diff --git a/src/game/DBCEnums.h b/src/game/DBCEnums.h index ed1af0d7f..d296c2090 100644 --- a/src/game/DBCEnums.h +++ b/src/game/DBCEnums.h @@ -207,8 +207,12 @@ enum AchievementCriteriaTypes ACHIEVEMENT_CRITERIA_TYPE_ACCEPTED_SUMMONINGS = 114, ACHIEVEMENT_CRITERIA_TYPE_EARN_ACHIEVEMENT_POINTS = 115, ACHIEVEMENT_CRITERIA_TYPE_USE_LFD_TO_GROUP_WITH_PLAYERS = 119, - // 0..119 => 120 criteria types total - ACHIEVEMENT_CRITERIA_TYPE_TOTAL = 120, + // 120 + // 121 + // 122 + // 123 + // 0..123 => 124 criteria types total + ACHIEVEMENT_CRITERIA_TYPE_TOTAL = 124, }; enum AreaFlags diff --git a/src/game/Item.cpp b/src/game/Item.cpp index 10eef36eb..c062aada8 100644 --- a/src/game/Item.cpp +++ b/src/game/Item.cpp @@ -320,8 +320,8 @@ void Item::SaveToDB() } break; case ITEM_REMOVED: { - if (GetUInt32Value(ITEM_FIELD_ITEM_TEXT_ID) > 0 ) - CharacterDatabase.PExecute("DELETE FROM item_text WHERE id = '%u'", GetUInt32Value(ITEM_FIELD_ITEM_TEXT_ID)); + //if (GetUInt32Value(ITEM_FIELD_ITEM_TEXT_ID) > 0 ) + // CharacterDatabase.PExecute("DELETE FROM item_text WHERE id = '%u'", GetUInt32Value(ITEM_FIELD_ITEM_TEXT_ID)); CharacterDatabase.PExecute("DELETE FROM item_instance WHERE guid = '%u'", guid); if(HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED)) CharacterDatabase.PExecute("DELETE FROM character_gifts WHERE item_guid = '%u'", GetGUIDLow()); diff --git a/src/game/Mail.cpp b/src/game/Mail.cpp index 4bd864227..8f913009a 100644 --- a/src/game/Mail.cpp +++ b/src/game/Mail.cpp @@ -765,7 +765,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data ) return; } - bodyItem->SetUInt32Value( ITEM_FIELD_ITEM_TEXT_ID, itemTextId ); + //bodyItem->SetUInt32Value( ITEM_FIELD_ITEM_TEXT_ID, itemTextId ); bodyItem->SetUInt32Value( ITEM_FIELD_CREATOR, m->sender); sLog.outDetail("HandleMailCreateTextItem mailid=%u",mailId); diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index fe2ee3c65..3a618f4ac 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -1374,13 +1374,20 @@ void WorldSession::HandleTimeSyncResp( WorldPacket & recv_data ) { sLog.outDebug("CMSG_TIME_SYNC_RESP"); - uint32 counter, time_; - recv_data >> counter >> time_; + uint32 counter, clientTicks; + recv_data >> counter >> clientTicks; - // time_ seems always more than getMSTime() - uint32 diff = getMSTimeDiff(getMSTime(), time_); + if(counter != _player->m_timeSyncCounter - 1) + sLog.outDebug("Wrong time sync counter from player %s (cheater?)", _player->GetName()); - sLog.outDebug("response sent: counter %u, time %u (HEX: %X), ms. time %u, diff %u", counter, time_, time_, getMSTime(), diff); + sLog.outDebug("Time sync received: counter %u, client ticks %u, time since last sync %u", counter, clientTicks, clientTicks - _player->m_timeSyncClient); + + uint32 ourTicks = clientTicks + (getMSTime() - _player->m_timeSyncServer); + + // diff should be small + sLog.outDebug("Our ticks: %u, diff %u, latency %u", ourTicks, ourTicks - clientTicks, GetLatency()); + + _player->m_timeSyncClient = clientTicks; } void WorldSession::HandleResetInstancesOpcode( WorldPacket & /*recv_data*/ ) diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h index 2d0c25f20..95fa6b2b8 100644 --- a/src/game/Opcodes.h +++ b/src/game/Opcodes.h @@ -1315,19 +1315,31 @@ enum Opcodes UMSG_UNKNOWN_1278 = 0x4FE, // not found 10596 CMSG_READY_FOR_ACCOUNT_DATA_TIMES = 0x4FF, // lua: ReadyForAccountDataTimes CMSG_QUERY_QUESTS_COMPLETED = 0x500, // lua: QueryQuestsCompleted - SMSG_QUERY_QUESTS_COMPLETED_RESPONSE = 0x501, // response to 0x500 + SMSG_QUERY_QUESTS_COMPLETED_RESPONSE = 0x501, // response to CMSG_QUERY_QUESTS_COMPLETED CMSG_GM_REPORT_LAG = 0x502, // lua: GMReportLag - UMSG_UNKNOWN_1283 = 0x503, - UMSG_UNKNOWN_1284 = 0x504, - UMSG_UNKNOWN_1285 = 0x505, + UMSG_UNKNOWN_1283 = 0x503, // not found + UMSG_UNKNOWN_1284 = 0x504, // not found + UMSG_UNKNOWN_1285 = 0x505, // not found SMSG_UNKNOWN_1286 = 0x506, // ERR_CORPSE_IS_NOT_IN_INSTANCE = 0x1A8, - // ? 0x507 - // ? 0x508 CMSG SetAllowLowLevelRaid - // ? 0x509 CMSG SetAllowLowLevelRaid - // ? 0x50A SMSG camera shake? - // ? 0x50B SMSG some item update packet? - // ? 0x50C - NUM_MSG_TYPES = 0x50D + UMSG_UNKNOWN_1287 = 0x507, // not found + CMSG_UNKNOWN_1288 = 0x508, // lua: SetAllowLowLevelRaid + CMSG_UNKNOWN_1289 = 0x509, // lua: SetAllowLowLevelRaid + SMSG_UNKNOWN_1290 = 0x50A, // camera shake? + SMSG_UNKNOWN_1291 = 0x50B, // some item update packet? + UMSG_UNKNOWN_1292 = 0x50C, // not found + UMSG_UNKNOWN_1293 = 0x50D, // not found - disconnect + CMSG_UNKNOWN_1294 = 0x50E, // something with networking + UMSG_UNKNOWN_1295 = 0x50F, // not found - disconnect + CMSG_UNKNOWN_1296 = 0x510, // something with networking + UMSG_UNKNOWN_1297 = 0x511, // not found - crash + CMSG_UNKNOWN_1298 = 0x512, // something with networking + UMSG_UNKNOWN_1299 = 0x513, // not found + SMSG_UNKNOWN_1300 = 0x514, // SMSG + SMSG_UNKNOWN_1301 = 0x515, // event 0x204 (opens dungeon finder, probably for outdoor bosses) + SMSG_UNKNOWN_1302 = 0x516, // something with player movement (move event 58?) + CMSG_UNKNOWN_1303 = 0x517, // something with player movement (move event 58?) + SMSG_UNKNOWN_1304 = 0x518, // something with player movement (move event 58?), speed packet + NUM_MSG_TYPES = 0x519 }; /// Player state diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 09e3647d3..c2ce7f31e 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -1295,6 +1295,14 @@ void Player::Update( uint32 p_time ) m_zoneUpdateTimer -= p_time; } + if (m_timeSyncTimer > 0) + { + if(p_time >= m_timeSyncTimer) + SendTimeSync(); + else + m_timeSyncTimer -= p_time; + } + if (isAlive()) { // if no longer casting, set regen power as soon as it is up. @@ -1306,9 +1314,7 @@ void Player::Update( uint32 p_time ) } if (m_deathState == JUST_DIED) - { KillPlayer(); - } if(m_nextSave > 0) { @@ -1319,9 +1325,7 @@ void Player::Update( uint32 p_time ) sLog.outDetail("Player '%s' (GUID: %u) saved", GetName(), GetGUIDLow()); } else - { m_nextSave -= p_time; - } } //Handle Water/drowning @@ -18977,9 +18981,8 @@ void Player::SendInitialPacketsAfterAddToMap() GetZoneAndAreaId(newzone,newarea); UpdateZone(newzone,newarea); // also call SendInitWorldStates(); - WorldPacket data(SMSG_TIME_SYNC_REQ, 4); // new 2.0.x, enable movement - data << uint32(0x00000000); // on blizz it increments periodically - GetSession()->SendPacket(&data); + ResetTimeSync(); + SendTimeSync(); CastSpell(this, 836, true); // LOGINEFFECT @@ -21543,6 +21546,25 @@ void Player::UpdateVisibilityForPlayer() m->UpdateObjectsVisibilityFor(this, cell, p); } +void Player::ResetTimeSync() +{ + m_timeSyncCounter = 0; + m_timeSyncTimer = 0; + m_timeSyncClient = 0; + m_timeSyncServer = getMSTime(); +} + +void Player::SendTimeSync() +{ + WorldPacket data(SMSG_TIME_SYNC_REQ, 4); + data << uint32(m_timeSyncCounter++); + GetSession()->SendPacket(&data); + + // Schedule next sync in 10 sec + m_timeSyncTimer = 10000; + m_timeSyncServer = getMSTime(); +} + void Player::SendDuelCountdown(uint32 counter) { WorldPacket data(SMSG_DUEL_COUNTDOWN, 4); diff --git a/src/game/Player.h b/src/game/Player.h index dae63b5fb..89ff4cd07 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1096,6 +1096,9 @@ class MANGOS_DLL_SPEC Player : public Unit uint32 GetTotalPlayedTime() { return m_Played_time[PLAYED_TIME_TOTAL]; } uint32 GetLevelPlayedTime() { return m_Played_time[PLAYED_TIME_LEVEL]; } + void ResetTimeSync(); + void SendTimeSync(); + void setDeathState(DeathState s); // overwrite Unit::setDeathState void InnEnter (time_t time, uint32 mapid, float x, float y, float z) @@ -2563,6 +2566,11 @@ class MANGOS_DLL_SPEC Player : public Unit AchievementMgr m_achievementMgr; ReputationMgr m_reputationMgr; + + uint32 m_timeSyncCounter; + uint32 m_timeSyncTimer; + uint32 m_timeSyncClient; + uint32 m_timeSyncServer; }; void AddItemsSetItem(Player*player,Item *item); diff --git a/src/game/PlayerDump.cpp b/src/game/PlayerDump.cpp index cd0c13ac4..532ff4454 100644 --- a/src/game/PlayerDump.cpp +++ b/src/game/PlayerDump.cpp @@ -307,8 +307,8 @@ void PlayerDumpWriter::DumpTableContent(std::string& dump, uint32 guid, char con { case DTT_INVENTORY: StoreGUID(result,3,items); break; // item guid collection - case DTT_ITEM: - StoreGUID(result,0,ITEM_FIELD_ITEM_TEXT_ID,texts); break; + //case DTT_ITEM: + //StoreGUID(result,0,ITEM_FIELD_ITEM_TEXT_ID,texts); break; // item text id collection case DTT_PET: StoreGUID(result,0,pets); break; // pet guid collection @@ -584,8 +584,8 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s ROLLBACK(DUMP_FILE_BROKEN); if(!changetoknth(vals, ITEM_FIELD_OWNER+1, newguid)) ROLLBACK(DUMP_FILE_BROKEN); - if(!changetokGuid(vals, ITEM_FIELD_ITEM_TEXT_ID+1, itemTexts, sObjectMgr.m_ItemTextId,true)) - ROLLBACK(DUMP_FILE_BROKEN); + //if(!changetokGuid(vals, ITEM_FIELD_ITEM_TEXT_ID+1, itemTexts, sObjectMgr.m_ItemTextId,true)) + // ROLLBACK(DUMP_FILE_BROKEN); if(!changenth(line, 3, vals.c_str())) ROLLBACK(DUMP_FILE_BROKEN); break; diff --git a/src/game/QuestDef.h b/src/game/QuestDef.h index 9a042ba3f..a00797d59 100644 --- a/src/game/QuestDef.h +++ b/src/game/QuestDef.h @@ -107,9 +107,9 @@ enum __QuestGiverStatus { DIALOG_STATUS_NONE = 0, DIALOG_STATUS_UNAVAILABLE = 1, - DIALOG_STATUS_CHAT = 2, // 3.1 - may be changed - DIALOG_STATUS_UNK1 = 3, // 3.1 - DIALOG_STATUS_UNK2 = 4, // 3.1 + DIALOG_STATUS_CHAT = 2, // 3.1 LowLevelQuest + DIALOG_STATUS_UNK1 = 3, // 3.1 LowLevelRepeatableHandin + DIALOG_STATUS_UNK2 = 4, // 3.1 LowLevelRepeatableAvailable DIALOG_STATUS_INCOMPLETE = 5, DIALOG_STATUS_REWARD_REP = 6, DIALOG_STATUS_AVAILABLE_REP = 7, diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 2e8e08d09..9857aa38e 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -2646,9 +2646,9 @@ enum PetTameFailureReason // we need to stick to 1 version or half of the stuff will work for someone // others will not and opposite -// will only support WoW, WoW:TBC and WoW:WotLK 3.3.3 client build 11573... +// will only support WoW, WoW:TBC and WoW:WotLK 3.3.3 client build 11643... -#define EXPECTED_MANGOSD_CLIENT_BUILD {11573, 0} +#define EXPECTED_MANGOSD_CLIENT_BUILD {11643, 0} // max supported expansion level in mangosd // NOTE: not set it more that supported by targeted client version with all expansions installed diff --git a/src/game/UpdateFields.h b/src/game/UpdateFields.h index 7d0e931c5..c9ddbb90e 100644 --- a/src/game/UpdateFields.h +++ b/src/game/UpdateFields.h @@ -19,7 +19,7 @@ #ifndef _UPDATEFIELDS_AUTO_H #define _UPDATEFIELDS_AUTO_H -// Auto generated for version 0, 3, 3, 11573 +// Auto generated for version 0, 3, 3, 11643 enum EObjectFields { @@ -67,10 +67,10 @@ enum EItemFields ITEM_FIELD_ENCHANTMENT_12_3 = OBJECT_END + 0x0033, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC ITEM_FIELD_PROPERTY_SEED = OBJECT_END + 0x0034, // Size: 1, Type: INT, Flags: PUBLIC ITEM_FIELD_RANDOM_PROPERTIES_ID = OBJECT_END + 0x0035, // Size: 1, Type: INT, Flags: PUBLIC - ITEM_FIELD_ITEM_TEXT_ID = OBJECT_END + 0x0036, // Size: 1, Type: INT, Flags: OWNER - ITEM_FIELD_DURABILITY = OBJECT_END + 0x0037, // Size: 1, Type: INT, Flags: OWNER, ITEM_OWNER - ITEM_FIELD_MAXDURABILITY = OBJECT_END + 0x0038, // Size: 1, Type: INT, Flags: OWNER, ITEM_OWNER - ITEM_FIELD_CREATE_PLAYED_TIME = OBJECT_END + 0x0039, // Size: 1, Type: INT, Flags: PUBLIC + ITEM_FIELD_DURABILITY = OBJECT_END + 0x0036, // Size: 1, Type: INT, Flags: OWNER, ITEM_OWNER + ITEM_FIELD_MAXDURABILITY = OBJECT_END + 0x0037, // Size: 1, Type: INT, Flags: OWNER, ITEM_OWNER + ITEM_FIELD_CREATE_PLAYED_TIME = OBJECT_END + 0x0038, // Size: 1, Type: INT, Flags: PUBLIC + ITEM_FIELD_PAD = OBJECT_END + 0x0039, // Size: 1, Type: INT, Flags: NONE ITEM_END = OBJECT_END + 0x003A, }; @@ -389,7 +389,7 @@ enum EUnitFields PLAYER_FIELD_GLYPH_SLOTS_1 = UNIT_END + 0x048C, // Size: 6, Type: INT, Flags: PRIVATE PLAYER_FIELD_GLYPHS_1 = UNIT_END + 0x0492, // Size: 6, Type: INT, Flags: PRIVATE PLAYER_GLYPHS_ENABLED = UNIT_END + 0x0498, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_FIELD_PADDING = UNIT_END + 0x0499, // Size: 1, Type: INT, Flags: NONE + PLAYER_PET_SPELL_POWER = UNIT_END + 0x0499, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_END = UNIT_END + 0x049A, }; diff --git a/src/realmd/AuthCodes.h b/src/realmd/AuthCodes.h index f80818178..9a75f5935 100644 --- a/src/realmd/AuthCodes.h +++ b/src/realmd/AuthCodes.h @@ -49,7 +49,7 @@ enum eAuthResults #define EXPECTED_REALMD_CLIENT_BUILD \ { \ - 11573, /* 3.3.3 and higher */ \ + 11643, /* 3.3.3 and higher */ \ 11159, /* 3.3.0a */ \ 10505, /* 3.2.2a */ \ 8606, /* 2.4.3 */ \ diff --git a/src/shared/Auth/AuthCrypt.cpp b/src/shared/Auth/AuthCrypt.cpp index 782ae008b..f718b104b 100644 --- a/src/shared/Auth/AuthCrypt.cpp +++ b/src/shared/Auth/AuthCrypt.cpp @@ -33,11 +33,15 @@ AuthCrypt::~AuthCrypt() void AuthCrypt::Init(BigNumber *K) { - uint8 ServerEncryptionKey[SEED_KEY_SIZE] = { 0x22, 0xBE, 0xE5, 0xCF, 0xBB, 0x07, 0x64, 0xD9, 0x00, 0x45, 0x1B, 0xD0, 0x24, 0xB8, 0xD5, 0x45 }; + //uint8 ServerEncryptionKey[SEED_KEY_SIZE] = { 0x22, 0xBE, 0xE5, 0xCF, 0xBB, 0x07, 0x64, 0xD9, 0x00, 0x45, 0x1B, 0xD0, 0x24, 0xB8, 0xD5, 0x45 }; + uint8 ServerEncryptionKey[SEED_KEY_SIZE] = { 0xCC, 0x98, 0xAE, 0x04, 0xE8, 0x97, 0xEA, 0xCA, 0x12, 0xDD, 0xC0, 0x93, 0x42, 0x91, 0x53, 0x57 }; + HmacHash serverEncryptHmac(SEED_KEY_SIZE, (uint8*)ServerEncryptionKey); uint8 *encryptHash = serverEncryptHmac.ComputeHash(K); - uint8 ServerDecryptionKey[SEED_KEY_SIZE] = { 0xF4, 0x66, 0x31, 0x59, 0xFC, 0x83, 0x6E, 0x31, 0x31, 0x02, 0x51, 0xD5, 0x44, 0x31, 0x67, 0x98 }; + //uint8 ServerDecryptionKey[SEED_KEY_SIZE] = { 0xF4, 0x66, 0x31, 0x59, 0xFC, 0x83, 0x6E, 0x31, 0x31, 0x02, 0x51, 0xD5, 0x44, 0x31, 0x67, 0x98 }; + uint8 ServerDecryptionKey[SEED_KEY_SIZE] = { 0xC2, 0xB3, 0x72, 0x3C, 0xC6, 0xAE, 0xD9, 0xB5, 0x34, 0x3C, 0x53, 0xEE, 0x2F, 0x43, 0x67, 0xCE }; + HmacHash clientDecryptHmac(SEED_KEY_SIZE, (uint8*)ServerDecryptionKey); uint8 *decryptHash = clientDecryptHmac.ComputeHash(K);