[8078] Fixed typos in character data loading after recently added new field.

* Really use race/class/gender fields instead `data` field values.
* Load extra flags (gm mode onm gm fly mode, gm invisibility and etc) from proper field.

NOTE: recommedned reset characters.extra_flags field to 0 for all characters.
It can be corrupted in time login/logout before this fix.
This commit is contained in:
VladimirMangos 2009-06-26 04:01:31 +04:00 committed by tomrus88
parent 48caaaffcf
commit fc5dde85c4
3 changed files with 13 additions and 6 deletions

View file

@ -13944,9 +13944,11 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
// overwrite some data fields // overwrite some data fields
uint32 bytes0 = GetUInt32Value(UNIT_FIELD_BYTES_0) & 0xFF000000; uint32 bytes0 = GetUInt32Value(UNIT_FIELD_BYTES_0) & 0xFF000000;
bytes0 |= fields[4].GetUInt8(); bytes0 |= fields[4].GetUInt8(); // race
bytes0 |= fields[5].GetUInt8() << 8; bytes0 |= fields[5].GetUInt8() << 8; // class
bytes0 |= fields[6].GetUInt8() << 16; bytes0 |= fields[6].GetUInt8() << 16; // gender
SetUInt32Value(UNIT_FIELD_BYTES_0, bytes0);
SetUInt32Value(UNIT_FIELD_LEVEL, fields[7].GetUInt8()); SetUInt32Value(UNIT_FIELD_LEVEL, fields[7].GetUInt8());
SetUInt32Value(PLAYER_XP, fields[8].GetUInt32()); SetUInt32Value(PLAYER_XP, fields[8].GetUInt32());
SetUInt32Value(PLAYER_FIELD_COINAGE, fields[9].GetUInt32()); SetUInt32Value(PLAYER_FIELD_COINAGE, fields[9].GetUInt32());
@ -14207,7 +14209,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
//speed collect rest bonus in offline, in logout, in tavern, city (section/in hour) //speed collect rest bonus in offline, in logout, in tavern, city (section/in hour)
float bubble1 = 0.125; float bubble1 = 0.125;
if((int32)fields[23].GetUInt32() > 0) if(time_diff > 0)
{ {
float bubble = fields[24].GetUInt32() > 0 float bubble = fields[24].GetUInt32() > 0
? bubble1*sWorld.getRate(RATE_REST_OFFLINE_IN_TAVERN_OR_CITY) ? bubble1*sWorld.getRate(RATE_REST_OFFLINE_IN_TAVERN_OR_CITY)
@ -14231,7 +14233,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
m_taxi.LoadTaxiMask( fields[18].GetString() ); // must be before InitTaxiNodesForLevel m_taxi.LoadTaxiMask( fields[18].GetString() ); // must be before InitTaxiNodesForLevel
uint32 extraflags = fields[25].GetUInt32(); uint32 extraflags = fields[32].GetUInt32();
m_stableSlots = fields[33].GetUInt32(); m_stableSlots = fields[33].GetUInt32();
if(m_stableSlots > MAX_PET_STABLES) if(m_stableSlots > MAX_PET_STABLES)
@ -20346,6 +20348,10 @@ void Player::BuildTeleportAckMsg( WorldPacket *data, float x, float y, float z,
*data << uint32(0); *data << uint32(0);
} }
bool Player::HasMovementFlag( MovementFlags f ) const
{
return m_movementInfo.HasMovementFlag(f);
}
void Player::SendDuelCountdown(uint32 counter) void Player::SendDuelCountdown(uint32 counter)
{ {
WorldPacket data(SMSG_DUEL_COUNTDOWN, 4); WorldPacket data(SMSG_DUEL_COUNTDOWN, 4);

View file

@ -1974,6 +1974,7 @@ class MANGOS_DLL_SPEC Player : public Unit
/*** VARIOUS SYSTEMS ***/ /*** VARIOUS SYSTEMS ***/
/*********************************************************/ /*********************************************************/
MovementInfo m_movementInfo; MovementInfo m_movementInfo;
bool HasMovementFlag(MovementFlags f) const; // for script access to m_movementInfo.HasMovementFlag
void UpdateFallInformationIfNeed(MovementInfo const& minfo,uint16 opcode); void UpdateFallInformationIfNeed(MovementInfo const& minfo,uint16 opcode);
Unit *m_mover; Unit *m_mover;
void SetFallInformation(uint32 time, float z) void SetFallInformation(uint32 time, float z)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "8077" #define REVISION_NR "8078"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__