fix player state desync on login (#59)
This commit is contained in:
parent
e2ba7cd296
commit
a8d26b6ce3
@ -857,6 +857,7 @@ struct TPlayer: TCreature {
|
|||||||
void SetQuestValue(int QuestNr, int Value);
|
void SetQuestValue(int QuestNr, int Value);
|
||||||
void CheckOutfit(void);
|
void CheckOutfit(void);
|
||||||
void CheckState(void);
|
void CheckState(void);
|
||||||
|
void SyncState(void);
|
||||||
void AddBuddy(const char *Name);
|
void AddBuddy(const char *Name);
|
||||||
void RemoveBuddy(uint32 CharacterID);
|
void RemoveBuddy(uint32 CharacterID);
|
||||||
void SendBuddies(void);
|
void SendBuddies(void);
|
||||||
|
|||||||
@ -205,7 +205,7 @@ TPlayer::TPlayer(TConnection *Connection, uint32 CharacterID):
|
|||||||
SendAmbiente(Connection);
|
SendAmbiente(Connection);
|
||||||
AnnounceChangedCreature(CharacterID, CREATURE_LIGHT_CHANGED);
|
AnnounceChangedCreature(CharacterID, CREATURE_LIGHT_CHANGED);
|
||||||
SendPlayerSkills(Connection);
|
SendPlayerSkills(Connection);
|
||||||
this->CheckState();
|
this->SyncState();
|
||||||
this->SendBuddies();
|
this->SendBuddies();
|
||||||
|
|
||||||
if(PlayerData->LastLoginTime != 0){
|
if(PlayerData->LastLoginTime != 0){
|
||||||
@ -750,7 +750,6 @@ void TPlayer::TakeOver(TConnection *Connection){
|
|||||||
strcpy(this->Guild, PlayerData->Guild);
|
strcpy(this->Guild, PlayerData->Guild);
|
||||||
strcpy(this->Rank, PlayerData->Rank);
|
strcpy(this->Rank, PlayerData->Rank);
|
||||||
strcpy(this->Title, PlayerData->Title);
|
strcpy(this->Title, PlayerData->Title);
|
||||||
this->OldState = 0;
|
|
||||||
|
|
||||||
this->CheckOutfit();
|
this->CheckOutfit();
|
||||||
this->ClearRequest();
|
this->ClearRequest();
|
||||||
@ -770,7 +769,7 @@ void TPlayer::TakeOver(TConnection *Connection){
|
|||||||
SendAmbiente(Connection);
|
SendAmbiente(Connection);
|
||||||
SendPlayerData(Connection);
|
SendPlayerData(Connection);
|
||||||
SendPlayerSkills(Connection);
|
SendPlayerSkills(Connection);
|
||||||
this->CheckState();
|
this->SyncState();
|
||||||
this->SendBuddies();
|
this->SendBuddies();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1254,6 +1253,16 @@ void TPlayer::CheckState(void){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TPlayer::SyncState(void){
|
||||||
|
// NOTE(fusion): This is only called after a new connection is established,
|
||||||
|
// when we know that the current client state is ZERO but `OldState` may not.
|
||||||
|
// It'll typically be the case in `TPlayer::TakeOver` but can also happen
|
||||||
|
// in the player constructor if `TPlayer::CheckState` is called from within
|
||||||
|
// any helper function before `TConnection::EnterGame` (see `BeginSendData`).
|
||||||
|
this->OldState = 0;
|
||||||
|
this->CheckState();
|
||||||
|
}
|
||||||
|
|
||||||
void TPlayer::AddBuddy(const char *Name){
|
void TPlayer::AddBuddy(const char *Name){
|
||||||
if(Name == NULL){
|
if(Name == NULL){
|
||||||
error("TPlayer::AddBuddy: Name ist NULL.\n");
|
error("TPlayer::AddBuddy: Name ist NULL.\n");
|
||||||
|
|||||||
@ -107,9 +107,6 @@ void TSkill::Load(int Act, int Max, int Min, int DAct, int MDAct,
|
|||||||
|
|
||||||
TCreature *Master = this->Master;
|
TCreature *Master = this->Master;
|
||||||
if(Master && Cycle != 0){
|
if(Master && Cycle != 0){
|
||||||
// NOTE(fusion): It seems we had `TSkillBase::SetTimer` inlined here.
|
|
||||||
// For whatever reason I hadn't noticed the error message referencing
|
|
||||||
// it, LOL.
|
|
||||||
Master->SetTimer(this->SkNr, Cycle, Count, MaxCount, FactorPercent);
|
Master->SetTimer(this->SkNr, Cycle, Count, MaxCount, FactorPercent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user