diff options
| -rw-r--r-- | sql/updates/world/2011_08_15_00_world_creature_loot_template.sql | 1 | ||||
| -rwxr-xr-x | src/server/game/Chat/Commands/Debugcmds.cpp | 19 | ||||
| -rwxr-xr-x | src/server/game/Combat/HostileRefManager.h | 8 | ||||
| -rwxr-xr-x | src/server/game/Entities/GameObject/GameObject.cpp | 5 | ||||
| -rwxr-xr-x | src/server/game/Entities/GameObject/GameObject.h | 7 | ||||
| -rwxr-xr-x | src/server/game/Entities/Object/Object.h | 2 | ||||
| -rwxr-xr-x | src/server/game/Scripting/ScriptMgr.cpp | 181 | ||||
| -rwxr-xr-x | src/server/game/Scripting/ScriptMgr.h | 109 | ||||
| -rw-r--r-- | src/server/game/Spells/SpellInfo.h | 88 | ||||
| -rw-r--r--[-rwxr-xr-x] | src/server/game/Tools/PlayerDump.cpp | 6 | ||||
| -rw-r--r-- | src/server/scripts/Northrend/Ulduar/ulduar/boss_hodir.cpp | 39 | ||||
| -rw-r--r-- | src/server/scripts/Northrend/storm_peaks.cpp | 2 |
12 files changed, 257 insertions, 210 deletions
diff --git a/sql/updates/world/2011_08_15_00_world_creature_loot_template.sql b/sql/updates/world/2011_08_15_00_world_creature_loot_template.sql new file mode 100644 index 00000000000..a5bfd7c44a6 --- /dev/null +++ b/sql/updates/world/2011_08_15_00_world_creature_loot_template.sql @@ -0,0 +1 @@ +UPDATE `creature_loot_template` SET `maxcount`=3 WHERE `entry`=38401 AND `mincountOrRef`=-34248; diff --git a/src/server/game/Chat/Commands/Debugcmds.cpp b/src/server/game/Chat/Commands/Debugcmds.cpp deleted file mode 100755 index 0c7e110c345..00000000000 --- a/src/server/game/Chat/Commands/Debugcmds.cpp +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -// This file is deprecated diff --git a/src/server/game/Combat/HostileRefManager.h b/src/server/game/Combat/HostileRefManager.h index f84a7a69fca..36fe6f7a6b7 100755 --- a/src/server/game/Combat/HostileRefManager.h +++ b/src/server/game/Combat/HostileRefManager.h @@ -32,9 +32,9 @@ class SpellInfo; class HostileRefManager : public RefManager<Unit, ThreatManager> { private: - Unit *iOwner; + Unit* iOwner; public: - explicit HostileRefManager(Unit *owner) { iOwner = owner; } + explicit HostileRefManager(Unit* owner) { iOwner = owner; } ~HostileRefManager(); Unit* getOwner() { return iOwner; } @@ -62,10 +62,10 @@ class HostileRefManager : public RefManager<Unit, ThreatManager> void setOnlineOfflineState(bool isOnline); // set state for one reference, defined by Unit - void setOnlineOfflineState(Unit *creature, bool isOnline); + void setOnlineOfflineState(Unit* creature, bool isOnline); // delete one reference, defined by Unit - void deleteReference(Unit *creature); + void deleteReference(Unit* creature); void UpdateVisibility(); }; diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 5d4eeb48111..b325a7fb407 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -1575,8 +1575,9 @@ void GameObject::Use(Unit* user) return; } default: - sLog->outError("GameObject::Use(): unit (type: %u, guid: %u, name: %s) tries to use object (guid: %u, entry: %u, name: %s) of unknown type (%u)", - user->GetTypeId(), user->GetGUIDLow(), user->GetName(), GetGUIDLow(), GetEntry(), GetGOInfo()->name.c_str(), GetGoType()); + if (GetGoType() >= MAX_GAMEOBJECT_TYPE) + sLog->outError("GameObject::Use(): unit (type: %u, guid: %u, name: %s) tries to use object (guid: %u, entry: %u, name: %s) of unknown type (%u)", + user->GetTypeId(), user->GetGUIDLow(), user->GetName(), GetGUIDLow(), GetEntry(), GetGOInfo()->name.c_str(), GetGoType()); break; } diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index 504fc37135f..a0e6fff173f 100755 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -816,6 +816,13 @@ class GameObject : public WorldObject, public GridObject<GameObject> uint16 m_LootMode; // bitmask, default LOOT_MODE_DEFAULT, determines what loot will be lootable private: void SwitchDoorOrButton(bool activate, bool alternative = false); + + //! Object distance/size - overridden from Object::_IsWithinDist. Needs to take in account proper GO size. + bool _IsWithinDist(WorldObject const* obj, float dist2compare, bool /*is3D*/) const + { + //! Following check does check 3d distance + return IsInRange(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), dist2compare); + } GameObjectAI* m_AI; }; #endif diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 0ec3312834d..a0433f8f475 100755 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -699,7 +699,7 @@ class WorldObject : public Object, public WorldLocation { return IsInDist2d(x, y, dist + GetObjectSize()); } bool IsWithinDist2d(const Position *pos, float dist) const { return IsInDist2d(pos, dist + GetObjectSize()); } - bool _IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D) const; + virtual bool _IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D) const; // use only if you will sure about placing both object at same map bool IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D = true) const { diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 6f170225cde..d0b56ee1ddf 100755 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -32,94 +32,97 @@ template<class TScript> class ScriptRegistry { - // Counter used for code-only scripts. - static uint32 _scriptIdCounter; + public: -public: - typedef std::map<uint32, TScript*> ScriptMap; - typedef typename ScriptMap::iterator ScriptMapIterator; + typedef std::map<uint32, TScript*> ScriptMap; + typedef typename ScriptMap::iterator ScriptMapIterator; - // The actual list of scripts. This will be accessed concurrently, so it must not be modified - // after server startup. - static ScriptMap ScriptPointerList; + // The actual list of scripts. This will be accessed concurrently, so it must not be modified + // after server startup. + static ScriptMap ScriptPointerList; - static void AddScript(TScript* const script) - { - ASSERT(script); - - // See if the script is using the same memory as another script. If this happens, it means that - // someone forgot to allocate new memory for a script. - for (ScriptMapIterator it = ScriptPointerList.begin(); it != ScriptPointerList.end(); ++it) + static void AddScript(TScript* const script) { - if (it->second == script) + ASSERT(script); + + // See if the script is using the same memory as another script. If this happens, it means that + // someone forgot to allocate new memory for a script. + for (ScriptMapIterator it = ScriptPointerList.begin(); it != ScriptPointerList.end(); ++it) { - sLog->outError("Script '%s' has same memory pointer as '%s'.", - script->GetName().c_str(), it->second->GetName().c_str()); + if (it->second == script) + { + sLog->outError("Script '%s' has same memory pointer as '%s'.", + script->GetName().c_str(), it->second->GetName().c_str()); - return; + return; + } } - } - if (script->IsDatabaseBound()) - { - // Get an ID for the script. An ID only exists if it's a script that is assigned in the database - // through a script name (or similar). - uint32 id = sObjectMgr->GetScriptId(script->GetName().c_str()); - if (id) + if (script->IsDatabaseBound()) { - // Try to find an existing script. - bool existing = false; - for (ScriptMapIterator it = ScriptPointerList.begin(); it != ScriptPointerList.end(); ++it) + // Get an ID for the script. An ID only exists if it's a script that is assigned in the database + // through a script name (or similar). + uint32 id = sObjectMgr->GetScriptId(script->GetName().c_str()); + if (id) { - // If the script names match... - if (it->second->GetName() == script->GetName()) + // Try to find an existing script. + bool existing = false; + for (ScriptMapIterator it = ScriptPointerList.begin(); it != ScriptPointerList.end(); ++it) { - // ... It exists. - existing = true; - break; + // If the script names match... + if (it->second->GetName() == script->GetName()) + { + // ... It exists. + existing = true; + break; + } } - } - // If the script isn't assigned -> assign it! - if (!existing) - { - ScriptPointerList[id] = script; - sScriptMgr->IncrementScriptCount(); + // If the script isn't assigned -> assign it! + if (!existing) + { + ScriptPointerList[id] = script; + sScriptMgr->IncrementScriptCount(); + } + else + { + // If the script is already assigned -> delete it! + sLog->outError("Script '%s' already assigned with the same script name, so the script can't work.", + script->GetName().c_str()); + + ASSERT(false); // Error that should be fixed ASAP. + } } else { - // If the script is already assigned -> delete it! - sLog->outError("Script '%s' already assigned with the same script name, so the script can't work.", - script->GetName().c_str()); - - ASSERT(false); // Error that should be fixed ASAP. + // The script uses a script name from database, but isn't assigned to anything. + if (script->GetName().find("example") == std::string::npos && script->GetName().find("Smart") == std::string::npos) + sLog->outErrorDb("Script named '%s' does not have a script name assigned in database.", + script->GetName().c_str()); } } else { - // The script uses a script name from database, but isn't assigned to anything. - if (script->GetName().find("example") == std::string::npos && script->GetName().find("Smart") == std::string::npos) - sLog->outErrorDb("Script named '%s' does not have a script name assigned in database.", - script->GetName().c_str()); + // We're dealing with a code-only script; just add it. + ScriptPointerList[_scriptIdCounter++] = script; + sScriptMgr->IncrementScriptCount(); } } - else + + // Gets a script by its ID (assigned by ObjectMgr). + static TScript* GetScriptById(uint32 id) { - // We're dealing with a code-only script; just add it. - ScriptPointerList[_scriptIdCounter++] = script; - sScriptMgr->IncrementScriptCount(); + ScriptMapIterator it = ScriptPointerList.find(id); + if (it != ScriptPointerList.end()) + return it->second; + + return NULL; } - } - // Gets a script by its ID (assigned by ObjectMgr). - static TScript* GetScriptById(uint32 id) - { - ScriptMapIterator it = ScriptPointerList.find(id); - if (it != ScriptPointerList.end()) - return it->second; + private: - return NULL; - } + // Counter used for code-only scripts. + static uint32 _scriptIdCounter; }; // Utility macros to refer to the script registry. @@ -316,29 +319,29 @@ void ScriptMgr::FillSpellSummary() SpellSummary[i].Targets = 0; pTempSpell = sSpellMgr->GetSpellInfo(i); - //This spell doesn't exist + // This spell doesn't exist. if (!pTempSpell) continue; for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j) { - //Spell targets self + // Spell targets self. if (pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_CASTER) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SELF-1); - //Spell targets a single enemy + // Spell targets a single enemy. if (pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_TARGET_ENEMY || pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_DST_TARGET_ENEMY) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SINGLE_ENEMY-1); - //Spell targets AoE at enemy + // Spell targets AoE at enemy. if (pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_AREA_ENEMY_SRC || pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_AREA_ENEMY_DST || pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_SRC_CASTER || pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_DEST_DYNOBJ_ENEMY) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_AOE_ENEMY-1); - //Spell targets an enemy + // Spell targets an enemy. if (pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_TARGET_ENEMY || pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_DST_TARGET_ENEMY || pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_AREA_ENEMY_SRC || @@ -347,19 +350,19 @@ void ScriptMgr::FillSpellSummary() pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_DEST_DYNOBJ_ENEMY) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_ANY_ENEMY-1); - //Spell targets a single friend(or self) + // Spell targets a single friend (or self). if (pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_CASTER || pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_TARGET_ALLY || pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_TARGET_PARTY) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SINGLE_FRIEND-1); - //Spell targets aoe friends + // Spell targets AoE friends. if (pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_PARTY_CASTER || pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_TARGET_ALLY_PARTY || pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_SRC_CASTER) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_AOE_FRIEND-1); - //Spell targets any friend(or self) + // Spell targets any friend (or self). if (pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_CASTER || pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_TARGET_ALLY || pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_TARGET_PARTY || @@ -368,30 +371,30 @@ void ScriptMgr::FillSpellSummary() pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_SRC_CASTER) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_ANY_FRIEND-1); - //Make sure that this spell includes a damage effect + // Make sure that this spell includes a damage effect. if (pTempSpell->Effects[j].Effect == SPELL_EFFECT_SCHOOL_DAMAGE || pTempSpell->Effects[j].Effect == SPELL_EFFECT_INSTAKILL || pTempSpell->Effects[j].Effect == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE || pTempSpell->Effects[j].Effect == SPELL_EFFECT_HEALTH_LEECH) SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_DAMAGE-1); - //Make sure that this spell includes a healing effect (or an apply aura with a periodic heal) + // Make sure that this spell includes a healing effect (or an apply aura with a periodic heal). if (pTempSpell->Effects[j].Effect == SPELL_EFFECT_HEAL || pTempSpell->Effects[j].Effect == SPELL_EFFECT_HEAL_MAX_HEALTH || pTempSpell->Effects[j].Effect == SPELL_EFFECT_HEAL_MECHANICAL || (pTempSpell->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA && pTempSpell->Effects[j].ApplyAuraName == 8)) SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_HEALING-1); - //Make sure that this spell applies an aura + // Make sure that this spell applies an aura. if (pTempSpell->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA) SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_AURA-1); } } } -void ScriptMgr::CreateSpellScripts(uint32 spell_id, std::list<SpellScript *> & script_vector) +void ScriptMgr::CreateSpellScripts(uint32 spellId, std::list<SpellScript*>& scriptVector) { - SpellScriptsBounds bounds = sObjectMgr->GetSpellScriptsBounds(spell_id); + SpellScriptsBounds bounds = sObjectMgr->GetSpellScriptsBounds(spellId); for (SpellScriptsMap::iterator itr = bounds.first; itr != bounds.second; ++itr) { @@ -404,15 +407,15 @@ void ScriptMgr::CreateSpellScripts(uint32 spell_id, std::list<SpellScript *> & s if (!script) continue; - script->_Init(&tmpscript->GetName(), spell_id); + script->_Init(&tmpscript->GetName(), spellId); - script_vector.push_back(script); + scriptVector.push_back(script); } } -void ScriptMgr::CreateAuraScripts(uint32 spell_id, std::list<AuraScript *> & script_vector) +void ScriptMgr::CreateAuraScripts(uint32 spellId, std::list<AuraScript*>& scriptVector) { - SpellScriptsBounds bounds = sObjectMgr->GetSpellScriptsBounds(spell_id); + SpellScriptsBounds bounds = sObjectMgr->GetSpellScriptsBounds(spellId); for (SpellScriptsMap::iterator itr = bounds.first; itr != bounds.second; ++itr) { @@ -425,16 +428,16 @@ void ScriptMgr::CreateAuraScripts(uint32 spell_id, std::list<AuraScript *> & scr if (!script) continue; - script->_Init(&tmpscript->GetName(), spell_id); + script->_Init(&tmpscript->GetName(), spellId); - script_vector.push_back(script); + scriptVector.push_back(script); } } -void ScriptMgr::CreateSpellScriptLoaders(uint32 spell_id, std::vector<std::pair<SpellScriptLoader *, SpellScriptsMap::iterator> > & script_vector) +void ScriptMgr::CreateSpellScriptLoaders(uint32 spellId, std::vector<std::pair<SpellScriptLoader*, SpellScriptsMap::iterator> >& scriptVector) { - SpellScriptsBounds bounds = sObjectMgr->GetSpellScriptsBounds(spell_id); - script_vector.reserve(std::distance(bounds.first, bounds.second)); + SpellScriptsBounds bounds = sObjectMgr->GetSpellScriptsBounds(spellId); + scriptVector.reserve(std::distance(bounds.first, bounds.second)); for (SpellScriptsMap::iterator itr = bounds.first; itr != bounds.second; ++itr) { @@ -442,7 +445,7 @@ void ScriptMgr::CreateSpellScriptLoaders(uint32 spell_id, std::vector<std::pair< if (!tmpscript) continue; - script_vector.push_back(std::make_pair(tmpscript, itr)); + scriptVector.push_back(std::make_pair(tmpscript, itr)); } } @@ -1195,9 +1198,9 @@ void ScriptMgr::OnPlayerFreeTalentPointsChanged(Player* player, uint32 points) FOREACH_SCRIPT(PlayerScript)->OnFreeTalentPointsChanged(player, points); } -void ScriptMgr::OnPlayerTalentsReset(Player* player, bool no_cost) +void ScriptMgr::OnPlayerTalentsReset(Player* player, bool noCost) { - FOREACH_SCRIPT(PlayerScript)->OnTalentsReset(player, no_cost); + FOREACH_SCRIPT(PlayerScript)->OnTalentsReset(player, noCost); } void ScriptMgr::OnPlayerMoneyChanged(Player* player, int32& amount) @@ -1260,9 +1263,9 @@ void ScriptMgr::OnPlayerEmote(Player* player, uint32 emote) FOREACH_SCRIPT(PlayerScript)->OnEmote(player, emote); } -void ScriptMgr::OnPlayerTextEmote(Player* player, uint32 text_emote, uint32 emoteNum, uint64 guid) +void ScriptMgr::OnPlayerTextEmote(Player* player, uint32 textEmote, uint32 emoteNum, uint64 guid) { - FOREACH_SCRIPT(PlayerScript)->OnTextEmote(player, text_emote, emoteNum, guid); + FOREACH_SCRIPT(PlayerScript)->OnTextEmote(player, textEmote, emoteNum, guid); } void ScriptMgr::OnPlayerSpellCast(Player* player, Spell* spell, bool skipCheck) diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 9372a7e71c2..75325b5319b 100755 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -199,9 +199,10 @@ class SpellScriptLoader : public ScriptObject bool IsDatabaseBound() const { return true; } // Should return a fully valid SpellScript pointer. - virtual SpellScript* GetSpellScript() const { return NULL; }; + virtual SpellScript* GetSpellScript() const { return NULL; } + // Should return a fully valid AuraScript pointer. - virtual AuraScript* GetAuraScript() const { return NULL; }; + virtual AuraScript* GetAuraScript() const { return NULL; } }; class ServerScript : public ScriptObject @@ -464,9 +465,10 @@ class GameObjectScript : public ScriptObject, public UpdatableScript<GameObject> // Called when the dialog status between a player and the gameobject is requested. virtual uint32 GetDialogStatus(Player* /*player*/, GameObject* /*go*/) { return 100; } - // Called when the gameobject is destroyed (destructible buildings only). + // Called when the game object is destroyed (destructible buildings only). virtual void OnDestroyed(GameObject* /*go*/, Player* /*player*/) { } - // Called when the gameobject is damaged (destructible buildings only). + + // Called when the game object is damaged (destructible buildings only). virtual void OnDamaged(GameObject* /*go*/, Player* /*player*/) { } }; @@ -668,7 +670,7 @@ class PlayerScript : public ScriptObject virtual void OnFreeTalentPointsChanged(Player* /*player*/, uint32 /*points*/) { } // Called when a player's talent points are reset (right before the reset is done) - virtual void OnTalentsReset(Player* /*player*/, bool /*no_cost*/) { } + virtual void OnTalentsReset(Player* /*player*/, bool /*noCost*/) { } // Called when a player's money is modified (before the modification is done) virtual void OnMoneyChanged(Player* /*player*/, int32& /*amount*/) { } @@ -677,7 +679,7 @@ class PlayerScript : public ScriptObject virtual void OnGiveXP(Player* /*player*/, uint32& /*amount*/, Unit* /*victim*/) { } // Called when a player's reputation changes (before it is actually changed) - virtual void OnReputationChange(Player* /*player*/, uint32 /*factionID*/, int32& /*standing*/, bool /*incremental*/) { } + virtual void OnReputationChange(Player* /*player*/, uint32 /*factionId*/, int32& /*standing*/, bool /*incremental*/) { } // Called when a duel is requested virtual void OnDuelRequest(Player* /*target*/, Player* /*challenger*/) { } @@ -688,30 +690,39 @@ class PlayerScript : public ScriptObject // Called when a duel ends virtual void OnDuelEnd(Player* /*winner*/, Player* /*loser*/, DuelCompleteType /*type*/) { } - // The following methods are called when a player sends a chat message + // The following methods are called when a player sends a chat message. virtual void OnChat(Player* /*player*/, uint32 /*type*/, uint32 /*lang*/, std::string& /*msg*/) { } + virtual void OnChat(Player* /*player*/, uint32 /*type*/, uint32 /*lang*/, std::string& /*msg*/, Player* /*receiver*/) { } + virtual void OnChat(Player* /*player*/, uint32 /*type*/, uint32 /*lang*/, std::string& /*msg*/, Group* /*group*/) { } + virtual void OnChat(Player* /*player*/, uint32 /*type*/, uint32 /*lang*/, std::string& /*msg*/, Guild* /*guild*/) { } + virtual void OnChat(Player* /*player*/, uint32 /*type*/, uint32 /*lang*/, std::string& /*msg*/, Channel* /*channel*/) { } - // Both of the below are called on emote opcodes + // Both of the below are called on emote opcodes. virtual void OnEmote(Player* /*player*/, uint32 /*emote*/) { } - virtual void OnTextEmote(Player* /*player*/, uint32 /*text_emote*/, uint32 /*emoteNum*/, uint64 /*guid*/) { } - // Called in Spell::cast + virtual void OnTextEmote(Player* /*player*/, uint32 /*textEmote*/, uint32 /*emoteNum*/, uint64 /*guid*/) { } + + // Called in Spell::Cast. virtual void OnSpellCast(Player* /*player*/, Spell* /*spell*/, bool /*skipCheck*/) { } - // Called when a player logs in or out + // Called when a player logs in. virtual void OnLogin(Player* /*player*/) { } + + // Called when a player logs out. virtual void OnLogout(Player* /*player*/) { } - // Called when a player is created/deleted + // Called when a player is created. virtual void OnCreate(Player* /*player*/) { } + + // Called when a player is deleted. virtual void OnDelete(uint64 /*guid*/) { } - // Called when a player is binded to an instance - virtual void OnBindToInstance(Player* /*player*/, Difficulty /*difficulty*/, uint32 /*mapid*/, bool /*permanent*/) { } + // Called when a player is bound to an instance + virtual void OnBindToInstance(Player* /*player*/, Difficulty /*difficulty*/, uint32 /*mapId*/, bool /*permanent*/) { } }; class GuildScript : public ScriptObject @@ -724,33 +735,63 @@ class GuildScript : public ScriptObject bool IsDatabaseBound() const { return false; } + // Called when a member is added to the guild. virtual void OnAddMember(Guild* /*guild*/, Player* /*player*/, uint8& /*plRank*/) { } + + // Called when a member is removed from the guild. virtual void OnRemoveMember(Guild* /*guild*/, Player* /*player*/, bool /*isDisbanding*/, bool /*isKicked*/) { } + + // Called when the guild MOTD (message of the day) changes. virtual void OnMOTDChanged(Guild* /*guild*/, const std::string& /*newMotd*/) { } + + // Called when the guild info is altered. virtual void OnInfoChanged(Guild* /*guild*/, const std::string& /*newInfo*/) { } + + // Called when a guild is created. virtual void OnCreate(Guild* /*guild*/, Player* /*leader*/, const std::string& /*name*/) { } + + // Called when a guild is disbanded. virtual void OnDisband(Guild* /*guild*/) { } + + // Called when a guild member withdraws money from a guild bank. virtual void OnMemberWitdrawMoney(Guild* /*guild*/, Player* /*player*/, uint32& /*amount*/, bool /*isRepair*/) { } + + // Called when a guild member deposits money in a guild bank. virtual void OnMemberDepositMoney(Guild* /*guild*/, Player* /*player*/, uint32& /*amount*/) { } + + // Called when a guild member moves an item in a guild bank. virtual void OnItemMove(Guild* /*guild*/, Player* /*player*/, Item* /*pItem*/, bool /*isSrcBank*/, uint8 /*srcContainer*/, uint8 /*srcSlotId*/, bool /*isDestBank*/, uint8 /*destContainer*/, uint8 /*destSlotId*/) { } + virtual void OnEvent(Guild* /*guild*/, uint8 /*eventType*/, uint32 /*playerGuid1*/, uint32 /*playerGuid2*/, uint8 /*newRank*/) { } + virtual void OnBankEvent(Guild* /*guild*/, uint8 /*eventType*/, uint8 /*tabId*/, uint32 /*playerGuid*/, uint32 /*itemOrMoney*/, uint16 /*itemStackCount*/, uint8 /*destTabId*/) { } }; class GroupScript : public ScriptObject { -protected: - GroupScript(const char* name); + protected: + + GroupScript(const char* name); + + public: + + bool IsDatabaseBound() const { return false; } + + // Called when a member is added to a group. + virtual void OnAddMember(Group* /*group*/, uint64 /*guid*/) { } -public: - bool IsDatabaseBound() const { return false; } + // Called when a member is invited to join a group. + virtual void OnInviteMember(Group* /*group*/, uint64 /*guid*/) { } - virtual void OnAddMember(Group* /*group*/, uint64 /*guid*/) { } - virtual void OnInviteMember(Group* /*group*/, uint64 /*guid*/) { } - virtual void OnRemoveMember(Group* /*group*/, uint64 /*guid*/, RemoveMethod& /*method*/, uint64 /*kicker*/, const char* /*reason*/) { } - virtual void OnChangeLeader(Group* /*group*/, uint64 /*newLeaderGuid*/, uint64 /*oldLeaderGuid*/) { } - virtual void OnDisband(Group* /*group*/) { } + // Called when a member is removed from a group. + virtual void OnRemoveMember(Group* /*group*/, uint64 /*guid*/, RemoveMethod& /*method*/, uint64 /*kicker*/, const char* /*reason*/) { } + + // Called when the leader of a group is changed. + virtual void OnChangeLeader(Group* /*group*/, uint64 /*newLeaderGuid*/, uint64 /*oldLeaderGuid*/) { } + + // Called when a group is disbanded. + virtual void OnDisband(Group* /*group*/) { } }; // Placed here due to ScriptRegistry::AddScript dependency. @@ -763,6 +804,7 @@ class ScriptMgr friend class ScriptObject; private: + ScriptMgr(); virtual ~ScriptMgr(); @@ -778,13 +820,14 @@ class ScriptMgr uint32 GetScriptCount() const { return _scriptCount; } public: /* Unloading */ + void Unload(); public: /* SpellScriptLoader */ - void CreateSpellScripts(uint32 spell_id, std::list<SpellScript*>& script_vector); - void CreateAuraScripts(uint32 spell_id, std::list<AuraScript*>& script_vector); - void CreateSpellScriptLoaders(uint32 spell_id, std::vector<std::pair<SpellScriptLoader*, std::multimap<uint32, uint32>::iterator> >& script_vector); + void CreateSpellScripts(uint32 spellId, std::list<SpellScript*>& scriptVector); + void CreateAuraScripts(uint32 spellId, std::list<AuraScript*>& scriptVector); + void CreateSpellScriptLoaders(uint32 spellId, std::vector<std::pair<SpellScriptLoader*, std::multimap<uint32, uint32>::iterator> >& scriptVector); public: /* ServerScript */ @@ -929,7 +972,7 @@ class ScriptMgr void OnPlayerKilledByCreature(Creature* killer, Player* killed); void OnPlayerLevelChanged(Player* player, uint8 oldLevel); void OnPlayerFreeTalentPointsChanged(Player* player, uint32 newPoints); - void OnPlayerTalentsReset(Player* player, bool no_cost); + void OnPlayerTalentsReset(Player* player, bool noCost); void OnPlayerMoneyChanged(Player* player, int32& amount); void OnGivePlayerXP(Player* player, uint32& amount, Unit* victim); void OnPlayerReputationChange(Player* player, uint32 factionID, int32& standing, bool incremental); @@ -942,7 +985,7 @@ class ScriptMgr void OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string& msg, Guild* guild); void OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string& msg, Channel* channel); void OnPlayerEmote(Player* player, uint32 emote); - void OnPlayerTextEmote(Player* player, uint32 text_emote, uint32 emoteNum, uint64 guid); + void OnPlayerTextEmote(Player* player, uint32 textEmote, uint32 emoteNum, uint64 guid); void OnPlayerSpellCast(Player* player, Spell* spell, bool skipCheck); void OnPlayerLogin(Player* player); void OnPlayerLogout(Player* player); @@ -951,6 +994,7 @@ class ScriptMgr void OnPlayerBindToInstance(Player* player, Difficulty difficulty, uint32 mapid, bool permanent); public: /* GuildScript */ + void OnGuildAddMember(Guild* guild, Player* player, uint8& plRank); void OnGuildRemoveMember(Guild* guild, Player* player, bool isDisbanding, bool isKicked); void OnGuildMOTDChanged(Guild* guild, const std::string& newMotd); @@ -965,6 +1009,7 @@ class ScriptMgr void OnGuildBankEvent(Guild* guild, uint8 eventType, uint8 tabId, uint32 playerGuid, uint32 itemOrMoney, uint16 itemStackCount, uint8 destTabId); public: /* GroupScript */ + void OnGroupAddMember(Group* group, uint64 guid); void OnGroupInviteMember(Group* group, uint64 guid); void OnGroupRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, const char* reason); @@ -972,12 +1017,14 @@ class ScriptMgr void OnGroupDisband(Group* group); public: /* Scheduled scripts */ - uint32 IncreaseScheduledScriptsCount() { return uint32(++_scheduledScripts); } - uint32 DecreaseScheduledScriptCount() { return uint32(--_scheduledScripts); } - uint32 DecreaseScheduledScriptCount(size_t count) { return uint32(_scheduledScripts -= count); } + + uint32 IncreaseScheduledScriptsCount() { return ++_scheduledScripts; } + uint32 DecreaseScheduledScriptCount() { return --_scheduledScripts; } + uint32 DecreaseScheduledScriptCount(size_t count) { return _scheduledScripts -= count; } bool IsScriptScheduled() const { return _scheduledScripts > 0; } private: + uint32 _scriptCount; //atomic op counter for active scripts amount diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h index 9cf75b06d3b..e0e52a94a6a 100644 --- a/src/server/game/Spells/SpellInfo.h +++ b/src/server/game/Spells/SpellInfo.h @@ -60,53 +60,53 @@ enum SpellSelectTargetTypes // Spell clasification enum SpellSpecificType { - SPELL_SPECIFIC_NORMAL = 0, - SPELL_SPECIFIC_SEAL = 1, - SPELL_SPECIFIC_AURA = 3, - SPELL_SPECIFIC_STING = 4, - SPELL_SPECIFIC_CURSE = 5, - SPELL_SPECIFIC_ASPECT = 6, - SPELL_SPECIFIC_TRACKER = 7, - SPELL_SPECIFIC_WARLOCK_ARMOR = 8, - SPELL_SPECIFIC_MAGE_ARMOR = 9, - SPELL_SPECIFIC_ELEMENTAL_SHIELD = 10, - SPELL_SPECIFIC_MAGE_POLYMORPH = 11, - SPELL_SPECIFIC_JUDGEMENT = 13, - SPELL_SPECIFIC_WARLOCK_CORRUPTION= 17, - SPELL_SPECIFIC_FOOD = 19, - SPELL_SPECIFIC_DRINK = 20, - SPELL_SPECIFIC_FOOD_AND_DRINK = 21, - SPELL_SPECIFIC_PRESENCE = 22, - SPELL_SPECIFIC_CHARM = 23, - SPELL_SPECIFIC_SCROLL = 24, - SPELL_SPECIFIC_MAGE_ARCANE_BRILLANCE = 25, - SPELL_SPECIFIC_WARRIOR_ENRAGE = 26, - SPELL_SPECIFIC_PRIEST_DIVINE_SPIRIT = 27, - SPELL_SPECIFIC_HAND = 28, - SPELL_SPECIFIC_PHASE = 29, + SPELL_SPECIFIC_NORMAL = 0, + SPELL_SPECIFIC_SEAL = 1, + SPELL_SPECIFIC_AURA = 3, + SPELL_SPECIFIC_STING = 4, + SPELL_SPECIFIC_CURSE = 5, + SPELL_SPECIFIC_ASPECT = 6, + SPELL_SPECIFIC_TRACKER = 7, + SPELL_SPECIFIC_WARLOCK_ARMOR = 8, + SPELL_SPECIFIC_MAGE_ARMOR = 9, + SPELL_SPECIFIC_ELEMENTAL_SHIELD = 10, + SPELL_SPECIFIC_MAGE_POLYMORPH = 11, + SPELL_SPECIFIC_JUDGEMENT = 13, + SPELL_SPECIFIC_WARLOCK_CORRUPTION = 17, + SPELL_SPECIFIC_FOOD = 19, + SPELL_SPECIFIC_DRINK = 20, + SPELL_SPECIFIC_FOOD_AND_DRINK = 21, + SPELL_SPECIFIC_PRESENCE = 22, + SPELL_SPECIFIC_CHARM = 23, + SPELL_SPECIFIC_SCROLL = 24, + SPELL_SPECIFIC_MAGE_ARCANE_BRILLANCE = 25, + SPELL_SPECIFIC_WARRIOR_ENRAGE = 26, + SPELL_SPECIFIC_PRIEST_DIVINE_SPIRIT = 27, + SPELL_SPECIFIC_HAND = 28, + SPELL_SPECIFIC_PHASE = 29, }; enum SpellCustomAttributes { - SPELL_ATTR0_CU_ENCHANT_PROC = 0x00000001, - SPELL_ATTR0_CU_CONE_BACK = 0x00000002, - SPELL_ATTR0_CU_CONE_LINE = 0x00000004, - SPELL_ATTR0_CU_SHARE_DAMAGE = 0x00000008, - SPELL_ATTR0_CU_NONE1 = 0x00000010, // UNUSED - SPELL_ATTR0_CU_NONE2 = 0x00000020, // UNUSED - SPELL_ATTR0_CU_AURA_CC = 0x00000040, - SPELL_ATTR0_CU_DIRECT_DAMAGE = 0x00000100, - SPELL_ATTR0_CU_CHARGE = 0x00000200, - SPELL_ATTR0_CU_PICKPOCKET = 0x00000400, - SPELL_ATTR0_CU_EXCLUDE_SELF = 0x00000800, - SPELL_ATTR0_CU_NEGATIVE_EFF0 = 0x00001000, - SPELL_ATTR0_CU_NEGATIVE_EFF1 = 0x00002000, - SPELL_ATTR0_CU_NEGATIVE_EFF2 = 0x00004000, - SPELL_ATTR0_CU_IGNORE_ARMOR = 0x00008000, - SPELL_ATTR0_CU_REQ_TARGET_FACING_CASTER = 0x00010000, - SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET = 0x00020000, - - SPELL_ATTR0_CU_NEGATIVE = SPELL_ATTR0_CU_NEGATIVE_EFF0 | SPELL_ATTR0_CU_NEGATIVE_EFF1 | SPELL_ATTR0_CU_NEGATIVE_EFF2, + SPELL_ATTR0_CU_ENCHANT_PROC = 0x00000001, + SPELL_ATTR0_CU_CONE_BACK = 0x00000002, + SPELL_ATTR0_CU_CONE_LINE = 0x00000004, + SPELL_ATTR0_CU_SHARE_DAMAGE = 0x00000008, + SPELL_ATTR0_CU_NONE1 = 0x00000010, // UNUSED + SPELL_ATTR0_CU_NONE2 = 0x00000020, // UNUSED + SPELL_ATTR0_CU_AURA_CC = 0x00000040, + SPELL_ATTR0_CU_DIRECT_DAMAGE = 0x00000100, + SPELL_ATTR0_CU_CHARGE = 0x00000200, + SPELL_ATTR0_CU_PICKPOCKET = 0x00000400, + SPELL_ATTR0_CU_EXCLUDE_SELF = 0x00000800, + SPELL_ATTR0_CU_NEGATIVE_EFF0 = 0x00001000, + SPELL_ATTR0_CU_NEGATIVE_EFF1 = 0x00002000, + SPELL_ATTR0_CU_NEGATIVE_EFF2 = 0x00004000, + SPELL_ATTR0_CU_IGNORE_ARMOR = 0x00008000, + SPELL_ATTR0_CU_REQ_TARGET_FACING_CASTER = 0x00010000, + SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET = 0x00020000, + + SPELL_ATTR0_CU_NEGATIVE = SPELL_ATTR0_CU_NEGATIVE_EFF0 | SPELL_ATTR0_CU_NEGATIVE_EFF1 | SPELL_ATTR0_CU_NEGATIVE_EFF2, }; class SpellImplicitTargetInfo @@ -357,4 +357,4 @@ public: static bool _IsPositiveTarget(uint32 targetA, uint32 targetB); }; -#endif // _SPELLINFO_H
\ No newline at end of file +#endif // _SPELLINFO_H diff --git a/src/server/game/Tools/PlayerDump.cpp b/src/server/game/Tools/PlayerDump.cpp index 86fb5cce425..4c464f92606 100755..100644 --- a/src/server/game/Tools/PlayerDump.cpp +++ b/src/server/game/Tools/PlayerDump.cpp @@ -520,11 +520,11 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s ROLLBACK(DUMP_FILE_BROKEN); const char null[5] = "NULL"; - if (!changenth(line, 68, null)) // characters.deleteInfos_Account + if (!changenth(line, 69, null)) // characters.deleteInfos_Account ROLLBACK(DUMP_FILE_BROKEN); - if (!changenth(line, 69, null)) // characters.deleteInfos_Name + if (!changenth(line, 70, null)) // characters.deleteInfos_Name ROLLBACK(DUMP_FILE_BROKEN); - if (!changenth(line, 70, null)) // characters.deleteDate + if (!changenth(line, 71, null)) // characters.deleteDate ROLLBACK(DUMP_FILE_BROKEN); break; } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_hodir.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_hodir.cpp index 3b86968c2d2..bb21da94bc5 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_hodir.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_hodir.cpp @@ -138,14 +138,14 @@ enum HodirActions ACTION_CHEESE_THE_FREEZE = 2, }; -#define ACHIEVEMENT_CHEESE_THE_FREEZE RAID_MODE(2961, 2962) -#define ACHIEVEMENT_GETTING_COLD_IN_HERE RAID_MODE(2967, 2968) -#define ACHIEVEMENT_THIS_CACHE_WAS_RARE RAID_MODE(3182, 3184) -#define ACHIEVEMENT_COOLEST_FRIENDS RAID_MODE(2963, 2965) -#define FRIENDS_COUNT RAID_MODE(4, 8) +#define ACHIEVEMENT_CHEESE_THE_FREEZE RAID_MODE<uint8>(2961, 2962) +#define ACHIEVEMENT_GETTING_COLD_IN_HERE RAID_MODE<uint8>(2967, 2968) +#define ACHIEVEMENT_THIS_CACHE_WAS_RARE RAID_MODE<uint8>(3182, 3184) +#define ACHIEVEMENT_COOLEST_FRIENDS RAID_MODE<uint8>(2963, 2965) +#define FRIENDS_COUNT RAID_MODE<uint8>(4, 8) #define DATA_GETTING_COLD_IN_HERE 29672968 // 2967, 2968 are achievement IDs -const Position SummonPositions[8] = +Position const SummonPositions[8] = { { 1983.75f, -243.36f, 432.767f, 1.57f }, // Field Medic Penny && Battle-Priest Eliza { 1999.90f, -230.49f, 432.767f, 1.57f }, // Eivi Nightfeather && Tor Greycloud @@ -157,9 +157,16 @@ const Position SummonPositions[8] = { 1976.60f, -233.53f, 432.767f, 1.57f }, // Sissy Flamecuffs && Veesha Blazeweaver }; -uint32 Entry[8] = +uint32 const Entry[8] = { - 32897, 33325, 33328, 32893, 33326, 32901, 32900, 33327, + NPC_FIELD_MEDIC_PENNY, + NPC_EIVI_NIGHTFEATHER, + NPC_ELEMENTALIST_MAHFUUN, + NPC_MISSY_FLAMECUFFS, + NPC_FIELD_MEDIC_JESSI, + NPC_ELLIE_NIGHTFEATHER, + NPC_ELEMENTALIST_AVUUN, + NPC_SISSY_FLAMECUFFS, }; class npc_flash_freeze : public CreatureScript @@ -452,7 +459,7 @@ class boss_hodir : public CreatureScript DoMeleeAttackIfReady(); } - void DoAction(const int32 action) + void DoAction(int32 const action) { switch (action) { @@ -540,7 +547,7 @@ class npc_icicle : public CreatureScript CreatureAI* GetAI(Creature* creature) const { - return new npc_icicleAI(creature); + return GetUlduarAI<npc_icicleAI>(creature); }; }; @@ -580,7 +587,7 @@ class npc_snowpacked_icicle : public CreatureScript CreatureAI* GetAI(Creature* creature) const { - return new npc_snowpacked_icicleAI(creature); + return GetUlduarAI<npc_snowpacked_icicleAI>(creature); }; }; @@ -657,7 +664,7 @@ class npc_hodir_priest : public CreatureScript CreatureAI* GetAI(Creature* creature) const { - return new npc_hodir_priestAI(creature); + return GetUlduarAI<npc_hodir_priestAI>(creature); }; }; @@ -719,7 +726,7 @@ class npc_hodir_shaman : public CreatureScript CreatureAI* GetAI(Creature* creature) const { - return new npc_hodir_shamanAI(creature); + return GetUlduarAI<npc_hodir_shamanAI>(creature); }; }; @@ -780,7 +787,7 @@ class npc_hodir_druid : public CreatureScript CreatureAI* GetAI(Creature* creature) const { - return new npc_hodir_druidAI(creature); + return GetUlduarAI<npc_hodir_druidAI>(creature); }; }; @@ -861,7 +868,7 @@ class npc_hodir_mage : public CreatureScript CreatureAI* GetAI(Creature* creature) const { - return new npc_hodir_mageAI(creature); + return GetUlduarAI<npc_hodir_mageAI>(creature); }; }; @@ -895,7 +902,7 @@ class npc_toasty_fire : public CreatureScript CreatureAI* GetAI(Creature* creature) const { - return new npc_toasty_fireAI(creature); + return GetUlduarAI<npc_toasty_fireAI>(creature); }; }; diff --git a/src/server/scripts/Northrend/storm_peaks.cpp b/src/server/scripts/Northrend/storm_peaks.cpp index 2bd774cdf5b..690b8015ca6 100644 --- a/src/server/scripts/Northrend/storm_peaks.cpp +++ b/src/server/scripts/Northrend/storm_peaks.cpp @@ -738,7 +738,7 @@ class npc_hyldsmeet_protodrake : public CreatureScript _accessoryRespawnTimer = who->ToCreature()->GetRespawnDelay(); } - void Update(uint32 const diff) + void UpdateAI(uint32 const diff) { //! We need to manually reinstall accessories because the vehicle itself is friendly to players, //! so EnterEvadeMode is never triggered. The accessory on the other hand is hostile and killable. |
