From 1ec21cfb717be7ab3649f976866e6301fa1f6465 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 26 Apr 2009 01:19:15 +0400 Subject: [PATCH 01/15] [7714] Implement new command .character level for set level provided level. --- sql/mangos.sql | 3 +- sql/updates/7714_01_mangos_command.sql | 6 ++ sql/updates/Makefile.am | 2 + src/game/Chat.cpp | 3 +- src/game/Chat.h | 2 + src/game/Level3.cpp | 140 ++++++++++++++++++++----- src/shared/revision_nr.h | 2 +- 7 files changed, 131 insertions(+), 27 deletions(-) create mode 100644 sql/updates/7714_01_mangos_command.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index b12ef24f3..e321ce018 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_7706_01_mangos_command` bit(1) default NULL + `required_7714_01_mangos_command` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -285,6 +285,7 @@ INSERT INTO `command` VALUES ('cast target',3,'Syntax: .cast target #spellid [triggered]\r\n Selected target will cast #spellid to his victim. If \'trigered\' or part provided then spell casted with triggered flag.'), ('character customize',2,'Syntax: .character customize [$name]\r\n\r\nMark selected in game or by $name in command character for customize at next login.'), ('character delete',4,'Syntax: .character delete $name\r\n\r\nDelete character $name.'), +('character level',3,'Syntax: .character level [$playername] [#level]\r\n\r\nSet the level of character with $playername (or the selected if not name provided) by #numberoflevels Or +1 if no #numberoflevels provided). If #numberoflevels is omitted, the level will be increase by 1. If #numberoflevels is 0, the same level will be restarted. If no character is selected and name not provided, increase your level. Command can be used for offline character. All stats and dependent values recalculated. At level decrease talents can be reset if need. Also at level decrease equipped items with greater level requirement can be lost.'), ('character rename',2,'Syntax: .character rename [$name]\r\n\r\nMark selected in game or by $name in command character for rename at next login.'), ('combatstop',2,'Syntax: .combatstop [$playername]\r\nStop combat for selected character. If selected non-player then command applied to self. If $playername provided then attempt applied to online player $playername.'), ('commands',0,'Syntax: .commands\r\n\r\nDisplay a list of available commands for your account level.'), diff --git a/sql/updates/7714_01_mangos_command.sql b/sql/updates/7714_01_mangos_command.sql new file mode 100644 index 000000000..a5eeec48b --- /dev/null +++ b/sql/updates/7714_01_mangos_command.sql @@ -0,0 +1,6 @@ +ALTER TABLE db_version CHANGE COLUMN required_7706_01_mangos_command required_7714_01_mangos_command bit; + +DELETE FROM `command` WHERE `name` IN ('character level'); + +INSERT INTO `command` VALUES +('character level',3,'Syntax: .character level [$playername] [#level]\r\n\r\nSet the level of character with $playername (or the selected if not name provided) by #numberoflevels Or +1 if no #numberoflevels provided). If #numberoflevels is omitted, the level will be increase by 1. If #numberoflevels is 0, the same level will be restarted. If no character is selected and name not provided, increase your level. Command can be used for offline character. All stats and dependent values recalculated. At level decrease talents can be reset if need. Also at level decrease equipped items with greater level requirement can be lost.'); diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 1d6d055f6..2c349097c 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -175,6 +175,7 @@ pkgdata_DATA = \ 7662_02_mangos_spell_bonus_data.sql \ 7705_01_mangos_command.sql \ 7706_01_mangos_command.sql \ + 7714_01_mangos_command.sql \ README ## Additional files to include when running 'make dist' @@ -330,4 +331,5 @@ EXTRA_DIST = \ 7662_02_mangos_spell_bonus_data.sql \ 7705_01_mangos_command.sql \ 7706_01_mangos_command.sql \ + 7714_01_mangos_command.sql \ README diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index c3d710c90..e8b207494 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -109,9 +109,10 @@ ChatCommand * ChatHandler::getCommandTable() static ChatCommand characterCommandTable[] = { - { "rename", SEC_GAMEMASTER, true, &ChatHandler::HandleCharacterRenameCommand, "", NULL }, { "customize", SEC_GAMEMASTER, true, &ChatHandler::HandleCharacterCustomizeCommand, "", NULL }, { "delete", SEC_CONSOLE, true, &ChatHandler::HandleCharacterDeleteCommand, "", NULL }, + { "level", SEC_ADMINISTRATOR, true, &ChatHandler::HandleCharacterLevelCommand, "", NULL }, + { "rename", SEC_GAMEMASTER, true, &ChatHandler::HandleCharacterRenameCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; diff --git a/src/game/Chat.h b/src/game/Chat.h index ec9e242b8..47d18974f 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -116,6 +116,7 @@ class ChatHandler bool HandleCharacterCustomizeCommand(const char * args); bool HandleCharacterDeleteCommand(const char* args); bool HandleCharacterRenameCommand(const char * args); + bool HandleCharacterLevelCommand(const char* args); bool HandleDebugAnimCommand(const char* args); bool HandleDebugArenaCommand(const char * args); @@ -498,6 +499,7 @@ class ChatHandler bool HandleBanHelper(BanMode mode,char const* args); bool HandleBanInfoHelper(uint32 accountid, char const* accountname); bool HandleUnBanHelper(BanMode mode,char const* args); + void HandleCharacterLevel(Player* player, uint64 player_guid, uint32 oldlevel, uint32 newlevel); void SetSentErrorMessage(bool val){ sentErrorMessage = val;}; private: diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 4f904a0d4..5c344813d 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -3896,6 +3896,121 @@ bool ChatHandler::HandleHoverCommand(const char* args) return true; } +void ChatHandler::HandleCharacterLevel(Player* player, uint64 player_guid, uint32 oldlevel, uint32 newlevel) +{ + if(player) + { + player->GiveLevel(newlevel); + player->InitTalentForLevel(); + player->SetUInt32Value(PLAYER_XP,0); + + if(oldlevel == newlevel) + ChatHandler(player).SendSysMessage(LANG_YOURS_LEVEL_PROGRESS_RESET); + else if(oldlevel < newlevel) + ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_UP,newlevel-oldlevel); + else // if(oldlevel > newlevel) + ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_DOWN,newlevel-oldlevel); + } + else + { + // update level and XP at level, all other will be updated at loading + Tokens values; + Player::LoadValuesArrayFromDB(values,player_guid); + Player::SetUInt32ValueInArray(values,UNIT_FIELD_LEVEL,newlevel); + Player::SetUInt32ValueInArray(values,PLAYER_XP,0); + Player::SaveValuesArrayInDB(values,player_guid); + } +} + +bool ChatHandler::HandleCharacterLevelCommand(const char* args) +{ + char* px = strtok((char*)args, " "); + char* py = strtok((char*)NULL, " "); + + // command format parsing + char* pname = (char*)NULL; + int32 newlevel = 0; + + if(px && py) // .character level $name #level + { + newlevel = atoi(py); + pname = px; + } + else if(px && !py) // .character level $name OR .character level #level + { + if(isalpha(px[0])) // .character level $name + pname = px; + else // .character level #level + newlevel = atoi(px); + } + // // .character level - progress reset + + if(newlevel < 1) + return false; // invalid level + + if(newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level + newlevel = STRONG_MAX_LEVEL; + + // player + Player *chr = NULL; + uint64 chr_guid = 0; + + std::string name; + + if(pname) // player by name + { + name = extractPlayerNameFromLink(pname); + if(name.empty()) + { + SendSysMessage(LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage(true); + return false; + } + + chr = objmgr.GetPlayer(name.c_str()); + if(!chr) // not in game + { + chr_guid = objmgr.GetPlayerGUIDByName(name); + if (chr_guid == 0) + { + SendSysMessage(LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage(true); + return false; + } + } + } + else // player by selection + { + chr = getSelectedPlayer(); + + if (chr == NULL) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + name = chr->GetName(); + } + + assert(chr || chr_guid); + + int32 oldlevel = chr ? chr->getLevel() : Player::GetUInt32ValueFromDB(UNIT_FIELD_LEVEL,chr_guid); + + if(!px && !py) // .character level - progress reset + newlevel = oldlevel; + + HandleCharacterLevel(chr,chr_guid,oldlevel,newlevel); + + if(m_session->GetPlayer() != chr) // including player==NULL + { + std::string nameLink = playerLink(name); + PSendSysMessage(LANG_YOU_CHANGE_LVL,nameLink.c_str(),newlevel); + } + + return true; +} + bool ChatHandler::HandleLevelUpCommand(const char* args) { char* px = strtok((char*)args, " "); @@ -3970,30 +4085,7 @@ bool ChatHandler::HandleLevelUpCommand(const char* args) if(newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level newlevel = STRONG_MAX_LEVEL; - if(chr) - { - chr->GiveLevel(newlevel); - chr->InitTalentForLevel(); - chr->SetUInt32Value(PLAYER_XP,0); - - if(oldlevel == newlevel) - ChatHandler(chr).SendSysMessage(LANG_YOURS_LEVEL_PROGRESS_RESET); - else - if(oldlevel < newlevel) - ChatHandler(chr).PSendSysMessage(LANG_YOURS_LEVEL_UP,newlevel-oldlevel); - else - if(oldlevel > newlevel) - ChatHandler(chr).PSendSysMessage(LANG_YOURS_LEVEL_DOWN,newlevel-oldlevel); - } - else - { - // update level and XP at level, all other will be updated at loading - Tokens values; - Player::LoadValuesArrayFromDB(values,chr_guid); - Player::SetUInt32ValueInArray(values,UNIT_FIELD_LEVEL,newlevel); - Player::SetUInt32ValueInArray(values,PLAYER_XP,0); - Player::SaveValuesArrayInDB(values,chr_guid); - } + HandleCharacterLevel(chr,chr_guid,oldlevel,newlevel); if(m_session->GetPlayer() != chr) // including chr==NULL { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index cc87beb3c..cd277961d 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 "7713" + #define REVISION_NR "7714" #endif // __REVISION_NR_H__ From c2e6dd20dda42686164c190eb7ebcc673a21802e Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 26 Apr 2009 07:14:46 +0400 Subject: [PATCH 02/15] [7715] Provided way for scripts set alternative gameobject state for client show. Also use enum for gsmeobject states. --- src/game/BattleGround.cpp | 4 ++-- src/game/GameObject.cpp | 48 ++++++++++++++++++++++----------------- src/game/GameObject.h | 41 +++++++++++++++++++++------------ src/game/Level2.cpp | 2 +- src/game/ObjectMgr.cpp | 10 +++++++- src/game/SpellAuras.cpp | 2 +- src/game/SpellEffects.cpp | 14 ++++++------ src/game/Transports.cpp | 2 +- src/game/World.cpp | 8 +++---- src/shared/revision_nr.h | 2 +- 10 files changed, 80 insertions(+), 53 deletions(-) diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index 6ea83c0f4..ee972d2d4 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -1324,7 +1324,7 @@ bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float // so we must create it specific for this instance GameObject * go = new GameObject; if(!go->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT),entry, map, - PHASEMASK_NORMAL, x,y,z,o,rotation0,rotation1,rotation2,rotation3,100,1)) + PHASEMASK_NORMAL, x,y,z,o,rotation0,rotation1,rotation2,rotation3,100,GO_STATE_READY)) { sLog.outErrorDb("Gameobject template %u not found in database! BattleGround not created!", entry); sLog.outError("Cannot create gameobject template %u! BattleGround not created!", entry); @@ -1367,7 +1367,7 @@ void BattleGround::DoorClose(uint32 type) if (obj) { //if doors are open, close it - if (obj->getLootState() == GO_ACTIVATED && !obj->GetGoState()) + if (obj->getLootState() == GO_ACTIVATED && obj->GetGoState() != GO_STATE_READY) { //change state to allow door to be closed obj->SetLootState(GO_READY); diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 7531c01b9..600d74b66 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -88,7 +88,7 @@ void GameObject::RemoveFromWorld() Object::RemoveFromWorld(); } -bool GameObject::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, uint32 go_state) +bool GameObject::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) { Relocate(x,y,z,ang); SetMapId(map->GetId()); @@ -188,7 +188,7 @@ void GameObject::Update(uint32 /*p_time*/) Unit* caster = GetOwner(); if(caster && caster->GetTypeId()==TYPEID_PLAYER) { - SetGoState(0); + SetGoState(GO_STATE_ACTIVE); SetUInt32Value(GAMEOBJECT_FLAGS, GO_FLAG_NODESPAWN); UpdateData udata; @@ -246,11 +246,11 @@ void GameObject::Update(uint32 /*p_time*/) case GAMEOBJECT_TYPE_DOOR: case GAMEOBJECT_TYPE_BUTTON: //we need to open doors if they are closed (add there another condition if this code breaks some usage, but it need to be here for battlegrounds) - if( !GetGoState() ) - SwitchDoorOrButton(false); + if (GetGoState() != GO_STATE_READY) + ResetDoorOrButton(); //flags in AB are type_button and we need to add them here so no break! default: - if(!m_spawnedByDefault) // despawn timer + if (!m_spawnedByDefault) // despawn timer { // can be despawned or destroyed SetLootState(GO_JUST_DEACTIVATED); @@ -368,11 +368,8 @@ void GameObject::Update(uint32 /*p_time*/) { case GAMEOBJECT_TYPE_DOOR: case GAMEOBJECT_TYPE_BUTTON: - if(GetAutoCloseTime() && (m_cooldownTime < time(NULL))) - { - SwitchDoorOrButton(false); - SetLootState(GO_JUST_DEACTIVATED); - } + if (GetAutoCloseTime() && (m_cooldownTime < time(NULL))) + ResetDoorOrButton(); break; } break; @@ -460,7 +457,7 @@ void GameObject::Delete() { SendObjectDeSpawnAnim(GetGUID()); - SetGoState(1); + SetGoState(GO_STATE_READY); SetUInt32Value(GAMEOBJECT_FLAGS, GetGOInfo()->flags); uint16 poolid = poolhandler.IsPartOfAPool(GetGUIDLow(), TYPEID_GAMEOBJECT); @@ -545,8 +542,8 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) << GetFloatValue(GAMEOBJECT_PARENTROTATION+2) << ", " << GetFloatValue(GAMEOBJECT_PARENTROTATION+3) << ", " << m_respawnDelayTime << ", " - << (uint32)GetGoAnimProgress() << ", " - << (uint32)GetGoState() << ")"; + << uint32(GetGoAnimProgress()) << ", " + << uint32(GetGoState()) << ")"; WorldDatabase.BeginTransaction(); WorldDatabase.PExecuteLog("DELETE FROM gameobject WHERE guid = '%u'", m_DBTableGuid); @@ -578,7 +575,7 @@ bool GameObject::LoadFromDB(uint32 guid, Map *map) float rotation3 = data->rotation3; uint32 animprogress = data->animprogress; - uint32 go_state = data->go_state; + GOState go_state = data->go_state; m_DBTableGuid = guid; if (map->GetInstanceId() != 0) guid = objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT); @@ -813,7 +810,17 @@ GameObject* GameObject::LookupFishingHoleAround(float range) return ok; } -void GameObject::UseDoorOrButton(uint32 time_to_restore) +void GameObject::ResetDoorOrButton() +{ + if (m_lootState == GO_READY || m_lootState == GO_JUST_DEACTIVATED) + return; + + SwitchDoorOrButton(false); + SetLootState(GO_JUST_DEACTIVATED); + m_cooldownTime = 0; +} + +void GameObject::UseDoorOrButton(uint32 time_to_restore, bool alternative /* = false */) { if(m_lootState != GO_READY) return; @@ -821,24 +828,23 @@ void GameObject::UseDoorOrButton(uint32 time_to_restore) if(!time_to_restore) time_to_restore = GetAutoCloseTime(); - SwitchDoorOrButton(true); + SwitchDoorOrButton(true,alternative); SetLootState(GO_ACTIVATED); m_cooldownTime = time(NULL) + time_to_restore; - } -void GameObject::SwitchDoorOrButton(bool activate) +void GameObject::SwitchDoorOrButton(bool activate, bool alternative /* = false */) { if(activate) SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); else RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); - if(GetGoState()) //if closed -> open - SetGoState(0); + if(GetGoState() == GO_STATE_READY) //if closed -> open + SetGoState(alternative ? GO_STATE_ACTIVE_ALTERNATIVE : GO_STATE_ACTIVE); else //if open -> close - SetGoState(1); + SetGoState(GO_STATE_READY); } void GameObject::Use(Unit* user) diff --git a/src/game/GameObject.h b/src/game/GameObject.h index f06dbe79e..5b88a6b23 100644 --- a/src/game/GameObject.h +++ b/src/game/GameObject.h @@ -366,12 +366,29 @@ struct GameObjectInfo uint32 ScriptId; }; +// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform +#if defined( __GNUC__ ) +#pragma pack() +#else +#pragma pack(pop) +#endif + struct GameObjectLocale { std::vector Name; std::vector CastBarCaption; }; +// client side GO show states +enum GOState +{ + GO_STATE_ACTIVE = 0, // show in world as used and not reset (closed door open) + GO_STATE_READY = 1, // show in world as ready (closed door close) + GO_STATE_ACTIVE_ALTERNATIVE = 2 // show in world as used in alt way and not reset (closed door open by cannon fire) +}; + +#define MAX_GO_STATE 3 + // from `gameobject` struct GameObjectData { @@ -388,17 +405,10 @@ struct GameObjectData float rotation3; int32 spawntimesecs; uint32 animprogress; - uint32 go_state; + GOState go_state; uint8 spawnMask; }; -// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform -#if defined( __GNUC__ ) -#pragma pack() -#else -#pragma pack(pop) -#endif - // For containers: [GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY -> ... // For bobber: GO_NOT_READY ->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED-> // For door(closed):[GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY(close) -> ... @@ -425,7 +435,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject void AddToWorld(); void RemoveFromWorld(); - 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, uint32 go_state); + 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); GameObjectInfo const* GetGOInfo() const; @@ -456,7 +466,6 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask); bool LoadFromDB(uint32 guid, Map *map); void DeleteFromDB(); - void SetLootState(LootState s) { m_lootState = s; } static uint32 GetLootId(GameObjectInfo const* info); uint32 GetLootId() const { return GetLootId(GetGOInfo()); } uint32 GetLockId() const @@ -523,8 +532,8 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject void getFishLoot(Loot *loot, Player* loot_owner); GameobjectTypes GetGoType() const { return GameobjectTypes(GetByteValue(GAMEOBJECT_BYTES_1, 1)); } void SetGoType(GameobjectTypes type) { SetByteValue(GAMEOBJECT_BYTES_1, 1, type); } - uint8 GetGoState() const { return GetByteValue(GAMEOBJECT_BYTES_1, 0); } - void SetGoState(uint8 state) { SetByteValue(GAMEOBJECT_BYTES_1, 0, state); } + GOState GetGoState() const { return GOState(GetByteValue(GAMEOBJECT_BYTES_1, 0)); } + void SetGoState(GOState state) { SetByteValue(GAMEOBJECT_BYTES_1, 0, state); } uint8 GetGoArtKit() const { return GetByteValue(GAMEOBJECT_BYTES_1, 2); } void SetGoArtKit(uint8 artkit) { SetByteValue(GAMEOBJECT_BYTES_1, 2, artkit); } uint8 GetGoAnimProgress() const { return GetByteValue(GAMEOBJECT_BYTES_1, 3); } @@ -533,6 +542,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject void Use(Unit* user); LootState getLootState() const { return m_lootState; } + void SetLootState(LootState s) { m_lootState = s; } void AddToSkillupList(uint32 PlayerGuidLow) { m_SkillupList.push_back(PlayerGuidLow); } bool IsInSkillupList(uint32 PlayerGuidLow) const @@ -556,7 +566,10 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject bool hasQuest(uint32 quest_id) const; bool hasInvolvedQuest(uint32 quest_id) const; bool ActivateToQuest(Player *pTarget) const; - void UseDoorOrButton(uint32 time_to_restore = 0); // 0 = use `gameobject`.`spawntimesecs` + void UseDoorOrButton(uint32 time_to_restore = 0, bool alternative = false); + // 0 = use `gameobject`.`spawntimesecs` + void ResetDoorOrButton(); + // 0 = use `gameobject`.`spawntimesecs` uint32 GetLinkedGameObjectEntry() const { @@ -611,7 +624,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject uint32 m_DBTableGuid; ///< For new or temporary gameobjects is 0 for saved it is lowguid GameObjectInfo const* m_goInfo; private: - void SwitchDoorOrButton(bool activate); + void SwitchDoorOrButton(bool activate, bool alternative = false); GridReference m_gridRef; }; diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index fc757bb98..1237ef026 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -740,7 +740,7 @@ bool ChatHandler::HandleGameObjectAddCommand(const char* args) GameObject* pGameObj = new GameObject; uint32 db_lowGUID = objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT); - if(!pGameObj->Create(db_lowGUID, goI->id, map, chr->GetPhaseMaskForSpawn(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, 1)) + if(!pGameObj->Create(db_lowGUID, goI->id, map, chr->GetPhaseMaskForSpawn(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY)) { delete pGameObj; return false; diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index d87ef4150..af0767a8f 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -1081,7 +1081,15 @@ void ObjectMgr::LoadGameobjects() data.rotation3 = fields[10].GetFloat(); data.spawntimesecs = fields[11].GetInt32(); data.animprogress = fields[12].GetUInt32(); - data.go_state = fields[13].GetUInt32(); + + 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); + continue; + } + data.go_state = GOState(go_state); + data.spawnMask = fields[14].GetUInt8(); data.phaseMask = fields[15].GetUInt16(); int16 gameEvent = fields[16].GetInt16(); diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 65c0a69d9..939dbcbcb 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -3406,7 +3406,7 @@ void Aura::HandleAuraModStun(bool apply, bool Real) { GameObject* pObj = new GameObject; if(pObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), 185584, m_target->GetMap(), m_target->GetPhaseMask(), - m_target->GetPositionX(), m_target->GetPositionY(), m_target->GetPositionZ(), m_target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, 1)) + m_target->GetPositionX(), m_target->GetPositionY(), m_target->GetPositionZ(), m_target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY)) { pObj->SetRespawnTime(GetAuraDuration()/IN_MILISECONDS); pObj->SetSpellId(GetId()); diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 5d56514df..f68cb4b1a 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -793,7 +793,7 @@ void Spell::EffectDummy(uint32 i) // create before death for get proper coordinates if(!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), 179644, map, m_caster->GetPhaseMask(), creatureTarget->GetPositionX(), creatureTarget->GetPositionY(), creatureTarget->GetPositionZ(), - creatureTarget->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, 1) ) + creatureTarget->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY) ) { delete pGameObj; return; @@ -4558,7 +4558,7 @@ void Spell::EffectSummonObjectWild(uint32 i) Map *map = target->GetMap(); if(!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), gameobject_id, map, - m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, 1)) + m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY)) { delete pGameObj; return; @@ -4606,7 +4606,7 @@ void Spell::EffectSummonObjectWild(uint32 i) { GameObject* linkedGO = new GameObject; if(linkedGO->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, map, - m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, 1)) + m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY)) { linkedGO->SetRespawnTime(duration > 0 ? duration/IN_MILISECONDS : 0); linkedGO->SetSpellId(m_spellInfo->Id); @@ -5260,7 +5260,7 @@ void Spell::EffectDuel(uint32 i) m_caster->GetPositionX()+(unitTarget->GetPositionX()-m_caster->GetPositionX())/2 , m_caster->GetPositionY()+(unitTarget->GetPositionY()-m_caster->GetPositionY())/2 , m_caster->GetPositionZ(), - m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0, 1)) + m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY)) { delete pGameObj; return; @@ -5649,7 +5649,7 @@ void Spell::EffectSummonObject(uint32 i) Map *map = m_caster->GetMap(); if(!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), go_id, map, - m_caster->GetPhaseMask(), x, y, z, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0, 1)) + m_caster->GetPhaseMask(), x, y, z, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY)) { delete pGameObj; return; @@ -6239,7 +6239,7 @@ void Spell::EffectTransmitted(uint32 effIndex) GameObject* pGameObj = new GameObject; if(!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), name_id, cMap, - m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, 1)) + m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY)) { delete pGameObj; return; @@ -6306,7 +6306,7 @@ void Spell::EffectTransmitted(uint32 effIndex) { GameObject* linkedGO = new GameObject; if(linkedGO->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, cMap, - m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, 1)) + 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() ); diff --git a/src/game/Transports.cpp b/src/game/Transports.cpp index 95e0dbcdd..860bdfd40 100644 --- a/src/game/Transports.cpp +++ b/src/game/Transports.cpp @@ -172,7 +172,7 @@ bool Transport::Create(uint32 guidlow, uint32 mapid, float x, float y, float z, SetUInt32Value(GAMEOBJECT_DISPLAYID, goinfo->displayId); - SetGoState(1); + SetGoState(GO_STATE_READY); SetGoType(GameobjectTypes(goinfo->type)); SetGoAnimProgress(animprogress); diff --git a/src/game/World.cpp b/src/game/World.cpp index 5ed2c327e..45c5c093c 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -2000,18 +2000,18 @@ void World::ScriptsProcess() CellLock cell_lock(cell, p); cell_lock->Visit(cell_lock, object_checker, *caster->GetMap()); - if ( !door ) + if (!door) { sLog.outError("SCRIPT_COMMAND_OPEN_DOOR failed for gameobject(guid: %u).", step.script->datalong); break; } - if ( door->GetGoType() != GAMEOBJECT_TYPE_DOOR ) + if (door->GetGoType() != GAMEOBJECT_TYPE_DOOR) { sLog.outError("SCRIPT_COMMAND_OPEN_DOOR failed for non-door(GoType: %u).", door->GetGoType()); break; } - if( !door->GetGoState() ) + if (door->GetGoState() != GO_STATE_READY) break; //door already open door->UseDoorOrButton(time_to_close); @@ -2067,7 +2067,7 @@ void World::ScriptsProcess() break; } - if( door->GetGoState() ) + if( door->GetGoState() == GO_STATE_READY ) break; //door already closed door->UseDoorOrButton(time_to_open); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index cd277961d..3be8dae7c 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 "7714" + #define REVISION_NR "7715" #endif // __REVISION_NR_H__ From c9d51a6dc7d7daad658c75e12fc7d313a695fe2b Mon Sep 17 00:00:00 2001 From: AlexDereka Date: Sun, 26 Apr 2009 18:49:00 +0400 Subject: [PATCH 03/15] [7716] Fixed some typos and possible crashes. --- src/game/AchievementMgr.cpp | 22 +-- src/game/BattleGroundHandler.cpp | 8 +- src/game/BattleGroundMgr.cpp | 23 +-- src/game/Channel.cpp | 14 +- src/game/CreatureEventAI.cpp | 6 +- src/game/GameEventMgr.cpp | 12 +- src/game/Group.cpp | 4 +- src/game/GuildHandler.cpp | 2 +- src/game/InstanceSaveMgr.cpp | 16 +- src/game/ItemHandler.cpp | 2 +- src/game/Level2.cpp | 4 +- src/game/MapInstanced.cpp | 2 +- src/game/MiscHandler.cpp | 5 +- src/game/ObjectMgr.cpp | 26 ++-- src/game/Pet.cpp | 18 +-- src/game/PetHandler.cpp | 17 ++- src/game/PetitionsHandler.cpp | 8 +- src/game/Player.cpp | 241 +++++++++++++++---------------- src/game/SpellAuras.cpp | 5 +- src/game/SpellEffects.cpp | 37 ++--- src/game/SpellMgr.h | 12 +- src/game/Unit.cpp | 12 +- src/game/debugcmds.cpp | 40 ++--- src/shared/ServiceWin32.cpp | 6 +- src/shared/revision_nr.h | 2 +- 25 files changed, 281 insertions(+), 263 deletions(-) diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp index 03083a60b..f3a352c6c 100644 --- a/src/game/AchievementMgr.cpp +++ b/src/game/AchievementMgr.cpp @@ -720,12 +720,12 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui continue; // skip wrong arena achievements, if not achievIdByArenaSlot then normal total death counter bool notfit = false; - for(int i = 0; i < MAX_ARENA_SLOT; ++i) + for(int j = 0; j < MAX_ARENA_SLOT; ++j) { - if(achievIdByArenaSlot[i] == achievement->ID) + if(achievIdByArenaSlot[j] == achievement->ID) { BattleGround* bg = GetPlayer()->GetBattleGround(); - if(!bg || !bg->isArena() || ArenaTeam::GetSlotByType(bg->GetArenaType()) != i) + if(!bg || !bg->isArena() || ArenaTeam::GetSlotByType(bg->GetArenaType()) != j) notfit = true; break; @@ -749,26 +749,26 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui // search case bool found = false; - for(int i = 0; achievIdForDangeon[i][0]; ++i) + for(int j = 0; achievIdForDangeon[j][0]; ++j) { - if(achievIdForDangeon[i][0] == achievement->ID) + if(achievIdForDangeon[j][0] == achievement->ID) { if(map->IsRaid()) { // if raid accepted (ignore difficulty) - if(!achievIdForDangeon[i][2]) + if(!achievIdForDangeon[j][2]) break; // for } else if(GetPlayer()->GetDifficulty()==DIFFICULTY_NORMAL) { // dungeon in normal mode accepted - if(!achievIdForDangeon[i][1]) + if(!achievIdForDangeon[j][1]) break; // for } else { // dungeon in heroic mode accepted - if(!achievIdForDangeon[i][3]) + if(!achievIdForDangeon[j][3]) break; // for } @@ -890,9 +890,9 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui break; bool matchFound = false; - for (int i = 0; i < 3; ++i) + for (int j = 0; j < 3; ++j) { - int32 exploreFlag = GetAreaFlagByAreaID(worldOverlayEntry->areatableID[i]); + int32 exploreFlag = GetAreaFlagByAreaID(worldOverlayEntry->areatableID[j]); if(exploreFlag < 0) break; @@ -1392,7 +1392,7 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry, { progress = &iter->second; - uint32 newValue; + uint32 newValue = 0; switch(ptype) { case PROGRESS_SET: diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp index 06435bd34..f5cf3bf48 100644 --- a/src/game/BattleGroundHandler.cpp +++ b/src/game/BattleGroundHandler.cpp @@ -110,9 +110,9 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data ) return; // get bg instance or bg template if instance not found - BattleGround * bg = NULL; + BattleGround *bg = NULL; if (instanceId) - BattleGround *bg = sBattleGroundMgr.GetBattleGroundThroughClientInstance(instanceId, bgTypeId, _player->GetBattleGroundQueueIdFromLevel(bgTypeId)); + bg = sBattleGroundMgr.GetBattleGroundThroughClientInstance(instanceId, bgTypeId, _player->GetBattleGroundQueueIdFromLevel(bgTypeId)); if (!bg && !(bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId))) { @@ -357,7 +357,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data ) else { // get the bg we're invited to - BattleGround * bg = sBattleGroundMgr.GetBattleGround(itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID, bgTypeId); + bg = sBattleGroundMgr.GetBattleGround(itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID, bgTypeId); status = STATUS_WAIT_JOIN; } @@ -571,7 +571,7 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ ) } else { - BattleGround *bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId); + bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId); if (!bg) continue; uint32 avgTime = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].GetAverageQueueWaitTime(itrPlayerStatus->second.GroupInfo, _player->GetBattleGroundQueueIdFromLevel(bgTypeId)); diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index 4f62ebc93..098b75574 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -761,10 +761,10 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve FillPlayersToBG(bg, queue_id); // now everything is set, invite players - for(GroupsQueueType::const_iterator itr = m_SelectionPools[BG_TEAM_ALLIANCE].SelectedGroups.begin(); itr != m_SelectionPools[BG_TEAM_ALLIANCE].SelectedGroups.end(); ++itr) - InviteGroupToBG((*itr), bg, (*itr)->Team); - for(GroupsQueueType::const_iterator itr = m_SelectionPools[BG_TEAM_HORDE].SelectedGroups.begin(); itr != m_SelectionPools[BG_TEAM_HORDE].SelectedGroups.end(); ++itr) - InviteGroupToBG((*itr), bg, (*itr)->Team); + for(GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE].SelectedGroups.end(); ++citr) + InviteGroupToBG((*citr), bg, (*citr)->Team); + for(GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_HORDE].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_HORDE].SelectedGroups.end(); ++citr) + InviteGroupToBG((*citr), bg, (*citr)->Team); if (!bg->HasFreeSlots()) { @@ -834,8 +834,8 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve } //invite those selection pools for(uint32 i = 0; i < BG_TEAMS_COUNT; i++) - for(GroupsQueueType::const_iterator itr = m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.begin(); itr != m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.end(); ++itr) - InviteGroupToBG((*itr), bg2, (*itr)->Team); + for(GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr) + InviteGroupToBG((*citr), bg2, (*citr)->Team); //start bg bg2->StartBattleGround(); //clear structures @@ -861,8 +861,8 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve // invite those selection pools for(uint32 i = 0; i < BG_TEAMS_COUNT; i++) - for(GroupsQueueType::const_iterator itr = m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.begin(); itr != m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.end(); ++itr) - InviteGroupToBG((*itr), bg2, (*itr)->Team); + for(GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr) + InviteGroupToBG((*citr), bg2, (*citr)->Team); // start bg bg2->StartBattleGround(); } @@ -1824,10 +1824,11 @@ void BattleGroundMgr::DistributeArenaPoints() void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, const uint64& guid, Player* plr, BattleGroundTypeId bgTypeId) { - uint32 PlayerLevel = 10; + if (!plr) + return; - if (plr) - PlayerLevel = plr->getLevel(); + uint32 PlayerLevel = 10; + PlayerLevel = plr->getLevel(); data->Initialize(SMSG_BATTLEFIELD_LIST); *data << uint64(guid); // battlemaster guid diff --git a/src/game/Channel.cpp b/src/game/Channel.cpp index c38c5592b..f5710b9f5 100644 --- a/src/game/Channel.cpp +++ b/src/game/Channel.cpp @@ -298,10 +298,11 @@ void Channel::Password(uint64 p, const char *pass) void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set) { - uint32 sec = 0; Player *plr = objmgr.GetPlayer(p); - if(plr) - sec = plr->GetSession()->GetSecurity(); + if (!plr) + return; + + uint32 sec = plr->GetSession()->GetSecurity(); if(!IsOn(p)) { @@ -366,10 +367,11 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set) void Channel::SetOwner(uint64 p, const char *newname) { - uint32 sec = 0; Player *plr = objmgr.GetPlayer(p); - if(plr) - sec = plr->GetSession()->GetSecurity(); + if (!plr) + return; + + uint32 sec = plr->GetSession()->GetSecurity(); if(!IsOn(p)) { diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index 3717f6748..bf8986643 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -622,7 +622,7 @@ void CreatureEventAI::ProcessAction(uint16 type, uint32 param1, uint32 param2, u } //Allowed to cast only if not casting (unless we interrupt ourself) or if spell is triggered - bool canCast = !(caster->IsNonMeleeSpellCasted(false) && (param3 & CAST_TRIGGERED | CAST_INTURRUPT_PREVIOUS)); + bool canCast = !(caster->IsNonMeleeSpellCasted(false) && (param3 & (CAST_TRIGGERED | CAST_INTURRUPT_PREVIOUS))); // If cast flag CAST_AURA_NOT_PRESENT is active, check if target already has aura on them if(param3 & CAST_AURA_NOT_PRESENT) @@ -912,8 +912,8 @@ void CreatureEventAI::ProcessAction(uint16 type, uint32 param1, uint32 param2, u //if not available, use pActionInvoker if (Unit* pTarget = GetTargetByType(param2, pActionInvoker)) { - if (Player* pPlayer = pTarget->GetCharmerOrOwnerPlayerOrPlayerItself()) - pPlayer->RewardPlayerAndGroupAtEvent(param1, m_creature); + if (Player* pPlayer2 = pTarget->GetCharmerOrOwnerPlayerOrPlayerItself()) + pPlayer2->RewardPlayerAndGroupAtEvent(param1, m_creature); } } } diff --git a/src/game/GameEventMgr.cpp b/src/game/GameEventMgr.cpp index e2b7386a8..2ad481e82 100644 --- a/src/game/GameEventMgr.cpp +++ b/src/game/GameEventMgr.cpp @@ -683,17 +683,17 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate) } else // If not spawned { - CreatureData const* data = objmgr.GetCreatureData(itr->first); - if (data && activate) + CreatureData const* data2 = objmgr.GetCreatureData(itr->first); + if (data2 && activate) { - CreatureInfo const *cinfo = objmgr.GetCreatureTemplate(data->id); - uint32 display_id = objmgr.ChooseDisplayId(0,cinfo,data); + CreatureInfo const *cinfo = objmgr.GetCreatureTemplate(data2->id); + uint32 display_id = objmgr.ChooseDisplayId(0,cinfo,data2); CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id); if (minfo) display_id = minfo->modelid; - if (data->equipmentId == 0) + if (data2->equipmentId == 0) itr->second.equipement_id_prev = cinfo->equipmentId; - else if (data->equipmentId != -1) + else if (data2->equipmentId != -1) itr->second.equipement_id_prev = data->equipmentId; itr->second.modelid_prev = display_id; } diff --git a/src/game/Group.cpp b/src/game/Group.cpp index e6e01aa13..c2e81576d 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -70,8 +70,8 @@ Group::~Group() // 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(BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr) - itr->second.save->RemoveGroup(this); + for(BoundInstancesMap::iterator itr2 = m_boundInstances[i].begin(); itr2 != m_boundInstances[i].end(); ++itr2) + itr2->second.save->RemoveGroup(this); // Sub group counters clean up if (m_subGroupsCounts) diff --git a/src/game/GuildHandler.cpp b/src/game/GuildHandler.cpp index 934a77b70..607d469a9 100644 --- a/src/game/GuildHandler.cpp +++ b/src/game/GuildHandler.cpp @@ -1193,7 +1193,7 @@ void WorldSession::HandleGuildBankDepositItem( WorldPacket & recv_data ) else // swap { gDest.clear(); - uint8 msg = pGuild->CanStoreItem(BankTabDst,BankTabSlotDst,gDest,pItemSrc->GetCount(),pItemSrc,true); + msg = pGuild->CanStoreItem(BankTabDst,BankTabSlotDst,gDest,pItemSrc->GetCount(),pItemSrc,true); if( msg != EQUIP_ERR_OK ) { pl->SendEquipError( msg, pItemSrc, NULL ); diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp index f3fb36a6c..223620d86 100644 --- a/src/game/InstanceSaveMgr.cpp +++ b/src/game/InstanceSaveMgr.cpp @@ -52,16 +52,16 @@ InstanceSaveManager::~InstanceSaveManager() for (InstanceSaveHashMap::iterator itr = m_instanceSaveById.begin(); itr != m_instanceSaveById.end(); ++itr) { InstanceSave *save = itr->second; - for(InstanceSave::PlayerListType::iterator itr = save->m_playerList.begin(), next = itr; itr != save->m_playerList.end(); itr = next) + for(InstanceSave::PlayerListType::iterator itr2 = save->m_playerList.begin(), next = itr2; itr2 != save->m_playerList.end(); itr2 = next) { ++next; - (*itr)->UnbindInstance(save->GetMapId(), save->GetDifficulty(), true); + (*itr2)->UnbindInstance(save->GetMapId(), save->GetDifficulty(), true); } save->m_playerList.clear(); - for(InstanceSave::GroupListType::iterator itr = save->m_groupList.begin(), next = itr; itr != save->m_groupList.end(); itr = next) + for(InstanceSave::GroupListType::iterator itr2 = save->m_groupList.begin(), next = itr2; itr2 != save->m_groupList.end(); itr2 = next) { ++next; - (*itr)->UnbindInstance(save->GetMapId(), save->GetDifficulty(), true); + (*itr2)->UnbindInstance(save->GetMapId(), save->GetDifficulty(), true); } save->m_groupList.clear(); delete save; @@ -617,10 +617,10 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, bool warn, uint32 timeLe MapInstanced::InstancedMaps::iterator mitr; for(mitr = instMaps.begin(); mitr != instMaps.end(); ++mitr) { - Map *map = mitr->second; - if(!map->IsDungeon()) continue; - if(warn) ((InstanceMap*)map)->SendResetWarnings(timeLeft); - else ((InstanceMap*)map)->Reset(INSTANCE_RESET_GLOBAL); + Map *map2 = mitr->second; + if(!map2->IsDungeon()) continue; + if(warn) ((InstanceMap*)map2)->SendResetWarnings(timeLeft); + else ((InstanceMap*)map2)->Reset(INSTANCE_RESET_GLOBAL); } // TODO: delete creature/gameobject respawn times even if the maps are not loaded diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp index 1c982fc1a..ee6296498 100644 --- a/src/game/ItemHandler.cpp +++ b/src/game/ItemHandler.cpp @@ -199,7 +199,7 @@ void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data ) // check dest->src move possibility ItemPosCountVec sSrc; - uint16 eSrc; + uint16 eSrc = 0; if( _player->IsInventoryPos( src ) ) { msg = _player->CanStoreItem( srcbag, srcslot, sSrc, pDstItem, true ); diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index 1237ef026..cc4117c13 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -553,7 +553,7 @@ bool ChatHandler::HandleGameObjectDeleteCommand(const char* args) if(owner_guid) { Unit* owner = ObjectAccessor::GetUnit(*m_session->GetPlayer(),owner_guid); - if(!owner && !IS_PLAYER_GUID(owner_guid)) + if(!owner || !IS_PLAYER_GUID(owner_guid)) { PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, GUID_LOPART(owner_guid), obj->GetGUIDLow()); SetSentErrorMessage(true); @@ -1375,7 +1375,7 @@ bool ChatHandler::HandleNpcMoveCommand(const char* args) if(!cId) return false; - uint32 lowguid = atoi(cId); + lowguid = atoi(cId); /* FIXME: impossibel without entry if(lowguid) diff --git a/src/game/MapInstanced.cpp b/src/game/MapInstanced.cpp index a89238ff9..e6eaa6298 100644 --- a/src/game/MapInstanced.cpp +++ b/src/game/MapInstanced.cpp @@ -208,7 +208,7 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave *save, } // some instances only have one difficulty - if(!entry->SupportsHeroicMode()) difficulty = DIFFICULTY_NORMAL; + if (entry && !entry->SupportsHeroicMode()) difficulty = 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/MiscHandler.cpp b/src/game/MiscHandler.cpp index 59097b3c5..cc40850c6 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -1380,7 +1380,10 @@ void WorldSession::HandleReportSpamOpcode( WorldPacket & recv_data ) uint8 spam_type; // 0 - mail, 1 - chat uint64 spammer_guid; - uint32 unk1, unk2, unk3, unk4 = 0; + uint32 unk1 = 0; + uint32 unk2 = 0; + uint32 unk3 = 0; + uint32 unk4 = 0; std::string description = ""; recv_data >> spam_type; // unk 0x01 const, may be spam type (mail/chat) recv_data >> spammer_guid; // player guid diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index af0767a8f..fc32e21e3 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -600,12 +600,12 @@ void ObjectMgr::LoadCreatureTemplates() sLog.outErrorDb("Creature (Entry: %u) has non-existing PetSpellDataId (%u)", cInfo->Entry, cInfo->PetSpellDataId); } - for(int i = 0; i < CREATURE_MAX_SPELLS; ++i) + for(int j = 0; j < CREATURE_MAX_SPELLS; ++j) { - if(cInfo->spells[i] && !sSpellStore.LookupEntry(cInfo->spells[i])) + if(cInfo->spells[j] && !sSpellStore.LookupEntry(cInfo->spells[j])) { - sLog.outErrorDb("Creature (Entry: %u) has non-existing Spell%d (%u), set to 0", cInfo->Entry, i+1,cInfo->spells[i]); - const_cast(cInfo)->spells[i] = 0; + sLog.outErrorDb("Creature (Entry: %u) has non-existing Spell%d (%u), set to 0", cInfo->Entry, j+1,cInfo->spells[j]); + const_cast(cInfo)->spells[j] = 0; } } @@ -2694,15 +2694,15 @@ void ObjectMgr::LoadGroups() result = CharacterDatabase.Query("SELECT memberGuid, assistant, subgroup, leaderGuid FROM group_member ORDER BY leaderGuid"); if(!result) { - barGoLink bar( 1 ); - bar.step(); + barGoLink bar2( 1 ); + bar2.step(); } else { - barGoLink bar( result->GetRowCount() ); + barGoLink bar2( result->GetRowCount() ); do { - bar.step(); + bar2.step(); Field *fields = result->Fetch(); count++; leaderGuid = MAKE_NEW_GUID(fields[3].GetUInt32(), 0, HIGHGUID_PLAYER); @@ -2754,15 +2754,15 @@ void ObjectMgr::LoadGroups() if(!result) { - barGoLink bar( 1 ); - bar.step(); + barGoLink bar2( 1 ); + bar2.step(); } else { - barGoLink bar( result->GetRowCount() ); + barGoLink bar2( result->GetRowCount() ); do { - bar.step(); + bar2.step(); Field *fields = result->Fetch(); count++; leaderGuid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER); @@ -3149,7 +3149,7 @@ void ObjectMgr::LoadQuests() { sLog.outErrorDb("Quest %u has `ReqSpellCast%d` = %u but spell %u does not exist, quest can't be done.", qinfo->GetQuestId(),j+1,id,id); - // no changes, quest can't be done for this requirement + continue; } if(!qinfo->ReqCreatureOrGOId[j]) diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 8d22a9a3f..38ca2a200 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -339,10 +339,10 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool delete m_declinedname; m_declinedname = new DeclinedName; - Field *fields = result->Fetch(); + Field *fields2 = result->Fetch(); for(int i = 0; i < MAX_DECLINED_NAME_CASES; ++i) { - m_declinedname->name[i] = fields[i].GetCppString(); + m_declinedname->name[i] = fields2[i].GetCppString(); } } } @@ -1321,19 +1321,19 @@ bool Pet::addSpell(uint32 spell_id, uint16 active, PetSpellState state, PetSpell } else if(uint32 chainstart = spellmgr.GetFirstSpellInChain(spell_id)) { - for (PetSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr) + for (PetSpellMap::iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2) { - if(itr->second->state == PETSPELL_REMOVED) continue; + if(itr2->second->state == PETSPELL_REMOVED) continue; - if(spellmgr.GetFirstSpellInChain(itr->first) == chainstart) + if(spellmgr.GetFirstSpellInChain(itr2->first) == chainstart) { - newspell->active = itr->second->active; + newspell->active = itr2->second->active; if(newspell->active == ACT_ENABLED) - ToggleAutocast(itr->first, false); + ToggleAutocast(itr2->first, false); - oldspell_id = itr->first; - unlearnSpell(itr->first); + oldspell_id = itr2->first; + unlearnSpell(itr2->first); break; } } diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp index 562b8915a..5d2f5d6e7 100644 --- a/src/game/PetHandler.cpp +++ b/src/game/PetHandler.cpp @@ -194,10 +194,19 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data ) //auto turn to target unless possessed if(result == SPELL_FAILED_UNIT_NOT_INFRONT && !pet->HasAuraType(SPELL_AURA_MOD_POSSESS)) { - pet->SetInFront(unit_target); - if( unit_target->GetTypeId() == TYPEID_PLAYER ) - pet->SendUpdateToPlayer( (Player*)unit_target ); - if(Unit* powner = pet->GetCharmerOrOwner()) + if(unit_target) + { + pet->SetInFront(unit_target); + if (unit_target->GetTypeId() == TYPEID_PLAYER) + pet->SendUpdateToPlayer( (Player*)unit_target ); + } + else if(Unit *unit_target2 = spell->m_targets.getUnitTarget()) + { + pet->SetInFront(unit_target2); + if (unit_target2->GetTypeId() == TYPEID_PLAYER) + pet->SendUpdateToPlayer( (Player*)unit_target2 ); + } + if (Unit* powner = pet->GetCharmerOrOwner()) if(powner->GetTypeId() == TYPEID_PLAYER) pet->SendUpdateToPlayer((Player*)powner); result = SPELL_CAST_OK; diff --git a/src/game/PetitionsHandler.cpp b/src/game/PetitionsHandler.cpp index 0087253a1..2dc05079a 100644 --- a/src/game/PetitionsHandler.cpp +++ b/src/game/PetitionsHandler.cpp @@ -279,8 +279,8 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data) for(uint8 i = 1; i <= signs; i++) { - Field *fields = result->Fetch(); - uint64 plguid = fields[0].GetUInt64(); + Field *fields2 = result->Fetch(); + uint64 plguid = fields2[0].GetUInt64(); data << plguid; // Player GUID data << (uint32)0; // there 0 ... @@ -690,8 +690,8 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data) for(uint8 i = 1; i <= signs; i++) { - Field *fields = result->Fetch(); - uint64 plguid = fields[0].GetUInt64(); + Field *fields2 = result->Fetch(); + plguid = fields2[0].GetUInt64(); data << plguid; // Player GUID data << (uint32)0; // there 0 ... diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 114786b45..3dc6df4d6 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -759,7 +759,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8 } // if this is ammo then use it - uint8 msg = CanUseAmmo( pItem->GetEntry() ); + msg = CanUseAmmo( pItem->GetEntry() ); if( msg == EQUIP_ERR_OK ) SetAmmo( pItem->GetEntry() ); } @@ -863,8 +863,8 @@ void Player::EnvironmentalDamage(EnviromentalDamage type, uint32 damage) DEBUG_LOG("We are fall to death, loosing 10 percents durability"); DurabilityLossAll(0.10f,false); // durability lost message - WorldPacket data(SMSG_DURABILITY_DAMAGE_DEATH, 0); - GetSession()->SendPacket(&data); + WorldPacket data2(SMSG_DURABILITY_DAMAGE_DEATH, 0); + GetSession()->SendPacket(&data2); } GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATHS_FROM, 1, type); @@ -2802,22 +2802,22 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen // replace spells in action bars and spellbook to bigger rank if only one spell rank must be accessible if(newspell->active && !newspell->disabled && !SpellMgr::canStackSpellRanks(spellInfo) && spellmgr.GetSpellRank(spellInfo->Id) != 0) { - for( PlayerSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr ) + for( PlayerSpellMap::iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2 ) { - if(itr->second->state == PLAYERSPELL_REMOVED) continue; - SpellEntry const *i_spellInfo = sSpellStore.LookupEntry(itr->first); + if(itr2->second->state == PLAYERSPELL_REMOVED) continue; + SpellEntry const *i_spellInfo = sSpellStore.LookupEntry(itr2->first); if(!i_spellInfo) continue; - if( spellmgr.IsRankSpellDueToSpell(spellInfo,itr->first) ) + if( spellmgr.IsRankSpellDueToSpell(spellInfo,itr2->first) ) { - if(itr->second->active) + if(itr2->second->active) { - if(spellmgr.IsHighRankOfSpell(spell_id,itr->first)) + if(spellmgr.IsHighRankOfSpell(spell_id,itr2->first)) { if(IsInWorld()) // not send spell (re-/over-)learn packets at loading { WorldPacket data(SMSG_SUPERCEDED_SPELL, (4)); - data << uint16(itr->first); + data << uint16(itr2->first); data << uint16(spell_id); GetSession()->SendPacket( &data ); } @@ -2828,13 +2828,13 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen itr->second->state = PLAYERSPELL_CHANGED; superceded_old = true; // new spell replace old in action bars and spell book. } - else if(spellmgr.IsHighRankOfSpell(itr->first,spell_id)) + else if(spellmgr.IsHighRankOfSpell(itr2->first,spell_id)) { if(IsInWorld()) // not send spell (re-/over-)learn packets at loading { WorldPacket data(SMSG_SUPERCEDED_SPELL, (4)); data << uint16(spell_id); - data << uint16(itr->first); + data << uint16(itr2->first); GetSession()->SendPacket( &data ); } @@ -2947,14 +2947,14 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen SpellLearnSpellMap::const_iterator spell_begin = spellmgr.GetBeginSpellLearnSpell(spell_id); SpellLearnSpellMap::const_iterator spell_end = spellmgr.GetEndSpellLearnSpell(spell_id); - for(SpellLearnSpellMap::const_iterator itr = spell_begin; itr != spell_end; ++itr) + for(SpellLearnSpellMap::const_iterator itr2 = spell_begin; itr2 != spell_end; ++itr2) { - if(!itr->second.autoLearned) + if(!itr2->second.autoLearned) { - if(!IsInWorld() || !itr->second.active) // at spells loading, no output, but allow save - addSpell(itr->second.spell,itr->second.active,true,true,false); + if(!IsInWorld() || !itr2->second.active) // at spells loading, no output, but allow save + addSpell(itr2->second.spell,itr2->second.active,true,true,false); else // at normal learning - learnSpell(itr->second.spell,true); + learnSpell(itr2->second.spell,true); } } @@ -5226,15 +5226,15 @@ void Player::SetSkill(uint32 id, uint16 currVal, uint16 maxVal) // temporary bonuses AuraList const& mModSkill = GetAurasByType(SPELL_AURA_MOD_SKILL); - for(AuraList::const_iterator i = mModSkill.begin(); i != mModSkill.end(); ++i) - if ((*i)->GetModifier()->m_miscvalue == int32(id)) - (*i)->ApplyModifier(true); + for(AuraList::const_iterator j = mModSkill.begin(); j != mModSkill.end(); ++j) + if ((*j)->GetModifier()->m_miscvalue == int32(id)) + (*j)->ApplyModifier(true); // permanent bonuses AuraList const& mModSkillTalent = GetAurasByType(SPELL_AURA_MOD_SKILL_TALENT); - for(AuraList::const_iterator i = mModSkillTalent.begin(); i != mModSkillTalent.end(); ++i) - if ((*i)->GetModifier()->m_miscvalue == int32(id)) - (*i)->ApplyModifier(true); + for(AuraList::const_iterator j = mModSkillTalent.begin(); j != mModSkillTalent.end(); ++j) + if ((*j)->GetModifier()->m_miscvalue == int32(id)) + (*j)->ApplyModifier(true); // Learn all spells for skill learnSkillRewardedSpells(id, currVal); @@ -5685,11 +5685,11 @@ void Player::RewardReputation(Unit *pVictim, float rate) donerep1 = int32(donerep1*rate); FactionEntry const *factionEntry1 = sFactionStore.LookupEntry(Rep->repfaction1); uint32 current_reputation_rank1 = GetReputationMgr().GetRank(factionEntry1); - if(factionEntry1 && current_reputation_rank1 <= Rep->reputation_max_cap1) + if (factionEntry1 && current_reputation_rank1 <= Rep->reputation_max_cap1) GetReputationMgr().ModifyReputation(factionEntry1, donerep1); // Wiki: Team factions value divided by 2 - if(Rep->is_teamaward1) + if (factionEntry1 && Rep->is_teamaward1) { FactionEntry const *team1_factionEntry = sFactionStore.LookupEntry(factionEntry1->team); if(team1_factionEntry) @@ -5703,11 +5703,11 @@ void Player::RewardReputation(Unit *pVictim, float rate) donerep2 = int32(donerep2*rate); FactionEntry const *factionEntry2 = sFactionStore.LookupEntry(Rep->repfaction2); uint32 current_reputation_rank2 = GetReputationMgr().GetRank(factionEntry2); - if(factionEntry2 && current_reputation_rank2 <= Rep->reputation_max_cap2) + if (factionEntry2 && current_reputation_rank2 <= Rep->reputation_max_cap2) GetReputationMgr().ModifyReputation(factionEntry2, donerep2); // Wiki: Team factions value divided by 2 - if(Rep->is_teamaward2) + if (factionEntry2 && Rep->is_teamaward2) { FactionEntry const *team2_factionEntry = sFactionStore.LookupEntry(factionEntry2->team); if(team2_factionEntry) @@ -9556,8 +9556,8 @@ uint8 Player::CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bo return EQUIP_ERR_NO_EQUIPMENT_SLOT_AVAILABLE; // if swap ignore item (equipped also) - if(uint8 res = CanEquipUniqueItem(pItem, swap ? eslot : NULL_SLOT)) - return res; + if(uint8 res2 = CanEquipUniqueItem(pItem, swap ? eslot : NULL_SLOT)) + return res2; // check unique-equipped special item classes if (pProto->Class == ITEM_CLASS_QUIVER) @@ -10148,97 +10148,96 @@ Item* Player::EquipNewItem( uint16 pos, uint32 item, bool update ) Item* Player::EquipItem( uint16 pos, Item *pItem, bool update ) { - if( pItem ) + + AddEnchantmentDurations(pItem); + AddItemDurations(pItem); + + uint8 bag = pos >> 8; + uint8 slot = pos & 255; + + Item *pItem2 = GetItemByPos( bag, slot ); + + if( !pItem2 ) { - AddEnchantmentDurations(pItem); - AddItemDurations(pItem); + VisualizeItem( slot, pItem); - uint8 bag = pos >> 8; - uint8 slot = pos & 255; - - Item *pItem2 = GetItemByPos( bag, slot ); - - if( !pItem2 ) + if(isAlive()) { - VisualizeItem( slot, pItem); + ItemPrototype const *pProto = pItem->GetProto(); - if(isAlive()) + // item set bonuses applied only at equip and removed at unequip, and still active for broken items + if(pProto && pProto->ItemSet) + AddItemsSetItem(this,pItem); + + _ApplyItemMods(pItem, slot, true); + + if(pProto && isInCombat()&& pProto->Class == ITEM_CLASS_WEAPON && m_weaponChangeTimer == 0) { - ItemPrototype const *pProto = pItem->GetProto(); + uint32 cooldownSpell = SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_5s; - // item set bonuses applied only at equip and removed at unequip, and still active for broken items - if(pProto && pProto->ItemSet) - AddItemsSetItem(this,pItem); + if (getClass() == CLASS_ROGUE) + cooldownSpell = SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_0s; - _ApplyItemMods(pItem, slot, true); + SpellEntry const* spellProto = sSpellStore.LookupEntry(cooldownSpell); - if(pProto && isInCombat()&& pProto->Class == ITEM_CLASS_WEAPON && m_weaponChangeTimer == 0) + if (!spellProto) + sLog.outError("Weapon switch cooldown spell %u couldn't be found in Spell.dbc", cooldownSpell); + else { - uint32 cooldownSpell = SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_5s; + m_weaponChangeTimer = spellProto->StartRecoveryTime; - if (getClass() == CLASS_ROGUE) - cooldownSpell = SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_0s; - - SpellEntry const* spellProto = sSpellStore.LookupEntry(cooldownSpell); - - if (!spellProto) - sLog.outError("Weapon switch cooldown spell %u couldn't be found in Spell.dbc", cooldownSpell); - else - { - m_weaponChangeTimer = spellProto->StartRecoveryTime; - - WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+4); - data << uint64(GetGUID()); - data << uint8(1); - data << uint32(cooldownSpell); - data << uint32(0); - GetSession()->SendPacket(&data); - } + WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+4); + data << uint64(GetGUID()); + data << uint8(1); + data << uint32(cooldownSpell); + data << uint32(0); + GetSession()->SendPacket(&data); } } - - if( IsInWorld() && update ) - { - pItem->AddToWorld(); - pItem->SendUpdateToPlayer( this ); - } - - ApplyEquipCooldown(pItem); - - if( slot == EQUIPMENT_SLOT_MAINHAND ) - UpdateExpertise(BASE_ATTACK); - else if( slot == EQUIPMENT_SLOT_OFFHAND ) - UpdateExpertise(OFF_ATTACK); } - else + + if( IsInWorld() && update ) { - pItem2->SetCount( pItem2->GetCount() + pItem->GetCount() ); - if( IsInWorld() && update ) - pItem2->SendUpdateToPlayer( this ); - - // delete item (it not in any slot currently) - //pItem->DeleteFromDB(); - if( IsInWorld() && update ) - { - pItem->RemoveFromWorld(); - pItem->DestroyForPlayer( this ); - } - - RemoveEnchantmentDurations(pItem); - RemoveItemDurations(pItem); - - pItem->SetOwnerGUID(GetGUID()); // prevent error at next SetState in case trade/mail/buy from vendor - pItem->SetState(ITEM_REMOVED, this); - pItem2->SetState(ITEM_CHANGED, this); - - ApplyEquipCooldown(pItem2); - - return pItem2; + pItem->AddToWorld(); + pItem->SendUpdateToPlayer( this ); } + + ApplyEquipCooldown(pItem); + + if( slot == EQUIPMENT_SLOT_MAINHAND ) + UpdateExpertise(BASE_ATTACK); + else if( slot == EQUIPMENT_SLOT_OFFHAND ) + UpdateExpertise(OFF_ATTACK); + } + else + { + pItem2->SetCount( pItem2->GetCount() + pItem->GetCount() ); + if( IsInWorld() && update ) + pItem2->SendUpdateToPlayer( this ); + + // delete item (it not in any slot currently) + //pItem->DeleteFromDB(); + if( IsInWorld() && update ) + { + pItem->RemoveFromWorld(); + pItem->DestroyForPlayer( this ); + } + + RemoveEnchantmentDurations(pItem); + RemoveItemDurations(pItem); + + pItem->SetOwnerGUID(GetGUID()); // prevent error at next SetState in case trade/mail/buy from vendor + pItem->SetState(ITEM_REMOVED, this); + pItem2->SetState(ITEM_CHANGED, this); + + ApplyEquipCooldown(pItem2); + + return pItem2; } // only for full equip instead adding to stack GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, pItem->GetEntry()); + return pItem; } @@ -11006,7 +11005,7 @@ void Player::SwapItem( uint16 src, uint16 dst ) // check src->dest move possibility ItemPosCountVec sDest; - uint16 eDest; + uint16 eDest = 0; if( IsInventoryPos( dst ) ) msg = CanStoreItem( dstbag, dstslot, sDest, pSrcItem, true ); else if( IsBankPos( dst ) ) @@ -11026,7 +11025,7 @@ void Player::SwapItem( uint16 src, uint16 dst ) // check dest->src move possibility ItemPosCountVec sDest2; - uint16 eDest2; + uint16 eDest2 = 0; if( IsInventoryPos( src ) ) msg = CanStoreItem( srcbag, srcslot, sDest2, pDstItem, true ); else if( IsBankPos( src ) ) @@ -12054,14 +12053,14 @@ bool Player::CanAddQuest( Quest const *pQuest, bool msg ) { uint32 count = pQuest->GetSrcItemCount(); ItemPosCountVec dest; - uint8 msg = CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, srcitem, count ); + uint8 msg2 = CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, srcitem, count ); // player already have max number (in most case 1) source item, no additional item needed and quest can be added. - if( msg == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS ) + if( msg2 == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS ) return true; - else if( msg != EQUIP_ERR_OK ) + else if( msg2 != EQUIP_ERR_OK ) { - SendEquipError( msg, NULL, NULL ); + SendEquipError( msg2, NULL, NULL ); return false; } } @@ -12662,14 +12661,14 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) // each-from-all exclusive group ( < 0) // can be start if only all quests in prev quest exclusive group completed and rewarded - ObjectMgr::ExclusiveQuestGroups::iterator iter = objmgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup()); + ObjectMgr::ExclusiveQuestGroups::iterator iter2 = objmgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup()); ObjectMgr::ExclusiveQuestGroups::iterator end = objmgr.mExclusiveQuestGroups.upper_bound(qPrevInfo->GetExclusiveGroup()); - assert(iter!=end); // always must be found if qPrevInfo->ExclusiveGroup != 0 + assert(iter2!=end); // always must be found if qPrevInfo->ExclusiveGroup != 0 - for(; iter != end; ++iter) + for(; iter2 != end; ++iter2) { - uint32 exclude_Id = iter->second; + uint32 exclude_Id = iter2->second; // skip checked quest id, only state of other quests in group is interesting if(exclude_Id == prevId) @@ -12697,14 +12696,14 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) // each-from-all exclusive group ( < 0) // can be start if only all quests in prev quest exclusive group active - ObjectMgr::ExclusiveQuestGroups::iterator iter = objmgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup()); + ObjectMgr::ExclusiveQuestGroups::iterator iter2 = objmgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup()); ObjectMgr::ExclusiveQuestGroups::iterator end = objmgr.mExclusiveQuestGroups.upper_bound(qPrevInfo->GetExclusiveGroup()); - assert(iter!=end); // always must be found if qPrevInfo->ExclusiveGroup != 0 + assert(iter2!=end); // always must be found if qPrevInfo->ExclusiveGroup != 0 - for(; iter != end; ++iter) + for(; iter2 != end; ++iter2) { - uint32 exclude_Id = iter->second; + uint32 exclude_Id = iter2->second; // skip checked quest id, only state of other quests in group is interesting if(exclude_Id == prevId) @@ -17782,8 +17781,8 @@ void Player::AddComboPoints(Unit* target, int8 count) else { if(m_comboTarget) - if(Unit* target = ObjectAccessor::GetUnit(*this,m_comboTarget)) - target->RemoveComboPointHolder(GetGUIDLow()); + if(Unit* target2 = ObjectAccessor::GetUnit(*this,m_comboTarget)) + target2->RemoveComboPointHolder(GetGUIDLow()); m_comboTarget = target->GetGUID(); m_comboPoints = count; @@ -17909,10 +17908,10 @@ void Player::SendInitialPacketsAfterAddToMap() // manual send package (have code in ApplyModifier(true,true); that don't must be re-applied. if(HasAuraType(SPELL_AURA_MOD_ROOT)) { - WorldPacket data(SMSG_FORCE_MOVE_ROOT, 10); - data.append(GetPackGUID()); - data << (uint32)2; - SendMessageToSet(&data,true); + WorldPacket data2(SMSG_FORCE_MOVE_ROOT, 10); + data2.append(GetPackGUID()); + data2 << (uint32)2; + SendMessageToSet(&data2,true); } SendAurasForTarget(this); diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 939dbcbcb..836547b88 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -2180,11 +2180,12 @@ void Aura::HandleAuraDummy(bool apply, bool Real) if( GetId()==24658 ) { uint32 spellId = 24659; - if (apply) + if (apply && caster) { const SpellEntry *spell = sSpellStore.LookupEntry(spellId); if (!spell) return; + for (int i=0; i < spell->StackAmount; ++i) caster->CastSpell(m_target, spell->Id, true, NULL, NULL, GetCasterGUID()); return; @@ -2196,7 +2197,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) if( GetId()==24661 ) { uint32 spellId = 24662; - if (apply) + if (apply && caster) { const SpellEntry *spell = sSpellStore.LookupEntry(spellId); if (!spell) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index f68cb4b1a..7fc3a8517 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -885,7 +885,7 @@ void Spell::EffectDummy(uint32 i) // return; -- implemented at client side case 28006: // Arcane Cloaking { - if( unitTarget->GetTypeId() == TYPEID_PLAYER ) + if (unitTarget && unitTarget->GetTypeId() == TYPEID_PLAYER ) m_caster->CastSpell(unitTarget,29294,true); return; } @@ -1289,7 +1289,7 @@ void Spell::EffectDummy(uint32 i) } // Think its not need (also need remove Life Tap from SpellDamageBonus or add new value) // damage = m_caster->SpellDamageBonus(m_caster, m_spellInfo,uint32(damage > 0 ? damage : 0), SPELL_DIRECT_DAMAGE); - if(int32(unitTarget->GetHealth()) > damage) + if(unitTarget && (int32(unitTarget->GetHealth()) > damage)) { // Shouldn't Appear in Combat Log unitTarget->ModifyHealth(-damage); @@ -1678,9 +1678,9 @@ void Spell::EffectDummy(uint32 i) if(m_caster->GetTypeId() != TYPEID_PLAYER) return; - for(int i = BASE_ATTACK; i <= OFF_ATTACK; ++i) + for(int j = BASE_ATTACK; j <= OFF_ATTACK; ++j) { - if(Item* item = ((Player*)m_caster)->GetWeaponForAttack(WeaponAttackType(i))) + if(Item* item = ((Player*)m_caster)->GetWeaponForAttack(WeaponAttackType(j))) { if(item->IsFitToSpellRequirements(m_spellInfo)) { @@ -1909,7 +1909,7 @@ void Spell::EffectTriggerSpell(uint32 i) if (!spell) return; - for (int i=0; i < spell->StackAmount; ++i) + for (int j=0; j < spell->StackAmount; ++j) m_caster->CastSpell(unitTarget,spell->Id, true, m_CastItem, NULL, m_originalCasterGUID); return; } @@ -1920,7 +1920,7 @@ void Spell::EffectTriggerSpell(uint32 i) if (!spell) return; - for (int i=0; i < spell->StackAmount; ++i) + for (int j=0; j < spell->StackAmount; ++j) m_caster->CastSpell(unitTarget,spell->Id, true, m_CastItem, NULL, m_originalCasterGUID); return; } @@ -3041,10 +3041,10 @@ void Spell::EffectSummonChangeItem(uint32 i) if( !pNewItem ) return; - for(uint8 i= PERM_ENCHANTMENT_SLOT; i<=TEMP_ENCHANTMENT_SLOT; ++i) + for(uint8 j= PERM_ENCHANTMENT_SLOT; j<=TEMP_ENCHANTMENT_SLOT; ++j) { - if(m_CastItem->GetEnchantmentId(EnchantmentSlot(i))) - pNewItem->SetEnchantment(EnchantmentSlot(i), m_CastItem->GetEnchantmentId(EnchantmentSlot(i)), m_CastItem->GetEnchantmentDuration(EnchantmentSlot(i)), m_CastItem->GetEnchantmentCharges(EnchantmentSlot(i))); + if(m_CastItem->GetEnchantmentId(EnchantmentSlot(j))) + pNewItem->SetEnchantment(EnchantmentSlot(j), m_CastItem->GetEnchantmentId(EnchantmentSlot(j)), m_CastItem->GetEnchantmentDuration(EnchantmentSlot(j)), m_CastItem->GetEnchantmentCharges(EnchantmentSlot(j))); } if(m_CastItem->GetUInt32Value(ITEM_FIELD_DURABILITY) < m_CastItem->GetUInt32Value(ITEM_FIELD_MAXDURABILITY)) @@ -4248,11 +4248,14 @@ void Spell::EffectLearnPetSpell(uint32 i) void Spell::EffectTaunt(uint32 /*i*/) { + if (!unitTarget) + return; + // this effect use before aura Taunt apply for prevent taunt already attacking target // for spell as marked "non effective at already attacking target" - if(unitTarget && unitTarget->GetTypeId() != TYPEID_PLAYER) + if (unitTarget->GetTypeId() != TYPEID_PLAYER) { - if(unitTarget->getVictim()==m_caster) + if (unitTarget->getVictim()==m_caster) { SendCastResult(SPELL_FAILED_DONT_REPORT); return; @@ -4260,7 +4263,7 @@ void Spell::EffectTaunt(uint32 /*i*/) } // Also use this effect to set the taunter's threat to the taunted creature's highest value - if(unitTarget->CanHaveThreatList() && unitTarget->getThreatManager().getCurrentVictim()) + if (unitTarget->CanHaveThreatList() && unitTarget->getThreatManager().getCurrentVictim()) unitTarget->getThreatManager().addThreat(m_caster,unitTarget->getThreatManager().getCurrentVictim()->getThreat()); } @@ -4374,12 +4377,12 @@ void Spell::EffectWeaponDmg(uint32 i) if(m_spellInfo->SpellFamilyFlags & 0x001000000000LL) { Unit::AuraList const& m_OverrideClassScript = m_caster->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); - for(Unit::AuraList::const_iterator i = m_OverrideClassScript.begin(); i != m_OverrideClassScript.end(); ++i) + for(Unit::AuraList::const_iterator citr = m_OverrideClassScript.begin(); citr != m_OverrideClassScript.end(); ++citr) { // Stormstrike AP Buff - if ( (*i)->GetModifier()->m_miscvalue == 5634 ) + if ( (*citr)->GetModifier()->m_miscvalue == 5634 ) { - m_caster->CastSpell(m_caster,38430,true,NULL,*i); + m_caster->CastSpell(m_caster,38430,true,NULL,*citr); break; } } @@ -4829,7 +4832,7 @@ void Spell::EffectScriptEffect(uint32 effIndex) if(!unitTarget) return; - uint32 spellId; + uint32 spellId = 0; switch(rand()%4) { case 0: spellId = 46740; break; @@ -6256,7 +6259,7 @@ void Spell::EffectTransmitted(uint32 effIndex) // end time of range when possible catch fish (FISHING_BOBBER_READY_TIME..GetDuration(m_spellInfo)) // start time == fish-FISHING_BOBBER_READY_TIME (0..GetDuration(m_spellInfo)-FISHING_BOBBER_READY_TIME) - int32 lastSec; + int32 lastSec = 0; switch(urand(0, 3)) { case 0: lastSec = 3; break; diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index ae0820ca3..8061dbee3 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -470,9 +470,9 @@ class PetAura return itr->second; else { - std::map::const_iterator itr = auras.find(0); - if(itr != auras.end()) - return itr->second; + std::map::const_iterator itr2 = auras.find(0); + if(itr2 != auras.end()) + return itr2->second; else return 0; } @@ -649,9 +649,9 @@ class SpellMgr // Not found, try lookup for 1 spell rank if exist if (uint32 rank_1 = GetFirstSpellInChain(spellId)) { - SpellBonusMap::const_iterator itr = mSpellBonusMap.find(rank_1); - if( itr != mSpellBonusMap.end( ) ) - return &itr->second; + SpellBonusMap::const_iterator itr2 = mSpellBonusMap.find(rank_1); + if( itr2 != mSpellBonusMap.end( ) ) + return &itr2->second; } return NULL; } diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 62a3f875c..f8469a39f 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -2103,12 +2103,12 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack if(pVictim->GetTypeId()==TYPEID_PLAYER || !(((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_PARRY) ) { - int32 tmp = int32(parry_chance); - if ( (tmp > 0) // check if unit _can_ parry - && ((tmp -= skillBonus) > 0) - && (roll < (sum += tmp))) + int32 tmp2 = int32(parry_chance); + if ( (tmp2 > 0) // check if unit _can_ parry + && ((tmp2 -= skillBonus) > 0) + && (roll < (sum += tmp2))) { - DEBUG_LOG ("RollMeleeOutcomeAgainst: PARRY <%d, %d)", sum-tmp, sum); + DEBUG_LOG ("RollMeleeOutcomeAgainst: PARRY <%d, %d)", sum-tmp2, sum); return MELEE_HIT_PARRY; } } @@ -2989,7 +2989,7 @@ void Unit::SetCurrentCastedSpell( Spell * pSpell ) { assert(pSpell); // NULL may be never passed here, use InterruptSpell or InterruptNonMeleeSpells - uint32 CSpellType = pSpell->GetCurrentContainer(); + CurrentSpellTypes CSpellType = pSpell->GetCurrentContainer(); if (pSpell == m_currentSpells[CSpellType]) return; // avoid breaking self diff --git a/src/game/debugcmds.cpp b/src/game/debugcmds.cpp index fa20d2439..a6ac22fdf 100644 --- a/src/game/debugcmds.cpp +++ b/src/game/debugcmds.cpp @@ -395,9 +395,9 @@ bool ChatHandler::HandleDebugGetItemState(const char* args) Bag *bag = (Bag*)item; for (uint8 j = 0; j < bag->GetBagSize(); ++j) { - Item* item = bag->GetItemByPos(j); - if (item && item->GetState() == state) - PSendSysMessage("bag: 255 slot: %d guid: %d owner: %d", item->GetSlot(), item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID())); + Item* item2 = bag->GetItemByPos(j); + if (item2 && item2->GetState() == state) + PSendSysMessage("bag: 255 slot: %d guid: %d owner: %d", item2->GetSlot(), item2->GetGUIDLow(), GUID_LOPART(item2->GetOwnerGUID())); } } } @@ -491,58 +491,58 @@ bool ChatHandler::HandleDebugGetItemState(const char* args) Bag *bag = (Bag*)item; for (uint8 j = 0; j < bag->GetBagSize(); ++j) { - Item* item = bag->GetItemByPos(j); - if (!item) continue; + Item* item2 = bag->GetItemByPos(j); + if (!item2) continue; - if (item->GetSlot() != j) + if (item2->GetSlot() != j) { - PSendSysMessage("the item in bag %d slot %d, guid %d has an incorrect slot value: %d", bag->GetSlot(), j, item->GetGUIDLow(), item->GetSlot()); + PSendSysMessage("the item in bag %d slot %d, guid %d has an incorrect slot value: %d", bag->GetSlot(), j, item2->GetGUIDLow(), item2->GetSlot()); error = true; continue; } - if (item->GetOwnerGUID() != player->GetGUID()) + if (item2->GetOwnerGUID() != player->GetGUID()) { - PSendSysMessage("for the item in bag %d at slot %d and itemguid %d, owner's guid (%d) and player's guid (%d) don't match!", bag->GetSlot(), item->GetSlot(), item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID()), player->GetGUIDLow()); + PSendSysMessage("for the item in bag %d at slot %d and itemguid %d, owner's guid (%d) and player's guid (%d) don't match!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), GUID_LOPART(item2->GetOwnerGUID()), player->GetGUIDLow()); error = true; continue; } - Bag *container = item->GetContainer(); + Bag *container = item2->GetContainer(); if (!container) { - PSendSysMessage("the item in bag %d at slot %d with guid %d has no container!", bag->GetSlot(), item->GetSlot(), item->GetGUIDLow()); + PSendSysMessage("the item in bag %d at slot %d with guid %d has no container!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow()); error = true; continue; } if (container != bag) { - PSendSysMessage("the item in bag %d at slot %d with guid %d has a different container(slot %d guid %d)!", bag->GetSlot(), item->GetSlot(), item->GetGUIDLow(), container->GetSlot(), container->GetGUIDLow()); + PSendSysMessage("the item in bag %d at slot %d with guid %d has a different container(slot %d guid %d)!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), container->GetSlot(), container->GetGUIDLow()); error = true; continue; } - if (item->IsInUpdateQueue()) + if (item2->IsInUpdateQueue()) { - uint16 qp = item->GetQueuePos(); + uint16 qp = item2->GetQueuePos(); if (qp > updateQueue.size()) { - PSendSysMessage("item in bag: %d at slot: %d guid: %d has a queuepos (%d) larger than the update queue size! ", bag->GetSlot(), item->GetSlot(), item->GetGUIDLow(), qp); + PSendSysMessage("item in bag: %d at slot: %d guid: %d has a queuepos (%d) larger than the update queue size! ", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), qp); error = true; continue; } if (updateQueue[qp] == NULL) { - PSendSysMessage("item in bag: %d at slot: %d guid: %d has a queuepos (%d) that points to NULL in the queue!", bag->GetSlot(), item->GetSlot(), item->GetGUIDLow(), qp); + PSendSysMessage("item in bag: %d at slot: %d guid: %d has a queuepos (%d) that points to NULL in the queue!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), qp); error = true; continue; } - if (updateQueue[qp] != item) + if (updateQueue[qp] != item2) { - PSendSysMessage("item in bag: %d at slot: %d guid: %d has has a queuepos (%d) that points to another item in the queue (bag: %d, slot: %d, guid: %d)", bag->GetSlot(), item->GetSlot(), item->GetGUIDLow(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUIDLow()); + PSendSysMessage("item in bag: %d at slot: %d guid: %d has has a queuepos (%d) that points to another item in the queue (bag: %d, slot: %d, guid: %d)", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUIDLow()); error = true; continue; } } - else if (item->GetState() != ITEM_UNCHANGED) + else if (item2->GetState() != ITEM_UNCHANGED) { - PSendSysMessage("item in bag: %d at slot: %d guid: %d is not in queue but should be (state: %d)!", bag->GetSlot(), item->GetSlot(), item->GetGUIDLow(), item->GetState()); + PSendSysMessage("item in bag: %d at slot: %d guid: %d is not in queue but should be (state: %d)!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), item2->GetState()); error = true; continue; } } diff --git a/src/shared/ServiceWin32.cpp b/src/shared/ServiceWin32.cpp index 0b5e446a4..82b51652b 100644 --- a/src/shared/ServiceWin32.cpp +++ b/src/shared/ServiceWin32.cpp @@ -129,10 +129,10 @@ bool WinServiceUninstall() serviceName, SERVICE_QUERY_STATUS | DELETE); if (service) { - SERVICE_STATUS serviceStatus; - if (QueryServiceStatus(service, &serviceStatus)) + SERVICE_STATUS serviceStatus2; + if (QueryServiceStatus(service, &serviceStatus2)) { - if (serviceStatus.dwCurrentState == SERVICE_STOPPED) + if (serviceStatus2.dwCurrentState == SERVICE_STOPPED) DeleteService(service); } CloseServiceHandle(service); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 3be8dae7c..ecd5f8f96 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 "7715" + #define REVISION_NR "7716" #endif // __REVISION_NR_H__ From 9dd305b457a9cfcf7ed162838e8bf903e917736e Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 26 Apr 2009 18:53:53 +0400 Subject: [PATCH 04/15] [7717] Use more safe code in EventAI. --- src/game/CreatureEventAI.cpp | 8 ++++---- src/game/CreatureEventAIMgr.h | 6 +++--- src/shared/revision_nr.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index bf8986643..beb473da5 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -39,10 +39,10 @@ int CreatureEventAI::Permissible(const Creature *creature) CreatureEventAI::CreatureEventAI(Creature *c ) : CreatureAI(c) { - CreatureEventAI_Event_Map::iterator CreatureEvents = CreatureEAI_Mgr.GetCreatureEventAIMap().find(m_creature->GetEntry()); + CreatureEventAI_Event_Map::const_iterator CreatureEvents = CreatureEAI_Mgr.GetCreatureEventAIMap().find(m_creature->GetEntry()); if (CreatureEvents != CreatureEAI_Mgr.GetCreatureEventAIMap().end()) { - std::vector::iterator i; + std::vector::const_iterator i; for (i = (*CreatureEvents).second.begin(); i != (*CreatureEvents).second.end(); ++i) { @@ -678,9 +678,9 @@ void CreatureEventAI::ProcessAction(uint16 type, uint32 param1, uint32 param2, u Creature* pCreature = NULL; if (param3) - pCreature = m_creature->SummonCreature(param1, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, param3); + pCreature = m_creature->SummonCreature(param1, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, param3); else - pCreature = m_creature->SummonCreature(param1, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); + pCreature = m_creature->SummonCreature(param1, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); if (!pCreature) { diff --git a/src/game/CreatureEventAIMgr.h b/src/game/CreatureEventAIMgr.h index ea5989a74..b4672460c 100644 --- a/src/game/CreatureEventAIMgr.h +++ b/src/game/CreatureEventAIMgr.h @@ -32,9 +32,9 @@ class CreatureEventAIMgr void LoadCreatureEventAI_Summons(); void LoadCreatureEventAI_Scripts(); - CreatureEventAI_Event_Map& GetCreatureEventAIMap() { return m_CreatureEventAI_Event_Map; } - CreatureEventAI_Summon_Map& GetCreatureEventAISummonMap() { return m_CreatureEventAI_Summon_Map; } - CreatureEventAI_TextMap& GetCreatureEventAITextMap() { return m_CreatureEventAI_TextMap; } + CreatureEventAI_Event_Map const& GetCreatureEventAIMap() const { return m_CreatureEventAI_Event_Map; } + CreatureEventAI_Summon_Map const& GetCreatureEventAISummonMap() const { return m_CreatureEventAI_Summon_Map; } + CreatureEventAI_TextMap const& GetCreatureEventAITextMap() const { return m_CreatureEventAI_TextMap; } private: CreatureEventAI_Event_Map m_CreatureEventAI_Event_Map; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index ecd5f8f96..f318175b8 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 "7716" + #define REVISION_NR "7717" #endif // __REVISION_NR_H__ From d74cdadc544cc2b8e6a5e1dc24df7a79db2f145f Mon Sep 17 00:00:00 2001 From: AlexDereka Date: Sun, 26 Apr 2009 20:14:05 +0400 Subject: [PATCH 05/15] [7718] Fix my typo in [7716] commit. --- src/game/Player.cpp | 6 +++--- src/shared/revision_nr.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 3dc6df4d6..76fe5a66d 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -2823,9 +2823,9 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen } // mark old spell as disable (SMSG_SUPERCEDED_SPELL replace it in client by new) - itr->second->active = false; - if(itr->second->state != PLAYERSPELL_NEW) - itr->second->state = PLAYERSPELL_CHANGED; + itr2->second->active = false; + if(itr2->second->state != PLAYERSPELL_NEW) + itr2->second->state = PLAYERSPELL_CHANGED; superceded_old = true; // new spell replace old in action bars and spell book. } else if(spellmgr.IsHighRankOfSpell(itr2->first,spell_id)) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index f318175b8..ce794355b 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 "7717" + #define REVISION_NR "7718" #endif // __REVISION_NR_H__ From b62c142425f2766ca1bd36c45cc5e739919417fd Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 26 Apr 2009 20:03:36 +0400 Subject: [PATCH 06/15] [7719] Use all existed 4 world map overlay area ids instead 3, replace values by constant for avoid problem repeat. --- src/game/AchievementMgr.cpp | 10 +++++++--- src/game/DBCStores.cpp | 4 ++-- src/game/DBCStores.h | 2 +- src/game/DBCStructure.h | 18 ++++++++++++------ src/game/DBCfmt.h | 2 +- src/shared/revision_nr.h | 2 +- 6 files changed, 24 insertions(+), 14 deletions(-) diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp index f3a352c6c..799542ac6 100644 --- a/src/game/AchievementMgr.cpp +++ b/src/game/AchievementMgr.cpp @@ -890,12 +890,16 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui break; bool matchFound = false; - for (int j = 0; j < 3; ++j) + for (int j = 0; j < MAX_WORLD_MAP_OVERLAY_AREA_IDX; ++j) { - int32 exploreFlag = GetAreaFlagByAreaID(worldOverlayEntry->areatableID[j]); - if(exploreFlag < 0) + uint32 area_id = worldOverlayEntry->areatableID[j]; + if(!area_id) // array have 0 only in empty tail break; + int32 exploreFlag = GetAreaFlagByAreaID(area_id); + if(exploreFlag < 0) + continue; + uint32 playerIndexOffset = uint32(exploreFlag) / 32; uint32 mask = 1<< (uint32(exploreFlag) % 32); diff --git a/src/game/DBCStores.cpp b/src/game/DBCStores.cpp index faad447d3..339ae386a 100644 --- a/src/game/DBCStores.cpp +++ b/src/game/DBCStores.cpp @@ -149,8 +149,8 @@ DBCStorage sTotemCategoryStore(TotemCategoryEntryfmt); DBCStorage sVehicleStore(VehicleEntryfmt); DBCStorage sVehicleSeatStore(VehicleSeatEntryfmt); DBCStorage sWorldMapAreaStore(WorldMapAreaEntryfmt); -DBCStorage sWorldSafeLocsStore(WorldSafeLocsEntryfmt); DBCStorage sWorldMapOverlayStore(WorldMapOverlayEntryfmt); +DBCStorage sWorldSafeLocsStore(WorldSafeLocsEntryfmt); typedef std::list StoreProblemList; @@ -508,8 +508,8 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales,bar,bad_dbc_files,sVehicleStore, dbcPath,"Vehicle.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sVehicleSeatStore, dbcPath,"VehicleSeat.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sWorldMapAreaStore, dbcPath,"WorldMapArea.dbc"); - LoadDBC(availableDbcLocales,bar,bad_dbc_files,sWorldSafeLocsStore, dbcPath,"WorldSafeLocs.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sWorldMapOverlayStore, dbcPath,"WorldMapOverlay.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sWorldSafeLocsStore, dbcPath,"WorldSafeLocs.dbc"); // error checks if(bad_dbc_files.size() >= DBCFilesCount ) diff --git a/src/game/DBCStores.h b/src/game/DBCStores.h index fc91325d0..222227dcb 100644 --- a/src/game/DBCStores.h +++ b/src/game/DBCStores.h @@ -144,8 +144,8 @@ extern DBCStorage sTotemCategoryStore; extern DBCStorage sVehicleStore; extern DBCStorage sVehicleSeatStore; //extern DBCStorage sWorldMapAreaStore; -- use Zone2MapCoordinates and Map2ZoneCoordinates -extern DBCStorage sWorldSafeLocsStore; extern DBCStorage sWorldMapOverlayStore; +extern DBCStorage sWorldSafeLocsStore; void LoadDBCStores(const std::string& dataPath); diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index 3cd5b79f6..942dadaa2 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -1641,6 +1641,18 @@ struct WorldMapAreaEntry // int32 dungeonMap_id; // 9 pointer to DungeonMap.dbc (owerride x1,x2,y1,y2 coordinates) }; +#define MAX_WORLD_MAP_OVERLAY_AREA_IDX 4 + +struct WorldMapOverlayEntry +{ + uint32 ID; // 0 + //uint32 worldMapAreaId; // 1 idx in WorldMapArea.dbc + uint32 areatableID[MAX_WORLD_MAP_OVERLAY_AREA_IDX]; // 2-5 + // 6-7 always 0, possible part of areatableID[] + //char* internal_name // 8 + // 9-16 some ints +}; + struct WorldSafeLocsEntry { uint32 ID; // 0 @@ -1652,12 +1664,6 @@ struct WorldSafeLocsEntry // 21 name flags, unused }; -struct WorldMapOverlayEntry -{ - uint32 ID; // 0 - uint32 areatableID[4]; // 2-5 -}; - // GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform #if defined( __GNUC__ ) #pragma pack() diff --git a/src/game/DBCfmt.h b/src/game/DBCfmt.h index 2bb619ae7..2e617488a 100644 --- a/src/game/DBCfmt.h +++ b/src/game/DBCfmt.h @@ -101,7 +101,7 @@ const char TotemCategoryEntryfmt[]="nxxxxxxxxxxxxxxxxxii"; const char VehicleEntryfmt[]="niffffiiiiiiiiffffiiiiiifffffffffffssssfifi"; const char VehicleSeatEntryfmt[]="niiffffffffffiiiiiifffffffiiifffiiiiiiiffiiiii"; const char WorldMapAreaEntryfmt[]="xinxffffix"; -const char WorldSafeLocsEntryfmt[]="nifffxxxxxxxxxxxxxxxxx"; const char WorldMapOverlayEntryfmt[]="nxiiiixxxxxxxxxxx"; +const char WorldSafeLocsEntryfmt[]="nifffxxxxxxxxxxxxxxxxx"; #endif \ No newline at end of file diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index ce794355b..4d7282a96 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 "7718" + #define REVISION_NR "7719" #endif // __REVISION_NR_H__ From b9853cb95894e4c67244c4e21f98b7b45decc1f6 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 26 Apr 2009 23:28:16 +0400 Subject: [PATCH 07/15] [7720] Fixed crash at .character level use from console. Include GM name in message for command target if report need. --- sql/mangos.sql | 8 ++++---- sql/updates/7720_01_mangos_mangos_string.sql | 7 +++++++ sql/updates/Makefile.am | 2 ++ src/game/Level3.cpp | 20 ++++++++++++-------- src/shared/revision_nr.h | 2 +- 5 files changed, 26 insertions(+), 13 deletions(-) create mode 100644 sql/updates/7720_01_mangos_mangos_string.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index e321ce018..822ae85e8 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_7714_01_mangos_command` bit(1) default NULL + `required_7720_01_mangos_mangos_string` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -2844,9 +2844,9 @@ INSERT INTO `mangos_string` VALUES (554,'%s has hidden all zones from you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (555,'Hover enabled',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (556,'Hover disabled',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), -(557,'You have been leveled up (%i)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), -(558,'You have been leveled down (%i)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), -(559,'Your level progress has been reset.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(557,'%s level up you to (%i)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(558,'%s level down you to (%i)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(559,'%s reset your level progress.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (560,'The area has been set as explored.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (561,'The area has been set as not explored.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (562,'GUID=%i \'s updateIndex: %i, value: %i.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), diff --git a/sql/updates/7720_01_mangos_mangos_string.sql b/sql/updates/7720_01_mangos_mangos_string.sql new file mode 100644 index 000000000..41435c0e8 --- /dev/null +++ b/sql/updates/7720_01_mangos_mangos_string.sql @@ -0,0 +1,7 @@ +ALTER TABLE db_version CHANGE COLUMN required_7714_01_mangos_command required_7720_01_mangos_mangos_string bit; + +DELETE FROM mangos_string WHERE entry IN(557,558,559); +INSERT INTO mangos_string VALUES +(557,'%s level up you to (%i)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(558,'%s level down you to (%i)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(559,'%s reset your level progress.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 2c349097c..302a634d1 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -176,6 +176,7 @@ pkgdata_DATA = \ 7705_01_mangos_command.sql \ 7706_01_mangos_command.sql \ 7714_01_mangos_command.sql \ + 7720_01_mangos_mangos_string.sql \ README ## Additional files to include when running 'make dist' @@ -332,4 +333,5 @@ EXTRA_DIST = \ 7705_01_mangos_command.sql \ 7706_01_mangos_command.sql \ 7714_01_mangos_command.sql \ + 7720_01_mangos_mangos_string.sql \ README diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 5c344813d..58d2d61bb 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -3904,12 +3904,15 @@ void ChatHandler::HandleCharacterLevel(Player* player, uint64 player_guid, uint3 player->InitTalentForLevel(); player->SetUInt32Value(PLAYER_XP,0); - if(oldlevel == newlevel) - ChatHandler(player).SendSysMessage(LANG_YOURS_LEVEL_PROGRESS_RESET); - else if(oldlevel < newlevel) - ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_UP,newlevel-oldlevel); - else // if(oldlevel > newlevel) - ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_DOWN,newlevel-oldlevel); + if(needReportToTarget(player)) + { + if(oldlevel == newlevel) + ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_PROGRESS_RESET,GetNameLink().c_str()); + else if(oldlevel < newlevel) + ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_UP,GetNameLink().c_str(),newlevel); + else // if(oldlevel > newlevel) + ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_DOWN,GetNameLink().c_str(),newlevel); + } } else { @@ -4002,7 +4005,7 @@ bool ChatHandler::HandleCharacterLevelCommand(const char* args) HandleCharacterLevel(chr,chr_guid,oldlevel,newlevel); - if(m_session->GetPlayer() != chr) // including player==NULL + if(m_session && m_session->GetPlayer() != chr) // including player==NULL { std::string nameLink = playerLink(name); PSendSysMessage(LANG_YOU_CHANGE_LVL,nameLink.c_str(),newlevel); @@ -4087,11 +4090,12 @@ bool ChatHandler::HandleLevelUpCommand(const char* args) HandleCharacterLevel(chr,chr_guid,oldlevel,newlevel); - if(m_session->GetPlayer() != chr) // including chr==NULL + if(m_session && m_session->GetPlayer() != chr) // including chr==NULL { std::string nameLink = playerLink(name); PSendSysMessage(LANG_YOU_CHANGE_LVL,nameLink.c_str(),newlevel); } + return true; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 4d7282a96..ea879a1a2 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 "7719" + #define REVISION_NR "7720" #endif // __REVISION_NR_H__ From 57002fa014b86578844b512b749a85eb8976e5ce Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 27 Apr 2009 00:30:45 +0400 Subject: [PATCH 08/15] [7721] Fixed possible source crash at rogue stealth lost in some special cases. --- src/game/SpellAuras.cpp | 4 ++-- src/shared/revision_nr.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 836547b88..5d83a255b 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -3535,7 +3535,7 @@ void Aura::HandleModStealth(bool apply, bool Real) else if ((*i)->GetId() == 58426 && GetSpellProto()->SpellFamilyFlags & 0x0000000000400000LL) { pTarget->RemoveAurasDueToSpell(58428); - pTarget->CastSpell(m_target, 58427, true); + pTarget->CastSpell(pTarget, 58427, true); } } } @@ -3573,7 +3573,7 @@ void Aura::HandleModStealth(bool apply, bool Real) pTarget->CastSpell(pTarget,31666,true); // Overkill else if ((*i)->GetId() == 58426 && GetSpellProto()->SpellFamilyFlags & 0x0000000000400000LL) - pTarget->CastSpell(m_target, 58428, true); + pTarget->CastSpell(pTarget, 58428, true); } } } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index ea879a1a2..bd97771b3 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 "7720" + #define REVISION_NR "7721" #endif // __REVISION_NR_H__ From f2f817883a1b24ca7e450ae03002d0d831009f5e Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 27 Apr 2009 03:30:51 +0400 Subject: [PATCH 09/15] [7722] Fixed cast allow check in EventAI. --- src/game/CreatureEventAI.cpp | 2 +- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index beb473da5..46a13d7e3 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -622,7 +622,7 @@ void CreatureEventAI::ProcessAction(uint16 type, uint32 param1, uint32 param2, u } //Allowed to cast only if not casting (unless we interrupt ourself) or if spell is triggered - bool canCast = !(caster->IsNonMeleeSpellCasted(false) && (param3 & (CAST_TRIGGERED | CAST_INTURRUPT_PREVIOUS))); + bool canCast = !caster->IsNonMeleeSpellCasted(false) || (param3 & (CAST_TRIGGERED | CAST_INTURRUPT_PREVIOUS)); // If cast flag CAST_AURA_NOT_PRESENT is active, check if target already has aura on them if(param3 & CAST_AURA_NOT_PRESENT) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index bd97771b3..7d9b6dd16 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 "7721" + #define REVISION_NR "7722" #endif // __REVISION_NR_H__ From 73db1cbe0125924e2564481ca7c912bbcbfab920 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 27 Apr 2009 03:36:31 +0400 Subject: [PATCH 10/15] [7723] New AI call EnterCombat called at enter creature to combat (and re-enter if leave by some reason). --- src/game/AggressorAI.cpp | 10 +++++----- src/game/CreatureAI.h | 3 +++ src/game/CreatureEventAI.cpp | 11 +++-------- src/game/CreatureEventAI.h | 2 +- src/game/GuardAI.cpp | 4 ++-- src/game/ReactorAI.cpp | 5 +++-- src/game/Spell.cpp | 2 +- src/game/Unit.cpp | 14 ++++++++++---- src/game/Unit.h | 2 +- src/shared/revision_nr.h | 2 +- 10 files changed, 30 insertions(+), 25 deletions(-) diff --git a/src/game/AggressorAI.cpp b/src/game/AggressorAI.cpp index 086f32864..50878ee59 100644 --- a/src/game/AggressorAI.cpp +++ b/src/game/AggressorAI.cpp @@ -60,8 +60,8 @@ AggressorAI::MoveInLineOfSight(Unit *u) } else if(sMapStore.LookupEntry(m_creature->GetMapId())->IsDungeon()) { - u->SetInCombatWith(m_creature); m_creature->AddThreat(u, 0.0f); + u->SetInCombatWith(m_creature); } } } @@ -152,13 +152,13 @@ AggressorAI::AttackStart(Unit *u) if(m_creature->Attack(u,true)) { - m_creature->SetInCombatWith(u); - u->SetInCombatWith(m_creature); - - m_creature->AddThreat(u, 0.0f); // DEBUG_LOG("Creature %s tagged a victim to kill [guid=%u]", m_creature->GetName(), u->GetGUIDLow()); i_victimGuid = u->GetGUID(); + m_creature->AddThreat(u, 0.0f); + m_creature->SetInCombatWith(u); + u->SetInCombatWith(m_creature); + m_creature->GetMotionMaster()->MoveChase(u); } } diff --git a/src/game/CreatureAI.h b/src/game/CreatureAI.h index af2fb5e21..e64214ff4 100644 --- a/src/game/CreatureAI.h +++ b/src/game/CreatureAI.h @@ -46,6 +46,9 @@ class MANGOS_DLL_SPEC CreatureAI // Called if IsVisible(Unit *who) is true at each *who move, reaction at visibility zone enter virtual void MoveInLineOfSight(Unit *) {} + // Called for reaction at enter to combat if not in combat yet (enemy can be NULL) + virtual void EnterCombat(Unit* /*enemy*/) {} + // Called for reaction at stopping attack at no attackers or targets virtual void EnterEvadeMode() {} diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index 46a13d7e3..e337351f7 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -1118,7 +1118,7 @@ void CreatureEventAI::JustSummoned(Creature* pUnit) } } -void CreatureEventAI::Aggro(Unit *who) +void CreatureEventAI::EnterCombat(Unit *enemy) { //Check for on combat start events if (!bEmptyList) @@ -1129,7 +1129,7 @@ void CreatureEventAI::Aggro(Unit *who) { case EVENT_T_AGGRO: (*i).Enabled = true; - ProcessEvent(*i, who); + ProcessEvent(*i, enemy); break; //Reset all in combat timers case EVENT_T_TIMER: @@ -1164,17 +1164,12 @@ void CreatureEventAI::AttackStart(Unit *who) if (!who) return; - bool inCombat = m_creature->isInCombat(); - if (m_creature->Attack(who, MeleeEnabled)) { m_creature->AddThreat(who, 0.0f); m_creature->SetInCombatWith(who); who->SetInCombatWith(m_creature); - if (!inCombat) - Aggro(who); - if (CombatMovementEnabled) { m_creature->GetMotionMaster()->MoveChase(who, AttackDistance, AttackAngle); @@ -1233,8 +1228,8 @@ void CreatureEventAI::MoveInLineOfSight(Unit *who) } else if (m_creature->GetMap()->IsDungeon()) { - who->SetInCombatWith(m_creature); m_creature->AddThreat(who, 0.0f); + who->SetInCombatWith(m_creature); } } } diff --git a/src/game/CreatureEventAI.h b/src/game/CreatureEventAI.h index af1f4871b..56bccc947 100644 --- a/src/game/CreatureEventAI.h +++ b/src/game/CreatureEventAI.h @@ -257,11 +257,11 @@ class MANGOS_DLL_SPEC CreatureEventAI : public CreatureAI void JustRespawned(); void Reset(); void JustReachedHome(); + void EnterCombat(Unit *enemy); void EnterEvadeMode(); void JustDied(Unit* killer); void KilledUnit(Unit* victim); void JustSummoned(Creature* pUnit); - void Aggro(Unit *who); void AttackStart(Unit *who); void MoveInLineOfSight(Unit *who); void SpellHit(Unit* pUnit, const SpellEntry* pSpell); diff --git a/src/game/GuardAI.cpp b/src/game/GuardAI.cpp index aad95c2ff..8e0e5ba18 100644 --- a/src/game/GuardAI.cpp +++ b/src/game/GuardAI.cpp @@ -137,11 +137,11 @@ void GuardAI::AttackStart(Unit *u) // DEBUG_LOG("Creature %s tagged a victim to kill [guid=%u]", i_creature.GetName(), u->GetGUIDLow()); if(m_creature->Attack(u,true)) { + i_victimGuid = u->GetGUID(); + m_creature->AddThreat(u, 0.0f); m_creature->SetInCombatWith(u); u->SetInCombatWith(m_creature); - m_creature->AddThreat(u, 0.0f); - i_victimGuid = u->GetGUID(); m_creature->GetMotionMaster()->MoveChase(u); } } diff --git a/src/game/ReactorAI.cpp b/src/game/ReactorAI.cpp index 0fd68dfe3..a27c39f11 100644 --- a/src/game/ReactorAI.cpp +++ b/src/game/ReactorAI.cpp @@ -48,11 +48,12 @@ ReactorAI::AttackStart(Unit *p) if(m_creature->Attack(p,true)) { DEBUG_LOG("Tag unit GUID: %u (TypeId: %u) as a victim", p->GetGUIDLow(), p->GetTypeId()); + i_victimGuid = p->GetGUID(); + m_creature->AddThreat(p, 0.0f); + m_creature->SetInCombatWith(p); p->SetInCombatWith(m_creature); - m_creature->AddThreat(p, 0.0f); - i_victimGuid = p->GetGUID(); m_creature->GetMotionMaster()->MoveChase(p); } } diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 0ace79988..7d95ed83a 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1158,6 +1158,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) if(!unit->isInCombat() && unit->GetTypeId() != TYPEID_PLAYER && ((Creature*)unit)->AI()) ((Creature*)unit)->AI()->AttackedBy(m_caster); + unit->AddThreat(m_caster, 0.0f); unit->SetInCombatWith(m_caster); m_caster->SetInCombatWith(unit); @@ -1165,7 +1166,6 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) { m_caster->SetContestedPvP(attackedPlayer); } - unit->AddThreat(m_caster, 0.0f); } } else diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index f8469a39f..f5e5f8c90 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -8678,7 +8678,7 @@ void Unit::SetInCombatWith(Unit* enemy) Unit* eOwner = enemy->GetCharmerOrOwnerOrSelf(); if(eOwner->IsPvP()) { - SetInCombatState(true); + SetInCombatState(true,enemy); return; } @@ -8688,14 +8688,14 @@ void Unit::SetInCombatWith(Unit* enemy) Unit const* myOwner = GetCharmerOrOwnerOrSelf(); if(((Player const*)eOwner)->duel->opponent == myOwner) { - SetInCombatState(true); + SetInCombatState(true,enemy); return; } } - SetInCombatState(false); + SetInCombatState(false,enemy); } -void Unit::SetInCombatState(bool PvP) +void Unit::SetInCombatState(bool PvP, Unit* enemy) { // only alive units can be in combat if(!isAlive()) @@ -8703,10 +8703,16 @@ void Unit::SetInCombatState(bool PvP) if(PvP) m_CombatTimer = 5000; + + bool creatureNotInCombat = GetTypeId()==TYPEID_UNIT && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); + SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); if(isCharmed() || (GetTypeId()!=TYPEID_PLAYER && ((Creature*)this)->isPet())) SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT); + + if(creatureNotInCombat && ((Creature*)this)->AI()) + ((Creature*)this)->AI()->EnterCombat(enemy); } void Unit::ClearInCombat() diff --git a/src/game/Unit.h b/src/game/Unit.h index 8c5ccc78e..2b9b14352 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1018,7 +1018,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject bool isInFlight() const { return hasUnitState(UNIT_STAT_IN_FLIGHT); } bool isInCombat() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); } - void SetInCombatState(bool PvP); + void SetInCombatState(bool PvP, Unit* enemy = NULL); void SetInCombatWith(Unit* enemy); void ClearInCombat(); uint32 GetCombatTimer() const { return m_CombatTimer; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 7d9b6dd16..d6c51267c 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 "7722" + #define REVISION_NR "7723" #endif // __REVISION_NR_H__ From f8e0fc7dbc1e4573694cbd6620280da02de5850b Mon Sep 17 00:00:00 2001 From: Trazom Date: Mon, 27 Apr 2009 18:17:53 +0400 Subject: [PATCH 11/15] [7724] Fixed possible crash when a drunk player gets fall damage Signed-off-by: AlexDereka --- src/game/GameEventMgr.cpp | 2 +- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/GameEventMgr.cpp b/src/game/GameEventMgr.cpp index 2ad481e82..111f0bc85 100644 --- a/src/game/GameEventMgr.cpp +++ b/src/game/GameEventMgr.cpp @@ -751,7 +751,7 @@ MANGOS_DLL_SPEC bool IsHolidayActive( HolidayIds id ) GameEventMgr::ActiveEvents const& ae = gameeventmgr.GetActiveEventList(); for(GameEventMgr::ActiveEvents::const_iterator itr = ae.begin(); itr != ae.end(); ++itr) - if(events[id].holiday_id==id) + if(events[*itr].holiday_id==id) return true; return false; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index d6c51267c..7ec415fcb 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 "7723" + #define REVISION_NR "7724" #endif // __REVISION_NR_H__ From 14b49d1fd600379cada6ff3f07d4e7339bd64abd Mon Sep 17 00:00:00 2001 From: AlexDereka Date: Mon, 27 Apr 2009 20:53:55 +0400 Subject: [PATCH 12/15] [7725] Fixed memory leak in PlayerDumpWriter. --- src/game/PlayerDump.cpp | 2 ++ src/shared/revision_nr.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/game/PlayerDump.cpp b/src/game/PlayerDump.cpp index e43da414c..7b3cb8f78 100644 --- a/src/game/PlayerDump.cpp +++ b/src/game/PlayerDump.cpp @@ -356,6 +356,8 @@ std::string PlayerDumpWriter::GetDump(uint32 guid) } else sLog.outError("Table 'character_db_version' not have revision guard field, revision guard query not added to pdump."); + + delete result; } else sLog.outError("Character DB not have 'character_db_version' table, revision guard query not added to pdump."); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 7ec415fcb..48ed1e3b3 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 "7724" + #define REVISION_NR "7725" #endif // __REVISION_NR_H__ From 995988039bd88e2a73720f66cc2d3023847f5e02 Mon Sep 17 00:00:00 2001 From: AlexDereka Date: Mon, 27 Apr 2009 21:57:03 +0400 Subject: [PATCH 13/15] [7726] Fixed memory leak in InstanceSaveMgr. --- src/game/InstanceSaveMgr.cpp | 7 ++++++- src/shared/revision_nr.h | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp index 223620d86..f92d505fc 100644 --- a/src/game/InstanceSaveMgr.cpp +++ b/src/game/InstanceSaveMgr.cpp @@ -550,7 +550,12 @@ void InstanceSaveManager::_ResetSave(InstanceSaveHashMap::iterator &itr) Group *group = *(gList.begin()); group->UnbindInstance(itr->second->GetMapId(), itr->second->GetDifficulty(), true); } - m_instanceSaveById.erase(itr++); + InstanceSaveHashMap::iterator next; + next = itr; + ++next; + delete itr->second; + m_instanceSaveById.erase(itr); + itr = next; lock_instLists = false; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 48ed1e3b3..1fd04519f 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 "7725" + #define REVISION_NR "7726" #endif // __REVISION_NR_H__ From 9ab8c6edd323c5ff1097e7f941efc80a719258d2 Mon Sep 17 00:00:00 2001 From: AlexDereka Date: Tue, 28 Apr 2009 00:00:04 +0400 Subject: [PATCH 14/15] [7727] Use more simple code for element erase. --- src/game/InstanceSaveMgr.cpp | 6 +----- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp index f92d505fc..f6f8060b4 100644 --- a/src/game/InstanceSaveMgr.cpp +++ b/src/game/InstanceSaveMgr.cpp @@ -550,12 +550,8 @@ void InstanceSaveManager::_ResetSave(InstanceSaveHashMap::iterator &itr) Group *group = *(gList.begin()); group->UnbindInstance(itr->second->GetMapId(), itr->second->GetDifficulty(), true); } - InstanceSaveHashMap::iterator next; - next = itr; - ++next; delete itr->second; - m_instanceSaveById.erase(itr); - itr = next; + m_instanceSaveById.erase(itr++); lock_instLists = false; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 1fd04519f..e633ccd9f 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 "7726" + #define REVISION_NR "7727" #endif // __REVISION_NR_H__ From 5b9e46edea39a1a8dd0ea40ac8fae456f473ace4 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 27 Apr 2009 21:19:51 +0400 Subject: [PATCH 15/15] [7728] Use correct loot_type values in data sent to client instead long time existed hacks. Code cleanups. Thanks to Seizerkiller and TOM_RUS for help in reseach. --- src/game/Player.cpp | 109 +++++++++++++++------------------------ src/game/Player.h | 16 +++--- src/shared/revision_nr.h | 2 +- 3 files changed, 51 insertions(+), 76 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 76fe5a66d..c15c2004f 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -1134,7 +1134,7 @@ void Player::Update( uint32 p_time ) if (hasUnitState(UNIT_STAT_MELEE_ATTACKING)) { Unit *pVictim = getVictim(); - if( !IsNonMeleeSpellCasted(false) && pVictim) + if (pVictim && !IsNonMeleeSpellCasted(false)) { // default combat reach 10 // TODO add weapon,skill check @@ -7083,12 +7083,6 @@ void Player::RemovedInsignia(Player* looterPlr) looterPlr->SendLoot(bones->GetGUID(), LOOT_INSIGNIA); } -/*Loot type MUST be -1-corpse, go -2-skinning -3-Fishing -*/ - void Player::SendLootRelease( uint64 guid ) { WorldPacket data( SMSG_LOOT_RELEASE_RESPONSE, (8+1) ); @@ -7120,18 +7114,18 @@ void Player::SendLoot(uint64 guid, LootType loot_type) loot = &go->loot; - if(go->getLootState() == GO_READY) + if (go->getLootState() == GO_READY) { uint32 lootid = go->GetLootId(); - if(lootid) + if (lootid) { sLog.outDebug(" if(lootid)"); loot->clear(); loot->FillLoot(lootid, LootTemplates_Gameobject, this, false); } - if(loot_type == LOOT_FISHING) + if (loot_type == LOOT_FISHING) go->getFishLoot(loot,this); go->SetLootState(GO_ACTIVATED); @@ -7147,50 +7141,28 @@ void Player::SendLoot(uint64 guid, LootType loot_type) return; } - if(loot_type == LOOT_DISENCHANTING) + loot = &item->loot; + + if (!item->m_lootGenerated) { - loot = &item->loot; + item->m_lootGenerated = true; + loot->clear(); - if(!item->m_lootGenerated) + switch(loot_type) { - item->m_lootGenerated = true; - loot->clear(); - loot->FillLoot(item->GetProto()->DisenchantID, LootTemplates_Disenchant, this,true); - } - } - else if(loot_type == LOOT_PROSPECTING) - { - loot = &item->loot; - - if(!item->m_lootGenerated) - { - item->m_lootGenerated = true; - loot->clear(); - loot->FillLoot(item->GetEntry(), LootTemplates_Prospecting, this,true); - } - } - else if(loot_type == LOOT_MILLING) - { - loot = &item->loot; - - if(!item->m_lootGenerated) - { - item->m_lootGenerated = true; - loot->clear(); - loot->FillLoot(item->GetEntry(), LootTemplates_Milling, this,true); - } - } - else - { - loot = &item->loot; - - if(!item->m_lootGenerated) - { - item->m_lootGenerated = true; - loot->clear(); - loot->FillLoot(item->GetEntry(), LootTemplates_Item, this,true); - - loot->generateMoneyLoot(item->GetProto()->MinMoneyLoot,item->GetProto()->MaxMoneyLoot); + case LOOT_DISENCHANTING: + loot->FillLoot(item->GetProto()->DisenchantID, LootTemplates_Disenchant, this,true); + break; + case LOOT_PROSPECTING: + loot->FillLoot(item->GetEntry(), LootTemplates_Prospecting, this,true); + break; + case LOOT_MILLING: + loot->FillLoot(item->GetEntry(), LootTemplates_Milling, this,true); + break; + default: + loot->FillLoot(item->GetEntry(), LootTemplates_Item, this,true); + loot->generateMoneyLoot(item->GetProto()->MinMoneyLoot,item->GetProto()->MaxMoneyLoot); + break; } } } @@ -7230,7 +7202,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type) return; } - if(loot_type == LOOT_PICKPOCKETING && IsFriendlyTo(creature)) + if (loot_type == LOOT_PICKPOCKETING && IsFriendlyTo(creature)) { SendLootRelease(guid); return; @@ -7238,9 +7210,9 @@ void Player::SendLoot(uint64 guid, LootType loot_type) loot = &creature->loot; - if(loot_type == LOOT_PICKPOCKETING) + if (loot_type == LOOT_PICKPOCKETING) { - if ( !creature->lootForPickPocketed ) + if (!creature->lootForPickPocketed) { creature->lootForPickPocketed = true; loot->clear(); @@ -7270,7 +7242,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type) loot->clear(); } - if(!creature->lootForBody) + if (!creature->lootForBody) { creature->lootForBody = true; loot->clear(); @@ -7280,7 +7252,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type) loot->generateMoneyLoot(creature->GetCreatureInfo()->mingold,creature->GetCreatureInfo()->maxgold); - if(Group* group = recipient->GetGroup()) + if (Group* group = recipient->GetGroup()) { group->UpdateLooterGuid(creature,true); @@ -7313,13 +7285,13 @@ void Player::SendLoot(uint64 guid, LootType loot_type) { if(Group* group = GetGroup()) { - if( group == recipient->GetGroup() ) + if (group == recipient->GetGroup()) { - if(group->GetLootMethod() == FREE_FOR_ALL) + if (group->GetLootMethod() == FREE_FOR_ALL) permission = ALL_PERMISSION; - else if(group->GetLooterGuid() == GetGUID()) + else if (group->GetLooterGuid() == GetGUID()) { - if(group->GetLootMethod() == MASTER_LOOT) + if (group->GetLootMethod() == MASTER_LOOT) permission = MASTER_PERMISSION; else permission = ALL_PERMISSION; @@ -7330,7 +7302,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type) else permission = NONE_PERMISSION; } - else if(recipient == this) + else if (recipient == this) permission = ALL_PERMISSION; else permission = NONE_PERMISSION; @@ -7340,12 +7312,13 @@ void Player::SendLoot(uint64 guid, LootType loot_type) SetLootGUID(guid); - // LOOT_PICKPOCKETING, LOOT_PROSPECTING, LOOT_DISENCHANTING, LOOT_INSIGNIA and LOOT_MILLING unsupported by client, sending LOOT_SKINNING instead - if(loot_type == LOOT_PICKPOCKETING || loot_type == LOOT_DISENCHANTING || loot_type == LOOT_PROSPECTING || loot_type == LOOT_INSIGNIA || loot_type == LOOT_MILLING) - loot_type = LOOT_SKINNING; - - if(loot_type == LOOT_FISHINGHOLE) - loot_type = LOOT_FISHING; + // LOOT_INSIGNIA and LOOT_FISHINGHOLE unsupported by client + switch(loot_type) + { + case LOOT_INSIGNIA: loot_type = LOOT_SKINNING; break; + case LOOT_FISHINGHOLE: loot_type = LOOT_FISHING; break; + default: break; + } WorldPacket data(SMSG_LOOT_RESPONSE, (9+50)); // we guess size @@ -7359,7 +7332,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type) if (permission != NONE_PERMISSION) loot->AddLooter(GetGUID()); - if ( loot_type == LOOT_CORPSE && !IS_ITEM_GUID(guid) ) + if (loot_type == LOOT_CORPSE && !IS_ITEM_GUID(guid)) SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_LOOTING); } diff --git a/src/game/Player.h b/src/game/Player.h index cd2980724..96e04aedc 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -460,14 +460,16 @@ enum ActivateTaxiReplies enum LootType { LOOT_CORPSE = 1, - LOOT_SKINNING = 2, + LOOT_PICKPOCKETING = 2, LOOT_FISHING = 3, - LOOT_PICKPOCKETING = 4, // unsupported by client, sending LOOT_SKINNING instead - LOOT_DISENCHANTING = 5, // unsupported by client, sending LOOT_SKINNING instead - LOOT_PROSPECTING = 6, // unsupported by client, sending LOOT_SKINNING instead - LOOT_INSIGNIA = 7, // unsupported by client, sending LOOT_SKINNING instead - LOOT_FISHINGHOLE = 8, // unsupported by client, sending LOOT_FISHING instead - LOOT_MILLING = 9 // unsupported by client, sending LOOT_SKINNING instead + LOOT_DISENCHANTING = 4, + // ignored always by client + LOOT_SKINNING = 6, + LOOT_PROSPECTING = 7, + LOOT_MILLING = 8, + + LOOT_FISHINGHOLE = 20, // unsupported by client, sending LOOT_FISHING instead + LOOT_INSIGNIA = 21 // unsupported by client, sending LOOT_CORPSE instead }; enum MirrorTimerType diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index e633ccd9f..972aacc40 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 "7727" + #define REVISION_NR "7728" #endif // __REVISION_NR_H__