From 7df637245808472088d28f68dd7cb4f334105150 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Wed, 24 Jun 2009 10:23:02 +0400 Subject: [PATCH 001/132] Updated to client 3.2.0.10026, not tested. --- src/game/DBCStructure.h | 34 ++++++++----------- src/game/DBCfmt.h | 8 ++--- src/game/DynamicObject.cpp | 5 +-- src/game/ItemPrototype.h | 7 ++-- src/game/ObjectMgr.cpp | 4 +-- src/game/Opcodes.cpp | 37 +++++++++++++++++++-- src/game/Opcodes.h | 59 +++++++++++++++++++++++++-------- src/game/Player.cpp | 1 + src/game/SharedDefines.h | 6 +++- src/game/UpdateFields.h | 68 ++++++++++++++++++-------------------- src/realmd/AuthCodes.h | 4 +-- 11 files changed, 148 insertions(+), 85 deletions(-) diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index 27646fda2..324d92998 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -1080,21 +1080,12 @@ struct MapEntry // 55 intro text flags uint32 multimap_id; // 56 // 57 - //chat* unknownText1[16]; // 58-73 unknown empty text fields, possible normal Intro text. - // 74 text flags - //chat* heroicIntroText[16]; // 75-90 heroic mode requirement text - // 91 text flags - //chat* unknownText2[16]; // 92-107 unknown empty text fields - // 108 text flags - int32 entrance_map; // 109 map_id of entrance map - float entrance_x; // 110 entrance x coordinate (if exist single entry) - float entrance_y; // 111 entrance y coordinate (if exist single entry) - uint32 resetTimeRaid; // 112 - uint32 resetTimeHeroic; // 113 - // 114 all 0 - // 115 -1, 0 and 720 - uint32 addon; // 116 (0-original maps,1-tbc addon) - // 117 some kind of time? + int32 entrance_map; // 58 map_id of entrance map + float entrance_x; // 59 entrance x coordinate (if exist single entry) + float entrance_y; // 60 entrance y coordinate (if exist single entry) + // 61 -1, 0 and 720 + uint32 addon; // 62 (0-original maps,1-tbc addon) + // 63 some kind of time? // Helpers uint32 Expansion() const { return addon; } @@ -1106,8 +1097,8 @@ struct MapEntry bool IsBattleGround() const { return map_type == MAP_BATTLEGROUND; } bool IsBattleArena() const { return map_type == MAP_ARENA; } bool IsBattleGroundOrArena() const { return map_type == MAP_BATTLEGROUND || map_type == MAP_ARENA; } - bool SupportsHeroicMode() const { return resetTimeHeroic != 0; } - bool HasResetTime() const { return resetTimeHeroic || resetTimeRaid; } + bool SupportsHeroicMode() const { return true; } + bool HasResetTime() const { return true; } bool IsMountAllowed() const { @@ -1159,7 +1150,7 @@ struct ScalingStatValuesEntry { uint32 Id; uint32 Level; - uint32 ssdMultiplier[5]; // Multiplier for ScalingStatDistribution + uint32 ssdMultiplier[4]; // Multiplier for ScalingStatDistribution uint32 armorMod[4]; // Armor for level uint32 dpsMod[6]; // DPS mod for level uint32 spellBonus; // not sure.. TODO: need more info about @@ -1172,8 +1163,8 @@ struct ScalingStatValuesEntry if(mask & 0x00000001) return ssdMultiplier[0]; if(mask & 0x00000002) return ssdMultiplier[1]; if(mask & 0x00000004) return ssdMultiplier[2]; - if(mask & 0x00000008) return ssdMultiplier[3]; - if(mask & 0x00000010) return ssdMultiplier[4]; + //if(mask & 0x00000008) return ssdMultiplier[3]; + if(mask & 0x00000010) return ssdMultiplier[3]; } return 0; } @@ -1298,8 +1289,11 @@ struct SpellEntry uint32 AttributesEx4; // 8 m_attributesExD uint32 AttributesEx5; // 9 m_attributesExE //uint32 AttributesEx6; // 10 m_attributesExF not used + // new 3.2 uint32 Stances; // 11 m_shapeshiftMask + // new 3.2 uint32 StancesNot; // 12 m_shapeshiftExclude + // new 3.2 uint32 Targets; // 13 m_targets uint32 TargetCreatureType; // 14 m_targetCreatureType uint32 RequiresSpellFocus; // 15 m_requiresSpellFocus diff --git a/src/game/DBCfmt.h b/src/game/DBCfmt.h index 29fa11944..3e7ae5442 100644 --- a/src/game/DBCfmt.h +++ b/src/game/DBCfmt.h @@ -65,25 +65,25 @@ const char Itemfmt[]="niiiiiii"; const char ItemBagFamilyfmt[]="nxxxxxxxxxxxxxxxxx"; //const char ItemDisplayTemplateEntryfmt[]="nxxxxxxxxxxixxxxxxxxxxx"; //const char ItemCondExtCostsEntryfmt[]="xiii"; -const char ItemExtendedCostEntryfmt[]="niiiiiiiiiiiiix"; +const char ItemExtendedCostEntryfmt[]="niixiiiiiiiiiiix"; const char ItemLimitCategoryEntryfmt[]="nxxxxxxxxxxxxxxxxxix"; const char ItemRandomPropertiesfmt[]="nxiiiiixxxxxxxxxxxxxxxxx"; const char ItemRandomSuffixfmt[]="nxxxxxxxxxxxxxxxxxxiiiiiiiiii"; const char ItemSetEntryfmt[]="dssssssssssssssssxxxxxxxxxxxxxxxxxxiiiiiiiiiiiiiiiiii"; const char LockEntryfmt[]="niiiiiiiiiiiiiiiiiiiiiiiixxxxxxxx"; const char MailTemplateEntryfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; -const char MapEntryfmt[]="nxixssssssssssssssssxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiffiixxix"; +const char MapEntryfmt[]="nxixssssssssssssssssxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixiffxix"; const char MovieEntryfmt[]="nxx"; const char QuestSortEntryfmt[]="nxxxxxxxxxxxxxxxxx"; const char RandomPropertiesPointsfmt[]="niiiiiiiiiiiiiii"; const char ScalingStatDistributionfmt[]="niiiiiiiiiiiiiiiiiiiii"; -const char ScalingStatValuesfmt[]="iniiiiiiiiiiiiiiiii"; +const char ScalingStatValuesfmt[]="iniiiiiiiiiiiiiiiixxxxxx"; const char SkillLinefmt[]="nixssssssssssssssssxxxxxxxxxxxxxxxxxxixxxxxxxxxxxxxxxxxi"; const char SkillLineAbilityfmt[]="niiiixxiiiiixx"; const char SoundEntriesfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; const char SpellCastTimefmt[]="nixx"; const char SpellDurationfmt[]="niii"; -const char SpellEntryfmt[]="niiiiiiiiixiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifxiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffffffiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiiiiiiiifffiiiiiiiiiiiiixssssssssssssssssxssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiiiiiiiiiiixfffxxxiiiiixx"; +const char SpellEntryfmt[]="niiiiiiiiixxixixiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifxiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffffffiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiiiiiiiifffiiiiiiiiiiiiixssssssssssssssssxssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiiiiiiiiiiixfffxxxiiiiixxxxxx"; const char SpellFocusObjectfmt[]="nxxxxxxxxxxxxxxxxx"; const char SpellItemEnchantmentfmt[]="nxiiiiiixxxiiissssssssssssssssxiiiixxx"; const char SpellItemEnchantmentConditionfmt[]="nbbbbbxxxxxbbbbbbbbbbiiiiiXXXXX"; diff --git a/src/game/DynamicObject.cpp b/src/game/DynamicObject.cpp index 89c6a7545..38310b638 100644 --- a/src/game/DynamicObject.cpp +++ b/src/game/DynamicObject.cpp @@ -31,7 +31,7 @@ DynamicObject::DynamicObject() : WorldObject() m_objectType |= TYPEMASK_DYNAMICOBJECT; m_objectTypeId = TYPEID_DYNAMICOBJECT; - m_updateFlag = (UPDATEFLAG_HIGHGUID | UPDATEFLAG_HAS_POSITION); + m_updateFlag = (UPDATEFLAG_HIGHGUID | UPDATEFLAG_HAS_POSITION | UPDATEFLAG_POSITION); m_valuesCount = DYNAMICOBJECT_END; } @@ -73,9 +73,6 @@ bool DynamicObject::Create( uint32 guidlow, Unit *caster, uint32 spellId, uint32 SetUInt32Value( DYNAMICOBJECT_BYTES, 0x00000001 ); SetUInt32Value( DYNAMICOBJECT_SPELLID, spellId ); SetFloatValue( DYNAMICOBJECT_RADIUS, radius); - SetFloatValue( DYNAMICOBJECT_POS_X, x ); - SetFloatValue( DYNAMICOBJECT_POS_Y, y ); - SetFloatValue( DYNAMICOBJECT_POS_Z, z ); SetUInt32Value( DYNAMICOBJECT_CASTTIME, getMSTime() ); // new 2.4.0 m_aliveDuration = duration; diff --git a/src/game/ItemPrototype.h b/src/game/ItemPrototype.h index 9974030ac..b34488553 100644 --- a/src/game/ItemPrototype.h +++ b/src/game/ItemPrototype.h @@ -63,10 +63,13 @@ enum ItemModType ITEM_MOD_SPELL_DAMAGE_DONE = 42, ITEM_MOD_MANA_REGENERATION = 43, ITEM_MOD_ARMOR_PENETRATION_RATING = 44, - ITEM_MOD_SPELL_POWER = 45 + ITEM_MOD_SPELL_POWER = 45, + ITEM_MOD_HEALTH_REGEN = 46, + ITEM_MOD_SPELL_PENETRATION = 47, + ITEM_MOD_BLOCK_VALUE = 48 }; -#define MAX_ITEM_MOD 46 +#define MAX_ITEM_MOD 49 enum ItemSpelltriggerType { diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index c05a324f6..81c3fba9e 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -4396,7 +4396,7 @@ void ObjectMgr::LoadInstanceTemplate() if(temp->reset_delay == 0) { // use defaults from the DBC - if(entry->resetTimeHeroic) // for both raid and non raids, read above + /*if(entry->resetTimeHeroic) // for both raid and non raids, read above { temp->reset_delay = entry->resetTimeHeroic / DAY; } @@ -4404,7 +4404,7 @@ void ObjectMgr::LoadInstanceTemplate() // for normal raid only { temp->reset_delay = entry->resetTimeRaid / DAY; - } + }*/ } // the reset_delay must be at least one day diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp index 51eb509d0..6d6e08c0d 100644 --- a/src/game/Opcodes.cpp +++ b/src/game/Opcodes.cpp @@ -1253,6 +1253,39 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x4C8*/ { "SMSG_UNKNOWN_1224", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x4C9*/ { "UMSG_UNKNOWN_1225", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4CA*/ { "UMSG_UNKNOWN_1226", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4CB*/ { "CMSG_EQUIPMENT_SET_USE", STATUS_LOGGEDIN, &WorldSession::HandleEquipmentSetUse }, - /*0x4CC*/ { "SMSG_EQUIPMENT_SET_USE_RESULT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, + /*0x4CB*/ { "UMSG_UNKNOWN_1227", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4CC*/ { "UMSG_UNKNOWN_1228", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4CD*/ { "UMSG_UNKNOWN_1229", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4CE*/ { "UMSG_UNKNOWN_1230", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4CF*/ { "UMSG_UNKNOWN_1231", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4D0*/ { "UMSG_UNKNOWN_1232", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4D1*/ { "UMSG_UNKNOWN_1233", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4D2*/ { "UMSG_UNKNOWN_1234", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4D3*/ { "UMSG_UNKNOWN_1235", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4D4*/ { "UMSG_UNKNOWN_1236", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4D5*/ { "CMSG_EQUIPMENT_SET_USE", STATUS_LOGGEDIN, &WorldSession::HandleEquipmentSetUse }, + /*0x4D6*/ { "SMSG_EQUIPMENT_SET_USE_RESULT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, + /*0x4D7*/ { "UMSG_UNKNOWN_1239", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4D8*/ { "UMSG_UNKNOWN_1240", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4D9*/ { "UMSG_UNKNOWN_1241", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4DA*/ { "UMSG_UNKNOWN_1242", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4DB*/ { "UMSG_UNKNOWN_1243", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4DC*/ { "UMSG_UNKNOWN_1244", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4DD*/ { "UMSG_UNKNOWN_1245", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4DE*/ { "UMSG_UNKNOWN_1246", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4DF*/ { "UMSG_UNKNOWN_1247", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4E0*/ { "UMSG_UNKNOWN_1248", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4E1*/ { "UMSG_UNKNOWN_1249", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4E2*/ { "UMSG_UNKNOWN_1250", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4E3*/ { "UMSG_UNKNOWN_1251", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4E4*/ { "UMSG_UNKNOWN_1252", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4E5*/ { "UMSG_UNKNOWN_1253", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4E6*/ { "UMSG_UNKNOWN_1254", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4E7*/ { "UMSG_UNKNOWN_1255", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4E8*/ { "UMSG_UNKNOWN_1256", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4E9*/ { "UMSG_UNKNOWN_1257", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4EA*/ { "UMSG_UNKNOWN_1258", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4EB*/ { "UMSG_UNKNOWN_1259", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4EC*/ { "UMSG_UNKNOWN_1260", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4ED*/ { "UMSG_UNKNOWN_1261", STATUS_NEVER, &WorldSession::Handle_NULL }, }; diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h index bc6c8ea59..a68fd3f11 100644 --- a/src/game/Opcodes.h +++ b/src/game/Opcodes.h @@ -517,8 +517,8 @@ enum Opcodes CMSG_SETSHEATHED = 0x1E0, SMSG_COOLDOWN_CHEAT = 0x1E1, SMSG_SPELL_DELAYED = 0x1E2, - CMSG_PLAYER_MACRO_OBSOLETE = 0x1E3, - SMSG_PLAYER_MACRO_OBSOLETE = 0x1E4, + CMSG_QUEST_POI_QUERY = 0x1E3, + SMSG_QUEST_POI_QUERY_RESPONSE = 0x1E4, CMSG_GHOST = 0x1E5, CMSG_GM_INVIS = 0x1E6, SMSG_INVALID_PROMOTION_CODE = 0x1E7, @@ -1253,17 +1253,50 @@ enum Opcodes SMSG_TALENTS_INFO = 0x4C0, // SMSG, talents related CMSG_LEARN_PREVIEW_TALENTS = 0x4C1, // CMSG, lua: LearnPreviewTalents (for player?) CMSG_LEARN_PREVIEW_TALENTS_PET = 0x4C2, // CMSG, lua: LearnPreviewTalents (for pet?) - UMSG_UNKNOWN_1219 = 0x4C3, // not found - UMSG_UNKNOWN_1220 = 0x4C4, // not found - UMSG_UNKNOWN_1221 = 0x4C5, // not found - UMSG_UNKNOWN_1222 = 0x4C6, // not found - SMSG_UNKNOWN_1223 = 0x4C7, // uint64, arena pet? - SMSG_UNKNOWN_1224 = 0x4C8, // uint32 "Can't change arena team..." - UMSG_UNKNOWN_1225 = 0x4C9, // not found - UMSG_UNKNOWN_1226 = 0x4CA, // not found - CMSG_EQUIPMENT_SET_USE = 0x4CB, // CMSG, lua: UseEquipmentSet - SMSG_EQUIPMENT_SET_USE_RESULT = 0x4CC, // SMSG, UseEquipmentSetResult? - NUM_MSG_TYPES = 0x4CD + UMSG_UNKNOWN_1219 = 0x4C3, // not found 3.2 + UMSG_UNKNOWN_1220 = 0x4C4, // not found 3.2 + UMSG_UNKNOWN_1221 = 0x4C5, // not found 3.2 + UMSG_UNKNOWN_1222 = 0x4C6, // not found 3.2 + SMSG_UNKNOWN_1223 = 0x4C7, // uint64, arena pet? 3.2 + SMSG_UNKNOWN_1224 = 0x4C8, // uint32 "Can't change arena team..." 3.2 + UMSG_UNKNOWN_1225 = 0x4C9, // not found 3.2 + UMSG_UNKNOWN_1226 = 0x4CA, // not found 3.2 + UMSG_UNKNOWN_1227 = 0x4CB, // not found 3.2 + UMSG_UNKNOWN_1228 = 0x4CC, // not found 3.2 + SMSG_UNKNOWN_1229 = 0x4CD, // SMSG, any opcode? + SMSG_UNKNOWN_1230 = 0x4CE, // SMSG, movement related + UMSG_UNKNOWN_1231 = 0x4CF, // not found 3.2 + SMSG_UNKNOWN_1232 = 0x4D0, // SMSG, movement related + UMSG_UNKNOWN_1233 = 0x4D1, // not found 3.2 + SMSG_UNKNOWN_1234 = 0x4D2, // SMSG, movement related + SMSG_UNKNOWN_1235 = 0x4D3, // SMSG, movement related + SMSG_UNKNOWN_1236 = 0x4D4, // SMSG, movement related + CMSG_EQUIPMENT_SET_USE = 0x4D5, // CMSG, lua: UseEquipmentSet + SMSG_EQUIPMENT_SET_USE_RESULT = 0x4D6, // SMSG, UseEquipmentSetResult? + UMSG_UNKNOWN_1239 = 0x4D7, // not found 3.2 + SMSG_UNKNOWN_1240 = 0x4D8, // SMSG, uint64, string + CMSG_UNKNOWN_1241 = 0x4D9, // lua: CreateCharacter + SMSG_UNKNOWN_1242 = 0x4DA, // response to 1241 + UMSG_UNKNOWN_1243 = 0x4DB, // not found 3.2 + UMSG_UNKNOWN_1244 = 0x4DC, // not found 3.2 + UMSG_UNKNOWN_1245 = 0x4DD, // not found 3.2 + SMSG_UNKNOWN_1246 = 0x4DE, // uint32 + CMSG_UNKNOWN_1247 = 0x4DF, // lua: BattlefieldMgrEntryInviteResponse + SMSG_UNKNOWN_1248 = 0x4E0, // uint32, uint8, uint8 + SMSG_UNKNOWN_1249 = 0x4E1, // uint32 + CMSG_UNKNOWN_1250 = 0x4E2, // lua: BattlefieldMgrQueueInviteResponse + CMSG_UNKNOWN_1251 = 0x4E3, // lua: BattlefieldMgrQueueRequest + SMSG_UNKNOWN_1252 = 0x4E4, // uint32, uint8 + SMSG_UNKNOWN_1253 = 0x4E5, // uint32 + SMSG_UNKNOWN_1254 = 0x4E6, // uint32, uint32, uint8 + CMSG_UNKNOWN_1255 = 0x4E7, // lua: BattlefieldMgrExitRequest + SMSG_UNKNOWN_1256 = 0x4E8, // uint32, uint32 + UMSG_UNKNOWN_1257 = 0x4E9, // not found 3.2 + MSG_UNKNOWN_1258 = 0x4EA, // lua: SetRaidDificulty + UMSG_UNKNOWN_1259 = 0x4EB, // not found 3.2 + SMSG_TOGGLE_XP_GAIN = 0x4EC, // enable/disable XP gain console message + UMSG_UNKNOWN_1261 = 0x4ED, // not found 3.2 + NUM_MSG_TYPES = 0x4EE }; /// Player state diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 170f8779f..e4eecf09d 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -1467,6 +1467,7 @@ bool Player::BuildEnumData( QueryResult * result, WorldPacket * p_data ) // character customize (flags?) *p_data << uint32(atLoginFlags & AT_LOGIN_CUSTOMIZE ? 1 : 0); *p_data << uint8(1); // unknown + *p_data << uint8(0); // 3.2 // Pets info { diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index ffa61ecd5..e4e89b963 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -869,7 +869,11 @@ enum SpellCastResult SPELL_FAILED_ITEM_AT_MAX_CHARGES = 178, SPELL_FAILED_NOT_IN_BARBERSHOP = 179, SPELL_FAILED_FISHING_TOO_LOW = 180, - SPELL_FAILED_UNKNOWN = 181, + SPELL_FAILED_ITEM_ENCHANT_TRADE_WINDOW = 181, + SPELL_FAILED_SUMMON_PENDING = 182, + SPELL_FAILED_MAX_SOCKETS = 183, + SPELL_FAILED_PET_CAN_RENAME = 184, + SPELL_FAILED_UNKNOWN = 185, SPELL_CAST_OK = 255 //custom value, don't must be send to client }; diff --git a/src/game/UpdateFields.h b/src/game/UpdateFields.h index 0ae175ae9..7a3ef58a8 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 3, 1, 3, 9947 +// Auto generated for version 0, 2, 0, 10026 enum EObjectFields { @@ -70,7 +70,7 @@ enum EItemFields 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_PAD = OBJECT_END + 0x0039, // Size: 1, Type: INT, Flags: NONE + ITEM_FIELD_CREATE_PLAYED_TIME = OBJECT_END + 0x0039, // Size: 1, Type: INT, Flags: PUBLIC ITEM_END = OBJECT_END + 0x003A, }; @@ -323,7 +323,7 @@ enum EUnitFields PLAYER_VISIBLE_ITEM_19_ENTRYID = UNIT_END + 0x0092, // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_19_ENCHANTMENT = UNIT_END + 0x0093, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_CHOSEN_TITLE = UNIT_END + 0x0094, // Size: 1, Type: INT, Flags: PUBLIC - PLAYER_FIELD_PAD_0 = UNIT_END + 0x0095, // Size: 1, Type: INT, Flags: NONE + PLAYER_FAKE_INEBRIATION = UNIT_END + 0x0095, // Size: 1, Type: INT, Flags: PUBLIC PLAYER_FIELD_INV_SLOT_HEAD = UNIT_END + 0x0096, // Size: 46, Type: LONG, Flags: PRIVATE PLAYER_FIELD_PACK_SLOT_1 = UNIT_END + 0x00C4, // Size: 32, Type: LONG, Flags: PRIVATE PLAYER_FIELD_BANK_SLOT_1 = UNIT_END + 0x00E4, // Size: 56, Type: LONG, Flags: PRIVATE @@ -361,32 +361,34 @@ enum EUnitFields PLAYER_FIELD_MOD_DAMAGE_DONE_NEG = UNIT_END + 0x03EC, // Size: 7, Type: INT, Flags: PRIVATE PLAYER_FIELD_MOD_DAMAGE_DONE_PCT = UNIT_END + 0x03F3, // Size: 7, Type: INT, Flags: PRIVATE PLAYER_FIELD_MOD_HEALING_DONE_POS = UNIT_END + 0x03FA, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_FIELD_MOD_TARGET_RESISTANCE = UNIT_END + 0x03FB, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE = UNIT_END + 0x03FC, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_FIELD_BYTES = UNIT_END + 0x03FD, // Size: 1, Type: BYTES, Flags: PRIVATE - PLAYER_AMMO_ID = UNIT_END + 0x03FE, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_SELF_RES_SPELL = UNIT_END + 0x03FF, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_FIELD_PVP_MEDALS = UNIT_END + 0x0400, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_FIELD_BUYBACK_PRICE_1 = UNIT_END + 0x0401, // Size: 12, Type: INT, Flags: PRIVATE - PLAYER_FIELD_BUYBACK_TIMESTAMP_1 = UNIT_END + 0x040D, // Size: 12, Type: INT, Flags: PRIVATE - PLAYER_FIELD_KILLS = UNIT_END + 0x0419, // Size: 1, Type: TWO_SHORT, Flags: PRIVATE - PLAYER_FIELD_TODAY_CONTRIBUTION = UNIT_END + 0x041A, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_FIELD_YESTERDAY_CONTRIBUTION = UNIT_END + 0x041B, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_FIELD_LIFETIME_HONORBALE_KILLS = UNIT_END + 0x041C, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_FIELD_BYTES2 = UNIT_END + 0x041D, // Size: 1, Type: BYTES, Flags: PRIVATE - PLAYER_FIELD_WATCHED_FACTION_INDEX = UNIT_END + 0x041E, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_FIELD_COMBAT_RATING_1 = UNIT_END + 0x041F, // Size: 25, Type: INT, Flags: PRIVATE - PLAYER_FIELD_ARENA_TEAM_INFO_1_1 = UNIT_END + 0x0438, // Size: 18, Type: INT, Flags: PRIVATE - PLAYER_FIELD_HONOR_CURRENCY = UNIT_END + 0x044A, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_FIELD_ARENA_CURRENCY = UNIT_END + 0x044B, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_FIELD_MAX_LEVEL = UNIT_END + 0x044C, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_FIELD_DAILY_QUESTS_1 = UNIT_END + 0x044D, // Size: 25, Type: INT, Flags: PRIVATE - PLAYER_RUNE_REGEN_1 = UNIT_END + 0x0466, // Size: 4, Type: FLOAT, Flags: PRIVATE - PLAYER_NO_REAGENT_COST_1 = UNIT_END + 0x046A, // Size: 3, Type: INT, Flags: PRIVATE - PLAYER_FIELD_GLYPH_SLOTS_1 = UNIT_END + 0x046D, // Size: 6, Type: INT, Flags: PRIVATE - PLAYER_FIELD_GLYPHS_1 = UNIT_END + 0x0473, // Size: 6, Type: INT, Flags: PRIVATE - PLAYER_GLYPHS_ENABLED = UNIT_END + 0x0479, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_END = UNIT_END + 0x047A, + PLAYER_FIELD_MOD_HEALING_PCT = UNIT_END + 0x03FB, // Size: 1, Type: FLOAT, Flags: PRIVATE + PLAYER_FIELD_MOD_HEALING_DONE_PCT = UNIT_END + 0x03FC, // Size: 1, Type: FLOAT, Flags: PRIVATE + PLAYER_FIELD_MOD_TARGET_RESISTANCE = UNIT_END + 0x03FD, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE = UNIT_END + 0x03FE, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_FIELD_BYTES = UNIT_END + 0x03FF, // Size: 1, Type: BYTES, Flags: PRIVATE + PLAYER_AMMO_ID = UNIT_END + 0x0400, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_SELF_RES_SPELL = UNIT_END + 0x0401, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_FIELD_PVP_MEDALS = UNIT_END + 0x0402, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_FIELD_BUYBACK_PRICE_1 = UNIT_END + 0x0403, // Size: 12, Type: INT, Flags: PRIVATE + PLAYER_FIELD_BUYBACK_TIMESTAMP_1 = UNIT_END + 0x040F, // Size: 12, Type: INT, Flags: PRIVATE + PLAYER_FIELD_KILLS = UNIT_END + 0x041B, // Size: 1, Type: TWO_SHORT, Flags: PRIVATE + PLAYER_FIELD_TODAY_CONTRIBUTION = UNIT_END + 0x041C, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_FIELD_YESTERDAY_CONTRIBUTION = UNIT_END + 0x041D, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_FIELD_LIFETIME_HONORBALE_KILLS = UNIT_END + 0x041E, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_FIELD_BYTES2 = UNIT_END + 0x041F, // Size: 1, Type: BYTES, Flags: PRIVATE + PLAYER_FIELD_WATCHED_FACTION_INDEX = UNIT_END + 0x0420, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_FIELD_COMBAT_RATING_1 = UNIT_END + 0x0421, // Size: 25, Type: INT, Flags: PRIVATE + PLAYER_FIELD_ARENA_TEAM_INFO_1_1 = UNIT_END + 0x043A, // Size: 18, Type: INT, Flags: PRIVATE + PLAYER_FIELD_HONOR_CURRENCY = UNIT_END + 0x044C, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_FIELD_ARENA_CURRENCY = UNIT_END + 0x044D, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_FIELD_MAX_LEVEL = UNIT_END + 0x044E, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_FIELD_DAILY_QUESTS_1 = UNIT_END + 0x044F, // Size: 25, Type: INT, Flags: PRIVATE + PLAYER_RUNE_REGEN_1 = UNIT_END + 0x0468, // Size: 4, Type: FLOAT, Flags: PRIVATE + PLAYER_NO_REAGENT_COST_1 = UNIT_END + 0x046C, // Size: 3, Type: INT, Flags: PRIVATE + PLAYER_FIELD_GLYPH_SLOTS_1 = UNIT_END + 0x046F, // Size: 6, Type: INT, Flags: PRIVATE + PLAYER_FIELD_GLYPHS_1 = UNIT_END + 0x0475, // Size: 6, Type: INT, Flags: PRIVATE + PLAYER_GLYPHS_ENABLED = UNIT_END + 0x047B, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_END = UNIT_END + 0x047C, }; enum EGameObjectFields @@ -408,12 +410,8 @@ enum EDynamicObjectFields DYNAMICOBJECT_BYTES = OBJECT_END + 0x0002, // Size: 1, Type: BYTES, Flags: PUBLIC DYNAMICOBJECT_SPELLID = OBJECT_END + 0x0003, // Size: 1, Type: INT, Flags: PUBLIC DYNAMICOBJECT_RADIUS = OBJECT_END + 0x0004, // Size: 1, Type: FLOAT, Flags: PUBLIC - DYNAMICOBJECT_POS_X = OBJECT_END + 0x0005, // Size: 1, Type: FLOAT, Flags: PUBLIC - DYNAMICOBJECT_POS_Y = OBJECT_END + 0x0006, // Size: 1, Type: FLOAT, Flags: PUBLIC - DYNAMICOBJECT_POS_Z = OBJECT_END + 0x0007, // Size: 1, Type: FLOAT, Flags: PUBLIC - DYNAMICOBJECT_FACING = OBJECT_END + 0x0008, // Size: 1, Type: FLOAT, Flags: PUBLIC - DYNAMICOBJECT_CASTTIME = OBJECT_END + 0x0009, // Size: 1, Type: INT, Flags: PUBLIC - DYNAMICOBJECT_END = OBJECT_END + 0x000A, + DYNAMICOBJECT_CASTTIME = OBJECT_END + 0x0005, // Size: 1, Type: INT, Flags: PUBLIC + DYNAMICOBJECT_END = OBJECT_END + 0x0006, }; enum ECorpseFields diff --git a/src/realmd/AuthCodes.h b/src/realmd/AuthCodes.h index 1940ecd93..53183244c 100644 --- a/src/realmd/AuthCodes.h +++ b/src/realmd/AuthCodes.h @@ -66,8 +66,8 @@ enum LoginResult // 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.1.3 client build 9947... +// will only support WoW, WoW:TBC and WoW:WotLK 3.2.0 client build 10026... -#define EXPECTED_MANGOS_CLIENT_BUILD {9947, 0} +#define EXPECTED_MANGOS_CLIENT_BUILD {10026, 0} #endif From 02bcc56919a1b16f750d0c0b030561500f8acaad Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Thu, 25 Jun 2009 19:08:53 +0400 Subject: [PATCH 002/132] Added placeholders for new battlegrounds, some other stuff. --- sql/320/1_creature_template.sql | 3 ++ sql/320/2_gameobject_template.sql | 3 ++ sql/320/3_item_template.sql | 2 + sql/320/4_groups.sql | 2 + sql/320/5_battleground_tempalate.sql | 2 + src/game/AchievementMgr.cpp | 4 +- src/game/BattleGround.h | 9 ++-- src/game/BattleGroundABG.cpp | 81 ++++++++++++++++++++++++++++ src/game/BattleGroundABG.h | 54 +++++++++++++++++++ src/game/BattleGroundIC.cpp | 81 ++++++++++++++++++++++++++++ src/game/BattleGroundIC.h | 54 +++++++++++++++++++ src/game/BattleGroundMgr.cpp | 22 +++++++- src/game/CalendarHandler.cpp | 2 +- src/game/Creature.h | 2 +- src/game/DBCStructure.h | 6 +++ src/game/DuelHandler.cpp | 14 +++-- src/game/GameObject.h | 2 +- src/game/Group.cpp | 66 +++++++++++++++-------- src/game/Group.h | 11 ++-- src/game/InstanceSaveMgr.cpp | 4 +- src/game/ItemHandler.cpp | 1 + src/game/ItemPrototype.h | 1 + src/game/Level1.cpp | 6 +-- src/game/Level3.cpp | 12 ++--- src/game/Makefile.am | 4 ++ src/game/Map.cpp | 4 +- src/game/Map.h | 2 +- src/game/MapInstanced.cpp | 8 +-- src/game/MapManager.cpp | 4 +- src/game/MiscHandler.cpp | 61 ++++++++++++++++++--- src/game/MovementHandler.cpp | 4 +- src/game/ObjectMgr.cpp | 6 +-- src/game/Opcodes.cpp | 2 +- src/game/Opcodes.h | 2 +- src/game/Player.cpp | 48 +++++++++++------ src/game/Player.h | 13 +++-- src/game/QueryHandler.cpp | 8 +-- src/game/SharedDefines.h | 21 ++++++-- src/game/WorldSession.h | 1 + src/shared/Database/SQLStorage.cpp | 12 ++--- win/VC100/game.vcxproj | 4 ++ win/VC80/game.vcproj | 16 ++++++ win/VC90/game.vcproj | 16 ++++++ 43 files changed, 567 insertions(+), 113 deletions(-) create mode 100644 sql/320/1_creature_template.sql create mode 100644 sql/320/2_gameobject_template.sql create mode 100644 sql/320/3_item_template.sql create mode 100644 sql/320/4_groups.sql create mode 100644 sql/320/5_battleground_tempalate.sql create mode 100644 src/game/BattleGroundABG.cpp create mode 100644 src/game/BattleGroundABG.h create mode 100644 src/game/BattleGroundIC.cpp create mode 100644 src/game/BattleGroundIC.h diff --git a/sql/320/1_creature_template.sql b/sql/320/1_creature_template.sql new file mode 100644 index 000000000..ae645af12 --- /dev/null +++ b/sql/320/1_creature_template.sql @@ -0,0 +1,3 @@ +alter table `creature_template` + add column `questItem5` int(11) UNSIGNED DEFAULT '0' NOT NULL after `questItem4`, + add column `questItem6` int(11) UNSIGNED DEFAULT '0' NOT NULL after `questItem5`; diff --git a/sql/320/2_gameobject_template.sql b/sql/320/2_gameobject_template.sql new file mode 100644 index 000000000..5d5a13cd3 --- /dev/null +++ b/sql/320/2_gameobject_template.sql @@ -0,0 +1,3 @@ +alter table `gameobject_template` + add column `questItem5` int(11) UNSIGNED DEFAULT '0' NOT NULL after `questItem4`, + add column `questItem6` int(11) UNSIGNED DEFAULT '0' NOT NULL after `questItem5`; diff --git a/sql/320/3_item_template.sql b/sql/320/3_item_template.sql new file mode 100644 index 000000000..c89d6da3a --- /dev/null +++ b/sql/320/3_item_template.sql @@ -0,0 +1,2 @@ +alter table `item_template` + add column `Faction` int(11) UNSIGNED DEFAULT '0' NOT NULL after `Flags`; diff --git a/sql/320/4_groups.sql b/sql/320/4_groups.sql new file mode 100644 index 000000000..0bce0691f --- /dev/null +++ b/sql/320/4_groups.sql @@ -0,0 +1,2 @@ +alter table `groups` + add column `raiddifficulty` int(11) UNSIGNED DEFAULT '0' NOT NULL after `difficulty`; diff --git a/sql/320/5_battleground_tempalate.sql b/sql/320/5_battleground_tempalate.sql new file mode 100644 index 000000000..699a0158d --- /dev/null +++ b/sql/320/5_battleground_tempalate.sql @@ -0,0 +1,2 @@ +insert into `battleground_template`(`id`,`MinPlayersPerTeam`,`MaxPlayersPerTeam`,`MinLvl`,`MaxLvl`,`AllianceStartLoc`,`AllianceStartO`,`HordeStartLoc`,`HordeStartO`) values (30,20,40,71,80,1485,0,1486,0); +insert into `battleground_template`(`id`,`MinPlayersPerTeam`,`MaxPlayersPerTeam`,`MinLvl`,`MaxLvl`,`AllianceStartLoc`,`AllianceStartO`,`HordeStartLoc`,`HordeStartO`) values (32,0,40,0,80,0,0,0,0); diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp index f350d6df5..cc8e8e6bc 100644 --- a/src/game/AchievementMgr.cpp +++ b/src/game/AchievementMgr.cpp @@ -191,7 +191,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) } return true; case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY: - if (difficalty.difficalty >= TOTAL_DIFFICULTIES) + if (difficalty.difficalty >= TOTAL_DUNGEON_DIFFICULTIES) { sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY (%u) have wrong difficulty in value1 (%u), ignore.", criteria->ID, criteria->requiredType,dataType,difficalty.difficalty); @@ -841,7 +841,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui if(!achievIdForDangeon[j][2]) break; // for } - else if(GetPlayer()->GetDifficulty()==DIFFICULTY_NORMAL) + else if(GetPlayer()->GetDungeonDifficulty()==DUNGEON_DIFFICULTY_NORMAL) { // dungeon in normal mode accepted if(!achievIdForDangeon[j][1]) diff --git a/src/game/BattleGround.h b/src/game/BattleGround.h index 91eb32382..7d64036e2 100644 --- a/src/game/BattleGround.h +++ b/src/game/BattleGround.h @@ -146,11 +146,12 @@ enum BattleGroundQueueTypeId BATTLEGROUND_QUEUE_AB = 3, BATTLEGROUND_QUEUE_EY = 4, BATTLEGROUND_QUEUE_SA = 5, - BATTLEGROUND_QUEUE_2v2 = 6, - BATTLEGROUND_QUEUE_3v3 = 7, - BATTLEGROUND_QUEUE_5v5 = 8 + BATTLEGROUND_QUEUE_IC = 6, + BATTLEGROUND_QUEUE_2v2 = 7, + BATTLEGROUND_QUEUE_3v3 = 8, + BATTLEGROUND_QUEUE_5v5 = 9 }; -#define MAX_BATTLEGROUND_QUEUE_TYPES 9 +#define MAX_BATTLEGROUND_QUEUE_TYPES 10 enum BGQueueIdBasedOnLevel // queue_id for level ranges { diff --git a/src/game/BattleGroundABG.cpp b/src/game/BattleGroundABG.cpp new file mode 100644 index 000000000..0d934659f --- /dev/null +++ b/src/game/BattleGroundABG.cpp @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "Player.h" +#include "BattleGround.h" +#include "BattleGroundABG.h" +#include "Language.h" + +BattleGroundABG::BattleGroundABG() +{ + //TODO FIX ME! + m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES; + m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE; + m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE; + m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN; +} + +BattleGroundABG::~BattleGroundABG() +{ + +} + +void BattleGroundABG::Update(uint32 diff) +{ + BattleGround::Update(diff); +} + +void BattleGroundABG::StartingEventCloseDoors() +{ +} + +void BattleGroundABG::StartingEventOpenDoors() +{ +} + +void BattleGroundABG::AddPlayer(Player *plr) +{ + BattleGround::AddPlayer(plr); + //create score and add it to map, default values are set in constructor + BattleGroundABGScore* sc = new BattleGroundABGScore; + + m_PlayerScores[plr->GetGUID()] = sc; +} + +void BattleGroundABG::RemovePlayer(Player* /*plr*/,uint64 /*guid*/) +{ + +} + +void BattleGroundABG::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/) +{ + // this is wrong way to implement these things. On official it done by gameobject spell cast. + if (GetStatus() != STATUS_IN_PROGRESS) + return; +} + +void BattleGroundABG::UpdatePlayerScore(Player* Source, uint32 type, uint32 value) +{ + + std::map::iterator itr = m_PlayerScores.find(Source->GetGUID()); + + if(itr == m_PlayerScores.end()) // player not found... + return; + + BattleGround::UpdatePlayerScore(Source,type,value); +} diff --git a/src/game/BattleGroundABG.h b/src/game/BattleGroundABG.h new file mode 100644 index 000000000..7d3e65ed3 --- /dev/null +++ b/src/game/BattleGroundABG.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __BATTLEGROUNDABG_H +#define __BATTLEGROUNDABG_H + +class BattleGround; + +class BattleGroundABGScore : public BattleGroundScore +{ + public: + BattleGroundABGScore() {}; + virtual ~BattleGroundABGScore() {}; +}; + +class BattleGroundABG : public BattleGround +{ + friend class BattleGroundMgr; + + public: + BattleGroundABG(); + ~BattleGroundABG(); + void Update(uint32 diff); + + /* inherited from BattlegroundClass */ + virtual void AddPlayer(Player *plr); + virtual void StartingEventCloseDoors(); + virtual void StartingEventOpenDoors(); + + void RemovePlayer(Player *plr,uint64 guid); + void HandleAreaTrigger(Player *Source, uint32 Trigger); + //bool SetupBattleGround(); + + /* Scorekeeping */ + void UpdatePlayerScore(Player *Source, uint32 type, uint32 value); + + private: +}; +#endif diff --git a/src/game/BattleGroundIC.cpp b/src/game/BattleGroundIC.cpp new file mode 100644 index 000000000..829dbcdb1 --- /dev/null +++ b/src/game/BattleGroundIC.cpp @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "Player.h" +#include "BattleGround.h" +#include "BattleGroundIC.h" +#include "Language.h" + +BattleGroundIC::BattleGroundIC() +{ + //TODO FIX ME! + m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES; + m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE; + m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE; + m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN; +} + +BattleGroundIC::~BattleGroundIC() +{ + +} + +void BattleGroundIC::Update(uint32 diff) +{ + BattleGround::Update(diff); +} + +void BattleGroundIC::StartingEventCloseDoors() +{ +} + +void BattleGroundIC::StartingEventOpenDoors() +{ +} + +void BattleGroundIC::AddPlayer(Player *plr) +{ + BattleGround::AddPlayer(plr); + //create score and add it to map, default values are set in constructor + BattleGroundICScore* sc = new BattleGroundICScore; + + m_PlayerScores[plr->GetGUID()] = sc; +} + +void BattleGroundIC::RemovePlayer(Player* /*plr*/,uint64 /*guid*/) +{ + +} + +void BattleGroundIC::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/) +{ + // this is wrong way to implement these things. On official it done by gameobject spell cast. + if (GetStatus() != STATUS_IN_PROGRESS) + return; +} + +void BattleGroundIC::UpdatePlayerScore(Player* Source, uint32 type, uint32 value) +{ + + std::map::iterator itr = m_PlayerScores.find(Source->GetGUID()); + + if(itr == m_PlayerScores.end()) // player not found... + return; + + BattleGround::UpdatePlayerScore(Source,type,value); +} diff --git a/src/game/BattleGroundIC.h b/src/game/BattleGroundIC.h new file mode 100644 index 000000000..9ca0f6d13 --- /dev/null +++ b/src/game/BattleGroundIC.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __BATTLEGROUNDIC_H +#define __BATTLEGROUNDIC_H + +class BattleGround; + +class BattleGroundICScore : public BattleGroundScore +{ + public: + BattleGroundICScore() {}; + virtual ~BattleGroundICScore() {}; +}; + +class BattleGroundIC : public BattleGround +{ + friend class BattleGroundMgr; + + public: + BattleGroundIC(); + ~BattleGroundIC(); + void Update(uint32 diff); + + /* inherited from BattlegroundClass */ + virtual void AddPlayer(Player *plr); + virtual void StartingEventCloseDoors(); + virtual void StartingEventOpenDoors(); + + void RemovePlayer(Player *plr,uint64 guid); + void HandleAreaTrigger(Player *Source, uint32 Trigger); + //bool SetupBattleGround(); + + /* Scorekeeping */ + void UpdatePlayerScore(Player *Source, uint32 type, uint32 value); + + private: +}; +#endif diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index df9276fe4..49f17630b 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -31,6 +31,8 @@ #include "BattleGroundSA.h" #include "BattleGroundDS.h" #include "BattleGroundRV.h" +#include "BattleGroundIC.h" +#include "BattleGroundABG.h" #include "MapManager.h" #include "Map.h" #include "MapInstanced.h" @@ -1385,6 +1387,8 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg) case BATTLEGROUND_SA: // wotlk case BATTLEGROUND_DS: // wotlk case BATTLEGROUND_RV: // wotlk + case BATTLEGROUND_IC: // wotlk + case BATTLEGROUND_ABG: // wotlk *data << (int32)0; // 0 break; default: @@ -1562,6 +1566,12 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI case BATTLEGROUND_RV: bg = new BattleGroundRV(*(BattleGroundRV*)bg_template); break; + case BATTLEGROUND_IC: + bg = new BattleGroundIC(*(BattleGroundIC*)bg_template); + break; + case BATTLEGROUND_ABG: + bg = new BattleGroundABG(*(BattleGroundABG*)bg_template); + break; default: //error, but it is handled few lines above return 0; @@ -1607,6 +1617,8 @@ uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsA case BATTLEGROUND_SA: bg = new BattleGroundSA; break; case BATTLEGROUND_DS: bg = new BattleGroundDS; break; case BATTLEGROUND_RV: bg = new BattleGroundRV; break; + case BATTLEGROUND_IC: bg = new BattleGroundIC; break; + case BATTLEGROUND_ABG: bg = new BattleGroundABG; break; default:bg = new BattleGround; break; // placeholder for non implemented BG } @@ -1701,7 +1713,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds() AStartLoc[2] = start->z; AStartLoc[3] = fields[6].GetFloat(); } - else if (bgTypeID == BATTLEGROUND_AA) + else if (bgTypeID == BATTLEGROUND_AA || bgTypeID == BATTLEGROUND_ABG) { AStartLoc[0] = 0; AStartLoc[1] = 0; @@ -1724,7 +1736,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds() HStartLoc[2] = start->z; HStartLoc[3] = fields[8].GetFloat(); } - else if (bgTypeID == BATTLEGROUND_AA) + else if (bgTypeID == BATTLEGROUND_AA || bgTypeID == BATTLEGROUND_ABG) { HStartLoc[0] = 0; HStartLoc[1] = 0; @@ -1909,6 +1921,10 @@ BattleGroundQueueTypeId BattleGroundMgr::BGQueueTypeId(BattleGroundTypeId bgType return BATTLEGROUND_QUEUE_EY; case BATTLEGROUND_SA: return BATTLEGROUND_QUEUE_SA; + case BATTLEGROUND_IC: + return BATTLEGROUND_QUEUE_IC; + case BATTLEGROUND_ABG: + return BATTLEGROUND_QUEUE_NONE; case BATTLEGROUND_AA: case BATTLEGROUND_NA: case BATTLEGROUND_RL: @@ -1945,6 +1961,8 @@ BattleGroundTypeId BattleGroundMgr::BGTemplateId(BattleGroundQueueTypeId bgQueue return BATTLEGROUND_EY; case BATTLEGROUND_QUEUE_SA: return BATTLEGROUND_SA; + case BATTLEGROUND_QUEUE_IC: + return BATTLEGROUND_IC; case BATTLEGROUND_QUEUE_2v2: case BATTLEGROUND_QUEUE_3v3: case BATTLEGROUND_QUEUE_5v5: diff --git a/src/game/CalendarHandler.cpp b/src/game/CalendarHandler.cpp index 4d3f9f074..a700b8857 100644 --- a/src/game/CalendarHandler.cpp +++ b/src/game/CalendarHandler.cpp @@ -45,7 +45,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket &recv_data) size_t p_counter = data.wpos(); data << uint32(counter); // instance save count - for(int i = 0; i < TOTAL_DIFFICULTIES; ++i) + for(int i = 0; i < TOTAL_DUNGEON_DIFFICULTIES; ++i) { for (Player::BoundInstancesMap::const_iterator itr = _player->m_boundInstances[i].begin(); itr != _player->m_boundInstances[i].end(); ++itr) { diff --git a/src/game/Creature.h b/src/game/Creature.h index 01259c3ea..b76685828 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -216,7 +216,7 @@ struct CreatureInfo float unk16; float unk17; bool RacialLeader; - uint32 questItems[4]; + uint32 questItems[6]; uint32 movementId; bool RegenHealth; uint32 equipmentId; diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index 324d92998..5f9434e3b 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -1001,6 +1001,7 @@ struct ItemExtendedCostEntry uint32 ID; // 0 extended-cost entry id uint32 reqhonorpoints; // 1 required honor points uint32 reqarenapoints; // 2 required arena points + //uint32 unk1; // 3.2 uint32 reqitem[5]; // 3-7 required item id uint32 reqitemcount[5]; // 8-12 required count of 1st item uint32 reqpersonalarenarating; // 13 required personal arena rating @@ -1155,6 +1156,7 @@ struct ScalingStatValuesEntry uint32 dpsMod[6]; // DPS mod for level uint32 spellBonus; // not sure.. TODO: need more info about uint32 feralBonus; // Feral AP bonus + //uint32 unk1[6]; // 3.2 uint32 getssdMultiplier(uint32 mask) const { @@ -1389,6 +1391,10 @@ struct SpellEntry uint32 runeCostID; // 229 m_runeCostID //uint32 spellMissileID; // 230 m_spellMissileID not used //uint32 PowerDisplayId; // 231 PowerDisplay.dbc, new in 3.1 + //uint32 unk1; // 3.2 + //uint32 unk2; // 3.2 + //uint32 unk3; // 3.2 + //uint32 unk4; // 3.2 // helpers int32 CalculateSimpleValue(uint8 eff) const { return EffectBasePoints[eff]+int32(EffectBaseDice[eff]); } diff --git a/src/game/DuelHandler.cpp b/src/game/DuelHandler.cpp index e9e1fa0b6..fcceae73e 100644 --- a/src/game/DuelHandler.cpp +++ b/src/game/DuelHandler.cpp @@ -26,7 +26,7 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket) { - CHECK_PACKET_SIZE(recvPacket,8); + CHECK_PACKET_SIZE(recvPacket, 8); uint64 guid; Player *pl; @@ -44,22 +44,20 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket) return; //sLog.outDebug( "WORLD: received CMSG_DUEL_ACCEPTED" ); - DEBUG_LOG("Player 1 is: %u (%s)", pl->GetGUIDLow(),pl->GetName()); - DEBUG_LOG("Player 2 is: %u (%s)", plTarget->GetGUIDLow(),plTarget->GetName()); + DEBUG_LOG("Player 1 is: %u (%s)", pl->GetGUIDLow(), pl->GetName()); + DEBUG_LOG("Player 2 is: %u (%s)", plTarget->GetGUIDLow(), plTarget->GetName()); time_t now = time(NULL); pl->duel->startTimer = now; plTarget->duel->startTimer = now; - WorldPacket data(SMSG_DUEL_COUNTDOWN, 4); - data << (uint32)3000; // 3 seconds - pl->GetSession()->SendPacket(&data); - plTarget->GetSession()->SendPacket(&data); + pl->SendDuelCountdown(3000); + plTarget->SendDuelCountdown(3000); } void WorldSession::HandleDuelCancelledOpcode(WorldPacket& recvPacket) { - CHECK_PACKET_SIZE(recvPacket,8); + CHECK_PACKET_SIZE(recvPacket, 8); //sLog.outDebug( "WORLD: received CMSG_DUEL_CANCELLED" ); diff --git a/src/game/GameObject.h b/src/game/GameObject.h index 8f2e1908f..569d8059d 100644 --- a/src/game/GameObject.h +++ b/src/game/GameObject.h @@ -45,7 +45,7 @@ struct GameObjectInfo uint32 faction; uint32 flags; float size; - uint32 questItems[4]; + uint32 questItems[6]; union // different GO types have different data field { //0 GAMEOBJECT_TYPE_DOOR diff --git a/src/game/Group.cpp b/src/game/Group.cpp index 0e4cb4e87..3ea0a204e 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -69,7 +69,7 @@ Group::~Group() // it is undefined whether objectmgr (which stores the groups) or instancesavemgr // will be unloaded first so we must be prepared for both cases // this may unload some instance saves - for(uint8 i = 0; i < TOTAL_DIFFICULTIES; ++i) + for(uint8 i = 0; i < TOTAL_DUNGEON_DIFFICULTIES; ++i) for(BoundInstancesMap::iterator itr2 = m_boundInstances[i].begin(); itr2 != m_boundInstances[i].end(); ++itr2) itr2->second.save->RemoveGroup(this); @@ -92,11 +92,16 @@ bool Group::Create(const uint64 &guid, const char * name) m_lootThreshold = ITEM_QUALITY_UNCOMMON; m_looterGuid = guid; - m_difficulty = DIFFICULTY_NORMAL; + m_dungeonDifficulty = DUNGEON_DIFFICULTY_NORMAL; + m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL; if(!isBGGroup()) { Player *leader = objmgr.GetPlayer(guid); - if(leader) m_difficulty = leader->GetDifficulty(); + if(leader) + { + m_dungeonDifficulty = leader->GetDungeonDifficulty(); + m_raidDifficulty = leader->GetRaidDifficulty(); + } Player::ConvertInstancesToGroup(leader, this, guid); @@ -104,10 +109,10 @@ bool Group::Create(const uint64 &guid, const char * name) CharacterDatabase.BeginTransaction(); CharacterDatabase.PExecute("DELETE FROM groups WHERE leaderGuid ='%u'", GUID_LOPART(m_leaderGuid)); CharacterDatabase.PExecute("DELETE FROM group_member WHERE leaderGuid ='%u'", GUID_LOPART(m_leaderGuid)); - CharacterDatabase.PExecute("INSERT INTO groups(leaderGuid,mainTank,mainAssistant,lootMethod,looterGuid,lootThreshold,icon1,icon2,icon3,icon4,icon5,icon6,icon7,icon8,isRaid,difficulty) " + CharacterDatabase.PExecute("INSERT INTO groups(leaderGuid,mainTank,mainAssistant,lootMethod,looterGuid,lootThreshold,icon1,icon2,icon3,icon4,icon5,icon6,icon7,icon8,isRaid,difficulty,raiddifficulty) " "VALUES('%u','%u','%u','%u','%u','%u','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','%u','%u')", GUID_LOPART(m_leaderGuid), GUID_LOPART(m_mainTank), GUID_LOPART(m_mainAssistant), uint32(m_lootMethod), - GUID_LOPART(m_looterGuid), uint32(m_lootThreshold), m_targetIcons[0], m_targetIcons[1], m_targetIcons[2], m_targetIcons[3], m_targetIcons[4], m_targetIcons[5], m_targetIcons[6], m_targetIcons[7], isRaidGroup(), m_difficulty); + GUID_LOPART(m_looterGuid), uint32(m_lootThreshold), m_targetIcons[0], m_targetIcons[1], m_targetIcons[2], m_targetIcons[3], m_targetIcons[4], m_targetIcons[5], m_targetIcons[6], m_targetIcons[7], isRaidGroup(), m_dungeonDifficulty, m_raidDifficulty); } if(!AddMember(guid, name)) @@ -127,8 +132,8 @@ bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult *result, bool if(!result) { external = false; - // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 - result = CharacterDatabase.PQuery("SELECT mainTank, mainAssistant, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, isRaid, difficulty FROM groups WHERE leaderGuid ='%u'", GUID_LOPART(leaderGuid)); + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + result = CharacterDatabase.PQuery("SELECT mainTank, mainAssistant, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, isRaid, difficulty, raiddifficulty FROM groups WHERE leaderGuid ='%u'", GUID_LOPART(leaderGuid)); if(!result) return false; } @@ -147,7 +152,8 @@ bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult *result, bool if (m_groupType == GROUPTYPE_RAID) _initRaidSubGroupsCounter(); - m_difficulty = (*result)[14].GetUInt8(); + m_dungeonDifficulty = (*result)[14].GetUInt8(); + m_raidDifficulty = (*result)[15].GetUInt8(); m_mainTank = (*result)[0].GetUInt64(); m_mainAssistant = (*result)[1].GetUInt64(); m_lootMethod = (LootMethod)(*result)[2].GetUInt8(); @@ -291,16 +297,16 @@ bool Group::AddMember(const uint64 &guid, const char* name) // including raid/heroic instances that they are not permanently bound to! player->ResetInstances(INSTANCE_RESET_GROUP_JOIN); - if(player->getLevel() >= LEVELREQUIREMENT_HEROIC && player->GetDifficulty() != GetDifficulty() ) + if(player->getLevel() >= LEVELREQUIREMENT_HEROIC && player->GetDungeonDifficulty() != GetDungeonDifficulty() ) { - player->SetDifficulty(m_difficulty); + player->SetDungeonDifficulty(m_dungeonDifficulty); player->SendDungeonDifficulty(true); } } player->SetGroupUpdateFlag(GROUP_UPDATE_FULL); UpdatePlayerOutOfRange(player); - // quest related GO state dependent from raid memebership + // quest related GO state dependent from raid membership if(isRaidGroup()) player->UpdateForQuestWorldObjects(); } @@ -364,7 +370,7 @@ void Group::ChangeLeader(const uint64 &guid) { member_citerator slot = _getMemberCSlot(guid); - if(slot==m_memberSlots.end()) + if(slot == m_memberSlots.end()) return; _setLeader(guid); @@ -955,7 +961,8 @@ void Group::SendUpdate() data << (uint8)m_lootMethod; // loot method data << (uint64)m_looterGuid; // looter guid data << (uint8)m_lootThreshold; // loot threshold - data << (uint8)m_difficulty; // Heroic Mod Group + data << (uint8)m_dungeonDifficulty; // Dungeon Difficulty + data << (uint8)m_raidDifficulty; // Raid Difficulty } player->GetSession()->SendPacket( &data ); } @@ -1072,7 +1079,7 @@ bool Group::_addMember(const uint64 &guid, const char* name, bool isAssistant, u else player->SetGroup(this, group); // if the same group invites the player back, cancel the homebind timer - InstanceGroupBind *bind = GetBoundInstance(player->GetMapId(), player->GetDifficulty()); + InstanceGroupBind *bind = GetBoundInstance(player->GetMapId(), player->GetDungeonDifficulty()); if(bind && bind->save->GetInstanceId() == player->GetInstanceId()) player->m_InstanceValid = true; } @@ -1158,7 +1165,7 @@ void Group::_setLeader(const uint64 &guid) Player *player = objmgr.GetPlayer(slot->guid); if(player) { - for(uint8 i = 0; i < TOTAL_DIFFICULTIES; ++i) + for(uint8 i = 0; i < TOTAL_DUNGEON_DIFFICULTIES; ++i) { for(BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end();) { @@ -1445,21 +1452,36 @@ void Roll::targetObjectBuildLink() getTarget()->addLootValidatorRef(this); } -void Group::SetDifficulty(uint8 difficulty) +void Group::SetDungeonDifficulty(uint8 difficulty) { - m_difficulty = difficulty; - if(!isBGGroup()) CharacterDatabase.PExecute("UPDATE groups SET difficulty = %u WHERE leaderGuid ='%u'", m_difficulty, GUID_LOPART(m_leaderGuid)); + m_dungeonDifficulty = difficulty; + if(!isBGGroup()) CharacterDatabase.PExecute("UPDATE groups SET difficulty = %u WHERE leaderGuid ='%u'", m_dungeonDifficulty, GUID_LOPART(m_leaderGuid)); for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) { Player *player = itr->getSource(); if(!player->GetSession() || player->getLevel() < LEVELREQUIREMENT_HEROIC) continue; - player->SetDifficulty(difficulty); + player->SetDungeonDifficulty(difficulty); player->SendDungeonDifficulty(true); } } +void Group::SetRaidDifficulty(uint8 difficulty) +{ + m_raidDifficulty = difficulty; + if(!isBGGroup()) CharacterDatabase.PExecute("UPDATE groups SET raiddifficulty = %u WHERE leaderGuid ='%u'", m_raidDifficulty, GUID_LOPART(m_leaderGuid)); + + for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) + { + Player *player = itr->getSource(); + if(!player->GetSession() || player->getLevel() < LEVELREQUIREMENT_HEROIC) + continue; + player->SetRaidDifficulty(difficulty); + player->SendRaidDifficulty(true); + } +} + bool Group::InCombatToInstance(uint32 instanceId) { for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) @@ -1479,7 +1501,7 @@ void Group::ResetInstances(uint8 method, Player* SendMsgTo) // method can be INSTANCE_RESET_ALL, INSTANCE_RESET_CHANGE_DIFFICULTY, INSTANCE_RESET_GROUP_DISBAND // we assume that when the difficulty changes, all instances that can be reset will be - uint8 dif = GetDifficulty(); + uint8 dif = GetDungeonDifficulty(); for(BoundInstancesMap::iterator itr = m_boundInstances[dif].begin(); itr != m_boundInstances[dif].end();) { @@ -1494,7 +1516,7 @@ void Group::ResetInstances(uint8 method, Player* SendMsgTo) if(method == INSTANCE_RESET_ALL) { // the "reset all instances" method can only reset normal maps - if(dif == DIFFICULTY_HEROIC || entry->map_type == MAP_RAID) + if(dif == DUNGEON_DIFFICULTY_HEROIC || entry->map_type == MAP_RAID) { ++itr; continue; @@ -1534,7 +1556,7 @@ InstanceGroupBind* Group::GetBoundInstance(uint32 mapid, uint8 difficulty) { // some instances only have one difficulty const MapEntry* entry = sMapStore.LookupEntry(mapid); - if(!entry || !entry->SupportsHeroicMode()) difficulty = DIFFICULTY_NORMAL; + if(!entry || !entry->SupportsHeroicMode()) difficulty = DUNGEON_DIFFICULTY_NORMAL; BoundInstancesMap::iterator itr = m_boundInstances[difficulty].find(mapid); if(itr != m_boundInstances[difficulty].end()) diff --git a/src/game/Group.h b/src/game/Group.h index 478b7c5cb..f6837e410 100644 --- a/src/game/Group.h +++ b/src/game/Group.h @@ -279,8 +279,10 @@ class MANGOS_DLL_SPEC Group } void SetTargetIcon(uint8 id, uint64 guid); - void SetDifficulty(uint8 difficulty); - uint8 GetDifficulty() { return m_difficulty; } + void SetDungeonDifficulty(uint8 difficulty); + uint8 GetDungeonDifficulty() { return m_dungeonDifficulty; } + void SetRaidDifficulty(uint8 difficulty); + uint8 GetRaidDifficulty() { return m_raidDifficulty; } uint16 InInstance(); bool InCombatToInstance(uint32 instanceId); void ResetInstances(uint8 method, Player* SendMsgTo); @@ -397,14 +399,15 @@ class MANGOS_DLL_SPEC Group uint64 m_mainTank; uint64 m_mainAssistant; GroupType m_groupType; - uint8 m_difficulty; + uint8 m_dungeonDifficulty; + uint8 m_raidDifficulty; BattleGround* m_bgGroup; uint64 m_targetIcons[TARGETICONCOUNT]; LootMethod m_lootMethod; ItemQualities m_lootThreshold; uint64 m_looterGuid; Rolls RollId; - BoundInstancesMap m_boundInstances[TOTAL_DIFFICULTIES]; + BoundInstancesMap m_boundInstances[TOTAL_DUNGEON_DIFFICULTIES]; uint8* m_subGroupsCounts; }; #endif diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp index c19462472..b52f74504 100644 --- a/src/game/InstanceSaveMgr.cpp +++ b/src/game/InstanceSaveMgr.cpp @@ -88,7 +88,7 @@ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instance { // initialize reset time // for normal instances if no creatures are killed the instance will reset in two hours - if(entry->map_type == MAP_RAID || difficulty == DIFFICULTY_HEROIC) + if(entry->map_type == MAP_RAID || difficulty == DUNGEON_DIFFICULTY_HEROIC) resetTime = GetResetTimeFor(mapId); else { @@ -175,7 +175,7 @@ time_t InstanceSave::GetResetTimeForDB() { // only save the reset time for normal instances const MapEntry *entry = sMapStore.LookupEntry(GetMapId()); - if(!entry || entry->map_type == MAP_RAID || GetDifficulty() == DIFFICULTY_HEROIC) + if(!entry || entry->map_type == MAP_RAID || GetDifficulty() == DUNGEON_DIFFICULTY_HEROIC) return 0; else return GetResetTime(); diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp index 5a9ff8172..ac030bd67 100644 --- a/src/game/ItemHandler.cpp +++ b/src/game/ItemHandler.cpp @@ -329,6 +329,7 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data ) data << pProto->DisplayInfoID; data << pProto->Quality; data << pProto->Flags; + data << pProto->Faction; // 3.2 faction? data << pProto->BuyPrice; data << pProto->SellPrice; data << pProto->InventoryType; diff --git a/src/game/ItemPrototype.h b/src/game/ItemPrototype.h index b34488553..cfa41ac05 100644 --- a/src/game/ItemPrototype.h +++ b/src/game/ItemPrototype.h @@ -511,6 +511,7 @@ struct ItemPrototype uint32 DisplayInfoID; // id from ItemDisplayInfo.dbc uint32 Quality; uint32 Flags; + uint32 Faction; uint32 BuyCount; uint32 BuyPrice; uint32 SellPrice; diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index ba089c72d..7bc7c8682 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -537,19 +537,19 @@ bool ChatHandler::HandleGonameCommand(const char* args) // if the player or the player's group is bound to another instance // the player will not be bound to another one - InstancePlayerBind *pBind = _player->GetBoundInstance(target->GetMapId(), target->GetDifficulty()); + InstancePlayerBind *pBind = _player->GetBoundInstance(target->GetMapId(), target->GetDungeonDifficulty()); if (!pBind) { Group *group = _player->GetGroup(); // if no bind exists, create a solo bind - InstanceGroupBind *gBind = group ? group->GetBoundInstance(target->GetMapId(), target->GetDifficulty()) : NULL; + InstanceGroupBind *gBind = group ? group->GetBoundInstance(target->GetMapId(), target->GetDungeonDifficulty()) : NULL; // if no bind exists, create a solo bind if (!gBind) if (InstanceSave *save = sInstanceSaveManager.GetInstanceSave(target->GetInstanceId())) _player->BindToInstance(save, !save->CanReset()); } - _player->SetDifficulty(target->GetDifficulty()); + _player->SetDungeonDifficulty(target->GetDungeonDifficulty()); } PSendSysMessage(LANG_APPEARING_AT, chrNameLink.c_str()); diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 818864a51..87b26eed7 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -6115,14 +6115,14 @@ bool ChatHandler::HandleInstanceListBindsCommand(const char* /*args*/) Player* player = getSelectedPlayer(); if (!player) player = m_session->GetPlayer(); uint32 counter = 0; - for(uint8 i = 0; i < TOTAL_DIFFICULTIES; ++i) + for(uint8 i = 0; i < TOTAL_DUNGEON_DIFFICULTIES; ++i) { Player::BoundInstancesMap &binds = player->GetBoundInstances(i); for(Player::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr) { InstanceSave *save = itr->second.save; std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL)); - PSendSysMessage("map: %d inst: %d perm: %s diff: %s canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty() == DIFFICULTY_NORMAL ? "normal" : "heroic", save->CanReset() ? "yes" : "no", timeleft.c_str()); + PSendSysMessage("map: %d inst: %d perm: %s diff: %s canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty() == DUNGEON_DIFFICULTY_NORMAL ? "normal" : "heroic", save->CanReset() ? "yes" : "no", timeleft.c_str()); counter++; } } @@ -6131,14 +6131,14 @@ bool ChatHandler::HandleInstanceListBindsCommand(const char* /*args*/) Group *group = player->GetGroup(); if(group) { - for(uint8 i = 0; i < TOTAL_DIFFICULTIES; ++i) + for(uint8 i = 0; i < TOTAL_DUNGEON_DIFFICULTIES; ++i) { Group::BoundInstancesMap &binds = group->GetBoundInstances(i); for(Group::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr) { InstanceSave *save = itr->second.save; std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL)); - PSendSysMessage("map: %d inst: %d perm: %s diff: %s canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty() == DIFFICULTY_NORMAL ? "normal" : "heroic", save->CanReset() ? "yes" : "no", timeleft.c_str()); + PSendSysMessage("map: %d inst: %d perm: %s diff: %s canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty() == DUNGEON_DIFFICULTY_NORMAL ? "normal" : "heroic", save->CanReset() ? "yes" : "no", timeleft.c_str()); counter++; } } @@ -6159,7 +6159,7 @@ bool ChatHandler::HandleInstanceUnbindCommand(const char* args) Player* player = getSelectedPlayer(); if (!player) player = m_session->GetPlayer(); uint32 counter = 0; - for(uint8 i = 0; i < TOTAL_DIFFICULTIES; ++i) + for(uint8 i = 0; i < TOTAL_DUNGEON_DIFFICULTIES; ++i) { Player::BoundInstancesMap &binds = player->GetBoundInstances(i); for(Player::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end();) @@ -6168,7 +6168,7 @@ bool ChatHandler::HandleInstanceUnbindCommand(const char* args) { InstanceSave *save = itr->second.save; std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL)); - PSendSysMessage("unbinding map: %d inst: %d perm: %s diff: %s canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty() == DIFFICULTY_NORMAL ? "normal" : "heroic", save->CanReset() ? "yes" : "no", timeleft.c_str()); + PSendSysMessage("unbinding map: %d inst: %d perm: %s diff: %s canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty() == DUNGEON_DIFFICULTY_NORMAL ? "normal" : "heroic", save->CanReset() ? "yes" : "no", timeleft.c_str()); player->UnbindInstance(itr, i); counter++; } diff --git a/src/game/Makefile.am b/src/game/Makefile.am index 96f9ae399..36f7f6a48 100644 --- a/src/game/Makefile.am +++ b/src/game/Makefile.am @@ -46,10 +46,12 @@ libmangosgame_a_SOURCES = \ BattleGround.cpp \ BattleGroundAA.cpp \ BattleGroundAB.cpp \ + BattleGroundABG.cpp \ BattleGroundAV.cpp \ BattleGroundBE.cpp \ BattleGroundDS.cpp \ BattleGroundEY.cpp \ + BattleGroundIC.cpp \ BattleGroundNA.cpp \ BattleGroundRL.cpp \ BattleGroundRV.cpp \ @@ -58,10 +60,12 @@ libmangosgame_a_SOURCES = \ BattleGround.h \ BattleGroundAA.h \ BattleGroundAB.h \ + BattleGroundABG.h \ BattleGroundAV.h \ BattleGroundBE.h \ BattleGroundDS.h \ BattleGroundEY.h \ + BattleGroundIC.h \ BattleGroundNA.h \ BattleGroundRL.h \ BattleGroundRV.h \ diff --git a/src/game/Map.cpp b/src/game/Map.cpp index f8c02b975..95470f94d 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -2507,7 +2507,7 @@ void InstanceMap::UnloadAll(bool pForce) void InstanceMap::SendResetWarnings(uint32 timeLeft) const { for(MapRefManager::const_iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr) - itr->getSource()->SendInstanceResetWarning(GetId(), itr->getSource()->GetDifficulty(), timeLeft); + itr->getSource()->SendInstanceResetWarning(GetId(), itr->getSource()->GetDungeonDifficulty(), timeLeft); } void InstanceMap::SetResetSchedule(bool on) @@ -2534,7 +2534,7 @@ uint32 InstanceMap::GetMaxPlayers() const /* ******* Battleground Instance Maps ******* */ BattleGroundMap::BattleGroundMap(uint32 id, time_t expiry, uint32 InstanceId) - : Map(id, expiry, InstanceId, DIFFICULTY_NORMAL) + : Map(id, expiry, InstanceId, DUNGEON_DIFFICULTY_NORMAL) { } diff --git a/src/game/Map.h b/src/game/Map.h index a07553181..faefcfa5b 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -348,7 +348,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager, public MaNGOS::Obj // NOTE: this duplicate of Instanceable(), but Instanceable() can be changed when BG also will be instanceable bool IsDungeon() const { return i_mapEntry && i_mapEntry->IsDungeon(); } bool IsRaid() const { return i_mapEntry && i_mapEntry->IsRaid(); } - bool IsHeroic() const { return i_spawnMode == DIFFICULTY_HEROIC; } + bool IsHeroic() const { return i_spawnMode == DUNGEON_DIFFICULTY_HEROIC; } bool IsBattleGround() const { return i_mapEntry && i_mapEntry->IsBattleGround(); } bool IsBattleArena() const { return i_mapEntry && i_mapEntry->IsBattleArena(); } bool IsBattleGroundOrArena() const { return i_mapEntry && i_mapEntry->IsBattleGroundOrArena(); } diff --git a/src/game/MapInstanced.cpp b/src/game/MapInstanced.cpp index e6eaa6298..43fc398f7 100644 --- a/src/game/MapInstanced.cpp +++ b/src/game/MapInstanced.cpp @@ -153,7 +153,7 @@ Map* MapInstanced::GetInstance(const WorldObject* obj) return map; } - InstancePlayerBind *pBind = player->GetBoundInstance(GetId(), player->GetDifficulty()); + InstancePlayerBind *pBind = player->GetBoundInstance(GetId(), player->GetDungeonDifficulty()); InstanceSave *pSave = pBind ? pBind->save : NULL; // the player's permanet player bind is taken into consideration first @@ -163,7 +163,7 @@ Map* MapInstanced::GetInstance(const WorldObject* obj) InstanceGroupBind *groupBind = NULL; Group *group = player->GetGroup(); // use the player's difficulty setting (it may not be the same as the group's) - if(group && (groupBind = group->GetBoundInstance(GetId(), player->GetDifficulty()))) + if(group && (groupBind = group->GetBoundInstance(GetId(), player->GetDungeonDifficulty()))) pSave = groupBind->save; } @@ -182,7 +182,7 @@ Map* MapInstanced::GetInstance(const WorldObject* obj) // if no instanceId via group members or instance saves is found // the instance will be created for the first time NewInstanceId = MapManager::Instance().GenerateInstanceId(); - return CreateInstance(NewInstanceId, NULL, player->GetDifficulty()); + return CreateInstance(NewInstanceId, NULL, player->GetDungeonDifficulty()); } } } @@ -208,7 +208,7 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave *save, } // some instances only have one difficulty - if (entry && !entry->SupportsHeroicMode()) difficulty = DIFFICULTY_NORMAL; + if (entry && !entry->SupportsHeroicMode()) difficulty = DUNGEON_DIFFICULTY_NORMAL; sLog.outDebug("MapInstanced::CreateInstance: %smap instance %d for %d created with difficulty %s", save?"":"new ", InstanceId, GetId(), difficulty?"heroic":"normal"); diff --git a/src/game/MapManager.cpp b/src/game/MapManager.cpp index 81b3786a5..314e44527 100644 --- a/src/game/MapManager.cpp +++ b/src/game/MapManager.cpp @@ -176,10 +176,10 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player) } //The player has a heroic mode and tries to enter into instance which has no a heroic mode - if (!entry->SupportsHeroicMode() && player->GetDifficulty() == DIFFICULTY_HEROIC) + if (!entry->SupportsHeroicMode() && player->GetDungeonDifficulty() == DUNGEON_DIFFICULTY_HEROIC) { //Send aborted message - player->SendTransferAborted(mapid, TRANSFER_ABORT_DIFFICULTY, DIFFICULTY_HEROIC); + player->SendTransferAborted(mapid, TRANSFER_ABORT_DIFFICULTY, DUNGEON_DIFFICULTY_HEROIC); return false; } diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 95730eb6a..30aa8a7cb 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -845,7 +845,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) missingItem = at->requiredItem2; uint32 missingKey = 0; - if(GetPlayer()->GetDifficulty() == DIFFICULTY_HEROIC) + if(GetPlayer()->GetDungeonDifficulty() == DUNGEON_DIFFICULTY_HEROIC) { if(at->heroicKey) { @@ -858,7 +858,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) } uint32 missingQuest = 0; - if(GetPlayer()->GetDifficulty() == DIFFICULTY_HEROIC) + if(GetPlayer()->GetDungeonDifficulty() == DUNGEON_DIFFICULTY_HEROIC) { if (at->requiredQuestHeroic && !GetPlayer()->GetQuestRewardStatus(at->requiredQuestHeroic)) missingQuest = at->requiredQuestHeroic; @@ -875,7 +875,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) if(missingItem) SendAreaTriggerMessage(GetMangosString(LANG_LEVEL_MINREQUIRED_AND_ITEM), at->requiredLevel, objmgr.GetItemPrototype(missingItem)->Name1); else if(missingKey) - GetPlayer()->SendTransferAborted(at->target_mapId, TRANSFER_ABORT_DIFFICULTY, DIFFICULTY_HEROIC); + GetPlayer()->SendTransferAborted(at->target_mapId, TRANSFER_ABORT_DIFFICULTY, DUNGEON_DIFFICULTY_HEROIC); else if(missingQuest) SendAreaTriggerMessage(at->requiredFailedText.c_str()); else if(missingLevel) @@ -1469,10 +1469,10 @@ void WorldSession::HandleSetDungeonDifficultyOpcode( WorldPacket & recv_data ) uint32 mode; recv_data >> mode; - if(mode == _player->GetDifficulty()) + if(mode == _player->GetDungeonDifficulty()) return; - if(mode > DIFFICULTY_HEROIC) + if(mode > DUNGEON_DIFFICULTY_HEROIC) { sLog.outError("WorldSession::HandleSetDungeonDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode); return; @@ -1496,13 +1496,60 @@ void WorldSession::HandleSetDungeonDifficultyOpcode( WorldPacket & recv_data ) // the difficulty is set even if the instances can't be reset //_player->SendDungeonDifficulty(true); pGroup->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, _player); - pGroup->SetDifficulty(mode); + pGroup->SetDungeonDifficulty(mode); } } else { _player->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY); - _player->SetDifficulty(mode); + _player->SetDungeonDifficulty(mode); + } +} + +void WorldSession::HandleSetRaidDifficultyOpcode( WorldPacket & recv_data ) +{ + CHECK_PACKET_SIZE(recv_data, 4); + + sLog.outDebug("MSG_SET_RAID_DIFFICULTY"); + + uint32 mode; + recv_data >> mode; + + if(mode == _player->GetRaidDifficulty()) + return; + + if(mode > RAID_DIFFICULTY_25MAN_HEROIC) + { + sLog.outError("WorldSession::HandleSetRaidDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode); + return; + } + + // cannot reset while in an instance + Map *map = _player->GetMap(); + if(map && map->IsDungeon()) + { + sLog.outError("WorldSession::HandleSetRaidDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow()); + return; + } + + if(_player->getLevel() < LEVELREQUIREMENT_HEROIC) + return; + + Group *pGroup = _player->GetGroup(); + if(pGroup) + { + if(pGroup->IsLeader(_player->GetGUID())) + { + // the difficulty is set even if the instances can't be reset + //_player->SendDungeonDifficulty(true); + pGroup->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, _player); + pGroup->SetRaidDifficulty(mode); + } + } + else + { + _player->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY); + _player->SetRaidDifficulty(mode); } } diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index ef6e0a136..9afab8936 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -138,10 +138,10 @@ void WorldSession::HandleMoveWorldportAckOpcode() } } - if((mEntry->IsRaid() || (mEntry->IsNonRaidDungeon() && mEntry->SupportsHeroicMode() && GetPlayer()->IsHeroic())) && mInstance) + if((mEntry->IsRaid() || (mEntry->IsNonRaidDungeon() && mEntry->SupportsHeroicMode() && GetPlayer()->IsHeroicDungeon())) && mInstance) { uint32 timeleft = sInstanceSaveManager.GetResetTimeFor(GetPlayer()->GetMapId()) - time(NULL); - GetPlayer()->SendInstanceResetWarning(GetPlayer()->GetMapId(), GetPlayer()->GetDifficulty(), timeleft); + GetPlayer()->SendInstanceResetWarning(GetPlayer()->GetMapId(), GetPlayer()->GetDungeonDifficulty(), timeleft); } // mount allow check diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 81c3fba9e..691430a4d 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -2922,8 +2922,8 @@ void ObjectMgr::LoadGroups() Group *group = NULL; uint64 leaderGuid = 0; uint32 count = 0; - // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 - QueryResult *result = CharacterDatabase.Query("SELECT mainTank, mainAssistant, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, isRaid, difficulty, leaderGuid FROM groups"); + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 + QueryResult *result = CharacterDatabase.Query("SELECT mainTank, mainAssistant, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, isRaid, difficulty, raiddifficulty, leaderGuid FROM groups"); if( !result ) { @@ -2943,7 +2943,7 @@ void ObjectMgr::LoadGroups() bar.step(); Field *fields = result->Fetch(); ++count; - leaderGuid = MAKE_NEW_GUID(fields[15].GetUInt32(),0,HIGHGUID_PLAYER); + leaderGuid = MAKE_NEW_GUID(fields[16].GetUInt32(),0,HIGHGUID_PLAYER); group = new Group; if(!group->LoadGroupFromDB(leaderGuid, result, false)) diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp index 6d6e08c0d..c2edf1e62 100644 --- a/src/game/Opcodes.cpp +++ b/src/game/Opcodes.cpp @@ -1284,7 +1284,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x4E7*/ { "UMSG_UNKNOWN_1255", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4E8*/ { "UMSG_UNKNOWN_1256", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4E9*/ { "UMSG_UNKNOWN_1257", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4EA*/ { "UMSG_UNKNOWN_1258", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4EA*/ { "MSG_SET_RAID_DIFFICULTY", STATUS_LOGGEDIN, &WorldSession::HandleSetRaidDifficultyOpcode }, /*0x4EB*/ { "UMSG_UNKNOWN_1259", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4EC*/ { "UMSG_UNKNOWN_1260", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4ED*/ { "UMSG_UNKNOWN_1261", STATUS_NEVER, &WorldSession::Handle_NULL }, diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h index a68fd3f11..f2b561256 100644 --- a/src/game/Opcodes.h +++ b/src/game/Opcodes.h @@ -1292,7 +1292,7 @@ enum Opcodes CMSG_UNKNOWN_1255 = 0x4E7, // lua: BattlefieldMgrExitRequest SMSG_UNKNOWN_1256 = 0x4E8, // uint32, uint32 UMSG_UNKNOWN_1257 = 0x4E9, // not found 3.2 - MSG_UNKNOWN_1258 = 0x4EA, // lua: SetRaidDificulty + MSG_SET_RAID_DIFFICULTY = 0x4EA, // lua: SetRaidDificulty UMSG_UNKNOWN_1259 = 0x4EB, // not found 3.2 SMSG_TOGGLE_XP_GAIN = 0x4EC, // enable/disable XP gain console message UMSG_UNKNOWN_1261 = 0x4ED, // not found 3.2 diff --git a/src/game/Player.cpp b/src/game/Player.cpp index e4eecf09d..8d109da90 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -418,7 +418,8 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa m_HomebindTimer = 0; m_InstanceValid = true; - m_dungeonDifficulty = DIFFICULTY_NORMAL; + m_dungeonDifficulty = DUNGEON_DIFFICULTY_NORMAL; + m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL; m_lastPotionId = 0; @@ -502,7 +503,7 @@ Player::~Player () delete ItemSetEff[x]; // clean up player-instance binds, may unload some instance saves - for(uint8 i = 0; i < TOTAL_DIFFICULTIES; ++i) + for(uint8 i = 0; i < TOTAL_DUNGEON_DIFFICULTIES; ++i) for(BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr) itr->second.save->RemovePlayer(this); @@ -13995,7 +13996,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) uint32 transGUID = fields[31].GetUInt32(); Relocate(fields[13].GetFloat(),fields[14].GetFloat(),fields[15].GetFloat(),fields[17].GetFloat()); SetMapId(fields[16].GetUInt32()); - SetDifficulty(fields[39].GetUInt32()); // may be changed in _LoadGroup + SetDungeonDifficulty(fields[39].GetUInt32()); // may be changed in _LoadGroup _LoadGroup(holder->GetResult(PLAYER_LOGIN_QUERY_LOADGROUP)); @@ -15099,7 +15100,7 @@ void Player::_LoadGroup(QueryResult *result) if(getLevel() >= LEVELREQUIREMENT_HEROIC) { // the group leader may change the instance difficulty while the player is offline - SetDifficulty(group->GetDifficulty()); + SetDungeonDifficulty(group->GetDungeonDifficulty()); } } } @@ -15107,7 +15108,7 @@ void Player::_LoadGroup(QueryResult *result) void Player::_LoadBoundInstances(QueryResult *result) { - for(uint8 i = 0; i < TOTAL_DIFFICULTIES; ++i) + for(uint8 i = 0; i < TOTAL_DUNGEON_DIFFICULTIES; ++i) m_boundInstances[i].clear(); Group *group = GetGroup(); @@ -15154,7 +15155,7 @@ InstancePlayerBind* Player::GetBoundInstance(uint32 mapid, uint8 difficulty) { // some instances only have one difficulty const MapEntry* entry = sMapStore.LookupEntry(mapid); - if(!entry || !entry->SupportsHeroicMode()) difficulty = DIFFICULTY_NORMAL; + if(!entry || !entry->SupportsHeroicMode()) difficulty = DUNGEON_DIFFICULTY_NORMAL; BoundInstancesMap::iterator itr = m_boundInstances[difficulty].find(mapid); if(itr != m_boundInstances[difficulty].end()) @@ -15221,7 +15222,7 @@ void Player::SendRaidInfo() time_t now = time(NULL); - for(int i = 0; i < TOTAL_DIFFICULTIES; ++i) + for(int i = 0; i < TOTAL_DUNGEON_DIFFICULTIES; ++i) { for (BoundInstancesMap::const_iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr) { @@ -15249,7 +15250,7 @@ void Player::SendSavedInstances() bool hasBeenSaved = false; WorldPacket data; - for(uint8 i = 0; i < TOTAL_DIFFICULTIES; ++i) + for(uint8 i = 0; i < TOTAL_DUNGEON_DIFFICULTIES; ++i) { for (BoundInstancesMap::const_iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr) { @@ -15269,7 +15270,7 @@ void Player::SendSavedInstances() if(!hasBeenSaved) return; - for(uint8 i = 0; i < TOTAL_DIFFICULTIES; ++i) + for(uint8 i = 0; i < TOTAL_DUNGEON_DIFFICULTIES; ++i) { for (BoundInstancesMap::const_iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr) { @@ -15297,7 +15298,7 @@ void Player::ConvertInstancesToGroup(Player *player, Group *group, uint64 player if(player) { - for(uint8 i = 0; i < TOTAL_DIFFICULTIES; ++i) + for(uint8 i = 0; i < TOTAL_DUNGEON_DIFFICULTIES; ++i) { for (BoundInstancesMap::iterator itr = player->m_boundInstances[i].begin(); itr != player->m_boundInstances[i].end();) { @@ -15434,7 +15435,7 @@ void Player::SaveToDB() if(!IsBeingTeleported()) { ss << GetMapId() << ", " - << (uint32)GetDifficulty() << ", " + << (uint32)GetDungeonDifficulty() << ", " << finiteAlways(GetPositionX()) << ", " << finiteAlways(GetPositionY()) << ", " << finiteAlways(GetPositionZ()) << ", " @@ -15443,7 +15444,7 @@ void Player::SaveToDB() else { ss << GetTeleportDest().mapid << ", " - << (uint32)GetDifficulty() << ", " + << (uint32)GetDungeonDifficulty() << ", " << finiteAlways(GetTeleportDest().coord_x) << ", " << finiteAlways(GetTeleportDest().coord_y) << ", " << finiteAlways(GetTeleportDest().coord_z) << ", " @@ -16059,7 +16060,17 @@ void Player::SendDungeonDifficulty(bool IsInGroup) { uint8 val = 0x00000001; WorldPacket data(MSG_SET_DUNGEON_DIFFICULTY, 12); - data << (uint32)GetDifficulty(); + data << (uint32)GetDungeonDifficulty(); + data << uint32(val); + data << uint32(IsInGroup); + GetSession()->SendPacket(&data); +} + +void Player::SendRaidDifficulty(bool IsInGroup) +{ + uint8 val = 0x00000001; + WorldPacket data(MSG_SET_RAID_DIFFICULTY, 12); + data << uint32(GetRaidDifficulty()); data << uint32(val); data << uint32(IsInGroup); GetSession()->SendPacket(&data); @@ -16078,7 +16089,7 @@ void Player::ResetInstances(uint8 method) // method can be INSTANCE_RESET_ALL, INSTANCE_RESET_CHANGE_DIFFICULTY, INSTANCE_RESET_GROUP_JOIN // we assume that when the difficulty changes, all instances that can be reset will be - uint8 dif = GetDifficulty(); + uint8 dif = GetDungeonDifficulty(); for (BoundInstancesMap::iterator itr = m_boundInstances[dif].begin(); itr != m_boundInstances[dif].end();) { @@ -16093,7 +16104,7 @@ void Player::ResetInstances(uint8 method) if(method == INSTANCE_RESET_ALL) { // the "reset all instances" method can only reset normal maps - if(dif == DIFFICULTY_HEROIC || entry->map_type == MAP_RAID) + if(dif == DUNGEON_DIFFICULTY_HEROIC || entry->map_type == MAP_RAID) { ++itr; continue; @@ -20322,3 +20333,10 @@ void Player::SendClearCooldown( uint32 spell_id, Unit* target ) data << uint64(target->GetGUID()); SendDirectMessage(&data); } + +void Player::SendDuelCountdown(uint32 counter) +{ + WorldPacket data(SMSG_DUEL_COUNTDOWN, 4); + data << uint32(counter); // seconds + GetSession()->SendPacket(&data); +} diff --git a/src/game/Player.h b/src/game/Player.h index 836eccb8b..f5600e409 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1505,6 +1505,7 @@ class MANGOS_DLL_SPEC Player : public Unit void UpdateDuelFlag(time_t currTime); void CheckDuelDistance(time_t currTime); void DuelComplete(DuelCompleteType type); + void SendDuelCountdown(uint32 counter); bool IsGroupVisibleFor(Player* p) const; bool IsInSameGroupWith(Player const* p) const; @@ -1535,9 +1536,11 @@ class MANGOS_DLL_SPEC Player : public Unit uint32 GetArenaTeamIdInvited() { return m_ArenaTeamIdInvited; } static void LeaveAllArenaTeams(uint64 guid); - void SetDifficulty(uint32 dungeon_difficulty) { m_dungeonDifficulty = dungeon_difficulty; } - uint8 GetDifficulty() { return m_dungeonDifficulty; } - bool IsHeroic() { return m_dungeonDifficulty == DIFFICULTY_HEROIC; } + void SetDungeonDifficulty(uint32 dungeon_difficulty) { m_dungeonDifficulty = dungeon_difficulty; } + uint8 GetDungeonDifficulty() { return m_dungeonDifficulty; } + bool IsHeroicDungeon() { return m_dungeonDifficulty == DUNGEON_DIFFICULTY_HEROIC; } + void SetRaidDifficulty(uint32 raid_difficulty) { m_raidDifficulty = raid_difficulty; } + uint8 GetRaidDifficulty() { return m_raidDifficulty; } bool UpdateSkill(uint32 skill_id, uint32 step); bool UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step); @@ -1625,6 +1628,7 @@ class MANGOS_DLL_SPEC Player : public Unit void SendExplorationExperience(uint32 Area, uint32 Experience); void SendDungeonDifficulty(bool IsInGroup); + void SendRaidDifficulty(bool IsInGroup); void ResetInstances(uint8 method); void SendResetInstanceSuccess(uint32 MapId); void SendResetInstanceFailed(uint32 reason, uint32 MapId); @@ -2037,7 +2041,7 @@ class MANGOS_DLL_SPEC Player : public Unit uint32 m_HomebindTimer; bool m_InstanceValid; // permanent binds and solo binds by difficulty - BoundInstancesMap m_boundInstances[TOTAL_DIFFICULTIES]; + BoundInstancesMap m_boundInstances[TOTAL_DUNGEON_DIFFICULTIES]; InstancePlayerBind* GetBoundInstance(uint32 mapid, uint8 difficulty); BoundInstancesMap& GetBoundInstances(uint8 difficulty) { return m_boundInstances[difficulty]; } void UnbindInstance(uint32 mapid, uint8 difficulty, bool unload = false); @@ -2194,6 +2198,7 @@ class MANGOS_DLL_SPEC Player : public Unit time_t m_speakTime; uint32 m_speakCount; uint32 m_dungeonDifficulty; + uint32 m_raidDifficulty; uint32 m_atLoginFlags; diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp index fd7846bdc..88f824ea5 100644 --- a/src/game/QueryHandler.cpp +++ b/src/game/QueryHandler.cpp @@ -198,8 +198,8 @@ void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data ) data << float(ci->unk16); // unk data << float(ci->unk17); // unk data << uint8(ci->RacialLeader); - for(uint32 i = 0; i < 4; ++i) - data << uint32(ci->questItems[i]); // itemId[4], quest drop + for(uint32 i = 0; i < 6; ++i) + data << uint32(ci->questItems[i]); // itemId[6], quest drop data << uint32(ci->movementId); // CreatureMovementInfo.dbc SendPacket( &data ); sLog.outDebug( "WORLD: Sent SMSG_CREATURE_QUERY_RESPONSE" ); @@ -261,8 +261,8 @@ void WorldSession::HandleGameObjectQueryOpcode( WorldPacket & recv_data ) data << info->unk1; // 2.0.3, string data.append(info->raw.data, 24); data << float(info->size); // go size - for(uint32 i = 0; i < 4; ++i) - data << uint32(info->questItems[i]); // itemId[4], quest drop + for(uint32 i = 0; i < 6; ++i) + data << uint32(info->questItems[i]); // itemId[6], quest drop SendPacket( &data ); sLog.outDebug( "WORLD: Sent SMSG_GAMEOBJECT_QUERY_RESPONSE" ); } diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index e4e89b963..66381f6ce 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -2351,9 +2351,18 @@ enum DiminishingGroup enum DungeonDifficulties { - DIFFICULTY_NORMAL = 0, - DIFFICULTY_HEROIC = 1, - TOTAL_DIFFICULTIES + DUNGEON_DIFFICULTY_NORMAL = 0, + DUNGEON_DIFFICULTY_HEROIC = 1, + TOTAL_DUNGEON_DIFFICULTIES +}; + +enum RaidDifficulties +{ + RAID_DIFFICULTY_10MAN_NORMAL = 0, + RAID_DIFFICULTY_10MAN_HEROIC = 1, + RAID_DIFFICULTY_25MAN_NORMAL = 2, + RAID_DIFFICULTY_25MAN_HEROIC = 3, + TOTAL_RAID_DIFFICULTIES }; enum SummonType @@ -2519,9 +2528,11 @@ enum BattleGroundTypeId BATTLEGROUND_RL = 8, BATTLEGROUND_SA = 9, BATTLEGROUND_DS = 10, - BATTLEGROUND_RV = 11 + BATTLEGROUND_RV = 11, + BATTLEGROUND_IC = 30, + BATTLEGROUND_ABG = 32 }; -#define MAX_BATTLEGROUND_TYPE_ID 12 +#define MAX_BATTLEGROUND_TYPE_ID 33 enum MailResponseType { diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h index 38fe40af0..1f040849d 100644 --- a/src/game/WorldSession.h +++ b/src/game/WorldSession.h @@ -627,6 +627,7 @@ class MANGOS_DLL_SPEC WorldSession void HandleFarSightOpcode(WorldPacket& recv_data); void HandleSetLfgOpcode(WorldPacket& recv_data); void HandleSetDungeonDifficultyOpcode(WorldPacket& recv_data); + void HandleSetRaidDifficultyOpcode(WorldPacket& recv_data); void HandleMoveSetCanFlyAckOpcode(WorldPacket& recv_data); void HandleLfgSetAutoJoinOpcode(WorldPacket& recv_data); void HandleLfgClearAutoJoinOpcode(WorldPacket& recv_data); diff --git a/src/shared/Database/SQLStorage.cpp b/src/shared/Database/SQLStorage.cpp index 288b66539..74bbcef45 100644 --- a/src/shared/Database/SQLStorage.cpp +++ b/src/shared/Database/SQLStorage.cpp @@ -25,16 +25,16 @@ extern DatabasePostgre WorldDatabase; extern DatabaseMysql WorldDatabase; #endif -const char CreatureInfosrcfmt[]="iiiiiiiisssiiiiiiiiiiffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiisiiffliiiiiliiis"; -const char CreatureInfodstfmt[]="iiiiiiiisssiiiiiiiiiiffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiisiiffliiiiiliiii"; +const char CreatureInfosrcfmt[]="iiiiiiiisssiiiiiiiiiiffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiisiiffliiiiiiiliiis"; +const char CreatureInfodstfmt[]="iiiiiiiisssiiiiiiiiiiffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiisiiffliiiiiiiliiii"; const char CreatureDataAddonInfofmt[]="iiiiiis"; const char CreatureModelfmt[]="iffbi"; const char CreatureInfoAddonInfofmt[]="iiiiiis"; const char EquipmentInfofmt[]="iiii"; -const char GameObjectInfosrcfmt[]="iiissssiifiiiiiiiiiiiiiiiiiiiiiiiiiiiis"; -const char GameObjectInfodstfmt[]="iiissssiifiiiiiiiiiiiiiiiiiiiiiiiiiiiii"; -const char ItemPrototypesrcfmt[]="iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifiiisiiii"; -const char ItemPrototypedstfmt[]="iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifiiiiiiii"; +const char GameObjectInfosrcfmt[]="iiissssiifiiiiiiiiiiiiiiiiiiiiiiiiiiiiiis"; +const char GameObjectInfodstfmt[]="iiissssiifiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii"; +const char ItemPrototypesrcfmt[]="iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifiiisiiii"; +const char ItemPrototypedstfmt[]="iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifiiiiiiii"; const char PageTextfmt[]="isi"; const char SpellThreatfmt[]="ii"; const char InstanceTemplatesrcfmt[]="iiiiiiiffffs"; diff --git a/win/VC100/game.vcxproj b/win/VC100/game.vcxproj index c35c9ab4c..100e7dd1a 100644 --- a/win/VC100/game.vcxproj +++ b/win/VC100/game.vcxproj @@ -355,11 +355,13 @@ + + @@ -501,10 +503,12 @@ + + diff --git a/win/VC80/game.vcproj b/win/VC80/game.vcproj index e4b1c4567..aac5d0b5f 100644 --- a/win/VC80/game.vcproj +++ b/win/VC80/game.vcproj @@ -565,6 +565,14 @@ RelativePath="..\..\src\game\BattleGroundAB.h" > + + + + @@ -601,6 +609,14 @@ RelativePath="..\..\src\game\BattleGroundHandler.cpp" > + + + + diff --git a/win/VC90/game.vcproj b/win/VC90/game.vcproj index a634b2ec5..01beb6159 100644 --- a/win/VC90/game.vcproj +++ b/win/VC90/game.vcproj @@ -565,6 +565,14 @@ RelativePath="..\..\src\game\BattleGroundAB.h" > + + + + @@ -601,6 +609,14 @@ RelativePath="..\..\src\game\BattleGroundHandler.cpp" > + + + + From 12f05c3c78f5ccb454c7b71f0b704f5a361b223a Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Thu, 25 Jun 2009 19:10:56 +0400 Subject: [PATCH 003/132] Renamed file. --- .../{5_battleground_tempalate.sql => 5_battleground_template.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sql/320/{5_battleground_tempalate.sql => 5_battleground_template.sql} (100%) diff --git a/sql/320/5_battleground_tempalate.sql b/sql/320/5_battleground_template.sql similarity index 100% rename from sql/320/5_battleground_tempalate.sql rename to sql/320/5_battleground_template.sql From f8740c15ef20ce4bebeac149e8ed39d27878c3f8 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Tue, 30 Jun 2009 09:46:27 +0400 Subject: [PATCH 004/132] Updated to latest PTR build 10048. --- src/game/Opcodes.cpp | 55 ++++++++++++++++++++++------------------- src/game/Opcodes.h | 25 +++++++++++-------- src/game/UpdateFields.h | 2 +- src/realmd/AuthCodes.h | 4 +-- 4 files changed, 48 insertions(+), 38 deletions(-) diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp index c2edf1e62..a71829cd3 100644 --- a/src/game/Opcodes.cpp +++ b/src/game/Opcodes.cpp @@ -685,7 +685,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x290*/ { "CMSG_BUYBACK_ITEM", STATUS_LOGGEDIN, &WorldSession::HandleBuybackItem }, /*0x291*/ { "SMSG_SERVER_MESSAGE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x292*/ { "CMSG_MEETINGSTONE_JOIN", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x293*/ { "CMSG_MEETINGSTONE_LEAVE", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x293*/ { "SMSG_MEETINGSTONE_LEAVE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x294*/ { "CMSG_MEETINGSTONE_CHEAT", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x295*/ { "SMSG_MEETINGSTONE_SETQUEUE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x296*/ { "CMSG_MEETINGSTONE_INFO", STATUS_LOGGEDIN, &WorldSession::HandleMeetingStoneInfo }, @@ -1229,8 +1229,8 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x4B0*/ { "UMSG_UNKNOWN_1200", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4B1*/ { "UMSG_UNKNOWN_1201", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4B2*/ { "SMSG_UNKNOWN_1202", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x4B3*/ { "UMSG_UNKNOWN_1203", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4B4*/ { "UMSG_UNKNOWN_1204", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4B3*/ { "CMSG_UNKNOWN_1203", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4B4*/ { "CMSG_UNKNOWN_1204", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4B5*/ { "SMSG_UNKNOWN_1205", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x4B6*/ { "CMSG_UNKNOWN_1206", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4B7*/ { "SMSG_UNKNOWN_1207", STATUS_NEVER, &WorldSession::Handle_ServerSide }, @@ -1255,37 +1255,42 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x4CA*/ { "UMSG_UNKNOWN_1226", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4CB*/ { "UMSG_UNKNOWN_1227", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4CC*/ { "UMSG_UNKNOWN_1228", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4CD*/ { "UMSG_UNKNOWN_1229", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4CE*/ { "UMSG_UNKNOWN_1230", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4CD*/ { "SMSG_UNKNOWN_1229", STATUS_NEVER, &WorldSession::Handle_ServerSide }, + /*0x4CE*/ { "SMSG_UNKNOWN_1230", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x4CF*/ { "UMSG_UNKNOWN_1231", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4D0*/ { "UMSG_UNKNOWN_1232", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4D0*/ { "SMSG_UNKNOWN_1232", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x4D1*/ { "UMSG_UNKNOWN_1233", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4D2*/ { "UMSG_UNKNOWN_1234", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4D3*/ { "UMSG_UNKNOWN_1235", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4D4*/ { "UMSG_UNKNOWN_1236", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4D2*/ { "SMSG_UNKNOWN_1234", STATUS_NEVER, &WorldSession::Handle_ServerSide }, + /*0x4D3*/ { "SMSG_UNKNOWN_1235", STATUS_NEVER, &WorldSession::Handle_ServerSide }, + /*0x4D4*/ { "SMSG_UNKNOWN_1236", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x4D5*/ { "CMSG_EQUIPMENT_SET_USE", STATUS_LOGGEDIN, &WorldSession::HandleEquipmentSetUse }, /*0x4D6*/ { "SMSG_EQUIPMENT_SET_USE_RESULT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x4D7*/ { "UMSG_UNKNOWN_1239", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4D8*/ { "UMSG_UNKNOWN_1240", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4D9*/ { "UMSG_UNKNOWN_1241", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4DA*/ { "UMSG_UNKNOWN_1242", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4D8*/ { "SMSG_UNKNOWN_1240", STATUS_NEVER, &WorldSession::Handle_ServerSide }, + /*0x4D9*/ { "CMSG_UNKNOWN_1241", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4DA*/ { "SMSG_UNKNOWN_1242", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x4DB*/ { "UMSG_UNKNOWN_1243", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4DC*/ { "UMSG_UNKNOWN_1244", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4DD*/ { "UMSG_UNKNOWN_1245", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4DE*/ { "UMSG_UNKNOWN_1246", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4DF*/ { "UMSG_UNKNOWN_1247", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4E0*/ { "UMSG_UNKNOWN_1248", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4E1*/ { "UMSG_UNKNOWN_1249", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4E2*/ { "UMSG_UNKNOWN_1250", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4E3*/ { "UMSG_UNKNOWN_1251", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4E4*/ { "UMSG_UNKNOWN_1252", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4E5*/ { "UMSG_UNKNOWN_1253", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4E6*/ { "UMSG_UNKNOWN_1254", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4E7*/ { "UMSG_UNKNOWN_1255", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4E8*/ { "UMSG_UNKNOWN_1256", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4DE*/ { "SMSG_UNKNOWN_1246", STATUS_NEVER, &WorldSession::Handle_ServerSide }, + /*0x4DF*/ { "CMSG_UNKNOWN_1247", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4E0*/ { "SMSG_UNKNOWN_1248", STATUS_NEVER, &WorldSession::Handle_ServerSide }, + /*0x4E1*/ { "SMSG_UNKNOWN_1249", STATUS_NEVER, &WorldSession::Handle_ServerSide }, + /*0x4E2*/ { "CMSG_UNKNOWN_1250", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4E3*/ { "CMSG_UNKNOWN_1251", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4E4*/ { "SMSG_UNKNOWN_1252", STATUS_NEVER, &WorldSession::Handle_ServerSide }, + /*0x4E5*/ { "SMSG_UNKNOWN_1253", STATUS_NEVER, &WorldSession::Handle_ServerSide }, + /*0x4E6*/ { "SMSG_UNKNOWN_1254", STATUS_NEVER, &WorldSession::Handle_ServerSide }, + /*0x4E7*/ { "CMSG_UNKNOWN_1255", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4E8*/ { "SMSG_UNKNOWN_1256", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x4E9*/ { "UMSG_UNKNOWN_1257", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4EA*/ { "MSG_SET_RAID_DIFFICULTY", STATUS_LOGGEDIN, &WorldSession::HandleSetRaidDifficultyOpcode }, /*0x4EB*/ { "UMSG_UNKNOWN_1259", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4EC*/ { "UMSG_UNKNOWN_1260", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4ED*/ { "UMSG_UNKNOWN_1261", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4EC*/ { "SMSG_TOGGLE_XP_GAIN", STATUS_NEVER, &WorldSession::Handle_ServerSide }, + /*0x4ED*/ { "SMSG_UNKNOWN_1261", STATUS_NEVER, &WorldSession::Handle_ServerSide }, + /*0x4EE*/ { "SMSG_UNKNOWN_1262", STATUS_NEVER, &WorldSession::Handle_ServerSide }, + /*0x4EF*/ { "CMSG_UNKNOWN_1263", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4F0*/ { "SMSG_UNKNOWN_1264", STATUS_NEVER, &WorldSession::Handle_ServerSide }, + /*0x4F1*/ { "UMSG_UNKNOWN_1265", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4F2*/ { "UMSG_UNKNOWN_1266", STATUS_NEVER, &WorldSession::Handle_NULL }, }; diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h index f2b561256..f8dd364ea 100644 --- a/src/game/Opcodes.h +++ b/src/game/Opcodes.h @@ -693,7 +693,7 @@ enum Opcodes CMSG_BUYBACK_ITEM = 0x290, SMSG_SERVER_MESSAGE = 0x291, CMSG_MEETINGSTONE_JOIN = 0x292, - CMSG_MEETINGSTONE_LEAVE = 0x293, // SMSG? + SMSG_MEETINGSTONE_LEAVE = 0x293, CMSG_MEETINGSTONE_CHEAT = 0x294, SMSG_MEETINGSTONE_SETQUEUE = 0x295, CMSG_MEETINGSTONE_INFO = 0x296, @@ -1075,7 +1075,7 @@ enum Opcodes CMSG_REFER_A_FRIEND = 0x40E, MSG_GM_CHANGE_ARENA_RATING = 0x40F, CMSG_DECLINE_CHANNEL_INVITE = 0x410, - CMSG_GROUPACTION_THROTTLED = 0x411, + CMSG_GROUPACTION_THROTTLED = 0x411, // SMSG? SMSG_OVERRIDE_LIGHT = 0x412, SMSG_TOTEM_CREATED = 0x413, CMSG_TOTEM_DESTROYED = 0x414, @@ -1224,7 +1224,7 @@ enum Opcodes SMSG_SERVER_BUCK_DATA_START = 0x4A3, // not found CMSG_QUERY_VEHICLE_STATUS = 0x4A4, // not found UMSG_UNKNOWN_1189 = 0x4A5, // not found, old SMSG_PET_GUIDS - SMSG_UNKNOWN_1190 = 0x4A6, // smsg unk, old SMSG_CLIENTCACHE_VERSION + SMSG_UNKNOWN_1190 = 0x4A6, // smsg unk, "You can't do that yet" SMSG_UNKNOWN_1191 = 0x4A7, // smsg guid+uint32 (vehicle) CMSG_UNKNOWN_1192 = 0x4A8, // cmsg uint64 CMSG_EJECT_PASSENGER = 0x4A9, // cmsg uint64 @@ -1258,7 +1258,7 @@ enum Opcodes UMSG_UNKNOWN_1221 = 0x4C5, // not found 3.2 UMSG_UNKNOWN_1222 = 0x4C6, // not found 3.2 SMSG_UNKNOWN_1223 = 0x4C7, // uint64, arena pet? 3.2 - SMSG_UNKNOWN_1224 = 0x4C8, // uint32 "Can't change arena team..." 3.2 + SMSG_UNKNOWN_1224 = 0x4C8, // uint32 "Can't modify arena team while queued or in a match." 3.2 UMSG_UNKNOWN_1225 = 0x4C9, // not found 3.2 UMSG_UNKNOWN_1226 = 0x4CA, // not found 3.2 UMSG_UNKNOWN_1227 = 0x4CB, // not found 3.2 @@ -1280,14 +1280,14 @@ enum Opcodes UMSG_UNKNOWN_1243 = 0x4DB, // not found 3.2 UMSG_UNKNOWN_1244 = 0x4DC, // not found 3.2 UMSG_UNKNOWN_1245 = 0x4DD, // not found 3.2 - SMSG_UNKNOWN_1246 = 0x4DE, // uint32 + SMSG_UNKNOWN_1246 = 0x4DE, // uint32, BattlefieldMgrEntryInvite CMSG_UNKNOWN_1247 = 0x4DF, // lua: BattlefieldMgrEntryInviteResponse SMSG_UNKNOWN_1248 = 0x4E0, // uint32, uint8, uint8 - SMSG_UNKNOWN_1249 = 0x4E1, // uint32 + SMSG_UNKNOWN_1249 = 0x4E1, // uint32 BattlefieldMgrQueueInvite CMSG_UNKNOWN_1250 = 0x4E2, // lua: BattlefieldMgrQueueInviteResponse CMSG_UNKNOWN_1251 = 0x4E3, // lua: BattlefieldMgrQueueRequest - SMSG_UNKNOWN_1252 = 0x4E4, // uint32, uint8 - SMSG_UNKNOWN_1253 = 0x4E5, // uint32 + SMSG_UNKNOWN_1252 = 0x4E4, // uint32, uint8 queue full/can't join + SMSG_UNKNOWN_1253 = 0x4E5, // uint32 wintergrasp is full, you'll be ejected soon SMSG_UNKNOWN_1254 = 0x4E6, // uint32, uint32, uint8 CMSG_UNKNOWN_1255 = 0x4E7, // lua: BattlefieldMgrExitRequest SMSG_UNKNOWN_1256 = 0x4E8, // uint32, uint32 @@ -1295,8 +1295,13 @@ enum Opcodes MSG_SET_RAID_DIFFICULTY = 0x4EA, // lua: SetRaidDificulty UMSG_UNKNOWN_1259 = 0x4EB, // not found 3.2 SMSG_TOGGLE_XP_GAIN = 0x4EC, // enable/disable XP gain console message - UMSG_UNKNOWN_1261 = 0x4ED, // not found 3.2 - NUM_MSG_TYPES = 0x4EE + SMSG_UNKNOWN_1261 = 0x4ED, + SMSG_UNKNOWN_1262 = 0x4EE, + CMSG_UNKNOWN_1263 = 0x4EF, // lua: GMResponseResolve + SMSG_UNKNOWN_1264 = 0x4F0, + UMSG_UNKNOWN_1265 = 0x4F1, // not found 3.2 + UMSG_UNKNOWN_1266 = 0x4F2, // not found 3.2 + NUM_MSG_TYPES = 0x4F3 }; /// Player state diff --git a/src/game/UpdateFields.h b/src/game/UpdateFields.h index 7a3ef58a8..0efc3d2be 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, 2, 0, 10026 +// Auto generated for version 0, 2, 0, 10048 enum EObjectFields { diff --git a/src/realmd/AuthCodes.h b/src/realmd/AuthCodes.h index 53183244c..dcf53e248 100644 --- a/src/realmd/AuthCodes.h +++ b/src/realmd/AuthCodes.h @@ -66,8 +66,8 @@ enum LoginResult // 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.2.0 client build 10026... +// will only support WoW, WoW:TBC and WoW:WotLK 3.2.0 client build 10048... -#define EXPECTED_MANGOS_CLIENT_BUILD {10026, 0} +#define EXPECTED_MANGOS_CLIENT_BUILD {10048, 0} #endif From 93d3edfc155a80453c06c4b143910aa7b6fea0b0 Mon Sep 17 00:00:00 2001 From: nos4r2zod Date: Wed, 24 Jun 2009 03:42:17 +0400 Subject: [PATCH 005/132] [8074] Fixed typo in money save. Signed-off-by: VladimirMangos --- src/game/Player.cpp | 2 +- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 8d109da90..d851a760d 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -15566,7 +15566,7 @@ void Player::SaveInventoryAndGoldToDB() void Player::SaveGoldToDB() { - CharacterDatabase.PExecute("UPDATE money = '%u' WHERE guid = '%u'", GetMoney(), GetGUIDLow()); + CharacterDatabase.PExecute("UPDATE characters SET money = '%u' WHERE guid = '%u'", GetMoney(), GetGUIDLow()); } void Player::_SaveActions() diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 7cce0da81..24d75161c 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8073" + #define REVISION_NR "8074" #endif // __REVISION_NR_H__ From 4baf32d05f0c681535bbb8e9b965497dff900059 Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Wed, 24 Jun 2009 05:28:44 +0400 Subject: [PATCH 006/132] [8075] Effect at remove for aura of spell 42783. Signed-off-by: VladimirMangos --- src/game/SpellAuras.cpp | 19 ++++++++++++++++--- src/shared/revision_nr.h | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 5808127e5..442da5011 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -4161,10 +4161,23 @@ void Aura::HandleAuraModStalked(bool apply, bool /*Real*/) void Aura::HandlePeriodicTriggerSpell(bool apply, bool /*Real*/) { m_isPeriodic = apply; - if (m_spellProto->Id == 66 && !apply) + + if (!apply) { - if (m_removeMode == AURA_REMOVE_BY_DEFAULT && m_duration<=0) - m_target->CastSpell(m_target, 32612, true, NULL, this); + switch(m_spellProto->Id) + { + case 66: // Invisibility + if (m_removeMode == AURA_REMOVE_BY_DEFAULT && m_duration<=0) + m_target->CastSpell(m_target, 32612, true, NULL, this); + + return; + case 42783: //Wrath of the Astrom... + if (m_removeMode == AURA_REMOVE_BY_DEFAULT && GetEffIndex() + 1 < 3) + m_target->CastSpell(m_target, m_spellProto->CalculateSimpleValue(GetEffIndex()+1), true); + return; + default: + break; + } } } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 24d75161c..539e7691c 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8074" + #define REVISION_NR "8075" #endif // __REVISION_NR_H__ From 9bc57c851212c4e7a86764a659101be681e4c6ee Mon Sep 17 00:00:00 2001 From: thenecromancer Date: Thu, 25 Jun 2009 06:31:28 +0400 Subject: [PATCH 007/132] [8076] Fixed well known walk-after-taxi bug. Also thanks to jolan, yad02, nos4r2zod for deep reseach problem. Signed-off-by: VladimirMangos --- src/game/Unit.cpp | 11 +++-------- src/game/WaypointMovementGenerator.cpp | 5 ++++- src/shared/revision_nr.h | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index e7f2b4947..e0196c9d2 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -11038,15 +11038,10 @@ void Unit::StopMoving() clearUnitState(UNIT_STAT_MOVING); // send explicit stop packet - // rely on vmaps here because for example stormwind is in air - //float z = MapManager::Instance().GetBaseMap(GetMapId())->GetHeight(GetPositionX(), GetPositionY(), GetPositionZ(), true); - //if (fabs(GetPositionZ() - z) < 2.0f) - // Relocate(GetPositionX(), GetPositionY(), z); - Relocate(GetPositionX(), GetPositionY(),GetPositionZ()); + // player expected for correct work MONSTER_MOVE_WALK + SendMonsterMove(GetPositionX(), GetPositionY(), GetPositionZ(), 0, GetTypeId()==TYPEID_PLAYER ? MONSTER_MOVE_WALK : MONSTER_MOVE_NONE, 0); - SendMonsterMove(GetPositionX(), GetPositionY(), GetPositionZ(), 0, 0, 0); - - // update position and orientation; + // update position and orientation for near players WorldPacket data; BuildHeartBeatMsg(&data); SendMessageToSet(&data,false); diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp index 71dd52599..3ee796ed6 100644 --- a/src/game/WaypointMovementGenerator.cpp +++ b/src/game/WaypointMovementGenerator.cpp @@ -38,6 +38,7 @@ alter table creature_movement add `wpguid` int(11) default '0'; #include "DestinationHolderImp.h" #include "CreatureAI.h" #include "WaypointManager.h" +#include "WorldPacket.h" #include @@ -261,7 +262,9 @@ void FlightPathMovementGenerator::Finalize(Player & player) if(player.pvpInfo.inHostileArea) player.CastSpell(&player, 2479, true); - player.SetUnitMovementFlags(MONSTER_MOVE_WALK); + // update z position to ground and orientation for landing point + // this prevent cheating with landing point at lags + // when client side flight end early in comparison server side player.StopMoving(); } } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 539e7691c..958440da3 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8075" + #define REVISION_NR "8076" #endif // __REVISION_NR_H__ From 48caaaffcf1b5ba3d162cdb15fe4d125386be15b Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Thu, 25 Jun 2009 11:03:51 +0400 Subject: [PATCH 008/132] [8077] Resolve mixed store and use 2 different flags values types in single field. * Create new monster move field in Creature class and use it in all cases when expected use MONSTER_MOVE_* flags. * Store and use MOVEMENTFLAG_* values in field in MovementInfo structure of Player class. * Cleanups and fix related code. NOTE: DB in creature_addon store values similar MONSTER_MOVE_* flags, scritps also expected set only this flags. --- src/game/ConfusedMovementGenerator.cpp | 17 ++++--- src/game/Creature.cpp | 42 ++++++++++++++--- src/game/Creature.h | 12 ++++- src/game/FleeingMovementGenerator.cpp | 17 ++++--- src/game/HomeMovementGenerator.cpp | 4 +- src/game/Level3.cpp | 2 +- src/game/MiscHandler.cpp | 4 +- src/game/MovementHandler.cpp | 5 +- src/game/Object.cpp | 37 --------------- src/game/Object.h | 2 - src/game/Player.cpp | 22 +++++++-- src/game/Player.h | 46 ++++++++++++++++-- src/game/PointMovementGenerator.cpp | 2 +- src/game/RandomMovementGenerator.cpp | 23 +++++---- src/game/Spell.cpp | 4 +- src/game/SpellAuras.cpp | 10 ++-- src/game/TargetedMovementGenerator.cpp | 27 ++++++----- src/game/Traveller.h | 6 +-- src/game/Unit.cpp | 65 +++++++++++--------------- src/game/Unit.h | 51 ++------------------ src/game/WaypointMovementGenerator.cpp | 4 +- src/game/World.cpp | 4 +- src/game/WorldSession.cpp | 8 ++-- src/shared/revision_nr.h | 2 +- 24 files changed, 215 insertions(+), 201 deletions(-) diff --git a/src/game/ConfusedMovementGenerator.cpp b/src/game/ConfusedMovementGenerator.cpp index 2d46808c9..84ebdfc6b 100644 --- a/src/game/ConfusedMovementGenerator.cpp +++ b/src/game/ConfusedMovementGenerator.cpp @@ -64,7 +64,6 @@ ConfusedMovementGenerator::Initialize(T &unit) } unit.StopMoving(); - unit.RemoveUnitMovementFlag(MONSTER_MOVE_WALK); unit.addUnitState(UNIT_STAT_CONFUSED); } @@ -72,6 +71,8 @@ template<> void ConfusedMovementGenerator::_InitSpecific(Creature &creature, bool &is_water_ok, bool &is_land_ok) { + creature.RemoveMonsterMoveFlag(MONSTER_MOVE_WALK); + is_water_ok = creature.canSwim(); is_land_ok = creature.canWalk(); } @@ -138,17 +139,21 @@ ConfusedMovementGenerator::Update(T &unit, const uint32 &diff) return true; } -template -void -ConfusedMovementGenerator::Finalize(T &unit) +template<> +void ConfusedMovementGenerator::Finalize(Player &unit) { unit.clearUnitState(UNIT_STAT_CONFUSED); } +template<> +void ConfusedMovementGenerator::Finalize(Creature &unit) +{ + unit.clearUnitState(UNIT_STAT_CONFUSED); + unit.AddMonsterMoveFlag(MONSTER_MOVE_WALK); +} + template void ConfusedMovementGenerator::Initialize(Player &player); template void ConfusedMovementGenerator::Initialize(Creature &creature); -template void ConfusedMovementGenerator::Finalize(Player &player); -template void ConfusedMovementGenerator::Finalize(Creature &creature); template void ConfusedMovementGenerator::Reset(Player &player); template void ConfusedMovementGenerator::Reset(Creature &creature); template bool ConfusedMovementGenerator::Update(Player &player, const uint32 &diff); diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index e8b2a20d6..98e500d8e 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -109,9 +109,10 @@ lootForPickPocketed(false), lootForBody(false), m_groupLootTimer(0), lootingGrou m_lootMoney(0), m_lootRecipient(0), m_deathTimer(0), m_respawnTime(0), m_respawnDelay(25), m_corpseDelay(60), m_respawnradius(0.0f), m_gossipOptionLoaded(false), m_isPet(false), m_isVehicle(false), m_isTotem(false), -m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0), m_AlreadyCallAssistance(false), +m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0), +m_AlreadyCallAssistance(false), m_AlreadySearchedAssistance(false), m_regenHealth(true), m_AI_locked(false), m_isDeadByDefault(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL), -m_creatureInfo(NULL), m_isActiveObject(false), m_AlreadySearchedAssistance(false) +m_creatureInfo(NULL), m_isActiveObject(false), m_monsterMoveFlags(MONSTER_MOVE_WALK) { m_regenTimer = 200; m_valuesCount = UNIT_END; @@ -122,7 +123,8 @@ m_creatureInfo(NULL), m_isActiveObject(false), m_AlreadySearchedAssistance(false m_CreatureSpellCooldowns.clear(); m_CreatureCategoryCooldowns.clear(); m_GlobalCooldown = 0; - m_unit_movement_flags = MONSTER_MOVE_WALK; + + m_monsterMoveFlags = MONSTER_MOVE_WALK; } Creature::~Creature() @@ -1032,7 +1034,7 @@ void Creature::LoadGossipOptions() m_gossipOptionLoaded = true; } -void Creature::AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint32 MovementFlags, uint8 type) +void Creature::AI_SendMoveToPacket(float x, float y, float z, uint32 time, MonsterMovementFlags flags, uint8 type) { /* uint32 timeElap = getMSTime(); if ((timeElap - m_startMove) < m_moveTime) @@ -1052,7 +1054,7 @@ void Creature::AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint3 m_startMove = getMSTime(); m_moveTime = time;*/ - SendMonsterMove(x, y, z, type, MovementFlags, time); + SendMonsterMove(x, y, z, type, flags, time); } Player *Creature::GetLootRecipient() const @@ -1533,7 +1535,7 @@ void Creature::setDeathState(DeathState s) CreatureInfo const *cinfo = GetCreatureInfo(); SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0); RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); - AddUnitMovementFlag(MONSTER_MOVE_WALK); + AddMonsterMoveFlag(MONSTER_MOVE_WALK); SetUInt32Value(UNIT_NPC_FLAGS, cinfo->npcflag); clearUnitState(UNIT_STAT_ALL_STATE); i_motionMaster.Clear(); @@ -1938,7 +1940,7 @@ bool Creature::LoadCreaturesAddon(bool reload) SetUInt32Value(UNIT_NPC_EMOTESTATE, cainfo->emote); if (cainfo->move_flags != 0) - SetUnitMovementFlags(cainfo->move_flags); + SetMonsterMoveFlags(MonsterMovementFlags(cainfo->move_flags)); if(cainfo->auras) { @@ -2279,3 +2281,29 @@ void Creature::SetActiveObjectState( bool on ) if(world) map->Add(this); } + +void Creature::SendMonsterMoveWithSpeedToCurrentDestination(Player* player) +{ + float x, y, z; + if(GetMotionMaster()->GetDestination(x, y, z)) + SendMonsterMoveWithSpeed(x, y, z, 0, player); +} + +void Creature::SendMonsterMoveWithSpeed(float x, float y, float z, uint32 transitTime, Player* player) +{ + if (!transitTime) + { + if(GetTypeId()==TYPEID_PLAYER) + { + Traveller traveller(*(Player*)this); + transitTime = traveller.GetTotalTrevelTimeTo(x,y,z); + } + else + { + Traveller traveller(*(Creature*)this); + transitTime = traveller.GetTotalTrevelTimeTo(x,y,z); + } + } + //float orientation = (float)atan2((double)dy, (double)dx); + SendMonsterMove(x, y, z, 0, GetMonsterMoveFlags(), transitTime, player); +} diff --git a/src/game/Creature.h b/src/game/Creature.h index b76685828..722f05fc9 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -517,9 +517,18 @@ class MANGOS_DLL_SPEC Creature : public Unit bool AIM_Initialize(); - void AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint32 MovementFlags, uint8 type); + void AI_SendMoveToPacket(float x, float y, float z, uint32 time, MonsterMovementFlags MovementFlags, uint8 type); CreatureAI* AI() { return i_AI; } + void AddMonsterMoveFlag(MonsterMovementFlags f) { m_monsterMoveFlags = MonsterMovementFlags(m_monsterMoveFlags | f); } + void RemoveMonsterMoveFlag(MonsterMovementFlags f) { m_monsterMoveFlags = MonsterMovementFlags(m_monsterMoveFlags & ~f); } + bool HasMonsterMoveFlag(MonsterMovementFlags f) const { return m_monsterMoveFlags & f; } + MonsterMovementFlags GetMonsterMoveFlags() const { return m_monsterMoveFlags; } + void SetMonsterMoveFlags(MonsterMovementFlags f) { m_monsterMoveFlags = f; } + + void SendMonsterMoveWithSpeed(float x, float y, float z, uint32 transitTime = 0, Player* player = NULL); + void SendMonsterMoveWithSpeedToCurrentDestination(Player* player = NULL); + uint32 GetShieldBlockValue() const //dunno mob block value { return (getLevel()/2 + uint32(GetStat(STAT_STRENGTH)/20)); @@ -725,6 +734,7 @@ class MANGOS_DLL_SPEC Creature : public Unit GridReference m_gridRef; CreatureInfo const* m_creatureInfo; // in heroic mode can different from ObjMgr::GetCreatureTemplate(GetEntry()) bool m_isActiveObject; + MonsterMovementFlags m_monsterMoveFlags; }; class AssistDelayEvent : public BasicEvent diff --git a/src/game/FleeingMovementGenerator.cpp b/src/game/FleeingMovementGenerator.cpp index f8f193ac9..a74790d9a 100644 --- a/src/game/FleeingMovementGenerator.cpp +++ b/src/game/FleeingMovementGenerator.cpp @@ -285,7 +285,6 @@ FleeingMovementGenerator::Initialize(T &owner) return; _Init(owner); - owner.RemoveUnitMovementFlag(MONSTER_MOVE_WALK); if(Unit * fright = ObjectAccessor::GetUnit(owner, i_frightGUID)) { @@ -313,6 +312,8 @@ FleeingMovementGenerator::_Init(Creature &owner) { if(!&owner) return; + + owner.RemoveMonsterMoveFlag(MONSTER_MOVE_WALK); owner.SetUInt64Value(UNIT_FIELD_TARGET, 0); is_water_ok = owner.canSwim(); is_land_ok = owner.canWalk(); @@ -326,13 +327,19 @@ FleeingMovementGenerator::_Init(Player &) is_land_ok = true; } -template -void -FleeingMovementGenerator::Finalize(T &owner) +template<> +void FleeingMovementGenerator::Finalize(Player &owner) { owner.clearUnitState(UNIT_STAT_FLEEING); } +template<> +void FleeingMovementGenerator::Finalize(Creature &owner) +{ + owner.AddMonsterMoveFlag(MONSTER_MOVE_WALK); + owner.clearUnitState(UNIT_STAT_FLEEING); +} + template void FleeingMovementGenerator::Reset(T &owner) @@ -379,8 +386,6 @@ template bool FleeingMovementGenerator::_getPoint(Player &, float &, flo template bool FleeingMovementGenerator::_getPoint(Creature &, float &, float &, float &); template void FleeingMovementGenerator::_setTargetLocation(Player &); template void FleeingMovementGenerator::_setTargetLocation(Creature &); -template void FleeingMovementGenerator::Finalize(Player &); -template void FleeingMovementGenerator::Finalize(Creature &); template void FleeingMovementGenerator::Reset(Player &); template void FleeingMovementGenerator::Reset(Creature &); template bool FleeingMovementGenerator::Update(Player &, const uint32 &); diff --git a/src/game/HomeMovementGenerator.cpp b/src/game/HomeMovementGenerator.cpp index 5dfbc8345..cc13446f0 100644 --- a/src/game/HomeMovementGenerator.cpp +++ b/src/game/HomeMovementGenerator.cpp @@ -27,7 +27,7 @@ void HomeMovementGenerator::Initialize(Creature & owner) { - owner.RemoveUnitMovementFlag(MONSTER_MOVE_WALK); + owner.RemoveMonsterMoveFlag(MONSTER_MOVE_WALK); _setTargetLocation(owner); } @@ -63,7 +63,7 @@ HomeMovementGenerator::Update(Creature &owner, const uint32& time_diff if (time_diff > i_travel_timer) { - owner.AddUnitMovementFlag(MONSTER_MOVE_WALK); + owner.AddMonsterMoveFlag(MONSTER_MOVE_WALK); // restore orientation of not moving creature at returning to home if(owner.GetDefaultMovementType()==IDLE_MOTION_TYPE) diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 87b26eed7..df3bbdcec 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -6057,7 +6057,7 @@ bool ChatHandler::HandleComeToMeCommand(const char *args) uint32 newFlags = atoi(newFlagStr); - caster->SetUnitMovementFlags(newFlags); + caster->SetMonsterMoveFlags(MonsterMovementFlags(newFlags)); Player* pl = m_session->GetPlayer(); diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 30aa8a7cb..d00b2b331 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -276,7 +276,7 @@ void WorldSession::HandleLogoutRequestOpcode( WorldPacket & /*recv_data*/ ) if( GetPlayer()->isInCombat() || //...is in combat GetPlayer()->duel || //...is in Duel //...is jumping ...is falling - GetPlayer()->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_JUMPING | MOVEMENTFLAG_FALLING)) + GetPlayer()->m_movementInfo.HasMovementFlag(MovementFlags(MOVEMENTFLAG_JUMPING | MOVEMENTFLAG_FALLING))) { WorldPacket data( SMSG_LOGOUT_RESPONSE, (2+4) ) ; data << (uint8)0xC; @@ -1589,7 +1589,7 @@ void WorldSession::HandleMoveSetCanFlyAckOpcode( WorldPacket & recv_data ) recv_data >> guid >> unk >> flags; - _player->m_movementInfo.flags = flags; + _player->m_movementInfo.SetMovementFlags(MovementFlags(flags)); } void WorldSession::HandleRequestPetInfoOpcode( WorldPacket & /*recv_data */) diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index 9afab8936..99d85a988 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -230,7 +230,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data ) return; /* handle special cases */ - if (movementInfo.flags & MOVEMENTFLAG_ONTRANSPORT) + if (movementInfo.HasMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) { // transports size limited // (also received at zeppelin leave by some reason with t_* as absolute in continent coordinates, can be safely skipped) @@ -272,7 +272,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data ) if (opcode == MSG_MOVE_FALL_LAND && plMover && !plMover->isInFlight()) plMover->HandleFall(movementInfo); - if (plMover && ((movementInfo.flags & MOVEMENTFLAG_SWIMMING) != 0) != plMover->IsInWater()) + if (plMover && (movementInfo.HasMovementFlag(MOVEMENTFLAG_SWIMMING) != plMover->IsInWater())) { // now client not include swimming flag in case jumping under water plMover->SetInWater( !plMover->IsInWater() || plMover->GetBaseMap()->IsUnderWater(movementInfo.x, movementInfo.y, movementInfo.z) ); @@ -331,7 +331,6 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data ) { if(Map *map = mover->GetMap()) map->CreatureRelocation((Creature*)mover, movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o); - mover->SetUnitMovementFlags(movementInfo.flags); } } diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 4f16c3dbd..560d607c0 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1511,43 +1511,6 @@ void WorldObject::BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const* *data << (uint8)0; // ChatTag } -void WorldObject::BuildHeartBeatMsg(WorldPacket *data) const -{ - //Heartbeat message cannot be used for non-units - if (!isType(TYPEMASK_UNIT)) - return; - - data->Initialize(MSG_MOVE_HEARTBEAT, 32); - data->append(GetPackGUID()); - *data << uint32(((Unit*)this)->GetUnitMovementFlags()); // movement flags - *data << uint16(0); // 2.3.0 - *data << uint32(getMSTime()); // time - *data << m_positionX; - *data << m_positionY; - *data << m_positionZ; - *data << m_orientation; - *data << uint32(0); -} - -void WorldObject::BuildTeleportAckMsg(WorldPacket *data, float x, float y, float z, float ang) const -{ - //TeleportAck message cannot be used for non-units - if (!isType(TYPEMASK_UNIT)) - return; - - data->Initialize(MSG_MOVE_TELEPORT_ACK, 41); - data->append(GetPackGUID()); - *data << uint32(0); // this value increments every time - *data << uint32(((Unit*)this)->GetUnitMovementFlags()); // movement flags - *data << uint16(0); // 2.3.0 - *data << uint32(getMSTime()); // time - *data << x; - *data << y; - *data << z; - *data << ang; - *data << uint32(0); -} - void WorldObject::SendMessageToSet(WorldPacket *data, bool /*bToSelf*/) { //if object is in world, map for it already created! diff --git a/src/game/Object.h b/src/game/Object.h index 9e4ff7cf6..9e1cdcdd1 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -449,8 +449,6 @@ class MANGOS_DLL_SPEC WorldObject : public Object virtual void SendMessageToSet(WorldPacket *data, bool self); virtual void SendMessageToSetInRange(WorldPacket *data, float dist, bool self); - void BuildHeartBeatMsg( WorldPacket *data ) const; - void BuildTeleportAckMsg( WorldPacket *data, float x, float y, float z, float ang) const; void MonsterSay(const char* text, uint32 language, uint64 TargetGuid); void MonsterYell(const char* text, uint32 language, uint64 TargetGuid); diff --git a/src/game/Player.cpp b/src/game/Player.cpp index d851a760d..58270af9d 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -450,9 +450,6 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa m_summon_y = 0.0f; m_summon_z = 0.0f; - //Default movement to run mode - m_unit_movement_flags = 0; - m_mover = this; m_miniPet = 0; @@ -1625,7 +1622,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati } // reset movement flags at teleport, because player will continue move with these flags after teleport - m_movementInfo.flags = 0; + m_movementInfo.SetMovementFlags(MOVEMENTFLAG_NONE); if ((GetMapId() == mapid) && (!m_transport)) { @@ -17982,7 +17979,7 @@ void Player::SendInitialPacketsBeforeAddToMap() // set fly flag if in fly form or taxi flight to prevent visually drop at ground in showup moment if(HasAuraType(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED) || isInFlight()) - m_movementInfo.flags |= MOVEMENTFLAG_FLYING2; + m_movementInfo.AddMovementFlag(MOVEMENTFLAG_FLYING2); m_mover = this; } @@ -20334,6 +20331,21 @@ void Player::SendClearCooldown( uint32 spell_id, Unit* target ) SendDirectMessage(&data); } +void Player::BuildTeleportAckMsg( WorldPacket *data, float x, float y, float z, float ang ) const +{ + data->Initialize(MSG_MOVE_TELEPORT_ACK, 41); + data->append(GetPackGUID()); + *data << uint32(0); // this value increments every time + *data << uint32(m_movementInfo.GetMovementFlags()); // movement flags + *data << uint16(0); // 2.3.0 + *data << uint32(getMSTime()); // time + *data << x; + *data << y; + *data << z; + *data << ang; + *data << uint32(0); +} + void Player::SendDuelCountdown(uint32 counter) { WorldPacket data(SMSG_DUEL_COUNTDOWN, 4); diff --git a/src/game/Player.h b/src/game/Player.h index f5600e409..0cfd44065 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -687,10 +687,42 @@ enum InstanceResetWarningType RAID_INSTANCE_EXPIRED = 5 }; +// used in most movement packets (send and received) +enum MovementFlags +{ + MOVEMENTFLAG_NONE = 0x00000000, + MOVEMENTFLAG_FORWARD = 0x00000001, + MOVEMENTFLAG_BACKWARD = 0x00000002, + MOVEMENTFLAG_STRAFE_LEFT = 0x00000004, + MOVEMENTFLAG_STRAFE_RIGHT = 0x00000008, + MOVEMENTFLAG_LEFT = 0x00000010, + MOVEMENTFLAG_RIGHT = 0x00000020, + MOVEMENTFLAG_PITCH_UP = 0x00000040, + MOVEMENTFLAG_PITCH_DOWN = 0x00000080, + MOVEMENTFLAG_WALK_MODE = 0x00000100, // Walking + MOVEMENTFLAG_ONTRANSPORT = 0x00000200, // Used for flying on some creatures + MOVEMENTFLAG_LEVITATING = 0x00000400, + MOVEMENTFLAG_FLY_UNK1 = 0x00000800, + MOVEMENTFLAG_JUMPING = 0x00001000, + MOVEMENTFLAG_UNK4 = 0x00002000, + MOVEMENTFLAG_FALLING = 0x00004000, + // 0x8000, 0x10000, 0x20000, 0x40000, 0x80000, 0x100000 + MOVEMENTFLAG_SWIMMING = 0x00200000, // appears with fly flag also + MOVEMENTFLAG_FLY_UP = 0x00400000, + MOVEMENTFLAG_CAN_FLY = 0x00800000, + MOVEMENTFLAG_FLYING = 0x01000000, + MOVEMENTFLAG_FLYING2 = 0x02000000, // Actual flying mode + MOVEMENTFLAG_SPLINE = 0x04000000, // used for flight paths + MOVEMENTFLAG_SPLINE2 = 0x08000000, // used for flight paths + MOVEMENTFLAG_WATERWALKING = 0x10000000, // prevent unit from falling through water + MOVEMENTFLAG_SAFE_FALL = 0x20000000, // active rogue safe fall spell (passive) + MOVEMENTFLAG_UNK3 = 0x40000000 +}; + struct MovementInfo { // common - uint32 flags; + uint32 flags; // see enum MovementFlags uint16 unk1; uint32 time; float x, y, z, o; @@ -710,16 +742,18 @@ struct MovementInfo MovementInfo() { - flags = 0; + flags = MOVEMENTFLAG_NONE; time = t_time = fallTime = 0; unk1 = 0; x = y = z = o = t_x = t_y = t_z = t_o = s_pitch = j_unk = j_sinAngle = j_cosAngle = j_xyspeed = u_unk1 = 0.0f; t_guid = 0; } - uint32 GetMovementFlags() { return flags; } - void AddMovementFlag(uint32 flag) { flags |= flag; } - bool HasMovementFlag(uint32 flag) const { return flags & flag; } + void AddMovementFlag(MovementFlags f) { flags |= f; } + void RemoveMovementFlag(MovementFlags f) { flags &= ~f; } + bool HasMovementFlag(MovementFlags f) const { return flags & f; } + MovementFlags GetMovementFlags() const { return MovementFlags(flags); } + void SetMovementFlags(MovementFlags f) { flags = f; } }; // flags that use in movement check for example at spell casting @@ -1949,6 +1983,8 @@ class MANGOS_DLL_SPEC Player : public Unit } void HandleFall(MovementInfo const& movementInfo); + void BuildTeleportAckMsg( WorldPacket *data, float x, float y, float z, float ang) const; + bool isMoving() const { return m_movementInfo.HasMovementFlag(movementFlagsMask); } bool isMovingOrTurning() const { return m_movementInfo.HasMovementFlag(movementOrTurningFlagsMask); } diff --git a/src/game/PointMovementGenerator.cpp b/src/game/PointMovementGenerator.cpp index 57d6f058b..19f596dd2 100644 --- a/src/game/PointMovementGenerator.cpp +++ b/src/game/PointMovementGenerator.cpp @@ -33,7 +33,7 @@ void PointMovementGenerator::Initialize(T &unit) i_destinationHolder.SetDestination(traveller,i_x,i_y,i_z); if (unit.GetTypeId() == TYPEID_UNIT && ((Creature*)&unit)->canFly()) - unit.AddUnitMovementFlag(MONSTER_MOVE_FLY); + ((Creature&)unit).AddMonsterMoveFlag(MONSTER_MOVE_FLY); } template diff --git a/src/game/RandomMovementGenerator.cpp b/src/game/RandomMovementGenerator.cpp index fcd9f7fc7..5cb713cbc 100644 --- a/src/game/RandomMovementGenerator.cpp +++ b/src/game/RandomMovementGenerator.cpp @@ -90,13 +90,13 @@ RandomMovementGenerator::_setRandomLocation(Creature &creature) if (is_air_ok) { i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime()); - creature.AddUnitMovementFlag(MONSTER_MOVE_FLY); + creature.AddMonsterMoveFlag(MONSTER_MOVE_FLY); } //else if (is_water_ok) // Swimming mode to be done with more than this check else { i_nextMoveTime.Reset(urand(500+i_destinationHolder.GetTotalTravelTime(),5000+i_destinationHolder.GetTotalTravelTime())); - creature.SetUnitMovementFlags(MONSTER_MOVE_WALK); + creature.AddMonsterMoveFlag(MONSTER_MOVE_WALK); } } @@ -108,9 +108,13 @@ RandomMovementGenerator::Initialize(Creature &creature) return; if (creature.canFly()) - creature.AddUnitMovementFlag(MONSTER_MOVE_FLY); + creature.AddMonsterMoveFlag(MONSTER_MOVE_FLY); + + else if(irand(0,RUNNING_CHANCE_RANDOMMV) > 0) + creature.AddMonsterMoveFlag(MONSTER_MOVE_WALK); else - creature.SetUnitMovementFlags(irand(0,RUNNING_CHANCE_RANDOMMV) > 0 ? MONSTER_MOVE_WALK : MONSTER_MOVE_NONE); + creature.RemoveMonsterMoveFlag(MONSTER_MOVE_WALK); // run with 1/RUNNING_CHANCE_RANDOMMV chance + _setRandomLocation(creature); } @@ -147,14 +151,17 @@ RandomMovementGenerator::Update(Creature &creature, const uint32 &diff if(i_nextMoveTime.Passed()) { if (creature.canFly()) - creature.AddUnitMovementFlag(MONSTER_MOVE_FLY); - else - creature.SetUnitMovementFlags(irand(0,RUNNING_CHANCE_RANDOMMV) > 0 ? MONSTER_MOVE_WALK : MONSTER_MOVE_NONE); + creature.AddMonsterMoveFlag(MONSTER_MOVE_FLY); + else if(irand(0,RUNNING_CHANCE_RANDOMMV) > 0) + creature.AddMonsterMoveFlag(MONSTER_MOVE_WALK); + else // run with 1/RUNNING_CHANCE_RANDOMMV chance + creature.RemoveMonsterMoveFlag(MONSTER_MOVE_WALK); + _setRandomLocation(creature); } else if(creature.isPet() && creature.GetOwner() && !creature.IsWithinDist(creature.GetOwner(),PET_FOLLOW_DIST+2.5f)) { - creature.SetUnitMovementFlags(MONSTER_MOVE_WALK); + creature.AddMonsterMoveFlag(MONSTER_MOVE_WALK); _setRandomLocation(creature); } } diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 71351659f..51553cabb 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2579,7 +2579,7 @@ void Spell::update(uint32 difftime) // check if the player caster has moved before the spell finished if ((m_caster->GetTypeId() == TYPEID_PLAYER && m_timer != 0) && (m_castPositionX != m_caster->GetPositionX() || m_castPositionY != m_caster->GetPositionY() || m_castPositionZ != m_caster->GetPositionZ()) && - (m_spellInfo->Effect[0] != SPELL_EFFECT_STUCK || !m_caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING))) + (m_spellInfo->Effect[0] != SPELL_EFFECT_STUCK || !((Player*)m_caster)->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_FALLING))) { // always cancel for channeled spells if( m_spellState == SPELL_STATE_CASTING ) @@ -2611,7 +2611,7 @@ void Spell::update(uint32 difftime) if( m_caster->GetTypeId() == TYPEID_PLAYER ) { // check if player has jumped before the channeling finished - if(m_caster->HasUnitMovementFlag(MOVEMENTFLAG_JUMPING)) + if(((Player*)m_caster)->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_JUMPING)) cancel(); // check for incapacitating player states diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 442da5011..7ccc4eb5a 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -3174,7 +3174,7 @@ void Aura::HandleModPossessPet(bool apply, bool Real) { pet->AttackStop(); pet->GetMotionMaster()->MoveFollow(caster, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); - pet->SetUnitMovementFlags(MONSTER_MOVE_WALK); + pet->AddMonsterMoveFlag(MONSTER_MOVE_WALK); } } @@ -3415,10 +3415,10 @@ void Aura::HandleAuraModStun(bool apply, bool Real) // Creature specific if(m_target->GetTypeId() != TYPEID_PLAYER) - ((Creature*)m_target)->StopMoving(); + m_target->StopMoving(); else { - ((Player*)m_target)->m_movementInfo.flags = 0; // Clear movement flags + ((Player*)m_target)->m_movementInfo.SetMovementFlags(MOVEMENTFLAG_NONE); m_target->SetStandState(UNIT_STAND_STATE_STAND);// in 1.5 client } @@ -3702,10 +3702,10 @@ void Aura::HandleAuraModRoot(bool apply, bool Real) m_target->SendMessageToSet(&data, true); //Clear unit movement flags - ((Player*)m_target)->m_movementInfo.flags = 0; + ((Player*)m_target)->m_movementInfo.SetMovementFlags(MOVEMENTFLAG_NONE); } else - ((Creature *)m_target)->StopMoving(); + m_target->StopMoving(); } else { diff --git a/src/game/TargetedMovementGenerator.cpp b/src/game/TargetedMovementGenerator.cpp index 6643f2a26..f33cbcfd6 100644 --- a/src/game/TargetedMovementGenerator.cpp +++ b/src/game/TargetedMovementGenerator.cpp @@ -85,24 +85,29 @@ TargetedMovementGenerator::_setTargetLocation(T &owner) i_destinationHolder.SetDestination(traveller, x, y, z); owner.addUnitState(UNIT_STAT_CHASE); if (owner.GetTypeId() == TYPEID_UNIT && ((Creature*)&owner)->canFly()) - owner.AddUnitMovementFlag(MONSTER_MOVE_FLY); + ((Creature&)owner).AddMonsterMoveFlag(MONSTER_MOVE_FLY); } -template -void -TargetedMovementGenerator::Initialize(T &owner) +template<> +void TargetedMovementGenerator::Initialize(Creature &owner) { - if (owner.GetTypeId() == TYPEID_UNIT && ((Creature*)&owner)->HasSearchedAssistance()) - owner.AddUnitMovementFlag(MONSTER_MOVE_WALK); + if (owner.HasSearchedAssistance()) + owner.AddMonsterMoveFlag(MONSTER_MOVE_WALK); else - owner.RemoveUnitMovementFlag(MONSTER_MOVE_WALK); + owner.RemoveMonsterMoveFlag(MONSTER_MOVE_WALK); - if (owner.GetTypeId() == TYPEID_UNIT && ((Creature*)&owner)->canFly()) - owner.AddUnitMovementFlag(MONSTER_MOVE_FLY); + if (((Creature*)&owner)->canFly()) + owner.AddMonsterMoveFlag(MONSTER_MOVE_FLY); _setTargetLocation(owner); } +template<> +void TargetedMovementGenerator::Initialize(Player &owner) +{ + _setTargetLocation(owner); +} + template void TargetedMovementGenerator::Finalize(T &owner) @@ -150,7 +155,7 @@ TargetedMovementGenerator::Update(T &owner, const uint32 & time_diff) { owner.addUnitState(UNIT_STAT_CHASE); if (owner.GetTypeId() == TYPEID_UNIT && ((Creature*)&owner)->canFly()) - owner.AddUnitMovementFlag(MONSTER_MOVE_FLY); + ((Creature&)owner).AddMonsterMoveFlag(MONSTER_MOVE_FLY); i_destinationHolder.StartTravel(traveller); return true; @@ -199,8 +204,6 @@ TargetedMovementGenerator::GetTarget() const template void TargetedMovementGenerator::_setTargetLocation(Player &); template void TargetedMovementGenerator::_setTargetLocation(Creature &); -template void TargetedMovementGenerator::Initialize(Player &); -template void TargetedMovementGenerator::Initialize(Creature &); template void TargetedMovementGenerator::Finalize(Player &); template void TargetedMovementGenerator::Finalize(Creature &); template void TargetedMovementGenerator::Reset(Player &); diff --git a/src/game/Traveller.h b/src/game/Traveller.h index 0e98d8c0d..deb453dfa 100644 --- a/src/game/Traveller.h +++ b/src/game/Traveller.h @@ -71,9 +71,9 @@ inline uint32 Traveller::GetTotalTrevelTimeTo(float x, float y, float z) template<> inline float Traveller::Speed() { - if(i_traveller.HasUnitMovementFlag(MONSTER_MOVE_WALK)) + if(i_traveller.HasMonsterMoveFlag(MONSTER_MOVE_WALK)) return i_traveller.GetSpeed(MOVE_WALK); - else if(i_traveller.HasUnitMovementFlag(MONSTER_MOVE_FLY)) + else if(i_traveller.HasMonsterMoveFlag(MONSTER_MOVE_FLY)) return i_traveller.GetSpeed(MOVE_FLIGHT); else return i_traveller.GetSpeed(MOVE_RUN); @@ -102,7 +102,7 @@ inline float Traveller::GetMoveDestinationTo(float x, float y, float z template<> inline void Traveller::MoveTo(float x, float y, float z, uint32 t) { - i_traveller.AI_SendMoveToPacket(x, y, z, t, i_traveller.GetUnitMovementFlags(), 0); + i_traveller.AI_SendMoveToPacket(x, y, z, t, i_traveller.GetMonsterMoveFlags(), 0); } // specialization for players diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index e0196c9d2..697367c53 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -150,7 +150,6 @@ Unit::Unit() m_removedAuras = 0; m_charmInfo = NULL; - m_unit_movement_flags = 0; // remove aurastates allowing special moves for(int i=0; i < MAX_REACTIVE; ++i) @@ -229,33 +228,7 @@ bool Unit::haveOffhandWeapon() const return false; } -void Unit::SendMonsterMoveWithSpeedToCurrentDestination(Player* player) -{ - float x, y, z; - if(GetMotionMaster()->GetDestination(x, y, z)) - SendMonsterMoveWithSpeed(x, y, z, 0, player); -} - -void Unit::SendMonsterMoveWithSpeed(float x, float y, float z, uint32 transitTime, Player* player) -{ - if (!transitTime) - { - if(GetTypeId()==TYPEID_PLAYER) - { - Traveller traveller(*(Player*)this); - transitTime = traveller.GetTotalTrevelTimeTo(x,y,z); - } - else - { - Traveller traveller(*(Creature*)this); - transitTime = traveller.GetTotalTrevelTimeTo(x,y,z); - } - } - //float orientation = (float)atan2((double)dy, (double)dx); - SendMonsterMove(x, y, z, 0, GetUnitMovementFlags(), transitTime, player); -} - -void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player) +void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, MonsterMovementFlags flags, uint32 Time, Player* player) { float moveTime = Time; @@ -286,9 +259,9 @@ void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 ty break; } - data << uint32(MovementFlags); + data << uint32(flags); - if(MovementFlags & MONSTER_MOVE_WALK) + if(flags & MONSTER_MOVE_WALK) moveTime *= 1.05f; data << uint32(moveTime); // Time in between points @@ -301,7 +274,7 @@ void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 ty SendMessageToSet( &data, true ); } -void Unit::SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end, uint32 MovementFlags) +void Unit::SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end, MonsterMovementFlags flags) { uint32 traveltime = uint32(path.GetTotalLength(start, end) * 32); @@ -314,14 +287,32 @@ void Unit::SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end, uin data << GetPositionY(); data << GetPositionZ(); data << uint32(getMSTime()); - data << uint8( 0 ); - data << uint32( MovementFlags ); - data << uint32( traveltime ); - data << uint32( pathSize ); - data.append( (char*)path.GetNodes(start), pathSize * 4 * 3 ); + data << uint8(0); + data << uint32(flags); + data << uint32(traveltime); + data << uint32(pathSize); + data.append((char*)path.GetNodes(start), pathSize * 4 * 3); SendMessageToSet(&data, true); } +void Unit::BuildHeartBeatMsg(WorldPacket *data) const +{ + MovementFlags move_flags = GetTypeId()==TYPEID_PLAYER + ? ((Player const*)this)->m_movementInfo.GetMovementFlags() + : MOVEMENTFLAG_NONE; + + data->Initialize(MSG_MOVE_HEARTBEAT, 32); + data->append(GetPackGUID()); + *data << uint32(move_flags); // movement flags + *data << uint16(0); // 2.3.0 + *data << uint32(getMSTime()); // time + *data << float(GetPositionX()); + *data << float(GetPositionY()); + *data << float(GetPositionZ()); + *data << float(GetOrientation()); + *data << uint32(0); +} + void Unit::resetAttackTimer(WeaponAttackType type) { m_attackTimer[type] = uint32(GetAttackTime(type) * m_modAttackSpeedPct[type]); @@ -11726,8 +11717,6 @@ void Unit::NearTeleportTo( float x, float y, float z, float orientation, bool ca GetMap()->CreatureRelocation((Creature*)this, x, y, z, orientation); WorldPacket data; - // Work strange for many spells: triggered active mover set for targeted player to creature - //BuildTeleportAckMsg(&data, x, y, z, orientation); BuildHeartBeatMsg(&data); SendMessageToSet(&data, false); } diff --git a/src/game/Unit.h b/src/game/Unit.h index 081b71e41..4b4b27d34 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -566,37 +566,7 @@ enum NPCFlags UNIT_NPC_FLAG_GUARD = 0x10000000, // custom flag for guards }; -enum MovementFlags -{ - MOVEMENTFLAG_NONE = 0x00000000, - MOVEMENTFLAG_FORWARD = 0x00000001, - MOVEMENTFLAG_BACKWARD = 0x00000002, - MOVEMENTFLAG_STRAFE_LEFT = 0x00000004, - MOVEMENTFLAG_STRAFE_RIGHT = 0x00000008, - MOVEMENTFLAG_LEFT = 0x00000010, - MOVEMENTFLAG_RIGHT = 0x00000020, - MOVEMENTFLAG_PITCH_UP = 0x00000040, - MOVEMENTFLAG_PITCH_DOWN = 0x00000080, - MOVEMENTFLAG_WALK_MODE = 0x00000100, // Walking - MOVEMENTFLAG_ONTRANSPORT = 0x00000200, // Used for flying on some creatures - MOVEMENTFLAG_LEVITATING = 0x00000400, - MOVEMENTFLAG_FLY_UNK1 = 0x00000800, - MOVEMENTFLAG_JUMPING = 0x00001000, - MOVEMENTFLAG_UNK4 = 0x00002000, - MOVEMENTFLAG_FALLING = 0x00004000, - // 0x8000, 0x10000, 0x20000, 0x40000, 0x80000, 0x100000 - MOVEMENTFLAG_SWIMMING = 0x00200000, // appears with fly flag also - MOVEMENTFLAG_FLY_UP = 0x00400000, - MOVEMENTFLAG_CAN_FLY = 0x00800000, - MOVEMENTFLAG_FLYING = 0x01000000, - MOVEMENTFLAG_FLYING2 = 0x02000000, // Actual flying mode - MOVEMENTFLAG_SPLINE = 0x04000000, // used for flight paths - MOVEMENTFLAG_SPLINE2 = 0x08000000, // used for flight paths - MOVEMENTFLAG_WATERWALKING = 0x10000000, // prevent unit from falling through water - MOVEMENTFLAG_SAFE_FALL = 0x20000000, // active rogue safe fall spell (passive) - MOVEMENTFLAG_UNK3 = 0x40000000 -}; - +// used in SMSG_MONSTER_MOVE enum MonsterMovementFlags { MONSTER_MOVE_NONE = 0x00000000, @@ -1143,10 +1113,10 @@ class MANGOS_DLL_SPEC Unit : public WorldObject void NearTeleportTo(float x, float y, float z, float orientation, bool casting = false); - void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player = NULL); - void SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end, uint32 MovementFlags); - void SendMonsterMoveWithSpeed(float x, float y, float z, uint32 transitTime = 0, Player* player = NULL); - void SendMonsterMoveWithSpeedToCurrentDestination(Player* player = NULL); + void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, MonsterMovementFlags flags, uint32 Time, Player* player = NULL); + void SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end, MonsterMovementFlags flags); + + void BuildHeartBeatMsg( WorldPacket *data ) const; virtual void MoveOutOfRange(Player &) { }; @@ -1474,16 +1444,6 @@ class MANGOS_DLL_SPEC Unit : public WorldObject bool IsStopped() const { return !(hasUnitState(UNIT_STAT_MOVING)); } void StopMoving(); - void AddUnitMovementFlag(uint32 f) { m_unit_movement_flags |= f; } - void RemoveUnitMovementFlag(uint32 f) - { - uint32 oldval = m_unit_movement_flags; - m_unit_movement_flags = oldval & ~f; - } - uint32 HasUnitMovementFlag(uint32 f) const { return m_unit_movement_flags & f; } - uint32 GetUnitMovementFlags() const { return m_unit_movement_flags; } - void SetUnitMovementFlags(uint32 f) { m_unit_movement_flags = f; } - void SetFeared(bool apply, uint64 casterGUID = 0, uint32 spellID = 0, uint32 time = 0); void SetConfused(bool apply, uint64 casterGUID = 0, uint32 spellID = 0); @@ -1558,7 +1518,6 @@ class MANGOS_DLL_SPEC Unit : public WorldObject virtual SpellSchoolMask GetMeleeDamageSchoolMask() const; MotionMaster i_motionMaster; - uint32 m_unit_movement_flags; uint32 m_reactiveTimer[MAX_REACTIVE]; uint32 m_regenTimer; diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp index 3ee796ed6..874fadf79 100644 --- a/src/game/WaypointMovementGenerator.cpp +++ b/src/game/WaypointMovementGenerator.cpp @@ -110,7 +110,7 @@ bool WaypointMovementGenerator::Update(Creature &creature, const uint3 // Now we re-set destination to same node and start travel creature.addUnitState(UNIT_STAT_ROAMING); if (creature.canFly()) - creature.AddUnitMovementFlag(MONSTER_MOVE_FLY); + creature.AddMonsterMoveFlag(MONSTER_MOVE_FLY); const WaypointNode &node = i_path->at(i_currentNode); i_destinationHolder.SetDestination(traveller, node.x, node.y, node.z); i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime()); @@ -173,7 +173,7 @@ bool WaypointMovementGenerator::Update(Creature &creature, const uint3 { creature.addUnitState(UNIT_STAT_ROAMING); if (creature.canFly()) - creature.AddUnitMovementFlag(MONSTER_MOVE_FLY); + creature.AddMonsterMoveFlag(MONSTER_MOVE_FLY); const WaypointNode &node = i_path->at(i_currentNode); i_destinationHolder.SetDestination(traveller, node.x, node.y, node.z); i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime()); diff --git a/src/game/World.cpp b/src/game/World.cpp index 1bfe54577..87b06e7b8 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -1821,8 +1821,8 @@ void World::ScriptsProcess() sLog.outError("SCRIPT_COMMAND_MOVE_TO call for non-creature (TypeId: %u), skipping.",source->GetTypeId()); break; } - ((Unit *)source)->SendMonsterMoveWithSpeed(step.script->x, step.script->y, step.script->z, step.script->datalong2 ); - ((Unit *)source)->GetMap()->CreatureRelocation(((Creature *)source), step.script->x, step.script->y, step.script->z, 0); + ((Creature*)source)->SendMonsterMoveWithSpeed(step.script->x, step.script->y, step.script->z, step.script->datalong2 ); + ((Creature*)source)->GetMap()->CreatureRelocation(((Creature*)source), step.script->x, step.script->y, step.script->z, 0); break; case SCRIPT_COMMAND_FLAG_SET: if(!source) diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index 7279352f2..f0d11f587 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -635,7 +635,7 @@ void WorldSession::ReadMovementInfo(WorldPacket &data, MovementInfo *mi) data >> mi->z; data >> mi->o; - if(mi->flags & MOVEMENTFLAG_ONTRANSPORT) + if(mi->HasMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) { if(!data.readPackGUID(mi->t_guid)) return; @@ -649,7 +649,7 @@ void WorldSession::ReadMovementInfo(WorldPacket &data, MovementInfo *mi) data >> mi->t_seat; } - if((mi->flags & (MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING2)) || (mi->unk1 & 0x20)) + if((mi->HasMovementFlag(MovementFlags(MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING2))) || (mi->unk1 & 0x20)) { CHECK_PACKET_SIZE(data, data.rpos()+4); data >> mi->s_pitch; @@ -658,7 +658,7 @@ void WorldSession::ReadMovementInfo(WorldPacket &data, MovementInfo *mi) CHECK_PACKET_SIZE(data, data.rpos()+4); data >> mi->fallTime; - if(mi->flags & MOVEMENTFLAG_JUMPING) + if(mi->HasMovementFlag(MOVEMENTFLAG_JUMPING)) { CHECK_PACKET_SIZE(data, data.rpos()+4+4+4+4); data >> mi->j_unk; @@ -667,7 +667,7 @@ void WorldSession::ReadMovementInfo(WorldPacket &data, MovementInfo *mi) data >> mi->j_xyspeed; } - if(mi->flags & MOVEMENTFLAG_SPLINE) + if(mi->HasMovementFlag(MOVEMENTFLAG_SPLINE)) { CHECK_PACKET_SIZE(data, data.rpos()+4); data >> mi->u_unk1; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 958440da3..97c16489c 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8076" + #define REVISION_NR "8077" #endif // __REVISION_NR_H__ From fc5dde85c459ba432ca66d4355d6ea1874e99710 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Fri, 26 Jun 2009 04:01:31 +0400 Subject: [PATCH 009/132] [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. --- src/game/Player.cpp | 16 +++++++++++----- src/game/Player.h | 1 + src/shared/revision_nr.h | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 58270af9d..a8181b509 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -13944,9 +13944,11 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) // overwrite some data fields uint32 bytes0 = GetUInt32Value(UNIT_FIELD_BYTES_0) & 0xFF000000; - bytes0 |= fields[4].GetUInt8(); - bytes0 |= fields[5].GetUInt8() << 8; - bytes0 |= fields[6].GetUInt8() << 16; + bytes0 |= fields[4].GetUInt8(); // race + bytes0 |= fields[5].GetUInt8() << 8; // class + bytes0 |= fields[6].GetUInt8() << 16; // gender + SetUInt32Value(UNIT_FIELD_BYTES_0, bytes0); + SetUInt32Value(UNIT_FIELD_LEVEL, fields[7].GetUInt8()); SetUInt32Value(PLAYER_XP, fields[8].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) float bubble1 = 0.125; - if((int32)fields[23].GetUInt32() > 0) + if(time_diff > 0) { float bubble = fields[24].GetUInt32() > 0 ? 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 - uint32 extraflags = fields[25].GetUInt32(); + uint32 extraflags = fields[32].GetUInt32(); m_stableSlots = fields[33].GetUInt32(); if(m_stableSlots > MAX_PET_STABLES) @@ -20346,6 +20348,10 @@ void Player::BuildTeleportAckMsg( WorldPacket *data, float x, float y, float z, *data << uint32(0); } +bool Player::HasMovementFlag( MovementFlags f ) const +{ + return m_movementInfo.HasMovementFlag(f); +} void Player::SendDuelCountdown(uint32 counter) { WorldPacket data(SMSG_DUEL_COUNTDOWN, 4); diff --git a/src/game/Player.h b/src/game/Player.h index 0cfd44065..53a30efef 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1974,6 +1974,7 @@ class MANGOS_DLL_SPEC Player : public Unit /*** VARIOUS SYSTEMS ***/ /*********************************************************/ MovementInfo m_movementInfo; + bool HasMovementFlag(MovementFlags f) const; // for script access to m_movementInfo.HasMovementFlag void UpdateFallInformationIfNeed(MovementInfo const& minfo,uint16 opcode); Unit *m_mover; void SetFallInformation(uint32 time, float z) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 97c16489c..714dddb03 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8077" + #define REVISION_NR "8078" #endif // __REVISION_NR_H__ From 0a8f9ac6e998621a083330c7459ac9eb059132c6 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Fri, 26 Jun 2009 23:23:26 +0400 Subject: [PATCH 010/132] [8079] Fixed build errors at use old ACE versions (without ace/Stack_Trace.h). --- configure.ac | 2 ++ src/shared/Errors.h | 14 +++++++++++++- src/shared/revision_nr.h | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 3111eacb2..7a1b219ec 100644 --- a/configure.ac +++ b/configure.ac @@ -228,6 +228,8 @@ fi AM_CONDITIONAL([MANGOS_BUILD_ACE], [test X$need_to_build_ace = Xyes]) +# old ace versions not have ace/Stack_Trace.h +AC_CHECK_HEADERS([ace/Stack_Trace.h]) ## Unify all additional includes/libs in one variable. # TODO this looks kinda ugly, but when we add m4 folder I will make it look very pritey ( by Derex ). diff --git a/src/shared/Errors.h b/src/shared/Errors.h index 7dd9dc52d..01d504229 100644 --- a/src/shared/Errors.h +++ b/src/shared/Errors.h @@ -19,9 +19,21 @@ #ifndef MANGOSSERVER_ERRORS_H #define MANGOSSERVER_ERRORS_H -#include "ace/Stack_Trace.h" +#include "Common.h" +#ifndef HAVE_CONFIG_H +#define HAVE_ACE_STACK_TRACE_H 1 +#endif + +#ifdef HAVE_ACE_STACK_TRACE_H +#include "ace/Stack_Trace.h" +#endif + +#ifdef HAVE_ACE_STACK_TRACE_H // old versions ACE not have Stack_Trace.h but used at some oS for better compatibility #define WPAssert( assertion ) { if (!(assertion)) { ACE_Stack_Trace st; fprintf( stderr, "\n%s:%i in %s ASSERTION FAILED:\n %s\n%s\n", __FILE__, __LINE__,__FUNCTION__, #assertion, st.c_str()); assert( #assertion &&0 ); } } +#else +#define WPAssert( assertion ) { if (!(assertion)) { fprintf( stderr, "\n%s:%i in %s ASSERTION FAILED2:\n %s\n", __FILE__, __LINE__,__FUNCTION__, #assertion); assert( #assertion &&0 ); } } +#endif #define WPError( assertion, errmsg ) if( ! (assertion) ) { sLog.outError( "%\n%s:%i in %s ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg ); assert( false ); } #define WPWarning( assertion, errmsg ) if( ! (assertion) ) { sLog.outError( "\n%s:%i in %s WARNING:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg ); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 714dddb03..a2a499339 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8078" + #define REVISION_NR "8079" #endif // __REVISION_NR_H__ From cc23cf46531c8e00cfd2d84f995b5def2ec10e00 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 27 Jun 2009 02:19:37 +0400 Subject: [PATCH 011/132] [8080] Portability fixes for some Unix platforms. * Add #include to some fiels where related functions call. * Avoid template dependent lookup for fields in class LockedQueue. --- dep/src/sockets/SocketHandler.cpp | 1 + dep/src/sockets/StdoutLog.cpp | 2 + dep/src/sockets/TcpSocket.cpp | 1 + src/shared/LockedQueue.h | 53 ++++++++++----------------- src/shared/revision_nr.h | 2 +- src/shared/vmap/CoordModelMapping.cpp | 8 ++++ src/shared/vmap/CoordModelMapping.h | 7 +--- src/shared/vmap/DebugCmdLogger.cpp | 1 + 8 files changed, 34 insertions(+), 41 deletions(-) diff --git a/dep/src/sockets/SocketHandler.cpp b/dep/src/sockets/SocketHandler.cpp index 9ec5412af..f2a4f7c30 100644 --- a/dep/src/sockets/SocketHandler.cpp +++ b/dep/src/sockets/SocketHandler.cpp @@ -33,6 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #endif #endif #include +#include #include #include "SocketHandler.h" diff --git a/dep/src/sockets/StdoutLog.cpp b/dep/src/sockets/StdoutLog.cpp index c01d8b8c2..f9251c326 100644 --- a/dep/src/sockets/StdoutLog.cpp +++ b/dep/src/sockets/StdoutLog.cpp @@ -27,6 +27,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include + #ifdef _MSC_VER #pragma warning(disable:4786) #endif diff --git a/dep/src/sockets/TcpSocket.cpp b/dep/src/sockets/TcpSocket.cpp index 36df37d58..64bb1009e 100644 --- a/dep/src/sockets/TcpSocket.cpp +++ b/dep/src/sockets/TcpSocket.cpp @@ -39,6 +39,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include +#include #ifdef HAVE_OPENSSL #include #include diff --git a/src/shared/LockedQueue.h b/src/shared/LockedQueue.h index 5109b1716..4087ebff0 100644 --- a/src/shared/LockedQueue.h +++ b/src/shared/LockedQueue.h @@ -27,11 +27,9 @@ namespace ACE_Based { - template > class LockedQueue { - //! Serialize access to the Queue LockType _lock; @@ -54,14 +52,12 @@ namespace ACE_Based */ void add(const T& item) { + ACE_Guard g(this->_lock); - ACE_Guard g(_lock); - - ASSERT(!_canceled); + ASSERT(!this->_canceled); // throw Cancellation_Exception(); - _queue.push_back(item); - + this->_queue.push_back(item); } /** @@ -69,27 +65,25 @@ namespace ACE_Based */ T next() { + ACE_Guard g(this->_lock); - ACE_Guard g(_lock); - - ASSERT (!_queue.empty() || !_canceled); + ASSERT (!_queue.empty() || !this->_canceled); // throw Cancellation_Exception(); - T item = _queue.front(); - _queue.pop_front(); + T item = this->_queue.front(); + this->_queue.pop_front(); return item; - } T front() { - ACE_Guard g(_lock); + ACE_Guard g(this->_lock); - ASSERT (!_queue.empty()); + ASSERT (!this->_queue.empty()); // throw NoSuchElement_Exception(); - return _queue.front(); + return this->_queue.front(); } /** @@ -97,11 +91,9 @@ namespace ACE_Based */ void cancel() { + ACE_Guard g(this->_lock); - ACE_Guard g(_lock); - - _canceled = true; - + this->_canceled = true; } /** @@ -109,15 +101,13 @@ namespace ACE_Based */ bool isCanceled() { - // Faster check since the queue will not become un-canceled - if(_canceled) + if(this->_canceled) return true; - ACE_Guard g(_lock); - - return _canceled; + ACE_Guard g(this->_lock); + return this->_canceled; } /** @@ -125,20 +115,15 @@ namespace ACE_Based */ size_t size() { - - ACE_Guard g(_lock); - return _queue.size(); - + ACE_Guard g(this->_lock); + return this->_queue.size(); } bool empty() { - - ACE_Guard g(_lock); - return _queue.empty(); + ACE_Guard g(this->_lock); + return this->_queue.empty(); } - }; - } #endif diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index a2a499339..ce69da771 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8079" + #define REVISION_NR "8080" #endif // __REVISION_NR_H__ diff --git a/src/shared/vmap/CoordModelMapping.cpp b/src/shared/vmap/CoordModelMapping.cpp index 23b89fefd..4b4dc50c9 100644 --- a/src/shared/vmap/CoordModelMapping.cpp +++ b/src/shared/vmap/CoordModelMapping.cpp @@ -19,6 +19,7 @@ #include "CoordModelMapping.h" #include +#include using namespace G3D; @@ -42,6 +43,13 @@ namespace VMAP return(CMappingEntry::getKeyString(iMapId,xPos, yPos)); } + const std::string CMappingEntry::getKeyString( unsigned int pMapId, int pXPos, int pYPos ) + { + char b[100]; + sprintf(b,"%03u_%d_%d", pMapId, pXPos, pYPos); + return(std::string(b)); + } + //============================================================ //============================================================ //============================================================ diff --git a/src/shared/vmap/CoordModelMapping.h b/src/shared/vmap/CoordModelMapping.h index 71b516311..0200caaa7 100644 --- a/src/shared/vmap/CoordModelMapping.h +++ b/src/shared/vmap/CoordModelMapping.h @@ -72,12 +72,7 @@ namespace VMAP const std::string getKeyString() const; inline const G3D::Array& getFilenames() const { return(iFilenames); } - static const std::string getKeyString(unsigned int pMapId, int pXPos, int pYPos) - { - char b[100]; - sprintf(b,"%03u_%d_%d", pMapId, pXPos, pYPos); - return(std::string(b)); - } + static const std::string getKeyString(unsigned int pMapId, int pXPos, int pYPos); }; diff --git a/src/shared/vmap/DebugCmdLogger.cpp b/src/shared/vmap/DebugCmdLogger.cpp index 080afa3fb..036149977 100644 --- a/src/shared/vmap/DebugCmdLogger.cpp +++ b/src/shared/vmap/DebugCmdLogger.cpp @@ -17,6 +17,7 @@ */ #include "DebugCmdLogger.h" +#include using namespace G3D; From d23f80924cb475ec50dd85b10bed3609da473d75 Mon Sep 17 00:00:00 2001 From: Ambient Date: Sat, 27 Jun 2009 05:57:29 +0400 Subject: [PATCH 012/132] [8081] Remove player only targeting limitation for spell 25899, 20911 for triggering part. Signed-off-by: VladimirMangos --- src/game/Unit.cpp | 3 --- src/shared/revision_nr.h | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 697367c53..d2ac9c314 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -5552,9 +5552,6 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu case 25899: // Greater Blessing of Sanctuary case 20911: // Blessing of Sanctuary { - if (target->GetTypeId() != TYPEID_PLAYER) - return false; - target = this; switch (target->getPowerType()) { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index ce69da771..213a1074d 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8080" + #define REVISION_NR "8081" #endif // __REVISION_NR_H__ From 7eef6d26387dfa6f0429bb639656aa96ade8b9ed Mon Sep 17 00:00:00 2001 From: Lightguard Date: Sat, 27 Jun 2009 11:31:22 +0400 Subject: [PATCH 013/132] [8082] Update Diminishing Returns. Signed-off-by: VladimirMangos --- src/game/SharedDefines.h | 16 +++--- src/game/SpellEffects.cpp | 3 +- src/game/SpellMgr.cpp | 111 ++++++++++++++++++++++++-------------- src/game/SpellMgr.h | 1 + src/game/Unit.cpp | 6 +-- src/game/Unit.h | 2 +- src/shared/revision_nr.h | 2 +- 7 files changed, 86 insertions(+), 55 deletions(-) diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 66381f6ce..c748acf42 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -2325,24 +2325,20 @@ enum DiminishingGroup DIMINISHING_NONE, DIMINISHING_CONTROL_STUN, // Player Controlled stuns DIMINISHING_TRIGGER_STUN, // By aura proced stuns, usualy chance on hit talents - DIMINISHING_SLEEP, DIMINISHING_CONTROL_ROOT, // Immobilizing effects from casted spells DIMINISHING_TRIGGER_ROOT, // Immobilizing effects from triggered spells like Frostbite - DIMINISHING_FEAR, // Non-warlock fears + DIMINISHING_FEAR_BLIND, // Fears & blind DIMINISHING_CHARM, - // Mage Specific - DIMINISHING_POLYMORPH, - // Rogue Specific - DIMINISHING_KIDNEYSHOT, // Kidney Shot is not diminished with Cheap Shot + DIMINISHING_POLYMORPH_GOUGE_SAP, // Warlock Specific DIMINISHING_DEATHCOIL, // Death Coil Diminish only with another Death Coil - DIMINISHING_WARLOCK_FEAR, // Also with Sedduction + // Druid Specific + DIMINISHING_CYCLONE, // From 2.3.0 // Shared Class Specific - DIMINISHING_BLIND_CYCLONE, // From 2.3.0 + DIMINISHING_CHEAPSHOT_POUNCE, DIMINISHING_DISARM, // From 2.3.0 DIMINISHING_SILENCE, // From 2.3.0 - DIMINISHING_FREEZE, // Hunter's Freezing Trap - DIMINISHING_KNOCKOUT, // Also with Sap, all Knockout mechanics are here + DIMINISHING_FREEZE_SLEEP, // Hunter's Freezing Trap DIMINISHING_BANISH, // Other // Don't Diminish, but limit duration to 10s diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 957c20506..23020ca16 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -2280,7 +2280,8 @@ void Spell::EffectApplyAura(uint32 i) // Now Reduce spell duration using data received at spell hit int32 duration = Aur->GetAuraMaxDuration(); - unitTarget->ApplyDiminishingToDuration(m_diminishGroup, duration, m_caster, m_diminishLevel); + int32 limitduration = GetDiminishingReturnsLimitDuration(m_diminishGroup,m_spellInfo); + unitTarget->ApplyDiminishingToDuration(m_diminishGroup, duration, m_caster, m_diminishLevel,limitduration); Aur->setDiminishGroup(m_diminishGroup); // if Aura removed and deleted, do not continue. diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index d40864c9c..ec21bb044 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -2717,36 +2717,32 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto { case SPELLFAMILY_ROGUE: { - // Kidney Shot - if (spellproto->SpellFamilyFlags & UI64LIT(0x00000200000)) - return DIMINISHING_KIDNEYSHOT; // Blind - else if (spellproto->SpellFamilyFlags & UI64LIT(0x00001000000)) - return DIMINISHING_BLIND_CYCLONE; - break; - } - case SPELLFAMILY_HUNTER: - { - // Freezing trap - if (spellproto->SpellFamilyFlags & UI64LIT(0x00000000008)) - return DIMINISHING_FREEZE; + if (spellproto->SpellFamilyFlags & UI64LIT(0x00001000000)) + return DIMINISHING_FEAR_BLIND; + // Cheap Shot + else if (spellproto->SpellFamilyFlags & UI64LIT(0x00000000400)) + return DIMINISHING_CHEAPSHOT_POUNCE; break; } case SPELLFAMILY_WARLOCK: { - // Fear - if (spellproto->SpellFamilyFlags & UI64LIT(0x40840000000)) - return DIMINISHING_WARLOCK_FEAR; // Curses/etc - else if (spellproto->SpellFamilyFlags & UI64LIT(0x00080000000)) + if (spellproto->SpellFamilyFlags & UI64LIT(0x00080000000)) return DIMINISHING_LIMITONLY; + // Seduction + else if (spellproto->SpellFamilyFlags & UI64LIT(0x00040000000)) + return DIMINISHING_CHARM; break; } case SPELLFAMILY_DRUID: { // Cyclone if (spellproto->SpellFamilyFlags & UI64LIT(0x02000000000)) - return DIMINISHING_BLIND_CYCLONE; + return DIMINISHING_CYCLONE; + // Pounce + else if (spellproto->SpellFamilyFlags & UI64LIT(0x00000020000)) + return DIMINISHING_CHEAPSHOT_POUNCE; break; } case SPELLFAMILY_WARRIOR: @@ -2756,6 +2752,20 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto return DIMINISHING_LIMITONLY; break; } + case SPELLFAMILY_PALADIN: + { + // Turn Evil + if (spellproto->SpellFamilyFlags & UI64LIT(0x00804000000000)) + return DIMINISHING_FEAR_BLIND; + break; + } + case SPELLFAMILY_DEATHKNIGHT: + { + // Hungering Cold (no flags) + if (spellproto->SpellIconID == 2797) + return DIMINISHING_POLYMORPH_GOUGE_SAP; + break; + } default: break; } @@ -2764,15 +2774,15 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto uint32 mechanic = GetAllSpellMechanicMask(spellproto); if (mechanic == MECHANIC_NONE) return DIMINISHING_NONE; if (mechanic & (1<SpellFamilyName) + { + case SPELLFAMILY_HUNTER: + { + // Wyvern Sting + if (spellproto->SpellFamilyFlags & UI64LIT(0x0000100000000000)) + return 6000; + break; + } + case SPELLFAMILY_PALADIN: + { + // Repentance - limit to 6 seconds in PvP + if (spellproto->SpellFamilyFlags & UI64LIT(0x00000000004)) + return 6000; + break; + } + default: + break; + } + + return 10000; +} + bool IsDiminishingReturnsGroupDurationLimited(DiminishingGroup group) { switch(group) { case DIMINISHING_CONTROL_STUN: case DIMINISHING_TRIGGER_STUN: - case DIMINISHING_KIDNEYSHOT: - case DIMINISHING_SLEEP: case DIMINISHING_CONTROL_ROOT: case DIMINISHING_TRIGGER_ROOT: - case DIMINISHING_FEAR: - case DIMINISHING_WARLOCK_FEAR: + case DIMINISHING_FEAR_BLIND: case DIMINISHING_CHARM: - case DIMINISHING_POLYMORPH: - case DIMINISHING_FREEZE: - case DIMINISHING_KNOCKOUT: - case DIMINISHING_BLIND_CYCLONE: + case DIMINISHING_POLYMORPH_GOUGE_SAP: + case DIMINISHING_CHEAPSHOT_POUNCE: + case DIMINISHING_FREEZE_SLEEP: + case DIMINISHING_CYCLONE: case DIMINISHING_BANISH: case DIMINISHING_LIMITONLY: return true; @@ -2810,24 +2846,21 @@ DiminishingReturnsType GetDiminishingReturnsGroupType(DiminishingGroup group) { switch(group) { - case DIMINISHING_BLIND_CYCLONE: - case DIMINISHING_CONTROL_STUN: + case DIMINISHING_CYCLONE: case DIMINISHING_TRIGGER_STUN: - case DIMINISHING_KIDNEYSHOT: + case DIMINISHING_CONTROL_STUN: + case DIMINISHING_CHEAPSHOT_POUNCE: return DRTYPE_ALL; - case DIMINISHING_SLEEP: case DIMINISHING_CONTROL_ROOT: case DIMINISHING_TRIGGER_ROOT: - case DIMINISHING_FEAR: + case DIMINISHING_FEAR_BLIND: case DIMINISHING_CHARM: - case DIMINISHING_POLYMORPH: + case DIMINISHING_POLYMORPH_GOUGE_SAP: case DIMINISHING_SILENCE: case DIMINISHING_DISARM: case DIMINISHING_DEATHCOIL: - case DIMINISHING_FREEZE: + case DIMINISHING_FREEZE_SLEEP: case DIMINISHING_BANISH: - case DIMINISHING_WARLOCK_FEAR: - case DIMINISHING_KNOCKOUT: return DRTYPE_PLAYER; default: break; diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 69ccc5485..71c8535ef 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -333,6 +333,7 @@ inline uint32 GetDispellMask(DispelType dispel) DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto, bool triggered); bool IsDiminishingReturnsGroupDurationLimited(DiminishingGroup group); DiminishingReturnsType GetDiminishingReturnsGroupType(DiminishingGroup group); +int32 GetDiminishingReturnsLimitDuration(DiminishingGroup group, SpellEntry const* spellproto); // Spell affects related declarations (accessed using SpellMgr functions) struct SpellAffectEntry diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index d2ac9c314..5ddca82d2 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -9847,13 +9847,13 @@ void Unit::IncrDiminishing(DiminishingGroup group) m_Diminishing.push_back(DiminishingReturn(group,getMSTime(),DIMINISHING_LEVEL_2)); } -void Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,Unit* caster,DiminishingLevels Level) +void Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,Unit* caster,DiminishingLevels Level, int32 limitduration) { if(duration == -1 || group == DIMINISHING_NONE || caster->IsFriendlyTo(this) ) return; // Duration of crowd control abilities on pvp target is limited by 10 sec. (2.2.0) - if(duration > 10000 && IsDiminishingReturnsGroupDurationLimited(group)) + if(limitduration > 0 && duration > limitduration) { // test pet/charm masters instead pets/charmeds Unit const* targetOwner = GetCharmerOrOwner(); @@ -9863,7 +9863,7 @@ void Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,Un Unit const* source = casterOwner ? casterOwner : caster; if(target->GetTypeId() == TYPEID_PLAYER && source->GetTypeId() == TYPEID_PLAYER) - duration = 10000; + duration = limitduration; } float mod = 1.0f; diff --git a/src/game/Unit.h b/src/game/Unit.h index 4b4b27d34..b2b4704ae 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -856,7 +856,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject DiminishingLevels GetDiminishing(DiminishingGroup group); void IncrDiminishing(DiminishingGroup group); - void ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,Unit* caster, DiminishingLevels Level); + void ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,Unit* caster, DiminishingLevels Level, int32 limitduration); void ApplyDiminishingAura(DiminishingGroup group, bool apply); void ClearDiminishings() { m_Diminishing.clear(); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 213a1074d..62a8a35f7 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8081" + #define REVISION_NR "8082" #endif // __REVISION_NR_H__ From 34d5620a91a06abe1944487559311167faf18b42 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 27 Jun 2009 23:57:51 +0400 Subject: [PATCH 014/132] [8083] New debug command: .debug setaurastate for test target/caster aura states. Also fix wrong (!args) checks in debug commands. --- src/game/Chat.cpp | 1 + src/game/Chat.h | 3 +- src/game/debugcmds.cpp | 92 ++++++++++++++++++++++++++-------------- src/shared/revision_nr.h | 2 +- 4 files changed, 65 insertions(+), 33 deletions(-) diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 34447760c..af7c914a9 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -154,6 +154,7 @@ ChatCommand * ChatHandler::getCommandTable() { "Mod32Value", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugMod32Value, "", NULL }, { "play", SEC_MODERATOR, false, NULL, "", debugPlayCommandTable }, { "send", SEC_ADMINISTRATOR, false, NULL, "", debugSendCommandTable }, + { "setaurastate", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSetAuraStateCommand, "", NULL }, { "setitemflag", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSetItemFlagCommand, "", NULL }, { "setvalue", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSetValue, "", NULL }, { "spawnvehicle", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSpawnVehicle, "", NULL }, diff --git a/src/game/Chat.h b/src/game/Chat.h index 18ef9ccf2..cd235d4ee 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -132,8 +132,9 @@ class ChatHandler bool HandleDebugGetLootRecipient(const char * args); bool HandleDebugGetValue(const char* args); bool HandleDebugMod32Value(const char* args); - bool HandleDebugSetValue(const char* args); + bool HandleDebugSetAuraStateCommand(const char * args); bool HandleDebugSetItemFlagCommand(const char * args); + bool HandleDebugSetValue(const char* args); bool HandleDebugSpawnVehicle(const char * args); bool HandleDebugUpdate(const char* args); bool HandleDebugUpdateWorldStateCommand(const char* args); diff --git a/src/game/debugcmds.cpp b/src/game/debugcmds.cpp index a3b4627b6..feaa83651 100644 --- a/src/game/debugcmds.cpp +++ b/src/game/debugcmds.cpp @@ -33,7 +33,7 @@ bool ChatHandler::HandleDebugSendSpellFailCommand(const char* args) { - if(!args) + if (!*args) return false; char* px = strtok((char*)args, " "); @@ -41,7 +41,7 @@ bool ChatHandler::HandleDebugSendSpellFailCommand(const char* args) return false; uint8 failnum = (uint8)atoi(px); - if(failnum==0 && *px!='0') + if (failnum==0 && *px!='0') return false; char* p1 = strtok(NULL, " "); @@ -66,20 +66,20 @@ bool ChatHandler::HandleDebugSendSpellFailCommand(const char* args) bool ChatHandler::HandleDebugSendPoiCommand(const char* args) { + if (!*args) + return false; + Player *pPlayer = m_session->GetPlayer(); Unit* target = getSelectedUnit(); - if(!target) + if (!target) { SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); return true; } - if(!args) - return false; - char* icon_text = strtok((char*)args, " "); char* flags_text = strtok(NULL, " "); - if(!icon_text || !flags_text) + if (!icon_text || !flags_text) return false; uint32 icon = atol(icon_text); @@ -92,7 +92,7 @@ bool ChatHandler::HandleDebugSendPoiCommand(const char* args) bool ChatHandler::HandleDebugSendEquipErrorCommand(const char* args) { - if(!args) + if (!*args) return false; uint8 msg = atoi(args); @@ -102,7 +102,7 @@ bool ChatHandler::HandleDebugSendEquipErrorCommand(const char* args) bool ChatHandler::HandleDebugSendSellErrorCommand(const char* args) { - if(!args) + if (!*args) return false; uint8 msg = atoi(args); @@ -112,7 +112,7 @@ bool ChatHandler::HandleDebugSendSellErrorCommand(const char* args) bool ChatHandler::HandleDebugSendBuyErrorCommand(const char* args) { - if(!args) + if (!*args) return false; uint8 msg = atoi(args); @@ -127,7 +127,7 @@ bool ChatHandler::HandleDebugSendOpcodeCommand(const char* /*args*/) unit = m_session->GetPlayer(); std::ifstream ifs("opcode.txt"); - if(ifs.bad()) + if (ifs.bad()) return false; uint32 opcode; @@ -215,7 +215,7 @@ bool ChatHandler::HandleDebugPlayCinematicCommand(const char* args) { // USAGE: .debug play cinematic #cinematicid // #cinematicid - ID decimal number from CinemaicSequences.dbc (1st column) - if( !*args ) + if (!*args) { SendSysMessage(LANG_BAD_VALUE); SetSentErrorMessage(true); @@ -224,7 +224,7 @@ bool ChatHandler::HandleDebugPlayCinematicCommand(const char* args) uint32 dwId = atoi((char*)args); - if(!sCinematicSequencesStore.LookupEntry(dwId)) + if (!sCinematicSequencesStore.LookupEntry(dwId)) { PSendSysMessage(LANG_CINEMATIC_NOT_EXIST, dwId); SetSentErrorMessage(true); @@ -239,7 +239,7 @@ bool ChatHandler::HandleDebugPlayMovieCommand(const char* args) { // USAGE: .debug play movie #movieid // #movieid - ID decimal number from Movie.dbc (1st column) - if( !*args ) + if (!*args) { SendSysMessage(LANG_BAD_VALUE); SetSentErrorMessage(true); @@ -248,7 +248,7 @@ bool ChatHandler::HandleDebugPlayMovieCommand(const char* args) uint32 dwId = atoi((char*)args); - if(!sMovieStore.LookupEntry(dwId)) + if (!sMovieStore.LookupEntry(dwId)) { PSendSysMessage(LANG_MOVIE_NOT_EXIST, dwId); SetSentErrorMessage(true); @@ -264,7 +264,7 @@ bool ChatHandler::HandleDebugPlaySoundCommand(const char* args) { // USAGE: .debug playsound #soundid // #soundid - ID decimal number from SoundEntries.dbc (1st column) - if( !*args ) + if (!*args) { SendSysMessage(LANG_BAD_VALUE); SetSentErrorMessage(true); @@ -273,7 +273,7 @@ bool ChatHandler::HandleDebugPlaySoundCommand(const char* args) uint32 dwSoundId = atoi((char*)args); - if(!sSoundEntriesStore.LookupEntry(dwSoundId)) + if (!sSoundEntriesStore.LookupEntry(dwSoundId)) { PSendSysMessage(LANG_SOUND_NOT_EXIST, dwSoundId); SetSentErrorMessage(true); @@ -281,14 +281,14 @@ bool ChatHandler::HandleDebugPlaySoundCommand(const char* args) } Unit* unit = getSelectedUnit(); - if(!unit) + if (!unit) { SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); SetSentErrorMessage(true); return false; } - if(m_session->GetPlayer()->GetSelection()) + if (m_session->GetPlayer()->GetSelection()) unit->PlayDistanceSound(dwSoundId,m_session->GetPlayer()); else unit->PlayDirectSound(dwSoundId,m_session->GetPlayer()); @@ -300,7 +300,7 @@ bool ChatHandler::HandleDebugPlaySoundCommand(const char* args) //Send notification in channel bool ChatHandler::HandleDebugSendChannelNotifyCommand(const char* args) { - if(!args) + if (!*args) return false; const char *name = "test"; @@ -318,7 +318,7 @@ bool ChatHandler::HandleDebugSendChannelNotifyCommand(const char* args) //Send notification in chat bool ChatHandler::HandleDebugSendChatMsgCommand(const char* args) { - if(!args) + if (!*args) return false; const char *msg = "testtest"; @@ -339,7 +339,7 @@ bool ChatHandler::HandleDebugSendQuestPartyMsgCommand(const char* args) bool ChatHandler::HandleDebugGetLootRecipient(const char* /*args*/) { Creature* target = getSelectedCreature(); - if(!target) + if (!target) return false; PSendSysMessage("loot recipient: %s", target->hasLootRecipient()?(target->GetLootRecipient()?target->GetLootRecipient()->GetName():"offline"):"no loot recipient"); @@ -355,7 +355,7 @@ bool ChatHandler::HandleDebugSendQuestInvalidMsgCommand(const char* args) bool ChatHandler::HandleDebugGetItemState(const char* args) { - if (!args) + if (!*args) return false; std::string state_str = args; @@ -601,7 +601,7 @@ bool ChatHandler::HandleDebugArenaCommand(const char * /*args*/) bool ChatHandler::HandleDebugSpawnVehicle(const char* args) { - if(!args) + if (!*args) return false; char* e = strtok((char*)args, " "); @@ -615,17 +615,17 @@ bool ChatHandler::HandleDebugSpawnVehicle(const char* args) CreatureInfo const *ci = objmgr.GetCreatureTemplate(entry); - if(!ci) + if (!ci) return false; VehicleEntry const *ve = sVehicleStore.LookupEntry(id); - if(!ve) + if (!ve) return false; Vehicle *v = new Vehicle; Map *map = m_session->GetPlayer()->GetMap(); - if(!v->Create(objmgr.GenerateLowGuid(HIGHGUID_VEHICLE), map, entry, id, m_session->GetPlayer()->GetTeam())) + if (!v->Create(objmgr.GenerateLowGuid(HIGHGUID_VEHICLE), map, entry, id, m_session->GetPlayer()->GetTeam())) { delete v; return false; @@ -636,7 +636,7 @@ bool ChatHandler::HandleDebugSpawnVehicle(const char* args) v->Relocate(px, py, pz, m_session->GetPlayer()->GetOrientation()); - if(!v->IsPositionValid()) + if (!v->IsPositionValid()) { sLog.outError("Vehicle (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)", v->GetGUIDLow(), v->GetEntry(), v->GetPositionX(), v->GetPositionY()); @@ -661,7 +661,7 @@ bool ChatHandler::HandleDebugSendLargePacketCommand(const char* /*args*/) bool ChatHandler::HandleDebugSendSetPhaseShiftCommand(const char* args) { - if(!args) + if (!*args) return false; uint32 PhaseShift = atoi(args); @@ -671,7 +671,7 @@ bool ChatHandler::HandleDebugSendSetPhaseShiftCommand(const char* args) bool ChatHandler::HandleDebugSetItemFlagCommand(const char* args) { - if(!args) + if (!*args) return false; char* e = strtok((char*)args, " "); @@ -685,7 +685,7 @@ bool ChatHandler::HandleDebugSetItemFlagCommand(const char* args) Item *i = m_session->GetPlayer()->GetItemByGuid(MAKE_NEW_GUID(guid, 0, HIGHGUID_ITEM)); - if(!i) + if (!i) return false; i->SetUInt32Value(ITEM_FIELD_FLAGS, flag); @@ -703,3 +703,33 @@ bool ChatHandler::HandleDebugAnimCommand(const char* args) m_session->GetPlayer()->HandleEmoteCommand(anim_id); return true; } + +bool ChatHandler::HandleDebugSetAuraStateCommand(const char* args) +{ + if (!*args) + { + SendSysMessage(LANG_BAD_VALUE); + SetSentErrorMessage(true); + return false; + } + + Unit* unit = getSelectedUnit(); + if (!unit) + { + SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + SetSentErrorMessage(true); + return false; + } + + int32 state = atoi((char*)args); + if (!state) + { + // reset all states + for(int i = 1; i <= 32; ++i) + unit->ModifyAuraState(AuraState(i),false); + return true; + } + + unit->ModifyAuraState(AuraState(abs(state)),state > 0); + return true; +} diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 62a8a35f7..6a6b80c99 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8082" + #define REVISION_NR "8083" #endif // __REVISION_NR_H__ From a656bc36fa8a16e27da0593d75baf7c50b0b81c0 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 28 Jun 2009 02:09:35 +0400 Subject: [PATCH 015/132] [8084] Correctly show spell icon disabled state at relogin for spells with cooldown delayed until expire. --- src/game/Player.cpp | 27 +++++++++++++++------------ src/game/Player.h | 2 ++ src/shared/revision_nr.h | 2 +- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index a8181b509..e689cd828 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -2537,7 +2537,7 @@ void Player::InitStatsForLevel(bool reapplyMods) void Player::SendInitialSpells() { time_t curTime = time(NULL); - time_t infTime = curTime + MONTH/2; + time_t infTime = curTime + infinityCooldownDelayCheck; uint16 spellCount = 0; @@ -2571,18 +2571,21 @@ void Player::SendInitialSpells() if(!sEntry) continue; - // not send infinity cooldown - if(itr->second.end > infTime) - continue; - data << uint32(itr->first); - time_t cooldown = 0; - if(itr->second.end > curTime) - cooldown = (itr->second.end-curTime)*IN_MILISECONDS; - data << uint16(itr->second.itemid); // cast item id data << uint16(sEntry->Category); // spell category + + // send infinity cooldown in special format + if(itr->second.end >= infTime) + { + data << uint32(1); // cooldown + data << uint32(0x80000000); // category cooldown + continue; + } + + time_t cooldown = itr->second.end > curTime ? (itr->second.end-curTime)*IN_MILISECONDS : 0; + if(sEntry->Category) // may be wrong, but anyway better than nothing... { data << uint32(0); // cooldown @@ -3349,7 +3352,7 @@ void Player::_SaveSpellCooldowns() CharacterDatabase.PExecute("DELETE FROM character_spell_cooldown WHERE guid = '%u'", GetGUIDLow()); time_t curTime = time(NULL); - time_t infTime = curTime + MONTH/2; + time_t infTime = curTime + infinityCooldownDelayCheck; // remove outdated and save active for(SpellCooldowns::iterator itr = m_spellCooldowns.begin();itr != m_spellCooldowns.end();) @@ -17396,8 +17399,8 @@ void Player::AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 it { // use +MONTH as infinity mark for spell cooldown (will checked as MONTH/2 at save ans skipped) // but not allow ignore until reset or re-login - catrecTime = catrec > 0 ? curTime+MONTH : 0; - recTime = rec > 0 ? curTime+MONTH : catrecTime; + catrecTime = catrec > 0 ? curTime+infinityCooldownDelay : 0; + recTime = rec > 0 ? curTime+infinityCooldownDelay : catrecTime; } else { diff --git a/src/game/Player.h b/src/game/Player.h index 53a30efef..4a27c934c 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1462,6 +1462,8 @@ class MANGOS_DLL_SPEC Player : public Unit template T ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell const* spell = NULL); void RemoveSpellMods(Spell const* spell); + static uint32 const infinityCooldownDelay = MONTH; // used for set "infinity cooldowns" for spells and check + static uint32 const infinityCooldownDelayCheck = MONTH/2; bool HasSpellCooldown(uint32 spell_id) const { SpellCooldowns::const_iterator itr = m_spellCooldowns.find(spell_id); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 6a6b80c99..a6b012d69 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8083" + #define REVISION_NR "8084" #endif // __REVISION_NR_H__ From d7a4665aaf98e3c657324503728ef1d76e63868c Mon Sep 17 00:00:00 2001 From: duckman Date: Sun, 28 Jun 2009 04:02:19 +0400 Subject: [PATCH 016/132] [8085] Apply talent rate to all talents points. Signed-off-by: VladimirMangos --- src/game/Player.cpp | 10 ++++------ src/shared/revision_nr.h | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index e689cd828..d6cc2521b 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -19464,19 +19464,17 @@ void Player::AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore cons uint32 Player::CalculateTalentsPoints() const { - uint32 base_talent = getLevel() < 10 ? 0 : uint32((getLevel()-9)*sWorld.getRate(RATE_TALENT)); + uint32 base_talent = getLevel() < 10 ? 0 : getLevel()-9; if(getClass() != CLASS_DEATH_KNIGHT) - return base_talent; + return uint32(base_talent * sWorld.getRate(RATE_TALENT)); - uint32 talentPointsForLevel = - (getLevel() < 56 ? 0 : uint32((getLevel()-55)*sWorld.getRate(RATE_TALENT))) - + m_questRewardTalentCount; + uint32 talentPointsForLevel = getLevel() < 56 ? 0 : getLevel() - 55 + m_questRewardTalentCount; if(talentPointsForLevel > base_talent) talentPointsForLevel = base_talent; - return talentPointsForLevel; + return uint32(talentPointsForLevel * sWorld.getRate(RATE_TALENT)); } bool Player::IsAllowUseFlyMountsHere() const diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index a6b012d69..583662128 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8084" + #define REVISION_NR "8085" #endif // __REVISION_NR_H__ From b7f699d89b1ce1d19977b842e5cd917169cf0805 Mon Sep 17 00:00:00 2001 From: Maxxie Date: Sun, 28 Jun 2009 11:14:40 +0400 Subject: [PATCH 017/132] [8086] Restore work spell 11196. Signed-off-by: VladimirMangos --- src/game/SpellAuras.cpp | 4 ++++ src/game/SpellMgr.cpp | 1 + src/shared/revision_nr.h | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 7ccc4eb5a..de02c0983 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -2183,6 +2183,10 @@ void Aura::HandleAuraDummy(bool apply, bool Real) { switch(GetId()) { + // Recently Bandaged + case 11196: + m_target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, GetMiscValue(), apply); + return; // Unstable Power case 24658: { diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index ec21bb044..2f188734a 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -331,6 +331,7 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex) case 38637: // Nether Exhaustion (red) case 38638: // Nether Exhaustion (green) case 38639: // Nether Exhaustion (blue) + case 11196: // Recently Bandaged return false; // some spells have unclear target modes for selection, so just make effect positive case 27184: diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 583662128..103f5d605 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8085" + #define REVISION_NR "8086" #endif // __REVISION_NR_H__ From f23242106905bbe21e0049af1b69591f11f83659 Mon Sep 17 00:00:00 2001 From: ApoC Date: Sun, 28 Jun 2009 21:00:49 +0200 Subject: [PATCH 018/132] Allow NPCs to apply taunt. Signed-off-by: ApoC --- src/game/SpellAuras.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index de02c0983..18150bfe3 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -3861,7 +3861,7 @@ void Aura::HandleModTaunt(bool apply, bool Real) Unit* caster = GetCaster(); - if(!caster || !caster->isAlive() || caster->GetTypeId() != TYPEID_PLAYER) + if(!caster || !caster->isAlive()) return; if(apply) From 55a383cbd042908b30864d807386b10f5b22e9f4 Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Mon, 29 Jun 2009 02:18:21 +0400 Subject: [PATCH 019/132] [8087] Cleanup code. Signed-off-by: VladimirMangos --- src/game/QuestHandler.cpp | 90 +++++++++++++++++++-------------------- src/shared/revision_nr.h | 2 +- 2 files changed, 44 insertions(+), 48 deletions(-) diff --git a/src/game/QuestHandler.cpp b/src/game/QuestHandler.cpp index b9baa025a..5d2300676 100644 --- a/src/game/QuestHandler.cpp +++ b/src/game/QuestHandler.cpp @@ -429,60 +429,56 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket) { CHECK_PACKET_SIZE(recvPacket,4); - uint32 quest; - recvPacket >> quest; + uint32 questId; + recvPacket >> questId; - sLog.outDebug( "WORLD: Received CMSG_PUSHQUESTTOPARTY quest = %u", quest ); + sLog.outDebug("WORLD: Received CMSG_PUSHQUESTTOPARTY quest = %u", questId); - Quest const *pQuest = objmgr.GetQuestTemplate(quest); - if( pQuest ) + if (Quest const *pQuest = objmgr.GetQuestTemplate(questId)) { - if( _player->GetGroup() ) + if (Group* pGroup = _player->GetGroup()) { - Group *pGroup = _player->GetGroup(); - if( pGroup ) + for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { - for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + Player *pPlayer = itr->getSource(); + + if (!pPlayer || pPlayer == _player) // skip self + continue; + + _player->SendPushToPartyResponse(pPlayer, QUEST_PARTY_MSG_SHARING_QUEST); + + if (!pPlayer->SatisfyQuestStatus(pQuest, false)) { - Player *pPlayer = itr->getSource(); - if (!pPlayer || pPlayer == _player) // skip self - continue; - - _player->SendPushToPartyResponse(pPlayer, QUEST_PARTY_MSG_SHARING_QUEST); - - if( !pPlayer->SatisfyQuestStatus( pQuest, false ) ) - { - _player->SendPushToPartyResponse( pPlayer, QUEST_PARTY_MSG_HAVE_QUEST ); - continue; - } - - if( pPlayer->GetQuestStatus( quest ) == QUEST_STATUS_COMPLETE ) - { - _player->SendPushToPartyResponse( pPlayer, QUEST_PARTY_MSG_FINISH_QUEST ); - continue; - } - - if( !pPlayer->CanTakeQuest( pQuest, false ) ) - { - _player->SendPushToPartyResponse( pPlayer, QUEST_PARTY_MSG_CANT_TAKE_QUEST ); - continue; - } - - if( !pPlayer->SatisfyQuestLog( false ) ) - { - _player->SendPushToPartyResponse( pPlayer, QUEST_PARTY_MSG_LOG_FULL ); - continue; - } - - if( pPlayer->GetDivider() != 0 ) - { - _player->SendPushToPartyResponse( pPlayer, QUEST_PARTY_MSG_BUSY ); - continue; - } - - pPlayer->PlayerTalkClass->SendQuestGiverQuestDetails( pQuest, _player->GetGUID(), true ); - pPlayer->SetDivider( _player->GetGUID() ); + _player->SendPushToPartyResponse(pPlayer, QUEST_PARTY_MSG_HAVE_QUEST); + continue; } + + if (pPlayer->GetQuestStatus(questId) == QUEST_STATUS_COMPLETE) + { + _player->SendPushToPartyResponse(pPlayer, QUEST_PARTY_MSG_FINISH_QUEST); + continue; + } + + if (!pPlayer->CanTakeQuest(pQuest, false)) + { + _player->SendPushToPartyResponse(pPlayer, QUEST_PARTY_MSG_CANT_TAKE_QUEST); + continue; + } + + if (!pPlayer->SatisfyQuestLog(false)) + { + _player->SendPushToPartyResponse(pPlayer, QUEST_PARTY_MSG_LOG_FULL); + continue; + } + + if (pPlayer->GetDivider() != 0) + { + _player->SendPushToPartyResponse(pPlayer, QUEST_PARTY_MSG_BUSY); + continue; + } + + pPlayer->PlayerTalkClass->SendQuestGiverQuestDetails(pQuest, _player->GetGUID(), true); + pPlayer->SetDivider(_player->GetGUID()); } } } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 103f5d605..8b1147a8f 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8086" + #define REVISION_NR "8087" #endif // __REVISION_NR_H__ From ed8a3a39cc473c2ef4c38ac2da7dd61b4df8d0a0 Mon Sep 17 00:00:00 2001 From: ApoC Date: Mon, 29 Jun 2009 01:10:26 +0200 Subject: [PATCH 020/132] [8088] Fixed min_range checking for spell casts. Skip in check values 0.0f from DBC, this spells do not have min range limitation. This should fix some inappropriate target too close messages. Signed-off-by: ApoC --- src/game/Spell.cpp | 4 ++-- src/shared/revision_nr.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 51553cabb..44fe64ac2 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -4678,7 +4678,7 @@ SpellCastResult Spell::CheckRange(bool strict) if(dist > max_range) return SPELL_FAILED_OUT_OF_RANGE; //0x5A; - if(dist < min_range) + if(min_range && dist < min_range) return SPELL_FAILED_TOO_CLOSE; if( m_caster->GetTypeId() == TYPEID_PLAYER && (m_spellInfo->FacingCasterFlags & SPELL_FACING_FLAG_INFRONT) && !m_caster->HasInArc( M_PI, target ) ) @@ -4689,7 +4689,7 @@ SpellCastResult Spell::CheckRange(bool strict) { if(!m_caster->IsWithinDist3d(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, max_range)) return SPELL_FAILED_OUT_OF_RANGE; - if(m_caster->IsWithinDist3d(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, min_range)) + if(min_range && m_caster->IsWithinDist3d(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, min_range)) return SPELL_FAILED_TOO_CLOSE; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 8b1147a8f..20c4fa01a 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8087" + #define REVISION_NR "8088" #endif // __REVISION_NR_H__ From cceb334533fbd049810e6ec8ba33715d6a8fa810 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 29 Jun 2009 10:54:21 +0400 Subject: [PATCH 021/132] [8089] Implement SPELL_EFFECT_CHARGE2(149), more correct monster flags use in charge effects. Last fix let for example correct charge for flight creatures... --- src/game/SpellEffects.cpp | 40 +++++++++++++++++++++++++++++++++------ src/shared/revision_nr.h | 2 +- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 23020ca16..14d6f5a06 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -206,7 +206,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]= &Spell::EffectActivateRune, //146 SPELL_EFFECT_ACTIVATE_RUNE &Spell::EffectQuestFail, //147 SPELL_EFFECT_QUEST_FAIL quest fail &Spell::EffectUnused, //148 SPELL_EFFECT_148 unused - &Spell::EffectNULL, //149 SPELL_EFFECT_149 swoop + &Spell::EffectCharge2, //149 SPELL_EFFECT_CHARGE2 swoop &Spell::EffectUnused, //150 SPELL_EFFECT_150 unused &Spell::EffectTriggerRitualOfSummoning, //151 SPELL_EFFECT_TRIGGER_SPELL_2 &Spell::EffectNULL, //152 SPELL_EFFECT_152 summon Refer-a-Friend @@ -5904,22 +5904,50 @@ void Spell::EffectSkinning(uint32 /*i*/) void Spell::EffectCharge(uint32 /*i*/) { - if(!unitTarget || !m_caster) + if (!unitTarget) return; float x, y, z; unitTarget->GetContactPoint(m_caster, x, y, z); - if(unitTarget->GetTypeId() != TYPEID_PLAYER) + if (unitTarget->GetTypeId() != TYPEID_PLAYER) ((Creature *)unitTarget)->StopMoving(); // Only send MOVEMENTFLAG_WALK_MODE, client has strange issues with other move flags - m_caster->SendMonsterMove(x, y, z, 0, MONSTER_MOVE_WALK, 1); + m_caster->SendMonsterMove(x, y, z, 0, m_caster->GetTypeId()==TYPEID_PLAYER ? MONSTER_MOVE_WALK : ((Creature*)m_caster)->GetMonsterMoveFlags(), 1); - if(m_caster->GetTypeId() != TYPEID_PLAYER) + if (m_caster->GetTypeId() != TYPEID_PLAYER) m_caster->GetMap()->CreatureRelocation((Creature*)m_caster,x,y,z,m_caster->GetOrientation()); // not all charge effects used in negative spells - if ( !IsPositiveSpell(m_spellInfo->Id)) + if (unitTarget != m_caster && !IsPositiveSpell(m_spellInfo->Id)) + m_caster->Attack(unitTarget,true); +} + +void Spell::EffectCharge2(uint32 /*i*/) +{ + float x, y, z; + if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) + { + x = m_targets.m_destX; + y = m_targets.m_destY; + z = m_targets.m_destZ; + + if (unitTarget->GetTypeId() != TYPEID_PLAYER) + ((Creature *)unitTarget)->StopMoving(); + } + else if (unitTarget && unitTarget != m_caster) + unitTarget->GetContactPoint(m_caster, x, y, z); + else + return; + + // Only send MOVEMENTFLAG_WALK_MODE, client has strange issues with other move flags + m_caster->SendMonsterMove(x, y, z, 0, m_caster->GetTypeId()==TYPEID_PLAYER ? MONSTER_MOVE_WALK : ((Creature*)m_caster)->GetMonsterMoveFlags(), 1); + + if (m_caster->GetTypeId() != TYPEID_PLAYER) + m_caster->GetMap()->CreatureRelocation((Creature*)m_caster,x,y,z,m_caster->GetOrientation()); + + // not all charge effects used in negative spells + if (unitTarget && unitTarget != m_caster && !IsPositiveSpell(m_spellInfo->Id)) m_caster->Attack(unitTarget,true); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 20c4fa01a..175ffdc62 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8088" + #define REVISION_NR "8089" #endif // __REVISION_NR_H__ From fad9c4c0b33bf5bb84941c35d22549022083099f Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 29 Jun 2009 12:05:46 +0400 Subject: [PATCH 022/132] [8090] Fixed build problems. --- src/game/Spell.h | 1 + src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/game/Spell.h b/src/game/Spell.h index ad4084833..01c25060d 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -288,6 +288,7 @@ class Spell void EffectSelfResurrect(uint32 i); void EffectSkinning(uint32 i); void EffectCharge(uint32 i); + void EffectCharge2(uint32 i); void EffectProspecting(uint32 i); void EffectMilling(uint32 i); void EffectRenamePet(uint32 i); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 175ffdc62..a2605425c 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8089" + #define REVISION_NR "8090" #endif // __REVISION_NR_H__ From 5a8640a69b82979cc1a858005361c008fce36ec0 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 29 Jun 2009 12:47:40 +0400 Subject: [PATCH 023/132] [8091] Check bag size at item protos loading and item slots at invetory loading. This is single not safe places in work with bag slots in current code. --- src/game/ObjectMgr.cpp | 6 ++++++ src/game/Player.cpp | 2 +- src/shared/revision_nr.h | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 691430a4d..cc43fb362 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -1735,6 +1735,12 @@ void ObjectMgr::LoadItemPrototypes() const_cast(proto)->Stackable = 1000; } + if(proto->ContainerSlots > MAX_BAG_SIZE) + { + sLog.outErrorDb("Item (Entry: %u) has too large value in ContainerSlots (%u), replace by hardcoded limit (%u).",i,proto->ContainerSlots,MAX_BAG_SIZE); + const_cast(proto)->ContainerSlots = MAX_BAG_SIZE; + } + if(proto->StatsCount > MAX_ITEM_PROTO_STATS) { sLog.outErrorDb("Item (Entry: %u) has too large value in statscount (%u), replace by hardcoded limit (%u).",i,proto->StatsCount,MAX_ITEM_PROTO_STATS); diff --git a/src/game/Player.cpp b/src/game/Player.cpp index d6cc2521b..02fb26102 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -14756,7 +14756,7 @@ void Player::_LoadInventory(QueryResult *result, uint32 timediff) item->SetSlot(NULL_SLOT); // the item is in a bag, find the bag std::map::const_iterator itr = bagMap.find(bag_guid); - if(itr != bagMap.end()) + if(itr != bagMap.end() && slot < itr->second->GetBagSize()) itr->second->StoreItem(slot, item, true ); else success = false; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index a2605425c..e3f2e604c 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8090" + #define REVISION_NR "8091" #endif // __REVISION_NR_H__ From 8e05eb53d37735c3aff2c5a55a94bf4713f4c9c9 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 29 Jun 2009 13:19:42 +0400 Subject: [PATCH 024/132] [8092] No, one more not safe place found. Patch inspired bug report connected with alt.patch written by Machiavelli. --- src/game/Player.cpp | 297 ++++++++++++++++++++------------------- src/shared/revision_nr.h | 2 +- 2 files changed, 151 insertions(+), 148 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 02fb26102..42e34194e 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -8703,39 +8703,42 @@ uint8 Player::_CanStoreItem_InSpecificSlot( uint8 bag, uint8 slot, ItemPosCountV Item* pItem2 = GetItemByPos( bag, slot ); // ignore move item (this slot will be empty at move) - if(pItem2==pSrcItem) + if (pItem2==pSrcItem) pItem2 = NULL; uint32 need_space; // empty specific slot - check item fit to slot - if( !pItem2 || swap ) + if (!pItem2 || swap) { - if( bag == INVENTORY_SLOT_BAG_0 ) + if (bag == INVENTORY_SLOT_BAG_0) { // keyring case - if(slot >= KEYRING_SLOT_START && slot < KEYRING_SLOT_START+GetMaxKeyringSize() && !(pProto->BagFamily & BAG_FAMILY_MASK_KEYS)) + if (slot >= KEYRING_SLOT_START && slot < KEYRING_SLOT_START+GetMaxKeyringSize() && !(pProto->BagFamily & BAG_FAMILY_MASK_KEYS)) return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; // currencytoken case - if(slot >= CURRENCYTOKEN_SLOT_START && slot < CURRENCYTOKEN_SLOT_END && !(pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS)) + if (slot >= CURRENCYTOKEN_SLOT_START && slot < CURRENCYTOKEN_SLOT_END && !(pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS)) return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; // prevent cheating - if(slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END || slot >= PLAYER_SLOT_END) + if (slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END || slot >= PLAYER_SLOT_END) return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; } else { Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, bag ); - if( !pBag ) + if (!pBag) return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; ItemPrototype const* pBagProto = pBag->GetProto(); - if( !pBagProto ) + if (!pBagProto) return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; - if( !ItemCanGoIntoBag(pProto,pBagProto) ) + if (slot >= pBagProto->ContainerSlots) + return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; + + if (!ItemCanGoIntoBag(pProto,pBagProto)) return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; } @@ -8746,22 +8749,22 @@ uint8 Player::_CanStoreItem_InSpecificSlot( uint8 bag, uint8 slot, ItemPosCountV else { // check item type - if(pItem2->GetEntry() != pProto->ItemId) + if (pItem2->GetEntry() != pProto->ItemId) return EQUIP_ERR_ITEM_CANT_STACK; // check free space - if(pItem2->GetCount() >= pProto->GetMaxStackSize()) + if (pItem2->GetCount() >= pProto->GetMaxStackSize()) return EQUIP_ERR_ITEM_CANT_STACK; // free stack space or infinity need_space = pProto->GetMaxStackSize() - pItem2->GetCount(); } - if(need_space > count) + if (need_space > count) need_space = count; ItemPosCount newPosition = ItemPosCount((bag << 8) | slot, need_space); - if(!newPosition.isContainedIn(dest)) + if (!newPosition.isContainedIn(dest)) { dest.push_back(newPosition); count -= need_space; @@ -8772,55 +8775,55 @@ uint8 Player::_CanStoreItem_InSpecificSlot( uint8 bag, uint8 slot, ItemPosCountV uint8 Player::_CanStoreItem_InBag( uint8 bag, ItemPosCountVec &dest, ItemPrototype const *pProto, uint32& count, bool merge, bool non_specialized, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot ) const { // skip specific bag already processed in first called _CanStoreItem_InBag - if(bag==skip_bag) + if (bag==skip_bag) return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, bag ); - if( !pBag ) + if (!pBag) return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; ItemPrototype const* pBagProto = pBag->GetProto(); - if( !pBagProto ) + if (!pBagProto) return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; // specialized bag mode or non-specilized - if( non_specialized != (pBagProto->Class == ITEM_CLASS_CONTAINER && pBagProto->SubClass == ITEM_SUBCLASS_CONTAINER) ) + if (non_specialized != (pBagProto->Class == ITEM_CLASS_CONTAINER && pBagProto->SubClass == ITEM_SUBCLASS_CONTAINER)) return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; - if( !ItemCanGoIntoBag(pProto,pBagProto) ) + if (!ItemCanGoIntoBag(pProto,pBagProto)) return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; for(uint32 j = 0; j < pBag->GetBagSize(); ++j) { // skip specific slot already processed in first called _CanStoreItem_InSpecificSlot - if(j==skip_slot) + if (j==skip_slot) continue; Item* pItem2 = GetItemByPos( bag, j ); // ignore move item (this slot will be empty at move) - if(pItem2==pSrcItem) + if (pItem2==pSrcItem) pItem2 = NULL; // if merge skip empty, if !merge skip non-empty - if((pItem2!=NULL)!=merge) + if ((pItem2!=NULL)!=merge) continue; - if( pItem2 ) + if (pItem2) { - if(pItem2->GetEntry() == pProto->ItemId && pItem2->GetCount() < pProto->GetMaxStackSize()) + if (pItem2->GetEntry() == pProto->ItemId && pItem2->GetCount() < pProto->GetMaxStackSize()) { uint32 need_space = pProto->GetMaxStackSize() - pItem2->GetCount(); if(need_space > count) need_space = count; ItemPosCount newPosition = ItemPosCount((bag << 8) | j, need_space); - if(!newPosition.isContainedIn(dest)) + if (!newPosition.isContainedIn(dest)) { dest.push_back(newPosition); count -= need_space; - if(count==0) + if (count==0) return EQUIP_ERR_OK; } } @@ -8828,16 +8831,16 @@ uint8 Player::_CanStoreItem_InBag( uint8 bag, ItemPosCountVec &dest, ItemPrototy else { uint32 need_space = pProto->GetMaxStackSize(); - if(need_space > count) + if (need_space > count) need_space = count; ItemPosCount newPosition = ItemPosCount((bag << 8) | j, need_space); - if(!newPosition.isContainedIn(dest)) + if (!newPosition.isContainedIn(dest)) { dest.push_back(newPosition); count -= need_space; - if(count==0) + if (count==0) return EQUIP_ERR_OK; } } @@ -8850,33 +8853,33 @@ uint8 Player::_CanStoreItem_InInventorySlots( uint8 slot_begin, uint8 slot_end, for(uint32 j = slot_begin; j < slot_end; ++j) { // skip specific slot already processed in first called _CanStoreItem_InSpecificSlot - if(INVENTORY_SLOT_BAG_0==skip_bag && j==skip_slot) + if (INVENTORY_SLOT_BAG_0==skip_bag && j==skip_slot) continue; Item* pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, j ); // ignore move item (this slot will be empty at move) - if(pItem2==pSrcItem) + if (pItem2==pSrcItem) pItem2 = NULL; // if merge skip empty, if !merge skip non-empty - if((pItem2!=NULL)!=merge) + if ((pItem2!=NULL)!=merge) continue; - if( pItem2 ) + if (pItem2) { - if(pItem2->GetEntry() == pProto->ItemId && pItem2->GetCount() < pProto->GetMaxStackSize()) + if (pItem2->GetEntry() == pProto->ItemId && pItem2->GetCount() < pProto->GetMaxStackSize()) { uint32 need_space = pProto->GetMaxStackSize() - pItem2->GetCount(); - if(need_space > count) + if (need_space > count) need_space = count; ItemPosCount newPosition = ItemPosCount((INVENTORY_SLOT_BAG_0 << 8) | j, need_space); - if(!newPosition.isContainedIn(dest)) + if (!newPosition.isContainedIn(dest)) { dest.push_back(newPosition); count -= need_space; - if(count==0) + if (count==0) return EQUIP_ERR_OK; } } @@ -8884,16 +8887,16 @@ uint8 Player::_CanStoreItem_InInventorySlots( uint8 slot_begin, uint8 slot_end, else { uint32 need_space = pProto->GetMaxStackSize(); - if(need_space > count) + if (need_space > count) need_space = count; ItemPosCount newPosition = ItemPosCount((INVENTORY_SLOT_BAG_0 << 8) | j, need_space); - if(!newPosition.isContainedIn(dest)) + if (!newPosition.isContainedIn(dest)) { dest.push_back(newPosition); count -= need_space; - if(count==0) + if (count==0) return EQUIP_ERR_OK; } } @@ -8906,16 +8909,16 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 sLog.outDebug( "STORAGE: CanStoreItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, entry, count); ItemPrototype const *pProto = objmgr.GetItemPrototype(entry); - if( !pProto ) + if (!pProto) { - if(no_space_count) + if (no_space_count) *no_space_count = count; return swap ? EQUIP_ERR_ITEMS_CANT_BE_SWAPPED :EQUIP_ERR_ITEM_NOT_FOUND; } - if(pItem && pItem->IsBindedNotWith(this)) + if (pItem && pItem->IsBindedNotWith(this)) { - if(no_space_count) + if (no_space_count) *no_space_count = count; return EQUIP_ERR_DONT_OWN_THAT_ITEM; } @@ -8923,11 +8926,11 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 // check count of items (skip for auto move for same player from bank) uint32 no_similar_count = 0; // can't store this amount similar items uint8 res = _CanTakeMoreSimilarItems(entry,count,pItem,&no_similar_count); - if(res!=EQUIP_ERR_OK) + if (res!=EQUIP_ERR_OK) { - if(count==no_similar_count) + if (count==no_similar_count) { - if(no_space_count) + if (no_space_count) *no_space_count = no_similar_count; return res; } @@ -8935,22 +8938,22 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 } // in specific slot - if( bag != NULL_BAG && slot != NULL_SLOT ) + if (bag != NULL_BAG && slot != NULL_SLOT) { res = _CanStoreItem_InSpecificSlot(bag,slot,dest,pProto,count,swap,pItem); - if(res!=EQUIP_ERR_OK) + if (res!=EQUIP_ERR_OK) { - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return res; } - if(count==0) + if (count==0) { - if(no_similar_count==0) + if (no_similar_count==0) return EQUIP_ERR_OK; - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS; } @@ -8959,45 +8962,45 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 // not specific slot or have space for partly store only in specific slot // in specific bag - if( bag != NULL_BAG ) + if (bag != NULL_BAG) { // search stack in bag for merge to - if( pProto->Stackable != 1 ) + if (pProto->Stackable != 1) { - if( bag == INVENTORY_SLOT_BAG_0 ) // inventory + if (bag == INVENTORY_SLOT_BAG_0) // inventory { res = _CanStoreItem_InInventorySlots(KEYRING_SLOT_START,CURRENCYTOKEN_SLOT_END,dest,pProto,count,true,pItem,bag,slot); - if(res!=EQUIP_ERR_OK) + if (res!=EQUIP_ERR_OK) { - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return res; } - if(count==0) + if (count==0) { - if(no_similar_count==0) + if (no_similar_count==0) return EQUIP_ERR_OK; - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS; } res = _CanStoreItem_InInventorySlots(INVENTORY_SLOT_ITEM_START,INVENTORY_SLOT_ITEM_END,dest,pProto,count,true,pItem,bag,slot); - if(res!=EQUIP_ERR_OK) + if (res!=EQUIP_ERR_OK) { - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return res; } - if(count==0) + if (count==0) { - if(no_similar_count==0) + if (no_similar_count==0) return EQUIP_ERR_OK; - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS; } @@ -9006,22 +9009,22 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 { // we need check 2 time (specialized/non_specialized), use NULL_BAG to prevent skipping bag res = _CanStoreItem_InBag(bag,dest,pProto,count,true,false,pItem,NULL_BAG,slot); - if(res!=EQUIP_ERR_OK) + if (res!=EQUIP_ERR_OK) res = _CanStoreItem_InBag(bag,dest,pProto,count,true,true,pItem,NULL_BAG,slot); - if(res!=EQUIP_ERR_OK) + if (res!=EQUIP_ERR_OK) { - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return res; } - if(count==0) + if (count==0) { - if(no_similar_count==0) + if (no_similar_count==0) return EQUIP_ERR_OK; - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS; } @@ -9029,83 +9032,83 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 } // search free slot in bag for place to - if( bag == INVENTORY_SLOT_BAG_0 ) // inventory + if(bag == INVENTORY_SLOT_BAG_0) // inventory { // search free slot - keyring case - if(pProto->BagFamily & BAG_FAMILY_MASK_KEYS) + if (pProto->BagFamily & BAG_FAMILY_MASK_KEYS) { uint32 keyringSize = GetMaxKeyringSize(); res = _CanStoreItem_InInventorySlots(KEYRING_SLOT_START,KEYRING_SLOT_START+keyringSize,dest,pProto,count,false,pItem,bag,slot); - if(res!=EQUIP_ERR_OK) + if (res!=EQUIP_ERR_OK) { - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return res; } - if(count==0) + if (count==0) { - if(no_similar_count==0) + if (no_similar_count==0) return EQUIP_ERR_OK; - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS; } res = _CanStoreItem_InInventorySlots(CURRENCYTOKEN_SLOT_START,CURRENCYTOKEN_SLOT_END,dest,pProto,count,false,pItem,bag,slot); - if(res!=EQUIP_ERR_OK) + if (res!=EQUIP_ERR_OK) { - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return res; } - if(count==0) + if (count==0) { - if(no_similar_count==0) + if (no_similar_count==0) return EQUIP_ERR_OK; - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS; } } - else if(pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS) + else if (pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS) { res = _CanStoreItem_InInventorySlots(CURRENCYTOKEN_SLOT_START,CURRENCYTOKEN_SLOT_END,dest,pProto,count,false,pItem,bag,slot); - if(res!=EQUIP_ERR_OK) + if (res!=EQUIP_ERR_OK) { - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return res; } - if(count==0) + if (count==0) { - if(no_similar_count==0) + if (no_similar_count==0) return EQUIP_ERR_OK; - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS; } } res = _CanStoreItem_InInventorySlots(INVENTORY_SLOT_ITEM_START,INVENTORY_SLOT_ITEM_END,dest,pProto,count,false,pItem,bag,slot); - if(res!=EQUIP_ERR_OK) + if (res!=EQUIP_ERR_OK) { - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return res; } - if(count==0) + if (count==0) { - if(no_similar_count==0) + if (no_similar_count==0) return EQUIP_ERR_OK; - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS; } @@ -9113,22 +9116,22 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 else // equipped bag { res = _CanStoreItem_InBag(bag,dest,pProto,count,false,false,pItem,NULL_BAG,slot); - if(res!=EQUIP_ERR_OK) + if (res!=EQUIP_ERR_OK) res = _CanStoreItem_InBag(bag,dest,pProto,count,false,true,pItem,NULL_BAG,slot); - if(res!=EQUIP_ERR_OK) + if (res!=EQUIP_ERR_OK) { - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return res; } - if(count==0) + if (count==0) { - if(no_similar_count==0) + if (no_similar_count==0) return EQUIP_ERR_OK; - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS; } @@ -9138,58 +9141,58 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 // not specific bag or have space for partly store only in specific bag // search stack for merge to - if( pProto->Stackable != 1 ) + if (pProto->Stackable != 1) { res = _CanStoreItem_InInventorySlots(KEYRING_SLOT_START,CURRENCYTOKEN_SLOT_END,dest,pProto,count,true,pItem,bag,slot); - if(res!=EQUIP_ERR_OK) + if (res!=EQUIP_ERR_OK) { - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return res; } - if(count==0) + if (count==0) { - if(no_similar_count==0) + if (no_similar_count==0) return EQUIP_ERR_OK; - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS; } res = _CanStoreItem_InInventorySlots(INVENTORY_SLOT_ITEM_START,INVENTORY_SLOT_ITEM_END,dest,pProto,count,true,pItem,bag,slot); - if(res!=EQUIP_ERR_OK) + if (res!=EQUIP_ERR_OK) { - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return res; } - if(count==0) + if (count==0) { - if(no_similar_count==0) + if (no_similar_count==0) return EQUIP_ERR_OK; - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS; } - if( pProto->BagFamily ) + if (pProto->BagFamily) { for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) { res = _CanStoreItem_InBag(i,dest,pProto,count,true,false,pItem,bag,slot); - if(res!=EQUIP_ERR_OK) + if (res!=EQUIP_ERR_OK) continue; - if(count==0) + if (count==0) { - if(no_similar_count==0) + if (no_similar_count==0) return EQUIP_ERR_OK; - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS; } @@ -9199,15 +9202,15 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) { res = _CanStoreItem_InBag(i,dest,pProto,count,true,true,pItem,bag,slot); - if(res!=EQUIP_ERR_OK) + if (res!=EQUIP_ERR_OK) continue; - if(count==0) + if (count==0) { - if(no_similar_count==0) + if (no_similar_count==0) return EQUIP_ERR_OK; - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS; } @@ -9215,45 +9218,45 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 } // search free slot - special bag case - if( pProto->BagFamily ) + if (pProto->BagFamily) { - if(pProto->BagFamily & BAG_FAMILY_MASK_KEYS) + if (pProto->BagFamily & BAG_FAMILY_MASK_KEYS) { uint32 keyringSize = GetMaxKeyringSize(); res = _CanStoreItem_InInventorySlots(KEYRING_SLOT_START,KEYRING_SLOT_START+keyringSize,dest,pProto,count,false,pItem,bag,slot); - if(res!=EQUIP_ERR_OK) + if (res!=EQUIP_ERR_OK) { - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return res; } - if(count==0) + if (count==0) { - if(no_similar_count==0) + if (no_similar_count==0) return EQUIP_ERR_OK; - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS; } } - else if(pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS) + else if (pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS) { res = _CanStoreItem_InInventorySlots(CURRENCYTOKEN_SLOT_START,CURRENCYTOKEN_SLOT_END,dest,pProto,count,false,pItem,bag,slot); - if(res!=EQUIP_ERR_OK) + if (res!=EQUIP_ERR_OK) { - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return res; } - if(count==0) + if (count==0) { - if(no_similar_count==0) + if (no_similar_count==0) return EQUIP_ERR_OK; - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS; } @@ -9262,15 +9265,15 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) { res = _CanStoreItem_InBag(i,dest,pProto,count,false,false,pItem,bag,slot); - if(res!=EQUIP_ERR_OK) + if (res!=EQUIP_ERR_OK) continue; - if(count==0) + if (count==0) { - if(no_similar_count==0) + if (no_similar_count==0) return EQUIP_ERR_OK; - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS; } @@ -9279,19 +9282,19 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 // search free slot res = _CanStoreItem_InInventorySlots(INVENTORY_SLOT_ITEM_START,INVENTORY_SLOT_ITEM_END,dest,pProto,count,false,pItem,bag,slot); - if(res!=EQUIP_ERR_OK) + if (res!=EQUIP_ERR_OK) { - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return res; } - if(count==0) + if (count==0) { - if(no_similar_count==0) + if (no_similar_count==0) return EQUIP_ERR_OK; - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS; } @@ -9299,21 +9302,21 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) { res = _CanStoreItem_InBag(i,dest,pProto,count,false,true,pItem,bag,slot); - if(res!=EQUIP_ERR_OK) + if (res!=EQUIP_ERR_OK) continue; - if(count==0) + if (count==0) { - if(no_similar_count==0) + if (no_similar_count==0) return EQUIP_ERR_OK; - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS; } } - if(no_space_count) + if (no_space_count) *no_space_count = count + no_similar_count; return EQUIP_ERR_INVENTORY_FULL; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index e3f2e604c..55fd6b24a 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8091" + #define REVISION_NR "8092" #endif // __REVISION_NR_H__ From d09b4b96bef696c9b8514c654b5a111b4342ba05 Mon Sep 17 00:00:00 2001 From: ApoC Date: Fri, 22 May 2009 19:31:55 +0200 Subject: [PATCH 025/132] [8093] Fixed effect of spell 25771. Signed-off-by: ApoC --- src/game/SpellAuras.cpp | 6 ++++++ src/shared/revision_nr.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 18150bfe3..eef4b9311 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -3966,6 +3966,12 @@ void Aura::HandleModMechanicImmunity(bool apply, bool /*Real*/) uint32 misc = m_modifier.m_miscvalue; Unit* target = m_target; + // Forbearance + // in DBC wrong mechanic immune since 3.0.x + if (GetId() == 25771) + misc = MECHANIC_IMMUNE_SHIELD; + + if(apply && spellInfo->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY) { uint32 mechanic = 1 << m_modifier.m_miscvalue; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 55fd6b24a..bc81ad8d7 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8092" + #define REVISION_NR "8093" #endif // __REVISION_NR_H__ From 3cdc1f279286f16f4937aa143b5b15598e5b58ef Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 29 Jun 2009 14:48:42 +0400 Subject: [PATCH 026/132] [8094] Overwrite max durability for item at item loading from prototype. --- src/game/Item.cpp | 10 ++++++++++ src/shared/revision_nr.h | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/game/Item.cpp b/src/game/Item.cpp index 52ed24bdb..0ac47c673 100644 --- a/src/game/Item.cpp +++ b/src/game/Item.cpp @@ -377,6 +377,16 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult *result) if(!proto) return false; + // update max durability (and durability) if need + if(proto->MaxDurability!= GetUInt32Value(ITEM_FIELD_MAXDURABILITY)) + { + SetUInt32Value(ITEM_FIELD_MAXDURABILITY,proto->MaxDurability); + if(GetUInt32Value(ITEM_FIELD_DURABILITY) > proto->MaxDurability) + SetUInt32Value(ITEM_FIELD_DURABILITY,proto->MaxDurability); + + need_save = true; + } + // recalculate suffix factor if(GetItemRandomPropertyId() < 0) { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index bc81ad8d7..2e4c90e44 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8093" + #define REVISION_NR "8094" #endif // __REVISION_NR_H__ From 81d0e303d2d796418612e02cbcd09c5868fcda3e Mon Sep 17 00:00:00 2001 From: freghar Date: Mon, 29 Jun 2009 13:59:07 +0200 Subject: [PATCH 027/132] [8095] Added gitignore for src/bindings/ Signed-off-by: freghar --- src/bindings/.gitignore | 14 ++++++++++++++ src/shared/revision_nr.h | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 src/bindings/.gitignore diff --git a/src/bindings/.gitignore b/src/bindings/.gitignore new file mode 100644 index 000000000..eeddf0dd7 --- /dev/null +++ b/src/bindings/.gitignore @@ -0,0 +1,14 @@ +# +# NOTE! Don't add files that are generated in specific +# subdirectories here. Add them in the ".gitignore" file +# in that subdirectory instead. +# +# NOTE! Please use 'git-ls-files -i --exclude-standard' +# command after changing this file, to see if there are +# any tracked files which get ignored after the change. +# + +# +# Scripting projects +# +#universal diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 2e4c90e44..6ee17294e 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8094" + #define REVISION_NR "8095" #endif // __REVISION_NR_H__ From 2d33a8d2208e751801fa6470f5b178a56359343b Mon Sep 17 00:00:00 2001 From: ApoC Date: Mon, 29 Jun 2009 19:37:32 +0200 Subject: [PATCH 028/132] [8096] Fixed dummy effect for 34665 * Removed dynamic cast * Little effect code clean up Signed-off-by: ApoC --- src/game/SpellEffects.cpp | 35 ++++++++++++++--------------------- src/shared/revision_nr.h | 2 +- 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 14d6f5a06..5d39fab2b 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -1042,32 +1042,25 @@ void Spell::EffectDummy(uint32 i) { if(!unitTarget || m_caster->GetTypeId() != TYPEID_PLAYER ) return; - - if(!unitTarget) + // Spell has scriptable target but for sure. + if (unitTarget->GetTypeId() != TYPEID_UNIT) return; - TemporarySummon* tempSummon = dynamic_cast(unitTarget); - if(!tempSummon) - return; + uint32 health = unitTarget->GetHealth(); + float x, y, z, o; - uint32 health = tempSummon->GetHealth(); + unitTarget->GetPosition(x, y, z); + o = unitTarget->GetOrientation(); + ((Creature*)unitTarget)->ForcedDespawn(); - float x = tempSummon->GetPositionX(); - float y = tempSummon->GetPositionY(); - float z = tempSummon->GetPositionZ(); - float o = tempSummon->GetOrientation(); - tempSummon->UnSummon(); - - Creature* pCreature = m_caster->SummonCreature(16992, x, y, z, o,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,180000); - if (!pCreature) - return; - - pCreature->SetHealth(health); - ((Player*)m_caster)->RewardPlayerAndGroupAtEvent(16992, pCreature); - - if (pCreature->AI()) - pCreature->AI()->AttackStart(m_caster); + if (Creature* summon = m_caster->SummonCreature(16992, x, y, z, o,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,180000)) + { + summon->SetHealth(health); + ((Player*)m_caster)->RewardPlayerAndGroupAtEvent(16992, summon); + if (summon->AI()) + summon->AI()->AttackStart(m_caster); + } return; } case 44997: // Converting Sentry diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 6ee17294e..93c4b523a 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8095" + #define REVISION_NR "8096" #endif // __REVISION_NR_H__ From f1284882a9a95956206860725df5d3d58d42fe40 Mon Sep 17 00:00:00 2001 From: ApoC Date: Mon, 29 Jun 2009 20:23:47 +0200 Subject: [PATCH 029/132] [8097] Updated comment based on research. Signed-off-by: ApoC --- src/game/DBCStructure.h | 4 +++- src/shared/revision_nr.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index 5f9434e3b..540bd37b0 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -487,7 +487,9 @@ struct AchievementCriteriaEntry //uint32 name_flags; // 25 uint32 completionFlag; // 26 uint32 groupFlag; // 27 - //uint32 unk1; // 28 + //uint32 unk1; // 28 Alway appears with timed events + // for timed spells it is spell id for + // timed kills it is creature id uint32 timeLimit; // 29 time limit in seconds //uint32 showOrder; // 30 show order }; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 93c4b523a..10f38a9ad 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8096" + #define REVISION_NR "8097" #endif // __REVISION_NR_H__ From c9fbd99579114955082d09c6b6eb7ad176924aeb Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Tue, 30 Jun 2009 07:37:36 +0400 Subject: [PATCH 030/132] [8098] Support uint32 spell ids in code. * Propertly work with uint32 spell ids in player action bar * Fix in same time bug with not save equipment set button with id==0 * Merge misc field in character_action and playercreateinfo_action to action field as 3 byte * Propertly load uint32 spell ids from character_spell * Fixed types for some pet/creature related structure for spell id storing. --- sql/characters.sql | 5 +- sql/mangos.sql | 713 +++++++++--------- .../8098_01_characters_character_action.sql | 10 + ...8098_02_mangos_playercreateinfo_action.sql | 10 + .../8098_03_characters_character_pet.sql | 13 + sql/updates/8098_04_characters_pet_spell.sql | 4 + sql/updates/Makefile.am | 8 + src/game/CharacterHandler.cpp | 2 +- src/game/Creature.h | 6 +- src/game/MiscHandler.cpp | 53 +- src/game/ObjectMgr.cpp | 9 +- src/game/Pet.cpp | 21 +- src/game/Pet.h | 2 +- src/game/PetHandler.cpp | 48 +- src/game/Player.cpp | 123 ++- src/game/Player.h | 53 +- src/game/SpellMgr.cpp | 6 +- src/game/SpellMgr.h | 16 +- src/game/Unit.cpp | 50 +- src/game/Unit.h | 49 +- src/shared/revision_nr.h | 2 +- 21 files changed, 638 insertions(+), 565 deletions(-) create mode 100644 sql/updates/8098_01_characters_character_action.sql create mode 100644 sql/updates/8098_02_mangos_playercreateinfo_action.sql create mode 100644 sql/updates/8098_03_characters_character_pet.sql create mode 100644 sql/updates/8098_04_characters_pet_spell.sql diff --git a/sql/characters.sql b/sql/characters.sql index ea5eb8ff9..8fb7327f2 100644 --- a/sql/characters.sql +++ b/sql/characters.sql @@ -21,7 +21,7 @@ DROP TABLE IF EXISTS `character_db_version`; CREATE TABLE `character_db_version` ( - `required_8072_02_characters_characters` bit(1) default NULL + `required_8098_04_characters_pet_spell` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB'; -- @@ -305,9 +305,8 @@ DROP TABLE IF EXISTS `character_action`; CREATE TABLE `character_action` ( `guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier', `button` tinyint(3) unsigned NOT NULL default '0', - `action` smallint(5) unsigned NOT NULL default '0', + `action` int(11) unsigned NOT NULL default '0', `type` tinyint(3) unsigned NOT NULL default '0', - `misc` tinyint(3) unsigned NOT NULL default '0', PRIMARY KEY (`guid`,`button`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System'; diff --git a/sql/mangos.sql b/sql/mangos.sql index c2f727eca..6ea0523d6 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -23,7 +23,7 @@ DROP TABLE IF EXISTS `db_version`; CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, - `required_8071_01_mangos_command` bit(1) default NULL + `required_8098_02_mangos_playercreateinfo_action` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -9721,9 +9721,8 @@ CREATE TABLE `playercreateinfo_action` ( `race` tinyint(3) unsigned NOT NULL default '0', `class` tinyint(3) unsigned NOT NULL default '0', `button` smallint(5) unsigned NOT NULL default '0', - `action` smallint(5) unsigned NOT NULL default '0', + `action` int(11) unsigned NOT NULL default '0', `type` smallint(5) unsigned NOT NULL default '0', - `misc` smallint(5) unsigned NOT NULL default '0', KEY `playercreateinfo_race_class_index` (`race`,`class`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; @@ -9734,360 +9733,360 @@ CREATE TABLE `playercreateinfo_action` ( LOCK TABLES `playercreateinfo_action` WRITE; /*!40000 ALTER TABLE `playercreateinfo_action` DISABLE KEYS */; INSERT INTO `playercreateinfo_action` VALUES -(1,1,1,78,0,0), -(1,1,0,6603,0,0), -(1,1,11,117,128,0), -(1,2,2,635,0,0), -(1,2,0,6603,0,0), -(1,2,1,21084,0,0), -(1,2,10,159,128,0), -(1,2,11,2070,128,0), -(1,4,1,1752,0,0), -(1,4,2,2098,0,0), -(1,4,3,2764,0,0), -(1,4,0,6603,0,0), -(1,4,11,2070,128,0), -(1,5,1,585,0,0), -(1,5,2,2050,0,0), -(1,5,0,6603,0,0), -(1,5,10,159,128,0), -(1,5,11,2070,128,0), -(1,6,0,6603,0,0), -(1,6,1,49576,0,0), -(1,6,2,45477,0,0), -(1,6,3,45462,0,0), -(1,6,4,45902,0,0), -(1,6,5,47541,0,0), -(1,6,11,59752,0,0), -(1,8,1,133,0,0), -(1,8,2,168,0,0), -(1,8,0,6603,0,0), -(1,8,10,159,128,0), -(1,8,11,2070,128,0), -(1,9,1,686,0,0), -(1,9,2,687,0,0), -(1,9,0,6603,0,0), -(1,9,10,159,128,0), -(1,9,11,4604,128,0), -(2,1,1,78,0,0), -(2,1,0,6603,0,0), -(2,1,11,117,128,0), -(2,3,2,75,0,0), -(2,3,1,2973,0,0), -(2,3,0,6603,0,0), -(2,3,11,117,128,0), -(2,3,10,159,128,0), -(2,4,10,0,128,0), -(2,4,1,1752,0,0), -(2,4,2,2098,0,0), -(2,4,0,6603,0,0), -(2,4,11,117,128,0), -(2,6,0,6603,0,0), -(2,6,1,49576,0,0), -(2,6,2,45477,0,0), -(2,6,3,45462,0,0), -(2,6,4,45902,0,0), -(2,6,5,47541,0,0), -(2,6,10,20572,0,0), -(2,7,2,331,0,0), -(2,7,1,403,0,0), -(2,7,0,6603,0,0), -(2,7,11,117,128,0), -(2,7,10,159,128,0), -(2,9,1,686,0,0), -(2,9,2,687,0,0), -(2,9,0,6603,0,0), -(2,9,11,117,128,0), -(2,9,10,159,128,0), -(3,1,1,78,0,0), -(3,1,0,6603,0,0), -(3,1,11,117,128,0), -(3,2,2,635,0,0), -(3,2,0,6603,0,0), -(3,2,1,21084,0,0), -(3,2,10,159,128,0), -(3,2,11,4540,128,0), -(3,3,2,75,0,0), -(3,3,1,2973,0,0), -(3,3,0,6603,0,0), -(3,3,11,117,128,0), -(3,3,10,159,128,0), -(3,4,1,1752,0,0), -(3,4,2,2098,0,0), -(3,4,3,2764,0,0), -(3,4,0,6603,0,0), -(3,4,11,4540,128,0), -(3,5,1,585,0,0), -(3,5,2,2050,0,0), -(3,5,0,6603,0,0), -(3,5,10,159,128,0), -(3,5,11,4540,128,0), -(3,6,0,6603,0,0), -(3,6,1,49576,0,0), -(3,6,2,45477,0,0), -(3,6,3,45462,0,0), -(3,6,4,45902,0,0), -(3,6,5,47541,0,0), -(3,6,10,2481,0,0), -(4,1,1,78,0,0), -(4,1,0,6603,0,0), -(4,1,11,117,128,0), -(4,3,2,75,0,0), -(4,3,1,2973,0,0), -(4,3,0,6603,0,0), -(4,3,11,117,128,0), -(4,3,10,159,128,0), -(4,4,1,1752,0,0), -(4,4,2,2098,0,0), -(4,4,3,2764,0,0), -(4,4,0,6603,0,0), -(4,4,11,4540,128,0), -(4,5,1,585,0,0), -(4,5,2,2050,0,0), -(4,5,0,6603,0,0), -(4,5,10,159,128,0), -(4,5,11,2070,128,0), -(4,6,0,6603,0,0), -(4,6,1,49576,0,0), -(4,6,2,45477,0,0), -(4,6,3,45462,0,0), -(4,6,4,45902,0,0), -(4,6,5,47541,0,0), -(4,6,10,58984,0,0), -(4,6,83,58984,0,0), -(4,11,1,5176,0,0), -(4,11,2,5185,0,0), -(4,11,0,6603,0,0), -(4,11,10,159,128,0), -(4,11,11,4536,128,0), -(5,1,11,4604,128,0), -(5,1,0,6603,0,0), -(5,1,1,78,0,0), -(5,4,11,4604,128,0), -(5,4,3,2764,0,0), -(5,4,2,2098,0,0), -(5,4,1,1752,0,0), -(5,4,0,6603,0,0), -(5,5,10,159,128,0), -(5,5,2,2050,0,0), -(5,5,1,585,0,0), -(5,5,11,4604,128,0), -(5,5,0,6603,0,0), -(5,6,0,6603,0,0), -(5,6,1,49576,0,0), -(5,6,2,45477,0,0), -(5,6,3,45462,0,0), -(5,6,4,45902,0,0), -(5,6,5,47541,0,0), -(5,6,10,20577,0,0), -(5,8,11,4604,128,0), -(5,8,10,159,128,0), -(5,8,2,168,0,0), -(5,8,1,133,0,0), -(5,8,0,6603,0,0), -(5,9,1,686,0,0), -(5,9,10,159,128,0), -(5,9,2,687,0,0), -(5,9,11,4604,128,0), -(5,9,0,6603,0,0), -(6,1,1,78,0,0), -(6,1,2,20549,0,0), -(6,1,11,4540,128,0), -(6,1,0,6603,0,0), -(6,3,1,2973,0,0), -(6,3,10,159,128,0), -(6,3,2,75,0,0), -(6,3,3,20549,0,0), -(6,3,11,117,128,0), -(6,3,0,6603,0,0), -(6,6,0,6603,0,0), -(6,6,1,49576,0,0), -(6,6,2,45477,0,0), -(6,6,3,45462,0,0), -(6,6,4,45902,0,0), -(6,6,5,47541,0,0), -(6,6,10,20549,0,0), -(6,6,75,20549,0,0), -(6,7,1,403,0,0), -(6,7,10,159,128,0), -(6,7,2,331,0,0), -(6,7,3,20549,0,0), -(6,7,11,4604,128,0), -(6,7,0,6603,0,0), -(6,11,1,5176,0,0), -(6,11,10,159,128,0), -(6,11,2,5185,0,0), -(6,11,3,20549,0,0), -(6,11,11,4536,128,0), -(6,11,0,6603,0,0), -(7,1,11,117,128,0), -(7,1,1,78,0,0), -(7,1,0,6603,0,0), -(7,4,11,117,128,0), -(7,4,3,2764,0,0), -(7,4,1,1752,0,0), -(7,4,2,2098,0,0), -(7,4,0,6603,0,0), -(7,6,0,6603,0,0), -(7,6,1,49576,0,0), -(7,6,2,45477,0,0), -(7,6,3,45462,0,0), -(7,6,4,45902,0,0), -(7,6,5,47541,0,0), -(7,6,10,20589,0,0), -(7,6,72,6603,0,0), -(7,6,83,117,128,0), -(7,6,84,6603,0,0), -(7,6,96,6603,0,0), -(7,6,108,6603,0,0), -(7,8,11,4536,128,0), -(7,8,1,133,0,0), -(7,8,2,168,0,0), -(7,8,10,159,128,0), -(7,8,0,6603,0,0), -(7,9,11,4604,128,0), -(7,9,1,686,0,0), -(7,9,2,687,0,0), -(7,9,10,159,128,0), -(7,9,0,6603,0,0), -(8,1,11,117,128,0), -(8,1,1,78,0,0), -(8,1,3,2764,0,0), -(8,1,0,6603,0,0), -(8,3,10,159,128,0), -(8,3,11,4604,128,0), -(8,3,1,2973,0,0), -(8,3,2,75,0,0), -(8,3,0,6603,0,0), -(8,4,1,1752,0,0), -(8,4,3,2764,0,0), -(8,4,2,2098,0,0), -(8,4,11,117,128,0), -(8,4,0,6603,0,0), -(8,5,1,585,0,0), -(8,5,10,159,128,0), -(8,5,2,2050,0,0), -(8,5,11,4540,128,0), -(8,5,0,6603,0,0), -(8,6,0,6603,0,0), -(8,6,1,49576,0,0), -(8,6,2,45477,0,0), -(8,6,3,45462,0,0), -(8,6,4,45902,0,0), -(8,6,5,47541,0,0), -(8,6,10,50621,0,0), -(8,7,1,403,0,0), -(8,7,10,159,128,0), -(8,7,2,331,0,0), -(8,7,11,117,128,0), -(8,7,0,6603,0,0), -(8,8,1,133,0,0), -(8,8,10,159,128,0), -(8,8,2,168,0,0), -(8,8,11,117,128,0), -(8,8,0,6603,0,0), -(10,2,0,6603,0,0), -(10,2,1,21084,0,0), -(10,2,2,635,0,0), -(10,2,3,28734,0,0), -(10,2,4,28730,0,0), -(10,2,10,159,128,0), -(10,2,11,20857,128,0), -(10,3,0,6603,0,0), -(10,3,1,2973,0,0), -(10,3,2,75,0,0), -(10,3,3,28734,0,0), -(10,3,4,28730,0,0), -(10,3,10,159,128,0), -(10,3,11,20857,128,0), -(10,4,0,6603,0,0), -(10,4,1,1752,0,0), -(10,4,2,2098,0,0), -(10,4,3,2764,0,0), -(10,4,4,28734,0,0), -(10,4,5,25046,0,0), -(10,4,11,20857,128,0), -(10,5,0,6603,0,0), -(10,5,1,585,0,0), -(10,5,2,2050,0,0), -(10,5,3,28734,0,0), -(10,5,4,28730,0,0), -(10,5,10,159,128,0), -(10,5,11,20857,128,0), -(10,6,0,6603,0,0), -(10,6,1,49576,0,0), -(10,6,2,45477,0,0), -(10,6,3,45462,0,0), -(10,6,4,45902,0,0), -(10,6,5,47541,0,0), -(10,6,6,50613,0,0), -(10,8,0,6603,0,0), -(10,8,1,133,0,0), -(10,8,2,168,0,0), -(10,8,3,28734,0,0), -(10,8,4,28730,0,0), -(10,8,10,159,128,0), -(10,8,11,20857,128,0), -(10,9,11,20857,128,0), -(10,9,10,159,128,0), -(10,9,4,28730,0,0), -(10,9,3,28734,0,0), -(10,9,2,687,0,0), -(10,9,1,686,0,0), -(10,9,0,6603,0,0), -(11,1,0,6603,0,0), -(11,1,72,6603,0,0), -(11,1,73,78,0,0), -(11,1,74,28880,0,0), -(11,1,83,4540,128,0), -(11,1,84,6603,0,0), -(11,1,96,6603,0,0), -(11,1,108,6603,0,0), -(11,2,0,6603,0,0), -(11,2,1,21084,0,0), -(11,2,2,635,0,0), -(11,2,3,59542,0,0), -(11,2,10,159,128,0), -(11,2,11,4540,128,0), -(11,2,83,4540,128,0), -(11,3,0,6603,0,0), -(11,3,1,2973,0,0), -(11,3,2,75,0,0), -(11,3,3,59543,0,0), -(11,3,10,159,128,0), -(11,3,11,4540,128,0), -(11,3,72,6603,0,0), -(11,3,73,2973,0,0), -(11,3,74,75,0,0), -(11,3,82,159,128,0), -(11,3,83,4540,128,0), -(11,5,0,6603,0,0), -(11,5,1,585,0,0), -(11,5,2,2050,0,0), -(11,5,3,59544,0,0), -(11,5,10,159,128,0), -(11,5,11,4540,128,0), -(11,5,83,4540,128,0), -(11,6,0,6603,0,0), -(11,6,1,49576,0,0), -(11,6,2,45477,0,0), -(11,6,3,45462,0,0), -(11,6,4,45902,0,0), -(11,6,5,47541,0,0), -(11,6,6,59545,0,0), -(11,7,0,6603,0,0), -(11,7,1,403,0,0), -(11,7,2,331,0,0), -(11,7,3,59547,0,0), -(11,7,10,159,128,0), -(11,7,11,4540,128,0), -(11,8,0,6603,0,0), -(11,8,1,133,0,0), -(11,8,2,168,0,0), -(11,8,3,59548,0,0), -(11,8,10,159,128,0), -(11,8,11,4540,128,0), -(11,8,83,4540,128,0); +(1,1,1,78,0), +(1,1,0,6603,0), +(1,1,11,117,128), +(1,2,2,635,0), +(1,2,0,6603,0), +(1,2,1,21084,0), +(1,2,10,159,128), +(1,2,11,2070,128), +(1,4,1,1752,0), +(1,4,2,2098,0), +(1,4,3,2764,0), +(1,4,0,6603,0), +(1,4,11,2070,128), +(1,5,1,585,0), +(1,5,2,2050,0), +(1,5,0,6603,0), +(1,5,10,159,128), +(1,5,11,2070,128), +(1,6,0,6603,0), +(1,6,1,49576,0), +(1,6,2,45477,0), +(1,6,3,45462,0), +(1,6,4,45902,0), +(1,6,5,47541,0), +(1,6,11,59752,0), +(1,8,1,133,0), +(1,8,2,168,0), +(1,8,0,6603,0), +(1,8,10,159,128), +(1,8,11,2070,128), +(1,9,1,686,0), +(1,9,2,687,0), +(1,9,0,6603,0), +(1,9,10,159,128), +(1,9,11,4604,128), +(2,1,1,78,0), +(2,1,0,6603,0), +(2,1,11,117,128), +(2,3,2,75,0), +(2,3,1,2973,0), +(2,3,0,6603,0), +(2,3,11,117,128), +(2,3,10,159,128), +(2,4,10,0,128), +(2,4,1,1752,0), +(2,4,2,2098,0), +(2,4,0,6603,0), +(2,4,11,117,128), +(2,6,0,6603,0), +(2,6,1,49576,0), +(2,6,2,45477,0), +(2,6,3,45462,0), +(2,6,4,45902,0), +(2,6,5,47541,0), +(2,6,10,20572,0), +(2,7,2,331,0), +(2,7,1,403,0), +(2,7,0,6603,0), +(2,7,11,117,128), +(2,7,10,159,128), +(2,9,1,686,0), +(2,9,2,687,0), +(2,9,0,6603,0), +(2,9,11,117,128), +(2,9,10,159,128), +(3,1,1,78,0), +(3,1,0,6603,0), +(3,1,11,117,128), +(3,2,2,635,0), +(3,2,0,6603,0), +(3,2,1,21084,0), +(3,2,10,159,128), +(3,2,11,4540,128), +(3,3,2,75,0), +(3,3,1,2973,0), +(3,3,0,6603,0), +(3,3,11,117,128), +(3,3,10,159,128), +(3,4,1,1752,0), +(3,4,2,2098,0), +(3,4,3,2764,0), +(3,4,0,6603,0), +(3,4,11,4540,128), +(3,5,1,585,0), +(3,5,2,2050,0), +(3,5,0,6603,0), +(3,5,10,159,128), +(3,5,11,4540,128), +(3,6,0,6603,0), +(3,6,1,49576,0), +(3,6,2,45477,0), +(3,6,3,45462,0), +(3,6,4,45902,0), +(3,6,5,47541,0), +(3,6,10,2481,0), +(4,1,1,78,0), +(4,1,0,6603,0), +(4,1,11,117,128), +(4,3,2,75,0), +(4,3,1,2973,0), +(4,3,0,6603,0), +(4,3,11,117,128), +(4,3,10,159,128), +(4,4,1,1752,0), +(4,4,2,2098,0), +(4,4,3,2764,0), +(4,4,0,6603,0), +(4,4,11,4540,128), +(4,5,1,585,0), +(4,5,2,2050,0), +(4,5,0,6603,0), +(4,5,10,159,128), +(4,5,11,2070,128), +(4,6,0,6603,0), +(4,6,1,49576,0), +(4,6,2,45477,0), +(4,6,3,45462,0), +(4,6,4,45902,0), +(4,6,5,47541,0), +(4,6,10,58984,0), +(4,6,83,58984,0), +(4,11,1,5176,0), +(4,11,2,5185,0), +(4,11,0,6603,0), +(4,11,10,159,128), +(4,11,11,4536,128), +(5,1,11,4604,128), +(5,1,0,6603,0), +(5,1,1,78,0), +(5,4,11,4604,128), +(5,4,3,2764,0), +(5,4,2,2098,0), +(5,4,1,1752,0), +(5,4,0,6603,0), +(5,5,10,159,128), +(5,5,2,2050,0), +(5,5,1,585,0), +(5,5,11,4604,128), +(5,5,0,6603,0), +(5,6,0,6603,0), +(5,6,1,49576,0), +(5,6,2,45477,0), +(5,6,3,45462,0), +(5,6,4,45902,0), +(5,6,5,47541,0), +(5,6,10,20577,0), +(5,8,11,4604,128), +(5,8,10,159,128), +(5,8,2,168,0), +(5,8,1,133,0), +(5,8,0,6603,0), +(5,9,1,686,0), +(5,9,10,159,128), +(5,9,2,687,0), +(5,9,11,4604,128), +(5,9,0,6603,0), +(6,1,1,78,0), +(6,1,2,20549,0), +(6,1,11,4540,128), +(6,1,0,6603,0), +(6,3,1,2973,0), +(6,3,10,159,128), +(6,3,2,75,0), +(6,3,3,20549,0), +(6,3,11,117,128), +(6,3,0,6603,0), +(6,6,0,6603,0), +(6,6,1,49576,0), +(6,6,2,45477,0), +(6,6,3,45462,0), +(6,6,4,45902,0), +(6,6,5,47541,0), +(6,6,10,20549,0), +(6,6,75,20549,0), +(6,7,1,403,0), +(6,7,10,159,128), +(6,7,2,331,0), +(6,7,3,20549,0), +(6,7,11,4604,128), +(6,7,0,6603,0), +(6,11,1,5176,0), +(6,11,10,159,128), +(6,11,2,5185,0), +(6,11,3,20549,0), +(6,11,11,4536,128), +(6,11,0,6603,0), +(7,1,11,117,128), +(7,1,1,78,0), +(7,1,0,6603,0), +(7,4,11,117,128), +(7,4,3,2764,0), +(7,4,1,1752,0), +(7,4,2,2098,0), +(7,4,0,6603,0), +(7,6,0,6603,0), +(7,6,1,49576,0), +(7,6,2,45477,0), +(7,6,3,45462,0), +(7,6,4,45902,0), +(7,6,5,47541,0), +(7,6,10,20589,0), +(7,6,72,6603,0), +(7,6,83,117,128), +(7,6,84,6603,0), +(7,6,96,6603,0), +(7,6,108,6603,0), +(7,8,11,4536,128), +(7,8,1,133,0), +(7,8,2,168,0), +(7,8,10,159,128), +(7,8,0,6603,0), +(7,9,11,4604,128), +(7,9,1,686,0), +(7,9,2,687,0), +(7,9,10,159,128), +(7,9,0,6603,0), +(8,1,11,117,128), +(8,1,1,78,0), +(8,1,3,2764,0), +(8,1,0,6603,0), +(8,3,10,159,128), +(8,3,11,4604,128), +(8,3,1,2973,0), +(8,3,2,75,0), +(8,3,0,6603,0), +(8,4,1,1752,0), +(8,4,3,2764,0), +(8,4,2,2098,0), +(8,4,11,117,128), +(8,4,0,6603,0), +(8,5,1,585,0), +(8,5,10,159,128), +(8,5,2,2050,0), +(8,5,11,4540,128), +(8,5,0,6603,0), +(8,6,0,6603,0), +(8,6,1,49576,0), +(8,6,2,45477,0), +(8,6,3,45462,0), +(8,6,4,45902,0), +(8,6,5,47541,0), +(8,6,10,50621,0), +(8,7,1,403,0), +(8,7,10,159,128), +(8,7,2,331,0), +(8,7,11,117,128), +(8,7,0,6603,0), +(8,8,1,133,0), +(8,8,10,159,128), +(8,8,2,168,0), +(8,8,11,117,128), +(8,8,0,6603,0), +(10,2,0,6603,0), +(10,2,1,21084,0), +(10,2,2,635,0), +(10,2,3,28734,0), +(10,2,4,28730,0), +(10,2,10,159,128), +(10,2,11,20857,128), +(10,3,0,6603,0), +(10,3,1,2973,0), +(10,3,2,75,0), +(10,3,3,28734,0), +(10,3,4,28730,0), +(10,3,10,159,128), +(10,3,11,20857,128), +(10,4,0,6603,0), +(10,4,1,1752,0), +(10,4,2,2098,0), +(10,4,3,2764,0), +(10,4,4,28734,0), +(10,4,5,25046,0), +(10,4,11,20857,128), +(10,5,0,6603,0), +(10,5,1,585,0), +(10,5,2,2050,0), +(10,5,3,28734,0), +(10,5,4,28730,0), +(10,5,10,159,128), +(10,5,11,20857,128), +(10,6,0,6603,0), +(10,6,1,49576,0), +(10,6,2,45477,0), +(10,6,3,45462,0), +(10,6,4,45902,0), +(10,6,5,47541,0), +(10,6,6,50613,0), +(10,8,0,6603,0), +(10,8,1,133,0), +(10,8,2,168,0), +(10,8,3,28734,0), +(10,8,4,28730,0), +(10,8,10,159,128), +(10,8,11,20857,128), +(10,9,11,20857,128), +(10,9,10,159,128), +(10,9,4,28730,0), +(10,9,3,28734,0), +(10,9,2,687,0), +(10,9,1,686,0), +(10,9,0,6603,0), +(11,1,0,6603,0), +(11,1,72,6603,0), +(11,1,73,78,0), +(11,1,74,28880,0), +(11,1,83,4540,128), +(11,1,84,6603,0), +(11,1,96,6603,0), +(11,1,108,6603,0), +(11,2,0,6603,0), +(11,2,1,21084,0), +(11,2,2,635,0), +(11,2,3,59542,0), +(11,2,10,159,128), +(11,2,11,4540,128), +(11,2,83,4540,128), +(11,3,0,6603,0), +(11,3,1,2973,0), +(11,3,2,75,0), +(11,3,3,59543,0), +(11,3,10,159,128), +(11,3,11,4540,128), +(11,3,72,6603,0), +(11,3,73,2973,0), +(11,3,74,75,0), +(11,3,82,159,128), +(11,3,83,4540,128), +(11,5,0,6603,0), +(11,5,1,585,0), +(11,5,2,2050,0), +(11,5,3,59544,0), +(11,5,10,159,128), +(11,5,11,4540,128), +(11,5,83,4540,128), +(11,6,0,6603,0), +(11,6,1,49576,0), +(11,6,2,45477,0), +(11,6,3,45462,0), +(11,6,4,45902,0), +(11,6,5,47541,0), +(11,6,6,59545,0), +(11,7,0,6603,0), +(11,7,1,403,0), +(11,7,2,331,0), +(11,7,3,59547,0), +(11,7,10,159,128), +(11,7,11,4540,128), +(11,8,0,6603,0), +(11,8,1,133,0), +(11,8,2,168,0), +(11,8,3,59548,0), +(11,8,10,159,128), +(11,8,11,4540,128), +(11,8,83,4540,128); /*!40000 ALTER TABLE `playercreateinfo_action` ENABLE KEYS */; UNLOCK TABLES; diff --git a/sql/updates/8098_01_characters_character_action.sql b/sql/updates/8098_01_characters_character_action.sql new file mode 100644 index 000000000..1ae612ab1 --- /dev/null +++ b/sql/updates/8098_01_characters_character_action.sql @@ -0,0 +1,10 @@ +ALTER TABLE character_db_version CHANGE COLUMN required_8072_02_characters_characters required_8098_01_characters_character_action bit; + +ALTER TABLE character_action + CHANGE COLUMN action action int(11) unsigned NOT NULL default '0'; + +UPDATE character_action + SET action = action | ( misc < 16 ); + +ALTER TABLE character_action + DROP COLUMN misc; diff --git a/sql/updates/8098_02_mangos_playercreateinfo_action.sql b/sql/updates/8098_02_mangos_playercreateinfo_action.sql new file mode 100644 index 000000000..f9bd79976 --- /dev/null +++ b/sql/updates/8098_02_mangos_playercreateinfo_action.sql @@ -0,0 +1,10 @@ +ALTER TABLE db_version CHANGE COLUMN required_8071_01_mangos_command required_8098_02_mangos_playercreateinfo_action bit; + +ALTER TABLE playercreateinfo_action + CHANGE COLUMN action action int(11) unsigned NOT NULL default '0'; + +UPDATE playercreateinfo_action + SET action = action | ( misc < 16 ); + +ALTER TABLE playercreateinfo_action + DROP COLUMN misc; diff --git a/sql/updates/8098_03_characters_character_pet.sql b/sql/updates/8098_03_characters_character_pet.sql new file mode 100644 index 000000000..d59e7729b --- /dev/null +++ b/sql/updates/8098_03_characters_character_pet.sql @@ -0,0 +1,13 @@ +ALTER TABLE character_db_version CHANGE COLUMN required_8098_01_characters_character_action required_8098_03_characters_character_pet bit; + +UPDATE character_pet + SET abdata = CONCAT( + (SUBSTRING(abdata, 1, length(SUBSTRING_INDEX(abdata, ' ', 1))) >> 8),' ', + SUBSTRING(abdata, length(SUBSTRING_INDEX(abdata, ' ', 1))+2, length(SUBSTRING_INDEX(abdata, ' ', 2))-length(SUBSTRING_INDEX(abdata, ' ', 1))-1),' ', + (SUBSTRING(abdata, length(SUBSTRING_INDEX(abdata, ' ', 2))+2, length(SUBSTRING_INDEX(abdata, ' ', 3))-length(SUBSTRING_INDEX(abdata, ' ', 2))-1) >> 8),' ', + SUBSTRING(abdata, length(SUBSTRING_INDEX(abdata, ' ', 3))+2, length(SUBSTRING_INDEX(abdata, ' ', 4))-length(SUBSTRING_INDEX(abdata, ' ', 3))-1),' ', + (SUBSTRING(abdata, length(SUBSTRING_INDEX(abdata, ' ', 4))+2, length(SUBSTRING_INDEX(abdata, ' ', 5))-length(SUBSTRING_INDEX(abdata, ' ', 4))-1) >> 8),' ', + SUBSTRING(abdata, length(SUBSTRING_INDEX(abdata, ' ', 5))+2, length(SUBSTRING_INDEX(abdata, ' ', 6))-length(SUBSTRING_INDEX(abdata, ' ', 5))-1),' ', + (SUBSTRING(abdata, length(SUBSTRING_INDEX(abdata, ' ', 6))+2, length(SUBSTRING_INDEX(abdata, ' ', 7))-length(SUBSTRING_INDEX(abdata, ' ', 6))-1) >> 8),' ', + SUBSTRING(abdata, length(SUBSTRING_INDEX(abdata, ' ', 7))+2, length(SUBSTRING_INDEX(abdata, ' ', 8))-length(SUBSTRING_INDEX(abdata, ' ', 7))-1),' ' + ); diff --git a/sql/updates/8098_04_characters_pet_spell.sql b/sql/updates/8098_04_characters_pet_spell.sql new file mode 100644 index 000000000..938c97632 --- /dev/null +++ b/sql/updates/8098_04_characters_pet_spell.sql @@ -0,0 +1,4 @@ +ALTER TABLE character_db_version CHANGE COLUMN required_8098_03_characters_character_pet required_8098_04_characters_pet_spell bit; + +UPDATE pet_spell + SET active = ( active >> 8); diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 087cdcaf1..48c1adc1f 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -235,6 +235,10 @@ pkgdata_DATA = \ 8071_01_mangos_command.sql \ 8072_01_characters_characters.sql \ 8072_02_characters_characters.sql \ + 8098_01_characters_character_action.sql \ + 8098_02_mangos_playercreateinfo_action.sql \ + 8098_03_characters_character_pet.sql \ + 8098_04_characters_pet_spell.sql \ README ## Additional files to include when running 'make dist' @@ -450,4 +454,8 @@ EXTRA_DIST = \ 8071_01_mangos_command.sql \ 8072_01_characters_characters.sql \ 8072_02_characters_characters.sql \ + 8098_01_characters_character_action.sql \ + 8098_02_mangos_playercreateinfo_action.sql \ + 8098_03_characters_character_pet.sql \ + 8098_04_characters_pet_spell.sql \ README diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index e53ecfdd5..a0799d0bc 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -68,7 +68,7 @@ bool LoginQueryHolder::Initialize() res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS,"SELECT quest,time FROM character_queststatus_daily WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADREPUTATION, "SELECT faction,standing,flags FROM character_reputation WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADINVENTORY, "SELECT data,bag,slot,item,item_template FROM character_inventory JOIN item_instance ON character_inventory.item = item_instance.guid WHERE character_inventory.guid = '%u' ORDER BY bag,slot", GUID_LOPART(m_guid)); - res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACTIONS, "SELECT button,action,type,misc FROM character_action WHERE guid = '%u' ORDER BY button", GUID_LOPART(m_guid)); + res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACTIONS, "SELECT button,action,type FROM character_action WHERE guid = '%u' ORDER BY button", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMAILCOUNT, "SELECT COUNT(id) FROM mail WHERE receiver = '%u' AND (checked & 1)=0 AND deliver_time <= '" UI64FMTD "'", GUID_LOPART(m_guid),(uint64)time(NULL)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMAILDATE, "SELECT MIN(deliver_time) FROM mail WHERE receiver = '%u' AND (checked & 1)=0", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSOCIALLIST, "SELECT friend,flags,note FROM character_social WHERE guid = '%u' LIMIT 255", GUID_LOPART(m_guid)); diff --git a/src/game/Creature.h b/src/game/Creature.h index 722f05fc9..df29675ef 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -294,7 +294,7 @@ struct CreatureData struct CreatureDataAddonAura { - uint16 spell_id; + uint32 spell_id; uint8 effect_idx; }; @@ -667,10 +667,10 @@ class MANGOS_DLL_SPEC Creature : public Unit virtual uint8 GetPetAutoSpellSize() const { return CREATURE_MAX_SPELLS; } virtual uint32 GetPetAutoSpellOnPos(uint8 pos) const { - if (pos >= CREATURE_MAX_SPELLS || m_charmInfo->GetCharmSpell(pos)->active != ACT_ENABLED) + if (pos >= CREATURE_MAX_SPELLS || m_charmInfo->GetCharmSpell(pos)->GetType() != ACT_ENABLED) return 0; else - return m_charmInfo->GetCharmSpell(pos)->spellId; + return m_charmInfo->GetCharmSpell(pos)->GetAction(); } void SetCombatStartPosition(float x, float y, float z) { CombatStartX = x; CombatStartY = y; CombatStartZ = z; } diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index d00b2b331..c13029b88 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -984,40 +984,41 @@ void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data) CHECK_PACKET_SIZE(recv_data,1+2+1+1); sLog.outDebug( "WORLD: Received CMSG_SET_ACTION_BUTTON" ); - uint8 button, misc, type; - uint16 action; - recv_data >> button >> action >> misc >> type; - sLog.outDetail( "BUTTON: %u ACTION: %u TYPE: %u MISC: %u", button, action, type, misc ); - if(action==0) + uint8 button; + uint32 packetData; + recv_data >> button >> packetData; + + uint32 action = ACTION_BUTTON_ACTION(packetData); + uint8 type = ACTION_BUTTON_TYPE(packetData); + + sLog.outDetail( "BUTTON: %u ACTION: %u TYPE: %u", button, action, type ); + if (!packetData) { sLog.outDetail( "MISC: Remove action from button %u", button ); - GetPlayer()->removeActionButton(button); } else { - if(type==ACTION_BUTTON_MACRO || type==ACTION_BUTTON_CMACRO) + switch(type) { - sLog.outDetail( "MISC: Added Macro %u into button %u", action, button ); - GetPlayer()->addActionButton(button,action,type,misc); + case ACTION_BUTTON_MACRO: + case ACTION_BUTTON_CMACRO: + sLog.outDetail( "MISC: Added Macro %u into button %u", action, button ); + break; + case ACTION_BUTTON_EQSET: + sLog.outDetail( "MISC: Added EquipmentSet %u into button %u", action, button ); + break; + case ACTION_BUTTON_SPELL: + sLog.outDetail( "MISC: Added Spell %u into button %u", action, button ); + break; + case ACTION_BUTTON_ITEM: + sLog.outDetail( "MISC: Added Item %u into button %u", action, button ); + break; + default: + sLog.outError( "MISC: Unknown action button type %u for action %u into button %u", type, action, button ); + return; } - else if(type==ACTION_BUTTON_EQSET) - { - sLog.outDetail( "MISC: Added EquipmentSet %u into button %u", action, button ); - GetPlayer()->addActionButton(button,action,type,misc); - } - else if(type==ACTION_BUTTON_SPELL) - { - sLog.outDetail( "MISC: Added Spell %u into button %u", action, button ); - GetPlayer()->addActionButton(button,action,type,misc); - } - else if(type==ACTION_BUTTON_ITEM) - { - sLog.outDetail( "MISC: Added Item %u into button %u", action, button ); - GetPlayer()->addActionButton(button,action,type,misc); - } - else - sLog.outError( "MISC: Unknown action button type %u for action %u into button %u", type, action, button ); + GetPlayer()->addActionButton(button,action,type); } } diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index cc43fb362..a6c479598 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -2404,8 +2404,8 @@ void ObjectMgr::LoadPlayerInfo() // Load playercreate actions { - // 0 1 2 3 4 5 - QueryResult *result = WorldDatabase.Query("SELECT race, class, button, action, type, misc FROM playercreateinfo_action"); + // 0 1 2 3 4 + QueryResult *result = WorldDatabase.Query("SELECT race, class, button, action, type FROM playercreateinfo_action"); uint32 count = 0; @@ -2440,10 +2440,7 @@ void ObjectMgr::LoadPlayerInfo() } PlayerInfo* pInfo = &playerInfo[current_race][current_class]; - pInfo->action[0].push_back(fields[2].GetUInt16()); - pInfo->action[1].push_back(fields[3].GetUInt16()); - pInfo->action[2].push_back(fields[4].GetUInt16()); - pInfo->action[3].push_back(fields[5].GetUInt16()); + pInfo->action.push_back(PlayerCreateInfoAction(fields[2].GetUInt8(),fields[3].GetUInt32(),fields[4].GetUInt8())); bar.step(); ++count; diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 5897c1e1c..5acb7069d 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -422,8 +422,8 @@ void Pet::SavePetToDB(PetSaveMode mode) // save only spell slots from action bar for(uint32 i = ACTION_BAR_INDEX_PET_SPELL_START; i < ACTION_BAR_INDEX_PET_SPELL_END; ++i) { - ss << uint32(m_charmInfo->GetActionBarEntry(i)->Type) << " " - << uint32(m_charmInfo->GetActionBarEntry(i)->SpellOrAction) << " "; + ss << uint32(m_charmInfo->GetActionBarEntry(i)->GetType()) << " " + << uint32(m_charmInfo->GetActionBarEntry(i)->GetAction()) << " "; }; ss << "', " @@ -1102,7 +1102,7 @@ void Pet::_LoadSpells() { Field *fields = result->Fetch(); - addSpell(fields[0].GetUInt32(), ActiveStates(fields[1].GetUInt16()), PETSPELL_UNCHANGED); + addSpell(fields[0].GetUInt32(), ActiveStates(fields[1].GetUInt8()), PETSPELL_UNCHANGED); } while( result->NextRow() ); @@ -1404,8 +1404,8 @@ bool Pet::learnSpell(uint32 spell_id) Unit* owner = GetOwner(); if(owner && owner->GetTypeId() == TYPEID_PLAYER) { - WorldPacket data(SMSG_PET_LEARNED_SPELL, 2); - data << uint16(spell_id); + WorldPacket data(SMSG_PET_LEARNED_SPELL, 4); + data << uint32(spell_id); ((Player*)owner)->GetSession()->SendPacket(&data); ((Player*)owner)->PetSpellInitialize(); @@ -1461,8 +1461,8 @@ bool Pet::unlearnSpell(uint32 spell_id, bool learn_prev, bool clear_ab) { if(!m_loading) { - WorldPacket data(SMSG_PET_REMOVED_SPELL, 2); - data << uint16(spell_id); + WorldPacket data(SMSG_PET_REMOVED_SPELL, 4); + data << uint32(spell_id); ((Player*)GetOwner())->GetSession()->SendPacket(&data); } } @@ -1527,8 +1527,9 @@ void Pet::CleanupActionBar() { for(int i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i) if(UnitActionBarEntry const* ab = m_charmInfo->GetActionBarEntry(i)) - if(ab->SpellOrAction && ab->IsActionBarForSpell() && !HasSpell(ab->SpellOrAction)) - m_charmInfo->SetActionBar(i,0,ACT_DISABLED); + if(uint32 action = ab->GetAction()) + if(ab->IsActionBarForSpell() && !HasSpell(action)) + m_charmInfo->SetActionBar(i,0,ACT_DISABLED); } void Pet::InitPetCreateSpells() @@ -1903,7 +1904,7 @@ void Pet::CastPetAuras(bool current) void Pet::CastPetAura(PetAura const* aura) { - uint16 auraId = aura->GetAura(GetEntry()); + uint32 auraId = aura->GetAura(GetEntry()); if(!auraId) return; diff --git a/src/game/Pet.h b/src/game/Pet.h index 4c3c2bd3d..f41b77710 100644 --- a/src/game/Pet.h +++ b/src/game/Pet.h @@ -69,7 +69,7 @@ enum PetSpellType struct PetSpell { - uint16 active; // use instead enum (not good use *uint16* limited enum in case when value in enum not possitive in *int16*) + uint8 active; // use instead enum (not good use *uint8* limited enum in case when value in enum not possitive in *int8*) PetSpellState state : 8; PetSpellType type : 8; diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp index ee5119251..441e40072 100644 --- a/src/game/PetHandler.cpp +++ b/src/game/PetHandler.cpp @@ -34,17 +34,18 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data ) CHECK_PACKET_SIZE(recv_data, 8+2+2+8); uint64 guid1; - uint16 spellid; - uint16 flag; + uint32 data; uint64 guid2; recv_data >> guid1; //pet guid - recv_data >> spellid; - recv_data >> flag; //delete = 0x0700 CastSpell = C100 + recv_data >> data; recv_data >> guid2; //tag guid + uint32 spellid = UNIT_ACTION_BUTTON_ACTION(data); + uint8 flag = UNIT_ACTION_BUTTON_TYPE(data); //delete = 0x07 CastSpell = C1 + // used also for charmed creature Unit* pet= ObjectAccessor::GetUnit(*_player, guid1); - sLog.outDetail("HandlePetAction.Pet %u flag is %u, spellid is %u, target %u.", uint32(GUID_LOPART(guid1)), flag, spellid, uint32(GUID_LOPART(guid2)) ); + sLog.outDetail("HandlePetAction.Pet %u flag is %u, spellid is %u, target %u.", uint32(GUID_LOPART(guid1)), uint32(flag), spellid, uint32(GUID_LOPART(guid2)) ); if(!pet) { sLog.outError( "Pet %u not exist.", uint32(GUID_LOPART(guid1)) ); @@ -72,7 +73,7 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data ) switch(flag) { - case ACT_COMMAND: //0x0700 + case ACT_COMMAND: //0x07 switch(spellid) { case COMMAND_STAY: //flat=1792 //STAY @@ -121,7 +122,7 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data ) pet->SendPetAIReaction(guid1); } } - else // charmed player + else // charmed player { pet->Attack(TargetUnit,true); pet->SendPetAIReaction(guid1); @@ -143,10 +144,10 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data ) _player->Uncharm(); break; default: - sLog.outError("WORLD: unknown PET flag Action %i and spellid %i.", flag, spellid); + sLog.outError("WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid); } break; - case ACT_REACTION: // 0x600 + case ACT_REACTION: // 0x6 switch(spellid) { case REACT_PASSIVE: //passive @@ -156,9 +157,9 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data ) break; } break; - case ACT_DISABLED: // 0x8100 spell (disabled), ignore - case ACT_PASSIVE: // 0x0100 - case ACT_ENABLED: // 0xC100 spell + case ACT_DISABLED: // 0x81 spell (disabled), ignore + case ACT_PASSIVE: // 0x01 + case ACT_ENABLED: // 0xC1 spell { Unit* unit_target = NULL; if (((Creature*)pet)->GetGlobalCooldown() > 0) @@ -258,7 +259,7 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data ) break; } default: - sLog.outError("WORLD: unknown PET flag Action %i and spellid %i.", flag, spellid); + sLog.outError("WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid); } } @@ -309,9 +310,6 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data ) sLog.outDetail( "HandlePetSetAction. CMSG_PET_SET_ACTION" ); uint64 petguid; - uint32 position; - uint16 spell_id; - uint16 act_state; uint8 count; recv_data >> petguid; @@ -339,11 +337,16 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data ) count = (recv_data.size() == 24) ? 2 : 1; for(uint8 i = 0; i < count; ++i) { - recv_data >> position; - recv_data >> spell_id; - recv_data >> act_state; + uint32 position; + uint32 data; - sLog.outDetail( "Player %s has changed pet spell action. Position: %u, Spell: %u, State: 0x%X", _player->GetName(), position, spell_id, act_state); + recv_data >> position; + recv_data >> data; + + uint32 spell_id = UNIT_ACTION_BUTTON_ACTION(data); + uint8 act_state = UNIT_ACTION_BUTTON_TYPE(data); + + sLog.outDetail( "Player %s has changed pet spell action. Position: %u, Spell: %u, State: 0x%X", _player->GetName(), position, spell_id, uint32(act_state)); //ignore invalid position if(position >= MAX_UNIT_ACTION_BAR_INDEX) @@ -516,10 +519,9 @@ void WorldSession::HandlePetSpellAutocastOpcode( WorldPacket& recvPacket ) sLog.outDetail("CMSG_PET_SPELL_AUTOCAST"); uint64 guid; - uint16 spellid; - uint16 spellid2; //maybe second spell, automatically toggled off when first toggled on? + uint32 spellid; uint8 state; //1 for on, 0 for off - recvPacket >> guid >> spellid >> spellid2 >> state; + recvPacket >> guid >> spellid >> state; if(!_player->GetPet() && !_player->GetCharm()) return; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 42e34194e..8acf126aa 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -651,21 +651,8 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8 learnDefaultSpells(); // original action bar - std::list::const_iterator action_itr[4]; - for(int i=0; i<4; ++i) - action_itr[i] = info->action[i].begin(); - - for (; action_itr[0]!=info->action[0].end() && action_itr[1]!=info->action[1].end();) - { - uint16 taction[4]; - for(int i=0; i<4 ;++i) - taction[i] = (*action_itr[i]); - - addActionButton((uint8)taction[0], taction[1], (uint8)taction[2], (uint8)taction[3]); - - for(int i=0; i<4 ;++i) - ++action_itr[i]; - } + for (PlayerCreateInfoActions::const_iterator action_itr = info->action.begin(); action_itr != info->action.end(); ++action_itr) + addActionButton(action_itr->button,action_itr->action,action_itr->type); // original items CharStartOutfitEntry const* oEntry = NULL; @@ -5427,65 +5414,69 @@ void Player::SendInitialActionButtons() const sLog.outDetail( "Initializing Action Buttons for '%u'", GetGUIDLow() ); WorldPacket data(SMSG_ACTION_BUTTONS, 1+(MAX_ACTION_BUTTONS*4)); - data << uint8(0); // can be 0, 1, 2 + data << uint8(0); // can be 0, 1, 2 (talent spec) for(int button = 0; button < MAX_ACTION_BUTTONS; ++button) { ActionButtonList::const_iterator itr = m_actionButtons.find(button); if(itr != m_actionButtons.end() && itr->second.uState != ACTIONBUTTON_DELETED) - { - data << uint16(itr->second.action); - data << uint8(itr->second.misc); - data << uint8(itr->second.type); - } + data << uint32(itr->second.packedData); else - { data << uint32(0); - } } GetSession()->SendPacket( &data ); sLog.outDetail( "Action Buttons for '%u' Initialized", GetGUIDLow() ); } -bool Player::addActionButton(const uint8 button, const uint16 action, const uint8 type, const uint8 misc) +ActionButton* Player::addActionButton(uint8 button, uint32 action, uint8 type) { if(button >= MAX_ACTION_BUTTONS) { sLog.outError( "Action %u not added into button %u for player %s: button must be < 132", action, button, GetName() ); - return false; + return NULL; } - // check cheating with adding non-known spells to action bar - if(type==ACTION_BUTTON_SPELL) + if(action >= MAX_ACTION_BUTTON_ACTION_VALUE) { - if(!sSpellStore.LookupEntry(action)) - { - sLog.outError( "Action %u not added into button %u for player %s: spell not exist", action, button, GetName() ); - return false; - } - - if(!HasSpell(action)) - { - sLog.outError( "Action %u not added into button %u for player %s: player don't known this spell", action, button, GetName() ); - return false; - } + sLog.outError( "Action %u not added into button %u for player %s: action must be < %u", action, button, GetName(), MAX_ACTION_BUTTON_ACTION_VALUE ); + return NULL; } - ActionButtonList::iterator buttonItr = m_actionButtons.find(button); + switch(type) + { + case ACTION_BUTTON_SPELL: + if(!sSpellStore.LookupEntry(action)) + { + sLog.outError( "Action %u not added into button %u for player %s: spell not exist", action, button, GetName() ); + return NULL; + } - if (buttonItr==m_actionButtons.end()) - { // just add new button - m_actionButtons[button] = ActionButton(action,type,misc); + if(!HasSpell(action)) + { + sLog.outError( "Action %u not added into button %u for player %s: player don't known this spell", action, button, GetName() ); + return NULL; + } + break; + case ACTION_BUTTON_ITEM: + if(!objmgr.GetItemPrototype(action)) + { + sLog.outError( "Action %u not added into button %u for player %s: item not exist", action, button, GetName() ); + return NULL; + } + break; + default: + break; // pther cases not checked at this moment } - else - { // change state of current button - ActionButtonUpdateState uState = buttonItr->second.uState; - buttonItr->second = ActionButton(action,type,misc); - if (uState != ACTIONBUTTON_NEW) buttonItr->second.uState = ACTIONBUTTON_CHANGED; - }; - sLog.outDetail( "Player '%u' Added Action '%u' to Button '%u'", GetGUIDLow(), action, button ); - return true; + + // it create new button (NEW state) if need or return existed + ActionButton& ab = m_actionButtons[button]; + + // set data and update to CHANGED if not NEW + ab.SetActionAndType(action,ActionButtonType(type)); + + sLog.outDetail( "Player '%u' Added Action '%u' (type %u) to Button '%u'", GetGUIDLow(), action, uint32(type), button ); + return &ab; } void Player::removeActionButton(uint8 button) @@ -14496,7 +14487,7 @@ void Player::_LoadActions(QueryResult *result) { m_actionButtons.clear(); - //QueryResult *result = CharacterDatabase.PQuery("SELECT button,action,type,misc FROM character_action WHERE guid = '%u' ORDER BY button",GetGUIDLow()); + //QueryResult *result = CharacterDatabase.PQuery("SELECT button,action,type FROM character_action WHERE guid = '%u' ORDER BY button",GetGUIDLow()); if(result) { @@ -14505,9 +14496,11 @@ void Player::_LoadActions(QueryResult *result) Field *fields = result->Fetch(); uint8 button = fields[0].GetUInt8(); + uint32 action = fields[1].GetUInt32(); + uint8 type = fields[2].GetUInt8(); - if(addActionButton(button, fields[1].GetUInt16(), fields[2].GetUInt8(), fields[3].GetUInt8())) - m_actionButtons[button].uState = ACTIONBUTTON_UNCHANGED; + if(ActionButton* ab = addActionButton(button, action, type)) + ab->uState = ACTIONBUTTON_UNCHANGED; else { sLog.outError( " ...at loading, and will deleted in DB also"); @@ -15082,7 +15075,7 @@ void Player::_LoadSpells(QueryResult *result) { Field *fields = result->Fetch(); - addSpell(fields[0].GetUInt16(), fields[1].GetBool(), false, false, fields[2].GetBool()); + addSpell(fields[0].GetUInt32(), fields[1].GetBool(), false, false, fields[2].GetBool()); } while( result->NextRow() ); @@ -15581,14 +15574,14 @@ void Player::_SaveActions() switch (itr->second.uState) { case ACTIONBUTTON_NEW: - CharacterDatabase.PExecute("INSERT INTO character_action (guid,button,action,type,misc) VALUES ('%u', '%u', '%u', '%u', '%u')", - GetGUIDLow(), (uint32)itr->first, (uint32)itr->second.action, (uint32)itr->second.type, (uint32)itr->second.misc ); + CharacterDatabase.PExecute("INSERT INTO character_action (guid,button,action,type) VALUES ('%u', '%u', '%u', '%u')", + GetGUIDLow(), (uint32)itr->first, (uint32)itr->second.GetAction(), (uint32)itr->second.GetType() ); itr->second.uState = ACTIONBUTTON_UNCHANGED; ++itr; break; case ACTIONBUTTON_CHANGED: - CharacterDatabase.PExecute("UPDATE character_action SET action = '%u', type = '%u', misc= '%u' WHERE guid= '%u' AND button= '%u' ", - (uint32)itr->second.action, (uint32)itr->second.type, (uint32)itr->second.misc, GetGUIDLow(), (uint32)itr->first ); + CharacterDatabase.PExecute("UPDATE character_action SET action = '%u', type = '%u' WHERE guid= '%u' AND button= '%u' ", + (uint32)itr->second.GetAction(), (uint32)itr->second.GetType(), GetGUIDLow(), (uint32)itr->first ); itr->second.uState = ACTIONBUTTON_UNCHANGED; ++itr; break; @@ -15599,7 +15592,7 @@ void Player::_SaveActions() default: ++itr; break; - }; + } } } @@ -16413,8 +16406,7 @@ void Player::PetSpellInitialize() if(itr->second.state == PETSPELL_REMOVED) continue; - data << uint16(itr->first); - data << uint16(itr->second.active); // pet spell active state isn't boolean + data << uint32(MAKE_UNIT_ACTION_BUTTON(itr->first,itr->second.active)); ++addlist; } } @@ -16502,7 +16494,7 @@ void Player::CharmSpellInitialize() { for(uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i) { - if(charmInfo->GetCharmSpell(i)->spellId) + if(charmInfo->GetCharmSpell(i)->GetAction()) ++addlist; } } @@ -16527,11 +16519,8 @@ void Player::CharmSpellInitialize() for(uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i) { CharmSpellEntry *cspell = charmInfo->GetCharmSpell(i); - if(cspell->spellId) - { - data << uint16(cspell->spellId); - data << uint16(cspell->active); - } + if(cspell->GetAction()) + data << uint32(cspell->packedData); } } diff --git a/src/game/Player.h b/src/game/Player.h index 4a27c934c..05a214777 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -133,17 +133,6 @@ enum ActionButtonUpdateState ACTIONBUTTON_DELETED = 3 }; -struct ActionButton -{ - ActionButton() : action(0), type(0), misc(0), uState( ACTIONBUTTON_NEW ) {} - ActionButton(uint16 _action, uint8 _type, uint8 _misc) : action(_action), type(_type), misc(_misc), uState( ACTIONBUTTON_NEW ) {} - - uint16 action; - uint8 type; - uint8 misc; - ActionButtonUpdateState uState; -}; - enum ActionButtonType { ACTION_BUTTON_SPELL = 0, @@ -153,6 +142,32 @@ enum ActionButtonType ACTION_BUTTON_ITEM = 128 }; +#define ACTION_BUTTON_ACTION(X) (uint32(X) & 0x00FFFFFF) +#define ACTION_BUTTON_TYPE(X) ((uint32(X) & 0xFF000000) >> 24) +#define MAX_ACTION_BUTTON_ACTION_VALUE (0x00FFFFFF+1) + +struct ActionButton +{ + ActionButton() : packedData(0), uState( ACTIONBUTTON_NEW ) {} + + uint32 packedData; + ActionButtonUpdateState uState; + + // helpers + ActionButtonType GetType() const { return ActionButtonType(ACTION_BUTTON_TYPE(packedData)); } + uint32 GetAction() const { return ACTION_BUTTON_ACTION(packedData); } + void SetActionAndType(uint32 action, ActionButtonType type) + { + uint32 newData = action | (uint32(type) << 24); + if (newData != packedData) + { + packedData = newData; + if (uState != ACTIONBUTTON_NEW) + uState = ACTIONBUTTON_CHANGED; + } + } +}; + #define MAX_ACTION_BUTTONS 132 //checked in 2.3.0 typedef std::map ActionButtonList; @@ -190,6 +205,18 @@ struct PlayerLevelInfo typedef std::list PlayerCreateInfoSpells; +struct PlayerCreateInfoAction +{ + PlayerCreateInfoAction() : button(0), type(0), action(0) {} + PlayerCreateInfoAction(uint8 _button, uint32 _action, uint8 _type) : button(_button), type(_type), action(_action) {} + + uint8 button; + uint8 type; + uint32 action; +}; + +typedef std::list PlayerCreateInfoActions; + struct PlayerInfo { // existence checked by displayId != 0 // existence checked by displayId != 0 @@ -206,7 +233,7 @@ struct PlayerInfo uint16 displayId_f; PlayerCreateInfoItems item; PlayerCreateInfoSpells spell; - std::list action[4]; + PlayerCreateInfoActions action; PlayerLevelInfo* levelInfo; //[level-1] 0..MaxPlayerLevel-1 }; @@ -1513,7 +1540,7 @@ class MANGOS_DLL_SPEC Player : public Unit m_cinematic = cine; } - bool addActionButton(uint8 button, uint16 action, uint8 type, uint8 misc); + ActionButton* addActionButton(uint8 button, uint32 action, uint8 type); void removeActionButton(uint8 button); void SendInitialActionButtons() const; diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 2f188734a..17cc4694e 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -2087,10 +2087,10 @@ void SpellMgr::LoadSpellPetAuras() bar.step(); - uint16 spell = fields[0].GetUInt16(); + uint32 spell = fields[0].GetUInt32(); uint8 eff = fields[1].GetUInt8(); - uint16 pet = fields[2].GetUInt16(); - uint16 aura = fields[3].GetUInt16(); + uint32 pet = fields[2].GetUInt32(); + uint32 aura = fields[3].GetUInt32(); SpellPetAuraMap::iterator itr = mSpellPetAuraMap.find((spell<<8) + eff); if(itr != mSpellPetAuraMap.end()) diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 71c8535ef..f6b71aeb6 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -487,20 +487,20 @@ class PetAura auras.clear(); } - PetAura(uint16 petEntry, uint16 aura, bool _removeOnChangePet, int _damage) : + PetAura(uint32 petEntry, uint32 aura, bool _removeOnChangePet, int _damage) : removeOnChangePet(_removeOnChangePet), damage(_damage) { auras[petEntry] = aura; } - uint16 GetAura(uint16 petEntry) const + uint32 GetAura(uint32 petEntry) const { - std::map::const_iterator itr = auras.find(petEntry); + std::map::const_iterator itr = auras.find(petEntry); if(itr != auras.end()) return itr->second; else { - std::map::const_iterator itr2 = auras.find(0); + std::map::const_iterator itr2 = auras.find(0); if(itr2 != auras.end()) return itr2->second; else @@ -508,7 +508,7 @@ class PetAura } } - void AddAura(uint16 petEntry, uint16 aura) + void AddAura(uint32 petEntry, uint32 aura) { auras[petEntry] = aura; } @@ -524,7 +524,7 @@ class PetAura } private: - std::map auras; + std::map auras; bool removeOnChangePet; int32 damage; }; @@ -633,7 +633,7 @@ class SpellMgr // Accessors (const or static functions) public: // Spell affects - SpellAffectEntry const*GetSpellAffect(uint16 spellId, uint8 effectId) const + SpellAffectEntry const*GetSpellAffect(uint32 spellId, uint8 effectId) const { SpellAffectMap::const_iterator itr = mSpellAffectMap.find((spellId<<8) + effectId); if( itr != mSpellAffectMap.end( ) ) @@ -833,7 +833,7 @@ class SpellMgr return mSkillLineAbilityMap.upper_bound(spell_id); } - PetAura const* GetPetAura(uint16 spell_id, uint8 eff) + PetAura const* GetPetAura(uint32 spell_id, uint8 eff) { SpellPetAuraMap::const_iterator itr = mSpellPetAuraMap.find((spell_id<<8) + eff); if(itr != mSpellPetAuraMap.end()) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 5ddca82d2..fb91db413 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -10384,10 +10384,7 @@ CharmInfo::CharmInfo(Unit* unit) : m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_reactState(REACT_PASSIVE), m_petnumber(0) { for(int i =0; i<4; ++i) - { - m_charmspells[i].spellId = 0; - m_charmspells[i].active = ACT_DISABLED; - } + m_charmspells[i].SetActionAndType(0,ACT_DISABLED); } void CharmInfo::InitPetActionBar() @@ -10441,18 +10438,22 @@ void CharmInfo::InitCharmCreateSpells() for(uint32 x = 0; x < CREATURE_MAX_SPELLS; ++x) { uint32 spellId = ((Creature*)m_unit)->m_spells[x]; - m_charmspells[x].spellId = spellId; if(!spellId) + { + m_charmspells[x].SetActionAndType(spellId,ACT_DISABLED); continue; + } if (IsPassiveSpell(spellId)) { m_unit->CastSpell(m_unit, spellId, true); - m_charmspells[x].active = ACT_PASSIVE; + m_charmspells[x].SetActionAndType(spellId,ACT_PASSIVE); } else { + m_charmspells[x].SetActionAndType(spellId,ACT_DISABLED); + ActiveStates newstate; bool onlyselfcast = true; SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); @@ -10481,11 +10482,11 @@ bool CharmInfo::AddSpellToActionBar(uint32 spell_id, ActiveStates newstate) // new spell rank can be already listed for(uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i) { - if (PetActionBar[i].SpellOrAction && PetActionBar[i].IsActionBarForSpell()) + if (uint32 action = PetActionBar[i].GetAction()) { - if (spellmgr.GetFirstSpellInChain(PetActionBar[i].SpellOrAction) == first_id) + if (PetActionBar[i].IsActionBarForSpell() && spellmgr.GetFirstSpellInChain(action) == first_id) { - PetActionBar[i].SpellOrAction = spell_id; + PetActionBar[i].SetAction(spell_id); return true; } } @@ -10494,7 +10495,7 @@ bool CharmInfo::AddSpellToActionBar(uint32 spell_id, ActiveStates newstate) // or use empty slot in other case for(uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i) { - if (!PetActionBar[i].SpellOrAction && PetActionBar[i].IsActionBarForSpell()) + if (!PetActionBar[i].GetAction() && PetActionBar[i].IsActionBarForSpell()) { SetActionBar(i,spell_id,newstate == ACT_DECIDE ? ACT_DISABLED : newstate); return true; @@ -10509,9 +10510,9 @@ bool CharmInfo::RemoveSpellFromActionBar(uint32 spell_id) for(uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i) { - if (PetActionBar[i].SpellOrAction && PetActionBar[i].IsActionBarForSpell()) + if (uint32 action = PetActionBar[i].GetAction()) { - if (spellmgr.GetFirstSpellInChain(PetActionBar[i].SpellOrAction) == first_id) + if (PetActionBar[i].IsActionBarForSpell() && spellmgr.GetFirstSpellInChain(action) == first_id) { SetActionBar(i,0,ACT_DISABLED); return true; @@ -10528,12 +10529,8 @@ void CharmInfo::ToggleCreatureAutocast(uint32 spellid, bool apply) return; for(uint32 x = 0; x < CREATURE_MAX_SPELLS; ++x) - { - if(spellid == m_charmspells[x].spellId) - { - m_charmspells[x].active = apply ? ACT_ENABLED : ACT_DISABLED; - } - } + if(spellid == m_charmspells[x].GetAction()) + m_charmspells[x].SetType(apply ? ACT_ENABLED : ACT_DISABLED); } void CharmInfo::SetPetNumber(uint32 petnumber, bool statwindow) @@ -10559,12 +10556,14 @@ void CharmInfo::LoadPetActionBar(const std::string& data ) for(iter = tokens.begin(), index = ACTION_BAR_INDEX_PET_SPELL_START; index < ACTION_BAR_INDEX_PET_SPELL_END; ++iter, ++index ) { // use unsigned cast to avoid sign negative format use at long-> ActiveStates (int) conversion - PetActionBar[index].Type = atol((*iter).c_str()); + uint8 type = atol((*iter).c_str()); ++iter; - PetActionBar[index].SpellOrAction = atol((*iter).c_str()); + uint32 action = atol((*iter).c_str()); + + PetActionBar[index].SetActionAndType(action,ActiveStates(type)); // check correctness - if(PetActionBar[index].IsActionBarForSpell() && !sSpellStore.LookupEntry(PetActionBar[index].SpellOrAction)) + if(PetActionBar[index].IsActionBarForSpell() && !sSpellStore.LookupEntry(PetActionBar[index].GetAction())) SetActionBar(index,0,ACT_DISABLED); } } @@ -10572,19 +10571,16 @@ void CharmInfo::LoadPetActionBar(const std::string& data ) void CharmInfo::BuildActionBar( WorldPacket* data ) { for(uint32 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i) - { - *data << uint16(PetActionBar[i].SpellOrAction); - *data << uint16(PetActionBar[i].Type); - } + *data << uint32(PetActionBar[i].packedData); } void CharmInfo::SetSpellAutocast( uint32 spell_id, bool state ) { for(int i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i) { - if(spell_id == PetActionBar[i].SpellOrAction && PetActionBar[i].IsActionBarForSpell()) + if(spell_id == PetActionBar[i].GetAction() && PetActionBar[i].IsActionBarForSpell()) { - PetActionBar[i].Type = state ? ACT_ENABLED : ACT_DISABLED; + PetActionBar[i].SetType(state ? ACT_ENABLED : ACT_DISABLED); break; } } diff --git a/src/game/Unit.h b/src/game/Unit.h index b2b4704ae..fe35362b1 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -718,12 +718,12 @@ enum CurrentSpellTypes enum ActiveStates { - ACT_PASSIVE = 0x0100, // 0x0100 - passive - ACT_DISABLED = 0x8100, // 0x8000 - castable - ACT_ENABLED = 0xC100, // 0x4000 | 0x8000 - auto cast + castable - ACT_COMMAND = 0x0700, // 0x0100 | 0x0200 | 0x0400 - ACT_REACTION = 0x0600, // 0x0200 | 0x0400 - ACT_DECIDE = 0x0001 // what is it? + ACT_PASSIVE = 0x01, // 0x01 - passive + ACT_DISABLED = 0x81, // 0x80 - castable + ACT_ENABLED = 0xC1, // 0x40 | 0x80 - auto cast + castable + ACT_COMMAND = 0x07, // 0x01 | 0x02 | 0x04 + ACT_REACTION = 0x06, // 0x02 | 0x04 + ACT_DECIDE = 0x00 // custom }; enum ReactStates @@ -741,25 +741,43 @@ enum CommandStates COMMAND_ABANDON = 3 }; +#define UNIT_ACTION_BUTTON_ACTION(X) (uint32(X) & 0x00FFFFFF) +#define UNIT_ACTION_BUTTON_TYPE(X) ((uint32(X) & 0xFF000000) >> 24) +#define MAX_UNIT_ACTION_BUTTON_ACTION_VALUE (0x00FFFFFF+1) +#define MAKE_UNIT_ACTION_BUTTON(A,T) (uint32(A) | (uint32(T) << 24)) + struct UnitActionBarEntry { - UnitActionBarEntry() : SpellOrAction(0), Type(ACT_DISABLED) {} + UnitActionBarEntry() : packedData(uint32(ACT_DISABLED) << 24) {} - uint16 SpellOrAction; - uint16 Type; + uint32 packedData; // helper + ActiveStates GetType() const { return ActiveStates(UNIT_ACTION_BUTTON_TYPE(packedData)); } + uint32 GetAction() const { return UNIT_ACTION_BUTTON_ACTION(packedData); } bool IsActionBarForSpell() const { + ActiveStates Type = GetType(); return Type == ACT_DISABLED || Type == ACT_ENABLED || Type == ACT_PASSIVE; } + + void SetActionAndType(uint32 action, ActiveStates type) + { + packedData = MAKE_UNIT_ACTION_BUTTON(action,type); + } + + void SetType(ActiveStates type) + { + packedData = MAKE_UNIT_ACTION_BUTTON(UNIT_ACTION_BUTTON_ACTION(packedData),type); + } + + void SetAction(uint32 action) + { + packedData = (packedData & 0xFF000000) | UNIT_ACTION_BUTTON_ACTION(action); + } }; -struct CharmSpellEntry -{ - uint16 spellId; - uint16 active; -}; +typedef UnitActionBarEntry CharmSpellEntry; enum ActionBarIndex { @@ -798,8 +816,7 @@ struct CharmInfo void SetSpellAutocast(uint32 spell_id, bool state); void SetActionBar(uint8 index, uint32 spellOrAction,ActiveStates type) { - PetActionBar[index].Type = type; - PetActionBar[index].SpellOrAction = spellOrAction; + PetActionBar[index].SetActionAndType(spellOrAction,type); } UnitActionBarEntry const* GetActionBarEntry(uint8 index) const { return &(PetActionBar[index]); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 10f38a9ad..4766153ff 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8097" + #define REVISION_NR "8098" #endif // __REVISION_NR_H__ From 008240678b9d8adee5bbb210f5841adaf1fc230d Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Tue, 30 Jun 2009 12:25:34 +0400 Subject: [PATCH 031/132] [8099] Small not detected uint16 cases for spell ids. --- src/game/SpellMgr.cpp | 4 ++-- src/shared/revision_nr.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 17cc4694e..1de3ec546 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -720,7 +720,7 @@ void SpellMgr::LoadSpellAffects() bar.step(); - uint16 entry = fields[0].GetUInt16(); + uint32 entry = fields[0].GetUInt32(); uint8 effectId = fields[1].GetUInt8(); SpellEntry const* spellInfo = sSpellStore.LookupEntry(entry); @@ -1039,7 +1039,7 @@ void SpellMgr::LoadSpellElixirs() bar.step(); - uint16 entry = fields[0].GetUInt16(); + uint32 entry = fields[0].GetUInt32(); uint8 mask = fields[1].GetUInt8(); SpellEntry const* spellInfo = sSpellStore.LookupEntry(entry); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 4766153ff..0bac1055c 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8098" + #define REVISION_NR "8099" #endif // __REVISION_NR_H__ From a7cbc7d8ec24e46fe77bcfdf243a01b27d3792dd Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Wed, 1 Jul 2009 01:12:33 +0400 Subject: [PATCH 032/132] [8100] Include known MaNGOS EULA. --- EULA | 9 +++++++++ src/shared/revision_nr.h | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 EULA diff --git a/EULA b/EULA new file mode 100644 index 000000000..719f9fdbe --- /dev/null +++ b/EULA @@ -0,0 +1,9 @@ +MaNGOS End-User License Agreement + +MaNGOS has been built with education as the main target, thus you may only use +the source code and binary releases provided by the project for educational +purposes. You are not allowed to use MaNGOS for any commercial purpose, and you +are not allowed to use MaNGOS for hosting MaNGOS servers for public usage. + +By translating the supplied source code into binary form and running the final +executable you agree with MaNGOS EULA. diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 0bac1055c..c9b62f044 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8099" + #define REVISION_NR "8100" #endif // __REVISION_NR_H__ From 91f26272eccf97a4108a1831261ce80b5c726fb5 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Wed, 1 Jul 2009 06:40:43 +0400 Subject: [PATCH 033/132] [8101] Prevent use talents as quest rewards or spell_learn_spell learned spells. --- src/game/ObjectMgr.cpp | 22 ++++++++++++++++++---- src/game/SpellMgr.cpp | 8 +++++++- src/shared/revision_nr.h | 2 +- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index a6c479598..8999c1fb8 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -3595,13 +3595,20 @@ void ObjectMgr::LoadQuests() qinfo->RewSpell = 0; // no spell reward will display for this quest } - else if(!SpellMgr::IsSpellValid(spellInfo)) + if(!SpellMgr::IsSpellValid(spellInfo)) { - sLog.outErrorDb("Quest %u has `RewSpell` = %u but spell %u is broken, quest can't be done.", + sLog.outErrorDb("Quest %u has `RewSpell` = %u but spell %u is broken, quest will not have a spell reward.", qinfo->GetQuestId(),qinfo->RewSpell,qinfo->RewSpell); qinfo->RewSpell = 0; // no spell reward will display for this quest } + if(GetTalentSpellCost(qinfo->RewSpell)) + { + sLog.outErrorDb("Quest %u has `RewSpell` = %u but spell %u is talent, quest will not have a spell reward.", + qinfo->GetQuestId(),qinfo->RewSpell,qinfo->RewSpell); + qinfo->RewSpell = 0; // no spell reward will display for this quest + continue; + } } if(qinfo->RewSpellCast) @@ -3615,13 +3622,20 @@ void ObjectMgr::LoadQuests() qinfo->RewSpellCast = 0; // no spell will be casted on player } - else if(!SpellMgr::IsSpellValid(spellInfo)) + if(!SpellMgr::IsSpellValid(spellInfo)) { - sLog.outErrorDb("Quest %u has `RewSpellCast` = %u but spell %u is broken, quest can't be done.", + sLog.outErrorDb("Quest %u has `RewSpellCast` = %u but spell %u is broken, quest will not have a spell reward.", qinfo->GetQuestId(),qinfo->RewSpellCast,qinfo->RewSpellCast); qinfo->RewSpellCast = 0; // no spell will be casted on player } + if(GetTalentSpellCost(qinfo->RewSpellCast)) + { + sLog.outErrorDb("Quest %u has `RewSpell` = %u but spell %u is talent, quest will not have a spell reward.", + qinfo->GetQuestId(),qinfo->RewSpellCast,qinfo->RewSpellCast); + qinfo->RewSpellCast = 0; // no spell will be casted on player + continue; + } } if(qinfo->RewMailTemplateId) diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 1de3ec546..23b2762bc 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -1859,7 +1859,13 @@ void SpellMgr::LoadSpellLearnSpells() if(!sSpellStore.LookupEntry(node.spell)) { - sLog.outErrorDb("Spell %u listed in `spell_learn_spell` does not exist",node.spell); + sLog.outErrorDb("Spell %u listed in `spell_learn_spell` learning not existed spell %u",spell_id,node.spell); + continue; + } + + if(GetTalentSpellCost(node.spell)) + { + sLog.outErrorDb("Spell %u listed in `spell_learn_spell` attempt learning talent spell %u, skipped",spell_id,node.spell); continue; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index c9b62f044..928a6426f 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8100" + #define REVISION_NR "8101" #endif // __REVISION_NR_H__ From a8288b311e2590684c0e546785c1f0ba81893cab Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Wed, 1 Jul 2009 11:05:55 +0400 Subject: [PATCH 034/132] [8102] Simplify code base at new root method WorldObject::CleanupsBeforeDelete * Call it from Map::AddObjectToRemoveList and remove now not needed explcit calls * Create Gameobject version to make GO with owner more safe for remove --- src/game/BattleGround.cpp | 1 - src/game/GameEventMgr.cpp | 3 --- src/game/GameObject.cpp | 13 ++++++++----- src/game/GameObject.h | 1 + src/game/Level2.cpp | 5 ----- src/game/Map.cpp | 3 ++- src/game/Object.cpp | 13 +++++-------- src/game/Object.h | 2 ++ src/game/Pet.cpp | 1 - src/game/Player.cpp | 1 - src/game/PoolHandler.cpp | 3 --- src/game/TemporarySummon.cpp | 1 - src/game/Totem.cpp | 1 - src/game/Vehicle.cpp | 1 - src/shared/revision_nr.h | 2 +- 15 files changed, 19 insertions(+), 32 deletions(-) diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index 6cd190e0f..0ffc65ed6 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -1529,7 +1529,6 @@ bool BattleGround::DelCreature(uint32 type) sLog.outError("Can't find creature guid: %u",GUID_LOPART(m_BgCreatures[type])); return false; } - cr->CleanupsBeforeDelete(); cr->AddObjectToRemoveList(); m_BgCreatures[type] = 0; return true; diff --git a/src/game/GameEventMgr.cpp b/src/game/GameEventMgr.cpp index 3c0847895..b3ebb8935 100644 --- a/src/game/GameEventMgr.cpp +++ b/src/game/GameEventMgr.cpp @@ -599,10 +599,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) objmgr.RemoveCreatureFromGrid(*itr, data); if( Creature* pCreature = ObjectAccessor::Instance().GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_UNIT), (Creature*)NULL) ) - { - pCreature->CleanupsBeforeDelete(); pCreature->AddObjectToRemoveList(); - } } } diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 04b0351d2..493b4eaca 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -59,15 +59,18 @@ GameObject::GameObject() : WorldObject() } GameObject::~GameObject() +{ + CleanupsBeforeDelete(); +} + +void GameObject::CleanupsBeforeDelete() { if(m_uint32Values) // field array can be not exist if GameOBject not loaded { // Possible crash at access to deleted GO in Unit::m_gameobj - uint64 owner_guid = GetOwnerGUID(); - if(owner_guid) + if(uint64 owner_guid = GetOwnerGUID()) { - Unit* owner = ObjectAccessor::GetUnit(*this,owner_guid); - if(owner) + if(Unit* owner = ObjectAccessor::GetUnit(*this,owner_guid)) owner->RemoveGameObject(this,false); else { @@ -78,7 +81,7 @@ GameObject::~GameObject() ownerType = "pet"; sLog.outError("Delete GameObject (GUID: %u Entry: %u SpellId %u LinkedGO %u) that lost references to owner (GUID %u Type '%s') GO list. Crash possible later.", - GetGUIDLow(), GetGOInfo()->id, m_spellId, GetLinkedGameObjectEntry(), GUID_LOPART(owner_guid), ownerType); + GetGUIDLow(), GetGOInfo()->id, m_spellId, GetLinkedGameObjectEntry(), GUID_LOPART(owner_guid), ownerType); } } } diff --git a/src/game/GameObject.h b/src/game/GameObject.h index 569d8059d..a15d4a848 100644 --- a/src/game/GameObject.h +++ b/src/game/GameObject.h @@ -467,6 +467,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject void AddToWorld(); void RemoveFromWorld(); + void CleanupsBeforeDelete(); bool Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state); void Update(uint32 p_time); diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index 7489cc8c5..a22640341 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -1337,7 +1337,6 @@ bool ChatHandler::HandleNpcDeleteCommand(const char* args) // Delete the creature unit->CombatStop(); unit->DeleteFromDB(); - unit->CleanupsBeforeDelete(); unit->AddObjectToRemoveList(); SendSysMessage(LANG_COMMAND_DELCREATMESSAGE); @@ -2783,7 +2782,6 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) { wpCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT)); wpCreature->DeleteFromDB(); - wpCreature->CleanupsBeforeDelete(); wpCreature->AddObjectToRemoveList(); } @@ -2847,7 +2845,6 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) { wpCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT)); wpCreature->DeleteFromDB(); - wpCreature->CleanupsBeforeDelete(); wpCreature->AddObjectToRemoveList(); // re-create Creature* wpCreature2 = new Creature; @@ -3127,7 +3124,6 @@ bool ChatHandler::HandleWpShowCommand(const char* args) else { pCreature->DeleteFromDB(); - pCreature->CleanupsBeforeDelete(); pCreature->AddObjectToRemoveList(); } @@ -3325,7 +3321,6 @@ bool ChatHandler::HandleWpShowCommand(const char* args) else { pCreature->DeleteFromDB(); - pCreature->CleanupsBeforeDelete(); pCreature->AddObjectToRemoveList(); } }while(result->NextRow()); diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 95470f94d..b3c6b542b 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -880,7 +880,6 @@ void Map::MoveAllCreaturesInMoveList() if((sLog.getLogFilter() & LOG_FILTER_CREATURE_MOVES)==0) sLog.outDebug("Creature (GUID: %u Entry: %u ) can't be move to unloaded respawn grid.",c->GetGUIDLow(),c->GetEntry()); #endif - c->CleanupsBeforeDelete(); AddObjectToRemoveList(c); } } @@ -2048,6 +2047,8 @@ void Map::AddObjectToRemoveList(WorldObject *obj) { assert(obj->GetMapId()==GetId() && obj->GetInstanceId()==GetInstanceId()); + obj->CleanupsBeforeDelete(); // remove or simplify at least cross referenced links + i_objectsToRemove.insert(obj); //sLog.outDebug("Object (GUID: %u TypeId: %u ) added to removing list.",obj->GetGUIDLow(),obj->GetTypeId()); } diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 560d607c0..fc7826a51 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1053,6 +1053,10 @@ WorldObject::WorldObject() { } +void WorldObject::CleanupsBeforeDelete() +{ +} + void WorldObject::_Create( uint32 guidlow, HighGuid guidhigh, uint32 mapid, uint32 phaseMask ) { Object::_Create(guidlow, 0, guidhigh); @@ -1546,14 +1550,7 @@ Map const* WorldObject::GetBaseMap() const void WorldObject::AddObjectToRemoveList() { - Map* map = GetMap(); - if(!map) - { - sLog.outError("Object (TypeId: %u Entry: %u GUID: %u) at attempt add to move list not have valid map (Id: %u).",GetTypeId(),GetEntry(),GetGUIDLow(),GetMapId()); - return; - } - - map->AddObjectToRemoveList(this); + GetMap()->AddObjectToRemoveList(this); } Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, float ang,TempSummonType spwtype,uint32 despwtime) diff --git a/src/game/Object.h b/src/game/Object.h index 9e1cdcdd1..aa53d628c 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -447,6 +447,8 @@ class MANGOS_DLL_SPEC WorldObject : public Object float GetAngle( const float x, const float y ) const; bool HasInArc( const float arcangle, const WorldObject* obj ) const; + virtual void CleanupsBeforeDelete(); // used in destructor or explicitly before mass creature delete to remove cross-references to already deleted units + virtual void SendMessageToSet(WorldPacket *data, bool self); virtual void SendMessageToSetInRange(WorldPacket *data, float dist, bool self); diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 5acb7069d..347d5ee5c 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -680,7 +680,6 @@ void Pet::Remove(PetSaveMode mode, bool returnreagent) owner->SetPet(0); } - CleanupsBeforeDelete(); AddObjectToRemoveList(); m_removed = true; } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 8acf126aa..967bc8275 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -16259,7 +16259,6 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent) pet->SavePetToDB(mode); - pet->CleanupsBeforeDelete(); pet->AddObjectToRemoveList(); pet->m_removed = true; diff --git a/src/game/PoolHandler.cpp b/src/game/PoolHandler.cpp index 09a1d4293..dd0834b80 100644 --- a/src/game/PoolHandler.cpp +++ b/src/game/PoolHandler.cpp @@ -127,10 +127,7 @@ void PoolGroup::Despawn1Object(uint32 guid) objmgr.RemoveCreatureFromGrid(guid, data); if (Creature* pCreature = ObjectAccessor::Instance().GetObjectInWorld(MAKE_NEW_GUID(guid, data->id, HIGHGUID_UNIT), (Creature*)NULL)) - { - pCreature->CleanupsBeforeDelete(); pCreature->AddObjectToRemoveList(); - } } } diff --git a/src/game/TemporarySummon.cpp b/src/game/TemporarySummon.cpp index 293ac9d5c..1ba714d63 100644 --- a/src/game/TemporarySummon.cpp +++ b/src/game/TemporarySummon.cpp @@ -165,7 +165,6 @@ void TemporarySummon::UnSummon() { CombatStop(); - CleanupsBeforeDelete(); AddObjectToRemoveList(); Unit* sum = m_summoner ? ObjectAccessor::GetUnit(*this, m_summoner) : NULL; diff --git a/src/game/Totem.cpp b/src/game/Totem.cpp index 98a5b7e12..6ba0e405e 100644 --- a/src/game/Totem.cpp +++ b/src/game/Totem.cpp @@ -122,7 +122,6 @@ void Totem::UnSummon() } } - CleanupsBeforeDelete(); AddObjectToRemoveList(); } diff --git a/src/game/Vehicle.cpp b/src/game/Vehicle.cpp index de587fcbe..c6c6f9279 100644 --- a/src/game/Vehicle.cpp +++ b/src/game/Vehicle.cpp @@ -92,6 +92,5 @@ void Vehicle::Dismiss() { SendObjectDeSpawnAnim(GetGUID()); CombatStop(); - CleanupsBeforeDelete(); AddObjectToRemoveList(); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 928a6426f..d7e5066f2 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8101" + #define REVISION_NR "8102" #endif // __REVISION_NR_H__ From 2baccbebc312c5370bbf39f35380631743fff845 Mon Sep 17 00:00:00 2001 From: Ambal Date: Wed, 1 Jul 2009 12:04:58 +0400 Subject: [PATCH 035/132] [8103] More wide use IsInWorld checks and delayed at teleport operations. * IsInWorld used to prevent return unexpected not in world objects. * Delayed operations need to process its in world state. Signed-off-by: VladimirMangos --- src/game/AccountMgr.cpp | 2 +- src/game/AchievementMgr.cpp | 5 +- src/game/GameObject.cpp | 8 +- src/game/Group.cpp | 2 +- src/game/LFGHandler.cpp | 10 +++ src/game/MiscHandler.cpp | 4 + src/game/MovementHandler.cpp | 10 ++- src/game/NPCHandler.cpp | 4 +- src/game/ObjectAccessor.cpp | 10 ++- src/game/ObjectAccessor.h | 10 ++- src/game/ObjectGridLoader.cpp | 23 +----- src/game/PetHandler.cpp | 3 + src/game/Player.cpp | 133 +++++++++++++++++++++++++++++++++- src/game/Player.h | 21 ++++++ src/game/Unit.cpp | 7 +- src/game/WorldSession.cpp | 6 ++ src/shared/revision_nr.h | 2 +- 17 files changed, 220 insertions(+), 40 deletions(-) diff --git a/src/game/AccountMgr.cpp b/src/game/AccountMgr.cpp index a10b0575f..b3ed91c7e 100644 --- a/src/game/AccountMgr.cpp +++ b/src/game/AccountMgr.cpp @@ -75,7 +75,7 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accid) uint64 guid = MAKE_NEW_GUID(guidlo, 0, HIGHGUID_PLAYER); // kick if player currently - if(Player* p = ObjectAccessor::FindPlayer(guid)) + if(Player* p = ObjectAccessor::GetObjectInWorld(guid, (Player*)NULL)) { WorldSession* s = p->GetSession(); s->KickPlayer(); // mark session to remove at next session list update diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp index cc8e8e6bc..258a3c71e 100644 --- a/src/game/AchievementMgr.cpp +++ b/src/game/AchievementMgr.cpp @@ -32,6 +32,7 @@ #include "GridNotifiersImpl.h" #include "CellImpl.h" #include "Language.h" +#include "MapManager.h" #include "Policies/SingletonImp.h" @@ -825,8 +826,8 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui if(!miscvalue1) continue; - Map const* map = GetPlayer()->GetMap(); - if(!map->IsDungeon()) + Map const* map = GetPlayer()->IsInWorld() ? GetPlayer()->GetMap() : MapManager::Instance().FindMap(GetPlayer()->GetMapId(), GetPlayer()->GetInstanceId()); + if(!map || !map->IsDungeon()) continue; // search case diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 493b4eaca..cda2b5f3f 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -70,7 +70,13 @@ void GameObject::CleanupsBeforeDelete() // Possible crash at access to deleted GO in Unit::m_gameobj if(uint64 owner_guid = GetOwnerGUID()) { - if(Unit* owner = ObjectAccessor::GetUnit(*this,owner_guid)) + Unit* owner = NULL; + if(IS_PLAYER_GUID(owner_guid)) + owner = ObjectAccessor::GetObjectInWorld(owner_guid, (Player*)NULL); + else + owner = ObjectAccessor::GetUnit(*this,owner_guid); + + if(owner) owner->RemoveGameObject(this,false); else { diff --git a/src/game/Group.cpp b/src/game/Group.cpp index 3ea0a204e..c67d874e0 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -970,7 +970,7 @@ void Group::SendUpdate() void Group::UpdatePlayerOutOfRange(Player* pPlayer) { - if(!pPlayer) + if(!pPlayer || !pPlayer->IsInWorld()) return; Player *player; diff --git a/src/game/LFGHandler.cpp b/src/game/LFGHandler.cpp index 17792dba5..5175fa4a3 100644 --- a/src/game/LFGHandler.cpp +++ b/src/game/LFGHandler.cpp @@ -40,6 +40,10 @@ static void AttemptJoin(Player* _player) if(!plr || plr==_player || plr->GetTeam() != _player->GetTeam()) continue; + //skip players not in world + if(!plr->IsInWorld()) + continue; + // skip not auto add, not group leader cases if(!plr->GetSession()->LookingForGroup_auto_add || plr->GetGroup() && plr->GetGroup()->GetLeaderGUID()!=plr->GetGUID()) continue; @@ -96,6 +100,9 @@ static void AttemptAddMore(Player* _player) if(!plr || plr==_player || plr->GetTeam() != _player->GetTeam()) continue; + if(!plr->IsInWorld()) + continue; + // skip not auto join or in group if(!plr->GetSession()->LookingForGroup_auto_join || plr->GetGroup() ) continue; @@ -309,6 +316,9 @@ void WorldSession::SendLfgResult(uint32 type, uint32 entry, uint8 lfg_type) if(!plr || plr->GetTeam() != _player->GetTeam()) continue; + if(!plr->IsInWorld()) + continue; + if(!plr->m_lookingForGroup.HaveInSlot(entry, type)) continue; diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index c13029b88..fbbd364aa 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -170,6 +170,10 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data ) continue; } + //do not process players which are not in world + if(!(itr->second->IsInWorld())) + continue; + // check if target is globally visible for player if (!(itr->second->IsVisibleGloballyFor(_player))) continue; diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index 99d85a988..3cbbe0e78 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -154,6 +154,9 @@ void WorldSession::HandleMoveWorldportAckOpcode() // resummon pet GetPlayer()->ResummonPetTemporaryUnSummonedIfAny(); + + //lets process all delayed operations on successful teleport + GetPlayer()->ProcessDelayedOperations(); } void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data) @@ -200,6 +203,9 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data) // resummon pet GetPlayer()->ResummonPetTemporaryUnSummonedIfAny(); + + //lets process all delayed operations on successful teleport + GetPlayer()->ProcessDelayedOperations(); } void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data ) @@ -329,8 +335,8 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data ) } else // creature charmed { - if(Map *map = mover->GetMap()) - map->CreatureRelocation((Creature*)mover, movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o); + if(mover->IsInWorld()) + mover->GetMap()->CreatureRelocation((Creature*)mover, movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o); } } diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp index f36fa96b9..e5fb150bd 100644 --- a/src/game/NPCHandler.cpp +++ b/src/game/NPCHandler.cpp @@ -415,7 +415,7 @@ void WorldSession::HandleBinderActivateOpcode( WorldPacket & recv_data ) uint64 npcGUID; recv_data >> npcGUID; - if(!GetPlayer()->isAlive()) + if(!GetPlayer()->IsInWorld() || !GetPlayer()->isAlive()) return; Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID,UNIT_NPC_FLAG_INNKEEPER); @@ -435,7 +435,7 @@ void WorldSession::HandleBinderActivateOpcode( WorldPacket & recv_data ) void WorldSession::SendBindPoint(Creature *npc) { // prevent set homebind to instances in any case - if(sMapStore.LookupEntry(GetPlayer()->GetMapId())->Instanceable()) + if(GetPlayer()->GetMap()->Instanceable()) return; uint32 bindspell = 3286; diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp index 43c38dde0..43eb02a8a 100644 --- a/src/game/ObjectAccessor.cpp +++ b/src/game/ObjectAccessor.cpp @@ -58,7 +58,7 @@ ObjectAccessor::GetCreatureOrPetOrVehicle(WorldObject const &u, uint64 guid) if(IS_VEHICLE_GUID(guid)) return GetVehicle(guid); - return u.GetMap()->GetCreature(guid); + return u.IsInWorld() ? u.GetMap()->GetCreature(guid) : NULL; } Unit* @@ -131,7 +131,11 @@ Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const &p, uint64 guid, u Player* ObjectAccessor::FindPlayer(uint64 guid) { - return GetObjectInWorld(guid, (Player*)NULL); + Player * plr = GetObjectInWorld(guid, (Player*)NULL); + if(!plr || !plr->IsInWorld()) + return NULL; + + return plr; } Player* @@ -141,7 +145,7 @@ ObjectAccessor::FindPlayerByName(const char *name) HashMapHolder::MapType& m = HashMapHolder::GetContainer(); HashMapHolder::MapType::iterator iter = m.begin(); for(; iter != m.end(); ++iter) - if( ::strcmp(name, iter->second->GetName()) == 0 ) + if(iter->second->IsInWorld() && ( ::strcmp(name, iter->second->GetName()) == 0 )) return iter->second; return NULL; } diff --git a/src/game/ObjectAccessor.h b/src/game/ObjectAccessor.h index c2a37be05..6ed1b26cf 100644 --- a/src/game/ObjectAccessor.h +++ b/src/game/ObjectAccessor.h @@ -102,10 +102,16 @@ class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::Singleton::Find(guid); + { + Unit * u = (Unit*)HashMapHolder::Find(guid); + if(!u || !u->IsInWorld()) + return NULL; - if (Unit* u = (Unit*)HashMapHolder::Find(guid)) return u; + } + + if (IS_PET_GUID(guid)) + return (Unit*)HashMapHolder::Find(guid); return (Unit*)HashMapHolder::Find(guid); } diff --git a/src/game/ObjectGridLoader.cpp b/src/game/ObjectGridLoader.cpp index de73ee183..a3e5145f0 100644 --- a/src/game/ObjectGridLoader.cpp +++ b/src/game/ObjectGridLoader.cpp @@ -254,6 +254,10 @@ template void ObjectGridUnloader::Visit(GridRefManager &m) { + // remove all cross-reference before deleting + for(GridRefManager::iterator iter=m.begin(); iter != m.end(); ++iter) + iter->getSource()->CleanupsBeforeDelete(); + while(!m.isEmpty()) { T *obj = m.getFirst()->getSource(); @@ -267,25 +271,6 @@ ObjectGridUnloader::Visit(GridRefManager &m) } } -template<> -void -ObjectGridUnloader::Visit(CreatureMapType &m) -{ - // remove all cross-reference before deleting - for(CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter) - iter->getSource()->CleanupsBeforeDelete(); - - while(!m.isEmpty()) - { - Creature *obj = m.getFirst()->getSource(); - // if option set then object already saved at this moment - if(!sWorld.getConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATLY)) - obj->SaveRespawnTime(); - ///- object will get delinked from the manager when deleted - delete obj; - } -} - void ObjectGridStoper::Stop(GridType &grid) { diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp index 441e40072..a9f464b40 100644 --- a/src/game/PetHandler.cpp +++ b/src/game/PetHandler.cpp @@ -463,6 +463,9 @@ void WorldSession::HandlePetAbandon( WorldPacket & recv_data ) recv_data >> guid; //pet guid sLog.outDetail( "HandlePetAbandon. CMSG_PET_ABANDON pet guid is %u", GUID_LOPART(guid) ); + if(!_player->IsInWorld()) + return; + // pet/charmed Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid); if(pet) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 967bc8275..5fd6e2ecf 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -338,6 +338,11 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa mSemaphoreTeleport_Near = false; mSemaphoreTeleport_Far = false; + m_DelayedOperations = 0; + m_bCanDelayTeleport = false; + m_bHasDelayedTeleport = false; + m_teleport_options = 0; + pTrader = 0; ClearTrade(); @@ -1065,7 +1070,10 @@ void Player::Update( uint32 p_time ) m_nextMailDelivereTime = 0; } + //used to implement delayed far teleports + SetCanDelayTeleport(true); Unit::Update( p_time ); + SetCanDelayTeleport(false); // update player only attacks if(uint32 ranged_att = getAttackTimer(RANGED_ATTACK)) @@ -1327,8 +1335,12 @@ void Player::Update( uint32 p_time ) if(pet && !IsWithinDistInMap(pet, OWNER_MAX_DISTANCE) && (GetCharmGUID() && (pet->GetGUID() != GetCharmGUID()))) { RemovePet(pet, PET_SAVE_NOT_IN_SLOT, true); - return; } + + //we should execute delayed teleports only for alive(!) players + //because we don't want player's ghost teleported from graveyard + if(IsHasDelayedTeleport() && isAlive()) + TeleportTo(m_teleport_dest, m_teleport_options); } void Player::setDeathState(DeathState s) @@ -1613,6 +1625,21 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati if ((GetMapId() == mapid) && (!m_transport)) { + //lets reset far teleport flag if it wasn't reset during chained teleports + SetSemaphoreTeleportFar(false); + //setup delayed teleport flag + SetDelayedTeleportFlag(IsCanDelayTeleport()); + //if teleport spell is casted in Unit::Update() func + //then we need to delay it until update process will be finished + if(IsHasDelayedTeleport()) + { + SetSemaphoreTeleportNear(true); + //lets save teleport destination for player + m_teleport_dest = WorldLocation(mapid, x, y, z, orientation); + m_teleport_options = options; + return true; + } + if (!(options & TELE_TO_NOT_UNSUMMON_PET)) { //same map, only remove pet if out of range for new position @@ -1654,6 +1681,21 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati Map *map = MapManager::Instance().FindMap(mapid); if (!map || map->CanEnter(this)) { + //lets reset near teleport flag if it wasn't reset during chained teleports + SetSemaphoreTeleportNear(false); + //setup delayed teleport flag + SetDelayedTeleportFlag(IsCanDelayTeleport()); + //if teleport spell is casted in Unit::Update() func + //then we need to delay it until update process will be finished + if(IsHasDelayedTeleport()) + { + SetSemaphoreTeleportFar(true); + //lets save teleport destination for player + m_teleport_dest = WorldLocation(mapid, x, y, z, orientation); + m_teleport_options = options; + return true; + } + SetSelection(0); CombatStop(); @@ -1683,6 +1725,9 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati if(IsNonMeleeSpellCasted(true)) InterruptNonMeleeSpells(true); + //remove auras before removing from map... + RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CHANGE_MAP | AURA_INTERRUPT_FLAG_MOVE | AURA_INTERRUPT_FLAG_TURNING); + if(!GetSession()->PlayerLogout()) { // send transfer packets @@ -1729,8 +1774,6 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati // if the player is saved before worldportack (at logout for example) // this will be used instead of the current location in SaveToDB - RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CHANGE_MAP | AURA_INTERRUPT_FLAG_MOVE | AURA_INTERRUPT_FLAG_TURNING); - // move packet sent by client always after far teleport // code for finish transfer to new map called in WorldSession::HandleMoveWorldportAckOpcode at client packet SetSemaphoreTeleportFar(true); @@ -1741,6 +1784,53 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati return true; } +void Player::ProcessDelayedOperations() +{ + if(m_DelayedOperations == 0) + return; + + if(m_DelayedOperations & DELAYED_RESURRECT_PLAYER) + { + ResurrectPlayer(0.0f, false); + + if(GetMaxHealth() > m_resurrectHealth) + SetHealth( m_resurrectHealth ); + else + SetHealth( GetMaxHealth() ); + + if(GetMaxPower(POWER_MANA) > m_resurrectMana) + SetPower(POWER_MANA, m_resurrectMana ); + else + SetPower(POWER_MANA, GetMaxPower(POWER_MANA) ); + + SetPower(POWER_RAGE, 0 ); + SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY) ); + + SpawnCorpseBones(); + } + + if(m_DelayedOperations & DELAYED_SAVE_PLAYER) + { + SaveToDB(); + } + + if(m_DelayedOperations & DELAYED_SPELL_CAST_DESERTER) + { + CastSpell(this, 26013, true); // Deserter + } + + //we have executed ALL delayed ops, so clear the flag + m_DelayedOperations = 0; +} + +void Player::ScheduleDelayedOperation(uint32 operation) +{ + if(operation >= DELAYED_END) + return; + + m_DelayedOperations |= operation; +} + void Player::AddToWorld() { ///- Do not add/remove the player from the object storage @@ -12083,7 +12173,11 @@ Quest const * Player::GetNextQuest( uint64 guid, Quest const *pQuest ) } else { - GameObject *pGameObject = GetMap()->GetGameObject(guid); + //we should obtain map pointer from GetMap() in 99% of cases. Special case + //only for quests which cast teleport spells on player + Map * _map = IsInWorld() ? GetMap() : MapManager::Instance().FindMap(GetMapId(), GetInstanceId()); + ASSERT(_map); + GameObject *pGameObject = _map->GetGameObject(guid); if( pGameObject ) { pObject = (Object*)pGameObject; @@ -12417,6 +12511,10 @@ void Player::IncompleteQuest( uint32 quest_id ) void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver, bool announce ) { + //this THING should be here to protect code from quest, which cast on player far teleport as a reward + //should work fine, cause far teleport will be executed in Player::Update() + SetCanDelayTeleport(true); + uint32 quest_id = pQuest->GetQuestId(); for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i ) @@ -12609,6 +12707,9 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver if( !HasAura(itr->second->spellId,0) ) CastSpell(this,itr->second->spellId,true); } + + //lets remove flag for delayed teleports + SetCanDelayTeleport(false); } void Player::FailQuest( uint32 quest_id ) @@ -15379,6 +15480,13 @@ void Player::SaveToDB() // delay auto save at any saves (manual, in code, or autosave) m_nextSave = sWorld.getConfig(CONFIG_INTERVAL_SAVE); + //lets allow only players in world to be saved + if(IsBeingTeleportedFar()) + { + ScheduleDelayedOperation(DELAYED_SAVE_PLAYER); + return; + } + // first save/honor gain after midnight will also update the player's honor fields UpdateHonorFields(); @@ -17653,7 +17761,16 @@ void Player::LeaveBattleground(bool teleportToEntryPoint) if( bg->isBattleGround() && !isGameMaster() && sWorld.getConfig(CONFIG_BATTLEGROUND_CAST_DESERTER) ) { if( bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN ) + { + //lets check if player was teleported from BG and schedule delayed Deserter spell cast + if(IsBeingTeleportedFar()) + { + ScheduleDelayedOperation(DELAYED_SPELL_CAST_DESERTER); + return; + } + CastSpell(this, 26013, true); // Deserter + } } } } @@ -18880,6 +18997,14 @@ void Player::ResurectUsingRequestData() if(IS_PLAYER_GUID(m_resurrectGUID)) TeleportTo(m_resurrectMap, m_resurrectX, m_resurrectY, m_resurrectZ, GetOrientation()); + //we cannot resurrect player when we triggered far teleport + //player will be resurrected upon teleportation + if(IsBeingTeleportedFar()) + { + ScheduleDelayedOperation(DELAYED_RESURRECT_PLAYER); + return; + } + ResurrectPlayer(0.0f,false); if(GetMaxHealth() > m_resurrectHealth) diff --git a/src/game/Player.h b/src/game/Player.h index 05a214777..07b3af604 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -858,6 +858,14 @@ enum PlayerLoginQueryIndex MAX_PLAYER_LOGIN_QUERY = 21 }; +enum PlayerDelayedOperations +{ + DELAYED_SAVE_PLAYER = 1, + DELAYED_RESURRECT_PLAYER = 2, + DELAYED_SPELL_CAST_DESERTER = 4, + DELAYED_END +}; + // Player summoning auto-decline time (in secs) #define MAX_PLAYER_SUMMON_DELAY (2*MINUTE) #define MAX_MONEY_AMOUNT (0x7FFFFFFF-1) @@ -1761,6 +1769,7 @@ class MANGOS_DLL_SPEC Player : public Unit bool IsBeingTeleportedFar() const { return mSemaphoreTeleport_Far; } void SetSemaphoreTeleportNear(bool semphsetting) { mSemaphoreTeleport_Near = semphsetting; } void SetSemaphoreTeleportFar(bool semphsetting) { mSemaphoreTeleport_Far = semphsetting; } + void ProcessDelayedOperations(); void CheckExploreSystem(void); @@ -2402,6 +2411,13 @@ class MANGOS_DLL_SPEC Player : public Unit int32 CalculateReputationGain(uint32 creatureOrQuestLevel, int32 rep, int32 faction, bool for_quest); void AdjustQuestReqItemCount( Quest const* pQuest, QuestStatusData& questStatusData ); + bool IsCanDelayTeleport() const { return m_bCanDelayTeleport; } + void SetCanDelayTeleport(bool setting) { m_bCanDelayTeleport = setting; } + bool IsHasDelayedTeleport() const { return m_bHasDelayedTeleport; } + void SetDelayedTeleportFlag(bool setting) { m_bHasDelayedTeleport = setting; } + + void ScheduleDelayedOperation(uint32 operation); + GridReference m_gridRef; MapReference m_mapRef; @@ -2415,9 +2431,14 @@ class MANGOS_DLL_SPEC Player : public Unit // Current teleport data WorldLocation m_teleport_dest; + uint32 m_teleport_options; bool mSemaphoreTeleport_Near; bool mSemaphoreTeleport_Far; + uint32 m_DelayedOperations; + bool m_bCanDelayTeleport; + bool m_bHasDelayedTeleport; + // Temporary removed pet cache uint32 m_temporaryUnsummonedPetNumber; uint32 m_oldpetspell; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index fb91db413..7bd089463 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -176,6 +176,9 @@ Unit::~Unit() void Unit::Update( uint32 p_time ) { + if(!IsInWorld()) + return; + /*if(p_time > m_AurasCheck) { m_AurasCheck = 2000; @@ -7248,7 +7251,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack) return false; // dead units can neither attack nor be attacked - if(!isAlive() || !victim->isAlive()) + if(!isAlive() || !victim->IsInWorld() || !victim->isAlive()) return false; // player cannot attack in mount state @@ -8906,7 +8909,7 @@ bool Unit::isTargetableForAttack() const if(HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE)) return false; - return isAlive() && !hasUnitState(UNIT_STAT_DIED)&& !isInFlight() /*&& !isStealth()*/; + return IsInWorld() && isAlive() && !hasUnitState(UNIT_STAT_DIED)&& !isInFlight() /*&& !isStealth()*/; } int32 Unit::ModifyHealth(int32 dVal) diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index f0d11f587..89f6bb895 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -307,7 +307,13 @@ void WorldSession::LogoutPlayer(bool Save) ///- Teleport to home if the player is in an invalid instance if(!_player->m_InstanceValid && !_player->isGameMaster()) + { _player->TeleportTo(_player->m_homebindMapId, _player->m_homebindX, _player->m_homebindY, _player->m_homebindZ, _player->GetOrientation()); + //this is a bad place to call for far teleport because we need player to be in world for successful logout + //maybe we should implement delayed far teleport logout? + while(_player->IsBeingTeleportedFar()) + HandleMoveWorldportAckOpcode(); + } for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i) { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index d7e5066f2..104d40568 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8102" + #define REVISION_NR "8103" #endif // __REVISION_NR_H__ From 90800416d10273f8927ac7b764e997542ef985f7 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Wed, 1 Jul 2009 14:30:06 +0400 Subject: [PATCH 036/132] [8104] Always (except 2 cases) for tables in characters DB InnoDB and utf8. --- sql/characters.sql | 12 ++++++------ sql/updates/8104_01_characters.sql | 8 ++++++++ sql/updates/Makefile.am | 2 ++ src/shared/revision_nr.h | 2 +- 4 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 sql/updates/8104_01_characters.sql diff --git a/sql/characters.sql b/sql/characters.sql index 8fb7327f2..0858b64cb 100644 --- a/sql/characters.sql +++ b/sql/characters.sql @@ -21,7 +21,7 @@ DROP TABLE IF EXISTS `character_db_version`; CREATE TABLE `character_db_version` ( - `required_8098_04_characters_pet_spell` bit(1) default NULL + `required_8104_01_characters` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB'; -- @@ -264,7 +264,7 @@ CREATE TABLE `character_achievement` ( `achievement` int(11) unsigned NOT NULL, `date` bigint(11) unsigned NOT NULL default '0', PRIMARY KEY (`guid`,`achievement`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `character_achievement` @@ -286,7 +286,7 @@ CREATE TABLE `character_achievement_progress` ( `counter` int(11) unsigned NOT NULL, `date` bigint(11) unsigned NOT NULL default '0', PRIMARY KEY (`guid`,`criteria`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `character_achievement_progress` @@ -359,7 +359,7 @@ CREATE TABLE `character_declinedname` ( `instrumental` varchar(15) NOT NULL default '', `prepositional` varchar(15) NOT NULL default '', PRIMARY KEY (`guid`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -- -- Dumping data for table `character_declinedname` @@ -559,7 +559,7 @@ CREATE TABLE `character_pet_declinedname` ( `prepositional` varchar(12) NOT NULL default '', PRIMARY KEY (`id`), KEY owner_key (`owner`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -- -- Dumping data for table `character_pet_declinedname` @@ -1020,7 +1020,7 @@ CREATE TABLE `guild_eventlog` ( `PlayerGuid2` int(11) NOT NULL COMMENT 'Player 2', `NewRank` tinyint(2) NOT NULL COMMENT 'New rank(in case promotion/demotion)', `TimeStamp` bigint(20) NOT NULL COMMENT 'Event UNIX time' -) ENGINE = InnoDB DEFAULT CHARSET = latin1 COMMENT 'Guild Eventlog'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT 'Guild Eventlog'; -- -- Dumping data for table `guild_eventlog` diff --git a/sql/updates/8104_01_characters.sql b/sql/updates/8104_01_characters.sql new file mode 100644 index 000000000..0575ab82d --- /dev/null +++ b/sql/updates/8104_01_characters.sql @@ -0,0 +1,8 @@ +ALTER TABLE character_db_version CHANGE COLUMN required_8098_04_characters_pet_spell required_8104_01_characters bit; + +ALTER TABLE character_achievement ENGINE=InnoDB DEFAULT CHARSET=utf8; +ALTER TABLE character_achievement_progress ENGINE=InnoDB DEFAULT CHARSET=utf8; +ALTER TABLE character_declinedname ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +ALTER TABLE character_pet_declinedname ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +ALTER TABLE guild_eventlog ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT 'Guild Eventlog'; + diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 48c1adc1f..5969c8cb1 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -239,6 +239,7 @@ pkgdata_DATA = \ 8098_02_mangos_playercreateinfo_action.sql \ 8098_03_characters_character_pet.sql \ 8098_04_characters_pet_spell.sql \ + 8104_01_characters.sql \ README ## Additional files to include when running 'make dist' @@ -458,4 +459,5 @@ EXTRA_DIST = \ 8098_02_mangos_playercreateinfo_action.sql \ 8098_03_characters_character_pet.sql \ 8098_04_characters_pet_spell.sql \ + 8104_01_characters.sql \ README diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 104d40568..379744361 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8103" + #define REVISION_NR "8104" #endif // __REVISION_NR_H__ From ae0cb6913525436cba3fcc954f1744254b456623 Mon Sep 17 00:00:00 2001 From: BonDit Date: Wed, 1 Jul 2009 14:50:21 +0400 Subject: [PATCH 037/132] Fixed instance heroic/raid reset cooldown at switch normal/heroic difficalty. Signed-off-by: VladimirMangos --- src/game/InstanceSaveMgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp index b52f74504..54bd628f0 100644 --- a/src/game/InstanceSaveMgr.cpp +++ b/src/game/InstanceSaveMgr.cpp @@ -128,7 +128,7 @@ void InstanceSaveManager::RemoveInstanceSave(uint32 InstanceId) InstanceSaveHashMap::iterator itr = m_instanceSaveById.find( InstanceId ); if(itr != m_instanceSaveById.end()) { - // save the resettime for normal instances only when they get unloaded + // save the resettime for instances only when they get unloaded if(time_t resettime = itr->second->GetResetTimeForDB()) CharacterDatabase.PExecute("UPDATE instance SET resettime = '"UI64FMTD"' WHERE id = '%u'", (uint64)resettime, InstanceId); delete itr->second; From f08046f4a54204e3ed54bd61df33ed6511022415 Mon Sep 17 00:00:00 2001 From: Ambal Date: Wed, 1 Jul 2009 14:21:54 +0200 Subject: [PATCH 038/132] [8105] Compile fix under Linux/BSD systems. Signed-off-by: ApoC --- src/game/ObjectGridLoader.cpp | 2 +- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/ObjectGridLoader.cpp b/src/game/ObjectGridLoader.cpp index a3e5145f0..77695e758 100644 --- a/src/game/ObjectGridLoader.cpp +++ b/src/game/ObjectGridLoader.cpp @@ -255,7 +255,7 @@ void ObjectGridUnloader::Visit(GridRefManager &m) { // remove all cross-reference before deleting - for(GridRefManager::iterator iter=m.begin(); iter != m.end(); ++iter) + for(typename GridRefManager::iterator iter=m.begin(); iter != m.end(); ++iter) iter->getSource()->CleanupsBeforeDelete(); while(!m.isEmpty()) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 379744361..9e4250f21 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8104" + #define REVISION_NR "8105" #endif // __REVISION_NR_H__ From a75d9893a6e4bd6bde298d5b9fe4b197cdc19b8b Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Thu, 2 Jul 2009 00:00:13 +0400 Subject: [PATCH 039/132] [8106] Revert "Fixed instance heroic/raid reset cooldown at switch normal/heroic difficalty." This reverts commit 655bb6125abcba28318b2074e1624bb4eb21cadd. After discussion with Wyk3d fix considered as wrong way. --- src/game/InstanceSaveMgr.cpp | 2 +- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp index 54bd628f0..b52f74504 100644 --- a/src/game/InstanceSaveMgr.cpp +++ b/src/game/InstanceSaveMgr.cpp @@ -128,7 +128,7 @@ void InstanceSaveManager::RemoveInstanceSave(uint32 InstanceId) InstanceSaveHashMap::iterator itr = m_instanceSaveById.find( InstanceId ); if(itr != m_instanceSaveById.end()) { - // save the resettime for instances only when they get unloaded + // save the resettime for normal instances only when they get unloaded if(time_t resettime = itr->second->GetResetTimeForDB()) CharacterDatabase.PExecute("UPDATE instance SET resettime = '"UI64FMTD"' WHERE id = '%u'", (uint64)resettime, InstanceId); delete itr->second; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 9e4250f21..8d1dc83e8 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8105" + #define REVISION_NR "8106" #endif // __REVISION_NR_H__ From 835a8da42a2d051bb64c4db304ccb26410021652 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Thu, 25 Jun 2009 19:08:53 +0400 Subject: [PATCH 040/132] Added placeholders for new battlegrounds, some other stuff. --- sql/320/5_battleground_tempalate.sql | 2 ++ src/game/Player.cpp | 1 + 2 files changed, 3 insertions(+) create mode 100644 sql/320/5_battleground_tempalate.sql diff --git a/sql/320/5_battleground_tempalate.sql b/sql/320/5_battleground_tempalate.sql new file mode 100644 index 000000000..699a0158d --- /dev/null +++ b/sql/320/5_battleground_tempalate.sql @@ -0,0 +1,2 @@ +insert into `battleground_template`(`id`,`MinPlayersPerTeam`,`MaxPlayersPerTeam`,`MinLvl`,`MaxLvl`,`AllianceStartLoc`,`AllianceStartO`,`HordeStartLoc`,`HordeStartO`) values (30,20,40,71,80,1485,0,1486,0); +insert into `battleground_template`(`id`,`MinPlayersPerTeam`,`MaxPlayersPerTeam`,`MinLvl`,`MaxLvl`,`AllianceStartLoc`,`AllianceStartO`,`HordeStartLoc`,`HordeStartO`) values (32,0,40,0,80,0,0,0,0); diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 5fd6e2ecf..cb75e4b89 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -20469,6 +20469,7 @@ bool Player::HasMovementFlag( MovementFlags f ) const { return m_movementInfo.HasMovementFlag(f); } + void Player::SendDuelCountdown(uint32 counter) { WorldPacket data(SMSG_DUEL_COUNTDOWN, 4); From 41b400dac902a291d2b86f5f2916b96ac08a1641 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Thu, 2 Jul 2009 09:02:00 +0400 Subject: [PATCH 041/132] Fix --- src/game/DBCStructure.h | 34 ++++++++++++++++++++++------------ src/game/DBCfmt.h | 2 +- src/game/Object.cpp | 37 ++++++++++++++++++++++--------------- src/game/Object.h | 2 +- src/game/Opcodes.cpp | 2 +- src/game/Opcodes.h | 4 ++-- src/game/Player.cpp | 39 +++++++++++++++++++++++---------------- src/game/Player.h | 19 ++++++++++--------- src/game/SpellEffects.cpp | 21 ++++----------------- src/game/Totem.cpp | 33 +++++++++++++++------------------ src/game/Unit.cpp | 4 ++-- 11 files changed, 103 insertions(+), 94 deletions(-) diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index 540bd37b0..a2f2174e7 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -638,18 +638,18 @@ struct ChrRacesEntry // 3 unused uint32 model_m; // 4 uint32 model_f; // 5 - // 6-7 unused - uint32 TeamID; // 8 (7-Alliance 1-Horde) - // 9-12 unused - uint32 CinematicSequence; // 13 id from CinematicSequences.dbc - char* name[16]; // 14-29 used for DBC language detection/selection - // 30 string flags, unused - //char* nameFemale[16]; // 31-46, if different from base (male) case - // 47 string flags, unused - //char* nameNeutralGender[16]; // 48-63, if different from base (male) case - // 64 string flags, unused - // 65-67 unused - uint32 addon; // 68 (0 - original race, 1 - tbc addon, ...) + // 6 unused + uint32 TeamID; // 7 (7-Alliance 1-Horde) + // 8-11 unused + uint32 CinematicSequence; // 12 id from CinematicSequences.dbc + char* name[16]; // 13-28 used for DBC language detection/selection + // 29 string flags, unused + //char* nameFemale[16]; // 30-45, if different from base (male) case + // 46 string flags, unused + //char* nameNeutralGender[16]; // 47-62, if different from base (male) case + // 63 string flags, unused + // 64-66 unused + uint32 addon; // 67 (0 - original race, 1 - tbc addon, ...) }; /* not used @@ -1118,6 +1118,16 @@ struct MapEntry } }; +struct MapDifficultyEntry +{ + uint32 Id; // 0 + uint32 MapId; // 1 + uint32 Difficulty; // 2 + char* transferFailedText[16]; // 3-18 + uint32 textFlags; // 19 + uint32 resetTime; // 20 +}; + struct MovieEntry { uint32 Id; // 0 index diff --git a/src/game/DBCfmt.h b/src/game/DBCfmt.h index 3e7ae5442..f3a5b524c 100644 --- a/src/game/DBCfmt.h +++ b/src/game/DBCfmt.h @@ -33,7 +33,7 @@ const char CharTitlesEntryfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi"; const char ChatChannelsEntryfmt[]="iixssssssssssssssssxxxxxxxxxxxxxxxxxx"; // ChatChannelsEntryfmt, index not used (more compact store) const char ChrClassesEntryfmt[]="nxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixii"; -const char ChrRacesEntryfmt[]="nxixiixxixxxxissssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi"; +const char ChrRacesEntryfmt[]="nxixiixixxxxissssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi"; const char CinematicSequencesEntryfmt[]="nxxxxxxxxx"; const char CreatureDisplayInfofmt[]="nxxxfxxxxxxxxxxx"; const char CreatureFamilyfmt[]="nfifiiiiixssssssssssssssssxx"; diff --git a/src/game/Object.cpp b/src/game/Object.cpp index fc7826a51..6ba4a8d36 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -240,13 +240,13 @@ void Object::BuildOutOfRangeUpdateBlock(UpdateData * data) const data->AddOutOfRangeGUID(GetGUID()); } -void Object::DestroyForPlayer(Player *target) const +void Object::DestroyForPlayer( Player *target, bool anim ) const { ASSERT(target); WorldPacket data(SMSG_DESTROY_OBJECT, 8); data << uint64(GetGUID()); - data << uint8(0); // WotLK (bool) + data << uint8(anim ? 1 : 0); // WotLK (bool), may be despawn animation target->GetSession()->SendPacket( &data ); } @@ -314,7 +314,14 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags, uint32 flags2 *data << (uint32)((Player*)this)->GetTransTime(); *data << (int8)((Player*)this)->GetTransSeat(); } - //MaNGOS currently not have support for other than player on transport + else + { + //MaNGOS currently not have support for other than player on transport + *data << uint8(0); + *data << float(0) << float(0) << float(0) << float(0); + *data << uint32(0); + *data << uint8(-1); + } } // 0x02200000 @@ -773,7 +780,7 @@ void Object::_SetCreateBits(UpdateMask *updateMask, Player* /*target*/) const void Object::SetInt32Value( uint16 index, int32 value ) { - ASSERT( index < m_valuesCount || PrintIndexError( index , true ) ); + ASSERT( index < m_valuesCount || PrintIndexError( index, true ) ); if(m_int32Values[ index ] != value) { @@ -792,7 +799,7 @@ void Object::SetInt32Value( uint16 index, int32 value ) void Object::SetUInt32Value( uint16 index, uint32 value ) { - ASSERT( index < m_valuesCount || PrintIndexError( index , true ) ); + ASSERT( index < m_valuesCount || PrintIndexError( index, true ) ); if(m_uint32Values[ index ] != value) { @@ -811,7 +818,7 @@ void Object::SetUInt32Value( uint16 index, uint32 value ) void Object::SetUInt64Value( uint16 index, const uint64 &value ) { - ASSERT( index + 1 < m_valuesCount || PrintIndexError( index , true ) ); + ASSERT( index + 1 < m_valuesCount || PrintIndexError( index, true ) ); if(*((uint64*)&(m_uint32Values[ index ])) != value) { m_uint32Values[ index ] = *((uint32*)&value); @@ -830,7 +837,7 @@ void Object::SetUInt64Value( uint16 index, const uint64 &value ) void Object::SetFloatValue( uint16 index, float value ) { - ASSERT( index < m_valuesCount || PrintIndexError( index , true ) ); + ASSERT( index < m_valuesCount || PrintIndexError( index, true ) ); if(m_floatValues[ index ] != value) { @@ -849,7 +856,7 @@ void Object::SetFloatValue( uint16 index, float value ) void Object::SetByteValue( uint16 index, uint8 offset, uint8 value ) { - ASSERT( index < m_valuesCount || PrintIndexError( index , true ) ); + ASSERT( index < m_valuesCount || PrintIndexError( index, true ) ); if(offset > 4) { @@ -875,7 +882,7 @@ void Object::SetByteValue( uint16 index, uint8 offset, uint8 value ) void Object::SetUInt16Value( uint16 index, uint8 offset, uint16 value ) { - ASSERT( index < m_valuesCount || PrintIndexError( index , true ) ); + ASSERT( index < m_valuesCount || PrintIndexError( index, true ) ); if(offset > 2) { @@ -949,7 +956,7 @@ void Object::ApplyModPositiveFloatValue(uint16 index, float val, bool apply) void Object::SetFlag( uint16 index, uint32 newFlag ) { - ASSERT( index < m_valuesCount || PrintIndexError( index , true ) ); + ASSERT( index < m_valuesCount || PrintIndexError( index, true ) ); uint32 oldval = m_uint32Values[ index ]; uint32 newval = oldval | newFlag; @@ -970,7 +977,7 @@ void Object::SetFlag( uint16 index, uint32 newFlag ) void Object::RemoveFlag( uint16 index, uint32 oldFlag ) { - ASSERT( index < m_valuesCount || PrintIndexError( index , true ) ); + ASSERT( index < m_valuesCount || PrintIndexError( index, true ) ); uint32 oldval = m_uint32Values[ index ]; uint32 newval = oldval & ~oldFlag; @@ -991,7 +998,7 @@ void Object::RemoveFlag( uint16 index, uint32 oldFlag ) void Object::SetByteFlag( uint16 index, uint8 offset, uint8 newFlag ) { - ASSERT( index < m_valuesCount || PrintIndexError( index , true ) ); + ASSERT( index < m_valuesCount || PrintIndexError( index, true ) ); if(offset > 4) { @@ -1016,7 +1023,7 @@ void Object::SetByteFlag( uint16 index, uint8 offset, uint8 newFlag ) void Object::RemoveByteFlag( uint16 index, uint8 offset, uint8 oldFlag ) { - ASSERT( index < m_valuesCount || PrintIndexError( index , true ) ); + ASSERT( index < m_valuesCount || PrintIndexError( index, true ) ); if(offset > 4) { @@ -1326,7 +1333,7 @@ bool WorldObject::HasInArc(const float arcangle, const WorldObject* obj) const void WorldObject::GetRandomPoint( float x, float y, float z, float distance, float &rand_x, float &rand_y, float &rand_z) const { - if(distance==0) + if(distance == 0) { rand_x = x; rand_y = y; @@ -1534,7 +1541,7 @@ void WorldObject::SendMessageToSetInRange(WorldPacket *data, float dist, bool /* void WorldObject::SendObjectDeSpawnAnim(uint64 guid) { WorldPacket data(SMSG_GAMEOBJECT_DESPAWN_ANIM, 8); - data << guid; + data << uint64(guid); SendMessageToSet(&data, true); } diff --git a/src/game/Object.h b/src/game/Object.h index aa53d628c..d37451428 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -151,7 +151,7 @@ class MANGOS_DLL_SPEC Object void BuildMovementUpdateBlock( UpdateData * data, uint32 flags = 0 ) const; void BuildUpdate(UpdateDataMapType &); - virtual void DestroyForPlayer( Player *target ) const; + virtual void DestroyForPlayer( Player *target, bool anim = false ) const; const int32& GetInt32Value( uint16 index ) const { diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp index a71829cd3..c37e5c3bf 100644 --- a/src/game/Opcodes.cpp +++ b/src/game/Opcodes.cpp @@ -1023,7 +1023,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x3E2*/ { "SMSG_COMSAT_CONNECT_FAIL", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x3E3*/ { "SMSG_VOICE_CHAT_STATUS", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x3E4*/ { "CMSG_REPORT_PVP_AFK", STATUS_LOGGEDIN, &WorldSession::HandleReportPvPAFK }, - /*0x3E5*/ { "CMSG_REPORT_PVP_AFK_RESULT", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x3E5*/ { "SMSG_REPORT_PVP_AFK_RESULT", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x3E6*/ { "CMSG_GUILD_BANKER_ACTIVATE", STATUS_LOGGEDIN, &WorldSession::HandleGuildBankerActivate }, /*0x3E7*/ { "CMSG_GUILD_BANK_QUERY_TAB", STATUS_LOGGEDIN, &WorldSession::HandleGuildBankQueryTab }, /*0x3E8*/ { "SMSG_GUILD_BANK_LIST", STATUS_NEVER, &WorldSession::Handle_ServerSide }, diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h index f8dd364ea..e405e7017 100644 --- a/src/game/Opcodes.h +++ b/src/game/Opcodes.h @@ -692,7 +692,7 @@ enum Opcodes CMSG_GROUP_ASSISTANT_LEADER = 0x28F, CMSG_BUYBACK_ITEM = 0x290, SMSG_SERVER_MESSAGE = 0x291, - CMSG_MEETINGSTONE_JOIN = 0x292, + CMSG_MEETINGSTONE_JOIN = 0x292, // lua: SetSavedInstanceExtend SMSG_MEETINGSTONE_LEAVE = 0x293, CMSG_MEETINGSTONE_CHEAT = 0x294, SMSG_MEETINGSTONE_SETQUEUE = 0x295, @@ -1031,7 +1031,7 @@ enum Opcodes SMSG_COMSAT_CONNECT_FAIL = 0x3E2, SMSG_VOICE_CHAT_STATUS = 0x3E3, CMSG_REPORT_PVP_AFK = 0x3E4, - CMSG_REPORT_PVP_AFK_RESULT = 0x3E5, + SMSG_REPORT_PVP_AFK_RESULT = 0x3E5, // SMSG? CMSG_GUILD_BANKER_ACTIVATE = 0x3E6, CMSG_GUILD_BANK_QUERY_TAB = 0x3E7, SMSG_GUILD_BANK_LIST = 0x3E8, diff --git a/src/game/Player.cpp b/src/game/Player.cpp index cb75e4b89..1c5679390 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -3743,9 +3743,9 @@ void Player::BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target ) Unit::BuildCreateUpdateBlockForPlayer( data, target ); } -void Player::DestroyForPlayer( Player *target ) const +void Player::DestroyForPlayer( Player *target, bool anim ) const { - Unit::DestroyForPlayer( target ); + Unit::DestroyForPlayer( target, anim ); for(int i = 0; i < INVENTORY_SLOT_BAG_END; ++i) { @@ -5522,7 +5522,7 @@ ActionButton* Player::addActionButton(uint8 button, uint32 action, uint8 type) { if(button >= MAX_ACTION_BUTTONS) { - sLog.outError( "Action %u not added into button %u for player %s: button must be < 132", action, button, GetName() ); + sLog.outError( "Action %u not added into button %u for player %s: button must be < 144", action, button, GetName() ); return NULL; } @@ -5564,6 +5564,7 @@ ActionButton* Player::addActionButton(uint8 button, uint32 action, uint8 type) // set data and update to CHANGED if not NEW ab.SetActionAndType(action,ActionButtonType(type)); + } sLog.outDetail( "Player '%u' Added Action '%u' (type %u) to Button '%u'", GetGUIDLow(), action, uint32(type), button ); return &ab; @@ -10328,7 +10329,6 @@ Item* Player::EquipNewItem( uint16 pos, uint32 item, bool update ) Item* Player::EquipItem( uint16 pos, Item *pItem, bool update ) { - AddEnchantmentDurations(pItem); AddItemDurations(pItem); @@ -15331,8 +15331,10 @@ void Player::SendRaidInfo() data << uint32(save->GetMapId()); // map id data << uint32(save->GetDifficulty()); // difficulty data << uint64(save->GetInstanceId()); // instance id + data << uint8(0); + data << uint8(0); data << uint32(save->GetResetTime() - now); // reset time - data << uint32(0); // is extended + //data << uint32(0); // is extended ++counter; } } @@ -16147,10 +16149,10 @@ void Player::SendAttackSwingBadFacingAttack() GetSession()->SendPacket( &data ); } -void Player::SendAutoRepeatCancel() +void Player::SendAutoRepeatCancel(Unit *target) { - WorldPacket data(SMSG_CANCEL_AUTO_REPEAT, GetPackGUID().size()); - data.append(GetPackGUID()); // may be it's target guid + WorldPacket data(SMSG_CANCEL_AUTO_REPEAT, target->GetPackGUID().size()); + data.append(target->GetPackGUID()); // may be it's target guid GetSession()->SendPacket( &data ); } @@ -17883,7 +17885,7 @@ void Player::UpdateVisibilityOf(WorldObject* target) { if(HaveAtClient(target)) { - if(!target->isVisibleForInState(this,true)) + if(!target->isVisibleForInState(this, true)) { target->DestroyForPlayer(this); m_clientGUIDs.erase(target->GetGUID()); @@ -18050,14 +18052,10 @@ void Player::SetGroup(Group *group, int8 subgroup) void Player::SendInitialPacketsBeforeAddToMap() { - WorldPacket data(SMSG_SET_REST_START_OBSOLETE, 4); - data << uint32(0); // unknown, may be rest state time or experience - GetSession()->SendPacket(&data); - GetSocial()->SendSocialList(); // Homebind - data.Initialize(SMSG_BINDPOINTUPDATE, 5*4); + WorldPacket data(SMSG_BINDPOINTUPDATE, 5*4); data << m_homebindX << m_homebindY << m_homebindZ; data << (uint32) m_homebindMapId; data << (uint32) m_homebindZoneId; @@ -19495,11 +19493,20 @@ bool Player::HasTitle(uint32 bitIndex) return HasFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag); } -void Player::SetTitle(CharTitlesEntry const* title) +void Player::SetTitle(CharTitlesEntry const* title, bool lost) { uint32 fieldIndexOffset = title->bit_index / 32; uint32 flag = 1 << (title->bit_index % 32); - SetFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag); + + if(lost) + RemoveFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag); + else + SetFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag); + + WorldPacket data(SMSG_TITLE_EARNED, 4 + 4); + data << uint32(title->bit_index); + data << uint32(lost ? 0 : 1); // 1 - earned, 0 - lost + GetSession()->SendPacket(&data); } void Player::ConvertRune(uint8 index, uint8 newType) diff --git a/src/game/Player.h b/src/game/Player.h index 07b3af604..03e55510a 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -135,11 +135,12 @@ enum ActionButtonUpdateState enum ActionButtonType { - ACTION_BUTTON_SPELL = 0, - ACTION_BUTTON_EQSET = 32, - ACTION_BUTTON_MACRO = 64, - ACTION_BUTTON_CMACRO= 65, - ACTION_BUTTON_ITEM = 128 + ACTION_BUTTON_SPELL = 0x00, + ACTION_BUTTON_C = 0x01, // click? + ACTION_BUTTON_EQSET = 0x20, + ACTION_BUTTON_MACRO = 0x40, + ACTION_BUTTON_CMACRO = ACTION_BUTTON_C | ACTION_BUTTON_MACRO, + ACTION_BUTTON_ITEM = 0x80 }; #define ACTION_BUTTON_ACTION(X) (uint32(X) & 0x00FFFFFF) @@ -168,7 +169,7 @@ struct ActionButton } }; -#define MAX_ACTION_BUTTONS 132 //checked in 2.3.0 +#define MAX_ACTION_BUTTONS 144 //checked in 2.3.0 typedef std::map ActionButtonList; @@ -1685,7 +1686,7 @@ class MANGOS_DLL_SPEC Player : public Unit void SetSession(WorldSession *s) { m_session = s; } void BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target ) const; - void DestroyForPlayer( Player *target ) const; + void DestroyForPlayer( Player *target, bool anim = false ) const; void SendDelayResponse(const uint32); void SendLogXPGain(uint32 GivenXP,Unit* victim,uint32 RestXP); @@ -1695,7 +1696,7 @@ class MANGOS_DLL_SPEC Player : public Unit void SendAttackSwingDeadTarget(); void SendAttackSwingNotInRange(); void SendAttackSwingBadFacingAttack(); - void SendAutoRepeatCancel(); + void SendAutoRepeatCancel(Unit *target); void SendExplorationExperience(uint32 Area, uint32 Experience); void SendDungeonDifficulty(bool IsInGroup); @@ -2172,7 +2173,7 @@ class MANGOS_DLL_SPEC Player : public Unit void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1=0, uint32 miscvalue2=0, Unit *unit=NULL, uint32 time=0); bool HasTitle(uint32 bitIndex); bool HasTitle(CharTitlesEntry const* title) { return HasTitle(title->bit_index); } - void SetTitle(CharTitlesEntry const* title); + void SetTitle(CharTitlesEntry const* title, bool lost = false); bool isActiveObject() const { return true; } bool canSeeSpellClickOn(Creature const* creature) const; diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 5d39fab2b..c1fbf09a4 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -823,10 +823,6 @@ void Spell::EffectDummy(uint32 i) DEBUG_LOG("AddObject at SpellEfects.cpp EffectDummy"); map->Add(pGameObj); - WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8); - data << uint64(pGameObj->GetGUID()); - m_caster->SendMessageToSet(&data, true); - return; } case 23074: // Arcanite Dragonling @@ -5699,9 +5695,6 @@ void Spell::EffectSummonObject(uint32 i) m_caster->AddGameObject(pGameObj); map->Add(pGameObj); - WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8); - data << uint64(pGameObj->GetGUID()); - m_caster->SendMessageToSet(&data, true); m_caster->m_ObjectSlot[slot] = pGameObj->GetGUID(); } @@ -6313,16 +6306,14 @@ void Spell::EffectTransmitted(uint32 effIndex) case GAMEOBJECT_TYPE_FISHINGHOLE: case GAMEOBJECT_TYPE_CHEST: default: - { break; - } } pGameObj->SetRespawnTime(duration > 0 ? duration/IN_MILISECONDS : 0); - pGameObj->SetOwnerGUID(m_caster->GetGUID() ); + pGameObj->SetOwnerGUID(m_caster->GetGUID()); - pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel() ); + pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel()); pGameObj->SetSpellId(m_spellInfo->Id); DEBUG_LOG("AddObject at SpellEfects.cpp EffectTransmitted"); @@ -6331,10 +6322,6 @@ void Spell::EffectTransmitted(uint32 effIndex) cMap->Add(pGameObj); - WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8); - data << uint64(pGameObj->GetGUID()); - m_caster->SendMessageToSet(&data,true); - if(uint32 linkedEntry = pGameObj->GetLinkedGameObjectEntry()) { GameObject* linkedGO = new GameObject; @@ -6342,9 +6329,9 @@ void Spell::EffectTransmitted(uint32 effIndex) m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY)) { linkedGO->SetRespawnTime(duration > 0 ? duration/IN_MILISECONDS : 0); - linkedGO->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel() ); + linkedGO->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel()); linkedGO->SetSpellId(m_spellInfo->Id); - linkedGO->SetOwnerGUID(m_caster->GetGUID() ); + linkedGO->SetOwnerGUID(m_caster->GetGUID()); linkedGO->GetMap()->Add(linkedGO); } diff --git a/src/game/Totem.cpp b/src/game/Totem.cpp index 6ba0e405e..b847dc8da 100644 --- a/src/game/Totem.cpp +++ b/src/game/Totem.cpp @@ -53,49 +53,45 @@ void Totem::Update( uint32 time ) void Totem::Summon(Unit* owner) { - sLog.outDebug("AddObject at Totem.cpp line 49"); - SetInstanceId(owner->GetInstanceId()); owner->GetMap()->Add((Creature*)this); // select totem model in dependent from owner team CreatureInfo const *cinfo = GetCreatureInfo(); - if(owner->GetTypeId()==TYPEID_PLAYER && cinfo) + if(owner->GetTypeId() == TYPEID_PLAYER && cinfo) { - uint32 display_id = objmgr.ChooseDisplayId(((Player*)owner)->GetTeam(),cinfo); + uint32 display_id = objmgr.ChooseDisplayId(((Player*)owner)->GetTeam(), cinfo); CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id); if (minfo) display_id = minfo->modelid; SetDisplayId(display_id); } - WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8); - data << GetGUID(); - SendMessageToSet(&data,true); - AIM_Initialize(); switch(m_type) { - case TOTEM_PASSIVE: CastSpell(this, GetSpell(), true); break; - case TOTEM_STATUE: CastSpell(GetOwner(), GetSpell(), true); break; + case TOTEM_PASSIVE: + CastSpell(this, GetSpell(), true); + break; + case TOTEM_STATUE: + CastSpell(GetOwner(), GetSpell(), true); + break; default: break; } } void Totem::UnSummon() { - SendObjectDeSpawnAnim(GetGUID()); - CombatStop(); RemoveAurasDueToSpell(GetSpell()); Unit *owner = GetOwner(); if (owner) { - // clear owenr's totem slot + // clear owner's totem slot for(int i = 0; i < MAX_TOTEM; ++i) { - if(owner->m_TotemSlot[i]==GetGUID()) + if(owner->m_TotemSlot[i] == GetGUID()) { owner->m_TotemSlot[i] = 0; break; @@ -105,11 +101,12 @@ void Totem::UnSummon() owner->RemoveAurasDueToSpell(GetSpell()); //remove aura all party members too - Group *pGroup = NULL; if (owner->GetTypeId() == TYPEID_PLAYER) { + ((Player*)owner)->SendAutoRepeatCancel(this); + // Not only the player can summon the totem (scripted AI) - pGroup = ((Player*)owner)->GetGroup(); + Group *pGroup = ((Player*)owner)->GetGroup(); if (pGroup) { for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) @@ -154,13 +151,13 @@ void Totem::SetTypeBySummonSpell(SpellEntry const * spellProto) if (GetSpellCastTime(totemSpell)) m_type = TOTEM_ACTIVE; } - if(spellProto->SpellIconID==2056) + if(spellProto->SpellIconID == 2056) m_type = TOTEM_STATUE; //Jewelery statue } bool Totem::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const { - // TODO: possibly all negative auras immuned? + // TODO: possibly all negative auras immune? switch(spellInfo->EffectApplyAuraName[index]) { case SPELL_AURA_PERIODIC_DAMAGE: diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 7bd089463..18030a63d 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -3138,8 +3138,8 @@ void Unit::InterruptSpell(uint32 spellType, bool withDelayed) // send autorepeat cancel message for autorepeat spells if (spellType == CURRENT_AUTOREPEAT_SPELL) { - if(GetTypeId()==TYPEID_PLAYER) - ((Player*)this)->SendAutoRepeatCancel(); + if(GetTypeId() == TYPEID_PLAYER) + ((Player*)this)->SendAutoRepeatCancel(this); } if (m_currentSpells[spellType]->getState() != SPELL_STATE_FINISHED) From 5af8fb89d0179d7e3b9868d1f2e41ff050215090 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sun, 5 Jul 2009 13:19:37 +0400 Subject: [PATCH 042/132] Fix --- src/game/Player.cpp | 3 ++- src/game/Totem.cpp | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index c91c49e4f..ba575de79 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -20480,4 +20480,5 @@ void Player::SendDuelCountdown(uint32 counter) { WorldPacket data(SMSG_DUEL_COUNTDOWN, 4); data << uint32(counter); // seconds - GetSession()->SendPacket(&data); \ No newline at end of file + GetSession()->SendPacket(&data); +} diff --git a/src/game/Totem.cpp b/src/game/Totem.cpp index b847dc8da..d9f422e2e 100644 --- a/src/game/Totem.cpp +++ b/src/game/Totem.cpp @@ -85,8 +85,8 @@ void Totem::UnSummon() { CombatStop(); RemoveAurasDueToSpell(GetSpell()); - Unit *owner = GetOwner(); - if (owner) + + if (Unit *owner = GetOwner()) { // clear owner's totem slot for(int i = 0; i < MAX_TOTEM; ++i) @@ -106,8 +106,7 @@ void Totem::UnSummon() ((Player*)owner)->SendAutoRepeatCancel(this); // Not only the player can summon the totem (scripted AI) - Group *pGroup = ((Player*)owner)->GetGroup(); - if (pGroup) + if (Group *pGroup = ((Player*)owner)->GetGroup()) { for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { From 3089d850358a973764388e76b7b7cb39aed561b2 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sun, 5 Jul 2009 13:39:57 +0400 Subject: [PATCH 043/132] Removed wrong file. --- sql/320/5_battleground_tempalate.sql | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 sql/320/5_battleground_tempalate.sql diff --git a/sql/320/5_battleground_tempalate.sql b/sql/320/5_battleground_tempalate.sql deleted file mode 100644 index 699a0158d..000000000 --- a/sql/320/5_battleground_tempalate.sql +++ /dev/null @@ -1,2 +0,0 @@ -insert into `battleground_template`(`id`,`MinPlayersPerTeam`,`MaxPlayersPerTeam`,`MinLvl`,`MaxLvl`,`AllianceStartLoc`,`AllianceStartO`,`HordeStartLoc`,`HordeStartO`) values (30,20,40,71,80,1485,0,1486,0); -insert into `battleground_template`(`id`,`MinPlayersPerTeam`,`MaxPlayersPerTeam`,`MinLvl`,`MaxLvl`,`AllianceStartLoc`,`AllianceStartO`,`HordeStartLoc`,`HordeStartO`) values (32,0,40,0,80,0,0,0,0); From c9258deb5a14af986e0e86c09cd668420fb16a96 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Wed, 8 Jul 2009 22:03:53 +0400 Subject: [PATCH 044/132] Updated to 10072 client build. --- src/game/MiscHandler.cpp | 14 +++++++------- src/game/Player.h | 26 +++++++++++++++----------- src/game/UpdateFields.h | 2 +- src/realmd/AuthCodes.h | 4 ++-- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index fbbd364aa..f7b63774d 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -723,29 +723,29 @@ void WorldSession::HandleResurrectResponseOpcode(WorldPacket & recv_data) void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) { - CHECK_PACKET_SIZE(recv_data,4); + CHECK_PACKET_SIZE(recv_data, 4); sLog.outDebug("WORLD: Received CMSG_AREATRIGGER"); uint32 Trigger_ID; recv_data >> Trigger_ID; - sLog.outDebug("Trigger ID:%u",Trigger_ID); + sLog.outDebug("Trigger ID: %u", Trigger_ID); if(GetPlayer()->isInFlight()) { - sLog.outDebug("Player '%s' (GUID: %u) in flight, ignore Area Trigger ID:%u",GetPlayer()->GetName(),GetPlayer()->GetGUIDLow(), Trigger_ID); + sLog.outDebug("Player '%s' (GUID: %u) in flight, ignore Area Trigger ID: %u", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), Trigger_ID); return; } AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID); if(!atEntry) { - sLog.outDebug("Player '%s' (GUID: %u) send unknown (by DBC) Area Trigger ID:%u",GetPlayer()->GetName(),GetPlayer()->GetGUIDLow(), Trigger_ID); + sLog.outDebug("Player '%s' (GUID: %u) send unknown (by DBC) Area Trigger ID: %u", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), Trigger_ID); return; } - if (GetPlayer()->GetMapId()!=atEntry->mapid) + if (GetPlayer()->GetMapId() != atEntry->mapid) { sLog.outDebug("Player '%s' (GUID: %u) too far (trigger map: %u player map: %u), ignore Area Trigger ID: %u", GetPlayer()->GetName(), atEntry->mapid, GetPlayer()->GetMapId(), GetPlayer()->GetGUIDLow(), Trigger_ID); return; @@ -759,7 +759,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) if (atEntry->radius > 0) { // if we have radius check it - float dist = pl->GetDistance(atEntry->x,atEntry->y,atEntry->z); + float dist = pl->GetDistance(atEntry->x, atEntry->y, atEntry->z); if(dist > atEntry->radius + delta) { sLog.outDebug("Player '%s' (GUID: %u) too far (radius: %f distance: %f), ignore Area Trigger ID: %u", @@ -888,7 +888,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) } } - GetPlayer()->TeleportTo(at->target_mapId,at->target_X,at->target_Y,at->target_Z,at->target_Orientation,TELE_TO_NOT_LEAVE_TRANSPORT); + GetPlayer()->TeleportTo(at->target_mapId, at->target_X, at->target_Y, at->target_Z, at->target_Orientation, TELE_TO_NOT_LEAVE_TRANSPORT); } void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data) diff --git a/src/game/Player.h b/src/game/Player.h index bbe948c25..80cdf36d9 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -169,7 +169,7 @@ struct ActionButton } }; -#define MAX_ACTION_BUTTONS 144 //checked in 2.3.0 +#define MAX_ACTION_BUTTONS 144 //checked in 3.2.0 typedef std::map ActionButtonList; @@ -316,20 +316,24 @@ typedef std::list ItemDurationList; enum LfgType { - LFG_TYPE_NONE = 0, - LFG_TYPE_DUNGEON = 1, - LFG_TYPE_RAID = 2, - LFG_TYPE_QUEST = 3, - LFG_TYPE_ZONE = 4, - LFG_TYPE_HEROIC_DUNGEON = 5 + LFG_TYPE_NONE = 0, + LFG_TYPE_DUNGEON = 1, + LFG_TYPE_RAID = 2, + LFG_TYPE_QUEST = 3, + LFG_TYPE_ZONE = 4, + LFG_TYPE_HEROIC_DUNGEON = 5, + LFG_TYPE_ANY_DUNGEON = 6, + LFG_TYPE_ANY_HEROIC_DUNGEON = 7, + LFG_TYPE_DAILY_DUNGEON = 8, + LFG_TYPE_DAILY_HEROIC_DUNGEON = 9 }; enum LfgRoles { - LEADER = 1, - TANK = 2, - HEALER = 4, - DAMAGE = 8 + LEADER = 0x01, + TANK = 0x02, + HEALER = 0x04, + DAMAGE = 0x08 }; struct LookingForGroupSlot diff --git a/src/game/UpdateFields.h b/src/game/UpdateFields.h index 0efc3d2be..b0ca0a28d 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, 2, 0, 10048 +// Auto generated for version 0, 2, 0, 10072 enum EObjectFields { diff --git a/src/realmd/AuthCodes.h b/src/realmd/AuthCodes.h index dcf53e248..9d42727bd 100644 --- a/src/realmd/AuthCodes.h +++ b/src/realmd/AuthCodes.h @@ -66,8 +66,8 @@ enum LoginResult // 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.2.0 client build 10048... +// will only support WoW, WoW:TBC and WoW:WotLK 3.2.0 client build 10072... -#define EXPECTED_MANGOS_CLIENT_BUILD {10048, 0} +#define EXPECTED_MANGOS_CLIENT_BUILD {10072, 0} #endif From 26fa65d840e7f2c99c7c6f533bc92c80d04ce855 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Thu, 9 Jul 2009 12:26:21 +0400 Subject: [PATCH 045/132] Updated spell.dbc struct. --- src/game/DBCStructure.h | 12 +++++------- src/game/UpdateFields.h | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index a2f2174e7..bcb4d1378 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -1303,11 +1303,11 @@ struct SpellEntry uint32 AttributesEx4; // 8 m_attributesExD uint32 AttributesEx5; // 9 m_attributesExE //uint32 AttributesEx6; // 10 m_attributesExF not used - // new 3.2 + // uint32 unk_320_1; // 3.2.0 (0x20 - totems, 0x4 - paladin auras, etc...) uint32 Stances; // 11 m_shapeshiftMask - // new 3.2 + // uint32 unk_320_2; // 3.2.0 uint32 StancesNot; // 12 m_shapeshiftExclude - // new 3.2 + // uint32 unk_320_3; // 3.2.0 uint32 Targets; // 13 m_targets uint32 TargetCreatureType; // 14 m_targetCreatureType uint32 RequiresSpellFocus; // 15 m_requiresSpellFocus @@ -1403,10 +1403,8 @@ struct SpellEntry uint32 runeCostID; // 229 m_runeCostID //uint32 spellMissileID; // 230 m_spellMissileID not used //uint32 PowerDisplayId; // 231 PowerDisplay.dbc, new in 3.1 - //uint32 unk1; // 3.2 - //uint32 unk2; // 3.2 - //uint32 unk3; // 3.2 - //uint32 unk4; // 3.2 + //float unk_320_4[3]; // 3.2.0 + //uint32 spellDescriptionVariablesID; // 3.2.0 // helpers int32 CalculateSimpleValue(uint8 eff) const { return EffectBasePoints[eff]+int32(EffectBaseDice[eff]); } diff --git a/src/game/UpdateFields.h b/src/game/UpdateFields.h index b0ca0a28d..34da679e4 100644 --- a/src/game/UpdateFields.h +++ b/src/game/UpdateFields.h @@ -375,7 +375,7 @@ enum EUnitFields PLAYER_FIELD_TODAY_CONTRIBUTION = UNIT_END + 0x041C, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_FIELD_YESTERDAY_CONTRIBUTION = UNIT_END + 0x041D, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_FIELD_LIFETIME_HONORBALE_KILLS = UNIT_END + 0x041E, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_FIELD_BYTES2 = UNIT_END + 0x041F, // Size: 1, Type: BYTES, Flags: PRIVATE + PLAYER_FIELD_BYTES2 = UNIT_END + 0x041F, // Size: 1, Type: 6, Flags: PRIVATE PLAYER_FIELD_WATCHED_FACTION_INDEX = UNIT_END + 0x0420, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_FIELD_COMBAT_RATING_1 = UNIT_END + 0x0421, // Size: 25, Type: INT, Flags: PRIVATE PLAYER_FIELD_ARENA_TEAM_INFO_1_1 = UNIT_END + 0x043A, // Size: 18, Type: INT, Flags: PRIVATE From 755c8a1a818feb0ee72ccf1d5635bd8a2d74b094 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sat, 11 Jul 2009 07:46:50 +0400 Subject: [PATCH 046/132] Updated to 10083 client build. --- src/game/ArenaTeam.cpp | 18 +++++++++--------- src/game/ArenaTeam.h | 2 +- src/game/BattleGroundHandler.cpp | 2 +- src/game/Player.cpp | 21 +++++++++++---------- src/game/Player.h | 4 ++-- src/game/UpdateFields.h | 25 +++++++++++++------------ src/realmd/AuthCodes.h | 4 ++-- 7 files changed, 39 insertions(+), 37 deletions(-) diff --git a/src/game/ArenaTeam.cpp b/src/game/ArenaTeam.cpp index 6b88ba687..62662718d 100644 --- a/src/game/ArenaTeam.cpp +++ b/src/game/ArenaTeam.cpp @@ -138,11 +138,11 @@ bool ArenaTeam::AddMember(const uint64& PlayerGuid) { pl->SetInArenaTeam(Id, GetSlot()); pl->SetArenaTeamIdInvited(0); - pl->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot()*6) + 5, newmember.personal_rating ); + pl->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * 7) + 5, newmember.personal_rating ); // hide promote/remove buttons if(CaptainGuid != PlayerGuid) - pl->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * 6) + 1, 1); + pl->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * 7) + 1, 1); } return true; } @@ -238,7 +238,7 @@ void ArenaTeam::SetCaptain(const uint64& guid) // disable remove/promote buttons Player *oldcaptain = objmgr.GetPlayer(GetCaptain()); if(oldcaptain) - oldcaptain->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 1 + (GetSlot() * 6), 1); + oldcaptain->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 1 + (GetSlot() * 7), 1); // set new captain CaptainGuid = guid; @@ -249,7 +249,7 @@ void ArenaTeam::SetCaptain(const uint64& guid) // enable remove/promote buttons Player *newcaptain = objmgr.GetPlayer(guid); if(newcaptain) - newcaptain->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 1 + (GetSlot() * 6), 0); + newcaptain->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 1 + (GetSlot() * 7), 0); } void ArenaTeam::DelMember(uint64 guid) @@ -272,7 +272,7 @@ void ArenaTeam::DelMember(uint64 guid) // delete all info regarding this team for(int i = 0; i < 6; ++i) { - player->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * 6) + i, 0); + player->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * 7) + i, 0); } } @@ -568,8 +568,8 @@ void ArenaTeam::MemberLost(Player * plr, uint32 againstRating) itr->games_week +=1; itr->games_season +=1; // update the unit fields - plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 6 * GetSlot() + 2, itr->games_week); - plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 6 * GetSlot() + 3, itr->games_season); + plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 7 * GetSlot() + 2, itr->games_week); + plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 7 * GetSlot() + 3, itr->games_season); return; } } @@ -614,8 +614,8 @@ void ArenaTeam::MemberWon(Player * plr, uint32 againstRating) itr->wins_season += 1; itr->wins_week += 1; // update unit fields - plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 6 * GetSlot() + 2, itr->games_week); - plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 6 * GetSlot() + 3, itr->games_season); + plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 7 * GetSlot() + 2, itr->games_week); + plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 7 * GetSlot() + 3, itr->games_season); return; } } diff --git a/src/game/ArenaTeam.h b/src/game/ArenaTeam.h index 9ad3ea618..775dc9b07 100644 --- a/src/game/ArenaTeam.h +++ b/src/game/ArenaTeam.h @@ -101,7 +101,7 @@ struct ArenaTeamMember else personal_rating += mod; if(plr) - plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot*6) + 5, personal_rating); + plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot*7) + 5, personal_rating); } }; diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp index a24ff1bdc..d37a38572 100644 --- a/src/game/BattleGroundHandler.cpp +++ b/src/game/BattleGroundHandler.cpp @@ -726,7 +726,7 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data ) Player *member = itr->getSource(); // calc avg personal rating - avg_pers_rating += member->GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaslot*6) + 5); + avg_pers_rating += member->GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaslot * 7) + 5); } if (arenatype) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 22f1b8f3c..3b3015ad6 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -13868,7 +13868,7 @@ void Player::_LoadDeclinedNames(QueryResult* result) void Player::_LoadArenaTeamInfo(QueryResult *result) { // arenateamid, played_week, played_season, personal_rating - memset((void*)&m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1], 0, sizeof(uint32)*18); + memset((void*)&m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1], 0, sizeof(uint32)*21); if (!result) return; @@ -13889,12 +13889,13 @@ void Player::_LoadArenaTeamInfo(QueryResult *result) } uint8 arenaSlot = aTeam->GetSlot(); - m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + arenaSlot * 6] = arenateamid; // TeamID - m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + arenaSlot * 6 + 1] = ((aTeam->GetCaptain() == GetGUID()) ? (uint32)0 : (uint32)1); // Captain 0, member 1 - m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + arenaSlot * 6 + 2] = played_week; // Played Week - m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + arenaSlot * 6 + 3] = played_season; // Played Season - m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + arenaSlot * 6 + 4] = 0; // Unk - m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + arenaSlot * 6 + 5] = personal_rating; // Personal Rating + m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + arenaSlot * 7 + 0] = arenateamid; // TeamID + m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + arenaSlot * 7 + 1] = ((aTeam->GetCaptain() == GetGUID()) ? (uint32)0 : (uint32)1); // Captain 0, member 1 + m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + arenaSlot * 7 + 2] = played_week; // Played Week + m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + arenaSlot * 7 + 3] = played_season; // Played Season + m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + arenaSlot * 7 + 4] = 0; // Unk + m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + arenaSlot * 7 + 5] = personal_rating; // Personal Rating + m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + arenaSlot * 7 + 6] = 0; // unk }while (result->NextRow()); delete result; @@ -14128,8 +14129,8 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) continue; // arena team not exist or not member, cleanup fields - for(int j =0; j < 6; ++j) - SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + arena_slot * 6 + j, 0); + for(int j = 0; j < 7; ++j) + SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + arena_slot * 7 + j, 0); } _LoadBoundInstances(holder->GetResult(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES)); @@ -17394,7 +17395,7 @@ uint32 Player::GetMaxPersonalArenaRatingRequirement() { if(ArenaTeam * at = objmgr.GetArenaTeamById(GetArenaTeamId(i))) { - uint32 p_rating = GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (i * 6) + 5); + uint32 p_rating = GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (i * 7) + 5); uint32 t_rating = at->GetRating(); p_rating = p_rating Date: Sat, 11 Jul 2009 07:53:38 +0400 Subject: [PATCH 047/132] Updated map.dbc struct. --- src/game/DBCStructure.h | 1 + src/game/DBCfmt.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index bcb4d1378..a3772cea2 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -1089,6 +1089,7 @@ struct MapEntry // 61 -1, 0 and 720 uint32 addon; // 62 (0-original maps,1-tbc addon) // 63 some kind of time? + //uint32 maxPlayers; // 64 max players // Helpers uint32 Expansion() const { return addon; } diff --git a/src/game/DBCfmt.h b/src/game/DBCfmt.h index f3a5b524c..9bd198ad9 100644 --- a/src/game/DBCfmt.h +++ b/src/game/DBCfmt.h @@ -72,7 +72,7 @@ const char ItemRandomSuffixfmt[]="nxxxxxxxxxxxxxxxxxxiiiiiiiiii"; const char ItemSetEntryfmt[]="dssssssssssssssssxxxxxxxxxxxxxxxxxxiiiiiiiiiiiiiiiiii"; const char LockEntryfmt[]="niiiiiiiiiiiiiiiiiiiiiiiixxxxxxxx"; const char MailTemplateEntryfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; -const char MapEntryfmt[]="nxixssssssssssssssssxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixiffxix"; +const char MapEntryfmt[]="nxixssssssssssssssssxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixiffxixx"; const char MovieEntryfmt[]="nxx"; const char QuestSortEntryfmt[]="nxxxxxxxxxxxxxxxxx"; const char RandomPropertiesPointsfmt[]="niiiiiiiiiiiiiii"; From 2066de036fb5d70a8a5b6a11e4d55f26680d7c30 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sat, 11 Jul 2009 10:36:56 +0400 Subject: [PATCH 048/132] Updated auras enum, dbc comments. --- src/game/CharacterHandler.cpp | 8 +- src/game/DBCStructure.h | 262 +++++++++++++++++----------------- src/game/MiscHandler.cpp | 11 +- src/game/Opcodes.cpp | 2 + src/game/Opcodes.h | 4 +- src/game/SpellAuraDefines.h | 14 +- src/game/SpellAuras.cpp | 30 ++-- 7 files changed, 181 insertions(+), 150 deletions(-) diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index f8bd12d02..0f395144a 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -226,19 +226,19 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) } // prevent character creating Expansion race without Expansion account - if (raceEntry->addon > Expansion()) + if (raceEntry->expansion > Expansion()) { data << (uint8)CHAR_CREATE_EXPANSION; - sLog.outError("Expansion %u account:[%d] tried to Create character with expansion %u race (%u)",Expansion(),GetAccountId(),raceEntry->addon,race_); + sLog.outError("Expansion %u account:[%d] tried to Create character with expansion %u race (%u)",Expansion(),GetAccountId(),raceEntry->expansion,race_); SendPacket( &data ); return; } // prevent character creating Expansion class without Expansion account - if (classEntry->addon > Expansion()) + if (classEntry->expansion > Expansion()) { data << (uint8)CHAR_CREATE_EXPANSION_CLASS; - sLog.outError("Expansion %u account:[%d] tried to Create character with expansion %u class (%u)",Expansion(),GetAccountId(),classEntry->addon,class_); + sLog.outError("Expansion %u account:[%d] tried to Create character with expansion %u class (%u)",Expansion(),GetAccountId(),classEntry->expansion,class_); SendPacket( &data ); return; } diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index a3772cea2..312b5b034 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -627,7 +627,7 @@ struct ChrClassesEntry uint32 spellfamily; // 56 // 57, unused uint32 CinematicSequence; // 58 id from CinematicSequences.dbc - uint32 addon; // 59 (0 - original race, 1 - tbc addon, ...) + uint32 expansion; // 59 (0 - original race, 1 - tbc addon, ...) }; struct ChrRacesEntry @@ -649,7 +649,7 @@ struct ChrRacesEntry //char* nameNeutralGender[16]; // 47-62, if different from base (male) case // 63 string flags, unused // 64-66 unused - uint32 addon; // 67 (0 - original race, 1 - tbc addon, ...) + uint32 expansion; // 67 (0 - original race, 1 - tbc addon, ...) }; /* not used @@ -959,7 +959,7 @@ struct ItemEntry { uint32 ID; // 0 uint32 Class; // 1 - uint32 SubClass; // 2 some items have strnage subclasses + uint32 SubClass; // 2 some items have strange subclasses int32 Unk0; // 3 int32 Material; // 4 uint32 DisplayId; // 5 @@ -1003,10 +1003,10 @@ struct ItemExtendedCostEntry uint32 ID; // 0 extended-cost entry id uint32 reqhonorpoints; // 1 required honor points uint32 reqarenapoints; // 2 required arena points - //uint32 unk1; // 3.2 - uint32 reqitem[5]; // 3-7 required item id - uint32 reqitemcount[5]; // 8-12 required count of 1st item - uint32 reqpersonalarenarating; // 13 required personal arena rating + //uint32 unk1; // 4 probably indicates new 2v2 bracket restrictions + uint32 reqitem[5]; // 5-8 required item id + uint32 reqitemcount[5]; // 9-13 required count of 1st item + uint32 reqpersonalarenarating; // 14 required personal arena rating }; struct ItemLimitCategoryEntry @@ -1124,7 +1124,7 @@ struct MapDifficultyEntry uint32 Id; // 0 uint32 MapId; // 1 uint32 Difficulty; // 2 - char* transferFailedText[16]; // 3-18 + char* areaTriggerText[16]; // 3-18 text showed when transfer to map failed (missing requirements) uint32 textFlags; // 19 uint32 resetTime; // 20 }; @@ -1154,38 +1154,39 @@ struct RandomPropertiesPointsEntry struct ScalingStatDistributionEntry { - uint32 Id; - int32 StatMod[10]; - uint32 Modifier[10]; - uint32 MaxLevel; + uint32 Id; // 0 + int32 StatMod[10]; // 1-10 + uint32 Modifier[10]; // 11-20 + uint32 MaxLevel; // 21 }; struct ScalingStatValuesEntry { - uint32 Id; - uint32 Level; - uint32 ssdMultiplier[4]; // Multiplier for ScalingStatDistribution - uint32 armorMod[4]; // Armor for level - uint32 dpsMod[6]; // DPS mod for level - uint32 spellBonus; // not sure.. TODO: need more info about - uint32 feralBonus; // Feral AP bonus - //uint32 unk1[6]; // 3.2 + uint32 Id; // 0 + uint32 Level; // 1 + uint32 ssdMultiplier[4]; // 2-5 Multiplier for ScalingStatDistribution + uint32 armorMod[4]; // 6-9 Armor for level + uint32 dpsMod[6]; // 10-15 DPS mod for level + uint32 spellBonus; // 16 not sure.. TODO: need more info about + uint32 feralBonus; // 17 Feral AP bonus (there's data from 3.1 ssdMultiplier[3]) + //uint32 unk1; // 18 all zero's + //uint32 unk2[5]; // 19-23 3.2 new feral bonus? uint32 getssdMultiplier(uint32 mask) const { - if (mask&0x001F) + if (mask & 0x001F) { if(mask & 0x00000001) return ssdMultiplier[0]; if(mask & 0x00000002) return ssdMultiplier[1]; if(mask & 0x00000004) return ssdMultiplier[2]; - //if(mask & 0x00000008) return ssdMultiplier[3]; + if(mask & 0x00000008) return feralBonus; if(mask & 0x00000010) return ssdMultiplier[3]; } return 0; } uint32 getArmorMod(uint32 mask) const { - if (mask&0x01E0) + if (mask & 0x01E0) { if(mask & 0x00000020) return armorMod[0]; if(mask & 0x00000040) return armorMod[1]; @@ -1194,9 +1195,10 @@ struct ScalingStatValuesEntry } return 0; } + uint32 getDPSMod(uint32 mask) const { - if (mask&0x7E00) + if (mask & 0x7E00) { if(mask & 0x00000200) return dpsMod[0]; if(mask & 0x00000400) return dpsMod[1]; @@ -1207,14 +1209,18 @@ struct ScalingStatValuesEntry } return 0; } + uint32 getSpellBonus(uint32 mask) const { - if (mask & 0x00008000) return spellBonus; + if (mask & 0x00008000) + return spellBonus; return 0; } + uint32 getFeralBonus(uint32 mask) const { - if (mask & 0x00010000) return feralBonus; + if (mask & 0x00010000) + return feralBonus; return 0; } }; @@ -1304,108 +1310,108 @@ struct SpellEntry uint32 AttributesEx4; // 8 m_attributesExD uint32 AttributesEx5; // 9 m_attributesExE //uint32 AttributesEx6; // 10 m_attributesExF not used - // uint32 unk_320_1; // 3.2.0 (0x20 - totems, 0x4 - paladin auras, etc...) - uint32 Stances; // 11 m_shapeshiftMask - // uint32 unk_320_2; // 3.2.0 - uint32 StancesNot; // 12 m_shapeshiftExclude - // uint32 unk_320_3; // 3.2.0 - uint32 Targets; // 13 m_targets - uint32 TargetCreatureType; // 14 m_targetCreatureType - uint32 RequiresSpellFocus; // 15 m_requiresSpellFocus - uint32 FacingCasterFlags; // 16 m_facingCasterFlags - uint32 CasterAuraState; // 17 m_casterAuraState - uint32 TargetAuraState; // 18 m_targetAuraState - uint32 CasterAuraStateNot; // 19 m_excludeCasterAuraState - uint32 TargetAuraStateNot; // 20 m_excludeTargetAuraState - uint32 casterAuraSpell; // 21 m_casterAuraSpell - uint32 targetAuraSpell; // 22 m_targetAuraSpell - uint32 excludeCasterAuraSpell; // 23 m_excludeCasterAuraSpell - uint32 excludeTargetAuraSpell; // 24 m_excludeTargetAuraSpell - uint32 CastingTimeIndex; // 25 m_castingTimeIndex - uint32 RecoveryTime; // 26 m_recoveryTime - uint32 CategoryRecoveryTime; // 27 m_categoryRecoveryTime - uint32 InterruptFlags; // 28 m_interruptFlags - uint32 AuraInterruptFlags; // 29 m_auraInterruptFlags - uint32 ChannelInterruptFlags; // 30 m_channelInterruptFlags - uint32 procFlags; // 31 m_procTypeMask - uint32 procChance; // 32 m_procChance - uint32 procCharges; // 33 m_procCharges - uint32 maxLevel; // 34 m_maxLevel - uint32 baseLevel; // 35 m_baseLevel - uint32 spellLevel; // 36 m_spellLevel - uint32 DurationIndex; // 37 m_durationIndex - uint32 powerType; // 38 m_powerType - uint32 manaCost; // 39 m_manaCost - uint32 manaCostPerlevel; // 40 m_manaCostPerLevel - uint32 manaPerSecond; // 41 m_manaPerSecond - uint32 manaPerSecondPerLevel; // 42 m_manaPerSecondPerLeve - uint32 rangeIndex; // 43 m_rangeIndex - float speed; // 44 m_speed - //uint32 modalNextSpell; // 45 m_modalNextSpell not used - uint32 StackAmount; // 46 m_cumulativeAura - uint32 Totem[2]; // 47-48 m_totem - int32 Reagent[8]; // 49-56 m_reagent - uint32 ReagentCount[8]; // 57-64 m_reagentCount - int32 EquippedItemClass; // 65 m_equippedItemClass (value) - int32 EquippedItemSubClassMask; // 66 m_equippedItemSubclass (mask) - int32 EquippedItemInventoryTypeMask; // 67 m_equippedItemInvTypes (mask) - uint32 Effect[3]; // 68-70 m_effect - int32 EffectDieSides[3]; // 71-73 m_effectDieSides - uint32 EffectBaseDice[3]; // 74-76 m_effectBaseDice - float EffectDicePerLevel[3]; // 77-79 m_effectDicePerLevel - float EffectRealPointsPerLevel[3]; // 80-82 m_effectRealPointsPerLevel - int32 EffectBasePoints[3]; // 83-85 m_effectBasePoints (don't must be used in spell/auras explicitly, must be used cached Spell::m_currentBasePoints) - uint32 EffectMechanic[3]; // 86-88 m_effectMechanic - uint32 EffectImplicitTargetA[3]; // 89-91 m_implicitTargetA - uint32 EffectImplicitTargetB[3]; // 92-94 m_implicitTargetB - uint32 EffectRadiusIndex[3]; // 95-97 m_effectRadiusIndex - spellradius.dbc - uint32 EffectApplyAuraName[3]; // 98-100 m_effectAura - uint32 EffectAmplitude[3]; // 101-103 m_effectAuraPeriod - float EffectMultipleValue[3]; // 104-106 m_effectAmplitude - uint32 EffectChainTarget[3]; // 107-109 m_effectChainTargets - uint32 EffectItemType[3]; // 110-112 m_effectItemType - int32 EffectMiscValue[3]; // 113-115 m_effectMiscValue - int32 EffectMiscValueB[3]; // 116-118 m_effectMiscValueB - uint32 EffectTriggerSpell[3]; // 119-121 m_effectTriggerSpell - float EffectPointsPerComboPoint[3]; // 122-124 m_effectPointsPerCombo - uint32 EffectSpellClassMaskA[3]; // 125-127 m_effectSpellClassMaskA - uint32 EffectSpellClassMaskB[3]; // 128-130 m_effectSpellClassMaskB - uint32 EffectSpellClassMaskC[3]; // 131-133 m_effectSpellClassMaskC - uint32 SpellVisual[2]; // 134-135 m_spellVisualID - uint32 SpellIconID; // 136 m_spellIconID - uint32 activeIconID; // 137 m_activeIconID - //uint32 spellPriority; // 138 m_spellPriority not used - char* SpellName[16]; // 139-154 m_name_lang - //uint32 SpellNameFlag; // 155 not used - char* Rank[16]; // 156-171 m_nameSubtext_lang - //uint32 RankFlags; // 172 not used - //char* Description[16]; // 173-188 m_description_lang not used - //uint32 DescriptionFlags; // 189 not used - //char* ToolTip[16]; // 190-205 m_auraDescription_lang not used - //uint32 ToolTipFlags; // 206 not used - uint32 ManaCostPercentage; // 207 m_manaCostPct - uint32 StartRecoveryCategory; // 208 m_startRecoveryCategory - uint32 StartRecoveryTime; // 209 m_startRecoveryTime - uint32 MaxTargetLevel; // 210 m_maxTargetLevel - uint32 SpellFamilyName; // 211 m_spellClassSet - uint64 SpellFamilyFlags; // 212-213 m_spellClassMask NOTE: size is 12 bytes!!! - uint32 SpellFamilyFlags2; // 214 addition to m_spellClassMask - uint32 MaxAffectedTargets; // 215 m_maxTargets - uint32 DmgClass; // 216 m_defenseType - uint32 PreventionType; // 217 m_preventionType - //uint32 StanceBarOrder; // 218 m_stanceBarOrder not used - float DmgMultiplier[3]; // 219-221 m_effectChainAmplitude - //uint32 MinFactionId; // 222 m_minFactionID not used - //uint32 MinReputation; // 223 m_minReputation not used - //uint32 RequiredAuraVision; // 224 m_requiredAuraVision not used - uint32 TotemCategory[2]; // 225-226 m_requiredTotemCategoryID - int32 AreaGroupId; // 227 m_requiredAreaGroupId - uint32 SchoolMask; // 228 m_schoolMask - uint32 runeCostID; // 229 m_runeCostID - //uint32 spellMissileID; // 230 m_spellMissileID not used - //uint32 PowerDisplayId; // 231 PowerDisplay.dbc, new in 3.1 - //float unk_320_4[3]; // 3.2.0 - //uint32 spellDescriptionVariablesID; // 3.2.0 + // uint32 unk_320_1; // 11 3.2.0 (0x20 - totems, 0x4 - paladin auras, etc...) + uint32 Stances; // 12 m_shapeshiftMask + // uint32 unk_320_2; // 13 3.2.0 + uint32 StancesNot; // 14 m_shapeshiftExclude + // uint32 unk_320_3; // 15 3.2.0 + uint32 Targets; // 16 m_targets + uint32 TargetCreatureType; // 17 m_targetCreatureType + uint32 RequiresSpellFocus; // 18 m_requiresSpellFocus + uint32 FacingCasterFlags; // 19 m_facingCasterFlags + uint32 CasterAuraState; // 20 m_casterAuraState + uint32 TargetAuraState; // 21 m_targetAuraState + uint32 CasterAuraStateNot; // 22 m_excludeCasterAuraState + uint32 TargetAuraStateNot; // 23 m_excludeTargetAuraState + uint32 casterAuraSpell; // 24 m_casterAuraSpell + uint32 targetAuraSpell; // 25 m_targetAuraSpell + uint32 excludeCasterAuraSpell; // 26 m_excludeCasterAuraSpell + uint32 excludeTargetAuraSpell; // 27 m_excludeTargetAuraSpell + uint32 CastingTimeIndex; // 28 m_castingTimeIndex + uint32 RecoveryTime; // 29 m_recoveryTime + uint32 CategoryRecoveryTime; // 30 m_categoryRecoveryTime + uint32 InterruptFlags; // 31 m_interruptFlags + uint32 AuraInterruptFlags; // 32 m_auraInterruptFlags + uint32 ChannelInterruptFlags; // 33 m_channelInterruptFlags + uint32 procFlags; // 34 m_procTypeMask + uint32 procChance; // 35 m_procChance + uint32 procCharges; // 36 m_procCharges + uint32 maxLevel; // 37 m_maxLevel + uint32 baseLevel; // 38 m_baseLevel + uint32 spellLevel; // 39 m_spellLevel + uint32 DurationIndex; // 40 m_durationIndex + uint32 powerType; // 41 m_powerType + uint32 manaCost; // 42 m_manaCost + uint32 manaCostPerlevel; // 43 m_manaCostPerLevel + uint32 manaPerSecond; // 44 m_manaPerSecond + uint32 manaPerSecondPerLevel; // 45 m_manaPerSecondPerLeve + uint32 rangeIndex; // 46 m_rangeIndex + float speed; // 47 m_speed + //uint32 modalNextSpell; // 48 m_modalNextSpell not used + uint32 StackAmount; // 49 m_cumulativeAura + uint32 Totem[2]; // 50-51 m_totem + int32 Reagent[8]; // 52-59 m_reagent + uint32 ReagentCount[8]; // 60-67 m_reagentCount + int32 EquippedItemClass; // 68 m_equippedItemClass (value) + int32 EquippedItemSubClassMask; // 69 m_equippedItemSubclass (mask) + int32 EquippedItemInventoryTypeMask; // 70 m_equippedItemInvTypes (mask) + uint32 Effect[3]; // 71-73 m_effect + int32 EffectDieSides[3]; // 74-76 m_effectDieSides + uint32 EffectBaseDice[3]; // 77-79 m_effectBaseDice + float EffectDicePerLevel[3]; // 80-82 m_effectDicePerLevel + float EffectRealPointsPerLevel[3]; // 83-85 m_effectRealPointsPerLevel + int32 EffectBasePoints[3]; // 86-88 m_effectBasePoints (don't must be used in spell/auras explicitly, must be used cached Spell::m_currentBasePoints) + uint32 EffectMechanic[3]; // 89-91 m_effectMechanic + uint32 EffectImplicitTargetA[3]; // 92-94 m_implicitTargetA + uint32 EffectImplicitTargetB[3]; // 95-97 m_implicitTargetB + uint32 EffectRadiusIndex[3]; // 98-100 m_effectRadiusIndex - spellradius.dbc + uint32 EffectApplyAuraName[3]; // 101-103 m_effectAura + uint32 EffectAmplitude[3]; // 104-106 m_effectAuraPeriod + float EffectMultipleValue[3]; // 107-109 m_effectAmplitude + uint32 EffectChainTarget[3]; // 110-112 m_effectChainTargets + uint32 EffectItemType[3]; // 113-115 m_effectItemType + int32 EffectMiscValue[3]; // 116-118 m_effectMiscValue + int32 EffectMiscValueB[3]; // 119-121 m_effectMiscValueB + uint32 EffectTriggerSpell[3]; // 122-124 m_effectTriggerSpell + float EffectPointsPerComboPoint[3]; // 125-127 m_effectPointsPerCombo + uint32 EffectSpellClassMaskA[3]; // 128-130 m_effectSpellClassMaskA + uint32 EffectSpellClassMaskB[3]; // 131-133 m_effectSpellClassMaskB + uint32 EffectSpellClassMaskC[3]; // 134-136 m_effectSpellClassMaskC + uint32 SpellVisual[2]; // 137-138 m_spellVisualID + uint32 SpellIconID; // 139 m_spellIconID + uint32 activeIconID; // 140 m_activeIconID + //uint32 spellPriority; // 141 m_spellPriority not used + char* SpellName[16]; // 142-157 m_name_lang + //uint32 SpellNameFlag; // 158 not used + char* Rank[16]; // 159-174 m_nameSubtext_lang + //uint32 RankFlags; // 175 not used + //char* Description[16]; // 176-191 m_description_lang not used + //uint32 DescriptionFlags; // 192 not used + //char* ToolTip[16]; // 193-208 m_auraDescription_lang not used + //uint32 ToolTipFlags; // 209 not used + uint32 ManaCostPercentage; // 210 m_manaCostPct + uint32 StartRecoveryCategory; // 211 m_startRecoveryCategory + uint32 StartRecoveryTime; // 212 m_startRecoveryTime + uint32 MaxTargetLevel; // 213 m_maxTargetLevel + uint32 SpellFamilyName; // 214 m_spellClassSet + uint64 SpellFamilyFlags; // 215-216 m_spellClassMask NOTE: size is 12 bytes!!! + uint32 SpellFamilyFlags2; // 217 addition to m_spellClassMask + uint32 MaxAffectedTargets; // 218 m_maxTargets + uint32 DmgClass; // 219 m_defenseType + uint32 PreventionType; // 220 m_preventionType + //uint32 StanceBarOrder; // 221 m_stanceBarOrder not used + float DmgMultiplier[3]; // 222-224 m_effectChainAmplitude + //uint32 MinFactionId; // 225 m_minFactionID not used + //uint32 MinReputation; // 226 m_minReputation not used + //uint32 RequiredAuraVision; // 227 m_requiredAuraVision not used + uint32 TotemCategory[2]; // 228-229 m_requiredTotemCategoryID + int32 AreaGroupId; // 230 m_requiredAreaGroupId + uint32 SchoolMask; // 231 m_schoolMask + uint32 runeCostID; // 232 m_runeCostID + //uint32 spellMissileID; // 233 m_spellMissileID not used + //uint32 PowerDisplayId; // 234 PowerDisplay.dbc, new in 3.1 + //float unk_320_4[3]; // 235-237 3.2.0 + //uint32 spellDescriptionVariablesID; // 238 3.2.0 // helpers int32 CalculateSimpleValue(uint8 eff) const { return EffectBasePoints[eff]+int32(EffectBaseDice[eff]); } diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index f7b63774d..87e1a5b30 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -1161,12 +1161,9 @@ void WorldSession::HandleWardenDataOpcode(WorldPacket& /*recv_data*/) void WorldSession::HandlePlayedTime(WorldPacket& /*recv_data*/) { - uint32 TotalTimePlayed = GetPlayer()->GetTotalPlayedTime(); - uint32 LevelPlayedTime = GetPlayer()->GetLevelPlayedTime(); - - WorldPacket data(SMSG_PLAYED_TIME, 9); - data << TotalTimePlayed; - data << LevelPlayedTime; + WorldPacket data(SMSG_PLAYED_TIME, 4 + 4 + 1); + data << uint32(_player->GetTotalPlayedTime()); + data << uint32(_player->GetLevelPlayedTime()); data << uint8(0); SendPacket(&data); } @@ -1261,7 +1258,7 @@ void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recv_data) DEBUG_LOG("Time %u sec, map=%u, x=%f, y=%f, z=%f, orient=%f", time/1000, mapid, PositionX, PositionY, PositionZ, Orientation); if (GetSecurity() >= SEC_ADMINISTRATOR) - GetPlayer()->TeleportTo(mapid,PositionX,PositionY,PositionZ,Orientation); + GetPlayer()->TeleportTo(mapid, PositionX, PositionY, PositionZ, Orientation); else SendNotification(LANG_YOU_NOT_HAVE_PERMISSION); sLog.outDebug("Received worldport command from player %s", GetPlayer()->GetName()); diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp index c37e5c3bf..bba16de8e 100644 --- a/src/game/Opcodes.cpp +++ b/src/game/Opcodes.cpp @@ -1293,4 +1293,6 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x4F0*/ { "SMSG_UNKNOWN_1264", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x4F1*/ { "UMSG_UNKNOWN_1265", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4F2*/ { "UMSG_UNKNOWN_1266", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4F3*/ { "UMSG_UNKNOWN_1267", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4F4*/ { "UMSG_UNKNOWN_1268", STATUS_NEVER, &WorldSession::Handle_NULL }, }; diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h index e405e7017..267daaa26 100644 --- a/src/game/Opcodes.h +++ b/src/game/Opcodes.h @@ -1301,7 +1301,9 @@ enum Opcodes SMSG_UNKNOWN_1264 = 0x4F0, UMSG_UNKNOWN_1265 = 0x4F1, // not found 3.2 UMSG_UNKNOWN_1266 = 0x4F2, // not found 3.2 - NUM_MSG_TYPES = 0x4F3 + UMSG_UNKNOWN_1267 = 0x4F3, // not found 3.2 + UMSG_UNKNOWN_1268 = 0x4F4, // not found 3.2 + NUM_MSG_TYPES = 0x4F5 }; /// Player state diff --git a/src/game/SpellAuraDefines.h b/src/game/SpellAuraDefines.h index 9254468ca..e3f6ab630 100644 --- a/src/game/SpellAuraDefines.h +++ b/src/game/SpellAuraDefines.h @@ -337,7 +337,19 @@ enum AuraType SPELL_AURA_292, SPELL_AURA_293, SPELL_AURA_294, - TOTAL_AURAS = 295 + SPELL_AURA_295, + SPELL_AURA_296, + SPELL_AURA_297, + SPELL_AURA_298, + SPELL_AURA_299, + SPELL_AURA_300, + SPELL_AURA_301, + SPELL_AURA_302, + SPELL_AURA_303, + SPELL_AURA_304, + SPELL_AURA_305, + SPELL_AURA_306, + TOTAL_AURAS = 307 }; enum AreaAuraType diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index df1cd5497..0c9e16931 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -311,8 +311,8 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleNULL, //258 SPELL_AURA_MOD_SPELL_VISUAL &Aura::HandleNULL, //259 corrupt healing over time spell &Aura::HandleNoImmediateEffect, //260 SPELL_AURA_SCREEN_EFFECT (miscvalue = id in ScreenEffect.dbc) not required any code - &Aura::HandlePhase, //261 SPELL_AURA_PHASE undetactable invisibility? implemented in Unit::isVisibleForOrDetect - &Aura::HandleNULL, //262 + &Aura::HandlePhase, //261 SPELL_AURA_PHASE undetectable invisibility? implemented in Unit::isVisibleForOrDetect + &Aura::HandleNULL, //262 ignore combat/aura state? &Aura::HandleNULL, //263 SPELL_AURA_ALLOW_ONLY_ABILITY player can use only abilities set in SpellClassMask &Aura::HandleUnused, //264 unused (3.0.8a) &Aura::HandleUnused, //265 unused (3.0.8a) @@ -323,7 +323,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleNULL, //270 SPELL_AURA_MOD_IGNORE_TARGET_RESIST &Aura::HandleNoImmediateEffect, //271 SPELL_AURA_MOD_DAMAGE_FROM_CASTER implemented in Unit::SpellDamageBonus &Aura::HandleNULL, //272 reduce spell cast time? - &Aura::HandleNULL, //273 + &Aura::HandleNULL, //273 x-ray effect &Aura::HandleNULL, //274 proc free shot? &Aura::HandleNoImmediateEffect, //275 SPELL_AURA_MOD_IGNORE_SHAPESHIFT Use SpellClassMask for spell select &Aura::HandleNULL, //276 mod damage % mechanic? @@ -334,17 +334,29 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleNULL, //281 SPELL_AURA_MOD_HONOR_GAIN &Aura::HandleAuraIncreaseBaseHealthPercent, //282 SPELL_AURA_INCREASE_BASE_HEALTH_PERCENT &Aura::HandleNoImmediateEffect, //283 SPELL_AURA_MOD_HEALING_RECEIVED implemented in Unit::SpellHealingBonus - &Aura::HandleUnused, //284 not used by any spells (3.08a) + &Aura::HandleUnused, //284 51 spells &Aura::HandleAuraModAttackPowerOfArmor, //285 SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR implemented in Player::UpdateAttackPowerAndDamage &Aura::HandleNoImmediateEffect, //286 SPELL_AURA_ABILITY_PERIODIC_CRIT implemented in Aura::IsCritFromAbilityAura called from Aura::PeriodicTick &Aura::HandleNoImmediateEffect, //287 SPELL_AURA_DEFLECT_SPELLS implemented in Unit::MagicSpellHitResult and Unit::MeleeSpellHitResult - &Aura::HandleUnused, //288 not used by any spells (3.09) except 1 test spell. + &Aura::HandleUnused, //288 increase parry/deflect, prevent attack &Aura::HandleUnused, //289 unused - &Aura::HandleUnused, //290 unused - &Aura::HandleUnused, //291 unused + &Aura::HandleUnused, //290 3 spells + &Aura::HandleUnused, //291 1 spell (+pct experience bonus) &Aura::HandleNULL, //292 call stabled pet - &Aura::HandleNULL, //293 2 test spells - &Aura::HandleNULL //294 2 spells, possible prevent mana regen + &Aura::HandleNULL, //293 3 spells + &Aura::HandleNULL, //294 2 spells, possible prevent mana regen + &Aura::HandleNULL, //295 unused + &Aura::HandleNULL, //296 2 spells + &Aura::HandleNULL, //297 1 spell (counter spell school?) + &Aura::HandleNULL, //298 unused + &Aura::HandleNULL, //299 unused + &Aura::HandleNULL, //300 3 spells (share damage?) + &Aura::HandleNULL, //301 5 spells + &Aura::HandleNULL, //302 unused + &Aura::HandleNULL, //303 17 spells + &Aura::HandleNULL, //304 2 spells (alcohol effect?) + &Aura::HandleNULL, //305 2 spells + &Aura::HandleNULL //306 1 spell }; static AuraType const frozenAuraTypes[] = { SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_STUN, SPELL_AURA_NONE }; From 43635162996048ac68cc2b513b5f349ad7e2c9fd Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sat, 11 Jul 2009 12:09:42 +0400 Subject: [PATCH 049/132] Replaced some hardcoded values with enum. --- src/game/ArenaTeam.cpp | 32 +++++++++--------- src/game/ArenaTeam.h | 2 +- src/game/BattleGroundHandler.cpp | 2 +- src/game/CharacterHandler.cpp | 2 +- src/game/Player.cpp | 57 ++++++++++++++++---------------- src/game/Player.h | 19 ++++++++--- 6 files changed, 63 insertions(+), 51 deletions(-) diff --git a/src/game/ArenaTeam.cpp b/src/game/ArenaTeam.cpp index 62662718d..a95ae5db7 100644 --- a/src/game/ArenaTeam.cpp +++ b/src/game/ArenaTeam.cpp @@ -138,11 +138,11 @@ bool ArenaTeam::AddMember(const uint64& PlayerGuid) { pl->SetInArenaTeam(Id, GetSlot()); pl->SetArenaTeamIdInvited(0); - pl->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * 7) + 5, newmember.personal_rating ); + pl->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING, newmember.personal_rating ); // hide promote/remove buttons if(CaptainGuid != PlayerGuid) - pl->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * 7) + 1, 1); + pl->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_MEMBER, 1); } return true; } @@ -238,7 +238,7 @@ void ArenaTeam::SetCaptain(const uint64& guid) // disable remove/promote buttons Player *oldcaptain = objmgr.GetPlayer(GetCaptain()); if(oldcaptain) - oldcaptain->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 1 + (GetSlot() * 7), 1); + oldcaptain->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_MEMBER, 1); // set new captain CaptainGuid = guid; @@ -249,7 +249,7 @@ void ArenaTeam::SetCaptain(const uint64& guid) // enable remove/promote buttons Player *newcaptain = objmgr.GetPlayer(guid); if(newcaptain) - newcaptain->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 1 + (GetSlot() * 7), 0); + newcaptain->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_MEMBER, 0); } void ArenaTeam::DelMember(uint64 guid) @@ -270,9 +270,9 @@ void ArenaTeam::DelMember(uint64 guid) player->SetInArenaTeam(0, GetSlot()); player->GetSession()->SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, GetName(), "", 0); // delete all info regarding this team - for(int i = 0; i < 6; ++i) + for(int i = 0; i < ARENA_TEAM_END; ++i) { - player->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * 7) + i, 0); + player->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + i, 0); } } @@ -565,11 +565,11 @@ void ArenaTeam::MemberLost(Player * plr, uint32 againstRating) int32 mod = (int32)ceil(32.0f * (0.0f - chance)); itr->ModifyPersonalRating(plr, mod, GetSlot()); // update personal played stats - itr->games_week +=1; - itr->games_season +=1; + itr->games_week += 1; + itr->games_season += 1; // update the unit fields - plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 7 * GetSlot() + 2, itr->games_week); - plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 7 * GetSlot() + 3, itr->games_season); + plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_GAMES_WEEK, itr->games_week); + plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_GAMES_SEASON, itr->games_season); return; } } @@ -590,8 +590,8 @@ void ArenaTeam::OfflineMemberLost(uint64 guid, uint32 againstRating) else itr->personal_rating += mod; // update personal played stats - itr->games_week +=1; - itr->games_season +=1; + itr->games_week += 1; + itr->games_season += 1; return; } } @@ -609,13 +609,13 @@ void ArenaTeam::MemberWon(Player * plr, uint32 againstRating) int32 mod = (int32)floor(32.0f * (1.0f - chance)); itr->ModifyPersonalRating(plr, mod, GetSlot()); // update personal stats - itr->games_week +=1; - itr->games_season +=1; + itr->games_week += 1; + itr->games_season += 1; itr->wins_season += 1; itr->wins_week += 1; // update unit fields - plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 7 * GetSlot() + 2, itr->games_week); - plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 7 * GetSlot() + 3, itr->games_season); + plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_GAMES_WEEK, itr->games_week); + plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_GAMES_SEASON, itr->games_season); return; } } diff --git a/src/game/ArenaTeam.h b/src/game/ArenaTeam.h index 775dc9b07..629b89d99 100644 --- a/src/game/ArenaTeam.h +++ b/src/game/ArenaTeam.h @@ -101,7 +101,7 @@ struct ArenaTeamMember else personal_rating += mod; if(plr) - plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot*7) + 5, personal_rating); + plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING, personal_rating); } }; diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp index d37a38572..cedf18a3c 100644 --- a/src/game/BattleGroundHandler.cpp +++ b/src/game/BattleGroundHandler.cpp @@ -726,7 +726,7 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data ) Player *member = itr->getSource(); // calc avg personal rating - avg_pers_rating += member->GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaslot * 7) + 5); + avg_pers_rating += member->GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaslot * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING); } if (arenatype) diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index 0f395144a..d9eae3a94 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -78,7 +78,7 @@ bool LoginQueryHolder::Initialize() res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADDECLINEDNAMES, "SELECT genitive, dative, accusative, instrumental, prepositional FROM character_declinedname WHERE guid = '%u'",GUID_LOPART(m_guid)); // in other case still be dummy query res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGUILD, "SELECT guildid,rank FROM guild_member WHERE guid = '%u'", GUID_LOPART(m_guid)); - res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADARENAINFO, "SELECT arenateamid, played_week, played_season, personal_rating FROM arena_team_member WHERE guid='%u'", GUID_LOPART(m_guid)); + res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADARENAINFO, "SELECT arenateamid, played_week, played_season, wons_season, personal_rating FROM arena_team_member WHERE guid='%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS, "SELECT achievement, date FROM character_achievement WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS,"SELECT criteria, counter, date FROM character_achievement_progress WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS, "SELECT setguid, setindex, name, iconname, item0, item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16, item17, item18 FROM character_equipmentsets WHERE guid = '%u' ORDER BY setindex", GUID_LOPART(m_guid)); diff --git a/src/game/Player.cpp b/src/game/Player.cpp index c962deca1..d5059f863 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -13869,7 +13869,7 @@ void Player::_LoadDeclinedNames(QueryResult* result) void Player::_LoadArenaTeamInfo(QueryResult *result) { // arenateamid, played_week, played_season, personal_rating - memset((void*)&m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1], 0, sizeof(uint32)*21); + memset((void*)&m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1], 0, sizeof(uint32) * MAX_ARENA_SLOT * ARENA_TEAM_END); if (!result) return; @@ -13880,7 +13880,8 @@ void Player::_LoadArenaTeamInfo(QueryResult *result) uint32 arenateamid = fields[0].GetUInt32(); uint32 played_week = fields[1].GetUInt32(); uint32 played_season = fields[2].GetUInt32(); - uint32 personal_rating = fields[3].GetUInt32(); + uint32 wons_season = fields[3].GetUInt32(); + uint32 personal_rating = fields[4].GetUInt32(); ArenaTeam* aTeam = objmgr.GetArenaTeamById(arenateamid); if(!aTeam) @@ -13890,15 +13891,15 @@ void Player::_LoadArenaTeamInfo(QueryResult *result) } uint8 arenaSlot = aTeam->GetSlot(); - m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + arenaSlot * 7 + 0] = arenateamid; // TeamID - m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + arenaSlot * 7 + 1] = ((aTeam->GetCaptain() == GetGUID()) ? (uint32)0 : (uint32)1); // Captain 0, member 1 - m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + arenaSlot * 7 + 2] = played_week; // Played Week - m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + arenaSlot * 7 + 3] = played_season; // Played Season - m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + arenaSlot * 7 + 4] = 0; // Unk - m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + arenaSlot * 7 + 5] = personal_rating; // Personal Rating - m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + arenaSlot * 7 + 6] = 0; // unk + m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaSlot * ARENA_TEAM_END) + ARENA_TEAM_ID] = arenateamid; // TeamID + m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaSlot * ARENA_TEAM_END) + ARENA_TEAM_MEMBER] = ((aTeam->GetCaptain() == GetGUID()) ? (uint32)0 : (uint32)1); // Captain 0, member 1 + m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaSlot * ARENA_TEAM_END) + ARENA_TEAM_GAMES_WEEK] = played_week; // Played Week + m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaSlot * ARENA_TEAM_END) + ARENA_TEAM_GAMES_SEASON] = played_season; // Played Season + m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaSlot * ARENA_TEAM_END) + ARENA_TEAM_WINS_SEASON] = wons_season; // wins season + m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaSlot * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING] = personal_rating; // Personal Rating + m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaSlot * ARENA_TEAM_END) + ARENA_TEAM_UNK2] = 0; // unk 3.2 - }while (result->NextRow()); + } while (result->NextRow()); delete result; } @@ -14130,8 +14131,8 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) continue; // arena team not exist or not member, cleanup fields - for(int j = 0; j < 7; ++j) - SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + arena_slot * 7 + j, 0); + for(int j = 0; j < ARENA_TEAM_END; ++j) + SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arena_slot * ARENA_TEAM_END) + j, 0); } _LoadBoundInstances(holder->GetResult(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES)); @@ -17321,10 +17322,10 @@ bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint uint32 new_count = pCreature->UpdateVendorItemCurrentCount(crItem,pProto->BuyCount * count); WorldPacket data(SMSG_BUY_ITEM, (8+4+4+4)); - data << pCreature->GetGUID(); - data << (uint32)(vendor_slot+1); // numbered from 1 at client - data << (uint32)(crItem->maxcount > 0 ? new_count : 0xFFFFFFFF); - data << (uint32)count; + data << uint64(pCreature->GetGUID()); + data << uint32(vendor_slot+1); // numbered from 1 at client + data << uint32(crItem->maxcount > 0 ? new_count : 0xFFFFFFFF); + data << uint32(count); GetSession()->SendPacket(&data); SendNewItem(it, pProto->BuyCount*count, true, false, false); @@ -17366,10 +17367,10 @@ bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint uint32 new_count = pCreature->UpdateVendorItemCurrentCount(crItem,pProto->BuyCount * count); WorldPacket data(SMSG_BUY_ITEM, (8+4+4+4)); - data << pCreature->GetGUID(); - data << (uint32)(vendor_slot+1); // numbered from 1 at client - data << (uint32)(crItem->maxcount > 0 ? new_count : 0xFFFFFFFF); - data << (uint32)count; + data << uint64(pCreature->GetGUID()); + data << uint32(vendor_slot + 1); // numbered from 1 at client + data << uint32(crItem->maxcount > 0 ? new_count : 0xFFFFFFFF); + data << uint32(count); GetSession()->SendPacket(&data); SendNewItem(it, pProto->BuyCount*count, true, false, false); @@ -17396,9 +17397,9 @@ uint32 Player::GetMaxPersonalArenaRatingRequirement() { if(ArenaTeam * at = objmgr.GetArenaTeamById(GetArenaTeamId(i))) { - uint32 p_rating = GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (i * 7) + 5); + uint32 p_rating = GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (i * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING); uint32 t_rating = at->GetRating(); - p_rating = p_ratingSendPacket(&data); sLog.outDebug("PLAYER: Player '%s' (GUID: %u) will be teleported to homebind in 60 seconds", GetName(),GetGUIDLow()); @@ -17568,12 +17569,12 @@ void Player::AddSpellCooldown(uint32 spellid, uint32 itemid, time_t end_time) void Player::SendCooldownEvent(SpellEntry const *spellInfo, uint32 itemId, Spell* spell) { // start cooldowns at server side, if any - AddSpellAndCategoryCooldowns(spellInfo,itemId,spell); + AddSpellAndCategoryCooldowns(spellInfo, itemId, spell); // Send activate cooldown timer (possible 0) at client side WorldPacket data(SMSG_COOLDOWN_EVENT, (4+8)); - data << spellInfo->Id; - data << GetGUID(); + data << uint32(spellInfo->Id); + data << uint64(GetGUID()); SendDirectMessage(&data); } @@ -17719,7 +17720,7 @@ void Player::CorrectMetaGemEnchants(uint8 exceptslot, bool apply) { // ignore item gem conditions //if state changed, (dis)apply enchant - ApplyEnchantment(pItem,EnchantmentSlot(enchant_slot),!wasactive,true,true); + ApplyEnchantment(pItem, EnchantmentSlot(enchant_slot), !wasactive, true, true); } } } @@ -17810,7 +17811,7 @@ void Player::ReportedAfkBy(Player* reporter) return; // check if player has 'Idle' or 'Inactive' debuff - if(m_bgAfkReporter.find(reporter->GetGUIDLow())==m_bgAfkReporter.end() && !HasAura(43680,0) && !HasAura(43681,0) && reporter->CanReportAfkDueToLimit()) + if(m_bgAfkReporter.find(reporter->GetGUIDLow()) == m_bgAfkReporter.end() && !HasAura(43680,0) && !HasAura(43681,0) && reporter->CanReportAfkDueToLimit()) { m_bgAfkReporter.insert(reporter->GetGUIDLow()); // 3 players have to complain to apply debuff diff --git a/src/game/Player.h b/src/game/Player.h index 5ffb8323d..b3ec48982 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -510,8 +510,6 @@ enum ActivateTaxiReplies ERR_TAXINOTSTANDING = 12 }; - - enum MirrorTimerType { FATIGUE_TIMER = 0, @@ -719,6 +717,19 @@ enum InstanceResetWarningType RAID_INSTANCE_EXPIRED = 5 }; +// PLAYER_FIELD_ARENA_TEAM_INFO_1_1 offsets +enum ArenaTeamInfoType +{ + ARENA_TEAM_ID = 0, + ARENA_TEAM_MEMBER = 1, // 0 - captain, 1 - member + ARENA_TEAM_GAMES_WEEK = 2, + ARENA_TEAM_GAMES_SEASON = 3, + ARENA_TEAM_WINS_SEASON = 4, + ARENA_TEAM_PERSONAL_RATING = 5, + ARENA_TEAM_UNK2 = 6, // new in 3.2 + ARENA_TEAM_END = 7 +}; + // used in most movement packets (send and received) enum MovementFlags { @@ -1609,9 +1620,9 @@ class MANGOS_DLL_SPEC Player : public Unit // Arena Team void SetInArenaTeam(uint32 ArenaTeamId, uint8 slot) { - SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * 7), ArenaTeamId); + SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END), ArenaTeamId); } - uint32 GetArenaTeamId(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * 7)); } + uint32 GetArenaTeamId(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END)); } static uint32 GetArenaTeamIdFromDB(uint64 guid, uint8 slot); void SetArenaTeamIdInvited(uint32 ArenaTeamId) { m_ArenaTeamIdInvited = ArenaTeamId; } uint32 GetArenaTeamIdInvited() { return m_ArenaTeamIdInvited; } From 3de88aef12f77c79b6bb2c5a2e28840e4cf2115d Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Fri, 17 Jul 2009 17:01:47 +0400 Subject: [PATCH 050/132] Updated to 10116 client build. --- src/game/DBCStructure.h | 1 + src/game/DBCfmt.h | 2 +- src/game/ItemHandler.cpp | 2 +- src/game/MovementHandler.cpp | 1 + src/game/Opcodes.h | 4 ++-- src/game/Player.cpp | 2 +- src/game/Player.h | 1 + src/game/UpdateFields.h | 2 +- src/game/WorldSession.cpp | 3 +++ src/realmd/AuthCodes.h | 4 ++-- 10 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index 312b5b034..b67a88d2e 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -1729,6 +1729,7 @@ struct WorldMapAreaEntry float x2; // 7 int32 virtual_map_id; // 8 -1 (map_id have correct map) other: virtual map where zone show (map_id - where zone in fact internally) // int32 dungeonMap_id; // 9 pointer to DungeonMap.dbc (owerride x1,x2,y1,y2 coordinates) + // uint32 someMapID; // 10 }; #define MAX_WORLD_MAP_OVERLAY_AREA_IDX 4 diff --git a/src/game/DBCfmt.h b/src/game/DBCfmt.h index 9bd198ad9..9f4b3d9f1 100644 --- a/src/game/DBCfmt.h +++ b/src/game/DBCfmt.h @@ -101,7 +101,7 @@ const char TaxiPathNodeEntryfmt[]="diiifffiixx"; const char TotemCategoryEntryfmt[]="nxxxxxxxxxxxxxxxxxii"; const char VehicleEntryfmt[]="niffffiiiiiiiifffffffffffffffssssfifixxx"; const char VehicleSeatEntryfmt[]="niiffffffffffiiiiiifffffffiiifffiiiiiiiffiiiiixxxxxxxxxxxx"; -const char WorldMapAreaEntryfmt[]="xinxffffix"; +const char WorldMapAreaEntryfmt[]="xinxffffixx"; const char WorldMapOverlayEntryfmt[]="nxiiiixxxxxxxxxxx"; const char WorldSafeLocsEntryfmt[]="nifffxxxxxxxxxxxxxxxxx"; diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp index b9b919174..4d8866707 100644 --- a/src/game/ItemHandler.cpp +++ b/src/game/ItemHandler.cpp @@ -68,7 +68,7 @@ void WorldSession::HandleSwapInvItemOpcode( WorldPacket & recv_data ) //sLog.outDebug("WORLD: CMSG_SWAP_INV_ITEM"); uint8 srcslot, dstslot; - recv_data >> srcslot >> dstslot; + recv_data >> dstslot >> srcslot; //sLog.outDebug("STORAGE: receive srcslot = %u, dstslot = %u", srcslot, dstslot); // prevent attempt swap same item to current position generated by client at special checting sequence diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index f71683e5b..694d8c5fc 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -211,6 +211,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data ) { uint32 opcode = recv_data.GetOpcode(); sLog.outDebug("WORLD: Recvd %s (%u, 0x%X) opcode", LookupOpcodeName(opcode), opcode, opcode); + recv_data.hexlike(); Unit *mover = _player->m_mover; Player *plMover = mover->GetTypeId()==TYPEID_PLAYER ? (Player*)mover : NULL; diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h index 267daaa26..833b451e9 100644 --- a/src/game/Opcodes.h +++ b/src/game/Opcodes.h @@ -1275,8 +1275,8 @@ enum Opcodes SMSG_EQUIPMENT_SET_USE_RESULT = 0x4D6, // SMSG, UseEquipmentSetResult? UMSG_UNKNOWN_1239 = 0x4D7, // not found 3.2 SMSG_UNKNOWN_1240 = 0x4D8, // SMSG, uint64, string - CMSG_UNKNOWN_1241 = 0x4D9, // lua: CreateCharacter - SMSG_UNKNOWN_1242 = 0x4DA, // response to 1241 + CMSG_UNKNOWN_1241 = 0x4D9, // lua: CreateCharacter (PFC client response) + SMSG_UNKNOWN_1242 = 0x4DA, // response to 1241 (PFC server response) UMSG_UNKNOWN_1243 = 0x4DB, // not found 3.2 UMSG_UNKNOWN_1244 = 0x4DC, // not found 3.2 UMSG_UNKNOWN_1245 = 0x4DD, // not found 3.2 diff --git a/src/game/Player.cpp b/src/game/Player.cpp index ee0e49691..c1f7453bf 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -1449,7 +1449,7 @@ bool Player::BuildEnumData( QueryResult * result, WorldPacket * p_data ) *p_data << uint32(char_flags); // character flags // character customize (flags?) - *p_data << uint32(atLoginFlags & AT_LOGIN_CUSTOMIZE ? 1 : 0); + *p_data << uint32(atLoginFlags & AT_LOGIN_CUSTOMIZE ? 1 : 0);// 0x00010000 - faction change *p_data << uint8(1); // unknown *p_data << uint8(0); // 3.2 diff --git a/src/game/Player.h b/src/game/Player.h index 64531af0e..4af54f0ed 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -765,6 +765,7 @@ enum MovementFlags struct MovementInfo { // common + uint64 guid; uint32 flags; // see enum MovementFlags uint16 unk1; uint32 time; diff --git a/src/game/UpdateFields.h b/src/game/UpdateFields.h index abc51246d..1d9e86591 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, 2, 0, 10083 +// Auto generated for version 0, 2, 0, 10116 enum EObjectFields { diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index 798147fe8..ac8f661b3 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -626,6 +626,9 @@ void WorldSession::SaveTutorialsData() void WorldSession::ReadMovementInfo(WorldPacket &data, MovementInfo *mi) { + if(!data.readPackGUID(mi->guid)) + return; + CHECK_PACKET_SIZE(data, data.rpos()+4+2+4+4+4+4+4); data >> mi->flags; data >> mi->unk1; diff --git a/src/realmd/AuthCodes.h b/src/realmd/AuthCodes.h index 625f1844f..a740fa3c1 100644 --- a/src/realmd/AuthCodes.h +++ b/src/realmd/AuthCodes.h @@ -66,8 +66,8 @@ enum LoginResult // 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.2.0 client build 10083... +// will only support WoW, WoW:TBC and WoW:WotLK 3.2.0 client build 10116... -#define EXPECTED_MANGOS_CLIENT_BUILD {10083, 0} +#define EXPECTED_MANGOS_CLIENT_BUILD {10116, 0} #endif From 09907c8e61d789646d8bc9478d861c95935e5771 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Tue, 21 Jul 2009 23:19:24 +0400 Subject: [PATCH 051/132] Updated to 10128 client build. --- src/game/SharedDefines.h | 75 +++++++++++++++++++++------------------- src/game/UpdateFields.h | 2 +- src/realmd/AuthCodes.h | 4 +-- 3 files changed, 43 insertions(+), 38 deletions(-) diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 2485c1efa..f497f030e 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -2232,8 +2232,8 @@ enum ChatMsg CHAT_MSG_OFFICER = 0x05, CHAT_MSG_YELL = 0x06, CHAT_MSG_WHISPER = 0x07, - CHAT_MSG_WHISPER_INFORM = 0x08, - CHAT_MSG_REPLY = 0x09, + CHAT_MSG_WHISPER_INFORM = 0x08, // WHISPER_FOREIGN? + CHAT_MSG_REPLY = 0x09, // WHISPER_INFORM? CHAT_MSG_EMOTE = 0x0A, CHAT_MSG_TEXT_EMOTE = 0x0B, CHAT_MSG_MONSTER_SAY = 0x0C, @@ -2456,42 +2456,47 @@ enum ResponseCodes CHAR_CREATE_EXPANSION_CLASS = 0x3A, CHAR_CREATE_LEVEL_REQUIREMENT = 0x3B, CHAR_CREATE_UNIQUE_CLASS_LIMIT = 0x3C, + CHAR_CREATE_CHARACTER_IN_GUILD = 0x3D, + CHAR_CREATE_RESTRICTED_RACECLASS = 0x3E, + CHAR_CREATE_CHARACTER_CHOOSE_RACE = 0x3F, + CHAR_CREATE_CHARACTER_ARENA_LEADER = 0x40, + CHAR_CREATE_CHARACTER_DELETE_MAIL = 0x41, - CHAR_DELETE_IN_PROGRESS = 0x3D, - CHAR_DELETE_SUCCESS = 0x3E, - CHAR_DELETE_FAILED = 0x3F, - CHAR_DELETE_FAILED_LOCKED_FOR_TRANSFER = 0x40, - CHAR_DELETE_FAILED_GUILD_LEADER = 0x41, - CHAR_DELETE_FAILED_ARENA_CAPTAIN = 0x42, + CHAR_DELETE_IN_PROGRESS = 0x42, + CHAR_DELETE_SUCCESS = 0x43, + CHAR_DELETE_FAILED = 0x44, + CHAR_DELETE_FAILED_LOCKED_FOR_TRANSFER = 0x45, + CHAR_DELETE_FAILED_GUILD_LEADER = 0x46, + CHAR_DELETE_FAILED_ARENA_CAPTAIN = 0x47, - CHAR_LOGIN_IN_PROGRESS = 0x43, - CHAR_LOGIN_SUCCESS = 0x44, - CHAR_LOGIN_NO_WORLD = 0x45, - CHAR_LOGIN_DUPLICATE_CHARACTER = 0x46, - CHAR_LOGIN_NO_INSTANCES = 0x47, - CHAR_LOGIN_FAILED = 0x48, - CHAR_LOGIN_DISABLED = 0x49, - CHAR_LOGIN_NO_CHARACTER = 0x4A, - CHAR_LOGIN_LOCKED_FOR_TRANSFER = 0x4B, - CHAR_LOGIN_LOCKED_BY_BILLING = 0x4C, + CHAR_LOGIN_IN_PROGRESS = 0x48, + CHAR_LOGIN_SUCCESS = 0x49, + CHAR_LOGIN_NO_WORLD = 0x4A, + CHAR_LOGIN_DUPLICATE_CHARACTER = 0x4B, + CHAR_LOGIN_NO_INSTANCES = 0x4C, + CHAR_LOGIN_FAILED = 0x4D, + CHAR_LOGIN_DISABLED = 0x4E, + CHAR_LOGIN_NO_CHARACTER = 0x4F, + CHAR_LOGIN_LOCKED_FOR_TRANSFER = 0x50, + CHAR_LOGIN_LOCKED_BY_BILLING = 0x51, - CHAR_NAME_SUCCESS = 0x4D, - CHAR_NAME_FAILURE = 0x4E, - CHAR_NAME_NO_NAME = 0x4F, - CHAR_NAME_TOO_SHORT = 0x50, - CHAR_NAME_TOO_LONG = 0x51, - CHAR_NAME_INVALID_CHARACTER = 0x52, - CHAR_NAME_MIXED_LANGUAGES = 0x53, - CHAR_NAME_PROFANE = 0x54, - CHAR_NAME_RESERVED = 0x55, - CHAR_NAME_INVALID_APOSTROPHE = 0x56, - CHAR_NAME_MULTIPLE_APOSTROPHES = 0x57, - CHAR_NAME_THREE_CONSECUTIVE = 0x58, - CHAR_NAME_INVALID_SPACE = 0x59, - CHAR_NAME_CONSECUTIVE_SPACES = 0x5A, - CHAR_NAME_RUSSIAN_CONSECUTIVE_SILENT_CHARACTERS = 0x5B, - CHAR_NAME_RUSSIAN_SILENT_CHARACTER_AT_BEGINNING_OR_END = 0x5C, - CHAR_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME = 0x5D + CHAR_NAME_SUCCESS = 0x52, + CHAR_NAME_FAILURE = 0x53, + CHAR_NAME_NO_NAME = 0x54, + CHAR_NAME_TOO_SHORT = 0x55, + CHAR_NAME_TOO_LONG = 0x56, + CHAR_NAME_INVALID_CHARACTER = 0x57, + CHAR_NAME_MIXED_LANGUAGES = 0x58, + CHAR_NAME_PROFANE = 0x59, + CHAR_NAME_RESERVED = 0x5A, + CHAR_NAME_INVALID_APOSTROPHE = 0x5B, + CHAR_NAME_MULTIPLE_APOSTROPHES = 0x5C, + CHAR_NAME_THREE_CONSECUTIVE = 0x5D, + CHAR_NAME_INVALID_SPACE = 0x5E, + CHAR_NAME_CONSECUTIVE_SPACES = 0x5F, + CHAR_NAME_RUSSIAN_CONSECUTIVE_SILENT_CHARACTERS = 0x60, + CHAR_NAME_RUSSIAN_SILENT_CHARACTER_AT_BEGINNING_OR_END = 0x61, + CHAR_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME = 0x62 }; /// Ban function modes diff --git a/src/game/UpdateFields.h b/src/game/UpdateFields.h index 1d9e86591..7df000b89 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, 2, 0, 10116 +// Auto generated for version 0, 2, 0, 10128 enum EObjectFields { diff --git a/src/realmd/AuthCodes.h b/src/realmd/AuthCodes.h index a740fa3c1..f1c7506fe 100644 --- a/src/realmd/AuthCodes.h +++ b/src/realmd/AuthCodes.h @@ -66,8 +66,8 @@ enum LoginResult // 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.2.0 client build 10116... +// will only support WoW, WoW:TBC and WoW:WotLK 3.2.0 client build 10128... -#define EXPECTED_MANGOS_CLIENT_BUILD {10116, 0} +#define EXPECTED_MANGOS_CLIENT_BUILD {10128, 0} #endif From a26e90019b575648fff6813c88f31684a9b2578a Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Wed, 22 Jul 2009 01:24:22 +0400 Subject: [PATCH 052/132] /played command should work once again. --- src/game/ItemHandler.cpp | 152 +++++++++++++++++++-------------------- src/game/MiscHandler.cpp | 2 +- 2 files changed, 77 insertions(+), 77 deletions(-) diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp index 4d8866707..e2c1affac 100644 --- a/src/game/ItemHandler.cpp +++ b/src/game/ItemHandler.cpp @@ -29,7 +29,7 @@ void WorldSession::HandleSplitItemOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,1+1+1+1+1); + CHECK_PACKET_SIZE(recv_data, 1+1+1+1+1); //sLog.outDebug("WORLD: CMSG_SPLIT_ITEM"); uint8 srcbag, srcslot, dstbag, dstslot, count; @@ -40,19 +40,19 @@ void WorldSession::HandleSplitItemOpcode( WorldPacket & recv_data ) uint16 src = ( (srcbag << 8) | srcslot ); uint16 dst = ( (dstbag << 8) | dstslot ); - if(src==dst) + if(src == dst) return; - if (count==0) + if (count == 0) return; //check count - if zero it's fake packet - if(!_player->IsValidPos(srcbag,srcslot)) + if(!_player->IsValidPos(srcbag, srcslot)) { _player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL ); return; } - if(!_player->IsValidPos(dstbag,dstslot)) + if(!_player->IsValidPos(dstbag, dstslot)) { _player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL ); return; @@ -63,7 +63,7 @@ void WorldSession::HandleSplitItemOpcode( WorldPacket & recv_data ) void WorldSession::HandleSwapInvItemOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,1+1); + CHECK_PACKET_SIZE(recv_data, 1+1); //sLog.outDebug("WORLD: CMSG_SWAP_INV_ITEM"); uint8 srcslot, dstslot; @@ -71,11 +71,11 @@ void WorldSession::HandleSwapInvItemOpcode( WorldPacket & recv_data ) recv_data >> dstslot >> srcslot; //sLog.outDebug("STORAGE: receive srcslot = %u, dstslot = %u", srcslot, dstslot); - // prevent attempt swap same item to current position generated by client at special checting sequence - if(srcslot==dstslot) + // prevent attempt swap same item to current position generated by client at special cheating sequence + if(srcslot == dstslot) return; - if(!_player->IsValidPos(INVENTORY_SLOT_BAG_0,srcslot)) + if(!_player->IsValidPos(INVENTORY_SLOT_BAG_0, srcslot)) { _player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL ); return; @@ -95,7 +95,7 @@ void WorldSession::HandleSwapInvItemOpcode( WorldPacket & recv_data ) void WorldSession::HandleAutoEquipItemSlotOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8+1); + CHECK_PACKET_SIZE(recv_data, 8+1); uint64 itemguid; uint8 dstslot; recv_data >> itemguid >> dstslot; @@ -115,7 +115,7 @@ void WorldSession::HandleAutoEquipItemSlotOpcode( WorldPacket & recv_data ) void WorldSession::HandleSwapItem( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,1+1+1+1); + CHECK_PACKET_SIZE(recv_data, 1+1+1+1); //sLog.outDebug("WORLD: CMSG_SWAP_ITEM"); uint8 dstbag, dstslot, srcbag, srcslot; @@ -126,17 +126,17 @@ void WorldSession::HandleSwapItem( WorldPacket & recv_data ) uint16 src = ( (srcbag << 8) | srcslot ); uint16 dst = ( (dstbag << 8) | dstslot ); - // prevent attempt swap same item to current position generated by client at special checting sequence - if(src==dst) + // prevent attempt swap same item to current position generated by client at special cheating sequence + if(src == dst) return; - if(!_player->IsValidPos(srcbag,srcslot)) + if(!_player->IsValidPos(srcbag, srcslot)) { _player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL ); return; } - if(!_player->IsValidPos(dstbag,dstslot)) + if(!_player->IsValidPos(dstbag, dstslot)) { _player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL ); return; @@ -147,7 +147,7 @@ void WorldSession::HandleSwapItem( WorldPacket & recv_data ) void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,1+1); + CHECK_PACKET_SIZE(recv_data, 1+1); //sLog.outDebug("WORLD: CMSG_AUTOEQUIP_ITEM"); uint8 srcbag, srcslot; @@ -175,7 +175,7 @@ void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data ) } uint16 src = pSrcItem->GetPos(); - if(dest==src) // prevent equip in same slot, only at cheat + if(dest == src) // prevent equip in same slot, only at cheat return; Item *pDstItem = _player->GetItemByPos( dest ); @@ -250,7 +250,7 @@ void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data ) void WorldSession::HandleDestroyItemOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,1+1+1+1+1+1); + CHECK_PACKET_SIZE(recv_data, 1+1+1+1+1+1); //sLog.outDebug("WORLD: CMSG_DESTROYITEM"); uint8 bag, slot, count, data1, data2, data3; @@ -445,7 +445,7 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data ) } else { - sLog.outDebug( "WORLD: CMSG_ITEM_QUERY_SINGLE - NO item INFO! (ENTRY: %u)", item ); + sLog.outDebug( "WORLD: CMSG_ITEM_QUERY_SINGLE - NO item INFO! (ENTRY: %u)", item ); WorldPacket data( SMSG_ITEM_QUERY_SINGLE_RESPONSE, 4); data << uint32(item | 0x80000000); SendPacket( &data ); @@ -454,7 +454,7 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data ) void WorldSession::HandleReadItem( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,1+1); + CHECK_PACKET_SIZE(recv_data, 1+1); //sLog.outDebug( "WORLD: CMSG_READ_ITEM"); @@ -489,9 +489,9 @@ void WorldSession::HandleReadItem( WorldPacket & recv_data ) void WorldSession::HandlePageQuerySkippedOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,4+8); + CHECK_PACKET_SIZE(recv_data, 4+8); - sLog.outDebug( "WORLD: Received CMSG_PAGE_TEXT_QUERY" ); + sLog.outDebug( "WORLD: Received CMSG_PAGE_TEXT_QUERY" ); uint32 itemid; uint64 guid; @@ -504,7 +504,7 @@ void WorldSession::HandlePageQuerySkippedOpcode( WorldPacket & recv_data ) void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8+8+1); + CHECK_PACKET_SIZE(recv_data, 8+8+1); sLog.outDebug( "WORLD: Received CMSG_SELL_ITEM" ); uint64 vendorguid, itemguid; @@ -518,7 +518,7 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data ) if(!itemguid) return; - Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid,UNIT_NPC_FLAG_VENDOR); + Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR); if (!pCreature) { sLog.outDebug( "WORLD: HandleSellItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)) ); @@ -534,7 +534,7 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data ) if( pItem ) { // prevent sell not owner item - if(_player->GetGUID()!=pItem->GetOwnerGUID()) + if(_player->GetGUID() != pItem->GetOwnerGUID()) { _player->SendSellError( SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0); return; @@ -548,20 +548,20 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data ) } // prevent sell currently looted item - if(_player->GetLootGUID()==pItem->GetGUID()) + if(_player->GetLootGUID() == pItem->GetGUID()) { _player->SendSellError( SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0); return; } // special case at auto sell (sell all) - if(count==0) + if(count == 0) { count = pItem->GetCount(); } else { - // prevent sell more items that exist in stack (possable only not from client) + // prevent sell more items that exist in stack (possible only not from client) if(count > pItem->GetCount()) { _player->SendSellError( SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0); @@ -615,15 +615,15 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data ) void WorldSession::HandleBuybackItem(WorldPacket & recv_data) { - CHECK_PACKET_SIZE(recv_data,8+4); + CHECK_PACKET_SIZE(recv_data, 8+4); - sLog.outDebug( "WORLD: Received CMSG_BUYBACK_ITEM" ); + sLog.outDebug( "WORLD: Received CMSG_BUYBACK_ITEM" ); uint64 vendorguid; uint32 slot; recv_data >> vendorguid >> slot; - Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid,UNIT_NPC_FLAG_VENDOR); + Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR); if (!pCreature) { sLog.outDebug( "WORLD: HandleBuybackItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)) ); @@ -664,9 +664,9 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data) void WorldSession::HandleBuyItemInSlotOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8+4+4+8+1+4); + CHECK_PACKET_SIZE(recv_data, 8+4+4+8+1+4); - sLog.outDebug( "WORLD: Received CMSG_BUY_ITEM_IN_SLOT" ); + sLog.outDebug( "WORLD: Received CMSG_BUY_ITEM_IN_SLOT" ); uint64 vendorguid, bagguid; uint32 item, slot, count; uint8 bagslot; @@ -697,26 +697,26 @@ void WorldSession::HandleBuyItemInSlotOpcode( WorldPacket & recv_data ) if (bag == NULL_BAG) return; - GetPlayer()->BuyItemFromVendor(vendorguid,item,count,bag,bagslot); + GetPlayer()->BuyItemFromVendor(vendorguid, item, count, bag, bagslot); } void WorldSession::HandleBuyItemOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8+4+4+4+1); + CHECK_PACKET_SIZE(recv_data, 8+4+4+4+1); - sLog.outDebug( "WORLD: Received CMSG_BUY_ITEM" ); + sLog.outDebug( "WORLD: Received CMSG_BUY_ITEM" ); uint64 vendorguid; uint32 item, slot, count; uint8 unk1; recv_data >> vendorguid >> item >> slot >> count >> unk1; - GetPlayer()->BuyItemFromVendor(vendorguid,item,count,NULL_BAG,NULL_SLOT); + GetPlayer()->BuyItemFromVendor(vendorguid, item, count, NULL_BAG, NULL_SLOT); } void WorldSession::HandleListInventoryOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8); + CHECK_PACKET_SIZE(recv_data, 8); uint64 guid; @@ -725,16 +725,16 @@ void WorldSession::HandleListInventoryOpcode( WorldPacket & recv_data ) if(!GetPlayer()->isAlive()) return; - sLog.outDebug( "WORLD: Recvd CMSG_LIST_INVENTORY" ); + sLog.outDebug( "WORLD: Recvd CMSG_LIST_INVENTORY" ); SendListInventory( guid ); } void WorldSession::SendListInventory( uint64 vendorguid ) { - sLog.outDebug( "WORLD: Sent SMSG_LIST_INVENTORY" ); + sLog.outDebug( "WORLD: Sent SMSG_LIST_INVENTORY" ); - Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid,UNIT_NPC_FLAG_VENDOR); + Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR); if (!pCreature) { sLog.outDebug( "WORLD: SendListInventory - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)) ); @@ -800,7 +800,7 @@ void WorldSession::SendListInventory( uint64 vendorguid ) void WorldSession::HandleAutoStoreBagItemOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,1+1+1); + CHECK_PACKET_SIZE(recv_data, 1+1+1); //sLog.outDebug("WORLD: CMSG_AUTOSTORE_BAG_ITEM"); uint8 srcbag, srcslot, dstbag; @@ -812,7 +812,7 @@ void WorldSession::HandleAutoStoreBagItemOpcode( WorldPacket & recv_data ) if( !pItem ) return; - if(!_player->IsValidPos(dstbag,NULL_SLOT)) + if(!_player->IsValidPos(dstbag, NULL_SLOT)) { _player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL ); return; @@ -840,9 +840,9 @@ void WorldSession::HandleAutoStoreBagItemOpcode( WorldPacket & recv_data ) } // no-op: placed in same slot - if(dest.size()==1 && dest[0].pos==src) + if(dest.size() == 1 && dest[0].pos == src) { - // just remove grey item state + // just remove gray item state _player->SendEquipError( EQUIP_ERR_NONE, pItem, NULL ); return; } @@ -892,7 +892,7 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket) void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket) { - CHECK_PACKET_SIZE(recvPacket,1+1); + CHECK_PACKET_SIZE(recvPacket, 1+1); sLog.outDebug("WORLD: CMSG_AUTOBANK_ITEM"); uint8 srcbag, srcslot; @@ -918,7 +918,7 @@ void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket) void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket) { - CHECK_PACKET_SIZE(recvPacket,1+1); + CHECK_PACKET_SIZE(recvPacket, 1+1); sLog.outDebug("WORLD: CMSG_AUTOSTORE_BANK_ITEM"); uint8 srcbag, srcslot; @@ -960,7 +960,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket) void WorldSession::HandleSetAmmoOpcode(WorldPacket & recv_data) { - CHECK_PACKET_SIZE(recv_data,4); + CHECK_PACKET_SIZE(recv_data, 4); if(!GetPlayer()->isAlive()) { @@ -982,10 +982,10 @@ void WorldSession::HandleSetAmmoOpcode(WorldPacket & recv_data) void WorldSession::SendEnchantmentLog(uint64 Target, uint64 Caster,uint32 ItemID,uint32 SpellID) { WorldPacket data(SMSG_ENCHANTMENTLOG, (8+8+4+4+1)); // last check 2.0.10 - data << Target; - data << Caster; - data << ItemID; - data << SpellID; + data << uint64(Target); + data << uint64(Caster); + data << uint32(ItemID); + data << uint32(SpellID); data << uint8(0); SendPacket(&data); } @@ -1003,7 +1003,7 @@ void WorldSession::SendItemEnchantTimeUpdate(uint64 Playerguid, uint64 Itemguid, void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recv_data) { - CHECK_PACKET_SIZE(recv_data,4); + CHECK_PACKET_SIZE(recv_data, 4); uint32 itemid; recv_data >> itemid; @@ -1044,7 +1044,7 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recv_data) void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data) { - CHECK_PACKET_SIZE(recv_data,1+1+1+1); + CHECK_PACKET_SIZE(recv_data, 1+1+1+1); sLog.outDebug("Received opcode CMSG_WRAP_ITEM"); @@ -1077,7 +1077,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data) return; } - if(item==gift) // not possable with pacjket from real client + if(item == gift) // not possible with packet from real client { _player->SendEquipError( EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED, item, NULL ); return; @@ -1114,7 +1114,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data) } // maybe not correct check (it is better than nothing) - if(item->GetProto()->MaxCount>0) + if(item->GetProto()->MaxCount > 0) { _player->SendEquipError( EQUIP_ERR_UNIQUE_CANT_BE_WRAPPED, item, NULL ); return; @@ -1137,7 +1137,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data) item->SetUInt32Value(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED); item->SetState(ITEM_CHANGED, _player); - if(item->GetState()==ITEM_NEW) // save new item, to have alway for `character_gifts` record in `item_instance` + if(item->GetState() == ITEM_NEW) // save new item, to have alway for `character_gifts` record in `item_instance` { // after save it will be impossible to remove the item from the queue item->RemoveFromUpdateQueueOf(_player); @@ -1153,7 +1153,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data) { sLog.outDebug("WORLD: CMSG_SOCKET_GEMS"); - CHECK_PACKET_SIZE(recv_data,8+8*MAX_GEM_SOCKETS); + CHECK_PACKET_SIZE(recv_data, 8+8*MAX_GEM_SOCKETS); uint64 item_guid; uint64 gem_guids[MAX_GEM_SOCKETS]; @@ -1201,8 +1201,8 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data) if(!itemTarget->GetEnchantmentId(PRISMATIC_ENCHANTMENT_SLOT)) return; - // not first not-colored (not normaly used) socket - if(i!=0 && !itemProto->Socket[i-1].Color && (i+1 >= MAX_GEM_SOCKETS || itemProto->Socket[i+1].Color)) + // not first not-colored (not normally used) socket + if(i != 0 && !itemProto->Socket[i - 1].Color && (i + 1 >= MAX_GEM_SOCKETS || itemProto->Socket[i + 1].Color)) return; // ok, this is first not colored socket for item with prismatic socket @@ -1222,7 +1222,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data) for(int i = 0; i < MAX_GEM_SOCKETS; ++i) //get new and old enchantments { GemEnchants[i] = (GemProps[i]) ? GemProps[i]->spellitemenchantement : 0; - OldEnchants[i] = itemTarget->GetEnchantmentId(EnchantmentSlot(SOCK_ENCHANTMENT_SLOT+i)); + OldEnchants[i] = itemTarget->GetEnchantmentId(EnchantmentSlot(SOCK_ENCHANTMENT_SLOT + i)); } // check unique-equipped conditions @@ -1239,7 +1239,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data) { for (int j = 0; j < MAX_GEM_SOCKETS; ++j) { - if(i==j) // skip self + if(i == j) // skip self continue; if (Gems[j]) @@ -1309,7 +1309,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data) // for equipped item check all equipment for duplicate equipped gems if(itemTarget->IsEquipped()) { - if(uint8 res = _player->CanEquipUniqueItem(Gems[i],slot,limit_newcount >= 0 ? limit_newcount : 0)) + if(uint8 res = _player->CanEquipUniqueItem(Gems[i], slot, limit_newcount >= 0 ? limit_newcount : 0)) { _player->SendEquipError( res, itemTarget, NULL ); return; @@ -1323,46 +1323,46 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data) //if a meta gem is being equipped, all information has to be written to the item before testing if the conditions for the gem are met //remove ALL enchants - for(uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+MAX_GEM_SOCKETS; ++enchant_slot) - _player->ApplyEnchantment(itemTarget,EnchantmentSlot(enchant_slot),false); + for(uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot) + _player->ApplyEnchantment(itemTarget, EnchantmentSlot(enchant_slot), false); for(int i = 0; i < MAX_GEM_SOCKETS; ++i) { if(GemEnchants[i]) { - itemTarget->SetEnchantment(EnchantmentSlot(SOCK_ENCHANTMENT_SLOT+i), GemEnchants[i],0,0); + itemTarget->SetEnchantment(EnchantmentSlot(SOCK_ENCHANTMENT_SLOT + i), GemEnchants[i], 0, 0); if(Item* guidItem = _player->GetItemByGuid(gem_guids[i])) _player->DestroyItem(guidItem->GetBagSlot(), guidItem->GetSlot(), true ); } } - for(uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+MAX_GEM_SOCKETS; ++enchant_slot) - _player->ApplyEnchantment(itemTarget,EnchantmentSlot(enchant_slot),true); + for(uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot) + _player->ApplyEnchantment(itemTarget, EnchantmentSlot(enchant_slot), true); - bool SocketBonusToBeActivated = itemTarget->GemsFitSockets();//current socketbonus state - if(SocketBonusActivated ^ SocketBonusToBeActivated) //if there was a change... + bool SocketBonusToBeActivated = itemTarget->GemsFitSockets();// current socketbonus state + if(SocketBonusActivated ^ SocketBonusToBeActivated) // if there was a change... { - _player->ApplyEnchantment(itemTarget,BONUS_ENCHANTMENT_SLOT,false); + _player->ApplyEnchantment(itemTarget,BONUS_ENCHANTMENT_SLOT, false); itemTarget->SetEnchantment(BONUS_ENCHANTMENT_SLOT, (SocketBonusToBeActivated ? itemTarget->GetProto()->socketBonus : 0), 0, 0); - _player->ApplyEnchantment(itemTarget,BONUS_ENCHANTMENT_SLOT,true); + _player->ApplyEnchantment(itemTarget, BONUS_ENCHANTMENT_SLOT, true); //it is not displayed, client has an inbuilt system to determine if the bonus is activated } - _player->ToggleMetaGemsActive(slot, true); //turn on all metagems (except for target item) + _player->ToggleMetaGemsActive(slot, true); // turn on all metagems (except for target item) } void WorldSession::HandleCancelTempEnchantmentOpcode(WorldPacket& recv_data) { sLog.outDebug("WORLD: CMSG_CANCEL_TEMP_ENCHANTMENT"); - CHECK_PACKET_SIZE(recv_data,4); + CHECK_PACKET_SIZE(recv_data, 4); uint32 eslot; recv_data >> eslot; // apply only to equipped item - if(!Player::IsEquipmentPos(INVENTORY_SLOT_BAG_0,eslot)) + if(!Player::IsEquipmentPos(INVENTORY_SLOT_BAG_0, eslot)) return; Item* item = GetPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, eslot); @@ -1373,6 +1373,6 @@ void WorldSession::HandleCancelTempEnchantmentOpcode(WorldPacket& recv_data) if(!item->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT)) return; - GetPlayer()->ApplyEnchantment(item,TEMP_ENCHANTMENT_SLOT,false); + GetPlayer()->ApplyEnchantment(item, TEMP_ENCHANTMENT_SLOT, false); item->ClearEnchantment(TEMP_ENCHANTMENT_SLOT); } diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 0b45d5798..48237809a 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -1164,7 +1164,7 @@ void WorldSession::HandlePlayedTime(WorldPacket& /*recv_data*/) WorldPacket data(SMSG_PLAYED_TIME, 4 + 4 + 1); data << uint32(_player->GetTotalPlayedTime()); data << uint32(_player->GetLevelPlayedTime()); - data << uint8(0); + data << uint8(1); // 0 - will not show in chat frame SendPacket(&data); } From 1c93b206e82ac311a768adc6baeb4714cd22234f Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sat, 25 Jul 2009 13:50:28 +0400 Subject: [PATCH 053/132] Updated to 10147 client build. --- src/game/MiscHandler.cpp | 9 +- src/game/SharedDefines.h | 374 +++++++++++++++++++------------------- src/game/UpdateFields.h | 2 +- src/game/WorldSocket.cpp | 3 +- src/realmd/AuthCodes.h | 4 +- src/realmd/AuthSocket.cpp | 174 ++++++++++-------- 6 files changed, 294 insertions(+), 272 deletions(-) diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 48237809a..623d69a46 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -1159,12 +1159,17 @@ void WorldSession::HandleWardenDataOpcode(WorldPacket& /*recv_data*/) */ } -void WorldSession::HandlePlayedTime(WorldPacket& /*recv_data*/) +void WorldSession::HandlePlayedTime(WorldPacket& recv_data) { + CHECK_PACKET_SIZE(recv_data, 1); + + uint8 unk1; + recv_data >> unk1; // 0 or 1 expected + WorldPacket data(SMSG_PLAYED_TIME, 4 + 4 + 1); data << uint32(_player->GetTotalPlayedTime()); data << uint32(_player->GetLevelPlayedTime()); - data << uint8(1); // 0 - will not show in chat frame + data << uint8(unk1); // 0 - will not show in chat frame SendPacket(&data); } diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index f497f030e..a63e4c1bf 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -688,194 +688,194 @@ enum SpellEffects enum SpellCastResult { - SPELL_FAILED_AFFECTING_COMBAT = 0, - SPELL_FAILED_ALREADY_AT_FULL_HEALTH = 1, - SPELL_FAILED_ALREADY_AT_FULL_MANA = 2, - SPELL_FAILED_ALREADY_AT_FULL_POWER = 3, - SPELL_FAILED_ALREADY_BEING_TAMED = 4, - SPELL_FAILED_ALREADY_HAVE_CHARM = 5, - SPELL_FAILED_ALREADY_HAVE_SUMMON = 6, - SPELL_FAILED_ALREADY_OPEN = 7, - SPELL_FAILED_AURA_BOUNCED = 8, - SPELL_FAILED_AUTOTRACK_INTERRUPTED = 9, - SPELL_FAILED_BAD_IMPLICIT_TARGETS = 10, - SPELL_FAILED_BAD_TARGETS = 11, - SPELL_FAILED_CANT_BE_CHARMED = 12, - SPELL_FAILED_CANT_BE_DISENCHANTED = 13, - SPELL_FAILED_CANT_BE_DISENCHANTED_SKILL = 14, - SPELL_FAILED_CANT_BE_MILLED = 15, - SPELL_FAILED_CANT_BE_PROSPECTED = 16, - SPELL_FAILED_CANT_CAST_ON_TAPPED = 17, - SPELL_FAILED_CANT_DUEL_WHILE_INVISIBLE = 18, - SPELL_FAILED_CANT_DUEL_WHILE_STEALTHED = 19, - SPELL_FAILED_CANT_STEALTH = 20, - SPELL_FAILED_CASTER_AURASTATE = 21, - SPELL_FAILED_CASTER_DEAD = 22, - SPELL_FAILED_CHARMED = 23, - SPELL_FAILED_CHEST_IN_USE = 24, - SPELL_FAILED_CONFUSED = 25, - SPELL_FAILED_DONT_REPORT = 26, - SPELL_FAILED_EQUIPPED_ITEM = 27, - SPELL_FAILED_EQUIPPED_ITEM_CLASS = 28, - SPELL_FAILED_EQUIPPED_ITEM_CLASS_MAINHAND = 29, - SPELL_FAILED_EQUIPPED_ITEM_CLASS_OFFHAND = 30, - SPELL_FAILED_ERROR = 31, - SPELL_FAILED_FIZZLE = 32, - SPELL_FAILED_FLEEING = 33, - SPELL_FAILED_FOOD_LOWLEVEL = 34, - SPELL_FAILED_HIGHLEVEL = 35, - SPELL_FAILED_HUNGER_SATIATED = 36, - SPELL_FAILED_IMMUNE = 37, - SPELL_FAILED_INCORRECT_AREA = 38, - SPELL_FAILED_INTERRUPTED = 39, - SPELL_FAILED_INTERRUPTED_COMBAT = 40, - SPELL_FAILED_ITEM_ALREADY_ENCHANTED = 41, - SPELL_FAILED_ITEM_GONE = 42, - SPELL_FAILED_ITEM_NOT_FOUND = 43, - SPELL_FAILED_ITEM_NOT_READY = 44, - SPELL_FAILED_LEVEL_REQUIREMENT = 45, - SPELL_FAILED_LINE_OF_SIGHT = 46, - SPELL_FAILED_LOWLEVEL = 47, - SPELL_FAILED_LOW_CASTLEVEL = 48, - SPELL_FAILED_MAINHAND_EMPTY = 49, - SPELL_FAILED_MOVING = 50, - SPELL_FAILED_NEED_AMMO = 51, - SPELL_FAILED_NEED_AMMO_POUCH = 52, - SPELL_FAILED_NEED_EXOTIC_AMMO = 53, - SPELL_FAILED_NEED_MORE_ITEMS = 54, - SPELL_FAILED_NOPATH = 55, - SPELL_FAILED_NOT_BEHIND = 56, - SPELL_FAILED_NOT_FISHABLE = 57, - SPELL_FAILED_NOT_FLYING = 58, - SPELL_FAILED_NOT_HERE = 59, - SPELL_FAILED_NOT_INFRONT = 60, - SPELL_FAILED_NOT_IN_CONTROL = 61, - SPELL_FAILED_NOT_KNOWN = 62, - SPELL_FAILED_NOT_MOUNTED = 63, - SPELL_FAILED_NOT_ON_TAXI = 64, - SPELL_FAILED_NOT_ON_TRANSPORT = 65, - SPELL_FAILED_NOT_READY = 66, - SPELL_FAILED_NOT_SHAPESHIFT = 67, - SPELL_FAILED_NOT_STANDING = 68, - SPELL_FAILED_NOT_TRADEABLE = 69, - SPELL_FAILED_NOT_TRADING = 70, - SPELL_FAILED_NOT_UNSHEATHED = 71, - SPELL_FAILED_NOT_WHILE_GHOST = 72, - SPELL_FAILED_NOT_WHILE_LOOTING = 73, - SPELL_FAILED_NO_AMMO = 74, - SPELL_FAILED_NO_CHARGES_REMAIN = 75, - SPELL_FAILED_NO_CHAMPION = 76, - SPELL_FAILED_NO_COMBO_POINTS = 77, - SPELL_FAILED_NO_DUELING = 78, - SPELL_FAILED_NO_ENDURANCE = 79, - SPELL_FAILED_NO_FISH = 80, - SPELL_FAILED_NO_ITEMS_WHILE_SHAPESHIFTED = 81, - SPELL_FAILED_NO_MOUNTS_ALLOWED = 82, - SPELL_FAILED_NO_PET = 83, - SPELL_FAILED_NO_POWER = 84, - SPELL_FAILED_NOTHING_TO_DISPEL = 85, - SPELL_FAILED_NOTHING_TO_STEAL = 86, - SPELL_FAILED_ONLY_ABOVEWATER = 87, - SPELL_FAILED_ONLY_DAYTIME = 88, - SPELL_FAILED_ONLY_INDOORS = 89, - SPELL_FAILED_ONLY_MOUNTED = 90, - SPELL_FAILED_ONLY_NIGHTTIME = 91, - SPELL_FAILED_ONLY_OUTDOORS = 92, - SPELL_FAILED_ONLY_SHAPESHIFT = 93, - SPELL_FAILED_ONLY_STEALTHED = 94, - SPELL_FAILED_ONLY_UNDERWATER = 95, - SPELL_FAILED_OUT_OF_RANGE = 96, - SPELL_FAILED_PACIFIED = 97, - SPELL_FAILED_POSSESSED = 98, - SPELL_FAILED_REAGENTS = 99, - SPELL_FAILED_REQUIRES_AREA = 100, - SPELL_FAILED_REQUIRES_SPELL_FOCUS = 101, - SPELL_FAILED_ROOTED = 102, - SPELL_FAILED_SILENCED = 103, - SPELL_FAILED_SPELL_IN_PROGRESS = 104, - SPELL_FAILED_SPELL_LEARNED = 105, - SPELL_FAILED_SPELL_UNAVAILABLE = 106, - SPELL_FAILED_STUNNED = 107, - SPELL_FAILED_TARGETS_DEAD = 108, - SPELL_FAILED_TARGET_AFFECTING_COMBAT = 109, - SPELL_FAILED_TARGET_AURASTATE = 110, - SPELL_FAILED_TARGET_DUELING = 111, - SPELL_FAILED_TARGET_ENEMY = 112, - SPELL_FAILED_TARGET_ENRAGED = 113, - SPELL_FAILED_TARGET_FRIENDLY = 114, - SPELL_FAILED_TARGET_IN_COMBAT = 115, - SPELL_FAILED_TARGET_IS_PLAYER = 116, - SPELL_FAILED_TARGET_IS_PLAYER_CONTROLLED = 117, - SPELL_FAILED_TARGET_NOT_DEAD = 118, - SPELL_FAILED_TARGET_NOT_IN_PARTY = 119, - SPELL_FAILED_TARGET_NOT_LOOTED = 120, - SPELL_FAILED_TARGET_NOT_PLAYER = 121, - SPELL_FAILED_TARGET_NO_POCKETS = 122, - SPELL_FAILED_TARGET_NO_WEAPONS = 123, - SPELL_FAILED_TARGET_NO_RANGED_WEAPONS = 124, - SPELL_FAILED_TARGET_UNSKINNABLE = 125, - SPELL_FAILED_THIRST_SATIATED = 126, - SPELL_FAILED_TOO_CLOSE = 127, - SPELL_FAILED_TOO_MANY_OF_ITEM = 128, - SPELL_FAILED_TOTEM_CATEGORY = 129, - SPELL_FAILED_TOTEMS = 130, - SPELL_FAILED_TRY_AGAIN = 131, - SPELL_FAILED_UNIT_NOT_BEHIND = 132, - SPELL_FAILED_UNIT_NOT_INFRONT = 133, - SPELL_FAILED_WRONG_PET_FOOD = 134, - SPELL_FAILED_NOT_WHILE_FATIGUED = 135, - SPELL_FAILED_TARGET_NOT_IN_INSTANCE = 136, - SPELL_FAILED_NOT_WHILE_TRADING = 137, - SPELL_FAILED_TARGET_NOT_IN_RAID = 138, - SPELL_FAILED_TARGET_FREEFORALL = 139, - SPELL_FAILED_NO_EDIBLE_CORPSES = 140, - SPELL_FAILED_ONLY_BATTLEGROUNDS = 141, - SPELL_FAILED_TARGET_NOT_GHOST = 142, - SPELL_FAILED_TRANSFORM_UNUSABLE = 143, - SPELL_FAILED_WRONG_WEATHER = 144, - SPELL_FAILED_DAMAGE_IMMUNE = 145, - SPELL_FAILED_PREVENTED_BY_MECHANIC = 146, - SPELL_FAILED_PLAY_TIME = 147, - SPELL_FAILED_REPUTATION = 148, - SPELL_FAILED_MIN_SKILL = 149, - SPELL_FAILED_NOT_IN_ARENA = 150, - SPELL_FAILED_NOT_ON_SHAPESHIFT = 151, - SPELL_FAILED_NOT_ON_STEALTHED = 152, - SPELL_FAILED_NOT_ON_DAMAGE_IMMUNE = 153, - SPELL_FAILED_NOT_ON_MOUNTED = 154, - SPELL_FAILED_TOO_SHALLOW = 155, - SPELL_FAILED_TARGET_NOT_IN_SANCTUARY = 156, - SPELL_FAILED_TARGET_IS_TRIVIAL = 157, - SPELL_FAILED_BM_OR_INVISGOD = 158, - SPELL_FAILED_EXPERT_RIDING_REQUIREMENT = 159, - SPELL_FAILED_ARTISAN_RIDING_REQUIREMENT = 160, - SPELL_FAILED_NOT_IDLE = 161, - SPELL_FAILED_NOT_INACTIVE = 162, - SPELL_FAILED_PARTIAL_PLAYTIME = 163, - SPELL_FAILED_NO_PLAYTIME = 164, - SPELL_FAILED_NOT_IN_BATTLEGROUND = 165, - SPELL_FAILED_NOT_IN_RAID_INSTANCE = 166, - SPELL_FAILED_ONLY_IN_ARENA = 167, - SPELL_FAILED_TARGET_LOCKED_TO_RAID_INSTANCE = 168, - SPELL_FAILED_ON_USE_ENCHANT = 169, - SPELL_FAILED_NOT_ON_GROUND = 170, - SPELL_FAILED_CUSTOM_ERROR = 171, - SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW = 172, - SPELL_FAILED_TOO_MANY_SOCKETS = 173, - SPELL_FAILED_INVALID_GLYPH = 174, - SPELL_FAILED_UNIQUE_GLYPH = 175, - SPELL_FAILED_GLYPH_SOCKET_LOCKED = 176, - SPELL_FAILED_NO_VALID_TARGETS = 177, - SPELL_FAILED_ITEM_AT_MAX_CHARGES = 178, - SPELL_FAILED_NOT_IN_BARBERSHOP = 179, - SPELL_FAILED_FISHING_TOO_LOW = 180, - SPELL_FAILED_ITEM_ENCHANT_TRADE_WINDOW = 181, - SPELL_FAILED_SUMMON_PENDING = 182, - SPELL_FAILED_MAX_SOCKETS = 183, - SPELL_FAILED_PET_CAN_RENAME = 184, - SPELL_FAILED_UNKNOWN = 185, + SPELL_FAILED_AFFECTING_COMBAT = 0x00, + SPELL_FAILED_ALREADY_AT_FULL_HEALTH = 0x01, + SPELL_FAILED_ALREADY_AT_FULL_MANA = 0x02, + SPELL_FAILED_ALREADY_AT_FULL_POWER = 0x03, + SPELL_FAILED_ALREADY_BEING_TAMED = 0x04, + SPELL_FAILED_ALREADY_HAVE_CHARM = 0x05, + SPELL_FAILED_ALREADY_HAVE_SUMMON = 0x06, + SPELL_FAILED_ALREADY_OPEN = 0x07, + SPELL_FAILED_AURA_BOUNCED = 0x08, + SPELL_FAILED_AUTOTRACK_INTERRUPTED = 0x09, + SPELL_FAILED_BAD_IMPLICIT_TARGETS = 0x0A, + SPELL_FAILED_BAD_TARGETS = 0x0B, + SPELL_FAILED_CANT_BE_CHARMED = 0x0C, + SPELL_FAILED_CANT_BE_DISENCHANTED = 0x0D, + SPELL_FAILED_CANT_BE_DISENCHANTED_SKILL = 0x0E, + SPELL_FAILED_CANT_BE_MILLED = 0x0F, + SPELL_FAILED_CANT_BE_PROSPECTED = 0x10, + SPELL_FAILED_CANT_CAST_ON_TAPPED = 0x11, + SPELL_FAILED_CANT_DUEL_WHILE_INVISIBLE = 0x12, + SPELL_FAILED_CANT_DUEL_WHILE_STEALTHED = 0x13, + SPELL_FAILED_CANT_STEALTH = 0x14, + SPELL_FAILED_CASTER_AURASTATE = 0x15, + SPELL_FAILED_CASTER_DEAD = 0x16, + SPELL_FAILED_CHARMED = 0x17, + SPELL_FAILED_CHEST_IN_USE = 0x18, + SPELL_FAILED_CONFUSED = 0x19, + SPELL_FAILED_DONT_REPORT = 0x1A, + SPELL_FAILED_EQUIPPED_ITEM = 0x1B, + SPELL_FAILED_EQUIPPED_ITEM_CLASS = 0x1C, + SPELL_FAILED_EQUIPPED_ITEM_CLASS_MAINHAND = 0x1D, + SPELL_FAILED_EQUIPPED_ITEM_CLASS_OFFHAND = 0x1E, + SPELL_FAILED_ERROR = 0x1F, + SPELL_FAILED_FIZZLE = 0x20, + SPELL_FAILED_FLEEING = 0x21, + SPELL_FAILED_FOOD_LOWLEVEL = 0x22, + SPELL_FAILED_HIGHLEVEL = 0x23, + SPELL_FAILED_HUNGER_SATIATED = 0x24, + SPELL_FAILED_IMMUNE = 0x25, + SPELL_FAILED_INCORRECT_AREA = 0x26, + SPELL_FAILED_INTERRUPTED = 0x27, + SPELL_FAILED_INTERRUPTED_COMBAT = 0x28, + SPELL_FAILED_ITEM_ALREADY_ENCHANTED = 0x29, + SPELL_FAILED_ITEM_GONE = 0x2A, + SPELL_FAILED_ITEM_NOT_FOUND = 0x2B, + SPELL_FAILED_ITEM_NOT_READY = 0x2C, + SPELL_FAILED_LEVEL_REQUIREMENT = 0x2D, + SPELL_FAILED_LINE_OF_SIGHT = 0x2E, + SPELL_FAILED_LOWLEVEL = 0x2F, + SPELL_FAILED_LOW_CASTLEVEL = 0x30, + SPELL_FAILED_MAINHAND_EMPTY = 0x31, + SPELL_FAILED_MOVING = 0x32, + SPELL_FAILED_NEED_AMMO = 0x33, + SPELL_FAILED_NEED_AMMO_POUCH = 0x34, + SPELL_FAILED_NEED_EXOTIC_AMMO = 0x35, + SPELL_FAILED_NEED_MORE_ITEMS = 0x36, + SPELL_FAILED_NOPATH = 0x37, + SPELL_FAILED_NOT_BEHIND = 0x38, + SPELL_FAILED_NOT_FISHABLE = 0x39, + SPELL_FAILED_NOT_FLYING = 0x3A, + SPELL_FAILED_NOT_HERE = 0x3B, + SPELL_FAILED_NOT_INFRONT = 0x3C, + SPELL_FAILED_NOT_IN_CONTROL = 0x3D, + SPELL_FAILED_NOT_KNOWN = 0x3E, + SPELL_FAILED_NOT_MOUNTED = 0x3F, + SPELL_FAILED_NOT_ON_TAXI = 0x40, + SPELL_FAILED_NOT_ON_TRANSPORT = 0x41, + SPELL_FAILED_NOT_READY = 0x42, + SPELL_FAILED_NOT_SHAPESHIFT = 0x43, + SPELL_FAILED_NOT_STANDING = 0x44, + SPELL_FAILED_NOT_TRADEABLE = 0x45, + SPELL_FAILED_NOT_TRADING = 0x46, + SPELL_FAILED_NOT_UNSHEATHED = 0x47, + SPELL_FAILED_NOT_WHILE_GHOST = 0x48, + SPELL_FAILED_NOT_WHILE_LOOTING = 0x49, + SPELL_FAILED_NO_AMMO = 0x4A, + SPELL_FAILED_NO_CHARGES_REMAIN = 0x4B, + SPELL_FAILED_NO_CHAMPION = 0x4C, + SPELL_FAILED_NO_COMBO_POINTS = 0x4D, + SPELL_FAILED_NO_DUELING = 0x4E, + SPELL_FAILED_NO_ENDURANCE = 0x4F, + SPELL_FAILED_NO_FISH = 0x50, + SPELL_FAILED_NO_ITEMS_WHILE_SHAPESHIFTED = 0x51, + SPELL_FAILED_NO_MOUNTS_ALLOWED = 0x52, + SPELL_FAILED_NO_PET = 0x53, + SPELL_FAILED_NO_POWER = 0x54, + SPELL_FAILED_NOTHING_TO_DISPEL = 0x55, + SPELL_FAILED_NOTHING_TO_STEAL = 0x56, + SPELL_FAILED_ONLY_ABOVEWATER = 0x57, + SPELL_FAILED_ONLY_DAYTIME = 0x58, + SPELL_FAILED_ONLY_INDOORS = 0x59, + SPELL_FAILED_ONLY_MOUNTED = 0x5A, + SPELL_FAILED_ONLY_NIGHTTIME = 0x5B, + SPELL_FAILED_ONLY_OUTDOORS = 0x5C, + SPELL_FAILED_ONLY_SHAPESHIFT = 0x5D, + SPELL_FAILED_ONLY_STEALTHED = 0x5E, + SPELL_FAILED_ONLY_UNDERWATER = 0x5F, + SPELL_FAILED_OUT_OF_RANGE = 0x60, + SPELL_FAILED_PACIFIED = 0x61, + SPELL_FAILED_POSSESSED = 0x62, + SPELL_FAILED_REAGENTS = 0x63, + SPELL_FAILED_REQUIRES_AREA = 0x64, + SPELL_FAILED_REQUIRES_SPELL_FOCUS = 0x65, + SPELL_FAILED_ROOTED = 0x66, + SPELL_FAILED_SILENCED = 0x67, + SPELL_FAILED_SPELL_IN_PROGRESS = 0x68, + SPELL_FAILED_SPELL_LEARNED = 0x69, + SPELL_FAILED_SPELL_UNAVAILABLE = 0x6A, + SPELL_FAILED_STUNNED = 0x6B, + SPELL_FAILED_TARGETS_DEAD = 0x6C, + SPELL_FAILED_TARGET_AFFECTING_COMBAT = 0x6D, + SPELL_FAILED_TARGET_AURASTATE = 0x6E, + SPELL_FAILED_TARGET_DUELING = 0x6F, + SPELL_FAILED_TARGET_ENEMY = 0x70, + SPELL_FAILED_TARGET_ENRAGED = 0x71, + SPELL_FAILED_TARGET_FRIENDLY = 0x72, + SPELL_FAILED_TARGET_IN_COMBAT = 0x73, + SPELL_FAILED_TARGET_IS_PLAYER = 0x74, + SPELL_FAILED_TARGET_IS_PLAYER_CONTROLLED = 0x75, + SPELL_FAILED_TARGET_NOT_DEAD = 0x76, + SPELL_FAILED_TARGET_NOT_IN_PARTY = 0x77, + SPELL_FAILED_TARGET_NOT_LOOTED = 0x78, + SPELL_FAILED_TARGET_NOT_PLAYER = 0x79, + SPELL_FAILED_TARGET_NO_POCKETS = 0x7A, + SPELL_FAILED_TARGET_NO_WEAPONS = 0x7B, + SPELL_FAILED_TARGET_NO_RANGED_WEAPONS = 0x7C, + SPELL_FAILED_TARGET_UNSKINNABLE = 0x7D, + SPELL_FAILED_THIRST_SATIATED = 0x7E, + SPELL_FAILED_TOO_CLOSE = 0x7F, + SPELL_FAILED_TOO_MANY_OF_ITEM = 0x80, + SPELL_FAILED_TOTEM_CATEGORY = 0x81, + SPELL_FAILED_TOTEMS = 0x82, + SPELL_FAILED_TRY_AGAIN = 0x83, + SPELL_FAILED_UNIT_NOT_BEHIND = 0x84, + SPELL_FAILED_UNIT_NOT_INFRONT = 0x85, + SPELL_FAILED_WRONG_PET_FOOD = 0x86, + SPELL_FAILED_NOT_WHILE_FATIGUED = 0x87, + SPELL_FAILED_TARGET_NOT_IN_INSTANCE = 0x88, + SPELL_FAILED_NOT_WHILE_TRADING = 0x89, + SPELL_FAILED_TARGET_NOT_IN_RAID = 0x8A, + SPELL_FAILED_TARGET_FREEFORALL = 0x8B, + SPELL_FAILED_NO_EDIBLE_CORPSES = 0x8C, + SPELL_FAILED_ONLY_BATTLEGROUNDS = 0x8D, + SPELL_FAILED_TARGET_NOT_GHOST = 0x8E, + SPELL_FAILED_TRANSFORM_UNUSABLE = 0x8F, + SPELL_FAILED_WRONG_WEATHER = 0x90, + SPELL_FAILED_DAMAGE_IMMUNE = 0x91, + SPELL_FAILED_PREVENTED_BY_MECHANIC = 0x92, + SPELL_FAILED_PLAY_TIME = 0x93, + SPELL_FAILED_REPUTATION = 0x94, + SPELL_FAILED_MIN_SKILL = 0x95, + SPELL_FAILED_NOT_IN_ARENA = 0x96, + SPELL_FAILED_NOT_ON_SHAPESHIFT = 0x97, + SPELL_FAILED_NOT_ON_STEALTHED = 0x98, + SPELL_FAILED_NOT_ON_DAMAGE_IMMUNE = 0x99, + SPELL_FAILED_NOT_ON_MOUNTED = 0x9A, + SPELL_FAILED_TOO_SHALLOW = 0x9B, + SPELL_FAILED_TARGET_NOT_IN_SANCTUARY = 0x9C, + SPELL_FAILED_TARGET_IS_TRIVIAL = 0x9D, + SPELL_FAILED_BM_OR_INVISGOD = 0x9E, + SPELL_FAILED_EXPERT_RIDING_REQUIREMENT = 0x9F, + SPELL_FAILED_ARTISAN_RIDING_REQUIREMENT = 0xA0, + SPELL_FAILED_NOT_IDLE = 0xA1, + SPELL_FAILED_NOT_INACTIVE = 0xA2, + SPELL_FAILED_PARTIAL_PLAYTIME = 0xA3, + SPELL_FAILED_NO_PLAYTIME = 0xA4, + SPELL_FAILED_NOT_IN_BATTLEGROUND = 0xA5, + SPELL_FAILED_NOT_IN_RAID_INSTANCE = 0xA6, + SPELL_FAILED_ONLY_IN_ARENA = 0xA7, + SPELL_FAILED_TARGET_LOCKED_TO_RAID_INSTANCE = 0xA8, + SPELL_FAILED_ON_USE_ENCHANT = 0xA9, + SPELL_FAILED_NOT_ON_GROUND = 0xAA, + SPELL_FAILED_CUSTOM_ERROR = 0xAB, + SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW = 0xAC, + SPELL_FAILED_TOO_MANY_SOCKETS = 0xAD, + SPELL_FAILED_INVALID_GLYPH = 0xAE, + SPELL_FAILED_UNIQUE_GLYPH = 0xAF, + SPELL_FAILED_GLYPH_SOCKET_LOCKED = 0xB0, + SPELL_FAILED_NO_VALID_TARGETS = 0xB1, + SPELL_FAILED_ITEM_AT_MAX_CHARGES = 0xB2, + SPELL_FAILED_NOT_IN_BARBERSHOP = 0xB3, + SPELL_FAILED_FISHING_TOO_LOW = 0xB4, + SPELL_FAILED_ITEM_ENCHANT_TRADE_WINDOW = 0xB5, + SPELL_FAILED_SUMMON_PENDING = 0xB6, + SPELL_FAILED_MAX_SOCKETS = 0xB7, + SPELL_FAILED_PET_CAN_RENAME = 0xB8, + SPELL_FAILED_UNKNOWN = 0xB9, - SPELL_CAST_OK = 255 //custom value, don't must be send to client + SPELL_CAST_OK = 0xFF // custom value, don't must be send to client }; // Spell aura states diff --git a/src/game/UpdateFields.h b/src/game/UpdateFields.h index 7df000b89..fb7485d70 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, 2, 0, 10128 +// Auto generated for version 0, 2, 0, 10147 enum EObjectFields { diff --git a/src/game/WorldSocket.cpp b/src/game/WorldSocket.cpp index 2281761e0..737f28631 100644 --- a/src/game/WorldSocket.cpp +++ b/src/game/WorldSocket.cpp @@ -776,10 +776,11 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) recvPacket >> clientSeed; recvPacket.read (digest, 20); - DEBUG_LOG ("WorldSocket::HandleAuthSession: client %u, unk2 %u, account %s, clientseed %u", + DEBUG_LOG ("WorldSocket::HandleAuthSession: client %u, unk2 %u, account %s, unk3 %u, clientseed %u", BuiltNumberClient, unk2, account.c_str (), + unk3, clientSeed); // Get the account information from the realmd database diff --git a/src/realmd/AuthCodes.h b/src/realmd/AuthCodes.h index f1c7506fe..456ffe5ad 100644 --- a/src/realmd/AuthCodes.h +++ b/src/realmd/AuthCodes.h @@ -66,8 +66,8 @@ enum LoginResult // 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.2.0 client build 10128... +// will only support WoW, WoW:TBC and WoW:WotLK 3.2.0 client build 10147... -#define EXPECTED_MANGOS_CLIENT_BUILD {10128, 0} +#define EXPECTED_MANGOS_CLIENT_BUILD {10147, 0} #endif diff --git a/src/realmd/AuthSocket.cpp b/src/realmd/AuthSocket.cpp index 989c645da..5611d85e8 100644 --- a/src/realmd/AuthSocket.cpp +++ b/src/realmd/AuthSocket.cpp @@ -110,7 +110,7 @@ typedef struct AUTH_LOGON_PROOF_C uint8 M1[20]; uint8 crc_hash[20]; uint8 number_of_keys; - uint8 unk; // Added in 1.12.x client branch + uint8 securityFlags; // 0x00-0x04 } sAuthLogonProof_C; /* typedef struct @@ -262,17 +262,11 @@ void AuthSocket::OnRead() ///- Get the command out of it ibuf.SoftRead((char *)&_cmd, 1); // UQ1: No longer exists in new net code ??? - //ibuf.Read((char *)&_cmd, 1); - /*char *command = (char *)malloc(1); - ibuf.Read(command, 1); - - _cmd = (uint8)command;*/ - // assert(0); size_t i; ///- Circle through known commands and call the correct command handler - for (i=0;icountry[4-i-1]; - sLog.outBasic("[AuthChallenge] account %s is using '%c%c%c%c' locale (%u)", _login.c_str (), ch->country[3],ch->country[2],ch->country[1],ch->country[0], GetLocaleByName(_localizationName)); + sLog.outBasic("[AuthChallenge] account %s is using '%c%c%c%c' locale (%u)", _login.c_str (), ch->country[3], ch->country[2], ch->country[1], ch->country[0], GetLocaleByName(_localizationName)); } } delete result; @@ -508,13 +523,13 @@ bool AuthSocket::_HandleLogonProof() ibuf.Read((char *)&lp, sizeof(sAuthLogonProof_C)); ///- Check if the client has one of the expected version numbers - bool valid_version=false; - int accepted_versions[]=EXPECTED_MANGOS_CLIENT_BUILD; - for(int i=0;accepted_versions[i];i++) + bool valid_version = false; + int accepted_versions[] = EXPECTED_MANGOS_CLIENT_BUILD; + for(int i = 0; accepted_versions[i]; ++i) { - if(_build==accepted_versions[i]) + if(_build == accepted_versions[i]) { - valid_version=true; + valid_version = true; break; } } @@ -527,9 +542,9 @@ bool AuthSocket::_HandleLogonProof() // 24 = len("./patches/65535enGB.mpq")+1 char tmp[24]; // No buffer overflow (fixed length of arguments) - sprintf(tmp,"./patches/%d%s.mpq",_build, _localizationName.c_str()); - // This will be closed at the destruction of the AuthSocket (client deconnection) - FILE *pFile=fopen(tmp,"rb"); + sprintf(tmp, "./patches/%d%s.mpq", _build, _localizationName.c_str()); + // This will be closed at the destruction of the AuthSocket (client disconnection) + FILE *pFile = fopen(tmp, "rb"); if(!pFile) { @@ -538,37 +553,37 @@ bool AuthSocket::_HandleLogonProof() pkt << (uint8) 0x00; pkt << (uint8) REALM_AUTH_WRONG_BUILD_NUMBER; DEBUG_LOG("[AuthChallenge] %u is not a valid client version!", _build); - DEBUG_LOG("[AuthChallenge] Patch %s not found",tmp); + DEBUG_LOG("[AuthChallenge] Patch %s not found", tmp); SendBuf((char const*)pkt.contents(), pkt.size()); return true; } else // have patch { - pPatch=pFile; + pPatch = pFile; XFER_INIT xferh; ///- Get the MD5 hash of the patch file (get it from preloaded Patcher cache or calculate it) - if(PatchesCache.GetHash(tmp,(uint8*)&xferh.md5)) + if(PatchesCache.GetHash(tmp, (uint8*)&xferh.md5)) { - DEBUG_LOG("\n[AuthChallenge] Found precached patch info for patch %s",tmp); + DEBUG_LOG("\n[AuthChallenge] Found precached patch info for patch %s", tmp); } else { // calculate patch md5 - printf("\n[AuthChallenge] Patch info for %s was not cached.",tmp); + printf("\n[AuthChallenge] Patch info for %s was not cached.", tmp); PatchesCache.LoadPatchMD5(tmp); - PatchesCache.GetHash(tmp,(uint8*)&xferh.md5); + PatchesCache.GetHash(tmp, (uint8*)&xferh.md5); } ///- Send a packet to the client with the file length and MD5 hash - uint8 data[2]={AUTH_LOGON_PROOF,REALM_AUTH_UPDATE_CLIENT}; - SendBuf((const char*)data,sizeof(data)); + uint8 data[2] = { AUTH_LOGON_PROOF, REALM_AUTH_UPDATE_CLIENT }; + SendBuf((const char*)data, sizeof(data)); - memcpy(&xferh,"0\x05Patch",7); - xferh.cmd=XFER_INITIATE; - fseek(pPatch,0,SEEK_END); - xferh.file_size=ftell(pPatch); + memcpy(&xferh, "0\x05Patch", 7); + xferh.cmd = XFER_INITIATE; + fseek(pPatch, 0, SEEK_END); + xferh.file_size = ftell(pPatch); - SendBuf((const char*)&xferh,sizeof(xferh)); + SendBuf((const char*)&xferh, sizeof(xferh)); return true; } } @@ -589,27 +604,27 @@ bool AuthSocket::_HandleLogonProof() uint8 t1[16]; uint8 vK[40]; memcpy(t, S.AsByteArray(), 32); - for (int i = 0; i < 16; i++) + for (int i = 0; i < 16; ++i) { - t1[i] = t[i*2]; + t1[i] = t[i * 2]; } sha.Initialize(); sha.UpdateData(t1, 16); sha.Finalize(); - for (int i = 0; i < 20; i++) + for (int i = 0; i < 20; ++i) { - vK[i*2] = sha.GetDigest()[i]; + vK[i * 2] = sha.GetDigest()[i]; } - for (int i = 0; i < 16; i++) + for (int i = 0; i < 16; ++i) { - t1[i] = t[i*2+1]; + t1[i] = t[i * 2 + 1]; } sha.Initialize(); sha.UpdateData(t1, 16); sha.Finalize(); - for (int i = 0; i < 20; i++) + for (int i = 0; i < 20; ++i) { - vK[i*2+1] = sha.GetDigest()[i]; + vK[i * 2 + 1] = sha.GetDigest()[i]; } K.SetBinary(vK, 40); @@ -622,7 +637,7 @@ bool AuthSocket::_HandleLogonProof() sha.Initialize(); sha.UpdateBigNumbers(&g, NULL); sha.Finalize(); - for (int i = 0; i < 20; i++) + for (int i = 0; i < 20; ++i) { hash[i] ^= sha.GetDigest()[i]; } @@ -674,8 +689,8 @@ bool AuthSocket::_HandleLogonProof() } else { - char data[4]={AUTH_LOGON_PROOF,REALM_AUTH_NO_MATCH,3,0}; - SendBuf(data,sizeof(data)); + char data[4]= { AUTH_LOGON_PROOF, REALM_AUTH_NO_MATCH, 3, 0}; + SendBuf(data, sizeof(data)); sLog.outBasic("[AuthChallenge] account %s tried to login with wrong password!",_login.c_str ()); uint32 MaxWrongPassCount = sConfig.GetIntDefault("WrongPass.MaxCount", 0); @@ -770,7 +785,7 @@ bool AuthSocket::_HandleReconnectChallenge() ByteBuffer pkt; pkt << (uint8) AUTH_RECONNECT_CHALLENGE; pkt << (uint8) 0x00; - _reconnectProof.SetRand(16*8); + _reconnectProof.SetRand(16 * 8); pkt.append(_reconnectProof.AsByteBuffer()); // 16 bytes random pkt << (uint64) 0x00 << (uint64) 0x00; // 16 bytes zeros SendBuf((char const*)pkt.contents(), pkt.size()); @@ -852,7 +867,7 @@ bool AuthSocket::_HandleRealmList() pkt << (uint32) 0; pkt << (uint16) m_realmList.size(); RealmList::RealmMap::const_iterator i; - for( i = m_realmList.begin(); i != m_realmList.end(); i++ ) + for( i = m_realmList.begin(); i != m_realmList.end(); ++i ) { uint8 AmountOfCharacters; @@ -899,7 +914,7 @@ bool AuthSocket::_HandleXferResume() { DEBUG_LOG("Entering _HandleXferResume"); ///- Check packet length and patch existence - if (ibuf.GetLength()<9 || !pPatch) + if (ibuf.GetLength() < 9 || !pPatch) { sLog.outError("Error while resuming patch transfer (wrong packet)"); return false; @@ -909,7 +924,7 @@ bool AuthSocket::_HandleXferResume() uint64 start; ibuf.Remove(1); ibuf.Read((char*)&start,sizeof(start)); - fseek(pPatch,start,0); + fseek(pPatch, start, 0); ACE_Based::Thread u(*new PatcherRunnable(this)); return true; @@ -940,9 +955,9 @@ bool AuthSocket::_HandleXferAccept() return false; } - ///- Launch a PatcherRunnable thread, starting at the begining of the patch file + ///- Launch a PatcherRunnable thread, starting at the beginning of the patch file ibuf.Remove(1); // clear input buffer - fseek(pPatch,0,0); + fseek(pPatch, 0, 0); ACE_Based::Thread u(*new PatcherRunnable(this)); return true; @@ -951,12 +966,12 @@ bool AuthSocket::_HandleXferAccept() /// Check if there is lag on the connection to the client bool AuthSocket::IsLag() { - return (TCP_BUFSIZE_READ-GetOutputLength()< 2*ChunkSize); + return (TCP_BUFSIZE_READ-GetOutputLength() < 2 * ChunkSize); } PatcherRunnable::PatcherRunnable(class AuthSocket * as) { - mySocket=as; + mySocket = as; } /// Send content of patch file to the client @@ -975,8 +990,8 @@ void PatcherRunnable::run() ACE_Based::Thread::Sleep(1); } ///- And send content of the patch file to the client - xfdata.data_size=fread(&xfdata.data,1,ChunkSize,mySocket->pPatch); - mySocket->SendBuf((const char*)&xfdata,xfdata.data_size +(sizeof(XFER_DATA_STRUCT)-ChunkSize)); + xfdata.data_size = fread(&xfdata.data, 1, ChunkSize, mySocket->pPatch); + mySocket->SendBuf((const char*)&xfdata, xfdata.data_size + (sizeof(XFER_DATA_STRUCT) - ChunkSize)); } } @@ -997,8 +1012,9 @@ void Patcher::LoadPatchesInfo() errno = 0; if ((dp = readdir(dirp)) != NULL) { - int l=strlen(dp->d_name); - if(l<8)continue; + int l = strlen(dp->d_name); + if(l < 8) + continue; if(!memcmp(&dp->d_name[l-4],".mpq",4)) LoadPatchMD5(dp->d_name); } @@ -1021,15 +1037,15 @@ void Patcher::LoadPatchesInfo() void Patcher::LoadPatchesInfo() { WIN32_FIND_DATA fil; - HANDLE hFil=FindFirstFile("./patches/*.mpq",&fil); - if(hFil==INVALID_HANDLE_VALUE) + HANDLE hFil=FindFirstFile("./patches/*.mpq", &fil); + if(hFil == INVALID_HANDLE_VALUE) return; // no patches were found do { LoadPatchMD5(fil.cFileName); } - while(FindNextFile(hFil,&fil)); + while(FindNextFile(hFil, &fil)); } #endif @@ -1039,11 +1055,11 @@ void Patcher::LoadPatchMD5(char * szFileName) ///- Try to open the patch file std::string path = "./patches/"; path += szFileName; - FILE * pPatch=fopen(path.c_str(),"rb"); - sLog.outDebug("Loading patch info from %s\n",path.c_str()); + FILE *pPatch = fopen(path.c_str(), "rb"); + sLog.outDebug("Loading patch info from %s\n", path.c_str()); if(!pPatch) { - sLog.outError("Error loading patch %s\n",path.c_str()); + sLog.outError("Error loading patch %s\n", path.c_str()); return; } @@ -1062,16 +1078,16 @@ void Patcher::LoadPatchMD5(char * szFileName) ///- Store the result in the internal patch hash map _patches[path] = new PATCH_INFO; - MD5_Final((uint8 *)&_patches[path]->md5 , &ctx); + MD5_Final((uint8 *)&_patches[path]->md5, &ctx); } /// Get cached MD5 hash for a given patch file -bool Patcher::GetHash(char * pat,uint8 mymd5[16]) +bool Patcher::GetHash(char * pat, uint8 mymd5[16]) { - for( Patches::iterator i = _patches.begin(); i != _patches.end(); i++ ) - if(!stricmp(pat,i->first.c_str () )) + for( Patches::iterator i = _patches.begin(); i != _patches.end(); ++i ) + if(!stricmp(pat, i->first.c_str())) { - memcpy(mymd5,i->second->md5,16); + memcpy(mymd5, i->second->md5, 16); return true; } @@ -1087,6 +1103,6 @@ Patcher::Patcher() /// Empty and delete the patch map on termination Patcher::~Patcher() { - for(Patches::iterator i = _patches.begin(); i != _patches.end(); i++ ) + for(Patches::iterator i = _patches.begin(); i != _patches.end(); ++i ) delete i->second; } From 3058ba26c6cd14bf7bbd75f97679720c707ec21d Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Tue, 28 Jul 2009 17:04:01 +0400 Subject: [PATCH 054/132] Applied coding style. --- src/game/MiscHandler.cpp | 76 +++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 40 deletions(-) diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index cd1c1fa7f..5dcfce30d 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -44,7 +44,7 @@ void WorldSession::HandleRepopRequestOpcode( WorldPacket & /*recv_data*/ ) { sLog.outDebug( "WORLD: Recvd CMSG_REPOP_REQUEST Message" ); - if(GetPlayer()->isAlive()||GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) + if(GetPlayer()->isAlive() || GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) return; // the world update order is sessions, players, creatures @@ -66,7 +66,7 @@ void WorldSession::HandleRepopRequestOpcode( WorldPacket & /*recv_data*/ ) void WorldSession::HandleWhoOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,4+4+1+1+4+4+4+4); + CHECK_PACKET_SIZE(recv_data, 4+4+1+1+4+4+4+4); sLog.outDebug( "WORLD: Recvd CMSG_WHO Message" ); //recv_data.hexlike(); @@ -82,12 +82,12 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data ) recv_data >> player_name; // player name, case sensitive... // recheck - CHECK_PACKET_SIZE(recv_data,4+4+(player_name.size()+1)+1+4+4+4+4); + CHECK_PACKET_SIZE(recv_data, 4+4+(player_name.size()+1)+1+4+4+4+4); recv_data >> guild_name; // guild name, case sensitive... // recheck - CHECK_PACKET_SIZE(recv_data,4+4+(player_name.size()+1)+(guild_name.size()+1)+4+4+4+4); + CHECK_PACKET_SIZE(recv_data, 4+4+(player_name.size()+1)+(guild_name.size()+1)+4+4+4+4); recv_data >> racemask; // race mask recv_data >> classmask; // class mask @@ -97,7 +97,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data ) return; // can't be received from real client or broken packet // recheck - CHECK_PACKET_SIZE(recv_data,4+4+(player_name.size()+1)+(guild_name.size()+1)+4+4+4+(4*zones_count)+4); + CHECK_PACKET_SIZE(recv_data, 4+4+(player_name.size()+1)+(guild_name.size()+1)+4+4+4+(4*zones_count)+4); for(uint32 i = 0; i < zones_count; ++i) { @@ -113,7 +113,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data ) return; // can't be received from real client or broken packet // recheck - CHECK_PACKET_SIZE(recv_data,4+4+(player_name.size()+1)+(guild_name.size()+1)+4+4+4+(4*zones_count)+4+(1*str_count)); + CHECK_PACKET_SIZE(recv_data, 4+4+(player_name.size()+1)+(guild_name.size()+1)+4+4+4+(4*zones_count)+4+(1*str_count)); sLog.outDebug("Minlvl %u, maxlvl %u, name %s, guild %s, racemask %u, classmask %u, zones %u, strings %u", level_min, level_max, player_name.c_str(), guild_name.c_str(), racemask, classmask, zones_count, str_count); @@ -262,8 +262,8 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data ) break; } - data.put( 0, clientcount ); //insert right count - data.put( sizeof(uint32), clientcount ); //insert right count + data.put( 0, clientcount ); // insert right count + data.put( sizeof(uint32), clientcount ); // insert right count SendPacket(&data); sLog.outDebug( "WORLD: Send SMSG_WHO Message" ); @@ -381,7 +381,7 @@ void WorldSession::HandleTogglePvP( WorldPacket & recv_data ) void WorldSession::HandleZoneUpdateOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,4); + CHECK_PACKET_SIZE(recv_data, 4); uint32 newZone; recv_data >> newZone; @@ -390,19 +390,19 @@ void WorldSession::HandleZoneUpdateOpcode( WorldPacket & recv_data ) // use server size data uint32 newzone, newarea; - GetPlayer()->GetZoneAndAreaId(newzone,newarea); - GetPlayer()->UpdateZone(newzone,newarea); + GetPlayer()->GetZoneAndAreaId(newzone, newarea); + GetPlayer()->UpdateZone(newzone, newarea); } void WorldSession::HandleSetTargetOpcode( WorldPacket & recv_data ) { // When this packet send? - CHECK_PACKET_SIZE(recv_data,8); + CHECK_PACKET_SIZE(recv_data, 8); uint64 guid ; recv_data >> guid; - _player->SetUInt32Value(UNIT_FIELD_TARGET,guid); + _player->SetUInt32Value(UNIT_FIELD_TARGET, guid); // update reputation list if need Unit* unit = ObjectAccessor::GetUnit(*_player, guid ); @@ -415,7 +415,7 @@ void WorldSession::HandleSetTargetOpcode( WorldPacket & recv_data ) void WorldSession::HandleSetSelectionOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8); + CHECK_PACKET_SIZE(recv_data, 8); uint64 guid; recv_data >> guid; @@ -433,7 +433,7 @@ void WorldSession::HandleSetSelectionOpcode( WorldPacket & recv_data ) void WorldSession::HandleStandStateChangeOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,1); + CHECK_PACKET_SIZE(recv_data, 1); sLog.outDebug( "WORLD: Received CMSG_STAND_STATE_CHANGE" ); uint8 animstate; @@ -544,7 +544,7 @@ void WorldSession::HandleDelFriendOpcode( WorldPacket & recv_data ) void WorldSession::HandleAddIgnoreOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,1); + CHECK_PACKET_SIZE(recv_data, 1); sLog.outDebug( "WORLD: Received CMSG_ADD_IGNORE" ); @@ -579,7 +579,7 @@ void WorldSession::HandleAddIgnoreOpcodeCallBack(QueryResult *result, uint32 acc FriendsResult ignoreResult = FRIEND_IGNORE_NOT_FOUND; if(IgnoreGuid) { - if(IgnoreGuid==session->GetPlayer()->GetGUID()) //not add yourself + if(IgnoreGuid == session->GetPlayer()->GetGUID()) //not add yourself ignoreResult = FRIEND_IGNORE_SELF; else if( session->GetPlayer()->GetSocial()->HasIgnore(GUID_LOPART(IgnoreGuid)) ) ignoreResult = FRIEND_IGNORE_ALREADY; @@ -627,7 +627,7 @@ void WorldSession::HandleSetContactNotesOpcode( WorldPacket & recv_data ) void WorldSession::HandleBugOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,4+4+1+4+1); + CHECK_PACKET_SIZE(recv_data, 4+4+1+4+1); uint32 suggestion, contentlen; std::string content; @@ -637,7 +637,7 @@ void WorldSession::HandleBugOpcode( WorldPacket & recv_data ) recv_data >> suggestion >> contentlen >> content; //recheck - CHECK_PACKET_SIZE(recv_data,4+4+(content.size()+1)+4+1); + CHECK_PACKET_SIZE(recv_data, 4+4+(content.size()+1)+4+1); recv_data >> typelen >> type; @@ -656,7 +656,7 @@ void WorldSession::HandleBugOpcode( WorldPacket & recv_data ) void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data) { - CHECK_PACKET_SIZE(recv_data,8); + CHECK_PACKET_SIZE(recv_data, 8); sLog.outDetail("WORLD: Received CMSG_RECLAIM_CORPSE"); if (GetPlayer()->isAlive()) @@ -696,7 +696,7 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data) void WorldSession::HandleResurrectResponseOpcode(WorldPacket & recv_data) { - CHECK_PACKET_SIZE(recv_data,8+1); + CHECK_PACKET_SIZE(recv_data, 8+1); sLog.outDetail("WORLD: Received CMSG_RESURRECT_RESPONSE"); @@ -986,7 +986,7 @@ void WorldSession::HandleRequestAccountData(WorldPacket& recv_data) void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data) { - CHECK_PACKET_SIZE(recv_data,1+2+1+1); + CHECK_PACKET_SIZE(recv_data, 1+2+1+1); sLog.outDebug( "WORLD: Received CMSG_SET_ACTION_BUTTON" ); uint8 button; @@ -1133,7 +1133,7 @@ void WorldSession::HandleMoveRootAck(WorldPacket&/* recv_data*/) void WorldSession::HandleSetActionBarToggles(WorldPacket& recv_data) { - CHECK_PACKET_SIZE(recv_data,1); + CHECK_PACKET_SIZE(recv_data, 1); uint8 ActionBar; @@ -1141,8 +1141,8 @@ void WorldSession::HandleSetActionBarToggles(WorldPacket& recv_data) if(!GetPlayer()) // ignore until not logged (check needed because STATUS_AUTHED) { - if(ActionBar!=0) - sLog.outError("WorldSession::HandleSetActionBarToggles in not logged state with value: %u, ignored",uint32(ActionBar)); + if(ActionBar != 0) + sLog.outError("WorldSession::HandleSetActionBarToggles in not logged state with value: %u, ignored", uint32(ActionBar)); return; } @@ -1152,11 +1152,11 @@ void WorldSession::HandleSetActionBarToggles(WorldPacket& recv_data) void WorldSession::HandleWardenDataOpcode(WorldPacket& /*recv_data*/) { /* - CHECK_PACKET_SIZE(recv_data,1); + CHECK_PACKET_SIZE(recv_data, 1); uint8 tmp; recv_data >> tmp; - sLog.outDebug("Received opcode CMSG_WARDEN_DATA, not resolve.uint8 = %u",tmp); + sLog.outDebug("Received opcode CMSG_WARDEN_DATA, not resolve.uint8 = %u", tmp); */ } @@ -1234,7 +1234,7 @@ void WorldSession::HandleInspectHonorStatsOpcode(WorldPacket& recv_data) void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recv_data) { - CHECK_PACKET_SIZE(recv_data,4+4+4+4+4+4); + CHECK_PACKET_SIZE(recv_data, 4+4+4+4+4+4); // write in client console: worldport 469 452 6454 2536 180 or /console worldport 469 452 6454 2536 180 // Received opcode CMSG_WORLD_TELEPORT @@ -1458,8 +1458,8 @@ void WorldSession::HandleTimeSyncResp( WorldPacket & recv_data ) void WorldSession::HandleResetInstancesOpcode( WorldPacket & /*recv_data*/ ) { sLog.outDebug("WORLD: CMSG_RESET_INSTANCES"); - Group *pGroup = _player->GetGroup(); - if(pGroup) + + if(Group *pGroup = _player->GetGroup()) { if(pGroup->IsLeader(_player->GetGUID())) pGroup->ResetInstances(INSTANCE_RESET_ALL, _player); @@ -1496,8 +1496,8 @@ void WorldSession::HandleSetDungeonDifficultyOpcode( WorldPacket & recv_data ) if(_player->getLevel() < LEVELREQUIREMENT_HEROIC) return; - Group *pGroup = _player->GetGroup(); - if(pGroup) + + if(Group *pGroup = _player->GetGroup()) { if(pGroup->IsLeader(_player->GetGUID())) { @@ -1543,8 +1543,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode( WorldPacket & recv_data ) if(_player->getLevel() < LEVELREQUIREMENT_HEROIC) return; - Group *pGroup = _player->GetGroup(); - if(pGroup) + if(Group *pGroup = _player->GetGroup()) { if(pGroup->IsLeader(_player->GetGUID())) { @@ -1564,7 +1563,6 @@ void WorldSession::HandleSetRaidDifficultyOpcode( WorldPacket & recv_data ) void WorldSession::HandleCancelMountAuraOpcode( WorldPacket & /*recv_data*/ ) { sLog.outDebug("WORLD: CMSG_CANCEL_MOUNT_AURA"); - //recv_data.hexlike(); //If player is not mounted, so go out :) if (!_player->IsMounted()) // not blizz like; no any messages on blizz @@ -1621,13 +1619,11 @@ void WorldSession::HandleSetTaxiBenchmarkOpcode( WorldPacket & recv_data ) void WorldSession::HandleQueryInspectAchievements( WorldPacket & recv_data ) { CHECK_PACKET_SIZE(recv_data, 1); + uint64 guid; if(!recv_data.readPackGUID(guid)) return; - Player *player = objmgr.GetPlayer(guid); - if(!player) - return; - - player->GetAchievementMgr().SendRespondInspectAchievements(_player); + if(Player *player = objmgr.GetPlayer(guid)) + player->GetAchievementMgr().SendRespondInspectAchievements(_player); } From eea0213d78aa1741449cb4973468ebd96cbdba9c Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Thu, 30 Jul 2009 08:21:54 +0400 Subject: [PATCH 055/132] Updated to 10170 client build. --- src/game/UpdateFields.h | 2 +- src/realmd/AuthCodes.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game/UpdateFields.h b/src/game/UpdateFields.h index fb7485d70..8011f4ed9 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, 2, 0, 10147 +// Auto generated for version 0, 2, 0, 10170 enum EObjectFields { diff --git a/src/realmd/AuthCodes.h b/src/realmd/AuthCodes.h index 456ffe5ad..461f871d1 100644 --- a/src/realmd/AuthCodes.h +++ b/src/realmd/AuthCodes.h @@ -66,8 +66,8 @@ enum LoginResult // 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.2.0 client build 10147... +// will only support WoW, WoW:TBC and WoW:WotLK 3.2.0 client build 10170... -#define EXPECTED_MANGOS_CLIENT_BUILD {10147, 0} +#define EXPECTED_MANGOS_CLIENT_BUILD {10170, 0} #endif From 2e2350d80048c4a6b4117a4b5ab55c41708ed936 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Fri, 31 Jul 2009 01:06:39 +0400 Subject: [PATCH 056/132] Updated to 10179 client build. --- src/game/UpdateFields.h | 2 +- src/realmd/AuthCodes.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game/UpdateFields.h b/src/game/UpdateFields.h index 8011f4ed9..0536be5f1 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, 2, 0, 10170 +// Auto generated for version 0, 2, 0, 10179 enum EObjectFields { diff --git a/src/realmd/AuthCodes.h b/src/realmd/AuthCodes.h index 461f871d1..357ac6076 100644 --- a/src/realmd/AuthCodes.h +++ b/src/realmd/AuthCodes.h @@ -66,8 +66,8 @@ enum LoginResult // 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.2.0 client build 10170... +// will only support WoW, WoW:TBC and WoW:WotLK 3.2.0 client build 10179... -#define EXPECTED_MANGOS_CLIENT_BUILD {10170, 0} +#define EXPECTED_MANGOS_CLIENT_BUILD {10179, 0} #endif From c30cfd71f5a66d87ce50794ac0af8eaab13a7476 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sat, 1 Aug 2009 09:22:00 +0400 Subject: [PATCH 057/132] Updated to 10192 client build. --- src/game/UpdateFields.h | 2 +- src/realmd/AuthCodes.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game/UpdateFields.h b/src/game/UpdateFields.h index 0536be5f1..4a2063d47 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, 2, 0, 10179 +// Auto generated for version 0, 2, 0, 10192 enum EObjectFields { diff --git a/src/realmd/AuthCodes.h b/src/realmd/AuthCodes.h index 357ac6076..b814db6ce 100644 --- a/src/realmd/AuthCodes.h +++ b/src/realmd/AuthCodes.h @@ -66,8 +66,8 @@ enum LoginResult // 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.2.0 client build 10179... +// will only support WoW, WoW:TBC and WoW:WotLK 3.2.0 client build 10192... -#define EXPECTED_MANGOS_CLIENT_BUILD {10179, 0} +#define EXPECTED_MANGOS_CLIENT_BUILD {10192, 0} #endif From 2855fa40575f02b86cddaf3248df99ec506b0f21 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Wed, 5 Aug 2009 14:53:33 +0400 Subject: [PATCH 058/132] Should work with live 3.2.0 client, not tested. --- src/game/UpdateFields.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/UpdateFields.h b/src/game/UpdateFields.h index 4a2063d47..4867c8c29 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, 2, 0, 10192 +// Auto generated for version 3, 2, 0, 10192 enum EObjectFields { From 3b67be525d5c819d95f90a4f16be629d7fd9afd5 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Fri, 7 Aug 2009 23:49:38 +0400 Subject: [PATCH 059/132] Enable creation of both faction charaters on PvP realms. --- src/game/CharacterHandler.cpp | 88 +++++++++++++++++------------------ 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index 26bf891f6..8eff58586 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -69,13 +69,13 @@ bool LoginQueryHolder::Initialize() res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADREPUTATION, "SELECT faction,standing,flags FROM character_reputation WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADINVENTORY, "SELECT data,bag,slot,item,item_template FROM character_inventory JOIN item_instance ON character_inventory.item = item_instance.guid WHERE character_inventory.guid = '%u' ORDER BY bag,slot", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACTIONS, "SELECT button,action,type FROM character_action WHERE guid = '%u' ORDER BY button", GUID_LOPART(m_guid)); - res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMAILCOUNT, "SELECT COUNT(id) FROM mail WHERE receiver = '%u' AND (checked & 1)=0 AND deliver_time <= '" UI64FMTD "'", GUID_LOPART(m_guid),(uint64)time(NULL)); + res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMAILCOUNT, "SELECT COUNT(id) FROM mail WHERE receiver = '%u' AND (checked & 1)=0 AND deliver_time <= '" UI64FMTD "'", GUID_LOPART(m_guid), (uint64)time(NULL)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMAILDATE, "SELECT MIN(deliver_time) FROM mail WHERE receiver = '%u' AND (checked & 1)=0", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSOCIALLIST, "SELECT friend,flags,note FROM character_social WHERE guid = '%u' LIMIT 255", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADHOMEBIND, "SELECT map,zone,position_x,position_y,position_z FROM character_homebind WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSPELLCOOLDOWNS, "SELECT spell,item,time FROM character_spell_cooldown WHERE guid = '%u'", GUID_LOPART(m_guid)); if(sWorld.getConfig(CONFIG_DECLINED_NAMES_USED)) - res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADDECLINEDNAMES, "SELECT genitive, dative, accusative, instrumental, prepositional FROM character_declinedname WHERE guid = '%u'",GUID_LOPART(m_guid)); + res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADDECLINEDNAMES, "SELECT genitive, dative, accusative, instrumental, prepositional FROM character_declinedname WHERE guid = '%u'", GUID_LOPART(m_guid)); // in other case still be dummy query res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGUILD, "SELECT guildid,rank FROM guild_member WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADARENAINFO, "SELECT arenateamid, played_week, played_season, wons_season, personal_rating FROM arena_team_member WHERE guid='%u'", GUID_LOPART(m_guid)); @@ -131,7 +131,7 @@ void WorldSession::HandleCharEnum(QueryResult * result) do { uint32 guidlow = (*result)[0].GetUInt32(); - sLog.outDetail("Loading char guid %u from account %u.",guidlow,GetAccountId()); + sLog.outDetail("Loading char guid %u from account %u.", guidlow, GetAccountId()); if(Player::BuildEnumData(result, &data)) ++num; } @@ -172,20 +172,20 @@ void WorldSession::HandleCharEnumOpcode( WorldPacket & /*recv_data*/ ) "LEFT JOIN character_declinedname ON characters.guid = character_declinedname.guid " "LEFT JOIN guild_member ON characters.guid = guild_member.guid " "WHERE characters.account = '%u' ORDER BY characters.guid", - PET_SAVE_AS_CURRENT,GetAccountId()); + PET_SAVE_AS_CURRENT, GetAccountId()); } void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,1+1+1+1+1+1+1+1+1+1); + CHECK_PACKET_SIZE(recv_data, 1+1+1+1+1+1+1+1+1+1); std::string name; - uint8 race_,class_; + uint8 race_, class_; recv_data >> name; // recheck with known string size - CHECK_PACKET_SIZE(recv_data,(name.size()+1)+1+1+1+1+1+1+1+1+1); + CHECK_PACKET_SIZE(recv_data, (name.size()+1)+1+1+1+1+1+1+1+1+1); recv_data >> race_; recv_data >> class_; @@ -201,8 +201,8 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) uint32 team = Player::TeamForRace(race_); switch(team) { - case ALLIANCE: disabled = mask & (1<<0); break; - case HORDE: disabled = mask & (1<<1); break; + case ALLIANCE: disabled = mask & (1 << 0); break; + case HORDE: disabled = mask & (1 << 1); break; } if(disabled) @@ -229,7 +229,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) if (raceEntry->expansion > Expansion()) { data << (uint8)CHAR_CREATE_EXPANSION; - sLog.outError("Expansion %u account:[%d] tried to Create character with expansion %u race (%u)",Expansion(),GetAccountId(),raceEntry->expansion,race_); + sLog.outError("Expansion %u account:[%d] tried to Create character with expansion %u race (%u)", Expansion(), GetAccountId(), raceEntry->expansion, race_); SendPacket( &data ); return; } @@ -238,7 +238,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) if (classEntry->expansion > Expansion()) { data << (uint8)CHAR_CREATE_EXPANSION_CLASS; - sLog.outError("Expansion %u account:[%d] tried to Create character with expansion %u class (%u)",Expansion(),GetAccountId(),classEntry->expansion,class_); + sLog.outError("Expansion %u account:[%d] tried to Create character with expansion %u class (%u)", Expansion(), GetAccountId(), classEntry->expansion, class_); SendPacket( &data ); return; } @@ -248,12 +248,12 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) { data << (uint8)CHAR_NAME_NO_NAME; SendPacket( &data ); - sLog.outError("Account:[%d] but tried to Create character with empty [name] ",GetAccountId()); + sLog.outError("Account:[%d] but tried to Create character with empty [name]", GetAccountId()); return; } // check name limitations - uint8 res = ObjectMgr::CheckPlayerName(name,true); + uint8 res = ObjectMgr::CheckPlayerName(name, true); if (res != CHAR_NAME_SUCCESS) { data << uint8(res); @@ -294,7 +294,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) uint8 charcount = 0; if ( result ) { - Field *fields=result->Fetch(); + Field *fields = result->Fetch(); charcount = fields[0].GetUInt8(); delete result; @@ -308,7 +308,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) // speedup check for heroic class disabled case uint32 heroic_free_slots = sWorld.getConfig(CONFIG_HEROIC_CHARACTERS_PER_REALM); - if(heroic_free_slots==0 && GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT) + if(heroic_free_slots == 0 && GetSecurity() == SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT) { data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT; SendPacket( &data ); @@ -317,14 +317,14 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) // speedup check for heroic class disabled case uint32 req_level_for_heroic = sWorld.getConfig(CONFIG_MIN_LEVEL_FOR_HEROIC_CHARACTER_CREATING); - if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && req_level_for_heroic > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)) + if(GetSecurity() == SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && req_level_for_heroic > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)) { data << (uint8)CHAR_CREATE_LEVEL_REQUIREMENT; SendPacket( &data ); return; } - bool AllowTwoSideAccounts = !sWorld.IsPvPRealm() || sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || GetSecurity() > SEC_PLAYER; + bool AllowTwoSideAccounts = sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || GetSecurity() > SEC_PLAYER; uint32 skipCinematics = sWorld.getConfig(CONFIG_SKIP_CINEMATICS); bool have_same_race = false; @@ -343,7 +343,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) Field* field = result2->Fetch(); uint8 acc_race = field[1].GetUInt32(); - if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT) + if(GetSecurity() == SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT) { uint8 acc_class = field[2].GetUInt32(); if(acc_class == CLASS_DEATH_KNIGHT) @@ -351,7 +351,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) if(heroic_free_slots > 0) --heroic_free_slots; - if(heroic_free_slots==0) + if(heroic_free_slots == 0) { data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT; SendPacket( &data ); @@ -371,7 +371,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) // TODO: what to if account already has characters of both races? if (!AllowTwoSideAccounts) { - uint32 acc_team=0; + uint32 acc_team = 0; if(acc_race > 0) acc_team = Player::TeamForRace(acc_race); @@ -397,7 +397,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) if(!have_same_race) have_same_race = race_ == acc_race; - if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT) + if(GetSecurity() == SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT) { uint8 acc_class = field[2].GetUInt32(); if(acc_class == CLASS_DEATH_KNIGHT) @@ -405,7 +405,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) if(heroic_free_slots > 0) --heroic_free_slots; - if(heroic_free_slots==0) + if(heroic_free_slots == 0) { data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT; SendPacket( &data ); @@ -425,7 +425,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) } } - if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && !have_req_level_for_heroic) + if(GetSecurity() == SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && !have_req_level_for_heroic) { data << (uint8)CHAR_CREATE_LEVEL_REQUIREMENT; SendPacket( &data ); @@ -437,7 +437,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) recv_data >> gender >> skin >> face; recv_data >> hairStyle >> hairColor >> facialHair >> outfitId; - Player * pNewChar = new Player(this); + Player *pNewChar = new Player(this); if(!pNewChar->Create( objmgr.GenerateLowGuid(HIGHGUID_PLAYER), name, race_, class_, gender, skin, face, hairStyle, hairColor, facialHair, outfitId )) { // Player not create (race/class problem?) @@ -454,7 +454,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) // Player created, save it now pNewChar->SaveToDB(); - charcount+=1; + charcount += 1; loginDatabase.PExecute("DELETE FROM realmcharacters WHERE acctid= '%d' AND realmid = '%d'", GetAccountId(), realmID); loginDatabase.PExecute("INSERT INTO realmcharacters (numchars, acctid, realmid) VALUES (%u, %u, %u)", charcount, GetAccountId(), realmID); @@ -465,13 +465,13 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) SendPacket( &data ); std::string IP_str = GetRemoteAddress(); - sLog.outBasic("Account: %d (IP: %s) Create Character:[%s]",GetAccountId(),IP_str.c_str(),name.c_str()); - sLog.outChar("Account: %d (IP: %s) Create Character:[%s]",GetAccountId(),IP_str.c_str(),name.c_str()); + sLog.outBasic("Account: %d (IP: %s) Create Character:[%s]", GetAccountId(), IP_str.c_str(), name.c_str()); + sLog.outChar("Account: %d (IP: %s) Create Character:[%s]", GetAccountId(), IP_str.c_str(), name.c_str()); } void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8); + CHECK_PACKET_SIZE(recv_data, 8); uint64 guid; recv_data >> guid; @@ -515,13 +515,13 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data ) return; std::string IP_str = GetRemoteAddress(); - sLog.outBasic("Account: %d (IP: %s) Delete Character:[%s] (guid: %u)",GetAccountId(),IP_str.c_str(),name.c_str(),GUID_LOPART(guid)); - sLog.outChar("Account: %d (IP: %s) Delete Character:[%s] (guid: %u)",GetAccountId(),IP_str.c_str(),name.c_str(),GUID_LOPART(guid)); + sLog.outBasic("Account: %d (IP: %s) Delete Character:[%s] (guid: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid)); + sLog.outChar("Account: %d (IP: %s) Delete Character:[%s] (guid: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid)); if(sLog.IsOutCharDump()) // optimize GetPlayerDump call { std::string dump = PlayerDumpWriter().GetDump(GUID_LOPART(guid)); - sLog.outCharDump(dump.c_str(),GetAccountId(),GUID_LOPART(guid),name.c_str()); + sLog.outCharDump(dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str()); } Player::DeleteFromDB(guid, GetAccountId()); @@ -533,11 +533,11 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data ) void WorldSession::HandlePlayerLoginOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8); + CHECK_PACKET_SIZE(recv_data, 8); if(PlayerLoading() || GetPlayer() != NULL) { - sLog.outError("Player tryes to login again, AccountId = %d",GetAccountId()); + sLog.outError("Player tryes to login again, AccountId = %d", GetAccountId()); return; } @@ -559,11 +559,11 @@ void WorldSession::HandlePlayerLoginOpcode( WorldPacket & recv_data ) CharacterDatabase.DelayQueryHolder(&chrHandler, &CharacterHandler::HandlePlayerLoginCallback, holder); } -void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) +void WorldSession::HandlePlayerLogin(LoginQueryHolder *holder) { uint64 playerGuid = holder->GetGuid(); - Player* pCurrChar = new Player(this); + Player *pCurrChar = new Player(this); pCurrChar->GetMotionMaster()->Initialize(); // "GetAccountId()==db stored account id" checked in LoadFromDB (prevent login not own character using cheating tools) @@ -614,13 +614,13 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) { if (nextpos != pos) { - data << str_motd.substr(pos,nextpos-pos); + data << str_motd.substr(pos, nextpos-pos); ++linecount; } - pos = nextpos+1; + pos = nextpos + 1; } - if (posGetName() ,pCurrChar->GetGUIDLow()); + GetAccountId(), IP_str.c_str(), pCurrChar->GetName(), pCurrChar->GetGUIDLow()); if(!pCurrChar->IsStandState() && !pCurrChar->hasUnitState(UNIT_STAT_STUNNED)) pCurrChar->SetStandState(UNIT_STAND_STATE_STAND); @@ -845,7 +845,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) void WorldSession::HandleSetFactionAtWar( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,4+1); + CHECK_PACKET_SIZE(recv_data, 4+1); DEBUG_LOG( "WORLD: Received CMSG_SET_FACTION_ATWAR" ); @@ -855,7 +855,7 @@ void WorldSession::HandleSetFactionAtWar( WorldPacket & recv_data ) recv_data >> repListID; recv_data >> flag; - GetPlayer()->GetReputationMgr().SetAtWar(repListID,flag); + GetPlayer()->GetReputationMgr().SetAtWar(repListID, flag); } //I think this function is never used :/ I dunno, but i guess this opcode not exists @@ -895,7 +895,7 @@ void WorldSession::HandleMeetingStoneInfo( WorldPacket & /*recv_data*/ ) void WorldSession::HandleTutorialFlag( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,4); + CHECK_PACKET_SIZE(recv_data, 4); uint32 iFlag; recv_data >> iFlag; @@ -929,7 +929,7 @@ void WorldSession::HandleTutorialReset( WorldPacket & /*recv_data*/ ) void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket & recv_data) { - CHECK_PACKET_SIZE(recv_data,4); + CHECK_PACKET_SIZE(recv_data, 4); DEBUG_LOG("WORLD: Received CMSG_SET_WATCHED_FACTION"); uint32 fact; @@ -939,7 +939,7 @@ void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket & recv_data) void WorldSession::HandleSetFactionInactiveOpcode(WorldPacket & recv_data) { - CHECK_PACKET_SIZE(recv_data,4+1); + CHECK_PACKET_SIZE(recv_data, 4+1); DEBUG_LOG("WORLD: Received CMSG_SET_FACTION_INACTIVE"); uint32 replistid; From e67d38648f39dd08a1e7372e0e554c7c557f1980 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sat, 8 Aug 2009 02:08:40 +0400 Subject: [PATCH 060/132] Fixed teleport bug. --- src/game/MovementHandler.cpp | 10 ++++++---- src/game/Opcodes.cpp | 2 ++ src/game/Opcodes.h | 4 +++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index 694d8c5fc..b82295f0b 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -160,13 +160,15 @@ void WorldSession::HandleMoveWorldportAckOpcode() void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data) { - CHECK_PACKET_SIZE(recv_data, 8+4); - sLog.outDebug("MSG_MOVE_TELEPORT_ACK"); uint64 guid; - uint32 flags, time; - recv_data >> guid; + if(!recv_data.readPackGUID(guid)) + return; + + CHECK_PACKET_SIZE(recv_data, recv_data.rpos()+4+4); + + uint32 flags, time; recv_data >> flags >> time; DEBUG_LOG("Guid " UI64FMTD, guid); DEBUG_LOG("Flags %u, time %u", flags, time/IN_MILISECONDS); diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp index bba16de8e..09be4e478 100644 --- a/src/game/Opcodes.cpp +++ b/src/game/Opcodes.cpp @@ -1295,4 +1295,6 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x4F2*/ { "UMSG_UNKNOWN_1266", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4F3*/ { "UMSG_UNKNOWN_1267", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4F4*/ { "UMSG_UNKNOWN_1268", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4F5*/ { "UMSG_UNKNOWN_1269", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4F6*/ { "UMSG_UNKNOWN_1270", STATUS_LOGGEDIN, &WorldSession::Handle_NULL }, }; diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h index 833b451e9..f131adfe0 100644 --- a/src/game/Opcodes.h +++ b/src/game/Opcodes.h @@ -1303,7 +1303,9 @@ enum Opcodes UMSG_UNKNOWN_1266 = 0x4F2, // not found 3.2 UMSG_UNKNOWN_1267 = 0x4F3, // not found 3.2 UMSG_UNKNOWN_1268 = 0x4F4, // not found 3.2 - NUM_MSG_TYPES = 0x4F5 + UMSG_UNKNOWN_1269 = 0x4F5, + UMSG_UNKNOWN_1270 = 0x4F6, + NUM_MSG_TYPES = 0x4F7 }; /// Player state From 6bf8eb346df785aa5858755311066113731d71e4 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sat, 8 Aug 2009 18:28:22 +0400 Subject: [PATCH 061/132] Added CMSG_WORLD_STATE_UI_TIMER_UPDATE handler. --- src/game/MiscHandler.cpp | 16 +++++++++++++--- src/game/Opcodes.cpp | 17 +++++++++-------- src/game/Opcodes.h | 25 +++++++++++++------------ src/game/WorldSession.h | 1 + 4 files changed, 36 insertions(+), 23 deletions(-) diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 5dcfce30d..9f00063fb 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -975,7 +975,7 @@ void WorldSession::HandleRequestAccountData(WorldPacket& recv_data) dest.resize(destSize); - WorldPacket data (SMSG_UPDATE_ACCOUNT_DATA, 8+4+4+4+destSize); + WorldPacket data(SMSG_UPDATE_ACCOUNT_DATA, 8+4+4+4+destSize); data << uint64(_player->GetGUID()); // player guid data << uint32(type); // type (0-7) data << uint32(adata->Time); // unix time @@ -1023,7 +1023,7 @@ void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data) sLog.outError( "MISC: Unknown action button type %u for action %u into button %u", type, action, button ); return; } - GetPlayer()->addActionButton(button,action,type); + GetPlayer()->addActionButton(button, action, type); } } @@ -1450,7 +1450,7 @@ void WorldSession::HandleTimeSyncResp( WorldPacket & recv_data ) recv_data >> counter >> time_; // time_ seems always more than getMSTime() - uint32 diff = getMSTimeDiff(getMSTime(),time_); + uint32 diff = getMSTimeDiff(getMSTime(), time_); sLog.outDebug("response sent: counter %u, time %u (HEX: %X), ms. time %u, diff %u", counter, time_, time_, getMSTime(), diff); } @@ -1627,3 +1627,13 @@ void WorldSession::HandleQueryInspectAchievements( WorldPacket & recv_data ) if(Player *player = objmgr.GetPlayer(guid)) player->GetAchievementMgr().SendRespondInspectAchievements(_player); } + +void WorldSession::HandleWorldStateUITimerUpdate(WorldPacket& recv_data) +{ + // empty opcode + sLog.outDebug("WORLD: CMSG_WORLD_STATE_UI_TIMER_UPDATE"); + + WorldPacket data(SMSG_WORLD_STATE_UI_TIMER_UPDATE, 4); + data << uint32(time(NULL)); + SendPacket(&data); +} diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp index 09be4e478..e2ff8282d 100644 --- a/src/game/Opcodes.cpp +++ b/src/game/Opcodes.cpp @@ -1284,17 +1284,18 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x4E7*/ { "CMSG_UNKNOWN_1255", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4E8*/ { "SMSG_UNKNOWN_1256", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x4E9*/ { "UMSG_UNKNOWN_1257", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4EA*/ { "MSG_SET_RAID_DIFFICULTY", STATUS_LOGGEDIN, &WorldSession::HandleSetRaidDifficultyOpcode }, - /*0x4EB*/ { "UMSG_UNKNOWN_1259", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4EC*/ { "SMSG_TOGGLE_XP_GAIN", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x4ED*/ { "SMSG_UNKNOWN_1261", STATUS_NEVER, &WorldSession::Handle_ServerSide }, + /*0x4EA*/ { "UMSG_UNKNOWN_1258", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4EB*/ { "MSG_SET_RAID_DIFFICULTY", STATUS_LOGGEDIN, &WorldSession::HandleSetRaidDifficultyOpcode }, + /*0x4EC*/ { "UMSG_UNKNOWN_1260", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4ED*/ { "SMSG_TOGGLE_XP_GAIN", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x4EE*/ { "SMSG_UNKNOWN_1262", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x4EF*/ { "CMSG_UNKNOWN_1263", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4F0*/ { "SMSG_UNKNOWN_1264", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x4F1*/ { "UMSG_UNKNOWN_1265", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4EF*/ { "SMSG_UNKNOWN_1263", STATUS_NEVER, &WorldSession::Handle_ServerSide }, + /*0x4F0*/ { "CMSG_UNKNOWN_1264", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4F1*/ { "SMSG_UNKNOWN_1265", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x4F2*/ { "UMSG_UNKNOWN_1266", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4F3*/ { "UMSG_UNKNOWN_1267", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4F4*/ { "UMSG_UNKNOWN_1268", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4F5*/ { "UMSG_UNKNOWN_1269", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4F6*/ { "UMSG_UNKNOWN_1270", STATUS_LOGGEDIN, &WorldSession::Handle_NULL }, + /*0x4F6*/ { "CMSG_WORLD_STATE_UI_TIMER_UPDATE", STATUS_LOGGEDIN, &WorldSession::HandleWorldStateUITimerUpdate }, + /*0x4F7*/ { "SMSG_WORLD_STATE_UI_TIMER_UPDATE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, }; diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h index f131adfe0..0a6c6b268 100644 --- a/src/game/Opcodes.h +++ b/src/game/Opcodes.h @@ -1275,8 +1275,8 @@ enum Opcodes SMSG_EQUIPMENT_SET_USE_RESULT = 0x4D6, // SMSG, UseEquipmentSetResult? UMSG_UNKNOWN_1239 = 0x4D7, // not found 3.2 SMSG_UNKNOWN_1240 = 0x4D8, // SMSG, uint64, string - CMSG_UNKNOWN_1241 = 0x4D9, // lua: CreateCharacter (PFC client response) - SMSG_UNKNOWN_1242 = 0x4DA, // response to 1241 (PFC server response) + CMSG_CHAR_FACTION_CHANGE = 0x4D9, // lua: CreateCharacter (PFC client response) + SMSG_CHAR_FACTION_CHANGE = 0x4DA, // response to 1241 (PFC server response) UMSG_UNKNOWN_1243 = 0x4DB, // not found 3.2 UMSG_UNKNOWN_1244 = 0x4DC, // not found 3.2 UMSG_UNKNOWN_1245 = 0x4DD, // not found 3.2 @@ -1292,20 +1292,21 @@ enum Opcodes CMSG_UNKNOWN_1255 = 0x4E7, // lua: BattlefieldMgrExitRequest SMSG_UNKNOWN_1256 = 0x4E8, // uint32, uint32 UMSG_UNKNOWN_1257 = 0x4E9, // not found 3.2 - MSG_SET_RAID_DIFFICULTY = 0x4EA, // lua: SetRaidDificulty - UMSG_UNKNOWN_1259 = 0x4EB, // not found 3.2 - SMSG_TOGGLE_XP_GAIN = 0x4EC, // enable/disable XP gain console message - SMSG_UNKNOWN_1261 = 0x4ED, + UMSG_UNKNOWN_1258 = 0x4EA, // not found 3.2 + MSG_SET_RAID_DIFFICULTY = 0x4EB, // lua: SetRaidDifficulty + UMSG_UNKNOWN_1260 = 0x4EC, // not found 3.2 + SMSG_TOGGLE_XP_GAIN = 0x4ED, // enable/disable XP gain console message SMSG_UNKNOWN_1262 = 0x4EE, - CMSG_UNKNOWN_1263 = 0x4EF, // lua: GMResponseResolve - SMSG_UNKNOWN_1264 = 0x4F0, - UMSG_UNKNOWN_1265 = 0x4F1, // not found 3.2 + SMSG_UNKNOWN_1263 = 0x4EF, + CMSG_UNKNOWN_1264 = 0x4F0, // lua: GMResponseResolve + SMSG_UNKNOWN_1265 = 0x4F1, UMSG_UNKNOWN_1266 = 0x4F2, // not found 3.2 UMSG_UNKNOWN_1267 = 0x4F3, // not found 3.2 UMSG_UNKNOWN_1268 = 0x4F4, // not found 3.2 - UMSG_UNKNOWN_1269 = 0x4F5, - UMSG_UNKNOWN_1270 = 0x4F6, - NUM_MSG_TYPES = 0x4F7 + UMSG_UNKNOWN_1269 = 0x4F5, // not found 3.2 + CMSG_WORLD_STATE_UI_TIMER_UPDATE = 0x4F6, + SMSG_WORLD_STATE_UI_TIMER_UPDATE = 0x4F7, + NUM_MSG_TYPES = 0x4F8 }; /// Player state diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h index 1f040849d..a7fbcadc0 100644 --- a/src/game/WorldSession.h +++ b/src/game/WorldSession.h @@ -712,6 +712,7 @@ class MANGOS_DLL_SPEC WorldSession void HandleEquipmentSetSave(WorldPacket& recv_data); void HandleEquipmentSetDelete(WorldPacket& recv_data); void HandleEquipmentSetUse(WorldPacket& recv_data); + void HandleWorldStateUITimerUpdate(WorldPacket& recv_data); private: // private trade methods void moveItems(Item* myItems[], Item* hisItems[]); From 1df1f7cff5db38e7747a9044c0dbdd5821bcd16c Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sun, 9 Aug 2009 18:08:14 +0400 Subject: [PATCH 062/132] Fixed player movement. Fixed multinode taxi. Removed some unhandled opcode spam. --- src/game/Group.cpp | 4 +-- src/game/ItemHandler.cpp | 27 +++++++++++++++ src/game/ItemPrototype.h | 4 +++ src/game/MovementHandler.cpp | 67 ++++++++++++++++++++++++++++-------- src/game/Opcodes.cpp | 6 ++-- src/game/Opcodes.h | 6 ++-- src/game/TaxiHandler.cpp | 8 ++--- src/game/WorldSession.cpp | 48 ++++++++++++++++++++++++-- src/game/WorldSession.h | 2 ++ 9 files changed, 142 insertions(+), 30 deletions(-) diff --git a/src/game/Group.cpp b/src/game/Group.cpp index 75299c935..3a38909c1 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -109,8 +109,8 @@ bool Group::Create(const uint64 &guid, const char * name) CharacterDatabase.BeginTransaction(); CharacterDatabase.PExecute("DELETE FROM groups WHERE leaderGuid ='%u'", GUID_LOPART(m_leaderGuid)); CharacterDatabase.PExecute("DELETE FROM group_member WHERE leaderGuid ='%u'", GUID_LOPART(m_leaderGuid)); - CharacterDatabase.PExecute("INSERT INTO groups(leaderGuid,mainTank,mainAssistant,lootMethod,looterGuid,lootThreshold,icon1,icon2,icon3,icon4,icon5,icon6,icon7,icon8,isRaid,difficulty,raiddifficulty) " - "VALUES('%u','%u','%u','%u','%u','%u','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','%u','%u')", + CharacterDatabase.PExecute("INSERT INTO groups (leaderGuid,mainTank,mainAssistant,lootMethod,looterGuid,lootThreshold,icon1,icon2,icon3,icon4,icon5,icon6,icon7,icon8,isRaid,difficulty,raiddifficulty) " + "VALUES ('%u','%u','%u','%u','%u','%u','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','%u','%u','%u')", GUID_LOPART(m_leaderGuid), GUID_LOPART(m_mainTank), GUID_LOPART(m_mainAssistant), uint32(m_lootMethod), GUID_LOPART(m_looterGuid), uint32(m_lootThreshold), m_targetIcons[0], m_targetIcons[1], m_targetIcons[2], m_targetIcons[3], m_targetIcons[4], m_targetIcons[5], m_targetIcons[6], m_targetIcons[7], isRaidGroup(), m_dungeonDifficulty, m_raidDifficulty); } diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp index ec9a285d8..692464cf6 100644 --- a/src/game/ItemHandler.cpp +++ b/src/game/ItemHandler.cpp @@ -1378,3 +1378,30 @@ void WorldSession::HandleCancelTempEnchantmentOpcode(WorldPacket& recv_data) GetPlayer()->ApplyEnchantment(item, TEMP_ENCHANTMENT_SLOT, false); item->ClearEnchantment(TEMP_ENCHANTMENT_SLOT); } + +void WorldSession::HandleItemRefundInfoRequest(WorldPacket& recv_data) +{ + sLog.outDebug("WORLD: CMSG_ITEM_REFUND_INFO_REQUEST"); + + CHECK_PACKET_SIZE(recv_data, 8); + + uint64 guid; + + recv_data >> guid; // item guid + + Item *item = _player->GetItemByGuid(guid); + + if(!item) + { + sLog.outDebug("Item refund: item not found!"); + return; + } + + if(!item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_REFUNDABLE)) + { + sLog.outDebug("Item refund: item not refundable!"); + return; + } + + // refund system not implemented yet +} diff --git a/src/game/ItemPrototype.h b/src/game/ItemPrototype.h index cfa41ac05..1789752b1 100644 --- a/src/game/ItemPrototype.h +++ b/src/game/ItemPrototype.h @@ -109,8 +109,11 @@ enum ITEM_FLAGS ITEM_FLAGS_OPENABLE = 0x00000004, ITEM_FLAGS_WRAPPED = 0x00000008, ITEM_FLAGS_BROKEN = 0x00000010, // appears red icon (like when item durability==0) + ITEM_FLAGS_TOTEM = 0x00000020, // ? + ITEM_FLAGS_USABLE = 0x00000040, // ? ITEM_FLAGS_WRAPPER = 0x00000200, // used or not used wrapper ITEM_FLAGS_PARTY_LOOT = 0x00000800, // determines if item is party loot or not + ITEM_FLAGS_REFUNDABLE = 0x00001000, // item cost can be refunded within 2 hours after purchase ITEM_FLAGS_CHARTER = 0x00002000, // arena/guild charter ITEM_FLAGS_PROSPECTABLE = 0x00040000, ITEM_FLAGS_UNIQUE_EQUIPPED = 0x00080000, @@ -118,6 +121,7 @@ enum ITEM_FLAGS ITEM_FLAGS_THROWABLE = 0x00400000, // not used in game for check trow possibility, only for item in game tooltip ITEM_FLAGS_SPECIALUSE = 0x00800000, // last used flag in 2.3.0 ITEM_FLAGS_BOA = 0x08000000, // bind on account (set in template for items that can binded in like way) + ITEM_FLAGS_ENCHANT_SCROLL = 0x10000000, // for enchant scrolls ITEM_FLAGS_MILLABLE = 0x20000000 }; diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index b82295f0b..d541e822a 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -216,20 +216,26 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data ) recv_data.hexlike(); Unit *mover = _player->m_mover; - Player *plMover = mover->GetTypeId()==TYPEID_PLAYER ? (Player*)mover : NULL; + Player *plMover = mover->GetTypeId() == TYPEID_PLAYER ? (Player*)mover : NULL; // ignore, waiting processing in WorldSession::HandleMoveWorldportAckOpcode and WorldSession::HandleMoveTeleportAck if(plMover && plMover->IsBeingTeleported()) return; /* extract packet */ + uint64 guid; + + if(!recv_data.readPackGUID(guid)) + return; + MovementInfo movementInfo; + movementInfo.guid = guid; ReadMovementInfo(recv_data, &movementInfo); /*----------------*/ if(recv_data.size() != recv_data.rpos()) { - sLog.outError("MovementHandler: player %s (guid %d, account %u) sent a packet (opcode %u) that is " SIZEFMTD " bytes larger than it should be. Kicked as cheater.", _player->GetName(), _player->GetGUIDLow(), _player->GetSession()->GetAccountId(), recv_data.GetOpcode(), recv_data.size() - recv_data.rpos()); + sLog.outError("MovementHandler: player %s (guid %d, account %u) sent a packet (opcode %u) that is " SIZEFMTD " bytes larger than it should be. Kicked as cheater.", _player->GetName(), _player->GetGUIDLow(), _player->GetSession()->GetAccountId(), opcode, recv_data.size() - recv_data.rpos()); KickPlayer(); return; } @@ -289,17 +295,17 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data ) /*----------------------*/ /* process position-change */ - recv_data.put(6, getMSTime()); // fix time, offset flags(4) + unk(2) - WorldPacket data(recv_data.GetOpcode(), (mover->GetPackGUID().size()+recv_data.size())); - data.append(mover->GetPackGUID()); // use mover guid - data.append(recv_data.contents(), recv_data.size()); + WorldPacket data(opcode, recv_data.size()); + movementInfo.time = getMSTime(); + movementInfo.guid = mover->GetGUID(); + WriteMovementInfo(&data, &movementInfo); GetPlayer()->SendMessageToSet(&data, false); if(plMover) // nothing is charmed, or player charmed { plMover->SetPosition(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o); plMover->m_movementInfo = movementInfo; - plMover->UpdateFallInformationIfNeed(movementInfo, recv_data.GetOpcode()); + plMover->UpdateFallInformationIfNeed(movementInfo, opcode); if(plMover->isMovingOrTurning()) plMover->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); @@ -344,26 +350,28 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data ) void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data) { - sLog.outDebug("WORLD: Recvd %s (%u, 0x%X) opcode", LookupOpcodeName(recv_data.GetOpcode()), recv_data.GetOpcode(), recv_data.GetOpcode()); - - CHECK_PACKET_SIZE(recv_data, recv_data.rpos()+8+4); + uint32 opcode = recv_data.GetOpcode(); + sLog.outDebug("WORLD: Recvd %s (%u, 0x%X) opcode", LookupOpcodeName(opcode), opcode, opcode); /* extract packet */ uint64 guid; uint32 unk1; float newspeed; - recv_data >> guid; + if(!recv_data.readPackGUID(guid)) + return; // now can skip not our packet if(_player->GetGUID() != guid) return; // continue parse packet + CHECK_PACKET_SIZE(recv_data, recv_data.rpos()+4); recv_data >> unk1; // counter or moveEvent MovementInfo movementInfo; + movementInfo.guid = guid; ReadMovementInfo(recv_data, &movementInfo); // recheck @@ -372,6 +380,13 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data) recv_data >> newspeed; /*----------------*/ + if(recv_data.size() != recv_data.rpos()) + { + sLog.outError("MovementHandler: player %s (guid %d, account %u) sent a packet (opcode %u) that is " SIZEFMTD " bytes larger than it should be. Kicked as cheater.", _player->GetName(), _player->GetGUIDLow(), _player->GetSession()->GetAccountId(), opcode, recv_data.size() - recv_data.rpos()); + KickPlayer(); + return; + } + // client ACK send one packet for mounted/run case and need skip all except last from its // in other cases anti-cheat check can be fail in false case UnitMoveType move_type; @@ -379,7 +394,6 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data) static char const* move_type_name[MAX_MOVE_TYPE] = { "Walk", "Run", "RunBack", "Swim", "SwimBack", "TurnRate", "Flight", "FlightBack", "PitchRate" }; - uint16 opcode = recv_data.GetOpcode(); switch(opcode) { case CMSG_FORCE_WALK_SPEED_CHANGE_ACK: move_type = MOVE_WALK; force_move_type = MOVE_WALK; break; @@ -444,10 +458,10 @@ void WorldSession::HandleMoveNotActiveMover(WorldPacket &recv_data) sLog.outDebug("WORLD: Recvd CMSG_MOVE_NOT_ACTIVE_MOVER"); recv_data.hexlike(); - CHECK_PACKET_SIZE(recv_data, recv_data.rpos()+8); - uint64 old_mover_guid; - recv_data >> old_mover_guid; + + if(!recv_data.readPackGUID(old_mover_guid)) + return; if(_player->m_mover->GetGUID() == old_mover_guid) { @@ -456,7 +470,16 @@ void WorldSession::HandleMoveNotActiveMover(WorldPacket &recv_data) } MovementInfo mi; + mi.guid = old_mover_guid; ReadMovementInfo(recv_data, &mi); + + if(recv_data.size() != recv_data.rpos()) + { + sLog.outError("MovementHandler: player %s (guid %d, account %u) sent a packet (opcode %u) that is " SIZEFMTD " bytes larger than it should be. Kicked as cheater.", _player->GetName(), _player->GetGUIDLow(), _player->GetSession()->GetAccountId(), recv_data.GetOpcode(), recv_data.size() - recv_data.rpos()); + KickPlayer(); + return; + } + _player->m_movementInfo = mi; } @@ -470,8 +493,22 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data) if(!vehicleGUID) // something wrong here... return; + uint64 guid; + + if(!recv_data.readPackGUID(guid)) + return; + MovementInfo mi; + mi.guid = guid; ReadMovementInfo(recv_data, &mi); + + if(recv_data.size() != recv_data.rpos()) + { + sLog.outError("MovementHandler: player %s (guid %d, account %u) sent a packet (opcode %u) that is " SIZEFMTD " bytes larger than it should be. Kicked as cheater.", _player->GetName(), _player->GetGUIDLow(), _player->GetSession()->GetAccountId(), recv_data.GetOpcode(), recv_data.size() - recv_data.rpos()); + KickPlayer(); + return; + } + _player->m_movementInfo = mi; // using charm guid, because we don't have vehicle guid... diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp index e2ff8282d..e364bfd22 100644 --- a/src/game/Opcodes.cpp +++ b/src/game/Opcodes.cpp @@ -1229,7 +1229,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x4B0*/ { "UMSG_UNKNOWN_1200", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4B1*/ { "UMSG_UNKNOWN_1201", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4B2*/ { "SMSG_UNKNOWN_1202", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x4B3*/ { "CMSG_UNKNOWN_1203", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4B3*/ { "CMSG_ITEM_REFUND_INFO_REQUEST", STATUS_LOGGEDIN, &WorldSession::HandleItemRefundInfoRequest }, /*0x4B4*/ { "CMSG_UNKNOWN_1204", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4B5*/ { "SMSG_UNKNOWN_1205", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x4B6*/ { "CMSG_UNKNOWN_1206", STATUS_NEVER, &WorldSession::Handle_NULL }, @@ -1257,9 +1257,9 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x4CC*/ { "UMSG_UNKNOWN_1228", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4CD*/ { "SMSG_UNKNOWN_1229", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x4CE*/ { "SMSG_UNKNOWN_1230", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x4CF*/ { "UMSG_UNKNOWN_1231", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4CF*/ { "CMSG_UNKNOWN_1231_ACK", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4D0*/ { "SMSG_UNKNOWN_1232", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x4D1*/ { "UMSG_UNKNOWN_1233", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4D1*/ { "CMSG_UNKNOWN_1233_ACK", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4D2*/ { "SMSG_UNKNOWN_1234", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x4D3*/ { "SMSG_UNKNOWN_1235", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x4D4*/ { "SMSG_UNKNOWN_1236", STATUS_NEVER, &WorldSession::Handle_ServerSide }, diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h index 0a6c6b268..a41e833c8 100644 --- a/src/game/Opcodes.h +++ b/src/game/Opcodes.h @@ -1237,7 +1237,7 @@ enum Opcodes UMSG_UNKNOWN_1200 = 0x4B0, // not found UMSG_UNKNOWN_1201 = 0x4B1, // not found SMSG_UNKNOWN_1202 = 0x4B2, // refund something - CMSG_UNKNOWN_1203 = 0x4B3, // refund request? + CMSG_ITEM_REFUND_INFO_REQUEST = 0x4B3, // refund request? CMSG_UNKNOWN_1204 = 0x4B4, // lua: ContainerRefundItemPurchase SMSG_UNKNOWN_1205 = 0x4B5, // refund something CMSG_UNKNOWN_1206 = 0x4B6, // CMSG, uint32 @@ -1265,9 +1265,9 @@ enum Opcodes UMSG_UNKNOWN_1228 = 0x4CC, // not found 3.2 SMSG_UNKNOWN_1229 = 0x4CD, // SMSG, any opcode? SMSG_UNKNOWN_1230 = 0x4CE, // SMSG, movement related - UMSG_UNKNOWN_1231 = 0x4CF, // not found 3.2 + CMSG_UNKNOWN_1231_ACK = 0x4CF, // movement related SMSG_UNKNOWN_1232 = 0x4D0, // SMSG, movement related - UMSG_UNKNOWN_1233 = 0x4D1, // not found 3.2 + CMSG_UNKNOWN_1233_ACK = 0x4D1, // movement related SMSG_UNKNOWN_1234 = 0x4D2, // SMSG, movement related SMSG_UNKNOWN_1235 = 0x4D3, // SMSG, movement related SMSG_UNKNOWN_1236 = 0x4D4, // SMSG, movement related diff --git a/src/game/TaxiHandler.cpp b/src/game/TaxiHandler.cpp index fe2f28c3b..b3118aa14 100644 --- a/src/game/TaxiHandler.cpp +++ b/src/game/TaxiHandler.cpp @@ -158,14 +158,14 @@ bool WorldSession::SendLearnNewTaxiNode( Creature* unit ) void WorldSession::HandleActivateTaxiExpressOpcode ( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8+4+4); + CHECK_PACKET_SIZE(recv_data,8+4); sLog.outDebug( "WORLD: Received CMSG_ACTIVATETAXIEXPRESS" ); uint64 guid; - uint32 node_count, _totalcost; + uint32 node_count; - recv_data >> guid >> _totalcost >> node_count; + recv_data >> guid >> node_count; Creature *npc = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER); if (!npc) @@ -174,7 +174,7 @@ void WorldSession::HandleActivateTaxiExpressOpcode ( WorldPacket & recv_data ) return; } // recheck - CHECK_PACKET_SIZE(recv_data,8+4+4+node_count*4); + CHECK_PACKET_SIZE(recv_data,8+4+node_count*4); std::vector nodes; diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index eb16e4d13..a52eec5ef 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -629,9 +629,6 @@ void WorldSession::SaveTutorialsData() void WorldSession::ReadMovementInfo(WorldPacket &data, MovementInfo *mi) { - if(!data.readPackGUID(mi->guid)) - return; - CHECK_PACKET_SIZE(data, data.rpos()+4+2+4+4+4+4+4); data >> mi->flags; data >> mi->unk1; @@ -680,6 +677,51 @@ void WorldSession::ReadMovementInfo(WorldPacket &data, MovementInfo *mi) } } +void WorldSession::WriteMovementInfo(WorldPacket *data, MovementInfo *mi) +{ + data->appendPackGUID(mi->guid); + + *data << mi->flags; + *data << mi->unk1; + *data << mi->time; + *data << mi->x; + *data << mi->y; + *data << mi->z; + *data << mi->o; + + if(mi->HasMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) + { + data->appendPackGUID(mi->t_guid); + + *data << mi->t_x; + *data << mi->t_y; + *data << mi->t_z; + *data << mi->t_o; + *data << mi->t_time; + *data << mi->t_seat; + } + + if((mi->HasMovementFlag(MovementFlags(MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING2))) || (mi->unk1 & 0x20)) + { + *data << mi->s_pitch; + } + + *data << mi->fallTime; + + if(mi->HasMovementFlag(MOVEMENTFLAG_JUMPING)) + { + *data << mi->j_unk; + *data << mi->j_sinAngle; + *data << mi->j_cosAngle; + *data << mi->j_xyspeed; + } + + if(mi->HasMovementFlag(MOVEMENTFLAG_SPLINE)) + { + *data << mi->u_unk1; + } +} + void WorldSession::ReadAddonsInfo(WorldPacket &data) { if (data.rpos() + 4 > data.size()) diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h index a7fbcadc0..9e916fbf2 100644 --- a/src/game/WorldSession.h +++ b/src/game/WorldSession.h @@ -110,6 +110,7 @@ class MANGOS_DLL_SPEC WorldSession void SendAddonsInfo(); void ReadMovementInfo(WorldPacket &data, MovementInfo *mi); + void WriteMovementInfo(WorldPacket *data, MovementInfo *mi); void SendPacket(WorldPacket const* packet); void SendNotification(const char *format,...) ATTR_PRINTF(2,3); @@ -667,6 +668,7 @@ class MANGOS_DLL_SPEC WorldSession void HandleSocketOpcode(WorldPacket& recv_data); void HandleCancelTempEnchantmentOpcode(WorldPacket& recv_data); + void HandleItemRefundInfoRequest(WorldPacket& recv_data); void HandleChannelVoiceOnOpcode(WorldPacket & recv_data); void HandleVoiceSessionEnableOpcode(WorldPacket& recv_data); From 0b8a22d06305d90e96bc6dd758fc5abf0d9a5303 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sun, 9 Aug 2009 18:27:01 +0400 Subject: [PATCH 063/132] Attempt to fix mail. --- src/game/Mail.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/game/Mail.cpp b/src/game/Mail.cpp index 139302047..b919340d3 100644 --- a/src/game/Mail.cpp +++ b/src/game/Mail.cpp @@ -574,7 +574,7 @@ void WorldSession::HandleMailTakeMoney(WorldPacket & recv_data ) //called when player lists his received mails void WorldSession::HandleGetMailList(WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8); + CHECK_PACKET_SIZE(recv_data, 8); uint64 mailbox; recv_data >> mailbox; @@ -594,6 +594,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data ) uint32 mails_count = 0; // real send to client mails amount WorldPacket data(SMSG_MAIL_LIST_RESULT, (200)); // guess size + data << uint32(0); // 3.2.0 data << uint8(0); // mail's count time_t cur_time = time(NULL); From 7b4a7def8a7fce2e710f74133d8bfffbab90e7f1 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sun, 9 Aug 2009 20:11:23 +0400 Subject: [PATCH 064/132] Second attempt to fix mail. --- src/game/Mail.cpp | 72 +++++++++++++++++++++++++---------------------- 1 file changed, 39 insertions(+), 33 deletions(-) diff --git a/src/game/Mail.cpp b/src/game/Mail.cpp index b919340d3..f3ce42151 100644 --- a/src/game/Mail.cpp +++ b/src/game/Mail.cpp @@ -591,10 +591,11 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data ) // client can't work with packets > max int16 value const uint32 maxPacketSize = 32767; - uint32 mails_count = 0; // real send to client mails amount + uint32 mailsCount = 0; // send to client mails amount + uint32 realCount = 0; // real mails amount - WorldPacket data(SMSG_MAIL_LIST_RESULT, (200)); // guess size - data << uint32(0); // 3.2.0 + WorldPacket data(SMSG_MAIL_LIST_RESULT, 200); // guess size + data << uint32(0); // real mail's count data << uint8(0); // mail's count time_t cur_time = time(NULL); @@ -609,7 +610,10 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data ) size_t next_mail_size = 2+4+1+8+4*8+((*itr)->subject.size()+1)+1+item_count*(1+4+4+6*3*4+4+4+1+4+4+4); if(data.wpos()+next_mail_size > maxPacketSize) - break; + { + realCount += 1; + continue; + } uint32 show_flags = 0; if ((*itr)->messageType != MAIL_NORMAL) @@ -619,9 +623,9 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data ) if ((*itr)->COD) show_flags |= MAIL_SHOW_COD; - data << (uint16) 0x0040; // unknown 2.3.0, different values - data << (uint32) (*itr)->messageID; // Message ID - data << (uint8) (*itr)->messageType; // Message Type + data << uint16(0x0040); // unknown 2.3.0, different values + data << uint32((*itr)->messageID); // Message ID + data << uint8((*itr)->messageType); // Message Type switch((*itr)->messageType) { @@ -631,63 +635,65 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data ) case MAIL_CREATURE: case MAIL_GAMEOBJECT: case MAIL_AUCTION: - data << (uint32) (*itr)->sender; // creature/gameobject entry, auction id + data << uint32((*itr)->sender); // creature/gameobject entry, auction id break; case MAIL_ITEM: // item entry (?) sender = "Unknown", NYI + data << uint32(0); // item entry break; } - data << (uint32) (*itr)->COD; // COD - data << (uint32) (*itr)->itemTextId; // sure about this - data << (uint32) 0; // unknown - data << (uint32) (*itr)->stationery; // stationery (Stationery.dbc) - data << (uint32) (*itr)->money; // Gold - data << (uint32) show_flags; // unknown, 0x4 - auction, 0x10 - normal - // Time - data << (float) ((*itr)->expire_time-time(NULL))/DAY; - data << (uint32) (*itr)->mailTemplateId; // mail template (MailTemplate.dbc) + data << uint32((*itr)->COD); // COD + data << uint32((*itr)->itemTextId); // sure about this + data << uint32(0); // unknown + data << uint32((*itr)->stationery); // stationery (Stationery.dbc) + data << uint32((*itr)->money); // Gold + data << uint32(show_flags); // unknown, 0x4 - auction, 0x10 - normal + data << float(((*itr)->expire_time-time(NULL))/DAY);// Time + data << uint32((*itr)->mailTemplateId); // mail template (MailTemplate.dbc) data << (*itr)->subject; // Subject string - once 00, when mail type = 3 - data << (uint8) item_count; // client limit is 0x10 + data << uint8(item_count); // client limit is 0x10 for(uint8 i = 0; i < item_count; ++i) { Item *item = pl->GetMItem((*itr)->items[i].item_guid); // item index (0-6?) - data << (uint8) i; + data << uint8(i); // item guid low? - data << (uint32) (item ? item->GetGUIDLow() : 0); + data << uint32(item ? item->GetGUIDLow() : 0); // entry - data << (uint32) (item ? item->GetEntry() : 0); + data << uint32(item ? item->GetEntry() : 0); for(uint8 j = 0; j < MAX_INSPECTED_ENCHANTMENT_SLOT; ++j) { // unsure - data << (uint32) (item ? item->GetEnchantmentCharges((EnchantmentSlot)j) : 0); + data << uint32(item ? item->GetEnchantmentCharges((EnchantmentSlot)j) : 0); // unsure - data << (uint32) (item ? item->GetEnchantmentDuration((EnchantmentSlot)j) : 0); + data << uint32(item ? item->GetEnchantmentDuration((EnchantmentSlot)j) : 0); // unsure - data << (uint32) (item ? item->GetEnchantmentId((EnchantmentSlot)j) : 0); + data << uint32(item ? item->GetEnchantmentId((EnchantmentSlot)j) : 0); } // can be negative - data << (uint32) (item ? item->GetItemRandomPropertyId() : 0); + data << uint32(item ? item->GetItemRandomPropertyId() : 0); // unk - data << (uint32) (item ? item->GetItemSuffixFactor() : 0); + data << uint32(item ? item->GetItemSuffixFactor() : 0); // stack count - data << (uint32) (item ? item->GetCount() : 0); + data << uint32(item ? item->GetCount() : 0); // charges - data << (uint32) (item ? item->GetSpellCharges() : 0); + data << uint32(item ? item->GetSpellCharges() : 0); // durability - data << (uint32) (item ? item->GetUInt32Value(ITEM_FIELD_MAXDURABILITY) : 0); + data << uint32(item ? item->GetUInt32Value(ITEM_FIELD_MAXDURABILITY) : 0); // durability - data << (uint32) (item ? item->GetUInt32Value(ITEM_FIELD_DURABILITY) : 0); + data << uint32(item ? item->GetUInt32Value(ITEM_FIELD_DURABILITY) : 0); // unknown wotlk - data << (uint8) 0; + data << uint8(0); } - mails_count += 1; + mailsCount += 1; + realCount += 1; } - data.put(0, mails_count); // set real send mails to client + data.put(0, realCount); // this will display warning about undelivered mail to player if realCount > mails_count + data.put(4, mailsCount); // set real send mails to client SendPacket(&data); // recalculate m_nextMailDelivereTime and unReadMails From 9a18da03a6645201278bbe95c5bd5c6195e20f28 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sun, 9 Aug 2009 20:48:42 +0400 Subject: [PATCH 065/132] Fixed arena teams fields. --- src/game/Player.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/game/Player.h b/src/game/Player.h index 39ba05e34..80da51c71 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -723,12 +723,12 @@ enum InstanceResetWarningType enum ArenaTeamInfoType { ARENA_TEAM_ID = 0, - ARENA_TEAM_MEMBER = 1, // 0 - captain, 1 - member - ARENA_TEAM_GAMES_WEEK = 2, - ARENA_TEAM_GAMES_SEASON = 3, - ARENA_TEAM_WINS_SEASON = 4, - ARENA_TEAM_PERSONAL_RATING = 5, - ARENA_TEAM_UNK2 = 6, // new in 3.2 + ARENA_TEAM_UNK2 = 1, // new in 3.2 - team type? + ARENA_TEAM_MEMBER = 2, // 0 - captain, 1 - member + ARENA_TEAM_GAMES_WEEK = 3, + ARENA_TEAM_GAMES_SEASON = 4, + ARENA_TEAM_WINS_SEASON = 5, + ARENA_TEAM_PERSONAL_RATING = 6, ARENA_TEAM_END = 7 }; From 027ea38d541e3c2db870c194277c93016d2a68b4 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Mon, 10 Aug 2009 10:35:21 +0400 Subject: [PATCH 066/132] Cleanup. --- src/game/Mail.cpp | 101 +++++++++++++++++++++++----------------------- src/game/Player.h | 81 ++++++++++++++++++------------------- 2 files changed, 91 insertions(+), 91 deletions(-) diff --git a/src/game/Mail.cpp b/src/game/Mail.cpp index ef80d78c8..43537315e 100644 --- a/src/game/Mail.cpp +++ b/src/game/Mail.cpp @@ -46,13 +46,13 @@ void MailItem::deleteItem( bool inDB ) CharacterDatabase.PExecute("DELETE FROM item_instance WHERE guid='%u'", item->GetGUIDLow()); delete item; - item=NULL; + item = NULL; } } void WorldSession::HandleSendMail(WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8+1+1+1+4+4+1+4+4+8+1); + CHECK_PACKET_SIZE(recv_data, 8+1+1+1+4+4+1+4+4+8+1); uint64 mailbox, unk3; std::string receiver, subject, body; @@ -137,7 +137,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data ) return; } - uint32 cost = items_count ? 30 * items_count : 30; // price hardcoded in client + uint32 cost = items_count ? 30 * items_count : 30; // price hardcoded in client uint32 reqmoney = cost + money; @@ -150,7 +150,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data ) Player *receive = objmgr.GetPlayer(rc); uint32 rc_team = 0; - uint8 mails_count = 0; //do not allow to send to one player more than 100 mails + uint8 mails_count = 0; // do not allow to send to one player more than 100 mails if(receive) { @@ -168,13 +168,15 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data ) delete result; } } + //do not allow to have more than 100 mails in mailbox.. mails count is in opcode uint8!!! - so max can be 255.. if (mails_count > 100) { pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_RECIPIENT_CAP_REACHED); return; } - // test the receiver's Faction... + + // check the receiver's Faction... if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL) && pl->GetTeam() != rc_team && GetSecurity() == SEC_PLAYER) { pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_NOT_YOUR_TEAM); @@ -265,7 +267,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data ) pl->MoveItemFromInventory(mailItem.item->GetBagSlot(), mailItem.item->GetSlot(), true); CharacterDatabase.BeginTransaction(); - mailItem.item->DeleteFromInventoryDB(); //deletes item from character's inventory + mailItem.item->DeleteFromInventoryDB(); // deletes item from character's inventory mailItem.item->SaveToDB(); // recursive and not have transaction guard into self, item not in inventory and can be save standalone // owner in data will set at mail receive and item extracting CharacterDatabase.PExecute("UPDATE item_instance SET owner_guid = '%u' WHERE guid='%u'", GUID_LOPART(rc), mailItem.item->GetGUIDLow()); @@ -297,7 +299,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data ) //called when mail is read void WorldSession::HandleMailMarkAsRead(WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8+4); + CHECK_PACKET_SIZE(recv_data, 8+4); uint64 mailbox; uint32 mailId; @@ -314,7 +316,7 @@ void WorldSession::HandleMailMarkAsRead(WorldPacket & recv_data ) if (pl->unReadMails) --pl->unReadMails; m->checked = m->checked | MAIL_CHECK_MASK_READ; - // m->expire_time = time(NULL) + (30 * DAY); // Expire time do not change at reading mail + // m->expire_time = time(NULL) + (30 * DAY); // Expire time do not change at reading mail pl->m_mailsUpdated = true; m->state = MAIL_STATE_CHANGED; } @@ -323,7 +325,7 @@ void WorldSession::HandleMailMarkAsRead(WorldPacket & recv_data ) //called when client deletes mail void WorldSession::HandleMailDelete(WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8+4); + CHECK_PACKET_SIZE(recv_data, 8+4); uint64 mailbox; uint32 mailId; @@ -343,7 +345,7 @@ void WorldSession::HandleMailDelete(WorldPacket & recv_data ) void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8+4); + CHECK_PACKET_SIZE(recv_data, 8+4); uint64 mailbox; uint32 mailId; @@ -389,7 +391,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data ) SendReturnToSender(MAIL_NORMAL, GetAccountId(), m->receiver, m->sender, m->subject, m->itemTextId, &mi, m->money, m->mailTemplateId); - delete m; //we can deallocate old mail + delete m; // we can deallocate old mail pl->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, MAIL_OK); } @@ -426,7 +428,7 @@ void WorldSession::SendReturnToSender(uint8 messageType, uint32 sender_acc, uint for(MailItemMap::iterator mailItemIter = mi->begin(); mailItemIter != mi->end(); ++mailItemIter) { MailItem& mailItem = mailItemIter->second; - mailItem.item->SaveToDB(); // item not in inventory and can be save standalone + mailItem.item->SaveToDB(); // item not in inventory and can be save standalone // owner in data will set at mail receive and item extracting CharacterDatabase.PExecute("UPDATE item_instance SET owner_guid = '%u' WHERE guid='%u'", receiver_guid, mailItem.item->GetGUIDLow()); } @@ -437,13 +439,13 @@ void WorldSession::SendReturnToSender(uint8 messageType, uint32 sender_acc, uint uint32 deliver_delay = needItemDelay ? sWorld.getConfig(CONFIG_MAIL_DELIVERY_DELAY) : 0; // will delete item or place to receiver mail list - WorldSession::SendMailTo(receiver, MAIL_NORMAL, MAIL_STATIONERY_NORMAL, sender_guid, receiver_guid, subject, itemTextId, mi, money, 0, MAIL_CHECK_MASK_RETURNED,deliver_delay,mailTemplateId); + WorldSession::SendMailTo(receiver, MAIL_NORMAL, MAIL_STATIONERY_NORMAL, sender_guid, receiver_guid, subject, itemTextId, mi, money, 0, MAIL_CHECK_MASK_RETURNED, deliver_delay, mailTemplateId); } //called when player takes item attached in mail void WorldSession::HandleMailTakeItem(WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8+4+4); + CHECK_PACKET_SIZE(recv_data, 8+4+4); uint64 mailbox; uint32 mailId; @@ -480,7 +482,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data ) m->RemoveItem(itemId); m->removedItems.push_back(itemId); - if (m->COD > 0) //if there is COD, take COD money from player and send them to sender by mail + if (m->COD > 0) // if there is COD, take COD money from player and send them to sender by mail { uint64 sender_guid = MAKE_NEW_GUID(m->sender, 0, HIGHGUID_PLAYER); Player *receive = objmgr.GetPlayer(sender_guid); @@ -500,11 +502,11 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data ) // can be calculated early sender_accId = objmgr.GetPlayerAccountIdByGUID(sender_guid); - if(!objmgr.GetPlayerNameByGUID(sender_guid,sender_name)) + if(!objmgr.GetPlayerNameByGUID(sender_guid, sender_name)) sender_name = objmgr.GetMangosStringForDBCLocale(LANG_UNKNOWN); } - sLog.outCommand(GetAccountId(),"GM %s (Account: %u) receive mail item: %s (Entry: %u Count: %u) and send COD money: %u to player: %s (Account: %u)", - GetPlayerName(),GetAccountId(),it->GetProto()->Name1,it->GetEntry(),it->GetCount(),m->COD,sender_name.c_str(),sender_accId); + sLog.outCommand(GetAccountId(), "GM %s (Account: %u) receive mail item: %s (Entry: %u Count: %u) and send COD money: %u to player: %s (Account: %u)", + GetPlayerName(), GetAccountId(), it->GetProto()->Name1, it->GetEntry(), it->GetCount(), m->COD, sender_name.c_str(), sender_accId); } else if(!receive) sender_accId = objmgr.GetPlayerAccountIdByGUID(sender_guid); @@ -523,7 +525,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data ) pl->RemoveMItem(it->GetGUIDLow()); uint32 count = it->GetCount(); // save counts before store and possible merge with deleting - pl->MoveItemToInventory(dest,it,true); + pl->MoveItemToInventory(dest, it, true); CharacterDatabase.BeginTransaction(); pl->SaveInventoryAndGoldToDB(); @@ -538,7 +540,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data ) void WorldSession::HandleMailTakeMoney(WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8+4); + CHECK_PACKET_SIZE(recv_data, 8+4); uint64 mailbox; uint32 mailId; @@ -582,11 +584,9 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data ) if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX)) return; - Player* pl = _player; - - //load players mails, and mailed items - if(!pl->m_mailsLoaded) - pl ->_LoadMail(); + // load players mails, and mailed items + if(!_player->m_mailsLoaded) + _player->_LoadMail(); // client can't work with packets > max int16 value const uint32 maxPacketSize = 32767; @@ -599,7 +599,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data ) data << uint8(0); // mail's count time_t cur_time = time(NULL); - for(PlayerMails::iterator itr = pl->GetmailBegin(); itr != pl->GetmailEnd(); ++itr) + for(PlayerMails::iterator itr = _player->GetMailBegin(); itr != _player->GetMailEnd(); ++itr) { // skip deleted or not delivered (deliver delay not expired) mails if ((*itr)->state == MAIL_STATE_DELETED || cur_time < (*itr)->deliver_time) @@ -656,7 +656,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data ) for(uint8 i = 0; i < item_count; ++i) { - Item *item = pl->GetMItem((*itr)->items[i].item_guid); + Item *item = _player->GetMItem((*itr)->items[i].item_guid); // item index (0-6?) data << uint8(i); // item guid low? @@ -703,11 +703,11 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data ) ///this function is called when client needs mail message body, or when player clicks on item which has ITEM_FIELD_ITEM_TEXT_ID > 0 void WorldSession::HandleItemTextQuery(WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,4+4+4); + CHECK_PACKET_SIZE(recv_data, 4+4+4); uint32 itemTextId; - uint32 mailId; //this value can be item id in bag, but it is also mail id - uint32 unk; //maybe something like state - 0x70000000 + uint32 mailId; // this value can be item id in bag, but it is also mail id + uint32 unk; // maybe something like state - 0x70000000 recv_data >> itemTextId >> mailId >> unk; @@ -724,7 +724,7 @@ void WorldSession::HandleItemTextQuery(WorldPacket & recv_data ) //used when player copies mail body to his inventory void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8+4); + CHECK_PACKET_SIZE(recv_data, 8+4); uint64 mailbox; uint32 mailId; @@ -750,7 +750,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data ) return; } - bodyItem->SetUInt32Value( ITEM_FIELD_ITEM_TEXT_ID , m->itemTextId ); + bodyItem->SetUInt32Value( ITEM_FIELD_ITEM_TEXT_ID, m->itemTextId ); bodyItem->SetUInt32Value( ITEM_FIELD_CREATOR, m->sender); sLog.outDetail("HandleMailCreateTextItem mailid=%u",mailId); @@ -784,12 +784,12 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recv_data*/ ) if( _player->unReadMails > 0 ) { - data << (uint32) 0; // float - data << (uint32) 0; // count + data << uint32(0); // float + data << uint32(0); // count uint32 count = 0; time_t now = time(NULL); - for(PlayerMails::iterator itr = _player->GetmailBegin(); itr != _player->GetmailEnd(); ++itr) + for(PlayerMails::iterator itr = _player->GetMailBegin(); itr != _player->GetMailEnd(); ++itr) { Mail *m = (*itr); // must be not checked yet @@ -800,22 +800,23 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recv_data*/ ) if(now < m->deliver_time) continue; - data << (uint64) m->sender; // sender guid + data << uint64(m->sender); // sender guid switch(m->messageType) { case MAIL_AUCTION: - data << (uint32) 2; - data << (uint32) 2; - data << (uint32) m->stationery; + data << uint32(2); + data << uint32(2); + data << uint32(m->stationery); break; default: - data << (uint32) 0; - data << (uint32) 0; - data << (uint32) m->stationery; + data << uint32(0); + data << uint32(0); + data << uint32(m->stationery); break; } - data << (uint32) 0xC6000000; // float unk, time or something + + data << uint32(0xC6000000); // float unk, time or something ++count; if(count == 2) // do not display more than 2 mails @@ -825,8 +826,8 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recv_data*/ ) } else { - data << (uint32) 0xC7A8C000; - data << (uint32) 0x00000000; + data << uint32(0xC7A8C000); + data << uint32(0x00000000); } SendPacket(&data); } @@ -837,12 +838,12 @@ void WorldSession::SendMailTo(Player* receiver, uint8 messageType, uint8 station time_t deliver_time = time(NULL) + deliver_delay; - //expire time if COD 3 days, if no COD 30 days, if auction sale pending 1 hour + // expire time if COD 3 days, if no COD 30 days, if auction sale pending 1 hour uint32 expire_delay; if(messageType == MAIL_AUCTION && !mi && !money) // auction mail without any items and money expire_delay = HOUR; else - expire_delay = (COD > 0) ? 3*DAY : 30*DAY; + expire_delay = (COD > 0) ? 3 * DAY : 30 * DAY; time_t expire_time = deliver_time + expire_delay; @@ -858,7 +859,7 @@ void WorldSession::SendMailTo(Player* receiver, uint8 messageType, uint8 station if ( receiver->IsMailsLoaded() ) { - Mail * m = new Mail; + Mail *m = new Mail; m->messageID = mailId; m->messageType = messageType; m->stationery = stationery; @@ -878,7 +879,7 @@ void WorldSession::SendMailTo(Player* receiver, uint8 messageType, uint8 station m->checked = checked; m->state = MAIL_STATE_UNCHANGED; - receiver->AddMail(m); //to insert new mail to beginning of maillist + receiver->AddMail(m); // to insert new mail to beginning of maillist if(mi) { @@ -907,7 +908,7 @@ void WorldSession::SendMailTo(Player* receiver, uint8 messageType, uint8 station for(MailItemMap::const_iterator mailItemIter = mi->begin(); mailItemIter != mi->end(); ++mailItemIter) { MailItem const& mailItem = mailItemIter->second; - CharacterDatabase.PExecute("INSERT INTO mail_items (mail_id,item_guid,item_template,receiver) VALUES ('%u', '%u', '%u','%u')", mailId, mailItem.item_guidlow, mailItem.item_template,receiver_guidlow); + CharacterDatabase.PExecute("INSERT INTO mail_items (mail_id,item_guid,item_template,receiver) VALUES ('%u', '%u', '%u','%u')", mailId, mailItem.item_guidlow, mailItem.item_template, receiver_guidlow); } } CharacterDatabase.CommitTransaction(); diff --git a/src/game/Player.h b/src/game/Player.h index 80da51c71..0812d534e 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -891,8 +891,8 @@ enum PlayerDelayedOperations DELAYED_SAVE_PLAYER = 0x01, DELAYED_RESURRECT_PLAYER = 0x02, DELAYED_SPELL_CAST_DESERTER = 0x04, - DELAYED_BG_MOUNT_RESTORE = 0x08, ///< Flag to restore mount state after teleport from BG - DELAYED_BG_TAXI_RESTORE = 0x10, ///< Flag to restore taxi state after teleport from BG + DELAYED_BG_MOUNT_RESTORE = 0x08, ///< Flag to restore mount state after teleport from BG + DELAYED_BG_TAXI_RESTORE = 0x10, ///< Flag to restore taxi state after teleport from BG DELAYED_END }; @@ -937,7 +937,7 @@ class MANGOS_DLL_SPEC PlayerTaxi else return false; } - void AppendTaximaskTo(ByteBuffer& data,bool all); + void AppendTaximaskTo(ByteBuffer& data, bool all); // Destinations bool LoadTaxiDestinationsFromString(const std::string& values, uint32 team); @@ -972,21 +972,21 @@ struct BGData bgTeam(0), mountSpell(0) { ClearTaxiPath(); } - uint32 bgInstanceID; ///< This variable is set to bg->m_InstanceID, - /// when player is teleported to BG - (it is battleground's GUID) + uint32 bgInstanceID; ///< This variable is set to bg->m_InstanceID, + /// when player is teleported to BG - (it is battleground's GUID) BattleGroundTypeId bgTypeID; std::set bgAfkReporter; uint8 bgAfkReportedCount; time_t bgAfkReportedTimer; - uint32 bgTeam; ///< What side the player will be added to + uint32 bgTeam; ///< What side the player will be added to uint32 mountSpell; uint32 taxiPath[2]; - WorldLocation joinPos; ///< From where player entered BG + WorldLocation joinPos; ///< From where player entered BG void ClearTaxiPath() { taxiPath[0] = taxiPath[1] = 0; } bool HasTaxiPath() const { return taxiPath[0] && taxiPath[1]; } @@ -1050,8 +1050,8 @@ class MANGOS_DLL_SPEC Player : public Unit bool ToggleAFK(); bool ToggleDND(); - bool isAFK() const { return HasFlag(PLAYER_FLAGS,PLAYER_FLAGS_AFK); }; - bool isDND() const { return HasFlag(PLAYER_FLAGS,PLAYER_FLAGS_DND); }; + bool isAFK() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK); } + bool isDND() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DND); } uint8 chatTag() const; std::string afkMsg; std::string dndMsg; @@ -1089,33 +1089,33 @@ class MANGOS_DLL_SPEC Player : public Unit time_t m_logintime; time_t m_Last_tick; uint32 m_Played_time[MAX_PLAYED_TIME_INDEX]; - uint32 GetTotalPlayedTime() { return m_Played_time[PLAYED_TIME_TOTAL]; }; - uint32 GetLevelPlayedTime() { return m_Played_time[PLAYED_TIME_LEVEL]; }; + uint32 GetTotalPlayedTime() { return m_Played_time[PLAYED_TIME_TOTAL]; } + uint32 GetLevelPlayedTime() { return m_Played_time[PLAYED_TIME_LEVEL]; } void setDeathState(DeathState s); // overwrite Unit::setDeathState - void InnEnter (int time,uint32 mapid, float x,float y,float z) + void InnEnter (int time, uint32 mapid, float x, float y, float z) { inn_pos_mapid = mapid; inn_pos_x = x; inn_pos_y = y; inn_pos_z = z; time_inn_enter = time; - }; + } - float GetRestBonus() const { return m_rest_bonus; }; + float GetRestBonus() const { return m_rest_bonus; } void SetRestBonus(float rest_bonus_new); - RestType GetRestType() const { return rest_type; }; - void SetRestType(RestType n_r_type) { rest_type = n_r_type; }; + RestType GetRestType() const { return rest_type; } + void SetRestType(RestType n_r_type) { rest_type = n_r_type; } - uint32 GetInnPosMapId() const { return inn_pos_mapid; }; - float GetInnPosX() const { return inn_pos_x; }; - float GetInnPosY() const { return inn_pos_y; }; - float GetInnPosZ() const { return inn_pos_z; }; + uint32 GetInnPosMapId() const { return inn_pos_mapid; } + float GetInnPosX() const { return inn_pos_x; } + float GetInnPosY() const { return inn_pos_y; } + float GetInnPosZ() const { return inn_pos_z; } - int GetTimeInnEnter() const { return time_inn_enter; }; - void UpdateInnerTime (int time) { time_inn_enter = time; }; + int GetTimeInnEnter() const { return time_inn_enter; } + void UpdateInnerTime (int time) { time_inn_enter = time; } void RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent = false); void RemoveMiniPet(); @@ -1145,14 +1145,14 @@ class MANGOS_DLL_SPEC Player : public Unit Item* GetShield(bool useable = false) const; static uint32 GetAttackBySlot( uint8 slot ); // MAX_ATTACK if not weapon slot std::vector &GetItemUpdateQueue() { return m_itemUpdateQueue; } - static bool IsInventoryPos( uint16 pos ) { return IsInventoryPos(pos >> 8,pos & 255); } + static bool IsInventoryPos( uint16 pos ) { return IsInventoryPos(pos >> 8, pos & 255); } static bool IsInventoryPos( uint8 bag, uint8 slot ); - static bool IsEquipmentPos( uint16 pos ) { return IsEquipmentPos(pos >> 8,pos & 255); } + static bool IsEquipmentPos( uint16 pos ) { return IsEquipmentPos(pos >> 8, pos & 255); } static bool IsEquipmentPos( uint8 bag, uint8 slot ); static bool IsBagPos( uint16 pos ); - static bool IsBankPos( uint16 pos ) { return IsBankPos(pos >> 8,pos & 255); } + static bool IsBankPos( uint16 pos ) { return IsBankPos(pos >> 8, pos & 255); } static bool IsBankPos( uint8 bag, uint8 slot ); - bool IsValidPos( uint16 pos ) { return IsBankPos(pos >> 8,pos & 255); } + bool IsValidPos( uint16 pos ) { return IsBankPos(pos >> 8, pos & 255); } bool IsValidPos( uint8 bag, uint8 slot ); uint8 GetBankBagSlotCount() const { return GetByteValue(PLAYER_BYTES_2, 2); } void SetBankBagSlotCount(uint8 count) { SetByteValue(PLAYER_BYTES_2, 2, count); } @@ -1161,8 +1161,8 @@ class MANGOS_DLL_SPEC Player : public Unit bool CanNoReagentCast(SpellEntry const* spellInfo) const; bool HasItemOrGemWithIdEquipped( uint32 item, uint32 count, uint8 except_slot = NULL_SLOT) const; bool HasItemOrGemWithLimitCategoryEquipped( uint32 limitCategory, uint32 count, uint8 except_slot = NULL_SLOT) const; - uint8 CanTakeMoreSimilarItems(Item* pItem) const { return _CanTakeMoreSimilarItems(pItem->GetEntry(),pItem->GetCount(),pItem); } - uint8 CanTakeMoreSimilarItems(uint32 entry, uint32 count) const { return _CanTakeMoreSimilarItems(entry,count,NULL); } + uint8 CanTakeMoreSimilarItems(Item* pItem) const { return _CanTakeMoreSimilarItems(pItem->GetEntry(), pItem->GetCount(), pItem); } + uint8 CanTakeMoreSimilarItems(uint32 entry, uint32 count) const { return _CanTakeMoreSimilarItems(entry, count, NULL); } uint8 CanStoreNewItem( uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 item, uint32 count, uint32* no_space_count = NULL ) const { return _CanStoreItem(bag, slot, dest, item, count, NULL, false, no_space_count ); @@ -1371,12 +1371,12 @@ class MANGOS_DLL_SPEC Player : public Unit void SendQuestUpdateAddItem( Quest const* pQuest, uint32 item_idx, uint32 count ); void SendQuestUpdateAddCreatureOrGo( Quest const* pQuest, uint64 guid, uint32 creatureOrGO_idx, uint32 old_count, uint32 add_count ); - uint64 GetDivider() { return m_divider; }; - void SetDivider( uint64 guid ) { m_divider = guid; }; + uint64 GetDivider() { return m_divider; } + void SetDivider( uint64 guid ) { m_divider = guid; } - uint32 GetInGameTime() { return m_ingametime; }; + uint32 GetInGameTime() { return m_ingametime; } - void SetInGameTime( uint32 time ) { m_ingametime = time; }; + void SetInGameTime( uint32 time ) { m_ingametime = time; } void AddTimedQuest( uint32 quest_id ) { m_timedquests.insert(quest_id); } @@ -1462,15 +1462,14 @@ class MANGOS_DLL_SPEC Player : public Unit void AddNewMailDeliverTime(time_t deliver_time); bool IsMailsLoaded() const { return m_mailsLoaded; } - //void SetMail(Mail *m); void RemoveMail(uint32 id); void AddMail(Mail* mail) { m_mail.push_front(mail);}// for call from WorldSession::SendMailTo - uint32 GetMailSize() { return m_mail.size();}; + uint32 GetMailSize() { return m_mail.size(); } Mail* GetMail(uint32 id); - PlayerMails::iterator GetmailBegin() { return m_mail.begin();}; - PlayerMails::iterator GetmailEnd() { return m_mail.end();}; + PlayerMails::iterator GetMailBegin() { return m_mail.begin();} + PlayerMails::iterator GetMailEnd() { return m_mail.end();} /*********************************************************/ /*** MAILED ITEMS SYSTEM ***/ @@ -1481,7 +1480,7 @@ class MANGOS_DLL_SPEC Player : public Unit typedef UNORDERED_MAP ItemMap; - ItemMap mMitems; //template defined in objectmgr.cpp + ItemMap mMitems; // template defined in objectmgr.cpp Item* GetMItem(uint32 id) { @@ -1600,7 +1599,7 @@ class MANGOS_DLL_SPEC Player : public Unit m_resurrectZ = Z; m_resurrectHealth = health; m_resurrectMana = mana; - }; + } void clearResurrectRequestData() { setResurrectRequestData(0,0,0.0f,0.0f,0.0f,0,0); } bool isRessurectRequestedBy(uint64 guid) const { return m_resurrectGUID == guid; } bool isRessurectRequested() const { return m_resurrectGUID != 0; } @@ -1892,7 +1891,7 @@ class MANGOS_DLL_SPEC Player : public Unit void SetCanBlock(bool value); bool CanDualWield() const { return m_canDualWield; } void SetCanDualWield(bool value) { m_canDualWield = value; } - bool CanTitanGrip() const { return m_canTitanGrip ; } + bool CanTitanGrip() const { return m_canTitanGrip; } void SetCanTitanGrip(bool value) { m_canTitanGrip = value; } bool CanTameExoticPets() const { return isGameMaster() || HasAuraType(SPELL_AURA_ALLOW_TAME_PET_TYPE); } @@ -2058,8 +2057,8 @@ class MANGOS_DLL_SPEC Player : public Unit bool isRested() const { return GetRestTime() >= 10*IN_MILISECONDS; } uint32 GetXPRestBonus(uint32 xp); - uint32 GetRestTime() const { return m_restTime;}; - void SetRestTime(uint32 v) { m_restTime = v;}; + uint32 GetRestTime() const { return m_restTime; } + void SetRestTime(uint32 v) { m_restTime = v; } /*********************************************************/ /*** ENVIROMENTAL SYSTEM ***/ From d9a9175c47fb262c74513cd4aade29be5d3b88a8 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sat, 15 Aug 2009 10:15:47 +0400 Subject: [PATCH 067/132] Updated to client build 10257. --- src/game/Opcodes.cpp | 1 + src/game/Opcodes.h | 3 ++- src/game/UpdateFields.h | 2 +- src/realmd/AuthCodes.h | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp index e364bfd22..7c48a8609 100644 --- a/src/game/Opcodes.cpp +++ b/src/game/Opcodes.cpp @@ -1298,4 +1298,5 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x4F5*/ { "UMSG_UNKNOWN_1269", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4F6*/ { "CMSG_WORLD_STATE_UI_TIMER_UPDATE", STATUS_LOGGEDIN, &WorldSession::HandleWorldStateUITimerUpdate }, /*0x4F7*/ { "SMSG_WORLD_STATE_UI_TIMER_UPDATE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, + /*0x4F8*/ { "CMSG_UNKNOWN_1272", STATUS_NEVER, &WorldSession::Handle_NULL }, }; diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h index a41e833c8..2aa539514 100644 --- a/src/game/Opcodes.h +++ b/src/game/Opcodes.h @@ -1306,7 +1306,8 @@ enum Opcodes UMSG_UNKNOWN_1269 = 0x4F5, // not found 3.2 CMSG_WORLD_STATE_UI_TIMER_UPDATE = 0x4F6, SMSG_WORLD_STATE_UI_TIMER_UPDATE = 0x4F7, - NUM_MSG_TYPES = 0x4F8 + CMSG_UNKNOWN_1272 = 0x4F8, // called from lua: CreateCharacter + NUM_MSG_TYPES = 0x4F9 }; /// Player state diff --git a/src/game/UpdateFields.h b/src/game/UpdateFields.h index 4867c8c29..c6d39ee88 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 3, 2, 0, 10192 +// Auto generated for version 0, 2, 2, 10257 enum EObjectFields { diff --git a/src/realmd/AuthCodes.h b/src/realmd/AuthCodes.h index b814db6ce..e091b61de 100644 --- a/src/realmd/AuthCodes.h +++ b/src/realmd/AuthCodes.h @@ -66,8 +66,8 @@ enum LoginResult // 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.2.0 client build 10192... +// will only support WoW, WoW:TBC and WoW:WotLK 3.2.2 client build 10257... -#define EXPECTED_MANGOS_CLIENT_BUILD {10192, 0} +#define EXPECTED_MANGOS_CLIENT_BUILD {10257, 0} #endif From 2c30020c7e6b0d6de68457c506d393785635002b Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sat, 15 Aug 2009 14:24:04 +0400 Subject: [PATCH 068/132] Login with 3.2.2.10257 should work now. --- src/game/CharacterHandler.cpp | 7 +------ src/game/DBCStructure.h | 17 +++++++++-------- src/game/DBCfmt.h | 2 +- src/game/Opcodes.cpp | 2 +- src/game/World.cpp | 4 +++- src/game/WorldSession.cpp | 12 ++++++++++++ src/game/WorldSession.h | 17 ++++++++++++++++- src/game/WorldSocket.cpp | 13 ++++++++++--- 8 files changed, 53 insertions(+), 21 deletions(-) diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index cc9b935b5..d20082a6f 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -589,12 +589,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder *holder) data << pCurrChar->GetOrientation(); SendPacket(&data); - data.Initialize( SMSG_ACCOUNT_DATA_TIMES, 4+1+8*4 ); // changed in WotLK - data << uint32(time(NULL)); // unix time of something - data << uint8(1); - for(int i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i) - data << uint32(GetAccountData(i)->Time); // also unix time - SendPacket(&data); + SendAccountDataTimes(PER_CHARACTER_CACHE_MASK); data.Initialize(SMSG_FEATURE_SYSTEM_STATUS, 2); // added in 2.2.0 data << uint8(2); // unknown value diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index d42fc8d9c..0e9a32dc4 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -645,14 +645,15 @@ struct ChrRacesEntry uint32 TeamID; // 7 (7-Alliance 1-Horde) // 8-11 unused uint32 CinematicSequence; // 12 id from CinematicSequences.dbc - char* name[16]; // 13-28 used for DBC language detection/selection - // 29 string flags, unused - //char* nameFemale[16]; // 30-45, if different from base (male) case - // 46 string flags, unused - //char* nameNeutralGender[16]; // 47-62, if different from base (male) case - // 63 string flags, unused - // 64-66 unused - uint32 expansion; // 67 (0 - original race, 1 - tbc addon, ...) + //uint32 unk_322; // 13 + char* name[16]; // 14-29 used for DBC language detection/selection + // 30 string flags, unused + //char* nameFemale[16]; // 31-46, if different from base (male) case + // 47 string flags, unused + //char* nameNeutralGender[16]; // 48-63, if different from base (male) case + // 64 string flags, unused + // 65-67 unused + uint32 expansion; // 68 (0 - original race, 1 - tbc addon, ...) }; /* not used diff --git a/src/game/DBCfmt.h b/src/game/DBCfmt.h index 9f4b3d9f1..4ede36f76 100644 --- a/src/game/DBCfmt.h +++ b/src/game/DBCfmt.h @@ -33,7 +33,7 @@ const char CharTitlesEntryfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi"; const char ChatChannelsEntryfmt[]="iixssssssssssssssssxxxxxxxxxxxxxxxxxx"; // ChatChannelsEntryfmt, index not used (more compact store) const char ChrClassesEntryfmt[]="nxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixii"; -const char ChrRacesEntryfmt[]="nxixiixixxxxissssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi"; +const char ChrRacesEntryfmt[]="nxixiixixxxxixssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi"; const char CinematicSequencesEntryfmt[]="nxxxxxxxxx"; const char CreatureDisplayInfofmt[]="nxxxfxxxxxxxxxxx"; const char CreatureFamilyfmt[]="nfifiiiiixssssssssssssssssxx"; diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp index 7c48a8609..682039af2 100644 --- a/src/game/Opcodes.cpp +++ b/src/game/Opcodes.cpp @@ -548,7 +548,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x207*/ { "CMSG_GMTICKET_UPDATETEXT", STATUS_LOGGEDIN, &WorldSession::HandleGMTicketUpdateTextOpcode }, /*0x208*/ { "SMSG_GMTICKET_UPDATETEXT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x209*/ { "SMSG_ACCOUNT_DATA_TIMES", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x20A*/ { "CMSG_REQUEST_ACCOUNT_DATA", STATUS_LOGGEDIN, &WorldSession::HandleRequestAccountData }, + /*0x20A*/ { "CMSG_REQUEST_ACCOUNT_DATA", STATUS_AUTHED, &WorldSession::HandleRequestAccountData }, /*0x20B*/ { "CMSG_UPDATE_ACCOUNT_DATA", STATUS_AUTHED, &WorldSession::HandleUpdateAccountData }, /*0x20C*/ { "SMSG_UPDATE_ACCOUNT_DATA", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x20D*/ { "SMSG_CLEAR_FAR_SIGHT_IMMEDIATE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, diff --git a/src/game/World.cpp b/src/game/World.cpp index a6c294b77..88a82bb48 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -242,6 +242,8 @@ World::AddSession_ (WorldSession* s) pkt << uint32(sWorld.getConfig(CONFIG_CLIENTCACHE_VERSION)); s->SendPacket(&pkt); + s->SendAccountDataTimes(GLOBAL_CACHE_MASK); + s->SendTutorialsData(); UpdateMaxSessionCounters (); @@ -249,7 +251,7 @@ World::AddSession_ (WorldSession* s) // Updates the population if (pLimit > 0) { - float popu = GetActiveSessionCount (); //updated number of users on the server + float popu = GetActiveSessionCount (); // updated number of users on the server popu /= pLimit; popu *= 2; loginDatabase.PExecute ("UPDATE realmlist SET population = '%f' WHERE id = '%d'", popu, realmID); diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index a52eec5ef..a5414cba2 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -568,6 +568,18 @@ void WorldSession::SetAccountData(uint32 type, time_t time_, std::string data) CharacterDatabase.CommitTransaction (); } +void WorldSession::SendAccountDataTimes(uint32 mask) +{ + WorldPacket data( SMSG_ACCOUNT_DATA_TIMES, 4+1+4+8*4 ); // changed in WotLK + data << uint32(time(NULL)); // unix time of something + data << uint8(1); + data << uint32(mask); + for(int i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i) + if(mask & (1 << i)) + data << uint32(GetAccountData(i)->Time); // also unix time + SendPacket(&data); +} + void WorldSession::LoadTutorialsData() { for ( int aX = 0 ; aX < 8 ; ++aX ) diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h index 9e916fbf2..c81ae36ab 100644 --- a/src/game/WorldSession.h +++ b/src/game/WorldSession.h @@ -46,7 +46,21 @@ class CharacterHandler; #define CHECK_PACKET_SIZE(P,S) if((P).size() < (S)) return SizeError((P),(S)); -#define NUM_ACCOUNT_DATA_TYPES 8 +enum AccountDataTypes +{ + GLOBAL_CONFIG_CACHE = 0, // 0x01 g + PER_CHARACTER_CONFIG_CACHE = 1, // 0x02 p + GLOBAL_BINDINGS_CACHE = 2, // 0x04 g + PER_CHARACTER_BINDINGS_CACHE = 3, // 0x08 p + GLOBAL_MACROS_CACHE = 4, // 0x10 g + PER_CHARACTER_MACROS_CACHE = 5, // 0x20 p + PER_CHARACTER_LAYOUT_CACHE = 6, // 0x40 p + PER_CHARACTER_CHAT_CACHE = 7, // 0x80 p + NUM_ACCOUNT_DATA_TYPES = 8 +}; + +#define GLOBAL_CACHE_MASK 0x15 +#define PER_CHARACTER_CACHE_MASK 0xEA struct AccountData { @@ -189,6 +203,7 @@ class MANGOS_DLL_SPEC WorldSession // Account Data AccountData *GetAccountData(uint32 type) { return &m_accountData[type]; } void SetAccountData(uint32 type, time_t time_, std::string data); + void SendAccountDataTimes(uint32 mask); void LoadAccountData(); void LoadTutorialsData(); void SendTutorialsData(); diff --git a/src/game/WorldSocket.cpp b/src/game/WorldSocket.cpp index 95e93c417..c5c33ae33 100644 --- a/src/game/WorldSocket.cpp +++ b/src/game/WorldSocket.cpp @@ -262,8 +262,13 @@ int WorldSocket::open (void *a) m_Address = remote_addr.get_host_addr (); // Send startup packet. - WorldPacket packet (SMSG_AUTH_CHALLENGE, 4); + WorldPacket packet (SMSG_AUTH_CHALLENGE, 24); + packet << uint32(1); packet << m_Seed; + packet << uint32(0xF3539DA3); + packet << uint32(0x6E8547B9); + packet << uint32(0x9A6AA2F8); + packet << uint32(0xA4F170F4); if (SendPacket (packet) == -1) return -1; @@ -744,6 +749,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) uint8 digest[20]; uint32 clientSeed; uint32 unk2, unk3; + uint64 unk4; uint32 BuiltNumberClient; uint32 id, security; uint8 expansion = 0; @@ -755,7 +761,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) BigNumber K; - if (recvPacket.size () < (4 + 4 + 1 + 4 + 4 + 20)) + if (recvPacket.size () < (4 + 4 + 1 + 4 + 4 + 8 + 20)) { sLog.outError ("WorldSocket::HandleAuthSession: wrong packet size"); return -1; @@ -767,13 +773,14 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) recvPacket >> account; recvPacket >> unk3; - if (recvPacket.size () < (4 + 4 + (account.size () + 1) + 4 + 4 + 20)) + if (recvPacket.size () < (4 + 4 + (account.size () + 1) + 4 + 4 + 8 + 20)) { sLog.outError ("WorldSocket::HandleAuthSession: wrong packet size second check"); return -1; } recvPacket >> clientSeed; + recvPacket >> unk4; recvPacket.read (digest, 20); DEBUG_LOG ("WorldSocket::HandleAuthSession: client %u, unk2 %u, account %s, unk3 %u, clientseed %u", From 0045d09a668645678892acdd421faabade0731f8 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sat, 15 Aug 2009 17:41:50 +0400 Subject: [PATCH 069/132] Some comments. --- src/game/WorldSocket.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/game/WorldSocket.cpp b/src/game/WorldSocket.cpp index c5c33ae33..3cdea5644 100644 --- a/src/game/WorldSocket.cpp +++ b/src/game/WorldSocket.cpp @@ -263,12 +263,12 @@ int WorldSocket::open (void *a) // Send startup packet. WorldPacket packet (SMSG_AUTH_CHALLENGE, 24); - packet << uint32(1); + packet << uint32(1); // 1...31 packet << m_Seed; - packet << uint32(0xF3539DA3); - packet << uint32(0x6E8547B9); - packet << uint32(0x9A6AA2F8); - packet << uint32(0xA4F170F4); + packet << uint32(0xF3539DA3); // random data + packet << uint32(0x6E8547B9); // random data + packet << uint32(0x9A6AA2F8); // random data + packet << uint32(0xA4F170F4); // random data if (SendPacket (packet) == -1) return -1; From ce4916d7e5a4dbc770aba0a3121954253ff3c616 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Tue, 18 Aug 2009 09:31:05 +0400 Subject: [PATCH 070/132] Updated some enums. --- src/game/ItemPrototype.h | 1 + src/game/Player.h | 6 +----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/game/ItemPrototype.h b/src/game/ItemPrototype.h index 1789752b1..ef94c95ff 100644 --- a/src/game/ItemPrototype.h +++ b/src/game/ItemPrototype.h @@ -115,6 +115,7 @@ enum ITEM_FLAGS ITEM_FLAGS_PARTY_LOOT = 0x00000800, // determines if item is party loot or not ITEM_FLAGS_REFUNDABLE = 0x00001000, // item cost can be refunded within 2 hours after purchase ITEM_FLAGS_CHARTER = 0x00002000, // arena/guild charter + ITEM_FLAGS_REFUNDABLE_2 = 0x00008000, ITEM_FLAGS_PROSPECTABLE = 0x00040000, ITEM_FLAGS_UNIQUE_EQUIPPED = 0x00080000, ITEM_FLAGS_USEABLE_IN_ARENA = 0x00200000, diff --git a/src/game/Player.h b/src/game/Player.h index ceaa0ba45..9ff2cf931 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -321,11 +321,7 @@ enum LfgType LFG_TYPE_RAID = 2, LFG_TYPE_QUEST = 3, LFG_TYPE_ZONE = 4, - LFG_TYPE_HEROIC_DUNGEON = 5, - LFG_TYPE_ANY_DUNGEON = 6, - LFG_TYPE_ANY_HEROIC_DUNGEON = 7, - LFG_TYPE_DAILY_DUNGEON = 8, - LFG_TYPE_DAILY_HEROIC_DUNGEON = 9 + LFG_TYPE_HEROIC_DUNGEON = 5 }; enum LfgRoles From 3097dcda2b1de0511be3c3f8f938fa307ce9d406 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Thu, 20 Aug 2009 16:18:34 +0400 Subject: [PATCH 071/132] Removed useless code. --- src/game/MiscHandler.cpp | 1 - src/game/MovementHandler.cpp | 28 ---------------------------- 2 files changed, 29 deletions(-) diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 976541dac..33c7ac9a6 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -1537,7 +1537,6 @@ void WorldSession::HandleSetTaxiBenchmarkOpcode( WorldPacket & recv_data ) void WorldSession::HandleQueryInspectAchievements( WorldPacket & recv_data ) { - uint64 guid; if(!recv_data.readPackGUID(guid)) return; diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index fd15c7ca5..bd6e92448 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -231,13 +231,6 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data ) ReadMovementInfo(recv_data, &movementInfo); /*----------------*/ - if(recv_data.size() != recv_data.rpos()) - { - sLog.outError("MovementHandler: player %s (guid %d, account %u) sent a packet (opcode %u) that is " SIZEFMTD " bytes larger than it should be. Kicked as cheater.", _player->GetName(), _player->GetGUIDLow(), _player->GetSession()->GetAccountId(), opcode, recv_data.size() - recv_data.rpos()); - KickPlayer(); - return; - } - if (!MaNGOS::IsValidMapCoord(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o)) return; @@ -372,13 +365,6 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data) recv_data >> newspeed; /*----------------*/ - if(recv_data.size() != recv_data.rpos()) - { - sLog.outError("MovementHandler: player %s (guid %d, account %u) sent a packet (opcode %u) that is " SIZEFMTD " bytes larger than it should be. Kicked as cheater.", _player->GetName(), _player->GetGUIDLow(), _player->GetSession()->GetAccountId(), opcode, recv_data.size() - recv_data.rpos()); - KickPlayer(); - return; - } - // client ACK send one packet for mounted/run case and need skip all except last from its // in other cases anti-cheat check can be fail in false case UnitMoveType move_type; @@ -463,13 +449,6 @@ void WorldSession::HandleMoveNotActiveMover(WorldPacket &recv_data) mi.guid = old_mover_guid; ReadMovementInfo(recv_data, &mi); - if(recv_data.size() != recv_data.rpos()) - { - sLog.outError("MovementHandler: player %s (guid %d, account %u) sent a packet (opcode %u) that is " SIZEFMTD " bytes larger than it should be. Kicked as cheater.", _player->GetName(), _player->GetGUIDLow(), _player->GetSession()->GetAccountId(), recv_data.GetOpcode(), recv_data.size() - recv_data.rpos()); - KickPlayer(); - return; - } - _player->m_movementInfo = mi; } @@ -492,13 +471,6 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data) mi.guid = guid; ReadMovementInfo(recv_data, &mi); - if(recv_data.size() != recv_data.rpos()) - { - sLog.outError("MovementHandler: player %s (guid %d, account %u) sent a packet (opcode %u) that is " SIZEFMTD " bytes larger than it should be. Kicked as cheater.", _player->GetName(), _player->GetGUIDLow(), _player->GetSession()->GetAccountId(), recv_data.GetOpcode(), recv_data.size() - recv_data.rpos()); - KickPlayer(); - return; - } - _player->m_movementInfo = mi; // using charm guid, because we don't have vehicle guid... From fe7330b0b874e8880c4a2eedd39589630ac98e57 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sun, 23 Aug 2009 18:57:48 +0400 Subject: [PATCH 072/132] Fixed bg opcode. --- src/game/BattleGroundHandler.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp index 5fd924400..865988746 100644 --- a/src/game/BattleGroundHandler.cpp +++ b/src/game/BattleGroundHandler.cpp @@ -277,7 +277,10 @@ void WorldSession::HandleBattlefieldListOpcode( WorldPacket &recv_data ) recv_data >> bgTypeId; // id from DBC uint8 fromWhere; - recv_data >> fromWhere; // 0 - battlemaster, 1 - UI + recv_data >> fromWhere; // 0 - battlemaster (lua: ShowBattlefieldList), 1 - UI (lua: RequestBattlegroundInstanceInfo) + + uint8 unk1; + recv_data >> unk1; // unknown 3.2.2 BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(bgTypeId); if (!bl) From e7353428b18587ffae8b26813395fac85a126472 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Mon, 24 Aug 2009 00:59:23 +0400 Subject: [PATCH 073/132] Fixed one more opcode. Added startup check for gameobject displayid==0. --- src/game/MiscHandler.cpp | 7 ++++++- src/game/ObjectMgr.cpp | 28 +++++++++++++++++----------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 5834c53f0..a2765ba1a 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -1001,7 +1001,12 @@ void WorldSession::HandleMoveTimeSkippedOpcode( WorldPacket & recv_data ) /* WorldSession::Update( getMSTime() );*/ DEBUG_LOG( "WORLD: Time Lag/Synchronization Resent/Update" ); - recv_data.read_skip(); + uint64 guid; + if(!recv_data.readPackGUID(guid)) + { + recv_data.rpos(recv_data.wpos()); + return; + } recv_data.read_skip(); /* uint64 guid; diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 673fa3537..e9a21360b 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -1226,9 +1226,15 @@ void ObjectMgr::LoadGameobjects() continue; } + if(!gInfo->displayId)) + { + sLog.outErrorDb("Gameobject (GUID: %u Entry %u GoType: %u) doesn't have displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId); + continue; + } + if(gInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(gInfo->displayId)) { - sLog.outErrorDb("Gameobject (GUID: %u Entry %u GoType: %u) have invalid displayId (%u), not loaded.",guid, entry, gInfo->type, gInfo->displayId); + sLog.outErrorDb("Gameobject (GUID: %u Entry %u GoType: %u) have invalid displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId); continue; } @@ -1246,9 +1252,9 @@ void ObjectMgr::LoadGameobjects() data.rotation3 = fields[10].GetFloat(); data.spawntimesecs = fields[11].GetInt32(); - if (data.spawntimesecs==0 && gInfo->IsDespawnAtAction()) + if (data.spawntimesecs == 0 && gInfo->IsDespawnAtAction()) { - sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with `spawntimesecs` (0) value, but gameobejct marked as despawnable at action.",guid,data.id); + sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with `spawntimesecs` (0) value, but gameobejct marked as despawnable at action.", guid, data.id); } data.animprogress = fields[12].GetUInt32(); @@ -1256,7 +1262,7 @@ void ObjectMgr::LoadGameobjects() uint32 go_state = fields[13].GetUInt32(); if (go_state >= MAX_GO_STATE) { - sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with invalid `state` (%u) value, skip",guid,data.id,go_state); + sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with invalid `state` (%u) value, skip", guid, data.id, go_state); continue; } data.go_state = GOState(go_state); @@ -1268,29 +1274,29 @@ void ObjectMgr::LoadGameobjects() if(data.rotation2 < -1.0f || data.rotation2 > 1.0f) { - sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with invalid rotation2 (%f) value, skip",guid,data.id,data.rotation2 ); + sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with invalid rotation2 (%f) value, skip", guid, data.id, data.rotation2); continue; } if(data.rotation3 < -1.0f || data.rotation3 > 1.0f) { - sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with invalid rotation3 (%f) value, skip",guid,data.id,data.rotation3 ); + sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with invalid rotation3 (%f) value, skip", guid, data.id, data.rotation3); continue; } - if(!MapManager::IsValidMapCoord(data.mapid,data.posX,data.posY,data.posZ,data.orientation)) + if(!MapManager::IsValidMapCoord(data.mapid, data.posX, data.posY, data.posZ, data.orientation)) { - sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with invalid coordinates, skip",guid,data.id ); + sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with invalid coordinates, skip", guid, data.id); continue; } - if(data.phaseMask==0) + if(data.phaseMask == 0) { - sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.",guid,data.id ); + sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.", guid, data.id); data.phaseMask = 1; } - if (gameEvent==0 && PoolId==0) // if not this is to be managed by GameEvent System or Pool system + if (gameEvent == 0 && PoolId == 0) // if not this is to be managed by GameEvent System or Pool system AddGameobjectToGrid(guid, &data); ++count; From ed2b97287bead73753324b7720f09d1ddbcf708a Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Mon, 24 Aug 2009 01:28:12 +0400 Subject: [PATCH 074/132] Compile fix. --- src/game/MiscHandler.cpp | 8 +++----- src/game/ObjectMgr.cpp | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index a2765ba1a..99ceebfc6 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -589,10 +589,8 @@ void WorldSession::HandleSetContactNotesOpcode( WorldPacket & recv_data ) void WorldSession::HandleBugOpcode( WorldPacket & recv_data ) { - uint32 suggestion, contentlen; - std::string content; - uint32 typelen; - std::string type; + uint32 suggestion, contentlen, typelen; + std::string content, type; recv_data >> suggestion >> contentlen >> content; @@ -889,7 +887,7 @@ void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data) uLongf realSize = decompressedSize; if(uncompress(const_cast(dest.contents()), &realSize, const_cast(recv_data.contents() + recv_data.rpos()), recv_data.size() - recv_data.rpos()) != Z_OK) { - recv_data.rpos(recv_data.wpos()); // unnneded warning spam in this case + recv_data.rpos(recv_data.wpos()); // unneded warning spam in this case sLog.outError("UAD: Failed to decompress account data"); return; } diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index e9a21360b..fdcb99832 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -1226,7 +1226,7 @@ void ObjectMgr::LoadGameobjects() continue; } - if(!gInfo->displayId)) + if(!gInfo->displayId) { sLog.outErrorDb("Gameobject (GUID: %u Entry %u GoType: %u) doesn't have displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId); continue; From af8ec3d94f5f7b2cd940b9330ddb2c1177749d0a Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Thu, 27 Aug 2009 01:47:49 +0400 Subject: [PATCH 075/132] Updated to latest client build 10357. --- src/game/UpdateFields.h | 2 +- src/realmd/AuthCodes.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game/UpdateFields.h b/src/game/UpdateFields.h index c6d39ee88..1e7548686 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, 2, 2, 10257 +// Auto generated for version 0, 2, 2, 10357 enum EObjectFields { diff --git a/src/realmd/AuthCodes.h b/src/realmd/AuthCodes.h index af2e38b4e..ff42e7d39 100644 --- a/src/realmd/AuthCodes.h +++ b/src/realmd/AuthCodes.h @@ -66,9 +66,9 @@ enum LoginResult // 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.2.2 client build 10257... +// will only support WoW, WoW:TBC and WoW:WotLK 3.2.2 client build 10357... -#define EXPECTED_MANGOS_CLIENT_BUILD {10257, 0} +#define EXPECTED_MANGOS_CLIENT_BUILD {10357, 0} // At update excepted builds please update if need define DEFAULT_MAX_LEVEL // in DBCEnum.h to default max player level expected by build From 0f5380a385ed200022ef4aa6c9343ad2769e2788 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Fri, 28 Aug 2009 17:26:59 +0400 Subject: [PATCH 076/132] Updated to latest build 10371. --- src/game/Opcodes.h | 2 +- src/game/UpdateFields.h | 2 +- src/realmd/AuthCodes.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h index 2aa539514..f34c82b24 100644 --- a/src/game/Opcodes.h +++ b/src/game/Opcodes.h @@ -1306,7 +1306,7 @@ enum Opcodes UMSG_UNKNOWN_1269 = 0x4F5, // not found 3.2 CMSG_WORLD_STATE_UI_TIMER_UPDATE = 0x4F6, SMSG_WORLD_STATE_UI_TIMER_UPDATE = 0x4F7, - CMSG_UNKNOWN_1272 = 0x4F8, // called from lua: CreateCharacter + CMSG_UNKNOWN_1272 = 0x4F8, // called from lua: CreateCharacter, may be paid race change NUM_MSG_TYPES = 0x4F9 }; diff --git a/src/game/UpdateFields.h b/src/game/UpdateFields.h index 1e7548686..3bd985ab8 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, 2, 2, 10357 +// Auto generated for version 0, 2, 2, 10371 enum EObjectFields { diff --git a/src/realmd/AuthCodes.h b/src/realmd/AuthCodes.h index ff42e7d39..6d84da2b5 100644 --- a/src/realmd/AuthCodes.h +++ b/src/realmd/AuthCodes.h @@ -66,9 +66,9 @@ enum LoginResult // 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.2.2 client build 10357... +// will only support WoW, WoW:TBC and WoW:WotLK 3.2.2 client build 10371... -#define EXPECTED_MANGOS_CLIENT_BUILD {10357, 0} +#define EXPECTED_MANGOS_CLIENT_BUILD {10371, 0} // At update excepted builds please update if need define DEFAULT_MAX_LEVEL // in DBCEnum.h to default max player level expected by build From 94fdc7e37edbc578e4cc3076d0123c480dc21a2e Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Fri, 28 Aug 2009 19:14:16 +0400 Subject: [PATCH 077/132] Fix. --- src/game/ArenaTeamHandler.cpp | 39 ++- src/game/GuildHandler.cpp | 439 ++++++++++++++-------------------- src/game/ObjectMgr.cpp | 12 + 3 files changed, 208 insertions(+), 282 deletions(-) diff --git a/src/game/ArenaTeamHandler.cpp b/src/game/ArenaTeamHandler.cpp index ce5dda707..0fdfdadfc 100644 --- a/src/game/ArenaTeamHandler.cpp +++ b/src/game/ArenaTeamHandler.cpp @@ -54,12 +54,11 @@ void WorldSession::HandleArenaTeamQueryOpcode(WorldPacket & recv_data) uint32 ArenaTeamId; recv_data >> ArenaTeamId; - ArenaTeam *arenateam = objmgr.GetArenaTeamById(ArenaTeamId); - if(!arenateam) // arena team not found - return; - - arenateam->Query(this); - arenateam->Stats(this); + if(ArenaTeam *arenateam = objmgr.GetArenaTeamById(ArenaTeamId)) + { + arenateam->Query(this); + arenateam->Stats(this); + } } void WorldSession::HandleArenaTeamRosterOpcode(WorldPacket & recv_data) @@ -69,11 +68,8 @@ void WorldSession::HandleArenaTeamRosterOpcode(WorldPacket & recv_data) uint32 ArenaTeamId; // arena team id recv_data >> ArenaTeamId; - ArenaTeam *arenateam = objmgr.GetArenaTeamById(ArenaTeamId); - if(!arenateam) - return; - - arenateam->Roster(this); + if(ArenaTeam *arenateam = objmgr.GetArenaTeamById(ArenaTeamId)) + arenateam->Roster(this); } void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recv_data) @@ -203,12 +199,14 @@ void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recv_data) ArenaTeam *at = objmgr.GetArenaTeamById(ArenaTeamId); if(!at) return; + if(_player->GetGUID() == at->GetCaptain() && at->GetMembersSize() > 1) { // check for correctness SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_LEADER_LEAVE_S); return; } + // arena team has only one member (=captain) if(_player->GetGUID() == at->GetCaptain()) { @@ -235,18 +233,17 @@ void WorldSession::HandleArenaTeamDisbandOpcode(WorldPacket & recv_data) uint32 ArenaTeamId; // arena team id recv_data >> ArenaTeamId; - ArenaTeam *at = objmgr.GetArenaTeamById(ArenaTeamId); - if(!at) - return; + if(ArenaTeam *at = objmgr.GetArenaTeamById(ArenaTeamId)) + { + if(at->GetCaptain() != _player->GetGUID()) + return; - if(at->GetCaptain() != _player->GetGUID()) - return; + if(at->IsFighting()) + return; - if (at->IsFighting()) - return; - - at->Disband(this); - delete at; + at->Disband(this); + delete at; + } } void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket & recv_data) diff --git a/src/game/GuildHandler.cpp b/src/game/GuildHandler.cpp index ddacd2aec..8891113ba 100644 --- a/src/game/GuildHandler.cpp +++ b/src/game/GuildHandler.cpp @@ -29,36 +29,32 @@ void WorldSession::HandleGuildQueryOpcode(WorldPacket& recvPacket) { + sLog.outDebug("WORLD: Received CMSG_GUILD_QUERY"); + uint32 guildId; - Guild *guild; - - //sLog.outDebug("WORLD: Received CMSG_GUILD_QUERY"); - recvPacket >> guildId; - guild = objmgr.GetGuildById(guildId); - if(!guild) + if(Guild *guild = objmgr.GetGuildById(guildId)) { - SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); + guild->Query(this); return; } - guild->Query(this); + SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); } void WorldSession::HandleGuildCreateOpcode(WorldPacket& recvPacket) { + sLog.outDebug("WORLD: Received CMSG_GUILD_CREATE"); + std::string gname; - - //sLog.outDebug("WORLD: Received CMSG_GUILD_CREATE"); - recvPacket >> gname; - if(GetPlayer()->GetGuildId()) + if(GetPlayer()->GetGuildId()) // already in guild return; Guild *guild = new Guild; - if(!guild->Create(GetPlayer(),gname)) + if(!guild->Create(GetPlayer(), gname)) { delete guild; return; @@ -69,10 +65,9 @@ void WorldSession::HandleGuildCreateOpcode(WorldPacket& recvPacket) void WorldSession::HandleGuildInviteOpcode(WorldPacket& recvPacket) { + sLog.outDebug("WORLD: Received CMSG_GUILD_INVITE"); + std::string Invitedname, plname; - - //sLog.outDebug("WORLD: Received CMSG_GUILD_INVITE"); - Player * player = NULL; recvPacket >> Invitedname; @@ -135,15 +130,14 @@ void WorldSession::HandleGuildInviteOpcode(WorldPacket& recvPacket) data << guild->GetName(); player->GetSession()->SendPacket(&data); - //sLog.outDebug("WORLD: Sent (SMSG_GUILD_INVITE)"); + sLog.outDebug("WORLD: Sent (SMSG_GUILD_INVITE)"); } void WorldSession::HandleGuildRemoveOpcode(WorldPacket& recvPacket) { + sLog.outDebug("WORLD: Received CMSG_GUILD_REMOVE"); + std::string plName; - - //sLog.outDebug("WORLD: Received CMSG_GUILD_REMOVE"); - recvPacket >> plName; if(!normalizePlayerName(plName)) @@ -200,7 +194,7 @@ void WorldSession::HandleGuildAcceptOpcode(WorldPacket& /*recvPacket*/) Guild *guild; Player *player = GetPlayer(); - //sLog.outDebug("WORLD: Received CMSG_GUILD_ACCEPT"); + sLog.outDebug("WORLD: Received CMSG_GUILD_ACCEPT"); guild = objmgr.GetGuildById(player->GetGuildIdInvited()); if(!guild || player->GetGuildId()) @@ -221,12 +215,12 @@ void WorldSession::HandleGuildAcceptOpcode(WorldPacket& /*recvPacket*/) data << player->GetName(); guild->BroadcastPacket(&data); - //sLog.outDebug("WORLD: Sent (SMSG_GUILD_EVENT)"); + sLog.outDebug("WORLD: Sent (SMSG_GUILD_EVENT)"); } void WorldSession::HandleGuildDeclineOpcode(WorldPacket& /*recvPacket*/) { - //sLog.outDebug("WORLD: Received CMSG_GUILD_DECLINE"); + sLog.outDebug("WORLD: Received CMSG_GUILD_DECLINE"); GetPlayer()->SetGuildIdInvited(0); GetPlayer()->SetInGuild(0); @@ -234,10 +228,9 @@ void WorldSession::HandleGuildDeclineOpcode(WorldPacket& /*recvPacket*/) void WorldSession::HandleGuildInfoOpcode(WorldPacket& /*recvPacket*/) { - Guild *guild; - //sLog.outDebug("WORLD: Received CMSG_GUILD_INFO"); + sLog.outDebug("WORLD: Received CMSG_GUILD_INFO"); - guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); + Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); if(!guild) { SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); @@ -257,21 +250,17 @@ void WorldSession::HandleGuildInfoOpcode(WorldPacket& /*recvPacket*/) void WorldSession::HandleGuildRosterOpcode(WorldPacket& /*recvPacket*/) { - //sLog.outDebug("WORLD: Received CMSG_GUILD_ROSTER"); + sLog.outDebug("WORLD: Received CMSG_GUILD_ROSTER"); - Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); - if(!guild) - return; - - guild->Roster(this); + if(Guild* guild = objmgr.GetGuildById(_player->GetGuildId())) + guild->Roster(this); } void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket) { + sLog.outDebug("WORLD: Received CMSG_GUILD_PROMOTE"); + std::string plName; - - //sLog.outDebug("WORLD: Received CMSG_GUILD_PROMOTE"); - recvPacket >> plName; if(!normalizePlayerName(plName)) @@ -330,10 +319,9 @@ void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket) void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket) { + sLog.outDebug("WORLD: Received CMSG_GUILD_DEMOTE"); + std::string plName; - - //sLog.outDebug("WORLD: Received CMSG_GUILD_DEMOTE"); - recvPacket >> plName; if(!normalizePlayerName(plName)) @@ -399,17 +387,15 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket) void WorldSession::HandleGuildLeaveOpcode(WorldPacket& /*recvPacket*/) { - std::string plName; - Guild *guild; + sLog.outDebug("WORLD: Received CMSG_GUILD_LEAVE"); - //sLog.outDebug("WORLD: Received CMSG_GUILD_LEAVE"); - - guild = objmgr.GetGuildById(_player->GetGuildId()); + Guild *guild = objmgr.GetGuildById(_player->GetGuildId()); if(!guild) { SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); return; } + if(_player->GetGUID() == guild->GetLeader() && guild->GetMemberSize() > 1) { SendGuildCommandResult(GUILD_QUIT_S, "", GUILD_LEADER_LEAVE); @@ -422,8 +408,6 @@ void WorldSession::HandleGuildLeaveOpcode(WorldPacket& /*recvPacket*/) return; } - plName = _player->GetName(); - guild->DelMember(_player->GetGUID()); // Put record into guildlog guild->LogGuildEvent(GUILD_EVENT_LOG_LEAVE_GUILD, _player->GetGUIDLow(), 0, 0); @@ -431,27 +415,25 @@ void WorldSession::HandleGuildLeaveOpcode(WorldPacket& /*recvPacket*/) WorldPacket data(SMSG_GUILD_EVENT, (2+10)); // guess size data << (uint8)GE_LEFT; data << (uint8)1; // strings count - data << plName; + data << _player->GetName(); guild->BroadcastPacket(&data); - //sLog.outDebug("WORLD: Sent (SMSG_GUILD_EVENT)"); + sLog.outDebug("WORLD: Sent (SMSG_GUILD_EVENT)"); SendGuildCommandResult(GUILD_QUIT_S, guild->GetName(), GUILD_PLAYER_NO_MORE_IN_GUILD); } void WorldSession::HandleGuildDisbandOpcode(WorldPacket& /*recvPacket*/) { - std::string name; - Guild *guild; + sLog.outDebug("WORLD: Received CMSG_GUILD_DISBAND"); - //sLog.outDebug("WORLD: Received CMSG_GUILD_DISBAND"); - - guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); + Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); if(!guild) { SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); return; } + if(GetPlayer()->GetGUID() != guild->GetLeader()) { SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS); @@ -460,23 +442,22 @@ void WorldSession::HandleGuildDisbandOpcode(WorldPacket& /*recvPacket*/) guild->Disband(); - //sLog.outDebug("WORLD: Guild Sucefully Disbanded"); + sLog.outDebug("WORLD: Guild Successfully Disbanded"); } void WorldSession::HandleGuildLeaderOpcode(WorldPacket& recvPacket) { + sLog.outDebug("WORLD: Received CMSG_GUILD_LEADER"); + std::string name; - Player *oldLeader = GetPlayer(); - Guild *guild; - - //sLog.outDebug("WORLD: Received CMSG_GUILD_LEADER"); - recvPacket >> name; + Player *oldLeader = GetPlayer(); + if(!normalizePlayerName(name)) return; - guild = objmgr.GetGuildById(oldLeader->GetGuildId()); + Guild *guild = objmgr.GetGuildById(oldLeader->GetGuildId()); if (!guild) { @@ -509,17 +490,21 @@ void WorldSession::HandleGuildLeaderOpcode(WorldPacket& recvPacket) data << name.c_str(); guild->BroadcastPacket(&data); - //sLog.outDebug("WORLD: Sent (SMSG_GUILD_EVENT)"); + sLog.outDebug("WORLD: Sent (SMSG_GUILD_EVENT)"); } void WorldSession::HandleGuildMOTDOpcode(WorldPacket& recvPacket) { - Guild *guild; + sLog.outDebug("WORLD: Received CMSG_GUILD_MOTD"); + std::string MOTD; - //sLog.outDebug("WORLD: Received CMSG_GUILD_MOTD"); + if(!recvPacket.empty()) + recvPacket >> MOTD; + else + MOTD = ""; - guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); + Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); if(!guild) { SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); @@ -531,11 +516,6 @@ void WorldSession::HandleGuildMOTDOpcode(WorldPacket& recvPacket) return; } - if(!recvPacket.empty()) - recvPacket >> MOTD; - else - MOTD = ""; - guild->SetMOTD(MOTD); WorldPacket data(SMSG_GUILD_EVENT, (2+MOTD.size()+1)); @@ -544,15 +524,14 @@ void WorldSession::HandleGuildMOTDOpcode(WorldPacket& recvPacket) data << MOTD; guild->BroadcastPacket(&data); - //sLog.outDebug("WORLD: Sent (SMSG_GUILD_EVENT)"); + sLog.outDebug("WORLD: Sent (SMSG_GUILD_EVENT)"); } void WorldSession::HandleGuildSetPublicNoteOpcode(WorldPacket& recvPacket) { + sLog.outDebug("WORLD: Received CMSG_GUILD_SET_PUBLIC_NOTE"); + std::string name,PNOTE; - - //sLog.outDebug("WORLD: Received CMSG_GUILD_SET_PUBLIC_NOTE"); - recvPacket >> name; if(!normalizePlayerName(name)) @@ -589,10 +568,9 @@ void WorldSession::HandleGuildSetPublicNoteOpcode(WorldPacket& recvPacket) void WorldSession::HandleGuildSetOfficerNoteOpcode(WorldPacket& recvPacket) { + sLog.outDebug("WORLD: Received CMSG_GUILD_SET_OFFICER_NOTE"); + std::string plName, OFFNOTE; - - //sLog.outDebug("WORLD: Received CMSG_GUILD_SET_OFFICER_NOTE"); - recvPacket >> plName; if (!normalizePlayerName(plName)) @@ -628,23 +606,19 @@ void WorldSession::HandleGuildSetOfficerNoteOpcode(WorldPacket& recvPacket) void WorldSession::HandleGuildRankOpcode(WorldPacket& recvPacket) { - //recvPacket.hexlike(); - - Guild *guild; std::string rankname; uint32 rankId; uint32 rights, MoneyPerDay; - //sLog.outDebug("WORLD: Received CMSG_GUILD_RANK"); + sLog.outDebug("WORLD: Received CMSG_GUILD_RANK"); - guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); + Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); if(!guild) { recvPacket.rpos(recvPacket.wpos()); // set to end to avoid warnings spam SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); return; } - else if(GetPlayer()->GetGUID() != guild->GetLeader()) { recvPacket.rpos(recvPacket.wpos()); // set to end to avoid warnings spam @@ -683,12 +657,12 @@ void WorldSession::HandleGuildRankOpcode(WorldPacket& recvPacket) void WorldSession::HandleGuildAddRankOpcode(WorldPacket& recvPacket) { - Guild *guild; + sLog.outDebug("WORLD: Received CMSG_GUILD_ADD_RANK"); + std::string rankname; + recvPacket >> rankname; - //sLog.outDebug("WORLD: Received CMSG_GUILD_ADD_RANK"); - - guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); + Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); if(!guild) { SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); @@ -704,8 +678,6 @@ void WorldSession::HandleGuildAddRankOpcode(WorldPacket& recvPacket) if(guild->GetRanksSize() >= GUILD_RANKS_MAX_COUNT) // client not let create more 10 than ranks return; - recvPacket >> rankname; - guild->CreateRank(rankname, GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK); guild->Query(this); @@ -714,18 +686,14 @@ void WorldSession::HandleGuildAddRankOpcode(WorldPacket& recvPacket) void WorldSession::HandleGuildDelRankOpcode(WorldPacket& /*recvPacket*/) { - Guild *guild; - std::string rankname; + sLog.outDebug("WORLD: Received CMSG_GUILD_DEL_RANK"); - //sLog.outDebug("WORLD: Received CMSG_GUILD_DEL_RANK"); - - guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); + Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); if(!guild) { SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); return; } - else if(GetPlayer()->GetGUID() != guild->GetLeader()) { SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS); @@ -746,15 +714,14 @@ void WorldSession::SendGuildCommandResult(uint32 typecmd, const std::string& str data << cmdresult; SendPacket(&data); - //sLog.outDebug("WORLD: Sent (SMSG_GUILD_COMMAND_RESULT)"); + sLog.outDebug("WORLD: Sent (SMSG_GUILD_COMMAND_RESULT)"); } void WorldSession::HandleGuildChangeInfoTextOpcode(WorldPacket& recvPacket) { - //sLog.outDebug("WORLD: Received CMSG_GUILD_INFO_TEXT"); + sLog.outDebug("WORLD: Received CMSG_GUILD_INFO_TEXT"); std::string GINFO; - recvPacket >> GINFO; Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); @@ -775,17 +742,13 @@ void WorldSession::HandleGuildChangeInfoTextOpcode(WorldPacket& recvPacket) void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket) { - //sLog.outDebug("WORLD: Received MSG_SAVE_GUILD_EMBLEM"); + sLog.outDebug("WORLD: Received MSG_SAVE_GUILD_EMBLEM"); uint64 vendorGuid; - - uint32 EmblemStyle; - uint32 EmblemColor; - uint32 BorderStyle; - uint32 BorderColor; - uint32 BackgroundColor; + uint32 EmblemStyle, EmblemColor, BorderStyle, BorderColor, BackgroundColor; recvPacket >> vendorGuid; + recvPacket >> EmblemStyle >> EmblemColor >> BorderStyle >> BorderColor >> BackgroundColor; Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorGuid,UNIT_NPC_FLAG_TABARDDESIGNER); if (!pCreature) @@ -800,12 +763,6 @@ void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket) if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); - recvPacket >> EmblemStyle; - recvPacket >> EmblemColor; - recvPacket >> BorderStyle; - recvPacket >> BorderColor; - recvPacket >> BackgroundColor; - Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); if(!guild) { @@ -841,17 +798,10 @@ void WorldSession::HandleGuildEventLogQueryOpcode(WorldPacket& /* recvPacket */) { // empty sLog.outDebug("WORLD: Received (MSG_GUILD_EVENT_LOG_QUERY)"); - //recvPacket.hexlike(); - uint32 GuildId = GetPlayer()->GetGuildId(); - if (GuildId == 0) - return; - - Guild *pGuild = objmgr.GetGuildById(GuildId); - if(!pGuild) - return; - - pGuild->DisplayGuildEventLog(this); + if(uint32 GuildId = GetPlayer()->GetGuildId()) + if(Guild *pGuild = objmgr.GetGuildById(GuildId)) + pGuild->DisplayGuildEventLog(this); } /****** GUILD BANK *******/ @@ -859,53 +809,45 @@ void WorldSession::HandleGuildEventLogQueryOpcode(WorldPacket& /* recvPacket */) void WorldSession::HandleGuildBankMoneyWithdrawn( WorldPacket & /* recv_data */ ) { sLog.outDebug("WORLD: Received (MSG_GUILD_BANK_MONEY_WITHDRAWN)"); - //recv_data.hexlike(); - uint32 GuildId = GetPlayer()->GetGuildId(); - if (GuildId == 0) - return; - - Guild *pGuild = objmgr.GetGuildById(GuildId); - if(!pGuild) - return; - - pGuild->SendMoneyInfo(this, GetPlayer()->GetGUIDLow()); + if(uint32 GuildId = GetPlayer()->GetGuildId()) + if(Guild *pGuild = objmgr.GetGuildById(GuildId)) + pGuild->SendMoneyInfo(this, GetPlayer()->GetGUIDLow()); } void WorldSession::HandleGuildPermissions( WorldPacket& /* recv_data */ ) { sLog.outDebug("WORLD: Received (MSG_GUILD_PERMISSIONS)"); - uint32 GuildId = GetPlayer()->GetGuildId(); - if (GuildId == 0) - return; - - Guild *pGuild = objmgr.GetGuildById(GuildId); - if(!pGuild) - return; - - uint32 rankId = GetPlayer()->GetRank(); - - WorldPacket data(MSG_GUILD_PERMISSIONS, 4*15+1); - data << uint32(rankId); // guild rank id - data << uint32(pGuild->GetRankRights(rankId)); // rank rights - // money per day left - data << uint32(pGuild->GetMemberMoneyWithdrawRem(GetPlayer()->GetGUIDLow())); - data << uint8(pGuild->GetPurchasedTabs()); // tabs count - // why sending all info when not all tabs are purchased??? - for(int i = 0; i < GUILD_BANK_MAX_TABS; ++i) + if(uint32 GuildId = GetPlayer()->GetGuildId()) { - data << uint32(pGuild->GetBankRights(rankId, uint8(i))); - data << uint32(pGuild->GetMemberSlotWithdrawRem(GetPlayer()->GetGUIDLow(), uint8(i))); + if(Guild *pGuild = objmgr.GetGuildById(GuildId)) + { + uint32 rankId = GetPlayer()->GetRank(); + + WorldPacket data(MSG_GUILD_PERMISSIONS, 4*15+1); + data << uint32(rankId); // guild rank id + data << uint32(pGuild->GetRankRights(rankId)); // rank rights + // money per day left + data << uint32(pGuild->GetMemberMoneyWithdrawRem(GetPlayer()->GetGUIDLow())); + data << uint8(pGuild->GetPurchasedTabs()); // tabs count + // why sending all info when not all tabs are purchased??? + for(int i = 0; i < GUILD_BANK_MAX_TABS; ++i) + { + data << uint32(pGuild->GetBankRights(rankId, uint8(i))); + data << uint32(pGuild->GetMemberSlotWithdrawRem(GetPlayer()->GetGUIDLow(), uint8(i))); + } + SendPacket(&data); + sLog.outDebug("WORLD: Sent (MSG_GUILD_PERMISSIONS)"); + } } - SendPacket(&data); - sLog.outDebug("WORLD: Sent (MSG_GUILD_PERMISSIONS)"); } /* Called when clicking on Guild bank gameobject */ void WorldSession::HandleGuildBankerActivate( WorldPacket & recv_data ) { sLog.outDebug("WORLD: Received (CMSG_GUILD_BANKER_ACTIVATE)"); + uint64 GoGuid; uint8 unk; recv_data >> GoGuid >> unk; @@ -929,31 +871,31 @@ void WorldSession::HandleGuildBankerActivate( WorldPacket & recv_data ) void WorldSession::HandleGuildBankQueryTab( WorldPacket & recv_data ) { sLog.outDebug("WORLD: Received (CMSG_GUILD_BANK_QUERY_TAB)"); + uint64 GoGuid; - uint8 TabId,unk1; + uint8 TabId, unk1; recv_data >> GoGuid >> TabId >> unk1; if (!GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK)) return; - uint32 GuildId = GetPlayer()->GetGuildId(); - if (GuildId == 0) - return; + if(uint32 GuildId = GetPlayer()->GetGuildId()) + { + if(Guild *pGuild = objmgr.GetGuildById(GuildId)) + { + // Let's update the amount of gold the player can withdraw before displaying the content + // This is useful if money withdraw right has changed + pGuild->SendMoneyInfo(this, GetPlayer()->GetGUIDLow()); - Guild *pGuild = objmgr.GetGuildById(GuildId); - if(!pGuild) - return; - - // Let's update the amount of gold the player can withdraw before displaying the content - // This is usefull if money withdraw right has changed - pGuild->SendMoneyInfo(this, GetPlayer()->GetGUIDLow()); - - pGuild->DisplayGuildBankContent(this, TabId); + pGuild->DisplayGuildBankContent(this, TabId); + } + } } void WorldSession::HandleGuildBankDepositMoney( WorldPacket & recv_data ) { sLog.outDebug("WORLD: Received (CMSG_GUILD_BANK_DEPOSIT_MONEY)"); + uint64 GoGuid; uint32 money; recv_data >> GoGuid >> money; @@ -964,43 +906,42 @@ void WorldSession::HandleGuildBankDepositMoney( WorldPacket & recv_data ) if (!GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK)) return; - uint32 GuildId = GetPlayer()->GetGuildId(); - if (GuildId == 0) - return; - - Guild *pGuild = objmgr.GetGuildById(GuildId); - if(!pGuild) - return; - if (GetPlayer()->GetMoney() < money) return; - CharacterDatabase.BeginTransaction(); - - pGuild->SetBankMoney(pGuild->GetGuildBankMoney()+money); - GetPlayer()->ModifyMoney(-int(money)); - GetPlayer()->SaveGoldToDB(); - - CharacterDatabase.CommitTransaction(); - - // logging money - if(_player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE)) + if(uint32 GuildId = GetPlayer()->GetGuildId()) { - sLog.outCommand(_player->GetSession()->GetAccountId(),"GM %s (Account: %u) deposit money (Amount: %u) to guild bank (Guild ID %u)", - _player->GetName(),_player->GetSession()->GetAccountId(),money,GuildId); + if(Guild *pGuild = objmgr.GetGuildById(GuildId)) + { + CharacterDatabase.BeginTransaction(); + + pGuild->SetBankMoney(pGuild->GetGuildBankMoney()+money); + GetPlayer()->ModifyMoney(-int(money)); + GetPlayer()->SaveGoldToDB(); + + CharacterDatabase.CommitTransaction(); + + // logging money + if(_player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE)) + { + sLog.outCommand(_player->GetSession()->GetAccountId(),"GM %s (Account: %u) deposit money (Amount: %u) to guild bank (Guild ID %u)", + _player->GetName(),_player->GetSession()->GetAccountId(),money,GuildId); + } + + // log + pGuild->LogBankEvent(GUILD_BANK_LOG_DEPOSIT_MONEY, uint8(0), GetPlayer()->GetGUIDLow(), money); + + pGuild->DisplayGuildBankTabsInfo(this); + pGuild->DisplayGuildBankContent(this, 0); + pGuild->DisplayGuildBankMoneyUpdate(); + } } - - // log - pGuild->LogBankEvent(GUILD_BANK_LOG_DEPOSIT_MONEY, uint8(0), GetPlayer()->GetGUIDLow(), money); - - pGuild->DisplayGuildBankTabsInfo(this); - pGuild->DisplayGuildBankContent(this, 0); - pGuild->DisplayGuildBankMoneyUpdate(); } void WorldSession::HandleGuildBankWithdrawMoney( WorldPacket & recv_data ) { sLog.outDebug("WORLD: Received (CMSG_GUILD_BANK_WITHDRAW_MONEY)"); + uint64 GoGuid; uint32 money; recv_data >> GoGuid >> money; @@ -1050,7 +991,6 @@ void WorldSession::HandleGuildBankWithdrawMoney( WorldPacket & recv_data ) void WorldSession::HandleGuildBankSwapItems( WorldPacket & recv_data ) { sLog.outDebug("WORLD: Received (CMSG_GUILD_BANK_SWAP_ITEMS)"); - //recv_data.hexlike(); uint64 GoGuid; uint8 BankToBank; @@ -1112,43 +1052,39 @@ void WorldSession::HandleGuildBankSwapItems( WorldPacket & recv_data ) if (!GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK)) return; - uint32 GuildId = GetPlayer()->GetGuildId(); - if (GuildId == 0) - return; - - Guild *pGuild = objmgr.GetGuildById(GuildId); - if(!pGuild) - return; - - Player *pl = GetPlayer(); - - // Bank <-> Bank - if (BankToBank) + if(uint32 GuildId = GetPlayer()->GetGuildId()) { - pGuild->SwapItems(pl, BankTab, BankTabSlot, BankTabDst, BankTabSlotDst, SplitedAmount); - return; + if(Guild *pGuild = objmgr.GetGuildById(GuildId)) + { + // Bank <-> Bank + if (BankToBank) + { + pGuild->SwapItems(_player, BankTab, BankTabSlot, BankTabDst, BankTabSlotDst, SplitedAmount); + return; + } + + // Player <-> Bank + + // allow work with inventory only + if(!Player::IsInventoryPos(PlayerBag, PlayerSlot) && !(PlayerBag == NULL_BAG && PlayerSlot == NULL_SLOT) ) + { + _player->SendEquipError( EQUIP_ERR_NONE, NULL, NULL ); + return; + } + + // BankToChar swap or char to bank remaining + if (ToChar) // Bank -> Char cases + pGuild->MoveFromBankToChar(_player, BankTab, BankTabSlot, PlayerBag, PlayerSlot, SplitedAmount); + else // Char -> Bank cases + pGuild->MoveFromCharToBank(_player, PlayerBag, PlayerSlot, BankTab, BankTabSlot, SplitedAmount); + } } - - // Player <-> Bank - - // allow work with inventory only - if(!Player::IsInventoryPos(PlayerBag,PlayerSlot) && !(PlayerBag == NULL_BAG && PlayerSlot == NULL_SLOT) ) - { - _player->SendEquipError( EQUIP_ERR_NONE, NULL, NULL ); - return; - } - - // BankToChar swap or char to bank remaining - if (ToChar) // Bank -> Char cases - pGuild->MoveFromBankToChar(pl, BankTab, BankTabSlot, PlayerBag, PlayerSlot, SplitedAmount); - else // Char -> Bank cases - pGuild->MoveFromCharToBank(pl, PlayerBag, PlayerSlot, BankTab, BankTabSlot, SplitedAmount); } void WorldSession::HandleGuildBankBuyTab( WorldPacket & recv_data ) { sLog.outDebug("WORLD: Received (CMSG_GUILD_BANK_BUY_TAB)"); - //recv_data.hexlike(); + uint64 GoGuid; uint8 TabId; @@ -1175,7 +1111,7 @@ void WorldSession::HandleGuildBankBuyTab( WorldPacket & recv_data ) if (TabId != pGuild->GetPurchasedTabs()) // m_PurchasedTabs = 0 when buying Tab 0, that is why this check can be made { - sLog.outError("Error: trying to buy a tab non contigous to owned ones"); + sLog.outError("Error: trying to buy a tab non contiguous to owned ones"); return; } @@ -1194,7 +1130,7 @@ void WorldSession::HandleGuildBankBuyTab( WorldPacket & recv_data ) void WorldSession::HandleGuildBankUpdateTab( WorldPacket & recv_data ) { sLog.outDebug("WORLD: Received (CMSG_GUILD_BANK_UPDATE_TAB)"); - //recv_data.hexlike(); + uint64 GoGuid; uint8 TabId; std::string Name; @@ -1214,72 +1150,53 @@ void WorldSession::HandleGuildBankUpdateTab( WorldPacket & recv_data ) if (!GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK)) return; - uint32 GuildId = GetPlayer()->GetGuildId(); - if (GuildId==0) - return; - - Guild *pGuild = objmgr.GetGuildById(GuildId); - if(!pGuild) - return; - - pGuild->SetGuildBankTabInfo(TabId, Name, IconIndex); - pGuild->DisplayGuildBankTabsInfo(this); - pGuild->DisplayGuildBankContent(this, TabId); + if(uint32 GuildId = GetPlayer()->GetGuildId()) + { + if(Guild *pGuild = objmgr.GetGuildById(GuildId)) + { + pGuild->SetGuildBankTabInfo(TabId, Name, IconIndex); + pGuild->DisplayGuildBankTabsInfo(this); + pGuild->DisplayGuildBankContent(this, TabId); + } + } } void WorldSession::HandleGuildBankLogQuery( WorldPacket & recv_data ) { sLog.outDebug("WORLD: Received (MSG_GUILD_BANK_LOG_QUERY)"); - uint32 GuildId = GetPlayer()->GetGuildId(); - if (GuildId == 0) - return; - - Guild *pGuild = objmgr.GetGuildById(GuildId); - if(!pGuild) - return; - uint8 TabId; recv_data >> TabId; - pGuild->DisplayGuildBankLogs(this, TabId); + if(uint32 GuildId = GetPlayer()->GetGuildId()) + if(Guild *pGuild = objmgr.GetGuildById(GuildId)) + pGuild->DisplayGuildBankLogs(this, TabId); } void WorldSession::HandleQueryGuildBankTabText(WorldPacket &recv_data) { sLog.outDebug("WORLD: Received MSG_QUERY_GUILD_BANK_TEXT"); - uint32 GuildId = GetPlayer()->GetGuildId(); - if (GuildId == 0) - return; - - Guild *pGuild = objmgr.GetGuildById(GuildId); - if(!pGuild) - return; - uint8 TabId; recv_data >> TabId; - pGuild->SendGuildBankTabText(this, TabId); + if(uint32 GuildId = GetPlayer()->GetGuildId()) + if(Guild *pGuild = objmgr.GetGuildById(GuildId)) + pGuild->SendGuildBankTabText(this, TabId); } void WorldSession::HandleSetGuildBankTabText(WorldPacket &recv_data) { sLog.outDebug("WORLD: Received CMSG_SET_GUILD_BANK_TEXT"); - uint32 GuildId = GetPlayer()->GetGuildId(); - if (GuildId == 0) - return; - - Guild *pGuild = objmgr.GetGuildById(GuildId); - if(!pGuild) - return; uint8 TabId; std::string Text; recv_data >> TabId; recv_data >> Text; - pGuild->SetGuildBankTabText(TabId, Text); + if(uint32 GuildId = GetPlayer()->GetGuildId()) + if(Guild *pGuild = objmgr.GetGuildById(GuildId)) + pGuild->SetGuildBankTabText(TabId, Text); } void WorldSession::SendSaveGuildEmblem( uint32 msg ) diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 03069a440..4441f2a79 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -1466,6 +1466,12 @@ bool ObjectMgr::GetPlayerNameByGUID(const uint64 &guid, std::string &name) const uint32 ObjectMgr::GetPlayerTeamByGUID(const uint64 &guid) const { + // prevent DB access for online player + if(Player* player = GetPlayer(guid)) + { + return Player::TeamForRace(player->getRace()); + } + QueryResult *result = CharacterDatabase.PQuery("SELECT race FROM characters WHERE guid = '%u'", GUID_LOPART(guid)); if(result) @@ -1480,6 +1486,12 @@ uint32 ObjectMgr::GetPlayerTeamByGUID(const uint64 &guid) const uint32 ObjectMgr::GetPlayerAccountIdByGUID(const uint64 &guid) const { + // prevent DB access for online player + if(Player* player = GetPlayer(guid)) + { + return player->GetSession()->GetAccountId(); + } + QueryResult *result = CharacterDatabase.PQuery("SELECT account FROM characters WHERE guid = '%u'", GUID_LOPART(guid)); if(result) { From fdc20af337ff12fcdf0a995af0e6ccd4c6f73d6f Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Fri, 28 Aug 2009 22:33:52 +0400 Subject: [PATCH 078/132] Some fixes. --- sql/320/5_bugreport.sql | 3 ++ src/game/DynamicObject.h | 1 - src/game/MiscHandler.cpp | 4 ++- src/game/MovementHandler.cpp | 9 +++-- src/game/Opcodes.cpp | 4 +-- src/game/Opcodes.h | 4 +-- src/game/Player.cpp | 11 +++--- src/game/Player.h | 2 -- src/game/QueryHandler.cpp | 13 +++++++ src/game/SharedDefines.h | 68 +++++++++++++++++++----------------- src/game/Spell.cpp | 18 +++++++++- src/game/Spell.h | 3 +- src/game/SpellHandler.cpp | 14 +++++--- src/game/WorldSession.h | 1 + 14 files changed, 99 insertions(+), 56 deletions(-) create mode 100644 sql/320/5_bugreport.sql diff --git a/sql/320/5_bugreport.sql b/sql/320/5_bugreport.sql new file mode 100644 index 000000000..8677da13a --- /dev/null +++ b/sql/320/5_bugreport.sql @@ -0,0 +1,3 @@ +alter table `characters`.`bugreport` + change `type` `type` longtext NOT NULL, + change `content` `content` longtext NOT NULL; diff --git a/src/game/DynamicObject.h b/src/game/DynamicObject.h index 066361b8c..089175f3c 100644 --- a/src/game/DynamicObject.h +++ b/src/game/DynamicObject.h @@ -61,7 +61,6 @@ class DynamicObject : public WorldObject uint32 m_spellId; uint32 m_effIndex; int32 m_aliveDuration; - time_t m_nextThinkTime; float m_radius; // radius apply persistent effect, 0 = no persistent effect AffectedSet m_affected; private: diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index eabc8f0a6..459bb2111 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -40,10 +40,12 @@ #include "Pet.h" #include "SocialMgr.h" -void WorldSession::HandleRepopRequestOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleRepopRequestOpcode( WorldPacket & recv_data ) { sLog.outDebug( "WORLD: Recvd CMSG_REPOP_REQUEST Message" ); + recv_data.read_skip(); + if(GetPlayer()->isAlive() || GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) return; diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index cddb39594..67951bab9 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -515,7 +515,8 @@ void WorldSession::HandleMoveKnockBackAck( WorldPacket & recv_data ) { sLog.outDebug("CMSG_MOVE_KNOCK_BACK_ACK"); - recv_data.read_skip(); // guid + uint64 guid; + recv_data.readPackGUID(guid); recv_data.read_skip(); // unk MovementInfo movementInfo; @@ -526,7 +527,8 @@ void WorldSession::HandleMoveHoverAck( WorldPacket& recv_data ) { sLog.outDebug("CMSG_MOVE_HOVER_ACK"); - recv_data.read_skip(); // guid + uint64 guid; + recv_data.readPackGUID(guid); recv_data.read_skip(); // unk MovementInfo movementInfo; @@ -539,7 +541,8 @@ void WorldSession::HandleMoveWaterWalkAck(WorldPacket& recv_data) { sLog.outDebug("CMSG_MOVE_WATER_WALK_ACK"); - recv_data.read_skip(); // guid + uint64 guid; + recv_data.readPackGUID(guid); recv_data.read_skip(); // unk MovementInfo movementInfo; diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp index 682039af2..964c14dd7 100644 --- a/src/game/Opcodes.cpp +++ b/src/game/Opcodes.cpp @@ -1232,8 +1232,8 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x4B3*/ { "CMSG_ITEM_REFUND_INFO_REQUEST", STATUS_LOGGEDIN, &WorldSession::HandleItemRefundInfoRequest }, /*0x4B4*/ { "CMSG_UNKNOWN_1204", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4B5*/ { "SMSG_UNKNOWN_1205", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x4B6*/ { "CMSG_UNKNOWN_1206", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x4B7*/ { "SMSG_UNKNOWN_1207", STATUS_NEVER, &WorldSession::Handle_ServerSide }, + /*0x4B6*/ { "CMSG_CORPSE_MAP_POSITION_QUERY", STATUS_LOGGEDIN, &WorldSession::HandleCorpseMapPositionQuery }, + /*0x4B7*/ { "CMSG_CORPSE_MAP_POSITION_QUERY_RESPONSE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x4B8*/ { "CMSG_LFG_SET_ROLES", STATUS_LOGGEDIN, &WorldSession::HandleLfgSetRoles }, /*0x4B9*/ { "UMSG_UNKNOWN_1209", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4BA*/ { "CMSG_UNKNOWN_1210", STATUS_NEVER, &WorldSession::Handle_NULL }, diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h index f34c82b24..fafccb09b 100644 --- a/src/game/Opcodes.h +++ b/src/game/Opcodes.h @@ -1240,8 +1240,8 @@ enum Opcodes CMSG_ITEM_REFUND_INFO_REQUEST = 0x4B3, // refund request? CMSG_UNKNOWN_1204 = 0x4B4, // lua: ContainerRefundItemPurchase SMSG_UNKNOWN_1205 = 0x4B5, // refund something - CMSG_UNKNOWN_1206 = 0x4B6, // CMSG, uint32 - SMSG_UNKNOWN_1207 = 0x4B7, // SMSG, string+float + CMSG_CORPSE_MAP_POSITION_QUERY = 0x4B6, // CMSG, uint32 + CMSG_CORPSE_MAP_POSITION_QUERY_RESPONSE = 0x4B7, // SMSG, 3*float+float CMSG_LFG_SET_ROLES = 0x4B8, // CMSG, empty, lua: SetLFGRoles UMSG_UNKNOWN_1209 = 0x4B9, // not found CMSG_UNKNOWN_1210 = 0x4BA, // CMSG, uint64, lua: CalendarContextEventSignUp diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 660c2b1af..dc5027151 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -1444,10 +1444,9 @@ bool Player::BuildEnumData( QueryResult * result, WorldPacket * p_data ) char_flags |= CHARACTER_FLAG_DECLINED; *p_data << uint32(char_flags); // character flags - // character customize (flags?) + // character customize flags *p_data << uint32(atLoginFlags & AT_LOGIN_CUSTOMIZE ? 1 : 0);// 0x00010000 - faction change *p_data << uint8(1); // unknown - *p_data << uint8(0); // 3.2 // Pets info { @@ -4236,17 +4235,17 @@ void Player::CreateCorpse() corpse->SetUInt32Value( CORPSE_FIELD_GUILD, GetGuildId() ); uint32 iDisplayID; - uint16 iIventoryType; + uint32 iIventoryType; uint32 _cfi; for (int i = 0; i < EQUIPMENT_SLOT_END; ++i) { if(m_items[i]) { iDisplayID = m_items[i]->GetProto()->DisplayInfoID; - iIventoryType = (uint16)m_items[i]->GetProto()->InventoryType; + iIventoryType = m_items[i]->GetProto()->InventoryType; - _cfi = (uint16(iDisplayID)) | (iIventoryType)<< 24; - corpse->SetUInt32Value(CORPSE_FIELD_ITEM + i,_cfi); + _cfi = iDisplayID | (iIventoryType << 24); + corpse->SetUInt32Value(CORPSE_FIELD_ITEM + i, _cfi); } } diff --git a/src/game/Player.h b/src/game/Player.h index 2a1d1eb42..d9fde7a0b 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -2390,8 +2390,6 @@ class MANGOS_DLL_SPEC Player : public Unit uint16 tradeItems[TRADE_SLOT_COUNT]; uint32 tradeGold; - time_t m_nextThinkTime; - bool m_DailyQuestChanged; time_t m_lastDailyQuestTime; diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp index 81104f70a..38c6ee096 100644 --- a/src/game/QueryHandler.cpp +++ b/src/game/QueryHandler.cpp @@ -457,3 +457,16 @@ void WorldSession::HandlePageTextQueryOpcode( WorldPacket & recv_data ) sLog.outDebug( "WORLD: Sent SMSG_PAGE_TEXT_QUERY_RESPONSE" ); } } + +void WorldSession::HandleCorpseMapPositionQuery( WorldPacket & recv_data ) +{ + uint32 unk; + recv_data >> unk; + + WorldPacket data(CMSG_CORPSE_MAP_POSITION_QUERY_RESPONSE, 4+4+4+4); + data << float(0); + data << float(0); + data << float(0); + data << float(0); + SendPacket(&data); +} diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 096aa775d..a8638378f 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -2518,42 +2518,44 @@ enum ResponseCodes CHAR_CREATE_CHARACTER_CHOOSE_RACE = 0x3F, CHAR_CREATE_CHARACTER_ARENA_LEADER = 0x40, CHAR_CREATE_CHARACTER_DELETE_MAIL = 0x41, + CHAR_CREATE_CHARACTER_SWAP_FACTION = 0x42, + CHAR_CREATE_CHARACTER_RACE_ONLY = 0x43, - CHAR_DELETE_IN_PROGRESS = 0x42, - CHAR_DELETE_SUCCESS = 0x43, - CHAR_DELETE_FAILED = 0x44, - CHAR_DELETE_FAILED_LOCKED_FOR_TRANSFER = 0x45, - CHAR_DELETE_FAILED_GUILD_LEADER = 0x46, - CHAR_DELETE_FAILED_ARENA_CAPTAIN = 0x47, + CHAR_DELETE_IN_PROGRESS = 0x44, + CHAR_DELETE_SUCCESS = 0x45, + CHAR_DELETE_FAILED = 0x46, + CHAR_DELETE_FAILED_LOCKED_FOR_TRANSFER = 0x47, + CHAR_DELETE_FAILED_GUILD_LEADER = 0x48, + CHAR_DELETE_FAILED_ARENA_CAPTAIN = 0x49, - CHAR_LOGIN_IN_PROGRESS = 0x48, - CHAR_LOGIN_SUCCESS = 0x49, - CHAR_LOGIN_NO_WORLD = 0x4A, - CHAR_LOGIN_DUPLICATE_CHARACTER = 0x4B, - CHAR_LOGIN_NO_INSTANCES = 0x4C, - CHAR_LOGIN_FAILED = 0x4D, - CHAR_LOGIN_DISABLED = 0x4E, - CHAR_LOGIN_NO_CHARACTER = 0x4F, - CHAR_LOGIN_LOCKED_FOR_TRANSFER = 0x50, - CHAR_LOGIN_LOCKED_BY_BILLING = 0x51, + CHAR_LOGIN_IN_PROGRESS = 0x4A, + CHAR_LOGIN_SUCCESS = 0x4B, + CHAR_LOGIN_NO_WORLD = 0x4C, + CHAR_LOGIN_DUPLICATE_CHARACTER = 0x4D, + CHAR_LOGIN_NO_INSTANCES = 0x4E, + CHAR_LOGIN_FAILED = 0x4F, + CHAR_LOGIN_DISABLED = 0x50, + CHAR_LOGIN_NO_CHARACTER = 0x51, + CHAR_LOGIN_LOCKED_FOR_TRANSFER = 0x52, + CHAR_LOGIN_LOCKED_BY_BILLING = 0x53, - CHAR_NAME_SUCCESS = 0x52, - CHAR_NAME_FAILURE = 0x53, - CHAR_NAME_NO_NAME = 0x54, - CHAR_NAME_TOO_SHORT = 0x55, - CHAR_NAME_TOO_LONG = 0x56, - CHAR_NAME_INVALID_CHARACTER = 0x57, - CHAR_NAME_MIXED_LANGUAGES = 0x58, - CHAR_NAME_PROFANE = 0x59, - CHAR_NAME_RESERVED = 0x5A, - CHAR_NAME_INVALID_APOSTROPHE = 0x5B, - CHAR_NAME_MULTIPLE_APOSTROPHES = 0x5C, - CHAR_NAME_THREE_CONSECUTIVE = 0x5D, - CHAR_NAME_INVALID_SPACE = 0x5E, - CHAR_NAME_CONSECUTIVE_SPACES = 0x5F, - CHAR_NAME_RUSSIAN_CONSECUTIVE_SILENT_CHARACTERS = 0x60, - CHAR_NAME_RUSSIAN_SILENT_CHARACTER_AT_BEGINNING_OR_END = 0x61, - CHAR_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME = 0x62 + CHAR_NAME_SUCCESS = 0x54, + CHAR_NAME_FAILURE = 0x55, + CHAR_NAME_NO_NAME = 0x56, + CHAR_NAME_TOO_SHORT = 0x57, + CHAR_NAME_TOO_LONG = 0x58, + CHAR_NAME_INVALID_CHARACTER = 0x59, + CHAR_NAME_MIXED_LANGUAGES = 0x5A, + CHAR_NAME_PROFANE = 0x5B, + CHAR_NAME_RESERVED = 0x5C, + CHAR_NAME_INVALID_APOSTROPHE = 0x5D, + CHAR_NAME_MULTIPLE_APOSTROPHES = 0x5E, + CHAR_NAME_THREE_CONSECUTIVE = 0x5F, + CHAR_NAME_INVALID_SPACE = 0x60, + CHAR_NAME_CONSECUTIVE_SPACES = 0x61, + CHAR_NAME_RUSSIAN_CONSECUTIVE_SILENT_CHARACTERS = 0x62, + CHAR_NAME_RUSSIAN_SILENT_CHARACTER_AT_BEGINNING_OR_END = 0x63, + CHAR_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME = 0x64 }; /// Ban function modes diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 2d894fbca..68052b5ae 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -239,7 +239,10 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) if( m_targetMask & TARGET_FLAG_SOURCE_LOCATION ) { - if(data->rpos() + 4 + 4 + 4 > data->size()) + if(data->rpos() + 1 + 4 + 4 + 4 > data->size()) + return false; + + if(!data->readPackGUID(m_unitTargetGUID)) return false; *data >> m_srcX >> m_srcY >> m_srcZ; @@ -308,7 +311,14 @@ void SpellCastTargets::write ( WorldPacket * data ) } if( m_targetMask & TARGET_FLAG_SOURCE_LOCATION ) + { + if(m_unitTarget) + data->append(m_unitTarget->GetPackGUID()); + else + *data << uint8(0); + *data << m_srcX << m_srcY << m_srcZ; + } if( m_targetMask & TARGET_FLAG_DEST_LOCATION ) { @@ -2973,6 +2983,12 @@ void Spell::SendSpellStart() if ( castFlags & CAST_FLAG_AMMO ) WriteAmmoToPacket(&data); + if ( castFlags & CAST_FLAG_UNKNOWN21 ) + { + data << uint32(0); + data << uint32(0); + } + m_caster->SendMessageToSet(&data, true); } diff --git a/src/game/Spell.h b/src/game/Spell.h index d3092c895..17fbdbe80 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -77,7 +77,8 @@ enum SpellCastFlags CAST_FLAG_UNKNOWN10 = 0x00040000, CAST_FLAG_UNKNOWN5 = 0x00080000, // wotlk CAST_FLAG_UNKNOWN20 = 0x00100000, - CAST_FLAG_UNKNOWN7 = 0x00200000 // wotlk, rune cooldown list + CAST_FLAG_UNKNOWN7 = 0x00200000, // wotlk, rune cooldown list + CAST_FLAG_UNKNOWN21 = 0x04000000 }; enum SpellNotifyPushType diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp index 2112325f2..2372dfd4b 100644 --- a/src/game/SpellHandler.cpp +++ b/src/game/SpellHandler.cpp @@ -340,10 +340,16 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) { recvPacket.read_skip(); // unk1, coords? recvPacket.read_skip(); // unk1, coords? - recvPacket.read_skip(); // >> 1 - recvPacket.read_skip(); // >> MSG_MOVE_STOP - MovementInfo movementInfo; - ReadMovementInfo(recvPacket, &movementInfo); + uint8 unk1; + recvPacket >> unk1; // >> 1 or 0 + if(unk1) + { + recvPacket.read_skip(); // >> MSG_MOVE_STOP + uint64 guid; + recvPacket.readPackGUID(guid); + MovementInfo movementInfo; + ReadMovementInfo(recvPacket, &movementInfo); + } } // auto-selection buff level base at target level (in spellInfo) diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h index df4765695..0e9ef4faa 100644 --- a/src/game/WorldSession.h +++ b/src/game/WorldSession.h @@ -570,6 +570,7 @@ class MANGOS_DLL_SPEC WorldSession void HandleReclaimCorpseOpcode( WorldPacket& recvPacket ); void HandleCorpseQueryOpcode( WorldPacket& recvPacket ); + void HandleCorpseMapPositionQuery( WorldPacket& recvPacket ); void HandleResurrectResponseOpcode(WorldPacket& recvPacket); void HandleSummonResponseOpcode(WorldPacket& recv_data); From 2015f21fa81fe73b630518628a65bc8f67b28655 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sat, 29 Aug 2009 00:50:34 +0400 Subject: [PATCH 079/132] Even more fixes. --- src/game/GMTicketHandler.cpp | 3 ++- src/game/Player.cpp | 30 +++++++++++++----------------- src/game/Weather.cpp | 6 +++--- src/game/World.cpp | 9 +++++++++ 4 files changed, 27 insertions(+), 21 deletions(-) diff --git a/src/game/GMTicketHandler.cpp b/src/game/GMTicketHandler.cpp index ffdfae504..4e062ac9f 100644 --- a/src/game/GMTicketHandler.cpp +++ b/src/game/GMTicketHandler.cpp @@ -89,8 +89,9 @@ void WorldSession::HandleGMTicketCreateOpcode( WorldPacket & recv_data ) recv_data >> ticketText; recv_data.read_skip(); // unk1, 0 - recv_data.read_skip(); // unk2, 1 + recv_data.read_skip(); // unk2, 1 recv_data.read_skip(); // unk3, 0 + recv_data.read_skip(); // unk4, 0 sLog.outDebug("TicketCreate: map %u, x %f, y %f, z %f, text %s", map, x, y, z, ticketText.c_str()); diff --git a/src/game/Player.cpp b/src/game/Player.cpp index dc5027151..e6cc2b162 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -6217,29 +6217,19 @@ void Player::UpdateArea(uint32 newArea) void Player::UpdateZone(uint32 newZone, uint32 newArea) { - if(m_zoneUpdateId != newZone) - SendInitWorldStates(newZone, newArea); // only if really enters to new zone, not just area change, works strange... - - m_zoneUpdateId = newZone; - m_zoneUpdateTimer = ZONE_UPDATE_INTERVAL; - - // zone changed, so area changed as well, update it - UpdateArea(newArea); - AreaTableEntry const* zone = GetAreaEntryByAreaID(newZone); if(!zone) return; - if (sWorld.getConfig(CONFIG_WEATHER)) + if(m_zoneUpdateId != newZone) { - Weather *wth = sWorld.FindWeather(zone->ID); - if(wth) + SendInitWorldStates(newZone, newArea); // only if really enters to new zone, not just area change, works strange... + + if (sWorld.getConfig(CONFIG_WEATHER)) { - wth->SendWeatherUpdateToPlayer(this); - } - else - { - if(!sWorld.AddWeather(zone->ID)) + if(Weather *wth = sWorld.FindWeather(zone->ID)) + wth->SendWeatherUpdateToPlayer(this); + else if(!sWorld.AddWeather(zone->ID)) { // send fine weather packet to remove old zone's weather Weather::SendFineWeatherUpdateToPlayer(this); @@ -6247,6 +6237,12 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea) } } + m_zoneUpdateId = newZone; + m_zoneUpdateTimer = ZONE_UPDATE_INTERVAL; + + // zone changed, so area changed as well, update it + UpdateArea(newArea); + // in PvP, any not controlled zone (except zone->team == 6, default case) // in PvE, only opposition team capital switch(zone->team) diff --git a/src/game/Weather.cpp b/src/game/Weather.cpp index 5065761fd..64e3ff979 100644 --- a/src/game/Weather.cpp +++ b/src/game/Weather.cpp @@ -186,7 +186,7 @@ bool Weather::ReGenerate() void Weather::SendWeatherUpdateToPlayer(Player *player) { - WorldPacket data( SMSG_WEATHER, (4+4+4) ); + WorldPacket data( SMSG_WEATHER, (4+4+1) ); data << uint32(GetWeatherState()) << (float)m_grade << uint8(0); player->GetSession()->SendPacket( &data ); @@ -194,7 +194,7 @@ void Weather::SendWeatherUpdateToPlayer(Player *player) void Weather::SendFineWeatherUpdateToPlayer(Player *player) { - WorldPacket data( SMSG_WEATHER, (4+4+4) ); + WorldPacket data( SMSG_WEATHER, (4+4+1) ); data << (uint32)WEATHER_STATE_FINE << (float)0.0f << uint8(0); player->GetSession()->SendPacket( &data ); @@ -215,7 +215,7 @@ bool Weather::UpdateWeather() WeatherState state = GetWeatherState(); - WorldPacket data( SMSG_WEATHER, (4+4+4) ); + WorldPacket data( SMSG_WEATHER, (4+4+1) ); data << uint32(state) << (float)m_grade << uint8(0); player->SendMessageToSet( &data, true ); diff --git a/src/game/World.cpp b/src/game/World.cpp index 36452d110..9889941c9 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -323,6 +323,15 @@ bool World::RemoveQueuedPlayer(WorldSession* sess) WorldSession* pop_sess = m_QueuedPlayer.front(); pop_sess->SetInQueue(false); pop_sess->SendAuthWaitQue(0); + pop_sess->SendAddonsInfo(); + + WorldPacket pkt(SMSG_CLIENTCACHE_VERSION, 4); + pkt << uint32(sWorld.getConfig(CONFIG_CLIENTCACHE_VERSION)); + pop_sess->SendPacket(&pkt); + + pop_sess->SendAccountDataTimes(GLOBAL_CACHE_MASK); + pop_sess->SendTutorialsData(); + m_QueuedPlayer.pop_front(); // update iter to point first queued socket or end() if queue is empty now From 98b0bc50800e43a7429baab25d87866864ac280b Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sat, 29 Aug 2009 01:30:44 +0400 Subject: [PATCH 080/132] Updated cast failed results enum. --- src/game/SharedDefines.h | 373 ++++++++++++++++++++------------------- 1 file changed, 187 insertions(+), 186 deletions(-) diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index a8638378f..db393bcb8 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -700,192 +700,193 @@ enum SpellEffects enum SpellCastResult { - SPELL_FAILED_AFFECTING_COMBAT = 0x00, - SPELL_FAILED_ALREADY_AT_FULL_HEALTH = 0x01, - SPELL_FAILED_ALREADY_AT_FULL_MANA = 0x02, - SPELL_FAILED_ALREADY_AT_FULL_POWER = 0x03, - SPELL_FAILED_ALREADY_BEING_TAMED = 0x04, - SPELL_FAILED_ALREADY_HAVE_CHARM = 0x05, - SPELL_FAILED_ALREADY_HAVE_SUMMON = 0x06, - SPELL_FAILED_ALREADY_OPEN = 0x07, - SPELL_FAILED_AURA_BOUNCED = 0x08, - SPELL_FAILED_AUTOTRACK_INTERRUPTED = 0x09, - SPELL_FAILED_BAD_IMPLICIT_TARGETS = 0x0A, - SPELL_FAILED_BAD_TARGETS = 0x0B, - SPELL_FAILED_CANT_BE_CHARMED = 0x0C, - SPELL_FAILED_CANT_BE_DISENCHANTED = 0x0D, - SPELL_FAILED_CANT_BE_DISENCHANTED_SKILL = 0x0E, - SPELL_FAILED_CANT_BE_MILLED = 0x0F, - SPELL_FAILED_CANT_BE_PROSPECTED = 0x10, - SPELL_FAILED_CANT_CAST_ON_TAPPED = 0x11, - SPELL_FAILED_CANT_DUEL_WHILE_INVISIBLE = 0x12, - SPELL_FAILED_CANT_DUEL_WHILE_STEALTHED = 0x13, - SPELL_FAILED_CANT_STEALTH = 0x14, - SPELL_FAILED_CASTER_AURASTATE = 0x15, - SPELL_FAILED_CASTER_DEAD = 0x16, - SPELL_FAILED_CHARMED = 0x17, - SPELL_FAILED_CHEST_IN_USE = 0x18, - SPELL_FAILED_CONFUSED = 0x19, - SPELL_FAILED_DONT_REPORT = 0x1A, - SPELL_FAILED_EQUIPPED_ITEM = 0x1B, - SPELL_FAILED_EQUIPPED_ITEM_CLASS = 0x1C, - SPELL_FAILED_EQUIPPED_ITEM_CLASS_MAINHAND = 0x1D, - SPELL_FAILED_EQUIPPED_ITEM_CLASS_OFFHAND = 0x1E, - SPELL_FAILED_ERROR = 0x1F, - SPELL_FAILED_FIZZLE = 0x20, - SPELL_FAILED_FLEEING = 0x21, - SPELL_FAILED_FOOD_LOWLEVEL = 0x22, - SPELL_FAILED_HIGHLEVEL = 0x23, - SPELL_FAILED_HUNGER_SATIATED = 0x24, - SPELL_FAILED_IMMUNE = 0x25, - SPELL_FAILED_INCORRECT_AREA = 0x26, - SPELL_FAILED_INTERRUPTED = 0x27, - SPELL_FAILED_INTERRUPTED_COMBAT = 0x28, - SPELL_FAILED_ITEM_ALREADY_ENCHANTED = 0x29, - SPELL_FAILED_ITEM_GONE = 0x2A, - SPELL_FAILED_ITEM_NOT_FOUND = 0x2B, - SPELL_FAILED_ITEM_NOT_READY = 0x2C, - SPELL_FAILED_LEVEL_REQUIREMENT = 0x2D, - SPELL_FAILED_LINE_OF_SIGHT = 0x2E, - SPELL_FAILED_LOWLEVEL = 0x2F, - SPELL_FAILED_LOW_CASTLEVEL = 0x30, - SPELL_FAILED_MAINHAND_EMPTY = 0x31, - SPELL_FAILED_MOVING = 0x32, - SPELL_FAILED_NEED_AMMO = 0x33, - SPELL_FAILED_NEED_AMMO_POUCH = 0x34, - SPELL_FAILED_NEED_EXOTIC_AMMO = 0x35, - SPELL_FAILED_NEED_MORE_ITEMS = 0x36, - SPELL_FAILED_NOPATH = 0x37, - SPELL_FAILED_NOT_BEHIND = 0x38, - SPELL_FAILED_NOT_FISHABLE = 0x39, - SPELL_FAILED_NOT_FLYING = 0x3A, - SPELL_FAILED_NOT_HERE = 0x3B, - SPELL_FAILED_NOT_INFRONT = 0x3C, - SPELL_FAILED_NOT_IN_CONTROL = 0x3D, - SPELL_FAILED_NOT_KNOWN = 0x3E, - SPELL_FAILED_NOT_MOUNTED = 0x3F, - SPELL_FAILED_NOT_ON_TAXI = 0x40, - SPELL_FAILED_NOT_ON_TRANSPORT = 0x41, - SPELL_FAILED_NOT_READY = 0x42, - SPELL_FAILED_NOT_SHAPESHIFT = 0x43, - SPELL_FAILED_NOT_STANDING = 0x44, - SPELL_FAILED_NOT_TRADEABLE = 0x45, - SPELL_FAILED_NOT_TRADING = 0x46, - SPELL_FAILED_NOT_UNSHEATHED = 0x47, - SPELL_FAILED_NOT_WHILE_GHOST = 0x48, - SPELL_FAILED_NOT_WHILE_LOOTING = 0x49, - SPELL_FAILED_NO_AMMO = 0x4A, - SPELL_FAILED_NO_CHARGES_REMAIN = 0x4B, - SPELL_FAILED_NO_CHAMPION = 0x4C, - SPELL_FAILED_NO_COMBO_POINTS = 0x4D, - SPELL_FAILED_NO_DUELING = 0x4E, - SPELL_FAILED_NO_ENDURANCE = 0x4F, - SPELL_FAILED_NO_FISH = 0x50, - SPELL_FAILED_NO_ITEMS_WHILE_SHAPESHIFTED = 0x51, - SPELL_FAILED_NO_MOUNTS_ALLOWED = 0x52, - SPELL_FAILED_NO_PET = 0x53, - SPELL_FAILED_NO_POWER = 0x54, - SPELL_FAILED_NOTHING_TO_DISPEL = 0x55, - SPELL_FAILED_NOTHING_TO_STEAL = 0x56, - SPELL_FAILED_ONLY_ABOVEWATER = 0x57, - SPELL_FAILED_ONLY_DAYTIME = 0x58, - SPELL_FAILED_ONLY_INDOORS = 0x59, - SPELL_FAILED_ONLY_MOUNTED = 0x5A, - SPELL_FAILED_ONLY_NIGHTTIME = 0x5B, - SPELL_FAILED_ONLY_OUTDOORS = 0x5C, - SPELL_FAILED_ONLY_SHAPESHIFT = 0x5D, - SPELL_FAILED_ONLY_STEALTHED = 0x5E, - SPELL_FAILED_ONLY_UNDERWATER = 0x5F, - SPELL_FAILED_OUT_OF_RANGE = 0x60, - SPELL_FAILED_PACIFIED = 0x61, - SPELL_FAILED_POSSESSED = 0x62, - SPELL_FAILED_REAGENTS = 0x63, - SPELL_FAILED_REQUIRES_AREA = 0x64, - SPELL_FAILED_REQUIRES_SPELL_FOCUS = 0x65, - SPELL_FAILED_ROOTED = 0x66, - SPELL_FAILED_SILENCED = 0x67, - SPELL_FAILED_SPELL_IN_PROGRESS = 0x68, - SPELL_FAILED_SPELL_LEARNED = 0x69, - SPELL_FAILED_SPELL_UNAVAILABLE = 0x6A, - SPELL_FAILED_STUNNED = 0x6B, - SPELL_FAILED_TARGETS_DEAD = 0x6C, - SPELL_FAILED_TARGET_AFFECTING_COMBAT = 0x6D, - SPELL_FAILED_TARGET_AURASTATE = 0x6E, - SPELL_FAILED_TARGET_DUELING = 0x6F, - SPELL_FAILED_TARGET_ENEMY = 0x70, - SPELL_FAILED_TARGET_ENRAGED = 0x71, - SPELL_FAILED_TARGET_FRIENDLY = 0x72, - SPELL_FAILED_TARGET_IN_COMBAT = 0x73, - SPELL_FAILED_TARGET_IS_PLAYER = 0x74, - SPELL_FAILED_TARGET_IS_PLAYER_CONTROLLED = 0x75, - SPELL_FAILED_TARGET_NOT_DEAD = 0x76, - SPELL_FAILED_TARGET_NOT_IN_PARTY = 0x77, - SPELL_FAILED_TARGET_NOT_LOOTED = 0x78, - SPELL_FAILED_TARGET_NOT_PLAYER = 0x79, - SPELL_FAILED_TARGET_NO_POCKETS = 0x7A, - SPELL_FAILED_TARGET_NO_WEAPONS = 0x7B, - SPELL_FAILED_TARGET_NO_RANGED_WEAPONS = 0x7C, - SPELL_FAILED_TARGET_UNSKINNABLE = 0x7D, - SPELL_FAILED_THIRST_SATIATED = 0x7E, - SPELL_FAILED_TOO_CLOSE = 0x7F, - SPELL_FAILED_TOO_MANY_OF_ITEM = 0x80, - SPELL_FAILED_TOTEM_CATEGORY = 0x81, - SPELL_FAILED_TOTEMS = 0x82, - SPELL_FAILED_TRY_AGAIN = 0x83, - SPELL_FAILED_UNIT_NOT_BEHIND = 0x84, - SPELL_FAILED_UNIT_NOT_INFRONT = 0x85, - SPELL_FAILED_WRONG_PET_FOOD = 0x86, - SPELL_FAILED_NOT_WHILE_FATIGUED = 0x87, - SPELL_FAILED_TARGET_NOT_IN_INSTANCE = 0x88, - SPELL_FAILED_NOT_WHILE_TRADING = 0x89, - SPELL_FAILED_TARGET_NOT_IN_RAID = 0x8A, - SPELL_FAILED_TARGET_FREEFORALL = 0x8B, - SPELL_FAILED_NO_EDIBLE_CORPSES = 0x8C, - SPELL_FAILED_ONLY_BATTLEGROUNDS = 0x8D, - SPELL_FAILED_TARGET_NOT_GHOST = 0x8E, - SPELL_FAILED_TRANSFORM_UNUSABLE = 0x8F, - SPELL_FAILED_WRONG_WEATHER = 0x90, - SPELL_FAILED_DAMAGE_IMMUNE = 0x91, - SPELL_FAILED_PREVENTED_BY_MECHANIC = 0x92, - SPELL_FAILED_PLAY_TIME = 0x93, - SPELL_FAILED_REPUTATION = 0x94, - SPELL_FAILED_MIN_SKILL = 0x95, - SPELL_FAILED_NOT_IN_ARENA = 0x96, - SPELL_FAILED_NOT_ON_SHAPESHIFT = 0x97, - SPELL_FAILED_NOT_ON_STEALTHED = 0x98, - SPELL_FAILED_NOT_ON_DAMAGE_IMMUNE = 0x99, - SPELL_FAILED_NOT_ON_MOUNTED = 0x9A, - SPELL_FAILED_TOO_SHALLOW = 0x9B, - SPELL_FAILED_TARGET_NOT_IN_SANCTUARY = 0x9C, - SPELL_FAILED_TARGET_IS_TRIVIAL = 0x9D, - SPELL_FAILED_BM_OR_INVISGOD = 0x9E, - SPELL_FAILED_EXPERT_RIDING_REQUIREMENT = 0x9F, - SPELL_FAILED_ARTISAN_RIDING_REQUIREMENT = 0xA0, - SPELL_FAILED_NOT_IDLE = 0xA1, - SPELL_FAILED_NOT_INACTIVE = 0xA2, - SPELL_FAILED_PARTIAL_PLAYTIME = 0xA3, - SPELL_FAILED_NO_PLAYTIME = 0xA4, - SPELL_FAILED_NOT_IN_BATTLEGROUND = 0xA5, - SPELL_FAILED_NOT_IN_RAID_INSTANCE = 0xA6, - SPELL_FAILED_ONLY_IN_ARENA = 0xA7, - SPELL_FAILED_TARGET_LOCKED_TO_RAID_INSTANCE = 0xA8, - SPELL_FAILED_ON_USE_ENCHANT = 0xA9, - SPELL_FAILED_NOT_ON_GROUND = 0xAA, - SPELL_FAILED_CUSTOM_ERROR = 0xAB, - SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW = 0xAC, - SPELL_FAILED_TOO_MANY_SOCKETS = 0xAD, - SPELL_FAILED_INVALID_GLYPH = 0xAE, - SPELL_FAILED_UNIQUE_GLYPH = 0xAF, - SPELL_FAILED_GLYPH_SOCKET_LOCKED = 0xB0, - SPELL_FAILED_NO_VALID_TARGETS = 0xB1, - SPELL_FAILED_ITEM_AT_MAX_CHARGES = 0xB2, - SPELL_FAILED_NOT_IN_BARBERSHOP = 0xB3, - SPELL_FAILED_FISHING_TOO_LOW = 0xB4, - SPELL_FAILED_ITEM_ENCHANT_TRADE_WINDOW = 0xB5, - SPELL_FAILED_SUMMON_PENDING = 0xB6, - SPELL_FAILED_MAX_SOCKETS = 0xB7, - SPELL_FAILED_PET_CAN_RENAME = 0xB8, - SPELL_FAILED_UNKNOWN = 0xB9, + SPELL_FAILED_SUCCESS = 0x00, + SPELL_FAILED_AFFECTING_COMBAT = 0x01, + SPELL_FAILED_ALREADY_AT_FULL_HEALTH = 0x02, + SPELL_FAILED_ALREADY_AT_FULL_MANA = 0x03, + SPELL_FAILED_ALREADY_AT_FULL_POWER = 0x04, + SPELL_FAILED_ALREADY_BEING_TAMED = 0x05, + SPELL_FAILED_ALREADY_HAVE_CHARM = 0x06, + SPELL_FAILED_ALREADY_HAVE_SUMMON = 0x07, + SPELL_FAILED_ALREADY_OPEN = 0x08, + SPELL_FAILED_AURA_BOUNCED = 0x09, + SPELL_FAILED_AUTOTRACK_INTERRUPTED = 0x0A, + SPELL_FAILED_BAD_IMPLICIT_TARGETS = 0x0B, + SPELL_FAILED_BAD_TARGETS = 0x0C, + SPELL_FAILED_CANT_BE_CHARMED = 0x0D, + SPELL_FAILED_CANT_BE_DISENCHANTED = 0x0E, + SPELL_FAILED_CANT_BE_DISENCHANTED_SKILL = 0x0F, + SPELL_FAILED_CANT_BE_MILLED = 0x10, + SPELL_FAILED_CANT_BE_PROSPECTED = 0x11, + SPELL_FAILED_CANT_CAST_ON_TAPPED = 0x12, + SPELL_FAILED_CANT_DUEL_WHILE_INVISIBLE = 0x13, + SPELL_FAILED_CANT_DUEL_WHILE_STEALTHED = 0x14, + SPELL_FAILED_CANT_STEALTH = 0x15, + SPELL_FAILED_CASTER_AURASTATE = 0x16, + SPELL_FAILED_CASTER_DEAD = 0x17, + SPELL_FAILED_CHARMED = 0x18, + SPELL_FAILED_CHEST_IN_USE = 0x19, + SPELL_FAILED_CONFUSED = 0x1A, + SPELL_FAILED_DONT_REPORT = 0x1B, + SPELL_FAILED_EQUIPPED_ITEM = 0x1C, + SPELL_FAILED_EQUIPPED_ITEM_CLASS = 0x1D, + SPELL_FAILED_EQUIPPED_ITEM_CLASS_MAINHAND = 0x1E, + SPELL_FAILED_EQUIPPED_ITEM_CLASS_OFFHAND = 0x1F, + SPELL_FAILED_ERROR = 0x20, + SPELL_FAILED_FIZZLE = 0x21, + SPELL_FAILED_FLEEING = 0x22, + SPELL_FAILED_FOOD_LOWLEVEL = 0x23, + SPELL_FAILED_HIGHLEVEL = 0x24, + SPELL_FAILED_HUNGER_SATIATED = 0x25, + SPELL_FAILED_IMMUNE = 0x26, + SPELL_FAILED_INCORRECT_AREA = 0x27, + SPELL_FAILED_INTERRUPTED = 0x28, + SPELL_FAILED_INTERRUPTED_COMBAT = 0x29, + SPELL_FAILED_ITEM_ALREADY_ENCHANTED = 0x2A, + SPELL_FAILED_ITEM_GONE = 0x2B, + SPELL_FAILED_ITEM_NOT_FOUND = 0x2C, + SPELL_FAILED_ITEM_NOT_READY = 0x2D, + SPELL_FAILED_LEVEL_REQUIREMENT = 0x2E, + SPELL_FAILED_LINE_OF_SIGHT = 0x2F, + SPELL_FAILED_LOWLEVEL = 0x30, + SPELL_FAILED_LOW_CASTLEVEL = 0x31, + SPELL_FAILED_MAINHAND_EMPTY = 0x32, + SPELL_FAILED_MOVING = 0x33, + SPELL_FAILED_NEED_AMMO = 0x34, + SPELL_FAILED_NEED_AMMO_POUCH = 0x35, + SPELL_FAILED_NEED_EXOTIC_AMMO = 0x36, + SPELL_FAILED_NEED_MORE_ITEMS = 0x37, + SPELL_FAILED_NOPATH = 0x38, + SPELL_FAILED_NOT_BEHIND = 0x39, + SPELL_FAILED_NOT_FISHABLE = 0x3A, + SPELL_FAILED_NOT_FLYING = 0x3B, + SPELL_FAILED_NOT_HERE = 0x3C, + SPELL_FAILED_NOT_INFRONT = 0x3D, + SPELL_FAILED_NOT_IN_CONTROL = 0x3E, + SPELL_FAILED_NOT_KNOWN = 0x3F, + SPELL_FAILED_NOT_MOUNTED = 0x40, + SPELL_FAILED_NOT_ON_TAXI = 0x41, + SPELL_FAILED_NOT_ON_TRANSPORT = 0x42, + SPELL_FAILED_NOT_READY = 0x43, + SPELL_FAILED_NOT_SHAPESHIFT = 0x44, + SPELL_FAILED_NOT_STANDING = 0x45, + SPELL_FAILED_NOT_TRADEABLE = 0x46, + SPELL_FAILED_NOT_TRADING = 0x47, + SPELL_FAILED_NOT_UNSHEATHED = 0x48, + SPELL_FAILED_NOT_WHILE_GHOST = 0x49, + SPELL_FAILED_NOT_WHILE_LOOTING = 0x4A, + SPELL_FAILED_NO_AMMO = 0x4B, + SPELL_FAILED_NO_CHARGES_REMAIN = 0x4C, + SPELL_FAILED_NO_CHAMPION = 0x4D, + SPELL_FAILED_NO_COMBO_POINTS = 0x4E, + SPELL_FAILED_NO_DUELING = 0x4F, + SPELL_FAILED_NO_ENDURANCE = 0x50, + SPELL_FAILED_NO_FISH = 0x51, + SPELL_FAILED_NO_ITEMS_WHILE_SHAPESHIFTED = 0x52, + SPELL_FAILED_NO_MOUNTS_ALLOWED = 0x53, + SPELL_FAILED_NO_PET = 0x54, + SPELL_FAILED_NO_POWER = 0x55, + SPELL_FAILED_NOTHING_TO_DISPEL = 0x56, + SPELL_FAILED_NOTHING_TO_STEAL = 0x57, + SPELL_FAILED_ONLY_ABOVEWATER = 0x58, + SPELL_FAILED_ONLY_DAYTIME = 0x59, + SPELL_FAILED_ONLY_INDOORS = 0x5A, + SPELL_FAILED_ONLY_MOUNTED = 0x5B, + SPELL_FAILED_ONLY_NIGHTTIME = 0x5C, + SPELL_FAILED_ONLY_OUTDOORS = 0x5D, + SPELL_FAILED_ONLY_SHAPESHIFT = 0x5E, + SPELL_FAILED_ONLY_STEALTHED = 0x5F, + SPELL_FAILED_ONLY_UNDERWATER = 0x60, + SPELL_FAILED_OUT_OF_RANGE = 0x61, + SPELL_FAILED_PACIFIED = 0x62, + SPELL_FAILED_POSSESSED = 0x63, + SPELL_FAILED_REAGENTS = 0x64, + SPELL_FAILED_REQUIRES_AREA = 0x65, + SPELL_FAILED_REQUIRES_SPELL_FOCUS = 0x66, + SPELL_FAILED_ROOTED = 0x67, + SPELL_FAILED_SILENCED = 0x68, + SPELL_FAILED_SPELL_IN_PROGRESS = 0x69, + SPELL_FAILED_SPELL_LEARNED = 0x6A, + SPELL_FAILED_SPELL_UNAVAILABLE = 0x6B, + SPELL_FAILED_STUNNED = 0x6C, + SPELL_FAILED_TARGETS_DEAD = 0x6D, + SPELL_FAILED_TARGET_AFFECTING_COMBAT = 0x6E, + SPELL_FAILED_TARGET_AURASTATE = 0x6F, + SPELL_FAILED_TARGET_DUELING = 0x70, + SPELL_FAILED_TARGET_ENEMY = 0x71, + SPELL_FAILED_TARGET_ENRAGED = 0x72, + SPELL_FAILED_TARGET_FRIENDLY = 0x73, + SPELL_FAILED_TARGET_IN_COMBAT = 0x74, + SPELL_FAILED_TARGET_IS_PLAYER = 0x75, + SPELL_FAILED_TARGET_IS_PLAYER_CONTROLLED = 0x76, + SPELL_FAILED_TARGET_NOT_DEAD = 0x77, + SPELL_FAILED_TARGET_NOT_IN_PARTY = 0x78, + SPELL_FAILED_TARGET_NOT_LOOTED = 0x79, + SPELL_FAILED_TARGET_NOT_PLAYER = 0x7A, + SPELL_FAILED_TARGET_NO_POCKETS = 0x7B, + SPELL_FAILED_TARGET_NO_WEAPONS = 0x7C, + SPELL_FAILED_TARGET_NO_RANGED_WEAPONS = 0x7D, + SPELL_FAILED_TARGET_UNSKINNABLE = 0x7E, + SPELL_FAILED_THIRST_SATIATED = 0x7F, + SPELL_FAILED_TOO_CLOSE = 0x80, + SPELL_FAILED_TOO_MANY_OF_ITEM = 0x81, + SPELL_FAILED_TOTEM_CATEGORY = 0x82, + SPELL_FAILED_TOTEMS = 0x83, + SPELL_FAILED_TRY_AGAIN = 0x84, + SPELL_FAILED_UNIT_NOT_BEHIND = 0x85, + SPELL_FAILED_UNIT_NOT_INFRONT = 0x86, + SPELL_FAILED_WRONG_PET_FOOD = 0x87, + SPELL_FAILED_NOT_WHILE_FATIGUED = 0x88, + SPELL_FAILED_TARGET_NOT_IN_INSTANCE = 0x89, + SPELL_FAILED_NOT_WHILE_TRADING = 0x8A, + SPELL_FAILED_TARGET_NOT_IN_RAID = 0x8B, + SPELL_FAILED_TARGET_FREEFORALL = 0x8C, + SPELL_FAILED_NO_EDIBLE_CORPSES = 0x8D, + SPELL_FAILED_ONLY_BATTLEGROUNDS = 0x8E, + SPELL_FAILED_TARGET_NOT_GHOST = 0x8F, + SPELL_FAILED_TRANSFORM_UNUSABLE = 0x90, + SPELL_FAILED_WRONG_WEATHER = 0x91, + SPELL_FAILED_DAMAGE_IMMUNE = 0x92, + SPELL_FAILED_PREVENTED_BY_MECHANIC = 0x93, + SPELL_FAILED_PLAY_TIME = 0x94, + SPELL_FAILED_REPUTATION = 0x95, + SPELL_FAILED_MIN_SKILL = 0x96, + SPELL_FAILED_NOT_IN_ARENA = 0x97, + SPELL_FAILED_NOT_ON_SHAPESHIFT = 0x98, + SPELL_FAILED_NOT_ON_STEALTHED = 0x99, + SPELL_FAILED_NOT_ON_DAMAGE_IMMUNE = 0x9A, + SPELL_FAILED_NOT_ON_MOUNTED = 0x9B, + SPELL_FAILED_TOO_SHALLOW = 0x9C, + SPELL_FAILED_TARGET_NOT_IN_SANCTUARY = 0x9D, + SPELL_FAILED_TARGET_IS_TRIVIAL = 0x9E, + SPELL_FAILED_BM_OR_INVISGOD = 0x9F, + SPELL_FAILED_EXPERT_RIDING_REQUIREMENT = 0xA0, + SPELL_FAILED_ARTISAN_RIDING_REQUIREMENT = 0xA1, + SPELL_FAILED_NOT_IDLE = 0xA2, + SPELL_FAILED_NOT_INACTIVE = 0xA3, + SPELL_FAILED_PARTIAL_PLAYTIME = 0xA4, + SPELL_FAILED_NO_PLAYTIME = 0xA5, + SPELL_FAILED_NOT_IN_BATTLEGROUND = 0xA6, + SPELL_FAILED_NOT_IN_RAID_INSTANCE = 0xA7, + SPELL_FAILED_ONLY_IN_ARENA = 0xA8, + SPELL_FAILED_TARGET_LOCKED_TO_RAID_INSTANCE = 0xA9, + SPELL_FAILED_ON_USE_ENCHANT = 0xAA, + SPELL_FAILED_NOT_ON_GROUND = 0xAB, + SPELL_FAILED_CUSTOM_ERROR = 0xAC, + SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW = 0xAD, + SPELL_FAILED_TOO_MANY_SOCKETS = 0xAE, + SPELL_FAILED_INVALID_GLYPH = 0xAF, + SPELL_FAILED_UNIQUE_GLYPH = 0xB0, + SPELL_FAILED_GLYPH_SOCKET_LOCKED = 0xB1, + SPELL_FAILED_NO_VALID_TARGETS = 0xB2, + SPELL_FAILED_ITEM_AT_MAX_CHARGES = 0xB3, + SPELL_FAILED_NOT_IN_BARBERSHOP = 0xB4, + SPELL_FAILED_FISHING_TOO_LOW = 0xB5, + SPELL_FAILED_ITEM_ENCHANT_TRADE_WINDOW = 0xB6, + SPELL_FAILED_SUMMON_PENDING = 0xB7, + SPELL_FAILED_MAX_SOCKETS = 0xB8, + SPELL_FAILED_PET_CAN_RENAME = 0xB9, + SPELL_FAILED_UNKNOWN = 0xBA, SPELL_CAST_OK = 0xFF // custom value, don't must be send to client }; From 828c91a80814b4995e2a2a176a0d3d11aad0a6ff Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sat, 29 Aug 2009 02:45:37 +0400 Subject: [PATCH 081/132] More misc fixes. --- src/game/Opcodes.cpp | 8 ++++---- src/game/Opcodes.h | 10 +++++----- src/game/Player.cpp | 15 +++++++++++---- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp index 964c14dd7..3c4515730 100644 --- a/src/game/Opcodes.cpp +++ b/src/game/Opcodes.cpp @@ -345,7 +345,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x13C*/ { "SMSG_AI_REACTION", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x13D*/ { "CMSG_SET_SELECTION", STATUS_LOGGEDIN, &WorldSession::HandleSetSelectionOpcode }, /*0x13E*/ { "CMSG_EQUIPMENT_SET_DELETE", STATUS_LOGGEDIN, &WorldSession::HandleEquipmentSetDelete }, - /*0x13F*/ { "CMSG_INSTANCE_LOCK_RESPONSE", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x13F*/ { "CMSG_INSTANCE_LOCK_WARNING_RESPONSE", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x140*/ { "CMSG_UNUSED2", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x141*/ { "CMSG_ATTACKSWING", STATUS_LOGGEDIN, &WorldSession::HandleAttackSwingOpcode }, /*0x142*/ { "CMSG_ATTACKSTOP", STATUS_LOGGEDIN, &WorldSession::HandleAttackStopOpcode }, @@ -353,7 +353,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x144*/ { "SMSG_ATTACKSTOP", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x145*/ { "SMSG_ATTACKSWING_NOTINRANGE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x146*/ { "SMSG_ATTACKSWING_BADFACING", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x147*/ { "SMSG_ATTACKSWING_NOTSTANDING", STATUS_NEVER, &WorldSession::Handle_ServerSide }, + /*0x147*/ { "SMSG_INSTANCE_LOCK_WARNING_QUERY", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x148*/ { "SMSG_ATTACKSWING_DEADTARGET", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x149*/ { "SMSG_ATTACKSWING_CANT_ATTACK", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x14A*/ { "SMSG_ATTACKERSTATEUPDATE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, @@ -684,7 +684,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x28F*/ { "CMSG_GROUP_ASSISTANT_LEADER", STATUS_LOGGEDIN, &WorldSession::HandleGroupAssistantLeaderOpcode}, /*0x290*/ { "CMSG_BUYBACK_ITEM", STATUS_LOGGEDIN, &WorldSession::HandleBuybackItem }, /*0x291*/ { "SMSG_SERVER_MESSAGE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x292*/ { "CMSG_MEETINGSTONE_JOIN", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x292*/ { "CMSG_SET_SAVED_INSTANCE_EXTEND", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x293*/ { "SMSG_MEETINGSTONE_LEAVE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x294*/ { "CMSG_MEETINGSTONE_CHEAT", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x295*/ { "SMSG_MEETINGSTONE_SETQUEUE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, @@ -1067,7 +1067,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x40E*/ { "CMSG_REFER_A_FRIEND", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x40F*/ { "MSG_GM_CHANGE_ARENA_RATING", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x410*/ { "CMSG_DECLINE_CHANNEL_INVITE", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x411*/ { "CMSG_GROUPACTION_THROTTLED", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x411*/ { "SMSG_GROUPACTION_THROTTLED", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x412*/ { "SMSG_OVERRIDE_LIGHT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x413*/ { "SMSG_TOTEM_CREATED", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x414*/ { "CMSG_TOTEM_DESTROYED", STATUS_LOGGEDIN, &WorldSession::HandleTotemDestroyed }, diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h index fafccb09b..c5209162c 100644 --- a/src/game/Opcodes.h +++ b/src/game/Opcodes.h @@ -353,7 +353,7 @@ enum Opcodes SMSG_AI_REACTION = 0x13C, CMSG_SET_SELECTION = 0x13D, CMSG_EQUIPMENT_SET_DELETE = 0x13E, - CMSG_INSTANCE_LOCK_RESPONSE = 0x13F, + CMSG_INSTANCE_LOCK_WARNING_RESPONSE = 0x13F, CMSG_UNUSED2 = 0x140, CMSG_ATTACKSWING = 0x141, CMSG_ATTACKSTOP = 0x142, @@ -361,7 +361,7 @@ enum Opcodes SMSG_ATTACKSTOP = 0x144, SMSG_ATTACKSWING_NOTINRANGE = 0x145, SMSG_ATTACKSWING_BADFACING = 0x146, - SMSG_INSTANCE_LOCK_QUERY = 0x147, + SMSG_INSTANCE_LOCK_WARNING_QUERY = 0x147, SMSG_ATTACKSWING_DEADTARGET = 0x148, SMSG_ATTACKSWING_CANT_ATTACK = 0x149, SMSG_ATTACKERSTATEUPDATE = 0x14A, @@ -692,7 +692,7 @@ enum Opcodes CMSG_GROUP_ASSISTANT_LEADER = 0x28F, CMSG_BUYBACK_ITEM = 0x290, SMSG_SERVER_MESSAGE = 0x291, - CMSG_MEETINGSTONE_JOIN = 0x292, // lua: SetSavedInstanceExtend + CMSG_SET_SAVED_INSTANCE_EXTEND = 0x292, // lua: SetSavedInstanceExtend SMSG_MEETINGSTONE_LEAVE = 0x293, CMSG_MEETINGSTONE_CHEAT = 0x294, SMSG_MEETINGSTONE_SETQUEUE = 0x295, @@ -1075,7 +1075,7 @@ enum Opcodes CMSG_REFER_A_FRIEND = 0x40E, MSG_GM_CHANGE_ARENA_RATING = 0x40F, CMSG_DECLINE_CHANNEL_INVITE = 0x410, - CMSG_GROUPACTION_THROTTLED = 0x411, // SMSG? + SMSG_GROUPACTION_THROTTLED = 0x411, // SMSG? SMSG_OVERRIDE_LIGHT = 0x412, SMSG_TOTEM_CREATED = 0x413, CMSG_TOTEM_DESTROYED = 0x414, @@ -1306,7 +1306,7 @@ enum Opcodes UMSG_UNKNOWN_1269 = 0x4F5, // not found 3.2 CMSG_WORLD_STATE_UI_TIMER_UPDATE = 0x4F6, SMSG_WORLD_STATE_UI_TIMER_UPDATE = 0x4F7, - CMSG_UNKNOWN_1272 = 0x4F8, // called from lua: CreateCharacter, may be paid race change + CMSG_UNKNOWN_1272 = 0x4F8, // called from lua: CreateCharacter, paid race change NUM_MSG_TYPES = 0x4F9 }; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index e6cc2b162..c98998858 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -112,6 +112,14 @@ enum CharacterFlags CHARACTER_FLAG_UNK32 = 0x80000000 }; +enum CharacterCustomizeFlags +{ + CHAR_CUSTOMIZE_FLAG_NONE = 0x00000000, + CHAR_CUSTOMIZE_FLAG_CUSTOMIZE = 0x00000001, // name, gender, etc... + CHAR_CUSTOMIZE_FLAG_FACTION = 0x00010000, // name, gender, faction, etc... + CHAR_CUSTOMIZE_FLAG_RACE = 0x00100000 // name, gender, race, etc... +}; + // corpse reclaim times #define DEATH_EXPIRE_STEP (5*MINUTE) #define MAX_DEATH_COUNT 3 @@ -1445,7 +1453,7 @@ bool Player::BuildEnumData( QueryResult * result, WorldPacket * p_data ) *p_data << uint32(char_flags); // character flags // character customize flags - *p_data << uint32(atLoginFlags & AT_LOGIN_CUSTOMIZE ? 1 : 0);// 0x00010000 - faction change + *p_data << uint32(atLoginFlags & AT_LOGIN_CUSTOMIZE ? CHAR_CUSTOMIZE_FLAG_CUSTOMIZE : CHAR_CUSTOMIZE_FLAG_NONE); *p_data << uint8(1); // unknown // Pets info @@ -15363,10 +15371,9 @@ void Player::SendRaidInfo() data << uint32(save->GetMapId()); // map id data << uint32(save->GetDifficulty()); // difficulty data << uint64(save->GetInstanceId()); // instance id - data << uint8(0); - data << uint8(0); + data << uint8(1); // expired = 0 + data << uint8(0); // extended = 1 data << uint32(save->GetResetTime() - now); // reset time - //data << uint32(0); // is extended ++counter; } } From 37f8736fba26593860c5a4367558349ce285a63f Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sat, 29 Aug 2009 12:09:47 +0400 Subject: [PATCH 082/132] Merge fix. --- src/game/WorldSession.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index 7282828ea..0fbcf4d6d 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -644,16 +644,6 @@ void WorldSession::SetAccountData(AccountDataType type, time_t time_, std::strin m_accountData[type].Data = data; } -void WorldSession::SendAccountDataTimes() -{ - WorldPacket data( SMSG_ACCOUNT_DATA_TIMES, 4+1+8*4 ); // changed in WotLK - data << uint32(time(NULL)); // unix time of something - data << uint8(1); - for(int i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i) - data << uint32(m_accountData[i].Time); // also unix time - SendPacket(&data); -} - void WorldSession::SendAccountDataTimes(uint32 mask) { WorldPacket data( SMSG_ACCOUNT_DATA_TIMES, 4+1+4+8*4 ); // changed in WotLK @@ -943,4 +933,4 @@ void WorldSession::SetPlayer( Player *plr ) // set m_GUID that can be used while player loggined and later until m_playerRecentlyLogout not reset if(_player) m_GUIDLow = _player->GetGUIDLow(); -} \ No newline at end of file +} From c90ced473d7d26f51c130342e6429c774a890a8b Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sat, 29 Aug 2009 12:37:33 +0400 Subject: [PATCH 083/132] Compile/merge fix. --- src/game/WorldSession.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index 0fbcf4d6d..f5c370331 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -649,10 +649,10 @@ void WorldSession::SendAccountDataTimes(uint32 mask) WorldPacket data( SMSG_ACCOUNT_DATA_TIMES, 4+1+4+8*4 ); // changed in WotLK data << uint32(time(NULL)); // unix time of something data << uint8(1); - data << uint32(mask); + data << uint32(mask); // type mask for(int i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i) if(mask & (1 << i)) - data << uint32(GetAccountData(i)->Time); // also unix time + data << uint32(GetAccountData(AccountDataType(i))->Time);// also unix time SendPacket(&data); } From 77af8018e1ae0c0e8c70ba77465be698988bfd28 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sat, 29 Aug 2009 16:03:30 +0400 Subject: [PATCH 084/132] Fixed typo, account data saving should work now. --- src/game/CharacterHandler.cpp | 10 +++++----- src/game/Opcodes.cpp | 2 +- src/game/Player.cpp | 13 +++++++++++++ src/game/WorldSession.cpp | 4 ++-- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index 2b72a06a7..616907f01 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -622,11 +622,6 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder *holder) DEBUG_LOG( "WORLD: Sent motd (SMSG_MOTD)" ); } - data.Initialize(SMSG_LEARNED_DANCE_MOVES, 4+4); - data << uint32(0); - data << uint32(0); - SendPacket(&data); - //QueryResult *result = CharacterDatabase.PQuery("SELECT guildid,rank FROM guild_member WHERE guid = '%u'",pCurrChar->GetGUIDLow()); QueryResult *resultGuild = holder->GetResult(PLAYER_LOGIN_QUERY_LOADGUILD); @@ -674,6 +669,11 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder *holder) } } + data.Initialize(SMSG_LEARNED_DANCE_MOVES, 4+4); + data << uint32(0); + data << uint32(0); + SendPacket(&data); + if(!pCurrChar->isAlive()) pCurrChar->SendCorpseReclaimDelay(true); diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp index fc9b9963a..920effc51 100644 --- a/src/game/Opcodes.cpp +++ b/src/game/Opcodes.cpp @@ -549,7 +549,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x208*/ { "SMSG_GMTICKET_UPDATETEXT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x209*/ { "SMSG_ACCOUNT_DATA_TIMES", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x20A*/ { "CMSG_REQUEST_ACCOUNT_DATA", STATUS_AUTHED, &WorldSession::HandleRequestAccountData }, - /*0x20B*/ { "CMSG_UPDATE_ACCOUNT_DATA", STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT, &WorldSession::HandleUpdateAccountData}, + /*0x20B*/ { "CMSG_UPDATE_ACCOUNT_DATA", STATUS_AUTHED, &WorldSession::HandleUpdateAccountData}, /*0x20C*/ { "SMSG_UPDATE_ACCOUNT_DATA", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x20D*/ { "SMSG_CLEAR_FAR_SIGHT_IMMEDIATE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x20E*/ { "SMSG_POWERGAINLOG_OBSOLETE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 5719feb58..b7726d078 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -18150,6 +18150,8 @@ void Player::SendInitialPacketsBeforeAddToMap() { GetSocial()->SendSocialList(); + // guild bank list wtf? + // Homebind WorldPacket data(SMSG_BINDPOINTUPDATE, 5*4); data << m_homebindX << m_homebindY << m_homebindZ; @@ -18158,9 +18160,14 @@ void Player::SendInitialPacketsBeforeAddToMap() GetSession()->SendPacket(&data); // SMSG_SET_PROFICIENCY + // SMSG_SET_PCT_SPELL_MODIFIER + // SMSG_SET_FLAT_SPELL_MODIFIER // SMSG_UPDATE_AURA_DURATION SendTalentsInfoData(false); + + // SMSG_INSTANCE_DIFFICULTY + SendInitialSpells(); data.Initialize(SMSG_SEND_UNLEARN_SPELLS, 4); @@ -18169,6 +18176,7 @@ void Player::SendInitialPacketsBeforeAddToMap() SendInitialActionButtons(); m_reputationMgr.SendInitialReputations(); + // SMSG_INIT_WORLD_STATES m_achievementMgr.SendAllAchievementData(); SendEquipmentSetList(); @@ -18179,6 +18187,11 @@ void Player::SendInitialPacketsBeforeAddToMap() data << uint32(0); // added in 3.1.2 GetSession()->SendPacket( &data ); + // SMSG_TALENTS_INFO x 2 for pet (unspent points and talents in separate packets...) + // SMSG_PET_GUIDS + // SMSG_UPDATE_WORLD_STATE + // SMSG_POWER_UPDATE + // set fly flag if in fly form or taxi flight to prevent visually drop at ground in showup moment if(HasAuraType(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED) || HasAuraType(SPELL_AURA_FLY) || isInFlight()) m_movementInfo.AddMovementFlag(MOVEMENTFLAG_FLYING2); diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index f5c370331..eb3867a7c 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -582,7 +582,7 @@ void WorldSession::LoadGlobalAccountData() void WorldSession::LoadAccountData(QueryResult* result, uint32 mask) { for (uint32 i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i) - if(mask & (1 < i)) + if(mask & (1 << i)) m_accountData[i] = AccountData(); if(!result) @@ -650,7 +650,7 @@ void WorldSession::SendAccountDataTimes(uint32 mask) data << uint32(time(NULL)); // unix time of something data << uint8(1); data << uint32(mask); // type mask - for(int i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i) + for(uint i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i) if(mask & (1 << i)) data << uint32(GetAccountData(AccountDataType(i))->Time);// also unix time SendPacket(&data); From f98fa7b4df34327c7724022f42e297f7174297ae Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sat, 29 Aug 2009 16:13:02 +0400 Subject: [PATCH 085/132] Fixed one more typo, now it even compiles :P --- src/game/WorldSession.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index eb3867a7c..fb8bed039 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -650,7 +650,7 @@ void WorldSession::SendAccountDataTimes(uint32 mask) data << uint32(time(NULL)); // unix time of something data << uint8(1); data << uint32(mask); // type mask - for(uint i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i) + for(uint32 i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i) if(mask & (1 << i)) data << uint32(GetAccountData(AccountDataType(i))->Time);// also unix time SendPacket(&data); From d87911303e6c578b8f412344743dfaf4cb6a6904 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sun, 30 Aug 2009 19:41:21 +0400 Subject: [PATCH 086/132] Scaling stats fix. --- src/game/DBCStructure.h | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index 9e503fded..5aa2c435c 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -1171,10 +1171,11 @@ struct ScalingStatValuesEntry uint32 ssdMultiplier[4]; // 2-5 Multiplier for ScalingStatDistribution uint32 armorMod[4]; // 6-9 Armor for level uint32 dpsMod[6]; // 10-15 DPS mod for level - uint32 spellBonus; // 16 not sure.. TODO: need more info about - uint32 feralBonus; // 17 Feral AP bonus (there's data from 3.1 ssdMultiplier[3]) - //uint32 unk1; // 18 all zero's - //uint32 unk2[5]; // 19-23 3.2 new feral bonus? + uint32 spellBonus; // 16 spell power for level + uint32 ssdMultiplier2; // 17 there's data from 3.1 dbc ssdMultiplier[3] + //uint32 unk1; // 18 all fields equal to 0 + //uint32 unk2; // 19 unk, probably also Armor for level + uint32 armorMod2[4]; // 20-23 Armor for level uint32 getssdMultiplier(uint32 mask) const { @@ -1183,19 +1184,25 @@ struct ScalingStatValuesEntry if(mask & 0x00000001) return ssdMultiplier[0]; if(mask & 0x00000002) return ssdMultiplier[1]; if(mask & 0x00000004) return ssdMultiplier[2]; - if(mask & 0x00000008) return feralBonus; + if(mask & 0x00000008) return ssdMultiplier2; if(mask & 0x00000010) return ssdMultiplier[3]; } return 0; } + uint32 getArmorMod(uint32 mask) const { - if (mask & 0x01E0) + if (mask & 0x00F001E0) { if(mask & 0x00000020) return armorMod[0]; if(mask & 0x00000040) return armorMod[1]; if(mask & 0x00000080) return armorMod[2]; if(mask & 0x00000100) return armorMod[3]; + + if(mask & 0x00100000) return armorMod2[0]; // cloth + if(mask & 0x00200000) return armorMod2[1]; // leather + if(mask & 0x00400000) return armorMod2[2]; // mail + if(mask & 0x00800000) return armorMod2[3]; // plate } return 0; } @@ -1209,7 +1216,7 @@ struct ScalingStatValuesEntry if(mask & 0x00000800) return dpsMod[2]; if(mask & 0x00001000) return dpsMod[3]; if(mask & 0x00002000) return dpsMod[4]; - if(mask & 0x00004000) return dpsMod[5]; + if(mask & 0x00004000) return dpsMod[5]; // not used? } return 0; } @@ -1221,10 +1228,10 @@ struct ScalingStatValuesEntry return 0; } - uint32 getFeralBonus(uint32 mask) const + uint32 getFeralBonus(uint32 mask) const // removed in 3.2.x? { - if (mask & 0x00010000) - return feralBonus; + if (mask & 0x00010000) // not used? + return 0; return 0; } }; From 2a1e4949a2e80d4535c3feecbfd75e708f942816 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Fri, 4 Sep 2009 21:13:33 +0400 Subject: [PATCH 087/132] Updated to 10392 client build. --- src/game/DBCStructure.h | 2 +- src/game/UpdateFields.h | 2 +- src/realmd/AuthCodes.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index 5aa2c435c..61eef7b41 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -1422,7 +1422,7 @@ struct SpellEntry //uint32 spellMissileID; // 233 m_spellMissileID not used //uint32 PowerDisplayId; // 234 PowerDisplay.dbc, new in 3.1 //float unk_320_4[3]; // 235-237 3.2.0 - //uint32 spellDescriptionVariablesID; // 238 3.2.0 + //uint32 spellDescriptionVariableID; // 238 3.2.0 // helpers int32 CalculateSimpleValue(uint8 eff) const { return EffectBasePoints[eff]+int32(EffectBaseDice[eff]); } diff --git a/src/game/UpdateFields.h b/src/game/UpdateFields.h index 3bd985ab8..79ae0dc48 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, 2, 2, 10371 +// Auto generated for version 0, 2, 2, 10392 enum EObjectFields { diff --git a/src/realmd/AuthCodes.h b/src/realmd/AuthCodes.h index 6d84da2b5..667b929e3 100644 --- a/src/realmd/AuthCodes.h +++ b/src/realmd/AuthCodes.h @@ -66,9 +66,9 @@ enum LoginResult // 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.2.2 client build 10371... +// will only support WoW, WoW:TBC and WoW:WotLK 3.2.2 client build 10392... -#define EXPECTED_MANGOS_CLIENT_BUILD {10371, 0} +#define EXPECTED_MANGOS_CLIENT_BUILD {10392, 0} // At update excepted builds please update if need define DEFAULT_MAX_LEVEL // in DBCEnum.h to default max player level expected by build From b9f16d2faf47e54a8e88c127298d1c648df093f8 Mon Sep 17 00:00:00 2001 From: NeatElves Date: Thu, 10 Sep 2009 06:04:21 +0400 Subject: [PATCH 088/132] New flask added in 3.2.x. Signed-off-by: VladimirMangos --- sql/320/6_spell_elixir.sql | 5 +++++ sql/mangos.sql | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 sql/320/6_spell_elixir.sql diff --git a/sql/320/6_spell_elixir.sql b/sql/320/6_spell_elixir.sql new file mode 100644 index 000000000..96c63197c --- /dev/null +++ b/sql/320/6_spell_elixir.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_elixir` WHERE `entry`=67019; + +/* Flasks added in 3.2.x */ +INSERT INTO `spell_elixir` (`entry`, `mask`) VALUES +(67019,0x3); diff --git a/sql/mangos.sql b/sql/mangos.sql index 6a5a42f3a..f71c3775c 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -17027,7 +17027,9 @@ INSERT INTO `spell_elixir` VALUES (53758,0x3), (53760,0x3), (54212,0x3), -(62380,0x3); +(62380,0x3), +(67019,0x3); + /*!40000 ALTER TABLE `spell_elixir` ENABLE KEYS */; From 3b9875db8fefc5239784c2401f9b139ed3307ba1 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Thu, 10 Sep 2009 16:06:37 +0400 Subject: [PATCH 089/132] Updated to 10433 client build. --- src/game/UpdateFields.h | 2 +- src/realmd/AuthCodes.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game/UpdateFields.h b/src/game/UpdateFields.h index 79ae0dc48..57aaa322d 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, 2, 2, 10392 +// Auto generated for version 0, 2, 2, 10433 enum EObjectFields { diff --git a/src/realmd/AuthCodes.h b/src/realmd/AuthCodes.h index 667b929e3..d31769b7f 100644 --- a/src/realmd/AuthCodes.h +++ b/src/realmd/AuthCodes.h @@ -66,9 +66,9 @@ enum LoginResult // 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.2.2 client build 10392... +// will only support WoW, WoW:TBC and WoW:WotLK 3.2.2 client build 10433... -#define EXPECTED_MANGOS_CLIENT_BUILD {10392, 0} +#define EXPECTED_MANGOS_CLIENT_BUILD {10433, 0} // At update excepted builds please update if need define DEFAULT_MAX_LEVEL // in DBCEnum.h to default max player level expected by build From 19b069694d4f37401c963ef2b35e5275052071d8 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Mon, 14 Sep 2009 16:32:34 +0400 Subject: [PATCH 090/132] Added comment. --- src/game/DBCStructure.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index 01881b387..7f563e831 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -645,7 +645,7 @@ struct ChrRacesEntry uint32 TeamID; // 7 (7-Alliance 1-Horde) // 8-11 unused uint32 CinematicSequence; // 12 id from CinematicSequences.dbc - //uint32 unk_322; // 13 + //uint32 unk_322; // 13 faction (0 alliance, 1 horde, 2 not available?) char* name[16]; // 14-29 used for DBC language detection/selection // 30 string flags, unused //char* nameFemale[16]; // 31-46, if different from base (male) case From 2d86aa4535c63d2c1202c0f27ec9d0a381ad153d Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Mon, 14 Sep 2009 18:11:15 +0400 Subject: [PATCH 091/132] Misc fixes. --- src/game/ArenaTeam.cpp | 37 +++------------------------ src/game/BattleGround.cpp | 5 +--- src/game/Creature.cpp | 2 +- src/game/FleeingMovementGenerator.cpp | 2 +- src/game/ItemHandler.cpp | 3 +-- src/game/MiscHandler.cpp | 2 +- src/game/Object.cpp | 7 ++--- src/game/Player.cpp | 13 +++++++--- src/game/Player.h | 9 ++++--- src/game/QueryHandler.cpp | 2 +- src/game/Spell.cpp | 4 +-- src/game/SpellAuras.cpp | 14 +++++----- src/game/SpellEffects.cpp | 2 +- src/game/Unit.cpp | 17 ++++++------ src/game/Unit.h | 10 ++++++-- 15 files changed, 53 insertions(+), 76 deletions(-) diff --git a/src/game/ArenaTeam.cpp b/src/game/ArenaTeam.cpp index f3266de70..51302179a 100644 --- a/src/game/ArenaTeam.cpp +++ b/src/game/ArenaTeam.cpp @@ -99,7 +99,7 @@ bool ArenaTeam::AddMember(const uint64& PlayerGuid) return false; } - plClass = (uint8)pl->getClass(); + plClass = pl->getClass(); plName = pl->GetName(); } else @@ -150,7 +150,7 @@ bool ArenaTeam::AddMember(const uint64& PlayerGuid) if(pl) { - pl->SetInArenaTeam(m_TeamId, GetSlot()); + pl->SetInArenaTeam(m_TeamId, GetSlot(), GetType()); pl->SetArenaTeamIdInvited(0); pl->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING, newmember.personal_rating ); @@ -277,17 +277,12 @@ void ArenaTeam::DelMember(uint64 guid) } } - Player *player = objmgr.GetPlayer(guid); - - if(player) + if(Player *player = objmgr.GetPlayer(guid)) { - player->SetInArenaTeam(0, GetSlot()); player->GetSession()->SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, GetName(), "", 0); // delete all info regarding this team for(int i = 0; i < ARENA_TEAM_END; ++i) - { player->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + i, 0); - } } CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u' AND guid = '%u'", GetId(), GUID_LOPART(guid)); @@ -537,14 +532,12 @@ void ArenaTeam::FinishGame(int32 mod) if (i->second->GetType() == this->m_Type && i->second->GetStats().rating > m_stats.rating) ++m_stats.rank; } - - } int32 ArenaTeam::WonAgainst(uint32 againstRating) { // called when the team has won - //'chance' calculation - to beat the opponent + // 'chance' calculation - to beat the opponent float chance = GetChanceAgainst(m_stats.rating, againstRating); // calculate the rating modification (ELO system with k=32) int32 mod = (int32)floor(32.0f * (1.0f - chance)); @@ -704,25 +697,3 @@ bool ArenaTeam::IsFighting() const } return false; } - -/* -arenateam fields (id from 2.3.3 client): -1414 - arena team id 2v2 -1415 - 0=captain, 1=member -1416 - played this week -1417 - played this season -1418 - unk - rank? -1419 - personal arena rating -1420 - arena team id 3v3 -1421 - 0=captain, 1=member -1422 - played this week -1423 - played this season -1424 - unk - rank? -1425 - personal arena rating -1426 - arena team id 5v5 -1427 - 0=captain, 1=member -1428 - played this week -1429 - played this season -1430 - unk - rank? -1431 - personal arena rating -*/ diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index 0e9e8549c..4d6113fab 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -1590,12 +1590,9 @@ bool BattleGround::AddSpiritGuide(uint32 type, float x, float y, float z, float pCreature->setDeathState(DEAD); - pCreature->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, pCreature->GetGUID()); + pCreature->SetChannelObjectGUID(pCreature->GetGUID()); // aura pCreature->SetVisibleAura(0, SPELL_SPIRIT_HEAL_CHANNEL); - //pCreature->SetUInt32Value(UNIT_FIELD_AURAFLAGS, 0x00000009); - //pCreature->SetUInt32Value(UNIT_FIELD_AURALEVELS, 0x0000003C); - //pCreature->SetUInt32Value(UNIT_FIELD_AURAAPPLICATIONS, 0x000000FF); // casting visual effect pCreature->SetUInt32Value(UNIT_CHANNEL_SPELL, SPELL_SPIRIT_HEAL_CHANNEL); // correct cast speed diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index fbfdc8189..4f6825066 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -1511,7 +1511,7 @@ void Creature::setDeathState(DeathState s) if(s == JUST_DIED) { - SetUInt64Value(UNIT_FIELD_TARGET,0); // remove target selection in any cases (can be set at aura remove in Unit::setDeathState) + SetTargetGUID(0); // remove target selection in any cases (can be set at aura remove in Unit::setDeathState) SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); if(!isPet() && GetCreatureInfo()->SkinLootId) diff --git a/src/game/FleeingMovementGenerator.cpp b/src/game/FleeingMovementGenerator.cpp index a74790d9a..172934340 100644 --- a/src/game/FleeingMovementGenerator.cpp +++ b/src/game/FleeingMovementGenerator.cpp @@ -314,7 +314,7 @@ FleeingMovementGenerator::_Init(Creature &owner) return; owner.RemoveMonsterMoveFlag(MONSTER_MOVE_WALK); - owner.SetUInt64Value(UNIT_FIELD_TARGET, 0); + owner.SetTargetGUID(0); is_water_ok = owner.canSwim(); is_land_ok = owner.canWalk(); } diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp index a391e576a..77a841bdc 100644 --- a/src/game/ItemHandler.cpp +++ b/src/game/ItemHandler.cpp @@ -1340,7 +1340,6 @@ void WorldSession::HandleItemRefundInfoRequest(WorldPacket& recv_data) sLog.outDebug("WORLD: CMSG_ITEM_REFUND_INFO_REQUEST"); uint64 guid; - recv_data >> guid; // item guid Item *item = _player->GetItemByGuid(guid); @@ -1357,5 +1356,5 @@ void WorldSession::HandleItemRefundInfoRequest(WorldPacket& recv_data) return; } - // refund system not implemented yet + // item refund system not implemented yet } diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 056696ff3..5cccd4ea0 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -383,7 +383,7 @@ void WorldSession::HandleSetTargetOpcode( WorldPacket & recv_data ) uint64 guid ; recv_data >> guid; - _player->SetUInt32Value(UNIT_FIELD_TARGET, guid); + _player->SetTargetGUID(guid); // update reputation list if need Unit* unit = ObjectAccessor::GetUnit(*_player, guid ); diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 71b691fdd..54b8eec5c 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -177,7 +177,7 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) c if(isType(TYPEMASK_UNIT)) { - if(((Unit*)this)->getVictim()) + if(((Unit*)this)->GetTargetGUID()) flags |= UPDATEFLAG_HAS_TARGET; } } @@ -554,10 +554,7 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags, uint32 flags2 // 0x4 if(flags & UPDATEFLAG_HAS_TARGET) // packed guid (current target guid) { - if(Unit *victim = ((Unit*)this)->getVictim()) - data->append(victim->GetPackGUID()); - else - *data << uint8(0); + data->appendPackGUID(((Unit*)this)->GetTargetGUID()); } // 0x2 diff --git a/src/game/Player.cpp b/src/game/Player.cpp index e95f4ce25..80b306c44 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -1609,6 +1609,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati m_movementInfo.t_y = 0.0f; m_movementInfo.t_z = 0.0f; m_movementInfo.t_o = 0.0f; + m_movementInfo.t_seat = -1; m_movementInfo.t_time = 0; } @@ -13910,18 +13911,18 @@ void Player::_LoadArenaTeamInfo(QueryResult *result) ArenaTeam* aTeam = objmgr.GetArenaTeamById(arenateamid); if(!aTeam) { - sLog.outError("Player::_LoadArenaTeamInfo: couldn't load arenateam %u, week %u, season %u, rating %u", arenateamid, played_week, played_season, personal_rating); + sLog.outError("Player::_LoadArenaTeamInfo: couldn't load arenateam %u", arenateamid); continue; } uint8 arenaSlot = aTeam->GetSlot(); m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaSlot * ARENA_TEAM_END) + ARENA_TEAM_ID] = arenateamid; // TeamID + m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaSlot * ARENA_TEAM_END) + ARENA_TEAM_TYPE] = aTeam->GetType(); // team type m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaSlot * ARENA_TEAM_END) + ARENA_TEAM_MEMBER] = ((aTeam->GetCaptain() == GetGUID()) ? (uint32)0 : (uint32)1); // Captain 0, member 1 m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaSlot * ARENA_TEAM_END) + ARENA_TEAM_GAMES_WEEK] = played_week; // Played Week m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaSlot * ARENA_TEAM_END) + ARENA_TEAM_GAMES_SEASON] = played_season; // Played Season m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaSlot * ARENA_TEAM_END) + ARENA_TEAM_WINS_SEASON] = wons_season; // wins season m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaSlot * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING] = personal_rating; // Personal Rating - m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaSlot * ARENA_TEAM_END) + ARENA_TEAM_UNK2] = 0; // unk 3.2 } while (result->NextRow()); delete result; @@ -14194,6 +14195,8 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) m_movementInfo.t_y = 0.0f; m_movementInfo.t_z = 0.0f; m_movementInfo.t_o = 0.0f; + m_movementInfo.t_time = 0; + m_movementInfo.t_seat = -1; } _LoadBGData(holder->GetResult(PLAYER_LOGIN_QUERY_LOADBGDATA)); @@ -14261,6 +14264,8 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) m_movementInfo.t_y = 0.0f; m_movementInfo.t_z = 0.0f; m_movementInfo.t_o = 0.0f; + m_movementInfo.t_time = 0; + m_movementInfo.t_seat = -1; transGUID = 0; } @@ -14298,6 +14303,8 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) m_movementInfo.t_y = 0.0f; m_movementInfo.t_z = 0.0f; m_movementInfo.t_o = 0.0f; + m_movementInfo.t_time = 0; + m_movementInfo.t_seat = -1; transGUID = 0; } @@ -14400,7 +14407,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) delete result; // clear channel spell data (if saved at channel spell casting) - SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, 0); + SetChannelObjectGUID(0); SetUInt32Value(UNIT_CHANNEL_SPELL,0); // clear charm/summon related fields diff --git a/src/game/Player.h b/src/game/Player.h index b2ac48876..d780e4691 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -719,7 +719,7 @@ enum InstanceResetWarningType enum ArenaTeamInfoType { ARENA_TEAM_ID = 0, - ARENA_TEAM_UNK2 = 1, // new in 3.2 - team type? + ARENA_TEAM_TYPE = 1, // new in 3.2 - team type? ARENA_TEAM_MEMBER = 2, // 0 - captain, 1 - member ARENA_TEAM_GAMES_WEEK = 3, ARENA_TEAM_GAMES_SEASON = 4, @@ -1443,7 +1443,7 @@ class MANGOS_DLL_SPEC Player : public Unit QuestStatusMap& getQuestStatusMap() { return mQuestStatus; }; const uint64& GetSelection( ) const { return m_curSelection; } - void SetSelection(const uint64 &guid) { m_curSelection = guid; SetUInt64Value(UNIT_FIELD_TARGET, guid); } + void SetSelection(const uint64 &guid) { m_curSelection = guid; SetTargetGUID(guid); } uint8 GetComboPoints() { return m_comboPoints; } const uint64& GetComboTarget() const { return m_comboTarget; } @@ -1659,9 +1659,10 @@ class MANGOS_DLL_SPEC Player : public Unit static void RemovePetitionsAndSigns(uint64 guid, uint32 type); // Arena Team - void SetInArenaTeam(uint32 ArenaTeamId, uint8 slot) + void SetInArenaTeam(uint32 ArenaTeamId, uint8 slot, uint8 type) { - SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END), ArenaTeamId); + SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_ID, ArenaTeamId); + SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_TYPE, type); } uint32 GetArenaTeamId(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END)); } static uint32 GetArenaTeamIdFromDB(uint64 guid, uint8 slot); diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp index 38c6ee096..0c2ea07fc 100644 --- a/src/game/QueryHandler.cpp +++ b/src/game/QueryHandler.cpp @@ -336,7 +336,7 @@ void WorldSession::HandleNpcTextQueryOpcode( WorldPacket & recv_data ) sLog.outDetail("WORLD: CMSG_NPC_TEXT_QUERY ID '%u'", textID); recv_data >> guid; - GetPlayer()->SetUInt64Value(UNIT_FIELD_TARGET, guid); + _player->SetTargetGUID(guid); GossipText const* pGossip = objmgr.GetGossipText(textID); diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 34e81012e..9335636c6 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -3347,7 +3347,7 @@ void Spell::SendChannelUpdate(uint32 time) { if(time == 0) { - m_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, 0); + m_caster->SetChannelObjectGUID(0); m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, 0); } @@ -3401,7 +3401,7 @@ void Spell::SendChannelStart(uint32 duration) m_timer = duration; if(target) - m_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, target->GetGUID()); + m_caster->SetChannelObjectGUID(target->GetGUID()); m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, m_spellInfo->Id); } diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 6ac84de2a..9b7515201 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -534,7 +534,7 @@ SingleEnemyTargetAura::SingleEnemyTargetAura(SpellEntry const* spellproto, uint3 Unit *caster, Item* castItem) : Aura(spellproto, eff, currentBasePoints, target, caster, castItem) { if (caster) - m_casters_target_guid = caster->GetTypeId()==TYPEID_PLAYER ? ((Player*)caster)->GetSelection() : caster->GetUInt64Value(UNIT_FIELD_TARGET); + m_casters_target_guid = caster->GetTypeId()==TYPEID_PLAYER ? ((Player*)caster)->GetSelection() : caster->GetTargetGUID(); else m_casters_target_guid = 0; } @@ -3665,7 +3665,7 @@ void Aura::HandleAuraModStun(bool apply, bool Real) m_target->ModifyAuraState(AURA_STATE_FROZEN, apply); m_target->addUnitState(UNIT_STAT_STUNNED); - m_target->SetUInt64Value(UNIT_FIELD_TARGET, 0); + m_target->SetTargetGUID(0); m_target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); m_target->CastStop(m_target->GetGUID() == GetCasterGUID() ? GetId() : 0); @@ -3735,7 +3735,7 @@ void Aura::HandleAuraModStun(bool apply, bool Real) if(!m_target->hasUnitState(UNIT_STAT_ROOT)) // prevent allow move if have also root effect { if(m_target->getVictim() && m_target->isAlive()) - m_target->SetUInt64Value(UNIT_FIELD_TARGET,m_target->getVictim()->GetGUID() ); + m_target->SetTargetGUID(m_target->getVictim()->GetGUID()); WorldPacket data(SMSG_FORCE_MOVE_UNROOT, 8+4); data.append(m_target->GetPackGUID()); @@ -3939,8 +3939,8 @@ void Aura::HandleAuraModRoot(bool apply, bool Real) m_target->ModifyAuraState(AURA_STATE_FROZEN, apply); m_target->addUnitState(UNIT_STAT_ROOT); - m_target->SetUInt64Value (UNIT_FIELD_TARGET, 0); - // probably wrong (this add skinable flag) + m_target->SetTargetGUID(0); + // probably wrong (this add skinnable flag) // TODO: find correct flag //m_target->SetFlag(UNIT_FIELD_FLAGS,(apply_stat<<16)); @@ -3991,14 +3991,14 @@ void Aura::HandleAuraModRoot(bool apply, bool Real) return; m_target->clearUnitState(UNIT_STAT_ROOT); - // probably wrong (this add skinable flag) + // probably wrong (this add skinnable flag) // TODO: find correct flag //m_target->RemoveFlag(UNIT_FIELD_FLAGS,(apply_stat<<16)); if(!m_target->hasUnitState(UNIT_STAT_STUNNED)) // prevent allow move if have also stun effect { if(m_target->getVictim() && m_target->isAlive()) - m_target->SetUInt64Value (UNIT_FIELD_TARGET, m_target->getVictim()->GetGUID() ); + m_target->SetTargetGUID(m_target->getVictim()->GetGUID()); if(m_target->GetTypeId() == TYPEID_PLAYER) { diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 5a793ff0c..bb2a943ee 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -6518,7 +6518,7 @@ void Spell::EffectTransmitted(uint32 effIndex) { case GAMEOBJECT_TYPE_FISHINGNODE: { - m_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT,pGameObj->GetGUID()); + m_caster->SetChannelObjectGUID(pGameObj->GetGUID()); m_caster->AddGameObject(pGameObj); // will removed at spell cancel // end time of range when possible catch fish (FISHING_BOBBER_READY_TIME..GetDuration(m_spellInfo)) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 2288ffaa7..c438a479b 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -7629,8 +7629,8 @@ bool Unit::Attack(Unit *victim, bool meleeAttack) ((Creature*)this)->SetCombatStartPosition(GetPositionX(), GetPositionY(), GetPositionZ()); } - //Set our target - SetUInt64Value(UNIT_FIELD_TARGET, victim->GetGUID()); + // Set our target + SetTargetGUID(victim->GetGUID()); if(meleeAttack) addUnitState(UNIT_STAT_MELEE_ATTACKING); @@ -7668,8 +7668,8 @@ bool Unit::AttackStop(bool targetSwitch /*=false*/) m_attacking->_removeAttacker(this); m_attacking = NULL; - //Clear our target - SetUInt64Value(UNIT_FIELD_TARGET, 0); + // Clear our target + SetTargetGUID(0); clearUnitState(UNIT_STAT_MELEE_ATTACKING); @@ -7831,6 +7831,7 @@ void Unit::ModifyAuraState(AuraState flag, bool apply) } } } + Unit *Unit::GetOwner() const { if(uint64 ownerid = GetOwnerGUID()) @@ -7894,7 +7895,7 @@ float Unit::GetCombatDistance( const Unit* target ) const void Unit::SetPet(Pet* pet) { - SetUInt64Value(UNIT_FIELD_SUMMON, pet ? pet->GetGUID() : 0); + SetPetGUID(pet ? pet->GetGUID() : 0); // FIXME: hack, speed must be set only at follow if(pet && GetTypeId()==TYPEID_PLAYER) @@ -7904,16 +7905,14 @@ void Unit::SetPet(Pet* pet) void Unit::SetCharm(Unit* pet) { - SetUInt64Value(UNIT_FIELD_CHARM, pet ? pet->GetGUID() : 0); + SetCharmGUID(pet ? pet->GetGUID() : 0); } - void Unit::AddGuardian( Pet* pet ) { m_guardianPets.insert(pet->GetGUID()); } - void Unit::RemoveGuardian( Pet* pet ) { m_guardianPets.erase(pet->GetGUID()); @@ -12136,7 +12135,7 @@ bool Unit::HandleMendingAuraProc( Aura* triggeredByAura ) void Unit::RemoveAurasAtChanneledTarget(SpellEntry const* spellInfo) { - uint64 target_guid = GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT); + uint64 target_guid = GetChannelObjectGUID(); if(!IS_UNIT_GUID(target_guid)) return; diff --git a/src/game/Unit.h b/src/game/Unit.h index b098d4dc9..87b51eb7c 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1155,10 +1155,16 @@ class MANGOS_DLL_SPEC Unit : public WorldObject void SetOwnerGUID(uint64 owner) { SetUInt64Value(UNIT_FIELD_SUMMONEDBY, owner); } uint64 GetCreatorGUID() const { return GetUInt64Value(UNIT_FIELD_CREATEDBY); } void SetCreatorGUID(uint64 creator) { SetUInt64Value(UNIT_FIELD_CREATEDBY, creator); } - uint64 GetPetGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMON); } + uint64 GetPetGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMON); } + void SetPetGUID(uint64 pet) { SetUInt64Value(UNIT_FIELD_SUMMON, pet); } uint64 GetCharmerGUID() const { return GetUInt64Value(UNIT_FIELD_CHARMEDBY); } void SetCharmerGUID(uint64 owner) { SetUInt64Value(UNIT_FIELD_CHARMEDBY, owner); } - uint64 GetCharmGUID() const { return GetUInt64Value(UNIT_FIELD_CHARM); } + uint64 GetCharmGUID() const { return GetUInt64Value(UNIT_FIELD_CHARM); } + void SetCharmGUID(uint64 charm) { SetUInt64Value(UNIT_FIELD_CHARM, charm); } + uint64 GetTargetGUID() const { return GetUInt64Value(UNIT_FIELD_TARGET); } + void SetTargetGUID(uint64 targetGuid) { SetUInt64Value(UNIT_FIELD_TARGET, targetGuid); } + uint64 GetChannelObjectGUID() const { return GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT); } + void SetChannelObjectGUID(uint64 targetGuid) { SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, targetGuid); } uint64 GetCharmerOrOwnerGUID() const { return GetCharmerGUID() ? GetCharmerGUID() : GetOwnerGUID(); } uint64 GetCharmerOrOwnerOrOwnGUID() const From f6ac2c133f588ae686b1cc263c6dd6c1215a8382 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Mon, 14 Sep 2009 18:18:57 +0400 Subject: [PATCH 092/132] Fixed dbc fmt string. --- src/game/DBCfmt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/DBCfmt.h b/src/game/DBCfmt.h index 1ddec6f1b..3a5c2e5cf 100644 --- a/src/game/DBCfmt.h +++ b/src/game/DBCfmt.h @@ -77,7 +77,7 @@ const char MovieEntryfmt[]="nxx"; const char QuestSortEntryfmt[]="nxxxxxxxxxxxxxxxxx"; const char RandomPropertiesPointsfmt[]="niiiiiiiiiiiiiii"; const char ScalingStatDistributionfmt[]="niiiiiiiiiiiiiiiiiiiii"; -const char ScalingStatValuesfmt[]="iniiiiiiiiiiiiiiiixxxxxx"; +const char ScalingStatValuesfmt[]="iniiiiiiiiiiiiiiiixxiiii"; const char SkillLinefmt[]="nixssssssssssssssssxxxxxxxxxxxxxxxxxxixxxxxxxxxxxxxxxxxi"; const char SkillLineAbilityfmt[]="niiiixxiiiiixx"; const char SoundEntriesfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; From b7ff759b04d115a094af26a796f2293cc2a7ae7a Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Tue, 22 Sep 2009 18:15:18 +0400 Subject: [PATCH 093/132] Updated to 3.2.2 live client build 10482. Fixed corpse query packet (it was broken since 3.1.x). --- src/game/QueryHandler.cpp | 1 + src/game/UpdateFields.h | 2 +- src/realmd/AuthCodes.h | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp index 8634ac873..f518cbb8b 100644 --- a/src/game/QueryHandler.cpp +++ b/src/game/QueryHandler.cpp @@ -324,6 +324,7 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recv_data*/) data << float(y); data << float(z); data << int32(corpsemapid); + data << uint32(0); // unknown SendPacket(&data); } diff --git a/src/game/UpdateFields.h b/src/game/UpdateFields.h index 57aaa322d..c3473731e 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, 2, 2, 10433 +// Auto generated for version 3, 2, 2, 10482 enum EObjectFields { diff --git a/src/realmd/AuthCodes.h b/src/realmd/AuthCodes.h index d31769b7f..7e4991264 100644 --- a/src/realmd/AuthCodes.h +++ b/src/realmd/AuthCodes.h @@ -66,9 +66,9 @@ enum LoginResult // 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.2.2 client build 10433... +// will only support WoW, WoW:TBC and WoW:WotLK 3.2.2 client build 10482... -#define EXPECTED_MANGOS_CLIENT_BUILD {10433, 0} +#define EXPECTED_MANGOS_CLIENT_BUILD {10482, 0} // At update excepted builds please update if need define DEFAULT_MAX_LEVEL // in DBCEnum.h to default max player level expected by build From a0929920308b68cc8bb9d74f1a222299a267dbb6 Mon Sep 17 00:00:00 2001 From: hunuza Date: Fri, 25 Sep 2009 13:29:07 +0200 Subject: [PATCH 094/132] Some BG changes that were introduced in 3.2.2. Player can now only join 2 bg queues at a time. There is a seperate level 80 bracket for AV. Signed-off-by: hunuza --- src/game/Player.cpp | 8 ++------ src/game/SharedDefines.h | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index a3afea53a..ec027d683 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -18591,12 +18591,8 @@ bool Player::GetBGAccessByLevel(BattleGroundTypeId bgTypeId) const BGQueueIdBasedOnLevel Player::GetBattleGroundQueueIdFromLevel(BattleGroundTypeId bgTypeId) const { - //returned to hardcoded version of this function, because there is no way to code it dynamic - uint32 level = getLevel(); - if( bgTypeId == BATTLEGROUND_AV ) - level--; - - uint32 queue_id = (level / 10) - 1; // for ranges 0 - 19, 20 - 29, 30 - 39, 40 - 49, 50 - 59, 60 - 69, 70 -79, 80 + // for ranges 0 - 19, 20 - 29, 30 - 39, 40 - 49, 50 - 59, 60 - 69, 70 - 79, 80 + uint32 queue_id = ( getLevel() / 10) - 1; if( queue_id >= MAX_BATTLEGROUND_QUEUES ) { sLog.outError("BattleGround: too high queue_id %u this shouldn't happen", queue_id); diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 9a6901a19..58ab7c0d0 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -93,7 +93,7 @@ enum Classes #define CLASSMASK_WAND_USERS ((1<<(CLASS_PRIEST-1))|(1<<(CLASS_MAGE-1))|(1<<(CLASS_WARLOCK-1))) -#define PLAYER_MAX_BATTLEGROUND_QUEUES 3 +#define PLAYER_MAX_BATTLEGROUND_QUEUES 2 enum ReputationRank { From 88040431b5edbb654aa0f75a821d04146bfc8de7 Mon Sep 17 00:00:00 2001 From: hunuza Date: Sat, 26 Sep 2009 13:24:50 +0200 Subject: [PATCH 095/132] Fix some death knight glyphs. Signed-off-by: hunuza --- src/game/SpellAuras.cpp | 4 ++-- src/game/SpellEffects.cpp | 26 ++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 53cd09647..bc18d132d 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -2570,8 +2570,8 @@ void Aura::HandleAuraDummy(bool apply, bool Real) return; // have a look if there is still some other Lifebloom dummy aura - Unit::AuraList auras = m_target->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::iterator itr = auras.begin(); itr!=auras.end(); ++itr) + Unit::AuraList const& auras = m_target->GetAurasByType(SPELL_AURA_DUMMY); + for(Unit::AuraList::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr) if((*itr)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID && ((*itr)->GetSpellProto()->SpellFamilyFlags & UI64LIT(0x1000000000))) return; diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index f4324ac46..319aa0266 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -4591,15 +4591,37 @@ void Spell::EffectWeaponDmg(uint32 i) if (count) { // Effect 1(for Blood-Caked Strike)/3(other) damage is bonus - double bonus = count * CalculateDamage(m_spellInfo->SpellIconID == 1736 ? 0 : 2, unitTarget) / 100.0f; + float bonus = count * CalculateDamage(m_spellInfo->SpellIconID == 1736 ? 0 : 2, unitTarget) / 100.0f; // Blood Strike, Blood-Caked Strike and Obliterate store bonus*2 if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0002000000400000) || m_spellInfo->SpellIconID == 1736) bonus /= 2.0f; - totalDamagePercentMod += bonus; + totalDamagePercentMod *= 1.0f + bonus; } } + // Glyph of Blood Strike + if( m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000400000) && + m_caster->HasAura(59332) && + unitTarget->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED)) + { + totalDamagePercentMod *= 1.2f; // 120% if snared + } + // Glyph of Death Strike + if( m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000000010) && + m_caster->HasAura(59336)) + { + int32 rp = m_caster->GetPower(POWER_RUNIC_POWER) / 10; + if(rp > 25) + rp = 25; + totalDamagePercentMod *= 1.0f + rp / 100.0f; + } + // Glyph of Plague Strike + if( m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000000001) && + m_caster->HasAura(58657) ) + { + totalDamagePercentMod *= 1.2f; + } break; } } From 65aa5c89e10340e94271e8c1d1b4d5bd40221b6a Mon Sep 17 00:00:00 2001 From: Tequila Date: Sat, 26 Sep 2009 16:54:10 +0200 Subject: [PATCH 096/132] Fix AP coefficient of 32645 and ranks. In 3.2.2 it does an additional 0.09 damage per combo point and AP. Signed-off-by: hunuza --- src/game/SpellEffects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 319aa0266..8177cf416 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -535,7 +535,7 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) for (int i=0; i< doses; i++) unitTarget->RemoveSingleSpellAurasFromStack(spellId); damage *= doses; - damage += int32(((Player*)m_caster)->GetTotalAttackPowerValue(BASE_ATTACK) * 0.03f * doses); + damage += int32(((Player*)m_caster)->GetTotalAttackPowerValue(BASE_ATTACK) * 0.09f * doses); } // Eviscerate and Envenom Bonus Damage (item set effect) if(m_caster->GetDummyAura(37169)) From 63b5154ca16f4f807dea267dab06b6cde7de9ab0 Mon Sep 17 00:00:00 2001 From: Ambal Date: Wed, 23 Sep 2009 22:26:21 +0300 Subject: [PATCH 097/132] [8527] Make Spell::FillAreaTargets() code use new cell search algorithm Signed-off-by: Ambal --- src/game/Spell.cpp | 4 ++-- src/shared/revision_nr.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 9bffe0d49..2a92b3f77 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -5926,8 +5926,8 @@ void Spell::FillAreaTargets( UnitList& TagUnitMap, float x, float y, float radiu TypeContainerVisitor world_notifier(notifier); TypeContainerVisitor grid_notifier(notifier); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, world_notifier, *m_caster->GetMap()); - cell_lock->Visit(cell_lock, grid_notifier, *m_caster->GetMap()); + cell_lock->Visit(cell_lock, world_notifier, *m_caster->GetMap(), *m_caster, radius); + cell_lock->Visit(cell_lock, grid_notifier, *m_caster->GetMap(), *m_caster, radius); } void Spell::FillRaidOrPartyTargets( UnitList &TagUnitMap, Unit* member, Unit* center, float radius, bool raid, bool withPets, bool withcaster ) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 58fc7f3ed..495a7f004 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8526" + #define REVISION_NR "8527" #endif // __REVISION_NR_H__ From d482660177c5a0e5532a4ab89fa596848e1fb267 Mon Sep 17 00:00:00 2001 From: Ambal Date: Fri, 25 Sep 2009 10:29:23 +0300 Subject: [PATCH 098/132] [8528] Implementing implicit target 49, 50. Thanks to qsa. Signed-off-by: Ambal --- src/game/SharedDefines.h | 4 +++- src/game/Spell.cpp | 23 ++++++++++++++++++++++- src/shared/revision_nr.h | 2 +- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 58ab7c0d0..5c571350d 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -1042,8 +1042,10 @@ enum Targets TARGET_TOTEM_FIRE = 44, TARGET_CHAIN_HEAL = 45, TARGET_SCRIPT_COORDINATES = 46, - TARGET_DYNAMIC_OBJECT = 47, + TARGET_DYNAMIC_OBJECT_FRONT = 47, TARGET_SUMMON = 48, + TARGET_DYNAMIC_OBJECT_LEFT_SIDE = 49, + TARGET_DYNAMIC_OBJECT_RIGHT_SIDE = 50, TARGET_AREAEFFECT_CUSTOM_2 = 52, TARGET_CURRENT_ENEMY_COORDINATES = 53, // set unit coordinates as dest, only 16 target B imlemented TARGET_ALL_RAID_AROUND_CASTER = 56, diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 2a92b3f77..e9d7f02c7 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1329,7 +1329,6 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap) case TARGET_TOTEM_FIRE: case TARGET_SELF: case TARGET_SELF2: - case TARGET_DYNAMIC_OBJECT: case TARGET_AREAEFFECT_CUSTOM: case TARGET_AREAEFFECT_CUSTOM_2: case TARGET_SUMMON: @@ -1996,6 +1995,28 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap) if(DynamicObject* dynObj = m_caster->GetDynObject(m_triggeredByAuraSpell ? m_triggeredByAuraSpell->Id : m_spellInfo->Id)) m_targets.setDestination(dynObj->GetPositionX(), dynObj->GetPositionY(), dynObj->GetPositionZ()); break; + + case TARGET_DYNAMIC_OBJECT_FRONT: + case TARGET_DYNAMIC_OBJECT_LEFT_SIDE: + case TARGET_DYNAMIC_OBJECT_RIGHT_SIDE: + if (!(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)) + { + float angle = m_caster->GetOrientation(); + switch(targetMode) + { + case TARGET_DYNAMIC_OBJECT_FRONT: break; + case TARGET_DYNAMIC_OBJECT_LEFT_SIDE: angle -= 3*M_PI/4; break; + case TARGET_DYNAMIC_OBJECT_RIGHT_SIDE: angle += 3*M_PI/4; break; + } + + float x,y; + m_caster->GetNearPoint2D(x,y,radius,angle); + m_targets.setDestination(x,y,m_caster->GetPositionZ()); + } + + TagUnitMap.push_back(m_caster); + break; + case TARGET_POINT_AT_NORTH: case TARGET_POINT_AT_SOUTH: case TARGET_POINT_AT_EAST: diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 495a7f004..5a35397de 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8527" + #define REVISION_NR "8528" #endif // __REVISION_NR_H__ From a202347079b2440ee6e14ce0bfeb1a7892388b6c Mon Sep 17 00:00:00 2001 From: Ambal Date: Fri, 25 Sep 2009 14:28:43 +0300 Subject: [PATCH 099/132] [8529] check rune cost only if spell has PowerType == POWER_RUNE. Patch provided by yavi. Signed-off-by: Ambal --- src/game/Spell.cpp | 10 +++++++--- src/shared/revision_nr.h | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index e9d7f02c7..f1e4896ba 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -5091,9 +5091,13 @@ SpellCastResult Spell::CheckPower() return SPELL_FAILED_UNKNOWN; } - SpellCastResult failReason = CheckRuneCost(m_spellInfo->runeCostID); - if(failReason != SPELL_CAST_OK) - return failReason; + //check rune cost only if a spell has PowerType == POWER_RUNE + if(m_spellInfo->powerType == POWER_RUNE) + { + SpellCastResult failReason = CheckRuneCost(m_spellInfo->runeCostID); + if(failReason != SPELL_CAST_OK) + return failReason; + } // Check power amount Powers powerType = Powers(m_spellInfo->powerType); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 5a35397de..9cc528464 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8528" + #define REVISION_NR "8529" #endif // __REVISION_NR_H__ From 3c89d50d1064a423281bb5292390c69e20d26a02 Mon Sep 17 00:00:00 2001 From: Maxxie Date: Fri, 25 Sep 2009 15:11:47 +0300 Subject: [PATCH 100/132] [8530] Correctly restore powers with energize-effect spells like Shadowfiend or Mana Tide Totem Signed-off-by: Ambal --- src/game/Unit.cpp | 2 +- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index d23cb7773..0b60f28a4 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -8074,7 +8074,7 @@ void Unit::EnergizeBySpell(Unit *pVictim, uint32 SpellID, uint32 Damage, Powers { SendEnergizeSpellLog(pVictim, SpellID, Damage, powertype); // needs to be called after sending spell log - ModifyPower(powertype, Damage); + pVictim->ModifyPower(powertype, Damage); } uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 9cc528464..2fff78f36 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8529" + #define REVISION_NR "8530" #endif // __REVISION_NR_H__ From 249555f411f5f7ab61f606b7041f64cb01b666a8 Mon Sep 17 00:00:00 2001 From: Shendor Date: Fri, 25 Sep 2009 15:36:43 +0300 Subject: [PATCH 101/132] [8531] Fixed spell 20594 Signed-off-by: Ambal --- src/game/Spell.cpp | 2 ++ src/shared/revision_nr.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index f1e4896ba..55e76b8ea 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2422,6 +2422,8 @@ void Spell::cast(bool skipCheck) else if(m_spellInfo->SpellIconID == 1662 && m_spellInfo->AttributesEx & 0x20) // Blood Fury (Racial) AddPrecastSpell(23230); // Blood Fury - Healing Reduction + else if(m_spellInfo->Id == 20594) // Stoneskin + AddTriggeredSpell(65116); // Stoneskin - armor 10% for 8 sec break; } case SPELLFAMILY_MAGE: diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 2fff78f36..c78be8ee6 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8530" + #define REVISION_NR "8531" #endif // __REVISION_NR_H__ From e9c38b03f445bae0fc8a6fdcbad0cb4be5b81483 Mon Sep 17 00:00:00 2001 From: Antonio593 Date: Fri, 25 Sep 2009 15:53:02 +0300 Subject: [PATCH 102/132] [8532] Fixed situation where some items like 42947 were not giving spell power bonus Signed-off-by: Ambal --- src/game/Player.cpp | 7 +++++++ src/shared/revision_nr.h | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index ec027d683..65bf4fd46 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -6695,6 +6695,13 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl } } + // Apply Spell Power from ScalingStatValue if set + if(ssv) + { + if (int32 spellbonus = ssv->getSpellBonus(proto->ScalingStatValue)) + ApplySpellPowerBonus(spellbonus, apply); + } + // If set ScalingStatValue armor get it or use item armor uint32 armor = proto->Armor; if (ssv) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index c78be8ee6..7773ed4ec 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8531" + #define REVISION_NR "8532" #endif // __REVISION_NR_H__ From 94b06506937ad4b4121eaf4855546b0c1131f2fe Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Fri, 25 Sep 2009 16:01:57 +0200 Subject: [PATCH 103/132] [8533] Not remove timed quest and correctly fail when time runs out. Add function to remove timed quest instead of direct access to set. Signed-off-by: NoFantasy --- src/game/Player.cpp | 20 +++++++------------- src/game/Player.h | 2 ++ src/game/QuestHandler.cpp | 6 ++++++ src/shared/revision_nr.h | 2 +- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 65bf4fd46..2a765bf1f 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -12608,9 +12608,7 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver DestroyItemCount( pQuest->ReqItemId[i], pQuest->ReqItemCount[i], true); } - //if( qInfo->HasSpecialFlag( QUEST_FLAGS_TIMED ) ) - // SetTimedQuest( 0 ); - m_timedquests.erase(pQuest->GetQuestId()); + RemoveTimedQuest(quest_id); if (pQuest->GetRewChoiceItemsCount() > 0) { @@ -12817,6 +12815,7 @@ void Player::FailQuest(uint32 questId) { QuestStatusData& q_status = mQuestStatus[questId]; + RemoveTimedQuest(questId); q_status.m_timer = 0; SendQuestTimerFailed(questId); @@ -13042,12 +13041,13 @@ bool Player::SatisfyQuestStatus( Quest const* qInfo, bool msg ) return true; } -bool Player::SatisfyQuestTimed( Quest const* qInfo, bool msg ) +bool Player::SatisfyQuestTimed(Quest const* qInfo, bool msg) { - if ( (find(m_timedquests.begin(), m_timedquests.end(), qInfo->GetQuestId()) != m_timedquests.end()) && qInfo->HasFlag(QUEST_MANGOS_FLAGS_TIMED) ) + if (!m_timedquests.empty() && qInfo->HasFlag(QUEST_MANGOS_FLAGS_TIMED)) { - if( msg ) - SendCanTakeQuestResponse( INVALIDREASON_QUEST_ONLY_ONE_TIMED ); + if (msg) + SendCanTakeQuestResponse(INVALIDREASON_QUEST_ONLY_ONE_TIMED); + return false; } return true; @@ -13275,12 +13275,6 @@ void Player::SetQuestStatus(uint32 quest_id, QuestStatus status) { if (Quest const* qInfo = objmgr.GetQuestTemplate(quest_id)) { - if (status == QUEST_STATUS_NONE || status == QUEST_STATUS_INCOMPLETE || status == QUEST_STATUS_COMPLETE || status == QUEST_STATUS_FAILED) - { - if (qInfo->HasFlag(QUEST_MANGOS_FLAGS_TIMED)) - m_timedquests.erase(qInfo->GetQuestId()); - } - QuestStatusData& q_status = mQuestStatus[quest_id]; q_status.m_status = status; diff --git a/src/game/Player.h b/src/game/Player.h index 049fb298a..6a4de1d39 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1375,6 +1375,7 @@ class MANGOS_DLL_SPEC Player : public Unit void SetInGameTime( uint32 time ) { m_ingametime = time; } void AddTimedQuest( uint32 quest_id ) { m_timedquests.insert(quest_id); } + void RemoveTimedQuest( uint32 quest_id ) { m_timedquests.erase(quest_id); } /*********************************************************/ /*** LOAD SYSTEM ***/ @@ -2265,6 +2266,7 @@ class MANGOS_DLL_SPEC Player : public Unit /*** QUEST SYSTEM ***/ /*********************************************************/ + //We allow only one timed quest active at the same time. Below can then be simple value instead of set. std::set m_timedquests; uint64 m_divider; diff --git a/src/game/QuestHandler.cpp b/src/game/QuestHandler.cpp index c886a2a0d..1cef7dd22 100644 --- a/src/game/QuestHandler.cpp +++ b/src/game/QuestHandler.cpp @@ -350,6 +350,12 @@ void WorldSession::HandleQuestLogRemoveQuest(WorldPacket& recv_data) if(!_player->TakeQuestSourceItem( quest, true )) return; // can't un-equip some items, reject quest cancel + if (const Quest *pQuest = objmgr.GetQuestTemplate(quest)) + { + if (pQuest->HasFlag(QUEST_MANGOS_FLAGS_TIMED)) + _player->RemoveTimedQuest(quest); + } + _player->SetQuestStatus( quest, QUEST_STATUS_NONE); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 7773ed4ec..deab694c5 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8532" + #define REVISION_NR "8533" #endif // __REVISION_NR_H__ From f168badca60514c88533f25b30191b1fd8f6c825 Mon Sep 17 00:00:00 2001 From: qsa Date: Fri, 25 Sep 2009 18:14:37 +0300 Subject: [PATCH 104/132] [8534] Add error output to track unhandled targetMode values in Spell::SetTargetMap() Signed-off-by: Ambal --- src/game/Spell.cpp | 2 ++ src/shared/revision_nr.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 55e76b8ea..570bb00b1 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2215,12 +2215,14 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap) TagUnitMap.push_back(owner); } break; + default: break; } break; } default: + sLog.outError( "SPELL: Unknown implicit target (%u) for spell ID %u", targetMode, m_spellInfo->Id ); break; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index deab694c5..914b5ca37 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8533" + #define REVISION_NR "8534" #endif // __REVISION_NR_H__ From 44ea1ee3e33fa1f4a9022fbaaed9b60d2d74d9ee Mon Sep 17 00:00:00 2001 From: SilverIce Date: Fri, 25 Sep 2009 19:56:48 +0300 Subject: [PATCH 105/132] [8535] Correctly show spell sharges/stack amount Signed-off-by: Ambal --- src/game/Player.cpp | 5 ++++- src/shared/revision_nr.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 2a765bf1f..3267b3ad0 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -18515,7 +18515,10 @@ void Player::SendAurasForTarget(Unit *target) // level data << uint8(aura->GetAuraLevel()); // charges - data << uint8(aura->GetAuraCharges()); + if (aura->GetAuraCharges()) + data << uint8(aura->GetAuraCharges() * aura->GetStackAmount()); + else + data << uint8(aura->GetStackAmount()); if(!(auraFlags & AFLAG_NOT_CASTER)) { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 914b5ca37..c80652735 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8534" + #define REVISION_NR "8535" #endif // __REVISION_NR_H__ From 76b0b9ace34ecb916f8a5dd60ed526569bb3f226 Mon Sep 17 00:00:00 2001 From: zergtmn Date: Fri, 25 Sep 2009 20:05:03 +0300 Subject: [PATCH 106/132] [8536] Fixed spell 62776 Signed-off-by: Ambal --- src/game/SpellEffects.cpp | 8 ++++++++ src/shared/revision_nr.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 8177cf416..714d9074a 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -348,8 +348,16 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) } // Cataclysmic Bolt case 38441: + { damage = unitTarget->GetMaxHealth() / 2; break; + } + // Tympanic Tantrum + case 62775: + { + damage = unitTarget->GetMaxHealth() / 10; + break; + } } break; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index c80652735..5656bb579 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8535" + #define REVISION_NR "8536" #endif // __REVISION_NR_H__ From 18a20e1e9f05d52560c118f323d4bb79c07db131 Mon Sep 17 00:00:00 2001 From: Shendor Date: Fri, 25 Sep 2009 20:19:03 +0300 Subject: [PATCH 107/132] [8537] Implement SPELL_AURA_MOD_CRIT_CHANCE for spell 31858 Signed-off-by: Ambal --- src/game/SpellAuras.h | 1 + src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index 053d24547..397338227 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -212,6 +212,7 @@ class MANGOS_DLL_SPEC Aura void HandleNoReagentUseAura(bool Apply, bool Real); void HandlePhase(bool Apply, bool Real); void HandleModTargetArmorPct(bool Apply, bool Real); + void HandleAuraModAllCritChance(bool Apply, bool Real); virtual ~Aura(); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 5656bb579..fa558880e 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8536" + #define REVISION_NR "8537" #endif // __REVISION_NR_H__ From 8c276365ba1eb3ac1d221b567ac4c681f3d6cce5 Mon Sep 17 00:00:00 2001 From: KAPATEJIb Date: Fri, 25 Sep 2009 20:43:19 +0300 Subject: [PATCH 108/132] [8538] Fixed spell 63375 Signed-off-by: Ambal --- src/game/Unit.cpp | 6 ++++++ src/shared/revision_nr.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 0b60f28a4..0bca930b2 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -7104,6 +7104,12 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB return false; break; } + // Improved Stormstrike + case 63375: + { + basepoints[0] = int32(GetCreateMana() * 0.20f); + break; + } // Brain Freeze case 57761: { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index fa558880e..f0bbcc4a4 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8537" + #define REVISION_NR "8538" #endif // __REVISION_NR_H__ From 88efd1f18acd12472412948919c5b27f38f3df9f Mon Sep 17 00:00:00 2001 From: Astellar Date: Fri, 25 Sep 2009 23:21:25 +0300 Subject: [PATCH 109/132] [8539] Check pet aura range at area aura update Signed-off-by: Ambal --- src/game/SpellAuras.cpp | 2 +- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index bc18d132d..1d7a43a48 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -784,7 +784,7 @@ void AreaAura::Update(uint32 diff) case AREA_AURA_OWNER: case AREA_AURA_PET: { - if(owner != caster) + if(owner != caster && caster->IsWithinDistInMap(owner, m_radius)) targets.push_back(owner); break; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index f0bbcc4a4..81e70c6d3 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8538" + #define REVISION_NR "8539" #endif // __REVISION_NR_H__ From e2556b18255916e0b0f3eabcbcb49afdf9ffcf99 Mon Sep 17 00:00:00 2001 From: ApoC Date: Fri, 25 Sep 2009 23:05:46 +0200 Subject: [PATCH 110/132] [8540] Revert "[8538] Fixed spell 63375" due to patch incorrectness. Revert suggested by Vladimir. This reverts commit 6217b913c35563f68ea3c414367cd7ac84236b3e. Signed-off-by: ApoC --- src/game/Unit.cpp | 6 ------ src/shared/revision_nr.h | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 0bca930b2..0b60f28a4 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -7104,12 +7104,6 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB return false; break; } - // Improved Stormstrike - case 63375: - { - basepoints[0] = int32(GetCreateMana() * 0.20f); - break; - } // Brain Freeze case 57761: { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 81e70c6d3..416038c68 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8539" + #define REVISION_NR "8540" #endif // __REVISION_NR_H__ From eee1553ab14bd5cf5c4bb4ccb1c6f9100c1fc6be Mon Sep 17 00:00:00 2001 From: qsa Date: Sat, 26 Sep 2009 09:29:38 +0300 Subject: [PATCH 111/132] [8541] Implement implicit target types TARGET_RANDOM_NEARBY_LOC(72) and TARGET_RANDOM_NEARBY_DEST(86). Some summon spells should work fine now Signed-off-by: Ambal --- src/game/SharedDefines.h | 2 ++ src/game/Spell.cpp | 28 ++++++++++++++++++++++++++++ src/shared/revision_nr.h | 2 +- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 5c571350d..03427d1f0 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -1053,6 +1053,7 @@ enum Targets TARGET_AREAEFFECT_PARTY_AND_CLASS = 61, TARGET_DUELVSPLAYER_COORDINATES = 63, TARGET_BEHIND_VICTIM = 65, // uses in teleport behind spells, caster/target dependent from spell effect + TARGET_RANDOM_NEARBY_LOC = 72, // uses in teleport onto nearby locations TARGET_DYNAMIC_OBJECT_COORDINATES = 76, TARGET_SINGLE_ENEMY = 77, TARGET_POINT_AT_NORTH = 78, // 78-85 possible _COORDINATES at radius with pi/4 step around target in unknown order, N? @@ -1063,6 +1064,7 @@ enum Targets TARGET_POINT_AT_NW = 83, // from spell desc: "(NW)" TARGET_POINT_AT_SE = 84, // from spell desc: "(SE)" TARGET_POINT_AT_SW = 85, // from spell desc: "(SW)" + TARGET_RANDOM_NEARBY_DEST = 86, // "Test Nearby Dest Random" - random around selected destination TARGET_SELF2 = 87, TARGET_DIRECTLY_FORWARD = 89, TARGET_NONCOMBAT_PET = 90, diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 570bb00b1..25214ad14 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1323,6 +1323,34 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap) switch(targetMode) { + case TARGET_RANDOM_NEARBY_LOC: + { + float dest_x = m_caster->GetPositionX() + irand(-radius, radius); + float dest_y = m_caster->GetPositionY() + irand(-radius, radius); + float dest_z = m_caster->GetMap()->GetHeight(dest_x, dest_y, MAX_HEIGHT); + m_targets.setDestination(dest_x, dest_y, dest_z); + + TagUnitMap.push_back(m_caster); + break; + } + case TARGET_RANDOM_NEARBY_DEST: + { + float dest_x = m_targets.m_destX + irand(-radius, radius); + float dest_y = m_targets.m_destY + irand(-radius, radius); + float dest_z = m_caster->GetMap()->GetHeight(dest_x, dest_y, MAX_HEIGHT); + m_targets.setDestination(dest_x, dest_y, dest_z); + + if (radius > 0.0f) + { + // caster included here? + FillAreaTargets(TagUnitMap, dest_x, dest_y, radius, PUSH_DEST_CENTER, SPELL_TARGETS_AOE_DAMAGE); + } + else + TagUnitMap.push_back(m_caster); + + break; + } + case TARGET_TOTEM_EARTH: case TARGET_TOTEM_WATER: case TARGET_TOTEM_AIR: diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 416038c68..b49806524 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8540" + #define REVISION_NR "8541" #endif // __REVISION_NR_H__ From 0517d4ccddaae69d1119a32a5c2ac42d08788481 Mon Sep 17 00:00:00 2001 From: Ambal Date: Wed, 23 Sep 2009 22:26:21 +0300 Subject: [PATCH 112/132] [8527] Make Spell::FillAreaTargets() code use new cell search algorithm Signed-off-by: Ambal --- src/shared/revision_nr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index b49806524..90ad3ea11 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8541" + #define REVISION_NR "8521" #endif // __REVISION_NR_H__ From e86f7d74ecbb8802dbd4cdaba51c394a06702bde Mon Sep 17 00:00:00 2001 From: Ambal Date: Fri, 25 Sep 2009 10:29:23 +0300 Subject: [PATCH 113/132] [8528] Implementing implicit target 49, 50. Thanks to qsa. Signed-off-by: Ambal --- src/shared/revision_nr.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 90ad3ea11..263ad44a0 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,8 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ +<<<<<<< HEAD #define REVISION_NR "8521" +======= + #define REVISION_NR "8528" +>>>>>>> [8528] Implementing implicit target 49, 50. Thanks to qsa. #endif // __REVISION_NR_H__ From f865cd79626054c93a1ada083b9cf78a5e1c0a4f Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sat, 26 Sep 2009 19:18:57 +0400 Subject: [PATCH 114/132] Some lost changes. --- src/game/UpdateFields.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/UpdateFields.h b/src/game/UpdateFields.h index c3473731e..4240e6a4a 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 3, 2, 2, 10482 +// Auto generated for version 3, 2, 2, 10505 enum EObjectFields { From 3f33946d6a477bdc5046365351fc522b37eea8ca Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sat, 26 Sep 2009 19:40:14 +0400 Subject: [PATCH 115/132] Update to latest client build 10505. Fixed CMSG_AUCTION_SELL_ITEM. Fixed CMSG_BUY_PETITION. Some other fixes. --- src/game/AuctionHouseHandler.cpp | 11 +++++-- src/game/BattleGround.h | 6 ++-- src/game/Chat.cpp | 3 +- src/game/Chat.h | 3 +- src/game/ItemPrototype.h | 3 +- src/game/LootHandler.cpp | 3 +- src/game/PetitionsHandler.cpp | 49 ++++++++++++++++++-------------- src/game/Player.cpp | 6 ++-- src/game/Player.h | 2 +- src/game/QueryHandler.cpp | 10 +++++-- src/game/debugcmds.cpp | 41 +++++++++++++++++++++++--- src/realmd/AuthCodes.h | 4 +-- src/shared/revision_nr.h | 6 +--- 13 files changed, 96 insertions(+), 51 deletions(-) diff --git a/src/game/AuctionHouseHandler.cpp b/src/game/AuctionHouseHandler.cpp index 80b3dee84..605b10e8e 100644 --- a/src/game/AuctionHouseHandler.cpp +++ b/src/game/AuctionHouseHandler.cpp @@ -151,8 +151,14 @@ void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data ) { uint64 auctioneer, item; uint32 etime, bid, buyout; - recv_data >> auctioneer >> item; - recv_data >> bid >> buyout >> etime; + recv_data >> auctioneer; + recv_data.read_skip(); // const 1? + recv_data >> item; + recv_data.read_skip(); // unk 3.2.2, const 1? + recv_data >> bid; + recv_data >> buyout; + recv_data >> etime; + Player *pl = GetPlayer(); if (!item || !bid || !etime) @@ -172,7 +178,6 @@ void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data ) return; } - // client send time in minutes, convert to common used sec time etime *= MINUTE; diff --git a/src/game/BattleGround.h b/src/game/BattleGround.h index d5ba8e3a0..8d81d13b8 100644 --- a/src/game/BattleGround.h +++ b/src/game/BattleGround.h @@ -85,9 +85,9 @@ enum BattleGroundSpells enum BattleGroundTimeIntervals { RESURRECTION_INTERVAL = 30000, // ms - REMIND_INTERVAL = 30000, // ms - INVITATION_REMIND_TIME = 60000, // ms - INVITE_ACCEPT_WAIT_TIME = 80000, // ms + //REMIND_INTERVAL = 10000, // ms + INVITATION_REMIND_TIME = 20000, // ms + INVITE_ACCEPT_WAIT_TIME = 40000, // ms TIME_TO_AUTOREMOVE = 120000, // ms MAX_OFFLINE_TIME = 300, // secs RESPAWN_ONE_DAY = 86400, // secs diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 9ae5cd722..03d48b58f 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -157,11 +157,12 @@ ChatCommand * ChatHandler::getCommandTable() { "getitemstate", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugGetItemStateCommand, "", NULL }, { "lootrecipient", SEC_GAMEMASTER, false, &ChatHandler::HandleDebugGetLootRecipientCommand, "", NULL }, { "getvalue", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugGetValueCommand, "", NULL }, + { "getitemvalue", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugGetItemValueCommand, "", NULL }, { "Mod32Value", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugMod32ValueCommand, "", NULL }, { "play", SEC_MODERATOR, false, NULL, "", debugPlayCommandTable }, { "send", SEC_ADMINISTRATOR, false, NULL, "", debugSendCommandTable }, { "setaurastate", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSetAuraStateCommand, "", NULL }, - { "setitemflag", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSetItemFlagCommand, "", NULL }, + { "setitemvalue", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSetItemValueCommand, "", NULL }, { "setvalue", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSetValueCommand, "", NULL }, { "spellcheck", SEC_CONSOLE, true, &ChatHandler::HandleDebugSpellCheckCommand, "", NULL }, { "spawnvehicle", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSpawnVehicle, "", NULL }, diff --git a/src/game/Chat.h b/src/game/Chat.h index 2bc558fcf..9ee748292 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -133,9 +133,10 @@ class ChatHandler bool HandleDebugGetItemStateCommand(const char * args); bool HandleDebugGetLootRecipientCommand(const char * args); bool HandleDebugGetValueCommand(const char* args); + bool HandleDebugGetItemValueCommand(const char* args); bool HandleDebugMod32ValueCommand(const char* args); bool HandleDebugSetAuraStateCommand(const char * args); - bool HandleDebugSetItemFlagCommand(const char * args); + bool HandleDebugSetItemValueCommand(const char * args); bool HandleDebugSetValueCommand(const char* args); bool HandleDebugSpawnVehicle(const char * args); bool HandleDebugSpellCheckCommand(const char* args); diff --git a/src/game/ItemPrototype.h b/src/game/ItemPrototype.h index f44cfbd3c..cae4fd3f5 100644 --- a/src/game/ItemPrototype.h +++ b/src/game/ItemPrototype.h @@ -123,7 +123,8 @@ enum ITEM_FLAGS ITEM_FLAGS_SPECIALUSE = 0x00800000, // last used flag in 2.3.0 ITEM_FLAGS_BOA = 0x08000000, // bind on account (set in template for items that can binded in like way) ITEM_FLAGS_ENCHANT_SCROLL = 0x10000000, // for enchant scrolls - ITEM_FLAGS_MILLABLE = 0x20000000 + ITEM_FLAGS_MILLABLE = 0x20000000, + ITEM_FLAGS_BOP_TRADEABLE = 0x80000000 }; enum BAG_FAMILY_MASK diff --git a/src/game/LootHandler.cpp b/src/game/LootHandler.cpp index 76008c6e9..67cb4dc59 100644 --- a/src/game/LootHandler.cpp +++ b/src/game/LootHandler.cpp @@ -489,7 +489,7 @@ void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data ) return; } - // not move item from loot to target inventory + // now move item from loot to target inventory Item * newitem = target->StoreNewItem( dest, item.itemid, true, item.randomPropertyId ); target->SendNewItem(newitem, uint32(item.count), false, false, true ); target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item.itemid, item.count); @@ -499,7 +499,6 @@ void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data ) item.count=0; item.is_looted=true; - pLoot->NotifyItemRemoved(slotid); --pLoot->unlootedCount; } diff --git a/src/game/PetitionsHandler.cpp b/src/game/PetitionsHandler.cpp index a4a1201cd..6c4918465 100644 --- a/src/game/PetitionsHandler.cpp +++ b/src/game/PetitionsHandler.cpp @@ -48,30 +48,35 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) { sLog.outDebug("Received opcode CMSG_PETITION_BUY"); - //recv_data.hexlike(); + recv_data.hexlike(); uint64 guidNPC; - uint64 unk1, unk3, unk4, unk5, unk6, unk7; uint32 unk2; std::string name; - uint16 unk8; - uint8 unk9; - uint32 unk10; // selected index - uint32 unk11; - recv_data >> guidNPC; // NPC GUID - recv_data >> unk1; // 0 - recv_data >> unk2; // 0 - recv_data >> name; // name - recv_data >> unk3; // 0 - recv_data >> unk4; // 0 - recv_data >> unk5; // 0 - recv_data >> unk6; // 0 - recv_data >> unk7; // 0 - recv_data >> unk8; // 0 - recv_data >> unk9; // 0 - recv_data >> unk10; // index - recv_data >> unk11; // 0 + recv_data >> guidNPC; // NPC GUID + recv_data.read_skip(); // 0 + recv_data.read_skip(); // 0 + recv_data >> name; // name + recv_data.read_skip(); // some string + recv_data.read_skip(); // 0 + recv_data.read_skip(); // 0 + recv_data.read_skip(); // 0 + recv_data.read_skip(); // 0 + recv_data.read_skip(); // 0 + recv_data.read_skip(); // 0 + recv_data.read_skip(); // 0 + recv_data.read_skip(); // 0 + recv_data.read_skip(); // 0 + recv_data.read_skip(); // 0 + recv_data.read_skip(); // 0 + + for (int i = 0; i < 10; ++i) + recv_data.read_skip(); + + recv_data >> unk2; // index + recv_data.read_skip(); // 0 + sLog.outDebug("Petitioner with GUID %u tried sell petition: name %s", GUID_LOPART(guidNPC), name.c_str()); // prevent cheating @@ -109,7 +114,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) return; } - switch(unk10) + switch(unk2) { case 1: charterid = ARENA_TEAM_CHARTER_2v2; @@ -127,11 +132,11 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) type = 5; // 5v5 break; default: - sLog.outDebug("unknown selection at buy petition: %u", unk10); + sLog.outDebug("unknown selection at buy petition: %u", unk2); return; } - if(_player->GetArenaTeamId(unk10-1)) + if(_player->GetArenaTeamId(unk2 - 1)) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ALREADY_IN_ARENA_TEAM); return; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 3267b3ad0..8af429623 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -13794,7 +13794,7 @@ void Player::SendQuestFailed( uint32 quest_id ) if( quest_id ) { WorldPacket data( SMSG_QUESTGIVER_QUEST_FAILED, 4+4 ); - data << quest_id; + data << uint32(quest_id); data << uint32(0); // failed reason (4 for inventory is full) GetSession()->SendPacket( &data ); sLog.outDebug("WORLD: Sent SMSG_QUESTGIVER_QUEST_FAILED"); @@ -13806,7 +13806,7 @@ void Player::SendQuestTimerFailed( uint32 quest_id ) if( quest_id ) { WorldPacket data( SMSG_QUESTUPDATE_FAILEDTIMER, 4 ); - data << quest_id; + data << uint32(quest_id); GetSession()->SendPacket( &data ); sLog.outDebug("WORLD: Sent SMSG_QUESTUPDATE_FAILEDTIMER"); } @@ -14225,7 +14225,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) { MapEntry const* mapEntry = sMapStore.LookupEntry(GetMapId()); // if server restart after player save in BG or area - // player can have current coordinates in to BG/Arean map, fix this + // player can have current coordinates in to BG/Arena map, fix this if(!mapEntry || mapEntry->IsBattleGroundOrArena()) { const WorldLocation& _loc = GetBattleGroundEntryPoint(); diff --git a/src/game/Player.h b/src/game/Player.h index 6a4de1d39..62a4bd839 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -426,7 +426,7 @@ enum PlayerFlags PLAYER_FLAGS_UNK23 = 0x00400000, PLAYER_FLAGS_UNK24 = 0x00800000, // disabled all abilitys on tab except autoattack PLAYER_FLAGS_UNK25 = 0x01000000, // disabled all melee ability on tab include autoattack - + PLAYER_FLAGS_NO_XP_GAIN = 0x02000000, }; // used for PLAYER__FIELD_KNOWN_TITLES field (uint64), (1<> pageID; - sLog.outDetail("WORLD: Received CMSG_PAGE_TEXT_QUERY for pageID '%u'", pageID); + recv_data.read_skip(); // guid while (pageID) { @@ -461,6 +463,8 @@ void WorldSession::HandlePageTextQueryOpcode( WorldPacket & recv_data ) void WorldSession::HandleCorpseMapPositionQuery( WorldPacket & recv_data ) { + sLog.outDebug( "WORLD: Recv CMSG_CORPSE_MAP_POSITION_QUERY" ); + uint32 unk; recv_data >> unk; diff --git a/src/game/debugcmds.cpp b/src/game/debugcmds.cpp index 684c2e0b4..d0f186f89 100644 --- a/src/game/debugcmds.cpp +++ b/src/game/debugcmds.cpp @@ -657,7 +657,6 @@ bool ChatHandler::HandleDebugSpellCheckCommand(const char* /*args*/) return true; } - bool ChatHandler::HandleDebugSendLargePacketCommand(const char* /*args*/) { const char* stuffingString = "This is a dummy string to push the packet's size beyond 128000 bytes. "; @@ -678,7 +677,7 @@ bool ChatHandler::HandleDebugSendSetPhaseShiftCommand(const char* args) return true; } -bool ChatHandler::HandleDebugSetItemFlagCommand(const char* args) +bool ChatHandler::HandleDebugGetItemValueCommand(const char* args) { if (!*args) return false; @@ -690,14 +689,48 @@ bool ChatHandler::HandleDebugSetItemFlagCommand(const char* args) return false; uint32 guid = (uint32)atoi(e); - uint32 flag = (uint32)atoi(f); + uint32 index = (uint32)atoi(f); Item *i = m_session->GetPlayer()->GetItemByGuid(MAKE_NEW_GUID(guid, 0, HIGHGUID_ITEM)); if (!i) return false; - i->SetUInt32Value(ITEM_FIELD_FLAGS, flag); + if (index >= i->GetValuesCount()) + return false; + + uint32 value = i->GetUInt32Value(index); + + PSendSysMessage("Item %u: value at %u is %u", guid, index, value); + + return true; +} + +bool ChatHandler::HandleDebugSetItemValueCommand(const char* args) +{ + if (!*args) + return false; + + char* e = strtok((char*)args, " "); + char* f = strtok(NULL, " "); + char* g = strtok(NULL, " "); + + if (!e || !f || !g) + return false; + + uint32 guid = (uint32)atoi(e); + uint32 index = (uint32)atoi(f); + uint32 value = (uint32)atoi(g); + + Item *i = m_session->GetPlayer()->GetItemByGuid(MAKE_NEW_GUID(guid, 0, HIGHGUID_ITEM)); + + if (!i) + return false; + + if (index >= i->GetValuesCount()) + return false; + + i->SetUInt32Value(index, value); return true; } diff --git a/src/realmd/AuthCodes.h b/src/realmd/AuthCodes.h index 7e4991264..7df23ad42 100644 --- a/src/realmd/AuthCodes.h +++ b/src/realmd/AuthCodes.h @@ -66,9 +66,9 @@ enum LoginResult // 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.2.2 client build 10482... +// will only support WoW, WoW:TBC and WoW:WotLK 3.2.2a client build 10505... -#define EXPECTED_MANGOS_CLIENT_BUILD {10482, 0} +#define EXPECTED_MANGOS_CLIENT_BUILD {10505, 0} // At update excepted builds please update if need define DEFAULT_MAX_LEVEL // in DBCEnum.h to default max player level expected by build diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 263ad44a0..b49806524 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,8 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ -<<<<<<< HEAD - #define REVISION_NR "8521" -======= - #define REVISION_NR "8528" ->>>>>>> [8528] Implementing implicit target 49, 50. Thanks to qsa. + #define REVISION_NR "8541" #endif // __REVISION_NR_H__ From 1e0b93abdb99e91db2a23d7053ccf4a442e36963 Mon Sep 17 00:00:00 2001 From: hunuza Date: Sat, 26 Sep 2009 18:14:49 +0200 Subject: [PATCH 116/132] You now only need 1600 resources to win in AB and EY. Signed-off-by: hunuza --- src/game/BattleGroundAB.h | 4 ++-- src/game/BattleGroundEY.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/game/BattleGroundAB.h b/src/game/BattleGroundAB.h index e01e78f66..30471f1ee 100644 --- a/src/game/BattleGroundAB.h +++ b/src/game/BattleGroundAB.h @@ -128,8 +128,8 @@ enum BG_AB_Timers enum BG_AB_Score { - BG_AB_WARNING_NEAR_VICTORY_SCORE = 1800, - BG_AB_MAX_TEAM_SCORE = 2000 + BG_AB_WARNING_NEAR_VICTORY_SCORE = 1400, + BG_AB_MAX_TEAM_SCORE = 1600 }; /* do NOT change the order, else wrong behaviour */ diff --git a/src/game/BattleGroundEY.h b/src/game/BattleGroundEY.h index 05200658f..af9a189ff 100644 --- a/src/game/BattleGroundEY.h +++ b/src/game/BattleGroundEY.h @@ -214,8 +214,8 @@ enum EYBattleGroundObjectTypes enum BG_EY_Score { - BG_EY_WARNING_NEAR_VICTORY_SCORE = 1800, - BG_EY_MAX_TEAM_SCORE = 2000 + BG_EY_WARNING_NEAR_VICTORY_SCORE = 1400, + BG_EY_MAX_TEAM_SCORE = 1600 }; enum BG_EY_FlagState From 302afbc40f0efe3642c75df229dd73df1b141fca Mon Sep 17 00:00:00 2001 From: hunuza Date: Sun, 27 Sep 2009 12:24:34 +0200 Subject: [PATCH 117/132] Allow weapon procs in druid shapeshifts. Signed-off-by: hunuza --- src/game/Player.cpp | 2 +- src/game/Unit.cpp | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 8af429623..4d2790ca7 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -6990,7 +6990,7 @@ void Player::UpdateEquipSpellsAtFormChange() void Player::CastItemCombatSpell(Unit* Target, WeaponAttackType attType) { - Item *item = GetWeaponForAttack(attType, true); + Item *item = GetWeaponForAttack(attType, false); if(!item || item->IsBroken()) return; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 0b60f28a4..c643b9c1c 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -12092,9 +12092,6 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura* aura, SpellEntry con else item = ((Player*)this)->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED); - if (!((Player*)this)->IsUseEquipedWeapon(attType==BASE_ATTACK)) - return false; - if(!item || item->IsBroken() || item->GetProto()->Class != ITEM_CLASS_WEAPON || !((1<GetProto()->SubClass) & spellProto->EquippedItemSubClassMask)) return false; } From 6c12b38711e12ac775177b4992de94a514999be7 Mon Sep 17 00:00:00 2001 From: hunuza Date: Sun, 27 Sep 2009 17:32:28 +0200 Subject: [PATCH 118/132] Implement DK spell 50842. Signed-off-by: hunuza --- src/game/SpellEffects.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 714d9074a..82328934b 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -5548,6 +5548,37 @@ void Spell::EffectScriptEffect(uint32 effIndex) } break; } + case SPELLFAMILY_DEATHKNIGHT: + { + switch(m_spellInfo->Id) + { + // Pestilence + case 50842: + { + if(!unitTarget) + return; + + Unit* mainTarget = m_targets.getUnitTarget(); + if(!mainTarget) + return; + + // do only refresh diseases on main target if caster has Glyph of Disease + if(mainTarget == unitTarget && !m_caster->HasAura(63334)) + return; + + // Blood Plague + if(mainTarget->HasAura(55078)) + m_caster->CastSpell(unitTarget, 55078, true); + + // Frost Fever + if(mainTarget->HasAura(55095)) + m_caster->CastSpell(unitTarget, 55095, true); + + break; + } + } + break; + } } // normal DB scripted effect From 23618d66eaf21fa445d1704645aac3c00603d83f Mon Sep 17 00:00:00 2001 From: hunuza Date: Sun, 27 Sep 2009 22:21:11 +0200 Subject: [PATCH 119/132] Implement DK talent 49471 and ranks. Signed-off-by: hunuza --- src/game/Unit.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index c643b9c1c..4f869e503 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -8274,6 +8274,38 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 } break; } + case SPELLFAMILY_DEATHKNIGHT: + { + // Icy Touch, Howling Blast and Frost Strike + if (spellProto->SpellFamilyFlags & UI64LIT(0x0000000600000002)) + { + // search disease + bool found = false; + Unit::AuraMap const& auras = pVictim->GetAuras(); + for(Unit::AuraMap::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr) + { + if(itr->second->GetSpellProto()->Dispel == DISPEL_DISEASE) + { + found = true; + break; + } + } + if(!found) + break; + + // search for Glacier Rot dummy aura + Unit::AuraList const& dummyAuras = GetAurasByType(SPELL_AURA_DUMMY); + for(Unit::AuraList::const_iterator i = dummyAuras.begin(); i != dummyAuras.end(); ++i) + { + if ((*i)->GetSpellProto()->EffectMiscValue[(*i)->GetEffIndex()] == 7244) + { + DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f) / 100.0f; + break; + } + } + } + break; + } default: break; } From 650fa65ea9e1f987f583e9176f4ed87d795ea648 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Mon, 28 Sep 2009 19:50:42 +0400 Subject: [PATCH 120/132] Nothing really changed. --- src/game/QueryHandler.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp index b80cbd1eb..041e81b5d 100644 --- a/src/game/QueryHandler.cpp +++ b/src/game/QueryHandler.cpp @@ -36,7 +36,6 @@ void WorldSession::SendNameQueryOpcode(Player *p) { if(!p) return; - // guess size WorldPacket data( SMSG_NAME_QUERY_RESPONSE, (8+1+1+1+1+1+10) ); data.append(p->GetPackGUID()); // player guid @@ -100,7 +99,6 @@ void WorldSession::SendNameQueryOpcodeFromDBCallBack(QueryResult *result, uint32 pGender = fields[3].GetUInt8(); pClass = fields[4].GetUInt8(); } - // guess size WorldPacket data( SMSG_NAME_QUERY_RESPONSE, (8+1+1+1+1+1+1+10) ); data.appendPackGUID(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER)); @@ -264,7 +262,6 @@ void WorldSession::HandleGameObjectQueryOpcode( WorldPacket & recv_data ) } else { - uint64 guid; recv_data >> guid; From ee884d2791199cb7f0ab70f2ac5b0b6897cbd995 Mon Sep 17 00:00:00 2001 From: YuruY Date: Wed, 30 Sep 2009 01:39:50 +0400 Subject: [PATCH 121/132] Support item levels > 255 as expected for 3.2.x clients. Signed-off-by: VladimirMangos --- sql/320/7_item_template.sql | 2 ++ sql/mangos.sql | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 sql/320/7_item_template.sql diff --git a/sql/320/7_item_template.sql b/sql/320/7_item_template.sql new file mode 100644 index 000000000..a5a955854 --- /dev/null +++ b/sql/320/7_item_template.sql @@ -0,0 +1,2 @@ +ALTER TABLE item_template + CHANGE COLUMN ItemLevel ItemLevel smallint(5) unsigned NOT NULL DEFAULT 0; diff --git a/sql/mangos.sql b/sql/mangos.sql index 9071133cc..f8aad173b 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -1714,7 +1714,7 @@ CREATE TABLE `item_template` ( `InventoryType` tinyint(3) unsigned NOT NULL default '0', `AllowableClass` mediumint(9) NOT NULL default '-1', `AllowableRace` mediumint(9) NOT NULL default '-1', - `ItemLevel` tinyint(3) unsigned NOT NULL default '0', + `ItemLevel` smallint(5) unsigned NOT NULL default '0', `RequiredLevel` tinyint(3) unsigned NOT NULL default '0', `RequiredSkill` smallint(5) unsigned NOT NULL default '0', `RequiredSkillRank` smallint(5) unsigned NOT NULL default '0', From 5c0e01be8f7b85843593bad27c3a2cba4989dbc6 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 3 Oct 2009 02:29:01 +0400 Subject: [PATCH 122/132] Remove outdated spell data from mangos.sql --- sql/320/8_spell_chain.sql | 2 ++ sql/320/9_spell_proc_event.sql | 1 + sql/mangos.sql | 8 -------- 3 files changed, 3 insertions(+), 8 deletions(-) create mode 100644 sql/320/8_spell_chain.sql create mode 100644 sql/320/9_spell_proc_event.sql diff --git a/sql/320/8_spell_chain.sql b/sql/320/8_spell_chain.sql new file mode 100644 index 000000000..db19d734f --- /dev/null +++ b/sql/320/8_spell_chain.sql @@ -0,0 +1,2 @@ +/* UnholyBlight non ranked now */ +DELETE FROM spell_chain WHERE first_spell = 49194; diff --git a/sql/320/9_spell_proc_event.sql b/sql/320/9_spell_proc_event.sql new file mode 100644 index 000000000..d2353556c --- /dev/null +++ b/sql/320/9_spell_proc_event.sql @@ -0,0 +1 @@ +DELETE FROM spell_proc_event WHERE entry IN (58642,58676,44401); diff --git a/sql/mangos.sql b/sql/mangos.sql index ce17d1036..8172dad67 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -16937,11 +16937,6 @@ INSERT INTO spell_chain VALUES (55265,55090,55090,2,0), (55270,55265,55090,3,0), (55271,55270,55090,4,0), -/*UnholyBlight*/ -(49194,0,49194,1,0), -(51376,49194,49194,2,0), -(51378,51376,49194,3,0), -(51379,51378,49194,4,0), /*------------------ -- (773) Inscription ------------------*/ @@ -17815,7 +17810,6 @@ INSERT INTO `spell_proc_event` VALUES (44394, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0.000000, 0.000000, 0), (44395, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0.000000, 0.000000, 0), (44396, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0.000000, 0.000000, 0), -(44401, 0x00000000, 3, 0x00200000, 0x00000000, 0x00000000, 0x00000000, 0x00000FFF, 0.000000, 0.000000, 0), (44404, 0x00000000, 3, 0x20000021, 0x00009000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (44442, 0x00000000, 3, 0x00800000, 0x00000040, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 1), (44443, 0x00000000, 3, 0x00800000, 0x00000040, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 1), @@ -18078,10 +18072,8 @@ INSERT INTO `spell_proc_event` VALUES (58620, 0x00000000, 15, 0x00000000, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (58626, 0x00000000, 15, 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (58631, 0x00000000, 15, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(58642, 0x00000000, 15, 0x00000000, 0x08000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (58644, 0x00000000, 15, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (58647, 0x00000000, 15, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(58676, 0x00000000, 15, 0x00000000, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (58677, 0x00000000, 15, 0x00002000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (58872, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), (58874, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), From ef19575a59409dffb59462773b44333ebae5b3c1 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 3 Oct 2009 06:47:34 +0400 Subject: [PATCH 123/132] Update spell code base at mangos_spell_check.sql errors: * Drop code for spell 781. Not need now for work. * Move code for 8017 and ranks to expected effect for 3.2.x. * Drop code for spell 26635. Not need for new way work. --- sql/mangos_spell_check.sql | 27 +++--- src/game/SpellEffects.cpp | 182 +++++++++++-------------------------- 2 files changed, 64 insertions(+), 145 deletions(-) diff --git a/sql/mangos_spell_check.sql b/sql/mangos_spell_check.sql index a6b8c3cde..0c9a97933 100644 --- a/sql/mangos_spell_check.sql +++ b/sql/mangos_spell_check.sql @@ -38,7 +38,6 @@ CREATE TABLE `spell_check` ( INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMaskB,SpellIcon,SpellVisual,SpellCategory,EffectType,EffectAura,EffectIdx,Name,Code) VALUES /* sorted by spell ids */ /*id fm familyMaskA fmMaskB icon vis cat eff aur ef name code */ -(781, 9, -1, -1, -1, -1, -1, 3, -1,-1,'Disengage', 'Spell::EffectDummy'), (1454, 5,0x0000000000040000,0x00000000, -1, -1, -1, 3, -1,-1,'Life Tap', 'Spell::EffectDummy'), (1455, 5,0x0000000000040000,0x00000000, -1, -1, -1, 3, -1,-1,'Life Tap', 'Spell::EffectDummy'), (1456, 5,0x0000000000040000,0x00000000, -1, -1, -1, 3, -1,-1,'Life Tap', 'Spell::EffectDummy'), @@ -46,9 +45,9 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (4073, -1, -1, -1, -1, -1, -1, -1, -1,-1,'Mechanical Dragonling', 'Spell::EffectDummy'), (5938, 8, -1, -1, -1, -1, -1, 3, -1,-1,'Shiv', 'Spell::EffectDummy'), (5940, -1, -1, -1, -1, -1, -1, -1, -1,-1,'Shiv', 'Spell::EffectDummy'), -(8017, 11,0x0000000000400000,0x00000000, -1, -1, -1, 3, -1,-1,'Rockbiter Weapon', 'Spell::EffectDummy'), -(8018, 11,0x0000000000400000,0x00000000, -1, -1, -1, 3, -1,-1,'Rockbiter Weapon', 'Spell::EffectDummy'), -(8019, 11,0x0000000000400000,0x00000000, -1, -1, -1, 3, -1,-1,'Rockbiter Weapon', 'Spell::EffectDummy'), +(8017, 11,0x0000000000400000,0x00000000, -1, -1, -1, 54, -1,-1,'Rockbiter Weapon', 'Spell::EffectEnchantItemTmp'), +(8018, 11,0x0000000000400000,0x00000000, -1, -1, -1, 54, -1,-1,'Rockbiter Weapon', 'Spell::EffectEnchantItemTmp'), +(8019, 11,0x0000000000400000,0x00000000, -1, -1, -1, 54, -1,-1,'Rockbiter Weapon', 'Spell::EffectEnchantItemTmp'), (8063, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Deviate Fish', 'Spell::EffectDummy'), (8064, -1, -1, -1, -1, -1, -1, -1, -1,-1,'Sleepy', 'Spell::EffectDummy'), (8065, -1, -1, -1, -1, -1, -1, -1, -1,-1,'Invigorate', 'Spell::EffectDummy'), @@ -61,7 +60,7 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (8221, -1, -1, -1, -1, -1, -1, -1, -1,-1,'Yaaarrrr', 'Spell::EffectDummy'), (8222, -1, -1, -1, -1, -1, -1, -1, -1,-1,'Yaaarrrr', 'Spell::EffectDummy'), (8593, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Symbol of life', 'Spell::EffectDummy'), -(10399,11,0x0000000000400000,0x00000000, -1, -1, -1, 3, -1,-1,'Rockbiter Weapon', 'Spell::EffectDummy'), +(10399,11,0x0000000000400000,0x00000000, -1, -1, -1, 54, -1,-1,'Rockbiter Weapon', 'Spell::EffectEnchantItemTmp'), (11687, 5,0x0000000000040000,0x00000000, -1, -1, -1, 3, -1,-1,'Life Tap', 'Spell::EffectDummy'), (11688, 5,0x0000000000040000,0x00000000, -1, -1, -1, 3, -1,-1,'Life Tap', 'Spell::EffectDummy'), (11689, 5,0x0000000000040000,0x00000000, -1, -1, -1, 3, -1,-1,'Life Tap', 'Spell::EffectDummy'), @@ -152,9 +151,6 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (26464,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Mercurial Shield', 'Spell::EffectTriggerSpell'), (26467,-1, -1, -1, -1, -1, -1, 6, 42, 0,'Persistent Shield', 'Spell::EffectDummy'), (26558, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Meteor', 'Spell::EffectSchoolDMG'), -(26635,-1, -1, -1, -1, -1, -1, 6, -1, 0,'Berserking', 'Spell::EffectDummy'), -(26635,-1, -1, -1, -1, -1, -1, 6, -1, 1,'Berserking', 'Spell::EffectDummy'), -(26635,-1, -1, -1, -1, -1, -1, 6, -1, 2,'Berserking', 'Spell::EffectDummy'), (26789, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Shard of the Fallen Star', 'Spell::EffectSchoolDMG'), (27174,10, -1, -1, 156, -1, -1, 3, -1,-1,'Holy Shock', 'Spell::EffectDummy'), (27175,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Shock', 'Spell::EffectDummy'), @@ -211,10 +207,14 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (35744,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Socrethar Portal', 'Spell::EffectDummy'), (35745, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Socrethar\'s Stone', 'Spell::EffectDummy'), (36032,-1, -1, -1, -1, -1, -1, -1, -1,-1,'', 'Spell::EffectSchoolDMG'), -(36494,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Rockbiter Weapon', 'Spell::EffectDummy'), -(36750,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Rockbiter Weapon', 'Spell::EffectDummy'), -(36755,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Rockbiter Weapon', 'Spell::EffectDummy'), -(36759,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Rockbiter Weapon', 'Spell::EffectDummy'), +(36744,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Rockbiter Weapon', 'Spell::EffectEnchantItemTmp'), +(36751,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Rockbiter Weapon', 'Spell::EffectEnchantItemTmp'), +(36753,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Rockbiter Weapon', 'Spell::EffectEnchantItemTmp'), +(36754,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Rockbiter Weapon', 'Spell::EffectEnchantItemTmp'), +(36755,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Rockbiter Weapon', 'Spell::EffectEnchantItemTmp'), +(36758,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Rockbiter Weapon', 'Spell::EffectEnchantItemTmp'), +(36760,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Rockbiter Weapon', 'Spell::EffectEnchantItemTmp'), +(36761,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Rockbiter Weapon', 'Spell::EffectEnchantItemTmp'), (36837, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Meteor', 'Spell::EffectSchoolDMG'), (36890,-1, -1, -1, -1, -1, -1, 5, -1,-1,'Area52 Transporter', 'Spell::EffectTeleportUnits'), (36893,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Transporter Malfunction', 'Spell::EffectTeleportUnits'), @@ -346,7 +346,6 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas ( 0, 3,0x0000000020000000,0x00000000, -1, -1, -1, 2, -1,-1,'Arcane Blast', 'Spell::EffectSchoolDMG'), ( 0, 9,0x0000000000000800,0x00000000, -1, -1, -1, 2, -1,-1,'Arcane Shot', 'Spell::EffectSchoolDMG'), ( 0,10,0x0000000000004000,0x00000000, -1, -1, -1, 2, -1,-1,'Avenger\'s Shield', 'Spell::EffectSchoolDMG'), -( 0, 0, -1, -1,1661, -1, -1, 3, -1,-1,'Berserking', 'Spell::EffectDummy'), ( 0, 4,0x0000040000000000,0x00000000, -1, -1, -1, 2, -1,-1,'Bloodthirst', 'Spell::EffectSchoolDMG'), (0, 4,0x0000000000000001,0x00000000, -1, 867, -1, 3, -1,-1,'Charge', 'Spell::EffectDummy'), ( 0,11,0x0000000004000000,0x00000000,1673, -1, -1, 3, -1,-1,'Cleansing Totem', 'Spell::EffectDummy'), @@ -394,7 +393,7 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas ( 0, 7,0x0000000000001000,0x00000000, -1, -1, -1, -1, 3,-1,'Rake', 'Aura::HandlePeriodicDamage'), /* used in */ ( 0, 7,0x0000000000001000,0x00000000, -1, -1, -1, 80, -1, 2,'Rake', 'Aura::HandlePeriodicDamage'), /* exactly selected */ ( 0, 4,0x0000000000000400,0x00000000, -1, -1, -1, 2, -1,-1,'Revenge', 'Spell::EffectSchoolDMG'), -( 0,11,0x0000000000400000,0x00000000, -1, -1, -1, 3, -1,-1,'Rockbiter Weapon', 'Spell::EffectDummy'), +( 0,11,0x0000000000400000,0x00000000, -1, -1, -1, 54, -1,-1,'Rockbiter Weapon', 'Spell::EffectEnchantItemTmp'), ( 0, 6,0x0000000200000000,0x00000000, -1, -1, -1, 2, -1,-1,'Shadow Word: Death', 'Spell::EffectSchoolDMG'), ( 0, 5,0x0000000000000000,0x00000002, -1, -1, -1, -1, 3,-1,'Shadowflame', 'Spell::EffectSchoolDMG'), /* dot */ ( 0, 5,0x0001000000000000,0x00000000, -1, -1, -1, 2, -1,-1,'Shadowflame', 'Spell::EffectSchoolDMG'), /* explcit damage */ diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index b2fe11dc9..e7d9587cc 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -1264,30 +1264,6 @@ void Spell::EffectDummy(uint32 i) m_caster->CastSpell(unitTarget,60934,true,NULL); return; } - - //All IconID Check in there - switch(m_spellInfo->SpellIconID) - { - // Berserking (troll racial traits) - case 1661: - { - uint32 healthPerc = uint32((float(m_caster->GetHealth())/m_caster->GetMaxHealth())*100); - int32 melee_mod = 10; - if (healthPerc <= 40) - melee_mod = 30; - if (healthPerc < 100 && healthPerc > 40) - melee_mod = 10+(100-healthPerc)/3; - - int32 hasteModBasePoints0 = melee_mod; // (EffectBasePoints[0]+1)-1+(5-melee_mod) = (melee_mod-1+1)-1+5-melee_mod = 5-1 - int32 hasteModBasePoints1 = (5-melee_mod); - int32 hasteModBasePoints2 = 5; - - // FIXME: custom spell required this aura state by some unknown reason, we not need remove it anyway - m_caster->ModifyAuraState(AURA_STATE_BERSERKING,true); - m_caster->CastCustomSpell(m_caster, 26635, &hasteModBasePoints0, &hasteModBasePoints1, &hasteModBasePoints2, true, NULL); - return; - } - } break; } case SPELLFAMILY_MAGE: @@ -1604,10 +1580,6 @@ void Spell::EffectDummy(uint32 i) uint32 spellid; switch(m_spellInfo->Id) { - case 781: // player case - target = m_caster; - spellid = 56446; - break; case 57635: spellid = 57636; break; // one from creature cases case 61507: spellid = 61508; break; // one from creature cases default: @@ -1784,55 +1756,6 @@ void Spell::EffectDummy(uint32 i) } break; case SPELLFAMILY_SHAMAN: - // Rockbiter Weapon - if (m_spellInfo->SpellFamilyFlags & 0x400000) - { - // TODO: use expect spell for enchant (if exist talent) - // In 3.0.3 no mods present for rockbiter - uint32 spell_id = 0; - switch(m_spellInfo->Id) - { - case 8017: spell_id = 36494; break; // Rank 1 - case 8018: spell_id = 36750; break; // Rank 2 - case 8019: spell_id = 36755; break; // Rank 3 - case 10399: spell_id = 36759; break; // Rank 4 - default: - sLog.outError("Spell::EffectDummy: Spell %u not handled in RW", m_spellInfo->Id); - return; - } - - SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id); - - if (!spellInfo) - { - sLog.outError("WORLD: unknown spell id %i", spell_id); - return; - } - - if (m_caster->GetTypeId() != TYPEID_PLAYER) - return; - - for(int j = BASE_ATTACK; j <= OFF_ATTACK; ++j) - { - if (Item* item = ((Player*)m_caster)->GetWeaponForAttack(WeaponAttackType(j))) - { - if (item->IsFitToSpellRequirements(m_spellInfo)) - { - Spell *spell = new Spell(m_caster, spellInfo, true); - - // enchanting spell selected by calculated damage-per-sec in enchanting effect - // at calculation applied affect from Elemental Weapons talent - // real enchantment damage-1 - spell->m_currentBasePoints[1] = damage-1; - - SpellCastTargets targets; - targets.setItemTarget( item ); - spell->prepare(&targets); - } - } - } - return; - } // Cleansing Totem if ((m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000004000000)) && m_spellInfo->SpellIconID==1673) { @@ -4051,65 +3974,62 @@ void Spell::EffectEnchantItemTmp(uint32 i) Player* p_caster = (Player*)m_caster; + // Rockbiter Weapon apply to both weapon + if (m_spellInfo->SpellFamilyName == SPELLFAMILY_SHAMAN && m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000400000)) + { + uint32 spell_id = 0; + + // enchanting spell selected by calculated damage-per-sec stored in Effect[1] base value + // Note: damage calculated (correctly) with rounding int32(float(v)) but + // RW enchantments applied damage int32(float(v)+0.5), this create 0..1 difference sometime + switch(damage) + { + // Rank 1 + case 2: spell_id = 36744; break; // 0% [ 7% == 2, 14% == 2, 20% == 2] + // Rank 2 + case 4: spell_id = 36753; break; // 0% [ 7% == 4, 14% == 4] + case 5: spell_id = 36751; break; // 20% + // Rank 3 + case 6: spell_id = 36754; break; // 0% [ 7% == 6, 14% == 6] + case 7: spell_id = 36755; break; // 20% + // Rank 4 + case 9: spell_id = 36761; break; // 0% [ 7% == 6] + case 10: spell_id = 36758; break; // 14% + case 11: spell_id = 36760; break; // 20% + default: + sLog.outError("Spell::EffectEnchantItemTmp: Damage %u not handled in S'RW",damage); + return; + } + + + SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id); + if (!spellInfo) + { + sLog.outError("Spell::EffectEnchantItemTmp: unknown spell id %i", spell_id); + return; + } + + for(int j = BASE_ATTACK; j <= OFF_ATTACK; ++j) + { + if (Item* item = p_caster->GetWeaponForAttack(WeaponAttackType(j))) + { + if (item->IsFitToSpellRequirements(m_spellInfo)) + { + Spell *spell = new Spell(m_caster, spellInfo, true); + SpellCastTargets targets; + targets.setItemTarget( item ); + spell->prepare(&targets); + } + } + } + return; + } + if (!itemTarget) return; uint32 enchant_id = m_spellInfo->EffectMiscValue[i]; - // Shaman Rockbiter Weapon - if (i==0 && m_spellInfo->Effect[1]==SPELL_EFFECT_DUMMY) - { - int32 enchnting_damage = m_currentBasePoints[1]+1; - - // enchanting id selected by calculated damage-per-sec stored in Effect[1] base value - // with already applied percent bonus from Elemental Weapons talent - // Note: damage calculated (correctly) with rounding int32(float(v)) but - // RW enchantments applied damage int32(float(v)+0.5), this create 0..1 difference sometime - switch(enchnting_damage) - { - // Rank 1 - case 2: enchant_id = 29; break; // 0% [ 7% == 2, 14% == 2, 20% == 2] - // Rank 2 - case 4: enchant_id = 6; break; // 0% [ 7% == 4, 14% == 4] - case 5: enchant_id = 3025; break; // 20% - // Rank 3 - case 6: enchant_id = 1; break; // 0% [ 7% == 6, 14% == 6] - case 7: enchant_id = 3027; break; // 20% - // Rank 4 - case 9: enchant_id = 3032; break; // 0% [ 7% == 6] - case 10: enchant_id = 503; break; // 14% - case 11: enchant_id = 3031; break; // 20% - // Rank 5 - case 15: enchant_id = 3035; break; // 0% - case 16: enchant_id = 1663; break; // 7% - case 17: enchant_id = 3033; break; // 14% - case 18: enchant_id = 3034; break; // 20% - // Rank 6 - case 28: enchant_id = 3038; break; // 0% - case 29: enchant_id = 683; break; // 7% - case 31: enchant_id = 3036; break; // 14% - case 33: enchant_id = 3037; break; // 20% - // Rank 7 - case 40: enchant_id = 3041; break; // 0% - case 42: enchant_id = 1664; break; // 7% - case 45: enchant_id = 3039; break; // 14% - case 48: enchant_id = 3040; break; // 20% - // Rank 8 - case 49: enchant_id = 3044; break; // 0% - case 52: enchant_id = 2632; break; // 7% - case 55: enchant_id = 3042; break; // 14% - case 58: enchant_id = 3043; break; // 20% - // Rank 9 - case 62: enchant_id = 2633; break; // 0% - case 66: enchant_id = 3018; break; // 7% - case 70: enchant_id = 3019; break; // 14% - case 74: enchant_id = 3020; break; // 20% - default: - sLog.outError("Spell::EffectEnchantItemTmp: Damage %u not handled in S'RW",enchnting_damage); - return; - } - } - if (!enchant_id) { sLog.outError("Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) have 0 as enchanting id",m_spellInfo->Id,i); From 8ad4f0f10b62492ec204cae8c51b43ea75fc91c4 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 3 Oct 2009 07:12:36 +0400 Subject: [PATCH 124/132] Restore spell 53563 work at 3.2.x --- sql/mangos_spell_check.sql | 3 ++- src/game/SpellAuras.cpp | 19 +++++-------------- src/game/Unit.cpp | 2 +- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/sql/mangos_spell_check.sql b/sql/mangos_spell_check.sql index 0c9a97933..aa401c50f 100644 --- a/sql/mangos_spell_check.sql +++ b/sql/mangos_spell_check.sql @@ -413,4 +413,5 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas /* some random spells from not proccessed files sorted by spell ids */ /*id fm familyMaskA fmMaskB icon vis cat eff aur ef name code */ -(53563,-1, -1, -1, -1, -1, -1, -1, 4,-1,'Beacon of Light', 'Aura::HandleAuraDummy'); /* will outdated in 3.2.x */ +(53563,-1, -1, -1, -1, -1, -1, -1, 23,-1,'Beacon of Light', 'Aura::HandlePeriodicTriggerSpell'), +(53563,-1, -1, -1, -1, -1, -1, -1, 23,-1,'Beacon of Light', 'Unit::HandleDummyAuraProc'); diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index b6618c936..288abc0d5 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -2145,6 +2145,11 @@ void Aura::TriggerSpell() case 33525: target->CastSpell(target, trigger_spell_id, true); return; + // Beacon of Light + case 53563: + // original caster must be target (beacon) + m_target->CastSpell(m_target,trigger_spell_id,true,NULL,this,m_target->GetGUID()); + return; } } @@ -2451,9 +2456,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) break; } case SPELLFAMILY_MAGE: - { break; - } case SPELLFAMILY_PRIEST: { // Pain and Suffering @@ -2477,19 +2480,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) break; } case SPELLFAMILY_PALADIN: - { - // Beacon of Light - if (GetId() == 53563) - { - if(apply) - // original caster must be target (beacon) - m_target->CastSpell(m_target,53651,true,NULL,this,m_target->GetGUID()); - else - m_target->RemoveAurasByCasterSpell(53651,m_target->GetGUID()); - return; - } break; - } case SPELLFAMILY_DRUID: { switch(GetId()) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 7e30563b0..3543837a4 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -5850,7 +5850,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu // find caster main aura at beacon Aura* dummy = NULL; - Unit::AuraList const& baa = beacon->GetAurasByType(SPELL_AURA_DUMMY); + Unit::AuraList const& baa = beacon->GetAurasByType(SPELL_AURA_PERIODIC_TRIGGER_SPELL); for(Unit::AuraList::const_iterator i = baa.begin(); i != baa.end(); ++i) { if ((*i)->GetId() == 53563 && (*i)->GetCasterGUID() == pVictim->GetGUID()) From 9919d899073793b0236d334e66bd52db15c3cce8 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 3 Oct 2009 07:22:46 +0400 Subject: [PATCH 125/132] Fixed some commented cases for later apply in 3.2.x * Allow cast 879 and ranks to players * Add support for spell 67596 from some items added into 3.2.x --- src/game/Spell.cpp | 4 +--- src/game/SpellAuras.cpp | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index ee99c01ed..01699d772 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -5703,9 +5703,7 @@ bool Spell::CheckTargetCreatureType(Unit* target) const uint32 spellCreatureTargetMask = m_spellInfo->TargetCreatureType; // Curse of Doom & Exorcism: not find another way to fix spell target check :/ - if (m_spellInfo->SpellFamilyName==SPELLFAMILY_WARLOCK && m_spellInfo->Category == 1179 || - // TODO: will be removed in 3.2.x - m_spellInfo->SpellFamilyName==SPELLFAMILY_PALADIN && m_spellInfo->Category == 19) + if (m_spellInfo->SpellFamilyName==SPELLFAMILY_WARLOCK && m_spellInfo->Category == 1179) { // not allow cast at player if(target->GetTypeId()==TYPEID_PLAYER) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 288abc0d5..606fd3f9c 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -4991,8 +4991,7 @@ void Aura::HandleAuraModIncreaseHealth(bool apply, bool Real) case 12976: // Warrior Last Stand triggered spell case 28726: // Nightmare Seed ( Nightmare Seed ) case 34511: // Valor (Bulwark of Kings, Bulwark of the Ancient Kings) - // FIXME: add case 67596: in 3.2.x - case 44055: case 55915: case 55917: // Tremendous Fortitude (Battlemaster's Alacrity) + case 44055: case 55915: case 55917: case 67596: // Tremendous Fortitude (Battlemaster's Alacrity) case 50322: // Survival Instincts case 54443: // Demonic Empowerment (Voidwalker) { From 8ad48e86e95b07f7ad86907d8f82fe87dd3af94a Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sat, 3 Oct 2009 11:01:29 +0400 Subject: [PATCH 126/132] Fixed character deletion. --- src/game/SharedDefines.h | 67 ++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 60a9253b3..011ed6f2d 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -2531,42 +2531,43 @@ enum ResponseCodes CHAR_CREATE_CHARACTER_DELETE_MAIL = 0x41, CHAR_CREATE_CHARACTER_SWAP_FACTION = 0x42, CHAR_CREATE_CHARACTER_RACE_ONLY = 0x43, + CHAR_CREATE_CHARACTER_GOLD_LIMIT = 0x44, - CHAR_DELETE_IN_PROGRESS = 0x44, - CHAR_DELETE_SUCCESS = 0x45, - CHAR_DELETE_FAILED = 0x46, - CHAR_DELETE_FAILED_LOCKED_FOR_TRANSFER = 0x47, - CHAR_DELETE_FAILED_GUILD_LEADER = 0x48, - CHAR_DELETE_FAILED_ARENA_CAPTAIN = 0x49, + CHAR_DELETE_IN_PROGRESS = 0x45, + CHAR_DELETE_SUCCESS = 0x46, + CHAR_DELETE_FAILED = 0x47, + CHAR_DELETE_FAILED_LOCKED_FOR_TRANSFER = 0x48, + CHAR_DELETE_FAILED_GUILD_LEADER = 0x49, + CHAR_DELETE_FAILED_ARENA_CAPTAIN = 0x4A, - CHAR_LOGIN_IN_PROGRESS = 0x4A, - CHAR_LOGIN_SUCCESS = 0x4B, - CHAR_LOGIN_NO_WORLD = 0x4C, - CHAR_LOGIN_DUPLICATE_CHARACTER = 0x4D, - CHAR_LOGIN_NO_INSTANCES = 0x4E, - CHAR_LOGIN_FAILED = 0x4F, - CHAR_LOGIN_DISABLED = 0x50, - CHAR_LOGIN_NO_CHARACTER = 0x51, - CHAR_LOGIN_LOCKED_FOR_TRANSFER = 0x52, - CHAR_LOGIN_LOCKED_BY_BILLING = 0x53, + CHAR_LOGIN_IN_PROGRESS = 0x4B, + CHAR_LOGIN_SUCCESS = 0x4C, + CHAR_LOGIN_NO_WORLD = 0x4D, + CHAR_LOGIN_DUPLICATE_CHARACTER = 0x4E, + CHAR_LOGIN_NO_INSTANCES = 0x4F, + CHAR_LOGIN_FAILED = 0x50, + CHAR_LOGIN_DISABLED = 0x51, + CHAR_LOGIN_NO_CHARACTER = 0x52, + CHAR_LOGIN_LOCKED_FOR_TRANSFER = 0x53, + CHAR_LOGIN_LOCKED_BY_BILLING = 0x54, - CHAR_NAME_SUCCESS = 0x54, - CHAR_NAME_FAILURE = 0x55, - CHAR_NAME_NO_NAME = 0x56, - CHAR_NAME_TOO_SHORT = 0x57, - CHAR_NAME_TOO_LONG = 0x58, - CHAR_NAME_INVALID_CHARACTER = 0x59, - CHAR_NAME_MIXED_LANGUAGES = 0x5A, - CHAR_NAME_PROFANE = 0x5B, - CHAR_NAME_RESERVED = 0x5C, - CHAR_NAME_INVALID_APOSTROPHE = 0x5D, - CHAR_NAME_MULTIPLE_APOSTROPHES = 0x5E, - CHAR_NAME_THREE_CONSECUTIVE = 0x5F, - CHAR_NAME_INVALID_SPACE = 0x60, - CHAR_NAME_CONSECUTIVE_SPACES = 0x61, - CHAR_NAME_RUSSIAN_CONSECUTIVE_SILENT_CHARACTERS = 0x62, - CHAR_NAME_RUSSIAN_SILENT_CHARACTER_AT_BEGINNING_OR_END = 0x63, - CHAR_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME = 0x64 + CHAR_NAME_SUCCESS = 0x55, + CHAR_NAME_FAILURE = 0x56, + CHAR_NAME_NO_NAME = 0x57, + CHAR_NAME_TOO_SHORT = 0x58, + CHAR_NAME_TOO_LONG = 0x59, + CHAR_NAME_INVALID_CHARACTER = 0x5A, + CHAR_NAME_MIXED_LANGUAGES = 0x5B, + CHAR_NAME_PROFANE = 0x5C, + CHAR_NAME_RESERVED = 0x5D, + CHAR_NAME_INVALID_APOSTROPHE = 0x5E, + CHAR_NAME_MULTIPLE_APOSTROPHES = 0x5F, + CHAR_NAME_THREE_CONSECUTIVE = 0x60, + CHAR_NAME_INVALID_SPACE = 0x61, + CHAR_NAME_CONSECUTIVE_SPACES = 0x62, + CHAR_NAME_RUSSIAN_CONSECUTIVE_SILENT_CHARACTERS = 0x63, + CHAR_NAME_RUSSIAN_SILENT_CHARACTER_AT_BEGINNING_OR_END = 0x64, + CHAR_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME = 0x65 }; /// Ban function modes From 8b07b82b931d9f9fff4a2e1b93119683308f6289 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 3 Oct 2009 23:05:44 +0400 Subject: [PATCH 127/132] Renumbering sql/320 sql updates --- sql/320/{1_creature_template.sql => 01_creature_template.sql} | 0 sql/320/{2_gameobject_template.sql => 02_gameobject_template.sql} | 0 sql/320/{3_item_template.sql => 03_item_template.sql} | 0 sql/320/{4_groups.sql => 04_groups.sql} | 0 .../{5_battleground_template.sql => 05_battleground_template.sql} | 0 sql/320/{5_bugreport.sql => 06_bugreport.sql} | 0 sql/320/{6_spell_elixir.sql => 07_spell_elixir.sql} | 0 sql/320/{7_item_template.sql => 08_item_template.sql} | 0 sql/320/{8_spell_chain.sql => 09_spell_chain.sql} | 0 sql/320/{9_spell_proc_event.sql => 10_spell_proc_event.sql} | 0 10 files changed, 0 insertions(+), 0 deletions(-) rename sql/320/{1_creature_template.sql => 01_creature_template.sql} (100%) rename sql/320/{2_gameobject_template.sql => 02_gameobject_template.sql} (100%) rename sql/320/{3_item_template.sql => 03_item_template.sql} (100%) rename sql/320/{4_groups.sql => 04_groups.sql} (100%) rename sql/320/{5_battleground_template.sql => 05_battleground_template.sql} (100%) rename sql/320/{5_bugreport.sql => 06_bugreport.sql} (100%) rename sql/320/{6_spell_elixir.sql => 07_spell_elixir.sql} (100%) rename sql/320/{7_item_template.sql => 08_item_template.sql} (100%) rename sql/320/{8_spell_chain.sql => 09_spell_chain.sql} (100%) rename sql/320/{9_spell_proc_event.sql => 10_spell_proc_event.sql} (100%) diff --git a/sql/320/1_creature_template.sql b/sql/320/01_creature_template.sql similarity index 100% rename from sql/320/1_creature_template.sql rename to sql/320/01_creature_template.sql diff --git a/sql/320/2_gameobject_template.sql b/sql/320/02_gameobject_template.sql similarity index 100% rename from sql/320/2_gameobject_template.sql rename to sql/320/02_gameobject_template.sql diff --git a/sql/320/3_item_template.sql b/sql/320/03_item_template.sql similarity index 100% rename from sql/320/3_item_template.sql rename to sql/320/03_item_template.sql diff --git a/sql/320/4_groups.sql b/sql/320/04_groups.sql similarity index 100% rename from sql/320/4_groups.sql rename to sql/320/04_groups.sql diff --git a/sql/320/5_battleground_template.sql b/sql/320/05_battleground_template.sql similarity index 100% rename from sql/320/5_battleground_template.sql rename to sql/320/05_battleground_template.sql diff --git a/sql/320/5_bugreport.sql b/sql/320/06_bugreport.sql similarity index 100% rename from sql/320/5_bugreport.sql rename to sql/320/06_bugreport.sql diff --git a/sql/320/6_spell_elixir.sql b/sql/320/07_spell_elixir.sql similarity index 100% rename from sql/320/6_spell_elixir.sql rename to sql/320/07_spell_elixir.sql diff --git a/sql/320/7_item_template.sql b/sql/320/08_item_template.sql similarity index 100% rename from sql/320/7_item_template.sql rename to sql/320/08_item_template.sql diff --git a/sql/320/8_spell_chain.sql b/sql/320/09_spell_chain.sql similarity index 100% rename from sql/320/8_spell_chain.sql rename to sql/320/09_spell_chain.sql diff --git a/sql/320/9_spell_proc_event.sql b/sql/320/10_spell_proc_event.sql similarity index 100% rename from sql/320/9_spell_proc_event.sql rename to sql/320/10_spell_proc_event.sql From 4e4e9b0c7873a84d2d6300a16b3183513aacab37 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 4 Oct 2009 01:44:48 +0400 Subject: [PATCH 128/132] Character data field convertor. --- sql/320/11_characters.sql | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 sql/320/11_characters.sql diff --git a/sql/320/11_characters.sql b/sql/320/11_characters.sql new file mode 100644 index 000000000..d4230084d --- /dev/null +++ b/sql/320/11_characters.sql @@ -0,0 +1,15 @@ +UPDATE characters SET data = REPLACE(data,' ',' '); +UPDATE characters SET data = CONCAT(TRIM(data),' '); + +UPDATE `characters` SET `data` = CONCAT( + SUBSTRING_INDEX(`data`, ' ', 1167 + 1), ' ', + '0 0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 1246 + 1), ' ', -1246 + 1168 - 1), ' ', + '0 0 0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 1294 + 1), ' ', -1294 + 1247 - 1), ' ', + '0 ' + ) +WHERE length(SUBSTRING_INDEX(data, ' ', 1294)) < length(data) and length(SUBSTRING_INDEX(data, ' ', 1294+1)) >= length(data); + +UPDATE characters SET data = REPLACE(data,' ',' '); +UPDATE characters SET data = CONCAT(TRIM(data),' '); From a6c04f166766d8dfbb8a47728f0b378730a26ffe Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sun, 4 Oct 2009 10:46:19 +0400 Subject: [PATCH 129/132] - Fixed arena petitions (not tested). --- src/game/PetitionsHandler.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/game/PetitionsHandler.cpp b/src/game/PetitionsHandler.cpp index 6c4918465..27b79aef5 100644 --- a/src/game/PetitionsHandler.cpp +++ b/src/game/PetitionsHandler.cpp @@ -211,7 +211,6 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) if (result) { - do { Field *fields = result->Fetch(); @@ -331,11 +330,11 @@ void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid) return; } - WorldPacket data(SMSG_PETITION_QUERY_RESPONSE, (4+8+name.size()+1+1+4*13)); - data << GUID_LOPART(petitionguid); // guild/team guid (in mangos always same as GUID_LOPART(petition guid) - data << ownerguid; // charter owner guid + WorldPacket data(SMSG_PETITION_QUERY_RESPONSE, (4+8+name.size()+1+1+4*12+2+10)); + data << uint32(GUID_LOPART(petitionguid)); // guild/team guid (in mangos always same as GUID_LOPART(petition guid) + data << uint64(ownerguid); // charter owner guid data << name; // name (guild/arena team) - data << uint8(0); // 1 + data << uint8(0); // some string if(type == 9) { data << uint32(9); @@ -356,11 +355,17 @@ void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid) data << uint32(0); // 10 data << uint32(0); // 11 data << uint32(0); // 13 count of next strings? + + for(int i = 0; i < 10; ++i) + data << uint8(0); // some string + data << uint32(0); // 14 + if(type == 9) data << uint32(0); // 15 0 - guild, 1 - arena team else data << uint32(1); + SendPacket(&data); } From 3193896935f4f3d96be950e20551fe1c579f620e Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sun, 4 Oct 2009 11:22:21 +0400 Subject: [PATCH 130/132] Some changes from 3.3.0, that applies to 3.2.2 as well. --- src/game/DBCStructure.h | 2 ++ src/game/GossipDef.cpp | 14 ++++++++------ src/game/QueryHandler.cpp | 12 ++++-------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index 7f563e831..2f0c82aa4 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -1131,6 +1131,8 @@ struct MapDifficultyEntry char* areaTriggerText[16]; // 3-18 text showed when transfer to map failed (missing requirements) uint32 textFlags; // 19 uint32 resetTime; // 20 + uint32 maxPlayers; // 21 + char* difficultyString; // 22 }; struct MovieEntry diff --git a/src/game/GossipDef.cpp b/src/game/GossipDef.cpp index ab229d9f1..7a221a59f 100644 --- a/src/game/GossipDef.cpp +++ b/src/game/GossipDef.cpp @@ -545,13 +545,13 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest ) WorldPacket data( SMSG_QUEST_QUERY_RESPONSE, 100 ); // guess size - data << uint32(pQuest->GetQuestId()); + data << uint32(pQuest->GetQuestId()); // quest id data << uint32(pQuest->GetQuestMethod()); // Accepted values: 0, 1 or 2. 0==IsAutoComplete() (skip objectives/details) data << uint32(pQuest->GetQuestLevel()); // may be 0, static data, in other cases must be used dynamic level: Player::GetQuestLevel data << uint32(pQuest->GetZoneOrSort()); // zone or sort to display in quest log - data << uint32(pQuest->GetType()); - data << uint32(pQuest->GetSuggestedPlayers()); + data << uint32(pQuest->GetType()); // quest type + data << uint32(pQuest->GetSuggestedPlayers()); // suggested players count data << uint32(pQuest->GetRepObjectiveFaction()); // shown in quest log as part of quest objective data << uint32(pQuest->GetRepObjectiveValue()); // shown in quest log as part of quest objective @@ -564,7 +564,7 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest ) if (pQuest->HasFlag(QUEST_FLAGS_HIDDEN_REWARDS)) data << uint32(0); // Hide money rewarded else - data << uint32(pQuest->GetRewOrReqMoney()); + data << uint32(pQuest->GetRewOrReqMoney()); // reward money (below max lvl) data << uint32(pQuest->GetRewMoneyMaxLevel()); // used in XP calculation at client data << uint32(pQuest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast==0) @@ -572,8 +572,8 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest ) // rewarded honor points data << uint32(MaNGOS::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills())); - data << uint32(pQuest->GetSrcItemId()); - data << uint32(pQuest->GetFlags() & 0xFFFF); + data << uint32(pQuest->GetSrcItemId()); // source item id + data << uint32(pQuest->GetFlags() & 0xFFFF); // quest flags data << uint32(pQuest->GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles) data << uint32(pQuest->GetPlayersSlain()); // players slain data << uint32(pQuest->GetBonusTalents()); // bonus talents @@ -634,6 +634,8 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest ) data << uint32(0); // TODO: 5 item objective data << uint32(0); + data << uint32(0); // TODO: 6 item objective + data << uint32(0); for (iI = 0; iI < QUEST_OBJECTIVES_COUNT; ++iI) data << ObjectiveText[iI]; diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp index 041e81b5d..e7ae81462 100644 --- a/src/game/QueryHandler.cpp +++ b/src/game/QueryHandler.cpp @@ -150,7 +150,8 @@ void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data ) { uint32 entry; recv_data >> entry; - recv_data.read_skip(); // guid + uint64 guid; + recv_data >> guid; CreatureInfo const *ci = objmgr.GetCreatureTemplate(entry); if (ci) @@ -201,9 +202,6 @@ void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data ) } else { - uint64 guid; - recv_data >> guid; - sLog.outDebug("WORLD: CMSG_CREATURE_QUERY - NO CREATURE INFO! (GUID: %u, ENTRY: %u)", GUID_LOPART(guid), entry); WorldPacket data( SMSG_CREATURE_QUERY_RESPONSE, 4 ); @@ -218,7 +216,8 @@ void WorldSession::HandleGameObjectQueryOpcode( WorldPacket & recv_data ) { uint32 entryID; recv_data >> entryID; - recv_data.read_skip(); // guid + uint64 guid; + recv_data >> guid; const GameObjectInfo *info = objmgr.GetGameObjectInfo(entryID); if(info) @@ -262,9 +261,6 @@ void WorldSession::HandleGameObjectQueryOpcode( WorldPacket & recv_data ) } else { - uint64 guid; - recv_data >> guid; - sLog.outDebug( "WORLD: CMSG_GAMEOBJECT_QUERY - Missing gameobject info for (GUID: %u, ENTRY: %u)", GUID_LOPART(guid), entryID ); WorldPacket data ( SMSG_GAMEOBJECT_QUERY_RESPONSE, 4 ); From 9850551751b23118610cc0989fa3ac062bbd21c7 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 4 Oct 2009 19:46:36 +0400 Subject: [PATCH 131/132] Small cleanupas in petition code. --- src/game/PetitionsHandler.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/game/PetitionsHandler.cpp b/src/game/PetitionsHandler.cpp index 27b79aef5..4deaf34d6 100644 --- a/src/game/PetitionsHandler.cpp +++ b/src/game/PetitionsHandler.cpp @@ -51,7 +51,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) recv_data.hexlike(); uint64 guidNPC; - uint32 unk2; + uint32 clientIndex; // 1 for guild and arenaslot+1 for arenas in client std::string name; recv_data >> guidNPC; // NPC GUID @@ -74,7 +74,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) for (int i = 0; i < 10; ++i) recv_data.read_skip(); - recv_data >> unk2; // index + recv_data >> clientIndex; // index recv_data.read_skip(); // 0 sLog.outDebug("Petitioner with GUID %u tried sell petition: name %s", GUID_LOPART(guidNPC), name.c_str()); @@ -114,7 +114,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) return; } - switch(unk2) + switch(clientIndex) // arenaSlot+1 as received from client (1 from 3 case) { case 1: charterid = ARENA_TEAM_CHARTER_2v2; @@ -132,11 +132,11 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) type = 5; // 5v5 break; default: - sLog.outDebug("unknown selection at buy petition: %u", unk2); + sLog.outDebug("unknown selection at buy arena petition: %u", clientIndex); return; } - if(_player->GetArenaTeamId(unk2 - 1)) + if(_player->GetArenaTeamId(clientIndex - 1)) // arenaSlot+1 as received from client { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ALREADY_IN_ARENA_TEAM); return; @@ -343,9 +343,9 @@ void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid) } else { - data << type-1; - data << type-1; - data << type; // bypass client - side limitation, a different value is needed here for each petition + data << uint32(type-1); + data << uint32(type-1); + data << uint32(type); // bypass client - side limitation, a different value is needed here for each petition } data << uint32(0); // 5 data << uint32(0); // 6 From a9af7f2b1cb39cd47ac0f20307ac35ed6c759dbe Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 5 Oct 2009 02:04:33 +0400 Subject: [PATCH 132/132] Use reset time for normal/heroic from new DBC. Improve basic support for raid difficalties. --- src/game/AchievementMgr.cpp | 6 +-- src/game/AchievementMgr.h | 4 +- src/game/CalendarHandler.cpp | 2 +- src/game/DBCStores.cpp | 29 +++++++++-- src/game/DBCStores.h | 3 ++ src/game/DBCStructure.h | 21 +++++--- src/game/DBCfmt.h | 1 + src/game/Group.cpp | 95 ++++++++++++++++++++++++++---------- src/game/Group.h | 23 +++++---- src/game/InstanceSaveMgr.cpp | 31 +++++++----- src/game/InstanceSaveMgr.h | 10 ++-- src/game/Level1.cpp | 9 ++-- src/game/Level3.cpp | 14 +++--- src/game/Map.cpp | 8 +-- src/game/Map.h | 2 +- src/game/MapInstanced.cpp | 12 +++-- src/game/MapInstanced.h | 2 +- src/game/MapManager.cpp | 10 +++- src/game/MiscHandler.cpp | 56 +++++++++++++-------- src/game/MovementHandler.cpp | 17 +++++-- src/game/ObjectMgr.cpp | 33 +++++++++---- src/game/Player.cpp | 73 +++++++++++++++++---------- src/game/Player.h | 31 ++++++------ src/game/SharedDefines.h | 21 ++++---- 24 files changed, 340 insertions(+), 173 deletions(-) diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp index 2b816aa53..b21bb0571 100644 --- a/src/game/AchievementMgr.cpp +++ b/src/game/AchievementMgr.cpp @@ -196,10 +196,10 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) } return true; case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY: - if (difficalty.difficalty >= TOTAL_DUNGEON_DIFFICULTIES) + if (difficulty.difficulty >= MAX_DIFFICULTY) { sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY (%u) have wrong difficulty in value1 (%u), ignore.", - criteria->ID, criteria->requiredType,dataType,difficalty.difficalty); + criteria->ID, criteria->requiredType,dataType,difficulty.difficulty); return false; } return true; @@ -294,7 +294,7 @@ bool AchievementCriteriaData::Meets(Player const* source, Unit const* target, ui case ACHIEVEMENT_CRITERIA_DATA_TYPE_DISABLED: return false; // always fail case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY: - return source->GetMap()->GetSpawnMode()==difficalty.difficalty; + return source->GetMap()->GetSpawnMode()==difficulty.difficulty; case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT: return source->GetMap()->GetPlayersCountExceptGMs() <= map_players.maxcount; case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM: diff --git a/src/game/AchievementMgr.h b/src/game/AchievementMgr.h index d0b0b90a5..eedd74700 100644 --- a/src/game/AchievementMgr.h +++ b/src/game/AchievementMgr.h @@ -125,8 +125,8 @@ struct AchievementCriteriaData // ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY = 12 struct { - uint32 difficalty; - } difficalty; + uint32 difficulty; + } difficulty; // ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT = 13 struct { diff --git a/src/game/CalendarHandler.cpp b/src/game/CalendarHandler.cpp index c5287a767..84c4c5aab 100644 --- a/src/game/CalendarHandler.cpp +++ b/src/game/CalendarHandler.cpp @@ -44,7 +44,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket &recv_data) size_t p_counter = data.wpos(); data << uint32(counter); // instance save count - for(int i = 0; i < TOTAL_DUNGEON_DIFFICULTIES; ++i) + for(int i = 0; i < MAX_DIFFICULTY; ++i) { for (Player::BoundInstancesMap::const_iterator itr = _player->m_boundInstances[i].begin(); itr != _player->m_boundInstances[i].end(); ++itr) { diff --git a/src/game/DBCStores.cpp b/src/game/DBCStores.cpp index 9050a1b52..62782159b 100644 --- a/src/game/DBCStores.cpp +++ b/src/game/DBCStores.cpp @@ -96,6 +96,12 @@ DBCStorage sLockStore(LockEntryfmt); DBCStorage sMailTemplateStore(MailTemplateEntryfmt); DBCStorage sMapStore(MapEntryfmt); + +// DBC used only for initialization sMapDifficultyMap at startup. +DBCStorage sMapDifficultyStore(MapDifficultyEntryfmt); // only for loading +typedef std::map MapDifficultyMap; +MapDifficultyMap sMapDifficultyMap; + DBCStorage sMovieStore(MovieEntryfmt); DBCStorage sQuestSortStore(QuestSortEntryfmt); @@ -129,7 +135,7 @@ TalentSpellPosMap sTalentSpellPosMap; DBCStorage sTalentTabStore(TalentTabEntryfmt); // store absolute bit position for first rank for talent inspect -static uint32 sTalentTabPages[12/*MAX_CLASSES*/][3]; +static uint32 sTalentTabPages[MAX_CLASSES][3]; DBCStorage sTaxiNodesStore(TaxiNodesEntryfmt); TaxiMask sTaxiNodesMask; @@ -139,10 +145,10 @@ TaxiMask sOldContinentsNodesMask; TaxiPathSetBySource sTaxiPathSetBySource; DBCStorage sTaxiPathStore(TaxiPathEntryfmt); -// DBC used only for initialization sTaxiPathSetBySource at startup. +// DBC used only for initialization sTaxiPathNodeStore at startup. TaxiPathNodesByPath sTaxiPathNodesByPath; - static DBCStorage sTaxiPathNodeStore(TaxiPathNodeEntryfmt); + DBCStorage sTotemCategoryStore(TotemCategoryEntryfmt); DBCStorage sVehicleStore(VehicleEntryfmt); DBCStorage sVehicleSeatStore(VehicleSeatEntryfmt); @@ -200,7 +206,7 @@ void LoadDBCStores(const std::string& dataPath) { std::string dbcPath = dataPath+"dbc/"; - const uint32 DBCFilesCount = 79; + const uint32 DBCFilesCount = 80; barGoLink bar( DBCFilesCount ); @@ -232,7 +238,6 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales,bar,bad_dbc_files,sBattlemasterListStore, dbcPath,"BattlemasterList.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sBarberShopStyleStore, dbcPath,"BarberShopStyle.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sCharStartOutfitStore, dbcPath,"CharStartOutfit.dbc"); - LoadDBC(availableDbcLocales,bar,bad_dbc_files,sCharTitlesStore, dbcPath,"CharTitles.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sChatChannelsStore, dbcPath,"ChatChannels.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sChrClassesStore, dbcPath,"ChrClasses.dbc"); @@ -290,6 +295,14 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales,bar,bad_dbc_files,sLockStore, dbcPath,"Lock.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sMailTemplateStore, dbcPath,"MailTemplate.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sMapStore, dbcPath,"Map.dbc"); + + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sMapDifficultyStore, dbcPath,"MapDifficulty.dbc"); + // fill data + for(uint32 i = 1; i < sMapDifficultyStore.GetNumRows(); ++i) + if(MapDifficultyEntry const* entry = sMapDifficultyStore.LookupEntry(i)) + sMapDifficultyMap[MAKE_PAIR32(entry->MapId,entry->Difficulty)] = MapDifficulty(entry->resetTime,entry->maxPlayers); + sMapDifficultyStore.Clear(); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sMovieStore, dbcPath,"Movie.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sQuestSortStore, dbcPath,"QuestSort.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sRandomPropertiesPointsStore, dbcPath,"RandPropPoints.dbc"); @@ -659,6 +672,12 @@ void Map2ZoneCoordinates(float& x,float& y,uint32 zone) std::swap(x,y); // client have map coords swapped } +MapDifficulty const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty) +{ + MapDifficultyMap::const_iterator itr = sMapDifficultyMap.find(MAKE_PAIR32(mapId,difficulty)); + return itr != sMapDifficultyMap.end() ? &itr->second : NULL; +} + uint32 const* GetTalentTabPages(uint32 cls) { return sTalentTabPages[cls]; diff --git a/src/game/DBCStores.h b/src/game/DBCStores.h index b41a3c94e..4a4761620 100644 --- a/src/game/DBCStores.h +++ b/src/game/DBCStores.h @@ -54,6 +54,8 @@ bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredT void Zone2MapCoordinates(float& x,float& y,uint32 zone); void Map2ZoneCoordinates(float& x,float& y,uint32 zone); +MapDifficulty const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty); + uint32 const* /*[3]*/ GetTalentTabPages(uint32 cls); extern DBCStorage sAchievementStore; @@ -109,6 +111,7 @@ extern DBCStorage sItemSetStore; extern DBCStorage sLockStore; extern DBCStorage sMailTemplateStore; extern DBCStorage sMapStore; +//extern DBCStorage sMapDifficultyStore; -- use GetMapDifficultyData insteed extern DBCStorage sMovieStore; extern DBCStorage sQuestSortStore; extern DBCStorage sRandomPropertiesPointsStore; diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index 2f0c82aa4..ce364eba9 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -1105,8 +1105,6 @@ struct MapEntry bool IsBattleGround() const { return map_type == MAP_BATTLEGROUND; } bool IsBattleArena() const { return map_type == MAP_ARENA; } bool IsBattleGroundOrArena() const { return map_type == MAP_BATTLEGROUND || map_type == MAP_ARENA; } - bool SupportsHeroicMode() const { return true; } - bool HasResetTime() const { return true; } bool IsMountAllowed() const { @@ -1125,14 +1123,14 @@ struct MapEntry struct MapDifficultyEntry { - uint32 Id; // 0 + //uint32 Id; // 0 uint32 MapId; // 1 - uint32 Difficulty; // 2 - char* areaTriggerText[16]; // 3-18 text showed when transfer to map failed (missing requirements) - uint32 textFlags; // 19 + uint32 Difficulty; // 2 (for arenas: arena slot) + //char* areaTriggerText[16]; // 3-18 text showed when transfer to map failed (missing requirements) + //uint32 textFlags; // 19 uint32 resetTime; // 20 uint32 maxPlayers; // 21 - char* difficultyString; // 22 + //char* difficultyString; // 22 }; struct MovieEntry @@ -1769,6 +1767,15 @@ struct WorldSafeLocsEntry #endif // Structures not used for casting to loaded DBC data and not required then packing +struct MapDifficulty +{ + MapDifficulty() : resetTime(0), maxPlayers(0) {} + MapDifficulty(uint32 _resetTime, uint32 _maxPlayers) : resetTime(_resetTime), maxPlayers(_maxPlayers) {} + + uint32 resetTime; + uint32 maxPlayers; +}; + struct TalentSpellPos { TalentSpellPos() : talent_id(0), rank(0) {} diff --git a/src/game/DBCfmt.h b/src/game/DBCfmt.h index 3a5c2e5cf..32c18ecfa 100644 --- a/src/game/DBCfmt.h +++ b/src/game/DBCfmt.h @@ -73,6 +73,7 @@ const char ItemSetEntryfmt[]="dssssssssssssssssxxxxxxxxxxxxxxxxxxiiiiiiiiiiiiiii const char LockEntryfmt[]="niiiiiiiiiiiiiiiiiiiiiiiixxxxxxxx"; const char MailTemplateEntryfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; const char MapEntryfmt[]="nxixssssssssssssssssxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixiffxixx"; +const char MapDifficultyEntryfmt[]="diixxxxxxxxxxxxxxxxxiix"; const char MovieEntryfmt[]="nxx"; const char QuestSortEntryfmt[]="nxxxxxxxxxxxxxxxxx"; const char RandomPropertiesPointsfmt[]="niiiiiiiiiiiiiii"; diff --git a/src/game/Group.cpp b/src/game/Group.cpp index f9b616fcd..7edee6eb1 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -69,7 +69,7 @@ Group::~Group() // it is undefined whether objectmgr (which stores the groups) or instancesavemgr // will be unloaded first so we must be prepared for both cases // this may unload some instance saves - for(uint8 i = 0; i < TOTAL_DUNGEON_DIFFICULTIES; ++i) + for(uint8 i = 0; i < MAX_DIFFICULTY; ++i) for(BoundInstancesMap::iterator itr2 = m_boundInstances[i].begin(); itr2 != m_boundInstances[i].end(); ++itr2) itr2->second.save->RemoveGroup(this); @@ -112,7 +112,7 @@ bool Group::Create(const uint64 &guid, const char * name) CharacterDatabase.PExecute("INSERT INTO groups (leaderGuid,mainTank,mainAssistant,lootMethod,looterGuid,lootThreshold,icon1,icon2,icon3,icon4,icon5,icon6,icon7,icon8,isRaid,difficulty,raiddifficulty) " "VALUES ('%u','%u','%u','%u','%u','%u','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','%u','%u','%u')", GUID_LOPART(m_leaderGuid), GUID_LOPART(m_mainTank), GUID_LOPART(m_mainAssistant), uint32(m_lootMethod), - GUID_LOPART(m_looterGuid), uint32(m_lootThreshold), m_targetIcons[0], m_targetIcons[1], m_targetIcons[2], m_targetIcons[3], m_targetIcons[4], m_targetIcons[5], m_targetIcons[6], m_targetIcons[7], isRaidGroup(), m_dungeonDifficulty, m_raidDifficulty); + GUID_LOPART(m_looterGuid), uint32(m_lootThreshold), m_targetIcons[0], m_targetIcons[1], m_targetIcons[2], m_targetIcons[3], m_targetIcons[4], m_targetIcons[5], m_targetIcons[6], m_targetIcons[7], isRaidGroup(), uint32(m_dungeonDifficulty), m_raidDifficulty); } if(!AddMember(guid, name)) @@ -152,8 +152,16 @@ bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult *result, bool if (m_groupType == GROUPTYPE_RAID) _initRaidSubGroupsCounter(); - m_dungeonDifficulty = (*result)[14].GetUInt8(); - m_raidDifficulty = (*result)[15].GetUInt8(); + uint32 diff = (*result)[14].GetUInt8(); + if (diff >= MAX_DUNGEON_DIFFICULTY) + diff = DUNGEON_DIFFICULTY_NORMAL; + m_dungeonDifficulty = Difficulty(diff); + + uint32 r_diff = (*result)[15].GetUInt8(); + if (r_diff >= MAX_RAID_DIFFICULTY) + r_diff = RAID_DIFFICULTY_10MAN_NORMAL; + m_raidDifficulty = Difficulty(r_diff); + m_mainTank = (*result)[0].GetUInt64(); m_mainAssistant = (*result)[1].GetUInt64(); m_lootMethod = (LootMethod)(*result)[2].GetUInt8(); @@ -295,12 +303,21 @@ bool Group::AddMember(const uint64 &guid, const char* name) { // reset the new member's instances, unless he is currently in one of them // including raid/heroic instances that they are not permanently bound to! - player->ResetInstances(INSTANCE_RESET_GROUP_JOIN); + player->ResetInstances(INSTANCE_RESET_GROUP_JOIN,false); + player->ResetInstances(INSTANCE_RESET_GROUP_JOIN,true); - if(player->getLevel() >= LEVELREQUIREMENT_HEROIC && player->GetDungeonDifficulty() != GetDungeonDifficulty() ) + if (player->getLevel() >= LEVELREQUIREMENT_HEROIC) { - player->SetDungeonDifficulty(m_dungeonDifficulty); - player->SendDungeonDifficulty(true); + if (player->GetDungeonDifficulty() != GetDungeonDifficulty()) + { + player->SetDungeonDifficulty(GetDungeonDifficulty()); + player->SendDungeonDifficulty(true); + } + if (player->GetRaidDifficulty() != GetRaidDifficulty()) + { + player->SetRaidDifficulty(GetRaidDifficulty()); + player->SendRaidDifficulty(true); + } } } player->SetGroupUpdateFlag(GROUP_UPDATE_FULL); @@ -443,7 +460,8 @@ void Group::Disband(bool hideDestroy) CharacterDatabase.PExecute("DELETE FROM groups WHERE leaderGuid='%u'", GUID_LOPART(m_leaderGuid)); CharacterDatabase.PExecute("DELETE FROM group_member WHERE leaderGuid='%u'", GUID_LOPART(m_leaderGuid)); CharacterDatabase.CommitTransaction(); - ResetInstances(INSTANCE_RESET_GROUP_DISBAND, NULL); + ResetInstances(INSTANCE_RESET_GROUP_DISBAND, false, NULL); + ResetInstances(INSTANCE_RESET_GROUP_DISBAND, true, NULL); } m_leaderGuid = 0; @@ -1079,7 +1097,7 @@ bool Group::_addMember(const uint64 &guid, const char* name, bool isAssistant, u else player->SetGroup(this, group); // if the same group invites the player back, cancel the homebind timer - InstanceGroupBind *bind = GetBoundInstance(player->GetMapId(), player->GetDungeonDifficulty()); + InstanceGroupBind *bind = GetBoundInstance(player); if(bind && bind->save->GetInstanceId() == player->GetInstanceId()) player->m_InstanceValid = true; } @@ -1165,7 +1183,7 @@ void Group::_setLeader(const uint64 &guid) Player *player = objmgr.GetPlayer(slot->guid); if(player) { - for(uint8 i = 0; i < TOTAL_DUNGEON_DIFFICULTIES; ++i) + for(uint8 i = 0; i < MAX_DIFFICULTY; ++i) { for(BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end();) { @@ -1452,10 +1470,11 @@ void Roll::targetObjectBuildLink() getTarget()->addLootValidatorRef(this); } -void Group::SetDungeonDifficulty(uint8 difficulty) +void Group::SetDungeonDifficulty(Difficulty difficulty) { m_dungeonDifficulty = difficulty; - if(!isBGGroup()) CharacterDatabase.PExecute("UPDATE groups SET difficulty = %u WHERE leaderGuid ='%u'", m_dungeonDifficulty, GUID_LOPART(m_leaderGuid)); + if(!isBGGroup()) + CharacterDatabase.PExecute("UPDATE groups SET difficulty = %u WHERE leaderGuid ='%u'", m_dungeonDifficulty, GUID_LOPART(m_leaderGuid)); for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) { @@ -1467,10 +1486,11 @@ void Group::SetDungeonDifficulty(uint8 difficulty) } } -void Group::SetRaidDifficulty(uint8 difficulty) +void Group::SetRaidDifficulty(Difficulty difficulty) { m_raidDifficulty = difficulty; - if(!isBGGroup()) CharacterDatabase.PExecute("UPDATE groups SET raiddifficulty = %u WHERE leaderGuid ='%u'", m_raidDifficulty, GUID_LOPART(m_leaderGuid)); + if(!isBGGroup()) + CharacterDatabase.PExecute("UPDATE groups SET raiddifficulty = %u WHERE leaderGuid ='%u'", m_raidDifficulty, GUID_LOPART(m_leaderGuid)); for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) { @@ -1493,7 +1513,7 @@ bool Group::InCombatToInstance(uint32 instanceId) return false; } -void Group::ResetInstances(uint8 method, Player* SendMsgTo) +void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo) { if(isBGGroup()) return; @@ -1501,13 +1521,13 @@ void Group::ResetInstances(uint8 method, Player* SendMsgTo) // method can be INSTANCE_RESET_ALL, INSTANCE_RESET_CHANGE_DIFFICULTY, INSTANCE_RESET_GROUP_DISBAND // we assume that when the difficulty changes, all instances that can be reset will be - uint8 dif = GetDungeonDifficulty(); + Difficulty diff = GetDifficulty(isRaid); - for(BoundInstancesMap::iterator itr = m_boundInstances[dif].begin(); itr != m_boundInstances[dif].end();) + for(BoundInstancesMap::iterator itr = m_boundInstances[diff].begin(); itr != m_boundInstances[diff].end();) { InstanceSave *p = itr->second.save; const MapEntry *entry = sMapStore.LookupEntry(itr->first); - if(!entry || (!p->CanReset() && method != INSTANCE_RESET_GROUP_DISBAND)) + if(!entry || entry->IsRaid() != isRaid || !p->CanReset() && method != INSTANCE_RESET_GROUP_DISBAND) { ++itr; continue; @@ -1516,7 +1536,7 @@ void Group::ResetInstances(uint8 method, Player* SendMsgTo) if(method == INSTANCE_RESET_ALL) { // the "reset all instances" method can only reset normal maps - if(dif == DUNGEON_DIFFICULTY_HEROIC || entry->map_type == MAP_RAID) + if (entry->map_type == MAP_RAID || diff == DUNGEON_DIFFICULTY_HEROIC) { ++itr; continue; @@ -1541,8 +1561,8 @@ void Group::ResetInstances(uint8 method, Player* SendMsgTo) if(p->CanReset()) p->DeleteFromDB(); else CharacterDatabase.PExecute("DELETE FROM group_instance WHERE instance = '%u'", p->GetInstanceId()); // i don't know for sure if hash_map iterators - m_boundInstances[dif].erase(itr); - itr = m_boundInstances[dif].begin(); + m_boundInstances[diff].erase(itr); + itr = m_boundInstances[diff].begin(); // this unloads the instance save unless online players are bound to it // (eg. permanent binds or GM solo binds) p->RemoveGroup(this); @@ -1552,11 +1572,19 @@ void Group::ResetInstances(uint8 method, Player* SendMsgTo) } } -InstanceGroupBind* Group::GetBoundInstance(uint32 mapid, uint8 difficulty) +InstanceGroupBind* Group::GetBoundInstance(Player* player) { + uint32 mapid = player->GetMapId(); + MapEntry const* mapEntry = sMapStore.LookupEntry(mapid); + if(!mapEntry) + return NULL; + + Difficulty difficulty = player->GetDifficulty(mapEntry->IsRaid()); + // some instances only have one difficulty - const MapEntry* entry = sMapStore.LookupEntry(mapid); - if(!entry || !entry->SupportsHeroicMode()) difficulty = DUNGEON_DIFFICULTY_NORMAL; + MapDifficulty const* mapDiff = GetMapDifficultyData(mapid,difficulty); + if(!mapDiff) + difficulty = DUNGEON_DIFFICULTY_NORMAL; BoundInstancesMap::iterator itr = m_boundInstances[difficulty].find(mapid); if(itr != m_boundInstances[difficulty].end()) @@ -1565,6 +1593,23 @@ InstanceGroupBind* Group::GetBoundInstance(uint32 mapid, uint8 difficulty) return NULL; } +InstanceGroupBind* Group::GetBoundInstance(Map* aMap) +{ + // Currently spawn numbering not different from map difficulty + Difficulty difficulty = Difficulty(aMap->GetSpawnMode()); + + // some instances only have one difficulty + MapDifficulty const* mapDiff = GetMapDifficultyData(aMap->GetId(),difficulty); + if(!mapDiff) + return NULL; + + BoundInstancesMap::iterator itr = m_boundInstances[difficulty].find(aMap->GetId()); + if(itr != m_boundInstances[difficulty].end()) + return &itr->second; + else + return NULL; +} + InstanceGroupBind* Group::BindToInstance(InstanceSave *save, bool permanent, bool load) { if(save && !isBGGroup()) diff --git a/src/game/Group.h b/src/game/Group.h index f6837e410..3b852fa8e 100644 --- a/src/game/Group.h +++ b/src/game/Group.h @@ -279,13 +279,15 @@ class MANGOS_DLL_SPEC Group } void SetTargetIcon(uint8 id, uint64 guid); - void SetDungeonDifficulty(uint8 difficulty); - uint8 GetDungeonDifficulty() { return m_dungeonDifficulty; } - void SetRaidDifficulty(uint8 difficulty); - uint8 GetRaidDifficulty() { return m_raidDifficulty; } + + Difficulty GetDifficulty(bool isRaid) const { return isRaid ? m_raidDifficulty : m_dungeonDifficulty; } + Difficulty GetDungeonDifficulty() const { return m_dungeonDifficulty; } + Difficulty GetRaidDifficulty() const { return m_raidDifficulty; } + void SetDungeonDifficulty(Difficulty difficulty); + void SetRaidDifficulty(Difficulty difficulty); uint16 InInstance(); bool InCombatToInstance(uint32 instanceId); - void ResetInstances(uint8 method, Player* SendMsgTo); + void ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo); // -no description- //void SendInit(WorldSession *session); @@ -329,8 +331,9 @@ class MANGOS_DLL_SPEC Group InstanceGroupBind* BindToInstance(InstanceSave *save, bool permanent, bool load = false); void UnbindInstance(uint32 mapid, uint8 difficulty, bool unload = false); - InstanceGroupBind* GetBoundInstance(uint32 mapid, uint8 difficulty); - BoundInstancesMap& GetBoundInstances(uint8 difficulty) { return m_boundInstances[difficulty]; } + InstanceGroupBind* GetBoundInstance(Player* player); + InstanceGroupBind* GetBoundInstance(Map* aMap); + BoundInstancesMap& GetBoundInstances(Difficulty difficulty) { return m_boundInstances[difficulty]; } protected: bool _addMember(const uint64 &guid, const char* name, bool isAssistant=false); @@ -399,15 +402,15 @@ class MANGOS_DLL_SPEC Group uint64 m_mainTank; uint64 m_mainAssistant; GroupType m_groupType; - uint8 m_dungeonDifficulty; - uint8 m_raidDifficulty; + Difficulty m_dungeonDifficulty; + Difficulty m_raidDifficulty; BattleGround* m_bgGroup; uint64 m_targetIcons[TARGETICONCOUNT]; LootMethod m_lootMethod; ItemQualities m_lootThreshold; uint64 m_looterGuid; Rolls RollId; - BoundInstancesMap m_boundInstances[TOTAL_DUNGEON_DIFFICULTIES]; + BoundInstancesMap m_boundInstances[MAX_DIFFICULTY]; uint8* m_subGroupsCounts; }; #endif diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp index b52f74504..2db0c49d4 100644 --- a/src/game/InstanceSaveMgr.cpp +++ b/src/game/InstanceSaveMgr.cpp @@ -72,15 +72,27 @@ InstanceSaveManager::~InstanceSaveManager() - adding instance into manager - called from InstanceMap::Add, _LoadBoundInstances, LoadGroups */ -InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instanceId, uint8 difficulty, time_t resetTime, bool canReset, bool load) +InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instanceId, Difficulty difficulty, time_t resetTime, bool canReset, bool load) { - InstanceSave *save = GetInstanceSave(instanceId); - if(save) return save; + if(InstanceSave *old_save = GetInstanceSave(instanceId)) + return old_save; const MapEntry* entry = sMapStore.LookupEntry(mapId); - if(!entry || instanceId == 0) + if (!entry) { - sLog.outError("InstanceSaveManager::AddInstanceSave: mapid = %d, instanceid = %d!", mapId, instanceId); + sLog.outError("InstanceSaveManager::AddInstanceSave: wrong mapid = %d!", mapId, instanceId); + return NULL; + } + + if (instanceId == 0) + { + sLog.outError("InstanceSaveManager::AddInstanceSave: mapid = %d, wrong instanceid = %d!", mapId, instanceId); + return NULL; + } + + if (difficulty >= (entry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY)) + { + sLog.outError("InstanceSaveManager::AddInstanceSave: mapid = %d, instanceid = %d, wrong dificalty %u!", mapId, instanceId, difficulty); return NULL; } @@ -100,7 +112,7 @@ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instance sLog.outDebug("InstanceSaveManager::AddInstanceSave: mapid = %d, instanceid = %d", mapId, instanceId); - save = new InstanceSave(mapId, instanceId, difficulty, resetTime, canReset); + InstanceSave *save = new InstanceSave(mapId, instanceId, difficulty, resetTime, canReset); if(!load) save->SaveToDB(); m_instanceSaveById[instanceId] = save; @@ -136,7 +148,7 @@ void InstanceSaveManager::RemoveInstanceSave(uint32 InstanceId) } } -InstanceSave::InstanceSave(uint16 MapId, uint32 InstanceId, uint8 difficulty, time_t resetTime, bool canReset) +InstanceSave::InstanceSave(uint16 MapId, uint32 InstanceId, Difficulty difficulty, time_t resetTime, bool canReset) : m_resetTime(resetTime), m_instanceid(InstanceId), m_mapid(MapId), m_difficulty(difficulty), m_canReset(canReset) { @@ -446,10 +458,7 @@ void InstanceSaveManager::LoadResetTimes() for(uint32 i = 0; i < sInstanceTemplate.MaxEntry; i++) { InstanceTemplate const* temp = objmgr.GetInstanceTemplate(i); - if(!temp) continue; - // only raid/heroic maps have a global reset time - const MapEntry* entry = sMapStore.LookupEntry(temp->map); - if(!entry || !entry->HasResetTime()) + if(!temp || temp->reset_delay == 0) continue; uint32 period = temp->reset_delay * DAY; diff --git a/src/game/InstanceSaveMgr.h b/src/game/InstanceSaveMgr.h index 5f573313a..f1d08e8f2 100644 --- a/src/game/InstanceSaveMgr.h +++ b/src/game/InstanceSaveMgr.h @@ -47,7 +47,7 @@ class InstanceSave - any new instance is being generated - the first time a player bound to InstanceId logs in - when a group bound to the instance is loaded */ - InstanceSave(uint16 MapId, uint32 InstanceId, uint8 difficulty, time_t resetTime, bool canReset); + InstanceSave(uint16 MapId, uint32 InstanceId, Difficulty difficulty, time_t resetTime, bool canReset); /* Unloaded when m_playerList and m_groupList become empty or when the instance is reset */ @@ -92,7 +92,7 @@ class InstanceSave /* currently it is possible to omit this information from this structure but that would depend on a lot of things that can easily change in future */ - uint8 GetDifficulty() { return m_difficulty; } + Difficulty GetDifficulty() { return m_difficulty; } typedef std::list PlayerListType; typedef std::list GroupListType; @@ -105,8 +105,8 @@ class InstanceSave GroupListType m_groupList; time_t m_resetTime; uint32 m_instanceid; - uint16 m_mapid; - uint8 m_difficulty; + uint32 m_mapid; + Difficulty m_difficulty; bool m_canReset; }; @@ -143,7 +143,7 @@ class MANGOS_DLL_DECL InstanceSaveManager : public MaNGOS::SingletonGetBoundInstance(target->GetMapId(), target->GetDungeonDifficulty()); + InstancePlayerBind *pBind = _player->GetBoundInstance(target->GetMapId(), target->GetDifficulty(cMap->IsRaid())); if (!pBind) { Group *group = _player->GetGroup(); // if no bind exists, create a solo bind - InstanceGroupBind *gBind = group ? group->GetBoundInstance(target->GetMapId(), target->GetDungeonDifficulty()) : NULL; + InstanceGroupBind *gBind = group ? group->GetBoundInstance(target) : NULL; // if no bind exists, create a solo bind if (!gBind) if (InstanceSave *save = sInstanceSaveManager.GetInstanceSave(target->GetInstanceId())) _player->BindToInstance(save, !save->CanReset()); } - _player->SetDungeonDifficulty(target->GetDungeonDifficulty()); + if(cMap->IsRaid()) + _player->SetRaidDifficulty(target->GetRaidDifficulty()); + else + _player->SetDungeonDifficulty(target->GetDungeonDifficulty()); } PSendSysMessage(LANG_APPEARING_AT, chrNameLink.c_str()); diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index ec69567c0..623f70631 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -5912,9 +5912,9 @@ bool ChatHandler::HandleInstanceListBindsCommand(const char* /*args*/) Player* player = getSelectedPlayer(); if (!player) player = m_session->GetPlayer(); uint32 counter = 0; - for(uint8 i = 0; i < TOTAL_DUNGEON_DIFFICULTIES; ++i) + for(uint8 i = 0; i < MAX_DIFFICULTY; ++i) { - Player::BoundInstancesMap &binds = player->GetBoundInstances(i); + Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i)); for(Player::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr) { InstanceSave *save = itr->second.save; @@ -5928,9 +5928,9 @@ bool ChatHandler::HandleInstanceListBindsCommand(const char* /*args*/) Group *group = player->GetGroup(); if(group) { - for(uint8 i = 0; i < TOTAL_DUNGEON_DIFFICULTIES; ++i) + for(uint8 i = 0; i < MAX_DIFFICULTY; ++i) { - Group::BoundInstancesMap &binds = group->GetBoundInstances(i); + Group::BoundInstancesMap &binds = group->GetBoundInstances(Difficulty(i)); for(Group::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr) { InstanceSave *save = itr->second.save; @@ -5956,9 +5956,9 @@ bool ChatHandler::HandleInstanceUnbindCommand(const char* args) Player* player = getSelectedPlayer(); if (!player) player = m_session->GetPlayer(); uint32 counter = 0; - for(uint8 i = 0; i < TOTAL_DUNGEON_DIFFICULTIES; ++i) + for(uint8 i = 0; i < MAX_DIFFICULTY; ++i) { - Player::BoundInstancesMap &binds = player->GetBoundInstances(i); + Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i)); for(Player::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end();) { if(itr->first != player->GetMapId()) @@ -5966,7 +5966,7 @@ bool ChatHandler::HandleInstanceUnbindCommand(const char* args) InstanceSave *save = itr->second.save; std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL)); PSendSysMessage("unbinding map: %d inst: %d perm: %s diff: %s canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty() == DUNGEON_DIFFICULTY_NORMAL ? "normal" : "heroic", save->CanReset() ? "yes" : "no", timeleft.c_str()); - player->UnbindInstance(itr, i); + player->UnbindInstance(itr, Difficulty(i)); counter++; } else diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 35dd3d744..7e4fdfba9 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -2334,11 +2334,11 @@ bool InstanceMap::Add(Player *player) if(!mapSave) { sLog.outDetail("InstanceMap::Add: creating instance save for map %d spawnmode %d with instance id %d", GetId(), GetSpawnMode(), GetInstanceId()); - mapSave = sInstanceSaveManager.AddInstanceSave(GetId(), GetInstanceId(), GetSpawnMode(), 0, true); + mapSave = sInstanceSaveManager.AddInstanceSave(GetId(), GetInstanceId(), Difficulty(GetSpawnMode()), 0, true); } // check for existing instance binds - InstancePlayerBind *playerBind = player->GetBoundInstance(GetId(), GetSpawnMode()); + InstancePlayerBind *playerBind = player->GetBoundInstance(GetId(), Difficulty(GetSpawnMode())); if(playerBind && playerBind->perm) { // cannot enter other instances if bound permanently @@ -2354,7 +2354,7 @@ bool InstanceMap::Add(Player *player) if(pGroup) { // solo saves should be reset when entering a group - InstanceGroupBind *groupBind = pGroup->GetBoundInstance(GetId(), GetSpawnMode()); + InstanceGroupBind *groupBind = pGroup->GetBoundInstance(this); if(playerBind) { sLog.outError("InstanceMap::Add: player %s(%d) is being put in instance %d,%d,%d,%d,%d,%d but he is in group %d and is bound to instance %d,%d,%d,%d,%d,%d!", player->GetName(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset(), GUID_LOPART(pGroup->GetLeaderGUID()), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset()); @@ -2573,7 +2573,7 @@ void InstanceMap::UnloadAll(bool pForce) void InstanceMap::SendResetWarnings(uint32 timeLeft) const { for(MapRefManager::const_iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr) - itr->getSource()->SendInstanceResetWarning(GetId(), itr->getSource()->GetDungeonDifficulty(), timeLeft); + itr->getSource()->SendInstanceResetWarning(GetId(), itr->getSource()->GetDifficulty(IsRaid()), timeLeft); } void InstanceMap::SetResetSchedule(bool on) diff --git a/src/game/Map.h b/src/game/Map.h index d4a01bc62..6fe6fdf3b 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -365,7 +365,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager, public MaNGOS::Obj // NOTE: this duplicate of Instanceable(), but Instanceable() can be changed when BG also will be instanceable bool IsDungeon() const { return i_mapEntry && i_mapEntry->IsDungeon(); } bool IsRaid() const { return i_mapEntry && i_mapEntry->IsRaid(); } - bool IsHeroic() const { return i_spawnMode == DUNGEON_DIFFICULTY_HEROIC; } + bool IsHeroic() const { return IsRaid() ? i_spawnMode >= RAID_DIFFICULTY_10MAN_HEROIC : i_spawnMode >= DUNGEON_DIFFICULTY_HEROIC; } bool IsBattleGround() const { return i_mapEntry && i_mapEntry->IsBattleGround(); } bool IsBattleArena() const { return i_mapEntry && i_mapEntry->IsBattleArena(); } bool IsBattleGroundOrArena() const { return i_mapEntry && i_mapEntry->IsBattleGroundOrArena(); } diff --git a/src/game/MapInstanced.cpp b/src/game/MapInstanced.cpp index 85bd15da1..0aa985ffe 100644 --- a/src/game/MapInstanced.cpp +++ b/src/game/MapInstanced.cpp @@ -139,7 +139,7 @@ Map* MapInstanced::CreateInstance(const uint32 mapId, Player * player) } else { - InstancePlayerBind *pBind = player->GetBoundInstance(GetId(), player->GetDungeonDifficulty()); + InstancePlayerBind *pBind = player->GetBoundInstance(GetId(), player->GetDifficulty(IsRaid())); InstanceSave *pSave = pBind ? pBind->save : NULL; // the player's permanent player bind is taken into consideration first @@ -149,7 +149,7 @@ Map* MapInstanced::CreateInstance(const uint32 mapId, Player * player) InstanceGroupBind *groupBind = NULL; Group *group = player->GetGroup(); // use the player's difficulty setting (it may not be the same as the group's) - if(group && (groupBind = group->GetBoundInstance(GetId(), player->GetDungeonDifficulty()))) + if(group && (groupBind = group->GetBoundInstance(this))) pSave = groupBind->save; } @@ -167,14 +167,14 @@ Map* MapInstanced::CreateInstance(const uint32 mapId, Player * player) // if no instanceId via group members or instance saves is found // the instance will be created for the first time NewInstanceId = MapManager::Instance().GenerateInstanceId(); - map = CreateInstance(NewInstanceId, NULL, player->GetDungeonDifficulty()); + map = CreateInstance(NewInstanceId, NULL, player->GetDifficulty(IsRaid())); } } return map; } -InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave *save, uint8 difficulty) +InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave *save, Difficulty difficulty) { // load/create a map Guard guard(*this); @@ -194,7 +194,9 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave *save, } // some instances only have one difficulty - if (entry && !entry->SupportsHeroicMode()) difficulty = DUNGEON_DIFFICULTY_NORMAL; + MapDifficulty const* mapDiff = GetMapDifficultyData(GetId(),difficulty); + if (!mapDiff) + difficulty = DUNGEON_DIFFICULTY_NORMAL; sLog.outDebug("MapInstanced::CreateInstance: %s map instance %d for %d created with difficulty %s", save?"":"new ", InstanceId, GetId(), difficulty?"heroic":"normal"); diff --git a/src/game/MapInstanced.h b/src/game/MapInstanced.h index 5e8183bac..baa78eeb6 100644 --- a/src/game/MapInstanced.h +++ b/src/game/MapInstanced.h @@ -61,7 +61,7 @@ class MANGOS_DLL_DECL MapInstanced : public Map private: - InstanceMap* CreateInstance(uint32 InstanceId, InstanceSave *save, uint8 difficulty); + InstanceMap* CreateInstance(uint32 InstanceId, InstanceSave *save, Difficulty difficulty); BattleGroundMap* CreateBattleGroundMap(uint32 InstanceId, BattleGround* bg); InstancedMaps m_InstancedMaps; diff --git a/src/game/MapManager.cpp b/src/game/MapManager.cpp index f98011e34..624e3b884 100644 --- a/src/game/MapManager.cpp +++ b/src/game/MapManager.cpp @@ -182,10 +182,16 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player) } //The player has a heroic mode and tries to enter into instance which has no a heroic mode - if (!entry->SupportsHeroicMode() && player->GetDungeonDifficulty() == DUNGEON_DIFFICULTY_HEROIC) + MapDifficulty const* mapDiff = GetMapDifficultyData(entry->MapID,player->GetDifficulty(entry->map_type == MAP_RAID)); + if (!mapDiff) { + bool isHeroicTargetMap = entry->map_type == MAP_RAID + ? (player->GetRaidDifficulty() >= RAID_DIFFICULTY_10MAN_HEROIC) + : (player->GetDungeonDifficulty() >= DUNGEON_DIFFICULTY_HEROIC); + //Send aborted message - player->SendTransferAborted(mapid, TRANSFER_ABORT_DIFFICULTY, DUNGEON_DIFFICULTY_HEROIC); + // FIX ME: what about absent normal/heroic mode with specific players limit... + player->SendTransferAborted(mapid, TRANSFER_ABORT_DIFFICULTY, isHeroicTargetMap ? DUNGEON_DIFFICULTY_HEROIC : DUNGEON_DIFFICULTY_NORMAL); return false; } diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 5cccd4ea0..776277d2a 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -809,8 +809,16 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) else if(at->requiredItem2 && !GetPlayer()->HasItemCount(at->requiredItem2, 1)) missingItem = at->requiredItem2; + MapEntry const* mapEntry = sMapStore.LookupEntry(at->target_mapId); + if(!mapEntry) + return; + + bool isHeroicTargetMap = mapEntry->IsRaid() + ? (GetPlayer()->GetRaidDifficulty() >= RAID_DIFFICULTY_10MAN_HEROIC) + : (GetPlayer()->GetDungeonDifficulty() >= DUNGEON_DIFFICULTY_HEROIC); + uint32 missingKey = 0; - if(GetPlayer()->GetDungeonDifficulty() == DUNGEON_DIFFICULTY_HEROIC) + if(isHeroicTargetMap) { if(at->heroicKey) { @@ -823,7 +831,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) } uint32 missingQuest = 0; - if(GetPlayer()->GetDungeonDifficulty() == DUNGEON_DIFFICULTY_HEROIC) + if(isHeroicTargetMap) { if (at->requiredQuestHeroic && !GetPlayer()->GetQuestRewardStatus(at->requiredQuestHeroic)) missingQuest = at->requiredQuestHeroic; @@ -840,7 +848,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) if(missingItem) SendAreaTriggerMessage(GetMangosString(LANG_LEVEL_MINREQUIRED_AND_ITEM), at->requiredLevel, objmgr.GetItemPrototype(missingItem)->Name1); else if(missingKey) - GetPlayer()->SendTransferAborted(at->target_mapId, TRANSFER_ABORT_DIFFICULTY, DUNGEON_DIFFICULTY_HEROIC); + GetPlayer()->SendTransferAborted(at->target_mapId, TRANSFER_ABORT_DIFFICULTY, isHeroicTargetMap ? DUNGEON_DIFFICULTY_HEROIC : DUNGEON_DIFFICULTY_NORMAL); else if(missingQuest) SendAreaTriggerMessage(at->requiredFailedText.c_str()); else if(missingLevel) @@ -1383,10 +1391,16 @@ void WorldSession::HandleResetInstancesOpcode( WorldPacket & /*recv_data*/ ) if(Group *pGroup = _player->GetGroup()) { if(pGroup->IsLeader(_player->GetGUID())) - pGroup->ResetInstances(INSTANCE_RESET_ALL, _player); + { + pGroup->ResetInstances(INSTANCE_RESET_ALL, false, _player); + pGroup->ResetInstances(INSTANCE_RESET_ALL, true,_player); + } } else - _player->ResetInstances(INSTANCE_RESET_ALL); + { + _player->ResetInstances(INSTANCE_RESET_ALL, false); + _player->ResetInstances(INSTANCE_RESET_ALL, true); + } } void WorldSession::HandleSetDungeonDifficultyOpcode( WorldPacket & recv_data ) @@ -1396,15 +1410,15 @@ void WorldSession::HandleSetDungeonDifficultyOpcode( WorldPacket & recv_data ) uint32 mode; recv_data >> mode; - if(mode == _player->GetDungeonDifficulty()) - return; - - if(mode > DUNGEON_DIFFICULTY_HEROIC) + if(mode >= MAX_DUNGEON_DIFFICULTY) { sLog.outError("WorldSession::HandleSetDungeonDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode); return; } + if(Difficulty(mode) == _player->GetDungeonDifficulty()) + return; + // cannot reset while in an instance Map *map = _player->GetMap(); if(map && map->IsDungeon()) @@ -1422,14 +1436,14 @@ void WorldSession::HandleSetDungeonDifficultyOpcode( WorldPacket & recv_data ) { // the difficulty is set even if the instances can't be reset //_player->SendDungeonDifficulty(true); - pGroup->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, _player); - pGroup->SetDungeonDifficulty(mode); + pGroup->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, false, _player); + pGroup->SetDungeonDifficulty(Difficulty(mode)); } } else { - _player->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY); - _player->SetDungeonDifficulty(mode); + _player->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, false); + _player->SetDungeonDifficulty(Difficulty(mode)); } } @@ -1440,15 +1454,15 @@ void WorldSession::HandleSetRaidDifficultyOpcode( WorldPacket & recv_data ) uint32 mode; recv_data >> mode; - if(mode == _player->GetRaidDifficulty()) - return; - - if(mode > RAID_DIFFICULTY_25MAN_HEROIC) + if(mode >= MAX_RAID_DIFFICULTY) { sLog.outError("WorldSession::HandleSetRaidDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode); return; } + if(RaidDifficulties(mode) == _player->GetRaidDifficulty()) + return; + // cannot reset while in an instance Map *map = _player->GetMap(); if(map && map->IsDungeon()) @@ -1466,14 +1480,14 @@ void WorldSession::HandleSetRaidDifficultyOpcode( WorldPacket & recv_data ) { // the difficulty is set even if the instances can't be reset //_player->SendDungeonDifficulty(true); - pGroup->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, _player); - pGroup->SetRaidDifficulty(mode); + pGroup->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, true, _player); + pGroup->SetRaidDifficulty(Difficulty(mode)); } } else { - _player->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY); - _player->SetRaidDifficulty(mode); + _player->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, true); + _player->SetRaidDifficulty(Difficulty(mode)); } } diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index 5ad057fe2..3d10973c6 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -137,10 +137,21 @@ void WorldSession::HandleMoveWorldportAckOpcode() } } - if((mEntry->IsRaid() || (mEntry->IsNonRaidDungeon() && mEntry->SupportsHeroicMode() && GetPlayer()->IsHeroicDungeon())) && mInstance) + if (mInstance) { - uint32 timeleft = sInstanceSaveManager.GetResetTimeFor(GetPlayer()->GetMapId()) - time(NULL); - GetPlayer()->SendInstanceResetWarning(GetPlayer()->GetMapId(), GetPlayer()->GetDungeonDifficulty(), timeleft); + if(mEntry->IsRaid()) + { + uint32 timeleft = sInstanceSaveManager.GetResetTimeFor(GetPlayer()->GetMapId()) - time(NULL); + GetPlayer()->SendInstanceResetWarning(GetPlayer()->GetMapId(), GetPlayer()->GetRaidDifficulty(), timeleft); + } + else if(mEntry->IsNonRaidDungeon() && GetPlayer()->GetDungeonDifficulty() > DUNGEON_DIFFICULTY_NORMAL) + { + if(MapDifficulty const* mapDiff = GetMapDifficultyData(mEntry->MapID,GetPlayer()->GetDungeonDifficulty())) + { + uint32 timeleft = sInstanceSaveManager.GetResetTimeFor(GetPlayer()->GetMapId()) - time(NULL); + GetPlayer()->SendInstanceResetWarning(GetPlayer()->GetMapId(), GetPlayer()->GetDungeonDifficulty(), timeleft); + } + } } // mount allow check diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 8a37a0085..6791db917 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -3148,7 +3148,14 @@ void ObjectMgr::LoadGroups() continue; } - InstanceSave *save = sInstanceSaveManager.AddInstanceSave(mapEntry->MapID, fields[2].GetUInt32(), fields[4].GetUInt8(), (time_t)fields[5].GetUInt64(), (fields[6].GetUInt32() == 0), true); + uint32 diff = fields[4].GetUInt8(); + if(diff >= (mapEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY)) + { + sLog.outErrorDb("Wrong dungeon difficulty use in group_instance table: %d", diff); + diff = 0; // default for both difficaly types + } + + InstanceSave *save = sInstanceSaveManager.AddInstanceSave(mapEntry->MapID, fields[2].GetUInt32(), Difficulty(diff), (time_t)fields[5].GetUInt64(), (fields[6].GetUInt32() == 0), true); group->BindToInstance(save, fields[3].GetBool(), true); }while( result->NextRow() ); delete result; @@ -4477,15 +4484,15 @@ void ObjectMgr::LoadInstanceTemplate() for(uint32 i = 0; i < sInstanceTemplate.MaxEntry; i++) { InstanceTemplate* temp = (InstanceTemplate*)GetInstanceTemplate(i); - if(!temp) continue; + if(!temp) + continue; + const MapEntry* entry = sMapStore.LookupEntry(temp->map); if(!entry) { sLog.outErrorDb("ObjectMgr::LoadInstanceTemplate: bad mapid %d for template!", temp->map); continue; } - else if(!entry->HasResetTime()) - continue; //FIXME: now exist heroic instance, normal/heroic raid instances // entry->resetTimeHeroic store reset time for both heroic mode instance (raid and non-raid) @@ -4494,16 +4501,24 @@ void ObjectMgr::LoadInstanceTemplate() // but at some point wee need implement reset time dependent from raid instance mode if(temp->reset_delay == 0) { + MapDifficulty const* mapDiffNorm = GetMapDifficultyData(temp->map,DUNGEON_DIFFICULTY_NORMAL); + MapDifficulty const* mapDiffHeroic = GetMapDifficultyData(temp->map,DUNGEON_DIFFICULTY_HEROIC); + + // no reset time + if ((!mapDiffNorm || mapDiffNorm->resetTime == 0) && + (!mapDiffHeroic || mapDiffHeroic->resetTime == 0)) + continue; + // use defaults from the DBC - /*if(entry->resetTimeHeroic) // for both raid and non raids, read above + if(mapDiffHeroic && mapDiffHeroic->resetTime) // for both raid and non raids, read above { - temp->reset_delay = entry->resetTimeHeroic / DAY; + temp->reset_delay = mapDiffHeroic->resetTime / DAY; } - else if (entry->resetTimeRaid && entry->map_type == MAP_RAID) + else if (mapDiffNorm && mapDiffNorm->resetTime && entry->map_type == MAP_RAID) // for normal raid only { - temp->reset_delay = entry->resetTimeRaid / DAY; - }*/ + temp->reset_delay = mapDiffNorm->resetTime / DAY; + } } // the reset_delay must be at least one day diff --git a/src/game/Player.cpp b/src/game/Player.cpp index d10779d2c..185551340 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -509,7 +509,7 @@ Player::~Player () delete ItemSetEff[x]; // clean up player-instance binds, may unload some instance saves - for(uint8 i = 0; i < TOTAL_DUNGEON_DIFFICULTIES; ++i) + for(uint8 i = 0; i < MAX_DIFFICULTY; ++i) for(BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr) itr->second.save->RemovePlayer(this); @@ -14182,7 +14182,11 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) uint32 transGUID = fields[31].GetUInt32(); Relocate(fields[13].GetFloat(),fields[14].GetFloat(),fields[15].GetFloat(),fields[17].GetFloat()); SetLocationMapId(fields[16].GetUInt32()); - SetDungeonDifficulty(fields[39].GetUInt32()); // may be changed in _LoadGroup + + uint32 difficulty = fields[39].GetUInt32(); + if(difficulty >= MAX_DUNGEON_DIFFICULTY) + difficulty = DUNGEON_DIFFICULTY_NORMAL; + SetDungeonDifficulty(Difficulty(difficulty)); // may be changed in _LoadGroup _LoadGroup(holder->GetResult(PLAYER_LOGIN_QUERY_LOADGROUP)); @@ -15281,19 +15285,20 @@ void Player::_LoadSpells(QueryResult *result) void Player::_LoadGroup(QueryResult *result) { //QueryResult *result = CharacterDatabase.PQuery("SELECT leaderGuid FROM group_member WHERE memberGuid='%u'", GetGUIDLow()); - if(result) + if (result) { uint64 leaderGuid = MAKE_NEW_GUID((*result)[0].GetUInt32(), 0, HIGHGUID_PLAYER); delete result; - Group* group = objmgr.GetGroupByLeader(leaderGuid); - if(group) + + if (Group* group = objmgr.GetGroupByLeader(leaderGuid)) { uint8 subgroup = group->GetMemberGroup(GetGUID()); SetGroup(group, subgroup); - if(getLevel() >= LEVELREQUIREMENT_HEROIC) + if (getLevel() >= LEVELREQUIREMENT_HEROIC) { // the group leader may change the instance difficulty while the player is offline SetDungeonDifficulty(group->GetDungeonDifficulty()); + SetRaidDifficulty(group->GetRaidDifficulty()); } } } @@ -15301,7 +15306,7 @@ void Player::_LoadGroup(QueryResult *result) void Player::_LoadBoundInstances(QueryResult *result) { - for(uint8 i = 0; i < TOTAL_DUNGEON_DIFFICULTIES; ++i) + for(uint8 i = 0; i < MAX_DIFFICULTY; ++i) m_boundInstances[i].clear(); Group *group = GetGroup(); @@ -15316,6 +15321,7 @@ void Player::_LoadBoundInstances(QueryResult *result) uint32 mapId = fields[2].GetUInt32(); uint32 instanceId = fields[0].GetUInt32(); uint8 difficulty = fields[3].GetUInt8(); + time_t resetTime = (time_t)fields[4].GetUInt64(); // the resettime for normal instances is only saved when the InstanceSave is unloaded // so the value read from the DB may be wrong here but only if the InstanceSave is loaded @@ -15329,6 +15335,21 @@ void Player::_LoadBoundInstances(QueryResult *result) continue; } + if(difficulty >= MAX_DIFFICULTY) + { + sLog.outError("_LoadBoundInstances: player %s(%d) has bind to not existed difficulty %d instance for map %u", GetName(), GetGUIDLow(), difficulty, mapId); + CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%d' AND instance = '%d'", GetGUIDLow(), instanceId); + continue; + } + + MapDifficulty const* mapDiff = GetMapDifficultyData(mapId,Difficulty(difficulty)); + if(!mapDiff) + { + sLog.outError("_LoadBoundInstances: player %s(%d) has bind to not existed difficulty %d instance for map %u", GetName(), GetGUIDLow(), difficulty, mapId); + CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%d' AND instance = '%d'", GetGUIDLow(), instanceId); + continue; + } + if(!perm && group) { sLog.outError("_LoadBoundInstances: player %s(%d) is in group %d but has a non-permanent character bind to map %d,%d,%d", GetName(), GetGUIDLow(), GUID_LOPART(group->GetLeaderGUID()), mapId, instanceId, difficulty); @@ -15337,18 +15358,19 @@ void Player::_LoadBoundInstances(QueryResult *result) } // since non permanent binds are always solo bind, they can always be reset - InstanceSave *save = sInstanceSaveManager.AddInstanceSave(mapId, instanceId, difficulty, resetTime, !perm, true); + InstanceSave *save = sInstanceSaveManager.AddInstanceSave(mapId, instanceId, Difficulty(difficulty), resetTime, !perm, true); if(save) BindToInstance(save, perm, true); } while(result->NextRow()); delete result; } } -InstancePlayerBind* Player::GetBoundInstance(uint32 mapid, uint8 difficulty) +InstancePlayerBind* Player::GetBoundInstance(uint32 mapid, Difficulty difficulty) { // some instances only have one difficulty - const MapEntry* entry = sMapStore.LookupEntry(mapid); - if(!entry || !entry->SupportsHeroicMode()) difficulty = DUNGEON_DIFFICULTY_NORMAL; + MapDifficulty const* mapDiff = GetMapDifficultyData(mapid,difficulty); + if(!mapDiff) + return NULL; BoundInstancesMap::iterator itr = m_boundInstances[difficulty].find(mapid); if(itr != m_boundInstances[difficulty].end()) @@ -15357,13 +15379,13 @@ InstancePlayerBind* Player::GetBoundInstance(uint32 mapid, uint8 difficulty) return NULL; } -void Player::UnbindInstance(uint32 mapid, uint8 difficulty, bool unload) +void Player::UnbindInstance(uint32 mapid, Difficulty difficulty, bool unload) { BoundInstancesMap::iterator itr = m_boundInstances[difficulty].find(mapid); UnbindInstance(itr, difficulty, unload); } -void Player::UnbindInstance(BoundInstancesMap::iterator &itr, uint8 difficulty, bool unload) +void Player::UnbindInstance(BoundInstancesMap::iterator &itr, Difficulty difficulty, bool unload) { if(itr != m_boundInstances[difficulty].end()) { @@ -15415,7 +15437,7 @@ void Player::SendRaidInfo() time_t now = time(NULL); - for(int i = 0; i < TOTAL_DUNGEON_DIFFICULTIES; ++i) + for(int i = 0; i < MAX_DIFFICULTY; ++i) { for (BoundInstancesMap::const_iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr) { @@ -15444,7 +15466,7 @@ void Player::SendSavedInstances() bool hasBeenSaved = false; WorldPacket data; - for(uint8 i = 0; i < TOTAL_DUNGEON_DIFFICULTIES; ++i) + for(uint8 i = 0; i < MAX_DIFFICULTY; ++i) { for (BoundInstancesMap::const_iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr) { @@ -15464,7 +15486,7 @@ void Player::SendSavedInstances() if(!hasBeenSaved) return; - for(uint8 i = 0; i < TOTAL_DUNGEON_DIFFICULTIES; ++i) + for(uint8 i = 0; i < MAX_DIFFICULTY; ++i) { for (BoundInstancesMap::const_iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr) { @@ -15492,7 +15514,7 @@ void Player::ConvertInstancesToGroup(Player *player, Group *group, uint64 player if(player) { - for(uint8 i = 0; i < TOTAL_DUNGEON_DIFFICULTIES; ++i) + for(uint8 i = 0; i < MAX_DIFFICULTY; ++i) { for (BoundInstancesMap::iterator itr = player->m_boundInstances[i].begin(); itr != player->m_boundInstances[i].end();) { @@ -15501,7 +15523,8 @@ void Player::ConvertInstancesToGroup(Player *player, Group *group, uint64 player // permanent binds are not removed if(!itr->second.perm) { - player->UnbindInstance(itr, i, true); // increments itr + // increments itr in call + player->UnbindInstance(itr, Difficulty(i), true); has_solo = true; } else @@ -16209,18 +16232,18 @@ void Player::SendResetFailedNotify(uint32 mapid) } /// Reset all solo instances and optionally send a message on success for each -void Player::ResetInstances(uint8 method) +void Player::ResetInstances(uint8 method, bool isRaid) { // method can be INSTANCE_RESET_ALL, INSTANCE_RESET_CHANGE_DIFFICULTY, INSTANCE_RESET_GROUP_JOIN // we assume that when the difficulty changes, all instances that can be reset will be - uint8 dif = GetDungeonDifficulty(); + Difficulty diff = GetDifficulty(isRaid); - for (BoundInstancesMap::iterator itr = m_boundInstances[dif].begin(); itr != m_boundInstances[dif].end();) + for (BoundInstancesMap::iterator itr = m_boundInstances[diff].begin(); itr != m_boundInstances[diff].end();) { InstanceSave *p = itr->second.save; const MapEntry *entry = sMapStore.LookupEntry(itr->first); - if(!entry || !p->CanReset()) + if(!entry || entry->IsRaid() != isRaid || !p->CanReset()) { ++itr; continue; @@ -16229,7 +16252,7 @@ void Player::ResetInstances(uint8 method) if(method == INSTANCE_RESET_ALL) { // the "reset all instances" method can only reset normal maps - if(dif == DUNGEON_DIFFICULTY_HEROIC || entry->map_type == MAP_RAID) + if(entry->map_type == MAP_RAID || diff == DUNGEON_DIFFICULTY_HEROIC) { ++itr; continue; @@ -16246,7 +16269,7 @@ void Player::ResetInstances(uint8 method) SendResetInstanceSuccess(p->GetMapId()); p->DeleteFromDB(); - m_boundInstances[dif].erase(itr++); + m_boundInstances[diff].erase(itr++); // the following should remove the instance save from the manager and delete it as well p->RemovePlayer(this); @@ -18325,7 +18348,7 @@ void Player::SendTransferAborted(uint32 mapid, uint8 reason, uint8 arg) GetSession()->SendPacket(&data); } -void Player::SendInstanceResetWarning( uint32 mapid, uint32 difficulty, uint32 time ) +void Player::SendInstanceResetWarning( uint32 mapid, Difficulty difficulty, uint32 time ) { // type of warning, based on the time remaining until reset uint32 type; diff --git a/src/game/Player.h b/src/game/Player.h index 41d852f85..20835baf1 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -704,6 +704,9 @@ enum TransferAbortReason TRANSFER_ABORT_NEED_GROUP = 0x0B, // 3.1 TRANSFER_ABORT_NOT_FOUND2 = 0x0C, // 3.1 TRANSFER_ABORT_NOT_FOUND3 = 0x0D, // 3.1 + TRANSFER_ABORT_NOT_FOUND4 = 0x0E, // 3.2 + TRANSFER_ABORT_REALM_ONLY = 0x0F, // All players on party must be from the same realm. + TRANSFER_ABORT_MAP_NOT_ALLOWED = 0x10, // Map can't be entered at this time. }; enum InstanceResetWarningType @@ -1039,7 +1042,7 @@ class MANGOS_DLL_SPEC Player : public Unit void SendInitialPacketsBeforeAddToMap(); void SendInitialPacketsAfterAddToMap(); void SendTransferAborted(uint32 mapid, uint8 reason, uint8 arg = 0); - void SendInstanceResetWarning(uint32 mapid, uint32 difficulty, uint32 time); + void SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time); Creature* GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask); bool CanInteractWithNPCs(bool alive = true) const; @@ -1673,11 +1676,11 @@ class MANGOS_DLL_SPEC Player : public Unit uint32 GetArenaTeamIdInvited() { return m_ArenaTeamIdInvited; } static void LeaveAllArenaTeams(uint64 guid); - void SetDungeonDifficulty(uint32 dungeon_difficulty) { m_dungeonDifficulty = dungeon_difficulty; } - uint8 GetDungeonDifficulty() { return m_dungeonDifficulty; } - bool IsHeroicDungeon() { return m_dungeonDifficulty == DUNGEON_DIFFICULTY_HEROIC; } - void SetRaidDifficulty(uint32 raid_difficulty) { m_raidDifficulty = raid_difficulty; } - uint8 GetRaidDifficulty() { return m_raidDifficulty; } + Difficulty GetDifficulty(bool isRaid) const { return isRaid ? m_raidDifficulty : m_dungeonDifficulty; } + Difficulty GetDungeonDifficulty() const { return m_dungeonDifficulty; } + Difficulty GetRaidDifficulty() const { return m_raidDifficulty; } + void SetDungeonDifficulty(Difficulty dungeon_difficulty) { m_dungeonDifficulty = dungeon_difficulty; } + void SetRaidDifficulty(Difficulty raid_difficulty) { m_raidDifficulty = raid_difficulty; } bool UpdateSkill(uint32 skill_id, uint32 step); bool UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step); @@ -1765,7 +1768,7 @@ class MANGOS_DLL_SPEC Player : public Unit void SendDungeonDifficulty(bool IsInGroup); void SendRaidDifficulty(bool IsInGroup); - void ResetInstances(uint8 method); + void ResetInstances(uint8 method, bool isRaid); void SendResetInstanceSuccess(uint32 MapId); void SendResetInstanceFailed(uint32 reason, uint32 MapId); void SendResetFailedNotify(uint32 mapid); @@ -2183,11 +2186,11 @@ class MANGOS_DLL_SPEC Player : public Unit uint32 m_HomebindTimer; bool m_InstanceValid; // permanent binds and solo binds by difficulty - BoundInstancesMap m_boundInstances[TOTAL_DUNGEON_DIFFICULTIES]; - InstancePlayerBind* GetBoundInstance(uint32 mapid, uint8 difficulty); - BoundInstancesMap& GetBoundInstances(uint8 difficulty) { return m_boundInstances[difficulty]; } - void UnbindInstance(uint32 mapid, uint8 difficulty, bool unload = false); - void UnbindInstance(BoundInstancesMap::iterator &itr, uint8 difficulty, bool unload = false); + BoundInstancesMap m_boundInstances[MAX_DIFFICULTY]; + InstancePlayerBind* GetBoundInstance(uint32 mapid, Difficulty difficulty); + BoundInstancesMap& GetBoundInstances(Difficulty difficulty) { return m_boundInstances[difficulty]; } + void UnbindInstance(uint32 mapid, Difficulty difficulty, bool unload = false); + void UnbindInstance(BoundInstancesMap::iterator &itr, Difficulty difficulty, bool unload = false); InstancePlayerBind* BindToInstance(InstanceSave *save, bool permanent, bool load = false); void SendRaidInfo(); void SendSavedInstances(); @@ -2339,8 +2342,8 @@ class MANGOS_DLL_SPEC Player : public Unit uint32 m_nextSave; time_t m_speakTime; uint32 m_speakCount; - uint32 m_dungeonDifficulty; - uint32 m_raidDifficulty; + Difficulty m_dungeonDifficulty; + Difficulty m_raidDifficulty; uint32 m_atLoginFlags; diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 011ed6f2d..282791706 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -2408,20 +2408,23 @@ enum DiminishingGroup DIMINISHING_LIMITONLY }; -enum DungeonDifficulties +enum Difficulty { - DUNGEON_DIFFICULTY_NORMAL = 0, - DUNGEON_DIFFICULTY_HEROIC = 1, - TOTAL_DUNGEON_DIFFICULTIES + DUNGEON_DIFFICULTY_NORMAL = 0, + DUNGEON_DIFFICULTY_HEROIC = 1, + + RAID_DIFFICULTY_10MAN_NORMAL = 0, + RAID_DIFFICULTY_25MAN_NORMAL = 1, + RAID_DIFFICULTY_10MAN_HEROIC = 2, + RAID_DIFFICULTY_25MAN_HEROIC = 3, }; +#define MAX_DUNGEON_DIFFICULTY 2 +#define MAX_RAID_DIFFICULTY 4 +#define MAX_DIFFICULTY 4 + enum RaidDifficulties { - RAID_DIFFICULTY_10MAN_NORMAL = 0, - RAID_DIFFICULTY_10MAN_HEROIC = 1, - RAID_DIFFICULTY_25MAN_NORMAL = 2, - RAID_DIFFICULTY_25MAN_HEROIC = 3, - TOTAL_RAID_DIFFICULTIES }; enum SummonType