1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-28 15:17:46 +00:00

Merge remote-tracking branch 'SapphireServer/develop' into develop

This commit is contained in:
JeidoUran 2019-01-13 02:41:42 +01:00
commit eddb0bf07c
11 changed files with 54 additions and 30 deletions

View file

@ -185,7 +185,7 @@ enum ActorControlType : uint16_t
LogMsg = 0x205, // LogMessage?
AchievementMsg = 0x206,
SetItemLevel = 0x207, //updated 4.5 ( 0x209 before )
SetItemLevel = 0x209,
ChallengeEntryCompleteMsg = 0x20B,
ChallengeEntryUnlockMsg = 0x20C,

View file

@ -13,25 +13,20 @@ namespace Server {
* Structural representation of the packet sent by the server as response
* to a tell request
*/
struct FFXIVIpcTell :
FFXIVIpcBasePacket< Tell >
struct FFXIVIpcTell : FFXIVIpcBasePacket< Tell >
{
uint32_t u1;
uint16_t u2a;
uint16_t u2b;
uint64_t contentId;
uint16_t worldId;
uint8_t preName;
uint8_t u3a;
bool isGm;
char receipientName[32];
char msg[1031];
char msg[1029];
};
/**
* Structural representation of the packet sent by the server as response
* to a failed tell because of unavailable target player
*/
struct FFXIVIpcTellErrNotFound :
FFXIVIpcBasePacket< TellErrNotFound >
struct FFXIVIpcTellErrNotFound : FFXIVIpcBasePacket< TellErrNotFound >
{
char receipientName[32];
};

View file

@ -138,10 +138,10 @@ namespace Sapphire::Network::Packets
ActorOwner = 0x0187, // updated 4.5
PlayerStateFlags = 0x0188, // updated 4.5
PlayerClassInfo = 0x0189, // updated 4.5
ModelEquip = 0x018A, // updated 4.5
Examine = 0x018B, // updated 4.5
ModelEquip = 0x018B, // updated 4.5
Examine = 0x018C, // updated 4.5
CharaNameReq = 0x018D, // updated 4.5
SetLevelSync = 0x0186, // not updated for 4.4, not sure what it is anymore
SetLevelSync = 0x1186, // not updated for 4.4, not sure what it is anymore
ItemInfo = 0x0196, // updated 4.5
ContainerInfo = 0x0197, // updated 4.5

View file

@ -147,12 +147,16 @@ struct FFXIVIpcSetSearchInfo :
/* 0012 */ char searchComment[193];
};
struct FFXIVIpcTellHandler :
FFXIVIpcBasePacket< TellReq >
struct FFXIVIpcTellHandler : FFXIVIpcBasePacket< TellReq >
{
/* 0000 */ char pad_0000[4];
uint64_t contentId;
uint16_t worldId;
uint16_t u0A;
uint32_t u0C;
uint16_t worldId1;
uint8_t preName;
/* 0004 */ char targetPCName[32];
/* 0024 */ char message[1012];
/* 0024 */ char message[1029];
};
struct FFXIVIpcChatHandler :

View file

@ -853,7 +853,8 @@ struct FFXIVIpcInitUI : FFXIVIpcBasePacket< InitUI >
unsigned char companionDefRank;
unsigned char companionAttRank;
unsigned char companionHealRank;
unsigned char unknown21A[19];
unsigned char u19[2];
unsigned char mountGuideMask[17];
char name[32];
unsigned char unknownOword[16];
unsigned char unknownOw;
@ -906,7 +907,6 @@ struct FFXIVIpcInitUI : FFXIVIpcBasePacket< InitUI >
unsigned char clearedGuildhests[10];
unsigned char clearedTrials[8];
unsigned char clearedPvp[5];
unsigned char mountGuideMask[17];
unsigned short fishingRecordsFishWeight[26];
unsigned int exploratoryMissionNextTimestamp;
unsigned char pvpLevel;
@ -917,8 +917,7 @@ struct FFXIVIpcInitUI : FFXIVIpcBasePacket< InitUI >
* Structural representation of the packet sent by the server
* to set a players stats
*/
struct FFXIVIpcPlayerStats :
FFXIVIpcBasePacket< PlayerStats >
struct FFXIVIpcPlayerStats : FFXIVIpcBasePacket< PlayerStats >
{
uint32_t strength;
uint32_t dexterity;

View file

@ -40,10 +40,11 @@ Sapphire::Entity::BNpc::BNpc( FrameworkPtr pFw ) :
{
}
Sapphire::Entity::BNpc::BNpc( BNpcTemplatePtr pTemplate, float posX, float posY, float posZ,
Sapphire::Entity::BNpc::BNpc( uint32_t id, BNpcTemplatePtr pTemplate, float posX, float posY, float posZ, float rot,
uint8_t level, uint32_t maxHp, FrameworkPtr pFw ) :
Npc( ObjKind::BattleNpc, pFw )
{
m_id = id;
m_modelChara = pTemplate->getModelChara();
m_displayFlags = pTemplate->getDisplayFlags();
m_pose = pTemplate->getPose();
@ -56,6 +57,7 @@ Sapphire::Entity::BNpc::BNpc( BNpcTemplatePtr pTemplate, float posX, float posY,
m_pos.x = posX;
m_pos.y = posY;
m_pos.z = posZ;
m_rot = rot;
m_level = level;
m_maxHp = maxHp;

View file

@ -23,7 +23,8 @@ namespace Sapphire::Entity
public:
BNpc( FrameworkPtr pFw );
BNpc( BNpcTemplatePtr pTemplate, float posX, float posY, float posZ, uint8_t level, uint32_t maxHp, FrameworkPtr pFw );
BNpc( uint32_t id, BNpcTemplatePtr pTemplate, float posX, float posY, float posZ, float rot,
uint8_t level, uint32_t maxHp, FrameworkPtr pFw );
virtual ~BNpc() override;

View file

@ -432,13 +432,16 @@ void Sapphire::World::Manager::DebugCommandMgr::add( char* data, Entity::Player&
player.sendNotice( "Template {0} not found in cache!", params );
return;
}
auto pBNpc = std::make_shared< Entity::BNpc >( bNpcTemplate,
auto playerZone = player.getCurrentZone();
auto pBNpc = std::make_shared< Entity::BNpc >( playerZone->getNextActorId(),
bNpcTemplate,
player.getPos().x,
player.getPos().y,
player.getPos().z,
player.getRot(),
1, 1000, framework() );
auto playerZone = player.getCurrentZone();
//pBNpc->setCurrentZone( playerZone );
//pBNpc->setPos( player.getPos().x, player.getPos().y, player.getPos().z );

View file

@ -652,13 +652,16 @@ void Sapphire::Network::GameConnection::tellHandler( FrameworkPtr pFw,
auto tellPacket = makeChatPacket< FFXIVIpcTell >( player.getId() );
strcpy( tellPacket->data().msg, packet.data().message );
strcpy( tellPacket->data().receipientName, player.getName().c_str() );
// TODO: world id from server
tellPacket->data().contentId = player.getContentId();
tellPacket->data().worldId = 67;
// TODO: do these have a meaning?
//tellPacket.data().u1 = 0x92CD7337;
//tellPacket.data().u2a = 0x2E;
//tellPacket.data().u2b = 0x40;
if( player.isActingAsGm() )
{
tellPacket->data().isGm = true;
//tellPacket->data().isGm = true;
}
pTargetPlayer->queueChatPacket( tellPacket );

View file

@ -1,6 +1,7 @@
#include <stdio.h>
#include <vector>
#include <time.h>
#include <random>
#include <Logging/Logger.h>
#include <Util/Util.h>
@ -53,7 +54,8 @@ Sapphire::Zone::Zone() :
m_currentWeather( Weather::FairSkies ),
m_weatherOverride( Weather::None ),
m_lastMobUpdate( 0 ),
m_nextEObjId( 0x400D0000 )
m_nextEObjId( 0x400D0000 ),
m_nextActorId( 0x500D0000 )
{
}
@ -741,6 +743,12 @@ uint32_t Sapphire::Zone::getNextEObjId()
return ++m_nextEObjId;
}
uint32_t Sapphire::Zone::getNextActorId()
{
return ++m_nextActorId;
}
Sapphire::Entity::EventObjectPtr Sapphire::Zone::registerEObj( const std::string& name, uint32_t objectId, uint32_t mapLink,
uint8_t state, FFXIVARR_POSITION3 pos, float scale,
float rotation )
@ -804,6 +812,10 @@ bool Sapphire::Zone::loadSpawnGroups()
void Sapphire::Zone::updateSpawnPoints()
{
std::random_device rd;
std::mt19937 mt( rd() );
std::uniform_real_distribution< float > dist( 0.0, PI * 2 );
for( auto& group : m_spawnGroups )
{
for( auto& point : group.getSpawnPointList() )
@ -820,12 +832,14 @@ void Sapphire::Zone::updateSpawnPoints()
continue;
}
//Logger::error( "No template found for templateId#{0}", group.getTemplateId() );
uint32_t random = rand() % 20;
auto pBNpc = std::make_shared< Entity::BNpc >( bNpcTemplate,
auto pBNpc = std::make_shared< Entity::BNpc >( getNextActorId(),
bNpcTemplate,
point->getPosX(),
point->getPosY(),
point->getPosZ(),
dist( mt ),
group.getLevel(),
group.getMaxHp(), m_pFw );
point->setLinkedBNpc( pBNpc );

View file

@ -57,6 +57,7 @@ namespace Sapphire
std::map< uint8_t, int32_t > m_weatherRateMap;
uint32_t m_nextEObjId;
uint32_t m_nextActorId;
FrameworkPtr m_pFw;
std::vector< Entity::SpawnGroup > m_spawnGroups;
@ -128,6 +129,8 @@ namespace Sapphire
uint32_t getNextEObjId();
uint32_t getNextActorId();
const std::string& getName() const;
const std::string& getInternalName() const;