diff options
Diffstat (limited to 'src')
761 files changed, 22983 insertions, 16643 deletions
diff --git a/src/server/authserver/Realms/RealmList.cpp b/src/server/authserver/Realms/RealmList.cpp index 245b9c7cc8c..d988b940809 100755 --- a/src/server/authserver/Realms/RealmList.cpp +++ b/src/server/authserver/Realms/RealmList.cpp @@ -31,7 +31,7 @@ void RealmList::Initialize(uint32 updateInterval) UpdateRealms(true); } -void RealmList::UpdateRealm(uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, uint8 color, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build) +void RealmList::UpdateRealm(uint32 ID, const std::string& name, const std::string& address, uint16 port, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build) { // Create new if not exist or update existed Realm& realm = m_realms[name]; @@ -39,7 +39,7 @@ void RealmList::UpdateRealm(uint32 ID, const std::string& name, const std::strin realm.m_ID = ID; realm.name = name; realm.icon = icon; - realm.color = color; + realm.flag = flag; realm.timezone = timezone; realm.allowedSecurityLevel = allowedSecurityLevel; realm.populationLevel = popu; @@ -70,7 +70,7 @@ void RealmList::UpdateRealms(bool init) { sLog->outDetail("Updating Realm List..."); - PreparedStatement *stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_REALMLIST); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_REALMLIST); PreparedQueryResult result = LoginDatabase.Query(stmt); // Circle through results and add them to the realm map @@ -79,18 +79,18 @@ void RealmList::UpdateRealms(bool init) do { Field* fields = result->Fetch(); - uint32 realmId = fields[0].GetUInt32(); - const std::string& name = fields[1].GetString(); + uint32 realmId = fields[0].GetUInt32(); + const std::string& name = fields[1].GetString(); const std::string& address = fields[2].GetString(); - uint32 port = fields[3].GetUInt32(); - uint8 icon = fields[4].GetUInt8(); - uint8 color = fields[5].GetUInt8(); - uint8 timezone = fields[6].GetUInt8(); + uint16 port = fields[3].GetUInt16(); + uint8 icon = fields[4].GetUInt8(); + RealmFlags flag = RealmFlags(fields[5].GetUInt8()); + uint8 timezone = fields[6].GetUInt8(); uint8 allowedSecurityLevel = fields[7].GetUInt8(); - float pop = fields[8].GetFloat(); - uint32 build = fields[9].GetUInt32(); + float pop = fields[8].GetFloat(); + uint32 build = fields[9].GetUInt32(); - UpdateRealm(realmId, name, address, port, icon, color, timezone, (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), pop, build); + UpdateRealm(realmId, name, address, port, icon, flag, timezone, (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), pop, build); if (init) sLog->outString("Added realm \"%s\".", fields[1].GetCString()); diff --git a/src/server/authserver/Realms/RealmList.h b/src/server/authserver/Realms/RealmList.h index 698026876fb..c8407b0fea1 100755 --- a/src/server/authserver/Realms/RealmList.h +++ b/src/server/authserver/Realms/RealmList.h @@ -23,13 +23,26 @@ #include <ace/Null_Mutex.h> #include "Common.h" +enum RealmFlags +{ + REALM_FLAG_NONE = 0x00, + REALM_FLAG_INVALID = 0x01, + REALM_FLAG_OFFLINE = 0x02, + REALM_FLAG_SPECIFYBUILD = 0x04, + REALM_FLAG_UNK1 = 0x08, + REALM_FLAG_UNK2 = 0x10, + REALM_FLAG_RECOMMENDED = 0x20, + REALM_FLAG_NEW = 0x40, + REALM_FLAG_FULL = 0x80 +}; + // Storage object for a realm struct Realm { std::string address; std::string name; uint8 icon; - uint8 color; + RealmFlags flag; uint8 timezone; uint32 m_ID; AccountTypes allowedSecurityLevel; @@ -58,7 +71,7 @@ public: private: void UpdateRealms(bool init=false); - void UpdateRealm(uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, uint8 color, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build); + void UpdateRealm(uint32 ID, const std::string& name, const std::string& address, uint16 port, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build); RealmMap m_realms; uint32 m_UpdateInterval; diff --git a/src/server/authserver/Server/AuthSocket.cpp b/src/server/authserver/Server/AuthSocket.cpp index 2698c3e30e1..2537a93fe43 100755 --- a/src/server/authserver/Server/AuthSocket.cpp +++ b/src/server/authserver/Server/AuthSocket.cpp @@ -849,7 +849,7 @@ bool AuthSocket::_HandleRealmList() pkt << i->second.icon; // realm type pkt << lock; // if 1, then realm locked - pkt << i->second.color; // if 2, then realm is offline + pkt << uint8(i->second.flag); // RealmFlags pkt << i->first; pkt << i->second.address; pkt << i->second.populationLevel; @@ -857,6 +857,15 @@ bool AuthSocket::_HandleRealmList() pkt << i->second.timezone; // realm category pkt << uint8(0x2C); // unk, may be realm number/id? + if (i->second.flag & REALM_FLAG_SPECIFYBUILD) + { + // TODO: Make this customizable + pkt << uint8(3); + pkt << uint8(3); + pkt << uint8(5); + pkt << uint16(12340); + } + ++RealmListSize; } diff --git a/src/server/authserver/Server/AuthSocket.h b/src/server/authserver/Server/AuthSocket.h index 0b04c8d015d..edd2b345183 100755 --- a/src/server/authserver/Server/AuthSocket.h +++ b/src/server/authserver/Server/AuthSocket.h @@ -23,19 +23,6 @@ #include "BigNumber.h" #include "RealmSocket.h" -enum RealmFlags -{ - REALM_FLAG_NONE = 0x00, - REALM_FLAG_INVALID = 0x01, - REALM_FLAG_OFFLINE = 0x02, - REALM_FLAG_SPECIFYBUILD = 0x04, - REALM_FLAG_UNK1 = 0x08, - REALM_FLAG_UNK2 = 0x10, - REALM_FLAG_RECOMMENDED = 0x20, - REALM_FLAG_NEW = 0x40, - REALM_FLAG_FULL = 0x80 -}; - // Handle login commands class AuthSocket: public RealmSocket::Session { diff --git a/src/server/authserver/authserver.conf.dist b/src/server/authserver/authserver.conf.dist index 86423d53e18..e9ed4bd752d 100644 --- a/src/server/authserver/authserver.conf.dist +++ b/src/server/authserver/authserver.conf.dist @@ -111,6 +111,14 @@ DebugLogMask = 64 SQLDriverLogFile = "" # +# SQLDriverQueryLogging +# Description: Log SQL queries to the SQLDriverLogFile and console. +# Default: 0 - (Disabled, Query errors only) +# 1 - (Enabled, Full query logging - may have performance impact) + +SQLDriverQueryLogging = 0 + +# # LogTimestamp # Description: Append timestamp to the server log file name. # Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext diff --git a/src/server/collision/Management/VMapManager2.cpp b/src/server/collision/Management/VMapManager2.cpp index 81b97f5f352..b9f0f25c2f9 100644 --- a/src/server/collision/Management/VMapManager2.cpp +++ b/src/server/collision/Management/VMapManager2.cpp @@ -30,6 +30,7 @@ #include <ace/Null_Mutex.h> #include <ace/Singleton.h> #include "DisableMgr.h" +#include "DBCStores.h" using G3D::Vector3; @@ -233,8 +234,8 @@ namespace VMAP { floor = info.ground_Z; ASSERT(floor < std::numeric_limits<float>::max()); - type = info.hitModel->GetLiquidType(); - if (reqLiquidType && !(type & reqLiquidType)) + type = info.hitModel->GetLiquidType(); // entry from LiquidType.dbc + if (reqLiquidType && !(GetLiquidFlags(type) & reqLiquidType)) return false; if (info.hitInstance->GetLiquidLevel(pos, info, level)) return true; @@ -245,7 +246,7 @@ namespace VMAP return false; } - WorldModel* VMapManager2::acquireModelInstance(const std::string& basepath, const std::string& filename, uint32 flags/* Only used when creating the model */) + WorldModel* VMapManager2::acquireModelInstance(const std::string& basepath, const std::string& filename) { //! Critical section, thread safe access to iLoadedModelFiles TRINITY_GUARD(ACE_Thread_Mutex, LoadedModelFilesLock); @@ -261,7 +262,6 @@ namespace VMAP return NULL; } sLog->outDebug(LOG_FILTER_MAPS, "VMapManager2: loading file '%s%s'", basepath.c_str(), filename.c_str()); - worldmodel->Flags = flags; model = iLoadedModelFiles.insert(std::pair<std::string, ManagedModel>(filename, ManagedModel())).first; model->second.setModel(worldmodel); } diff --git a/src/server/collision/Management/VMapManager2.h b/src/server/collision/Management/VMapManager2.h index 4b66a2e9fc7..1fba108388a 100755 --- a/src/server/collision/Management/VMapManager2.h +++ b/src/server/collision/Management/VMapManager2.h @@ -103,7 +103,7 @@ namespace VMAP bool getAreaInfo(unsigned int pMapId, float x, float y, float& z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const; bool GetLiquidLevel(uint32 pMapId, float x, float y, float z, uint8 reqLiquidType, float& level, float& floor, uint32& type) const; - WorldModel* acquireModelInstance(const std::string& basepath, const std::string& filename, uint32 flags = 0); + WorldModel* acquireModelInstance(const std::string& basepath, const std::string& filename); void releaseModelInstance(const std::string& filename); // what's the use of this? o.O diff --git a/src/server/collision/Maps/MapTree.cpp b/src/server/collision/Maps/MapTree.cpp index f94f9bbf52b..f4a3f1c7b30 100644 --- a/src/server/collision/Maps/MapTree.cpp +++ b/src/server/collision/Maps/MapTree.cpp @@ -309,7 +309,7 @@ namespace VMAP #endif if (!iIsTiled && ModelSpawn::readFromFile(rf, spawn)) { - WorldModel* model = vm->acquireModelInstance(iBasePath, spawn.name, spawn.flags); + WorldModel* model = vm->acquireModelInstance(iBasePath, spawn.name); sLog->outDebug(LOG_FILTER_MAPS, "StaticMapTree::InitMap() : loading %s", spawn.name.c_str()); if (model) { @@ -380,7 +380,7 @@ namespace VMAP if (result) { // acquire model instance - WorldModel* model = vm->acquireModelInstance(iBasePath, spawn.name, spawn.flags); + WorldModel* model = vm->acquireModelInstance(iBasePath, spawn.name); if (!model) sLog->outError("StaticMapTree::LoadMapTile() : could not acquire WorldModel pointer [%u, %u]", tileX, tileY); diff --git a/src/server/collision/Maps/TileAssembler.cpp b/src/server/collision/Maps/TileAssembler.cpp index 68ea3ec80cd..e7693a70de4 100644 --- a/src/server/collision/Maps/TileAssembler.cpp +++ b/src/server/collision/Maps/TileAssembler.cpp @@ -335,7 +335,7 @@ namespace VMAP void TileAssembler::exportGameobjectModels() { - FILE* model_list = fopen((iSrcDir + "/" + GAMEOBJECT_MODELS).c_str(), "rb"); + FILE* model_list = fopen((iSrcDir + "/" + "temp_gameobject_models").c_str(), "rb"); FILE* model_list_copy = fopen((iDestDir + "/" + GAMEOBJECT_MODELS).c_str(), "wb"); if (!model_list || !model_list_copy) return; diff --git a/src/server/collision/Models/GameObjectModel.cpp b/src/server/collision/Models/GameObjectModel.cpp index 1abbc59a5b0..84c736c22e8 100644 --- a/src/server/collision/Models/GameObjectModel.cpp +++ b/src/server/collision/Models/GameObjectModel.cpp @@ -33,6 +33,8 @@ using G3D::Vector3; using G3D::Ray; using G3D::AABox; +#ifndef NO_CORE_FUNCS + struct GameobjectModelData { GameobjectModelData(const std::string& name_, const AABox& box) : @@ -47,23 +49,30 @@ ModelList model_list; void LoadGameObjectModelList() { + uint32 oldMSTime = getMSTime(); FILE* model_list_file = fopen((sWorld->GetDataPath() + "vmaps/" + VMAP::GAMEOBJECT_MODELS).c_str(), "rb"); if (!model_list_file) + { + sLog->outError("Unable to open '%s' file.", VMAP::GAMEOBJECT_MODELS); return; + } uint32 name_length, displayId; char buff[500]; - while (!feof(model_list_file)) + while (true) { Vector3 v1, v2; - if (fread(&displayId, sizeof(uint32), 1, model_list_file) != 1 - || fread(&name_length, sizeof(uint32), 1, model_list_file) != 1 + if (fread(&displayId, sizeof(uint32), 1, model_list_file) != 1) + if (feof(model_list_file)) // EOF flag is only set after failed reading attempt + break; + + if (fread(&name_length, sizeof(uint32), 1, model_list_file) != 1 || name_length >= sizeof(buff) || fread(&buff, sizeof(char), name_length, model_list_file) != name_length || fread(&v1, sizeof(Vector3), 1, model_list_file) != 1 || fread(&v2, sizeof(Vector3), 1, model_list_file) != 1) { - printf("\nFile '%s' seems to be corrupted", VMAP::GAMEOBJECT_MODELS); + sLog->outError("File '%s' seems to be corrupted!", VMAP::GAMEOBJECT_MODELS); break; } @@ -72,7 +81,10 @@ void LoadGameObjectModelList() ModelList::value_type( displayId, GameobjectModelData(std::string(buff,name_length),AABox(v1,v2)) ) ); } + fclose(model_list_file); + sLog->outString(">> Loaded %u GameObject models in %u ms", uint32(model_list.size()), GetMSTimeDiffToNow(oldMSTime)); + sLog->outString(); } GameObjectModel::~GameObjectModel() @@ -91,7 +103,7 @@ bool GameObjectModel::initialize(const GameObject& go, const GameObjectDisplayIn // ignore models with no bounds if (mdl_box == G3D::AABox::zero()) { - std::cout << "Model " << it->second.name << " has zero bounds, loading skipped" << std::endl; + sLog->outError("GameObject model %s has zero bounds, loading skipped", it->second.name.c_str()); return false; } @@ -171,3 +183,5 @@ bool GameObjectModel::intersectRay(const G3D::Ray& ray, float& MaxDist, bool Sto } return hit; } + +#endif diff --git a/src/server/collision/Models/WorldModel.cpp b/src/server/collision/Models/WorldModel.cpp index cda34510058..b818232fb32 100644 --- a/src/server/collision/Models/WorldModel.cpp +++ b/src/server/collision/Models/WorldModel.cpp @@ -392,9 +392,8 @@ namespace VMAP uint32 GroupModel::GetLiquidType() const { - // convert to type mask, matching MAP_LIQUID_TYPE_* defines in Map.h if (iLiquid) - return (1 << iLiquid->GetType()); + return iLiquid->GetType(); return 0; } @@ -421,9 +420,6 @@ namespace VMAP bool WorldModel::IntersectRay(const G3D::Ray &ray, float &distance, bool stopAtFirstHit) const { - // M2 models are not taken into account for LoS calculation - if (Flags & MOD_M2) - return false; // small M2 workaround, maybe better make separate class with virtual intersection funcs // in any case, there's no need to use a bound tree if we only have one submodel if (groupModels.size() == 1) diff --git a/src/server/collision/Models/WorldModel.h b/src/server/collision/Models/WorldModel.h index dbaccb58573..ebf828e4935 100755 --- a/src/server/collision/Models/WorldModel.h +++ b/src/server/collision/Models/WorldModel.h @@ -113,7 +113,6 @@ namespace VMAP bool GetLocationInfo(const G3D::Vector3 &p, const G3D::Vector3 &down, float &dist, LocationInfo &info) const; bool writeFile(const std::string &filename); bool readFile(const std::string &filename); - uint32 Flags; protected: uint32 RootWMOID; std::vector<GroupModel> groupModels; diff --git a/src/server/collision/VMapDefinitions.h b/src/server/collision/VMapDefinitions.h index 72a62807b4c..cc796d96dd5 100644 --- a/src/server/collision/VMapDefinitions.h +++ b/src/server/collision/VMapDefinitions.h @@ -24,9 +24,9 @@ namespace VMAP { - const char VMAP_MAGIC[] = "VMAP_4.0"; - const char RAW_VMAP_MAGIC[] = "VMAP004"; // used in extracted vmap files with raw data - const char GAMEOBJECT_MODELS[] = "temp_gameobject_models"; + const char VMAP_MAGIC[] = "VMAP_4.1"; + const char RAW_VMAP_MAGIC[] = "VMAP041"; // used in extracted vmap files with raw data + const char GAMEOBJECT_MODELS[] = "GameObjectModels.dtree"; // defined in TileAssembler.cpp currently... bool readChunk(FILE* rf, char *dest, const char *compare, uint32 len); diff --git a/src/server/game/AI/CoreAI/GameObjectAI.h b/src/server/game/AI/CoreAI/GameObjectAI.h index b9d385ba675..f4555649210 100644 --- a/src/server/game/AI/CoreAI/GameObjectAI.h +++ b/src/server/game/AI/CoreAI/GameObjectAI.h @@ -33,21 +33,24 @@ class GameObjectAI explicit GameObjectAI(GameObject* g) : go(g) {} virtual ~GameObjectAI() {} - virtual void UpdateAI(const uint32 /*diff*/) {} + virtual void UpdateAI(uint32 /*diff*/) {} virtual void InitializeAI() { Reset(); } virtual void Reset() {}; - static int Permissible(const GameObject* go); + static int Permissible(GameObject const* go); - virtual bool GossipHello(Player* /*player*/) {return false;} - virtual bool GossipSelect(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/) {return false;} - virtual bool GossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/) {return false;} - virtual bool QuestAccept(Player* /*player*/, Quest const* /*quest*/) {return false;} - virtual bool QuestReward(Player* /*player*/, Quest const* /*quest*/, uint32 /*opt*/) {return false;} - virtual uint32 GetDialogStatus(Player* /*player*/) {return 100;} + virtual bool GossipHello(Player* /*player*/) { return false; } + virtual bool GossipSelect(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/) { return false; } + virtual bool GossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, char const* /*code*/) { return false; } + virtual bool QuestAccept(Player* /*player*/, Quest const* /*quest*/) { return false; } + virtual bool QuestReward(Player* /*player*/, Quest const* /*quest*/, uint32 /*opt*/) { return false; } + virtual uint32 GetDialogStatus(Player* /*player*/) { return 100; } virtual void Destroyed(Player* /*player*/, uint32 /*eventId*/) {} + virtual uint32 GetData(uint32 /*id*/) { return 0; } + virtual void SetData64(uint32 /*id*/, uint64 /*value*/) {} + virtual uint64 GetData64(uint32 /*id*/) { return 0; } virtual void SetData(uint32 /*id*/, uint32 /*value*/) {} virtual void OnGameEvent(bool /*start*/, uint16 /*eventId*/) {} virtual void OnStateChanged(uint32 /*state*/, Unit* /*unit*/) { } @@ -58,8 +61,8 @@ class NullGameObjectAI : public GameObjectAI public: explicit NullGameObjectAI(GameObject* g); - void UpdateAI(const uint32 /*diff*/) {} + void UpdateAI(uint32 /*diff*/) {} - static int Permissible(const GameObject* /*go*/) { return PERMIT_BASE_IDLE; } + static int Permissible(GameObject const* /*go*/) { return PERMIT_BASE_IDLE; } }; #endif diff --git a/src/server/game/AI/CoreAI/GuardAI.cpp b/src/server/game/AI/CoreAI/GuardAI.cpp index b78fec7c142..6e2326ca9d5 100755 --- a/src/server/game/AI/CoreAI/GuardAI.cpp +++ b/src/server/game/AI/CoreAI/GuardAI.cpp @@ -23,7 +23,7 @@ #include "World.h" #include "CreatureAIImpl.h" -int GuardAI::Permissible(const Creature* creature) +int GuardAI::Permissible(Creature const* creature) { if (creature->isGuard()) return PERMIT_BASE_SPECIAL; @@ -31,7 +31,7 @@ int GuardAI::Permissible(const Creature* creature) return PERMIT_BASE_NO; } -GuardAI::GuardAI(Creature* creature) : ScriptedAI(creature), i_victimGuid(0), i_state(STATE_NORMAL), i_tracker(TIME_INTERVAL_LOOK) +GuardAI::GuardAI(Creature* creature) : ScriptedAI(creature) { } @@ -40,108 +40,35 @@ bool GuardAI::CanSeeAlways(WorldObject const* obj) if (!obj->isType(TYPEMASK_UNIT)) return false; - std::list<HostileReference*> t_list = me->getThreatManager().getThreatList(); - for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) - { - if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) - if (unit == obj) - return true; - } + std::list<HostileReference*> threatList = me->getThreatManager().getThreatList(); + for (std::list<HostileReference*>::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr) + if ((*itr)->getUnitGuid() == obj->GetGUID()) + return true; return false; } -void GuardAI::MoveInLineOfSight(Unit* unit) -{ - // Ignore Z for flying creatures - if (!me->canFly() && me->GetDistanceZ(unit) > CREATURE_Z_ATTACK_RANGE) - return; - - if (!me->getVictim() && me->IsValidAttackTarget(unit) && - (unit->IsHostileToPlayers() || me->IsHostileTo(unit)) && - unit->isInAccessiblePlaceFor(me)) - { - float attackRadius = me->GetAttackDistance(unit); - if (me->IsWithinDistInMap(unit, attackRadius)) - { - //Need add code to let guard support player - AttackStart(unit); - //u->RemoveAurasByType(SPELL_AURA_MOD_STEALTH); - } - } -} - void GuardAI::EnterEvadeMode() { if (!me->isAlive()) { - sLog->outStaticDebug("Creature stopped attacking because he is dead [guid=%u]", me->GetGUIDLow()); me->GetMotionMaster()->MoveIdle(); - - i_state = STATE_NORMAL; - - i_victimGuid = 0; me->CombatStop(true); me->DeleteThreatList(); return; } - Unit* victim = ObjectAccessor::GetUnit(*me, i_victimGuid); - - if (!victim) - { - sLog->outStaticDebug("Creature stopped attacking because victim does not exist [guid=%u]", me->GetGUIDLow()); - } - else if (!victim ->isAlive()) - { - sLog->outStaticDebug("Creature stopped attacking because victim is dead [guid=%u]", me->GetGUIDLow()); - } - else if (victim ->HasStealthAura()) - { - sLog->outStaticDebug("Creature stopped attacking because victim is using stealth [guid=%u]", me->GetGUIDLow()); - } - else if (victim ->isInFlight()) - { - sLog->outStaticDebug("Creature stopped attacking because victim is flying away [guid=%u]", me->GetGUIDLow()); - } - else - { - sLog->outStaticDebug("Creature stopped attacking because victim outran him [guid=%u]", me->GetGUIDLow()); - } + sLog->outDebug(LOG_FILTER_UNITS, "Guard entry: %u enters evade mode.", me->GetEntry()); me->RemoveAllAuras(); me->DeleteThreatList(); - i_victimGuid = 0; me->CombatStop(true); - i_state = STATE_NORMAL; // Remove ChaseMovementGenerator from MotionMaster stack list, and add HomeMovementGenerator instead if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE) me->GetMotionMaster()->MoveTargetedHome(); } -void GuardAI::UpdateAI(const uint32 /*diff*/) -{ - // update i_victimGuid if me->getVictim() !=0 and changed - if (!UpdateVictim()) - return; - - Unit* const victim = me->getVictim(); - if (!victim) - return; - - i_victimGuid = victim->GetGUID(); - - if (me->isAttackReady()) - { - if (me->IsWithinMeleeRange(victim)) - { - me->AttackerStateUpdate(victim); - me->resetAttackTimer(); - } - } -} - void GuardAI::JustDied(Unit* killer) { if (Player* player = killer->GetCharmerOrOwnerPlayerOrPlayerItself()) diff --git a/src/server/game/AI/CoreAI/GuardAI.h b/src/server/game/AI/CoreAI/GuardAI.h index c80c5a6c343..c8dd9d54921 100755 --- a/src/server/game/AI/CoreAI/GuardAI.h +++ b/src/server/game/AI/CoreAI/GuardAI.h @@ -20,34 +20,19 @@ #define TRINITY_GUARDAI_H #include "ScriptedCreature.h" -#include "Timer.h" class Creature; class GuardAI : public ScriptedAI { - enum GuardState - { - STATE_NORMAL = 1, - STATE_LOOK_AT_VICTIM = 2 - }; - public: + explicit GuardAI(Creature* creature); - explicit GuardAI(Creature* c); - - void MoveInLineOfSight(Unit*); - void EnterEvadeMode(); - void JustDied(Unit*); + static int Permissible(Creature const* creature); bool CanSeeAlways(WorldObject const* obj); - void UpdateAI(const uint32); - static int Permissible(const Creature*); - - private: - uint64 i_victimGuid; - GuardState i_state; - TimeTracker i_tracker; + void EnterEvadeMode(); + void JustDied(Unit* killer); }; #endif diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index 30ebd06745f..160b406a6ea 100755 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -109,17 +109,25 @@ void PetAI::UpdateAI(const uint32 diff) } else if (owner && me->GetCharmInfo()) //no victim { - Unit* nextTarget = SelectNextTarget(); + // Only aggressive pets do target search every update. + // Defensive pets do target search only in these cases: + // * Owner attacks something - handled by OwnerAttacked() + // * Owner receives damage - handled by OwnerDamagedBy() + // * Pet is in combat and current target dies - handled by KilledUnit() + if (me->HasReactState(REACT_AGGRESSIVE)) + { + Unit* nextTarget = SelectNextTarget(); - if (me->HasReactState(REACT_PASSIVE)) - _stopAttack(); - else if (nextTarget) - AttackStart(nextTarget); + if (nextTarget) + AttackStart(nextTarget); + else + HandleReturnMovement(); + } else HandleReturnMovement(); } else if (owner && !me->HasUnitState(UNIT_STATE_FOLLOW)) // no charm info and no victim - me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle()); + HandleReturnMovement(); if (!me->GetCharmInfo()) return; @@ -145,40 +153,56 @@ void PetAI::UpdateAI(const uint32 diff) if (spellInfo->IsPositive()) { - // non combat spells allowed - // only pet spells have IsNonCombatSpell and not fit this reqs: - // Consume Shadows, Lesser Invisibility, so ignore checks for its if (spellInfo->CanBeUsedInCombat()) { - // allow only spell without spell cost or with spell cost but not duration limit - int32 duration = spellInfo->GetDuration(); - if ((spellInfo->ManaCost || spellInfo->ManaCostPercentage || spellInfo->ManaPerSecond) && duration > 0) + // check spell cooldown + if (me->HasSpellCooldown(spellInfo->Id)) continue; - // allow only spell without cooldown > duration - int32 cooldown = spellInfo->GetRecoveryTime(); - if (cooldown >= 0 && duration >= 0 && cooldown > duration) + // Check if we're in combat or commanded to attack + if (!me->isInCombat() && !me->GetCharmInfo()->IsCommandAttack()) continue; } Spell* spell = new Spell(me, spellInfo, TRIGGERED_NONE, 0); - bool spellUsed = false; - for (std::set<uint64>::const_iterator tar = m_AllySet.begin(); tar != m_AllySet.end(); ++tar) - { - Unit* target = ObjectAccessor::GetUnit(*me, *tar); - //only buff targets that are in combat, unless the spell can only be cast while out of combat - if (!target) - continue; + // Some spells can target enemy or friendly (DK Ghoul's Leap) + // Check for enemy first (pet then owner) + Unit* target = me->getAttackerForHelper(); + if (!target && owner) + target = owner->getAttackerForHelper(); - if (spell->CanAutoCast(target)) + if (target) + { + if (CanAttack(target) && spell->CanAutoCast(target)) { - targetSpellStore.push_back(std::make_pair<Unit*, Spell*>(target, spell)); + targetSpellStore.push_back(std::make_pair(target, spell)); spellUsed = true; - break; } } + + // No enemy, check friendly + if (!spellUsed) + { + for (std::set<uint64>::const_iterator tar = m_AllySet.begin(); tar != m_AllySet.end(); ++tar) + { + Unit* ally = ObjectAccessor::GetUnit(*me, *tar); + + //only buff targets that are in combat, unless the spell can only be cast while out of combat + if (!ally) + continue; + + if (spell->CanAutoCast(ally)) + { + targetSpellStore.push_back(std::make_pair(ally, spell)); + spellUsed = true; + break; + } + } + } + + // No valid targets at all if (!spellUsed) delete spell; } @@ -186,7 +210,7 @@ void PetAI::UpdateAI(const uint32 diff) { Spell* spell = new Spell(me, spellInfo, TRIGGERED_NONE, 0); if (spell->CanAutoCast(me->getVictim())) - targetSpellStore.push_back(std::make_pair<Unit*, Spell*>(me->getVictim(), spell)); + targetSpellStore.push_back(std::make_pair(me->getVictim(), spell)); else delete spell; } @@ -278,6 +302,7 @@ void PetAI::KilledUnit(Unit* victim) // next target selection me->AttackStop(); me->GetCharmInfo()->SetIsCommandAttack(false); + me->SendMeleeAttackStop(); // Stops the pet's 'Attack' button from flashing Unit* nextTarget = SelectNextTarget(); @@ -301,6 +326,47 @@ void PetAI::AttackStart(Unit* target) DoAttack(target, true); } +void PetAI::OwnerDamagedBy(Unit* attacker) +{ + // Called when owner takes damage. Allows defensive pets to know + // that their owner might need help + + if (!attacker) + return; + + // Passive pets don't do anything + if (me->HasReactState(REACT_PASSIVE)) + return; + + // Prevent pet from disengaging from current target + if (me->getVictim() && me->getVictim()->isAlive()) + return; + + // Continue to evaluate and attack if necessary + AttackStart(attacker); +} + +void PetAI::OwnerAttacked(Unit* target) +{ + // Called when owner attacks something. Allows defensive pets to know + // that they need to assist + + // Target might be NULL if called from spell with invalid cast targets + if (!target) + return; + + // Passive pets don't do anything + if (me->HasReactState(REACT_PASSIVE)) + return; + + // Prevent pet from disengaging from current target + if (me->getVictim() && me->getVictim()->isAlive()) + return; + + // Continue to evaluate and attack if necessary + AttackStart(target); +} + Unit* PetAI::SelectNextTarget() { // Provides next target selection after current target death @@ -457,7 +523,7 @@ bool PetAI::CanAttack(Unit* target) // Stay - can attack if target is within range or commanded to if (me->GetCharmInfo()->HasCommandState(COMMAND_STAY)) - return (me->IsWithinMeleeRange(target, MIN_MELEE_REACH) || me->GetCharmInfo()->IsCommandAttack()); + return (me->IsWithinMeleeRange(target, MELEE_RANGE) || me->GetCharmInfo()->IsCommandAttack()); // Follow if (me->GetCharmInfo()->HasCommandState(COMMAND_FOLLOW)) diff --git a/src/server/game/AI/CoreAI/PetAI.h b/src/server/game/AI/CoreAI/PetAI.h index 730ab12a3ca..ed3e2305556 100755 --- a/src/server/game/AI/CoreAI/PetAI.h +++ b/src/server/game/AI/CoreAI/PetAI.h @@ -40,6 +40,8 @@ class PetAI : public CreatureAI void KilledUnit(Unit* /*victim*/); void AttackStart(Unit* target); void MovementInform(uint32 moveType, uint32 data); + void OwnerDamagedBy(Unit* attacker); + void OwnerAttacked(Unit* target); private: bool _isVisible(Unit*) const; diff --git a/src/server/game/AI/CoreAI/TotemAI.cpp b/src/server/game/AI/CoreAI/TotemAI.cpp index 0739b62b605..d12d3c098e8 100755 --- a/src/server/game/AI/CoreAI/TotemAI.cpp +++ b/src/server/game/AI/CoreAI/TotemAI.cpp @@ -27,8 +27,7 @@ #include "GridNotifiersImpl.h" #include "CellImpl.h" -int -TotemAI::Permissible(const Creature* creature) +int TotemAI::Permissible(Creature const* creature) { if (creature->isTotem()) return PERMIT_BASE_PROACTIVE; @@ -41,8 +40,7 @@ TotemAI::TotemAI(Creature* c) : CreatureAI(c), i_victimGuid(0) ASSERT(c->isTotem()); } -void -TotemAI::MoveInLineOfSight(Unit*) +void TotemAI::MoveInLineOfSight(Unit* /*who*/) { } @@ -51,10 +49,9 @@ void TotemAI::EnterEvadeMode() me->CombatStop(true); } -void -TotemAI::UpdateAI(const uint32 /*diff*/) +void TotemAI::UpdateAI(uint32 const /*diff*/) { - if (me->ToTotem()->GetTotemType() != TOTEM_ACTIVE) + if (me->ToTotem()->GetTotemType() != TOTEM_ACTIVE) return; if (!me->isAlive() || me->IsNonMeleeSpellCasted(false)) @@ -98,8 +95,7 @@ TotemAI::UpdateAI(const uint32 /*diff*/) i_victimGuid = 0; } -void -TotemAI::AttackStart(Unit*) +void TotemAI::AttackStart(Unit* /*victim*/) { // Sentry totem sends ping on attack if (me->GetEntry() == SENTRY_TOTEM_ENTRY && me->GetOwner()->GetTypeId() == TYPEID_PLAYER) diff --git a/src/server/game/AI/CoreAI/TotemAI.h b/src/server/game/AI/CoreAI/TotemAI.h index 0fa2920888f..f0d705345ef 100755 --- a/src/server/game/AI/CoreAI/TotemAI.h +++ b/src/server/game/AI/CoreAI/TotemAI.h @@ -31,12 +31,12 @@ class TotemAI : public CreatureAI explicit TotemAI(Creature* c); - void MoveInLineOfSight(Unit*); - void AttackStart(Unit*); + void MoveInLineOfSight(Unit* who); + void AttackStart(Unit* victim); void EnterEvadeMode(); - void UpdateAI(const uint32); - static int Permissible(const Creature*); + void UpdateAI(uint32 const diff); + static int Permissible(Creature const* creature); private: uint64 i_victimGuid; diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h index b871a25835b..593f0d15e18 100755 --- a/src/server/game/AI/CoreAI/UnitAI.h +++ b/src/server/game/AI/CoreAI/UnitAI.h @@ -223,7 +223,7 @@ class UnitAI targetList.reverse(); if (targetType == SELECT_TARGET_RANDOM) - Trinity::RandomResizeList(targetList, maxTargets); + Trinity::Containers::RandomResizeList(targetList, maxTargets); else targetList.resize(maxTargets); } diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index c8818f84e5b..9c236cbd039 100755 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -25,6 +25,7 @@ #include "Log.h" #include "MapReference.h" #include "Player.h" +#include "CreatureTextMgr.h" //Disable CreatureAI when charmed void CreatureAI::OnCharmed(bool /*apply*/) diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h index dafd3e4e137..94ac452b9f3 100755 --- a/src/server/game/AI/CreatureAI.h +++ b/src/server/game/AI/CreatureAI.h @@ -19,9 +19,9 @@ #ifndef TRINITY_CREATUREAI_H #define TRINITY_CREATUREAI_H +#include "Creature.h" #include "UnitAI.h" #include "Common.h" -#include "CreatureTextMgr.h" class WorldObject; class Unit; @@ -138,6 +138,12 @@ class CreatureAI : public UnitAI // Called at text emote receive from player virtual void ReceiveEmote(Player* /*player*/, uint32 /*emoteId*/) {} + // Called when owner takes damage + virtual void OwnerDamagedBy(Unit* /*attacker*/) {} + + // Called when owner attacks something + virtual void OwnerAttacked(Unit* /*target*/) {} + /// == Triggered Actions Requested ================== // Called when creature attack expected (if creature can and no have current victim) diff --git a/src/server/game/AI/CreatureAIImpl.h b/src/server/game/AI/CreatureAIImpl.h index f568da80b49..d097adf38ec 100755 --- a/src/server/game/AI/CreatureAIImpl.h +++ b/src/server/game/AI/CreatureAIImpl.h @@ -326,11 +326,15 @@ class EventMap : private std::map<uint32, uint32> uint32 GetPhaseMask() const { return (_phase >> 24) & 0xFF; } + bool Empty() const { return empty(); } + // Sets event phase, must be in range 1 - 8 void SetPhase(uint32 phase) { if (phase && phase < 8) _phase = (1 << (phase + 24)); + else if (!phase) + _phase = 0; } // Creates new event entry in map with given id, time, group if given (1 - 8) and phase if given (1 - 8) @@ -604,6 +608,7 @@ inline void UnitAI::DoCast(Unit* victim, uint32 spellId, bool triggered) inline void UnitAI::DoCastVictim(uint32 spellId, bool triggered) { + // Why don't we check for casting unit_state and existing target as we do in DoCast(.. ? me->CastSpell(me->getVictim(), spellId, triggered); } diff --git a/src/server/game/AI/CreatureAISelector.cpp b/src/server/game/AI/CreatureAISelector.cpp index ab616d78a8c..1a0c6652e74 100755 --- a/src/server/game/AI/CreatureAISelector.cpp +++ b/src/server/game/AI/CreatureAISelector.cpp @@ -82,7 +82,7 @@ namespace FactorySelector { const CreatureAICreator* factory = iter->second; const SelectableAI* p = dynamic_cast<const SelectableAI*>(factory); - ASSERT(p != NULL); + ASSERT(p); int val = p->Permit(creature); if (val > best_val) { @@ -102,7 +102,7 @@ namespace FactorySelector MovementGenerator* selectMovementGenerator(Creature* creature) { MovementGeneratorRegistry& mv_registry(*MovementGeneratorRepository::instance()); - ASSERT(creature->GetCreatureInfo() != NULL); + ASSERT(creature->GetCreatureTemplate()); const MovementGeneratorCreator* mv_factory = mv_registry.GetRegistryItem(creature->GetDefaultMovementType()); /* if (mv_factory == NULL) @@ -133,6 +133,9 @@ namespace FactorySelector const GameObjectAICreator* ai_factory = NULL; GameObjectAIRegistry& ai_registry(*GameObjectAIRepository::instance()); + if (GameObjectAI* scriptedAI = sScriptMgr->GetGameObjectAI(go)) + return scriptedAI; + ai_factory = ai_registry.GetRegistryItem(go->GetAIName()); //future goAI types go here diff --git a/src/server/game/AI/EventAI/CreatureEventAI.cpp b/src/server/game/AI/EventAI/CreatureEventAI.cpp index bc1903257b7..9745b7185d9 100755 --- a/src/server/game/AI/EventAI/CreatureEventAI.cpp +++ b/src/server/game/AI/EventAI/CreatureEventAI.cpp @@ -95,7 +95,7 @@ CreatureEventAI::CreatureEventAI(Creature* c) : CreatureAI(c) m_AttackDistance = 0.0f; m_AttackAngle = 0.0f; - m_InvinceabilityHpLevel = 0; + m_InvincibilityHpLevel = 0; //Handle Spawned Events if (!m_bEmptyList) @@ -816,9 +816,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 case ACTION_T_SET_INVINCIBILITY_HP_LEVEL: { if (action.invincibility_hp_level.is_percent) - m_InvinceabilityHpLevel = me->CountPctFromMaxHealth(action.invincibility_hp_level.hp_level); + m_InvincibilityHpLevel = me->CountPctFromMaxHealth(action.invincibility_hp_level.hp_level); else - m_InvinceabilityHpLevel = action.invincibility_hp_level.hp_level; + m_InvincibilityHpLevel = action.invincibility_hp_level.hp_level; break; } case ACTION_T_MOUNT_TO_ENTRY_OR_MODEL: @@ -1107,7 +1107,7 @@ void CreatureEventAI::UpdateAI(const uint32 diff) break; case EVENT_T_RANGE: if (me->getVictim()) - if (me->IsInMap(me->getVictim())) + if (me->IsInMap(me->getVictim()) && me->InSamePhase(me->getVictim())) if (me->IsInRange(me->getVictim(), (float)(*i).Event.range.minDist, (float)(*i).Event.range.maxDist)) ProcessEvent(*i); break; @@ -1252,7 +1252,7 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* source, Unit* t if ((*i).second.SoundId) { - if (GetSoundEntriesStore()->LookupEntry((*i).second.SoundId)) + if (sSoundEntriesStore.LookupEntry((*i).second.SoundId)) source->PlayDirectSound((*i).second.SoundId); else sLog->outErrorDb("CreatureEventAI: DoScriptText entry %i tried to process invalid sound id %u.", textEntry, (*i).second.SoundId); @@ -1350,12 +1350,12 @@ void CreatureEventAI::ReceiveEmote(Player* player, uint32 textEmote) void CreatureEventAI::DamageTaken(Unit* /*done_by*/, uint32& damage) { - if (m_InvinceabilityHpLevel > 0 && me->GetHealth() < m_InvinceabilityHpLevel+damage) + if (m_InvincibilityHpLevel > 0 && me->GetHealth() < m_InvincibilityHpLevel+damage) { - if (me->GetHealth() <= m_InvinceabilityHpLevel) + if (me->GetHealth() <= m_InvincibilityHpLevel) damage = 0; else - damage = me->GetHealth() - m_InvinceabilityHpLevel; + damage = me->GetHealth() - m_InvincibilityHpLevel; } } diff --git a/src/server/game/AI/EventAI/CreatureEventAI.h b/src/server/game/AI/EventAI/CreatureEventAI.h index c4daf2563e0..3d2bcf888c8 100755 --- a/src/server/game/AI/EventAI/CreatureEventAI.h +++ b/src/server/game/AI/EventAI/CreatureEventAI.h @@ -641,6 +641,6 @@ class CreatureEventAI : public CreatureAI bool m_MeleeEnabled; // If we allow melee auto attack float m_AttackDistance; // Distance to attack from float m_AttackAngle; // Angle of attack - uint32 m_InvinceabilityHpLevel; // Minimal health level allowed at damage apply + uint32 m_InvincibilityHpLevel; // Minimal health level allowed at damage apply }; #endif diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp index add7b4db174..517e55af457 100755 --- a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp +++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp @@ -38,7 +38,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts() // Load EventAI Text sObjectMgr->LoadTrinityStrings("creature_ai_texts", MIN_CREATURE_AI_TEXT_STRING_ID, MAX_CREATURE_AI_TEXT_STRING_ID); - // Gather Additional data from EventAI Texts + // Gather Additional data from EventAI Texts 0 1 2 3 4 QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM creature_ai_texts"); if (!result) @@ -56,10 +56,10 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts() StringTextData temp; int32 i = fields[0].GetInt32(); - temp.SoundId = fields[1].GetInt32(); - temp.Type = fields[2].GetInt32(); - temp.Language = fields[3].GetInt32(); - temp.Emote = fields[4].GetInt32(); + temp.SoundId = fields[1].GetUInt32(); + temp.Type = fields[2].GetUInt8(); + temp.Language = fields[3].GetUInt8(); + temp.Emote = fields[4].GetUInt16(); // range negative if (i > MIN_CREATURE_AI_TEXT_STRING_ID || i <= MAX_CREATURE_AI_TEXT_STRING_ID) @@ -187,7 +187,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() temp.creature_id = fields[1].GetUInt32(); uint32 creature_id = temp.creature_id; - uint32 e_type = fields[2].GetUInt32(); + uint32 e_type = fields[2].GetUInt8(); //Report any errors in event if (e_type >= EVENT_T_END) { @@ -196,13 +196,13 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() } temp.event_type = EventAI_Type(e_type); - temp.event_inverse_phase_mask = fields[3].GetUInt32(); - temp.event_chance = fields[4].GetUInt8(); - temp.event_flags = fields[5].GetUInt8(); - temp.raw.param1 = fields[6].GetUInt32(); - temp.raw.param2 = fields[7].GetUInt32(); - temp.raw.param3 = fields[8].GetUInt32(); - temp.raw.param4 = fields[9].GetUInt32(); + temp.event_inverse_phase_mask = fields[3].GetInt32(); + temp.event_chance = fields[4].GetUInt32(); + temp.event_flags = fields[5].GetUInt32(); + temp.raw.param1 = fields[6].GetInt32(); + temp.raw.param2 = fields[7].GetInt32(); + temp.raw.param3 = fields[8].GetInt32(); + temp.raw.param4 = fields[9].GetInt32(); //Creature does not exist in database if (!sObjectMgr->GetCreatureTemplate(temp.creature_id)) @@ -399,7 +399,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() for (uint32 j = 0; j < MAX_ACTIONS; j++) { - uint16 action_type = fields[10+(j*4)].GetUInt16(); + uint16 action_type = fields[10+(j*4)].GetUInt8(); if (action_type >= ACTION_T_END) { sLog->outErrorDb("CreatureEventAI: Event %u Action %u has incorrect action type (%u), replace by ACTION_T_NONE.", i, j+1, action_type); @@ -410,9 +410,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() CreatureEventAI_Action& action = temp.action[j]; action.type = EventAI_ActionType(action_type); - action.raw.param1 = fields[11+(j*4)].GetUInt32(); - action.raw.param2 = fields[12+(j*4)].GetUInt32(); - action.raw.param3 = fields[13+(j*4)].GetUInt32(); + action.raw.param1 = fields[11+(j*4)].GetInt32(); + action.raw.param2 = fields[12+(j*4)].GetInt32(); + action.raw.param3 = fields[13+(j*4)].GetInt32(); //Report any errors in actions switch (action.type) diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index 78adc38a67d..55ce2451709 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -30,18 +30,6 @@ void SummonList::DoZoneInCombat(uint32 entry) } } -void SummonList::DoAction(uint32 entry, int32 info) -{ - for (iterator i = begin(); i != end();) - { - Creature* summon = Unit::GetCreature(*me, *i); - ++i; - if (summon && summon->IsAIEnabled - && (!entry || summon->GetEntry() == entry)) - summon->AI()->DoAction(info); - } -} - void SummonList::DespawnEntry(uint32 entry) { for (iterator i = begin(); i != end();) @@ -126,15 +114,7 @@ void ScriptedAI::UpdateAI(uint32 const /*diff*/) if (!UpdateVictim()) return; - if (me->isAttackReady()) - { - //If we are within range melee the target - if (me->IsWithinMeleeRange(me->getVictim())) - { - me->AttackerStateUpdate(me->getVictim()); - me->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } void ScriptedAI::DoStartMovement(Unit* victim, float distance, float angle) @@ -171,7 +151,7 @@ void ScriptedAI::DoPlaySoundToSet(WorldObject* source, uint32 soundId) if (!source) return; - if (!GetSoundEntriesStore()->LookupEntry(soundId)) + if (!sSoundEntriesStore.LookupEntry(soundId)) { sLog->outError("TSCR: Invalid soundId %u used in DoPlaySoundToSet (Source: TypeId %u, GUID %u)", soundId, source->GetTypeId(), source->GetGUIDLow()); return; @@ -189,11 +169,11 @@ SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mec { //No target so we can't cast if (!target) - return false; + return NULL; //Silenced so we can't cast if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED)) - return false; + return NULL; //Using the extended script system we first create a list of viable spells SpellInfo const* apSpell[CREATURE_MAX_SPELLS]; @@ -274,7 +254,7 @@ void ScriptedAI::DoResetThreat() for (std::list<HostileReference*>::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) { - Unit* unit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); + Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()); if (unit && DoGetThreat(unit)) DoModifyThreatPercent(unit, -100); @@ -309,14 +289,13 @@ void ScriptedAI::DoTeleportTo(const float position[4]) void ScriptedAI::DoTeleportPlayer(Unit* unit, float x, float y, float z, float o) { - if (!unit || unit->GetTypeId() != TYPEID_PLAYER) - { - if (unit) - sLog->outError("TSCR: Creature " UI64FMTD " (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: " UI64FMTD ") to x: %f y:%f z: %f o: %f. Aborted.", me->GetGUID(), me->GetEntry(), unit->GetTypeId(), unit->GetGUID(), x, y, z, o); + if (!unit) return; - } - CAST_PLR(unit)->TeleportTo(unit->GetMapId(), x, y, z, o, TELE_TO_NOT_LEAVE_COMBAT); + if (Player* player = unit->ToPlayer()) + player->TeleportTo(unit->GetMapId(), x, y, z, o, TELE_TO_NOT_LEAVE_COMBAT); + else + sLog->outError("TSCR: Creature " UI64FMTD " (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: " UI64FMTD ") to x: %f y:%f z: %f o: %f. Aborted.", me->GetGUID(), me->GetEntry(), unit->GetTypeId(), unit->GetGUID(), x, y, z, o); } void ScriptedAI::DoTeleportAll(float x, float y, float z, float o) diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h index a01c993cab6..4fac8b3cba5 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h @@ -38,7 +38,18 @@ class SummonList : public std::list<uint64> void Despawn(Creature* summon) { remove(summon->GetGUID()); } void DespawnEntry(uint32 entry); void DespawnAll(); - void DoAction(uint32 entry, int32 info); + + template <class Predicate> void DoAction(int32 info, Predicate& predicate, uint16 max = 0) + { + Trinity::Containers::RandomResizeList<uint64, Predicate>(*this, predicate, max); + for (iterator i = begin(); i != end(); ) + { + Creature* summon = Unit::GetCreature(*me, *i++); + if (summon && summon->IsAIEnabled) + summon->AI()->DoAction(info); + } + } + void DoZoneInCombat(uint32 entry = 0); void RemoveNotExisting(); bool HasEntry(uint32 entry); @@ -46,6 +57,22 @@ class SummonList : public std::list<uint64> Creature* me; }; +class EntryCheckPredicate +{ + public: + EntryCheckPredicate(uint32 entry) : _entry(entry) {} + bool operator()(uint64 guid) { return GUID_ENPART(guid) == _entry; } + + private: + uint32 _entry; +}; + +class DummyEntryCheckPredicate +{ + public: + bool operator()(uint64) { return true; } +}; + struct ScriptedAI : public CreatureAI { explicit ScriptedAI(Creature* creature); diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index 048cc8b3d68..2243734f642 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -57,7 +57,7 @@ bool npc_escortAI::AssistPlayerInCombat(Unit* who) return false; //experimental (unknown) flag not present - if (!(me->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_AID_PLAYERS)) + if (!(me->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_AID_PLAYERS)) return false; //not a player @@ -95,7 +95,7 @@ void npc_escortAI::MoveInLineOfSight(Unit* who) if (HasEscortState(STATE_ESCORT_ESCORTING) && AssistPlayerInCombat(who)) return; - if (!me->canFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) + if (!me->CanFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) return; if (me->IsHostileTo(who)) @@ -150,7 +150,7 @@ void npc_escortAI::JustRespawned() //add a small delay before going to first waypoint, normal in near all cases m_uiWPWaitTimer = 2500; - if (me->getFaction() != me->GetCreatureInfo()->faction_A) + if (me->getFaction() != me->GetCreatureTemplate()->faction_A) me->RestoreFaction(); Reset(); @@ -307,11 +307,7 @@ void npc_escortAI::MovementInform(uint32 moveType, uint32 pointId) { sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI has returned to original position before combat"); - if (m_bIsRunning && me->HasUnitMovementFlag(MOVEMENTFLAG_WALKING)) - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - else if (!m_bIsRunning && !me->HasUnitMovementFlag(MOVEMENTFLAG_WALKING)) - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - + me->SetWalk(!m_bIsRunning); RemoveEscortState(STATE_ESCORT_RETURNING); if (!m_uiWPWaitTimer) @@ -387,7 +383,7 @@ void npc_escortAI::FillPointMovementListForCreature() if (movePoints.empty()) return; - ScriptPointVector::const_iterator itrEnd = movePoints.end();; + ScriptPointVector::const_iterator itrEnd = movePoints.end(); for (ScriptPointVector::const_iterator itr = movePoints.begin(); itr != itrEnd; ++itr) { Escort_Waypoint point(itr->uiPointId, itr->fX, itr->fY, itr->fZ, itr->uiWaitTime); @@ -400,14 +396,14 @@ void npc_escortAI::SetRun(bool on) if (on) { if (!m_bIsRunning) - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(false); else sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI attempt to set run mode, but is already running."); } else { if (m_bIsRunning) - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(true); else sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI attempt to set walk mode, but is already walking."); } @@ -473,9 +469,9 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false //Set initial speed if (m_bIsRunning) - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(false); else - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(true); AddEscortState(STATE_ESCORT_ESCORTING); } diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp index d83ad9b756c..13bbbe2c338 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp @@ -55,7 +55,7 @@ bool FollowerAI::AssistPlayerInCombat(Unit* who) return false; //experimental (unknown) flag not present - if (!(me->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_AID_PLAYERS)) + if (!(me->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_AID_PLAYERS)) return false; //not a player @@ -93,7 +93,7 @@ void FollowerAI::MoveInLineOfSight(Unit* who) if (HasFollowState(STATE_FOLLOW_INPROGRESS) && AssistPlayerInCombat(who)) return; - if (!me->canFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) + if (!me->CanFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) return; if (me->IsHostileTo(who)) @@ -150,8 +150,8 @@ void FollowerAI::JustRespawned() if (!IsCombatMovementAllowed()) SetCombatMovement(true); - if (me->getFaction() != me->GetCreatureInfo()->faction_A) - me->setFaction(me->GetCreatureInfo()->faction_A); + if (me->getFaction() != me->GetCreatureTemplate()->faction_A) + me->setFaction(me->GetCreatureTemplate()->faction_A); Reset(); } diff --git a/src/server/game/AI/ScriptedAI/ScriptedSimpleAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedSimpleAI.cpp deleted file mode 100755 index 25c7f6f44b7..00000000000 --- a/src/server/game/AI/ScriptedAI/ScriptedSimpleAI.cpp +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> - * - * 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/>. - */ - -/* ScriptData -SDName: SimpleAI -SD%Complete: 100 -SDComment: Base Class for SimpleAI creatures -SDCategory: Creatures -EndScriptData */ - -#include "ScriptPCH.h" -#include "ScriptedSimpleAI.h" - -SimpleAI::SimpleAI(Creature* c) : ScriptedAI(c) -{ - //Clear all data - Aggro_TextId[0] = 0; - Aggro_TextId[1] = 0; - Aggro_TextId[2] = 0; - Aggro_Sound[0] = 0; - Aggro_Sound[1] = 0; - Aggro_Sound[2] = 0; - - Death_TextId[0] = 0; - Death_TextId[1] = 0; - Death_TextId[2] = 0; - Death_Sound[0] = 0; - Death_Sound[1] = 0; - Death_Sound[2] = 0; - Death_Spell = 0; - Death_Target_Type = 0; - - Kill_TextId[0] = 0; - Kill_TextId[1] = 0; - Kill_TextId[2] = 0; - Kill_Sound[0] = 0; - Kill_Sound[1] = 0; - Kill_Sound[2] = 0; - Kill_Spell = 0; - Kill_Target_Type = 0; - - memset(Spell, 0, sizeof(Spell)); - - EnterEvadeMode(); -} - -void SimpleAI::Reset() -{ -} - -void SimpleAI::EnterCombat(Unit* who) -{ - //Reset cast timers - if (Spell[0].First_Cast >= 0) - Spell_Timer[0] = Spell[0].First_Cast; - else Spell_Timer[0] = 1000; - if (Spell[1].First_Cast >= 0) - Spell_Timer[1] = Spell[1].First_Cast; - else Spell_Timer[1] = 1000; - if (Spell[2].First_Cast >= 0) - Spell_Timer[2] = Spell[2].First_Cast; - else Spell_Timer[2] = 1000; - if (Spell[3].First_Cast >= 0) - Spell_Timer[3] = Spell[3].First_Cast; - else Spell_Timer[3] = 1000; - if (Spell[4].First_Cast >= 0) - Spell_Timer[4] = Spell[4].First_Cast; - else Spell_Timer[4] = 1000; - if (Spell[5].First_Cast >= 0) - Spell_Timer[5] = Spell[5].First_Cast; - else Spell_Timer[5] = 1000; - if (Spell[6].First_Cast >= 0) - Spell_Timer[6] = Spell[6].First_Cast; - else Spell_Timer[6] = 1000; - if (Spell[7].First_Cast >= 0) - Spell_Timer[7] = Spell[7].First_Cast; - else Spell_Timer[7] = 1000; - if (Spell[8].First_Cast >= 0) - Spell_Timer[8] = Spell[8].First_Cast; - else Spell_Timer[8] = 1000; - if (Spell[9].First_Cast >= 0) - Spell_Timer[9] = Spell[9].First_Cast; - else Spell_Timer[9] = 1000; - - uint8 random_text = urand(0, 2); - - //Random text - if (Aggro_TextId[random_text]) - DoScriptText(Aggro_TextId[random_text], me, who); - - //Random sound - if (Aggro_Sound[random_text]) - DoPlaySoundToSet(me, Aggro_Sound[random_text]); -} - -void SimpleAI::KilledUnit(Unit* victim) -{ - uint8 random_text = urand(0, 2); - - //Random yell - if (Kill_TextId[random_text]) - DoScriptText(Kill_TextId[random_text], me, victim); - - //Random sound - if (Kill_Sound[random_text]) - DoPlaySoundToSet(me, Kill_Sound[random_text]); - - if (!Kill_Spell) - return; - - Unit* target = NULL; - - switch (Kill_Target_Type) - { - case CAST_SELF: - target = me; - break; - case CAST_HOSTILE_TARGET: - target = me->getVictim(); - break; - case CAST_HOSTILE_SECOND_AGGRO: - target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1); - break; - case CAST_HOSTILE_LAST_AGGRO: - target = SelectTarget(SELECT_TARGET_BOTTOMAGGRO, 0); - break; - case CAST_HOSTILE_RANDOM: - target = SelectTarget(SELECT_TARGET_RANDOM, 0); - break; - case CAST_KILLEDUNIT_VICTIM: - target = victim; - break; - } - - //Target is ok, cast a spell on it - if (target) - DoCast(target, Kill_Spell); -} - -void SimpleAI::DamageTaken(Unit* killer, uint32& damage) -{ - //Return if damage taken won't kill us - if (me->GetHealth() > damage) - return; - - uint8 random_text = urand(0, 2); - - //Random yell - if (Death_TextId[random_text]) - DoScriptText(Death_TextId[random_text], me, killer); - - //Random sound - if (Death_Sound[random_text]) - DoPlaySoundToSet(me, Death_Sound[random_text]); - - if (!Death_Spell) - return; - - Unit* target = NULL; - - switch (Death_Target_Type) - { - case CAST_SELF: - target = me; - break; - case CAST_HOSTILE_TARGET: - target = me->getVictim(); - break; - case CAST_HOSTILE_SECOND_AGGRO: - target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1); - break; - case CAST_HOSTILE_LAST_AGGRO: - target = SelectTarget(SELECT_TARGET_BOTTOMAGGRO, 0); - break; - case CAST_HOSTILE_RANDOM: - target = SelectTarget(SELECT_TARGET_RANDOM, 0); - break; - case CAST_JUSTDIED_KILLER: - target = killer; - break; - } - - //Target is ok, cast a spell on it - if (target) - DoCast(target, Death_Spell); -} - -void SimpleAI::UpdateAI(const uint32 diff) -{ - //Return since we have no target - if (!UpdateVictim()) - return; - - //Spells - for (uint32 i = 0; i < MAX_SIMPLEAI_SPELLS; ++i) - { - //Spell not valid - if (!Spell[i].Enabled || !Spell[i].Spell_Id) - continue; - - if (Spell_Timer[i] <= diff) - { - //Check if this is a percentage based - if (Spell[i].First_Cast < 0 && Spell[i].First_Cast > -100 && HealthAbovePct(uint32(-Spell[i].First_Cast))) - continue; - - //Check Current spell - if (!(Spell[i].InterruptPreviousCast && me->IsNonMeleeSpellCasted(false))) - { - Unit* target = NULL; - - switch (Spell[i].Cast_Target_Type) - { - case CAST_SELF: - target = me; - break; - case CAST_HOSTILE_TARGET: - target = me->getVictim(); - break; - case CAST_HOSTILE_SECOND_AGGRO: - target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1); - break; - case CAST_HOSTILE_LAST_AGGRO: - target = SelectTarget(SELECT_TARGET_BOTTOMAGGRO, 0); - break; - case CAST_HOSTILE_RANDOM: - target = SelectTarget(SELECT_TARGET_RANDOM, 0); - break; - } - - //Target is ok, cast a spell on it and then do our random yell - if (target) - { - if (me->IsNonMeleeSpellCasted(false)) - me->InterruptNonMeleeSpells(false); - - DoCast(target, Spell[i].Spell_Id); - - //Yell and sound use the same number so that you can make - //the Creature yell with the correct sound effect attached - uint8 random_text = urand(0, 2); - - //Random yell - if (Spell[i].TextId[random_text]) - DoScriptText(Spell[i].TextId[random_text], me, target); - - //Random sound - if (Spell[i].Text_Sound[random_text]) - DoPlaySoundToSet(me, Spell[i].Text_Sound[random_text]); - } - - } - - //Spell will cast agian when the cooldown is up - if (Spell[i].CooldownRandomAddition) - Spell_Timer[i] = Spell[i].Cooldown + (rand() % Spell[i].CooldownRandomAddition); - else Spell_Timer[i] = Spell[i].Cooldown; - - } else Spell_Timer[i] -= diff; - - } - - DoMeleeAttackIfReady(); -} - diff --git a/src/server/game/AI/ScriptedAI/ScriptedSimpleAI.h b/src/server/game/AI/ScriptedAI/ScriptedSimpleAI.h deleted file mode 100644 index a38bdf85e14..00000000000 --- a/src/server/game/AI/ScriptedAI/ScriptedSimpleAI.h +++ /dev/null @@ -1,73 +0,0 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> -* This program is free software licensed under GPL version 2 -* Please see the included DOCS/LICENSE.TXT for more information */ - -#ifndef SC_SIMPLEAI_H -#define SC_SIMPLEAI_H - -enum CastTarget -{ - CAST_SELF = 0, //Self cast - CAST_HOSTILE_TARGET, //Our current target (ie: highest aggro) - CAST_HOSTILE_SECOND_AGGRO, //Second highest aggro (generaly used for cleaves and some special attacks) - CAST_HOSTILE_LAST_AGGRO, //Dead last on aggro (no idea what this could be used for) - CAST_HOSTILE_RANDOM, //Just any random target on our threat list - CAST_FRIENDLY_RANDOM, //NOT YET IMPLEMENTED - - //Special cases - CAST_KILLEDUNIT_VICTIM, //Only works within KilledUnit function - CAST_JUSTDIED_KILLER, //Only works within JustDied function -}; - -#define MAX_SIMPLEAI_SPELLS 10 - -struct SimpleAI : public ScriptedAI -{ - SimpleAI(Creature* c);// : ScriptedAI(c); - - void Reset(); - - void EnterCombat(Unit* /*who*/); - - void KilledUnit(Unit* /*victim*/); - - void DamageTaken(Unit* killer, uint32& damage); - - void UpdateAI(const uint32 diff); - -public: - - int32 Aggro_TextId[3]; - uint32 Aggro_Sound[3]; - - int32 Death_TextId[3]; - uint32 Death_Sound[3]; - uint32 Death_Spell; - uint32 Death_Target_Type; - - int32 Kill_TextId[3]; - uint32 Kill_Sound[3]; - uint32 Kill_Spell; - uint32 Kill_Target_Type; - - struct SimpleAI_Spell - { - uint32 Spell_Id; //Spell ID to cast - int32 First_Cast; //Delay for first cast - uint32 Cooldown; //Cooldown between casts - uint32 CooldownRandomAddition; //Random addition to cooldown (in range from 0 - CooldownRandomAddition) - uint32 Cast_Target_Type; //Target type (note that certain spells may ignore this) - bool InterruptPreviousCast; //Interrupt a previous cast if this spell needs to be cast - bool Enabled; //Spell enabled or disabled (default: false) - - //3 texts to many? - int32 TextId[3]; - uint32 Text_Sound[3]; - }Spell[MAX_SIMPLEAI_SPELLS]; - -protected: - uint32 Spell_Timer[MAX_SIMPLEAI_SPELLS]; -}; - -#endif - diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 7838e6891fe..08f1b18ffad 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -45,7 +45,7 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c) mCanRepeatPath = false; // spawn in run mode - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(false); mRun = false; me->GetPosition(&mLastOOCPos); @@ -68,12 +68,14 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c) mFollowCredit = 0; mFollowArrivedEntry = 0; mFollowCreditType = 0; - mInvinceabilityHpLevel = 0; + mInvincibilityHpLevel = 0; } void SmartAI::UpdateDespawn(const uint32 diff) { - if (mDespawnState <= 1 || mDespawnState > 3) return; + if (mDespawnState <= 1 || mDespawnState > 3) + return; + if (mDespawnTime < diff) { if (mDespawnState == 2) @@ -524,7 +526,7 @@ bool SmartAI::AssistPlayerInCombat(Unit* who) return false; //experimental (unknown) flag not present - if (!(me->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_AID_PLAYERS)) + if (!(me->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_AID_PLAYERS)) return false; //not a player @@ -561,7 +563,7 @@ void SmartAI::JustRespawned() mDespawnState = 0; mEscortState = SMART_ESCORT_NONE; me->SetVisible(true); - if (me->getFaction() != me->GetCreatureInfo()->faction_A) + if (me->getFaction() != me->GetCreatureTemplate()->faction_A) me->RestoreFaction(); GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN); Reset(); @@ -638,8 +640,8 @@ void SmartAI::SpellHitTarget(Unit* target, const SpellInfo* spellInfo) void SmartAI::DamageTaken(Unit* doneBy, uint32& damage) { GetScript()->ProcessEventsFor(SMART_EVENT_DAMAGED, doneBy, damage); - if ((me->GetHealth() - damage) <= mInvinceabilityHpLevel) - damage -= mInvinceabilityHpLevel; + if ((me->GetHealth() - damage) <= mInvincibilityHpLevel) + damage = me->GetHealth() - mInvincibilityHpLevel; } void SmartAI::HealReceived(Unit* doneBy, uint32& addhealth) @@ -720,26 +722,16 @@ uint64 SmartAI::GetGUID(int32 /*id*/) void SmartAI::SetRun(bool run) { if (run) - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(false); else - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(true); mRun = run; } void SmartAI::SetFly(bool fly) { - if (fly) - { - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, 0x01); - } - else - { - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, 0x01); - } - me->SetFlying(fly); + me->SetDisableGravity(fly); me->SendMovementFlagUpdate(); } @@ -812,12 +804,12 @@ void SmartAI::SetFollow(Unit* target, float dist, float angle, uint32 credit, ui return; SetRun(mRun); mFollowGuid = target->GetGUID(); - mFollowDist = dist ? dist : PET_FOLLOW_DIST; - mFollowAngle = angle ? angle : me->GetFollowAngle(); + mFollowDist = dist >= 0.0f ? dist : PET_FOLLOW_DIST; + mFollowAngle = angle >= 0.0f ? angle : me->GetFollowAngle(); mFollowArrivedTimer = 1000; mFollowCredit = credit; mFollowArrivedEntry = end; - me->GetMotionMaster()->MoveFollow(target, dist, angle); + me->GetMotionMaster()->MoveFollow(target, mFollowDist, mFollowAngle); mFollowCreditType = creditType; } @@ -862,7 +854,7 @@ int SmartGameObjectAI::Permissible(const GameObject* g) return PERMIT_BASE_NO; } -void SmartGameObjectAI::UpdateAI(const uint32 diff) +void SmartGameObjectAI::UpdateAI(uint32 diff) { GetScript()->OnUpdate(diff); } diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h index e82b35ec87a..435aa176d4d 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.h +++ b/src/server/game/AI/SmartScripts/SmartAI.h @@ -23,7 +23,6 @@ #include "CreatureAI.h" #include "Unit.h" #include "ConditionMgr.h" -#include "CreatureTextMgr.h" #include "Spell.h" #include "SmartScript.h" @@ -63,6 +62,7 @@ class SmartAI : public CreatureAI void RemoveEscortState(uint32 uiEscortState) { mEscortState &= ~uiEscortState; } void SetAutoAttack(bool on) { mCanAutoAttack = on; } void SetCombatMove(bool on); + bool CanCombatMove() { return mCanCombatMove; } void SetFollow(Unit* target, float dist = 0.0f, float angle = 0.0f, uint32 credit = 0, uint32 end = 0, uint32 creditType = 0); void SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker); @@ -175,7 +175,7 @@ class SmartAI : public CreatureAI void SetSwim(bool swim = true); - void SetInvinceabilityHpLevel(uint32 level) { mInvinceabilityHpLevel = level; } + void SetInvincibilityHpLevel(uint32 level) { mInvincibilityHpLevel = level; } void sGossipHello(Player* player); void sGossipSelect(Player* player, uint32 sender, uint32 action); @@ -224,8 +224,7 @@ class SmartAI : public CreatureAI bool mCanAutoAttack; bool mCanCombatMove; bool mForcedPaused; - uint32 mInvinceabilityHpLevel; - + uint32 mInvincibilityHpLevel; bool AssistPlayerInCombat(Unit* who); uint32 mDespawnTime; @@ -240,13 +239,13 @@ public: SmartGameObjectAI(GameObject* g) : GameObjectAI(g), go(g) {} ~SmartGameObjectAI() {} - void UpdateAI(const uint32 diff); + void UpdateAI(uint32 diff); void InitializeAI(); void Reset(); SmartScript* GetScript() { return &mScript; } static int Permissible(const GameObject* g); - bool GossipHello(Player* player) ; + bool GossipHello(Player* player); bool GossipSelect(Player* player, uint32 sender, uint32 action); bool GossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/); bool QuestAccept(Player* player, Quest const* quest); diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 67d26ea06dd..01a9b777358 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -33,6 +33,47 @@ #include "Group.h" #include "Vehicle.h" #include "ScriptedGossip.h" +#include "CreatureTextMgr.h" + +class TrinityStringTextBuilder +{ + public: + TrinityStringTextBuilder(WorldObject* obj, ChatMsg msgtype, int32 id, uint32 language, uint64 targetGUID) + : _source(obj), _msgType(msgtype), _textId(id), _language(language), _targetGUID(targetGUID) + { + } + + size_t operator()(WorldPacket* data, LocaleConstant locale) const + { + std::string text = sObjectMgr->GetTrinityString(_textId, locale); + char const* localizedName = _source->GetNameForLocaleIdx(locale); + + *data << uint8(_msgType); + *data << uint32(_language); + *data << uint64(_source->GetGUID()); + *data << uint32(1); // 2.1.0 + *data << uint32(strlen(localizedName)+1); + *data << localizedName; + size_t whisperGUIDpos = data->wpos(); + *data << uint64(_targetGUID); // Unit Target + if (_targetGUID && !IS_PLAYER_GUID(_targetGUID)) + { + *data << uint32(1); // target name length + *data << uint8(0); // target name + } + *data << uint32(text.length() + 1); + *data << text; + *data << uint8(0); // ChatTag + + return whisperGUIDpos; + } + + WorldObject* _source; + ChatMsg _msgType; + int32 _textId; + uint32 _language; + uint64 _targetGUID; +}; SmartScript::SmartScript() { @@ -67,8 +108,11 @@ void SmartScript::OnReset() ResetBaseObject(); for (SmartAIEventList::iterator i = mEvents.begin(); i != mEvents.end(); ++i) { - InitTimer((*i)); - (*i).runOnce = false; + if (!((*i).event.event_flags & SMART_EVENT_FLAG_DONT_RESET)) + { + InitTimer((*i)); + (*i).runOnce = false; + } } ProcessEventsFor(SMART_EVENT_RESET); mLastInvoker = 0; @@ -695,7 +739,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u me->DoFleeToGetAssistance(); if (e.action.flee.withEmote) - sCreatureTextMgr->SendChatString(me, sObjectMgr->GetTrinityStringForDBCLocale(LANG_FLEE), CHAT_MSG_MONSTER_EMOTE); + { + TrinityStringTextBuilder builder(me, CHAT_MSG_MONSTER_EMOTE, LANG_FLEE, LANG_UNIVERSAL, 0); + sCreatureTextMgr->SendChatPacket(me, builder, CHAT_MSG_MONSTER_EMOTE); + } sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_FLEE_FOR_ASSIST: Creature %u DoFleeToGetAssistance", me->GetGUIDLow()); break; } @@ -999,9 +1046,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u break; if (e.action.invincHP.percent) - ai->SetInvinceabilityHpLevel(me->CountPctFromMaxHealth(e.action.invincHP.percent)); + ai->SetInvincibilityHpLevel(me->CountPctFromMaxHealth(e.action.invincHP.percent)); else - ai->SetInvinceabilityHpLevel(e.action.invincHP.minHP); + ai->SetInvincibilityHpLevel(e.action.invincHP.minHP); break; } case SMART_ACTION_SET_DATA: @@ -1072,12 +1119,13 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { - if (!IsUnit(*itr)) - continue; - (*itr)->GetPosition(x, y, z, o); + x += e.target.x; + y += e.target.y; + z += e.target.z; + o += e.target.o; if (Creature* summon = GetBaseObject()->SummonCreature(e.action.summonCreature.creature, x, y, z, o, (TempSummonType)e.action.summonCreature.type, e.action.summonCreature.duration)) - if (unit && e.action.summonCreature.attackInvoker) + if (e.action.summonCreature.attackInvoker) summon->AI()->AttackStart((*itr)->ToUnit()); } @@ -1107,6 +1155,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u continue; (*itr)->GetPosition(x, y, z, o); + x += e.target.x; + y += e.target.y; + z += e.target.z; + o += e.target.o; GetBaseObject()->SummonGameObject(e.action.summonGO.entry, x, y, z, o, 0, 0, 0, 0, e.action.summonGO.despawnTime); } @@ -1320,19 +1372,20 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u e.GetTargetType() == SMART_TARGET_CREATURE_DISTANCE || e.GetTargetType() == SMART_TARGET_GAMEOBJECT_RANGE || e.GetTargetType() == SMART_TARGET_GAMEOBJECT_GUID || e.GetTargetType() == SMART_TARGET_GAMEOBJECT_DISTANCE || e.GetTargetType() == SMART_TARGET_CLOSEST_CREATURE || e.GetTargetType() == SMART_TARGET_CLOSEST_GAMEOBJECT || - e.GetTargetType() == SMART_TARGET_OWNER_OR_SUMMONER) + e.GetTargetType() == SMART_TARGET_OWNER_OR_SUMMONER || e.GetTargetType() == SMART_TARGET_ACTION_INVOKER) { ObjectList* targets = GetTargets(e, unit); if (!targets) break; target = targets->front(); + delete targets; } - if(!target) - me->GetMotionMaster()->MovePoint(0, e.target.x, e.target.y, e.target.z); + if (!target) + me->GetMotionMaster()->MovePoint(e.action.MoveToPos.pointId, e.target.x, e.target.y, e.target.z); else - me->GetMotionMaster()->MovePoint(0, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()); + me->GetMotionMaster()->MovePoint(e.action.MoveToPos.pointId, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()); break; } case SMART_ACTION_RESPAWN_TARGET: @@ -1481,6 +1534,27 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u case SMART_ACTION_CALL_SCRIPT_RESET: OnReset(); break; + case SMART_ACTION_SET_RANGED_MOVEMENT: + { + if (!IsSmart()) + break; + + float attackDistance = (float)e.action.setRangedMovement.distance; + float attackAngle = e.action.setRangedMovement.angle / 180.0f * M_PI; + + ObjectList* targets = GetTargets(e, unit); + if (targets) + { + for (ObjectList::iterator itr = targets->begin(); itr != targets->end(); ++itr) + if (Creature* target = (*itr)->ToCreature()) + if (IsSmart(target) && target->getVictim()) + if (CAST_AI(SmartAI, target->AI())->CanCombatMove()) + target->GetMotionMaster()->MoveChase(target->getVictim(), attackDistance, attackAngle); + + delete targets; + } + break; + } case SMART_ACTION_CALL_TIMED_ACTIONLIST: { if (e.GetTargetType() == SMART_TARGET_NONE) @@ -1817,19 +1891,26 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!targets) break; + ObjectList* storedTargets = GetTargetList(e.action.sendTargetToTarget.id); + if (!storedTargets) + { + delete targets; + return; + } + for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { if (IsCreature(*itr)) { if (SmartAI* ai = CAST_AI(SmartAI, (*itr)->ToCreature()->AI())) - ai->GetScript()->StoreTargetList(GetTargetList(e.action.sendTargetToTarget.id), e.action.sendTargetToTarget.id); + ai->GetScript()->StoreTargetList(new ObjectList(*storedTargets), e.action.sendTargetToTarget.id); // store a copy of target list else sLog->outErrorDb("SmartScript: Action target for SMART_ACTION_SEND_TARGET_TO_TARGET is not using SmartAI, skipping"); } else if (IsGameObject(*itr)) { if (SmartGameObjectAI* ai = CAST_AI(SmartGameObjectAI, (*itr)->ToGameObject()->AI())) - ai->GetScript()->StoreTargetList(GetTargetList(e.action.sendTargetToTarget.id), e.action.sendTargetToTarget.id); + ai->GetScript()->StoreTargetList(new ObjectList(*storedTargets), e.action.sendTargetToTarget.id); // store a copy of target list else sLog->outErrorDb("SmartScript: Action target for SMART_ACTION_SEND_TARGET_TO_TARGET is not using SmartGameObjectAI, skipping"); } @@ -1865,7 +1946,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u break; } default: - sLog->outErrorDb("SmartScript::ProcessAction: Unhandled Action type %u", e.GetActionType()); + sLog->outErrorDb("SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); break; } @@ -1909,7 +1990,8 @@ void SmartScript::InstallTemplate(SmartScriptHolder const& e) } case SMARTAI_TEMPLATE_CAGED_NPC_PART: { - if (!me) return; + if (!me) + return; //store cage as id1 AddEvent(SMART_EVENT_DATA_SET, 0, 0, 0, 0, 0, SMART_ACTION_STORE_TARGET_LIST, 1, 0, 0, 0, 0, 0, SMART_TARGET_CLOSEST_GAMEOBJECT, e.action.installTtemplate.param1, 10, 0, 0); @@ -1931,7 +2013,8 @@ void SmartScript::InstallTemplate(SmartScriptHolder const& e) } case SMARTAI_TEMPLATE_CAGED_GO_PART: { - if (!go) return; + if (!go) + return; //store hostage as id1 AddEvent(SMART_EVENT_GOSSIP_HELLO, 0, 0, 0, 0, 0, SMART_ACTION_STORE_TARGET_LIST, 1, 0, 0, 0, 0, 0, SMART_TARGET_CLOSEST_CREATURE, e.action.installTtemplate.param1, 10, 0, 0); //store invoker as id2 @@ -2794,8 +2877,12 @@ void SmartScript::InstallEvents() bool SmartScript::ConditionValid(Unit* u, int32 c, int32 v1, int32 v2, int32 v3) { - if (c == 0) return true; - if (!u || !u->ToPlayer()) return false; + if (c == 0) + return true; + + if (!u || !u->ToPlayer()) + return false; + Condition cond; cond.ConditionType = ConditionTypes(uint32(c)); cond.ConditionValue1 = uint32(v1); @@ -2962,7 +3049,9 @@ void SmartScript::OnMoveInLineOfSight(Unit* who) { ProcessEventsFor(SMART_EVENT_OOC_LOS, who); - if (!me) return; + if (!me) + return; + if (me->getVictim()) return; diff --git a/src/server/game/AI/SmartScripts/SmartScript.h b/src/server/game/AI/SmartScripts/SmartScript.h index f7524582ab7..5fb691c87f2 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.h +++ b/src/server/game/AI/SmartScripts/SmartScript.h @@ -23,7 +23,6 @@ #include "CreatureAI.h" #include "Unit.h" #include "ConditionMgr.h" -#include "CreatureTextMgr.h" #include "Spell.h" #include "GridNotifiers.h" @@ -99,7 +98,13 @@ class SmartScript return; if (mTargetStorage->find(id) != mTargetStorage->end()) + { + // check if already stored + if ((*mTargetStorage)[id] == targets) + return; + delete (*mTargetStorage)[id]; + } (*mTargetStorage)[id] = targets; } diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index f99e317454c..a7149f37480 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -27,6 +27,7 @@ #include "InstanceScript.h" #include "ScriptedCreature.h" #include "GameEventMgr.h" +#include "CreatureTextMgr.h" #include "SmartScriptMgr.h" @@ -34,6 +35,14 @@ void SmartWaypointMgr::LoadFromDB() { uint32 oldMSTime = getMSTime(); + for (UNORDERED_MAP<uint32, WPPath*>::iterator itr = waypoint_map.begin(); itr != waypoint_map.end(); ++itr) + { + for (WPPath::iterator pathItr = itr->second->begin(); pathItr != itr->second->end(); ++pathItr) + delete pathItr->second; + + delete itr->second; + } + waypoint_map.clear(); PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_SMARTAI_WP); @@ -48,7 +57,6 @@ void SmartWaypointMgr::LoadFromDB() uint32 count = 0; uint32 total = 0; - WPPath* path = NULL; uint32 last_entry = 0; uint32 last_id = 1; @@ -62,27 +70,19 @@ void SmartWaypointMgr::LoadFromDB() y = fields[3].GetFloat(); z = fields[4].GetFloat(); - WayPoint* wp = new WayPoint(id, x, y, z); - if (last_entry != entry) { - path = new WPPath; + waypoint_map[entry] = new WPPath(); last_id = 1; + count++; } if (last_id != id) - { sLog->outErrorDb("SmartWaypointMgr::LoadFromDB: Path entry %u, unexpected point id %u, expected %u.", entry, id, last_id); - } last_id++; - (*path)[id] = wp; + (*waypoint_map[entry])[id] = new WayPoint(id, x, y, z); - if (last_entry != entry) - { - count++; - waypoint_map[entry] = path; - } last_entry = entry; total++; } @@ -92,6 +92,19 @@ void SmartWaypointMgr::LoadFromDB() sLog->outString(); } +SmartWaypointMgr::~SmartWaypointMgr() +{ + for (UNORDERED_MAP<uint32, WPPath*>::iterator itr = waypoint_map.begin(); itr != waypoint_map.end(); ++itr) + { + for (WPPath::iterator pathItr = itr->second->begin(); pathItr != itr->second->end(); ++pathItr) + delete pathItr->second; + + delete itr->second; + } + + waypoint_map.clear(); +} + void SmartAIMgr::LoadSmartAIFromDB() { uint32 oldMSTime = getMSTime(); @@ -185,7 +198,6 @@ void SmartAIMgr::LoadSmartAIFromDB() temp.event.raw.param4 = fields[11].GetUInt32(); temp.action.type = (SMART_ACTION)fields[12].GetUInt8(); - temp.action.raw.param1 = fields[13].GetUInt32(); temp.action.raw.param2 = fields[14].GetUInt32(); temp.action.raw.param3 = fields[15].GetUInt32(); @@ -312,7 +324,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d, event type %u can not be used for Script type %u", e.entryOrGuid, e.GetEventType(), e.GetScriptType()); return false; } - if (e.action.type >= SMART_ACTION_END) + if (e.action.type <= 0 || e.action.type >= SMART_ACTION_END) { sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid action type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetActionType()); return false; @@ -322,11 +334,19 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid phase mask (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_phase_mask); return false; } + if (e.event.event_flags > SMART_EVENT_FLAGS_ALL) + { + sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event flags (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_flags); + return false; + } if (e.GetScriptType() == SMART_SCRIPT_TYPE_TIMED_ACTIONLIST) { e.event.type = SMART_EVENT_UPDATE_OOC;//force default OOC, can change when calling the script! - if (!IsMinMaxValid(e, e.event.minMaxRepeat.min, e.event.minMaxRepeat.max)) return false; - if (!IsMinMaxValid(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax)) return false; + if (!IsMinMaxValid(e, e.event.minMaxRepeat.min, e.event.minMaxRepeat.max)) + return false; + + if (!IsMinMaxValid(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax)) + return false; } else { @@ -344,8 +364,11 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_EVENT_DAMAGED: case SMART_EVENT_DAMAGED_TARGET: case SMART_EVENT_RECEIVE_HEAL: - if (!IsMinMaxValid(e, e.event.minMaxRepeat.min, e.event.minMaxRepeat.max)) return false; - if (!IsMinMaxValid(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax)) return false; + if (!IsMinMaxValid(e, e.event.minMaxRepeat.min, e.event.minMaxRepeat.max)) + return false; + + if (!IsMinMaxValid(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax)) + return false; break; case SMART_EVENT_SPELLHIT: case SMART_EVENT_SPELLHIT_TARGET: @@ -363,11 +386,13 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) return false; } } - if (!IsMinMaxValid(e, e.event.spellHit.cooldownMin, e.event.spellHit.cooldownMax)) return false; + if (!IsMinMaxValid(e, e.event.spellHit.cooldownMin, e.event.spellHit.cooldownMax)) + return false; break; case SMART_EVENT_OOC_LOS: case SMART_EVENT_IC_LOS: - if (!IsMinMaxValid(e, e.event.los.cooldownMin, e.event.los.cooldownMax)) return false; + if (!IsMinMaxValid(e, e.event.los.cooldownMin, e.event.los.cooldownMax)) + return false; break; case SMART_EVENT_RESPAWN: if (e.event.respawn.type == SMART_SCRIPT_RESPAWN_CONDITION_MAP && !sMapStore.LookupEntry(e.event.respawn.map)) @@ -382,32 +407,48 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) } break; case SMART_EVENT_FRIENDLY_HEALTH: - if (!NotNULL(e, e.event.friendlyHealt.radius)) return false; - if (!IsMinMaxValid(e, e.event.friendlyHealt.repeatMin, e.event.friendlyHealt.repeatMax)) return false; + if (!NotNULL(e, e.event.friendlyHealt.radius)) + return false; + + if (!IsMinMaxValid(e, e.event.friendlyHealt.repeatMin, e.event.friendlyHealt.repeatMax)) + return false; break; case SMART_EVENT_FRIENDLY_IS_CC: - if (!IsMinMaxValid(e, e.event.friendlyCC.repeatMin, e.event.friendlyCC.repeatMax)) return false; + if (!IsMinMaxValid(e, e.event.friendlyCC.repeatMin, e.event.friendlyCC.repeatMax)) + return false; break; case SMART_EVENT_FRIENDLY_MISSING_BUFF: { - if (!IsSpellValid(e, e.event.missingBuff.spell)) return false; - if (!NotNULL(e, e.event.missingBuff.radius)) return false; - if (!IsMinMaxValid(e, e.event.missingBuff.repeatMin, e.event.missingBuff.repeatMax)) return false; + if (!IsSpellValid(e, e.event.missingBuff.spell)) + return false; + + if (!NotNULL(e, e.event.missingBuff.radius)) + return false; + + if (!IsMinMaxValid(e, e.event.missingBuff.repeatMin, e.event.missingBuff.repeatMax)) + return false; break; } case SMART_EVENT_KILL: - if (!IsMinMaxValid(e, e.event.kill.cooldownMin, e.event.kill.cooldownMax)) return false; - if (e.event.kill.creature && !IsCreatureValid(e, e.event.kill.creature)) return false; + if (!IsMinMaxValid(e, e.event.kill.cooldownMin, e.event.kill.cooldownMax)) + return false; + + if (e.event.kill.creature && !IsCreatureValid(e, e.event.kill.creature)) + return false; break; case SMART_EVENT_TARGET_CASTING: case SMART_EVENT_PASSENGER_BOARDED: case SMART_EVENT_PASSENGER_REMOVED: - if (!IsMinMaxValid(e, e.event.minMax.repeatMin, e.event.minMax.repeatMax)) return false; + if (!IsMinMaxValid(e, e.event.minMax.repeatMin, e.event.minMax.repeatMax)) + return false; break; case SMART_EVENT_SUMMON_DESPAWNED: case SMART_EVENT_SUMMONED_UNIT: - if (e.event.summoned.creature && !IsCreatureValid(e, e.event.summoned.creature)) return false; - if (!IsMinMaxValid(e, e.event.summoned.cooldownMin, e.event.summoned.cooldownMax)) return false; + if (e.event.summoned.creature && !IsCreatureValid(e, e.event.summoned.creature)) + return false; + + if (!IsMinMaxValid(e, e.event.summoned.cooldownMin, e.event.summoned.cooldownMax)) + return false; break; case SMART_EVENT_ACCEPTED_QUEST: case SMART_EVENT_REWARD_QUEST: @@ -416,20 +457,27 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) break; case SMART_EVENT_RECEIVE_EMOTE: { - if (e.event.emote.emote && !IsTextEmoteValid(e, e.event.emote.emote)) return false; - if (!IsMinMaxValid(e, e.event.emote.cooldownMin, e.event.emote.cooldownMax)) return false; + if (e.event.emote.emote && !IsTextEmoteValid(e, e.event.emote.emote)) + return false; + + if (!IsMinMaxValid(e, e.event.emote.cooldownMin, e.event.emote.cooldownMax)) + return false; break; } case SMART_EVENT_HAS_AURA: case SMART_EVENT_TARGET_BUFFED: { - if (!IsSpellValid(e, e.event.aura.spell)) return false; - if (!IsMinMaxValid(e, e.event.aura.repeatMin, e.event.aura.repeatMax)) return false; + if (!IsSpellValid(e, e.event.aura.spell)) + return false; + + if (!IsMinMaxValid(e, e.event.aura.repeatMin, e.event.aura.repeatMax)) + return false; break; } case SMART_EVENT_TRANSPORT_ADDCREATURE: { - if (e.event.transportAddCreature.creature && !IsCreatureValid(e, e.event.transportAddCreature.creature)) return false; + if (e.event.transportAddCreature.creature && !IsCreatureValid(e, e.event.transportAddCreature.creature)) + return false; break; } case SMART_EVENT_MOVEMENTINFORM: @@ -443,12 +491,14 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) } case SMART_EVENT_DATA_SET: { - if (!IsMinMaxValid(e, e.event.dataSet.cooldownMin, e.event.dataSet.cooldownMax)) return false; + if (!IsMinMaxValid(e, e.event.dataSet.cooldownMin, e.event.dataSet.cooldownMax)) + return false; break; } case SMART_EVENT_AREATRIGGER_ONTRIGGER: { - if (e.event.areatrigger.id && !IsAreaTriggerValid(e, e.event.areatrigger.id)) return false; + if (e.event.areatrigger.id && !IsAreaTriggerValid(e, e.event.areatrigger.id)) + return false; break; } case SMART_EVENT_TEXT_OVER: @@ -464,8 +514,11 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) break; } case SMART_EVENT_DUMMY_EFFECT: - if (!IsSpellValid(e, e.event.dummy.spell)) return false; - if (e.event.dummy.effIndex > EFFECT_2) return false; + if (!IsSpellValid(e, e.event.dummy.spell)) + return false; + + if (e.event.dummy.effIndex > EFFECT_2) + return false; break; case SMART_EVENT_IS_BEHIND_TARGET: if (!IsMinMaxValid(e, e.event.behindTarget.cooldownMin, e.event.behindTarget.cooldownMax)) @@ -562,11 +615,13 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) break; case SMART_ACTION_SET_EMOTE_STATE: case SMART_ACTION_PLAY_EMOTE: - if (!IsEmoteValid(e, e.action.emote.emote)) return false; + if (!IsEmoteValid(e, e.action.emote.emote)) + return false; break; case SMART_ACTION_FAIL_QUEST: case SMART_ACTION_ADD_QUEST: - if (!e.action.quest.quest || !IsQuestValid(e, e.action.quest.quest)) return false; + if (!e.action.quest.quest || !IsQuestValid(e, e.action.quest.quest)) + return false; break; case SMART_ACTION_ACTIVATE_TAXI: { @@ -578,17 +633,29 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) break; } case SMART_ACTION_RANDOM_EMOTE: - if (e.action.randomEmote.emote1 && !IsEmoteValid(e, e.action.randomEmote.emote1)) return false; - if (e.action.randomEmote.emote2 && !IsEmoteValid(e, e.action.randomEmote.emote2)) return false; - if (e.action.randomEmote.emote3 && !IsEmoteValid(e, e.action.randomEmote.emote3)) return false; - if (e.action.randomEmote.emote4 && !IsEmoteValid(e, e.action.randomEmote.emote4)) return false; - if (e.action.randomEmote.emote5 && !IsEmoteValid(e, e.action.randomEmote.emote5)) return false; - if (e.action.randomEmote.emote6 && !IsEmoteValid(e, e.action.randomEmote.emote6)) return false; + if (e.action.randomEmote.emote1 && !IsEmoteValid(e, e.action.randomEmote.emote1)) + return false; + + if (e.action.randomEmote.emote2 && !IsEmoteValid(e, e.action.randomEmote.emote2)) + return false; + + if (e.action.randomEmote.emote3 && !IsEmoteValid(e, e.action.randomEmote.emote3)) + return false; + + if (e.action.randomEmote.emote4 && !IsEmoteValid(e, e.action.randomEmote.emote4)) + return false; + + if (e.action.randomEmote.emote5 && !IsEmoteValid(e, e.action.randomEmote.emote5)) + return false; + + if (e.action.randomEmote.emote6 && !IsEmoteValid(e, e.action.randomEmote.emote6)) + return false; break; case SMART_ACTION_ADD_AURA: case SMART_ACTION_CAST: case SMART_ACTION_INVOKER_CAST: - if (!IsSpellValid(e, e.action.cast.spell)) return false; + if (!IsSpellValid(e, e.action.cast.spell)) + return false; break; case SMART_ACTION_CALL_AREAEXPLOREDOREVENTHAPPENS: case SMART_ACTION_CALL_GROUPEVENTHAPPENS: @@ -607,8 +674,11 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) } break; case SMART_ACTION_SEND_CASTCREATUREORGO: - if (!IsQuestValid(e, e.action.castCreatureOrGO.quest)) return false; - if (!IsSpellValid(e, e.action.castCreatureOrGO.spell)) return false; + if (!IsQuestValid(e, e.action.castCreatureOrGO.quest)) + return false; + + if (!IsSpellValid(e, e.action.castCreatureOrGO.spell)) + return false; break; @@ -632,11 +702,15 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) } break; case SMART_ACTION_CALL_CASTEDCREATUREORGO: - if (!IsCreatureValid(e, e.action.castedCreatureOrGO.creature)) return false; - if (!IsSpellValid(e, e.action.castedCreatureOrGO.spell)) return false; + if (!IsCreatureValid(e, e.action.castedCreatureOrGO.creature)) + return false; + + if (!IsSpellValid(e, e.action.castedCreatureOrGO.spell)) + return false; break; case SMART_ACTION_REMOVEAURASFROMSPELL: - if (!IsSpellValid(e, e.action.removeAura.spell)) return false; + if (!IsSpellValid(e, e.action.removeAura.spell)) + return false; break; case SMART_ACTION_RANDOM_PHASE: { @@ -660,11 +734,13 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); return false; } - if (!IsMinMaxValid(e, e.action.randomPhaseRange.phaseMin, e.action.randomPhaseRange.phaseMax)) return false; + if (!IsMinMaxValid(e, e.action.randomPhaseRange.phaseMin, e.action.randomPhaseRange.phaseMax)) + return false; break; } case SMART_ACTION_SUMMON_CREATURE: - if (!IsCreatureValid(e, e.action.summonCreature.creature)) return false; + if (!IsCreatureValid(e, e.action.summonCreature.creature)) + return false; if (e.action.summonCreature.type < TEMPSUMMON_TIMED_OR_DEAD_DESPAWN || e.action.summonCreature.type > TEMPSUMMON_MANUAL_DESPAWN) { sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect TempSummonType %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonCreature.type); @@ -672,10 +748,12 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) } break; case SMART_ACTION_CALL_KILLEDMONSTER: - if (!IsCreatureValid(e, e.action.killedMonster.creature)) return false; + if (!IsCreatureValid(e, e.action.killedMonster.creature)) + return false; break; case SMART_ACTION_UPDATE_TEMPLATE: - if (e.action.updateTemplate.creature && !IsCreatureValid(e, e.action.updateTemplate.creature)) return false; + if (e.action.updateTemplate.creature && !IsCreatureValid(e, e.action.updateTemplate.creature)) + return false; break; case SMART_ACTION_SET_SHEATH: if (e.action.setSheath.sheath && e.action.setSheath.sheath >= MAX_SHEATH_STATE) @@ -694,12 +772,16 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) break; } case SMART_ACTION_SUMMON_GO: - if (!IsGameObjectValid(e, e.action.summonGO.entry)) return false; + if (!IsGameObjectValid(e, e.action.summonGO.entry)) + return false; break; case SMART_ACTION_ADD_ITEM: case SMART_ACTION_REMOVE_ITEM: - if (!IsItemValid(e, e.action.item.entry)) return false; - if (!NotNULL(e, e.action.item.count)) return false; + if (!IsItemValid(e, e.action.item.entry)) + return false; + + if (!NotNULL(e, e.action.item.count)) + return false; break; case SMART_ACTION_TELEPORT: if (!sMapStore.LookupEntry(e.action.teleport.mapID)) @@ -716,7 +798,8 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) } break; case SMART_ACTION_WP_STOP: - if (e.action.wpStop.quest && !IsQuestValid(e, e.action.wpStop.quest)) return false; + if (e.action.wpStop.quest && !IsQuestValid(e, e.action.wpStop.quest)) + return false; break; case SMART_ACTION_WP_START: { @@ -725,7 +808,8 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) sLog->outErrorDb("SmartAIMgr: Creature %d Event %u Action %u uses non-existent WaypointPath id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.pathID); return false; } - if (e.action.wpStart.quest && !IsQuestValid(e, e.action.wpStart.quest)) return false; + if (e.action.wpStart.quest && !IsQuestValid(e, e.action.wpStart.quest)) + return false; if (e.action.wpStart.reactState > REACT_AGGRESSIVE) { sLog->outErrorDb("SmartAIMgr: Creature %d Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.reactState); @@ -735,8 +819,11 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) } case SMART_ACTION_CREATE_TIMED_EVENT: { - if (!IsMinMaxValid(e, e.action.timeEvent.min, e.action.timeEvent.max)) return false; - if (!IsMinMaxValid(e, e.action.timeEvent.repeatMin, e.action.timeEvent.repeatMax)) return false; + if (!IsMinMaxValid(e, e.action.timeEvent.min, e.action.timeEvent.max)) + return false; + + if (!IsMinMaxValid(e, e.action.timeEvent.repeatMin, e.action.timeEvent.repeatMax)) + return false; break; } case SMART_ACTION_FOLLOW: diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 7869a2e665f..e6c5eb727d7 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -23,7 +23,6 @@ #include "CreatureAI.h" #include "Unit.h" #include "ConditionMgr.h" -#include "CreatureTextMgr.h" #include "Spell.h" #include "DB2Stores.h" @@ -443,7 +442,7 @@ enum SMART_ACTION SMART_ACTION_CREATE_TIMED_EVENT = 67, // id, InitialMin, InitialMax, RepeatMin(only if it repeats), RepeatMax(only if it repeats), chance SMART_ACTION_PLAYMOVIE = 68, // entry - SMART_ACTION_MOVE_TO_POS = 69, // xyz + SMART_ACTION_MOVE_TO_POS = 69, // PointId, xyz SMART_ACTION_RESPAWN_TARGET = 70, // SMART_ACTION_EQUIP = 71, // entry, slotmask slot1, slot2, slot3 , only slots with mask set will be sent to client, bits are 1, 2, 4, leaving mask 0 is defaulted to mask 7 (send all), slots1-3 are only used if no entry is set SMART_ACTION_CLOSE_GOSSIP = 72, // none @@ -453,7 +452,7 @@ enum SMART_ACTION SMART_ACTION_OVERRIDE_SCRIPT_BASE_OBJECT = 76, // WARNING: CAN CRASH CORE, do not use if you dont know what you are doing SMART_ACTION_RESET_SCRIPT_BASE_OBJECT = 77, // none SMART_ACTION_CALL_SCRIPT_RESET = 78, // none - // Unused = 79, + SMART_ACTION_SET_RANGED_MOVEMENT = 79, // Distance, angle SMART_ACTION_CALL_TIMED_ACTIONLIST = 80, // ID (overwrites already running actionlist), stop after combat?(0/1), timer update type(0-OOC, 1-IC, 2-ALWAYS) SMART_ACTION_SET_NPC_FLAG = 81, // Flags SMART_ACTION_ADD_NPC_FLAG = 82, // Flags @@ -876,6 +875,11 @@ struct SmartAction struct { + uint8 pointId; + } MoveToPos; + + struct + { uint32 gossipMenuId; uint32 gossipNpcTextId; } sendGossipMenu; @@ -892,6 +896,12 @@ struct SmartAction struct { + float distance; + float angle; + } setRangedMovement; + + struct + { uint32 param1; uint32 param2; uint32 param3; @@ -1162,16 +1172,18 @@ const uint32 SmartAIEventMask[SMART_EVENT_END][2] = enum SmartEventFlags { - SMART_EVENT_FLAG_NOT_REPEATABLE = 0x01, //Event can not repeat - SMART_EVENT_FLAG_DIFFICULTY_0 = 0x02, //Event only occurs in instance difficulty 0 - SMART_EVENT_FLAG_DIFFICULTY_1 = 0x04, //Event only occurs in instance difficulty 1 - SMART_EVENT_FLAG_DIFFICULTY_2 = 0x08, //Event only occurs in instance difficulty 2 - SMART_EVENT_FLAG_DIFFICULTY_3 = 0x10, //Event only occurs in instance difficulty 3 - SMART_EVENT_FLAG_RESERVED_5 = 0x20, - SMART_EVENT_FLAG_RESERVED_6 = 0x40, - SMART_EVENT_FLAG_DEBUG_ONLY = 0x80, //Event only occurs in debug build - - SMART_EVENT_FLAG_DIFFICULTY_ALL = (SMART_EVENT_FLAG_DIFFICULTY_0|SMART_EVENT_FLAG_DIFFICULTY_1|SMART_EVENT_FLAG_DIFFICULTY_2|SMART_EVENT_FLAG_DIFFICULTY_3) + SMART_EVENT_FLAG_NOT_REPEATABLE = 0x001, //Event can not repeat + SMART_EVENT_FLAG_DIFFICULTY_0 = 0x002, //Event only occurs in instance difficulty 0 + SMART_EVENT_FLAG_DIFFICULTY_1 = 0x004, //Event only occurs in instance difficulty 1 + SMART_EVENT_FLAG_DIFFICULTY_2 = 0x008, //Event only occurs in instance difficulty 2 + SMART_EVENT_FLAG_DIFFICULTY_3 = 0x010, //Event only occurs in instance difficulty 3 + SMART_EVENT_FLAG_RESERVED_5 = 0x020, + SMART_EVENT_FLAG_RESERVED_6 = 0x040, + SMART_EVENT_FLAG_DEBUG_ONLY = 0x080, //Event only occurs in debug build + SMART_EVENT_FLAG_DONT_RESET = 0x100, //Event will not reset in SmartScript::OnReset() + + SMART_EVENT_FLAG_DIFFICULTY_ALL = (SMART_EVENT_FLAG_DIFFICULTY_0|SMART_EVENT_FLAG_DIFFICULTY_1|SMART_EVENT_FLAG_DIFFICULTY_2|SMART_EVENT_FLAG_DIFFICULTY_3), + SMART_EVENT_FLAGS_ALL = (SMART_EVENT_FLAG_NOT_REPEATABLE|SMART_EVENT_FLAG_DIFFICULTY_ALL|SMART_EVENT_FLAG_RESERVED_5|SMART_EVENT_FLAG_RESERVED_6|SMART_EVENT_FLAG_DEBUG_ONLY|SMART_EVENT_FLAG_DONT_RESET) }; enum SmartCastFlags @@ -1227,9 +1239,9 @@ typedef UNORDERED_MAP<uint32, ObjectList*> ObjectListMap; class SmartWaypointMgr { friend class ACE_Singleton<SmartWaypointMgr, ACE_Null_Mutex>; - SmartWaypointMgr(){}; + SmartWaypointMgr() {} public: - ~SmartWaypointMgr(){}; + ~SmartWaypointMgr(); void LoadFromDB(); diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp index a6ae300e25d..8076f800356 100755 --- a/src/server/game/Accounts/AccountMgr.cpp +++ b/src/server/game/Accounts/AccountMgr.cpp @@ -53,12 +53,21 @@ AccountOpResult CreateAccount(std::string username, std::string password) AccountOpResult DeleteAccount(uint32 accountId) { - QueryResult result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%d'", accountId); + // Check if accounts exists + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BY_ID); + stmt->setUInt32(0, accountId); + PreparedQueryResult result = LoginDatabase.Query(stmt); + if (!result) - return AOR_NAME_NOT_EXIST; // account doesn't exist + return AOR_NAME_NOT_EXIST; + + // Obtain accounts characters + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARS_BY_ACCOUNT_ID); + + stmt->setUInt32(0, accountId); + + result = CharacterDatabase.Query(stmt); - // existed characters list - result = CharacterDatabase.PQuery("SELECT guid FROM characters WHERE account='%d'", accountId); if (result) { do @@ -66,7 +75,7 @@ AccountOpResult DeleteAccount(uint32 accountId) uint32 guidLow = (*result)[0].GetUInt32(); uint64 guid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER); - // kick if player is online + // Kick if player is online if (Player* p = ObjectAccessor::FindPlayer(guid)) { WorldSession* s = p->GetSession(); @@ -79,18 +88,35 @@ AccountOpResult DeleteAccount(uint32 accountId) } // table realm specific but common for all characters of account for realm - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_TUTORIALS); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_TUTORIALS); stmt->setUInt32(0, accountId); CharacterDatabase.Execute(stmt); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ACCOUNT_DATA); stmt->setUInt32(0, accountId); CharacterDatabase.Execute(stmt); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER_BAN); + stmt->setUInt32(0, accountId); + CharacterDatabase.Execute(stmt); + SQLTransaction trans = LoginDatabase.BeginTransaction(); - trans->PAppend("DELETE FROM account WHERE id='%d'", accountId); - trans->PAppend("DELETE FROM account_access WHERE id ='%d'", accountId); - trans->PAppend("DELETE FROM realmcharacters WHERE acctid='%d'", accountId); + stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT); + stmt->setUInt32(0, accountId); + trans->Append(stmt); + + stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT_ACCESS); + stmt->setUInt32(0, accountId); + trans->Append(stmt); + + stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_REALM_CHARACTERS); + stmt->setUInt32(0, accountId); + trans->Append(stmt); + + stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT_BANNED); + stmt->setUInt32(0, accountId); + trans->Append(stmt); LoginDatabase.CommitTransaction(trans); @@ -99,9 +125,13 @@ AccountOpResult DeleteAccount(uint32 accountId) AccountOpResult ChangeUsername(uint32 accountId, std::string newUsername, std::string newPassword) { - QueryResult result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%d'", accountId); + // Check if accounts exists + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BY_ID); + stmt->setUInt32(0, accountId); + PreparedQueryResult result = LoginDatabase.Query(stmt); + if (!result) - return AOR_NAME_NOT_EXIST; // account doesn't exist + return AOR_NAME_NOT_EXIST; if (utf8length(newUsername) > MAX_ACCOUNT_STR) return AOR_NAME_TOO_LONG; @@ -112,7 +142,7 @@ AccountOpResult ChangeUsername(uint32 accountId, std::string newUsername, std::s normalizeString(newUsername); normalizeString(newPassword); - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_USERNAME); + stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_USERNAME); stmt->setString(0, newUsername); stmt->setString(1, CalculateShaPassHash(newUsername, newPassword)); @@ -148,28 +178,38 @@ AccountOpResult ChangePassword(uint32 accountId, std::string newPassword) uint32 GetId(std::string username) { - LoginDatabase.EscapeString(username); - QueryResult result = LoginDatabase.PQuery("SELECT id FROM account WHERE username = '%s'", username.c_str()); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_ACCOUNT_ID_BY_USERNAME); + stmt->setString(0, username); + PreparedQueryResult result = LoginDatabase.Query(stmt); + return (result) ? (*result)[0].GetUInt32() : 0; } uint32 GetSecurity(uint32 accountId) { - QueryResult result = LoginDatabase.PQuery("SELECT gmlevel FROM account_access WHERE id = '%u'", accountId); - return (result) ? (*result)[0].GetUInt32() : 0; + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_ACCOUNT_ACCESS_GMLEVEL); + stmt->setUInt32(0, accountId); + PreparedQueryResult result = LoginDatabase.Query(stmt); + + return (result) ? (*result)[0].GetUInt8() : uint32(SEC_PLAYER); } -uint32 GetSecurity(uint64 accountId, int32 realmId) +uint32 GetSecurity(uint32 accountId, int32 realmId) { - QueryResult result = (realmId == -1) - ? LoginDatabase.PQuery("SELECT gmlevel FROM account_access WHERE id = '%u' AND RealmID = '%d'", accountId, realmId) - : LoginDatabase.PQuery("SELECT gmlevel FROM account_access WHERE id = '%u' AND (RealmID = '%d' OR RealmID = '-1')", accountId, realmId); - return (result) ? (*result)[0].GetUInt32() : 0; + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_GMLEVEL_BY_REALMID); + stmt->setUInt32(0, accountId); + stmt->setInt32(1, realmId); + PreparedQueryResult result = LoginDatabase.Query(stmt); + + return (result) ? (*result)[0].GetUInt8() : uint32(SEC_PLAYER); } bool GetName(uint32 accountId, std::string& name) { - QueryResult result = LoginDatabase.PQuery("SELECT username FROM account WHERE id = '%u'", accountId); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_USERNAME_BY_ID); + stmt->setUInt32(0, accountId); + PreparedQueryResult result = LoginDatabase.Query(stmt); + if (result) { name = (*result)[0].GetString(); @@ -189,15 +229,22 @@ bool CheckPassword(uint32 accountId, std::string password) normalizeString(username); normalizeString(password); - QueryResult result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%d' AND sha_pass_hash='%s'", accountId, CalculateShaPassHash(username, password).c_str()); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_CHECK_PASSWORD); + stmt->setUInt32(0, accountId); + stmt->setString(1, CalculateShaPassHash(username, password)); + PreparedQueryResult result = LoginDatabase.Query(stmt); + return (result) ? true : false; } uint32 GetCharactersCount(uint32 accountId) { // check character count - QueryResult result = CharacterDatabase.PQuery("SELECT COUNT(guid) FROM characters WHERE account = '%d'", accountId); - return (result) ? (*result)[0].GetUInt32() : 0; + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_SUM_CHARS); + stmt->setUInt32(0, accountId); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + + return (result) ? (*result)[0].GetUInt64() : 0; } bool normalizeString(std::string& utf8String) diff --git a/src/server/game/Accounts/AccountMgr.h b/src/server/game/Accounts/AccountMgr.h index 1b1ecfa994a..c69f3c0a6f3 100755 --- a/src/server/game/Accounts/AccountMgr.h +++ b/src/server/game/Accounts/AccountMgr.h @@ -36,25 +36,25 @@ enum AccountOpResult namespace AccountMgr { - AccountOpResult CreateAccount(std::string username, std::string password); - AccountOpResult DeleteAccount(uint32 accountId); - AccountOpResult ChangeUsername(uint32 accountId, std::string newUsername, std::string newPassword); - AccountOpResult ChangePassword(uint32 accountId, std::string newPassword); - bool CheckPassword(uint32 accountId, std::string password); - - uint32 GetId(std::string username); - uint32 GetSecurity(uint32 accountId); - uint32 GetSecurity(uint64 accountId, int32 realmId); - bool GetName(uint32 accountId, std::string& name); - uint32 GetCharactersCount(uint32 accountId); - std::string CalculateShaPassHash(std::string& name, std::string& password); - - bool normalizeString(std::string& utf8String); - bool IsPlayerAccount(uint32 gmlevel); - bool IsModeratorAccount(uint32 gmlevel); - bool IsGMAccount(uint32 gmlevel); - bool IsAdminAccount(uint32 gmlevel); - bool IsConsoleAccount(uint32 gmlevel); + AccountOpResult CreateAccount(std::string username, std::string password); + AccountOpResult DeleteAccount(uint32 accountId); + AccountOpResult ChangeUsername(uint32 accountId, std::string newUsername, std::string newPassword); + AccountOpResult ChangePassword(uint32 accountId, std::string newPassword); + bool CheckPassword(uint32 accountId, std::string password); + + uint32 GetId(std::string username); + uint32 GetSecurity(uint32 accountId); + uint32 GetSecurity(uint32 accountId, int32 realmId); + bool GetName(uint32 accountId, std::string& name); + uint32 GetCharactersCount(uint32 accountId); + std::string CalculateShaPassHash(std::string& name, std::string& password); + + bool normalizeString(std::string& utf8String); + bool IsPlayerAccount(uint32 gmlevel); + bool IsModeratorAccount(uint32 gmlevel); + bool IsGMAccount(uint32 gmlevel); + bool IsAdminAccount(uint32 gmlevel); + bool IsConsoleAccount(uint32 gmlevel); }; #endif diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index aa6c39f351d..21a2a75b470 100755 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -445,8 +445,15 @@ void AchievementMgr::ResetAchievementCriteria(AchievementCriteriaTypes type, uin void AchievementMgr::DeleteFromDB(uint32 lowguid) { SQLTransaction trans = CharacterDatabase.BeginTransaction(); - trans->PAppend("DELETE FROM character_achievement WHERE guid = %u", lowguid); - trans->PAppend("DELETE FROM character_achievement_progress WHERE guid = %u", lowguid); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT); + stmt->setUInt32(0, lowguid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_PROGRESS); + stmt->setUInt32(0, lowguid); + trans->Append(stmt); + CharacterDatabase.CommitTransaction(trans); } @@ -574,7 +581,7 @@ void AchievementMgr::LoadFromDB(PreparedQueryResult achievementResult, PreparedQ // title achievement rewards are retroactive if (AchievementReward const* reward = sAchievementMgr->GetAchievementReward(achievement)) - if (uint32 titleId = reward->titleId[GetPlayer()->GetTeam() == ALLIANCE ? 0 : 1]) + if (uint32 titleId = reward->titleId[Player::TeamForRace(GetPlayer()->getRace()) == ALLIANCE ? 0 : 1]) if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(titleId)) if (!GetPlayer()->HasTitle(titleEntry)) GetPlayer()->SetTitle(titleEntry); @@ -1340,7 +1347,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui if (!miscValue1) { uint32 points = 0; - for (CompletedAchievementMap::iterator itr = m_completedAchievements.begin(); itr != m_completedAchievements.end(); ++itr) + for (CompletedAchievementMap::iterator itr = m_completedAchievements.begin(); itr != m_completedAchievements.end(); ++itr) if (AchievementEntry const* pAchievement = sAchievementStore.LookupEntry(itr->first)) points += pAchievement->points; SetCriteriaProgress(achievementCriteria, points, PROGRESS_SET); @@ -1889,7 +1896,7 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement) return; SendAchievementEarned(achievement); - CompletedAchievementData& ca = m_completedAchievements[achievement->ID]; + CompletedAchievementData& ca = m_completedAchievements[achievement->ID]; ca.date = time(NULL); ca.changed = true; @@ -1920,7 +1927,7 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement) // mail if (reward->sender) { - Item* item = reward->itemId ? Item::CreateItem(reward->itemId, 1, GetPlayer ()) : NULL; + Item* item = reward->itemId ? Item::CreateItem(reward->itemId, 1, GetPlayer()) : NULL; int loc_idx = GetPlayer()->GetSession()->GetSessionDbLocaleIndex(); @@ -2274,7 +2281,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData() continue; } - uint32 dataType = fields[1].GetUInt32(); + uint32 dataType = fields[1].GetUInt8(); const char* scriptName = fields[4].GetCString(); uint32 scriptId = 0; if (strcmp(scriptName, "")) // not empty @@ -2407,7 +2414,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements() { Field* fields = result->Fetch(); - uint32 achievementId = fields[0].GetUInt32(); + uint16 achievementId = fields[0].GetUInt16(); const AchievementEntry* achievement = sAchievementStore.LookupEntry(achievementId); if (!achievement) { diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index 5b42ebe45b7..a156583a006 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -482,7 +482,9 @@ void AuctionHouseObject::Update() if (AuctionsMap.empty()) return; - QueryResult result = CharacterDatabase.PQuery("SELECT id FROM auctionhouse WHERE time <= %u ORDER BY TIME ASC", (uint32)curTime+60); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_AUCTION_BY_TIME); + stmt->setUInt32(0, (uint32)curTime+60); + PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) return; @@ -793,7 +795,7 @@ void AuctionHouseMgr::DeleteExpiredAuctionsAtStartup() AuctionEntry* auction = new AuctionEntry(); - // Can't use LoadFromDB() because it assumes the auction map is loaded + // Can't use LoadFromDB() because it assumes the auction map is loaded if (!auction->LoadFromFieldList(fields)) { // For some reason the record in the DB is broken (possibly corrupt diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp index 02707261d13..89151b6395c 100755 --- a/src/server/game/Battlegrounds/ArenaTeam.cpp +++ b/src/server/game/Battlegrounds/ArenaTeam.cpp @@ -145,7 +145,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid) uint32 matchMakerRating; if (result) - matchMakerRating = (*result)[0].GetUInt32(); + matchMakerRating = (*result)[0].GetUInt16(); else matchMakerRating = sWorld->getIntConfig(CONFIG_ARENA_START_MATCHMAKER_RATING); @@ -154,18 +154,18 @@ bool ArenaTeam::AddMember(uint64 playerGuid) Player::RemovePetitionsAndSigns(playerGuid, GetType()); // Feed data to the struct - ArenaTeamMember newmember; - newmember.Name = playerName; - newmember.Guid = playerGuid; - newmember.Class = playerClass; - newmember.SeasonGames = 0; - newmember.WeekGames = 0; - newmember.SeasonWins = 0; - newmember.WeekWins = 0; - newmember.PersonalRating = personalRating; - newmember.MatchMakerRating = matchMakerRating; - - Members.push_back(newmember); + ArenaTeamMember newMember; + newMember.Name = playerName; + newMember.Guid = playerGuid; + newMember.Class = playerClass; + newMember.SeasonGames = 0; + newMember.WeekGames = 0; + newMember.SeasonWins = 0; + newMember.WeekWins = 0; + newMember.PersonalRating = personalRating; + newMember.MatchMakerRating = matchMakerRating; + + Members.push_back(newMember); // Save player's arena team membership to db stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_TEAM_MEMBER); @@ -267,7 +267,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result) if (Empty() || !captainPresentInTeam) { // Arena team is empty or captain is not in team, delete from db - sLog->outErrorDb("ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId); + sLog->outDebug(LOG_FILTER_BATTLEGROUND, "ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId); return false; } @@ -295,8 +295,10 @@ void ArenaTeam::SetCaptain(uint64 guid) if (newCaptain) { newCaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0); + char const* oldCaptainName = oldCaptain ? oldCaptain->GetName() : ""; + uint32 oldCaptainLowGuid = oldCaptain ? oldCaptain->GetGUIDLow() : 0; sLog->outArena("Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].", - oldCaptain->GetName(), oldCaptain->GetGUIDLow(), newCaptain->GetName(), newCaptain->GetGUIDLow(), GetId(), GetType()); + oldCaptainName, oldCaptainLowGuid, newCaptain->GetName(), newCaptain->GetGUIDLow(), GetId(), GetType()); } } @@ -304,11 +306,13 @@ void ArenaTeam::DelMember(uint64 guid, bool cleanDb) { // Remove member from team for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr) + { if (itr->Guid == guid) { Members.erase(itr); break; } + } // Inform player and remove arena team info from player data if (Player* player = ObjectAccessor::FindPlayer(guid)) @@ -719,7 +723,7 @@ int32 ArenaTeam::LostAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int3 void ArenaTeam::MemberLost(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange) { // Called for each participant of a match after losing - for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr) + for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr) { if (itr->Guid == player->GetGUID()) { @@ -745,7 +749,7 @@ void ArenaTeam::MemberLost(Player* player, uint32 againstMatchmakerRating, int32 void ArenaTeam::OfflineMemberLost(uint64 guid, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange) { // Called for offline player after ending rated arena match! - for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr) + for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr) { if (itr->Guid == guid) { @@ -767,7 +771,7 @@ void ArenaTeam::OfflineMemberLost(uint64 guid, uint32 againstMatchmakerRating, i void ArenaTeam::MemberWon(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange) { // called for each participant after winning a match - for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr) + for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr) { if (itr->Guid == player->GetGUID()) { @@ -802,7 +806,7 @@ void ArenaTeam::UpdateArenaPointsHelper(std::map<uint32, uint32>& playerPoints) // To get points, a player has to participate in at least 30% of the matches uint32 requiredGames = (uint32)ceil(Stats.WeekGames * 0.3f); - for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr) + for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr) { // The player participated in enough games, update his points uint32 pointsToAdd = 0; @@ -838,7 +842,7 @@ void ArenaTeam::SaveToDB() stmt->setUInt32(6, GetId()); trans->Append(stmt); - for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr) + for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ARENA_TEAM_MEMBER); stmt->setUInt16(0, itr->PersonalRating); @@ -867,7 +871,7 @@ void ArenaTeam::FinishWeek() Stats.WeekWins = 0; // Reset member stats - for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr) + for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr) { itr->WeekGames = 0; itr->WeekWins = 0; diff --git a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp index 7afa488a879..47282be3a8e 100644 --- a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp +++ b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp @@ -92,12 +92,12 @@ void ArenaTeamMgr::LoadArenaTeams() uint32 oldMSTime = getMSTime(); // Clean out the trash before loading anything - CharacterDatabase.Execute("DELETE FROM arena_team_member WHERE arenaTeamId NOT IN (SELECT arenaTeamId FROM arena_team)"); + CharacterDatabase.Execute("DELETE FROM arena_team_member WHERE arenaTeamId NOT IN (SELECT arenaTeamId FROM arena_team)"); // One-time query - // 0 1 2 3 4 5 6 7 8 - QueryResult result = CharacterDatabase.Query("SELECT arena_team.arenaTeamId, name, captainGuid, type, backgroundColor, emblemStyle, emblemColor, borderStyle, borderColor, " - // 9 10 11 12 13 14 - "rating, weekGames, weekWins, seasonGames, seasonWins, rank FROM arena_team ORDER BY arena_team.arenaTeamId ASC"); + // 0 1 2 3 4 5 6 7 8 + QueryResult result = CharacterDatabase.Query("SELECT arenaTeamId, name, captainGuid, type, backgroundColor, emblemStyle, emblemColor, borderStyle, borderColor, " + // 9 10 11 12 13 14 + "rating, weekGames, weekWins, seasonGames, seasonWins, rank FROM arena_team ORDER BY arenaTeamId ASC"); if (!result) { @@ -153,6 +153,8 @@ void ArenaTeamMgr::DistributeArenaPoints() SQLTransaction trans = CharacterDatabase.BeginTransaction(); + PreparedStatement* stmt; + // Cycle that gives points to all players /* for (std::map<uint32, uint32>::iterator playerItr = PlayerPoints.begin(); playerItr != PlayerPoints.end(); ++playerItr) @@ -161,7 +163,12 @@ void ArenaTeamMgr::DistributeArenaPoints() if (Player* player = HashMapHolder<Player>::Find(playerItr->first)) player->ModifyConquestPoints(playerItr->second, &trans); else // Update database - trans->PAppend("UPDATE characters SET arenaPoints=arenaPoints+%u WHERE guid=%u", playerItr->second, playerItr->first); + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_ARENA_POINTS); + stmt->setUInt32(0, playerItr->second); + stmt->setUInt32(1, playerItr->first); + trans->Append(stmt); + } } */ diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 191d2eaaeb6..54c84f2e6d4 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -21,7 +21,6 @@ #include "ArenaTeamMgr.h" #include "World.h" #include "WorldPacket.h" - #include "ArenaTeam.h" #include "Battleground.h" #include "BattlegroundMgr.h" @@ -66,7 +65,7 @@ namespace Trinity private: void do_helper(WorldPacket& data, char const* text) { - uint64 target_guid = _source ? _source ->GetGUID() : 0; + uint64 target_guid = _source ? _source->GetGUID() : 0; data << uint8 (_msgtype); data << uint32(LANG_UNIVERSAL); @@ -145,6 +144,7 @@ Battleground::Battleground() m_Winner = 2; m_StartTime = 0; m_ResetStatTimer = 0; + m_ValidStartPositionTimer = 0; m_Events = 0; m_IsRated = false; m_BuffChange = false; @@ -178,6 +178,8 @@ Battleground::Battleground() m_ArenaTeamIds[BG_TEAM_ALLIANCE] = 0; m_ArenaTeamIds[BG_TEAM_HORDE] = 0; + m_StartMaxDist = 0.0f; + m_ArenaTeamRatingChanges[BG_TEAM_ALLIANCE] = 0; m_ArenaTeamRatingChanges[BG_TEAM_HORDE] = 0; @@ -259,9 +261,7 @@ void Battleground::Update(uint32 diff) { case STATUS_WAIT_JOIN: if (GetPlayersSize()) - { _ProcessJoin(diff); - } break; case STATUS_IN_PROGRESS: _ProcessOfflineQueue(); @@ -294,6 +294,7 @@ void Battleground::Update(uint32 diff) // Update start time and reset stats timer m_StartTime += diff; m_ResetStatTimer += diff; + m_ValidStartPositionTimer += diff; PostUpdateImpl(diff); } @@ -425,7 +426,7 @@ inline void Battleground::_ProcessJoin(uint32 diff) // ********************************************************* ModifyStartDelayTime(diff); - if (m_ResetStatTimer <= 5000) + if (m_ResetStatTimer > 5000) { m_ResetStatTimer = 0; for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) @@ -456,19 +457,19 @@ inline void Battleground::_ProcessJoin(uint32 diff) // First start warning - 2 or 1 minute SendMessageToAll(StartMessageIds[BG_STARTING_EVENT_FIRST], CHAT_MSG_BG_SYSTEM_NEUTRAL); } - // After 1 minute or 30 seconds, warning is signalled + // After 1 minute or 30 seconds, warning is signaled else if (GetStartDelayTime() <= StartDelayTimes[BG_STARTING_EVENT_SECOND] && !(m_Events & BG_STARTING_EVENT_2)) { m_Events |= BG_STARTING_EVENT_2; SendMessageToAll(StartMessageIds[BG_STARTING_EVENT_SECOND], CHAT_MSG_BG_SYSTEM_NEUTRAL); } - // After 30 or 15 seconds, warning is signalled + // After 30 or 15 seconds, warning is signaled else if (GetStartDelayTime() <= StartDelayTimes[BG_STARTING_EVENT_THIRD] && !(m_Events & BG_STARTING_EVENT_3)) { m_Events |= BG_STARTING_EVENT_3; SendMessageToAll(StartMessageIds[BG_STARTING_EVENT_THIRD], CHAT_MSG_BG_SYSTEM_NEUTRAL); } - // Delay expired (atfer 2 or 1 minute) + // Delay expired (after 2 or 1 minute) else if (GetStartDelayTime() <= 0 && !(m_Events & BG_STARTING_EVENT_4)) { m_Events |= BG_STARTING_EVENT_4; @@ -529,6 +530,33 @@ inline void Battleground::_ProcessJoin(uint32 diff) sWorld->SendWorldText(LANG_BG_STARTED_ANNOUNCE_WORLD, GetName(), GetMinLevel(), GetMaxLevel()); } } + + // Find if the player left our start zone; if so, teleport it back + if (m_ValidStartPositionTimer > 1000) + { + m_ValidStartPositionTimer = 0; + float maxDist = GetStartMaxDist(); + if (maxDist > 0.0f) + { + for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) + { + if (Player *plr = ObjectAccessor::FindPlayer(itr->first)) + { + float x, y, z, o; + uint32 team = plr->GetBGTeam(); + GetTeamStartLoc(team, x, y, z, o); + + float dist = plr->GetDistance(x, y, z); + + if (dist >= maxDist) + { + sLog->outError("BATTLEGROUND: Sending %s back to start location (map: %u) (possible exploit)", plr->GetName(), GetMapId()); + plr->TeleportTo(GetMapId(), x, y, z, o); + } + } + } + } + } } inline void Battleground::_ProcessLeave(uint32 diff) @@ -743,7 +771,7 @@ void Battleground::EndBattleground(uint32 winner) winner_matchmaker_rating = GetArenaMatchmakerRating(winner); winner_matchmaker_change = winner_arena_team->WonAgainst(winner_matchmaker_rating, loser_matchmaker_rating, winner_change); loser_matchmaker_change = loser_arena_team->LostAgainst(loser_matchmaker_rating, winner_matchmaker_rating, loser_change); - sLog->outArena("--- Winner: old rating: %u, rating gain: %d, old MMR: %u, MMR gain: %d --- Loser: old rating: %u, rating loss: %d, old MMR: %u, MMR loss: %d ---", winner_team_rating, winner_change, winner_matchmaker_rating, + sLog->outArena("match Type: %u --- Winner: old rating: %u, rating gain: %d, old MMR: %u, MMR gain: %d --- Loser: old rating: %u, rating loss: %d, old MMR: %u, MMR loss: %d ---", m_ArenaType, winner_team_rating, winner_change, winner_matchmaker_rating, winner_matchmaker_change, loser_team_rating, loser_change, loser_matchmaker_rating, loser_matchmaker_change); SetArenaMatchmakerRating(winner, winner_matchmaker_rating + winner_matchmaker_change); SetArenaMatchmakerRating(GetOtherTeam(winner), loser_matchmaker_rating + loser_matchmaker_change); @@ -753,7 +781,7 @@ void Battleground::EndBattleground(uint32 winner) if (sWorld->getBoolConfig(CONFIG_ARENA_LOG_EXTENDED_INFO)) for (Battleground::BattlegroundScoreMap::const_iterator itr = GetPlayerScoresBegin(); itr != GetPlayerScoresEnd(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(itr->first)) - sLog->outArena("Statistics for %s (GUID: " UI64FMTD ", Team: %d, IP: %s): %u damage, %u healing, %u killing blows", player->GetName(), itr->first, player->GetArenaTeamId(m_ArenaType == 5 ? 2 : m_ArenaType == 3), player->GetSession()->GetRemoteAddress().c_str(), itr->second->DamageDone, itr->second->HealingDone, itr->second->KillingBlows); + sLog->outArena("Statistics match Type: %u for %s (GUID: " UI64FMTD ", Team: %d, IP: %s): %u damage, %u healing, %u killing blows", m_ArenaType, player->GetName(), itr->first, player->GetArenaTeamId(m_ArenaType == 5 ? 2 : m_ArenaType == 3), player->GetSession()->GetRemoteAddress().c_str(), itr->second->DamageDone, itr->second->HealingDone, itr->second->KillingBlows); } // Deduct 16 points from each teams arena-rating if there are no winners after 45+2 minutes else @@ -822,9 +850,12 @@ void Battleground::EndBattleground(uint32 winner) if (team == winner) { // update achievement BEFORE personal rating update - ArenaTeamMember* member = winner_arena_team->GetMember(player->GetGUID()); - if (member) - player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, 1); + if (ArenaTeamMember* member = winner_arena_team->GetMember(player->GetGUID())) + { + uint32 rating = player->GetArenaPersonalRating(winner_arena_team->GetSlot()); + player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, + rating ? rating : 1); + } winner_arena_team->MemberWon(player, loser_matchmaker_rating, winner_matchmaker_change); } @@ -1465,9 +1496,8 @@ void Battleground::DoorClose(uint32 type) // If doors are open, close it if (obj->getLootState() == GO_ACTIVATED && obj->GetGoState() != GO_STATE_READY) { - // Change state to allow door to be closed obj->SetLootState(GO_READY); - obj->UseDoorOrButton(RESPAWN_ONE_DAY); + obj->SetGoState(GO_STATE_READY); } } else @@ -1479,9 +1509,8 @@ void Battleground::DoorOpen(uint32 type) { if (GameObject* obj = GetBgMap()->GetGameObject(BgObjects[type])) { - // Change state to be sure they will be opened - obj->SetLootState(GO_READY); - obj->UseDoorOrButton(RESPAWN_ONE_DAY); + obj->SetLootState(GO_ACTIVATED); + obj->SetGoState(GO_STATE_ACTIVE); } else sLog->outError("Battleground::DoorOpen: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h index 32f6ebc92de..01dfbb23033 100755 --- a/src/server/game/Battlegrounds/Battleground.h +++ b/src/server/game/Battlegrounds/Battleground.h @@ -443,6 +443,8 @@ class Battleground Z = m_TeamStartLocZ[idx]; O = m_TeamStartLocO[idx]; } + void SetStartMaxDist(float startMaxDist) { m_StartMaxDist = startMaxDist; } + float GetStartMaxDist() const { return m_StartMaxDist; } // Packet Transfer // method that should fill worldpacket with actual world states (not yet implemented for all battlegrounds!) @@ -617,6 +619,7 @@ class Battleground uint32 m_ClientInstanceID; // the instance-id which is sent to the client and without any other internal use uint32 m_StartTime; uint32 m_ResetStatTimer; + uint32 m_ValidStartPositionTimer; int32 m_EndTime; // it is set to 120000 when bg is ending and it decreases itself uint32 m_LastResurrectTime; BattlegroundBracketId m_BracketId; @@ -698,6 +701,7 @@ class Battleground float m_TeamStartLocY[BG_TEAMS_COUNT]; float m_TeamStartLocZ[BG_TEAMS_COUNT]; float m_TeamStartLocO[BG_TEAMS_COUNT]; + float m_StartMaxDist; uint32 ScriptId; }; #endif diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index eac876a71d5..167933b9c0c 100755 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -660,6 +660,7 @@ uint32 BattlegroundMgr::CreateBattleground(CreateBattlegroundData& data) bg->SetName(data.BattlegroundName); bg->SetTeamStartLoc(ALLIANCE, data.Team1StartLocX, data.Team1StartLocY, data.Team1StartLocZ, data.Team1StartLocO); bg->SetTeamStartLoc(HORDE, data.Team2StartLocX, data.Team2StartLocY, data.Team2StartLocZ, data.Team2StartLocO); + bg->SetStartMaxDist(data.StartMaxDist); bg->SetLevelRange(data.LevelMin, data.LevelMax); bg->SetScriptId(data.scriptId); @@ -677,8 +678,8 @@ void BattlegroundMgr::CreateInitialBattlegrounds() uint8 selectionWeight; BattlemasterListEntry const* bl; - // 0 1 2 3 4 5 6 7 8 9 10 - QueryResult result = WorldDatabase.Query("SELECT id, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, AllianceStartLoc, AllianceStartO, HordeStartLoc, HordeStartO, Weight, ScriptName FROM battleground_template"); + // 0 1 2 3 4 5 6 7 8 9 10 11 + QueryResult result = WorldDatabase.Query("SELECT id, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, AllianceStartLoc, AllianceStartO, HordeStartLoc, HordeStartO, StartMaxDist, Weight, ScriptName FROM battleground_template"); if (!result) { @@ -708,21 +709,24 @@ void BattlegroundMgr::CreateInitialBattlegrounds() CreateBattlegroundData data; data.bgTypeId = BattlegroundTypeId(bgTypeID_); data.IsArena = (bl->type == TYPE_ARENA); - data.MinPlayersPerTeam = fields[1].GetUInt32(); - data.MaxPlayersPerTeam = fields[2].GetUInt32(); - data.LevelMin = fields[3].GetUInt32(); - data.LevelMax = fields[4].GetUInt32(); - //check values from DB - if (data.MaxPlayersPerTeam == 0 || data.MinPlayersPerTeam == 0 || data.MinPlayersPerTeam > data.MaxPlayersPerTeam) + data.MinPlayersPerTeam = fields[1].GetUInt16(); + data.MaxPlayersPerTeam = fields[2].GetUInt16(); + data.LevelMin = fields[3].GetUInt8(); + data.LevelMax = fields[4].GetUInt8(); + + // check values from DB + if (data.MaxPlayersPerTeam == 0 || data.MinPlayersPerTeam > data.MaxPlayersPerTeam) { - data.MinPlayersPerTeam = 0; // by default now expected strong full bg requirement - data.MaxPlayersPerTeam = 40; + sLog->outErrorDb("Table `battleground_template` for id %u has bad values for MinPlayersPerTeam (%u) and MaxPlayersPerTeam(%u)", + data.bgTypeId, data.MinPlayersPerTeam, data.MaxPlayersPerTeam); + continue; } + if (data.LevelMin == 0 || data.LevelMax == 0 || data.LevelMin > data.LevelMax) { - //TO-DO: FIX ME - data.LevelMin = 0;//bl->minlvl; - data.LevelMax = 80;//bl->maxlvl; + sLog->outErrorDb("Table `battleground_template` for id %u has bad values for LevelMin (%u) and LevelMax(%u)", + data.bgTypeId, data.LevelMin, data.LevelMax); + continue; } startId = fields[5].GetUInt32(); @@ -767,9 +771,10 @@ void BattlegroundMgr::CreateInitialBattlegrounds() continue; } - selectionWeight = fields[9].GetUInt8(); - data.scriptId = sObjectMgr->GetScriptId(fields[10].GetCString()); + data.StartMaxDist = fields[9].GetFloat(); + //data.BattlegroundName = bl->name[sWorld->GetDefaultDbcLocale()]; + data.scriptId = sObjectMgr->GetScriptId(fields[10].GetCString()); data.MapID = bl->mapid[0]; if (!CreateBattleground(data)) diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.h b/src/server/game/Battlegrounds/BattlegroundMgr.h index b40f7bcbe91..dd502409178 100755 --- a/src/server/game/Battlegrounds/BattlegroundMgr.h +++ b/src/server/game/Battlegrounds/BattlegroundMgr.h @@ -50,6 +50,7 @@ struct CreateBattlegroundData float Team2StartLocY; float Team2StartLocZ; float Team2StartLocO; + float StartMaxDist; uint32 scriptId; }; diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp index a5b00ed9db1..6f4264c0faf 100755 --- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp +++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp @@ -129,7 +129,7 @@ bool BattlegroundQueue::SelectionPool::AddGroup(GroupQueueInfo* ginfo, uint32 de // add group or player (grp == NULL) to bg queue with the given leader and bg specifications GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, BattlegroundTypeId BgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 ArenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 MatchmakerRating, uint32 arenateamid) { - BattlegroundBracketId bracketId = bracketEntry->GetBracketId(); + BattlegroundBracketId bracketId = bracketEntry->GetBracketId(); // create new ginfo GroupQueueInfo* ginfo = new GroupQueueInfo; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp index 71f0ce29aec..d28f5ddfe6a 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp @@ -290,7 +290,7 @@ int32 BattlegroundAB::_GetNodeNameId(uint8 node) case BG_AB_NODE_LUMBER_MILL:return LANG_BG_AB_NODE_LUMBER_MILL; case BG_AB_NODE_GOLD_MINE: return LANG_BG_AB_NODE_GOLD_MINE; default: - ASSERT(0); + ASSERT(false); } return 0; } @@ -549,7 +549,7 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ bool BattlegroundAB::SetupBattleground() { - for (int i = 0 ; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) + for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) { if (!AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + 8*i, BG_AB_OBJECTID_NODE_BANNER_0 + i, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY) || !AddObject(BG_AB_OBJECT_BANNER_CONT_A + 8*i, BG_AB_OBJECTID_BANNER_CONT_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h index 50020a580b1..2cac5df73a9 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h @@ -184,7 +184,8 @@ enum BG_AB_Objectives #define AB_EVENT_START_BATTLE 9158 // Achievement: Let's Get This Done // x, y, z, o -const float BG_AB_NodePositions[BG_AB_DYNAMIC_NODES_COUNT][4] = { +const float BG_AB_NodePositions[BG_AB_DYNAMIC_NODES_COUNT][4] = +{ {1166.785f, 1200.132f, -56.70859f, 0.9075713f}, // stables {977.0156f, 1046.616f, -44.80923f, -2.600541f}, // blacksmith {806.1821f, 874.2723f, -55.99371f, -2.303835f}, // farm @@ -193,7 +194,8 @@ const float BG_AB_NodePositions[BG_AB_DYNAMIC_NODES_COUNT][4] = { }; // x, y, z, o, rot0, rot1, rot2, rot3 -const float BG_AB_DoorPositions[2][8] = { +const float BG_AB_DoorPositions[2][8] = +{ {1284.597f, 1281.167f, -15.97792f, 0.7068594f, 0.012957f, -0.060288f, 0.344959f, 0.93659f}, {708.0903f, 708.4479f, -17.8342f, -2.391099f, 0.050291f, 0.015127f, 0.929217f, -0.365784f} }; @@ -206,7 +208,8 @@ const uint32 BG_AB_TickPoints[6] = {0, 10, 10, 10, 10, 30}; const uint32 BG_AB_GraveyardIds[BG_AB_ALL_NODES_COUNT] = {895, 894, 893, 897, 896, 898, 899}; // x, y, z, o -const float BG_AB_BuffPositions[BG_AB_DYNAMIC_NODES_COUNT][4] = { +const float BG_AB_BuffPositions[BG_AB_DYNAMIC_NODES_COUNT][4] = +{ {1185.71f, 1185.24f, -56.36f, 2.56f}, // stables {990.75f, 1008.18f, -42.60f, 2.43f}, // blacksmith {817.66f, 843.34f, -56.54f, 3.01f}, // farm @@ -215,7 +218,8 @@ const float BG_AB_BuffPositions[BG_AB_DYNAMIC_NODES_COUNT][4] = { }; // x, y, z, o -const float BG_AB_SpiritGuidePos[BG_AB_ALL_NODES_COUNT][4] = { +const float BG_AB_SpiritGuidePos[BG_AB_ALL_NODES_COUNT][4] = +{ {1200.03f, 1171.09f, -56.47f, 5.15f}, // stables {1017.43f, 960.61f, -42.95f, 4.88f}, // blacksmith {833.00f, 793.00f, -57.25f, 5.27f}, // farm diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index 801b522feab..d2cbab2be54 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -1032,17 +1032,18 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object) std::vector<uint64> ghost_list = m_ReviveQueue[BgCreatures[node]]; if (!ghost_list.empty()) { - Player* player; - WorldSafeLocsEntry const* ClosestGrave = NULL; + Player* waitingPlayer; // player waiting at graveyard for resurrection + WorldSafeLocsEntry const* closestGrave = NULL; for (std::vector<uint64>::iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr) { - player = ObjectAccessor::FindPlayer(*ghost_list.begin()); - if (!player) + waitingPlayer = ObjectAccessor::FindPlayer(*ghost_list.begin()); + if (!waitingPlayer) continue; - if (!ClosestGrave) - ClosestGrave = GetClosestGraveYard(player); + + if (!closestGrave) + closestGrave = GetClosestGraveYard(waitingPlayer); else - player->TeleportTo(GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, player->GetOrientation()); + waitingPlayer->TeleportTo(GetMapId(), closestGrave->x, closestGrave->y, closestGrave->z, player->GetOrientation()); } m_ReviveQueue[BgCreatures[node]].clear(); } @@ -1207,7 +1208,7 @@ bool BattlegroundAV::SetupBattleground() } //spawn node-objects - for (uint8 i = BG_AV_NODES_FIRSTAID_STATION ; i < BG_AV_NODES_MAX; ++i) + for (uint8 i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i) { if (i <= BG_AV_NODES_FROSTWOLF_HUT) { @@ -1292,7 +1293,7 @@ bool BattlegroundAV::SetupBattleground() return false; } } - for (uint16 i= 0 ; i <= (BG_AV_OBJECT_MINE_SUPPLY_S_MAX-BG_AV_OBJECT_MINE_SUPPLY_S_MIN); i++) + for (uint16 i= 0; i <= (BG_AV_OBJECT_MINE_SUPPLY_S_MAX-BG_AV_OBJECT_MINE_SUPPLY_S_MIN); i++) { if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_S_MIN+i, BG_AV_OBJECTID_MINE_S, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), RESPAWN_ONE_DAY)) { @@ -1323,30 +1324,39 @@ bool BattlegroundAV::SetupBattleground() // Initial Nodes for (i = 0; i < BG_AV_OBJECT_MAX; i++) SpawnBGObject(i, RESPAWN_ONE_DAY); - for (i = BG_AV_OBJECT_FLAG_A_FIRSTAID_STATION; i <= BG_AV_OBJECT_FLAG_A_STONEHEART_GRAVE ; i++){ + + for (i = BG_AV_OBJECT_FLAG_A_FIRSTAID_STATION; i <= BG_AV_OBJECT_FLAG_A_STONEHEART_GRAVE; i++) + { SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+3*i, RESPAWN_IMMEDIATELY); SpawnBGObject(i, RESPAWN_IMMEDIATELY); } - for (i = BG_AV_OBJECT_FLAG_A_DUNBALDAR_SOUTH; i <= BG_AV_OBJECT_FLAG_A_STONEHEART_BUNKER ; i++) + + for (i = BG_AV_OBJECT_FLAG_A_DUNBALDAR_SOUTH; i <= BG_AV_OBJECT_FLAG_A_STONEHEART_BUNKER; i++) SpawnBGObject(i, RESPAWN_IMMEDIATELY); - for (i = BG_AV_OBJECT_FLAG_H_ICEBLOOD_GRAVE; i <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_WTOWER ; i++){ + + for (i = BG_AV_OBJECT_FLAG_H_ICEBLOOD_GRAVE; i <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_WTOWER; i++) + { SpawnBGObject(i, RESPAWN_IMMEDIATELY); if (i <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_HUT) SpawnBGObject(BG_AV_OBJECT_AURA_H_FIRSTAID_STATION+3*GetNodeThroughObject(i), RESPAWN_IMMEDIATELY); } + for (i = BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH; i <= BG_AV_OBJECT_TFLAG_A_STONEHEART_BUNKER; i+=2) { SpawnBGObject(i, RESPAWN_IMMEDIATELY); //flag SpawnBGObject(i+16, RESPAWN_IMMEDIATELY); //aura } + for (i = BG_AV_OBJECT_TFLAG_H_ICEBLOOD_TOWER; i <= BG_AV_OBJECT_TFLAG_H_FROSTWOLF_WTOWER; i+=2) { SpawnBGObject(i, RESPAWN_IMMEDIATELY); //flag SpawnBGObject(i+16, RESPAWN_IMMEDIATELY); //aura } + //snowfall and the doors for (i = BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE; i <= BG_AV_OBJECT_DOOR_A; i++) SpawnBGObject(i, RESPAWN_IMMEDIATELY); + SpawnBGObject(BG_AV_OBJECT_AURA_N_SNOWFALL_GRAVE, RESPAWN_IMMEDIATELY); //creatures @@ -1471,7 +1481,7 @@ void BattlegroundAV::ResetBGSubclass() { for (uint8 j=0; j<9; j++) m_Team_QuestStatus[i][j]=0; - m_Team_Scores[i]=BG_AV_SCORE_INITIAL_POINTS; + m_Team_Scores[i]=BG_AV_SCORE_INITIAL_POINTS; m_IsInformedNearVictory[i]=false; m_CaptainAlive[i] = true; m_CaptainBuffTimer[i] = 120000 + urand(0, 4)* 60; //as far as i could see, the buff is randomly so i make 2minutes (thats the duration of the buff itself) + 0-4minutes TODO get the right times @@ -1492,7 +1502,6 @@ void BattlegroundAV::ResetBGSubclass() for (uint16 i = 0; i < AV_CPLACE_MAX+AV_STATICCPLACE_MAX; i++) if (BgCreatures[i]) DelCreature(i); - } bool BattlegroundAV::IsBothMinesControlledByTeam(uint32 team) const @@ -1552,4 +1561,4 @@ bool BattlegroundAV::IsAllTowersControlledAndCaptainAlive(uint32 team) const } return false; -}
\ No newline at end of file +} diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h index 82e231c63fa..f073b69a779 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h @@ -356,7 +356,9 @@ enum BG_AV_OBJECTS AV_OPLACE_MAX = 149 }; -const float BG_AV_ObjectPos[AV_OPLACE_MAX][4] = { + +const float BG_AV_ObjectPos[AV_OPLACE_MAX][4] = +{ {638.592f, -32.422f, 46.0608f, -1.62316f }, //firstaid station {669.007f, -294.078f, 30.2909f, 2.77507f }, //stormpike {77.8013f, -404.7f, 46.7549f, -0.872665f }, //stone grave @@ -527,7 +529,8 @@ const float BG_AV_ObjectPos[AV_OPLACE_MAX][4] = { {-951.394f, -193.695f, 67.634f, 0.802851f} }; -const float BG_AV_DoorPositons[2][4] = { +const float BG_AV_DoorPositons[2][4] = +{ {780.487f, -493.024f, 99.9553f, 3.0976f}, //alliance {-1375.193f, -538.981f, 55.2824f, 0.72178f} //horde }; @@ -623,7 +626,8 @@ enum BG_AV_CreaturePlace }; //x, y, z, o -const float BG_AV_CreaturePos[AV_CPLACE_MAX][4] = { +const float BG_AV_CreaturePos[AV_CPLACE_MAX][4] = +{ //spiritguides {643.000000f, 44.000000f, 69.740196f, -0.001854f}, {676.000000f, -374.000000f, 30.000000f, -0.001854f}, @@ -1039,7 +1043,8 @@ enum BG_AV_CreatureIds //entry, team, minlevel, maxlevel //TODO this array should be removed, the only needed things are the entrys (for spawning(?) and handlekillunit) -const uint32 BG_AV_CreatureInfo[AV_NPC_INFO_MAX][4] = { +const uint32 BG_AV_CreatureInfo[AV_NPC_INFO_MAX][4] = +{ { 12050, 1216, 58, 58 }, //Stormpike Defender { 13326, 1216, 59, 59 }, //Seasoned Defender { 13331, 1216, 60, 60 }, //Veteran Defender @@ -1099,7 +1104,9 @@ const uint32 BG_AV_CreatureInfo[AV_NPC_INFO_MAX][4] = { }; //x, y, z, o, static_creature_info-id -const float BG_AV_StaticCreaturePos[AV_STATICCPLACE_MAX][5] = { //static creatures +const float BG_AV_StaticCreaturePos[AV_STATICCPLACE_MAX][5] = +{ + //static creatures {-1235.31f, -340.777f, 60.5088f, 3.31613f, 0 }, //2225 - Zora Guthrek {-1244.02f, -323.795f, 61.0485f, 5.21853f, 1 }, //3343 - Grelkor {-1235.16f, -332.302f, 60.2985f, 2.96706f, 2 }, //3625 - Rarck @@ -1226,7 +1233,8 @@ const float BG_AV_StaticCreaturePos[AV_STATICCPLACE_MAX][5] = { //static creatur }; -const uint32 BG_AV_StaticCreatureInfo[51][4] = { +const uint32 BG_AV_StaticCreatureInfo[51][4] = +{ { 2225, 1215, 55, 55 }, //Zora Guthrek { 3343, 1215, 55, 55 }, //Grelkor { 3625, 1215, 55, 55 }, //Rarck @@ -1293,16 +1301,17 @@ enum BG_AV_Graveyards AV_GRAVE_MAIN_HORDE = 610 }; -const uint32 BG_AV_GraveyardIds[9]= { - AV_GRAVE_STORM_AID, - AV_GRAVE_STORM_GRAVE, - AV_GRAVE_STONE_GRAVE, - AV_GRAVE_SNOWFALL, - AV_GRAVE_ICE_GRAVE, - AV_GRAVE_FROSTWOLF, - AV_GRAVE_FROST_HUT, - AV_GRAVE_MAIN_ALLIANCE, - AV_GRAVE_MAIN_HORDE +const uint32 BG_AV_GraveyardIds[9]= +{ + AV_GRAVE_STORM_AID, + AV_GRAVE_STORM_GRAVE, + AV_GRAVE_STONE_GRAVE, + AV_GRAVE_SNOWFALL, + AV_GRAVE_ICE_GRAVE, + AV_GRAVE_FROSTWOLF, + AV_GRAVE_FROST_HUT, + AV_GRAVE_MAIN_ALLIANCE, + AV_GRAVE_MAIN_HORDE }; enum BG_AV_BUFF @@ -1434,13 +1443,15 @@ enum BG_AV_WorldStates }; //alliance_control neutral_control horde_control -const uint32 BG_AV_MineWorldStates[2][3] = { +const uint32 BG_AV_MineWorldStates[2][3] = +{ {1358, 1360, 1359}, {1355, 1357, 1356} }; //alliance_control alliance_assault h_control h_assault -const uint32 BG_AV_NodeWorldStates[16][4] = { +const uint32 BG_AV_NodeWorldStates[16][4] = +{ //Stormpike first aid station {1325, 1326, 1327, 1328}, //Stormpike Graveyard diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp index d24058cdd8a..ccc6a2305b4 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp @@ -27,6 +27,7 @@ BattlegroundDS::BattlegroundDS() { BgObjects.resize(BG_DS_OBJECT_MAX); + BgCreatures.resize(BG_DS_NPC_MAX); StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; @@ -49,6 +50,34 @@ void BattlegroundDS::PostUpdateImpl(uint32 diff) if (GetStatus() != STATUS_IN_PROGRESS) return; + if (getPipeKnockBackCount() < BG_DS_PIPE_KNOCKBACK_TOTAL_COUNT) + { + if (getPipeKnockBackTimer() < diff) + { + for (uint32 i = BG_DS_NPC_PIPE_KNOCKBACK_1; i <= BG_DS_NPC_PIPE_KNOCKBACK_2; ++i) + if (Creature* waterSpout = GetBgMap()->GetCreature(BgCreatures[i])) + waterSpout->CastSpell(waterSpout, BG_DS_SPELL_FLUSH, true); + + setPipeKnockBackCount(getPipeKnockBackCount() + 1); + setPipeKnockBackTimer(BG_DS_PIPE_KNOCKBACK_DELAY); + } + else + setPipeKnockBackTimer(getPipeKnockBackTimer() - diff); + } + + if (getWaterFallStatus() == BG_DS_WATERFALL_STATUS_ON) // Repeat knockback while the waterfall still active + { + if (getWaterFallKnockbackTimer() < diff) + { + if (Creature* waterSpout = GetBgMap()->GetCreature(BgCreatures[BG_DS_NPC_WATERFALL_KNOCKBACK])) + waterSpout->CastSpell(waterSpout, BG_DS_SPELL_WATER_SPOUT, true); + + setWaterFallKnockbackTimer(BG_DS_WATERFALL_KNOCKBACK_TIMER); + } + else + setWaterFallKnockbackTimer(getWaterFallKnockbackTimer() - diff); + } + if (getWaterFallTimer() < diff) { if (getWaterFallStatus() == BG_DS_WATERFALL_STATUS_OFF) // Add the water @@ -57,13 +86,14 @@ void BattlegroundDS::PostUpdateImpl(uint32 diff) setWaterFallTimer(BG_DS_WATERFALL_WARNING_DURATION); setWaterFallStatus(BG_DS_WATERFALL_STATUS_WARNING); } - else if (getWaterFallStatus() == BG_DS_WATERFALL_STATUS_WARNING) // Active collision + else if (getWaterFallStatus() == BG_DS_WATERFALL_STATUS_WARNING) // Active collision and start knockback timer { if (GameObject* gob = GetBgMap()->GetGameObject(BgObjects[BG_DS_OBJECT_WATER_1])) gob->SetGoState(GO_STATE_READY); setWaterFallTimer(BG_DS_WATERFALL_DURATION); setWaterFallStatus(BG_DS_WATERFALL_STATUS_ON); + setWaterFallKnockbackTimer(BG_DS_WATERFALL_KNOCKBACK_TIMER); } else //if (getWaterFallStatus() == BG_DS_WATERFALL_STATUS_ON) // Remove collision and water { @@ -97,12 +127,21 @@ void BattlegroundDS::StartingEventOpenDoors() setWaterFallTimer(urand(BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX)); setWaterFallStatus(BG_DS_WATERFALL_STATUS_OFF); + setPipeKnockBackTimer(BG_DS_PIPE_KNOCKBACK_FIRST_DELAY); + setPipeKnockBackCount(0); + SpawnBGObject(BG_DS_OBJECT_WATER_2, RESPAWN_IMMEDIATELY); DoorOpen(BG_DS_OBJECT_WATER_2); // Turn off collision if (GameObject* gob = GetBgMap()->GetGameObject(BgObjects[BG_DS_OBJECT_WATER_1])) gob->SetGoState(GO_STATE_ACTIVE); + + // Remove effects of Demonic Circle Summon + for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) + if (Player* player = ObjectAccessor::FindPlayer(itr->first)) + if (player->HasAura(48018)) + player->RemoveAurasDueToSpell(48018); } void BattlegroundDS::AddPlayer(Player* player) @@ -151,6 +190,14 @@ void BattlegroundDS::HandleAreaTrigger(Player* Source, uint32 Trigger) { case 5347: case 5348: + // Remove effects of Demonic Circle Summon + if (Source->HasAura(48018)) + Source->RemoveAurasDueToSpell(48018); + + // Someone has get back into the pipes and the knockback has already been performed, + // so we reset the knockback count for kicking the player again into the arena. + if (getPipeKnockBackCount() >= BG_DS_PIPE_KNOCKBACK_TOTAL_COUNT) + setPipeKnockBackCount(0); break; default: sLog->outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); @@ -187,7 +234,11 @@ bool BattlegroundDS::SetupBattleground() || !AddObject(BG_DS_OBJECT_WATER_2, BG_DS_OBJECT_TYPE_WATER_2, 1291.56f, 790.837f, 7.1f, 3.14238f, 0, 0, 0.694215f, -0.719768f, 120) // buffs || !AddObject(BG_DS_OBJECT_BUFF_1, BG_DS_OBJECT_TYPE_BUFF_1, 1291.7f, 813.424f, 7.11472f, 4.64562f, 0, 0, 0.730314f, -0.683111f, 120) - || !AddObject(BG_DS_OBJECT_BUFF_2, BG_DS_OBJECT_TYPE_BUFF_2, 1291.7f, 768.911f, 7.11472f, 1.55194f, 0, 0, 0.700409f, 0.713742f, 120)) + || !AddObject(BG_DS_OBJECT_BUFF_2, BG_DS_OBJECT_TYPE_BUFF_2, 1291.7f, 768.911f, 7.11472f, 1.55194f, 0, 0, 0.700409f, 0.713742f, 120) + // knockback creatures + || !AddCreature(BG_DS_NPC_TYPE_WATER_SPOUT, BG_DS_NPC_WATERFALL_KNOCKBACK, 0, 1292.587f, 790.2205f, 7.19796f, 3.054326f, RESPAWN_IMMEDIATELY) + || !AddCreature(BG_DS_NPC_TYPE_WATER_SPOUT, BG_DS_NPC_PIPE_KNOCKBACK_1, 0, 1369.977f, 817.2882f, 16.08718f, 3.106686f, RESPAWN_IMMEDIATELY) + || !AddCreature(BG_DS_NPC_TYPE_WATER_SPOUT, BG_DS_NPC_PIPE_KNOCKBACK_2, 0, 1212.833f, 765.3871f, 16.09484f, 0.0f, RESPAWN_IMMEDIATELY)) { sLog->outErrorDb("BatteGroundDS: Failed to spawn some object!"); return false; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h index 7efc6e1caa7..aaf08ba1313 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h @@ -42,12 +42,37 @@ enum BattlegroundDSObjects BG_DS_OBJECT_TYPE_BUFF_2 = 184664 }; +enum BattlegroundDSCreatureTypes +{ + BG_DS_NPC_WATERFALL_KNOCKBACK = 0, + BG_DS_NPC_PIPE_KNOCKBACK_1 = 1, + BG_DS_NPC_PIPE_KNOCKBACK_2 = 2, + BG_DS_NPC_MAX = 3 +}; + +enum BattlegroundDSCreatures +{ + BG_DS_NPC_TYPE_WATER_SPOUT = 28567, +}; + +enum BattlegroundDSSpells +{ + BG_DS_SPELL_FLUSH = 57405, // Visual and target selector for the starting knockback from the pipe + BG_DS_SPELL_FLUSH_KNOCKBACK = 61698, // Knockback effect for previous spell (triggered, not need to be casted) + BG_DS_SPELL_WATER_SPOUT = 58873, // Knockback effect of the central waterfall +}; + enum BattlegroundDSData { // These values are NOT blizzlike... need the correct data! BG_DS_WATERFALL_TIMER_MIN = 30000, BG_DS_WATERFALL_TIMER_MAX = 60000, - BG_DS_WATERFALL_WARNING_DURATION = 7000, - BG_DS_WATERFALL_DURATION = 10000, + BG_DS_WATERFALL_WARNING_DURATION = 5000, + BG_DS_WATERFALL_DURATION = 30000, + BG_DS_WATERFALL_KNOCKBACK_TIMER = 1500, + + BG_DS_PIPE_KNOCKBACK_FIRST_DELAY = 5000, + BG_DS_PIPE_KNOCKBACK_DELAY = 3000, + BG_DS_PIPE_KNOCKBACK_TOTAL_COUNT = 2, BG_DS_WATERFALL_STATUS_WARNING = 1, // Water starting to fall, but no LoS Blocking nor movement blocking BG_DS_WATERFALL_STATUS_ON = 2, // LoS and Movement blocking active @@ -83,12 +108,21 @@ class BattlegroundDS : public Battleground private: uint32 _waterfallTimer; uint8 _waterfallStatus; + uint32 _waterfallKnockbackTimer; + uint32 _pipeKnockBackTimer; + uint8 _pipeKnockBackCount; virtual void PostUpdateImpl(uint32 diff); protected: uint32 getWaterFallStatus() { return _waterfallStatus; }; - void setWaterFallStatus(uint32 status) { _waterfallStatus = status; }; - void setWaterFallTimer(uint32 timer) { _waterfallTimer = timer; }; + void setWaterFallStatus(uint8 status) { _waterfallStatus = status; }; uint32 getWaterFallTimer() { return _waterfallTimer; }; + void setWaterFallTimer(uint32 timer) { _waterfallTimer = timer; }; + uint32 getWaterFallKnockbackTimer() { return _waterfallKnockbackTimer; }; + void setWaterFallKnockbackTimer(uint32 timer) { _waterfallKnockbackTimer = timer; }; + uint8 getPipeKnockBackCount() { return _pipeKnockBackCount; }; + void setPipeKnockBackCount(uint8 count) { _pipeKnockBackCount = count; }; + uint32 getPipeKnockBackTimer() { return _pipeKnockBackTimer; }; + void setPipeKnockBackTimer(uint32 timer) { _pipeKnockBackTimer = timer; }; }; #endif diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp index 344dc79fe79..8269a04a383 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp @@ -29,7 +29,8 @@ #include "Util.h" // these variables aren't used outside of this file, so declare them only here -uint32 BG_EY_HonorScoreTicks[BG_HONOR_MODE_NUM] = { +uint32 BG_EY_HonorScoreTicks[BG_HONOR_MODE_NUM] = +{ 260, // normal honor 160 // holiday }; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h index 026fbccc320..534a40484ce 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h @@ -258,7 +258,8 @@ struct BattlegroundEYPointIconsStruct }; // x, y, z, o -const float BG_EY_TriggerPositions[EY_POINTS_MAX][4] = { +const float BG_EY_TriggerPositions[EY_POINTS_MAX][4] = +{ {2044.28f, 1729.68f, 1189.96f, 0.017453f}, // FEL_REAVER center {2048.83f, 1393.65f, 1194.49f, 0.20944f}, // BLOOD_ELF center {2286.56f, 1402.36f, 1197.11f, 3.72381f}, // DRAENEI_RUINS center @@ -326,7 +327,7 @@ const BattlegroundEYCapturingPointStruct m_CapturingPointTypes[EY_POINTS_MAX] = class BattlegroundEYScore : public BattlegroundScore { public: - BattlegroundEYScore () : FlagCaptures(0) {}; + BattlegroundEYScore() : FlagCaptures(0) {}; virtual ~BattlegroundEYScore() {}; uint32 FlagCaptures; }; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp index c72fcfdb3a7..47ea9915ac7 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp @@ -47,7 +47,7 @@ BattlegroundIC::BattlegroundIC() resourceTimer = IC_RESOURCE_TIME; for (uint8 i = NODE_TYPE_REFINERY; i < MAX_NODE_TYPES; i++) - nodePoint[i] = nodePointInitial[i]; + nodePoint[i] = nodePointInitial[i]; siegeEngineWorkshopTimer = WORKSHOP_UPDATE_TIME; @@ -359,7 +359,7 @@ void BattlegroundIC::FillInitialWorldStates(WorldPacket& data) data << uint32(uws) << uint32(1); } - for (uint8 i = 0 ; i < MAX_NODE_TYPES ; i++) + for (uint8 i = 0; i < MAX_NODE_TYPES; i++) data << uint32(nodePoint[i].worldStates[nodePoint[i].nodeState]) << uint32(1); } @@ -837,6 +837,7 @@ void BattlegroundIC::DestroyGate(Player* player, GameObject* go) { case GO_HORDE_GATE_1: lang_entry = LANG_BG_IC_NORTH_GATE_DESTROYED; + break; case GO_HORDE_GATE_2: case GO_ALLIANCE_GATE_1: lang_entry = LANG_BG_IC_WEST_GATE_DESTROYED; @@ -926,11 +927,11 @@ Transport* BattlegroundIC::CreateTransport(uint32 goEntry, uint32 period) float x = t->m_WayPoints[0].x; float y = t->m_WayPoints[0].y; - float z = t->m_WayPoints[0].z; + float z = t->m_WayPoints[0].z; float o = 1; // creates the Gameobject - if (!t->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_MO_TRANSPORT), goEntry, mapid, x, y, z, o, 100, 0)) + if (!t->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_MO_TRANSPORT), goEntry, mapid, x, y, z, o, 255, 0)) { delete t; return NULL; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp index 98bb704661e..6869a899305 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp @@ -32,7 +32,7 @@ BattlegroundRV::BattlegroundRV() StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; - //we must set messageIds + // we must set messageIds StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE; StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS; StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; @@ -46,40 +46,32 @@ BattlegroundRV::~BattlegroundRV() void BattlegroundRV::PostUpdateImpl(uint32 diff) { + if (GetStatus() != STATUS_IN_PROGRESS) + return; + if (getTimer() < diff) { switch (getState()) { case BG_RV_STATE_OPEN_FENCES: - setTimer(BG_RV_PILAR_TO_FIRE_TIMER); + // Open fire (only at game start) + for (uint8 i = BG_RV_OBJECT_FIRE_1; i <= BG_RV_OBJECT_FIREDOOR_2; ++i) + DoorOpen(i); + setTimer(BG_RV_CLOSE_FIRE_TIMER); setState(BG_RV_STATE_CLOSE_FIRE); break; case BG_RV_STATE_CLOSE_FIRE: for (uint8 i = BG_RV_OBJECT_FIRE_1; i <= BG_RV_OBJECT_FIREDOOR_2; ++i) DoorClose(i); - setTimer(BG_RV_FIRE_TO_PILAR_TIMER); - setState(BG_RV_STATE_OPEN_PILARS); + // Fire got closed after five seconds, leaves twenty seconds before toggling pillars + setTimer(BG_RV_FIRE_TO_PILLAR_TIMER); + setState(BG_RV_STATE_SWITCH_PILLARS); break; - case BG_RV_STATE_OPEN_PILARS: + case BG_RV_STATE_SWITCH_PILLARS: for (uint8 i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_PULLEY_2; ++i) DoorOpen(i); - TogglePillarCollision(false); - setTimer(BG_RV_PILAR_TO_FIRE_TIMER); - setState(BG_RV_STATE_OPEN_FIRE); - break; - case BG_RV_STATE_OPEN_FIRE: - // FIXME: after 3.2.0 it's only decorative and should be opened only one time at battle start - for (uint8 i = BG_RV_OBJECT_FIRE_1; i <= BG_RV_OBJECT_FIREDOOR_2; ++i) - DoorOpen(i); - setTimer(BG_RV_FIRE_TO_PILAR_TIMER); - setState(BG_RV_STATE_CLOSE_PILARS); - break; - case BG_RV_STATE_CLOSE_PILARS: - for (uint8 i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_PULLEY_2; ++i) - DoorOpen(i); - TogglePillarCollision(true); - setTimer(BG_RV_PILAR_TO_FIRE_TIMER); - setState(BG_RV_STATE_CLOSE_FIRE); + TogglePillarCollision(); + setTimer(BG_RV_PILLAR_SWITCH_TIMER); break; } } @@ -103,7 +95,9 @@ void BattlegroundRV::StartingEventOpenDoors() setState(BG_RV_STATE_OPEN_FENCES); setTimer(BG_RV_FIRST_TIMER); - TogglePillarCollision(true); + // Should be false at first, TogglePillarCollision will do it. + SetPillarCollision(true); + TogglePillarCollision(); } void BattlegroundRV::AddPlayer(Player* player) @@ -227,8 +221,10 @@ bool BattlegroundRV::SetupBattleground() } -void BattlegroundRV::TogglePillarCollision(bool apply) +void BattlegroundRV::TogglePillarCollision() { + bool apply = GetPillarCollision(); + for (uint8 i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_PILAR_COLLISION_4; ++i) { if (GameObject* gob = GetBgMap()->GetGameObject(BgObjects[i])) @@ -249,4 +245,6 @@ void BattlegroundRV::TogglePillarCollision(bool apply) gob->SendUpdateToPlayer(player); } } + + SetPillarCollision(!apply); }
\ No newline at end of file diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h index 1dfd4825c8f..8c5746931e3 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h @@ -79,12 +79,12 @@ enum BattlegroundRVObjects enum BattlegroundRVData { BG_RV_STATE_OPEN_FENCES, - BG_RV_STATE_OPEN_PILARS, - BG_RV_STATE_CLOSE_PILARS, - BG_RV_STATE_OPEN_FIRE, + BG_RV_STATE_SWITCH_PILLARS, BG_RV_STATE_CLOSE_FIRE, - BG_RV_FIRE_TO_PILAR_TIMER = 20000, - BG_RV_PILAR_TO_FIRE_TIMER = 5000, + + BG_RV_PILLAR_SWITCH_TIMER = 25000, + BG_RV_FIRE_TO_PILLAR_TIMER = 20000, + BG_RV_CLOSE_FIRE_TIMER = 5000, BG_RV_FIRST_TIMER = 20133, BG_RV_WORLD_STATE_A = 0xe10, BG_RV_WORLD_STATE_H = 0xe11, @@ -120,6 +120,7 @@ class BattlegroundRV : public Battleground private: uint32 Timer; uint32 State; + bool PillarCollision; virtual void PostUpdateImpl(uint32 diff); @@ -129,6 +130,8 @@ class BattlegroundRV : public Battleground uint32 getState() { return State; }; void setState(uint32 state) { State = state; }; - void TogglePillarCollision(bool apply); + void TogglePillarCollision(); + bool GetPillarCollision() { return PillarCollision; } + void SetPillarCollision(bool apply) { PillarCollision = apply; } }; #endif diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index b7792e10ae3..39c6e00946a 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -37,6 +37,11 @@ BattlegroundSA::BattlegroundSA() SignaledRoundTwo = false; SignaledRoundTwoHalfMin = false; InitSecondRound = false; + + //! This is here to prevent an uninitialised variable warning + //! The warning only occurs when SetUpBattleGround fails though. + //! In the future this function should be called BEFORE sending initial worldstates. + memset(&GraveyardStatus, 0, sizeof(GraveyardStatus)); } BattlegroundSA::~BattlegroundSA() @@ -529,16 +534,16 @@ void BattlegroundSA::EventPlayerDamagedGO(Player* /*player*/, GameObject* go, ui if (eventType == go->GetGOInfo()->building.damagedEvent) { - uint32 i = GetGateIDFromDestroyEventID(eventType); + uint32 i = getGateIdFromDamagedOrDestroyEventId(eventType); GateStatus[i] = BG_SA_GATE_DAMAGED; - uint32 uws = GetWorldStateFromGateID(i); + uint32 uws = getWorldStateFromGateId(i); if (uws) UpdateWorldState(uws, GateStatus[i]); } if (eventType == go->GetGOInfo()->building.destroyedEvent) { - if (go->GetGOInfo()->building.destroyedEvent == 19837) + if (go->GetGOInfo()->building.destroyedEvent == BG_SA_EVENT_ANCIENT_GATE_DESTROYED) SendWarningToAll(LANG_BG_SA_CHAMBER_BREACHED); else SendWarningToAll(LANG_BG_SA_WAS_DESTROYED, go->GetGOInfo()->name.c_str()); @@ -598,7 +603,7 @@ void BattlegroundSA::DemolisherStartState(bool start) void BattlegroundSA::DestroyGate(Player* player, GameObject* go) { - uint32 i = GetGateIDFromDestroyEventID(go->GetGOInfo()->building.destroyedEvent); + uint32 i = getGateIdFromDamagedOrDestroyEventId(go->GetGOInfo()->building.destroyedEvent); if (!GateStatus[i]) return; @@ -607,7 +612,7 @@ void BattlegroundSA::DestroyGate(Player* player, GameObject* go) if (g->GetGOValue()->Building.Health == 0) { GateStatus[i] = BG_SA_GATE_DESTROYED; - uint32 uws = GetWorldStateFromGateID(i); + uint32 uws = getWorldStateFromGateId(i); if (uws) UpdateWorldState(uws, GateStatus[i]); bool rewardHonor = true; @@ -715,8 +720,13 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source) DelCreature(BG_SA_MAXNPC + i); GraveyardStatus[i] = Source->GetTeamId(); - WorldSafeLocsEntry const* sg = NULL; - sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]); + WorldSafeLocsEntry const* sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]); + if (!sg) + { + sLog->outError("BattlegroundSA::CaptureGraveyard: non-existant GY entry: %u", BG_SA_GYEntries[i]); + return; + } + AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], (GraveyardStatus[i] == TEAM_ALLIANCE? ALLIANCE : HORDE)); uint32 npc = 0; uint32 flag = 0; @@ -776,7 +786,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source) SendWarningToAll(LANG_BG_SA_H_GY_SOUTH); break; default: - ASSERT(0); + ASSERT(false); break; }; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h index 76a772ff978..c18806490f2 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h @@ -30,8 +30,8 @@ class BattlegroundSAScore : public BattlegroundScore uint8 gates_destroyed; }; -#define BG_SA_FLAG_AMOUNT 3 -#define BG_SA_DEMOLISHER_AMOUNT 4 +#define BG_SA_FLAG_AMOUNT 3 +#define BG_SA_DEMOLISHER_AMOUNT 4 enum BG_SA_Status { @@ -45,45 +45,66 @@ enum BG_SA_Status enum BG_SA_GateState { - BG_SA_GATE_OK = 1, - BG_SA_GATE_DAMAGED = 2, - BG_SA_GATE_DESTROYED = 3 + BG_SA_GATE_OK = 1, + BG_SA_GATE_DAMAGED = 2, + BG_SA_GATE_DESTROYED = 3 +}; + +enum BG_SA_EventIdGate +{ + BG_SA_EVENT_BLUE_GATE_DAMAGED = 19040, + BG_SA_EVENT_BLUE_GATE_DESTROYED = 19045, + + BG_SA_EVENT_GREEN_GATE_DAMAGED = 19041, + BG_SA_EVENT_GREEN_GATE_DESTROYED = 19046, + + BG_SA_EVENT_RED_GATE_DAMAGED = 19042, + BG_SA_EVENT_RED_GATE_DESTROYED = 19047, + + BG_SA_EVENT_PURPLE_GATE_DAMAGED = 19043, + BG_SA_EVENT_PURPLE_GATE_DESTROYED = 19048, + + BG_SA_EVENT_YELLOW_GATE_DAMAGED = 19044, + BG_SA_EVENT_YELLOW_GATE_DESTROYED = 19049, + + BG_SA_EVENT_ANCIENT_GATE_DAMAGED = 19836, + BG_SA_EVENT_ANCIENT_GATE_DESTROYED = 19837 }; enum BG_SA_Timers { - BG_SA_BOAT_START = 60*IN_MILLISECONDS, - BG_SA_WARMUPLENGTH = 120*IN_MILLISECONDS, - BG_SA_ROUNDLENGTH = 600*IN_MILLISECONDS + BG_SA_BOAT_START = 60 * IN_MILLISECONDS, + BG_SA_WARMUPLENGTH = 120 * IN_MILLISECONDS, + BG_SA_ROUNDLENGTH = 600 * IN_MILLISECONDS }; enum BG_SA_WorldStates { - BG_SA_TIMER_MINS = 3559, - BG_SA_TIMER_SEC_TENS = 3560, - BG_SA_TIMER_SEC_DECS = 3561, - BG_SA_ALLY_ATTACKS = 4352, - BG_SA_HORDE_ATTACKS = 4353, - BG_SA_PURPLE_GATEWS = 3614, - BG_SA_RED_GATEWS = 3617, - BG_SA_BLUE_GATEWS = 3620, - BG_SA_GREEN_GATEWS = 3623, - BG_SA_YELLOW_GATEWS = 3638, - BG_SA_ANCIENT_GATEWS = 3849, - BG_SA_LEFT_GY_ALLIANCE = 3635, - BG_SA_RIGHT_GY_ALLIANCE = 3636, - BG_SA_CENTER_GY_ALLIANCE = 3637, - BG_SA_RIGHT_ATT_TOKEN_ALL = 3627, - BG_SA_LEFT_ATT_TOKEN_ALL = 3626, - BG_SA_LEFT_ATT_TOKEN_HRD = 3629, - BG_SA_RIGHT_ATT_TOKEN_HRD = 3628, - BG_SA_HORDE_DEFENCE_TOKEN = 3631, - BG_SA_ALLIANCE_DEFENCE_TOKEN = 3630, - BG_SA_RIGHT_GY_HORDE = 3632, - BG_SA_LEFT_GY_HORDE = 3633, - BG_SA_CENTER_GY_HORDE = 3634, - BG_SA_BONUS_TIMER = 0xdf3, - BG_SA_ENABLE_TIMER = 3564, + BG_SA_TIMER_MINS = 3559, + BG_SA_TIMER_SEC_TENS = 3560, + BG_SA_TIMER_SEC_DECS = 3561, + BG_SA_ALLY_ATTACKS = 4352, + BG_SA_HORDE_ATTACKS = 4353, + BG_SA_PURPLE_GATEWS = 3614, + BG_SA_RED_GATEWS = 3617, + BG_SA_BLUE_GATEWS = 3620, + BG_SA_GREEN_GATEWS = 3623, + BG_SA_YELLOW_GATEWS = 3638, + BG_SA_ANCIENT_GATEWS = 3849, + BG_SA_LEFT_GY_ALLIANCE = 3635, + BG_SA_RIGHT_GY_ALLIANCE = 3636, + BG_SA_CENTER_GY_ALLIANCE = 3637, + BG_SA_RIGHT_ATT_TOKEN_ALL = 3627, + BG_SA_LEFT_ATT_TOKEN_ALL = 3626, + BG_SA_LEFT_ATT_TOKEN_HRD = 3629, + BG_SA_RIGHT_ATT_TOKEN_HRD = 3628, + BG_SA_HORDE_DEFENCE_TOKEN = 3631, + BG_SA_ALLIANCE_DEFENCE_TOKEN = 3630, + BG_SA_RIGHT_GY_HORDE = 3632, + BG_SA_LEFT_GY_HORDE = 3633, + BG_SA_CENTER_GY_HORDE = 3634, + BG_SA_BONUS_TIMER = 0xdf3, + BG_SA_ENABLE_TIMER = 3564, }; enum npc @@ -122,14 +143,14 @@ enum BG_SA_NPCs enum BG_SA_Boat { - BG_SA_BOAT_ONE_A =193182, - BG_SA_BOAT_TWO_H =193183, - BG_SA_BOAT_ONE_H =193184, - BG_SA_BOAT_TWO_A =193185, + BG_SA_BOAT_ONE_A = 193182, + BG_SA_BOAT_TWO_H = 193183, + BG_SA_BOAT_ONE_H = 193184, + BG_SA_BOAT_TWO_A = 193185, }; -const uint32 BG_SA_NpcEntries[BG_SA_MAXNPC] = - { +uint32 const BG_SA_NpcEntries[BG_SA_MAXNPC] = +{ NPC_ANTI_PERSONNAL_CANNON, NPC_ANTI_PERSONNAL_CANNON, NPC_ANTI_PERSONNAL_CANNON, @@ -140,25 +161,25 @@ const uint32 BG_SA_NpcEntries[BG_SA_MAXNPC] = NPC_ANTI_PERSONNAL_CANNON, NPC_ANTI_PERSONNAL_CANNON, NPC_ANTI_PERSONNAL_CANNON, - //4 beach demolishers + // 4 beach demolishers NPC_DEMOLISHER_SA, NPC_DEMOLISHER_SA, NPC_DEMOLISHER_SA, NPC_DEMOLISHER_SA, - //Triggers + // Triggers 23472, 23472, 23472, 23472, 23472, - //Used Demolisher Salesman + // Used Demolisher Salesman NPC_RIGGER_SPARKLIGHT, NPC_GORGRIL_RIGSPARK - }; +}; -const float BG_SA_NpcSpawnlocs[BG_SA_MAXNPC + BG_SA_DEMOLISHER_AMOUNT][4] = +float const BG_SA_NpcSpawnlocs[BG_SA_MAXNPC + BG_SA_DEMOLISHER_AMOUNT][4] = { - //Cannons + // Cannons { 1436.429f, 110.05f, 41.407f, 5.4f }, { 1404.9023f, 84.758f, 41.183f, 5.46f }, { 1068.693f, -86.951f, 93.81f, 0.02f }, @@ -169,21 +190,21 @@ const float BG_SA_NpcSpawnlocs[BG_SA_MAXNPC + BG_SA_DEMOLISHER_AMOUNT][4] = { 1249.634f, -224.189f, 66.72f, 0.635f }, { 1236.213f, 92.287f, 64.965f, 5.751f }, { 1215.11f, 57.772f, 64.739f, 5.78f }, - //Demolishers + // Demolishers { 1611.597656f, -117.270073f, 8.719355f, 2.513274f}, { 1575.562500f, -158.421875f, 5.024450f, 2.129302f}, { 1618.047729f, 61.424641f, 7.248210f, 3.979351f}, { 1575.103149f, 98.873344f, 2.830360f, 3.752458f}, - //trigger + // Triggers { 1453.49f, -250.453f, 30.896f, 4.2883f}, { 1377.05f, 97.036f, 30.8605f, 2.46539f}, { 1186.05f, 58.8048f, 56.5491f, 2.75992f}, { 1042.83f, -72.839f, 84.8145f, 3.58615f}, { 1233.62f, -250.49f, 55.4036f, 3.7016f}, - //Npcs + // Npcs { 1348.644165f, -298.786469f, 31.080130f, 1.710423f}, { 1358.191040f, 195.527786f, 31.018187f, 4.171337f}, - //Demolishers2 + // Demolishers 2 { 1371.055786f, -317.071136f, 35.007359f, 1.947460f}, { 1424.034912f, -260.195190f, 31.084425f, 2.820013f}, { 1353.139893f, 223.745438f, 35.265411f, 4.343684f}, @@ -221,7 +242,7 @@ enum BG_SA_Objects BG_SA_MAXOBJ = BG_SA_BOMB+68 }; -const float BG_SA_ObjSpawnlocs[BG_SA_MAXOBJ][4] = +float const BG_SA_ObjSpawnlocs[BG_SA_MAXOBJ][4] = { { 1411.57f, 108.163f, 28.692f, 5.441f }, { 1055.452f, -108.1f, 82.134f, 0.034f }, @@ -230,30 +251,30 @@ const float BG_SA_ObjSpawnlocs[BG_SA_MAXOBJ][4] = { 1214.681f, 81.21f, 53.413f, 5.745f }, { 878.555f, -108.2f, 117.845f, 0.0f }, { 836.5f, -108.8f, 120.219f, 0.0f }, - //Ships + // Ships { 2679.696777f, -826.891235f, 3.712860f, 5.78367f}, //rot2 1 rot3 0.0002f { 2574.003662f, 981.261475f, 2.603424f, 0.807696f}, - //Sigils + // Sigils { 1414.054f, 106.72f, 41.442f, 5.441f }, { 1060.63f, -107.8f, 94.7f, 0.034f }, { 1433.383f, -216.4f, 43.642f, 0.9736f }, { 1230.75f, -210.724f, 67.611f, 0.5023f }, { 1217.8f, 79.532f, 66.58f, 5.745f }, - //Flagpoles + // Flagpoles { 1215.114258f, -65.711861f, 70.084267f, -3.124123f}, {1338.863892f, -153.336533f, 30.895121f, -2.530723f}, {1309.124268f, 9.410645f, 30.893402f, -1.623156f}, - //Flags + // Flags { 1215.108032f, -65.715767f, 70.084267f, -3.124123f}, { 1338.859253f, -153.327316f, 30.895077f, -2.530723f}, { 1309.192017f, 9.416233f, 30.893402f, 1.518436f}, - //Portal + // Portal {1468.380005f, -225.798996f, 30.896200f, 0.0f}, //blue {1394.270020f, 72.551399f, 31.054300f, 0.0f}, //green {1065.260010f, -89.79501f, 81.073402f, 0.0f}, //yellow {1216.069946f, 47.904301f, 54.278198f, 0.0f}, //purple {1255.569946f, -233.548996f, 56.43699f, 0.0f}, //red - //Bombs + // Bombs {1333.45f, 211.354f, 31.0538f, 5.03666f}, {1334.29f, 209.582f, 31.0532f, 1.28088f}, {1332.72f, 210.049f, 31.0532f, 1.28088f}, @@ -337,7 +358,7 @@ const float BG_SA_ObjSpawnlocs[BG_SA_MAXOBJ][4] = * to get horde ones. */ -const uint32 BG_SA_ObjEntries[BG_SA_MAXOBJ + BG_SA_FLAG_AMOUNT] = +uint32 const BG_SA_ObjEntries[BG_SA_MAXOBJ + BG_SA_FLAG_AMOUNT] = { 190722, 190727, @@ -367,7 +388,7 @@ const uint32 BG_SA_ObjEntries[BG_SA_MAXOBJ + BG_SA_FLAG_AMOUNT] = 190753 }; -const uint32 BG_SA_Factions[2] = +uint32 const BG_SA_Factions[2] = { 1732, 1735, @@ -392,13 +413,13 @@ const uint32 BG_SA_GYEntries[BG_SA_MAX_GY] = 1348, }; -const float BG_SA_GYOrientation[BG_SA_MAX_GY] = +float const BG_SA_GYOrientation[BG_SA_MAX_GY] = { 6.202f, - 1.926f, //right capturable GY - 3.917f, //left capturable GY - 3.104f, //center, capturable - 6.148f, //defender last GY + 1.926f, // right capturable GY + 3.917f, // left capturable GY + 3.104f, // center, capturable + 6.148f, // defender last GY }; struct BG_SA_RoundScore @@ -443,34 +464,60 @@ class BattlegroundSA : public Battleground /// Called when a player use a gamobject (relic) virtual void EventPlayerUsedGO(Player* Source, GameObject* object); /// Return gate id, relative to bg data, according to gameobject id - uint32 GetGateIDFromDestroyEventID(uint32 id) + uint32 getGateIdFromDamagedOrDestroyEventId(uint32 id) { - uint32 i = 0; switch (id) { - case 19046: i = BG_SA_GREEN_GATE; break; //Green gate destroyed - case 19045: i = BG_SA_BLUE_GATE; break; //blue gate - case 19047: i = BG_SA_RED_GATE; break; //red gate - case 19048: i = BG_SA_PURPLE_GATE; break; //purple gate - case 19049: i = BG_SA_YELLOW_GATE; break; //yellow gate - case 19837: i = BG_SA_ANCIENT_GATE; break; //ancient gate + // Green gate + case BG_SA_EVENT_GREEN_GATE_DAMAGED: + case BG_SA_EVENT_GREEN_GATE_DESTROYED: + return BG_SA_GREEN_GATE; + // Blue gate + case BG_SA_EVENT_BLUE_GATE_DAMAGED: + case BG_SA_EVENT_BLUE_GATE_DESTROYED: + return BG_SA_BLUE_GATE; + // Red gate + case BG_SA_EVENT_RED_GATE_DAMAGED: + case BG_SA_EVENT_RED_GATE_DESTROYED: + return BG_SA_RED_GATE; + // Purple gate + case BG_SA_EVENT_PURPLE_GATE_DAMAGED: + case BG_SA_EVENT_PURPLE_GATE_DESTROYED: + return BG_SA_PURPLE_GATE; + // Yellow gate + case BG_SA_EVENT_YELLOW_GATE_DAMAGED: + case BG_SA_EVENT_YELLOW_GATE_DESTROYED: + return BG_SA_YELLOW_GATE; + // Ancient gate + case BG_SA_EVENT_ANCIENT_GATE_DAMAGED: + case BG_SA_EVENT_ANCIENT_GATE_DESTROYED: + return BG_SA_ANCIENT_GATE; + default: + break; } - return i; + return 0; } /// Return worldstate id, according to door id - uint32 GetWorldStateFromGateID(uint32 id) + uint32 getWorldStateFromGateId(uint32 id) { - uint32 uws = 0; switch (id) { - case BG_SA_GREEN_GATE: uws = BG_SA_GREEN_GATEWS; break; - case BG_SA_YELLOW_GATE: uws = BG_SA_YELLOW_GATEWS; break; - case BG_SA_BLUE_GATE: uws = BG_SA_BLUE_GATEWS; break; - case BG_SA_RED_GATE: uws = BG_SA_RED_GATEWS; break; - case BG_SA_PURPLE_GATE: uws = BG_SA_PURPLE_GATEWS; break; - case BG_SA_ANCIENT_GATE: uws = BG_SA_ANCIENT_GATEWS; break; + case BG_SA_GREEN_GATE: + return BG_SA_GREEN_GATEWS; + case BG_SA_YELLOW_GATE: + return BG_SA_YELLOW_GATEWS; + case BG_SA_BLUE_GATE: + return BG_SA_BLUE_GATEWS; + case BG_SA_RED_GATE: + return BG_SA_RED_GATEWS; + case BG_SA_PURPLE_GATE: + return BG_SA_PURPLE_GATEWS; + case BG_SA_ANCIENT_GATE: + return BG_SA_ANCIENT_GATEWS; + default: + break; } - return uws; + return 0; } /// Called on battleground ending diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index 9650cf11a8c..d100dc645a2 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp @@ -37,7 +37,8 @@ enum BG_WSG_Rewards BG_WSG_REWARD_NUM }; -uint32 BG_WSG_Honor[BG_HONOR_MODE_NUM][BG_WSG_REWARD_NUM] = { +uint32 BG_WSG_Honor[BG_HONOR_MODE_NUM][BG_WSG_REWARD_NUM] = +{ {20, 40, 40}, // normal honor {60, 40, 80} // holiday }; @@ -51,6 +52,7 @@ BattlegroundWS::BattlegroundWS() StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE; StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE; StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN; + _flagDebuffState = 0; } BattlegroundWS::~BattlegroundWS() @@ -177,20 +179,20 @@ void BattlegroundWS::StartingEventCloseDoors() void BattlegroundWS::StartingEventOpenDoors() { - for (uint32 i = BG_WS_OBJECT_DOOR_A_1; i <= BG_WS_OBJECT_DOOR_A_4; ++i) + for (uint32 i = BG_WS_OBJECT_DOOR_A_1; i <= BG_WS_OBJECT_DOOR_A_6; ++i) DoorOpen(i); - for (uint32 i = BG_WS_OBJECT_DOOR_H_1; i <= BG_WS_OBJECT_DOOR_H_2; ++i) + for (uint32 i = BG_WS_OBJECT_DOOR_H_1; i <= BG_WS_OBJECT_DOOR_H_4; ++i) DoorOpen(i); + for (uint32 i = BG_WS_OBJECT_A_FLAG; i <= BG_WS_OBJECT_BERSERKBUFF_2; ++i) + SpawnBGObject(i, RESPAWN_IMMEDIATELY); + SpawnBGObject(BG_WS_OBJECT_DOOR_A_5, RESPAWN_ONE_DAY); SpawnBGObject(BG_WS_OBJECT_DOOR_A_6, RESPAWN_ONE_DAY); SpawnBGObject(BG_WS_OBJECT_DOOR_H_3, RESPAWN_ONE_DAY); SpawnBGObject(BG_WS_OBJECT_DOOR_H_4, RESPAWN_ONE_DAY); - for (uint32 i = BG_WS_OBJECT_A_FLAG; i <= BG_WS_OBJECT_BERSERKBUFF_2; ++i) - SpawnBGObject(i, RESPAWN_IMMEDIATELY); - - // players joining later are not egible + // players joining later are not eligibles StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, WS_EVENT_START_BATTLE); } @@ -436,8 +438,8 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target ChatMsg type = CHAT_MSG_BG_SYSTEM_NEUTRAL; //alliance flag picked up from base - if (Source->GetTeam() == HORDE && this->GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE - && this->BgObjects[BG_WS_OBJECT_A_FLAG] == target_obj->GetGUID()) + if (Source->GetTeam() == HORDE && GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE + && BgObjects[BG_WS_OBJECT_A_FLAG] == target_obj->GetGUID()) { message_id = LANG_BG_WS_PICKEDUP_AF; type = CHAT_MSG_BG_SYSTEM_HORDE; @@ -455,8 +457,8 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target } //horde flag picked up from base - if (Source->GetTeam() == ALLIANCE && this->GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_BASE - && this->BgObjects[BG_WS_OBJECT_H_FLAG] == target_obj->GetGUID()) + if (Source->GetTeam() == ALLIANCE && GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_BASE + && BgObjects[BG_WS_OBJECT_H_FLAG] == target_obj->GetGUID()) { message_id = LANG_BG_WS_PICKEDUP_HF; type = CHAT_MSG_BG_SYSTEM_ALLIANCE; @@ -474,7 +476,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target } //Alliance flag on ground(not in base) (returned or picked up again from ground!) - if (GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10)) + if (GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10) && target_obj->GetGOInfo()->entry == BG_OBJECT_A_FLAG_GROUND_WS_ENTRY) { if (Source->GetTeam() == ALLIANCE) { @@ -508,7 +510,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target } //Horde flag on ground(not in base) (returned or picked up again) - if (GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10)) + if (GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10) && target_obj->GetGOInfo()->entry == BG_OBJECT_H_FLAG_GROUND_WS_ENTRY) { if (Source->GetTeam() == HORDE) { diff --git a/src/server/game/CMakeLists.txt b/src/server/game/CMakeLists.txt index 1f680f6e9b0..8b81a48c33b 100644 --- a/src/server/game/CMakeLists.txt +++ b/src/server/game/CMakeLists.txt @@ -107,7 +107,6 @@ set(game_STAT_SRCS include_directories( ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/dep/g3dlite/include - ${CMAKE_SOURCE_DIR}/dep/mersennetwister ${CMAKE_SOURCE_DIR}/dep/SFMT ${CMAKE_SOURCE_DIR}/dep/zlib ${CMAKE_SOURCE_DIR}/src/server/collision diff --git a/src/server/game/Calendar/Calendar.cpp b/src/server/game/Calendar/Calendar.cpp index 2c4ad943dd6..139e63614cc 100755 --- a/src/server/game/Calendar/Calendar.cpp +++ b/src/server/game/Calendar/Calendar.cpp @@ -15,3 +15,85 @@ * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include "Player.h" +#include "Calendar.h" + +std::string CalendarInvite::GetDebugString() const +{ + std::ostringstream data; + + data << "CalendarInvite::" + << " inviteId: " << _inviteId + << " EventId: " << _eventId + << " Status: " << uint32(_status) + << " Invitee: " << _invitee + << " Sender: " << _senderGUID + << " Rank: " << uint32(_rank) + << " Text: " << _text; + + return data.str(); +} + +void CalendarInvite::Init() +{ + _eventId = 0; + _invitee = 0; + _senderGUID = 0; + _statusTime = 0; + _status = CALENDAR_STATUS_INVITED; // default (0)? + _rank = CALENDAR_RANK_PLAYER; + _text = ""; +} + +std::string CalendarEvent::GetDebugString() const +{ + std::ostringstream data; + + data << "CalendarEvent::" + << " EventId: " << _eventId + << " Title: " << _title + << " Description" << _description + << " Type: " << uint32(_type) + << " Max Invites: " << _maxInvites + << " Creator: " << _creatorGUID + << " Flags: " << _flags + << " Guild: " << _guildId + << " Time: " << _eventTime + << " Time2: " << _timezoneTime + << " Repeatable: " << uint32(_repeatable) + << " DungeonId: " << _dungeonId; + + return data.str(); +} + +void CalendarEvent::Init() +{ + _creatorGUID = 0; + _guildId = 0; + _type = CALENDAR_TYPE_OTHER; + _dungeonId = -1; + _maxInvites = 0; + _eventTime = 0; + _flags = 0; + _repeatable = false; + _timezoneTime = 0; + _title = ""; + _description = ""; + +} + +std::string CalendarAction::GetDebugString() const +{ + std::ostringstream data; + + data << "CalendarAction::" + << " Action: " << GetAction() + << " Guid: " << GetPlayer()->GetGUID() + << " Invite Id: " << GetInviteId() + << " Extra data: " << GetExtraData() + << " Event: " << Event.GetDebugString() + << " Invite: " << Invite.GetDebugString(); + + return data.str(); +} diff --git a/src/server/game/Calendar/Calendar.h b/src/server/game/Calendar/Calendar.h index dfc88e477f9..a2d2dc2ffb7 100755 --- a/src/server/game/Calendar/Calendar.h +++ b/src/server/game/Calendar/Calendar.h @@ -19,8 +19,171 @@ #ifndef TRINITY_CALENDAR_H #define TRINITY_CALENDAR_H -class Calendar +#include "Errors.h" +#include "SharedDefines.h" +#include <map> + +class CalendarInvite { + public: + CalendarInvite() : _inviteId(0) { Init(); } + explicit CalendarInvite(uint64 inviteId) : _inviteId(inviteId) { Init(); } + + ~CalendarInvite() { } + + void SetInviteId(uint64 inviteId) { _inviteId = inviteId; } + uint64 GetInviteId() const { return _inviteId; } + + void SetEventId(uint64 eventId) { _eventId = eventId; } + uint64 GetEventId() const { return _eventId; } + + void SetSenderGUID(uint64 guid) { _senderGUID = guid; } + uint64 GetSenderGUID() const { return _senderGUID; } + + void SetInvitee(uint64 guid) { _invitee = guid; } + uint64 GetInvitee() const { return _invitee; } + + void SetStatusTime(uint32 statusTime) { _statusTime = statusTime; } + uint32 GetStatusTime() const { return _statusTime; } + + void SetText(std::string text) { _text = text; } + std::string GetText() const { return _text; } + + void SetStatus(CalendarInviteStatus status) { _status = status; } + CalendarInviteStatus GetStatus() const { return _status; } + + void SetRank(CalendarModerationRank rank) { _rank = rank; } + CalendarModerationRank GetRank() const { return _rank; } + + std::string GetDebugString() const; + + private: + void Init(); + uint64 _inviteId; + uint64 _eventId; + uint64 _invitee; + uint64 _senderGUID; + uint32 _statusTime; + CalendarInviteStatus _status; + CalendarModerationRank _rank; + std::string _text; }; + +typedef std::set<uint64> CalendarInviteIdList; + +class CalendarEvent +{ + public: + CalendarEvent() : _eventId(0) { Init(); } + explicit CalendarEvent(uint64 eventId) : _eventId(eventId) { Init(); } + + ~CalendarEvent() { } + + void SetEventId(uint64 eventId) { _eventId = eventId; } + uint64 GetEventId() const { return _eventId; } + + void SetCreatorGUID(uint64 guid) { _creatorGUID = guid; } + uint64 GetCreatorGUID() const { return _creatorGUID; } + + void SetGuildId(uint32 guildId) { _guildId = guildId; } + uint32 GetGuildId() const { return _guildId; } + + void SetTitle(std::string title) { _title = title; } + std::string GetTitle() const { return _title; } + + void SetDescription(std::string description) { _description = description; } + std::string GetDescription() const { return _description; } + + void SetType(CalendarEventType type) { _type = type; } + CalendarEventType GetType() const { return _type; } + + void SetMaxInvites(uint32 limit) { _maxInvites = limit; } + uint32 GetMaxInvites() const { return _maxInvites; } + + void SetDungeonId(int32 dungeonId) { _dungeonId = dungeonId; } + int32 GetDungeonId() const { return _dungeonId; } + + void SetTime(uint32 eventTime) { _eventTime = eventTime; } + uint32 GetTime() const { return _eventTime; } + + void SetFlags(uint32 flags) { _flags = flags; } + uint32 GetFlags() const { return _flags; } + + void SetRepeatable(bool repeatable) { _repeatable = repeatable; } + bool GetRepeatable() const { return _repeatable; } + + void SetTimeZoneTime(uint32 timezoneTime) { _timezoneTime = timezoneTime; } + uint32 GetTimeZoneTime() const { return _timezoneTime; } + + void AddInvite(uint64 inviteId) + { + if (inviteId) + _invites.insert(inviteId); + } + + void RemoveInvite(uint64 inviteId) { _invites.erase(inviteId); } + bool HasInvite(uint64 inviteId) const { return _invites.find(inviteId) != _invites.end(); } + CalendarInviteIdList const& GetInviteIdList() const { return _invites; } + void SetInviteIdList(CalendarInviteIdList const& list) { _invites = list; } + void ClearInviteIdList() { _invites.clear(); } + + std::string GetDebugString() const; + + private: + void Init(); + + uint64 _eventId; + uint64 _creatorGUID; + uint32 _guildId; + CalendarEventType _type; + int32 _dungeonId; + uint32 _maxInvites; + uint32 _eventTime; + uint32 _flags; + bool _repeatable; + uint32 _timezoneTime; + std::string _title; + std::string _description; + CalendarInviteIdList _invites; +}; + +typedef std::set<uint64> CalendarEventIdList; +typedef std::map<uint64, CalendarInviteIdList> CalendarPlayerInviteIdMap; +typedef std::map<uint64, CalendarEventIdList> CalendarPlayerEventIdMap; +typedef std::map<uint64, CalendarInvite> CalendarInviteMap; +typedef std::map<uint64, CalendarEvent> CalendarEventMap; + +class Player; + +struct CalendarAction +{ + CalendarAction(): _action(CALENDAR_ACTION_NONE), _player(NULL), _inviteId(0), _data(0) + { + } + + void SetAction(CalendarActionData data) { _action = data; } + CalendarActionData GetAction() const { return _action; } + + void SetPlayer(Player* player) { ASSERT(player); _player = player; } + Player* GetPlayer() const { return _player; } + + void SetInviteId(uint64 id) { _inviteId = id; } + uint64 GetInviteId() const { return _inviteId; } + + void SetExtraData(uint32 data) { _data = data; } + uint32 GetExtraData() const { return _data; } + + CalendarEvent Event; + CalendarInvite Invite; + + std::string GetDebugString() const; + + private: + CalendarActionData _action; + Player* _player; + uint64 _inviteId; + uint32 _data; +}; + #endif diff --git a/src/server/game/Calendar/CalendarMgr.cpp b/src/server/game/Calendar/CalendarMgr.cpp new file mode 100644 index 00000000000..62bc0ab3205 --- /dev/null +++ b/src/server/game/Calendar/CalendarMgr.cpp @@ -0,0 +1,593 @@ +/* + * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> + * + * 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/>. + */ + +/* + +DROP TABLE IF EXISTS `calendar_events`; +CREATE TABLE IF NOT EXISTS `calendar_events` ( + `id` int(11) unsigned NOT NULL DEFAULT '0', + `creator` int(11) unsigned NOT NULL DEFAULT '0', + `title` varchar(255) NOT NULL DEFAULT '', + `description` varchar(255) NOT NULL DEFAULT '', + `type` tinyint(1) unsigned NOT NULL DEFAULT '4', + `dungeon` tinyint(3) NOT NULL DEFAULT '-1', + `eventtime` int(10) unsigned NOT NULL DEFAULT '0', + `flags` int(10) unsigned NOT NULL DEFAULT '0', + `repeatable` tinyint(1) unsigned NOT NULL DEFAULT '0', + `time2` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) +); + +DROP TABLE IF EXISTS `calendar_invites`; +CREATE TABLE IF NOT EXISTS `calendar_invites` ( + `id` int(11) unsigned NOT NULL DEFAULT '0', + `event` int(11) unsigned NOT NULL DEFAULT '0', + `invitee` int(11) unsigned NOT NULL DEFAULT '0', + `sender` int(11) unsigned NOT NULL DEFAULT '0', + `status` tinyint(1) unsigned NOT NULL DEFAULT '0', + `statustime` int(10) unsigned NOT NULL DEFAULT '0', + `rank` tinyint(1) unsigned NOT NULL DEFAULT '0', + `text` varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (`id`) +); +*/ + +#include "CalendarMgr.h" +#include "QueryResult.h" +#include "DatabaseEnv.h" +#include "Log.h" +#include "Player.h" +#include "ObjectAccessor.h" + +CalendarMgr::CalendarMgr() : + _eventNum(0), _inviteNum(0) +{ +} + +CalendarMgr::~CalendarMgr() +{ +} + +uint32 CalendarMgr::GetPlayerNumPending(uint64 guid) +{ + if (!guid) + return 0; + + CalendarPlayerInviteIdMap::const_iterator itr = _playerInvites.find(guid); + if (itr == _playerInvites.end()) + return 0; + + uint32 pendingNum = 0; + for (CalendarInviteIdList::const_iterator it = itr->second.begin(); it != itr->second.end(); ++it) + if (CalendarInvite* invite = GetInvite(*it)) + if (invite->GetRank() != CALENDAR_RANK_OWNER + && invite->GetStatus() != CALENDAR_STATUS_CONFIRMED + && invite->GetStatus() != CALENDAR_STATUS_8 + && invite->GetStatus() != CALENDAR_STATUS_9) // FIXME Check the proper value + ++pendingNum; + + return pendingNum; +} + +CalendarInviteIdList const& CalendarMgr::GetPlayerInvites(uint64 guid) +{ + return _playerInvites[guid]; +} + +CalendarEventIdList const& CalendarMgr::GetPlayerEvents(uint64 guid) +{ + return _playerEvents[guid]; +} + +CalendarInvite* CalendarMgr::GetInvite(uint64 inviteId) +{ + CalendarInviteMap::iterator itr = _invites.find(inviteId); + if (itr != _invites.end()) + return &(itr->second); + + sLog->outError("CalendarMgr::GetInvite: [" UI64FMTD "] not found!", inviteId); + return NULL; +} + +CalendarEvent* CalendarMgr::GetEvent(uint64 eventId) +{ + CalendarEventMap::iterator itr = _events.find(eventId); + if (itr != _events.end()) + return &(itr->second); + + sLog->outError("CalendarMgr::GetEvent: [" UI64FMTD "] not found!", eventId); + return NULL; +} + +uint64 CalendarMgr::GetFreeEventId() +{ + return ++_eventNum; +} +uint64 CalendarMgr::GetFreeInviteId() +{ + return ++_inviteNum; +} + +void CalendarMgr::LoadFromDB() +{ + /* + uint32 count = 0; + // 0 1 2 3 4 5 6 7 8 9 + if (QueryResult result = CharacterDatabase.Query("SELECT id, creator, title, description, type, dungeon, eventtime, flags, repeatable, time2 FROM calendar_events")) + do + { + Field * fields = result->Fetch(); + + uint64 eventId = fields[0].GetUInt64(); + CalendarEvent& calendarEvent = _events[eventId]; + + calendarEvent.SetEventId(eventId); + calendarEvent.SetCreatorGUID(fields[1].GetUInt64()); + calendarEvent.SetTitle(fields[2].GetString()); + calendarEvent.SetDescription(fields[3].GetString()); + calendarEvent.SetType(fields[4].GetUInt8()); + calendarEvent.SetDungeonId(fields[5].GetInt32()); + calendarEvent.SetTime(fields[6].GetUInt32()); + calendarEvent.SetFlags(fields[7].GetUInt32()); + calendarEvent.SetRepeatable(fields[8].GetBool()); + calendarEvent.SetTimeZoneTime(fields[9].GetUInt32()); + ++count; + } + while (result->NextRow()); + + sLog->outString(">> Loaded %u calendar events", count); + count = 0; + + // 0 1 2 3 4 5 6 7 + if (QueryResult result = CharacterDatabase.Query("SELECT id, event, invitee, sender, status, statustime, rank, text FROM calendar_invites")) + do + { + Field * fields = result->Fetch(); + + uint64 inviteId = fields[0].GetUInt64(); + uint64 eventId = fields[1].GetUInt64(); + + CalendarInvite& invite = _invites[inviteId]; + + invite.SetEventId(eventId); + invite.SetInvitee(fields[2].GetUInt64()); + invite.SetSenderGUID(fields[3].GetUInt64()); + invite.SetStatus(fields[4].GetUInt8()); + invite.SetStatusTime(fields[5].GetUInt32()); + invite.SetRank(fields[6].GetUInt8()); + invite.SetText(fields[7].GetString()); + + CalendarEvent& calendarEvent = _events[eventId]; + calendarEvent.AddInvite(inviteId); + } + while (result->NextRow()); + + sLog->outString(">> Loaded %u calendar Invites", count); + */ +} + +CalendarEvent* CalendarMgr::CheckPermisions(uint64 eventId, Player* player, uint64 inviteId, CalendarModerationRank minRank) +{ + if (!player) + return NULL; // CALENDAR_ERROR_INTERNAL + + CalendarEvent* calendarEvent = GetEvent(eventId); + if (!calendarEvent) + { + player->GetSession()->SendCalendarCommandResult(CALENDAR_ERROR_EVENT_INVALID); + return NULL; + } + + CalendarInvite* invite = GetInvite(inviteId); + if (!invite) + { + player->GetSession()->SendCalendarCommandResult(CALENDAR_ERROR_NO_INVITE); + return NULL; + } + + if (!calendarEvent->HasInvite(inviteId)) + { + player->GetSession()->SendCalendarCommandResult(CALENDAR_ERROR_NOT_INVITED); + return NULL; + } + + if (invite->GetEventId() != calendarEvent->GetEventId() || invite->GetInvitee() != player->GetGUID()) + { + player->GetSession()->SendCalendarCommandResult(CALENDAR_ERROR_INTERNAL); + return NULL; + } + + if (invite->GetRank() < minRank) + { + player->GetSession()->SendCalendarCommandResult(CALENDAR_ERROR_PERMISSIONS); + return NULL; + } + + return calendarEvent; +} + +void CalendarMgr::AddAction(CalendarAction const& action) +{ + switch (action.GetAction()) + { + case CALENDAR_ACTION_ADD_EVENT: + { + if (AddEvent(action.Event) && AddInvite(action.Invite)) + { + SendCalendarEventInviteAlert(action.Event, action.Invite); + SendCalendarEvent(action.Event, CALENDAR_SENDTYPE_ADD); + } + break; + } + case CALENDAR_ACTION_MODIFY_EVENT: + { + uint64 eventId = action.Event.GetEventId(); + CalendarEvent* calendarEvent = CheckPermisions(eventId, action.GetPlayer(), action.GetInviteId(), CALENDAR_RANK_MODERATOR); + if (!calendarEvent) + return; + + calendarEvent->SetEventId(action.Event.GetEventId()); + calendarEvent->SetType(action.Event.GetType()); + calendarEvent->SetFlags(action.Event.GetFlags()); + calendarEvent->SetTime(action.Event.GetTime()); + calendarEvent->SetTimeZoneTime(action.Event.GetTimeZoneTime()); + calendarEvent->SetRepeatable(action.Event.GetRepeatable()); + calendarEvent->SetDungeonId(action.Event.GetDungeonId()); + calendarEvent->SetTitle(action.Event.GetTitle()); + calendarEvent->SetDescription(action.Event.GetDescription()); + calendarEvent->SetMaxInvites(action.Event.GetMaxInvites()); + + CalendarInviteIdList const& invites = calendarEvent->GetInviteIdList(); + for (CalendarInviteIdList::const_iterator itr = invites.begin(); itr != invites.end(); ++itr) + if (CalendarInvite* invite = GetInvite(*itr)) + SendCalendarEventUpdateAlert(invite->GetInvitee(), *calendarEvent, CALENDAR_SENDTYPE_ADD); + + break; + } + case CALENDAR_ACTION_COPY_EVENT: + { + CalendarEvent* calendarEvent = CheckPermisions(action.Event.GetEventId(), action.GetPlayer(), action.GetInviteId(), CALENDAR_RANK_OWNER); + + if (!calendarEvent) + return; + + uint64 eventId = GetFreeEventId(); + CalendarEvent newEvent(eventId); + newEvent.SetType(calendarEvent->GetType()); + newEvent.SetFlags(calendarEvent->GetFlags()); + newEvent.SetTime(action.Event.GetTime()); + newEvent.SetTimeZoneTime(calendarEvent->GetTimeZoneTime()); + newEvent.SetRepeatable(calendarEvent->GetRepeatable()); + newEvent.SetDungeonId(calendarEvent->GetDungeonId()); + newEvent.SetTitle(calendarEvent->GetTitle()); + newEvent.SetDescription(calendarEvent->GetDescription()); + newEvent.SetMaxInvites(calendarEvent->GetMaxInvites()); + newEvent.SetCreatorGUID(calendarEvent->GetCreatorGUID()); + newEvent.SetGuildId(calendarEvent->GetGuildId()); + + CalendarInviteIdList const invites = calendarEvent->GetInviteIdList(); + for (CalendarInviteIdList::const_iterator itr = invites.begin(); itr != invites.end(); ++itr) + { + if (CalendarInvite* invite = GetInvite(*itr)) + { + uint64 inviteId = GetFreeInviteId(); + CalendarInvite newInvite(inviteId); + newInvite.SetEventId(eventId); + newInvite.SetSenderGUID(action.GetPlayer()->GetGUID()); + newInvite.SetInvitee(invite->GetInvitee()); + newInvite.SetStatus(invite->GetStatus()); + newInvite.SetStatusTime(invite->GetStatusTime()); + newInvite.SetText(invite->GetText()); + newInvite.SetRank(invite->GetRank()); + if (AddInvite(newInvite)) + { + SendCalendarEventInviteAlert(newEvent, newInvite); + newEvent.AddInvite(inviteId); + } + } + } + + if (AddEvent(newEvent)) + SendCalendarEvent(newEvent, CALENDAR_SENDTYPE_COPY); + + break; + } + case CALENDAR_ACTION_REMOVE_EVENT: + { + uint64 eventId = action.Event.GetEventId(); + //uint32 flags = action.Event.GetFlags(); + // FIXME - Use of Flags here! + + CalendarEvent* calendarEvent = CheckPermisions(eventId, action.GetPlayer(), action.GetInviteId(), CALENDAR_RANK_OWNER); + if (!calendarEvent) + return; + + RemoveEvent(eventId); + break; + } + case CALENDAR_ACTION_ADD_EVENT_INVITE: + { + uint64 eventId = action.Invite.GetEventId(); + CalendarEvent* calendarEvent = CheckPermisions(eventId, action.GetPlayer(), action.GetInviteId(), CALENDAR_RANK_MODERATOR); + if (!calendarEvent) + return; + + if (AddInvite(action.Invite)) + { + calendarEvent->AddInvite(action.Invite.GetInviteId()); + SendCalendarEventInvite(action.Invite, (!(calendarEvent->GetFlags() & CALENDAR_FLAG_INVITES_LOCKED) && + !action.Invite.GetStatusTime())); + SendCalendarEventInviteAlert(*calendarEvent, action.Invite); + } + + break; + } + case CALENDAR_ACTION_SIGNUP_TO_EVENT: + { + uint64 eventId = action.Event.GetEventId(); + CalendarEvent* calendarEvent = GetEvent(eventId); + CheckPermisions(eventId, action.GetPlayer(), action.GetInviteId(), CALENDAR_RANK_MODERATOR); + + if (!calendarEvent || !(calendarEvent->GetFlags() & CALENDAR_FLAG_GUILD_ONLY) + || !calendarEvent->GetGuildId() || calendarEvent->GetGuildId() != action.GetExtraData()) + return; + + CalendarInviteStatus status = action.Invite.GetStatus(); + + if (status == CALENDAR_STATUS_INVITED) + status = CALENDAR_STATUS_CONFIRMED; + else if (status == CALENDAR_STATUS_ACCEPTED) + status = CALENDAR_STATUS_8; + + CalendarInvite newInvite(GetFreeInviteId()); + newInvite.SetStatus(status); + newInvite.SetStatusTime(uint32(time(NULL))); + newInvite.SetEventId(eventId); + newInvite.SetInvitee(action.GetPlayer()->GetGUID()); + newInvite.SetSenderGUID(action.GetPlayer()->GetGUID()); + + if (AddInvite(newInvite)) + SendCalendarEventInvite(newInvite, false); + + break; + } + case CALENDAR_ACTION_MODIFY_EVENT_INVITE: + { + uint64 eventId = action.Invite.GetEventId(); + uint64 inviteId = action.Invite.GetInviteId(); + + CalendarEvent* calendarEvent = NULL; + if (action.GetInviteId() != action.Invite.GetInviteId()) + calendarEvent = CheckPermisions(eventId, action.GetPlayer(), action.GetInviteId(), CALENDAR_RANK_MODERATOR); + else + calendarEvent = GetEvent(eventId); + + CalendarInvite* invite = GetInvite(inviteId); + + if (!calendarEvent || !invite || !calendarEvent->HasInvite(inviteId)) + return; + + invite->SetStatus(action.Invite.GetStatus()); + SendCalendarEventStatus(invite->GetSenderGUID(), *calendarEvent, *invite); + break; + } + case CALENDAR_ACTION_MODIFY_MODERATOR_EVENT_INVITE: + { + uint64 eventId = action.Invite.GetEventId(); + uint64 inviteId = action.Invite.GetInviteId(); + + CalendarEvent* calendarEvent = NULL; + if (action.GetInviteId() != action.Invite.GetInviteId()) + calendarEvent = CheckPermisions(eventId, action.GetPlayer(), action.GetInviteId(), CALENDAR_RANK_OWNER); + else + calendarEvent = GetEvent(eventId); + + CalendarInvite* invite = GetInvite(inviteId); + + if (!calendarEvent || !invite || !calendarEvent->HasInvite(inviteId)) + return; + + invite->SetStatus(action.Invite.GetStatus()); + SendCalendarEventModeratorStatusAlert(*invite); + break; + } + case CALENDAR_ACTION_REMOVE_EVENT_INVITE: + { + uint64 eventId = action.Invite.GetEventId(); + uint64 inviteId = action.Invite.GetInviteId(); + CalendarEvent* calendarEvent = CheckPermisions(eventId, action.GetPlayer(), action.GetInviteId(), CALENDAR_RANK_MODERATOR); + if (!calendarEvent) + return; + + // already checked in CheckPermisions + CalendarInvite* invite = GetInvite(inviteId); + if (!invite) + return; + + if (calendarEvent->GetCreatorGUID() == invite->GetInvitee()) + { + action.GetPlayer()->GetSession()->SendCalendarCommandResult(CALENDAR_ERROR_DELETE_CREATOR_FAILED); + return; + } + + if (uint64 invitee = RemoveInvite(inviteId)) + { + SendCalendarEventInviteRemoveAlert(invitee, *calendarEvent, CALENDAR_STATUS_9); + SendCalendarEventInviteRemove(action.GetPlayer()->GetGUID(), action.Invite, calendarEvent->GetFlags()); + } + break; + } + default: + break; + } + +} + +bool CalendarMgr::AddEvent(CalendarEvent const& newEvent) +{ + uint64 eventId = newEvent.GetEventId(); + if (_events.find(eventId) != _events.end()) + { + sLog->outError("CalendarMgr::AddEvent: Event [" UI64FMTD "] exists", eventId); + return false; + } + + _events[eventId] = newEvent; + return true; +} + +bool CalendarMgr::RemoveEvent(uint64 eventId) +{ + CalendarEventMap::iterator itr = _events.find(eventId); + if (itr == _events.end()) + { + sLog->outError("CalendarMgr::RemoveEvent: Event [" UI64FMTD "] does not exist", eventId); + return false; + } + + bool val = true; + + CalendarInviteIdList const& invites = itr->second.GetInviteIdList(); + for (CalendarInviteIdList::const_iterator itrInvites = invites.begin(); itrInvites != invites.end(); ++itrInvites) + { + CalendarInvite* invite = GetInvite(*itrInvites); + if (!invite || !RemovePlayerEvent(invite->GetInvitee(), eventId)) + val = false; + + if (uint64 invitee = RemoveInvite(*itrInvites)) + SendCalendarEventRemovedAlert(invitee, itr->second); + } + + _events.erase(itr); + + return val; +} + +bool CalendarMgr::AddPlayerEvent(uint64 guid, uint64 eventId) +{ + _playerEvents[guid].insert(eventId); + return true; +} + +bool CalendarMgr::RemovePlayerEvent(uint64 guid, uint64 eventId) +{ + _playerEvents[guid].erase(eventId); + return true; +} + +bool CalendarMgr::AddInvite(CalendarInvite const& newInvite) +{ + uint64 inviteId = newInvite.GetInviteId(); + if (!inviteId) + { + sLog->outError("CalendarMgr::AddInvite: Cant add Invite 0"); + return false; + } + + if (_invites.find(inviteId) != _invites.end()) + { + sLog->outError("CalendarMgr::AddInvite: Invite [" UI64FMTD "] exists", inviteId); + return false; + } + + _invites[inviteId] = newInvite; + uint64 guid = newInvite.GetInvitee(); + bool inviteAdded = AddPlayerInvite(guid, inviteId); + bool eventAdded = AddPlayerEvent(guid, newInvite.GetEventId()); + return eventAdded && inviteAdded; +} + +uint64 CalendarMgr::RemoveInvite(uint64 inviteId) +{ + CalendarInviteMap::iterator itr = _invites.find(inviteId); + if (itr == _invites.end()) + { + sLog->outError("CalendarMgr::RemoveInvite: Invite [" UI64FMTD "] does not exist", inviteId); + return 0; + } + + uint64 invitee = itr->second.GetInvitee(); + _invites.erase(itr); + + return RemovePlayerInvite(invitee, inviteId) ? invitee : 0; +} + +bool CalendarMgr::AddPlayerInvite(uint64 guid, uint64 inviteId) +{ + _playerInvites[guid].insert(inviteId); + return true; +} + +bool CalendarMgr::RemovePlayerInvite(uint64 guid, uint64 inviteId) +{ + _playerInvites[guid].erase(inviteId); + return true; +} + +void CalendarMgr::SendCalendarEvent(CalendarEvent const& calendarEvent, CalendarSendEventType type) +{ + if (Player* player = ObjectAccessor::FindPlayer(calendarEvent.GetCreatorGUID())) + player->GetSession()->SendCalendarEvent(calendarEvent, type); +} + +void CalendarMgr::SendCalendarEventInvite(CalendarInvite const& invite, bool pending) +{ + if (Player* player = ObjectAccessor::FindPlayer(invite.GetSenderGUID())) + player->GetSession()->SendCalendarEventInvite(invite, pending); +} + +void CalendarMgr::SendCalendarEventInviteAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite) +{ + if (Player* player = ObjectAccessor::FindPlayer(invite.GetInvitee())) + player->GetSession()->SendCalendarEventInviteAlert(calendarEvent, invite); +} + +void CalendarMgr::SendCalendarEventUpdateAlert(uint64 guid, CalendarEvent const& calendarEvent, CalendarSendEventType type) +{ + if (Player* player = ObjectAccessor::FindPlayer(guid)) + player->GetSession()->SendCalendarEventUpdateAlert(calendarEvent, type); +} + +void CalendarMgr::SendCalendarEventStatus(uint64 guid, CalendarEvent const& calendarEvent, CalendarInvite const& invite) +{ + if (Player* player = ObjectAccessor::FindPlayer(guid)) + player->GetSession()->SendCalendarEventStatus(calendarEvent, invite); +} + +void CalendarMgr::SendCalendarEventRemovedAlert(uint64 guid, CalendarEvent const& calendarEvent) +{ + if (Player* player = ObjectAccessor::FindPlayer(guid)) + player->GetSession()->SendCalendarEventRemovedAlert(calendarEvent); +} + +void CalendarMgr::SendCalendarEventInviteRemoveAlert(uint64 guid, CalendarEvent const& calendarEvent, CalendarInviteStatus status) +{ + if (Player* player = ObjectAccessor::FindPlayer(guid)) + player->GetSession()->SendCalendarEventInviteRemoveAlert(calendarEvent, status); +} + +void CalendarMgr::SendCalendarEventInviteRemove(uint64 guid, CalendarInvite const& invite, uint32 flags) +{ + if (Player* player = ObjectAccessor::FindPlayer(guid)) + player->GetSession()->SendCalendarEventInviteRemove(invite, flags); +} + +void CalendarMgr::SendCalendarEventModeratorStatusAlert(CalendarInvite const& invite) +{ + if (Player* player = ObjectAccessor::FindPlayer(invite.GetInvitee())) + player->GetSession()->SendCalendarEventModeratorStatusAlert(invite); +} diff --git a/src/server/game/Calendar/CalendarMgr.h b/src/server/game/Calendar/CalendarMgr.h new file mode 100644 index 00000000000..a8749778cb3 --- /dev/null +++ b/src/server/game/Calendar/CalendarMgr.h @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> + * + * 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/>. + */ + +#ifndef TRINITY_CALENDARMGR_H +#define TRINITY_CALENDARMGR_H + +#include <ace/Singleton.h> +#include "Calendar.h" + +class CalendarMgr +{ + friend class ACE_Singleton<CalendarMgr, ACE_Null_Mutex>; + + CalendarMgr(); + ~CalendarMgr(); + + public: + void LoadFromDB(); + + CalendarInvite* GetInvite(uint64 inviteId); + CalendarEvent* GetEvent(uint64 eventId); + + CalendarInviteIdList const& GetPlayerInvites(uint64 guid); + CalendarEventIdList const& GetPlayerEvents(uint64 guid); + + uint32 GetPlayerNumPending(uint64 guid); + uint64 GetFreeEventId(); + uint64 GetFreeInviteId(); + + void AddAction(CalendarAction const& action); + + void SendCalendarEvent(CalendarEvent const& calendarEvent, CalendarSendEventType type); + void SendCalendarEventInvite(CalendarInvite const& invite, bool pending); + void SendCalendarEventInviteAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite); + void SendCalendarEventInviteRemove(uint64 guid, CalendarInvite const& invite, uint32 flags); + void SendCalendarEventInviteRemoveAlert(uint64 guid, CalendarEvent const& calendarEvent, CalendarInviteStatus status); + void SendCalendarEventUpdateAlert(uint64 guid, CalendarEvent const& calendarEvent, CalendarSendEventType type); + void SendCalendarEventStatus(uint64 guid, CalendarEvent const& calendarEvent, CalendarInvite const& invite); + void SendCalendarEventRemovedAlert(uint64 guid, CalendarEvent const& calendarEvent); + void SendCalendarEventModeratorStatusAlert(CalendarInvite const& invite); + + private: + CalendarEvent* CheckPermisions(uint64 eventId, Player* player, uint64 inviteId, CalendarModerationRank minRank); + + bool AddEvent(CalendarEvent const& calendarEvent); + bool RemoveEvent(uint64 eventId); + bool AddPlayerEvent(uint64 guid, uint64 eventId); + bool RemovePlayerEvent(uint64 guid, uint64 eventId); + + bool AddInvite(CalendarInvite const& invite); + uint64 RemoveInvite(uint64 inviteId); + bool AddPlayerInvite(uint64 guid, uint64 inviteId); + bool RemovePlayerInvite(uint64 guid, uint64 inviteId); + + CalendarEventMap _events; + CalendarInviteMap _invites; + CalendarPlayerInviteIdMap _playerInvites; + CalendarPlayerEventIdMap _playerEvents; + + uint64 _eventNum; + uint64 _inviteNum; +}; + +#define sCalendarMgr ACE_Singleton<CalendarMgr, ACE_Null_Mutex>::instance() + +#endif diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp index b6e9dd30d28..0e89601e987 100755 --- a/src/server/game/Chat/Channels/Channel.cpp +++ b/src/server/game/Chat/Channels/Channel.cpp @@ -49,7 +49,6 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team) } else // it's custom channel { - channel_id = 0; m_flags |= CHANNEL_FLAG_CUSTOM; // If storing custom channels in the db is enabled either load or save the channel @@ -671,7 +670,7 @@ void Channel::Invite(uint64 p, const char *newname) } Player* newp = sObjectAccessor->FindPlayerByName(newname); - if (!newp) + if (!newp || !newp->isGMVisible()) { WorldPacket data; MakePlayerNotFound(&data, newname); diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 035fbaf5b78..cc64a8e22dd 100755 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -140,10 +140,10 @@ ChatCommand* ChatHandler::getCommandTable() static ChatCommand groupCommandTable[] = { - { "leader", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleGroupLeaderCommand>, "", NULL }, - { "disband", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleGroupDisbandCommand>, "", NULL }, - { "remove", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleGroupRemoveCommand>, "", NULL }, - { NULL, 0, false, NULL, "", NULL } + { "leader", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleGroupLeaderCommand>, "", NULL }, + { "disband", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleGroupDisbandCommand>, "", NULL }, + { "remove", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleGroupRemoveCommand>, "", NULL }, + { NULL, 0, false, NULL, "", NULL } }; static ChatCommand guildCommandTable[] = @@ -281,7 +281,7 @@ ChatCommand* ChatHandler::getCommandTable() { "corpses", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleServerCorpsesCommand>, "", NULL }, { "exit", SEC_CONSOLE, true, OldHandler<&ChatHandler::HandleServerExitCommand>, "", NULL }, { "idlerestart", SEC_ADMINISTRATOR, true, NULL, "", serverIdleRestartCommandTable }, - { "idleshutdown", SEC_ADMINISTRATOR, true, NULL, "", serverShutdownCommandTable }, + { "idleshutdown", SEC_ADMINISTRATOR, true, NULL, "", serverIdleShutdownCommandTable }, { "info", SEC_PLAYER, true, OldHandler<&ChatHandler::HandleServerInfoCommand>, "", NULL }, { "motd", SEC_PLAYER, true, OldHandler<&ChatHandler::HandleServerMotdCommand>, "", NULL }, { "plimit", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleServerPLimitCommand>, "", NULL }, @@ -336,6 +336,7 @@ ChatCommand* ChatHandler::getCommandTable() { "lookup", SEC_ADMINISTRATOR, true, NULL, "", lookupCommandTable }, { "pdump", SEC_ADMINISTRATOR, true, NULL, "", pdumpCommandTable }, { "guild", SEC_ADMINISTRATOR, true, NULL, "", guildCommandTable }, + { "group", SEC_ADMINISTRATOR, false, NULL, "", groupCommandTable }, { "cast", SEC_ADMINISTRATOR, false, NULL, "", castCommandTable }, { "reset", SEC_ADMINISTRATOR, true, NULL, "", resetCommandTable }, { "instance", SEC_ADMINISTRATOR, true, NULL, "", instanceCommandTable }, @@ -358,7 +359,6 @@ ChatCommand* ChatHandler::getCommandTable() { "summon", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleSummonCommand>, "", NULL }, { "groupsummon", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleGroupSummonCommand>, "", NULL }, { "commands", SEC_PLAYER, true, OldHandler<&ChatHandler::HandleCommandsCommand>, "", NULL }, - { "demorph", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandleDeMorphCommand>, "", NULL }, { "die", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleDieCommand>, "", NULL }, { "revive", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleReviveCommand>, "", NULL }, { "dismount", SEC_PLAYER, false, OldHandler<&ChatHandler::HandleDismountCommand>, "", NULL }, @@ -381,7 +381,6 @@ ChatCommand* ChatHandler::getCommandTable() { "linkgrave", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleLinkGraveCommand>, "", NULL }, { "neargrave", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleNearGraveCommand>, "", NULL }, { "explorecheat", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleExploreCheatCommand>, "", NULL }, - { "hover", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleHoverCommand>, "", NULL }, { "levelup", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleLevelUpCommand>, "", NULL }, { "showarea", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleShowAreaCommand>, "", NULL }, { "hidearea", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleHideAreaCommand>, "", NULL }, @@ -400,7 +399,7 @@ ChatCommand* ChatHandler::getCommandTable() { "movegens", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleMovegensCommand>, "", NULL }, { "cometome", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleComeToMeCommand>, "", NULL }, { "damage", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleDamageCommand>, "", NULL }, - { "combatstop", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandleCombatStopCommand>, "", NULL }, + { "combatstop", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleCombatStopCommand>, "", NULL }, { "flusharenapoints", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleFlushArenaPointsCommand>, "", NULL }, { "repairitems", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleRepairitemsCommand>, "", NULL }, { "waterwalk", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandleWaterwalkCommand>, "", NULL }, @@ -443,7 +442,10 @@ ChatCommand* ChatHandler::getCommandTable() added += appendCommandTable(commandTableCache + added, *it); } - QueryResult result = WorldDatabase.Query("SELECT name, security, help FROM command"); + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_COMMANDS); + + PreparedQueryResult result = WorldDatabase.Query(stmt); + if (result) { do @@ -451,7 +453,7 @@ ChatCommand* ChatHandler::getCommandTable() Field* fields = result->Fetch(); std::string name = fields[0].GetString(); - SetDataForCommandInTable(commandTableCache, name.c_str(), fields[1].GetUInt16(), fields[2].GetString(), name); + SetDataForCommandInTable(commandTableCache, name.c_str(), fields[1].GetUInt8(), fields[2].GetString(), name); } while (result->NextRow()); } @@ -1331,7 +1333,7 @@ GameTele const* ChatHandler::extractGameTeleFromLink(char* text) // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r char* cId = extractKeyFromLink(text, "Htele"); if (!cId) - return false; + return NULL; // id case (explicit or from shift link) if (cId[0] >= '0' || cId[0] >= '9') @@ -1503,7 +1505,7 @@ char* ChatHandler::extractQuotedArg(char* args) { char* space = strtok(args, "\""); if (!space) - return false; + return NULL; return strtok(NULL, "\""); } } diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h index 2311f4b8e5e..e88914a2daf 100755 --- a/src/server/game/Chat/Chat.h +++ b/src/server/game/Chat/Chat.h @@ -286,7 +286,6 @@ class ChatHandler bool HandleActivateObjectCommand(const char* args); bool HandleSpawnTransportCommand(const char* args); bool HandleExploreCheatCommand(const char* args); - bool HandleHoverCommand(const char* args); bool HandleWaterwalkCommand(const char* args); bool HandleLevelUpCommand(const char* args); bool HandleShowAreaCommand(const char* args); @@ -350,8 +349,8 @@ class ChatHandler bool HandleSaveAllCommand(const char* args); // Utility methods for commands - bool LookupPlayerSearchCommand(QueryResult result, int32 limit); - bool HandleBanListHelper(QueryResult result); + bool LookupPlayerSearchCommand(PreparedQueryResult result, int32 limit); + bool HandleBanListHelper(PreparedQueryResult result); bool HandleBanHelper(BanMode mode, char const* args); bool HandleBanInfoHelper(uint32 accountid, char const* accountname); bool HandleUnBanHelper(BanMode mode, char const* args); diff --git a/src/server/game/Chat/Commands/Level0.cpp b/src/server/game/Chat/Commands/Level0.cpp index 6d33a5761f4..b2ac090c313 100755 --- a/src/server/game/Chat/Commands/Level0.cpp +++ b/src/server/game/Chat/Commands/Level0.cpp @@ -17,10 +17,8 @@ */ #include "Common.h" -#include "DatabaseEnv.h" #include "World.h" #include "Player.h" -#include "Opcodes.h" #include "Chat.h" #include "ObjectAccessor.h" #include "Language.h" @@ -54,31 +52,31 @@ bool ChatHandler::HandleCommandsCommand(const char* /*args*/) bool ChatHandler::HandleStartCommand(const char* /*args*/) { - Player* chr = m_session->GetPlayer(); + Player* player = m_session->GetPlayer(); - if (chr->isInFlight()) + if (player->isInFlight()) { SendSysMessage(LANG_YOU_IN_FLIGHT); SetSentErrorMessage(true); return false; } - if (chr->isInCombat()) + if (player->isInCombat()) { SendSysMessage(LANG_YOU_IN_COMBAT); SetSentErrorMessage(true); return false; } - if ((chr->isDead()) || (chr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))) + if (player->isDead() || player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) { - // if player is dead and stuck, send ghost to graveyard - chr->RepopAtGraveyard(); - return true; + // if player is dead and stuck, send ghost to graveyard + player->RepopAtGraveyard(); + return true; } // cast spell Stuck - chr->CastSpell(chr, 7355, false); + player->CastSpell(player, 7355, false); return true; } @@ -107,23 +105,25 @@ bool ChatHandler::HandleServerInfoCommand(const char* /*args*/) bool ChatHandler::HandleDismountCommand(const char* /*args*/) { + Player* player = m_session->GetPlayer(); + //If player is not mounted, so go out :) - if (!m_session->GetPlayer()->IsMounted()) + if (!player->IsMounted()) { SendSysMessage(LANG_CHAR_NON_MOUNTED); SetSentErrorMessage(true); return false; } - if (m_session->GetPlayer()->isInFlight()) + if (player->isInFlight()) { SendSysMessage(LANG_YOU_IN_FLIGHT); SetSentErrorMessage(true); return false; } - m_session->GetPlayer()->Dismount(); - m_session->GetPlayer()->RemoveAurasByType(SPELL_AURA_MOUNTED); + player->Dismount(); + player->RemoveAurasByType(SPELL_AURA_MOUNTED); return true; } @@ -144,7 +144,7 @@ bool ChatHandler::HandleSaveCommand(const char* /*args*/) // save if the player has last been saved over 20 seconds ago uint32 save_interval = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE); - if (save_interval == 0 || (save_interval > 20*IN_MILLISECONDS && player->GetSaveTimer() <= save_interval - 20*IN_MILLISECONDS)) + if (save_interval == 0 || (save_interval > 20 * IN_MILLISECONDS && player->GetSaveTimer() <= save_interval - 20 * IN_MILLISECONDS)) player->SaveToDB(); return true; diff --git a/src/server/game/Chat/Commands/Level1.cpp b/src/server/game/Chat/Commands/Level1.cpp index 2a57dce77a4..abbc59d0114 100755 --- a/src/server/game/Chat/Commands/Level1.cpp +++ b/src/server/game/Chat/Commands/Level1.cpp @@ -42,7 +42,6 @@ bool ChatHandler::HandleNameAnnounceCommand(const char* args) { - WorldPacket data; if (!*args) return false; @@ -56,7 +55,6 @@ bool ChatHandler::HandleNameAnnounceCommand(const char* args) bool ChatHandler::HandleGMNameAnnounceCommand(const char* args) { - WorldPacket data; if (!*args) return false; @@ -422,13 +420,10 @@ bool ChatHandler::HandleTaxiCheatCommand(const char* args) std::string argstr = (char*)args; Player* chr = getSelectedPlayer(); - if (!chr) - { - chr=m_session->GetPlayer(); - } - // check online security - else if (HasLowerSecurity(chr, 0)) + if (!chr) + chr = m_session->GetPlayer(); + else if (HasLowerSecurity(chr, 0)) // check online security return false; if (argstr == "on") @@ -474,12 +469,12 @@ bool ChatHandler::HandleLookupAreaCommand(const char* args) wstrToLower (wnamepart); // Search in AreaTable.dbc - for (uint32 areaflag = 0; areaflag < sAreaStore.GetNumRows (); ++areaflag) + for (uint32 areaflag = 0; areaflag < sAreaStore.GetNumRows(); ++areaflag) { - AreaTableEntry const* areaEntry = sAreaStore.LookupEntry (areaflag); + AreaTableEntry const* areaEntry = sAreaStore.LookupEntry(areaflag); if (areaEntry) { - int loc = GetSessionDbcLocale (); + int loc = GetSessionDbcLocale(); std::string name = areaEntry->area_name; if (name.empty()) continue; @@ -489,11 +484,11 @@ bool ChatHandler::HandleLookupAreaCommand(const char* args) loc = 0; for (; loc < TOTAL_LOCALES; ++loc) { - if (loc == GetSessionDbcLocale ()) + if (loc == GetSessionDbcLocale()) continue; name = areaEntry->area_name; - if (name.empty ()) + if (name.empty()) continue; if (Utf8FitTo (name, wnamepart)) @@ -516,7 +511,7 @@ bool ChatHandler::HandleLookupAreaCommand(const char* args) else ss << areaEntry->ID << " - " << name << ' ' << localeNames[loc]; - SendSysMessage (ss.str ().c_str()); + SendSysMessage(ss.str().c_str()); if (!found) found = true; @@ -525,7 +520,7 @@ bool ChatHandler::HandleLookupAreaCommand(const char* args) } if (!found) - SendSysMessage (LANG_COMMAND_NOAREAFOUND); + SendSysMessage(LANG_COMMAND_NOAREAFOUND); return true; } @@ -698,7 +693,7 @@ bool ChatHandler::HandleGroupSummonCommand(const char* args) } Map* gmMap = m_session->GetPlayer()->GetMap(); - bool to_instance = gmMap->Instanceable(); + bool to_instance = gmMap->Instanceable(); // we are in instance, and can summon only player in our group with us as lead if (to_instance && ( diff --git a/src/server/game/Chat/Commands/Level2.cpp b/src/server/game/Chat/Commands/Level2.cpp index b0c0bbf6890..4359c5ff20c 100755 --- a/src/server/game/Chat/Commands/Level2.cpp +++ b/src/server/game/Chat/Commands/Level2.cpp @@ -42,6 +42,7 @@ #include "Transport.h" #include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand #include "CreatureGroups.h" +#include "ace/INET_Addr.h" //mute player for some times bool ChatHandler::HandleMuteCommand(const char* args) @@ -175,7 +176,6 @@ bool ChatHandler::HandleItemMoveCommand(const char* args) { if (!*args) return false; - uint8 srcslot, dstslot; char* pParam1 = strtok((char*)args, " "); if (!pParam1) @@ -185,8 +185,8 @@ bool ChatHandler::HandleItemMoveCommand(const char* args) if (!pParam2) return false; - srcslot = (uint8)atoi(pParam1); - dstslot = (uint8)atoi(pParam2); + uint8 srcslot = (uint8)atoi(pParam1); + uint8 dstslot = (uint8)atoi(pParam2); if (srcslot == dstslot) return true; @@ -205,22 +205,6 @@ bool ChatHandler::HandleItemMoveCommand(const char* args) return true; } -//demorph player or unit -bool ChatHandler::HandleDeMorphCommand(const char* /*args*/) -{ - Unit* target = getSelectedUnit(); - if (!target) - target = m_session->GetPlayer(); - - // check online security - else if (target->GetTypeId() == TYPEID_PLAYER && HasLowerSecurity((Player*)target, 0)) - return false; - - target->DeMorph(); - - return true; -} - //kick player bool ChatHandler::HandleKickPlayerCommand(const char *args) { @@ -266,19 +250,18 @@ bool ChatHandler::HandlePInfoCommand(const char* args) else if (!extractPlayerTarget((char*)args, &target, &target_guid, &target_name)) return false; - uint32 accId = 0; - uint32 money = 0; + uint32 accId = 0; + uint32 money = 0; uint32 total_player_time = 0; - uint8 level = 0; - uint32 latency = 0; + uint8 level = 0; + uint32 latency = 0; uint8 race; uint8 Class; - int64 muteTime = 0; - int64 banTime = -1; + int64 muteTime = 0; + int64 banTime = -1; uint32 mapId; uint32 areaId; - uint32 phase = 0; - + uint32 phase = 0; // get additional information from Player object if (target) @@ -287,17 +270,17 @@ bool ChatHandler::HandlePInfoCommand(const char* args) if (HasLowerSecurity(target, 0)) return false; - accId = target->GetSession()->GetAccountId(); - money = target->GetMoney(); + accId = target->GetSession()->GetAccountId(); + money = target->GetMoney(); total_player_time = target->GetTotalPlayedTime(); - level = target->getLevel(); - latency = target->GetSession()->GetLatency(); - race = target->getRace(); - Class = target->getClass(); - muteTime = target->GetSession()->m_muteTime; - mapId = target->GetMapId(); - areaId = target->GetAreaId(); - phase = target->GetPhaseMask(); + level = target->getLevel(); + latency = target->GetSession()->GetLatency(); + race = target->getRace(); + Class = target->getClass(); + muteTime = target->GetSession()->m_muteTime; + mapId = target->GetMapId(); + areaId = target->GetAreaId(); + phase = target->GetPhaseMask(); } // get additional information from DB else @@ -306,41 +289,42 @@ bool ChatHandler::HandlePInfoCommand(const char* args) if (HasLowerSecurity(NULL, target_guid)) return false; - // 0 1 2 3 4 5 6 7 - QueryResult result = CharacterDatabase.PQuery("SELECT totaltime, level, money, account, race, class, map, zone FROM characters " - "WHERE guid = '%u'", GUID_LOPART(target_guid)); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PINFO); + stmt->setUInt32(0, GUID_LOPART(target_guid)); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (!result) return false; - Field* fields = result->Fetch(); + Field* fields = result->Fetch(); total_player_time = fields[0].GetUInt32(); - level = fields[1].GetUInt32(); - money = fields[2].GetUInt32(); - accId = fields[3].GetUInt32(); - race = fields[4].GetUInt8(); - Class = fields[5].GetUInt8(); - mapId = fields[6].GetUInt16(); - areaId = fields[7].GetUInt16(); + level = fields[1].GetUInt8(); + money = fields[2].GetUInt32(); + accId = fields[3].GetUInt32(); + race = fields[4].GetUInt8(); + Class = fields[5].GetUInt8(); + mapId = fields[6].GetUInt16(); + areaId = fields[7].GetUInt16(); } - std::string username = GetTrinityString(LANG_ERROR); - std::string email = GetTrinityString(LANG_ERROR); - std::string last_ip = GetTrinityString(LANG_ERROR); - uint32 security = 0; + std::string username = GetTrinityString(LANG_ERROR); + std::string email = GetTrinityString(LANG_ERROR); + std::string last_ip = GetTrinityString(LANG_ERROR); + uint32 security = 0; std::string last_login = GetTrinityString(LANG_ERROR); - QueryResult result = LoginDatabase.PQuery("SELECT a.username, aa.gmlevel, a.email, a.last_ip, a.last_login, a.mutetime " - "FROM account a " - "LEFT JOIN account_access aa " - "ON (a.id = aa.id AND (aa.RealmID = -1 OR aa.RealmID = %u)) " - "WHERE a.id = '%u'", realmID, accId); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO); + stmt->setInt32(0, int32(realmID)); + stmt->setUInt32(1, accId); + PreparedQueryResult result = LoginDatabase.Query(stmt); + if (result) { Field* fields = result->Fetch(); - username = fields[0].GetString(); - security = fields[1].GetUInt32(); - email = fields[2].GetString(); - muteTime = fields[5].GetUInt64(); + username = fields[0].GetString(); + security = fields[1].GetUInt8(); + email = fields[2].GetString(); + muteTime = fields[5].GetUInt64(); if (email.empty()) email = "-"; @@ -349,6 +333,25 @@ bool ChatHandler::HandlePInfoCommand(const char* args) { last_ip = fields[3].GetString(); last_login = fields[4].GetString(); + + uint32 ip = inet_addr(last_ip.c_str()); +#if TRINITY_ENDIAN == BIGENDIAN + EndianConvertReverse(ip); +#endif + + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_IP2NATION_COUNTRY); + + stmt->setUInt32(0, ip); + + PreparedQueryResult result2 = WorldDatabase.Query(stmt); + + if (result2) + { + Field* fields2 = result2->Fetch(); + last_ip.append(" ("); + last_ip.append(fields2[0].GetString()); + last_ip.append(")"); + } } else { @@ -363,21 +366,23 @@ bool ChatHandler::HandlePInfoCommand(const char* args) std::string bannedby = "unknown"; std::string banreason = ""; - if (QueryResult result2 = LoginDatabase.PQuery("SELECT unbandate, bandate = unbandate, bannedby, banreason FROM account_banned " - "WHERE id = '%u' AND active ORDER BY bandate ASC LIMIT 1", accId)) + + stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO_BANS); + stmt->setUInt32(0, accId); + PreparedQueryResult result2 = LoginDatabase.Query(stmt); + if (!result2) { - Field* fields = result2->Fetch(); - banTime = fields[1].GetBool() ? 0 : fields[0].GetUInt64(); - bannedby = fields[2].GetString(); - banreason = fields[3].GetString(); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_BANS); + stmt->setUInt32(0, GUID_LOPART(target_guid)); + result2 = CharacterDatabase.Query(stmt); } - else if (QueryResult result3 = CharacterDatabase.PQuery("SELECT unbandate, bandate = unbandate, bannedby, banreason FROM character_banned " - "WHERE guid = '%u' AND active ORDER BY bandate ASC LIMIT 1", GUID_LOPART(target_guid))) + + if (result2) { - Field* fields = result3->Fetch(); - banTime = fields[1].GetBool() ? 0 : fields[0].GetUInt64(); - bannedby = fields[2].GetString(); - banreason = fields[3].GetString(); + Field* fields = result2->Fetch(); + banTime = int64(fields[1].GetBool() ? 0 : fields[0].GetUInt32()); + bannedby = fields[2].GetString(); + banreason = fields[3].GetString(); } if (muteTime > 0) @@ -694,9 +699,22 @@ bool ChatHandler::HandleLookupEventCommand(const char* args) bool ChatHandler::HandleCombatStopCommand(const char* args) { - Player* target; - if (!extractPlayerTarget((char*)args, &target)) - return false; + Player* target = NULL; + + if (args && strlen(args) > 0) + { + target = sObjectAccessor->FindPlayerByName(args); + if (!target) + { + SendSysMessage(LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage(true); + return false; + } + } + + if (!target) + if (!extractPlayerTarget((char*)args, &target)) + return false; // check online security if (HasLowerSecurity(target, 0)) @@ -730,9 +748,9 @@ bool ChatHandler::HandleLookupPlayerIpCommand(const char* args) limit = limit_str ? atoi (limit_str) : -1; } - LoginDatabase.EscapeString(ip); - - QueryResult result = LoginDatabase.PQuery("SELECT id, username FROM account WHERE last_ip = '%s'", ip.c_str()); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BY_IP); + stmt->setString(0, ip); + PreparedQueryResult result = LoginDatabase.Query(stmt); return LookupPlayerSearchCommand(result, limit); } @@ -749,16 +767,15 @@ bool ChatHandler::HandleLookupPlayerAccountCommand(const char* args) if (!AccountMgr::normalizeString (account)) return false; - LoginDatabase.EscapeString (account); - - QueryResult result = LoginDatabase.PQuery ("SELECT id, username FROM account WHERE username = '%s'", account.c_str ()); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_LIST_BY_NAME); + stmt->setString(0, account); + PreparedQueryResult result = LoginDatabase.Query(stmt); return LookupPlayerSearchCommand (result, limit); } bool ChatHandler::HandleLookupPlayerEmailCommand(const char* args) { - if (!*args) return false; @@ -766,14 +783,14 @@ bool ChatHandler::HandleLookupPlayerEmailCommand(const char* args) char* limit_str = strtok (NULL, " "); int32 limit = limit_str ? atoi (limit_str) : -1; - LoginDatabase.EscapeString (email); - - QueryResult result = LoginDatabase.PQuery ("SELECT id, username FROM account WHERE email = '%s'", email.c_str ()); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_LIST_BY_EMAIL); + stmt->setString(0, email); + PreparedQueryResult result = LoginDatabase.Query(stmt); - return LookupPlayerSearchCommand (result, limit); + return LookupPlayerSearchCommand(result, limit); } -bool ChatHandler::LookupPlayerSearchCommand(QueryResult result, int32 limit) +bool ChatHandler::LookupPlayerSearchCommand(PreparedQueryResult result, int32 limit) { if (!result) { @@ -797,8 +814,11 @@ bool ChatHandler::LookupPlayerSearchCommand(QueryResult result, int32 limit) uint32 acc_id = fields[0].GetUInt32(); std::string acc_name = fields[1].GetString(); - QueryResult chars = CharacterDatabase.PQuery("SELECT guid, name FROM characters WHERE account = '%u'", acc_id); - if (chars) + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_GUID_NAME_BY_ACC); + stmt->setUInt32(0, acc_id); + PreparedQueryResult result2 = CharacterDatabase.Query(stmt); + + if (result2) { PSendSysMessage(LANG_LOOKUP_PLAYER_ACCOUNT, acc_name.c_str(), acc_id); @@ -807,14 +827,14 @@ bool ChatHandler::LookupPlayerSearchCommand(QueryResult result, int32 limit) do { - Field* charfields = chars->Fetch(); + Field* charfields = result2->Fetch(); guid = charfields[0].GetUInt64(); name = charfields[1].GetString(); PSendSysMessage(LANG_LOOKUP_PLAYER_CHARACTER, name.c_str(), guid); ++i; - } while (chars->NextRow() && (limit == -1 || i < limit)); + } while (result2->NextRow() && (limit == -1 || i < limit)); } } while (result->NextRow()); diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp index 1cb07fca4a8..2ae7e73b828 100755 --- a/src/server/game/Chat/Commands/Level3.cpp +++ b/src/server/game/Chat/Commands/Level3.cpp @@ -87,11 +87,10 @@ bool ChatHandler::HandleSetSkillCommand(const char *args) return false; char *level_p = strtok (NULL, " "); - if (!level_p) return false; - char *max_p = strtok (NULL, " "); + char *max_p = strtok (NULL, " "); int32 skill = atoi(skill_p); if (skill <= 0) @@ -101,7 +100,7 @@ bool ChatHandler::HandleSetSkillCommand(const char *args) return false; } - int32 level = atol (level_p); + int32 level = atol(level_p); Player* target = getSelectedPlayer(); if (!target) @@ -128,7 +127,7 @@ bool ChatHandler::HandleSetSkillCommand(const char *args) return false; } - int32 max = max_p ? atol (max_p) : target->GetPureMaxSkillValue(skill); + int32 max = max_p ? atol (max_p) : target->GetPureMaxSkillValue(skill); if (level <= 0 || level > max || max <= 0) return false; @@ -226,7 +225,11 @@ bool ChatHandler::HandleAddItemCommand(const char *args) { std::string itemName = citemName+1; WorldDatabase.EscapeString(itemName); - QueryResult result = WorldDatabase.PQuery("SELECT entry FROM item_template WHERE name = '%s'", itemName.c_str()); + + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_ITEM_TEMPLATE_BY_NAME); + stmt->setString(0, itemName); + PreparedQueryResult result = WorldDatabase.Query(stmt); + if (!result) { PSendSysMessage(LANG_COMMAND_COULDNOTFIND, citemName+1); @@ -414,22 +417,22 @@ bool ChatHandler::HandleListItemCommand(const char *args) return false; uint32 count = uint32(_count); - QueryResult result; + PreparedQueryResult result; // inventory case uint32 inv_count = 0; - result = CharacterDatabase.PQuery("SELECT COUNT(itemEntry) FROM character_inventory ci INNER JOIN item_instance ii ON ii.guid = ci.item WHERE itemEntry = '%u'", item_id); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_INVENTORY_COUNT_ITEM); + stmt->setUInt32(0, item_id); + result = CharacterDatabase.Query(stmt); + if (result) - inv_count = (*result)[0].GetUInt32(); + inv_count = (*result)[0].GetUInt64(); - result=CharacterDatabase.PQuery( - // 0 1 2 3 4 5 - "SELECT ci.item, cb.slot AS bag, ci.slot, ci.guid, c.account, c.name FROM characters c " - "INNER JOIN character_inventory ci ON ci.guid = c.guid " - "INNER JOIN item_instance ii ON ii.guid = ci.item " - "LEFT JOIN character_inventory cb ON cb.item = ci.bag " - "WHERE ii.itemEntry = '%u' LIMIT %u ", - item_id, count); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_INVENTORY_ITEM_BY_ENTRY); + stmt->setUInt32(0, item_id); + stmt->setUInt32(1, count); + result = CharacterDatabase.Query(stmt); if (result) { @@ -438,7 +441,7 @@ bool ChatHandler::HandleListItemCommand(const char *args) Field* fields = result->Fetch(); uint32 item_guid = fields[0].GetUInt32(); uint32 item_bag = fields[1].GetUInt32(); - uint32 item_slot = fields[2].GetUInt32(); + uint8 item_slot = fields[2].GetUInt8(); uint32 owner_guid = fields[3].GetUInt32(); uint32 owner_acc = fields[4].GetUInt32(); std::string owner_name = fields[5].GetString(); @@ -467,24 +470,23 @@ bool ChatHandler::HandleListItemCommand(const char *args) // mail case uint32 mail_count = 0; - result = CharacterDatabase.PQuery("SELECT COUNT(itemEntry) FROM mail_items mi INNER JOIN item_instance ii ON ii.guid = mi.item_guid WHERE itemEntry = '%u'", item_id); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_COUNT_ITEM); + stmt->setUInt32(0, item_id); + result = CharacterDatabase.Query(stmt); + if (result) - mail_count = (*result)[0].GetUInt32(); + mail_count = (*result)[0].GetUInt64(); if (count > 0) { - result = CharacterDatabase.PQuery( - // 0 1 2 3 4 5 6 - "SELECT mi.item_guid, m.sender, m.receiver, cs.account, cs.name, cr.account, cr.name FROM mail m " - "INNER JOIN mail_items mi ON mi.mail_id = m.id " - "INNER JOIN item_instance ii ON ii.guid = mi.item_guid " - "INNER JOIN characters cs ON cs.guid = m.sender " - "INNER JOIN characters cr ON cr.guid = m.receiver " - "WHERE ii.itemEntry = '%u' LIMIT %u", - item_id, count); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_ITEMS_BY_ENTRY); + stmt->setUInt32(0, item_id); + stmt->setUInt32(1, count); + result = CharacterDatabase.Query(stmt); } else - result = QueryResult(NULL); + result = PreparedQueryResult(NULL); if (result) { @@ -515,21 +517,23 @@ bool ChatHandler::HandleListItemCommand(const char *args) // auction case uint32 auc_count = 0; - result=CharacterDatabase.PQuery("SELECT COUNT(itemEntry) FROM auctionhouse ah INNER JOIN item_instance ii ON ii.guid = ah.itemguid WHERE itemEntry = '%u'", item_id); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_AUCTIONHOUSE_COUNT_ITEM); + stmt->setUInt32(0, item_id); + result = CharacterDatabase.Query(stmt); + if (result) - auc_count = (*result)[0].GetUInt32(); + auc_count = (*result)[0].GetUInt64(); if (count > 0) { - result = CharacterDatabase.PQuery( - // 0 1 2 3 - "SELECT ah.itemguid, ah.itemowner, c.account, c.name FROM auctionhouse ah " - "INNER JOIN characters c ON c.guid = ah.itemowner " - "INNER JOIN item_instance ii ON ii.guid = ah.itemguid " - "WHERE ii.itemEntry = '%u' LIMIT %u", item_id, count); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_AUCTIONHOUSE_ITEM_BY_ENTRY); + stmt->setUInt32(0, item_id); + stmt->setUInt32(1, count); + result = CharacterDatabase.Query(stmt); } else - result = QueryResult(NULL); + result = PreparedQueryResult(NULL); if (result) { @@ -550,17 +554,18 @@ bool ChatHandler::HandleListItemCommand(const char *args) // guild bank case uint32 guild_count = 0; - result = CharacterDatabase.PQuery("SELECT COUNT(itemEntry) FROM guild_bank_item gbi INNER JOIN item_instance ii ON ii.guid = gbi.item_guid WHERE itemEntry = '%u'", item_id); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_BANK_COUNT_ITEM); + stmt->setUInt32(0, item_id); + result = CharacterDatabase.Query(stmt); + if (result) - guild_count = (*result)[0].GetUInt32(); + guild_count = (*result)[0].GetUInt64(); - result = CharacterDatabase.PQuery( - // 0 1 2 - "SELECT gi.item_guid, gi.guildid, g.name FROM guild_bank_item gi " - "INNER JOIN guild g ON g.guildid = gi.guildid " - "INNER JOIN item_instance ii ON ii.guid = gi.item_guid " - "WHERE ii.itemEntry = '%u' LIMIT %u ", - item_id, count); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_BANK_ITEM_BY_ENTRY); + stmt->setUInt32(0, item_id); + stmt->setUInt32(1, count); + result = CharacterDatabase.Query(stmt); if (result) { @@ -631,9 +636,9 @@ bool ChatHandler::HandleListObjectCommand(const char *args) QueryResult result; uint32 obj_count = 0; - result=WorldDatabase.PQuery("SELECT COUNT(guid) FROM gameobject WHERE id='%u'", go_id); + result = WorldDatabase.PQuery("SELECT COUNT(guid) FROM gameobject WHERE id='%u'", go_id); if (result) - obj_count = (*result)[0].GetUInt32(); + obj_count = (*result)[0].GetUInt64(); if (m_session) { @@ -703,9 +708,9 @@ bool ChatHandler::HandleListCreatureCommand(const char *args) QueryResult result; uint32 cr_count = 0; - result=WorldDatabase.PQuery("SELECT COUNT(guid) FROM creature WHERE id='%u'", cr_id); + result = WorldDatabase.PQuery("SELECT COUNT(guid) FROM creature WHERE id='%u'", cr_id); if (result) - cr_count = (*result)[0].GetUInt32(); + cr_count = (*result)[0].GetUInt64(); if (m_session) { @@ -1234,7 +1239,7 @@ bool ChatHandler::HandleLookupCreatureCommand(const char *args) uint8 localeIndex = GetSessionDbLocaleIndex(); if (CreatureLocale const* cl = sObjectMgr->GetCreatureLocale(id)) { - if (cl->Name.size() > localeIndex && !cl->Name[localeIndex].empty ()) + if (cl->Name.size() > localeIndex && !cl->Name[localeIndex].empty()) { std::string name = cl->Name[localeIndex]; @@ -1247,9 +1252,9 @@ bool ChatHandler::HandleLookupCreatureCommand(const char *args) } if (m_session) - PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str ()); + PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str()); else - PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str ()); + PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str()); if (!found) found = true; @@ -1260,7 +1265,7 @@ bool ChatHandler::HandleLookupCreatureCommand(const char *args) } std::string name = itr->second.Name; - if (name.empty ()) + if (name.empty()) continue; if (Utf8FitTo(name, wnamepart)) @@ -1272,9 +1277,9 @@ bool ChatHandler::HandleLookupCreatureCommand(const char *args) } if (m_session) - PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str ()); + PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str()); else - PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str ()); + PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str()); if (!found) found = true; @@ -1282,7 +1287,7 @@ bool ChatHandler::HandleLookupCreatureCommand(const char *args) } if (!found) - SendSysMessage (LANG_COMMAND_NOCREATUREFOUND); + SendSysMessage(LANG_COMMAND_NOCREATUREFOUND); return true; } @@ -1370,7 +1375,7 @@ bool ChatHandler::HandleLookupFactionCommand(const char *args) return false; // Can be NULL at console call - Player* target = getSelectedPlayer (); + Player* target = getSelectedPlayer(); std::string namepart = args; std::wstring wnamepart; @@ -1522,10 +1527,10 @@ bool ChatHandler::HandleLookupTaxiNodeCommand(const char * args) // send taxinode in "id - [name] (Map:m X:x Y:y Z:z)" format if (m_session) - PSendSysMessage (LANG_TAXINODE_ENTRY_LIST_CHAT, id, id, name.c_str(), localeNames[loc], + PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CHAT, id, id, name.c_str(), localeNames[loc], nodeEntry->map_id, nodeEntry->x, nodeEntry->y, nodeEntry->z); else - PSendSysMessage (LANG_TAXINODE_ENTRY_LIST_CONSOLE, id, name.c_str(), localeNames[loc], + PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CONSOLE, id, name.c_str(), localeNames[loc], nodeEntry->map_id, nodeEntry->x, nodeEntry->y, nodeEntry->z); if (!found) @@ -1674,16 +1679,16 @@ bool ChatHandler::HandleGuildCreateCommand(const char *args) if (target->GetGuildId()) { - SendSysMessage (LANG_PLAYER_IN_GUILD); + SendSysMessage(LANG_PLAYER_IN_GUILD); return true; } Guild* guild = new Guild; - if (!guild->Create (target, guildname)) + if (!guild->Create(target, guildname)) { delete guild; - SendSysMessage (LANG_GUILD_NOT_CREATED); - SetSentErrorMessage (true); + SendSysMessage(LANG_GUILD_NOT_CREATED); + SetSentErrorMessage(true); return false; } @@ -1710,7 +1715,7 @@ bool ChatHandler::HandleGuildInviteCommand(const char *args) return false; std::string glName = guildStr; - Guild* targetGuild = sGuildMgr->GetGuildByName (glName); + Guild* targetGuild = sGuildMgr->GetGuildByName(glName); if (!targetGuild) return false; @@ -1726,11 +1731,10 @@ bool ChatHandler::HandleGuildUninviteCommand(const char *args) return false; uint32 glId = target ? target->GetGuildId() : Player::GetGuildIdFromGuid(target_guid); - if (!glId) return false; - Guild* targetGuild = sGuildMgr->GetGuildById (glId); + Guild* targetGuild = sGuildMgr->GetGuildById(glId); if (!targetGuild) return false; @@ -1775,11 +1779,11 @@ bool ChatHandler::HandleGuildDeleteCommand(const char *args) std::string gld = guildStr; - Guild* targetGuild = sGuildMgr->GetGuildByName (gld); + Guild* targetGuild = sGuildMgr->GetGuildByName(gld); if (!targetGuild) return false; - targetGuild->Disband (); + targetGuild->Disband(); return true; } @@ -1885,7 +1889,7 @@ bool ChatHandler::HandleDamageCommand(const char * args) { m_session->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); if (target != m_session->GetPlayer()) - m_session->GetPlayer()->SendAttackStateUpdate (HITINFO_NORMALSWING2, target, 1, SPELL_SCHOOL_MASK_NORMAL, damage, 0, 0, VICTIMSTATE_HIT, 0); + m_session->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, SPELL_SCHOOL_MASK_NORMAL, damage, 0, 0, VICTIMSTATE_HIT, 0); return true; } @@ -1915,7 +1919,7 @@ bool ChatHandler::HandleDamageCommand(const char * args) m_session->GetPlayer()->DealDamageMods(target, damage, &absorb); m_session->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, schoolmask, NULL, false); - m_session->GetPlayer()->SendAttackStateUpdate (HITINFO_NORMALSWING2, target, 1, schoolmask, damage, absorb, resist, VICTIMSTATE_HIT, 0); + m_session->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, schoolmask, damage, absorb, resist, VICTIMSTATE_HIT, 0); return true; } @@ -2020,7 +2024,7 @@ bool ChatHandler::HandleLinkGraveCommand(const char *args) else return false; - WorldSafeLocsEntry const* graveyard = sWorldSafeLocsStore.LookupEntry(g_id); + WorldSafeLocsEntry const* graveyard = sWorldSafeLocsStore.LookupEntry(g_id); if (!graveyard) { @@ -2143,40 +2147,17 @@ bool ChatHandler::HandleExploreCheatCommand(const char *args) ChatHandler(chr).PSendSysMessage(LANG_YOURS_EXPLORE_SET_NOTHING, GetNameLink().c_str()); } - for (uint8 i=0; i<PLAYER_EXPLORED_ZONES_SIZE; ++i) + for (uint8 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i) { if (flag != 0) - { m_session->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0xFFFFFFFF); - } else - { m_session->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0); - } } return true; } -bool ChatHandler::HandleHoverCommand(const char *args) -{ - char* px = strtok((char*)args, " "); - uint32 flag; - if (!px) - flag = 1; - else - flag = atoi(px); - - m_session->GetPlayer()->SetHover(flag); - - if (flag) - SendSysMessage(LANG_HOVER_ENABLED); - else - SendSysMessage(LANG_HOVER_DISABLED); - - return true; -} - void ChatHandler::HandleCharacterLevel(Player* player, uint64 playerGuid, uint32 oldLevel, uint32 newLevel) { if (player) @@ -2434,7 +2415,9 @@ bool ChatHandler::HandleListAurasCommand (const char * /*args*/) for (uint16 i = 0; i < TOTAL_AURAS; ++i) { Unit::AuraEffectList const& uAuraList = unit->GetAuraEffectsByType(AuraType(i)); - if (uAuraList.empty()) continue; + if (uAuraList.empty()) + continue; + PSendSysMessage(LANG_COMMAND_TARGET_LISTAURATYPE, uAuraList.size(), i); for (Unit::AuraEffectList::const_iterator itr = uAuraList.begin(); itr != uAuraList.end(); ++itr) { @@ -2737,7 +2720,7 @@ bool ChatHandler::HandleServerShutDownCommand(const char *args) if (exitcode < 0 || exitcode > 125) return false; - sWorld->ShutdownServ (time, 0, exitcode); + sWorld->ShutdownServ(time, 0, exitcode); } else sWorld->ShutdownServ(time, 0, SHUTDOWN_EXIT_CODE); @@ -2772,7 +2755,7 @@ bool ChatHandler::HandleServerRestartCommand(const char *args) if (exitcode < 0 || exitcode > 125) return false; - sWorld->ShutdownServ (time, SHUTDOWN_MASK_RESTART, exitcode); + sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART, exitcode); } else sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART, RESTART_EXIT_CODE); @@ -2807,7 +2790,7 @@ bool ChatHandler::HandleServerIdleRestartCommand(const char *args) if (exitcode < 0 || exitcode > 125) return false; - sWorld->ShutdownServ (time, SHUTDOWN_MASK_RESTART|SHUTDOWN_MASK_IDLE, exitcode); + sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART|SHUTDOWN_MASK_IDLE, exitcode); } else sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART|SHUTDOWN_MASK_IDLE, RESTART_EXIT_CODE); @@ -2842,7 +2825,7 @@ bool ChatHandler::HandleServerIdleShutDownCommand(const char *args) if (exitcode < 0 || exitcode > 125) return false; - sWorld->ShutdownServ (time, SHUTDOWN_MASK_IDLE, exitcode); + sWorld->ShutdownServ(time, SHUTDOWN_MASK_IDLE, exitcode); } else sWorld->ShutdownServ(time, SHUTDOWN_MASK_IDLE, SHUTDOWN_EXIT_CODE); @@ -3221,7 +3204,7 @@ bool ChatHandler::HandleBanListCharacterCommand(const char *args) std::string filter(cFilter); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_BY_NAME_FILTER); - stmt->setString(0, filter.c_str()); + stmt->setString(0, filter); PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) { @@ -3298,25 +3281,27 @@ bool ChatHandler::HandleBanListCharacterCommand(const char *args) bool ChatHandler::HandleBanListAccountCommand(const char *args) { - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_OLD_BANS); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS); LoginDatabase.Execute(stmt); char* cFilter = strtok((char*)args, " "); std::string filter = cFilter ? cFilter : ""; - LoginDatabase.EscapeString(filter); - QueryResult result; + PreparedQueryResult result; if (filter.empty()) { - result = LoginDatabase.Query("SELECT account.id, username FROM account, account_banned" - " WHERE account.id = account_banned.id AND active = 1 GROUP BY account.id"); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED_ALL); + + result = LoginDatabase.Query(stmt); } else { - result = LoginDatabase.PQuery("SELECT account.id, username FROM account, account_banned" - " WHERE account.id = account_banned.id AND active = 1 AND username "_LIKE_" "_CONCAT3_("'%%'", "'%s'", "'%%'")" GROUP BY account.id", - filter.c_str()); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED_BY_USERNAME); + + stmt->setString(0, filter); + + result = LoginDatabase.Query(stmt); } if (!result) @@ -3328,7 +3313,7 @@ bool ChatHandler::HandleBanListAccountCommand(const char *args) return HandleBanListHelper(result); } -bool ChatHandler::HandleBanListHelper(QueryResult result) +bool ChatHandler::HandleBanListHelper(PreparedQueryResult result) { PSendSysMessage(LANG_BANLIST_MATCHINGACCOUNT); @@ -3358,7 +3343,7 @@ bool ChatHandler::HandleBanListHelper(QueryResult result) { SendSysMessage("-------------------------------------------------------------------------------"); Field* fields = result->Fetch(); - uint32 account_id = fields[0].GetUInt32 (); + uint32 account_id = fields[0].GetUInt32(); std::string account_name; @@ -3404,26 +3389,28 @@ bool ChatHandler::HandleBanListHelper(QueryResult result) bool ChatHandler::HandleBanListIPCommand(const char *args) { - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_OLD_IP_BANS); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS); LoginDatabase.Execute(stmt); char* cFilter = strtok((char*)args, " "); std::string filter = cFilter ? cFilter : ""; LoginDatabase.EscapeString(filter); - QueryResult result; + PreparedQueryResult result; if (filter.empty()) { - result = LoginDatabase.Query ("SELECT ip, bandate, unbandate, bannedby, banreason FROM ip_banned" - " WHERE (bandate=unbandate OR unbandate>UNIX_TIMESTAMP())" - " ORDER BY unbandate"); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED_ALL); + + result = LoginDatabase.Query(stmt); } else { - result = LoginDatabase.PQuery("SELECT ip, bandate, unbandate, bannedby, banreason FROM ip_banned" - " WHERE (bandate=unbandate OR unbandate>UNIX_TIMESTAMP()) AND ip "_LIKE_" "_CONCAT3_("'%%'", "'%s'", "'%%'") - " ORDER BY unbandate", filter.c_str()); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED_BY_IP); + + stmt->setString(0, filter); + + result = LoginDatabase.Query(stmt); } if (!result) @@ -4455,7 +4442,7 @@ bool ChatHandler::HandleChannelSetOwnership(const char *args) if (!*args) return false; char *channel = strtok((char*)args, " "); - char *argstr = strtok(NULL, ""); + char *argstr = strtok(NULL, ""); if (!channel || !argstr) return false; @@ -4492,10 +4479,6 @@ bool ChatHandler::HandleChannelSetOwnership(const char *args) return true; } -/*------------------------------------------ - *-------------TRINITY---------------------- - *-------------------------------------*/ - bool ChatHandler::HandlePlayAllCommand(const char *args) { if (!*args) @@ -4589,53 +4572,58 @@ bool ChatHandler::HandleUnFreezeCommand(const char *args) { std::string name; Player* player; - char *TargetName = strtok((char*)args, " "); //get entered name - if (!TargetName) //if no name entered use target - { - player = getSelectedPlayer(); - if (player) //prevent crash with creature as target - name = player->GetName(); - } + char* targetName = strtok((char*)args, " "); // Get entered name - else // if name entered + if (targetName) { - name = TargetName; + name = targetName; normalizePlayerName(name); player = sObjectAccessor->FindPlayerByName(name.c_str()); } + else // If no name was entered - use target + { + player = getSelectedPlayer(); + if (player) + name = player->GetName(); + } - //effect if (player) { PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str()); - //Reset player faction + allow combat + allow duels + // Reset player faction + allow combat + allow duels player->setFactionForRace(player->getRace()); player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - //allow movement and spells + // Remove Freeze spell (allowing movement and spells) player->RemoveAurasDueToSpell(9454); - //save player + // Save player player->SaveToDB(); } - - if (!player) + else { - if (TargetName) + if (targetName) { - //check for offline players - QueryResult result = CharacterDatabase.PQuery("SELECT characters.guid FROM characters WHERE characters.name = '%s'", name.c_str()); + // Check for offline players + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_GUID_BY_NAME); + stmt->setString(0, name); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (!result) { SendSysMessage(LANG_COMMAND_FREEZE_WRONG); return true; } - //if player found: delete his freeze aura - Field* fields=result->Fetch(); - uint64 pguid = fields[0].GetUInt64(); - CharacterDatabase.PQuery("DELETE FROM character_aura WHERE character_aura.spell = 9454 AND character_aura.guid = '%u'", pguid); + // If player found: delete his freeze aura + Field* fields = result->Fetch(); + uint32 lowGuid = fields[0].GetUInt32(); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA_FROZEN); + stmt->setUInt32(0, lowGuid); + CharacterDatabase.Execute(stmt); + PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str()); return true; } @@ -4651,8 +4639,11 @@ bool ChatHandler::HandleUnFreezeCommand(const char *args) bool ChatHandler::HandleListFreezeCommand(const char * /*args*/) { - //Get names from DB - QueryResult result = CharacterDatabase.Query("SELECT characters.name FROM characters LEFT JOIN character_aura ON (characters.guid = character_aura.guid) WHERE character_aura.spell = 9454"); + // Get names from DB + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AURA_FROZEN); + + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (!result) { SendSysMessage(LANG_COMMAND_NO_FROZEN_PLAYERS); @@ -4750,9 +4741,11 @@ bool ChatHandler::HandleBindSightCommand(const char * /*args*/) bool ChatHandler::HandleUnbindSightCommand(const char * /*args*/) { - if (m_session->GetPlayer()->isPossessing()) + Player* player = m_session->GetPlayer(); + + if (player->isPossessing()) return false; - m_session->GetPlayer()->StopCastingBindSight(); + player->StopCastingBindSight(); return true; } diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp index d82e43ba83b..9737d4584ea 100755 --- a/src/server/game/Combat/ThreatManager.cpp +++ b/src/server/game/Combat/ThreatManager.cpp @@ -75,7 +75,7 @@ bool ThreatCalcHelper::isValidProcess(Unit* hatedUnit, Unit* hatingUnit, SpellIn return false; // not in same map or phase - if (!hatedUnit->IsInMap(hatingUnit)) + if (!hatedUnit->IsInMap(hatingUnit) || !hatedUnit->InSamePhase(hatingUnit)) return false; // spell not causing threat @@ -182,6 +182,7 @@ void HostileReference::updateOnlineStatus() && (getTarget()->GetTypeId() != TYPEID_PLAYER || !getTarget()->ToPlayer()->isGameMaster()) && !getTarget()->HasUnitState(UNIT_STATE_IN_FLIGHT) && getTarget()->IsInMap(getSourceUnit()) + && getTarget()->InSamePhase(getSourceUnit()) ) { Creature* creature = getSourceUnit()->ToCreature(); @@ -534,6 +535,7 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat setCurrentVictim(NULL); setDirty(true); } + iOwner->SendRemoveFromThreatListOpcode(hostilRef); iThreatContainer.remove(hostilRef); iThreatOfflineContainer.addReference(hostilRef); } diff --git a/src/server/game/Combat/ThreatManager.h b/src/server/game/Combat/ThreatManager.h index ce1f6de2ab0..e5badcd24ce 100755 --- a/src/server/game/Combat/ThreatManager.h +++ b/src/server/game/Combat/ThreatManager.h @@ -242,7 +242,7 @@ class ThreatManager // methods to access the lists from the outside to do some dirty manipulation (scriping and such) // I hope they are used as little as possible. std::list<HostileReference*>& getThreatList() { return iThreatContainer.getThreatList(); } - std::list<HostileReference*>& getOfflieThreatList() { return iThreatOfflineContainer.getThreatList(); } + std::list<HostileReference*>& getOfflineThreatList() { return iThreatOfflineContainer.getThreatList(); } ThreatContainer& getOnlineContainer() { return iThreatContainer; } ThreatContainer& getOfflineContainer() { return iThreatOfflineContainer; } private: diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 7d21f94f372..4176d9f605b 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -114,7 +114,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) case CONDITION_QUESTREWARDED: { if (Player* player = object->ToPlayer()) - condMeets = (player->GetQuestRewardStatus(ConditionValue1) == !ConditionValue2); + condMeets = player->GetQuestRewardStatus(ConditionValue1); break; } case CONDITION_QUESTTAKEN: @@ -122,7 +122,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) if (Player* player = object->ToPlayer()) { QuestStatus status = player->GetQuestStatus(ConditionValue1); - condMeets = ((status == QUEST_STATUS_INCOMPLETE) == !ConditionValue2); + condMeets = (status == QUEST_STATUS_INCOMPLETE); } break; } @@ -131,7 +131,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) if (Player* player = object->ToPlayer()) { QuestStatus status = player->GetQuestStatus(ConditionValue1); - condMeets = ((status == QUEST_STATUS_COMPLETE && !player->GetQuestRewardStatus(ConditionValue1)) == !ConditionValue2); + condMeets = (status == QUEST_STATUS_COMPLETE && !player->GetQuestRewardStatus(ConditionValue1)); } break; } @@ -140,7 +140,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) if (Player* player = object->ToPlayer()) { QuestStatus status = player->GetQuestStatus(ConditionValue1); - condMeets = ((status == QUEST_STATUS_NONE) == !ConditionValue2); + condMeets = (status == QUEST_STATUS_NONE); } break; } @@ -190,7 +190,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) } case CONDITION_OBJECT_ENTRY: { - if (object->GetTypeId() == ConditionValue1) + if (uint32(object->GetTypeId()) == ConditionValue1) condMeets = (!ConditionValue2) || (object->GetEntry() == ConditionValue2); break; } @@ -274,6 +274,12 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) condMeets = object->GetPhaseMask() & ConditionValue1; break; } + case CONDITION_TITLE: + { + if (Player* player = object->ToPlayer()) + condMeets = player->HasTitle(ConditionValue1); + break; + } default: condMeets = false; break; @@ -422,6 +428,9 @@ uint32 Condition::GetSearcherTypeMaskForCondition() case CONDITION_PHASEMASK: mask |= GRID_MAP_TYPE_MASK_ALL; break; + case CONDITION_TITLE: + mask |= GRID_MAP_TYPE_MASK_PLAYER; + break; default: ASSERT(false && "Condition::GetSearcherTypeMaskForCondition - missing condition handling!"); break; @@ -515,7 +524,9 @@ bool ConditionMgr::IsObjectMeetToConditionList(ConditionSourceInfo& sourceInfo, sLog->outDebug(LOG_FILTER_CONDITIONSYS, "ConditionMgr::IsPlayerMeetToConditionList condType: %u val1: %u", (*i)->ConditionType, (*i)->ConditionValue1); if ((*i)->isLoaded()) { + //! Find ElseGroup in ElseGroupStore std::map<uint32, bool>::const_iterator itr = ElseGroupStore.find((*i)->ElseGroup); + //! If not found, add an entry in the store and set to true (placeholder) if (itr == ElseGroupStore.end()) ElseGroupStore[(*i)->ElseGroup] = true; else if (!(*itr).second) @@ -717,8 +728,8 @@ void ConditionMgr::LoadConditions(bool isReload) Condition* cond = new Condition(); int32 iSourceTypeOrReferenceId = fields[0].GetInt32(); cond->SourceGroup = fields[1].GetUInt32(); - cond->SourceEntry = fields[2].GetInt32(); - cond->SourceId = fields[3].GetUInt32(); + cond->SourceEntry = fields[2].GetUInt32(); + cond->SourceId = fields[3].GetInt32(); cond->ElseGroup = fields[4].GetUInt32(); int32 iConditionTypeOrReference = fields[5].GetInt32(); cond->ConditionTarget = fields[6].GetUInt8(); @@ -854,18 +865,6 @@ void ConditionMgr::LoadConditions(bool isReload) break; case CONDITION_SOURCE_TYPE_SPELL_CLICK_EVENT: { - //if no list for npc create one - if (SpellClickEventConditionStore.find(cond->SourceGroup) == SpellClickEventConditionStore.end()) - { - ConditionTypeContainer cmap; - SpellClickEventConditionStore[cond->SourceGroup] = cmap; - } - //if no list for spellclick spell create one - if (SpellClickEventConditionStore[cond->SourceGroup].find(cond->SourceEntry) == SpellClickEventConditionStore[cond->SourceGroup].end()) - { - ConditionList clist; - SpellClickEventConditionStore[cond->SourceGroup][cond->SourceEntry] = clist; - } SpellClickEventConditionStore[cond->SourceGroup][cond->SourceEntry].push_back(cond); valid = true; ++count; @@ -877,18 +876,6 @@ void ConditionMgr::LoadConditions(bool isReload) break; case CONDITION_SOURCE_TYPE_VEHICLE_SPELL: { - //if no list for vehicle create one - if (VehicleSpellConditionStore.find(cond->SourceGroup) == VehicleSpellConditionStore.end()) - { - ConditionTypeContainer cmap; - VehicleSpellConditionStore[cond->SourceGroup] = cmap; - } - //if no list for vehicle's spell create one - if (VehicleSpellConditionStore[cond->SourceGroup].find(cond->SourceEntry) == VehicleSpellConditionStore[cond->SourceGroup].end()) - { - ConditionList clist; - VehicleSpellConditionStore[cond->SourceGroup][cond->SourceEntry] = clist; - } VehicleSpellConditionStore[cond->SourceGroup][cond->SourceEntry].push_back(cond); valid = true; ++count; @@ -896,18 +883,8 @@ void ConditionMgr::LoadConditions(bool isReload) } case CONDITION_SOURCE_TYPE_SMART_EVENT: { - // If the entry does not exist, create a new list + //! TODO: PAIR_32 ? std::pair<int32, uint32> key = std::make_pair(cond->SourceEntry, cond->SourceId); - if (SmartEventConditionStore.find(key) == SmartEventConditionStore.end()) - { - ConditionTypeContainer cmap; - SmartEventConditionStore[key] = cmap; - } - if (SmartEventConditionStore[key].find(cond->SourceGroup) == SmartEventConditionStore[key].end()) - { - ConditionList clist; - SmartEventConditionStore[key][cond->SourceGroup] = clist; - } SmartEventConditionStore[key][cond->SourceGroup].push_back(cond); valid = true; ++count; @@ -1326,7 +1303,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) default: break; } - + switch (spellInfo->Effects[i].TargetB.GetSelectionCategory()) { case TARGET_SELECT_CATEGORY_NEARBY: @@ -1577,7 +1554,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) } case CONDITION_ACHIEVEMENT: { - AchievementEntry const* achievement = GetAchievementStore()->LookupEntry(cond->ConditionValue1); + AchievementEntry const* achievement = sAchievementStore.LookupEntry(cond->ConditionValue1); if (!achievement) { sLog->outErrorDb("Achivement condition has non existing achivement id (%u), skipped", cond->ConditionValue1); @@ -1858,9 +1835,16 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) sLog->outErrorDb("Phasemask condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } - case CONDITION_UNUSED_18: - sLog->outErrorDb("Found ConditionTypeOrReference = CONDITION_UNUSED_18 in `conditions` table - ignoring"); - return false; + case CONDITION_TITLE: + { + CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(cond->ConditionValue1); + if (!titleEntry) + { + sLog->outErrorDb("Title condition has non existing title in value1 (%u), skipped", cond->ConditionValue1); + return false; + } + break; + } case CONDITION_UNUSED_19: sLog->outErrorDb("Found ConditionTypeOrReference = CONDITION_UNUSED_19 in `conditions` table - ignoring"); return false; @@ -1929,6 +1913,19 @@ void ConditionMgr::Clean() SmartEventConditionStore.clear(); + for (CreatureSpellConditionContainer::iterator itr = SpellClickEventConditionStore.begin(); itr != SpellClickEventConditionStore.end(); ++itr) + { + for (ConditionTypeContainer::iterator it = itr->second.begin(); it != itr->second.end(); ++it) + { + for (ConditionList::const_iterator i = it->second.begin(); i != it->second.end(); ++i) + delete *i; + it->second.clear(); + } + itr->second.clear(); + } + + SpellClickEventConditionStore.clear(); + // this is a BIG hack, feel free to fix it if you can figure out the ConditionMgr ;) for (std::list<Condition*>::const_iterator itr = AllocatedMemoryStore.begin(); itr != AllocatedMemoryStore.end(); ++itr) delete *itr; diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index 5a5e2dd1c2e..130a23a0cb0 100755 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -48,7 +48,7 @@ enum ConditionTypes CONDITION_CLASS = 15, // class 0 0 true if player's class is equal to class CONDITION_RACE = 16, // race 0 0 true if player's race is equal to race CONDITION_ACHIEVEMENT = 17, // achievement_id 0 0 true if achievement is complete - CONDITION_UNUSED_18 = 18, // + CONDITION_TITLE = 18, // title id 0 0 true if player has title CONDITION_UNUSED_19 = 19, // CONDITION_UNUSED_20 = 20, // CONDITION_UNUSED_21 = 21, // @@ -72,6 +72,33 @@ enum ConditionTypes CONDITION_MAX = 39 // MAX }; +/*! Documentation on implementing a new ConditionSourceType: + Step 1: Check for the lowest free ID. Look for CONDITION_SOURCE_TYPE_UNUSED_XX in the enum. + Then define the new source type. + + Step 2: Determine and map the parameters for the new condition type. + + Step 3: Add a case block to ConditionMgr::isSourceTypeValid with the new condition type + and validate the parameters. + + Step 4: If your condition can be grouped (determined in step 2), add a rule for it in + ConditionMgr::CanHaveSourceGroupSet, following the example of the existing types. + + Step 5: Define the maximum available condition targets in ConditionMgr::GetMaxAvailableConditionTargets. + + The following steps only apply if your condition can be grouped: + + Step 6: Determine how you are going to store your conditions. You need to add a new storage container + for it in ConditionMgr class, along with a function like: + ConditionList GetConditionsForXXXYourNewSourceTypeXXX(parameters...) + + The above function should be placed in upper level (practical) code that actually + checks the conditions. + + Step 7: Implement loading for your source type in ConditionMgr::LoadConditions. + + Step 8: Implement memory cleaning for your source type in ConditionMgr::Clean. +*/ enum ConditionSourceType { CONDITION_SOURCE_TYPE_NONE = 0, diff --git a/src/server/game/DataStores/DBCEnums.h b/src/server/game/DataStores/DBCEnums.h index 8055641f3a4..dcd189a05cb 100755 --- a/src/server/game/DataStores/DBCEnums.h +++ b/src/server/game/DataStores/DBCEnums.h @@ -343,7 +343,7 @@ enum AreaFlags AREA_FLAG_CITY = 0x00000200, // only for one zone named "City" (where it located?) AREA_FLAG_OUTLAND = 0x00000400, // expansion zones? (only Eye of the Storm not have this flag, but have 0x00004000 flag) AREA_FLAG_SANCTUARY = 0x00000800, // sanctuary area (PvP disabled) - AREA_FLAG_NEED_FLY = 0x00001000, // Unknown + AREA_FLAG_NEED_FLY = 0x00001000, // Respawn alive at the graveyard without corpse AREA_FLAG_UNUSED1 = 0x00002000, // Unused in 3.3.5a AREA_FLAG_OUTLAND2 = 0x00004000, // expansion zones? (only Circle of Blood Arena not have this flag, but have 0x00000400 flag) AREA_FLAG_OUTDOOR_PVP = 0x00008000, // pvp objective area? (Death's Door also has this flag although it's no pvp object area) @@ -358,7 +358,7 @@ enum AreaFlags AREA_FLAG_WINTERGRASP = 0x01000000, // Wintergrasp and it's subzones AREA_FLAG_INSIDE = 0x02000000, // used for determinating spell related inside/outside questions in Map::IsOutdoors AREA_FLAG_OUTSIDE = 0x04000000, // used for determinating spell related inside/outside questions in Map::IsOutdoors - AREA_FLAG_WINTERGRASP_2 = 0x08000000, // Same as AREA_FLAG_WINTERGRASP except for The Sunken Ring and Western Bridge. + AREA_FLAG_WINTERGRASP_2 = 0x08000000, // Can Hearth And Resurrect From Area AREA_FLAG_NO_FLY_ZONE = 0x20000000, // Marks zones where you cannot fly AREA_FLAG_UNK9 = 0x40000000, }; diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index 6dbd1d847db..e8087753efd 100755 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -129,7 +129,7 @@ DBCStorage <ItemRandomSuffixEntry> sItemRandomSuffixStore(ItemRandomSuffixfmt); DBCStorage <ItemSetEntry> sItemSetStore(ItemSetEntryfmt); DBCStorage <LFGDungeonEntry> sLFGDungeonStore(LFGDungeonEntryfmt); -//DBCStorage <LiquidTypeEntry> sLiquidTypeStore(LiquidTypeEntryfmt); +DBCStorage <LiquidTypeEntry> sLiquidTypeStore(LiquidTypefmt); DBCStorage <LockEntry> sLockStore(LockEntryfmt); DBCStorage <MailTemplateEntry> sMailTemplateStore(MailTemplateEntryfmt); @@ -411,6 +411,7 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales, bad_dbc_files, sItemDisenchantLootStore, dbcPath, "ItemDisenchantLoot.dbc"); LoadDBC(availableDbcLocales, bad_dbc_files, sLFGDungeonStore, dbcPath, "LFGDungeons.dbc");//14545 + LoadDBC(availableDbcLocales, bad_dbc_files, sLiquidTypeStore, dbcPath, "LiquidType.dbc");//14545 LoadDBC(availableDbcLocales, bad_dbc_files, sLockStore, dbcPath, "Lock.dbc");//14545 LoadDBC(availableDbcLocales, bad_dbc_files, sPhaseStores, dbcPath, "Phase.dbc");//14545 @@ -567,7 +568,9 @@ void LoadDBCStores(const std::string& dataPath) for (unsigned int i = 0; i < sTalentStore.GetNumRows(); ++i) { TalentEntry const* talentInfo = sTalentStore.LookupEntry(i); - if (!talentInfo) continue; + if (!talentInfo) + continue; + for (int j = 0; j < MAX_TALENT_RANK; j++) if (talentInfo->RankID[j]) sTalentSpellPosMap[talentInfo->RankID[j]] = TalentSpellPos(i, j); @@ -632,7 +635,7 @@ void LoadDBCStores(const std::string& dataPath) // include existed nodes that have at least single not spell base (scripted) path { std::set<uint32> spellPaths; - for (uint32 i = 1; i < sSpellStore.GetNumRows (); ++i) + for (uint32 i = 1; i < sSpellStore.GetNumRows(); ++i) if (SpellEffectEntry const* sInfo = sSpellEffectStore.LookupEntry (i)) if (sInfo->Effect == SPELL_EFFECT_SEND_TAXI) spellPaths.insert(sInfo->EffectMiscValue); @@ -1156,10 +1159,10 @@ uint32 ScalingStatValuesEntry::GetDPSAndDamageMultiplier(uint32 subClass, bool i } // script support functions - DBCStorage <SoundEntriesEntry> const* GetSoundEntriesStore() { return &sSoundEntriesStore; } - DBCStorage <SpellRangeEntry> const* GetSpellRangeStore() { return &sSpellRangeStore; } - DBCStorage <FactionEntry> const* GetFactionStore() { return &sFactionStore; } - DBCStorage <CreatureDisplayInfoEntry> const* GetCreatureDisplayStore() { return &sCreatureDisplayInfoStore; } - DBCStorage <EmotesEntry> const* GetEmotesStore() { return &sEmotesStore; } - DBCStorage <EmotesTextEntry> const* GetEmotesTextStore() { return &sEmotesTextStore; } - DBCStorage <AchievementEntry> const* GetAchievementStore() { return &sAchievementStore; } +DBCStorage <SoundEntriesEntry> const* GetSoundEntriesStore() { return &sSoundEntriesStore; } +DBCStorage <SpellRangeEntry> const* GetSpellRangeStore() { return &sSpellRangeStore; } +DBCStorage <FactionEntry> const* GetFactionStore() { return &sFactionStore; } +DBCStorage <CreatureDisplayInfoEntry> const* GetCreatureDisplayStore() { return &sCreatureDisplayInfoStore; } +DBCStorage <EmotesEntry> const* GetEmotesStore() { return &sEmotesStore; } +DBCStorage <EmotesTextEntry> const* GetEmotesTextStore() { return &sEmotesTextStore; } +DBCStorage <AchievementEntry> const* GetAchievementStore() { return &sAchievementStore; } diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h index f77f6195aea..d04dc4ff131 100755 --- a/src/server/game/DataStores/DBCStores.h +++ b/src/server/game/DataStores/DBCStores.h @@ -138,6 +138,7 @@ extern DBCStorage <ItemRandomPropertiesEntry> sItemRandomPropertiesStore; extern DBCStorage <ItemRandomSuffixEntry> sItemRandomSuffixStore; extern DBCStorage <ItemSetEntry> sItemSetStore; extern DBCStorage <LFGDungeonEntry> sLFGDungeonStore; +extern DBCStorage <LiquidTypeEntry> sLiquidTypeStore; extern DBCStorage <LockEntry> sLockStore; extern DBCStorage <MailTemplateEntry> sMailTemplateStore; extern DBCStorage <MapEntry> sMapStore; diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h index cc25a8f5495..f0b462e827c 100755 --- a/src/server/game/DataStores/DBCStructure.h +++ b/src/server/game/DataStores/DBCStructure.h @@ -543,9 +543,7 @@ struct AreaTableEntry //uint32 unk8; // 8, //uint32 unk9; // 9, int32 area_level; // 10 - char* area_name; // 11 uint32 team; // 12 - //uint32 unk13; // 13, //uint32 unk14; // 14, All zeros (4.2.2) //uint32 unk15; // 15, //uint32 unk16; // 16, Only Naxxramas has value (21) @@ -1288,27 +1286,29 @@ struct LFGDungeonEntry uint32 Entry() const { return ID + (type << 24); } }; -/* + struct LiquidTypeEntry { - uint32 ID; // 0 - char* name; // 1 - uint32 flags; // 2 Water: 1|2|4|8, Magma: 8|16|32|64, Slime: 2|64|256, WMO Ocean: 1|2|4|8|512 - uint32 type; // 3 0: Water, 1: Ocean, 2: Magma, 3: Slime - uint32 soundid; // 4 Reference to SoundEntries.dbc - uint32 spellID; // 5 Reference to Spell.dbc - float unk0[4]; // 6-9 - uint32 unk1; // 10 Light? - float particleScale // 11 0: Slime, 1: Water/Ocean, 4: Magma - uint32 particleMovement; // 12 - uint32 unk2 // 13 - uint32 LiquidMaterialID // 14 Reference to LiquidMaterial.dbc - char* texture[6]; // 15-20 - uint32 unk3[2] // 21-22 - float unk4[18]; // 23-40 - uint32 unk5[4] // 41-44 + uint32 Id; + //char* Name; + //uint32 Flags; + uint32 Type; + //uint32 SoundId; + uint32 SpellId; + //float MaxDarkenDepth; + //float FogDarkenIntensity; + //float AmbDarkenIntensity; + //float DirDarkenIntensity; + //uint32 LightID; + //float ParticleScale; + //uint32 ParticleMovement; + //uint32 ParticleTexSlots; + //uint32 LiquidMaterialID; + //char* Texture[6]; + //uint32 Color[2]; + //float Unk1[18]; + //uint32 Unk2[4]; }; -*/ #define MAX_LOCK_CASE 8 @@ -1368,6 +1368,7 @@ struct MapEntry bool IsBattleground() const { return map_type == MAP_BATTLEGROUND; } bool IsBattleArena() const { return map_type == MAP_ARENA; } bool IsBattlegroundOrArena() const { return map_type == MAP_BATTLEGROUND || map_type == MAP_ARENA; } + bool IsWorldMap() const { return map_type == MAP_COMMON; } bool GetEntrancePos(int32 &mapid, float &x, float &y) const { @@ -2212,7 +2213,7 @@ struct WorldMapAreaEntry float x2; // 7 int32 virtual_map_id; // 8 -1 (map_id have correct map) other: virtual map where zone show (map_id - where zone in fact internally) // int32 dungeonMap_id; // 9 pointer to DungeonMap.dbc (owerride x1, x2, y1, y2 coordinates) - // uint32 someMapID; // 10 + // uint32 parentMapID; // 10 }; #define MAX_WORLD_MAP_OVERLAY_AREA_IDX 4 diff --git a/src/server/game/DataStores/DBCfmt.h b/src/server/game/DataStores/DBCfmt.h index c0923b45400..df5e1ce5035 100755 --- a/src/server/game/DataStores/DBCfmt.h +++ b/src/server/game/DataStores/DBCfmt.h @@ -88,7 +88,7 @@ const char ItemRandomPropertiesfmt[]="nxiiixxs"; const char ItemRandomSuffixfmt[]="nsxiiiiiiiiii"; const char ItemSetEntryfmt[]="dsiiiiiiiiiixxxxxxxiiiiiiiiiiiiiiiiii"; const char LFGDungeonEntryfmt[]="nxiiiiiiixixxixixx"; -//const char LiquidTypeEntryfmt[]="nsiiiiffffifiiisssssiiffffffffffffffffffiiii"; +const char LiquidTypefmt[]="nxxixixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; const char LockEntryfmt[]="niiiiiiiiiiiiiiiiiiiiiiiixxxxxxxx"; const char PhaseEntryfmt[]="nsi"; const char MailTemplateEntryfmt[]="nxs"; diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index e6039880b63..47c298d7467 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -38,7 +38,8 @@ m_NumWaitTimeAvg(0), m_NumWaitTimeTank(0), m_NumWaitTimeHealer(0), m_NumWaitTime m_update = sWorld->getBoolConfig(CONFIG_DUNGEON_FINDER_ENABLE); if (m_update) { - new LFGScripts(); + new LFGPlayerScript(); + new LFGGroupScript(); // Initialize dungeon cache for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i) @@ -1022,7 +1023,7 @@ bool LFGMgr::CheckCompatibility(LfgGuidList check, LfgProposal*& pProposal) // Select a random dungeon from the compatible list // TODO - Select the dungeon based on group item Level, not just random // Create a new proposal - pProposal = new LfgProposal(SelectRandomContainerElement(compatibleDungeons)); + pProposal = new LfgProposal(Trinity::Containers::SelectRandomContainerElement(compatibleDungeons)); pProposal->cancelTime = time_t(time(NULL)) + LFG_TIME_PROPOSAL; pProposal->state = LFG_PROPOSAL_INITIATING; pProposal->queues = check; @@ -1166,7 +1167,7 @@ void LFGMgr::UpdateRoleCheck(uint64 gguid, uint64 guid /* = 0 */, uint8 roles /* } m_QueueInfoMap[gguid] = pqInfo; - if(GetState(gguid) != LFG_STATE_NONE) + if (GetState(gguid) != LFG_STATE_NONE) { LfgGuidList& currentQueue = m_currentQueue[team]; currentQueue.push_front(gguid); diff --git a/src/server/game/DungeonFinding/LFGScripts.cpp b/src/server/game/DungeonFinding/LFGScripts.cpp index 2966e799c58..6175addfae2 100644 --- a/src/server/game/DungeonFinding/LFGScripts.cpp +++ b/src/server/game/DungeonFinding/LFGScripts.cpp @@ -27,9 +27,45 @@ #include "LFGScripts.h" #include "LFGMgr.h" -LFGScripts::LFGScripts(): GroupScript("LFGScripts"), PlayerScript("LFGScripts") {} +LFGPlayerScript::LFGPlayerScript() : PlayerScript("LFGPlayerScript") +{ +} + +void LFGPlayerScript::OnLevelChanged(Player* player, uint8 /*oldLevel*/) +{ + sLFGMgr->InitializeLockedDungeons(player); +} -void LFGScripts::OnAddMember(Group* group, uint64 guid) +void LFGPlayerScript::OnLogout(Player* player) +{ + sLFGMgr->Leave(player); + LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE); + player->GetSession()->SendLfgUpdateParty(updateData); + player->GetSession()->SendLfgUpdatePlayer(updateData); + player->GetSession()->SendLfgUpdateSearch(false); + uint64 guid = player->GetGUID(); + // TODO - Do not remove, add timer before deleting + sLFGMgr->RemovePlayerData(guid); +} + +void LFGPlayerScript::OnLogin(Player* player) +{ + sLFGMgr->InitializeLockedDungeons(player); + // TODO - Restore LfgPlayerData and send proper status to player if it was in a group +} + +void LFGPlayerScript::OnBindToInstance(Player* player, Difficulty difficulty, uint32 mapId, bool /*permanent*/) +{ + MapEntry const* mapEntry = sMapStore.LookupEntry(mapId); + if (mapEntry->IsDungeon() && difficulty > DUNGEON_DIFFICULTY_NORMAL) + sLFGMgr->InitializeLockedDungeons(player); +} + +LFGGroupScript::LFGGroupScript() : GroupScript("LFGGroupScript") +{ +} + +void LFGGroupScript::OnAddMember(Group* group, uint64 guid) { uint64 gguid = group->GetGUID(); if (!gguid) @@ -55,7 +91,7 @@ void LFGScripts::OnAddMember(Group* group, uint64 guid) sLFGMgr->Leave(player); } -void LFGScripts::OnRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, const char* reason) +void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, char const* reason) { uint64 gguid = group->GetGUID(); if (!gguid || method == GROUP_REMOVEMETHOD_DEFAULT) @@ -102,7 +138,7 @@ void LFGScripts::OnRemoveMember(Group* group, uint64 guid, RemoveMethod method, sLFGMgr->OfferContinue(group); } -void LFGScripts::OnDisband(Group* group) +void LFGGroupScript::OnDisband(Group* group) { uint64 gguid = group->GetGUID(); sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnDisband [" UI64FMTD "]", gguid); @@ -110,7 +146,7 @@ void LFGScripts::OnDisband(Group* group) sLFGMgr->RemoveGroupData(gguid); } -void LFGScripts::OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid) +void LFGGroupScript::OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid) { uint64 gguid = group->GetGUID(); if (!gguid) @@ -131,7 +167,7 @@ void LFGScripts::OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLe } } -void LFGScripts::OnInviteMember(Group* group, uint64 guid) +void LFGGroupScript::OnInviteMember(Group* group, uint64 guid) { uint64 gguid = group->GetGUID(); if (!gguid) @@ -140,33 +176,3 @@ void LFGScripts::OnInviteMember(Group* group, uint64 guid) sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnInviteMember [" UI64FMTD "]: invite [" UI64FMTD "] leader [" UI64FMTD "]", gguid, guid, group->GetLeaderGUID()); sLFGMgr->Leave(NULL, group); } - -void LFGScripts::OnLevelChanged(Player* player, uint8 /*oldLevel*/) -{ - sLFGMgr->InitializeLockedDungeons(player); -} - -void LFGScripts::OnLogout(Player* player) -{ - sLFGMgr->Leave(player); - LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE); - player->GetSession()->SendLfgUpdateParty(updateData); - player->GetSession()->SendLfgUpdatePlayer(updateData); - player->GetSession()->SendLfgUpdateSearch(false); - uint64 guid = player->GetGUID(); - // TODO - Do not remove, add timer before deleting - sLFGMgr->RemovePlayerData(guid); -} - -void LFGScripts::OnLogin(Player* player) -{ - sLFGMgr->InitializeLockedDungeons(player); - // TODO - Restore LfgPlayerData and send proper status to player if it was in a group -} - -void LFGScripts::OnBindToInstance(Player* player, Difficulty difficulty, uint32 mapId, bool /*permanent*/) -{ - MapEntry const* mapEntry = sMapStore.LookupEntry(mapId); - if (mapEntry->IsDungeon() && difficulty > DUNGEON_DIFFICULTY_NORMAL) - sLFGMgr->InitializeLockedDungeons(player); -} diff --git a/src/server/game/DungeonFinding/LFGScripts.h b/src/server/game/DungeonFinding/LFGScripts.h index f17f7b16af1..4b332c7d731 100644 --- a/src/server/game/DungeonFinding/LFGScripts.h +++ b/src/server/game/DungeonFinding/LFGScripts.h @@ -26,17 +26,10 @@ class Player; class Group; -class LFGScripts: public GroupScript, public PlayerScript +class LFGPlayerScript : public PlayerScript { public: - LFGScripts(); - - // Group Hooks - void OnAddMember(Group* group, uint64 guid); - void OnRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, const char* reason); - void OnDisband(Group* group); - void OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid); - void OnInviteMember(Group* group, uint64 guid); + LFGPlayerScript(); // Player Hooks void OnLevelChanged(Player* player, uint8 oldLevel); @@ -44,3 +37,16 @@ class LFGScripts: public GroupScript, public PlayerScript void OnLogin(Player* player); void OnBindToInstance(Player* player, Difficulty difficulty, uint32 mapId, bool permanent); }; + +class LFGGroupScript : public GroupScript +{ + public: + LFGGroupScript(); + + // Group Hooks + void OnAddMember(Group* group, uint64 guid); + void OnRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, char const* reason); + void OnDisband(Group* group); + void OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid); + void OnInviteMember(Group* group, uint64 guid); +}; diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp index 858a218774c..714be7d7c9e 100755 --- a/src/server/game/Entities/Corpse/Corpse.cpp +++ b/src/server/game/Entities/Corpse/Corpse.cpp @@ -32,7 +32,7 @@ Corpse::Corpse(CorpseType type) : WorldObject(type != CORPSE_BONES) m_objectType |= TYPEMASK_CORPSE; m_objectTypeId = TYPEID_CORPSE; - m_updateFlag = (UPDATEFLAG_HAS_POSITION | UPDATEFLAG_POSITION); + m_updateFlag = (UPDATEFLAG_STATIONARY_POSITION | UPDATEFLAG_POSITION); m_valuesCount = CORPSE_END; @@ -89,7 +89,7 @@ bool Corpse::Create(uint32 guidlow, Player* owner) WorldObject::_Create(guidlow, HIGHGUID_CORPSE, owner->GetPhaseMask()); - SetFloatValue(OBJECT_FIELD_SCALE_X, 1); + SetObjectScale(1); SetUInt64Value(CORPSE_FIELD_OWNER, owner->GetGUID()); _gridCoord = Trinity::ComputeGridCoord(GetPositionX(), GetPositionY()); diff --git a/src/server/game/Entities/Corpse/Corpse.h b/src/server/game/Entities/Corpse/Corpse.h index 1aaf56eaf27..afac900df32 100755 --- a/src/server/game/Entities/Corpse/Corpse.h +++ b/src/server/game/Entities/Corpse/Corpse.h @@ -91,4 +91,3 @@ class Corpse : public WorldObject, public GridObject<Corpse> GridCoord _gridCoord; // gride for corpse position for fast search }; #endif - diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index fc403ef1ff7..ca075703277 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -135,7 +135,7 @@ CreatureBaseStats const* CreatureBaseStats::GetBaseStats(uint8 level, uint8 unit bool ForcedDespawnDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) { - m_owner.ForcedDespawn(); + m_owner.DespawnOrUnsummon(); // since we are here, we are not TempSummon as object type cannot change during runtime return true; } @@ -199,7 +199,7 @@ void Creature::RemoveFromWorld() if (m_zoneScript) m_zoneScript->OnCreatureRemove(this); if (m_formation) - FormationMgr::RemoveCreatureFromGroup(m_formation, this); + sFormationMgr->RemoveCreatureFromGroup(m_formation, this); Unit::RemoveFromWorld(); sObjectAccessor->RemoveObject(this); } @@ -224,9 +224,9 @@ void Creature::SearchFormation() if (!lowguid) return; - CreatureGroupInfoType::iterator frmdata = CreatureGroupMap.find(lowguid); - if (frmdata != CreatureGroupMap.end()) - FormationMgr::AddCreatureToGroup(frmdata->second->leaderGUID, this); + CreatureGroupInfoType::iterator frmdata = sFormationMgr->CreatureGroupMap.find(lowguid); + if (frmdata != sFormationMgr->CreatureGroupMap.end()) + sFormationMgr->AddCreatureToGroup(frmdata->second->leaderGUID, this); } void Creature::RemoveCorpse(bool setSpawnTime) @@ -303,7 +303,7 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData* data return false; } - uint32 displayID = sObjectMgr->ChooseDisplayId(0, GetCreatureInfo(), data); + uint32 displayID = sObjectMgr->ChooseDisplayId(0, GetCreatureTemplate(), data); CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID); if (!minfo) // Cancel load if no model defined { @@ -333,8 +333,9 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData* data SetSpeed(MOVE_SWIM, 1.0f); // using 1.0 rate SetSpeed(MOVE_FLIGHT, 1.0f); // using 1.0 rate - SetFloatValue(OBJECT_FIELD_SCALE_X, cinfo->scale); - SetLevitate(canFly()); + SetObjectScale(cinfo->scale); + + SetFloatValue(UNIT_FIELD_HOVERHEIGHT, cinfo->HoverHeight); // checked at loading m_defaultMovementType = MovementGeneratorType(cinfo->MovementType); @@ -342,7 +343,7 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData* data m_defaultMovementType = IDLE_MOTION_TYPE; for (uint8 i=0; i < CREATURE_MAX_SPELLS; ++i) - m_spells[i] = GetCreatureInfo()->spells[i]; + m_spells[i] = GetCreatureTemplate()->spells[i]; return true; } @@ -352,14 +353,15 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData* data) if (!InitEntry(Entry, team, data)) return false; - CreatureTemplate const* cInfo = GetCreatureInfo(); + CreatureTemplate const* cInfo = GetCreatureTemplate(); m_regenHealth = cInfo->RegenHealth; - // creatures always have melee weapon ready if any - SetSheath(SHEATH_STATE_MELEE); + // creatures always have melee weapon ready if any unless specified otherwise + if (!GetCreatureAddon()) + SetSheath(SHEATH_STATE_MELEE); - SelectLevel(GetCreatureInfo()); + SelectLevel(GetCreatureTemplate()); if (team == HORDE) setFaction(cInfo->faction_H); else @@ -418,10 +420,25 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData* data) ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, true); } - // TODO: In fact monster move flags should be set - not movement flags. - if (cInfo->InhabitType & INHABIT_AIR) - AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_FLYING); + //! Suspect it works this way: + //! If creature can walk and fly (usually with pathing) + //! Set MOVEMENTFLAG_CAN_FLY. Otherwise if it can only fly + //! Set MOVEMENTFLAG_DISABLE_GRAVITY + //! The only time I saw Movement Flags: DisableGravity, CanFly, Flying (50332672) on the same unit + //! it was a vehicle + if (cInfo->InhabitType & INHABIT_AIR && cInfo->InhabitType & INHABIT_GROUND) + SetCanFly(true); + else if (cInfo->InhabitType & INHABIT_AIR) + SetDisableGravity(true); + /*! Implemented in LoadCreatureAddon. Suspect there's a rule for UNIT_BYTE_1_FLAG_HOVER + in relation to DisableGravity also. + + else if (GetByteValue(UNIT_FIELD_BYTES_1, 3) & UNIT_BYTE_1_FLAG_HOVER) + SetHover(true); + */ + + // TODO: Shouldn't we check whether or not the creature is in water first? if (cInfo->InhabitType & INHABIT_WATER) AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING); @@ -451,9 +468,9 @@ void Creature::Update(uint32 diff) switch (m_deathState) { - case JUST_ALIVED: - // Must not be called, see Creature::setDeathState JUST_ALIVED -> ALIVE promoting. - sLog->outError("Creature (GUID: %u Entry: %u) in wrong state: JUST_ALIVED (4)", GetGUIDLow(), GetEntry()); + case JUST_RESPAWNED: + // Must not be called, see Creature::setDeathState JUST_RESPAWNED -> ALIVE promoting. + sLog->outError("Creature (GUID: %u Entry: %u) in wrong state: JUST_RESPAWNED (4)", GetGUIDLow(), GetEntry()); break; case JUST_DIED: // Must not be called, see Creature::setDeathState JUST_DIED -> CORPSE promoting. @@ -742,19 +759,21 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, return false; } + //! Relocate before CreateFromProto, to initialize coords and allow + //! returning correct zone id for selecting OutdoorPvP/Battlefield script Relocate(x, y, z, ang); + //oX = x; oY = y; dX = x; dY = y; m_moveTime = 0; m_startMove = 0; + if (!CreateFromProto(guidlow, Entry, vehId, team, data)) + return false; + if (!IsPositionValid()) { sLog->outError("Creature::Create(): given coordinates for creature (guidlow %d, entry %d) are not valid (X: %f, Y: %f, Z: %f, O: %f)", guidlow, Entry, x, y, z, ang); return false; } - //oX = x; oY = y; dX = x; dY = y; m_moveTime = 0; m_startMove = 0; - if (!CreateFromProto(guidlow, Entry, vehId, team, data)) - return false; - - switch (GetCreatureInfo()->rank) + switch (GetCreatureTemplate()->rank) { case CREATURE_ELITE_RARE: m_corpseDelay = sWorld->getIntConfig(CONFIG_CORPSE_DECAY_RARE); @@ -774,6 +793,16 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, } LoadCreaturesAddon(); + + //! Need to be called after LoadCreaturesAddon - MOVEMENTFLAG_HOVER is set there + if (HasUnitMovementFlag(MOVEMENTFLAG_HOVER)) + { + z += GetFloatValue(UNIT_FIELD_HOVERHEIGHT); + + //! Relocate again with updated Z coord + Relocate(x, y, z, ang); + } + uint32 displayID = GetNativeDisplayId(); CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID); if (minfo && !isTotem()) // Cancel load if no model defined or if totem @@ -783,18 +812,7 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, SetByteValue(UNIT_FIELD_BYTES_0, 2, minfo->gender); } - if (GetCreatureInfo()->InhabitType & INHABIT_AIR) - { - if (GetDefaultMovementType() == IDLE_MOTION_TYPE) - AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY); - else - SetFlying(true); - } - - if (GetCreatureInfo()->InhabitType & INHABIT_WATER) - AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING); - - LastUsedScriptID = GetCreatureInfo()->ScriptID; + LastUsedScriptID = GetCreatureTemplate()->ScriptID; // TODO: Replace with spell, handle from DB if (isSpiritHealer() || isSpiritGuide()) @@ -816,22 +834,22 @@ bool Creature::isCanTrainingOf(Player* player, bool msg) const TrainerSpellData const* trainer_spells = GetTrainerSpells(); - if ((!trainer_spells || trainer_spells->spellList.empty()) && GetCreatureInfo()->trainer_type != TRAINER_TYPE_PETS) + if ((!trainer_spells || trainer_spells->spellList.empty()) && GetCreatureTemplate()->trainer_type != TRAINER_TYPE_PETS) { sLog->outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_TRAINER but have empty trainer spell list.", GetGUIDLow(), GetEntry()); return false; } - switch (GetCreatureInfo()->trainer_type) + switch (GetCreatureTemplate()->trainer_type) { case TRAINER_TYPE_CLASS: - if (player->getClass() != GetCreatureInfo()->trainer_class) + if (player->getClass() != GetCreatureTemplate()->trainer_class) { if (msg) { player->PlayerTalkClass->ClearMenus(); - switch (GetCreatureInfo()->trainer_class) + switch (GetCreatureTemplate()->trainer_class) { case CLASS_DRUID: player->PlayerTalkClass->SendGossipMenu(4913, GetGUID()); break; case CLASS_HUNTER: player->PlayerTalkClass->SendGossipMenu(10090, GetGUID()); break; @@ -856,12 +874,12 @@ bool Creature::isCanTrainingOf(Player* player, bool msg) const } break; case TRAINER_TYPE_MOUNTS: - if (GetCreatureInfo()->trainer_race && player->getRace() != GetCreatureInfo()->trainer_race) + if (GetCreatureTemplate()->trainer_race && player->getRace() != GetCreatureTemplate()->trainer_race) { if (msg) { player->PlayerTalkClass->ClearMenus(); - switch (GetCreatureInfo()->trainer_class) + switch (GetCreatureTemplate()->trainer_class) { case RACE_DWARF: player->PlayerTalkClass->SendGossipMenu(5865, GetGUID()); break; case RACE_GNOME: player->PlayerTalkClass->SendGossipMenu(4881, GetGUID()); break; @@ -879,7 +897,7 @@ bool Creature::isCanTrainingOf(Player* player, bool msg) const } break; case TRAINER_TYPE_TRADESKILLS: - if (GetCreatureInfo()->trainer_spell && !player->HasSpell(GetCreatureInfo()->trainer_spell)) + if (GetCreatureTemplate()->trainer_spell && !player->HasSpell(GetCreatureTemplate()->trainer_spell)) { if (msg) { @@ -930,8 +948,8 @@ bool Creature::isCanInteractWithBattleMaster(Player* player, bool msg) const bool Creature::isCanTrainingAndResetTalentsOf(Player* player) const { return player->getLevel() >= 10 - && GetCreatureInfo()->trainer_type == TRAINER_TYPE_CLASS - && player->getClass() == GetCreatureInfo()->trainer_class; + && GetCreatureTemplate()->trainer_type == TRAINER_TYPE_CLASS + && player->getClass() == GetCreatureTemplate()->trainer_class; } void Creature::AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint32 /*MovementFlags*/, uint8 /*type*/) @@ -1040,7 +1058,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) uint32 dynamicflags = GetUInt32Value(UNIT_DYNAMIC_FLAGS); // check if it's a custom model and if not, use 0 for displayId - CreatureTemplate const* cinfo = GetCreatureInfo(); + CreatureTemplate const* cinfo = GetCreatureTemplate(); if (cinfo) { if (displayId == cinfo->Modelid1 || displayId == cinfo->Modelid2 || @@ -1065,11 +1083,11 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) data.equipmentId = GetEquipmentId(); data.posX = GetPositionX(); data.posY = GetPositionY(); - data.posZ = GetPositionZ(); + data.posZ = GetPositionZMinusOffset(); data.orientation = GetOrientation(); data.spawntimesecs = m_respawnDelay; // prevent add data integrity problems - data.spawndist = GetDefaultMovementType() == IDLE_MOTION_TYPE ? 0 : m_respawnradius; + data.spawndist = GetDefaultMovementType() == IDLE_MOTION_TYPE ? 0.0f : m_respawnradius; data.currentwaypoint = 0; data.curhealth = GetHealth(); data.curmana = GetPower(POWER_MANA); @@ -1084,32 +1102,34 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) // update in DB SQLTransaction trans = WorldDatabase.BeginTransaction(); - trans->PAppend("DELETE FROM creature WHERE guid = '%u'", m_DBTableGuid); - - std::ostringstream ss; - ss << "INSERT INTO creature VALUES (" - << m_DBTableGuid << ',' - << GetEntry() << ',' - << mapid << ',' - << uint32(spawnMask) << ',' // cast to prevent save as symbol - << uint16(GetPhaseMask()) << ',' // prevent out of range error - << displayId << ',' - << GetEquipmentId() << ',' - << GetPositionX() << ',' - << GetPositionY() << ',' - << GetPositionZ() << ',' - << GetOrientation() << ',' - << m_respawnDelay << ',' //respawn time - << (float) m_respawnradius << ',' //spawn distance (float) - << (uint32) (0) << ',' //currentwaypoint - << GetHealth() << ',' //curhealth - << GetPower(POWER_MANA) << ',' //curmana - << GetDefaultMovementType() << ',' //default movement generator type - << npcflag << ',' - << unit_flags << ',' - << dynamicflags << ')'; - - trans->Append(ss.str().c_str()); + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE); + stmt->setUInt32(0, m_DBTableGuid); + trans->Append(stmt); + + uint8 index = 0; + + stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_CREATURE); + stmt->setUInt32(index++, m_DBTableGuid); + stmt->setUInt32(index++, GetEntry()); + stmt->setUInt16(index++, uint16(mapid)); + stmt->setUInt8(index++, spawnMask); + stmt->setUInt16(index++, uint16(GetPhaseMask())); + stmt->setUInt32(index++, displayId); + stmt->setInt32(index++, int32(GetEquipmentId())); + stmt->setFloat(index++, GetPositionX()); + stmt->setFloat(index++, GetPositionY()); + stmt->setFloat(index++, GetPositionZ()); + stmt->setFloat(index++, GetOrientation()); + stmt->setUInt32(index++, m_respawnDelay); + stmt->setFloat(index++, m_respawnradius); + stmt->setUInt32(index++, 0); + stmt->setUInt32(index++, GetHealth()); + stmt->setUInt32(index++, GetPower(POWER_MANA)); + stmt->setUInt8(index++, uint8(GetDefaultMovementType())); + stmt->setUInt32(index++, npcflag); + stmt->setUInt32(index++, unit_flags); + stmt->setUInt32(index++, dynamicflags); + trans->Append(stmt); WorldDatabase.CommitTransaction(trans); } @@ -1287,7 +1307,7 @@ bool Creature::LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap) if (m_respawnTime) // respawn on Update { m_deathState = DEAD; - if (canFly()) + if (CanFly()) { float tz = map->GetHeight(GetPhaseMask(), data->posX, data->posY, data->posZ, false); if (data->posZ - tz > 0.1f) @@ -1302,7 +1322,7 @@ bool Creature::LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap) curhealth = data->curhealth; if (curhealth) { - curhealth = uint32(curhealth*_GetHealthMod(GetCreatureInfo()->rank)); + curhealth = uint32(curhealth*_GetHealthMod(GetCreatureTemplate()->rank)); if (curhealth < 1) curhealth = 1; } @@ -1382,10 +1402,23 @@ void Creature::DeleteFromDB() sObjectMgr->DeleteCreatureData(m_DBTableGuid); SQLTransaction trans = WorldDatabase.BeginTransaction(); - trans->PAppend("DELETE FROM creature WHERE guid = '%u'", m_DBTableGuid); - trans->PAppend("DELETE FROM creature_addon WHERE guid = '%u'", m_DBTableGuid); - trans->PAppend("DELETE FROM game_event_creature WHERE guid = '%u'", m_DBTableGuid); - trans->PAppend("DELETE FROM game_event_model_equip WHERE guid = '%u'", m_DBTableGuid); + + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE); + stmt->setUInt32(0, m_DBTableGuid); + trans->Append(stmt); + + stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE_ADDON); + stmt->setUInt32(0, m_DBTableGuid); + trans->Append(stmt); + + stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_GAME_EVENT_CREATURE); + stmt->setUInt32(0, m_DBTableGuid); + trans->Append(stmt); + + stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_GAME_EVENT_MODEL_EQUIP); + stmt->setUInt32(0, m_DBTableGuid); + trans->Append(stmt); + WorldDatabase.CommitTransaction(trans); } @@ -1420,7 +1453,7 @@ bool Creature::canStartAttack(Unit const* who, bool force) const if (who->GetTypeId() == TYPEID_UNIT && who->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET) return false; - if (!canFly() && (GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE + m_CombatDistance)) + if (!CanFly() && (GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE + m_CombatDistance)) //|| who->IsControlledByPlayer() && who->IsFlying())) // we cannot check flying for other creatures, too much map/vmap calculation // TODO: should switch to range attack @@ -1502,8 +1535,8 @@ void Creature::setDeathState(DeathState s) setActive(false); - if (!isPet() && GetCreatureInfo()->SkinLootId) - if (LootTemplates_Skinning.HaveLootFor(GetCreatureInfo()->SkinLootId)) + if (!isPet() && GetCreatureTemplate()->SkinLootId) + if (LootTemplates_Skinning.HaveLootFor(GetCreatureTemplate()->SkinLootId)) if (hasLootRecipient()) SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); @@ -1517,23 +1550,25 @@ void Creature::setDeathState(DeathState s) if (m_formation && m_formation->getLeader() == this) m_formation->FormationReset(true); - if ((canFly() || IsFlying())) + if ((CanFly() || IsFlying())) i_motionMaster.MoveFall(); Unit::setDeathState(CORPSE); } - else if (s == JUST_ALIVED) + else if (s == JUST_RESPAWNED) { //if (isPet()) // setActive(true); SetFullHealth(); SetLootRecipient(NULL); ResetPlayerDamageReq(); - CreatureTemplate const* cinfo = GetCreatureInfo(); + CreatureTemplate const* cinfo = GetCreatureTemplate(); SetWalk(true); - if (GetCreatureInfo()->InhabitType & INHABIT_AIR) - AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_FLYING); - if (GetCreatureInfo()->InhabitType & INHABIT_WATER) + if (cinfo->InhabitType & INHABIT_AIR && cinfo->InhabitType & INHABIT_GROUND) + SetCanFly(true); + else if (cinfo->InhabitType & INHABIT_AIR) + SetDisableGravity(true); + if (cinfo->InhabitType & INHABIT_WATER) AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING); SetUInt32Value(UNIT_NPC_FLAGS, cinfo->npcflag); ClearUnitState(uint32(UNIT_STATE_ALL_STATE)); @@ -1573,10 +1608,10 @@ void Creature::Respawn(bool force) if (m_originalEntry != GetEntry()) UpdateEntry(m_originalEntry); - CreatureTemplate const* cinfo = GetCreatureInfo(); + CreatureTemplate const* cinfo = GetCreatureTemplate(); SelectLevel(cinfo); - setDeathState(JUST_ALIVED); + setDeathState(JUST_RESPAWNED); uint32 displayID = GetNativeDisplayId(); CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID); @@ -1633,12 +1668,12 @@ bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo) if (!spellInfo) return false; - // Spells that don't have effectMechanics. - if (!spellInfo->HasAnyEffectMechanic() && GetCreatureInfo()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1))) + // Creature is immune to main mechanic of the spell + if (GetCreatureTemplate()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1))) return true; - // This check must be done instead of 'if (GetCreatureInfo()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1)))' for not break - // the check of mechanic immunity on DB (tested) because GetCreatureInfo()->MechanicImmuneMask and m_spellImmune[IMMUNITY_MECHANIC] don't have same data. + // This check must be done instead of 'if (GetCreatureTemplate()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1)))' for not break + // the check of mechanic immunity on DB (tested) because GetCreatureTemplate()->MechanicImmuneMask and m_spellImmune[IMMUNITY_MECHANIC] don't have same data. bool immunedToAllEffects = true; for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) if (!IsImmunedToSpellEffect(spellInfo, i)) @@ -1654,18 +1689,18 @@ bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo) bool Creature::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const { - if (GetCreatureInfo()->MechanicImmuneMask & (1 << (spellInfo->Effects[index].Mechanic - 1))) + if (GetCreatureTemplate()->MechanicImmuneMask & (1 << (spellInfo->Effects[index].Mechanic - 1))) return true; - if (GetCreatureInfo()->type == CREATURE_TYPE_MECHANICAL && spellInfo->Effects[index].Effect == SPELL_EFFECT_HEAL) + if (GetCreatureTemplate()->type == CREATURE_TYPE_MECHANICAL && spellInfo->Effects[index].Effect == SPELL_EFFECT_HEAL) return true; return Unit::IsImmunedToSpellEffect(spellInfo, index); } -SpellInfo const* Creature::reachWithSpellAttack(Unit* pVictim) +SpellInfo const* Creature::reachWithSpellAttack(Unit* victim) { - if (!pVictim) + if (!victim) return NULL; for (uint32 i=0; i < CREATURE_MAX_SPELLS; ++i) @@ -1686,7 +1721,7 @@ SpellInfo const* Creature::reachWithSpellAttack(Unit* pVictim) (spellInfo->Effects[j].Effect == SPELL_EFFECT_INSTAKILL) || (spellInfo->Effects[j].Effect == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE) || (spellInfo->Effects[j].Effect == SPELL_EFFECT_HEALTH_LEECH) -) + ) { bcontinue = false; break; @@ -1700,7 +1735,7 @@ SpellInfo const* Creature::reachWithSpellAttack(Unit* pVictim) continue; float range = spellInfo->GetMaxRange(false); float minrange = spellInfo->GetMinRange(false); - float dist = GetDistance(pVictim); + float dist = GetDistance(victim); if (dist > range || dist < minrange) continue; if (spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED)) @@ -1712,9 +1747,9 @@ SpellInfo const* Creature::reachWithSpellAttack(Unit* pVictim) return NULL; } -SpellInfo const* Creature::reachWithSpellCure(Unit* pVictim) +SpellInfo const* Creature::reachWithSpellCure(Unit* victim) { - if (!pVictim) + if (!victim) return NULL; for (uint32 i=0; i < CREATURE_MAX_SPELLS; ++i) @@ -1737,15 +1772,16 @@ SpellInfo const* Creature::reachWithSpellCure(Unit* pVictim) break; } } - if (bcontinue) continue; + if (bcontinue) + continue; if (spellInfo->ManaCost > (uint32)GetPower(POWER_MANA)) continue; float range = spellInfo->GetMaxRange(true); float minrange = spellInfo->GetMinRange(true); - float dist = GetDistance(pVictim); - //if (!isInFront(pVictim, range) && spellInfo->AttributesEx) + float dist = GetDistance(victim); + //if (!isInFront(victim, range) && spellInfo->AttributesEx) // continue; if (dist > range || dist < minrange) continue; @@ -1982,30 +2018,30 @@ void Creature::SaveRespawnTime() } // this should not be called by petAI or -bool Creature::canCreatureAttack(Unit const* pVictim, bool /*force*/) const +bool Creature::canCreatureAttack(Unit const* victim, bool /*force*/) const { - if (!pVictim->IsInMap(this)) + if (!victim->IsInMap(this)) return false; - if (!IsValidAttackTarget(pVictim)) + if (!IsValidAttackTarget(victim)) return false; - if (!pVictim->isInAccessiblePlaceFor(this)) + if (!victim->isInAccessiblePlaceFor(this)) return false; - if (IsAIEnabled && !AI()->CanAIAttack(pVictim)) + if (IsAIEnabled && !AI()->CanAIAttack(victim)) return false; if (sMapStore.LookupEntry(GetMapId())->IsDungeon()) return true; //Use AttackDistance in distance check if threat radius is lower. This prevents creature bounce in and out of combat every update tick. - float dist = std::max(GetAttackDistance(pVictim), sWorld->getFloatConfig(CONFIG_THREAT_RADIUS)) + m_CombatDistance; + float dist = std::max(GetAttackDistance(victim), sWorld->getFloatConfig(CONFIG_THREAT_RADIUS)) + m_CombatDistance; if (Unit* unit = GetCharmerOrOwner()) - return pVictim->IsWithinDist(unit, dist); + return victim->IsWithinDist(unit, dist); else - return pVictim->IsInDist(&m_homePosition, dist); + return victim->IsInDist(&m_homePosition, dist); } CreatureAddon const* Creature::GetCreatureAddon() const @@ -2017,7 +2053,7 @@ CreatureAddon const* Creature::GetCreatureAddon() const } // dependent from difficulty mode entry - return sObjectMgr->GetCreatureTemplateAddon(GetCreatureInfo()->Entry); + return sObjectMgr->GetCreatureTemplateAddon(GetCreatureTemplate()->Entry); } //creature_addon table @@ -2042,6 +2078,12 @@ bool Creature::LoadCreaturesAddon(bool reload) SetByteValue(UNIT_FIELD_BYTES_1, 1, 0); SetByteValue(UNIT_FIELD_BYTES_1, 2, uint8((cainfo->bytes1 >> 16) & 0xFF)); SetByteValue(UNIT_FIELD_BYTES_1, 3, uint8((cainfo->bytes1 >> 24) & 0xFF)); + + //! Suspected correlation between UNIT_FIELD_BYTES_1, offset 3, value 0x2: + //! If no inhabittype_fly (if no MovementFlag_DisableGravity flag found in sniffs) + //! Set MovementFlag_Hover. Otherwise do nothing. + if (GetByteValue(UNIT_FIELD_BYTES_1, 3) & UNIT_BYTE1_FLAG_HOVER && !IsLevitating()) + AddUnitMovementFlag(MOVEMENTFLAG_HOVER); } if (cainfo->bytes2 != 0) @@ -2090,6 +2132,7 @@ bool Creature::LoadCreaturesAddon(bool reload) sLog->outDebug(LOG_FILTER_UNITS, "Spell: %u added to creature (GUID: %u Entry: %u)", *itr, GetGUIDLow(), GetEntry()); } } + return true; } @@ -2238,7 +2281,7 @@ void Creature::AllLootRemovedFromCorpse() return; float decayRate; - CreatureTemplate const* cinfo = GetCreatureInfo(); + CreatureTemplate const* cinfo = GetCreatureTemplate(); decayRate = sWorld->getRate(RATE_CORPSE_DECAY_LOOTED); uint32 diff = uint32((m_corpseRemoveTime - now) * decayRate); @@ -2410,24 +2453,50 @@ bool Creature::IsDungeonBoss() const return cinfo && (cinfo->flags_extra & CREATURE_FLAG_EXTRA_DUNGEON_BOSS); } -void Creature::SetWalk(bool enable) +bool Creature::SetWalk(bool enable) { - if (enable) - AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - else - RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + if (!Unit::SetWalk(enable)) + return false; + WorldPacket data(enable ? SMSG_MOVE_SPLINE_SET_WALK_MODE : SMSG_MOVE_SPLINE_SET_RUN_MODE, 9); data.append(GetPackGUID()); - SendMessageToSet(&data, true); + SendMessageToSet(&data, false); + return true; } -void Creature::SetLevitate(bool enable) +bool Creature::SetDisableGravity(bool disable, bool packetOnly/*=false*/) { + //! It's possible only a packet is sent but moveflags are not updated + //! Need more research on this + if (!packetOnly && !Unit::SetDisableGravity(disable)) + return false; + + if (!movespline->Initialized()) + return true; + + WorldPacket data(disable ? SMSG_SPLINE_MOVE_GRAVITY_DISABLE : SMSG_SPLINE_MOVE_GRAVITY_ENABLE, 9); + data.append(GetPackGUID()); + SendMessageToSet(&data, false); + return true; +} + +bool Creature::SetHover(bool enable) +{ + if (!Unit::SetHover(enable)) + return false; + + //! Unconfirmed for players: if (enable) - AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_HOVER); else - RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - WorldPacket data(enable ? SMSG_MOVE_SPLINE_DISABLE_GRAVITY : SMSG_MOVE_SPLINE_ENABLE_GRAVITY, 9); + RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_HOVER); + + if (!movespline->Initialized()) + return true; + + //! Not always a packet is sent + WorldPacket data(enable ? SMSG_SPLINE_MOVE_SET_HOVER : SMSG_SPLINE_MOVE_UNSET_HOVER, 9); data.append(GetPackGUID()); - SendMessageToSet(&data, true); + SendMessageToSet(&data, false); + return true; } diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 847f2aa6fd1..906dc827d3f 100755 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -136,6 +136,7 @@ struct CreatureTemplate std::string AIName; uint32 MovementType; uint32 InhabitType; + float HoverHeight; float ModHealth; float ModMana; float ModArmor; @@ -267,7 +268,6 @@ struct CreatureData // `creature_addon` table struct CreatureAddon { - uint32 guidOrEntry; uint32 path_id; uint32 mount; uint32 bytes1; @@ -339,7 +339,9 @@ struct VendorItemData VendorItem* GetItem(uint32 slot) const { - if (slot >= m_items.size()) return NULL; + if (slot >= m_items.size()) + return NULL; + return m_items[slot]; } bool Empty() const { return m_items.empty(); } @@ -374,7 +376,7 @@ struct TrainerSpell { TrainerSpell() : spell(0), spellCost(0), reqSkill(0), reqSkillValue(0), reqLevel(0) { - for (uint8 i = 0; i < MAX_SPELL_EFFECTS ; ++i) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) learnedSpell[i] = 0; } @@ -459,17 +461,17 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature void Update(uint32 time); // overwrited Unit::Update void GetRespawnPosition(float &x, float &y, float &z, float* ori = NULL, float* dist =NULL) const; - uint32 GetEquipmentId() const { return GetCreatureInfo()->equipmentId; } + uint32 GetEquipmentId() const { return GetCreatureTemplate()->equipmentId; } void SetCorpseDelay(uint32 delay) { m_corpseDelay = delay; } uint32 GetCorpseDelay() const { return m_corpseDelay; } - bool isRacialLeader() const { return GetCreatureInfo()->RacialLeader; } - bool isCivilian() const { return GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_CIVILIAN; } - bool isTrigger() const { return GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER; } - bool isGuard() const { return GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_GUARD; } - bool canWalk() const { return GetCreatureInfo()->InhabitType & INHABIT_GROUND; } - bool canSwim() const { return GetCreatureInfo()->InhabitType & INHABIT_WATER; } - //bool canFly() const { return GetCreatureInfo()->InhabitType & INHABIT_AIR; } + bool isRacialLeader() const { return GetCreatureTemplate()->RacialLeader; } + bool isCivilian() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_CIVILIAN; } + bool isTrigger() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER; } + bool isGuard() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_GUARD; } + bool canWalk() const { return GetCreatureTemplate()->InhabitType & INHABIT_GROUND; } + bool canSwim() const { return GetCreatureTemplate()->InhabitType & INHABIT_WATER; } + bool CanFly() const { return GetCreatureTemplate()->InhabitType & INHABIT_AIR; } void SetReactState(ReactStates st) { m_reactState = st; } ReactStates GetReactState() { return m_reactState; } @@ -488,7 +490,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature bool isCanTrainingOf(Player* player, bool msg) const; bool isCanInteractWithBattleMaster(Player* player, bool msg) const; bool isCanTrainingAndResetTalentsOf(Player* player) const; - bool canCreatureAttack(Unit const* pVictim, bool force = true) const; + bool canCreatureAttack(Unit const* victim, bool force = true) const; bool IsImmunedToSpell(SpellInfo const* spellInfo); // redefine Unit::IsImmunedToSpell bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const; @@ -498,7 +500,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature if (isPet()) return false; - uint32 rank = GetCreatureInfo()->rank; + uint32 rank = GetCreatureTemplate()->rank; return rank != CREATURE_ELITE_NORMAL && rank != CREATURE_ELITE_RARE; } @@ -507,7 +509,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature if (isPet()) return false; - return GetCreatureInfo()->rank == CREATURE_ELITE_WORLDBOSS; + return GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_BOSS; } bool IsDungeonBoss() const; @@ -522,8 +524,9 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature void AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint32 MovementFlags, uint8 type); CreatureAI* AI() const { return (CreatureAI*)i_AI; } - void SetWalk(bool enable); - void SetLevitate(bool enable); + bool SetWalk(bool enable); + bool SetDisableGravity(bool disable, bool packetOnly = false); + bool SetHover(bool enable); uint32 GetShieldBlockValue() const //dunno mob block value { @@ -560,7 +563,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature TrainerSpellData const* GetTrainerSpells() const; - CreatureTemplate const* GetCreatureInfo() const { return m_creatureInfo; } + CreatureTemplate const* GetCreatureTemplate() const { return m_creatureInfo; } CreatureData const* GetCreatureData() const { return m_creatureData; } CreatureAddon const* GetCreatureAddon() const; @@ -604,8 +607,8 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature void RemoveLootMode(uint16 lootMode) { m_LootMode &= ~lootMode; } void ResetLootMode() { m_LootMode = LOOT_MODE_DEFAULT; } - SpellInfo const* reachWithSpellAttack(Unit* pVictim); - SpellInfo const* reachWithSpellCure(Unit* pVictim); + SpellInfo const* reachWithSpellAttack(Unit* victim); + SpellInfo const* reachWithSpellCure(Unit* victim); uint32 m_spells[CREATURE_MAX_SPELLS]; CreatureSpellCooldowns m_CreatureSpellCooldowns; @@ -634,7 +637,6 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature void RemoveCorpse(bool setSpawnTime = true); - void ForcedDespawn(uint32 timeMSToDespawn = 0); void DespawnOrUnsummon(uint32 msTimeToDespawn = 0); time_t const& GetRespawnTime() const { return m_respawnTime; } @@ -762,6 +764,8 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature bool IsInvisibleDueToDespawn() const; bool CanAlwaysSee(WorldObject const* obj) const; private: + void ForcedDespawn(uint32 timeMSToDespawn = 0); + //WaypointMovementGenerator vars uint32 m_waypointID; uint32 m_path_id; diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp index f440fd497fc..54953ef5420 100755 --- a/src/server/game/Entities/Creature/CreatureGroups.cpp +++ b/src/server/game/Entities/Creature/CreatureGroups.cpp @@ -24,12 +24,13 @@ #define MAX_DESYNC 5.0f -CreatureGroupInfoType CreatureGroupMap; - -namespace FormationMgr +FormationMgr::~FormationMgr() { + for (CreatureGroupInfoType::iterator itr = CreatureGroupMap.begin(); itr != CreatureGroupMap.end(); ++itr) + delete itr->second; +} -void AddCreatureToGroup(uint32 groupId, Creature* member) +void FormationMgr::AddCreatureToGroup(uint32 groupId, Creature* member) { Map* map = member->FindMap(); if (!map) @@ -53,7 +54,7 @@ void AddCreatureToGroup(uint32 groupId, Creature* member) } } -void RemoveCreatureFromGroup(CreatureGroup* group, Creature* member) +void FormationMgr::RemoveCreatureFromGroup(CreatureGroup* group, Creature* member) { sLog->outDebug(LOG_FILTER_UNITS, "Deleting member pointer to GUID: %u from group %u", group->GetId(), member->GetDBTableGUIDLow()); group->RemoveMember(member); @@ -70,7 +71,7 @@ void RemoveCreatureFromGroup(CreatureGroup* group, Creature* member) } } -void LoadCreatureFormations() +void FormationMgr::LoadCreatureFormations() { uint32 oldMSTime = getMSTime(); @@ -97,10 +98,10 @@ void LoadCreatureFormations() fields = result->Fetch(); //Load group member data - group_member = new FormationInfo; + group_member = new FormationInfo(); group_member->leaderGUID = fields[0].GetUInt32(); uint32 memberGUID = fields[1].GetUInt32(); - group_member->groupAI = fields[4].GetUInt8(); + group_member->groupAI = fields[4].GetUInt32(); //If creature is group leader we may skip loading of dist/angle if (group_member->leaderGUID != memberGUID) { @@ -133,14 +134,12 @@ void LoadCreatureFormations() CreatureGroupMap[memberGUID] = group_member; ++count; } - while (result->NextRow()) ; + while (result->NextRow()); sLog->outString(">> Loaded %u creatures in formations in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); } -} // Namespace - void CreatureGroup::AddMember(Creature* member) { sLog->outDebug(LOG_FILTER_UNITS, "CreatureGroup::AddMember: Adding unit GUID: %u.", member->GetGUIDLow()); @@ -152,7 +151,7 @@ void CreatureGroup::AddMember(Creature* member) m_leader = member; } - m_members[member] = CreatureGroupMap.find(member->GetDBTableGUIDLow())->second; + m_members[member] = sFormationMgr->CreatureGroupMap.find(member->GetDBTableGUIDLow())->second; member->SetFormation(this); } @@ -167,7 +166,7 @@ void CreatureGroup::RemoveMember(Creature* member) void CreatureGroup::MemberAttackStart(Creature* member, Unit* target) { - uint8 groupAI = CreatureGroupMap[member->GetDBTableGUIDLow()]->groupAI; + uint8 groupAI = sFormationMgr->CreatureGroupMap[member->GetDBTableGUIDLow()]->groupAI; if (!groupAI) return; @@ -240,7 +239,7 @@ void CreatureGroup::LeaderMoveTo(float x, float y, float z) if (member->IsWithinDist(m_leader, dist + MAX_DESYNC)) member->SetUnitMovementFlags(m_leader->GetUnitMovementFlags()); else - member->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + member->SetWalk(false); member->GetMotionMaster()->MovePoint(0, dx, dy, dz); member->SetHomePosition(dx, dy, dz, pathangle); diff --git a/src/server/game/Entities/Creature/CreatureGroups.h b/src/server/game/Entities/Creature/CreatureGroups.h index 80e552f7e93..e5b8771ee40 100755 --- a/src/server/game/Entities/Creature/CreatureGroups.h +++ b/src/server/game/Entities/Creature/CreatureGroups.h @@ -34,16 +34,19 @@ struct FormationInfo uint8 groupAI; }; -namespace FormationMgr -{ - void AddCreatureToGroup(uint32 group_id, Creature* creature); - void RemoveCreatureFromGroup(CreatureGroup* group, Creature* creature); - void LoadCreatureFormations(); -}; - typedef UNORDERED_MAP<uint32/*memberDBGUID*/, FormationInfo*> CreatureGroupInfoType; -extern CreatureGroupInfoType CreatureGroupMap; +class FormationMgr +{ + friend class ACE_Singleton<FormationMgr, ACE_Null_Mutex>; + public: + FormationMgr() { } + ~FormationMgr(); + void AddCreatureToGroup(uint32 group_id, Creature* creature); + void RemoveCreatureFromGroup(CreatureGroup* group, Creature* creature); + void LoadCreatureFormations(); + CreatureGroupInfoType CreatureGroupMap; +}; class CreatureGroup { @@ -73,4 +76,6 @@ class CreatureGroup void MemberAttackStart(Creature* member, Unit* target); }; +#define sFormationMgr ACE_Singleton<FormationMgr, ACE_Null_Mutex>::instance() + #endif diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp index 99150434c44..21c5aa38a19 100755 --- a/src/server/game/Entities/Creature/GossipDef.cpp +++ b/src/server/game/Entities/Creature/GossipDef.cpp @@ -47,10 +47,7 @@ void GossipMenu::AddMenuItem(int32 menuItemId, uint8 icon, std::string const& me for (GossipMenuItemContainer::const_iterator itr = _menuItems.begin(); itr != _menuItems.end(); ++itr) { if (int32(itr->first) > menuItemId) - { - menuItemId = menuItemId; break; - } menuItemId = itr->first + 1; } diff --git a/src/server/game/Entities/Creature/TemporarySummon.h b/src/server/game/Entities/Creature/TemporarySummon.h index fa1e134b1ac..829eb73bf80 100755 --- a/src/server/game/Entities/Creature/TemporarySummon.h +++ b/src/server/game/Entities/Creature/TemporarySummon.h @@ -107,4 +107,3 @@ private: TempSummon& m_owner; }; #endif - diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.cpp b/src/server/game/Entities/DynamicObject/DynamicObject.cpp index 754caa5c774..8dcafa3b2ae 100755 --- a/src/server/game/Entities/DynamicObject/DynamicObject.cpp +++ b/src/server/game/Entities/DynamicObject/DynamicObject.cpp @@ -33,7 +33,7 @@ DynamicObject::DynamicObject(bool isWorldObject) : WorldObject(isWorldObject), m_objectType |= TYPEMASK_DYNAMICOBJECT; m_objectTypeId = TYPEID_DYNAMICOBJECT; - m_updateFlag = (UPDATEFLAG_HAS_POSITION | UPDATEFLAG_POSITION); + m_updateFlag = (UPDATEFLAG_STATIONARY_POSITION | UPDATEFLAG_POSITION); m_valuesCount = DYNAMICOBJECT_END; } @@ -92,7 +92,7 @@ bool DynamicObject::CreateDynamicObject(uint32 guidlow, Unit* caster, uint32 spe WorldObject::_Create(guidlow, HIGHGUID_DYNAMICOBJECT, caster->GetPhaseMask()); SetEntry(spellId); - SetFloatValue(OBJECT_FIELD_SCALE_X, 1); + SetObjectScale(1); SetUInt64Value(DYNAMICOBJECT_CASTER, caster->GetGUID()); // The lower word of DYNAMICOBJECT_BYTES must be 0x0001. This value means that the visual radius will be overriden @@ -116,7 +116,7 @@ bool DynamicObject::CreateDynamicObject(uint32 guidlow, Unit* caster, uint32 spe void DynamicObject::Update(uint32 p_time) { - // caster has to be always avalible and in the same map + // caster has to be always available and in the same map ASSERT(_caster); ASSERT(_caster->GetMap() == GetMap()); @@ -127,7 +127,7 @@ void DynamicObject::Update(uint32 p_time) if (!_aura->IsRemoved()) _aura->UpdateOwner(p_time, this); - // m_aura may be set to null in Aura::UpdateOwner call + // _aura may be set to null in Aura::UpdateOwner call if (_aura && (_aura->IsRemoved() || _aura->IsExpired())) expired = true; } diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index c04dd0b1941..7591359230a 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -38,7 +38,7 @@ GameObject::GameObject() : WorldObject(false), m_model(NULL), m_goValue(new Game m_objectType |= TYPEMASK_GAMEOBJECT; m_objectTypeId = TYPEID_GAMEOBJECT; - m_updateFlag = (UPDATEFLAG_HAS_POSITION | UPDATEFLAG_POSITION | UPDATEFLAG_ROTATION); + m_updateFlag = (UPDATEFLAG_STATIONARY_POSITION | UPDATEFLAG_POSITION | UPDATEFLAG_ROTATION); m_valuesCount = GAMEOBJECT_END; m_respawnTime = 0; @@ -55,6 +55,8 @@ GameObject::GameObject() : WorldObject(false), m_model(NULL), m_goValue(new Game m_DBTableGuid = 0; m_rotation = 0; + m_lootRecipient = 0; + m_lootRecipientGroup = 0; m_groupLootTimer = 0; lootingGroupLowGUID = 0; @@ -132,10 +134,11 @@ void GameObject::AddToWorld() sObjectAccessor->AddObject(this); bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false); - bool toggledState = (GetGOData() ? GetGOData()->go_state == GO_STATE_ACTIVE : false); + // The state can be changed after GameObject::Create but before GameObject::AddToWorld + bool toggledState = GetGOData() ? GetGOData()->go_state == GO_STATE_READY : false; if (m_model) GetMap()->Insert(*m_model); - if ((startOpen && !toggledState) || (!startOpen && toggledState)) + if (startOpen ^ toggledState) EnableCollision(false); WorldObject::AddToWorld(); @@ -203,7 +206,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa UpdateRotationFields(rotation2, rotation3); // GAMEOBJECT_FACING, GAMEOBJECT_ROTATION, GAMEOBJECT_PARENTROTATION+2/3 - SetFloatValue(OBJECT_FIELD_SCALE_X, goinfo->size); + SetObjectScale(goinfo->size); SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction); SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags); @@ -219,10 +222,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa // GAMEOBJECT_BYTES_1, index at 0, 1, 2 and 3 SetGoType(GameobjectTypes(goinfo->type)); SetGoState(go_state); - - SetGoArtKit(0); // unknown what this is - SetByteValue(GAMEOBJECT_BYTES_1, 2, artKit); - + SetGoArtKit(artKit); switch (goinfo->type) { @@ -252,7 +252,6 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa m_invisibility.AddFlag(INVISIBILITY_TRAP); m_invisibility.AddValue(INVISIBILITY_TRAP, 300); } - break; default: SetGoAnimProgress(animprogress); @@ -685,29 +684,34 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) data.spawnMask = spawnMask; data.artKit = GetGoArtKit(); - // update in DB - std::ostringstream ss; - ss << "INSERT INTO gameobject VALUES (" - << m_DBTableGuid << ',' - << GetEntry() << ',' - << mapid << ',' - << uint32(spawnMask) << ',' // cast to prevent save as symbol - << uint16(GetPhaseMask()) << ',' // prevent out of range error - << GetPositionX() << ',' - << GetPositionY() << ',' - << GetPositionZ() << ',' - << GetOrientation() << ',' - << GetFloatValue(GAMEOBJECT_PARENTROTATION) << ',' - << GetFloatValue(GAMEOBJECT_PARENTROTATION+1) << ',' - << GetFloatValue(GAMEOBJECT_PARENTROTATION+2) << ',' - << GetFloatValue(GAMEOBJECT_PARENTROTATION+3) << ',' - << m_respawnDelayTime << ',' - << uint32(GetGoAnimProgress()) << ',' - << uint32(GetGoState()) << ')'; - + // Update in DB SQLTransaction trans = WorldDatabase.BeginTransaction(); - trans->PAppend("DELETE FROM gameobject WHERE guid = '%u'", m_DBTableGuid); - trans->Append(ss.str().c_str()); + + uint8 index = 0; + + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_GAMEOBJECT); + stmt->setUInt32(0, m_DBTableGuid); + trans->Append(stmt); + + stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_GAMEOBJECT); + stmt->setUInt32(index++, m_DBTableGuid); + stmt->setUInt32(index++, GetEntry()); + stmt->setUInt16(index++, uint16(mapid)); + stmt->setUInt8(index++, spawnMask); + stmt->setUInt16(index++, uint16(GetPhaseMask())); + stmt->setFloat(index++, GetPositionX()); + stmt->setFloat(index++, GetPositionY()); + stmt->setFloat(index++, GetPositionZ()); + stmt->setFloat(index++, GetOrientation()); + stmt->setFloat(index++, GetFloatValue(GAMEOBJECT_PARENTROTATION)); + stmt->setFloat(index++, GetFloatValue(GAMEOBJECT_PARENTROTATION+1)); + stmt->setFloat(index++, GetFloatValue(GAMEOBJECT_PARENTROTATION+2)); + stmt->setFloat(index++, GetFloatValue(GAMEOBJECT_PARENTROTATION+3)); + stmt->setInt32(index++, int32(m_respawnDelayTime)); + stmt->setUInt8(index++, GetGoAnimProgress()); + stmt->setUInt8(index++, uint8(GetGoState())); + trans->Append(stmt); + WorldDatabase.CommitTransaction(trans); } @@ -834,7 +838,9 @@ bool GameObject::IsTransport() const { // If something is marked as a transport, don't transmit an out of range packet for it. GameObjectTemplate const* gInfo = GetGOInfo(); - if (!gInfo) return false; + if (!gInfo) + return false; + return gInfo->type == GAMEOBJECT_TYPE_TRANSPORT || gInfo->type == GAMEOBJECT_TYPE_MO_TRANSPORT; } @@ -843,7 +849,9 @@ bool GameObject::IsDynTransport() const { // If something is marked as a transport, don't transmit an out of range packet for it. GameObjectTemplate const* gInfo = GetGOInfo(); - if (!gInfo) return false; + if (!gInfo) + return false; + return gInfo->type == GAMEOBJECT_TYPE_MO_TRANSPORT || (gInfo->type == GAMEOBJECT_TYPE_TRANSPORT && !gInfo->transport.pause); } @@ -1422,7 +1430,7 @@ void GameObject::Use(Unit* user) if (info->summoningRitual.casterTargetSpell && info->summoningRitual.casterTargetSpell != 1) // No idea why this field is a bool in some cases for (uint32 i = 0; i < info->summoningRitual.casterTargetSpellTargets; i++) // m_unique_users can contain only player GUIDs - if (Player* target = ObjectAccessor::GetPlayer(*this, SelectRandomContainerElement(m_unique_users))) + if (Player* target = ObjectAccessor::GetPlayer(*this, Trinity::Containers::SelectRandomContainerElement(m_unique_users))) spellCaster->CastSpell(target, info->summoningRitual.casterTargetSpell, true); // finish owners spell @@ -1666,7 +1674,7 @@ void GameObject::CastSpell(Unit* target, uint32 spellId) else { trigger->setFaction(14); - // Set owner guid for target if no owner avalible - needed by trigger auras + // Set owner guid for target if no owner available - needed by trigger auras // - trigger gets despawned and there's no caster avalible (see AuraEffect::TriggerSpell()) trigger->CastSpell(target ? target : trigger, spellInfo, true, 0, 0, target ? target->GetGUID() : 0); } @@ -1815,6 +1823,7 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player* m_goValue->Building.Health = m_goValue->Building.MaxHealth; SetGoAnimProgress(255); } + EnableCollision(true); break; case GO_DESTRUCTIBLE_DAMAGED: { @@ -1871,6 +1880,7 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player* m_goValue->Building.Health = 0; SetGoAnimProgress(0); } + EnableCollision(false); break; } case GO_DESTRUCTIBLE_REBUILDING: @@ -1890,6 +1900,7 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player* m_goValue->Building.Health = m_goValue->Building.MaxHealth; SetGoAnimProgress(255); } + EnableCollision(true); break; } } @@ -1899,12 +1910,14 @@ void GameObject::SetLootState(LootState state, Unit* unit) { m_lootState = state; AI()->OnStateChanged(state, unit); + sScriptMgr->OnGameObjectLootStateChanged(this, state, unit); if (m_model) { // startOpen determines whether we are going to add or remove the LoS on activation bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false); - if (GetGOData() && GetGOData()->go_state == GO_NOT_READY) + // Use the current go state + if (GetGoState() == GO_STATE_ACTIVE) startOpen = !startOpen; if (state == GO_ACTIVATED || state == GO_JUST_DEACTIVATED) @@ -1917,6 +1930,7 @@ void GameObject::SetLootState(LootState state, Unit* unit) void GameObject::SetGoState(GOState state) { SetByteValue(GAMEOBJECT_BYTES_1, 0, state); + sScriptMgr->OnGameObjectStateChanged(this, state); if (m_model) { if (!IsInWorld()) @@ -1925,7 +1939,7 @@ void GameObject::SetGoState(GOState state) // startOpen determines whether we are going to add or remove the LoS on activation bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false); - if (GetGOData() && GetGOData()->go_state == GO_NOT_READY) + if (GetGOData() && GetGOData()->go_state == GO_STATE_READY) startOpen = !startOpen; if (state == GO_STATE_ACTIVE || state == GO_STATE_ACTIVE_ALTERNATIVE) @@ -1970,3 +1984,57 @@ void GameObject::UpdateModel() if (m_model) GetMap()->Insert(*m_model); } + +Player* GameObject::GetLootRecipient() const +{ + if (!m_lootRecipient) + return NULL; + return ObjectAccessor::FindPlayer(m_lootRecipient); +} + +Group* GameObject::GetLootRecipientGroup() const +{ + if (!m_lootRecipientGroup) + return NULL; + return sGroupMgr->GetGroupByGUID(m_lootRecipientGroup); +} + +void GameObject::SetLootRecipient(Unit* unit) +{ + // set the player whose group should receive the right + // to loot the creature after it dies + // should be set to NULL after the loot disappears + + if (!unit) + { + m_lootRecipient = 0; + m_lootRecipientGroup = 0; + return; + } + + if (unit->GetTypeId() != TYPEID_PLAYER && !unit->IsVehicle()) + return; + + Player* player = unit->GetCharmerOrOwnerPlayerOrPlayerItself(); + if (!player) // normal creature, no player involved + return; + + m_lootRecipient = player->GetGUID(); + if (Group* group = player->GetGroup()) + m_lootRecipientGroup = group->GetLowGUID(); +} + +bool GameObject::IsLootAllowedFor(Player const* player) const +{ + if (!m_lootRecipient && !m_lootRecipientGroup) + return true; + + if (player->GetGUID() == m_lootRecipient) + return true; + + Group const* playerGroup = player->GetGroup(); + if (!playerGroup || playerGroup != GetLootRecipientGroup()) // if we dont have a group we arent the recipient + return false; // if go doesnt have group bound it means it was solo killed by someone else + + return true; +} diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index 2e40d45541c..80aaf1c933f 100755 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -403,7 +403,6 @@ struct GameObjectTemplate } raw; }; - std::string AIName; uint32 ScriptId; @@ -732,7 +731,9 @@ class GameObject : public WorldObject, public GridObject<GameObject> bool IsInSkillupList(uint32 PlayerGuidLow) const { for (std::list<uint32>::const_iterator i = m_SkillupList.begin(); i != m_SkillupList.end(); ++i) - if (*i == PlayerGuidLow) return true; + if (*i == PlayerGuidLow) + return true; + return false; } void ClearSkillupList() { m_SkillupList.clear(); } @@ -747,6 +748,11 @@ class GameObject : public WorldObject, public GridObject<GameObject> Loot loot; + Player* GetLootRecipient() const; + Group* GetLootRecipientGroup() const; + void SetLootRecipient(Unit* unit); + bool IsLootAllowedFor(Player const* player) const; + bool HasLootRecipient() const { return m_lootRecipient || m_lootRecipientGroup; } uint32 m_groupLootTimer; // (msecs)timer used for group loot uint32 lootingGroupLowGUID; // used to find group which is looting @@ -823,6 +829,8 @@ class GameObject : public WorldObject, public GridObject<GameObject> uint64 m_rotation; + uint64 m_lootRecipient; + uint32 m_lootRecipientGroup; uint16 m_LootMode; // bitmask, default LOOT_MODE_DEFAULT, determines what loot will be lootable private: void RemoveFromOwner(); diff --git a/src/server/game/Entities/Item/Container/Bag.cpp b/src/server/game/Entities/Item/Container/Bag.cpp index 4eede93bd37..c4d4adeb6f2 100755 --- a/src/server/game/Entities/Item/Container/Bag.cpp +++ b/src/server/game/Entities/Item/Container/Bag.cpp @@ -78,7 +78,7 @@ bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner) Object::_Create(guidlow, 0, HIGHGUID_CONTAINER); SetEntry(itemid); - SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f); + SetObjectScale(1.0f); SetUInt64Value(ITEM_FIELD_OWNER, owner ? owner->GetGUID() : 0); SetUInt64Value(ITEM_FIELD_CONTAINED, owner ? owner->GetGUID() : 0); diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index b5e39fe19af..d973c3ba4f8 100755 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -56,8 +56,7 @@ void AddItemsSetItem(Player* player, Item* item) if (!eff) { - eff = new ItemSetEffect; - memset(eff, 0, sizeof(ItemSetEffect)); + eff = new ItemSetEffect(); eff->setid = setid; size_t x = 0; @@ -259,7 +258,7 @@ bool Item::Create(uint32 guidlow, uint32 itemid, Player const* owner) Object::_Create(guidlow, 0, HIGHGUID_ITEM); SetEntry(itemid); - SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f); + SetObjectScale(1.0f); SetUInt64Value(ITEM_FIELD_OWNER, owner ? owner->GetGUID() : 0); SetUInt64Value(ITEM_FIELD_CONTAINED, owner ? owner->GetGUID() : 0); @@ -344,8 +343,8 @@ void Item::SaveToDB(SQLTransaction& trans) } stmt->setString(++index, ssEnchants.str()); - stmt->setInt32 (++index, GetItemRandomPropertyId()); - stmt->setUInt32(++index, GetUInt32Value(ITEM_FIELD_DURABILITY)); + stmt->setInt16 (++index, GetItemRandomPropertyId()); + stmt->setUInt16(++index, GetUInt32Value(ITEM_FIELD_DURABILITY)); stmt->setUInt32(++index, GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME)); stmt->setString(++index, m_text); stmt->setUInt32(++index, guid); @@ -401,7 +400,7 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entr // Set entry, MUST be before proto check SetEntry(entry); - SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f); + SetObjectScale(1.0f); ItemTemplate const* proto = GetTemplate(); if (!proto) @@ -487,7 +486,7 @@ void Item::DeleteFromDB(SQLTransaction& trans) /*static*/ void Item::DeleteFromInventoryDB(SQLTransaction& trans, uint32 itemGuid) { - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVENTORY_ITEM); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_ITEM); stmt->setUInt32(0, itemGuid); trans->Append(stmt); } @@ -766,7 +765,7 @@ bool Item::CanBeTraded(bool mail, bool trade) const if (Player* owner = GetOwner()) { - if (owner->CanUnequipItem(GetPos(), false) != EQUIP_ERR_OK) + if (owner->CanUnequipItem(GetPos(), false) != EQUIP_ERR_OK) return false; if (owner->GetLootGUID() == GetGUID()) return false; @@ -780,30 +779,28 @@ bool Item::CanBeTraded(bool mail, bool trade) const bool Item::HasEnchantRequiredSkill(const Player* player) const { - - // Check all enchants for required skill - for (uint32 enchant_slot = PERM_ENCHANTMENT_SLOT; enchant_slot < MAX_ENCHANTMENT_SLOT; ++enchant_slot) - if (uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot))) - if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id)) - if (enchantEntry->requiredSkill && player->GetSkillValue(enchantEntry->requiredSkill) < enchantEntry->requiredSkillValue) - return false; + // Check all enchants for required skill + for (uint32 enchant_slot = PERM_ENCHANTMENT_SLOT; enchant_slot < MAX_ENCHANTMENT_SLOT; ++enchant_slot) + if (uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot))) + if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id)) + if (enchantEntry->requiredSkill && player->GetSkillValue(enchantEntry->requiredSkill) < enchantEntry->requiredSkillValue) + return false; return true; } uint32 Item::GetEnchantRequiredLevel() const { + uint32 level = 0; - uint32 level = 0; - - // Check all enchants for required level - for (uint32 enchant_slot = PERM_ENCHANTMENT_SLOT; enchant_slot < MAX_ENCHANTMENT_SLOT; ++enchant_slot) - if (uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot))) - if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id)) - if (enchantEntry->requiredLevel > level) - level = enchantEntry->requiredLevel; + // Check all enchants for required level + for (uint32 enchant_slot = PERM_ENCHANTMENT_SLOT; enchant_slot < MAX_ENCHANTMENT_SLOT; ++enchant_slot) + if (uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot))) + if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id)) + if (enchantEntry->requiredLevel > level) + level = enchantEntry->requiredLevel; - return level; + return level; } bool Item::IsBoundByEnchant() const @@ -861,7 +858,7 @@ bool Item::IsFitToSpellRequirements(SpellInfo const* spellInfo) const // Special case - accept weapon type for main and offhand requirements if (proto->InventoryType == INVTYPE_WEAPON && (spellInfo->EquippedItemInventoryTypeMask & (1 << INVTYPE_WEAPONMAINHAND) || - spellInfo->EquippedItemInventoryTypeMask & (1 << INVTYPE_WEAPONOFFHAND))) + spellInfo->EquippedItemInventoryTypeMask & (1 << INVTYPE_WEAPONOFFHAND))) return true; else if ((spellInfo->EquippedItemInventoryTypeMask & (1 << proto->InventoryType)) == 0) return false; // inventory type not present in mask @@ -1001,12 +998,13 @@ bool Item::IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) cons // time. void Item::SendTimeUpdate(Player* owner) { - if (!GetUInt32Value(ITEM_FIELD_DURATION)) + uint32 duration = GetUInt32Value(ITEM_FIELD_DURATION); + if (!duration) return; WorldPacket data(SMSG_ITEM_TIME_UPDATE, (8+4)); - data << (uint64)GetGUID(); - data << (uint32)GetUInt32Value(ITEM_FIELD_DURATION); + data << uint64(GetGUID()); + data << uint32(duration); owner->GetSession()->SendPacket(&data); } @@ -1084,16 +1082,30 @@ void Item::BuildUpdate(UpdateDataMapType& data_map) void Item::SaveRefundDataToDB() { SQLTransaction trans = CharacterDatabase.BeginTransaction(); - trans->PAppend("DELETE FROM item_refund_instance WHERE item_guid = '%u'", GetGUIDLow()); - trans->PAppend("INSERT INTO item_refund_instance (`item_guid`, `player_guid`, `paidMoney`, `paidExtendedCost`)" - " VALUES('%u', '%u', '%u', '%u')", GetGUIDLow(), GetRefundRecipient(), GetPaidMoney(), GetPaidExtendedCost()); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_REFUND_INSTANCE); + stmt->setUInt32(0, GetGUIDLow()); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_REFUND_INSTANCE); + stmt->setUInt32(0, GetGUIDLow()); + stmt->setUInt32(1, GetRefundRecipient()); + stmt->setUInt32(2, GetPaidMoney()); + stmt->setUInt16(3, uint16(GetPaidExtendedCost())); + trans->Append(stmt); + CharacterDatabase.CommitTransaction(trans); } void Item::DeleteRefundDataFromDB(SQLTransaction* trans) { if (trans && !trans->null()) - (*trans)->PAppend("DELETE FROM item_refund_instance WHERE item_guid = '%u'", GetGUIDLow()); + { + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_REFUND_INSTANCE); + stmt->setUInt32(0, GetGUIDLow()); + (*trans)->Append(stmt); + + } } void Item::SetNotRefundable(Player* owner, bool changestate /*=true*/, SQLTransaction* trans /*=NULL*/) diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h index 4887afc2b8a..54570e9b708 100755 --- a/src/server/game/Entities/Item/Item.h +++ b/src/server/game/Entities/Item/Item.h @@ -213,7 +213,7 @@ class Item : public Object static Item* CreateItem(uint32 item, uint32 count, Player const* player = NULL); Item* CloneItem(uint32 count, Player const* player = NULL) const; - Item (); + Item(); virtual bool Create(uint32 guidlow, uint32 itemid, Player const* owner); diff --git a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp index b8eaf043b1f..f3d7d7fd56c 100755 --- a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp +++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp @@ -49,6 +49,7 @@ void LoadRandomEnchantmentsTable() RandomItemEnch.clear(); // for reload case + // 0 1 2 QueryResult result = WorldDatabase.Query("SELECT entry, ench, chance FROM item_enchantment_template"); if (result) @@ -101,18 +102,20 @@ uint32 GetItemEnchantMod(int32 entry) { fCount += ench_iter->chance; - if (fCount > dRoll) return ench_iter->ench; + if (fCount > dRoll) + return ench_iter->ench; } //we could get here only if sum of all enchantment chances is lower than 100% - dRoll = (irand(0, (int)floor(fCount * 100) + 1)) / 100; + dRoll = (irand(0, (int)floor(fCount * 100) + 1)) / 100; fCount = 0; for (EnchStoreList::const_iterator ench_iter = tab->second.begin(); ench_iter != tab->second.end(); ++ench_iter) { fCount += ench_iter->chance; - if (fCount > dRoll) return ench_iter->ench; + if (fCount > dRoll) + return ench_iter->ench; } return 0; diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index f1d0dd5a506..d21ae63be45 100755 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -197,7 +197,7 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c if (target == this) // building packet for yourself flags |= UPDATEFLAG_SELF; - if (flags & UPDATEFLAG_HAS_POSITION) + if (flags & UPDATEFLAG_STATIONARY_POSITION) { // UPDATETYPE_CREATE_OBJECT2 dynamic objects, corpses... if (isType(TYPEMASK_DYNAMICOBJECT) || isType(TYPEMASK_CORPSE) || isType(TYPEMASK_PLAYER)) @@ -281,19 +281,21 @@ void Object::BuildOutOfRangeUpdateBlock(UpdateData* data) const data->AddOutOfRangeGUID(GetGUID()); } -void Object::DestroyForPlayer(Player* target, bool anim) const +void Object::DestroyForPlayer(Player* target, bool onDeath) const { ASSERT(target); WorldPacket data(SMSG_DESTROY_OBJECT, 8 + 1); data << uint64(GetGUID()); - data << uint8(anim ? 1 : 0); // WotLK (bool), may be despawn animation + //! If the following bool is true, the client will call "void CGUnit_C::OnDeath()" for this object. + //! OnDeath() does for eg trigger death animation and interrupts certain spells/missiles/auras/sounds... + data << uint8(onDeath ? 1 : 0); target->GetSession()->SendPacket(&data); } -void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const +void Object::_BuildMovementUpdate(ByteBuffer* data, uint16 flags) const { - *data << (uint16)flags; // update flags + *data << uint16(flags); // update flags // 0x20 if (flags & UPDATEFLAG_LIVING) @@ -320,14 +322,38 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const WorldObject* worldObj = ((WorldObject*)this); if (flags & UPDATEFLAG_POSITION) { - *data << uint8(0); // unk PGUID! - *data << worldObj->GetPositionX(); - *data << worldObj->GetPositionY(); - *data << worldObj->GetPositionZ(); + Transport* transport = worldObj->GetTransport(); + if (transport) + data->append(transport->GetPackGUID()); + else + *data << uint8(0); + *data << worldObj->GetPositionX(); *data << worldObj->GetPositionY(); *data << worldObj->GetPositionZ(); *data << worldObj->GetOrientation(); + if (isType(TYPEMASK_UNIT)) + *data << ((Unit*)this)->GetPositionZMinusOffset(); + else + *data << worldObj->GetPositionZ(); + + if (transport) + { + *data << worldObj->GetTransOffsetX(); + *data << worldObj->GetTransOffsetY(); + *data << worldObj->GetTransOffsetZ(); + } + else + { + *data << worldObj->GetPositionX(); + *data << worldObj->GetPositionY(); + if (isType(TYPEMASK_UNIT)) + *data << ((Unit*)this)->GetPositionZMinusOffset(); + else + *data << worldObj->GetPositionZ(); + } + + *data << worldObj->GetOrientation(); if (GetTypeId() == TYPEID_CORPSE) *data << worldObj->GetOrientation(); @@ -337,31 +363,23 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const else { // 0x40 - if (flags & UPDATEFLAG_HAS_POSITION) + if (flags & UPDATEFLAG_STATIONARY_POSITION) { - // 0x02 - if (flags & UPDATEFLAG_TRANSPORT && ((GameObject*)this)->GetGoType() == GAMEOBJECT_TYPE_MO_TRANSPORT) - { - *data << (float)0; - *data << (float)0; - *data << (float)0; - *data << worldObj->GetOrientation(); - } + *data << worldObj->GetPositionX(); + *data << worldObj->GetPositionY(); + if (isType(TYPEMASK_UNIT)) + *data << ((Unit*)this)->GetPositionZMinusOffset(); else - { - *data << worldObj->GetPositionX(); - *data << worldObj->GetPositionY(); *data << worldObj->GetPositionZ(); - *data << worldObj->GetOrientation(); - } + *data << worldObj->GetOrientation(); } } } // 0x4 - if (flags & UPDATEFLAG_HAS_TARGET) // packed guid (current target guid) + if (flags & UPDATEFLAG_HAS_TARGET) { - if (Unit *victim = this->ToUnit()->getVictim()) + if (Unit* victim = this->ToUnit()->getVictim()) data->append(victim->GetPackGUID()); else *data << uint8(0); @@ -369,13 +387,14 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const // 0x2 if (flags & UPDATEFLAG_TRANSPORT) - *data << uint32(getMSTime()); // ms time + *data << uint32(getMSTime()); // Unknown - getMSTime is wrong. // 0x80 - if (flags & UPDATEFLAG_VEHICLE) // unused for now + if (flags & UPDATEFLAG_VEHICLE) { - *data << uint32(((Unit*)this)->GetVehicleKit()->GetVehicleInfo()->m_ID); // vehicle id - *data << float(((Creature*)this)->GetOrientation()); // facing adjustment + // TODO: Allow players to aquire this updateflag. + *data << uint32(((Unit*)this)->GetVehicleKit()->GetVehicleInfo()->m_ID); + *data << float(((Creature*)this)->GetOrientation()); } // 0x800 - AnimKits @@ -427,6 +446,10 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask* } updateMask->SetBit(GAMEOBJECT_DYNAMIC); updateMask->SetBit(GAMEOBJECT_BYTES_1); + + if (ToGameObject()->GetGoType() == GAMEOBJECT_TYPE_CHEST && ToGameObject()->GetGOInfo()->chest.groupLootRules && + ToGameObject()->HasLootRecipient()) + updateMask->SetBit(GAMEOBJECT_FLAGS); } else if (isType(TYPEMASK_UNIT)) { @@ -500,7 +523,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask* { if (GetTypeId() == TYPEID_UNIT) { - CreatureTemplate const* cinfo = ToCreature()->GetCreatureInfo(); + CreatureTemplate const* cinfo = ToCreature()->GetCreatureTemplate(); // this also applies for transform auras if (SpellInfo const* transform = sSpellMgr->GetSpellInfo(ToUnit()->getTransForm())) @@ -540,7 +563,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask* { uint32 dynamicFlags = m_uint32Values[index]; - if (const Creature* creature = ToCreature()) + if (Creature const* creature = ToCreature()) { if (creature->hasLootRecipient()) { @@ -564,6 +587,11 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask* dynamicFlags &= ~UNIT_DYNFLAG_LOOTABLE; } + // unit UNIT_DYNFLAG_TRACK_UNIT should only be sent to caster of SPELL_AURA_MOD_STALKED auras + if (Unit const* unit = ToUnit()) + if (dynamicFlags & UNIT_DYNFLAG_TRACK_UNIT) + if (!unit->HasAuraTypeWithCaster(SPELL_AURA_MOD_STALKED, target->GetGUID())) + dynamicFlags &= ~UNIT_DYNFLAG_TRACK_UNIT; *data << dynamicFlags; } // FG: pretend that OTHER players in own group are friendly ("blue") @@ -650,6 +678,15 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask* *data << uint16(-1); } } + else if (index == GAMEOBJECT_FLAGS) + { + uint32 flags = m_uint32Values[index]; + if (ToGameObject()->GetGoType() == GAMEOBJECT_TYPE_CHEST) + if (ToGameObject()->GetGOInfo()->chest.groupLootRules && !ToGameObject()->IsLootAllowedFor(target)) + flags |= GO_FLAG_LOCKED | GO_FLAG_NOT_SELECTABLE; + + *data << flags; + } else *data << m_uint32Values[index]; // other cases } @@ -1114,7 +1151,7 @@ void MovementInfo::OutDebug() sLog->outString("pitch: %f", pitch); sLog->outString("fallTime: %u", fallTime); - if (flags & MOVEMENTFLAG_JUMPING) + if (flags & MOVEMENTFLAG_FALLING) sLog->outString("j_zspeed: %f j_sinAngle: %f j_cosAngle: %f j_xyspeed: %f", j_zspeed, j_sinAngle, j_cosAngle, j_xyspeed); if (flags & MOVEMENTFLAG_SPLINE_ELEVATION) @@ -1385,7 +1422,9 @@ void Position::GetPositionOffsetTo(const Position & endPos, Position & retOffset float Position::GetAngle(const Position* obj) const { - if (!obj) return 0; + if (!obj) + return 0; + return GetAngle(obj->GetPositionX(), obj->GetPositionY()); } @@ -1436,7 +1475,7 @@ bool Position::HasInArc(float arc, const Position* obj) const if (angle > M_PI) angle -= 2.0f*M_PI; - float lborder = -1 * (arc/2.0f); // in range -pi..0 + float lborder = -1 * (arc/2.0f); // in range -pi..0 float rborder = (arc/2.0f); // in range 0..pi return ((angle >= lborder) && (angle <= rborder)); } @@ -1507,7 +1546,7 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float &z) const { // non fly unit don't must be in air // non swim unit must be at ground (mostly speedup, because it don't must be in water and water level check less fast - if (!ToCreature()->canFly()) + if (!ToCreature()->CanFly()) { bool canSwim = ToCreature()->canSwim(); float ground_z = z; @@ -1533,7 +1572,7 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float &z) const case TYPEID_PLAYER: { // for server controlled moves playr work same as creature (but it can always swim) - if (!ToPlayer()->canFly()) + if (!ToPlayer()->CanFly()) { float ground_z = z; float max_z = GetBaseMap()->GetWaterOrGroundLevel(x, y, z, &ground_z, !ToUnit()->HasAuraType(SPELL_AURA_WATER_WALK)); @@ -1556,7 +1595,7 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float &z) const default: { float ground_z = GetBaseMap()->GetHeight(GetPhaseMask(), x, y, z, true); - if(ground_z > INVALID_HEIGHT) + if (ground_z > INVALID_HEIGHT) z = ground_z; break; } @@ -2618,8 +2657,42 @@ void WorldObject::GetNearPoint(WorldObject const* /*searcher*/, float &x, float void WorldObject::MovePosition(Position &pos, float dist, float angle) { angle += m_orientation; - pos.m_positionX += dist * cos(angle); - pos.m_positionY += dist * sin(angle); + float destx, desty, destz, ground, floor; + destx = pos.m_positionX + dist * cos(angle); + desty = pos.m_positionY + dist * sin(angle); + + // Prevent invalid coordinates here, position is unchanged + if (!Trinity::IsValidMapCoord(destx, desty)) + { + sLog->outCrash("WorldObject::MovePosition invalid coordinates X: %f and Y: %f were passed!", destx, desty); + return; + } + + ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true); + floor = GetMap()->GetHeight(GetPhaseMask(), destx, desty, pos.m_positionZ, true); + destz = fabs(ground - pos.m_positionZ) <= fabs(floor - pos.m_positionZ) ? ground : floor; + + float step = dist/10.0f; + + for (uint8 j = 0; j < 10; ++j) + { + // do not allow too big z changes + if (fabs(pos.m_positionZ - destz) > 6) + { + destx -= step * cos(angle); + desty -= step * sin(angle); + ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true); + floor = GetMap()->GetHeight(GetPhaseMask(), destx, desty, pos.m_positionZ, true); + destz = fabs(ground - pos.m_positionZ) <= fabs(floor - pos.m_positionZ) ? ground : floor; + } + // we have correct destz now + else + { + pos.Relocate(destx, desty, destz); + break; + } + } + Trinity::NormalizeMapCoord(pos.m_positionX); Trinity::NormalizeMapCoord(pos.m_positionY); UpdateGroundPositionZ(pos.m_positionX, pos.m_positionY, pos.m_positionZ); @@ -2633,6 +2706,14 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float pos.m_positionZ += 2.0f; destx = pos.m_positionX + dist * cos(angle); desty = pos.m_positionY + dist * sin(angle); + + // Prevent invalid coordinates here, position is unchanged + if (!Trinity::IsValidMapCoord(destx, desty)) + { + sLog->outCrash("WorldObject::MovePositionToFirstCollision invalid coordinates X: %f and Y: %f were passed!", destx, desty); + return; + } + ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true); floor = GetMap()->GetHeight(GetPhaseMask(), destx, desty, pos.m_positionZ, true); destz = fabs(ground - pos.m_positionZ) <= fabs(floor - pos.m_positionZ) ? ground : floor; diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 54f64f8da38..0d18a47885f 100755 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -122,7 +122,7 @@ typedef UNORDERED_MAP<Player*, UpdateData> UpdateDataMapType; class Object { public: - virtual ~Object (); + virtual ~Object(); bool IsInWorld() const { return m_inWorld; } @@ -137,6 +137,8 @@ class Object uint32 GetEntry() const { return GetUInt32Value(OBJECT_FIELD_ENTRY); } void SetEntry(uint32 entry) { SetUInt32Value(OBJECT_FIELD_ENTRY, entry); } + void SetObjectScale(float scale) { SetFloatValue(OBJECT_FIELD_SCALE_X, scale); } + TypeID GetTypeId() const { return m_objectTypeId; } bool isType(uint16 mask) const { return (mask & m_objectType); } @@ -146,7 +148,7 @@ class Object void BuildValuesUpdateBlockForPlayer(UpdateData* data, Player* target) const; void BuildOutOfRangeUpdateBlock(UpdateData* data) const; - virtual void DestroyForPlayer(Player* target, bool anim = false) const; + virtual void DestroyForPlayer(Player* target, bool onDeath = false) const; int32 GetInt32Value(uint16 index) const { @@ -226,7 +228,9 @@ class Object bool HasFlag(uint16 index, uint32 flag) const { - if (index >= m_valuesCount && !PrintIndexError(index, false)) return false; + if (index >= m_valuesCount && !PrintIndexError(index, false)) + return false; + return (m_uint32Values[index] & flag) != 0; } @@ -298,21 +302,21 @@ class Object // FG: some hacky helpers void ForceValuesUpdateAtIndex(uint32); - Player* ToPlayer(){ if (GetTypeId() == TYPEID_PLAYER) return reinterpret_cast<Player*>(this); else return NULL; } - const Player* ToPlayer() const { if (GetTypeId() == TYPEID_PLAYER) return (const Player*)((Player*)this); else return NULL; } - Creature* ToCreature(){ if (GetTypeId() == TYPEID_UNIT) return reinterpret_cast<Creature*>(this); else return NULL; } - const Creature* ToCreature() const {if (GetTypeId() == TYPEID_UNIT) return (const Creature*)((Creature*)this); else return NULL; } + Player* ToPlayer() { if (GetTypeId() == TYPEID_PLAYER) return reinterpret_cast<Player*>(this); else return NULL; } + Player const* ToPlayer() const { if (GetTypeId() == TYPEID_PLAYER) return (Player const*)((Player*)this); else return NULL; } + Creature* ToCreature() { if (GetTypeId() == TYPEID_UNIT) return reinterpret_cast<Creature*>(this); else return NULL; } + Creature const* ToCreature() const { if (GetTypeId() == TYPEID_UNIT) return (Creature const*)((Creature*)this); else return NULL; } - Unit* ToUnit(){ if (GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) return reinterpret_cast<Unit*>(this); else return NULL; } - const Unit* ToUnit() const {if (GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) return (const Unit*)((Unit*)this); else return NULL; } - GameObject* ToGameObject(){ if (GetTypeId() == TYPEID_GAMEOBJECT) return reinterpret_cast<GameObject*>(this); else return NULL; } - const GameObject* ToGameObject() const {if (GetTypeId() == TYPEID_GAMEOBJECT) return (const GameObject*)((GameObject*)this); else return NULL; } + Unit* ToUnit() { if (GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) return reinterpret_cast<Unit*>(this); else return NULL; } + Unit const* ToUnit() const { if (GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) return (const Unit*)((Unit*)this); else return NULL; } + GameObject* ToGameObject() { if (GetTypeId() == TYPEID_GAMEOBJECT) return reinterpret_cast<GameObject*>(this); else return NULL; } + GameObject const* ToGameObject() const { if (GetTypeId() == TYPEID_GAMEOBJECT) return (const GameObject*)((GameObject*)this); else return NULL; } - Corpse* ToCorpse(){ if (GetTypeId() == TYPEID_CORPSE) return reinterpret_cast<Corpse*>(this); else return NULL; } - const Corpse* ToCorpse() const {if (GetTypeId() == TYPEID_CORPSE) return (const Corpse*)((Corpse*)this); else return NULL; } + Corpse* ToCorpse() { if (GetTypeId() == TYPEID_CORPSE) return reinterpret_cast<Corpse*>(this); else return NULL; } + Corpse const* ToCorpse() const { if (GetTypeId() == TYPEID_CORPSE) return (const Corpse*)((Corpse*)this); else return NULL; } protected: - Object (); + Object(); void _InitValues(); void _Create (uint32 guidlow, uint32 entry, HighGuid guidhigh); @@ -506,6 +510,8 @@ struct MovementInfo void AddExtraMovementFlag(uint16 flag) { flags2 |= flag; } bool HasExtraMovementFlag(uint16 flag) const { return flags2 & flag; } + void SetFallTime(uint32 time) { fallTime = time; } + void OutDebug(); }; @@ -681,7 +687,7 @@ class WorldObject : public Object, public WorldLocation bool IsInMap(const WorldObject* obj) const { if (obj) - return IsInWorld() && obj->IsInWorld() && (GetMap() == obj->GetMap()) && InSamePhase(obj); + return IsInWorld() && obj->IsInWorld() && (GetMap() == obj->GetMap()); return false; } bool IsWithinDist3d(float x, float y, float z, float dist) const @@ -699,7 +705,7 @@ class WorldObject : public Object, public WorldLocation } bool IsWithinDistInMap(WorldObject const* obj, float dist2compare, bool is3D = true) const { - return obj && IsInMap(obj) && _IsWithinDist(obj, dist2compare, is3D); + return obj && IsInMap(obj) && InSamePhase(obj) && _IsWithinDist(obj, dist2compare, is3D); } bool IsWithinLOS(float x, float y, float z) const; bool IsWithinLOSInMap(const WorldObject* obj) const; @@ -776,7 +782,8 @@ class WorldObject : public Object, public WorldLocation GetClosePoint(x, y, z, GetObjectSize()); ang = GetOrientation(); } - Position pos = {x, y, z, ang}; + Position pos; + pos.Relocate(x, y, z, ang); return SummonCreature(id, pos, spwtype, despwtime, 0); } GameObject* SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime); @@ -873,20 +880,6 @@ class WorldObject : public Object, public WorldLocation namespace Trinity { - template<class T> - void RandomResizeList(std::list<T> &_list, uint32 _size) - { - size_t list_size = _list.size(); - - while (list_size > _size) - { - typename std::list<T>::iterator itr = _list.begin(); - std::advance(itr, urand(0, list_size - 1)); - _list.erase(itr); - --list_size; - } - } - // Binary predicate to sort WorldObjects based on the distance to a reference WorldObject class ObjectDistanceOrderPred { diff --git a/src/server/game/Entities/Object/ObjectPosSelector.cpp b/src/server/game/Entities/Object/ObjectPosSelector.cpp index ec654954b80..f5c36f5a3c9 100755 --- a/src/server/game/Entities/Object/ObjectPosSelector.cpp +++ b/src/server/game/Entities/Object/ObjectPosSelector.cpp @@ -75,9 +75,9 @@ void ObjectPosSelector::InitializeAngle() bool ObjectPosSelector::FirstAngle(float& angle) { - if (m_UsedPosLists[USED_POS_PLUS].empty() && !m_UsedPosLists[USED_POS_MINUS].empty() ) + if (m_UsedPosLists[USED_POS_PLUS].empty() && !m_UsedPosLists[USED_POS_MINUS].empty()) return NextAngleFor(*m_UsedPosLists[USED_POS_MINUS].begin(), 1.0f, USED_POS_PLUS, angle); - else if (m_UsedPosLists[USED_POS_MINUS].empty() && !m_UsedPosLists[USED_POS_PLUS].empty() ) + else if (m_UsedPosLists[USED_POS_MINUS].empty() && !m_UsedPosLists[USED_POS_PLUS].empty()) return NextAngleFor(*m_UsedPosLists[USED_POS_PLUS].begin(), -1.0f, USED_POS_MINUS, angle); return false; @@ -100,7 +100,7 @@ bool ObjectPosSelector::NextAngle(float& angle) bool ObjectPosSelector::NextUsedAngle(float& angle) { while (m_nextUsedPos[USED_POS_PLUS]!=m_UsedPosLists[USED_POS_PLUS].end() || - m_nextUsedPos[USED_POS_MINUS]!=m_UsedPosLists[USED_POS_MINUS].end() ) + m_nextUsedPos[USED_POS_MINUS]!=m_UsedPosLists[USED_POS_MINUS].end()) { // calculate next possible angle if (!NextPosibleAngle(angle)) @@ -114,7 +114,7 @@ bool ObjectPosSelector::NextPosibleAngle(float& angle) { // ++ direction less updated if (m_nextUsedPos[USED_POS_PLUS]!=m_UsedPosLists[USED_POS_PLUS].end() && - (m_nextUsedPos[USED_POS_MINUS]==m_UsedPosLists[USED_POS_MINUS].end() || m_nextUsedPos[USED_POS_PLUS]->first <= m_nextUsedPos[USED_POS_MINUS]->first) ) + (m_nextUsedPos[USED_POS_MINUS]==m_UsedPosLists[USED_POS_MINUS].end() || m_nextUsedPos[USED_POS_PLUS]->first <= m_nextUsedPos[USED_POS_MINUS]->first)) { bool ok; if (m_smallStepOk[USED_POS_PLUS]) @@ -133,7 +133,7 @@ bool ObjectPosSelector::NextPosibleAngle(float& angle) if (m_smallStepOk[USED_POS_MINUS]) ok = NextSmallStepAngle(-1.0f, USED_POS_MINUS, angle); else - ok = NextAngleFor(*m_nextUsedPos[USED_POS_MINUS], -1.0f, USED_POS_MINUS, angle); + ok = NextAngleFor(*m_nextUsedPos[USED_POS_MINUS], -1.0f, USED_POS_MINUS, angle); if (!ok) ++m_nextUsedPos[USED_POS_MINUS]; diff --git a/src/server/game/Entities/Object/Updates/UpdateData.h b/src/server/game/Entities/Object/Updates/UpdateData.h index d1bdad13a19..11d54ac488e 100755 --- a/src/server/game/Entities/Object/Updates/UpdateData.h +++ b/src/server/game/Entities/Object/Updates/UpdateData.h @@ -32,21 +32,21 @@ enum OBJECT_UPDATE_TYPE enum OBJECT_UPDATE_FLAGS { - UPDATEFLAG_NONE = 0x0000, - UPDATEFLAG_SELF = 0x0001, - UPDATEFLAG_TRANSPORT = 0x0002, - UPDATEFLAG_HAS_TARGET = 0x0004, - UPDATEFLAG_UNK1 = 0x0008, - UPDATEFLAG_UNK2 = 0x0010, - UPDATEFLAG_LIVING = 0x0020, - UPDATEFLAG_HAS_POSITION = 0x0040, - UPDATEFLAG_VEHICLE = 0x0080, - UPDATEFLAG_POSITION = 0x0100, - UPDATEFLAG_ROTATION = 0x0200, - UPDATEFLAG_UNK3 = 0x0400, - UPDATEFLAG_ANIMKITS = 0x0800, - UPDATEFLAG_UNK5 = 0x1000, - UPDATEFLAG_UNK6 = 0x2000 + UPDATEFLAG_NONE = 0x0000, + UPDATEFLAG_SELF = 0x0001, + UPDATEFLAG_TRANSPORT = 0x0002, + UPDATEFLAG_HAS_TARGET = 0x0004, + UPDATEFLAG_UNKNOWN = 0x0008, + UPDATEFLAG_LOWGUID = 0x0010, + UPDATEFLAG_LIVING = 0x0020, + UPDATEFLAG_STATIONARY_POSITION = 0x0040, + UPDATEFLAG_VEHICLE = 0x0080, + UPDATEFLAG_POSITION = 0x0100, + UPDATEFLAG_ROTATION = 0x0200, + UPDATEFLAG_UNK3 = 0x0400, + UPDATEFLAG_ANIMKITS = 0x0800, + UPDATEFLAG_UNK5 = 0x1000, + UPDATEFLAG_UNK6 = 0x2000 }; class UpdateData diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index 088957ab0b3..414792c8d5c 100755 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -97,30 +97,42 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c uint32 ownerid = owner->GetGUIDLow(); - QueryResult result; + PreparedStatement* stmt; + PreparedQueryResult result; if (petnumber) - // known petnumber entry 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 - result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, abdata, savetime, CreatedBySpell, PetType " - "FROM character_pet WHERE owner = '%u' AND id = '%u'", - ownerid, petnumber); + { + // Known petnumber entry + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PET_BY_ENTRY); + stmt->setUInt32(0, ownerid); + stmt->setUInt32(1, petnumber); + } else if (current) - // current pet (slot 0) 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 - result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, abdata, savetime, CreatedBySpell, PetType " - "FROM character_pet WHERE owner = '%u' AND slot = '%u'", - ownerid, PET_SAVE_AS_CURRENT); + { + // Current pet (slot 0) + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PET_BY_ENTRY_AND_SLOT); + stmt->setUInt32(0, ownerid); + stmt->setUInt8(1, uint8(PET_SAVE_AS_CURRENT)); + } else if (petentry) + { // known petentry entry (unique for summoned pet, but non unique for hunter pet (only from current or not stabled pets) - // 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 - result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, abdata, savetime, CreatedBySpell, PetType " - "FROM character_pet WHERE owner = '%u' AND entry = '%u' AND (slot = '%u' OR slot > '%u') ", - ownerid, petentry, PET_SAVE_AS_CURRENT, PET_SAVE_LAST_STABLE_SLOT); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PET_BY_ENTRY_AND_SLOT_2); + stmt->setUInt32(0, ownerid); + stmt->setUInt32(1, petentry); + stmt->setUInt8(2, uint8(PET_SAVE_AS_CURRENT)); + stmt->setUInt8(3, uint8(PET_SAVE_LAST_STABLE_SLOT)); + } else - // any current or other non-stabled pet (for hunter "call pet") - // 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 - result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, abdata, savetime, CreatedBySpell, PetType " - "FROM character_pet WHERE owner = '%u' AND (slot = '%u' OR slot > '%u') ", - ownerid, PET_SAVE_AS_CURRENT, PET_SAVE_LAST_STABLE_SLOT); + { + // Any current or other non-stabled pet (for hunter "call pet") + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PET_BY_SLOT); + stmt->setUInt32(0, ownerid); + stmt->setUInt8(1, uint8(PET_SAVE_AS_CURRENT)); + stmt->setUInt8(2, uint8(PET_SAVE_LAST_STABLE_SLOT)); + } + + result = CharacterDatabase.Query(stmt); if (!result) { @@ -180,7 +192,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c setFaction(owner->getFaction()); SetUInt32Value(UNIT_CREATED_BY_SPELL, summon_spell_id); - CreatureTemplate const* cinfo = GetCreatureInfo(); + CreatureTemplate const* cinfo = GetCreatureTemplate(); if (cinfo->type == CREATURE_TYPE_CRITTER) { map->AddToMap(this->ToCreature()); @@ -252,10 +264,20 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c if (fields[7].GetUInt8()) { SQLTransaction trans = CharacterDatabase.BeginTransaction(); - trans->PAppend("UPDATE character_pet SET slot = '%u' WHERE owner = '%u' AND slot = '%u' AND id <> '%u'", - PET_SAVE_NOT_IN_SLOT, ownerid, PET_SAVE_AS_CURRENT, m_charmInfo->GetPetNumber()); - trans->PAppend("UPDATE character_pet SET slot = '%u' WHERE owner = '%u' AND id = '%u'", - PET_SAVE_AS_CURRENT, ownerid, m_charmInfo->GetPetNumber()); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_PET_SLOT_BY_SLOT_EXCLUDE_ID); + stmt->setUInt8(0, uint8(PET_SAVE_NOT_IN_SLOT)); + stmt->setUInt32(1, ownerid); + stmt->setUInt8(2, uint8(PET_SAVE_AS_CURRENT)); + stmt->setUInt32(3, m_charmInfo->GetPetNumber()); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_PET_SLOT_BY_ID); + stmt->setUInt8(0, uint8(PET_SAVE_AS_CURRENT)); + stmt->setUInt32(1, ownerid); + stmt->setUInt32(2, m_charmInfo->GetPetNumber()); + trans->Append(stmt); + CharacterDatabase.CommitTransaction(trans); } @@ -308,7 +330,10 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c if (getPetType() == HUNTER_PET) { - result = CharacterDatabase.PQuery("SELECT genitive, dative, accusative, instrumental, prepositional FROM character_pet_declinedname WHERE owner = '%u' AND id = '%u'", owner->GetGUIDLow(), GetCharmInfo()->GetPetNumber()); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_DECLINED_NAME); + stmt->setUInt32(0, owner->GetGUIDLow()); + stmt->setUInt32(1, GetCharmInfo()->GetPetNumber()); + PreparedQueryResult result = CharacterDatabase.Query(stmt); if (result) { @@ -383,17 +408,31 @@ void Pet::SavePetToDB(PetSaveMode mode) CharacterDatabase.EscapeString(name); trans = CharacterDatabase.BeginTransaction(); // remove current data - trans->PAppend("DELETE FROM character_pet WHERE owner = '%u' AND id = '%u'", ownerLowGUID, m_charmInfo->GetPetNumber()); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_BY_ID); + stmt->setUInt32(0, m_charmInfo->GetPetNumber()); + trans->Append(stmt); // prevent duplicate using slot (except PET_SAVE_NOT_IN_SLOT) if (mode <= PET_SAVE_LAST_STABLE_SLOT) - trans->PAppend("UPDATE character_pet SET slot = '%u' WHERE owner = '%u' AND slot = '%u'", - PET_SAVE_NOT_IN_SLOT, ownerLowGUID, uint32(mode)); + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_PET_SLOT_BY_SLOT); + stmt->setUInt8(0, uint8(PET_SAVE_NOT_IN_SLOT)); + stmt->setUInt32(1, ownerLowGUID); + stmt->setUInt8(2, uint8(mode)); + trans->Append(stmt); + } // prevent existence another hunter pet in PET_SAVE_AS_CURRENT and PET_SAVE_NOT_IN_SLOT if (getPetType() == HUNTER_PET && (mode == PET_SAVE_AS_CURRENT || mode > PET_SAVE_LAST_STABLE_SLOT)) - trans->PAppend("DELETE FROM character_pet WHERE owner = '%u' AND (slot = '%u' OR slot > '%u')", - ownerLowGUID, PET_SAVE_AS_CURRENT, PET_SAVE_LAST_STABLE_SLOT); + { + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_BY_SLOT); + stmt->setUInt32(0, ownerLowGUID); + stmt->setUInt8(1, uint8(PET_SAVE_AS_CURRENT)); + stmt->setUInt8(2, uint8(PET_SAVE_LAST_STABLE_SLOT)); + trans->Append(stmt); + } + // save pet std::ostringstream ss; ss << "INSERT INTO character_pet (id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, abdata, savetime, CreatedBySpell, PetType) " @@ -414,7 +453,7 @@ void Pet::SavePetToDB(PetSaveMode mode) for (uint32 i = ACTION_BAR_INDEX_START; i < ACTION_BAR_INDEX_END; ++i) { ss << uint32(m_charmInfo->GetActionBarEntry(i)->GetType()) << ' ' - << uint32(m_charmInfo->GetActionBarEntry(i)->GetAction()) << ' '; + << uint32(m_charmInfo->GetActionBarEntry(i)->GetAction()) << ' '; }; ss << "', " @@ -436,11 +475,27 @@ void Pet::SavePetToDB(PetSaveMode mode) void Pet::DeleteFromDB(uint32 guidlow) { SQLTransaction trans = CharacterDatabase.BeginTransaction(); - trans->PAppend("DELETE FROM character_pet WHERE id = '%u'", guidlow); - trans->PAppend("DELETE FROM character_pet_declinedname WHERE id = '%u'", guidlow); - trans->PAppend("DELETE FROM pet_aura WHERE guid = '%u'", guidlow); - trans->PAppend("DELETE FROM pet_spell WHERE guid = '%u'", guidlow); - trans->PAppend("DELETE FROM pet_spell_cooldown WHERE guid = '%u'", guidlow); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_BY_ID); + stmt->setUInt32(0, guidlow); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_DECLINEDNAME); + stmt->setUInt32(0, guidlow); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PET_AURAS); + stmt->setUInt32(0, guidlow); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PET_SPELLS); + stmt->setUInt32(0, guidlow); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PET_SPELL_COOLDOWNS); + stmt->setUInt32(0, guidlow); + trans->Append(stmt); + CharacterDatabase.CommitTransaction(trans); } @@ -528,7 +583,13 @@ void Pet::Update(uint32 diff) Regenerate(POWER_FOCUS); m_regenTimer += PET_FOCUS_REGEN_INTERVAL - diff; if (!m_regenTimer) ++m_regenTimer; + + // Reset if large diff (lag) causes focus to get 'stuck' + if (m_regenTimer > PET_FOCUS_REGEN_INTERVAL) + m_regenTimer = PET_FOCUS_REGEN_INTERVAL; + break; + // in creature::update //case POWER_ENERGY: // Regenerate(POWER_ENERGY); @@ -650,7 +711,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature) { ASSERT(creature); - if (!CreateBaseAtTamed(creature->GetCreatureInfo(), creature->GetMap(), creature->GetPhaseMask())) + if (!CreateBaseAtTamed(creature->GetCreatureTemplate(), creature->GetMap(), creature->GetPhaseMask())) return false; Relocate(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), creature->GetOrientation()); @@ -662,7 +723,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature) return false; } - CreatureTemplate const* cinfo = GetCreatureInfo(); + CreatureTemplate const* cinfo = GetCreatureTemplate(); if (!cinfo) { sLog->outError("CreateBaseAtCreature() failed, creatureInfo is missing!"); @@ -719,7 +780,7 @@ bool Pet::CreateBaseAtTamed(CreatureTemplate const* cinfo, Map* map, uint32 phas // TODO: Move stat mods code to pet passive auras bool Guardian::InitStatsForLevel(uint8 petlevel) { - CreatureTemplate const* cinfo = GetCreatureInfo(); + CreatureTemplate const* cinfo = GetCreatureTemplate(); ASSERT(cinfo); SetLevel(petlevel); @@ -765,7 +826,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) else scale = cFamily->minScale + float(getLevel() - cFamily->minScaleLevel) / cFamily->maxScaleLevel * (cFamily->maxScale - cFamily->minScale); - SetFloatValue(OBJECT_FIELD_SCALE_X, scale); + SetObjectScale(scale); } // Resistance @@ -835,14 +896,14 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) { case 510: // mage Water Elemental { - SetBonusDamage(int32(m_owner->SpellBaseDamageBonus(SPELL_SCHOOL_MASK_FROST) * 0.33f)); + SetBonusDamage(int32(m_owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FROST) * 0.33f)); break; } case 1964: //force of nature { if (!pInfo) SetCreateHealth(30 + 30*petlevel); - float bonusDmg = m_owner->SpellBaseDamageBonus(SPELL_SCHOOL_MASK_NATURE) * 0.15f; + float bonusDmg = m_owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_NATURE) * 0.15f; SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel * 2.5f - (petlevel / 2) + bonusDmg)); SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel * 2.5f + (petlevel / 2) + bonusDmg)); break; @@ -862,7 +923,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) SetCreateHealth(40*petlevel); SetCreateMana(28 + 10*petlevel); } - SetBonusDamage(m_owner->SpellBaseDamageBonus(SPELL_SCHOOL_MASK_FIRE) * 0.5f); + SetBonusDamage(int32(m_owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE) * 0.5f)); SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel * 4 - petlevel)); SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel * 4 + petlevel)); break; @@ -874,7 +935,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) SetCreateMana(28 + 10*petlevel); SetCreateHealth(28 + 30*petlevel); } - int32 bonus_dmg = (int32(m_owner->SpellBaseDamageBonus(SPELL_SCHOOL_MASK_SHADOW)* 0.3f)); + int32 bonus_dmg = (int32(m_owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW)* 0.3f)); SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float((petlevel * 4 - petlevel) + bonus_dmg)); SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float((petlevel * 4 + petlevel) + bonus_dmg)); @@ -915,7 +976,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) } case 31216: // Mirror Image { - SetBonusDamage(int32(m_owner->SpellBaseDamageBonus(SPELL_SCHOOL_MASK_FROST) * 0.33f)); + SetBonusDamage(int32(m_owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FROST) * 0.33f)); SetDisplayId(m_owner->GetDisplayId()); if (!pInfo) { @@ -936,6 +997,13 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel + (petlevel / 4))); break; } + case 28017: // Bloodworms + { + SetCreateHealth(4 * petlevel); + SetBonusDamage(int32(m_owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.006f)); + SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - 30 - (petlevel / 4))); + SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel - 30 + (petlevel / 4))); + } } break; } @@ -953,7 +1021,7 @@ bool Pet::HaveInDiet(ItemTemplate const* item) const if (!item->FoodType) return false; - CreatureTemplate const* cInfo = GetCreatureInfo(); + CreatureTemplate const* cInfo = GetCreatureTemplate(); if (!cInfo) return false; @@ -987,7 +1055,9 @@ void Pet::_LoadSpellCooldowns() m_CreatureSpellCooldowns.clear(); m_CreatureCategoryCooldowns.clear(); - QueryResult result = CharacterDatabase.PQuery("SELECT spell, time FROM pet_spell_cooldown WHERE guid = '%u'", m_charmInfo->GetPetNumber()); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_SPELL_COOLDOWN); + stmt->setUInt32(0, m_charmInfo->GetPetNumber()); + PreparedQueryResult result = CharacterDatabase.Query(stmt); if (result) { @@ -1030,7 +1100,9 @@ void Pet::_LoadSpellCooldowns() void Pet::_SaveSpellCooldowns(SQLTransaction& trans) { - trans->PAppend("DELETE FROM pet_spell_cooldown WHERE guid = '%u'", m_charmInfo->GetPetNumber()); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PET_SPELL_COOLDOWNS); + stmt->setUInt32(0, m_charmInfo->GetPetNumber()); + trans->Append(stmt); time_t curTime = time(NULL); @@ -1041,7 +1113,12 @@ void Pet::_SaveSpellCooldowns(SQLTransaction& trans) m_CreatureSpellCooldowns.erase(itr++); else { - trans->PAppend("INSERT INTO pet_spell_cooldown (guid, spell, time) VALUES ('%u', '%u', '%u')", m_charmInfo->GetPetNumber(), itr->first, uint32(itr->second)); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PET_SPELL_COOLDOWN); + stmt->setUInt32(0, m_charmInfo->GetPetNumber()); + stmt->setUInt32(1, itr->first); + stmt->setUInt32(2, uint32(itr->second)); + trans->Append(stmt); + ++itr; } } @@ -1049,7 +1126,9 @@ void Pet::_SaveSpellCooldowns(SQLTransaction& trans) void Pet::_LoadSpells() { - QueryResult result = CharacterDatabase.PQuery("SELECT spell, active FROM pet_spell WHERE guid = '%u'", m_charmInfo->GetPetNumber()); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_SPELL); + stmt->setUInt32(0, m_charmInfo->GetPetNumber()); + PreparedQueryResult result = CharacterDatabase.Query(stmt); if (result) { @@ -1073,18 +1152,37 @@ void Pet::_SaveSpells(SQLTransaction& trans) if (itr->second.type == PETSPELL_FAMILY) continue; + PreparedStatement* stmt; + switch (itr->second.state) { case PETSPELL_REMOVED: - trans->PAppend("DELETE FROM pet_spell WHERE guid = '%u' and spell = '%u'", m_charmInfo->GetPetNumber(), itr->first); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PET_SPELL_BY_SPELL); + stmt->setUInt32(0, m_charmInfo->GetPetNumber()); + stmt->setUInt32(1, itr->first); + trans->Append(stmt); + m_spells.erase(itr); continue; case PETSPELL_CHANGED: - trans->PAppend("DELETE FROM pet_spell WHERE guid = '%u' and spell = '%u'", m_charmInfo->GetPetNumber(), itr->first); - trans->PAppend("INSERT INTO pet_spell (guid, spell, active) VALUES ('%u', '%u', '%u')", m_charmInfo->GetPetNumber(), itr->first, itr->second.active); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PET_SPELL_BY_SPELL); + stmt->setUInt32(0, m_charmInfo->GetPetNumber()); + stmt->setUInt32(1, itr->first); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PET_SPELL); + stmt->setUInt32(0, m_charmInfo->GetPetNumber()); + stmt->setUInt32(1, itr->first); + stmt->setUInt8(2, itr->second.active); + trans->Append(stmt); + break; case PETSPELL_NEW: - trans->PAppend("INSERT INTO pet_spell (guid, spell, active) VALUES ('%u', '%u', '%u')", m_charmInfo->GetPetNumber(), itr->first, itr->second.active); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PET_SPELL); + stmt->setUInt32(0, m_charmInfo->GetPetNumber()); + stmt->setUInt32(1, itr->first); + stmt->setUInt8(2, itr->second.active); + trans->Append(stmt); break; case PETSPELL_UNCHANGED: continue; @@ -1097,7 +1195,9 @@ void Pet::_LoadAuras(uint32 timediff) { sLog->outDebug(LOG_FILTER_PETS, "Loading auras for pet %u", GetGUIDLow()); - QueryResult result = CharacterDatabase.PQuery("SELECT caster_guid, spell, effect_mask, recalculate_mask, stackcount, amount0, amount1, amount2, base_amount0, base_amount1, base_amount2, maxduration, remaintime, remaincharges FROM pet_aura WHERE guid = '%u'", m_charmInfo->GetPetNumber()); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_AURA); + stmt->setUInt32(0, m_charmInfo->GetPetNumber()); + PreparedQueryResult result = CharacterDatabase.Query(stmt); if (result) { @@ -1167,9 +1267,11 @@ void Pet::_LoadAuras(uint32 timediff) void Pet::_SaveAuras(SQLTransaction& trans) { - trans->PAppend("DELETE FROM pet_aura WHERE guid = '%u'", m_charmInfo->GetPetNumber()); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PET_AURAS); + stmt->setUInt32(0, m_charmInfo->GetPetNumber()); + trans->Append(stmt); - for (AuraMap::const_iterator itr = m_ownedAuras.begin(); itr != m_ownedAuras.end() ; ++itr) + for (AuraMap::const_iterator itr = m_ownedAuras.begin(); itr != m_ownedAuras.end(); ++itr) { // check if the aura has to be saved if (!itr->second->CanBeSaved() || IsPetAura(itr->second)) @@ -1201,11 +1303,26 @@ void Pet::_SaveAuras(SQLTransaction& trans) // don't save guid of caster in case we are caster of the spell - guid for pet is generated every pet load, so it won't match saved guid anyways uint64 casterGUID = (itr->second->GetCasterGUID() == GetGUID()) ? 0 : itr->second->GetCasterGUID(); - trans->PAppend("INSERT INTO pet_aura (guid, caster_guid, spell, effect_mask, recalculate_mask, stackcount, amount0, amount1, amount2, base_amount0, base_amount1, base_amount2, maxduration, remaintime, remaincharges) " - "VALUES ('%u', '" UI64FMTD "', '%u', '%u', '%u', '%u', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%u')", - m_charmInfo->GetPetNumber(), casterGUID, itr->second->GetId(), effMask, recalculateMask, - itr->second->GetStackAmount(), damage[0], damage[1], damage[2], baseDamage[0], baseDamage[1], baseDamage[2], - itr->second->GetMaxDuration(), itr->second->GetDuration(), itr->second->GetCharges()); + uint8 index = 0; + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PET_AURA); + stmt->setUInt32(index++, m_charmInfo->GetPetNumber()); + stmt->setUInt64(index++, casterGUID); + stmt->setUInt32(index++, itr->second->GetId()); + stmt->setUInt8(index++, effMask); + stmt->setUInt8(index++, recalculateMask); + stmt->setUInt8(index++, itr->second->GetStackAmount()); + stmt->setInt32(index++, damage[0]); + stmt->setInt32(index++, damage[1]); + stmt->setInt32(index++, damage[2]); + stmt->setInt32(index++, baseDamage[0]); + stmt->setInt32(index++, baseDamage[1]); + stmt->setInt32(index++, baseDamage[2]); + stmt->setInt32(index++, itr->second->GetMaxDuration()); + stmt->setInt32(index++, itr->second->GetDuration()); + stmt->setUInt8(index++, itr->second->GetCharges()); + + trans->Append(stmt); } } @@ -1292,7 +1409,8 @@ bool Pet::addSpell(uint32 spellId, ActiveStates active /*= ACT_DECIDE*/, PetSpel { for (PetSpellMap::const_iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2) { - if (itr2->second.state == PETSPELL_REMOVED) continue; + if (itr2->second.state == PETSPELL_REMOVED) + continue; SpellInfo const* oldRankSpellInfo = sSpellMgr->GetSpellInfo(itr2->first); @@ -1361,7 +1479,7 @@ void Pet::InitLevelupSpellsForLevel() { uint8 level = getLevel(); - if (PetLevelupSpellSet const* levelupSpells = GetCreatureInfo()->family ? sSpellMgr->GetPetLevelupSpellList(GetCreatureInfo()->family) : NULL) + if (PetLevelupSpellSet const* levelupSpells = GetCreatureTemplate()->family ? sSpellMgr->GetPetLevelupSpellList(GetCreatureTemplate()->family) : NULL) { // PetLevelupSpellSet ordered by levels, process in reversed order for (PetLevelupSpellSet::const_reverse_iterator itr = levelupSpells->rbegin(); itr != levelupSpells->rend(); ++itr) @@ -1375,7 +1493,7 @@ void Pet::InitLevelupSpellsForLevel() } } - int32 petSpellsId = GetCreatureInfo()->PetSpellDataId ? -(int32)GetCreatureInfo()->PetSpellDataId : GetEntry(); + int32 petSpellsId = GetCreatureTemplate()->PetSpellDataId ? -(int32)GetCreatureTemplate()->PetSpellDataId : GetEntry(); // default spells (can be not learned if pet level (as owner level decrease result for example) less first possible in normal game) if (PetDefaultSpellsEntry const* defSpells = sSpellMgr->GetPetDefaultSpellsEntry(petSpellsId)) @@ -1499,7 +1617,7 @@ bool Pet::resetTalents() if (owner->ToPlayer()->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS)) owner->ToPlayer()->RemoveAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS, true); - CreatureTemplate const* ci = GetCreatureInfo(); + CreatureTemplate const* ci = GetCreatureTemplate(); if (!ci) return false; // Check pet talent type @@ -1579,18 +1697,19 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/) // now need only reset for offline pets (all pets except online case) uint32 except_petnumber = online_pet ? online_pet->GetCharmInfo()->GetPetNumber() : 0; - QueryResult resultPets = CharacterDatabase.PQuery( - "SELECT id FROM character_pet WHERE owner = '%u' AND id <> '%u'", - owner->GetGUIDLow(), except_petnumber); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PET); + stmt->setUInt32(0, owner->GetGUIDLow()); + stmt->setUInt32(1, except_petnumber); + PreparedQueryResult resultPets = CharacterDatabase.Query(stmt); // no offline pets if (!resultPets) return; - QueryResult result = CharacterDatabase.PQuery( - "SELECT DISTINCT pet_spell.spell FROM pet_spell, character_pet " - "WHERE character_pet.owner = '%u' AND character_pet.id = pet_spell.guid AND character_pet.id <> %u", - owner->GetGUIDLow(), except_petnumber); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_SPELL_LIST); + stmt->setUInt32(0, owner->GetGUIDLow()); + stmt->setUInt32(1, except_petnumber); + PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) return; @@ -1727,9 +1846,9 @@ bool Pet::IsPermanentPetFor(Player* owner) switch (owner->getClass()) { case CLASS_WARLOCK: - return GetCreatureInfo()->type == CREATURE_TYPE_DEMON; + return GetCreatureTemplate()->type == CREATURE_TYPE_DEMON; case CLASS_DEATH_KNIGHT: - return GetCreatureInfo()->type == CREATURE_TYPE_UNDEAD; + return GetCreatureTemplate()->type == CREATURE_TYPE_UNDEAD; case CLASS_MAGE: return GetCreatureInfo()->type == CREATURE_TYPE_ELEMENTAL; default: @@ -1770,7 +1889,7 @@ bool Pet::HasSpell(uint32 spell) const // Get all passive spells in our skill line void Pet::LearnPetPassives() { - CreatureTemplate const* cInfo = GetCreatureInfo(); + CreatureTemplate const* cInfo = GetCreatureTemplate(); if (!cInfo) return; diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 2c9747312af..d62e0ccfd53 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -145,7 +145,6 @@ static uint32 copseReclaimDelay[MAX_DEATH_COUNT] = { 30, 60, 120 }; PlayerTaxi::PlayerTaxi() { - // Taxi nodes memset(m_taximask, 0, sizeof(m_taximask)); } @@ -541,7 +540,7 @@ inline void KillRewarder::_RewardKillCredit(Player* player) // 4.4. Give kill credit (player must not be in group, or he must be alive or without corpse). if (!_group || player->isAlive() || !player->GetCorpse()) if (_victim->GetTypeId() == TYPEID_UNIT) - player->KilledMonster(_victim->ToCreature()->GetCreatureInfo(), _victim->GetGUID()); + player->KilledMonster(_victim->ToCreature()->GetCreatureTemplate(), _victim->GetGUID()); } void KillRewarder::_RewardPlayer(Player* player, bool isDungeon) @@ -844,6 +843,10 @@ Player::Player(WorldSession* session): Unit(true), m_achievementMgr(this), m_rep isDebugAreaTriggers = false; + m_WeeklyQuestChanged = false; + + m_SeasonalQuestChanged = false; + SetPendingBind(0, 0); } @@ -862,7 +865,7 @@ Player::~Player() delete _talentMgr; //all mailed items should be deleted, also all mail should be deallocated - for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr) + for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr) delete *itr; for (ItemMap::iterator iter = mMitems.begin(); iter != mMitems.end(); ++iter) @@ -909,7 +912,8 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) PlayerInfo const* info = sObjectMgr->GetPlayerInfo(createInfo->Race, createInfo->Class); if (!info) { - sLog->outError("Player (Name %s) has incorrect race/class pair. Can't be loaded.", m_name.c_str()); + sLog->outError("Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid race/class pair (%u/%u) - refusing to do so.", + GetSession()->GetAccountId(), m_name.c_str(), createInfo->Race, createInfo->Class); return false; } @@ -921,7 +925,8 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(createInfo->Class); if (!cEntry) { - sLog->outError("Class %u not found in DBC (Wrong DBC files?)", createInfo->Class); + sLog->outError("Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid character class (%u) - refusing to do so (wrong DBC-files?)", + GetSession()->GetAccountId(), m_name.c_str(), createInfo->Class); return false; } @@ -936,7 +941,8 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) if (!IsValidGender(createInfo->Gender)) { - sLog->outError("Player has invalid gender (%hu), can't be loaded.", createInfo->Gender); + sLog->outError("Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid gender (%hu) - refusing to do so", + GetSession()->GetAccountId(), m_name.c_str(), createInfo->Gender); return false; } @@ -1101,10 +1107,10 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) if (oEntry->ItemId[j] <= 0) continue; - uint32 item_id = oEntry->ItemId[j]; + uint32 itemId = oEntry->ItemId[j]; // just skip, reported in ObjectMgr::LoadItemTemplates - ItemTemplate const* iProto = sObjectMgr->GetItemTemplate(item_id); + ItemTemplate const* iProto = sObjectMgr->GetItemTemplate(itemId); if (!iProto) continue; @@ -1126,7 +1132,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) if (iProto->GetMaxStackSize() < count) count = iProto->GetMaxStackSize(); } - StoreNewItemInBestSlots(item_id, count); + StoreNewItemInBestSlots(itemId, count); } } @@ -1390,14 +1396,14 @@ void Player::HandleDrowning(uint32 time_diff) SendMirrorTimer(FATIGUE_TIMER, DarkWaterTime, m_MirrorTimer[FATIGUE_TIMER], 10); } - if (m_MirrorTimerFlags & (UNDERWATER_INLAVA|UNDERWATER_INSLIME)) + if (m_MirrorTimerFlags & (UNDERWATER_INLAVA /*| UNDERWATER_INSLIME*/) && !(_lastLiquid && _lastLiquid->SpellId)) { // Breath timer not activated - activate it if (m_MirrorTimer[FIRE_TIMER] == DISABLED_MIRROR_TIMER) m_MirrorTimer[FIRE_TIMER] = getMaxTimer(FIRE_TIMER); else { - m_MirrorTimer[FIRE_TIMER]-=time_diff; + m_MirrorTimer[FIRE_TIMER] -= time_diff; if (m_MirrorTimer[FIRE_TIMER] < 0) { m_MirrorTimer[FIRE_TIMER]+= 1*IN_MILLISECONDS; @@ -1408,8 +1414,8 @@ void Player::HandleDrowning(uint32 time_diff) EnvironmentalDamage(DAMAGE_LAVA, damage); // need to skip Slime damage in Undercity, // maybe someone can find better way to handle environmental damage - else if (m_zoneUpdateId != 1497) - EnvironmentalDamage(DAMAGE_SLIME, damage); + //else if (m_zoneUpdateId != 1497) + // EnvironmentalDamage(DAMAGE_SLIME, damage); } } } @@ -1562,14 +1568,14 @@ void Player::Update(uint32 p_time) if (HasUnitState(UNIT_STATE_MELEE_ATTACKING) && !HasUnitState(UNIT_STATE_CASTING)) { - if (Unit* pVictim = getVictim()) + if (Unit* victim = getVictim()) { // default combat reach 10 // TODO add weapon, skill check if (isAttackReady(BASE_ATTACK)) { - if (!IsWithinMeleeRange(pVictim)) + if (!IsWithinMeleeRange(victim)) { setAttackTimer(BASE_ATTACK, 100); if (m_swingErrorMsg != 1) // send single time (client auto repeat) @@ -1579,7 +1585,7 @@ void Player::Update(uint32 p_time) } } //120 degrees of radiant range - else if (!HasInArc(2*M_PI/3, pVictim)) + else if (!HasInArc(2*M_PI/3, victim)) { setAttackTimer(BASE_ATTACK, 100); if (m_swingErrorMsg != 2) // send single time (client auto repeat) @@ -1598,16 +1604,16 @@ void Player::Update(uint32 p_time) setAttackTimer(OFF_ATTACK, ATTACK_DISPLAY_DELAY); // do attack - AttackerStateUpdate(pVictim, BASE_ATTACK); + AttackerStateUpdate(victim, BASE_ATTACK); resetAttackTimer(BASE_ATTACK); } } if (haveOffhandWeapon() && isAttackReady(OFF_ATTACK)) { - if (!IsWithinMeleeRange(pVictim)) + if (!IsWithinMeleeRange(victim)) setAttackTimer(OFF_ATTACK, 100); - else if (!HasInArc(2*M_PI/3, pVictim)) + else if (!HasInArc(2*M_PI/3, victim)) setAttackTimer(OFF_ATTACK, 100); else { @@ -1616,13 +1622,13 @@ void Player::Update(uint32 p_time) setAttackTimer(BASE_ATTACK, ATTACK_DISPLAY_DELAY); // do attack - AttackerStateUpdate(pVictim, OFF_ATTACK); + AttackerStateUpdate(victim, OFF_ATTACK); resetAttackTimer(OFF_ATTACK); } } - /*Unit* owner = pVictim->GetOwner(); - Unit* u = owner ? owner : pVictim; + /*Unit* owner = victim->GetOwner(); + Unit* u = owner ? owner : victim; if (u->IsPvP() && (!duel || duel->opponent != u)) { UpdatePvP(true); @@ -2208,7 +2214,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati if (duel && GetMapId() != mapid && GetMap()->GetGameObject(GetUInt64Value(PLAYER_DUEL_ARBITER))) DuelComplete(DUEL_FLED); - if ((GetMapId() == mapid && !m_transport) || (GetTransport() && GetMapId() == 628)) + if (GetMapId() == mapid) { //lets reset far teleport flag if it wasn't reset during chained teleports SetSemaphoreTeleportFar(false); @@ -2774,11 +2780,11 @@ Creature* Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask) return NULL; // Deathstate checks - if (!isAlive() && !(creature->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_GHOST)) + if (!isAlive() && !(creature->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_GHOST)) return NULL; // alive or spirit healer - if (!creature->isAlive() && !(creature->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_DEAD_INTERACT)) + if (!creature->isAlive() && !(creature->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_DEAD_INTERACT)) return NULL; // appropriate npc type @@ -3019,7 +3025,7 @@ void Player::GiveXP(uint32 xp, Unit* victim, float group_rate) if (xp < 1) return; - if (!isAlive()) + if (!isAlive() && !GetBattlegroundId()) return; if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN)) @@ -3231,7 +3237,7 @@ void Player::InitStatsForLevel(bool reapplyMods) SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f); // reset size before reapply auras - SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f); + SetObjectScale(1.0f); // save base values (bonuses already included in stored stats for (uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i) @@ -3501,7 +3507,7 @@ void Player::AddNewMailDeliverTime(time_t deliver_time) else // not ready and no have ready mails { if (!m_nextMailDelivereTime || m_nextMailDelivereTime > deliver_time) - m_nextMailDelivereTime = deliver_time; + m_nextMailDelivereTime = deliver_time; } } @@ -3773,9 +3779,12 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent { for (PlayerSpellMap::iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2) { - if (itr2->second->state == PLAYERSPELL_REMOVED) continue; + if (itr2->second->state == PLAYERSPELL_REMOVED) + continue; + SpellInfo const* i_spellInfo = sSpellMgr->GetSpellInfo(itr2->first); - if (!i_spellInfo) continue; + if (!i_spellInfo) + continue; if (spellInfo->IsDifferentRankOf(i_spellInfo)) { @@ -3873,7 +3882,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent uint32 new_skill_max_value = spellLearnSkill->maxvalue == 0 ? maxskill : spellLearnSkill->maxvalue; if (skill_max_value < new_skill_max_value) - skill_max_value = new_skill_max_value; + skill_max_value = new_skill_max_value; SetSkill(spellLearnSkill->skill, spellLearnSkill->step, skill_value, skill_max_value); } @@ -4160,11 +4169,11 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank) // most likely will never be used, haven't heard of cases where players unlearn a mount if (Has310Flyer(false) && _spell_idx->second->skillId == SKILL_MOUNTS) { - SpellInfo const* pSpellInfo = sSpellMgr->GetSpellInfo(spell_id); - for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) - if (pSpellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED && - pSpellInfo->Effects[i].CalcValue() == 310) - Has310Flyer(true, spell_id); // with true as first argument its also used to set/remove the flag + if (spellInfo) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED && + spellInfo->Effects[i].CalcValue() == 310) + Has310Flyer(true, spell_id); // with true as first argument its also used to set/remove the flag } } } @@ -4253,7 +4262,7 @@ bool Player::Has310Flyer(bool checkAllSpells, uint32 excludeSpellId) else { SetHas310Flyer(false); - SpellInfo const* pSpellInfo; + SpellInfo const* spellInfo; for (PlayerSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr) { if (itr->first == excludeSpellId) @@ -4265,10 +4274,10 @@ bool Player::Has310Flyer(bool checkAllSpells, uint32 excludeSpellId) if (_spell_idx->second->skillId != SKILL_MOUNTS) break; // We can break because mount spells belong only to one skillline (at least 310 flyers do) - pSpellInfo = sSpellMgr->GetSpellInfo(itr->first); + spellInfo = sSpellMgr->GetSpellInfo(itr->first); for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) - if (pSpellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED && - pSpellInfo->Effects[i].CalcValue() == 310) + if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED && + spellInfo->Effects[i].CalcValue() == 310) { SetHas310Flyer(true); return true; @@ -4394,7 +4403,9 @@ void Player::_LoadSpellCooldowns(PreparedQueryResult result) void Player::_SaveSpellCooldowns(SQLTransaction& trans) { - trans->PAppend("DELETE FROM character_spell_cooldown WHERE guid = '%u'", GetGUIDLow()); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL_COOLDOWN); + stmt->setUInt32(0, GetGUIDLow()); + trans->Append(stmt); time_t curTime = time(NULL); time_t infTime = curTime + infinityCooldownDelayCheck; @@ -4560,7 +4571,7 @@ bool Player::ResetTalents(bool no_cost) /* when prev line will dropped use next line if (Pet* pet = GetPet()) { - if (pet->getPetType() == HUNTER_PET && !pet->GetCreatureInfo()->isTameable(CanTameExoticPets())) + if (pet->getPetType() == HUNTER_PET && !pet->GetCreatureTemplate()->isTameable(CanTameExoticPets())) RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true); } */ @@ -4716,9 +4727,9 @@ void Player::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c Unit::BuildCreateUpdateBlockForPlayer(data, target); } -void Player::DestroyForPlayer(Player* target, bool anim) const +void Player::DestroyForPlayer(Player* target, bool onDeath) const { - Unit::DestroyForPlayer(target, anim); + Unit::DestroyForPlayer(target, onDeath); for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; ++i) { @@ -4773,7 +4784,7 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell return TRAINER_SPELL_RED; bool hasSpell = true; - for (uint8 i = 0; i < MAX_SPELL_EFFECTS ; ++i) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { if (!trainer_spell->learnedSpell[i]) continue; @@ -4796,7 +4807,7 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell if (getLevel() < trainer_spell->reqLevel) return TRAINER_SPELL_RED; - for (uint8 i = 0; i < MAX_SPELL_EFFECTS ; ++i) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { if (!trainer_spell->learnedSpell[i]) continue; @@ -4823,7 +4834,7 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell // check primary prof. limit // first rank of primary profession spell when there are no proffesions avalible is disabled - for (uint8 i = 0; i < MAX_SPELL_EFFECTS ; ++i) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { if (!trainer_spell->learnedSpell[i]) continue; @@ -4875,7 +4886,10 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC LeaveAllArenaTeams(playerguid); // the player was uninvited already on logout so just remove from group - QueryResult resultGroup = CharacterDatabase.PQuery("SELECT guid FROM group_member WHERE memberGuid=%u", guid); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GROUP_MEMBER); + stmt->setUInt32(0, guid); + PreparedQueryResult resultGroup = CharacterDatabase.Query(stmt); + if (resultGroup) if (Group* group = sGroupMgr->GetGroupByDbStoreId((*resultGroup)[0].GetUInt32())) RemoveFromGroup(group, playerguid); @@ -4889,32 +4903,41 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC case CHAR_DELETE_REMOVE: { SQLTransaction trans = CharacterDatabase.BeginTransaction(); - // Return back all mails with COD and Item 0 1 2 3 4 5 6 7 - QueryResult resultMail = CharacterDatabase.PQuery("SELECT id, messageType, mailTemplateId, sender, subject, body, money, has_items FROM mail WHERE receiver='%u' AND has_items<>0 AND cod<>0", guid); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_COD_ITEM_MAIL); + stmt->setUInt32(0, guid); + PreparedQueryResult resultMail = CharacterDatabase.Query(stmt); + if (resultMail) { do { - Field* fields = resultMail->Fetch(); + Field* mailFields = resultMail->Fetch(); - uint32 mail_id = fields[0].GetUInt32(); - uint16 mailType = fields[1].GetUInt16(); - uint16 mailTemplateId= fields[2].GetUInt16(); - uint32 sender = fields[3].GetUInt32(); - std::string subject = fields[4].GetString(); - std::string body = fields[5].GetString(); - uint32 money = fields[6].GetUInt32(); - bool has_items = fields[7].GetBool(); + uint32 mail_id = mailFields[0].GetUInt32(); + uint8 mailType = mailFields[1].GetUInt8(); + uint16 mailTemplateId= mailFields[2].GetUInt16(); + uint32 sender = mailFields[3].GetUInt32(); + std::string subject = mailFields[4].GetString(); + std::string body = mailFields[5].GetString(); + uint32 money = mailFields[6].GetUInt32(); + bool has_items = mailFields[7].GetBool(); // We can return mail now // So firstly delete the old one - trans->PAppend("DELETE FROM mail WHERE id = '%u'", mail_id); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_BY_ID); + stmt->setUInt32(0, mail_id); + trans->Append(stmt); // Mail is not from player if (mailType != MAIL_NORMAL) { if (has_items) - trans->PAppend("DELETE FROM mail_items WHERE mail_id = '%u'", mail_id); + { + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM_BY_ID); + stmt->setUInt32(0, mail_id); + trans->Append(stmt); + } continue; } @@ -4932,9 +4955,9 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC { do { - Field* fields2 = resultItems->Fetch(); - uint32 item_guidlow = fields2[11].GetUInt32(); - uint32 item_template = fields2[12].GetUInt32(); + Field* itemFields = resultItems->Fetch(); + uint32 item_guidlow = itemFields[11].GetUInt32(); + uint32 item_template = itemFields[12].GetUInt32(); ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(item_template); if (!itemProto) @@ -4946,7 +4969,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC } Item* pItem = NewItemOrBag(itemProto); - if (!pItem->LoadFromDB(item_guidlow, MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER), fields, item_template)) + if (!pItem->LoadFromDB(item_guidlow, MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER), itemFields, item_template)) { pItem->FSetState(ITEM_REMOVED); pItem->SaveToDB(trans); // it also deletes item object! @@ -4959,7 +4982,9 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC } } - trans->PAppend("DELETE FROM mail_items WHERE mail_id = '%u'", mail_id); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM_BY_ID); + stmt->setUInt32(0, mail_id); + trans->Append(stmt); uint32 pl_account = sObjectMgr->GetPlayerAccountIdByGUID(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER)); @@ -4970,7 +4995,11 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC // Unsummon and delete for pets in world is not required: player deleted from CLI or character list with not loaded pet. // NOW we can finally clear other DB data related to character - if (QueryResult resultPets = CharacterDatabase.PQuery("SELECT id FROM character_pet WHERE owner = '%u'", guid)) + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PETS); + stmt->setUInt32(0, guid); + PreparedQueryResult resultPets = CharacterDatabase.Query(stmt); + + if (resultPets) { do { @@ -4980,7 +5009,11 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC } // Delete char from social list of online chars - if (QueryResult resultFriends = CharacterDatabase.PQuery("SELECT DISTINCT guid FROM character_social WHERE friend = '%u'", guid)) + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_SOCIAL); + stmt->setUInt32(0, guid); + PreparedQueryResult resultFriends = CharacterDatabase.Query(stmt); + + if (resultFriends) { do { @@ -4995,48 +5028,134 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC } while (resultFriends->NextRow()); } - trans->PAppend("DELETE FROM characters WHERE guid = '%u'", guid); - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_ACCOUNT_DATA); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER); stmt->setUInt32(0, guid); trans->Append(stmt); - trans->PAppend("DELETE FROM character_declinedname WHERE guid = '%u'", guid); - trans->PAppend("DELETE FROM character_action WHERE guid = '%u'", guid); - trans->PAppend("DELETE FROM character_aura WHERE guid = '%u'", guid); - trans->PAppend("DELETE FROM character_gifts WHERE guid = '%u'", guid); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_ACCOUNT_DATA); + stmt->setUInt32(0, guid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_DECLINED_NAME); + stmt->setUInt32(0, guid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACTION); + stmt->setUInt32(0, guid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA); + stmt->setUInt32(0, guid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_GIFT); + stmt->setUInt32(0, guid); + trans->Append(stmt); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_HOMEBIND); stmt->setUInt32(0, guid); trans->Append(stmt); - trans->PAppend("DELETE FROM character_instance WHERE guid = '%u'", guid); - trans->PAppend("DELETE FROM character_inventory WHERE guid = '%u'", guid); - trans->PAppend("DELETE FROM character_queststatus WHERE guid = '%u'", guid); - trans->PAppend("DELETE FROM character_queststatus_rewarded WHERE guid = '%u'", guid); - trans->PAppend("DELETE FROM character_reputation WHERE guid = '%u'", guid); - trans->PAppend("DELETE FROM character_spell WHERE guid = '%u'", guid); - trans->PAppend("DELETE FROM character_spell_cooldown WHERE guid = '%u'", guid); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE); + stmt->setUInt32(0, guid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY); + stmt->setUInt32(0, guid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS); + stmt->setUInt32(0, guid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS_REWARDED); + stmt->setUInt32(0, guid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_REPUTATION); + stmt->setUInt32(0, guid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL); + stmt->setUInt32(0, guid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL_COOLDOWN); + stmt->setUInt32(0, guid); + trans->Append(stmt); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_GM_TICKETS); stmt->setUInt32(0, guid); trans->Append(stmt); - trans->PAppend("DELETE FROM item_instance WHERE owner_guid = '%u'", guid); - trans->PAppend("DELETE FROM character_social WHERE guid = '%u' OR friend='%u'", guid, guid); - trans->PAppend("DELETE FROM mail WHERE receiver = '%u'", guid); - trans->PAppend("DELETE FROM mail_items WHERE receiver = '%u'", guid); - trans->PAppend("DELETE FROM character_pet WHERE owner = '%u'", guid); - trans->PAppend("DELETE FROM character_pet_declinedname WHERE owner = '%u'", guid); - trans->PAppend("DELETE FROM character_achievement WHERE guid = '%u' " // NOTE: These achievements have flags & 256 in DBC. - "AND achievement NOT BETWEEN '456' AND '467' " // Realm First Level 80 - "AND achievement NOT BETWEEN '1400' AND '1427' " // Realm First Raid Achievements - "AND achievement NOT IN(1463, 3117, 3259) ", guid); // Realm First Northen Vanguard + Raid Achievements - trans->PAppend("DELETE FROM character_achievement_progress WHERE guid = '%u'", guid); - trans->PAppend("DELETE FROM character_equipmentsets WHERE guid = '%u'", guid); - trans->PAppend("DELETE FROM guild_eventlog WHERE PlayerGuid1 = '%u' OR PlayerGuid2 = '%u'", guid, guid); - trans->PAppend("DELETE FROM guild_bank_eventlog WHERE PlayerGuid = '%u'", guid); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE); + stmt->setUInt32(0, guid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_FRIEND); + stmt->setUInt32(0, guid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_GUID); + stmt->setUInt32(0, guid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL); + stmt->setUInt32(0, guid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEMS); + stmt->setUInt32(0, guid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_BY_OWNER); + stmt->setUInt32(0, guid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_DECLINEDNAME_BY_OWNER); + stmt->setUInt32(0, guid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENTS); + stmt->setUInt32(0, guid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_PROGRESS); + stmt->setUInt32(0, guid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_EQUIPMENTSETS); + stmt->setUInt32(0, guid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_EVENTLOG_BY_PLAYER); + stmt->setUInt32(0, guid); + stmt->setUInt32(1, guid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_BANK_EVENTLOG_BY_PLAYER); + stmt->setUInt32(0, guid); + trans->Append(stmt); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_BGDATA); stmt->setUInt32(0, guid); trans->Append(stmt); - trans->PAppend("DELETE FROM character_glyphs WHERE guid = '%u'", guid); - trans->PAppend("DELETE FROM character_queststatus_daily WHERE guid = '%u'", guid); - trans->PAppend("DELETE FROM character_talent WHERE guid = '%u'", guid); - trans->PAppend("DELETE FROM character_skills WHERE guid = '%u'", guid); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_GLYPHS); + stmt->setUInt32(0, guid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS_DAILY); + stmt->setUInt32(0, guid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_TALENT); + stmt->setUInt32(0, guid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SKILLS); + stmt->setUInt32(0, guid); + trans->Append(stmt); CharacterDatabase.CommitTransaction(trans); break; @@ -5084,15 +5203,19 @@ void Player::DeleteOldCharacters(uint32 keepDays) { sLog->outString("Player::DeleteOldChars: Deleting all characters which have been deleted %u days before...", keepDays); - QueryResult resultChars = CharacterDatabase.PQuery("SELECT guid, deleteInfos_Account FROM characters WHERE deleteDate IS NOT NULL AND deleteDate < '%u'", uint32(time(NULL) - time_t(keepDays * DAY))); - if (resultChars) + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_OLD_CHARS); + stmt->setUInt32(0, uint32(time(NULL) - time_t(keepDays * DAY))); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + + if (result) { - sLog->outString("Player::DeleteOldChars: Found " UI64FMTD " character(s) to delete", resultChars->GetRowCount()); + sLog->outString("Player::DeleteOldChars: Found " UI64FMTD " character(s) to delete", result->GetRowCount()); do { - Field* charFields = resultChars->Fetch(); - Player::DeleteFromDB(charFields[0].GetUInt64(), charFields[1].GetUInt32(), true, true); - } while (resultChars->NextRow()); + Field* fields = result->Fetch(); + Player::DeleteFromDB(fields[0].GetUInt32(), fields[1].GetUInt32(), true, true); + } + while (result->NextRow()); } } @@ -5332,7 +5455,7 @@ void Player::CreateCorpse() iDisplayID = m_items[i]->GetTemplate()->DisplayInfoID; iIventoryType = m_items[i]->GetTemplate()->InventoryType; - _cfi = iDisplayID | (iIventoryType << 24); + _cfi = iDisplayID | (iIventoryType << 24); corpse->SetUInt32Value(CORPSE_FIELD_ITEM + i, _cfi); } } @@ -5388,7 +5511,7 @@ void Player::DurabilityLoss(Item* item, double percent) if (!item) return; - uint32 pMaxDurability = item ->GetUInt32Value(ITEM_FIELD_MAXDURABILITY); + uint32 pMaxDurability = item ->GetUInt32Value(ITEM_FIELD_MAXDURABILITY); if (!pMaxDurability) return; @@ -6311,7 +6434,7 @@ void Player::UpdateWeaponSkill(WeaponAttackType attType) if (GetShapeshiftForm() == FORM_TREE) return; // use weapon but not skill up - if (victim && victim->GetTypeId() == TYPEID_UNIT && (victim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_SKILLGAIN)) + if (victim && victim->GetTypeId() == TYPEID_UNIT && (victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_SKILLGAIN)) return; uint32 weapon_skill_gain = sWorld->getIntConfig(CONFIG_SKILL_GAIN_WEAPON); @@ -6631,7 +6754,7 @@ uint16 Player::GetBaseSkillValue(uint32 skill) const return 0; int32 result = int32(SKILL_VALUE(GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos)))); - result += SKILL_PERM_BONUS(GetUInt32Value(PLAYER_SKILL_BONUS_INDEX(itr->second.pos))); + result += SKILL_PERM_BONUS(GetUInt32Value(PLAYER_SKILL_BONUS_INDEX(itr->second.pos))); return result < 0 ? 0 : result; } @@ -6795,11 +6918,6 @@ bool Player::UpdatePosition(float x, float y, float z, float orientation, bool t if (GetGroup()) SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POSITION); - // code block for underwater state update - // Unit::UpdatePosition() checks for validity and updates our coordinates - // so we re-fetch them instead of using "raw" coordinates from function params - UpdateUnderwaterState(GetMap(), GetPositionX(), GetPositionY(), GetPositionZ()); - if (GetTrader() && !IsWithinDistInMap(GetTrader(), INTERACTION_DISTANCE)) GetSession()->SendCancelTrade(); @@ -6879,7 +6997,7 @@ void Player::CheckAreaExploreAndOutdoor() if (sWorld->getBoolConfig(CONFIG_VMAP_INDOOR_CHECK) && !isOutdoor) RemoveAurasWithAttribute(SPELL_ATTR0_OUTDOORS_ONLY); - if (areaFlag==0xffff) + if (areaFlag == 0xffff) return; int offset = areaFlag / 32; @@ -6898,21 +7016,23 @@ void Player::CheckAreaExploreAndOutdoor() GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA); - AreaTableEntry const* p = GetAreaEntryByAreaFlagAndMap(areaFlag, GetMapId()); - if (!p) + AreaTableEntry const* areaEntry = GetAreaEntryByAreaFlagAndMap(areaFlag, GetMapId()); + if (!areaEntry) { - sLog->outError("PLAYER: Player %u discovered unknown area (x: %f y: %f map: %u", GetGUIDLow(), GetPositionX(), GetPositionY(), GetMapId()); + sLog->outError("Player %u discovered unknown area (x: %f y: %f z: %f map: %u", GetGUIDLow(), GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId()); + return; } - else if (p->area_level > 0) + + if (areaEntry->area_level > 0) { - uint32 area = p->ID; + uint32 area = areaEntry->ID; if (getLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) { SendExplorationExperience(area, 0); } else { - int32 diff = int32(getLevel()) - p->area_level; + int32 diff = int32(getLevel()) - areaEntry->area_level; uint32 XP = 0; if (diff < -5) { @@ -6926,17 +7046,17 @@ void Player::CheckAreaExploreAndOutdoor() else if (exploration_percent < 0) exploration_percent = 0; - XP = uint32(sObjectMgr->GetBaseXP(p->area_level)*exploration_percent/100*sWorld->getRate(RATE_XP_EXPLORE)); + XP = uint32(sObjectMgr->GetBaseXP(areaEntry->area_level)*exploration_percent/100*sWorld->getRate(RATE_XP_EXPLORE)); } else { - XP = uint32(sObjectMgr->GetBaseXP(p->area_level)*sWorld->getRate(RATE_XP_EXPLORE)); + XP = uint32(sObjectMgr->GetBaseXP(areaEntry->area_level)*sWorld->getRate(RATE_XP_EXPLORE)); } GiveXP(XP, NULL); SendExplorationExperience(area, XP); } - sLog->outDetail("PLAYER: Player %u discovered a new area: %u", GetGUIDLow(), area); + sLog->outDetail("Player %u discovered a new area: %u", GetGUIDLow(), area); } } } @@ -7003,15 +7123,15 @@ int32 Player::CalculateReputationGain(uint32 creatureOrQuestLevel, int32 rep, in } //Calculates how many reputation points player gains in victim's enemy factions -void Player::RewardReputation(Unit* pVictim, float rate) +void Player::RewardReputation(Unit* victim, float rate) { - if (!pVictim || pVictim->GetTypeId() == TYPEID_PLAYER) + if (!victim || victim->GetTypeId() == TYPEID_PLAYER) return; - if (pVictim->ToCreature()->IsReputationGainDisabled()) + if (victim->ToCreature()->IsReputationGainDisabled()) return; - ReputationOnKillEntry const* Rep = sObjectMgr->GetReputationOnKilEntry(pVictim->ToCreature()->GetCreatureInfo()->Entry); + ReputationOnKillEntry const* Rep = sObjectMgr->GetReputationOnKilEntry(victim->ToCreature()->GetCreatureTemplate()->Entry); if (!Rep) return; @@ -7053,7 +7173,7 @@ void Player::RewardReputation(Unit* pVictim, float rate) if (Rep->RepFaction1 && (!Rep->TeamDependent || team == ALLIANCE)) { - int32 donerep1 = CalculateReputationGain(pVictim->getLevel(), Rep->RepValue1, ChampioningFaction ? ChampioningFaction : Rep->RepFaction1, false); + int32 donerep1 = CalculateReputationGain(victim->getLevel(), Rep->RepValue1, ChampioningFaction ? ChampioningFaction : Rep->RepFaction1, false); donerep1 = int32(donerep1*(rate + favored_rep_mult)); if (recruitAFriend) @@ -7067,7 +7187,7 @@ void Player::RewardReputation(Unit* pVictim, float rate) if (Rep->RepFaction2 && (!Rep->TeamDependent || team == HORDE)) { - int32 donerep2 = CalculateReputationGain(pVictim->getLevel(), Rep->RepValue2, ChampioningFaction ? ChampioningFaction : Rep->RepFaction2, false); + int32 donerep2 = CalculateReputationGain(victim->getLevel(), Rep->RepValue2, ChampioningFaction ? ChampioningFaction : Rep->RepFaction2, false); donerep2 = int32(donerep2*(rate + favored_rep_mult)); if (recruitAFriend) @@ -7490,10 +7610,13 @@ uint32 Player::GetGuildIdFromGuid(uint64 guid) uint8 Player::GetRankFromDB(uint64 guid) { - QueryResult result = CharacterDatabase.PQuery("SELECT rank FROM guild_member WHERE guid='%u'", GUID_LOPART(guid)); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER); + stmt->setUInt32(0, GUID_LOPART(guid)); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (result) { - uint32 v = result->Fetch()[0].GetUInt8(); + uint32 v = result->Fetch()[1].GetUInt8(); return v; } else @@ -7502,7 +7625,11 @@ uint8 Player::GetRankFromDB(uint64 guid) uint32 Player::GetArenaTeamIdFromDB(uint64 guid, uint8 type) { - QueryResult result = CharacterDatabase.PQuery("SELECT arena_team_member.arenateamid FROM arena_team_member JOIN arena_team ON arena_team_member.arenateamid = arena_team.arenateamid WHERE guid='%u' AND type='%u' LIMIT 1", GUID_LOPART(guid), type); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ARENA_TEAM_ID_BY_PLAYER_GUID); + stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt8(1, type); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (!result) return 0; @@ -7513,7 +7640,10 @@ uint32 Player::GetArenaTeamIdFromDB(uint64 guid, uint8 type) uint32 Player::GetZoneIdFromDB(uint64 guid) { uint32 guidLow = GUID_LOPART(guid); - QueryResult result = CharacterDatabase.PQuery("SELECT zone FROM characters WHERE guid='%u'", guidLow); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_ZONE); + stmt->setUInt32(0, guidLow); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (!result) return 0; Field* fields = result->Fetch(); @@ -7522,7 +7652,10 @@ uint32 Player::GetZoneIdFromDB(uint64 guid) if (!zone) { // stored zone is zero, use generic and slow zone detection - result = CharacterDatabase.PQuery("SELECT map, position_x, position_y, position_z FROM characters WHERE guid='%u'", guidLow); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_POSITION_XYZ); + stmt->setUInt32(0, guidLow); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (!result) return 0; fields = result->Fetch(); @@ -7549,7 +7682,10 @@ uint32 Player::GetZoneIdFromDB(uint64 guid) uint32 Player::GetLevelFromDB(uint64 guid) { - QueryResult result = CharacterDatabase.PQuery("SELECT level FROM characters WHERE guid='%u'", GUID_LOPART(guid)); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_LEVEL); + stmt->setUInt32(0, GUID_LOPART(guid)); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (!result) return 0; @@ -7593,17 +7729,15 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea) } // group update - if (GetGroup()) + if (Group* group = GetGroup()) { SetGroupUpdateFlag(GROUP_UPDATE_FULL); - Group* grp = GetGroup(); - if (GetSession() && grp->isLFGGroup() && sLFGMgr->IsTeleported(GetGUID())) + if (GetSession() && group->isLFGGroup() && sLFGMgr->IsTeleported(GetGUID())) { - for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { - Player* tempplr = itr->getSource(); - if (tempplr) - GetSession()->SendNameQueryOpcode(tempplr->GetGUID()); + if (Player* member = itr->getSource()) + GetSession()->SendNameQueryOpcode(member->GetGUID()); } } } @@ -7620,9 +7754,8 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea) if (sWorld->getBoolConfig(CONFIG_WEATHER)) { - Weather* wth = WeatherMgr::FindWeather(zone->ID); - if (wth) - wth->SendWeatherUpdateToPlayer(this); + if (Weather* weather = WeatherMgr::FindWeather(zone->ID)) + weather->SendWeatherUpdateToPlayer(this); else { if (!WeatherMgr::AddWeather(zone->ID)) @@ -7633,6 +7766,8 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea) } } + sScriptMgr->OnPlayerUpdateZone(this, newZone, newArea); + // in PvP, any not controlled zone (except zone->team == 6, default case) // in PvE, only opposition team capital switch (zone->team) @@ -7652,7 +7787,7 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea) break; } - if (zone->flags & AREA_FLAG_CAPITAL) // in capital city + if (zone->flags & AREA_FLAG_CAPITAL) // Is in a capital city { if (!pvpInfo.inHostileArea || zone->IsSanctuary()) { @@ -7662,19 +7797,21 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea) } pvpInfo.inNoPvPArea = true; } - else // anywhere else + else { - if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING)) // but resting (walk from city or maybe in tavern or leave tavern recently) + if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING)) { - if (GetRestType() == REST_TYPE_IN_TAVERN) // has been in tavern. Is still in? + if (GetRestType() == REST_TYPE_IN_TAVERN) // Still inside a tavern or has recently left { - if (GetMapId() != GetInnPosMapId() || sqrt((GetPositionX()-GetInnPosX())*(GetPositionX()-GetInnPosX())+(GetPositionY()-GetInnPosY())*(GetPositionY()-GetInnPosY())+(GetPositionZ()-GetInnPosZ())*(GetPositionZ()-GetInnPosZ()))>40) + // Remove rest state if we have recently left a tavern. + // Why is 40 yd hardcoded? + if (GetMapId() != GetInnPosMapId() || GetExactDist(GetInnPosX(), GetInnPosY(), GetInnPosZ()) > 40.0f) { RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING); SetRestType(REST_TYPE_NO); } } - else // not in tavern (leave city then) + else // Recently left a capital city { RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING); SetRestType(REST_TYPE_NO); @@ -8223,6 +8360,10 @@ void Player::_ApplyWeaponDependentAuraMods(Item* item, WeaponAttackType attackTy void Player::_ApplyWeaponDependentAuraCritMod(Item* item, WeaponAttackType attackType, AuraEffect const* aura, bool apply) { + // don't apply mod if item is broken or cannot be used + if (item->IsBroken() || !CanUseAttackType(attackType)) + return; + // generic not weapon specific case processes in aura code if (aura->GetSpellInfo()->EquippedItemClass == -1) return; @@ -8236,13 +8377,13 @@ void Player::_ApplyWeaponDependentAuraCritMod(Item* item, WeaponAttackType attac default: return; } - if (!item->IsBroken()&&item->IsFitToSpellRequirements(aura->GetSpellInfo())) + if (item->IsFitToSpellRequirements(aura->GetSpellInfo())) HandleBaseModValue(mod, FLAT_MOD, float (aura->GetAmount()), apply); } void Player::_ApplyWeaponDependentAuraDamageMod(Item* item, WeaponAttackType attackType, AuraEffect const* aura, bool apply) { - //don't apply mod if item is broken + // don't apply mod if item is broken or cannot be used if (item->IsBroken() || !CanUseAttackType(attackType)) return; @@ -8473,13 +8614,15 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 { uint32 enchant_id = item->GetEnchantmentId(EnchantmentSlot(e_slot)); SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); - if (!pEnchant) continue; + if (!pEnchant) + continue; + for (uint8 s = 0; s < MAX_ITEM_ENCHANTMENT_EFFECTS; ++s) { if (pEnchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL) continue; - SpellEnchantProcEntry const* entry = sSpellMgr->GetSpellEnchantProcEvent(enchant_id); + SpellEnchantProcEntry const* entry = sSpellMgr->GetSpellEnchantProcEvent(enchant_id); if (entry && entry->procEx) { @@ -8791,7 +8934,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type) if (go->getLootState() == GO_READY) { - uint32 lootid = go->GetGOInfo()->GetLootId(); + uint32 lootid = go->GetGOInfo()->GetLootId(); //TODO: fix this big hack if ((go->GetEntry() == BG_AV_OBJECTID_MINE_N || go->GetEntry() == BG_AV_OBJECTID_MINE_S)) @@ -8966,7 +9109,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type) creature->lootForPickPocketed = true; loot->clear(); - if (uint32 lootid = creature->GetCreatureInfo()->pickpocketLootId) + if (uint32 lootid = creature->GetCreatureTemplate()->pickpocketLootId) loot->FillLoot(lootid, LootTemplates_Pickpocketing, this, true); // Generate extra money for pick pocket loot @@ -9013,7 +9156,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type) if (loot_type == LOOT_SKINNING) { loot->clear(); - loot->FillLoot(creature->GetCreatureInfo()->SkinLootId, LootTemplates_Skinning, this, true); + loot->FillLoot(creature->GetCreatureTemplate()->SkinLootId, LootTemplates_Skinning, this, true); permission = OWNER_PERMISSION; } // set group rights only for loot_type != LOOT_SKINNING @@ -9179,6 +9322,9 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid) case 4100: // The Culling of Stratholme NumberOfFields = 13; break; + case 4273: // Ulduar + NumberOfFields = 10; + break; default: NumberOfFields = 12; break; @@ -9723,6 +9869,16 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid) data << uint32(3932) << uint32(0); // 13 WORLDSTATE_TIME_GUARDIAN_SHOW } break; + // Ulduar + case 4273: + if (instance && mapid == 603) + instance->FillInitialWorldStates(data); + else + { + data << uint32(4132) << uint32(0); // 9 WORLDSTATE_SHOW_CRATES + data << uint32(4131) << uint32(0); // 10 WORLDSTATE_CRATES_REVEALED + } + break; default: data << uint32(0x914) << uint32(0x0); // 7 data << uint32(0x913) << uint32(0x0); // 8 @@ -10106,7 +10262,8 @@ uint32 Player::GetItemCount(uint32 item, bool inBankAlso, Item* skipItem) const if (inBankAlso) { - for (uint8 i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; ++i) + // checking every item from 39 to 74 (including bank bags) + for (uint8 i = BANK_SLOT_ITEM_START; i < BANK_SLOT_BAG_END; ++i) if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem != skipItem && pItem->GetEntry() == item) count += pItem->GetCount(); @@ -10146,7 +10303,7 @@ uint32 Player::GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipIte if (Bag* pBag = GetBagByPos(i)) count += pBag->GetItemCountWithLimitCategory(limitCategory, skipItem); - for (int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; ++i) + for (int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_BAG_END; ++i) if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem != skipItem) if (ItemTemplate const* pProto = pItem->GetTemplate()) @@ -10172,7 +10329,7 @@ Item* Player::GetItemByGuid(uint64 guid) const if (pItem->GetGUID() == guid) return pItem; - for (int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; ++i) + for (int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_BAG_END; ++i) if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->GetGUID() == guid) return pItem; @@ -11283,7 +11440,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const Item* pItem = pItems[k]; // no item - if (!pItem) continue; + if (!pItem) + continue; sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanStoreItems %i. item = %u, count = %u", k + 1, pItem->GetEntry(), pItem->GetCount()); ItemTemplate const* pProto = pItem->GetTemplate(); @@ -11322,7 +11480,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const break; } } - if (b_found) continue; + if (b_found) + continue; for (int t = CURRENCYTOKEN_SLOT_START; t < CURRENCYTOKEN_SLOT_END; ++t) { @@ -11334,7 +11493,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const break; } } - if (b_found) continue; + if (b_found) + continue; for (int t = INVENTORY_SLOT_ITEM_START; t < INVENTORY_SLOT_ITEM_END; ++t) { @@ -11346,7 +11506,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const break; } } - if (b_found) continue; + if (b_found) + continue; for (int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t) { @@ -11367,7 +11528,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const } } } - if (b_found) continue; + if (b_found) + continue; } // special bag case @@ -11388,7 +11550,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const } } - if (b_found) continue; + if (b_found) + continue; if (pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS) { @@ -11403,7 +11566,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const } } - if (b_found) continue; + if (b_found) + continue; for (int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t) { @@ -11427,7 +11591,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const } } } - if (b_found) continue; + if (b_found) + continue; } // search free slot @@ -11441,7 +11606,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const break; } } - if (b_found) continue; + if (b_found) + continue; // search free slot in bags for (int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t) @@ -11606,8 +11772,8 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item* pItem, bool Item* offItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); ItemPosCountVec off_dest; if (offItem && (!not_loading || - CanUnequipItem(uint16(INVENTORY_SLOT_BAG_0) << 8 | EQUIPMENT_SLOT_OFFHAND, false) != EQUIP_ERR_OK || - CanStoreItem(NULL_BAG, NULL_SLOT, off_dest, offItem, false) != EQUIP_ERR_OK)) + CanUnequipItem(uint16(INVENTORY_SLOT_BAG_0) << 8 | EQUIPMENT_SLOT_OFFHAND, false) != EQUIP_ERR_OK || + CanStoreItem(NULL_BAG, NULL_SLOT, off_dest, offItem, false) != EQUIP_ERR_OK)) return swap ? EQUIP_ERR_ITEMS_CANT_BE_SWAPPED : EQUIP_ERR_INVENTORY_FULL; } } @@ -11667,7 +11833,7 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest uint32 count = pItem->GetCount(); - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanBankItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, pItem->GetEntry(), pItem->GetCount()); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanBankItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, pItem->GetEntry(), pItem->GetCount()); ItemTemplate const* pProto = pItem->GetTemplate(); if (!pProto) return swap ? EQUIP_ERR_ITEMS_CANT_BE_SWAPPED : EQUIP_ERR_ITEM_NOT_FOUND; @@ -11851,7 +12017,7 @@ InventoryResult Player::CanUseItem(Item* pItem, bool not_loading) const { if (pItem) { - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanUseItem item = %u", pItem->GetEntry()); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanUseItem item = %u", pItem->GetEntry()); if (!isAlive() && not_loading) return EQUIP_ERR_YOU_ARE_DEAD; @@ -11959,7 +12125,7 @@ InventoryResult Player::CanRollForItemInLFG(ItemTemplate const* proto, WorldObje Map const* map = lootedObject->GetMap(); if (uint32 dungeonId = sLFGMgr->GetDungeon(GetGroup()->GetGUID(), true)) if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId)) - if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == map->GetDifficulty()) + if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == uint32(map->GetDifficulty())) lootedObjectInDungeon = true; if (!lootedObjectInDungeon) @@ -12055,16 +12221,11 @@ Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update pItem->SetItemRandomProperties(randomPropertyId); pItem = StoreItem(dest, pItem, update); - const ItemTemplate* proto = pItem->GetTemplate(); - for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) - if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger - CastSpell(this, proto->Spells[i].SpellId, true, pItem); - if (allowedLooters.size() > 1 && pItem->GetTemplate()->GetMaxStackSize() == 1 && pItem->IsSoulBound()) { pItem->SetSoulboundTradeable(allowedLooters); pItem->SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, GetTotalPlayedTime()); - m_itemSoulboundTradeable.push_back(pItem); + AddTradeableItem(pItem); // save data std::ostringstream ss; @@ -12115,7 +12276,7 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool uint8 bag = pos >> 8; uint8 slot = pos & 255; - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: StoreItem bag = %u, slot = %u, item = %u, count = %u, guid = %u", bag, slot, pItem->GetEntry(), count, pItem->GetGUIDLow()); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: StoreItem bag = %u, slot = %u, item = %u, count = %u, guid = %u", bag, slot, pItem->GetEntry(), count, pItem->GetGUIDLow()); Item* pItem2 = GetItemByPos(bag, slot); @@ -12165,6 +12326,14 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool AddEnchantmentDurations(pItem); AddItemDurations(pItem); + + const ItemTemplate* proto = pItem->GetTemplate(); + for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) + if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger + if (bag == INVENTORY_SLOT_BAG_0 || (bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END)) + if (!HasAura(proto->Spells[i].SpellId)) + CastSpell(this, proto->Spells[i].SpellId, true, pItem); + return pItem; } else @@ -12201,6 +12370,13 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool pItem2->SetState(ITEM_CHANGED, this); + const ItemTemplate* proto = pItem2->GetTemplate(); + for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) + if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger + if (bag == INVENTORY_SLOT_BAG_0 || (bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END)) + if (!HasAura(proto->Spells[i].SpellId)) + CastSpell(this, proto->Spells[i].SpellId, true, pItem2); + return pItem2; } } @@ -12371,7 +12547,7 @@ void Player::VisualizeItem(uint8 slot, Item* pItem) if (pItem->GetTemplate()->Bonding == BIND_WHEN_EQUIPED || pItem->GetTemplate()->Bonding == BIND_WHEN_PICKED_UP || pItem->GetTemplate()->Bonding == BIND_QUEST_ITEM) pItem->SetBinding(true); - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: EquipItem slot = %u, item = %u", slot, pItem->GetEntry()); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: EquipItem slot = %u, item = %u", slot, pItem->GetEntry()); m_items[slot] = pItem; SetUInt64Value(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), pItem->GetGUID()); @@ -12396,7 +12572,7 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update) Item* pItem = GetItemByPos(bag, slot); if (pItem) { - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: RemoveItem bag = %u, slot = %u, item = %u", bag, slot, pItem->GetEntry()); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: RemoveItem bag = %u, slot = %u, item = %u", bag, slot, pItem->GetEntry()); RemoveEnchantmentDurations(pItem); RemoveItemDurations(pItem); @@ -12507,7 +12683,7 @@ void Player::MoveItemToInventory(ItemPosCountVec const& dest, Item* pItem, bool } if (pLastItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_BOP_TRADEABLE)) - m_itemSoulboundTradeable.push_back(pLastItem); + AddTradeableItem(pLastItem); } void Player::DestroyItem(uint8 bag, uint8 slot, bool update) @@ -12515,7 +12691,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update) Item* pItem = GetItemByPos(bag, slot); if (pItem) { - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyItem bag = %u, slot = %u, item = %u", bag, slot, pItem->GetEntry()); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyItem bag = %u, slot = %u, item = %u", bag, slot, pItem->GetEntry()); // Also remove all contained items if the item is a bag. // This if () prevents item saving crashes if the condition for a bag to be empty before being destroyed was bypassed somehow. if (pItem->IsNotEmptyBag()) @@ -12606,7 +12782,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update) void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequip_check) { - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyItemCount item = %u, count = %u", item, count); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyItemCount item = %u, count = %u", item, count); uint32 remcount = 0; // in inventory @@ -12735,7 +12911,7 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ void Player::DestroyZoneLimitedItem(bool update, uint32 new_zone) { - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyZoneLimitedItem in map %u and area %u", GetMapId(), new_zone); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyZoneLimitedItem in map %u and area %u", GetMapId(), new_zone); // in inventory for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) @@ -12767,7 +12943,7 @@ void Player::DestroyConjuredItems(bool update) { // used when entering arena // destroys all conjured items - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyConjuredItems"); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyConjuredItems"); // in inventory for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) @@ -12818,7 +12994,7 @@ void Player::DestroyItemCount(Item* pItem, uint32 &count, bool update) if (!pItem) return; - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyItemCount item (GUID: %u, Entry: %u) count = %u", pItem->GetGUIDLow(), pItem->GetEntry(), count); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyItemCount item (GUID: %u, Entry: %u) count = %u", pItem->GetGUIDLow(), pItem->GetEntry(), count); if (pItem->GetCount() <= count) { @@ -12881,7 +13057,7 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count) return; } - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: SplitItem bag = %u, slot = %u, item = %u, count = %u", dstbag, dstslot, pSrcItem->GetEntry(), count); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: SplitItem bag = %u, slot = %u, item = %u, count = %u", dstbag, dstslot, pSrcItem->GetEntry(), count); Item* pNewItem = pSrcItem->CloneItem(count, this); if (!pNewItem) { @@ -12966,7 +13142,7 @@ void Player::SwapItem(uint16 src, uint16 dst) if (!pSrcItem) return; - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: SwapItem bag = %u, slot = %u, item = %u", dstbag, dstslot, pSrcItem->GetEntry()); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: SwapItem bag = %u, slot = %u, item = %u", dstbag, dstslot, pSrcItem->GetEntry()); if (!isAlive()) { @@ -12996,7 +13172,7 @@ void Player::SwapItem(uint16 src, uint16 dst) } // prevent put equipped/bank bag in self - if (IsBagPos (src) && srcslot == dstbag) + if (IsBagPos(src) && srcslot == dstbag) { SendEquipError(EQUIP_ERR_NONEMPTY_BAG_OVER_OTHER_BAG, pSrcItem, pDstItem); return; @@ -13054,7 +13230,7 @@ void Player::SwapItem(uint16 src, uint16 dst) if (IsBankPos(src)) ItemAddedQuestCheck(pSrcItem->GetEntry(), pSrcItem->GetCount()); } - else if (IsBankPos (dst)) + else if (IsBankPos(dst)) { ItemPosCountVec dest; InventoryResult msg = CanBankItem(dstbag, dstslot, dest, pSrcItem, false); @@ -13068,7 +13244,7 @@ void Player::SwapItem(uint16 src, uint16 dst) BankItem(dest, pSrcItem, true); ItemRemovedQuestCheck(pSrcItem->GetEntry(), pSrcItem->GetCount()); } - else if (IsEquipmentPos (dst)) + else if (IsEquipmentPos(dst)) { uint16 dest; InventoryResult msg = CanEquipItem(dstslot, dest, pSrcItem, false); @@ -13094,9 +13270,9 @@ void Player::SwapItem(uint16 src, uint16 dst) uint16 eDest = 0; if (IsInventoryPos(dst)) msg = CanStoreItem(dstbag, dstslot, sDest, pSrcItem, false); - else if (IsBankPos (dst)) + else if (IsBankPos(dst)) msg = CanBankItem(dstbag, dstslot, sDest, pSrcItem, false); - else if (IsEquipmentPos (dst)) + else if (IsEquipmentPos(dst)) msg = CanEquipItem(dstslot, eDest, pSrcItem, false); else return; @@ -13110,9 +13286,9 @@ void Player::SwapItem(uint16 src, uint16 dst) if (IsInventoryPos(dst)) StoreItem(sDest, pSrcItem, true); - else if (IsBankPos (dst)) + else if (IsBankPos(dst)) BankItem(sDest, pSrcItem, true); - else if (IsEquipmentPos (dst)) + else if (IsEquipmentPos(dst)) { EquipItem(eDest, pSrcItem, true); AutoUnequipOffhandIfNeed(); @@ -13342,7 +13518,7 @@ void Player::AddItemToBuyBackSlot(Item* pItem) } RemoveItemFromBuyBackSlot(slot, true); - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: AddItemToBuyBackSlot item = %u, slot = %u", pItem->GetEntry(), slot); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: AddItemToBuyBackSlot item = %u, slot = %u", pItem->GetEntry(), slot); m_items[slot] = pItem; time_t base = time(NULL); @@ -13350,8 +13526,8 @@ void Player::AddItemToBuyBackSlot(Item* pItem) uint32 eslot = slot - BUYBACK_SLOT_START; SetUInt64Value(PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + (eslot * 2), pItem->GetGUID()); - if (ItemTemplate const* pProto = pItem->GetTemplate()) - SetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, pProto->SellPrice * pItem->GetCount()); + if (ItemTemplate const* proto = pItem->GetTemplate()) + SetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, proto->SellPrice * pItem->GetCount()); else SetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, 0); SetUInt32Value(PLAYER_FIELD_BUYBACK_TIMESTAMP_1 + eslot, (uint32)etime); @@ -13364,7 +13540,7 @@ void Player::AddItemToBuyBackSlot(Item* pItem) Item* Player::GetItemFromBuyBackSlot(uint32 slot) { - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: GetItemFromBuyBackSlot slot = %u", slot); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: GetItemFromBuyBackSlot slot = %u", slot); if (slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END) return m_items[slot]; return NULL; @@ -13372,7 +13548,7 @@ Item* Player::GetItemFromBuyBackSlot(uint32 slot) void Player::RemoveItemFromBuyBackSlot(uint32 slot, bool del) { - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: RemoveItemFromBuyBackSlot slot = %u", slot); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: RemoveItemFromBuyBackSlot slot = %u", slot); if (slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END) { Item* pItem = m_items[slot]; @@ -13504,6 +13680,11 @@ void Player::UpdateSoulboundTradeItems() } } +void Player::AddTradeableItem(Item* item) +{ + m_itemSoulboundTradeable.push_back(item); +} + //TODO: should never allow an item to be added to m_itemSoulboundTradeable twice void Player::RemoveTradeableItem(Item* item) { @@ -14129,12 +14310,10 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool menuItemBounds = sObjectMgr->GetGossipMenuItemsMapBounds(0); uint32 npcflags = 0; - Creature* creature = NULL; if (source->GetTypeId() == TYPEID_UNIT) { - creature = source->ToCreature(); - npcflags = creature->GetUInt32Value(UNIT_NPC_FLAGS); + npcflags = source->GetUInt32Value(UNIT_NPC_FLAGS); if (npcflags & UNIT_NPC_FLAG_QUESTGIVER && showQuests) PrepareQuestMenu(source->GetGUID()); } @@ -14149,7 +14328,7 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool if (!sConditionMgr->IsObjectMeetToConditions(this, source, itr->second.Conditions)) continue; - if (source->GetTypeId() == TYPEID_UNIT) + if (Creature* creature = source->ToCreature()) { if (!(itr->second.OptionNpcflag & npcflags)) continue; @@ -14186,7 +14365,7 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool canTalk = false; break; case GOSSIP_OPTION_UNLEARNPETTALENTS: - if (!GetPet() || GetPet()->getPetType() != HUNTER_PET || GetPet()->m_spells.size() <= 1 || creature->GetCreatureInfo()->trainer_type != TRAINER_TYPE_PETS || creature->GetCreatureInfo()->trainer_class != CLASS_HUNTER) + if (!GetPet() || GetPet()->getPetType() != HUNTER_PET || GetPet()->m_spells.size() <= 1 || creature->GetCreatureTemplate()->trainer_type != TRAINER_TYPE_PETS || creature->GetCreatureTemplate()->trainer_class != CLASS_HUNTER) canTalk = false; break; case GOSSIP_OPTION_TAXIVENDOR: @@ -14222,10 +14401,8 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool break; } } - else if (source->GetTypeId() == TYPEID_GAMEOBJECT) + else if (GameObject* go = source->ToGameObject()) { - GameObject* go = source->ToGameObject(); - switch (itr->second.OptionType) { case GOSSIP_OPTION_GOSSIP: @@ -14335,15 +14512,15 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men { case GOSSIP_OPTION_GOSSIP: { + if (menuItemData->GossipActionPoi) + PlayerTalkClass->SendPointOfInterest(menuItemData->GossipActionPoi); + if (menuItemData->GossipActionMenuId) { PrepareGossipMenu(source, menuItemData->GossipActionMenuId); SendPreparedGossip(source); } - if (menuItemData->GossipActionPoi) - PlayerTalkClass->SendPointOfInterest(menuItemData->GossipActionPoi); - break; } case GOSSIP_OPTION_OUTDOORPVP: @@ -14422,7 +14599,7 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men return; } - GetSession()->SendBattlegGroundList(guid, bgTypeId); + GetSession()->SendBattleGroundList(guid, bgTypeId); break; } } @@ -14461,7 +14638,7 @@ uint32 Player::GetDefaultGossipMenuForSource(WorldObject* source) switch (source->GetTypeId()) { case TYPEID_UNIT: - return source->ToCreature()->GetCreatureInfo()->GossipMenuId; + return source->ToCreature()->GetCreatureTemplate()->GossipMenuId; case TYPEID_GAMEOBJECT: return source->ToGameObject()->GetGOInfo()->GetGossipMenuId(); default: @@ -14477,15 +14654,15 @@ uint32 Player::GetDefaultGossipMenuForSource(WorldObject* source) void Player::PrepareQuestMenu(uint64 guid) { - QuestRelationBounds pObjectQR; - QuestRelationBounds pObjectQIR; + QuestRelationBounds objectQR; + QuestRelationBounds objectQIR; // pets also can have quests Creature* creature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid); if (creature) { - pObjectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry()); - pObjectQIR = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(creature->GetEntry()); + objectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry()); + objectQIR = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(creature->GetEntry()); } else { @@ -14496,8 +14673,8 @@ void Player::PrepareQuestMenu(uint64 guid) GameObject* pGameObject = _map->GetGameObject(guid); if (pGameObject) { - pObjectQR = sObjectMgr->GetGOQuestRelationBounds(pGameObject->GetEntry()); - pObjectQIR = sObjectMgr->GetGOQuestInvolvedRelationBounds(pGameObject->GetEntry()); + objectQR = sObjectMgr->GetGOQuestRelationBounds(pGameObject->GetEntry()); + objectQIR = sObjectMgr->GetGOQuestInvolvedRelationBounds(pGameObject->GetEntry()); } else return; @@ -14506,7 +14683,7 @@ void Player::PrepareQuestMenu(uint64 guid) QuestMenu &qm = PlayerTalkClass->GetQuestMenu(); qm.ClearMenu(); - for (QuestRelations::const_iterator i = pObjectQIR.first; i != pObjectQIR.second; ++i) + for (QuestRelations::const_iterator i = objectQIR.first; i != objectQIR.second; ++i) { uint32 quest_id = i->second; QuestStatus status = GetQuestStatus(quest_id); @@ -14518,7 +14695,7 @@ void Player::PrepareQuestMenu(uint64 guid) // qm.AddMenuItem(quest_id, 2); } - for (QuestRelations::const_iterator i = pObjectQR.first; i != pObjectQR.second; ++i) + for (QuestRelations::const_iterator i = objectQR.first; i != objectQR.second; ++i) { uint32 quest_id = i->second; Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id); @@ -14638,11 +14815,11 @@ bool Player::IsActiveQuest(uint32 quest_id) const Quest const* Player::GetNextQuest(uint64 guid, Quest const* quest) { - QuestRelationBounds pObjectQR; + QuestRelationBounds objectQR; Creature* creature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid); if (creature) - pObjectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry()); + objectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry()); else { //we should obtain map pointer from GetMap() in 99% of cases. Special case @@ -14651,13 +14828,13 @@ Quest const* Player::GetNextQuest(uint64 guid, Quest const* quest) ASSERT(_map); GameObject* pGameObject = _map->GetGameObject(guid); if (pGameObject) - pObjectQR = sObjectMgr->GetGOQuestRelationBounds(pGameObject->GetEntry()); + objectQR = sObjectMgr->GetGOQuestRelationBounds(pGameObject->GetEntry()); else return NULL; } uint32 nextQuestID = quest->GetNextQuestInChain(); - for (QuestRelations::const_iterator itr = pObjectQR.first; itr != pObjectQR.second; ++itr) + for (QuestRelations::const_iterator itr = objectQR.first; itr != objectQR.second; ++itr) { if (itr->second == nextQuestID) return sObjectMgr->GetQuestTemplate(nextQuestID); @@ -16057,9 +16234,9 @@ void Player::CastedCreatureOrGO(uint32 entry, uint64 guid, uint32 spell_id) if (reqTarget != entry) // if entry doesn't match, check for killcredits referenced in template { CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry); - for (uint8 j = 0; j < MAX_KILL_CREDIT; ++j) - if (cinfo->KillCredit[j] == reqTarget) - entry = cinfo->KillCredit[j]; + for (uint8 k = 0; k < MAX_KILL_CREDIT; ++k) + if (cinfo->KillCredit[k] == reqTarget) + entry = cinfo->KillCredit[k]; } } } @@ -16568,7 +16745,7 @@ void Player::_LoadEquipmentSets(PreparedQueryResult result) EquipmentSet eqSet; eqSet.Guid = fields[0].GetUInt64(); - uint32 index = fields[1].GetUInt32(); + uint8 index = fields[1].GetUInt8(); eqSet.Name = fields[2].GetString(); eqSet.IconName = fields[3].GetString(); eqSet.state = EQUIPMENT_SET_UNCHANGED; @@ -16610,7 +16787,10 @@ void Player::_LoadBGData(PreparedQueryResult result) bool Player::LoadPositionFromDB(uint32& mapid, float& x, float& y, float& z, float& o, bool& in_flight, uint64 guid) { - QueryResult result = CharacterDatabase.PQuery("SELECT position_x, position_y, position_z, orientation, map, taxi_path FROM characters WHERE guid = '%u'", GUID_LOPART(guid)); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_POSITION); + stmt->setUInt32(0, GUID_LOPART(guid)); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (!result) return false; @@ -16790,12 +16970,12 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) InitPrimaryProfessions(); // to max set before any spell loaded // init saved position, and fix it later if problematic - uint32 transGUID = uint32(fields[31].GetUInt64()); // field type is uint64 but lowguid is saved + uint32 transGUID = uint32(fields[31].GetUInt32()); Relocate(fields[12].GetFloat(), fields[13].GetFloat(), fields[14].GetFloat(), fields[16].GetFloat()); uint32 mapId = fields[15].GetUInt16(); - uint32 instanceId = fields[54].GetUInt8(); + uint32 instanceId = fields[54].GetUInt32(); - uint32 dungeonDiff = fields[39].GetUInt32() & 0x0F; + uint32 dungeonDiff = fields[39].GetUInt8() & 0x0F; if (dungeonDiff >= MAX_DUNGEON_DIFFICULTY) dungeonDiff = DUNGEON_DIFFICULTY_NORMAL; uint32 raidDiff = (fields[39].GetUInt8() >> 4) & 0x0F; @@ -17137,7 +17317,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) float bubble0 = 0.031f; //speed collect rest bonus in offline, in logout, in tavern, city (section/in hour) float bubble1 = 0.125f; - float bubble = fields[23].GetUInt32() > 0 + float bubble = fields[23].GetUInt8() > 0 ? bubble1*sWorld->getRate(RATE_REST_OFFLINE_IN_TAVERN_OR_CITY) : bubble0*sWorld->getRate(RATE_REST_OFFLINE_IN_WILDERNESS); @@ -17299,7 +17479,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) } // RaF stuff. - m_grantableLevels = fields[61].GetUInt32(); + m_grantableLevels = fields[61].GetUInt8(); if (GetSession()->IsARecruiter() || (GetSession()->GetRecruiterId() != 0)) SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_REFER_A_FRIEND); @@ -17523,6 +17703,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) uint32 zoneId = GetZoneId(); std::map<uint64, Bag*> bagMap; // fast guid lookup for bags + std::map<uint64, Item*> invalidBagMap; // fast guid lookup for bags std::list<Item*> problematicItems; SQLTransaction trans = CharacterDatabase.BeginTransaction(); @@ -17567,9 +17748,15 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) // Remember bags that may contain items in them if (err == EQUIP_ERR_OK) + { if (IsBagPos(item->GetPos())) if (Bag* pBag = item->ToBag()) bagMap[item->GetGUIDLow()] = pBag; + } + else + if (IsBagPos(item->GetPos())) + if (item->IsBag()) + invalidBagMap[item->GetGUIDLow()] = item; } else { @@ -17581,8 +17768,23 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) ItemPosCountVec dest; err = CanStoreItem(itr->second->GetSlot(), slot, dest, item); if (err == EQUIP_ERR_OK) - itr->second->StoreItem(slot, item, true); + item = StoreItem(dest, item, true); + } + else if (invalidBagMap.find(bagGuid) != invalidBagMap.end()) + { + std::map<uint64, Item*>::iterator itr = invalidBagMap.find(bagGuid); + if (std::find(problematicItems.begin(),problematicItems.end(),itr->second) != problematicItems.end()) + err = EQUIP_ERR_INT_BAG_ERROR; + } + else + { + sLog->outError("Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) which doesnt have a valid bag (Bag GUID: %u, slot: %u). Possible cheat?", + GetGUIDLow(), GetName(), item->GetGUIDLow(), item->GetEntry(), bagGuid, slot); + item->DeleteFromInventoryDB(trans); + delete item; + continue; } + } // Item's state may have changed after storing @@ -17621,6 +17823,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, Field* fields) { + PreparedStatement* stmt = NULL; Item* item = NULL; uint32 itemGuid = fields[13].GetUInt32(); uint32 itemEntry = fields[14].GetUInt32(); @@ -17650,7 +17853,11 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F { sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) with expired refund time (%u). Deleting refund data and removing refundable flag.", GetGUIDLow(), GetName(), item->GetGUIDLow(), item->GetEntry(), item->GetPlayedTime()); - trans->PAppend("DELETE FROM item_refund_instance WHERE item_guid = '%u'", item->GetGUIDLow()); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_REFUND_INSTANCE); + stmt->setUInt32(0, item->GetGUIDLow()); + trans->Append(stmt); + item->RemoveFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_REFUNDABLE); } else @@ -17685,7 +17892,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F for (Tokens::iterator itr = GUIDlist.begin(); itr != GUIDlist.end(); ++itr) looters.insert(atol(*itr)); item->SetSoulboundTradeable(looters); - m_itemSoulboundTradeable.push_back(item); + AddTradeableItem(item); } else { @@ -17701,7 +17908,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F GameEventMgr::ActiveEvents const& activeEventsList = sGameEventMgr->GetActiveEventList(); for (GameEventMgr::ActiveEvents::const_iterator itr = activeEventsList.begin(); itr != activeEventsList.end(); ++itr) { - if (events[*itr].holiday_id == proto->HolidayId) + if (uint32(events[*itr].holiday_id) == proto->HolidayId) { remove = false; break; @@ -17759,7 +17966,7 @@ void Player::_LoadMailedItems(Mail* mail) { sLog->outError("Player %u has unknown item_template (ProtoType) in mailed items(GUID: %u template: %u) in mail (%u), deleted.", GetGUIDLow(), itemGuid, itemTemplate, mail->messageID); - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_MAIL_ITEM); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_MAIL_ITEM); stmt->setUInt32(0, itemGuid); CharacterDatabase.Execute(stmt); @@ -17775,10 +17982,8 @@ void Player::_LoadMailedItems(Mail* mail) { sLog->outError("Player::_LoadMailedItems - Item in mail (%u) doesn't exist !!!! - item guid: %u, deleted from mail", mail->messageID, itemGuid); - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM); - + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM); stmt->setUInt32(0, itemGuid); - CharacterDatabase.Execute(stmt); item->FSetState(ITEM_REMOVED); @@ -17798,38 +18003,42 @@ void Player::_LoadMailInit(PreparedQueryResult resultUnread, PreparedQueryResult //set a count of unread mails //QueryResult* resultMails = CharacterDatabase.PQuery("SELECT COUNT(id) FROM mail WHERE receiver = '%u' AND (checked & 1)=0 AND deliver_time <= '" UI64FMTD "'", GUID_LOPART(playerGuid), (uint64)cTime); if (resultUnread) - unReadMails = (*resultUnread)[0].GetUInt8(); + unReadMails = uint8((*resultUnread)[0].GetUInt64()); // store nearest delivery time (it > 0 and if it < current then at next player update SendNewMaill will be called) //resultMails = CharacterDatabase.PQuery("SELECT MIN(deliver_time) FROM mail WHERE receiver = '%u' AND (checked & 1)=0", GUID_LOPART(playerGuid)); if (resultDelivery) - m_nextMailDelivereTime = (time_t)(*resultDelivery)[0].GetUInt64(); + m_nextMailDelivereTime = time_t((*resultDelivery)[0].GetUInt32()); } void Player::_LoadMail() { m_mail.clear(); - //mails are in right order 0 1 2 3 4 5 6 7 8 9 10 11 12 13 - QueryResult result = CharacterDatabase.PQuery("SELECT id, messageType, sender, receiver, subject, body, has_items, expire_time, deliver_time, money, cod, checked, stationery, mailTemplateId FROM mail WHERE receiver = '%u' ORDER BY id DESC", GetGUIDLow()); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL); + stmt->setUInt32(0, GetGUIDLow()); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (result) { do { Field* fields = result->Fetch(); Mail* m = new Mail; - m->messageID = fields[0].GetUInt32(); - m->messageType = fields[1].GetUInt8(); - m->sender = fields[2].GetUInt32(); - m->receiver = fields[3].GetUInt32(); - m->subject = fields[4].GetString(); - m->body = fields[5].GetString(); - bool has_items = fields[6].GetBool(); - m->expire_time = time_t(fields[7].GetUInt32()); - m->deliver_time = time_t(fields[8].GetUInt32()); - m->money = fields[9].GetUInt32(); - m->COD = fields[10].GetUInt32(); - m->checked = fields[11].GetUInt32(); - m->stationery = fields[12].GetUInt8(); + + m->messageID = fields[0].GetUInt32(); + m->messageType = fields[1].GetUInt8(); + m->sender = fields[2].GetUInt32(); + m->receiver = fields[3].GetUInt32(); + m->subject = fields[4].GetString(); + m->body = fields[5].GetString(); + bool has_items = fields[6].GetBool(); + m->expire_time = time_t(fields[7].GetUInt32()); + m->deliver_time = time_t(fields[8].GetUInt32()); + m->money = fields[9].GetUInt32(); + m->COD = fields[10].GetUInt32(); + m->checked = fields[11].GetUInt8(); + m->stationery = fields[12].GetUInt8(); m->mailTemplateId = fields[13].GetInt16(); if (m->mailTemplateId && !sMailTemplateStore.LookupEntry(m->mailTemplateId)) @@ -17891,7 +18100,8 @@ void Player::_LoadQuestStatus(PreparedQueryResult result) else { questStatusData.Status = QUEST_STATUS_INCOMPLETE; - sLog->outError("Player %s have invalid quest %d status (%u), replaced by QUEST_STATUS_INCOMPLETE(3).", GetName(), quest_id, qstatus); + sLog->outError("Player %s (GUID: %u) has invalid quest %d status (%u), replaced by QUEST_STATUS_INCOMPLETE(3).", + GetName(), GetGUIDLow(), quest_id, qstatus); } questStatusData.Explored = (fields[2].GetUInt8() > 0); @@ -18021,7 +18231,7 @@ void Player::_LoadDailyQuestStatus(PreparedQueryResult result) uint32 quest_id = fields[0].GetUInt32(); // save _any_ from daily quest times (it must be after last reset anyway) - m_lastDailyQuestTime = (time_t)fields[1].GetUInt64(); + m_lastDailyQuestTime = time_t(fields[1].GetUInt32()); Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id); if (!quest) @@ -18170,7 +18380,7 @@ void Player::_LoadBoundInstances(PreparedQueryResult result) if (deleteInstance) { - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE_BY_INSTANCE_GUID); stmt->setUInt32(0, GetGUIDLow()); stmt->setUInt32(1, instanceId); @@ -18226,7 +18436,7 @@ void Player::UnbindInstance(BoundInstancesMap::iterator &itr, Difficulty difficu { if (!unload) { - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE_BY_INSTANCE_GUID); stmt->setUInt32(0, GetGUIDLow()); stmt->setUInt32(1, itr->second.save->GetInstanceId()); @@ -18234,6 +18444,9 @@ void Player::UnbindInstance(BoundInstancesMap::iterator &itr, Difficulty difficu CharacterDatabase.Execute(stmt); } + if (itr->second.perm) + GetSession()->SendCalendarRaidLockout(itr->second.save, false); + itr->second.save->RemovePlayer(this); // save can become invalid m_boundInstances[difficulty].erase(itr++); } @@ -18303,6 +18516,8 @@ void Player::BindToInstance() data << uint32(0); GetSession()->SendPacket(&data); BindToInstance(mapSave, true); + + GetSession()->SendCalendarRaidLockout(mapSave, true); } void Player::SendRaidInfo() @@ -18583,7 +18798,7 @@ void Player::SaveToDB(bool create /*=false*/) outDebugValues(); PreparedStatement* stmt = NULL; - uint16 index = 0; + uint8 index = 0; if (create) { @@ -18632,7 +18847,7 @@ void Player::SaveToDB(bool create /*=false*/) stmt->setUInt8(index++, m_stableSlots); stmt->setUInt16(index++, (uint16)m_atLoginFlags); stmt->setUInt16(index++, GetZoneId()); - stmt->setUInt32(index++, m_deathExpireTime); + stmt->setUInt32(index++, uint32(m_deathExpireTime)); ss.str(""); ss << m_taxi.SaveTaxiDestinationsToString(); @@ -18743,7 +18958,7 @@ void Player::SaveToDB(bool create /*=false*/) stmt->setUInt8(index++, m_stableSlots); stmt->setUInt16(index++, (uint16)m_atLoginFlags); stmt->setUInt16(index++, GetZoneId()); - stmt->setUInt32(index++, m_deathExpireTime); + stmt->setUInt32(index++, uint32(m_deathExpireTime)); ss.str(""); ss << m_taxi.SaveTaxiDestinationsToString(); @@ -18849,29 +19064,51 @@ void Player::SaveInventoryAndGoldToDB(SQLTransaction& trans) void Player::SaveGoldToDB(SQLTransaction& trans) { - trans->PAppend("UPDATE characters SET money = '%u' WHERE guid = '%u'", GetMoney(), GetGUIDLow()); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_MONEY); + stmt->setUInt32(0, GetMoney()); + stmt->setUInt32(1, GetGUIDLow()); + trans->Append(stmt); } void Player::_SaveActions(SQLTransaction& trans) { + PreparedStatement* stmt = NULL; + for (ActionButtonList::iterator itr = m_actionButtons.begin(); itr != m_actionButtons.end();) { switch (itr->second.uState) { case ACTIONBUTTON_NEW: - trans->PAppend("INSERT INTO character_action (guid, spec, button, action, type) VALUES ('%u', '%u', '%u', '%u', '%u')", - GetGUIDLow(), GetActiveSpec(), (uint32)itr->first, (uint32)itr->second.GetAction(), (uint32)itr->second.GetType()); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_ACTION); + stmt->setUInt32(0, GetGUIDLow()); + stmt->setUInt8(1, m_activeSpec); + stmt->setUInt8(2, itr->first); + stmt->setUInt32(3, itr->second.GetAction()); + stmt->setUInt8(4, uint8(itr->second.GetType())); + trans->Append(stmt); + itr->second.uState = ACTIONBUTTON_UNCHANGED; ++itr; break; case ACTIONBUTTON_CHANGED: - trans->PAppend("UPDATE character_action SET action = '%u', type = '%u' WHERE guid = '%u' AND button = '%u' AND spec = '%u'", - (uint32)itr->second.GetAction(), (uint32)itr->second.GetType(), GetGUIDLow(), (uint32)itr->first, GetActiveSpec()); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_ACTION); + stmt->setUInt32(0, itr->second.GetAction()); + stmt->setUInt8(1, uint8(itr->second.GetType())); + stmt->setUInt32(2, GetGUIDLow()); + stmt->setUInt8(3, itr->first); + stmt->setUInt8(4, m_activeSpec); + trans->Append(stmt); + itr->second.uState = ACTIONBUTTON_UNCHANGED; ++itr; break; case ACTIONBUTTON_DELETED: - trans->PAppend("DELETE FROM character_action WHERE guid = '%u' and button = '%u' and spec = '%u'", GetGUIDLow(), (uint32)itr->first, GetActiveSpec()); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACTION_BY_BUTTON_SPEC); + stmt->setUInt32(0, GetGUIDLow()); + stmt->setUInt8(1, itr->first); + stmt->setUInt8(2, m_activeSpec); + trans->Append(stmt); + m_actionButtons.erase(itr++); break; default: @@ -18883,11 +19120,11 @@ void Player::_SaveActions(SQLTransaction& trans) void Player::_SaveAuras(SQLTransaction& trans) { - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_AURA); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA); stmt->setUInt32(0, GetGUIDLow()); trans->Append(stmt); - for (AuraMap::const_iterator itr = m_ownedAuras.begin(); itr != m_ownedAuras.end() ; ++itr) + for (AuraMap::const_iterator itr = m_ownedAuras.begin(); itr != m_ownedAuras.end(); ++itr) { if (!itr->second->CanBeSaved()) continue; @@ -18939,6 +19176,7 @@ void Player::_SaveAuras(SQLTransaction& trans) void Player::_SaveInventory(SQLTransaction& trans) { + PreparedStatement* stmt = NULL; // force items in buyback slots to new state // and remove those that aren't already for (uint8 i = BUYBACK_SLOT_START; i < BUYBACK_SLOT_END; ++i) @@ -18946,8 +19184,12 @@ void Player::_SaveInventory(SQLTransaction& trans) Item* item = m_items[i]; if (!item || item->GetState() == ITEM_NEW) continue; - trans->PAppend("DELETE FROM character_inventory WHERE item = '%u'", item->GetGUIDLow()); - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_ITEM); + stmt->setUInt32(0, item->GetGUIDLow()); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE); stmt->setUInt32(0, item->GetGUIDLow()); trans->Append(stmt); m_items[i]->FSetState(ITEM_NEW); @@ -19005,7 +19247,12 @@ void Player::_SaveInventory(SQLTransaction& trans) bagTestGUID = test2->GetGUIDLow(); sLog->outError("Player(GUID: %u Name: %s)::_SaveInventory - the bag(%u) and slot(%u) values for the item with guid %u (state %d) are incorrect, the player doesn't have an item at that position!", lowGuid, GetName(), item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), (int32)item->GetState()); // according to the test that was just performed nothing should be in this slot, delete - trans->PAppend("DELETE FROM character_inventory WHERE bag=%u AND slot=%u AND guid=%u", bagTestGUID, item->GetSlot(), lowGuid); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_BAG_SLOT); + stmt->setUInt32(0, bagTestGUID); + stmt->setUInt8(1, item->GetSlot()); + stmt->setUInt32(2, lowGuid); + trans->Append(stmt); + // also THIS item should be somewhere else, cheat attempt item->FSetState(ITEM_REMOVED); // we are IN updateQueue right now, can't use SetState which modifies the queue DeleteRefundReference(item->GetGUIDLow()); @@ -19036,7 +19283,7 @@ void Player::_SaveInventory(SQLTransaction& trans) trans->Append(stmt); break; case ITEM_REMOVED: - stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVENTORY_ITEM); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_ITEM); stmt->setUInt32(0, item->GetGUIDLow()); trans->Append(stmt); case ITEM_UNCHANGED: @@ -19053,17 +19300,32 @@ void Player::_SaveMail(SQLTransaction& trans) if (!m_mailsLoaded) return; + PreparedStatement* stmt = NULL; + for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr) { Mail* m = (*itr); if (m->state == MAIL_STATE_CHANGED) { - trans->PAppend("UPDATE mail SET has_items = '%u', expire_time = '" UI64FMTD "', deliver_time = '" UI64FMTD "', money = '%u', cod = '%u', checked = '%u' WHERE id = '%u'", - m->HasItems() ? 1 : 0, (uint64)m->expire_time, (uint64)m->deliver_time, m->money, m->COD, m->checked, m->messageID); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_MAIL); + stmt->setUInt8(0, uint8(m->HasItems() ? 1 : 0)); + stmt->setUInt32(1, uint32(m->expire_time)); + stmt->setUInt32(2, uint32(m->deliver_time)); + stmt->setUInt32(3, m->money); + stmt->setUInt32(4, m->COD); + stmt->setUInt8(5, uint8(m->checked)); + stmt->setUInt32(6, m->messageID); + + trans->Append(stmt); + if (!m->removedItems.empty()) { for (std::vector<uint32>::iterator itr2 = m->removedItems.begin(); itr2 != m->removedItems.end(); ++itr2) - trans->PAppend("DELETE FROM mail_items WHERE item_guid = '%u'", *itr2); + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM); + stmt->setUInt32(0, *itr2); + trans->Append(stmt); + } m->removedItems.clear(); } m->state = MAIL_STATE_UNCHANGED; @@ -19080,8 +19342,13 @@ void Player::_SaveMail(SQLTransaction& trans) trans->Append(stmt); } } - trans->PAppend("DELETE FROM mail WHERE id = '%u'", m->messageID); - trans->PAppend("DELETE FROM mail_items WHERE mail_id = '%u'", m->messageID); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_BY_ID); + stmt->setUInt32(0, m->messageID); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM_BY_ID); + stmt->setUInt32(0, m->messageID); + trans->Append(stmt); } } @@ -19110,6 +19377,7 @@ void Player::_SaveQuestStatus(SQLTransaction& trans) QuestStatusSaveMap::iterator saveItr; QuestStatusMap::iterator statusItr; + PreparedStatement* stmt = NULL; bool keepAbandoned = !(sWorld->GetCleaningFlags() & CharacterDatabaseCleaner::CLEANING_FLAG_QUESTSTATUS); @@ -19119,12 +19387,33 @@ void Player::_SaveQuestStatus(SQLTransaction& trans) { statusItr = m_QuestStatus.find(saveItr->first); if (statusItr != m_QuestStatus.end() && (keepAbandoned || statusItr->second.Status != QUEST_STATUS_NONE)) - trans->PAppend("REPLACE INTO character_queststatus (guid, quest, status, explored, timer, mobcount1, mobcount2, mobcount3, mobcount4, itemcount1, itemcount2, itemcount3, itemcount4, playercount) " - "VALUES ('%u', '%u', '%u', '%u', '" UI64FMTD "', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u')", - GetGUIDLow(), statusItr->first, statusItr->second.Status, statusItr->second.Explored, uint64(statusItr->second.Timer / IN_MILLISECONDS+ sWorld->GetGameTime()), statusItr->second.CreatureOrGOCount[0], statusItr->second.CreatureOrGOCount[1], statusItr->second.CreatureOrGOCount[2], statusItr->second.CreatureOrGOCount[3], statusItr->second.ItemCount[0], statusItr->second.ItemCount[1], statusItr->second.ItemCount[2], statusItr->second.ItemCount[3], statusItr->second.PlayerCount); + { + uint8 index = 0; + stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CHAR_QUESTSTATUS); + + stmt->setUInt32(index++, GetGUIDLow()); + stmt->setUInt32(index++, statusItr->first); + stmt->setUInt8(index++, uint8(statusItr->second.Status)); + stmt->setBool(index++, statusItr->second.Explored); + stmt->setUInt32(index++, uint32(statusItr->second.Timer / IN_MILLISECONDS+ sWorld->GetGameTime())); + + for (uint8 i = 0; i < 4; i++) + stmt->setUInt16(index++, statusItr->second.CreatureOrGOCount[i]); + + for (uint8 i = 0; i < 4; i++) + stmt->setUInt16(index++, statusItr->second.ItemCount[i]); + + stmt->setUInt16(index, statusItr->second.PlayerCount); + trans->Append(stmt); + } } else - trans->PAppend("DELETE FROM character_queststatus WHERE guid = %u AND quest = %u", GetGUIDLow(), saveItr->first); + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS_BY_QUEST); + stmt->setUInt32(0, GetGUIDLow()); + stmt->setUInt32(1, saveItr->first); + trans->Append(stmt); + } } m_QuestStatusSave.clear(); @@ -19132,9 +19421,20 @@ void Player::_SaveQuestStatus(SQLTransaction& trans) for (saveItr = m_RewardedQuestsSave.begin(); saveItr != m_RewardedQuestsSave.end(); ++saveItr) { if (saveItr->second) - trans->PAppend("INSERT IGNORE INTO character_queststatus_rewarded (guid, quest) VALUES (%u, %u)", GetGUIDLow(), saveItr->first); + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_QUESTSTATUS); + stmt->setUInt32(0, GetGUIDLow()); + stmt->setUInt32(1, saveItr->first); + trans->Append(stmt); + + } else if (!keepAbandoned) - trans->PAppend("DELETE FROM character_queststatus_rewarded WHERE guid = %u AND quest = %u", GetGUIDLow(), saveItr->first); + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS_REWARDED_BY_QUEST); + stmt->setUInt32(0, GetGUIDLow()); + stmt->setUInt32(1, saveItr->first); + trans->Append(stmt); + } } m_RewardedQuestsSave.clear(); @@ -19157,20 +19457,22 @@ void Player::_SaveDailyQuestStatus(SQLTransaction& trans) stmt->setUInt32(0, GetGUIDLow()); trans->Append(stmt); for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx) + { if (GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx)) { - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_DAILYQUESTSTATUS); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_DAILYQUESTSTATUS); stmt->setUInt32(0, GetGUIDLow()); stmt->setUInt32(1, GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx)); stmt->setUInt64(2, uint64(m_lastDailyQuestTime)); trans->Append(stmt); } + } if (!m_DFQuests.empty()) { for (DFQuestsDoneList::iterator itr = m_DFQuests.begin(); itr != m_DFQuests.end(); ++itr) { - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_DAILYQUESTSTATUS); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_DAILYQUESTSTATUS); stmt->setUInt32(0, GetGUIDLow()); stmt->setUInt32(1, (*itr)); stmt->setUInt64(2, uint64(m_lastDailyQuestTime)); @@ -19193,7 +19495,7 @@ void Player::_SaveWeeklyQuestStatus(SQLTransaction& trans) { uint32 quest_id = *iter; - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_WEEKLYQUESTSTATUS); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_WEEKLYQUESTSTATUS); stmt->setUInt32(0, GetGUIDLow()); stmt->setUInt32(1, quest_id); trans->Append(stmt); @@ -19219,7 +19521,7 @@ void Player::_SaveSeasonalQuestStatus(SQLTransaction& trans) { uint32 quest_id = (*itr); - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_SEASONALQUESTSTATUS); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_SEASONALQUESTSTATUS); stmt->setUInt32(0, GetGUIDLow()); stmt->setUInt32(1, quest_id); stmt->setUInt32(2, event_id); @@ -19232,6 +19534,7 @@ void Player::_SaveSeasonalQuestStatus(SQLTransaction& trans) void Player::_SaveSkills(SQLTransaction& trans) { + PreparedStatement* stmt = NULL; // we don't need transactions here. for (SkillStatusMap::iterator itr = mSkillStatus.begin(); itr != mSkillStatus.end();) { @@ -19243,7 +19546,11 @@ void Player::_SaveSkills(SQLTransaction& trans) if (itr->second.uState == SKILL_DELETED) { - trans->PAppend("DELETE FROM character_skills WHERE guid = '%u' AND skill = '%u' ", GetGUIDLow(), itr->first); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SKILL_BY_SKILL); + stmt->setUInt32(0, GetGUIDLow()); + stmt->setUInt32(1, itr->first); + trans->Append(stmt); + mSkillStatus.erase(itr++); continue; } @@ -19255,12 +19562,22 @@ void Player::_SaveSkills(SQLTransaction& trans) switch (itr->second.uState) { case SKILL_NEW: - trans->PAppend("INSERT INTO character_skills (guid, skill, value, max) VALUES ('%u', '%u', '%u', '%u')", - GetGUIDLow(), itr->first, value, max); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_SKILLS); + stmt->setUInt32(0, GetGUIDLow()); + stmt->setUInt16(1, uint16(itr->first)); + stmt->setUInt16(2, value); + stmt->setUInt16(3, max); + trans->Append(stmt); + break; case SKILL_CHANGED: - trans->PAppend("UPDATE character_skills SET value = '%u', max = '%u'WHERE guid = '%u' AND skill = '%u' ", - value, max, GetGUIDLow(), itr->first); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_SKILLS); + stmt->setUInt16(0, value); + stmt->setUInt16(1, max); + stmt->setUInt32(2, GetGUIDLow()); + stmt->setUInt16(3, uint16(itr->first)); + trans->Append(stmt); + break; default: break; @@ -19273,14 +19590,28 @@ void Player::_SaveSkills(SQLTransaction& trans) void Player::_SaveSpells(SQLTransaction& trans) { + PreparedStatement* stmt = NULL; + for (PlayerSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end();) { if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->state == PLAYERSPELL_CHANGED) - trans->PAppend("DELETE FROM character_spell WHERE guid = '%u' and spell = '%u'", GetGUIDLow(), itr->first); + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL_BY_SPELL); + stmt->setUInt32(0, itr->first); + stmt->setUInt32(1, GetGUIDLow()); + trans->Append(stmt); + } // add only changed/new not dependent spells if (!itr->second->dependent && (itr->second->state == PLAYERSPELL_NEW || itr->second->state == PLAYERSPELL_CHANGED)) - trans->PAppend("INSERT INTO character_spell (guid, spell, active, disabled) VALUES ('%u', '%u', '%u', '%u')", GetGUIDLow(), itr->first, itr->second->active ? 1 : 0, itr->second->disabled ? 1 : 0); + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_SPELL); + stmt->setUInt32(0, GetGUIDLow()); + stmt->setUInt32(1, itr->first); + stmt->setBool(2, itr->second->active); + stmt->setBool(3, itr->second->disabled); + trans->Append(stmt); + } if (itr->second->state == PLAYERSPELL_REMOVED) { @@ -19303,31 +19634,38 @@ void Player::_SaveStats(SQLTransaction& trans) if (!sWorld->getIntConfig(CONFIG_MIN_LEVEL_STAT_SAVE) || getLevel() < sWorld->getIntConfig(CONFIG_MIN_LEVEL_STAT_SAVE)) return; - trans->PAppend("DELETE FROM character_stats WHERE guid = '%u'", GetGUIDLow()); - std::ostringstream ss; - ss << "INSERT INTO character_stats (guid, maxhealth, maxpower1, maxpower2, maxpower3, maxpower4, maxpower5, " - "strength, agility, stamina, intellect, spirit, armor, resHoly, resFire, resNature, resFrost, resShadow, resArcane, " - "blockPct, dodgePct, parryPct, critPct, rangedCritPct, spellCritPct, attackPower, rangedAttackPower, spellPower, resilience) VALUES (" - << GetGUIDLow() << ',' - << GetMaxHealth() << ','; - for (uint8 i = 0; i < MAX_STORED_POWERS; ++i) - ss << GetMaxPower(Powers(i)) << ','; + PreparedStatement* stmt = NULL; + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_STATS); + stmt->setUInt32(0, GetGUIDLow()); + trans->Append(stmt); + + uint8 index = 0; + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_STATS); + stmt->setUInt32(index++, GetGUIDLow()); + stmt->setUInt32(index++, GetMaxHealth()); + + stmt->setUInt32(index++, GetMaxPower(Powers(i))); + for (uint8 i = 0; i < MAX_STATS; ++i) - ss << GetStat(Stats(i)) << ','; - // armor + school resistances + stmt->setUInt32(index++, GetStat(Stats(i))); + for (int i = 0; i < MAX_SPELL_SCHOOL; ++i) - ss << GetResistance(SpellSchools(i)) << ','; - ss << GetFloatValue(PLAYER_BLOCK_PERCENTAGE) << ',' - << GetFloatValue(PLAYER_DODGE_PERCENTAGE) << ',' - << GetFloatValue(PLAYER_PARRY_PERCENTAGE) << ',' - << GetFloatValue(PLAYER_CRIT_PERCENTAGE) << ',' - << GetFloatValue(PLAYER_RANGED_CRIT_PERCENTAGE) << ',' - << GetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1) << ',' - << GetUInt32Value(UNIT_FIELD_ATTACK_POWER) << ',' - << GetUInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER) << ',' - << GetBaseSpellPowerBonus() << ',' - << GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_CRIT_TAKEN_SPELL) << ')'; - trans->Append(ss.str().c_str()); + stmt->setUInt32(index++, GetResistance(SpellSchools(i))); + + stmt->setFloat(index++, GetFloatValue(PLAYER_BLOCK_PERCENTAGE)); + stmt->setFloat(index++, GetFloatValue(PLAYER_DODGE_PERCENTAGE)); + stmt->setFloat(index++, GetFloatValue(PLAYER_PARRY_PERCENTAGE)); + stmt->setFloat(index++, GetFloatValue(PLAYER_CRIT_PERCENTAGE)); + stmt->setFloat(index++, GetFloatValue(PLAYER_RANGED_CRIT_PERCENTAGE)); + stmt->setFloat(index++, GetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1)); + stmt->setUInt32(index++, GetUInt32Value(UNIT_FIELD_ATTACK_POWER)); + stmt->setUInt32(index++, GetUInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER)); + stmt->setUInt32(index++, GetBaseSpellPowerBonus()); + stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_CRIT_TAKEN_SPELL)); + + trans->Append(stmt); } void Player::outDebugValues() const @@ -19426,8 +19764,10 @@ void Player::SetUInt32ValueInArray(Tokens& tokens, uint16 index, uint32 value) void Player::Customize(uint64 guid, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair) { - // 0 - QueryResult result = CharacterDatabase.PQuery("SELECT playerBytes2 FROM characters WHERE guid = '%u'", GUID_LOPART(guid)); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PLAYERBYTES2); + stmt->setUInt32(0, GUID_LOPART(guid)); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (!result) return; @@ -19437,7 +19777,7 @@ void Player::Customize(uint64 guid, uint8 gender, uint8 skin, uint8 face, uint8 playerBytes2 &= ~0xFF; playerBytes2 |= facialHair; - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GENDER_PLAYERBYTES); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GENDER_PLAYERBYTES); stmt->setUInt8(0, gender); stmt->setUInt32(1, skin | (face << 8) | (hairStyle << 16) | (hairColor << 24)); @@ -19571,7 +19911,11 @@ void Player::SendResetInstanceSuccess(uint32 MapId) void Player::SendResetInstanceFailed(uint32 reason, uint32 MapId) { - // TODO: find what other fail reasons there are besides players in the instance + /*reasons for instance reset failure: + // 0: There are players inside the instance. + // 1: There are players offline in your party. + // 2>: There are players in your party attempting to zone into an instance. + */ WorldPacket data(SMSG_INSTANCE_RESET_FAILED, 4); data << uint32(reason); data << uint32(MapId); @@ -19864,7 +20208,7 @@ void Player::PetSpellInitialize() WorldPacket data(SMSG_PET_SPELLS, 8+2+4+4+4*MAX_UNIT_ACTION_BAR_INDEX+1+1); data << uint64(pet->GetGUID()); - data << uint16(pet->GetCreatureInfo()->family); // creature family (required for pet talents) + data << uint16(pet->GetCreatureTemplate()->family); // creature family (required for pet talents) data << uint32(0); data << uint8(pet->GetReactState()) << uint8(charmInfo->GetCommandState()) << uint16(0); @@ -19958,7 +20302,7 @@ void Player::VehicleSpellInitialize() WorldPacket data(SMSG_PET_SPELLS, 8 + 2 + 4 + 4 + 4 * 10 + 1 + 1 + cooldownCount * (4 + 2 + 4 + 4)); data << uint64(veh->GetGUID()); - data << uint16(veh->GetCreatureInfo()->family); + data << uint16(veh->GetCreatureTemplate()->family); data << uint32(0); // The following three segments are read as one uint32 data << uint8(veh->GetReactState()); @@ -20044,7 +20388,7 @@ void Player::CharmSpellInitialize() uint8 addlist = 0; if (charm->GetTypeId() != TYPEID_PLAYER) { - //CreatureInfo const* cinfo = charm->ToCreature()->GetCreatureInfo(); + //CreatureInfo const* cinfo = charm->ToCreature()->GetCreatureTemplate(); //if (cinfo && cinfo->type == CREATURE_TYPE_DEMON && getClass() == CLASS_WARLOCK) { for (uint32 i = 0; i < MAX_SPELL_CHARM; ++i) @@ -20174,9 +20518,13 @@ void Player::RestoreSpellMods(Spell* spell, uint32 ownerAuraId, Aura* aura) continue; // check if mod affected this spell + // first, check if the mod aura applied at least one spellmod to this spell Spell::UsedSpellMods::iterator iterMod = spell->m_appliedMods.find(mod->ownerAura); if (iterMod == spell->m_appliedMods.end()) continue; + // secondly, check if the current mod is one of the spellmods applied by the mod aura + if (!(mod->mask & spell->m_spellInfo->SpellFamilyFlags)) + continue; // remove from list spell->m_appliedMods.erase(iterMod); @@ -20270,16 +20618,24 @@ void Player::SendProficiency(ItemClass itemClass, uint32 itemSubclassMask) { WorldPacket data(SMSG_SET_PROFICIENCY, 1 + 4); data << uint8(itemClass) << uint32(itemSubclassMask); - GetSession()->SendPacket (&data); + GetSession()->SendPacket(&data); } void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type) { - QueryResult result = QueryResult(NULL); + PreparedStatement* stmt; + if (type == 10) - result = CharacterDatabase.PQuery("SELECT ownerguid, petitionguid FROM petition_sign WHERE playerguid = '%u'", GUID_LOPART(guid)); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_SIG_BY_GUID); else - result = CharacterDatabase.PQuery("SELECT ownerguid, petitionguid FROM petition_sign WHERE playerguid = '%u' AND type = '%u'", GUID_LOPART(guid), type); + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_SIG_BY_GUID_TYPE); + stmt->setUInt8(0, uint8(type)); + } + + stmt->setUInt32(0, GUID_LOPART(guid)); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (result) { do // this part effectively does nothing, since the deletion / modification only takes place _after_ the PetitionQuery. Though I don't know if the result remains intact if I execute the delete query beforehand. @@ -20316,13 +20672,25 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type) SQLTransaction trans = CharacterDatabase.BeginTransaction(); if (type == 10) { - trans->PAppend("DELETE FROM petition WHERE ownerguid = '%u'", GUID_LOPART(guid)); - trans->PAppend("DELETE FROM petition_sign WHERE ownerguid = '%u'", GUID_LOPART(guid)); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_BY_OWNER); + stmt->setUInt32(0, GUID_LOPART(guid)); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE_BY_OWNER); + stmt->setUInt32(0, GUID_LOPART(guid)); + trans->Append(stmt); } else { - trans->PAppend("DELETE FROM petition WHERE ownerguid = '%u' AND type = '%u'", GUID_LOPART(guid), type); - trans->PAppend("DELETE FROM petition_sign WHERE ownerguid = '%u' AND type = '%u'", GUID_LOPART(guid), type); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_BY_OWNER_AND_TYPE); + stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt8(1, uint8(type)); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE_BY_OWNER_AND_TYPE); + stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt8(1, uint8(type)); + trans->Append(stmt); } CharacterDatabase.CommitTransaction(trans); } @@ -20905,10 +21273,10 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 } uint32 price = 0; - if(crItem->IsGoldRequired(pProto) && pProto->BuyPrice > 0) //Assume price cannot be negative (do not know why it is int32) + if (crItem->IsGoldRequired(pProto) && pProto->BuyPrice > 0) //Assume price cannot be negative (do not know why it is int32) { uint32 maxCount = MAX_MONEY_AMOUNT / pProto->BuyPrice; - if((uint32)count > maxCount) + if ((uint32)count > maxCount) { sLog->outError("Player %s tried to buy %u item id %u, causing overflow", GetName(), (uint32)count, pProto->ItemId); count = (uint8)maxCount; @@ -21542,13 +21910,6 @@ inline void UpdateVisibilityOf_helper(std::set<uint64>& s64, T* target, std::set } template<> -inline void UpdateVisibilityOf_helper(std::set<uint64>& s64, GameObject* target, std::set<Unit*>& /*v*/) -{ - if (!target->IsTransport()) - s64.insert(target->GetGUID()); -} - -template<> inline void UpdateVisibilityOf_helper(std::set<uint64>& s64, Creature* target, std::set<Unit*>& v) { s64.insert(target->GetGUID()); @@ -22238,6 +22599,18 @@ void Player::SendAurasForTarget(Unit* target) if (!target || target->GetVisibleAuras()->empty()) // speedup things return; + /*! Blizz sends certain movement packets sometimes even before CreateObject + These movement packets are usually found in SMSG_COMPRESSED_MOVES + */ + if (target->HasAuraType(SPELL_AURA_FEATHER_FALL)) + target->SendMovementFeatherFall(); + + if (target->HasAuraType(SPELL_AURA_WATER_WALK)) + target->SendMovementWaterWalking(); + + if (target->HasAuraType(SPELL_AURA_HOVER)) + target->SendMovementHover(); + WorldPacket data(SMSG_AURA_UPDATE_ALL); data.append(target->GetPackGUID()); @@ -22711,20 +23084,20 @@ uint32 Player::GetResurrectionSpellId() } // Used in triggers for check "Only to targets that grant experience or honor" req -bool Player::isHonorOrXPTarget(Unit* pVictim) +bool Player::isHonorOrXPTarget(Unit* victim) { - uint8 v_level = pVictim->getLevel(); + uint8 v_level = victim->getLevel(); uint8 k_grey = Trinity::XP::GetGrayLevel(getLevel()); // Victim level less gray level if (v_level <= k_grey) return false; - if (pVictim->GetTypeId() == TYPEID_UNIT) + if (victim->GetTypeId() == TYPEID_UNIT) { - if (pVictim->ToCreature()->isTotem() || - pVictim->ToCreature()->isPet() || - pVictim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL) + if (victim->ToCreature()->isTotem() || + victim->ToCreature()->isPet() || + victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL) return false; } return true; @@ -22771,9 +23144,9 @@ bool Player::GetsRecruitAFriendBonus(bool forXP) return recruitAFriend; } -void Player::RewardPlayerAndGroupAtKill(Unit* pVictim, bool isBattleGround) +void Player::RewardPlayerAndGroupAtKill(Unit* victim, bool isBattleGround) { - KillRewarder(this, pVictim, isBattleGround).Reward(); + KillRewarder(this, victim, isBattleGround).Reward(); } void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewardSource) @@ -23005,7 +23378,8 @@ void Player::SendCorpseReclaimDelay(bool load) else delay = GetCorpseReclaimDelay(pvp); - if (!delay) return; + if (!delay) + return; //! corpse reclaim delay 30 * 1000ms or longer at often deaths WorldPacket data(SMSG_CORPSE_RECLAIM_DELAY, 4); @@ -23129,15 +23503,39 @@ void Player::UpdateUnderwaterState(Map* m, float x, float y, float z) ZLiquidStatus res = m->getLiquidStatus(x, y, z, MAP_ALL_LIQUIDS, &liquid_status); if (!res) { - m_MirrorTimerFlags &= ~(UNDERWATER_INWATER|UNDERWATER_INLAVA|UNDERWATER_INSLIME|UNDERWARER_INDARKWATER); - // Small hack for enable breath in WMO - /* if (IsInWater()) - m_MirrorTimerFlags|=UNDERWATER_INWATER; */ + m_MirrorTimerFlags &= ~(UNDERWATER_INWATER | UNDERWATER_INLAVA | UNDERWATER_INSLIME | UNDERWARER_INDARKWATER); + if (_lastLiquid && _lastLiquid->SpellId) + RemoveAurasDueToSpell(_lastLiquid->SpellId); + + _lastLiquid = NULL; return; } + if (uint32 liqEntry = liquid_status.entry) + { + LiquidTypeEntry const* liquid = sLiquidTypeStore.LookupEntry(liqEntry); + if (_lastLiquid && _lastLiquid->SpellId && _lastLiquid->Id != liqEntry) + RemoveAurasDueToSpell(_lastLiquid->SpellId); + + if (liquid && liquid->SpellId) + { + if (res & (LIQUID_MAP_UNDER_WATER | LIQUID_MAP_IN_WATER)) + CastSpell(this, liquid->SpellId, true); + else + RemoveAurasDueToSpell(liquid->SpellId); + } + + _lastLiquid = liquid; + } + else if (_lastLiquid && _lastLiquid->SpellId) + { + RemoveAurasDueToSpell(_lastLiquid->SpellId); + _lastLiquid = NULL; + } + + // All liquids type - check under water position - if (liquid_status.type&(MAP_LIQUID_TYPE_WATER|MAP_LIQUID_TYPE_OCEAN|MAP_LIQUID_TYPE_MAGMA|MAP_LIQUID_TYPE_SLIME)) + if (liquid_status.type_flags & (MAP_LIQUID_TYPE_WATER | MAP_LIQUID_TYPE_OCEAN | MAP_LIQUID_TYPE_MAGMA | MAP_LIQUID_TYPE_SLIME)) { if (res & LIQUID_MAP_UNDER_WATER) m_MirrorTimerFlags |= UNDERWATER_INWATER; @@ -23146,23 +23544,23 @@ void Player::UpdateUnderwaterState(Map* m, float x, float y, float z) } // Allow travel in dark water on taxi or transport - if ((liquid_status.type & MAP_LIQUID_TYPE_DARK_WATER) && !isInFlight() && !GetTransport()) + if ((liquid_status.type_flags & MAP_LIQUID_TYPE_DARK_WATER) && !isInFlight() && !GetTransport()) m_MirrorTimerFlags |= UNDERWARER_INDARKWATER; else m_MirrorTimerFlags &= ~UNDERWARER_INDARKWATER; // in lava check, anywhere in lava level - if (liquid_status.type&MAP_LIQUID_TYPE_MAGMA) + if (liquid_status.type_flags & MAP_LIQUID_TYPE_MAGMA) { - if (res & (LIQUID_MAP_UNDER_WATER|LIQUID_MAP_IN_WATER|LIQUID_MAP_WATER_WALK)) + if (res & (LIQUID_MAP_UNDER_WATER | LIQUID_MAP_IN_WATER | LIQUID_MAP_WATER_WALK)) m_MirrorTimerFlags |= UNDERWATER_INLAVA; else m_MirrorTimerFlags &= ~UNDERWATER_INLAVA; } // in slime check, anywhere in slime level - if (liquid_status.type&MAP_LIQUID_TYPE_SLIME) + if (liquid_status.type_flags & MAP_LIQUID_TYPE_SLIME) { - if (res & (LIQUID_MAP_UNDER_WATER|LIQUID_MAP_IN_WATER|LIQUID_MAP_WATER_WALK)) + if (res & (LIQUID_MAP_UNDER_WATER | LIQUID_MAP_IN_WATER | LIQUID_MAP_WATER_WALK)) m_MirrorTimerFlags |= UNDERWATER_INSLIME; else m_MirrorTimerFlags &= ~UNDERWATER_INSLIME; @@ -23386,7 +23784,6 @@ void Player::SetTitle(CharTitlesEntry const* title, bool lost) GetSession()->SendPacket(&data); } -/*-----------------------TRINITY--------------------------*/ bool Player::isTotalImmunity() { AuraEffectList const& immune = GetAuraEffectsByType(SPELL_AURA_SCHOOL_IMMUNITY); @@ -23518,7 +23915,8 @@ void Player::AddRunePower(uint8 index) GetSession()->SendPacket(&data); } -static RuneType runeSlotTypes[MAX_RUNES] = { +static RuneType runeSlotTypes[MAX_RUNES] = +{ /*0*/ RUNE_BLOOD, /*1*/ RUNE_BLOOD, /*2*/ RUNE_UNHOLY, @@ -24107,7 +24505,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank) if (!talentTabInfo) return; - CreatureTemplate const* ci = pet->GetCreatureInfo(); + CreatureTemplate const* ci = pet->GetCreatureTemplate(); if (!ci) return; @@ -24370,7 +24768,7 @@ void Player::BuildPetTalentsInfoData(WorldPacket* data) data->put<uint32>(pointsPos, unspentTalentPoints); // put real points - CreatureTemplate const* ci = pet->GetCreatureInfo(); + CreatureTemplate const* ci = pet->GetCreatureTemplate(); if (!ci) return; @@ -24690,11 +25088,24 @@ void Player::_LoadGlyphs(PreparedQueryResult result) void Player::_SaveGlyphs(SQLTransaction& trans) { - trans->PAppend("DELETE FROM character_glyphs WHERE guid='%u'", GetGUIDLow()); - for (uint8 spec = 0; spec < GetSpecsCount(); ++spec) + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_GLYPHS); + stmt->setUInt32(0, GetGUIDLow()); + trans->Append(stmt); + + + for (uint8 spec = 0; spec < m_specsCount; ++spec) { - trans->PAppend("INSERT INTO character_glyphs VALUES('%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u')", - GetGUIDLow(), spec, GetGlyph(spec, 0), GetGlyph(spec, 1), GetGlyph(spec, 2), GetGlyph(spec, 3), GetGlyph(spec, 4), GetGlyph(spec, 5)); + uint8 index = 0; + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_GLYPHS); + stmt->setUInt32(index++, GetGUIDLow()); + + stmt->setUInt8(index++, spec); + + for (uint8 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i) + stmt->setUInt16(index++, uint16(m_Glyphs[spec][i])); + + trans->Append(stmt); } } @@ -24704,22 +25115,36 @@ void Player::_LoadTalents(PreparedQueryResult result) if (result) { do - AddTalent((*result)[0].GetUInt32(), (*result)[1].GetUInt32(), false); + AddTalent((*result)[0].GetUInt32(), (*result)[1].GetUInt8(), false); while (result->NextRow()); } } void Player::_SaveTalents(SQLTransaction& trans) { + PreparedStatement* stmt = NULL; + for (uint8 i = 0; i < MAX_TALENT_SPECS; ++i) { for (PlayerTalentMap::iterator itr = GetTalentMap(i)->begin(); itr != GetTalentMap(i)->end();) { if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->state == PLAYERSPELL_CHANGED) - trans->PAppend("DELETE FROM character_talent WHERE guid = '%u' and spell = '%u' and spec = '%u'", GetGUIDLow(), itr->first, itr->second->spec); + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_TALENT_BY_SPELL_SPEC); + stmt->setUInt32(0, GetGUIDLow()); + stmt->setUInt32(1, itr->first); + stmt->setUInt8(2, itr->second->spec); + trans->Append(stmt); + } if (itr->second->state == PLAYERSPELL_NEW || itr->second->state == PLAYERSPELL_CHANGED) - trans->PAppend("INSERT INTO character_talent (guid, spell, spec) VALUES ('%u', '%u', '%u')", GetGUIDLow(), itr->first, itr->second->spec); + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_TALENT); + stmt->setUInt32(0, GetGUIDLow()); + stmt->setUInt32(1, itr->first); + stmt->setUInt8(2, itr->second->spec); + trans->Append(stmt); + } if (itr->second->state == PLAYERSPELL_REMOVED) { @@ -24745,21 +25170,33 @@ void Player::UpdateSpecCount(uint8 count) ActivateSpec(0); SQLTransaction trans = CharacterDatabase.BeginTransaction(); + PreparedStatement* stmt = NULL; // Copy spec data if (count > curCount) { _SaveActions(trans); // make sure the button list is cleaned up for (ActionButtonList::iterator itr = m_actionButtons.begin(); itr != m_actionButtons.end(); ++itr) - trans->PAppend("INSERT INTO character_action (guid, button, action, type, spec) VALUES ('%u', '%u', '%u', '%u', '%u')", - GetGUIDLow(), uint32(itr->first), uint32(itr->second.GetAction()), uint32(itr->second.GetType()), 1); + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_ACTION); + stmt->setUInt32(0, GetGUIDLow()); + stmt->setUInt8(1, 1); + stmt->setUInt8(2, itr->first); + stmt->setUInt32(3, itr->second.GetAction()); + stmt->setUInt8(4, uint8(itr->second.GetType())); + trans->Append(stmt); + } } // Delete spec data for removed spec. else if (count < curCount) { _SaveActions(trans); - trans->PAppend("DELETE FROM character_action WHERE spec<>'%u' AND guid='%u'", GetActiveSpec(), GetGUIDLow()); - SetActiveSpec(0); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACTION_EXCEPT_SPEC); + stmt->setUInt8(0, m_activeSpec); + stmt->setUInt32(1, GetGUIDLow()); + trans->Append(stmt); + } CharacterDatabase.CommitTransaction(trans); @@ -25231,3 +25668,53 @@ bool Player::IsInWhisperWhiteList(uint64 guid) } return false; } + +bool Player::SetHover(bool enable) +{ + if (!Unit::SetHover(enable)) + return false; + + return true; +} + +void Player::SendMovementSetCanFly(bool apply) +{ + WorldPacket data(apply ? SMSG_MOVE_SET_CAN_FLY : SMSG_MOVE_UNSET_CAN_FLY, 12); + data.append(GetPackGUID()); + data << uint32(0); //! movement counter + SendDirectMessage(&data); +} + +void Player::SendMovementSetCanTransitionBetweenSwimAndFly(bool apply) +{ + WorldPacket data(apply ? + SMSG_MOVE_SET_CAN_TRANSITION_BETWEEN_SWIM_AND_FLY : + SMSG_MOVE_UNSET_CAN_TRANSITION_BETWEEN_SWIM_AND_FLY, 12); + data.append(GetPackGUID()); + data << uint32(0); //! movement counter + SendDirectMessage(&data); +} + +void Player::SendMovementSetHover(bool apply) +{ + WorldPacket data(apply ? SMSG_MOVE_SET_HOVER : SMSG_MOVE_UNSET_HOVER, 12); + data.append(GetPackGUID()); + data << uint32(0); //! movement counter + SendDirectMessage(&data); +} + +void Player::SendMovementSetWaterWalking(bool apply) +{ + WorldPacket data(apply ? SMSG_MOVE_WATER_WALK : SMSG_MOVE_LAND_WALK, 12); + data.append(GetPackGUID()); + data << uint32(0); //! movement counter + SendDirectMessage(&data); +} + +void Player::SendMovementSetFeatherFall(bool apply) +{ + WorldPacket data(apply ? SMSG_MOVE_FEATHER_FALL : SMSG_MOVE_NORMAL_FALL, 12); + data.append(GetPackGUID()); + data << uint32(0); //! movement counter + SendDirectMessage(&data); +} diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index b3315ceec9f..dc6fd7eab26 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -703,9 +703,9 @@ enum TransferAbortReason TRANSFER_ABORT_UNIQUE_MESSAGE = 0x09, // Until you've escaped TLK's grasp, you cannot leave this place! TRANSFER_ABORT_TOO_MANY_REALM_INSTANCES = 0x0A, // Additional instances cannot be launched, please try again later. TRANSFER_ABORT_NEED_GROUP = 0x0B, // 3.1 - TRANSFER_ABORT_NOT_FOUND2 = 0x0C, // 3.1 - TRANSFER_ABORT_NOT_FOUND3 = 0x0D, // 3.1 - TRANSFER_ABORT_NOT_FOUND4 = 0x0E, // 3.2 + TRANSFER_ABORT_NOT_FOUND1 = 0x0C, // 3.1 + TRANSFER_ABORT_NOT_FOUND2 = 0x0D, // 3.1 + TRANSFER_ABORT_NOT_FOUND3 = 0x0E, // 3.2 TRANSFER_ABORT_REALM_ONLY = 0x0F, // All players on party must be from the same realm. TRANSFER_ABORT_MAP_NOT_ALLOWED = 0x10, // Map can't be entered at this time. TRANSFER_ABORT_LOCKED_TO_DIFFERENT_INSTANCE = 0x12, // 4.2.2 @@ -1120,7 +1120,7 @@ class Player : public Unit, public GridObject<Player> friend void Item::RemoveFromUpdateQueueOf(Player* player); public: explicit Player (WorldSession* session); - ~Player (); + ~Player(); void CleanupsBeforeDelete(bool finalCleanup = true); @@ -1395,6 +1395,7 @@ class Player : public Unit, public GridObject<Player> void UpdateEnchantTime(uint32 time); void UpdateSoulboundTradeItems(); + void AddTradeableItem(Item* item); void RemoveTradeableItem(Item* item); void UpdateItemDuration(uint32 time, bool realtimeonly = false); void AddEnchantmentDurations(Item* item); @@ -1568,7 +1569,7 @@ class Player : public Unit, public GridObject<Player> static uint32 GetLevelFromDB(uint64 guid); static bool LoadPositionFromDB(uint32& mapid, float& x, float& y, float& z, float& o, bool& in_flight, uint64 guid); - static bool IsValidGender(uint8 Gender) { return Gender <= GENDER_FEMALE ; } + static bool IsValidGender(uint8 Gender) { return Gender <= GENDER_FEMALE; } static bool IsValidClass(uint8 Class) { return (1 << (Class - 1)) & CLASSMASK_ALL_PLAYABLE; } static bool IsValidRace(uint8 Race) { return (1 << (Race - 1)) & RACEMASK_ALL_PLAYABLE; } @@ -1602,7 +1603,7 @@ class Player : public Unit, public GridObject<Player> void setRegenTimerCount(uint32 time) {m_regenTimerCount = time;} void setWeaponChangeTimer(uint32 time) {m_weaponChangeTimer = time;} - uint32 GetMoney() const { return GetUInt32Value (PLAYER_FIELD_COINAGE); } + uint32 GetMoney() const { return GetUInt32Value(PLAYER_FIELD_COINAGE); } void ModifyMoney(int32 d); bool HasEnoughMoney(uint32 amount) const { return (GetMoney() >= amount); } bool HasEnoughMoney(int32 amount) const @@ -1614,13 +1615,13 @@ class Player : public Unit, public GridObject<Player> void SetMoney(uint32 value) { - SetUInt32Value (PLAYER_FIELD_COINAGE, value); + SetUInt32Value(PLAYER_FIELD_COINAGE, value); MoneyChanged(value); UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_GOLD_VALUE_OWNED); } RewardedQuestSet const& getRewardedQuests() const { return m_RewardedQuests; } - QuestStatusMap& getQuestStatusMap() { return m_QuestStatus; }; + QuestStatusMap& getQuestStatusMap() { return m_QuestStatus; } size_t GetRewardedQuestCount() const { return m_RewardedQuests.size(); } bool IsQuestRewarded(uint32 quest_id) const @@ -1633,7 +1634,7 @@ class Player : public Unit, public GridObject<Player> Player* GetSelectedPlayer() const; void SetSelection(uint64 guid) { m_curSelection = guid; SetUInt64Value(UNIT_FIELD_TARGET, guid); } - uint8 GetComboPoints() { return m_comboPoints; } + uint8 GetComboPoints() const { return m_comboPoints; } uint64 GetComboTarget() const { return m_comboTarget; } void AddComboPoints(Unit* target, int8 count, Spell* spell = NULL); @@ -1996,7 +1997,7 @@ class Player : public Unit, public GridObject<Player> WorldSession* GetSession() const { return m_session; } void BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const; - void DestroyForPlayer(Player* target, bool anim = false) const; + void DestroyForPlayer(Player* target, bool onDeath = false) const; void SendLogXPGain(uint32 GivenXP, Unit* victim, uint32 BonusXP, bool recruitAFriend = false, float group_rate=1.0f); // notifiers @@ -2064,7 +2065,7 @@ class Player : public Unit, public GridObject<Player> void UpdateDefense(); void UpdateWeaponSkill (WeaponAttackType attType); - void UpdateCombatSkills(Unit* pVictim, WeaponAttackType attType, bool defence); + void UpdateCombatSkills(Unit* victim, WeaponAttackType attType, bool defence); void SetSkill(uint16 id, uint16 step, uint16 currVal, uint16 maxVal); uint16 GetMaxSkillValue(uint32 skill) const; // max + perm. bonus + temp bonus @@ -2097,9 +2098,9 @@ class Player : public Unit, public GridObject<Player> bool IsAtGroupRewardDistance(WorldObject const* pRewardSource) const; bool IsAtRecruitAFriendDistance(WorldObject const* pOther) const; - void RewardPlayerAndGroupAtKill(Unit* pVictim, bool isBattleGround); + void RewardPlayerAndGroupAtKill(Unit* victim, bool isBattleGround); void RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewardSource); - bool isHonorOrXPTarget(Unit* pVictim); + bool isHonorOrXPTarget(Unit* victim); bool GetsRecruitAFriendBonus(bool forXP); uint8 GetGrantableLevels() { return m_grantableLevels; } @@ -2108,7 +2109,7 @@ class Player : public Unit, public GridObject<Player> ReputationMgr& GetReputationMgr() { return m_reputationMgr; } ReputationMgr const& GetReputationMgr() const { return m_reputationMgr; } ReputationRank GetReputationRank(uint32 faction_id) const; - void RewardReputation(Unit* pVictim, float rate); + void RewardReputation(Unit* victim, float rate); void RewardReputation(Quest const* quest); void UpdateSkillsForLevel(); @@ -2362,6 +2363,8 @@ class Player : public Unit, public GridObject<Player> m_mover->m_movedPlayer = this; } + bool SetHover(bool enable); + void SetSeer(WorldObject* target) { m_seer = target; } void SetViewpoint(WorldObject* target, bool apply); WorldObject* GetViewpoint() const; @@ -2407,7 +2410,7 @@ class Player : public Unit, public GridObject<Player> void UpdateTriggerVisibility(); template<class T> - void UpdateVisibilityOf(T* target, UpdateData& data, std::set<Unit*>& visibleNow); + void UpdateVisibilityOf(T* target, UpdateData& data, std::set<Unit*>& visibleNow); uint8 m_forced_speed_changes[MAX_MOVE_TYPE]; @@ -2490,6 +2493,7 @@ class Player : public Unit, public GridObject<Player> void SetAuraUpdateMaskForRaid(uint8 slot) { m_auraRaidUpdateMask |= (uint64(1) << slot); } Player* GetNextRandomRaidMember(float radius); PartyResult CanUninviteFromGroup() const; + // Battleground Group System void SetBattlegroundRaid(Group* group, int8 subgroup = -1); void RemoveFromBattlegroundRaid(); @@ -2553,6 +2557,17 @@ class Player : public Unit, public GridObject<Player> void AddWhisperWhiteList(uint64 guid) { WhisperList.push_back(guid); } bool IsInWhisperWhiteList(uint64 guid); + /*! These methods send different packets to the client in apply and unapply case. + These methods are only sent to the current unit. + */ + void SendMovementSetCanFly(bool apply); + void SendMovementSetCanTransitionBetweenSwimAndFly(bool apply); + void SendMovementSetHover(bool apply); + void SendMovementSetWaterWalking(bool apply); + void SendMovementSetFeatherFall(bool apply); + + bool CanFly() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_CAN_FLY); } + //! Return collision height sent to client float GetCollisionHeight(bool mounted) { @@ -2585,7 +2600,6 @@ class Player : public Unit, public GridObject<Player> return modelData->CollisionHeight; } - //! TODO: Need a proper calculation for collision height when mounted } protected: diff --git a/src/server/game/Entities/Player/SocialMgr.cpp b/src/server/game/Entities/Player/SocialMgr.cpp index cb327b83d17..1ded8cda81b 100755 --- a/src/server/game/Entities/Player/SocialMgr.cpp +++ b/src/server/game/Entities/Player/SocialMgr.cpp @@ -61,7 +61,7 @@ bool PlayerSocial::AddToSocialList(uint32 friendGuid, bool ignore) return false; } - uint32 flag = SOCIAL_FLAG_FRIEND; + uint8 flag = SOCIAL_FLAG_FRIEND; if (ignore) flag = SOCIAL_FLAG_IGNORED; @@ -70,7 +70,7 @@ bool PlayerSocial::AddToSocialList(uint32 friendGuid, bool ignore) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_CHARACTER_SOCIAL_FLAGS); - stmt->setUInt8(0, uint8(flag)); + stmt->setUInt8(0, flag); stmt->setUInt32(1, GetPlayerGUID()); stmt->setUInt32(2, friendGuid); @@ -84,7 +84,7 @@ bool PlayerSocial::AddToSocialList(uint32 friendGuid, bool ignore) stmt->setUInt32(0, GetPlayerGUID()); stmt->setUInt32(1, friendGuid); - stmt->setUInt8(2, uint8(flag)); + stmt->setUInt8(2, flag); CharacterDatabase.Execute(stmt); @@ -101,7 +101,7 @@ void PlayerSocial::RemoveFromSocialList(uint32 friendGuid, bool ignore) if (itr == m_playerSocialMap.end()) // not exist return; - uint32 flag = SOCIAL_FLAG_FRIEND; + uint8 flag = SOCIAL_FLAG_FRIEND; if (ignore) flag = SOCIAL_FLAG_IGNORED; @@ -121,7 +121,7 @@ void PlayerSocial::RemoveFromSocialList(uint32 friendGuid, bool ignore) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_REM_CHARACTER_SOCIAL_FLAGS); - stmt->setUInt8(0, uint8(flag)); + stmt->setUInt8(0, flag); stmt->setUInt32(1, GetPlayerGUID()); stmt->setUInt32(2, friendGuid); @@ -321,7 +321,7 @@ void SocialMgr::BroadcastToFriendListers(Player* player, WorldPacket* packet) } } -PlayerSocial *SocialMgr::LoadFromDB(PreparedQueryResult result, uint32 guid) +PlayerSocial* SocialMgr::LoadFromDB(PreparedQueryResult result, uint32 guid) { PlayerSocial *social = &m_socialMap[guid]; social->SetPlayerGUID(guid); @@ -330,7 +330,7 @@ PlayerSocial *SocialMgr::LoadFromDB(PreparedQueryResult result, uint32 guid) return social; uint32 friend_guid = 0; - uint32 flags = 0; + uint8 flags = 0; std::string note = ""; do @@ -338,7 +338,7 @@ PlayerSocial *SocialMgr::LoadFromDB(PreparedQueryResult result, uint32 guid) Field* fields = result->Fetch(); friend_guid = fields[0].GetUInt32(); - flags = fields[1].GetUInt32(); + flags = fields[1].GetUInt8(); note = fields[2].GetString(); social->m_playerSocialMap[friend_guid] = FriendInfo(flags, note); diff --git a/src/server/game/Entities/Player/SocialMgr.h b/src/server/game/Entities/Player/SocialMgr.h index 540b425588e..3c7d13070fa 100755 --- a/src/server/game/Entities/Player/SocialMgr.h +++ b/src/server/game/Entities/Player/SocialMgr.h @@ -48,7 +48,7 @@ enum SocialFlag struct FriendInfo { FriendStatus Status; - uint32 Flags; + uint8 Flags; uint32 Area; uint8 Level; uint8 Class; @@ -64,7 +64,7 @@ struct FriendInfo Note = ""; } - FriendInfo(uint32 flags, const std::string& note) + FriendInfo(uint8 flags, const std::string& note) { Status = FRIEND_STATUS_OFFLINE; Flags = flags; diff --git a/src/server/game/Entities/Totem/Totem.h b/src/server/game/Entities/Totem/Totem.h index 8b00da34d73..c33b8776660 100755 --- a/src/server/game/Entities/Totem/Totem.h +++ b/src/server/game/Entities/Totem/Totem.h @@ -60,4 +60,3 @@ class Totem : public Minion uint32 m_duration; }; #endif - diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index f18b041ba88..a00fcae1e09 100755 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -52,7 +52,7 @@ void MapManager::LoadTransports() uint32 period = fields[3].GetUInt32(); uint32 scriptId = sObjectMgr->GetScriptId(fields[4].GetCString()); - const GameObjectTemplate* goinfo = sObjectMgr->GetGameObjectTemplate(entry); + GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry); if (!goinfo) { @@ -86,7 +86,7 @@ void MapManager::LoadTransports() float o = 1.0f; // creates the Gameobject - if (!t->Create(lowguid, entry, mapid, x, y, z, o, 100, 0)) + if (!t->Create(lowguid, entry, mapid, x, y, z, o, 255, 0)) { delete t; continue; @@ -129,8 +129,8 @@ void MapManager::LoadTransportNPCs() { uint32 oldMSTime = getMSTime(); - // 0 1 2 3 4 5 6 7 - QueryResult result = WorldDatabase.PQuery("SELECT guid, npc_entry, transport_entry, TransOffsetX, TransOffsetY, TransOffsetZ, TransOffsetO, emote FROM creature_transport"); + // 0 1 2 3 4 5 6 7 + QueryResult result = WorldDatabase.Query("SELECT guid, npc_entry, transport_entry, TransOffsetX, TransOffsetY, TransOffsetZ, TransOffsetO, emote FROM creature_transport"); if (!result) { @@ -144,14 +144,14 @@ void MapManager::LoadTransportNPCs() do { Field* fields = result->Fetch(); - uint32 guid = fields[0].GetUInt32(); - uint32 entry = fields[1].GetUInt32(); - uint32 transportEntry = fields[2].GetUInt32(); + uint32 guid = fields[0].GetInt32(); + uint32 entry = fields[1].GetInt32(); + uint32 transportEntry = fields[2].GetInt32(); float tX = fields[3].GetFloat(); float tY = fields[4].GetFloat(); float tZ = fields[5].GetFloat(); float tO = fields[6].GetFloat(); - uint32 anim = fields[7].GetUInt32(); + uint32 anim = fields[7].GetInt32(); for (MapManager::TransportSet::iterator itr = m_Transports.begin(); itr != m_Transports.end(); ++itr) { @@ -173,7 +173,7 @@ void MapManager::LoadTransportNPCs() Transport::Transport(uint32 period, uint32 script) : GameObject(), m_pathTime(0), m_timer(0), currenttguid(0), m_period(period), ScriptId(script), m_nextNodeTime(0) { - m_updateFlag = (UPDATEFLAG_TRANSPORT | UPDATEFLAG_HAS_POSITION | UPDATEFLAG_ROTATION); + m_updateFlag = (UPDATEFLAG_TRANSPORT | UPDATEFLAG_STATIONARY_POSITION | UPDATEFLAG_ROTATION); } Transport::~Transport() @@ -214,11 +214,10 @@ bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, floa m_goInfo = goinfo; - SetFloatValue(OBJECT_FIELD_SCALE_X, goinfo->size); + SetObjectScale(goinfo->size); SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction); - //SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags); - SetUInt32Value(GAMEOBJECT_FLAGS, MAKE_PAIR32(0x28, 0x64)); + SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags); SetUInt32Value(GAMEOBJECT_LEVEL, m_period); SetEntry(goinfo->entry); diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp index c25c4d3d79d..c307324bead 100755 --- a/src/server/game/Entities/Unit/StatSystem.cpp +++ b/src/server/game/Entities/Unit/StatSystem.cpp @@ -142,13 +142,13 @@ void Player::ApplySpellPowerBonus(int32 amount, bool apply) void Player::UpdateSpellDamageAndHealingBonus() { - // Magic damage modifiers implemented in Unit::SpellDamageBonus + // Magic damage modifiers implemented in Unit::SpellDamageBonusDone // This information for client side use only // Get healing bonus for all schools - SetStatInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS, SpellBaseHealingBonus(SPELL_SCHOOL_MASK_ALL)); + SetStatInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS, SpellBaseHealingBonusDone(SPELL_SCHOOL_MASK_ALL)); // Get damage bonus for all schools for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) - SetStatInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+i, SpellBaseDamageBonus(SpellSchoolMask(1 << i))); + SetStatInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+i, SpellBaseDamageBonusDone(SpellSchoolMask(1 << i))); } bool Player::UpdateAllStats() @@ -352,7 +352,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged) break; } case CLASS_MAGE: - val2 = GetStat(STAT_STRENGTH) - 10.0f; + val2 = GetStat(STAT_STRENGTH) - 10.0f; break; case CLASS_PRIEST: val2 = GetStat(STAT_STRENGTH) - 10.0f; @@ -967,12 +967,12 @@ void Creature::UpdateDamagePhysical(WeaponAttackType attType) float weapon_maxdamage = GetWeaponDamageRange(attType, MAXDAMAGE); /* difference in AP between current attack power and base value from DB */ - float att_pwr_change = GetTotalAttackPowerValue(attType) - GetCreatureInfo()->attackpower; + float att_pwr_change = GetTotalAttackPowerValue(attType) - GetCreatureTemplate()->attackpower; float base_value = GetModifierValue(unitMod, BASE_VALUE) + (att_pwr_change * GetAPMultiplier(attType, false) / 14.0f); float base_pct = GetModifierValue(unitMod, BASE_PCT); float total_value = GetModifierValue(unitMod, TOTAL_VALUE); float total_pct = GetModifierValue(unitMod, TOTAL_PCT); - float dmg_multiplier = GetCreatureInfo()->dmg_multiplier; + float dmg_multiplier = GetCreatureTemplate()->dmg_multiplier; if (!CanUseAttackType(attType)) { @@ -1016,6 +1016,7 @@ void Creature::UpdateDamagePhysical(WeaponAttackType attType) #define ENTRY_TREANT 1964 #define ENTRY_FIRE_ELEMENTAL 15438 #define ENTRY_GHOUL 26125 +#define ENTRY_BLOODWORM 28017 bool Guardian::UpdateStats(Stats stat) { @@ -1165,6 +1166,7 @@ void Guardian::UpdateMaxHealth() case ENTRY_SUCCUBUS: multiplicator = 9.1f; break; case ENTRY_FELHUNTER: multiplicator = 9.5f; break; case ENTRY_FELGUARD: multiplicator = 11.0f; break; + case ENTRY_BLOODWORM: multiplicator = 1.0f; break; default: multiplicator = 10.0f; break; } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 01c1175f074..6ae8e0b7caf 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -71,7 +71,9 @@ float baseMoveSpeed[MAX_MOVE_TYPE] = 4.5f, // MOVE_FLIGHT_BACK 3.14f // MOVE_PITCH_RATE }; -float playerBaseMoveSpeed[MAX_MOVE_TYPE] = { + +float playerBaseMoveSpeed[MAX_MOVE_TYPE] = +{ 2.5f, // MOVE_WALK 7.0f, // MOVE_RUN 4.5f, // MOVE_RUN_BACK @@ -110,23 +112,27 @@ m_damageType(DIRECT_DAMAGE), m_attackType(dmgInfo.attackType) m_resist = 0; m_block = 0; } + void DamageInfo::ModifyDamage(int32 amount) { amount = std::min(amount, int32(GetDamage())); m_damage += amount; } + void DamageInfo::AbsorbDamage(uint32 amount) { amount = std::min(amount, GetDamage()); m_absorb += amount; m_damage -= amount; } + void DamageInfo::ResistDamage(uint32 amount) { amount = std::min(amount, GetDamage()); m_resist += amount; m_damage -= amount; } + void DamageInfo::BlockDamage(uint32 amount) { amount = std::min(amount, GetDamage()); @@ -158,7 +164,7 @@ m_HostileRefManager(this) m_objectType |= TYPEMASK_UNIT; m_objectTypeId = TYPEID_UNIT; - m_updateFlag = (UPDATEFLAG_LIVING | UPDATEFLAG_HAS_POSITION); + m_updateFlag = (UPDATEFLAG_LIVING | UPDATEFLAG_STATIONARY_POSITION); m_attackTimer[BASE_ATTACK] = 0; m_attackTimer[OFF_ATTACK] = 0; @@ -246,6 +252,7 @@ m_HostileRefManager(this) _focusSpell = NULL; _targetLocked = false; + _lastLiquid = NULL; } //////////////////////////////////////////////////////////// @@ -430,7 +437,7 @@ void Unit::SendMonsterMoveTransport(Unit* vehicleOwner) data.append(GetPackGUID()); data.append(vehicleOwner->GetPackGUID()); data << int8(GetTransSeat()); - data << uint8(GetTypeId() == TYPEID_PLAYER ? 1 : 0); // boolean + data << uint8(0); data << GetPositionX() - vehicleOwner->GetPositionX(); data << GetPositionY() - vehicleOwner->GetPositionY(); data << GetPositionZ() - vehicleOwner->GetPositionZ(); @@ -453,7 +460,8 @@ void Unit::resetAttackTimer(WeaponAttackType type) bool Unit::IsWithinCombatRange(const Unit* obj, float dist2compare) const { - if (!obj || !IsInMap(obj)) return false; + if (!obj || !IsInMap(obj) || !InSamePhase(obj)) + return false; float dx = GetPositionX() - obj->GetPositionX(); float dy = GetPositionY() - obj->GetPositionY(); @@ -468,7 +476,8 @@ bool Unit::IsWithinCombatRange(const Unit* obj, float dist2compare) const bool Unit::IsWithinMeleeRange(const Unit* obj, float dist) const { - if (!obj || !IsInMap(obj)) return false; + if (!obj || !IsInMap(obj) || !InSamePhase(obj)) + return false; float dx = GetPositionX() - obj->GetPositionX(); float dy = GetPositionY() - obj->GetPositionY(); @@ -564,6 +573,15 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam if (IsAIEnabled) GetAI()->DamageDealt(victim, damage, damagetype); + // Signal to pets that their owner was attacked + if (victim->GetTypeId() == TYPEID_PLAYER) + { + Pet* pet = victim->ToPlayer()->GetPet(); + + if (pet && pet->isAlive()) + pet->AI()->OwnerDamagedBy(this); + } + if (damagetype != NODAMAGE) { // interrupting auras with AURA_INTERRUPT_FLAG_DAMAGE before checking !damage (absorbed damage breaks that type of auras) @@ -661,7 +679,7 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam duel_hasEnded = true; } - else if (victim->IsVehicle() && damage >= (health-1) && victim->GetCharmer() && victim->GetCharmer()->GetTypeId() == TYPEID_PLAYER) + else if (victim->IsVehicle() && damage >= (health-1) && victim->GetCharmer() && victim->GetCharmer()->GetTypeId() == TYPEID_PLAYER) { Player* victimRider = victim->GetCharmer()->ToPlayer(); @@ -784,20 +802,9 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam // last damage from duel opponent if (duel_hasEnded) { - Player* he; - - if (duel_wasMounted) - { - ASSERT(victim->GetCharmer()->GetTypeId() == TYPEID_PLAYER); - he = victim->GetCharmer()->ToPlayer(); - } - else - { - ASSERT(victim->GetTypeId() == TYPEID_PLAYER); - he = victim->ToPlayer(); - } + Player* he = duel_wasMounted ? victim->GetCharmer()->ToPlayer() : victim->ToPlayer(); - ASSERT(he->duel); + ASSERT(he && he->duel); if (duel_wasMounted) // In this case victim==mount victim->SetHealth(1); @@ -946,7 +953,9 @@ uint32 Unit::SpellNonMeleeDamageLog(Unit* victim, uint32 spellID, uint32 damage) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellID); SpellNonMeleeDamage damageInfo(this, victim, spellInfo->Id, spellInfo->SchoolMask); - damage = SpellDamageBonus(victim, spellInfo, damage, SPELL_DIRECT_DAMAGE); + damage = SpellDamageBonusDone(victim, spellInfo, damage, SPELL_DIRECT_DAMAGE); + damage = victim->SpellDamageBonusTaken(this, spellInfo, damage, SPELL_DIRECT_DAMAGE); + CalculateSpellDamageTaken(&damageInfo, damage, spellInfo); DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb); SendSpellNonMeleeDamageLog(&damageInfo); @@ -1107,6 +1116,7 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam if (!victim) return; + if (!isAlive() || !victim->isAlive()) return; @@ -1116,12 +1126,11 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam case BASE_ATTACK: damageInfo->procAttacker = PROC_FLAG_DONE_MELEE_AUTO_ATTACK | PROC_FLAG_DONE_MAINHAND_ATTACK; damageInfo->procVictim = PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK; - damageInfo->HitInfo = HITINFO_NORMALSWING2; break; case OFF_ATTACK: damageInfo->procAttacker = PROC_FLAG_DONE_MELEE_AUTO_ATTACK | PROC_FLAG_DONE_OFFHAND_ATTACK; damageInfo->procVictim = PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK; - damageInfo->HitInfo = HITINFO_LEFTSWING; + damageInfo->HitInfo = HITINFO_OFFHAND; break; default: return; @@ -1141,7 +1150,8 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam damage += CalculateDamage(damageInfo->attackType, false, true); // Add melee damage bonus - MeleeDamageBonus(damageInfo->target, &damage, damageInfo->attackType); + damage = MeleeDamageBonusDone(damageInfo->target, damage, damageInfo->attackType); + damage = damageInfo->target->MeleeDamageBonusTaken(this, damage, damageInfo->attackType); // Calculate armor reduction if (IsDamageReducedByArmor((SpellSchoolMask)(damageInfo->damageSchoolMask))) @@ -1157,29 +1167,29 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam switch (damageInfo->hitOutCome) { case MELEE_HIT_EVADE: - damageInfo->HitInfo |= HITINFO_MISS|HITINFO_SWINGNOHITSOUND; - damageInfo->TargetState = VICTIMSTATE_EVADES; - damageInfo->procEx|=PROC_EX_EVADE; + damageInfo->HitInfo |= HITINFO_MISS | HITINFO_SWINGNOHITSOUND; + damageInfo->TargetState = VICTIMSTATE_EVADES; + damageInfo->procEx |= PROC_EX_EVADE; damageInfo->damage = 0; damageInfo->cleanDamage = 0; return; case MELEE_HIT_MISS: - damageInfo->HitInfo |= HITINFO_MISS; - damageInfo->TargetState = VICTIMSTATE_INTACT; - damageInfo->procEx |= PROC_EX_MISS; - damageInfo->damage = 0; - damageInfo->cleanDamage = 0; + damageInfo->HitInfo |= HITINFO_MISS; + damageInfo->TargetState = VICTIMSTATE_INTACT; + damageInfo->procEx |= PROC_EX_MISS; + damageInfo->damage = 0; + damageInfo->cleanDamage = 0; break; case MELEE_HIT_NORMAL: - damageInfo->TargetState = VICTIMSTATE_HIT; - damageInfo->procEx|=PROC_EX_NORMAL_HIT; + damageInfo->TargetState = VICTIMSTATE_HIT; + damageInfo->procEx |= PROC_EX_NORMAL_HIT; break; case MELEE_HIT_CRIT: { - damageInfo->HitInfo |= HITINFO_CRITICALHIT; - damageInfo->TargetState = VICTIMSTATE_HIT; + damageInfo->HitInfo |= HITINFO_CRITICALHIT; + damageInfo->TargetState = VICTIMSTATE_HIT; - damageInfo->procEx |= PROC_EX_CRITICAL_HIT; + damageInfo->procEx |= PROC_EX_CRITICAL_HIT; // Crit bonus calc damageInfo->damage += damageInfo->damage; float mod = 0.0f; @@ -1240,8 +1250,8 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam if (leveldif > 3) leveldif = 3; float reducePercent = 1 - leveldif * 0.1f; - damageInfo->cleanDamage += damageInfo->damage-uint32(reducePercent * damageInfo->damage); - damageInfo->damage = uint32(reducePercent * damageInfo->damage); + damageInfo->cleanDamage += damageInfo->damage - uint32(reducePercent * damageInfo->damage); + damageInfo->damage = uint32(reducePercent * damageInfo->damage); break; } case MELEE_HIT_CRUSHING: @@ -1255,6 +1265,10 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam break; } + // Always apply HITINFO_AFFECTS_VICTIM in case its not a miss + if (!(damageInfo->HitInfo & HITINFO_MISS)) + damageInfo->HitInfo |= HITINFO_AFFECTS_VICTIM; + int32 resilienceReduction = damageInfo->damage; if (attackType != RANGED_ATTACK) ApplyResilience(victim, NULL, &resilienceReduction, (damageInfo->hitOutCome == MELEE_HIT_CRIT), CR_CRIT_TAKEN_MELEE); @@ -1270,14 +1284,17 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam damageInfo->procVictim |= PROC_FLAG_TAKEN_DAMAGE; // Calculate absorb & resists CalcAbsorbResist(damageInfo->target, SpellSchoolMask(damageInfo->damageSchoolMask), DIRECT_DAMAGE, damageInfo->damage, &damageInfo->absorb, &damageInfo->resist); - damageInfo->damage -= damageInfo->absorb + damageInfo->resist; + if (damageInfo->absorb) { - damageInfo->HitInfo |= HITINFO_ABSORB; + damageInfo->HitInfo |= (damageInfo->damage - damageInfo->absorb == 0 ? HITINFO_FULL_ABSORB : HITINFO_PARTIAL_ABSORB); damageInfo->procEx |= PROC_EX_ABSORB; } + if (damageInfo->resist) - damageInfo->HitInfo |= HITINFO_RESIST; + damageInfo->HitInfo |= (damageInfo->damage - damageInfo->resist == 0 ? HITINFO_FULL_RESIST : HITINFO_PARTIAL_RESIST); + + damageInfo->damage -= damageInfo->absorb + damageInfo->resist; } else // Impossible get negative result but.... damageInfo->damage = 0; @@ -1386,7 +1403,10 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss) uint32 damage = (*dmgShieldItr)->GetAmount(); if (Unit* caster = (*dmgShieldItr)->GetCaster()) - damage = caster->SpellDamageBonus(this, i_spellProto, damage, SPELL_DIRECT_DAMAGE); + { + damage = caster->SpellDamageBonusDone(this, i_spellProto, damage, SPELL_DIRECT_DAMAGE); + damage = this->SpellDamageBonusTaken(caster, i_spellProto, damage, SPELL_DIRECT_DAMAGE); + } // No Unit::CalcAbsorbResist here - opcode doesn't send that data - this damage is probably not affected by that victim->DealDamageMods(this, damage, NULL); @@ -1478,8 +1498,8 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo if (GetTypeId() == TYPEID_PLAYER) { float bonusPct = 0; - AuraEffectList const& ResIgnoreAuras = GetAuraEffectsByType(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT); - for (AuraEffectList::const_iterator itr = ResIgnoreAuras.begin(); itr != ResIgnoreAuras.end(); ++itr) + AuraEffectList const& armorPenAuras = GetAuraEffectsByType(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT); + for (AuraEffectList::const_iterator itr = armorPenAuras.begin(); itr != armorPenAuras.end(); ++itr) { if ((*itr)->GetSpellInfo()->EquippedItemClass == -1) { @@ -1490,7 +1510,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo } else { - if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*itr)->GetSpellInfo())) + if (ToPlayer()->HasItemFitToSpellRequirements((*itr)->GetSpellInfo())) bonusPct += (*itr)->GetAmount(); } } @@ -1500,6 +1520,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo maxArmorPen = float(400 + 85 * victim->getLevel()); else maxArmorPen = 400 + 85 * victim->getLevel() + 4.5f * 85 * (victim->getLevel() - 59); + // Cap armor penetration to this number maxArmorPen = std::min((armor + maxArmorPen) / 3, armor); // Figure out how much armor do we ignore @@ -1536,7 +1557,8 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe DamageInfo dmgInfo = DamageInfo(this, victim, damage, spellInfo, schoolMask, damagetype); // Magic damage, check for resists - if ((schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0) + // Ignore spells that cant be resisted + if ((schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0 && (!spellInfo || (spellInfo->AttributesEx4 & SPELL_ATTR4_IGNORE_RESISTANCES) == 0)) { float victimResistance = float(victim->GetResistance(schoolMask)); victimResistance += float(GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask)); @@ -2023,7 +2045,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT else parry_chance -= GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE) * 25; - if (victim->GetTypeId() == TYPEID_PLAYER || !(victim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_PARRY)) + if (victim->GetTypeId() == TYPEID_PLAYER || !(victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_PARRY)) { int32 tmp2 = int32(parry_chance); if (tmp2 > 0 // check if unit _can_ parry @@ -2035,7 +2057,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT } } - if (victim->GetTypeId() == TYPEID_PLAYER || !(victim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK)) + if (victim->GetTypeId() == TYPEID_PLAYER || !(victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK)) { tmp = block_chance; if (tmp > 0 // check if unit _can_ block @@ -2054,7 +2076,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT if (tmp > 0 && roll < (sum += tmp)) { sLog->outStaticDebug ("RollMeleeOutcomeAgainst: CRIT <%d, %d)", sum-tmp, sum); - if (GetTypeId() == TYPEID_UNIT && (ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRIT)) + if (GetTypeId() == TYPEID_UNIT && (ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRIT)) sLog->outStaticDebug ("RollMeleeOutcomeAgainst: CRIT DISABLED)"); else return MELEE_HIT_CRIT; @@ -2084,7 +2106,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT if (getLevelForTarget(victim) >= victim->getLevelForTarget(this) + 4 && // can be from by creature (if can) or from controlled player that considered as creature !IsControlledByPlayer() && - !(GetTypeId() == TYPEID_UNIT && ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRUSH)) + !(GetTypeId() == TYPEID_UNIT && ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRUSH)) { // when their weapon skill is 15 or more above victim's defense skill tmp = victimDefenseSkill; @@ -2177,8 +2199,8 @@ void Unit::SendMeleeAttackStop(Unit* victim) { WorldPacket data(SMSG_ATTACKSTOP, (8+8+4)); data.append(GetPackGUID()); - data.append(victim ? victim->GetPackGUID() : 0); // can be 0x00... - data << uint32(0); // can be 0x1 + data.append(victim ? victim->GetPackGUID() : 0); + data << uint32(0); //! Can also take the value 0x01, which seems related to updating rotation SendMessageToSet(&data, true); sLog->outStaticDebug("WORLD: Sent SMSG_ATTACKSTOP"); @@ -2198,7 +2220,7 @@ bool Unit::isSpellBlocked(Unit* victim, SpellInfo const* spellProto, WeaponAttac { // Check creatures flags_extra for disable block if (victim->GetTypeId() == TYPEID_UNIT && - victim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK) + victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK) return false; float blockChance = victim->GetUnitBlockChance(); @@ -2336,7 +2358,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spell) // Check creatures flags_extra for disable parry if (victim->GetTypeId() == TYPEID_UNIT) { - uint32 flagEx = victim->ToCreature()->GetCreatureInfo()->flags_extra; + uint32 flagEx = victim->ToCreature()->GetCreatureTemplate()->flags_extra; if (flagEx & CREATURE_FLAG_EXTRA_NO_PARRY) canParry = false; // Check creatures flags_extra for disable block @@ -2887,7 +2909,8 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell) CurrentSpellTypes CSpellType = pSpell->GetCurrentContainer(); - if (pSpell == m_currentSpells[CSpellType]) return; // avoid breaking self + if (pSpell == m_currentSpells[CSpellType]) // avoid breaking self + return; // break same type spell if it is not delayed InterruptSpell(CSpellType, false); @@ -3008,20 +3031,20 @@ bool Unit::IsNonMeleeSpellCasted(bool withDelayed, bool skipChanneled, bool skip (withDelayed || m_currentSpells[CURRENT_GENERIC_SPELL]->getState() != SPELL_STATE_DELAYED)) { if (!isAutoshoot || !(m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->AttributesEx2 & SPELL_ATTR2_NOT_RESET_AUTO_ACTIONS)) - return(true); + return true; } // channeled spells may be delayed, but they are still considered casted else if (!skipChanneled && m_currentSpells[CURRENT_CHANNELED_SPELL] && (m_currentSpells[CURRENT_CHANNELED_SPELL]->getState() != SPELL_STATE_FINISHED)) { if (!isAutoshoot || !(m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->AttributesEx2 & SPELL_ATTR2_NOT_RESET_AUTO_ACTIONS)) - return(true); + return true; } // autorepeat spells may be finished or delayed, but they are still considered casted else if (!skipAutorepeat && m_currentSpells[CURRENT_AUTOREPEAT_SPELL]) - return(true); + return true; - return(false); + return false; } void Unit::InterruptNonMeleeSpells(bool withDelayed, uint32 spell_id, bool withInstant) @@ -3069,7 +3092,7 @@ bool Unit::isInAccessiblePlaceFor(Creature const* c) const if (IsInWater()) return c->canSwim(); else - return c->canWalk() || c->canFly(); + return c->canWalk() || c->CanFly(); } bool Unit::IsInWater() const @@ -3082,6 +3105,48 @@ bool Unit::IsUnderWater() const return GetBaseMap()->IsUnderWater(GetPositionX(), GetPositionY(), GetPositionZ()); } +void Unit::UpdateUnderwaterState(Map* m, float x, float y, float z) +{ + if (!isPet() && !IsVehicle()) + return; + + LiquidData liquid_status; + ZLiquidStatus res = m->getLiquidStatus(x, y, z, MAP_ALL_LIQUIDS, &liquid_status); + if (!res) + { + if (_lastLiquid && _lastLiquid->SpellId) + RemoveAurasDueToSpell(_lastLiquid->SpellId); + + RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_UNDERWATER); + _lastLiquid = NULL; + return; + } + + if (uint32 liqEntry = liquid_status.entry) + { + LiquidTypeEntry const* liquid = sLiquidTypeStore.LookupEntry(liqEntry); + if (_lastLiquid && _lastLiquid->SpellId && _lastLiquid->Id != liqEntry) + RemoveAurasDueToSpell(_lastLiquid->SpellId); + + if (liquid && liquid->SpellId) + { + if (res & (LIQUID_MAP_UNDER_WATER | LIQUID_MAP_IN_WATER)) + CastSpell(this, liquid->SpellId, true); + else + RemoveAurasDueToSpell(liquid->SpellId); + } + + RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_ABOVEWATER); + _lastLiquid = liquid; + } + else if (_lastLiquid && _lastLiquid->SpellId) + { + RemoveAurasDueToSpell(_lastLiquid->SpellId); + RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_UNDERWATER); + _lastLiquid = NULL; + } +} + void Unit::DeMorph() { SetDisplayId(GetNativeDisplayId()); @@ -3254,7 +3319,7 @@ void Unit::_ApplyAura(AuraApplication * aurApp, uint8 effMask) aura->HandleAuraSpecificMods(aurApp, caster, true, false); // apply effects of the aura - for (uint8 i = 0 ; i < MAX_SPELL_EFFECTS; ++i) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { if (effMask & 1<<i && (!aurApp->GetRemoveMode())) aurApp->_HandleEffect(i, true); @@ -3313,7 +3378,7 @@ void Unit::_UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMo aura->_UnapplyForTarget(this, caster, aurApp); // remove effects of the spell - needs to be done after removing aura from lists - for (uint8 itr = 0 ; itr < MAX_SPELL_EFFECTS; ++itr) + for (uint8 itr = 0; itr < MAX_SPELL_EFFECTS; ++itr) { if (aurApp->HasEffect(itr)) aurApp->_HandleEffect(itr, false); @@ -3490,7 +3555,7 @@ void Unit::RemoveAura(AuraApplication * aurApp, AuraRemoveMode mode) if (aurApp->GetRemoveMode()) { // remove remaining effects of an aura - for (uint8 itr = 0 ; itr < MAX_SPELL_EFFECTS; ++itr) + for (uint8 itr = 0; itr < MAX_SPELL_EFFECTS; ++itr) { if (aurApp->HasEffect(itr)) aurApp->_HandleEffect(itr, false); @@ -3601,8 +3666,12 @@ void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId { // final heal int32 healAmount = aurEff->GetAmount(); - int32 stack = dispelInfo.GetRemovedCharges(); - CastCustomSpell(this, 33778, &healAmount, &stack, NULL, true, NULL, NULL, aura->GetCasterGUID()); + if (Unit* caster = aura->GetCaster()) + { + healAmount = caster->SpellHealingBonusDone(this, aura->GetSpellInfo(), healAmount, HEAL, dispelInfo.GetRemovedCharges()); + healAmount = this->SpellHealingBonusTaken(caster, aura->GetSpellInfo(), healAmount, HEAL, dispelInfo.GetRemovedCharges()); + } + CastCustomSpell(this, 33778, &healAmount, NULL, NULL, true, NULL, NULL, aura->GetCasterGUID()); // mana if (Unit* caster = aura->GetCaster()) @@ -4133,6 +4202,45 @@ Aura* Unit::GetAuraOfRankedSpell(uint32 spellId, uint64 casterGUID, uint64 itemC return aurApp ? aurApp->GetBase() : NULL; } +void Unit::GetDispellableAuraList(Unit* caster, uint32 dispelMask, DispelChargesList& dispelList) +{ + // we should not be able to dispel diseases if the target is affected by unholy blight + if (dispelMask & (1 << DISPEL_DISEASE) && HasAura(50536)) + dispelMask &= ~(1 << DISPEL_DISEASE); + + AuraMap const& auras = GetOwnedAuras(); + for (AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) + { + Aura* aura = itr->second; + AuraApplication * aurApp = aura->GetApplicationOfTarget(GetGUID()); + if (!aurApp) + continue; + + // don't try to remove passive auras + if (aura->IsPassive()) + continue; + + if (aura->GetSpellInfo()->GetDispelMask() & dispelMask) + { + if (aura->GetSpellInfo()->Dispel == DISPEL_MAGIC) + { + // do not remove positive auras if friendly target + // negative auras if non-friendly target + if (aurApp->IsPositive() == IsFriendlyTo(caster)) + continue; + } + + // The charges / stack amounts don't count towards the total number of auras that can be dispelled. + // Ie: A dispel on a target with 5 stacks of Winters Chill and a Polymorph has 1 / (1 + 1) -> 50% chance to dispell + // Polymorph instead of 1 / (5 + 1) -> 16%. + bool dispel_charges = aura->GetSpellInfo()->AttributesEx7 & SPELL_ATTR7_DISPEL_CHARGES; + uint8 charges = dispel_charges ? aura->GetCharges() : aura->GetStackAmount(); + if (charges > 0) + dispelList.push_back(std::make_pair(aura, charges)); + } + } +} + bool Unit::HasAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster) const { for (AuraApplicationMap::const_iterator itr = m_appliedAuras.lower_bound(spellId); itr != m_appliedAuras.upper_bound(spellId); ++itr) @@ -4389,9 +4497,7 @@ float Unit::GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask } // Add the highest of the Same Effect Stack Rule SpellGroups to the multiplier for (std::map<SpellGroup, int32>::const_iterator itr = SameEffectSpellGroup.begin(); itr != SameEffectSpellGroup.end(); ++itr) - { AddPctN(multiplier, itr->second); - } return multiplier; } @@ -4426,27 +4532,39 @@ int32 Unit::GetMaxNegativeAuraModifierByMiscMask(AuraType auratype, uint32 misc_ int32 Unit::GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const { + std::map<SpellGroup, int32> SameEffectSpellGroup; int32 modifier = 0; AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype); for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) { if ((*i)->GetMiscValue() == misc_value) - modifier += (*i)->GetAmount(); + if (!sSpellMgr->AddSameEffectStackRuleSpellGroups((*i)->GetSpellInfo(), (*i)->GetAmount(), SameEffectSpellGroup)) + modifier += (*i)->GetAmount(); } + + for (std::map<SpellGroup, int32>::const_iterator itr = SameEffectSpellGroup.begin(); itr != SameEffectSpellGroup.end(); ++itr) + modifier += itr->second; + return modifier; } float Unit::GetTotalAuraMultiplierByMiscValue(AuraType auratype, int32 misc_value) const { + std::map<SpellGroup, int32> SameEffectSpellGroup; float multiplier = 1.0f; AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype); for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) { if ((*i)->GetMiscValue() == misc_value) - AddPctN(multiplier, (*i)->GetAmount()); + if (!sSpellMgr->AddSameEffectStackRuleSpellGroups((*i)->GetSpellInfo(), (*i)->GetAmount(), SameEffectSpellGroup)) + AddPctN(multiplier, (*i)->GetAmount()); } + + for (std::map<SpellGroup, int32>::const_iterator itr = SameEffectSpellGroup.begin(); itr != SameEffectSpellGroup.end(); ++itr) + AddPctN(multiplier, itr->second); + return multiplier; } @@ -4480,27 +4598,39 @@ int32 Unit::GetMaxNegativeAuraModifierByMiscValue(AuraType auratype, int32 misc_ int32 Unit::GetTotalAuraModifierByAffectMask(AuraType auratype, SpellInfo const* affectedSpell) const { + std::map<SpellGroup, int32> SameEffectSpellGroup; int32 modifier = 0; AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype); for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) { if ((*i)->IsAffectingSpell(affectedSpell)) - modifier += (*i)->GetAmount(); + if (!sSpellMgr->AddSameEffectStackRuleSpellGroups((*i)->GetSpellInfo(), (*i)->GetAmount(), SameEffectSpellGroup)) + modifier += (*i)->GetAmount(); } + + for (std::map<SpellGroup, int32>::const_iterator itr = SameEffectSpellGroup.begin(); itr != SameEffectSpellGroup.end(); ++itr) + modifier += itr->second; + return modifier; } float Unit::GetTotalAuraMultiplierByAffectMask(AuraType auratype, SpellInfo const* affectedSpell) const { + std::map<SpellGroup, int32> SameEffectSpellGroup; float multiplier = 1.0f; AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype); for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) { if ((*i)->IsAffectingSpell(affectedSpell)) - AddPctN(multiplier, (*i)->GetAmount()); + if (!sSpellMgr->AddSameEffectStackRuleSpellGroups((*i)->GetSpellInfo(), (*i)->GetAmount(), SameEffectSpellGroup)) + AddPctN(multiplier, (*i)->GetAmount()); } + + for (std::map<SpellGroup, int32>::const_iterator itr = SameEffectSpellGroup.begin(); itr != SameEffectSpellGroup.end(); ++itr) + AddPctN(multiplier, itr->second); + return multiplier; } @@ -4589,7 +4719,9 @@ GameObject* Unit::GetGameObject(uint32 spellId) const void Unit::AddGameObject(GameObject* gameObj) { - if (!gameObj || !gameObj->GetOwnerGUID() == 0) return; + if (!gameObj || !gameObj->GetOwnerGUID() == 0) + return; + m_gameObj.push_back(gameObj); gameObj->SetOwnerGUID(GetGUID()); @@ -4605,7 +4737,8 @@ void Unit::AddGameObject(GameObject* gameObj) void Unit::RemoveGameObject(GameObject* gameObj, bool del) { - if (!gameObj || !gameObj->GetOwnerGUID() == GetGUID()) return; + if (!gameObj || gameObj->GetOwnerGUID() != GetGUID()) + return; gameObj->SetOwnerGUID(0); @@ -4826,28 +4959,29 @@ void Unit::SendAttackStateUpdate(CalcDamageInfo* damageInfo) data << uint32(damageInfo->damage); // Sub Damage } - if (damageInfo->HitInfo & (HITINFO_ABSORB | HITINFO_ABSORB2)) + if (damageInfo->HitInfo & (HITINFO_FULL_ABSORB | HITINFO_PARTIAL_ABSORB)) { for (uint32 i = 0; i < count; ++i) data << uint32(damageInfo->absorb); // Absorb } - if (damageInfo->HitInfo & (HITINFO_RESIST | HITINFO_RESIST2)) + if (damageInfo->HitInfo & (HITINFO_FULL_RESIST | HITINFO_PARTIAL_RESIST)) { for (uint32 i = 0; i < count; ++i) data << uint32(damageInfo->resist); // Resist } data << uint8(damageInfo->TargetState); - data << uint32(0); - data << uint32(0); + data << uint32(0); // Unknown attackerstate + data << uint32(0); // Melee spellid if (damageInfo->HitInfo & HITINFO_BLOCK) data << uint32(damageInfo->blocked_amount); - if (damageInfo->HitInfo & HITINFO_UNK3) + if (damageInfo->HitInfo & HITINFO_RAGE_GAIN) data << uint32(0); + //! Probably used for debugging purposes, as it is not known to appear on retail servers if (damageInfo->HitInfo & HITINFO_UNK1) { data << uint32(0); @@ -5492,6 +5626,13 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere } break; } + case 71875: // Item - Black Bruise: Necrotic Touch Proc + case 71877: + { + basepoints0 = CalculatePctN(int32(damage), triggerAmount); + triggered_spell_id = 71879; + break; + } // Item - Shadowmourne Legendary case 71903: { @@ -5673,7 +5814,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // Glyph of Polymorph case 56375: { - if(!target) + if (!target) return false; target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE, 0, target->GetAura(32409)); // SW:D shall not be removed. target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT); @@ -5732,13 +5873,13 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // Blessing of Ancient Kings (Val'anyr, Hammer of Ancient Kings) case 64411: { - if(!victim) + if (!victim) return false; basepoints0 = int32(CalculatePctN(damage, 15)); if (AuraEffect* aurEff = victim->GetAuraEffect(64413, 0, GetGUID())) { // The shield can grow to a maximum size of 20, 000 damage absorbtion - aurEff->SetAmount(std::max<int32>(aurEff->GetAmount() + basepoints0, 20000)); + aurEff->SetAmount(std::min<int32>(aurEff->GetAmount() + basepoints0, 20000)); // Refresh and return to prevent replacing the aura aurEff->GetBase()->RefreshDuration(); @@ -5920,6 +6061,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // Siphon Life case 63108: { + if (!damage) + break; // Glyph of Siphon Life if (HasAura(56216)) triggerAmount += triggerAmount / 4; @@ -6043,7 +6186,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // Divine Aegis if (dummySpell->SpellIconID == 2820) { - if(!target) + if (!target) return false; // Multiple effects stack, so let's try to find this aura. @@ -6213,7 +6356,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // Glyph of Shred case 54815: { - if(!target) + if (!target) return false; // try to find spell Rip on the target @@ -6519,7 +6662,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // Explosive Shot if (procSpell->SpellFamilyFlags[2] & 0x200) { - if(!victim) + if (!victim) return false; if (AuraEffect const* pEff = victim->GetAuraEffect(SPELL_AURA_PERIODIC_DUMMY, SPELLFAMILY_HUNTER, 0x0, 0x80000000, 0x0, GetGUID())) basepoints0 = pEff->GetSpellInfo()->CalcPowerCost(this, SpellSchoolMask(pEff->GetSpellInfo()->SchoolMask)) * 4/10/3; @@ -6576,9 +6719,11 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere { case 34477: // Misdirection { + if (!GetMisdirectionTarget()) + return false; triggered_spell_id = 35079; // 4 sec buff on self target = this; - return true; + break; } case 57870: // Glyph of Mend Pet { @@ -6597,8 +6742,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere return false; triggered_spell_id = 25742; float ap = GetTotalAttackPowerValue(BASE_ATTACK); - int32 holy = SpellBaseDamageBonus(SPELL_SCHOOL_MASK_HOLY) + - SpellBaseDamageBonusForVictim(SPELL_SCHOOL_MASK_HOLY, victim); + int32 holy = SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_HOLY) + + victim->SpellBaseDamageBonusTaken(SPELL_SCHOOL_MASK_HOLY); basepoints0 = (int32)GetAttackTime(BASE_ATTACK) * int32(ap * 0.022f + 0.044f * holy) / 1000; break; } @@ -7230,30 +7375,16 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere if (procSpell->SpellIconID != 2019) return false; - AuraEffect* aurEffA = NULL; - AuraEffectList const& auras = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE); - for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i) + if (Creature* totem = GetMap()->GetCreature(m_SummonSlot[1])) // Fire totem summon slot { - SpellInfo const* spell = (*i)->GetSpellInfo(); - if (spell->SpellFamilyName == uint32(SPELLFAMILY_SHAMAN) && spell->SpellFamilyFlags.HasFlag(0, 0x02000000, 0)) + if (SpellInfo const* totemSpell = sSpellMgr->GetSpellInfo(totem->m_spells[0])) { - if ((*i)->GetCasterGUID() != GetGUID()) - continue; - if (spell->Id == 63283) - continue; - aurEffA = (*i); - break; + int32 bp0 = CalculatePctN(totemSpell->Effects[EFFECT_0].CalcValue(), triggerAmount); + int32 bp1 = CalculatePctN(totemSpell->Effects[EFFECT_1].CalcValue(), triggerAmount); + CastCustomSpell(this, 63283, &bp0, &bp1, NULL, true); + return true; } } - if (aurEffA) - { - int32 bp0 = 0, bp1 = 0; - bp0 = CalculatePctN(triggerAmount, aurEffA->GetAmount()); - if (AuraEffect* aurEffB = aurEffA->GetBase()->GetEffect(EFFECT_1)) - bp1 = CalculatePctN(triggerAmount, aurEffB->GetAmount()); - CastCustomSpell(this, 63283, &bp0, &bp1, NULL, true, NULL, triggeredByAura); - return true; - } return false; } break; @@ -7272,20 +7403,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere triggered_spell_id = 63685; break; } - // Storm, Earth and Fire - if (dummySpell->SpellIconID == 3063) - { - // Earthbind Totem summon only - if (procSpell->Id != 2484) - return false; - - float chance = (float)triggerAmount; - if (!roll_chance_f(chance)) - return false; - - triggered_spell_id = 64695; - break; - } // Ancestral Awakening if (dummySpell->SpellIconID == 3065) { @@ -7314,8 +7431,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere if (GetTypeId() != TYPEID_PLAYER || !victim || !victim->isAlive() || !castItem || !castItem->IsEquipped()) return false; - Player* player = ToPlayer(); - WeaponAttackType attType = WeaponAttackType(player->GetAttackBySlot(castItem->GetSlot())); + WeaponAttackType attType = WeaponAttackType(Player::GetAttackBySlot(castItem->GetSlot())); if ((attType != BASE_ATTACK && attType != OFF_ATTACK) || (attType == BASE_ATTACK && procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK) || (attType == OFF_ATTACK && procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK)) @@ -7323,8 +7439,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere float fire_onhit = float(CalculatePctF(dummySpell->Effects[EFFECT_0]. CalcValue(), 1.0f)); - float add_spellpower = (float)(SpellBaseDamageBonus(SPELL_SCHOOL_MASK_FIRE) - + SpellBaseDamageBonusForVictim(SPELL_SCHOOL_MASK_FIRE, victim)); + float add_spellpower = (float)(SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE) + + victim->SpellBaseDamageBonusTaken(SPELL_SCHOOL_MASK_FIRE)); // 1.3speed = 5%, 2.6speed = 10%, 4.0 speed = 15%, so, 1.0speed = 3.84% ApplyPctF(add_spellpower, 3.84f); @@ -7665,17 +7781,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere } } } - // Item - Death Knight T10 Melee 4P Bonus - if (dummySpell->Id == 70656) - { - Player* player = ToPlayer(); - if (!player) - return false; - - for (uint32 i = 0; i < MAX_RUNES; ++i) - if (player->GetRuneCooldown(i) == 0) - return false; - } break; } case SPELLFAMILY_POTION: @@ -7903,11 +8008,7 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp for (uint8 i = 1; i < stack; ++i) dmg += mod * stack; if (Unit* caster = triggeredByAura->GetCaster()) - { caster->CastCustomSpell(70701, SPELLVALUE_BASE_POINT0, dmg); - if (Creature* creature = caster->ToCreature()) - creature->DespawnOrUnsummon(1); - } break; } // Ball of Flames Proc @@ -7947,7 +8048,7 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp *handled = true; if (victim && victim->HasAura(53601)) { - int32 bp0 = CalculatePctN(int32(damage / 12), dummySpell->Effects[EFFECT_2]. CalcValue()); + int32 bp0 = CalculatePctN(int32(damage / 12), dummySpell->Effects[EFFECT_2].CalcValue()); // Item - Paladin T9 Holy 4P Bonus if (AuraEffect const* aurEff = GetAuraEffect(67191, 0)) AddPctN(bp0, aurEff->GetAmount()); @@ -7972,10 +8073,10 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp { *handled = true; // Check if we are the target and prevent mana gain - if (triggeredByAura->GetCasterGUID() == victim->GetGUID()) + if (victim && triggeredByAura->GetCasterGUID() == victim->GetGUID()) return false; // Lookup base amount mana restore - for (uint8 i = 0; i<MAX_SPELL_EFFECTS; i++) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; i++) { if (procSpell->Effects[i].Effect == SPELL_EFFECT_ENERGIZE) { @@ -8118,6 +8219,16 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp CastCustomSpell(this, 70845, &basepoints0, NULL, NULL, true); break; } + // Recklessness + case 1719: + { + //! Possible hack alert + //! Don't drop charges on proc, they will be dropped on SpellMod removal + //! Before this change, it was dropping two charges per attack, one in ProcDamageAndSpellFor, and one in RemoveSpellMods. + //! The reason of this behaviour is Recklessness having three auras, 2 of them can not proc (isTriggeredAura array) but the other one can, making the whole spell proc. + *handled = true; + break; + } default: break; } @@ -8241,6 +8352,12 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg RemoveAuraFromStack(auraSpellInfo->Id); return false; } + if (auraSpellInfo->Id == 50720) + { + target = triggeredByAura->GetCaster(); + if (!target) + return false; + } break; case SPELLFAMILY_WARLOCK: { @@ -8591,6 +8708,36 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg trigger_spell_id = 50475; basepoints0 = CalculatePctN(int32(damage), triggerAmount); } + // Item - Death Knight T10 Melee 4P Bonus + else if (auraSpellInfo->Id == 70656) + { + if (GetTypeId() != TYPEID_PLAYER || getClass() != CLASS_DEATH_KNIGHT) + return false; + + for (uint8 i = 0; i < MAX_RUNES; ++i) + if (ToPlayer()->GetRuneCooldown(i) == 0) + return false; + } + break; + } + case SPELLFAMILY_ROGUE: + { + switch (auraSpellInfo->Id) + { + // Rogue T10 2P bonus, should only proc on caster + case 70805: + { + if (victim != this) + return false; + break; + } + // Rogue T10 4P bonus, should proc on victim + case 70803: + { + target = victim; + break; + } + } break; } default: @@ -8757,7 +8904,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg } // Blade Barrier - if (auraSpellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && auraSpellInfo->SpellIconID == 85) + if (auraSpellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && auraSpellInfo->SpellIconID == 85 && procSpell) { Player* player = ToPlayer(); if (!player || player->getClass() != CLASS_DEATH_KNIGHT) @@ -8863,7 +9010,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg { if (AuraEffect* aurEff = owner->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, 3220, 0)) { - basepoints0 = int32((aurEff->GetAmount() * owner->SpellBaseDamageBonus(SpellSchoolMask(SPELL_SCHOOL_MASK_MAGIC)) + 100.0f) / 100.0f); // TODO: Is it right? + basepoints0 = int32((aurEff->GetAmount() * owner->SpellBaseDamageBonusDone(SpellSchoolMask(SPELL_SCHOOL_MASK_MAGIC)) + 100.0f) / 100.0f); // TODO: Is it right? CastCustomSpell(this, trigger_spell_id, &basepoints0, &basepoints0, NULL, true, castItem, triggeredByAura); return true; } @@ -8972,10 +9119,10 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg case 70893: { // check if we're doing a critical hit - if (!(procSpell->SpellFamilyFlags[1] & 0x10000000) && (procEx != PROC_EX_CRITICAL_HIT) ) + if (!(procSpell->SpellFamilyFlags[1] & 0x10000000) && (procEx != PROC_EX_CRITICAL_HIT)) return false; // check if we're procced by Claw, Bite or Smack (need to use the spell icon ID to detect it) - if (!(procSpell->SpellIconID == 262 || procSpell->SpellIconID == 1680 || procSpell->SpellIconID == 473 )) + if (!(procSpell->SpellIconID == 262 || procSpell->SpellIconID == 1680 || procSpell->SpellIconID == 473)) return false; break; } @@ -9183,7 +9330,7 @@ FactionTemplateEntry const* Unit::getFactionTemplateEntry() const if (Player const* player = ToPlayer()) sLog->outError("Player %s has invalid faction (faction template id) #%u", player->GetName(), getFaction()); else if (Creature const* creature = ToCreature()) - sLog->outError("Creature (template id: %u) has invalid faction (faction template id) #%u", creature->GetCreatureInfo()->Entry, getFaction()); + sLog->outError("Creature (template id: %u) has invalid faction (faction template id) #%u", creature->GetCreatureTemplate()->Entry, getFaction()); else sLog->outError("Unit (name=%s, type=%u) has invalid faction (faction template id) #%u", GetName(), uint32(GetTypeId()), getFaction()); @@ -9441,6 +9588,16 @@ bool Unit::Attack(Unit* victim, bool meleeAttack) if (meleeAttack) SendMeleeAttackStart(victim); + // Let the pet know we've started attacking someting. Handles melee attacks only + // Spells such as auto-shot and others handled in WorldSession::HandleCastSpellOpcode + if (this->GetTypeId() == TYPEID_PLAYER) + { + Pet* playerPet = this->ToPlayer()->GetPet(); + + if (playerPet && playerPet->isAlive()) + playerPet->AI()->OwnerAttacked(victim); + } + return true; } @@ -9911,7 +10068,7 @@ void Unit::SetCharm(Unit* charm, bool apply) if (charm->HasUnitMovementFlag(MOVEMENTFLAG_WALKING)) { - charm->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + charm->SetWalk(false); charm->SendMovementFlagUpdate(); } @@ -10039,7 +10196,7 @@ Unit* Unit::GetFirstControlled() const // Sequence: charmed, pet, other guardians Unit* unit = GetCharm(); if (!unit) - if (uint64 guid = GetUInt64Value(UNIT_FIELD_SUMMON)) + if (uint64 guid = GetMinionGUID()) unit = ObjectAccessor::GetUnit(*this, guid); return unit; @@ -10216,7 +10373,7 @@ void Unit::EnergizeBySpell(Unit* victim, uint32 spellID, uint32 damage, Powers p victim->getHostileRefManager().threatAssist(this, float(damage) * 0.5f, spellInfo); } -uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack) +uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack) { if (!spellProto || !victim || damagetype == DIRECT_DAMAGE) return pdamage; @@ -10229,33 +10386,35 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32 // For totems get damage bonus from owner if (GetTypeId() == TYPEID_UNIT && ToCreature()->isTotem()) if (Unit* owner = GetOwner()) - return owner->SpellDamageBonus(victim, spellProto, pdamage, damagetype); + return owner->SpellDamageBonusDone(victim, spellProto, pdamage, damagetype); - // Taken/Done total percent damage auras + // Done total percent damage auras float DoneTotalMod = 1.0f; float ApCoeffMod = 1.0f; int32 DoneTotal = 0; - int32 TakenTotal = 0; - // ..done // Pet damage? if (GetTypeId() == TYPEID_UNIT && !ToCreature()->isPet()) - DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureInfo()->rank); + DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureTemplate()->rank); - AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); - for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) + // Some spells don't benefit from pct done mods + if (!(spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS) && !spellProto->IsRankOf(sSpellMgr->GetSpellInfo(12162))) { - if (spellProto->EquippedItemClass == -1 && (*i)->GetSpellInfo()->EquippedItemClass != -1) //prevent apply mods from weapon specific case to non weapon specific spells (Example: thunder clap and two-handed weapon specialization) - continue; - - if ((*i)->GetMiscValue() & spellProto->GetSchoolMask()) + AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); + for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) { - if ((*i)->GetSpellInfo()->EquippedItemClass == -1) - AddPctN(DoneTotalMod, (*i)->GetAmount()); - else if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0)) - AddPctN(DoneTotalMod, (*i)->GetAmount()); - else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo())) - AddPctN(DoneTotalMod, (*i)->GetAmount()); + if (spellProto->EquippedItemClass == -1 && (*i)->GetSpellInfo()->EquippedItemClass != -1) //prevent apply mods from weapon specific case to non weapon specific spells (Example: thunder clap and two-handed weapon specialization) + continue; + + if ((*i)->GetMiscValue() & spellProto->GetSchoolMask()) + { + if ((*i)->GetSpellInfo()->EquippedItemClass == -1) + AddPctN(DoneTotalMod, (*i)->GetAmount()); + else if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0)) + AddPctN(DoneTotalMod, (*i)->GetAmount()); + else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo())) + AddPctN(DoneTotalMod, (*i)->GetAmount()); + } } } @@ -10435,7 +10594,7 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32 break; } } - break; + break; case SPELLFAMILY_PRIEST: // Mind Flay if (spellProto->SpellFamilyFlags[0] & 0x800000) @@ -10468,7 +10627,7 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32 if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT)) AddPctN(DoneTotalMod, aurEff->GetAmount()); } - break; + break; case SPELLFAMILY_PALADIN: // Judgement of Vengeance/Judgement of Corruption if ((spellProto->SpellFamilyFlags[1] & 0x400000) && spellProto->SpellIconID == 2292) @@ -10486,7 +10645,7 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32 if (stacks) AddPctU(DoneTotalMod, 10 * stacks); } - break; + break; case SPELLFAMILY_DRUID: // Thorns if (spellProto->SpellFamilyFlags[0] & 0x100) @@ -10495,7 +10654,7 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32 if (AuraEffect* aurEff = GetAuraEffectOfRankedSpell(16836, 0)) AddPctN(DoneTotalMod, aurEff->GetAmount()); } - break; + break; case SPELLFAMILY_WARLOCK: // Fire and Brimstone if (spellProto->SpellFamilyFlags[1] & 0x00020040) @@ -10517,14 +10676,14 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32 if (spellProto->SpellFamilyFlags[1] & 0x00400000 && isPet()) if (uint8 count = victim->GetDoTsByCaster(GetOwnerGUID())) AddPctN(DoneTotalMod, 15 * count); - break; + break; case SPELLFAMILY_HUNTER: // Steady Shot if (spellProto->SpellFamilyFlags[1] & 0x1) if (AuraEffect* aurEff = GetAuraEffect(56826, 0)) // Glyph of Steady Shot if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_HUNTER, 0x00004000, 0, 0, GetGUID())) AddPctN(DoneTotalMod, aurEff->GetAmount()); - break; + break; case SPELLFAMILY_DEATHKNIGHT: // Improved Icy Touch if (spellProto->SpellFamilyFlags[0] & 0x2) @@ -10565,53 +10724,11 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32 } } } - break; - } - - // ..taken - float TakenTotalMod = 1.0f; - - // from positive and negative SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN - // multiplicative bonus, for example Dispersion + Shadowform (0.10*0.85=0.085) - TakenTotalMod *= victim->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, spellProto->GetSchoolMask()); - - // .. taken pct: dummy auras - AuraEffectList const& mDummyAuras = victim->GetAuraEffectsByType(SPELL_AURA_DUMMY); - for (AuraEffectList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i) - { - switch ((*i)->GetSpellInfo()->SpellIconID) - { - // Cheat Death - case 2109: - if ((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) - { - if (victim->GetTypeId() != TYPEID_PLAYER) - continue; - float mod = victim->ToPlayer()->GetRatingBonusValue(CR_CRIT_TAKEN_MELEE) * (-8.0f); - AddPctF(TakenTotalMod, std::max(mod, float((*i)->GetAmount()))); - } - break; - } - } - - // From caster spells - AuraEffectList const& mOwnerTaken = victim->GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER); - for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i) - if ((*i)->GetCasterGUID() == GetGUID() && (*i)->IsAffectingSpell(spellProto)) - AddPctN(TakenTotalMod, (*i)->GetAmount()); - - // Mod damage from spell mechanic - if (uint32 mechanicMask = spellProto->GetAllEffectsMechanicMask()) - { - AuraEffectList const& mDamageDoneMechanic = victim->GetAuraEffectsByType(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT); - for (AuraEffectList::const_iterator i = mDamageDoneMechanic.begin(); i != mDamageDoneMechanic.end(); ++i) - if (mechanicMask & uint32(1<<((*i)->GetMiscValue()))) - AddPctN(TakenTotalMod, (*i)->GetAmount()); + break; } - // Taken/Done fixed damage bonus auras - int32 DoneAdvertisedBenefit = SpellBaseDamageBonus(spellProto->GetSchoolMask()); - int32 TakenAdvertisedBenefit = SpellBaseDamageBonusForVictim(spellProto->GetSchoolMask(), victim); + // Done fixed damage bonus auras + int32 DoneAdvertisedBenefit = SpellBaseDamageBonusDone(spellProto->GetSchoolMask()); // Pets just add their bonus damage to their spell damage // note that their spell damage is just gain of their own auras if (HasUnitTypeMask(UNIT_MASK_GUARDIAN)) @@ -10628,7 +10745,7 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32 if (bonus->ap_dot_bonus > 0) { WeaponAttackType attType = (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK; - float APbonus = (float) victim->GetTotalAuraModifier(attType == BASE_ATTACK ? SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS : SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS); + float APbonus = float(victim->GetTotalAuraModifier(attType == BASE_ATTACK ? SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS : SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS)); APbonus += GetTotalAttackPowerValue(attType); DoneTotal += int32(bonus->ap_dot_bonus * stack * ApCoeffMod * APbonus); } @@ -10639,74 +10756,20 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32 if (bonus->ap_bonus > 0) { WeaponAttackType attType = (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK; - float APbonus = (float) victim->GetTotalAuraModifier(attType == BASE_ATTACK ? SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS : SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS); + float APbonus = float(victim->GetTotalAuraModifier(attType == BASE_ATTACK ? SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS : SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS)); APbonus += GetTotalAttackPowerValue(attType); DoneTotal += int32(bonus->ap_bonus * stack * ApCoeffMod * APbonus); } } } // Default calculation - if (DoneAdvertisedBenefit || TakenAdvertisedBenefit) + if (DoneAdvertisedBenefit) { if (!bonus || coeff < 0) - { - // Damage Done from spell damage bonus - int32 CastingTime = spellProto->IsChanneled() ? spellProto->GetDuration() : spellProto->CalcCastTime(); - // Damage over Time spells bonus calculation - float DotFactor = 1.0f; - if (damagetype == DOT) - { - int32 DotDuration = spellProto->GetDuration(); - // 200% limit - if (DotDuration > 0) - { - if (DotDuration > 30000) - DotDuration = 30000; - if (!spellProto->IsChanneled()) - DotFactor = DotDuration / 15000.0f; - uint8 x = 0; - for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) - { - if (spellProto->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA && ( - spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE || - spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_LEECH)) - { - x = j; - break; - } - } - int32 DotTicks = 6; - if (spellProto->Effects[x].Amplitude != 0) - DotTicks = DotDuration / spellProto->Effects[x].Amplitude; - if (DotTicks) - { - DoneAdvertisedBenefit /= DotTicks; - TakenAdvertisedBenefit /= DotTicks; - } - } - } - // Distribute Damage over multiple effects, reduce by AoE - CastingTime = GetCastingTimeForBonus(spellProto, damagetype, CastingTime); - - // 50% for damage and healing spells for leech spells from damage bonus and 0% from healing - for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) - { - if (spellProto->Effects[j].Effect == SPELL_EFFECT_HEALTH_LEECH || - (spellProto->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA && spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_LEECH)) - { - CastingTime /= 2; - break; - } - } - if (spellProto->SchoolMask != SPELL_SCHOOL_MASK_NORMAL) - coeff = (CastingTime / 3500.0f) * DotFactor; - else - coeff = DotFactor; - } + coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack); float factorMod = CalculateLevelPenalty(spellProto) * stack; - // level penalty still applied on Taken bonus - is it blizzlike? - TakenTotal+= int32(TakenAdvertisedBenefit * factorMod); + if (Player* modOwner = GetSpellModOwner()) { coeff *= 100.0f; @@ -10723,27 +10786,94 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32 DoneTotalMod = 1.0f; } - // Some spells don't benefit from pct done mods - // maybe should be implemented like SPELL_ATTR3_NO_DONE_BONUS, - // but then it may break spell power coeffs work on spell 31117 - if (spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS) - DoneTotalMod = 1.0f; - float tmpDamage = (int32(pdamage) + DoneTotal) * DoneTotalMod; // apply spellmod to Done damage (flat and pct) if (Player* modOwner = GetSpellModOwner()) modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, tmpDamage); - tmpDamage = (tmpDamage + TakenTotal) * TakenTotalMod; + return uint32(std::max(tmpDamage, 0.0f)); +} + +uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack) +{ + if (!spellProto || damagetype == DIRECT_DAMAGE) + return pdamage; + + int32 TakenTotal = 0; + float TakenTotalMod = 1.0f; + + // from positive and negative SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN + // multiplicative bonus, for example Dispersion + Shadowform (0.10*0.85=0.085) + TakenTotalMod *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, spellProto->GetSchoolMask()); + + //.. taken pct: dummy auras + AuraEffectList const& mDummyAuras = GetAuraEffectsByType(SPELL_AURA_DUMMY); + for (AuraEffectList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i) + { + switch ((*i)->GetSpellInfo()->SpellIconID) + { + // Cheat Death + case 2109: + if ((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) + { + if (GetTypeId() != TYPEID_PLAYER) + continue; + float mod = ToPlayer()->GetRatingBonusValue(CR_CRIT_TAKEN_MELEE) * (-8.0f); + AddPctF(TakenTotalMod, std::max(mod, float((*i)->GetAmount()))); + } + break; + } + } + + // From caster spells + AuraEffectList const& mOwnerTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER); + for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i) + if ((*i)->GetCasterGUID() == caster->GetGUID() && (*i)->IsAffectedOnSpell(spellProto)) + AddPctN(TakenTotalMod, (*i)->GetAmount()); + + // Mod damage from spell mechanic + if (uint32 mechanicMask = spellProto->GetAllEffectsMechanicMask()) + { + AuraEffectList const& mDamageDoneMechanic = GetAuraEffectsByType(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT); + for (AuraEffectList::const_iterator i = mDamageDoneMechanic.begin(); i != mDamageDoneMechanic.end(); ++i) + if (mechanicMask & uint32(1<<((*i)->GetMiscValue()))) + AddPctN(TakenTotalMod, (*i)->GetAmount()); + } + + int32 TakenAdvertisedBenefit = SpellBaseDamageBonusTaken(spellProto->GetSchoolMask()); + + // Check for table values + float coeff = 0; + SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id); + if (bonus) + coeff = (damagetype == DOT) ? bonus->dot_damage : bonus->direct_damage; + + // Default calculation + if (TakenAdvertisedBenefit) + { + if (!bonus || coeff < 0) + coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack); + + float factorMod = CalculateLevelPenalty(spellProto) * stack; + // level penalty still applied on Taken bonus - is it blizzlike? + if (Player* modOwner = GetSpellModOwner()) + { + coeff *= 100.0f; + modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff); + coeff /= 100.0f; + } + TakenTotal+= int32(TakenAdvertisedBenefit * coeff * factorMod); + } + + float tmpDamage = (float(pdamage) + TakenTotal) * TakenTotalMod; return uint32(std::max(tmpDamage, 0.0f)); } -int32 Unit::SpellBaseDamageBonus(SpellSchoolMask schoolMask) +int32 Unit::SpellBaseDamageBonusDone(SpellSchoolMask schoolMask) { int32 DoneAdvertisedBenefit = 0; - // ..done AuraEffectList const& mDamageDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE); for (AuraEffectList::const_iterator i = mDamageDone.begin(); i != mDamageDone.end(); ++i) if (((*i)->GetMiscValue() & schoolMask) != 0 && @@ -10776,27 +10906,19 @@ int32 Unit::SpellBaseDamageBonus(SpellSchoolMask schoolMask) DoneAdvertisedBenefit += int32(CalculatePctN(GetTotalAttackPowerValue(BASE_ATTACK), (*i)->GetAmount())); } - return DoneAdvertisedBenefit > 0 ? DoneAdvertisedBenefit : 0; + return DoneAdvertisedBenefit; } -int32 Unit::SpellBaseDamageBonusForVictim(SpellSchoolMask schoolMask, Unit* victim) +int32 Unit::SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask) { - uint32 creatureTypeMask = victim->GetCreatureTypeMask(); - int32 TakenAdvertisedBenefit = 0; - // ..done (for creature type by mask) in taken - AuraEffectList const& mDamageDoneCreature = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_CREATURE); - for (AuraEffectList::const_iterator i = mDamageDoneCreature.begin(); i != mDamageDoneCreature.end(); ++i) - if (creatureTypeMask & uint32((*i)->GetMiscValue())) - TakenAdvertisedBenefit += (*i)->GetAmount(); - // ..taken - AuraEffectList const& mDamageTaken = victim->GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_TAKEN); + AuraEffectList const& mDamageTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_TAKEN); for (AuraEffectList::const_iterator i = mDamageTaken.begin(); i != mDamageTaken.end(); ++i) if (((*i)->GetMiscValue() & schoolMask) != 0) TakenAdvertisedBenefit += (*i)->GetAmount(); - return TakenAdvertisedBenefit > 0 ? TakenAdvertisedBenefit : 0; + return TakenAdvertisedBenefit; } bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType) const @@ -11065,23 +11187,19 @@ uint32 Unit::SpellCriticalHealingBonus(SpellInfo const* spellProto, uint32 damag return damage; } -uint32 Unit::SpellHealingBonus(Unit* victim, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack) +uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack) { // For totems get healing bonus from owner (statue isn't totem in fact) - if (GetTypeId() == TYPEID_UNIT && ToCreature()->isTotem()) + if (GetTypeId() == TYPEID_UNIT && isTotem()) if (Unit* owner = GetOwner()) - return owner->SpellHealingBonus(victim, spellProto, healamount, damagetype, stack); + return owner->SpellHealingBonusDone(victim, spellProto, healamount, damagetype, stack); - // no bonus for heal potions/bandages + // No bonus healing for potion spells if (spellProto->SpellFamilyName == SPELLFAMILY_POTION) return healamount; - // Healing Done - // Taken/Done total percent damage auras - float DoneTotalMod = 1.0f; - float TakenTotalMod = 1.0f; - int32 DoneTotal = 0; - int32 TakenTotal = 0; + float DoneTotalMod = 1.0f; + int32 DoneTotal = 0; // Healing done percent AuraEffectList const& mHealingDonePct = GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_DONE_PERCENT); @@ -11144,28 +11262,11 @@ uint32 Unit::SpellHealingBonus(Unit* victim, SpellInfo const* spellProto, uint32 } } - // Taken/Done fixed damage bonus auras - int32 DoneAdvertisedBenefit = SpellBaseHealingBonus(spellProto->GetSchoolMask()); - int32 TakenAdvertisedBenefit = SpellBaseHealingBonusForVictim(spellProto->GetSchoolMask(), victim); - - bool scripted = false; - - for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) - { - switch (spellProto->Effects[i].ApplyAuraName) - { - // These auras do not use healing coeff - case SPELL_AURA_PERIODIC_LEECH: - case SPELL_AURA_PERIODIC_HEALTH_FUNNEL: - scripted = true; - break; - } - if (spellProto->Effects[i].Effect == SPELL_EFFECT_HEALTH_LEECH) - scripted = true; - } + // Done fixed damage bonus auras + int32 DoneAdvertisedBenefit = SpellBaseHealingBonusDone(spellProto->GetSchoolMask()); // Check for table values - SpellBonusEntry const* bonus = !scripted ? sSpellMgr->GetSpellBonusData(spellProto->Id) : NULL; + SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id); float coeff = 0; float factorMod = 1.0f; if (bonus) @@ -11175,159 +11276,184 @@ uint32 Unit::SpellHealingBonus(Unit* victim, SpellInfo const* spellProto, uint32 coeff = bonus->dot_damage; if (bonus->ap_dot_bonus > 0) DoneTotal += int32(bonus->ap_dot_bonus * stack * GetTotalAttackPowerValue( - (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE)? RANGED_ATTACK : BASE_ATTACK)); + (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK)); } else { coeff = bonus->direct_damage; if (bonus->ap_bonus > 0) DoneTotal += int32(bonus->ap_bonus * stack * GetTotalAttackPowerValue( - (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE)? RANGED_ATTACK : BASE_ATTACK)); + (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK)); } } - else // scripted bonus + else { - // Gift of the Naaru - if (spellProto->SpellFamilyFlags[2] & 0x80000000 && spellProto->SpellIconID == 329) - { - scripted = true; - int32 apBonus = int32(std::max(GetTotalAttackPowerValue(BASE_ATTACK), GetTotalAttackPowerValue(RANGED_ATTACK))); - if (apBonus > DoneAdvertisedBenefit) - DoneTotal += int32(apBonus * 0.22f); // 22% of AP per tick - else - DoneTotal += int32(DoneAdvertisedBenefit * 0.377f); // 37.7% of BH per tick - } - // Earthliving - 0.45% of normal hot coeff - else if (spellProto->SpellFamilyName == SPELLFAMILY_SHAMAN && spellProto->SpellFamilyFlags[1] & 0x80000) - factorMod *= 0.45f; - // Already set to scripted? so not uses healing bonus coefficient - // No heal coeff for SPELL_DAMAGE_CLASS_NONE class spells by default - else if (scripted || spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE) - { - scripted = true; - coeff = 0.0f; - } + // No bonus healing for SPELL_DAMAGE_CLASS_NONE class spells by default + if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE) + return healamount; } // Default calculation - if (DoneAdvertisedBenefit || TakenAdvertisedBenefit) + if (DoneAdvertisedBenefit) { - if ((!bonus && !scripted) || coeff < 0) - { - // Damage Done from spell damage bonus - int32 CastingTime = !spellProto->IsChanneled() ? spellProto->CalcCastTime() : spellProto->GetDuration(); - // Damage over Time spells bonus calculation - float DotFactor = 1.0f; - if (damagetype == DOT) - { - int32 DotDuration = spellProto->GetDuration(); - // 200% limit - if (DotDuration > 0) - { - if (DotDuration > 30000) DotDuration = 30000; - if (!spellProto->IsChanneled()) DotFactor = DotDuration / 15000.0f; - uint32 x = 0; - for (uint8 j = 0; j < MAX_SPELL_EFFECTS; j++) - { - if (spellProto->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA && ( - spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE || - spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_LEECH)) - { - x = j; - break; - } - } - int32 DotTicks = 6; - if (spellProto->Effects[x].Amplitude != 0) - DotTicks = DotDuration / spellProto->Effects[x].Amplitude; - if (DotTicks) - { - DoneAdvertisedBenefit = DoneAdvertisedBenefit * int32(stack) / DotTicks; - TakenAdvertisedBenefit = TakenAdvertisedBenefit * int32(stack) / DotTicks; - } - } - } - // Distribute Damage over multiple effects, reduce by AoE - CastingTime = GetCastingTimeForBonus(spellProto, damagetype, CastingTime); - // 50% for damage and healing spells for leech spells from damage bonus and 0% from healing - for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) - { - if (spellProto->Effects[j].Effect == SPELL_EFFECT_HEALTH_LEECH || - (spellProto->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA && spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_LEECH)) - { - CastingTime /= 2; - break; - } - } - // As wowwiki says: C = (Cast Time / 3.5) * 1.88 (for healing spells) - coeff = (CastingTime / 3500.0f) * DotFactor * 1.88f; - } + if (!bonus || coeff < 0) + coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack) * 1.88f; // As wowwiki says: C = (Cast Time / 3.5) * 1.88 (for healing spells) factorMod *= CalculateLevelPenalty(spellProto) * stack; - // level penalty still applied on Taken bonus - is it blizzlike? - TakenTotal += int32(TakenAdvertisedBenefit * factorMod); + if (Player* modOwner = GetSpellModOwner()) { coeff *= 100.0f; modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff); coeff /= 100.0f; } + + // Earthliving - 0.45% of normal hot coeff + if (spellProto->SpellFamilyName == SPELLFAMILY_SHAMAN && spellProto->SpellFamilyFlags[1] & 0x80000) + factorMod *= 0.45f; + DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod); } + // Gift of the Naaru + if (spellProto->SpellFamilyFlags[2] & 0x80000000 && spellProto->SpellIconID == 329) + { + int32 apBonus = int32(std::max(GetTotalAttackPowerValue(BASE_ATTACK), GetTotalAttackPowerValue(RANGED_ATTACK))); + if (apBonus > DoneAdvertisedBenefit) + DoneTotal += int32(apBonus * 0.22f); // 22% of AP per tick + else + DoneTotal += int32(DoneAdvertisedBenefit * 0.377f); // 37.7% of BH per tick + } + + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + { + switch (spellProto->Effects[i].ApplyAuraName) + { + // Bonus healing does not apply to these spells + case SPELL_AURA_PERIODIC_LEECH: + case SPELL_AURA_PERIODIC_HEALTH_FUNNEL: + DoneTotal = 0; + break; + } + if (spellProto->Effects[i].Effect == SPELL_EFFECT_HEALTH_LEECH) + DoneTotal = 0; + } + // use float as more appropriate for negative values and percent applying - float heal = (int32(healamount) + DoneTotal) * DoneTotalMod; + float heal = float(int32(healamount) + DoneTotal) * DoneTotalMod; // apply spellmod to Done amount if (Player* modOwner = GetSpellModOwner()) modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, heal); - // Nourish cast - if (spellProto->SpellFamilyName == SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags[1] & 0x2000000) - { - // Rejuvenation, Regrowth, Lifebloom, or Wild Growth - if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_DRUID, 0x50, 0x4000010, 0)) - // increase healing by 20% - TakenTotalMod *= 1.2f; - } - - // Taken mods + return uint32(std::max(heal, 0.0f)); +} - // Tenacity increase healing % taken - if (AuraEffect const* Tenacity = victim->GetAuraEffect(58549, 0)) - AddPctN(TakenTotalMod, Tenacity->GetAmount()); +uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack) +{ + float TakenTotalMod = 1.0f; // Healing taken percent - float minval = (float)victim->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT); + float minval = float(GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT)); if (minval) AddPctF(TakenTotalMod, minval); - float maxval = (float)victim->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT); + float maxval = float(GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT)); if (maxval) AddPctF(TakenTotalMod, maxval); + // Tenacity increase healing % taken + if (AuraEffect const* Tenacity = GetAuraEffect(58549, 0)) + AddPctN(TakenTotalMod, Tenacity->GetAmount()); + + // Healing Done + int32 TakenTotal = 0; + + // Taken fixed damage bonus auras + int32 TakenAdvertisedBenefit = SpellBaseHealingBonusTaken(spellProto->GetSchoolMask()); + + // Nourish cast + if (spellProto->SpellFamilyName == SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags[1] & 0x2000000) + { + // Rejuvenation, Regrowth, Lifebloom, or Wild Growth + if (GetAuraEffect(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_DRUID, 0x50, 0x4000010, 0)) + // increase healing by 20% + TakenTotalMod *= 1.2f; + } + if (damagetype == DOT) { // Healing over time taken percent - float minval_hot = (float)victim->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT); + float minval_hot = float(GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT)); if (minval_hot) AddPctF(TakenTotalMod, minval_hot); - float maxval_hot = (float)victim->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT); + float maxval_hot = float(GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT)); if (maxval_hot) AddPctF(TakenTotalMod, maxval_hot); } - AuraEffectList const& mHealingGet= victim->GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_RECEIVED); + // Check for table values + SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id); + float coeff = 0; + float factorMod = 1.0f; + if (bonus) + coeff = (damagetype == DOT) ? bonus->dot_damage : bonus->direct_damage; + else + { + // No bonus healing for SPELL_DAMAGE_CLASS_NONE class spells by default + if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE) + { + healamount = uint32(std::max((float(healamount) * TakenTotalMod), 0.0f)); + return healamount; + } + } + + // Default calculation + if (TakenAdvertisedBenefit) + { + if (!bonus || coeff < 0) + coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack) * 1.88f; // As wowwiki says: C = (Cast Time / 3.5) * 1.88 (for healing spells) + + factorMod *= CalculateLevelPenalty(spellProto) * int32(stack); + if (Player* modOwner = GetSpellModOwner()) + { + coeff *= 100.0f; + modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff); + coeff /= 100.0f; + } + + // Earthliving - 0.45% of normal hot coeff + if (spellProto->SpellFamilyName == SPELLFAMILY_SHAMAN && spellProto->SpellFamilyFlags[1] & 0x80000) + factorMod *= 0.45f; + + TakenTotal += int32(TakenAdvertisedBenefit * coeff * factorMod); + } + + AuraEffectList const& mHealingGet= GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_RECEIVED); for (AuraEffectList::const_iterator i = mHealingGet.begin(); i != mHealingGet.end(); ++i) - if (GetGUID() == (*i)->GetCasterGUID() && (*i)->IsAffectingSpell(spellProto)) + if (caster->GetGUID() == (*i)->GetCasterGUID() && (*i)->IsAffectedOnSpell(spellProto)) AddPctN(TakenTotalMod, (*i)->GetAmount()); - heal = (int32(heal) + TakenTotal) * TakenTotalMod; + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + { + switch (spellProto->Effects[i].ApplyAuraName) + { + // Bonus healing does not apply to these spells + case SPELL_AURA_PERIODIC_LEECH: + case SPELL_AURA_PERIODIC_HEALTH_FUNNEL: + TakenTotal = 0; + break; + } + if (spellProto->Effects[i].Effect == SPELL_EFFECT_HEALTH_LEECH) + TakenTotal = 0; + } + + float heal = float(int32(healamount) + TakenTotal) * TakenTotalMod; return uint32(std::max(heal, 0.0f)); } -int32 Unit::SpellBaseHealingBonus(SpellSchoolMask schoolMask) +int32 Unit::SpellBaseHealingBonusDone(SpellSchoolMask schoolMask) { int32 AdvertisedBenefit = 0; @@ -11360,13 +11486,15 @@ int32 Unit::SpellBaseHealingBonus(SpellSchoolMask schoolMask) return AdvertisedBenefit; } -int32 Unit::SpellBaseHealingBonusForVictim(SpellSchoolMask schoolMask, Unit* victim) +int32 Unit::SpellBaseHealingBonusTaken(SpellSchoolMask schoolMask) { int32 AdvertisedBenefit = 0; - AuraEffectList const& mDamageTaken = victim->GetAuraEffectsByType(SPELL_AURA_MOD_HEALING); + + AuraEffectList const& mDamageTaken = GetAuraEffectsByType(SPELL_AURA_MOD_HEALING); for (AuraEffectList::const_iterator i = mDamageTaken.begin(); i != mDamageTaken.end(); ++i) if (((*i)->GetMiscValue() & schoolMask) != 0) AdvertisedBenefit += (*i)->GetAmount(); + return AdvertisedBenefit; } @@ -11393,7 +11521,7 @@ bool Unit::IsImmunedToDamage(SpellInfo const* spellInfo) return false; uint32 shoolMask = spellInfo->GetSchoolMask(); - if (spellInfo->Id != 42292 && spellInfo->Id !=59752) + if (spellInfo->Id != 42292 && spellInfo->Id != 59752) { // If m_immuneToSchool type contain this school type, IMMUNE damage. SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL]; @@ -11434,7 +11562,7 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo) } // Spells that don't have effectMechanics. - if (!spellInfo->HasAnyEffectMechanic() && spellInfo->Mechanic) + if (spellInfo->Mechanic) { SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC]; for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr) @@ -11447,16 +11575,17 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo) { // State/effect immunities applied by aura expect full spell immunity // Ignore effects with mechanic, they are supposed to be checked separately - if (spellInfo->Effects[i].Mechanic || !IsImmunedToSpellEffect(spellInfo, i)) + if (!IsImmunedToSpellEffect(spellInfo, i)) { immuneToAllEffects = false; break; } } + if (immuneToAllEffects) //Return immune only if the target is immune to all spell effects. return true; - if (spellInfo->Id != 42292 && spellInfo->Id !=59752) + if (spellInfo->Id != 42292 && spellInfo->Id != 59752) { SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL]; for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr) @@ -11474,8 +11603,9 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo) bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const { - if (!spellInfo) + if (!spellInfo || !spellInfo->Effects[index].IsEffect()) return false; + // If m_immuneToEffect type contain this effect type, IMMUNE effect. uint32 effect = spellInfo->Effects[index].Effect; SpellImmuneList const& effectList = m_spellImmune[IMMUNITY_EFFECT]; @@ -11509,21 +11639,17 @@ bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) cons return false; } -void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attType, SpellInfo const* spellProto) +uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType attType, SpellInfo const* spellProto) { - if (!victim) - return; - - if (*pdamage == 0) - return; + if (!victim || pdamage == 0) + return 0; uint32 creatureTypeMask = victim->GetCreatureTypeMask(); - // Taken/Done fixed damage bonus auras + // Done fixed damage bonus auras int32 DoneFlatBenefit = 0; - int32 TakenFlatBenefit = 0; - // ..done (for creature type by mask) in taken + // ..done AuraEffectList const& mDamageDoneCreature = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_CREATURE); for (AuraEffectList::const_iterator i = mDamageDoneCreature.begin(); i != mDamageDoneCreature.end(); ++i) if (creatureTypeMask & uint32((*i)->GetMiscValue())) @@ -11569,54 +11695,27 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT DoneFlatBenefit += int32(APbonus/14.0f * GetAPMultiplier(attType, normalized)); } - // ..taken - AuraEffectList const& mDamageTaken = victim->GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_TAKEN); - for (AuraEffectList::const_iterator i = mDamageTaken.begin(); i != mDamageTaken.end(); ++i) - if ((*i)->GetMiscValue() & GetMeleeDamageSchoolMask()) - TakenFlatBenefit += (*i)->GetAmount(); - - if (attType != RANGED_ATTACK) - TakenFlatBenefit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN); - else - TakenFlatBenefit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN); - - // Done/Taken total percent damage auras + // Done total percent damage auras float DoneTotalMod = 1.0f; - float TakenTotalMod = 1.0f; - // ..done - // SPELL_AURA_MOD_AUTOATTACK_DAMAGE - if (!spellProto) - { - AuraEffectList const & autoattackDamage = GetAuraEffectsByType(SPELL_AURA_MOD_AUTOATTACK_DAMAGE); - for (AuraEffectList::const_iterator i = autoattackDamage.begin(); i != autoattackDamage.end(); ++i) - { - int32 amount = (*i)->GetAmount(); - if ((*i)->GetSpellInfo()->EquippedItemClass == -1) - AddPctN(DoneTotalMod, amount); - else if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0)) - AddPctN(DoneTotalMod, amount); - else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo())) - AddPctN(DoneTotalMod, amount); - } - } - - AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); - for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) - { - if (spellProto) + // Some spells don't benefit from pct done mods + if (spellProto) + if (!(spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS) && !spellProto->IsRankOf(sSpellMgr->GetSpellInfo(12162))) { - if ((*i)->GetMiscValue() & spellProto->GetSchoolMask() && !(spellProto->GetSchoolMask() & SPELL_SCHOOL_MASK_NORMAL)) + AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); + for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) { - if ((*i)->GetSpellInfo()->EquippedItemClass == -1) - AddPctN(DoneTotalMod, (*i)->GetAmount()); - else if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0)) - AddPctN(DoneTotalMod, (*i)->GetAmount()); - else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo())) - AddPctN(DoneTotalMod, (*i)->GetAmount()); + if ((*i)->GetMiscValue() & spellProto->GetSchoolMask() && !(spellProto->GetSchoolMask() & SPELL_SCHOOL_MASK_NORMAL)) + { + if ((*i)->GetSpellInfo()->EquippedItemClass == -1) + AddPctN(DoneTotalMod, (*i)->GetAmount()); + else if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0)) + AddPctN(DoneTotalMod, (*i)->GetAmount()); + else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo())) + AddPctN(DoneTotalMod, (*i)->GetAmount()); + } } } - } AuraEffectList const& mDamageDoneVersus = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS); for (AuraEffectList::const_iterator i = mDamageDoneVersus.begin(); i != mDamageDoneVersus.end(); ++i) @@ -11704,18 +11803,50 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT break; } + float tmpDamage = float(int32(pdamage) + DoneFlatBenefit) * DoneTotalMod; + + // apply spellmod to Done damage + if (spellProto) + if (Player* modOwner = GetSpellModOwner()) + modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_DAMAGE, tmpDamage); + + // bonus result can be negative + return uint32(std::max(tmpDamage, 0.0f)); +} + +uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackType attType, SpellInfo const* spellProto) +{ + if (pdamage == 0) + return 0; + + int32 TakenFlatBenefit = 0; + // ..taken - TakenTotalMod *= victim->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, GetMeleeDamageSchoolMask()); + AuraEffectList const& mDamageTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_TAKEN); + for (AuraEffectList::const_iterator i = mDamageTaken.begin(); i != mDamageTaken.end(); ++i) + if ((*i)->GetMiscValue() & GetMeleeDamageSchoolMask()) + TakenFlatBenefit += (*i)->GetAmount(); - // From caster spells - AuraEffectList const& mOwnerTaken = victim->GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER); - for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i) - if ((*i)->GetCasterGUID() == GetGUID() && (*i)->IsAffectingSpell(spellProto)) - AddPctN(TakenTotalMod, (*i)->GetAmount()); + if (attType != RANGED_ATTACK) + TakenFlatBenefit += GetTotalAuraModifier(SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN); + else + TakenFlatBenefit += GetTotalAuraModifier(SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN); + + // Taken total percent damage auras + float TakenTotalMod = 1.0f; + + // ..taken + TakenTotalMod *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, GetMeleeDamageSchoolMask()); // .. taken pct (special attacks) if (spellProto) { + // From caster spells + AuraEffectList const& mOwnerTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER); + for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i) + if ((*i)->GetCasterGUID() == attacker->GetGUID() && (*i)->IsAffectedOnSpell(spellProto)) + AddPctN(TakenTotalMod, (*i)->GetAmount()); + // Mod damage from spell mechanic uint32 mechanicMask = spellProto->GetAllEffectsMechanicMask(); @@ -11725,7 +11856,7 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT if (mechanicMask) { - AuraEffectList const& mDamageDoneMechanic = victim->GetAuraEffectsByType(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT); + AuraEffectList const& mDamageDoneMechanic = GetAuraEffectsByType(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT); for (AuraEffectList::const_iterator i = mDamageDoneMechanic.begin(); i != mDamageDoneMechanic.end(); ++i) if (mechanicMask & uint32(1<<((*i)->GetMiscValue()))) AddPctN(TakenTotalMod, (*i)->GetAmount()); @@ -11733,7 +11864,7 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT } // .. taken pct: dummy auras - AuraEffectList const& mDummyAuras = victim->GetAuraEffectsByType(SPELL_AURA_DUMMY); + AuraEffectList const& mDummyAuras = GetAuraEffectsByType(SPELL_AURA_DUMMY); for (AuraEffectList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i) { switch ((*i)->GetSpellInfo()->SpellIconID) @@ -11742,9 +11873,9 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT case 2109: if ((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) { - if (victim->GetTypeId() != TYPEID_PLAYER) + if (GetTypeId() != TYPEID_PLAYER) continue; - float mod = victim->ToPlayer()->GetRatingBonusValue(CR_CRIT_TAKEN_MELEE) * (-8.0f); + float mod = ToPlayer()->GetRatingBonusValue(CR_CRIT_TAKEN_MELEE) * (-8.0f); AddPctF(TakenTotalMod, std::max(mod, float((*i)->GetAmount()))); } break; @@ -11752,38 +11883,31 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT } // .. taken pct: class scripts - /*AuraEffectList const& mclassScritAuras = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); - for (AuraEffectList::const_iterator i = mclassScritAuras.begin(); i != mclassScritAuras.end(); ++i) - { - switch ((*i)->GetMiscValue()) - { - } - }*/ + //*AuraEffectList const& mclassScritAuras = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); + //for (AuraEffectList::const_iterator i = mclassScritAuras.begin(); i != mclassScritAuras.end(); ++i) + //{ + // switch ((*i)->GetMiscValue()) + // { + // } + //}*/ if (attType != RANGED_ATTACK) { - AuraEffectList const& mModMeleeDamageTakenPercent = victim->GetAuraEffectsByType(SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT); + AuraEffectList const& mModMeleeDamageTakenPercent = GetAuraEffectsByType(SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT); for (AuraEffectList::const_iterator i = mModMeleeDamageTakenPercent.begin(); i != mModMeleeDamageTakenPercent.end(); ++i) AddPctN(TakenTotalMod, (*i)->GetAmount()); } else { - AuraEffectList const& mModRangedDamageTakenPercent = victim->GetAuraEffectsByType(SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT); + AuraEffectList const& mModRangedDamageTakenPercent = GetAuraEffectsByType(SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT); for (AuraEffectList::const_iterator i = mModRangedDamageTakenPercent.begin(); i != mModRangedDamageTakenPercent.end(); ++i) AddPctN(TakenTotalMod, (*i)->GetAmount()); } - float tmpDamage = float(int32(*pdamage) + DoneFlatBenefit) * DoneTotalMod; - - // apply spellmod to Done damage - if (spellProto) - if (Player* modOwner = GetSpellModOwner()) - modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_DAMAGE, tmpDamage); - - tmpDamage = (tmpDamage + TakenFlatBenefit) * TakenTotalMod; + float tmpDamage = (float(pdamage) + TakenFlatBenefit) * TakenTotalMod; // bonus result can be negative - *pdamage = uint32(std::max(tmpDamage, 0.0f)); + return uint32(std::max(tmpDamage, 0.0f)); } void Unit::ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply) @@ -11855,7 +11979,9 @@ float Unit::GetWeaponProcChance() const float Unit::GetPPMProcChance(uint32 WeaponSpeed, float PPM, const SpellInfo* spellProto) const { // proc per minute chance calculation - if (PPM <= 0) return 0.0f; + if (PPM <= 0) + return 0.0f; + // Apply chance modifer aura if (spellProto) if (Player* modOwner = GetSpellModOwner()) @@ -12116,7 +12242,7 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy) UpdateSpeed(MOVE_FLIGHT, true); } - if (!(creature->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_MOUNTED_COMBAT)) + if (!(creature->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_MOUNTED_COMBAT)) Dismount(); } @@ -12135,12 +12261,12 @@ void Unit::ClearInCombat() // Player's state will be cleared in Player::UpdateContestedPvP if (Creature* creature = ToCreature()) { - if (creature->GetCreatureInfo() && creature->GetCreatureInfo()->unit_flags & UNIT_FLAG_IMMUNE_TO_PC) + if (creature->GetCreatureTemplate() && creature->GetCreatureTemplate()->unit_flags & UNIT_FLAG_IMMUNE_TO_PC) SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); // set immunity state to the one from db on evade ClearUnitState(UNIT_STATE_ATTACK_PLAYER); if (HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED)) - SetUInt32Value(UNIT_DYNAMIC_FLAGS, creature->GetCreatureInfo()->dynamicflags); + SetUInt32Value(UNIT_DYNAMIC_FLAGS, creature->GetCreatureTemplate()->dynamicflags); if (creature->isPet()) { @@ -12179,7 +12305,7 @@ bool Unit::IsValidAttackTarget(Unit const* target) const } // function based on function Unit::CanAttack from 13850 client -bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) const +bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, WorldObject const* obj) const { ASSERT(target); @@ -12197,8 +12323,8 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) co if (IsOnVehicle(target) || m_vehicle->GetBase()->IsOnVehicle(target)) return false; - // can't attack invisible (ignore stealth for aoe spells) - if ((!bySpell || !(bySpell->AttributesEx6 & SPELL_ATTR6_CAN_TARGET_INVISIBLE)) && !canSeeOrDetect(target, bySpell && bySpell->IsAffectingArea())) + // can't attack invisible (ignore stealth for aoe spells) also if the area being looked at is from a spell use the dynamic object created instead of the casting unit. + if ((!bySpell || !(bySpell->AttributesEx6 & SPELL_ATTR6_CAN_TARGET_INVISIBLE)) && (obj ? !obj->canSeeOrDetect(target, bySpell && bySpell->IsAffectingArea()) : !canSeeOrDetect(target, bySpell && bySpell->IsAffectingArea()))) return false; // can't attack dead @@ -12255,7 +12381,7 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) co } Creature const* creatureAttacker = ToCreature(); - if (creatureAttacker && creatureAttacker->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_UNK26) + if (creatureAttacker && creatureAttacker->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_PARTY_MEMBER) return false; Player const* playerAffectingAttacker = HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) ? GetAffectingPlayer() : NULL; @@ -12342,7 +12468,7 @@ bool Unit::_IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) co // can't assist non-friendly targets if (GetReactionTo(target) <= REP_NEUTRAL && target->GetReactionTo(this) <= REP_NEUTRAL - && (!ToCreature() || !(ToCreature()->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_UNK26))) + && (!ToCreature() || !(ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_PARTY_MEMBER))) return false; // PvP case @@ -12376,7 +12502,7 @@ bool Unit::_IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) co && !((target->GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_PVP))) { if (Creature const* creatureTarget = target->ToCreature()) - return creatureTarget->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_UNK26 || creatureTarget->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_AID_PLAYERS; + return creatureTarget->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_PARTY_MEMBER || creatureTarget->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_AID_PLAYERS; } return true; } @@ -12490,6 +12616,12 @@ bool Unit::IsAlwaysVisibleFor(WorldObject const* seer) const if (seer->GetGUID() == guid) return true; + if (Player const* seerPlayer = seer->ToPlayer()) + if (Unit* owner = GetOwner()) + if (Player* ownerPlayer = owner->ToPlayer()) + if (ownerPlayer->IsGroupVisibleFor(seerPlayer)) + return true; + return false; } @@ -12598,7 +12730,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced) { // Set creature speed rate from CreatureInfo if (GetTypeId() == TYPEID_UNIT) - speed *= ToCreature()->GetCreatureInfo()->speed_walk; + speed *= ToCreature()->GetCreatureTemplate()->speed_walk; // Normalize speed by 191 aura SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED if need // TODO: possible affect only on MOVE_RUN @@ -13080,21 +13212,9 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) } } -void Unit::SetHover(bool on) -{ - if (on) - CastSpell(this, 11010, true); - else - RemoveAurasDueToSpell(11010); -} - void Unit::setDeathState(DeathState s) { - // death state needs to be updated before RemoveAllAurasOnDeath() calls HandleChannelDeathItem(..) so that - // it can be used to check creation of death items (such as soul shards). - m_deathState = s; - - if (s != ALIVE && s != JUST_ALIVED) + if (s != ALIVE && s != JUST_RESPAWNED) { CombatStop(); DeleteThreatList(); @@ -13116,9 +13236,18 @@ void Unit::setDeathState(DeathState s) // remove aurastates allowing special moves ClearAllReactives(); ClearDiminishings(); - GetMotionMaster()->Clear(false); - GetMotionMaster()->MoveIdle(); + if (IsInWorld()) + { + // Only clear MotionMaster for entities that exists in world + // Avoids crashes in the following conditions : + // * Using 'call pet' on dead pets + // * Using 'call stabled pet' + // * Logging in with dead pets + GetMotionMaster()->Clear(false); + GetMotionMaster()->MoveIdle(); + } StopMoving(); + DisableSpline(); // without this when removing IncreaseMaxHealth aura player may stuck with 1 hp // do not why since in IncreaseMaxHealth currenthealth is checked SetHealth(0); @@ -13128,8 +13257,10 @@ void Unit::setDeathState(DeathState s) if (ZoneScript* zoneScript = GetZoneScript() ? GetZoneScript() : (ZoneScript*)GetInstanceScript()) zoneScript->OnUnitDeath(this); } - else if (s == JUST_ALIVED) - RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground) + else if (s == JUST_RESPAWNED) + RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground) + + m_deathState = s; } /*######################################## @@ -13605,7 +13736,7 @@ float Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration, Unit const* source = casterOwner ? casterOwner : caster; if ((target->GetTypeId() == TYPEID_PLAYER - || ((Creature*)target)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH) + || ((Creature*)target)->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH) && source->GetTypeId() == TYPEID_PLAYER) duration = limitduration; } @@ -13614,7 +13745,7 @@ float Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration, if (group == DIMINISHING_TAUNT) { - if (GetTypeId() == TYPEID_UNIT && (ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_TAUNT_DIMINISH)) + if (GetTypeId() == TYPEID_UNIT && (ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_TAUNT_DIMINISH)) { DiminishingLevels diminish = Level; switch (diminish) @@ -13631,7 +13762,7 @@ float Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration, // Some diminishings applies to mobs too (for example, Stun) else if ((GetDiminishingReturnsGroupType(group) == DRTYPE_PLAYER && ((targetOwner ? (targetOwner->GetTypeId() == TYPEID_PLAYER) : (GetTypeId() == TYPEID_PLAYER)) - || (GetTypeId() == TYPEID_UNIT && ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH))) + || (GetTypeId() == TYPEID_UNIT && ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH))) || GetDiminishingReturnsGroupType(group) == DRTYPE_ALL) { DiminishingLevels diminish = Level; @@ -13715,7 +13846,7 @@ uint32 Unit::GetCreatureType() const return CREATURE_TYPE_HUMANOID; } else - return ToCreature()->GetCreatureInfo()->type; + return ToCreature()->GetCreatureTemplate()->type; } /*####################################### @@ -14365,12 +14496,7 @@ void CharmInfo::InitCharmCreateSpells() newstate = ACT_PASSIVE; else { - bool autocast = false; - for (uint32 i = 0; i < MAX_SPELL_EFFECTS && !autocast; ++i) - if (spellInfo->Effects[i].TargetA.GetType() == TARGET_TYPE_UNIT_TARGET) - autocast = true; - - if (autocast) + if (spellInfo->NeedsExplicitUnitTarget()) { newstate = ACT_ENABLED; ToggleCreatureAutocast(spellInfo, true); @@ -14804,7 +14930,8 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: doing %u damage from spell id %u (triggered by %s aura of spell %u)", triggeredByAura->GetAmount(), spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); SpellNonMeleeDamage damageInfo(this, target, spellInfo->Id, spellInfo->SchoolMask); - uint32 newDamage = SpellDamageBonus(target, spellInfo, triggeredByAura->GetAmount(), SPELL_DIRECT_DAMAGE); + uint32 newDamage = SpellDamageBonusDone(target, spellInfo, triggeredByAura->GetAmount(), SPELL_DIRECT_DAMAGE); + newDamage = target->SpellDamageBonusTaken(this, spellInfo, newDamage, SPELL_DIRECT_DAMAGE); CalculateSpellDamageTaken(&damageInfo, newDamage, spellInfo); DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb); SendSpellNonMeleeDamageLog(&damageInfo); @@ -15046,9 +15173,9 @@ Player* Unit::GetSpellModOwner() const } ///----------Pet responses methods----------------- -void Unit::SendPetCastFail(uint32 spellid, SpellCastResult msg) +void Unit::SendPetCastFail(uint32 spellid, SpellCastResult result) { - if (msg == SPELL_CAST_OK) + if (result == SPELL_CAST_OK) return; Unit* owner = GetCharmerOrOwner(); @@ -15056,15 +15183,13 @@ void Unit::SendPetCastFail(uint32 spellid, SpellCastResult msg) return; WorldPacket data(SMSG_PET_CAST_FAILED, 1 + 4 + 1); - data << uint8(0); // cast count? + data << uint8(0); // cast count data << uint32(spellid); - data << uint8(msg); - // uint32 for some reason - // uint32 for some reason + data << uint8(result); owner->ToPlayer()->GetSession()->SendPacket(&data); } -void Unit::SendPetActionFeedback (uint8 msg) +void Unit::SendPetActionFeedback(uint8 msg) { Unit* owner = GetOwner(); if (!owner || owner->GetTypeId() != TYPEID_PLAYER) @@ -15075,7 +15200,7 @@ void Unit::SendPetActionFeedback (uint8 msg) owner->ToPlayer()->GetSession()->SendPacket(&data); } -void Unit::SendPetTalk (uint32 pettalk) +void Unit::SendPetTalk(uint32 pettalk) { Unit* owner = GetOwner(); if (!owner || owner->GetTypeId() != TYPEID_PLAYER) @@ -15306,7 +15431,7 @@ Unit* Unit::SelectNearbyTarget(Unit* exclude, float dist) const return NULL; // select random - return SelectRandomContainerElement(targets); + return Trinity::Containers::SelectRandomContainerElement(targets); } void Unit::ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply) @@ -15333,7 +15458,7 @@ void Unit::ApplyCastTimePercentMod(float val, bool apply) ApplyPercentModFloatValue(UNIT_MOD_CAST_SPEED, -val, apply); } -uint32 Unit::GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectType damagetype, uint32 CastingTime) +uint32 Unit::GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectType damagetype, uint32 CastingTime) const { // Not apply this to creature casted spells with casttime == 0 if (CastingTime == 0 && GetTypeId() == TYPEID_UNIT && !ToCreature()->isPet()) @@ -15406,20 +15531,21 @@ uint32 Unit::GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectTyp if (AreaEffect) CastingTime /= 2; - // -5% of total per any additional effect - for (uint8 i = 0; i < effects; ++i) + // 50% for damage and healing spells for leech spells from damage bonus and 0% from healing + for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) { - if (CastingTime > 175) - { - CastingTime -= 175; - } - else + if (spellProto->Effects[j].Effect == SPELL_EFFECT_HEALTH_LEECH || + (spellProto->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA && spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_LEECH)) { - CastingTime = 0; + CastingTime /= 2; break; } } + // -5% of total per any additional effect + for (uint8 i = 0; i < effects; ++i) + CastingTime *= 0.95f; + return CastingTime; } @@ -15450,6 +15576,29 @@ void Unit::UpdateAuraForGroup(uint8 slot) } } +float Unit::CalculateDefaultCoefficient(SpellInfo const *spellInfo, DamageEffectType damagetype) const +{ + // Damage over Time spells bonus calculation + float DotFactor = 1.0f; + if (damagetype == DOT) + { + + int32 DotDuration = spellInfo->GetDuration(); + if (!spellInfo->IsChanneled() && DotDuration > 0) + DotFactor = DotDuration / 15000.0f; + + if (uint32 DotTicks = spellInfo->GetMaxTicks()) + DotFactor /= DotTicks; + } + + int32 CastingTime = spellInfo->IsChanneled() ? spellInfo->GetDuration() : spellInfo->CalcCastTime(); + // Distribute Damage over multiple effects, reduce by AoE + CastingTime = GetCastingTimeForBonus(spellInfo, damagetype, CastingTime); + + // As wowwiki says: C = (Cast Time / 3.5) + return (CastingTime / 3500.0f) * DotFactor; +} + float Unit::GetAPMultiplier(WeaponAttackType attType, bool normalized) { if (!normalized || GetTypeId() != TYPEID_PLAYER) @@ -15860,10 +16009,10 @@ void Unit::Kill(Unit* victim, bool durabilityLoss) creature->lootForPickPocketed = false; loot->clear(); - if (uint32 lootid = creature->GetCreatureInfo()->lootid) + if (uint32 lootid = creature->GetCreatureTemplate()->lootid) loot->FillLoot(lootid, LootTemplates_Creature, looter, false, false, creature->GetLootMode()); - loot->generateMoneyLoot(creature->GetCreatureInfo()->mingold, creature->GetCreatureInfo()->maxgold); + loot->generateMoneyLoot(creature->GetCreatureTemplate()->mingold, creature->GetCreatureTemplate()->maxgold); } player->RewardPlayerAndGroupAtKill(victim, false); @@ -15921,7 +16070,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss) // Inform pets (if any) when player kills target) // MUST come after victim->setDeathState(JUST_DIED); or pet next target // selection will get stuck on same target and break pet react state - if (Player* player = ToPlayer()) + if (player) { Pet* pet = player->GetPet(); if (pet && pet->isAlive() && pet->isControlled()) @@ -15964,7 +16113,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss) if (!creature->isPet()) { creature->DeleteThreatList(); - CreatureTemplate const* cInfo = creature->GetCreatureInfo(); + CreatureTemplate const* cInfo = creature->GetCreatureTemplate(); if (cInfo && (cInfo->lootid || cInfo->maxgold > 0)) creature->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); } @@ -15993,7 +16142,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss) { if (instanceMap->IsRaidOrHeroicDungeon()) { - if (creature->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND) + if (creature->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND) ((InstanceMap*)instanceMap)->PermBindAllPlayers(creditedPlayer); } else @@ -16402,7 +16551,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au case CHARM_TYPE_CHARM: if (GetTypeId() == TYPEID_UNIT && charmer->getClass() == CLASS_WARLOCK) { - CreatureTemplate const* cinfo = ToCreature()->GetCreatureInfo(); + CreatureTemplate const* cinfo = ToCreature()->GetCreatureTemplate(); if (cinfo && cinfo->type == CREATURE_TYPE_DEMON) { // to prevent client crash @@ -16506,7 +16655,7 @@ void Unit::RemoveCharmedBy(Unit* charmer) case CHARM_TYPE_CHARM: if (GetTypeId() == TYPEID_UNIT && charmer->getClass() == CLASS_WARLOCK) { - CreatureTemplate const* cinfo = ToCreature()->GetCreatureInfo(); + CreatureTemplate const* cinfo = ToCreature()->GetCreatureTemplate(); if (cinfo && cinfo->type == CREATURE_TYPE_DEMON) { SetByteValue(UNIT_FIELD_BYTES_0, 1, uint8(cinfo->unit_class)); @@ -16545,7 +16694,7 @@ void Unit::RestoreFaction() } } - if (CreatureTemplate const* cinfo = ToCreature()->GetCreatureInfo()) // normal creature + if (CreatureTemplate const* cinfo = ToCreature()->GetCreatureTemplate()) // normal creature { FactionTemplateEntry const* faction = getFactionTemplateEntry(); setFaction((faction && faction->friendlyMask & 0x004) ? cinfo->faction_H : cinfo->faction_A); @@ -16616,7 +16765,10 @@ bool Unit::IsInPartyWith(Unit const* unit) const return true; if (u1->GetTypeId() == TYPEID_PLAYER && u2->GetTypeId() == TYPEID_PLAYER) - return u1->ToPlayer()->IsInSameGroupWith(u2->ToPlayer()); + return u1->ToPlayer()->IsInSameGroupWith(u2->ToPlayer()); + else if ((u2->GetTypeId() == TYPEID_PLAYER && u1->GetTypeId() == TYPEID_UNIT && u1->ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_PARTY_MEMBER) || + (u1->GetTypeId() == TYPEID_PLAYER && u2->GetTypeId() == TYPEID_UNIT && u2->ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_PARTY_MEMBER)) + return true; else return false; } @@ -16632,82 +16784,14 @@ bool Unit::IsInRaidWith(Unit const* unit) const return true; if (u1->GetTypeId() == TYPEID_PLAYER && u2->GetTypeId() == TYPEID_PLAYER) - return u1->ToPlayer()->IsInSameRaidWith(u2->ToPlayer()); + return u1->ToPlayer()->IsInSameRaidWith(u2->ToPlayer()); + else if ((u2->GetTypeId() == TYPEID_PLAYER && u1->GetTypeId() == TYPEID_UNIT && u1->ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_PARTY_MEMBER) || + (u1->GetTypeId() == TYPEID_PLAYER && u2->GetTypeId() == TYPEID_UNIT && u2->ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_PARTY_MEMBER)) + return true; else return false; } -void Unit::GetRaidMember(std::list<Unit*> &nearMembers, float radius) -{ - Player* owner = GetCharmerOrOwnerPlayerOrPlayerItself(); - if (!owner) - return; - - Group* group = owner->GetGroup(); - if (group) - { - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) - { - Player* Target = itr->getSource(); - - if (Target && !IsHostileTo(Target)) - { - if (Target->isAlive() && IsWithinDistInMap(Target, radius)) - nearMembers.push_back(Target); - - if (Guardian* pet = Target->GetGuardianPet()) - if (pet->isAlive() && IsWithinDistInMap(pet, radius)) - nearMembers.push_back(pet); - } - } - } - else - { - if (owner->isAlive() && (owner == this || IsWithinDistInMap(owner, radius))) - nearMembers.push_back(owner); - if (Guardian* pet = owner->GetGuardianPet()) - if (pet->isAlive() && (pet == this || IsWithinDistInMap(pet, radius))) - nearMembers.push_back(pet); - } -} - -void Unit::GetPartyMemberInDist(std::list<Unit*> &TagUnitMap, float radius) -{ - Unit* owner = GetCharmerOrOwnerOrSelf(); - Group* group = NULL; - if (owner->GetTypeId() == TYPEID_PLAYER) - group = owner->ToPlayer()->GetGroup(); - - if (group) - { - uint8 subgroup = owner->ToPlayer()->GetSubGroup(); - - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) - { - Player* Target = itr->getSource(); - - // IsHostileTo check duel and controlled by enemy - if (Target && Target->GetSubGroup() == subgroup && !IsHostileTo(Target)) - { - if (Target->isAlive() && IsWithinDistInMap(Target, radius)) - TagUnitMap.push_back(Target); - - if (Guardian* pet = Target->GetGuardianPet()) - if (pet->isAlive() && IsWithinDistInMap(pet, radius)) - TagUnitMap.push_back(pet); - } - } - } - else - { - if (owner->isAlive() && (owner == this || IsWithinDistInMap(owner, radius))) - TagUnitMap.push_back(owner); - if (Guardian* pet = owner->GetGuardianPet()) - if (pet->isAlive() && (pet == this || IsWithinDistInMap(pet, radius))) - TagUnitMap.push_back(pet); - } -} - void Unit::GetPartyMembers(std::list<Unit*> &TagUnitMap) { Unit* owner = GetCharmerOrOwnerOrSelf(); @@ -16919,7 +17003,41 @@ void Unit::SetPhaseMask(uint32 newPhaseMask, bool update) return; if (IsInWorld()) - RemoveNotOwnSingleTargetAuras(newPhaseMask); // we can lost access to caster or target + { + RemoveNotOwnSingleTargetAuras(newPhaseMask); // we can lost access to caster or target + + // modify hostile references for new phasemask, some special cases deal with hostile references themselves + if (GetTypeId() == TYPEID_UNIT || (!ToPlayer()->isGameMaster() && !ToPlayer()->GetSession()->PlayerLogout())) + { + HostileRefManager& refManager = getHostileRefManager(); + HostileReference* ref = refManager.getFirst(); + + while (ref) + { + if (Unit* unit = ref->getSource()->getOwner()) + if (Creature* creature = unit->ToCreature()) + refManager.setOnlineOfflineState(creature, creature->InSamePhase(newPhaseMask)); + + ref = ref->next(); + } + + // modify threat lists for new phasemask + if (GetTypeId() != TYPEID_PLAYER) + { + std::list<HostileReference*> threatList = getThreatManager().getThreatList(); + std::list<HostileReference*> offlineThreatList = getThreatManager().getOfflineThreatList(); + + // merge expects sorted lists + threatList.sort(); + offlineThreatList.sort(); + threatList.merge(offlineThreatList); + + for (std::list<HostileReference*>::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr) + if (Unit* unit = (*itr)->getTarget()) + unit->getHostileRefManager().setOnlineOfflineState(ToCreature(), unit->InSamePhase(newPhaseMask)); + } + } + } WorldObject::SetPhaseMask(newPhaseMask, update); @@ -17393,7 +17511,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId) } if (IsInMap(caster)) - caster->CastCustomSpell(itr->second.spellId, SpellValueMod(SPELLVALUE_BASE_POINT0+i), seatId+1, target, true, NULL, NULL, origCasterGUID); + caster->CastCustomSpell(itr->second.spellId, SpellValueMod(SPELLVALUE_BASE_POINT0+i), seatId+1, target, false, NULL, NULL, origCasterGUID); else // This can happen during Player::_LoadAuras { int32 bp0 = seatId; @@ -17403,7 +17521,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId) else { if (IsInMap(caster)) - caster->CastSpell(target, spellEntry, true, NULL, NULL, origCasterGUID); + caster->CastSpell(target, spellEntry, false, NULL, NULL, origCasterGUID); else Aura::TryRefreshStackOrCreate(spellEntry, MAX_EFFECT_MASK, this, clicker, NULL, NULL, origCasterGUID); } @@ -17497,14 +17615,14 @@ void Unit::ChangeSeat(int8 seatId, bool next) ASSERT(false); } -void Unit::ExitVehicle(Position const* exitPosition) +void Unit::ExitVehicle(Position const* /*exitPosition*/) { //! This function can be called at upper level code to initialize an exit from the passenger's side. if (!m_vehicle) return; GetVehicleBase()->RemoveAurasByType(SPELL_AURA_CONTROL_VEHICLE, GetGUID()); - //! The following call would not even be executed successfully as the + //! The following call would not even be executed successfully as the //! SPELL_AURA_CONTROL_VEHICLE unapply handler already calls _ExitVehicle without //! specifying an exitposition. The subsequent call below would return on if (!m_vehicle). /*_ExitVehicle(exitPosition);*/ @@ -17513,7 +17631,7 @@ void Unit::ExitVehicle(Position const* exitPosition) //! to specify exit coordinates and either store those per passenger, or we need to //! init spline movement based on those coordinates in unapply handlers, and //! relocate exiting passengers based on Unit::moveSpline data. Either way, - //! Coming Soon™ + //! Coming Soon(TM) } void Unit::_ExitVehicle(Position const* exitPosition) @@ -17670,18 +17788,12 @@ void Unit::BuildMovementPacket(ByteBuffer *data) const *data << (float)m_movementInfo.splineElevation; } -void Unit::SetFlying(bool apply) +void Unit::SetCanFly(bool apply) { if (apply) - { - SetByteFlag(UNIT_FIELD_BYTES_1, 3, 0x02); - AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_FLYING); - } + AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY); else - { - RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, 0x02); - RemoveUnitMovementFlag(MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_FLYING); - } + RemoveUnitMovementFlag(MOVEMENTFLAG_CAN_FLY); } void Unit::NearTeleportTo(float x, float y, float z, float orientation, bool casting /*= false*/) @@ -17722,14 +17834,30 @@ bool Unit::UpdatePosition(float x, float y, float z, float orientation, bool tel GetMap()->CreatureRelocation(ToCreature(), x, y, z, orientation); } else if (turn) - SetOrientation(orientation); + UpdateOrientation(orientation); - if ((relocated || turn) && IsVehicle()) - GetVehicleKit()->RelocatePassengers(x, y, z, orientation); + // code block for underwater state update + UpdateUnderwaterState(GetMap(), x, y, z); return (relocated || turn); } +//! Only server-side orientation update, does not broadcast to client +void Unit::UpdateOrientation(float orientation) +{ + SetOrientation(orientation); + if (IsVehicle()) + GetVehicleKit()->RelocatePassengers(GetPositionX(), GetPositionY(), GetPositionZ(), orientation); +} + +//! Only server-side height update, does not broadcast to client +void Unit::UpdateHeight(float newZ) +{ + Relocate(GetPositionX(), GetPositionY(), newZ); + if (IsVehicle()) + GetVehicleKit()->RelocatePassengers(GetPositionX(), GetPositionY(), newZ, GetOrientation()); +} + void Unit::SendThreatListUpdate() { if (!getThreatManager().isThreatListEmpty()) @@ -17992,12 +18120,130 @@ void Unit::SetFacingTo(float ori) init.Launch(); } -void Unit::SetFacingToObject(WorldObject* pObject) +void Unit::SetFacingToObject(WorldObject* object) { // never face when already moving if (!IsStopped()) return; // TODO: figure out under what conditions creature will move towards object instead of facing it where it currently is. - SetFacingTo(GetAngle(pObject)); + SetFacingTo(GetAngle(object)); +} + +bool Unit::SetWalk(bool enable) +{ + if (enable == IsWalking()) + return false; + + if (enable) + AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + else + RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + + return true; +} + +bool Unit::SetDisableGravity(bool disable, bool /*packetOnly = false*/) +{ + if (disable == IsLevitating()) + return false; + + if (disable) + AddUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY); + else + RemoveUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY); + + return true; +} + +bool Unit::SetHover(bool enable) +{ + if (enable == HasUnitMovementFlag(MOVEMENTFLAG_HOVER)) + return false; + + if (enable) + { + //! No need to check height on ascent + AddUnitMovementFlag(MOVEMENTFLAG_HOVER); + if (float hh = GetFloatValue(UNIT_FIELD_HOVERHEIGHT)) + UpdateHeight(GetPositionZ() + hh); + } + else + { + RemoveUnitMovementFlag(MOVEMENTFLAG_HOVER); + if (float hh = GetFloatValue(UNIT_FIELD_HOVERHEIGHT)) + { + float newZ = GetPositionZ() - hh; + UpdateAllowedPositionZ(GetPositionX(), GetPositionY(), newZ); + UpdateHeight(newZ); + } + } + + return true; +} + +void Unit::SendMovementHover() +{ + if (GetTypeId() == TYPEID_PLAYER) + ToPlayer()->SendMovementSetHover(HasUnitMovementFlag(MOVEMENTFLAG_HOVER)); + + WorldPacket data(MSG_MOVE_HOVER, 64); + data.append(GetPackGUID()); + BuildMovementPacket(&data); + SendMessageToSet(&data, false); +} + +void Unit::SendMovementWaterWalking() +{ + if (GetTypeId() == TYPEID_PLAYER) + ToPlayer()->SendMovementSetWaterWalking(HasUnitMovementFlag(MOVEMENTFLAG_WATERWALKING)); + + WorldPacket data(MSG_MOVE_WATER_WALK, 64); + data.append(GetPackGUID()); + BuildMovementPacket(&data); + SendMessageToSet(&data, false); +} + +void Unit::SendMovementFeatherFall() +{ + if (GetTypeId() == TYPEID_PLAYER) + ToPlayer()->SendMovementSetFeatherFall(HasUnitMovementFlag(MOVEMENTFLAG_FALLING_SLOW)); + + WorldPacket data(MSG_MOVE_FEATHER_FALL, 64); + data.append(GetPackGUID()); + BuildMovementPacket(&data); + SendMessageToSet(&data, false); +} + +void Unit::SendMovementGravityChange() +{ + WorldPacket data(MSG_MOVE_GRAVITY_CHNG, 64); + data.append(GetPackGUID()); + BuildMovementPacket(&data); + SendMessageToSet(&data, false); +} + +void Unit::SendMovementCanFlyChange() +{ + /*! + if ( a3->MoveFlags & MOVEMENTFLAG_CAN_FLY ) + { + v4->MoveFlags |= 0x1000000u; + result = 1; + } + else + { + if ( v4->MoveFlags & MOVEMENTFLAG_FLYING ) + CMovement::DisableFlying(v4); + v4->MoveFlags &= 0xFEFFFFFFu; + result = 1; + } + */ + if (GetTypeId() == TYPEID_PLAYER) + ToPlayer()->SendMovementSetCanFly(CanFly()); + + WorldPacket data(MSG_MOVE_UPDATE_CAN_FLY, 64); + data.append(GetPackGUID()); + BuildMovementPacket(&data); + SendMessageToSet(&data, false); } diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index e82c755ae41..9d6c22ab8b5 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -185,10 +185,10 @@ enum UnitStandFlags // byte flags value (UNIT_FIELD_BYTES_1, 3) enum UnitBytes1_Flags { - UNIT_BYTE1_FLAG_ALWAYS_STAND = 0x01, - UNIT_BYTE1_FLAG_UNK_2 = 0x02, - UNIT_BYTE1_FLAG_UNK_3 = 0x04, - UNIT_BYTE1_FLAG_ALL = 0xFF + UNIT_BYTE1_FLAG_ALWAYS_STAND = 0x01, + UNIT_BYTE1_FLAG_HOVER = 0x02, + UNIT_BYTE1_FLAG_UNK_3 = 0x04, + UNIT_BYTE1_FLAG_ALL = 0xFF }; // high byte (3 from 0..3) of UNIT_FIELD_BYTES_2 @@ -287,29 +287,29 @@ enum HitInfo { HITINFO_NORMALSWING = 0x00000000, HITINFO_UNK1 = 0x00000001, // req correct packet structure - HITINFO_NORMALSWING2 = 0x00000002, - HITINFO_LEFTSWING = 0x00000004, + HITINFO_AFFECTS_VICTIM = 0x00000002, + HITINFO_OFFHAND = 0x00000004, HITINFO_UNK2 = 0x00000008, HITINFO_MISS = 0x00000010, - HITINFO_ABSORB = 0x00000020, // absorbed damage - HITINFO_ABSORB2 = 0x00000040, // absorbed damage - HITINFO_RESIST = 0x00000080, // resisted atleast some damage - HITINFO_RESIST2 = 0x00000100, // resisted atleast some damage + HITINFO_FULL_ABSORB = 0x00000020, + HITINFO_PARTIAL_ABSORB = 0x00000040, + HITINFO_FULL_RESIST = 0x00000080, + HITINFO_PARTIAL_RESIST = 0x00000100, HITINFO_CRITICALHIT = 0x00000200, // critical hit // 0x00000400 // 0x00000800 // 0x00001000 HITINFO_BLOCK = 0x00002000, // blocked damage - // 0x00004000 - // 0x00008000 + // 0x00004000 // Hides worldtext for 0 damage + // 0x00008000 // Related to blood visual HITINFO_GLANCING = 0x00010000, HITINFO_CRUSHING = 0x00020000, - HITINFO_NOACTION = 0x00040000, // guessed + HITINFO_NO_ANIMATION = 0x00040000, // 0x00080000 // 0x00100000 - HITINFO_SWINGNOHITSOUND = 0x00200000, // guessed + HITINFO_SWINGNOHITSOUND = 0x00200000, // unused? // 0x00400000 - HITINFO_UNK3 = 0x00800000 + HITINFO_RAGE_GAIN = 0x00800000 }; //i would like to remove this: (it is defined in item.h @@ -342,6 +342,7 @@ class Transport; class Vehicle; typedef std::list<Unit*> UnitList; +typedef std::list< std::pair<Aura*, uint8> > DispelChargesList; struct SpellImmune { @@ -464,7 +465,7 @@ enum DeathState JUST_DIED = 1, CORPSE = 2, DEAD = 3, - JUST_ALIVED = 4, + JUST_RESPAWNED = 4, }; enum UnitState @@ -498,9 +499,8 @@ enum UnitState UNIT_STATE_CHASE_MOVE = 0x04000000, UNIT_STATE_FOLLOW_MOVE = 0x08000000, UNIT_STATE_UNATTACKABLE = (UNIT_STATE_IN_FLIGHT | UNIT_STATE_ONVEHICLE), - //UNIT_STATE_MOVING = (UNIT_STATE_ROAMING | UNIT_STATE_CHASE), // for real move using movegen check and stop (except unstoppable flight) - UNIT_STATE_MOVING = UNIT_STATE_ROAMING_MOVE | UNIT_STATE_CONFUSED_MOVE | UNIT_STATE_FLEEING_MOVE| UNIT_STATE_CHASE_MOVE | UNIT_STATE_FOLLOW_MOVE , + UNIT_STATE_MOVING = UNIT_STATE_ROAMING_MOVE | UNIT_STATE_CONFUSED_MOVE | UNIT_STATE_FLEEING_MOVE | UNIT_STATE_CHASE_MOVE | UNIT_STATE_FOLLOW_MOVE , UNIT_STATE_CONTROLLED = (UNIT_STATE_CONFUSED | UNIT_STATE_STUNNED | UNIT_STATE_FLEEING), UNIT_STATE_LOST_CONTROL = (UNIT_STATE_CONTROLLED | UNIT_STATE_JUMPING | UNIT_STATE_CHARGING), UNIT_STATE_SIGHTLESS = (UNIT_STATE_LOST_CONTROL | UNIT_STATE_EVADE), @@ -676,10 +676,10 @@ enum MovementFlags MOVEMENTFLAG_PITCH_DOWN = 0x00000080, MOVEMENTFLAG_WALKING = 0x00000100, // Walking MOVEMENTFLAG_ONTRANSPORT = 0x00000200, // Used for flying on some creatures - MOVEMENTFLAG_LEVITATING = 0x00000400, + MOVEMENTFLAG_DISABLE_GRAVITY = 0x00000400, // Former MOVEMENTFLAG_LEVITATING. This is used when walking is not possible. MOVEMENTFLAG_ROOT = 0x00000800, // Must not be set along with MOVEMENTFLAG_MASK_MOVING - MOVEMENTFLAG_JUMPING = 0x00001000, - MOVEMENTFLAG_FALLING = 0x00002000, // damage dealt on that type of falling + MOVEMENTFLAG_FALLING = 0x00001000, // damage dealt on that type of falling + MOVEMENTFLAG_FALLING_FAR = 0x00002000, MOVEMENTFLAG_PENDING_STOP = 0x00004000, MOVEMENTFLAG_PENDING_STRAFE_STOP = 0x00008000, MOVEMENTFLAG_PENDING_FORWARD = 0x00010000, @@ -690,8 +690,8 @@ enum MovementFlags MOVEMENTFLAG_SWIMMING = 0x00200000, // appears with fly flag also MOVEMENTFLAG_ASCENDING = 0x00400000, // press "space" when flying MOVEMENTFLAG_DESCENDING = 0x00800000, - MOVEMENTFLAG_CAN_FLY = 0x01000000, // can fly - MOVEMENTFLAG_FLYING = 0x02000000, // hover + MOVEMENTFLAG_CAN_FLY = 0x01000000, // Appears when unit can fly AND also walk + MOVEMENTFLAG_FLYING = 0x02000000, // unit is actually flying. pretty sure this is only used for players. creatures use disable_gravity MOVEMENTFLAG_SPLINE_ELEVATION = 0x04000000, // used for flight paths MOVEMENTFLAG_SPLINE_ENABLED = 0x08000000, // used for flight paths MOVEMENTFLAG_WATERWALKING = 0x10000000, // prevent unit from falling through water @@ -701,11 +701,18 @@ enum MovementFlags // TODO: Check if PITCH_UP and PITCH_DOWN really belong here.. MOVEMENTFLAG_MASK_MOVING = MOVEMENTFLAG_FORWARD | MOVEMENTFLAG_BACKWARD | MOVEMENTFLAG_STRAFE_LEFT | MOVEMENTFLAG_STRAFE_RIGHT | - MOVEMENTFLAG_PITCH_UP | MOVEMENTFLAG_PITCH_DOWN | MOVEMENTFLAG_JUMPING | MOVEMENTFLAG_FALLING | MOVEMENTFLAG_ASCENDING | MOVEMENTFLAG_DESCENDING | + MOVEMENTFLAG_PITCH_UP | MOVEMENTFLAG_PITCH_DOWN | MOVEMENTFLAG_FALLING | MOVEMENTFLAG_FALLING_FAR | MOVEMENTFLAG_ASCENDING | MOVEMENTFLAG_DESCENDING | MOVEMENTFLAG_SPLINE_ELEVATION, MOVEMENTFLAG_MASK_TURNING = MOVEMENTFLAG_LEFT | MOVEMENTFLAG_RIGHT, + + MOVEMENTFLAG_MASK_MOVING_FLY = + MOVEMENTFLAG_FLYING | MOVEMENTFLAG_ASCENDING | MOVEMENTFLAG_DESCENDING, + + //! TODO if needed: add more flags to this masks that are exclusive to players + MOVEMENTFLAG_MASK_PLAYER_ONLY = + MOVEMENTFLAG_FLYING, }; enum MovementFlags2 { @@ -1232,7 +1239,7 @@ class Unit : public WorldObject typedef std::map<uint8, AuraApplication*> VisibleAuraMap; - virtual ~Unit (); + virtual ~Unit(); UnitAI* GetAI() { return i_AI; } void SetAI(UnitAI* newAI) { i_AI = newAI; } @@ -1301,7 +1308,7 @@ class Unit : public WorldObject void StopAttackFaction(uint32 faction_id); Unit* SelectNearbyTarget(Unit* exclude = NULL, float dist = NOMINAL_MELEE_RANGE) const; void SendMeleeAttackStop(Unit* victim = NULL); - void SendMeleeAttackStart(Unit* pVictim); + void SendMeleeAttackStart(Unit* victim); void AddUnitState(uint32 f) { m_state |= f; } bool HasUnitState(const uint32 f) const { return (m_state & f); } @@ -1332,7 +1339,7 @@ class Unit : public WorldObject float GetStat(Stats stat) const { return float(GetUInt32Value(UNIT_FIELD_STAT0+stat)); } void SetStat(Stats stat, int32 val) { SetStatInt32Value(UNIT_FIELD_STAT0+stat, val); } - uint32 GetArmor() const { return GetResistance(SPELL_SCHOOL_NORMAL) ; } + uint32 GetArmor() const { return GetResistance(SPELL_SCHOOL_NORMAL); } void SetArmor(int32 val) { SetResistance(SPELL_SCHOOL_NORMAL, val); } uint32 GetResistance(SpellSchools school) const { return GetUInt32Value(UNIT_FIELD_RESISTANCES+school); } @@ -1396,9 +1403,7 @@ class Unit : public WorldObject bool IsNeutralToAll() const; bool IsInPartyWith(Unit const* unit) const; bool IsInRaidWith(Unit const* unit) const; - void GetPartyMemberInDist(std::list<Unit*> &units, float dist); void GetPartyMembers(std::list<Unit*> &units); - void GetRaidMember(std::list<Unit*> &units, float dist); bool IsContestedGuard() const { if (FactionTemplateEntry const* entry = getFactionTemplateEntry()) @@ -1436,12 +1441,12 @@ class Unit : public WorldObject MountCapabilityEntry const* GetMountCapability(uint32 mountType) const; uint16 GetMaxSkillValueForLevel(Unit const* target = NULL) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; } - void DealDamageMods(Unit* pVictim, uint32 &damage, uint32* absorb); - uint32 DealDamage(Unit* pVictim, uint32 damage, CleanDamage const* cleanDamage = NULL, DamageEffectType damagetype = DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* spellProto = NULL, bool durabilityLoss = true); - void Kill(Unit* pVictim, bool durabilityLoss = true); - int32 DealHeal(Unit* pVictim, uint32 addhealth); + void DealDamageMods(Unit* victim, uint32 &damage, uint32* absorb); + uint32 DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDamage = NULL, DamageEffectType damagetype = DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* spellProto = NULL, bool durabilityLoss = true); + void Kill(Unit* victim, bool durabilityLoss = true); + int32 DealHeal(Unit* victim, uint32 addhealth); - void ProcDamageAndSpell(Unit* pVictim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType = BASE_ATTACK, SpellInfo const* procSpell = NULL, SpellInfo const* procAura = NULL); + void ProcDamageAndSpell(Unit* victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType = BASE_ATTACK, SpellInfo const* procSpell = NULL, SpellInfo const* procAura = NULL); void ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const* procSpell, uint32 damage, SpellInfo const* procAura = NULL); void GetProcAurasTriggeredOnEvent(std::list<AuraApplication*>& aurasTriggeringProc, std::list<AuraApplication*>* procAuras, ProcEventInfo eventInfo); @@ -1450,9 +1455,9 @@ class Unit : public WorldObject void TriggerAurasProcOnEvent(ProcEventInfo& eventInfo, std::list<AuraApplication*>& procAuras); void HandleEmoteCommand(uint32 anim_id); - void AttackerStateUpdate (Unit* pVictim, WeaponAttackType attType = BASE_ATTACK, bool extra = false); + void AttackerStateUpdate (Unit* victim, WeaponAttackType attType = BASE_ATTACK, bool extra = false); - void CalculateMeleeDamage(Unit* pVictim, uint32 damage, CalcDamageInfo* damageInfo, WeaponAttackType attackType = BASE_ATTACK); + void CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* damageInfo, WeaponAttackType attackType = BASE_ATTACK); void DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss); void HandleProcExtraAttackFor(Unit* victim); @@ -1474,18 +1479,18 @@ class Unit : public WorldObject uint32 GetRangedDamageReduction(uint32 damage) const { return GetCombatRatingDamageReduction(CR_CRIT_TAKEN_RANGED, 2.0f, 100.0f, damage); } uint32 GetSpellDamageReduction(uint32 damage) const { return GetCombatRatingDamageReduction(CR_CRIT_TAKEN_SPELL, 2.0f, 100.0f, damage); } - void ApplyResilience(const Unit* pVictim, float * crit, int32 * damage, bool isCrit, CombatRating type) const; + void ApplyResilience(const Unit* victim, float * crit, int32 * damage, bool isCrit, CombatRating type) const; - float MeleeSpellMissChance(const Unit* pVictim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const; - SpellMissInfo MeleeSpellHitResult(Unit* pVictim, SpellInfo const* spell); - SpellMissInfo MagicSpellHitResult(Unit* pVictim, SpellInfo const* spell); - SpellMissInfo SpellHitResult(Unit* pVictim, SpellInfo const* spell, bool canReflect = false); + float MeleeSpellMissChance(const Unit* victim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const; + SpellMissInfo MeleeSpellHitResult(Unit* victim, SpellInfo const* spell); + SpellMissInfo MagicSpellHitResult(Unit* victim, SpellInfo const* spell); + SpellMissInfo SpellHitResult(Unit* victim, SpellInfo const* spell, bool canReflect = false); float GetUnitDodgeChance() const; float GetUnitParryChance() const; float GetUnitBlockChance() const; float GetUnitMissChance(WeaponAttackType attType) const; - float GetUnitCriticalChance(WeaponAttackType attackType, const Unit* pVictim) const; + float GetUnitCriticalChance(WeaponAttackType attackType, const Unit* victim) const; int32 GetMechanicResistChance(const SpellInfo* spell); bool CanUseAttackType(uint8 attacktype) const { @@ -1519,8 +1524,8 @@ class Unit : public WorldObject float GetWeaponProcChance() const; float GetPPMProcChance(uint32 WeaponSpeed, float PPM, const SpellInfo* spellProto) const; - MeleeHitOutcome RollMeleeOutcomeAgainst (const Unit* pVictim, WeaponAttackType attType) const; - MeleeHitOutcome RollMeleeOutcomeAgainst (const Unit* pVictim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance) const; + MeleeHitOutcome RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackType attType) const; + MeleeHitOutcome RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance) const; bool isVendor() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_VENDOR); } bool isTrainer() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TRAINER); } @@ -1571,20 +1576,21 @@ class Unit : public WorldObject bool isTargetableForAttack(bool checkFakeDeath = true) const; bool IsValidAttackTarget(Unit const* target) const; - bool _IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) const; + bool _IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, WorldObject const* obj = NULL) const; bool IsValidAssistTarget(Unit const* target) const; bool _IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) const; virtual bool IsInWater() const; virtual bool IsUnderWater() const; + virtual void UpdateUnderwaterState(Map* m, float x, float y, float z); bool isInAccessiblePlaceFor(Creature const* c) const; - void SendHealSpellLog(Unit* pVictim, uint32 SpellID, uint32 Damage, uint32 OverHeal, uint32 Absorb, bool critical = false); - int32 HealBySpell(Unit* pVictim, SpellInfo const* spellInfo, uint32 addHealth, bool critical = false); - void SendEnergizeSpellLog(Unit* pVictim, uint32 SpellID, uint32 Damage, Powers powertype); - void EnergizeBySpell(Unit* pVictim, uint32 SpellID, uint32 Damage, Powers powertype); - uint32 SpellNonMeleeDamageLog(Unit* pVictim, uint32 spellID, uint32 damage); + void SendHealSpellLog(Unit* victim, uint32 SpellID, uint32 Damage, uint32 OverHeal, uint32 Absorb, bool critical = false); + int32 HealBySpell(Unit* victim, SpellInfo const* spellInfo, uint32 addHealth, bool critical = false); + void SendEnergizeSpellLog(Unit* victim, uint32 SpellID, uint32 Damage, Powers powertype); + void EnergizeBySpell(Unit* victim, uint32 SpellID, uint32 Damage, Powers powertype); + uint32 SpellNonMeleeDamageLog(Unit* victim, uint32 spellID, uint32 damage); void CastSpell(SpellCastTargets const& targets, SpellInfo const* spellInfo, CustomSpellValues const* value, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); void CastSpell(Unit* victim, uint32 spellId, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); @@ -1617,6 +1623,8 @@ class Unit : public WorldObject virtual bool UpdatePosition(float x, float y, float z, float ang, bool teleport = false); // returns true if unit's position really changed bool UpdatePosition(const Position &pos, bool teleport = false) { return UpdatePosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teleport); } + void UpdateOrientation(float orientation); + void UpdateHeight(float newZ); void KnockbackFrom(float x, float y, float speedXY, float speedZ); void JumpTo(float speedXY, float speedZ, bool forward = true); @@ -1628,12 +1636,27 @@ class Unit : public WorldObject //void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player = NULL); void SendMonsterMoveTransport(Unit* vehicleOwner); void SendMovementFlagUpdate(); - bool IsLevitating() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_LEVITATING);} + + /*! These methods send the same packet to the client in apply and unapply case. + The client-side interpretation of this packet depends on the presence of relevant movementflags + which are sent with movementinfo. Furthermore, these packets are broadcast to nearby players as well + as the current unit. + */ + void SendMovementHover(); + void SendMovementFeatherFall(); + void SendMovementWaterWalking(); + void SendMovementGravityChange(); + void SendMovementCanFlyChange(); + + bool IsLevitating() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY);} bool IsWalking() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_WALKING);} + virtual bool SetWalk(bool enable); + virtual bool SetDisableGravity(bool disable, bool packetOnly = false); + bool SetHover(bool enable); void SetInFront(Unit const* target); void SetFacingTo(float ori); - void SetFacingToObject(WorldObject* pObject); + void SetFacingToObject(WorldObject* object); void SendChangeCurrentVictimOpcode(HostileReference* pHostileReference); void SendClearThreatListOpcode(); @@ -1805,6 +1828,8 @@ class Unit : public WorldObject AuraApplication * GetAuraApplicationOfRankedSpell(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0, AuraApplication * except = NULL) const; Aura* GetAuraOfRankedSpell(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0) const; + void GetDispellableAuraList(Unit* caster, uint32 dispelMask, DispelChargesList& dispelList); + bool HasAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster = 0) const; uint32 GetAuraCount(uint32 spellId) const; bool HasAura(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0) const; @@ -1958,10 +1983,10 @@ class Unit : public WorldObject // Threat related methods bool CanHaveThreatList() const; - void AddThreat(Unit* pVictim, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* threatSpell = NULL); + void AddThreat(Unit* victim, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* threatSpell = NULL); float ApplyTotalThreatModifier(float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL); void DeleteThreatList(); - void TauntApply(Unit* pVictim); + void TauntApply(Unit* victim); void TauntFadeOut(Unit* taunter); ThreatManager& getThreatManager() { return m_ThreatManager; } void addHatedBy(HostileReference* pHostileReference) { m_HostileRefManager.insertFirst(pHostileReference); }; @@ -2008,29 +2033,37 @@ class Unit : public WorldObject float GetAPMultiplier(WeaponAttackType attType, bool normalized); void ModifyAuraState(AuraStateType flag, bool apply); uint32 BuildAuraStateUpdateForTarget(Unit* target) const; - bool HasAuraState(AuraStateType flag, SpellInfo const* spellProto = NULL, Unit const* Caster = NULL) const ; + bool HasAuraState(AuraStateType flag, SpellInfo const* spellProto = NULL, Unit const* Caster = NULL) const; void UnsummonAllTotems(); Unit* GetMagicHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo); Unit* GetMeleeHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo = NULL); - int32 SpellBaseDamageBonus(SpellSchoolMask schoolMask); - int32 SpellBaseHealingBonus(SpellSchoolMask schoolMask); - int32 SpellBaseDamageBonusForVictim(SpellSchoolMask schoolMask, Unit* pVictim); - int32 SpellBaseHealingBonusForVictim(SpellSchoolMask schoolMask, Unit* pVictim); - uint32 SpellDamageBonus(Unit* pVictim, SpellInfo const* spellProto, uint32 damage, DamageEffectType damagetype, uint32 stack = 1); - uint32 SpellHealingBonus(Unit* pVictim, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1); - bool isSpellBlocked(Unit* pVictim, SpellInfo const* spellProto, WeaponAttackType attackType = BASE_ATTACK); + + int32 SpellBaseDamageBonusDone(SpellSchoolMask schoolMask); + int32 SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask); + uint32 SpellDamageBonusDone(Unit* victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack = 1); + uint32 SpellDamageBonusTaken(Unit* caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack = 1); + int32 SpellBaseHealingBonusDone(SpellSchoolMask schoolMask); + int32 SpellBaseHealingBonusTaken(SpellSchoolMask schoolMask); + uint32 SpellHealingBonusDone(Unit* victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1); + uint32 SpellHealingBonusTaken(Unit* caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1); + + uint32 MeleeDamageBonusDone(Unit *pVictim, uint32 damage, WeaponAttackType attType, SpellInfo const *spellProto = NULL); + uint32 MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage,WeaponAttackType attType, SpellInfo const *spellProto = NULL); + + + bool isSpellBlocked(Unit* victim, SpellInfo const* spellProto, WeaponAttackType attackType = BASE_ATTACK); bool isBlockCritical(); - bool isSpellCrit(Unit* pVictim, SpellInfo const* spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType = BASE_ATTACK) const; - uint32 SpellCriticalDamageBonus(SpellInfo const* spellProto, uint32 damage, Unit* pVictim); - uint32 SpellCriticalHealingBonus(SpellInfo const* spellProto, uint32 damage, Unit* pVictim); + bool isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType = BASE_ATTACK) const; + uint32 SpellCriticalDamageBonus(SpellInfo const* spellProto, uint32 damage, Unit* victim); + uint32 SpellCriticalHealingBonus(SpellInfo const* spellProto, uint32 damage, Unit* victim); void SetLastManaUse(uint32 spellCastTime) { m_lastManaUse = spellCastTime; } bool IsUnderLastManaUseEffect() const; void SetContestedPvP(Player* attackedPlayer = NULL); - void MeleeDamageBonus(Unit* pVictim, uint32 *damage, WeaponAttackType attType, SpellInfo const* spellProto = NULL); - uint32 GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectType damagetype, uint32 CastingTime); + uint32 GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectType damagetype, uint32 CastingTime) const; + float CalculateDefaultCoefficient(SpellInfo const *spellInfo, DamageEffectType damagetype) const; uint32 GetRemainingPeriodicAmount(uint64 caster, uint32 spellId, AuraType auraType, uint8 effectIndex = 0) const; @@ -2043,9 +2076,9 @@ class Unit : public WorldObject virtual bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const; // redefined in Creature static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const* spellInfo = NULL, uint8 effIndex = MAX_SPELL_EFFECTS); - uint32 CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellInfo const* spellInfo, WeaponAttackType attackType=MAX_ATTACK); - void CalcAbsorbResist(Unit* pVictim, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32 *absorb, uint32 *resist, SpellInfo const* spellInfo = NULL); - void CalcHealAbsorb(Unit* pVictim, const SpellInfo* spellProto, uint32 &healAmount, uint32 &absorb); + uint32 CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo const* spellInfo, WeaponAttackType attackType=MAX_ATTACK); + void CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32 *absorb, uint32 *resist, SpellInfo const* spellInfo = NULL); + void CalcHealAbsorb(Unit* victim, const SpellInfo* spellProto, uint32 &healAmount, uint32 &absorb); void UpdateSpeed(UnitMoveType mtype, bool forced); float GetSpeed(UnitMoveType mtype) const; @@ -2053,7 +2086,6 @@ class Unit : public WorldObject void SetSpeed(UnitMoveType mtype, float rate, bool forced = false); float m_TempSpeed; - void SetHover(bool on); bool isHover() const { return HasAuraType(SPELL_AURA_HOVER); } float ApplyEffectModifiers(SpellInfo const* spellProto, uint8 effect_index, float value) const; @@ -2077,7 +2109,7 @@ class Unit : public WorldObject void AddUnitMovementFlag(uint32 f) { m_movementInfo.flags |= f; } void RemoveUnitMovementFlag(uint32 f) { m_movementInfo.flags &= ~f; } - uint32 HasUnitMovementFlag(uint32 f) const { return m_movementInfo.flags & f; } + bool HasUnitMovementFlag(uint32 f) const { return (m_movementInfo.flags & f) == f; } uint32 GetUnitMovementFlags() const { return m_movementInfo.flags; } void SetUnitMovementFlags(uint32 f) { m_movementInfo.flags = f; } @@ -2087,6 +2119,15 @@ class Unit : public WorldObject uint16 GetExtraUnitMovementFlags() const { return m_movementInfo.flags2; } void SetExtraUnitMovementFlags(uint16 f) { m_movementInfo.flags2 = f; } + float GetPositionZMinusOffset() const + { + float offset = 0.0f; + if (HasUnitMovementFlag(MOVEMENTFLAG_HOVER)) + offset = GetFloatValue(UNIT_FIELD_HOVERHEIGHT); + + return GetPositionZ() - offset; + } + void SetControlled(bool apply, UnitState state); void AddComboPointHolder(uint32 lowguid) { m_ComboPointHolders.insert(lowguid); } @@ -2171,9 +2212,9 @@ class Unit : public WorldObject bool isMoving() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_MASK_MOVING); } bool isTurning() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_MASK_TURNING); } - bool canFly() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_CAN_FLY); } - bool IsFlying() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_FLYING); } - void SetFlying(bool apply); + virtual bool CanFly() const = 0; + bool IsFlying() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_FLYING | MOVEMENTFLAG_DISABLE_GRAVITY); } + void SetCanFly(bool apply); void RewardRage(uint32 damage, uint32 weaponSpeedHitFactor, bool attacker); @@ -2290,21 +2331,22 @@ class Unit : public WorldObject Vehicle* m_vehicleKit; uint32 m_unitTypeMask; + LiquidTypeEntry const* _lastLiquid; bool IsAlwaysVisibleFor(WorldObject const* seer) const; bool IsAlwaysDetectableFor(WorldObject const* seer) const; void DisableSpline(); private: - bool IsTriggeredAtSpellProcEvent(Unit* pVictim, Aura* aura, SpellInfo const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const* & spellProcEvent); - bool HandleDummyAuraProc(Unit* pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); - bool HandleHasteAuraProc(Unit* pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); - bool HandleSpellCritChanceAuraProc(Unit* pVictim, uint32 damage, AuraEffect* triggredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); - bool HandleObsModEnergyAuraProc(Unit* pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); - bool HandleModDamagePctTakenAuraProc(Unit* pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); - bool HandleAuraProc(Unit* pVictim, uint32 damage, Aura* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, bool * handled); - bool HandleProcTriggerSpell(Unit* pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); - bool HandleOverrideClassScriptAuraProc(Unit* pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* procSpell, uint32 cooldown); + bool IsTriggeredAtSpellProcEvent(Unit* victim, Aura* aura, SpellInfo const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const* & spellProcEvent); + bool HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + bool HandleHasteAuraProc(Unit* victim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + bool HandleSpellCritChanceAuraProc(Unit* victim, uint32 damage, AuraEffect* triggredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + bool HandleObsModEnergyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + bool HandleModDamagePctTakenAuraProc(Unit* victim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + bool HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, bool * handled); + bool HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + bool HandleOverrideClassScriptAuraProc(Unit* victim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* procSpell, uint32 cooldown); bool HandleAuraRaidProcFromChargeWithValue(AuraEffect* triggeredByAura); bool HandleAuraRaidProcFromCharge(AuraEffect* triggeredByAura); diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index e0d67e9ceef..090a1db382a 100755 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -146,7 +146,7 @@ void Vehicle::ApplyAllImmunities() _me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK_DEST, true); // Mechanical units & vehicles ( which are not Bosses, they have own immunities in DB ) should be also immune on healing ( exceptions in switch below ) - if (_me->ToCreature() && _me->ToCreature()->GetCreatureInfo()->type == CREATURE_TYPE_MECHANICAL && !_me->ToCreature()->isWorldBoss()) + if (_me->ToCreature() && _me->ToCreature()->GetCreatureTemplate()->type == CREATURE_TYPE_MECHANICAL && !_me->ToCreature()->isWorldBoss()) { // Heal & dispel ... _me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_HEAL, true); @@ -285,9 +285,6 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 typ // return; // Something went wrong in the spellsystem //} - // This is not good, we have to send update twice - accessory->SendMovementFlagUpdate(); - if (GetBase()->GetTypeId() == TYPEID_UNIT) sScriptMgr->OnInstallAccessory(this, accessory); } @@ -352,6 +349,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) unit->m_movementInfo.t_pos.m_orientation = 0; unit->m_movementInfo.t_time = 0; // 1 for player unit->m_movementInfo.t_seat = seat->first; + unit->m_movementInfo.t_guid = _me->GetGUID(); if (_me->GetTypeId() == TYPEID_UNIT && unit->GetTypeId() == TYPEID_PLAYER @@ -424,13 +422,14 @@ void Vehicle::RemovePassenger(Unit* unit) _me->ToCreature()->AI()->PassengerBoarded(unit, seat->first, false); // only for flyable vehicles - if (unit->HasUnitMovementFlag(MOVEMENTFLAG_FLYING)) + if (unit->IsFlying()) _me->CastSpell(unit, VEHICLE_SPELL_PARACHUTE, true); if (GetBase()->GetTypeId() == TYPEID_UNIT) sScriptMgr->OnRemovePassenger(this, unit); } +//! Must be called after m_base::Relocate void Vehicle::RelocatePassengers(float x, float y, float z, float ang) { ASSERT(_me->GetMap()); @@ -440,8 +439,6 @@ void Vehicle::RelocatePassengers(float x, float y, float z, float ang) if (Unit* passenger = ObjectAccessor::GetUnit(*GetBase(), itr->second.Passenger)) { ASSERT(passenger->IsInWorld()); - ASSERT(passenger->IsOnVehicle(GetBase())); - ASSERT(GetSeatForPassenger(passenger)); float px = x + passenger->m_movementInfo.t_pos.m_positionX; float py = y + passenger->m_movementInfo.t_pos.m_positionY; @@ -454,11 +451,12 @@ void Vehicle::RelocatePassengers(float x, float y, float z, float ang) void Vehicle::Dismiss() { + if (GetBase()->GetTypeId() != TYPEID_UNIT) + return; + sLog->outDebug(LOG_FILTER_VEHICLES, "Vehicle::Dismiss Entry: %u, GuidLow %u", _creatureEntry, _me->GetGUIDLow()); Uninstall(); - _me->DestroyForNearbyPlayers(); - _me->CombatStop(); - _me->AddObjectToRemoveList(); + GetBase()->ToCreature()->DespawnOrUnsummon(); } void Vehicle::InitMovementInfoForBase() diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index 6f5dc0e511e..d5e85d2cf2f 100755 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -80,7 +80,7 @@ uint32 GameEventMgr::NextCheck(uint16 entry) const if (mGameEvent[entry].state == GAMEEVENT_WORLD_CONDITIONS) { if (mGameEvent[entry].length) - return mGameEvent[entry].length * 60 ; + return mGameEvent[entry].length * 60; else return max_ge_check_delay; } @@ -205,7 +205,7 @@ void GameEventMgr::LoadFromDB() { { uint32 oldMSTime = getMSTime(); - + // 1 2 3 4 5 6 7 8 QueryResult result = WorldDatabase.Query("SELECT eventEntry, UNIX_TIMESTAMP(start_time), UNIX_TIMESTAMP(end_time), occurence, length, holiday, description, world_event FROM game_event"); if (!result) { @@ -220,7 +220,7 @@ void GameEventMgr::LoadFromDB() { Field* fields = result->Fetch(); - uint16 event_id = fields[0].GetUInt16(); + uint8 event_id = fields[0].GetUInt8(); if (event_id == 0) { sLog->outErrorDb("`game_event` game event entry 0 is reserved and can't be used."); @@ -232,8 +232,8 @@ void GameEventMgr::LoadFromDB() pGameEvent.start = time_t(starttime); uint64 endtime = fields[2].GetUInt64(); pGameEvent.end = time_t(endtime); - pGameEvent.occurence = fields[3].GetUInt32(); - pGameEvent.length = fields[4].GetUInt32(); + pGameEvent.occurence = fields[3].GetUInt64(); + pGameEvent.length = fields[4].GetUInt64(); pGameEvent.holiday_id = HolidayIds(fields[5].GetUInt32()); pGameEvent.state = (GameEventState)(fields[7].GetUInt8()); @@ -283,7 +283,7 @@ void GameEventMgr::LoadFromDB() { Field* fields = result->Fetch(); - uint16 event_id = fields[0].GetUInt16(); + uint8 event_id = fields[0].GetUInt8(); if (event_id >= mGameEvent.size()) { @@ -315,6 +315,7 @@ void GameEventMgr::LoadFromDB() { uint32 oldMSTime = getMSTime(); + // 0 1 QueryResult result = WorldDatabase.Query("SELECT eventEntry, prerequisite_event FROM game_event_prerequisite"); if (!result) { @@ -328,7 +329,7 @@ void GameEventMgr::LoadFromDB() { Field* fields = result->Fetch(); - uint16 event_id = fields[0].GetUInt16(); + uint16 event_id = fields[0].GetUInt8(); if (event_id >= mGameEvent.size()) { @@ -338,7 +339,7 @@ void GameEventMgr::LoadFromDB() if (mGameEvent[event_id].state != GAMEEVENT_NORMAL && mGameEvent[event_id].state != GAMEEVENT_INTERNAL) { - uint16 prerequisite_event = fields[1].GetUInt16(); + uint16 prerequisite_event = fields[1].GetUInt32(); if (prerequisite_event >= mGameEvent.size()) { sLog->outErrorDb("`game_event_prerequisite` game event prerequisite id (%i) is out of range compared to max event id in `game_event`", prerequisite_event); @@ -382,7 +383,7 @@ void GameEventMgr::LoadFromDB() Field* fields = result->Fetch(); uint32 guid = fields[0].GetUInt32(); - int16 event_id = fields[1].GetInt16(); + int16 event_id = fields[1].GetInt8(); int32 internal_event_id = mGameEvent.size() + event_id - 1; @@ -408,7 +409,7 @@ void GameEventMgr::LoadFromDB() { uint32 oldMSTime = getMSTime(); - // 1 2 + // 0 1 QueryResult result = WorldDatabase.Query("SELECT gameobject.guid, game_event_gameobject.eventEntry FROM gameobject" " JOIN game_event_gameobject ON gameobject.guid=game_event_gameobject.guid"); @@ -425,7 +426,7 @@ void GameEventMgr::LoadFromDB() Field* fields = result->Fetch(); uint32 guid = fields[0].GetUInt32(); - int16 event_id = fields[1].GetInt16(); + int16 event_id = fields[1].GetInt8(); int32 internal_event_id = mGameEvent.size() + event_id - 1; @@ -468,7 +469,7 @@ void GameEventMgr::LoadFromDB() Field* fields = result->Fetch(); uint32 guid = fields[0].GetUInt32(); - uint16 event_id = fields[1].GetUInt16(); + uint16 event_id = fields[1].GetUInt8(); if (event_id >= mGameEventModelEquip.size()) { @@ -525,7 +526,7 @@ void GameEventMgr::LoadFromDB() uint32 id = fields[0].GetUInt32(); uint32 quest = fields[1].GetUInt32(); - uint16 event_id = fields[2].GetUInt16(); + uint16 event_id = fields[2].GetUInt8(); if (event_id >= mGameEventCreatureQuests.size()) { @@ -566,7 +567,7 @@ void GameEventMgr::LoadFromDB() uint32 id = fields[0].GetUInt32(); uint32 quest = fields[1].GetUInt32(); - uint16 event_id = fields[2].GetUInt16(); + uint16 event_id = fields[2].GetUInt8(); if (event_id >= mGameEventGameObjectQuests.size()) { @@ -590,7 +591,7 @@ void GameEventMgr::LoadFromDB() { uint32 oldMSTime = getMSTime(); - // 0 1 2 3 + // 0 1 2 3 QueryResult result = WorldDatabase.Query("SELECT quest, eventEntry, condition_id, num FROM game_event_quest_condition"); if (!result) @@ -606,7 +607,7 @@ void GameEventMgr::LoadFromDB() Field* fields = result->Fetch(); uint32 quest = fields[0].GetUInt32(); - uint16 event_id = fields[1].GetUInt16(); + uint16 event_id = fields[1].GetUInt8(); uint32 condition = fields[2].GetUInt32(); float num = fields[3].GetFloat(); @@ -648,7 +649,7 @@ void GameEventMgr::LoadFromDB() { Field* fields = result->Fetch(); - uint16 event_id = fields[0].GetUInt16(); + uint16 event_id = fields[0].GetUInt8(); uint32 condition = fields[1].GetUInt32(); if (event_id >= mGameEvent.size()) @@ -659,8 +660,8 @@ void GameEventMgr::LoadFromDB() mGameEvent[event_id].conditions[condition].reqNum = fields[2].GetFloat(); mGameEvent[event_id].conditions[condition].done = 0; - mGameEvent[event_id].conditions[condition].max_world_state = fields[3].GetUInt32(); - mGameEvent[event_id].conditions[condition].done_world_state = fields[4].GetUInt32(); + mGameEvent[event_id].conditions[condition].max_world_state = fields[3].GetUInt16(); + mGameEvent[event_id].conditions[condition].done_world_state = fields[4].GetUInt16(); ++count; } @@ -690,7 +691,7 @@ void GameEventMgr::LoadFromDB() { Field* fields = result->Fetch(); - uint16 event_id = fields[0].GetUInt16(); + uint16 event_id = fields[0].GetUInt8(); uint32 condition = fields[1].GetUInt32(); if (event_id >= mGameEvent.size()) @@ -739,7 +740,7 @@ void GameEventMgr::LoadFromDB() Field* fields = result->Fetch(); uint32 guid = fields[0].GetUInt32(); - uint16 event_id = fields[1].GetUInt16(); + uint16 event_id = fields[1].GetUInt8(); uint32 npcflag = fields[2].GetUInt32(); if (event_id >= mGameEvent.size()) @@ -763,7 +764,7 @@ void GameEventMgr::LoadFromDB() { uint32 oldMSTime = getMSTime(); - // 0 1 + // 0 1 QueryResult result = WorldDatabase.Query("SELECT questId, eventEntry FROM game_event_seasonal_questrelation"); if (!result) @@ -779,7 +780,7 @@ void GameEventMgr::LoadFromDB() Field* fields = result->Fetch(); uint32 questId = fields[0].GetUInt32(); - uint16 eventEntry = fields[1].GetUInt16(); + uint32 eventEntry = fields[1].GetUInt32(); // TODO: Change to uint8 if (!sObjectMgr->GetQuestTemplate(questId)) { @@ -822,7 +823,7 @@ void GameEventMgr::LoadFromDB() { Field* fields = result->Fetch(); - uint16 event_id = fields[0].GetUInt16(); + uint8 event_id = fields[0].GetUInt8(); if (event_id >= mGameEventVendors.size()) { @@ -834,7 +835,7 @@ void GameEventMgr::LoadFromDB() NPCVendorEntry newEntry; uint32 guid = fields[1].GetUInt32(); newEntry.item = fields[2].GetUInt32(); - newEntry.maxcount = fields[3].GetInt32(); + newEntry.maxcount = fields[3].GetUInt32(); newEntry.incrtime = fields[4].GetUInt32(); newEntry.ExtendedCost = fields[5].GetUInt32(); // get the event npc flag for checking if the npc will be vendor during the event or not @@ -888,7 +889,7 @@ void GameEventMgr::LoadFromDB() { Field* fields = result->Fetch(); - uint16 event_id = fields[0].GetUInt16(); + uint16 event_id = fields[0].GetUInt8(); if (event_id >= mGameEvent.size()) { @@ -911,7 +912,7 @@ void GameEventMgr::LoadFromDB() { uint32 oldMSTime = getMSTime(); - // 1 2 + // 0 1 QueryResult result = WorldDatabase.Query("SELECT pool_template.entry, game_event_pool.eventEntry FROM pool_template" " JOIN game_event_pool ON pool_template.entry = game_event_pool.pool_entry"); @@ -928,7 +929,7 @@ void GameEventMgr::LoadFromDB() Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); - int16 event_id = fields[1].GetInt16(); + int16 event_id = fields[1].GetInt8(); int32 internal_event_id = mGameEvent.size() + event_id - 1; @@ -981,7 +982,7 @@ void GameEventMgr::Initialize() { Field* fields = result->Fetch(); - uint32 maxEventId = fields[0].GetUInt16(); + uint32 maxEventId = fields[0].GetUInt8(); // Id starts with 1 and vector with 0, thus increment maxEventId++; @@ -1019,7 +1020,7 @@ void GameEventMgr::StartArenaSeason() } Field* fields = result->Fetch(); - uint16 eventId = fields[0].GetUInt16(); + uint16 eventId = fields[0].GetUInt8(); if (eventId >= mGameEvent.size()) { @@ -1123,8 +1124,6 @@ void GameEventMgr::UnApplyEvent(uint16 event_id) UpdateEventNPCVendor(event_id, false); // update bg holiday UpdateBattlegroundSettings(); - // check for seasonal quest reset. - sWorld->ResetEventSeasonalQuests(event_id); } void GameEventMgr::ApplyNewEvent(uint16 event_id) @@ -1159,6 +1158,8 @@ void GameEventMgr::ApplyNewEvent(uint16 event_id) UpdateEventNPCVendor(event_id, true); // update bg holiday UpdateBattlegroundSettings(); + // check for seasonal quest reset. + sWorld->ResetEventSeasonalQuests(event_id); } void GameEventMgr::UpdateEventNPCFlags(uint16 event_id) @@ -1174,7 +1175,7 @@ void GameEventMgr::UpdateEventNPCFlags(uint16 event_id) if (cr) { uint32 npcflag = GetNPCFlag(cr); - if (const CreatureTemplate* ci = cr->GetCreatureInfo()) + if (const CreatureTemplate* ci = cr->GetCreatureTemplate()) npcflag |= ci->npcflag; cr->SetUInt32Value(UNIT_NPC_FLAGS, npcflag); // reset gossip options, since the flag change might have added / removed some diff --git a/src/server/game/Globals/ObjectAccessor.cpp b/src/server/game/Globals/ObjectAccessor.cpp index 1a069a27825..9a99a28c7aa 100755 --- a/src/server/game/Globals/ObjectAccessor.cpp +++ b/src/server/game/Globals/ObjectAccessor.cpp @@ -166,10 +166,18 @@ Unit* ObjectAccessor::FindUnit(uint64 guid) Player* ObjectAccessor::FindPlayerByName(const char* name) { TRINITY_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock()); + std::string nameStr = name; + std::transform(nameStr.begin(), nameStr.end(), nameStr.begin(), ::tolower); HashMapHolder<Player>::MapType const& m = GetPlayers(); for (HashMapHolder<Player>::MapType::const_iterator iter = m.begin(); iter != m.end(); ++iter) - if (iter->second->IsInWorld() && strcmp(name, iter->second->GetName()) == 0) + { + if (!iter->second->IsInWorld()) + continue; + std::string currentName = iter->second->GetName(); + std::transform(currentName.begin(), currentName.end(), currentName.begin(), ::tolower); + if (nameStr.compare(currentName) == 0) return iter->second; + } return NULL; } @@ -400,4 +408,4 @@ template Pet* ObjectAccessor::GetObjectInWorld<Pet>(uint32 mapid, float x, float template Creature* ObjectAccessor::GetObjectInWorld<Creature>(uint32 mapid, float x, float y, uint64 guid, Creature* /*fake*/); template Corpse* ObjectAccessor::GetObjectInWorld<Corpse>(uint32 mapid, float x, float y, uint64 guid, Corpse* /*fake*/); template GameObject* ObjectAccessor::GetObjectInWorld<GameObject>(uint32 mapid, float x, float y, uint64 guid, GameObject* /*fake*/); -template DynamicObject* ObjectAccessor::GetObjectInWorld<DynamicObject>(uint32 mapid, float x, float y, uint64 guid, DynamicObject* /*fake*/);
\ No newline at end of file +template DynamicObject* ObjectAccessor::GetObjectInWorld<DynamicObject>(uint32 mapid, float x, float y, uint64 guid, DynamicObject* /*fake*/); diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index b30b36dbdc1..a14a49d2069 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -256,6 +256,10 @@ ObjectMgr::~ObjectMgr() itr->second.Clear(); _cacheTrainerSpellStore.clear(); + + for (DungeonEncounterContainer::iterator itr =_dungeonEncounterStore.begin(); itr != _dungeonEncounterStore.end(); ++itr) + for (DungeonEncounterList::iterator encounterItr = itr->second.begin(); encounterItr != itr->second.end(); ++encounterItr) + delete *encounterItr; } void ObjectMgr::AddLocaleString(std::string const& s, LocaleConstant locale, StringVector& data) @@ -380,10 +384,10 @@ void ObjectMgr::LoadCreatureTemplates() "type_flags, type_flags2, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, " // 55 56 57 58 59 60 61 62 63 64 65 66 67 68 "spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, " - // 68 69 70 71 72 73 74 75 76 77 78 - "InhabitType, Health_mod, Mana_mod, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, questItem6, " - // 79 80 81 82 83 84 - "movementId, RegenHealth, equipment_id, mechanic_immune_mask, flags_extra, ScriptName " + // 69 70 71 72 73 74 75 76 77 78 79 + "InhabitType, HoverHeight, Health_mod, Mana_mod, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, " + // 80 81 82 83 84 85 86 + " questItem6, movementId, RegenHealth, equipment_id, mechanic_immune_mask, flags_extra, ScriptName " "FROM creature_template;"); if (!result) @@ -393,6 +397,7 @@ void ObjectMgr::LoadCreatureTemplates() return; } + _creatureTemplateStore.rehash(result->GetRowCount()); uint32 count = 0; do { @@ -421,7 +426,7 @@ void ObjectMgr::LoadCreatureTemplates() creatureTemplate.GossipMenuId = fields[13].GetUInt32(); creatureTemplate.minlevel = fields[14].GetUInt8(); creatureTemplate.maxlevel = fields[15].GetUInt8(); - creatureTemplate.expansion = uint32(fields[16].GetUInt16()); + creatureTemplate.expansion = uint32(fields[16].GetInt16()); creatureTemplate.expansionUnknown = uint32(fields[17].GetUInt16()); creatureTemplate.faction_A = uint32(fields[18].GetUInt16()); creatureTemplate.faction_H = uint32(fields[19].GetUInt16()); @@ -456,7 +461,7 @@ void ObjectMgr::LoadCreatureTemplates() creatureTemplate.SkinLootId = fields[48].GetUInt32(); for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) - creatureTemplate.resistance[i] = fields[50 + i -1].GetInt32(); + creatureTemplate.resistance[i] = fields[50 + i -1].GetInt16(); for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i) creatureTemplate.spells[i] = fields[55 + i].GetUInt32(); @@ -468,20 +473,21 @@ void ObjectMgr::LoadCreatureTemplates() creatureTemplate.AIName = fields[67].GetString(); creatureTemplate.MovementType = uint32(fields[68].GetUInt8()); creatureTemplate.InhabitType = uint32(fields[69].GetUInt8()); - creatureTemplate.ModHealth = fields[70].GetFloat(); - creatureTemplate.ModMana = fields[71].GetFloat(); - creatureTemplate.ModArmor = fields[72].GetFloat(); - creatureTemplate.RacialLeader = fields[73].GetBool(); + creatureTemplate.HoverHeight = fields[70].GetFloat(); + creatureTemplate.ModHealth = fields[71].GetFloat(); + creatureTemplate.ModMana = fields[72].GetFloat(); + creatureTemplate.ModArmor = fields[73].GetFloat(); + creatureTemplate.RacialLeader = fields[74].GetBool(); for (uint8 i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i) - creatureTemplate.questItems[i] = fields[74 + i].GetUInt32(); + creatureTemplate.questItems[i] = fields[75 + i].GetUInt32(); - creatureTemplate.movementId = fields[80].GetUInt32(); - creatureTemplate.RegenHealth = fields[81].GetBool(); - creatureTemplate.equipmentId = fields[82].GetUInt32(); - creatureTemplate.MechanicImmuneMask = fields[83].GetUInt32(); - creatureTemplate.flags_extra = fields[84].GetUInt32(); - creatureTemplate.ScriptID = GetScriptId(fields[85].GetCString()); + creatureTemplate.movementId = fields[81].GetUInt32(); + creatureTemplate.RegenHealth = fields[82].GetBool(); + creatureTemplate.equipmentId = fields[83].GetUInt32(); + creatureTemplate.MechanicImmuneMask = fields[84].GetUInt32(); + creatureTemplate.flags_extra = fields[85].GetUInt32(); + creatureTemplate.ScriptID = GetScriptId(fields[86].GetCString()); ++count; } @@ -554,7 +560,10 @@ void ObjectMgr::LoadCreatureTemplateAddons() } if (!sEmotesStore.LookupEntry(creatureAddon.emote)) - sLog->outErrorDb("Creature (Entry: %u) has invalid emote (%u) defined in `creature_template_addon`.", entry, creatureAddon.emote); + { + sLog->outErrorDb("Creature (Entry: %u) has invalid emote (%u) defined in `creature_addon`.", entry, creatureAddon.emote); + creatureAddon.emote = 0; + } ++count; } @@ -706,7 +715,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) else if (!displayScaleEntry) displayScaleEntry = displayEntry; - CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid2);; + CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid2); if (!modelInfo) sLog->outErrorDb("No model data exist for `Modelid2` = %u listed by creature (Entry: %u).", cInfo->Modelid2, cInfo->Entry); } @@ -738,7 +747,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) else if (!displayScaleEntry) displayScaleEntry = displayEntry; - CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid4);; + CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid4); if (!modelInfo) sLog->outErrorDb("No model data exist for `Modelid4` = %u listed by creature (Entry: %u).", cInfo->Modelid4, cInfo->Entry); } @@ -798,6 +807,12 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) const_cast<CreatureTemplate*>(cInfo)->InhabitType = INHABIT_ANYWHERE; } + if (cInfo->HoverHeight < 0.0f) + { + sLog->outErrorDb("Creature (Entry: %u) has wrong value (%f) in `HoverHeight`", cInfo->Entry, cInfo->HoverHeight); + const_cast<CreatureTemplate*>(cInfo)->HoverHeight = 1.0f; + } + if (cInfo->VehicleId) { VehicleEntry const* vehId = sVehicleStore.LookupEntry(cInfo->VehicleId); @@ -925,7 +940,7 @@ void ObjectMgr::LoadCreatureAddons() creatureAddon.auras[i++] = uint32(atol(*itr)); } - if (creatureAddon.mount) + if (creatureAddon.mount) { if (!sCreatureDisplayInfoStore.LookupEntry(creatureAddon.mount)) { @@ -935,7 +950,10 @@ void ObjectMgr::LoadCreatureAddons() } if (!sEmotesStore.LookupEntry(creatureAddon.emote)) + { sLog->outErrorDb("Creature (GUID: %u) has invalid emote (%u) defined in `creature_addon`.", guid, creatureAddon.emote); + creatureAddon.emote = 0; + } ++count; } @@ -1003,7 +1021,7 @@ void ObjectMgr::LoadEquipmentTemplates() if (!equipmentInfo.ItemEntry[i]) continue; - ItemEntry const* dbcItem = sItemStore.LookupEntry(equipmentInfo.ItemEntry[i]); + ItemEntry const* dbcItem = sItemStore.LookupEntry(equipmentInfo.ItemEntry[i]); if (!dbcItem) { @@ -1082,25 +1100,25 @@ void ObjectMgr::ChooseCreatureFlags(const CreatureTemplate* cinfo, uint32& npcfl CreatureModelInfo const* ObjectMgr::GetCreatureModelRandomGender(uint32* displayID) { - CreatureModelInfo const* minfo = GetCreatureModelInfo(*displayID); - if (!minfo) + CreatureModelInfo const* modelInfo = GetCreatureModelInfo(*displayID); + if (!modelInfo) return NULL; // If a model for another gender exists, 50% chance to use it - if (minfo->modelid_other_gender != 0 && urand(0, 1) == 0) + if (modelInfo->modelid_other_gender != 0 && urand(0, 1) == 0) { - CreatureModelInfo const* minfo_tmp = GetCreatureModelInfo(minfo->modelid_other_gender); + CreatureModelInfo const* minfo_tmp = GetCreatureModelInfo(modelInfo->modelid_other_gender); if (!minfo_tmp) - sLog->outErrorDb("Model (Entry: %u) has modelid_other_gender %u not found in table `creature_model_info`. ", *displayID, minfo->modelid_other_gender); + sLog->outErrorDb("Model (Entry: %u) has modelid_other_gender %u not found in table `creature_model_info`. ", *displayID, modelInfo->modelid_other_gender); else { // Model ID changed - *displayID = minfo->modelid_other_gender; + *displayID = modelInfo->modelid_other_gender; return minfo_tmp; } } - return minfo; + return modelInfo; } void ObjectMgr::LoadCreatureModelInfo() @@ -1116,6 +1134,7 @@ void ObjectMgr::LoadCreatureModelInfo() return; } + _creatureModelStore.rehash(result->GetRowCount()); uint32 count = 0; do @@ -1124,7 +1143,7 @@ void ObjectMgr::LoadCreatureModelInfo() uint32 modelId = fields[0].GetUInt32(); - CreatureModelInfo& modelInfo = _creatureModelStore[modelId]; + CreatureModelInfo& modelInfo = _creatureModelStore[modelId]; modelInfo.bounding_radius = fields[1].GetFloat(); modelInfo.combat_reach = fields[2].GetFloat(); @@ -1149,9 +1168,7 @@ void ObjectMgr::LoadCreatureModelInfo() } if (modelInfo.combat_reach < 0.1f) - { modelInfo.combat_reach = DEFAULT_COMBAT_REACH; - } ++count; } @@ -1166,6 +1183,7 @@ void ObjectMgr::LoadLinkedRespawn() uint32 oldMSTime = getMSTime(); _linkedRespawnStore.clear(); + // 0 1 2 QueryResult result = WorldDatabase.Query("SELECT guid, linkedGuid, linkType FROM linked_respawn ORDER BY guid ASC"); if (!result) @@ -1339,7 +1357,6 @@ void ObjectMgr::LoadLinkedRespawn() if (!error) _linkedRespawnStore[guid] = linkedGuid; - } while (result->NextRow()); @@ -1393,9 +1410,9 @@ void ObjectMgr::LoadCreatures() { uint32 oldMSTime = getMSTime(); - // 0 1 2 3 4 5 6 7 8 9 10 + // 0 1 2 3 4 5 6 7 8 9 10 QueryResult result = WorldDatabase.Query("SELECT creature.guid, id, map, modelid, equipment_id, position_x, position_y, position_z, orientation, spawntimesecs, spawndist, " - // 11 12 13 14 15 16 17 18 19 20 21 + // 11 12 13 14 15 16 17 18 19 20 21 "currentwaypoint, curhealth, curmana, MovementType, spawnMask, phaseMask, eventEntry, pool_entry, creature.npcflag, creature.unit_flags, creature.dynamicflags " "FROM creature " "LEFT OUTER JOIN game_event_creature ON creature.guid = game_event_creature.guid " @@ -1416,13 +1433,14 @@ void ObjectMgr::LoadCreatures() if (GetMapDifficultyData(i, Difficulty(k))) spawnMasks[i] |= (1 << k); + _creatureDataStore.rehash(result->GetRowCount()); uint32 count = 0; do { Field* fields = result->Fetch(); - uint32 guid = fields[ 0].GetUInt32(); - uint32 entry = fields[ 1].GetUInt32(); + uint32 guid = fields[0].GetUInt32(); + uint32 entry = fields[1].GetUInt32(); CreatureTemplate const* cInfo = GetCreatureTemplate(entry); if (!cInfo) @@ -1432,16 +1450,15 @@ void ObjectMgr::LoadCreatures() } CreatureData& data = _creatureDataStore[guid]; - data.id = entry; - data.mapid = fields[ 2].GetUInt32(); - data.displayid = fields[ 3].GetUInt32(); - data.equipmentId = fields[ 4].GetUInt32(); - data.posX = fields[ 5].GetFloat(); - data.posY = fields[ 6].GetFloat(); - data.posZ = fields[ 7].GetFloat(); - data.orientation = fields[ 8].GetFloat(); - data.spawntimesecs = fields[ 9].GetUInt32(); + data.mapid = fields[2].GetUInt16(); + data.displayid = fields[3].GetUInt32(); + data.equipmentId = fields[4].GetInt32(); + data.posX = fields[5].GetFloat(); + data.posY = fields[6].GetFloat(); + data.posZ = fields[7].GetFloat(); + data.orientation = fields[8].GetFloat(); + data.spawntimesecs = fields[9].GetUInt32(); data.spawndist = fields[10].GetFloat(); data.currentwaypoint= fields[11].GetUInt32(); data.curhealth = fields[12].GetUInt32(); @@ -1449,7 +1466,7 @@ void ObjectMgr::LoadCreatures() data.movementType = fields[14].GetUInt8(); data.spawnMask = fields[15].GetUInt8(); data.phaseMask = fields[16].GetUInt16(); - int16 gameEvent = fields[17].GetInt16(); + int16 gameEvent = fields[17].GetInt8(); uint32 PoolId = fields[18].GetUInt32(); data.npcflag = fields[19].GetUInt32(); data.unit_flags = fields[20].GetUInt32(); @@ -1706,7 +1723,7 @@ void ObjectMgr::LoadGameobjects() // 0 1 2 3 4 5 6 QueryResult result = WorldDatabase.Query("SELECT gameobject.guid, id, map, position_x, position_y, position_z, orientation, " - // 7 8 9 10 11 12 13 14 15 16 17 + // 7 8 9 10 11 12 13 14 15 16 17 "rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state, spawnMask, phaseMask, eventEntry, pool_entry " "FROM gameobject LEFT OUTER JOIN game_event_gameobject ON gameobject.guid = game_event_gameobject.guid " "LEFT OUTER JOIN pool_gameobject ON gameobject.guid = pool_gameobject.guid"); @@ -1726,12 +1743,13 @@ void ObjectMgr::LoadGameobjects() if (GetMapDifficultyData(i, Difficulty(k))) spawnMasks[i] |= (1 << k); + _gameObjectDataStore.rehash(result->GetRowCount()); do { Field* fields = result->Fetch(); - uint32 guid = fields[ 0].GetUInt32(); - uint32 entry = fields[ 1].GetUInt32(); + uint32 guid = fields[0].GetUInt32(); + uint32 entry = fields[1].GetUInt32(); GameObjectTemplate const* gInfo = GetGameObjectTemplate(entry); if (!gInfo) @@ -1762,14 +1780,14 @@ void ObjectMgr::LoadGameobjects() GameObjectData& data = _gameObjectDataStore[guid]; data.id = entry; - data.mapid = fields[ 2].GetUInt32(); - data.posX = fields[ 3].GetFloat(); - data.posY = fields[ 4].GetFloat(); - data.posZ = fields[ 5].GetFloat(); - data.orientation = fields[ 6].GetFloat(); - data.rotation0 = fields[ 7].GetFloat(); - data.rotation1 = fields[ 8].GetFloat(); - data.rotation2 = fields[ 9].GetFloat(); + data.mapid = fields[2].GetUInt16(); + data.posX = fields[3].GetFloat(); + data.posY = fields[4].GetFloat(); + data.posZ = fields[5].GetFloat(); + data.orientation = fields[6].GetFloat(); + data.rotation0 = fields[7].GetFloat(); + data.rotation1 = fields[8].GetFloat(); + data.rotation2 = fields[9].GetFloat(); data.rotation3 = fields[10].GetFloat(); data.spawntimesecs = fields[11].GetInt32(); @@ -1785,10 +1803,10 @@ void ObjectMgr::LoadGameobjects() sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with `spawntimesecs` (0) value, but the gameobejct is marked as despawnable at action.", guid, data.id); } - data.animprogress = fields[12].GetUInt32(); + data.animprogress = fields[12].GetUInt8(); data.artKit = 0; - uint32 go_state = fields[13].GetUInt32(); + uint32 go_state = fields[13].GetUInt8(); if (go_state >= MAX_GO_STATE) { sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid `state` (%u) value, skip", guid, data.id, go_state); @@ -1802,7 +1820,7 @@ void ObjectMgr::LoadGameobjects() sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) that has wrong spawn mask %u including not supported difficulty modes for map (Id: %u), skip", guid, data.id, data.spawnMask, data.mapid); data.phaseMask = fields[15].GetUInt16(); - int16 gameEvent = fields[16].GetInt16(); + int16 gameEvent = fields[16].GetInt8(); uint32 PoolId = fields[17].GetUInt32(); if (data.rotation2 < -1.0f || data.rotation2 > 1.0f) @@ -1832,7 +1850,6 @@ void ObjectMgr::LoadGameobjects() if (gameEvent == 0 && PoolId == 0) // if not this is to be managed by GameEvent System or Pool system AddGameobjectToGrid(guid, &data); ++count; - } while (result->NextRow()); sLog->outString(">> Loaded %lu gameobjects in %u ms", (unsigned long)_gameObjectDataStore.size(), GetMSTimeDiffToNow(oldMSTime)); @@ -1903,7 +1920,7 @@ void ObjectMgr::LoadGameobjectRespawnTimes() uint32 oldMSTime = getMSTime(); // Remove outdated data - CharacterDatabase.DirectExecute(CharacterDatabase.GetPreparedStatement(CHAR_DEL_EXPIRED_GO_RESPAWNS)); + CharacterDatabase.DirectExecute("DELETE FROM gameobject_respawn WHERE respawnTime <= UNIX_TIMESTAMP(NOW())"); uint32 count = 0; @@ -1943,10 +1960,12 @@ uint64 ObjectMgr::GetPlayerGUIDByName(std::string name) const { uint64 guid = 0; - CharacterDatabase.EscapeString(name); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_BY_NAME); + + stmt->setString(0, name); + + PreparedQueryResult result = CharacterDatabase.Query(stmt); - // Player name safe to sending to DB (checked at login) and this function using - QueryResult result = CharacterDatabase.PQuery("SELECT guid FROM characters WHERE name = '%s'", name.c_str()); if (result) guid = MAKE_NEW_GUID((*result)[0].GetUInt32(), 0, HIGHGUID_PLAYER); @@ -1962,7 +1981,11 @@ bool ObjectMgr::GetPlayerNameByGUID(uint64 guid, std::string &name) const return true; } - QueryResult result = CharacterDatabase.PQuery("SELECT name FROM characters WHERE guid = '%u'", GUID_LOPART(guid)); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME); + + stmt->setUInt32(0, GUID_LOPART(guid)); + + PreparedQueryResult result = CharacterDatabase.Query(stmt); if (result) { @@ -1981,7 +2004,11 @@ uint32 ObjectMgr::GetPlayerTeamByGUID(uint64 guid) const return Player::TeamForRace(player->getRace()); } - QueryResult result = CharacterDatabase.PQuery("SELECT race FROM characters WHERE guid = '%u'", GUID_LOPART(guid)); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_RACE); + + stmt->setUInt32(0, GUID_LOPART(guid)); + + PreparedQueryResult result = CharacterDatabase.Query(stmt); if (result) { @@ -2000,7 +2027,12 @@ uint32 ObjectMgr::GetPlayerAccountIdByGUID(uint64 guid) const return player->GetSession()->GetAccountId(); } - QueryResult result = CharacterDatabase.PQuery("SELECT account FROM characters WHERE guid = '%u'", GUID_LOPART(guid)); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ACCOUNT_BY_GUID); + + stmt->setUInt32(0, GUID_LOPART(guid)); + + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (result) { uint32 acc = (*result)[0].GetUInt32(); @@ -2012,7 +2044,12 @@ uint32 ObjectMgr::GetPlayerAccountIdByGUID(uint64 guid) const uint32 ObjectMgr::GetPlayerAccountIdByPlayerName(const std::string& name) const { - QueryResult result = CharacterDatabase.PQuery("SELECT account FROM characters WHERE name = '%s'", name.c_str()); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ACCOUNT_BY_NAME); + + stmt->setString(0, name); + + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (result) { uint32 acc = (*result)[0].GetUInt32(); @@ -2613,7 +2650,8 @@ void ObjectMgr::LoadItemSetNames() if (setEntry->itemId[i]) itemSetItems.insert(setEntry->itemId[i]); } - + + // 0 1 2 QueryResult result = WorldDatabase.Query("SELECT `entry`, `name`, `InventoryType` FROM `item_set_names`"); if (!result) @@ -2623,6 +2661,7 @@ void ObjectMgr::LoadItemSetNames() return; } + _itemSetNameStore.rehash(result->GetRowCount()); uint32 count = 0; do @@ -2639,7 +2678,7 @@ void ObjectMgr::LoadItemSetNames() ItemSetNameEntry &data = _itemSetNameStore[entry]; data.name = fields[1].GetString(); - uint32 invType = fields[2].GetUInt32(); + uint32 invType = fields[2].GetUInt8(); if (invType >= MAX_INVTYPE) { sLog->outErrorDb("Item set name (Entry: %u) has wrong InventoryType value (%u)", entry, invType); @@ -2684,6 +2723,7 @@ void ObjectMgr::LoadVehicleTemplateAccessories() uint32 count = 0; + // 0 1 2 3 4 5 QueryResult result = WorldDatabase.Query("SELECT `entry`, `accessory_entry`, `seat_id`, `minion`, `summontype`, `summontimer` FROM `vehicle_template_accessory`"); if (!result) @@ -2699,7 +2739,7 @@ void ObjectMgr::LoadVehicleTemplateAccessories() uint32 uiEntry = fields[0].GetUInt32(); uint32 uiAccessory = fields[1].GetUInt32(); - int8 uiSeat = int8(fields[2].GetInt16()); + int8 uiSeat = int8(fields[2].GetInt8()); bool bMinion = fields[3].GetBool(); uint8 uiSummonType = fields[4].GetUInt8(); uint32 uiSummonTimer= fields[5].GetUInt32(); @@ -2740,6 +2780,7 @@ void ObjectMgr::LoadVehicleAccessories() uint32 count = 0; + // 0 1 2 3 4 5 QueryResult result = WorldDatabase.Query("SELECT `guid`, `accessory_entry`, `seat_id`, `minion`, `summontype`, `summontimer` FROM `vehicle_accessory`"); if (!result) @@ -2781,7 +2822,7 @@ void ObjectMgr::LoadPetLevelInfo() uint32 oldMSTime = getMSTime(); // 0 1 2 3 4 5 6 7 8 9 - QueryResult result = WorldDatabase.Query("SELECT creature_entry, level, hp, mana, str, agi, sta, inte, spi, armor FROM pet_levelstats"); + QueryResult result = WorldDatabase.Query("SELECT creature_entry, level, hp, mana, str, agi, sta, inte, spi, armor FROM pet_levelstats"); if (!result) { @@ -2803,7 +2844,7 @@ void ObjectMgr::LoadPetLevelInfo() continue; } - uint32 current_level = fields[1].GetUInt32(); + uint32 current_level = fields[1].GetUInt8(); if (current_level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) { if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum @@ -2824,14 +2865,14 @@ void ObjectMgr::LoadPetLevelInfo() PetLevelInfo*& pInfoMapEntry = _petInfoStore[creature_id]; if (pInfoMapEntry == NULL) - pInfoMapEntry = new PetLevelInfo[sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)]; + pInfoMapEntry = new PetLevelInfo[sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)]; // data for level 1 stored in [0] array element, ... PetLevelInfo* pLevelInfo = &pInfoMapEntry[current_level-1]; pLevelInfo->health = fields[2].GetUInt16(); pLevelInfo->mana = fields[3].GetUInt16(); - pLevelInfo->armor = fields[9].GetUInt16(); + pLevelInfo->armor = fields[9].GetUInt32(); for (int i = 0; i < MAX_STATS; i++) { @@ -2927,7 +2968,7 @@ void ObjectMgr::LoadPlayerInfo() // Load playercreate { uint32 oldMSTime = getMSTime(); - // 0 1 2 3 4 5 6 + // 0 1 2 3 4 5 6 QueryResult result = WorldDatabase.Query("SELECT race, class, map, zone, position_x, position_y, position_z, orientation FROM playercreateinfo"); if (!result) @@ -2944,10 +2985,10 @@ void ObjectMgr::LoadPlayerInfo() { Field* fields = result->Fetch(); - uint32 current_race = fields[0].GetUInt32(); - uint32 current_class = fields[1].GetUInt32(); - uint32 mapId = fields[2].GetUInt32(); - uint32 areaId = fields[3].GetUInt32(); + uint32 current_race = fields[0].GetUInt8(); + uint32 current_class = fields[1].GetUInt8(); + uint32 mapId = fields[2].GetUInt16(); + uint32 areaId = fields[3].GetUInt32(); // zone float positionX = fields[4].GetFloat(); float positionY = fields[5].GetFloat(); float positionZ = fields[6].GetFloat(); @@ -3032,14 +3073,14 @@ void ObjectMgr::LoadPlayerInfo() { Field* fields = result->Fetch(); - uint32 current_race = fields[0].GetUInt32(); + uint32 current_race = fields[0].GetUInt8(); if (current_race >= MAX_RACES) { sLog->outErrorDb("Wrong race %u in `playercreateinfo_item` table, ignoring.", current_race); continue; } - uint32 current_class = fields[1].GetUInt32(); + uint32 current_class = fields[1].GetUInt8(); if (current_class >= MAX_CLASSES) { sLog->outErrorDb("Wrong class %u in `playercreateinfo_item` table, ignoring.", current_class); @@ -3048,13 +3089,13 @@ void ObjectMgr::LoadPlayerInfo() uint32 item_id = fields[2].GetUInt32(); - if (!sObjectMgr->GetItemTemplate(item_id)) + if (!GetItemTemplate(item_id)) { sLog->outErrorDb("Item id %u (race %u class %u) in `playercreateinfo_item` table but not listed in `item_template`, ignoring.", item_id, current_race, current_class); continue; } - int32 amount = fields[3].GetInt32(); + int32 amount = fields[3].GetInt8(); if (!amount) { @@ -3089,11 +3130,8 @@ void ObjectMgr::LoadPlayerInfo() { uint32 oldMSTime = getMSTime(); - QueryResult result = QueryResult(NULL); - if (sWorld->getBoolConfig(CONFIG_START_ALL_SPELLS)) - result = WorldDatabase.Query("SELECT race, class, Spell, Active FROM playercreateinfo_spell_custom"); - else - result = WorldDatabase.Query("SELECT race, class, Spell FROM playercreateinfo_spell"); + std::string tableName = sWorld->getBoolConfig(CONFIG_START_ALL_SPELLS) ? "playercreateinfo_spell_custom" : "playercreateinfo_spell"; + QueryResult result = WorldDatabase.PQuery("SELECT race, class, Spell FROM %s", tableName.c_str()); if (!result) { @@ -3108,14 +3146,14 @@ void ObjectMgr::LoadPlayerInfo() { Field* fields = result->Fetch(); - uint32 current_race = fields[0].GetUInt32(); + uint32 current_race = fields[0].GetUInt8(); if (current_race >= MAX_RACES) { sLog->outErrorDb("Wrong race %u in `playercreateinfo_spell` table, ignoring.", current_race); continue; } - uint32 current_class = fields[1].GetUInt32(); + uint32 current_class = fields[1].GetUInt8(); if (current_class >= MAX_CLASSES) { sLog->outErrorDb("Wrong class %u in `playercreateinfo_spell` table, ignoring.", current_class); @@ -3165,14 +3203,14 @@ void ObjectMgr::LoadPlayerInfo() { Field* fields = result->Fetch(); - uint32 current_race = fields[0].GetUInt32(); + uint32 current_race = fields[0].GetUInt8(); if (current_race >= MAX_RACES) { sLog->outErrorDb("Wrong race %u in `playercreateinfo_action` table, ignoring.", current_race); continue; } - uint32 current_class = fields[1].GetUInt32(); + uint32 current_class = fields[1].GetUInt8(); if (current_class >= MAX_CLASSES) { sLog->outErrorDb("Wrong class %u in `playercreateinfo_action` table, ignoring.", current_class); @@ -3180,7 +3218,7 @@ void ObjectMgr::LoadPlayerInfo() } PlayerInfo* pInfo = &_playerInfo[current_race][current_class]; - pInfo->action.push_back(PlayerCreateInfoAction(fields[2].GetUInt8(), fields[3].GetUInt32(), fields[4].GetUInt8())); + pInfo->action.push_back(PlayerCreateInfoAction(fields[2].GetUInt16(), fields[3].GetUInt32(), fields[4].GetUInt16())); ++count; } @@ -3212,7 +3250,7 @@ void ObjectMgr::LoadPlayerInfo() { Field* fields = result->Fetch(); - uint32 current_class = fields[0].GetUInt32(); + uint32 current_class = fields[0].GetUInt8(); if (current_class >= MAX_CLASSES) { sLog->outErrorDb("Wrong class %u in `player_classlevelstats` table, ignoring.", current_class); @@ -3293,21 +3331,21 @@ void ObjectMgr::LoadPlayerInfo() { Field* fields = result->Fetch(); - uint32 current_race = fields[0].GetUInt32(); + uint32 current_race = fields[0].GetUInt8(); if (current_race >= MAX_RACES) { sLog->outErrorDb("Wrong race %u in `player_levelstats` table, ignoring.", current_race); continue; } - uint32 current_class = fields[1].GetUInt32(); + uint32 current_class = fields[1].GetUInt8(); if (current_class >= MAX_CLASSES) { sLog->outErrorDb("Wrong class %u in `player_levelstats` table, ignoring.", current_class); continue; } - uint32 current_level = fields[2].GetUInt32(); + uint32 current_level = fields[2].GetUInt8(); if (current_level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) { if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum @@ -3411,7 +3449,7 @@ void ObjectMgr::LoadPlayerInfo() { Field* fields = result->Fetch(); - uint32 current_level = fields[0].GetUInt32(); + uint32 current_level = fields[0].GetUInt8(); uint32 current_xp = fields[1].GetUInt32(); if (current_level >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) @@ -3615,7 +3653,7 @@ void ObjectMgr::LoadQuests() { Field* fields = result->Fetch(); - Quest * newQuest = new Quest(fields); + Quest* newQuest = new Quest(fields); _questTemplates[newQuest->GetQuestId()] = newQuest; } while (result->NextRow()); @@ -3633,9 +3671,7 @@ void ObjectMgr::LoadQuests() // additional quest integrity checks (GO, creature_template and item_template must be loaded already) if (qinfo->GetQuestMethod() >= 3) - { sLog->outErrorDb("Quest %u has `Method` = %u, expected values are 0, 1 or 2.", qinfo->GetQuestId(), qinfo->GetQuestMethod()); - } if (qinfo->Flags & ~QUEST_TRINITY_FLAGS_DB_ALLOWED) { @@ -4466,9 +4502,8 @@ void ObjectMgr::LoadScripts(ScriptsType type) scripts->clear(); // need for reload support bool isSpellScriptTable = (type == SCRIPTS_SPELL); - char buff[125]; - sprintf(buff, "SELECT id, delay, command, datalong, datalong2, dataint, x, y, z, o%s FROM %s", isSpellScriptTable ? ", effIndex" : "", tableName.c_str()); - QueryResult result = WorldDatabase.Query(buff); + // 0 1 2 3 4 5 6 7 8 9 + QueryResult result = WorldDatabase.PQuery("SELECT id, delay, command, datalong, datalong2, dataint, x, y, z, o%s FROM %s", isSpellScriptTable ? ", effIndex" : "", tableName.c_str()); if (!result) { @@ -4481,7 +4516,6 @@ void ObjectMgr::LoadScripts(ScriptsType type) do { - Field* fields = result->Fetch(); ScriptInfo tmp; tmp.type = type; @@ -4881,7 +4915,9 @@ void ObjectMgr::LoadWaypointScripts() for (ScriptMapMap::const_iterator itr = sWaypointScripts.begin(); itr != sWaypointScripts.end(); ++itr) actionSet.insert(itr->first); - QueryResult result = WorldDatabase.PQuery("SELECT DISTINCT(`action`) FROM waypoint_data"); + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WOLRD_SEL_WAYPOINT_DATA_ACTION); + PreparedQueryResult result = WorldDatabase.Query(stmt); + if (result) { do @@ -4890,8 +4926,8 @@ void ObjectMgr::LoadWaypointScripts() uint32 action = fields[0].GetUInt32(); actionSet.erase(action); - - } while (result->NextRow()); + } + while (result->NextRow()); } for (std::set<uint32>::iterator itr = actionSet.begin(); itr != actionSet.end(); ++itr) @@ -5022,6 +5058,7 @@ void ObjectMgr::LoadPageTexts() { uint32 oldMSTime = getMSTime(); + // 0 1 2 QueryResult result = WorldDatabase.Query("SELECT entry, text, next_page FROM page_text"); if (!result) @@ -5036,10 +5073,10 @@ void ObjectMgr::LoadPageTexts() { Field* fields = result->Fetch(); - PageText& pageText = _pageTextStore[fields[0].GetUInt32()]; + PageText& pageText = _pageTextStore[fields[0].GetUInt32()]; pageText.Text = fields[1].GetString(); - pageText.NextPage = fields[2].GetInt16(); + pageText.NextPage = fields[2].GetUInt32(); ++count; } @@ -5100,6 +5137,7 @@ void ObjectMgr::LoadInstanceTemplate() { uint32 oldMSTime = getMSTime(); + // 0 1 2 4 QueryResult result = WorldDatabase.Query("SELECT map, parent, script, allowMount FROM instance_template"); if (!result) @@ -5151,6 +5189,7 @@ void ObjectMgr::LoadInstanceEncounters() { uint32 oldMSTime = getMSTime(); + // 0 1 2 3 QueryResult result = WorldDatabase.Query("SELECT entry, creditType, creditEntry, lastEncounterDungeon FROM instance_encounters"); if (!result) { @@ -5167,7 +5206,7 @@ void ObjectMgr::LoadInstanceEncounters() uint32 entry = fields[0].GetUInt32(); uint8 creditType = fields[1].GetUInt8(); uint32 creditEntry = fields[2].GetUInt32(); - uint32 lastEncounterDungeon = fields[3].GetUInt32(); + uint32 lastEncounterDungeon = fields[3].GetUInt16(); DungeonEncounterEntry const* dungeonEncounter = sDungeonEncounterStore.LookupEntry(entry); if (!dungeonEncounter) { @@ -5244,11 +5283,11 @@ void ObjectMgr::LoadGossipText() int count = 0; if (!result) { - sLog->outString(">> Loaded %u npc texts", count); sLog->outString(); return; } + _gossipTextStore.rehash(result->GetRowCount()); int cic; @@ -5273,13 +5312,13 @@ void ObjectMgr::LoadGossipText() gText.Options[i].Text_0 = fields[cic++].GetString(); gText.Options[i].Text_1 = fields[cic++].GetString(); - gText.Options[i].Language = fields[cic++].GetUInt32(); + gText.Options[i].Language = fields[cic++].GetUInt8(); gText.Options[i].Probability = fields[cic++].GetFloat(); for (uint8 j=0; j < MAX_GOSSIP_TEXT_EMOTES; ++j) { - gText.Options[i].Emotes[j]._Delay = fields[cic++].GetUInt32(); - gText.Options[i].Emotes[j]._Emote = fields[cic++].GetUInt32(); + gText.Options[i].Emotes[j]._Delay = fields[cic++].GetUInt16(); + gText.Options[i].Emotes[j]._Emote = fields[cic++].GetUInt16(); } } } while (result->NextRow()); @@ -5360,7 +5399,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) std::map<uint32 /*messageId*/, MailItemInfoVec> itemsCache; stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_EXPIRED_MAIL_ITEMS); - stmt->setUInt64(0, basetime); + stmt->setUInt32(0, (uint32)basetime); if (PreparedQueryResult items = CharacterDatabase.Query(stmt)) { MailItemInfo item; @@ -5378,18 +5417,17 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) uint32 returnedCount = 0; do { - Field* fields = result->Fetch(); Mail* m = new Mail; - m->messageID = fields[0].GetUInt32(); - m->messageType = fields[1].GetUInt8(); - m->sender = fields[2].GetUInt32(); - m->receiver = fields[3].GetUInt32(); - bool has_items = fields[4].GetBool(); - m->expire_time = time_t(fields[5].GetUInt32()); - m->deliver_time = 0; - m->COD = fields[6].GetUInt32(); - m->checked = fields[7].GetUInt32(); + m->messageID = fields[0].GetUInt32(); + m->messageType = fields[1].GetUInt8(); + m->sender = fields[2].GetUInt32(); + m->receiver = fields[3].GetUInt32(); + bool has_items = fields[4].GetBool(); + m->expire_time = time_t(fields[5].GetUInt32()); + m->deliver_time = 0; + m->COD = fields[6].GetUInt32(); + m->checked = fields[7].GetUInt8(); m->mailTemplateId = fields[8].GetInt16(); Player* player = NULL; @@ -5426,8 +5464,8 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_MAIL_RETURNED); stmt->setUInt32(0, m->receiver); stmt->setUInt32(1, m->sender); - stmt->setUInt64(2, basetime + 30 * DAY); - stmt->setUInt64(3, basetime); + stmt->setUInt32(2, basetime + 30 * DAY); + stmt->setUInt32(3, basetime); stmt->setUInt8 (4, uint8(MAIL_CHECK_MASK_RETURNED)); stmt->setUInt32(5, m->messageID); CharacterDatabase.Execute(stmt); @@ -5450,7 +5488,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) } } - stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_BY_ID); stmt->setUInt32(0, m->messageID); CharacterDatabase.Execute(stmt); delete m; @@ -5697,7 +5735,7 @@ uint32 ObjectMgr::GetTaxiMountDisplayId(uint32 id, uint32 team, bool allowed_alt } // minfo is not actually used but the mount_id was updated - sObjectMgr->GetCreatureModelRandomGender(&mount_id); + GetCreatureModelRandomGender(&mount_id); return mount_id; } @@ -5708,6 +5746,7 @@ void ObjectMgr::LoadGraveyardZones() GraveYardStore.clear(); // need for reload case + // 0 1 2 QueryResult result = WorldDatabase.Query("SELECT id, ghost_zone, faction FROM game_graveyard_zone"); if (!result) @@ -5727,7 +5766,7 @@ void ObjectMgr::LoadGraveyardZones() uint32 safeLocId = fields[0].GetUInt32(); uint32 zoneId = fields[1].GetUInt32(); - uint32 team = fields[2].GetUInt32(); + uint32 team = fields[2].GetUInt16(); WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(safeLocId); if (!entry) @@ -5845,10 +5884,10 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveYard(float x, float y, float if (MapId != entry->map_id) { // if find graveyard at different map from where entrance placed (or no entrance data), use any first - if (!mapEntry || - mapEntry->entrance_map < 0 || - uint32(mapEntry->entrance_map) != entry->map_id || - (mapEntry->entrance_x == 0 && mapEntry->entrance_y == 0)) + if (!mapEntry + || mapEntry->entrance_map < 0 + || uint32(mapEntry->entrance_map) != entry->map_id + || (mapEntry->entrance_x == 0 && mapEntry->entrance_y == 0)) { // not have any corrdinates for check distance anyway entryFar = entry; @@ -5993,8 +6032,6 @@ void ObjectMgr::RemoveGraveYardLink(uint32 id, uint32 zoneId, uint32 team, bool WorldDatabase.Execute(stmt); } - - return; } void ObjectMgr::LoadAreaTriggerTeleports() @@ -6024,7 +6061,7 @@ void ObjectMgr::LoadAreaTriggerTeleports() AreaTrigger at; - at.target_mapId = fields[1].GetUInt32(); + at.target_mapId = fields[1].GetUInt16(); at.target_X = fields[2].GetFloat(); at.target_Y = fields[3].GetFloat(); at.target_Z = fields[4].GetFloat(); @@ -6064,7 +6101,7 @@ void ObjectMgr::LoadAccessRequirements() _accessRequirementStore.clear(); // need for reload case - // 0 1 2 3 4 5 6 7 8 9 + // 0 1 2 3 4 5 6 7 8 9 QueryResult result = WorldDatabase.Query("SELECT mapid, difficulty, level_min, level_max, item, item2, quest_done_A, quest_done_H, completed_achievement, quest_failed_text FROM access_requirement"); if (!result) { @@ -6098,7 +6135,7 @@ void ObjectMgr::LoadAccessRequirements() if (ar.item) { - ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(ar.item); + ItemTemplate const* pProto = GetItemTemplate(ar.item); if (!pProto) { sLog->outError("Key item %u does not exist for map %u difficulty %u, removing key requirement.", ar.item, mapid, difficulty); @@ -6108,7 +6145,7 @@ void ObjectMgr::LoadAccessRequirements() if (ar.item2) { - ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(ar.item2); + ItemTemplate const* pProto = GetItemTemplate(ar.item2); if (!pProto) { sLog->outError("Second item %u does not exist for map %u difficulty %u, removing key requirement.", ar.item2, mapid, difficulty); @@ -6215,10 +6252,10 @@ void ObjectMgr::SetHighestGuids() _hiItemGuid = (*result)[0].GetUInt32()+1; // Cleanup other tables from not existed guids ( >= _hiItemGuid) - CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item >= '%u'", _hiItemGuid); // One-time query - CharacterDatabase.PExecute("DELETE FROM mail_items WHERE item_guid >= '%u'", _hiItemGuid); // One-time query - CharacterDatabase.PExecute("DELETE FROM auctionhouse WHERE itemguid >= '%u'", _hiItemGuid); // One-time query - CharacterDatabase.PExecute("DELETE FROM guild_bank_item WHERE item_guid >= '%u'", _hiItemGuid); // One-time query + CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item >= '%u'", _hiItemGuid); // One-time query + CharacterDatabase.PExecute("DELETE FROM mail_items WHERE item_guid >= '%u'", _hiItemGuid); // One-time query + CharacterDatabase.PExecute("DELETE FROM auctionhouse WHERE itemguid >= '%u'", _hiItemGuid); // One-time query + CharacterDatabase.PExecute("DELETE FROM guild_bank_item WHERE item_guid >= '%u'", _hiItemGuid); // One-time query result = WorldDatabase.Query("SELECT MAX(guid) FROM gameobject"); if (result) @@ -6292,74 +6329,54 @@ uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh) switch (guidhigh) { case HIGHGUID_ITEM: - if (_hiItemGuid >= 0xFFFFFFFE) - { - sLog->outError("Item guid overflow!! Can't continue, shutting down server. "); - World::StopNow(ERROR_EXIT_CODE); - } + { + ASSERT(_hiItemGuid < 0xFFFFFFFE && "Item guid overflow!"); return _hiItemGuid++; + } case HIGHGUID_UNIT: - if (_hiCreatureGuid >= 0x00FFFFFE) - { - sLog->outError("Creature guid overflow!! Can't continue, shutting down server. "); - World::StopNow(ERROR_EXIT_CODE); - } + { + ASSERT(_hiCreatureGuid < 0x00FFFFFE && "Creature guid overflow!"); return _hiCreatureGuid++; + } case HIGHGUID_PET: - if (_hiPetGuid >= 0x00FFFFFE) - { - sLog->outError("Pet guid overflow!! Can't continue, shutting down server. "); - World::StopNow(ERROR_EXIT_CODE); - } + { + ASSERT(_hiPetGuid < 0x00FFFFFE && "Pet guid overflow!"); return _hiPetGuid++; + } case HIGHGUID_VEHICLE: - if (_hiVehicleGuid >= 0x00FFFFFF) - { - sLog->outError("Vehicle guid overflow!! Can't continue, shutting down server. "); - World::StopNow(ERROR_EXIT_CODE); - } + { + ASSERT(_hiVehicleGuid < 0x00FFFFFF && "Vehicle guid overflow!"); return _hiVehicleGuid++; + } case HIGHGUID_PLAYER: - if (_hiCharGuid >= 0xFFFFFFFE) - { - sLog->outError("Players guid overflow!! Can't continue, shutting down server. "); - World::StopNow(ERROR_EXIT_CODE); - } + { + ASSERT(_hiCharGuid < 0xFFFFFFFE && "Player guid overflow!"); return _hiCharGuid++; + } case HIGHGUID_GAMEOBJECT: - if (_hiGoGuid >= 0x00FFFFFE) - { - sLog->outError("Gameobject guid overflow!! Can't continue, shutting down server. "); - World::StopNow(ERROR_EXIT_CODE); - } + { + ASSERT(_hiGoGuid < 0x00FFFFFE && "Gameobject guid overflow!"); return _hiGoGuid++; + } case HIGHGUID_CORPSE: - if (_hiCorpseGuid >= 0xFFFFFFFE) - { - sLog->outError("Corpse guid overflow!! Can't continue, shutting down server. "); - World::StopNow(ERROR_EXIT_CODE); - } + { + ASSERT(_hiCorpseGuid < 0xFFFFFFFE && "Corpse guid overflow!"); return _hiCorpseGuid++; + } case HIGHGUID_DYNAMICOBJECT: - if (_hiDoGuid >= 0xFFFFFFFE) - { - sLog->outError("DynamicObject guid overflow!! Can't continue, shutting down server. "); - World::StopNow(ERROR_EXIT_CODE); - } + { + ASSERT(_hiDoGuid < 0xFFFFFFFE && "DynamicObject guid overflow!"); return _hiDoGuid++; + } case HIGHGUID_MO_TRANSPORT: - if (_hiMoTransGuid >= 0xFFFFFFFE) - { - sLog->outError("MO Transport guid overflow!! Can't continue, shutting down server. "); - World::StopNow(ERROR_EXIT_CODE); - } + { + ASSERT(_hiMoTransGuid < 0xFFFFFFFE && "MO Transport guid overflow!"); return _hiMoTransGuid++; + } default: - ASSERT(0); + ASSERT(false && "ObjectMgr::GenerateLowGuid - Unknown HIGHGUID type"); + return 0; } - - ASSERT(0); - return 0; } void ObjectMgr::LoadGameObjectLocales() @@ -6475,6 +6492,7 @@ void ObjectMgr::LoadGameObjectTemplate() return; } + _gameObjectTemplateStore.rehash(result->GetRowCount()); uint32 count = 0; do { @@ -6513,13 +6531,13 @@ void ObjectMgr::LoadGameObjectTemplate() { if (got.door.lockId) CheckGOLockId(&got, got.door.lockId, 1); - CheckGONoDamageImmuneId(&got, got.door.noDamageImmune, 3); + CheckGONoDamageImmuneId(&got, got.door.noDamageImmune, 3); break; } case GAMEOBJECT_TYPE_BUTTON: //1 { if (got.button.lockId) - CheckGOLockId(&got, got.button.lockId, 1); + CheckGOLockId(&got, got.button.lockId, 1); CheckGONoDamageImmuneId(&got, got.button.noDamageImmune, 4); break; } @@ -6661,10 +6679,9 @@ void ObjectMgr::LoadExplorationBaseXP() do { - Field* fields = result->Fetch(); uint8 level = fields[0].GetUInt8(); - uint32 basexp = fields[1].GetUInt32(); + uint32 basexp = fields[1].GetInt32(); _baseXPTable[level] = basexp; ++count; } @@ -6689,7 +6706,7 @@ uint32 ObjectMgr::GetXPForLevel(uint8 level) void ObjectMgr::LoadPetNames() { uint32 oldMSTime = getMSTime(); - + // 0 1 2 QueryResult result = WorldDatabase.Query("SELECT word, entry, half FROM pet_name_generation"); if (!result) @@ -6703,7 +6720,6 @@ void ObjectMgr::LoadPetNames() do { - Field* fields = result->Fetch(); std::string word = fields[0].GetString(); uint32 entry = fields[1].GetUInt32(); @@ -6807,7 +6823,7 @@ void ObjectMgr::LoadReputationRewardRate() _repRewardRateStore.clear(); // for reload case - uint32 count = 0; + uint32 count = 0; // 0 1 2 3 QueryResult result = WorldDatabase.Query("SELECT faction, quest_rate, creature_rate, spell_rate FROM reputation_reward_rate"); if (!result) @@ -6819,7 +6835,6 @@ void ObjectMgr::LoadReputationRewardRate() do { - Field* fields = result->Fetch(); uint32 factionId = fields[0].GetUInt32(); @@ -6894,13 +6909,13 @@ void ObjectMgr::LoadReputationOnKill() uint32 creature_id = fields[0].GetUInt32(); ReputationOnKillEntry repOnKill; - repOnKill.RepFaction1 = fields[1].GetUInt32(); - repOnKill.RepFaction2 = fields[2].GetUInt32(); + repOnKill.RepFaction1 = fields[1].GetInt16(); + repOnKill.RepFaction2 = fields[2].GetInt16(); repOnKill.IsTeamAward1 = fields[3].GetBool(); - repOnKill.ReputationMaxCap1 = fields[4].GetUInt32(); + repOnKill.ReputationMaxCap1 = fields[4].GetUInt8(); repOnKill.RepValue1 = fields[5].GetInt32(); repOnKill.IsTeamAward2 = fields[6].GetBool(); - repOnKill.ReputationMaxCap2 = fields[7].GetUInt32(); + repOnKill.ReputationMaxCap2 = fields[7].GetUInt8(); repOnKill.RepValue2 = fields[8].GetInt32(); repOnKill.TeamDependent = fields[9].GetUInt8(); @@ -6945,7 +6960,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate() _repSpilloverTemplateStore.clear(); // for reload case - uint32 count = 0; + uint32 count = 0; // 0 1 2 3 4 5 6 7 8 9 10 11 12 QueryResult result = WorldDatabase.Query("SELECT faction, faction1, rate_1, rank_1, faction2, rate_2, rank_2, faction3, rate_3, rank_3, faction4, rate_4, rank_4 FROM reputation_spillover_template"); if (!result) @@ -6957,25 +6972,24 @@ void ObjectMgr::LoadReputationSpilloverTemplate() do { - Field* fields = result->Fetch(); - uint32 factionId = fields[0].GetUInt32(); + uint32 factionId = fields[0].GetUInt16(); RepSpilloverTemplate repTemplate; - repTemplate.faction[0] = fields[1].GetUInt32(); + repTemplate.faction[0] = fields[1].GetUInt16(); repTemplate.faction_rate[0] = fields[2].GetFloat(); - repTemplate.faction_rank[0] = fields[3].GetUInt32(); - repTemplate.faction[1] = fields[4].GetUInt32(); + repTemplate.faction_rank[0] = fields[3].GetUInt8(); + repTemplate.faction[1] = fields[4].GetUInt16(); repTemplate.faction_rate[1] = fields[5].GetFloat(); - repTemplate.faction_rank[1] = fields[6].GetUInt32(); - repTemplate.faction[2] = fields[7].GetUInt32(); + repTemplate.faction_rank[1] = fields[6].GetUInt8(); + repTemplate.faction[2] = fields[7].GetUInt16(); repTemplate.faction_rate[2] = fields[8].GetFloat(); - repTemplate.faction_rank[2] = fields[9].GetUInt32(); - repTemplate.faction[3] = fields[10].GetUInt32(); + repTemplate.faction_rank[2] = fields[9].GetUInt8(); + repTemplate.faction[3] = fields[10].GetUInt16(); repTemplate.faction_rate[3] = fields[11].GetFloat(); - repTemplate.faction_rank[3] = fields[12].GetUInt32(); + repTemplate.faction_rank[3] = fields[12].GetUInt8(); FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId); @@ -7060,7 +7074,7 @@ void ObjectMgr::LoadPointsOfInterest() uint32 count = 0; - // 0 1 2 3 4 5 6 + // 0 1 2 3 4 5 6 QueryResult result = WorldDatabase.Query("SELECT entry, x, y, icon, flags, data, icon_name FROM points_of_interest"); if (!result) @@ -7077,12 +7091,12 @@ void ObjectMgr::LoadPointsOfInterest() uint32 point_id = fields[0].GetUInt32(); PointOfInterest POI; - POI.x = fields[1].GetFloat(); - POI.y = fields[2].GetFloat(); - POI.icon = fields[3].GetUInt32(); - POI.flags = fields[4].GetUInt32(); - POI.data = fields[5].GetUInt32(); - POI.icon_name = fields[6].GetString(); + POI.x = fields[1].GetFloat(); + POI.y = fields[2].GetFloat(); + POI.icon = fields[3].GetUInt32(); + POI.flags = fields[4].GetUInt32(); + POI.data = fields[5].GetUInt32(); + POI.icon_name = fields[6].GetString(); if (!Trinity::IsValidMapCoord(POI.x, POI.y)) { @@ -7117,8 +7131,8 @@ void ObjectMgr::LoadQuestPOI() return; } - // 0 1 2 3 - QueryResult points = WorldDatabase.PQuery("SELECT questId, id, x, y FROM quest_poi_points ORDER BY questId DESC, idx"); + // 0 1 2 3 + QueryResult points = WorldDatabase.Query("SELECT questId, id, x, y FROM quest_poi_points ORDER BY questId DESC, idx"); std::vector<std::vector<std::vector<QuestPOIPoint> > > POIs; @@ -7131,7 +7145,6 @@ void ObjectMgr::LoadQuestPOI() do { - fields = points->Fetch(); uint32 questId = fields[0].GetUInt32(); @@ -7177,7 +7190,7 @@ void ObjectMgr::LoadNPCSpellClickSpells() uint32 oldMSTime = getMSTime(); _spellClickInfoStore.clear(); - // 0 1 2 3 + // 0 1 2 3 QueryResult result = WorldDatabase.Query("SELECT npc_entry, spell_id, cast_flags, user_type FROM npc_spellclick_spells"); if (!result) @@ -7209,7 +7222,7 @@ void ObjectMgr::LoadNPCSpellClickSpells() continue; } - uint8 userType = fields[3].GetUInt8(); + uint8 userType = fields[3].GetUInt16(); if (userType >= SPELL_CLICK_USER_MAX) sLog->outErrorDb("Table npc_spellclick_spells references unknown user type %u. Skipping entry.", uint32(userType)); @@ -7256,9 +7269,9 @@ void ObjectMgr::SaveCreatureRespawnTime(uint32 loguid, uint32 instance, time_t t _creatureRespawnTimesMutex.release(); } - PreparedStatement *stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CREATURE_RESPAWN); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CREATURE_RESPAWN); stmt->setUInt32(0, loguid); - stmt->setUInt64(1, uint64(t)); + stmt->setUInt32(1, uint32(t)); stmt->setUInt32(2, instance); CharacterDatabase.Execute(stmt); } @@ -7272,7 +7285,7 @@ void ObjectMgr::RemoveCreatureRespawnTime(uint32 loguid, uint32 instance) _creatureRespawnTimesMutex.release(); } - PreparedStatement *stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CREATURE_RESPAWN); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CREATURE_RESPAWN); stmt->setUInt32(0, loguid); stmt->setUInt32(1, instance); CharacterDatabase.Execute(stmt); @@ -7410,7 +7423,6 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string table, do { - uint32 id = result->Fetch()[0].GetUInt32(); uint32 quest = result->Fetch()[1].GetUInt32(); uint32 poolId = result->Fetch()[2].GetUInt32(); @@ -7733,7 +7745,7 @@ void ObjectMgr::LoadGameObjectForQuests() sLog->outString(); } -bool ObjectMgr::LoadTrinityStrings(char const* table, int32 min_value, int32 max_value) +bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max_value) { uint32 oldMSTime = getMSTime(); @@ -7775,7 +7787,6 @@ bool ObjectMgr::LoadTrinityStrings(char const* table, int32 min_value, int32 max if (!result) { - if (min_value == MIN_TRINITY_STRING_ID) // error only in case internal strings sLog->outErrorDb(">> Loaded 0 trinity strings. DB table `%s` is empty. Cannot continue.", table); else @@ -7863,10 +7874,9 @@ void ObjectMgr::LoadFishingBaseSkillLevel() do { - Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); - int32 skill = fields[1].GetInt32(); + int32 skill = fields[1].GetInt16(); AreaTableEntry const* fArea = GetAreaEntryByAreaID(entry); if (!fArea) @@ -7893,7 +7903,7 @@ bool ObjectMgr::CheckDeclinedNames(std::wstring w_ownname, DeclinedName const& n bool y = true; // check declined names - for (uint8 i =0; i < MAX_DECLINED_NAME_CASES; ++i) + for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i) { std::wstring wname; if (!Utf8toWStr(names.name[i], wname)) @@ -7959,6 +7969,7 @@ void ObjectMgr::LoadGameTele() _gameTeleStore.clear(); // for reload case + // 0 1 2 3 4 5 6 QueryResult result = WorldDatabase.Query("SELECT id, position_x, position_y, position_z, orientation, map, name FROM game_tele"); if (!result) @@ -7972,7 +7983,6 @@ void ObjectMgr::LoadGameTele() do { - Field* fields = result->Fetch(); uint32 id = fields[0].GetUInt32(); @@ -7983,7 +7993,7 @@ void ObjectMgr::LoadGameTele() gt.position_y = fields[2].GetFloat(); gt.position_z = fields[3].GetFloat(); gt.orientation = fields[4].GetFloat(); - gt.mapId = fields[5].GetUInt32(); + gt.mapId = fields[5].GetUInt16(); gt.name = fields[6].GetString(); if (!MapManager::IsValidMapCoord(gt.mapId, gt.position_x, gt.position_y, gt.position_z, gt.orientation)) @@ -8015,7 +8025,7 @@ GameTele const* ObjectMgr::GetGameTele(const std::string& name) const // explicit name case std::wstring wname; if (!Utf8toWStr(name, wname)) - return false; + return NULL; // converting string that we try to find to lower case wstrToLower(wname); @@ -8100,6 +8110,7 @@ void ObjectMgr::LoadMailLevelRewards() _mailLevelRewardStore.clear(); // for reload case + // 0 1 2 3 QueryResult result = WorldDatabase.Query("SELECT level, raceMask, mailTemplateId, senderEntry FROM mail_level_reward"); if (!result) @@ -8113,7 +8124,6 @@ void ObjectMgr::LoadMailLevelRewards() do { - Field* fields = result->Fetch(); uint8 level = fields[0].GetUInt8(); @@ -8257,20 +8267,18 @@ void ObjectMgr::LoadTrainerSpell() do { - Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); uint32 spell = fields[1].GetUInt32(); uint32 spellCost = fields[2].GetUInt32(); - uint32 reqSkill = fields[3].GetUInt32(); - uint32 reqSkillValue = fields[4].GetUInt32(); - uint32 reqLevel = fields[5].GetUInt32(); + uint32 reqSkill = fields[3].GetUInt16(); + uint32 reqSkillValue = fields[4].GetUInt16(); + uint32 reqLevel = fields[5].GetUInt8(); AddSpellToTrainer(entry, spell, spellCost, reqSkill, reqSkillValue, reqLevel); - count++; - + ++count; } while (result->NextRow()); @@ -8281,7 +8289,10 @@ void ObjectMgr::LoadTrainerSpell() int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set<uint32> *skip_vendors) { // find all items from the reference vendor - QueryResult result = WorldDatabase.PQuery("SELECT item, maxcount, incrtime, ExtendedCost FROM npc_vendor WHERE entry='%d' ORDER BY slot ASC", item); + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_NPC_VENDOR_REF); + stmt->setUInt32(0, uint32(item)); + PreparedQueryResult result = WorldDatabase.Query(stmt); + if (!result) return 0; @@ -8297,7 +8308,7 @@ int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set<uint32> *s count += LoadReferenceVendor(vendor, -item_id, skip_vendors); else { - int32 maxcount = fields[1].GetInt32(); + int32 maxcount = fields[1].GetUInt8(); uint32 incrtime = fields[2].GetUInt32(); uint32 ExtendedCost = fields[3].GetUInt32(); @@ -8309,7 +8320,6 @@ int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set<uint32> *s vList.AddItem(item_id, maxcount, incrtime, ExtendedCost); ++count; } - } while (result->NextRow()); return count; @@ -8348,7 +8358,7 @@ void ObjectMgr::LoadVendors() count += LoadReferenceVendor(entry, -item_id, &skip_vendors); else { - int32 maxcount = fields[2].GetInt32(); + uint32 maxcount = fields[2].GetUInt8(); uint32 incrtime = fields[3].GetUInt32(); uint32 ExtendedCost = fields[4].GetUInt32(); @@ -8360,7 +8370,6 @@ void ObjectMgr::LoadVendors() vList.AddItem(item_id, maxcount, incrtime, ExtendedCost); ++count; } - } while (result->NextRow()); @@ -8387,12 +8396,11 @@ void ObjectMgr::LoadGossipMenu() do { - Field* fields = result->Fetch(); GossipMenus gMenu; - gMenu.entry = fields[0].GetUInt32(); + gMenu.entry = fields[0].GetUInt16(); gMenu.text_id = fields[1].GetUInt32(); if (!GetGossipText(gMenu.text_id)) @@ -8418,7 +8426,9 @@ void ObjectMgr::LoadGossipMenuItems() _gossipMenuItemsStore.clear(); QueryResult result = WorldDatabase.Query( + // 0 1 2 3 4 "SELECT menu_id, id, option_icon, option_text, option_id, npc_option_npcflag, " + // 5 6 7 8 9 "action_menu_id, action_poi_id, box_coded, box_money, box_text " "FROM gossip_menu_option ORDER BY menu_id, id"); @@ -8437,11 +8447,11 @@ void ObjectMgr::LoadGossipMenuItems() GossipMenuItems gMenuItem; - gMenuItem.MenuId = fields[0].GetUInt32(); - gMenuItem.OptionIndex = fields[1].GetUInt32(); - gMenuItem.OptionIcon = fields[2].GetUInt8(); + gMenuItem.MenuId = fields[0].GetUInt16(); + gMenuItem.OptionIndex = fields[1].GetUInt16(); + gMenuItem.OptionIcon = fields[2].GetUInt32(); gMenuItem.OptionText = fields[3].GetString(); - gMenuItem.OptionType = fields[4].GetUInt32(); + gMenuItem.OptionType = fields[4].GetUInt8(); gMenuItem.OptionNpcflag = fields[5].GetUInt32(); gMenuItem.ActionMenuId = fields[6].GetUInt32(); gMenuItem.ActionPoiId = fields[7].GetUInt32(); @@ -8656,10 +8666,13 @@ uint32 ObjectMgr::GetScriptId(const char *name) { // use binary search to find the script name in the sorted vector // assume "" is the first element - if (!name) return 0; - ScriptNameContainer::const_iterator itr = - std::lower_bound(_scriptNamesStore.begin(), _scriptNamesStore.end(), name); - if (itr == _scriptNamesStore.end() || *itr != name) return 0; + if (!name) + return 0; + + ScriptNameContainer::const_iterator itr = std::lower_bound(_scriptNamesStore.begin(), _scriptNamesStore.end(), name); + if (itr == _scriptNamesStore.end() || *itr != name) + return 0; + return uint32(itr - _scriptNamesStore.begin()); } @@ -8668,6 +8681,7 @@ void ObjectMgr::CheckScripts(ScriptsType type, std::set<int32>& ids) ScriptMapMap* scripts = GetScriptsMapByType(type); if (!scripts) return; + for (ScriptMapMap::const_iterator itrMM = scripts->begin(); itrMM != scripts->end(); ++itrMM) { for (ScriptMap::const_iterator itrM = itrMM->second.begin(); itrM != itrMM->second.end(); ++itrM) @@ -8706,7 +8720,7 @@ void ObjectMgr::LoadDbScriptStrings() sLog->outErrorDb("Table `db_script_string` has unused string id %u", *itr); } -bool LoadTrinityStrings(char const* table, int32 start_value, int32 end_value) +bool LoadTrinityStrings(const char* table, int32 start_value, int32 end_value) { // MAX_DB_SCRIPT_STRING_ID is max allowed negative value for scripts (scrpts can use only more deep negative values // start/end reversed for negative values @@ -8758,16 +8772,16 @@ void ObjectMgr::LoadCreatureClassLevelStats() { Field* fields = result->Fetch(); - uint8 Level = fields[0].GetUInt8(); - uint8 Class = fields[1].GetUInt8(); + uint8 Level = fields[0].GetInt8(); + uint8 Class = fields[1].GetInt8(); CreatureBaseStats stats; for (uint8 i = 0; i < MAX_CREATURE_BASE_HP; ++i) - stats.BaseHealth[i] = fields[i + 2].GetUInt32(); + stats.BaseHealth[i] = fields[i + 2].GetInt16(); - stats.BaseMana = fields[5].GetUInt32(); - stats.BaseArmor = fields[6].GetUInt32(); + stats.BaseMana = fields[5].GetInt16(); + stats.BaseArmor = fields[6].GetInt16(); if (!Class || ((1 << (Class - 1)) & CLASSMASK_ALL_CREATURES) == 0) sLog->outErrorDb("Creature base stats for level %u has invalid class %u", Level, Class); diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index ae699a01da7..9ab7898573f 100755 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -526,6 +526,7 @@ struct GraveYardData uint32 safeLocId; uint32 team; }; + typedef std::multimap<uint32, GraveYardData> GraveYardContainer; typedef UNORDERED_MAP<uint32, VendorItemData> CacheVendorItemContainer; @@ -649,7 +650,7 @@ class ObjectMgr return NULL; } - InstanceTemplate const* GetInstanceTemplate(uint32 mapID); + InstanceTemplate const* GetInstanceTemplate(uint32 mapId); PetLevelInfo const* GetPetLevelInfo(uint32 creature_id, uint8 level) const; @@ -1035,15 +1036,6 @@ class ObjectMgr return &itr->second; } - bool IsGoOfSpecificEntrySpawned(uint32 entry) const - { - for (GameObjectDataContainer::const_iterator it = _gameObjectDataStore.begin(); it != _gameObjectDataStore.end(); ++it) - if (it->second.id == entry) - return true; - - return false; - } - GameObjectData const* GetGOData(uint32 guid) const { GameObjectDataContainer::const_iterator itr = _gameObjectDataStore.find(guid); @@ -1349,7 +1341,6 @@ class ObjectMgr }; HotfixData _hotfixData; - }; #define sObjectMgr ACE_Singleton<ObjectMgr, ACE_Null_Mutex>::instance() diff --git a/src/server/game/Grids/Cells/CellImpl.h b/src/server/game/Grids/Cells/CellImpl.h index 77830bc59d5..b224b3865e0 100644 --- a/src/server/game/Grids/Cells/CellImpl.h +++ b/src/server/game/Grids/Cells/CellImpl.h @@ -91,7 +91,7 @@ inline void Cell::Visit(CellCoord const& standing_cell, TypeContainerVisitor<T, //if radius is known to reach cell area more than 4x4 then we should call optimized VisitCircle //currently this technique works with MAX_NUMBER_OF_CELLS 16 and higher, with lower values //there are nothing to optimize because SIZE_OF_GRID_CELL is too big... - if (((area.high_bound.x_coord - area.low_bound.x_coord) > 4) && ((area.high_bound.y_coord - area.low_bound.y_coord) > 4)) + if ((area.high_bound.x_coord > (area.low_bound.x_coord + 4)) && (area.high_bound.y_coord > (area.low_bound.y_coord + 4))) { VisitCircle(visitor, map, area.low_bound, area.high_bound); return; diff --git a/src/server/game/Grids/GridDefines.h b/src/server/game/Grids/GridDefines.h index d096bb7ab63..7bd0da34a46 100644 --- a/src/server/game/Grids/GridDefines.h +++ b/src/server/game/Grids/GridDefines.h @@ -67,12 +67,12 @@ typedef GridRefManager<Player> PlayerMapType; enum GridMapTypeMask { - GRID_MAP_TYPE_MASK_CORPSE = 0x01, - GRID_MAP_TYPE_MASK_CREATURE = 0x02, - GRID_MAP_TYPE_MASK_DYNAMICOBJECT = 0x04, - GRID_MAP_TYPE_MASK_GAMEOBJECT = 0x08, - GRID_MAP_TYPE_MASK_PLAYER = 0x10, - GRID_MAP_TYPE_MASK_ALL = 0x1F + GRID_MAP_TYPE_MASK_CORPSE = 0x01, + GRID_MAP_TYPE_MASK_CREATURE = 0x02, + GRID_MAP_TYPE_MASK_DYNAMICOBJECT = 0x04, + GRID_MAP_TYPE_MASK_GAMEOBJECT = 0x08, + GRID_MAP_TYPE_MASK_PLAYER = 0x10, + GRID_MAP_TYPE_MASK_ALL = 0x1F }; typedef Grid<Player, AllWorldObjectTypes, AllGridObjectTypes> GridType; @@ -172,14 +172,14 @@ typedef CoordPair<TOTAL_NUMBER_OF_CELLS_PER_MAP> CellCoord; namespace Trinity { template<class RET_TYPE, int CENTER_VAL> - inline RET_TYPE Compute(float x, float y, float center_offset, float size) + inline RET_TYPE Compute(float x, float y, float center_offset, float size) { // calculate and store temporary values in double format for having same result as same mySQL calculations double x_offset = (double(x) - center_offset)/size; double y_offset = (double(y) - center_offset)/size; - int x_val = int(x_offset+CENTER_VAL + 0.5f); - int y_val = int(y_offset+CENTER_VAL + 0.5f); + int x_val = int(x_offset + CENTER_VAL + 0.5f); + int y_val = int(y_offset + CENTER_VAL + 0.5f); return RET_TYPE(x_val, y_val); } diff --git a/src/server/game/Grids/GridStates.h b/src/server/game/Grids/GridStates.h index 08b66f6bb35..cf649f8d896 100755 --- a/src/server/game/Grids/GridStates.h +++ b/src/server/game/Grids/GridStates.h @@ -40,6 +40,7 @@ class GridState void setMagic() { i_Magic = MAGIC_TESTVAL; } unsigned int i_Magic; #endif + virtual ~GridState() {}; virtual void Update(Map &, NGridType&, GridInfo &, const uint32 t_diff) const = 0; }; diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.cpp b/src/server/game/Grids/Notifiers/GridNotifiers.cpp index 17d3066e64d..a02c18ca008 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiers.cpp +++ b/src/server/game/Grids/Notifiers/GridNotifiers.cpp @@ -120,7 +120,7 @@ inline void CreatureUnitRelocationWorker(Creature* c, Unit* u) void PlayerRelocationNotifier::Visit(PlayerMapType &m) { - for (PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter) + for (PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter) { Player* player = iter->getSource(); diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index 48b9860eb0b..54bc1206e18 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -797,7 +797,7 @@ namespace Trinity if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isTotem()) return false; - if(!u->isTargetableForAttack(false)) + if (!u->isTargetableForAttack(false)) return false; return i_obj->IsWithinDistInMap(u, i_range) && !i_funit->IsFriendlyTo(u); @@ -858,6 +858,30 @@ namespace Trinity float i_range; }; + class AnyGroupedUnitInObjectRangeCheck + { + public: + AnyGroupedUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range, bool raid) : _source(obj), _refUnit(funit), _range(range), _raid(raid) {} + bool operator()(Unit* u) + { + if (_raid) + { + if (!_refUnit->IsInRaidWith(u)) + return false; + } + else if (!_refUnit->IsInPartyWith(u)) + return false; + + return !_refUnit->IsHostileTo(u) && u->isAlive() && _source->IsWithinDistInMap(u, _range); + } + + private: + WorldObject const* _source; + Unit const* _refUnit; + float _range; + bool _raid; + }; + class AnyUnitInObjectRangeCheck { public: @@ -903,13 +927,15 @@ namespace Trinity { public: AnyAoETargetUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range) - : i_obj(obj), i_funit(funit), i_range(range) + : i_obj(obj), i_funit(funit), _spellInfo(NULL), i_range(range) { Unit const* check = i_funit; Unit const* owner = i_funit->GetOwner(); if (owner) check = owner; i_targetForPlayer = (check->GetTypeId() == TYPEID_PLAYER); + if (i_obj->GetTypeId() == TYPEID_DYNAMICOBJECT) + _spellInfo = sSpellMgr->GetSpellInfo(((DynamicObject*)i_obj)->GetSpellId()); } bool operator()(Unit* u) { @@ -917,7 +943,7 @@ namespace Trinity if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isTotem()) return false; - if (i_funit->IsValidAttackTarget(u) && i_obj->IsWithinDistInMap(u, i_range)) + if (i_funit->_IsValidAttackTarget(u, _spellInfo,i_obj->GetTypeId() == TYPEID_DYNAMICOBJECT ? i_obj : NULL) && i_obj->IsWithinDistInMap(u, i_range)) return true; return false; @@ -926,6 +952,7 @@ namespace Trinity bool i_targetForPlayer; WorldObject const* i_obj; Unit const* i_funit; + SpellInfo const* _spellInfo; float i_range; }; @@ -945,7 +972,7 @@ namespace Trinity return; // too far - if (!u->IsWithinDistInMap(i_enemy, i_range)) + if (!u->IsWithinDistInMap(i_funit, i_range)) return; // only if see assisted creature's enemy @@ -1188,7 +1215,7 @@ namespace Trinity class AllGameObjectsWithEntryInRange { public: - AllGameObjectsWithEntryInRange(const WorldObject* pObject, uint32 uiEntry, float fMaxRange) : m_pObject(pObject), m_uiEntry(uiEntry), m_fRange(fMaxRange) {} + AllGameObjectsWithEntryInRange(const WorldObject* object, uint32 entry, float maxRange) : m_pObject(object), m_uiEntry(entry), m_fRange(maxRange) {} bool operator() (GameObject* go) { if (go->GetEntry() == m_uiEntry && m_pObject->IsWithinDist(go, m_fRange, false)) @@ -1205,7 +1232,7 @@ namespace Trinity class AllCreaturesOfEntryInRange { public: - AllCreaturesOfEntryInRange(const WorldObject* pObject, uint32 uiEntry, float fMaxRange) : m_pObject(pObject), m_uiEntry(uiEntry), m_fRange(fMaxRange) {} + AllCreaturesOfEntryInRange(const WorldObject* object, uint32 entry, float maxRange) : m_pObject(object), m_uiEntry(entry), m_fRange(maxRange) {} bool operator() (Unit* unit) { if (unit->GetEntry() == m_uiEntry && m_pObject->IsWithinDist(unit, m_fRange, false)) @@ -1257,10 +1284,10 @@ namespace Trinity class AllWorldObjectsInRange { public: - AllWorldObjectsInRange(const WorldObject* pObject, float fMaxRange) : m_pObject(pObject), m_fRange(fMaxRange) {} + AllWorldObjectsInRange(const WorldObject* object, float maxRange) : m_pObject(object), m_fRange(maxRange) {} bool operator() (WorldObject* go) { - return m_pObject->IsWithinDist(go, m_fRange, false); + return m_pObject->IsWithinDist(go, m_fRange, false) && m_pObject->InSamePhase(go); } private: const WorldObject* m_pObject; diff --git a/src/server/game/Grids/Notifiers/GridNotifiersImpl.h b/src/server/game/Grids/Notifiers/GridNotifiersImpl.h index 40b3863679b..e3cda4dd76d 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiersImpl.h +++ b/src/server/game/Grids/Notifiers/GridNotifiersImpl.h @@ -251,9 +251,8 @@ void Trinity::WorldObjectListSearcher<Check>::Visit(PlayerMapType &m) return; for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr) - if (itr->getSource()->InSamePhase(i_phaseMask)) - if (i_check(itr->getSource())) - i_objects.push_back(itr->getSource()); + if (i_check(itr->getSource())) + i_objects.push_back(itr->getSource()); } template<class Check> @@ -263,9 +262,8 @@ void Trinity::WorldObjectListSearcher<Check>::Visit(CreatureMapType &m) return; for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) - if (itr->getSource()->InSamePhase(i_phaseMask)) - if (i_check(itr->getSource())) - i_objects.push_back(itr->getSource()); + if (i_check(itr->getSource())) + i_objects.push_back(itr->getSource()); } template<class Check> @@ -275,9 +273,8 @@ void Trinity::WorldObjectListSearcher<Check>::Visit(CorpseMapType &m) return; for (CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr) - if (itr->getSource()->InSamePhase(i_phaseMask)) - if (i_check(itr->getSource())) - i_objects.push_back(itr->getSource()); + if (i_check(itr->getSource())) + i_objects.push_back(itr->getSource()); } template<class Check> @@ -287,9 +284,8 @@ void Trinity::WorldObjectListSearcher<Check>::Visit(GameObjectMapType &m) return; for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr) - if (itr->getSource()->InSamePhase(i_phaseMask)) - if (i_check(itr->getSource())) - i_objects.push_back(itr->getSource()); + if (i_check(itr->getSource())) + i_objects.push_back(itr->getSource()); } template<class Check> @@ -299,9 +295,8 @@ void Trinity::WorldObjectListSearcher<Check>::Visit(DynamicObjectMapType &m) return; for (DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr) - if (itr->getSource()->InSamePhase(i_phaseMask)) - if (i_check(itr->getSource())) - i_objects.push_back(itr->getSource()); + if (i_check(itr->getSource())) + i_objects.push_back(itr->getSource()); } // Gameobject searchers diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index 1af656d7664..4c6b6249887 100755 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -41,6 +41,7 @@ totalPlayersRolling(0), totalNeed(0), totalGreed(0), totalPass(0), itemSlot(0), rollVoteMask(ROLL_ALL_TYPE_NO_DISENCHANT) { } + Roll::~Roll() { } @@ -170,7 +171,7 @@ void Group::LoadGroupFromDB(Field* fields) m_lootMethod = LootMethod(fields[1].GetUInt8()); m_looterGuid = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER); - m_lootThreshold = ItemQualities(fields[3].GetUInt16()); + m_lootThreshold = ItemQualities(fields[3].GetUInt8()); for (uint8 i = 0; i < TARGETICONCOUNT; ++i) m_targetIcons[i] = fields[4+i].GetUInt32(); @@ -728,13 +729,21 @@ void Group::Disband(bool hideDestroy /* = false */) if (!isBGGroup()) { SQLTransaction trans = CharacterDatabase.BeginTransaction(); - trans->PAppend("DELETE FROM groups WHERE guid = %u", m_dbStoreId); - trans->PAppend("DELETE FROM group_member WHERE guid = %u", m_dbStoreId); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP); + stmt->setUInt32(0, m_dbStoreId); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER_ALL); + stmt->setUInt32(0, m_dbStoreId); + trans->Append(stmt); + CharacterDatabase.CommitTransaction(trans); + ResetInstances(INSTANCE_RESET_GROUP_DISBAND, false, NULL); ResetInstances(INSTANCE_RESET_GROUP_DISBAND, true, NULL); - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_LFG_DATA); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_LFG_DATA); stmt->setUInt32(0, m_dbStoreId); CharacterDatabase.Execute(stmt); @@ -779,7 +788,7 @@ void Group::SendLootStartRollToPlayer(uint32 countDown, uint32 mapId, Player* p, if (!p || !p->GetSession()) return; - WorldPacket data(SMSG_LOOT_START_ROLL, (8 + 4 + 4 + 4 + 4 + 4 + 4 + 1 )); + WorldPacket data(SMSG_LOOT_START_ROLL, (8 + 4 + 4 + 4 + 4 + 4 + 4 + 1)); data << uint64(r.itemGUID); // guid of rolled item data << uint32(mapId); // 3.3.3 mapid data << uint32(r.totalPlayersRolling); // maybe the number of players rolling for it??? @@ -843,28 +852,28 @@ void Group::SendLootRollWon(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumb } } -void Group::SendLootAllPassed(uint32 NumberOfPlayers, const Roll &r) +void Group::SendLootAllPassed(uint32 numberOfPlayers, Roll const& roll) { WorldPacket data(SMSG_LOOT_ALL_PASSED, (8+4+4+4+4)); - data << uint64(r.itemGUID); // Guid of the item rolled - data << uint32(NumberOfPlayers); // The number of players rolling for it??? - data << uint32(r.itemid); // The itemEntryId for the item that shall be rolled for - data << uint32(r.itemRandomPropId); // Item random property ID - data << uint32(r.itemRandomSuffix); // Item random suffix ID + data << uint64(roll.itemGUID); // Guid of the item rolled + data << uint32(numberOfPlayers); // The number of players rolling for it + data << uint32(roll.itemid); // The itemEntryId for the item that shall be rolled for + data << uint32(roll.itemRandomPropId); // Item random property ID + data << uint32(roll.itemRandomSuffix); // Item random suffix ID - for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr != r.playerVote.end(); ++itr) + for (Roll::PlayerVote::const_iterator itr = roll.playerVote.begin(); itr != roll.playerVote.end(); ++itr) { - Player* p = ObjectAccessor::FindPlayer(itr->first); - if (!p || !p->GetSession()) + Player* player = ObjectAccessor::FindPlayer(itr->first); + if (!player || !player->GetSession()) continue; if (itr->second != NOT_VALID) - p->GetSession()->SendPacket(&data); + player->GetSession()->SendPacket(&data); } } // notify group members which player is the allowed looter for the given creature -void Group::SendLooter(Creature* creature, Player* pLooter) +void Group::SendLooter(Creature* creature, Player* groupLooter) { ASSERT(creature); @@ -872,8 +881,8 @@ void Group::SendLooter(Creature* creature, Player* pLooter) data << uint64(creature->GetGUID()); data << uint8(0); // unk1 - if (pLooter) - data.append(pLooter->GetPackGUID()); + if (groupLooter) + data.append(groupLooter->GetPackGUID()); else data << uint8(0); @@ -1758,7 +1767,7 @@ bool Group::InCombatToInstance(uint32 instanceId) Player* player = itr->getSource(); if (player && !player->getAttackers().empty() && player->GetInstanceId() == instanceId && (player->GetMap()->IsRaidOrHeroicDungeon())) for (std::set<Unit*>::const_iterator i = player->getAttackers().begin(); i != player->getAttackers().end(); ++i) - if ((*i) && (*i)->GetTypeId() == TYPEID_UNIT && (*i)->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND) + if ((*i) && (*i)->GetTypeId() == TYPEID_UNIT && (*i)->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND) return true; } return false; @@ -2158,7 +2167,7 @@ void Group::SetGroupMemberFlag(uint64 guid, bool apply, GroupMemberFlags flag) PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_FLAG); stmt->setUInt8(0, slot->flags); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(1, GUID_LOPART(guid)); CharacterDatabase.Execute(stmt); diff --git a/src/server/game/Groups/GroupMgr.cpp b/src/server/game/Groups/GroupMgr.cpp index ae400852c73..f372f08c941 100644 --- a/src/server/game/Groups/GroupMgr.cpp +++ b/src/server/game/Groups/GroupMgr.cpp @@ -120,7 +120,7 @@ void GroupMgr::LoadGroups() CharacterDatabase.DirectExecute("DELETE FROM groups WHERE guid NOT IN (SELECT guid FROM group_member GROUP BY guid HAVING COUNT(guid) > 1)"); // 0 1 2 3 4 5 6 7 8 9 - QueryResult result = CharacterDatabase.PQuery("SELECT g.leaderGuid, g.lootMethod, g.looterGuid, g.lootThreshold, g.icon1, g.icon2, g.icon3, g.icon4, g.icon5, g.icon6" + QueryResult result = CharacterDatabase.Query("SELECT g.leaderGuid, g.lootMethod, g.looterGuid, g.lootThreshold, g.icon1, g.icon2, g.icon3, g.icon4, g.icon5, g.icon6" // 10 11 12 13 14 15 16 17 ", g.icon7, g.icon8, g.groupType, g.difficulty, g.raiddifficulty, g.guid, lfg.dungeon, lfg.state FROM groups g LEFT JOIN lfg_data lfg ON lfg.guid = g.guid ORDER BY g.guid ASC"); if (!result) @@ -215,10 +215,10 @@ void GroupMgr::LoadGroups() Group* group = GetGroupByDbStoreId(fields[0].GetUInt32()); // group will never be NULL (we have run consistency sql's before loading) - MapEntry const* mapEntry = sMapStore.LookupEntry(fields[1].GetUInt32()); + MapEntry const* mapEntry = sMapStore.LookupEntry(fields[1].GetUInt16()); if (!mapEntry || !mapEntry->IsDungeon()) { - sLog->outErrorDb("Incorrect entry in group_instance table : no dungeon map %d", fields[1].GetUInt32()); + sLog->outErrorDb("Incorrect entry in group_instance table : no dungeon map %d", fields[1].GetUInt16()); continue; } @@ -229,7 +229,7 @@ void GroupMgr::LoadGroups() diff = 0; // default for both difficaly types } - InstanceSave* save = sInstanceSaveMgr->AddInstanceSave(mapEntry->MapID, fields[2].GetUInt32(), Difficulty(diff), time_t(fields[5].GetUInt64()), fields[6].GetBool(), true); + InstanceSave* save = sInstanceSaveMgr->AddInstanceSave(mapEntry->MapID, fields[2].GetUInt32(), Difficulty(diff), time_t(fields[5].GetUInt32()), (bool)fields[6].GetUInt64(), true); group->BindToInstance(save, fields[3].GetBool(), true); ++count; } diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index a7c5b04bcba..dfeb3f7cad9 100755 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.cpp @@ -588,11 +588,11 @@ bool Guild::Member::LoadFromDB(Field* fields) } SetStats(fields[19].GetString(), - fields[20].GetUInt8(), - fields[21].GetUInt8(), - fields[22].GetUInt32(), - fields[23].GetUInt32()); - m_logoutTime = fields[24].GetUInt32(); + fields[20].GetUInt8(), // characters.level + fields[21].GetUInt8(), // characters.class + fields[22].GetUInt16(), // characters.zone + fields[23].GetUInt32()); // characters.account + m_logoutTime = fields[24].GetUInt32(); // characters.logout_time if (!CheckStats()) return false; @@ -1376,12 +1376,12 @@ void Guild::HandleSetMemberNote(WorldSession* session, const std::string& name, if (!_HasRankRight(session->GetPlayer(), officer ? GR_RIGHT_EOFFNOTE : GR_RIGHT_EPNOTE)) SendCommandResult(session, GUILD_INVITE_S, ERR_GUILD_PERMISSIONS); // Noted player must be a member of guild - else if (Member* pMember = GetMember(session, name)) + else if (Member* member = GetMember(session, name)) { if (officer) - pMember->SetOfficerNote(note); + member->SetOfficerNote(note); else - pMember->SetPublicNote(note); + member->SetPublicNote(note); HandleRoster(session); } } @@ -1526,17 +1526,17 @@ void Guild::HandleRemoveMember(WorldSession* session, const std::string& name) if (!_HasRankRight(player, GR_RIGHT_REMOVE)) SendCommandResult(session, GUILD_INVITE_S, ERR_GUILD_PERMISSIONS); // Removed player must be a member of guild - else if (Member* pMember = GetMember(session, name)) + else if (Member* member = GetMember(session, name)) { // Leader cannot be removed - if (pMember->IsRank(GR_GUILDMASTER)) + if (member->IsRank(GR_GUILDMASTER)) SendCommandResult(session, GUILD_QUIT_S, ERR_GUILD_LEADER_LEAVE); // Do not allow to remove player with the same rank or higher - else if (pMember->IsRankNotLower(player->GetRank())) + else if (member->IsRankNotLower(player->GetRank())) SendCommandResult(session, GUILD_QUIT_S, ERR_GUILD_RANK_TOO_HIGH_S, name); else { - uint64 guid = pMember->GetGUID(); + uint64 guid = member->GetGUID(); // After call to DeleteMember pointer to member becomes invalid DeleteMember(guid, false, true); _LogEvent(GUILD_EVENT_LOG_UNINVITE_PLAYER, player->GetGUIDLow(), GUID_LOPART(guid)); @@ -1552,10 +1552,10 @@ void Guild::HandleUpdateMemberRank(WorldSession* session, const std::string& nam if (!_HasRankRight(player, demote ? GR_RIGHT_DEMOTE : GR_RIGHT_PROMOTE)) SendCommandResult(session, GUILD_INVITE_S, ERR_GUILD_PERMISSIONS); // Promoted player must be a member of guild - else if (Member* pMember = GetMember(session, name)) + else if (Member* member = GetMember(session, name)) { // Player cannot promote himself - if (pMember->IsSamePlayer(player->GetGUID())) + if (member->IsSamePlayer(player->GetGUID())) { SendCommandResult(session, GUILD_INVITE_S, ERR_GUILD_NAME_INVALID); return; @@ -1564,13 +1564,13 @@ void Guild::HandleUpdateMemberRank(WorldSession* session, const std::string& nam if (demote) { // Player can demote only lower rank members - if (pMember->IsRankNotLower(player->GetRank())) + if (member->IsRankNotLower(player->GetRank())) { SendCommandResult(session, GUILD_INVITE_S, ERR_GUILD_RANK_TOO_HIGH_S, name); return; } // Lowest rank cannot be demoted - if (pMember->GetRankId() >= _GetLowestRankId()) + if (member->GetRankId() >= _GetLowestRankId()) { SendCommandResult(session, GUILD_INVITE_S, ERR_GUILD_RANK_TOO_LOW_S, name); return; @@ -1579,8 +1579,8 @@ void Guild::HandleUpdateMemberRank(WorldSession* session, const std::string& nam else { // Allow to promote only to lower rank than member's rank - // pMember->GetRank() + 1 is the highest rank that current player can promote to - if (pMember->IsRankNotLower(player->GetRank() + 1)) + // member->GetRank() + 1 is the highest rank that current player can promote to + if (member->IsRankNotLower(player->GetRank() + 1)) { SendCommandResult(session, GUILD_INVITE_S, ERR_GUILD_RANK_TOO_HIGH_S, name); return; @@ -1588,9 +1588,9 @@ void Guild::HandleUpdateMemberRank(WorldSession* session, const std::string& nam } // When promoting player, rank is decreased, when demoting - increased - uint32 newRankId = pMember->GetRankId() + (demote ? 1 : -1); - pMember->ChangeRank(newRankId); - _LogEvent(demote ? GUILD_EVENT_LOG_DEMOTE_PLAYER : GUILD_EVENT_LOG_PROMOTE_PLAYER, player->GetGUIDLow(), GUID_LOPART(pMember->GetGUID()), newRankId); + uint32 newRankId = member->GetRankId() + (demote ? 1 : -1); + member->ChangeRank(newRankId); + _LogEvent(demote ? GUILD_EVENT_LOG_DEMOTE_PLAYER : GUILD_EVENT_LOG_PROMOTE_PLAYER, player->GetGUIDLow(), GUID_LOPART(member->GetGUID()), newRankId); _BroadcastEvent(demote ? GE_DEMOTION : GE_PROMOTION, 0, player->GetName(), name.c_str(), _GetRankName(newRankId).c_str()); } } @@ -1643,9 +1643,6 @@ void Guild::HandleRemoveLowestRank(WorldSession* session) void Guild::HandleMemberDepositMoney(WorldSession* session, uint32 amount) { - if (!_GetPurchasedTabsSize()) - return; // No guild bank tabs - no money in bank - Player* player = session->GetPlayer(); // Call script after validation and before money transfer. @@ -1676,9 +1673,6 @@ void Guild::HandleMemberDepositMoney(WorldSession* session, uint32 amount) bool Guild::HandleMemberWithdrawMoney(WorldSession* session, uint32 amount, bool repair) { - if (!_GetPurchasedTabsSize()) - return false; // No guild bank tabs - no money - if (m_bankMoney < amount) // Not enough money in bank return false; @@ -1699,8 +1693,8 @@ bool Guild::HandleMemberWithdrawMoney(WorldSession* session, uint32 amount, bool SQLTransaction trans = CharacterDatabase.BeginTransaction(); // Update remaining money amount if (remainingMoney < uint32(GUILD_WITHDRAW_MONEY_UNLIMITED)) - if (Member* pMember = GetMember(player->GetGUID())) - pMember->DecreaseBankRemainingValue(trans, GUILD_BANK_MAX_TABS, amount); + if (Member* member = GetMember(player->GetGUID())) + member->DecreaseBankRemainingValue(trans, GUILD_BANK_MAX_TABS, amount); // Remove money from bank _ModifyBankMoney(trans, amount, false); // Add money to player (if required) @@ -1726,10 +1720,10 @@ bool Guild::HandleMemberWithdrawMoney(WorldSession* session, uint32 amount, bool void Guild::HandleMemberLogout(WorldSession* session) { Player* player = session->GetPlayer(); - if (Member* pMember = GetMember(player->GetGUID())) + if (Member* member = GetMember(player->GetGUID())) { - pMember->SetStats(player); - pMember->UpdateLogoutTime(); + member->SetStats(player); + member->UpdateLogoutTime(); } _BroadcastEvent(GE_SIGNED_OFF, player->GetGUID(), player->GetName()); } @@ -1869,7 +1863,7 @@ bool Guild::LoadFromDB(Field* fields) m_createdDate = time_t(fields[10].GetUInt32()); m_bankMoney = fields[11].GetUInt64(); - uint8 purchasedTabs = uint8(fields[12].GetUInt32()); + uint8 purchasedTabs = uint8(fields[12].GetUInt64()); if (purchasedTabs > GUILD_BANK_MAX_TABS) purchasedTabs = GUILD_BANK_MAX_TABS; @@ -1893,14 +1887,14 @@ void Guild::LoadRankFromDB(Field* fields) bool Guild::LoadMemberFromDB(Field* fields) { uint32 lowguid = fields[1].GetUInt32(); - Member *pMember = new Member(m_id, MAKE_NEW_GUID(lowguid, 0, HIGHGUID_PLAYER), fields[2].GetUInt8()); - if (!pMember->LoadFromDB(fields)) + Member *member = new Member(m_id, MAKE_NEW_GUID(lowguid, 0, HIGHGUID_PLAYER), fields[2].GetUInt8()); + if (!member->LoadFromDB(fields)) { _DeleteMemberFromDB(lowguid); - delete pMember; + delete member; return false; } - m_members[lowguid] = pMember; + m_members[lowguid] = member; return true; } @@ -1971,7 +1965,7 @@ bool Guild::LoadBankEventLogFromDB(Field* fields) bool Guild::LoadBankTabFromDB(Field* fields) { - uint32 tabId = fields[1].GetUInt8(); + uint8 tabId = fields[1].GetUInt8(); if (tabId >= _GetPurchasedTabsSize()) { sLog->outError("Invalid tab (tabId: %u) in guild bank, skipped.", tabId); @@ -2112,9 +2106,9 @@ bool Guild::AddMember(uint64 guid, uint8 rankId) if (rankId == GUILD_RANK_NONE) rankId = _GetLowestRankId(); - Member* pMember = new Member(m_id, guid, rankId); + Member* member = new Member(m_id, guid, rankId); if (player) - pMember->SetStats(player); + member->SetStats(player); else { bool ok = false; @@ -2124,25 +2118,25 @@ bool Guild::AddMember(uint64 guid, uint8 rankId) if (PreparedQueryResult result = CharacterDatabase.Query(stmt)) { Field* fields = result->Fetch(); - pMember->SetStats( + member->SetStats( fields[0].GetString(), fields[1].GetUInt8(), fields[2].GetUInt8(), fields[3].GetUInt16(), fields[4].GetUInt32()); - ok = pMember->CheckStats(); + ok = member->CheckStats(); } if (!ok) { - delete pMember; + delete member; return false; } } - m_members[lowguid] = pMember; + m_members[lowguid] = member; SQLTransaction trans(NULL); - pMember->SaveToDB(trans); + member->SaveToDB(trans); // If player not in game data in will be loaded from guild tables, so no need to update it! if (player) { @@ -2199,8 +2193,8 @@ void Guild::DeleteMember(uint64 guid, bool isDisbanding, bool isKicked) // Call script on remove before member is acutally removed from guild (and database) sScriptMgr->OnGuildRemoveMember(this, player, isDisbanding, isKicked); - if (Member* pMember = GetMember(guid)) - delete pMember; + if (Member* member = GetMember(guid)) + delete member; m_members.erase(lowguid); // If player not online data in data field will be loaded from guild tabs no need to update it !! @@ -2218,9 +2212,9 @@ void Guild::DeleteMember(uint64 guid, bool isDisbanding, bool isKicked) bool Guild::ChangeMemberRank(uint64 guid, uint8 newRank) { if (newRank <= _GetLowestRankId()) // Validate rank (allow only existing ranks) - if (Member* pMember = GetMember(guid)) + if (Member* member = GetMember(guid)) { - pMember->ChangeRank(newRank); + member->ChangeRank(newRank); return true; } return false; @@ -2369,8 +2363,8 @@ bool Guild::_IsLeader(Player* player) const { if (player->GetGUID() == m_leaderGuid) return true; - if (const Member* pMember = GetMember(player->GetGUID())) - return pMember->IsRank(GR_GUILDMASTER); + if (const Member* member = GetMember(player->GetGUID())) + return member->IsRank(GR_GUILDMASTER); return false; } @@ -2483,15 +2477,15 @@ inline uint8 Guild::_GetRankBankTabRights(uint8 rankId, uint8 tabId) const inline uint32 Guild::_GetMemberRemainingSlots(uint64 guid, uint8 tabId) const { - if (const Member* pMember = GetMember(guid)) - return pMember->GetBankRemainingValue(tabId, this); + if (const Member* member = GetMember(guid)) + return member->GetBankRemainingValue(tabId, this); return 0; } inline uint32 Guild::_GetMemberRemainingMoney(uint64 guid) const { - if (const Member* pMember = GetMember(guid)) - return pMember->GetBankRemainingValue(GUILD_BANK_MAX_TABS, this); + if (const Member* member = GetMember(guid)) + return member->GetBankRemainingValue(GUILD_BANK_MAX_TABS, this); return 0; } @@ -2501,18 +2495,18 @@ inline void Guild::_DecreaseMemberRemainingSlots(SQLTransaction& trans, uint64 g if (uint32 remainingSlots = _GetMemberRemainingSlots(guid, tabId)) // Ignore guild master if (remainingSlots < uint32(GUILD_WITHDRAW_SLOT_UNLIMITED)) - if (Member* pMember = GetMember(guid)) - pMember->DecreaseBankRemainingValue(trans, tabId, 1); + if (Member* member = GetMember(guid)) + member->DecreaseBankRemainingValue(trans, tabId, 1); } inline bool Guild::_MemberHasTabRights(uint64 guid, uint8 tabId, uint32 rights) const { - if (const Member* pMember = GetMember(guid)) + if (const Member* member = GetMember(guid)) { // Leader always has full rights - if (pMember->IsRank(GR_GUILDMASTER) || m_leaderGuid == guid) + if (member->IsRank(GR_GUILDMASTER) || m_leaderGuid == guid) return true; - return (_GetRankBankTabRights(pMember->GetRankId(), tabId) & rights) == rights; + return (_GetRankBankTabRights(member->GetRankId(), tabId) & rights) == rights; } return false; } diff --git a/src/server/game/Guilds/GuildMgr.cpp b/src/server/game/Guilds/GuildMgr.cpp index 2a7a7f2ca8b..450a49e345c 100644 --- a/src/server/game/Guilds/GuildMgr.cpp +++ b/src/server/game/Guilds/GuildMgr.cpp @@ -232,7 +232,6 @@ void GuildMgr::LoadGuilds() // Delete orphaned guild bank right entries before loading the valid ones CharacterDatabase.DirectExecute("DELETE gbr FROM guild_bank_right gbr LEFT JOIN guild g ON gbr.guildId = g.guildId WHERE g.guildId IS NULL"); - // 0 1 2 3 4 QueryResult result = CharacterDatabase.Query("SELECT guildid, TabId, rid, gbright, SlotPerDay FROM guild_bank_right ORDER BY guildid ASC, TabId ASC"); diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index 929532b6362..27eb559fb68 100755 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.cpp @@ -241,6 +241,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) else AH->auctioneer = GUID_LOPART(auctioneer); + // Required stack size of auction matches to current item stack size, just move item to auctionhouse if (itemsCount == 1 && item->GetCount() == count[i]) { if (GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) @@ -278,7 +279,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CREATE_AUCTION, 1); return; } - else + else // Required stack size of auction does not match to current item stack size, clone item and set correct stack size { Item* newItem = item->CloneItem(finalCount, _player); if (!newItem) @@ -309,33 +310,35 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) sAuctionMgr->AddAItem(newItem); auctionHouse->AddAuction(AH); - for (uint32 i = 0; i < itemsCount; ++i) + for (uint32 j = 0; j < itemsCount; ++j) { - Item* item = items[i]; + Item* item2 = items[j]; - if (item->GetCount() == count[i]) + // Item stack count equals required count, ready to delete item - cloned item will be used for auction + if (item2->GetCount() == count[j]) { - _player->MoveItemFromInventory(item->GetBagSlot(), item->GetSlot(), true); + _player->MoveItemFromInventory(item2->GetBagSlot(), item2->GetSlot(), true); SQLTransaction trans = CharacterDatabase.BeginTransaction(); - item->DeleteFromInventoryDB(trans); - item->SaveToDB(trans); + item2->DeleteFromInventoryDB(trans); + item2->DeleteFromDB(trans); CharacterDatabase.CommitTransaction(trans); } - else + else // Item stack count is bigger than required count, update item stack count and save to database - cloned item will be used for auction { - item->SetCount(item->GetCount() - count[i]); - item->SetState(ITEM_CHANGED, _player); - _player->ItemRemovedQuestCheck(item->GetEntry(), count[i]); - item->SendUpdateToPlayer(_player); + item2->SetCount(item2->GetCount() - count[j]); + item2->SetState(ITEM_CHANGED, _player); + _player->ItemRemovedQuestCheck(item2->GetEntry(), count[j]); + item2->SendUpdateToPlayer(_player); SQLTransaction trans = CharacterDatabase.BeginTransaction(); - item->SaveToDB(trans); + item2->SaveToDB(trans); CharacterDatabase.CommitTransaction(trans); } } SQLTransaction trans = CharacterDatabase.BeginTransaction(); + newItem->SaveToDB(trans); AH->SaveToDB(trans); _player->SaveInventoryAndGoldToDB(trans); CharacterDatabase.CommitTransaction(trans); @@ -436,7 +439,11 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recv_data) auction->bid = price; GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID, price); - trans->PAppend("UPDATE auctionhouse SET buyguid = '%u', lastbid = '%u' WHERE id = '%u'", auction->bidder, auction->bid, auction->Id); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_AUCTION_BID); + stmt->setUInt32(0, auction->bidder); + stmt->setUInt32(1, auction->bid); + stmt->setUInt32(2, auction->Id); + trans->Append(stmt); SendAuctionCommandResult(auction->Id, AUCTION_PLACE_BID, AUCTION_OK, 0); } diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp index 00f18217eed..41188e1134e 100755 --- a/src/server/game/Handlers/BattleGroundHandler.cpp +++ b/src/server/game/Handlers/BattleGroundHandler.cpp @@ -60,10 +60,10 @@ void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket & recv_data) return; } - SendBattlegGroundList(guid, bgTypeId); + SendBattleGroundList(guid, bgTypeId); } -void WorldSession::SendBattlegGroundList(uint64 guid, BattlegroundTypeId bgTypeId) +void WorldSession::SendBattleGroundList(uint64 guid, BattlegroundTypeId bgTypeId) { WorldPacket data; sBattlegroundMgr->BuildBattlegroundListPacket(&data, guid, _player, bgTypeId); @@ -216,7 +216,8 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data) for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* member = itr->getSource(); - if (!member) continue; // this should never happen + if (!member) + continue; // this should never happen WorldPacket data; diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp index 820079a90e1..298c742fc3a 100755 --- a/src/server/game/Handlers/CalendarHandler.cpp +++ b/src/server/game/Handlers/CalendarHandler.cpp @@ -16,6 +16,22 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* +----- Opcodes Not Used yet ----- + +SMSG_CALENDAR_CLEAR_PENDING_ACTION SendCalendarClearPendingAction() +SMSG_CALENDAR_RAID_LOCKOUT_UPDATED SendCalendarRaidLockoutUpdated(InstanceSave const* save) + +----- Opcodes without Sniffs ----- +SMSG_CALENDAR_FILTER_GUILD [ for (... uint32(count) { packguid(???), uint8(???) } ] +SMSG_CALENDAR_ARENA_TEAM [ for (... uint32(count) { packguid(???), uint8(???) } ] +CMSG_CALENDAR_EVENT_INVITE_NOTES [ packguid(Invitee), uint64(inviteId), string(Text), Boolean(Unk) ] +SMSG_CALENDAR_EVENT_INVITE_NOTES [ uint32(unk1), uint32(unk2), uint32(unk3), uint32(unk4), uint32(unk5) ] +SMSG_CALENDAR_EVENT_INVITE_NOTES_ALERT [ uint64(inviteId), string(Text) ] +SMSG_CALENDAR_EVENT_INVITE_STATUS_ALERT [ Structure unkown ] + +*/ + #include "Common.h" #include "WorldPacket.h" #include "WorldSession.h" @@ -24,8 +40,12 @@ #include "Log.h" #include "Opcodes.h" #include "Player.h" +#include "CalendarMgr.h" +#include "ObjectMgr.h" +#include "ObjectAccessor.h" +#include "DatabaseEnv.h" -void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recv_data*/) +void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/) { uint64 guid = _player->GetGUID(); sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GET_CALENDAR [" UI64FMTD "]", guid); @@ -33,32 +53,62 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recv_data*/) time_t cur_time = time_t(time(NULL)); sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_SEND_CALENDAR [" UI64FMTD "]", guid); - WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR, 4+4*0+4+4*0+4+4); + WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR, 1000); // Impossible to get the correct size without doing a double iteration of some elements - data << uint32(0); // invite count - /* - for (;;) + CalendarInviteIdList const& invites = sCalendarMgr->GetPlayerInvites(guid); + data << uint32(invites.size()); + for (CalendarInviteIdList::const_iterator it = invites.begin(); it != invites.end(); ++it) { - uint64 inviteId; - uint64 unkGuid0; - uint8 unk1, unk2, unk3; - uint64 creatorGuid; + CalendarInvite* invite = sCalendarMgr->GetInvite(*it); + CalendarEvent* calendarEvent = invite ? sCalendarMgr->GetEvent(invite->GetEventId()) : NULL; + + if (calendarEvent) + { + data << uint64(invite->GetEventId()); + data << uint64(invite->GetInviteId()); + data << uint8(invite->GetStatus()); + data << uint8(invite->GetRank()); + data << uint8(calendarEvent->GetGuildId() != 0); + data.appendPackGUID(calendarEvent->GetCreatorGUID()); + } + else + { + sLog->outError("SMSG_CALENDAR_SEND_CALENDAR: No Invite found with id [" UI64FMTD "]", *it); + data << uint64(0); + data << uint64(0); + data << uint8(0); + data << uint8(0); + data << uint8(0); + data.appendPackGUID(0); + } } - */ - data << uint32(0); // event count - /* - for (;;) + CalendarEventIdList const& events = sCalendarMgr->GetPlayerEvents(guid); + data << uint32(events.size()); + for (CalendarEventIdList::const_iterator it = events.begin(); it != events.end(); ++it) { - uint64 eventId; - std::string title; // 128 chars - uint32 type; - uint32 occurrenceTime; - uint32 flags; - uint32 unk4; -- possibly mapid for dungeon/raid - uint64 creatorGuid; + if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(*it)) + { + data << uint64(*it); + data << calendarEvent->GetTitle().c_str(); + data << uint32(calendarEvent->GetType()); + data << uint32(calendarEvent->GetTime()); + data << uint32(calendarEvent->GetFlags()); + data << uint32(calendarEvent->GetDungeonId()); + data.appendPackGUID(calendarEvent->GetCreatorGUID()); + } + else + { + sLog->outError("SMSG_CALENDAR_SEND_CALENDAR: No Event found with id [" UI64FMTD "]", *it); + data << uint64(0); + data << uint8(0); + data << uint32(0); + data << uint32(0); + data << uint32(0); + data << uint32(0); + data.appendPackGUID(0); + } } - */ data << uint32(cur_time); // server time data << uint32(secsToTimeBitFields(cur_time)); // server time @@ -108,202 +158,751 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recv_data*/) data << uint32(mapEntry->unk_time); ++counter; } - data.put<uint32>(p_counter, counter); - data << uint32(0); // holiday count? - /* - for (;;) + // TODO: Fix this, how we do know how many and what holidays to send? + uint32 holidayCount = 0; + data << uint32(holidayCount); + for (uint32 i = 0; i < holidayCount; ++i) { - uint32 unk5, unk6, unk7, unk8, unk9; - for (uint32 j = 0; j < 26; ++j) - { - uint32 unk10; - } - for (uint32 j = 0; j < 10; ++j) + HolidaysEntry const* holiday = sHolidaysStore.LookupEntry(666); + + data << uint32(holiday->Id); // m_ID + data << uint32(holiday->Region); // m_region, might be looping + data << uint32(holiday->Looping); // m_looping, might be region + data << uint32(holiday->Priority); // m_priority + data << uint32(holiday->CalendarFilterType); // m_calendarFilterType + + for (uint8 j = 0; j < MAX_HOLIDAY_DATES; ++j) + data << uint32(holiday->Date[j]); // 26 * m_date + + for (uint8 j = 0; j < MAX_HOLIDAY_DURATIONS; ++j) + data << uint32(holiday->Duration[j]); // 10 * m_duration + + for (uint8 j = 0; j < MAX_HOLIDAY_FLAGS; ++j) + data << uint32(holiday->CalendarFlags[j]); // 10 * m_calendarFlags + + data << holiday->TextureFilename; // m_textureFilename (holiday name) + } + + SendPacket(&data); +} + +void WorldSession::HandleCalendarGetEvent(WorldPacket& recvData) +{ + uint64 eventId; + recvData >> eventId; + + sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GET_EVENT. Event: [" + UI64FMTD "] Event [" UI64FMTD "]", _player->GetGUID(), eventId); + + if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId)) + SendCalendarEvent(*calendarEvent, CALENDAR_SENDTYPE_GET); +} + +void WorldSession::HandleCalendarGuildFilter(WorldPacket& recvData) +{ + sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GUILD_FILTER [" UI64FMTD "]", _player->GetGUID()); + + int32 unk1, unk2, unk3; + recvData >> unk1; + recvData >> unk2; + recvData >> unk3; + + sLog->outDebug(LOG_FILTER_NETWORKIO, "Calendar: CMSG_CALENDAR_GUILD_FILTER - unk1: %d unk2: %d unk3: %d", unk1, unk2, unk3); +} + +void WorldSession::HandleCalendarArenaTeam(WorldPacket& recvData) +{ + sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_ARENA_TEAM [" UI64FMTD "]", _player->GetGUID()); + + int32 unk1; + recvData >> unk1; + + sLog->outDebug(LOG_FILTER_NETWORKIO, "Calendar: CMSG_CALENDAR_ARENA_TEAM - unk1: %d", unk1); +} + +void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData) +{ + uint64 guid = _player->GetGUID(); + std::string title; + std::string description; + uint8 type; + bool repeatable; + uint32 maxInvites; + int32 dungeonId; + uint32 eventPackedTime; + uint32 unkPackedTime; + uint32 flags; + uint64 inviteId = 0; + uint64 invitee = 0; + uint8 status; + uint8 rank; + + recvData >> title >> description >> type >> repeatable >> maxInvites; + recvData >> dungeonId >> eventPackedTime >> unkPackedTime >> flags; + + if (!(flags & CALENDAR_FLAG_WITHOUT_INVITES)) + { + uint32 inviteCount; + recvData >> inviteCount; + recvData.readPackGUID(invitee); + recvData >> status >> rank; + + if (inviteCount != 1 || invitee != guid) { - uint32 unk11; + sLog->outError("HandleCalendarAddEvent: [" UI64FMTD + "]: More than one invite (%d) or Invitee [" UI64FMTD + "] differs", guid, inviteCount, invitee); + return; } - for (uint32 j = 0; j < 10; ++j) + + inviteId = sCalendarMgr->GetFreeInviteId(); + } + else + { + inviteId = 0; + status = CALENDAR_STATUS_NO_OWNER; + rank = CALENDAR_RANK_PLAYER; + } + + sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_ADD_EVENT: [" UI64FMTD "] " + "Title %s, Description %s, type %u, Repeatable %u, MaxInvites %u, " + "Dungeon ID %d, Time %u, Time2 %u, Flags %u, Invitee [" UI64FMTD "] " + "Status %d, Rank %d", guid, title.c_str(), description.c_str(), + type, repeatable, maxInvites, dungeonId, eventPackedTime, + unkPackedTime, flags, invitee, status, rank); + + CalendarAction action; + + action.SetAction(CALENDAR_ACTION_ADD_EVENT); + action.SetPlayer(_player); + action.Event.SetEventId(sCalendarMgr->GetFreeEventId()); + action.Event.SetCreatorGUID(guid); + action.Event.SetType((CalendarEventType) type); + action.Event.SetFlags(flags); + action.Event.SetTime(eventPackedTime); + action.Event.SetTimeZoneTime(unkPackedTime); + action.Event.SetRepeatable(repeatable); + action.Event.SetMaxInvites(maxInvites); + action.Event.SetDungeonId(dungeonId); + action.Event.SetGuildId((flags & CALENDAR_FLAG_GUILD_ONLY) ? GetPlayer()->GetGuildId() : 0); + action.Event.SetTitle(title); + action.Event.SetDescription(description); + action.Event.AddInvite(inviteId); + action.Invite.SetEventId(action.Event.GetEventId()); + action.Invite.SetInviteId(inviteId); + action.Invite.SetInvitee(invitee); + action.Invite.SetStatus((CalendarInviteStatus) status); + action.Invite.SetRank((CalendarModerationRank) rank); + action.Invite.SetSenderGUID(guid); + + sCalendarMgr->AddAction(action); +} + +void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData) +{ + uint64 guid = _player->GetGUID(); + uint64 eventId; + uint64 inviteId; + std::string title; + std::string description; + uint8 type; + bool repeatable; + uint32 maxInvites; + int32 dungeonId; + uint32 eventPackedTime; + uint32 timeZoneTime; + uint32 flags; + + recvData >> eventId >> inviteId >> title >> description >> type; + recvData >> repeatable >> maxInvites >> dungeonId; + recvData >> eventPackedTime >> timeZoneTime >> flags; + + sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_UPDATE_EVENT [" UI64FMTD "] EventId [" UI64FMTD + "], InviteId [" UI64FMTD "] Title %s, Description %s, type %u " + "Repeatable %u, MaxInvites %u, Dungeon ID %d, Time %u " + "Time2 %u, Flags %u", guid, eventId, inviteId, title.c_str(), + description.c_str(), type, repeatable, maxInvites, dungeonId, + eventPackedTime, timeZoneTime, flags); + + CalendarAction action; + action.SetAction(CALENDAR_ACTION_MODIFY_EVENT); + action.SetPlayer(_player); + action.SetInviteId(inviteId); + action.Event.SetEventId(eventId); + action.Event.SetType((CalendarEventType) type); + action.Event.SetFlags((CalendarFlags) flags); + action.Event.SetTime(eventPackedTime); + action.Event.SetTimeZoneTime(timeZoneTime); + action.Event.SetRepeatable(repeatable); + action.Event.SetDungeonId(dungeonId); + action.Event.SetTitle(title); + action.Event.SetDescription(description); + action.Event.SetMaxInvites(maxInvites); + + sCalendarMgr->AddAction(action); +} + +void WorldSession::HandleCalendarRemoveEvent(WorldPacket& recvData) +{ + uint64 guid = _player->GetGUID(); + uint64 eventId; + uint64 inviteId; + uint32 flags; + + recvData >> eventId >> inviteId >> flags; + sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_REMOVE_EVENT [" UI64FMTD "], EventId [" UI64FMTD + "] inviteId [" UI64FMTD "] Flags?: %u", guid, eventId, inviteId, flags); + + CalendarAction action; + action.SetAction(CALENDAR_ACTION_REMOVE_EVENT); + action.SetPlayer(_player); + action.SetInviteId(inviteId); + action.Event.SetEventId(eventId); + action.Event.SetFlags((CalendarFlags) flags); + + sCalendarMgr->AddAction(action); +} + +void WorldSession::HandleCalendarCopyEvent(WorldPacket& recvData) +{ + uint64 guid = _player->GetGUID(); + uint64 eventId; + uint64 inviteId; + uint32 time; + + recvData >> eventId >> inviteId >> time; + sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_COPY_EVENT [" UI64FMTD "], EventId [" UI64FMTD + "] inviteId [" UI64FMTD "] Time: %u", guid, eventId, inviteId, time); + + CalendarAction action; + action.SetAction(CALENDAR_ACTION_COPY_EVENT); + action.SetPlayer(_player); + action.SetInviteId(inviteId); + action.Event.SetEventId(eventId); + action.Event.SetTime(time); + + sCalendarMgr->AddAction(action); +} + +void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData) +{ + uint64 guid = _player->GetGUID(); + uint64 eventId; + uint64 inviteId; + std::string name; + uint8 status; + uint8 rank; + uint64 invitee = 0; + uint32 team = 0; + + recvData >> eventId >> inviteId >> name >> status >> rank; + if (Player* player = sObjectAccessor->FindPlayerByName(name.c_str())) + { + invitee = player->GetGUID(); + team = player->GetTeam(); + } + else + { + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_RACE_ACC_BY_NAME); + stmt->setString(0, name); + if (PreparedQueryResult result = CharacterDatabase.Query(stmt)) { - uint32 unk12; + Field* fields = result->Fetch(); + invitee = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER); + team = Player::TeamForRace(fields[1].GetUInt8()); } - std::string holidayName; // 64 chars } - */ - SendPacket(&data); + sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_INVITE [" UI64FMTD "], EventId [" + UI64FMTD "] InviteId [" UI64FMTD "] Name %s ([" UI64FMTD "]), status %u, " + "Rank %u", guid, eventId, inviteId, name.c_str(), invitee, status, rank); + + if (!invitee) + { + SendCalendarCommandResult(CALENDAR_ERROR_PLAYER_NOT_FOUND); + return; + } + + if (_player->GetTeam() != team) + { + SendCalendarCommandResult(CALENDAR_ERROR_NOT_ALLIED); + return; + } + + // TODO: Check ignore, even if offline (db query) + + CalendarAction action; + action.SetAction(CALENDAR_ACTION_ADD_EVENT_INVITE); + action.SetPlayer(_player); + action.SetInviteId(inviteId); + action.Invite.SetEventId(eventId); + action.Invite.SetInviteId(sCalendarMgr->GetFreeInviteId()); + action.Invite.SetSenderGUID(_player->GetGUID()); + action.Invite.SetInvitee(invitee); + action.Invite.SetRank((CalendarModerationRank) rank); + action.Invite.SetStatus((CalendarInviteStatus) status); + + sCalendarMgr->AddAction(action); } -void WorldSession::HandleCalendarGetEvent(WorldPacket& recv_data) +void WorldSession::HandleCalendarEventSignup(WorldPacket& recvData) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_GET_EVENT"); - recv_data.read_skip<uint64>(); // unk + uint64 guid = _player->GetGUID(); + uint64 eventId; + uint8 status; + + recvData >> eventId >> status; + sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_SIGNUP [" UI64FMTD "] EventId [" + UI64FMTD "] Status %u", guid, eventId, status); + + CalendarAction action; + action.SetAction(CALENDAR_ACTION_SIGNUP_TO_EVENT); + action.SetPlayer(_player); + action.SetExtraData(GetPlayer()->GetGuildId()); + action.Event.SetEventId(eventId); + action.Invite.SetStatus((CalendarInviteStatus) status); + sCalendarMgr->AddAction(action); } -void WorldSession::HandleCalendarGuildFilter(WorldPacket& recv_data) +void WorldSession::HandleCalendarEventRsvp(WorldPacket& recvData) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_GUILD_FILTER"); - recv_data.read_skip<uint32>(); // unk1 - recv_data.read_skip<uint32>(); // unk2 - recv_data.read_skip<uint32>(); // unk3 + uint64 guid = _player->GetGUID(); + uint64 eventId; + uint64 inviteId; + uint8 status; + + recvData >> eventId >> inviteId >> status; + sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_RSVP [" UI64FMTD"] EventId [" + UI64FMTD "], InviteId [" UI64FMTD "], status %u", guid, eventId, + inviteId, status); + + CalendarAction action; + action.SetAction(CALENDAR_ACTION_MODIFY_EVENT_INVITE); + action.SetPlayer(_player); + action.SetInviteId(inviteId); + action.Invite.SetInviteId(inviteId); + action.Invite.SetEventId(eventId); + action.Invite.SetStatus((CalendarInviteStatus) status); + + sCalendarMgr->AddAction(action); } -void WorldSession::HandleCalendarArenaTeam(WorldPacket& recv_data) +void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket& recvData) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_ARENA_TEAM"); - recv_data.read_skip<uint32>(); // unk + uint64 guid = _player->GetGUID(); + uint64 invitee; + uint64 eventId; + uint64 owninviteId; + uint64 inviteId; + + recvData.readPackGUID(invitee); + recvData >> inviteId >> owninviteId >> eventId; + + sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_REMOVE_INVITE [" + UI64FMTD "] EventId [" UI64FMTD "], OwnInviteId [" + UI64FMTD "], Invitee ([" UI64FMTD "] id: [" UI64FMTD "])", + guid, eventId, owninviteId, invitee, inviteId); + + CalendarAction action; + action.SetAction(CALENDAR_ACTION_REMOVE_EVENT_INVITE); + action.SetPlayer(_player); + action.SetInviteId(owninviteId); + action.Invite.SetInviteId(inviteId); + action.Invite.SetEventId(eventId); + action.Invite.SetInvitee(invitee); + + sCalendarMgr->AddAction(action); } -void WorldSession::HandleCalendarAddEvent(WorldPacket& recv_data) +void WorldSession::HandleCalendarEventStatus(WorldPacket& recvData) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_ADD_EVENT"); - recv_data.rfinish(); // set to end to avoid warnings spam - - //std::string unk1, unk2; - //recv_data >> (std::string)unk1; - //recv_data >> (std::string)unk2; - - //uint8 unk3, unk4; - //uint32 unk5, unk6, unk7, unk8, unk9, count = 0; - //recv_data >> (uint8)unk3; - //recv_data >> (uint8)unk4; - //recv_data >> (uint32)unk5; - //recv_data >> (uint32)unk6; - //recv_data >> (uint32)unk7; - //recv_data >> (uint32)unk8; - //recv_data >> (uint32)unk9; - //if (!((unk9 >> 6) & 1)) - //{ - // recv_data >> (uint32)count; - // if (count) - // { - // uint8 unk12, unk13; - // uint64 guid; - // for (int i=0; i<count; i++) - // { - // recv_data.readPackGUID(guid); - // recv_data >> (uint8)unk12; - // recv_data >> (uint8)unk13; - // } - // } - //} + uint64 guid = _player->GetGUID(); + uint64 invitee; + uint64 eventId; + uint64 inviteId; + uint64 owninviteId; + uint8 status; + + recvData.readPackGUID(invitee); + recvData >> eventId >> inviteId >> owninviteId >> status; + sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_STATUS [" UI64FMTD"] EventId [" + UI64FMTD "] OwnInviteId [" UI64FMTD "], Invitee ([" UI64FMTD "] id: [" + UI64FMTD "], status %u", guid, eventId, owninviteId, invitee, inviteId, status); + + CalendarAction action; + action.SetAction(CALENDAR_ACTION_MODIFY_EVENT_INVITE); + action.SetPlayer(_player); + action.SetInviteId(owninviteId); + action.Invite.SetInviteId(inviteId); + action.Invite.SetEventId(eventId); + action.Invite.SetInvitee(invitee); + action.Invite.SetStatus((CalendarInviteStatus) status); + + sCalendarMgr->AddAction(action); } -void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recv_data) +void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recvData) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_UPDATE_EVENT"); - recv_data.rfinish(); // set to end to avoid warnings spam - - //recv_data >> uint64 - //recv_data >> uint64 - //recv_data >> std::string - //recv_data >> std::string - //recv_data >> uint8 - //recv_data >> uint8 - //recv_data >> uint32 - //recv_data >> uint32 - //recv_data >> uint32 - //recv_data >> uint32 - //recv_data >> uint32 + uint64 guid = _player->GetGUID(); + uint64 invitee; + uint64 eventId; + uint64 inviteId; + uint64 owninviteId; + uint8 status; + + recvData.readPackGUID(invitee); + recvData >> eventId >> inviteId >> owninviteId >> status; + sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_MODERATOR_STATUS [" UI64FMTD "] EventId [" + UI64FMTD "] OwnInviteId [" UI64FMTD "], Invitee ([" UI64FMTD "] id: [" + UI64FMTD "], status %u", guid, eventId, owninviteId, invitee, inviteId, status); + + CalendarAction action; + action.SetAction(CALENDAR_ACTION_MODIFY_MODERATOR_EVENT_INVITE); + action.SetPlayer(_player); + action.SetInviteId(owninviteId); + action.Invite.SetInviteId(inviteId); + action.Invite.SetEventId(eventId); + action.Invite.SetInvitee(invitee); + action.Invite.SetStatus((CalendarInviteStatus) status); + + sCalendarMgr->AddAction(action); } -void WorldSession::HandleCalendarRemoveEvent(WorldPacket& recv_data) +void WorldSession::HandleCalendarComplain(WorldPacket& recvData) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_REMOVE_EVENT"); - recv_data.rfinish(); // set to end to avoid warnings spam + uint64 guid = _player->GetGUID(); + uint64 eventId; + uint64 complainGUID; + + recvData >> eventId >> complainGUID; + sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_COMPLAIN [" UI64FMTD "] EventId [" + UI64FMTD "] guid [" UI64FMTD "]", guid, eventId, complainGUID); +} + +void WorldSession::HandleCalendarGetNumPending(WorldPacket& /*recvData*/) +{ + uint64 guid = _player->GetGUID(); + uint32 pending = sCalendarMgr->GetPlayerNumPending(guid); + + sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GET_NUM_PENDING: [" UI64FMTD + "] Pending: %u", guid, pending); + + WorldPacket data(SMSG_CALENDAR_SEND_NUM_PENDING, 4); + data << uint32(pending); + SendPacket(&data); +} + +// ----------------------------------- SEND ------------------------------------ - //recv_data >> uint64 - //recv_data >> uint64 - //recv_data >> uint32 +void WorldSession::SendCalendarEvent(CalendarEvent const& calendarEvent, CalendarSendEventType sendEventType) +{ + uint64 eventId = calendarEvent.GetEventId(); + + sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_SEND_EVENT [" UI64FMTD "] EventId [" + UI64FMTD "] SendType %u", _player->GetGUID(), eventId, sendEventType); + + WorldPacket data(SMSG_CALENDAR_SEND_EVENT); + data << uint8(sendEventType); + data.appendPackGUID(calendarEvent.GetCreatorGUID()); + data << uint64(eventId); + data << calendarEvent.GetTitle().c_str(); + data << calendarEvent.GetDescription().c_str(); + data << uint8(calendarEvent.GetType()); + data << uint8(calendarEvent.GetRepeatable()); + data << uint32(calendarEvent.GetMaxInvites()); + data << int32(calendarEvent.GetDungeonId()); + data << uint32(calendarEvent.GetFlags()); + data << uint32(calendarEvent.GetTime()); + data << uint32(calendarEvent.GetTimeZoneTime()); + data << uint32(calendarEvent.GetGuildId()); + + CalendarInviteIdList const& invites = calendarEvent.GetInviteIdList(); + data << uint32(invites.size()); + for (CalendarInviteIdList::const_iterator it = invites.begin(); it != invites.end(); ++it) + { + if (CalendarInvite* invite = sCalendarMgr->GetInvite(*it)) + { + uint64 guid = invite->GetInvitee(); + Player* player = ObjectAccessor::FindPlayer(guid); + uint8 level = player ? player->getLevel() : Player::GetLevelFromDB(guid); + + data.appendPackGUID(guid); + data << uint8(level); + data << uint8(invite->GetStatus()); + data << uint8(invite->GetRank()); + data << uint8(calendarEvent.GetGuildId() != 0); + data << uint64(invite->GetInviteId()); + data << uint32(invite->GetStatusTime()); + data << invite->GetText().c_str(); + } + else + { + data.appendPackGUID(_player->GetGUID()); + data << uint8(0) << uint8(0) << uint8(0) << uint8(0) + << uint64(0) << uint32(0) << uint8(0); + sLog->outError("SendCalendarEvent: No Invite found with id [" UI64FMTD "]", *it); + } + } + SendPacket(&data); } -void WorldSession::HandleCalendarCopyEvent(WorldPacket& recv_data) +void WorldSession::SendCalendarEventInvite(CalendarInvite const& invite, bool pending) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_COPY_EVENT"); - recv_data.rfinish(); // set to end to avoid warnings spam + uint64 guid = _player->GetGUID(); + uint64 eventId = invite.GetEventId(); + uint64 inviteId = invite.GetInviteId(); + uint64 invitee = invite.GetInvitee(); + uint8 status = invite.GetStatus(); + uint32 statusTime = invite.GetStatusTime(); + Player* player = ObjectAccessor::FindPlayer(invitee); + uint8 level = player ? player->getLevel() : Player::GetLevelFromDB(invitee); + + sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_EVENT_INVITE [" UI64FMTD "] EventId [" + UI64FMTD "] InviteId [" UI64FMTD "] Invitee [" UI64FMTD "] " + " Level %u, Status %u, StatusTime %u" , guid, eventId, inviteId, + invitee, level, status, statusTime); + + WorldPacket data(SMSG_CALENDAR_EVENT_INVITE, 8 + 8 + 8 + 1 + 1 + 1 + (statusTime ? 4 : 0) + 1); + data.appendPackGUID(invitee); + data << uint64(eventId); + data << uint64(inviteId); + data << uint8(level); + data << uint8(status); + if (statusTime) + data << uint8(1) << uint32(statusTime); + else + data << uint8(0); + data << uint8(pending); - //recv_data >> uint64 - //recv_data >> uint64 - //recv_data >> uint32 + SendPacket(&data); +} +void WorldSession::SendCalendarEventInviteAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite) +{ + uint64 guid = _player->GetGUID(); + uint64 eventId = calendarEvent.GetEventId(); + uint64 inviteId = invite.GetInviteId(); + + sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_EVENT_INVITE_ALERT [" UI64FMTD "] EventId [" + UI64FMTD "] InviteId [" UI64FMTD "]", guid, eventId, inviteId); + + WorldPacket data(SMSG_CALENDAR_EVENT_INVITE_ALERT); + data << uint64(eventId); + data << calendarEvent.GetTitle().c_str(); + data << uint32(calendarEvent.GetTime()); + data << uint32(calendarEvent.GetFlags()); + data << uint32(calendarEvent.GetType()); + data << uint32(calendarEvent.GetDungeonId()); + data << uint64(inviteId); + data << uint8(invite.GetStatus()); + data << uint8(invite.GetRank()); + data.appendPackGUID(calendarEvent.GetCreatorGUID()); + data.appendPackGUID(invite.GetSenderGUID()); + SendPacket(&data); +} + +void WorldSession::SendCalendarEventUpdateAlert(CalendarEvent const& calendarEvent, CalendarSendEventType sendEventType) +{ + uint64 guid = _player->GetGUID(); + uint64 eventId = calendarEvent.GetEventId(); + + sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_EVENT_UPDATED_ALERT [" + UI64FMTD "] EventId [" UI64FMTD "]", guid, eventId); + + + WorldPacket data(SMSG_CALENDAR_EVENT_UPDATED_ALERT, 1 + 8 + 4 + 4 + 4 + 1 + 4 + + calendarEvent.GetTitle().size() + calendarEvent.GetDescription().size() + 1 + 4 + 4); + data << uint8(sendEventType); + data << uint64(eventId); + data << uint32(calendarEvent.GetTime()); + data << uint32(calendarEvent.GetFlags()); + data << uint32(calendarEvent.GetTime()); + data << uint8(calendarEvent.GetType()); + data << uint32(calendarEvent.GetDungeonId()); + data << calendarEvent.GetTitle().c_str(); + data << calendarEvent.GetDescription().c_str(); + data << uint8(calendarEvent.GetRepeatable()); + data << uint32(calendarEvent.GetMaxInvites()); + data << uint32(0); // FIXME + SendPacket(&data); } -void WorldSession::HandleCalendarEventInvite(WorldPacket& recv_data) +void WorldSession::SendCalendarEventRemovedAlert(CalendarEvent const& calendarEvent) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_INVITE"); - recv_data.rfinish(); // set to end to avoid warnings spam + uint64 guid = _player->GetGUID(); + uint64 eventId = calendarEvent.GetEventId(); + uint32 eventTime = (calendarEvent.GetTime()); - //recv_data >> uint64 - //recv_data >> uint64 - //recv_data >> std::string - //recv_data >> uint8 - //recv_data >> uint8 + sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_EVENT_REMOVED_ALERT [" UI64FMTD "] EventId [" + UI64FMTD "] Time %u", guid, eventId, eventTime); + + WorldPacket data(SMSG_CALENDAR_EVENT_REMOVED_ALERT, 1 + 8 + 1); + data << uint8(1); // FIXME: If true does not SignalEvent(EVENT_CALENDAR_ACTION_PENDING) + data << uint64(eventId); + data << uint32(eventTime); + SendPacket(&data); +} +void WorldSession::SendCalendarEventStatus(CalendarEvent const& calendarEvent, CalendarInvite const& invite) +{ + uint64 guid = _player->GetGUID(); + uint64 eventId = calendarEvent.GetEventId(); + uint64 inviteId = invite.GetInviteId(); + uint64 invitee = invite.GetInvitee(); + uint32 eventTime = (calendarEvent.GetTime()); + uint32 flags = calendarEvent.GetFlags(); + uint8 status = invite.GetStatus(); + uint8 rank = invite.GetRank(); + uint32 statusTime = secsToTimeBitFields(invite.GetStatusTime()); + + + sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_EVENT_STATUS [" UI64FMTD "] EventId [" + UI64FMTD "] InviteId [" UI64FMTD "] Invitee [" UI64FMTD "] Time %u " + "Flags %u, Status %u, Rank %u, StatusTime %u", + guid, eventId, inviteId, invitee, eventTime, flags, status, rank, + statusTime); + + WorldPacket data(SMSG_CALENDAR_EVENT_STATUS, 8 + 8 + 4 + 4 + 1 + 1 + 4); + data.appendPackGUID(invitee); + data << uint64(eventId); + data << uint32(eventTime); + data << uint32(flags); + data << uint8(status); + data << uint8(rank); + data << uint32(statusTime); + SendPacket(&data); } -void WorldSession::HandleCalendarEventRsvp(WorldPacket& recv_data) +void WorldSession::SendCalendarEventModeratorStatusAlert(CalendarInvite const& invite) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_RSVP"); - recv_data.rfinish(); // set to end to avoid warnings spam + uint64 guid = _player->GetGUID(); + uint64 eventId = invite.GetEventId(); + uint64 invitee = invite.GetInvitee(); + uint8 status = invite.GetStatus(); - //recv_data >> uint64 - //recv_data >> uint64 - //recv_data >> uint32 + sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_EVENT_MODERATOR_STATUS_ALERT [" UI64FMTD + "] Invitee [" UI64FMTD "] EventId [" UI64FMTD "] Status %u ", guid, + invitee, eventId, status); + + + WorldPacket data(SMSG_CALENDAR_EVENT_MODERATOR_STATUS_ALERT, 8 + 8 + 1 + 1); + data.appendPackGUID(invitee); + data << uint64(eventId); + data << uint8(status); + data << uint8(1); // FIXME + SendPacket(&data); } -void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket& recv_data) +void WorldSession::SendCalendarEventInviteRemoveAlert(CalendarEvent const& calendarEvent, CalendarInviteStatus status) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_REMOVE_INVITE"); - recv_data.rfinish(); // set to end to avoid warnings spam + uint64 guid = _player->GetGUID(); + uint64 eventId = calendarEvent.GetEventId(); + uint32 eventTime = (calendarEvent.GetTime()); + uint32 flags = calendarEvent.GetFlags(); + + sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_EVENT_INVITE_REMOVED_ALERT [" + UI64FMTD "] EventId [" UI64FMTD "] Time %u, Flags %u, Status %u", + guid, eventId, eventTime, flags, status); + + WorldPacket data(SMSG_CALENDAR_EVENT_INVITE_REMOVED_ALERT, 8 + 4 + 4 + 1); + data << uint64(eventId); + data << uint32(eventTime); + data << uint32(flags); + data << uint8(status); + SendPacket(&data); +} - //recv_data.readPackGUID(guid) - //recv_data >> uint64 - //recv_data >> uint64 - //recv_data >> uint64 +void WorldSession::SendCalendarEventInviteRemove(CalendarInvite const& invite, uint32 flags) +{ + uint64 guid = _player->GetGUID(); + uint64 eventId = invite.GetEventId(); + uint64 invitee = invite.GetInvitee(); + + sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_EVENT_INVITE_REMOVED [" + UI64FMTD "] Invitee [" UI64FMTD "] EventId [" UI64FMTD + "] Flags %u", guid, invitee, eventId, flags); + + WorldPacket data(SMSG_CALENDAR_EVENT_INVITE_REMOVED, 8 + 4 + 4 + 1); + data.appendPackGUID(invitee); + data << uint32(eventId); + data << uint32(flags); + data << uint8(1); // FIXME + SendPacket(&data); } -void WorldSession::HandleCalendarEventStatus(WorldPacket& recv_data) +void WorldSession::SendCalendarClearPendingAction() { - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_STATUS"); - recv_data.rfinish(); // set to end to avoid warnings spam - - //recv_data.readPackGUID(guid) - //recv_data >> uint64 - //recv_data >> uint64 - //recv_data >> uint64 - //recv_data >> uint32 + uint64 guid = _player->GetGUID(); + sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_CLEAR_PENDING_ACTION [" UI64FMTD "]", guid); + + WorldPacket data(SMSG_CALENDAR_CLEAR_PENDING_ACTION, 0); + SendPacket(&data); } -void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recv_data) +void WorldSession::SendCalendarCommandResult(CalendarError err, char const* param /*= NULL*/) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_MODERATOR_STATUS"); - recv_data.rfinish(); // set to end to avoid warnings spam - - //recv_data.readPackGUID(guid) - //recv_data >> uint64 - //recv_data >> uint64 - //recv_data >> uint64 - //recv_data >> uint32 + uint64 guid = _player->GetGUID(); + sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_COMMAND_RESULT [" UI64FMTD "] Value: %u", guid, err); + + WorldPacket data(SMSG_CALENDAR_COMMAND_RESULT, 0); + data << uint32(0); + data << uint8(0); + switch (err) + { + case CALENDAR_ERROR_OTHER_INVITES_EXCEEDED: + case CALENDAR_ERROR_ALREADY_INVITED_TO_EVENT_S: + case CALENDAR_ERROR_IGNORING_YOU_S: + data << param; + break; + default: + data << uint8(0); + break; + } + + data << uint32(err); + + SendPacket(&data); } -void WorldSession::HandleCalendarComplain(WorldPacket& recv_data) +void WorldSession::SendCalendarRaidLockout(InstanceSave const* save, bool add) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_COMPLAIN"); - recv_data.rfinish(); // set to end to avoid warnings spam + sLog->outDebug(LOG_FILTER_NETWORKIO, "%s", add ? "SMSG_CALENDAR_RAID_LOCKOUT_ADDED" : "SMSG_CALENDAR_RAID_LOCKOUT_REMOVED"); + time_t currTime = time(NULL); - //recv_data >> uint64 - //recv_data >> uint64 - //recv_data >> uint64 + WorldPacket data(SMSG_CALENDAR_RAID_LOCKOUT_REMOVED, (add ? 4 : 0) + 4 + 4 + 4 + 8); + if (add) + { + data.SetOpcode(SMSG_CALENDAR_RAID_LOCKOUT_ADDED); + data << uint32(secsToTimeBitFields(currTime)); + } + + data << uint32(save->GetMapId()); + data << uint32(save->GetDifficulty()); + data << uint32(save->GetResetTime() - currTime); + data << uint64(save->GetInstanceId()); + SendPacket(&data); } -void WorldSession::HandleCalendarGetNumPending(WorldPacket& /*recv_data*/) +void WorldSession::SendCalendarRaidLockoutUpdated(InstanceSave const* save) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_GET_NUM_PENDING"); // empty + if (!save) + return; - WorldPacket data(SMSG_CALENDAR_SEND_NUM_PENDING, 4); - data << uint32(0); // 0 - no pending invites, 1 - some pending invites + uint64 guid = _player->GetGUID(); + sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_RAID_LOCKOUT_UPDATED [" UI64FMTD + "] Map: %u, Difficulty %u", guid, save->GetMapId(), save->GetDifficulty()); + + time_t cur_time = time_t(time(NULL)); + + WorldPacket data(SMSG_CALENDAR_RAID_LOCKOUT_UPDATED, 4 + 4 + 4 + 4 + 8); + data << secsToTimeBitFields(cur_time); + data << uint32(save->GetMapId()); + data << uint32(save->GetDifficulty()); + data << uint32(0); // Amount of seconds that has changed to the reset time + data << uint32(save->GetResetTime() - cur_time); SendPacket(&data); } diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index 16129985d0f..887bebe5656 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -532,7 +532,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte if (result) { Field* fields = result->Fetch(); - createInfo->CharCount = fields[0].GetUInt8(); + createInfo->CharCount = uint8(fields[0].GetUInt64()); // SQL's COUNT() returns uint64 but it will always be less than uint8.Max if (createInfo->CharCount >= sWorld->getIntConfig(CONFIG_CHARACTERS_PER_REALM)) { @@ -711,7 +711,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte SQLTransaction trans = LoginDatabase.BeginTransaction(); - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_REALM_CHARACTERS); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_REALM_CHARACTERS_BY_REALM); stmt->setUInt32(0, GetAccountId()); stmt->setUInt32(1, realmID); trans->Append(stmt); @@ -724,8 +724,6 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte LoginDatabase.CommitTransaction(trans); - newChar.CleanupsBeforeDelete(); - WorldPacket data(SMSG_CHAR_CREATE, 1); data << uint8(CHAR_CREATE_SUCCESS); SendPacket(&data); @@ -736,6 +734,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte sScriptMgr->OnPlayerCreate(&newChar); sWorld->AddCharacterNameData(newChar.GetGUIDLow(), std::string(newChar.GetName()), newChar.getGender(), newChar.getRace(), newChar.getClass()); + newChar.CleanupsBeforeDelete(); delete createInfo; _charCreateCallback.Reset(); } @@ -773,12 +772,17 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data) return; } - QueryResult result = CharacterDatabase.PQuery("SELECT account, name FROM characters WHERE guid='%u'", GUID_LOPART(guid)); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ACCOUNT_NAME_BY_GUID); + + stmt->setUInt32(0, GUID_LOPART(guid)); + + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (result) { Field* fields = result->Fetch(); - accountId = fields[0].GetUInt32(); - name = fields[1].GetString(); + accountId = fields[0].GetUInt32(); + name = fields[1].GetString(); } // prevent deleting other players' characters using cheating tools @@ -1110,8 +1114,8 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) SendNotification(LANG_GM_ON); std::string IP_str = GetRemoteAddress(); - sLog->outChar("Account: %d (IP: %s) Login Character:[%s] (GUID: %u)", - GetAccountId(), IP_str.c_str(), pCurrChar->GetName(), pCurrChar->GetGUIDLow()); + sLog->outChar("Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d", + GetAccountId(), IP_str.c_str(), pCurrChar->GetName(), pCurrChar->GetGUIDLow(), pCurrChar->getLevel()); if (!pCurrChar->IsStandState() && !pCurrChar->HasUnitState(UNIT_STATE_STUNNED)) pCurrChar->SetStandState(UNIT_STAND_STATE_STAND); @@ -1222,8 +1226,10 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recv_data) uint8 res = ObjectMgr::CheckPlayerName(newName, true); if (res != CHAR_NAME_SUCCESS) { - WorldPacket data(SMSG_CHAR_RENAME, 1); + WorldPacket data(SMSG_CHAR_RENAME, 1+8+(newName.size()+1)); data << uint8(res); + data << uint64(guid); + data << newName; SendPacket(&data); return; } @@ -1372,9 +1378,19 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data) CharacterDatabase.EscapeString(declinedname.name[i]); SQLTransaction trans = CharacterDatabase.BeginTransaction(); - trans->PAppend("DELETE FROM character_declinedname WHERE guid = '%u'", GUID_LOPART(guid)); - trans->PAppend("INSERT INTO character_declinedname (guid, genitive, dative, accusative, instrumental, prepositional) VALUES ('%u', '%s', '%s', '%s', '%s', '%s')", - GUID_LOPART(guid), declinedname.name[0].c_str(), declinedname.name[1].c_str(), declinedname.name[2].c_str(), declinedname.name[3].c_str(), declinedname.name[4].c_str()); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_DECLINED_NAME); + stmt->setUInt32(0, GUID_LOPART(guid)); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_DECLINED_NAME); + stmt->setUInt32(0, GUID_LOPART(guid)); + + for (uint8 i = 0; i < 5; i++) + stmt->setString(i+1, declinedname.name[i]); + + trans->Append(stmt); + CharacterDatabase.CommitTransaction(trans); WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8); @@ -1471,7 +1487,12 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data) uint8 gender, skin, face, hairStyle, hairColor, facialHair; recv_data >> gender >> skin >> hairColor >> hairStyle >> facialHair >> face; - QueryResult result = CharacterDatabase.PQuery("SELECT at_login FROM characters WHERE guid ='%u'", GUID_LOPART(guid)); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AT_LOGIN); + + stmt->setUInt32(0, GUID_LOPART(guid)); + + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (!result) { WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1); @@ -1530,15 +1551,19 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data) } } - if (QueryResult oldNameResult = CharacterDatabase.PQuery("SELECT name FROM characters WHERE guid ='%u'", GUID_LOPART(guid))) + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME); + stmt->setUInt32(0, GUID_LOPART(guid)); + result = CharacterDatabase.Query(stmt); + + if (result) { - std::string oldname = oldNameResult->Fetch()[0].GetString(); - std::string IP_str = GetRemoteAddress(); - sLog->outChar("Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), IP_str.c_str(), oldname.c_str(), GUID_LOPART(guid), newName.c_str()); + std::string oldname = result->Fetch()[0].GetString(); + sLog->outChar("Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), GUID_LOPART(guid), newName.c_str()); } + Player::Customize(guid, gender, skin, face, hairStyle, hairColor, facialHair); - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_NAME_AT_LOGIN); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_NAME_AT_LOGIN); stmt->setString(0, newName); stmt->setUInt16(1, uint16(AT_LOGIN_CUSTOMIZE)); @@ -1683,7 +1708,13 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data) recv_data >> gender >> skin >> hairColor >> hairStyle >> facialHair >> face >> race; uint32 lowGuid = GUID_LOPART(guid); - QueryResult result = CharacterDatabase.PQuery("SELECT class, level, at_login FROM characters WHERE guid ='%u'", lowGuid); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_CLASS_LVL_AT_LOGIN); + + stmt->setUInt32(0, lowGuid); + + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (!result) { WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1); @@ -1693,8 +1724,8 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data) } Field* fields = result->Fetch(); - uint32 playerClass = fields[0].GetUInt32(); - uint32 level = fields[1].GetUInt32(); + uint32 playerClass = uint32(fields[0].GetUInt8()); + uint32 level = uint32(fields[1].GetUInt8()); uint32 at_loginFlags = fields[2].GetUInt16(); uint32 used_loginFlag = ((recv_data.GetOpcode() == CMSG_CHAR_RACE_CHANGE) ? AT_LOGIN_CHANGE_RACE : AT_LOGIN_CHANGE_FACTION); @@ -1749,7 +1780,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data) { WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1); data << uint8(CHAR_NAME_RESERVED); - SendPacket (&data); + SendPacket(&data); return; } @@ -1768,8 +1799,18 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data) CharacterDatabase.EscapeString(newname); Player::Customize(guid, gender, skin, face, hairStyle, hairColor, facialHair); SQLTransaction trans = CharacterDatabase.BeginTransaction(); - trans->PAppend("UPDATE `characters` SET name='%s', race='%u', at_login=at_login & ~ %u WHERE guid='%u'", newname.c_str(), race, used_loginFlag, lowGuid); - trans->PAppend("DELETE FROM character_declinedname WHERE guid ='%u'", lowGuid); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_FACTION_OR_RACE); + stmt->setString(0, newname); + stmt->setUInt8(1, race); + stmt->setUInt16(2, used_loginFlag); + stmt->setUInt32(3, lowGuid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_DECLINED_NAME); + stmt->setUInt32(0, lowGuid); + trans->Append(stmt); + sWorld->UpdateCharacterNameData(GUID_LOPART(guid), newname, gender, race); BattlegroundTeamId team = BG_TEAM_ALLIANCE; @@ -1791,58 +1832,71 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data) // Switch Languages // delete all languages first - trans->PAppend("DELETE FROM `character_skills` WHERE `skill` IN (98, 113, 759, 111, 313, 109, 115, 315, 673, 137, 791, 792) AND `guid`='%u'", lowGuid); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SKILL_LANGUAGES); + stmt->setUInt32(0, lowGuid); + trans->Append(stmt); + + // Now add them back + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_SKILL_LANGUAGE); + stmt->setUInt32(0, lowGuid); + + // Faction specific languages + if (team == BG_TEAM_HORDE) + stmt->setUInt16(1, 109); + else + stmt->setUInt16(1, 98); - // now add them back - if (team == BG_TEAM_ALLIANCE) + trans->Append(stmt); + + // Race specific languages + if (race != RACE_ORC && race != RACE_HUMAN) { - trans->PAppend("INSERT INTO `character_skills` (guid, skill, value, max) VALUES (%u, 98, 300, 300)", lowGuid); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_SKILL_LANGUAGE); + stmt->setUInt32(0, lowGuid); + switch (race) { - case RACE_DWARF: - trans->PAppend("INSERT INTO `character_skills` (guid, skill, value, max) VALUES (%u, 111, 300, 300)", lowGuid); - break; - case RACE_DRAENEI: - trans->PAppend("INSERT INTO `character_skills` (guid, skill, value, max) VALUES (%u, 759, 300, 300)", lowGuid); - break; - case RACE_GNOME: - trans->PAppend("INSERT INTO `character_skills` (guid, skill, value, max) VALUES (%u, 313, 300, 300)", lowGuid); - break; - case RACE_NIGHTELF: - trans->PAppend("INSERT INTO `character_skills` (guid, skill, value, max) VALUES (%u, 113, 300, 300)", lowGuid); - break; + case RACE_DWARF: + stmt->setUInt16(1, 111); + break; + case RACE_DRAENEI: + stmt->setUInt16(1, 759); + break; + case RACE_GNOME: + stmt->setUInt16(1, 313); + break; + case RACE_NIGHTELF: + stmt->setUInt16(1, 113); + break; case RACE_WORGEN: trans->PAppend("INSERT INTO `character_skills` (guid, skill, value, max) VALUES (%u, 791, 300, 300)", lowGuid); break; - } - } - else if (team == BG_TEAM_HORDE) - { - trans->PAppend("INSERT INTO `character_skills` (guid, skill, value, max) VALUES (%u, 109, 300, 300)", lowGuid); - switch (race) - { - case RACE_UNDEAD_PLAYER: - trans->PAppend("INSERT INTO `character_skills` (guid, skill, value, max) VALUES (%u, 673, 300, 300)", lowGuid); - break; - case RACE_TAUREN: - trans->PAppend("INSERT INTO `character_skills` (guid, skill, value, max) VALUES (%u, 115, 300, 300)", lowGuid); - break; - case RACE_TROLL: - trans->PAppend("INSERT INTO `character_skills` (guid, skill, value, max) VALUES (%u, 315, 300, 300)", lowGuid); - break; - case RACE_BLOODELF: - trans->PAppend("INSERT INTO `character_skills` (guid, skill, value, max) VALUES (%u, 137, 300, 300)", lowGuid); - break; + case RACE_UNDEAD_PLAYER: + stmt->setUInt16(1, 673); + break; + case RACE_TAUREN: + stmt->setUInt16(1, 115); + break; + case RACE_TROLL: + stmt->setUInt16(1, 315); + break; + case RACE_BLOODELF: + stmt->setUInt16(1, 137); + break; case RACE_GOBLIN: trans->PAppend("INSERT INTO `character_skills` (guid, skill, value, max) VALUES (%u, 792, 300, 300)", lowGuid); break; } + + trans->Append(stmt); } if (recv_data.GetOpcode() == CMSG_CHAR_FACTION_CHANGE) { // Delete all Flypaths - trans->PAppend("UPDATE `characters` SET taxi_path = '' WHERE guid ='%u'", lowGuid); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_TAXI_PATH); + stmt->setUInt32(0, lowGuid); + trans->Append(stmt); if (level > 7) { @@ -1884,11 +1938,17 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data) taximaskstream << "0 "; taximaskstream << '0'; std::string taximask = taximaskstream.str(); - trans->PAppend("UPDATE `characters` SET `taximask`= '%s' WHERE `guid` = '%u'", taximask.c_str(), lowGuid); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_TAXIMASK); + stmt->setString(0, taximask); + stmt->setUInt32(1, lowGuid); + trans->Append(stmt); } // Delete all current quests - trans->PAppend("DELETE FROM `character_queststatus` WHERE guid ='%u'", GUID_LOPART(guid)); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS); + stmt->setUInt32(0, GUID_LOPART(guid)); + trans->Append(stmt); // Delete record of the faction old completed quests { @@ -1926,7 +1986,12 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data) if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD)) { // Reset guild - if (QueryResult result = CharacterDatabase.PQuery("SELECT guildid FROM `guild_member` WHERE guid ='%u'", lowGuid)) + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER); + + stmt->setUInt32(0, lowGuid); + + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (result) if (Guild* guild = sGuildMgr->GetGuildById((result->Fetch()[0]).GetUInt32())) guild->DeleteMember(MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER)); } @@ -1934,15 +1999,21 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data) if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND)) { // Delete Friend List - trans->PAppend("DELETE FROM `character_social` WHERE `guid`= '%u'", lowGuid); - trans->PAppend("DELETE FROM `character_social` WHERE `friend`= '%u'", lowGuid); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_GUID); + stmt->setUInt32(0, lowGuid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_FRIEND); + stmt->setUInt32(0, lowGuid); + trans->Append(stmt); + } // Leave Arena Teams Player::LeaveAllArenaTeams(guid); // Reset homebind and position - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_HOMEBIND); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_HOMEBIND); stmt->setUInt32(0, lowGuid); trans->Append(stmt); @@ -1973,10 +2044,17 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data) { uint32 achiev_alliance = it->first; uint32 achiev_horde = it->second; - trans->PAppend("DELETE FROM `character_achievement` WHERE `achievement`=%u AND `guid`=%u", - team == BG_TEAM_ALLIANCE ? achiev_alliance : achiev_horde, lowGuid); - trans->PAppend("UPDATE `character_achievement` SET achievement = '%u' where achievement = '%u' AND guid = '%u'", - team == BG_TEAM_ALLIANCE ? achiev_alliance : achiev_horde, team == BG_TEAM_ALLIANCE ? achiev_horde : achiev_alliance, lowGuid); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_BY_ACHIEVEMENT); + stmt->setUInt16(0, uint16(team == BG_TEAM_ALLIANCE ? achiev_alliance : achiev_horde)); + stmt->setUInt32(1, lowGuid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_ACHIEVEMENT); + stmt->setUInt16(0, uint16(team == BG_TEAM_ALLIANCE ? achiev_alliance : achiev_horde)); + stmt->setUInt16(1, uint16(team == BG_TEAM_ALLIANCE ? achiev_horde : achiev_alliance)); + stmt->setUInt32(2, lowGuid); + trans->Append(stmt); } // Item conversion @@ -1984,8 +2062,12 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data) { uint32 item_alliance = it->first; uint32 item_horde = it->second; - trans->PAppend("UPDATE `item_instance` ii, `character_inventory` ci SET ii.itemEntry = '%u' WHERE ii.itemEntry = '%u' AND ci.guid = '%u' AND ci.item = ii.guid", - team == BG_TEAM_ALLIANCE ? item_alliance : item_horde, team == BG_TEAM_ALLIANCE ? item_horde : item_alliance, guid); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_INVENTORY_FACTION_CHANGE); + stmt->setUInt32(0, (team == BG_TEAM_ALLIANCE ? item_alliance : item_horde)); + stmt->setUInt32(1, (team == BG_TEAM_ALLIANCE ? item_horde : item_alliance)); + stmt->setUInt32(2, guid); + trans->Append(stmt); } // Spell conversion @@ -1993,10 +2075,17 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data) { uint32 spell_alliance = it->first; uint32 spell_horde = it->second; - trans->PAppend("DELETE FROM `character_spell` WHERE `spell`=%u AND `guid`=%u", - team == BG_TEAM_ALLIANCE ? spell_alliance : spell_horde, lowGuid); - trans->PAppend("UPDATE `character_spell` SET spell = '%u' where spell = '%u' AND guid = '%u'", - team == BG_TEAM_ALLIANCE ? spell_alliance : spell_horde, team == BG_TEAM_ALLIANCE ? spell_horde : spell_alliance, lowGuid); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL_BY_SPELL); + stmt->setUInt32(0, (team == BG_TEAM_ALLIANCE ? spell_alliance : spell_horde)); + stmt->setUInt32(1, lowGuid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_SPELL_FACTION_CHANGE); + stmt->setUInt32(0, (team == BG_TEAM_ALLIANCE ? spell_alliance : spell_horde)); + stmt->setUInt32(1, (team == BG_TEAM_ALLIANCE ? spell_horde : spell_alliance)); + stmt->setUInt32(2, lowGuid); + trans->Append(stmt); } // Reputation conversion @@ -2004,10 +2093,17 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data) { uint32 reputation_alliance = it->first; uint32 reputation_horde = it->second; - trans->PAppend("DELETE FROM character_reputation WHERE faction = '%u' AND guid = '%u'", - team == BG_TEAM_ALLIANCE ? reputation_alliance : reputation_horde, lowGuid); - trans->PAppend("UPDATE `character_reputation` SET faction = '%u' where faction = '%u' AND guid = '%u'", - team == BG_TEAM_ALLIANCE ? reputation_alliance : reputation_horde, team == BG_TEAM_ALLIANCE ? reputation_horde : reputation_alliance, lowGuid); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_REP_BY_FACTION); + stmt->setUInt32(0, uint16(team == BG_TEAM_ALLIANCE ? reputation_alliance : reputation_horde)); + stmt->setUInt32(1, lowGuid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_REP_FACTION_CHANGE); + stmt->setUInt16(0, uint16(team == BG_TEAM_ALLIANCE ? reputation_alliance : reputation_horde)); + stmt->setUInt16(1, uint16(team == BG_TEAM_ALLIANCE ? reputation_horde : reputation_alliance)); + stmt->setUInt32(2, lowGuid); + trans->Append(stmt); } } diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp index 3d919335e1a..d725419ac84 100755 --- a/src/server/game/Handlers/GroupHandler.cpp +++ b/src/server/game/Handlers/GroupHandler.cpp @@ -277,8 +277,9 @@ void WorldSession::HandleGroupDeclineOpcode(WorldPacket & /*recv_data*/) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_DECLINE"); - Group *group = GetPlayer()->GetGroupInvite(); - if (!group) return; + Group* group = GetPlayer()->GetGroupInvite(); + if (!group) + return; // Remember leader if online (group pointer will be invalid if group gets disbanded) Player* leader = ObjectAccessor::FindPlayer(group->GetLeaderGUID()); @@ -459,7 +460,8 @@ void WorldSession::HandleLootMethodOpcode(WorldPacket & recv_data) void WorldSession::HandleLootRoll(WorldPacket &recv_data) { - if (!GetPlayer()->GetGroup()) + Group* group = GetPlayer()->GetGroup(); + if (!group) { recv_data.rfinish(); return; @@ -472,12 +474,6 @@ void WorldSession::HandleLootRoll(WorldPacket &recv_data) recv_data >> NumberOfPlayers; recv_data >> rollType; //0: pass, 1: need, 2: greed - //sLog->outDebug("WORLD RECIEVE CMSG_LOOT_ROLL, From:%u, Numberofplayers:%u, Choise:%u", (uint32)Guid, NumberOfPlayers, Choise); - - Group* group = GetPlayer()->GetGroup(); - if (!group) - return; - // everything's fine, do it group->CountRollVote(GetPlayer()->GetGUID(), Guid, NumberOfPlayers, rollType); diff --git a/src/server/game/Handlers/GuildHandler.cpp b/src/server/game/Handlers/GuildHandler.cpp index fd3f0c07fb4..c2ff61bb912 100755 --- a/src/server/game/Handlers/GuildHandler.cpp +++ b/src/server/game/Handlers/GuildHandler.cpp @@ -373,8 +373,8 @@ void WorldSession::HandleGuildBankerActivate(WorldPacket & recv_data) uint64 GoGuid; recv_data >> GoGuid; - uint8 unk; - recv_data >> unk; + uint8 fullSlotList; + recv_data >> fullSlotList; // 0 = only slots updated in last operation are shown. 1 = all slots updated if (GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK)) { @@ -396,8 +396,8 @@ void WorldSession::HandleGuildBankQueryTab(WorldPacket & recv_data) uint8 tabId; recv_data >> tabId; - uint8 unk1; - recv_data >> unk1; + uint8 fullSlotList; + recv_data >> fullSlotList; // 0 = only slots updated in last operation are shown. 1 = all slots updated if (GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK)) if (Guild* guild = _GetPlayerGuild(this)) diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp index 00ff1f8ffa4..2d85a4cb689 100755 --- a/src/server/game/Handlers/ItemHandler.cpp +++ b/src/server/game/Handlers/ItemHandler.cpp @@ -115,7 +115,7 @@ void WorldSession::HandleSwapItem(WorldPacket & recv_data) //sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_SWAP_ITEM"); uint8 dstbag, dstslot, srcbag, srcslot; - recv_data >> dstbag >> dstslot >> srcbag >> srcslot ; + recv_data >> dstbag >> dstslot >> srcbag >> srcslot; //sLog->outDebug("STORAGE: receive srcbag = %u, srcslot = %u, dstbag = %u, dstslot = %u", srcbag, srcslot, dstbag, dstslot); uint16 src = ((srcbag << 8) | srcslot); @@ -1144,7 +1144,14 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data) } SQLTransaction trans = CharacterDatabase.BeginTransaction(); - trans->PAppend("INSERT INTO character_gifts VALUES ('%u', '%u', '%u', '%u')", GUID_LOPART(item->GetOwnerGUID()), item->GetGUIDLow(), item->GetEntry(), item->GetUInt32Value(ITEM_FIELD_FLAGS)); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_GIFT); + stmt->setUInt32(0, GUID_LOPART(item->GetOwnerGUID())); + stmt->setUInt32(1, item->GetGUIDLow()); + stmt->setUInt32(2, item->GetEntry()); + stmt->setUInt32(3, item->GetUInt32Value(ITEM_FIELD_FLAGS)); + trans->Append(stmt); + item->SetEntry(gift->GetEntry()); switch (item->GetEntry()) @@ -1282,7 +1289,6 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data) } } } - } } diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp index 842e19cf510..9c66ca44383 100755 --- a/src/server/game/Handlers/LFGHandler.cpp +++ b/src/server/game/Handlers/LFGHandler.cpp @@ -72,7 +72,7 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket& recv_data) } LfgDungeonSet newDungeons; - for (int8 i = 0 ; i < numDungeons; ++i) + for (int8 i = 0; i < numDungeons; ++i) { recv_data >> dungeon; newDungeons.insert((dungeon & 0x00FFFFFF)); // remove the type from the dungeon entry @@ -527,9 +527,9 @@ void WorldSession::SendLfgBootPlayer(const LfgPlayerBoot* pBoot) ++agreeNum; } } - sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_BOOT_PLAYER [" UI64FMTD "] inProgress: %u - didVote: %u - agree: %u - victim: [" UI64FMTD "] votes: %u - agrees: %u - left: %u - needed: %u - reason %s", + sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_BOOT_PROPOSAL_UPDATE [" UI64FMTD "] inProgress: %u - didVote: %u - agree: %u - victim: [" UI64FMTD "] votes: %u - agrees: %u - left: %u - needed: %u - reason %s", guid, uint8(pBoot->inProgress), uint8(playerVote != LFG_ANSWER_PENDING), uint8(playerVote == LFG_ANSWER_AGREE), pBoot->victim, votesNum, agreeNum, secsleft, pBoot->votedNeeded, pBoot->reason.c_str()); - WorldPacket data(SMSG_LFG_BOOT_PLAYER, 1 + 1 + 1 + 8 + 4 + 4 + 4 + 4 + pBoot->reason.length()); + WorldPacket data(SMSG_LFG_BOOT_PROPOSAL_UPDATE, 1 + 1 + 1 + 8 + 4 + 4 + 4 + 4 + pBoot->reason.length()); data << uint8(pBoot->inProgress); // Vote in progress data << uint8(playerVote != LFG_ANSWER_PENDING); // Did Vote data << uint8(playerVote == LFG_ANSWER_AGREE); // Agree diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp index 6508f08dc22..8e4b41a9be4 100755 --- a/src/server/game/Handlers/LootHandler.cpp +++ b/src/server/game/Handlers/LootHandler.cpp @@ -80,9 +80,9 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket & recv_data) { Creature* creature = GetPlayer()->GetMap()->GetCreature(lguid); - bool ok_loot = creature && creature->isAlive() == (player->getClass() == CLASS_ROGUE && creature->lootForPickPocketed); + bool lootAllowed = creature && creature->isAlive() == (player->getClass() == CLASS_ROGUE && creature->lootForPickPocketed); - if (!ok_loot || !creature->IsWithinDistInMap(_player, INTERACTION_DISTANCE)) + if (!lootAllowed || !creature->IsWithinDistInMap(_player, INTERACTION_DISTANCE)) { player->SendLootRelease(lguid); return; @@ -386,8 +386,8 @@ void WorldSession::DoLootRelease(uint64 lguid) { Creature* creature = GetPlayer()->GetMap()->GetCreature(lguid); - bool ok_loot = creature && creature->isAlive() == (player->getClass() == CLASS_ROGUE && creature->lootForPickPocketed); - if (!ok_loot || !creature->IsWithinDistInMap(_player, INTERACTION_DISTANCE)) + bool lootAllowed = creature && creature->isAlive() == (player->getClass() == CLASS_ROGUE && creature->lootForPickPocketed); + if (!lootAllowed || !creature->IsWithinDistInMap(_player, INTERACTION_DISTANCE)) return; loot = &creature->loot; @@ -448,7 +448,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data) if (_player->GetLootGUID() != lootguid) return; - Loot* pLoot = NULL; + Loot* loot = NULL; if (IS_CRE_OR_VEH_GUID(GetPlayer()->GetLootGUID())) { @@ -456,7 +456,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data) if (!creature) return; - pLoot = &creature->loot; + loot = &creature->loot; } else if (IS_GAMEOBJECT_GUID(GetPlayer()->GetLootGUID())) { @@ -464,19 +464,19 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data) if (!pGO) return; - pLoot = &pGO->loot; + loot = &pGO->loot; } - if (!pLoot) + if (!loot) return; - if (slotid > pLoot->items.size()) + if (slotid > loot->items.size()) { - sLog->outDebug(LOG_FILTER_LOOT, "MasterLootItem: Player %s might be using a hack! (slot %d, size %lu)", GetPlayer()->GetName(), slotid, (unsigned long)pLoot->items.size()); + sLog->outDebug(LOG_FILTER_LOOT, "MasterLootItem: Player %s might be using a hack! (slot %d, size %lu)", GetPlayer()->GetName(), slotid, (unsigned long)loot->items.size()); return; } - LootItem& item = pLoot->items[slotid]; + LootItem& item = loot->items[slotid]; ItemPosCountVec dest; InventoryResult msg = target->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item.itemid, item.count); @@ -495,14 +495,13 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data) Item* newitem = target->StoreNewItem(dest, item.itemid, true, item.randomPropertyId, looters); target->SendNewItem(newitem, uint32(item.count), false, false, true); target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item.itemid, item.count); - target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, pLoot->loot_type, item.count); + target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, loot->loot_type, item.count); target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM, item.itemid, item.count); // mark as looted item.count=0; item.is_looted=true; - pLoot->NotifyItemRemoved(slotid); - --pLoot->unlootedCount; + loot->NotifyItemRemoved(slotid); + --loot->unlootedCount; } - diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp index 95459bae0fa..988857558c9 100755 --- a/src/server/game/Handlers/MailHandler.cpp +++ b/src/server/game/Handlers/MailHandler.cpp @@ -128,12 +128,26 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data) else { rc_team = sObjectMgr->GetPlayerTeamByGUID(rc); - if (QueryResult result = CharacterDatabase.PQuery("SELECT COUNT(*) FROM mail WHERE receiver = '%u'", GUID_LOPART(rc))) + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_COUNT); + + stmt->setUInt32(0, GUID_LOPART(rc)); + + PreparedQueryResult result = CharacterDatabase.Query(stmt); + + if (result) { Field* fields = result->Fetch(); - mails_count = fields[0].GetUInt32(); + mails_count = fields[0].GetUInt64(); } - if (QueryResult result = CharacterDatabase.PQuery("SELECT level FROM characters WHERE guid = '%u'", GUID_LOPART(rc))) + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_LEVEL); + + stmt->setUInt32(0, GUID_LOPART(rc)); + + result = CharacterDatabase.Query(stmt); + + if (result) { Field* fields = result->Fetch(); receiveLevel = fields[0].GetUInt8(); @@ -360,8 +374,15 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data) //we can return mail now //so firstly delete the old one SQLTransaction trans = CharacterDatabase.BeginTransaction(); - trans->PAppend("DELETE FROM mail WHERE id = '%u'", mailId); // needed? - trans->PAppend("DELETE FROM mail_items WHERE mail_id = '%u'", mailId); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_BY_ID); + stmt->setUInt32(0, mailId); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM_BY_ID); + stmt->setUInt32(0, mailId); + trans->Append(stmt); + player->RemoveMail(mailId); // only return mail if the player exists (and delete if not existing) @@ -541,7 +562,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data) //load players mails, and mailed items if (!player->m_mailsLoaded) - player ->_LoadMail(); + player->_LoadMail(); // client can't work with packets > max int16 value const uint32 maxPacketSize = 32767; diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index e04704785e0..7cea7b2ea8e 100755 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -51,6 +51,7 @@ #include "GameObjectAI.h" #include "Group.h" #include "AccountMgr.h" +#include "Spell.h" void WorldSession::HandleRepopRequestOpcode(WorldPacket & recv_data) { @@ -125,11 +126,11 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data) if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - if ((unit && unit->GetCreatureInfo()->ScriptID != unit->LastUsedScriptID) || (go && go->GetGOInfo()->ScriptId != go->LastUsedScriptID)) + if ((unit && unit->GetCreatureTemplate()->ScriptID != unit->LastUsedScriptID) || (go && go->GetGOInfo()->ScriptId != go->LastUsedScriptID)) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleGossipSelectOptionOpcode - Script reloaded while in use, ignoring and set new scipt id"); if (unit) - unit->LastUsedScriptID = unit->GetCreatureInfo()->ScriptID; + unit->LastUsedScriptID = unit->GetCreatureTemplate()->ScriptID; if (go) go->LastUsedScriptID = go->GetGOInfo()->ScriptId; _player->PlayerTalkClass->SendCloseGossip(); @@ -374,7 +375,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket & /*recv_data*/) if (GetPlayer()->isInCombat()) reason = 1; - else if (GetPlayer()->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_JUMPING | MOVEMENTFLAG_FALLING)) + else if (GetPlayer()->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_FALLING | MOVEMENTFLAG_FALLING_FAR)) reason = 3; // is jumping or falling else if (GetPlayer()->duel || GetPlayer()->HasAura(9454)) // is dueling or frozen by GM via freeze command reason = 2; // FIXME - Need the correct value @@ -429,6 +430,10 @@ void WorldSession::HandleLogoutCancelOpcode(WorldPacket & /*recv_data*/) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_LOGOUT_CANCEL Message"); + // Player have already logged out serverside, too late to cancel + if (!GetPlayer()) + return; + LogoutRequest(0); WorldPacket data(SMSG_LOGOUT_CANCEL_ACK, 0); @@ -818,7 +823,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data) Player* player = GetPlayer(); if (player->isInFlight()) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Player '%s' (GUID: %u) in flight, ignore Area Trigger ID:%u", + sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) in flight, ignore Area Trigger ID:%u", player->GetName(), player->GetGUIDLow(), triggerId); return; } @@ -826,14 +831,14 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data) AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(triggerId); if (!atEntry) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Player '%s' (GUID: %u) send unknown (by DBC) Area Trigger ID:%u", + sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) send unknown (by DBC) Area Trigger ID:%u", player->GetName(), player->GetGUIDLow(), triggerId); return; } if (player->GetMapId() != atEntry->mapid) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Player '%s' (GUID: %u) too far (trigger map: %u player map: %u), ignore Area Trigger ID: %u", + sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) too far (trigger map: %u player map: %u), ignore Area Trigger ID: %u", player->GetName(), atEntry->mapid, player->GetMapId(), player->GetGUIDLow(), triggerId); return; } @@ -847,7 +852,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data) float dist = player->GetDistance(atEntry->x, atEntry->y, atEntry->z); if (dist > atEntry->radius + delta) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Player '%s' (GUID: %u) too far (radius: %f distance: %f), ignore Area Trigger ID: %u", + sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) too far (radius: %f distance: %f), ignore Area Trigger ID: %u", player->GetName(), player->GetGUIDLow(), atEntry->radius, dist, triggerId); return; } @@ -878,7 +883,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data) (fabs(dy) > atEntry->box_y / 2 + delta) || (fabs(dz) > atEntry->box_z / 2 + delta)) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Player '%s' (GUID: %u) too far (1/2 box X: %f 1/2 box Y: %f 1/2 box Z: %f rotatedPlayerX: %f rotatedPlayerY: %f dZ:%f), ignore Area Trigger ID: %u", + sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) too far (1/2 box X: %f 1/2 box Y: %f 1/2 box Z: %f rotatedPlayerX: %f rotatedPlayerY: %f dZ:%f), ignore Area Trigger ID: %u", player->GetName(), player->GetGUIDLow(), atEntry->box_x/2, atEntry->box_y/2, atEntry->box_z/2, rotPlayerX, rotPlayerY, dz, triggerId); return; } @@ -1065,7 +1070,7 @@ void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data) sLog->outDetail("MISC: Added Item %u into button %u", action, button); break; default: - sLog->outError("MISC: Unknown action button type %u for action %u into button %u", type, action, button); + sLog->outError("MISC: Unknown action button type %u for action %u into button %u for player %s (GUID: %u)", type, action, button, _player->GetName(), _player->GetGUIDLow()); return; } GetPlayer()->addActionButton(button, action, type); @@ -1327,7 +1332,12 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data) uint32 accid = player->GetSession()->GetAccountId(); - QueryResult result = LoginDatabase.PQuery("SELECT username, email, last_ip FROM account WHERE id=%u", accid); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_WHOIS); + + stmt->setUInt32(0, accid); + + PreparedQueryResult result = LoginDatabase.Query(stmt); + if (!result) { SendNotification(LANG_ACCOUNT_FOR_PLAYER_NOT_FOUND, charname.c_str()); @@ -1349,7 +1359,7 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data) WorldPacket data(SMSG_WHOIS, msg.size()+1); data << msg; - _player->GetSession()->SendPacket(&data); + SendPacket(&data); sLog->outDebug(LOG_FILTER_NETWORKIO, "Received whois command from player %s for character %s", GetPlayer()->GetName(), charname.c_str()); } @@ -1526,16 +1536,16 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data) { for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { - Player* pGroupGuy = itr->getSource(); - if (!pGroupGuy) + Player* groupGuy = itr->getSource(); + if (!groupGuy) continue; - if (!pGroupGuy->IsInMap(pGroupGuy)) + if (!groupGuy->IsInMap(groupGuy)) return; - if (pGroupGuy->GetMap()->IsNonRaidDungeon()) + if (groupGuy->GetMap()->IsNonRaidDungeon()) { - sLog->outError("WorldSession::HandleSetDungeonDifficultyOpcode: player %d tried to reset the instance while group member (Name: %s, GUID: %u) is inside!", _player->GetGUIDLow(), pGroupGuy->GetName(), pGroupGuy->GetGUIDLow()); + sLog->outError("WorldSession::HandleSetDungeonDifficultyOpcode: player %d tried to reset the instance while group member (Name: %s, GUID: %u) is inside!", _player->GetGUIDLow(), groupGuy->GetName(), groupGuy->GetGUIDLow()); return; } } @@ -1583,14 +1593,14 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data) { for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { - Player* pGroupGuy = itr->getSource(); - if (!pGroupGuy) + Player* groupGuy = itr->getSource(); + if (!groupGuy) continue; - if (!pGroupGuy->IsInMap(pGroupGuy)) + if (!groupGuy->IsInMap(groupGuy)) return; - if (pGroupGuy->GetMap()->IsRaid()) + if (groupGuy->GetMap()->IsRaid()) { sLog->outError("WorldSession::HandleSetRaidDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow()); return; @@ -1779,3 +1789,47 @@ void WorldSession::HandleRequestHotfix(WorldPacket& recvPacket) delete[] guidBytes; delete[] mask; } + +void WorldSession::HandleUpdateMissileTrajectory(WorldPacket& recvPacket) +{ + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_UPDATE_MISSILE_TRAJECTORY"); + + uint64 guid; + uint32 spellId; + float elevation, speed; + float curX, curY, curZ; + float targetX, targetY, targetZ; + uint8 moveStop; + + recvPacket >> guid >> spellId >> elevation >> speed; + recvPacket >> curX >> curY >> curZ; + recvPacket >> targetX >> targetY >> targetZ; + recvPacket >> moveStop; + + Unit* caster = ObjectAccessor::GetUnit(*_player, guid); + Spell* spell = caster ? caster->GetCurrentSpell(CURRENT_GENERIC_SPELL) : NULL; + if (!spell || spell->m_spellInfo->Id != spellId || !spell->m_targets.HasDst() || !spell->m_targets.HasSrc()) + { + recvPacket.rfinish(); + return; + } + + Position pos = *spell->m_targets.GetSrcPos(); + pos.Relocate(curX, curY, curZ); + spell->m_targets.ModSrc(pos); + + pos = *spell->m_targets.GetDstPos(); + pos.Relocate(targetX, targetY, targetZ); + spell->m_targets.ModDst(pos); + + spell->m_targets.SetElevation(elevation); + spell->m_targets.SetSpeed(speed); + + if (moveStop) + { + uint32 opcode; + recvPacket >> opcode; + recvPacket.SetOpcode(opcode); + HandleMovementOpcodes(recvPacket); + } +} diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp index 5cac0b99c77..3d9968d9a9d 100755 --- a/src/server/game/Handlers/MovementHandler.cpp +++ b/src/server/game/Handlers/MovementHandler.cpp @@ -47,7 +47,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() GetPlayer()->SetSemaphoreTeleportFar(false); // get the teleport destination - WorldLocation &loc = GetPlayer()->GetTeleportDest(); + WorldLocation const loc = GetPlayer()->GetTeleportDest(); // possible errors in the coordinate validity check if (!MapManager::IsValidMapCoord(loc)) @@ -65,10 +65,9 @@ void WorldSession::HandleMoveWorldportAckOpcode() GetPlayer()->m_InstanceValid = true; Map* oldMap = GetPlayer()->GetMap(); - ASSERT(oldMap); if (GetPlayer()->IsInWorld()) { - sLog->outCrash("Player (Name %s) is still in world when teleported from map %u to new map %u", GetPlayer()->GetName(), oldMap->GetId(), loc.GetMapId()); + sLog->outError("Player (Name %s) is still in world when teleported from map %u to new map %u", GetPlayer()->GetName(), oldMap->GetId(), loc.GetMapId()); oldMap->RemovePlayerFromMap(GetPlayer(), false); } @@ -213,8 +212,7 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data) sLog->outStaticDebug("Guid " UI64FMTD, guid); sLog->outStaticDebug("Flags %u, time %u", flags, time/IN_MILLISECONDS); - Unit* mover = _player->m_mover; - Player* plMover = mover->GetTypeId() == TYPEID_PLAYER ? (Player*)mover : NULL; + Player* plMover = _player->m_mover->ToPlayer(); if (!plMover || !plMover->IsBeingTeleportedNear()) return; @@ -253,25 +251,25 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data) GetPlayer()->ProcessDelayedOperations(); } -void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data) +void WorldSession::HandleMovementOpcodes(WorldPacket & recvData) { - uint16 opcode = recv_data.GetOpcode(); + uint16 opcode = recvData.GetOpcode(); Unit* mover = _player->m_mover; - ASSERT(mover != NULL); // there must always be a mover + ASSERT(mover != NULL); // there must always be a mover - Player* plMover = mover->GetTypeId() == TYPEID_PLAYER ? (Player*)mover : NULL; + Player* plrMover = mover->ToPlayer(); // ignore, waiting processing in WorldSession::HandleMoveWorldportAckOpcode and WorldSession::HandleMoveTeleportAck - if (plMover && plMover->IsBeingTeleported()) + if (plrMover && plrMover->IsBeingTeleported()) { return; } /* extract packet */ MovementInfo movementInfo; - ReadMovementInfo(recv_data, &movementInfo); + ReadMovementInfo(recvData, &movementInfo); // prevent tampered movement data if (movementInfo.guid != mover->GetGUID()) @@ -292,27 +290,27 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data) // (also received at zeppelin leave by some reason with t_* as absolute in continent coordinates, can be safely skipped) if (movementInfo.t_pos.GetPositionX() > 50 || movementInfo.t_pos.GetPositionY() > 50 || movementInfo.t_pos.GetPositionZ() > 50) { - recv_data.rfinish(); // prevent warnings spam + recvData.rfinish(); // prevent warnings spam return; } if (!Trinity::IsValidMapCoord(movementInfo.pos.GetPositionX() + movementInfo.t_pos.GetPositionX(), movementInfo.pos.GetPositionY() + movementInfo.t_pos.GetPositionY(), movementInfo.pos.GetPositionZ() + movementInfo.t_pos.GetPositionZ(), movementInfo.pos.GetOrientation() + movementInfo.t_pos.GetOrientation())) { - recv_data.rfinish(); // prevent warnings spam + recvData.rfinish(); // prevent warnings spam return; } // if we boarded a transport, add us to it - if (plMover && !plMover->GetTransport()) + if (plrMover && !plrMover->GetTransport()) { // elevators also cause the client to send MOVEMENTFLAG_ONTRANSPORT - just dismount if the guid can be found in the transport list for (MapManager::TransportSet::const_iterator iter = sMapMgr->m_Transports.begin(); iter != sMapMgr->m_Transports.end(); ++iter) { if ((*iter)->GetGUID() == movementInfo.t_guid) { - plMover->m_transport = (*iter); - (*iter)->AddPassenger(plMover); + plrMover->m_transport = (*iter); + (*iter)->AddPassenger(plrMover); break; } } @@ -325,23 +323,23 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data) movementInfo.flags &= ~MOVEMENTFLAG_ONTRANSPORT; } } - else if (plMover && plMover->GetTransport()) // if we were on a transport, leave + else if (plrMover && plrMover->GetTransport()) // if we were on a transport, leave { - plMover->m_transport->RemovePassenger(plMover); - plMover->m_transport = NULL; + plrMover->m_transport->RemovePassenger(plrMover); + plrMover->m_transport = NULL; movementInfo.t_pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f); movementInfo.t_time = 0; movementInfo.t_seat = -1; } // fall damage generation (ignore in flight case that can be triggered also at lags in moment teleportation to another map). - if (opcode == MSG_MOVE_FALL_LAND && plMover && !plMover->isInFlight()) - plMover->HandleFall(movementInfo); + if (opcode == MSG_MOVE_FALL_LAND && plrMover && !plrMover->isInFlight()) + plrMover->HandleFall(movementInfo); - if (plMover && ((movementInfo.flags & MOVEMENTFLAG_SWIMMING) != 0) != plMover->IsInWater()) + if (plrMover && ((movementInfo.flags & MOVEMENTFLAG_SWIMMING) != 0) != plrMover->IsInWater()) { // now client not include swimming flag in case jumping under water - plMover->SetInWater(!plMover->IsInWater() || plMover->GetBaseMap()->IsUnderWater(movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY(), movementInfo.pos.GetPositionZ())); + plrMover->SetInWater(!plrMover->IsInWater() || plrMover->GetBaseMap()->IsUnderWater(movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY(), movementInfo.pos.GetPositionZ())); } /*----------------------*/ @@ -364,27 +362,25 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data) mover->UpdatePosition(movementInfo.pos); - if (plMover) // nothing is charmed, or player charmed + if (plrMover) // nothing is charmed, or player charmed { - plMover->UpdateFallInformationIfNeed(movementInfo, opcode); + plrMover->UpdateFallInformationIfNeed(movementInfo, opcode); if (movementInfo.pos.GetPositionZ() < -500.0f) { - if (!(plMover->InBattleground() - && plMover->GetBattleground() - && plMover->GetBattleground()->HandlePlayerUnderMap(_player))) + if (!(plrMover->GetBattleground() && plrMover->GetBattleground()->HandlePlayerUnderMap(_player))) { // NOTE: this is actually called many times while falling // even after the player has been teleported away // TODO: discard movement packets after the player is rooted - if (plMover->isAlive()) + if (plrMover->isAlive()) { - plMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, GetPlayer()->GetMaxHealth()); + plrMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, GetPlayer()->GetMaxHealth()); // player can be alive if GM/etc // change the death state to CORPSE to prevent the death timer from // starting in the next player update - if (!plMover->isAlive()) - plMover->KillPlayer(); + if (!plrMover->isAlive()) + plrMover->KillPlayer(); } } } @@ -492,9 +488,10 @@ void WorldSession::HandleMoveNotActiveMover(WorldPacket &recv_data) recv_data.readPackGUID(old_mover_guid); MovementInfo mi; - mi.guid = old_mover_guid; ReadMovementInfo(recv_data, &mi); + mi.guid = old_mover_guid; + _player->m_movementInfo = mi; } @@ -520,6 +517,7 @@ void WorldSession::HandleMoveKnockBackAck(WorldPacket & recv_data) MovementInfo movementInfo; ReadMovementInfo(recv_data, &movementInfo); + _player->m_movementInfo = movementInfo; WorldPacket data(SMSG_MOVE_UPDATE_KNOCK_BACK, 66); @@ -744,6 +742,78 @@ void WorldSession::ReadMovementInfo(WorldPacket &data, MovementInfo* mi) if (HaveTransportData && mi->pos.m_positionX != mi->t_pos.m_positionX) if (GetPlayer()->GetTransport()) GetPlayer()->GetTransport()->UpdatePosition(mi); + + //! Anti-cheat checks. Please keep them in seperate if() blocks to maintain a clear overview. + //! Might be subject to latency, so just remove improper flags. + #ifdef TRINITY_DEBUG + #define REMOVE_VIOLATING_FLAGS(check, maskToRemove) \ + { \ + if (check) \ + { \ + sLog->outDebug(LOG_FILTER_UNITS, "WorldSession::ReadMovementInfo: Violation of MovementFlags found (%s). " \ + "MovementFlags: %u, MovementFlags2: %u for player GUID: %u. Mask %u will be removed.", \ + STRINGIZE(check), mi->GetMovementFlags(), mi->GetExtraMovementFlags(), GetPlayer()->GetGUIDLow(), maskToRemove); \ + mi->RemoveMovementFlag((maskToRemove)); \ + } \ + } + #else + #define REMOVE_VIOLATING_FLAGS(check, maskToRemove) \ + if (check) \ + mi->RemoveMovementFlag((maskToRemove)); + #endif + + + /*! This must be a packet spoofing attempt. MOVEMENTFLAG_ROOT sent from the client is not valid + in conjunction with any of the moving movement flags such as MOVEMENTFLAG_FORWARD. + It will freeze clients that receive this player's movement info. + */ + REMOVE_VIOLATING_FLAGS(mi->HasMovementFlag(MOVEMENTFLAG_ROOT), + MOVEMENTFLAG_ROOT); + + //! Cannot hover without SPELL_AURA_HOVER + REMOVE_VIOLATING_FLAGS(mi->HasMovementFlag(MOVEMENTFLAG_HOVER) && !GetPlayer()->HasAuraType(SPELL_AURA_HOVER), + MOVEMENTFLAG_HOVER); + + //! Cannot ascend and descend at the same time + REMOVE_VIOLATING_FLAGS(mi->HasMovementFlag(MOVEMENTFLAG_ASCENDING) && mi->HasMovementFlag(MOVEMENTFLAG_DESCENDING), + MOVEMENTFLAG_ASCENDING | MOVEMENTFLAG_DESCENDING); + + //! Cannot move left and right at the same time + REMOVE_VIOLATING_FLAGS(mi->HasMovementFlag(MOVEMENTFLAG_LEFT) && mi->HasMovementFlag(MOVEMENTFLAG_RIGHT), + MOVEMENTFLAG_LEFT | MOVEMENTFLAG_RIGHT); + + //! Cannot strafe left and right at the same time + REMOVE_VIOLATING_FLAGS(mi->HasMovementFlag(MOVEMENTFLAG_STRAFE_LEFT) && mi->HasMovementFlag(MOVEMENTFLAG_STRAFE_RIGHT), + MOVEMENTFLAG_STRAFE_LEFT | MOVEMENTFLAG_STRAFE_RIGHT); + + //! Cannot pitch up and down at the same time + REMOVE_VIOLATING_FLAGS(mi->HasMovementFlag(MOVEMENTFLAG_PITCH_UP) && mi->HasMovementFlag(MOVEMENTFLAG_PITCH_DOWN), + MOVEMENTFLAG_PITCH_UP | MOVEMENTFLAG_PITCH_DOWN); + + //! Cannot move forwards and backwards at the same time + REMOVE_VIOLATING_FLAGS(mi->HasMovementFlag(MOVEMENTFLAG_FORWARD) && mi->HasMovementFlag(MOVEMENTFLAG_BACKWARD), + MOVEMENTFLAG_FORWARD | MOVEMENTFLAG_BACKWARD); + + //! Cannot walk on water without SPELL_AURA_WATER_WALK + REMOVE_VIOLATING_FLAGS(mi->HasMovementFlag(MOVEMENTFLAG_WATERWALKING) && !GetPlayer()->HasAuraType(SPELL_AURA_WATER_WALK), + MOVEMENTFLAG_WATERWALKING); + + //! Cannot feather fall without SPELL_AURA_FEATHER_FALL + REMOVE_VIOLATING_FLAGS(mi->HasMovementFlag(MOVEMENTFLAG_FALLING_SLOW) && !GetPlayer()->HasAuraType(SPELL_AURA_FEATHER_FALL), + MOVEMENTFLAG_FALLING_SLOW); + + /*! Cannot fly if no fly auras present. Exception is being a GM. + Note that we check for account level instead of Player::IsGameMaster() because in some + situations it may be feasable to use .gm fly on as a GM without having .gm on, + e.g. aerial combat. + */ + + REMOVE_VIOLATING_FLAGS(mi->HasMovementFlag(MOVEMENTFLAG_FLYING | MOVEMENTFLAG_CAN_FLY) && GetSecurity() == SEC_PLAYER && + !GetPlayer()->m_mover->HasAuraType(SPELL_AURA_FLY) && + !GetPlayer()->m_mover->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED), + MOVEMENTFLAG_FLYING | MOVEMENTFLAG_CAN_FLY); + + #undef REMOVE_VIOLATING_FLAGS } void WorldSession::WriteMovementInfo(WorldPacket &data, MovementInfo* mi) @@ -901,4 +971,4 @@ void WorldSession::WriteMovementInfo(WorldPacket &data, MovementInfo* mi) WPError(false, "Incorrect sequence element detected at ReadMovementInfo"); } } -} +}
\ No newline at end of file diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp index 385b91c9f7d..4da8805614b 100755 --- a/src/server/game/Handlers/NPCHandler.cpp +++ b/src/server/game/Handlers/NPCHandler.cpp @@ -135,7 +135,7 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle) if (!unit->isCanTrainingOf(_player, true)) return; - CreatureTemplate const* ci = unit->GetCreatureInfo(); + CreatureTemplate const* ci = unit->GetCreatureTemplate(); if (!ci) { @@ -170,7 +170,7 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle) bool valid = true; bool primary_prof_first_rank = false; - for (uint8 i = 0; i < MAX_SPELL_EFFECTS ; ++i) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { if (!tSpell->learnedSpell[i]) continue; @@ -197,7 +197,7 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle) data << uint32(tSpell->reqSkillValue); //prev + req or req + 0 uint8 maxReq = 0; - for (uint8 i = 0; i < MAX_SPELL_EFFECTS ; ++i) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { if (!tSpell->learnedSpell[i]) continue; @@ -341,7 +341,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket & recv_data) if (!sScriptMgr->OnGossipHello(_player, unit)) { // _player->TalkedToCreature(unit->GetEntry(), unit->GetGUID()); - _player->PrepareGossipMenu(unit, unit->GetCreatureInfo()->GossipMenuId, true); + _player->PrepareGossipMenu(unit, unit->GetCreatureTemplate()->GossipMenuId, true); _player->SendPreparedGossip(unit); } unit->AI()->sGossipHello(_player); diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp index f278e6b017e..5f7e4ce04a8 100755 --- a/src/server/game/Handlers/PetHandler.cpp +++ b/src/server/game/Handlers/PetHandler.cpp @@ -158,8 +158,6 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid switch (spellid) { case COMMAND_STAY: //flat=1792 //STAY - pet->AttackStop(); - pet->InterruptNonMeleeSpells(false); pet->StopMoving(); pet->GetMotionMaster()->Clear(false); pet->GetMotionMaster()->MoveIdle(); @@ -652,15 +650,25 @@ void WorldSession::HandlePetRename(WorldPacket & recv_data) SQLTransaction trans = CharacterDatabase.BeginTransaction(); if (isdeclined) { - for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i) - CharacterDatabase.EscapeString(declinedname.name[i]); - trans->PAppend("DELETE FROM character_pet_declinedname WHERE owner = '%u' AND id = '%u'", _player->GetGUIDLow(), pet->GetCharmInfo()->GetPetNumber()); - trans->PAppend("INSERT INTO character_pet_declinedname (id, owner, genitive, dative, accusative, instrumental, prepositional) VALUES ('%u', '%u', '%s', '%s', '%s', '%s', '%s')", - pet->GetCharmInfo()->GetPetNumber(), _player->GetGUIDLow(), declinedname.name[0].c_str(), declinedname.name[1].c_str(), declinedname.name[2].c_str(), declinedname.name[3].c_str(), declinedname.name[4].c_str()); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_DECLINEDNAME); + stmt->setUInt32(0, pet->GetCharmInfo()->GetPetNumber()); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_CHAR_PET_DECLINEDNAME); + stmt->setUInt32(0, _player->GetGUIDLow()); + + for (uint8 i = 0; i < 5; i++) + stmt->setString(i+1, declinedname.name[i]); + + trans->Append(stmt); } - CharacterDatabase.EscapeString(name); - trans->PAppend("UPDATE character_pet SET name = '%s', renamed = '1' WHERE owner = '%u' AND id = '%u'", name.c_str(), _player->GetGUIDLow(), pet->GetCharmInfo()->GetPetNumber()); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_PET_NAME); + stmt->setString(0, name); + stmt->setUInt32(1, _player->GetGUIDLow()); + stmt->setUInt32(2, pet->GetCharmInfo()->GetPetNumber()); + trans->Append(stmt); + CharacterDatabase.CommitTransaction(trans); pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped diff --git a/src/server/game/Handlers/PetitionsHandler.cpp b/src/server/game/Handlers/PetitionsHandler.cpp index 7faabb730e4..0c2f8741b15 100755 --- a/src/server/game/Handlers/PetitionsHandler.cpp +++ b/src/server/game/Handlers/PetitionsHandler.cpp @@ -215,7 +215,10 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) // a petition is invalid, if both the owner and the type matches // we checked above, if this player is in an arenateam, so this must be // datacorruption - QueryResult result = CharacterDatabase.PQuery("SELECT petitionguid FROM petition WHERE ownerguid = '%u' AND type = '%u'", _player->GetGUIDLow(), type); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_BY_OWNER); + stmt->setUInt32(0, _player->GetGUIDLow()); + stmt->setUInt8(1, type); + PreparedQueryResult result = CharacterDatabase.Query(stmt); std::ostringstream ssInvalidPetitionGUIDs; @@ -236,8 +239,14 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) SQLTransaction trans = CharacterDatabase.BeginTransaction(); trans->PAppend("DELETE FROM petition WHERE petitionguid IN (%s)", ssInvalidPetitionGUIDs.str().c_str()); trans->PAppend("DELETE FROM petition_sign WHERE petitionguid IN (%s)", ssInvalidPetitionGUIDs.str().c_str()); - trans->PAppend("INSERT INTO petition (ownerguid, petitionguid, name, type) VALUES ('%u', '%u', '%s', '%u')", - _player->GetGUIDLow(), charter->GetGUIDLow(), name.c_str(), type); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PETITION); + stmt->setUInt32(0, _player->GetGUIDLow()); + stmt->setUInt32(1, charter->GetGUIDLow()); + stmt->setString(2, name); + stmt->setUInt8(3, uint8(type)); + trans->Append(stmt); + CharacterDatabase.CommitTransaction(trans); } @@ -250,9 +259,14 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recv_data) recv_data >> petitionguid; // petition guid // solve (possible) some strange compile problems with explicit use GUID_LOPART(petitionguid) at some GCC versions (wrong code optimization in compiler?) - uint32 petitionguid_low = GUID_LOPART(petitionguid); + uint32 petitionGuidLow = GUID_LOPART(petitionguid); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_TYPE); + + stmt->setUInt32(0, petitionGuidLow); + + PreparedQueryResult result = CharacterDatabase.Query(stmt); - QueryResult result = CharacterDatabase.PQuery("SELECT type FROM petition WHERE petitionguid = '%u'", petitionguid_low); if (!result) { sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "Petition %u is not found for player %u %s", GUID_LOPART(petitionguid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName()); @@ -265,26 +279,30 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recv_data) if (type == GUILD_CHARTER_TYPE && _player->GetGuildId()) return; - result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE petitionguid = '%u'", petitionguid_low); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_SIGNATURE); + + stmt->setUInt32(0, petitionGuidLow); + + result = CharacterDatabase.Query(stmt); // result == NULL also correct in case no sign yet if (result) signs = uint8(result->GetRowCount()); - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_PETITION_SHOW_SIGNATURES petition entry: '%u'", petitionguid_low); + sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_PETITION_SHOW_SIGNATURES petition entry: '%u'", petitionGuidLow); WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8+8+4+1+signs*12)); data << uint64(petitionguid); // petition guid data << uint64(_player->GetGUID()); // owner guid - data << uint32(petitionguid_low); // guild guid + data << uint32(petitionGuidLow); // guild guid data << uint8(signs); // sign's count for (uint8 i = 1; i <= signs; ++i) { Field* fields2 = result->Fetch(); - uint64 plguid = fields2[0].GetUInt64(); + uint32 lowGuid = fields2[0].GetUInt32(); - data << uint64(plguid); // Player GUID + data << uint64(MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER)); // Player GUID data << uint32(0); // there 0 ... result->NextRow(); @@ -311,16 +329,18 @@ void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid) uint32 type; std::string name = "NO_NAME_FOR_GUID"; - // TODO: Use CHAR_LOAD_PETITION PS - QueryResult result = CharacterDatabase.PQuery("SELECT ownerguid, name, type " - "FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid)); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION); + + stmt->setUInt32(0, GUID_LOPART(petitionguid)); + + PreparedQueryResult result = CharacterDatabase.Query(stmt); if (result) { Field* fields = result->Fetch(); ownerguid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER); name = fields[1].GetString(); - type = fields[2].GetUInt32(); + type = fields[2].GetUInt8(); } else { @@ -382,7 +402,11 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recv_data) if (!item) return; - QueryResult result = CharacterDatabase.PQuery("SELECT type FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionGuid)); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_TYPE); + + stmt->setUInt32(0, GUID_LOPART(petitionGuid)); + + PreparedQueryResult result = CharacterDatabase.Query(stmt); if (result) { @@ -422,7 +446,7 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recv_data) } } - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_PETITION_NAME); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_PETITION_NAME); stmt->setString(0, newName); stmt->setUInt32(1, GUID_LOPART(petitionGuid)); @@ -446,11 +470,12 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data) recv_data >> petitionGuid; // petition guid recv_data >> unk; - QueryResult result = CharacterDatabase.PQuery( - "SELECT ownerguid, " - " (SELECT COUNT(playerguid) FROM petition_sign WHERE petition_sign.petitionguid = '%u') AS signs, " - " type " - "FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionGuid), GUID_LOPART(petitionGuid)); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_SIGNATURES); + + stmt->setUInt32(0, GUID_LOPART(petitionGuid)); + stmt->setUInt32(1, GUID_LOPART(petitionGuid)); + + PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) { @@ -460,8 +485,8 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data) fields = result->Fetch(); uint64 ownerGuid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER); - uint8 signs = fields[1].GetUInt8(); - uint32 type = fields[2].GetUInt32(); + uint64 signs = fields[1].GetUInt64(); + uint8 type = fields[2].GetUInt8(); uint32 playerGuid = _player->GetGUIDLow(); if (GUID_LOPART(ownerGuid) == playerGuid) @@ -518,9 +543,14 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data) if (++signs > type) // client signs maximum return; - //client doesn't allow to sign petition two times by one character, but not check sign by another character from same account - //not allow sign another player from already sign player account - result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE player_account = '%u' AND petitionguid = '%u'", GetAccountId(), GUID_LOPART(petitionGuid)); + // Client doesn't allow to sign petition two times by one character, but not check sign by another character from same account + // not allow sign another player from already sign player account + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_SIG_BY_ACCOUNT); + + stmt->setUInt32(0, GetAccountId()); + stmt->setUInt32(1, GUID_LOPART(petitionGuid)); + + result = CharacterDatabase.Query(stmt); if (result) { @@ -538,7 +568,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data) return; } - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PETITION_SIGNATURE); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PETITION_SIGNATURE); stmt->setUInt32(0, GUID_LOPART(ownerGuid)); stmt->setUInt32(1, GUID_LOPART(petitionGuid)); @@ -576,7 +606,12 @@ void WorldSession::HandlePetitionDeclineOpcode(WorldPacket & recv_data) recv_data >> petitionguid; // petition guid sLog->outDebug(LOG_FILTER_NETWORKIO, "Petition %u declined by %u", GUID_LOPART(petitionguid), _player->GetGUIDLow()); - QueryResult result = CharacterDatabase.PQuery("SELECT ownerguid FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid)); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_OWNER_BY_GUID); + + stmt->setUInt32(0, GUID_LOPART(petitionguid)); + + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (!result) return; @@ -608,7 +643,12 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data) if (!player) return; - QueryResult result = CharacterDatabase.PQuery("SELECT type FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid)); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_TYPE); + + stmt->setUInt32(0, GUID_LOPART(petitionguid)); + + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (!result) return; @@ -667,7 +707,13 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data) } } - result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE petitionguid = '%u'", GUID_LOPART(petitionguid)); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_SIGNATURE); + + stmt->setUInt32(0, GUID_LOPART(petitionguid)); + + result = CharacterDatabase.Query(stmt); + // result == NULL also correct charter without signs if (result) signs = uint8(result->GetRowCount()); @@ -681,9 +727,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data) for (uint8 i = 1; i <= signs; ++i) { Field* fields2 = result->Fetch(); - plguid = fields2[0].GetUInt64(); - - data << uint64(plguid); // Player GUID + data << uint64(MAKE_NEW_GUID(fields2[0].GetUInt32(), 0, HIGHGUID_PLAYER)); // Player GUID data << uint32(0); // there 0 ... result->NextRow(); @@ -861,8 +905,15 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data) } SQLTransaction trans = CharacterDatabase.BeginTransaction(); - trans->PAppend("DELETE FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionGuid)); - trans->PAppend("DELETE FROM petition_sign WHERE petitionguid = '%u'", GUID_LOPART(petitionGuid)); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_BY_GUID); + stmt->setUInt32(0, GUID_LOPART(petitionGuid)); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE_BY_GUID); + stmt->setUInt32(0, GUID_LOPART(petitionGuid)); + trans->Append(stmt); + CharacterDatabase.CommitTransaction(trans); // created diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp index a18fbcddfca..f0e681b535c 100755 --- a/src/server/game/Handlers/QueryHandler.cpp +++ b/src/server/game/Handlers/QueryHandler.cpp @@ -33,42 +33,33 @@ void WorldSession::SendNameQueryOpcode(uint64 guid) { - Player* player = NULL; - const CharacterNameData* nameData = sWorld->GetCharacterNameData(GUID_LOPART(guid)); - if (nameData) - player = ObjectAccessor::FindPlayer(guid); + Player* player = ObjectAccessor::FindPlayer(guid); + CharacterNameData const* nameData = sWorld->GetCharacterNameData(GUID_LOPART(guid)); - // guess size WorldPacket data(SMSG_NAME_QUERY_RESPONSE, (8+1+1+1+1+1+10)); data.appendPackGUID(guid); - data << uint8(0); // added in 3.1 - if (nameData) - { - data << nameData->m_name; // played name - data << uint8(0); // realm name for cross realm BG usage - data << uint8(nameData->m_race); - data << uint8(nameData->m_gender); - data << uint8(nameData->m_class); - } - else + if (!nameData) { - data << std::string(GetTrinityString(LANG_NON_EXIST_CHARACTER)); - data << uint32(0); + data << uint8(1); // name unknown + SendPacket(&data); + return; } - if (player) + data << uint8(0); // name known + data << nameData->m_name; // played name + data << uint8(0); // realm name - only set for cross realm interaction (such as Battlegrounds) + data << uint8(nameData->m_race); + data << uint8(nameData->m_gender); + data << uint8(nameData->m_class); + + if (DeclinedName const* names = (player ? player->GetDeclinedNames() : NULL)) { - if (DeclinedName const* names = player->GetDeclinedNames()) - { - data << uint8(1); // is declined - for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i) - data << names->name[i]; - } - else - data << uint8(0); // is not declined + data << uint8(1); // Name is declined + for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i) + data << names->name[i]; } - else //TODO: decline names may also need to be stored in char name data - data << uint8(0); + else + data << uint8(0); // Name is not declined SendPacket(&data); } @@ -76,7 +67,6 @@ void WorldSession::SendNameQueryOpcode(uint64 guid) void WorldSession::HandleNameQueryOpcode(WorldPacket& recv_data) { uint64 guid; - recv_data >> guid; // This is disable by default to prevent lots of console spam diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp index 761fb9657c9..62372004f03 100755 --- a/src/server/game/Handlers/QuestHandler.cpp +++ b/src/server/game/Handlers/QuestHandler.cpp @@ -53,7 +53,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for npc, guid = %u", uint32(GUID_LOPART(guid))); Creature* cr_questgiver=questgiver->ToCreature(); - if (!cr_questgiver->IsHostileTo(_player)) // not show quest status to enemies + if (!cr_questgiver->IsHostileTo(_player)) // do not show quest status to enemies { questStatus = sScriptMgr->GetDialogStatus(_player, cr_questgiver); if (questStatus > 6) @@ -103,7 +103,7 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket & recv_data) if (sScriptMgr->OnGossipHello(_player, creature)) return; - _player->PrepareGossipMenu(creature, creature->GetCreatureInfo()->GossipMenuId, true); + _player->PrepareGossipMenu(creature, creature->GetCreatureTemplate()->GossipMenuId, true); _player->SendPreparedGossip(creature); creature->AI()->sGossipHello(_player); @@ -112,17 +112,17 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket & recv_data) void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data) { uint64 guid; - uint32 quest; + uint32 questId; uint32 unk1; - recv_data >> guid >> quest >> unk1; + recv_data >> guid >> questId >> unk1; - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), quest, unk1); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), questId, unk1); - Object* pObject = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT|TYPEMASK_ITEM|TYPEMASK_PLAYER); + Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT|TYPEMASK_ITEM|TYPEMASK_PLAYER); // no or incorrect quest giver - if (!pObject || (pObject->GetTypeId() != TYPEID_PLAYER && !pObject->hasQuest(quest)) || - (pObject->GetTypeId() == TYPEID_PLAYER && !pObject->ToPlayer()->CanShareQuest(quest))) + if (!object || (object->GetTypeId() != TYPEID_PLAYER && !object->hasQuest(questId)) || + (object->GetTypeId() == TYPEID_PLAYER && !object->ToPlayer()->CanShareQuest(questId))) { _player->PlayerTalkClass->SendCloseGossip(); _player->SetDivider(0); @@ -130,14 +130,13 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data) } // some kind of WPE protection - if (!_player->CanInteractWithQuestGiver(pObject)) + if (!_player->CanInteractWithQuestGiver(object)) return; - Quest const* qInfo = sObjectMgr->GetQuestTemplate(quest); - if (qInfo) + if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId)) { // prevent cheating - if (!GetPlayer()->CanTakeQuest(qInfo, true)) + if (!GetPlayer()->CanTakeQuest(quest, true)) { _player->PlayerTalkClass->SendCloseGossip(); _player->SetDivider(0); @@ -154,11 +153,11 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data) } } - if (_player->CanAddQuest(qInfo, true)) + if (_player->CanAddQuest(quest, true)) { - _player->AddQuest(qInfo, pObject); + _player->AddQuest(quest, object); - if (qInfo->HasFlag(QUEST_FLAGS_PARTY_ACCEPT)) + if (quest->HasFlag(QUEST_FLAGS_PARTY_ACCEPT)) { if (Group* group = _player->GetGroup()) { @@ -169,38 +168,38 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data) if (!player || player == _player) // not self continue; - if (player->CanTakeQuest(qInfo, true)) + if (player->CanTakeQuest(quest, true)) { player->SetDivider(_player->GetGUID()); //need confirmation that any gossip window will close player->PlayerTalkClass->SendCloseGossip(); - _player->SendQuestConfirmAccept(qInfo, player); + _player->SendQuestConfirmAccept(quest, player); } } } } - if (_player->CanCompleteQuest(quest)) - _player->CompleteQuest(quest); + if (_player->CanCompleteQuest(questId)) + _player->CompleteQuest(questId); - switch (pObject->GetTypeId()) + switch (object->GetTypeId()) { case TYPEID_UNIT: - sScriptMgr->OnQuestAccept(_player, (pObject->ToCreature()), qInfo); - (pObject->ToCreature())->AI()->sQuestAccept(_player, qInfo); + sScriptMgr->OnQuestAccept(_player, (object->ToCreature()), quest); + (object->ToCreature())->AI()->sQuestAccept(_player, quest); break; case TYPEID_ITEM: case TYPEID_CONTAINER: { - sScriptMgr->OnQuestAccept(_player, ((Item*)pObject), qInfo); + sScriptMgr->OnQuestAccept(_player, ((Item*)object), quest); // destroy not required for quest finish quest starting item bool destroyItem = true; for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) { - if ((qInfo->RequiredItemId[i] == ((Item*)pObject)->GetEntry()) && (((Item*)pObject)->GetTemplate()->MaxCount > 0)) + if ((quest->RequiredItemId[i] == ((Item*)object)->GetEntry()) && (((Item*)object)->GetTemplate()->MaxCount > 0)) { destroyItem = false; break; @@ -208,21 +207,21 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data) } if (destroyItem) - _player->DestroyItem(((Item*)pObject)->GetBagSlot(), ((Item*)pObject)->GetSlot(), true); + _player->DestroyItem(((Item*)object)->GetBagSlot(), ((Item*)object)->GetSlot(), true); break; } case TYPEID_GAMEOBJECT: - sScriptMgr->OnQuestAccept(_player, ((GameObject*)pObject), qInfo); - (pObject->ToGameObject())->AI()->QuestAccept(_player, qInfo); + sScriptMgr->OnQuestAccept(_player, ((GameObject*)object), quest); + (object->ToGameObject())->AI()->QuestAccept(_player, quest); break; default: break; } _player->PlayerTalkClass->SendCloseGossip(); - if (qInfo->GetSrcSpell() > 0) - _player->CastSpell(_player, qInfo->GetSrcSpell(), true); + if (quest->GetSrcSpell() > 0) + _player->CastSpell(_player, quest->GetSrcSpell(), true); return; } @@ -247,8 +246,7 @@ void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket & recv_data) return; } - Quest const* quest = sObjectMgr->GetQuestTemplate(questId); - if (quest) + if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId)) { // not sure here what should happen to quests with QUEST_FLAGS_AUTOCOMPLETE // if this breaks them, add && object->GetTypeId() == TYPEID_ITEM to this check @@ -275,15 +273,12 @@ void WorldSession::HandleQuestQueryOpcode(WorldPacket & recv_data) if (!_player) return; - uint32 quest; - recv_data >> quest; - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUEST_QUERY quest = %u", quest); + uint32 questId; + recv_data >> questId; + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUEST_QUERY quest = %u", questId); - Quest const* pQuest = sObjectMgr->GetQuestTemplate(quest); - if (pQuest) - { - _player->PlayerTalkClass->SendQuestQueryResponse(pQuest); - } + if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId)) + _player->PlayerTalkClass->SendQuestQueryResponse(quest); } void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recv_data) @@ -372,28 +367,28 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recv_data) void WorldSession::HandleQuestgiverRequestRewardOpcode(WorldPacket & recv_data) { - uint32 quest; + uint32 questId; uint64 guid; - recv_data >> guid >> quest; + recv_data >> guid >> questId; - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_REQUEST_REWARD npc = %u, quest = %u", uint32(GUID_LOPART(guid)), quest); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_REQUEST_REWARD npc = %u, quest = %u", uint32(GUID_LOPART(guid)), questId); - Object* pObject = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT); - if (!pObject || !pObject->hasInvolvedQuest(quest)) + Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT); + if (!object || !object->hasInvolvedQuest(questId)) return; // some kind of WPE protection - if (!_player->CanInteractWithQuestGiver(pObject)) + if (!_player->CanInteractWithQuestGiver(object)) return; - if (_player->CanCompleteQuest(quest)) - _player->CompleteQuest(quest); + if (_player->CanCompleteQuest(questId)) + _player->CompleteQuest(questId); - if (_player->GetQuestStatus(quest) != QUEST_STATUS_COMPLETE) + if (_player->GetQuestStatus(questId) != QUEST_STATUS_COMPLETE) return; - if (Quest const* pQuest = sObjectMgr->GetQuestTemplate(quest)) - _player->PlayerTalkClass->SendQuestGiverOfferReward(pQuest, guid, true); + if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId)) + _player->PlayerTalkClass->SendQuestGiverOfferReward(quest, guid, true); } void WorldSession::HandleQuestgiverCancel(WorldPacket& /*recv_data*/) @@ -425,22 +420,22 @@ void WorldSession::HandleQuestLogRemoveQuest(WorldPacket& recv_data) if (slot < MAX_QUEST_LOG_SIZE) { - if (uint32 quest = _player->GetQuestSlotQuestId(slot)) + if (uint32 questId = _player->GetQuestSlotQuestId(slot)) { - if (!_player->TakeQuestSourceItem(quest, true)) + if (!_player->TakeQuestSourceItem(questId, true)) return; // can't un-equip some items, reject quest cancel - if (const Quest *pQuest = sObjectMgr->GetQuestTemplate(quest)) + if (const Quest *quest = sObjectMgr->GetQuestTemplate(questId)) { - if (pQuest->HasFlag(QUEST_TRINITY_FLAGS_TIMED)) - _player->RemoveTimedQuest(quest); + if (quest->HasFlag(QUEST_TRINITY_FLAGS_TIMED)) + _player->RemoveTimedQuest(questId); } - _player->TakeQuestSourceItem(quest, true); // remove quest src item from player - _player->RemoveActiveQuest(quest); - _player->GetAchievementMgr().RemoveTimedAchievement(ACHIEVEMENT_TIMED_TYPE_QUEST, quest); + _player->TakeQuestSourceItem(questId, true); // remove quest src item from player + _player->RemoveActiveQuest(questId); + _player->GetAchievementMgr().RemoveTimedAchievement(ACHIEVEMENT_TIMED_TYPE_QUEST, questId); - sLog->outDetail("Player %u abandoned quest %u", _player->GetGUIDLow(), quest); + sLog->outDetail("Player %u abandoned quest %u", _player->GetGUIDLow(), questId); } _player->SetQuestSlot(slot, 0); @@ -495,6 +490,8 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recv_data) Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, playerGuid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT); if (!object || !object->hasInvolvedQuest(questId)) + Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT); + if (!object || !object->hasInvolvedQuest(questId)) return; // some kind of WPE protection @@ -545,7 +542,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket) sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_PUSHQUESTTOPARTY questId = %u", questId); - if (Quest const* pQuest = sObjectMgr->GetQuestTemplate(questId)) + if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId)) { if (Group* group = _player->GetGroup()) { @@ -558,7 +555,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket) _player->SendPushToPartyResponse(player, QUEST_PARTY_MSG_SHARING_QUEST); - if (!player->SatisfyQuestStatus(pQuest, false)) + if (!player->SatisfyQuestStatus(quest, false)) { _player->SendPushToPartyResponse(player, QUEST_PARTY_MSG_HAVE_QUEST); continue; @@ -570,7 +567,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket) continue; } - if (!player->CanTakeQuest(pQuest, false)) + if (!player->CanTakeQuest(quest, false)) { _player->SendPushToPartyResponse(player, QUEST_PARTY_MSG_CANT_TAKE_QUEST); continue; @@ -588,7 +585,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket) continue; } - player->PlayerTalkClass->SendQuestGiverQuestDetails(pQuest, _player->GetGUID(), true); + player->PlayerTalkClass->SendQuestGiverQuestDetails(quest, _player->GetGUID(), true); player->SetDivider(_player->GetGUID()); } } @@ -648,18 +645,19 @@ uint32 WorldSession::getDialogStatus(Player* player, Object* questgiver, uint32 { uint32 result2 = 0; uint32 quest_id = i->second; - Quest const* pQuest = sObjectMgr->GetQuestTemplate(quest_id); - if (!pQuest) continue; + Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id); + if (!quest) + continue; - ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, pQuest->GetQuestId()); + ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, quest->GetQuestId()); if (!sConditionMgr->IsObjectMeetToConditions(player, conditions)) continue; QuestStatus status = player->GetQuestStatus(quest_id); if ((status == QUEST_STATUS_COMPLETE && !player->GetQuestRewardStatus(quest_id)) || - (pQuest->IsAutoComplete() && player->CanTakeQuest(pQuest, false))) + (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))) { - if (pQuest->IsAutoComplete() && pQuest->IsRepeatable()) + if (quest->IsAutoComplete() && quest->IsRepeatable()) result2 = DIALOG_STATUS_REWARD_REP; else result2 = DIALOG_STATUS_REWARD; @@ -675,26 +673,26 @@ uint32 WorldSession::getDialogStatus(Player* player, Object* questgiver, uint32 { uint32 result2 = 0; uint32 quest_id = i->second; - Quest const* pQuest = sObjectMgr->GetQuestTemplate(quest_id); - if (!pQuest) + Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id); + if (!quest) continue; - ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, pQuest->GetQuestId()); + ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, quest->GetQuestId()); if (!sConditionMgr->IsObjectMeetToConditions(player, conditions)) continue; QuestStatus status = player->GetQuestStatus(quest_id); if (status == QUEST_STATUS_NONE) { - if (player->CanSeeStartQuest(pQuest)) + if (player->CanSeeStartQuest(quest)) { - if (player->SatisfyQuestLevel(pQuest, false)) + if (player->SatisfyQuestLevel(quest, false)) { - if (pQuest->IsAutoComplete() || (pQuest->IsRepeatable() && player->IsQuestRewarded(quest_id))) + if (quest->IsAutoComplete() || (quest->IsRepeatable() && player->IsQuestRewarded(quest_id))) result2 = DIALOG_STATUS_REWARD_REP; - else if (player->getLevel() <= ((player->GetQuestLevel(pQuest) == -1) ? player->getLevel() : player->GetQuestLevel(pQuest) + sWorld->getIntConfig(CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF))) + else if (player->getLevel() <= ((player->GetQuestLevel(quest) == -1) ? player->getLevel() : player->GetQuestLevel(quest) + sWorld->getIntConfig(CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF))) { - if (pQuest->HasFlag(QUEST_FLAGS_DAILY) || pQuest->HasFlag(QUEST_FLAGS_WEEKLY)) + if (quest->HasFlag(QUEST_FLAGS_DAILY) || quest->HasFlag(QUEST_FLAGS_WEEKLY)) result2 = DIALOG_STATUS_AVAILABLE_REP; else result2 = DIALOG_STATUS_AVAILABLE; diff --git a/src/server/game/Handlers/SkillHandler.cpp b/src/server/game/Handlers/SkillHandler.cpp index 886368821f5..cec5ea2bbda 100755 --- a/src/server/game/Handlers/SkillHandler.cpp +++ b/src/server/game/Handlers/SkillHandler.cpp @@ -110,4 +110,3 @@ void WorldSession::HandleUnlearnSkillOpcode(WorldPacket& recv_data) recv_data >> skillId; GetPlayer()->SetSkill(skillId, 0, 0, 0); } - diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp index 4e3a5a91db7..c56d86d11db 100755 --- a/src/server/game/Handlers/SpellHandler.cpp +++ b/src/server/game/Handlers/SpellHandler.cpp @@ -236,7 +236,12 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) if (item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED))// wrapped? { - QueryResult result = CharacterDatabase.PQuery("SELECT entry, flags FROM character_gifts WHERE item_guid = '%u'", item->GetGUIDLow()); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_GIFT_BY_ITEM); + + stmt->setUInt32(0, item->GetGUIDLow()); + + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (result) { Field* fields = result->Fetch(); @@ -255,7 +260,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) return; } - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GIFT); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GIFT); stmt->setUInt32(0, item->GetGUIDLow()); @@ -656,13 +661,22 @@ void WorldSession::HandleUpdateProjectilePosition(WorldPacket& recvPacket) uint8 castCount; float x, y, z; // Position of missile hit - recvPacket.readPackGUID(casterGuid); + recvPacket >> casterGuid; recvPacket >> spellId; recvPacket >> castCount; recvPacket >> x; recvPacket >> y; recvPacket >> z; + Unit* caster = ObjectAccessor::GetUnit(*_player, casterGuid); + Spell* spell = caster ? caster->FindCurrentSpellBySpellId(spellId) : NULL; + if (spell && spell->m_targets.HasDst()) + { + Position pos = *spell->m_targets.GetDstPos(); + pos.Relocate(x, y, z); + spell->m_targets.ModDst(pos); + } + WorldPacket data(SMSG_SET_PROJECTILE_POSITION, 21); data << uint64(casterGuid); data << uint8(castCount); diff --git a/src/server/game/Handlers/TaxiHandler.cpp b/src/server/game/Handlers/TaxiHandler.cpp index 44889e6dda8..b774fbcba70 100755 --- a/src/server/game/Handlers/TaxiHandler.cpp +++ b/src/server/game/Handlers/TaxiHandler.cpp @@ -103,7 +103,7 @@ void WorldSession::SendTaxiMenu(Creature* unit) sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_TAXINODE_STATUS_QUERY %u ", curloc); - WorldPacket data(SMSG_SHOWTAXINODES, (4+8+4+8*4)); + WorldPacket data(SMSG_SHOWTAXINODES, (4 + 8 + 4 + 8 * 4)); data << uint32(1); data << uint64(unit->GetGUID()); data << uint32(curloc); diff --git a/src/server/game/Handlers/TicketHandler.cpp b/src/server/game/Handlers/TicketHandler.cpp index a270d42b000..d6675188f6e 100755 --- a/src/server/game/Handlers/TicketHandler.cpp +++ b/src/server/game/Handlers/TicketHandler.cpp @@ -38,7 +38,7 @@ void WorldSession::HandleGMTicketCreateOpcode(WorldPacket & recv_data) return; } - GMTicketResponse response = GMTICKET_RESPONSE_FAILURE; + GMTicketResponse response = GMTICKET_RESPONSE_CREATE_ERROR; // Player must not have ticket if (!sTicketMgr->GetTicketByPlayer(GetPlayer()->GetGUID())) { @@ -48,7 +48,7 @@ void WorldSession::HandleGMTicketCreateOpcode(WorldPacket & recv_data) sWorld->SendGMText(LANG_COMMAND_TICKETNEW, GetPlayer()->GetName(), ticket->GetId()); - response = GMTICKET_RESPONSE_SUCCESS; + response = GMTICKET_RESPONSE_CREATE_SUCCESS; } WorldPacket data(SMSG_GMTICKET_CREATE, 4); @@ -61,8 +61,8 @@ void WorldSession::HandleGMTicketUpdateOpcode(WorldPacket & recv_data) std::string message; recv_data >> message; - GMTicketResponse response = GMTICKET_RESPONSE_FAILURE; - if (GmTicket *ticket = sTicketMgr->GetTicketByPlayer(GetPlayer()->GetGUID())) + GMTicketResponse response = GMTICKET_RESPONSE_UPDATE_ERROR; + if (GmTicket* ticket = sTicketMgr->GetTicketByPlayer(GetPlayer()->GetGUID())) { SQLTransaction trans = SQLTransaction(NULL); ticket->SetMessage(message); @@ -70,7 +70,7 @@ void WorldSession::HandleGMTicketUpdateOpcode(WorldPacket & recv_data) sWorld->SendGMText(LANG_COMMAND_TICKETUPDATED, GetPlayer()->GetName(), ticket->GetId()); - response = GMTICKET_RESPONSE_SUCCESS; + response = GMTICKET_RESPONSE_UPDATE_SUCCESS; } WorldPacket data(SMSG_GMTICKET_UPDATETEXT, 4); @@ -176,6 +176,8 @@ void WorldSession::HandleReportLag(WorldPacket& recv_data) stmt->setFloat (3, x); stmt->setFloat (4, y); stmt->setFloat (5, z); + stmt->setUInt32(6, GetLatency()); + stmt->setUInt32(7, time(NULL)); CharacterDatabase.Execute(stmt); } diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp index b51f13a5063..b2a89ed3021 100755 --- a/src/server/game/Handlers/TradeHandler.cpp +++ b/src/server/game/Handlers/TradeHandler.cpp @@ -412,7 +412,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) trader->GetSession()->SendTradeStatus(TRADE_STATUS_TRADE_ACCEPT); // test if item will fit in each inventory - hisCanCompleteTrade = (trader->CanStoreItems(myItems, TRADE_SLOT_TRADED_COUNT) == EQUIP_ERR_OK); + hisCanCompleteTrade = (trader->CanStoreItems(myItems, TRADE_SLOT_TRADED_COUNT) == EQUIP_ERR_OK); myCanCompleteTrade = (_player->CanStoreItems(hisItems, TRADE_SLOT_TRADED_COUNT) == EQUIP_ERR_OK); clearAcceptTradeMode(myItems, hisItems); @@ -551,7 +551,7 @@ void WorldSession::HandleBeginTradeOpcode(WorldPacket& recvPacket) void WorldSession::SendCancelTrade() { - if (m_playerRecentlyLogout) + if (PlayerRecentlyLoggedOut() || PlayerLogout()) return; SendTradeStatus(TRADE_STATUS_TRADE_CANCELED); @@ -566,15 +566,12 @@ void WorldSession::HandleCancelTradeOpcode(WorldPacket& /*recvPacket*/) void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket) { - if (GetPlayer()->m_trade) - { - recvPacket.rfinish(); - return; - } - uint64 ID; recvPacket >> ID; + if (GetPlayer()->m_trade) + return; + if (!GetPlayer()->isAlive()) { SendTradeStatus(TRADE_STATUS_YOU_DEAD); @@ -748,4 +745,3 @@ void WorldSession::HandleClearTradeItemOpcode(WorldPacket& recvPacket) my_trade->SetItem(TradeSlots(tradeSlot), NULL); } - diff --git a/src/server/game/Handlers/VehicleHandler.cpp b/src/server/game/Handlers/VehicleHandler.cpp index ce4f6ccb8fe..cfd73c2c987 100644 --- a/src/server/game/Handlers/VehicleHandler.cpp +++ b/src/server/game/Handlers/VehicleHandler.cpp @@ -81,7 +81,9 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recv_data) uint64 guid; // current vehicle guid recv_data.readPackGUID(guid); - ReadMovementInfo(recv_data, &vehicle_base->m_movementInfo); + MovementInfo movementInfo; + ReadMovementInfo(recv_data, &movementInfo); + vehicle_base->m_movementInfo = movementInfo; uint64 accessory; // accessory guid recv_data.readPackGUID(accessory); diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp index 722b7089a17..8078a91d082 100755 --- a/src/server/game/Instances/InstanceSaveMgr.cpp +++ b/src/server/game/Instances/InstanceSaveMgr.cpp @@ -124,11 +124,21 @@ InstanceSave* InstanceSaveManager::GetInstanceSave(uint32 InstanceId) void InstanceSaveManager::DeleteInstanceFromDB(uint32 instanceid) { SQLTransaction trans = CharacterDatabase.BeginTransaction(); - trans->PAppend("DELETE FROM instance WHERE id = '%u'", instanceid); - trans->PAppend("DELETE FROM character_instance WHERE instance = '%u'", instanceid); - trans->PAppend("DELETE FROM group_instance WHERE instance = '%u'", instanceid); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INSTANCE_BY_INSTANCE); + stmt->setUInt32(0, instanceid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE_BY_INSTANCE); + stmt->setUInt32(0, instanceid); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_INSTANCE_BY_INSTANCE); + stmt->setUInt32(0, instanceid); + trans->Append(stmt); + CharacterDatabase.CommitTransaction(trans); - // respawn times should be deleted only when the map gets unloaded + // Respawn times should be deleted only when the map gets unloaded } void InstanceSaveManager::RemoveInstanceSave(uint32 InstanceId) @@ -250,13 +260,13 @@ void InstanceSaveManager::LoadInstances() CharacterDatabase.DirectExecute("DELETE i.* FROM instance AS i LEFT JOIN character_instance AS ci ON i.id = ci.instance LEFT JOIN group_instance AS gi ON i.id = gi.instance WHERE ci.guid IS NULL AND gi.guid IS NULL"); // Delete invalid references to instance - CharacterDatabase.DirectExecute(CharacterDatabase.GetPreparedStatement(CHAR_DEL_NONEXISTENT_INSTANCE_CREATURE_RESPAWNS)); - CharacterDatabase.DirectExecute(CharacterDatabase.GetPreparedStatement(CHAR_DEL_NONEXISTENT_INSTANCE_GO_RESPAWNS)); + CharacterDatabase.DirectExecute("DELETE FROM creature_respawn WHERE instanceId > 0 AND instanceId NOT IN (SELECT id FROM instance)"); + CharacterDatabase.DirectExecute("DELETE FROM gameobject_respawn WHERE instanceId > 0 AND instanceId NOT IN (SELECT id FROM instance)"); CharacterDatabase.DirectExecute("DELETE tmp.* FROM character_instance AS tmp LEFT JOIN instance ON tmp.instance = instance.id WHERE tmp.instance > 0 AND instance.id IS NULL"); CharacterDatabase.DirectExecute("DELETE tmp.* FROM group_instance AS tmp LEFT JOIN instance ON tmp.instance = instance.id WHERE tmp.instance > 0 AND instance.id IS NULL"); // Clean invalid references to instance - CharacterDatabase.DirectExecute(CharacterDatabase.GetPreparedStatement(CHAR_UPD_NONEXISTENT_INSTANCE_FOR_CORPSES)); + CharacterDatabase.DirectExecute("UPDATE corpse SET instanceId = 0 WHERE instanceId > 0 AND instanceId NOT IN (SELECT id FROM instance)"); CharacterDatabase.DirectExecute("UPDATE characters AS tmp LEFT JOIN instance ON tmp.instance_id = instance.id SET tmp.instance_id = 0 WHERE tmp.instance_id > 0 AND instance.id IS NULL"); // Initialize instance id storage (Needs to be done after the trash has been clean out) @@ -348,7 +358,7 @@ void InstanceSaveManager::LoadResetTimes() { Field* fields = result->Fetch(); uint32 mapid = fields[0].GetUInt16(); - Difficulty difficulty = Difficulty(fields[1].GetUInt32()); + Difficulty difficulty = Difficulty(fields[1].GetUInt8()); uint64 oldresettime = fields[2].GetUInt32(); MapDifficulty const* mapDiff = GetMapDifficultyData(mapid, difficulty); @@ -568,9 +578,22 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b // delete them from the DB, even if not loaded SQLTransaction trans = CharacterDatabase.BeginTransaction(); - trans->PAppend("DELETE FROM character_instance USING character_instance LEFT JOIN instance ON character_instance.instance = id WHERE map = '%u' and difficulty='%u'", mapid, difficulty); - trans->PAppend("DELETE FROM group_instance USING group_instance LEFT JOIN instance ON group_instance.instance = id WHERE map = '%u' and difficulty='%u'", mapid, difficulty); - trans->PAppend("DELETE FROM instance WHERE map = '%u' and difficulty='%u'", mapid, difficulty); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE_BY_MAP_DIFF); + stmt->setUInt16(0, uint16(mapid)); + stmt->setUInt8(1, uint8(difficulty)); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_INSTANCE_BY_MAP_DIFF); + stmt->setUInt16(0, uint16(mapid)); + stmt->setUInt8(1, uint8(difficulty)); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INSTANCE_BY_MAP_DIFF); + stmt->setUInt16(0, uint16(mapid)); + stmt->setUInt8(1, uint8(difficulty)); + trans->Append(stmt); + CharacterDatabase.CommitTransaction(trans); // calculate the next reset time @@ -580,13 +603,13 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b if (period < DAY) period = DAY; - uint32 next_reset = ((resetTime + MINUTE) / DAY * DAY) + period + diff; + uint32 next_reset = uint32(((resetTime + MINUTE) / DAY * DAY) + period + diff); SetResetTimeFor(mapid, difficulty, next_reset); ScheduleReset(true, time_t(next_reset-3600), InstResetEvent(1, mapid, difficulty, 0)); // Update it in the DB - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GLOBAL_INSTANCE_RESETTIME); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GLOBAL_INSTANCE_RESETTIME); stmt->setUInt32(0, next_reset); stmt->setUInt16(1, uint16(mapid)); @@ -639,4 +662,4 @@ uint32 InstanceSaveManager::GetNumBoundGroupsTotal() ret += itr->second->GetGroupCount(); return ret; -}
\ No newline at end of file +} diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp index d0a96e3b62e..66621dc43ee 100755 --- a/src/server/game/Instances/InstanceScript.cpp +++ b/src/server/game/Instances/InstanceScript.cpp @@ -397,22 +397,22 @@ void InstanceScript::SendEncounterUnit(uint32 type, Unit* unit /*= NULL*/, uint8 switch (type) { - case ENCOUNTER_FRAME_ADD: - case ENCOUNTER_FRAME_REMOVE: - case 2: + case ENCOUNTER_FRAME_ENGAGE: + case ENCOUNTER_FRAME_DISENGAGE: + case ENCOUNTER_FRAME_UPDATE_PRIORITY: data.append(unit->GetPackGUID()); data << uint8(param1); break; - case 3: - case 4: - case 6: + case ENCOUNTER_FRAME_ADD_TIMER: + case ENCOUNTER_FRAME_ENABLE_OBJECTIVE: + case ENCOUNTER_FRAME_DISABLE_OBJECTIVE: data << uint8(param1); - data << uint8(param2); break; - case 5: + case ENCOUNTER_FRAME_UPDATE_OBJECTIVE: data << uint8(param1); + data << uint8(param2); break; - case 7: + case ENCOUNTER_FRAME_UNK7: default: break; } diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h index 69f11c203c1..71f1572624b 100755 --- a/src/server/game/Instances/InstanceScript.h +++ b/src/server/game/Instances/InstanceScript.h @@ -42,8 +42,14 @@ typedef std::set<Creature*> MinionSet; enum EncounterFrameType { - ENCOUNTER_FRAME_ADD = 0, - ENCOUNTER_FRAME_REMOVE = 1, + ENCOUNTER_FRAME_ENGAGE = 0, + ENCOUNTER_FRAME_DISENGAGE = 1, + ENCOUNTER_FRAME_UPDATE_PRIORITY = 2, + ENCOUNTER_FRAME_ADD_TIMER = 3, + ENCOUNTER_FRAME_ENABLE_OBJECTIVE = 4, + ENCOUNTER_FRAME_UPDATE_OBJECTIVE = 5, + ENCOUNTER_FRAME_DISABLE_OBJECTIVE = 6, + ENCOUNTER_FRAME_UNK7 = 7, // Seems to have something to do with sorting the encounter units }; enum EncounterState diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index edc8d24c635..2100eb26346 100755 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -26,7 +26,8 @@ #include "SpellInfo.h" #include "Group.h" -static Rates const qualityToRate[MAX_ITEM_QUALITY] = { +static Rates const qualityToRate[MAX_ITEM_QUALITY] = +{ RATE_DROP_ITEM_POOR, // ITEM_QUALITY_POOR RATE_DROP_ITEM_NORMAL, // ITEM_QUALITY_NORMAL RATE_DROP_ITEM_UNCOMMON, // ITEM_QUALITY_UNCOMMON @@ -116,7 +117,7 @@ uint32 LootStore::LoadLootTable() uint16 lootmode = fields[3].GetUInt16(); uint8 group = fields[4].GetUInt8(); int32 mincountOrRef = fields[5].GetInt32(); - int32 maxcount = fields[6].GetInt32(); + int32 maxcount = fields[6].GetUInt8(); if (maxcount > std::numeric_limits<uint8>::max()) { @@ -147,7 +148,6 @@ uint32 LootStore::LoadLootTable() // Adds current row to the template tab->second->AddEntry(storeitem); ++count; - } while (result->NextRow()); @@ -205,12 +205,12 @@ LootTemplate* LootStore::GetLootForConditionFill(uint32 loot_id) return tab->second; } -uint32 LootStore::LoadAndCollectLootIds(LootIdSet& ids_set) +uint32 LootStore::LoadAndCollectLootIds(LootIdSet& lootIdSet) { uint32 count = LoadLootTable(); for (LootTemplateMap::const_iterator tab = m_LootTemplates.begin(); tab != m_LootTemplates.end(); ++tab) - ids_set.insert(tab->first); + lootIdSet.insert(tab->first); return count; } @@ -221,10 +221,10 @@ void LootStore::CheckLootRefs(LootIdSet* ref_set) const ltItr->second->CheckLootRefs(m_LootTemplates, ref_set); } -void LootStore::ReportUnusedIds(LootIdSet const& ids_set) const +void LootStore::ReportUnusedIds(LootIdSet const& lootIdSet) const { // all still listed ids isn't referenced - for (LootIdSet::const_iterator itr = ids_set.begin(); itr != ids_set.end(); ++itr) + for (LootIdSet::const_iterator itr = lootIdSet.begin(); itr != lootIdSet.end(); ++itr) sLog->outErrorDb("Table '%s' entry %d isn't %s and not referenced from loot, and then useless.", GetName(), *itr, GetEntryName()); } @@ -296,7 +296,6 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const sLog->outErrorDb("Table '%s' entry %d item %d: max count (%u) less that min count (%i) - skipped", store.GetName(), entry, itemid, int32(maxcount), mincountOrRef); return false; } - } else // mincountOrRef < 0 { @@ -514,7 +513,9 @@ QuestItemList* Loot::FillFFALoot(Player* player) QuestItemList* Loot::FillQuestLoot(Player* player) { - if (items.size() == MAX_NR_LOOT_ITEMS) return NULL; + if (items.size() == MAX_NR_LOOT_ITEMS) + return NULL; + QuestItemList* ql = new QuestItemList(); for (uint8 i = 0; i < quest_items.size(); ++i) @@ -736,7 +737,7 @@ bool Loot::hasItemFor(Player* player) const if (q_itr != lootPlayerQuestItems.end()) { QuestItemList* q_list = q_itr->second; - for (QuestItemList::const_iterator qi = q_list->begin() ; qi != q_list->end(); ++qi) + for (QuestItemList::const_iterator qi = q_list->begin(); qi != q_list->end(); ++qi) { const LootItem &item = quest_items[qi->index]; if (!qi->is_looted && !item.is_looted) @@ -749,7 +750,7 @@ bool Loot::hasItemFor(Player* player) const if (ffa_itr != lootPlayerFFAItems.end()) { QuestItemList* ffa_list = ffa_itr->second; - for (QuestItemList::const_iterator fi = ffa_list->begin() ; fi != ffa_list->end(); ++fi) + for (QuestItemList::const_iterator fi = ffa_list->begin(); fi != ffa_list->end(); ++fi) { const LootItem &item = items[fi->index]; if (!fi->is_looted && !item.is_looted) @@ -761,8 +762,8 @@ bool Loot::hasItemFor(Player* player) const QuestItemMap::const_iterator nn_itr = lootPlayerNonQuestNonFFAConditionalItems.find(player->GetGUIDLow()); if (nn_itr != lootPlayerNonQuestNonFFAConditionalItems.end()) { - QuestItemList* conditional_list = nn_itr->second; - for (QuestItemList::const_iterator ci = conditional_list->begin() ; ci != conditional_list->end(); ++ci) + QuestItemList* conditional_list = nn_itr->second; + for (QuestItemList::const_iterator ci = conditional_list->begin(); ci != conditional_list->end(); ++ci) { const LootItem &item = items[ci->index]; if (!ci->is_looted && !item.is_looted) @@ -903,7 +904,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) if (q_itr != lootPlayerQuestItems.end()) { QuestItemList* q_list = q_itr->second; - for (QuestItemList::const_iterator qi = q_list->begin() ; qi != q_list->end(); ++qi) + for (QuestItemList::const_iterator qi = q_list->begin(); qi != q_list->end(); ++qi) { LootItem &item = l.quest_items[qi->index]; if (!qi->is_looted && !item.is_looted) @@ -921,7 +922,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) if (ffa_itr != lootPlayerFFAItems.end()) { QuestItemList* ffa_list = ffa_itr->second; - for (QuestItemList::const_iterator fi = ffa_list->begin() ; fi != ffa_list->end(); ++fi) + for (QuestItemList::const_iterator fi = ffa_list->begin(); fi != ffa_list->end(); ++fi) { LootItem &item = l.items[fi->index]; if (!fi->is_looted && !item.is_looted) @@ -938,8 +939,8 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) QuestItemMap::const_iterator nn_itr = lootPlayerNonQuestNonFFAConditionalItems.find(lv.viewer->GetGUIDLow()); if (nn_itr != lootPlayerNonQuestNonFFAConditionalItems.end()) { - QuestItemList* conditional_list = nn_itr->second; - for (QuestItemList::const_iterator ci = conditional_list->begin() ; ci != conditional_list->end(); ++ci) + QuestItemList* conditional_list = nn_itr->second; + for (QuestItemList::const_iterator ci = conditional_list->begin(); ci != conditional_list->end(); ++ci) { LootItem &item = l.items[ci->index]; if (!ci->is_looted && !item.is_looted) @@ -1288,7 +1289,7 @@ bool LootTemplate::HasQuestDrop(LootTemplateMap const& store, uint8 groupId) con } // Now processing groups - for (LootGroups::const_iterator i = Groups.begin() ; i != Groups.end(); ++i) + for (LootGroups::const_iterator i = Groups.begin(); i != Groups.end(); ++i) if (i->HasQuestDrop()) return true; @@ -1306,7 +1307,7 @@ bool LootTemplate::HasQuestDropForPlayer(LootTemplateMap const& store, Player co } // Checking non-grouped entries - for (LootStoreItemList::const_iterator i = Entries.begin() ; i != Entries.end(); ++i) + for (LootStoreItemList::const_iterator i = Entries.begin(); i != Entries.end(); ++i) { if (i->mincountOrRef < 0) // References processing { @@ -1421,8 +1422,8 @@ void LoadLootTemplates_Creature() uint32 oldMSTime = getMSTime(); - LootIdSet ids_set, ids_setUsed; - uint32 count = LootTemplates_Creature.LoadAndCollectLootIds(ids_set); + LootIdSet lootIdSet, lootIdSetUsed; + uint32 count = LootTemplates_Creature.LoadAndCollectLootIds(lootIdSet); // Remove real entries and check loot existence CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates(); @@ -1430,18 +1431,18 @@ void LoadLootTemplates_Creature() { if (uint32 lootid = itr->second.lootid) { - if (ids_set.find(lootid) == ids_set.end()) + if (lootIdSet.find(lootid) == lootIdSet.end()) LootTemplates_Creature.ReportNotExistedId(lootid); else - ids_setUsed.insert(lootid); + lootIdSetUsed.insert(lootid); } } - for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr) - ids_set.erase(*itr); + for (LootIdSet::const_iterator itr = lootIdSetUsed.begin(); itr != lootIdSetUsed.end(); ++itr) + lootIdSet.erase(*itr); // output error for any still listed (not referenced from appropriate table) ids - LootTemplates_Creature.ReportUnusedIds(ids_set); + LootTemplates_Creature.ReportUnusedIds(lootIdSet); if (count) sLog->outString(">> Loaded %u creature loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); @@ -1457,7 +1458,7 @@ void LoadLootTemplates_Disenchant() uint32 oldMSTime = getMSTime(); - LootIdSet lootIdSet, loodIdSetUsed; + LootIdSet lootIdSet, lootIdSetUsed; uint32 count = LootTemplates_Disenchant.LoadAndCollectLootIds(lootIdSet); for (uint32 i = 0; i < sItemDisenchantLootStore.GetNumRows(); ++i) @@ -1470,10 +1471,10 @@ void LoadLootTemplates_Disenchant() if (lootIdSet.find(lootid) == lootIdSet.end()) LootTemplates_Disenchant.ReportNotExistedId(lootid); else - loodIdSetUsed.insert(lootid); + lootIdSetUsed.insert(lootid); } - for (LootIdSet::const_iterator itr = loodIdSetUsed.begin(); itr != loodIdSetUsed.end(); ++itr) + for (LootIdSet::const_iterator itr = lootIdSetUsed.begin(); itr != lootIdSetUsed.end(); ++itr) lootIdSet.erase(*itr); // output error for any still listed (not referenced from appropriate table) ids @@ -1492,17 +1493,17 @@ void LoadLootTemplates_Fishing() uint32 oldMSTime = getMSTime(); - LootIdSet ids_set; - uint32 count = LootTemplates_Fishing.LoadAndCollectLootIds(ids_set); + LootIdSet lootIdSet; + uint32 count = LootTemplates_Fishing.LoadAndCollectLootIds(lootIdSet); // remove real entries and check existence loot for (uint32 i = 1; i < sAreaStore.GetNumRows(); ++i) if (AreaTableEntry const* areaEntry = sAreaStore.LookupEntry(i)) - if (ids_set.find(areaEntry->ID) != ids_set.end()) - ids_set.erase(areaEntry->ID); + if (lootIdSet.find(areaEntry->ID) != lootIdSet.end()) + lootIdSet.erase(areaEntry->ID); // output error for any still listed (not referenced from appropriate table) ids - LootTemplates_Fishing.ReportUnusedIds(ids_set); + LootTemplates_Fishing.ReportUnusedIds(lootIdSet); if (count) sLog->outString(">> Loaded %u fishing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); @@ -1518,8 +1519,8 @@ void LoadLootTemplates_Gameobject() uint32 oldMSTime = getMSTime(); - LootIdSet ids_set, ids_setUsed; - uint32 count = LootTemplates_Gameobject.LoadAndCollectLootIds(ids_set); + LootIdSet lootIdSet, lootIdSetUsed; + uint32 count = LootTemplates_Gameobject.LoadAndCollectLootIds(lootIdSet); // remove real entries and check existence loot GameObjectTemplateContainer const* gotc = sObjectMgr->GetGameObjectTemplates(); @@ -1527,18 +1528,18 @@ void LoadLootTemplates_Gameobject() { if (uint32 lootid = itr->second.GetLootId()) { - if (sObjectMgr->IsGoOfSpecificEntrySpawned(itr->second.entry) && ids_set.find(lootid) == ids_set.end()) + if (lootIdSet.find(lootid) == lootIdSet.end()) LootTemplates_Gameobject.ReportNotExistedId(lootid); else - ids_setUsed.insert(lootid); + lootIdSetUsed.insert(lootid); } } - for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr) - ids_set.erase(*itr); + for (LootIdSet::const_iterator itr = lootIdSetUsed.begin(); itr != lootIdSetUsed.end(); ++itr) + lootIdSet.erase(*itr); // output error for any still listed (not referenced from appropriate table) ids - LootTemplates_Gameobject.ReportUnusedIds(ids_set); + LootTemplates_Gameobject.ReportUnusedIds(lootIdSet); if (count) sLog->outString(">> Loaded %u gameobject loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); @@ -1554,17 +1555,17 @@ void LoadLootTemplates_Item() uint32 oldMSTime = getMSTime(); - LootIdSet ids_set; - uint32 count = LootTemplates_Item.LoadAndCollectLootIds(ids_set); + LootIdSet lootIdSet; + uint32 count = LootTemplates_Item.LoadAndCollectLootIds(lootIdSet); // remove real entries and check existence loot ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore(); for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr) - if (ids_set.find(itr->second.ItemId) != ids_set.end() && itr->second.Flags & ITEM_PROTO_FLAG_OPENABLE) - ids_set.erase(itr->second.ItemId); + if (lootIdSet.find(itr->second.ItemId) != lootIdSet.end() && itr->second.Flags & ITEM_PROTO_FLAG_OPENABLE) + lootIdSet.erase(itr->second.ItemId); // output error for any still listed (not referenced from appropriate table) ids - LootTemplates_Item.ReportUnusedIds(ids_set); + LootTemplates_Item.ReportUnusedIds(lootIdSet); if (count) sLog->outString(">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); @@ -1580,8 +1581,8 @@ void LoadLootTemplates_Milling() uint32 oldMSTime = getMSTime(); - LootIdSet ids_set; - uint32 count = LootTemplates_Milling.LoadAndCollectLootIds(ids_set); + LootIdSet lootIdSet; + uint32 count = LootTemplates_Milling.LoadAndCollectLootIds(lootIdSet); // remove real entries and check existence loot ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore(); @@ -1590,12 +1591,12 @@ void LoadLootTemplates_Milling() if (!(itr->second.Flags & ITEM_PROTO_FLAG_MILLABLE)) continue; - if (ids_set.find(itr->second.ItemId) != ids_set.end()) - ids_set.erase(itr->second.ItemId); + if (lootIdSet.find(itr->second.ItemId) != lootIdSet.end()) + lootIdSet.erase(itr->second.ItemId); } // output error for any still listed (not referenced from appropriate table) ids - LootTemplates_Milling.ReportUnusedIds(ids_set); + LootTemplates_Milling.ReportUnusedIds(lootIdSet); if (count) sLog->outString(">> Loaded %u milling loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); @@ -1611,8 +1612,8 @@ void LoadLootTemplates_Pickpocketing() uint32 oldMSTime = getMSTime(); - LootIdSet ids_set, ids_setUsed; - uint32 count = LootTemplates_Pickpocketing.LoadAndCollectLootIds(ids_set); + LootIdSet lootIdSet, lootIdSetUsed; + uint32 count = LootTemplates_Pickpocketing.LoadAndCollectLootIds(lootIdSet); // Remove real entries and check loot existence CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates(); @@ -1620,18 +1621,18 @@ void LoadLootTemplates_Pickpocketing() { if (uint32 lootid = itr->second.pickpocketLootId) { - if (ids_set.find(lootid) == ids_set.end()) + if (lootIdSet.find(lootid) == lootIdSet.end()) LootTemplates_Pickpocketing.ReportNotExistedId(lootid); else - ids_setUsed.insert(lootid); + lootIdSetUsed.insert(lootid); } } - for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr) - ids_set.erase(*itr); + for (LootIdSet::const_iterator itr = lootIdSetUsed.begin(); itr != lootIdSetUsed.end(); ++itr) + lootIdSet.erase(*itr); // output error for any still listed (not referenced from appropriate table) ids - LootTemplates_Pickpocketing.ReportUnusedIds(ids_set); + LootTemplates_Pickpocketing.ReportUnusedIds(lootIdSet); if (count) sLog->outString(">> Loaded %u pickpocketing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); @@ -1647,8 +1648,8 @@ void LoadLootTemplates_Prospecting() uint32 oldMSTime = getMSTime(); - LootIdSet ids_set; - uint32 count = LootTemplates_Prospecting.LoadAndCollectLootIds(ids_set); + LootIdSet lootIdSet; + uint32 count = LootTemplates_Prospecting.LoadAndCollectLootIds(lootIdSet); // remove real entries and check existence loot ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore(); @@ -1657,12 +1658,12 @@ void LoadLootTemplates_Prospecting() if (!(itr->second.Flags & ITEM_PROTO_FLAG_PROSPECTABLE)) continue; - if (ids_set.find(itr->second.ItemId) != ids_set.end()) - ids_set.erase(itr->second.ItemId); + if (lootIdSet.find(itr->second.ItemId) != lootIdSet.end()) + lootIdSet.erase(itr->second.ItemId); } // output error for any still listed (not referenced from appropriate table) ids - LootTemplates_Prospecting.ReportUnusedIds(ids_set); + LootTemplates_Prospecting.ReportUnusedIds(lootIdSet); if (count) sLog->outString(">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); @@ -1678,17 +1679,17 @@ void LoadLootTemplates_Mail() uint32 oldMSTime = getMSTime(); - LootIdSet ids_set; - uint32 count = LootTemplates_Mail.LoadAndCollectLootIds(ids_set); + LootIdSet lootIdSet; + uint32 count = LootTemplates_Mail.LoadAndCollectLootIds(lootIdSet); // remove real entries and check existence loot for (uint32 i = 1; i < sMailTemplateStore.GetNumRows(); ++i) if (sMailTemplateStore.LookupEntry(i)) - if (ids_set.find(i) != ids_set.end()) - ids_set.erase(i); + if (lootIdSet.find(i) != lootIdSet.end()) + lootIdSet.erase(i); // output error for any still listed (not referenced from appropriate table) ids - LootTemplates_Mail.ReportUnusedIds(ids_set); + LootTemplates_Mail.ReportUnusedIds(lootIdSet); if (count) sLog->outString(">> Loaded %u mail loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); @@ -1704,8 +1705,8 @@ void LoadLootTemplates_Skinning() uint32 oldMSTime = getMSTime(); - LootIdSet ids_set, ids_setUsed; - uint32 count = LootTemplates_Skinning.LoadAndCollectLootIds(ids_set); + LootIdSet lootIdSet, lootIdSetUsed; + uint32 count = LootTemplates_Skinning.LoadAndCollectLootIds(lootIdSet); // remove real entries and check existence loot CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates(); @@ -1713,18 +1714,18 @@ void LoadLootTemplates_Skinning() { if (uint32 lootid = itr->second.SkinLootId) { - if (ids_set.find(lootid) == ids_set.end()) + if (lootIdSet.find(lootid) == lootIdSet.end()) LootTemplates_Skinning.ReportNotExistedId(lootid); else - ids_setUsed.insert(lootid); + lootIdSetUsed.insert(lootid); } } - for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr) - ids_set.erase(*itr); + for (LootIdSet::const_iterator itr = lootIdSetUsed.begin(); itr != lootIdSetUsed.end(); ++itr) + lootIdSet.erase(*itr); // output error for any still listed (not referenced from appropriate table) ids - LootTemplates_Skinning.ReportUnusedIds(ids_set); + LootTemplates_Skinning.ReportUnusedIds(lootIdSet); if (count) sLog->outString(">> Loaded %u skinning loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); @@ -1740,8 +1741,8 @@ void LoadLootTemplates_Spell() uint32 oldMSTime = getMSTime(); - LootIdSet ids_set; - uint32 count = LootTemplates_Spell.LoadAndCollectLootIds(ids_set); + LootIdSet lootIdSet; + uint32 count = LootTemplates_Spell.LoadAndCollectLootIds(lootIdSet); // remove real entries and check existence loot for (uint32 spell_id = 1; spell_id < sSpellMgr->GetSpellInfoStoreSize(); ++spell_id) @@ -1754,7 +1755,7 @@ void LoadLootTemplates_Spell() if (!spellInfo->IsLootCrafting()) continue; - if (ids_set.find(spell_id) == ids_set.end()) + if (lootIdSet.find(spell_id) == lootIdSet.end()) { // not report about not trainable spells (optionally supported by DB) // ignore 61756 (Northrend Inscription Research (FAST QA VERSION) for example @@ -1764,11 +1765,11 @@ void LoadLootTemplates_Spell() } } else - ids_set.erase(spell_id); + lootIdSet.erase(spell_id); } // output error for any still listed (not referenced from appropriate table) ids - LootTemplates_Spell.ReportUnusedIds(ids_set); + LootTemplates_Spell.ReportUnusedIds(lootIdSet); if (count) sLog->outString(">> Loaded %u spell loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); @@ -1783,24 +1784,24 @@ void LoadLootTemplates_Reference() uint32 oldMSTime = getMSTime(); - LootIdSet ids_set; - LootTemplates_Reference.LoadAndCollectLootIds(ids_set); + LootIdSet lootIdSet; + LootTemplates_Reference.LoadAndCollectLootIds(lootIdSet); // check references and remove used - LootTemplates_Creature.CheckLootRefs(&ids_set); - LootTemplates_Fishing.CheckLootRefs(&ids_set); - LootTemplates_Gameobject.CheckLootRefs(&ids_set); - LootTemplates_Item.CheckLootRefs(&ids_set); - LootTemplates_Milling.CheckLootRefs(&ids_set); - LootTemplates_Pickpocketing.CheckLootRefs(&ids_set); - LootTemplates_Skinning.CheckLootRefs(&ids_set); - LootTemplates_Disenchant.CheckLootRefs(&ids_set); - LootTemplates_Prospecting.CheckLootRefs(&ids_set); - LootTemplates_Mail.CheckLootRefs(&ids_set); - LootTemplates_Reference.CheckLootRefs(&ids_set); + LootTemplates_Creature.CheckLootRefs(&lootIdSet); + LootTemplates_Fishing.CheckLootRefs(&lootIdSet); + LootTemplates_Gameobject.CheckLootRefs(&lootIdSet); + LootTemplates_Item.CheckLootRefs(&lootIdSet); + LootTemplates_Milling.CheckLootRefs(&lootIdSet); + LootTemplates_Pickpocketing.CheckLootRefs(&lootIdSet); + LootTemplates_Skinning.CheckLootRefs(&lootIdSet); + LootTemplates_Disenchant.CheckLootRefs(&lootIdSet); + LootTemplates_Prospecting.CheckLootRefs(&lootIdSet); + LootTemplates_Mail.CheckLootRefs(&lootIdSet); + LootTemplates_Reference.CheckLootRefs(&lootIdSet); // output error for any still listed ids (not referenced from any loot table) - LootTemplates_Reference.ReportUnusedIds(ids_set); + LootTemplates_Reference.ReportUnusedIds(lootIdSet); sLog->outString(">> Loaded refence loot templates in %u ms", GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); diff --git a/src/server/game/Mails/Mail.h b/src/server/game/Mails/Mail.h index 6615d59160a..dbd03bd96ee 100755 --- a/src/server/game/Mails/Mail.h +++ b/src/server/game/Mails/Mail.h @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ + #ifndef TRINITY_MAIL_H #define TRINITY_MAIL_H diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 81b4f958e5d..073ceae5b62 100755 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -32,6 +32,7 @@ #include "Group.h" #include "LFGMgr.h" #include "DynamicTree.h" +#include "Vehicle.h" union u_map_magic { @@ -40,7 +41,7 @@ union u_map_magic }; u_map_magic MapMagic = { {'M','A','P','S'} }; -u_map_magic MapVersionMagic = { {'v','1','.','1'} }; +u_map_magic MapVersionMagic = { {'v','1','.','2'} }; u_map_magic MapAreaMagic = { {'A','R','E','A'} }; u_map_magic MapHeightMagic = { {'M','H','G','T'} }; u_map_magic MapLiquidMagic = { {'M','L','I','Q'} }; @@ -492,6 +493,7 @@ void Map::VisitNearbyCellsOf(WorldObject* obj, TypeContainerVisitor<Trinity::Obj markCell(cell_id); CellCoord pair(x, y); Cell cell(pair); + cell.SetNoCreate(); Visit(cell, gridVisitor); Visit(cell, worldVisitor); } @@ -508,9 +510,9 @@ void Map::Update(const uint32 t_diff) if (player && player->IsInWorld()) { //player->Update(t_diff); - WorldSession* pSession = player->GetSession(); - MapSessionFilter updater(pSession); - pSession->Update(t_diff, updater); + WorldSession* session = player->GetSession(); + MapSessionFilter updater(session); + session->Update(t_diff, updater); } } /// update active cells around players and active objects @@ -701,7 +703,15 @@ void Map::PlayerRelocation(Player* player, float x, float y, float z, float orie Cell old_cell(player->GetPositionX(), player->GetPositionY()); Cell new_cell(x, y); + //! If hovering, always increase our server-side Z position + //! Client automatically projects correct position based on Z coord sent in monster move + //! and UNIT_FIELD_HOVERHEIGHT sent in object updates + if (player->HasUnitMovementFlag(MOVEMENTFLAG_HOVER)) + z += player->GetFloatValue(UNIT_FIELD_HOVERHEIGHT); + player->Relocate(x, y, z, orientation); + if (player->IsVehicle()) + player->GetVehicleKit()->RelocatePassengers(x, y, z, orientation); if (old_cell.DiffGrid(new_cell) || old_cell.DiffCell(new_cell)) { @@ -728,6 +738,12 @@ void Map::CreatureRelocation(Creature* creature, float x, float y, float z, floa if (!respawnRelocationOnFail && !getNGrid(new_cell.GridX(), new_cell.GridY())) return; + //! If hovering, always increase our server-side Z position + //! Client automatically projects correct position based on Z coord sent in monster move + //! and UNIT_FIELD_HOVERHEIGHT sent in object updates + if (creature->HasUnitMovementFlag(MOVEMENTFLAG_HOVER)) + z += creature->GetFloatValue(UNIT_FIELD_HOVERHEIGHT); + // delay creature move for grid/cell to grid/cell moves if (old_cell.DiffCell(new_cell) || old_cell.DiffGrid(new_cell)) { @@ -740,6 +756,8 @@ void Map::CreatureRelocation(Creature* creature, float x, float y, float z, floa else { creature->Relocate(x, y, z, ang); + if (creature->IsVehicle()) + creature->GetVehicleKit()->RelocatePassengers(x, y, z, ang); creature->UpdateObjectVisibility(false); RemoveCreatureFromMoveList(creature); } @@ -769,20 +787,20 @@ void Map::RemoveCreatureFromMoveList(Creature* c) void Map::MoveAllCreaturesInMoveList() { _creatureToMoveLock = true; - for(std::vector<Creature*>::iterator itr = _creaturesToMove.begin(); itr != _creaturesToMove.end(); ++itr) + for (std::vector<Creature*>::iterator itr = _creaturesToMove.begin(); itr != _creaturesToMove.end(); ++itr) { Creature* c = *itr; - if(c->FindMap() != this) //pet is teleported to another map + if (c->FindMap() != this) //pet is teleported to another map continue; - if(c->_moveState != CREATURE_CELL_MOVE_ACTIVE) + if (c->_moveState != CREATURE_CELL_MOVE_ACTIVE) { c->_moveState = CREATURE_CELL_MOVE_NONE; continue; } c->_moveState = CREATURE_CELL_MOVE_NONE; - if(!c->IsInWorld()) + if (!c->IsInWorld()) continue; // do move or do move to respawn or remove creature if previous all fail @@ -1039,7 +1057,8 @@ GridMap::GridMap() _liquidWidth = 0; _liquidHeight = 0; _liquidLevel = INVALID_HEIGHT; - _liquidData = NULL; + _liquidEntry = NULL; + _liquidFlags = NULL; _liquidMap = NULL; } @@ -1101,12 +1120,14 @@ void GridMap::unloadData() delete[] _areaMap; delete[] m_V9; delete[] m_V8; - delete[] _liquidData; + delete[] _liquidEntry; + delete[] _liquidFlags; delete[] _liquidMap; _areaMap = NULL; m_V9 = NULL; m_V8 = NULL; - _liquidData = NULL; + _liquidEntry = NULL; + _liquidFlags = NULL; _liquidMap = NULL; _gridGetHeight = &GridMap::getHeightFromFlat; } @@ -1187,18 +1208,22 @@ bool GridMap::loadLiquidData(FILE* in, uint32 offset, uint32 /*size*/) _liquidOffX = header.offsetX; _liquidOffY = header.offsetY; _liquidWidth = header.width; - _liquidHeight= header.height; + _liquidHeight = header.height; _liquidLevel = header.liquidLevel; if (!(header.flags & MAP_LIQUID_NO_TYPE)) { - _liquidData = new uint8 [16*16]; - if (fread(_liquidData, sizeof(uint8), 16*16, in) != 16*16) + _liquidEntry = new uint16[16*16]; + if (fread(_liquidEntry, sizeof(uint16), 16*16, in) != 16*16) + return false; + + _liquidFlags = new uint8[16*16]; + if (fread(_liquidFlags, sizeof(uint8), 16*16, in) != 16*16) return false; } if (!(header.flags & MAP_LIQUID_NO_HEIGHT)) { - _liquidMap = new float [_liquidWidth*_liquidHeight]; + _liquidMap = new float[_liquidWidth*_liquidHeight]; if (fread(_liquidMap, sizeof(float), _liquidWidth*_liquidHeight, in) != _liquidWidth*_liquidHeight) return false; } @@ -1457,23 +1482,24 @@ float GridMap::getLiquidLevel(float x, float y) return _liquidMap[cx_int*_liquidWidth + cy_int]; } +// Why does this return LIQUID data? uint8 GridMap::getTerrainType(float x, float y) { - if (!_liquidData) + if (!_liquidFlags) return 0; x = 16 * (32 - x/SIZE_OF_GRIDS); y = 16 * (32 - y/SIZE_OF_GRIDS); int lx = (int)x & 15; int ly = (int)y & 15; - return _liquidData[lx*16 + ly]; + return _liquidFlags[lx*16 + ly]; } // Get water state on map inline ZLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data) { // Check water type (if no water return) - if (!_liquidType && !_liquidData) + if (!_liquidType && !_liquidFlags) return LIQUID_MAP_NO_WATER; // Get cell @@ -1484,7 +1510,40 @@ inline ZLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 R int y_int = (int)cy & (MAP_RESOLUTION-1); // Check water type in cell - uint8 type = _liquidData ? _liquidData[(x_int>>3)*16 + (y_int>>3)] : _liquidType; + int idx=(x_int>>3)*16 + (y_int>>3); + uint8 type = _liquidFlags ? _liquidFlags[idx] : _liquidType; + uint32 entry = 0; + if (_liquidEntry) + { + if (LiquidTypeEntry const* liquidEntry = sLiquidTypeStore.LookupEntry(_liquidEntry[idx])) + { + entry = liquidEntry->Id; + type &= MAP_LIQUID_TYPE_DARK_WATER; + uint32 liqTypeIdx = liquidEntry->Type; + if (entry < 21) + { + if (AreaTableEntry const* area = GetAreaEntryByAreaFlagAndMap(getArea(x, y), MAPID_INVALID)) + { + uint32 overrideLiquid = area->LiquidTypeOverride[liquidEntry->Type]; + if (!overrideLiquid && area->zone) + { + area = GetAreaEntryByAreaID(area->zone); + if (area) + overrideLiquid = area->LiquidTypeOverride[liquidEntry->Type]; + } + + if (LiquidTypeEntry const* liq = sLiquidTypeStore.LookupEntry(overrideLiquid)) + { + entry = overrideLiquid; + liqTypeIdx = liq->Type; + } + } + } + + type |= 1 << liqTypeIdx; + } + } + if (type == 0) return LIQUID_MAP_NO_WATER; @@ -1513,20 +1572,20 @@ inline ZLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 R // All ok in water -> store data if (data) { - data->type = type; + data->entry = entry; + data->type_flags = type; data->level = liquid_level; data->depth_level = ground_level; } // For speed check as int values - int delta = int((liquid_level - z) * 10); + float delta = liquid_level - z; - // Get position delta - if (delta > 20) // Under water + if (delta > 2.0f) // Under water return LIQUID_MAP_UNDER_WATER; - if (delta > 0) // In water + if (delta > 0.0f) // In water return LIQUID_MAP_IN_WATER; - if (delta > -1) // Walk on water + if (delta > -0.1f) // Walk on water return LIQUID_MAP_WATER_WALK; // Above water return LIQUID_MAP_ABOVE_WATER; @@ -1717,8 +1776,9 @@ ZLiquidStatus Map::getLiquidStatus(float x, float y, float z, uint8 ReqLiquidTyp { ZLiquidStatus result = LIQUID_MAP_NO_WATER; VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager(); - float liquid_level, ground_level = INVALID_HEIGHT; - uint32 liquid_type; + float liquid_level = INVALID_HEIGHT; + float ground_level = INVALID_HEIGHT; + uint32 liquid_type = 0; if (vmgr->GetLiquidLevel(GetId(), x, y, z, ReqLiquidType, liquid_level, ground_level, liquid_type)) { sLog->outDebug(LOG_FILTER_MAPS, "getLiquidStatus(): vmap liquid level: %f ground: %f type: %u", liquid_level, ground_level, liquid_type); @@ -1728,20 +1788,49 @@ ZLiquidStatus Map::getLiquidStatus(float x, float y, float z, uint8 ReqLiquidTyp // All ok in water -> store data if (data) { - data->type = liquid_type; + // hardcoded in client like this + if (GetId() == 530 && liquid_type == 2) + liquid_type = 15; + + uint32 liquidFlagType = 0; + if (LiquidTypeEntry const* liq = sLiquidTypeStore.LookupEntry(liquid_type)) + liquidFlagType = liq->Type; + + if (liquid_type && liquid_type < 21) + { + if (AreaTableEntry const* area = GetAreaEntryByAreaFlagAndMap(GetAreaFlag(x, y, z), GetId())) + { + uint32 overrideLiquid = area->LiquidTypeOverride[liquidFlagType]; + if (!overrideLiquid && area->zone) + { + area = GetAreaEntryByAreaID(area->zone); + if (area) + overrideLiquid = area->LiquidTypeOverride[liquidFlagType]; + } + + if (LiquidTypeEntry const* liq = sLiquidTypeStore.LookupEntry(overrideLiquid)) + { + liquid_type = overrideLiquid; + liquidFlagType = liq->Type; + } + } + } + data->level = liquid_level; data->depth_level = ground_level; + + data->entry = liquid_type; + data->type_flags = 1 << liquidFlagType; } - // For speed check as int values - int delta = int((liquid_level - z) * 10); + float delta = liquid_level - z; // Get position delta - if (delta > 20) // Under water + if (delta > 2.0f) // Under water return LIQUID_MAP_UNDER_WATER; - if (delta > 0 ) // In water + if (delta > 0.0f) // In water return LIQUID_MAP_IN_WATER; - if (delta > -1) // Walk on water + if (delta > -0.1f) // Walk on water return LIQUID_MAP_WATER_WALK; result = LIQUID_MAP_ABOVE_WATER; } @@ -1755,7 +1844,13 @@ ZLiquidStatus Map::getLiquidStatus(float x, float y, float z, uint8 ReqLiquidTyp if (map_result != LIQUID_MAP_NO_WATER && (map_data.level > ground_level)) { if (data) + { + // hardcoded in client like this + if (GetId() == 530 && map_data.entry == 2) + map_data.entry = 15; + *data = map_data; + } return map_result; } } @@ -2260,7 +2355,7 @@ bool InstanceMap::CanEnter(Player* player) return false; } // player inside instance has no group or his groups is different to entering player's one, deny entry - if (!iPlayer->GetGroup() || iPlayer->GetGroup() != player->GetGroup() ) + if (!iPlayer->GetGroup() || iPlayer->GetGroup() != player->GetGroup()) { player->SendTransferAborted(GetId(), TRANSFER_ABORT_MAX_PLAYERS); return false; @@ -2376,7 +2471,7 @@ bool InstanceMap::AddPlayerToMap(Player* player) if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true)) if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId)) if (LFGDungeonEntry const* randomDungeon = sLFGDungeonStore.LookupEntry(*(sLFGMgr->GetSelectedDungeons(player->GetGUID()).begin()))) - if (uint32(dungeon->map) == GetId() && dungeon->difficulty == GetDifficulty() && randomDungeon->type == LFG_TYPE_RANDOM) + if (uint32(dungeon->map) == GetId() && dungeon->difficulty == uint32(GetDifficulty()) && randomDungeon->type == uint32(LFG_TYPE_RANDOM)) player->CastSpell(player, LFG_SPELL_LUCK_OF_THE_DRAW, true); } @@ -2439,7 +2534,11 @@ void InstanceMap::CreateInstanceData(bool load) if (load) { // TODO: make a global storage for this - QueryResult result = CharacterDatabase.PQuery("SELECT data, completedEncounters FROM instance WHERE map = '%u' AND id = '%u'", GetId(), i_InstanceId); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_INSTANCE); + stmt->setUInt16(0, uint16(GetId())); + stmt->setUInt32(1, i_InstanceId); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (result) { Field* fields = result->Fetch(); @@ -2519,6 +2618,8 @@ void InstanceMap::PermBindAllPlayers(Player* source) WorldPacket data(SMSG_INSTANCE_SAVE_CREATED, 4); data << uint32(0); player->GetSession()->SendPacket(&data); + + player->GetSession()->SendCalendarRaidLockout(save, true); } // if the leader is not in the instance the group will not get a perm bind diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index d8db4c947a3..6ba08646f25 100755 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -136,7 +136,8 @@ enum ZLiquidStatus struct LiquidData { - uint32 type; + uint32 type_flags; + uint32 entry; float level; float depth_level; }; @@ -163,7 +164,8 @@ class GridMap // Liquid data float _liquidLevel; - uint8* _liquidData; + uint16* _liquidEntry; + uint8* _liquidFlags; float* _liquidMap; uint16 _gridArea; uint16 _liquidType; @@ -226,7 +228,7 @@ enum LevelRequirementVsMode #define MAX_HEIGHT 100000.0f // can be use for find ground height at surface #define INVALID_HEIGHT -100000.0f // for check, must be equal to VMAP_INVALID_HEIGHT, real value for unknown height is VMAP_INVALID_HEIGHT_VALUE #define MAX_FALL_DISTANCE 250000.0f // "unlimited fall" to find VMap ground if it is available, just larger than MAX_HEIGHT - INVALID_HEIGHT -#define DEFAULT_HEIGHT_SEARCH 10.0f // default search distance to find height at nearby locations +#define DEFAULT_HEIGHT_SEARCH 50.0f // default search distance to find height at nearby locations #define MIN_UNLOAD_DELAY 1 // immediate unload typedef std::map<uint32/*leaderDBGUID*/, CreatureGroup*> CreatureGroupHolderType; @@ -243,8 +245,12 @@ class Map : public GridRefManager<NGridType> // currently unused for normal maps bool CanUnload(uint32 diff) { - if (!m_unloadTimer) return false; - if (m_unloadTimer <= diff) return true; + if (!m_unloadTimer) + return false; + + if (m_unloadTimer <= diff) + return true; + m_unloadTimer -= diff; return false; } diff --git a/src/server/game/Maps/MapInstanced.cpp b/src/server/game/Maps/MapInstanced.cpp index fbe609bee23..5543251e115 100755 --- a/src/server/game/Maps/MapInstanced.cpp +++ b/src/server/game/Maps/MapInstanced.cpp @@ -116,19 +116,21 @@ Map* MapInstanced::CreateInstanceForPlayer(const uint32 mapId, Player* player) return NULL; Map* map = NULL; - uint32 NewInstanceId = 0; // instanceId of the resulting map + uint32 newInstanceId = 0; // instanceId of the resulting map if (IsBattlegroundOrArena()) { // instantiate or find existing bg map for player // the instance id is set in battlegroundid - NewInstanceId = player->GetBattlegroundId(); - if (!NewInstanceId) return NULL; - map = sMapMgr->FindMap(mapId, NewInstanceId); + newInstanceId = player->GetBattlegroundId(); + if (!newInstanceId) + return NULL; + + map = sMapMgr->FindMap(mapId, newInstanceId); if (!map) { if (Battleground* bg = player->GetBattleground()) - map = CreateBattleground(NewInstanceId, bg); + map = CreateBattleground(newInstanceId, bg); else { player->TeleportToBGEntryPoint(); @@ -158,24 +160,24 @@ Map* MapInstanced::CreateInstanceForPlayer(const uint32 mapId, Player* player) if (pSave) { // solo/perm/group - NewInstanceId = pSave->GetInstanceId(); - map = FindInstanceMap(NewInstanceId); + newInstanceId = pSave->GetInstanceId(); + map = FindInstanceMap(newInstanceId); // it is possible that the save exists but the map doesn't if (!map) - map = CreateInstance(NewInstanceId, pSave, pSave->GetDifficulty()); + map = CreateInstance(newInstanceId, pSave, pSave->GetDifficulty()); } else { // if no instanceId via group members or instance saves is found // the instance will be created for the first time - NewInstanceId = sMapMgr->GenerateInstanceId(); + newInstanceId = sMapMgr->GenerateInstanceId(); Difficulty diff = player->GetGroup() ? player->GetGroup()->GetDifficulty(IsRaid()) : player->GetDifficulty(IsRaid()); //Seems it is now possible, but I do not know if it should be allowed //ASSERT(!FindInstanceMap(NewInstanceId)); - map = FindInstanceMap(NewInstanceId); + map = FindInstanceMap(newInstanceId); if (!map) - map = CreateInstance(NewInstanceId, NULL, diff); + map = CreateInstance(newInstanceId, NULL, diff); } } diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp index 6890ec8ac2e..ce93fe5af1a 100755 --- a/src/server/game/Maps/MapManager.cpp +++ b/src/server/game/Maps/MapManager.cpp @@ -96,32 +96,32 @@ void MapManager::checkAndCorrectGridStatesArray() Map* MapManager::CreateBaseMap(uint32 id) { - Map* m = FindBaseMap(id); + Map* map = FindBaseMap(id); - if (m == NULL) + if (map == NULL) { TRINITY_GUARD(ACE_Thread_Mutex, Lock); const MapEntry* entry = sMapStore.LookupEntry(id); if (entry && entry->Instanceable()) { - m = new MapInstanced(id, i_gridCleanUpDelay); + map = new MapInstanced(id, i_gridCleanUpDelay); } else { - m = new Map(id, i_gridCleanUpDelay, 0, REGULAR_DIFFICULTY); + map = new Map(id, i_gridCleanUpDelay, 0, REGULAR_DIFFICULTY); } - i_maps[id] = m; + i_maps[id] = map; } - ASSERT(m != NULL); - return m; + ASSERT(map); + return map; } Map* MapManager::FindBaseNonInstanceMap(uint32 mapId) const { Map* map = FindBaseMap(mapId); - if(map && map->Instanceable()) + if (map && map->Instanceable()) return NULL; return map; } diff --git a/src/server/game/Maps/MapUpdater.cpp b/src/server/game/Maps/MapUpdater.cpp index 80025680753..b747d065a14 100644 --- a/src/server/game/Maps/MapUpdater.cpp +++ b/src/server/game/Maps/MapUpdater.cpp @@ -52,7 +52,7 @@ class MapUpdateRequest : public ACE_Method_Request virtual int call() { m_map.Update (m_diff); - m_updater.update_finished (); + m_updater.update_finished(); return 0; } }; diff --git a/src/server/game/Miscellaneous/Formulas.h b/src/server/game/Miscellaneous/Formulas.h index 27397837265..dacd9962251 100755 --- a/src/server/game/Miscellaneous/Formulas.h +++ b/src/server/game/Miscellaneous/Formulas.h @@ -165,8 +165,8 @@ namespace Trinity if (u->GetTypeId() == TYPEID_UNIT && (((Creature*)u)->isTotem() || ((Creature*)u)->isPet() || - (((Creature*)u)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL) || - ((Creature*)u)->GetCreatureInfo()->type == CREATURE_TYPE_CRITTER)) + (((Creature*)u)->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL) || + ((Creature*)u)->GetCreatureTemplate()->type == CREATURE_TYPE_CRITTER)) gain = 0; else { diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index e751dbf92fe..aec72835d86 100755 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -522,8 +522,11 @@ enum TrinityStrings LANG_YOURS_EXPLORE_SET_ALL = 553, LANG_YOURS_EXPLORE_SET_NOTHING = 554, - LANG_HOVER_ENABLED = 555, - LANG_HOVER_DISABLED = 556, + LANG_NPC_SETDATA = 555, + + //! Old ones now free: + // LANG_HOVER_DISABLED = 556, + LANG_YOURS_LEVEL_UP = 557, LANG_YOURS_LEVEL_DOWN = 558, LANG_YOURS_LEVEL_PROGRESS_RESET = 559, @@ -811,7 +814,9 @@ enum TrinityStrings LANG_MOVEGENS_FOLLOW_CREATURE = 1140, LANG_MOVEGENS_FOLLOW_NULL = 1141, LANG_MOVEGENS_EFFECT = 1142, - // Room for more level 3 1143-1199 not used + LANG_MOVEFLAGS_GET = 1143, + LANG_MOVEFLAGS_SET = 1144, + // Room for more level 3 1144-1199 not used // Debug commands LANG_CINEMATIC_NOT_EXIST = 1200, diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index f1ebfb6ec96..7b77ecaa17e 100755 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -258,7 +258,8 @@ enum SpellCategory SPELL_CATEGORY_DRINK = 59, }; -const uint32 ItemQualityColors[MAX_ITEM_QUALITY] = { +const uint32 ItemQualityColors[MAX_ITEM_QUALITY] = +{ 0xff9d9d9d, //GREY 0xffffffff, //WHITE 0xff1eff00, //GREEN @@ -278,7 +279,7 @@ enum SpellAttr0 SPELL_ATTR0_UNK0 = 0x00000001, // 0 SPELL_ATTR0_REQ_AMMO = 0x00000002, // 1 on next ranged SPELL_ATTR0_ON_NEXT_SWING = 0x00000004, // 2 - SPELL_ATTR0_UNK3 = 0x00000008, // 3 not set in 3.0.3 + SPELL_ATTR0_IS_REPLENISHMENT = 0x00000008, // 3 not set in 3.0.3 SPELL_ATTR0_ABILITY = 0x00000010, // 4 client puts 'ability' instead of 'spell' in game strings for these spells SPELL_ATTR0_TRADESPELL = 0x00000020, // 5 trade spells (recipes), will be added by client to a sublist of profession spell SPELL_ATTR0_PASSIVE = 0x00000040, // 6 Passive spell @@ -323,7 +324,7 @@ enum SpellAttr1 SPELL_ATTR1_MELEE_COMBAT_START = 0x00000200, // 9 player starts melee combat after this spell is cast SPELL_ATTR1_NO_THREAT = 0x00000400, // 10 no generates threat on cast 100% (old NO_INITIAL_AGGRO) SPELL_ATTR1_UNK11 = 0x00000800, // 11 aura - SPELL_ATTR1_UNK12 = 0x00001000, // 12 pickpoket + SPELL_ATTR1_IS_PICKPOCKET = 0x00001000, // 12 Pickpocket SPELL_ATTR1_FARSIGHT = 0x00002000, // 13 Client removes farsight on aura loss SPELL_ATTR1_CHANNEL_TRACK_TARGET = 0x00004000, // 14 Client automatically forces player to face target when channeling SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY = 0x00008000, // 15 remove auras on immunity @@ -335,7 +336,7 @@ enum SpellAttr1 SPELL_ATTR1_UNK21 = 0x00200000, // 21 SPELL_ATTR1_REQ_COMBO_POINTS2 = 0x00400000, // 22 Req combo points on target SPELL_ATTR1_UNK23 = 0x00800000, // 23 - SPELL_ATTR1_UNK24 = 0x01000000, // 24 only fishing spells + SPELL_ATTR1_IS_FISHING = 0x01000000, // 24 only fishing spells SPELL_ATTR1_UNK25 = 0x02000000, // 25 SPELL_ATTR1_UNK26 = 0x04000000, // 26 works correctly with [target=focus] and [target=mouseover] macros? SPELL_ATTR1_UNK27 = 0x08000000, // 27 melee spell? @@ -360,17 +361,17 @@ enum SpellAttr2 SPELL_ATTR2_UNK10 = 0x00000400, // 10 related to tame SPELL_ATTR2_HEALTH_FUNNEL = 0x00000800, // 11 SPELL_ATTR2_UNK12 = 0x00001000, // 12 Cleave, Heart Strike, Maul, Sunder Armor, Swipe - SPELL_ATTR2_UNK13 = 0x00002000, // 13 Items enchanted by spells with this flag preserve the enchant to arenas + SPELL_ATTR2_PRESERVE_ENCHANT_IN_ARENA = 0x00002000, // 13 Items enchanted by spells with this flag preserve the enchant to arenas SPELL_ATTR2_UNK14 = 0x00004000, // 14 SPELL_ATTR2_UNK15 = 0x00008000, // 15 not set in 3.0.3 SPELL_ATTR2_TAME_BEAST = 0x00010000, // 16 SPELL_ATTR2_NOT_RESET_AUTO_ACTIONS = 0x00020000, // 17 don't reset timers for melee autoattacks (swings) or ranged autoattacks (autoshoots) - SPELL_ATTR2_UNK18 = 0x00040000, // 18 Only Revive pet - possible req dead pet + SPELL_ATTR2_REQ_DEAD_PET = 0x00040000, // 18 Only Revive pet and Heart of the Pheonix SPELL_ATTR2_NOT_NEED_SHAPESHIFT = 0x00080000, // 19 does not necessarly need shapeshift SPELL_ATTR2_UNK20 = 0x00100000, // 20 SPELL_ATTR2_DAMAGE_REDUCED_SHIELD = 0x00200000, // 21 for ice blocks, pala immunity buffs, priest absorb shields, but used also for other spells -> not sure! SPELL_ATTR2_UNK22 = 0x00400000, // 22 Ambush, Backstab, Cheap Shot, Death Grip, Garrote, Judgements, Mutilate, Pounce, Ravage, Shiv, Shred - SPELL_ATTR2_UNK23 = 0x00800000, // 23 Only mage Arcane Concentration have this flag + SPELL_ATTR2_IS_ARCANE_CONCENTRATION = 0x00800000, // 23 Only mage Arcane Concentration have this flag SPELL_ATTR2_UNK24 = 0x01000000, // 24 SPELL_ATTR2_UNK25 = 0x02000000, // 25 SPELL_ATTR2_UNK26 = 0x04000000, // 26 unaffected by school immunity @@ -397,7 +398,7 @@ enum SpellAttr3 SPELL_ATTR3_BATTLEGROUND = 0x00000800, // 11 Can casted only on battleground SPELL_ATTR3_ONLY_TARGET_GHOSTS = 0x00001000, // 12 SPELL_ATTR3_UNK13 = 0x00002000, // 13 - SPELL_ATTR3_UNK14 = 0x00004000, // 14 "Honorless Target" only this spells have this flag + SPELL_ATTR3_IS_HONORLESS_TARGET = 0x00004000, // 14 "Honorless Target" only this spells have this flag SPELL_ATTR3_UNK15 = 0x00008000, // 15 Auto Shoot, Shoot, Throw, - this is autoshot flag SPELL_ATTR3_CANT_TRIGGER_PROC = 0x00010000, // 16 confirmed with many patchnotes SPELL_ATTR3_NO_INITIAL_AGGRO = 0x00020000, // 17 Soothe Animal, 39758, Mind Soothe @@ -419,8 +420,8 @@ enum SpellAttr3 enum SpellAttr4 { - SPELL_ATTR4_UNK0 = 0x00000001, // 0 - SPELL_ATTR4_PROC_ONLY_ON_DUMMY = 0x00000002, // 1 proc only on SPELL_EFFECT_DUMMY? + SPELL_ATTR4_IGNORE_RESISTANCES = 0x00000001, // 0 spells with this attribute will completely ignore the target's resistance (these spells can't be resisted) + SPELL_ATTR4_PROC_ONLY_ON_CASTER = 0x00000002, // 1 proc only on effects with TARGET_UNIT_CASTER? SPELL_ATTR4_UNK2 = 0x00000004, // 2 SPELL_ATTR4_UNK3 = 0x00000008, // 3 SPELL_ATTR4_UNK4 = 0x00000010, // 4 This will no longer cause guards to attack on use?? @@ -441,16 +442,16 @@ enum SpellAttr4 SPELL_ATTR4_UNK19 = 0x00080000, // 19 proc dalayed, after damage or don't proc on absorb? SPELL_ATTR4_NOT_CHECK_SELFCAST_POWER = 0x00100000, // 20 supersedes message "More powerful spell applied" for self casts. SPELL_ATTR4_UNK21 = 0x00200000, // 21 Pally aura, dk presence, dudu form, warrior stance, shadowform, hunter track - SPELL_ATTR4_UNK22 = 0x00400000, // 22 + SPELL_ATTR4_UNK22 = 0x00400000, // 22 Seal of Command (42058,57770) and Gymer's Smash 55426 SPELL_ATTR4_UNK23 = 0x00800000, // 23 SPELL_ATTR4_UNK24 = 0x01000000, // 24 some shoot spell - SPELL_ATTR4_UNK25 = 0x02000000, // 25 pet scaling auras + SPELL_ATTR4_IS_PET_SCALING = 0x02000000, // 25 pet scaling auras SPELL_ATTR4_CAST_ONLY_IN_OUTLAND = 0x04000000, // 26 Can only be used in Outland. SPELL_ATTR4_UNK27 = 0x08000000, // 27 SPELL_ATTR4_UNK28 = 0x10000000, // 28 Aimed Shot SPELL_ATTR4_UNK29 = 0x20000000, // 29 SPELL_ATTR4_UNK30 = 0x40000000, // 30 - SPELL_ATTR4_UNK31 = 0x80000000 // 31 + SPELL_ATTR4_UNK31 = 0x80000000 // 31 Polymorph (chicken) 228 and Sonic Boom (38052,38488) }; enum SpellAttr5 @@ -470,7 +471,7 @@ enum SpellAttr5 SPELL_ATTR5_UNK12 = 0x00001000, // 12 Cleave related? SPELL_ATTR5_HASTE_AFFECT_DURATION = 0x00002000, // 13 haste effects decrease duration of this SPELL_ATTR5_UNK14 = 0x00004000, // 14 - SPELL_ATTR5_UNK15 = 0x00008000, // 15 + SPELL_ATTR5_UNK15 = 0x00008000, // 15 Inflits on multiple targets? SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK = 0x00010000, // 16 this allows spells with EquippedItemClass to affect spells from other items if the required item is equipped SPELL_ATTR5_USABLE_WHILE_FEARED = 0x00020000, // 17 usable while feared SPELL_ATTR5_USABLE_WHILE_CONFUSED = 0x00040000, // 18 usable while confused @@ -2640,7 +2641,7 @@ enum CreatureTypeFlags { CREATURE_TYPEFLAGS_TAMEABLE = 0x00000001, // Tameable by any hunter CREATURE_TYPEFLAGS_GHOST = 0x00000002, // Creature are also visible for not alive player. Allow gossip interaction if npcflag allow? - CREATURE_TYPEFLAGS_UNK2 = 0x00000004, + CREATURE_TYPEFLAGS_BOSS = 0x00000004, CREATURE_TYPEFLAGS_UNK3 = 0x00000008, CREATURE_TYPEFLAGS_UNK4 = 0x00000010, CREATURE_TYPEFLAGS_UNK5 = 0x00000020, @@ -2664,7 +2665,7 @@ enum CreatureTypeFlags CREATURE_TYPEFLAGS_UNK23 = 0x00800000, // ? First seen in 3.2.2. Related to banner/backpack of creature/companion? CREATURE_TYPEFLAGS_UNK24 = 0x01000000, CREATURE_TYPEFLAGS_UNK25 = 0x02000000, - CREATURE_TYPEFLAGS_UNK26 = 0x04000000, + CREATURE_TYPEFLAGS_PARTY_MEMBER = 0x04000000, //! Creature can be targeted by spells that require target to be in caster's party/raid CREATURE_TYPEFLAGS_UNK27 = 0x08000000, CREATURE_TYPEFLAGS_UNK28 = 0x10000000, CREATURE_TYPEFLAGS_UNK29 = 0x20000000, @@ -3421,25 +3422,25 @@ enum BanReturn // indexes of BattlemasterList.dbc enum BattlegroundTypeId { - BATTLEGROUND_TYPE_NONE = 0, - BATTLEGROUND_AV = 1, - BATTLEGROUND_WS = 2, - BATTLEGROUND_AB = 3, - BATTLEGROUND_NA = 4, - BATTLEGROUND_BE = 5, - BATTLEGROUND_AA = 6, - BATTLEGROUND_EY = 7, - BATTLEGROUND_RL = 8, - BATTLEGROUND_SA = 9, - BATTLEGROUND_DS = 10, - BATTLEGROUND_RV = 11, - BATTLEGROUND_IC = 30, - BATTLEGROUND_RB = 32, - BATTLEGROUND_RATED_10_VS_10 = 100, - BATTLEGROUND_RATED_15_VS_15 = 101, - BATTLEGROUND_RATED_25_VS_25 = 102, - BATTLEGROUND_TP = 108, - BATTLEGROUND_BFG = 120, + BATTLEGROUND_TYPE_NONE = 0, // None + BATTLEGROUND_AV = 1, // Alterac Valley + BATTLEGROUND_WS = 2, // Warsong Gulch + BATTLEGROUND_AB = 3, // Arathi Basin + BATTLEGROUND_NA = 4, // Nagrand Arena + BATTLEGROUND_BE = 5, // Blade's Edge Arena + BATTLEGROUND_AA = 6, // All Arenas + BATTLEGROUND_EY = 7, // Eye of the Storm + BATTLEGROUND_RL = 8, // Ruins of Lordaernon + BATTLEGROUND_SA = 9, // Strand of the Ancients + BATTLEGROUND_DS = 10, // Dalaran Sewers + BATTLEGROUND_RV = 11, // Ring of Valor + BATTLEGROUND_IC = 30, // Isle of Conquest + BATTLEGROUND_RB = 32, // Random Battleground + BATTLEGROUND_RATED_10_VS_10 = 100, // Rated BG 10 vs 10 + BATTLEGROUND_RATED_15_VS_15 = 101, // Rated BG 15 vs 15 + BATTLEGROUND_RATED_25_VS_25 = 102, // Rated BG 25 vs 25 + BATTLEGROUND_TP = 108, // Twin Peaks + BATTLEGROUND_BFG = 120, // Battle For Gilneas // 441 = "Icecrown Citadel" // 443 = "The Ruby Sanctum" // 656 = "Rated Eye of the Storm" @@ -3559,4 +3560,105 @@ enum ActivateTaxiReply ERR_TAXINOTSTANDING = 12 }; +// Calendar - start + +enum CalendarFlags +{ + CALENDAR_FLAG_ALL_ALLOWED = 0x001, + CALENDAR_FLAG_INVITES_LOCKED = 0x010, + CALENDAR_FLAG_WITHOUT_INVITES = 0x040, + CALENDAR_FLAG_GUILD_ONLY = 0x400, +}; + +enum CalendarActionData +{ + CALENDAR_ACTION_NONE, + CALENDAR_ACTION_ADD_EVENT, + CALENDAR_ACTION_MODIFY_EVENT, + CALENDAR_ACTION_REMOVE_EVENT, + CALENDAR_ACTION_COPY_EVENT, + CALENDAR_ACTION_ADD_EVENT_INVITE, + CALENDAR_ACTION_MODIFY_EVENT_INVITE, + CALENDAR_ACTION_MODIFY_MODERATOR_EVENT_INVITE, + CALENDAR_ACTION_REMOVE_EVENT_INVITE, + CALENDAR_ACTION_SIGNUP_TO_EVENT, +}; + +enum CalendarModerationRank +{ + CALENDAR_RANK_PLAYER, + CALENDAR_RANK_MODERATOR, + CALENDAR_RANK_OWNER, +}; + +enum CalendarSendEventType +{ + CALENDAR_SENDTYPE_GET, + CALENDAR_SENDTYPE_ADD, + CALENDAR_SENDTYPE_COPY, +}; + +enum CalendarEventType +{ + CALENDAR_TYPE_RAID, + CALENDAR_TYPE_DUNGEON, + CALENDAR_TYPE_PVP, + CALENDAR_TYPE_MEETING, + CALENDAR_TYPE_OTHER, +}; + +enum CalendarInviteStatus +{ + CALENDAR_STATUS_INVITED, + CALENDAR_STATUS_ACCEPTED, + CALENDAR_STATUS_DECLINED, + CALENDAR_STATUS_TENTATIVE, + CALENDAR_STATUS_OUT, + CALENDAR_STATUS_STANDBY, + CALENDAR_STATUS_CONFIRMED, + CALENDAR_STATUS_NO_OWNER, + CALENDAR_STATUS_8, + CALENDAR_STATUS_9, +}; + +enum CalendarError +{ + CALENDAR_OK = 0, + CALENDAR_ERROR_GUILD_EVENTS_EXCEEDED = 1, + CALENDAR_ERROR_EVENTS_EXCEEDED = 2, + CALENDAR_ERROR_SELF_INVITES_EXCEEDED = 3, + CALENDAR_ERROR_OTHER_INVITES_EXCEEDED = 4, + CALENDAR_ERROR_PERMISSIONS = 5, + CALENDAR_ERROR_EVENT_INVALID = 6, + CALENDAR_ERROR_NOT_INVITED = 7, + CALENDAR_ERROR_INTERNAL = 8, + CALENDAR_ERROR_GUILD_PLAYER_NOT_IN_GUILD = 9, + CALENDAR_ERROR_ALREADY_INVITED_TO_EVENT_S = 10, + CALENDAR_ERROR_PLAYER_NOT_FOUND = 11, + CALENDAR_ERROR_NOT_ALLIED = 12, + CALENDAR_ERROR_IGNORING_YOU_S = 13, + CALENDAR_ERROR_INVITES_EXCEEDED = 14, + CALENDAR_ERROR_INVALID_DATE = 16, + CALENDAR_ERROR_INVALID_TIME = 17, + + CALENDAR_ERROR_NEEDS_TITLE = 19, + CALENDAR_ERROR_EVENT_PASSED = 20, + CALENDAR_ERROR_EVENT_LOCKED = 21, + CALENDAR_ERROR_DELETE_CREATOR_FAILED = 22, + CALENDAR_ERROR_SYSTEM_DISABLED = 24, + CALENDAR_ERROR_RESTRICTED_ACCOUNT = 25, + CALENDAR_ERROR_ARENA_EVENTS_EXCEEDED = 26, + CALENDAR_ERROR_RESTRICTED_LEVEL = 27, + CALENDAR_ERROR_USER_SQUELCHED = 28, + CALENDAR_ERROR_NO_INVITE = 29, + + CALENDAR_ERROR_EVENT_WRONG_SERVER = 36, + CALENDAR_ERROR_INVITE_WRONG_SERVER = 37, + CALENDAR_ERROR_NO_GUILD_INVITES = 38, + CALENDAR_ERROR_INVALID_SIGNUP = 39, + CALENDAR_ERROR_NO_MODERATOR = 40 +}; + +// Calendar - end + #endif diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index 27816753ca7..c0e1eb842ae 100755 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -114,6 +114,9 @@ void MotionMaster::UpdateMotion(uint32 diff) _cleanFlag &= ~MMCF_RESET; } + + // probably not the best place to pu this but im not really sure where else to put it. + _owner->UpdateUnderwaterState(_owner->GetMap(), _owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ()); } void MotionMaster::DirectClean(bool reset) @@ -202,11 +205,11 @@ void MotionMaster::MoveTargetedHome() } else if (_owner->GetTypeId()==TYPEID_UNIT && ((Creature*)_owner)->GetCharmerOrOwnerGUID()) { - sLog->outStaticDebug("Pet or controlled creature (Entry: %u GUID: %u) targeting home", _owner->GetEntry(), _owner->GetGUIDLow() ); + sLog->outStaticDebug("Pet or controlled creature (Entry: %u GUID: %u) targeting home", _owner->GetEntry(), _owner->GetGUIDLow()); Unit *target = ((Creature*)_owner)->GetCharmerOrOwner(); if (target) { - sLog->outStaticDebug("Following %s (GUID: %u)", target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow() ); + sLog->outStaticDebug("Following %s (GUID: %u)", target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow()); Mutate(new FollowMovementGenerator<Creature>(*target,PET_FOLLOW_DIST,PET_FOLLOW_ANGLE), MOTION_SLOT_ACTIVE); } } @@ -383,6 +386,12 @@ void MotionMaster::MoveFall(uint32 id/*=0*/) if (fabs(_owner->GetPositionZ() - tz) < 0.1f) return; + if (_owner->GetTypeId() == TYPEID_PLAYER) + { + _owner->AddUnitMovementFlag(MOVEMENTFLAG_FALLING); + _owner->m_movementInfo.SetFallTime(0); + } + Movement::MoveSplineInit init(*_owner); init.MoveTo(_owner->GetPositionX(), _owner->GetPositionY(), tz); init.SetFall(); diff --git a/src/server/game/Movement/MovementGenerator.h b/src/server/game/Movement/MovementGenerator.h index dd9ba32f337..0a2ebcfaeee 100755 --- a/src/server/game/Movement/MovementGenerator.h +++ b/src/server/game/Movement/MovementGenerator.h @@ -38,7 +38,7 @@ class MovementGenerator virtual void Reset(Unit &) = 0; - virtual bool Update(Unit &, const uint32 time_diff) = 0; + virtual bool Update(Unit &, const uint32& time_diff) = 0; virtual MovementGeneratorType GetMovementGeneratorType() = 0; @@ -64,7 +64,7 @@ class MovementGeneratorMedium : public MovementGenerator //u->AssertIsType<T>(); (static_cast<D*>(this))->Reset(*((T*)&u)); } - bool Update(Unit &u, const uint32 time_diff) + bool Update(Unit &u, const uint32& time_diff) { //u->AssertIsType<T>(); return (static_cast<D*>(this))->Update(*((T*)&u), time_diff); @@ -74,7 +74,7 @@ class MovementGeneratorMedium : public MovementGenerator void Initialize(T &u); void Finalize(T &u); void Reset(T &u); - bool Update(T &u, const uint32 time_diff); + bool Update(T &u, const uint32& time_diff); }; struct SelectableMovement : public FactoryHolder<MovementGenerator, MovementGeneratorType> diff --git a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp index 32b960028c2..54a68f92c66 100755 --- a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp @@ -32,11 +32,10 @@ template<class T> void ConfusedMovementGenerator<T>::Initialize(T &unit) { - const float wander_distance=4; - float x,y,z; - x = unit.GetPositionX(); - y = unit.GetPositionY(); - z = unit.GetPositionZ(); + float const wander_distance = 4; + float x = unit.GetPositionX(); + float y = unit.GetPositionY(); + float z = unit.GetPositionZ(); Map const* map = unit.GetBaseMap(); @@ -47,31 +46,42 @@ void ConfusedMovementGenerator<T>::Initialize(T &unit) for (uint8 idx = 0; idx < MAX_CONF_WAYPOINTS + 1; ++idx) { - const float wanderX=wander_distance*(float)rand_norm() - wander_distance/2; - const float wanderY=wander_distance*(float)rand_norm() - wander_distance/2; - - i_waypoints[idx][0] = x + wanderX; - i_waypoints[idx][1] = y + wanderY; + float wanderX = x + (wander_distance * (float)rand_norm() - wander_distance/2); + float wanderY = y + (wander_distance * (float)rand_norm() - wander_distance/2); // prevent invalid coordinates generation - Trinity::NormalizeMapCoord(i_waypoints[idx][0]); - Trinity::NormalizeMapCoord(i_waypoints[idx][1]); + Trinity::NormalizeMapCoord(wanderX); + Trinity::NormalizeMapCoord(wanderY); - bool is_water = map->IsInWater(i_waypoints[idx][0],i_waypoints[idx][1],z); - // if generated wrong path just ignore - if ((is_water && !is_water_ok) || (!is_water && !is_land_ok)) + if (unit.IsWithinLOS(wanderX, wanderY, z)) + { + bool is_water = map->IsInWater(wanderX, wanderY, z); + + if ((is_water && !is_water_ok) || (!is_water && !is_land_ok)) + { + //! Cannot use coordinates outside our InhabitType. Use the current or previous position. + wanderX = idx > 0 ? i_waypoints[idx-1][0] : x; + wanderY = idx > 0 ? i_waypoints[idx-1][1] : y; + } + } + else { - i_waypoints[idx][0] = idx > 0 ? i_waypoints[idx-1][0] : x; - i_waypoints[idx][1] = idx > 0 ? i_waypoints[idx-1][1] : y; + //! Trying to access path outside line of sight. Skip this by using the current or previous position. + wanderX = idx > 0 ? i_waypoints[idx-1][0] : x; + wanderY = idx > 0 ? i_waypoints[idx-1][1] : y; } - unit.UpdateAllowedPositionZ(i_waypoints[idx][0], i_waypoints[idx][1], z); - i_waypoints[idx][2] = z; + unit.UpdateAllowedPositionZ(wanderX, wanderY, z); + + //! Positions are fine - apply them to this waypoint + i_waypoints[idx][0] = wanderX; + i_waypoints[idx][1] = wanderY; + i_waypoints[idx][2] = z; } unit.StopMoving(); unit.SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED); - unit.AddUnitState(UNIT_STATE_CONFUSED|UNIT_STATE_CONFUSED_MOVE); + unit.AddUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_CONFUSED_MOVE); } template<> @@ -94,7 +104,7 @@ void ConfusedMovementGenerator<T>::Reset(T &unit) i_nextMove = 1; i_nextMoveTime.Reset(0); unit.StopMoving(); - unit.AddUnitState(UNIT_STATE_CONFUSED|UNIT_STATE_CONFUSED_MOVE); + unit.AddUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_CONFUSED_MOVE); } template<class T> @@ -110,20 +120,20 @@ bool ConfusedMovementGenerator<T>::Update(T &unit, const uint32 &diff) if (unit.movespline->Finalized()) { - i_nextMove = urand(1,MAX_CONF_WAYPOINTS); - i_nextMoveTime.Reset(urand(0, 1500-1)); // TODO: check the minimum reset time, should be probably higher + i_nextMove = urand(1, MAX_CONF_WAYPOINTS); + i_nextMoveTime.Reset(urand(500, 1200)); // Guessed } } else { // waiting for next move i_nextMoveTime.Update(diff); - if(i_nextMoveTime.Passed() ) + if (i_nextMoveTime.Passed()) { // start moving unit.AddUnitState(UNIT_STATE_CONFUSED_MOVE); - ASSERT( i_nextMove <= MAX_CONF_WAYPOINTS ); + ASSERT(i_nextMove <= MAX_CONF_WAYPOINTS); float x = i_waypoints[i_nextMove][0]; float y = i_waypoints[i_nextMove][1]; float z = i_waypoints[i_nextMove][2]; @@ -141,14 +151,14 @@ template<> void ConfusedMovementGenerator<Player>::Finalize(Player &unit) { unit.RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED); - unit.ClearUnitState(UNIT_STATE_CONFUSED|UNIT_STATE_CONFUSED_MOVE); + unit.ClearUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_CONFUSED_MOVE); } template<> void ConfusedMovementGenerator<Creature>::Finalize(Creature &unit) { unit.RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED); - unit.ClearUnitState(UNIT_STATE_CONFUSED|UNIT_STATE_CONFUSED_MOVE); + unit.ClearUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_CONFUSED_MOVE); if (unit.getVictim()) unit.SetTarget(unit.getVictim()->GetGUID()); } diff --git a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h index b9f96bb785d..7f2226ea069 100755 --- a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h @@ -22,11 +22,10 @@ #include "MovementGenerator.h" #include "Timer.h" -#define MAX_CONF_WAYPOINTS 24 +#define MAX_CONF_WAYPOINTS 24 //! Allows a twelve second confusion if i_nextMove always is the absolute minimum timer. template<class T> -class ConfusedMovementGenerator -: public MovementGeneratorMedium< T, ConfusedMovementGenerator<T> > +class ConfusedMovementGenerator : public MovementGeneratorMedium< T, ConfusedMovementGenerator<T> > { public: explicit ConfusedMovementGenerator() : i_nextMoveTime(0) {} diff --git a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp index 216afbb2b20..08e27abf050 100755 --- a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp @@ -28,8 +28,7 @@ #define MAX_QUIET_DISTANCE 43.0f template<class T> -void -FleeingMovementGenerator<T>::_setTargetLocation(T &owner) +void FleeingMovementGenerator<T>::_setTargetLocation(T &owner) { if (!&owner) return; @@ -53,8 +52,7 @@ FleeingMovementGenerator<T>::_setTargetLocation(T &owner) } template<class T> -bool -FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z) +bool FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z) { if (!&owner) return false; @@ -65,8 +63,8 @@ FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z) float temp_x, temp_y, angle; const Map* _map = owner.GetBaseMap(); - //primitive path-finding - for(uint8 i = 0; i < 18; ++i) + // primitive path-finding + for (uint8 i = 0; i < 18; ++i) { if (i_only_forward && i > 2) break; @@ -182,13 +180,12 @@ FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z) } } i_to_distance_from_caster = 0.0f; - i_nextCheckTime.Reset( urand(500,1000) ); + i_nextCheckTime.Reset(urand(500,1000)); return false; } template<class T> -bool -FleeingMovementGenerator<T>::_setMoveData(T &owner) +bool FleeingMovementGenerator<T>::_setMoveData(T &owner) { float cur_dist_xyz = owner.GetDistance(i_caster_x, i_caster_y, i_caster_z); @@ -201,12 +198,12 @@ FleeingMovementGenerator<T>::_setMoveData(T &owner) (i_last_distance_from_caster < i_to_distance_from_caster && cur_dist_xyz > i_to_distance_from_caster) || // if we reach bigger distance (cur_dist_xyz > MAX_QUIET_DISTANCE) || // if we are too far - (i_last_distance_from_caster > MIN_QUIET_DISTANCE && cur_dist_xyz < MIN_QUIET_DISTANCE) ) + (i_last_distance_from_caster > MIN_QUIET_DISTANCE && cur_dist_xyz < MIN_QUIET_DISTANCE)) // if we leave 'quiet zone' { // we are very far or too close, stopping i_to_distance_from_caster = 0.0f; - i_nextCheckTime.Reset( urand(500,1000) ); + i_nextCheckTime.Reset(urand(500,1000)); return false; } else @@ -280,8 +277,7 @@ FleeingMovementGenerator<T>::_setMoveData(T &owner) } template<class T> -void -FleeingMovementGenerator<T>::Initialize(T &owner) +void FleeingMovementGenerator<T>::Initialize(T &owner) { if (!&owner) return; @@ -312,8 +308,7 @@ FleeingMovementGenerator<T>::Initialize(T &owner) } template<> -void -FleeingMovementGenerator<Creature>::_Init(Creature &owner) +void FleeingMovementGenerator<Creature>::_Init(Creature &owner) { if (!&owner) return; @@ -324,8 +319,7 @@ FleeingMovementGenerator<Creature>::_Init(Creature &owner) } template<> -void -FleeingMovementGenerator<Player>::_Init(Player &) +void FleeingMovementGenerator<Player>::_Init(Player &) { is_water_ok = true; is_land_ok = true; @@ -354,8 +348,7 @@ void FleeingMovementGenerator<T>::Reset(T &owner) } template<class T> -bool -FleeingMovementGenerator<T>::Update(T &owner, const uint32 &time_diff) +bool FleeingMovementGenerator<T>::Update(T &owner, const uint32 &time_diff) { if (!&owner || !owner.isAlive()) return false; @@ -399,7 +392,7 @@ void TimedFleeingMovementGenerator::Finalize(Unit &owner) } } -bool TimedFleeingMovementGenerator::Update(Unit & owner, const uint32 time_diff) +bool TimedFleeingMovementGenerator::Update(Unit & owner, const uint32& time_diff) { if (!owner.isAlive()) return false; diff --git a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h index 750db52bb5a..aec93ad3375 100755 --- a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h @@ -22,8 +22,7 @@ #include "MovementGenerator.h" template<class T> -class FleeingMovementGenerator -: public MovementGeneratorMedium< T, FleeingMovementGenerator<T> > +class FleeingMovementGenerator : public MovementGeneratorMedium< T, FleeingMovementGenerator<T> > { public: FleeingMovementGenerator(uint64 fright) : i_frightGUID(fright), i_nextCheckTime(0) {} @@ -55,8 +54,7 @@ class FleeingMovementGenerator TimeTracker i_nextCheckTime; }; -class TimedFleeingMovementGenerator -: public FleeingMovementGenerator<Creature> +class TimedFleeingMovementGenerator : public FleeingMovementGenerator<Creature> { public: TimedFleeingMovementGenerator(uint64 fright, uint32 time) : @@ -64,7 +62,7 @@ class TimedFleeingMovementGenerator i_totalFleeTime(time) {} MovementGeneratorType GetMovementGeneratorType() { return TIMED_FLEEING_MOTION_TYPE; } - bool Update(Unit &, const uint32); + bool Update(Unit &, const uint32&); void Finalize(Unit &); private: diff --git a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp index 5725aec54f6..a8bdb698432 100755 --- a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp @@ -25,7 +25,6 @@ void HomeMovementGenerator<Creature>::Initialize(Creature & owner) { - owner.AddUnitState(UNIT_STATE_EVADE); _setTargetLocation(owner); } @@ -35,9 +34,6 @@ void HomeMovementGenerator<Creature>::Reset(Creature &) void HomeMovementGenerator<Creature>::_setTargetLocation(Creature & owner) { - if (!&owner) - return; - if (owner.HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DISTRACTED)) return; diff --git a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.h b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.h index c724edc91ff..95eb05f281c 100755 --- a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.h @@ -27,8 +27,7 @@ template < class T > class HomeMovementGenerator; template <> -class HomeMovementGenerator<Creature> -: public MovementGeneratorMedium< Creature, HomeMovementGenerator<Creature> > +class HomeMovementGenerator<Creature> : public MovementGeneratorMedium< Creature, HomeMovementGenerator<Creature> > { public: diff --git a/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp index 36561e00b93..5a2090cfe28 100755 --- a/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp @@ -29,16 +29,15 @@ void IdleMovementGenerator::Initialize(Unit &owner) Reset(owner); } -void -IdleMovementGenerator::Reset(Unit& owner) +void IdleMovementGenerator::Reset(Unit& owner) { - if (owner.HasUnitState(UNIT_STATE_MOVE)) + if (!owner.IsStopped()) owner.StopMoving(); } void RotateMovementGenerator::Initialize(Unit& owner) { - if (owner.HasUnitState(UNIT_STATE_MOVE)) + if (!owner.IsStopped()) owner.StopMoving(); if (owner.getVictim()) @@ -49,7 +48,7 @@ void RotateMovementGenerator::Initialize(Unit& owner) owner.AttackStop(); } -bool RotateMovementGenerator::Update(Unit& owner, const uint32 diff) +bool RotateMovementGenerator::Update(Unit& owner, const uint32& diff) { float angle = owner.GetOrientation(); if (m_direction == ROTATE_DIRECTION_LEFT) @@ -80,20 +79,17 @@ void RotateMovementGenerator::Finalize(Unit &unit) unit.ToCreature()->AI()->MovementInform(ROTATE_MOTION_TYPE, 0); } -void -DistractMovementGenerator::Initialize(Unit& owner) +void DistractMovementGenerator::Initialize(Unit& owner) { owner.AddUnitState(UNIT_STATE_DISTRACTED); } -void -DistractMovementGenerator::Finalize(Unit& owner) +void DistractMovementGenerator::Finalize(Unit& owner) { owner.ClearUnitState(UNIT_STATE_DISTRACTED); } -bool -DistractMovementGenerator::Update(Unit& /*owner*/, const uint32 time_diff) +bool DistractMovementGenerator::Update(Unit& /*owner*/, const uint32& time_diff) { if (time_diff > m_timer) return false; @@ -102,8 +98,7 @@ DistractMovementGenerator::Update(Unit& /*owner*/, const uint32 time_diff) return true; } -void -AssistanceDistractMovementGenerator::Finalize(Unit &unit) +void AssistanceDistractMovementGenerator::Finalize(Unit &unit) { unit.ClearUnitState(UNIT_STATE_DISTRACTED); unit.ToCreature()->SetReactState(REACT_AGGRESSIVE); diff --git a/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.h b/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.h index 8180a86c49b..7acec82af98 100755 --- a/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.h @@ -28,7 +28,7 @@ class IdleMovementGenerator : public MovementGenerator void Initialize(Unit &); void Finalize(Unit &) { } void Reset(Unit &); - bool Update(Unit &, const uint32) { return true; } + bool Update(Unit &, const uint32&) { return true; } MovementGeneratorType GetMovementGeneratorType() { return IDLE_MOTION_TYPE; } }; @@ -42,7 +42,7 @@ class RotateMovementGenerator : public MovementGenerator void Initialize(Unit& owner); void Finalize(Unit& owner); void Reset(Unit& owner) { Initialize(owner); } - bool Update(Unit& owner, const uint32 time_diff); + bool Update(Unit& owner, const uint32& time_diff); MovementGeneratorType GetMovementGeneratorType() { return ROTATE_MOTION_TYPE; } private: @@ -58,7 +58,7 @@ class DistractMovementGenerator : public MovementGenerator void Initialize(Unit& owner); void Finalize(Unit& owner); void Reset(Unit& owner) { Initialize(owner); } - bool Update(Unit& owner, const uint32 time_diff); + bool Update(Unit& owner, const uint32& time_diff); MovementGeneratorType GetMovementGeneratorType() { return DISTRACT_MOTION_TYPE; } private: diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp index c565e150740..a922c937b5f 100755 --- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp @@ -46,7 +46,7 @@ bool PointMovementGenerator<T>::Update(T &unit, const uint32 & /*diff*/) if (!&unit) return false; - if(unit.HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED)) + if (unit.HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED)) { unit.ClearUnitState(UNIT_STATE_ROAMING_MOVE); return true; @@ -57,7 +57,7 @@ bool PointMovementGenerator<T>::Update(T &unit, const uint32 & /*diff*/) } template<class T> -void PointMovementGenerator<T>:: Finalize(T &unit) +void PointMovementGenerator<T>::Finalize(T &unit) { unit.ClearUnitState(UNIT_STATE_ROAMING|UNIT_STATE_ROAMING_MOVE); @@ -107,7 +107,7 @@ void AssistanceMovementGenerator::Finalize(Unit &unit) unit.GetMotionMaster()->MoveSeekAssistanceDistract(sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY)); } -bool EffectMovementGenerator::Update(Unit &unit, const uint32) +bool EffectMovementGenerator::Update(Unit &unit, const uint32&) { return !unit.movespline->Finalized(); } @@ -117,7 +117,7 @@ void EffectMovementGenerator::Finalize(Unit &unit) if (unit.GetTypeId() != TYPEID_UNIT) return; - if (((Creature&)unit).AI() && unit.movespline->Finalized()) + if (((Creature&)unit).AI()) ((Creature&)unit).AI()->MovementInform(EFFECT_MOTION_TYPE, m_Id); // Need restore previous movement since we have no proper states system //if (unit.isAlive() && !unit.HasUnitState(UNIT_STATE_CONFUSED|UNIT_STATE_FLEEING)) diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h index e47f3d93450..13be9fee77b 100755 --- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h @@ -23,8 +23,7 @@ #include "FollowerReference.h" template<class T> -class PointMovementGenerator -: public MovementGeneratorMedium< T, PointMovementGenerator<T> > +class PointMovementGenerator : public MovementGeneratorMedium< T, PointMovementGenerator<T> > { public: PointMovementGenerator(uint32 _id, float _x, float _y, float _z, float _speed = 0.0f) : id(_id), @@ -46,8 +45,7 @@ class PointMovementGenerator float speed; }; -class AssistanceMovementGenerator -: public PointMovementGenerator<Creature> +class AssistanceMovementGenerator : public PointMovementGenerator<Creature> { public: AssistanceMovementGenerator(float _x, float _y, float _z) : @@ -65,7 +63,7 @@ class EffectMovementGenerator : public MovementGenerator void Initialize(Unit &) {} void Finalize(Unit &unit); void Reset(Unit &) {} - bool Update(Unit &u, const uint32); + bool Update(Unit &u, const uint32&); MovementGeneratorType GetMovementGeneratorType() { return EFFECT_MOTION_TYPE; } private: uint32 m_Id; diff --git a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp index b65fa210723..84cd9e88295 100755 --- a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp @@ -42,7 +42,7 @@ void RandomMovementGenerator<Creature>::_setRandomLocation(Creature& creature) // For 2D/3D system selection //bool is_land_ok = creature.CanWalk(); // not used? //bool is_water_ok = creature.CanSwim(); // not used? - bool is_air_ok = creature.canFly(); + bool is_air_ok = creature.CanFly(); const float angle = float(rand_norm()) * static_cast<float>(M_PI*2.0f); const float range = float(rand_norm()) * wander_distance; @@ -127,8 +127,7 @@ void RandomMovementGenerator<Creature>::Initialize(Creature &creature) } template<> -void -RandomMovementGenerator<Creature>::Reset(Creature &creature) +void RandomMovementGenerator<Creature>::Reset(Creature &creature) { Initialize(creature); } @@ -141,8 +140,7 @@ void RandomMovementGenerator<Creature>::Finalize(Creature &creature) } template<> -bool -RandomMovementGenerator<Creature>::Update(Creature &creature, const uint32 diff) +bool RandomMovementGenerator<Creature>::Update(Creature &creature, const uint32 diff) { if (creature.HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DISTRACTED)) { diff --git a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h index 67161b6fc29..07ec3647052 100755 --- a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h @@ -22,8 +22,7 @@ #include "MovementGenerator.h" template<class T> -class RandomMovementGenerator -: public MovementGeneratorMedium< T, RandomMovementGenerator<T> > +class RandomMovementGenerator : public MovementGeneratorMedium< T, RandomMovementGenerator<T> > { public: RandomMovementGenerator(float spawn_dist = 0.0f) : i_nextMoveTime(0), wander_distance(spawn_dist) {} diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp index 064a8fc8297..fdff5a92564 100755 --- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp @@ -40,12 +40,12 @@ void TargetedMovementGeneratorMedium<T,D>::_setTargetLocation(T &owner) float x, y, z; //! Following block of code deleted by MrSmite in issue 4891 //! Code kept for learning and diagnostical purposes -// +// // if (i_offset && i_target->IsWithinDistInMap(&owner,2*i_offset)) // { // if (!owner.movespline->Finalized()) // return; -// +// // owner.GetPosition(x, y, z); // } // else @@ -78,7 +78,7 @@ void TargetedMovementGeneratorMedium<T,D>::_setTargetLocation(T &owner) //We don't update Mob Movement, if the difference between New destination and last destination is < BothObjectSize float bothObjectSize = i_target->GetObjectBoundingRadius() + owner.GetObjectBoundingRadius() + CONTACT_DISTANCE; - if( i_destinationHolder.HasDestination() && i_destinationHolder.GetDestinationDiff(x,y,z) < bothObjectSize ) + if ( i_destinationHolder.HasDestination() && i_destinationHolder.GetDestinationDiff(x,y,z) < bothObjectSize ) return; */ @@ -135,7 +135,7 @@ bool TargetedMovementGeneratorMedium<T,D>::Update(T &owner, const uint32 & time_ } // prevent movement while casting spells with cast time or channel time - if (owner.IsNonMeleeSpellCasted(false, false, true)) + if (owner.HasUnitState(UNIT_STATE_CASTING)) { if (!owner.IsStopped()) owner.StopMoving(); diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h index b851dbc0e05..29fd73624e1 100755 --- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h @@ -34,8 +34,7 @@ class TargetedMovementGeneratorBase }; template<class T, typename D> -class TargetedMovementGeneratorMedium -: public MovementGeneratorMedium< T, D >, public TargetedMovementGeneratorBase +class TargetedMovementGeneratorMedium : public MovementGeneratorMedium< T, D >, public TargetedMovementGeneratorBase { protected: TargetedMovementGeneratorMedium(Unit &target, float offset, float angle) : diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index fb2249c508e..25730f92161 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -79,7 +79,7 @@ void WaypointMovementGenerator<Creature>::OnArrived(Creature& creature) if (i_path->at(i_currentNode)->event_id && urand(0, 99) < i_path->at(i_currentNode)->event_chance) { sLog->outDebug(LOG_FILTER_MAPSCRIPTS, "Creature movement start script %u at point %u for "UI64FMTD".", i_path->at(i_currentNode)->event_id, i_currentNode, creature.GetGUID()); - creature.GetMap()->ScriptsStart(sWaypointScripts, i_path->at(i_currentNode)->event_id, &creature, NULL/*, false*/); + creature.GetMap()->ScriptsStart(sWaypointScripts, i_path->at(i_currentNode)->event_id, &creature, NULL); } // Inform script @@ -107,7 +107,7 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature &creature) i_currentNode = (i_currentNode+1) % i_path->size(); } - const WaypointData *node = i_path->at(i_currentNode); + WaypointData const* node = i_path->at(i_currentNode); m_isArrivalDone = false; @@ -116,7 +116,8 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature &creature) Movement::MoveSplineInit init(creature); init.MoveTo(node->x, node->y, node->z); - if (node->orientation != 100 && node->delay != 0) + //! Accepts angles such as 0.00001 and -0.00001, 0 must be ignored, default value in waypoint table + if (node->orientation && node->delay) init.SetFacing(node->orientation); init.SetWalk(!node->run); @@ -231,7 +232,7 @@ void FlightPathMovementGenerator::Reset(Player & player) uint32 end = GetPathAtMapEnd(); for (uint32 i = GetCurrentNode(); i != end; ++i) { - G3D::Vector3 vertice((*i_path)[i].x,(*i_path)[i].y,(*i_path)[i].z); + G3D::Vector3 vertice((*i_path)[i].x, (*i_path)[i].y, (*i_path)[i].z); init.Path().push_back(vertice); } init.SetFirstPointId(GetCurrentNode()); @@ -240,7 +241,7 @@ void FlightPathMovementGenerator::Reset(Player & player) init.Launch(); } -bool FlightPathMovementGenerator::Update(Player &player, const uint32 /*diff*/) +bool FlightPathMovementGenerator::Update(Player &player, const uint32& /*diff*/) { uint32 pointId = (uint32)player.movespline->currentPathIdx(); if (pointId > i_currentNode) diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h index 9c2475267f6..0d8f047c83a 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h @@ -58,9 +58,8 @@ template<class T> class WaypointMovementGenerator; template<> -class WaypointMovementGenerator<Creature> -: public MovementGeneratorMedium< Creature, WaypointMovementGenerator<Creature> >, -public PathMovementBase<Creature, WaypointPath const*> +class WaypointMovementGenerator<Creature> : public MovementGeneratorMedium< Creature, WaypointMovementGenerator<Creature> >, + public PathMovementBase<Creature, WaypointPath const*> { public: WaypointMovementGenerator(uint32 _path_id = 0, bool _repeating = true) @@ -110,9 +109,8 @@ public PathMovementBase<Creature, WaypointPath const*> /** FlightPathMovementGenerator generates movement of the player for the paths * and hence generates ground and activities for the player. */ -class FlightPathMovementGenerator -: public MovementGeneratorMedium< Player, FlightPathMovementGenerator >, -public PathMovementBase<Player, TaxiPathNodeList const*> +class FlightPathMovementGenerator : public MovementGeneratorMedium< Player, FlightPathMovementGenerator >, + public PathMovementBase<Player, TaxiPathNodeList const*> { public: explicit FlightPathMovementGenerator(TaxiPathNodeList const& pathnodes, uint32 startNode = 0) @@ -123,7 +121,7 @@ public PathMovementBase<Player, TaxiPathNodeList const*> void Initialize(Player &); void Reset(Player &); void Finalize(Player &); - bool Update(Player &, const uint32); + bool Update(Player &, const uint32&); MovementGeneratorType GetMovementGeneratorType() { return FLIGHT_MOTION_TYPE; } TaxiPathNodeList const& GetPath() { return *i_path; } diff --git a/src/server/game/Movement/Spline/MoveSpline.cpp b/src/server/game/Movement/Spline/MoveSpline.cpp index 5d0344f9769..91b4ff08250 100644 --- a/src/server/game/Movement/Spline/MoveSpline.cpp +++ b/src/server/game/Movement/Spline/MoveSpline.cpp @@ -288,7 +288,7 @@ std::string MoveSpline::ToString() const str << "facing angle: " << facing.angle; else if (splineflags.final_target) str << "facing target: " << facing.target; - else if(splineflags.final_point) + else if (splineflags.final_point) str << "facing point: " << facing.f.x << " " << facing.f.y << " " << facing.f.z; str << std::endl; str << "time passed: " << time_passed << std::endl; diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp index b5ae923dc32..e586cb4f4f9 100644 --- a/src/server/game/Movement/Spline/MoveSplineInit.cpp +++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp @@ -25,9 +25,13 @@ namespace Movement { UnitMoveType SelectSpeedType(uint32 moveFlags) { - if (moveFlags & MOVEMENTFLAG_FLYING) + /*! Not sure about MOVEMENTFLAG_CAN_FLY here - do creatures that can fly + but are on ground right now also have it? If yes, this needs a more + dynamic check, such as is flying now + */ + if (moveFlags & (MOVEMENTFLAG_FLYING | MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_DISABLE_GRAVITY)) { - if ( moveFlags & MOVEMENTFLAG_BACKWARD /*&& speed_obj.flight >= speed_obj.flight_back*/ ) + if (moveFlags & MOVEMENTFLAG_BACKWARD /*&& speed_obj.flight >= speed_obj.flight_back*/) return MOVE_FLIGHT_BACK; else return MOVE_FLIGHT; @@ -41,7 +45,7 @@ namespace Movement } else if (moveFlags & MOVEMENTFLAG_WALKING) { - //if ( speed_obj.run > speed_obj.walk ) + //if (speed_obj.run > speed_obj.walk) return MOVE_WALK; } else if (moveFlags & MOVEMENTFLAG_BACKWARD /*&& speed_obj.run >= speed_obj.run_back*/) @@ -54,7 +58,7 @@ namespace Movement { MoveSpline& move_spline = *unit.movespline; - Location real_position(unit.GetPositionX(),unit.GetPositionY(),unit.GetPositionZ(),unit.GetOrientation()); + Location real_position(unit.GetPositionX(),unit.GetPositionY(),unit.GetPositionZMinusOffset(),unit.GetOrientation()); // there is a big chane that current position is unknown if current state is not finalized, need compute it // this also allows calculate spline position and update map position in much greater intervals if (!move_spline.Finalized()) @@ -100,7 +104,7 @@ namespace Movement { // mix existing state into new args.flags.walkmode = unit.m_movementInfo.HasMovementFlag(MOVEMENTFLAG_WALKING); - args.flags.flying = unit.m_movementInfo.HasMovementFlag((MovementFlags)(MOVEMENTFLAG_FLYING|MOVEMENTFLAG_LEVITATING)); + args.flags.flying = unit.m_movementInfo.HasMovementFlag((MovementFlags)(MOVEMENTFLAG_CAN_FLY|MOVEMENTFLAG_DISABLE_GRAVITY)); } void MoveSplineInit::SetFacing(const Unit * target) diff --git a/src/server/game/Movement/Spline/MovementPacketBuilder.cpp b/src/server/game/Movement/Spline/MovementPacketBuilder.cpp index 73fdbf4c2f6..0260767dbe2 100644 --- a/src/server/game/Movement/Spline/MovementPacketBuilder.cpp +++ b/src/server/game/Movement/Spline/MovementPacketBuilder.cpp @@ -44,11 +44,17 @@ namespace Movement void PacketBuilder::WriteCommonMonsterMovePart(const MoveSpline& move_spline, WorldPacket& data) { MoveSplineFlag splineflags = move_spline.splineflags; - /*if (mov.IsBoarded()) + /*if (unit->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) { data.SetOpcode(SMSG_MONSTER_MOVE_TRANSPORT); - data << mov.GetTransport()->Owner.GetPackGUID(); - data << int8(mov.m_unused.transport_seat); + if (unit->GetVehicle()) + data << unit->GetVehicle()->GetBase()->GetPackGUID(); + else if (unit->GetTransport()) + data << unit->GetTransport()->GetPackGUID(); + else + data << uint64(0); + + data << int8(unit->GetTransSeat()); }*/ data << uint8(0); @@ -57,21 +63,21 @@ namespace Movement switch(splineflags & MoveSplineFlag::Mask_Final_Facing) { - default: - data << uint8(MonsterMoveNormal); - break; - case MoveSplineFlag::Final_Target: - data << uint8(MonsterMoveFacingTarget); - data << move_spline.facing.target; - break; - case MoveSplineFlag::Final_Angle: - data << uint8(MonsterMoveFacingAngle); - data << move_spline.facing.angle; - break; - case MoveSplineFlag::Final_Point: - data << uint8(MonsterMoveFacingSpot); - data << move_spline.facing.f.x << move_spline.facing.f.y << move_spline.facing.f.z; - break; + case MoveSplineFlag::Final_Target: + data << uint8(MonsterMoveFacingTarget); + data << move_spline.facing.target; + break; + case MoveSplineFlag::Final_Angle: + data << uint8(MonsterMoveFacingAngle); + data << move_spline.facing.angle; + break; + case MoveSplineFlag::Final_Point: + data << uint8(MonsterMoveFacingSpot); + data << move_spline.facing.f.x << move_spline.facing.f.y << move_spline.facing.f.z; + break; + default: + data << uint8(MonsterMoveNormal); + break; } // add fake Enter_Cycle flag - needed for client-side cyclic movement (client will erase first spline vertex after first cycle done) @@ -105,7 +111,7 @@ namespace Movement Vector3 middle = (real_path[0] + real_path[last_idx]) / 2.f; Vector3 offset; // first and last points already appended - for(uint32 i = 1; i < last_idx; ++i) + for (uint32 i = 1; i < last_idx; ++i) { offset = middle - real_path[i]; data.appendPackXYZ(offset.x, offset.y, offset.z); @@ -163,7 +169,7 @@ namespace Movement { data << move_spline.facing.target; } - else if(splineFlags.final_point) + else if (splineFlags.final_point) { data << move_spline.facing.f.x << move_spline.facing.f.y << move_spline.facing.f.z; } diff --git a/src/server/game/Movement/Waypoints/WaypointManager.cpp b/src/server/game/Movement/Waypoints/WaypointManager.cpp index b957674151b..296c9eee50f 100755 --- a/src/server/game/Movement/Waypoints/WaypointManager.cpp +++ b/src/server/game/Movement/Waypoints/WaypointManager.cpp @@ -43,6 +43,7 @@ void WaypointMgr::Load() { uint32 oldMSTime = getMSTime(); + // 0 1 2 3 4 5 6 7 8 9 QueryResult result = WorldDatabase.Query("SELECT id, point, position_x, position_y, position_z, orientation, move_flag, delay, action, action_chance FROM waypoint_data ORDER BY id, point"); if (!result) @@ -78,7 +79,7 @@ void WaypointMgr::Load() wp->run = fields[6].GetBool(); wp->delay = fields[7].GetUInt32(); wp->event_id = fields[8].GetUInt32(); - wp->event_chance = fields[9].GetUInt8(); + wp->event_chance = fields[9].GetInt16(); path.push_back(wp); ++count; @@ -100,7 +101,12 @@ void WaypointMgr::ReloadPath(uint32 id) _waypointStore.erase(itr); } - QueryResult result = WorldDatabase.PQuery("SELECT point, position_x, position_y, position_z, orientation, move_flag, delay, action, action_chance FROM waypoint_data WHERE id = %u ORDER BY point", id); + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_BY_ID); + + stmt->setUInt32(0, id); + + PreparedQueryResult result = WorldDatabase.Query(stmt); + if (!result) return; diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp index 9f6ec547342..465fca75030 100755 --- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp @@ -436,20 +436,20 @@ void OutdoorPvP::HandleKill(Player* killer, Unit* killed) { for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { - Player* pGroupGuy = itr->getSource(); + Player* groupGuy = itr->getSource(); - if (!pGroupGuy) + if (!groupGuy) continue; // skip if too far away - if (!pGroupGuy->IsAtGroupRewardDistance(killed)) + if (!groupGuy->IsAtGroupRewardDistance(killed)) continue; // creature kills must be notified, even if not inside objective / not outdoor pvp active // player kills only count if active and inside objective - if ((pGroupGuy->IsOutdoorPvPActive() && IsInsideObjective(pGroupGuy)) || killed->GetTypeId() == TYPEID_UNIT) + if ((groupGuy->IsOutdoorPvPActive() && IsInsideObjective(groupGuy)) || killed->GetTypeId() == TYPEID_UNIT) { - HandleKillImpl(pGroupGuy, killed); + HandleKillImpl(groupGuy, killed); } } } diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp index 88e6db971f0..a079d2f643b 100755 --- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp @@ -27,7 +27,7 @@ OutdoorPvPMgr::OutdoorPvPMgr() //sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Instantiating OutdoorPvPMgr"); } -OutdoorPvPMgr::~OutdoorPvPMgr() +void OutdoorPvPMgr::Die() { //sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Deleting OutdoorPvPMgr"); for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr) @@ -41,7 +41,7 @@ void OutdoorPvPMgr::InitOutdoorPvP() { uint32 oldMSTime = getMSTime(); - // 0 1 + // 0 1 QueryResult result = WorldDatabase.Query("SELECT TypeId, ScriptName FROM outdoorpvp_template"); if (!result) @@ -58,7 +58,7 @@ void OutdoorPvPMgr::InitOutdoorPvP() { Field* fields = result->Fetch(); - typeId = fields[0].GetUInt32(); + typeId = fields[0].GetUInt8(); if (DisableMgr::IsDisabledFor(DISABLE_TYPE_OUTDOORPVP, typeId, NULL)) continue; diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.h b/src/server/game/OutdoorPvP/OutdoorPvPMgr.h index 3a66a87ecba..1313e29bfb4 100755 --- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.h +++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.h @@ -42,12 +42,15 @@ class OutdoorPvPMgr private: OutdoorPvPMgr(); - ~OutdoorPvPMgr(); + ~OutdoorPvPMgr() {}; public: // create outdoor pvp events void InitOutdoorPvP(); + // cleanup + void Die(); + // called when a player enters an outdoor pvp area void HandlePlayerEnterZone(Player* player, uint32 areaflag); diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp index 05ce7a0a50d..d8548b552d3 100755 --- a/src/server/game/Pools/PoolMgr.cpp +++ b/src/server/game/Pools/PoolMgr.cpp @@ -440,7 +440,12 @@ void PoolGroup<Quest>::SpawnObject(ActivePoolData& spawns, uint32 limit, uint32 // load state from db if (!triggerFrom) { - QueryResult result = CharacterDatabase.PQuery("SELECT quest_id FROM pool_quest_save WHERE pool_id = %u", poolId); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_POOL_QUEST_SAVE); + + stmt->setUInt32(0, poolId); + + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (result) { do @@ -474,7 +479,7 @@ void PoolGroup<Quest>::SpawnObject(ActivePoolData& spawns, uint32 limit, uint32 { do { - uint32 questId = SelectRandomContainerElement(currentQuests); + uint32 questId = Trinity::Containers::SelectRandomContainerElement(currentQuests); newQuests.insert(questId); currentQuests.erase(questId); } while (newQuests.size() < limit && !currentQuests.empty()); // failsafe @@ -486,7 +491,7 @@ void PoolGroup<Quest>::SpawnObject(ActivePoolData& spawns, uint32 limit, uint32 // activate <limit> random quests do { - uint32 questId = SelectRandomContainerElement(newQuests); + uint32 questId = Trinity::Containers::SelectRandomContainerElement(newQuests); spawns.ActivateObject<Quest>(questId, poolId); PoolObject tempObj(questId, 0.0f); Spawn1Object(&tempObj); @@ -595,7 +600,7 @@ void PoolMgr::LoadFromDB() { uint32 oldMSTime = getMSTime(); - // 1 2 3 + // 1 2 3 QueryResult result = WorldDatabase.Query("SELECT guid, pool_entry, chance FROM pool_creature"); if (!result) diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp index abd8ebbb302..31c05c2723e 100755 --- a/src/server/game/Quests/QuestDef.cpp +++ b/src/server/game/Quests/QuestDef.cpp @@ -23,31 +23,31 @@ Quest::Quest(Field* questRecord) { Id = questRecord[0].GetUInt32(); - Method = questRecord[1].GetUInt32(); - Level = questRecord[2].GetInt32(); - MinLevel = questRecord[3].GetUInt32(); - MaxLevel = questRecord[4].GetUInt32(); - ZoneOrSort = questRecord[5].GetInt32(); - Type = questRecord[6].GetUInt32(); - SuggestedPlayers = questRecord[7].GetUInt32(); + Method = questRecord[1].GetUInt8(); + Level = questRecord[2].GetInt16(); + MinLevel = questRecord[3].GetUInt8(); + MaxLevel = questRecord[4].GetUInt8(); + ZoneOrSort = questRecord[5].GetInt16(); + Type = questRecord[6].GetUInt16(); + SuggestedPlayers = questRecord[7].GetUInt8(); LimitTime = questRecord[8].GetUInt32(); - RequiredClasses = questRecord[9].GetUInt32(); - RequiredRaces = questRecord[10].GetUInt32(); - RequiredSkillId = questRecord[11].GetUInt32(); - RequiredSkillPoints = questRecord[12].GetUInt32(); - RequiredFactionId1 = questRecord[13].GetUInt32(); - RequiredFactionId2 = questRecord[14].GetUInt32(); + RequiredClasses = questRecord[9].GetUInt16(); + RequiredRaces = questRecord[10].GetUInt16(); + RequiredSkillId = questRecord[11].GetUInt16(); + RequiredSkillPoints = questRecord[12].GetUInt16(); + RequiredFactionId1 = questRecord[13].GetUInt16(); + RequiredFactionId2 = questRecord[14].GetUInt16(); RequiredFactionValue1 = questRecord[15].GetInt32(); RequiredFactionValue2 = questRecord[16].GetInt32(); - RequiredMinRepFaction = questRecord[17].GetUInt32(); - RequiredMaxRepFaction = questRecord[18].GetUInt32(); + RequiredMinRepFaction = questRecord[17].GetUInt16(); + RequiredMaxRepFaction = questRecord[18].GetUInt16(); RequiredMinRepValue = questRecord[19].GetInt32(); RequiredMaxRepValue = questRecord[20].GetInt32(); PrevQuestId = questRecord[21].GetInt32(); NextQuestId = questRecord[22].GetInt32(); ExclusiveGroup = questRecord[23].GetInt32(); NextQuestIdChain = questRecord[24].GetUInt32(); - RewardXPId = questRecord[25].GetUInt32(); + RewardXPId = questRecord[25].GetUInt8(); RewardOrRequiredMoney = questRecord[26].GetInt32(); RewardMoneyMaxLevel = questRecord[27].GetUInt32(); RewardSpell = questRecord[28].GetUInt32(); @@ -57,15 +57,15 @@ Quest::Quest(Field* questRecord) RewardMailTemplateId = questRecord[32].GetUInt32(); RewardMailDelay = questRecord[33].GetUInt32(); SourceItemId = questRecord[34].GetUInt32(); - SourceItemIdCount = questRecord[35].GetUInt32(); + SourceItemIdCount = questRecord[35].GetUInt8(); SourceSpellid = questRecord[36].GetUInt32(); Flags = questRecord[37].GetUInt32(); - uint32 SpecialFlags = questRecord[38].GetUInt16(); + uint32 SpecialFlags = questRecord[38].GetUInt8(); MinimapTargetMark = questRecord[39].GetUInt32(); - RewardTitleId = questRecord[40].GetUInt32(); - RequiredPlayerKills = questRecord[41].GetUInt32(); - RewardTalents = questRecord[42].GetUInt32(); - RewardArenaPoints = questRecord[43].GetInt32(); + RewardTitleId = questRecord[40].GetUInt8(); + RequiredPlayerKills = questRecord[41].GetUInt8(); + RewardTalents = questRecord[42].GetUInt8(); + RewardArenaPoints = questRecord[43].GetUInt16(); RewardSkillId = questRecord[44].GetUInt32(); RewardSkillPoints = questRecord[45].GetUInt32(); RewardReputationMask = questRecord[46].GetUInt32(); @@ -76,16 +76,16 @@ Quest::Quest(Field* questRecord) RewardItemId[i] = questRecord[49+i].GetUInt32(); for (int i = 0; i < QUEST_REWARDS_COUNT; ++i) - RewardItemIdCount[i] = questRecord[53+i].GetUInt32(); + RewardItemIdCount[i] = questRecord[53+i].GetUInt16(); for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) RewardChoiceItemId[i] = questRecord[57+i].GetUInt32(); for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) - RewardChoiceItemCount[i] = questRecord[63+i].GetUInt32(); + RewardChoiceItemCount[i] = questRecord[63+i].GetUInt16(); for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) - RewardFactionId[i] = questRecord[69+i].GetUInt32(); + RewardFactionId[i] = questRecord[69+i].GetUInt16(); for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) RewardFactionValueId[i] = questRecord[74+i].GetInt32(); @@ -93,7 +93,7 @@ Quest::Quest(Field* questRecord) for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) RewardFactionValueIdOverride[i] = questRecord[79+i].GetInt32(); - PointMapId = questRecord[84].GetUInt32(); + PointMapId = questRecord[84].GetUInt16(); PointX = questRecord[85].GetFloat(); PointY = questRecord[86].GetFloat(); PointOption = questRecord[87].GetUInt32(); @@ -109,19 +109,19 @@ Quest::Quest(Field* questRecord) RequiredNpcOrGo[i] = questRecord[95+i].GetInt32(); for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) - RequiredNpcOrGoCount[i] = questRecord[99+i].GetUInt32(); + RequiredNpcOrGoCount[i] = questRecord[99+i].GetUInt16(); for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i) RequiredSourceItemId[i] = questRecord[103+i].GetUInt32(); for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i) - RequiredSourceItemCount[i] = questRecord[107+i].GetUInt32(); + RequiredSourceItemCount[i] = questRecord[107+i].GetUInt16(); for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) RequiredItemId[i] = questRecord[111+i].GetUInt32(); for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) - RequiredItemCount[i] = questRecord[117+i].GetUInt32(); + RequiredItemCount[i] = questRecord[117+i].GetUInt16(); RequiredSpell = questRecord[123].GetUInt32(); @@ -151,16 +151,16 @@ Quest::Quest(Field* questRecord) SoundTurnIn = questRecord[153].GetUInt32(); for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) - DetailsEmote[i] = questRecord[154+i].GetUInt32(); + DetailsEmote[i] = questRecord[154+i].GetUInt16(); for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) DetailsEmoteDelay[i] = questRecord[158+i].GetUInt32(); - EmoteOnIncomplete = questRecord[162].GetUInt32(); - EmoteOnComplete = questRecord[163].GetUInt32(); + EmoteOnIncomplete = questRecord[162].GetUInt16(); + EmoteOnComplete = questRecord[163].GetUInt16(); for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) - OfferRewardEmote[i] = questRecord[164+i].GetInt32(); + OfferRewardEmote[i] = questRecord[164+i].GetInt16(); for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) OfferRewardEmoteDelay[i] = questRecord[168+i].GetInt32(); diff --git a/src/server/game/Reputation/ReputationMgr.cpp b/src/server/game/Reputation/ReputationMgr.cpp index b1f38dfb86d..94a6590cc4a 100755 --- a/src/server/game/Reputation/ReputationMgr.cpp +++ b/src/server/game/Reputation/ReputationMgr.cpp @@ -166,15 +166,16 @@ void ReputationMgr::SendState(FactionState const* faction) { uint32 count = 1; - WorldPacket data(SMSG_SET_FACTION_STANDING, (16)); // last check 2.4.0 - data << (float) 0; // unk 2.4.0 - data << (uint8) 0; // wotlk 8634 + WorldPacket data(SMSG_SET_FACTION_STANDING, 17); + data << float(0); + data << uint8(_sendFactionIncreased); + _sendFactionIncreased = false; // Reset size_t p_count = data.wpos(); - data << (uint32) count; // placeholder + data << uint32(count); - data << (uint32) faction->ReputationListID; - data << (uint32) faction->Standing; + data << uint32(faction->ReputationListID); + data << uint32(faction->Standing); for (FactionStateList::iterator itr = _factions.begin(); itr != _factions.end(); ++itr) { @@ -183,8 +184,8 @@ void ReputationMgr::SendState(FactionState const* faction) itr->second.needSend = false; if (itr->second.ReputationListID != faction->ReputationListID) { - data << (uint32) itr->second.ReputationListID; - data << (uint32) itr->second.Standing; + data << uint32(itr->second.ReputationListID); + data << uint32(itr->second.Standing); ++count; } } @@ -253,6 +254,7 @@ void ReputationMgr::Initialize() _honoredFactionCount = 0; _reveredFactionCount = 0; _exaltedFactionCount = 0; + _sendFactionIncreased = false; for (unsigned int i = 1; i < sFactionStore.GetNumRows(); i++) { @@ -337,6 +339,7 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi } } } + // spillover done, update faction itself FactionStateList::iterator faction = _factions.find(factionEntry->reputationListID); if (faction != _factions.end()) @@ -379,11 +382,14 @@ bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, in if (new_rank <= REP_HOSTILE) SetAtWar(&itr->second, true); + if (new_rank > old_rank) + _sendFactionIncreased = true; + UpdateRankCounters(old_rank, new_rank); _player->ReputationChanged(factionEntry); - _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS, factionEntry->ID); - _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION, factionEntry->ID); + _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS, factionEntry->ID); + _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION, factionEntry->ID); _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION, factionEntry->ID); _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION, factionEntry->ID); _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION, factionEntry->ID); @@ -515,7 +521,7 @@ void ReputationMgr::LoadFromDB(PreparedQueryResult result) FactionState* faction = &_factions[factionEntry->reputationListID]; // update standing to current - faction->Standing = int32(fields[1].GetUInt32()); + faction->Standing = fields[1].GetInt32(); // update counters int32 BaseRep = GetBaseReputation(factionEntry); @@ -562,8 +568,18 @@ void ReputationMgr::SaveToDB(SQLTransaction& trans) { if (itr->second.needSave) { - trans->PAppend("DELETE FROM character_reputation WHERE guid = '%u' AND faction='%u'", _player->GetGUIDLow(), itr->second.ID); - trans->PAppend("INSERT INTO character_reputation (guid, faction, standing, flags) VALUES ('%u', '%u', '%i', '%u')", _player->GetGUIDLow(), itr->second.ID, itr->second.Standing, itr->second.Flags); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_REPUTATION_BY_FACTION); + stmt->setUInt32(0, _player->GetGUIDLow()); + stmt->setUInt16(1, uint16(itr->second.ID)); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_REPUTATION_BY_FACTION); + stmt->setUInt32(0, _player->GetGUIDLow()); + stmt->setUInt16(1, uint16(itr->second.ID)); + stmt->setInt32(2, itr->second.Standing); + stmt->setUInt16(3, uint16(itr->second.Flags)); + trans->Append(stmt); + itr->second.needSave = false; } } diff --git a/src/server/game/Reputation/ReputationMgr.h b/src/server/game/Reputation/ReputationMgr.h index 84013f7ec20..a073845ea73 100755 --- a/src/server/game/Reputation/ReputationMgr.h +++ b/src/server/game/Reputation/ReputationMgr.h @@ -132,6 +132,9 @@ class ReputationMgr void ApplyForceReaction(uint32 faction_id, ReputationRank rank, bool apply); + //! Public for chat command needs + bool SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing, bool incremental); + public: // senders void SendInitialReputations(); void SendForceReactions(); @@ -142,7 +145,6 @@ class ReputationMgr void Initialize(); uint32 GetDefaultStateFlags(FactionEntry const* factionEntry) const; bool SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental); - bool SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing, bool incremental); void SetVisible(FactionState* faction); void SetAtWar(FactionState* faction, bool atWar) const; void SetInactive(FactionState* faction, bool inactive) const; @@ -156,6 +158,7 @@ class ReputationMgr uint8 _honoredFactionCount :8; uint8 _reveredFactionCount :8; uint8 _exaltedFactionCount :8; + bool _sendFactionIncreased; //! Play visual effect on next SMSG_SET_FACTION_STANDING sent }; #endif diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp index 7757e1a1a35..5387a3132c6 100755 --- a/src/server/game/Scripting/MapScripts.cpp +++ b/src/server/game/Scripting/MapScripts.cpp @@ -39,9 +39,9 @@ void Map::ScriptsStart(ScriptMapMap const& scripts, uint32 id, Object* source, O return; // prepare static data - uint64 sourceGUID = source ? source->GetGUID() : (uint64)0; //some script commands doesn't have source - uint64 targetGUID = target ? target->GetGUID() : (uint64)0; - uint64 ownerGUID = (source->GetTypeId() == TYPEID_ITEM) ? ((Item*)source)->GetOwnerGUID() : (uint64)0; + uint64 sourceGUID = source ? source->GetGUID() : uint64(0); //some script commands doesn't have source + uint64 targetGUID = target ? target->GetGUID() : uint64(0); + uint64 ownerGUID = (source && source->GetTypeId() == TYPEID_ITEM) ? ((Item*)source)->GetOwnerGUID() : uint64(0); ///- Schedule script execution for all scripts in the script map ScriptMap const* s2 = &(s->second); @@ -74,9 +74,9 @@ void Map::ScriptCommandStart(ScriptInfo const& script, uint32 delay, Object* sou // NOTE: script record _must_ exist until command executed // prepare static data - uint64 sourceGUID = source ? source->GetGUID() : (uint64)0; - uint64 targetGUID = target ? target->GetGUID() : (uint64)0; - uint64 ownerGUID = (source->GetTypeId() == TYPEID_ITEM) ? ((Item*)source)->GetOwnerGUID() : (uint64)0; + uint64 sourceGUID = source ? source->GetGUID() : uint64(0); + uint64 targetGUID = target ? target->GetGUID() : uint64(0); + uint64 ownerGUID = (source && source->GetTypeId() == TYPEID_ITEM) ? ((Item*)source)->GetOwnerGUID() : uint64(0); ScriptAction sa; sa.sourceGUID = sourceGUID; @@ -375,22 +375,22 @@ void Map::ScriptsProcess() } if (step.script->Talk.Flags & SF_TALK_USE_PLAYER) { - if (Player* pSource = _GetScriptPlayerSourceOrTarget(source, target, step.script)) + if (Player* player = _GetScriptPlayerSourceOrTarget(source, target, step.script)) { - LocaleConstant loc_idx = pSource->GetSession()->GetSessionDbLocaleIndex(); + LocaleConstant loc_idx = player->GetSession()->GetSessionDbLocaleIndex(); std::string text(sObjectMgr->GetTrinityString(step.script->Talk.TextID, loc_idx)); switch (step.script->Talk.ChatType) { case CHAT_TYPE_SAY: - pSource->Say(text, LANG_UNIVERSAL); + player->Say(text, LANG_UNIVERSAL); break; case CHAT_TYPE_YELL: - pSource->Yell(text, LANG_UNIVERSAL); + player->Yell(text, LANG_UNIVERSAL); break; case CHAT_TYPE_TEXT_EMOTE: case CHAT_TYPE_BOSS_EMOTE: - pSource->TextEmote(text); + player->TextEmote(text); break; case CHAT_TYPE_WHISPER: case CHAT_MSG_RAID_BOSS_WHISPER: @@ -399,7 +399,7 @@ void Map::ScriptsProcess() if (!targetGUID || !IS_PLAYER_GUID(targetGUID)) sLog->outError("%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str()); else - pSource->Whisper(text, LANG_UNIVERSAL, targetGUID); + player->Whisper(text, LANG_UNIVERSAL, targetGUID); break; } default: @@ -524,8 +524,8 @@ void Map::ScriptsProcess() else { // Source or target must be Player. - if (Player* pSource = _GetScriptPlayerSourceOrTarget(source, target, step.script)) - pSource->TeleportTo(step.script->TeleportTo.MapID, step.script->TeleportTo.DestX, step.script->TeleportTo.DestY, step.script->TeleportTo.DestZ, step.script->TeleportTo.Orientation); + if (Player* player = _GetScriptPlayerSourceOrTarget(source, target, step.script)) + player->TeleportTo(step.script->TeleportTo.MapID, step.script->TeleportTo.DestX, step.script->TeleportTo.DestY, step.script->TeleportTo.DestZ, step.script->TeleportTo.Orientation); } break; @@ -544,8 +544,8 @@ void Map::ScriptsProcess() // when script called for item spell casting then target == (unit or GO) and source is player WorldObject* worldObject; - Player* plrTarget = target->ToPlayer(); - if (plrTarget) + Player* player = target->ToPlayer(); + if (player) { if (source->GetTypeId() != TYPEID_UNIT && source->GetTypeId() != TYPEID_GAMEOBJECT && source->GetTypeId() != TYPEID_PLAYER) { @@ -557,8 +557,8 @@ void Map::ScriptsProcess() } else { - plrTarget = source->ToPlayer(); - if (plrTarget) + player = source->ToPlayer(); + if (player) { if (target->GetTypeId() != TYPEID_UNIT && target->GetTypeId() != TYPEID_GAMEOBJECT && target->GetTypeId() != TYPEID_PLAYER) { @@ -566,7 +566,7 @@ void Map::ScriptsProcess() step.script->GetDebugInfo().c_str(), target->GetTypeId(), target->GetEntry(), target->GetGUIDLow()); break; } - worldObject = dynamic_cast<WorldObject*>(target); + worldObject = dynamic_cast<WorldObject*>(target); } else { @@ -579,22 +579,22 @@ void Map::ScriptsProcess() // quest id and flags checked at script loading if ((worldObject->GetTypeId() != TYPEID_UNIT || ((Unit*)worldObject)->isAlive()) && - (step.script->QuestExplored.Distance == 0 || worldObject->IsWithinDistInMap(plrTarget, float(step.script->QuestExplored.Distance)))) - plrTarget->AreaExploredOrEventHappens(step.script->QuestExplored.QuestID); + (step.script->QuestExplored.Distance == 0 || worldObject->IsWithinDistInMap(player, float(step.script->QuestExplored.Distance)))) + player->AreaExploredOrEventHappens(step.script->QuestExplored.QuestID); else - plrTarget->FailQuest(step.script->QuestExplored.QuestID); + player->FailQuest(step.script->QuestExplored.QuestID); break; } case SCRIPT_COMMAND_KILL_CREDIT: // Source or target must be Player. - if (Player* pSource = _GetScriptPlayerSourceOrTarget(source, target, step.script)) + if (Player* player = _GetScriptPlayerSourceOrTarget(source, target, step.script)) { if (step.script->KillCredit.Flags & SF_KILLCREDIT_REWARD_GROUP) - pSource->RewardPlayerAndGroupAtEvent(step.script->KillCredit.CreatureEntry, pSource); + player->RewardPlayerAndGroupAtEvent(step.script->KillCredit.CreatureEntry, player); else - pSource->KilledMonsterCredit(step.script->KillCredit.CreatureEntry, 0); + player->KilledMonsterCredit(step.script->KillCredit.CreatureEntry, 0); } break; @@ -665,7 +665,7 @@ void Map::ScriptsProcess() case SCRIPT_COMMAND_ACTIVATE_OBJECT: // Source must be Unit. - if (Unit* pSource = _GetScriptUnit(source, true, step.script)) + if (Unit* unit = _GetScriptUnit(source, true, step.script)) { // Target must be GameObject. if (!target) @@ -682,7 +682,7 @@ void Map::ScriptsProcess() } if (GameObject* pGO = target->ToGameObject()) - pGO->Use(pSource); + pGO->Use(unit); } break; @@ -690,8 +690,8 @@ void Map::ScriptsProcess() { // Source (datalong2 != 0) or target (datalong2 == 0) must be Unit. bool bReverse = step.script->RemoveAura.Flags & SF_REMOVEAURA_REVERSE; - if (Unit* pTarget = _GetScriptUnit(bReverse ? source : target, bReverse, step.script)) - pTarget->RemoveAurasDueToSpell(step.script->RemoveAura.SpellID); + if (Unit* unit = _GetScriptUnit(bReverse ? source : target, bReverse, step.script)) + unit->RemoveAurasDueToSpell(step.script->RemoveAura.SpellID); break; } @@ -752,23 +752,23 @@ void Map::ScriptsProcess() case SCRIPT_COMMAND_PLAY_SOUND: // Source must be WorldObject. - if (WorldObject* pSource = _GetScriptWorldObject(source, true, step.script)) + if (WorldObject* object = _GetScriptWorldObject(source, true, step.script)) { // PlaySound.Flags bitmask: 0/1=anyone/target - Player* pTarget = NULL; + Player* player = NULL; if (step.script->PlaySound.Flags & SF_PLAYSOUND_TARGET_PLAYER) { // Target must be Player. - pTarget = _GetScriptPlayer(target, false, step.script); - if (!pTarget) + player = _GetScriptPlayer(target, false, step.script); + if (!target) break; } // PlaySound.Flags bitmask: 0/2=without/with distance dependent if (step.script->PlaySound.Flags & SF_PLAYSOUND_DISTANCE_SOUND) - pSource->PlayDistanceSound(step.script->PlaySound.SoundID, pTarget); + object->PlayDistanceSound(step.script->PlaySound.SoundID, player); else - pSource->PlayDirectSound(step.script->PlaySound.SoundID, pTarget); + object->PlayDirectSound(step.script->PlaySound.SoundID, player); } break; @@ -796,12 +796,12 @@ void Map::ScriptsProcess() case SCRIPT_COMMAND_LOAD_PATH: // Source must be Unit. - if (Unit* pSource = _GetScriptUnit(source, true, step.script)) + if (Unit* unit = _GetScriptUnit(source, true, step.script)) { if (!sWaypointMgr->GetPath(step.script->LoadPath.PathID)) sLog->outError("%s source object has an invalid path (%u), skipping.", step.script->GetDebugInfo().c_str(), step.script->LoadPath.PathID); else - pSource->GetMotionMaster()->MovePath(step.script->LoadPath.PathID, step.script->LoadPath.IsRepeatable); + unit->GetMotionMaster()->MovePath(step.script->LoadPath.PathID, step.script->LoadPath.IsRepeatable); } break; @@ -876,21 +876,21 @@ void Map::ScriptsProcess() case SCRIPT_COMMAND_ORIENTATION: // Source must be Unit. - if (Unit* pSource = _GetScriptUnit(source, true, step.script)) + if (Unit* sourceUnit = _GetScriptUnit(source, true, step.script)) { - if (step.script->Orientation.Flags& SF_ORIENTATION_FACE_TARGET) + if (step.script->Orientation.Flags & SF_ORIENTATION_FACE_TARGET) { // Target must be Unit. - Unit* pTarget = _GetScriptUnit(target, false, step.script); - if (!pTarget) + Unit* targetUnit = _GetScriptUnit(target, false, step.script); + if (!targetUnit) break; - pSource->SetInFront(pTarget); + sourceUnit->SetInFront(targetUnit); } else - pSource->SetOrientation(step.script->Orientation.Orientation); + sourceUnit->SetOrientation(step.script->Orientation.Orientation); - pSource->SendMovementFlagUpdate(); + sourceUnit->SendMovementFlagUpdate(); } break; @@ -908,14 +908,14 @@ void Map::ScriptsProcess() case SCRIPT_COMMAND_CLOSE_GOSSIP: // Source must be Player. - if (Player* pSource = _GetScriptPlayer(source, true, step.script)) - pSource->PlayerTalkClass->SendCloseGossip(); + if (Player* player = _GetScriptPlayer(source, true, step.script)) + player->PlayerTalkClass->SendCloseGossip(); break; case SCRIPT_COMMAND_PLAYMOVIE: // Source must be Player. - if (Player* pSource = _GetScriptPlayer(source, true, step.script)) - pSource->SendMovieStart(step.script->PlayMovie.MovieID); + if (Player* player = _GetScriptPlayer(source, true, step.script)) + player->SendMovieStart(step.script->PlayMovie.MovieID); break; default: diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index 1207b654817..f64d0953e86 100755 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -61,7 +61,6 @@ void AddSC_reload_commandscript(); void AddSC_tele_commandscript(); void AddSC_titles_commandscript(); void AddSC_wp_commandscript(); -void AddSC_gps_commandscript(); #ifdef SCRIPTS //world @@ -151,7 +150,6 @@ void AddSC_boss_sulfuron(); void AddSC_boss_majordomo(); void AddSC_boss_ragnaros(); void AddSC_instance_molten_core(); -void AddSC_molten_core(); void AddSC_the_scarlet_enclave(); //Scarlet Enclave void AddSC_the_scarlet_enclave_c1(); void AddSC_the_scarlet_enclave_c2(); @@ -426,6 +424,7 @@ void AddSC_ulduar_teleporter(); void AddSC_boss_mimiron(); void AddSC_boss_hodir(); void AddSC_boss_freya(); +void AddSC_boss_algalon_the_observer(); void AddSC_instance_ulduar(); void AddSC_boss_keleseth(); //Utgarde Keep void AddSC_boss_skarvald_dalronn(); @@ -664,7 +663,6 @@ void AddCommandScripts() AddSC_tele_commandscript(); AddSC_titles_commandscript(); AddSC_wp_commandscript(); - AddSC_gps_commandscript(); } void AddWorldScripts() @@ -761,7 +759,6 @@ void AddEasternKingdomsScripts() AddSC_boss_majordomo(); AddSC_boss_ragnaros(); AddSC_instance_molten_core(); - AddSC_molten_core(); AddSC_the_scarlet_enclave(); //Scarlet Enclave AddSC_the_scarlet_enclave_c1(); AddSC_the_scarlet_enclave_c2(); @@ -1131,6 +1128,7 @@ void AddNorthrendScripts() AddSC_boss_mimiron(); AddSC_boss_hodir(); AddSC_boss_freya(); + AddSC_boss_algalon_the_observer(); AddSC_instance_ulduar(); AddSC_boss_keleseth(); //Utgarde Keep AddSC_boss_skarvald_dalronn(); diff --git a/src/server/game/Scripting/ScriptLoader.h b/src/server/game/Scripting/ScriptLoader.h index 409b3db4b7f..0db6917a0d4 100644 --- a/src/server/game/Scripting/ScriptLoader.h +++ b/src/server/game/Scripting/ScriptLoader.h @@ -1,6 +1,19 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> -* This program is free software licensed under GPL version 2 -* Please see the included DOCS/LICENSE.TXT for more information */ +/* + * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> + * + * 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/>. + */ #ifndef SC_SCRIPTLOADER_H #define SC_SCRIPTLOADER_H diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 47751338d66..23d18e12097 100755 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -181,7 +181,7 @@ void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* target) if (pData->uiSoundId) { - if (GetSoundEntriesStore()->LookupEntry(pData->uiSoundId)) + if (sSoundEntriesStore.LookupEntry(pData->uiSoundId)) pSource->SendPlaySound(pData->uiSoundId, false); else sLog->outError("TSCR: DoScriptText entry %i tried to process invalid sound id %u.", iTextEntry, pData->uiSoundId); @@ -260,7 +260,7 @@ void ScriptMgr::Initialize() void ScriptMgr::Unload() { #define SCR_CLEAR(T) \ - FOR_SCRIPTS(T, itr, end) \ + for (SCR_REG_ITR(T) itr = SCR_REG_LST(T).begin(); itr != SCR_REG_LST(T).end(); ++itr) \ delete itr->second; \ SCR_REG_LST(T).clear(); @@ -582,7 +582,7 @@ void ScriptMgr::OnCreateMap(Map* map) { ASSERT(map); - SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsContinent); + SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsWorldMap); itr->second->OnCreate(map); SCR_MAP_END; @@ -599,7 +599,7 @@ void ScriptMgr::OnDestroyMap(Map* map) { ASSERT(map); - SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsContinent); + SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsWorldMap); itr->second->OnDestroy(map); SCR_MAP_END; @@ -617,7 +617,7 @@ void ScriptMgr::OnLoadGridMap(Map* map, GridMap* gmap, uint32 gx, uint32 gy) ASSERT(map); ASSERT(gmap); - SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsContinent); + SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsWorldMap); itr->second->OnLoadGridMap(map, gmap, gx, gy); SCR_MAP_END; @@ -635,7 +635,7 @@ void ScriptMgr::OnUnloadGridMap(Map* map, GridMap* gmap, uint32 gx, uint32 gy) ASSERT(map); ASSERT(gmap); - SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsContinent); + SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsWorldMap); itr->second->OnUnloadGridMap(map, gmap, gx, gy); SCR_MAP_END; @@ -653,7 +653,7 @@ void ScriptMgr::OnPlayerEnterMap(Map* map, Player* player) ASSERT(map); ASSERT(player); - SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsContinent); + SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsWorldMap); itr->second->OnPlayerEnter(map, player); SCR_MAP_END; @@ -671,7 +671,7 @@ void ScriptMgr::OnPlayerLeaveMap(Map* map, Player* player) ASSERT(map); ASSERT(player); - SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsContinent); + SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsWorldMap); itr->second->OnPlayerLeave(map, player); SCR_MAP_END; @@ -688,7 +688,7 @@ void ScriptMgr::OnMapUpdate(Map* map, uint32 diff) { ASSERT(map); - SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsContinent); + SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsWorldMap); itr->second->OnUpdate(map, diff); SCR_MAP_END; @@ -937,6 +937,22 @@ void ScriptMgr::OnGameObjectDamaged(GameObject* go, Player* player) tmpscript->OnDamaged(go, player); } +void ScriptMgr::OnGameObjectLootStateChanged(GameObject* go, uint32 state, Unit* unit) +{ + ASSERT(go); + + GET_SCRIPT(GameObjectScript, go->GetScriptId(), tmpscript); + tmpscript->OnLootStateChanged(go, state, unit); +} + +void ScriptMgr::OnGameObjectStateChanged(GameObject* go, uint32 state) +{ + ASSERT(go); + + GET_SCRIPT(GameObjectScript, go->GetScriptId(), tmpscript); + tmpscript->OnGameObjectStateChanged(go, state); +} + void ScriptMgr::OnGameObjectUpdate(GameObject* go, uint32 diff) { ASSERT(go); @@ -954,6 +970,14 @@ bool ScriptMgr::OnDummyEffect(Unit* caster, uint32 spellId, SpellEffIndex effInd return tmpscript->OnDummyEffect(caster, spellId, effIndex, target); } +GameObjectAI* ScriptMgr::GetGameObjectAI(GameObject* go) +{ + ASSERT(go); + + GET_SCRIPT_RET(GameObjectScript, go->GetScriptId(), tmpscript, NULL); + return tmpscript->GetAI(go); +} + bool ScriptMgr::OnAreaTrigger(Player* player, AreaTriggerEntry const* trigger) { ASSERT(player); @@ -1295,6 +1319,11 @@ void ScriptMgr::OnPlayerBindToInstance(Player* player, Difficulty difficulty, ui FOREACH_SCRIPT(PlayerScript)->OnBindToInstance(player, difficulty, mapid, permanent); } +void ScriptMgr::OnPlayerUpdateZone(Player* player, uint32 newZone, uint32 newArea) +{ + FOREACH_SCRIPT(PlayerScript)->OnUpdateZone(player, newZone, newArea); +} + // Guild void ScriptMgr::OnGuildAddMember(Guild* guild, Player* player, uint8& plRank) { @@ -1410,7 +1439,7 @@ FormulaScript::FormulaScript(const char* name) WorldMapScript::WorldMapScript(const char* name, uint32 mapId) : ScriptObject(name), MapScript<Map>(mapId) { - if (GetEntry() && !GetEntry()->IsContinent()) + if (GetEntry() && !GetEntry()->IsWorldMap()) sLog->outError("WorldMapScript for map %u is invalid.", mapId); ScriptRegistry<WorldMapScript>::AddScript(this); diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 048a7581215..b3d445af0c6 100755 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -39,6 +39,7 @@ class Creature; class CreatureAI; class DynamicObject; class GameObject; +class GameObjectAI; class Guild; class GridMap; class Group; @@ -471,6 +472,15 @@ class GameObjectScript : public ScriptObject, public UpdatableScript<GameObject> // Called when the game object is damaged (destructible buildings only). virtual void OnDamaged(GameObject* /*go*/, Player* /*player*/) { } + + // Called when the game object loot state is changed. + virtual void OnLootStateChanged(GameObject* /*go*/, uint32 /*state*/, Unit* /*unit*/) { } + + // Called when the game object state is changed. + virtual void OnGameObjectStateChanged(GameObject* /*go*/, uint32 /*state*/) { } + + // Called when a GameObjectAI object is needed for the gameobject. + virtual GameObjectAI* GetAI(GameObject* /*go*/) const { return NULL; } }; class AreaTriggerScript : public ScriptObject @@ -724,6 +734,9 @@ class PlayerScript : public ScriptObject // Called when a player is bound to an instance virtual void OnBindToInstance(Player* /*player*/, Difficulty /*difficulty*/, uint32 /*mapId*/, bool /*permanent*/) { } + + // Called when a player switches to a new zone + virtual void OnUpdateZone(Player* /*player*/, uint32 /*newZone*/, uint32 /*newArea*/) { } }; class GuildScript : public ScriptObject @@ -907,7 +920,10 @@ class ScriptMgr uint32 GetDialogStatus(Player* player, GameObject* go); void OnGameObjectDestroyed(GameObject* go, Player* player); void OnGameObjectDamaged(GameObject* go, Player* player); + void OnGameObjectLootStateChanged(GameObject* go, uint32 state, Unit* unit); + void OnGameObjectStateChanged(GameObject* go, uint32 state); void OnGameObjectUpdate(GameObject* go, uint32 diff); + GameObjectAI* GetGameObjectAI(GameObject* go); public: /* AreaTriggerScript */ @@ -993,6 +1009,7 @@ class ScriptMgr void OnPlayerCreate(Player* player); void OnPlayerDelete(uint64 guid); void OnPlayerBindToInstance(Player* player, Difficulty difficulty, uint32 mapid, bool permanent); + void OnPlayerUpdateZone(Player* player, uint32 newZone, uint32 newArea); public: /* GuildScript */ diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp index 56d3109a6a0..c38d559372f 100755 --- a/src/server/game/Scripting/ScriptSystem.cpp +++ b/src/server/game/Scripting/ScriptSystem.cpp @@ -30,7 +30,8 @@ void SystemMgr::LoadScriptTexts() sLog->outString("TSCR: Loading Script Texts additional data..."); uint32 oldMSTime = getMSTime(); - + + // 0 1 2 3 QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM script_texts"); if (!result) @@ -49,9 +50,9 @@ void SystemMgr::LoadScriptTexts() int32 iId = pFields[0].GetInt32(); temp.uiSoundId = pFields[1].GetUInt32(); - temp.uiType = pFields[2].GetUInt32(); - temp.uiLanguage = pFields[3].GetUInt32(); - temp.uiEmote = pFields[4].GetUInt32(); + temp.uiType = pFields[2].GetUInt8(); + temp.uiLanguage = pFields[3].GetUInt8(); + temp.uiEmote = pFields[4].GetUInt16(); if (iId >= 0) { @@ -67,7 +68,7 @@ void SystemMgr::LoadScriptTexts() if (temp.uiSoundId) { - if (!GetSoundEntriesStore()->LookupEntry(temp.uiSoundId)) + if (!sSoundEntriesStore.LookupEntry(temp.uiSoundId)) sLog->outErrorDb("TSCR: Entry %i in table `script_texts` has soundId %u but sound does not exist.", iId, temp.uiSoundId); } @@ -79,7 +80,8 @@ void SystemMgr::LoadScriptTexts() m_mTextDataMap[iId] = temp; ++uiCount; - } while (result->NextRow()); + } + while (result->NextRow()); sLog->outString(">> Loaded %u additional Script Texts data in %u ms", uiCount, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -108,11 +110,11 @@ void SystemMgr::LoadScriptTextsCustom() Field* pFields = result->Fetch(); StringTextData temp; - int32 iId = pFields[0].GetInt32(); + int32 iId = pFields[0].GetInt32(); temp.uiSoundId = pFields[1].GetUInt32(); - temp.uiType = pFields[2].GetUInt32(); - temp.uiLanguage = pFields[3].GetUInt32(); - temp.uiEmote = pFields[4].GetUInt32(); + temp.uiType = pFields[2].GetUInt8(); + temp.uiLanguage = pFields[3].GetUInt8(); + temp.uiEmote = pFields[4].GetUInt16(); if (iId >= 0) { @@ -128,7 +130,7 @@ void SystemMgr::LoadScriptTextsCustom() if (temp.uiSoundId) { - if (!GetSoundEntriesStore()->LookupEntry(temp.uiSoundId)) + if (!sSoundEntriesStore.LookupEntry(temp.uiSoundId)) sLog->outErrorDb("TSCR: Entry %i in table `custom_texts` has soundId %u but sound does not exist.", iId, temp.uiSoundId); } @@ -140,7 +142,8 @@ void SystemMgr::LoadScriptTextsCustom() m_mTextDataMap[iId] = temp; ++uiCount; - } while (result->NextRow()); + } + while (result->NextRow()); sLog->outString(">> Loaded %u additional Custom Texts data.", uiCount); sLog->outString(); @@ -162,6 +165,7 @@ void SystemMgr::LoadScriptWaypoints() sLog->outString("TSCR: Loading Script Waypoints for " UI64FMTD " creature(s)...", uiCreatureCount); + // 0 1 2 3 4 5 result = WorldDatabase.Query("SELECT entry, pointid, location_x, location_y, location_z, waittime FROM script_waypoint ORDER BY pointid"); if (!result) @@ -199,7 +203,8 @@ void SystemMgr::LoadScriptWaypoints() m_mPointMoveMap[uiEntry].push_back(temp); ++count; - } while (result->NextRow()); + } + while (result->NextRow()); sLog->outString(">> Loaded %u Script Waypoint nodes in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); diff --git a/src/server/game/Scripting/ScriptSystem.h b/src/server/game/Scripting/ScriptSystem.h index daa7fe0d596..cf6332b22f2 100644 --- a/src/server/game/Scripting/ScriptSystem.h +++ b/src/server/game/Scripting/ScriptSystem.h @@ -4,6 +4,7 @@ #ifndef SC_SYSTEM_H #define SC_SYSTEM_H + #include <ace/Singleton.h> #define TEXT_SOURCE_RANGE -1000000 //the amount of entries each text source has available diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp index 8e53d6230c4..a3fd1f523d9 100644 --- a/src/server/game/Server/Protocol/Opcodes.cpp +++ b/src/server/game/Server/Protocol/Opcodes.cpp @@ -1183,7 +1183,7 @@ void InitOpcodes() //DEFINE_OPCODE_HANDLER(CMSG_CALENDAR_EVENT_INVITE_NOTES, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); //DEFINE_OPCODE_HANDLER(SMSG_CALENDAR_EVENT_INVITE_NOTES, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide ); //DEFINE_OPCODE_HANDLER(SMSG_CALENDAR_EVENT_INVITE_NOTES_ALERT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide ); - //DEFINE_OPCODE_HANDLER(CMSG_UPDATE_MISSILE_TRAJECTORY, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); + //DEFINE_OPCODE_HANDLER(CMSG_UPDATE_MISSILE_TRAJECTORY, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleUpdateMissileTrajectory ); DEFINE_OPCODE_HANDLER(SMSG_UPDATE_ACCOUNT_DATA_COMPLETE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide ); DEFINE_OPCODE_HANDLER(SMSG_TRIGGER_MOVIE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide ); //DEFINE_OPCODE_HANDLER(CMSG_COMPLETE_MOVIE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); diff --git a/src/server/game/Server/Protocol/Opcodes.h b/src/server/game/Server/Protocol/Opcodes.h index 65fa2a5a950..66fd54cd960 100755 --- a/src/server/game/Server/Protocol/Opcodes.h +++ b/src/server/game/Server/Protocol/Opcodes.h @@ -454,7 +454,8 @@ enum Opcodes CMSG_UNLEARN_SKILL = 0xAC3, CMSG_UNREGISTER_ALL_ADDON_PREFIXES = 0x00, CMSG_UPDATE_ACCOUNT_DATA = 0x4AFE, - CMSG_UPDATE_PROJECTILE_POSITION = 0xEDB, + CMSG_UPDATE_MISSILE_TRAJECTORY = 0x9525, + CMSG_UPDATE_PROJECTILE_POSITION = 0x00, // sub_677360 CMSG_USE_ITEM = 0xD8EA, CMSG_VIOLENCE_LEVEL = 0x00, CMSG_VOICE_SESSION_ENABLE = 0x00, diff --git a/src/server/game/Server/Protocol/WorldLog.cpp b/src/server/game/Server/Protocol/WorldLog.cpp index 5b1a3af996f..38b13dff095 100755 --- a/src/server/game/Server/Protocol/WorldLog.cpp +++ b/src/server/game/Server/Protocol/WorldLog.cpp @@ -34,6 +34,7 @@ WorldLog::~WorldLog() { if (i_file != NULL) fclose(i_file); + i_file = NULL; } diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index e93c0eb8102..a9e4ffbf362 100755 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -48,7 +48,7 @@ bool MapSessionFilter::Process(WorldPacket* packet) { Opcodes opcode = DropHighBytes(packet->GetOpcode()); - const OpcodeHandler* opHandle = opcodeTable[opcode]; + OpcodeHandler const* opHandle = opcodeTable[opcode]; //let's check if our opcode can be really processed in Map::Update() if (opHandle->packetProcessing == PROCESS_INPLACE) @@ -71,7 +71,7 @@ bool MapSessionFilter::Process(WorldPacket* packet) bool WorldSessionFilter::Process(WorldPacket* packet) { Opcodes opcode = DropHighBytes(packet->GetOpcode()); - const OpcodeHandler* opHandle = opcodeTable[opcode]; + OpcodeHandler const* opHandle = opcodeTable[opcode]; //check if packet handler is supposed to be safe if (opHandle->packetProcessing == PROCESS_INPLACE) return true; @@ -123,8 +123,8 @@ WorldSession::~WorldSession() /// - If have unclosed socket, close it if (m_Socket) { - m_Socket->CloseSocket (); - m_Socket->RemoveReference (); + m_Socket->CloseSocket(); + m_Socket->RemoveReference(); m_Socket = NULL; } @@ -139,7 +139,7 @@ WorldSession::~WorldSession() LoginDatabase.PExecute("UPDATE account SET online = 0 WHERE id = %u;", GetAccountId()); // One-time query } -void WorldSession::SizeError(WorldPacket const &packet, uint32 size) const +void WorldSession::SizeError(WorldPacket const& packet, uint32 size) const { sLog->outError("Client (account %u) send packet %s (%u) with size " SIZEFMTD " but expected %u (attempt to crash server?), skipped", GetAccountId(), LookupOpcodeName(packet.GetOpcode()), packet.GetOpcode(), packet.size(), size); @@ -205,8 +205,8 @@ void WorldSession::SendPacket(WorldPacket const* packet) } #endif // !TRINITY_DEBUG - if (m_Socket->SendPacket (*packet) == -1) - m_Socket->CloseSocket (); + if (m_Socket->SendPacket(*packet) == -1) + m_Socket->CloseSocket(); } /// Add an incoming packet to the queue @@ -292,7 +292,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) // lag can cause STATUS_LOGGEDIN opcodes to arrive after the player started a transfer break; case STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT: - if (!_player && !m_playerRecentlyLogout) + if (!_player && !m_playerRecentlyLogout && !m_playerLogout) // There's a short delay between _player = null and m_playerRecentlyLogout = true during logout LogUnexpectedOpcode(packet, "STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT", "the player has not logged in yet and not recently logout"); else @@ -325,9 +325,9 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) break; } - // single from authed time opcodes send in to after logout time - // and before other STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT opcodes. - if (packet->GetOpcode() != CMSG_SET_ACTIVE_VOICE_CHANNEL) + // some auth opcodes can be recieved before STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT opcodes + // however when we recieve CMSG_CHAR_ENUM we are surely no longer during the logout process. + if (packet->GetOpcode() == CMSG_CHAR_ENUM) m_playerRecentlyLogout = false; sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet)); @@ -405,7 +405,7 @@ void WorldSession::LogoutPlayer(bool Save) if (_player) { - if (uint64 lguid = GetPlayer()->GetLootGUID()) + if (uint64 lguid = _player->GetLootGUID()) DoLootRelease(lguid); ///- If the player just died before logging out, make him appear as a ghost @@ -519,44 +519,41 @@ void WorldSession::LogoutPlayer(bool Save) if (_player->GetGroup() && !_player->GetGroup()->isRaidGroup() && m_Socket) _player->RemoveFromGroup(); - ///- Send update to group and reset stored max enchanting level + //! Send update to group and reset stored max enchanting level if (_player->GetGroup()) { _player->GetGroup()->SendUpdate(); _player->GetGroup()->ResetMaxEnchantingLevel(); } - ///- Broadcast a logout message to the player's friends + //! Broadcast a logout message to the player's friends sSocialMgr->SendFriendStatus(_player, FRIEND_OFFLINE, _player->GetGUIDLow(), true); - sSocialMgr->RemovePlayerSocial (_player->GetGUIDLow ()); + sSocialMgr->RemovePlayerSocial(_player->GetGUIDLow()); - // Call script hook before deletion - sScriptMgr->OnPlayerLogout(GetPlayer()); + //! Call script hook before deletion + sScriptMgr->OnPlayerLogout(_player); - ///- Remove the player from the world + //! Remove the player from the world // the player may not be in the world when logging out // e.g if he got disconnected during a transfer to another map // calls to GetMap in this case may cause crashes _player->CleanupsBeforeDelete(); - sLog->outChar("Account: %d (IP: %s) Logout Character:[%s] (GUID: %u)", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName(), _player->GetGUIDLow()); + sLog->outChar("Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName(), _player->GetGUIDLow(), _player->getLevel()); if (Map* _map = _player->FindMap()) _map->RemovePlayerFromMap(_player, true); - SetPlayer(NULL); // deleted in Remove call - ///- Send the 'logout complete' packet to the client + SetPlayer(NULL); //! Pointer already deleted during RemovePlayerFromMap + + //! Send the 'logout complete' packet to the client + //! Client will respond by sending 3x CMSG_CANCEL_TRADE, which we currently dont handle WorldPacket data(SMSG_LOGOUT_COMPLETE, 0); SendPacket(&data); + sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION: Sent SMSG_LOGOUT_COMPLETE Message"); - ///- Since each account can only have one online character at any given time, ensure all characters for active account are marked as offline - //No SQL injection as AccountId is uint32 - + //! Since each account can only have one online character at any given time, ensure all characters for active account are marked as offline PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ACCOUNT_ONLINE); - stmt->setUInt32(0, GetAccountId()); - CharacterDatabase.Execute(stmt); - - sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION: Sent SMSG_LOGOUT_COMPLETE Message"); } m_playerLogout = false; @@ -773,6 +770,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data) { if (data.rpos() + 4 > data.size()) return; + uint32 size; data >> size; @@ -792,7 +790,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data) ByteBuffer addonInfo; addonInfo.resize(size); - if (uncompress(const_cast<uint8 *>(addonInfo.contents()), &uSize, const_cast<uint8 *>(data.contents() + pos), data.size() - pos) == Z_OK) + if (uncompress(const_cast<uint8*>(addonInfo.contents()), &uSize, const_cast<uint8*>(data.contents() + pos), data.size() - pos) == Z_OK) { uint32 addonsCount; addonInfo >> addonsCount; // addons count diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 21cc3991b9f..83677aada88 100755 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -31,24 +31,25 @@ #include "WorldPacket.h" #include "Cryptography/BigNumber.h" -struct ItemTemplate; -struct AuctionEntry; -struct DeclinedName; -struct MovementInfo; - +class CalendarEvent; +class CalendarInvite; class Creature; +class GameObject; +class InstanceSave; class Item; +class LoginQueryHolder; class Object; class Player; -class Unit; -class GameObject; class Quest; -class WorldPacket; -class WorldSocket; -class LoginQueryHolder; class SpellCastTargets; +class Unit; class Warden; +class WorldPacket; +class WorldSocket; struct AreaTableEntry; +struct AuctionEntry; +struct DeclinedName; +struct ItemTemplate; struct LfgJoinResultData; struct LfgLockStatus; struct LfgPlayerBoot; @@ -56,6 +57,7 @@ struct LfgProposal; struct LfgReward; struct LfgRoleCheck; struct LfgUpdateData; +struct MovementInfo; enum AccountDataType { @@ -229,6 +231,7 @@ class WorldSession bool PlayerLoading() const { return m_playerLoading; } bool PlayerLogout() const { return m_playerLogout; } bool PlayerLogoutWithSave() const { return m_playerLogout && m_playerSave; } + bool PlayerRecentlyLoggedOut() const { return m_playerRecentlyLogout; } void SizeError(WorldPacket const& packet, uint32 size) const; @@ -302,7 +305,7 @@ class WorldSession void SendAttackStop(Unit const* enemy); - void SendBattlegGroundList(uint64 guid, BattlegroundTypeId bgTypeId); + void SendBattleGroundList(uint64 guid, BattlegroundTypeId bgTypeId); void SendTradeStatus(TradeStatus status); void SendUpdateTrade(bool trader_data = true); @@ -403,7 +406,7 @@ class WorldSession public: // opcodes handlers void Handle_NULL(WorldPacket& recvPacket); // not used - void Handle_EarlyProccess(WorldPacket& recvPacket);// just mark packets processed in WorldSocket::OnRead + void Handle_EarlyProccess(WorldPacket& recvPacket); // just mark packets processed in WorldSocket::OnRead void Handle_ServerSide(WorldPacket& recvPacket); // sever side only, can't be accepted from client void Handle_Deprecated(WorldPacket& recvPacket); // never used anymore by client @@ -799,6 +802,7 @@ class WorldSession void HandleResetInstancesOpcode(WorldPacket& recv_data); void HandleHearthAndResurrect(WorldPacket& recv_data); void HandleInstanceLockResponse(WorldPacket& recvPacket); + void HandleUpdateMissileTrajectory(WorldPacket& recvPacket); // Looking for Dungeon/Raid void HandleLfgSetCommentOpcode(WorldPacket& recv_data); @@ -879,21 +883,36 @@ class WorldSession void HandleAcceptGrantLevel(WorldPacket& recv_data); // Calendar - void HandleCalendarGetCalendar(WorldPacket& recv_data); - void HandleCalendarGetEvent(WorldPacket& recv_data); - void HandleCalendarGuildFilter(WorldPacket& recv_data); - void HandleCalendarArenaTeam(WorldPacket& recv_data); - void HandleCalendarAddEvent(WorldPacket& recv_data); - void HandleCalendarUpdateEvent(WorldPacket& recv_data); - void HandleCalendarRemoveEvent(WorldPacket& recv_data); - void HandleCalendarCopyEvent(WorldPacket& recv_data); - void HandleCalendarEventInvite(WorldPacket& recv_data); - void HandleCalendarEventRsvp(WorldPacket& recv_data); - void HandleCalendarEventRemoveInvite(WorldPacket& recv_data); - void HandleCalendarEventStatus(WorldPacket& recv_data); - void HandleCalendarEventModeratorStatus(WorldPacket& recv_data); - void HandleCalendarComplain(WorldPacket& recv_data); - void HandleCalendarGetNumPending(WorldPacket& recv_data); + void HandleCalendarGetCalendar(WorldPacket& recvData); + void HandleCalendarGetEvent(WorldPacket& recvData); + void HandleCalendarGuildFilter(WorldPacket& recvData); + void HandleCalendarArenaTeam(WorldPacket& recvData); + void HandleCalendarAddEvent(WorldPacket& recvData); + void HandleCalendarUpdateEvent(WorldPacket& recvData); + void HandleCalendarRemoveEvent(WorldPacket& recvData); + void HandleCalendarCopyEvent(WorldPacket& recvData); + void HandleCalendarEventInvite(WorldPacket& recvData); + void HandleCalendarEventRsvp(WorldPacket& recvData); + void HandleCalendarEventRemoveInvite(WorldPacket& recvData); + void HandleCalendarEventStatus(WorldPacket& recvData); + void HandleCalendarEventModeratorStatus(WorldPacket& recvData); + void HandleCalendarComplain(WorldPacket& recvData); + void HandleCalendarGetNumPending(WorldPacket& recvData); + void HandleCalendarEventSignup(WorldPacket& recvData); + + void SendCalendarEvent(CalendarEvent const& calendarEvent, CalendarSendEventType sendEventType); + void SendCalendarEventInvite(CalendarInvite const& invite, bool pending); + void SendCalendarEventInviteAlert(CalendarEvent const& calendarEvent, CalendarInvite const& calendarInvite); + void SendCalendarEventInviteRemove(CalendarInvite const& invite, uint32 flags); + void SendCalendarEventInviteRemoveAlert(CalendarEvent const& calendarEvent, CalendarInviteStatus status); + void SendCalendarEventRemovedAlert(CalendarEvent const& calendarEvent); + void SendCalendarEventUpdateAlert(CalendarEvent const& calendarEvent, CalendarSendEventType sendEventType); + void SendCalendarEventStatus(CalendarEvent const& calendarEvent, CalendarInvite const& invite); + void SendCalendarEventModeratorStatusAlert(CalendarInvite const& invite); + void SendCalendarClearPendingAction(); + void SendCalendarRaidLockout(InstanceSave const* save, bool add); + void SendCalendarRaidLockoutUpdated(InstanceSave const* save); + void SendCalendarCommandResult(CalendarError err, char const* param = NULL); void HandleSpellClick(WorldPacket& recv_data); void HandleMirrorImageDataRequest(WorldPacket& recv_data); diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index 761d64b200c..3e4a38ba6b1 100755 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.cpp @@ -152,7 +152,7 @@ const std::string& WorldSocket::GetRemoteAddress (void) const return m_Address; } -int WorldSocket::SendPacket (const WorldPacket& pct) +int WorldSocket::SendPacket(const WorldPacket& pct) { ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, -1); @@ -254,7 +254,7 @@ int WorldSocket::open (void *a) if (peer().get_remote_addr(remote_addr) == -1) { - sLog->outError ("WorldSocket::open: peer().get_remote_addr errno = %s", ACE_OS::strerror (errno)); + sLog->outError("WorldSocket::open: peer().get_remote_addr errno = %s", ACE_OS::strerror (errno)); return -1; } @@ -271,7 +271,7 @@ int WorldSocket::open (void *a) // Register with ACE Reactor if (reactor()->register_handler(this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK) == -1) { - sLog->outError ("WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno)); + sLog->outError("WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno)); return -1; } @@ -490,7 +490,7 @@ int WorldSocket::handle_input_header (void) if ((header.size < 4) || (header.size > 10240)) { Player* _player = m_Session ? m_Session->GetPlayer() : NULL; - sLog->outError ("WorldSocket::handle_input_header(): client (account: %u, char [GUID: %u, name: %s]) sent malformed packet (size: %d, cmd: %d)", + sLog->outError("WorldSocket::handle_input_header(): client (account: %u, char [GUID: %u, name: %s]) sent malformed packet (size: %d, cmd: %d)", m_Session ? m_Session->GetAccountId() : 0, _player ? _player->GetGUIDLow() : 0, _player ? _player->GetName() : "<none>", @@ -596,7 +596,7 @@ int WorldSocket::handle_input_missing_data (void) // hope this is not hack, as proper m_RecvWPct is asserted around if (!m_RecvWPct) { - sLog->outError ("Forcing close on input m_RecvWPct = NULL"); + sLog->outError("Forcing close on input m_RecvWPct = NULL"); errno = EINVAL; return -1; } @@ -642,7 +642,7 @@ int WorldSocket::cancel_wakeup_output (GuardType& g) (this, ACE_Event_Handler::WRITE_MASK) == -1) { // would be good to store errno from reactor with errno guard - sLog->outError ("WorldSocket::cancel_wakeup_output"); + sLog->outError("WorldSocket::cancel_wakeup_output"); return -1; } @@ -661,7 +661,7 @@ int WorldSocket::schedule_wakeup_output (GuardType& g) if (reactor()->schedule_wakeup (this, ACE_Event_Handler::WRITE_MASK) == -1) { - sLog->outError ("WorldSocket::schedule_wakeup_output"); + sLog->outError("WorldSocket::schedule_wakeup_output"); return -1; } @@ -711,7 +711,7 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct) case CMSG_AUTH_SESSION: if (m_Session) { - sLog->outError ("WorldSocket::ProcessIncoming: Player send CMSG_AUTH_SESSION again"); + sLog->outError("WorldSocket::ProcessIncoming: Player send CMSG_AUTH_SESSION again"); return -1; } @@ -760,7 +760,7 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct) } else { - sLog->outError ("WorldSocket::ProcessIncoming: Client not authed opcode = %u", uint32(opcode)); + sLog->outError("WorldSocket::ProcessIncoming: Client not authed opcode = %u", uint32(opcode)); return -1; } } @@ -846,20 +846,18 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) { packet.Initialize(SMSG_AUTH_RESPONSE, 1); packet << uint8(AUTH_REJECT); - SendPacket (packet); + SendPacket(packet); sLog->outError("WorldSocket::HandleAuthSession: World closed, denying client (%s).", GetRemoteAddress().c_str()); return -1; } // Get the account information from the realmd database - std::string safe_account = account; // Duplicate, else will screw the SHA hash verification below - LoginDatabase.EscapeString (safe_account); - // No SQL injection, username escaped. + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_INFO_BY_NAME); - QueryResult result = - LoginDatabase.PQuery ("SELECT " - "id, " //0 + stmt->setString(0, account); + + PreparedQueryResult result = LoginDatabase.Query(stmt); "sessionkey, " //1 "last_ip, " //2 "locked, " //3 @@ -880,9 +878,9 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) packet.Initialize (SMSG_AUTH_RESPONSE, 1); packet << uint8 (AUTH_UNKNOWN_ACCOUNT); - SendPacket (packet); + SendPacket(packet); - sLog->outError ("WorldSocket::HandleAuthSession: Sent Auth Response (unknown account)."); + sLog->outError("WorldSocket::HandleAuthSession: Sent Auth Response (unknown account)."); return -1; } @@ -916,7 +914,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) { packet.Initialize (SMSG_AUTH_RESPONSE, 1); packet << uint8 (AUTH_FAILED); - SendPacket (packet); + SendPacket(packet); sLog->outBasic ("WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs)."); return -1; @@ -953,36 +951,36 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) std::string os = fields[10].GetString(); // Checks gmlevel per Realm - result = LoginDatabase.PQuery ("SELECT " - "RealmID, " //0 - "gmlevel " //1 - "FROM account_access " - "WHERE id = '%d'" - " AND (RealmID = '%d'" - " OR RealmID = '-1')", - id, realmID); + stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_GMLEVEL_BY_REALMID); + + stmt->setUInt32(0, id); + stmt->setInt32(1, int32(realmID)); + + result = LoginDatabase.Query(stmt); + if (!result) security = 0; else { fields = result->Fetch(); - security = fields[1].GetInt32(); + security = fields[0].GetUInt8(); } // Re-check account ban (same check as in realmd) - QueryResult banresult = - LoginDatabase.PQuery ("SELECT 1 FROM account_banned WHERE id = %u AND active = 1 " - "UNION " - "SELECT 1 FROM ip_banned WHERE ip = '%s'", - id, GetRemoteAddress().c_str()); + stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BANS); + + stmt->setUInt32(0, id); + stmt->setString(1, GetRemoteAddress()); + + PreparedQueryResult banresult = LoginDatabase.Query(stmt); if (banresult) // if account banned { packet.Initialize (SMSG_AUTH_RESPONSE, 1); packet << uint8 (AUTH_BANNED); - SendPacket (packet); + SendPacket(packet); - sLog->outError ("WorldSocket::HandleAuthSession: Sent Auth Response (Account banned)."); + sLog->outError("WorldSocket::HandleAuthSession: Sent Auth Response (Account banned)."); return -1; } @@ -994,9 +992,9 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) WorldPacket Packet (SMSG_AUTH_RESPONSE, 1); Packet << uint8 (AUTH_UNAVAILABLE); - SendPacket (packet); + SendPacket(packet); - sLog->outDetail ("WorldSocket::HandleAuthSession: User tries to login but his security level is not enough"); + sLog->outDetail("WorldSocket::HandleAuthSession: User tries to login but his security level is not enough"); return -1; } @@ -1018,7 +1016,11 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) address.c_str()); // Check if this user is by any chance a recruiter - result = LoginDatabase.PQuery ("SELECT 1 FROM account WHERE recruiter = %u", id); + stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_RECRUITER); + + stmt->setUInt32(0, id); + + result = LoginDatabase.Query(stmt); bool isRecruiter = false; if (result) @@ -1026,7 +1028,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) // Update the last_ip in the database - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LAST_IP); + stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LAST_IP); stmt->setString(0, address); stmt->setString(1, account); @@ -1109,7 +1111,7 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket) m_Session->SetLatency (latency); else { - sLog->outError ("WorldSocket::HandlePing: peer sent CMSG_PING, " + sLog->outError("WorldSocket::HandlePing: peer sent CMSG_PING, " "but is not authenticated or got recently kicked, " " address = %s", GetRemoteAddress().c_str()); @@ -1119,5 +1121,5 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket) WorldPacket packet (SMSG_PONG, 4); packet << ping; - return SendPacket (packet); + return SendPacket(packet); } diff --git a/src/server/game/Server/WorldSocket.h b/src/server/game/Server/WorldSocket.h index 375808db569..3a256c07095 100755 --- a/src/server/game/Server/WorldSocket.h +++ b/src/server/game/Server/WorldSocket.h @@ -108,7 +108,7 @@ class WorldSocket : public WorldHandler /// Send A packet on the socket, this function is reentrant. /// @param pct packet to send /// @return -1 of failure - int SendPacket (const WorldPacket& pct); + int SendPacket(const WorldPacket& pct); /// Add reference to this object. long AddReference (void); diff --git a/src/server/game/Server/WorldSocketMgr.cpp b/src/server/game/Server/WorldSocketMgr.cpp index 00a8b263847..d357651a5bf 100755 --- a/src/server/game/Server/WorldSocketMgr.cpp +++ b/src/server/game/Server/WorldSocketMgr.cpp @@ -236,7 +236,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address) if (num_threads <= 0) { - sLog->outError ("Network.Threads is wrong in your config file"); + sLog->outError("Network.Threads is wrong in your config file"); return -1; } @@ -253,7 +253,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address) if (m_SockOutUBuff <= 0) { - sLog->outError ("Network.OutUBuff is wrong in your config file"); + sLog->outError("Network.OutUBuff is wrong in your config file"); return -1; } @@ -263,7 +263,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address) if (m_Acceptor->open(listen_addr, m_NetThreads[0].GetReactor(), ACE_NONBLOCK) == -1) { - sLog->outError ("Failed to open acceptor, check if the port is free"); + sLog->outError("Failed to open acceptor, check if the port is free"); return -1; } @@ -327,7 +327,7 @@ WorldSocketMgr::OnSocketOpen (WorldSocket* sock) (void*) & m_SockOutKBuff, sizeof (int)) == -1 && errno != ENOTSUP) { - sLog->outError ("WorldSocketMgr::OnSocketOpen set_option SO_SNDBUF"); + sLog->outError("WorldSocketMgr::OnSocketOpen set_option SO_SNDBUF"); return -1; } } @@ -342,7 +342,7 @@ WorldSocketMgr::OnSocketOpen (WorldSocket* sock) (void*)&ndoption, sizeof (int)) == -1) { - sLog->outError ("WorldSocketMgr::OnSocketOpen: peer().set_option TCP_NODELAY errno = %s", ACE_OS::strerror (errno)); + sLog->outError("WorldSocketMgr::OnSocketOpen: peer().set_option TCP_NODELAY errno = %s", ACE_OS::strerror (errno)); return -1; } } diff --git a/src/server/game/Skills/SkillDiscovery.cpp b/src/server/game/Skills/SkillDiscovery.cpp index 466d3ac83a2..e314fab07be 100755 --- a/src/server/game/Skills/SkillDiscovery.cpp +++ b/src/server/game/Skills/SkillDiscovery.cpp @@ -71,7 +71,7 @@ void LoadSkillDiscoveryTable() uint32 spellId = fields[0].GetUInt32(); int32 reqSkillOrSpell = fields[1].GetInt32(); - uint32 reqSkillValue = fields[2].GetUInt32(); + uint32 reqSkillValue = fields[2].GetUInt16(); float chance = fields[3].GetFloat(); if (chance <= 0) // chance @@ -132,7 +132,8 @@ void LoadSkillDiscoveryTable() } ++count; - } while (result->NextRow()); + } + while (result->NextRow()); if (!ssNonDiscoverableEntries.str().empty()) sLog->outErrorDb("Some items can't be successfully discovered: have in chance field value < 0.000001 in `skill_discovery_template` DB table . List:\n%s", ssNonDiscoverableEntries.str().c_str()); @@ -246,4 +247,3 @@ uint32 GetSkillDiscoverySpell(uint32 skillId, uint32 spellId, Player* player) return 0; } - diff --git a/src/server/game/Skills/SkillDiscovery.h b/src/server/game/Skills/SkillDiscovery.h index 110adb91cf2..ba5542e0189 100755 --- a/src/server/game/Skills/SkillDiscovery.h +++ b/src/server/game/Skills/SkillDiscovery.h @@ -28,4 +28,3 @@ uint32 GetSkillDiscoverySpell(uint32 skillId, uint32 spellId, Player* player); bool HasDiscoveredAllSpells(uint32 spellId, Player* player); uint32 GetExplicitDiscoverySpell(uint32 spellId, Player* player); #endif - diff --git a/src/server/game/Skills/SkillExtraItems.cpp b/src/server/game/Skills/SkillExtraItems.cpp index b5b6b5d7b96..3bb435145f1 100755 --- a/src/server/game/Skills/SkillExtraItems.cpp +++ b/src/server/game/Skills/SkillExtraItems.cpp @@ -55,7 +55,7 @@ void LoadSkillExtraItemTable() SkillExtraItemStore.clear(); // need for reload - // 0 1 2 3 + // 0 1 2 3 QueryResult result = WorldDatabase.Query("SELECT spellId, requiredSpecialization, additionalCreateChance, additionalMaxNum FROM skill_extra_item_template"); if (!result) @@ -138,4 +138,3 @@ bool canCreateExtraItems(Player* player, uint32 spellId, float &additionalChance // enable extra item creation return true; } - diff --git a/src/server/game/Skills/SkillExtraItems.h b/src/server/game/Skills/SkillExtraItems.h index c4e20b9fbef..0cf49021e1c 100755 --- a/src/server/game/Skills/SkillExtraItems.h +++ b/src/server/game/Skills/SkillExtraItems.h @@ -28,4 +28,3 @@ bool canCreateExtraItems(Player* player, uint32 spellId, float &additionalChance // function to load the extra item creation info from DB void LoadSkillExtraItemTable(); #endif - diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 273fcb4f049..200007c3190 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -536,7 +536,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster) if (GetSpellInfo()->SpellFamilyFlags[1] & 0x1 && GetSpellInfo()->SpellFamilyFlags[2] & 0x8) { // +80.68% from sp bonus - DoneActualBenefit += caster->SpellBaseDamageBonus(m_spellInfo->GetSchoolMask()) * 0.8068f; + DoneActualBenefit += caster->SpellBaseDamageBonusDone(m_spellInfo->GetSchoolMask()) * 0.8068f; // Glyph of Ice Barrier: its weird having a SPELLMOD_ALL_EFFECTS here but its blizzards doing :) // Glyph of Ice Barrier is only applied at the spell damage bonus because it was already applied to the base value in CalculateSpellDamage DoneActualBenefit = caster->ApplyEffectModifiers(GetSpellInfo(), m_effIndex, DoneActualBenefit); @@ -545,13 +545,13 @@ int32 AuraEffect::CalculateAmount(Unit* caster) else if (GetSpellInfo()->SpellFamilyFlags[0] & 0x8 && GetSpellInfo()->SpellFamilyFlags[2] & 0x8) { // +80.68% from sp bonus - DoneActualBenefit += caster->SpellBaseDamageBonus(m_spellInfo->GetSchoolMask()) * 0.8068f; + DoneActualBenefit += caster->SpellBaseDamageBonusDone(m_spellInfo->GetSchoolMask()) * 0.8068f; } // Frost Ward else if (GetSpellInfo()->SpellFamilyFlags[0] & 0x100 && GetSpellInfo()->SpellFamilyFlags[2] & 0x8) { // +80.68% from sp bonus - DoneActualBenefit += caster->SpellBaseDamageBonus(m_spellInfo->GetSchoolMask()) * 0.8068f; + DoneActualBenefit += caster->SpellBaseDamageBonusDone(m_spellInfo->GetSchoolMask()) * 0.8068f; } break; case SPELLFAMILY_WARLOCK: @@ -559,7 +559,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster) if (m_spellInfo->SpellFamilyFlags[2] & 0x40) { // +80.68% from sp bonus - DoneActualBenefit += caster->SpellBaseDamageBonus(m_spellInfo->GetSchoolMask()) * 0.8068f; + DoneActualBenefit += caster->SpellBaseDamageBonusDone(m_spellInfo->GetSchoolMask()) * 0.8068f; } break; case SPELLFAMILY_PRIEST: @@ -573,7 +573,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster) if (AuraEffect const* pAurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 2899, 1)) bonus += CalculatePctN(1.0f, pAurEff->GetAmount()); - DoneActualBenefit += caster->SpellBaseHealingBonus(m_spellInfo->GetSchoolMask()) * bonus; + DoneActualBenefit += caster->SpellBaseHealingBonusDone(m_spellInfo->GetSchoolMask()) * bonus; // Improved PW: Shield: its weird having a SPELLMOD_ALL_EFFECTS here but its blizzards doing :) // Improved PW: Shield is only applied at the spell healing bonus because it was already applied to the base value in CalculateSpellDamage DoneActualBenefit = caster->ApplyEffectModifiers(GetSpellInfo(), m_effIndex, DoneActualBenefit); @@ -601,7 +601,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster) //+75.00% from sp bonus float bonus = 0.75f; - DoneActualBenefit += caster->SpellBaseHealingBonus(m_spellInfo->GetSchoolMask()) * bonus; + DoneActualBenefit += caster->SpellBaseHealingBonusDone(m_spellInfo->GetSchoolMask()) * bonus; // Divine Guardian is only applied at the spell healing bonus because it was already applied to the base value in CalculateSpellDamage DoneActualBenefit = caster->ApplyEffectModifiers(GetSpellInfo(), m_effIndex, DoneActualBenefit); DoneActualBenefit *= caster->CalculateLevelPenalty(GetSpellInfo()); @@ -630,7 +630,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster) if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_MAGE && GetSpellInfo()->SpellFamilyFlags[0] & 0x8000 && m_spellInfo->SpellFamilyFlags[2] & 0x8) { // +80.53% from +spd bonus - DoneActualBenefit += caster->SpellBaseDamageBonus(m_spellInfo->GetSchoolMask()) * 0.8053f;; + DoneActualBenefit += caster->SpellBaseDamageBonusDone(m_spellInfo->GetSchoolMask()) * 0.8053f; } break; case SPELL_AURA_DUMMY: @@ -638,7 +638,10 @@ int32 AuraEffect::CalculateAmount(Unit* caster) break; // Earth Shield if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_SHAMAN && m_spellInfo->SpellFamilyFlags[1] & 0x400) - amount = caster->SpellHealingBonus(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, SPELL_DIRECT_DAMAGE); + { + amount = caster->SpellHealingBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, SPELL_DIRECT_DAMAGE); + amount = GetBase()->GetUnitOwner()->SpellHealingBonusTaken(caster, GetSpellInfo(), amount, SPELL_DIRECT_DAMAGE); + } break; case SPELL_AURA_PERIODIC_DAMAGE: if (!caster) @@ -703,19 +706,23 @@ int32 AuraEffect::CalculateAmount(Unit* caster) } break; case SPELL_AURA_PERIODIC_ENERGIZE: - if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_GENERIC) + switch (m_spellInfo->Id) { - // Replenishment (0.25% from max) - // Infinite Replenishment - if (m_spellInfo->SpellIconID == 3184 && m_spellInfo->SpellVisual[0] == 12495) - amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 25 / 10000; - } - // Innervate - else if (m_spellInfo->Id == 29166) + case 57669: // Replenishment (0.2% from max) + amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.002f; + break; + case 61782: // Infinite Replenishment + amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.0025f; + break; + case 29166: // Innervate ApplyPctF(amount, float(GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)) / GetTotalTicks()); - // Owlkin Frenzy - else if (m_spellInfo->Id == 48391) + break; + case 48391: // Owlkin Frenzy ApplyPctU(amount, GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)); + break; + default: + break; + } break; case SPELL_AURA_PERIODIC_HEAL: if (!caster) @@ -983,6 +990,7 @@ void AuraEffect::ChangeAmount(int32 newAmount, bool mark, bool onStackOrReapply) handleMask |= AURA_EFFECT_HANDLE_CHANGE_AMOUNT; if (onStackOrReapply) handleMask |= AURA_EFFECT_HANDLE_REAPPLY; + if (!handleMask) return; @@ -1281,12 +1289,11 @@ bool AuraEffect::IsPeriodicTickCrit(Unit* target, Unit const* caster) const if ((*itr)->IsAffectingSpell(m_spellInfo) && caster->isSpellCrit(target, m_spellInfo, m_spellInfo->GetSchoolMask())) return true; } + // Rupture - since 3.3.3 can crit - if (target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x100000, 0x0, 0x0, caster->GetGUID())) - { - if (caster->isSpellCrit(target, m_spellInfo, m_spellInfo->GetSchoolMask())) - return true; - } + if (m_spellInfo->SpellIconID == 500 && m_spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE) + return caster->isSpellCrit(target, m_spellInfo, m_spellInfo->GetSchoolMask()); + return false; } @@ -1512,13 +1519,36 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const const PlayerSpellMap& sp_list = target->ToPlayer()->GetSpellMap(); for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr) { - if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled) continue; - if (itr->first == spellId || itr->first == spellId2) continue; + if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled) + continue; + + if (itr->first == spellId || itr->first == spellId2) + continue; + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); - if (!spellInfo || !(spellInfo->Attributes & (SPELL_ATTR0_PASSIVE | SPELL_ATTR0_HIDDEN_CLIENTSIDE))) continue; + if (!spellInfo || !(spellInfo->Attributes & (SPELL_ATTR0_PASSIVE | SPELL_ATTR0_HIDDEN_CLIENTSIDE))) + continue; + if (spellInfo->Stances & (1<<(GetMiscValue()-1))) target->CastSpell(target, itr->first, true, NULL, this); } + + // Also do it for Glyphs + for (uint32 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i) + { + if (uint32 glyphId = target->ToPlayer()->GetGlyph(i)) + { + if (GlyphPropertiesEntry const* glyph = sGlyphPropertiesStore.LookupEntry(glyphId)) + { + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(glyph->SpellId); + if (!spellInfo || !(spellInfo->Attributes & (SPELL_ATTR0_PASSIVE | SPELL_ATTR0_HIDDEN_CLIENTSIDE))) + continue; + if (spellInfo->Stances & (1<<(GetMiscValue()-1))) + target->CastSpell(target, glyph->SpellId, true, NULL, this); + } + } + } + // Leader of the Pack if (target->ToPlayer()->HasSpell(17007)) { @@ -1628,10 +1658,25 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const } } + const Unit::AuraEffectList& shapeshifts = target->GetAuraEffectsByType(SPELL_AURA_MOD_SHAPESHIFT); + AuraEffect* newAura = NULL; + // Iterate through all the shapeshift auras that the target has, if there is another aura with SPELL_AURA_MOD_SHAPESHIFT, then this aura is being removed due to that one being applied + for (Unit::AuraEffectList::const_iterator itr = shapeshifts.begin(); itr != shapeshifts.end(); ++itr) + { + if ((*itr) != this) + { + newAura = *itr; + break; + } + } Unit::AuraApplicationMap& tAuras = target->GetAppliedAuras(); for (Unit::AuraApplicationMap::iterator itr = tAuras.begin(); itr != tAuras.end();) { - if (itr->second->GetBase()->IsRemovedOnShapeLost(target)) + // Use the new aura to see on what stance the target will be + uint32 newStance = (1<<((newAura ? newAura->GetMiscValue() : 0)-1)); + + // If the stances are not compatible with the spell, remove it + if (itr->second->GetBase()->IsRemovedOnShapeLost(target) && !(itr->second->GetBase()->GetSpellInfo()->Stances & newStance)) target->RemoveAura(itr); else ++itr; @@ -2119,7 +2164,9 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo PlayerSpellMap const& sp_list = target->ToPlayer()->GetSpellMap(); for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr) { - if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled) continue; + if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled) + continue; + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139) Rage_val += target->CalculateSpellDamage(target, spellInfo, 0) * 10; @@ -2428,7 +2475,7 @@ void AuraEffect::HandleAuraCloneCaster(AuraApplication const* aurApp, uint8 mode // What must be cloned? at least display and scale target->SetDisplayId(caster->GetDisplayId()); - //target->SetFloatValue(OBJECT_FIELD_SCALE_X, caster->GetFloatValue(OBJECT_FIELD_SCALE_X)); // we need retail info about how scaling is handled (aura maybe?) + //target->SetObjectScale(caster->GetFloatValue(OBJECT_FIELD_SCALE_X)); // we need retail info about how scaling is handled (aura maybe?) target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_MIRROR_IMAGE); } else @@ -2904,14 +2951,23 @@ void AuraEffect::HandleAuraAllowFlight(AuraApplication const* aurApp, uint8 mode return; } - if (target->GetTypeId() == TYPEID_UNIT) - target->SetFlying(apply); - - if (Player* player = target->m_movedPlayer) + //! Not entirely sure if this should be sent for creatures as well, but I don't think so. + target->SetCanFly(apply); + if (!apply) { - // allow flying - player->SendSetFlyPacket(apply); + target->RemoveUnitMovementFlag(MOVEMENTFLAG_MASK_MOVING_FLY); + target->GetMotionMaster()->MoveFall(); } + + Player* player = target->ToPlayer(); + if (!player) + player = target->m_movedPlayer; + + if (player) + player->SendMovementCanFlyChange(); + + //! We still need to initiate a server-side MoveFall here, + //! which requires MSG_MOVE_FALL_LAND on landing. } void AuraEffect::HandleAuraWaterWalk(AuraApplication const* aurApp, uint8 mode, bool apply) const @@ -2928,14 +2984,12 @@ void AuraEffect::HandleAuraWaterWalk(AuraApplication const* aurApp, uint8 mode, return; } - WorldPacket data; if (apply) - data.Initialize(SMSG_MOVE_SPLINE_SET_WATER_WALK, 8+4); + target->AddUnitMovementFlag(MOVEMENTFLAG_WATERWALKING); else - data.Initialize(SMSG_MOVE_SPLINE_SET_LAND_WALK, 8+4); - data.append(target->GetPackGUID()); - data << uint32(0); - target->SendMessageToSet(&data, true); + target->RemoveUnitMovementFlag(MOVEMENTFLAG_WATERWALKING); + + target->SendMovementWaterWalking(); } void AuraEffect::HandleAuraFeatherFall(AuraApplication const* aurApp, uint8 mode, bool apply) const @@ -2952,14 +3006,12 @@ void AuraEffect::HandleAuraFeatherFall(AuraApplication const* aurApp, uint8 mode return; } - WorldPacket data; if (apply) - data.Initialize(SMSG_MOVE_SPLINE_SET_FEATHER_FALL, 8+4); + target->AddUnitMovementFlag(MOVEMENTFLAG_FALLING_SLOW); else - data.Initialize(SMSG_MOVE_SPLINE_SET_NORMAL_FALL, 8+4); - data.append(target->GetPackGUID()); - data << uint32(0); - target->SendMessageToSet(&data, true); + target->RemoveUnitMovementFlag(MOVEMENTFLAG_FALLING_SLOW); + + target->SendMovementFeatherFall(); // start fall from current height if (!apply && target->GetTypeId() == TYPEID_PLAYER) @@ -2980,14 +3032,8 @@ void AuraEffect::HandleAuraHover(AuraApplication const* aurApp, uint8 mode, bool return; } - WorldPacket data; - if (apply) - data.Initialize(SMSG_MOVE_SPLINE_SET_HOVER, 8+4); - else - data.Initialize(SMSG_MOVE_SPLINE_UNSET_HOVER, 8+4); - data.append(target->GetPackGUID()); - data << uint32(0); - target->SendMessageToSet(&data, true); + target->SetHover(apply); //! Sets movementflags + target->SendMovementHover(); } void AuraEffect::HandleWaterBreathing(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const @@ -3293,16 +3339,30 @@ void AuraEffect::HandleAuraModIncreaseFlightSpeed(AuraApplication const* aurApp, Unit* target = aurApp->GetTarget(); - // Enable Fly mode for flying mounts + //! Update ability to fly if (GetAuraType() == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) { // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit if (mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK && (apply || (!target->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !target->HasAuraType(SPELL_AURA_FLY)))) { - if (Player* player = target->m_movedPlayer) - player->SendSetFlyPacket(apply); + target->SetCanFly(apply); + if (!apply) + target->RemoveUnitMovementFlag(MOVEMENTFLAG_FLYING); + target->AddUnitMovementFlag(MOVEMENTFLAG_FALLING); + target->m_movementInfo.SetFallTime(0); + + Player* player = target->ToPlayer(); + if (!player) + player = target->m_movedPlayer; + + if (player) + player->SendMovementCanFlyChange(); + + //! We still need to initiate a server-side MoveFall here, + //! which requires MSG_MOVE_FALL_LAND on landing. } + //! Someone should clean up these hacks and remove it from this function. It doesn't even belong here. if (mode & AURA_EFFECT_HANDLE_REAL) { //Players on flying mounts must be immune to polymorph @@ -3514,7 +3574,7 @@ void AuraEffect::HandleAuraModSchoolImmunity(AuraApplication const* aurApp, uint { bool banishFound = false; Unit::AuraEffectList const& banishAuras = target->GetAuraEffectsByType(GetAuraType()); - for (Unit::AuraEffectList::const_iterator i = banishAuras.begin(); i != banishAuras.end(); ++i) + for (Unit::AuraEffectList::const_iterator i = banishAuras.begin(); i != banishAuras.end(); ++i) if ((*i)->GetSpellInfo()->Mechanic == MECHANIC_BANISH) { banishFound = true; @@ -4621,7 +4681,7 @@ void AuraEffect::HandleNoReagentUseAura(AuraApplication const* aurApp, uint8 mod flag96 mask; Unit::AuraEffectList const& noReagent = target->GetAuraEffectsByType(SPELL_AURA_NO_REAGENT_USE); - for (Unit::AuraEffectList::const_iterator i = noReagent.begin(); i != noReagent.end(); ++i) + for (Unit::AuraEffectList::const_iterator i = noReagent.begin(); i != noReagent.end(); ++i) mask |= (*i)->m_spellInfo->Effects[(*i)->m_effIndex].SpellClassMask; target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1 , mask[0]); @@ -4724,11 +4784,11 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool if (owner_aura) { owner_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount); - } - if (pet_aura) - { - pet_aura->SetCharges(0); - pet_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount); + if (pet_aura) + { + pet_aura->SetCharges(0); + pet_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount); + } } break; } @@ -4791,11 +4851,6 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool if (caster) target->GetMotionMaster()->MoveFall(); break; - case 49028: - if (caster) - if (AuraEffect* aurEff = caster->GetAuraEffect(63330, 0)) // glyph of Dancing Rune Weapon - GetBase()->SetDuration(GetBase()->GetDuration() + aurEff->GetAmount()); - break; case 52916: // Honor Among Thieves if (target->GetTypeId() == TYPEID_PLAYER) if (Unit* spellTarget = ObjectAccessor::GetUnit(*target, target->ToPlayer()->GetComboTarget())) @@ -4961,7 +5016,13 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool // final heal int32 stack = GetBase()->GetStackAmount(); - target->CastCustomSpell(target, 33778, &m_amount, &stack, NULL, true, NULL, this, GetCasterGUID()); + int32 heal = m_amount; + if (caster) + { + heal = caster->SpellHealingBonusDone(target, GetSpellInfo(), heal, HEAL, stack); + heal = target->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, HEAL, stack); + } + target->CastCustomSpell(target, 33778, &heal, &stack, NULL, true, NULL, this, GetCasterGUID()); // restore mana if (caster) @@ -4971,18 +5032,6 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool } } break; - case SPELLFAMILY_HUNTER: - switch (GetId()) - { - case 34477: // Misdirection - if (aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) - target->SetReducedThreatPercent(0, 0); - break; - case 35079: // Misdirection proc - target->SetReducedThreatPercent(0, 0); - break; - } - break; case SPELLFAMILY_DEATHKNIGHT: // Summon Gargoyle (Dismiss Gargoyle at remove) if (GetId() == 61777) @@ -5224,7 +5273,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool target->CastCustomSpell(target, 50322, &bp0, NULL, NULL, true); } else - target-> RemoveAurasDueToSpell(50322); + target->RemoveAurasDueToSpell(50322); break; } } @@ -5275,66 +5324,63 @@ void AuraEffect::HandleChannelDeathItem(AuraApplication const* aurApp, uint8 mod if (!(mode & AURA_EFFECT_HANDLE_REAL)) return; - if (!apply) - { - Unit* caster = GetCaster(); + if (apply || aurApp->GetRemoveMode() != AURA_REMOVE_BY_DEATH) + return; - if (!caster || caster->GetTypeId() != TYPEID_PLAYER) - return; + Unit* caster = GetCaster(); - Player* plCaster = caster->ToPlayer(); - Unit* target = aurApp->GetTarget(); + if (!caster || caster->GetTypeId() != TYPEID_PLAYER) + return; - if (target->getDeathState() != JUST_DIED) - return; + Player* plCaster = caster->ToPlayer(); + Unit* target = aurApp->GetTarget(); - // Item amount - if (GetAmount() <= 0) - return; + // Item amount + if (GetAmount() <= 0) + return; + + if (GetSpellInfo()->Effects[m_effIndex].ItemType == 0) + return; - if (GetSpellInfo()->Effects[m_effIndex].ItemType == 0) + // Soul Shard + if (GetSpellInfo()->Effects[m_effIndex].ItemType == 6265) + { + // Soul Shard only from units that grant XP or honor + if (!plCaster->isHonorOrXPTarget(target) || + (target->GetTypeId() == TYPEID_UNIT && !target->ToCreature()->isTappedBy(plCaster))) return; - // Soul Shard - if (GetSpellInfo()->Effects[m_effIndex].ItemType == 6265) + // If this is Drain Soul, check for Glyph of Drain Soul + if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[0] & 0x00004000)) { - // Soul Shard only from units that grant XP or honor - if (!plCaster->isHonorOrXPTarget(target) || - (target->GetTypeId() == TYPEID_UNIT && !target->ToCreature()->isTappedBy(plCaster))) - return; - - // If this is Drain Soul, check for Glyph of Drain Soul - if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[0] & 0x00004000)) - { - // Glyph of Drain Soul - chance to create an additional Soul Shard - if (AuraEffect* aur = caster->GetAuraEffect(58070, 0)) - if (roll_chance_i(aur->GetMiscValue())) - caster->CastSpell(caster, 58068, true, 0, aur); // We _could_ simply do ++count here, but Blizz does it this way :) - } + // Glyph of Drain Soul - chance to create an additional Soul Shard + if (AuraEffect* aur = caster->GetAuraEffect(58070, 0)) + if (roll_chance_i(aur->GetMiscValue())) + caster->CastSpell(caster, 58068, true, 0, aur); // We _could_ simply do ++count here, but Blizz does it this way :) } + } - //Adding items - uint32 noSpaceForCount = 0; - uint32 count = m_amount; + //Adding items + uint32 noSpaceForCount = 0; + uint32 count = m_amount; - ItemPosCountVec dest; - InventoryResult msg = plCaster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, GetSpellInfo()->Effects[m_effIndex].ItemType, count, &noSpaceForCount); - if (msg != EQUIP_ERR_OK) - { - count-=noSpaceForCount; - plCaster->SendEquipError(msg, NULL, NULL, GetSpellInfo()->Effects[m_effIndex].ItemType); - if (count == 0) - return; - } - - Item* newitem = plCaster->StoreNewItem(dest, GetSpellInfo()->Effects[m_effIndex].ItemType, true); - if (!newitem) - { - plCaster->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); + ItemPosCountVec dest; + InventoryResult msg = plCaster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, GetSpellInfo()->Effects[m_effIndex].ItemType, count, &noSpaceForCount); + if (msg != EQUIP_ERR_OK) + { + count-=noSpaceForCount; + plCaster->SendEquipError(msg, NULL, NULL, GetSpellInfo()->Effects[m_effIndex].ItemType); + if (count == 0) return; - } - plCaster->SendNewItem(newitem, count, true, true); } + + Item* newitem = plCaster->StoreNewItem(dest, GetSpellInfo()->Effects[m_effIndex].ItemType, true); + if (!newitem) + { + plCaster->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); + return; + } + plCaster->SendNewItem(newitem, count, true, true); } void AuraEffect::HandleBindSight(AuraApplication const* aurApp, uint8 mode, bool apply) const @@ -5661,21 +5707,6 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const caster->CastCustomSpell(66153, SPELLVALUE_MAX_TARGETS, urand(1, 6), target, true); break; } - case 54798: // FLAMING Arrow Triggered Effect - { - if (!caster || !target || !target->ToCreature() || !caster->GetVehicle() || target->HasAura(54683)) - break; - - target->CastSpell(target, 54683, true); - - // Credit Frostworgs - if (target->GetEntry() == 29358) - caster->CastSpell(caster, 54896, true); - // Credit Frost Giants - else if (target->GetEntry() == 29351) - caster->CastSpell(caster, 54893, true); - break; - } case 62292: // Blaze (Pool of Tar) // should we use custom damage? target->CastSpell((Unit*)NULL, m_spellInfo->Effects[m_effIndex].TriggerSpell, true); @@ -5705,27 +5736,6 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const target->CastSpell((Unit*)NULL, m_spellInfo->Effects[m_effIndex].TriggerSpell, true); break; } - case SPELLFAMILY_WARLOCK: - { - switch (GetSpellInfo()->Id) - { - // Demonic Circle - case 48018: - if (GameObject* obj = target->GetGameObject(GetSpellInfo()->Id)) - { - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(48020); - if (target->IsWithinDist(obj, spellInfo->GetMaxRange(true))) - { - if (!target->HasAura(62388)) - target->CastSpell(target, 62388, true); - } - else - target->RemoveAura(62388); - } - break; - } - break; - } case SPELLFAMILY_DRUID: { switch (GetSpellInfo()->Id) @@ -5785,7 +5795,7 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const if (targets.empty()) return; - Unit* spellTarget = SelectRandomContainerElement(targets); + Unit* spellTarget = Trinity::Containers::SelectRandomContainerElement(targets); target->CastSpell(spellTarget, 57840, true); target->CastSpell(spellTarget, 57841, true); @@ -5949,15 +5959,15 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster) // move loot to player inventory and despawn target if (caster && caster->GetTypeId() == TYPEID_PLAYER && target->GetTypeId() == TYPEID_UNIT && - target->ToCreature()->GetCreatureInfo()->type == CREATURE_TYPE_GAS_CLOUD) + target->ToCreature()->GetCreatureTemplate()->type == CREATURE_TYPE_GAS_CLOUD) { Player* player = caster->ToPlayer(); Creature* creature = target->ToCreature(); // missing lootid has been reported on startup - just return - if (!creature->GetCreatureInfo()->SkinLootId) + if (!creature->GetCreatureTemplate()->SkinLootId) return; - player->AutoStoreLoot(creature->GetCreatureInfo()->SkinLootId, LootTemplates_Skinning, true); + player->AutoStoreLoot(creature->GetCreatureTemplate()->SkinLootId, LootTemplates_Skinning, true); creature->DespawnOrUnsummon(); } @@ -6232,14 +6242,15 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const uint32 absorb = 0; uint32 resist = 0; - CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL); + CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL); // ignore non positive values (can be result apply spellmods to aura damage uint32 damage = std::max(GetAmount(), 0); if (GetAuraType() == SPELL_AURA_PERIODIC_DAMAGE) { - damage = caster->SpellDamageBonus(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); + damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); + damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); // Calculate armor mitigation if (Unit::IsDamageReducedByArmor(GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), GetEffIndex())) @@ -6331,7 +6342,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) const { - if (!caster || !caster->isAlive() || !target->isAlive()) + if (!caster || !target->isAlive()) return; if (target->HasUnitState(UNIT_STATE_ISOLATED) || target->IsImmunedToDamage(GetSpellInfo())) @@ -6349,7 +6360,9 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL); uint32 damage = std::max(GetAmount(), 0); - damage = caster->SpellDamageBonus(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); + + damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); + damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); bool crit = IsPeriodicTickCrit(target, caster); if (crit) @@ -6384,15 +6397,19 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c damage = (damage <= absorb+resist) ? 0 : (damage-absorb-resist); if (damage) procVictim |= PROC_FLAG_TAKEN_DAMAGE; - caster->ProcDamageAndSpell(target, procAttacker, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo()); + if (caster->isAlive()) + caster->ProcDamageAndSpell(target, procAttacker, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo()); int32 new_damage = caster->DealDamage(target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), false); + if (caster->isAlive()) + { + float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster); - float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster); - - uint32 heal = uint32(caster->SpellHealingBonus(caster, GetSpellInfo(), uint32(new_damage * gainMultiplier), DOT, GetBase()->GetStackAmount())); + uint32 heal = uint32(caster->SpellHealingBonusDone(caster, GetSpellInfo(), uint32(new_damage * gainMultiplier), DOT, GetBase()->GetStackAmount())); + heal = uint32(caster->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, DOT, GetBase()->GetStackAmount())); - int32 gain = caster->HealBySpell(caster, GetSpellInfo(), heal); - caster->getHostileRefManager().threatAssist(caster, gain * 0.5f, GetSpellInfo()); + int32 gain = caster->HealBySpell(caster, GetSpellInfo(), heal); + caster->getHostileRefManager().threatAssist(caster, gain * 0.5f, GetSpellInfo()); + } } void AuraEffect::HandlePeriodicHealthFunnelAuraTick(Unit* target, Unit* caster) const @@ -6492,7 +6509,8 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const damage += addition; } - damage = caster->SpellHealingBonus(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); + damage = caster->SpellHealingBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); + damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); } bool crit = IsPeriodicTickCrit(target, caster); @@ -6507,7 +6525,7 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const caster->CalcHealAbsorb(target, GetSpellInfo(), heal, absorb); int32 gain = caster->DealHeal(target, heal); - SpellPeriodicAuraLogInfo pInfo(this, damage, damage - gain, absorb, 0, 0.0f, crit); + SpellPeriodicAuraLogInfo pInfo(this, heal, heal - gain, absorb, 0, 0.0f, crit); target->SendPeriodicAuraLog(&pInfo); target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellInfo()); @@ -6518,14 +6536,14 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const // damage caster for heal amount if (target != caster && GetSpellInfo()->AttributesEx2 & SPELL_ATTR2_HEALTH_FUNNEL) { - uint32 funnelDamage = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); // damage is not affected by spell power + uint32 funnelDamage = GetSpellInfo()->ManaPerSecond; // damage is not affected by spell power if ((int32)funnelDamage > gain) funnelDamage = gain; uint32 funnelAbsorb = 0; caster->DealDamageMods(caster, funnelDamage, &funnelAbsorb); caster->SendSpellNonMeleeDamageLog(caster, GetId(), funnelDamage, GetSpellInfo()->GetSchoolMask(), funnelAbsorb, 0, false, 0, false); - CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL); + CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL); caster->DealDamage(caster, funnelDamage, &cleanDamage, NODAMAGE, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true); } @@ -6782,7 +6800,8 @@ void AuraEffect::HandleProcTriggerDamageAuraProc(AuraApplication* aurApp, ProcEv Unit* target = aurApp->GetTarget(); Unit* triggerTarget = eventInfo.GetProcTarget(); SpellNonMeleeDamage damageInfo(target, triggerTarget, GetId(), GetSpellInfo()->SchoolMask); - uint32 damage = target->SpellDamageBonus(triggerTarget, GetSpellInfo(), GetAmount(), SPELL_DIRECT_DAMAGE); + uint32 damage = target->SpellDamageBonusDone(triggerTarget, GetSpellInfo(), GetAmount(), SPELL_DIRECT_DAMAGE); + damage = triggerTarget->SpellDamageBonusTaken(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); target->CalculateSpellDamageTaken(&damageInfo, damage, GetSpellInfo()); target->DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb); target->SendSpellNonMeleeDamageLog(&damageInfo); diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index add50042aa5..ea25c0b76b5 100755 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -365,7 +365,7 @@ m_isRemoved(false), m_isSingleTarget(false), m_isUsingCharges(false) void Aura::_InitEffects(uint8 effMask, Unit* caster, int32 *baseAmount) { // shouldn't be in constructor - functions in AuraEffect::AuraEffect use polymorphism - for (uint8 i=0 ; i<MAX_SPELL_EFFECTS; ++i) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { if (effMask & (uint8(1) << i)) m_effects[i] = new AuraEffect(this, i, baseAmount ? baseAmount + i : NULL, caster); @@ -386,7 +386,7 @@ Aura::~Aura() } // free effects memory - for (uint8 i = 0 ; i < MAX_SPELL_EFFECTS; ++i) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) delete m_effects[i]; ASSERT(m_applications.empty()); @@ -468,7 +468,7 @@ void Aura::_Remove(AuraRemoveMode removeMode) ApplicationMap::iterator appItr = m_applications.begin(); for (appItr = m_applications.begin(); appItr != m_applications.end();) { - AuraApplication * aurApp = appItr->second; + AuraApplication * aurApp = appItr->second; Unit* target = aurApp->GetTarget(); target->_UnapplyAura(aurApp, removeMode); appItr = m_applications.begin(); @@ -734,7 +734,8 @@ int32 Aura::CalcMaxDuration(Unit* caster) const if (IsPassive() && !m_spellInfo->DurationEntry) maxDuration = -1; - if (!IsPermanent() && modOwner) + // IsPermanent() checks max duration (which we are supposed to calculate here) + if (maxDuration != -1 && modOwner) modOwner->ApplySpellMod(GetId(), SPELLMOD_DURATION, maxDuration); return maxDuration; } @@ -1217,19 +1218,6 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b break; } break; - case SPELLFAMILY_WARLOCK: - switch (GetId()) - { - case 48020: // Demonic Circle - if (target->GetTypeId() == TYPEID_PLAYER) - if (GameObject* obj = target->GetGameObject(48018)) - { - target->NearTeleportTo(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), obj->GetOrientation()); - target->RemoveMovementImpairingAuras(); - } - break; - } - break; case SPELLFAMILY_PRIEST: if (!caster) break; @@ -1239,8 +1227,11 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b // Improved Devouring Plague if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 3790, 1)) { - int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * caster->SpellDamageBonus(target, GetSpellInfo(), GetEffect(0)->GetAmount(), DOT) / 100; + uint32 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), GetEffect(0)->GetAmount(), DOT); + damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT); + int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * int32(damage) / 100; int32 heal = int32(CalculatePctN(basepoints0, 15)); + caster->CastCustomSpell(target, 63675, &basepoints0, NULL, NULL, true, NULL, GetEffect(0)); caster->CastCustomSpell(caster, 75999, &heal, NULL, NULL, true, NULL, GetEffect(0)); } @@ -1251,7 +1242,10 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b // Empowered Renew if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 3021, 1)) { - int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * caster->SpellHealingBonus(target, GetSpellInfo(), GetEffect(0)->GetAmount(), HEAL) / 100; + uint32 damage = caster->SpellHealingBonusDone(target, GetSpellInfo(), GetEffect(0)->GetAmount(), HEAL); + damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, HEAL); + + int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * int32(damage) / 100; caster->CastCustomSpell(target, 63544, &basepoints0, NULL, NULL, true, NULL, GetEffect(0)); } } @@ -1433,17 +1427,6 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b caster->CastSpell(target, spellId, true); } } - switch (GetId()) - { - case 48018: // Demonic Circle - // Do not remove GO when aura is removed by stack - // to prevent remove GO added by new spell - // old one is already removed - if (!onReapply) - target->RemoveGameObject(GetId(), true); - target->RemoveAura(62388); - break; - } break; case SPELLFAMILY_PRIEST: if (!caster) @@ -2081,7 +2064,7 @@ void Aura::_DeleteRemovedApplications() void Aura::LoadScripts() { sScriptMgr->CreateAuraScripts(m_spellInfo->Id, m_loadedScripts); - for (std::list<AuraScript*>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end() ;) + for (std::list<AuraScript*>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end();) { if (!(*itr)->_Load(this)) { @@ -2098,11 +2081,11 @@ void Aura::LoadScripts() bool Aura::CallScriptCheckAreaTargetHandlers(Unit* target) { - for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_CHECK_AREA_TARGET); std::list<AuraScript::CheckAreaTargetHandler>::iterator hookItrEnd = (*scritr)->DoCheckAreaTarget.end(), hookItr = (*scritr)->DoCheckAreaTarget.begin(); - for (; hookItr != hookItrEnd ; ++hookItr) + for (; hookItr != hookItrEnd; ++hookItr) if (!(*hookItr).Call(*scritr, target)) return false; (*scritr)->_FinishScriptCall(); @@ -2112,11 +2095,11 @@ bool Aura::CallScriptCheckAreaTargetHandlers(Unit* target) void Aura::CallScriptDispel(DispelInfo* dispelInfo) { - for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_DISPEL); std::list<AuraScript::AuraDispelHandler>::iterator hookItrEnd = (*scritr)->OnDispel.end(), hookItr = (*scritr)->OnDispel.begin(); - for (; hookItr != hookItrEnd ; ++hookItr) + for (; hookItr != hookItrEnd; ++hookItr) (*hookItr).Call(*scritr, dispelInfo); (*scritr)->_FinishScriptCall(); } @@ -2124,11 +2107,11 @@ void Aura::CallScriptDispel(DispelInfo* dispelInfo) void Aura::CallScriptAfterDispel(DispelInfo* dispelInfo) { - for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_AFTER_DISPEL); std::list<AuraScript::AuraDispelHandler>::iterator hookItrEnd = (*scritr)->AfterDispel.end(), hookItr = (*scritr)->AfterDispel.begin(); - for (; hookItr != hookItrEnd ; ++hookItr) + for (; hookItr != hookItrEnd; ++hookItr) (*hookItr).Call(*scritr, dispelInfo); (*scritr)->_FinishScriptCall(); } @@ -2137,11 +2120,11 @@ void Aura::CallScriptAfterDispel(DispelInfo* dispelInfo) bool Aura::CallScriptEffectApplyHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, AuraEffectHandleModes mode) { bool preventDefault = false; - for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_APPLY, aurApp); std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->OnEffectApply.end(), effItr = (*scritr)->OnEffectApply.begin(); - for (; effItr != effEndItr ; ++effItr) + for (; effItr != effEndItr; ++effItr) { if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex())) (*effItr).Call(*scritr, aurEff, mode); @@ -2156,11 +2139,11 @@ bool Aura::CallScriptEffectApplyHandlers(AuraEffect const* aurEff, AuraApplicati bool Aura::CallScriptEffectRemoveHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, AuraEffectHandleModes mode) { bool preventDefault = false; - for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_REMOVE, aurApp); std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->OnEffectRemove.end(), effItr = (*scritr)->OnEffectRemove.begin(); - for (; effItr != effEndItr ; ++effItr) + for (; effItr != effEndItr; ++effItr) { if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex())) (*effItr).Call(*scritr, aurEff, mode); @@ -2174,11 +2157,11 @@ bool Aura::CallScriptEffectRemoveHandlers(AuraEffect const* aurEff, AuraApplicat void Aura::CallScriptAfterEffectApplyHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, AuraEffectHandleModes mode) { - for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_APPLY, aurApp); std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->AfterEffectApply.end(), effItr = (*scritr)->AfterEffectApply.begin(); - for (; effItr != effEndItr ; ++effItr) + for (; effItr != effEndItr; ++effItr) { if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex())) (*effItr).Call(*scritr, aurEff, mode); @@ -2189,11 +2172,11 @@ void Aura::CallScriptAfterEffectApplyHandlers(AuraEffect const* aurEff, AuraAppl void Aura::CallScriptAfterEffectRemoveHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, AuraEffectHandleModes mode) { - for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_REMOVE, aurApp); std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->AfterEffectRemove.end(), effItr = (*scritr)->AfterEffectRemove.begin(); - for (; effItr != effEndItr ; ++effItr) + for (; effItr != effEndItr; ++effItr) { if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex())) (*effItr).Call(*scritr, aurEff, mode); @@ -2205,11 +2188,11 @@ void Aura::CallScriptAfterEffectRemoveHandlers(AuraEffect const* aurEff, AuraApp bool Aura::CallScriptEffectPeriodicHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp) { bool preventDefault = false; - for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_PERIODIC, aurApp); std::list<AuraScript::EffectPeriodicHandler>::iterator effEndItr = (*scritr)->OnEffectPeriodic.end(), effItr = (*scritr)->OnEffectPeriodic.begin(); - for (; effItr != effEndItr ; ++effItr) + for (; effItr != effEndItr; ++effItr) { if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex())) (*effItr).Call(*scritr, aurEff); @@ -2223,11 +2206,11 @@ bool Aura::CallScriptEffectPeriodicHandlers(AuraEffect const* aurEff, AuraApplic void Aura::CallScriptEffectUpdatePeriodicHandlers(AuraEffect* aurEff) { - for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_UPDATE_PERIODIC); std::list<AuraScript::EffectUpdatePeriodicHandler>::iterator effEndItr = (*scritr)->OnEffectUpdatePeriodic.end(), effItr = (*scritr)->OnEffectUpdatePeriodic.begin(); - for (; effItr != effEndItr ; ++effItr) + for (; effItr != effEndItr; ++effItr) { if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex())) (*effItr).Call(*scritr, aurEff); @@ -2238,11 +2221,11 @@ void Aura::CallScriptEffectUpdatePeriodicHandlers(AuraEffect* aurEff) void Aura::CallScriptEffectCalcAmountHandlers(AuraEffect const* aurEff, int32 & amount, bool & canBeRecalculated) { - for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_AMOUNT); std::list<AuraScript::EffectCalcAmountHandler>::iterator effEndItr = (*scritr)->DoEffectCalcAmount.end(), effItr = (*scritr)->DoEffectCalcAmount.begin(); - for (; effItr != effEndItr ; ++effItr) + for (; effItr != effEndItr; ++effItr) { if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex())) (*effItr).Call(*scritr, aurEff, amount, canBeRecalculated); @@ -2253,11 +2236,11 @@ void Aura::CallScriptEffectCalcAmountHandlers(AuraEffect const* aurEff, int32 & void Aura::CallScriptEffectCalcPeriodicHandlers(AuraEffect const* aurEff, bool & isPeriodic, int32 & amplitude) { - for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_PERIODIC); std::list<AuraScript::EffectCalcPeriodicHandler>::iterator effEndItr = (*scritr)->DoEffectCalcPeriodic.end(), effItr = (*scritr)->DoEffectCalcPeriodic.begin(); - for (; effItr != effEndItr ; ++effItr) + for (; effItr != effEndItr; ++effItr) { if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex())) (*effItr).Call(*scritr, aurEff, isPeriodic, amplitude); @@ -2268,11 +2251,11 @@ void Aura::CallScriptEffectCalcPeriodicHandlers(AuraEffect const* aurEff, bool & void Aura::CallScriptEffectCalcSpellModHandlers(AuraEffect const* aurEff, SpellModifier* & spellMod) { - for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_SPELLMOD); std::list<AuraScript::EffectCalcSpellModHandler>::iterator effEndItr = (*scritr)->DoEffectCalcSpellMod.end(), effItr = (*scritr)->DoEffectCalcSpellMod.begin(); - for (; effItr != effEndItr ; ++effItr) + for (; effItr != effEndItr; ++effItr) { if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex())) (*effItr).Call(*scritr, aurEff, spellMod); @@ -2281,28 +2264,29 @@ void Aura::CallScriptEffectCalcSpellModHandlers(AuraEffect const* aurEff, SpellM } } -void Aura::CallScriptEffectAbsorbHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount, bool & /*defaultPrevented*/) +void Aura::CallScriptEffectAbsorbHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount, bool& defaultPrevented) { - for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_ABSORB, aurApp); std::list<AuraScript::EffectAbsorbHandler>::iterator effEndItr = (*scritr)->OnEffectAbsorb.end(), effItr = (*scritr)->OnEffectAbsorb.begin(); - for (; effItr != effEndItr ; ++effItr) + for (; effItr != effEndItr; ++effItr) { if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex())) (*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount); } + defaultPrevented = (*scritr)->_IsDefaultActionPrevented(); (*scritr)->_FinishScriptCall(); } } void Aura::CallScriptEffectAfterAbsorbHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount) { - for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_ABSORB, aurApp); std::list<AuraScript::EffectAbsorbHandler>::iterator effEndItr = (*scritr)->AfterEffectAbsorb.end(), effItr = (*scritr)->AfterEffectAbsorb.begin(); - for (; effItr != effEndItr ; ++effItr) + for (; effItr != effEndItr; ++effItr) { if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex())) (*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount); @@ -2313,11 +2297,11 @@ void Aura::CallScriptEffectAfterAbsorbHandlers(AuraEffect* aurEff, AuraApplicati void Aura::CallScriptEffectManaShieldHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount, bool & /*defaultPrevented*/) { - for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_MANASHIELD, aurApp); std::list<AuraScript::EffectManaShieldHandler>::iterator effEndItr = (*scritr)->OnEffectManaShield.end(), effItr = (*scritr)->OnEffectManaShield.begin(); - for (; effItr != effEndItr ; ++effItr) + for (; effItr != effEndItr; ++effItr) { if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex())) (*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount); @@ -2328,11 +2312,11 @@ void Aura::CallScriptEffectManaShieldHandlers(AuraEffect* aurEff, AuraApplicatio void Aura::CallScriptEffectAfterManaShieldHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount) { - for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_MANASHIELD, aurApp); std::list<AuraScript::EffectManaShieldHandler>::iterator effEndItr = (*scritr)->AfterEffectManaShield.end(), effItr = (*scritr)->AfterEffectManaShield.begin(); - for (; effItr != effEndItr ; ++effItr) + for (; effItr != effEndItr; ++effItr) { if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex())) (*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount); @@ -2377,7 +2361,7 @@ void UnitAura::Remove(AuraRemoveMode removeMode) void UnitAura::FillTargetMap(std::map<Unit*, uint8> & targets, Unit* caster) { - for (uint8 effIndex = 0; effIndex < MAX_SPELL_EFFECTS ; ++effIndex) + for (uint8 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex) { if (!HasEffect(effIndex)) continue; @@ -2396,13 +2380,14 @@ void UnitAura::FillTargetMap(std::map<Unit*, uint8> & targets, Unit* caster) switch (GetSpellInfo()->Effects[effIndex].Effect) { case SPELL_EFFECT_APPLY_AREA_AURA_PARTY: - targetList.push_back(GetUnitOwner()); - GetUnitOwner()->GetPartyMemberInDist(targetList, radius); - break; case SPELL_EFFECT_APPLY_AREA_AURA_RAID: + { targetList.push_back(GetUnitOwner()); - GetUnitOwner()->GetRaidMember(targetList, radius); + Trinity::AnyGroupedUnitInObjectRangeCheck u_check(GetUnitOwner(), GetUnitOwner(), radius, GetSpellInfo()->Effects[effIndex].Effect == SPELL_EFFECT_APPLY_AREA_AURA_RAID); + Trinity::UnitListSearcher<Trinity::AnyGroupedUnitInObjectRangeCheck> searcher(GetUnitOwner(), targetList, u_check); + GetUnitOwner()->VisitNearbyObject(radius, searcher); break; + } case SPELL_EFFECT_APPLY_AREA_AURA_FRIEND: { targetList.push_back(GetUnitOwner()); diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 8d98e4c2777..aad66a45d17 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -57,6 +57,35 @@ extern pEffect SpellEffects[TOTAL_SPELL_EFFECTS]; +SpellDestination::SpellDestination() +{ + _position.Relocate(0, 0, 0, 0); + _transportGUID = 0; + _transportOffset.Relocate(0, 0, 0, 0); +} + +SpellDestination::SpellDestination(float x, float y, float z, float orientation, uint32 mapId) +{ + _position.Relocate(x, y, z, orientation); + _transportGUID = 0; + _position.m_mapId = mapId; +} + +SpellDestination::SpellDestination(Position const& pos) +{ + _position.Relocate(pos); + _transportGUID = 0; +} + +SpellDestination::SpellDestination(WorldObject const& wObj) +{ + _transportGUID = wObj.GetTransGUID(); + _transportOffset.Relocate(wObj.GetTransOffsetX(), wObj.GetTransOffsetY(), wObj.GetTransOffsetZ(), wObj.GetTransOffsetO()); + _position.Relocate(wObj); + _position.SetOrientation(wObj.GetOrientation()); +} + + SpellCastTargets::SpellCastTargets() : m_elevation(0), m_speed(0) { m_objectTarget = NULL; @@ -66,12 +95,6 @@ SpellCastTargets::SpellCastTargets() : m_elevation(0), m_speed(0) m_itemTargetGUID = 0; m_itemTargetEntry = 0; - m_srcTransGUID = 0; - m_srcTransOffset.Relocate(0, 0, 0, 0); - m_srcPos.Relocate(0, 0, 0, 0); - m_dstTransGUID = 0; - m_dstTransOffset.Relocate(0, 0, 0, 0); - m_dstPos.Relocate(0, 0, 0, 0); m_strTarget = ""; m_targetMask = 0; } @@ -95,36 +118,36 @@ void SpellCastTargets::Read(ByteBuffer& data, Unit* caster) if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION) { - data.readPackGUID(m_srcTransGUID); - if (m_srcTransGUID) - data >> m_srcTransOffset.PositionXYZStream(); + data.readPackGUID(m_src._transportGUID); + if (m_src._transportGUID) + data >> m_src._transportOffset.PositionXYZStream(); else - data >> m_srcPos.PositionXYZStream(); + data >> m_src._position.PositionXYZStream(); } else { - m_srcTransGUID = caster->GetTransGUID(); - if (m_srcTransGUID) - m_srcTransOffset.Relocate(caster->GetTransOffsetX(), caster->GetTransOffsetY(), caster->GetTransOffsetZ(), caster->GetTransOffsetO()); + m_src._transportGUID = caster->GetTransGUID(); + if (m_src._transportGUID) + m_src._transportOffset.Relocate(caster->GetTransOffsetX(), caster->GetTransOffsetY(), caster->GetTransOffsetZ(), caster->GetTransOffsetO()); else - m_srcPos.Relocate(caster); + m_src._position.Relocate(caster); } if (m_targetMask & TARGET_FLAG_DEST_LOCATION) { - data.readPackGUID(m_dstTransGUID); - if (m_dstTransGUID) - data >> m_dstTransOffset.PositionXYZStream(); + data.readPackGUID(m_dst._transportGUID); + if (m_dst._transportGUID) + data >> m_dst._transportOffset.PositionXYZStream(); else - data >> m_dstPos.PositionXYZStream(); + data >> m_dst._position.PositionXYZStream(); } else { - m_dstTransGUID = caster->GetTransGUID(); - if (m_dstTransGUID) - m_dstTransOffset.Relocate(caster->GetTransOffsetX(), caster->GetTransOffsetY(), caster->GetTransOffsetZ(), caster->GetTransOffsetO()); + m_dst._transportGUID = caster->GetTransGUID(); + if (m_dst._transportGUID) + m_dst._transportOffset.Relocate(caster->GetTransOffsetX(), caster->GetTransOffsetY(), caster->GetTransOffsetZ(), caster->GetTransOffsetO()); else - m_dstPos.Relocate(caster); + m_dst._position.Relocate(caster); } if (m_targetMask & TARGET_FLAG_STRING) @@ -150,20 +173,20 @@ void SpellCastTargets::Write(ByteBuffer& data) if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION) { - data.appendPackGUID(m_srcTransGUID); // relative position guid here - transport for example - if (m_srcTransGUID) - data << m_srcTransOffset.PositionXYZStream(); + data.appendPackGUID(m_src._transportGUID); // relative position guid here - transport for example + if (m_src._transportGUID) + data << m_src._transportOffset.PositionXYZStream(); else - data << m_srcPos.PositionXYZStream(); + data << m_src._position.PositionXYZStream(); } if (m_targetMask & TARGET_FLAG_DEST_LOCATION) { - data.appendPackGUID(m_dstTransGUID); // relative position guid here - transport for example - if (m_dstTransGUID) - data << m_dstTransOffset.PositionXYZStream(); + data.appendPackGUID(m_dst._transportGUID); // relative position guid here - transport for example + if (m_dst._transportGUID) + data << m_dst._transportOffset.PositionXYZStream(); else - data << m_dstPos.PositionXYZStream(); + data << m_dst._position.PositionXYZStream(); } if (m_targetMask & TARGET_FLAG_STRING) @@ -296,31 +319,31 @@ void SpellCastTargets::UpdateTradeSlotItem() } } -Position const* SpellCastTargets::GetSrc() const +SpellDestination const* SpellCastTargets::GetSrc() const { - return &m_srcPos; + return &m_src; +} + +Position const* SpellCastTargets::GetSrcPos() const +{ + return &m_src._position; } void SpellCastTargets::SetSrc(float x, float y, float z) { - m_srcPos.Relocate(x, y, z); - m_srcTransGUID = 0; + m_src = SpellDestination(x, y, z); m_targetMask |= TARGET_FLAG_SOURCE_LOCATION; } void SpellCastTargets::SetSrc(Position const& pos) { - m_srcPos.Relocate(pos); - m_srcTransGUID = 0; + m_src = SpellDestination(pos); m_targetMask |= TARGET_FLAG_SOURCE_LOCATION; } void SpellCastTargets::SetSrc(WorldObject const& wObj) { - uint64 guid = wObj.GetTransGUID(); - m_srcTransGUID = guid; - m_srcTransOffset.Relocate(wObj.GetTransOffsetX(), wObj.GetTransOffsetY(), wObj.GetTransOffsetZ(), wObj.GetTransOffsetO()); - m_srcPos.Relocate(wObj); + m_src = SpellDestination(wObj); m_targetMask |= TARGET_FLAG_SOURCE_LOCATION; } @@ -328,13 +351,13 @@ void SpellCastTargets::ModSrc(Position const& pos) { ASSERT(m_targetMask & TARGET_FLAG_SOURCE_LOCATION); - if (m_srcTransGUID) + if (m_src._transportGUID) { Position offset; - m_srcPos.GetPositionOffsetTo(pos, offset); - m_srcTransOffset.RelocateOffset(offset); + m_src._position.GetPositionOffsetTo(pos, offset); + m_src._transportOffset.RelocateOffset(offset); } - m_srcPos.Relocate(pos); + m_src._position.Relocate(pos); } void SpellCastTargets::RemoveSrc() @@ -342,41 +365,37 @@ void SpellCastTargets::RemoveSrc() m_targetMask &= ~(TARGET_FLAG_SOURCE_LOCATION); } -WorldLocation const* SpellCastTargets::GetDst() const +SpellDestination const* SpellCastTargets::GetDst() const +{ + return &m_dst; +} + +WorldLocation const* SpellCastTargets::GetDstPos() const { - return &m_dstPos; + return &m_dst._position; } void SpellCastTargets::SetDst(float x, float y, float z, float orientation, uint32 mapId) { - m_dstPos.Relocate(x, y, z, orientation); - m_dstTransGUID = 0; + m_dst = SpellDestination(x, y, z, orientation, mapId); m_targetMask |= TARGET_FLAG_DEST_LOCATION; - if (mapId != MAPID_INVALID) - m_dstPos.m_mapId = mapId; } void SpellCastTargets::SetDst(Position const& pos) { - m_dstPos.Relocate(pos); - m_dstTransGUID = 0; + m_dst = SpellDestination(pos); m_targetMask |= TARGET_FLAG_DEST_LOCATION; } void SpellCastTargets::SetDst(WorldObject const& wObj) { - uint64 guid = wObj.GetTransGUID(); - m_dstTransGUID = guid; - m_dstTransOffset.Relocate(wObj.GetTransOffsetX(), wObj.GetTransOffsetY(), wObj.GetTransOffsetZ(), wObj.GetTransOffsetO()); - m_dstPos.Relocate(wObj); + m_dst = SpellDestination(wObj); m_targetMask |= TARGET_FLAG_DEST_LOCATION; } void SpellCastTargets::SetDst(SpellCastTargets const& spellTargets) { - m_dstTransGUID = spellTargets.m_dstTransGUID; - m_dstTransOffset.Relocate(spellTargets.m_dstTransOffset); - m_dstPos.Relocate(spellTargets.m_dstPos); + m_dst = spellTargets.m_dst; m_targetMask |= TARGET_FLAG_DEST_LOCATION; } @@ -384,13 +403,13 @@ void SpellCastTargets::ModDst(Position const& pos) { ASSERT(m_targetMask & TARGET_FLAG_DEST_LOCATION); - if (m_dstTransGUID) + if (m_dst._transportGUID) { Position offset; - m_dstPos.GetPositionOffsetTo(pos, offset); - m_dstTransOffset.RelocateOffset(offset); + m_dst._position.GetPositionOffsetTo(pos, offset); + m_dst._transportOffset.RelocateOffset(offset); } - m_dstPos.Relocate(pos); + m_dst._position.Relocate(pos); } void SpellCastTargets::RemoveDst() @@ -418,21 +437,21 @@ void SpellCastTargets::Update(Unit* caster) } // update positions by transport move - if (HasSrc() && m_srcTransGUID) + if (HasSrc() && m_src._transportGUID) { - if (WorldObject* transport = ObjectAccessor::GetWorldObject(*caster, m_srcTransGUID)) + if (WorldObject* transport = ObjectAccessor::GetWorldObject(*caster, m_src._transportGUID)) { - m_srcPos.Relocate(transport); - m_srcPos.RelocateOffset(m_srcTransOffset); + m_src._position.Relocate(transport); + m_src._position.RelocateOffset(m_src._transportOffset); } } - if (HasDst() && m_dstTransGUID) + if (HasDst() && m_dst._transportGUID) { - if (WorldObject* transport = ObjectAccessor::GetWorldObject(*caster, m_dstTransGUID)) + if (WorldObject* transport = ObjectAccessor::GetWorldObject(*caster, m_dst._transportGUID)) { - m_dstPos.Relocate(transport); - m_dstPos.RelocateOffset(m_dstTransOffset); + m_dst._position.Relocate(transport); + m_dst._position.RelocateOffset(m_dst._transportOffset); } } } @@ -450,9 +469,9 @@ void SpellCastTargets::OutDebug() const if (m_targetMask & TARGET_FLAG_TRADE_ITEM) sLog->outString("Trade item target: " UI64FMTD, m_itemTargetGUID); if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION) - sLog->outString("Source location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_srcTransGUID, m_srcTransOffset.ToString().c_str(), m_srcPos.ToString().c_str()); + sLog->outString("Source location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_src._transportGUID, m_src._transportOffset.ToString().c_str(), m_src._position.ToString().c_str()); if (m_targetMask & TARGET_FLAG_DEST_LOCATION) - sLog->outString("Destination location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_dstTransGUID, m_dstTransOffset.ToString().c_str(), m_dstPos.ToString().c_str()); + sLog->outString("Destination location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_dst._transportGUID, m_dst._transportOffset.ToString().c_str(), m_dst._position.ToString().c_str()); if (m_targetMask & TARGET_FLAG_STRING) sLog->outString("String: %s", m_strTarget.c_str()); sLog->outString("speed: %f", m_speed); @@ -565,6 +584,9 @@ m_caster((info->AttributesEx6 & SPELL_ATTR6_CAST_BY_CHARMER && caster->GetCharme CleanupTargetList(); CleanupEffectExecuteData(); + + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + m_destTargets[i] = SpellDestination(*m_caster); } Spell::~Spell() @@ -721,6 +743,9 @@ void Spell::SelectSpellTargets() // some spell effects don't add anything to target map (confirmed with sniffs) (like SPELL_EFFECT_DESTROY_ALL_TOTEMS) SelectEffectTypeImplicitTargets(i); + if (m_targets.HasDst()) + AddDestTarget(*m_targets.GetDst(), i); + if (m_spellInfo->IsChanneled()) { uint8 mask = (1 << i); @@ -768,7 +793,7 @@ void Spell::SelectSpellTargets() } else if (m_spellInfo->Speed > 0.0f) { - float dist = m_caster->GetDistance(*m_targets.GetDst()); + float dist = m_caster->GetDistance(*m_targets.GetDstPos()); m_delayMoment = (uint64) floor(dist / m_spellInfo->Speed * 1000.0f); } } @@ -827,7 +852,7 @@ void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTar m_targets.SetSrc(*m_caster); break; default: - ASSERT("Spell::SelectEffectImplicitTargets: received not implemented select target reference type for TARGET_TYPE_OBJECT_SRC"); + ASSERT(false && "Spell::SelectEffectImplicitTargets: received not implemented select target reference type for TARGET_TYPE_OBJECT_SRC"); break; } break; @@ -844,7 +869,7 @@ void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTar SelectImplicitDestDestTargets(effIndex, targetType); break; default: - ASSERT("Spell::SelectEffectImplicitTargets: received not implemented select target reference type for TARGET_TYPE_OBJECT_DEST"); + ASSERT(false && "Spell::SelectEffectImplicitTargets: received not implemented select target reference type for TARGET_TYPE_OBJECT_DEST"); break; } break; @@ -858,7 +883,7 @@ void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTar SelectImplicitTargetObjectTargets(effIndex, targetType); break; default: - ASSERT("Spell::SelectEffectImplicitTargets: received not implemented select target reference type for TARGET_TYPE_OBJECT"); + ASSERT(false && "Spell::SelectEffectImplicitTargets: received not implemented select target reference type for TARGET_TYPE_OBJECT"); break; } break; @@ -982,7 +1007,7 @@ void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTar { case TARGET_OBJECT_TYPE_UNIT: if (Unit* unitTarget = target->ToUnit()) - AddUnitTarget(unitTarget, effMask, false); + AddUnitTarget(unitTarget, effMask, true, false); break; case TARGET_OBJECT_TYPE_GOBJ: if (GameObject* gobjTarget = target->ToGameObject()) @@ -1029,7 +1054,7 @@ void Spell::SelectImplicitConeTargets(SpellEffIndex effIndex, SpellImplicitTarge if ((*j)->IsAffectingSpell(m_spellInfo)) maxTargets += (*j)->GetAmount(); - Trinity::RandomResizeList(targets, maxTargets); + Trinity::Containers::RandomResizeList(targets, maxTargets); } // for compability with older code - add only unit and go targets @@ -1093,10 +1118,10 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge switch (targetType.GetReferenceType()) { case TARGET_REFERENCE_TYPE_SRC: - center = m_targets.GetSrc(); + center = m_targets.GetSrcPos(); break; case TARGET_REFERENCE_TYPE_DEST: - center = m_targets.GetDst(); + center = m_targets.GetDstPos(); break; case TARGET_REFERENCE_TYPE_CASTER: case TARGET_REFERENCE_TYPE_TARGET: @@ -1127,7 +1152,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge case TYPEID_PLAYER: { Unit* unitTarget = (*itr)->ToUnit(); - if (unitTarget->isAlive() || !playerCaster->isHonorOrXPTarget(unitTarget) + if (unitTarget->isAlive() || !playerCaster->isHonorOrXPTarget(unitTarget) || ((unitTarget->GetCreatureTypeMask() & (1 << (CREATURE_TYPE_HUMANOID-1))) == 0) || (unitTarget->GetDisplayId() != unitTarget->GetNativeDisplayId())) break; @@ -1152,7 +1177,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge case 51328: // check if our target is not valid (spell can target ghoul or dead unit) if (!(m_targets.GetUnitTarget() && m_targets.GetUnitTarget()->GetDisplayId() == m_targets.GetUnitTarget()->GetNativeDisplayId() && - ((m_targets.GetUnitTarget()->GetEntry() == 26125 && m_targets.GetUnitTarget()->GetOwnerGUID() == m_caster->GetGUID()) + ((m_targets.GetUnitTarget()->GetEntry() == 26125 && m_targets.GetUnitTarget()->GetOwnerGUID() == m_caster->GetGUID()) || m_targets.GetUnitTarget()->isDead()))) { // remove existing targets @@ -1248,7 +1273,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge break; // Remove targets outside caster's raid - for (std::list<Unit*>::iterator itr = unitTargets.begin() ; itr != unitTargets.end();) + for (std::list<Unit*>::iterator itr = unitTargets.begin(); itr != unitTargets.end();) { if (!(*itr)->IsInRaidWith(m_caster)) itr = unitTargets.erase(itr); @@ -1265,7 +1290,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge else if (m_spellInfo->SpellFamilyFlags[2] == 0x0100) // Starfall { // Remove targets not in LoS or in stealth - for (std::list<Unit*>::iterator itr = unitTargets.begin() ; itr != unitTargets.end();) + for (std::list<Unit*>::iterator itr = unitTargets.begin(); itr != unitTargets.end();) { if ((*itr)->HasStealthAura() || (*itr)->HasInvisibilityAura() || !(*itr)->IsWithinLOSInMap(m_caster)) itr = unitTargets.erase(itr); @@ -1278,7 +1303,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge break; // Remove targets outside caster's raid - for (std::list<Unit*>::iterator itr = unitTargets.begin() ; itr != unitTargets.end();) + for (std::list<Unit*>::iterator itr = unitTargets.begin(); itr != unitTargets.end();) if (!(*itr)->IsInRaidWith(m_caster)) itr = unitTargets.erase(itr); else @@ -1300,7 +1325,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge } else { - for (std::list<Unit*>::iterator itr = unitTargets.begin() ; itr != unitTargets.end();) + for (std::list<Unit*>::iterator itr = unitTargets.begin(); itr != unitTargets.end();) if ((*itr)->getPowerType() != (Powers)power) itr = unitTargets.erase(itr); else @@ -1324,7 +1349,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge if (m_spellInfo->Id == 5246) //Intimidating Shout unitTargets.remove(m_targets.GetUnitTarget()); - Trinity::RandomResizeList(unitTargets, maxTargets); + Trinity::Containers::RandomResizeList(unitTargets, maxTargets); } CallScriptAfterUnitTargetSelectHandlers(unitTargets, effIndex); @@ -1342,7 +1367,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge if ((*j)->IsAffectingSpell(m_spellInfo)) maxTargets += (*j)->GetAmount(); - Trinity::RandomResizeList(gObjTargets, maxTargets); + Trinity::Containers::RandomResizeList(gObjTargets, maxTargets); } for (std::list<GameObject*>::iterator itr = gObjTargets.begin(); itr != gObjTargets.end(); ++itr) AddGOTarget(*itr, effMask); @@ -1468,7 +1493,7 @@ void Spell::SelectImplicitDestDestTargets(SpellEffIndex effIndex, SpellImplicitT if (targetType.GetTarget() == TARGET_DEST_DEST_RANDOM) dist *= (float)rand_norm(); - Position pos = *m_targets.GetDst(); + Position pos = *m_targets.GetDstPos(); m_caster->MovePosition(pos, dist, angle); m_targets.ModDst(pos); } @@ -1518,11 +1543,11 @@ void Spell::SelectImplicitTargetObjectTargets(SpellEffIndex effIndex, SpellImpli { ASSERT((m_targets.GetObjectTarget() || m_targets.GetItemTarget()) && "Spell::SelectImplicitTargetObjectTargets - no explicit object or item target available!"); if (Unit* unit = m_targets.GetUnitTarget()) - AddUnitTarget(unit, 1 << effIndex); + AddUnitTarget(unit, 1 << effIndex, true, false); else if (GameObject* gobj = m_targets.GetGOTarget()) AddGOTarget(gobj, 1 << effIndex); else - AddItemTarget(m_targets.GetItemTarget(), effIndex); + AddItemTarget(m_targets.GetItemTarget(), 1 << effIndex); if (WorldObject* target = m_targets.GetObjectTarget()) SelectImplicitChainTargets(effIndex, targetType, target, 1 << effIndex); @@ -1582,12 +1607,12 @@ void Spell::SelectImplicitTrajTargets() if (!dist2d) return; - float srcToDestDelta = m_targets.GetDst()->m_positionZ - m_targets.GetSrc()->m_positionZ; + float srcToDestDelta = m_targets.GetDstPos()->m_positionZ - m_targets.GetSrcPos()->m_positionZ; std::list<WorldObject*> targets; - Trinity::WorldObjectSpellTrajTargetCheck check(dist2d, m_targets.GetSrc(), m_caster, m_spellInfo); + Trinity::WorldObjectSpellTrajTargetCheck check(dist2d, m_targets.GetSrcPos(), m_caster, m_spellInfo); Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellTrajTargetCheck> searcher(m_caster, targets, check, GRID_MAP_TYPE_MASK_ALL); - SearchTargets<Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellTrajTargetCheck> > (searcher, GRID_MAP_TYPE_MASK_ALL, m_caster, m_targets.GetSrc(), dist2d); + SearchTargets<Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellTrajTargetCheck> > (searcher, GRID_MAP_TYPE_MASK_ALL, m_caster, m_targets.GetSrcPos(), dist2d); if (targets.empty()) return; @@ -1610,8 +1635,8 @@ void Spell::SelectImplicitTrajTargets() const float size = std::max((*itr)->GetObjectSize() * 0.7f, 1.0f); // 1/sqrt(3) // TODO: all calculation should be based on src instead of m_caster - const float objDist2d = m_targets.GetSrc()->GetExactDist2d(*itr) * cos(m_targets.GetSrc()->GetRelativeAngle(*itr)); - const float dz = (*itr)->GetPositionZ() - m_targets.GetSrc()->m_positionZ; + const float objDist2d = m_targets.GetSrcPos()->GetExactDist2d(*itr) * cos(m_targets.GetSrcPos()->GetRelativeAngle(*itr)); + const float dz = (*itr)->GetPositionZ() - m_targets.GetSrcPos()->m_positionZ; DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: check %u, dist between %f %f, height between %f %f.", (*itr)->GetEntry(), objDist2d - size, objDist2d + size, dz - size, dz + size);) @@ -1676,11 +1701,11 @@ void Spell::SelectImplicitTrajTargets() } } - if (m_targets.GetSrc()->GetExactDist2d(m_targets.GetDst()) > bestDist) + if (m_targets.GetSrcPos()->GetExactDist2d(m_targets.GetDstPos()) > bestDist) { - float x = m_targets.GetSrc()->m_positionX + cos(m_caster->GetOrientation()) * bestDist; - float y = m_targets.GetSrc()->m_positionY + sin(m_caster->GetOrientation()) * bestDist; - float z = m_targets.GetSrc()->m_positionZ + bestDist * (a * bestDist + b); + float x = m_targets.GetSrcPos()->m_positionX + cos(m_caster->GetOrientation()) * bestDist; + float y = m_targets.GetSrcPos()->m_positionY + sin(m_caster->GetOrientation()) * bestDist; + float z = m_targets.GetSrcPos()->m_positionZ + bestDist * (a * bestDist + b); if (itr != targets.end()) { @@ -1865,7 +1890,7 @@ void Spell::SearchAreaTargets(std::list<WorldObject*>& targets, float range, Pos return; Trinity::WorldObjectSpellAreaTargetCheck check(range, position, m_caster, referer, m_spellInfo, selectionType, condList); Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellAreaTargetCheck> searcher(m_caster, targets, check, containerTypeMask); - SearchTargets<Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellAreaTargetCheck> > (searcher, containerTypeMask, m_caster, m_caster, range); + SearchTargets<Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellAreaTargetCheck> > (searcher, containerTypeMask, m_caster, position, range); } void Spell::SearchChainTargets(std::list<WorldObject*>& targets, uint32 chainTargets, WorldObject* target, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectType, ConditionList* condList, bool isChainHeal) @@ -1894,7 +1919,7 @@ void Spell::SearchChainTargets(std::list<WorldObject*>& targets, uint32 chainTar } // chain lightning/heal spells and similar - allow to jump at larger distance and go out of los - bool isBouncingFar = (m_spellInfo->AttributesEx4 & SPELL_ATTR4_AREA_TARGET_CHAIN + bool isBouncingFar = (m_spellInfo->AttributesEx4 & SPELL_ATTR4_AREA_TARGET_CHAIN || m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_NONE || m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC); @@ -2051,7 +2076,7 @@ void Spell::CleanupTargetList() m_delayMoment = 0; } -void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*= true*/) +void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*= true*/, bool implicit /*= true*/) { for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex) if (!m_spellInfo->Effects[effIndex].IsEffect() || !CheckEffectTarget(target, effIndex)) @@ -2062,7 +2087,7 @@ void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*= return; if (checkIfValid) - if (m_spellInfo->CheckTarget(m_caster, target, true) != SPELL_CAST_OK) + if (m_spellInfo->CheckTarget(m_caster, target, implicit) != SPELL_CAST_OK) return; // Check for effect immune skip if immuned @@ -2140,7 +2165,7 @@ void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*= if (targetInfo.missCondition == SPELL_MISS_REFLECT) { // Calculate reflected spell result on caster - targetInfo.reflectResult = m_caster->SpellHitResult(m_caster, m_spellInfo, m_canReflect); + targetInfo.reflectResult = m_caster->SpellHitResult(m_caster, m_spellInfo, m_canReflect); if (targetInfo.reflectResult == SPELL_MISS_REFLECT) // Impossible reflect again, so simply deflect spell targetInfo.reflectResult = SPELL_MISS_PARRY; @@ -2217,12 +2242,6 @@ void Spell::AddGOTarget(GameObject* go, uint32 effectMask) m_UniqueGOTargetInfo.push_back(target); } -void Spell::AddGOTarget(uint64 goGUID, uint32 effectMask) -{ - if (GameObject* go = m_caster->GetMap()->GetGameObject(goGUID)) - AddGOTarget(go, effectMask); -} - void Spell::AddItemTarget(Item* item, uint32 effectMask) { for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex) @@ -2252,6 +2271,11 @@ void Spell::AddItemTarget(Item* item, uint32 effectMask) m_UniqueItemInfo.push_back(target); } +void Spell::AddDestTarget(SpellDestination const& dest, uint32 effIndex) +{ + m_destTargets[effIndex] = dest; +} + void Spell::DoAllEffectOnTarget(TargetInfo* target) { if (!target || target->processed) @@ -2417,13 +2441,13 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) else procEx |= PROC_EX_NORMAL_HIT; - // Do triggers for unit (reflect triggers passed on hit phase for correct drop charge) - if (canEffectTrigger && missInfo != SPELL_MISS_REFLECT) - caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, addhealth, m_attackType, m_spellInfo, m_triggeredByAuraSpell); - int32 gain = caster->HealBySpell(unitTarget, m_spellInfo, addhealth, crit); unitTarget->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, m_spellInfo); m_healing = gain; + + // Do triggers for unit (reflect triggers passed on hit phase for correct drop charge) + if (canEffectTrigger && missInfo != SPELL_MISS_REFLECT) + caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, addhealth, m_attackType, m_spellInfo, m_triggeredByAuraSpell); } // Do damage and triggers else if (m_damage > 0) @@ -2450,15 +2474,16 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) caster->ToPlayer()->CastItemCombatSpell(unitTarget, m_attackType, procVictim, procEx); } - caster->DealSpellDamage(&damageInfo, true); - // Haunt if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->SpellFamilyFlags[1] & 0x40000 && m_spellAura && m_spellAura->GetEffect(1)) { AuraEffect* aurEff = m_spellAura->GetEffect(1); aurEff->SetAmount(CalculatePctU(aurEff->GetAmount(), damageInfo.damage)); } + m_damage = damageInfo.damage; + + caster->DealSpellDamage(&damageInfo, true); } // Passive spell hits/misses or active spells only misses (only triggers) else @@ -2479,7 +2504,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) } } - if (missInfo != SPELL_MISS_EVADE && m_caster && !m_caster->IsFriendlyTo(unit) && !m_spellInfo->IsPositive()) + if (missInfo != SPELL_MISS_EVADE && m_caster && !m_caster->IsFriendlyTo(unit) && (!m_spellInfo->IsPositive() || m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL))) { m_caster->CombatStart(unit, !(m_spellInfo->AttributesEx3 & SPELL_ATTR3_NO_INITIAL_AGGRO)); @@ -2720,18 +2745,18 @@ void Spell::DoTriggersOnSpellHit(Unit* unit, uint8 effMask) if (!m_hitTriggerSpells.empty()) { int _duration = 0; - for (HitTriggerSpells::const_iterator i = m_hitTriggerSpells.begin(); i != m_hitTriggerSpells.end(); ++i) + for (HitTriggerSpellList::const_iterator i = m_hitTriggerSpells.begin(); i != m_hitTriggerSpells.end(); ++i) { - if (CanExecuteTriggersOnHit(effMask, i->first) && roll_chance_i(i->second)) + if (CanExecuteTriggersOnHit(effMask, i->triggeredByAura) && roll_chance_i(i->chance)) { - m_caster->CastSpell(unit, i->first, true); - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell %d triggered spell %d by SPELL_AURA_ADD_TARGET_TRIGGER aura", m_spellInfo->Id, i->first->Id); + m_caster->CastSpell(unit, i->triggeredSpell, true); + sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell %d triggered spell %d by SPELL_AURA_ADD_TARGET_TRIGGER aura", m_spellInfo->Id, i->triggeredSpell->Id); // SPELL_AURA_ADD_TARGET_TRIGGER auras shouldn't trigger auras without duration // set duration of current aura to the triggered spell - if (i->first->GetDuration() == -1) + if (i->triggeredSpell->GetDuration() == -1) { - if (Aura* triggeredAur = unit->GetAura(i->first->Id, m_caster->GetGUID())) + if (Aura* triggeredAur = unit->GetAura(i->triggeredSpell->Id, m_caster->GetGUID())) { // get duration from aura-only once if (!_duration) @@ -2862,34 +2887,6 @@ bool Spell::UpdateChanneledTargetList() return channelTargetEffectMask == 0; } -// Helper for Chain Healing -// Spell target first -// Raidmates then descending by injury suffered (MaxHealth - Health) -// Other players/mobs then descending by injury suffered (MaxHealth - Health) -struct ChainHealingOrder : public std::binary_function<const Unit*, const Unit*, bool> -{ - const Unit* MainTarget; - ChainHealingOrder(Unit const* Target) : MainTarget(Target) {}; - // functor for operator ">" - bool operator()(Unit const* _Left, Unit const* _Right) const - { - return (ChainHealingHash(_Left) < ChainHealingHash(_Right)); - } - - int32 ChainHealingHash(Unit const* Target) const - { - if (Target->GetTypeId() == TYPEID_PLAYER && MainTarget->GetTypeId() == TYPEID_PLAYER && Target->ToPlayer()->IsInSameRaidWith(MainTarget->ToPlayer())) - { - if (Target->IsFullHealth()) - return 40000; - else - return 20000 - Target->GetMaxHealth() + Target->GetHealth(); - } - else - return 40000 - Target->GetMaxHealth() + Target->GetHealth(); - } -}; - void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggeredByAura) { if (m_CastItem) @@ -3083,7 +3080,8 @@ void Spell::cancel() *m_selfContainer = NULL; m_caster->RemoveDynObject(m_spellInfo->Id); - m_caster->RemoveGameObject(m_spellInfo->Id, true); + if (m_spellInfo->IsChanneled()) // if not channeled then the object for the current cast wasn't summoned yet + m_caster->RemoveGameObject(m_spellInfo->Id, true); //set state back so finish will be processed m_spellState = oldState; @@ -3103,11 +3101,20 @@ void Spell::cast(bool skipCheck) return; } - // now that we've done the basic check, now run the scripts - // should be done before the spell is actually executed if (Player* playerCaster = m_caster->ToPlayer()) + { + // now that we've done the basic check, now run the scripts + // should be done before the spell is actually executed sScriptMgr->OnPlayerSpellCast(playerCaster, this, skipCheck); + // As of 3.0.2 pets begin attacking their owner's target immediately + // Let any pets know we've attacked something. Check DmgClass for harmful spells only + // This prevents spells such as Hunter's Mark from triggering pet attack + if (this->GetSpellInfo()->DmgClass != SPELL_DAMAGE_CLASS_NONE) + if (Pet* playerPet = playerCaster->GetPet()) + if (playerPet->isAlive() && playerPet->isControlled() && (m_targets.GetTargetMask() & TARGET_FLAG_UNIT)) + playerPet->AI()->OwnerAttacked(m_targets.GetObjectTarget()->ToUnit()); + } SetExecutedCurrently(true); if (m_caster->GetTypeId() != TYPEID_PLAYER && m_targets.GetUnitTarget() && m_targets.GetUnitTarget() != m_caster) @@ -3425,29 +3432,13 @@ void Spell::_handle_immediate_phase() return; // Handle procs on cast // TODO: finish new proc system:P - if (m_UniqueTargetInfo.empty()) + if (m_UniqueTargetInfo.empty() && m_targets.HasDst()) { uint32 procAttacker = m_procAttacker; if (!procAttacker) - { - bool positive = m_spellInfo->IsPositive(); - switch (m_spellInfo->DmgClass) - { - case SPELL_DAMAGE_CLASS_MAGIC: - if (positive) - procAttacker |= PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS; - else - procAttacker |= PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG; - break; - case SPELL_DAMAGE_CLASS_NONE: - if (positive) - procAttacker |= PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS; - else - procAttacker |= PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG; - break; - } - } - // Proc damage for spells which have only dest targets (2484 should proc 51486 for example) + procAttacker |= PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS; + + // Proc the spells that have DEST target m_originalCaster->ProcDamageAndSpell(NULL, procAttacker, 0, m_procEx | PROC_EX_NORMAL_HIT, 0, BASE_ATTACK, m_spellInfo, m_triggeredByAuraSpell); } } @@ -3508,7 +3499,7 @@ void Spell::update(uint32 difftime) // check if the player caster has moved before the spell finished if ((m_caster->GetTypeId() == TYPEID_PLAYER && m_timer != 0) && m_caster->isMoving() && (m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_MOVEMENT) && - (m_spellInfo->Effects[0].Effect != SPELL_EFFECT_STUCK || !m_caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING))) + (m_spellInfo->Effects[0].Effect != SPELL_EFFECT_STUCK || !m_caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING_FAR))) { // don't cancel for melee, autorepeat, triggered and instant spells if (!IsNextMeleeSwingSpell() && !IsAutoRepeat() && !IsTriggered()) @@ -3757,12 +3748,12 @@ void Spell::SendCastResult(Player* caster, SpellInfo const* spellInfo, uint8 cas case SPELL_FAILED_TOO_MANY_OF_ITEM: { uint32 item = 0; - for (int8 x = 0; x < 3; x++) - if (spellInfo->Effects[x].ItemType) - item = spellInfo->Effects[x].ItemType; - ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item); - if (pProto && pProto->ItemLimitCategory) - data << uint32(pProto->ItemLimitCategory); + for (int8 eff = 0; eff < MAX_SPELL_EFFECTS; eff++) + if (spellInfo->Effects[eff].ItemType) + item = spellInfo->Effects[eff].ItemType; + ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item); + if (proto && proto->ItemLimitCategory) + data << uint32(proto->ItemLimitCategory); break; } case SPELL_FAILED_PREVENTED_BY_MECHANIC: @@ -3809,6 +3800,23 @@ void Spell::SendCastResult(Player* caster, SpellInfo const* spellInfo, uint8 cas data << uint32(missingItem); // first missing item break; } + case SPELL_FAILED_PREVENTED_BY_MECHANIC: + data << uint32(spellInfo->Mechanic); + break; + case SPELL_FAILED_NEED_EXOTIC_AMMO: + data << uint32(spellInfo->EquippedItemSubClassMask); + break; + case SPELL_FAILED_NEED_MORE_ITEMS: + data << uint32(0); // Item entry + data << uint32(0); // Count + break; + case SPELL_FAILED_MIN_SKILL: + data << uint32(0); // SkillLine.dbc Id + data << uint32(0); // Amount + break; + case SPELL_FAILED_FISHING_TOO_LOW: + data << uint32(0); // Skill level + break; default: break; } @@ -3884,6 +3892,7 @@ void Spell::SendSpellGo() if ((IsTriggered() && !m_spellInfo->IsAutoRepeatRangedSpell()) || m_triggeredByAuraSpell) castFlags |= CAST_FLAG_PENDING; + if ((m_caster->GetTypeId() == TYPEID_PLAYER || (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->isPet())) && m_spellInfo->PowerType != POWER_HEALTH) @@ -3896,7 +3905,6 @@ void Spell::SendSpellGo() { castFlags |= CAST_FLAG_UNKNOWN_19; // same as in SMSG_SPELL_START castFlags |= CAST_FLAG_RUNE_LIST; // rune cooldowns list - castFlags |= CAST_FLAG_UNKNOWN_9; // ?? } if (m_spellInfo->HasEffect(SPELL_EFFECT_ACTIVATE_RUNE)) @@ -4281,10 +4289,9 @@ void Spell::TakePower() for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) if (ihit->targetGUID == targetGUID) { - if (ihit->missCondition != SPELL_MISS_NONE && ihit->missCondition != SPELL_MISS_MISS/* && ihit->targetGUID != m_caster->GetGUID()*/) - hit = false; if (ihit->missCondition != SPELL_MISS_NONE) { + hit = false; //lower spell cost on fail (by talent aura) if (Player* modOwner = m_caster->ToPlayer()->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_SPELL_COST_REFUND_ON_FAIL, m_powerCost); @@ -4469,9 +4476,7 @@ void Spell::TakeReagents() if (m_caster->GetTypeId() != TYPEID_PLAYER) return; - ItemTemplate const* castItemTemplate = m_CastItem - ? m_CastItem->GetTemplate() - : NULL; + ItemTemplate const* castItemTemplate = m_CastItem ? m_CastItem->GetTemplate() : NULL; // do not take reagents for these item casts if (castItemTemplate && castItemTemplate->Flags & ITEM_PROTO_FLAG_TRIGGERED_CAST) @@ -4571,6 +4576,7 @@ void Spell::HandleEffects(Unit* pUnitTarget, Item* pItemTarget, GameObject* pGOT unitTarget = pUnitTarget; itemTarget = pItemTarget; gameObjTarget = pGOTarget; + destTarget = &m_destTargets[i]._position; uint8 eff = m_spellInfo->Effects[i].Effect; @@ -4706,7 +4712,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->isMoving()) { // skip stuck spell to allow use it in falling case and apply spell limitations at movement - if ((!m_caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING) || m_spellInfo->Effects[0].Effect != SPELL_EFFECT_STUCK) && + if ((!m_caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING_FAR) || m_spellInfo->Effects[0].Effect != SPELL_EFFECT_STUCK) && (IsAutoRepeat() || (m_spellInfo->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED) != 0)) return SPELL_FAILED_MOVING; } @@ -4751,11 +4757,17 @@ SpellCastResult Spell::CheckCast(bool strict) // TODO: using WorldSession::SendNotification is not blizzlike if (Player* playerCaster = m_caster->ToPlayer()) { + // mLastFailedCondition can be NULL if there was an error processing the condition in Condition::Meets (i.e. wrong data for ConditionTarget or others) if (playerCaster->GetSession() && condInfo.mLastFailedCondition && condInfo.mLastFailedCondition->ErrorTextId) + { playerCaster->GetSession()->SendNotification(condInfo.mLastFailedCondition->ErrorTextId); + return SPELL_FAILED_DONT_REPORT; + } } - return SPELL_FAILED_DONT_REPORT; + if (!condInfo.mLastFailedCondition || !condInfo.mLastFailedCondition->ConditionTarget) + return SPELL_FAILED_CASTER_AURASTATE; + return SPELL_FAILED_BAD_TARGETS; } } @@ -4787,8 +4799,9 @@ SpellCastResult Spell::CheckCast(bool strict) if ((m_spellInfo->AttributesCu & SPELL_ATTR0_CU_REQ_TARGET_FACING_CASTER) && !target->HasInArc(static_cast<float>(M_PI), m_caster)) return SPELL_FAILED_NOT_INFRONT; - if (!(m_spellInfo->AttributesEx2 & SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS) && VMAP::VMapFactory::checkSpellForLoS(m_spellInfo->Id) && !m_caster->IsWithinLOSInMap(target)) - return SPELL_FAILED_LINE_OF_SIGHT; + if (m_caster->GetEntry() != WORLD_TRIGGER) // Ignore LOS for gameobjects casts (wrongly casted by a trigger) + if (!(m_spellInfo->AttributesEx2 & SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS) && VMAP::VMapFactory::checkSpellForLoS(m_spellInfo->Id) && !m_caster->IsWithinLOSInMap(target)) + return SPELL_FAILED_LINE_OF_SIGHT; } else { @@ -4806,7 +4819,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_targets.HasDst()) { float x, y, z; - m_targets.GetDst()->GetPosition(x, y, z); + m_targets.GetDstPos()->GetPosition(x, y, z); if (!(m_spellInfo->AttributesEx2 & SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS) && VMAP::VMapFactory::checkSpellForLoS(m_spellInfo->Id) && !m_caster->IsWithinLOS(x, y, z)) return SPELL_FAILED_LINE_OF_SIGHT; @@ -4899,6 +4912,37 @@ SpellCastResult Spell::CheckCast(bool strict) if (castResult != SPELL_CAST_OK) return castResult; + bool hasDispellableAura = false; + bool hasNonDispelEffect = false; + for (int i = 0; i < MAX_SPELL_EFFECTS; i++) + if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_DISPEL) + { + if (m_spellInfo->Effects[i].IsTargetingArea() || m_spellInfo->AttributesEx & SPELL_ATTR1_MELEE_COMBAT_START) + { + hasDispellableAura = true; + break; + } + if (Unit* target = m_targets.GetUnitTarget()) + { + DispelChargesList dispelList; + uint32 dispelMask = SpellInfo::GetDispelMask(DispelType(m_spellInfo->Effects[i].MiscValue)); + target->GetDispellableAuraList(m_caster, dispelMask, dispelList); + if (!dispelList.empty()) + { + hasDispellableAura = true; + break; + } + } + } + else if (m_spellInfo->Effects[i].IsEffect()) + { + hasNonDispelEffect = true; + break; + } + + if (!hasNonDispelEffect && !hasDispellableAura && m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL) && !IsTriggered()) + return SPELL_FAILED_NOTHING_TO_DISPEL; + for (int i = 0; i < MAX_SPELL_EFFECTS; i++) { // for effects of spells that have only one target @@ -4906,35 +4950,12 @@ SpellCastResult Spell::CheckCast(bool strict) { case SPELL_EFFECT_DUMMY: { - if (m_spellInfo->Id == 51582) // Rocket Boots Engaged - { - if (m_caster->IsInWater()) - return SPELL_FAILED_ONLY_ABOVEWATER; - } - else if (m_spellInfo->SpellIconID == 156) // Holy Shock - { - // spell different for friends and enemies - // hurt version required facing - if (m_targets.GetUnitTarget() && !m_caster->IsFriendlyTo(m_targets.GetUnitTarget()) && !m_caster->HasInArc(static_cast<float>(M_PI), m_targets.GetUnitTarget())) - return SPELL_FAILED_UNIT_NOT_INFRONT; - } - else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && m_spellInfo->SpellFamilyFlags[0] == 0x2000) // Death Coil (DeathKnight) - { - Unit* target = m_targets.GetUnitTarget(); - if (!target || (target->IsFriendlyTo(m_caster) && target->GetCreatureType() != CREATURE_TYPE_UNDEAD)) - return SPELL_FAILED_BAD_TARGETS; - } - else if (m_spellInfo->Id == 19938) // Awaken Peon + if (m_spellInfo->Id == 19938) // Awaken Peon { Unit* unit = m_targets.GetUnitTarget(); if (!unit || !unit->HasAura(17743)) return SPELL_FAILED_BAD_TARGETS; } - else if (m_spellInfo->Id == 52264) // Deliver Stolen Horse - { - if (!m_caster->FindNearestCreature(28653, 5)) - return SPELL_FAILED_OUT_OF_RANGE; - } else if (m_spellInfo->Id == 31789) // Righteous Defense { if (m_caster->GetTypeId() != TYPEID_PLAYER) @@ -5059,7 +5080,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (creature->GetCreatureType() != CREATURE_TYPE_CRITTER && !creature->loot.isLooted()) return SPELL_FAILED_TARGET_NOT_LOOTED; - uint32 skill = creature->GetCreatureInfo()->GetRequiredLootSkill(); + uint32 skill = creature->GetCreatureTemplate()->GetRequiredLootSkill(); int32 skillValue = m_caster->ToPlayer()->GetSkillValue(skill); int32 TargetLevel = m_targets.GetUnitTarget()->getLevel(); @@ -5142,10 +5163,8 @@ SpellCastResult Spell::CheckCast(bool strict) case SPELL_EFFECT_SUMMON_DEAD_PET: { Creature* pet = m_caster->GetGuardianPet(); - if (!pet) - return SPELL_FAILED_NO_PET; - if (pet->isAlive()) + if (pet && pet->isAlive()) return SPELL_FAILED_ALREADY_HAVE_SUMMON; break; @@ -5195,7 +5214,6 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_caster->GetCharmGUID()) return SPELL_FAILED_ALREADY_HAVE_CHARM; - break; } case SPELL_EFFECT_SUMMON_PLAYER: @@ -5270,8 +5288,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->Id == 781 && !m_caster->isInCombat()) return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; - Unit* target = m_targets.GetUnitTarget(); - if (m_caster == target && m_caster->HasUnitState(UNIT_STATE_ROOT)) + if (m_caster->HasUnitState(UNIT_STATE_ROOT)) { if (m_caster->GetTypeId() == TYPEID_PLAYER) return SPELL_FAILED_ROOTED; @@ -5327,7 +5344,7 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_HIGHLEVEL; // use SMSG_PET_TAME_FAILURE? - if (!target->GetCreatureInfo()->isTameable (m_caster->ToPlayer()->CanTameExoticPets())) + if (!target->GetCreatureTemplate()->isTameable (m_caster->ToPlayer()->CanTameExoticPets())) return SPELL_FAILED_BAD_TARGETS; if (m_caster->GetPetGUID()) @@ -5509,16 +5526,11 @@ SpellCastResult Spell::CheckPetCast(Unit* target) if (!target && m_targets.GetUnitTarget()) target = m_targets.GetUnitTarget(); - for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i) + if (m_spellInfo->NeedsExplicitUnitTarget()) { - if (m_spellInfo->Effects[i].TargetA.GetType() == TARGET_TYPE_UNIT_TARGET - || m_spellInfo->Effects[i].TargetA.GetType() == TARGET_TYPE_DEST_TARGET) - { - if (!target) - return SPELL_FAILED_BAD_IMPLICIT_TARGETS; - m_targets.SetUnitTarget(target); - break; - } + if (!target) + return SPELL_FAILED_BAD_IMPLICIT_TARGETS; + m_targets.SetUnitTarget(target); } // cooldown @@ -5748,9 +5760,9 @@ SpellCastResult Spell::CheckRange(bool strict) if (m_targets.HasDst() && !m_targets.HasTraj()) { - if (!m_caster->IsWithinDist3d(m_targets.GetDst(), max_range)) + if (!m_caster->IsWithinDist3d(m_targets.GetDstPos(), max_range)) return SPELL_FAILED_OUT_OF_RANGE; - if (min_range && m_caster->IsWithinDist3d(m_targets.GetDst(), min_range)) + if (min_range && m_caster->IsWithinDist3d(m_targets.GetDstPos(), min_range)) return SPELL_FAILED_TOO_CLOSE; } @@ -5956,7 +5968,7 @@ SpellCastResult Spell::CheckItems() // check totem-item requirements (items presence in inventory) uint32 totems = 2; - for (int i = 0; i < 2 ; ++i) + for (int i = 0; i < 2; ++i) { if (m_spellInfo->Totem[i] != 0) { @@ -6179,9 +6191,12 @@ SpellCastResult Spell::CheckItems() case SPELL_EFFECT_WEAPON_DAMAGE: case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL: { - if (m_caster->GetTypeId() != TYPEID_PLAYER) return SPELL_FAILED_TARGET_NOT_PLAYER; + if (m_caster->GetTypeId() != TYPEID_PLAYER) + return SPELL_FAILED_TARGET_NOT_PLAYER; + if (m_attackType != RANGED_ATTACK) break; + Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(m_attackType); if (!pItem || pItem->IsBroken()) return SPELL_FAILED_EQUIPPED_ITEM; @@ -6193,7 +6208,8 @@ SpellCastResult Spell::CheckItems() uint32 ammo = pItem->GetEntry(); if (!m_caster->ToPlayer()->HasItemCount(ammo, 1)) return SPELL_FAILED_NO_AMMO; - }; break; + }; + break; case ITEM_SUBCLASS_WEAPON_GUN: case ITEM_SUBCLASS_WEAPON_BOW: case ITEM_SUBCLASS_WEAPON_CROSSBOW: @@ -6357,6 +6373,30 @@ void Spell::UpdatePointers() m_CastItem = m_caster->ToPlayer()->GetItemByGuid(m_castItemGUID); m_targets.Update(m_caster); + + // further actions done only for dest targets + if (!m_targets.HasDst()) + return; + + // cache last transport + WorldObject* transport = NULL; + + // update effect destinations (in case of moved transport dest target) + for (uint8 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex) + { + SpellDestination& dest = m_destTargets[effIndex]; + if (!dest._transportGUID) + continue; + + if (!transport || transport->GetGUID() != dest._transportGUID) + transport = ObjectAccessor::GetWorldObject(*m_caster, dest._transportGUID); + + if (transport) + { + dest._position.Relocate(transport); + dest._position.RelocateOffset(dest._transportOffset); + } + } } CurrentSpellTypes Spell::GetCurrentContainer() const @@ -6519,7 +6559,7 @@ bool SpellEvent::Execute(uint64 e_time, uint32 p_time) // no, we aren't, do the typical update // check, if we have channeled spell on our hands /* - if (IsChanneledSpell(m_Spell->m_spellInfo)) + if (m_Spell->m_spellInfo->IsChanneled()) { // evented channeled spell is processed separately, casted once after delay, and not destroyed till finish // check, if we have casting anything else except this channeled spell and autorepeat @@ -6840,7 +6880,7 @@ void Spell::CheckEffectExecuteData() void Spell::LoadScripts() { sScriptMgr->CreateSpellScripts(m_spellInfo->Id, m_loadedScripts); - for (std::list<SpellScript*>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end() ;) + for (std::list<SpellScript*>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end();) { if (!(*itr)->_Load(this)) { @@ -6857,11 +6897,11 @@ void Spell::LoadScripts() void Spell::CallScriptBeforeCastHandlers() { - for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_BEFORE_CAST); std::list<SpellScript::CastHandler>::iterator hookItrEnd = (*scritr)->BeforeCast.end(), hookItr = (*scritr)->BeforeCast.begin(); - for (; hookItr != hookItrEnd ; ++hookItr) + for (; hookItr != hookItrEnd; ++hookItr) (*hookItr).Call(*scritr); (*scritr)->_FinishScriptCall(); @@ -6870,11 +6910,11 @@ void Spell::CallScriptBeforeCastHandlers() void Spell::CallScriptOnCastHandlers() { - for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_ON_CAST); std::list<SpellScript::CastHandler>::iterator hookItrEnd = (*scritr)->OnCast.end(), hookItr = (*scritr)->OnCast.begin(); - for (; hookItr != hookItrEnd ; ++hookItr) + for (; hookItr != hookItrEnd; ++hookItr) (*hookItr).Call(*scritr); (*scritr)->_FinishScriptCall(); @@ -6883,11 +6923,11 @@ void Spell::CallScriptOnCastHandlers() void Spell::CallScriptAfterCastHandlers() { - for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_AFTER_CAST); std::list<SpellScript::CastHandler>::iterator hookItrEnd = (*scritr)->AfterCast.end(), hookItr = (*scritr)->AfterCast.begin(); - for (; hookItr != hookItrEnd ; ++hookItr) + for (; hookItr != hookItrEnd; ++hookItr) (*hookItr).Call(*scritr); (*scritr)->_FinishScriptCall(); @@ -6897,7 +6937,7 @@ void Spell::CallScriptAfterCastHandlers() SpellCastResult Spell::CallScriptCheckCastHandlers() { SpellCastResult retVal = SPELL_CAST_OK; - for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_CHECK_CAST); std::list<SpellScript::CheckCastHandler>::iterator hookItrEnd = (*scritr)->OnCheckCast.end(), hookItr = (*scritr)->OnCheckCast.begin(); @@ -6915,7 +6955,7 @@ SpellCastResult Spell::CallScriptCheckCastHandlers() void Spell::PrepareScriptHitHandlers() { - for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) (*scritr)->_InitHit(); } @@ -6923,7 +6963,7 @@ bool Spell::CallScriptEffectHandlers(SpellEffIndex effIndex, SpellEffectHandleMo { // execute script effect handler hooks and check if effects was prevented bool preventDefault = false; - for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { std::list<SpellScript::EffectHandler>::iterator effItr, effEndItr; SpellScriptHookType hookType; @@ -6954,7 +6994,7 @@ bool Spell::CallScriptEffectHandlers(SpellEffIndex effIndex, SpellEffectHandleMo return false; } (*scritr)->_PrepareScriptCall(hookType); - for (; effItr != effEndItr ; ++effItr) + for (; effItr != effEndItr; ++effItr) // effect execution can be prevented if (!(*scritr)->_IsEffectPrevented(effIndex) && (*effItr).IsEffectAffected(m_spellInfo, effIndex)) (*effItr).Call(*scritr, effIndex); @@ -6969,11 +7009,11 @@ bool Spell::CallScriptEffectHandlers(SpellEffIndex effIndex, SpellEffectHandleMo void Spell::CallScriptBeforeHitHandlers() { - for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_BEFORE_HIT); std::list<SpellScript::HitHandler>::iterator hookItrEnd = (*scritr)->BeforeHit.end(), hookItr = (*scritr)->BeforeHit.begin(); - for (; hookItr != hookItrEnd ; ++hookItr) + for (; hookItr != hookItrEnd; ++hookItr) (*hookItr).Call(*scritr); (*scritr)->_FinishScriptCall(); @@ -6982,11 +7022,11 @@ void Spell::CallScriptBeforeHitHandlers() void Spell::CallScriptOnHitHandlers() { - for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_HIT); std::list<SpellScript::HitHandler>::iterator hookItrEnd = (*scritr)->OnHit.end(), hookItr = (*scritr)->OnHit.begin(); - for (; hookItr != hookItrEnd ; ++hookItr) + for (; hookItr != hookItrEnd; ++hookItr) (*hookItr).Call(*scritr); (*scritr)->_FinishScriptCall(); @@ -6995,11 +7035,11 @@ void Spell::CallScriptOnHitHandlers() void Spell::CallScriptAfterHitHandlers() { - for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_AFTER_HIT); std::list<SpellScript::HitHandler>::iterator hookItrEnd = (*scritr)->AfterHit.end(), hookItr = (*scritr)->AfterHit.begin(); - for (; hookItr != hookItrEnd ; ++hookItr) + for (; hookItr != hookItrEnd; ++hookItr) (*hookItr).Call(*scritr); (*scritr)->_FinishScriptCall(); @@ -7008,11 +7048,11 @@ void Spell::CallScriptAfterHitHandlers() void Spell::CallScriptAfterUnitTargetSelectHandlers(std::list<Unit*>& unitTargets, SpellEffIndex effIndex) { - for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_UNIT_TARGET_SELECT); std::list<SpellScript::UnitTargetHandler>::iterator hookItrEnd = (*scritr)->OnUnitTargetSelect.end(), hookItr = (*scritr)->OnUnitTargetSelect.begin(); - for (; hookItr != hookItrEnd ; ++hookItr) + for (; hookItr != hookItrEnd; ++hookItr) if ((*hookItr).IsEffectAffected(m_spellInfo, effIndex)) (*hookItr).Call(*scritr, unitTargets); @@ -7020,14 +7060,13 @@ void Spell::CallScriptAfterUnitTargetSelectHandlers(std::list<Unit*>& unitTarget } } -bool Spell::CanExecuteTriggersOnHit(uint8 effMask, SpellInfo const* spellInfo) const +bool Spell::CanExecuteTriggersOnHit(uint8 effMask, SpellInfo const* triggeredByAura) const { - bool only_on_dummy = (spellInfo && (spellInfo->AttributesEx4 & SPELL_ATTR4_PROC_ONLY_ON_DUMMY)); - // If triggered spell has SPELL_ATTR4_PROC_ONLY_ON_DUMMY then it can only proc on a casted spell with SPELL_EFFECT_DUMMY - // If triggered spell doesn't have SPELL_ATTR4_PROC_ONLY_ON_DUMMY then it can NOT proc on SPELL_EFFECT_DUMMY (needs confirmation) + bool only_on_caster = (triggeredByAura && (triggeredByAura->AttributesEx4 & SPELL_ATTR4_PROC_ONLY_ON_CASTER)); + // If triggeredByAura has SPELL_ATTR4_PROC_ONLY_ON_CASTER then it can only proc on a casted spell with TARGET_UNIT_CASTER for (uint8 i = 0;i < MAX_SPELL_EFFECTS; ++i) { - if ((effMask & (1 << i)) && (only_on_dummy == (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_DUMMY))) + if ((effMask & (1 << i)) && (!only_on_caster || (m_spellInfo->Effects[i].TargetA.GetTarget() == TARGET_UNIT_CASTER))) return true; } return false; @@ -7079,9 +7118,14 @@ void Spell::PrepareTriggersExecutedOnHit() // calculate the chance using spell base amount, because aura amount is not updated on combo-points change // this possibly needs fixing int32 auraBaseAmount = (*i)->GetBaseAmount(); - int32 chance = m_caster->CalculateSpellDamage(NULL, auraSpellInfo, auraSpellIdx, &auraBaseAmount); // proc chance is stored in effect amount - m_hitTriggerSpells.push_back(std::make_pair(spellInfo, chance * (*i)->GetBase()->GetStackAmount())); + int32 chance = m_caster->CalculateSpellDamage(NULL, auraSpellInfo, auraSpellIdx, &auraBaseAmount); + // build trigger and add to the list + HitTriggerSpell spellTriggerInfo; + spellTriggerInfo.triggeredSpell = spellInfo; + spellTriggerInfo.triggeredByAura = auraSpellInfo; + spellTriggerInfo.chance = chance * (*i)->GetBase()->GetStackAmount(); + m_hitTriggerSpells.push_back(spellTriggerInfo); } } } @@ -7154,7 +7198,7 @@ namespace Trinity { WorldObjectSpellTargetCheck::WorldObjectSpellTargetCheck(Unit* caster, Unit* referer, SpellInfo const* spellInfo, - SpellTargetCheckTypes selectionType, ConditionList* condList) : _caster(caster), _referer(referer), _spellInfo(spellInfo), + SpellTargetCheckTypes selectionType, ConditionList* condList) : _caster(caster), _referer(referer), _spellInfo(spellInfo), _targetSelectionType(selectionType), _condList(condList) { if (condList) @@ -7228,7 +7272,7 @@ bool WorldObjectSpellTargetCheck::operator()(WorldObject* target) return sConditionMgr->IsObjectMeetToConditions(*_condSrcInfo, *_condList); } -WorldObjectSpellNearbyTargetCheck::WorldObjectSpellNearbyTargetCheck(float range, Unit* caster, SpellInfo const* spellInfo, +WorldObjectSpellNearbyTargetCheck::WorldObjectSpellNearbyTargetCheck(float range, Unit* caster, SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionList* condList) : WorldObjectSpellTargetCheck(caster, caster, spellInfo, selectionType, condList), _range(range), _position(caster) { diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index dd377d66feb..ff29269e281 100755 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -57,7 +57,7 @@ enum SpellCastFlags CAST_FLAG_UNKNOWN_17 = 0x00010000, CAST_FLAG_ADJUST_MISSILE = 0x00020000, CAST_FLAG_UNKNOWN_19 = 0x00040000, - CAST_FLAG_VISUAL_CHAIN = 0x00080000, + CAST_FLAG_VISUAL_CHAIN = 0x00080000, CAST_FLAG_UNKNOWN_21 = 0x00100000, CAST_FLAG_RUNE_LIST = 0x00200000, CAST_FLAG_UNKNOWN_23 = 0x00400000, @@ -79,6 +79,18 @@ enum SpellRangeFlag SPELL_RANGE_RANGED = 2, //hunter range and ranged weapon }; +struct SpellDestination +{ + SpellDestination(); + SpellDestination(float x, float y, float z, float orientation = 0.0f, uint32 mapId = MAPID_INVALID); + SpellDestination(Position const& pos); + SpellDestination(WorldObject const& wObj); + + WorldLocation _position; + uint64 _transportGUID; + Position _transportOffset; +}; + class SpellCastTargets { public: @@ -115,14 +127,16 @@ class SpellCastTargets void SetTradeItemTarget(Player* caster); void UpdateTradeSlotItem(); - Position const* GetSrc() const; + SpellDestination const* GetSrc() const; + Position const* GetSrcPos() const; void SetSrc(float x, float y, float z); void SetSrc(Position const& pos); void SetSrc(WorldObject const& wObj); void ModSrc(Position const& pos); void RemoveSrc(); - WorldLocation const* GetDst() const; + SpellDestination const* GetDst() const; + WorldLocation const* GetDstPos() const; void SetDst(float x, float y, float z, float orientation, uint32 mapId = MAPID_INVALID); void SetDst(Position const& pos); void SetDst(WorldObject const& wObj); @@ -139,7 +153,7 @@ class SpellCastTargets float GetSpeed() const { return m_speed; } void SetSpeed(float speed) { m_speed = speed; } - float GetDist2d() const { return m_srcPos.GetExactDist2d(&m_dstPos); } + float GetDist2d() const { return m_src._position.GetExactDist2d(&m_dst._position); } float GetSpeedXY() const { return m_speed * cos(m_elevation); } float GetSpeedZ() const { return m_speed * sin(m_elevation); } @@ -158,13 +172,8 @@ class SpellCastTargets uint64 m_itemTargetGUID; uint32 m_itemTargetEntry; - uint64 m_srcTransGUID; - Position m_srcTransOffset; - Position m_srcPos; - - uint64 m_dstTransGUID; - Position m_dstTransOffset; - WorldLocation m_dstPos; + SpellDestination m_src; + SpellDestination m_dst; float m_elevation, m_speed; std::string m_strTarget; @@ -197,11 +206,6 @@ enum SpellEffectHandleMode SPELL_EFFECT_HANDLE_HIT_TARGET, }; -namespace Trinity -{ - struct SpellNotifierCreatureAndPlayer; -} - class Spell { friend void Unit::SetCurrentCastedSpell(Spell* pSpell); @@ -450,7 +454,7 @@ class Spell void SetAutoRepeat(bool rep) { m_autoRepeat = rep; } void ReSetTimer() { m_timer = m_casttime > 0 ? m_casttime : 0; } bool IsNextMeleeSwingSpell() const; - bool IsTriggered() const {return _triggeredCastFlags & TRIGGERED_FULL_MASK;}; + bool IsTriggered() const { return _triggeredCastFlags & TRIGGERED_FULL_MASK; }; bool IsChannelActive() const { return m_caster->GetUInt32Value(UNIT_CHANNEL_SPELL) != 0; } bool IsAutoActionResetSpell() const; @@ -528,6 +532,7 @@ class Spell Unit* unitTarget; Item* itemTarget; GameObject* gameObjTarget; + WorldLocation* destTarget; int32 damage; SpellEffectHandleMode effectHandleMode; // used in effects handlers @@ -588,10 +593,13 @@ class Spell }; std::list<ItemTargetInfo> m_UniqueItemInfo; - void AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid = true); + SpellDestination m_destTargets[MAX_SPELL_EFFECTS]; + + void AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid = true, bool implicit = true); void AddGOTarget(GameObject* target, uint32 effectMask); - void AddGOTarget(uint64 goGUID, uint32 effectMask); void AddItemTarget(Item* item, uint32 effectMask); + void AddDestTarget(SpellDestination const& dest, uint32 effIndex); + void DoAllEffectOnTarget(TargetInfo* target); SpellMissInfo DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleAura); void DoTriggersOnSpellHit(Unit* unit, uint8 effMask); @@ -624,13 +632,20 @@ class Spell void CallScriptAfterUnitTargetSelectHandlers(std::list<Unit*>& unitTargets, SpellEffIndex effIndex); std::list<SpellScript*> m_loadedScripts; - bool CanExecuteTriggersOnHit(uint8 effMask, SpellInfo const* spellInfo = NULL) const; + struct HitTriggerSpell + { + SpellInfo const* triggeredSpell; + SpellInfo const* triggeredByAura; + // uint8 triggeredByEffIdx This might be needed at a later stage - No need known for now + int32 chance; + }; + + bool CanExecuteTriggersOnHit(uint8 effMask, SpellInfo const* triggeredByAura = NULL) const; void PrepareTriggersExecutedOnHit(); - typedef std::list< std::pair<SpellInfo const*, int32> > HitTriggerSpells; - HitTriggerSpells m_hitTriggerSpells; + typedef std::list<HitTriggerSpell> HitTriggerSpellList; + HitTriggerSpellList m_hitTriggerSpells; // effect helpers - void GetSummonPosition(uint32 i, Position &pos, float radius = 0.0f, uint32 count = 0); void SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* properties, uint32 numSummons); void CalculateJumpSpeeds(uint8 i, float dist, float & speedxy, float & speedz); diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 271d4859c4c..4069cd5271a 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -403,23 +403,6 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) if (!unitTarget->HasAura(27825)) return; break; - // Cataclysmic Bolt - case 38441: - { - damage = unitTarget->CountPctFromMaxHealth(50); - break; - } - case 20625: // Ritual of Doom Sacrifice - case 29142: // Eyesore Blaster - case 35139: // Throw Boom's Doom - case 42393: // Brewfest - Attack Keg - case 55269: // Deathly Stare - case 56578: // Rapid-Fire Harpoon - case 62775: // Tympanic Tantrum - { - damage = unitTarget->CountPctFromMaxHealth(damage); - break; - } // Gargoyle Strike case 51963: { @@ -497,7 +480,8 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) if (aura) { uint32 pdamage = uint32(std::max(aura->GetAmount(), 0)); - pdamage = m_caster->SpellDamageBonus(unitTarget, aura->GetSpellInfo(), pdamage, DOT, aura->GetBase()->GetStackAmount()); + pdamage = m_caster->SpellDamageBonusDone(unitTarget, aura->GetSpellInfo(), pdamage, DOT, aura->GetBase()->GetStackAmount()); + pdamage = unitTarget->SpellDamageBonusTaken(m_caster, aura->GetSpellInfo(), pdamage, DOT, aura->GetBase()->GetStackAmount()); uint32 pct_dir = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, (effIndex + 1)); uint8 baseTotalTicks = uint8(m_caster->CalcSpellDuration(aura->GetSpellInfo()) / aura->GetSpellInfo()->Effects[EFFECT_0].Amplitude); damage += int32(CalculatePctU(pdamage * baseTotalTicks, pct_dir)); @@ -535,7 +519,8 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) // Shadow Word: Death - deals damage equal to damage done to caster if (m_spellInfo->SpellFamilyFlags[1] & 0x2) { - int32 back_damage = m_caster->SpellDamageBonus(unitTarget, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE); + int32 back_damage = m_caster->SpellDamageBonusDone(unitTarget, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE); + back_damage = unitTarget->SpellDamageBonusTaken(m_caster, m_spellInfo, (uint32)back_damage, SPELL_DIRECT_DAMAGE); // Pain and Suffering reduces damage if (AuraEffect* aurEff = m_caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 2874, 0)) AddPctN(back_damage, -aurEff->GetAmount()); @@ -679,19 +664,19 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) if (found) damage += m_spellInfo->Effects[EFFECT_1].CalcValue(); - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (Player* caster = m_caster->ToPlayer()) { // Add Ammo and Weapon damage plus RAP * 0.1 - Item* item = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK); - if (item) + if (Item* item = caster->GetWeaponForAttack(RANGED_ATTACK)) { - float dmg_min = item->GetTemplate()->DamageMin; - float dmg_max = item->GetTemplate()->DamageMax; + ItemTemplate const* weaponTemplate = item->GetTemplate(); + float dmg_min = weaponTemplate->Damage[0].DamageMin; + float dmg_max = weaponTemplate->Damage[0].DamageMax; if (dmg_max == 0.0f && dmg_min > dmg_max) damage += int32(dmg_min); else damage += irand(int32(dmg_min), int32(dmg_max)); - damage += int32(item->GetTemplate()->Delay*0.001f); + damage += int32(weaponTemplate->Delay * 0.001f); } } } @@ -742,7 +727,10 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) } if (m_originalCaster && damage > 0 && apply_direct_bonus) - damage = m_originalCaster->SpellDamageBonus(unitTarget, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE); + { + damage = m_originalCaster->SpellDamageBonusDone(unitTarget, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE); + damage = unitTarget->SpellDamageBonusTaken(m_originalCaster, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE); + } m_damage += damage; } @@ -787,7 +775,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex) uint32 maxTargets = std::min<uint32>(3, attackers.size()); for (uint32 i = 0; i < maxTargets; ++i) { - Unit* attacker = SelectRandomContainerElement(attackers); + Unit* attacker = Trinity::Containers::SelectRandomContainerElement(attackers); AddUnitTarget(attacker, 1 << 1); attackers.erase(attacker); } @@ -813,7 +801,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex) bp = 46585; if (m_targets.HasDst()) - targets.SetDst(*m_targets.GetDst()); + targets.SetDst(*m_targets.GetDstPos()); else { targets.SetDst(*m_caster); @@ -827,8 +815,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex) // Raise dead - take reagents and trigger summon spells case 48289: if (m_targets.HasDst()) - targets.SetDst(*m_targets.GetDst()); - + targets.SetDst(*m_targets.GetDstPos()); spell_id = CalculateDamage(0, NULL); break; } @@ -1044,7 +1031,7 @@ void Spell::EffectTriggerMissileSpell(SpellEffIndex effIndex) SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id); if (!spellInfo) { - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell::EffectTriggerSpell spell %u tried to trigger unknown spell %u", m_spellInfo->Id, triggered_spell_id); + sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell::EffectTriggerMissileSpell spell %u tried to trigger unknown spell %u", m_spellInfo->Id, triggered_spell_id); return; } @@ -1116,10 +1103,6 @@ void Spell::EffectForceCast(SpellEffIndex effIndex) case 52349: // Overtake unitTarget->CastCustomSpell(unitTarget, spellInfo->Id, &damage, NULL, NULL, true, NULL, NULL, m_originalCasterGUID); return; - case 72378: // Blood Nova - case 73058: // Blood Nova - m_caster->CastSpell(unitTarget, damage, true); // additional spell cast - break; } } @@ -1190,7 +1173,7 @@ void Spell::EffectJumpDest(SpellEffIndex effIndex) // Init dest coordinates float x, y, z; - m_targets.GetDst()->GetPosition(x, y, z); + destTarget->GetPosition(x, y, z); float speedXY, speedZ; CalculateJumpSpeeds(effIndex, m_caster->GetExactDist2d(x, y), speedXY, speedZ); @@ -1263,11 +1246,11 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/) } // Init dest coordinates - uint32 mapid = m_targets.GetDst()->GetMapId(); + uint32 mapid = destTarget->GetMapId(); if (mapid == MAPID_INVALID) mapid = unitTarget->GetMapId(); float x, y, z, orientation; - m_targets.GetDst()->GetPosition(x, y, z, orientation); + destTarget->GetPosition(x, y, z, orientation); if (!orientation && m_targets.GetUnitTarget()) orientation = m_targets.GetUnitTarget()->GetOrientation(); sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell::EffectTeleportUnits - teleport unit to %u %f %f %f %f\n", mapid, x, y, z, orientation); @@ -1426,7 +1409,8 @@ void Spell::EffectPowerDrain(SpellEffIndex effIndex) return; // add spell damage bonus - damage = m_caster->SpellDamageBonus(unitTarget, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); + damage = m_caster->SpellDamageBonusDone(unitTarget, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); + damage = unitTarget->SpellDamageBonusTaken(m_caster, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4) int32 power = damage; @@ -1589,7 +1573,7 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/) int32 tickheal = targetAura->GetAmount(); if (Unit* auraCaster = targetAura->GetCaster()) - tickheal = auraCaster->SpellHealingBonus(unitTarget, targetAura->GetSpellInfo(), tickheal, DOT); + tickheal = auraCaster->SpellHealingBonusDone(unitTarget, targetAura->GetSpellInfo(), tickheal, DOT); //int32 tickheal = targetAura->GetSpellInfo()->EffectBasePoints[idx] + 1; //It is said that talent bonus should not be included @@ -1610,11 +1594,12 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/) //addhealth += tickheal * tickcount; //addhealth = caster->SpellHealingBonus(m_spellInfo, addhealth, HEAL, unitTarget); } - // Glyph of Nourish + // Nourish else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && m_spellInfo->SpellFamilyFlags[1] & 0x2000000) { - addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, addhealth, HEAL); + addhealth = caster->SpellHealingBonusDone(unitTarget, m_spellInfo, addhealth, HEAL); + // Glyph of Nourish if (AuraEffect const* aurEff = m_caster->GetAuraEffect(62971, 0)) { Unit::AuraEffectList const& Periodic = unitTarget->GetAuraEffectsByType(SPELL_AURA_PERIODIC_HEAL); @@ -1625,25 +1610,13 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/) } } } - // Lifebloom - final heal coef multiplied by original DoT stack - else if (m_spellInfo->Id == 33778) - addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, addhealth, HEAL, m_spellValue->EffectBasePoints[1]); - // Riptide - increase healing done by Chain Heal - else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_SHAMAN && m_spellInfo->SpellFamilyFlags[0] & 0x100) - { - addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, addhealth, HEAL); - if (AuraEffect* aurEff = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_SHAMAN, 0, 0, 0x10, m_originalCasterGUID)) - { - addhealth = int32(addhealth * 1.25f); - // consume aura - unitTarget->RemoveAura(aurEff->GetBase()); - } - } // Death Pact - return pct of max health to caster else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && m_spellInfo->SpellFamilyFlags[0] & 0x00080000) - addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, int32(caster->CountPctFromMaxHealth(damage)), HEAL); + addhealth = caster->SpellHealingBonusDone(unitTarget, m_spellInfo, int32(caster->CountPctFromMaxHealth(damage)), HEAL); else - addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, addhealth, HEAL); + addhealth = caster->SpellHealingBonusDone(unitTarget, m_spellInfo, addhealth, HEAL); + + addhealth = unitTarget->SpellHealingBonusTaken(caster, m_spellInfo, addhealth, HEAL); // Remove Grievious bite if fully healed if (unitTarget->HasAura(48920) && (unitTarget->GetHealth() + addhealth >= unitTarget->GetMaxHealth())) @@ -1669,7 +1642,10 @@ void Spell::EffectHealPct(SpellEffIndex /*effIndex*/) if (m_spellInfo->Id == 59754 && unitTarget == m_caster) return; - m_healing += m_originalCaster->SpellHealingBonus(unitTarget, m_spellInfo, unitTarget->CountPctFromMaxHealth(damage), HEAL); + uint32 heal = m_originalCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, unitTarget->CountPctFromMaxHealth(damage), HEAL); + heal = unitTarget->SpellHealingBonusTaken(m_originalCaster, m_spellInfo, heal, HEAL); + + m_healing += heal; } void Spell::EffectHealMechanical(SpellEffIndex /*effIndex*/) @@ -1684,7 +1660,9 @@ void Spell::EffectHealMechanical(SpellEffIndex /*effIndex*/) if (!m_originalCaster) return; - m_healing += m_originalCaster->SpellHealingBonus(unitTarget, m_spellInfo, uint32(damage), HEAL); + uint32 heal = m_originalCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, uint32(damage), HEAL); + + m_healing += unitTarget->SpellHealingBonusTaken(m_originalCaster, m_spellInfo, heal, HEAL); } void Spell::EffectHealthLeech(SpellEffIndex effIndex) @@ -1695,7 +1673,8 @@ void Spell::EffectHealthLeech(SpellEffIndex effIndex) if (!unitTarget || !unitTarget->isAlive() || damage < 0) return; - damage = m_caster->SpellDamageBonus(unitTarget, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); + damage = m_caster->SpellDamageBonusDone(unitTarget, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); + damage = unitTarget->SpellDamageBonusTaken(m_caster, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "HealthLeech :%i", damage); @@ -1707,7 +1686,9 @@ void Spell::EffectHealthLeech(SpellEffIndex effIndex) if (m_caster->isAlive()) { - healthGain = m_caster->SpellHealingBonus(m_caster, m_spellInfo, healthGain, HEAL); + healthGain = m_caster->SpellHealingBonusDone(m_caster, m_spellInfo, healthGain, HEAL); + healthGain = m_caster->SpellHealingBonusTaken(m_caster, m_spellInfo, healthGain, HEAL); + m_caster->HealBySpell(m_caster, m_spellInfo, uint32(healthGain)); } } @@ -1896,7 +1877,7 @@ void Spell::EffectPersistentAA(SpellEffIndex effIndex) if (!caster->IsInWorld()) return; DynamicObject* dynObj = new DynamicObject(false); - if (!dynObj->CreateDynamicObject(sObjectMgr->GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), caster, m_spellInfo->Id, *m_targets.GetDst(), radius, DYNAMIC_OBJECT_AREA_SPELL)) + if (!dynObj->CreateDynamicObject(sObjectMgr->GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), caster, m_spellInfo->Id, *destTarget, radius, DYNAMIC_OBJECT_AREA_SPELL)) { delete dynObj; return; @@ -2006,7 +1987,7 @@ void Spell::EffectEnergize(SpellEffIndex effIndex) sSpellMgr->GetSetOfSpellsInSpellGroup(SPELL_GROUP_ELIXIR_GUARDIAN, avalibleElixirs); if (!battleFound) sSpellMgr->GetSetOfSpellsInSpellGroup(SPELL_GROUP_ELIXIR_BATTLE, avalibleElixirs); - for (std::set<uint32>::iterator itr = avalibleElixirs.begin(); itr != avalibleElixirs.end() ;) + for (std::set<uint32>::iterator itr = avalibleElixirs.begin(); itr != avalibleElixirs.end();) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(*itr); if (spellInfo->SpellLevel < m_spellInfo->SpellLevel || spellInfo->SpellLevel > unitTarget->getLevel()) @@ -2022,7 +2003,7 @@ void Spell::EffectEnergize(SpellEffIndex effIndex) if (!avalibleElixirs.empty()) { // cast random elixir on target - m_caster->CastSpell(unitTarget, SelectRandomContainerElement(avalibleElixirs), true, m_CastItem); + m_caster->CastSpell(unitTarget, Trinity::Containers::SelectRandomContainerElement(avalibleElixirs), true, m_CastItem); } } } @@ -2370,9 +2351,6 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) if (Player* modOwner = m_originalCaster->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DURATION, duration); - Position pos; - GetSummonPosition(effIndex, pos); - TempSummon* summon = NULL; // determine how many units should be summoned @@ -2426,11 +2404,11 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) // Summons a vehicle, but doesn't force anyone to enter it (see SUMMON_CATEGORY_VEHICLE) case SUMMON_TYPE_VEHICLE: case SUMMON_TYPE_VEHICLE2: - summon = m_caster->GetMap()->SummonCreature(entry, pos, properties, duration, m_originalCaster, m_spellInfo->Id); + summon = m_caster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_originalCaster, m_spellInfo->Id); break; case SUMMON_TYPE_TOTEM: { - summon = m_caster->GetMap()->SummonCreature(entry, pos, properties, duration, m_originalCaster, m_spellInfo->Id); + summon = m_caster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_originalCaster, m_spellInfo->Id); if (!summon || !summon->isTotem()) return; @@ -2447,12 +2425,12 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) } case SUMMON_TYPE_MINIPET: { - summon = m_caster->GetMap()->SummonCreature(entry, pos, properties, duration, m_originalCaster, m_spellInfo->Id); + summon = m_caster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_originalCaster, m_spellInfo->Id); if (!summon || !summon->HasUnitTypeMask(UNIT_MASK_MINION)) return; - summon->SelectLevel(summon->GetCreatureInfo()); // some summoned creaters have different from 1 DB data for level/hp - summon->SetUInt32Value(UNIT_NPC_FLAGS, summon->GetCreatureInfo()->npcflag); + summon->SelectLevel(summon->GetCreatureTemplate()); // some summoned creaters have different from 1 DB data for level/hp + summon->SetUInt32Value(UNIT_NPC_FLAGS, summon->GetCreatureTemplate()->npcflag); summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); @@ -2467,9 +2445,14 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) for (uint32 count = 0; count < numSummons; ++count) { - GetSummonPosition(effIndex, pos, radius, count); + Position pos; + if (count == 0) + pos = *destTarget; + else + // randomize position for multiple summons + m_caster->GetRandomPoint(*destTarget, radius, pos); - summon = m_originalCaster->SummonCreature(entry, pos, summonType, duration); + summon = m_originalCaster->SummonCreature(entry, *destTarget, summonType, duration); if (!summon) continue; @@ -2490,14 +2473,14 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) SummonGuardian(effIndex, entry, properties, numSummons); break; case SUMMON_CATEGORY_PUPPET: - summon = m_caster->GetMap()->SummonCreature(entry, pos, properties, duration, m_originalCaster, m_spellInfo->Id); + summon = m_caster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_originalCaster, m_spellInfo->Id); break; case SUMMON_CATEGORY_VEHICLE: // Summoning spells (usually triggered by npc_spellclick) that spawn a vehicle and that cause the clicker // to cast a ride vehicle spell on the summoned unit. float x, y, z; m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE); - summon = m_originalCaster->GetMap()->SummonCreature(entry, pos, properties, duration, m_caster, m_spellInfo->Id); + summon = m_originalCaster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_caster, m_spellInfo->Id); if (!summon || !summon->IsVehicle()) return; @@ -2548,7 +2531,6 @@ void Spell::EffectLearnSpell(SpellEffIndex effIndex) } typedef std::list< std::pair<uint32, uint64> > DispelList; -typedef std::list< std::pair<Aura*, uint8> > DispelChargesList; void Spell::EffectDispel(SpellEffIndex effIndex) { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) @@ -2557,48 +2539,12 @@ void Spell::EffectDispel(SpellEffIndex effIndex) if (!unitTarget) return; - DispelChargesList dispel_list; - // Create dispel mask by dispel type uint32 dispel_type = m_spellInfo->Effects[effIndex].MiscValue; uint32 dispelMask = SpellInfo::GetDispelMask(DispelType(dispel_type)); - // we should not be able to dispel diseases if the target is affected by unholy blight - if (dispelMask & (1 << DISPEL_DISEASE) && unitTarget->HasAura(50536)) - dispelMask &= ~(1 << DISPEL_DISEASE); - - Unit::AuraMap const& auras = unitTarget->GetOwnedAuras(); - for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) - { - Aura* aura = itr->second; - AuraApplication * aurApp = aura->GetApplicationOfTarget(unitTarget->GetGUID()); - if (!aurApp) - continue; - - // don't try to remove passive auras - if (aura->IsPassive()) - continue; - - if (aura->GetSpellInfo()->GetDispelMask() & dispelMask) - { - if (aura->GetSpellInfo()->Dispel == DISPEL_MAGIC) - { - // do not remove positive auras if friendly target - // negative auras if non-friendly target - if (aurApp->IsPositive() == unitTarget->IsFriendlyTo(m_caster)) - continue; - } - - // The charges / stack amounts don't count towards the total number of auras that can be dispelled. - // Ie: A dispel on a target with 5 stacks of Winters Chill and a Polymorph has 1 / (1 + 1) -> 50% chance to dispell - // Polymorph instead of 1 / (5 + 1) -> 16%. - bool dispel_charges = aura->GetSpellInfo()->AttributesEx7 & SPELL_ATTR7_DISPEL_CHARGES; - uint8 charges = dispel_charges ? aura->GetCharges() : aura->GetStackAmount(); - if (charges > 0) - dispel_list.push_back(std::make_pair(aura, charges)); - } - } - + DispelChargesList dispel_list; + unitTarget->GetDispellableAuraList(m_caster, dispelMask, dispel_list); if (dispel_list.empty()) return; @@ -2719,7 +2665,7 @@ void Spell::EffectDistract(SpellEffIndex /*effIndex*/) if (unitTarget->HasUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_STUNNED | UNIT_STATE_FLEEING)) return; - unitTarget->SetFacingTo(unitTarget->GetAngle(m_targets.GetDst())); + unitTarget->SetFacingTo(unitTarget->GetAngle(destTarget)); unitTarget->ClearUnitState(UNIT_STATE_MOVING); if (unitTarget->GetTypeId() == TYPEID_UNIT) @@ -2758,7 +2704,7 @@ void Spell::EffectAddFarsight(SpellEffIndex effIndex) return; DynamicObject* dynObj = new DynamicObject(true); - if (!dynObj->CreateDynamicObject(sObjectMgr->GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), m_caster, m_spellInfo->Id, *m_targets.GetDst(), radius, DYNAMIC_OBJECT_FARSIGHT_FOCUS)) + if (!dynObj->CreateDynamicObject(sObjectMgr->GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), m_caster, m_spellInfo->Id, *destTarget, radius, DYNAMIC_OBJECT_FARSIGHT_FOCUS)) { delete dynObj; return; @@ -2810,7 +2756,7 @@ void Spell::EffectLearnSkill(SpellEffIndex effIndex) if (damage < 0) return; - uint32 skillid = m_spellInfo->Effects[effIndex].MiscValue; + uint32 skillid = m_spellInfo->Effects[effIndex].MiscValue; uint16 skillval = unitTarget->ToPlayer()->GetPureSkillValue(skillid); unitTarget->ToPlayer()->SetSkill(skillid, m_spellInfo->Effects[effIndex].CalcValue(), skillval?skillval:1, damage*75); } @@ -3381,7 +3327,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) if (m_spellInfo->Id == 20467) { spell_bonus += int32(0.08f * m_caster->GetTotalAttackPowerValue(BASE_ATTACK)); - spell_bonus += int32(0.13f * m_caster->SpellBaseDamageBonus(m_spellInfo->GetSchoolMask())); + spell_bonus += int32(0.13f * m_caster->SpellBaseDamageBonusDone(m_spellInfo->GetSchoolMask())); } break; } @@ -3550,8 +3496,9 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) uint32 eff_damage(std::max(weaponDamage, 0)); // Add melee damage bonuses (also check for negative) - m_caster->MeleeDamageBonus(unitTarget, &eff_damage, m_attackType, m_spellInfo); - m_damage += eff_damage; + uint32 damage = m_caster->MeleeDamageBonusDone(unitTarget, eff_damage, m_attackType, m_spellInfo); + + m_damage += unitTarget->MeleeDamageBonusTaken(m_caster, damage, m_attackType, m_spellInfo); } void Spell::EffectThreat(SpellEffIndex /*effIndex*/) @@ -3576,7 +3523,7 @@ void Spell::EffectHealMaxHealth(SpellEffIndex /*effIndex*/) if (!unitTarget || !unitTarget->isAlive()) return; - int32 addhealth; + int32 addhealth = 0; if (m_spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN) // Lay on Hands { if (m_caster->GetGUID() == unitTarget->GetGUID()) @@ -3593,8 +3540,7 @@ void Spell::EffectHealMaxHealth(SpellEffIndex /*effIndex*/) else addhealth = unitTarget->GetMaxHealth() - unitTarget->GetHealth(); - if (m_originalCaster) - m_healing += m_originalCaster->SpellHealingBonus(unitTarget, m_spellInfo, addhealth, HEAL); + m_healing += addhealth; } void Spell::EffectInterruptCast(SpellEffIndex effIndex) @@ -3647,7 +3593,7 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex) float x, y, z; if (m_targets.HasDst()) - m_targets.GetDst()->GetPosition(x, y, z); + destTarget->GetPosition(x, y, z); else m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE); @@ -4032,7 +3978,9 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) while (bag) // 256 = 0 due to var type { item = m_caster->ToPlayer()->GetItemByPos(bag, slot); - if (item && item->GetEntry() == 38587) break; + if (item && item->GetEntry() == 38587) + break; + ++slot; if (slot == 39) { @@ -4190,7 +4138,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) float radius = m_spellInfo->Effects[effIndex].CalcRadius(); for (uint8 i = 0; i < 15; ++i) { - m_caster->GetRandomPoint(*m_targets.GetDst(), radius, x, y, z); + m_caster->GetRandomPoint(*destTarget, radius, x, y, z); m_caster->CastSpell(x, y, z, 54522, true); } break; @@ -4622,7 +4570,8 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) 45684 // Polymorph }; - static uint32 const spellTarget[5] = { + static uint32 const spellTarget[5] = + { 45673, // Bigger! 45672, // Shrunk 45677, // Yellow @@ -5075,7 +5024,7 @@ void Spell::EffectEnchantHeldItem(SpellEffIndex effIndex) return; // must be equipped - if (!item ->IsEquipped()) + if (!item->IsEquipped()) return; if (m_spellInfo->Effects[effIndex].MiscValue) @@ -5230,7 +5179,7 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex) float x, y, z; // If dest location if present if (m_targets.HasDst()) - m_targets.GetDst()->GetPosition(x, y, z); + destTarget->GetPosition(x, y, z); // Summon in random point all other units if location present else m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE); @@ -5360,7 +5309,7 @@ void Spell::EffectLeap(SpellEffIndex /*effIndex*/) return; Position pos; - m_targets.GetDst()->GetPosition(&pos); + destTarget->GetPosition(&pos); unitTarget->GetFirstCollisionPosition(pos, unitTarget->GetDistance(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ() + 2.0f), 0.0f); unitTarget->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), unitTarget == m_caster); } @@ -5484,7 +5433,7 @@ void Spell::EffectSkinning(SpellEffIndex /*effIndex*/) Creature* creature = unitTarget->ToCreature(); int32 targetLevel = creature->getLevel(); - uint32 skill = creature->GetCreatureInfo()->GetRequiredLootSkill(); + uint32 skill = creature->GetCreatureTemplate()->GetRequiredLootSkill(); m_caster->ToPlayer()->SendLoot(creature->GetGUID(), LOOT_SKINNING); creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); @@ -5532,7 +5481,7 @@ void Spell::EffectChargeDest(SpellEffIndex /*effIndex*/) if (m_targets.HasDst()) { Position pos; - m_targets.GetDst()->GetPosition(&pos); + destTarget->GetPosition(&pos); float angle = m_caster->GetRelativeAngle(pos.GetPositionX(), pos.GetPositionY()); float dist = m_caster->GetDistance(pos); m_caster->GetFirstCollisionPosition(pos, dist, angle); @@ -5583,7 +5532,7 @@ void Spell::EffectKnockBack(SpellEffIndex effIndex) if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_KNOCK_BACK_DEST) { if (m_targets.HasDst()) - m_targets.GetDst()->GetPosition(x, y); + destTarget->GetPosition(x, y); else return; } @@ -5671,7 +5620,7 @@ void Spell::EffectPullTowards(SpellEffIndex effIndex) if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_PULL_TOWARDS_DEST) { if (m_targets.HasDst()) - pos.Relocate(*m_targets.GetDst()); + pos.Relocate(*destTarget); else return; } @@ -5722,7 +5671,7 @@ void Spell::EffectSummonDeadPet(SpellEffIndex /*effIndex*/) return; Pet* pet = player->GetPet(); - if (!pet || pet->isAlive()) + if (pet && pet->isAlive()) return; if (damage < 0) @@ -5730,6 +5679,14 @@ void Spell::EffectSummonDeadPet(SpellEffIndex /*effIndex*/) float x, y, z; player->GetPosition(x, y, z); + if (!pet) + { + player->SummonPet(0, x, y, z, player->GetOrientation(), SUMMON_PET, 0); + pet = player->GetPet(); + } + if (!pet) + return; + player->GetMap()->CreatureRelocation(pet, x, y, z, player->GetOrientation()); pet->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE); @@ -5858,7 +5815,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex) float fx, fy, fz; if (m_targets.HasDst()) - m_targets.GetDst()->GetPosition(fx, fy, fz); + destTarget->GetPosition(fx, fy, fz); //FIXME: this can be better check for most objects but still hack else if (m_spellInfo->Effects[effIndex].HasRadius() && m_spellInfo->Speed == 0) { @@ -6439,7 +6396,11 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* for (uint32 count = 0; count < numGuardians; ++count) { Position pos; - GetSummonPosition(i, pos, radius, count); + if (count == 0) + pos = *destTarget; + else + // randomize position for multiple summons + m_caster->GetRandomPoint(*destTarget, radius, pos); TempSummon* summon = map->SummonCreature(entry, pos, properties, duration, caster, m_spellInfo->Id); if (!summon) @@ -6470,44 +6431,6 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* } } -void Spell::GetSummonPosition(uint32 i, Position &pos, float radius, uint32 count) -{ - pos.SetOrientation(m_caster->GetOrientation()); - - if (m_targets.HasDst()) - { - // Summon 1 unit in dest location - if (count == 0) - pos.Relocate(*m_targets.GetDst()); - // Summon in random point all other units if location present - else - { - //This is a workaround. Do not have time to write much about it - switch (m_spellInfo->Effects[i].TargetA.GetTarget()) - { - case TARGET_DEST_CASTER_SUMMON: - case TARGET_DEST_CASTER_RANDOM: - m_caster->GetNearPosition(pos, radius * (float)rand_norm(), (float)rand_norm()*static_cast<float>(2*M_PI)); - break; - case TARGET_DEST_DEST_RANDOM: - case TARGET_DEST_TARGET_RANDOM: - m_caster->GetRandomPoint(*m_targets.GetDst(), radius, pos); - break; - default: - pos.Relocate(*m_targets.GetDst()); - break; - } - } - } - // Summon if dest location not present near caster - else - { - float x, y, z; - m_caster->GetClosePoint(x, y, z, 3.0f); - pos.Relocate(x, y, z); - } -} - void Spell::EffectRenamePet(SpellEffIndex /*effIndex*/) { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 8b8f1fb5afc..183ca747b37 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -61,11 +61,6 @@ bool SpellImplicitTargetInfo::IsArea() const return GetSelectionCategory() == TARGET_SELECT_CATEGORY_AREA || GetSelectionCategory() == TARGET_SELECT_CATEGORY_CONE; } -SpellSelectTargetTypes SpellImplicitTargetInfo::GetType() const -{ - return Type[_target]; -} - SpellTargetSelectionCategories SpellImplicitTargetInfo::GetSelectionCategory() const { return _data[_target].SelectionCategory; @@ -104,7 +99,7 @@ float SpellImplicitTargetInfo::CalcDirectionAngle() const case TARGET_DIR_LEFT: return static_cast<float>(M_PI/2); case TARGET_DIR_FRONT_RIGHT: - return static_cast<float>(M_PI/4); + return static_cast<float>(-M_PI/4); case TARGET_DIR_BACK_RIGHT: return static_cast<float>(-3*M_PI/4); case TARGET_DIR_BACK_LEFT: @@ -207,144 +202,6 @@ uint32 SpellImplicitTargetInfo::GetExplicitTargetMask(bool& srcSet, bool& dstSet return targetMask; } -bool SpellImplicitTargetInfo::InitStaticData() -{ - InitTypeData(); - return true; -} - -void SpellImplicitTargetInfo::InitTypeData() -{ - for (uint8 i = 0; i < TOTAL_SPELL_TARGETS; ++i) - { - switch (i) - { - case TARGET_UNIT_CASTER: - case TARGET_DEST_CASTER_FISHING: - case TARGET_UNIT_MASTER: - case TARGET_UNIT_PET: - case TARGET_UNIT_CASTER_AREA_PARTY: - case TARGET_UNIT_CASTER_AREA_RAID: - case TARGET_UNIT_VEHICLE: - case TARGET_UNIT_PASSENGER_0: - case TARGET_UNIT_PASSENGER_1: - case TARGET_UNIT_PASSENGER_2: - case TARGET_UNIT_PASSENGER_3: - case TARGET_UNIT_PASSENGER_4: - case TARGET_UNIT_PASSENGER_5: - case TARGET_UNIT_PASSENGER_6: - case TARGET_UNIT_PASSENGER_7: - case TARGET_UNIT_SUMMONER: - Type[i] = TARGET_TYPE_UNIT_CASTER; - break; - case TARGET_UNIT_TARGET_MINIPET: - case TARGET_UNIT_TARGET_ALLY: - case TARGET_UNIT_TARGET_RAID: - case TARGET_UNIT_TARGET_ANY: - case TARGET_UNIT_TARGET_ENEMY: - case TARGET_UNIT_TARGET_PARTY: - case TARGET_UNIT_TARGET_PASSENGER: - case TARGET_UNIT_LASTTARGET_AREA_PARTY: - case TARGET_UNIT_TARGET_AREA_RAID_CLASS: - case TARGET_UNIT_TARGET_CHAINHEAL_ALLY: - Type[i] = TARGET_TYPE_UNIT_TARGET; - break; - case TARGET_UNIT_NEARBY_ENEMY: - case TARGET_UNIT_NEARBY_ALLY: - case TARGET_UNIT_NEARBY_ENTRY: - case TARGET_UNIT_NEARBY_PARTY: - case TARGET_UNIT_NEARBY_RAID: - case TARGET_GAMEOBJECT_NEARBY_ENTRY: - Type[i] = TARGET_TYPE_UNIT_NEARBY; - break; - case TARGET_UNIT_SRC_AREA_ENEMY: - case TARGET_UNIT_SRC_AREA_ALLY: - case TARGET_UNIT_SRC_AREA_ENTRY: - case TARGET_UNIT_SRC_AREA_PARTY: - case TARGET_GAMEOBJECT_SRC_AREA: - Type[i] = TARGET_TYPE_AREA_SRC; - break; - case TARGET_UNIT_DEST_AREA_ENEMY: - case TARGET_UNIT_DEST_AREA_ALLY: - case TARGET_UNIT_DEST_AREA_ENTRY: - case TARGET_UNIT_DEST_AREA_PARTY: - case TARGET_GAMEOBJECT_DEST_AREA: - Type[i] = TARGET_TYPE_AREA_DST; - break; - case TARGET_UNIT_CONE_ENEMY_24: - case TARGET_UNIT_CONE_ALLY: - case TARGET_UNIT_CONE_ENTRY: - case TARGET_UNIT_CONE_ENEMY_54: - case TARGET_UNIT_CONE_ENEMY_104: - case TARGET_GAMEOBJECT_CONE: - Type[i] = TARGET_TYPE_AREA_CONE; - break; - case TARGET_DEST_CASTER: - case TARGET_SRC_CASTER: - case TARGET_DEST_CASTER_SUMMON: - case TARGET_DEST_CASTER_FRONT_LEAP: - case TARGET_DEST_CASTER_FRONT: - case TARGET_DEST_CASTER_BACK: - case TARGET_DEST_CASTER_RIGHT: - case TARGET_DEST_CASTER_LEFT: - case TARGET_DEST_CASTER_FRONT_LEFT: - case TARGET_DEST_CASTER_BACK_LEFT: - case TARGET_DEST_CASTER_BACK_RIGHT: - case TARGET_DEST_CASTER_FRONT_RIGHT: - case TARGET_DEST_CASTER_RANDOM: - case TARGET_DEST_CASTER_RADIUS: - Type[i] = TARGET_TYPE_DEST_CASTER; - break; - case TARGET_DEST_TARGET_ENEMY: - case TARGET_DEST_TARGET_ANY: - case TARGET_DEST_TARGET_FRONT: - case TARGET_DEST_TARGET_BACK: - case TARGET_DEST_TARGET_RIGHT: - case TARGET_DEST_TARGET_LEFT: - case TARGET_DEST_TARGET_FRONT_LEFT: - case TARGET_DEST_TARGET_BACK_LEFT: - case TARGET_DEST_TARGET_BACK_RIGHT: - case TARGET_DEST_TARGET_FRONT_RIGHT: - case TARGET_DEST_TARGET_RANDOM: - case TARGET_DEST_TARGET_RADIUS: - Type[i] = TARGET_TYPE_DEST_TARGET; - break; - case TARGET_DEST_DYNOBJ_ENEMY: - case TARGET_DEST_DYNOBJ_ALLY: - case TARGET_DEST_DYNOBJ_NONE: - case TARGET_DEST_DEST: - case TARGET_DEST_TRAJ: - case TARGET_DEST_DEST_FRONT_LEFT: - case TARGET_DEST_DEST_BACK_LEFT: - case TARGET_DEST_DEST_BACK_RIGHT: - case TARGET_DEST_DEST_FRONT_RIGHT: - case TARGET_DEST_DEST_FRONT: - case TARGET_DEST_DEST_BACK: - case TARGET_DEST_DEST_RIGHT: - case TARGET_DEST_DEST_LEFT: - case TARGET_DEST_DEST_RANDOM: - case TARGET_DEST_DEST_RADIUS: - Type[i] = TARGET_TYPE_DEST_DEST; - break; - case TARGET_DEST_DB: - case TARGET_DEST_HOME: - case TARGET_DEST_NEARBY_ENTRY: - Type[i] = TARGET_TYPE_DEST_SPECIAL; - break; - case TARGET_UNIT_CHANNEL_TARGET: - case TARGET_DEST_CHANNEL_TARGET: - case TARGET_DEST_CHANNEL_CASTER: - Type[i] = TARGET_TYPE_CHANNEL; - break; - default: - Type[i] = TARGET_TYPE_DEFAULT; - } - } -} - -bool SpellImplicitTargetInfo::Init = SpellImplicitTargetInfo::InitStaticData(); -SpellSelectTargetTypes SpellImplicitTargetInfo::Type[TOTAL_SPELL_TARGETS]; - SpellImplicitTargetInfo::StaticData SpellImplicitTargetInfo::_data[TOTAL_SPELL_TARGETS] = { {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // @@ -496,7 +353,7 @@ bool SpellEffectInfo::IsEffect() const bool SpellEffectInfo::IsEffect(SpellEffects effectName) const { - return Effect == effectName; + return Effect == uint32(effectName); } bool SpellEffectInfo::IsAura() const @@ -759,7 +616,7 @@ SpellEffectInfo::StaticData SpellEffectInfo::_data[TOTAL_SPELL_EFFECTS] = {EFFECT_IMPLICIT_TARGET_EXPLICIT, TARGET_OBJECT_TYPE_UNIT}, // 66 SPELL_EFFECT_CREATE_MANA_GEM {EFFECT_IMPLICIT_TARGET_EXPLICIT, TARGET_OBJECT_TYPE_UNIT}, // 67 SPELL_EFFECT_HEAL_MAX_HEALTH {EFFECT_IMPLICIT_TARGET_EXPLICIT, TARGET_OBJECT_TYPE_UNIT}, // 68 SPELL_EFFECT_INTERRUPT_CAST - {EFFECT_IMPLICIT_TARGET_EXPLICIT, TARGET_OBJECT_TYPE_UNIT}, // 69 SPELL_EFFECT_DISTRACT + {EFFECT_IMPLICIT_TARGET_EXPLICIT, TARGET_OBJECT_TYPE_UNIT_AND_DEST}, // 69 SPELL_EFFECT_DISTRACT {EFFECT_IMPLICIT_TARGET_EXPLICIT, TARGET_OBJECT_TYPE_UNIT}, // 70 SPELL_EFFECT_PULL {EFFECT_IMPLICIT_TARGET_EXPLICIT, TARGET_OBJECT_TYPE_UNIT}, // 71 SPELL_EFFECT_PICKPOCKET {EFFECT_IMPLICIT_TARGET_EXPLICIT, TARGET_OBJECT_TYPE_DEST}, // 72 SPELL_EFFECT_ADD_FARSIGHT @@ -1410,7 +1267,6 @@ bool SpellInfo::IsAuraExclusiveBySpecificWith(SpellInfo const* spellInfo) const SpellSpecificType spellSpec2 = spellInfo->GetSpellSpecific(); switch (spellSpec1) { - case SPELL_SPECIFIC_PHASE: case SPELL_SPECIFIC_TRACKER: case SPELL_SPECIFIC_WARLOCK_ARMOR: case SPELL_SPECIFIC_MAGE_ARMOR: @@ -2129,8 +1985,6 @@ SpellSpecificType SpellInfo::GetSpellSpecific() const case SPELL_AURA_TRACK_RESOURCES: case SPELL_AURA_TRACK_STEALTHED: return SPELL_SPECIFIC_TRACKER; - case SPELL_AURA_PHASE: - return SPELL_SPECIFIC_PHASE; } } } @@ -2193,6 +2047,33 @@ uint32 SpellInfo::CalcCastTime(Unit* caster, Spell* spell) const return (castTime > 0) ? uint32(castTime) : 0; } +uint32 SpellInfo::GetMaxTicks() const +{ + int32 DotDuration = GetDuration(); + if (DotDuration == 0) + return 1; + + // 200% limit + if (DotDuration > 30000) + DotDuration = 30000; + + for (uint8 x = 0; x < MAX_SPELL_EFFECTS; x++) + { + if (Effects[x].Effect == SPELL_EFFECT_APPLY_AURA) + switch (Effects[x].ApplyAuraName) + { + case SPELL_AURA_PERIODIC_DAMAGE: + case SPELL_AURA_PERIODIC_HEAL: + case SPELL_AURA_PERIODIC_LEECH: + if (Effects[x].Amplitude != 0) + return DotDuration / Effects[x].Amplitude; + break; + } + } + + return 6; +} + uint32 SpellInfo::GetRecoveryTime() const { return RecoveryTime > CategoryRecoveryTime ? RecoveryTime : CategoryRecoveryTime; @@ -2397,12 +2278,12 @@ bool SpellInfo::_IsPositiveEffect(uint8 effIndex, bool deep) const switch (Id) { case 34700: // Allergic Reaction - case 61716: // Rabbit Costume - case 61734: // Noblegarden Bunny case 61987: // Avenging Wrath Marker case 61988: // Divine Shield exclude aura case 62532: // Conservator's Grip return false; + case 61716: // Rabbit Costume + case 61734: // Noblegarden Bunny case 30877: // Tag Murloc case 62344: // Fists of Stone return true; diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h index baf03589794..a338b8d627f 100644 --- a/src/server/game/Spells/SpellInfo.h +++ b/src/server/game/Spells/SpellInfo.h @@ -133,22 +133,6 @@ enum SpellTargetDirectionTypes TARGET_DIR_ENTRY, }; -enum SpellSelectTargetTypes -{ - TARGET_TYPE_DEFAULT, - TARGET_TYPE_UNIT_CASTER, - TARGET_TYPE_UNIT_TARGET, - TARGET_TYPE_UNIT_NEARBY, - TARGET_TYPE_AREA_SRC, - TARGET_TYPE_AREA_DST, - TARGET_TYPE_AREA_CONE, - TARGET_TYPE_DEST_CASTER, - TARGET_TYPE_DEST_TARGET, - TARGET_TYPE_DEST_DEST, - TARGET_TYPE_DEST_SPECIAL, - TARGET_TYPE_CHANNEL, -}; - enum SpellEffectImplicitTargetTypes { EFFECT_IMPLICIT_TARGET_NONE = 0, @@ -182,7 +166,6 @@ enum SpellSpecificType SPELL_SPECIFIC_WARRIOR_ENRAGE = 26, SPELL_SPECIFIC_PRIEST_DIVINE_SPIRIT = 27, SPELL_SPECIFIC_HAND = 28, - SPELL_SPECIFIC_PHASE = 29, }; enum SpellCustomAttributes @@ -218,7 +201,6 @@ public: SpellImplicitTargetInfo(uint32 target); bool IsArea() const; - SpellSelectTargetTypes GetType() const; SpellTargetSelectionCategories GetSelectionCategory() const; SpellTargetReferenceTypes GetReferenceType() const; SpellTargetObjectTypes GetObjectType() const; @@ -229,14 +211,7 @@ public: Targets GetTarget() const; uint32 GetExplicitTargetMask(bool& srcSet, bool& dstSet) const; - // temporarily avalible to public - static SpellSelectTargetTypes Type[TOTAL_SPELL_TARGETS]; private: - static bool InitStaticData(); - static void InitTypeData(); - - static bool Init; - struct StaticData { SpellTargetObjectTypes ObjectType; // type of object returned by target type @@ -508,6 +483,8 @@ public: int32 GetDuration() const; int32 GetMaxDuration() const; + uint32 GetMaxTicks() const; + uint32 CalcCastTime(Unit* caster = NULL, Spell* spell = NULL) const; uint32 GetRecoveryTime() const; diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 67bd7939d70..117953f2bc0 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -111,24 +111,14 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellInfo const* spellproto, } case SPELLFAMILY_WARLOCK: { - // Death Coil - if (spellproto->SpellFamilyFlags[0] & 0x80000) - return DIMINISHING_HORROR; // Curses/etc - else if ((spellproto->SpellFamilyFlags[0] & 0x80000000) || (spellproto->SpellFamilyFlags[1] & 0x200)) + if ((spellproto->SpellFamilyFlags[0] & 0x80000000) || (spellproto->SpellFamilyFlags[1] & 0x200)) return DIMINISHING_LIMITONLY; // Seduction else if (spellproto->SpellFamilyFlags[1] & 0x10000000) return DIMINISHING_FEAR; break; } - case SPELLFAMILY_PRIEST: - { - // Psychic Horror - if (spellproto->SpellFamilyFlags[2] & 0x2000) - return DIMINISHING_HORROR; - break; - } case SPELLFAMILY_DRUID: { // Pounce @@ -228,6 +218,8 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellInfo const* spellproto, return DIMINISHING_BANISH; if (mechanic & (1 << MECHANIC_ROOT)) return triggered ? DIMINISHING_ROOT : DIMINISHING_CONTROLLED_ROOT; + if (mechanic & (1 << MECHANIC_HORROR)) + return DIMINISHING_HORROR; return DIMINISHING_NONE; } @@ -651,7 +643,7 @@ SpellSpellGroupMapBounds SpellMgr::GetSpellSpellGroupMapBounds(uint32 spell_id) uint32 SpellMgr::IsSpellMemberOfSpellGroup(uint32 spellid, SpellGroup groupid) const { SpellSpellGroupMapBounds spellGroup = GetSpellSpellGroupMapBounds(spellid); - for (SpellSpellGroupMap::const_iterator itr = spellGroup.first; itr != spellGroup.second ; ++itr) + for (SpellSpellGroupMap::const_iterator itr = spellGroup.first; itr != spellGroup.second; ++itr) { if (itr->second == groupid) return true; @@ -677,7 +669,7 @@ void SpellMgr::GetSetOfSpellsInSpellGroup(SpellGroup group_id, std::set<uint32>& usedGroups.insert(group_id); SpellGroupSpellMapBounds groupSpell = GetSpellGroupSpellMapBounds(group_id); - for (SpellGroupSpellMap::const_iterator itr = groupSpell.first; itr != groupSpell.second ; ++itr) + for (SpellGroupSpellMap::const_iterator itr = groupSpell.first; itr != groupSpell.second; ++itr) { if (itr->second < 0) { @@ -696,7 +688,7 @@ bool SpellMgr::AddSameEffectStackRuleSpellGroups(SpellInfo const* spellInfo, int uint32 spellId = spellInfo->GetFirstRankSpell()->Id; SpellSpellGroupMapBounds spellGroup = GetSpellSpellGroupMapBounds(spellId); // Find group with SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT if it belongs to one - for (SpellSpellGroupMap::const_iterator itr = spellGroup.first; itr != spellGroup.second ; ++itr) + for (SpellSpellGroupMap::const_iterator itr = spellGroup.first; itr != spellGroup.second; ++itr) { SpellGroup group = itr->second; SpellGroupStackMap::const_iterator found = mSpellGroupStack.find(group); @@ -732,13 +724,13 @@ SpellGroupStackRule SpellMgr::CheckSpellGroupStackRules(SpellInfo const* spellIn // find SpellGroups which are common for both spells SpellSpellGroupMapBounds spellGroup1 = GetSpellSpellGroupMapBounds(spellid_1); std::set<SpellGroup> groups; - for (SpellSpellGroupMap::const_iterator itr = spellGroup1.first; itr != spellGroup1.second ; ++itr) + for (SpellSpellGroupMap::const_iterator itr = spellGroup1.first; itr != spellGroup1.second; ++itr) { if (IsSpellMemberOfSpellGroup(spellid_2, itr->second)) { bool add = true; SpellGroupSpellMapBounds groupSpell = GetSpellGroupSpellMapBounds(itr->second); - for (SpellGroupSpellMap::const_iterator itr2 = groupSpell.first; itr2 != groupSpell.second ; ++itr2) + for (SpellGroupSpellMap::const_iterator itr2 = groupSpell.first; itr2 != groupSpell.second; ++itr2) { if (itr2->second < 0) { @@ -757,7 +749,7 @@ SpellGroupStackRule SpellMgr::CheckSpellGroupStackRules(SpellInfo const* spellIn SpellGroupStackRule rule = SPELL_GROUP_STACK_RULE_DEFAULT; - for (std::set<SpellGroup>::iterator itr = groups.begin() ; itr!= groups.end() ; ++itr) + for (std::set<SpellGroup>::iterator itr = groups.begin(); itr!= groups.end(); ++itr) { SpellGroupStackMap::const_iterator found = mSpellGroupStack.find(*itr); if (found != mSpellGroupStack.end()) @@ -1148,11 +1140,6 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 return true; } -void SpellMgr::LoadSpellInfos() -{ - -} - void SpellMgr::LoadSpellRanks() { uint32 oldMSTime = getMSTime(); @@ -1163,18 +1150,17 @@ void SpellMgr::LoadSpellRanks() mSpellInfoMap[itr->first]->ChainEntry = NULL; } mSpellChains.clear(); - + // 0 1 2 QueryResult result = WorldDatabase.Query("SELECT first_spell_id, spell_id, rank from spell_ranks ORDER BY first_spell_id, rank"); if (!result) { - sLog->outString(">> Loaded 0 spell rank records"); + sLog->outString(">> Loaded 0 spell rank records. DB table `spell_ranks` is empty."); sLog->outString(); - sLog->outErrorDb("`spell_ranks` table is empty!"); return; } - uint32 rows = 0; + uint32 count = 0; bool finished = false; do @@ -1193,7 +1179,7 @@ void SpellMgr::LoadSpellRanks() if (lastSpell == -1) lastSpell = currentSpell; uint32 spell_id = fields[1].GetUInt32(); - uint32 rank = fields[2].GetUInt32(); + uint32 rank = fields[2].GetUInt8(); // don't drop the row if we're moving to the next rank if (currentSpell == lastSpell) @@ -1221,7 +1207,7 @@ void SpellMgr::LoadSpellRanks() int32 curRank = 0; bool valid = true; // check spells in chain - for (std::list<std::pair<int32, int32> >::iterator itr = rankChain.begin() ; itr!= rankChain.end(); ++itr) + for (std::list<std::pair<int32, int32> >::iterator itr = rankChain.begin(); itr!= rankChain.end(); ++itr) { SpellInfo const* spell = GetSpellInfo(itr->first); if (!spell) @@ -1245,7 +1231,7 @@ void SpellMgr::LoadSpellRanks() std::list<std::pair<int32, int32> >::iterator itr = rankChain.begin(); do { - ++rows; + ++count; int32 addedSpell = itr->first; mSpellChains[addedSpell].first = GetSpellInfo(lastSpell); mSpellChains[addedSpell].last = GetSpellInfo(rankChain.back().first); @@ -1265,7 +1251,7 @@ void SpellMgr::LoadSpellRanks() while (true); } while (!finished); - sLog->outString(">> Loaded %u spell rank records in %u ms", rows, GetMSTimeDiffToNow(oldMSTime)); + sLog->outString(">> Loaded %u spell rank records in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); } @@ -1276,23 +1262,24 @@ void SpellMgr::LoadSpellRequired() mSpellsReqSpell.clear(); // need for reload case mSpellReq.clear(); // need for reload case + // 0 1 QueryResult result = WorldDatabase.Query("SELECT spell_id, req_spell from spell_required"); if (!result) { - sLog->outString(">> Loaded 0 spell required records"); + sLog->outString(">> Loaded 0 spell required records. DB table `spell_required` is empty."); sLog->outString(); - sLog->outErrorDb("`spell_required` table is empty!"); return; } - uint32 rows = 0; + uint32 count = 0; do { Field* fields = result->Fetch(); - uint32 spell_id = fields[0].GetUInt32(); + uint32 spell_id = fields[0].GetUInt32(); uint32 spell_req = fields[1].GetUInt32(); + // check if chain is made with valid first spell SpellInfo const* spell = GetSpellInfo(spell_id); if (!spell) @@ -1300,17 +1287,20 @@ void SpellMgr::LoadSpellRequired() sLog->outErrorDb("spell_id %u in `spell_required` table is not found in dbcs, skipped", spell_id); continue; } + SpellInfo const* req_spell = GetSpellInfo(spell_req); if (!req_spell) { sLog->outErrorDb("req_spell %u in `spell_required` table is not found in dbcs, skipped", spell_req); continue; } + if (GetFirstSpellInChain(spell_id) == GetFirstSpellInChain(spell_req)) { sLog->outErrorDb("req_spell %u and spell_id %u in `spell_required` table are ranks of the same spell, entry not needed, skipped", spell_req, spell_id); continue; } + if (IsSpellRequiringSpell(spell_id, spell_req)) { sLog->outErrorDb("duplicated entry of req_spell %u and spell_id %u in `spell_required`, skipped", spell_req, spell_id); @@ -1319,10 +1309,10 @@ void SpellMgr::LoadSpellRequired() mSpellReq.insert (std::pair<uint32, uint32>(spell_id, spell_req)); mSpellsReqSpell.insert (std::pair<uint32, uint32>(spell_req, spell_id)); - ++rows; + ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u spell required records in %u ms", rows, GetMSTimeDiffToNow(oldMSTime)); + sLog->outString(">> Loaded %u spell required records in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); } @@ -1374,24 +1364,22 @@ void SpellMgr::LoadSpellLearnSpells() QueryResult result = WorldDatabase.Query("SELECT entry, SpellID, Active FROM spell_learn_spell"); if (!result) { - sLog->outString(">> Loaded 0 spell learn spells"); + sLog->outString(">> Loaded 0 spell learn spells. DB table `spell_learn_spell` is empty."); sLog->outString(); - sLog->outErrorDb("`spell_learn_spell` table is empty!"); return; } uint32 count = 0; - do { Field* fields = result->Fetch(); - uint32 spell_id = fields[0].GetUInt32(); + uint32 spell_id = fields[0].GetUInt16(); SpellLearnSpellNode node; - node.spell = fields[1].GetUInt32(); - node.active = fields[2].GetBool(); - node.autoLearned= false; + node.spell = fields[1].GetUInt16(); + node.active = fields[2].GetBool(); + node.autoLearned = false; if (!GetSpellInfo(spell_id)) { @@ -1475,7 +1463,7 @@ void SpellMgr::LoadSpellTargetPositions() mSpellTargetPositions.clear(); // need for reload case - // 0 1 2 3 4 5 + // 0 1 2 3 4 5 QueryResult result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM spell_target_position"); if (!result) { @@ -1485,7 +1473,6 @@ void SpellMgr::LoadSpellTargetPositions() } uint32 count = 0; - do { Field* fields = result->Fetch(); @@ -1494,7 +1481,7 @@ void SpellMgr::LoadSpellTargetPositions() SpellTargetPosition st; - st.target_mapId = fields[1].GetUInt32(); + st.target_mapId = fields[1].GetUInt16(); st.target_X = fields[2].GetFloat(); st.target_Y = fields[3].GetFloat(); st.target_Z = fields[4].GetFloat(); @@ -1597,19 +1584,17 @@ void SpellMgr::LoadSpellGroups() mSpellSpellGroup.clear(); // need for reload case mSpellGroupSpell.clear(); - uint32 count = 0; - - // 0 1 + // 0 1 QueryResult result = WorldDatabase.Query("SELECT id, spell_id FROM spell_group"); if (!result) { + sLog->outString(">> Loaded 0 spell group definitions. DB table `spell_group` is empty."); sLog->outString(); - sLog->outString(">> Loaded %u spell group definitions", count); return; } std::set<uint32> groups; - + uint32 count = 0; do { Field* fields = result->Fetch(); @@ -1617,7 +1602,7 @@ void SpellMgr::LoadSpellGroups() uint32 group_id = fields[0].GetUInt32(); if (group_id <= SPELL_GROUP_DB_RANGE_MIN && group_id >= SPELL_GROUP_CORE_RANGE_MAX) { - sLog->outErrorDb("SpellGroup id %u listed in `spell_groups` is in core range, but is not defined in core!", group_id); + sLog->outErrorDb("SpellGroup id %u listed in `spell_group` is in core range, but is not defined in core!", group_id); continue; } int32 spell_id = fields[1].GetInt32(); @@ -1627,13 +1612,13 @@ void SpellMgr::LoadSpellGroups() } while (result->NextRow()); - for (SpellGroupSpellMap::iterator itr = mSpellGroupSpell.begin(); itr!= mSpellGroupSpell.end() ;) + for (SpellGroupSpellMap::iterator itr = mSpellGroupSpell.begin(); itr!= mSpellGroupSpell.end();) { if (itr->second < 0) { if (groups.find(abs(itr->second)) == groups.end()) { - sLog->outErrorDb("SpellGroup id %u listed in `spell_groups` does not exist", abs(itr->second)); + sLog->outErrorDb("SpellGroup id %u listed in `spell_group` does not exist", abs(itr->second)); mSpellGroupSpell.erase(itr++); } else @@ -1658,12 +1643,12 @@ void SpellMgr::LoadSpellGroups() } } - for (std::set<uint32>::iterator groupItr = groups.begin() ; groupItr != groups.end() ; ++groupItr) + for (std::set<uint32>::iterator groupItr = groups.begin(); groupItr != groups.end(); ++groupItr) { std::set<uint32> spells; GetSetOfSpellsInSpellGroup(SpellGroup(*groupItr), spells); - for (std::set<uint32>::iterator spellItr = spells.begin() ; spellItr != spells.end() ; ++spellItr) + for (std::set<uint32>::iterator spellItr = spells.begin(); spellItr != spells.end(); ++spellItr) { ++count; mSpellSpellGroup.insert(SpellSpellGroupMap::value_type(*spellItr, SpellGroup(*groupItr))); @@ -1680,23 +1665,22 @@ void SpellMgr::LoadSpellGroupStackRules() mSpellGroupStack.clear(); // need for reload case - uint32 count = 0; - // 0 1 QueryResult result = WorldDatabase.Query("SELECT group_id, stack_rule FROM spell_group_stack_rules"); if (!result) { - sLog->outString(">> Loaded 0 spell group stack rules"); + sLog->outString(">> Loaded 0 spell group stack rules. DB table `spell_group_stack_rules` is empty."); sLog->outString(); return; } + uint32 count = 0; do { Field* fields = result->Fetch(); uint32 group_id = fields[0].GetUInt32(); - uint8 stack_rule = fields[1].GetUInt32(); + uint8 stack_rule = fields[1].GetInt8(); if (stack_rule >= SPELL_GROUP_STACK_RULE_MAX) { sLog->outErrorDb("SpellGroupStackRule %u listed in `spell_group_stack_rules` does not exist", stack_rule); @@ -1726,17 +1710,16 @@ void SpellMgr::LoadSpellProcEvents() mSpellProcEventMap.clear(); // need for reload case - uint32 count = 0; - // 0 1 2 3 4 5 6 7 8 9 10 QueryResult result = WorldDatabase.Query("SELECT entry, SchoolMask, SpellFamilyName, SpellFamilyMask0, SpellFamilyMask1, SpellFamilyMask2, procFlags, procEx, ppmRate, CustomChance, Cooldown FROM spell_proc_event"); if (!result) { - sLog->outString(">> Loaded %u spell proc event conditions", count); + sLog->outString(">> Loaded 0 spell proc event conditions. DB table `spell_proc_event` is empty."); sLog->outString(); return; } + uint32 count = 0; uint32 customProc = 0; do { @@ -1753,8 +1736,8 @@ void SpellMgr::LoadSpellProcEvents() SpellProcEventEntry spe; - spe.schoolMask = fields[1].GetUInt32(); - spe.spellFamilyName = fields[2].GetUInt32(); + spe.schoolMask = fields[1].GetInt8(); + spe.spellFamilyName = fields[2].GetUInt16(); spe.spellFamilyMask[0] = fields[3].GetUInt32(); spe.spellFamilyMask[1] = fields[4].GetUInt32(); spe.spellFamilyMask[2] = fields[5].GetUInt32(); @@ -1791,17 +1774,16 @@ void SpellMgr::LoadSpellProcs() mSpellProcMap.clear(); // need for reload case - uint32 count = 0; - - // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 QueryResult result = WorldDatabase.Query("SELECT spellId, schoolMask, spellFamilyName, spellFamilyMask0, spellFamilyMask1, spellFamilyMask2, typeMask, spellTypeMask, spellPhaseMask, hitMask, attributesMask, ratePerMinute, chance, cooldown, charges FROM spell_proc"); if (!result) { - sLog->outString(">> Loaded %u spell proc conditions and data", count); + sLog->outString(">> Loaded 0 spell proc conditions and data. DB table `spell_proc` is empty."); sLog->outString(); return; } + uint32 count = 0; do { Field* fields = result->Fetch(); @@ -1833,8 +1815,8 @@ void SpellMgr::LoadSpellProcs() SpellProcEntry baseProcEntry; - baseProcEntry.schoolMask = fields[1].GetUInt32(); - baseProcEntry.spellFamilyName = fields[2].GetUInt32(); + baseProcEntry.schoolMask = fields[1].GetInt8(); + baseProcEntry.spellFamilyName = fields[2].GetUInt16(); baseProcEntry.spellFamilyMask[0] = fields[3].GetUInt32(); baseProcEntry.spellFamilyMask[1] = fields[4].GetUInt32(); baseProcEntry.spellFamilyMask[2] = fields[5].GetUInt32(); @@ -1932,16 +1914,17 @@ void SpellMgr::LoadSpellBonusess() uint32 oldMSTime = getMSTime(); mSpellBonusMap.clear(); // need for reload case - uint32 count = 0; + // 0 1 2 3 4 QueryResult result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus FROM spell_bonus_data"); if (!result) { - sLog->outString(">> Loaded %u spell bonus data", count); + sLog->outString(">> Loaded 0 spell bonus data. DB table `spell_bonus_data` is empty."); sLog->outString(); return; } + uint32 count = 0; do { Field* fields = result->Fetch(); @@ -1973,17 +1956,16 @@ void SpellMgr::LoadSpellThreats() mSpellThreatMap.clear(); // need for reload case - uint32 count = 0; - // 0 1 2 3 QueryResult result = WorldDatabase.Query("SELECT entry, flatMod, pctMod, apPctMod FROM spell_threat"); if (!result) { - sLog->outString(">> Loaded 0 aggro generating spells"); + sLog->outString(">> Loaded 0 aggro generating spells. DB table `spell_threat` is empty."); sLog->outString(); return; } + uint32 count = 0; do { Field* fields = result->Fetch(); @@ -1997,7 +1979,7 @@ void SpellMgr::LoadSpellThreats() } SpellThreatEntry ste; - ste.flatMod = fields[1].GetInt16(); + ste.flatMod = fields[1].GetInt32(); ste.pctMod = fields[2].GetFloat(); ste.apPctMod = fields[3].GetFloat(); @@ -2047,7 +2029,6 @@ void SpellMgr::LoadSpellPetAuras() } uint32 count = 0; - do { Field* fields = result->Fetch(); @@ -2102,11 +2083,10 @@ void SpellMgr::LoadEnchantCustomAttr() uint32 size = sSpellItemEnchantmentStore.GetNumRows(); mEnchantCustomAttr.resize(size); - uint32 count = 0; - for (uint32 i = 0; i < size; ++i) mEnchantCustomAttr[i] = 0; + uint32 count = 0; for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i) { SpellInfo const* spellInfo = GetSpellInfo(i); @@ -2114,7 +2094,7 @@ void SpellMgr::LoadEnchantCustomAttr() continue; // TODO: find a better check - if (!(spellInfo->AttributesEx2 & SPELL_ATTR2_UNK13) || !(spellInfo->Attributes & SPELL_ATTR0_NOT_SHAPESHIFT)) + if (!(spellInfo->AttributesEx2 & SPELL_ATTR2_PRESERVE_ENCHANT_IN_ARENA) || !(spellInfo->Attributes & SPELL_ATTR0_NOT_SHAPESHIFT)) continue; for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j) @@ -2142,17 +2122,16 @@ void SpellMgr::LoadSpellEnchantProcData() mSpellEnchantProcEventMap.clear(); // need for reload case - uint32 count = 0; - // 0 1 2 3 QueryResult result = WorldDatabase.Query("SELECT entry, customChance, PPMChance, procEx FROM spell_enchant_proc_data"); if (!result) { - sLog->outString(">> Loaded %u spell enchant proc event conditions", count); + sLog->outString(">> Loaded 0 spell enchant proc event conditions. DB table `spell_enchant_proc_data` is empty."); sLog->outString(); return; } + uint32 count = 0; do { Field* fields = result->Fetch(); @@ -2197,14 +2176,13 @@ void SpellMgr::LoadSpellLinked() } uint32 count = 0; - do { Field* fields = result->Fetch(); int32 trigger = fields[0].GetInt32(); - int32 effect = fields[1].GetInt32(); - int32 type = fields[2].GetInt32(); + int32 effect = fields[1].GetInt32(); + int32 type = fields[2].GetUInt8(); SpellInfo const* spellInfo = GetSpellInfo(abs(trigger)); if (!spellInfo) @@ -2442,7 +2420,6 @@ void SpellMgr::LoadSpellAreas() } uint32 count = 0; - do { Field* fields = result->Fetch(); @@ -3261,6 +3238,10 @@ void SpellMgr::LoadDbcDataCorrections() spellInfo->EffectDieSides[0] = 0; // was 1, that should probably mean seat 0, but instead it's treated as spell 1 spellInfo->EffectBasePoints[0] = 52391; // Ride Vehicle (forces seat 0) break; + case 64745: // Item - Death Knight T8 Tank 4P Bonus + case 64936: // Item - Warrior T8 Protection 4P Bonus + spellInfo->EffectBasePoints[0] = 100; // 100% chance of procc'ing, not -10% (chance calculated in PrepareTriggersExecutedOnHit) + break; case 19970: // Entangling Roots (Rank 6) -- Nature's Grasp Proc case 19971: // Entangling Roots (Rank 5) -- Nature's Grasp Proc case 19972: // Entangling Roots (Rank 4) -- Nature's Grasp Proc @@ -3317,6 +3298,19 @@ void SpellMgr::LoadDbcDataCorrections() spellInfo->EffectImplicitTargetB[1] = TARGET_UNIT_NEARBY_ENTRY; spellInfo->EffectImplicitTargetB[2] = TARGET_UNIT_NEARBY_ENTRY; break; + case 62301: // Cosmic Smash (Algalon the Observer) + spellInfo->MaxAffectedTargets = 1; + break; + case 64598: // Cosmic Smash (Algalon the Observer) + spellInfo->MaxAffectedTargets = 3; + break; + case 62293: // Cosmic Smash (Algalon the Observer) + spellInfo->EffectImplicitTargetB[0] = TARGET_DEST_CASTER; + break; + case 62311: // Cosmic Smash (Algalon the Observer) + case 64596: // Cosmic Smash (Algalon the Observer) + spellInfo->rangeIndex = 6; // 100yd + break; // ENDOF ULDUAR SPELLS // // TRIAL OF THE CRUSADER SPELLS @@ -3352,13 +3346,22 @@ void SpellMgr::LoadDbcDataCorrections() case 70835: // Bone Storm (Lord Marrowgar) case 70836: // Bone Storm (Lord Marrowgar) case 72864: // Death Plague (Rotting Frost Giant) - case 72378: // Blood Nova (Deathbringer Saurfang) - case 73058: // Blood Nova (Deathbringer Saurfang) case 71160: // Plague Stench (Stinky) case 71161: // Plague Stench (Stinky) case 71123: // Decimate (Stinky & Precious) spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_100_YARDS; // 100yd break; + case 72378: // Blood Nova (Deathbringer Saurfang) + case 73058: // Blood Nova (Deathbringer Saurfang) + spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; + spellInfo->EffectRadiusIndex[1] = EFFECT_RADIUS_200_YARDS; + break; + case 72769: // Scent of Blood (Deathbringer Saurfang) + spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; + // no break + case 72771: // Scent of Blood (Deathbringer Saurfang) + spellInfo->EffectRadiusIndex[1] = EFFECT_RADIUS_200_YARDS; + break; case 72723: // Resistant Skin (Deathbringer Saurfang adds) // this spell initially granted Shadow damage immunity, however it was removed but the data was left in client spellInfo->Effect[2] = 0; @@ -3366,9 +3369,9 @@ void SpellMgr::LoadDbcDataCorrections() case 70460: // Coldflame Jets (Traps after Saurfang) spellInfo->DurationIndex = 1; // 10 seconds break; - case 71413: // Green Ooze Summon (Professor Putricide) - case 71414: // Orange Ooze Summon (Professor Putricide) - spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; + case 71412: // Green Ooze Summon (Professor Putricide) + case 71415: // Orange Ooze Summon (Professor Putricide) + spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ANY; break; case 71159: // Awaken Plagued Zombies spellInfo->DurationIndex = 21; @@ -3429,10 +3432,7 @@ void SpellMgr::LoadDbcDataCorrections() spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_CASTER; break; case 69846: // Frost Bomb - spellInfo->speed = 10; - spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_TARGET_ANY; - spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_TARGET_ANY; - spellInfo->Effect[1] = 0; + spellInfo->speed = 0.0f; // This spell's summon happens instantly break; case 71614: // Ice Lock spellInfo->Mechanic = MECHANIC_STUN; @@ -3528,6 +3528,11 @@ void SpellMgr::LoadDbcDataCorrections() case 40166: // Introspection case 40167: // Introspection spellInfo->Attributes |= SPELL_ATTR0_NEGATIVE_1; + break; + case 2378: // Minor Fortitude + spellInfo->manaCost = 0; + spellInfo->manaPerSecond = 0; + break; default: break; } diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h index 9fffd474651..dcf3c38fe4f 100755 --- a/src/server/game/Spells/SpellMgr.h +++ b/src/server/game/Spells/SpellMgr.h @@ -605,7 +605,7 @@ class SpellMgr // Accessors (const or static functions) public: - // Spell correctess for client using + // Spell correctness for client using static bool IsSpellValid(SpellInfo const* spellInfo, Player* player = NULL, bool msg = true); // Spell difficulty @@ -693,7 +693,6 @@ class SpellMgr public: // Loading data at server startup - void LoadSpellInfos(); void LoadSpellRanks(); void LoadSpellRequired(); void LoadSpellLearnSkills(); diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index 03fea614c0d..e6ce80c20f0 100755 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -320,29 +320,34 @@ SpellInfo const* SpellScript::GetSpellInfo() return m_spell->GetSpellInfo(); } -WorldLocation const* SpellScript::GetTargetDest() +WorldLocation const* SpellScript::GetExplTargetDest() { if (m_spell->m_targets.HasDst()) - return m_spell->m_targets.GetDst(); + return m_spell->m_targets.GetDstPos(); return NULL; } -void SpellScript::SetTargetDest(WorldLocation& loc) +void SpellScript::SetExplTargetDest(WorldLocation& loc) { m_spell->m_targets.SetDst(loc); } -Unit* SpellScript::GetTargetUnit() +WorldObject* SpellScript::GetExplTargetWorldObject() +{ + return m_spell->m_targets.GetObjectTarget(); +} + +Unit* SpellScript::GetExplTargetUnit() { return m_spell->m_targets.GetUnitTarget(); } -GameObject* SpellScript::GetTargetGObj() +GameObject* SpellScript::GetExplTargetGObj() { return m_spell->m_targets.GetGOTarget(); } -Item* SpellScript::GetTargetItem() +Item* SpellScript::GetExplTargetItem() { return m_spell->m_targets.GetItemTarget(); } @@ -403,6 +408,16 @@ GameObject* SpellScript::GetHitGObj() return m_spell->gameObjTarget; } +WorldLocation* SpellScript::GetHitDest() +{ + if (!IsInEffectHook()) + { + sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitGObj was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + return NULL; + } + return m_spell->destTarget; +} + int32 SpellScript::GetHitDamage() { if (!IsInTargetHook()) @@ -468,11 +483,6 @@ void SpellScript::PreventHitAura() m_spell->m_spellAura->Remove(); } -void SpellScript::GetSummonPosition(uint32 i, Position &pos, float radius = 0.0f, uint32 count = 0) -{ - m_spell->GetSummonPosition(i, pos, radius, count); -} - void SpellScript::PreventHitEffect(SpellEffIndex effIndex) { if (!IsInHitPhase() && !IsInEffectHook()) @@ -768,6 +778,7 @@ bool AuraScript::_IsDefaultActionPrevented() case AURA_SCRIPT_HOOK_EFFECT_APPLY: case AURA_SCRIPT_HOOK_EFFECT_REMOVE: case AURA_SCRIPT_HOOK_EFFECT_PERIODIC: + case AURA_SCRIPT_HOOK_EFFECT_ABSORB: return m_defaultActionPrevented; default: ASSERT(false && "AuraScript::_IsDefaultActionPrevented is called in a wrong place"); @@ -782,6 +793,7 @@ void AuraScript::PreventDefaultAction() case AURA_SCRIPT_HOOK_EFFECT_APPLY: case AURA_SCRIPT_HOOK_EFFECT_REMOVE: case AURA_SCRIPT_HOOK_EFFECT_PERIODIC: + case AURA_SCRIPT_HOOK_EFFECT_ABSORB: m_defaultActionPrevented = true; break; default: diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index 1bf8d25adef..7b194b7827f 100755 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -295,25 +295,35 @@ class SpellScript : public _SpellScript SpellInfo const* GetSpellInfo(); SpellValue const* GetSpellValue(); - // methods useable after spell targets are set - // accessors to the "focus" targets of the spell - // note: do not confuse these with spell hit targets + // methods useable after spell is prepared + // accessors to the explicit targets of the spell + // explicit target - target selected by caster (player, game client, or script - DoCast(explicitTarget, ...), required for spell to be cast + // examples: + // -shadowstep - explicit target is the unit you want to go behind of + // -chain heal - explicit target is the unit to be healed first + // -holy nova/arcane explosion - explicit target = NULL because target you are selecting doesn't affect how spell targets are selected + // you can determine if spell requires explicit targets by dbc columns: + // - Targets - mask of explicit target types + // - ImplicitTargetXX set to TARGET_XXX_TARGET_YYY, _TARGET_ here means that explicit target is used by the effect, so spell needs one too + // returns: WorldLocation which was selected as a spell destination or NULL - WorldLocation const* GetTargetDest(); + WorldLocation const* GetExplTargetDest(); - void SetTargetDest(WorldLocation& loc); + void SetExplTargetDest(WorldLocation& loc); - // returns: Unit which was selected as a spell target or NULL - Unit* GetTargetUnit(); + // returns: WorldObject which was selected as an explicit spell target or NULL if there's no target + WorldObject* GetExplTargetWorldObject(); - // returns: GameObject which was selected as a spell target or NULL - GameObject* GetTargetGObj(); + // returns: Unit which was selected as an explicit spell target or NULL if there's no target + Unit* GetExplTargetUnit(); - // returns: Item which was selected as a spell target or NULL - Item* GetTargetItem(); + // returns: GameObject which was selected as an explicit spell target or NULL if there's no target + GameObject* GetExplTargetGObj(); - // methods useable only during spell hit on target, or during spell launch on target: + // returns: Item which was selected as an explicit spell target or NULL if there's no target + Item* GetExplTargetItem(); + // methods useable only during spell hit on target, or during spell launch on target: // returns: target of current effect if it was Unit otherwise NULL Unit* GetHitUnit(); // returns: target of current effect if it was Creature otherwise NULL @@ -324,6 +334,8 @@ class SpellScript : public _SpellScript Item* GetHitItem(); // returns: target of current effect if it was GameObject otherwise NULL GameObject* GetHitGObj(); + // returns: destination of current effect + WorldLocation* GetHitDest(); // setter/getter for for damage done by spell to target of spell hit // returns damage calculated before hit, and real dmg done after hit int32 GetHitDamage(); @@ -335,7 +347,6 @@ class SpellScript : public _SpellScript void SetHitHeal(int32 heal); void PreventHitHeal() { SetHitHeal(0); } Spell* GetSpell() { return m_spell; } - void GetSummonPosition(uint32 i, Position &pos, float radius, uint32 count); // returns current spell hit target aura Aura* GetHitAura(); // prevents applying aura on current spell hit target diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp index e5a12693aa7..2f79eaff06a 100755 --- a/src/server/game/Texts/CreatureTextMgr.cpp +++ b/src/server/game/Texts/CreatureTextMgr.cpp @@ -17,8 +17,53 @@ #include "Common.h" #include "DatabaseEnv.h" -#include "CreatureTextMgr.h" #include "ObjectMgr.h" +#include "Cell.h" +#include "CellImpl.h" +#include "GridNotifiers.h" +#include "GridNotifiersImpl.h" +#include "CreatureTextMgr.h" + +class CreatureTextBuilder +{ + public: + CreatureTextBuilder(WorldObject* obj, ChatMsg msgtype, uint8 textGroup, uint32 id, uint32 language, uint64 targetGUID) + : _source(obj), _msgType(msgtype), _textGroup(textGroup), _textId(id), _language(language), _targetGUID(targetGUID) + { + } + + size_t operator()(WorldPacket* data, LocaleConstant locale) const + { + std::string text = sCreatureTextMgr->GetLocalizedChatString(_source->GetEntry(), _textGroup, _textId, locale); + char const* localizedName = _source->GetNameForLocaleIdx(locale); + + *data << uint8(_msgType); + *data << uint32(_language); + *data << uint64(_source->GetGUID()); + *data << uint32(1); // 2.1.0 + *data << uint32(strlen(localizedName)+1); + *data << localizedName; + size_t whisperGUIDpos = data->wpos(); + *data << uint64(_targetGUID); // Unit Target + if (_targetGUID && !IS_PLAYER_GUID(_targetGUID)) + { + *data << uint32(1); // target name length + *data << uint8(0); // target name + } + *data << uint32(text.length() + 1); + *data << text; + *data << uint8(0); // ChatTag + + return whisperGUIDpos; + } + + WorldObject* _source; + ChatMsg _msgType; + uint8 _textGroup; + uint32 _textId; + uint32 _language; + uint64 _targetGUID; +}; void CreatureTextMgr::LoadCreatureTexts() { @@ -83,17 +128,8 @@ void CreatureTextMgr::LoadCreatureTexts() } //entry not yet added, add empty TextHolder (list of groups) if (mTextMap.find(temp.entry) == mTextMap.end()) - { ++creatureCount; - CreatureTextHolder TextHolder; - mTextMap[temp.entry] = TextHolder; - } - //group not yet added, add empty TextGroup (list of texts) - if (mTextMap[temp.entry].find(temp.group) == mTextMap[temp.entry].end()) - { - CreatureTextGroup TextGroup; - mTextMap[temp.entry][temp.group] = TextGroup; - } + //add the text into our entry's group mTextMap[temp.entry][temp.group].push_back(temp); @@ -104,42 +140,76 @@ void CreatureTextMgr::LoadCreatureTexts() sLog->outString(); } +void CreatureTextMgr::LoadCreatureTextLocales() +{ + uint32 oldMSTime = getMSTime(); + + mLocaleTextMap.clear(); // for reload case + + QueryResult result = WorldDatabase.Query("SELECT entry, textGroup, id, text_loc1, text_loc2, text_loc3, text_loc4, text_loc5, text_loc6, text_loc7, text_loc8 FROM locales_creature_text"); + + if (!result) + return; + + uint32 textCount = 0; + + do + { + Field* fields = result->Fetch(); + CreatureTextLocale& loc = mLocaleTextMap[CreatureTextId(fields[0].GetUInt32(), uint32(fields[1].GetUInt8()), fields[2].GetUInt32())]; + for (uint8 i = 1; i < TOTAL_LOCALES; ++i) + { + LocaleConstant locale = LocaleConstant(i); + ObjectMgr::AddLocaleString(fields[3 + i - 1].GetString(), locale, loc.Text); + } + + ++textCount; + } while (result->NextRow()); + + sLog->outString(">> Loaded %u creature localized texts in %u ms", textCount, GetMSTimeDiffToNow(oldMSTime)); + sLog->outString(); +} + uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, uint64 whisperGuid /*= 0*/, ChatMsg msgType /*= CHAT_MSG_ADDON*/, Language language /*= LANG_ADDON*/, TextRange range /*= TEXT_RANGE_NORMAL*/, uint32 sound /*= 0*/, Team team /*= TEAM_OTHER*/, bool gmOnly /*= false*/, Player* srcPlr /*= NULL*/) { if (!source) return 0; + CreatureTextMap::const_iterator sList = mTextMap.find(source->GetEntry()); if (sList == mTextMap.end()) { sLog->outErrorDb("CreatureTextMgr: Could not find Text for Creature(%s) Entry %u in 'creature_text' table. Ignoring.", source->GetName(), source->GetEntry()); return 0; } - CreatureTextHolder TextHolder = (*sList).second; - CreatureTextHolder::const_iterator itr = TextHolder.find(textGroup); - if (itr == TextHolder.end()) + + CreatureTextHolder const& textHolder = sList->second; + CreatureTextHolder::const_iterator itr = textHolder.find(textGroup); + if (itr == textHolder.end()) { sLog->outErrorDb("CreatureTextMgr: Could not find TextGroup %u for Creature(%s) GuidLow %u Entry %u. Ignoring.", uint32(textGroup), source->GetName(), source->GetGUIDLow(), source->GetEntry()); return 0; } - CreatureTextGroup TextGroup = (*itr).second;//has all texts in the group + + CreatureTextGroup const& textGroupContainer = itr->second; //has all texts in the group CreatureTextRepeatIds repeatGroup = GetRepeatGroup(source, textGroup);//has all textIDs from the group that were already said CreatureTextGroup tempGroup;//will use this to talk after sorting repeatGroup - for (CreatureTextGroup::const_iterator giter = TextGroup.begin(); giter != TextGroup.end(); ++giter) - { - if (std::find(repeatGroup.begin(), repeatGroup.end(), (*giter).id) == repeatGroup.end()) - tempGroup.push_back((*giter)); - } + for (CreatureTextGroup::const_iterator giter = textGroupContainer.begin(); giter != textGroupContainer.end(); ++giter) + if (std::find(repeatGroup.begin(), repeatGroup.end(), giter->id) == repeatGroup.end()) + tempGroup.push_back(*giter); + if (tempGroup.empty()) { CreatureTextRepeatMap::iterator mapItr = mTextRepeatMap.find(source->GetGUID()); if (mapItr != mTextRepeatMap.end()) { - CreatureTextRepeatGroup::iterator groupItr = (*mapItr).second.find(textGroup); - (*groupItr).second.clear(); + CreatureTextRepeatGroup::iterator groupItr = mapItr->second.find(textGroup); + groupItr->second.clear(); } - tempGroup = TextGroup; + + tempGroup = textGroupContainer; } + uint8 count = 0; float lastChance = -1; bool isEqualChanced = true; @@ -148,173 +218,92 @@ uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, uint64 whisp for (CreatureTextGroup::const_iterator iter = tempGroup.begin(); iter != tempGroup.end(); ++iter) { - if (lastChance >= 0 && lastChance != (*iter).probability) + if (lastChance >= 0 && lastChance != iter->probability) isEqualChanced = false; - lastChance = (*iter).probability; - totalChance += (*iter).probability; - count++; + lastChance = iter->probability; + totalChance += iter->probability; + ++count; } + int32 offset = -1; if (!isEqualChanced) { for (CreatureTextGroup::const_iterator iter = tempGroup.begin(); iter != tempGroup.end(); ++iter) { - uint32 chance = uint32((*iter).probability); + uint32 chance = uint32(iter->probability); uint32 r = urand(0, 100); - offset++; + ++offset; if (r <= chance) break; } } + uint32 pos = 0; if (isEqualChanced || offset < 0) pos = urand(0, count - 1); else if (offset >= 0) pos = offset; + CreatureTextGroup::const_iterator iter = tempGroup.begin() + pos; - ChatMsg finalType = (msgType == CHAT_MSG_ADDON) ? (*iter).type : msgType; - Language finalLang = (language == LANG_ADDON) ? (*iter).lang : language; - uint32 finalSound = sound ? sound : (*iter).sound; + ChatMsg finalType = (msgType == CHAT_MSG_ADDON) ? iter->type : msgType; + Language finalLang = (language == LANG_ADDON) ? iter->lang : language; + uint32 finalSound = sound ? sound : iter->sound; if (finalSound) SendSound(source, finalSound, finalType, whisperGuid, range, team, gmOnly); - if ((*iter).emote) - SendEmote(srcPlr ? srcPlr->ToUnit() : source, (*iter).emote); - - SendChatString(srcPlr ? srcPlr->ToUnit() : source, (*iter).text.c_str(), finalType, finalLang, whisperGuid, range, team, gmOnly); - if (isEqualChanced || (!isEqualChanced && totalChance == 100.0f)) - SetRepeatId(source, textGroup, (*iter).id); - - return (*iter).duration; -} - -void CreatureTextMgr::SendSound(Creature* source, uint32 sound, ChatMsg msgType, uint64 whisperGuid, TextRange range, Team team, bool gmOnly) -{ - if (!sound || !source) - return; - WorldPacket data(SMSG_PLAY_SOUND, 4); - data << uint32(sound); - SendChatPacket(&data, source, msgType, whisperGuid, range, team, gmOnly); -} - -void CreatureTextMgr::SendEmote(Unit* source, uint32 emote) -{ - if (!source) return; - source->HandleEmoteCommand(emote); -} - -void CreatureTextMgr::SetRepeatId(Creature* source, uint8 textGroup, uint8 id) -{ - if (!source) - return; - - if (mTextRepeatMap.find(source->GetGUID()) == mTextRepeatMap.end()) - { - CreatureTextRepeatGroup TextGroup; - mTextRepeatMap[source->GetGUID()] = TextGroup; - } - if (mTextRepeatMap[source->GetGUID()].find(textGroup) == mTextRepeatMap[source->GetGUID()].end()) - { - CreatureTextRepeatIds ids; - mTextRepeatMap[source->GetGUID()][textGroup] = ids; - } - if (std::find(mTextRepeatMap[source->GetGUID()][textGroup].begin(), mTextRepeatMap[source->GetGUID()][textGroup].end(), id) == mTextRepeatMap[source->GetGUID()][textGroup].end()) - { - mTextRepeatMap[source->GetGUID()][textGroup].push_back(id); - } - else - sLog->outErrorDb("CreatureTextMgr: TextGroup %u for Creature(%s) GuidLow %u Entry %u, id %u already added", uint32(textGroup), source->GetName(), source->GetGUIDLow(), source->GetEntry(), uint32(id)); -} - -CreatureTextRepeatIds CreatureTextMgr::GetRepeatGroup(Creature* source, uint8 textGroup) -{ - ASSERT(source);//should never happen - CreatureTextRepeatIds ids; + Unit* finalSource = source; + if (srcPlr) + finalSource = srcPlr; - CreatureTextRepeatMap::const_iterator mapItr = mTextRepeatMap.find(source->GetGUID()); - if (mapItr != mTextRepeatMap.end()) - { - CreatureTextRepeatGroup::const_iterator groupItr = (*mapItr).second.find(textGroup); - if (groupItr != (*mapItr).second.end()) - { - ids = (*groupItr).second; - } - } - return ids; -} + if (iter->emote) + SendEmote(finalSource, iter->emote); -void CreatureTextMgr::SendChatString(WorldObject* source, char const* text, ChatMsg msgtype /*= CHAT_MSG_MONSTER_SAY*/, Language language /*= LANG_UNIVERSAL*/, uint64 whisperGuid /*= 0*/, TextRange range /*= TEXT_RANGE_NORMAL*/, Team team /*= TEAM_OTHER*/, bool gmOnly /*= false*/) const -{ - if (!source) - return; + CreatureTextBuilder builder(finalSource, finalType, iter->group, iter->id, finalLang, whisperGuid); + SendChatPacket(finalSource, builder, finalType, whisperGuid, range, team, gmOnly); + if (isEqualChanced || (!isEqualChanced && totalChance == 100.0f)) + SetRepeatId(source, textGroup, iter->id); - WorldPacket data(SMSG_MESSAGECHAT, 200); - BuildMonsterChat(&data, source, msgtype, text, language, whisperGuid);//build our packet - SendChatPacket(&data, source, msgtype, whisperGuid, range, team, gmOnly);//send our packet + return iter->duration; } -void CreatureTextMgr::BuildMonsterChat(WorldPacket* data, WorldObject* source, ChatMsg msgType, char const* text, Language language, uint64 whisperGuid) const +float CreatureTextMgr::GetRangeForChatType(ChatMsg msgType) const { - if (!source) - return; - + float dist = sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY); switch (msgType) { - case CHAT_MSG_MONSTER_WHISPER: - if (!whisperGuid) - { - sLog->outError("CreatureTextMgr: WorldObject(%s) TypeId %u GuidLow %u sent CHAT_TYPE_WHISPER with targetGuid 0. Ignoring.", source->GetName(), uint32(source->GetTypeId()), source->GetGUIDLow()); - return; - } + case CHAT_MSG_MONSTER_YELL: + dist = sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL); break; - case CHAT_MSG_RAID_BOSS_WHISPER: - if (!whisperGuid) - { - sLog->outError("CreatureTextMgr: WorldObject(%s) TypeId %u GuidLow %u sent CHAT_TYPE_BOSS_WHISPER with targetGuid 0. Ignoring.", source->GetName(), uint32(source->GetTypeId()), source->GetGUIDLow()); - return; - } + case CHAT_MSG_MONSTER_EMOTE: + case CHAT_MSG_RAID_BOSS_EMOTE: + dist = sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE); break; default: break; } - *data << uint8(msgType); - *data << uint32(language); - *data << uint64(source->GetGUID()); - *data << uint32(0); // 2.1.0 - *data << uint32(strlen(source->GetName()) + 1); - *data << source->GetName(); - *data << uint64(whisperGuid); // Unit Target - if (whisperGuid && !IS_PLAYER_GUID(whisperGuid)) //can only whisper players - { - sLog->outError("CreatureTextMgr: WorldObject(%s) TypeId %u GuidLow %u sent WHISPER msg to Non-Player target. Ignoring.", source->GetName(), uint32(source->GetTypeId()), source->GetGUIDLow()); - return; - // *data << (uint32)1; // target name length - // *data << (uint8)0; // target name - } - *data << uint32(strlen(text) + 1); - *data << text; - *data << uint8(0); // ChatTag + + return dist; } -void CreatureTextMgr::SendChatPacket(WorldPacket* data, WorldObject* source, ChatMsg msgType, uint64 whisperGuid, TextRange range, Team team, bool gmOnly) const +void CreatureTextMgr::SendSound(Creature* source, uint32 sound, ChatMsg msgType, uint64 whisperGuid, TextRange range, Team team, bool gmOnly) { - if (!source) + if (!sound || !source) return; - float dist = sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY); + WorldPacket data(SMSG_PLAY_SOUND, 4); + data << uint32(sound); + SendNonChatPacket(source, &data, msgType, whisperGuid, range, team, gmOnly); +} + +void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket* data, ChatMsg msgType, uint64 whisperGuid, TextRange range, Team team, bool gmOnly) const +{ + float dist = GetRangeForChatType(msgType); switch (msgType) { - case CHAT_MSG_MONSTER_YELL: - dist = sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL); - break; - case CHAT_MSG_MONSTER_EMOTE: - case CHAT_MSG_RAID_BOSS_EMOTE: - dist = sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE); - break; case CHAT_MSG_MONSTER_WHISPER: case CHAT_MSG_RAID_BOSS_WHISPER: { @@ -337,83 +326,134 @@ void CreatureTextMgr::SendChatPacket(WorldPacket* data, WorldObject* source, Cha case TEXT_RANGE_AREA: { uint32 areaId = source->GetAreaId(); - Map::PlayerList const& pList = source->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) - { + Map::PlayerList const& players = source->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) if (itr->getSource()->GetAreaId() == areaId && (!team || Team(itr->getSource()->GetTeam()) == team) && (!gmOnly || itr->getSource()->isGameMaster())) - { - if (data->GetOpcode() == SMSG_MESSAGECHAT)//override whisperguid with actual player's guid - data->put<uint64>(1+4+8+4+4+(int32)(strlen(source->GetName())+1), uint64(itr->getSource()->GetGUID())); - (itr->getSource())->GetSession()->SendPacket(data); - } - } + itr->getSource()->GetSession()->SendPacket(data); return; } case TEXT_RANGE_ZONE: { uint32 zoneId = source->GetZoneId(); - Map::PlayerList const& pList = source->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) - { + Map::PlayerList const& players = source->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) if (itr->getSource()->GetZoneId() == zoneId && (!team || Team(itr->getSource()->GetTeam()) == team) && (!gmOnly || itr->getSource()->isGameMaster())) - { - if (data->GetOpcode() == SMSG_MESSAGECHAT)//override whisperguid with actual player's guid - data->put<uint64>(1+4+8+4+4+(int32)(strlen(source->GetName())+1), uint64(itr->getSource()->GetGUID())); - (itr->getSource())->GetSession()->SendPacket(data); - } - } + itr->getSource()->GetSession()->SendPacket(data); return; } case TEXT_RANGE_MAP: { - Map::PlayerList const& pList = source->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) - { - if (data->GetOpcode() == SMSG_MESSAGECHAT)//override whisperguid with actual player's guid - data->put<uint64>(1+4+8+4+4+(int32)(strlen(source->GetName())+1), uint64(itr->getSource()->GetGUID())); + Map::PlayerList const& players = source->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) if ((!team || Team(itr->getSource()->GetTeam()) == team) && (!gmOnly || itr->getSource()->isGameMaster())) - (itr->getSource())->GetSession()->SendPacket(data); - } + itr->getSource()->GetSession()->SendPacket(data); return; } case TEXT_RANGE_WORLD: { - const SessionMap smap = sWorld->GetAllSessions(); + SessionMap const& smap = sWorld->GetAllSessions(); for (SessionMap::const_iterator iter = smap.begin(); iter != smap.end(); ++iter) - { - if (Player* player = (*iter).second->GetPlayer()) - { - if (data->GetOpcode() == SMSG_MESSAGECHAT)//override whisperguid with actual player's guid - data->put<uint64>(1+4+8+4+4+(int32)(strlen(source->GetName())+1), uint64(player->GetGUID())); + if (Player* player = iter->second->GetPlayer()) if (player->GetSession() && (!team || Team(player->GetTeam()) == team) && (!gmOnly || player->isGameMaster())) player->GetSession()->SendPacket(data); - } - } return; } case TEXT_RANGE_NORMAL: default: break; } + source->SendMessageToSetInRange(data, dist, true); } +void CreatureTextMgr::SendEmote(Unit* source, uint32 emote) +{ + if (!source) + return; + + source->HandleEmoteCommand(emote); +} + +void CreatureTextMgr::SetRepeatId(Creature* source, uint8 textGroup, uint8 id) +{ + if (!source) + return; + + CreatureTextRepeatIds& repeats = mTextRepeatMap[source->GetGUID()][textGroup]; + if (std::find(repeats.begin(), repeats.end(), id) == repeats.end()) + repeats.push_back(id); + else + sLog->outErrorDb("CreatureTextMgr: TextGroup %u for Creature(%s) GuidLow %u Entry %u, id %u already added", uint32(textGroup), source->GetName(), source->GetGUIDLow(), source->GetEntry(), uint32(id)); +} + +CreatureTextRepeatIds CreatureTextMgr::GetRepeatGroup(Creature* source, uint8 textGroup) +{ + ASSERT(source);//should never happen + CreatureTextRepeatIds ids; + + CreatureTextRepeatMap::const_iterator mapItr = mTextRepeatMap.find(source->GetGUID()); + if (mapItr != mTextRepeatMap.end()) + { + CreatureTextRepeatGroup::const_iterator groupItr = (*mapItr).second.find(textGroup); + if (groupItr != mapItr->second.end()) + ids = groupItr->second; + } + return ids; +} + bool CreatureTextMgr::TextExist(uint32 sourceEntry, uint8 textGroup) { if (!sourceEntry) return false; + CreatureTextMap::const_iterator sList = mTextMap.find(sourceEntry); if (sList == mTextMap.end()) { sLog->outDebug(LOG_FILTER_UNITS, "CreatureTextMgr::TextExist: Could not find Text for Creature (entry %u) in 'creature_text' table.", sourceEntry); return false; } - CreatureTextHolder TextHolder = (*sList).second; - CreatureTextHolder::const_iterator itr = TextHolder.find(textGroup); - if (itr == TextHolder.end()) + + CreatureTextHolder const& textHolder = sList->second; + CreatureTextHolder::const_iterator itr = textHolder.find(textGroup); + if (itr == textHolder.end()) { sLog->outDebug(LOG_FILTER_UNITS, "CreatureTextMgr::TextExist: Could not find TextGroup %u for Creature (entry %u).", uint32(textGroup), sourceEntry); return false; } + return true; } + +std::string CreatureTextMgr::GetLocalizedChatString(uint32 entry, uint8 textGroup, uint32 id, LocaleConstant locale) const +{ + CreatureTextMap::const_iterator mapitr = mTextMap.find(entry); + if (mapitr == mTextMap.end()) + return ""; + + CreatureTextHolder::const_iterator holderItr = mapitr->second.find(textGroup); + if (holderItr == mapitr->second.end()) + return ""; + + CreatureTextGroup::const_iterator groupItr = holderItr->second.begin(); + for (; groupItr != holderItr->second.end(); ++groupItr) + if (groupItr->id == id) + break; + + if (groupItr == holderItr->second.end()) + return ""; + + std::string baseText = groupItr->text; + if (locale == DEFAULT_LOCALE) + return baseText; + + if (locale > MAX_LOCALES) + return baseText; + + LocaleCreatureTextMap::const_iterator locItr = mLocaleTextMap.find(CreatureTextId(entry, uint32(textGroup), id)); + if (locItr == mLocaleTextMap.end()) + return baseText; + + ObjectMgr::GetLocaleString(locItr->second.Text, locale, baseText); + + return baseText; +} diff --git a/src/server/game/Texts/CreatureTextMgr.h b/src/server/game/Texts/CreatureTextMgr.h index 0c80e2d568f..8ed0b01fcd5 100755 --- a/src/server/game/Texts/CreatureTextMgr.h +++ b/src/server/game/Texts/CreatureTextMgr.h @@ -19,6 +19,8 @@ #define TRINITY_CREATURE_TEXT_MGR_H #include "Creature.h" +#include "GridNotifiers.h" +#include "ObjectAccessor.h" #include "SharedDefines.h" struct CreatureTextEntry @@ -44,10 +46,33 @@ enum TextRange TEXT_RANGE_WORLD = 4 }; +struct CreatureTextLocale +{ + StringVector Text; +}; + +struct CreatureTextId +{ + CreatureTextId(uint32 e, uint32 g, uint32 i) : entry(e), textGroup(g), textId(i) + { + } + + bool operator<(CreatureTextId const& right) const + { + return memcmp(this, &right, sizeof(CreatureTextId)) < 0; + } + + uint32 entry; + uint32 textGroup; + uint32 textId; +}; + typedef std::vector<CreatureTextEntry> CreatureTextGroup; //texts in a group typedef UNORDERED_MAP<uint8, CreatureTextGroup> CreatureTextHolder; //groups for a creature by groupid typedef UNORDERED_MAP<uint32, CreatureTextHolder> CreatureTextMap; //all creatures by entry +typedef std::map<CreatureTextId, CreatureTextLocale> LocaleCreatureTextMap; + //used for handling non-repeatable random texts typedef std::vector<uint8> CreatureTextRepeatIds; typedef UNORDERED_MAP<uint8, CreatureTextRepeatIds> CreatureTextRepeatGroup; @@ -57,9 +82,11 @@ class CreatureTextMgr { friend class ACE_Singleton<CreatureTextMgr, ACE_Null_Mutex>; CreatureTextMgr() {}; + public: ~CreatureTextMgr() {}; void LoadCreatureTexts(); + void LoadCreatureTextLocales(); CreatureTextMap const& GetTextMap() const { return mTextMap; } void SendSound(Creature* source, uint32 sound, ChatMsg msgType, uint64 whisperGuid, TextRange range, Team team, bool gmOnly); @@ -67,17 +94,156 @@ class CreatureTextMgr //if sent, returns the 'duration' of the text else 0 if error uint32 SendChat(Creature* source, uint8 textGroup, uint64 whisperGuid = 0, ChatMsg msgType = CHAT_MSG_ADDON, Language language = LANG_ADDON, TextRange range = TEXT_RANGE_NORMAL, uint32 sound = 0, Team team = TEAM_OTHER, bool gmOnly = false, Player* srcPlr = NULL); - void SendChatString(WorldObject* source, char const* text, ChatMsg msgtype = CHAT_MSG_MONSTER_SAY, Language language = LANG_UNIVERSAL, uint64 whisperGuid = 0, TextRange range = TEXT_RANGE_NORMAL, Team team = TEAM_OTHER, bool gmOnly = false) const; bool TextExist(uint32 sourceEntry, uint8 textGroup); + std::string GetLocalizedChatString(uint32 entry, uint8 textGroup, uint32 id, LocaleConstant locale) const; + + template<class Builder> + void SendChatPacket(WorldObject* source, Builder const& builder, ChatMsg msgType, uint64 whisperGuid = 0, TextRange range = TEXT_RANGE_NORMAL, Team team = TEAM_OTHER, bool gmOnly = false) const; private: CreatureTextRepeatIds GetRepeatGroup(Creature* source, uint8 textGroup); void SetRepeatId(Creature* source, uint8 textGroup, uint8 id); - void BuildMonsterChat(WorldPacket* data, WorldObject* source, ChatMsg msgType, char const* text, Language language, uint64 whisperGuid) const; - void SendChatPacket(WorldPacket* data, WorldObject* source, ChatMsg msgType, uint64 whisperGuid, TextRange range, Team team, bool gmOnly) const; + + void SendNonChatPacket(WorldObject* source, WorldPacket* data, ChatMsg msgType, uint64 whisperGuid, TextRange range, Team team, bool gmOnly) const; + float GetRangeForChatType(ChatMsg msgType) const; CreatureTextMap mTextMap; CreatureTextRepeatMap mTextRepeatMap; + LocaleCreatureTextMap mLocaleTextMap; }; #define sCreatureTextMgr ACE_Singleton<CreatureTextMgr, ACE_Null_Mutex>::instance() + +template<class Builder> +class CreatureTextLocalizer +{ + public: + CreatureTextLocalizer(Builder const& builder, ChatMsg msgType) : _builder(builder), _msgType(msgType) + { + _packetCache.resize(TOTAL_LOCALES, NULL); + } + + ~CreatureTextLocalizer() + { + for (size_t i = 0; i < _packetCache.size(); ++i) + { + if (_packetCache[i]) + delete _packetCache[i]->first; + delete _packetCache[i]; + } + } + + void operator()(Player* player) + { + LocaleConstant loc_idx = player->GetSession()->GetSessionDbLocaleIndex(); + WorldPacket* messageTemplate; + size_t whisperGUIDpos; + + // create if not cached yet + if (!_packetCache[loc_idx]) + { + messageTemplate = new WorldPacket(SMSG_MESSAGECHAT, 200); + whisperGUIDpos = _builder(messageTemplate, loc_idx); + _packetCache[loc_idx] = new std::pair<WorldPacket*, size_t>(messageTemplate, whisperGUIDpos); + } + else + { + messageTemplate = _packetCache[loc_idx]->first; + whisperGUIDpos = _packetCache[loc_idx]->second; + } + + WorldPacket data(*messageTemplate); + switch (_msgType) + { + case CHAT_MSG_MONSTER_WHISPER: + case CHAT_MSG_RAID_BOSS_WHISPER: + data.put<uint64>(whisperGUIDpos, player->GetGUID()); + break; + default: + break; + } + + player->SendDirectMessage(&data); + } + + private: + std::vector<std::pair<WorldPacket*, size_t>* > _packetCache; + Builder const& _builder; + ChatMsg _msgType; +}; + +template<class Builder> +void CreatureTextMgr::SendChatPacket(WorldObject* source, Builder const& builder, ChatMsg msgType, uint64 whisperGuid, TextRange range, Team team, bool gmOnly) const +{ + if (!source) + return; + + CreatureTextLocalizer<Builder> localizer(builder, msgType); + + switch (msgType) + { + case CHAT_MSG_MONSTER_WHISPER: + case CHAT_MSG_RAID_BOSS_WHISPER: + { + if (range == TEXT_RANGE_NORMAL) //ignores team and gmOnly + { + Player* player = ObjectAccessor::FindPlayer(whisperGuid); + if (!player || !player->GetSession()) + return; + + localizer(player); + return; + } + break; + } + default: + break; + } + + switch (range) + { + case TEXT_RANGE_AREA: + { + uint32 areaId = source->GetAreaId(); + Map::PlayerList const& players = source->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + if (itr->getSource()->GetAreaId() == areaId && (!team || Team(itr->getSource()->GetTeam()) == team) && (!gmOnly || itr->getSource()->isGameMaster())) + localizer(itr->getSource()); + return; + } + case TEXT_RANGE_ZONE: + { + uint32 zoneId = source->GetZoneId(); + Map::PlayerList const& players = source->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + if (itr->getSource()->GetZoneId() == zoneId && (!team || Team(itr->getSource()->GetTeam()) == team) && (!gmOnly || itr->getSource()->isGameMaster())) + localizer(itr->getSource()); + return; + } + case TEXT_RANGE_MAP: + { + Map::PlayerList const& players = source->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + if ((!team || Team(itr->getSource()->GetTeam()) == team) && (!gmOnly || itr->getSource()->isGameMaster())) + localizer(itr->getSource()); + return; + } + case TEXT_RANGE_WORLD: + { + SessionMap const& smap = sWorld->GetAllSessions(); + for (SessionMap::const_iterator iter = smap.begin(); iter != smap.end(); ++iter) + if (Player* player = iter->second->GetPlayer()) + if (player->GetSession() && (!team || Team(player->GetTeam()) == team) && (!gmOnly || player->isGameMaster())) + localizer(player); + return; + } + case TEXT_RANGE_NORMAL: + default: + break; + } + + float dist = GetRangeForChatType(msgType); + Trinity::PlayerDistWorker<CreatureTextLocalizer<Builder> > worker(source, dist, localizer); + source->VisitNearbyWorldObject(dist, worker); +} + #endif diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp index fe8a8c64607..0ed437461d5 100755 --- a/src/server/game/Tickets/TicketMgr.cpp +++ b/src/server/game/Tickets/TicketMgr.cpp @@ -38,24 +38,38 @@ GmTicket::GmTicket(Player* player, WorldPacket& recv_data) : _createTime(time(NU _playerGuid = player->GetGUID(); uint32 mapId; - recv_data >> mapId; + recv_data >> mapId; // Map is sent as UInt32! _mapId = mapId; recv_data >> _posX; recv_data >> _posY; recv_data >> _posZ; recv_data >> _message; - - uint32 unk1; - recv_data >> unk1; // not sure what this is... replyTo? - uint8 needResponse; - recv_data >> needResponse; // always 1/0 -- not sure what retail does with this + uint32 needResponse; + recv_data >> needResponse; + _needResponse = (needResponse == 17); // Requires GM response. 17 = true, 1 = false (17 is default) + uint8 unk1; + recv_data >> unk1; // Requests further GM interaction on a ticket to which a GM has already responded + + recv_data.rfinish(); + /* + recv_data >> uint32(count); // text lines + for (int i = 0; i < count; i++) + recv_data >> uint32(); + + if (something) + recv_data >> uint32(); + else + compressed uint32 + string; + */ } GmTicket::~GmTicket() { } bool GmTicket::LoadFromDB(Field* fields) { + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + // ticketId, guid, name, message, createTime, mapId, posX, posY, posZ, lastModifiedTime, closedBy, assignedTo, comment, completed, escalated, viewed uint8 index = 0; _id = fields[ index].GetUInt32(); _playerGuid = MAKE_NEW_GUID(fields[++index].GetUInt32(), 0, HIGHGUID_PLAYER); @@ -78,6 +92,8 @@ bool GmTicket::LoadFromDB(Field* fields) void GmTicket::SaveToDB(SQLTransaction& trans) const { + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + // ticketId, guid, name, message, createTime, mapId, posX, posY, posZ, lastModifiedTime, closedBy, assignedTo, comment, completed, escalated, viewed uint8 index = 0; PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_GM_TICKET); stmt->setUInt32( index, _id); @@ -125,8 +141,8 @@ void GmTicket::WritePacket(WorldPacket& data) const void GmTicket::SendResponse(WorldSession* session) const { WorldPacket data(SMSG_GMRESPONSE_RECEIVED); - data << uint32(1); // unk? Zor says "hasActiveTicket" - data << uint32(0); // can-edit - always 1 or 0, not flags + data << uint32(1); // responseID + data << uint32(_id); // ticketID data << _message.c_str(); data << _response.c_str(); session->SendPacket(&data); @@ -187,13 +203,19 @@ void GmTicket::SetUnassigned() void GmTicket::TeleportTo(Player* player) const { - player->TeleportTo(_mapId, _posX, _posY, _posZ, 1, 0); + player->TeleportTo(_mapId, _posX, _posY, _posZ, 0.0f, 0); } /////////////////////////////////////////////////////////////////////////////////////////////////// // Ticket manager TicketMgr::TicketMgr() : _status(true), _lastTicketId(0), _lastSurveyId(0), _openTicketCount(0), _lastChange(time(NULL)) { } +TicketMgr::~TicketMgr() +{ + for (GmTicketList::const_iterator itr = _ticketList.begin(); itr != _ticketList.end(); ++itr) + delete itr->second; +} + void TicketMgr::Initialize() { SetStatus(sWorld->getBoolConfig(CONFIG_ALLOW_TICKETS)); } void TicketMgr::ResetTickets() @@ -213,10 +235,8 @@ void TicketMgr::LoadTickets() { uint32 oldMSTime = getMSTime(); - if (!_ticketList.empty()) - for (GmTicketList::const_iterator itr = _ticketList.begin(); itr != _ticketList.end(); ++itr) - if (itr->second) - delete itr->second; + for (GmTicketList::const_iterator itr = _ticketList.begin(); itr != _ticketList.end(); ++itr) + delete itr->second; _ticketList.clear(); _lastTicketId = 0; @@ -297,6 +317,7 @@ void TicketMgr::RemoveTicket(uint32 ticketId) { ticket->DeleteFromDB(); _ticketList.erase(ticketId); + delete ticket; } } @@ -336,13 +357,13 @@ void TicketMgr::SendTicket(WorldSession* session, GmTicket* ticket) const } WorldPacket data(SMSG_GMTICKET_GETTICKET, (4 + 4 + (ticket ? message.length() + 1 + 4 + 4 + 4 + 1 + 1 : 0))); - data << uint32(status); // standard 0x0A, 0x06 if text present - data << uint32(1); // g_HasActiveGMTicket -- not a flag + data << uint32(status); // standard 0x0A, 0x06 if text present + data << uint32(ticket ? ticket->GetId() : 0); // ticketID if (ticket) { - data << message.c_str(); // ticket text - data << uint8(0x7); // ticket category; why is this hardcoded? does it make a diff re: client? + data << message.c_str(); // ticket text + data << uint8(0x7); // ticket category; why is this hardcoded? does it make a diff re: client? // we've got the easy stuff done by now. // Now we need to go through the client logic for displaying various levels of ticket load diff --git a/src/server/game/Tickets/TicketMgr.h b/src/server/game/Tickets/TicketMgr.h index cb0a1bab22b..be8b4063d84 100755 --- a/src/server/game/Tickets/TicketMgr.h +++ b/src/server/game/Tickets/TicketMgr.h @@ -40,8 +40,11 @@ enum GMTicketStatus enum GMTicketResponse { - GMTICKET_RESPONSE_FAILURE = 1, - GMTICKET_RESPONSE_SUCCESS = 2, + GMTICKET_RESPONSE_ALREADY_EXIST = 1, + GMTICKET_RESPONSE_CREATE_SUCCESS = 2, + GMTICKET_RESPONSE_CREATE_ERROR = 3, + GMTICKET_RESPONSE_UPDATE_SUCCESS = 4, + GMTICKET_RESPONSE_UPDATE_ERROR = 5, GMTICKET_RESPONSE_TICKET_DELETED = 9, }; @@ -156,6 +159,7 @@ private: bool _completed; GMTicketEscalationStatus _escalatedStatus; bool _viewed; + bool _needResponse; // TODO: find out the use of this, and then store it in DB std::string _response; }; typedef std::map<uint32, GmTicket*> GmTicketList; @@ -166,6 +170,7 @@ class TicketMgr private: TicketMgr(); + ~TicketMgr(); public: void LoadTickets(); diff --git a/src/server/game/Tools/PlayerDump.cpp b/src/server/game/Tools/PlayerDump.cpp index 4d9c5a93875..476a19b6885 100644 --- a/src/server/game/Tools/PlayerDump.cpp +++ b/src/server/game/Tools/PlayerDump.cpp @@ -306,22 +306,28 @@ bool PlayerDumpWriter::DumpTable(std::string& dump, uint32 guid, char const*tabl switch (type) { case DTT_INVENTORY: - StoreGUID(result, 3, items); break; // item guid collection (character_inventory.item) + StoreGUID(result, 3, items); // item guid collection (character_inventory.item) + break; case DTT_PET: - StoreGUID(result, 0, pets); break; // pet petnumber collection (character_pet.id) + StoreGUID(result, 0, pets); // pet petnumber collection (character_pet.id) + break; case DTT_MAIL: - StoreGUID(result, 0, mails); // mail id collection (mail.id) + StoreGUID(result, 0, mails); // mail id collection (mail.id) + break; case DTT_MAIL_ITEM: - StoreGUID(result, 1, items); break; // item guid collection (mail_items.item_guid) + StoreGUID(result, 1, items); // item guid collection (mail_items.item_guid) + break; case DTT_CHARACTER: { - if (result->GetFieldCount() <= 67) // avoid crashes on next check - return true; - if (result->Fetch()[67].GetUInt32()) // characters.deleteInfos_Account - if filled error + if (result->GetFieldCount() <= 68) // avoid crashes on next check + sLog->outCrash("PlayerDumpWriter::DumpTable - Trying to access non-existing or wrong positioned field (`deleteInfos_Account`) in `characters` table."); + + if (result->Fetch()[68].GetUInt32()) // characters.deleteInfos_Account - if filled error return false; break; } - default: break; + default: + break; } dump += CreateDumpString(tableTo, result); @@ -406,7 +412,10 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s bool incHighest = true; if (guid != 0 && guid < sObjectMgr->_hiCharGuid) { - result = CharacterDatabase.PQuery("SELECT 1 FROM characters WHERE guid = '%d'", guid); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHECK_GUID); + stmt->setUInt32(0, guid); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (result) guid = sObjectMgr->_hiCharGuid; // use first free if exists else incHighest = false; @@ -420,8 +429,10 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s if (ObjectMgr::CheckPlayerName(name, true) == CHAR_NAME_SUCCESS) { - CharacterDatabase.EscapeString(name); // for safe, we use name only for sql quearies anyway - result = CharacterDatabase.PQuery("SELECT 1 FROM characters WHERE name = '%s'", name.c_str()); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHECK_NAME); + stmt->setString(0, name); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (result) name = ""; // use the one from the dump } @@ -452,7 +463,8 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s { if (!fgets(buf, 32000, fin)) { - if (feof(fin)) break; + if (feof(fin)) + break; ROLLBACK(DUMP_FILE_BROKEN); } @@ -523,9 +535,11 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s { // check if the original name already exists name = getnth(line, 3); - CharacterDatabase.EscapeString(name); - result = CharacterDatabase.PQuery("SELECT 1 FROM characters WHERE name = '%s'", name.c_str()); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHECK_NAME); + stmt->setString(0, name); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (result) if (!changenth(line, 37, "1")) // characters.at_login set to "rename on login" ROLLBACK(DUMP_FILE_BROKEN); diff --git a/src/server/game/Warden/Modules/WardenModuleWin.h b/src/server/game/Warden/Modules/WardenModuleWin.h index ca61a270a81..bf40cde546b 100644 --- a/src/server/game/Warden/Modules/WardenModuleWin.h +++ b/src/server/game/Warden/Modules/WardenModuleWin.h @@ -19,1186 +19,1219 @@ #ifndef _WARDEN_MODULE_WIN_H #define _WARDEN_MODULE_WIN_H -uint8 Module_79C0768D657977D697E10BAD956CCED1_Data[18756] = -{ - 0x21, 0x6C, 0xBB, 0x6A, 0xB9, 0xAF, 0xE8, 0xA1, 0x9A, 0x79, 0x18, 0xF1, 0x27, 0x9A, 0x14, 0xF5, - 0x42, 0x5D, 0x00, 0xBA, 0x74, 0x57, 0x0E, 0xAF, 0xD2, 0xAE, 0x8E, 0x51, 0xA5, 0xC1, 0x17, 0x4E, - 0xEC, 0x7F, 0xAC, 0xBC, 0xDD, 0x42, 0x87, 0xA6, 0xF9, 0xC1, 0x4A, 0xCE, 0xB5, 0xDD, 0xB3, 0xF8, - 0x06, 0x52, 0x9D, 0xF2, 0xAE, 0x2A, 0x49, 0x2B, 0x7B, 0x72, 0x5F, 0x40, 0x01, 0x16, 0xDB, 0x98, - 0x77, 0x1F, 0xE3, 0x61, 0x5A, 0x99, 0x39, 0x66, 0x2F, 0x2F, 0x35, 0xBF, 0x00, 0x20, 0xE4, 0xE0, - 0x8F, 0x98, 0xAD, 0xFC, 0xDB, 0x7D, 0xDD, 0xE8, 0x7A, 0xE9, 0x21, 0x6C, 0x86, 0x80, 0x3A, 0xE7, - 0x75, 0x66, 0x0E, 0xD9, 0xC6, 0xC5, 0xD8, 0xD8, 0xA9, 0x9B, 0x84, 0x09, 0xF0, 0xB3, 0x7C, 0x72, - 0x53, 0xE2, 0x29, 0xF9, 0x64, 0x8C, 0x17, 0xFD, 0x90, 0xAE, 0x48, 0x5A, 0x30, 0xFA, 0x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, 0x9F, 0x1F, 0xA7, 0xD5, 0x27, 0x18, 0x33, - 0x29, 0xA8, 0x33, 0x6E, 0xCB, 0x80, 0x40, 0x2D, 0x52, 0xDF, 0x6C, 0x78, 0x8F, 0xA6, 0x1D, 0xCF, - 0xE8, 0xB9, 0x54, 0x6B -}; +/* +Seed: 4D808D2C77D905C41A6380EC08586AFE (0x05 packet) +Hash: 568C054C781A972A6037A2290C22B52571A06F4E (0x04 packet) +Module MD5: 79C0768D657977D697E10BAD956CCED1 +New Client Key: 7F 96 EE FD A5 B6 3D 20 A4 DF 8E 00 CB F4 83 04 +New Cerver Key: C2 B7 AD ED FC CC A9 C2 BF B3 F8 56 02 BA 80 9B +*/ -uint8 Module_79C0768D657977D697E10BAD956CCED1_Key[16] = +struct Module_79C0768D657977D697E10BAD956CCED1 +{ + uint8 Module[18756]; + uint8 ModuleKey[16]; + uint8 Seed[16]; + uint8 ServerKeySeed[16]; + uint8 ClientKeySeed[16]; + uint8 ClientKeySeedHash[20]; +} Module = { - 0xAE, 0x25, 0xBC, 0x51, 0x06, 0x3B, 0x77, 0xBD, 0x36, 0x3C, 0x3E, 0xFE, 0x0F, 0xC1, 0x73, 0xF9 + { + 0x21, 0x6C, 0xBB, 0x6A, 0xB9, 0xAF, 0xE8, 0xA1, 0x9A, 0x79, 0x18, 0xF1, 0x27, 0x9A, 0x14, 0xF5, + 0x42, 0x5D, 0x00, 0xBA, 0x74, 0x57, 0x0E, 0xAF, 0xD2, 0xAE, 0x8E, 0x51, 0xA5, 0xC1, 0x17, 0x4E, + 0xEC, 0x7F, 0xAC, 0xBC, 0xDD, 0x42, 0x87, 0xA6, 0xF9, 0xC1, 0x4A, 0xCE, 0xB5, 0xDD, 0xB3, 0xF8, + 0x06, 0x52, 0x9D, 0xF2, 0xAE, 0x2A, 0x49, 0x2B, 0x7B, 0x72, 0x5F, 0x40, 0x01, 0x16, 0xDB, 0x98, + 0x77, 0x1F, 0xE3, 0x61, 0x5A, 0x99, 0x39, 0x66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0x90, 0x37, 0xA3, 0xB2, 0xD2, 0x09, 0x3C, 0x5E, 0x6C, 0x2E, 0x72, 0x38, 0x08, 0x24, 0x99, + 0x90, 0xD0, 0x86, 0xC7, 0xD3, 0xFB, 0x4E, 0xA2, 0xDF, 0xC7, 0x26, 0x4D, 0x8E, 0x81, 0x98, 0x19, + 0x15, 0xD0, 0x4C, 0xB8, 0x44, 0xF7, 0x53, 0x1C, 0x0F, 0xAF, 0x78, 0x4C, 0x20, 0xB8, 0xCC, 0xBB, + 0x20, 0x60, 0xEC, 0x55, 0x70, 0xBD, 0xE9, 0x02, 0x63, 0x9F, 0x1F, 0xA7, 0xD5, 0x27, 0x18, 0x33, + 0x29, 0xA8, 0x33, 0x6E, 0xCB, 0x80, 0x40, 0x2D, 0x52, 0xDF, 0x6C, 0x78, 0x8F, 0xA6, 0x1D, 0xCF, + 0xE8, 0xB9, 0x54, 0x6B + }, + // ModuleKey + { + 0xAE, 0x25, 0xBC, 0x51, 0x06, 0x3B, 0x77, 0xBD, 0x36, 0x3C, 0x3E, 0xFE, 0x0F, 0xC1, 0x73, 0xF9 + }, + // Seed + { + 0x4D, 0x80, 0x8D, 0x2C, 0x77, 0xD9, 0x05, 0xC4, 0x1A, 0x63, 0x80, 0xEC, 0x08, 0x58, 0x6A, 0xFE + }, + // ServerKeySeed + { + 0xC2, 0xB7, 0xAD, 0xED, 0xFC, 0xCC, 0xA9, 0xC2, 0xBF, 0xB3, 0xF8, 0x56, 0x02, 0xBA, 0x80, 0x9B + }, + // ClientKeySeed + { + 0x7F, 0x96, 0xEE, 0xFD, 0xA5, 0xB6, 0x3D, 0x20, 0xA4, 0xDF, 0x8E, 0x00, 0xCB, 0xF4, 0x83, 0x04 + }, + // ClientKeySeedHash (SHA1(ClientKeySeed)) + { + 0x56, 0x8C, 0x05, 0x4C, 0x78, 0x1A, 0x97, 0x2A, 0x60, 0x37, 0xA2, 0x29, 0x0C, 0x22, 0xB5, 0x25, 0x71, 0xA0, 0x6F, 0x4E + } }; #endif diff --git a/src/server/game/Warden/Warden.cpp b/src/server/game/Warden/Warden.cpp index 3d625df63d0..0734e0a0f63 100644 --- a/src/server/game/Warden/Warden.cpp +++ b/src/server/game/Warden/Warden.cpp @@ -187,15 +187,17 @@ std::string Warden::Penalty(WardenCheck* check /*= NULL*/) duration << sWorld->getIntConfig(CONFIG_WARDEN_CLIENT_BAN_DURATION) << "s"; std::string accountName; AccountMgr::GetName(_session->GetAccountId(), accountName); - sWorld->BanAccount(BAN_ACCOUNT, accountName, duration.str(), "Warden Anticheat violation","Server"); + std::stringstream banReason; + banReason << "Warden Anticheat Violation: " << check->Comment << " (CheckId: " << check->CheckId << ")"; + sWorld->BanAccount(BAN_ACCOUNT, accountName, duration.str(), banReason.str(),"Server"); return "Ban"; break; } default: - return "Undefined"; break; } + return "Undefined"; } void WorldSession::HandleWardenDataOpcode(WorldPacket& recvData) @@ -203,7 +205,7 @@ void WorldSession::HandleWardenDataOpcode(WorldPacket& recvData) _warden->DecryptData(const_cast<uint8*>(recvData.contents()), recvData.size()); uint8 opcode; recvData >> opcode; - sLog->outDebug(LOG_FILTER_WARDEN, "Got packet, opcode %02X, size %u", opcode, recvData.size()); + sLog->outDebug(LOG_FILTER_WARDEN, "Got packet, opcode %02X, size %u", opcode, uint32(recvData.size())); recvData.hexlike(); switch(opcode) @@ -228,7 +230,7 @@ void WorldSession::HandleWardenDataOpcode(WorldPacket& recvData) sLog->outDebug(LOG_FILTER_WARDEN, "NYI WARDEN_CMSG_MODULE_FAILED received!"); break; default: - sLog->outDebug(LOG_FILTER_WARDEN, "Got unknown warden opcode %02X of size %u.", opcode, recvData.size() - 1); + sLog->outDebug(LOG_FILTER_WARDEN, "Got unknown warden opcode %02X of size %u.", opcode, uint32(recvData.size() - 1)); break; } } diff --git a/src/server/game/Warden/Warden.h b/src/server/game/Warden/Warden.h index e06ea7dca25..d16890b31b9 100644 --- a/src/server/game/Warden/Warden.h +++ b/src/server/game/Warden/Warden.h @@ -107,7 +107,7 @@ class Warden public: Warden(); - ~Warden(); + virtual ~Warden(); virtual void Init(WorldSession* session, BigNumber* k) = 0; virtual ClientWardenModule* GetModuleForClient() = 0; diff --git a/src/server/game/Warden/WardenCheckMgr.cpp b/src/server/game/Warden/WardenCheckMgr.cpp index 77332bd30a8..f4c7a5069cf 100644 --- a/src/server/game/Warden/WardenCheckMgr.cpp +++ b/src/server/game/Warden/WardenCheckMgr.cpp @@ -25,10 +25,8 @@ #include "WardenCheckMgr.h" #include "Warden.h" - WardenCheckMgr::WardenCheckMgr() { - InternalDataID = 1; } WardenCheckMgr::~WardenCheckMgr() @@ -50,17 +48,6 @@ void WardenCheckMgr::LoadWardenChecks() return; } - // For reload case - for (uint16 i = 0; i < CheckStore.size(); ++i) - delete CheckStore[i]; - - CheckStore.clear(); - - for (CheckResultContainer::iterator itr = CheckResultStore.begin(); itr != CheckResultStore.end(); ++itr) - delete itr->second; - CheckResultStore.clear(); - - QueryResult result = WorldDatabase.Query("SELECT MAX(id) FROM warden_checks"); if (!result) @@ -72,17 +59,17 @@ void WardenCheckMgr::LoadWardenChecks() Field* fields = result->Fetch(); - uint32 maxCheckId = fields[0].GetUInt32(); + uint16 maxCheckId = fields[0].GetUInt16(); CheckStore.resize(maxCheckId + 1); - // 0 1 2 3 4 5 6 - result = WorldDatabase.Query("SELECT id, type, data, result, address, length, str FROM warden_checks ORDER BY id ASC"); + // 0 1 2 3 4 5 6 7 + result = WorldDatabase.Query("SELECT id, type, data, result, address, length, str, comment FROM warden_checks ORDER BY id ASC"); uint32 count = 0; do { - Field* fields = result->Fetch(); + fields = result->Fetch(); uint16 id = fields[0].GetUInt16(); uint8 checkType = fields[1].GetUInt8(); @@ -91,9 +78,11 @@ void WardenCheckMgr::LoadWardenChecks() uint32 address = fields[4].GetUInt32(); uint8 length = fields[5].GetUInt8(); std::string str = fields[6].GetString(); + std::string comment = fields[7].GetString(); WardenCheck* wardenCheck = new WardenCheck(); wardenCheck->Type = checkType; + wardenCheck->CheckId = id; // Initialize action with default action from config wardenCheck->Action = WardenActions(sWorld->getIntConfig(CONFIG_WARDEN_CLIENT_FAIL_ACTION)); @@ -147,35 +136,57 @@ void WardenCheckMgr::LoadWardenChecks() CheckResultStore[id] = wr; } + if (comment.empty()) + wardenCheck->Comment = "Undocumented Check"; + else + wardenCheck->Comment = comment; + ++count; } while (result->NextRow()); - // Fetch overrides from char db and overwrite default action in CheckStore - QueryResult overrideResult = CharacterDatabase.Query("SELECT wardenId, action FROM warden_action"); + sLog->outString(">> Loaded %u warden checks.", count); + sLog->outString(); +} - uint32 overrideCount = 0; +void WardenCheckMgr::LoadWardenOverrides() +{ + // 0 1 + QueryResult result = CharacterDatabase.Query("SELECT wardenId, action FROM warden_action"); - if(overrideResult) + if (!result) { - do - { - Field * fields = overrideResult->Fetch(); + sLog->outString(">> Loaded 0 Warden action overrides. DB table `warden_action` is empty!"); + sLog->outString(); + return; + } + + uint32 count = 0; - uint16 checkId = fields[0].GetUInt16(); + ACE_WRITE_GUARD(ACE_RW_Mutex, g, _checkStoreLock); - // Check if override check ID actually exists in current Warden checks - if (checkId > maxCheckId) - sLog->outError("Warden check action override for invalid check (ID: %u, action: %u), skipped", checkId, fields[1].GetUInt8()); - else - CheckStore[fields[0].GetUInt16()]->Action = WardenActions(fields[1].GetUInt8()); + do + { + Field* fields = result->Fetch(); + + uint16 checkId = fields[0].GetUInt16(); + uint8 action = fields[1].GetUInt8(); - ++overrideCount; + // Check if action value is in range (0-2, see WardenActions enum) + if (action > WARDEN_ACTION_BAN) + sLog->outError("Warden check override action out of range (ID: %u, action: %u)", checkId, action); + // Check if check actually exists before accessing the CheckStore vector + else if (checkId > CheckStore.size()) + sLog->outError("Warden check action override for non-existing check (ID: %u, action: %u), skipped", checkId, action); + else + { + CheckStore[checkId]->Action = WardenActions(action); + ++count; } - while (overrideResult->NextRow()); } + while (result->NextRow()); - sLog->outString(">> Loaded %u warden checks and %u action overrides.", count, overrideCount); + sLog->outString(">> Loaded %u warden action overrides.", count); sLog->outString(); } diff --git a/src/server/game/Warden/WardenCheckMgr.h b/src/server/game/Warden/WardenCheckMgr.h index cbe8460db3b..7a83d8f0c6d 100644 --- a/src/server/game/Warden/WardenCheckMgr.h +++ b/src/server/game/Warden/WardenCheckMgr.h @@ -36,6 +36,8 @@ struct WardenCheck uint32 Address; // PROC_CHECK, MEM_CHECK, PAGE_CHECK uint8 Length; // PROC_CHECK, MEM_CHECK, PAGE_CHECK std::string Str; // LUA, MPQ, DRIVER + std::string Comment; + uint16 CheckId; enum WardenActions Action; }; @@ -58,11 +60,13 @@ class WardenCheckMgr WardenCheck* GetWardenDataById(uint16 Id); WardenCheckResult* GetWardenResultById(uint16 Id); - uint32 InternalDataID; std::vector<uint16> MemChecksIdPool; std::vector<uint16> OtherChecksIdPool; void LoadWardenChecks(); + void LoadWardenOverrides(); + + ACE_RW_Mutex _checkStoreLock; private: CheckContainer CheckStore; diff --git a/src/server/game/Warden/WardenMac.cpp b/src/server/game/Warden/WardenMac.cpp index f62aa11a339..a60ae765013 100644 --- a/src/server/game/Warden/WardenMac.cpp +++ b/src/server/game/Warden/WardenMac.cpp @@ -122,7 +122,7 @@ void WardenMac::HandleHashResult(ByteBuffer &buff) uint8 mod_seed[16] = { 0x4D, 0x80, 0x8D, 0x2C, 0x77, 0xD9, 0x05, 0xC4, 0x1A, 0x63, 0x80, 0xEC, 0x08, 0x58, 0x6A, 0xFE }; - for(int i = 0; i < 4; ++i) + for (int i = 0; i < 4; ++i) { keyIn[i] = *(int*)(&mod_seed[0] + i * 4); } diff --git a/src/server/game/Warden/WardenWin.cpp b/src/server/game/Warden/WardenWin.cpp index a77c77a3261..a7485d7da51 100644 --- a/src/server/game/Warden/WardenWin.cpp +++ b/src/server/game/Warden/WardenWin.cpp @@ -49,16 +49,8 @@ void WardenWin::Init(WorldSession* session, BigNumber *k) SHA1Randx WK(k->AsByteArray(), k->GetNumBytes()); WK.generate(_inputKey, 16); WK.generate(_outputKey, 16); - /* - Seed: 4D808D2C77D905C41A6380EC08586AFE (0x05 packet) - Hash: 568C054C781A972A6037A2290C22B52571A06F4E (0x04 packet) - Module MD5: 79C0768D657977D697E10BAD956CCED1 - New Client Key: 7F 96 EE FD A5 B6 3D 20 A4 DF 8E 00 CB F4 83 04 - New Cerver Key: C2 B7 AD ED FC CC A9 C2 BF B3 F8 56 02 BA 80 9B - */ - uint8 mod_seed[16] = { 0x4D, 0x80, 0x8D, 0x2C, 0x77, 0xD9, 0x05, 0xC4, 0x1A, 0x63, 0x80, 0xEC, 0x08, 0x58, 0x6A, 0xFE }; - memcpy(_seed, mod_seed, 16); + memcpy(_seed, Module.Seed, 16); _inputCrypto.Init(_inputKey); _outputCrypto.Init(_outputKey); @@ -79,13 +71,13 @@ ClientWardenModule* WardenWin::GetModuleForClient() { ClientWardenModule *mod = new ClientWardenModule; - uint32 length = sizeof(Module_79C0768D657977D697E10BAD956CCED1_Data); + uint32 length = sizeof(Module.Module); // data assign mod->CompressedSize = length; mod->CompressedData = new uint8[length]; - memcpy(mod->CompressedData, Module_79C0768D657977D697E10BAD956CCED1_Data, length); - memcpy(mod->Key, Module_79C0768D657977D697E10BAD956CCED1_Key, 16); + memcpy(mod->CompressedData, Module.Module, length); + memcpy(mod->Key, Module.ModuleKey, 16); // md5 hash MD5_CTX ctx; @@ -104,7 +96,6 @@ void WardenWin::InitializeModule() WardenInitModuleRequest Request; Request.Command1 = WARDEN_SMSG_MODULE_INITIALIZE; Request.Size1 = 20; - Request.CheckSumm1 = BuildChecksum(&Request.Unk1, 20); Request.Unk1 = 1; Request.Unk2 = 0; Request.Type = 1; @@ -113,24 +104,25 @@ void WardenWin::InitializeModule() Request.Function1[1] = 0x000218C0; // 0x00400000 + 0x000218C0 SFileGetFileSize Request.Function1[2] = 0x00022530; // 0x00400000 + 0x00022530 SFileReadFile Request.Function1[3] = 0x00022910; // 0x00400000 + 0x00022910 SFileCloseFile + Request.CheckSumm1 = BuildChecksum(&Request.Unk1, 20); Request.Command2 = WARDEN_SMSG_MODULE_INITIALIZE; Request.Size2 = 8; - Request.CheckSumm2 = BuildChecksum(&Request.Unk2, 8); Request.Unk3 = 4; Request.Unk4 = 0; Request.String_library2 = 0; Request.Function2 = 0x00419D40; // 0x00400000 + 0x00419D40 FrameScript::GetText Request.Function2_set = 1; + Request.CheckSumm2 = BuildChecksum(&Request.Unk2, 8); Request.Command3 = WARDEN_SMSG_MODULE_INITIALIZE; Request.Size3 = 8; - Request.CheckSumm3 = BuildChecksum(&Request.Unk5, 8); Request.Unk5 = 1; Request.Unk6 = 1; Request.String_library3 = 0; Request.Function3 = 0x0046AE20; // 0x00400000 + 0x0046AE20 PerformanceCounter Request.Function3_set = 1; + Request.CheckSumm3 = BuildChecksum(&Request.Unk5, 8); // Encrypt with warden RC4 key. EncryptData((uint8*)&Request, sizeof(WardenInitModuleRequest)); @@ -161,10 +153,8 @@ void WardenWin::HandleHashResult(ByteBuffer &buff) { buff.rpos(buff.wpos()); - const uint8 validHash[20] = { 0x56, 0x8C, 0x05, 0x4C, 0x78, 0x1A, 0x97, 0x2A, 0x60, 0x37, 0xA2, 0x29, 0x0C, 0x22, 0xB5, 0x25, 0x71, 0xA0, 0x6F, 0x4E }; - // Verify key - if (memcmp(buff.contents() + 1, validHash, sizeof(validHash)) != 0) + if (memcmp(buff.contents() + 1, Module.ClientKeySeedHash, 20) != 0) { sLog->outDebug(LOG_FILTER_WARDEN, "Request hash reply: failed"); sLog->outWarden("WARDEN: Player %s (guid: %u, account: %u) failed hash reply. Action: %s", @@ -174,15 +164,9 @@ void WardenWin::HandleHashResult(ByteBuffer &buff) sLog->outDebug(LOG_FILTER_WARDEN, "Request hash reply: succeed"); - // Client 7F96EEFDA5B63D20A4DF8E00CBF48304 - const uint8 client_key[16] = { 0x7F, 0x96, 0xEE, 0xFD, 0xA5, 0xB6, 0x3D, 0x20, 0xA4, 0xDF, 0x8E, 0x00, 0xCB, 0xF4, 0x83, 0x04 }; - - // Server C2B7ADEDFCCCA9C2BFB3F85602BA809B - const uint8 server_key[16] = { 0xC2, 0xB7, 0xAD, 0xED, 0xFC, 0xCC, 0xA9, 0xC2, 0xBF, 0xB3, 0xF8, 0x56, 0x02, 0xBA, 0x80, 0x9B }; - // Change keys here - memcpy(_inputKey, client_key, 16); - memcpy(_outputKey, server_key, 16); + memcpy(_inputKey, Module.ClientKeySeed, 16); + memcpy(_outputKey, Module.ServerKeySeed, 16); _inputCrypto.Init(_inputKey); _outputCrypto.Init(_outputKey); @@ -228,6 +212,8 @@ void WardenWin::RequestData() ByteBuffer buff; buff << uint8(WARDEN_SMSG_CHEAT_CHECKS_REQUEST); + ACE_READ_GUARD(ACE_RW_Mutex, g, sWardenCheckMgr->_checkStoreLock); + for (uint32 i = 0; i < sWorld->getIntConfig(CONFIG_WARDEN_NUM_OTHER_CHECKS); ++i) { // If todo list is done break loop (will be filled on next Update() run) @@ -339,7 +325,7 @@ void WardenWin::RequestData() for (std::list<uint16>::iterator itr = _currentChecks.begin(); itr != _currentChecks.end(); ++itr) stream << *itr << " "; - sLog->outWarden("%s", stream.str().c_str()); + sLog->outDebug(LOG_FILTER_WARDEN, "%s", stream.str().c_str()); } void WardenWin::HandleData(ByteBuffer &buff) @@ -393,6 +379,8 @@ void WardenWin::HandleData(ByteBuffer &buff) uint8 type; uint16 checkFailed = 0; + ACE_READ_GUARD(ACE_RW_Mutex, g, sWardenCheckMgr->_checkStoreLock); + for (std::list<uint16>::iterator itr = _currentChecks.begin(); itr != _currentChecks.end(); ++itr) { rd = sWardenCheckMgr->GetWardenDataById(*itr); diff --git a/src/server/game/Weather/Weather.cpp b/src/server/game/Weather/Weather.cpp index 2a48ede4c81..965e6bf3805 100755 --- a/src/server/game/Weather/Weather.cpp +++ b/src/server/game/Weather/Weather.cpp @@ -147,7 +147,7 @@ bool Weather::ReGenerate() } // At this point, only weather that isn't doing anything remains but that have weather data - uint32 chance1 = m_weatherChances->data[season].rainChance; + uint32 chance1 = m_weatherChances->data[season].rainChance; uint32 chance2 = chance1+ m_weatherChances->data[season].snowChance; uint32 chance3 = chance2+ m_weatherChances->data[season].stormChance; diff --git a/src/server/game/Weather/Weather.h b/src/server/game/Weather/Weather.h index 0c17cfd1efe..dadd1151a53 100755 --- a/src/server/game/Weather/Weather.h +++ b/src/server/game/Weather/Weather.h @@ -89,4 +89,3 @@ class Weather WeatherData const* m_weatherChances; }; #endif - diff --git a/src/server/game/Weather/WeatherMgr.cpp b/src/server/game/Weather/WeatherMgr.cpp index 731aba8d197..bb8fadf08bc 100755 --- a/src/server/game/Weather/WeatherMgr.cpp +++ b/src/server/game/Weather/WeatherMgr.cpp @@ -24,14 +24,14 @@ #include "Weather.h" #include "Log.h" #include "ObjectMgr.h" -#include <ace/Refcounted_Auto_Ptr.h> +#include "AutoPtr.h" namespace WeatherMgr { namespace { - typedef UNORDERED_MAP<uint32, ACE_Refcounted_Auto_Ptr<Weather, ACE_Null_Mutex> > WeatherMap; + typedef UNORDERED_MAP<uint32, Trinity::AutoPtr<Weather, ACE_Null_Mutex> > WeatherMap; typedef UNORDERED_MAP<uint32, WeatherData> WeatherZoneMap; WeatherMap m_weathers; @@ -108,9 +108,9 @@ void LoadWeatherData() for (uint8 season = 0; season < WEATHER_SEASONS; ++season) { - wzc.data[season].rainChance = fields[season * (MAX_WEATHER_TYPE-1) + 1].GetUInt32(); - wzc.data[season].snowChance = fields[season * (MAX_WEATHER_TYPE-1) + 2].GetUInt32(); - wzc.data[season].stormChance = fields[season * (MAX_WEATHER_TYPE-1) + 3].GetUInt32(); + wzc.data[season].rainChance = fields[season * (MAX_WEATHER_TYPE-1) + 1].GetUInt8(); + wzc.data[season].snowChance = fields[season * (MAX_WEATHER_TYPE-1) + 2].GetUInt8(); + wzc.data[season].stormChance = fields[season * (MAX_WEATHER_TYPE-1) + 3].GetUInt8(); if (wzc.data[season].rainChance > 100) { diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 45b1c4dac64..b5c0e13c425 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -77,8 +77,9 @@ #include "Channel.h" #include "WardenCheckMgr.h" #include "Warden.h" +#include "CalendarMgr.h" -volatile bool World::m_stopEvent = false; +ACE_Atomic_Op<ACE_Thread_Mutex, bool> World::m_stopEvent = false; uint8 World::m_ExitCode = SHUTDOWN_EXIT_CODE; volatile uint32 World::m_worldLoopCounter = 0; @@ -207,6 +208,7 @@ bool World::RemoveSession(uint32 id) { if (itr->second->PlayerLoading()) return false; + itr->second->KickPlayer(); } @@ -218,8 +220,7 @@ void World::AddSession(WorldSession* s) addSessQueue.add(s); } -void -World::AddSession_(WorldSession* s) +void World::AddSession_(WorldSession* s) { ASSERT (s); @@ -267,16 +268,13 @@ World::AddSession_(WorldSession* s) { AddQueuedPlayer (s); UpdateMaxSessionCounters(); - sLog->outDetail ("PlayerQueue: Account id %u is in Queue Position (%u).", s->GetAccountId(), ++QueueSize); + sLog->outDetail("PlayerQueue: Account id %u is in Queue Position (%u).", s->GetAccountId(), ++QueueSize); return; } s->SendAuthResponse(AUTH_OK, true); - s->SendAddonsInfo(); - s->SendClientCacheVersion(sWorld->getIntConfig(CONFIG_CLIENTCACHE_VERSION)); - s->SendTutorialsData(); UpdateMaxSessionCounters(); @@ -287,7 +285,7 @@ World::AddSession_(WorldSession* s) float popu = (float)GetActiveSessionCount(); // updated number of users on the server popu /= pLimit; popu *= 2; - sLog->outDetail ("Server Population (%f).", popu); + sLog->outDetail("Server Population (%f).", popu); } } @@ -1203,7 +1201,9 @@ void World::LoadConfigSettings(bool reload) m_bool_configs[CONFIG_PDUMP_NO_PATHS] = ConfigMgr::GetBoolDefault("PlayerDump.DisallowPaths", true); m_bool_configs[CONFIG_PDUMP_NO_OVERWRITE] = ConfigMgr::GetBoolDefault("PlayerDump.DisallowOverwrite", true); - sScriptMgr->OnConfigLoad(reload); + // call ScriptMgr if we're reloading the configuration + if (reload) + sScriptMgr->OnConfigLoad(reload); } extern void LoadGameObjectModelList(); @@ -1279,6 +1279,9 @@ void World::SetInitialWorldSettings() sLog->outString("Loading SpellInfo store..."); sSpellMgr->LoadSpellInfoStore(); + sLog->outString("Loading SkillLineAbilityMultiMap Data..."); + sSpellMgr->LoadSkillLineAbilityMap(); + sLog->outString("Loading spell custom attributes..."); sSpellMgr->LoadSpellCustomAttr(); @@ -1291,9 +1294,6 @@ void World::SetInitialWorldSettings() sLog->outString("Loading Instance Template..."); sObjectMgr->LoadInstanceTemplate(); - sLog->outString("Loading SkillLineAbilityMultiMap Data..."); - sSpellMgr->LoadSkillLineAbilityMap(); - // Must be called before `creature_respawn`/`gameobject_respawn` tables sLog->outString("Loading instances..."); sInstanceSaveMgr->LoadInstances(); @@ -1591,7 +1591,7 @@ void World::SetInitialWorldSettings() sSmartWaypointMgr->LoadFromDB(); sLog->outString("Loading Creature Formations..."); - FormationMgr::LoadCreatureFormations(); + sFormationMgr->LoadCreatureFormations(); sLog->outString("Loading World States..."); // must be loaded before battleground, outdoor PvP and conditions LoadWorldStates(); @@ -1653,8 +1653,12 @@ void World::SetInitialWorldSettings() sLog->outString("Loading Creature Texts..."); sCreatureTextMgr->LoadCreatureTexts(); + sLog->outString("Loading Creature Text Locales..."); + sCreatureTextMgr->LoadCreatureTextLocales(); + sLog->outString("Initializing Scripts..."); sScriptMgr->Initialize(); + sScriptMgr->OnConfigLoad(false); // must be done after the ScriptMgr has been properly initialized sLog->outString("Validating spell scripts..."); sObjectMgr->ValidateSpellScripts(); @@ -1662,21 +1666,16 @@ void World::SetInitialWorldSettings() sLog->outString("Loading SmartAI scripts..."); sSmartScriptMgr->LoadSmartAIFromDB(); + sLog->outString("Loading Calendar data..."); + sCalendarMgr->LoadFromDB(); + ///- Initialize game time and timers sLog->outString("Initialize game time and timers"); m_gameTime = time(NULL); - m_startTime=m_gameTime; - - tm local; - time_t curr; - time(&curr); - local=*(localtime(&curr)); // dereference and assign - char isoDate[128]; - sprintf(isoDate, "%04d-%02d-%02d %02d:%02d:%02d", - local.tm_year+1900, local.tm_mon+1, local.tm_mday, local.tm_hour, local.tm_min, local.tm_sec); + m_startTime = m_gameTime; - LoginDatabase.PExecute("INSERT INTO uptime (realmid, starttime, startstring, uptime, revision) VALUES('%u', " UI64FMTD ", '%s', 0, '%s')", - realmID, uint64(m_startTime), isoDate, _FULLVERSION); // One-time query + LoginDatabase.PExecute("INSERT INTO uptime (realmid, starttime, uptime, revision) VALUES(%u, %u, 0, '%s')", + realmID, uint32(m_startTime), _FULLVERSION); // One-time query m_timers[WUPDATE_WEATHERS].SetInterval(1*IN_MILLISECONDS); m_timers[WUPDATE_AUCTIONS].SetInterval(MINUTE*IN_MILLISECONDS); @@ -1742,8 +1741,11 @@ void World::SetInitialWorldSettings() sLog->outString("Loading Warden Checks..." ); sWardenCheckMgr->LoadWardenChecks(); + sLog->outString("Loading Warden Action Overrides..." ); + sWardenCheckMgr->LoadWardenOverrides(); + sLog->outString("Deleting expired bans..."); - LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate <= UNIX_TIMESTAMP() AND unbandate<>bandate"); + LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate <= UNIX_TIMESTAMP() AND unbandate<>bandate"); // One-time query sLog->outString("Calculate next daily quest reset time..."); InitDailyQuestResetTime(); @@ -1774,7 +1776,7 @@ void World::SetInitialWorldSettings() uint32 startupDuration = GetMSTimeDiffToNow(startupBegin); sLog->outString(); - sLog->outString("WORLD: World initialized in %u minutes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000) ); + sLog->outString("WORLD: World initialized in %u minutes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000)); sLog->outString(); } @@ -1964,10 +1966,10 @@ void World::Update(uint32 diff) PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_UPTIME_PLAYERS); - stmt->setUInt64(0, uint64(tmpDiff)); + stmt->setUInt32(0, tmpDiff); stmt->setUInt16(1, uint16(maxOnlinePlayers)); stmt->setUInt32(2, realmID); - stmt->setUInt64(3, uint64(m_startTime)); + stmt->setUInt32(3, uint32(m_startTime)); LoginDatabase.Execute(stmt); } @@ -2313,7 +2315,7 @@ BanReturn World::BanAccount(BanMode mode, std::string nameOrIP, std::string dura do { Field* fieldsAccount = resultAccounts->Fetch(); - uint32 account = fieldsAccount->GetUInt32(); + uint32 account = fieldsAccount[0].GetUInt32(); if (mode != BAN_IP) { @@ -2449,7 +2451,7 @@ void World::_UpdateGameTime() m_gameTime = thisTime; ///- if there is a shutdown timer - if (!m_stopEvent && m_ShutdownTimer > 0 && elapsed > 0) + if (!IsStopped() && m_ShutdownTimer > 0 && elapsed > 0) { ///- ... and it is overdue, stop the world (set m_stopEvent) if (m_ShutdownTimer <= elapsed) @@ -2473,7 +2475,7 @@ void World::_UpdateGameTime() void World::ShutdownServ(uint32 time, uint32 options, uint8 exitcode) { // ignore if server shutdown at next tick - if (m_stopEvent) + if (IsStopped()) return; m_ShutdownMask = options; @@ -2525,7 +2527,7 @@ void World::ShutdownMsg(bool show, Player* player) void World::ShutdownCancel() { // nothing cancel or too later - if (!m_ShutdownTimer || m_stopEvent) + if (!m_ShutdownTimer || m_stopEvent.value()) return; ServerMessageType msgid = (m_ShutdownMask & SHUTDOWN_MASK_RESTART) ? SERVER_MSG_RESTART_CANCELLED : SERVER_MSG_SHUTDOWN_CANCELLED; @@ -2609,7 +2611,7 @@ void World::SendAutoBroadcast() std::string msg; - msg = SelectRandomContainerElement(m_Autobroadcasts); + msg = Trinity::Containers::SelectRandomContainerElement(m_Autobroadcasts); uint32 abcenter = sWorld->getIntConfig(CONFIG_AUTOBROADCAST_CENTER); @@ -2649,15 +2651,15 @@ void World::_UpdateRealmCharCount(PreparedQueryResult resultCharCount) { Field* fields = resultCharCount->Fetch(); uint32 accountId = fields[0].GetUInt32(); - uint32 charCount = fields[1].GetUInt32(); + uint8 charCount = uint8(fields[1].GetUInt64()); - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_REALM_CHARACTERS); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_REALM_CHARACTERS_BY_REALM); stmt->setUInt32(0, accountId); stmt->setUInt32(1, realmID); LoginDatabase.Execute(stmt); stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_REALM_CHARACTERS); - stmt->setUInt32(0, charCount); + stmt->setUInt8(0, charCount); stmt->setUInt32(1, accountId); stmt->setUInt32(2, realmID); LoginDatabase.Execute(stmt); @@ -2749,9 +2751,12 @@ void World::ResetDailyQuests() void World::LoadDBAllowedSecurityLevel() { - QueryResult result = LoginDatabase.PQuery("SELECT allowedSecurityLevel from realmlist WHERE id = '%d'", realmID); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_REALMLIST_SECURITY_LEVEL); + stmt->setInt32(0, int32(realmID)); + PreparedQueryResult result = LoginDatabase.Query(stmt); + if (result) - SetPlayerSecurityLimit(AccountTypes(result->Fetch()->GetUInt16())); + SetPlayerSecurityLimit(AccountTypes(result->Fetch()->GetUInt8())); } void World::SetPlayerSecurityLimit(AccountTypes _sec) @@ -2930,7 +2935,7 @@ void World::LoadCharacterNameData() { sLog->outString("Loading character name data"); - QueryResult result = CharacterDatabase.Query("SELECT guid, name, race, gender, class FROM characters"); + QueryResult result = CharacterDatabase.Query("SELECT guid, name, race, gender, class FROM characters WHERE deleteDate IS NULL"); if (!result) { sLog->outError("No character name data loaded, empty query"); @@ -2941,7 +2946,7 @@ void World::LoadCharacterNameData() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); AddCharacterNameData(fields[0].GetUInt32(), fields[1].GetString(), fields[3].GetUInt8() /*gender*/, fields[2].GetUInt8() /*race*/, fields[4].GetUInt8() /*class*/); ++count; diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index 6304699e7e1..51f384770da 100755 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -26,6 +26,7 @@ #include "Common.h" #include "Timer.h" #include <ace/Singleton.h> +#include <ace/Atomic_Op.h> #include "SharedDefines.h" #include "QueryResult.h" #include "Callback.h" @@ -660,7 +661,7 @@ class World void ShutdownMsg(bool show = false, Player* player = NULL); static uint8 GetExitCode() { return m_ExitCode; } static void StopNow(uint8 exitcode) { m_stopEvent = true; m_ExitCode = exitcode; } - static bool IsStopped() { return m_stopEvent; } + static bool IsStopped() { return m_stopEvent.value(); } void Update(uint32 diff); @@ -778,7 +779,7 @@ class World void ResetWeeklyQuests(); void ResetRandomBG(); private: - static volatile bool m_stopEvent; + static ACE_Atomic_Op<ACE_Thread_Mutex, bool> m_stopEvent; static uint8 m_ExitCode; uint32 m_ShutdownTimer; uint32 m_ShutdownMask; diff --git a/src/server/scripts/CMakeLists.txt b/src/server/scripts/CMakeLists.txt index 62336e95ff6..792fdeb3e7b 100644 --- a/src/server/scripts/CMakeLists.txt +++ b/src/server/scripts/CMakeLists.txt @@ -34,7 +34,6 @@ set(scripts_STAT_SRCS ../game/AI/ScriptedAI/ScriptedEscortAI.cpp ../game/AI/ScriptedAI/ScriptedCreature.cpp ../game/AI/ScriptedAI/ScriptedFollowerAI.cpp - ../game/AI/ScriptedAI/ScriptedSimpleAI.cpp ) if(SCRIPTS) @@ -54,7 +53,6 @@ include_directories( ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/dep/g3dlite/include ${CMAKE_SOURCE_DIR}/dep/SFMT - ${CMAKE_SOURCE_DIR}/dep/mersennetwister ${CMAKE_SOURCE_DIR}/dep/zlib ${CMAKE_SOURCE_DIR}/src/server/shared ${CMAKE_SOURCE_DIR}/src/server/shared/Configuration @@ -121,6 +119,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/server/game/Maps ${CMAKE_SOURCE_DIR}/src/server/game/Movement ${CMAKE_SOURCE_DIR}/src/server/game/Movement/MovementGenerators + ${CMAKE_SOURCE_DIR}/src/server/game/Movement/Spline ${CMAKE_SOURCE_DIR}/src/server/game/Movement/Waypoints ${CMAKE_SOURCE_DIR}/src/server/game/Opcodes ${CMAKE_SOURCE_DIR}/src/server/game/OutdoorPvP diff --git a/src/server/scripts/Commands/CMakeLists.txt b/src/server/scripts/Commands/CMakeLists.txt index b17350c265d..86fe984e197 100644 --- a/src/server/scripts/Commands/CMakeLists.txt +++ b/src/server/scripts/Commands/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/> +# Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> # # This file is free software; as a special exception the author gives # unlimited permission to copy and/or distribute it, with or without @@ -17,7 +17,6 @@ set(scripts_STAT_SRCS Commands/cs_gm.cpp Commands/cs_go.cpp Commands/cs_gobject.cpp - Commands/cs_gps.cpp Commands/cs_honor.cpp Commands/cs_learn.cpp Commands/cs_misc.cpp diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp index 7372c92c4dd..b52102479b5 100644 --- a/src/server/scripts/Commands/cs_account.cpp +++ b/src/server/scripts/Commands/cs_account.cpp @@ -194,8 +194,11 @@ public: static bool HandleAccountOnlineListCommand(ChatHandler* handler, char const* /*args*/) { ///- Get the list of accounts ID logged to the realm - QueryResult resultDB = CharacterDatabase.Query("SELECT name, account, map, zone FROM characters WHERE online > 0"); - if (!resultDB) + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_ONLINE); + + PreparedQueryResult result = CharacterDatabase.Query(stmt); + + if (!result) { handler->SendSysMessage(LANG_ACCOUNT_LIST_EMPTY); return true; @@ -209,31 +212,28 @@ public: ///- Cycle through accounts do { - Field* fieldsDB = resultDB->Fetch(); + Field* fieldsDB = result->Fetch(); std::string name = fieldsDB[0].GetString(); uint32 account = fieldsDB[1].GetUInt32(); ///- Get the username, last IP and GM level of each account // No SQL injection. account is uint32. - QueryResult resultLogin = - LoginDatabase.PQuery("SELECT a.username, a.last_ip, aa.gmlevel, a.expansion " - "FROM account a " - "LEFT JOIN account_access aa " - "ON (a.id = aa.id) " - "WHERE a.id = '%u'", account); + stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_INFO); + stmt->setUInt32(0, account); + PreparedQueryResult resultLogin = LoginDatabase.Query(stmt); if (resultLogin) { Field* fieldsLogin = resultLogin->Fetch(); handler->PSendSysMessage(LANG_ACCOUNT_LIST_LINE, fieldsLogin[0].GetCString(), name.c_str(), fieldsLogin[1].GetCString(), - fieldsDB[2].GetUInt16(), fieldsDB[3].GetUInt16(), fieldsLogin[3].GetUInt32(), - fieldsLogin[2].GetUInt32()); + fieldsDB[2].GetUInt16(), fieldsDB[3].GetUInt16(), fieldsLogin[3].GetUInt8(), + fieldsLogin[2].GetUInt8()); } else handler->PSendSysMessage(LANG_ACCOUNT_LIST_ERROR, name.c_str()); - } while (resultDB->NextRow()); + } while (result->NextRow()); handler->SendSysMessage(LANG_ACCOUNT_LIST_BAR); return true; @@ -382,7 +382,7 @@ public: // Let set addon state only for lesser (strong) security level // or to self account - if (handler->GetSession() && handler->GetSession()->GetAccountId () != accountId && + if (handler->GetSession() && handler->GetSession()->GetAccountId() != accountId && handler->HasLowerSecurityAccount(NULL, accountId, true)) return false; @@ -469,7 +469,13 @@ public: // Check and abort if the target gm has a higher rank on one of the realms and the new realm is -1 if (gmRealmID == -1 && !AccountMgr::IsConsoleAccount(playerSecurity)) { - QueryResult result = LoginDatabase.PQuery("SELECT * FROM account_access WHERE id = '%u' AND gmlevel > '%d'", targetAccountId, gm); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_ACCESS_GMLEVEL_TEST); + + stmt->setUInt32(0, targetAccountId); + stmt->setUInt8(1, uint8(gm)); + + PreparedQueryResult result = LoginDatabase.Query(stmt); + if (result) { handler->SendSysMessage(LANG_YOURS_SECURITY_IS_LOW); @@ -502,11 +508,12 @@ public: stmt->setUInt32(0, targetAccountId); stmt->setUInt32(1, realmID); } + LoginDatabase.Execute(stmt); if (gm != 0) { - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT_ACCESS); + stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT_ACCESS); stmt->setUInt32(0, targetAccountId); stmt->setUInt8(1, uint8(gm)); diff --git a/src/server/scripts/Commands/cs_achievement.cpp b/src/server/scripts/Commands/cs_achievement.cpp index f136cba46ab..7667e79ece7 100644 --- a/src/server/scripts/Commands/cs_achievement.cpp +++ b/src/server/scripts/Commands/cs_achievement.cpp @@ -67,7 +67,7 @@ public: return false; } - if (AchievementEntry const* achievementEntry = GetAchievementStore()->LookupEntry(achievementId)) + if (AchievementEntry const* achievementEntry = sAchievementStore.LookupEntry(achievementId)) target->CompletedAchievement(achievementEntry); return true; diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 4c4869c1c5b..6accc96260b 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -46,7 +46,7 @@ public: { "cinematic", SEC_MODERATOR, false, &HandleDebugPlayCinematicCommand, "", NULL }, { "movie", SEC_MODERATOR, false, &HandleDebugPlayMovieCommand, "", NULL }, { "sound", SEC_MODERATOR, false, &HandleDebugPlaySoundCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } + { NULL, SEC_PLAYER, false, NULL, "", NULL } }; static ChatCommand debugSendCommandTable[] = { @@ -61,7 +61,7 @@ public: { "sellerror", SEC_ADMINISTRATOR, false, &HandleDebugSendSellErrorCommand, "", NULL }, { "setphaseshift", SEC_ADMINISTRATOR, false, &HandleDebugSendSetPhaseShiftCommand, "", NULL }, { "spellfail", SEC_ADMINISTRATOR, false, &HandleDebugSendSpellFailCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } + { NULL, SEC_PLAYER, false, NULL, "", NULL } }; static ChatCommand debugCommandTable[] = { @@ -89,12 +89,14 @@ public: { "itemexpire", SEC_ADMINISTRATOR, false, &HandleDebugItemExpireCommand, "", NULL }, { "areatriggers", SEC_ADMINISTRATOR, false, &HandleDebugAreaTriggersCommand, "", NULL }, { "los", SEC_MODERATOR, false, &HandleDebugLoSCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } + { "moveflags", SEC_ADMINISTRATOR, false, &HandleDebugMoveflagsCommand, "", NULL }, + { NULL, SEC_PLAYER, false, NULL, "", NULL } }; static ChatCommand commandTable[] = { { "debug", SEC_MODERATOR, true, NULL, "", debugCommandTable }, - { NULL, 0, false, NULL, "", NULL } + { "wpgps", SEC_ADMINISTRATOR, false, &HandleWPGPSCommand, "", NULL }, + { NULL, SEC_PLAYER, false, NULL, "", NULL } }; return commandTable; } @@ -1197,7 +1199,7 @@ public: int currentValue = (int)handler->GetSession()->GetPlayer()->GetUInt32Value(opcode); currentValue += value; - handler->GetSession()->GetPlayer()->SetUInt32Value(opcode , (uint32)currentValue); + handler->GetSession()->GetPlayer()->SetUInt32Value(opcode, (uint32)currentValue); handler->PSendSysMessage(LANG_CHANGE_32BIT_FIELD, opcode, currentValue); @@ -1283,6 +1285,51 @@ public: handler->PSendSysMessage(LANG_SET_32BIT_FIELD, opcode, value); return true; } + + static bool HandleDebugMoveflagsCommand(ChatHandler* handler, char const* args) + { + Unit* target = handler->getSelectedUnit(); + if (!target) + target = handler->GetSession()->GetPlayer(); + + if (!*args) + { + //! Display case + handler->PSendSysMessage(LANG_MOVEFLAGS_GET, target->GetUnitMovementFlags(), target->GetExtraUnitMovementFlags()); + } + else + { + char* mask1 = strtok((char*)args, " "); + if (!mask1) + return false; + + char* mask2 = strtok(NULL, " \n"); + + uint32 moveFlags = (uint32)atoi(mask1); + target->SetUnitMovementFlags(moveFlags); + + if (mask2) + { + uint32 moveFlagsExtra = uint32(atoi(mask2)); + target->SetExtraUnitMovementFlags(moveFlagsExtra); + } + + target->SendMovementFlagUpdate(); + handler->PSendSysMessage(LANG_MOVEFLAGS_SET, target->GetUnitMovementFlags(), target->GetExtraUnitMovementFlags()); + } + + return true; + } + + static bool HandleWPGPSCommand(ChatHandler* handler, char const* /*args*/) + { + Player* player = handler->GetSession()->GetPlayer(); + + sLog->outSQLDev("(@PATH, XX, %.3f, %.3f, %.5f, 0,0, 0,100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); + + handler->PSendSysMessage("Waypoint SQL written to SQL Developer log"); + return true; + } }; void AddSC_debug_commandscript() diff --git a/src/server/scripts/Commands/cs_gm.cpp b/src/server/scripts/Commands/cs_gm.cpp index 0dcb6995cb1..ba5a7f10d7d 100644 --- a/src/server/scripts/Commands/cs_gm.cpp +++ b/src/server/scripts/Commands/cs_gm.cpp @@ -153,7 +153,11 @@ public: static bool HandleGMListFullCommand(ChatHandler* handler, char const* /*args*/) { ///- Get the accounts with GM Level >0 - QueryResult result = LoginDatabase.PQuery("SELECT a.username, aa.gmlevel FROM account a, account_access aa WHERE a.id=aa.id AND aa.gmlevel >= %u AND (aa.realmid = -1 OR aa.realmid = %u)", SEC_MODERATOR, realmID); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_GM_ACCOUNTS); + stmt->setUInt8(0, uint8(SEC_MODERATOR)); + stmt->setInt32(1, int32(realmID)); + PreparedQueryResult result = LoginDatabase.Query(stmt); + if (result) { handler->SendSysMessage(LANG_GMLIST); diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index 74b8272201b..232aad9f21c 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -535,11 +535,17 @@ public: uint32 count = 0; Player* player = handler->GetSession()->GetPlayer(); - QueryResult result = WorldDatabase.PQuery("SELECT guid, id, position_x, position_y, position_z, map, " - "(POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ " - "FROM gameobject WHERE map='%u' AND (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) <= '%f' ORDER BY order_", - player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), - player->GetMapId(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), distance * distance); + + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_GAMEOBJECT_NEAREST); + stmt->setFloat(0, player->GetPositionX()); + stmt->setFloat(1, player->GetPositionY()); + stmt->setFloat(2, player->GetPositionZ()); + stmt->setUInt32(3, player->GetMapId()); + stmt->setFloat(4, player->GetPositionX()); + stmt->setFloat(5, player->GetPositionY()); + stmt->setFloat(6, player->GetPositionZ()); + stmt->setFloat(7, distance * distance); + PreparedQueryResult result = WorldDatabase.Query(stmt); if (result) { diff --git a/src/server/scripts/Commands/cs_gps.cpp b/src/server/scripts/Commands/cs_gps.cpp deleted file mode 100644 index 12a5efddf47..00000000000 --- a/src/server/scripts/Commands/cs_gps.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> - * - * 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/>. - */ - -/* ScriptData -Name: gps_commandscript -%Complete: 100 -Comment: GPS/WPGPS commands -Category: commandscripts -EndScriptData */ - -#include "ObjectAccessor.h" -#include "ScriptMgr.h" -#include "Chat.h" -#include "CellImpl.h" - -class gps_commandscript : public CommandScript -{ -public: - gps_commandscript() : CommandScript("gps_commandscript") { } - - ChatCommand* GetCommands() const - { - static ChatCommand commandTable[] = - { - { "gps", SEC_ADMINISTRATOR, false, &HandleGPSCommand, "", NULL }, - { "wpgps", SEC_ADMINISTRATOR, false, &HandleWPGPSCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - return commandTable; - } - - static bool HandleGPSCommand(ChatHandler* handler, char const* args) - { - WorldObject* object = NULL; - if (*args) - { - uint64 guid = handler->extractGuidFromLink((char*)args); - if (guid) - object = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT); - - if (!object) - { - handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); - handler->SetSentErrorMessage(true); - return false; - } - } - else - { - object = handler->getSelectedUnit(); - - if (!object) - { - handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); - handler->SetSentErrorMessage(true); - return false; - } - } - - CellCoord cellCoord = Trinity::ComputeCellCoord(object->GetPositionX(), object->GetPositionY()); - Cell cell(cellCoord); - - uint32 zoneId, areaId; - object->GetZoneAndAreaId(zoneId, areaId); - - MapEntry const* mapEntry = sMapStore.LookupEntry(object->GetMapId()); - AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zoneId); - AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaId); - - float zoneX = object->GetPositionX(); - float zoneY = object->GetPositionY(); - - Map2ZoneCoordinates(zoneX, zoneY, zoneId); - - Map const* map = object->GetMap(); - float groundZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT); - float floorZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ()); - - GridCoord gridCoord = Trinity::ComputeGridCoord(object->GetPositionX(), object->GetPositionY()); - - // 63? WHY? - int gridX = 63 - gridCoord.x_coord; - int gridY = 63 - gridCoord.y_coord; - - uint32 haveMap = Map::ExistMap(object->GetMapId(), gridX, gridY) ? 1 : 0; - uint32 haveVMap = Map::ExistVMap(object->GetMapId(), gridX, gridY) ? 1 : 0; - - if (haveVMap) - { - if (map->IsOutdoors(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ())) - handler->PSendSysMessage("You are outdoors"); - else - handler->PSendSysMessage("You are indoors"); - } - else - handler->PSendSysMessage("no VMAP available for area info"); - - handler->PSendSysMessage(LANG_MAP_POSITION, - object->GetMapId(), (mapEntry ? mapEntry->name : "<unknown>"), - zoneId, (zoneEntry ? zoneEntry->area_name : "<unknown>"), - areaId, (areaEntry ? areaEntry->area_name : "<unknown>"), - object->GetPhaseMask(), - object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation(), - cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(), - zoneX, zoneY, groundZ, floorZ, haveMap, haveVMap); - - LiquidData liquidStatus; - ZLiquidStatus status = map->getLiquidStatus(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), MAP_ALL_LIQUIDS, &liquidStatus); - - if (status) - handler->PSendSysMessage(LANG_LIQUID_STATUS, liquidStatus.level, liquidStatus.depth_level, liquidStatus.type, status); - - return true; - } - - static bool HandleWPGPSCommand(ChatHandler* handler, char const* /*args*/) - { - Player* player = handler->GetSession()->GetPlayer(); - - sLog->outSQLDev("(@PATH, XX, %.3f, %.3f, %.5f, 0,0, 0,100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); - - handler->PSendSysMessage("Waypoint SQL written to SQL Developer log"); - return true; - } -}; - -void AddSC_gps_commandscript() -{ - new gps_commandscript(); -} diff --git a/src/server/scripts/Commands/cs_learn.cpp b/src/server/scripts/Commands/cs_learn.cpp index fcabaaa7e5b..ae573577d7e 100644 --- a/src/server/scripts/Commands/cs_learn.cpp +++ b/src/server/scripts/Commands/cs_learn.cpp @@ -248,7 +248,7 @@ public: return false; } - CreatureTemplate const* creatureInfo = pet->GetCreatureInfo(); + CreatureTemplate const* creatureInfo = pet->GetCreatureTemplate(); if (!creatureInfo) { handler->SendSysMessage(LANG_WRONG_PET_TYPE); diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 5f0434e5c55..7c431566f52 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -17,6 +17,9 @@ #include "ScriptPCH.h"
#include "Chat.h"
+#include "ObjectAccessor.h"
+#include "ScriptMgr.h"
+#include "CellImpl.h"
class misc_commandscript : public CommandScript
{
@@ -27,7 +30,8 @@ public: {
static ChatCommand commandTable[] =
{
- { "dev", SEC_ADMINISTRATOR, false, &HandleDevCommand, "", NULL },
+ { "dev", SEC_ADMINISTRATOR, false, &HandleDevCommand, "", NULL },
+ { "gps", SEC_ADMINISTRATOR, false, &HandleGPSCommand, "", NULL },
{ NULL, 0, false, NULL, "", NULL }
};
return commandTable;
@@ -64,6 +68,90 @@ public: handler->SetSentErrorMessage(true);
return false;
}
+
+ static bool HandleGPSCommand(ChatHandler* handler, char const* args)
+ {
+ WorldObject* object = NULL;
+ if (*args)
+ {
+ uint64 guid = handler->extractGuidFromLink((char*)args);
+ if (guid)
+ object = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT);
+
+ if (!object)
+ {
+ handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+ else
+ {
+ object = handler->getSelectedUnit();
+
+ if (!object)
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ CellCoord cellCoord = Trinity::ComputeCellCoord(object->GetPositionX(), object->GetPositionY());
+ Cell cell(cellCoord);
+
+ uint32 zoneId, areaId;
+ object->GetZoneAndAreaId(zoneId, areaId);
+
+ MapEntry const* mapEntry = sMapStore.LookupEntry(object->GetMapId());
+ AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zoneId);
+ AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaId);
+
+ float zoneX = object->GetPositionX();
+ float zoneY = object->GetPositionY();
+
+ Map2ZoneCoordinates(zoneX, zoneY, zoneId);
+
+ Map const* map = object->GetMap();
+ float groundZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT);
+ float floorZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ());
+
+ GridCoord gridCoord = Trinity::ComputeGridCoord(object->GetPositionX(), object->GetPositionY());
+
+ // 63? WHY?
+ int gridX = 63 - gridCoord.x_coord;
+ int gridY = 63 - gridCoord.y_coord;
+
+ uint32 haveMap = Map::ExistMap(object->GetMapId(), gridX, gridY) ? 1 : 0;
+ uint32 haveVMap = Map::ExistVMap(object->GetMapId(), gridX, gridY) ? 1 : 0;
+
+ if (haveVMap)
+ {
+ if (map->IsOutdoors(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ()))
+ handler->PSendSysMessage("You are outdoors");
+ else
+ handler->PSendSysMessage("You are indoors");
+ }
+ else
+ handler->PSendSysMessage("no VMAP available for area info");
+
+ handler->PSendSysMessage(LANG_MAP_POSITION,
+ object->GetMapId(), (mapEntry ? mapEntry->name[handler->GetSessionDbcLocale()] : "<unknown>"),
+ zoneId, (zoneEntry ? zoneEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"),
+ areaId, (areaEntry ? areaEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"),
+ object->GetPhaseMask(),
+ object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation(),
+ cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(),
+ zoneX, zoneY, groundZ, floorZ, haveMap, haveVMap);
+
+ LiquidData liquidStatus;
+ ZLiquidStatus status = map->getLiquidStatus(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), MAP_ALL_LIQUIDS, &liquidStatus);
+
+ if (status)
+ handler->PSendSysMessage(LANG_LIQUID_STATUS, liquidStatus.level, liquidStatus.depth_level, liquidStatus.entry, liquidStatus.type_flags, status);
+
+ return true;
+ }
};
void AddSC_misc_commandscript()
diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index 93aa188c071..0de3637586c 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -33,6 +33,16 @@ public: ChatCommand* GetCommands() const { + static ChatCommand modifyspeedCommandTable[] = + { + { "fly", SEC_MODERATOR, false, &HandleModifyFlyCommand, "", NULL }, + { "all", SEC_MODERATOR, false, &HandleModifyASpeedCommand, "", NULL }, + { "walk", SEC_MODERATOR, false, &HandleModifySpeedCommand, "", NULL }, + { "backwalk", SEC_MODERATOR, false, &HandleModifyBWalkCommand, "", NULL }, + { "swim", SEC_MODERATOR, false, &HandleModifySwimCommand, "", NULL }, + { "", SEC_MODERATOR, false, &HandleModifyASpeedCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; static ChatCommand modifyCommandTable[] = { { "hp", SEC_MODERATOR, false, &HandleModifyHPCommand, "", NULL }, @@ -41,31 +51,28 @@ public: { "runicpower", SEC_MODERATOR, false, &HandleModifyRunicPowerCommand, "", NULL }, { "energy", SEC_MODERATOR, false, &HandleModifyEnergyCommand, "", NULL }, { "money", SEC_MODERATOR, false, &HandleModifyMoneyCommand, "", NULL }, - { "speed", SEC_MODERATOR, false, &HandleModifySpeedCommand, "", NULL }, - { "swim", SEC_MODERATOR, false, &HandleModifySwimCommand, "", NULL }, { "scale", SEC_MODERATOR, false, &HandleModifyScaleCommand, "", NULL }, { "bit", SEC_MODERATOR, false, &HandleModifyBitCommand, "", NULL }, - { "bwalk", SEC_MODERATOR, false, &HandleModifyBWalkCommand, "", NULL }, - { "fly", SEC_MODERATOR, false, &HandleModifyFlyCommand, "", NULL }, - { "aspeed", SEC_MODERATOR, false, &HandleModifyASpeedCommand, "", NULL }, { "faction", SEC_MODERATOR, false, &HandleModifyFactionCommand, "", NULL }, { "spell", SEC_MODERATOR, false, &HandleModifySpellCommand, "", NULL }, - { "tp", SEC_MODERATOR, false, &HandleModifyTalentCommand, "", NULL }, + { "talentpoints", SEC_MODERATOR, false, &HandleModifyTalentCommand, "", NULL }, { "mount", SEC_MODERATOR, false, &HandleModifyMountCommand, "", NULL }, { "honor", SEC_MODERATOR, false, &HandleModifyHonorCommand, "", NULL }, - { "rep", SEC_GAMEMASTER, false, &HandleModifyRepCommand, "", NULL }, - { "arena", SEC_MODERATOR, false, &HandleModifyArenaCommand, "", NULL }, + { "reputation", SEC_GAMEMASTER, false, &HandleModifyRepCommand, "", NULL }, + { "arenapoints", SEC_MODERATOR, false, &HandleModifyArenaCommand, "", NULL }, { "drunk", SEC_MODERATOR, false, &HandleModifyDrunkCommand, "", NULL }, { "standstate", SEC_GAMEMASTER, false, &HandleModifyStandStateCommand, "", NULL }, - { "morph", SEC_GAMEMASTER, false, &HandleModifyMorphCommand, "", NULL }, { "phase", SEC_ADMINISTRATOR, false, &HandleModifyPhaseCommand, "", NULL }, { "gender", SEC_GAMEMASTER, false, &HandleModifyGenderCommand, "", NULL }, { "collision", SEC_GAMEMASTER, false, &HandleModifyCollisionCommand, "", NULL }, + { "speed", SEC_MODERATOR, false, NULL, "", modifyspeedCommandTable }, { NULL, 0, false, NULL, "", NULL } }; static ChatCommand commandTable[] = { - { "modify", SEC_MODERATOR, false, NULL, "", modifyCommandTable }, + { "morph", SEC_GAMEMASTER, false, &HandleModifyMorphCommand, "", NULL }, + { "demorph", SEC_GAMEMASTER, false, &HandleDeMorphCommand, "", NULL }, + { "modify", SEC_MODERATOR, false, NULL, "", modifyCommandTable }, { NULL, 0, false, NULL, "", NULL } }; return commandTable; @@ -361,7 +368,9 @@ public: //Edit Player Spell static bool HandleModifySpellCommand(ChatHandler* handler, const char* args) { - if (!*args) return false; + if (!*args) + return false; + char* pspellflatid = strtok((char*)args, " "); if (!pspellflatid) return false; @@ -710,7 +719,7 @@ public: (ChatHandler(player)).PSendSysMessage(LANG_YOURS_SIZE_CHANGED, handler->GetNameLink().c_str(), Scale); } - target->SetFloatValue(OBJECT_FIELD_SCALE_X, Scale); + target->SetObjectScale(Scale); return true; } @@ -1142,10 +1151,10 @@ public: static bool HandleModifyRepCommand(ChatHandler* handler, const char* args) { - if (!*args) return false; + if (!*args) + return false; Player* target = handler->getSelectedPlayer(); - if (!target) { handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); @@ -1233,7 +1242,7 @@ public: return false; } - target->GetReputationMgr().SetReputation(factionEntry, amount); + target->GetReputationMgr().SetOneFactionReputation(factionEntry, amount, false); handler->PSendSysMessage(LANG_COMMAND_MODIFY_REP, factionEntry->name, factionId, handler->GetNameLink(target).c_str(), target->GetReputationMgr().GetReputation(factionEntry)); return true; @@ -1375,6 +1384,21 @@ public: return true; } +//demorph player or unit + static bool HandleDeMorphCommand(ChatHandler* handler, const char* /*args*/) + { + Unit* target = handler->getSelectedUnit(); + if (!target) + target = handler->GetSession()->GetPlayer(); + + // check online security + else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), 0)) + return false; + + target->DeMorph(); + + return true; + } static bool HandleModifyCollisionCommand(ChatHandler* handler, const char* args) { diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 57932ef56c6..832f7958fc8 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -28,6 +28,7 @@ EndScriptData */ #include "Transport.h" #include "CreatureGroups.h" #include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand +#include "CreatureAI.h" class npc_commandscript : public CommandScript { @@ -73,6 +74,7 @@ public: { "phase", SEC_GAMEMASTER, false, &HandleNpcSetPhaseCommand, "", NULL }, { "spawndist", SEC_GAMEMASTER, false, &HandleNpcSetSpawnDistCommand, "", NULL }, { "spawntime", SEC_GAMEMASTER, false, &HandleNpcSetSpawnTimeCommand, "", NULL }, + { "data", SEC_ADMINISTRATOR, false, &HandleNpcSetDataCommand, "", NULL }, //{ TODO: fix or remove these commands { "name", SEC_GAMEMASTER, false, &HandleNpcSetNameCommand, "", NULL }, { "subname", SEC_GAMEMASTER, false, &HandleNpcSetSubNameCommand, "", NULL }, @@ -108,6 +110,7 @@ public: { if (!*args) return false; + char* charID = handler->extractKeyFromLink((char*)args, "Hcreature_entry"); if (!charID) return false; @@ -130,12 +133,24 @@ public: { uint32 tguid = chr->GetTransport()->AddNPCPassenger(0, id, chr->GetTransOffsetX(), chr->GetTransOffsetY(), chr->GetTransOffsetZ(), chr->GetTransOffsetO()); if (tguid > 0) - WorldDatabase.PExecute("INSERT INTO creature_transport (guid, npc_entry, transport_entry, TransOffsetX, TransOffsetY, TransOffsetZ, TransOffsetO) values (%u, %u, %f, %f, %f, %f, %u)", tguid, id, chr->GetTransport()->GetEntry(), chr->GetTransOffsetX(), chr->GetTransOffsetY(), chr->GetTransOffsetZ(), chr->GetTransOffsetO()); + { + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_CREATURE_TRANSPORT); + + stmt->setInt32(0, int32(tguid)); + stmt->setInt32(1, int32(id)); + stmt->setInt32(2, int32(chr->GetTransport()->GetEntry())); + stmt->setFloat(3, chr->GetTransOffsetX()); + stmt->setFloat(4, chr->GetTransOffsetY()); + stmt->setFloat(5, chr->GetTransOffsetZ()); + stmt->setFloat(6, chr->GetTransOffsetO()); + + WorldDatabase.Execute(stmt); + } return true; } - Creature* creature = new Creature; + Creature* creature = new Creature(); if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, (uint32)teamval, x, y, z, o)) { delete creature; @@ -462,7 +477,7 @@ public: // Faction is set in creature_template - not inside creature // Update in memory.. - if (CreatureTemplate const* cinfo = creature->GetCreatureInfo()) + if (CreatureTemplate const* cinfo = creature->GetCreatureTemplate()) { const_cast<CreatureTemplate*>(cinfo)->faction_A = factionId; const_cast<CreatureTemplate*>(cinfo)->faction_H = factionId; @@ -511,6 +526,39 @@ public: return true; } + //set data of creature for testing scripting + static bool HandleNpcSetDataCommand(ChatHandler* handler, const char* args) + { + if (!*args) + return false; + + char* arg1 = strtok((char*)args, " "); + char* arg2 = strtok((char*)NULL, ""); + + if (!arg1 || !arg2) + return false; + + uint32 data_1 = (uint32)atoi(arg1); + uint32 data_2 = (uint32)atoi(arg2); + + if (!data_1 || !data_2) + return false; + + Creature* creature = handler->getSelectedCreature(); + + if (!creature) + { + handler->SendSysMessage(LANG_SELECT_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + creature->AI()->SetData(data_1, data_2); + std::string AIorScript = creature->GetAIName() != "" ? "AI type: " + creature->GetAIName() : (creature->GetScriptName() != "" ? "Script Name: " + creature->GetScriptName() : "No AI or Script Name Set"); + handler->PSendSysMessage(LANG_NPC_SETDATA, creature->GetGUID(), creature->GetEntry(), creature->GetName(), data_1, data_2, AIorScript.c_str()); + return true; + } + //npc follow handling static bool HandleNpcFollowCommand(ChatHandler* handler, const char* /*args*/) { @@ -547,7 +595,7 @@ public: uint32 displayid = target->GetDisplayId(); uint32 nativeid = target->GetNativeDisplayId(); uint32 Entry = target->GetEntry(); - CreatureTemplate const* cInfo = target->GetCreatureInfo(); + CreatureTemplate const* cInfo = target->GetCreatureTemplate(); int64 curRespawnDelay = target->GetRespawnTimeEx()-time(NULL); if (curRespawnDelay < 0) @@ -677,9 +725,16 @@ public: return false; } - if (target->GetTransport()) - if (target->GetGUIDTransport()) - WorldDatabase.PExecute("UPDATE creature_transport SET emote=%u WHERE transport_entry=%u AND guid=%u", emote, target->GetTransport()->GetEntry(), target->GetGUIDTransport()); + if (target->GetTransport() && target->GetGUIDTransport()) + { + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_TRANSPORT_EMOTE); + + stmt->setInt32(0, int32(emote)); + stmt->setInt32(1, target->GetTransport()->GetEntry()); + stmt->setInt32(2, target->GetGUIDTransport()); + + WorldDatabase.Execute(stmt); + } target->SetUInt32Value(UNIT_NPC_EMOTESTATE, emote); @@ -1036,7 +1091,7 @@ public: } if (/*creature->GetMotionMaster()->empty() ||*/ - creature->GetMotionMaster()->GetCurrentMovementGeneratorType () != FOLLOW_MOTION_TYPE) + creature->GetMotionMaster()->GetCurrentMovementGeneratorType() != FOLLOW_MOTION_TYPE) { handler->PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU, creature->GetName()); handler->SetSentErrorMessage(true); @@ -1131,24 +1186,24 @@ public: //npc tame handling static bool HandleNpcTameCommand(ChatHandler* handler, const char* /*args*/) { - Creature* creatureTarget = handler->getSelectedCreature (); - if (!creatureTarget || creatureTarget->isPet ()) + Creature* creatureTarget = handler->getSelectedCreature(); + if (!creatureTarget || creatureTarget->isPet()) { handler->PSendSysMessage (LANG_SELECT_CREATURE); handler->SetSentErrorMessage (true); return false; } - Player* player = handler->GetSession()->GetPlayer (); + Player* player = handler->GetSession()->GetPlayer(); - if (player->GetPetGUID ()) + if (player->GetPetGUID()) { handler->SendSysMessage (LANG_YOU_ALREADY_HAVE_PET); handler->SetSentErrorMessage (true); return false; } - CreatureTemplate const* cInfo = creatureTarget->GetCreatureInfo(); + CreatureTemplate const* cInfo = creatureTarget->GetCreatureTemplate(); if (!cInfo->isTameable (player->CanTameExoticPets())) { @@ -1168,8 +1223,8 @@ public: // place pet before player float x, y, z; - player->GetClosePoint (x, y, z, creatureTarget->GetObjectSize (), CONTACT_DISTANCE); - pet->Relocate (x, y, z, M_PI-player->GetOrientation ()); + player->GetClosePoint (x, y, z, creatureTarget->GetObjectSize(), CONTACT_DISTANCE); + pet->Relocate(x, y, z, M_PI-player->GetOrientation()); // set pet to defensive mode by default (some classes can't control controlled pets in fact). pet->SetReactState(REACT_DEFENSIVE); @@ -1229,7 +1284,7 @@ public: group_member->leaderGUID = leaderGUID; group_member->groupAI = 0; - CreatureGroupMap[lowguid] = group_member; + sFormationMgr->CreatureGroupMap[lowguid] = group_member; creature->SearchFormation(); PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_CREATURE_FORMATION); diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp index 17c819f2f22..1c119fdef4c 100644 --- a/src/server/scripts/Commands/cs_reload.cpp +++ b/src/server/scripts/Commands/cs_reload.cpp @@ -37,6 +37,7 @@ EndScriptData */ #include "SkillExtraItems.h" #include "Chat.h" #include "WaypointManager.h" +#include "WardenCheckMgr.h" class reload_commandscript : public CommandScript { @@ -105,6 +106,7 @@ public: { "lfg_dungeon_rewards", SEC_ADMINISTRATOR, true, &HandleReloadLfgRewardsCommand, "", NULL }, { "locales_achievement_reward", SEC_ADMINISTRATOR, true, &HandleReloadLocalesAchievementRewardCommand, "", NULL }, { "locales_creature", SEC_ADMINISTRATOR, true, &HandleReloadLocalesCreatureCommand, "", NULL }, + { "locales_creature_text", SEC_ADMINISTRATOR, true, &HandleReloadLocalesCreatureTextCommand, "", NULL }, { "locales_gameobject", SEC_ADMINISTRATOR, true, &HandleReloadLocalesGameobjectCommand, "", NULL }, { "locales_gossip_menu_option", SEC_ADMINISTRATOR, true, &HandleReloadLocalesGossipMenuOptionCommand, "", NULL }, { "locales_item", SEC_ADMINISTRATOR, true, &HandleReloadLocalesItemCommand, "", NULL }, @@ -151,6 +153,7 @@ public: { "spell_threats", SEC_ADMINISTRATOR, true, &HandleReloadSpellThreatsCommand, "", NULL }, { "spell_group_stack_rules", SEC_ADMINISTRATOR, true, &HandleReloadSpellGroupStackRulesCommand, "", NULL }, { "trinity_string", SEC_ADMINISTRATOR, true, &HandleReloadTrinityStringCommand, "", NULL }, + { "warden_action", SEC_ADMINISTRATOR, true, &HandleReloadWardenactionCommand, "", NULL }, { "waypoint_scripts", SEC_ADMINISTRATOR, true, &HandleReloadWpScriptsCommand, "", NULL }, { "waypoint_data", SEC_ADMINISTRATOR, true, &HandleReloadWpCommand, "", NULL }, { "vehicle_accessory", SEC_ADMINISTRATOR, true, &HandleReloadVehicleAccessoryCommand, "", NULL }, @@ -317,6 +320,7 @@ public: { HandleReloadLocalesAchievementRewardCommand(handler, "a"); HandleReloadLocalesCreatureCommand(handler, "a"); + HandleReloadLocalesCreatureTextCommand(handler, "a"); HandleReloadLocalesGameobjectCommand(handler, "a"); HandleReloadLocalesGossipMenuOptionCommand(handler, "a"); HandleReloadLocalesItemCommand(handler, "a"); @@ -409,14 +413,18 @@ public: for (Tokens::const_iterator itr = entries.begin(); itr != entries.end(); ++itr) { uint32 entry = uint32(atoi(*itr)); - QueryResult result = WorldDatabase.PQuery("SELECT difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction_A, faction_H, npcflag, speed_walk, speed_run, scale, rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, InhabitType, Health_mod, Mana_mod, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, questItem6, movementId, RegenHealth, equipment_id, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template WHERE entry = %u", entry); + + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_CREATURE_TEMPLATE); + stmt->setUInt32(0, entry); + PreparedQueryResult result = WorldDatabase.Query(stmt); + if (!result) { handler->PSendSysMessage(LANG_COMMAND_CREATURETEMPLATE_NOTFOUND, entry); continue; } - CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(entry); + CreatureTemplate* cInfo = const_cast<CreatureTemplate*>(sObjectMgr->GetCreatureTemplate(entry)); if (!cInfo) { handler->PSendSysMessage(LANG_COMMAND_CREATURESTORAGE_NOTFOUND, entry); @@ -427,89 +435,88 @@ public: Field* fields = result->Fetch(); - const_cast<CreatureTemplate*>(cInfo)->DifficultyEntry[0] = fields[0].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->DifficultyEntry[1] = fields[1].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->DifficultyEntry[2] = fields[2].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->KillCredit[0] = fields[3].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->KillCredit[1] = fields[4].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->Modelid1 = fields[5].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->Modelid2 = fields[6].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->Modelid3 = fields[7].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->Modelid4 = fields[8].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->Name = fields[9].GetString(); - const_cast<CreatureTemplate*>(cInfo)->SubName = fields[10].GetString(); - const_cast<CreatureTemplate*>(cInfo)->IconName = fields[11].GetString(); - const_cast<CreatureTemplate*>(cInfo)->GossipMenuId = fields[12].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->minlevel = fields[13].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->maxlevel = fields[14].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->expansion = fields[15].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->faction_A = fields[16].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->faction_H = fields[17].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->npcflag = fields[18].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->speed_walk = fields[19].GetFloat(); - const_cast<CreatureTemplate*>(cInfo)->speed_run = fields[20].GetFloat(); - const_cast<CreatureTemplate*>(cInfo)->scale = fields[21].GetFloat(); - const_cast<CreatureTemplate*>(cInfo)->rank = fields[22].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->mindmg = fields[23].GetFloat(); - const_cast<CreatureTemplate*>(cInfo)->maxdmg = fields[24].GetFloat(); - const_cast<CreatureTemplate*>(cInfo)->dmgschool = fields[25].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->attackpower = fields[26].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->dmg_multiplier = fields[27].GetFloat(); - const_cast<CreatureTemplate*>(cInfo)->baseattacktime = fields[28].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->rangeattacktime = fields[29].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->unit_class = fields[30].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->unit_flags = fields[31].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->dynamicflags = fields[32].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->family = fields[33].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->trainer_type = fields[34].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->trainer_spell = fields[35].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->trainer_class = fields[36].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->trainer_race = fields[37].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->minrangedmg = fields[38].GetFloat(); - const_cast<CreatureTemplate*>(cInfo)->maxrangedmg = fields[39].GetFloat(); - const_cast<CreatureTemplate*>(cInfo)->rangedattackpower = fields[40].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->type = fields[41].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->type_flags = fields[42].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->lootid = fields[43].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->pickpocketLootId = fields[44].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->SkinLootId = fields[45].GetUInt32(); + cInfo->DifficultyEntry[0] = fields[0].GetUInt32(); + cInfo->DifficultyEntry[1] = fields[1].GetUInt32(); + cInfo->DifficultyEntry[2] = fields[2].GetUInt32(); + cInfo->KillCredit[0] = fields[3].GetUInt32(); + cInfo->KillCredit[1] = fields[4].GetUInt32(); + cInfo->Modelid1 = fields[5].GetUInt32(); + cInfo->Modelid2 = fields[6].GetUInt32(); + cInfo->Modelid3 = fields[7].GetUInt32(); + cInfo->Modelid4 = fields[8].GetUInt32(); + cInfo->Name = fields[9].GetString(); + cInfo->SubName = fields[10].GetString(); + cInfo->IconName = fields[11].GetString(); + cInfo->GossipMenuId = fields[12].GetUInt32(); + cInfo->minlevel = fields[13].GetUInt8(); + cInfo->maxlevel = fields[14].GetUInt8(); + cInfo->expansion = fields[15].GetUInt16(); + cInfo->faction_A = fields[16].GetUInt16(); + cInfo->faction_H = fields[17].GetUInt16(); + cInfo->npcflag = fields[18].GetUInt32(); + cInfo->speed_walk = fields[19].GetFloat(); + cInfo->speed_run = fields[20].GetFloat(); + cInfo->scale = fields[21].GetFloat(); + cInfo->rank = fields[22].GetUInt8(); + cInfo->mindmg = fields[23].GetFloat(); + cInfo->maxdmg = fields[24].GetFloat(); + cInfo->dmgschool = fields[25].GetUInt8(); + cInfo->attackpower = fields[26].GetUInt32(); + cInfo->dmg_multiplier = fields[27].GetFloat(); + cInfo->baseattacktime = fields[28].GetUInt32(); + cInfo->rangeattacktime = fields[29].GetUInt32(); + cInfo->unit_class = fields[30].GetUInt8(); + cInfo->unit_flags = fields[31].GetUInt32(); + cInfo->dynamicflags = fields[32].GetUInt32(); + cInfo->family = fields[33].GetUInt8(); + cInfo->trainer_type = fields[34].GetUInt8(); + cInfo->trainer_spell = fields[35].GetUInt32(); + cInfo->trainer_class = fields[36].GetUInt8(); + cInfo->trainer_race = fields[37].GetUInt8(); + cInfo->minrangedmg = fields[38].GetFloat(); + cInfo->maxrangedmg = fields[39].GetFloat(); + cInfo->rangedattackpower = fields[40].GetUInt16(); + cInfo->type = fields[41].GetUInt8(); + cInfo->type_flags = fields[42].GetUInt32(); + cInfo->lootid = fields[43].GetUInt32(); + cInfo->pickpocketLootId = fields[44].GetUInt32(); + cInfo->SkinLootId = fields[45].GetUInt32(); for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) - { - const_cast<CreatureTemplate*>(cInfo)->resistance[i] = fields[46 + i -1].GetUInt32(); - } - - const_cast<CreatureTemplate*>(cInfo)->spells[0] = fields[52].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->spells[1] = fields[53].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->spells[2] = fields[54].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->spells[3] = fields[55].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->spells[4] = fields[56].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->spells[5] = fields[57].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->spells[6] = fields[58].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->spells[7] = fields[59].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->PetSpellDataId = fields[60].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->VehicleId = fields[61].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->mingold = fields[62].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->maxgold = fields[63].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->AIName = fields[64].GetString(); - const_cast<CreatureTemplate*>(cInfo)->MovementType = fields[65].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->InhabitType = fields[66].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->ModHealth = fields[67].GetFloat(); - const_cast<CreatureTemplate*>(cInfo)->ModMana = fields[68].GetFloat(); - const_cast<CreatureTemplate*>(cInfo)->ModArmor = fields[69].GetFloat(); - const_cast<CreatureTemplate*>(cInfo)->RacialLeader = fields[70].GetBool(); - const_cast<CreatureTemplate*>(cInfo)->questItems[0] = fields[71].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->questItems[1] = fields[72].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->questItems[2] = fields[73].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->questItems[3] = fields[74].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->questItems[4] = fields[75].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->questItems[5] = fields[76].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->movementId = fields[77].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->RegenHealth = fields[78].GetBool(); - const_cast<CreatureTemplate*>(cInfo)->equipmentId = fields[79].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->MechanicImmuneMask = fields[80].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->flags_extra = fields[81].GetUInt32(); - const_cast<CreatureTemplate*>(cInfo)->ScriptID = sObjectMgr->GetScriptId(fields[82].GetCString()); + cInfo->resistance[i] = fields[46 + i -1].GetUInt16(); + + cInfo->spells[0] = fields[52].GetUInt32(); + cInfo->spells[1] = fields[53].GetUInt32(); + cInfo->spells[2] = fields[54].GetUInt32(); + cInfo->spells[3] = fields[55].GetUInt32(); + cInfo->spells[4] = fields[56].GetUInt32(); + cInfo->spells[5] = fields[57].GetUInt32(); + cInfo->spells[6] = fields[58].GetUInt32(); + cInfo->spells[7] = fields[59].GetUInt32(); + cInfo->PetSpellDataId = fields[60].GetUInt32(); + cInfo->VehicleId = fields[61].GetUInt32(); + cInfo->mingold = fields[62].GetUInt32(); + cInfo->maxgold = fields[63].GetUInt32(); + cInfo->AIName = fields[64].GetString(); + cInfo->MovementType = fields[65].GetUInt8(); + cInfo->InhabitType = fields[66].GetUInt8(); + cInfo->HoverHeight = fields[67].GetFloat(); + cInfo->ModHealth = fields[68].GetFloat(); + cInfo->ModMana = fields[69].GetFloat(); + cInfo->ModArmor = fields[70].GetFloat(); + cInfo->RacialLeader = fields[71].GetBool(); + cInfo->questItems[0] = fields[72].GetUInt32(); + cInfo->questItems[1] = fields[73].GetUInt32(); + cInfo->questItems[2] = fields[74].GetUInt32(); + cInfo->questItems[3] = fields[75].GetUInt32(); + cInfo->questItems[4] = fields[76].GetUInt32(); + cInfo->questItems[5] = fields[77].GetUInt32(); + cInfo->movementId = fields[78].GetUInt32(); + cInfo->RegenHealth = fields[79].GetBool(); + cInfo->equipmentId = fields[80].GetUInt32(); + cInfo->MechanicImmuneMask = fields[81].GetUInt32(); + cInfo->flags_extra = fields[82].GetUInt32(); + cInfo->ScriptID = sObjectMgr->GetScriptId(fields[83].GetCString()); sObjectMgr->CheckCreatureTemplate(cInfo); } @@ -724,6 +731,21 @@ public: return true; } + static bool HandleReloadWardenactionCommand(ChatHandler* handler, const char* /*args*/) + { + if (!sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED)) + { + handler->SendSysMessage("Warden system disabled by config - reloading warden_action skipped."); + handler->SetSentErrorMessage(true); + return false; + } + + sLog->outString("Re-Loading warden_action Table!"); + sWardenCheckMgr->LoadWardenOverrides(); + handler->SendGlobalGMSysMessage("DB table `warden_action` reloaded."); + return true; + } + static bool HandleReloadNpcTrainerCommand(ChatHandler* handler, const char* /*args*/) { sLog->outString("Re-Loading `npc_trainer` Table!"); @@ -1154,6 +1176,14 @@ public: return true; } + static bool HandleReloadLocalesCreatureTextCommand(ChatHandler* handler, const char* /*args*/) + { + sLog->outString("Re-Loading Locales Creature Texts..."); + sCreatureTextMgr->LoadCreatureTextLocales(); + handler->SendGlobalGMSysMessage("DB table `locales_creature_text` reloaded."); + return true; + } + static bool HandleReloadLocalesGameobjectCommand(ChatHandler* handler, const char* /*args*/) { sLog->outString("Re-Loading Locales Gameobject ... "); diff --git a/src/server/scripts/Commands/cs_tele.cpp b/src/server/scripts/Commands/cs_tele.cpp index 5054bd83f32..ca7c3af7fde 100644 --- a/src/server/scripts/Commands/cs_tele.cpp +++ b/src/server/scripts/Commands/cs_tele.cpp @@ -131,12 +131,15 @@ public: target->TeleportTo(target->m_homebindMapId, target->m_homebindX, target->m_homebindY, target->m_homebindZ, target->GetOrientation()); else { - QueryResult resultDB = CharacterDatabase.PQuery("SELECT mapId, zoneId, posX, posY, posZ FROM character_homebind WHERE guid = %u", target_guid); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_HOMEBIND); + stmt->setUInt32(0, target_guid); + PreparedQueryResult resultDB = CharacterDatabase.Query(stmt); + if (resultDB) { Field* fieldsDB = resultDB->Fetch(); - uint32 mapId = fieldsDB[0].GetUInt32(); - uint32 zoneId = fieldsDB[1].GetUInt32(); + uint32 mapId = fieldsDB[0].GetUInt16(); + uint32 zoneId = fieldsDB[1].GetUInt16(); float posX = fieldsDB[2].GetFloat(); float posY = fieldsDB[3].GetFloat(); float posZ = fieldsDB[4].GetFloat(); diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp index 8f5e862555c..99ec263b8f9 100644 --- a/src/server/scripts/Commands/cs_wp.cpp +++ b/src/server/scripts/Commands/cs_wp.cpp @@ -91,7 +91,10 @@ public: pathid = target->GetWaypointPath(); else { - QueryResult result = WorldDatabase.Query("SELECT MAX(id) FROM waypoint_data"); + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_MAX_ID); + + PreparedQueryResult result = WorldDatabase.Query(stmt); + uint32 maxpathid = result->Fetch()->GetInt32(); pathid = maxpathid+1; handler->PSendSysMessage("%s%s|r", "|cff00ff00", "New path started."); @@ -109,7 +112,9 @@ public: return true; } - QueryResult result = WorldDatabase.PQuery("SELECT MAX(point) FROM waypoint_data WHERE id = '%u'", pathid); + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_MAX_POINT); + stmt->setUInt32(0, pathid); + PreparedQueryResult result = WorldDatabase.Query(stmt); if (result) point = (*result)[0].GetUInt32(); @@ -117,7 +122,7 @@ public: Player* player = handler->GetSession()->GetPlayer(); //Map* map = player->GetMap(); - PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_WAYPOINT_DATA); + stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_WAYPOINT_DATA); stmt->setUInt32(0, pathid); stmt->setUInt32(1, point + 1); @@ -173,9 +178,12 @@ public: } guidLow = target->GetDBTableGUIDLow(); - QueryResult result = WorldDatabase.PQuery("SELECT guid FROM creature_addon WHERE guid = '%u'", guidLow); - PreparedStatement* stmt; + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_CREATURE_ADDON_BY_GUID); + + stmt->setUInt32(0, guidLow); + + PreparedQueryResult result = WorldDatabase.Query(stmt); if (result) { @@ -223,6 +231,7 @@ public: sWaypointMgr->ReloadPath(id); return true; } + static bool HandleWpUnLoadCommand(ChatHandler* handler, const char* /*args*/) { @@ -276,7 +285,8 @@ public: std::string show = show_str; // Check - if ((show != "add") && (show != "mod") && (show != "del") && (show != "listid")) return false; + if ((show != "add") && (show != "mod") && (show != "del") && (show != "listid")) + return false; char* arg_id = strtok(NULL, " "); uint32 id = 0; @@ -288,7 +298,9 @@ public: if (id) { - QueryResult result = WorldDatabase.PQuery("SELECT id FROM waypoint_scripts WHERE guid = %u", id); + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_SCRIPT_ID_BY_GUID); + stmt->setUInt32(0, id); + PreparedQueryResult result = WorldDatabase.Query(stmt); if (!result) { @@ -305,10 +317,13 @@ public: } else { - QueryResult result = WorldDatabase.Query("SELECT MAX(guid) FROM waypoint_scripts"); + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_SCRIPTS_MAX_ID); + + PreparedQueryResult result = WorldDatabase.Query(stmt); + id = result->Fetch()->GetUInt32(); - PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_WAYPOINT_SCRIPT); + stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_WAYPOINT_SCRIPT); stmt->setUInt32(0, id + 1); @@ -334,7 +349,9 @@ public: float a8, a9, a10, a11; char const* a7; - QueryResult result = WorldDatabase.PQuery("SELECT guid, delay, command, datalong, datalong2, dataint, x, y, z, o FROM waypoint_scripts WHERE id = %u", id); + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_SCRIPT_BY_ID); + stmt->setUInt32(0, id); + PreparedQueryResult result = WorldDatabase.Query(stmt); if (!result) { @@ -367,7 +384,11 @@ public: { id = atoi(arg_id); - QueryResult result = WorldDatabase.PQuery("SELECT guid FROM waypoint_scripts WHERE guid = %u", id); + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_SCRIPT_ID_BY_GUID); + + stmt->setUInt32(0, id); + + PreparedQueryResult result = WorldDatabase.Query(stmt); if (result) { @@ -445,7 +466,9 @@ public: } else { - QueryResult result = WorldDatabase.PQuery("SELECT id FROM waypoint_scripts WHERE guid='%u'", id); + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_SCRIPT_ID_BY_GUID); + stmt->setUInt32(0, id); + PreparedQueryResult result = WorldDatabase.Query(stmt); if (!result) { @@ -565,7 +588,9 @@ public: // User did select a visual waypoint? // Check the creature - QueryResult result = WorldDatabase.PQuery("SELECT id, point FROM waypoint_data WHERE wpguid = %u", wpGuid); + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_BY_WPGUID); + stmt->setUInt32(0, wpGuid); + PreparedQueryResult result = WorldDatabase.Query(stmt); if (!result) { @@ -576,9 +601,17 @@ public: // Here we search for all waypoints that only differ in one from 1 thousand // (0.001) - There is no other way to compare C++ floats with mySQL floats // See also: http://dev.mysql.com/doc/refman/5.0/en/problems-with-float.html - const char* maxDIFF = "0.01"; - result = WorldDatabase.PQuery("SELECT id, point FROM waypoint_data WHERE (abs(position_x - %f) <= %s) and (abs(position_y - %f) <= %s) and (abs(position_z - %f) <= %s)", - target->GetPositionX(), maxDIFF, target->GetPositionY(), maxDIFF, target->GetPositionZ(), maxDIFF); + std::string maxDiff = "0.01"; + + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_BY_POS); + stmt->setFloat(0, target->GetPositionX()); + stmt->setString(1, maxDiff); + stmt->setFloat(2, target->GetPositionY()); + stmt->setString(3, maxDiff); + stmt->setFloat(4, target->GetPositionZ()); + stmt->setString(5, maxDiff); + PreparedQueryResult result = WorldDatabase.Query(stmt); + if (!result) { handler->PSendSysMessage(LANG_WAYPOINT_NOTFOUNDDBPROBLEM, wpGuid); @@ -605,7 +638,7 @@ public: return false; } - if (show == "del" && target) + if (show == "del") { handler->PSendSysMessage("|cff00ff00DEBUG: wp modify del, PathID: |r|cff00ffff%u|r", pathid); @@ -615,9 +648,12 @@ public: if (wpGuid != 0) { wpCreature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT)); - wpCreature->CombatStop(); - wpCreature->DeleteFromDB(); - wpCreature->AddObjectToRemoveList(); + if (wpCreature) + { + wpCreature->CombatStop(); + wpCreature->DeleteFromDB(); + wpCreature->AddObjectToRemoveList(); + } } PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_WAYPOINT_DATA); @@ -638,7 +674,7 @@ public: return true; } // del - if (show == "move" && target) + if (show == "move") { handler->PSendSysMessage("|cff00ff00DEBUG: wp move, PathID: |r|cff00ffff%u|r", pathid); @@ -652,16 +688,20 @@ public: // Respawn the owner of the waypoints if (wpGuid != 0) { - wpCreature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT)); - wpCreature->CombatStop(); - wpCreature->DeleteFromDB(); - wpCreature->AddObjectToRemoveList(); + wpCreature = map->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT)); + if (wpCreature) + { + wpCreature->CombatStop(); + wpCreature->DeleteFromDB(); + wpCreature->AddObjectToRemoveList(); + } // re-create Creature* wpCreature2 = new Creature; if (!wpCreature2->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), VISUAL_WAYPOINT, 0, 0, chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), chr->GetOrientation())) { handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, VISUAL_WAYPOINT); delete wpCreature2; + wpCreature2 = NULL; return false; } @@ -672,6 +712,7 @@ public: { handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, VISUAL_WAYPOINT); delete wpCreature2; + wpCreature2 = NULL; return false; } //sMapMgr->GetMap(npcCreature->GetMapId())->Add(wpCreature2); @@ -755,7 +796,6 @@ public: } std::string show = show_str; - uint32 Maxpoint; //handler->PSendSysMessage("wpshow - show: %s", show); @@ -770,7 +810,11 @@ public: return false; } - QueryResult result = WorldDatabase.PQuery("SELECT id, point, delay, move_flag, action, action_chance FROM waypoint_data WHERE wpguid = %u", target->GetGUIDLow()); + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_ALL_BY_WPGUID); + + stmt->setUInt32(0, target->GetGUIDLow()); + + PreparedQueryResult result = WorldDatabase.Query(stmt); if (!result) { @@ -802,7 +846,11 @@ public: if (show == "on") { - QueryResult result = WorldDatabase.PQuery("SELECT point, position_x, position_y, position_z FROM waypoint_data WHERE id = '%u'", pathid); + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_POS_BY_ID); + + stmt->setUInt32(0, pathid); + + PreparedQueryResult result = WorldDatabase.Query(stmt); if (!result) { @@ -814,7 +862,11 @@ public: handler->PSendSysMessage("|cff00ff00DEBUG: wp on, PathID: |cff00ffff%u|r", pathid); // Delete all visuals for this NPC - QueryResult result2 = WorldDatabase.PQuery("SELECT wpguid FROM waypoint_data WHERE id = '%u' and wpguid <> 0", pathid); + stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_WPGUID_BY_ID); + + stmt->setUInt32(0, pathid); + + PreparedQueryResult result2 = WorldDatabase.Query(stmt); if (result2) { @@ -897,7 +949,7 @@ public: if (target) { wpCreature->SetDisplayId(target->GetDisplayId()); - wpCreature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5f); + wpCreature->SetObjectScale(0.5f); wpCreature->SetLevel(point > STRONG_MAX_LEVEL ? STRONG_MAX_LEVEL : point); } } @@ -911,7 +963,10 @@ public: { handler->PSendSysMessage("|cff00ff00DEBUG: wp first, GUID: %u|r", pathid); - QueryResult result = WorldDatabase.PQuery("SELECT position_x, position_y, position_z FROM waypoint_data WHERE point='1' AND id = '%u'", pathid); + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_POS_FIRST_BY_ID); + stmt->setUInt32(0, pathid); + PreparedQueryResult result = WorldDatabase.Query(stmt); + if (!result) { handler->PSendSysMessage(LANG_WAYPOINT_NOTFOUND, pathid); @@ -948,7 +1003,7 @@ public: if (target) { creature->SetDisplayId(target->GetDisplayId()); - creature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5f); + creature->SetObjectScale(0.5f); } return true; @@ -958,13 +1013,10 @@ public: { handler->PSendSysMessage("|cff00ff00DEBUG: wp last, PathID: |r|cff00ffff%u|r", pathid); - QueryResult result = WorldDatabase.PQuery("SELECT MAX(point) FROM waypoint_data WHERE id = '%u'", pathid); - if (result) - Maxpoint = (*result)[0].GetUInt32(); - else - Maxpoint = 0; + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_POS_LAST_BY_ID); + stmt->setUInt32(0, pathid); + PreparedQueryResult result = WorldDatabase.Query(stmt); - result = WorldDatabase.PQuery("SELECT position_x, position_y, position_z, orientation FROM waypoint_data WHERE point ='%u' AND id = '%u'", Maxpoint, pathid); if (!result) { handler->PSendSysMessage(LANG_WAYPOINT_NOTFOUNDLAST, pathid); @@ -1000,7 +1052,7 @@ public: if (target) { creature->SetDisplayId(target->GetDisplayId()); - creature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5f); + creature->SetObjectScale(0.5f); } return true; @@ -1008,7 +1060,10 @@ public: if (show == "off") { - QueryResult result = WorldDatabase.PQuery("SELECT guid FROM creature WHERE id = '%u'", 1); + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_CREATURE_BY_ID); + stmt->setUInt32(0, 1); + PreparedQueryResult result = WorldDatabase.Query(stmt); + if (!result) { handler->SendSysMessage(LANG_WAYPOINT_VP_NOTFOUND); @@ -1041,7 +1096,7 @@ public: } while (result->NextRow()); // set "wpguid" column to "empty" - no visual waypoint spawned - PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_ALL_WAYPOINT_DATA_WPGUID); + stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_DATA_ALL_WPGUID); WorldDatabase.Execute(stmt); //WorldDatabase.PExecute("UPDATE creature_movement SET wpguid = '0' WHERE wpguid <> '0'"); diff --git a/src/server/scripts/Custom/CMakeLists.txt b/src/server/scripts/Custom/CMakeLists.txt index 1570ca17312..62abde25905 100644 --- a/src/server/scripts/Custom/CMakeLists.txt +++ b/src/server/scripts/Custom/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/> +# Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> # # This file is free software; as a special exception the author gives # unlimited permission to copy and/or distribute it, with or without diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp index 1292cdaee17..93de16fc80b 100644 --- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp +++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp @@ -139,7 +139,7 @@ public: summons.Summon(summoned); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { summons.DespawnAll(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp index 7ef11e5256a..9375cc33f27 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp @@ -126,11 +126,11 @@ public: InstanceScript* instance; - uint8 EventPhase; + uint8 EventPhase; uint32 Event_Timer; - uint8 MobSpawnId; - uint8 MobCount; + uint8 MobSpawnId; + uint8 MobCount; uint32 MobDeath_Timer; uint64 RingMobGUID[4]; @@ -142,16 +142,16 @@ public: { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - EventPhase = 0; - Event_Timer = 1000; + EventPhase = 0; + Event_Timer = 1000; - MobCount = 0; - MobDeath_Timer = 0; + MobCount = 0; + MobDeath_Timer = 0; for (uint8 i = 0; i < MAX_MOB_AMOUNT; ++i) RingMobGUID[i] = 0; - RingBossGUID = 0; + RingBossGUID = 0; CanWalk = false; } @@ -177,39 +177,39 @@ public: MobDeath_Timer = 2500; } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { - switch (i) + switch (waypointId) { - case 0: - DoScriptText(SCRIPT_TEXT1, me);//2 - CanWalk = false; - Event_Timer = 5000; - break; - case 1: - DoScriptText(SCRIPT_TEXT2, me);//4 - CanWalk = false; - Event_Timer = 5000; - break; - case 2: - CanWalk = false; - break; - case 3: - DoScriptText(SCRIPT_TEXT3, me);//5 - break; - case 4: - DoScriptText(SCRIPT_TEXT4, me);//6 - CanWalk = false; - Event_Timer = 5000; - break; - case 5: - if (instance) - { - instance->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, NPC_GRIMSTONE, me); - instance->SetData(TYPE_RING_OF_LAW, DONE); - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: npc_grimstone: event reached end and set complete."); - } - break; + case 0: + DoScriptText(SCRIPT_TEXT1, me);//2 + CanWalk = false; + Event_Timer = 5000; + break; + case 1: + DoScriptText(SCRIPT_TEXT2, me);//4 + CanWalk = false; + Event_Timer = 5000; + break; + case 2: + CanWalk = false; + break; + case 3: + DoScriptText(SCRIPT_TEXT3, me);//5 + break; + case 4: + DoScriptText(SCRIPT_TEXT4, me);//6 + CanWalk = false; + Event_Timer = 5000; + break; + case 5: + if (instance) + { + instance->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, NPC_GRIMSTONE, me); + instance->SetData(TYPE_RING_OF_LAW, DONE); + sLog->outDebug(LOG_FILTER_TSCR, "TSCR: npc_grimstone: event reached end and set complete."); + } + break; } } @@ -227,16 +227,16 @@ public: { if (MobDeath_Timer <= diff) { - MobDeath_Timer = 2500; + MobDeath_Timer = 2500; if (RingBossGUID) { Creature* boss = Unit::GetCreature(*me, RingBossGUID); if (boss && !boss->isAlive() && boss->isDead()) { - RingBossGUID = 0; - Event_Timer = 5000; - MobDeath_Timer = 0; + RingBossGUID = 0; + Event_Timer = 5000; + MobDeath_Timer = 0; return; } return; @@ -247,7 +247,7 @@ public: Creature* mob = Unit::GetCreature(*me, RingMobGUID[i]); if (mob && !mob->isAlive() && mob->isDead()) { - RingMobGUID[i] = 0; + RingMobGUID[i] = 0; --MobCount; //seems all are gone, so set timer to continue and discontinue this @@ -355,7 +355,7 @@ public: struct mob_phalanxAI : public ScriptedAI { - mob_phalanxAI(Creature* c) : ScriptedAI(c) {} + mob_phalanxAI(Creature* creature) : ScriptedAI(creature) {} uint32 ThunderClap_Timer; uint32 FireballVolley_Timer; @@ -363,9 +363,9 @@ public: void Reset() { - ThunderClap_Timer = 12000; - FireballVolley_Timer = 0; - MightyBlow_Timer = 15000; + ThunderClap_Timer = 12000; + FireballVolley_Timer = 0; + MightyBlow_Timer = 15000; } void UpdateAI(const uint32 diff) @@ -426,7 +426,7 @@ class npc_kharan_mighthammer : public CreatureScript public: npc_kharan_mighthammer() : CreatureScript("npc_kharan_mighthammer") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*Sender*/, uint32 action) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); switch (action) @@ -520,7 +520,7 @@ class npc_lokhtos_darkbargainer : public CreatureScript public: npc_lokhtos_darkbargainer() : CreatureScript("npc_lokhtos_darkbargainer") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*Sender*/, uint32 action) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); if (action == GOSSIP_ACTION_INFO_DEF + 1) @@ -564,7 +564,6 @@ enum DughalQuests QUEST_JAIL_BREAK = 4322 }; -// DELETE THIS IF IT IS NOT NEEDED! #define SAY_DUGHAL_FREE "Thank you, $N! I'm free!!!" #define GOSSIP_DUGHAL "You're free, Dughal! Get out of here!" @@ -585,7 +584,7 @@ public: return dughal_stormwingAI; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 Sender, uint32 action) + bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) { player->PlayerTalkClass->ClearMenus(); if (action == GOSSIP_ACTION_INFO_DEF + 1) @@ -610,20 +609,24 @@ public: struct npc_dughal_stormwingAI : public npc_escortAI { - npc_dughal_stormwingAI(Creature* c) : npc_escortAI(c) {} + npc_dughal_stormwingAI(Creature* creature) : npc_escortAI(creature) {} - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { - switch (i) + switch (waypointId) { - case 0:me->Say(SAY_DUGHAL_FREE, LANG_UNIVERSAL, PlayerGUID); break; - case 1:instance->SetData(DATA_DUGHAL, ENCOUNTER_STATE_OBJECTIVE_COMPLETED);break; - case 2: - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - instance->SetData(DATA_DUGHAL, ENCOUNTER_STATE_ENDED); - break; + case 0: + me->Say(SAY_DUGHAL_FREE, LANG_UNIVERSAL, PlayerGUID); + break; + case 1: + instance->SetData(DATA_DUGHAL, ENCOUNTER_STATE_OBJECTIVE_COMPLETED); + break; + case 2: + me->SetVisible(false); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + instance->SetData(DATA_DUGHAL, ENCOUNTER_STATE_ENDED); + break; } } @@ -634,7 +637,7 @@ public: { if (IsBeingEscorted && killer == me) { - me->SetVisibility(VISIBILITY_OFF); + me->SetVisible(false); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); instance->SetData(DATA_DUGHAL, ENCOUNTER_STATE_ENDED); @@ -646,13 +649,13 @@ public: if (instance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; if ((instance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS || instance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_FAILED || instance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_ENDED)&& instance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_ENDED) { - me->SetVisibility(VISIBILITY_OFF); + me->SetVisible(false); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } else { - me->SetVisibility(VISIBILITY_ON); + me->SetVisible(true); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } @@ -713,78 +716,85 @@ public: bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) { if (quest->GetQuestId() == 4322) - {PlayerStart = player; + { + PlayerStart = player; if (instance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) { - CAST_AI(npc_escort::npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID()); - instance->SetData(DATA_QUEST_JAIL_BREAK, ENCOUNTER_STATE_IN_PROGRESS); - creature->setFaction(11); - } + CAST_AI(npc_escort::npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID()); + instance->SetData(DATA_QUEST_JAIL_BREAK, ENCOUNTER_STATE_IN_PROGRESS); + creature->setFaction(11); } + } return false; } struct npc_marshal_windsorAI : public npc_escortAI { - npc_marshal_windsorAI(Creature* c) : npc_escortAI(c) + npc_marshal_windsorAI(Creature* creature) : npc_escortAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { - switch (i) + switch (waypointId) { - case 1: - me->Say(SAY_WINDSOR_1, LANG_UNIVERSAL, PlayerGUID); - break; - case 7: - me->HandleEmoteCommand(EMOTE_STATE_POINT); - me->Say(SAY_WINDSOR_4_1, LANG_UNIVERSAL, PlayerGUID); - IsOnHold=true; - break; - case 10: - me->setFaction(534); - break; - case 12: - me->Say(SAY_WINDSOR_6, LANG_UNIVERSAL, PlayerGUID); - instance->SetData(DATA_SUPPLY_ROOM, ENCOUNTER_STATE_IN_PROGRESS); - break; - case 13: - me->HandleEmoteCommand(EMOTE_STATE_USESTANDING);//EMOTE_STATE_WORK - break; - case 14: - instance->SetData(DATA_GATE_SR, 0); - me->setFaction(11); - break; - case 16: - me->Say(SAY_WINDSOR_9, LANG_UNIVERSAL, PlayerGUID); - break; - case 17: - me->HandleEmoteCommand(EMOTE_STATE_USESTANDING);//EMOTE_STATE_WORK - break; - case 18: - instance->SetData(DATA_GATE_SC, 0); - break; - case 19: - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SummonCreature(MOB_ENTRY_REGINALD_WINDSOR, 403.61f, -51.71f, -63.92f, 3.600434f, TEMPSUMMON_DEAD_DESPAWN, 0); - instance->SetData(DATA_SUPPLY_ROOM, ENCOUNTER_STATE_ENDED); - break; + case 1: + me->Say(SAY_WINDSOR_1, LANG_UNIVERSAL, PlayerGUID); + break; + case 7: + me->HandleEmoteCommand(EMOTE_STATE_POINT); + me->Say(SAY_WINDSOR_4_1, LANG_UNIVERSAL, PlayerGUID); + IsOnHold = true; + break; + case 10: + me->setFaction(534); + break; + case 12: + me->Say(SAY_WINDSOR_6, LANG_UNIVERSAL, PlayerGUID); + instance->SetData(DATA_SUPPLY_ROOM, ENCOUNTER_STATE_IN_PROGRESS); + break; + case 13: + me->HandleEmoteCommand(EMOTE_STATE_USESTANDING);//EMOTE_STATE_WORK + break; + case 14: + instance->SetData(DATA_GATE_SR, 0); + me->setFaction(11); + break; + case 16: + me->Say(SAY_WINDSOR_9, LANG_UNIVERSAL, PlayerGUID); + break; + case 17: + me->HandleEmoteCommand(EMOTE_STATE_USESTANDING);//EMOTE_STATE_WORK + break; + case 18: + instance->SetData(DATA_GATE_SC, 0); + break; + case 19: + me->SetVisible(false); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SummonCreature(MOB_ENTRY_REGINALD_WINDSOR, 403.61f, -51.71f, -63.92f, 3.600434f, TEMPSUMMON_DEAD_DESPAWN, 0); + instance->SetData(DATA_SUPPLY_ROOM, ENCOUNTER_STATE_ENDED); + break; } } void EnterCombat(Unit* who) - { + { switch (urand(0, 2)) { - case 0: me->Say(SAY_WINDSOR_AGGRO1, LANG_UNIVERSAL, PlayerGUID); break; - case 1: me->Say(SAY_WINDSOR_AGGRO2, LANG_UNIVERSAL, PlayerGUID); break; - case 2: me->Say(SAY_WINDSOR_AGGRO3, LANG_UNIVERSAL, PlayerGUID); break; - } + case 0: + me->Say(SAY_WINDSOR_AGGRO1, LANG_UNIVERSAL, PlayerGUID); + break; + case 1: + me->Say(SAY_WINDSOR_AGGRO2, LANG_UNIVERSAL, PlayerGUID); + break; + case 2: + me->Say(SAY_WINDSOR_AGGRO3, LANG_UNIVERSAL, PlayerGUID); + break; } + } void Reset() {} @@ -795,28 +805,31 @@ public: void UpdateAI(const uint32 diff) { - if (instance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; + if (instance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) + return; + if (instance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_OBJECTIVE_COMPLETED) SetEscortPaused(false); + if (!instance->GetData(DATA_GATE_D) && instance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_NOT_STARTED) - { + { me->Say(SAY_WINDSOR_4_2, LANG_UNIVERSAL, PlayerGUID); instance->SetData(DATA_DUGHAL, ENCOUNTER_STATE_BEFORE_START); - } + } if (instance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_OBJECTIVE_COMPLETED) - { + { me->Say(SAY_WINDSOR_4_3, LANG_UNIVERSAL, PlayerGUID); instance->SetData(DATA_DUGHAL, ENCOUNTER_STATE_ENDED); - } + } if ((instance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS || instance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_FAILED || instance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_ENDED)&& instance->GetData(DATA_SUPPLY_ROOM) == ENCOUNTER_STATE_ENDED) { - me->SetVisibility(VISIBILITY_OFF); + me->SetVisible(false); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } else { - me->SetVisibility(VISIBILITY_ON); + me->SetVisible(true); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } @@ -897,65 +910,65 @@ public: struct npc_marshal_reginald_windsorAI : public npc_escortAI { - npc_marshal_reginald_windsorAI(Creature* c) : npc_escortAI(c) + npc_marshal_reginald_windsorAI(Creature* creature) : npc_escortAI(creature) { } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { - wp=i; - switch (i) + wp = waypointId; + switch (waypointId) { - case 0: - me->setFaction(11); - me->Say(SAY_REGINALD_WINDSOR_0_1, LANG_UNIVERSAL, PlayerGUID); - break; - case 1: - me->Say(SAY_REGINALD_WINDSOR_0_2, LANG_UNIVERSAL, PlayerGUID); - break; - case 7: - me->HandleEmoteCommand(EMOTE_STATE_POINT); - me->Say(SAY_REGINALD_WINDSOR_5_1, LANG_UNIVERSAL, PlayerGUID); - IsOnHold=true; - break; - case 8: - me->Say(SAY_REGINALD_WINDSOR_5_2, LANG_UNIVERSAL, PlayerGUID); - break; - case 11: - me->HandleEmoteCommand(EMOTE_STATE_POINT); - me->Say(SAY_REGINALD_WINDSOR_7_1, LANG_UNIVERSAL, PlayerGUID); - IsOnHold=true; - break; - case 12: - me->Say(SAY_REGINALD_WINDSOR_7_2, LANG_UNIVERSAL, PlayerGUID); - break; - case 13: - me->Say(SAY_REGINALD_WINDSOR_7_3, LANG_UNIVERSAL, PlayerGUID); - break; - case 20: - me->HandleEmoteCommand(EMOTE_STATE_POINT); - me->Say(SAY_REGINALD_WINDSOR_13_1, LANG_UNIVERSAL, PlayerGUID); - IsOnHold=true; - break; - case 21: - me->Say(SAY_REGINALD_WINDSOR_13_3, LANG_UNIVERSAL, PlayerGUID); - break; - case 23: - me->HandleEmoteCommand(EMOTE_STATE_POINT); - me->Say(SAY_REGINALD_WINDSOR_14_1, LANG_UNIVERSAL, PlayerGUID); - IsOnHold=true; - break; - case 24: - me->Say(SAY_REGINALD_WINDSOR_14_2, LANG_UNIVERSAL, PlayerGUID); - break; - case 31: - me->Say(SAY_REGINALD_WINDSOR_20_1, LANG_UNIVERSAL, PlayerGUID); - break; - case 32: - me->Say(SAY_REGINALD_WINDSOR_20_2, LANG_UNIVERSAL, PlayerGUID); - PlayerStart->GroupEventHappens(QUEST_JAIL_BREAK, me); - instance->SetData(DATA_SHILL, ENCOUNTER_STATE_ENDED); - break; + case 0: + me->setFaction(11); + me->Say(SAY_REGINALD_WINDSOR_0_1, LANG_UNIVERSAL, PlayerGUID); + break; + case 1: + me->Say(SAY_REGINALD_WINDSOR_0_2, LANG_UNIVERSAL, PlayerGUID); + break; + case 7: + me->HandleEmoteCommand(EMOTE_STATE_POINT); + me->Say(SAY_REGINALD_WINDSOR_5_1, LANG_UNIVERSAL, PlayerGUID); + IsOnHold=true; + break; + case 8: + me->Say(SAY_REGINALD_WINDSOR_5_2, LANG_UNIVERSAL, PlayerGUID); + break; + case 11: + me->HandleEmoteCommand(EMOTE_STATE_POINT); + me->Say(SAY_REGINALD_WINDSOR_7_1, LANG_UNIVERSAL, PlayerGUID); + IsOnHold=true; + break; + case 12: + me->Say(SAY_REGINALD_WINDSOR_7_2, LANG_UNIVERSAL, PlayerGUID); + break; + case 13: + me->Say(SAY_REGINALD_WINDSOR_7_3, LANG_UNIVERSAL, PlayerGUID); + break; + case 20: + me->HandleEmoteCommand(EMOTE_STATE_POINT); + me->Say(SAY_REGINALD_WINDSOR_13_1, LANG_UNIVERSAL, PlayerGUID); + IsOnHold=true; + break; + case 21: + me->Say(SAY_REGINALD_WINDSOR_13_3, LANG_UNIVERSAL, PlayerGUID); + break; + case 23: + me->HandleEmoteCommand(EMOTE_STATE_POINT); + me->Say(SAY_REGINALD_WINDSOR_14_1, LANG_UNIVERSAL, PlayerGUID); + IsOnHold=true; + break; + case 24: + me->Say(SAY_REGINALD_WINDSOR_14_2, LANG_UNIVERSAL, PlayerGUID); + break; + case 31: + me->Say(SAY_REGINALD_WINDSOR_20_1, LANG_UNIVERSAL, PlayerGUID); + break; + case 32: + me->Say(SAY_REGINALD_WINDSOR_20_2, LANG_UNIVERSAL, PlayerGUID); + PlayerStart->GroupEventHappens(QUEST_JAIL_BREAK, me); + instance->SetData(DATA_SHILL, ENCOUNTER_STATE_ENDED); + break; } } @@ -979,14 +992,20 @@ public: } void EnterCombat(Unit* who) - { + { switch (urand(0, 2)) { - case 0: me->Say(SAY_WINDSOR_AGGRO1, LANG_UNIVERSAL, PlayerGUID); break; - case 1: me->Say(SAY_WINDSOR_AGGRO2, LANG_UNIVERSAL, PlayerGUID); break; - case 2: me->Say(SAY_WINDSOR_AGGRO3, LANG_UNIVERSAL, PlayerGUID); break; - } + case 0: + me->Say(SAY_WINDSOR_AGGRO1, LANG_UNIVERSAL, PlayerGUID); + break; + case 1: + me->Say(SAY_WINDSOR_AGGRO2, LANG_UNIVERSAL, PlayerGUID); + break; + case 2: + me->Say(SAY_WINDSOR_AGGRO3, LANG_UNIVERSAL, PlayerGUID); + break; } + } void Reset() {} void JustDied(Unit* slayer) @@ -996,47 +1015,49 @@ public: void UpdateAI(const uint32 diff) { - if (instance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; + if (instance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) + return; + if (wp == 7) - { + { if (!instance->GetData(DATA_GATE_J) && instance->GetData(DATA_JAZ) == ENCOUNTER_STATE_NOT_STARTED) - { - instance->SetData(DATA_CREATURE_JAZ, 1); - instance->SetData(DATA_JAZ, ENCOUNTER_STATE_IN_PROGRESS); - } + { + instance->SetData(DATA_CREATURE_JAZ, 1); + instance->SetData(DATA_JAZ, ENCOUNTER_STATE_IN_PROGRESS); + } if (instance->GetData(DATA_CREATURE_JAZ) && instance->GetData(DATA_CREATURE_OGRABISI) && instance->GetData(DATA_JAZ) == ENCOUNTER_STATE_IN_PROGRESS) - { - SetEscortPaused(false); - instance->SetData(DATA_JAZ, ENCOUNTER_STATE_ENDED); - } + { + SetEscortPaused(false); + instance->SetData(DATA_JAZ, ENCOUNTER_STATE_ENDED); } + } else if (wp == 11) - { + { if (!instance->GetData(DATA_GATE_S) && instance->GetData(DATA_SHILL) == ENCOUNTER_STATE_NOT_STARTED) - { - instance->SetData(DATA_CREATURE_SHILL, 1); - instance->SetData(DATA_SHILL, ENCOUNTER_STATE_IN_PROGRESS); - } + { + instance->SetData(DATA_CREATURE_SHILL, 1); + instance->SetData(DATA_SHILL, ENCOUNTER_STATE_IN_PROGRESS); + } if (instance->GetData(DATA_CREATURE_SHILL) && instance->GetData(DATA_SHILL) == ENCOUNTER_STATE_IN_PROGRESS) - { - instance->SetData(DATA_SHILL, ENCOUNTER_STATE_ENDED); - SetEscortPaused(false); - } + { + instance->SetData(DATA_SHILL, ENCOUNTER_STATE_ENDED); + SetEscortPaused(false); } + } else if (wp == 20) - { + { if (!instance->GetData(DATA_GATE_C) && instance->GetData(DATA_CREST) == ENCOUNTER_STATE_NOT_STARTED) - { - instance->SetData(DATA_CREATURE_CREST, 1); - me->Say(SAY_REGINALD_WINDSOR_13_2, LANG_UNIVERSAL, PlayerGUID); - instance->SetData(DATA_CREST, ENCOUNTER_STATE_IN_PROGRESS); - } + { + instance->SetData(DATA_CREATURE_CREST, 1); + me->Say(SAY_REGINALD_WINDSOR_13_2, LANG_UNIVERSAL, PlayerGUID); + instance->SetData(DATA_CREST, ENCOUNTER_STATE_IN_PROGRESS); + } if (instance->GetData(DATA_CREATURE_CREST) && instance->GetData(DATA_CREST) == ENCOUNTER_STATE_IN_PROGRESS) - { - SetEscortPaused(false); - instance->SetData(DATA_CREST, ENCOUNTER_STATE_ENDED); - } + { + SetEscortPaused(false); + instance->SetData(DATA_CREST, ENCOUNTER_STATE_ENDED); } + } if (instance->GetData(DATA_TOBIAS) == ENCOUNTER_STATE_OBJECTIVE_COMPLETED) SetEscortPaused(false); npc_escortAI::UpdateAI(diff); } @@ -1046,6 +1067,7 @@ public: // npc_tobias_seecher #define SAY_TOBIAS_FREE "Thank you! I will run for safety immediately!" + /* class npc_tobias_seecher : public CreatureScript { @@ -1065,7 +1087,7 @@ public: return tobias_seecherAI; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 Sender, uint32 action) + bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) { player->PlayerTalkClass->ClearMenus(); if (action == GOSSIP_ACTION_INFO_DEF + 1) @@ -1090,7 +1112,7 @@ public: struct npc_tobias_seecherAI : public npc_escortAI { - npc_tobias_seecherAI(Creature* c) :npc_escortAI(c) {} + npc_tobias_seecherAI(Creature* creature) : npc_escortAI(creature) {} void EnterCombat(Unit* who) {} void Reset() {} @@ -1099,41 +1121,46 @@ public: { if (IsBeingEscorted && killer == me) { - me->SetVisibility(VISIBILITY_OFF); + me->SetVisible(false); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); instance->SetData(DATA_TOBIAS, ENCOUNTER_STATE_ENDED); } } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { - switch (i) + switch (waypointId) { - case 0:me->Say(SAY_TOBIAS_FREE, LANG_UNIVERSAL, PlayerGUID); break; - case 2: - instance->SetData(DATA_TOBIAS, ENCOUNTER_STATE_OBJECTIVE_COMPLETED);break; - case 4: - me->SetVisibility(VISIBILITY_OFF); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - instance->SetData(DATA_TOBIAS, ENCOUNTER_STATE_ENDED); - break; + case 0: + me->Say(SAY_TOBIAS_FREE, LANG_UNIVERSAL, PlayerGUID); + break; + case 2: + instance->SetData(DATA_TOBIAS, ENCOUNTER_STATE_OBJECTIVE_COMPLETED); + break; + case 4: + me->SetVisible(false); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + instance->SetData(DATA_TOBIAS, ENCOUNTER_STATE_ENDED); + break; } } void UpdateAI(const uint32 diff) { - if (instance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; + if (instance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) + return; + if ((instance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS || instance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_FAILED || instance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_ENDED)&& instance->GetData(DATA_TOBIAS) == ENCOUNTER_STATE_ENDED) { - me->SetVisibility(VISIBILITY_OFF); + me->SetVisible(false); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } else { - me->SetVisibility(VISIBILITY_ON); + me->SetVisible(true); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } @@ -1217,8 +1244,8 @@ public: if (HasEscortState(STATE_ESCORT_ESCORTING)) return; - BreakKeg_Timer = 0; - BreakDoor_Timer = 0; + BreakKeg_Timer = 0; + BreakDoor_Timer = 0; } void DoGo(uint32 id, uint32 state) @@ -1227,29 +1254,29 @@ public: go->SetGoState((GOState)state); } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { if (!instance) return; - switch (i) + switch (waypointId) { - case 1: - me->HandleEmoteCommand(EMOTE_ONESHOT_KICK); - break; - case 2: - me->HandleEmoteCommand(EMOTE_ONESHOT_ATTACK_UNARMED); - break; - case 3: - me->HandleEmoteCommand(EMOTE_ONESHOT_ATTACK_UNARMED); - break; - case 4: - me->HandleEmoteCommand(EMOTE_ONESHOT_KICK); - break; - case 5: - me->HandleEmoteCommand(EMOTE_ONESHOT_KICK); - BreakKeg_Timer = 2000; - break; + case 1: + me->HandleEmoteCommand(EMOTE_ONESHOT_KICK); + break; + case 2: + me->HandleEmoteCommand(EMOTE_ONESHOT_ATTACK_UNARMED); + break; + case 3: + me->HandleEmoteCommand(EMOTE_ONESHOT_ATTACK_UNARMED); + break; + case 4: + me->HandleEmoteCommand(EMOTE_ONESHOT_KICK); + break; + case 5: + me->HandleEmoteCommand(EMOTE_ONESHOT_KICK); + BreakKeg_Timer = 2000; + break; } } @@ -1263,8 +1290,8 @@ public: if (BreakKeg_Timer <= diff) { DoGo(DATA_GO_BAR_KEG, 0); - BreakKeg_Timer = 0; - BreakDoor_Timer = 1000; + BreakKeg_Timer = 0; + BreakDoor_Timer = 1000; } else BreakKeg_Timer -= diff; } diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp index 2e8dc029d44..ff0f1a4cedd 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp @@ -42,8 +42,8 @@ public: void Reset() { - FireBlast_Timer = 2000; - Spirit_Timer = 24000; + FireBlast_Timer = 2000; + Spirit_Timer = 24000; } void EnterCombat(Unit* /*who*/) {} diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp index b4a4c416693..2585796e28e 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp @@ -49,11 +49,11 @@ public: void Reset() { - ShadowBolt_Timer = 7000; - CurseOfTongues_Timer = 24000; - CurseOfWeakness_Timer = 12000; - DemonArmor_Timer = 3000; - EnvelopingWeb_Timer = 16000; + ShadowBolt_Timer = 7000; + CurseOfTongues_Timer = 24000; + CurseOfWeakness_Timer = 12000; + DemonArmor_Timer = 3000; + EnvelopingWeb_Timer = 16000; } void EnterCombat(Unit* /*who*/) {} diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp index e894fd35bd1..073c4fde82a 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp @@ -55,9 +55,9 @@ public: void Reset() { - HandOfThaurissan_Timer = 4000; - AvatarOfFlame_Timer = 25000; - //Counter = 0; + HandOfThaurissan_Timer = 4000; + AvatarOfFlame_Timer = 25000; + //Counter= 0; } void EnterCombat(Unit* /*who*/) @@ -71,7 +71,7 @@ public: DoScriptText(SAY_SLAY, me); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { if (Creature* Moira = ObjectAccessor::GetCreature(*me, instance ? instance->GetData64(DATA_MOIRA) : 0)) { @@ -100,7 +100,7 @@ public: //else //{ HandOfThaurissan_Timer = 5000; - //Counter = 0; + //Counter = 0; //} } else HandOfThaurissan_Timer -= diff; diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp index 69808386423..703f684cc9f 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp @@ -47,11 +47,11 @@ public: void Reset() { - MightyBlow_Timer = 8000; - HamString_Timer = 12000; - Cleave_Timer = 16000; - Adds_Timer = 0; - Medics = false; + MightyBlow_Timer = 8000; + HamString_Timer = 12000; + Cleave_Timer = 16000; + Adds_Timer = 0; + Medics = false; } void EnterCombat(Unit* /*who*/) {} diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_gorosh_the_dervish.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_gorosh_the_dervish.cpp index 883c601709e..b2c93d949c2 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_gorosh_the_dervish.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_gorosh_the_dervish.cpp @@ -43,8 +43,8 @@ public: void Reset() { - WhirlWind_Timer = 12000; - MortalStrike_Timer = 22000; + WhirlWind_Timer = 12000; + MortalStrike_Timer = 22000; } void EnterCombat(Unit* /*who*/) diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp index 7686ece3c2e..63d945ade90 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp @@ -43,8 +43,8 @@ public: void Reset() { - GroundTremor_Timer = 12000; - Frenzy_Timer = 0; + GroundTremor_Timer = 12000; + Frenzy_Timer =0; } void EnterCombat(Unit* /*who*/) {} diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_high_interrogator_gerstahn.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_high_interrogator_gerstahn.cpp index 26e2bc80eb2..f4f245be4be 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_high_interrogator_gerstahn.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_high_interrogator_gerstahn.cpp @@ -47,10 +47,10 @@ public: void Reset() { - ShadowWordPain_Timer = 4000; - ManaBurn_Timer = 14000; - PsychicScream_Timer = 32000; - ShadowShield_Timer = 8000; + ShadowWordPain_Timer = 4000; + ManaBurn_Timer = 14000; + PsychicScream_Timer = 32000; + ShadowShield_Timer = 8000; } void EnterCombat(Unit* /*who*/) {} diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp index 141b8307b7b..3d2cc627145 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp @@ -48,8 +48,8 @@ public: void Reset() { - FieryBurst_Timer = 5000; - WarStomp_Timer = 0; + FieryBurst_Timer = 5000; + WarStomp_Timer =0; } void EnterCombat(Unit* /*who*/) {} @@ -80,9 +80,9 @@ public: DoMeleeAttackIfReady(); } // When he die open door to last chamber - void JustDied(Unit* who) + void JustDied(Unit* killer) { - if (InstanceScript* instance = who->GetInstanceScript()) + if (InstanceScript* instance = killer->GetInstanceScript()) instance->HandleGameObject(instance->GetData64(DATA_THRONE_DOOR), true); } }; diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp index 72a60daea2d..e6f65ab4252 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp @@ -49,10 +49,10 @@ public: void Reset() { - Heal_Timer = 12000; // These times are probably wrong - MindBlast_Timer = 16000; - ShadowWordPain_Timer = 2000; - Smite_Timer = 8000; + Heal_Timer = 12000; //These times are probably wrong + MindBlast_Timer = 16000; + ShadowWordPain_Timer = 2000; + Smite_Timer = 8000; } void EnterCombat(Unit* /*who*/) {} diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp index 3c8d5fc4fa8..211930e4f1a 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp @@ -45,7 +45,7 @@ class boss_gloomrel : public CreatureScript public: boss_gloomrel() : CreatureScript("boss_gloomrel") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*Sender*/, uint32 action) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); switch (action) @@ -104,7 +104,7 @@ class boss_doomrel : public CreatureScript public: boss_doomrel() : CreatureScript("boss_doomrel") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*Sender*/, uint32 action) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); switch (action) @@ -156,11 +156,11 @@ public: void Reset() { - ShadowVolley_Timer = 10000; - Immolate_Timer = 18000; - CurseOfWeakness_Timer = 5000; - DemonArmor_Timer = 16000; - Voidwalkers = false; + ShadowVolley_Timer = 10000; + Immolate_Timer = 18000; + CurseOfWeakness_Timer = 5000; + DemonArmor_Timer = 16000; + Voidwalkers = false; me->setFaction(FACTION_FRIEND); @@ -193,7 +193,7 @@ public: instance->SetData64(DATA_EVENSTARTER, 0); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { if (instance) instance->SetData(DATA_GHOSTKILL, 1); diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp index 2ef3ef48ecb..03cb077936b 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp @@ -115,57 +115,57 @@ public: { memset(&encounter, 0, sizeof(encounter)); - EmperorGUID = 0; - PhalanxGUID = 0; - MagmusGUID = 0; - MoiraGUID = 0; - - GoArena1GUID = 0; - GoArena2GUID = 0; - GoArena3GUID = 0; - GoArena4GUID = 0; - GoShadowLockGUID = 0; - GoShadowMechGUID = 0; - GoShadowGiantGUID = 0; - GoShadowDummyGUID = 0; - GoBarKegGUID = 0; - GoBarKegTrapGUID = 0; - GoBarDoorGUID = 0; - GoTombEnterGUID = 0; - GoTombExitGUID = 0; - GoLyceumGUID = 0; - GoSFSGUID = 0; - GoSFNGUID = 0; - GoGolemNGUID = 0; - GoGolemSGUID = 0; - GoThroneGUID = 0; - GoChestGUID = 0; - GoSpectralChaliceGUID = 0; - - BarAleCount = 0; - GhostKillCount = 0; - TombEventStarterGUID = 0; + EmperorGUID = 0; + PhalanxGUID = 0; + MagmusGUID = 0; + MoiraGUID = 0; + + GoArena1GUID = 0; + GoArena2GUID = 0; + GoArena3GUID = 0; + GoArena4GUID = 0; + GoShadowLockGUID = 0; + GoShadowMechGUID = 0; + GoShadowGiantGUID = 0; + GoShadowDummyGUID = 0; + GoBarKegGUID = 0; + GoBarKegTrapGUID = 0; + GoBarDoorGUID = 0; + GoTombEnterGUID = 0; + GoTombExitGUID = 0; + GoLyceumGUID = 0; + GoSFSGUID = 0; + GoSFNGUID = 0; + GoGolemNGUID = 0; + GoGolemSGUID = 0; + GoThroneGUID = 0; + GoChestGUID = 0; + GoSpectralChaliceGUID = 0; + + BarAleCount = 0; + GhostKillCount = 0; + TombEventStarterGUID = 0; TombTimer = TIMER_TOMBOFTHESEVEN; - TombEventCounter = 0; + TombEventCounter = 0; for (uint8 i = 0; i < 7; ++i) - TombBossGUIDs[i] = 0; + TombBossGUIDs[i] = 0; } void OnCreatureCreate(Creature* creature) { switch (creature->GetEntry()) { - case NPC_EMPEROR: EmperorGUID = creature->GetGUID(); break; - case NPC_PHALANX: PhalanxGUID = creature->GetGUID(); break; - case NPC_MOIRA: MoiraGUID = creature->GetGUID(); break; - case NPC_DOOMREL: TombBossGUIDs[0] = creature->GetGUID(); break; - case NPC_DOPEREL: TombBossGUIDs[1] = creature->GetGUID(); break; - case NPC_HATEREL: TombBossGUIDs[2] = creature->GetGUID(); break; - case NPC_VILEREL: TombBossGUIDs[3] = creature->GetGUID(); break; - case NPC_SEETHREL: TombBossGUIDs[4] = creature->GetGUID(); break; - case NPC_GLOOMREL: TombBossGUIDs[5] = creature->GetGUID(); break; - case NPC_ANGERREL: TombBossGUIDs[6] = creature->GetGUID(); break; + case NPC_EMPEROR: EmperorGUID = creature->GetGUID(); break; + case NPC_PHALANX: PhalanxGUID = creature->GetGUID(); break; + case NPC_MOIRA: MoiraGUID = creature->GetGUID(); break; + case NPC_DOOMREL: TombBossGUIDs[0] = creature->GetGUID(); break; + case NPC_DOPEREL: TombBossGUIDs[1] = creature->GetGUID(); break; + case NPC_HATEREL: TombBossGUIDs[2] = creature->GetGUID(); break; + case NPC_VILEREL: TombBossGUIDs[3] = creature->GetGUID(); break; + case NPC_SEETHREL: TombBossGUIDs[4] = creature->GetGUID(); break; + case NPC_GLOOMREL: TombBossGUIDs[5] = creature->GetGUID(); break; + case NPC_ANGERREL: TombBossGUIDs[6] = creature->GetGUID(); break; case NPC_MAGMUS: MagmusGUID = creature->GetGUID(); if (!creature->isAlive()) diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h b/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h index e51c6b9130d..0af2af948d3 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h @@ -33,7 +33,8 @@ enum Data DATA_WARCHIEF_REND_BLACKHAND, DATA_GYTH, DATA_THE_BEAST, - DATA_GENERAL_DRAKKISATH + DATA_GENERAL_DRAKKISATH, + DATA_DRAGONSPIRE_ROOM, }; enum Npc { @@ -51,17 +52,51 @@ enum Npc NPC_GYTH = 10339, NPC_THE_BEAST = 10430, NPC_GENERAL_DRAKKISATH = 10363, + NPC_BLACKHAND_DREADWEAVER = 9817, + NPC_BLACKHAND_SUMMONER = 9818, + NPC_BLACKHAND_VETERAN = 9819, }; enum AdditionalData { SPELL_SUMMON_ROOKERY_WHELP = 15745, MAX_ENCOUNTER = 14, + MAX_DRAGONSPIRE_HALL_RUNES = 7, + EVENT_PYROGUARD_EMBERSEER = 4884, + AREATRIGGER_ENTER_UBRS = 2046, + AREATRIGGER_STADIUM = 2026, }; enum GameObjects { - GO_WHELP_SPAWNER = 175622, //trap spawned by go id 175124 + GO_WHELP_SPAWNER = 175622, // trap spawned by go id 175124 + + // Doors + GO_EMBERSEER_IN = 175244, // First door to Pyroguard Emberseer + GO_DOORS = 175705, // Second door to Pyroguard Emberseer + GO_EMBERSEER_OUT = 175153, // Door after Pyroguard Emberseer event + GO_GYTH_ENTRY_DOOR = 164726, + GO_GYTH_COMBAT_DOOR = 175185, + GO_GYTH_EXIT_DOOR = 175186, + GO_DRAKKISATH_DOOR_1 = 175946, + GO_DRAKKISATH_DOOR_2 = 175947, + + // Runes + GO_ROOM_1_RUNE = 175197, + GO_ROOM_2_RUNE = 175199, + GO_ROOM_3_RUNE = 175195, + GO_ROOM_4_RUNE = 175200, + GO_ROOM_5_RUNE = 175198, + GO_ROOM_6_RUNE = 175196, + GO_ROOM_7_RUNE = 175194, + + GO_EMBERSEER_RUNE_1 = 175266, + GO_EMBERSEER_RUNE_2 = 175267, + GO_EMBERSEER_RUNE_3 = 175268, + GO_EMBERSEER_RUNE_4 = 175269, + GO_EMBERSEER_RUNE_5 = 175270, + GO_EMBERSEER_RUNE_6 = 175271, + GO_EMBERSEER_RUNE_7 = 175272, }; #endif diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_drakkisath.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_drakkisath.cpp index ff17e989cd9..ff40094debd 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_drakkisath.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_drakkisath.cpp @@ -64,7 +64,7 @@ public: events.ScheduleEvent(EVENT_THUNDERCLAP, 17 * IN_MILLISECONDS); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { _JustDied(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_gyth.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_gyth.cpp index 0d8cabcf89c..214ce4e02f3 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_gyth.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_gyth.cpp @@ -79,7 +79,7 @@ public: events.ScheduleEvent(EVENT_AGGRO, 60 * IN_MILLISECONDS); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { _JustDied(); } @@ -117,7 +117,7 @@ public: // Interrupt any spell casting me->InterruptNonMeleeSpells(false); // Gyth model - me->SetDisplayId(me->GetCreatureInfo()->Modelid1); + me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); me->SummonCreature(NPC_WARCHIEF_REND_BLACKHAND, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 900 * IN_MILLISECONDS); events.ScheduleEvent(EVENT_CORROSIVE_ACID, 8 * IN_MILLISECONDS); events.ScheduleEvent(EVENT_FREEZE, 11 * IN_MILLISECONDS); diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_halycon.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_halycon.cpp index a944ee6daf8..c5d566c51cb 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_halycon.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_halycon.cpp @@ -63,7 +63,7 @@ public: events.ScheduleEvent(EVENT_MIGHTY_BLOW, 14 * IN_MILLISECONDS); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { _JustDied(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_highlord_omokk.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_highlord_omokk.cpp index bc9de52d91d..027952dc74a 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_highlord_omokk.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_highlord_omokk.cpp @@ -73,7 +73,7 @@ public: events.ScheduleEvent(EVENT_SLOW, 24 * IN_MILLISECONDS); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { _JustDied(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_mother_smolderweb.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_mother_smolderweb.cpp index 973ffe7e53b..c455b1d404d 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_mother_smolderweb.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_mother_smolderweb.cpp @@ -59,7 +59,7 @@ public: events.ScheduleEvent(EVENT_MOTHERS_MILK, 10 * IN_MILLISECONDS); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { _JustDied(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_overlord_wyrmthalak.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_overlord_wyrmthalak.cpp index b7492998d56..0c23f55bd39 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_overlord_wyrmthalak.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_overlord_wyrmthalak.cpp @@ -77,7 +77,7 @@ public: events.ScheduleEvent(EVENT_KNOCK_AWAY, 12 * IN_MILLISECONDS); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { _JustDied(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp index d76d0d7f47c..0279f3e2834 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp @@ -20,11 +20,24 @@ #include "ScriptedCreature.h" #include "blackrock_spire.h" +enum Text +{ + EMOTE_ONE_STACK = 0, + EMOTE_TEN_STACK = 1, + EMOTE_FREE_OF_BONDS = 2, + YELL_FREE_OF_BONDS = 3, +}; + enum Spells { - SPELL_FIRENOVA = 23462, - SPELL_FLAMEBUFFET = 23341, - SPELL_PYROBLAST = 17274, + SPELL_ENCAGED_EMBERSEER = 15282, // Self on spawn + SPELL_FIRE_SHIELD_TRIGGER = 13377, // Self on spawn missing from 335 dbc + SPELL_FREEZE_ANIM = 16245, // Self on event start + SPELL_EMBERSEER_GROWING = 16048, // Self on event start + SPELL_EMBERSEER_FULL_STRENGTH = 16047, // Emberseer Full Strength + SPELL_FIRENOVA = 23462, // Combat + SPELL_FLAMEBUFFET = 23341, // Combat + SPELL_PYROBLAST = 17274, // Combat }; enum Events @@ -51,6 +64,12 @@ public: void Reset() { + if(instance->GetBossState(DATA_PYROGAURD_EMBERSEER) == IN_PROGRESS) + OpenDoors(false); + instance->SetBossState(DATA_PYROGAURD_EMBERSEER,NOT_STARTED); + // respawn any dead Blackhand Incarcerators + DoCast(me, SPELL_ENCAGED_EMBERSEER); + //DoCast(me, SPELL_FIRE_SHIELD_TRIGGER); _Reset(); } @@ -62,14 +81,28 @@ public: events.ScheduleEvent(EVENT_PYROBLAST, 14 * IN_MILLISECONDS); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { + instance->SetBossState(DATA_PYROGAURD_EMBERSEER,DONE); + OpenDoors(true); _JustDied(); } + void OpenDoors(bool Boss_Killed) + { + if (GameObject* door1 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_IN))) + door1->SetGoState(GO_STATE_ACTIVE); + if (GameObject* door2 = me->GetMap()->GetGameObject(instance->GetData64(GO_DOORS))) + door2->SetGoState(GO_STATE_ACTIVE); + if (Boss_Killed) + if (GameObject* door3 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_OUT))) + door3->SetGoState(GO_STATE_ACTIVE); + } + void UpdateAI(uint32 const diff) { if (!UpdateVictim()) + return; events.Update(diff); diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_quartermaster_zigris.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_quartermaster_zigris.cpp index 4fb7e513f5d..d1eb60fbb71 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_quartermaster_zigris.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_quartermaster_zigris.cpp @@ -60,7 +60,7 @@ public: events.ScheduleEvent(EVENT_STUN_BOMB, 16 * IN_MILLISECONDS); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { _JustDied(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_rend_blackhand.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_rend_blackhand.cpp index ce19a03571a..1f7e3697a6d 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_rend_blackhand.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_rend_blackhand.cpp @@ -61,7 +61,7 @@ public: events.ScheduleEvent(EVENT_THUNDERCLAP, 9 * IN_MILLISECONDS); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { _JustDied(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_shadow_hunter_voshgajin.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_shadow_hunter_voshgajin.cpp index f93466cbece..99e87dc617b 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_shadow_hunter_voshgajin.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_shadow_hunter_voshgajin.cpp @@ -62,7 +62,7 @@ public: events.ScheduleEvent(EVENT_CLEAVE, 14 * IN_MILLISECONDS); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { _JustDied(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_the_beast.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_the_beast.cpp index 88a09d57138..843679b460d 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_the_beast.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_the_beast.cpp @@ -61,7 +61,7 @@ public: events.ScheduleEvent(EVENT_TERRIFYING_ROAR, 23 * IN_MILLISECONDS); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { _JustDied(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_warmaster_voone.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_warmaster_voone.cpp index 2dc05799e51..a3891ef8590 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_warmaster_voone.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_warmaster_voone.cpp @@ -70,7 +70,7 @@ public: events.ScheduleEvent(EVENT_THROW_AXE, 1 * IN_MILLISECONDS); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { _JustDied(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp index ff97984fa09..fdb73fe1196 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp @@ -49,6 +49,12 @@ public: uint64 Gyth; uint64 TheBeast; uint64 GeneralDrakkisath; + uint64 go_emberseerin; + uint64 go_doors; + uint64 go_emberseerout; + uint64 go_roomrunes[MAX_DRAGONSPIRE_HALL_RUNES]; + uint8 Runemaxprotectors[MAX_DRAGONSPIRE_HALL_RUNES]; + uint8 Runeprotectorsdead[MAX_DRAGONSPIRE_HALL_RUNES]; void Initialize() { @@ -67,6 +73,9 @@ public: Gyth = 0; TheBeast = 0; GeneralDrakkisath = 0; + go_emberseerin = 0; + go_doors = 0; + go_emberseerout = 0; } bool IsEncounterInProgress() const @@ -125,7 +134,11 @@ public: case NPC_GENERAL_DRAKKISATH: GeneralDrakkisath = creature->GetGUID(); break; - } + case NPC_BLACKHAND_DREADWEAVER: + case NPC_BLACKHAND_SUMMONER: + case NPC_BLACKHAND_VETERAN: + break; + } } void OnGameObjectCreate(GameObject* go) @@ -135,6 +148,36 @@ public: case GO_WHELP_SPAWNER: go->CastSpell(NULL, SPELL_SUMMON_ROOKERY_WHELP); break; + case GO_EMBERSEER_IN: + go_emberseerin = go->GetGUID(); + break; + case GO_DOORS: + go_doors = go->GetGUID(); + break; + case GO_EMBERSEER_OUT: + go_emberseerout = go->GetGUID(); + break; + case GO_ROOM_1_RUNE: + go_roomrunes[0] = go->GetGUID(); + break; + case GO_ROOM_2_RUNE: + go_roomrunes[1] = go->GetGUID(); + break; + case GO_ROOM_3_RUNE: + go_roomrunes[2] = go->GetGUID(); + break; + case GO_ROOM_4_RUNE: + go_roomrunes[3] = go->GetGUID(); + break; + case GO_ROOM_5_RUNE: + go_roomrunes[4] = go->GetGUID(); + break; + case GO_ROOM_6_RUNE: + go_roomrunes[5] = go->GetGUID(); + break; + case GO_ROOM_7_RUNE: + go_roomrunes[6] = go->GetGUID(); + break; } } @@ -167,6 +210,18 @@ public: return true; } + void ProcessEvent(WorldObject* /*gameObject*/, uint32 eventId) + { + switch (eventId) + { + case EVENT_PYROGUARD_EMBERSEER: + SetBossState(DATA_PYROGAURD_EMBERSEER,IN_PROGRESS); + break; + default: + break; + } + } + uint64 GetData64(uint32 type) { switch (type) @@ -199,6 +254,26 @@ public: return TheBeast; case DATA_GENERAL_DRAKKISATH: return GeneralDrakkisath; + case GO_EMBERSEER_IN: + return go_emberseerin; + case GO_DOORS: + return go_doors; + case GO_EMBERSEER_OUT: + return go_emberseerout; + case GO_ROOM_1_RUNE: + return go_roomrunes[0]; + case GO_ROOM_2_RUNE: + return go_roomrunes[1]; + case GO_ROOM_3_RUNE: + return go_roomrunes[2]; + case GO_ROOM_4_RUNE: + return go_roomrunes[3]; + case GO_ROOM_5_RUNE: + return go_roomrunes[4]; + case GO_ROOM_6_RUNE: + return go_roomrunes[5]; + case GO_ROOM_7_RUNE: + return go_roomrunes[6]; } return 0; diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp index 7a4ba5777d1..af0dfd38ae8 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp @@ -59,10 +59,10 @@ public: void Reset() { - Cleave_Timer = 8000; // These times are probably wrong - BlastWave_Timer = 12000; - MortalStrike_Timer = 20000; - KnockBack_Timer = 30000; + Cleave_Timer = 8000; // These times are probably wrong + BlastWave_Timer = 12000; + MortalStrike_Timer = 20000; + KnockBack_Timer = 30000; } void EnterCombat(Unit* /*who*/) diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp index 818dcace078..a3eb0cea5ad 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp @@ -245,7 +245,7 @@ public: Unit* unit; if ((*i) && (*i)->getSource()) { - unit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + unit = Unit::GetUnit(*me, (*i)->getUnitGuid()); if (unit) { //Cast affliction diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp index c4e0d6ea715..5d4cc442a49 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp @@ -92,15 +92,15 @@ public: void Reset() { - ShadowFlame_Timer = 12000; // These times are probably wrong - BellowingRoar_Timer = 30000; - VeilOfShadow_Timer = 15000; - Cleave_Timer = 7000; - TailLash_Timer = 10000; - ClassCall_Timer = 35000; // 35-40 seconds + ShadowFlame_Timer = 12000; // These times are probably wrong + BellowingRoar_Timer = 30000; + VeilOfShadow_Timer = 15000; + Cleave_Timer = 7000; + TailLash_Timer = 10000; + ClassCall_Timer = 35000; // 35-40 seconds Phase3 = false; - DespawnTimer = 5000; + DespawnTimer = 5000; } void KilledUnit(Unit* Victim) @@ -111,7 +111,7 @@ public: DoScriptText(SAY_SLAY, me, Victim); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); } diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp index a4fb4ad22a3..24fc74cc7cb 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp @@ -75,7 +75,7 @@ public: DoZoneInCombat(); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); } diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp index 4a72bd0ca38..eaa8c118f19 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp @@ -51,20 +51,20 @@ class boss_vaelastrasz : public CreatureScript public: boss_vaelastrasz() : CreatureScript("boss_vaelastrasz") { } - void SendDefaultMenu(Player* player, Creature* creature, uint32 Action) + void SendDefaultMenu(Player* player, Creature* creature, uint32 action) { - if (Action == GOSSIP_ACTION_INFO_DEF + 1) //Fight time + if (action == GOSSIP_ACTION_INFO_DEF + 1) //Fight time { player->CLOSE_GOSSIP_MENU(); CAST_AI(boss_vaelastrasz::boss_vaelAI, creature->AI())->BeginSpeech(player); } } - bool OnGossipSelect(Player* player, Creature* creature, uint32 Sender, uint32 Action) + bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (Sender == GOSSIP_SENDER_MAIN) - SendDefaultMenu(player, creature, Action); + if (sender == GOSSIP_SENDER_MAIN) + SendDefaultMenu(player, creature, action); return true; } @@ -108,17 +108,17 @@ public: void Reset() { - PlayerGUID = 0; - SpeechTimer = 0; - SpeechNum = 0; - Cleave_Timer = 8000; //These times are probably wrong - FlameBreath_Timer = 11000; - BurningAdrenalineCaster_Timer = 15000; - BurningAdrenalineTank_Timer = 45000; - FireNova_Timer = 5000; - TailSwipe_Timer = 20000; - HasYelled = false; - DoingSpeech = false; + PlayerGUID = 0; + SpeechTimer = 0; + SpeechNum = 0; + Cleave_Timer = 8000; // These times are probably wrong + FlameBreath_Timer = 11000; + BurningAdrenalineCaster_Timer = 15000; + BurningAdrenalineTank_Timer = 45000; + FireNova_Timer = 5000; + TailSwipe_Timer = 20000; + HasYelled = false; + DoingSpeech = false; } void BeginSpeech(Unit* target) @@ -176,9 +176,9 @@ public: break; case 2: me->setFaction(103); - if (PlayerGUID && Unit::GetUnit((*me), PlayerGUID)) + if (PlayerGUID && Unit::GetUnit(*me, PlayerGUID)) { - AttackStart(Unit::GetUnit((*me), PlayerGUID)); + AttackStart(Unit::GetUnit(*me, PlayerGUID)); DoCast(me, SPELL_ESSENCEOFTHERED); } SpeechTimer = 0; diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp index 2c7cd73c604..668b84d38dd 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp @@ -83,10 +83,10 @@ class boss_victor_nefarius : public CreatureScript public: boss_victor_nefarius() : CreatureScript("boss_victor_nefarius") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*Sender*/, uint32 Action) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (Action) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); @@ -220,13 +220,13 @@ public: void Reset() { - SpawnedAdds = 0; - AddSpawnTimer = 10000; - ShadowBoltTimer = 5000; - FearTimer = 8000; - ResetTimer = 900000; //On official it takes him 15 minutes(900 seconds) to reset. We are only doing 1 minute to make testing easier - NefarianGUID = 0; - NefCheckTime = 2000; + SpawnedAdds = 0; + AddSpawnTimer = 10000; + ShadowBoltTimer = 5000; + FearTimer = 8000; + ResetTimer = 900000; // On official it takes him 15 minutes(900 seconds) to reset. We are only doing 1 minute to make testing easier + NefarianGUID = 0; + NefCheckTime = 2000; me->SetUInt32Value(UNIT_NPC_FLAGS, 1); me->setFaction(35); diff --git a/src/server/scripts/EasternKingdoms/CMakeLists.txt b/src/server/scripts/EasternKingdoms/CMakeLists.txt index 5af9dd2f23e..5dc3b52dec1 100644 --- a/src/server/scripts/EasternKingdoms/CMakeLists.txt +++ b/src/server/scripts/EasternKingdoms/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/> +# Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> # # This file is free software; as a special exception the author gives # unlimited permission to copy and/or distribute it, with or without @@ -84,7 +84,6 @@ set(scripts_STAT_SRCS EasternKingdoms/MoltenCore/instance_molten_core.cpp EasternKingdoms/MoltenCore/boss_sulfuron_harbinger.cpp EasternKingdoms/MoltenCore/boss_magmadar.cpp - EasternKingdoms/MoltenCore/molten_core.cpp EasternKingdoms/MoltenCore/boss_shazzrah.cpp EasternKingdoms/Stratholme/boss_baroness_anastari.cpp EasternKingdoms/Stratholme/boss_nerubenkan.cpp diff --git a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp index 9830563ac87..4885d8620b0 100644 --- a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp +++ b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp @@ -127,7 +127,7 @@ public: DoCastAOE(SPELL_SMITE_STOMP, false); SetCombatMovement(false); if (instance) - if (GameObject* go = GameObject::GetGameObject((*me), instance->GetData64(DATA_SMITE_CHEST))) + if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_SMITE_CHEST))) { me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MovePoint(1, go->GetPositionX() - 3.0f, go->GetPositionY(), go->GetPositionZ()); @@ -158,7 +158,6 @@ public: me->GetMotionMaster()->MoveChase(me->getVictim(), me->m_CombatDistance); uiPhase = 0; break; - } } else uiTimer -= uiDiff; } @@ -174,9 +173,7 @@ public: uiTimer = 1500; uiPhase = 1; } - }; - }; void AddSC_boss_mr_smite() diff --git a/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp b/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp index fffd8d41264..6c6b0647c5f 100644 --- a/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp +++ b/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp @@ -45,17 +45,16 @@ public: player->GetSession()->SendNotification("Instance script not initialized"); return true; } - if (instance->GetData(EVENT_STATE)!= CANNON_NOT_USED) + + if (instance->GetData(EVENT_STATE) != CANNON_NOT_USED) return false; + if (targets.GetGOTarget() && targets.GetGOTarget()->GetEntry() == GO_DEFIAS_CANNON) - { instance->SetData(EVENT_STATE, CANNON_GUNPOWDER_USED); - } player->DestroyItemCount(item->GetEntry(), 1, true); return true; } - }; void AddSC_deadmines() diff --git a/src/server/scripts/EasternKingdoms/Deadmines/deadmines.h b/src/server/scripts/EasternKingdoms/Deadmines/deadmines.h index 55726fb2a8e..419af40ee36 100644 --- a/src/server/scripts/EasternKingdoms/Deadmines/deadmines.h +++ b/src/server/scripts/EasternKingdoms/Deadmines/deadmines.h @@ -47,4 +47,3 @@ enum GameObjects GO_MR_SMITE_CHEST = 144111 }; #endif - diff --git a/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp b/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp index 1b037be8afa..46e84481fee 100644 --- a/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp +++ b/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp @@ -156,7 +156,7 @@ class instance_deadmines : public InstanceMapScript void MoveCreatureInside(Creature* creature) { - creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + creature->SetWalk(false); creature->GetMotionMaster()->MovePoint(0, -102.7f, -655.9f, creature->GetPositionZ()); } diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp index cd5566007ee..b5a7984d945 100644 --- a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp +++ b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp @@ -95,10 +95,10 @@ public: return new npc_blastmaster_emi_shortfuseAI(creature); } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { if (npc_escortAI* pEscortAI = CAST_AI(npc_blastmaster_emi_shortfuse::npc_blastmaster_emi_shortfuseAI, creature->AI())) pEscortAI->Start(true, false, player->GetGUID()); @@ -189,11 +189,11 @@ public: if (bBool) { if (instance) - if (GameObject* go = GameObject::GetGameObject((*me), instance->GetData64(DATA_GO_CAVE_IN_RIGHT))) + if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_RIGHT))) instance->HandleGameObject(0, false, go); }else if (instance) - if (GameObject* go = GameObject::GetGameObject((*me), instance->GetData64(DATA_GO_CAVE_IN_LEFT))) + if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_LEFT))) instance->HandleGameObject(0, false, go); } @@ -204,10 +204,10 @@ public: if (bBool) { - if (GameObject* go = GameObject::GetGameObject((*me), instance->GetData64(DATA_GO_CAVE_IN_RIGHT))) + if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_RIGHT))) me->SetFacingToObject(go); }else - if (GameObject* go = GameObject::GetGameObject((*me), instance->GetData64(DATA_GO_CAVE_IN_LEFT))) + if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_LEFT))) me->SetFacingToObject(go); } @@ -216,10 +216,10 @@ public: if (!instance) return; - if (GameObject* go = GameObject::GetGameObject((*me), instance->GetData64(DATA_GO_CAVE_IN_RIGHT))) + if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_RIGHT))) instance->HandleGameObject(0, false, go); - if (GameObject* go = GameObject::GetGameObject((*me), instance->GetData64(DATA_GO_CAVE_IN_LEFT))) + if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_LEFT))) instance->HandleGameObject(0, false, go); if (!GoSummonList.empty()) @@ -266,14 +266,14 @@ public: } } - void WaypointReached(uint32 uiPoint) + void WaypointReached(uint32 waypointId) { //just in case if (GetPlayerForEscort()) if (me->getFaction() != GetPlayerForEscort()->getFaction()) me->setFaction(GetPlayerForEscort()->getFaction()); - switch (uiPoint) + switch (waypointId) { case 3: SetEscortPaused(true); @@ -445,7 +445,7 @@ public: DoScriptText(SAY_BLASTMASTER_5, me); Summon(1); if (instance) - if (GameObject* go = GameObject::GetGameObject((*me), instance->GetData64(DATA_GO_CAVE_IN_RIGHT))) + if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_RIGHT))) instance->HandleGameObject(0, true, go); NextStep(3000, true); break; @@ -491,7 +491,7 @@ public: DoScriptText(SAY_BLASTMASTER_23, me); SetInFace(false); if (instance) - if (GameObject* go = GameObject::GetGameObject((*me), instance->GetData64(DATA_GO_CAVE_IN_LEFT))) + if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_LEFT))) instance->HandleGameObject(0, true, go); NextStep(2000, true); break; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp index b1fa4d54eb6..96bda019f6a 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp @@ -55,7 +55,7 @@ public: struct boss_curatorAI : public ScriptedAI { - boss_curatorAI(Creature* c) : ScriptedAI(c) {} + boss_curatorAI(Creature* creature) : ScriptedAI(creature) {} uint32 AddTimer; uint32 HatefulBoltTimer; @@ -80,7 +80,7 @@ public: DoScriptText(RAND(SAY_KILL1, SAY_KILL2), me); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp index 66de84abbc2..e19efc7c4e5 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp @@ -51,7 +51,7 @@ public: struct boss_maiden_of_virtueAI : public ScriptedAI { - boss_maiden_of_virtueAI(Creature* c) : ScriptedAI(c) {} + boss_maiden_of_virtueAI(Creature* creature) : ScriptedAI(creature) {} uint32 Repentance_Timer; uint32 Holyfire_Timer; @@ -78,7 +78,7 @@ public: DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2, SAY_SLAY3), me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp index 65b758b55e7..2bba875ad1f 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp @@ -58,7 +58,7 @@ public: struct boss_attumenAI : public ScriptedAI { - boss_attumenAI(Creature* c) : ScriptedAI(c) + boss_attumenAI(Creature* creature) : ScriptedAI(creature) { Phase = 1; @@ -89,7 +89,7 @@ public: DoScriptText(RAND(SAY_KILL1, SAY_KILL2), me); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); if (Unit* pMidnight = Unit::GetUnit(*me, Midnight)) @@ -119,7 +119,7 @@ public: struct boss_midnightAI : public ScriptedAI { - boss_midnightAI(Creature* c) : ScriptedAI(c) {} + boss_midnightAI(Creature* creature) : ScriptedAI(creature) {} uint64 Attumen; uint8 Phase; @@ -185,7 +185,7 @@ public: pAttumen->GetMotionMaster()->MoveChase(pAttumen->getVictim()); pAttumen->SetTarget(pAttumen->getVictim()->GetGUID()); } - pAttumen->SetFloatValue(OBJECT_FIELD_SCALE_X, 1); + pAttumen->SetObjectScale(1); } } else Mount_Timer -= diff; } @@ -203,16 +203,16 @@ public: pAttumen->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); float angle = me->GetAngle(pAttumen); float distance = me->GetDistance2d(pAttumen); - float newX = me->GetPositionX() + cos(angle)*(distance/2) ; - float newY = me->GetPositionY() + sin(angle)*(distance/2) ; + float newX = me->GetPositionX() + cos(angle)*(distance/2); + float newY = me->GetPositionY() + sin(angle)*(distance/2); float newZ = 50; //me->Relocate(newX, newY, newZ, angle); //me->SendMonsterMove(newX, newY, newZ, 0, true, 1000); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MovePoint(0, newX, newY, newZ); distance += 10; - newX = me->GetPositionX() + cos(angle)*(distance/2) ; - newY = me->GetPositionY() + sin(angle)*(distance/2) ; + newX = me->GetPositionX() + cos(angle)*(distance/2); + newY = me->GetPositionY() + sin(angle)*(distance/2); pAttumen->GetMotionMaster()->Clear(); pAttumen->GetMotionMaster()->MovePoint(0, newX, newY, newZ); //pAttumen->Relocate(newX, newY, newZ, -angle); @@ -244,8 +244,8 @@ void boss_attumen::boss_attumenAI::UpdateAI(const uint32 diff) Midnight = 0; me->SetVisible(false); me->Kill(me); - } - } else ResetTimer -= diff; + } else ResetTimer -= diff; + } //Return since we have no target if (!UpdateVictim()) diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp index 484515be0f8..f69cecdb4c3 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp @@ -72,13 +72,12 @@ public: struct boss_moroesAI : public ScriptedAI { - boss_moroesAI(Creature* c) : ScriptedAI(c) + boss_moroesAI(Creature* creature) : ScriptedAI(creature) { for (uint8 i = 0; i < 4; ++i) - { AddId[i] = 0; - } - instance = c->GetInstanceScript(); + + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -136,7 +135,7 @@ public: DoScriptText(RAND(SAY_KILL_1, SAY_KILL_2, SAY_KILL_3), me); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); @@ -202,7 +201,7 @@ public: void DeSpawnAdds() { - for (uint8 i = 0; i < 4 ; ++i) + for (uint8 i = 0; i < 4; ++i) { Creature* Temp = NULL; if (AddGUID[i]) @@ -322,12 +321,12 @@ struct boss_moroes_guestAI : public ScriptedAI uint64 GuestGUID[4]; - boss_moroes_guestAI(Creature* c) : ScriptedAI(c) + boss_moroes_guestAI(Creature* creature) : ScriptedAI(creature) { for (uint8 i = 0; i < 4; ++i) GuestGUID[i] = 0; - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } void Reset() @@ -359,7 +358,7 @@ struct boss_moroes_guestAI : public ScriptedAI uint64 TempGUID = GuestGUID[rand()%4]; if (TempGUID) { - Unit* unit = Unit::GetUnit((*me), TempGUID); + Unit* unit = Unit::GetUnit(*me, TempGUID); if (unit && unit->isAlive()) return unit; } @@ -417,7 +416,7 @@ public: struct boss_baroness_dorothea_millstipeAI : public boss_moroes_guestAI { //Shadow Priest - boss_baroness_dorothea_millstipeAI(Creature* c) : boss_moroes_guestAI(c) {} + boss_baroness_dorothea_millstipeAI(Creature* creature) : boss_moroes_guestAI(creature) {} uint32 ManaBurn_Timer; uint32 MindFlay_Timer; @@ -481,7 +480,7 @@ public: struct boss_baron_rafe_dreugerAI : public boss_moroes_guestAI { //Retr Pally - boss_baron_rafe_dreugerAI(Creature* c) : boss_moroes_guestAI(c){} + boss_baron_rafe_dreugerAI(Creature* creature) : boss_moroes_guestAI(creature){} uint32 HammerOfJustice_Timer; uint32 SealOfCommand_Timer; @@ -539,7 +538,7 @@ public: struct boss_lady_catriona_von_indiAI : public boss_moroes_guestAI { //Holy Priest - boss_lady_catriona_von_indiAI(Creature* c) : boss_moroes_guestAI(c) {} + boss_lady_catriona_von_indiAI(Creature* creature) : boss_moroes_guestAI(creature) {} uint32 DispelMagic_Timer; uint32 GreaterHeal_Timer; @@ -610,7 +609,7 @@ public: struct boss_lady_keira_berrybuckAI : public boss_moroes_guestAI { //Holy Pally - boss_lady_keira_berrybuckAI(Creature* c) : boss_moroes_guestAI(c) {} + boss_lady_keira_berrybuckAI(Creature* creature) : boss_moroes_guestAI(creature) {} uint32 Cleanse_Timer; uint32 GreaterBless_Timer; @@ -685,7 +684,7 @@ public: struct boss_lord_robin_darisAI : public boss_moroes_guestAI { //Arms Warr - boss_lord_robin_darisAI(Creature* c) : boss_moroes_guestAI(c) {} + boss_lord_robin_darisAI(Creature* creature) : boss_moroes_guestAI(creature) {} uint32 Hamstring_Timer; uint32 MortalStrike_Timer; @@ -742,7 +741,7 @@ public: struct boss_lord_crispin_ferenceAI : public boss_moroes_guestAI { //Arms Warr - boss_lord_crispin_ferenceAI(Creature* c) : boss_moroes_guestAI(c) {} + boss_lord_crispin_ferenceAI(Creature* creature) : boss_moroes_guestAI(creature) {} uint32 Disarm_Timer; uint32 HeroicStrike_Timer; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp index c1fe9c9c56c..f89abca76cf 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp @@ -70,9 +70,9 @@ public: struct boss_netherspiteAI : public ScriptedAI { - boss_netherspiteAI(Creature* c) : ScriptedAI(c) + boss_netherspiteAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); for (int i=0; i<3; ++i) { diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp index 728446aa833..ded5e6903a5 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp @@ -70,9 +70,9 @@ public: struct boss_nightbaneAI : public ScriptedAI { - boss_nightbaneAI(Creature* c) : ScriptedAI(c) + boss_nightbaneAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); Intro = true; } @@ -121,8 +121,8 @@ public: MovePhase = 0; me->SetSpeed(MOVE_RUN, 2.0f); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetDisableGravity(true); + me->SetWalk(false); me->setActive(true); if (instance) @@ -240,7 +240,7 @@ public: me->InterruptSpell(CURRENT_GENERIC_SPELL); me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetDisableGravity(true); (*me).GetMotionMaster()->Clear(false); (*me).GetMotionMaster()->MovePoint(0, IntroWay[2][0], IntroWay[2][1], IntroWay[2][2]); @@ -263,7 +263,7 @@ public: { if (MovePhase >= 7) { - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetLevitate(false); me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); me->GetMotionMaster()->MovePoint(8, IntroWay[7][0], IntroWay[7][1], IntroWay[7][2]); } @@ -277,7 +277,7 @@ public: { if (MovePhase >= 7) { - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetLevitate(false); me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); me->GetMotionMaster()->MovePoint(8, IntroWay[7][0], IntroWay[7][1], IntroWay[7][2]); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp index 14add92fd16..4700ad71fab 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp @@ -108,7 +108,7 @@ public: struct netherspite_infernalAI : public ScriptedAI { - netherspite_infernalAI(Creature* c) : ScriptedAI(c), + netherspite_infernalAI(Creature* creature) : ScriptedAI(creature), HellfireTimer(0), CleanupTimer(0), malchezaar(0), point(NULL) {} uint32 HellfireTimer; @@ -183,9 +183,9 @@ public: struct boss_malchezaarAI : public ScriptedAI { - boss_malchezaarAI(Creature* c) : ScriptedAI(c) + boss_malchezaarAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -243,7 +243,7 @@ public: DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2, SAY_SLAY3), me); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); @@ -297,7 +297,7 @@ public: SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); //damage - const CreatureTemplate* cinfo = me->GetCreatureInfo(); + const CreatureTemplate* cinfo = me->GetCreatureTemplate(); me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, cinfo->mindmg); me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, cinfo->maxdmg); me->UpdateDamagePhysical(BASE_ATTACK); @@ -420,7 +420,7 @@ public: SetEquipmentSlots(false, EQUIP_ID_AXE, EQUIP_ID_AXE, EQUIP_NO_CHANGE); //damage - const CreatureTemplate* cinfo = me->GetCreatureInfo(); + const CreatureTemplate* cinfo = me->GetCreatureTemplate(); me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 2*cinfo->mindmg); me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 2*cinfo->maxdmg); me->UpdateDamagePhysical(BASE_ATTACK); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp index 119cb7d9de6..d95b4aa3ae1 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp @@ -24,7 +24,6 @@ SDCategory: Karazhan EndScriptData */ #include "ScriptPCH.h" -#include "ScriptedSimpleAI.h" #include "karazhan.h" #include "GameObject.h" @@ -93,9 +92,9 @@ public: struct boss_aranAI : public ScriptedAI { - boss_aranAI(Creature* c) : ScriptedAI(c) + boss_aranAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -162,7 +161,7 @@ public: DoScriptText(RAND(SAY_KILL1, SAY_KILL2), me); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); @@ -523,7 +522,7 @@ public: struct water_elementalAI : public ScriptedAI { - water_elementalAI(Creature* c) : ScriptedAI(c) {} + water_elementalAI(Creature* creature) : ScriptedAI(creature) {} uint32 CastTimer; @@ -549,33 +548,8 @@ public: }; -// CONVERT TO ACID -class mob_shadow_of_aran : public CreatureScript -{ -public: - mob_shadow_of_aran() : CreatureScript("mob_shadow_of_aran") { } - - CreatureAI* GetAI(Creature* creature) const - { - sLog->outString("TSCR: Convert simpleAI script for Creature Entry %u to ACID", creature->GetEntry()); - SimpleAI* ai = new SimpleAI (creature); - - ai->Spell[0].Enabled = true; - ai->Spell[0].Spell_Id = SPELL_SHADOW_PYRO; - ai->Spell[0].Cooldown = 5000; - ai->Spell[0].First_Cast = 1000; - ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_TARGET; - - ai->EnterEvadeMode(); - - return ai; - } - -}; - void AddSC_boss_shade_of_aran() { new boss_shade_of_aran(); - new mob_shadow_of_aran(); new mob_aran_elemental(); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp index 15750c5b9c5..2f19d2c7fc1 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp @@ -68,9 +68,9 @@ public: struct mob_kilrekAI : public ScriptedAI { - mob_kilrekAI(Creature* c) : ScriptedAI(c) + mob_kilrekAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -94,14 +94,14 @@ public: } } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { if (instance) { uint64 TerestianGUID = instance->GetData64(DATA_TERESTIAN); if (TerestianGUID) { - Unit* Terestian = Unit::GetUnit((*me), TerestianGUID); + Unit* Terestian = Unit::GetUnit(*me, TerestianGUID); if (Terestian && Terestian->isAlive()) DoCast(Terestian, SPELL_BROKEN_PACT, true); } @@ -140,7 +140,7 @@ public: struct mob_demon_chainAI : public ScriptedAI { - mob_demon_chainAI(Creature* c) : ScriptedAI(c) {} + mob_demon_chainAI(Creature* creature) : ScriptedAI(creature) {} uint64 SacrificeGUID; @@ -157,7 +157,7 @@ public: { if (SacrificeGUID) { - Unit* Sacrifice = Unit::GetUnit((*me), SacrificeGUID); + Unit* Sacrifice = Unit::GetUnit(*me, SacrificeGUID); if (Sacrifice) Sacrifice->RemoveAurasDueToSpell(SPELL_SACRIFICE); } @@ -178,7 +178,7 @@ public: struct mob_fiendish_portalAI : public PassiveAI { - mob_fiendish_portalAI(Creature* c) : PassiveAI(c), summons(me){} + mob_fiendish_portalAI(Creature* creature) : PassiveAI(creature), summons(me){} SummonList summons; @@ -215,7 +215,7 @@ public: struct mob_fiendish_impAI : public ScriptedAI { - mob_fiendish_impAI(Creature* c) : ScriptedAI(c) {} + mob_fiendish_impAI(Creature* creature) : ScriptedAI(creature) {} uint32 FireboltTimer; @@ -258,11 +258,11 @@ public: struct boss_terestianAI : public ScriptedAI { - boss_terestianAI(Creature* c) : ScriptedAI(c) + boss_terestianAI(Creature* creature) : ScriptedAI(creature) { for (uint8 i = 0; i < 2; ++i) PortalGUID[i] = 0; - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp index b15cb7d3da1..6f8121ef5b6 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp @@ -114,9 +114,9 @@ public: struct boss_dorotheeAI : public ScriptedAI { - boss_dorotheeAI(Creature* c) : ScriptedAI(c) + boss_dorotheeAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -229,7 +229,7 @@ public: struct mob_titoAI : public ScriptedAI { - mob_titoAI(Creature* c) : ScriptedAI(c) {} + mob_titoAI(Creature* creature) : ScriptedAI(creature) {} uint64 DorotheeGUID; uint32 YipTimer; @@ -296,9 +296,9 @@ public: struct boss_strawmanAI : public ScriptedAI { - boss_strawmanAI(Creature* c) : ScriptedAI(c) + boss_strawmanAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -411,9 +411,9 @@ public: struct boss_tinheadAI : public ScriptedAI { - boss_tinheadAI(Creature* c) : ScriptedAI(c) + boss_tinheadAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -521,9 +521,9 @@ public: struct boss_roarAI : public ScriptedAI { - boss_roarAI(Creature* c) : ScriptedAI(c) + boss_roarAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -630,9 +630,9 @@ public: struct boss_croneAI : public ScriptedAI { - boss_croneAI(Creature* c) : ScriptedAI(c) + boss_croneAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -712,7 +712,7 @@ public: struct mob_cycloneAI : public ScriptedAI { - mob_cycloneAI(Creature* c) : ScriptedAI(c) {} + mob_cycloneAI(Creature* creature) : ScriptedAI(creature) {} uint32 MoveTimer; @@ -769,10 +769,10 @@ class npc_grandmother : public CreatureScript public: npc_grandmother() : CreatureScript("npc_grandmother") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF) + if (action == GOSSIP_ACTION_INFO_DEF) { if (Creature* pBigBadWolf = creature->SummonCreature(CREATURE_BIG_BAD_WOLF, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, HOUR*2*IN_MILLISECONDS)) pBigBadWolf->AI()->AttackStart(player); @@ -805,9 +805,9 @@ public: struct boss_bigbadwolfAI : public ScriptedAI { - boss_bigbadwolfAI(Creature* c) : ScriptedAI(c) + boss_bigbadwolfAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -886,7 +886,7 @@ public: { IsChasing = false; - if (Unit* target = Unit::GetUnit((*me), HoodGUID)) + if (Unit* target = Unit::GetUnit(*me, HoodGUID)) { HoodGUID = 0; if (DoGetThreat(target)) @@ -1004,9 +1004,9 @@ public: struct boss_julianneAI : public ScriptedAI { - boss_julianneAI(Creature* c) : ScriptedAI(c) + boss_julianneAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); EntryYellTimer = 1000; AggroYellTimer = 10000; IsFakingDeath = false; @@ -1127,9 +1127,9 @@ public: struct boss_romuloAI : public ScriptedAI { - boss_romuloAI(Creature* c) : ScriptedAI(c) + boss_romuloAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); EntryYellTimer = 8000; AggroYellTimer = 15000; } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp index 056a2e95448..b37f6913b8d 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp @@ -109,11 +109,11 @@ public: struct npc_barnesAI : public npc_escortAI { - npc_barnesAI(Creature* c) : npc_escortAI(c) + npc_barnesAI(Creature* creature) : npc_escortAI(creature) { RaidWiped = false; m_uiEventId = 0; - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -158,12 +158,12 @@ public: void EnterCombat(Unit* /*who*/) {} - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { if (!instance) return; - switch (i) + switch (waypointId) { case 0: DoCast(me, SPELL_TUXEDO, false); @@ -324,12 +324,12 @@ public: } }; - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); npc_barnesAI* pBarnesAI = CAST_AI(npc_barnes::npc_barnesAI, creature->AI()); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, OZ_GOSSIP2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); @@ -414,10 +414,10 @@ class npc_berthold : public CreatureScript public: npc_berthold() : CreatureScript("npc_berthold") { } - bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) + if (action == GOSSIP_ACTION_INFO_DEF + 1) player->CastSpell(player, SPELL_TELEPORT, true); player->CLOSE_GOSSIP_MENU(); @@ -474,9 +474,9 @@ public: struct npc_image_of_medivhAI : public ScriptedAI { - npc_image_of_medivhAI(Creature* c) : ScriptedAI(c) + npc_image_of_medivhAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -527,7 +527,7 @@ public: if (!Arcanagos) return; ArcanagosGUID = Arcanagos->GetGUID(); - Arcanagos->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + Arcanagos->SetDisableGravity(true); (*Arcanagos).GetMotionMaster()->MovePoint(0, ArcanagosPos[0], ArcanagosPos[1], ArcanagosPos[2]); Arcanagos->SetOrientation(ArcanagosPos[3]); me->SetOrientation(MedivPos[3]); @@ -536,7 +536,7 @@ public: uint32 NextStep(uint32 Step) { - Unit* arca = Unit::GetUnit((*me), ArcanagosGUID); + Unit* arca = Unit::GetUnit(*me, ArcanagosGUID); Map* map = me->GetMap(); switch (Step) { @@ -625,7 +625,7 @@ public: if (Step >= 7 && Step <= 12) { - Unit* arca = Unit::GetUnit((*me), ArcanagosGUID); + Unit* arca = Unit::GetUnit(*me, ArcanagosGUID); if (FireArcanagosTimer <= diff) { diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp index dd37f659eec..c53793b6e30 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp @@ -89,9 +89,9 @@ public: struct boss_felblood_kaelthasAI : public ScriptedAI { - boss_felblood_kaelthasAI(Creature* c) : ScriptedAI(c) + boss_felblood_kaelthasAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -154,14 +154,18 @@ public: if (!instance) return; - instance->HandleGameObject(instance->GetData64(DATA_KAEL_DOOR), true); // Open the encounter door + instance->HandleGameObject(instance->GetData64(DATA_KAEL_DOOR), true); + + // Enable the Translocation Orb Exit + if (GameObject* escapeOrb = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ESCAPE_ORB))) + escapeOrb->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); } void DamageTaken(Unit* /*done_by*/, uint32 &damage) { if (damage > me->GetHealth()) - RemoveGravityLapse(); // Remove Gravity Lapse so that players fall to ground if they kill him when in air. + RemoveGravityLapse(); // Remove Gravity Lapse so that players fall to ground if they kill him when in air. } void EnterCombat(Unit* /*who*/) @@ -169,8 +173,8 @@ public: if (!instance) return; + //Close the encounter door, open it in JustDied/Reset instance->HandleGameObject(instance->GetData64(DATA_KAEL_DOOR), false); - //Close the encounter door, open it in JustDied/Reset } void MoveInLineOfSight(Unit* who) @@ -193,7 +197,7 @@ public: std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); for (i = m_threatlist.begin(); i != m_threatlist.end(); ++i) { - Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()); if (unit && unit->isAlive()) { float threat = me->getThreatManager().getThreat(unit); @@ -211,7 +215,7 @@ public: std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) { - Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()); if (unit && (unit->GetTypeId() == TYPEID_PLAYER)) unit->CastSpell(unit, SPELL_TELEPORT_CENTER, true); } @@ -223,7 +227,7 @@ public: std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) { - Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()); if (unit && (unit->GetTypeId() == TYPEID_PLAYER)) // Knockback into the air unit->CastSpell(unit, SPELL_GRAVITY_LAPSE_DOT, true, 0, 0, me->GetGUID()); @@ -235,7 +239,7 @@ public: std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) { - Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()); if (unit && (unit->GetTypeId() == TYPEID_PLAYER)) { // Also needs an exception in spell system. @@ -254,7 +258,7 @@ public: std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) { - Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()); if (unit && (unit->GetTypeId() == TYPEID_PLAYER)) { unit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY); @@ -439,7 +443,7 @@ public: struct mob_felkael_flamestrikeAI : public ScriptedAI { - mob_felkael_flamestrikeAI(Creature* c) : ScriptedAI(c) + mob_felkael_flamestrikeAI(Creature* creature) : ScriptedAI(creature) { } @@ -481,9 +485,9 @@ public: struct mob_felkael_phoenixAI : public ScriptedAI { - mob_felkael_phoenixAI(Creature* c) : ScriptedAI(c) + mob_felkael_phoenixAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -495,7 +499,7 @@ public: void Reset() { me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetDisableGravity(true); DoCast(me, SPELL_PHOENIX_BURN, true); BurnTimer = 2000; Death_Timer = 3000; @@ -542,7 +546,7 @@ public: } - void JustDied(Unit* /*slayer*/) + void JustDied(Unit* /*killer*/) { me->SummonCreature(CREATURE_PHOENIX_EGG, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000); } @@ -601,7 +605,7 @@ public: struct mob_felkael_phoenix_eggAI : public ScriptedAI { - mob_felkael_phoenix_eggAI(Creature* c) : ScriptedAI(c) {} + mob_felkael_phoenix_eggAI(Creature* creature) : ScriptedAI(creature) {} uint32 HatchTimer; @@ -638,7 +642,7 @@ public: struct mob_arcane_sphereAI : public ScriptedAI { - mob_arcane_sphereAI(Creature* c) : ScriptedAI(c) { Reset(); } + mob_arcane_sphereAI(Creature* creature) : ScriptedAI(creature) { Reset(); } uint32 DespawnTimer; uint32 ChangeTargetTimer; @@ -649,7 +653,7 @@ public: ChangeTargetTimer = urand(6000, 12000); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetDisableGravity(true); me->setFaction(14); DoCast(me, SPELL_ARCANE_SPHERE_PASSIVE, true); } diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp index b9d4f600329..883932fdb9b 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp @@ -99,9 +99,9 @@ public: struct boss_priestess_delrissaAI : public ScriptedAI { - boss_priestess_delrissaAI(Creature* c) : ScriptedAI(c) + boss_priestess_delrissaAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); memset(&m_auiLackeyGUID, 0, sizeof(m_auiLackeyGUID)); LackeyEntryList.clear(); } @@ -341,9 +341,9 @@ enum eHealingPotion //all 8 possible lackey use this common struct boss_priestess_lackey_commonAI : public ScriptedAI { - boss_priestess_lackey_commonAI(Creature* c) : ScriptedAI(c) + boss_priestess_lackey_commonAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); memset(&m_auiLackeyGUIDs, 0, sizeof(m_auiLackeyGUIDs)); AcquireGUIDs(); } @@ -495,7 +495,7 @@ public: struct boss_kagani_nightstrikeAI : public boss_priestess_lackey_commonAI { //Rogue - boss_kagani_nightstrikeAI(Creature* c) : boss_priestess_lackey_commonAI(c) {} + boss_kagani_nightstrikeAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) {} uint32 Gouge_Timer; uint32 Kick_Timer; @@ -600,7 +600,7 @@ public: struct boss_ellris_duskhallowAI : public boss_priestess_lackey_commonAI { //Warlock - boss_ellris_duskhallowAI(Creature* c) : boss_priestess_lackey_commonAI(c) {} + boss_ellris_duskhallowAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) {} uint32 Immolate_Timer; uint32 Shadow_Bolt_Timer; @@ -692,7 +692,7 @@ public: struct boss_eramas_brightblazeAI : public boss_priestess_lackey_commonAI { //Monk - boss_eramas_brightblazeAI(Creature* c) : boss_priestess_lackey_commonAI(c) {} + boss_eramas_brightblazeAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) {} uint32 Knockdown_Timer; uint32 Snap_Kick_Timer; @@ -754,7 +754,7 @@ public: struct boss_yazzaiAI : public boss_priestess_lackey_commonAI { //Mage - boss_yazzaiAI(Creature* c) : boss_priestess_lackey_commonAI(c) {} + boss_yazzaiAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) {} bool HasIceBlocked; @@ -885,7 +885,7 @@ public: struct boss_warlord_salarisAI : public boss_priestess_lackey_commonAI { //Warrior - boss_warlord_salarisAI(Creature* c) : boss_priestess_lackey_commonAI(c) {} + boss_warlord_salarisAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) {} uint32 Intercept_Stun_Timer; uint32 Disarm_Timer; @@ -1006,7 +1006,10 @@ public: struct boss_garaxxasAI : public boss_priestess_lackey_commonAI { //Hunter - boss_garaxxasAI(Creature* c) : boss_priestess_lackey_commonAI(c) { m_uiPetGUID = 0; } + boss_garaxxasAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) + { + m_uiPetGUID = 0; + } uint64 m_uiPetGUID; @@ -1126,7 +1129,7 @@ public: struct boss_apokoAI : public boss_priestess_lackey_commonAI { //Shaman - boss_apokoAI(Creature* c) : boss_priestess_lackey_commonAI(c) {} + boss_apokoAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) {} uint32 Totem_Timer; uint8 Totem_Amount; @@ -1225,7 +1228,7 @@ public: struct boss_zelfanAI : public boss_priestess_lackey_commonAI { //Engineer - boss_zelfanAI(Creature* c) : boss_priestess_lackey_commonAI(c) {} + boss_zelfanAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) {} uint32 Goblin_Dragon_Gun_Timer; uint32 Rocket_Launch_Timer; diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp index fa97e4eefc0..af7deda4545 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp @@ -63,9 +63,9 @@ public: struct boss_selin_fireheartAI : public ScriptedAI { - boss_selin_fireheartAI(Creature* c) : ScriptedAI(c) + boss_selin_fireheartAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); Crystals.clear(); //GUIDs per instance is static, so we only need to load them once. @@ -171,7 +171,7 @@ public: float x, y, z; // coords that we move to, close to the crystal. CrystalChosen->GetClosePoint(x, y, z, me->GetObjectSize(), CONTACT_DISTANCE); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(false); me->GetMotionMaster()->MovePoint(1, x, y, z); DrainingCrystal = true; } @@ -333,7 +333,7 @@ public: struct mob_fel_crystalAI : public ScriptedAI { - mob_fel_crystalAI(Creature* c) : ScriptedAI(c) {} + mob_fel_crystalAI(Creature* creature) : ScriptedAI(creature) {} void Reset() {} void EnterCombat(Unit* /*who*/) {} diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp index 5f3716d9dea..327c611b2d6 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp @@ -71,9 +71,9 @@ public: struct boss_vexallusAI : public ScriptedAI { - boss_vexallusAI(Creature* c) : ScriptedAI(c) + boss_vexallusAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -101,7 +101,7 @@ public: DoScriptText(SAY_KILL, me); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { if (instance) instance->SetData(DATA_VEXALLUS_EVENT, DONE); @@ -206,7 +206,7 @@ public: struct mob_pure_energyAI : public ScriptedAI { - mob_pure_energyAI(Creature* c) : ScriptedAI(c) {} + mob_pure_energyAI(Creature* creature) : ScriptedAI(creature) {} void Reset() {} diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp index 642f7955b2e..aa43cb3702f 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp @@ -35,6 +35,25 @@ EndScriptData */ 3 - Kael'thas Sunstrider */ +enum Creatures +{ + NPC_SELIN = 24723, + NPC_DELRISSA = 24560, + NPC_FELCRYSTALS = 24722 +}; + +enum GameObjects +{ + GO_VEXALLUS_DOOR = 187896, + GO_SELIN_DOOR = 187979, + GO_SELIN_ENCOUNTER_DOOR = 188065, + GO_DELRISSA_DOOR = 187770, + GO_KAEL_DOOR = 188064, + GO_KAEL_STATUE_1 = 188165, + GO_KAEL_STATUE_2 = 188166, + GO_ESCAPE_ORB = 188173 +}; + class instance_magisters_terrace : public InstanceMapScript { public: @@ -49,7 +68,7 @@ public: { instance_magisters_terrace_InstanceMapScript(Map* map) : InstanceScript(map) {} - uint32 m_auiEncounter[MAX_ENCOUNTER]; + uint32 Encounter[MAX_ENCOUNTER]; uint32 DelrissaDeathCount; std::list<uint64> FelCrystals; @@ -63,12 +82,13 @@ public: uint64 DelrissaDoorGUID; uint64 KaelDoorGUID; uint64 KaelStatue[2]; + uint64 EscapeOrbGUID; bool InitializedItr; void Initialize() { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + memset(&Encounter, 0, sizeof(Encounter)); FelCrystals.clear(); @@ -83,6 +103,7 @@ public: KaelDoorGUID = 0; KaelStatue[0] = 0; KaelStatue[1] = 0; + EscapeOrbGUID = 0; InitializedItr = false; } @@ -90,7 +111,7 @@ public: bool IsEncounterInProgress() const { for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) + if (Encounter[i] == IN_PROGRESS) return true; return false; } @@ -99,12 +120,18 @@ public: { switch (identifier) { - case DATA_SELIN_EVENT: return m_auiEncounter[0]; - case DATA_VEXALLUS_EVENT: return m_auiEncounter[1]; - case DATA_DELRISSA_EVENT: return m_auiEncounter[2]; - case DATA_KAELTHAS_EVENT: return m_auiEncounter[3]; - case DATA_DELRISSA_DEATH_COUNT: return DelrissaDeathCount; - case DATA_FEL_CRYSTAL_SIZE: return FelCrystals.size(); + case DATA_SELIN_EVENT: + return Encounter[0]; + case DATA_VEXALLUS_EVENT: + return Encounter[1]; + case DATA_DELRISSA_EVENT: + return Encounter[2]; + case DATA_KAELTHAS_EVENT: + return Encounter[3]; + case DATA_DELRISSA_DEATH_COUNT: + return DelrissaDeathCount; + case DATA_FEL_CRYSTAL_SIZE: + return FelCrystals.size(); } return 0; } @@ -113,21 +140,24 @@ public: { switch (identifier) { - case DATA_SELIN_EVENT: m_auiEncounter[0] = data; break; + case DATA_SELIN_EVENT: + Encounter[0] = data; + break; case DATA_VEXALLUS_EVENT: if (data == DONE) DoUseDoorOrButton(VexallusDoorGUID); - m_auiEncounter[1] = data; + Encounter[1] = data; break; case DATA_DELRISSA_EVENT: if (data == DONE) DoUseDoorOrButton(DelrissaDoorGUID); if (data == IN_PROGRESS) DelrissaDeathCount = 0; - m_auiEncounter[2] = data; + Encounter[2] = data; + break; + case DATA_KAELTHAS_EVENT: + Encounter[3] = data; break; - case DATA_KAELTHAS_EVENT: m_auiEncounter[3] = data; break; - case DATA_DELRISSA_DEATH_COUNT: if (data == SPECIAL) ++DelrissaDeathCount; @@ -141,9 +171,15 @@ public: { switch (creature->GetEntry()) { - case 24723: SelinGUID = creature->GetGUID(); break; - case 24560: DelrissaGUID = creature->GetGUID(); break; - case 24722: FelCrystals.push_back(creature->GetGUID()); break; + case NPC_SELIN: + SelinGUID = creature->GetGUID(); + break; + case NPC_DELRISSA: + DelrissaGUID = creature->GetGUID(); + break; + case NPC_FELCRYSTALS: + FelCrystals.push_back(creature->GetGUID()); + break; } } @@ -151,15 +187,30 @@ public: { switch (go->GetEntry()) { - case 187896: VexallusDoorGUID = go->GetGUID(); break; - //SunwellRaid Gate 02 - case 187979: SelinDoorGUID = go->GetGUID(); break; - //Assembly Chamber Door - case 188065: SelinEncounterDoorGUID = go->GetGUID(); break; - case 187770: DelrissaDoorGUID = go->GetGUID(); break; - case 188064: KaelDoorGUID = go->GetGUID(); break; - case 188165: KaelStatue[0] = go->GetGUID(); break; - case 188166: KaelStatue[1] = go->GetGUID(); break; + case GO_VEXALLUS_DOOR: + VexallusDoorGUID = go->GetGUID(); + break; + case GO_SELIN_DOOR: + SelinDoorGUID = go->GetGUID(); + break; + case GO_SELIN_ENCOUNTER_DOOR: + SelinEncounterDoorGUID = go->GetGUID(); + break; + case GO_DELRISSA_DOOR: + DelrissaDoorGUID = go->GetGUID(); + break; + case GO_KAEL_DOOR: + KaelDoorGUID = go->GetGUID(); + break; + case GO_KAEL_STATUE_1: + KaelStatue[0] = go->GetGUID(); + break; + case GO_KAEL_STATUE_2: + KaelStatue[1] = go->GetGUID(); + break; + case GO_ESCAPE_ORB: + EscapeOrbGUID = go->GetGUID(); + break; } } @@ -167,15 +218,26 @@ public: { switch (identifier) { - case DATA_SELIN: return SelinGUID; - case DATA_DELRISSA: return DelrissaGUID; - case DATA_VEXALLUS_DOOR: return VexallusDoorGUID; - case DATA_SELIN_DOOR: return SelinDoorGUID; - case DATA_SELIN_ENCOUNTER_DOOR: return SelinEncounterDoorGUID; - case DATA_DELRISSA_DOOR: return DelrissaDoorGUID; - case DATA_KAEL_DOOR: return KaelDoorGUID; - case DATA_KAEL_STATUE_LEFT: return KaelStatue[0]; - case DATA_KAEL_STATUE_RIGHT: return KaelStatue[1]; + case DATA_SELIN: + return SelinGUID; + case DATA_DELRISSA: + return DelrissaGUID; + case DATA_VEXALLUS_DOOR: + return VexallusDoorGUID; + case DATA_SELIN_DOOR: + return SelinDoorGUID; + case DATA_SELIN_ENCOUNTER_DOOR: + return SelinEncounterDoorGUID; + case DATA_DELRISSA_DOOR: + return DelrissaDoorGUID; + case DATA_KAEL_DOOR: + return KaelDoorGUID; + case DATA_KAEL_STATUE_LEFT: + return KaelStatue[0]; + case DATA_KAEL_STATUE_RIGHT: + return KaelStatue[1]; + case DATA_ESCAPE_ORB: + return EscapeOrbGUID; case DATA_FEL_CRYSTAL: { diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp index 679db023b63..ccaaa0ec68d 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp @@ -56,10 +56,10 @@ class npc_kalecgos : public CreatureScript public: npc_kalecgos() : CreatureScript("npc_kalecgos") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAEL_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.h b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.h index dcea4424bf5..78aa14b9102 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.h +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.h @@ -19,27 +19,31 @@ #ifndef DEF_MAGISTERS_TERRACE_H #define DEF_MAGISTERS_TERRACE_H -#define DATA_SELIN_EVENT 1 -#define DATA_VEXALLUS_EVENT 2 -#define DATA_DELRISSA_EVENT 3 -#define DATA_KAELTHAS_EVENT 4 +#define ERROR_INST_DATA "TSCR Error: Instance Data not set properly for Magister's Terrace instance (map 585). Encounters will be buggy." +#endif -#define DATA_SELIN 5 -#define DATA_FEL_CRYSTAL 6 -#define DATA_FEL_CRYSTAL_SIZE 7 +enum Data +{ + DATA_SELIN_EVENT = 0, + DATA_VEXALLUS_EVENT = 1, + DATA_DELRISSA_EVENT = 2, + DATA_KAELTHAS_EVENT = 3, -#define DATA_VEXALLUS_DOOR 8 -#define DATA_SELIN_DOOR 9 -#define DATA_DELRISSA 10 -#define DATA_DELRISSA_DOOR 11 -#define DATA_SELIN_ENCOUNTER_DOOR 12 + DATA_SELIN = 4, + DATA_FEL_CRYSTAL = 5, + DATA_FEL_CRYSTAL_SIZE = 6, -#define DATA_KAEL_DOOR 13 -#define DATA_KAEL_STATUE_LEFT 14 -#define DATA_KAEL_STATUE_RIGHT 15 + DATA_VEXALLUS_DOOR = 7, + DATA_SELIN_DOOR = 8, + DATA_DELRISSA = 9, + DATA_DELRISSA_DOOR = 10, + DATA_SELIN_ENCOUNTER_DOOR = 11, -#define DATA_DELRISSA_DEATH_COUNT 16 + DATA_KAEL_DOOR = 12, + DATA_KAEL_STATUE_LEFT = 13, + DATA_KAEL_STATUE_RIGHT = 14, -#define ERROR_INST_DATA "TSCR Error: Instance Data not set properly for Magister's Terrace instance (map 585). Encounters will be buggy." -#endif + DATA_DELRISSA_DEATH_COUNT = 15, + DATA_ESCAPE_ORB = 16 +}; diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp index 862a980394a..f085e15fcb7 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp @@ -200,7 +200,7 @@ class boss_majordomo : public CreatureScript return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 /*uiAction*/) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 /*action*/) { player->CLOSE_GOSSIP_MENU(); creature->AI()->DoAction(ACTION_START_RAGNAROS); diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp index 47d50925d56..0160f35f143 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp @@ -316,12 +316,12 @@ class mob_son_of_flame : public CreatureScript struct mob_son_of_flameAI : public ScriptedAI //didnt work correctly in EAI for me... { - mob_son_of_flameAI(Creature* c) : ScriptedAI(c) + mob_son_of_flameAI(Creature* creature) : ScriptedAI(creature) { instance = me->GetInstanceScript(); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { if (instance) instance->SetData(DATA_RAGNAROS_ADDS, 1); diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_sulfuron_harbinger.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_sulfuron_harbinger.cpp index 9f511c1394a..343298d29fe 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_sulfuron_harbinger.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_sulfuron_harbinger.cpp @@ -103,7 +103,7 @@ class boss_sulfuron : public CreatureScript { std::list<Creature*> healers = DoFindFriendlyMissingBuff(45.0f, SPELL_INSPIRE); if (!healers.empty()) - DoCast(SelectRandomContainerElement(healers), SPELL_INSPIRE); + DoCast(Trinity::Containers::SelectRandomContainerElement(healers), SPELL_INSPIRE); DoCast(me, SPELL_INSPIRE); events.ScheduleEvent(EVENT_INSPIRE, urand(20000, 26000)); diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/molten_core.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/molten_core.cpp deleted file mode 100644 index 801a11fbfc8..00000000000 --- a/src/server/scripts/EasternKingdoms/MoltenCore/molten_core.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> - * - * 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/>. - */ - -/* ScriptData -SDName: Molten_Core -SD%Complete: 100 -SDComment: -SDCategory: Molten Core -EndScriptData */ - -/* ContentData -mob_ancient_core_hound -EndContentData */ - -#include "ScriptPCH.h" -#include "ScriptedSimpleAI.h" - -enum Spells -{ - SPELL_CONE_OF_FIRE = 19630, - SPELL_BITE = 19771, - - //Random Debuff (each hound has only one of these) - SPELL_GROUND_STOMP = 19364, - SPELL_ANCIENT_DREAD = 19365, - SPELL_CAUTERIZING_FLAMES = 19366, - SPELL_WITHERING_HEAT = 19367, - SPELL_ANCIENT_DESPAIR = 19369, - SPELL_ANCIENT_HYSTERIA = 19372 -}; - -class mob_ancient_core_hound : public CreatureScript -{ -public: - mob_ancient_core_hound() : CreatureScript("mob_ancient_core_hound") { } - - CreatureAI* GetAI(Creature* creature) const - { - SimpleAI* ai = new SimpleAI(creature); - - ai->Spell[0].Enabled = true; - ai->Spell[0].Spell_Id = SPELL_CONE_OF_FIRE; - ai->Spell[0].Cooldown = 7000; - ai->Spell[0].First_Cast = 10000; - ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_TARGET; - - uint32 RandDebuff = RAND(SPELL_GROUND_STOMP, SPELL_ANCIENT_DREAD, SPELL_CAUTERIZING_FLAMES, - SPELL_WITHERING_HEAT, SPELL_ANCIENT_DESPAIR, SPELL_ANCIENT_HYSTERIA); - - ai->Spell[1].Enabled = true; - ai->Spell[1].Spell_Id = RandDebuff; - ai->Spell[1].Cooldown = 24000; - ai->Spell[1].First_Cast = 15000; - ai->Spell[1].Cast_Target_Type = CAST_HOSTILE_TARGET; - - ai->Spell[2].Enabled = true; - ai->Spell[2].Spell_Id = SPELL_BITE; - ai->Spell[2].Cooldown = 6000; - ai->Spell[2].First_Cast = 4000; - ai->Spell[2].Cast_Target_Type = CAST_HOSTILE_TARGET; - - ai->EnterEvadeMode(); - - return ai; - } -}; - -void AddSC_molten_core() -{ - new mob_ancient_core_hound(); -} diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index a2c8a890feb..bf887bec164 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -102,13 +102,13 @@ public: struct npc_unworthy_initiateAI : public ScriptedAI { - npc_unworthy_initiateAI(Creature* c) : ScriptedAI(c) + npc_unworthy_initiateAI(Creature* creature) : ScriptedAI(creature) { me->SetReactState(REACT_PASSIVE); if (!me->GetEquipmentId()) if (const CreatureTemplate* info = sObjectMgr->GetCreatureTemplate(28406)) if (info->equipmentId) - const_cast<CreatureTemplate*>(me->GetCreatureInfo())->equipmentId = info->equipmentId; + const_cast<CreatureTemplate*>(me->GetCreatureTemplate())->equipmentId = info->equipmentId; } uint64 playerGUID; @@ -293,7 +293,7 @@ public: struct npc_unworthy_initiate_anchorAI : public PassiveAI { - npc_unworthy_initiate_anchorAI(Creature* c) : PassiveAI(c), prisonerGUID(0) {} + npc_unworthy_initiate_anchorAI(Creature* creature) : PassiveAI(creature), prisonerGUID(0) {} uint64 prisonerGUID; @@ -303,9 +303,11 @@ public: prisonerGUID = guid; } - uint64 GetGUID(int32 /*id*/) { return prisonerGUID; } + uint64 GetGUID(int32 /*id*/) + { + return prisonerGUID; + } }; - }; class go_acherus_soul_prison : public GameObjectScript @@ -362,10 +364,10 @@ class npc_death_knight_initiate : public CreatureScript public: npc_death_knight_initiate() : CreatureScript("npc_death_knight_initiate") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF) + if (action == GOSSIP_ACTION_INFO_DEF) { player->CLOSE_GOSSIP_MENU(); @@ -531,7 +533,7 @@ public: struct npc_dark_rider_of_acherusAI : public ScriptedAI { - npc_dark_rider_of_acherusAI(Creature* c) : ScriptedAI(c) {} + npc_dark_rider_of_acherusAI(Creature* creature) : ScriptedAI(creature) {} uint32 PhaseTimer; uint32 Phase; @@ -587,7 +589,7 @@ public: return; TargetGUID = who->GetGUID(); - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(true); me->SetSpeed(MOVE_RUN, 0.4f); me->GetMotionMaster()->MoveChase(who); me->SetTarget(TargetGUID); @@ -623,7 +625,7 @@ public: struct npc_salanar_the_horsemanAI : public ScriptedAI { - npc_salanar_the_horsemanAI(Creature* c) : ScriptedAI(c) {} + npc_salanar_the_horsemanAI(Creature* creature) : ScriptedAI(creature) {} void SpellHit(Unit* caster, const SpellInfo* spell) { @@ -662,7 +664,7 @@ public: { CAST_PLR(charmer)->GroupEventHappens(12687, me); charmer->RemoveAurasDueToSpell(SPELL_EFFECT_OVERTAKE); - CAST_CRE(who)->ForcedDespawn(); + CAST_CRE(who)->DespawnOrUnsummon(); //CAST_CRE(who)->Respawn(true); } @@ -692,7 +694,7 @@ public: struct npc_ros_dark_riderAI : public ScriptedAI { - npc_ros_dark_riderAI(Creature* c) : ScriptedAI(c) {} + npc_ros_dark_riderAI(Creature* creature) : ScriptedAI(creature) {} void EnterCombat(Unit* /*who*/) { @@ -702,7 +704,9 @@ public: void Reset() { Creature* deathcharger = me->FindNearestCreature(28782, 30); - if (!deathcharger) return; + if (!deathcharger) + return; + deathcharger->RestoreFaction(); deathcharger->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); deathcharger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -713,7 +717,9 @@ public: void JustDied(Unit* killer) { Creature* deathcharger = me->FindNearestCreature(28782, 30); - if (!deathcharger) return; + if (!deathcharger) + return; + if (killer->GetTypeId() == TYPEID_PLAYER && deathcharger->GetTypeId() == TYPEID_UNIT && deathcharger->IsVehicle()) { deathcharger->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); @@ -743,7 +749,7 @@ public: struct npc_dkc1_gothikAI : public ScriptedAI { - npc_dkc1_gothikAI(Creature* c) : ScriptedAI(c) {} + npc_dkc1_gothikAI(Creature* creature) : ScriptedAI(creature) {} void MoveInLineOfSight(Unit* who) { @@ -761,7 +767,7 @@ public: //Todo: Creatures must not be removed, but, must instead // stand next to Gothik and be commanded into the pit // and dig into the ground. - CAST_CRE(who)->ForcedDespawn(); + CAST_CRE(who)->DespawnOrUnsummon(); if (CAST_PLR(owner)->GetQuestStatus(12698) == QUEST_STATUS_COMPLETE) owner->RemoveAllMinionsByEntry(GHOULS); @@ -785,7 +791,7 @@ public: struct npc_scarlet_ghoulAI : public ScriptedAI { - npc_scarlet_ghoulAI(Creature* c) : ScriptedAI(c) + npc_scarlet_ghoulAI(Creature* creature) : ScriptedAI(creature) { // Ghouls should display their Birth Animation // Crawling out of the ground @@ -803,11 +809,11 @@ public: { for (std::list<Creature*>::const_iterator itr = MinionList.begin(); itr != MinionList.end(); ++itr) { - if (CAST_CRE(*itr)->GetOwner()->GetGUID() == me->GetOwner()->GetGUID()) + if ((*itr)->GetOwner()->GetGUID() == me->GetOwner()->GetGUID()) { - if (CAST_CRE(*itr)->isInCombat() && CAST_CRE(*itr)->getAttackerForHelper()) + if ((*itr)->isInCombat() && (*itr)->getAttackerForHelper()) { - AttackStart(CAST_CRE(*itr)->getAttackerForHelper()); + AttackStart((*itr)->getAttackerForHelper()); } } } @@ -820,16 +826,13 @@ public: { if (Unit* owner = me->GetOwner()) { - if (owner->GetTypeId() == TYPEID_PLAYER && CAST_PLR(owner)->isInCombat()) + Player* plrOwner = owner->ToPlayer(); + if (plrOwner && plrOwner->isInCombat()) { - if (CAST_PLR(owner)->getAttackerForHelper() && CAST_PLR(owner)->getAttackerForHelper()->GetEntry() == GHOSTS) - { - AttackStart(CAST_PLR(owner)->getAttackerForHelper()); - } + if (plrOwner->getAttackerForHelper() && plrOwner->getAttackerForHelper()->GetEntry() == GHOSTS) + AttackStart(plrOwner->getAttackerForHelper()); else - { FindMinions(owner); - } } } } @@ -868,17 +871,17 @@ class npc_scarlet_miner_cart : public CreatureScript public: npc_scarlet_miner_cart() : CreatureScript("npc_scarlet_miner_cart") { } - CreatureAI* GetAI(Creature* _Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new npc_scarlet_miner_cartAI(_Creature); + return new npc_scarlet_miner_cartAI(creature); } struct npc_scarlet_miner_cartAI : public PassiveAI { - npc_scarlet_miner_cartAI(Creature* c) : PassiveAI(c), minerGUID(0) + npc_scarlet_miner_cartAI(Creature* creature) : PassiveAI(creature), minerGUID(0) { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - me->SetDisplayId(me->GetCreatureInfo()->Modelid1); // Modelid2 is a horse. + me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); // Modelid2 is a horse. } uint64 minerGUID; @@ -892,7 +895,7 @@ public: { if (Creature* miner = Unit::GetCreature(*me, minerGUID)) { - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(false); //Not 100% correct, but movement is smooth. Sometimes miner walks faster //than normal, this speed is fast enough to keep up at those times. @@ -924,14 +927,14 @@ class npc_scarlet_miner : public CreatureScript public: npc_scarlet_miner() : CreatureScript("npc_scarlet_miner") { } - CreatureAI* GetAI(Creature* _Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new npc_scarlet_minerAI(_Creature); + return new npc_scarlet_minerAI(creature); } struct npc_scarlet_minerAI : public npc_escortAI { - npc_scarlet_minerAI(Creature* c) : npc_escortAI(c) + npc_scarlet_minerAI(Creature* creature) : npc_escortAI(creature) { me->SetReactState(REACT_PASSIVE); } @@ -988,9 +991,9 @@ public: SetDespawnAtFar(false); } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { - switch (i) + switch (waypointId) { case 1: if (Unit* car = Unit::GetCreature(*me, carGUID)) @@ -1057,7 +1060,7 @@ class go_inconspicuous_mine_car : public GameObjectScript public: go_inconspicuous_mine_car() : GameObjectScript("go_inconspicuous_mine_car") { } - bool OnGossipHello(Player* player, GameObject* /*pGO*/) + bool OnGossipHello(Player* player, GameObject* /*go*/) { if (player->GetQuestStatus(12701) == QUEST_STATUS_INCOMPLETE) { diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp index 4583a33a196..1c17e6afa9b 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp @@ -111,12 +111,33 @@ public: switch (uiSpeech_counter) { - case 1: DoScriptText(SAY_PERSUADED1, me); uiSpeech_timer = 8000; break; - case 2: DoScriptText(SAY_PERSUADED2, me); uiSpeech_timer = 8000; break; - case 3: DoScriptText(SAY_PERSUADED3, me); uiSpeech_timer = 8000; break; - case 4: DoScriptText(SAY_PERSUADED4, me); uiSpeech_timer = 8000; break; - case 5: DoScriptText(SAY_PERSUADED5, player); uiSpeech_timer = 8000; break; - case 6: DoScriptText(SAY_PERSUADED6, me); + case 1: + DoScriptText(SAY_PERSUADED1, me); + uiSpeech_timer = 8000; + break; + + case 2: + DoScriptText(SAY_PERSUADED2, me); + uiSpeech_timer = 8000; + break; + + case 3: + DoScriptText(SAY_PERSUADED3, me); + uiSpeech_timer = 8000; + break; + + case 4: + DoScriptText(SAY_PERSUADED4, me); + uiSpeech_timer = 8000; + break; + + case 5: + DoScriptText(SAY_PERSUADED5, player); + uiSpeech_timer = 8000; + break; + + case 6: + DoScriptText(SAY_PERSUADED6, me); player->Kill(me); //me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); //me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -218,9 +239,9 @@ public: } } - void WaypointReached(uint32 uiPointId) + void WaypointReached(uint32 waypointId) { - switch (uiPointId) + switch (waypointId) { case 0: DoScriptText(SAY_BREAKOUT1, me); @@ -256,9 +277,7 @@ public: void JustSummoned(Creature* summoned) { if (Player* player = GetPlayerForEscort()) - { summoned->AI()->AttackStart(player); - } if (summoned->GetEntry() == NPC_HIGH_INQUISITOR_VALROTH) m_uiValrothGUID = summoned->GetGUID(); @@ -400,7 +419,7 @@ public: switch (uiStage) { case 1: - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(true); if (GameObject* tree = me->FindNearestGameObject(GO_INCONSPICUOUS_TREE, 40.0f)) { DoScriptText(SAY_TREE1, me); @@ -608,48 +627,48 @@ public: me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); } - bool MeetQuestCondition(Unit* player) + bool MeetQuestCondition(Player* player) { switch (me->GetEntry()) { case 29061: // Ellen Stanbridge - if (CAST_PLR(player)->GetQuestStatus(12742) == QUEST_STATUS_INCOMPLETE) + if (player->GetQuestStatus(12742) == QUEST_STATUS_INCOMPLETE) return true; break; case 29072: // Kug Ironjaw - if (CAST_PLR(player)->GetQuestStatus(12748) == QUEST_STATUS_INCOMPLETE) + if (player->GetQuestStatus(12748) == QUEST_STATUS_INCOMPLETE) return true; break; case 29067: // Donovan Pulfrost - if (CAST_PLR(player)->GetQuestStatus(12744) == QUEST_STATUS_INCOMPLETE) + if (player->GetQuestStatus(12744) == QUEST_STATUS_INCOMPLETE) return true; break; case 29065: // Yazmina Oakenthorn - if (CAST_PLR(player)->GetQuestStatus(12743) == QUEST_STATUS_INCOMPLETE) + if (player->GetQuestStatus(12743) == QUEST_STATUS_INCOMPLETE) return true; break; case 29071: // Antoine Brack - if (CAST_PLR(player)->GetQuestStatus(12750) == QUEST_STATUS_INCOMPLETE) + if (player->GetQuestStatus(12750) == QUEST_STATUS_INCOMPLETE) return true; break; case 29032: // Malar Bravehorn - if (CAST_PLR(player)->GetQuestStatus(12739) == QUEST_STATUS_INCOMPLETE) + if (player->GetQuestStatus(12739) == QUEST_STATUS_INCOMPLETE) return true; break; case 29068: // Goby Blastenheimer - if (CAST_PLR(player)->GetQuestStatus(12745) == QUEST_STATUS_INCOMPLETE) + if (player->GetQuestStatus(12745) == QUEST_STATUS_INCOMPLETE) return true; break; case 29073: // Iggy Darktusk - if (CAST_PLR(player)->GetQuestStatus(12749) == QUEST_STATUS_INCOMPLETE) + if (player->GetQuestStatus(12749) == QUEST_STATUS_INCOMPLETE) return true; break; case 29074: // Lady Eonys - if (CAST_PLR(player)->GetQuestStatus(12747) == QUEST_STATUS_INCOMPLETE) + if (player->GetQuestStatus(12747) == QUEST_STATUS_INCOMPLETE) return true; break; case 29070: // Valok the Righteous - if (CAST_PLR(player)->GetQuestStatus(12746) == QUEST_STATUS_INCOMPLETE) + if (player->GetQuestStatus(12746) == QUEST_STATUS_INCOMPLETE) return true; break; } @@ -662,7 +681,7 @@ public: if (PlayerGUID || who->GetTypeId() != TYPEID_PLAYER || !who->IsWithinDist(me, INTERACTION_DISTANCE)) return; - if (MeetQuestCondition(who)) + if (MeetQuestCondition(who->ToPlayer())) PlayerGUID = who->GetGUID(); } @@ -704,7 +723,9 @@ public: me->SetStandState(UNIT_STAND_STATE_KNEEL); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, player); break; + case 10: + DoScriptText(SAY_EXEC_WAITING, me, player); + break; case 11: DoScriptText(EMOTE_DIES, me); me->setDeathState(JUST_DIED); @@ -732,7 +753,9 @@ public: me->SetStandState(UNIT_STAND_STATE_KNEEL); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, player); break; + case 10: + DoScriptText(SAY_EXEC_WAITING, me, player); + break; case 11: DoScriptText(EMOTE_DIES, me); me->setDeathState(JUST_DIED); @@ -760,7 +783,9 @@ public: me->SetStandState(UNIT_STAND_STATE_KNEEL); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, player); break; + case 10: + DoScriptText(SAY_EXEC_WAITING, me, player); + break; case 11: DoScriptText(EMOTE_DIES, me); me->setDeathState(JUST_DIED); @@ -788,7 +813,9 @@ public: me->SetStandState(UNIT_STAND_STATE_KNEEL); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, player); break; + case 10: + DoScriptText(SAY_EXEC_WAITING, me, player); + break; case 11: DoScriptText(EMOTE_DIES, me); me->setDeathState(JUST_DIED); @@ -816,7 +843,9 @@ public: me->SetStandState(UNIT_STAND_STATE_KNEEL); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, player); break; + case 10: + DoScriptText(SAY_EXEC_WAITING, me, player); + break; case 11: DoScriptText(EMOTE_DIES, me); me->setDeathState(JUST_DIED); @@ -844,7 +873,9 @@ public: me->SetStandState(UNIT_STAND_STATE_KNEEL); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, player); break; + case 10: + DoScriptText(SAY_EXEC_WAITING, me, player); + break; case 11: DoScriptText(EMOTE_DIES, me); me->setDeathState(JUST_DIED); @@ -872,7 +903,9 @@ public: me->SetStandState(UNIT_STAND_STATE_KNEEL); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, player); break; + case 10: + DoScriptText(SAY_EXEC_WAITING, me, player); + break; case 11: DoScriptText(EMOTE_DIES, me); me->setDeathState(JUST_DIED); @@ -900,7 +933,9 @@ public: me->SetStandState(UNIT_STAND_STATE_KNEEL); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, player); break; + case 10: + DoScriptText(SAY_EXEC_WAITING, me, player); + break; case 11: DoScriptText(EMOTE_DIES, me); me->setDeathState(JUST_DIED); @@ -928,7 +963,9 @@ public: me->SetStandState(UNIT_STAND_STATE_KNEEL); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, player); break; + case 10: + DoScriptText(SAY_EXEC_WAITING, me, player); + break; case 11: DoScriptText(EMOTE_DIES, me); me->setDeathState(JUST_DIED); @@ -956,7 +993,9 @@ public: me->SetStandState(UNIT_STAND_STATE_KNEEL); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, player); break; + case 10: + DoScriptText(SAY_EXEC_WAITING, me, player); + break; case 11: DoScriptText(EMOTE_DIES, me); me->setDeathState(JUST_DIED); @@ -978,7 +1017,6 @@ public: } } }; - }; void AddSC_the_scarlet_enclave_c2() diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp index 81c4b1261ef..8cee23fab1c 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp @@ -287,10 +287,10 @@ class npc_highlord_darion_mograine : public CreatureScript public: npc_highlord_darion_mograine() : CreatureScript("npc_highlord_darion_mograine") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: player->CLOSE_GOSSIP_MENU(); @@ -497,17 +497,16 @@ public: SetEscortPaused(bOnHold); } - void WaypointReached(uint32 wpId) + void WaypointReached(uint32 waypointId) { - switch (wpId) + switch (waypointId) { case 0: - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(false); SetHoldState(true); break; case 1: SetHoldState(true); - SpawnNPC(); if (Creature* temp = Unit::GetCreature(*me, uiKorfaxGUID)) DoScriptText(SAY_LIGHT_OF_DAWN07, temp); @@ -537,7 +536,7 @@ public: bIsBattle = true; break; case 2: - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(true); DoCast(me, SPELL_THE_LIGHT_OF_DAWN); break; case 3: @@ -551,34 +550,35 @@ public: { if (temp->HasAura(SPELL_THE_LIGHT_OF_DAWN, 0)) temp->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN); - temp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + temp->SetWalk(true); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[19].x, LightofDawnLoc[19].y, LightofDawnLoc[19].z); } if (Creature* temp = Unit::GetCreature(*me, uiThassarianGUID)) { if (temp->HasAura(SPELL_THE_LIGHT_OF_DAWN, 0)) temp->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN); - temp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + temp->SetWalk(true); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[21].x, LightofDawnLoc[21].y, LightofDawnLoc[21].z); } if (Creature* temp = Unit::GetCreature(*me, uiKorfaxGUID)) { - temp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + temp->SetWalk(true); temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[10].x, LightofDawnLoc[10].y, LightofDawnLoc[10].z); } if (Creature* temp = Unit::GetCreature(*me, uiMaxwellGUID)) { - temp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + temp->SetWalk(true); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[13].x, LightofDawnLoc[13].y, LightofDawnLoc[13].z); } if (Creature* temp = Unit::GetCreature(*me, uiEligorGUID)) { - temp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + temp->SetWalk(true); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[16].x, LightofDawnLoc[16].y, LightofDawnLoc[16].z); } JumpToNextStep(10000); - } break; + } + break; case 4: DoScriptText(SAY_LIGHT_OF_DAWN27, me); me->SetStandState(UNIT_STAND_STATE_KNEEL); @@ -664,7 +664,7 @@ public: if (uiSummon_counter < ENCOUNTER_GHOUL_NUMBER) { Unit* temp = me->SummonCreature(NPC_ACHERUS_GHOUL, (me->GetPositionX()-20)+rand()%40, (me->GetPositionY()-20)+rand()%40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); - temp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + temp->SetWalk(false); temp->setFaction(2084); uiGhoulGUID[uiSummon_counter] = temp->GetGUID(); ++uiSummon_counter; @@ -682,7 +682,7 @@ public: if (uiSummon_counter < ENCOUNTER_ABOMINATION_NUMBER) { Unit* temp = me->SummonCreature(NPC_RAMPAGING_ABOMINATION, (me->GetPositionX()-20)+rand()%40, (me->GetPositionY()-20)+rand()%40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); - temp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + temp->SetWalk(false); temp->setFaction(2084); uiAbominationGUID[uiSummon_counter] = temp->GetGUID(); ++uiSummon_counter; @@ -700,7 +700,7 @@ public: if (uiSummon_counter < ENCOUNTER_WARRIOR_NUMBER) { Unit* temp = me->SummonCreature(NPC_WARRIOR_OF_THE_FROZEN_WASTES, (me->GetPositionX()-20)+rand()%40, (me->GetPositionY()-20)+rand()%40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); - temp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + temp->SetWalk(false); temp->setFaction(2084); uiWarriorGUID[uiSummon_counter] = temp->GetGUID(); ++uiSummon_counter; @@ -718,7 +718,7 @@ public: if (uiSummon_counter < ENCOUNTER_BEHEMOTH_NUMBER) { Unit* temp = me->SummonCreature(NPC_FLESH_BEHEMOTH, (me->GetPositionX()-20)+rand()%40, (me->GetPositionY()-20)+rand()%40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); - temp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + temp->SetWalk(false); temp->setFaction(2084); uiBehemothGUID[uiSummon_counter] = temp->GetGUID(); ++uiSummon_counter; @@ -739,17 +739,17 @@ public: SetHoldState(false); if (Creature* temp = Unit::GetCreature(*me, uiKoltiraGUID)) { - temp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + temp->SetWalk(false); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); } if (Creature* temp = Unit::GetCreature(*me, uiOrbazGUID)) { - temp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + temp->SetWalk(false); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); } if (Creature* temp = Unit::GetCreature(*me, uiThassarianGUID)) { - temp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + temp->SetWalk(false); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); } for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) @@ -824,7 +824,7 @@ public: if (Unit* temp = me->SummonCreature(NPC_DARION_MOGRAINE, LightofDawnLoc[24].x, LightofDawnLoc[24].y, LightofDawnLoc[24].z, LightofDawnLoc[24].o, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) { DoScriptText(SAY_LIGHT_OF_DAWN35, temp); - temp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + temp->SetWalk(false); uiDarionGUID = temp->GetGUID(); } JumpToNextStep(4000); @@ -938,9 +938,9 @@ public: case 33: // Darion supports to jump to lich king here if (Unit::GetCreature(*me, uiLichKingGUID)) DoCast(me, SPELL_MOGRAINE_CHARGE); // jumping charge - // doesn't make it looks well, so workarounds, Darion charges, looks better + // doesn't make it looks well, so workarounds, Darion charges, looks better me->SetSpeed(MOVE_RUN, 3.0f); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(false); SetHoldState(false); JumpToNextStep(0); break; @@ -1010,10 +1010,9 @@ public: if (fLichPositionX && fLichPositionY) { - Unit* temp; - temp = me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); + Unit* temp = me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); - temp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + temp->SetWalk(false); temp->SetSpeed(MOVE_RUN, 2.0f); temp->setFaction(me->getFaction()); temp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); @@ -1021,7 +1020,7 @@ public: temp = me->SummonCreature(NPC_RIMBLAT_EARTHSHATTER, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); - temp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + temp->SetWalk(false); temp->SetSpeed(MOVE_RUN, 2.0f); temp->setFaction(me->getFaction()); temp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); @@ -1030,7 +1029,7 @@ public: if (Creature* temp = Unit::GetCreature(*me, uiMaxwellGUID)) { temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); - temp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + temp->SetWalk(false); temp->SetSpeed(MOVE_RUN, 2.0f); temp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); DoScriptText(SAY_LIGHT_OF_DAWN50, temp); @@ -1038,7 +1037,7 @@ public: if (Creature* temp = Unit::GetCreature(*me, uiKorfaxGUID)) { temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); - temp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + temp->SetWalk(false); temp->SetSpeed(MOVE_RUN, 2.0f); temp->HandleEmoteCommand(EMOTE_STATE_ATTACK_UNARMED); temp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); @@ -1046,7 +1045,7 @@ public: if (Creature* temp = Unit::GetCreature(*me, uiEligorGUID)) { temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); - temp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + temp->SetWalk(false); temp->SetSpeed(MOVE_RUN, 2.0f); temp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); } @@ -1111,7 +1110,7 @@ public: case 46: // Darion stand up, "not today" me->SetSpeed(MOVE_RUN, 1.0f); - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(true); me->SetStandState(UNIT_STAND_STATE_STAND); DoScriptText(SAY_LIGHT_OF_DAWN53, me); SetHoldState(false); // Darion throws sword @@ -1171,7 +1170,7 @@ public: temp->CastSpell(temp, SPELL_TIRION_CHARGE, false); // jumping charge temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); temp->SetSpeed(MOVE_RUN, 3.0f); // workarounds, make Tirion still running - temp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + temp->SetWalk(false); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[2].x, LightofDawnLoc[2].y, LightofDawnLoc[2].z); if (Creature* lktemp = Unit::GetCreature(*me, uiLichKingGUID)) lktemp->Relocate(LightofDawnLoc[28].x, LightofDawnLoc[28].y, LightofDawnLoc[28].z); // workarounds, he should kick back by Tirion, but here we relocate him @@ -1189,7 +1188,7 @@ public: if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID)) { temp->SetSpeed(MOVE_RUN, 1.0f); - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(true); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[29].x, LightofDawnLoc[29].y, LightofDawnLoc[29].z); // 26 } JumpToNextStep(4000); @@ -1249,7 +1248,7 @@ public: case 62: if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID)) { - temp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + temp->SetWalk(true); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[7].x, LightofDawnLoc[7].y, LightofDawnLoc[7].z); } JumpToNextStep(5500); @@ -1309,7 +1308,6 @@ public: case 71: //if (GameObject* go = me->GetMap()->GetGameObject(uiDawnofLightGUID)) // Turn off dawn of light // go->SetPhaseMask(0, true); - { Map* map = me->GetMap(); // search players with in 50 yards for quest credit Map::PlayerList const &PlayerList = map->GetPlayers(); @@ -1438,7 +1436,7 @@ public: me->DeleteThreatList(); me->CombatStop(true); me->InterruptNonMeleeSpells(false); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(false); for (uint8 i = 0; i < ENCOUNTER_DEFENDER_NUMBER; ++i) DespawnNPC(uiDefenderGUID[i]); @@ -1460,7 +1458,7 @@ public: temp->CombatStop(true); temp->AttackStop(); temp->setFaction(me->getFaction()); - temp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + temp->SetWalk(false); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[9].x, LightofDawnLoc[9].y, LightofDawnLoc[9].z); } @@ -1471,7 +1469,7 @@ public: temp->CombatStop(true); temp->AttackStop(); temp->setFaction(me->getFaction()); - temp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + temp->SetWalk(false); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[12].x, LightofDawnLoc[12].y, LightofDawnLoc[12].z); } @@ -1482,7 +1480,7 @@ public: temp->CombatStop(true); temp->AttackStop(); temp->setFaction(me->getFaction()); - temp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + temp->SetWalk(false); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[15].x, LightofDawnLoc[15].y, LightofDawnLoc[15].z); } DespawnNPC(uiRayneGUID); @@ -1494,7 +1492,7 @@ public: temp->CombatStop(true); temp->AttackStop(); temp->setFaction(me->getFaction()); - temp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + temp->SetWalk(false); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[18].x, LightofDawnLoc[18].y, LightofDawnLoc[18].z); temp->CastSpell(temp, SPELL_THE_LIGHT_OF_DAWN, false); } @@ -1509,7 +1507,7 @@ public: temp->CombatStop(true); temp->AttackStop(); temp->setFaction(me->getFaction()); - temp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + temp->SetWalk(false); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[20].x, LightofDawnLoc[20].y, LightofDawnLoc[20].z); temp->CastSpell(temp, SPELL_THE_LIGHT_OF_DAWN, false); } diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp index 9512d66b6eb..0ef2dddda8d 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp @@ -35,7 +35,7 @@ public: struct npc_valkyr_battle_maidenAI : public PassiveAI { - npc_valkyr_battle_maidenAI(Creature* c) : PassiveAI(c) {} + npc_valkyr_battle_maidenAI(Creature* creature) : PassiveAI(creature) {} uint32 FlyBackTimer; float x, y, z; @@ -46,7 +46,7 @@ public: me->setActive(true); me->SetVisible(false); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetFlying(true); + me->SetCanFly(true); FlyBackTimer = 500; phase = 0; @@ -74,7 +74,7 @@ public: switch (phase) { case 0: - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(false); me->HandleEmoteCommand(EMOTE_STATE_FLYGRABCLOSED); FlyBackTimer = 500; break; diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp index 77099f2e2d7..813c43288d0 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -296,8 +296,11 @@ public: if (spell->Id == SPELL_FLYING_HEAD) { - if (Phase < 3) ++Phase; - else Phase = 3; + if (Phase < 3) + ++Phase; + else + Phase = 3; + withbody = false; if (!bodyGUID) bodyGUID = caster->GetGUID(); @@ -319,7 +322,8 @@ public: if (wait <= diff) { wait = 1000; - if (!me->getVictim()) return; + if (!me->getVictim()) + return; me->GetMotionMaster()->Clear(false); me->GetMotionMaster()->MoveFleeing(me->getVictim()); } @@ -344,7 +348,7 @@ public: if (wait <= diff) { die = false; - if (Unit* body = Unit::GetUnit((*me), bodyGUID)) + if (Unit* body = Unit::GetUnit(*me, bodyGUID)) body->Kill(body); me->Kill(me); } @@ -429,7 +433,7 @@ public: { me->SetVisible(false); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING); + me->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_DISABLE_GRAVITY); me->SetSpeed(MOVE_WALK, 5.0f, true); wp_reached = false; count = 0; @@ -462,7 +466,7 @@ public: instance->SetData(GAMEOBJECT_PUMPKIN_SHRINE, 0); //hide gameobject break; case 19: - me->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_DISABLE_GRAVITY); break; case 20: { @@ -471,7 +475,7 @@ public: wp_reached = false; me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); SaySound(SAY_ENTRANCE); - if (Unit* player = Unit::GetUnit((*me), PlayerGUID)) + if (Unit* player = Unit::GetUnit(*me, PlayerGUID)) DoStartMovement(player); break; } @@ -485,12 +489,18 @@ public: instance->SetData(DATA_HORSEMAN_EVENT, IN_PROGRESS); DoZoneInCombat(); } - void AttackStart(Unit* who) {ScriptedAI::AttackStart(who);} + + void AttackStart(Unit* who) + { + ScriptedAI::AttackStart(who); + } + void MoveInLineOfSight(Unit* who) { if (withhead && Phase != 0) ScriptedAI::MoveInLineOfSight(who); } + void KilledUnit(Unit* player) { if (player->GetTypeId() == TYPEID_PLAYER) @@ -576,7 +586,7 @@ public: std::list<HostileReference*>::const_iterator itr; for (itr = caster->getThreatManager().getThreatList().begin(); itr != caster->getThreatManager().getThreatList().end(); ++itr) { - Unit* unit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); + Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()); if (unit && unit->isAlive() && unit != caster) me->AddThreat(unit, caster->getThreatManager().getThreat(unit)); } @@ -595,7 +605,8 @@ public: if (!headGUID) headGUID = DoSpawnCreature(HEAD, float(rand()%6), float(rand()%6), 0, 0, TEMPSUMMON_DEAD_DESPAWN, 0)->GetGUID(); - Unit* Head = Unit::GetUnit((*me), headGUID); + + Unit* Head = Unit::GetUnit(*me, headGUID); if (Head && Head->isAlive()) { Head->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -803,14 +814,22 @@ public: void Despawn() { - if (!debuffGUID) return; - Unit* debuff = Unit::GetUnit((*me), debuffGUID); + if (!debuffGUID) + return; + + Unit* debuff = Unit::GetUnit(*me, debuffGUID); if (debuff) + { debuff->SetVisible(false); debuffGUID = 0; + } } - void JustDied(Unit* /*killer*/) { if (!sprouted) Despawn(); } + void JustDied(Unit* /*killer*/) + { + if (!sprouted) + Despawn(); + } void MoveInLineOfSight(Unit* who) { diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp index 16b90f89bb5..58c21d86a2f 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp @@ -152,7 +152,12 @@ public: uint32 Start_Timer; void Reset() {} - void WaypointReached(uint32 /*point*/) {} + + void WaypointReached(uint32 /*waypointId*/) + { + + } + void EnterCombat(Unit* /*who*/) {} void UpdateAI(const uint32 diff) diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp index a64636a4223..1989c318c84 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp @@ -66,9 +66,15 @@ public: Sleep_Timer = 30000; Dispel_Timer = 20000; PowerWordShield = false; + me->SetStandState(UNIT_STAND_STATE_DEAD); + me->SetUInt32Value(UNIT_FIELD_BYTES_1, 7); } - void EnterCombat(Unit* /*who*/) {} + void EnterCombat(Unit* /*who*/) + { + me->SetStandState(UNIT_STAND_STATE_STAND); + me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); + } void UpdateAI(const uint32 diff) { diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp index 058c688641f..fd978136339 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp @@ -78,12 +78,12 @@ public: DoScriptText(SAY_KILL, me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { if (!instance) return; - //Any other actions to do with vorrel? setStandState? + //Any other Actions to do with vorrel? setStandState? if (Unit* vorrel = Unit::GetUnit(*me, instance->GetData64(DATA_VORREL))) DoScriptText(SAY_TRIGGER_VORREL, vorrel); } diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp index ec6ac34b0bb..8d813bfe502 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp @@ -132,7 +132,7 @@ public: return; //On first death, fake death and open door, as well as initiate whitemane if exist - if (Unit* Whitemane = Unit::GetUnit((*me), instance->GetData64(DATA_WHITEMANE))) + if (Unit* Whitemane = Unit::GetUnit(*me, instance->GetData64(DATA_WHITEMANE))) { instance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, IN_PROGRESS); @@ -181,7 +181,7 @@ public: if (_bHasDied && !_bHeal && instance && instance->GetData(TYPE_MOGRAINE_AND_WHITE_EVENT) == SPECIAL) { //On ressurection, stop fake death and heal whitemane and resume fight - if (Unit* Whitemane = Unit::GetUnit((*me), instance->GetData64(DATA_WHITEMANE))) + if (Unit* Whitemane = Unit::GetUnit(*me, instance->GetData64(DATA_WHITEMANE))) { me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetStandState(UNIT_STAND_STATE_STAND); @@ -292,7 +292,7 @@ public: //When casting resuruction make sure to delay so on rez when reinstate battle deepsleep runs out if (instance && Wait_Timer <= diff) { - if (Unit* Mograine = Unit::GetUnit((*me), instance->GetData64(DATA_MOGRAINE))) + if (Unit* Mograine = Unit::GetUnit(*me, instance->GetData64(DATA_MOGRAINE))) { DoCast(Mograine, SPELL_SCARLETRESURRECTION); DoScriptText(SAY_WH_RESSURECT, me); diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp index 4ddc240a03c..2bc0320b81d 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp @@ -62,7 +62,7 @@ public: struct boss_darkmaster_gandlingAI : public ScriptedAI { - boss_darkmaster_gandlingAI(Creature* c) : ScriptedAI(c) + boss_darkmaster_gandlingAI(Creature* creature) : ScriptedAI(creature) { instance = me->GetInstanceScript(); } diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp index 693cad06bd5..967f771fe7a 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp @@ -37,7 +37,7 @@ public: struct boss_death_knight_darkreaverAI : public ScriptedAI { - boss_death_knight_darkreaverAI(Creature* c) : ScriptedAI(c) {} + boss_death_knight_darkreaverAI(Creature* creature) : ScriptedAI(creature) {} void Reset() { diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp index 05d662c4fe3..82f4dc85060 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp @@ -45,7 +45,7 @@ public: struct boss_theolenkrastinovAI : public ScriptedAI { - boss_theolenkrastinovAI(Creature* c) : ScriptedAI(c) {} + boss_theolenkrastinovAI(Creature* creature) : ScriptedAI(creature) {} uint32 m_uiRend_Timer; uint32 m_uiBackhand_Timer; diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp index 92f0fcd25c4..e438ae56a2b 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp @@ -43,7 +43,7 @@ public: struct boss_illuciabarovAI : public ScriptedAI { - boss_illuciabarovAI(Creature* c) : ScriptedAI(c) {} + boss_illuciabarovAI(Creature* creature) : ScriptedAI(creature) {} uint32 CurseOfAgony_Timer; uint32 ShadowShock_Timer; diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp index 295d9440d2e..498e6596b06 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp @@ -44,7 +44,7 @@ public: struct boss_instructormaliciaAI : public ScriptedAI { - boss_instructormaliciaAI(Creature* c) : ScriptedAI(c) {} + boss_instructormaliciaAI(Creature* creature) : ScriptedAI(creature) {} uint32 CallOfGraves_Timer; uint32 Corruption_Timer; diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp index 48bf000745c..064faa5643d 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp @@ -43,7 +43,7 @@ public: struct boss_jandicebarovAI : public ScriptedAI { - boss_jandicebarovAI(Creature* c) : ScriptedAI(c) {} + boss_jandicebarovAI(Creature* creature) : ScriptedAI(creature) {} uint32 CurseOfBlood_Timer; uint32 Illusion_Timer; @@ -165,7 +165,7 @@ public: struct mob_illusionofjandicebarovAI : public ScriptedAI { - mob_illusionofjandicebarovAI(Creature* c) : ScriptedAI(c) {} + mob_illusionofjandicebarovAI(Creature* creature) : ScriptedAI(creature) {} uint32 Cleave_Timer; diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp index 7c279e726a6..5fd5a96d605 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp @@ -40,7 +40,7 @@ public: struct boss_kormokAI : public ScriptedAI { - boss_kormokAI(Creature* c) : ScriptedAI(c) {} + boss_kormokAI(Creature* creature) : ScriptedAI(creature) {} uint32 ShadowVolley_Timer; uint32 BoneShield_Timer; diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp index 5109e6e1468..327c1df921d 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp @@ -41,7 +41,7 @@ public: struct boss_lordalexeibarovAI : public ScriptedAI { - boss_lordalexeibarovAI(Creature* c) : ScriptedAI(c) {} + boss_lordalexeibarovAI(Creature* creature) : ScriptedAI(creature) {} uint32 Immolate_Timer; uint32 VeilofShadow_Timer; diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp index 754640bff9e..1919a1ba099 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp @@ -43,7 +43,7 @@ public: struct boss_lorekeeperpolkeltAI : public ScriptedAI { - boss_lorekeeperpolkeltAI(Creature* c) : ScriptedAI(c) {} + boss_lorekeeperpolkeltAI(Creature* creature) : ScriptedAI(creature) {} uint32 VolatileInfection_Timer; uint32 Darkplague_Timer; diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp index 902838da152..fd10c6374a6 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp @@ -44,7 +44,7 @@ public: struct boss_rasfrostAI : public ScriptedAI { - boss_rasfrostAI(Creature* c) : ScriptedAI(c) {} + boss_rasfrostAI(Creature* creature) : ScriptedAI(creature) {} uint32 IceArmor_Timer; uint32 Frostbolt_Timer; diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp index 13fa450f5ee..a28cecf3772 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp @@ -43,7 +43,7 @@ public: struct boss_theravenianAI : public ScriptedAI { - boss_theravenianAI(Creature* c) : ScriptedAI(c) {} + boss_theravenianAI(Creature* creature) : ScriptedAI(creature) {} uint32 Trample_Timer; uint32 Cleave_Timer; diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp index 657b458e148..f5f453c30bd 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp @@ -45,7 +45,7 @@ public: struct boss_vectusAI : public ScriptedAI { - boss_vectusAI(Creature* c) : ScriptedAI(c) {} + boss_vectusAI(Creature* creature) : ScriptedAI(creature) {} uint32 m_uiFireShield_Timer; uint32 m_uiBlastWave_Timer; diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp index dded75e193c..63e753a18ba 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp @@ -63,10 +63,10 @@ public: return new npc_shadowfang_prisonerAI(creature); } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { player->CLOSE_GOSSIP_MENU(); @@ -90,18 +90,18 @@ public: struct npc_shadowfang_prisonerAI : public npc_escortAI { - npc_shadowfang_prisonerAI(Creature* c) : npc_escortAI(c) + npc_shadowfang_prisonerAI(Creature* creature) : npc_escortAI(creature) { - instance = c->GetInstanceScript(); - uiNpcEntry = c->GetEntry(); + instance = creature->GetInstanceScript(); + uiNpcEntry = creature->GetEntry(); } InstanceScript* instance; uint32 uiNpcEntry; - void WaypointReached(uint32 uiPoint) + void WaypointReached(uint32 waypointId) { - switch (uiPoint) + switch (waypointId) { case 0: if (uiNpcEntry == NPC_ASH) @@ -175,10 +175,7 @@ public: if (uiDarkOffering <= uiDiff) { if (Creature* pFriend = me->FindNearestCreature(me->GetEntry(), 25.0f, true)) - { - if (pFriend) - DoCast(pFriend, SPELL_DARK_OFFERING); - } + DoCast(pFriend, SPELL_DARK_OFFERING); else DoCast(me, SPELL_DARK_OFFERING); uiDarkOffering = urand(4400, 12500); diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp index 0c659117f5d..85faa14900b 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp @@ -89,7 +89,7 @@ public: struct boss_baron_rivendareAI : public ScriptedAI { - boss_baron_rivendareAI(Creature* c) : ScriptedAI(c) + boss_baron_rivendareAI(Creature* creature) : ScriptedAI(creature) { instance = me->GetInstanceScript(); } @@ -126,7 +126,7 @@ public: summoned->AI()->AttackStart(target); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { if (instance) instance->SetData(TYPE_BARON, DONE); diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp index a01846cb862..106719d654f 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp @@ -43,7 +43,7 @@ public: struct boss_baroness_anastariAI : public ScriptedAI { - boss_baroness_anastariAI(Creature* c) : ScriptedAI(c) + boss_baroness_anastariAI(Creature* creature) : ScriptedAI(creature) { instance = me->GetInstanceScript(); } @@ -67,7 +67,7 @@ public: { } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { if (instance) instance->SetData(TYPE_BARONESS, IN_PROGRESS); diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp index d84bd489dab..01299ae06b6 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp @@ -88,7 +88,7 @@ public: struct boss_cannon_master_willeyAI : public ScriptedAI { - boss_cannon_master_willeyAI(Creature* c) : ScriptedAI(c) {} + boss_cannon_master_willeyAI(Creature* creature) : ScriptedAI(creature) {} uint32 KnockAway_Timer; uint32 Pummel_Timer; @@ -103,7 +103,7 @@ public: SummonRifleman_Timer = 15000; } - void JustDied(Unit* /*Victim*/) + void JustDied(Unit* /*killer*/) { me->SummonCreature(11054, ADD_1X, ADD_1Y, ADD_1Z, ADD_1O, TEMPSUMMON_TIMED_DESPAWN, 240000); me->SummonCreature(11054, ADD_2X, ADD_2Y, ADD_2Z, ADD_2O, TEMPSUMMON_TIMED_DESPAWN, 240000); diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp index 8a14f1e2401..21e3e19d890 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp @@ -77,7 +77,7 @@ public: struct boss_dathrohan_balnazzarAI : public ScriptedAI { - boss_dathrohan_balnazzarAI(Creature* c) : ScriptedAI(c) {} + boss_dathrohan_balnazzarAI(Creature* creature) : ScriptedAI(creature) {} uint32 m_uiCrusadersHammer_Timer; uint32 m_uiCrusaderStrike_Timer; @@ -105,7 +105,7 @@ public: me->UpdateEntry(NPC_DATHROHAN); } - void JustDied(Unit* /*Victim*/) + void JustDied(Unit* /*killer*/) { static uint32 uiCount = sizeof(m_aSummonPoint)/sizeof(SummonDef); diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp index 48b1fc2acc7..37e0bd5757f 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp @@ -46,7 +46,7 @@ public: struct boss_magistrate_barthilasAI : public ScriptedAI { - boss_magistrate_barthilasAI(Creature* c) : ScriptedAI(c) {} + boss_magistrate_barthilasAI(Creature* creature) : ScriptedAI(creature) {} uint32 DrainingBlow_Timer; uint32 CrowdPummel_Timer; @@ -75,7 +75,7 @@ public: ScriptedAI::MoveInLineOfSight(who); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { me->SetDisplayId(MODEL_HUMAN); } diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp index 1dc22a20d08..f8a10f06155 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp @@ -43,7 +43,7 @@ public: struct boss_maleki_the_pallidAI : public ScriptedAI { - boss_maleki_the_pallidAI(Creature* c) : ScriptedAI(c) + boss_maleki_the_pallidAI(Creature* creature) : ScriptedAI(creature) { instance = me->GetInstanceScript(); } @@ -65,7 +65,7 @@ public: { } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { if (instance) instance->SetData(TYPE_PALLID, IN_PROGRESS); diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp index a7c91c3636d..c9a43edb66d 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp @@ -43,7 +43,7 @@ public: struct boss_nerubenkanAI : public ScriptedAI { - boss_nerubenkanAI(Creature* c) : ScriptedAI(c) + boss_nerubenkanAI(Creature* creature) : ScriptedAI(creature) { instance = me->GetInstanceScript(); } @@ -67,7 +67,7 @@ public: { } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { if (instance) instance->SetData(TYPE_NERUB, IN_PROGRESS); diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp index 3393b9e5797..ebeda248331 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp @@ -54,9 +54,9 @@ public: struct boss_silver_hand_bossesAI : public ScriptedAI { - boss_silver_hand_bossesAI(Creature* c) : ScriptedAI(c) + boss_silver_hand_bossesAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -96,30 +96,34 @@ public: { } - void JustDied(Unit* Killer) + void JustDied(Unit* killer) { - if (instance) + if (!instance) + return; + + switch (me->GetEntry()) { - switch (me->GetEntry()) - { - case SH_AELMAR: - instance->SetData(TYPE_SH_AELMAR, 2); - break; - case SH_CATHELA: - instance->SetData(TYPE_SH_CATHELA, 2); - break; - case SH_GREGOR: - instance->SetData(TYPE_SH_GREGOR, 2); - break; - case SH_NEMAS: - instance->SetData(TYPE_SH_NEMAS, 2); - break; - case SH_VICAR: - instance->SetData(TYPE_SH_VICAR, 2); - break; - } - if (instance->GetData(TYPE_SH_QUEST) && Killer->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(Killer)->KilledMonsterCredit(SH_QUEST_CREDIT, 0); + case SH_AELMAR: + instance->SetData(TYPE_SH_AELMAR, 2); + break; + case SH_CATHELA: + instance->SetData(TYPE_SH_CATHELA, 2); + break; + case SH_GREGOR: + instance->SetData(TYPE_SH_GREGOR, 2); + break; + case SH_NEMAS: + instance->SetData(TYPE_SH_NEMAS, 2); + break; + case SH_VICAR: + instance->SetData(TYPE_SH_VICAR, 2); + break; + } + + if (instance->GetData(TYPE_SH_QUEST)) + { + if (Player* player = killer->ToPlayer()) + player->KilledMonsterCredit(SH_QUEST_CREDIT, 0); } } diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp index 869a82011ad..cf8b10a2ee5 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp @@ -48,7 +48,7 @@ public: struct boss_postmaster_malownAI : public ScriptedAI { - boss_postmaster_malownAI(Creature* c) : ScriptedAI(c) {} + boss_postmaster_malownAI(Creature* creature) : ScriptedAI(creature) {} uint32 WailingDead_Timer; uint32 Backhand_Timer; diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp index f35bcc05ec2..3bb1ce7959d 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp @@ -43,7 +43,7 @@ public: struct boss_ramstein_the_gorgerAI : public ScriptedAI { - boss_ramstein_the_gorgerAI(Creature* c) : ScriptedAI(c) + boss_ramstein_the_gorgerAI(Creature* creature) : ScriptedAI(creature) { instance = me->GetInstanceScript(); } @@ -63,7 +63,7 @@ public: { } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { for (uint8 i = 0; i < 30; ++i) { diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp index 405527ab383..a281c1b59c6 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp @@ -41,7 +41,7 @@ public: struct boss_timmy_the_cruelAI : public ScriptedAI { - boss_timmy_the_cruelAI(Creature* c) : ScriptedAI(c) {} + boss_timmy_the_cruelAI(Creature* creature) : ScriptedAI(creature) {} uint32 RavenousClaw_Timer; bool HasYelled; diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp index 5b2b2fd46c1..7e167093e07 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp @@ -99,7 +99,7 @@ public: struct mob_freed_soulAI : public ScriptedAI { - mob_freed_soulAI(Creature* c) : ScriptedAI(c) {} + mob_freed_soulAI(Creature* creature) : ScriptedAI(creature) {} void Reset() { @@ -133,7 +133,7 @@ public: struct mob_restless_soulAI : public ScriptedAI { - mob_restless_soulAI(Creature* c) : ScriptedAI(c) {} + mob_restless_soulAI(Creature* creature) : ScriptedAI(creature) {} uint64 Tagger; uint32 Die_Timer; @@ -165,7 +165,7 @@ public: summoned->CastSpell(summoned, SPELL_SOUL_FREED, false); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { if (Tagged) me->SummonCreature(ENTRY_FREED, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 300000); @@ -211,7 +211,7 @@ public: struct mobs_spectral_ghostly_citizenAI : public ScriptedAI { - mobs_spectral_ghostly_citizenAI(Creature* c) : ScriptedAI(c) {} + mobs_spectral_ghostly_citizenAI(Creature* creature) : ScriptedAI(creature) {} uint32 Die_Timer; bool Tagged; @@ -230,7 +230,7 @@ public: Tagged = true; } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { if (Tagged) { diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp index 1404fd14e91..43c94f8a57d 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp @@ -78,9 +78,9 @@ public: struct boss_brutallusAI : public ScriptedAI { - boss_brutallusAI(Creature* c) : ScriptedAI(c) + boss_brutallusAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); Intro = true; } @@ -132,7 +132,7 @@ public: DoScriptText(RAND(YELL_KILL1, YELL_KILL2, YELL_KILL3), me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(YELL_DEATH, me); @@ -216,7 +216,7 @@ public: break; case 3: DoCast(me, SPELL_INTRO_FROST_BLAST); - Madrigosa->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + Madrigosa->SetDisableGravity(true); me->AttackStop(); Madrigosa->AttackStop(); IntroFrostBoltTimer = 3000; diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp index 56d7909336c..03486a644a2 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp @@ -97,9 +97,9 @@ public: struct boss_sacrolashAI : public ScriptedAI { - boss_sacrolashAI(Creature* c) : ScriptedAI(c) + boss_sacrolashAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -120,7 +120,7 @@ public: if (instance) { - Unit* Temp = Unit::GetUnit((*me), instance->GetData64(DATA_ALYTHESS)); + Unit* Temp = Unit::GetUnit(*me, instance->GetData64(DATA_ALYTHESS)); if (Temp) { if (Temp->isDead()) @@ -152,7 +152,7 @@ public: if (instance) { - Unit* Temp = Unit::GetUnit((*me), instance->GetData64(DATA_ALYTHESS)); + Unit* Temp = Unit::GetUnit(*me, instance->GetData64(DATA_ALYTHESS)); if (Temp && Temp->isAlive() && !(Temp->getVictim())) CAST_CRE(Temp)->AI()->AttackStart(who); } @@ -167,7 +167,7 @@ public: DoScriptText(RAND(YELL_SAC_KILL_1, YELL_SAC_KILL_2), me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { // only if ALY death if (SisterDeath) @@ -231,7 +231,7 @@ public: if (instance) { Unit* Temp = NULL; - Temp = Unit::GetUnit((*me), instance->GetData64(DATA_ALYTHESS)); + Temp = Unit::GetUnit(*me, instance->GetData64(DATA_ALYTHESS)); if (Temp && Temp->isDead()) { DoScriptText(YELL_SISTER_ALYTHESS_DEAD, me); @@ -355,9 +355,9 @@ public: struct boss_alythessAI : public Scripted_NoMovementAI { - boss_alythessAI(Creature* c) : Scripted_NoMovementAI(c) + boss_alythessAI(Creature* creature) : Scripted_NoMovementAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); IntroStepCounter = 10; } @@ -382,7 +382,7 @@ public: if (instance) { - Unit* Temp = Unit::GetUnit((*me), instance->GetData64(DATA_SACROLASH)); + Unit* Temp = Unit::GetUnit(*me, instance->GetData64(DATA_SACROLASH)); if (Temp) { if (Temp->isDead()) @@ -415,7 +415,7 @@ public: if (instance) { - Unit* Temp = Unit::GetUnit((*me), instance->GetData64(DATA_SACROLASH)); + Unit* Temp = Unit::GetUnit(*me, instance->GetData64(DATA_SACROLASH)); if (Temp && Temp->isAlive() && !(Temp->getVictim())) CAST_CRE(Temp)->AI()->AttackStart(who); } @@ -462,7 +462,7 @@ public: } } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { if (SisterDeath) { @@ -567,7 +567,7 @@ public: if (instance) { Unit* Temp = NULL; - Temp = Unit::GetUnit((*me), instance->GetData64(DATA_SACROLASH)); + Temp = Unit::GetUnit(*me, instance->GetData64(DATA_SACROLASH)); if (Temp && Temp->isDead()) { DoScriptText(YELL_SISTER_SACROLASH_DEAD, me); @@ -684,7 +684,7 @@ public: struct mob_shadow_imageAI : public ScriptedAI { - mob_shadow_imageAI(Creature* c) : ScriptedAI(c) {} + mob_shadow_imageAI(Creature* creature) : ScriptedAI(creature) {} uint32 ShadowfuryTimer; uint32 KillTimer; diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp index c65ce2c8f98..72ad1100752 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp @@ -115,9 +115,9 @@ public: struct boss_felmystAI : public ScriptedAI { - boss_felmystAI(Creature* c) : ScriptedAI(c) + boss_felmystAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -137,7 +137,7 @@ public: uiFlightCount = 0; - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetDisableGravity(true); me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 10); me->SetFloatValue(UNIT_FIELD_COMBATREACH, 10); @@ -184,7 +184,7 @@ public: DoScriptText(YELL_BIRTH, me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(YELL_DEATH, me); @@ -254,7 +254,7 @@ public: events.ScheduleEvent(EVENT_FLIGHT, 60000); break; case PHASE_FLIGHT: - me->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); + me->SetUnitMovementFlags(MOVEMENTFLAG_DISABLE_GRAVITY); events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1000); uiFlightCount = 0; uiBreathCount = 0; @@ -391,7 +391,7 @@ public: } break; case 10: - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetDisableGravity(false); me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); EnterPhase(PHASE_GROUND); AttackStart(SelectTarget(SELECT_TARGET_TOPAGGRO)); @@ -522,7 +522,7 @@ public: struct mob_felmyst_vaporAI : public ScriptedAI { - mob_felmyst_vaporAI(Creature* c) : ScriptedAI(c) + mob_felmyst_vaporAI(Creature* creature) : ScriptedAI(creature) { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetSpeed(MOVE_RUN, 0.8f); @@ -555,7 +555,7 @@ public: struct mob_felmyst_trailAI : public ScriptedAI { - mob_felmyst_trailAI(Creature* c) : ScriptedAI(c) + mob_felmyst_trailAI(Creature* creature) : ScriptedAI(creature) { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); DoCast(me, SPELL_TRAIL_TRIGGER, true); diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp index d7c90732a80..f783fcc1eb5 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp @@ -115,9 +115,9 @@ public: struct boss_kalecgosAI : public ScriptedAI { - boss_kalecgosAI(Creature* c) : ScriptedAI(c) + boss_kalecgosAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); SathGUID = 0; DoorGUID = 0; bJustReset = false; @@ -159,7 +159,7 @@ public: if (!bJustReset) //first reset at create { me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetDisableGravity(false); me->SetVisible(true); me->SetStandState(UNIT_STAND_STATE_SLEEP); } @@ -231,7 +231,7 @@ public: if (ResetTimer <= diff) { me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetDisableGravity(false); me->SetVisible(true); me->SetStandState(UNIT_STAND_STATE_SLEEP); ResetTimer = 10000; @@ -400,7 +400,7 @@ public: TalkTimer = 10000; break; case 3: - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetDisableGravity(true); me->GetMotionMaster()->MovePoint(0, FLY_X, FLY_Y, FLY_Z); TalkTimer = 600000; break; @@ -418,7 +418,7 @@ public: TalkTimer = 3000; break; case 2: - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetDisableGravity(true); me->GetMotionMaster()->MovePoint(0, FLY_X, FLY_Y, FLY_Z); TalkTimer = 15000; break; @@ -456,9 +456,9 @@ public: bool isEnraged; // if demon is enraged - boss_kalecAI(Creature* c) : ScriptedAI(c) + boss_kalecAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } void Reset() @@ -575,9 +575,9 @@ public: struct boss_sathrovarrAI : public ScriptedAI { - boss_sathrovarrAI(Creature* c) : ScriptedAI(c) + boss_sathrovarrAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); KalecGUID = 0; KalecgosGUID = 0; } @@ -676,7 +676,9 @@ public: void TeleportAllPlayersBack() { Map* map = me->GetMap(); - if (!map->IsDungeon()) return; + if (!map->IsDungeon()) + return; + Map::PlayerList const &PlayerList = map->GetPlayers(); for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp index 337eea13438..8a64d45abcb 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp @@ -251,9 +251,9 @@ public: struct boss_kalecgos_kjAI : public ScriptedAI { - boss_kalecgos_kjAI(Creature* c) : ScriptedAI(c) + boss_kalecgos_kjAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -264,7 +264,7 @@ public: { OrbsEmpowered = 0; EmpowerCount = 0; - me->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING); + me->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_DISABLE_GRAVITY); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->setActive(true); @@ -406,9 +406,9 @@ public: struct mob_kiljaeden_controllerAI : public Scripted_NoMovementAI { - mob_kiljaeden_controllerAI(Creature* c) : Scripted_NoMovementAI(c), summons(me) + mob_kiljaeden_controllerAI(Creature* creature) : Scripted_NoMovementAI(creature), summons(me) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -434,8 +434,9 @@ public: { phase = PHASE_DECEIVERS; - if (Creature* pKalecKJ = Unit::GetCreature((*me), instance->GetData64(DATA_KALECGOS_KJ))) - CAST_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalecKJ->AI())->ResetOrbs(); + if (instance) + if (Creature* pKalecKJ = Unit::GetCreature((*me), instance->GetData64(DATA_KALECGOS_KJ))) + CAST_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalecKJ->AI())->ResetOrbs(); deceiverDeathCount = 0; bSummonedDeceivers = false; bKiljaedenDeath = false; @@ -451,7 +452,7 @@ public: summoned->CastSpell(summoned, SPELL_SHADOW_CHANNELING, false); break; case CREATURE_ANVEENA: - summoned->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING); + summoned->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_DISABLE_GRAVITY); summoned->CastSpell(summoned, SPELL_ANVEENA_PRISON, true); summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); break; @@ -506,9 +507,9 @@ public: struct boss_kiljaedenAI : public Scripted_NoMovementAI { - boss_kiljaedenAI(Creature* c) : Scripted_NoMovementAI(c), summons(me) + boss_kiljaedenAI(Creature* creature) : Scripted_NoMovementAI(creature), summons(me) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -660,17 +661,9 @@ public: DoScriptText(RAND(SAY_KJ_REFLECTION1, SAY_KJ_REFLECTION2), me); for (uint8 i = 0; i < 4; ++i) { - float x, y, z; - Unit* target = NULL; - for (uint8 i = 0; i < 6; ++i) - { - target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (!target || !target->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT, 0)) - break; - } - - if (target) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true, -SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT)) { + float x, y, z; target->GetPosition(x, y, z); if (Creature* pSinisterReflection = me->SummonCreature(CREATURE_SINISTER_REFLECTION, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0)) { @@ -922,9 +915,9 @@ public: struct mob_hand_of_the_deceiverAI : public ScriptedAI { - mob_hand_of_the_deceiverAI(Creature* c) : ScriptedAI(c) + mob_hand_of_the_deceiverAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -1023,7 +1016,7 @@ public: struct mob_felfire_portalAI : public Scripted_NoMovementAI { - mob_felfire_portalAI(Creature* c) : Scripted_NoMovementAI(c) {} + mob_felfire_portalAI(Creature* creature) : Scripted_NoMovementAI(creature) {} uint32 uiSpawnFiendTimer; @@ -1068,7 +1061,7 @@ public: struct mob_volatile_felfire_fiendAI : public ScriptedAI { - mob_volatile_felfire_fiendAI(Creature* c) : ScriptedAI(c) {} + mob_volatile_felfire_fiendAI(Creature* creature) : ScriptedAI(creature) {} uint32 uiExplodeTimer; @@ -1126,7 +1119,7 @@ public: struct mob_armageddonAI : public Scripted_NoMovementAI { - mob_armageddonAI(Creature* c) : Scripted_NoMovementAI(c) {} + mob_armageddonAI(Creature* creature) : Scripted_NoMovementAI(creature) {} uint8 spell; uint32 uiTimer; @@ -1181,9 +1174,9 @@ public: struct mob_shield_orbAI : public ScriptedAI { - mob_shield_orbAI(Creature* c) : ScriptedAI(c) + mob_shield_orbAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -1196,7 +1189,7 @@ public: void Reset() { - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetDisableGravity(true); bPointReached = true; uiTimer = urand(500, 1000); uiCheckTimer = 1000; @@ -1269,7 +1262,7 @@ public: struct mob_sinster_reflectionAI : public ScriptedAI { - mob_sinster_reflectionAI(Creature* c) : ScriptedAI(c) {} + mob_sinster_reflectionAI(Creature* creature) : ScriptedAI(creature) {} uint8 victimClass; uint32 uiTimer[3]; diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp index 9b5d941589b..66030a1c78c 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp @@ -113,9 +113,9 @@ public: struct boss_entropiusAI : public ScriptedAI { - boss_entropiusAI(Creature* c) : ScriptedAI(c), Summons(me) + boss_entropiusAI(Creature* creature) : ScriptedAI(creature), Summons(me) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -213,9 +213,9 @@ public: struct boss_muruAI : public Scripted_NoMovementAI { - boss_muruAI(Creature* c) : Scripted_NoMovementAI(c), Summons(me) + boss_muruAI(Creature* creature) : Scripted_NoMovementAI(creature), Summons(me) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -378,9 +378,9 @@ public: struct npc_muru_portalAI : public Scripted_NoMovementAI { - npc_muru_portalAI(Creature* c) : Scripted_NoMovementAI(c), Summons(me) + npc_muru_portalAI(Creature* creature) : Scripted_NoMovementAI(creature), Summons(me) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -462,7 +462,7 @@ public: struct npc_dark_fiendAI : public ScriptedAI { - npc_dark_fiendAI(Creature* c) : ScriptedAI(c) {} + npc_dark_fiendAI(Creature* creature) : ScriptedAI(creature) {} uint32 WaitTimer; bool InAction; @@ -525,7 +525,7 @@ public: struct npc_void_sentinelAI : public ScriptedAI { - npc_void_sentinelAI(Creature* c) : ScriptedAI(c){} + npc_void_sentinelAI(Creature* creature) : ScriptedAI(creature){} uint32 PulseTimer; uint32 VoidBlastTimer; @@ -581,9 +581,9 @@ public: struct npc_blackholeAI : public ScriptedAI { - npc_blackholeAI(Creature* c) : ScriptedAI(c) + npc_blackholeAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp index 0872ac9adca..7a946e9d5bf 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp @@ -153,7 +153,7 @@ class boss_archaedas : public CreatureScript // wake a wall minion if (uiWallMinionTimer <= uiDiff) { - instance->SetData (DATA_MINIONS, IN_PROGRESS); + instance->SetData(DATA_MINIONS, IN_PROGRESS); uiWallMinionTimer = 10000; } else uiWallMinionTimer -= uiDiff; @@ -232,7 +232,7 @@ class mob_archaedas_minions : public CreatureScript struct mob_archaedas_minionsAI : public ScriptedAI { - mob_archaedas_minionsAI(Creature* c) : ScriptedAI(c) + mob_archaedas_minionsAI(Creature* creature) : ScriptedAI(creature) { instance = me->GetInstanceScript(); } @@ -394,7 +394,7 @@ class go_altar_of_archaedas : public GameObjectScript { } - bool OnGossipHello(Player* player, GameObject* /*pGO*/) + bool OnGossipHello(Player* player, GameObject* /*go*/) { InstanceScript* instance = player->GetInstanceScript(); if (!instance) diff --git a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp index 60d17a7e5d2..fea64c55377 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp @@ -184,8 +184,8 @@ class instance_uldaman : public InstanceMapScript return; // only want the first one we find } // if we get this far than all four are dead so open the door - SetData (DATA_ALTAR_DOORS, DONE); - SetDoor (uiArchaedasTempleDoor, true); //open next the door too + SetData(DATA_ALTAR_DOORS, DONE); + SetDoor(uiArchaedasTempleDoor, true); //open next the door too } void ActivateWallMinions() @@ -320,7 +320,7 @@ class instance_uldaman : public InstanceMapScript uiIronayaSealDoorTimer -= diff; } - void SetData (uint32 type, uint32 data) + void SetData(uint32 type, uint32 data) { switch (type) { @@ -386,7 +386,7 @@ class instance_uldaman : public InstanceMapScript } } - void SetData64 (uint32 type, uint64 data) + void SetData64(uint32 type, uint64 data) { // Archaedas if (type == 0) @@ -425,7 +425,8 @@ class instance_uldaman : public InstanceMapScript void OnCreatureCreate(Creature* creature) { - switch (creature->GetEntry()) { + switch (creature->GetEntry()) + { case 4857: // Stone Keeper SetFrozenState (creature); vStoneKeeper.push_back(creature->GetGUID()); @@ -458,10 +459,10 @@ class instance_uldaman : public InstanceMapScript uiArchaedasGUID = creature->GetGUID(); break; - } // end switch - } // end OnCreatureCreate + } + } - uint64 GetData64 (uint32 identifier) + uint64 GetData64(uint32 identifier) { if (identifier == 0) return uiWhoWokeuiArchaedasGUID; if (identifier == 1) return vVaultWalker[0]; // VaultWalker1 diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp index eee6b08d834..a715dbfce9d 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp @@ -72,9 +72,9 @@ class boss_akilzon : public CreatureScript struct boss_akilzonAI : public ScriptedAI { - boss_akilzonAI(Creature* c) : ScriptedAI(c) + boss_akilzonAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -131,7 +131,7 @@ class boss_akilzon : public CreatureScript instance->SetData(DATA_AKILZONEVENT, IN_PROGRESS); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { me->MonsterYell(SAY_ONDEATH, LANG_UNIVERSAL, 0); DoPlaySoundToSet(me, SOUND_ONDEATH); @@ -209,9 +209,7 @@ class boss_akilzon : public CreatureScript for (std::list<Unit*>::const_iterator i = tempUnitMap.begin(); i != tempUnitMap.end(); ++i) { if (!Cloud->IsWithinDist(*i, 6, false)) - { Cloud->CastCustomSpell(*i, 43137, &bp0, NULL, NULL, true, 0, 0, me->GetGUID()); - } } // visual float x, y, z; @@ -311,7 +309,8 @@ class boss_akilzon : public CreatureScript isRaining = true; } - if (ElectricalStorm_Timer <= diff) { + if (ElectricalStorm_Timer <= diff) + { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true); if (!target) { @@ -324,16 +323,16 @@ class boss_akilzon : public CreatureScript target->GetPosition(x, y, z); if (target) { - target->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); + target->SetUnitMovementFlags(MOVEMENTFLAG_DISABLE_GRAVITY); target->MonsterMoveWithSpeed(x, y, me->GetPositionZ()+15, 0); } Unit* Cloud = me->SummonTrigger(x, y, me->GetPositionZ()+16, 0, 15000); if (Cloud) { CloudGUID = Cloud->GetGUID(); - Cloud->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); + Cloud->SetUnitMovementFlags(MOVEMENTFLAG_DISABLE_GRAVITY); Cloud->StopMoving(); - Cloud->SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f); + Cloud->SetObjectScale(1.0f); Cloud->setFaction(35); Cloud->SetMaxHealth(9999999); Cloud->SetHealth(9999999); @@ -390,15 +389,11 @@ class boss_akilzon : public CreatureScript class mob_akilzon_eagle : public CreatureScript { public: - - mob_akilzon_eagle() - : CreatureScript("mob_akilzon_eagle") - { - } + mob_akilzon_eagle() : CreatureScript("mob_akilzon_eagle") { } struct mob_akilzon_eagleAI : public ScriptedAI { - mob_akilzon_eagleAI(Creature* c) : ScriptedAI(c) {} + mob_akilzon_eagleAI(Creature* creature) : ScriptedAI(creature) { } uint32 EagleSwoop_Timer; bool arrived; @@ -409,10 +404,13 @@ class mob_akilzon_eagle : public CreatureScript EagleSwoop_Timer = urand(5000, 10000); arrived = true; TargetGUID = 0; - me->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); + me->SetUnitMovementFlags(MOVEMENTFLAG_DISABLE_GRAVITY); } - void EnterCombat(Unit* /*who*/) {DoZoneInCombat();} + void EnterCombat(Unit* /*who*/) + { + DoZoneInCombat(); + } void MoveInLineOfSight(Unit* /*who*/) {} diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp index db0e201298c..3baa6ebdf62 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp @@ -83,9 +83,9 @@ class boss_halazzi : public CreatureScript struct boss_halazziAI : public ScriptedAI { - boss_halazziAI(Creature* c) : ScriptedAI(c) + boss_halazziAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -324,7 +324,7 @@ class boss_halazzi : public CreatureScript } } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { if (instance) instance->SetData(DATA_HALAZZIEVENT, DONE); @@ -352,7 +352,7 @@ class mob_halazzi_lynx : public CreatureScript struct mob_halazzi_lynxAI : public ScriptedAI { - mob_halazzi_lynxAI(Creature* c) : ScriptedAI(c) {} + mob_halazzi_lynxAI(Creature* creature) : ScriptedAI(creature) {} uint32 FrenzyTimer; uint32 shredder_timer; diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp index 5efd4af55ea..b5698d851f8 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp @@ -179,14 +179,17 @@ struct boss_hexlord_addAI : public ScriptedAI { InstanceScript* instance; - boss_hexlord_addAI(Creature* c) : ScriptedAI(c) + boss_hexlord_addAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } void Reset() {} - void EnterCombat(Unit* /*who*/) {DoZoneInCombat();} + void EnterCombat(Unit* /*who*/) + { + DoZoneInCombat(); + } void UpdateAI(const uint32 /*diff*/) { @@ -211,9 +214,9 @@ class boss_hexlord_malacrass : public CreatureScript struct boss_hex_lord_malacrassAI : public ScriptedAI { - boss_hex_lord_malacrassAI(Creature* c) : ScriptedAI(c) + boss_hex_lord_malacrassAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); SelectAddEntry(); for (uint8 i = 0; i < 4; ++i) AddGUID[i] = 0; @@ -264,7 +267,7 @@ class boss_hexlord_malacrass : public CreatureScript for (uint8 i = 0; i < 4; ++i) { - Unit* Temp = Unit::GetUnit((*me), AddGUID[i]); + Unit* Temp = Unit::GetUnit(*me, AddGUID[i]); if (Temp && Temp->isAlive()) CAST_CRE(Temp)->AI()->AttackStart(me->getVictim()); else @@ -290,7 +293,7 @@ class boss_hexlord_malacrass : public CreatureScript } } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { if (instance) instance->SetData(DATA_HEXLORDEVENT, DONE); @@ -298,9 +301,9 @@ class boss_hexlord_malacrass : public CreatureScript me->MonsterYell(YELL_DEATH, LANG_UNIVERSAL, 0); DoPlaySoundToSet(me, SOUND_YELL_DEATH); - for (uint8 i = 0; i < 4 ; ++i) + for (uint8 i = 0; i < 4; ++i) { - Unit* Temp = Unit::GetUnit((*me), AddGUID[i]); + Unit* Temp = Unit::GetUnit(*me, AddGUID[i]); if (Temp && Temp->isAlive()) Temp->DealDamage(Temp, Temp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } @@ -488,7 +491,7 @@ class boss_thurg : public CreatureScript struct boss_thurgAI : public boss_hexlord_addAI { - boss_thurgAI(Creature* c) : boss_hexlord_addAI(c) {} + boss_thurgAI(Creature* creature) : boss_hexlord_addAI(creature) {} uint32 bloodlust_timer; uint32 cleave_timer; @@ -548,7 +551,7 @@ class boss_alyson_antille : public CreatureScript struct boss_alyson_antilleAI : public boss_hexlord_addAI { //Holy Priest - boss_alyson_antilleAI(Creature* c) : boss_hexlord_addAI(c) {} + boss_alyson_antilleAI(Creature* creature) : boss_hexlord_addAI(creature) {} uint32 flashheal_timer; uint32 dispelmagic_timer; @@ -637,7 +640,7 @@ class boss_alyson_antille : public CreatureScript struct boss_gazakrothAI : public boss_hexlord_addAI { - boss_gazakrothAI(Creature* c) : boss_hexlord_addAI(c) {} + boss_gazakrothAI(Creature* creature) : boss_hexlord_addAI(creature) {} uint32 firebolt_timer; @@ -691,7 +694,7 @@ class boss_lord_raadan : public CreatureScript struct boss_lord_raadanAI : public boss_hexlord_addAI { - boss_lord_raadanAI(Creature* c) : boss_hexlord_addAI(c) {} + boss_lord_raadanAI(Creature* creature) : boss_hexlord_addAI(creature) {} uint32 flamebreath_timer; uint32 thunderclap_timer; @@ -744,7 +747,7 @@ class boss_darkheart : public CreatureScript struct boss_darkheartAI : public boss_hexlord_addAI { - boss_darkheartAI(Creature* c) : boss_hexlord_addAI(c) {} + boss_darkheartAI(Creature* creature) : boss_hexlord_addAI(creature) {} uint32 psychicwail_timer; @@ -787,7 +790,7 @@ class boss_slither : public CreatureScript struct boss_slitherAI : public boss_hexlord_addAI { - boss_slitherAI(Creature* c) : boss_hexlord_addAI(c) {} + boss_slitherAI(Creature* creature) : boss_hexlord_addAI(creature) {} uint32 venomspit_timer; @@ -847,7 +850,7 @@ class boss_fenstalker : public CreatureScript struct boss_fenstalkerAI : public boss_hexlord_addAI { - boss_fenstalkerAI(Creature* c) : boss_hexlord_addAI(c) {} + boss_fenstalkerAI(Creature* creature) : boss_hexlord_addAI(creature) {} uint32 volatileinf_timer; @@ -894,7 +897,7 @@ class boss_koragg : public CreatureScript struct boss_koraggAI : public boss_hexlord_addAI { - boss_koraggAI(Creature* c) : boss_hexlord_addAI(c) {} + boss_koraggAI(Creature* creature) : boss_hexlord_addAI(creature) {} uint32 coldstare_timer; uint32 mightyblow_timer; diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp index 21245209e45..a2125c45689 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp @@ -113,9 +113,9 @@ class boss_janalai : public CreatureScript struct boss_janalaiAI : public ScriptedAI { - boss_janalaiAI(Creature* c) : ScriptedAI(c) + boss_janalaiAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -159,7 +159,7 @@ class boss_janalai : public CreatureScript HatchAllEggs(1); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); @@ -221,12 +221,13 @@ class boss_janalai : public CreatureScript dy = float(irand(-area_dy/2, area_dy/2)); Creature* bomb = DoSpawnCreature(MOB_FIRE_BOMB, dx, dy, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 15000); - if (bomb) FireBombGUIDs[i] = bomb->GetGUID(); + if (bomb) + FireBombGUIDs[i] = bomb->GetGUID(); } BombCount = 0; } - bool HatchAllEggs(uint32 uiAction) //1: reset, 2: isHatching all + bool HatchAllEggs(uint32 action) //1: reset, 2: isHatching all { std::list<Creature*> templist; float x, y, z; @@ -251,9 +252,9 @@ class boss_janalai : public CreatureScript for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end(); ++i) { - if (uiAction == 1) + if (action == 1) (*i)->SetDisplayId(10056); - else if (uiAction == 2 &&(*i)->GetDisplayId() != 11686) + else if (action == 2 &&(*i)->GetDisplayId() != 11686) (*i)->CastSpell(*i, SPELL_HATCH_EGG, false); } return true; @@ -288,7 +289,7 @@ class boss_janalai : public CreatureScript { if (BombCount < 40) { - if (Unit* FireBomb = Unit::GetUnit((*me), FireBombGUIDs[BombCount])) + if (Unit* FireBomb = Unit::GetUnit(*me, FireBombGUIDs[BombCount])) { FireBomb->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); DoCast(FireBomb, SPELL_FIRE_BOMB_THROW, true); @@ -374,7 +375,9 @@ class boss_janalai : public CreatureScript //Teleport every Player into the middle Map* map = me->GetMap(); - if (!map->IsDungeon()) return; + if (!map->IsDungeon()) + return; + Map::PlayerList const &PlayerList = map->GetPlayers(); for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) if (Player* i_pl = i->getSource()) @@ -448,7 +451,7 @@ class mob_janalai_firebomb : public CreatureScript struct mob_janalai_firebombAI : public ScriptedAI { - mob_janalai_firebombAI(Creature* c) : ScriptedAI(c){} + mob_janalai_firebombAI(Creature* creature) : ScriptedAI(creature){} void Reset() {} @@ -484,9 +487,9 @@ class mob_janalai_hatcher : public CreatureScript struct mob_janalai_hatcherAI : public ScriptedAI { - mob_janalai_hatcherAI(Creature* c) : ScriptedAI(c) + mob_janalai_hatcherAI(Creature* creature) : ScriptedAI(creature) { - instance =c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -501,7 +504,7 @@ class mob_janalai_hatcher : public CreatureScript void Reset() { - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(true); side =(me->GetPositionY() < 1150); waypoint = 0; isHatching = false; @@ -616,9 +619,9 @@ class mob_janalai_hatchling : public CreatureScript struct mob_janalai_hatchlingAI : public ScriptedAI { - mob_janalai_hatchlingAI(Creature* c) : ScriptedAI(c) + mob_janalai_hatchlingAI(Creature* creature) : ScriptedAI(creature) { - instance =c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -632,7 +635,7 @@ class mob_janalai_hatchling : public CreatureScript else me->GetMotionMaster()->MovePoint(0, hatcherway[1][3][0]+rand()%4-2, 1150.0f+rand()%4-2, hatcherway[1][3][2]); - me->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); + me->SetUnitMovementFlags(MOVEMENTFLAG_DISABLE_GRAVITY); } void EnterCombat(Unit* /*who*/) {/*DoZoneInCombat();*/} diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp index 954f232f786..48a406f22a4 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp @@ -101,11 +101,11 @@ class boss_nalorakk : public CreatureScript struct boss_nalorakkAI : public ScriptedAI { - boss_nalorakkAI(Creature* c) : ScriptedAI(c) + boss_nalorakkAI(Creature* creature) : ScriptedAI(creature) { MoveEvent = true; MovePhase = 0; - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -136,7 +136,7 @@ class boss_nalorakk : public CreatureScript inMove = false; waitTimer = 0; me->SetSpeed(MOVE_RUN, 2); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(false); }else { (*me).GetMotionMaster()->MovePoint(0, NalorakkWay[7][0], NalorakkWay[7][1], NalorakkWay[7][2]); @@ -276,7 +276,7 @@ class boss_nalorakk : public CreatureScript DoZoneInCombat(); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { if (instance) instance->SetData(DATA_NALORAKKEVENT, DONE); diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp index b5130630d05..2df202af088 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp @@ -151,9 +151,9 @@ class boss_zuljin : public CreatureScript struct boss_zuljinAI : public ScriptedAI { - boss_zuljinAI(Creature* c) : ScriptedAI(c), Summons(me) + boss_zuljinAI(Creature* creature) : ScriptedAI(creature), Summons(me) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -252,7 +252,7 @@ class boss_zuljin : public CreatureScript } } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { if (instance) instance->SetData(DATA_ZULJINEVENT, DONE); @@ -604,7 +604,7 @@ class mob_zuljin_vortex : public CreatureScript struct mob_zuljin_vortexAI : public ScriptedAI { - mob_zuljin_vortexAI(Creature* c) : ScriptedAI(c) {} + mob_zuljin_vortexAI(Creature* creature) : ScriptedAI(creature) {} void Reset() {} diff --git a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp index ac1554bd00e..884fe109785 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp @@ -109,7 +109,8 @@ class instance_zulaman : public InstanceMapScript bool IsEncounterInProgress() const { for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; + if (m_auiEncounter[i] == IN_PROGRESS) + return true; return false; } @@ -188,7 +189,9 @@ class instance_zulaman : public InstanceMapScript void Load(const char* load) { - if (!load) return; + if (!load) + return; + std::istringstream ss(load); //sLog->outError("TSCR: Zul'aman loaded, %s.", ss.str().c_str()); char dataHead; // S diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp index bf951dd186c..bfb22483b09 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp @@ -49,9 +49,9 @@ class npc_forest_frog : public CreatureScript struct npc_forest_frogAI : public ScriptedAI { - npc_forest_frogAI(Creature* c) : ScriptedAI(c) + npc_forest_frogAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -120,24 +120,29 @@ static uint32 ChestEntry[] = {186648, 187021, 186672, 186667}; class npc_zulaman_hostage : public CreatureScript { public: - - npc_zulaman_hostage() - : CreatureScript("npc_zulaman_hostage") - { - } + npc_zulaman_hostage() : CreatureScript("npc_zulaman_hostage") { } struct npc_zulaman_hostageAI : public ScriptedAI { - npc_zulaman_hostageAI(Creature* c) : ScriptedAI(c) {IsLoot = false;} + npc_zulaman_hostageAI(Creature* creature) : ScriptedAI(creature) + { + IsLoot = false; + } + bool IsLoot; uint64 PlayerGUID; + void Reset() {} + void EnterCombat(Unit* /*who*/) {} - void JustDied(Unit* /*who*/) + + void JustDied(Unit* /*killer*/) { Player* player = Unit::GetPlayer(*me, PlayerGUID); - if (player) player->SendLoot(me->GetGUID(), LOOT_CORPSE); + if (player) + player->SendLoot(me->GetGUID(), LOOT_CORPSE); } + void UpdateAI(const uint32 /*diff*/) { if (IsLoot) @@ -157,14 +162,16 @@ class npc_zulaman_hostage : public CreatureScript return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) + + if (action == GOSSIP_ACTION_INFO_DEF + 1) player->CLOSE_GOSSIP_MENU(); if (!creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) return true; + creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); InstanceScript* instance = creature->GetInstanceScript(); diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp index 27ddc215543..4ba0c187973 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp @@ -61,10 +61,10 @@ class boss_arlokk : public CreatureScript { boss_arlokkAI(Creature* creature) : ScriptedAI(creature) { - m_instance = creature->GetInstanceScript(); + instance = creature->GetInstanceScript(); } - InstanceScript* m_instance; + InstanceScript* instance; uint32 m_uiShadowWordPain_Timer; uint32 m_uiGouge_Timer; @@ -110,8 +110,8 @@ class boss_arlokk : public CreatureScript void JustReachedHome() { - if (m_instance) - m_instance->SetData(DATA_ARLOKK, NOT_STARTED); + if (instance) + instance->SetData(DATA_ARLOKK, NOT_STARTED); //we should be summoned, so despawn me->DespawnOrUnsummon(); @@ -124,8 +124,8 @@ class boss_arlokk : public CreatureScript me->SetDisplayId(MODEL_ID_NORMAL); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - if (m_instance) - m_instance->SetData(DATA_ARLOKK, DONE); + if (instance) + instance->SetData(DATA_ARLOKK, DONE); } void DoSummonPhanters() @@ -237,7 +237,7 @@ class boss_arlokk : public CreatureScript me->SetDisplayId(MODEL_ID_PANTHER); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - const CreatureTemplate* cinfo = me->GetCreatureInfo(); + const CreatureTemplate* cinfo = me->GetCreatureTemplate(); me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35))); me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35))); me->UpdateDamagePhysical(BASE_ATTACK); @@ -271,12 +271,12 @@ class go_gong_of_bethekk : public GameObjectScript bool OnGossipHello(Player* /*player*/, GameObject* go) { - if (InstanceScript* m_instance = go->GetInstanceScript()) + if (InstanceScript* instance = go->GetInstanceScript()) { - if (m_instance->GetData(DATA_ARLOKK) == DONE || m_instance->GetData(DATA_ARLOKK) == IN_PROGRESS) + if (instance->GetData(DATA_ARLOKK) == DONE || instance->GetData(DATA_ARLOKK) == IN_PROGRESS) return true; - m_instance->SetData(DATA_ARLOKK, IN_PROGRESS); + instance->SetData(DATA_ARLOKK, IN_PROGRESS); return true; } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp index a944a857f74..ce2fd0848f9 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp @@ -32,15 +32,11 @@ EndScriptData */ class boss_gahzranka : public CreatureScript { public: - - boss_gahzranka() - : CreatureScript("boss_gahzranka") - { - } + boss_gahzranka() : CreatureScript("boss_gahzranka") { } struct boss_gahzrankaAI : public ScriptedAI { - boss_gahzrankaAI(Creature* c) : ScriptedAI(c) {} + boss_gahzrankaAI(Creature* creature) : ScriptedAI(creature) { } uint32 Frostbreath_Timer; uint32 MassiveGeyser_Timer; uint32 Slam_Timer; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp index 68ae6dbbf0c..cdd45a3fa0d 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp @@ -32,15 +32,11 @@ EndScriptData */ class boss_grilek : public CreatureScript { public: - - boss_grilek() - : CreatureScript("boss_grilek") - { - } + boss_grilek() : CreatureScript("boss_grilek") { } struct boss_grilekAI : public ScriptedAI { - boss_grilekAI(Creature* c) : ScriptedAI(c) {} + boss_grilekAI(Creature* creature) : ScriptedAI(creature) { } uint32 Avartar_Timer; uint32 GroundTremor_Timer; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp index 6a1309983c3..9edd82c39b0 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp @@ -55,12 +55,12 @@ class boss_hakkar : public CreatureScript struct boss_hakkarAI : public ScriptedAI { - boss_hakkarAI(Creature* c) : ScriptedAI(c) + boss_hakkarAI(Creature* creature) : ScriptedAI(creature) { - m_instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } - InstanceScript* m_instance; + InstanceScript* instance; uint32 BloodSiphon_Timer; uint32 CorruptedBlood_Timer; @@ -156,9 +156,9 @@ class boss_hakkar : public CreatureScript //Checking if Jeklik is dead. If not we cast her Aspect if (CheckJeklik_Timer <= diff) { - if (m_instance) + if (instance) { - if (m_instance->GetData(DATA_JEKLIK) != DONE) + if (instance->GetData(DATA_JEKLIK) != DONE) { if (AspectOfJeklik_Timer <= diff) { @@ -173,9 +173,9 @@ class boss_hakkar : public CreatureScript //Checking if Venoxis is dead. If not we cast his Aspect if (CheckVenoxis_Timer <= diff) { - if (m_instance) + if (instance) { - if (m_instance->GetData(DATA_VENOXIS) != DONE) + if (instance->GetData(DATA_VENOXIS) != DONE) { if (AspectOfVenoxis_Timer <= diff) { @@ -190,9 +190,9 @@ class boss_hakkar : public CreatureScript //Checking if Marli is dead. If not we cast her Aspect if (CheckMarli_Timer <= diff) { - if (m_instance) + if (instance) { - if (m_instance->GetData(DATA_MARLI) != DONE) + if (instance->GetData(DATA_MARLI) != DONE) { if (AspectOfMarli_Timer <= diff) { @@ -208,9 +208,9 @@ class boss_hakkar : public CreatureScript //Checking if Thekal is dead. If not we cast his Aspect if (CheckThekal_Timer <= diff) { - if (m_instance) + if (instance) { - if (m_instance->GetData(DATA_THEKAL) != DONE) + if (instance->GetData(DATA_THEKAL) != DONE) { if (AspectOfThekal_Timer <= diff) { @@ -225,9 +225,9 @@ class boss_hakkar : public CreatureScript //Checking if Arlokk is dead. If yes we cast her Aspect if (CheckArlokk_Timer <= diff) { - if (m_instance) + if (instance) { - if (m_instance->GetData(DATA_ARLOKK) != DONE) + if (instance->GetData(DATA_ARLOKK) != DONE) { if (AspectOfArlokk_Timer <= diff) { diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp index 69a4f5dbab5..27c46b8e0f2 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp @@ -40,7 +40,7 @@ class boss_hazzarah : public CreatureScript struct boss_hazzarahAI : public ScriptedAI { - boss_hazzarahAI(Creature* c) : ScriptedAI(c) {} + boss_hazzarahAI(Creature* creature) : ScriptedAI(creature) {} uint32 ManaBurn_Timer; uint32 Sleep_Timer; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp index d2ac4f3bceb..7d2215f8311 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp @@ -54,12 +54,12 @@ class boss_jeklik : public CreatureScript struct boss_jeklikAI : public ScriptedAI { - boss_jeklikAI(Creature* c) : ScriptedAI(c) + boss_jeklikAI(Creature* creature) : ScriptedAI(creature) { - m_instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } - InstanceScript* m_instance; + InstanceScript* instance; uint32 Charge_Timer; uint32 SonicBurst_Timer; @@ -94,12 +94,12 @@ class boss_jeklik : public CreatureScript DoCast(me, SPELL_BAT_FORM); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); - if (m_instance) - m_instance->SetData(DATA_JEKLIK, DONE); + if (instance) + instance->SetData(DATA_JEKLIK, DONE); } void UpdateAI(const uint32 diff) @@ -236,12 +236,12 @@ class mob_batrider : public CreatureScript struct mob_batriderAI : public ScriptedAI { - mob_batriderAI(Creature* c) : ScriptedAI(c) + mob_batriderAI(Creature* creature) : ScriptedAI(creature) { - m_instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } - InstanceScript* m_instance; + InstanceScript* instance; uint32 Bomb_Timer; uint32 Check_Timer; @@ -274,9 +274,9 @@ class mob_batrider : public CreatureScript //Check_Timer if (Check_Timer <= diff) { - if (m_instance) + if (instance) { - if (m_instance->GetData(DATA_JEKLIK) == DONE) + if (instance->GetData(DATA_JEKLIK) == DONE) { me->setDeathState(JUST_DIED); me->RemoveCorpse(); diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp index 132812c932a..f4a17da56fb 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp @@ -52,7 +52,7 @@ class boss_jindo : public CreatureScript struct boss_jindoAI : public ScriptedAI { - boss_jindoAI(Creature* c) : ScriptedAI(c) {} + boss_jindoAI(Creature* creature) : ScriptedAI(creature) {} uint32 BrainWashTotem_Timer; uint32 HealingWard_Timer; @@ -187,9 +187,9 @@ class mob_healing_ward : public CreatureScript struct mob_healing_wardAI : public ScriptedAI { - mob_healing_wardAI(Creature* c) : ScriptedAI(c) + mob_healing_wardAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 Heal_Timer; @@ -212,7 +212,7 @@ class mob_healing_ward : public CreatureScript { if (instance) { - Unit* pJindo = Unit::GetUnit((*me), instance->GetData64(DATA_JINDO)); + Unit* pJindo = Unit::GetUnit(*me, instance->GetData64(DATA_JINDO)); if (pJindo) DoCast(pJindo, SPELL_HEAL); } @@ -241,7 +241,7 @@ class mob_shade_of_jindo : public CreatureScript struct mob_shade_of_jindoAI : public ScriptedAI { - mob_shade_of_jindoAI(Creature* c) : ScriptedAI(c) {} + mob_shade_of_jindoAI(Creature* creature) : ScriptedAI(creature) {} uint32 ShadowShock_Timer; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp index 10708cd7f95..cbe1178e6c4 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp @@ -55,9 +55,9 @@ class boss_mandokir : public CreatureScript struct boss_mandokirAI : public ScriptedAI { - boss_mandokirAI(Creature* c) : ScriptedAI(c) + boss_mandokirAI(Creature* creature) : ScriptedAI(creature) { - m_instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 KillCount; @@ -72,7 +72,7 @@ class boss_mandokir : public CreatureScript float targetY; float targetZ; - InstanceScript* m_instance; + InstanceScript* instance; bool endWatch; bool someWatched; @@ -116,9 +116,9 @@ class boss_mandokir : public CreatureScript { DoScriptText(SAY_DING_KILL, me); - if (m_instance) + if (instance) { - uint64 JindoGUID = m_instance->GetData64(DATA_JINDO); + uint64 JindoGUID = instance->GetData64(DATA_JINDO); if (JindoGUID) { if (Unit* jTemp = Unit::GetUnit(*me, JindoGUID)) @@ -256,9 +256,9 @@ class boss_mandokir : public CreatureScript //Checking if Ohgan is dead. If yes Mandokir will enrage. if (Check_Timer <= diff) { - if (m_instance) + if (instance) { - if (m_instance->GetData(DATA_OHGAN) == DONE) + if (instance->GetData(DATA_OHGAN) == DONE) { if (!RaptorDead) { @@ -294,13 +294,13 @@ class mob_ohgan : public CreatureScript struct mob_ohganAI : public ScriptedAI { - mob_ohganAI(Creature* c) : ScriptedAI(c) + mob_ohganAI(Creature* creature) : ScriptedAI(creature) { - m_instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 SunderArmor_Timer; - InstanceScript* m_instance; + InstanceScript* instance; void Reset() { @@ -309,10 +309,10 @@ class mob_ohgan : public CreatureScript void EnterCombat(Unit* /*who*/) {} - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { - if (m_instance) - m_instance->SetData(DATA_OHGAN, DONE); + if (instance) + instance->SetData(DATA_OHGAN, DONE); } void UpdateAI (const uint32 diff) diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp index 38d9be78f2a..44ab5d851f5 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp @@ -51,12 +51,12 @@ class boss_marli : public CreatureScript struct boss_marliAI : public ScriptedAI { - boss_marliAI(Creature* c) : ScriptedAI(c) + boss_marliAI(Creature* creature) : ScriptedAI(creature) { - m_instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } - InstanceScript* m_instance; + InstanceScript* instance; uint32 SpawnStartSpiders_Timer; uint32 PoisonVolley_Timer; @@ -88,11 +88,11 @@ class boss_marli : public CreatureScript DoScriptText(SAY_AGGRO, me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); - if (m_instance) - m_instance->SetData(DATA_MARLI, DONE); + if (instance) + instance->SetData(DATA_MARLI, DONE); } void UpdateAI(const uint32 diff) @@ -156,7 +156,7 @@ class boss_marli : public CreatureScript { DoScriptText(SAY_TRANSFORM, me); DoCast(me, SPELL_SPIDER_FORM); - const CreatureTemplate* cinfo = me->GetCreatureInfo(); + const CreatureTemplate* cinfo = me->GetCreatureTemplate(); me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35))); me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35))); me->UpdateDamagePhysical(BASE_ATTACK); @@ -196,7 +196,7 @@ class boss_marli : public CreatureScript if (TransformBack_Timer <= diff) { me->SetDisplayId(15220); - const CreatureTemplate* cinfo = me->GetCreatureInfo(); + const CreatureTemplate* cinfo = me->GetCreatureTemplate(); me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 1))); me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 1))); me->UpdateDamagePhysical(BASE_ATTACK); @@ -230,7 +230,7 @@ class mob_spawn_of_marli : public CreatureScript struct mob_spawn_of_marliAI : public ScriptedAI { - mob_spawn_of_marliAI(Creature* c) : ScriptedAI(c) {} + mob_spawn_of_marliAI(Creature* creature) : ScriptedAI(creature) {} uint32 LevelUp_Timer; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp index f988d0df77a..81260c28d73 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp @@ -42,7 +42,7 @@ class boss_renataki : public CreatureScript struct boss_renatakiAI : public ScriptedAI { - boss_renatakiAI(Creature* c) : ScriptedAI(c) {} + boss_renatakiAI(Creature* creature) : ScriptedAI(creature) {} uint32 Invisible_Timer; uint32 Ambush_Timer; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp index 4185ba2f3e7..3da74d16dc3 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp @@ -66,9 +66,9 @@ class boss_thekal : public CreatureScript struct boss_thekalAI : public ScriptedAI { - boss_thekalAI(Creature* c) : ScriptedAI(c) + boss_thekalAI(Creature* creature) : ScriptedAI(creature) { - m_instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 MortalCleave_Timer; @@ -81,7 +81,7 @@ class boss_thekal : public CreatureScript uint32 Check_Timer; uint32 Resurrect_Timer; - InstanceScript* m_instance; + InstanceScript* instance; bool Enraged; bool PhaseTwo; bool WasDead; @@ -108,17 +108,17 @@ class boss_thekal : public CreatureScript DoScriptText(SAY_AGGRO, me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); - if (m_instance) - m_instance->SetData(DATA_THEKAL, DONE); + if (instance) + instance->SetData(DATA_THEKAL, DONE); } void JustReachedHome() { - if (m_instance) - m_instance->SetData(DATA_THEKAL, NOT_STARTED); + if (instance) + instance->SetData(DATA_THEKAL, NOT_STARTED); } void UpdateAI(const uint32 diff) @@ -129,26 +129,26 @@ class boss_thekal : public CreatureScript //Check_Timer for the death of LorKhan and Zath. if (!WasDead && Check_Timer <= diff) { - if (m_instance) + if (instance) { - if (m_instance->GetData(DATA_LORKHAN) == SPECIAL) + if (instance->GetData(DATA_LORKHAN) == SPECIAL) { //Resurrect LorKhan - if (Unit* pLorKhan = Unit::GetUnit((*me), m_instance->GetData64(DATA_LORKHAN))) + if (Unit* pLorKhan = Unit::GetUnit(*me, instance->GetData64(DATA_LORKHAN))) { pLorKhan->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pLorKhan->setFaction(14); pLorKhan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); pLorKhan->SetFullHealth(); - m_instance->SetData(DATA_LORKHAN, DONE); + instance->SetData(DATA_LORKHAN, DONE); } } - if (m_instance->GetData(DATA_ZATH) == SPECIAL) + if (instance->GetData(DATA_ZATH) == SPECIAL) { //Resurrect Zath - Unit* pZath = Unit::GetUnit((*me), m_instance->GetData64(DATA_ZATH)); + Unit* pZath = Unit::GetUnit(*me, instance->GetData64(DATA_ZATH)); if (pZath) { pZath->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); @@ -156,7 +156,7 @@ class boss_thekal : public CreatureScript pZath->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); pZath->SetFullHealth(); - m_instance->SetData(DATA_ZATH, DONE); + instance->SetData(DATA_ZATH, DONE); } } } @@ -185,8 +185,8 @@ class boss_thekal : public CreatureScript me->SetStandState(UNIT_STAND_STATE_SLEEP); me->AttackStop(); - if (m_instance) - m_instance->SetData(DATA_THEKAL, SPECIAL); + if (instance) + instance->SetData(DATA_THEKAL, SPECIAL); WasDead=true; } @@ -197,11 +197,11 @@ class boss_thekal : public CreatureScript if (Resurrect_Timer <= diff) { DoCast(me, SPELL_TIGER_FORM); - me->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.00f); + me->SetObjectScale(2.00f); me->SetStandState(UNIT_STAND_STATE_STAND); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetFullHealth(); - const CreatureTemplate* cinfo = me->GetCreatureInfo(); + const CreatureTemplate* cinfo = me->GetCreatureTemplate(); me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 40))); me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 40))); me->UpdateDamagePhysical(BASE_ATTACK); @@ -277,9 +277,9 @@ class mob_zealot_lorkhan : public CreatureScript struct mob_zealot_lorkhanAI : public ScriptedAI { - mob_zealot_lorkhanAI(Creature* c) : ScriptedAI(c) + mob_zealot_lorkhanAI(Creature* creature) : ScriptedAI(creature) { - m_instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 Shield_Timer; @@ -290,7 +290,7 @@ class mob_zealot_lorkhan : public CreatureScript bool FakeDeath; - InstanceScript* m_instance; + InstanceScript* instance; void Reset() { @@ -302,8 +302,8 @@ class mob_zealot_lorkhan : public CreatureScript FakeDeath = false; - if (m_instance) - m_instance->SetData(DATA_LORKHAN, NOT_STARTED); + if (instance) + instance->SetData(DATA_LORKHAN, NOT_STARTED); me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -335,10 +335,10 @@ class mob_zealot_lorkhan : public CreatureScript //Casting Greaterheal to Thekal or Zath if they are in meele range. if (GreaterHeal_Timer <= diff) { - if (m_instance) + if (instance) { - Unit* pThekal = Unit::GetUnit((*me), m_instance->GetData64(DATA_THEKAL)); - Unit* pZath = Unit::GetUnit((*me), m_instance->GetData64(DATA_ZATH)); + Unit* pThekal = Unit::GetUnit(*me, instance->GetData64(DATA_THEKAL)); + Unit* pZath = Unit::GetUnit(*me, instance->GetData64(DATA_ZATH)); if (!pThekal || !pZath) return; @@ -369,12 +369,12 @@ class mob_zealot_lorkhan : public CreatureScript //Check_Timer for the death of LorKhan and Zath. if (!FakeDeath && Check_Timer <= diff) { - if (m_instance) + if (instance) { - if (m_instance->GetData(DATA_THEKAL) == SPECIAL) + if (instance->GetData(DATA_THEKAL) == SPECIAL) { //Resurrect Thekal - if (Unit* pThekal = Unit::GetUnit((*me), m_instance->GetData64(DATA_THEKAL))) + if (Unit* pThekal = Unit::GetUnit(*me, instance->GetData64(DATA_THEKAL))) { pThekal->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pThekal->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -383,10 +383,10 @@ class mob_zealot_lorkhan : public CreatureScript } } - if (m_instance->GetData(DATA_ZATH) == SPECIAL) + if (instance->GetData(DATA_ZATH) == SPECIAL) { //Resurrect Zath - if (Unit* pZath = Unit::GetUnit((*me), m_instance->GetData64(DATA_ZATH))) + if (Unit* pZath = Unit::GetUnit(*me, instance->GetData64(DATA_ZATH))) { pZath->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pZath->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -409,8 +409,8 @@ class mob_zealot_lorkhan : public CreatureScript me->setFaction(35); me->AttackStop(); - if (m_instance) - m_instance->SetData(DATA_LORKHAN, SPECIAL); + if (instance) + instance->SetData(DATA_LORKHAN, SPECIAL); FakeDeath = true; } @@ -437,9 +437,9 @@ class mob_zealot_zath : public CreatureScript struct mob_zealot_zathAI : public ScriptedAI { - mob_zealot_zathAI(Creature* c) : ScriptedAI(c) + mob_zealot_zathAI(Creature* creature) : ScriptedAI(creature) { - m_instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 SweepingStrikes_Timer; @@ -451,7 +451,7 @@ class mob_zealot_zath : public CreatureScript bool FakeDeath; - InstanceScript* m_instance; + InstanceScript* instance; void Reset() { @@ -464,8 +464,8 @@ class mob_zealot_zath : public CreatureScript FakeDeath = false; - if (m_instance) - m_instance->SetData(DATA_ZATH, NOT_STARTED); + if (instance) + instance->SetData(DATA_ZATH, NOT_STARTED); me->SetStandState(UNIT_STAND_STATE_STAND); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -522,12 +522,12 @@ class mob_zealot_zath : public CreatureScript //Check_Timer for the death of LorKhan and Zath. if (!FakeDeath && Check_Timer <= diff) { - if (m_instance) + if (instance) { - if (m_instance->GetData(DATA_LORKHAN) == SPECIAL) + if (instance->GetData(DATA_LORKHAN) == SPECIAL) { //Resurrect LorKhan - if (Unit* pLorKhan = Unit::GetUnit((*me), m_instance->GetData64(DATA_LORKHAN))) + if (Unit* pLorKhan = Unit::GetUnit(*me, instance->GetData64(DATA_LORKHAN))) { pLorKhan->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pLorKhan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -536,10 +536,10 @@ class mob_zealot_zath : public CreatureScript } } - if (m_instance->GetData(DATA_THEKAL) == SPECIAL) + if (instance->GetData(DATA_THEKAL) == SPECIAL) { //Resurrect Thekal - if (Unit* pThekal = Unit::GetUnit((*me), m_instance->GetData64(DATA_THEKAL))) + if (Unit* pThekal = Unit::GetUnit(*me, instance->GetData64(DATA_THEKAL))) { pThekal->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pThekal->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -562,8 +562,8 @@ class mob_zealot_zath : public CreatureScript me->setFaction(35); me->AttackStop(); - if (m_instance) - m_instance->SetData(DATA_ZATH, SPECIAL); + if (instance) + instance->SetData(DATA_ZATH, SPECIAL); FakeDeath = true; } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp index bd6f6ec4748..06448032dff 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp @@ -186,7 +186,7 @@ class boss_venoxis : public CreatureScript events.ScheduleEvent(EVENT_THRASH, urand(10000, 20000)); break; - // troll form spells and actions (first part) + // troll form spells and Actions (first part) case EVENT_DISPEL_MAGIC: DoCast(me, SPELL_DISPEL_MAGIC); events.ScheduleEvent(EVENT_DISPEL_MAGIC, urand(15000, 20000), 0, PHASE_ONE); @@ -198,7 +198,7 @@ class boss_venoxis : public CreatureScript case EVENT_HOLY_NOVA: _inMeleeRange = 0; - for (uint8 i = 0; i < 10 ; ++i) + for (uint8 i = 0; i < 10; ++i) { if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, i)) // check if target is within melee-distance @@ -224,7 +224,7 @@ class boss_venoxis : public CreatureScript break; // - // snake form spells and actions + // snake form spells and Actions // case EVENT_VENOM_SPIT: diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp index 702a69207ba..b22630f51bb 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp @@ -40,7 +40,7 @@ class boss_wushoolay : public CreatureScript struct boss_wushoolayAI : public ScriptedAI { - boss_wushoolayAI(Creature* c) : ScriptedAI(c) {} + boss_wushoolayAI(Creature* creature) : ScriptedAI(creature) {} uint32 LightningCloud_Timer; uint32 LightningWave_Timer; diff --git a/src/server/scripts/EasternKingdoms/arathi_highlands.cpp b/src/server/scripts/EasternKingdoms/arathi_highlands.cpp index 82b09b9dc18..d4d35b107b2 100644 --- a/src/server/scripts/EasternKingdoms/arathi_highlands.cpp +++ b/src/server/scripts/EasternKingdoms/arathi_highlands.cpp @@ -62,38 +62,44 @@ class npc_professor_phizzlethorpe : public CreatureScript struct npc_professor_phizzlethorpeAI : public npc_escortAI { - npc_professor_phizzlethorpeAI(Creature* c) : npc_escortAI(c) {} + npc_professor_phizzlethorpeAI(Creature* creature) : npc_escortAI(creature) {} - void WaypointReached(uint32 uiPointId) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); - if (!player) return; - switch (uiPointId) + switch (waypointId) { - case 4:Talk(SAY_PROGRESS_2, player->GetGUID());break; - case 5:Talk(SAY_PROGRESS_3, player->GetGUID());break; - case 8:Talk(EMOTE_PROGRESS_4);break; - case 9: - { - me->SummonCreature(MOB_VENGEFUL_SURGE, -2052.96f, -2142.49f, 20.15f, 1.0f, TEMPSUMMON_CORPSE_DESPAWN, 0); - me->SummonCreature(MOB_VENGEFUL_SURGE, -2052.96f, -2142.49f, 20.15f, 1.0f, TEMPSUMMON_CORPSE_DESPAWN, 0); - break; - } - case 10:Talk(SAY_PROGRESS_5, player->GetGUID());break; - case 11: - Talk(SAY_PROGRESS_6, player->GetGUID()); - SetRun(); - break; - case 19:Talk(SAY_PROGRESS_7, player->GetGUID()); break; - case 20: - Talk(EMOTE_PROGRESS_8); - Talk(SAY_PROGRESS_9, player->GetGUID()); - if (player) - CAST_PLR(player)->GroupEventHappens(QUEST_SUNKEN_TREASURE, me); - break; + case 4: + Talk(SAY_PROGRESS_2, player->GetGUID()); + break; + case 5: + Talk(SAY_PROGRESS_3, player->GetGUID()); + break; + case 8: + Talk(EMOTE_PROGRESS_4); + break; + case 9: + me->SummonCreature(MOB_VENGEFUL_SURGE, -2052.96f, -2142.49f, 20.15f, 1.0f, TEMPSUMMON_CORPSE_DESPAWN, 0); + me->SummonCreature(MOB_VENGEFUL_SURGE, -2052.96f, -2142.49f, 20.15f, 1.0f, TEMPSUMMON_CORPSE_DESPAWN, 0); + break; + case 10: + Talk(SAY_PROGRESS_5, player->GetGUID()); + break; + case 11: + Talk(SAY_PROGRESS_6, player->GetGUID()); + SetRun(); + break; + case 19: + Talk(SAY_PROGRESS_7, player->GetGUID()); + break; + case 20: + Talk(EMOTE_PROGRESS_8); + Talk(SAY_PROGRESS_9, player->GetGUID()); + player->GroupEventHappens(QUEST_SUNKEN_TREASURE, me); + break; } } diff --git a/src/server/scripts/EasternKingdoms/blasted_lands.cpp b/src/server/scripts/EasternKingdoms/blasted_lands.cpp index 2ad03f8b504..2042e5313c3 100644 --- a/src/server/scripts/EasternKingdoms/blasted_lands.cpp +++ b/src/server/scripts/EasternKingdoms/blasted_lands.cpp @@ -44,10 +44,10 @@ class npc_deathly_usher : public CreatureScript public: npc_deathly_usher() : CreatureScript("npc_deathly_usher") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF) + if (action == GOSSIP_ACTION_INFO_DEF) { player->CLOSE_GOSSIP_MENU(); creature->CastSpell(player, SPELL_TELEPORT_SINGLE, true); @@ -65,7 +65,6 @@ public: return true; } - }; void AddSC_blasted_lands() diff --git a/src/server/scripts/EasternKingdoms/boss_kruul.cpp b/src/server/scripts/EasternKingdoms/boss_kruul.cpp index 126f55838b9..8749c943a6f 100644 --- a/src/server/scripts/EasternKingdoms/boss_kruul.cpp +++ b/src/server/scripts/EasternKingdoms/boss_kruul.cpp @@ -45,7 +45,7 @@ public: struct boss_kruulAI : public ScriptedAI { - boss_kruulAI(Creature* c) : ScriptedAI(c) {} + boss_kruulAI(Creature* creature) : ScriptedAI(creature) {} uint32 ShadowVolley_Timer; uint32 Cleave_Timer; @@ -151,7 +151,6 @@ public: DoMeleeAttackIfReady(); } }; - }; void AddSC_boss_kruul() diff --git a/src/server/scripts/EasternKingdoms/burning_steppes.cpp b/src/server/scripts/EasternKingdoms/burning_steppes.cpp index 1d2725b10ee..b526246f670 100644 --- a/src/server/scripts/EasternKingdoms/burning_steppes.cpp +++ b/src/server/scripts/EasternKingdoms/burning_steppes.cpp @@ -51,10 +51,10 @@ class npc_ragged_john : public CreatureScript public: npc_ragged_john() : CreatureScript("npc_ragged_john") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -127,7 +127,7 @@ public: struct npc_ragged_johnAI : public ScriptedAI { - npc_ragged_johnAI(Creature* c) : ScriptedAI(c) {} + npc_ragged_johnAI(Creature* creature) : ScriptedAI(creature) {} void Reset() {} @@ -147,7 +147,6 @@ public: void EnterCombat(Unit* /*who*/) {} }; - }; void AddSC_burning_steppes() diff --git a/src/server/scripts/EasternKingdoms/duskwood.cpp b/src/server/scripts/EasternKingdoms/duskwood.cpp index 5d04489bbca..10cb5987ce5 100644 --- a/src/server/scripts/EasternKingdoms/duskwood.cpp +++ b/src/server/scripts/EasternKingdoms/duskwood.cpp @@ -60,7 +60,6 @@ public: } return false; }; - }; /*###### @@ -83,7 +82,7 @@ public: struct boss_twilight_corrupterAI : public ScriptedAI { - boss_twilight_corrupterAI(Creature* c) : ScriptedAI(c) {} + boss_twilight_corrupterAI(Creature* creature) : ScriptedAI(creature) {} uint32 SoulCorruption_Timer; uint32 CreatureOfNightmare_Timer; @@ -133,7 +132,6 @@ public: DoMeleeAttackIfReady(); }; }; - }; void AddSC_duskwood() diff --git a/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp b/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp index 2b4bb61c603..0519ce94b32 100644 --- a/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp +++ b/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp @@ -32,35 +32,30 @@ EndContentData */ #include "ScriptPCH.h" -//id8530 - cannibal ghoul -//id8531 - gibbering ghoul -//id8532 - diseased flayer - class mobs_ghoul_flayer : public CreatureScript { public: mobs_ghoul_flayer() : CreatureScript("mobs_ghoul_flayer") { } - CreatureAI* GetAI(Creature* creature) const - { - return new mobs_ghoul_flayerAI (creature); - } - struct mobs_ghoul_flayerAI : public ScriptedAI { - mobs_ghoul_flayerAI(Creature* c) : ScriptedAI(c) {} + mobs_ghoul_flayerAI(Creature* creature) : ScriptedAI(creature) { } void Reset() {} void EnterCombat(Unit* /*who*/) {} - void JustDied(Unit* Killer) + void JustDied(Unit* killer) { - if (Killer->GetTypeId() == TYPEID_PLAYER) + if (killer->GetTypeId() == TYPEID_PLAYER) me->SummonCreature(11064, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000); } }; + CreatureAI* GetAI(Creature* creature) const + { + return new mobs_ghoul_flayerAI (creature); + } }; /*###### @@ -72,10 +67,10 @@ class npc_augustus_the_touched : public CreatureScript public: npc_augustus_the_touched() : CreatureScript("npc_augustus_the_touched") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_TRADE) + if (action == GOSSIP_ACTION_TRADE) player->GetSession()->SendListInventory(creature->GetGUID()); return true; } @@ -91,7 +86,6 @@ public: player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); return true; } - }; /*###### @@ -120,7 +114,7 @@ public: struct npc_darrowshire_spiritAI : public ScriptedAI { - npc_darrowshire_spiritAI(Creature* c) : ScriptedAI(c) {} + npc_darrowshire_spiritAI(Creature* creature) : ScriptedAI(creature) {} void Reset() { @@ -129,9 +123,7 @@ public: } void EnterCombat(Unit* /*who*/) {} - }; - }; /*###### @@ -148,10 +140,10 @@ class npc_tirion_fordring : public CreatureScript public: npc_tirion_fordring() : CreatureScript("npc_tirion_fordring") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); @@ -185,7 +177,6 @@ public: return true; } - }; void AddSC_eastern_plaguelands() diff --git a/src/server/scripts/EasternKingdoms/eversong_woods.cpp b/src/server/scripts/EasternKingdoms/eversong_woods.cpp index 4797774ef49..8ae72e142c8 100644 --- a/src/server/scripts/EasternKingdoms/eversong_woods.cpp +++ b/src/server/scripts/EasternKingdoms/eversong_woods.cpp @@ -124,7 +124,6 @@ public: void Reset() { - timer = 2000; questPhase = 0; summonerGuid = 0; @@ -248,7 +247,7 @@ public: CAST_PLR(Killed)->FailQuest(QUEST_SECOND_TRIAL); } - void JustDied(Unit* Killer); + void JustDied(Unit* killer); }; }; @@ -294,7 +293,7 @@ public: struct master_kelerun_bloodmournAI : public ScriptedAI { - master_kelerun_bloodmournAI(Creature* c) : ScriptedAI(c) {} + master_kelerun_bloodmournAI(Creature* creature) : ScriptedAI(creature) {} uint8 questPhase; uint8 paladinPhase; @@ -366,10 +365,8 @@ public: void StartEvent() { - if (questPhase == 1) { // no player check, quest can be finished as group, so no complex PlayerGUID/group search code - for (uint8 i = 0; i < 4; ++i) if (Creature* summoned = DoSpawnCreature(PaladinEntry[i], SpawnPosition[i].x, SpawnPosition[i].y, SpawnPosition[i].z, SpawnPosition[i].o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 180000)) paladinGuid[i] = summoned->GetGUID(); @@ -420,15 +417,14 @@ class go_second_trial : public GameObjectScript public: go_second_trial() : GameObjectScript("go_second_trial") { } - bool OnGossipHello(Player* /*player*/, GameObject* pGO) + bool OnGossipHello(Player* /*player*/, GameObject* go) { // find spawn :: master_kelerun_bloodmourn - if (Creature* creature = pGO->FindNearestCreature(MASTER_KELERUN_BLOODMOURN, 30.0f)) + if (Creature* creature = go->FindNearestCreature(MASTER_KELERUN_BLOODMOURN, 30.0f)) CAST_AI(npc_second_trial_controller::master_kelerun_bloodmournAI, creature->AI())->StartEvent(); return true; } - }; /*###### @@ -461,7 +457,7 @@ public: struct npc_apprentice_mirvedaAI : public ScriptedAI { - npc_apprentice_mirvedaAI(Creature* c) : ScriptedAI(c), Summons(me) {} + npc_apprentice_mirvedaAI(Creature* creature) : ScriptedAI(creature), Summons(me) {} uint32 KillCount; uint64 PlayerGUID; @@ -494,14 +490,14 @@ public: { if (PlayerGUID) if (Player* player = Unit::GetPlayer(*me, PlayerGUID)) - CAST_PLR(player)->FailQuest(QUEST_UNEXPECTED_RESULT); + player->FailQuest(QUEST_UNEXPECTED_RESULT); } void UpdateAI(const uint32 /*diff*/) { if (KillCount >= 3 && PlayerGUID) if (Player* player = Unit::GetPlayer(*me, PlayerGUID)) - CAST_PLR(player)->CompleteQuest(QUEST_UNEXPECTED_RESULT); + player->CompleteQuest(QUEST_UNEXPECTED_RESULT); if (Summon) { @@ -512,7 +508,6 @@ public: } } }; - }; /*###### @@ -552,7 +547,7 @@ public: struct npc_infused_crystalAI : public Scripted_NoMovementAI { - npc_infused_crystalAI(Creature* c) : Scripted_NoMovementAI(c) {} + npc_infused_crystalAI(Creature* creature) : Scripted_NoMovementAI(creature) {} uint32 EndTimer; uint32 WaveTimer; @@ -621,7 +616,6 @@ public: } else WaveTimer -= diff; } }; - }; void AddSC_eversong_woods() diff --git a/src/server/scripts/EasternKingdoms/ghostlands.cpp b/src/server/scripts/EasternKingdoms/ghostlands.cpp index 412613572f1..e40a2f785e6 100644 --- a/src/server/scripts/EasternKingdoms/ghostlands.cpp +++ b/src/server/scripts/EasternKingdoms/ghostlands.cpp @@ -44,10 +44,10 @@ class npc_budd_nedreck : public CreatureScript public: npc_budd_nedreck() : CreatureScript("npc_budd_nedreck") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF) + if (action == GOSSIP_ACTION_INFO_DEF) { player->CLOSE_GOSSIP_MENU(); creature->CastSpell(player, 42540, false); @@ -66,7 +66,6 @@ public: player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); return true; } - }; /*###### @@ -78,10 +77,10 @@ class npc_rathis_tomber : public CreatureScript public: npc_rathis_tomber() : CreatureScript("npc_rathis_tomber") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_TRADE) + if (action == GOSSIP_ACTION_TRADE) player->GetSession()->SendListInventory(creature->GetGUID()); return true; } @@ -100,7 +99,6 @@ public: return true; } - }; /*###### @@ -130,61 +128,63 @@ public: struct npc_ranger_lilathaAI : public npc_escortAI { - npc_ranger_lilathaAI(Creature* c) : npc_escortAI(c) {} + npc_ranger_lilathaAI(Creature* creature) : npc_escortAI(creature) {} - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); - if (!player) return; - switch (i) + switch (waypointId) { - case 0: - { - me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20)) - Cage->SetGoState(GO_STATE_ACTIVE); - DoScriptText(SAY_START, me, player); - break; - } - case 5: - DoScriptText(SAY_PROGRESS1, me, player); - case 11: - DoScriptText(SAY_PROGRESS2, me, player); - me->SetOrientation(4.762841f); - break; - case 18: - { - DoScriptText(SAY_PROGRESS3, me, player); - Creature* Summ1 = me->SummonCreature(16342, 7627.083984f, -7532.538086f, 152.128616f, 1.082733f, TEMPSUMMON_DEAD_DESPAWN, 0); - Creature* Summ2 = me->SummonCreature(16343, 7620.432129f, -7532.550293f, 152.454865f, 0.827478f, TEMPSUMMON_DEAD_DESPAWN, 0); - if (Summ1 && Summ2) - { - Summ1->Attack(me, true); - Summ2->Attack(player, true); - } - me->AI()->AttackStart(Summ1); - break; - } - case 19: me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); break; - case 25: me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); break; - case 30: - if (player && player->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(player)->GroupEventHappens(QUEST_ESCAPE_FROM_THE_CATACOMBS, me); - break; - case 32: - me->SetOrientation(2.978281f); - DoScriptText(SAY_END1, me, player); - break; - case 33: - me->SetOrientation(5.858011f); - DoScriptText(SAY_END2, me, player); - Unit* CaptainHelios = me->FindNearestCreature(NPC_CAPTAIN_HELIOS, 50); - if (CaptainHelios) - DoScriptText(SAY_CAPTAIN_ANSWER, CaptainHelios, player); - break; + case 0: + me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); + if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20)) + Cage->SetGoState(GO_STATE_ACTIVE); + DoScriptText(SAY_START, me, player); + break; + case 5: + DoScriptText(SAY_PROGRESS1, me, player); + break; + case 11: + DoScriptText(SAY_PROGRESS2, me, player); + me->SetOrientation(4.762841f); + break; + case 18: + { + DoScriptText(SAY_PROGRESS3, me, player); + Creature* Summ1 = me->SummonCreature(16342, 7627.083984f, -7532.538086f, 152.128616f, 1.082733f, TEMPSUMMON_DEAD_DESPAWN, 0); + Creature* Summ2 = me->SummonCreature(16343, 7620.432129f, -7532.550293f, 152.454865f, 0.827478f, TEMPSUMMON_DEAD_DESPAWN, 0); + if (Summ1 && Summ2) + { + Summ1->Attack(me, true); + Summ2->Attack(player, true); + } + me->AI()->AttackStart(Summ1); + } + break; + case 19: + me->SetWalk(false); + break; + case 25: + me->SetWalk(true); + break; + case 30: + if (player->GetTypeId() == TYPEID_PLAYER) + CAST_PLR(player)->GroupEventHappens(QUEST_ESCAPE_FROM_THE_CATACOMBS, me); + break; + case 32: + me->SetOrientation(2.978281f); + DoScriptText(SAY_END1, me, player); + break; + case 33: + me->SetOrientation(5.858011f); + DoScriptText(SAY_END2, me, player); + Unit* CaptainHelios = me->FindNearestCreature(NPC_CAPTAIN_HELIOS, 50); + if (CaptainHelios) + DoScriptText(SAY_CAPTAIN_ANSWER, CaptainHelios, player); + break; } } diff --git a/src/server/scripts/EasternKingdoms/hinterlands.cpp b/src/server/scripts/EasternKingdoms/hinterlands.cpp index 7021deeae75..8de895cb51f 100644 --- a/src/server/scripts/EasternKingdoms/hinterlands.cpp +++ b/src/server/scripts/EasternKingdoms/hinterlands.cpp @@ -87,9 +87,9 @@ public: void Reset() { } - void WaypointReached(uint32 uiPointId) + void WaypointReached(uint32 waypointId) { - switch (uiPointId) + switch (waypointId) { case 26: DoScriptText(SAY_OOX_AMBUSH, me); @@ -146,7 +146,6 @@ public: summoned->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); } }; - }; /*###### @@ -273,18 +272,17 @@ public: void JustSummoned(Creature* summoned) { - summoned->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + summoned->SetWalk(false); summoned->GetMotionMaster()->MovePoint(0, m_afAmbushMoveTo[m_iSpawnId].m_fX, m_afAmbushMoveTo[m_iSpawnId].m_fY, m_afAmbushMoveTo[m_iSpawnId].m_fZ); } - void WaypointReached(uint32 uiPointId) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); - if (!player) return; - switch (uiPointId) + switch (waypointId) { case 1: DoScriptText(SAY_RIN_FREE, me, player); @@ -315,7 +313,7 @@ public: { m_uiPostEventTimer = 3000; - if (Unit* player = GetPlayerForEscort()) + if (Player* player = GetPlayerForEscort()) { switch (m_uiPostEventCount) { @@ -345,7 +343,6 @@ public: DoMeleeAttackIfReady(); } }; - }; void AddSC_hinterlands() diff --git a/src/server/scripts/EasternKingdoms/ironforge.cpp b/src/server/scripts/EasternKingdoms/ironforge.cpp index 5a0ee3c5630..93a8d7423c9 100644 --- a/src/server/scripts/EasternKingdoms/ironforge.cpp +++ b/src/server/scripts/EasternKingdoms/ironforge.cpp @@ -44,10 +44,10 @@ class npc_royal_historian_archesonus : public CreatureScript public: npc_royal_historian_archesonus() : CreatureScript("npc_royal_historian_archesonus") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ROYAL_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -88,7 +88,6 @@ public: return true; } - }; void AddSC_ironforge() diff --git a/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp b/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp index f2095de49c3..27d8ea3e51c 100644 --- a/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp +++ b/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp @@ -51,7 +51,7 @@ public: struct npc_converted_sentryAI : public ScriptedAI { - npc_converted_sentryAI(Creature* c) : ScriptedAI(c) {} + npc_converted_sentryAI(Creature* creature) : ScriptedAI(creature) {} bool Credit; uint32 Timer; @@ -85,7 +85,6 @@ public: } } }; - }; /*###### @@ -109,7 +108,7 @@ public: struct npc_greengill_slaveAI : public ScriptedAI { - npc_greengill_slaveAI(Creature* c) : ScriptedAI(c) {} + npc_greengill_slaveAI(Creature* creature) : ScriptedAI(creature) {} uint64 PlayerGUID; @@ -130,8 +129,8 @@ public: PlayerGUID = caster->GetGUID(); if (PlayerGUID) { - Unit* player = Unit::GetUnit((*me), PlayerGUID); - if (player && CAST_PLR(player)->GetQuestStatus(QUESTG) == QUEST_STATUS_INCOMPLETE) + Player* player = Unit::GetPlayer(*me, PlayerGUID); + if (player && player->GetQuestStatus(QUESTG) == QUEST_STATUS_INCOMPLETE) DoCast(player, 45110, true); } DoCast(me, ENRAGE); @@ -149,7 +148,6 @@ public: DoMeleeAttackIfReady(); } }; - }; void AddSC_isle_of_queldanas() diff --git a/src/server/scripts/EasternKingdoms/loch_modan.cpp b/src/server/scripts/EasternKingdoms/loch_modan.cpp index 9ce9de4381a..7ea8a62a5bd 100644 --- a/src/server/scripts/EasternKingdoms/loch_modan.cpp +++ b/src/server/scripts/EasternKingdoms/loch_modan.cpp @@ -47,10 +47,10 @@ class npc_mountaineer_pebblebitty : public CreatureScript public: npc_mountaineer_pebblebitty() : CreatureScript("npc_mountaineer_pebblebitty") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); @@ -95,7 +95,6 @@ public: return true; } - }; void AddSC_loch_modan() diff --git a/src/server/scripts/EasternKingdoms/redridge_mountains.cpp b/src/server/scripts/EasternKingdoms/redridge_mountains.cpp index d7b00af33e8..3ade1da4a19 100644 --- a/src/server/scripts/EasternKingdoms/redridge_mountains.cpp +++ b/src/server/scripts/EasternKingdoms/redridge_mountains.cpp @@ -76,17 +76,16 @@ public: uiShieldBashTimer = 8000; } - void WaypointReached(uint32 uiI) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); - if (!player) return; - if (uiI >= 65 && me->GetUnitMovementFlags() == MOVEMENTFLAG_WALKING) - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + if (waypointId >= 65 && me->GetUnitMovementFlags() == MOVEMENTFLAG_WALKING) + me->SetWalk(false); - switch (uiI) + switch (waypointId) { case 39: SetEscortPaused(true); @@ -94,7 +93,7 @@ public: uiPhase = 1; break; case 65: - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(false); break; case 115: player->AreaExploredOrEventHappens(QUEST_MISSING_IN_ACTION); @@ -164,7 +163,6 @@ public: DoMeleeAttackIfReady(); } }; - }; void AddSC_redridge_mountains() diff --git a/src/server/scripts/EasternKingdoms/silvermoon_city.cpp b/src/server/scripts/EasternKingdoms/silvermoon_city.cpp index 8d04e92b9b8..e6595a83b66 100644 --- a/src/server/scripts/EasternKingdoms/silvermoon_city.cpp +++ b/src/server/scripts/EasternKingdoms/silvermoon_city.cpp @@ -53,7 +53,7 @@ public: struct npc_blood_knight_stillbladeAI : public ScriptedAI { - npc_blood_knight_stillbladeAI(Creature* c) : ScriptedAI(c) {} + npc_blood_knight_stillbladeAI(Creature* creature) : ScriptedAI(creature) {} uint32 lifeTimer; bool spellHit; @@ -100,7 +100,6 @@ public: } } }; - }; void AddSC_silvermoon_city() diff --git a/src/server/scripts/EasternKingdoms/silverpine_forest.cpp b/src/server/scripts/EasternKingdoms/silverpine_forest.cpp index 4d897c4f3b8..bc3110878de 100644 --- a/src/server/scripts/EasternKingdoms/silverpine_forest.cpp +++ b/src/server/scripts/EasternKingdoms/silverpine_forest.cpp @@ -64,37 +64,46 @@ public: struct npc_deathstalker_erlandAI : public npc_escortAI { - npc_deathstalker_erlandAI(Creature* c) : npc_escortAI(c) {} + npc_deathstalker_erlandAI(Creature* creature) : npc_escortAI(creature) {} - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); - if (!player) return; - switch (i) + switch (waypointId) { - case 1: DoScriptText(SAY_START, me, player);break; - case 13: - DoScriptText(SAY_LAST, me, player); - player->GroupEventHappens(QUEST_ESCORTING, me); break; - case 14: DoScriptText(SAY_THANKS, me, player); break; - case 15: { - Unit* Rane = me->FindNearestCreature(NPC_RANE, 20); - if (Rane) + case 1: + DoScriptText(SAY_START, me, player); + break; + case 13: + DoScriptText(SAY_LAST, me, player); + player->GroupEventHappens(QUEST_ESCORTING, me); + break; + case 14: + DoScriptText(SAY_THANKS, me, player); + break; + case 15: + if (Unit* Rane = me->FindNearestCreature(NPC_RANE, 20)) DoScriptText(SAY_RANE, Rane); - break;} - case 16: DoScriptText(SAY_ANSWER, me); break; - case 17: DoScriptText(SAY_MOVE_QUINN, me); break; - case 24: DoScriptText(SAY_GREETINGS, me); break; - case 25: { - Unit* Quinn = me->FindNearestCreature(NPC_QUINN, 20); - if (Quinn) + break; + case 16: + DoScriptText(SAY_ANSWER, me); + break; + case 17: + DoScriptText(SAY_MOVE_QUINN, me); + break; + case 24: + DoScriptText(SAY_GREETINGS, me); + break; + case 25: + if (Unit* Quinn = me->FindNearestCreature(NPC_QUINN, 20)) DoScriptText(SAY_QUINN, Quinn); - break;} - case 26: DoScriptText(SAY_ON_BYE, me, NULL); break; - + break; + case 26: + DoScriptText(SAY_ON_BYE, me, NULL); + break; } } @@ -123,7 +132,6 @@ public: { return new npc_deathstalker_erlandAI(creature); } - }; /*###### @@ -177,7 +185,7 @@ public: struct pyrewood_ambushAI : public ScriptedAI { - pyrewood_ambushAI(Creature* c) : ScriptedAI(c), Summons(me) + pyrewood_ambushAI(Creature* creature) : ScriptedAI(creature), Summons(me) { QuestInProgress = false; } @@ -309,7 +317,6 @@ public: ++Phase; //prepare next phase } }; - }; /*###### diff --git a/src/server/scripts/EasternKingdoms/stormwind_city.cpp b/src/server/scripts/EasternKingdoms/stormwind_city.cpp index a4eca1950f8..96ad1da725d 100644 --- a/src/server/scripts/EasternKingdoms/stormwind_city.cpp +++ b/src/server/scripts/EasternKingdoms/stormwind_city.cpp @@ -47,10 +47,10 @@ class npc_archmage_malin : public CreatureScript public: npc_archmage_malin() : CreatureScript("npc_archmage_malin") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF) + if (action == GOSSIP_ACTION_INFO_DEF) { player->CLOSE_GOSSIP_MENU(); creature->CastSpell(player, 42711, true); @@ -71,7 +71,6 @@ public: return true; } - }; /*###### @@ -106,9 +105,9 @@ public: struct npc_bartlebyAI : public ScriptedAI { - npc_bartlebyAI(Creature* c) : ScriptedAI(c) + npc_bartlebyAI(Creature* creature) : ScriptedAI(creature) { - m_uiNormalFaction = c->getFaction(); + m_uiNormalFaction = creature->getFaction(); } uint32 m_uiNormalFaction; @@ -143,7 +142,6 @@ public: } } }; - }; /*###### @@ -160,10 +158,10 @@ class npc_lady_katrana_prestor : public CreatureScript public: npc_lady_katrana_prestor() : CreatureScript("npc_lady_katrana_prestor") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAT_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -197,7 +195,6 @@ public: return true; } - }; /*###### @@ -271,9 +268,9 @@ public: } } - void WaypointReached(uint32 uiPointId) + void WaypointReached(uint32 waypointId) { - switch (uiPointId) + switch (waypointId) { case 14: SetEscortPaused(true); @@ -370,7 +367,6 @@ public: DoMeleeAttackIfReady(); } }; - }; /*###### @@ -391,7 +387,7 @@ public: { npc_marzon_silent_bladeAI(Creature* creature) : ScriptedAI(creature) { - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(true); } void Reset() @@ -407,7 +403,7 @@ public: { if (Unit* summoner = me->ToTempSummon()->GetSummoner()) { - if (summoner && summoner->GetTypeId() == TYPEID_UNIT && summoner->isAlive() && !summoner->isInCombat()) + if (summoner->GetTypeId() == TYPEID_UNIT && summoner->isAlive() && !summoner->isInCombat()) summoner->ToCreature()->AI()->AttackStart(who); } } @@ -421,7 +417,7 @@ public: { if (Unit* summoner = me->ToTempSummon()->GetSummoner()) { - if (summoner && summoner->GetTypeId() == TYPEID_UNIT && summoner->isAlive()) + if (summoner->GetTypeId() == TYPEID_UNIT && summoner->isAlive()) summoner->ToCreature()->DisappearAndDie(); } } @@ -457,7 +453,6 @@ public: DoMeleeAttackIfReady(); } }; - }; /*###### @@ -502,9 +497,9 @@ public: uiPhase = 0; } - void WaypointReached(uint32 uiPointId) + void WaypointReached(uint32 waypointId) { - switch (uiPointId) + switch (waypointId) { case 1: SetEscortPaused(true); @@ -606,7 +601,6 @@ public: DoMeleeAttackIfReady(); } }; - }; /*###### @@ -636,7 +630,6 @@ public: } return false; } - }; void AddSC_stormwind_city() diff --git a/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp b/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp index a6effe29ff7..03f92ce6d61 100644 --- a/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp +++ b/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp @@ -45,7 +45,7 @@ public: struct mob_yennikuAI : public ScriptedAI { - mob_yennikuAI(Creature* c) : ScriptedAI(c) + mob_yennikuAI(Creature* creature) : ScriptedAI(creature) { bReset = false; } @@ -114,7 +114,6 @@ public: DoMeleeAttackIfReady(); } }; - }; /*###### diff --git a/src/server/scripts/EasternKingdoms/swamp_of_sorrows.cpp b/src/server/scripts/EasternKingdoms/swamp_of_sorrows.cpp index ef6fccd8bde..6507ec911c0 100644 --- a/src/server/scripts/EasternKingdoms/swamp_of_sorrows.cpp +++ b/src/server/scripts/EasternKingdoms/swamp_of_sorrows.cpp @@ -106,24 +106,24 @@ public: } } - void WaypointReached(uint32 uiPointId) + void WaypointReached(uint32 waypointId) { - switch (uiPointId) + switch (waypointId) { - case 0: - if (GameObject* pCage = me->GetMap()->GetGameObject(m_uiGalensCageGUID)) - pCage->ResetDoorOrButton(); - break; - case 20: - if (Player* player = GetPlayerForEscort()) - { - me->SetFacingToObject(player); - DoScriptText(SAY_QUEST_COMPLETE, me, player); - DoScriptText(EMOTE_WHISPER, me, player); - player->GroupEventHappens(QUEST_GALENS_ESCAPE, me); - } - SetRun(true); - break; + case 0: + if (GameObject* pCage = me->GetMap()->GetGameObject(m_uiGalensCageGUID)) + pCage->ResetDoorOrButton(); + break; + case 20: + if (Player* player = GetPlayerForEscort()) + { + me->SetFacingToObject(player); + DoScriptText(SAY_QUEST_COMPLETE, me, player); + DoScriptText(EMOTE_WHISPER, me, player); + player->GroupEventHappens(QUEST_GALENS_ESCAPE, me); + } + SetRun(true); + break; } } diff --git a/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp b/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp index 0d72ab6fb2f..4687fa3630f 100644 --- a/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp +++ b/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp @@ -150,7 +150,6 @@ public: DoMeleeAttackIfReady(); } }; - }; /*###### @@ -185,7 +184,6 @@ public: return false; } - }; class go_mausoleum_trigger : public GameObjectScript @@ -207,7 +205,6 @@ public: return false; } - }; void AddSC_tirisfal_glades() diff --git a/src/server/scripts/EasternKingdoms/undercity.cpp b/src/server/scripts/EasternKingdoms/undercity.cpp index fe9c40e6dbd..a9b627ded34 100644 --- a/src/server/scripts/EasternKingdoms/undercity.cpp +++ b/src/server/scripts/EasternKingdoms/undercity.cpp @@ -47,7 +47,15 @@ enum Sylvanas SPELL_HIGHBORNE_AURA = 37090, SPELL_SYLVANAS_CAST = 36568, - SPELL_RIBBON_OF_SOULS = 34432, //the real one to use might be 37099 + SPELL_RIBBON_OF_SOULS = 34432, // the real one to use might be 37099 + + // Combat spells + SPELL_BLACK_ARROW = 59712, + SPELL_FADE = 20672, + SPELL_FADE_BLINK = 29211, + SPELL_MULTI_SHOT = 59713, + SPELL_SHOT = 59710, + SPELL_SUMMON_SKELETON = 59711 }; float HighborneLoc[4][3]= @@ -88,17 +96,29 @@ public: struct npc_lady_sylvanas_windrunnerAI : public ScriptedAI { - npc_lady_sylvanas_windrunnerAI(Creature* c) : ScriptedAI(c) {} + npc_lady_sylvanas_windrunnerAI(Creature* creature) : ScriptedAI(creature) {} - uint32 LamentEvent_Timer; + uint32 LamentEventTimer; bool LamentEvent; uint64 targetGUID; + uint32 FadeTimer; + uint32 SummonSkeletonTimer; + uint32 BlackArrowTimer; + uint32 ShotTimer; + uint32 MultiShotTimer; + void Reset() { - LamentEvent_Timer = 5000; + LamentEventTimer = 5000; LamentEvent = false; targetGUID = 0; + + FadeTimer = 30000; + SummonSkeletonTimer = 20000; + BlackArrowTimer = 15000; + ShotTimer = 8000; + MultiShotTimer = 10000; } void EnterCombat(Unit* /*who*/) {} @@ -114,7 +134,7 @@ public: summoned->CastSpell(target, SPELL_RIBBON_OF_SOULS, false); } - summoned->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + summoned->SetDisableGravity(true); targetGUID = summoned->GetGUID(); } } @@ -123,27 +143,73 @@ public: { if (LamentEvent) { - if (LamentEvent_Timer <= diff) + if (LamentEventTimer <= diff) { DoSummon(ENTRY_HIGHBORNE_BUNNY, me, 10.0f, 3000, TEMPSUMMON_TIMED_DESPAWN); - LamentEvent_Timer = 2000; + LamentEventTimer = 2000; if (!me->HasAura(SPELL_SYLVANAS_CAST)) { DoScriptText(SAY_LAMENT_END, me); DoScriptText(EMOTE_LAMENT_END, me); LamentEvent = false; } - } else LamentEvent_Timer -= diff; + } else LamentEventTimer -= diff; } if (!UpdateVictim()) return; + // Combat spells + + if (FadeTimer <= diff) + { + DoCast(me, SPELL_FADE); + // add a blink to simulate a stealthed movement and reappearing elsewhere + DoCast(me, SPELL_FADE_BLINK); + FadeTimer = 30000 + rand()%5000; + // if the victim is out of melee range she cast multi shot + if (Unit* victim = me->getVictim()) + if (me->GetDistance(victim) > 10.0f) + DoCast(victim, SPELL_MULTI_SHOT); + } else FadeTimer -= diff; + + if (SummonSkeletonTimer <= diff) + { + DoCast(me, SPELL_SUMMON_SKELETON); + SummonSkeletonTimer = 20000 + rand()%10000; + } else SummonSkeletonTimer -= diff; + + if (BlackArrowTimer <= diff) + { + if (Unit* victim = me->getVictim()) + { + DoCast(victim, SPELL_BLACK_ARROW); + BlackArrowTimer = 15000 + rand()%5000; + } + } else BlackArrowTimer -= diff; + + if (ShotTimer <= diff) + { + if (Unit* victim = me->getVictim()) + { + DoCast(victim, SPELL_SHOT); + ShotTimer = 8000 + rand()%2000; + } + } else ShotTimer -= diff; + + if (MultiShotTimer <= diff) + { + if (Unit* victim = me->getVictim()) + { + DoCast(victim, SPELL_MULTI_SHOT); + MultiShotTimer = 10000 + rand()%3000; + } + } else MultiShotTimer -= diff; + DoMeleeAttackIfReady(); } }; - }; /*###### @@ -162,17 +228,17 @@ public: struct npc_highborne_lamenterAI : public ScriptedAI { - npc_highborne_lamenterAI(Creature* c) : ScriptedAI(c) {} + npc_highborne_lamenterAI(Creature* creature) : ScriptedAI(creature) {} - uint32 EventMove_Timer; - uint32 EventCast_Timer; + uint32 EventMoveTimer; + uint32 EventCastTimer; bool EventMove; bool EventCast; void Reset() { - EventMove_Timer = 10000; - EventCast_Timer = 17500; + EventMoveTimer = 10000; + EventCastTimer = 17500; EventMove = true; EventCast = true; } @@ -183,25 +249,24 @@ public: { if (EventMove) { - if (EventMove_Timer <= diff) + if (EventMoveTimer <= diff) { - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetDisableGravity(true); me->MonsterMoveWithSpeed(me->GetPositionX(), me->GetPositionY(), HIGHBORNE_LOC_Y_NEW, me->GetDistance(me->GetPositionX(), me->GetPositionY(), HIGHBORNE_LOC_Y_NEW) / (5000 * 0.001f)); me->SetPosition(me->GetPositionX(), me->GetPositionY(), HIGHBORNE_LOC_Y_NEW, me->GetOrientation()); EventMove = false; - } else EventMove_Timer -= diff; + } else EventMoveTimer -= diff; } if (EventCast) { - if (EventCast_Timer <= diff) + if (EventCastTimer <= diff) { DoCast(me, SPELL_HIGHBORNE_AURA); EventCast = false; - } else EventCast_Timer -= diff; + } else EventCastTimer -= diff; } } }; - }; /*###### @@ -219,15 +284,15 @@ class npc_parqual_fintallas : public CreatureScript public: npc_parqual_fintallas() : CreatureScript("npc_parqual_fintallas") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { player->CLOSE_GOSSIP_MENU(); creature->CastSpell(player, SPELL_MARK_OF_SHAME, false); } - if (uiAction == GOSSIP_ACTION_INFO_DEF+2) + if (action == GOSSIP_ACTION_INFO_DEF+2) { player->CLOSE_GOSSIP_MENU(); player->AreaExploredOrEventHappens(6628); @@ -252,7 +317,6 @@ public: return true; } - }; /*###### diff --git a/src/server/scripts/EasternKingdoms/western_plaguelands.cpp b/src/server/scripts/EasternKingdoms/western_plaguelands.cpp index a04a94f73b1..0057c01b882 100644 --- a/src/server/scripts/EasternKingdoms/western_plaguelands.cpp +++ b/src/server/scripts/EasternKingdoms/western_plaguelands.cpp @@ -49,10 +49,10 @@ class npcs_dithers_and_arbington : public CreatureScript public: npcs_dithers_and_arbington() : CreatureScript("npcs_dithers_and_arbington") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_TRADE: player->GetSession()->SendListInventory(creature->GetGUID()); @@ -85,6 +85,7 @@ public: { if (creature->isQuestGiver()) player->PrepareQuestMenu(creature->GetGUID()); + if (creature->isVendor()) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); @@ -95,12 +96,12 @@ public: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HDA3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HDA4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); player->SEND_GOSSIP_MENU(3985, creature->GetGUID()); - }else + } + else player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); return true; } - }; /*###### @@ -121,10 +122,10 @@ class npc_myranda_the_hag : public CreatureScript public: npc_myranda_the_hag() : CreatureScript("npc_myranda_the_hag") { } - bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) + if (action == GOSSIP_ACTION_INFO_DEF + 1) { player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, SPELL_SCARLET_ILLUSION, false); @@ -149,7 +150,6 @@ public: return true; } - }; /*###### @@ -168,7 +168,7 @@ public: struct npc_the_scourge_cauldronAI : public ScriptedAI { - npc_the_scourge_cauldronAI(Creature* c) : ScriptedAI(c) {} + npc_the_scourge_cauldronAI(Creature* creature) : ScriptedAI(creature) {} void Reset() {} @@ -229,7 +229,6 @@ public: } } }; - }; /*###### @@ -253,7 +252,7 @@ public: struct npc_andorhal_towerAI : public Scripted_NoMovementAI { - npc_andorhal_towerAI(Creature* c) : Scripted_NoMovementAI(c) {} + npc_andorhal_towerAI(Creature* creature) : Scripted_NoMovementAI(creature) {} void MoveInLineOfSight(Unit* who) { @@ -264,7 +263,6 @@ public: CAST_PLR(who)->KilledMonsterCredit(me->GetEntry(), me->GetGUID()); } }; - }; /*###### @@ -330,10 +328,11 @@ public: summoned->AI()->AttackStart(me); } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); - switch (i) + + switch (waypointId) { case 8: DoScriptText(SAY_WP_0, me); @@ -359,7 +358,7 @@ public: break; case 23: Ughost = me->SummonCreature(NPC_GHOST_UTHER, 971.86f, -1825.42f, 81.99f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - Ughost->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + Ughost->SetDisableGravity(true); DoScriptText(SAY_WP_4, Ughost, me); m_uiChatTimer = 4000; break; @@ -382,8 +381,7 @@ public: void JustDied(Unit* /*killer*/) { - Player* player = GetPlayerForEscort(); - if (player) + if (Player* player = GetPlayerForEscort()) player->FailQuest(QUEST_TOMB_LIGHTBRINGER); } @@ -395,7 +393,6 @@ public: m_uiChatTimer = 6000; } }; - }; /*###### diff --git a/src/server/scripts/EasternKingdoms/westfall.cpp b/src/server/scripts/EasternKingdoms/westfall.cpp index 271e1d99d63..46f1526c5bf 100644 --- a/src/server/scripts/EasternKingdoms/westfall.cpp +++ b/src/server/scripts/EasternKingdoms/westfall.cpp @@ -85,9 +85,15 @@ public: { switch (uiWPHolder) { - case 7: DoScriptText(SAY_DS_DOWN_1, me); break; - case 8: DoScriptText(SAY_DS_DOWN_2, me); break; - case 9: DoScriptText(SAY_DS_DOWN_3, me); break; + case 7: + DoScriptText(SAY_DS_DOWN_1, me); + break; + case 8: + DoScriptText(SAY_DS_DOWN_2, me); + break; + case 9: + DoScriptText(SAY_DS_DOWN_3, me); + break; } } else @@ -96,16 +102,15 @@ public: uiShootTimer = 0; } - void WaypointReached(uint32 uiPoint) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); - if (!player) return; - uiWPHolder = uiPoint; + uiWPHolder = waypointId; - switch (uiPoint) + switch (waypointId) { case 4: SetEquipmentSlots(false, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE, EQUIP_ID_RIFLE); @@ -185,7 +190,6 @@ public: } else uiShootTimer -= diff; } }; - }; /*###### @@ -225,16 +229,15 @@ public: struct npc_defias_traitorAI : public npc_escortAI { - npc_defias_traitorAI(Creature* c) : npc_escortAI(c) { Reset(); } + npc_defias_traitorAI(Creature* creature) : npc_escortAI(creature) { Reset(); } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); - if (!player) return; - switch (i) + switch (waypointId) { case 35: SetRun(false); @@ -244,13 +247,11 @@ public: break; case 44: DoScriptText(SAY_END, me, player); - { - if (player) - player->GroupEventHappens(QUEST_DEFIAS_BROTHERHOOD, me); - } + player->GroupEventHappens(QUEST_DEFIAS_BROTHERHOOD, me); break; } } + void EnterCombat(Unit* who) { DoScriptText(RAND(SAY_AGGRO_1, SAY_AGGRO_2), me, who); @@ -258,7 +259,6 @@ public: void Reset() {} }; - }; void AddSC_westfall() diff --git a/src/server/scripts/EasternKingdoms/wetlands.cpp b/src/server/scripts/EasternKingdoms/wetlands.cpp index 3b196720242..bf28d9838a4 100644 --- a/src/server/scripts/EasternKingdoms/wetlands.cpp +++ b/src/server/scripts/EasternKingdoms/wetlands.cpp @@ -67,14 +67,13 @@ public: m_bFriendSummoned = false; } - void WaypointReached(uint32 uiPointId) + void WaypointReached(uint32 waypointId) { - switch (uiPointId) + switch (waypointId) { case 2: if (me->HasStealthAura()) me->RemoveAurasByType(SPELL_AURA_MOD_STEALTH); - SetRun(); me->setFaction(FACTION_ENEMY); break; @@ -132,7 +131,6 @@ public: } } }; - }; /*###### @@ -161,7 +159,6 @@ public: } return false; } - }; /*###### diff --git a/src/server/scripts/Examples/CMakeLists.txt b/src/server/scripts/Examples/CMakeLists.txt index 14002100713..dde6fe2c37c 100644 --- a/src/server/scripts/Examples/CMakeLists.txt +++ b/src/server/scripts/Examples/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/> +# Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> # # This file is free software; as a special exception the author gives # unlimited permission to copy and/or distribute it, with or without diff --git a/src/server/scripts/Examples/example_creature.cpp b/src/server/scripts/Examples/example_creature.cpp index f1b336f07f9..7f75a0fb481 100644 --- a/src/server/scripts/Examples/example_creature.cpp +++ b/src/server/scripts/Examples/example_creature.cpp @@ -90,7 +90,7 @@ class example_creature : public CreatureScript { // *** HANDLED FUNCTION *** //This is the constructor, called only once when the Creature is first created - example_creatureAI(Creature* c) : ScriptedAI(c) {} + example_creatureAI(Creature* creature) : ScriptedAI(creature) {} // *** CUSTOM VARIABLES **** //These variables are for use only by this individual script. @@ -271,10 +271,10 @@ class example_creature : public CreatureScript return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { player->CLOSE_GOSSIP_MENU(); //Set our faction to hostile towards all diff --git a/src/server/scripts/Examples/example_escort.cpp b/src/server/scripts/Examples/example_escort.cpp index cae09266b49..851a32538e9 100644 --- a/src/server/scripts/Examples/example_escort.cpp +++ b/src/server/scripts/Examples/example_escort.cpp @@ -75,9 +75,9 @@ class example_escort : public CreatureScript } // Pure Virtual Functions (Have to be implemented) - void WaypointReached(uint32 uiWP) + void WaypointReached(uint32 waypointId) { - switch (uiWP) + switch (waypointId) { case 1: DoScriptText(SAY_WP_1, me); @@ -123,9 +123,7 @@ class example_escort : public CreatureScript { // not a likely case, code here for the sake of example if (killer == me) - { DoScriptText(SAY_DEATH_1, me, player); - } else DoScriptText(SAY_DEATH_2, me, player); } @@ -197,12 +195,12 @@ class example_escort : public CreatureScript return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); npc_escortAI* pEscortAI = CAST_AI(example_escort::example_escortAI, creature->AI()); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: player->CLOSE_GOSSIP_MENU(); diff --git a/src/server/scripts/Examples/example_gossip_codebox.cpp b/src/server/scripts/Examples/example_gossip_codebox.cpp index c288123f117..6d57f1ac798 100644 --- a/src/server/scripts/Examples/example_gossip_codebox.cpp +++ b/src/server/scripts/Examples/example_gossip_codebox.cpp @@ -58,10 +58,10 @@ class example_gossip_codebox : public CreatureScript return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+2) + if (action == GOSSIP_ACTION_INFO_DEF+2) { DoScriptText(SAY_NOT_INTERESTED, creature); player->CLOSE_GOSSIP_MENU(); @@ -70,12 +70,12 @@ class example_gossip_codebox : public CreatureScript return true; } - bool OnGossipSelectCode(Player* player, Creature* creature, uint32 uiSender, uint32 uiAction, const char* code) + bool OnGossipSelectCode(Player* player, Creature* creature, uint32 sender, uint32 action, const char* code) { player->PlayerTalkClass->ClearMenus(); - if (uiSender == GOSSIP_SENDER_MAIN) + if (sender == GOSSIP_SENDER_MAIN) { - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: if (std::strcmp(code, player->GetName()) != 0) diff --git a/src/server/scripts/Examples/example_spell.cpp b/src/server/scripts/Examples/example_spell.cpp index 71dbd7f4fb0..70d7f43135c 100644 --- a/src/server/scripts/Examples/example_spell.cpp +++ b/src/server/scripts/Examples/example_spell.cpp @@ -92,7 +92,7 @@ class spell_ex_5581 : public SpellScriptLoader void HandleAfterCast() { - sLog->outString("All immediate actions for the spell are finished now"); + sLog->outString("All immediate Actions for the spell are finished now"); // this is a safe for triggering additional effects for a spell without interfering // with visuals or with other effects of the spell //GetCaster()->CastSpell(target, SPELL_TRIGGERED, true); @@ -102,7 +102,7 @@ class spell_ex_5581 : public SpellScriptLoader { // in this hook you can add additional requirements for spell caster (and throw a client error if reqs're not passed) // in this case we're disallowing to select non-player as a target of the spell - //if (!GetTargetUnit() || GetTargetUnit()->ToPlayer()) + //if (!GetExplTargetUnit() || GetExplTargetUnit()->ToPlayer()) //return SPELL_FAILED_BAD_TARGETS; return SPELL_CAST_OK; } diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp index 3bfaa448b85..a86b2b8b17a 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp @@ -201,7 +201,7 @@ class npc_morridune : public CreatureScript public: npc_morridune() : CreatureScript("npc_morridune") { } - bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*Sender*/, uint32 action) + bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); switch (action) @@ -236,9 +236,9 @@ public: Start(false, false, 0); } - void WaypointReached(uint32 uiPoint) + void WaypointReached(uint32 waypointId) { - switch (uiPoint) + switch (waypointId) { case 4: SetEscortPaused(true); diff --git a/src/server/scripts/Kalimdor/CMakeLists.txt b/src/server/scripts/Kalimdor/CMakeLists.txt index 9c68451122f..7f63c521594 100644 --- a/src/server/scripts/Kalimdor/CMakeLists.txt +++ b/src/server/scripts/Kalimdor/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/> +# Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> # # This file is free software; as a special exception the author gives # unlimited permission to copy and/or distribute it, with or without diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp index 6bc179bba40..85f82c62079 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp @@ -64,11 +64,10 @@ public: struct boss_anetheronAI : public hyjal_trashAI { - boss_anetheronAI(Creature* c) : hyjal_trashAI(c) + boss_anetheronAI(Creature* creature) : hyjal_trashAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); go = false; - pos = 0; } uint32 SwarmTimer; @@ -76,7 +75,6 @@ public: uint32 AuraTimer; uint32 InfernoTimer; bool go; - uint32 pos; void Reset() { @@ -117,20 +115,19 @@ public: } } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { - pos = i; - if (i == 7 && instance) + if (waypointId == 7 && instance) { - Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_JAINAPROUDMOORE)); + Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); if (target && target->isAlive()) me->AddThreat(target, 0.0f); } } - void JustDied(Unit* victim) + void JustDied(Unit* killer) { - hyjal_trashAI::JustDied(victim); + hyjal_trashAI::JustDied(killer); if (instance && IsEvent) instance->SetData(DATA_ANETHERONEVENT, DONE); DoPlaySoundToSet(me, SOUND_ONDEATH); @@ -248,9 +245,9 @@ public: struct mob_towering_infernalAI : public ScriptedAI { - mob_towering_infernalAI(Creature* c) : ScriptedAI(c) + mob_towering_infernalAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); if (instance) AnetheronGUID = instance->GetData64(DATA_ANETHERON); } @@ -275,7 +272,7 @@ public: { } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp index a5239e5a649..f07aaaa1f2a 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp @@ -86,9 +86,9 @@ public: struct mob_ancient_wispAI : public ScriptedAI { - mob_ancient_wispAI(Creature* c) : ScriptedAI(c) + mob_ancient_wispAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); ArchimondeGUID = 0; } @@ -108,13 +108,16 @@ public: void EnterCombat(Unit* /*who*/) {} - void DamageTaken(Unit* /*done_by*/, uint32 &damage) { damage = 0; } + void DamageTaken(Unit* /*done_by*/, uint32 &damage) + { + damage = 0; + } void UpdateAI(const uint32 diff) { if (CheckTimer <= diff) { - if (Unit* Archimonde = Unit::GetUnit((*me), ArchimondeGUID)) + if (Unit* Archimonde = Unit::GetUnit(*me, ArchimondeGUID)) { if (Archimonde->HealthBelowPct(2) || !Archimonde->isAlive()) DoCast(me, SPELL_DENOUEMENT_WISP); @@ -142,15 +145,18 @@ public: struct mob_doomfireAI : public ScriptedAI { - mob_doomfireAI(Creature* c) : ScriptedAI(c) {} + mob_doomfireAI(Creature* creature) : ScriptedAI(creature) {} void Reset() { } void MoveInLineOfSight(Unit* /*who*/) {} void EnterCombat(Unit* /*who*/) {} - void DamageTaken(Unit* /*done_by*/, uint32 &damage) { damage = 0; } - }; + void DamageTaken(Unit* /*done_by*/, uint32 &damage) + { + damage = 0; + } + }; }; /* This is the script for the Doomfire Spirit Mob. This mob simply follow players or @@ -167,7 +173,7 @@ public: struct mob_doomfire_targettingAI : public ScriptedAI { - mob_doomfire_targettingAI(Creature* c) : ScriptedAI(c) {} + mob_doomfire_targettingAI(Creature* creature) : ScriptedAI(creature) {} uint64 TargetGUID; uint32 ChangeTargetTimer; @@ -188,7 +194,10 @@ public: void EnterCombat(Unit* /*who*/) {} - void DamageTaken(Unit* /*done_by*/, uint32 &damage) { damage = 0; } + void DamageTaken(Unit* /*done_by*/, uint32 &damage) + { + damage = 0; + } void UpdateAI(const uint32 diff) { @@ -233,9 +242,9 @@ public: struct boss_archimondeAI : public hyjal_trashAI { - boss_archimondeAI(Creature* c) : hyjal_trashAI(c) + boss_archimondeAI(Creature* creature) : hyjal_trashAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -334,9 +343,9 @@ public: ++SoulChargeCount; } - void JustDied(Unit* victim) + void JustDied(Unit* killer) { - hyjal_trashAI::JustDied(victim); + hyjal_trashAI::JustDied(killer); DoScriptText(SAY_DEATH, me); if (instance) @@ -358,7 +367,7 @@ public: std::list<HostileReference*>::const_iterator itr = m_threatlist.begin(); for (; itr != m_threatlist.end(); ++itr) { - Unit* unit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); + Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()); if (unit && unit->isAlive()) targets.push_back(unit); } @@ -635,7 +644,11 @@ public: DoMeleeAttackIfReady(); } - void WaypointReached(uint32 /*i*/){} + + void WaypointReached(uint32 /*waypointId*/) + { + + } }; }; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp index 2885276f2b6..a9e0c866ab9 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp @@ -55,11 +55,10 @@ public: struct boss_azgalorAI : public hyjal_trashAI { - boss_azgalorAI(Creature* c) : hyjal_trashAI(c) + boss_azgalorAI(Creature* creature) : hyjal_trashAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); go = false; - pos = 0; } uint32 RainTimer; @@ -70,7 +69,6 @@ public: bool enraged; bool go; - uint32 pos; void Reset() { @@ -113,20 +111,19 @@ public: } } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { - pos = i; - if (i == 7 && instance) + if (waypointId == 7 && instance) { - Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_THRALL)); + Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL)); if (target && target->isAlive()) me->AddThreat(target, 0.0f); } } - void JustDied(Unit* victim) + void JustDied(Unit* killer) { - hyjal_trashAI::JustDied(victim); + hyjal_trashAI::JustDied(killer); if (instance && IsEvent) instance->SetData(DATA_AZGALOREVENT, DONE); DoPlaySoundToSet(me, SOUND_ONDEATH); @@ -215,9 +212,9 @@ public: struct mob_lesser_doomguardAI : public hyjal_trashAI { - mob_lesser_doomguardAI(Creature* c) : hyjal_trashAI(c) + mob_lesser_doomguardAI(Creature* creature) : hyjal_trashAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); if (instance) AzgalorGUID = instance->GetData64(DATA_AZGALOR); } @@ -244,7 +241,7 @@ public: { } - void WaypointReached(uint32 /*i*/) + void WaypointReached(uint32 /*waypointId*/) { } @@ -254,7 +251,7 @@ public: AttackStart(who); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp index 7d1b292fd12..407faa19eaa 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp @@ -52,11 +52,10 @@ public: struct boss_kazrogalAI : public hyjal_trashAI { - boss_kazrogalAI(Creature* c) : hyjal_trashAI(c) + boss_kazrogalAI(Creature* creature) : hyjal_trashAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); go = false; - pos = 0; } uint32 CleaveTimer; @@ -64,7 +63,6 @@ public: uint32 MarkTimer; uint32 MarkTimerBase; bool go; - uint32 pos; void Reset() { @@ -105,20 +103,19 @@ public: } } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { - pos = i; - if (i == 7 && instance) + if (waypointId == 7 && instance) { - Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_THRALL)); + Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL)); if (target && target->isAlive()) me->AddThreat(target, 0.0f); } } - void JustDied(Unit* victim) + void JustDied(Unit* killer) { - hyjal_trashAI::JustDied(victim); + hyjal_trashAI::JustDied(killer); if (instance && IsEvent) instance->SetData(DATA_KAZROGALEVENT, DONE); DoPlaySoundToSet(me, SOUND_ONDEATH); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp index 3f39b61192a..5d7ee1fe194 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp @@ -58,11 +58,10 @@ public: struct boss_rage_winterchillAI : public hyjal_trashAI { - boss_rage_winterchillAI(Creature* c) : hyjal_trashAI(c) + boss_rage_winterchillAI(Creature* creature) : hyjal_trashAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); go = false; - pos = 0; } uint32 FrostArmorTimer; @@ -70,7 +69,6 @@ public: uint32 NovaTimer; uint32 IceboltTimer; bool go; - uint32 pos; void Reset() { @@ -107,20 +105,19 @@ public: } } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { - pos = i; - if (i == 7 && instance) + if (waypointId == 7 && instance) { - Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_JAINAPROUDMOORE)); + Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); if (target && target->isAlive()) me->AddThreat(target, 0.0f); } } - void JustDied(Unit* victim) + void JustDied(Unit* killer) { - hyjal_trashAI::JustDied(victim); + hyjal_trashAI::JustDied(killer); if (instance && IsEvent) instance->SetData(DATA_RAGEWINTERCHILLEVENT, DONE); DoPlaySoundToSet(me, SOUND_ONDEATH); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp index 12485293650..22307468f14 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp @@ -50,11 +50,11 @@ class npc_jaina_proudmoore : public CreatureScript public: npc_jaina_proudmoore() : CreatureScript("npc_jaina_proudmoore") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); hyjalAI* ai = CAST_AI(hyjalAI, creature->AI()); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF + 1: ai->StartEvent(player); @@ -126,12 +126,12 @@ class npc_thrall : public CreatureScript public: npc_thrall() : CreatureScript("npc_thrall") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); hyjalAI* ai = CAST_AI(hyjalAI, creature->AI()); ai->DeSpawnVeins();//despawn the alliance veins - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF + 1: ai->StartEvent(player); @@ -212,10 +212,10 @@ public: return ai; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF) + if (action == GOSSIP_ACTION_INFO_DEF) { ItemPosCountVec dest; uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_TEAR_OF_GODDESS, 1); @@ -226,7 +226,6 @@ public: player->SendNewItem(item, 1, true, false, true); } player->SEND_GOSSIP_MENU(907, creature->GetGUID()); - CAST_AI(hyjalAI, creature->AI()); } return true; } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp index 107c9e8f2f9..2f6bbb7edb5 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp @@ -310,9 +310,9 @@ float HordeFirePos[65][8]=//spawn points for the fire visuals (GO) in the horde {5545.43f, -2647.82f, 1483.05f, 5.38848f, 0, 0, 0.432578f, -0.901596f} }; -hyjalAI::hyjalAI(Creature* c) : npc_escortAI(c), Summons(me) +hyjalAI::hyjalAI(Creature* creature) : npc_escortAI(creature), Summons(me) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); VeinsSpawned[0] = false; VeinsSpawned[1] = false; for (uint8 i=0; i<14; ++i) @@ -492,7 +492,7 @@ void hyjalAI::SummonCreature(uint32 entry, float Base[4][3]) // Increment Enemy Count to be used in World States and instance script ++EnemyCount; - creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + creature->SetWalk(false); creature->setActive(true); switch (entry) { @@ -855,7 +855,7 @@ void hyjalAI::UpdateAI(const uint32 diff) { if (BossGUID[i]) { - Unit* unit = Unit::GetUnit((*me), BossGUID[i]); + Unit* unit = Unit::GetUnit(*me, BossGUID[i]); if (unit && (!unit->isAlive())) { if (BossGUID[i] == BossGUID[0]) @@ -896,9 +896,17 @@ void hyjalAI::UpdateAI(const uint32 diff) switch (Spells[i].TargetType) { - case TARGETTYPE_SELF: target = me; break; - case TARGETTYPE_RANDOM: target = SelectTarget(SELECT_TARGET_RANDOM, 0); break; - case TARGETTYPE_VICTIM: target = me->getVictim(); break; + case TARGETTYPE_SELF: + target = me; + break; + + case TARGETTYPE_RANDOM: + target = SelectTarget(SELECT_TARGET_RANDOM, 0); + break; + + case TARGETTYPE_VICTIM: + target = me->getVictim(); + break; } if (target && target->isAlive()) @@ -972,9 +980,9 @@ void hyjalAI::RespawnNearPos(float x, float y) cell.Visit(p, obj_worker, *me->GetMap(), *me, me->GetGridActivationRange()); } -void hyjalAI::WaypointReached(uint32 i) +void hyjalAI::WaypointReached(uint32 waypointId) { - if (i == 1 || (i == 0 && me->GetEntry() == THRALL)) + if (waypointId == 1 || (waypointId == 0 && me->GetEntry() == THRALL)) { me->MonsterYell(YELL_HURRY, 0, 0); WaitForTeleport = true; @@ -983,7 +991,7 @@ void hyjalAI::WaypointReached(uint32 i) DoCast(me, SPELL_MASS_TELEPORT, false); if (me->GetEntry() == THRALL && DummyGuid) { - Unit* Dummy = Unit::GetUnit((*me), DummyGuid); + Unit* Dummy = Unit::GetUnit(*me, DummyGuid); if (Dummy) { CAST_AI(hyjalAI, CAST_CRE(Dummy)->AI())->DoMassTeleport = true; @@ -1014,7 +1022,7 @@ void hyjalAI::WaypointReached(uint32 i) if ((*itr) && (*itr)->isAlive() && (*itr) != me && (*itr)->GetEntry() != JAINA) { if (!(*itr)->IsWithinDist(me, 60)) - (*itr)->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + (*itr)->SetWalk(false); float x, y, z; (*itr)->SetDefaultMovementType(IDLE_MOTION_TYPE); (*itr)->GetMotionMaster()->Initialize(); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h index d91c2ead123..b32288ca43a 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h @@ -171,7 +171,7 @@ const Yells ThrallQuotes[]= struct hyjalAI : public npc_escortAI { - hyjalAI(Creature* c); + hyjalAI(Creature* creature); void Reset(); // Generically used to reset our variables. Do *not* call in EnterEvadeMode as this may make problems if the raid is still in combat @@ -196,7 +196,7 @@ struct hyjalAI : public npc_escortAI void SummonedCreatureDespawn(Creature* summoned); void HideNearPos(float x, float y); void RespawnNearPos(float x, float y); - void WaypointReached(uint32 i); + void WaypointReached(uint32 waypointId); void DoOverrun(uint32 faction, const uint32 diff); void MoveInLineOfSight(Unit* who); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp index c94cb874bfa..840aa5de081 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp @@ -155,9 +155,9 @@ float HordeOverrunWP[21][3]=//waypoints in the horde base used in the end in the {5429.91f, -2718.44f, 1493.42f}//20 end 2 }; -hyjal_trashAI::hyjal_trashAI(Creature* c) : npc_escortAI(c) +hyjal_trashAI::hyjal_trashAI(Creature* creature) : npc_escortAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); IsEvent = false; Delay = 0; LastOverronPos = 0; @@ -377,10 +377,11 @@ void hyjal_trashAI::UpdateAI(const uint32 /*diff*/) } } -void hyjal_trashAI::JustDied(Unit* /*victim*/) +void hyjal_trashAI::JustDied(Unit* /*killer*/) { if (!instance) return; + if (IsEvent && !me->isWorldBoss()) instance->SetData(DATA_TRASH, 0);//signal trash is dead @@ -395,9 +396,9 @@ public: struct mob_giant_infernalAI : public hyjal_trashAI { - mob_giant_infernalAI(Creature* c) : hyjal_trashAI(c) + mob_giant_infernalAI(Creature* creature) : hyjal_trashAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); meteor = false;//call once! CanMove = false; Delay = rand()%30000; @@ -405,7 +406,6 @@ public: me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetDisplayId(MODEL_INVIS); go = false; - pos = 0; Reset(); } @@ -413,7 +413,6 @@ public: bool CanMove; bool WpEnabled; bool go; - uint32 pos; uint32 spawnTimer; uint32 FlameBuffetTimer; bool imol; @@ -427,14 +426,13 @@ public: void EnterCombat(Unit* /*who*/) {} - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { - pos = i; - if (i == 0 && instance && !IsOverrun) + if (waypointId == 0 && instance && !IsOverrun) { if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall { - Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_THRALL)); + Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL)); if (target && target->isAlive()) me->AddThreat(target, 0.0f); } @@ -459,7 +457,7 @@ public: { trigger->SetVisible(false); trigger->setFaction(me->getFaction()); - trigger->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + trigger->SetDisableGravity(true); trigger->CastSpell(me, SPELL_METEOR, true); } me->GetMotionMaster()->Clear(); @@ -475,7 +473,7 @@ public: { if (instance->GetData(DATA_ALLIANCE_RETREAT) && !instance->GetData(DATA_HORDE_RETREAT)) { - Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_THRALL)); + Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL)); if (target && target->isAlive()) me->AddThreat(target, 0.0f); } else if (instance->GetData(DATA_ALLIANCE_RETREAT) && instance->GetData(DATA_HORDE_RETREAT)){ @@ -539,39 +537,38 @@ public: struct mob_abominationAI : public hyjal_trashAI { - mob_abominationAI(Creature* c) : hyjal_trashAI(c) + mob_abominationAI(Creature* creature) : hyjal_trashAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); go = false; - pos = 0; Reset(); } bool go; uint32 KnockDownTimer; - uint32 pos; void Reset() { KnockDownTimer = 10000; } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { - pos = i; - if (i == 7 && instance && !IsOverrun) + if (waypointId == 7 && instance && !IsOverrun) { if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall { - Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_THRALL)); + Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL)); if (target && target->isAlive()) me->AddThreat(target, 0.0f); - }else{ - Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_JAINAPROUDMOORE)); + } + else + { + Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); if (target && target->isAlive()) me->AddThreat(target, 0.0f); } } - if (i == LastOverronPos && IsOverrun) + if (waypointId == LastOverronPos && IsOverrun) { if ((faction == 0 && LastOverronPos == 17) || (faction == 1 && LastOverronPos == 21)) { @@ -640,17 +637,15 @@ public: struct mob_ghoulAI : public hyjal_trashAI { - mob_ghoulAI(Creature* c) : hyjal_trashAI(c) + mob_ghoulAI(Creature* creature) : hyjal_trashAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); go = false; - pos = 0; Reset(); } bool go; uint32 FrenzyTimer; - uint32 pos; uint32 MoveTimer; bool RandomMove; void Reset() @@ -660,23 +655,24 @@ public: RandomMove = false; } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { - pos = i; - if (i == 7 && instance && !IsOverrun) + if (waypointId == 7 && instance && !IsOverrun) { if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall { - Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_THRALL)); + Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL)); if (target && target->isAlive()) me->AddThreat(target, 0.0f); - }else{ - Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_JAINAPROUDMOORE)); + } + else + { + Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); if (target && target->isAlive()) me->AddThreat(target, 0.0f); } } - if (i == LastOverronPos && IsOverrun) + if (waypointId == LastOverronPos && IsOverrun) { me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_ATTACK_UNARMED); if ((faction == 0 && LastOverronPos == 17) || (faction == 1 && LastOverronPos == 21)) @@ -684,7 +680,6 @@ public: me->setDeathState(DEAD); me->RemoveCorpse(); } - } } @@ -749,17 +744,17 @@ public: struct mob_necromancerAI : public hyjal_trashAI { - mob_necromancerAI(Creature* c) : hyjal_trashAI(c), summons(me) + mob_necromancerAI(Creature* creature) : hyjal_trashAI(creature), summons(me) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); go = false; - pos = 0; Reset(); } + SummonList summons; bool go; uint32 ShadowBoltTimer; - uint32 pos; + void Reset() { ShadowBoltTimer = 1000+rand()%5000; @@ -773,19 +768,25 @@ public: summon->Attack(target, false); summons.Summon(summon); } - void SummonedCreatureDespawn(Creature* summon) {summons.Despawn(summon);} - void WaypointReached(uint32 i) + + void SummonedCreatureDespawn(Creature* summon) { - pos = i; - if (i == 7 && instance && !IsOverrun) + summons.Despawn(summon); + } + + void WaypointReached(uint32 waypointId) + { + if (waypointId == 7 && instance && !IsOverrun) { if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall { - Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_THRALL)); + Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL)); if (target && target->isAlive()) me->AddThreat(target, 0.0f); - }else{ - Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_JAINAPROUDMOORE)); + } + else + { + Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); if (target && target->isAlive()) me->AddThreat(target, 0.0f); } @@ -815,8 +816,10 @@ public: void UpdateAI(const uint32 diff) { hyjal_trashAI::UpdateAI(diff); + if (IsEvent || IsOverrun) npc_escortAI::UpdateAI(diff); + if (IsEvent) { if (!go) @@ -840,8 +843,10 @@ public: } } } + if (!UpdateVictim()) return; + if (ShadowBoltTimer <= diff) { DoCast(me->getVictim(), SPELL_SHADOW_BOLT); @@ -870,11 +875,10 @@ public: struct mob_bansheeAI : public hyjal_trashAI { - mob_bansheeAI(Creature* c) : hyjal_trashAI(c) + mob_bansheeAI(Creature* creature) : hyjal_trashAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); go = false; - pos = 0; Reset(); } @@ -882,7 +886,7 @@ public: uint32 CourseTimer; uint32 WailTimer; uint32 ShellTimer; - uint32 pos; + void Reset() { CourseTimer = 20000+rand()%5000; @@ -890,18 +894,19 @@ public: ShellTimer = 50000+rand()%10000; } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { - pos = i; - if (i == 7 && instance && !IsOverrun) + if (waypointId == 7 && instance && !IsOverrun) { if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall { - Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_THRALL)); + Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL)); if (target && target->isAlive()) me->AddThreat(target, 0.0f); - }else{ - Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_JAINAPROUDMOORE)); + } + else + { + Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); if (target && target->isAlive()) me->AddThreat(target, 0.0f); } @@ -975,34 +980,34 @@ public: struct mob_crypt_fiendAI : public hyjal_trashAI { - mob_crypt_fiendAI(Creature* c) : hyjal_trashAI(c) + mob_crypt_fiendAI(Creature* creature) : hyjal_trashAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); go = false; - pos = 0; Reset(); } bool go; uint32 WebTimer; - uint32 pos; + void Reset() { WebTimer = 20000+rand()%5000; } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { - pos = i; - if (i == 7 && instance && !IsOverrun) + if (waypointId == 7 && instance && !IsOverrun) { if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall { - Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_THRALL)); + Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL)); if (target && target->isAlive()) me->AddThreat(target, 0.0f); - }else{ - Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_JAINAPROUDMOORE)); + } + else + { + Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); if (target && target->isAlive()) me->AddThreat(target, 0.0f); } @@ -1067,34 +1072,34 @@ public: struct mob_fel_stalkerAI : public hyjal_trashAI { - mob_fel_stalkerAI(Creature* c) : hyjal_trashAI(c) + mob_fel_stalkerAI(Creature* creature) : hyjal_trashAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); go = false; - pos = 0; Reset(); } bool go; uint32 ManaBurnTimer; - uint32 pos; + void Reset() { ManaBurnTimer = 9000+rand()%5000; } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { - pos = i; - if (i == 7 && instance && !IsOverrun) + if (waypointId == 7 && instance && !IsOverrun) { if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall { - Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_THRALL)); + Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL)); if (target && target->isAlive()) me->AddThreat(target, 0.0f); - }else{ - Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_JAINAPROUDMOORE)); + } + else + { + Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); if (target && target->isAlive()) me->AddThreat(target, 0.0f); } @@ -1159,32 +1164,29 @@ public: struct mob_frost_wyrmAI : public hyjal_trashAI { - mob_frost_wyrmAI(Creature* c) : hyjal_trashAI(c) + mob_frost_wyrmAI(Creature* creature) : hyjal_trashAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); go = false; - pos = 0; Reset(); } bool go; uint32 FrostBreathTimer; - uint32 pos; uint32 MoveTimer; void Reset() { FrostBreathTimer = 5000; MoveTimer = 0; - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetDisableGravity(true); } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { - pos = i; - if (i == 2 && instance && !IsOverrun) + if (waypointId == 2 && instance && !IsOverrun) { - Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_THRALL)); + Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL)); if (target && target->isAlive()) { me->AddThreat(target, 0.0f); @@ -1193,7 +1195,7 @@ public: } } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { if (instance && IsEvent) instance->SetData(DATA_TRASH, 0);//signal trash is dead @@ -1276,18 +1278,16 @@ public: struct mob_gargoyleAI : public hyjal_trashAI { - mob_gargoyleAI(Creature* c) : hyjal_trashAI(c) + mob_gargoyleAI(Creature* creature) : hyjal_trashAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); go = false; - pos = 0; DummyTarget[0] = 0;DummyTarget[1] = 0;DummyTarget[2] = 0; Reset(); } bool go; uint32 StrikeTimer; - uint32 pos; uint32 MoveTimer; float Zpos; bool forcemove; @@ -1298,15 +1298,14 @@ public: Zpos = 10.0f; StrikeTimer = 2000+rand()%5000; MoveTimer = 0; - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetDisableGravity(true); } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { - pos = i; - if (i == 2 && instance && !IsOverrun) + if (waypointId == 2 && instance && !IsOverrun) { - Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_THRALL)); + Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL)); if (target && target->isAlive()) { me->AddThreat(target, 0.0f); @@ -1315,14 +1314,14 @@ public: } } - void JustDied(Unit* victim) + void JustDied(Unit* killer) { float x, y, z; me->GetPosition(x, y, z); z = me->GetMap()->GetHeight(me->GetPhaseMask(), x, y, z); me->GetMotionMaster()->MovePoint(0, x, y, z); me->SetPosition(x, y, z, 0); - hyjal_trashAI::JustDied(victim); + hyjal_trashAI::JustDied(killer); } void UpdateAI(const uint32 diff) @@ -1382,8 +1381,9 @@ public: float x, y, z; me->getVictim()->GetPosition(x, y, z); me->GetMotionMaster()->MovePoint(0, x, y, z+Zpos); - Zpos-=1.0f; - if (Zpos <= 0)Zpos=0; + Zpos -= 1.0f; + if (Zpos <= 0) + Zpos = 0; MoveTimer = 2000; } else MoveTimer-=diff; } @@ -1416,14 +1416,14 @@ public: struct alliance_riflemanAI : public Scripted_NoMovementAI { - alliance_riflemanAI(Creature* c) : Scripted_NoMovementAI(c) + alliance_riflemanAI(Creature* creature) : Scripted_NoMovementAI(creature) { Reset(); } uint32 ExplodeTimer; - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.h b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.h index 047c0dc308e..cb994167641 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.h +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.h @@ -25,7 +25,7 @@ struct hyjal_trashAI : public npc_escortAI { - hyjal_trashAI(Creature* c); + hyjal_trashAI(Creature* creature); void UpdateAI(const uint32 diff); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp index b87379d599f..ad8ebdb370a 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp @@ -110,7 +110,8 @@ public: bool IsEncounterInProgress() const { for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; + if (m_auiEncounter[i] == IN_PROGRESS) + return true; return false; } @@ -175,17 +176,23 @@ public: { switch (type) { - case DATA_RAGEWINTERCHILLEVENT: m_auiEncounter[0] = data; break; + case DATA_RAGEWINTERCHILLEVENT: + m_auiEncounter[0] = data; + break; case DATA_ANETHERONEVENT: m_auiEncounter[1] = data; break; - case DATA_KAZROGALEVENT: m_auiEncounter[2] = data; break; + case DATA_KAZROGALEVENT: + m_auiEncounter[2] = data; + break; case DATA_AZGALOREVENT: { m_auiEncounter[3] = data; if (data == DONE) { - if (ArchiYell)break; + if (ArchiYell) + break; + ArchiYell = true; Creature* creature = instance->GetCreature(Azgalor); @@ -219,12 +226,17 @@ public: } } break; - case DATA_ARCHIMONDEEVENT: m_auiEncounter[4] = data; break; - case DATA_RESET_TRASH_COUNT: Trash = 0; break; - + case DATA_ARCHIMONDEEVENT: + m_auiEncounter[4] = data; + break; + case DATA_RESET_TRASH_COUNT: + Trash = 0; + break; case DATA_TRASH: - if (data) Trash = data; - else Trash--; + if (data) + Trash = data; + else + Trash--; DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, Trash); break; case TYPE_RETREAT: diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp index 35c1848456b..b2853f25a33 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp @@ -60,9 +60,9 @@ public: struct boss_epochAI : public ScriptedAI { - boss_epochAI(Creature* c) : ScriptedAI(c) + boss_epochAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint8 uiStep; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp index 7947c9be48d..ccf60f9bd0b 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp @@ -43,9 +43,9 @@ public: struct boss_infinite_corruptorAI : public ScriptedAI { - boss_infinite_corruptorAI(Creature* c) : ScriptedAI(c) + boss_infinite_corruptorAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp index b61838a253a..a038a06f815 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp @@ -77,9 +77,9 @@ public: struct boss_mal_ganisAI : public ScriptedAI { - boss_mal_ganisAI(Creature* c) : ScriptedAI(c) + boss_mal_ganisAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 uiCarrionSwarmTimer; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp index c36b98ed510..d5dd597960f 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp @@ -57,9 +57,9 @@ public: struct boss_meathookAI : public ScriptedAI { - boss_meathookAI(Creature* c) : ScriptedAI(c) + boss_meathookAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); if (instance) DoScriptText(SAY_SPAWN, me); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp index 7a5e0d06158..7828d172e1e 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp @@ -66,9 +66,9 @@ public: struct boss_salrammAI : public ScriptedAI { - boss_salrammAI(Creature* c) : ScriptedAI(c) + boss_salrammAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); if (instance) DoScriptText(SAY_SPAWN, me); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp index 9518abd1635..6454083e424 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp @@ -446,9 +446,9 @@ public: ++uiStep; } - void WaypointReached(uint32 uiPointId) + void WaypointReached(uint32 waypointId) { - switch (uiPointId) + switch (waypointId) { case 0: case 1: @@ -591,11 +591,11 @@ public: } //After waypoint 0 case 1: - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(false); if (Unit* pUther = me->SummonCreature(NPC_UTHER, 1794.357f, 1272.183f, 140.558f, 1.37f, TEMPSUMMON_DEAD_DESPAWN, 180000)) { uiUtherGUID = pUther->GetGUID(); - pUther->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pUther->SetWalk(false); pUther->GetMotionMaster()->MovePoint(0, 1897.018f, 1287.487f, 143.481f); pUther->SetTarget(me->GetGUID()); me->SetTarget(uiUtherGUID); @@ -680,7 +680,7 @@ public: case 17: if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) { - pUther->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pUther->SetWalk(true); pUther->GetMotionMaster()->MovePoint(0, 1794.357f, 1272.183f, 140.558f); } JumpToNextStep(1000); @@ -689,7 +689,7 @@ public: if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID)) { me->SetTarget(uiJainaGUID); - pJaina->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pJaina->SetWalk(true); pJaina->GetMotionMaster()->MovePoint(0, 1794.357f, 1272.183f, 140.558f); } JumpToNextStep(1000); @@ -755,7 +755,7 @@ public: if (Creature* pCityman = Unit::GetCreature(*me, uiCitymenGUID[0])) { pCityman->SetTarget(me->GetGUID()); - pCityman->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pCityman->SetWalk(true); pCityman->GetMotionMaster()->MovePoint(0, 2088.625f, 1279.191f, 140.743f); } JumpToNextStep(2000); @@ -929,7 +929,7 @@ public: if (Unit* pBoss = me->SummonCreature(uiBossID, 2232.19f, 1331.933f, 126.662f, 3.15f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 900000)) { uiBossGUID = pBoss->GetGUID(); - pBoss->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pBoss->SetWalk(true); pBoss->GetMotionMaster()->MovePoint(0, 2194.110f, 1332.00f, 130.00f); } } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp index 9a91e1e232b..b232cae4657 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp @@ -16,6 +16,7 @@ */ #include "ScriptPCH.h" +#include "CreatureTextMgr.h" #include "culling_of_stratholme.h" #define MAX_ENCOUNTER 5 diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp index b895b56379c..5b47c2ee07d 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp @@ -55,9 +55,9 @@ public: struct boss_aeonusAI : public ScriptedAI { - boss_aeonusAI(Creature* c) : ScriptedAI(c) + boss_aeonusAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -93,7 +93,7 @@ public: ScriptedAI::MoveInLineOfSight(who); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp index 99e43495c96..a4e805b3b75 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp @@ -55,9 +55,9 @@ public: struct boss_chrono_lord_dejaAI : public ScriptedAI { - boss_chrono_lord_dejaAI(Creature* c) : ScriptedAI(c) + boss_chrono_lord_dejaAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -100,7 +100,7 @@ public: DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp index 9b272491717..f59c9f0ef4c 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp @@ -54,9 +54,9 @@ public: struct boss_temporusAI : public ScriptedAI { - boss_temporusAI(Creature* c) : ScriptedAI(c) + boss_temporusAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -84,7 +84,7 @@ public: DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp index 4ff34fc3349..c2a41cb29d1 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp @@ -68,9 +68,9 @@ public: struct npc_medivh_bmAI : public ScriptedAI { - npc_medivh_bmAI(Creature* c) : ScriptedAI(c) + npc_medivh_bmAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -111,7 +111,7 @@ public: instance->SetData(TYPE_MEDIVH, IN_PROGRESS); DoCast(me, SPELL_CHANNEL, false); Check_Timer = 5000; - } + } else if (who->GetTypeId() == TYPEID_UNIT && me->IsWithinDistInMap(who, 15.0f)) { if (instance->GetData(TYPE_MEDIVH) != IN_PROGRESS) @@ -153,9 +153,9 @@ public: SpellCorrupt_Timer = 3000; } - void JustDied(Unit* Killer) + void JustDied(Unit* killer) { - if (Killer->GetEntry() == me->GetEntry()) + if (killer->GetEntry() == me->GetEntry()) return; DoScriptText(SAY_DEATH, me); @@ -170,7 +170,7 @@ public: { if (SpellCorrupt_Timer <= diff) { - instance->SetData(TYPE_MEDIVH, SPECIAL); + instance->SetData(TYPE_MEDIVH, SPECIAL); if (me->HasAura(SPELL_CORRUPT_AEONUS)) SpellCorrupt_Timer = 1000; @@ -261,9 +261,9 @@ public: struct npc_time_riftAI : public ScriptedAI { - npc_time_riftAI(Creature* c) : ScriptedAI(c) + npc_time_riftAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -318,11 +318,11 @@ public: void DoSelectSummon() { - uint32 entry = 0; - if ((mRiftWaveCount > 2 && mWaveId < 1) || mRiftWaveCount > 3) mRiftWaveCount = 0; + uint32 entry = 0; + entry = PortalWaves[mWaveId].PortalMob[mRiftWaveCount]; sLog->outDebug(LOG_FILTER_TSCR, "TSCR: npc_time_rift: summoning wave Creature (Wave %u, Entry %u).", mRiftWaveCount, entry); @@ -370,10 +370,10 @@ class npc_saat : public CreatureScript public: npc_saat() : CreatureScript("npc_saat") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { player->CLOSE_GOSSIP_MENU(); creature->CastSpell(player, SPELL_CHRONO_BEACON, false); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp index dabf3db13cb..2c8cd096644 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp @@ -116,9 +116,9 @@ public: DoUpdateWorldState(WORLD_STATE_BM_RIFT, 0); } - bool IsEncounterInProgress() + bool IsEncounterInProgress() const { - if (GetData(TYPE_MEDIVH) == IN_PROGRESS) + if (const_cast<instance_dark_portal_InstanceMapScript*>(this)->GetData(TYPE_MEDIVH) == IN_PROGRESS) return true; return false; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp index 89877f2cc7b..c27507cdcec 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp @@ -52,9 +52,9 @@ public: struct boss_captain_skarlocAI : public ScriptedAI { - boss_captain_skarlocAI(Creature* c) : ScriptedAI(c) + boss_captain_skarlocAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -88,7 +88,7 @@ public: DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp index 8307eb44013..82bd0a9e9be 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp @@ -54,9 +54,9 @@ public: struct boss_epoch_hunterAI : public ScriptedAI { - boss_epoch_hunterAI(Creature* c) : ScriptedAI(c) + boss_epoch_hunterAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -84,7 +84,7 @@ public: DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp index 1f0ba93645f..45825a81eb2 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp @@ -36,9 +36,9 @@ class go_barrel_old_hillsbrad : public GameObjectScript public: go_barrel_old_hillsbrad() : GameObjectScript("go_barrel_old_hillsbrad") { } - bool OnGossipHello(Player* /*player*/, GameObject* pGO) + bool OnGossipHello(Player* /*player*/, GameObject* go) { - if (InstanceScript* instance = pGO->GetInstanceScript()) + if (InstanceScript* instance = go->GetInstanceScript()) { if (instance->GetData(TYPE_BARREL_DIVERSION) == DONE) return false; @@ -111,7 +111,7 @@ public: struct boss_lieutenant_drakeAI : public ScriptedAI { - boss_lieutenant_drakeAI(Creature* c) : ScriptedAI(c) {} + boss_lieutenant_drakeAI(Creature* creature) : ScriptedAI(creature) {} bool CanPatrol; uint32 wpId; @@ -142,7 +142,7 @@ public: DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp index aa57b3d9499..7d9da6771dc 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp @@ -51,10 +51,10 @@ class npc_erozion : public CreatureScript public: npc_erozion() : CreatureScript("npc_erozion") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { ItemPosCountVec dest; uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_ENTRY_BOMBS, 1); @@ -64,7 +64,7 @@ public: } player->SEND_GOSSIP_MENU(9515, creature->GetGUID()); } - if (uiAction == GOSSIP_ACTION_INFO_DEF+2) + if (action == GOSSIP_ACTION_INFO_DEF+2) { player->CLOSE_GOSSIP_MENU(); } @@ -198,11 +198,11 @@ public: return new npc_thrall_old_hillsbradAI(creature); } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); InstanceScript* instance = creature->GetInstanceScript(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: player->CLOSE_GOSSIP_MENU(); @@ -282,9 +282,9 @@ public: struct npc_thrall_old_hillsbradAI : public npc_escortAI { - npc_thrall_old_hillsbradAI(Creature* c) : npc_escortAI(c) + npc_thrall_old_hillsbradAI(Creature* creature) : npc_escortAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); HadMount = false; me->setActive(true); } @@ -296,12 +296,12 @@ public: bool LowHp; bool HadMount; - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { if (!instance) return; - switch (i) + switch (waypointId) { case 8: SetRun(false); @@ -401,7 +401,7 @@ public: SetRun(); break; case 91: - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(true); SetRun(false); break; case 93: @@ -413,7 +413,7 @@ public: case 94: if (uint64 TarethaGUID = instance->GetData64(DATA_TARETHA)) { - if (Unit* Taretha = Unit::GetUnit((*me), TarethaGUID)) + if (Unit* Taretha = Unit::GetUnit(*me, TarethaGUID)) DoScriptText(SAY_TA_ESCAPED, Taretha, me); } break; @@ -433,7 +433,6 @@ public: //trigger epoch Yell("Thrall! Come outside and face your fate! ....") //from here, thrall should not never be allowed to move to point 106 which he currently does. break; - case 106: { //trigger taretha to run down outside @@ -581,16 +580,16 @@ public: return new npc_tarethaAI(creature); } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); InstanceScript* instance = creature->GetInstanceScript(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_EPOCH2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); player->SEND_GOSSIP_MENU(GOSSIP_ID_EPOCH2, creature->GetGUID()); } - if (uiAction == GOSSIP_ACTION_INFO_DEF+2) + if (action == GOSSIP_ACTION_INFO_DEF+2) { player->CLOSE_GOSSIP_MENU(); @@ -624,16 +623,16 @@ public: struct npc_tarethaAI : public npc_escortAI { - npc_tarethaAI(Creature* c) : npc_escortAI(c) + npc_tarethaAI(Creature* creature) : npc_escortAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { - switch (i) + switch (waypointId) { case 6: DoScriptText(SAY_TA_FREE, me); @@ -643,6 +642,7 @@ public: break; } } + void Reset() {} void EnterCombat(Unit* /*who*/) {} diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp index 38d9ce31563..d7043965271 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp @@ -59,7 +59,7 @@ public: void EnterCombat(Unit* /*who*/) { } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { me->SummonCreature(13716, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 600000); } diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp index 3b42fc3ed7b..6e6e089ba02 100644 --- a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp +++ b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp @@ -114,11 +114,11 @@ public: { boss_onyxiaAI(Creature* creature) : ScriptedAI(creature), Summons(me) { - m_instance = creature->GetInstanceScript(); + instance = creature->GetInstanceScript(); Reset(); } - InstanceScript* m_instance; + InstanceScript* instance; SummonList Summons; uint32 m_uiPhase; @@ -169,11 +169,11 @@ public: m_uiSummonWhelpCount = 0; m_bIsMoving = false; - if (m_instance) + if (instance) { - m_instance->SetData(DATA_ONYXIA, NOT_STARTED); - m_instance->SetData(DATA_ONYXIA_PHASE, m_uiPhase); - m_instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + instance->SetData(DATA_ONYXIA, NOT_STARTED); + instance->SetData(DATA_ONYXIA_PHASE, m_uiPhase); + instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); } } @@ -182,17 +182,17 @@ public: DoScriptText(SAY_AGGRO, me); me->SetInCombatWithZone(); - if (m_instance) + if (instance) { - m_instance->SetData(DATA_ONYXIA, IN_PROGRESS); - m_instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + instance->SetData(DATA_ONYXIA, IN_PROGRESS); + instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); } } void JustDied(Unit* /*killer*/) { - if (m_instance) - m_instance->SetData(DATA_ONYXIA, DONE); + if (instance) + instance->SetData(DATA_ONYXIA, DONE); Summons.DespawnAll(); } @@ -261,12 +261,12 @@ public: m_uiBellowingRoarTimer = 1000; break; case 10: - me->SetFlying(true); + me->SetCanFly(true); me->GetMotionMaster()->MovePoint(11, Phase2Location.GetPositionX(), Phase2Location.GetPositionY(), Phase2Location.GetPositionZ()+25); me->SetSpeed(MOVE_FLIGHT, 1.0f); DoScriptText(SAY_PHASE_2_TRANS, me); - if (m_instance) - m_instance->SetData(DATA_ONYXIA_PHASE, m_uiPhase); + if (instance) + instance->SetData(DATA_ONYXIA_PHASE, m_uiPhase); m_uiWhelpTimer = 5000; m_uiLairGuardTimer = 15000; break; @@ -301,9 +301,9 @@ public: (pSpell->Id >= 22267 && pSpell->Id <= 22268)) && (target->GetTypeId() == TYPEID_PLAYER)) { - if (m_instance) + if (instance) { - m_instance->SetData(DATA_SHE_DEEP_BREATH_MORE, FAIL); + instance->SetData(DATA_SHE_DEEP_BREATH_MORE, FAIL); } } } @@ -362,8 +362,8 @@ public: Trinity::GameObjectInRangeCheck check(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 15); Trinity::GameObjectLastSearcher<Trinity::GameObjectInRangeCheck> searcher(me, pFloor, check); me->VisitNearbyGridObject(30, searcher); - if (m_instance && pFloor) - m_instance->SetData64(DATA_FLOOR_ERUPTION_GUID, pFloor->GetGUID()); + if (instance && pFloor) + instance->SetData64(DATA_FLOOR_ERUPTION_GUID, pFloor->GetGUID()); m_uiBellowingRoarTimer = 30000; } else @@ -409,12 +409,12 @@ public: if (HealthBelowPct(40)) { m_uiPhase = PHASE_END; - if (m_instance) - m_instance->SetData(DATA_ONYXIA_PHASE, m_uiPhase); + if (instance) + instance->SetData(DATA_ONYXIA_PHASE, m_uiPhase); DoScriptText(SAY_PHASE_3_TRANS, me); SetCombatMovement(true); - me->SetFlying(false); + me->SetCanFly(false); m_bIsMoving = false; me->GetMotionMaster()->MovePoint(9, me->GetHomePosition()); return; diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp index d0da864809c..bda5267713d 100644 --- a/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp +++ b/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp @@ -48,7 +48,7 @@ public: struct boss_amnennar_the_coldbringerAI : public ScriptedAI { - boss_amnennar_the_coldbringerAI(Creature* c) : ScriptedAI(c) {} + boss_amnennar_the_coldbringerAI(Creature* creature) : ScriptedAI(creature) {} uint32 AmnenarsWrath_Timer; uint32 FrostBolt_Timer; diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp index ac9bf524e7a..b84ecea4de3 100644 --- a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp +++ b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp @@ -52,16 +52,16 @@ class npc_henry_stern : public CreatureScript public: npc_henry_stern() : CreatureScript("npc_henry_stern") { } - bool OnGossipSelect (Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) + if (action == GOSSIP_ACTION_INFO_DEF + 1) { player->CastSpell(player, SPELL_TEACHING_GOLDTHORN_TEA, true); player->SEND_GOSSIP_MENU(GOSSIP_TEXT_TEA_ANSWER, creature->GetGUID()); } - if (uiAction == GOSSIP_ACTION_INFO_DEF + 2) + if (action == GOSSIP_ACTION_INFO_DEF + 2) { player->CastSpell(player, SPELL_TEACHING_MIGHTY_TROLLS_BLOOD_POTION, true); player->SEND_GOSSIP_MENU(GOSSIP_TEXT_POTION_ANSWER, creature->GetGUID()); @@ -70,7 +70,7 @@ public: return true; } - bool OnGossipHello (Player* player, Creature* creature) + bool OnGossipHello(Player* player, Creature* creature) { if (player->GetBaseSkillValue(SKILL_COOKING) >= 175 && !player->HasSpell(SPELL_GOLDTHORN_TEA)) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TEA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -81,7 +81,6 @@ public: player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); return true; } - }; /*###### @@ -93,10 +92,10 @@ class go_gong : public GameObjectScript public: go_gong() : GameObjectScript("go_gong") { } - bool OnGossipHello(Player* /*player*/, GameObject* pGO) + bool OnGossipHello(Player* /*player*/, GameObject* go) { //basic support, not blizzlike data is missing... - InstanceScript* instance = pGO->GetInstanceScript(); + InstanceScript* instance = go->GetInstanceScript(); if (instance) { diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp index 1bc0a3b7a19..43e3fe6efdd 100644 --- a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp +++ b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp @@ -70,57 +70,56 @@ public: struct npc_willixAI : public npc_escortAI { - npc_willixAI(Creature* c) : npc_escortAI(c) {} + npc_willixAI(Creature* creature) : npc_escortAI(creature) {} - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); - if (!player) return; - switch (i) + switch (waypointId) { - case 3: - me->HandleEmoteCommand(EMOTE_STATE_POINT); - DoScriptText(SAY_POINT, me, player); - break; - case 4: - me->SummonCreature(ENTRY_BOAR, 2137.66f, 1843.98f, 48.08f, 1.54f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - break; - case 8: - DoScriptText(SAY_BLUELEAF, me, player); - break; - case 9: - DoScriptText(SAY_DANGER, me, player); - break; - case 13: - DoScriptText(SAY_BAD, me, player); - break; - case 14: - me->SummonCreature(ENTRY_BOAR, 2078.91f, 1704.54f, 56.77f, 1.54f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - break; - case 25: - DoScriptText(SAY_THINK, me, player); - break; - case 31: - DoScriptText(SAY_SOON, me, player); - break; - case 42: - DoScriptText(SAY_FINALY, me, player); - break; - case 43: - me->SummonCreature(ENTRY_BOAR, 1956.43f, 1596.97f, 81.75f, 1.54f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - break; - case 45: - DoScriptText(SAY_WIN, me, player); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - if (player && player->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(player)->GroupEventHappens(QUEST_WILLIX_THE_IMPORTER, me); - break; - case 46: - DoScriptText(SAY_END, me, player); - break; + case 3: + me->HandleEmoteCommand(EMOTE_STATE_POINT); + DoScriptText(SAY_POINT, me, player); + break; + case 4: + me->SummonCreature(ENTRY_BOAR, 2137.66f, 1843.98f, 48.08f, 1.54f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + break; + case 8: + DoScriptText(SAY_BLUELEAF, me, player); + break; + case 9: + DoScriptText(SAY_DANGER, me, player); + break; + case 13: + DoScriptText(SAY_BAD, me, player); + break; + case 14: + me->SummonCreature(ENTRY_BOAR, 2078.91f, 1704.54f, 56.77f, 1.54f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + break; + case 25: + DoScriptText(SAY_THINK, me, player); + break; + case 31: + DoScriptText(SAY_SOON, me, player); + break; + case 42: + DoScriptText(SAY_FINALY, me, player); + break; + case 43: + me->SummonCreature(ENTRY_BOAR, 1956.43f, 1596.97f, 81.75f, 1.54f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + break; + case 45: + DoScriptText(SAY_WIN, me, player); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + if (player->GetTypeId() == TYPEID_PLAYER) + CAST_PLR(player)->GroupEventHappens(QUEST_WILLIX_THE_IMPORTER, me); + break; + case 46: + DoScriptText(SAY_END, me, player); + break; } } diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp index a290b07e60f..18a77519ba2 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp @@ -147,7 +147,7 @@ class boss_moam : public CreatureScript targetList.push_back((*itr)->getTarget()); } - Trinity::RandomResizeList(targetList, 5); + Trinity::Containers::RandomResizeList(targetList, 5); for (std::list<Unit*>::iterator itr = targetList.begin(); itr != targetList.end(); ++itr) DoCast(*itr, SPELL_DRAIN_MANA); diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp index eaeec50ef7b..36b1871c96e 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp @@ -49,9 +49,9 @@ public: struct boss_kriAI : public ScriptedAI { - boss_kriAI(Creature* c) : ScriptedAI(c) + boss_kriAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -146,9 +146,9 @@ public: struct boss_vemAI : public ScriptedAI { - boss_vemAI(Creature* c) : ScriptedAI(c) + boss_vemAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -168,7 +168,7 @@ public: Enraged = false; } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { if (instance) { @@ -239,9 +239,9 @@ public: struct boss_yaujAI : public ScriptedAI { - boss_yaujAI(Creature* c) : ScriptedAI(c) + boss_yaujAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -261,7 +261,7 @@ public: VemDead = false; } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { if (instance) { @@ -303,8 +303,8 @@ public: { if (instance) { - Unit* pKri = Unit::GetUnit((*me), instance->GetData64(DATA_KRI)); - Unit* pVem = Unit::GetUnit((*me), instance->GetData64(DATA_VEM)); + Unit* pKri = Unit::GetUnit(*me, instance->GetData64(DATA_KRI)); + Unit* pVem = Unit::GetUnit(*me, instance->GetData64(DATA_VEM)); switch (urand(0, 2)) { diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp index a6409ca056f..11efccd14b7 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp @@ -176,9 +176,9 @@ public: struct eye_of_cthunAI : public Scripted_NoMovementAI { - eye_of_cthunAI(Creature* c) : Scripted_NoMovementAI(c) + eye_of_cthunAI(Creature* creature) : Scripted_NoMovementAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); if (!instance) sLog->outError("TSCR: No Instance eye_of_cthunAI"); } @@ -480,11 +480,11 @@ public: struct cthunAI : public Scripted_NoMovementAI { - cthunAI(Creature* c) : Scripted_NoMovementAI(c) + cthunAI(Creature* creature) : Scripted_NoMovementAI(creature) { SetCombatMovement(false); - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); if (!instance) sLog->outError("TSCR: No Instance eye_of_cthunAI"); } @@ -607,7 +607,8 @@ public: if (WisperTimer <= diff) { Map* map = me->GetMap(); - if (!map->IsDungeon()) return; + if (!map->IsDungeon()) + return; //Play random sound to the zone Map::PlayerList const &PlayerList = map->GetPlayers(); @@ -935,7 +936,7 @@ public: struct eye_tentacleAI : public Scripted_NoMovementAI { - eye_tentacleAI(Creature* c) : Scripted_NoMovementAI(c) + eye_tentacleAI(Creature* creature) : Scripted_NoMovementAI(creature) { if (Creature* pPortal = me->SummonCreature(MOB_SMALL_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) { @@ -948,7 +949,7 @@ public: uint32 KillSelfTimer; uint64 Portal; - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { if (Unit* p = Unit::GetUnit(*me, Portal)) p->Kill(p); @@ -1008,7 +1009,7 @@ public: struct claw_tentacleAI : public Scripted_NoMovementAI { - claw_tentacleAI(Creature* c) : Scripted_NoMovementAI(c) + claw_tentacleAI(Creature* creature) : Scripted_NoMovementAI(creature) { SetCombatMovement(false); @@ -1024,7 +1025,7 @@ public: uint32 EvadeTimer; uint64 Portal; - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { if (Unit* p = Unit::GetUnit(*me, Portal)) p->Kill(p); @@ -1118,7 +1119,7 @@ public: struct giant_claw_tentacleAI : public Scripted_NoMovementAI { - giant_claw_tentacleAI(Creature* c) : Scripted_NoMovementAI(c) + giant_claw_tentacleAI(Creature* creature) : Scripted_NoMovementAI(creature) { SetCombatMovement(false); @@ -1135,7 +1136,7 @@ public: uint32 EvadeTimer; uint64 Portal; - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { if (Unit* p = Unit::GetUnit(*me, Portal)) p->Kill(p); @@ -1237,7 +1238,7 @@ public: struct giant_eye_tentacleAI : public Scripted_NoMovementAI { - giant_eye_tentacleAI(Creature* c) : Scripted_NoMovementAI(c) + giant_eye_tentacleAI(Creature* creature) : Scripted_NoMovementAI(creature) { SetCombatMovement(false); @@ -1251,7 +1252,7 @@ public: uint32 BeamTimer; uint64 Portal; - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { if (Unit* p = Unit::GetUnit(*me, Portal)) p->Kill(p); @@ -1301,7 +1302,7 @@ public: struct flesh_tentacleAI : public Scripted_NoMovementAI { - flesh_tentacleAI(Creature* c) : Scripted_NoMovementAI(c) + flesh_tentacleAI(Creature* creature) : Scripted_NoMovementAI(creature) { SetCombatMovement(false); } diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp index 9ccff0bff48..613bc91182b 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp @@ -49,7 +49,7 @@ public: struct boss_fankrissAI : public ScriptedAI { - boss_fankrissAI(Creature* c) : ScriptedAI(c) {} + boss_fankrissAI(Creature* creature) : ScriptedAI(creature) {} uint32 MortalWound_Timer; uint32 SpawnHatchlings_Timer; diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp index c0ccd55f219..53fac3ee3ec 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp @@ -47,7 +47,7 @@ public: struct boss_huhuranAI : public ScriptedAI { - boss_huhuranAI(Creature* c) : ScriptedAI(c) {} + boss_huhuranAI(Creature* creature) : ScriptedAI(creature) {} uint32 Frenzy_Timer; uint32 Wyvern_Timer; diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp index b0e5112aa6b..81205780e7d 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp @@ -45,7 +45,7 @@ public: struct boss_ouroAI : public ScriptedAI { - boss_ouroAI(Creature* c) : ScriptedAI(c) {} + boss_ouroAI(Creature* creature) : ScriptedAI(creature) {} uint32 Sweep_Timer; uint32 SandBlast_Timer; diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp index 4d5aff16770..8c6c0fa0ad0 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp @@ -49,7 +49,7 @@ public: struct boss_sarturaAI : public ScriptedAI { - boss_sarturaAI(Creature* c) : ScriptedAI(c) {} + boss_sarturaAI(Creature* creature) : ScriptedAI(creature) {} uint32 WhirlWind_Timer; uint32 WhirlWindRandom_Timer; @@ -84,7 +84,7 @@ public: DoScriptText(SAY_AGGRO, me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); } @@ -192,7 +192,7 @@ public: struct mob_sartura_royal_guardAI : public ScriptedAI { - mob_sartura_royal_guardAI(Creature* c) : ScriptedAI(c) {} + mob_sartura_royal_guardAI(Creature* creature) : ScriptedAI(creature) {} uint32 WhirlWind_Timer; uint32 WhirlWindRandom_Timer; diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp index 7f3c19ac69c..4df4bf73330 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp @@ -63,7 +63,7 @@ public: struct boss_skeramAI : public ScriptedAI { - boss_skeramAI(Creature* c) : ScriptedAI(c) + boss_skeramAI(Creature* creature) : ScriptedAI(creature) { IsImage = false; } @@ -105,7 +105,7 @@ public: DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2, SAY_SLAY3), me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { if (!IsImage) DoScriptText(SAY_DEATH, me); diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp index b03d2dc3a4a..abaab9d830e 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp @@ -61,9 +61,9 @@ EndScriptData */ struct boss_twinemperorsAI : public ScriptedAI { - boss_twinemperorsAI(Creature* c): ScriptedAI(c) + boss_twinemperorsAI(Creature* creature): ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -120,7 +120,7 @@ struct boss_twinemperorsAI : public ScriptedAI } } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { Creature* pOtherBoss = GetOtherBoss(); if (pOtherBoss) @@ -393,7 +393,7 @@ public: struct boss_veknilashAI : public boss_twinemperorsAI { bool IAmVeklor() {return false;} - boss_veknilashAI(Creature* c) : boss_twinemperorsAI(c) {} + boss_veknilashAI(Creature* creature) : boss_twinemperorsAI(creature) {} uint32 UpperCut_Timer; uint32 UnbalancingStrike_Timer; @@ -479,7 +479,7 @@ public: struct boss_veklorAI : public boss_twinemperorsAI { bool IAmVeklor() {return true;} - boss_veklorAI(Creature* c) : boss_twinemperorsAI(c) {} + boss_veklorAI(Creature* creature) : boss_twinemperorsAI(creature) {} uint32 ShadowBolt_Timer; uint32 Blizzard_Timer; diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp index 38ea8e8748b..f1cc0b401c3 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp @@ -117,7 +117,7 @@ public: return 0; } - uint64 GetData64 (uint32 identifier) + uint64 GetData64(uint32 identifier) { switch (identifier) { diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp index 45e9797328e..556247d85af 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp @@ -86,7 +86,7 @@ public: } } - aqsentinelAI(Creature* c) : ScriptedAI(c) + aqsentinelAI(Creature* creature) : ScriptedAI(creature) { ClearBuddyList(); abselected = 0; // just initialization of variable @@ -242,7 +242,7 @@ public: DoZoneInCombat(); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { for (int ni=0; ni<3; ++ni) { diff --git a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp index 8eb3d20d528..7e93cc7e4c7 100644 --- a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp +++ b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp @@ -85,11 +85,11 @@ public: return new npc_disciple_of_naralexAI(creature); } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); InstanceScript* instance = creature->GetInstanceScript(); - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) + if (action == GOSSIP_ACTION_INFO_DEF + 1) { player->CLOSE_GOSSIP_MENU(); if (instance) @@ -136,9 +136,9 @@ public: struct npc_disciple_of_naralexAI : public npc_escortAI { - npc_disciple_of_naralexAI(Creature* c) : npc_escortAI(c) + npc_disciple_of_naralexAI(Creature* creature) : npc_escortAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); eventTimer = 0; currentEvent = 0; eventProgress = 0; @@ -151,35 +151,35 @@ public: uint32 eventProgress; InstanceScript* instance; - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { if (!instance) return; - switch (i) + switch (waypointId) { case 4: eventProgress = 1; currentEvent = TYPE_NARALEX_PART1; instance->SetData(TYPE_NARALEX_PART1, IN_PROGRESS); - break; + break; case 5: DoScriptText(SAY_MUST_CONTINUE, me); instance->SetData(TYPE_NARALEX_PART1, DONE); - break; + break; case 11: eventProgress = 1; currentEvent = TYPE_NARALEX_PART2; instance->SetData(TYPE_NARALEX_PART2, IN_PROGRESS); - break; + break; case 19: DoScriptText(SAY_BEYOND_THIS_CORRIDOR, me); - break; + break; case 24: eventProgress = 1; currentEvent = TYPE_NARALEX_PART3; instance->SetData(TYPE_NARALEX_PART3, IN_PROGRESS); - break; + break; } } @@ -315,7 +315,7 @@ public: eventTimer = 3000; if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX))) { - AchievementEntry const* AchievWC = GetAchievementStore()->LookupEntry(ACHIEVEMENT_WAILING_CAVERNS); + AchievementEntry const* AchievWC = sAchievementStore.LookupEntry(ACHIEVEMENT_WAILING_CAVERNS); if (AchievWC) { Map* map = me->GetMap(); diff --git a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp index 33a2ce73e21..b6c69584358 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp +++ b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp @@ -301,14 +301,15 @@ public: { if (npc->isAlive()) { - npc->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + npc->SetWalk(true); npc->GetMotionMaster()->MovePoint(1, x, y, z); npc->SetHomePosition(x, y, z, o); } } } - void SpawnPyramidWave(uint32 wave){ + void SpawnPyramidWave(uint32 wave) + { for (int i = 0; i < pyramidSpawnTotal; i++) { if (pyramidSpawns[i][0] == (float)wave) @@ -321,7 +322,8 @@ public: } } - bool IsWaveAllDead(){ + bool IsWaveAllDead() + { for (std::list<uint64>::iterator itr = addsAtBase.begin(); itr != addsAtBase.end(); ++itr) { if (Creature* add = instance->GetCreature((*itr))) diff --git a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp index 61fe526407c..9e3d9240321 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp +++ b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp @@ -61,10 +61,10 @@ class npc_sergeant_bly : public CreatureScript public: npc_sergeant_bly() : CreatureScript("npc_sergeant_bly") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { player->CLOSE_GOSSIP_MENU(); CAST_AI(npc_sergeant_bly::npc_sergeant_blyAI, creature->AI())->PlayerGUID = player->GetGUID(); @@ -199,18 +199,6 @@ public: +## go_troll_cage +######*/ -void initBlyCrewMember(InstanceScript* instance, uint32 entry, float x, float y, float z) -{ - if (Creature* crew = instance->instance->GetCreature(instance->GetData64(entry))) - { - crew->SetReactState(REACT_AGGRESSIVE); - crew->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - crew->SetHomePosition(x, y, z, 0); - crew->GetMotionMaster()->MovePoint(1, x, y, z); - crew->setFaction(FACTION_FREED); - } -} - class go_troll_cage : public GameObjectScript { public: @@ -231,6 +219,18 @@ public: return false; } +private: + void initBlyCrewMember(InstanceScript* instance, uint32 entry, float x, float y, float z) + { + if (Creature* crew = instance->instance->GetCreature(instance->GetData64(entry))) + { + crew->SetReactState(REACT_AGGRESSIVE); + crew->SetWalk(true); + crew->SetHomePosition(x, y, z, 0); + crew->GetMotionMaster()->MovePoint(1, x, y, z); + crew->setFaction(FACTION_FREED); + } + } }; /*###### @@ -258,10 +258,10 @@ class npc_weegli_blastfuse : public CreatureScript public: npc_weegli_blastfuse() : CreatureScript("npc_weegli_blastfuse") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { player->CLOSE_GOSSIP_MENU(); //here we make him run to door, set the charge and run away off to nowhere @@ -322,7 +322,7 @@ public: AttackStartCaster(victim, 10);//keep back & toss bombs/shoot } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { /*if (instance) instance->SetData(0, DONE);*/ @@ -399,9 +399,9 @@ public: enum { - ZOMBIE = 7286, - DEAD_HERO = 7276, - ZOMBIE_CHANCE = 65, + ZOMBIE = 7286, + DEAD_HERO = 7276, + ZOMBIE_CHANCE = 65, DEAD_HERO_CHANCE = 10 }; @@ -419,13 +419,12 @@ public: if (randomchance < ZOMBIE_CHANCE) go->SummonCreature(ZOMBIE, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); else - if ((randomchance-ZOMBIE_CHANCE) < DEAD_HERO_CHANCE) + if ((randomchance - ZOMBIE_CHANCE) < DEAD_HERO_CHANCE) go->SummonCreature(DEAD_HERO, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); } go->AddUse(); return false; } - }; /*###### diff --git a/src/server/scripts/Kalimdor/ashenvale.cpp b/src/server/scripts/Kalimdor/ashenvale.cpp index 5d26653a1a8..e28665c038e 100644 --- a/src/server/scripts/Kalimdor/ashenvale.cpp +++ b/src/server/scripts/Kalimdor/ashenvale.cpp @@ -28,7 +28,8 @@ npc_torek npc_ruul_snowhoof EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" /*#### @@ -76,36 +77,33 @@ class npc_torek : public CreatureScript uint32 Thunderclap_Timer; bool Completed; - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { - Player* player = GetPlayerForEscort(); - - if (!player) - return; - - switch (i) + if (Player* player = GetPlayerForEscort()) { - case 1: - Talk(SAY_MOVE, player->GetGUID()); - break; - case 8: - Talk(SAY_PREPARE, player->GetGUID()); - break; - case 19: - //TODO: verify location and creatures amount. - me->SummonCreature(ENTRY_DURIEL, 1776.73f, -2049.06f, 109.83f, 1.54f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(ENTRY_SILVERWING_SENTINEL, 1774.64f, -2049.41f, 109.83f, 1.40f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(ENTRY_SILVERWING_WARRIOR, 1778.73f, -2049.50f, 109.83f, 1.67f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - break; - case 20: - DoScriptText(SAY_WIN, me, player); - Completed = true; - if (player) - player->GroupEventHappens(QUEST_TOREK_ASSULT, me); - break; - case 21: - Talk(SAY_END, player->GetGUID()); - break; + switch (waypointId) + { + case 1: + Talk(SAY_MOVE, player->GetGUID()); + break; + case 8: + Talk(SAY_PREPARE, player->GetGUID()); + break; + case 19: + //TODO: verify location and creatures amount. + me->SummonCreature(ENTRY_DURIEL, 1776.73f, -2049.06f, 109.83f, 1.54f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(ENTRY_SILVERWING_SENTINEL, 1774.64f, -2049.41f, 109.83f, 1.40f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(ENTRY_SILVERWING_WARRIOR, 1778.73f, -2049.50f, 109.83f, 1.67f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + break; + case 20: + DoScriptText(SAY_WIN, me, player); + Completed = true; + player->GroupEventHappens(QUEST_TOREK_ASSULT, me); + break; + case 21: + Talk(SAY_END, player->GetGUID()); + break; + } } } @@ -171,53 +169,62 @@ class npc_torek : public CreatureScript # npc_ruul_snowhoof ####*/ -#define QUEST_FREEDOM_TO_RUUL 6482 -#define GO_CAGE 178147 +enum RuulSnowhoof +{ + NPC_THISTLEFUR_URSA = 3921, + NPC_THISTLEFUR_TOTEMIC = 3922, + NPC_THISTLEFUR_PATHFINDER = 3926, + + QUEST_FREEDOM_TO_RUUL = 6482, + + GO_CAGE = 178147 +}; + +Position const RuulSnowhoofSummonsCoord[6] = +{ + {3449.218018f, -587.825073f, 174.978867f, 4.714445f}, + {3446.384521f, -587.830872f, 175.186279f, 4.714445f}, + {3444.218994f, -587.835327f, 175.380600f, 4.714445f}, + {3508.344482f, -492.024261f, 186.929031f, 4.145029f}, + {3506.265625f, -490.531006f, 186.740128f, 4.239277f}, + {3503.682373f, -489.393799f, 186.629684f, 4.349232f} +}; class npc_ruul_snowhoof : public CreatureScript { public: - - npc_ruul_snowhoof() - : CreatureScript("npc_ruul_snowhoof") - { - } + npc_ruul_snowhoof() : CreatureScript("npc_ruul_snowhoof") { } struct npc_ruul_snowhoofAI : public npc_escortAI { - npc_ruul_snowhoofAI(Creature* c) : npc_escortAI(c) {} + npc_ruul_snowhoofAI(Creature* creature) : npc_escortAI(creature) { } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); - if (!player) return; - switch (i) + switch (waypointId) { - case 0: { + case 0: me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20); - if (Cage) + if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20)) Cage->SetGoState(GO_STATE_ACTIVE); - break;} - case 13: - me->SummonCreature(3922, 3449.218018f, -587.825073f, 174.978867f, 4.714445f, TEMPSUMMON_DEAD_DESPAWN, 60000); - me->SummonCreature(3921, 3446.384521f, -587.830872f, 175.186279f, 4.714445f, TEMPSUMMON_DEAD_DESPAWN, 60000); - me->SummonCreature(3926, 3444.218994f, -587.835327f, 175.380600f, 4.714445f, TEMPSUMMON_DEAD_DESPAWN, 60000); break; - case 19: - me->SummonCreature(3922, 3508.344482f, -492.024261f, 186.929031f, 4.145029f, TEMPSUMMON_DEAD_DESPAWN, 60000); - me->SummonCreature(3921, 3506.265625f, -490.531006f, 186.740128f, 4.239277f, TEMPSUMMON_DEAD_DESPAWN, 60000); - me->SummonCreature(3926, 3503.682373f, -489.393799f, 186.629684f, 4.349232f, TEMPSUMMON_DEAD_DESPAWN, 60000); + case 13: + me->SummonCreature(NPC_THISTLEFUR_TOTEMIC, RuulSnowhoofSummonsCoord[0], TEMPSUMMON_DEAD_DESPAWN, 60000); + me->SummonCreature(NPC_THISTLEFUR_URSA, RuulSnowhoofSummonsCoord[1], TEMPSUMMON_DEAD_DESPAWN, 60000); + me->SummonCreature(NPC_THISTLEFUR_PATHFINDER, RuulSnowhoofSummonsCoord[2], TEMPSUMMON_DEAD_DESPAWN, 60000); + break; + case 19: + me->SummonCreature(NPC_THISTLEFUR_TOTEMIC, RuulSnowhoofSummonsCoord[3], TEMPSUMMON_DEAD_DESPAWN, 60000); + me->SummonCreature(NPC_THISTLEFUR_URSA, RuulSnowhoofSummonsCoord[4], TEMPSUMMON_DEAD_DESPAWN, 60000); + me->SummonCreature(NPC_THISTLEFUR_PATHFINDER, RuulSnowhoofSummonsCoord[5], TEMPSUMMON_DEAD_DESPAWN, 60000); + break; + case 21: + player->GroupEventHappens(QUEST_FREEDOM_TO_RUUL, me); break; - - case 21:{ - if (player) - player->GroupEventHappens(QUEST_FREEDOM_TO_RUUL, me); - - break; } } } @@ -225,8 +232,7 @@ class npc_ruul_snowhoof : public CreatureScript void Reset() { - GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20); - if (Cage) + if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20)) Cage->SetGoState(GO_STATE_READY); } @@ -260,7 +266,7 @@ class npc_ruul_snowhoof : public CreatureScript } }; -enum eEnums +enum Muglash { SAY_MUG_START1 = -1800054, SAY_MUG_START2 = -1800055, @@ -289,21 +295,21 @@ enum eEnums NPC_MUGLASH = 12717 }; -static float m_afFirstNagaCoord[3][3]= +Position const FirstNagaCoord[3] = { - {3603.504150f, 1122.631104f, 1.635f}, // rider - {3589.293945f, 1148.664063f, 5.565f}, // sorceress - {3609.925537f, 1168.759521f, -1.168f} // razortail + {3603.504150f, 1122.631104f, 1.635f, 0.0f}, // rider + {3589.293945f, 1148.664063f, 5.565f, 0.0f}, // sorceress + {3609.925537f, 1168.759521f, -1.168f, 0.0f} // razortail }; -static float m_afSecondNagaCoord[3][3]= +Position const SecondNagaCoord[3] = { - {3609.925537f, 1168.759521f, -1.168f}, // witch - {3645.652100f, 1139.425415f, 1.322f}, // priest - {3583.602051f, 1128.405762f, 2.347f} // myrmidon + {3609.925537f, 1168.759521f, -1.168f, 0.0f}, // witch + {3645.652100f, 1139.425415f, 1.322f, 0.0f}, // priest + {3583.602051f, 1128.405762f, 2.347f, 0.0f} // myrmidon }; -static float m_fVorshaCoord[]={3633.056885f, 1172.924072f, -5.388f}; +Position const VorshaCoord = {3633.056885f, 1172.924072f, -5.388f, 0.0f}; class npc_muglash : public CreatureScript { @@ -314,47 +320,44 @@ class npc_muglash : public CreatureScript { npc_muglashAI(Creature* creature) : npc_escortAI(creature) { } - uint32 m_uiWaveId; - uint32 m_uiEventTimer; - bool m_bIsBrazierExtinguished; + uint8 WaveId; + uint32 EventTimer; + bool IsBrazierExtinguished; void JustSummoned(Creature* summoned) { summoned->AI()->AttackStart(me); } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { - Player* player = GetPlayerForEscort(); - - switch (i) + if (Player* player = GetPlayerForEscort()) { - case 0: - if (player) + switch (waypointId) + { + case 0: DoScriptText(SAY_MUG_START2, me, player); - break; - case 24: - if (player) + break; + case 24: DoScriptText(SAY_MUG_BRAZIER, me, player); - if (GameObject* go = GetClosestGameObjectWithEntry(me, GO_NAGA_BRAZIER, INTERACTION_DISTANCE*2)) - { - go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - SetEscortPaused(true); - } - break; - case 25: - DoScriptText(SAY_MUG_GRATITUDE, me); - - if (player) + if (GameObject* go = GetClosestGameObjectWithEntry(me, GO_NAGA_BRAZIER, INTERACTION_DISTANCE*2)) + { + go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + SetEscortPaused(true); + } + break; + case 25: + DoScriptText(SAY_MUG_GRATITUDE, me); player->GroupEventHappens(QUEST_VORSHA, me); - break; - case 26: - DoScriptText(SAY_MUG_PATROL, me); - break; - case 27: - DoScriptText(SAY_MUG_RETURN, me); - break; + break; + case 26: + DoScriptText(SAY_MUG_PATROL, me); + break; + case 27: + DoScriptText(SAY_MUG_RETURN, me); + break; + } } } @@ -371,39 +374,34 @@ class npc_muglash : public CreatureScript void Reset() { - m_uiEventTimer = 10000; - m_uiWaveId = 0; - m_bIsBrazierExtinguished = false; + EventTimer = 10000; + WaveId = 0; + IsBrazierExtinguished = false; } void JustDied(Unit* /*killer*/) { - Player* player = GetPlayerForEscort(); if (HasEscortState(STATE_ESCORT_ESCORTING)) - { - if (player) - { + if (Player* player = GetPlayerForEscort()) player->FailQuest(QUEST_VORSHA); - } - } } void DoWaveSummon() { - switch (m_uiWaveId) + switch (WaveId) { case 1: - me->SummonCreature(NPC_WRATH_RIDER, m_afFirstNagaCoord[0][0], m_afFirstNagaCoord[0][1], m_afFirstNagaCoord[0][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); - me->SummonCreature(NPC_WRATH_SORCERESS, m_afFirstNagaCoord[1][0], m_afFirstNagaCoord[1][1], m_afFirstNagaCoord[1][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); - me->SummonCreature(NPC_WRATH_RAZORTAIL, m_afFirstNagaCoord[2][0], m_afFirstNagaCoord[2][1], m_afFirstNagaCoord[2][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + me->SummonCreature(NPC_WRATH_RIDER, FirstNagaCoord[0], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + me->SummonCreature(NPC_WRATH_SORCERESS, FirstNagaCoord[1], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + me->SummonCreature(NPC_WRATH_RAZORTAIL, FirstNagaCoord[2], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; case 2: - me->SummonCreature(NPC_WRATH_PRIESTESS, m_afSecondNagaCoord[0][0], m_afSecondNagaCoord[0][1], m_afSecondNagaCoord[0][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); - me->SummonCreature(NPC_WRATH_MYRMIDON, m_afSecondNagaCoord[1][0], m_afSecondNagaCoord[1][1], m_afSecondNagaCoord[1][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); - me->SummonCreature(NPC_WRATH_SEAWITCH, m_afSecondNagaCoord[2][0], m_afSecondNagaCoord[2][1], m_afSecondNagaCoord[2][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + me->SummonCreature(NPC_WRATH_PRIESTESS, SecondNagaCoord[0], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + me->SummonCreature(NPC_WRATH_MYRMIDON, SecondNagaCoord[1], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + me->SummonCreature(NPC_WRATH_SEAWITCH, SecondNagaCoord[2], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; case 3: - me->SummonCreature(NPC_VORSHA, m_fVorshaCoord[0], m_fVorshaCoord[1], m_fVorshaCoord[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + me->SummonCreature(NPC_VORSHA, VorshaCoord, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; case 4: SetEscortPaused(false); @@ -418,16 +416,16 @@ class npc_muglash : public CreatureScript if (!me->getVictim()) { - if (HasEscortState(STATE_ESCORT_PAUSED) && m_bIsBrazierExtinguished) + if (HasEscortState(STATE_ESCORT_PAUSED) && IsBrazierExtinguished) { - if (m_uiEventTimer < uiDiff) + if (EventTimer < uiDiff) { - ++m_uiWaveId; + ++WaveId; DoWaveSummon(); - m_uiEventTimer = 10000; + EventTimer = 10000; } else - m_uiEventTimer -= uiDiff; + EventTimer -= uiDiff; } return; } @@ -459,11 +457,7 @@ class npc_muglash : public CreatureScript class go_naga_brazier : public GameObjectScript { public: - - go_naga_brazier() - : GameObjectScript("go_naga_brazier") - { - } + go_naga_brazier() : GameObjectScript("go_naga_brazier") { } bool OnGossipHello(Player* /*player*/, GameObject* go) { @@ -473,7 +467,7 @@ class go_naga_brazier : public GameObjectScript { DoScriptText(SAY_MUG_BRAZIER_WAIT, creature); - pEscortAI->m_bIsBrazierExtinguished = true; + pEscortAI->IsBrazierExtinguished = true; return false; } } diff --git a/src/server/scripts/Kalimdor/azshara.cpp b/src/server/scripts/Kalimdor/azshara.cpp index 2e621c4a3ba..eae5baa8db2 100644 --- a/src/server/scripts/Kalimdor/azshara.cpp +++ b/src/server/scripts/Kalimdor/azshara.cpp @@ -30,9 +30,9 @@ mob_rizzle_sprysprocket mob_depth_charge EndContentData */ -#include "ScriptPCH.h" -#include "World.h" -#include "WorldPacket.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /*###### ## mobs_spitelashes @@ -50,7 +50,7 @@ public: struct mobs_spitelashesAI : public ScriptedAI { - mobs_spitelashesAI(Creature* c) : ScriptedAI(c) {} + mobs_spitelashesAI(Creature* creature) : ScriptedAI(creature) {} uint32 morphtimer; bool spellhit; @@ -120,10 +120,10 @@ class npc_loramus_thalipedes : public CreatureScript public: npc_loramus_thalipedes() : CreatureScript("npc_loramus_thalipedes") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: player->CLOSE_GOSSIP_MENU(); @@ -179,9 +179,12 @@ public: # mob_rizzle_sprysprocket ####*/ -enum eRizzleSprysprocketData +enum RizzleSprysprocketData { + QUEST_CHASING_THE_MOONSTONE = 10994, + MOB_DEPTH_CHARGE = 23025, + SPELL_RIZZLE_BLACKJACK = 39865, SPELL_RIZZLE_ESCAPE = 39871, SPELL_RIZZLE_FROST_GRENADE = 40525, @@ -199,67 +202,66 @@ enum eRizzleSprysprocketData #define GOSSIP_GET_MOONSTONE "Hand over the Southfury moonstone and I'll let you go." -float WPs[58][4] = +Position const WPs[58] = { -//pos_x pos_y pos_z orien -{3691.97f, -3962.41f, 35.9118f, 3.67f}, -{3675.02f, -3960.49f, 35.9118f, 3.67f}, -{3653.19f, -3958.33f, 33.9118f, 3.59f}, -{3621.12f, -3958.51f, 29.9118f, 3.48f}, -{3604.86f, -3963, 29.9118f, 3.48f}, -{3569.94f, -3970.25f, 29.9118f, 3.44f}, -{3541.03f, -3975.64f, 29.9118f, 3.41f}, -{3510.84f, -3978.71f, 29.9118f, 3.41f}, -{3472.7f, -3997.07f, 29.9118f, 3.35f}, -{3439.15f, -4014.55f, 29.9118f, 3.29f}, -{3412.8f, -4025.87f, 29.9118f, 3.25f}, -{3384.95f, -4038.04f, 29.9118f, 3.24f}, -{3346.77f, -4052.93f, 29.9118f, 3.22f}, -{3299.56f, -4071.59f, 29.9118f, 3.20f}, -{3261.22f, -4080.38f, 30.9118f, 3.19f}, -{3220.68f, -4083.09f, 31.9118f, 3.18f}, -{3187.11f, -4070.45f, 33.9118f, 3.16f}, -{3162.78f, -4062.75f, 33.9118f, 3.15f}, -{3136.09f, -4050.32f, 33.9118f, 3.07f}, -{3119.47f, -4044.51f, 36.0363f, 3.07f}, -{3098.95f, -4019.8f, 33.9118f, 3.07f}, -{3073.07f, -4011.42f, 33.9118f, 3.07f}, -{3051.71f, -3993.37f, 33.9118f, 3.02f}, -{3027.52f, -3978.6f, 33.9118f, 3.00f}, -{3003.78f, -3960.14f, 33.9118f, 2.98f}, -{2977.99f, -3941.98f, 31.9118f, 2.96f}, -{2964.57f, -3932.07f, 30.9118f, 2.96f}, -{2947.9f, -3921.31f, 29.9118f, 2.96f}, -{2924.91f, -3910.8f, 29.9118f, 2.94f}, -{2903.04f, -3896.42f, 29.9118f, 2.93f}, -{2884.75f, -3874.03f, 29.9118f, 2.90f}, -{2868.19f, -3851.48f, 29.9118f, 2.82f}, -{2854.62f, -3819.72f, 29.9118f, 2.80f}, -{2825.53f, -3790.4f, 29.9118f, 2.744f}, -{2804.31f, -3773.05f, 29.9118f, 2.71f}, -{2769.78f, -3763.57f, 29.9118f, 2.70f}, -{2727.23f, -3745.92f, 30.9118f, 2.69f}, -{2680.12f, -3737.49f, 30.9118f, 2.67f}, -{2647.62f, -3739.94f, 30.9118f, 2.66f}, -{2616.6f, -3745.75f, 30.9118f, 2.64f}, -{2589.38f, -3731.97f, 30.9118f, 2.61f}, -{2562.94f, -3722.35f, 31.9118f, 2.56f}, -{2521.05f, -3716.6f, 31.9118f, 2.55f}, -{2485.26f, -3706.67f, 31.9118f, 2.51f}, -{2458.93f, -3696.67f, 31.9118f, 2.51f}, -{2432, -3692.03f, 31.9118f, 2.46f}, -{2399.59f, -3681.97f, 31.9118f, 2.45f}, -{2357.75f, -3666.6f, 31.9118f, 2.44f}, -{2311.99f, -3656.88f, 31.9118f, 2.94f}, -{2263.41f, -3649.55f, 31.9118f, 3.02f}, -{2209.05f, -3641.76f, 31.9118f, 2.99f}, -{2164.83f, -3637.64f, 31.9118f, 3.15f}, -{2122.42f, -3639, 31.9118f, 3.21f}, -{2075.73f, -3643.59f, 31.9118f, 3.22f}, -{2033.59f, -3649.52f, 31.9118f, 3.42f}, -{1985.22f, -3662.99f, 31.9118f, 3.42f}, -{1927.09f, -3679.56f, 33.9118f, 3.42f}, -{1873.57f, -3695.32f, 33.9118f, 3.44f} + {3691.97f, -3962.41f, 35.9118f, 3.67f}, + {3675.02f, -3960.49f, 35.9118f, 3.67f}, + {3653.19f, -3958.33f, 33.9118f, 3.59f}, + {3621.12f, -3958.51f, 29.9118f, 3.48f}, + {3604.86f, -3963, 29.9118f, 3.48f}, + {3569.94f, -3970.25f, 29.9118f, 3.44f}, + {3541.03f, -3975.64f, 29.9118f, 3.41f}, + {3510.84f, -3978.71f, 29.9118f, 3.41f}, + {3472.7f, -3997.07f, 29.9118f, 3.35f}, + {3439.15f, -4014.55f, 29.9118f, 3.29f}, + {3412.8f, -4025.87f, 29.9118f, 3.25f}, + {3384.95f, -4038.04f, 29.9118f, 3.24f}, + {3346.77f, -4052.93f, 29.9118f, 3.22f}, + {3299.56f, -4071.59f, 29.9118f, 3.20f}, + {3261.22f, -4080.38f, 30.9118f, 3.19f}, + {3220.68f, -4083.09f, 31.9118f, 3.18f}, + {3187.11f, -4070.45f, 33.9118f, 3.16f}, + {3162.78f, -4062.75f, 33.9118f, 3.15f}, + {3136.09f, -4050.32f, 33.9118f, 3.07f}, + {3119.47f, -4044.51f, 36.0363f, 3.07f}, + {3098.95f, -4019.8f, 33.9118f, 3.07f}, + {3073.07f, -4011.42f, 33.9118f, 3.07f}, + {3051.71f, -3993.37f, 33.9118f, 3.02f}, + {3027.52f, -3978.6f, 33.9118f, 3.00f}, + {3003.78f, -3960.14f, 33.9118f, 2.98f}, + {2977.99f, -3941.98f, 31.9118f, 2.96f}, + {2964.57f, -3932.07f, 30.9118f, 2.96f}, + {2947.9f, -3921.31f, 29.9118f, 2.96f}, + {2924.91f, -3910.8f, 29.9118f, 2.94f}, + {2903.04f, -3896.42f, 29.9118f, 2.93f}, + {2884.75f, -3874.03f, 29.9118f, 2.90f}, + {2868.19f, -3851.48f, 29.9118f, 2.82f}, + {2854.62f, -3819.72f, 29.9118f, 2.80f}, + {2825.53f, -3790.4f, 29.9118f, 2.744f}, + {2804.31f, -3773.05f, 29.9118f, 2.71f}, + {2769.78f, -3763.57f, 29.9118f, 2.70f}, + {2727.23f, -3745.92f, 30.9118f, 2.69f}, + {2680.12f, -3737.49f, 30.9118f, 2.67f}, + {2647.62f, -3739.94f, 30.9118f, 2.66f}, + {2616.6f, -3745.75f, 30.9118f, 2.64f}, + {2589.38f, -3731.97f, 30.9118f, 2.61f}, + {2562.94f, -3722.35f, 31.9118f, 2.56f}, + {2521.05f, -3716.6f, 31.9118f, 2.55f}, + {2485.26f, -3706.67f, 31.9118f, 2.51f}, + {2458.93f, -3696.67f, 31.9118f, 2.51f}, + {2432, -3692.03f, 31.9118f, 2.46f}, + {2399.59f, -3681.97f, 31.9118f, 2.45f}, + {2357.75f, -3666.6f, 31.9118f, 2.44f}, + {2311.99f, -3656.88f, 31.9118f, 2.94f}, + {2263.41f, -3649.55f, 31.9118f, 3.02f}, + {2209.05f, -3641.76f, 31.9118f, 2.99f}, + {2164.83f, -3637.64f, 31.9118f, 3.15f}, + {2122.42f, -3639, 31.9118f, 3.21f}, + {2075.73f, -3643.59f, 31.9118f, 3.22f}, + {2033.59f, -3649.52f, 31.9118f, 3.42f}, + {1985.22f, -3662.99f, 31.9118f, 3.42f}, + {1927.09f, -3679.56f, 33.9118f, 3.42f}, + {1873.57f, -3695.32f, 33.9118f, 3.44f} }; class mob_rizzle_sprysprocket : public CreatureScript @@ -267,22 +269,22 @@ class mob_rizzle_sprysprocket : public CreatureScript public: mob_rizzle_sprysprocket() : CreatureScript("mob_rizzle_sprysprocket") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1 && player->GetQuestStatus(10994) == QUEST_STATUS_INCOMPLETE) + if (action == GOSSIP_ACTION_INFO_DEF + 1 && player->GetQuestStatus(QUEST_CHASING_THE_MOONSTONE) == QUEST_STATUS_INCOMPLETE) { player->CLOSE_GOSSIP_MENU(); creature->CastSpell(player, SPELL_GIVE_SOUTHFURY_MOONSTONE, true); - CAST_AI(mob_rizzle_sprysprocket::mob_rizzle_sprysprocketAI, creature->AI())->Must_Die_Timer = 3000; - CAST_AI(mob_rizzle_sprysprocket::mob_rizzle_sprysprocketAI, creature->AI())->Must_Die = true; + CAST_AI(mob_rizzle_sprysprocket::mob_rizzle_sprysprocketAI, creature->AI())->MustDieTimer = 3000; + CAST_AI(mob_rizzle_sprysprocket::mob_rizzle_sprysprocketAI, creature->AI())->MustDie = true; } return true; } bool OnGossipHello(Player* player, Creature* creature) { - if (player->GetQuestStatus(10994) != QUEST_STATUS_INCOMPLETE) + if (player->GetQuestStatus(QUEST_CHASING_THE_MOONSTONE) != QUEST_STATUS_INCOMPLETE) return true; player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_GET_MOONSTONE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); player->SEND_GOSSIP_MENU(10811, creature->GetGUID()); @@ -296,34 +298,34 @@ public: struct mob_rizzle_sprysprocketAI : public ScriptedAI { - mob_rizzle_sprysprocketAI(Creature* c) : ScriptedAI(c) {} + mob_rizzle_sprysprocketAI(Creature* creature) : ScriptedAI(creature) {} - uint32 spellEscape_Timer; - uint32 Teleport_Timer; - uint32 Check_Timer; - uint32 Grenade_Timer; - uint32 Must_Die_Timer; + uint32 SpellEscapeTimer; + uint32 TeleportTimer; + uint32 CheckTimer; + uint32 GrenadeTimer; + uint32 MustDieTimer; uint32 CurrWP; uint64 PlayerGUID; - bool Must_Die; + bool MustDie; bool Escape; bool ContinueWP; bool Reached; void Reset() { - spellEscape_Timer = 1300; - Teleport_Timer = 3500; - Check_Timer = 10000; - Grenade_Timer = 30000; - Must_Die_Timer = 3000; + SpellEscapeTimer = 1300; + TeleportTimer = 3500; + CheckTimer = 10000; + GrenadeTimer = 30000; + MustDieTimer = 3000; CurrWP = 0; PlayerGUID = 0; - Must_Die = false; + MustDie = false; Escape = false; ContinueWP = false; Reached = false; @@ -331,13 +333,13 @@ public: void UpdateAI(const uint32 diff) { - if (Must_Die) + if (MustDie) { - if (Must_Die_Timer <= diff) + if (MustDieTimer <= diff) { me->DespawnOrUnsummon(); return; - } else Must_Die_Timer -= diff; + } else MustDieTimer -= diff; } if (!Escape) @@ -345,17 +347,16 @@ public: if (!PlayerGUID) return; - if (spellEscape_Timer <= diff) + if (SpellEscapeTimer <= diff) { DoCast(me, SPELL_RIZZLE_ESCAPE, false); - spellEscape_Timer = 10000; - } else spellEscape_Timer -= diff; + SpellEscapeTimer = 10000; + } else SpellEscapeTimer -= diff; - if (Teleport_Timer <= diff) + if (TeleportTimer <= diff) { //temp solution - unit can't be teleported by core using spelleffect 5, only players - Map* map = me->GetMap(); - if (map) + if (me->GetMap()) { me->SetPosition(3706.39f, -3969.15f, 35.9118f, 0); me->AI_SendMoveToPacket(3706.39f, -3969.15f, 35.9118f, 0, 0, 0); @@ -367,20 +368,20 @@ public: me->SetUnitMovementFlags(MOVEMENTFLAG_HOVER | MOVEMENTFLAG_SWIMMING); me->SetSpeed(MOVE_RUN, 0.85f, true); me->GetMotionMaster()->MovementExpired(); - me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP][0], WPs[CurrWP][1], WPs[CurrWP][2]); + me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP]); Escape = true; - } else Teleport_Timer -= diff; + } else TeleportTimer -= diff; return; } if (ContinueWP) { - me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP][0], WPs[CurrWP][1], WPs[CurrWP][2]); + me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP]); ContinueWP = false; } - if (Grenade_Timer <= diff) + if (GrenadeTimer <= diff) { Player* player = Unit::GetPlayer(*me, PlayerGUID); if (player) @@ -388,10 +389,10 @@ public: DoScriptText(SAY_RIZZLE_GRENADE, me, player); DoCast(player, SPELL_RIZZLE_FROST_GRENADE, true); } - Grenade_Timer = 30000; - } else Grenade_Timer -= diff; + GrenadeTimer = 30000; + } else GrenadeTimer -= diff; - if (Check_Timer <= diff) + if (CheckTimer <= diff) { Player* player = Unit::GetPlayer(*me, PlayerGUID); if (!player) @@ -410,8 +411,8 @@ public: Reached = true; } - Check_Timer = 1000; - } else Check_Timer -= diff; + CheckTimer = 1000; + } else CheckTimer -= diff; } @@ -427,7 +428,7 @@ public: if (!who || PlayerGUID) return; - if (who->GetTypeId() == TYPEID_PLAYER && CAST_PLR(who)->GetQuestStatus(10994) == QUEST_STATUS_INCOMPLETE) + if (who->GetTypeId() == TYPEID_PLAYER && CAST_PLR(who)->GetQuestStatus(QUEST_CHASING_THE_MOONSTONE) == QUEST_STATUS_INCOMPLETE) { PlayerGUID = who->GetGUID(); DoScriptText(SAY_RIZZLE_START, me); @@ -470,27 +471,27 @@ public: struct mob_depth_chargeAI : public ScriptedAI { - mob_depth_chargeAI(Creature* c) : ScriptedAI(c) {} + mob_depth_chargeAI(Creature* creature) : ScriptedAI(creature) {} - bool we_must_die; - uint32 must_die_timer; + bool WeMustDie; + uint32 WeMustDieTimer; void Reset() { me->SetUnitMovementFlags(MOVEMENTFLAG_HOVER | MOVEMENTFLAG_SWIMMING); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - we_must_die = false; - must_die_timer = 1000; + WeMustDie = false; + WeMustDieTimer = 1000; } void UpdateAI(const uint32 diff) { - if (we_must_die) + if (WeMustDie) { - if (must_die_timer <= diff) - { + if (WeMustDieTimer <= diff) me->DespawnOrUnsummon(); - } else must_die_timer -= diff; + else + WeMustDieTimer -= diff; } return; } @@ -503,20 +504,15 @@ public: if (who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 5)) { DoCast(who, SPELL_DEPTH_CHARGE_TRAP); - we_must_die = true; + WeMustDie = true; return; } } - void AttackStart(Unit* /*who*/) - { - } + void AttackStart(Unit* /*who*/) {} - void EnterCombat(Unit* /*who*/) - { - } + void EnterCombat(Unit* /*who*/) {} }; - }; void AddSC_azshara() diff --git a/src/server/scripts/Kalimdor/azuremyst_isle.cpp b/src/server/scripts/Kalimdor/azuremyst_isle.cpp index 09f4b9415a9..608117ca9af 100644 --- a/src/server/scripts/Kalimdor/azuremyst_isle.cpp +++ b/src/server/scripts/Kalimdor/azuremyst_isle.cpp @@ -33,15 +33,19 @@ go_ravager_cage npc_death_ravager EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" -#include <cmath> +#include "ScriptedGossip.h" +#include "Cell.h" +#include "CellImpl.h" +#include "GridNotifiers.h" /*###### ## npc_draenei_survivor ######*/ -enum eEnums +enum draeneiSurvivor { SAY_HEAL1 = -1000176, SAY_HEAL2 = -1000177, @@ -69,7 +73,7 @@ public: struct npc_draenei_survivorAI : public ScriptedAI { - npc_draenei_survivorAI(Creature* c) : ScriptedAI(c) {} + npc_draenei_survivorAI(Creature* creature) : ScriptedAI(creature) {} uint64 pCaster; @@ -175,7 +179,7 @@ public: ## npc_engineer_spark_overgrind ######*/ -enum eOvergrind +enum Overgrind { SAY_TEXT = -1000184, SAY_EMOTE = -1000185, @@ -195,10 +199,10 @@ class npc_engineer_spark_overgrind : public CreatureScript public: npc_engineer_spark_overgrind() : CreatureScript("npc_engineer_spark_overgrind") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF) + if (action == GOSSIP_ACTION_INFO_DEF) { player->CLOSE_GOSSIP_MENU(); creature->setFaction(FACTION_HOSTILE); @@ -223,27 +227,27 @@ public: struct npc_engineer_spark_overgrindAI : public ScriptedAI { - npc_engineer_spark_overgrindAI(Creature* c) : ScriptedAI(c) + npc_engineer_spark_overgrindAI(Creature* creature) : ScriptedAI(creature) { - NormFaction = c->getFaction(); - NpcFlags = c->GetUInt32Value(UNIT_NPC_FLAGS); + NormFaction = creature->getFaction(); + NpcFlags = creature->GetUInt32Value(UNIT_NPC_FLAGS); - if (c->GetAreaId() == AREA_COVE || c->GetAreaId() == AREA_ISLE) + if (creature->GetAreaId() == AREA_COVE || creature->GetAreaId() == AREA_ISLE) IsTreeEvent = true; } uint32 NormFaction; uint32 NpcFlags; - uint32 Dynamite_Timer; - uint32 Emote_Timer; + uint32 DynamiteTimer; + uint32 EmoteTimer; bool IsTreeEvent; void Reset() { - Dynamite_Timer = 8000; - Emote_Timer = urand(120000, 150000); + DynamiteTimer = 8000; + EmoteTimer = urand(120000, 150000); me->setFaction(NormFaction); me->SetUInt32Value(UNIT_NPC_FLAGS, NpcFlags); @@ -260,12 +264,12 @@ public: { if (!me->isInCombat() && !IsTreeEvent) { - if (Emote_Timer <= diff) + if (EmoteTimer <= diff) { DoScriptText(SAY_TEXT, me); DoScriptText(SAY_EMOTE, me); - Emote_Timer = urand(120000, 150000); - } else Emote_Timer -= diff; + EmoteTimer = urand(120000, 150000); + } else EmoteTimer -= diff; } else if (IsTreeEvent) return; @@ -273,11 +277,11 @@ public: if (!UpdateVictim()) return; - if (Dynamite_Timer <= diff) + if (DynamiteTimer <= diff) { DoCast(me->getVictim(), SPELL_DYNAMITE); - Dynamite_Timer = 8000; - } else Dynamite_Timer -= diff; + DynamiteTimer = 8000; + } else DynamiteTimer -= diff; DoMeleeAttackIfReady(); } @@ -301,29 +305,29 @@ public: struct npc_injured_draeneiAI : public ScriptedAI { - npc_injured_draeneiAI(Creature* c) : ScriptedAI(c) {} + npc_injured_draeneiAI(Creature* creature) : ScriptedAI(creature) {} void Reset() { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); me->SetHealth(me->CountPctFromMaxHealth(15)); - switch (rand()%2) + switch (urand(0, 1)) { - case 0: me->SetStandState(UNIT_STAND_STATE_SIT); break; - case 1: me->SetStandState(UNIT_STAND_STATE_SLEEP); break; + case 0: + me->SetStandState(UNIT_STAND_STATE_SIT); + break; + + case 1: + me->SetStandState(UNIT_STAND_STATE_SLEEP); + break; } } void EnterCombat(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) - { - } - - void UpdateAI(const uint32 /*diff*/) - { - } + void MoveInLineOfSight(Unit* /*who*/) {} + void UpdateAI(const uint32 /*diff*/) {} }; }; @@ -332,7 +336,7 @@ public: ## npc_magwin ######*/ -enum eMagwin +enum Magwin { SAY_START = -1000111, SAY_AGGRO = -1000112, @@ -367,31 +371,29 @@ public: struct npc_magwinAI : public npc_escortAI { - npc_magwinAI(Creature* c) : npc_escortAI(c) {} + npc_magwinAI(Creature* creature) : npc_escortAI(creature) {} - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { - Player* player = GetPlayerForEscort(); - - if (!player) - return; - - switch (i) + if (Player* player = GetPlayerForEscort()) { - case 0: - DoScriptText(SAY_START, me, player); - break; - case 17: - DoScriptText(SAY_PROGRESS, me, player); - break; - case 28: - DoScriptText(SAY_END1, me, player); - break; - case 29: - DoScriptText(EMOTE_HUG, me, player); - DoScriptText(SAY_END2, me, player); - player->GroupEventHappens(QUEST_A_CRY_FOR_SAY_HELP, me); - break; + switch (waypointId) + { + case 0: + DoScriptText(SAY_START, me, player); + break; + case 17: + DoScriptText(SAY_PROGRESS, me, player); + break; + case 28: + DoScriptText(SAY_END1, me, player); + break; + case 29: + DoScriptText(EMOTE_HUG, me, player); + DoScriptText(SAY_END2, me, player); + player->GroupEventHappens(QUEST_A_CRY_FOR_SAY_HELP, me); + break; + } } } @@ -400,7 +402,7 @@ public: DoScriptText(SAY_AGGRO, me, who); } - void Reset() { } + void Reset() {} }; }; @@ -409,7 +411,7 @@ public: ## npc_geezle ######*/ -enum eGeezle +enum Geezle { QUEST_TREES_COMPANY = 9531, @@ -429,7 +431,7 @@ enum eGeezle GO_NAGA_FLAG = 181694 }; -static float SparkPos[3] = {-5029.91f, -11291.79f, 8.096f}; +Position const SparkPos = {-5029.91f, -11291.79f, 8.096f, 0.0f}; class npc_geezle : public CreatureScript { @@ -443,11 +445,11 @@ public: struct npc_geezleAI : public ScriptedAI { - npc_geezleAI(Creature* c) : ScriptedAI(c) {} + npc_geezleAI(Creature* creature) : ScriptedAI(creature) {} uint64 SparkGUID; - uint32 Step; + uint8 Step; uint32 SayTimer; bool EventStarted; @@ -465,8 +467,7 @@ public: { Step = 0; EventStarted = true; - Creature* Spark = me->SummonCreature(MOB_SPARK, SparkPos[0], SparkPos[1], SparkPos[2], 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000); - if (Spark) + if (Creature* Spark = me->SummonCreature(MOB_SPARK, SparkPos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000)) { SparkGUID = Spark->GetGUID(); Spark->setActive(true); @@ -475,47 +476,47 @@ public: SayTimer = 8000; } - uint32 NextStep(uint32 Step) + uint32 NextStep(uint8 Step) { Creature* Spark = Unit::GetCreature(*me, SparkGUID); switch (Step) { - case 0: - if (Spark) - Spark->GetMotionMaster()->MovePoint(0, -5080.70f, -11253.61f, 0.56f); - me->GetMotionMaster()->MovePoint(0, -5092.26f, -11252, 0.71f); - return 9000; // NPCs are walking up to fire - case 1: - DespawnNagaFlag(true); - DoScriptText(EMOTE_SPARK, Spark); - return 1000; - case 2: - DoScriptText(GEEZLE_SAY_1, me, Spark); - if (Spark) - { - Spark->SetInFront(me); - me->SetInFront(Spark); - } - return 5000; - case 3: DoScriptText(SPARK_SAY_2, Spark); return 7000; - case 4: DoScriptText(SPARK_SAY_3, Spark); return 8000; - case 5: DoScriptText(GEEZLE_SAY_4, me, Spark); return 8000; - case 6: DoScriptText(SPARK_SAY_5, Spark); return 9000; - case 7: DoScriptText(SPARK_SAY_6, Spark); return 8000; - case 8: DoScriptText(GEEZLE_SAY_7, me, Spark); return 2000; - case 9: - me->GetMotionMaster()->MoveTargetedHome(); - if (Spark) - Spark->GetMotionMaster()->MovePoint(0, SparkPos[0], SparkPos[1], SparkPos[2]); - CompleteQuest(); - return 9000; - case 10: - if (Spark) - Spark->DisappearAndDie(); - DespawnNagaFlag(false); - me->DisappearAndDie(); - default: return 99999999; + case 0: + if (Spark) + Spark->GetMotionMaster()->MovePoint(0, -5080.70f, -11253.61f, 0.56f); + me->GetMotionMaster()->MovePoint(0, -5092.26f, -11252, 0.71f); + return 9000; // NPCs are walking up to fire + case 1: + DespawnNagaFlag(true); + DoScriptText(EMOTE_SPARK, Spark); + return 1000; + case 2: + DoScriptText(GEEZLE_SAY_1, me, Spark); + if (Spark) + { + Spark->SetInFront(me); + me->SetInFront(Spark); + } + return 5000; + case 3: DoScriptText(SPARK_SAY_2, Spark); return 7000; + case 4: DoScriptText(SPARK_SAY_3, Spark); return 8000; + case 5: DoScriptText(GEEZLE_SAY_4, me, Spark); return 8000; + case 6: DoScriptText(SPARK_SAY_5, Spark); return 9000; + case 7: DoScriptText(SPARK_SAY_6, Spark); return 8000; + case 8: DoScriptText(GEEZLE_SAY_7, me, Spark); return 2000; + case 9: + me->GetMotionMaster()->MoveTargetedHome(); + if (Spark) + Spark->GetMotionMaster()->MovePoint(0, SparkPos); + CompleteQuest(); + return 9000; + case 10: + if (Spark) + Spark->DisappearAndDie(); + DespawnNagaFlag(false); + me->DisappearAndDie(); + default: return 99999999; } } @@ -529,13 +530,8 @@ public: me->VisitNearbyWorldObject(radius, searcher); for (std::list<Player*>::const_iterator itr = players.begin(); itr != players.end(); ++itr) - { - if ((*itr)->GetQuestStatus(QUEST_TREES_COMPANY) == QUEST_STATUS_INCOMPLETE - &&(*itr)->HasAura(SPELL_TREE_DISGUISE)) - { + if ((*itr)->GetQuestStatus(QUEST_TREES_COMPANY) == QUEST_STATUS_INCOMPLETE && (*itr)->HasAura(SPELL_TREE_DISGUISE)) (*itr)->KilledMonsterCredit(MOB_SPARK, 0); - } - } } void DespawnNagaFlag(bool despawn) @@ -548,13 +544,13 @@ public: for (std::list<GameObject*>::const_iterator itr = FlagList.begin(); itr != FlagList.end(); ++itr) { if (despawn) - { (*itr)->SetLootState(GO_JUST_DEACTIVATED); - } else (*itr)->Respawn(); } - } else sLog->outError("SD2 ERROR: FlagList is empty!"); + } + else + sLog->outError("SD2 ERROR: FlagList is empty!"); } void UpdateAI(const uint32 diff) @@ -562,16 +558,16 @@ public: if (SayTimer <= diff) { if (EventStarted) - { SayTimer = NextStep(Step++); - } - } else SayTimer -= diff; + } + else + SayTimer -= diff; } }; }; -enum eRavegerCage +enum RavegerCage { NPC_DEATH_RAVAGER = 17556, @@ -597,7 +593,7 @@ public: ravager->AI()->AttackStart(player); } } - return true ; + return true; } }; @@ -613,7 +609,7 @@ public: struct npc_death_ravagerAI : public ScriptedAI { - npc_death_ravagerAI(Creature* c) : ScriptedAI(c){} + npc_death_ravagerAI(Creature* creature) : ScriptedAI(creature){} uint32 RendTimer; uint32 EnragingBiteTimer; diff --git a/src/server/scripts/Kalimdor/bloodmyst_isle.cpp b/src/server/scripts/Kalimdor/bloodmyst_isle.cpp index c114c02b16d..3883b740d02 100644 --- a/src/server/scripts/Kalimdor/bloodmyst_isle.cpp +++ b/src/server/scripts/Kalimdor/bloodmyst_isle.cpp @@ -28,14 +28,16 @@ mob_webbed_creature npc_captured_sunhawk_agent EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /*###### ## mob_webbed_creature ######*/ //possible creatures to be spawned -const uint32 possibleSpawns[32] = {17322, 17661, 17496, 17522, 17340, 17352, 17333, 17524, 17654, 17348, 17339, 17345, 17359, 17353, 17336, 17550, 17330, 17701, 17321, 17680, 17325, 17320, 17683, 17342, 17715, 17334, 17341, 17338, 17337, 17346, 17344, 17327}; +uint32 const possibleSpawns[32] = {17322, 17661, 17496, 17522, 17340, 17352, 17333, 17524, 17654, 17348, 17339, 17345, 17359, 17353, 17336, 17550, 17330, 17701, 17321, 17680, 17325, 17320, 17683, 17342, 17715, 17334, 17341, 17338, 17337, 17346, 17344, 17327}; class mob_webbed_creature : public CreatureScript { @@ -49,17 +51,13 @@ public: struct mob_webbed_creatureAI : public ScriptedAI { - mob_webbed_creatureAI(Creature* c) : ScriptedAI(c) {} + mob_webbed_creatureAI(Creature* creature) : ScriptedAI(creature) {} - void Reset() - { - } + void Reset() {} - void EnterCombat(Unit* /*who*/) - { - } + void EnterCombat(Unit* /*who*/) {} - void JustDied(Unit* Killer) + void JustDied(Unit* killer) { uint32 spawnCreatureID = 0; @@ -67,8 +65,8 @@ public: { case 0: spawnCreatureID = 17681; - if (Killer->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(Killer)->KilledMonsterCredit(spawnCreatureID, 0); + if (Player* player = killer->ToPlayer()) + player->KilledMonsterCredit(spawnCreatureID, 0); break; case 1: case 2: @@ -101,10 +99,10 @@ class npc_captured_sunhawk_agent : public CreatureScript public: npc_captured_sunhawk_agent() : CreatureScript("npc_captured_sunhawk_agent") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_CSA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); @@ -153,7 +151,7 @@ public: ## Quest 9667: Saving Princess Stillpine ######*/ -enum eStillpine +enum Stillpine { QUEST_SAVING_PRINCESS_STILLPINE = 9667, NPC_PRINCESS_STILLPINE = 17682, @@ -193,7 +191,7 @@ public: if (type == POINT_MOTION_TYPE && id == 1) { DoScriptText(SAY_DIRECTION, me); - me->ForcedDespawn(); + me->DespawnOrUnsummon(); } } }; diff --git a/src/server/scripts/Kalimdor/boss_azuregos.cpp b/src/server/scripts/Kalimdor/boss_azuregos.cpp index 4c415014eef..ec098951c03 100644 --- a/src/server/scripts/Kalimdor/boss_azuregos.cpp +++ b/src/server/scripts/Kalimdor/boss_azuregos.cpp @@ -23,17 +23,24 @@ SDComment: Teleport not included, spell reflect not effecting dots (Core problem SDCategory: Azshara EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" -#define SAY_TELEPORT -1000100 +enum Say +{ + SAY_TELEPORT = -1000100 +}; -#define SPELL_MARKOFFROST 23182 -#define SPELL_MANASTORM 21097 -#define SPELL_CHILL 21098 -#define SPELL_FROSTBREATH 21099 -#define SPELL_REFLECT 22067 -#define SPELL_CLEAVE 8255 //Perhaps not right ID -#define SPELL_ENRAGE 23537 +enum Spells +{ + SPELL_MARKOFFROST = 23182, + SPELL_MANASTORM = 21097, + SPELL_CHILL = 21098, + SPELL_FROSTBREATH = 21099, + SPELL_REFLECT = 22067, + SPELL_CLEAVE = 8255, //Perhaps not right ID + SPELL_ENRAGE = 23537 +}; class boss_azuregos : public CreatureScript { @@ -47,28 +54,28 @@ public: struct boss_azuregosAI : public ScriptedAI { - boss_azuregosAI(Creature* c) : ScriptedAI(c) {} - - uint32 MarkOfFrost_Timer; - uint32 ManaStorm_Timer; - uint32 Chill_Timer; - uint32 Breath_Timer; - uint32 Teleport_Timer; - uint32 Reflect_Timer; - uint32 Cleave_Timer; - uint32 Enrage_Timer; + boss_azuregosAI(Creature* creature) : ScriptedAI(creature) {} + + uint32 MarkOfFrostTimer; + uint32 ManaStormTimer; + uint32 ChillTimer; + uint32 BreathTimer; + uint32 TeleportTimer; + uint32 ReflectTimer; + uint32 CleaveTimer; + uint32 EnrageTimer; bool Enraged; void Reset() { - MarkOfFrost_Timer = 35000; - ManaStorm_Timer = urand(5000, 17000); - Chill_Timer = urand(10000, 30000); - Breath_Timer = urand(2000, 8000); - Teleport_Timer = 30000; - Reflect_Timer = urand(15000, 30000); - Cleave_Timer = 7000; - Enrage_Timer = 0; + MarkOfFrostTimer = 35000; + ManaStormTimer = urand(5000, 17000); + ChillTimer = urand(10000, 30000); + BreathTimer = urand(2000, 8000); + TeleportTimer = 30000; + ReflectTimer = urand(15000, 30000); + CleaveTimer = 7000; + EnrageTimer = 0; Enraged = false; } @@ -80,14 +87,14 @@ public: if (!UpdateVictim()) return; - if (Teleport_Timer <= diff) + if (TeleportTimer <= diff) { DoScriptText(SAY_TELEPORT, me); - std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList(); - std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); - for (i = m_threatlist.begin(); i!= m_threatlist.end(); ++i) + std::list<HostileReference*>& threatlist = me->getThreatManager().getThreatList(); + std::list<HostileReference*>::const_iterator i = threatlist.begin(); + for (i = threatlist.begin(); i!= threatlist.end(); ++i) { - Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()); if (unit && (unit->GetTypeId() == TYPEID_PLAYER)) { DoTeleportPlayer(unit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+3, unit->GetOrientation()); @@ -95,53 +102,53 @@ public: } DoResetThreat(); - Teleport_Timer = 30000; - } else Teleport_Timer -= diff; + TeleportTimer = 30000; + } else TeleportTimer -= diff; - // //MarkOfFrost_Timer - // if (MarkOfFrost_Timer <= diff) + // //MarkOfFrostTimer + // if (MarkOfFrostTimer <= diff) // { // DoCast(me->getVictim(), SPELL_MARKOFFROST); - // MarkOfFrost_Timer = 25000; - // } else MarkOfFrost_Timer -= diff; + // MarkOfFrostTimer = 25000; + // } else MarkOfFrostTimer -= diff; - //Chill_Timer - if (Chill_Timer <= diff) + //ChillTimer + if (ChillTimer <= diff) { DoCast(me->getVictim(), SPELL_CHILL); - Chill_Timer = urand(13000, 25000); - } else Chill_Timer -= diff; + ChillTimer = urand(13000, 25000); + } else ChillTimer -= diff; - //Breath_Timer - if (Breath_Timer <= diff) + //BreathTimer + if (BreathTimer <= diff) { DoCast(me->getVictim(), SPELL_FROSTBREATH); - Breath_Timer = urand(10000, 15000); - } else Breath_Timer -= diff; + BreathTimer = urand(10000, 15000); + } else BreathTimer -= diff; - //ManaStorm_Timer - if (ManaStorm_Timer <= diff) + //ManaStormTimer + if (ManaStormTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_MANASTORM); - ManaStorm_Timer = urand(7500, 12500); - } else ManaStorm_Timer -= diff; + ManaStormTimer = urand(7500, 12500); + } else ManaStormTimer -= diff; - //Reflect_Timer - if (Reflect_Timer <= diff) + //ReflectTimer + if (ReflectTimer <= diff) { DoCast(me, SPELL_REFLECT); - Reflect_Timer = urand(20000, 35000); - } else Reflect_Timer -= diff; + ReflectTimer = urand(20000, 35000); + } else ReflectTimer -= diff; - //Cleave_Timer - if (Cleave_Timer <= diff) + //CleaveTimer + if (CleaveTimer <= diff) { DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 7000; - } else Cleave_Timer -= diff; + CleaveTimer = 7000; + } else CleaveTimer -= diff; - //Enrage_Timer + //EnrageTimer if (HealthBelowPct(26) && !Enraged) { DoCast(me, SPELL_ENRAGE); diff --git a/src/server/scripts/Kalimdor/darkshore.cpp b/src/server/scripts/Kalimdor/darkshore.cpp index a2c10b94ff9..0e02a77169e 100644 --- a/src/server/scripts/Kalimdor/darkshore.cpp +++ b/src/server/scripts/Kalimdor/darkshore.cpp @@ -29,7 +29,9 @@ npc_prospector_remtravel npc_threshwackonator EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" #include "ScriptedFollowerAI.h" @@ -37,7 +39,7 @@ EndContentData */ # npc_kerlonian ####*/ -enum eKerlonian +enum Kerlonian { SAY_KER_START = -1000434, @@ -94,11 +96,11 @@ public: { npc_kerlonianAI(Creature* creature) : FollowerAI(creature) { } - uint32 m_uiFallAsleepTimer; + uint32 FallAsleepTimer; void Reset() { - m_uiFallAsleepTimer = urand(10000, 45000); + FallAsleepTimer = urand(10000, 45000); } void MoveInLineOfSight(Unit* who) @@ -150,7 +152,7 @@ public: SetFollowPaused(false); } - void UpdateFollowerAI(const uint32 uiDiff) + void UpdateFollowerAI(const uint32 Diff) { if (!UpdateVictim()) { @@ -159,13 +161,13 @@ public: if (!HasFollowState(STATE_FOLLOW_PAUSED)) { - if (m_uiFallAsleepTimer <= uiDiff) + if (FallAsleepTimer <= Diff) { SetSleeping(); - m_uiFallAsleepTimer = urand(25000, 90000); + FallAsleepTimer = urand(25000, 90000); } else - m_uiFallAsleepTimer -= uiDiff; + FallAsleepTimer -= Diff; } return; @@ -181,7 +183,7 @@ public: # npc_prospector_remtravel ####*/ -enum eRemtravel +enum Remtravel { SAY_REM_START = -1000327, SAY_REM_AGGRO = -1000328, @@ -231,66 +233,64 @@ public: { npc_prospector_remtravelAI(Creature* creature) : npc_escortAI(creature) {} - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { - Player* player = GetPlayerForEscort(); - - if (!player) - return; - - switch (i) + if (Player* player = GetPlayerForEscort()) { - case 0: - DoScriptText(SAY_REM_START, me, player); - break; - case 5: - DoScriptText(SAY_REM_RAMP1_1, me, player); - break; - case 6: - DoSpawnCreature(NPC_GRAVEL_SCOUT, -10.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - DoSpawnCreature(NPC_GRAVEL_BONE, -10.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case 9: - DoScriptText(SAY_REM_RAMP1_2, me, player); - break; - case 14: - //depend quest rewarded? - DoScriptText(SAY_REM_BOOK, me, player); - break; - case 15: - DoScriptText(SAY_REM_TENT1_1, me, player); - break; - case 16: - DoSpawnCreature(NPC_GRAVEL_SCOUT, -10.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - DoSpawnCreature(NPC_GRAVEL_BONE, -10.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case 17: - DoScriptText(SAY_REM_TENT1_2, me, player); - break; - case 26: - DoScriptText(SAY_REM_MOSS, me, player); - break; - case 27: - DoScriptText(EMOTE_REM_MOSS, me, player); - break; - case 28: - DoScriptText(SAY_REM_MOSS_PROGRESS, me, player); - break; - case 29: - DoSpawnCreature(NPC_GRAVEL_SCOUT, -15.0f, 3.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - DoSpawnCreature(NPC_GRAVEL_BONE, -15.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - DoSpawnCreature(NPC_GRAVEL_GEO, -15.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case 31: - DoScriptText(SAY_REM_PROGRESS, me, player); - break; - case 41: - DoScriptText(SAY_REM_REMEMBER, me, player); - break; - case 42: - DoScriptText(EMOTE_REM_END, me, player); - player->GroupEventHappens(QUEST_ABSENT_MINDED_PT2, me); - break; + switch (waypointId) + { + case 0: + DoScriptText(SAY_REM_START, me, player); + break; + case 5: + DoScriptText(SAY_REM_RAMP1_1, me, player); + break; + case 6: + DoSpawnCreature(NPC_GRAVEL_SCOUT, -10.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + DoSpawnCreature(NPC_GRAVEL_BONE, -10.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case 9: + DoScriptText(SAY_REM_RAMP1_2, me, player); + break; + case 14: + //depend quest rewarded? + DoScriptText(SAY_REM_BOOK, me, player); + break; + case 15: + DoScriptText(SAY_REM_TENT1_1, me, player); + break; + case 16: + DoSpawnCreature(NPC_GRAVEL_SCOUT, -10.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + DoSpawnCreature(NPC_GRAVEL_BONE, -10.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case 17: + DoScriptText(SAY_REM_TENT1_2, me, player); + break; + case 26: + DoScriptText(SAY_REM_MOSS, me, player); + break; + case 27: + DoScriptText(EMOTE_REM_MOSS, me, player); + break; + case 28: + DoScriptText(SAY_REM_MOSS_PROGRESS, me, player); + break; + case 29: + DoSpawnCreature(NPC_GRAVEL_SCOUT, -15.0f, 3.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + DoSpawnCreature(NPC_GRAVEL_BONE, -15.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + DoSpawnCreature(NPC_GRAVEL_GEO, -15.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case 31: + DoScriptText(SAY_REM_PROGRESS, me, player); + break; + case 41: + DoScriptText(SAY_REM_REMEMBER, me, player); + break; + case 42: + DoScriptText(EMOTE_REM_END, me, player); + player->GroupEventHappens(QUEST_ABSENT_MINDED_PT2, me); + break; + } } } @@ -298,7 +298,7 @@ public: void EnterCombat(Unit* who) { - if (rand()%2) + if (urand(0, 1)) DoScriptText(SAY_REM_AGGRO, me, who); } @@ -315,7 +315,7 @@ public: # npc_threshwackonator ####*/ -enum eThreshwackonator +enum Threshwackonator { EMOTE_START = -1000325, //signed for 4966 SAY_AT_CLOSE = -1000326, //signed for 4966 @@ -331,10 +331,10 @@ class npc_threshwackonator : public CreatureScript public: npc_threshwackonator() : CreatureScript("npc_threshwackonator") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { player->CLOSE_GOSSIP_MENU(); diff --git a/src/server/scripts/Kalimdor/desolace.cpp b/src/server/scripts/Kalimdor/desolace.cpp index 49a9be21a98..e196c71f681 100644 --- a/src/server/scripts/Kalimdor/desolace.cpp +++ b/src/server/scripts/Kalimdor/desolace.cpp @@ -30,10 +30,12 @@ npc_dalinda_malem go_demon_portal EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" -enum eDyingKodo +enum DyingKodo { // signed for 9999 SAY_SMEED_HOME_1 = -1000348, @@ -114,11 +116,11 @@ public: { npc_aged_dying_ancient_kodoAI(Creature* creature) : ScriptedAI(creature) { Reset(); } - uint32 m_uiDespawnTimer; + uint32 DespawnTimer; void Reset() { - m_uiDespawnTimer = 0; + DespawnTimer = 0; } void MoveInLineOfSight(Unit* who) @@ -143,14 +145,14 @@ public: if (pSpell->Id == SPELL_KODO_KOMBO_GOSSIP) { me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - m_uiDespawnTimer = 60000; + DespawnTimer = 60000; } } void UpdateAI(const uint32 diff) { //timer should always be == 0 unless we already updated entry of creature. Then not expect this updated to ever be in combat. - if (m_uiDespawnTimer && m_uiDespawnTimer <= diff) + if (DespawnTimer && DespawnTimer <= diff) { if (!me->getVictim() && me->isAlive()) { @@ -159,7 +161,7 @@ public: me->Respawn(); return; } - } else m_uiDespawnTimer -= diff; + } else DespawnTimer -= diff; if (!UpdateVictim()) return; @@ -175,7 +177,7 @@ public: ## Hand of Iruxos ######*/ -enum +enum Iruxos { QUEST_HAND_IRUXOS = 5381, NPC_DEMON_SPIRIT = 11876, @@ -199,7 +201,10 @@ class go_iruxos : public GameObjectScript ## npc_dalinda_malem. Quest 1440 ######*/ -#define QUEST_RETURN_TO_VAHLARRIEL 1440 +enum Dalinda +{ + QUEST_RETURN_TO_VAHLARRIEL = 1440 +}; class npc_dalinda : public CreatureScript { @@ -228,17 +233,18 @@ public: { npc_dalindaAI(Creature* creature) : npc_escortAI(creature) { } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); - switch (i) + + switch (waypointId) { case 1: me->IsStandState(); break; case 15: if (player) - player->GroupEventHappens(QUEST_RETURN_TO_VAHLARRIEL, me); + player->GroupEventHappens(QUEST_RETURN_TO_VAHLARRIEL, me); break; } } @@ -249,15 +255,14 @@ public: void JustDied(Unit* /*killer*/) { - Player* player = GetPlayerForEscort(); - if (player) + if (Player* player = GetPlayerForEscort()) player->FailQuest(QUEST_RETURN_TO_VAHLARRIEL); return; } - void UpdateAI(const uint32 uiDiff) + void UpdateAI(const uint32 Diff) { - npc_escortAI::UpdateAI(uiDiff); + npc_escortAI::UpdateAI(Diff); if (!UpdateVictim()) return; DoMeleeAttackIfReady(); diff --git a/src/server/scripts/Kalimdor/durotar.cpp b/src/server/scripts/Kalimdor/durotar.cpp index 6c91c64f981..ec06a542b6f 100644 --- a/src/server/scripts/Kalimdor/durotar.cpp +++ b/src/server/scripts/Kalimdor/durotar.cpp @@ -15,8 +15,10 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "Vehicle.h" +#include "SpellScript.h" /*###### ##Quest 5441: Lazy Peons @@ -48,17 +50,17 @@ public: struct npc_lazy_peonAI : public ScriptedAI { - npc_lazy_peonAI(Creature* c) : ScriptedAI(c) {} + npc_lazy_peonAI(Creature* creature) : ScriptedAI(creature) {} - uint64 uiPlayerGUID; + uint64 PlayerGUID; - uint32 m_uiRebuffTimer; + uint32 RebuffTimer; bool work; - void Reset () + void Reset() { - uiPlayerGUID = 0; - m_uiRebuffTimer = 0; + PlayerGUID = 0; + RebuffTimer = 0; work = false; } @@ -81,17 +83,17 @@ public: } } - void UpdateAI(const uint32 uiDiff) + void UpdateAI(const uint32 Diff) { if (work == true) me->HandleEmoteCommand(EMOTE_ONESHOT_WORK_CHOPWOOD); - if (m_uiRebuffTimer <= uiDiff) + if (RebuffTimer <= Diff) { DoCast(me, SPELL_BUFF_SLEEP); - m_uiRebuffTimer = 300000; //Rebuff agian in 5 minutes + RebuffTimer = 300000; //Rebuff agian in 5 minutes } else - m_uiRebuffTimer -= uiDiff; + RebuffTimer -= Diff; if (!UpdateVictim()) return; DoMeleeAttackIfReady(); @@ -170,7 +172,7 @@ enum Points class npc_tiger_matriarch_credit : public CreatureScript { public: - npc_tiger_matriarch_credit() : CreatureScript("npc_tiger_matriarch_credit"){} + npc_tiger_matriarch_credit() : CreatureScript("npc_tiger_matriarch_credit") { } struct npc_tiger_matriarch_creditAI : public Scripted_NoMovementAI { @@ -179,7 +181,7 @@ class npc_tiger_matriarch_credit : public CreatureScript events.ScheduleEvent(EVENT_CHECK_SUMMON_AURA, 2000); } - void UpdateAI(const uint32 diff) + void UpdateAI(uint32 const diff) { events.Update(diff); @@ -223,27 +225,32 @@ class npc_tiger_matriarch_credit : public CreatureScript class npc_tiger_matriarch : public CreatureScript { public: - npc_tiger_matriarch() : CreatureScript("npc_tiger_matriarch"){} + npc_tiger_matriarch() : CreatureScript("npc_tiger_matriarch") {} struct npc_tiger_matriarchAI : public ScriptedAI { npc_tiger_matriarchAI(Creature* creature) : ScriptedAI(creature), - _tiger(NULL) + _tigerGuid(0) { } + void EnterCombat(Unit* /*target*/) + { + _events.Reset(); + _events.ScheduleEvent(EVENT_POUNCE, 100); + _events.ScheduleEvent(EVENT_NOSUMMON, 50000); + } + void IsSummonedBy(Unit* summoner) { - if (summoner->GetTypeId() != TYPEID_PLAYER) + if (summoner->GetTypeId() != TYPEID_PLAYER || !summoner->GetVehicle()) return; - _tiger = summoner->GetVehicle()->GetBase(); - if (_tiger) + _tigerGuid = summoner->GetVehicle()->GetBase()->GetGUID(); + if (Unit* tiger = ObjectAccessor::GetUnit(*me, _tigerGuid)) { - me->AddThreat(_tiger, 500000.0f); + me->AddThreat(tiger, 500000.0f); DoCast(me, SPELL_FURIOUS_BITE); - events.ScheduleEvent(EVENT_POUNCE, 100); - events.ScheduleEvent(EVENT_NOSUMMON, 50000); } } @@ -259,7 +266,7 @@ class npc_tiger_matriarch : public CreatureScript vehSummoner->RemoveAurasDueToSpell(SPELL_SPIRIT_OF_THE_TIGER_RIDER); vehSummoner->RemoveAurasDueToSpell(SPELL_SUMMON_ZENTABRA_TRIGGER); } - me->ForcedDespawn(); + me->DespawnOrUnsummon(); } void DamageTaken(Unit* attacker, uint32& damage) @@ -282,7 +289,7 @@ class npc_tiger_matriarch : public CreatureScript vehSummoner->RemoveAurasDueToSpell(SPELL_SUMMON_ZENTABRA_TRIGGER); } - me->ForcedDespawn(); + me->DespawnOrUnsummon(); } } @@ -291,24 +298,27 @@ class npc_tiger_matriarch : public CreatureScript if (!UpdateVictim()) return; - if (!_tiger) + if (!_tigerGuid) return; - events.Update(diff); + _events.Update(diff); - while (uint32 eventId = events.ExecuteEvent()) + while (uint32 eventId = _events.ExecuteEvent()) { switch (eventId) { case EVENT_POUNCE: DoCastVictim(SPELL_POUNCE); - events.ScheduleEvent(EVENT_POUNCE, 30000); + _events.ScheduleEvent(EVENT_POUNCE, 30000); break; case EVENT_NOSUMMON: // Reapply SPELL_NO_SUMMON_AURA - if (_tiger && _tiger->isSummon()) - if (Unit* vehSummoner = _tiger->ToTempSummon()->GetSummoner()) - me->AddAura(SPELL_NO_SUMMON_AURA, vehSummoner); - events.ScheduleEvent(EVENT_NOSUMMON, 50000); + if (Unit* tiger = ObjectAccessor::GetUnit(*me, _tigerGuid)) + { + if (tiger->isSummon()) + if (Unit* vehSummoner = tiger->ToTempSummon()->GetSummoner()) + me->AddAura(SPELL_NO_SUMMON_AURA, vehSummoner); + } + _events.ScheduleEvent(EVENT_NOSUMMON, 50000); break; default: break; @@ -319,8 +329,8 @@ class npc_tiger_matriarch : public CreatureScript } private: - EventMap events; - Unit* _tiger; + EventMap _events; + uint64 _tigerGuid; }; CreatureAI* GetAI(Creature* creature) const @@ -345,26 +355,32 @@ class npc_troll_volunteer : public CreatureScript { npc_troll_volunteerAI(Creature* creature) : ScriptedAI(creature) { + } + + void InitializeAI() + { + if (me->isDead() || !me->GetOwner()) + return; + Reset(); - Player* player = me->GetOwner()->ToPlayer(); - switch (urand(1, 4)) + switch (urand(0, 3)) { - case 1: + case 0: _mountModel = 6471; break; - case 2: + case 1: _mountModel = 6473; break; - case 3: + case 2: _mountModel = 6469; break; - case 4: + default: _mountModel = 6472; break; } me->SetDisplayId(trollmodel[urand(0, 39)]); - if (player) + if (Player* player = me->GetOwner()->ToPlayer()) me->GetMotionMaster()->MoveFollow(player, 5.0f, float(rand_norm() + 1.0f) * M_PI / 3.0f * 4.0f); } @@ -417,6 +433,8 @@ class npc_troll_volunteer : public CreatureScript } }; +typedef npc_troll_volunteer::npc_troll_volunteerAI VolunteerAI; + class spell_mount_check : public SpellScriptLoader { public: @@ -442,9 +460,8 @@ class spell_mount_check : public SpellScriptLoader if (owner->IsMounted() && !target->IsMounted()) { - if (Creature* volunteer = target->ToCreature()) - if (uint32 mountid = CAST_AI(npc_troll_volunteer::npc_troll_volunteerAI, volunteer->AI())->GetMountId()) - target->Mount(mountid); + if (VolunteerAI* volunteerAI = CAST_AI(VolunteerAI, target->GetAI())) + target->Mount(volunteerAI->GetMountId()); } else if (!owner->IsMounted() && target->IsMounted()) target->Dismount(); @@ -493,7 +510,7 @@ class spell_voljin_war_drums : public SpellScriptLoader else if (target->GetEntry() == NPC_CITIZEN_2) motivate = SPELL_MOTIVATE_2; if (motivate) - caster->CastSpell(target, motivate, true, NULL, NULL, caster->GetGUID()); + caster->CastSpell(target, motivate, false); } } @@ -511,13 +528,13 @@ class spell_voljin_war_drums : public SpellScriptLoader enum VoodooSpells { - SPELL_BREW = 16712, // Special Brew - SPELL_GHOSTLY = 16713, // Ghostly - SPELL_HEX1 = 16707, // Hex - SPELL_HEX2 = 16708, // Hex - SPELL_HEX3 = 16709, // Hex - SPELL_GROW = 16711, // Grow - SPELL_LAUNCH = 16716, // Launch (Whee!) + SPELL_BREW = 16712, // Special Brew + SPELL_GHOSTLY = 16713, // Ghostly + SPELL_HEX1 = 16707, // Hex + SPELL_HEX2 = 16708, // Hex + SPELL_HEX3 = 16709, // Hex + SPELL_GROW = 16711, // Grow + SPELL_LAUNCH = 16716, // Launch (Whee!) }; // 17009 @@ -542,13 +559,9 @@ class spell_voodoo : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { - Unit* caster = GetCaster(); + uint32 spellid = RAND(SPELL_BREW, SPELL_GHOSTLY, RAND(SPELL_HEX1, SPELL_HEX2, SPELL_HEX3), SPELL_GROW, SPELL_LAUNCH); if (Unit* target = GetHitUnit()) - { - caster->CastSpell(target, RAND(SPELL_BREW, SPELL_GHOSTLY, - RAND(SPELL_HEX1, SPELL_HEX2, SPELL_HEX3), - SPELL_GROW, SPELL_LAUNCH), false); - } + GetCaster()->CastSpell(target, spellid, false); } void Register() diff --git a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp index eede1aa069a..45e1c1808c1 100644 --- a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp +++ b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp @@ -32,8 +32,11 @@ npc_private_hendel npc_cassa_crimsonwing - handled by npc_taxi EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" +#include "ScriptedGossip.h" +#include "SpellScript.h" /*###### ## mobs_risen_husk_spirit @@ -132,7 +135,7 @@ class mobs_risen_husk_spirit : public CreatureScript ## npc_deserter_agitator ######*/ -enum eDeserter +enum Deserter { QUEST_TRAITORS_AMONG_US = 11126, NPC_THERAMORE_DESERTER = 23602, @@ -157,11 +160,11 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_SENDER_INFO) + if (action == GOSSIP_SENDER_INFO) { player->CLOSE_GOSSIP_MENU(); switch (urand(0, 1)) @@ -203,12 +206,12 @@ public: me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); } - void MovementInform(uint32 uiType, uint32 uiId) + void MovementInform(uint32 Type, uint32 Id) { - if (uiType != POINT_MOTION_TYPE) + if (Type != POINT_MOTION_TYPE) return; - if (uiId == 1) + if (Id == 1) me->DisappearAndDie(); } }; @@ -218,7 +221,7 @@ public: ## npc_deserter_agitator ######*/ -enum eTheramoreGuard +enum TheramoreGuard { SAY_QUEST1 = -1000641, SAY_QUEST2 = -1000642, @@ -255,18 +258,18 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_SENDER_INFO) + if (action == GOSSIP_SENDER_INFO) { player->CLOSE_GOSSIP_MENU(); player->KilledMonsterCredit(NPC_THERAMORE_GUARD, 0); DoScriptText(SAY_QUEST1, creature); creature->CastSpell(creature, SPELL_DOCTORED_LEAFLET, false); creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - CAST_AI(npc_theramore_guard::npc_theramore_guardAI, creature->AI())->uiYellTimer = 4000; + CAST_AI(npc_theramore_guard::npc_theramore_guardAI, creature->AI())->YellTimer = 4000; CAST_AI(npc_theramore_guard::npc_theramore_guardAI, creature->AI())->bYellTimer = true; } @@ -282,40 +285,40 @@ public: { npc_theramore_guardAI(Creature* creature) : ScriptedAI(creature) { } - uint32 uiYellTimer; - uint32 uiStep; + uint32 YellTimer; + uint32 Step; bool bYellTimer; void Reset() { bYellTimer = false; - uiStep = 0; + Step = 0; } - void UpdateAI(const uint32 uiDiff) + void UpdateAI(const uint32 Diff) { if (!me->HasAura(SPELL_PROPAGANDIZED)) me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - if (bYellTimer && uiYellTimer <= uiDiff) + if (bYellTimer && YellTimer <= Diff) { - switch (uiStep) + switch (Step) { case 0: DoScriptText(RAND(SAY_QUEST2, SAY_QUEST3, SAY_QUEST4, SAY_QUEST5, SAY_QUEST6), me); - uiYellTimer = 3000; - ++uiStep; + YellTimer = 3000; + ++Step; break; case 1: DoScriptText(RAND(SAY_QUEST7, SAY_QUEST8, SAY_QUEST9), me); me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); - uiStep = 0; + Step = 0; bYellTimer = false; break; } } else - uiYellTimer -= uiDiff; + YellTimer -= Diff; } }; }; @@ -324,7 +327,7 @@ public: ## npc_lady_jaina_proudmoore ######*/ -enum eLadyJaina +enum LadyJaina { QUEST_JAINAS_AUTOGRAPH = 558, SPELL_JAINAS_AUTOGRAPH = 23122 @@ -337,10 +340,10 @@ class npc_lady_jaina_proudmoore : public CreatureScript public: npc_lady_jaina_proudmoore() : CreatureScript("npc_lady_jaina_proudmoore") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_SENDER_INFO) + if (action == GOSSIP_SENDER_INFO) { player->SEND_GOSSIP_MENU(7012, creature->GetGUID()); player->CastSpell(player, SPELL_JAINAS_AUTOGRAPH, false); @@ -367,7 +370,7 @@ public: ## npc_nat_pagle ######*/ -enum eNatPagle +enum NatPagle { QUEST_NATS_MEASURING_TAPE = 8227 }; @@ -377,10 +380,10 @@ class npc_nat_pagle : public CreatureScript public: npc_nat_pagle() : CreatureScript("npc_nat_pagle") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_TRADE) + if (action == GOSSIP_ACTION_TRADE) player->GetSession()->SendListInventory(creature->GetGUID()); return true; @@ -408,7 +411,7 @@ public: ## npc_private_hendel ######*/ -enum eHendel +enum Hendel { // looks like all this text ids are wrong. SAY_PROGRESS_1_TER = -1000411, // signed for 3568 @@ -464,11 +467,11 @@ public: AttackStart(pAttacker); } - void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) + void DamageTaken(Unit* pDoneBy, uint32 &Damage) { - if (uiDamage > me->GetHealth() || me->HealthBelowPctDamaged(20, uiDamage)) + if (Damage > me->GetHealth() || me->HealthBelowPctDamaged(20, Damage)) { - uiDamage = 0; + Damage = 0; if (Player* player = pDoneBy->GetCharmerOrOwnerPlayerOrPlayerItself()) player->GroupEventHappens(QUEST_MISSING_DIPLO_PT16, me); @@ -485,9 +488,9 @@ public: ## npc_zelfrax ######*/ -const Position MovePosition = {-2967.030f, -3872.1799f, 35.620f, 0.0f}; +Position const MovePosition = {-2967.030f, -3872.1799f, 35.620f, 0.0f}; -enum eZelfrax +enum Zelfrax { SAY_ZELFRAX = -1000472, SAY_ZELFRAX_2 = -1000473 @@ -525,9 +528,9 @@ public: } } - void MovementInform(uint32 uiType, uint32 /*uiId*/) + void MovementInform(uint32 Type, uint32 /*Id*/) { - if (uiType != POINT_MOTION_TYPE) + if (Type != POINT_MOTION_TYPE) return; me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); @@ -547,7 +550,7 @@ public: DoScriptText(SAY_ZELFRAX_2, me); } - void UpdateAI(uint32 const /*uiDiff*/) + void UpdateAI(uint32 const /*Diff*/) { if (!UpdateVictim()) return; @@ -562,7 +565,7 @@ public: ## npc_stinky ######*/ -enum eStinky +enum Stinky { QUEST_STINKYS_ESCAPE_H = 1270, QUEST_STINKYS_ESCAPE_A = 1222, @@ -607,49 +610,48 @@ public: { npc_stinkyAI(Creature* creature) : npc_escortAI(creature) { } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); if (!player) return; - switch (i) + switch (waypointId) { - case 7: - DoScriptText(SAY_STAY_1, me, player); - break; - case 11: - DoScriptText(SAY_STAY_2, me, player); - break; - case 25: - DoScriptText(SAY_STAY_3, me, player); - break; - case 26: - DoScriptText(SAY_STAY_4, me, player); - break; - case 27: - DoScriptText(SAY_STAY_5, me, player); - break; - case 28: - DoScriptText(SAY_STAY_6, me, player); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - break; - case 29: - me->SetStandState(UNIT_STAND_STATE_STAND); - break; - case 37: - DoScriptText(SAY_QUEST_COMPLETE, me, player); - me->SetSpeed(MOVE_RUN, 1.2f, true); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - if (player && player->GetQuestStatus(QUEST_STINKYS_ESCAPE_H)) - player->GroupEventHappens(QUEST_STINKYS_ESCAPE_H, me); - if (player && player->GetQuestStatus(QUEST_STINKYS_ESCAPE_A)) - player->GroupEventHappens(QUEST_STINKYS_ESCAPE_A, me); - break; - case 39: - DoScriptText(EMOTE_DISAPPEAR, me); - break; - + case 7: + DoScriptText(SAY_STAY_1, me, player); + break; + case 11: + DoScriptText(SAY_STAY_2, me, player); + break; + case 25: + DoScriptText(SAY_STAY_3, me, player); + break; + case 26: + DoScriptText(SAY_STAY_4, me, player); + break; + case 27: + DoScriptText(SAY_STAY_5, me, player); + break; + case 28: + DoScriptText(SAY_STAY_6, me, player); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + break; + case 29: + me->SetStandState(UNIT_STAND_STATE_STAND); + break; + case 37: + DoScriptText(SAY_QUEST_COMPLETE, me, player); + me->SetSpeed(MOVE_RUN, 1.2f, true); + me->SetWalk(false); + if (player->GetQuestStatus(QUEST_STINKYS_ESCAPE_H)) + player->GroupEventHappens(QUEST_STINKYS_ESCAPE_H, me); + if (player->GetQuestStatus(QUEST_STINKYS_ESCAPE_A)) + player->GroupEventHappens(QUEST_STINKYS_ESCAPE_A, me); + break; + case 39: + DoScriptText(EMOTE_DISAPPEAR, me); + break; } } @@ -663,10 +665,11 @@ public: void JustDied(Unit* /*killer*/) { Player* player = GetPlayerForEscort(); - if (HasEscortState(STATE_ESCORT_ESCORTING) && player) + if (player && HasEscortState(STATE_ESCORT_ESCORTING)) { if (player->GetQuestStatus(QUEST_STINKYS_ESCAPE_H)) player->FailQuest(QUEST_STINKYS_ESCAPE_H); + if (player->GetQuestStatus(QUEST_STINKYS_ESCAPE_A)) player->FailQuest(QUEST_STINKYS_ESCAPE_A); } @@ -713,7 +716,7 @@ class spell_ooze_zap : public SpellScriptLoader if (!GetCaster()->HasAura(GetSpellInfo()->Effects[EFFECT_1].CalcValue())) return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; // This is actually correct - if (!GetTargetUnit()) + if (!GetExplTargetUnit()) return SPELL_FAILED_BAD_TARGETS; return SPELL_CAST_OK; @@ -847,7 +850,7 @@ public: player->KilledMonsterCredit(NPC_THERAMORE_PRISONER, 0); prisoner->AI()->Talk(SAY_FREE); // We also emote cry here (handled in creature_text.emote) - prisoner->ForcedDespawn(6000); + prisoner->DespawnOrUnsummon(6000); } return true; } diff --git a/src/server/scripts/Kalimdor/felwood.cpp b/src/server/scripts/Kalimdor/felwood.cpp index 91d8a875f17..9243ea0017e 100644 --- a/src/server/scripts/Kalimdor/felwood.cpp +++ b/src/server/scripts/Kalimdor/felwood.cpp @@ -27,7 +27,9 @@ EndScriptData */ npcs_riverbreeze_and_silversky EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /*###### ## npcs_riverbreeze_and_silversky @@ -35,32 +37,43 @@ EndContentData */ #define GOSSIP_ITEM_BEACON "Please make me a Cenarion Beacon" +enum RiverbreezeAndSilversky +{ + SPELL_CENARION_BEACON = 15120, + + NPC_ARATHANDRIS_SILVERSKY = 9528, + NPC_MAYBESS_RIVERBREEZE = 9529, + + QUEST_CLEASING_FELWOOD_A = 4101, + QUEST_CLEASING_FELWOOD_H = 4102 +}; + class npcs_riverbreeze_and_silversky : public CreatureScript { public: npcs_riverbreeze_and_silversky() : CreatureScript("npcs_riverbreeze_and_silversky") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { player->CLOSE_GOSSIP_MENU(); - creature->CastSpell(player, 15120, false); + creature->CastSpell(player, SPELL_CENARION_BEACON, false); } return true; } bool OnGossipHello(Player* player, Creature* creature) { - uint32 eCreature = creature->GetEntry(); - if (creature->isQuestGiver()) player->PrepareQuestMenu(creature->GetGUID()); - if (eCreature == 9528) + uint32 creatureId = creature->GetEntry(); + + if (creatureId == NPC_ARATHANDRIS_SILVERSKY) { - if (player->GetQuestRewardStatus(4101)) + if (player->GetQuestRewardStatus(QUEST_CLEASING_FELWOOD_A)) { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BEACON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(2848, creature->GetGUID()); @@ -70,9 +83,9 @@ public: player->SEND_GOSSIP_MENU(2844, creature->GetGUID()); } - if (eCreature == 9529) + if (creatureId == NPC_MAYBESS_RIVERBREEZE) { - if (player->GetQuestRewardStatus(4102)) + if (player->GetQuestRewardStatus(QUEST_CLEASING_FELWOOD_H)) { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BEACON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(2849, creature->GetGUID()); @@ -84,7 +97,6 @@ public: return true; } - }; void AddSC_felwood() diff --git a/src/server/scripts/Kalimdor/feralas.cpp b/src/server/scripts/Kalimdor/feralas.cpp index 37a0e4e8f88..4fcd20951c9 100644 --- a/src/server/scripts/Kalimdor/feralas.cpp +++ b/src/server/scripts/Kalimdor/feralas.cpp @@ -23,8 +23,10 @@ SDComment: Quest support: 3520, 2767, Special vendor Gregan Brewspewer SDCategory: Feralas EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" +#include "ScriptedGossip.h" /*###### ## npc_gregan_brewspewer @@ -37,15 +39,15 @@ class npc_gregan_brewspewer : public CreatureScript public: npc_gregan_brewspewer() : CreatureScript("npc_gregan_brewspewer") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); player->SEND_GOSSIP_MENU(2434, creature->GetGUID()); } - if (uiAction == GOSSIP_ACTION_TRADE) + if (action == GOSSIP_ACTION_TRADE) player->GetSession()->SendListInventory(creature->GetGUID()); return true; } @@ -68,7 +70,7 @@ public: ## npc_oox22fe ######*/ -enum eOOX +enum OOX { //signed for 7806 SAY_OOX_START = -1000287, @@ -124,9 +126,9 @@ public: { npc_oox22feAI(Creature* creature) : npc_escortAI(creature) { } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { - switch (i) + switch (waypointId) { // First Ambush(3 Yetis) case 11: @@ -154,9 +156,7 @@ public: DoScriptText(SAY_OOX_END, me); // Award quest credit if (Player* player = GetPlayerForEscort()) - { - player->GroupEventHappens(QUEST_RESCUE_OOX22FE, me); - } + player->GroupEventHappens(QUEST_RESCUE_OOX22FE, me); break; } } diff --git a/src/server/scripts/Kalimdor/moonglade.cpp b/src/server/scripts/Kalimdor/moonglade.cpp index 2d6e34ab9ee..9df208d2578 100644 --- a/src/server/scripts/Kalimdor/moonglade.cpp +++ b/src/server/scripts/Kalimdor/moonglade.cpp @@ -31,14 +31,16 @@ npc_clintar_spirit npc_clintar_dreamwalker EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" +#include "ScriptedGossip.h" /*###### ## npc_bunthen_plainswind ######*/ -enum eBunthen +enum Bunthen { QUEST_SEA_LION_HORDE = 30, QUEST_SEA_LION_ALLY = 272, @@ -54,10 +56,10 @@ class npc_bunthen_plainswind : public CreatureScript public: npc_bunthen_plainswind() : CreatureScript("npc_bunthen_plainswind") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF + 1: player->CLOSE_GOSSIP_MENU(); @@ -113,10 +115,10 @@ class npc_great_bear_spirit : public CreatureScript public: npc_great_bear_spirit() : CreatureScript("npc_great_bear_spirit") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BEAR2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -169,10 +171,10 @@ class npc_silva_filnaveth : public CreatureScript public: npc_silva_filnaveth() : CreatureScript("npc_silva_filnaveth") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF + 1: player->CLOSE_GOSSIP_MENU(); @@ -218,70 +220,68 @@ public: ## npc_clintar_spirit ######*/ -float Clintar_spirit_WP[41][5] = +float const Clintar_spirit_WP[41][5] = { - //pos_x pos_y pos_z orien waitTime -{7465.28f, -3115.46f, 439.327f, 0.83f, 4000}, -{7476.49f, -3101, 443.457f, 0.89f, 0}, -{7486.57f, -3085.59f, 439.478f, 1.07f, 0}, -{7472.19f, -3085.06f, 443.142f, 3.07f, 0}, -{7456.92f, -3085.91f, 438.862f, 3.24f, 0}, -{7446.68f, -3083.43f, 438.245f, 2.40f, 0}, -{7446.17f, -3080.21f, 439.826f, 1.10f, 6000}, -{7452.41f, -3085.8f, 438.984f, 5.78f, 0}, -{7469.11f, -3084.94f, 443.048f, 6.25f, 0}, -{7483.79f, -3085.44f, 439.607f, 6.25f, 0}, -{7491.14f, -3090.96f, 439.983f, 5.44f, 0}, -{7497.62f, -3098.22f, 436.854f, 5.44f, 0}, -{7498.72f, -3113.41f, 434.596f, 4.84f, 0}, -{7500.06f, -3122.51f, 434.749f, 5.17f, 0}, -{7504.96f, -3131.53f, 434.475f, 4.74f, 0}, -{7504.31f, -3133.53f, 435.693f, 3.84f, 6000}, -{7504.55f, -3133.27f, 435.476f, 0.68f, 15000}, -{7501.99f, -3126.01f, 434.93f, 1.83f, 0}, -{7490.76f, -3114.97f, 434.431f, 2.51f, 0}, -{7479.64f, -3105.51f, 431.123f, 1.83f, 0}, -{7474.63f, -3086.59f, 428.994f, 1.83f, 2000}, -{7472.96f, -3074.18f, 427.566f, 1.57f, 0}, -{7472.25f, -3063, 428.268f, 1.55f, 0}, -{7473.46f, -3054.22f, 427.588f, 0.36f, 0}, -{7475.08f, -3053.6f, 428.653f, 0.36f, 6000}, -{7474.66f, -3053.56f, 428.433f, 3.19f, 4000}, -{7471.81f, -3058.84f, 427.073f, 4.29f, 0}, -{7472.16f, -3064.91f, 427.772f, 4.95f, 0}, -{7471.56f, -3085.36f, 428.924f, 4.72f, 0}, -{7473.56f, -3093.48f, 429.294f, 5.04f, 0}, -{7478.94f, -3104.29f, 430.638f, 5.23f, 0}, -{7484.46f, -3109.61f, 432.769f, 5.79f, 0}, -{7490.23f, -3111.08f, 434.431f, 0.02f, 0}, -{7496.29f, -3108, 434.783f, 1.15f, 0}, -{7497.46f, -3100.66f, 436.191f, 1.50f, 0}, -{7495.64f, -3093.39f, 438.349f, 2.10f, 0}, -{7492.44f, -3086.01f, 440.267f, 1.38f, 0}, -{7498.26f, -3076.44f, 440.808f, 0.71f, 0}, -{7506.4f, -3067.35f, 443.64f, 0.77f, 0}, -{7518.37f, -3057.42f, 445.584f, 0.74f, 0}, -{7517.51f, -3056.3f, 444.568f, 2.49f, 4500} + //pos_x pos_y pos_z orien waitTime + {7465.28f, -3115.46f, 439.327f, 0.83f, 4000}, + {7476.49f, -3101, 443.457f, 0.89f, 0}, + {7486.57f, -3085.59f, 439.478f, 1.07f, 0}, + {7472.19f, -3085.06f, 443.142f, 3.07f, 0}, + {7456.92f, -3085.91f, 438.862f, 3.24f, 0}, + {7446.68f, -3083.43f, 438.245f, 2.40f, 0}, + {7446.17f, -3080.21f, 439.826f, 1.10f, 6000}, + {7452.41f, -3085.8f, 438.984f, 5.78f, 0}, + {7469.11f, -3084.94f, 443.048f, 6.25f, 0}, + {7483.79f, -3085.44f, 439.607f, 6.25f, 0}, + {7491.14f, -3090.96f, 439.983f, 5.44f, 0}, + {7497.62f, -3098.22f, 436.854f, 5.44f, 0}, + {7498.72f, -3113.41f, 434.596f, 4.84f, 0}, + {7500.06f, -3122.51f, 434.749f, 5.17f, 0}, + {7504.96f, -3131.53f, 434.475f, 4.74f, 0}, + {7504.31f, -3133.53f, 435.693f, 3.84f, 6000}, + {7504.55f, -3133.27f, 435.476f, 0.68f, 15000}, + {7501.99f, -3126.01f, 434.93f, 1.83f, 0}, + {7490.76f, -3114.97f, 434.431f, 2.51f, 0}, + {7479.64f, -3105.51f, 431.123f, 1.83f, 0}, + {7474.63f, -3086.59f, 428.994f, 1.83f, 2000}, + {7472.96f, -3074.18f, 427.566f, 1.57f, 0}, + {7472.25f, -3063, 428.268f, 1.55f, 0}, + {7473.46f, -3054.22f, 427.588f, 0.36f, 0}, + {7475.08f, -3053.6f, 428.653f, 0.36f, 6000}, + {7474.66f, -3053.56f, 428.433f, 3.19f, 4000}, + {7471.81f, -3058.84f, 427.073f, 4.29f, 0}, + {7472.16f, -3064.91f, 427.772f, 4.95f, 0}, + {7471.56f, -3085.36f, 428.924f, 4.72f, 0}, + {7473.56f, -3093.48f, 429.294f, 5.04f, 0}, + {7478.94f, -3104.29f, 430.638f, 5.23f, 0}, + {7484.46f, -3109.61f, 432.769f, 5.79f, 0}, + {7490.23f, -3111.08f, 434.431f, 0.02f, 0}, + {7496.29f, -3108, 434.783f, 1.15f, 0}, + {7497.46f, -3100.66f, 436.191f, 1.50f, 0}, + {7495.64f, -3093.39f, 438.349f, 2.10f, 0}, + {7492.44f, -3086.01f, 440.267f, 1.38f, 0}, + {7498.26f, -3076.44f, 440.808f, 0.71f, 0}, + {7506.4f, -3067.35f, 443.64f, 0.77f, 0}, + {7518.37f, -3057.42f, 445.584f, 0.74f, 0}, + {7517.51f, -3056.3f, 444.568f, 2.49f, 4500} }; -#define ASPECT_RAVEN 22915 - -#define ASPECT_RAVEN_SUMMON_X 7472.96f -#define ASPECT_RAVEN_SUMMON_Y -3074.18f -#define ASPECT_RAVEN_SUMMON_Z 427.566f -#define CLINTAR_SPIRIT_SUMMON_X 7459.2275f -#define CLINTAR_SPIRIT_SUMMON_Y -3122.5632f -#define CLINTAR_SPIRIT_SUMMON_Z 438.9842f -#define CLINTAR_SPIRIT_SUMMON_O 0.8594f - -//from -1000292 to -1000287 are signed for 7806. but all this texts ids wrong. -#define CLINTAR_SPIRIT_SAY_START -1000286 -#define CLINTAR_SPIRIT_SAY_UNDER_ATTACK_1 -1000287 -#define CLINTAR_SPIRIT_SAY_UNDER_ATTACK_2 -1000288 -#define CLINTAR_SPIRIT_SAY_GET_ONE -1000289 -#define CLINTAR_SPIRIT_SAY_GET_TWO -1000290 -#define CLINTAR_SPIRIT_SAY_GET_THREE -1000291 -#define CLINTAR_SPIRIT_SAY_GET_FINAL -1000292 +Position const AspectRavenSummon = {7472.96f, -3074.18f, 427.566f, 0.0f}; +Position const ClintarSpiritSummon = {7459.2275f, -3122.5632f, 438.9842f, 0.8594f}; + +enum ClintarSpirit +{ + ASPECT_RAVEN = 22915, + + //from -1000292 to -1000287 are signed for 7806. but all this texts ids wrong. + CLINTAR_SPIRIT_SAY_START = -1000286, + CLINTAR_SPIRIT_SAY_UNDER_ATTACK_1 = -1000287, + CLINTAR_SPIRIT_SAY_UNDER_ATTACK_2 = -1000288, + CLINTAR_SPIRIT_SAY_GET_ONE = -1000289, + CLINTAR_SPIRIT_SAY_GET_TWO = -1000290, + CLINTAR_SPIRIT_SAY_GET_THREE = -1000291, + CLINTAR_SPIRIT_SAY_GET_FINAL = -1000292 +}; class npc_clintar_spirit : public CreatureScript { @@ -296,16 +296,16 @@ public: struct npc_clintar_spiritAI : public npc_escortAI { public: - npc_clintar_spiritAI(Creature* c) : npc_escortAI(c) {} + npc_clintar_spiritAI(Creature* creature) : npc_escortAI(creature) {} - uint32 Step; + uint8 Step; uint32 CurrWP; - uint32 Event_Timer; - uint32 checkPlayer_Timer; + uint32 EventTimer; + uint32 checkPlayerTimer; uint64 PlayerGUID; - bool Event_onWait; + bool EventOnWait; void Reset() { @@ -313,10 +313,10 @@ public: { Step = 0; CurrWP = 0; - Event_Timer = 0; + EventTimer = 0; PlayerGUID = 0; - checkPlayer_Timer = 1000; - Event_onWait = false; + checkPlayerTimer = 1000; + EventOnWait = false; } } @@ -347,8 +347,7 @@ public: void EnterCombat(Unit* who) { - uint32 rnd = rand()%2; - switch (rnd) + switch (urand(0, 1)) { case 0: DoScriptText(CLINTAR_SPIRIT_SAY_UNDER_ATTACK_1, me, who); break; case 1: DoScriptText(CLINTAR_SPIRIT_SAY_UNDER_ATTACK_2, me, who); break; @@ -357,9 +356,7 @@ public: void StartEvent(Player* player) { - if (!player) - return; - if (player->GetQuestStatus(10965) == QUEST_STATUS_INCOMPLETE) + if (player && player->GetQuestStatus(10965) == QUEST_STATUS_INCOMPLETE) { for (uint8 i = 0; i < 41; ++i) { @@ -381,18 +378,18 @@ public: return; } - if (!me->isInCombat() && !Event_onWait) + if (!me->isInCombat() && !EventOnWait) { - if (checkPlayer_Timer <= diff) + if (checkPlayerTimer <= diff) { Player* player = Unit::GetPlayer(*me, PlayerGUID); if (player && player->isInCombat() && player->getAttackerForHelper()) AttackStart(player->getAttackerForHelper()); - checkPlayer_Timer = 1000; - } else checkPlayer_Timer -= diff; + checkPlayerTimer = 1000; + } else checkPlayerTimer -= diff; } - if (Event_onWait && Event_Timer <= diff) + if (EventOnWait && EventTimer <= diff) { Player* player = Unit::GetPlayer(*me, PlayerGUID); @@ -409,11 +406,11 @@ public: { case 0: me->Say(CLINTAR_SPIRIT_SAY_START, 0, PlayerGUID); - Event_Timer = 8000; + EventTimer = 8000; Step = 1; break; case 1: - Event_onWait = false; + EventOnWait = false; break; } break; @@ -422,13 +419,13 @@ public: { case 0: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133); - Event_Timer = 5000; + EventTimer = 5000; Step = 1; break; case 1: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); DoScriptText(CLINTAR_SPIRIT_SAY_GET_ONE, me, player); - Event_onWait = false; + EventOnWait = false; break; } break; @@ -437,12 +434,12 @@ public: { case 0: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133); - Event_Timer = 5000; + EventTimer = 5000; Step = 1; break; case 1: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); - Event_onWait = false; + EventOnWait = false; break; } break; @@ -451,11 +448,11 @@ public: { case 0: DoScriptText(CLINTAR_SPIRIT_SAY_GET_TWO, me, player); - Event_Timer = 15000; + EventTimer = 15000; Step = 1; break; case 1: - Event_onWait = false; + EventOnWait = false; break; } break; @@ -463,19 +460,16 @@ public: switch (Step) { case 0: - { - Creature* mob = me->SummonCreature(ASPECT_RAVEN, ASPECT_RAVEN_SUMMON_X, ASPECT_RAVEN_SUMMON_Y, ASPECT_RAVEN_SUMMON_Z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000); - if (mob) + if (Creature* mob = me->SummonCreature(ASPECT_RAVEN, AspectRavenSummon, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000)) { mob->AddThreat(me, 10000.0f); mob->AI()->AttackStart(me); } - Event_Timer = 2000; + EventTimer = 2000; Step = 1; break; - } case 1: - Event_onWait = false; + EventOnWait = false; break; } break; @@ -484,12 +478,12 @@ public: { case 0: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133); - Event_Timer = 5000; + EventTimer = 5000; Step = 1; break; case 1: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); - Event_onWait = false; + EventOnWait = false; break; } break; @@ -498,11 +492,11 @@ public: { case 0: DoScriptText(CLINTAR_SPIRIT_SAY_GET_THREE, me, player); - Event_Timer = 4000; + EventTimer = 4000; Step = 1; break; case 1: - Event_onWait = false; + EventOnWait = false; break; } break; @@ -513,12 +507,12 @@ public: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 2); DoScriptText(CLINTAR_SPIRIT_SAY_GET_FINAL, me, player); player->CompleteQuest(10965); - Event_Timer = 1500; + EventTimer = 1500; Step = 1; break; case 1: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); - Event_Timer = 3000; + EventTimer = 3000; Step = 2; break; case 2: @@ -530,19 +524,19 @@ public: } break; default: - Event_onWait = false; + EventOnWait = false; break; } - } else if (Event_onWait) Event_Timer -= diff; + } else if (EventOnWait) EventTimer -= diff; } - void WaypointReached(uint32 id) + void WaypointReached(uint32 waypointId) { - CurrWP = id; - Event_Timer = 0; + CurrWP = waypointId; + EventTimer = 0; Step = 0; - Event_onWait = true; + EventOnWait = true; } }; @@ -552,7 +546,10 @@ public: # npc_clintar_dreamwalker ####*/ -#define CLINTAR_SPIRIT 22916 +enum Clintar +{ + CLINTAR_SPIRIT = 22916 +}; class npc_clintar_dreamwalker : public CreatureScript { @@ -562,11 +559,8 @@ public: bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) { if (quest->GetQuestId() == 10965) - { - Creature* clintar_spirit = creature->SummonCreature(CLINTAR_SPIRIT, CLINTAR_SPIRIT_SUMMON_X, CLINTAR_SPIRIT_SUMMON_Y, CLINTAR_SPIRIT_SUMMON_Z, CLINTAR_SPIRIT_SUMMON_O, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 100000); - if (clintar_spirit) + if (Creature* clintar_spirit = creature->SummonCreature(CLINTAR_SPIRIT, ClintarSpiritSummon, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 100000)) CAST_AI(npc_clintar_spirit::npc_clintar_spiritAI, clintar_spirit->AI())->StartEvent(player); - } return true; } diff --git a/src/server/scripts/Kalimdor/mulgore.cpp b/src/server/scripts/Kalimdor/mulgore.cpp index c689d6954a4..5b35688c2b8 100644 --- a/src/server/scripts/Kalimdor/mulgore.cpp +++ b/src/server/scripts/Kalimdor/mulgore.cpp @@ -29,8 +29,9 @@ npc_kyle_frenzied npc_plains_vision EndContentData */ -#include "ScriptPCH.h" -#include "ScriptedEscortAI.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /*###### # npc_skorn_whitecloud @@ -43,10 +44,10 @@ class npc_skorn_whitecloud : public CreatureScript public: npc_skorn_whitecloud() : CreatureScript("npc_skorn_whitecloud") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF) + if (action == GOSSIP_ACTION_INFO_DEF) player->SEND_GOSSIP_MENU(523, creature->GetGUID()); return true; @@ -71,7 +72,7 @@ public: # npc_kyle_frenzied ######*/ -enum eKyleFrenzied +enum KyleFrenzied { //emote signed for 7780 but propably thats wrong id. EMOTE_SEE_LUNCH = -1000340, @@ -96,32 +97,32 @@ public: struct npc_kyle_frenziedAI : public ScriptedAI { - npc_kyle_frenziedAI(Creature* c) : ScriptedAI(c) {} + npc_kyle_frenziedAI(Creature* creature) : ScriptedAI(creature) {} - bool bEvent; - bool m_bIsMovingToLunch; - uint64 uiPlayerGUID; - uint32 uiEventTimer; - uint8 uiEventPhase; + bool EventActive; + bool IsMovingToLunch; + uint64 PlayerGUID; + uint32 EventTimer; + uint8 EventPhase; void Reset() { - bEvent = false; - m_bIsMovingToLunch = false; - uiPlayerGUID = 0; - uiEventTimer = 5000; - uiEventPhase = 0; + EventActive = false; + IsMovingToLunch = false; + PlayerGUID = 0; + EventTimer = 5000; + EventPhase = 0; if (me->GetEntry() == NPC_KYLE_FRIENDLY) me->UpdateEntry(NPC_KYLE_FRENZIED); } - void SpellHit(Unit* pCaster, SpellInfo const* pSpell) + void SpellHit(Unit* Caster, SpellInfo const* Spell) { - if (!me->getVictim() && !bEvent && pSpell->Id == SPELL_LUNCH) + if (!me->getVictim() && !EventActive && Spell->Id == SPELL_LUNCH) { - if (pCaster->GetTypeId() == TYPEID_PLAYER) - uiPlayerGUID = pCaster->GetGUID(); + if (Caster->GetTypeId() == TYPEID_PLAYER) + PlayerGUID = Caster->GetGUID(); if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) { @@ -130,41 +131,41 @@ public: me->StopMoving(); } - bEvent = true; + EventActive = true; DoScriptText(EMOTE_SEE_LUNCH, me); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_CREATURE_SPECIAL); } } - void MovementInform(uint32 uiType, uint32 uiPointId) + void MovementInform(uint32 Type, uint32 PointId) { - if (uiType != POINT_MOTION_TYPE || !bEvent) + if (Type != POINT_MOTION_TYPE || !EventActive) return; - if (uiPointId == POINT_ID) - m_bIsMovingToLunch = false; + if (PointId == POINT_ID) + IsMovingToLunch = false; } void UpdateAI(const uint32 diff) { - if (bEvent) + if (EventActive) { - if (m_bIsMovingToLunch) + if (IsMovingToLunch) return; - if (uiEventTimer <= diff) + if (EventTimer <= diff) { - uiEventTimer = 5000; - ++uiEventPhase; + EventTimer = 5000; + ++EventPhase; - switch (uiEventPhase) + switch (EventPhase) { case 1: - if (Unit* unit = Unit::GetUnit(*me, uiPlayerGUID)) + if (Unit* unit = Unit::GetUnit(*me, PlayerGUID)) { if (GameObject* go = unit->GetGameObject(SPELL_LUNCH)) { - m_bIsMovingToLunch = true; + IsMovingToLunch = true; me->GetMotionMaster()->MovePoint(POINT_ID, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ()); } } @@ -174,13 +175,13 @@ public: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USE_STANDING); break; case 3: - if (Player* unit = Unit::GetPlayer(*me, uiPlayerGUID)) + if (Player* unit = Unit::GetPlayer(*me, PlayerGUID)) unit->TalkedToCreature(me->GetEntry(), me->GetGUID()); me->UpdateEntry(NPC_KYLE_FRIENDLY); break; case 4: - uiEventTimer = 30000; + EventTimer = 30000; DoScriptText(EMOTE_DANCE, me); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_DANCESPECIAL); break; @@ -192,7 +193,7 @@ public: } } else - uiEventTimer -= diff; + EventTimer -= diff; } } }; @@ -203,58 +204,58 @@ public: # npc_plains_vision ######*/ -float wp_plain_vision[50][3] = +Position const wpPlainVision[50] = { - {-2226.32f, -408.095f, -9.36235f}, - {-2203.04f, -437.212f, -5.72498f}, - {-2163.91f, -457.851f, -7.09049f}, - {-2123.87f, -448.137f, -9.29591f}, - {-2104.66f, -427.166f, -6.49513f}, - {-2101.48f, -422.826f, -5.3567f}, - {-2097.56f, -417.083f, -7.16716f}, - {-2084.87f, -398.626f, -9.88973f}, - {-2072.71f, -382.324f, -10.2488f}, - {-2054.05f, -356.728f, -6.22468f}, - {-2051.8f, -353.645f, -5.35791f}, - {-2049.08f, -349.912f, -6.15723f}, - {-2030.6f, -310.724f, -9.59302f}, - {-2002.15f, -249.308f, -10.8124f}, - {-1972.85f, -195.811f, -10.6316f}, - {-1940.93f, -147.652f, -11.7055f}, - {-1888.06f, -81.943f, -11.4404f}, - {-1837.05f, -34.0109f, -12.258f}, - {-1796.12f, -14.6462f, -10.3581f}, - {-1732.61f, -4.27746f, -10.0213f}, - {-1688.94f, -0.829945f, -11.7103f}, - {-1681.32f, 13.0313f, -9.48056f}, - {-1677.04f, 36.8349f, -7.10318f}, - {-1675.2f, 68.559f, -8.95384f}, - {-1676.57f, 89.023f, -9.65104f}, - {-1678.16f, 110.939f, -10.1782f}, - {-1677.86f, 128.681f, -5.73869f}, - {-1675.27f, 144.324f, -3.47916f}, - {-1671.7f, 163.169f, -1.23098f}, - {-1666.61f, 181.584f, 5.26145f}, - {-1661.51f, 196.154f, 8.95252f}, - {-1655.47f, 210.811f, 8.38727f}, - {-1647.07f, 226.947f, 5.27755f}, - {-1621.65f, 232.91f, 2.69579f}, - {-1600.23f, 237.641f, 2.98539f}, - {-1576.07f, 242.546f, 4.66541f}, - {-1554.57f, 248.494f, 6.60377f}, - {-1547.53f, 259.302f, 10.6741f}, - {-1541.7f, 269.847f, 16.4418f}, - {-1539.83f, 278.989f, 21.0597f}, - {-1540.16f, 290.219f, 27.8247f}, - {-1538.99f, 298.983f, 34.0032f}, - {-1540.38f, 307.337f, 41.3557f}, - {-1536.61f, 314.884f, 48.0179f}, - {-1532.42f, 323.277f, 55.6667f}, - {-1528.77f, 329.774f, 61.1525f}, - {-1525.65f, 333.18f, 63.2161f}, - {-1517.01f, 350.713f, 62.4286f}, - {-1511.39f, 362.537f, 62.4539f}, - {-1508.68f, 366.822f, 62.733f} + {-2226.32f, -408.095f, -9.36235f, 0.0f}, + {-2203.04f, -437.212f, -5.72498f, 0.0f}, + {-2163.91f, -457.851f, -7.09049f, 0.0f}, + {-2123.87f, -448.137f, -9.29591f, 0.0f}, + {-2104.66f, -427.166f, -6.49513f, 0.0f}, + {-2101.48f, -422.826f, -5.3567f, 0.0f}, + {-2097.56f, -417.083f, -7.16716f, 0.0f}, + {-2084.87f, -398.626f, -9.88973f, 0.0f}, + {-2072.71f, -382.324f, -10.2488f, 0.0f}, + {-2054.05f, -356.728f, -6.22468f, 0.0f}, + {-2051.8f, -353.645f, -5.35791f, 0.0f}, + {-2049.08f, -349.912f, -6.15723f, 0.0f}, + {-2030.6f, -310.724f, -9.59302f, 0.0f}, + {-2002.15f, -249.308f, -10.8124f, 0.0f}, + {-1972.85f, -195.811f, -10.6316f, 0.0f}, + {-1940.93f, -147.652f, -11.7055f, 0.0f}, + {-1888.06f, -81.943f, -11.4404f, 0.0f}, + {-1837.05f, -34.0109f, -12.258f, 0.0f}, + {-1796.12f, -14.6462f, -10.3581f, 0.0f}, + {-1732.61f, -4.27746f, -10.0213f, 0.0f}, + {-1688.94f, -0.829945f, -11.7103f, 0.0f}, + {-1681.32f, 13.0313f, -9.48056f, 0.0f}, + {-1677.04f, 36.8349f, -7.10318f, 0.0f}, + {-1675.2f, 68.559f, -8.95384f, 0.0f}, + {-1676.57f, 89.023f, -9.65104f, 0.0f}, + {-1678.16f, 110.939f, -10.1782f, 0.0f}, + {-1677.86f, 128.681f, -5.73869f, 0.0f}, + {-1675.27f, 144.324f, -3.47916f, 0.0f}, + {-1671.7f, 163.169f, -1.23098f, 0.0f}, + {-1666.61f, 181.584f, 5.26145f, 0.0f}, + {-1661.51f, 196.154f, 8.95252f, 0.0f}, + {-1655.47f, 210.811f, 8.38727f, 0.0f}, + {-1647.07f, 226.947f, 5.27755f, 0.0f}, + {-1621.65f, 232.91f, 2.69579f, 0.0f}, + {-1600.23f, 237.641f, 2.98539f, 0.0f}, + {-1576.07f, 242.546f, 4.66541f, 0.0f}, + {-1554.57f, 248.494f, 6.60377f, 0.0f}, + {-1547.53f, 259.302f, 10.6741f, 0.0f}, + {-1541.7f, 269.847f, 16.4418f, 0.0f}, + {-1539.83f, 278.989f, 21.0597f, 0.0f}, + {-1540.16f, 290.219f, 27.8247f, 0.0f}, + {-1538.99f, 298.983f, 34.0032f, 0.0f}, + {-1540.38f, 307.337f, 41.3557f, 0.0f}, + {-1536.61f, 314.884f, 48.0179f, 0.0f}, + {-1532.42f, 323.277f, 55.6667f, 0.0f}, + {-1528.77f, 329.774f, 61.1525f, 0.0f}, + {-1525.65f, 333.18f, 63.2161f, 0.0f}, + {-1517.01f, 350.713f, 62.4286f, 0.0f}, + {-1511.39f, 362.537f, 62.4539f, 0.0f}, + {-1508.68f, 366.822f, 62.733f, 0.0f} }; class npc_plains_vision : public CreatureScript @@ -269,7 +270,7 @@ public: struct npc_plains_visionAI : public ScriptedAI { - npc_plains_visionAI(Creature* c) : ScriptedAI(c) {} + npc_plains_visionAI(Creature* creature) : ScriptedAI(creature) {} bool newWaypoint; uint8 WayPointId; @@ -305,7 +306,7 @@ public: { if (newWaypoint) { - me->GetMotionMaster()->MovePoint(WayPointId, wp_plain_vision[WayPointId][0], wp_plain_vision[WayPointId][1], wp_plain_vision[WayPointId][2]); + me->GetMotionMaster()->MovePoint(WayPointId, wpPlainVision[WayPointId]); newWaypoint = false; } } diff --git a/src/server/scripts/Kalimdor/orgrimmar.cpp b/src/server/scripts/Kalimdor/orgrimmar.cpp index 629abb84fc1..fca8d0f5fc5 100644 --- a/src/server/scripts/Kalimdor/orgrimmar.cpp +++ b/src/server/scripts/Kalimdor/orgrimmar.cpp @@ -28,13 +28,15 @@ npc_shenthul npc_thrall_warchief EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /*###### ## npc_shenthul ######*/ -enum eShenthul +enum Shenthul { QUEST_SHATTERED_SALUTE = 2460 }; @@ -61,20 +63,20 @@ public: struct npc_shenthulAI : public ScriptedAI { - npc_shenthulAI(Creature* c) : ScriptedAI(c) {} + npc_shenthulAI(Creature* creature) : ScriptedAI(creature) {} bool CanTalk; bool CanEmote; - uint32 Salute_Timer; - uint32 Reset_Timer; + uint32 SaluteTimer; + uint32 ResetTimer; uint64 PlayerGUID; void Reset() { CanTalk = false; CanEmote = false; - Salute_Timer = 6000; - Reset_Timer = 0; + SaluteTimer = 6000; + ResetTimer = 0; PlayerGUID = 0; } @@ -84,7 +86,7 @@ public: { if (CanEmote) { - if (Reset_Timer <= diff) + if (ResetTimer <= diff) { if (Player* player = Unit::GetPlayer(*me, PlayerGUID)) { @@ -92,17 +94,17 @@ public: player->FailQuest(QUEST_SHATTERED_SALUTE); } Reset(); - } else Reset_Timer -= diff; + } else ResetTimer -= diff; } if (CanTalk && !CanEmote) { - if (Salute_Timer <= diff) + if (SaluteTimer <= diff) { me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); CanEmote = true; - Reset_Timer = 60000; - } else Salute_Timer -= diff; + ResetTimer = 60000; + } else SaluteTimer -= diff; } if (!UpdateVictim()) @@ -130,10 +132,13 @@ public: ## npc_thrall_warchief ######*/ -#define QUEST_6566 6566 +enum ThrallWarchief +{ + QUEST_6566 = 6566, -#define SPELL_CHAIN_LIGHTNING 16033 -#define SPELL_SHOCK 16034 + SPELL_CHAIN_LIGHTNING = 16033, + SPELL_SHOCK = 16034 +}; #define GOSSIP_HTW "Please share your wisdom with me, Warchief." #define GOSSIP_STW1 "What discoveries?" @@ -149,10 +154,10 @@ class npc_thrall_warchief : public CreatureScript public: npc_thrall_warchief() : CreatureScript("npc_thrall_warchief") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_STW1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); @@ -205,15 +210,15 @@ public: struct npc_thrall_warchiefAI : public ScriptedAI { - npc_thrall_warchiefAI(Creature* c) : ScriptedAI(c) {} + npc_thrall_warchiefAI(Creature* creature) : ScriptedAI(creature) {} - uint32 ChainLightning_Timer; - uint32 Shock_Timer; + uint32 ChainLightningTimer; + uint32 ShockTimer; void Reset() { - ChainLightning_Timer = 2000; - Shock_Timer = 8000; + ChainLightningTimer = 2000; + ShockTimer = 8000; } void EnterCombat(Unit* /*who*/) {} @@ -223,17 +228,17 @@ public: if (!UpdateVictim()) return; - if (ChainLightning_Timer <= diff) + if (ChainLightningTimer <= diff) { DoCast(me->getVictim(), SPELL_CHAIN_LIGHTNING); - ChainLightning_Timer = 9000; - } else ChainLightning_Timer -= diff; + ChainLightningTimer = 9000; + } else ChainLightningTimer -= diff; - if (Shock_Timer <= diff) + if (ShockTimer <= diff) { DoCast(me->getVictim(), SPELL_SHOCK); - Shock_Timer = 15000; - } else Shock_Timer -= diff; + ShockTimer = 15000; + } else ShockTimer -= diff; DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/Kalimdor/silithus.cpp b/src/server/scripts/Kalimdor/silithus.cpp index fac56021c3a..639de3dc3b2 100644 --- a/src/server/scripts/Kalimdor/silithus.cpp +++ b/src/server/scripts/Kalimdor/silithus.cpp @@ -29,7 +29,9 @@ npcs_rutgar_and_frankal quest_a_pawn_on_the_eternal_pawn EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "Group.h" /*### @@ -49,10 +51,10 @@ class npc_highlord_demitrian : public CreatureScript public: npc_highlord_demitrian() : CreatureScript("npc_highlord_demitrian") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); @@ -125,19 +127,21 @@ public: #define GOSSIP_ITEM14 "I should ask the monkey about this" #define GOSSIP_ITEM15 "Then what..." -//trigger creatures to kill -#define TRIGGER_RUTGAR 15222 -#define TRIGGER_FRANKAL 15221 +enum RutgarAndFrankal //trigger creatures to kill +{ + TRIGGER_FRANKAL = 15221, + TRIGGER_RUTGAR = 15222 +}; class npcs_rutgar_and_frankal : public CreatureScript { public: npcs_rutgar_and_frankal() : CreatureScript("npcs_rutgar_and_frankal") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -223,7 +227,7 @@ public: /*#### # quest_a_pawn_on_the_eternal_board (Defines) ####*/ -enum eEternalBoard +enum EternalBoard { QUEST_A_PAWN_ON_THE_ETERNAL_BOARD = 8519, @@ -290,7 +294,6 @@ TO DO: get correct spell IDs and timings for spells cast upon dragon transformat TO DO: Dragons should use the HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF) after transformation, but for some unknown reason it doesnt work. EndContentData */ -#define QUEST_A_PAWN_ON_THE_ETERNAL_BOARD 8519 #define EVENT_AREA_RADIUS 65 //65yds #define EVENT_COOLDOWN 500000 //in ms. appear after event completed or failed (should be = Adds despawn time) @@ -374,7 +377,7 @@ static QuestCinematic EventAnim[]= }; //Cordinates for Spawns -static const Position SpawnLocation[]= +Position const SpawnLocation[] = { {-8085.0f, 1528.0f, 2.61f, 3.141592f}, //Kaldorei Infantry {-8080.0f, 1526.0f, 2.61f, 3.141592f}, //Kaldorei Infantry @@ -455,7 +458,7 @@ struct WaveData int32 WaveTextId; }; -static WaveData WavesInfo[] = +static WaveData WavesInfo[5] = { {30, 0, 15423, 0, 0, 24000, 0}, // Kaldorei Soldier { 3, 35, 15424, 0, 0, 24000, 0}, // Anubisath Conqueror @@ -470,7 +473,7 @@ struct SpawnSpells uint32 Timer1, Timer2, SpellId; }; -static SpawnSpells SpawnCast[]=// +static SpawnSpells SpawnCast[4] = { {100000, 2000, 33652}, // Stop Time {38500, 300000, 28528}, // Poison Cloud @@ -485,14 +488,14 @@ class npc_anachronos_the_ancient : public CreatureScript public: npc_anachronos_the_ancient() : CreatureScript("npc_anachronos_the_ancient") { } - CreatureAI* GetAI(Creature* c) const + CreatureAI* GetAI(Creature* creature) const { - return new npc_anachronos_the_ancientAI(c); + return new npc_anachronos_the_ancientAI(creature); } struct npc_anachronos_the_ancientAI : public ScriptedAI { - npc_anachronos_the_ancientAI(Creature* c) : ScriptedAI(c) {} + npc_anachronos_the_ancientAI(Creature* creature) : ScriptedAI(creature) {} uint32 AnimationTimer; uint8 AnimationCount; @@ -576,7 +579,7 @@ public: break; case 10: Merithra->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - Merithra->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + Merithra->SetDisableGravity(true); Merithra->GetMotionMaster()->MoveCharge(-8065, 1530, 6.61f, 3); break; case 11: @@ -603,7 +606,7 @@ public: break; case 18: Arygos->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - Arygos->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + Arygos->SetDisableGravity(true); Arygos->GetMotionMaster()->MoveCharge(-8065, 1530, 6.61f, 42); break; case 19: @@ -630,7 +633,7 @@ public: break; case 26: Caelestrasz->HandleEmoteCommand(254); - Caelestrasz->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + Caelestrasz->SetDisableGravity(true); Caelestrasz->GetMotionMaster()->MoveCharge(-8065, 1530, 7.61f, 4); break; case 27: @@ -769,7 +772,7 @@ public: break; case 63: me->HandleEmoteCommand(254); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetDisableGravity(true); break; case 64: me->GetMotionMaster()->MoveCharge(-8000, 1400, 150, 9); @@ -813,14 +816,14 @@ class mob_qiraj_war_spawn : public CreatureScript public: mob_qiraj_war_spawn() : CreatureScript("mob_qiraj_war_spawn") { } - CreatureAI* GetAI(Creature* c) const + CreatureAI* GetAI(Creature* creature) const { - return new mob_qiraj_war_spawnAI(c); + return new mob_qiraj_war_spawnAI(creature); } struct mob_qiraj_war_spawnAI : public ScriptedAI { - mob_qiraj_war_spawnAI(Creature* c) : ScriptedAI(c) {} + mob_qiraj_war_spawnAI(Creature* creature) : ScriptedAI(creature) {} uint64 MobGUID; uint64 PlayerGUID; @@ -928,14 +931,14 @@ class npc_anachronos_quest_trigger : public CreatureScript public: npc_anachronos_quest_trigger() : CreatureScript("npc_anachronos_quest_trigger") { } - CreatureAI* GetAI(Creature* c) const + CreatureAI* GetAI(Creature* creature) const { - return new npc_anachronos_quest_triggerAI(c); + return new npc_anachronos_quest_triggerAI(creature); } struct npc_anachronos_quest_triggerAI : public ScriptedAI { - npc_anachronos_quest_triggerAI(Creature* c) : ScriptedAI(c) {} + npc_anachronos_quest_triggerAI(Creature* creature) : ScriptedAI(creature) {} uint64 PlayerGUID; @@ -967,16 +970,15 @@ public: void SummonNextWave() { - //uint8 count = WavesInfo[WaveCount].SpawnCount; uint8 locIndex = WavesInfo[WaveCount].UsedSpawnPoint; - //uint8 KaldoreiSoldierCount = 0; - //uint8 AnubisathConquerorCount = 0; - //uint8 QirajiWaspCount = 0; - for (uint8 i = 0; i < 67; ++i) + uint8 count = locIndex + WavesInfo[WaveCount].SpawnCount; + + for (uint8 i = locIndex; i <= count; ++i) { - if (Creature* spawn = me->SummonCreature(WavesInfo[WaveCount].CreatureId, SpawnLocation[locIndex + i], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, WavesInfo[WaveCount].DespTimer)) + uint32 desptimer = WavesInfo[WaveCount].DespTimer; + + if (Creature* spawn = me->SummonCreature(WavesInfo[WaveCount].CreatureId, SpawnLocation[i], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, desptimer)) { - spawn->LoadCreaturesAddon(); if (spawn->GetEntry() == 15423) spawn->SetUInt32Value(UNIT_FIELD_DISPLAYID, 15427+rand()%4); if (i >= 30) WaveCount = 1; @@ -986,12 +988,15 @@ public: if (WaveCount < 5) //1-4 Wave { - mob_qiraj_war_spawn::mob_qiraj_war_spawnAI* spawnAI = CAST_AI(mob_qiraj_war_spawn::mob_qiraj_war_spawnAI, spawn->AI()); - spawnAI->MobGUID = me->GetGUID(); - spawnAI->PlayerGUID = PlayerGUID; + if (mob_qiraj_war_spawn::mob_qiraj_war_spawnAI* spawnAI = CAST_AI(mob_qiraj_war_spawn::mob_qiraj_war_spawnAI, spawn->AI())) + { + spawnAI->MobGUID = me->GetGUID(); + spawnAI->PlayerGUID = PlayerGUID; + } } } } + WaveTimer = WavesInfo[WaveCount].SpawnTimer; AnnounceTimer = WavesInfo[WaveCount].YellTimer; } @@ -1005,27 +1010,27 @@ public: if (Group* EventGroup = player->GetGroup()) { - Player* GroupMember; + Player* groupMember; uint8 GroupMemberCount = 0; uint8 DeadMemberCount = 0; uint8 FailedMemberCount = 0; - const Group::MemberSlotList members = EventGroup->GetMemberSlots(); + Group::MemberSlotList const members = EventGroup->GetMemberSlots(); for (Group::member_citerator itr = members.begin(); itr!= members.end(); ++itr) { - GroupMember = (Unit::GetPlayer(*me, itr->guid)); - if (!GroupMember) + groupMember = (Unit::GetPlayer(*me, itr->guid)); + if (!groupMember) continue; - if (!GroupMember->IsWithinDistInMap(me, EVENT_AREA_RADIUS) && GroupMember->GetQuestStatus(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD) == QUEST_STATUS_INCOMPLETE) + if (!groupMember->IsWithinDistInMap(me, EVENT_AREA_RADIUS) && groupMember->GetQuestStatus(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD) == QUEST_STATUS_INCOMPLETE) { - GroupMember->FailQuest(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD); + groupMember->FailQuest(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD); ++FailedMemberCount; } ++GroupMemberCount; - if (GroupMember->isDead()) + if (groupMember->isDead()) ++DeadMemberCount; } @@ -1069,8 +1074,13 @@ public: void mob_qiraj_war_spawn::mob_qiraj_war_spawnAI::JustDied(Unit* /*slayer*/) { me->RemoveCorpse(); - if (Creature* Mob = (Unit::GetCreature(*me, MobGUID))) - CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, Mob->AI())->LiveCounter(); + + if (!MobGUID) + return; + + if (Creature* mob = Unit::GetCreature(*me, MobGUID)) + if (npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI* triggerAI = CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, mob->AI())) + triggerAI->LiveCounter(); }; @@ -1087,15 +1097,13 @@ public: { if (quest->GetQuestId() == QUEST_A_PAWN_ON_THE_ETERNAL_BOARD) { - - if (Unit* Anachronos_Quest_Trigger = go->FindNearestCreature(15454, 100, player)) + if (Creature* trigger = go->FindNearestCreature(15454, 100, player)) { - - Unit* Merithra = Anachronos_Quest_Trigger->SummonCreature(15378, -8034.535f, 1535.14f, 2.61f, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 220000); - Unit* Caelestrasz = Anachronos_Quest_Trigger->SummonCreature(15379, -8032.767f, 1533.148f, 2.61f, 1.5f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 220000); - Unit* Arygos = Anachronos_Quest_Trigger->SummonCreature(15380, -8034.52f, 1537.843f, 2.61f, 5.7f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 220000); - /* Unit* Fandral = */ Anachronos_Quest_Trigger->SummonCreature(15382, -8028.462f, 1535.843f, 2.61f, 3.141592f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 220000); - Creature* Anachronos = Anachronos_Quest_Trigger->SummonCreature(15381, -8028.75f, 1538.795f, 2.61f, 4, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 220000); + Unit* Merithra = trigger->SummonCreature(15378, -8034.535f, 1535.14f, 2.61f, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 220000); + Unit* Caelestrasz = trigger->SummonCreature(15379, -8032.767f, 1533.148f, 2.61f, 1.5f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 220000); + Unit* Arygos = trigger->SummonCreature(15380, -8034.52f, 1537.843f, 2.61f, 5.7f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 220000); + /* Unit* Fandral = */ trigger->SummonCreature(15382, -8028.462f, 1535.843f, 2.61f, 3.141592f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 220000); + Creature* Anachronos = trigger->SummonCreature(15381, -8028.75f, 1538.795f, 2.61f, 4, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 220000); if (Merithra) { @@ -1123,11 +1131,16 @@ public: if (Anachronos) { - CAST_AI(npc_anachronos_the_ancient::npc_anachronos_the_ancientAI, Anachronos->AI())->PlayerGUID = player->GetGUID(); - CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, CAST_CRE(Anachronos_Quest_Trigger)->AI())->Failed=false; - CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, CAST_CRE(Anachronos_Quest_Trigger)->AI())->PlayerGUID = player->GetGUID(); - CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, CAST_CRE(Anachronos_Quest_Trigger)->AI())->EventStarted=true; - CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, CAST_CRE(Anachronos_Quest_Trigger)->AI())->Announced=true; + if (npc_anachronos_the_ancient::npc_anachronos_the_ancientAI* anachronosAI = CAST_AI(npc_anachronos_the_ancient::npc_anachronos_the_ancientAI, Anachronos->AI())) + anachronosAI->PlayerGUID = player->GetGUID(); + + if (npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI* triggerAI = CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, trigger->AI())) + { + triggerAI->Failed = false; + triggerAI->PlayerGUID = player->GetGUID(); + triggerAI->EventStarted = true; + triggerAI->Announced = true; + } } } } diff --git a/src/server/scripts/Kalimdor/stonetalon_mountains.cpp b/src/server/scripts/Kalimdor/stonetalon_mountains.cpp index c31a7731865..d38395c7b37 100644 --- a/src/server/scripts/Kalimdor/stonetalon_mountains.cpp +++ b/src/server/scripts/Kalimdor/stonetalon_mountains.cpp @@ -28,7 +28,9 @@ npc_braug_dimspirit npc_kaya_flathoof EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" /*###### @@ -46,16 +48,16 @@ class npc_braug_dimspirit : public CreatureScript public: npc_braug_dimspirit() : CreatureScript("npc_braug_dimspirit") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { player->CLOSE_GOSSIP_MENU(); creature->CastSpell(player, 6766, false); } - if (uiAction == GOSSIP_ACTION_INFO_DEF+2) + if (action == GOSSIP_ACTION_INFO_DEF+2) { player->CLOSE_GOSSIP_MENU(); player->AreaExploredOrEventHappens(6627); @@ -90,7 +92,7 @@ public: ## npc_kaya_flathoof ######*/ -enum eKaya +enum Kaya { FACTION_ESCORTEE_H = 775, @@ -112,28 +114,27 @@ public: struct npc_kaya_flathoofAI : public npc_escortAI { - npc_kaya_flathoofAI(Creature* c) : npc_escortAI(c) {} + npc_kaya_flathoofAI(Creature* creature) : npc_escortAI(creature) {} - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); - if (!player) return; - switch (i) + switch (waypointId) { - case 16: - DoScriptText(SAY_AMBUSH, me); - me->SummonCreature(NPC_GRIMTOTEM_BRUTE, -48.53f, -503.34f, -46.31f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_GRIMTOTEM_RUFFIAN, -38.85f, -503.77f, -45.90f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_GRIMTOTEM_SORCERER, -36.37f, -496.23f, -45.71f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case 18: me->SetInFront(player); - DoScriptText(SAY_END, me, player); - if (player) + case 16: + DoScriptText(SAY_AMBUSH, me); + me->SummonCreature(NPC_GRIMTOTEM_BRUTE, -48.53f, -503.34f, -46.31f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_GRIMTOTEM_RUFFIAN, -38.85f, -503.77f, -45.90f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_GRIMTOTEM_SORCERER, -36.37f, -496.23f, -45.71f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case 18: + me->SetInFront(player); + DoScriptText(SAY_END, me, player); player->GroupEventHappens(QUEST_PROTECT_KAYA, me); - break; + break; } } diff --git a/src/server/scripts/Kalimdor/tanaris.cpp b/src/server/scripts/Kalimdor/tanaris.cpp index ff6cdccb66a..9b742b495bb 100644 --- a/src/server/scripts/Kalimdor/tanaris.cpp +++ b/src/server/scripts/Kalimdor/tanaris.cpp @@ -33,7 +33,9 @@ npc_OOX17 npc_tooga EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" #include "ScriptedFollowerAI.h" @@ -41,10 +43,13 @@ EndContentData */ ## mob_aquementas ######*/ -#define AGGRO_YELL_AQUE -1000350 +enum Aquementas +{ + AGGRO_YELL_AQUE = -1000350, -#define SPELL_AQUA_JET 13586 -#define SPELL_FROST_SHOCK 15089 + SPELL_AQUA_JET = 13586, + SPELL_FROST_SHOCK = 15089 +}; class mob_aquementas : public CreatureScript { @@ -58,24 +63,24 @@ public: struct mob_aquementasAI : public ScriptedAI { - mob_aquementasAI(Creature* c) : ScriptedAI(c) {} + mob_aquementasAI(Creature* creature) : ScriptedAI(creature) {} - uint32 SendItem_Timer; - uint32 SwitchFaction_Timer; + uint32 SendItemTimer; + uint32 SwitchFactionTimer; bool isFriendly; - uint32 FrostShock_Timer; - uint32 AquaJet_Timer; + uint32 FrostShockTimer; + uint32 AquaJetTimer; void Reset() { - SendItem_Timer = 0; - SwitchFaction_Timer = 10000; + SendItemTimer = 0; + SwitchFactionTimer = 10000; me->setFaction(35); isFriendly = true; - AquaJet_Timer = 5000; - FrostShock_Timer = 1000; + AquaJetTimer = 5000; + FrostShockTimer = 1000; } void SendItem(Unit* receiver) @@ -101,11 +106,11 @@ public: { if (isFriendly) { - if (SwitchFaction_Timer <= diff) + if (SwitchFactionTimer <= diff) { me->setFaction(91); isFriendly = false; - } else SwitchFaction_Timer -= diff; + } else SwitchFactionTimer -= diff; } if (!UpdateVictim()) @@ -113,25 +118,25 @@ public: if (!isFriendly) { - if (SendItem_Timer <= diff) + if (SendItemTimer <= diff) { if (me->getVictim()->GetTypeId() == TYPEID_PLAYER) SendItem(me->getVictim()); - SendItem_Timer = 5000; - } else SendItem_Timer -= diff; + SendItemTimer = 5000; + } else SendItemTimer -= diff; } - if (FrostShock_Timer <= diff) + if (FrostShockTimer <= diff) { DoCast(me->getVictim(), SPELL_FROST_SHOCK); - FrostShock_Timer = 15000; - } else FrostShock_Timer -= diff; + FrostShockTimer = 15000; + } else FrostShockTimer -= diff; - if (AquaJet_Timer <= diff) + if (AquaJetTimer <= diff) { DoCast(me, SPELL_AQUA_JET); - AquaJet_Timer = 15000; - } else AquaJet_Timer -= diff; + AquaJetTimer = 15000; + } else AquaJetTimer -= diff; DoMeleeAttackIfReady(); } @@ -143,20 +148,23 @@ public: ## npc_custodian_of_time ######*/ -#define WHISPER_CUSTODIAN_1 -1000217 -#define WHISPER_CUSTODIAN_2 -1000218 -#define WHISPER_CUSTODIAN_3 -1000219 -#define WHISPER_CUSTODIAN_4 -1000220 -#define WHISPER_CUSTODIAN_5 -1000221 -#define WHISPER_CUSTODIAN_6 -1000222 -#define WHISPER_CUSTODIAN_7 -1000223 -#define WHISPER_CUSTODIAN_8 -1000224 -#define WHISPER_CUSTODIAN_9 -1000225 -#define WHISPER_CUSTODIAN_10 -1000226 -#define WHISPER_CUSTODIAN_11 -1000227 -#define WHISPER_CUSTODIAN_12 -1000228 -#define WHISPER_CUSTODIAN_13 -1000229 -#define WHISPER_CUSTODIAN_14 -1000230 +enum CustodianOfTime +{ + WHISPER_CUSTODIAN_1 = -1000217, + WHISPER_CUSTODIAN_2 = -1000218, + WHISPER_CUSTODIAN_3 = -1000219, + WHISPER_CUSTODIAN_4 = -1000220, + WHISPER_CUSTODIAN_5 = -1000221, + WHISPER_CUSTODIAN_6 = -1000222, + WHISPER_CUSTODIAN_7 = -1000223, + WHISPER_CUSTODIAN_8 = -1000224, + WHISPER_CUSTODIAN_9 = -1000225, + WHISPER_CUSTODIAN_10 = -1000226, + WHISPER_CUSTODIAN_11 = -1000227, + WHISPER_CUSTODIAN_12 = -1000228, + WHISPER_CUSTODIAN_13 = -1000229, + WHISPER_CUSTODIAN_14 = -1000230 +}; class npc_custodian_of_time : public CreatureScript { @@ -170,39 +178,72 @@ public: struct npc_custodian_of_timeAI : public npc_escortAI { - npc_custodian_of_timeAI(Creature* c) : npc_escortAI(c) {} + npc_custodian_of_timeAI(Creature* creature) : npc_escortAI(creature) {} - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { - Player* player = GetPlayerForEscort(); - if (!player) - return; - - switch (i) + if (Player* player = GetPlayerForEscort()) { - case 0: DoScriptText(WHISPER_CUSTODIAN_1, me, player); break; - case 1: DoScriptText(WHISPER_CUSTODIAN_2, me, player); break; - case 2: DoScriptText(WHISPER_CUSTODIAN_3, me, player); break; - case 3: DoScriptText(WHISPER_CUSTODIAN_4, me, player); break; - case 5: DoScriptText(WHISPER_CUSTODIAN_5, me, player); break; - case 6: DoScriptText(WHISPER_CUSTODIAN_6, me, player); break; - case 7: DoScriptText(WHISPER_CUSTODIAN_7, me, player); break; - case 8: DoScriptText(WHISPER_CUSTODIAN_8, me, player); break; - case 9: DoScriptText(WHISPER_CUSTODIAN_9, me, player); break; - case 10: DoScriptText(WHISPER_CUSTODIAN_4, me, player); break; - case 13: DoScriptText(WHISPER_CUSTODIAN_10, me, player); break; - case 14: DoScriptText(WHISPER_CUSTODIAN_4, me, player); break; - case 16: DoScriptText(WHISPER_CUSTODIAN_11, me, player); break; - case 17: DoScriptText(WHISPER_CUSTODIAN_12, me, player); break; - case 18: DoScriptText(WHISPER_CUSTODIAN_4, me, player); break; - case 22: DoScriptText(WHISPER_CUSTODIAN_13, me, player); break; - case 23: DoScriptText(WHISPER_CUSTODIAN_4, me, player); break; - case 24: - DoScriptText(WHISPER_CUSTODIAN_14, me, player); - DoCast(player, 34883); - // below here is temporary workaround, to be removed when spell works properly - player->AreaExploredOrEventHappens(10277); - break; + switch (waypointId) + { + case 0: + DoScriptText(WHISPER_CUSTODIAN_1, me, player); + break; + case 1: + DoScriptText(WHISPER_CUSTODIAN_2, me, player); + break; + case 2: + DoScriptText(WHISPER_CUSTODIAN_3, me, player); + break; + case 3: + DoScriptText(WHISPER_CUSTODIAN_4, me, player); + break; + case 5: + DoScriptText(WHISPER_CUSTODIAN_5, me, player); + break; + case 6: + DoScriptText(WHISPER_CUSTODIAN_6, me, player); + break; + case 7: + DoScriptText(WHISPER_CUSTODIAN_7, me, player); + break; + case 8: + DoScriptText(WHISPER_CUSTODIAN_8, me, player); + break; + case 9: + DoScriptText(WHISPER_CUSTODIAN_9, me, player); + break; + case 10: + DoScriptText(WHISPER_CUSTODIAN_4, me, player); + break; + case 13: + DoScriptText(WHISPER_CUSTODIAN_10, me, player); + break; + case 14: + DoScriptText(WHISPER_CUSTODIAN_4, me, player); + break; + case 16: + DoScriptText(WHISPER_CUSTODIAN_11, me, player); + break; + case 17: + DoScriptText(WHISPER_CUSTODIAN_12, me, player); + break; + case 18: + DoScriptText(WHISPER_CUSTODIAN_4, me, player); + break; + case 22: + DoScriptText(WHISPER_CUSTODIAN_13, me, player); + break; + case 23: + DoScriptText(WHISPER_CUSTODIAN_4, me, player); + break; + case 24: + DoScriptText(WHISPER_CUSTODIAN_14, me, player); + DoCast(player, 34883); + // below here is temporary workaround, to be removed when spell works properly + player->AreaExploredOrEventHappens(10277); + break; + } } } @@ -225,7 +266,7 @@ public: } void EnterCombat(Unit* /*who*/) {} - void Reset() { } + void Reset() {} void UpdateAI(const uint32 diff) { @@ -244,10 +285,10 @@ class npc_marin_noggenfogger : public CreatureScript public: npc_marin_noggenfogger() : CreatureScript("npc_marin_noggenfogger") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_TRADE) + if (action == GOSSIP_ACTION_TRADE) player->GetSession()->SendListInventory(creature->GetGUID()); return true; @@ -287,10 +328,10 @@ public: return false; } - bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) + if (action == GOSSIP_ACTION_INFO_DEF + 1) player->CastSpell(player, 34891, true); //(Flight through Caverns) return true; @@ -330,10 +371,10 @@ class npc_stone_watcher_of_norgannon : public CreatureScript public: npc_stone_watcher_of_norgannon() : CreatureScript("npc_stone_watcher_of_norgannon") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); @@ -382,7 +423,7 @@ public: ## npc_OOX17 ######*/ -enum e00X17 +enum Npc00X17 { //texts are signed for 7806 SAY_OOX_START = -1000287, @@ -426,39 +467,33 @@ public: struct npc_OOX17AI : public npc_escortAI { - npc_OOX17AI(Creature* c) : npc_escortAI(c) {} + npc_OOX17AI(Creature* creature) : npc_escortAI(creature) {} - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { - Player* player = GetPlayerForEscort(); - - if (!player) - return; - - switch (i) { - case 23: - me->SummonCreature(SPAWN_FIRST, -8350.96f, -4445.79f, 10.10f, 6.20f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(SPAWN_FIRST, -8355.96f, -4447.79f, 10.10f, 6.27f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(SPAWN_FIRST, -8353.96f, -4442.79f, 10.10f, 6.08f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - DoScriptText(SAY_OOX_AMBUSH, me); - break; - - case 56: - me->SummonCreature(SPAWN_SECOND_1, -7510.07f, -4795.50f, 9.35f, 6.06f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(SPAWN_SECOND_2, -7515.07f, -4797.50f, 9.35f, 6.22f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(SPAWN_SECOND_2, -7518.07f, -4792.50f, 9.35f, 6.22f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - DoScriptText(SAY_OOX_AMBUSH, me); - if (Unit* scoff = me->FindNearestCreature(SPAWN_SECOND_2, 30)) - DoScriptText(SAY_OOX17_AMBUSH_REPLY, scoff); - break; - - case 86: - if (player) - { + if (Player* player = GetPlayerForEscort()) + { + switch (waypointId) + { + case 23: + me->SummonCreature(SPAWN_FIRST, -8350.96f, -4445.79f, 10.10f, 6.20f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(SPAWN_FIRST, -8355.96f, -4447.79f, 10.10f, 6.27f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(SPAWN_FIRST, -8353.96f, -4442.79f, 10.10f, 6.08f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + DoScriptText(SAY_OOX_AMBUSH, me); + break; + case 56: + me->SummonCreature(SPAWN_SECOND_1, -7510.07f, -4795.50f, 9.35f, 6.06f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(SPAWN_SECOND_2, -7515.07f, -4797.50f, 9.35f, 6.22f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(SPAWN_SECOND_2, -7518.07f, -4792.50f, 9.35f, 6.22f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + DoScriptText(SAY_OOX_AMBUSH, me); + if (Unit* scoff = me->FindNearestCreature(SPAWN_SECOND_2, 30)) + DoScriptText(SAY_OOX17_AMBUSH_REPLY, scoff); + break; + case 86: DoScriptText(SAY_OOX_END, me); player->GroupEventHappens(Q_OOX17, me); - } - break; + break; + } } } @@ -474,14 +509,13 @@ public: summoned->AI()->AttackStart(me); } }; - }; /*#### # npc_tooga ####*/ -enum eTooga +enum Tooga { SAY_TOOG_THIRST = -1000391, SAY_TOOG_WORRIED = -1000392, @@ -499,7 +533,7 @@ enum eTooga FACTION_TOOG_ESCORTEE = 113 }; -const float m_afToWaterLoc[] = {-7032.664551f, -4906.199219f, -1.606446f}; +Position const ToWaterLoc = {-7032.664551f, -4906.199219f, -1.606446f, 0.0f}; class npc_tooga : public CreatureScript { @@ -526,17 +560,17 @@ public: { npc_toogaAI(Creature* creature) : FollowerAI(creature) { } - uint32 m_uiCheckSpeechTimer; - uint32 m_uiPostEventTimer; - uint32 m_uiPhasePostEvent; + uint32 CheckSpeechTimer; + uint32 PostEventTimer; + uint32 PhasePostEvent; uint64 TortaGUID; void Reset() { - m_uiCheckSpeechTimer = 2500; - m_uiPostEventTimer = 1000; - m_uiPhasePostEvent = 0; + CheckSpeechTimer = 2500; + PostEventTimer = 1000; + PhasePostEvent = 0; TortaGUID = 0; } @@ -549,11 +583,9 @@ public: { if (me->IsWithinDistInMap(who, INTERACTION_DISTANCE)) { - if (Player* player = GetLeaderForFollower()) - { - if (player->GetQuestStatus(QUEST_TOOGA) == QUEST_STATUS_INCOMPLETE) - player->GroupEventHappens(QUEST_TOOGA, me); - } + Player* player = GetLeaderForFollower(); + if (player && player->GetQuestStatus(QUEST_TOOGA) == QUEST_STATUS_INCOMPLETE) + player->GroupEventHappens(QUEST_TOOGA, me); TortaGUID = who->GetGUID(); SetFollowComplete(true); @@ -561,27 +593,27 @@ public: } } - void MovementInform(uint32 uiMotionType, uint32 uiPointId) + void MovementInform(uint32 MotionType, uint32 PointId) { - FollowerAI::MovementInform(uiMotionType, uiPointId); + FollowerAI::MovementInform(MotionType, PointId); - if (uiMotionType != POINT_MOTION_TYPE) + if (MotionType != POINT_MOTION_TYPE) return; - if (uiPointId == POINT_ID_TO_WATER) + if (PointId == POINT_ID_TO_WATER) SetFollowComplete(); } - void UpdateFollowerAI(const uint32 uiDiff) + void UpdateFollowerAI(const uint32 Diff) { if (!UpdateVictim()) { //we are doing the post-event, or... if (HasFollowState(STATE_FOLLOW_POSTEVENT)) { - if (m_uiPostEventTimer <= uiDiff) + if (PostEventTimer <= Diff) { - m_uiPostEventTimer = 5000; + PostEventTimer = 5000; Unit* pTorta = Unit::GetUnit(*me, TortaGUID); if (!pTorta || !pTorta->isAlive()) @@ -591,7 +623,7 @@ public: return; } - switch (m_uiPhasePostEvent) + switch (PhasePostEvent) { case 1: DoScriptText(SAY_TOOG_POST_1, me); @@ -610,27 +642,27 @@ public: break; case 6: DoScriptText(SAY_TORT_POST_6, pTorta); - me->GetMotionMaster()->MovePoint(POINT_ID_TO_WATER, m_afToWaterLoc[0], m_afToWaterLoc[1], m_afToWaterLoc[2]); + me->GetMotionMaster()->MovePoint(POINT_ID_TO_WATER, ToWaterLoc); break; } - ++m_uiPhasePostEvent; + ++PhasePostEvent; } else - m_uiPostEventTimer -= uiDiff; + PostEventTimer -= Diff; } //...we are doing regular speech check else if (HasFollowState(STATE_FOLLOW_INPROGRESS)) { - if (m_uiCheckSpeechTimer <= uiDiff) + if (CheckSpeechTimer <= Diff) { - m_uiCheckSpeechTimer = 5000; + CheckSpeechTimer = 5000; if (urand(0, 9) > 8) DoScriptText(RAND(SAY_TOOG_THIRST, SAY_TOOG_WORRIED), me); } else - m_uiCheckSpeechTimer -= uiDiff; + CheckSpeechTimer -= Diff; } return; diff --git a/src/server/scripts/Kalimdor/teldrassil.cpp b/src/server/scripts/Kalimdor/teldrassil.cpp index d7cac99c374..7f2b2fc7f05 100644 --- a/src/server/scripts/Kalimdor/teldrassil.cpp +++ b/src/server/scripts/Kalimdor/teldrassil.cpp @@ -27,14 +27,15 @@ EndScriptData */ npc_mist EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedFollowerAI.h" /*#### # npc_mist ####*/ -enum eMist +enum Mist { SAY_AT_HOME = -1000323, EMOTE_AT_HOME = -1000324, @@ -51,10 +52,8 @@ public: bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) { if (quest->GetQuestId() == QUEST_MIST) - { if (npc_mistAI* pMistAI = CAST_AI(npc_mist::npc_mistAI, creature->AI())) pMistAI->StartFollow(player, FACTION_DARNASSUS, quest); - } return true; } @@ -88,18 +87,16 @@ public: { DoScriptText(EMOTE_AT_HOME, me); - if (Player* player = GetLeaderForFollower()) - { - if (player->GetQuestStatus(QUEST_MIST) == QUEST_STATUS_INCOMPLETE) - player->GroupEventHappens(QUEST_MIST, me); - } + Player* player = GetLeaderForFollower(); + if (player && player->GetQuestStatus(QUEST_MIST) == QUEST_STATUS_INCOMPLETE) + player->GroupEventHappens(QUEST_MIST, me); //The follow is over (and for later development, run off to the woods before really end) SetFollowComplete(); } //call not needed here, no known abilities - /*void UpdateFollowerAI(const uint32 uiDiff) + /*void UpdateFollowerAI(const uint32 Diff) { if (!UpdateVictim()) return; diff --git a/src/server/scripts/Kalimdor/the_barrens.cpp b/src/server/scripts/Kalimdor/the_barrens.cpp index e12897c1def..f4983558b67 100644 --- a/src/server/scripts/Kalimdor/the_barrens.cpp +++ b/src/server/scripts/Kalimdor/the_barrens.cpp @@ -32,7 +32,9 @@ npc_twiggy_flathead npc_wizzlecrank_shredder EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" /*###### @@ -41,7 +43,7 @@ EndContentData */ #define GOSSIP_CORPSE "Examine corpse in detail..." -enum eQuests +enum BeatenCorpse { QUEST_LOST_IN_BATTLE = 4921 }; @@ -51,10 +53,10 @@ class npc_beaten_corpse : public CreatureScript public: npc_beaten_corpse() : CreatureScript("npc_beaten_corpse") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF +1) + if (action == GOSSIP_ACTION_INFO_DEF +1) { player->SEND_GOSSIP_MENU(3558, creature->GetGUID()); player->TalkedToCreature(creature->GetEntry(), creature->GetGUID()); @@ -77,7 +79,7 @@ public: # npc_gilthares ######*/ -enum eGilthares +enum Gilthares { SAY_GIL_START = -1000370, SAY_GIL_AT_LAST = -1000371, @@ -127,14 +129,13 @@ public: void Reset() { } - void WaypointReached(uint32 uiPointId) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); - if (!player) return; - switch (uiPointId) + switch (waypointId) { case 16: DoScriptText(SAY_GIL_AT_LAST, me, player); @@ -186,10 +187,10 @@ class npc_sputtervalve : public CreatureScript public: npc_sputtervalve() : CreatureScript("npc_sputtervalve") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF) + if (action == GOSSIP_ACTION_INFO_DEF) { player->SEND_GOSSIP_MENU(2013, creature->GetGUID()); player->AreaExploredOrEventHappens(6981); @@ -215,7 +216,7 @@ public: ## npc_taskmaster_fizzule ######*/ -enum eEnums +enum TaskmasterFizzule { FACTION_FRIENDLY_F = 35, SPELL_FLARE = 10113, @@ -234,20 +235,20 @@ public: struct npc_taskmaster_fizzuleAI : public ScriptedAI { - npc_taskmaster_fizzuleAI(Creature* c) : ScriptedAI(c) + npc_taskmaster_fizzuleAI(Creature* creature) : ScriptedAI(creature) { - factionNorm = c->getFaction(); + factionNorm = creature->getFaction(); } uint32 factionNorm; bool IsFriend; - uint32 Reset_Timer; + uint32 ResetTimer; uint8 FlareCount; void Reset() { IsFriend = false; - Reset_Timer = 120000; + ResetTimer = 120000; FlareCount = 0; me->setFaction(factionNorm); } @@ -282,11 +283,11 @@ public: { if (IsFriend) { - if (Reset_Timer <= diff) + if (ResetTimer <= diff) { EnterEvadeMode(); return; - } else Reset_Timer -= diff; + } else ResetTimer -= diff; } if (!UpdateVictim()) @@ -316,7 +317,7 @@ public: ## npc_twiggy_flathead #####*/ -enum eTwiggyFlathead +enum TwiggyFlathead { NPC_BIG_WILL = 6238, NPC_AFFRAY_CHALLENGER = 6240, @@ -328,7 +329,7 @@ enum eTwiggyFlathead SAY_TWIGGY_FLATHEAD_OVER = -1000127, }; -float AffrayChallengerLoc[6][4]= +Position const AffrayChallengerLoc[6] = { {-1683.0f, -4326.0f, 2.79f, 0.0f}, {-1682.0f, -4329.0f, 2.79f, 0.0f}, @@ -350,15 +351,15 @@ public: struct npc_twiggy_flatheadAI : public ScriptedAI { - npc_twiggy_flatheadAI(Creature* c) : ScriptedAI(c) {} + npc_twiggy_flatheadAI(Creature* creature) : ScriptedAI(creature) {} bool EventInProgress; bool EventGrate; bool EventBigWill; - bool Challenger_down[6]; - uint32 Wave; - uint32 Wave_Timer; - uint32 Challenger_checker; + bool ChallengerDown[6]; + uint8 Wave; + uint32 WaveTimer; + uint32 ChallengerChecker; uint64 PlayerGUID; uint64 AffrayChallenger[6]; uint64 BigWill; @@ -368,15 +369,15 @@ public: EventInProgress = false; EventGrate = false; EventBigWill = false; - Wave_Timer = 600000; - Challenger_checker = 0; + WaveTimer = 600000; + ChallengerChecker = 0; Wave = 0; PlayerGUID = 0; for (uint8 i = 0; i < 6; ++i) { AffrayChallenger[i] = 0; - Challenger_down[i] = false; + ChallengerDown[i] = false; } BigWill = 0; } @@ -385,7 +386,8 @@ public: void MoveInLineOfSight(Unit* who) { - if (!who || (!who->isAlive())) return; + if (!who || (!who->isAlive())) + return; if (me->IsWithinDistInMap(who, 10.0f) && (who->GetTypeId() == TYPEID_PLAYER) && CAST_PLR(who)->GetQuestStatus(1719) == QUEST_STATUS_INCOMPLETE && !EventInProgress) { @@ -408,40 +410,26 @@ public: return; if (!pWarrior->isAlive() && pWarrior->GetQuestStatus(1719) == QUEST_STATUS_INCOMPLETE) { - EventInProgress = false; DoScriptText(SAY_TWIGGY_FLATHEAD_DOWN, me); pWarrior->FailQuest(1719); - for (uint8 i = 0; i < 6; ++i) + for (uint8 i = 0; i < 6; ++i) // unsummon challengers { if (AffrayChallenger[i]) { Creature* creature = Unit::GetCreature((*me), AffrayChallenger[i]); - if (creature) { - if (creature->isAlive()) - { - creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); - creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - creature->setDeathState(JUST_DIED); - } - } + if (creature && creature->isAlive()) + creature->DisappearAndDie(); } - AffrayChallenger[i] = 0; - Challenger_down[i] = false; } - if (BigWill) + if (BigWill) // unsummon bigWill { Creature* creature = Unit::GetCreature((*me), BigWill); - if (creature) { - if (creature->isAlive()) { - creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); - creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - creature->setDeathState(JUST_DIED); - } - } + if (creature && creature->isAlive()) + creature->DisappearAndDie(); } - BigWill = 0; + Reset(); } if (!EventGrate && EventInProgress) @@ -451,11 +439,11 @@ public: if (x >= -1684 && x <= -1674 && y >= -4334 && y <= -4324) { pWarrior->AreaExploredOrEventHappens(1719); - DoScriptText(SAY_TWIGGY_FLATHEAD_BEGIN, me); + DoScriptText(SAY_TWIGGY_FLATHEAD_BEGIN, me, pWarrior); for (uint8 i = 0; i < 6; ++i) { - Creature* creature = me->SummonCreature(NPC_AFFRAY_CHALLENGER, AffrayChallengerLoc[i][0], AffrayChallengerLoc[i][1], AffrayChallengerLoc[i][2], AffrayChallengerLoc[i][3], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000); + Creature* creature = me->SummonCreature(NPC_AFFRAY_CHALLENGER, AffrayChallengerLoc[i], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000); if (!creature) continue; creature->setFaction(35); @@ -464,31 +452,31 @@ public: creature->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); AffrayChallenger[i] = creature->GetGUID(); } - Wave_Timer = 5000; - Challenger_checker = 1000; + WaveTimer = 5000; + ChallengerChecker = 1000; EventGrate = true; } } else if (EventInProgress) { - if (Challenger_checker <= diff) + if (ChallengerChecker <= diff) { for (uint8 i = 0; i < 6; ++i) { if (AffrayChallenger[i]) { Creature* creature = Unit::GetCreature((*me), AffrayChallenger[i]); - if ((!creature || (!creature->isAlive())) && !Challenger_down[i]) + if ((!creature || (!creature->isAlive())) && !ChallengerDown[i]) { DoScriptText(SAY_TWIGGY_FLATHEAD_DOWN, me); - Challenger_down[i] = true; + ChallengerDown[i] = true; } } } - Challenger_checker = 1000; - } else Challenger_checker -= diff; + ChallengerChecker = 1000; + } else ChallengerChecker -= diff; - if (Wave_Timer <= diff) + if (WaveTimer <= diff) { if (Wave < 6 && AffrayChallenger[Wave] && !EventBigWill) { @@ -502,7 +490,7 @@ public: creature->setFaction(14); creature->AI()->AttackStart(pWarrior); ++Wave; - Wave_Timer = 20000; + WaveTimer = 20000; } } else if (Wave >= 6 && !EventBigWill) { @@ -514,7 +502,7 @@ public: creature->GetMotionMaster()->MovePoint(2, -1682, -4329, 2.79f); creature->HandleEmoteCommand(EMOTE_STATE_READY_UNARMED); EventBigWill = true; - Wave_Timer = 1000; + WaveTimer = 1000; } } else if (Wave >= 6 && EventBigWill && BigWill) @@ -523,14 +511,10 @@ public: if (!creature || !creature->isAlive()) { DoScriptText(SAY_TWIGGY_FLATHEAD_OVER, me); - EventInProgress = false; - EventBigWill = false; - EventGrate = false; - PlayerGUID = 0; - Wave = 0; + Reset(); } } - } else Wave_Timer -= diff; + } else WaveTimer -= diff; } } } @@ -542,7 +526,7 @@ public: ## npc_wizzlecrank_shredder #####*/ -enum eEnums_Wizzlecrank +enum Wizzlecrank { SAY_START = -1000298, SAY_STARTUP1 = -1000299, @@ -568,14 +552,14 @@ public: { npc_wizzlecrank_shredderAI(Creature* creature) : npc_escortAI(creature) { - m_bIsPostEvent = false; - m_uiPostEventTimer = 1000; - m_uiPostEventCount = 0; + IsPostEvent = false; + PostEventTimer = 1000; + PostEventCount = 0; } - bool m_bIsPostEvent; - uint32 m_uiPostEventTimer; - uint32 m_uiPostEventCount; + bool IsPostEvent; + uint32 PostEventTimer; + uint32 PostEventCount; void Reset() { @@ -584,48 +568,43 @@ public: if (me->getStandState() == UNIT_STAND_STATE_DEAD) me->SetStandState(UNIT_STAND_STATE_STAND); - m_bIsPostEvent = false; - m_uiPostEventTimer = 1000; - m_uiPostEventCount = 0; + IsPostEvent = false; + PostEventTimer = 1000; + PostEventCount = 0; } } - void WaypointReached(uint32 uiPointId) + void WaypointReached(uint32 waypointId) { - Player* player = GetPlayerForEscort(); - - if (!player) - return; - - switch (uiPointId) + switch (waypointId) { - case 0: - DoScriptText(SAY_STARTUP1, me); - break; - case 9: - SetRun(false); - break; - case 17: - if (Creature* temp = me->SummonCreature(NPC_MERCENARY, 1128.489f, -3037.611f, 92.701f, 1.472f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000)) - { - DoScriptText(SAY_MERCENARY, temp); - me->SummonCreature(NPC_MERCENARY, 1160.172f, -2980.168f, 97.313f, 3.690f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); - } - break; - case 24: - m_bIsPostEvent = true; - break; + case 0: + DoScriptText(SAY_STARTUP1, me); + break; + case 9: + SetRun(false); + break; + case 17: + if (Creature* temp = me->SummonCreature(NPC_MERCENARY, 1128.489f, -3037.611f, 92.701f, 1.472f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000)) + { + DoScriptText(SAY_MERCENARY, temp); + me->SummonCreature(NPC_MERCENARY, 1160.172f, -2980.168f, 97.313f, 3.690f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); + } + break; + case 24: + IsPostEvent = true; + break; } } - void WaypointStart(uint32 uiPointId) + void WaypointStart(uint32 PointId) { Player* player = GetPlayerForEscort(); if (!player) return; - switch (uiPointId) + switch (PointId) { case 9: DoScriptText(SAY_STARTUP2, me, player); @@ -646,15 +625,15 @@ public: summoned->AI()->AttackStart(me); } - void UpdateEscortAI(const uint32 uiDiff) + void UpdateEscortAI(const uint32 Diff) { if (!UpdateVictim()) { - if (m_bIsPostEvent) + if (IsPostEvent) { - if (m_uiPostEventTimer <= uiDiff) + if (PostEventTimer <= Diff) { - switch (m_uiPostEventCount) + switch (PostEventCount) { case 0: DoScriptText(SAY_PROGRESS_2, me); @@ -674,11 +653,11 @@ public: break; } - ++m_uiPostEventCount; - m_uiPostEventTimer = 5000; + ++PostEventCount; + PostEventTimer = 5000; } else - m_uiPostEventTimer -= uiDiff; + PostEventTimer -= Diff; } return; diff --git a/src/server/scripts/Kalimdor/thousand_needles.cpp b/src/server/scripts/Kalimdor/thousand_needles.cpp index 2349b4493ce..b9ae356ddf1 100644 --- a/src/server/scripts/Kalimdor/thousand_needles.cpp +++ b/src/server/scripts/Kalimdor/thousand_needles.cpp @@ -32,14 +32,16 @@ npc_enraged_panther go_panther_cage EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "ScriptedEscortAI.h" /*##### # npc_kanati ######*/ -enum eKanati +enum Kanati { SAY_KAN_START = -1000410, @@ -47,7 +49,7 @@ enum eKanati NPC_GALAK_ASS = 10720 }; -const float m_afGalakLoc[]= {-4867.387695f, -1357.353760f, -48.226f }; +Position const GalakLoc = {-4867.387695f, -1357.353760f, -48.226f, 0.0f}; class npc_kanati : public CreatureScript { @@ -57,10 +59,9 @@ public: bool OnQuestAccept(Player* player, Creature* creature, const Quest* quest) { if (quest->GetQuestId() == QUEST_PROTECT_KANATI) - { if (npc_kanatiAI* pEscortAI = CAST_AI(npc_kanati::npc_kanatiAI, creature->AI())) pEscortAI->Start(false, false, player->GetGUID(), quest, true); - } + return true; } @@ -73,11 +74,11 @@ public: { npc_kanatiAI(Creature* creature) : npc_escortAI(creature) { } - void Reset() { } + void Reset() {} - void WaypointReached(uint32 uiPointId) + void WaypointReached(uint32 waypointId) { - switch (uiPointId) + switch (waypointId) { case 0: DoScriptText(SAY_KAN_START, me); @@ -93,9 +94,7 @@ public: void DoSpawnGalak() { for (int i = 0; i < 3; ++i) - me->SummonCreature(NPC_GALAK_ASS, - m_afGalakLoc[0], m_afGalakLoc[1], m_afGalakLoc[2], 0.0f, - TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(NPC_GALAK_ASS, GalakLoc, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); } void JustSummoned(Creature* summoned) @@ -110,7 +109,7 @@ public: # npc_lakota_windsong ######*/ -enum eLakota +enum Lakota { SAY_LAKO_START = -1000365, SAY_LAKO_LOOK_OUT = -1000366, @@ -127,14 +126,14 @@ enum eLakota ID_AMBUSH_3 = 4 }; -float m_afBanditLoc[6][6]= +Position const BanditLoc[6] = { - {-4905.479492f, -2062.732666f, 84.352f}, - {-4915.201172f, -2073.528320f, 84.733f}, - {-4878.883301f, -1986.947876f, 91.966f}, - {-4877.503906f, -1966.113403f, 91.859f}, - {-4767.985352f, -1873.169189f, 90.192f}, - {-4788.861328f, -1888.007813f, 89.888f} + {-4905.479492f, -2062.732666f, 84.352f, 0.0f}, + {-4915.201172f, -2073.528320f, 84.733f, 0.0f}, + {-4878.883301f, -1986.947876f, 91.966f, 0.0f}, + {-4877.503906f, -1966.113403f, 91.859f, 0.0f}, + {-4767.985352f, -1873.169189f, 90.192f, 0.0f}, + {-4788.861328f, -1888.007813f, 89.888f, 0.0f} }; class npc_lakota_windsong : public CreatureScript @@ -164,11 +163,11 @@ public: { npc_lakota_windsongAI(Creature* creature) : npc_escortAI(creature) { } - void Reset() { } + void Reset() {} - void WaypointReached(uint32 uiPointId) + void WaypointReached(uint32 waypointId) { - switch (uiPointId) + switch (waypointId) { case 8: DoScriptText(SAY_LAKO_LOOK_OUT, me); @@ -189,12 +188,10 @@ public: } } - void DoSpawnBandits(int uiAmbushId) + void DoSpawnBandits(int AmbushId) { for (int i = 0; i < 2; ++i) - me->SummonCreature(NPC_GRIM_BANDIT, - m_afBanditLoc[i+uiAmbushId][0], m_afBanditLoc[i+uiAmbushId][1], m_afBanditLoc[i+uiAmbushId][2], 0.0f, - TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); + me->SummonCreature(NPC_GRIM_BANDIT, BanditLoc[i+AmbushId], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); } }; @@ -204,7 +201,7 @@ public: # npc_paoka_swiftmountain ######*/ -enum ePacka +enum Packa { SAY_START = -1000362, SAY_WYVERN = -1000363, @@ -215,11 +212,11 @@ enum ePacka FACTION_ESCORTEE = 232 //guessed }; -float m_afWyvernLoc[3][3]= +Position const WyvernLoc[3] = { - {-4990.606f, -906.057f, -5.343f}, - {-4970.241f, -927.378f, -4.951f}, - {-4985.364f, -952.528f, -5.199f} + {-4990.606f, -906.057f, -5.343f, 0.0f}, + {-4970.241f, -927.378f, -4.951f, 0.0f}, + {-4985.364f, -952.528f, -5.199f, 0.0f} }; class npc_paoka_swiftmountain : public CreatureScript @@ -249,11 +246,11 @@ public: { npc_paoka_swiftmountainAI(Creature* creature) : npc_escortAI(creature) { } - void Reset() { } + void Reset() {} - void WaypointReached(uint32 uiPointId) + void WaypointReached(uint32 waypointId) { - switch (uiPointId) + switch (waypointId) { case 15: DoScriptText(SAY_WYVERN, me); @@ -272,12 +269,9 @@ public: void DoSpawnWyvern() { for (int i = 0; i < 3; ++i) - me->SummonCreature(NPC_WYVERN, - m_afWyvernLoc[i][0], m_afWyvernLoc[i][1], m_afWyvernLoc[i][2], 0.0f, - TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); + me->SummonCreature(NPC_WYVERN, WyvernLoc[i], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); } }; - }; /*##### @@ -286,7 +280,7 @@ public: #define GOSSIP_P "Please tell me the Phrase.." -enum ePlucky +enum Plucky { FACTION_FRIENDLY = 35, QUEST_SCOOP = 1950, @@ -299,10 +293,10 @@ class npc_plucky : public CreatureScript public: npc_plucky() : CreatureScript("npc_plucky") { } - bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: player->CLOSE_GOSSIP_MENU(); @@ -316,6 +310,7 @@ public: { if (player->GetQuestStatus(QUEST_SCOOP) == QUEST_STATUS_INCOMPLETE) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_P, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->SEND_GOSSIP_MENU(738, creature->GetGUID()); return true; @@ -328,17 +323,17 @@ public: struct npc_pluckyAI : public ScriptedAI { - npc_pluckyAI(Creature* c) : ScriptedAI(c) { m_uiNormFaction = c->getFaction(); } + npc_pluckyAI(Creature* creature) : ScriptedAI(creature) { NormFaction = creature->getFaction(); } - uint32 m_uiNormFaction; - uint32 m_uiResetTimer; + uint32 NormFaction; + uint32 ResetTimer; void Reset() { - m_uiResetTimer = 120000; + ResetTimer = 120000; - if (me->getFaction() != m_uiNormFaction) - me->setFaction(m_uiNormFaction); + if (me->getFaction() != NormFaction) + me->setFaction(NormFaction); if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); @@ -346,11 +341,11 @@ public: DoCast(me, SPELL_PLUCKY_CHICKEN, false); } - void ReceiveEmote(Player* player, uint32 uiTextEmote) + void ReceiveEmote(Player* player, uint32 TextEmote) { if (player->GetQuestStatus(QUEST_SCOOP) == QUEST_STATUS_INCOMPLETE) { - if (uiTextEmote == TEXT_EMOTE_BECKON) + if (TextEmote == TEXT_EMOTE_BECKON) { me->setFaction(FACTION_FRIENDLY); me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); @@ -358,7 +353,7 @@ public: } } - if (uiTextEmote == TEXT_EMOTE_CHICKEN) + if (TextEmote == TEXT_EMOTE_CHICKEN) { if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) return; @@ -372,11 +367,11 @@ public: } } - void UpdateAI(const uint32 uiDiff) + void UpdateAI(const uint32 Diff) { if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) { - if (m_uiResetTimer <= uiDiff) + if (ResetTimer <= Diff) { if (!me->getVictim()) EnterEvadeMode(); @@ -386,7 +381,7 @@ public: return; } else - m_uiResetTimer -= uiDiff; + ResetTimer -= Diff; } if (!UpdateVictim()) @@ -398,7 +393,7 @@ public: }; -enum ePantherCage +enum PantherCage { ENRAGED_PANTHER = 10992 }; @@ -410,7 +405,6 @@ public: bool OnGossipHello(Player* player, GameObject* go) { - if (player->GetQuestStatus(5151) == QUEST_STATUS_INCOMPLETE) { if (Creature* panther = go->FindNearestCreature(ENRAGED_PANTHER, 5, true)) @@ -421,7 +415,7 @@ public: } } - return true ; + return true; } }; @@ -437,7 +431,7 @@ public: struct npc_enraged_pantherAI : public ScriptedAI { - npc_enraged_pantherAI(Creature* c) : ScriptedAI(c) {} + npc_enraged_pantherAI(Creature* creature) : ScriptedAI(creature) {} void Reset() { diff --git a/src/server/scripts/Kalimdor/thunder_bluff.cpp b/src/server/scripts/Kalimdor/thunder_bluff.cpp index 67a876c40b2..b8b05b9692f 100644 --- a/src/server/scripts/Kalimdor/thunder_bluff.cpp +++ b/src/server/scripts/Kalimdor/thunder_bluff.cpp @@ -23,17 +23,22 @@ SDComment: Quest support: 925 SDCategory: Thunder Bluff EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /*##### # npc_cairne_bloodhoof ######*/ -#define SPELL_BERSERKER_CHARGE 16636 -#define SPELL_CLEAVE 16044 -#define SPELL_MORTAL_STRIKE 16856 -#define SPELL_THUNDERCLAP 23931 -#define SPELL_UPPERCUT 22916 +enum CairneBloodhoof +{ + SPELL_BERSERKER_CHARGE = 16636, + SPELL_CLEAVE = 16044, + SPELL_MORTAL_STRIKE = 16856, + SPELL_THUNDERCLAP = 23931, + SPELL_UPPERCUT = 22916 +}; #define GOSSIP_HCB "I know this is rather silly but a young ward who is a bit shy would like your hoofprint." //TODO: verify abilities/timers @@ -42,10 +47,10 @@ class npc_cairne_bloodhoof : public CreatureScript public: npc_cairne_bloodhoof() : CreatureScript("npc_cairne_bloodhoof") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_SENDER_INFO) + if (action == GOSSIP_SENDER_INFO) { player->CastSpell(player, 23123, false); player->SEND_GOSSIP_MENU(7014, creature->GetGUID()); @@ -73,21 +78,21 @@ public: struct npc_cairne_bloodhoofAI : public ScriptedAI { - npc_cairne_bloodhoofAI(Creature* c) : ScriptedAI(c) {} + npc_cairne_bloodhoofAI(Creature* creature) : ScriptedAI(creature) {} - uint32 BerserkerCharge_Timer; - uint32 Cleave_Timer; - uint32 MortalStrike_Timer; - uint32 Thunderclap_Timer; - uint32 Uppercut_Timer; + uint32 BerserkerChargeTimer; + uint32 CleaveTimer; + uint32 MortalStrikeTimer; + uint32 ThunderclapTimer; + uint32 UppercutTimer; void Reset() { - BerserkerCharge_Timer = 30000; - Cleave_Timer = 5000; - MortalStrike_Timer = 10000; - Thunderclap_Timer = 15000; - Uppercut_Timer = 10000; + BerserkerChargeTimer = 30000; + CleaveTimer = 5000; + MortalStrikeTimer = 10000; + ThunderclapTimer = 15000; + UppercutTimer = 10000; } void EnterCombat(Unit* /*who*/) {} @@ -97,37 +102,37 @@ public: if (!UpdateVictim()) return; - if (BerserkerCharge_Timer <= diff) + if (BerserkerChargeTimer <= diff) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0); if (target) DoCast(target, SPELL_BERSERKER_CHARGE); - BerserkerCharge_Timer = 25000; - } else BerserkerCharge_Timer -= diff; + BerserkerChargeTimer = 25000; + } else BerserkerChargeTimer -= diff; - if (Uppercut_Timer <= diff) + if (UppercutTimer <= diff) { DoCast(me->getVictim(), SPELL_UPPERCUT); - Uppercut_Timer = 20000; - } else Uppercut_Timer -= diff; + UppercutTimer = 20000; + } else UppercutTimer -= diff; - if (Thunderclap_Timer <= diff) + if (ThunderclapTimer <= diff) { DoCast(me->getVictim(), SPELL_THUNDERCLAP); - Thunderclap_Timer = 15000; - } else Thunderclap_Timer -= diff; + ThunderclapTimer = 15000; + } else ThunderclapTimer -= diff; - if (MortalStrike_Timer <= diff) + if (MortalStrikeTimer <= diff) { DoCast(me->getVictim(), SPELL_MORTAL_STRIKE); - MortalStrike_Timer = 15000; - } else MortalStrike_Timer -= diff; + MortalStrikeTimer = 15000; + } else MortalStrikeTimer -= diff; - if (Cleave_Timer <= diff) + if (CleaveTimer <= diff) { DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 7000; - } else Cleave_Timer -= diff; + CleaveTimer = 7000; + } else CleaveTimer -= diff; DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/Kalimdor/ungoro_crater.cpp b/src/server/scripts/Kalimdor/ungoro_crater.cpp index 0e2a1b2c4d9..786d2fc0cd3 100644 --- a/src/server/scripts/Kalimdor/ungoro_crater.cpp +++ b/src/server/scripts/Kalimdor/ungoro_crater.cpp @@ -28,11 +28,12 @@ npc_a-me npc_ringo EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "ScriptedEscortAI.h" #include "ScriptedFollowerAI.h" -enum eAMeData +enum AmeData { SAY_READY = -1000517, SAY_AGGRO1 = -1000518, @@ -74,45 +75,42 @@ public: struct npc_ameAI : public npc_escortAI { - npc_ameAI(Creature* c) : npc_escortAI(c) {} + npc_ameAI(Creature* creature) : npc_escortAI(creature) {} - uint32 DEMORALIZINGSHOUT_Timer; + uint32 DemoralizingShoutTimer; - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { - Player* player = GetPlayerForEscort(); - - if (!player) - return; - - switch (i) + if (Player* player = GetPlayerForEscort()) { - case 19: - me->SummonCreature(ENTRY_STOMPER, -6391.69f, -1730.49f, -272.83f, 4.96f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - DoScriptText(SAY_AGGRO1, me, player); - break; - case 28: - DoScriptText(SAY_SEARCH, me, player); - break; - case 38: - me->SummonCreature(ENTRY_TARLORD, -6370.75f, -1382.84f, -270.51f, 6.06f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - DoScriptText(SAY_AGGRO2, me, player); - break; - case 49: - me->SummonCreature(ENTRY_TARLORD1, -6324.44f, -1181.05f, -270.17f, 4.34f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - DoScriptText(SAY_AGGRO3, me, player); - break; - case 55: - DoScriptText(SAY_FINISH, me, player); - if (player) + switch (waypointId) + { + case 19: + me->SummonCreature(ENTRY_STOMPER, -6391.69f, -1730.49f, -272.83f, 4.96f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + DoScriptText(SAY_AGGRO1, me, player); + break; + case 28: + DoScriptText(SAY_SEARCH, me, player); + break; + case 38: + me->SummonCreature(ENTRY_TARLORD, -6370.75f, -1382.84f, -270.51f, 6.06f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + DoScriptText(SAY_AGGRO2, me, player); + break; + case 49: + me->SummonCreature(ENTRY_TARLORD1, -6324.44f, -1181.05f, -270.17f, 4.34f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + DoScriptText(SAY_AGGRO3, me, player); + break; + case 55: + DoScriptText(SAY_FINISH, me, player); player->GroupEventHappens(QUEST_CHASING_AME, me); - break; + break; + } } } void Reset() { - DEMORALIZINGSHOUT_Timer = 5000; + DemoralizingShoutTimer = 5000; } void JustSummoned(Creature* summoned) @@ -132,11 +130,11 @@ public: if (!UpdateVictim()) return; - if (DEMORALIZINGSHOUT_Timer <= diff) + if (DemoralizingShoutTimer <= diff) { DoCast(me->getVictim(), SPELL_DEMORALIZINGSHOUT); - DEMORALIZINGSHOUT_Timer = 70000; - } else DEMORALIZINGSHOUT_Timer -= diff; + DemoralizingShoutTimer = 70000; + } else DemoralizingShoutTimer -= diff; } }; }; @@ -145,7 +143,7 @@ public: # npc_ringo ####*/ -enum eRingo +enum Ringo { SAY_RIN_START_1 = -1000416, SAY_RIN_START_2 = -1000417, @@ -203,17 +201,17 @@ public: { npc_ringoAI(Creature* creature) : FollowerAI(creature) { } - uint32 m_uiFaintTimer; - uint32 m_uiEndEventProgress; - uint32 m_uiEndEventTimer; + uint32 FaintTimer; + uint32 EndEventProgress; + uint32 EndEventTimer; uint64 SpraggleGUID; void Reset() { - m_uiFaintTimer = urand(30000, 60000); - m_uiEndEventProgress = 0; - m_uiEndEventTimer = 1000; + FaintTimer = urand(30000, 60000); + EndEventProgress = 0; + EndEventTimer = 1000; SpraggleGUID = 0; } @@ -268,13 +266,13 @@ public: SetFollowPaused(false); } - void UpdateFollowerAI(const uint32 uiDiff) + void UpdateFollowerAI(const uint32 Diff) { if (!UpdateVictim()) { if (HasFollowState(STATE_FOLLOW_POSTEVENT)) { - if (m_uiEndEventTimer <= uiDiff) + if (EndEventTimer <= Diff) { Unit* pSpraggle = Unit::GetUnit(*me, SpraggleGUID); if (!pSpraggle || !pSpraggle->isAlive()) @@ -283,64 +281,61 @@ public: return; } - switch (m_uiEndEventProgress) + switch (EndEventProgress) { case 1: DoScriptText(SAY_RIN_END_1, me); - m_uiEndEventTimer = 3000; + EndEventTimer = 3000; break; case 2: DoScriptText(SAY_SPR_END_2, pSpraggle); - m_uiEndEventTimer = 5000; + EndEventTimer = 5000; break; case 3: DoScriptText(SAY_RIN_END_3, me); - m_uiEndEventTimer = 1000; + EndEventTimer = 1000; break; case 4: DoScriptText(EMOTE_RIN_END_4, me); SetFaint(); - m_uiEndEventTimer = 9000; + EndEventTimer = 9000; break; case 5: DoScriptText(EMOTE_RIN_END_5, me); ClearFaint(); - m_uiEndEventTimer = 1000; + EndEventTimer = 1000; break; case 6: DoScriptText(SAY_RIN_END_6, me); - m_uiEndEventTimer = 3000; + EndEventTimer = 3000; break; case 7: DoScriptText(SAY_SPR_END_7, pSpraggle); - m_uiEndEventTimer = 10000; + EndEventTimer = 10000; break; case 8: DoScriptText(EMOTE_RIN_END_8, me); - m_uiEndEventTimer = 5000; + EndEventTimer = 5000; break; case 9: SetFollowComplete(); break; } - ++m_uiEndEventProgress; + ++EndEventProgress; } else - m_uiEndEventTimer -= uiDiff; + EndEventTimer -= Diff; } - else if (HasFollowState(STATE_FOLLOW_INPROGRESS)) + else if (HasFollowState(STATE_FOLLOW_INPROGRESS) && !HasFollowState(STATE_FOLLOW_PAUSED)) { - if (!HasFollowState(STATE_FOLLOW_PAUSED)) + if (FaintTimer <= Diff) { - if (m_uiFaintTimer <= uiDiff) - { - SetFaint(); - m_uiFaintTimer = urand(60000, 120000); - } - else - m_uiFaintTimer -= uiDiff; + SetFaint(); + FaintTimer = urand(60000, 120000); } + else + FaintTimer -= Diff; } return; diff --git a/src/server/scripts/Kalimdor/winterspring.cpp b/src/server/scripts/Kalimdor/winterspring.cpp index 00bb250d64d..a02156ee110 100644 --- a/src/server/scripts/Kalimdor/winterspring.cpp +++ b/src/server/scripts/Kalimdor/winterspring.cpp @@ -29,7 +29,9 @@ npc_rivern_frostwind npc_witch_doctor_mauari EndContentData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" /*###### ## npc_lorax @@ -48,10 +50,10 @@ class npc_lorax : public CreatureScript public: npc_lorax() : CreatureScript("npc_lorax") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -105,10 +107,10 @@ class npc_rivern_frostwind : public CreatureScript public: npc_rivern_frostwind() : CreatureScript("npc_rivern_frostwind") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_TRADE) + if (action == GOSSIP_ACTION_TRADE) player->GetSession()->SendListInventory(creature->GetGUID()); return true; @@ -140,10 +142,10 @@ class npc_witch_doctor_mauari : public CreatureScript public: npc_witch_doctor_mauari() : CreatureScript("npc_witch_doctor_mauari") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { player->CLOSE_GOSSIP_MENU(); creature->CastSpell(player, 16351, false); @@ -161,12 +163,12 @@ public: { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HWDM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(3377, creature->GetGUID()); - }else + } + else player->SEND_GOSSIP_MENU(3375, creature->GetGUID()); return true; } - }; void AddSC_winterspring() diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp index b16ad9934d8..8f34fa56525 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp @@ -48,9 +48,9 @@ public: struct boss_amanitarAI : public ScriptedAI { - boss_amanitarAI(Creature* c) : ScriptedAI(c) + boss_amanitarAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); bFirstTime = true; } @@ -83,7 +83,7 @@ public: } } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { if (instance) { @@ -167,7 +167,7 @@ public: struct mob_amanitar_mushroomsAI : public Scripted_NoMovementAI { - mob_amanitar_mushroomsAI(Creature* c) : Scripted_NoMovementAI(c) {} + mob_amanitar_mushroomsAI(Creature* creature) : Scripted_NoMovementAI(creature) {} uint32 uiAuraTimer; uint32 uiDeathTimer; diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp index 85abaa46a5d..ea757e86f4d 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp @@ -105,7 +105,7 @@ class boss_elder_nadox : public CreatureScript DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3), me); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_SLAY_3, me); //SAY_SLAY_3 on death? @@ -229,7 +229,7 @@ class mob_ahnkahar_nerubian : public CreatureScript uiSprintTimer = 10000; } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { if (me->GetEntry() == MOB_AHNKAHAR_GUARDIAN_ENTRY) if (Creature* Nadox = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ELDER_NADOX))) @@ -278,10 +278,10 @@ public: struct mob_nadox_eggsAI : public Scripted_NoMovementAI { - mob_nadox_eggsAI(Creature* c) : Scripted_NoMovementAI(c) + mob_nadox_eggsAI(Creature* creature) : Scripted_NoMovementAI(creature) { - c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - c->UpdateAllStats(); + creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); + creature->UpdateAllStats(); } void Reset() {} void EnterCombat(Unit* /*who*/) {} diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp index 2789bc48a4c..d6e50097765 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp @@ -73,9 +73,9 @@ public: struct boss_jedoga_shadowseekerAI : public ScriptedAI { - boss_jedoga_shadowseekerAI(Creature* c) : ScriptedAI(c) + boss_jedoga_shadowseekerAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); bFirstTime = true; bPreDone = false; } @@ -149,7 +149,7 @@ public: DoScriptText(RAND(TEXT_SLAY_1, TEXT_SLAY_2, TEXT_SLAY_3), me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(TEXT_DEATH, me); if (instance) @@ -355,9 +355,9 @@ public: struct mob_jedoga_initiandAI : public ScriptedAI { - mob_jedoga_initiandAI(Creature* c) : ScriptedAI(c) + mob_jedoga_initiandAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -390,9 +390,9 @@ public: } } - void JustDied(Unit* Killer) + void JustDied(Unit* killer) { - if (!Killer || !instance) + if (!killer || !instance) return; if (bWalking) @@ -402,7 +402,7 @@ public: if (!CAST_AI(boss_jedoga_shadowseeker::boss_jedoga_shadowseekerAI, boss->AI())->bOpFerok) CAST_AI(boss_jedoga_shadowseeker::boss_jedoga_shadowseekerAI, boss->AI())->bOpFerokFail = true; - if (Killer->GetTypeId() == TYPEID_PLAYER) + if (killer->GetTypeId() == TYPEID_PLAYER) boss->AI()->DoAction(ACTION_INITIAND_KILLED); } @@ -410,8 +410,8 @@ public: bWalking = false; } - if (Killer->GetTypeId() == TYPEID_PLAYER) - instance->SetData64(DATA_PL_JEDOGA_TARGET, Killer->GetGUID()); + if (killer->GetTypeId() == TYPEID_PLAYER) + instance->SetData64(DATA_PL_JEDOGA_TARGET, killer->GetGUID()); } void EnterCombat(Unit* who) @@ -531,9 +531,9 @@ public: struct npc_jedogas_aufseher_triggerAI : public Scripted_NoMovementAI { - npc_jedogas_aufseher_triggerAI(Creature* c) : Scripted_NoMovementAI(c) + npc_jedogas_aufseher_triggerAI(Creature* creature) : Scripted_NoMovementAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); bRemoved = false; bRemoved2 = false; bCasted = false; diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp index 0f4b046f7d5..cf3c4274e48 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp @@ -36,7 +36,8 @@ enum Spells SPELL_VANISH = 55964, CREATURE_FLAME_SPHERE = 30106, H_CREATURE_FLAME_SPHERE_1 = 31686, - H_CREATURE_FLAME_SPHERE_2 = 31687 + H_CREATURE_FLAME_SPHERE_2 = 31687, + SPELL_HOVER_FALL = 60425 }; enum Misc { @@ -45,18 +46,17 @@ enum Misc DATA_SPHERE_DISTANCE = 15 }; #define DATA_SPHERE_ANGLE_OFFSET 0.7f -#define DATA_GROUND_POSITION_Z 11.4f +#define DATA_GROUND_POSITION_Z 11.30809f enum Yells { - SAY_AGGRO = -1619021, - SAY_SLAY_1 = -1619022, - SAY_SLAY_2 = -1619023, - SAY_DEATH = -1619024, - SAY_FEED_1 = -1619025, - SAY_FEED_2 = -1619026, - SAY_VANISH_1 = -1619027, - SAY_VANISH_2 = -1619028 + SAY_1 = 0, + SAY_WARNING = 1, + SAY_AGGRO = 2, + SAY_SLAY = 3, + SAY_DEATH = 4, + SAY_FEED = 5, + SAY_VANISH = 6, }; enum CombatPhase { @@ -79,11 +79,10 @@ public: struct boss_taldaramAI : public ScriptedAI { - boss_taldaramAI(Creature* c) : ScriptedAI(c) + boss_taldaramAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + instance = creature->GetInstanceScript(); + me->SetDisableGravity(true); } uint32 uiBloodthirstTimer; @@ -118,7 +117,7 @@ public: { if (instance) instance->SetData(DATA_PRINCE_TALDARAM_EVENT, IN_PROGRESS); - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); } void UpdateAI(const uint32 diff) @@ -180,7 +179,8 @@ public: break; case VANISHED: if (Unit* pEmbraceTarget = GetEmbraceTarget()) - DoCast(pEmbraceTarget, SPELL_EMBRACE_OF_THE_VAMPYR); + DoCast(pEmbraceTarget, DUNGEON_MODE(SPELL_EMBRACE_OF_THE_VAMPYR, H_SPELL_EMBRACE_OF_THE_VAMPYR)); + Talk(SAY_FEED); me->GetMotionMaster()->Clear(); me->SetSpeed(MOVE_WALK, 1.0f, true); me->GetMotionMaster()->MoveChase(me->getVictim()); @@ -201,7 +201,8 @@ public: if (uiFlamesphereTimer <= diff) { - DoCast(me, SPELL_CONJURE_FLAME_SPHERE); + // because TARGET_UNIT_TARGET_ENEMY we need a target selected to cast + DoCastVictim(SPELL_CONJURE_FLAME_SPHERE); Phase = CASTING_FLAME_SPHERES; uiPhaseTimer = 3*IN_MILLISECONDS + diff; uiFlamesphereTimer = 15*IN_MILLISECONDS; @@ -224,7 +225,7 @@ public: //He only vanishes if there are 3 or more alive players if (target_list.size() > 2) { - DoScriptText(RAND(SAY_VANISH_1, SAY_VANISH_2), me); + Talk(SAY_VANISH); DoCast(me, SPELL_VANISH); Phase = JUST_VANISHED; uiPhaseTimer = 500; @@ -260,7 +261,7 @@ public: void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_DEATH, me); + Talk(SAY_DEATH); if (instance) instance->SetData(DATA_PRINCE_TALDARAM_EVENT, DONE); @@ -278,7 +279,7 @@ public: uiPhaseTimer = 0; uiEmbraceTarget = 0; } - DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me); + Talk(SAY_SLAY); } bool CheckSpheres() @@ -314,12 +315,13 @@ public: { if (!instance) return; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->RemoveAurasDueToSpell(SPELL_BEAM_VISUAL); - me->SetUnitMovementFlags(MOVEMENTFLAG_WALKING); me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), DATA_GROUND_POSITION_Z, me->GetOrientation()); + DoCast(SPELL_HOVER_FALL); + me->SetDisableGravity(false); + me->GetMotionMaster()->MovePoint(0, me->GetHomePosition()); + Talk(SAY_WARNING); uint64 prison_GUID = instance->GetData64(DATA_PRINCE_TALDARAM_PLATFORM); instance->HandleGameObject(prison_GUID, true); } @@ -338,9 +340,9 @@ public: struct mob_taldaram_flamesphereAI : public ScriptedAI { - mob_taldaram_flamesphereAI(Creature* c) : ScriptedAI(c) + mob_taldaram_flamesphereAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 uiDespawnTimer; @@ -349,9 +351,10 @@ public: void Reset() { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + //! HACK: Creature's can't have MOVEMENTFLAG_FLYING me->AddUnitMovementFlag(MOVEMENTFLAG_FLYING); me->setFaction(16); - me->SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f); + me->SetObjectScale(1.0f); DoCast(me, SPELL_FLAME_SPHERE_VISUAL); DoCast(me, SPELL_FLAME_SPHERE_SPAWN_EFFECT); DoCast(me, SPELL_FLAME_SPHERE_PERIODIC); @@ -361,7 +364,7 @@ public: void EnterCombat(Unit* /*who*/) {} void MoveInLineOfSight(Unit* /*who*/) {} - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { DoCast(me, SPELL_FLAME_SPHERE_DEATH_EFFECT); } @@ -386,21 +389,30 @@ class prince_taldaram_sphere : public GameObjectScript public: prince_taldaram_sphere() : GameObjectScript("prince_taldaram_sphere") { } - bool OnGossipHello(Player* /*player*/, GameObject* pGO) + bool OnGossipHello(Player* /*player*/, GameObject* go) { - InstanceScript* instance = pGO->GetInstanceScript(); + InstanceScript* instance = go->GetInstanceScript(); + if (!instance) + return true; - Creature* pPrinceTaldaram = Unit::GetCreature(*pGO, instance ? instance->GetData64(DATA_PRINCE_TALDARAM) : 0); + Creature* pPrinceTaldaram = Unit::GetCreature(*go, instance->GetData64(DATA_PRINCE_TALDARAM)); if (pPrinceTaldaram && pPrinceTaldaram->isAlive()) { // maybe these are hacks :( - pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - pGO->SetGoState(GO_STATE_ACTIVE); + go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + go->SetGoState(GO_STATE_ACTIVE); - switch (pGO->GetEntry()) + switch (go->GetEntry()) { - case GO_SPHERE1: instance->SetData(DATA_SPHERE1_EVENT, IN_PROGRESS); break; - case GO_SPHERE2: instance->SetData(DATA_SPHERE2_EVENT, IN_PROGRESS); break; + case GO_SPHERE1: + instance->SetData(DATA_SPHERE1_EVENT, IN_PROGRESS); + pPrinceTaldaram->AI()->Talk(SAY_1); + break; + + case GO_SPHERE2: + instance->SetData(DATA_SPHERE2_EVENT, IN_PROGRESS); + pPrinceTaldaram->AI()->Talk(SAY_1); + break; } CAST_AI(boss_taldaram::boss_taldaramAI, pPrinceTaldaram->AI())->CheckSpheres(); diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp index 3ae78d4053b..74643e58e30 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp @@ -87,7 +87,8 @@ public: bool IsEncounterInProgress() const { for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; + if (m_auiEncounter[i] == IN_PROGRESS) + return true; return false; } @@ -109,26 +110,37 @@ public: { switch (go->GetEntry()) { - case 193564: Prince_TaldaramPlatform = go->GetGUID(); - if (m_auiEncounter[1] == DONE) HandleGameObject(0, true, go); break; - case 193093: Prince_TaldaramSpheres[0] = go->GetGUID(); + case 193564: + Prince_TaldaramPlatform = go->GetGUID(); + if (m_auiEncounter[1] == DONE) + HandleGameObject(0, true, go); + break; + + case 193093: + Prince_TaldaramSpheres[0] = go->GetGUID(); if (spheres[0] == IN_PROGRESS) { go->SetGoState(GO_STATE_ACTIVE); go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); } - else go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + else + go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); break; - case 193094: Prince_TaldaramSpheres[1] = go->GetGUID(); + case 193094: + Prince_TaldaramSpheres[1] = go->GetGUID(); if (spheres[1] == IN_PROGRESS) { go->SetGoState(GO_STATE_ACTIVE); go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); } - else go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + else + go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + break; + case 192236: + Prince_TaldaramGate = go->GetGUID(); // Web gate past Prince Taldaram + if (m_auiEncounter[1] == DONE) + HandleGameObject(0, true, go); break; - case 192236: Prince_TaldaramGate = go->GetGUID(); // Web gate past Prince Taldaram - if (m_auiEncounter[1] == DONE)HandleGameObject(0, true, go);break; } } @@ -136,8 +148,13 @@ public: { switch (idx) { - case DATA_ADD_JEDOGA_OPFER: JedogaSacrifices = guid; break; - case DATA_PL_JEDOGA_TARGET: JedogaTarget = guid; break; + case DATA_ADD_JEDOGA_OPFER: + JedogaSacrifices = guid; + break; + + case DATA_PL_JEDOGA_TARGET: + JedogaTarget = guid; + break; } } @@ -178,7 +195,9 @@ public: { switch (type) { - case DATA_ELDER_NADOX_EVENT: m_auiEncounter[0] = data; break; + case DATA_ELDER_NADOX_EVENT: + m_auiEncounter[0] = data; + break; case DATA_PRINCE_TALDARAM_EVENT: if (data == DONE) HandleGameObject(Prince_TaldaramGate, true); @@ -200,11 +219,21 @@ public: } } break; - case DATA_HERALD_VOLAZJ_EVENT: m_auiEncounter[3] = data; break; - case DATA_AMANITAR_EVENT: m_auiEncounter[4] = data; break; - case DATA_SPHERE1_EVENT: spheres[0] = data; break; - case DATA_SPHERE2_EVENT: spheres[1] = data; break; - case DATA_JEDOGA_TRIGGER_SWITCH: switchtrigger = data; break; + case DATA_HERALD_VOLAZJ_EVENT: + m_auiEncounter[3] = data; + break; + case DATA_AMANITAR_EVENT: + m_auiEncounter[4] = data; + break; + case DATA_SPHERE1_EVENT: + spheres[0] = data; + break; + case DATA_SPHERE2_EVENT: + spheres[1] = data; + break; + case DATA_JEDOGA_TRIGGER_SWITCH: + switchtrigger = data; + break; case DATA_JEDOGA_RESET_INITIANDS: for (std::set<uint64>::const_iterator itr = InitiandGUIDs.begin(); itr != InitiandGUIDs.end(); ++itr) { @@ -236,7 +265,8 @@ public: for (std::set<uint64>::const_iterator itr = InitiandGUIDs.begin(); itr != InitiandGUIDs.end(); ++itr) { Creature* cr = instance->GetCreature(*itr); - if (!cr || (cr && cr->isAlive())) return 0; + if (!cr || (cr && cr->isAlive())) + return 0; } return 1; case DATA_JEDOGA_TRIGGER_SWITCH: return switchtrigger; diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp index 79a102c803f..ca71d8c313e 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp @@ -267,7 +267,7 @@ public: } } else DatterTimer -= diff; - if(me->HasAura(SPELL_LEECHING_SWARM)) + if (me->HasAura(SPELL_LEECHING_SWARM)) me->RemoveAurasDueToSpell(SPELL_LEECHING_SWARM); } diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp index da629fd45e9..6587631f249 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp @@ -51,9 +51,9 @@ public: struct boss_hadronoxAI : public ScriptedAI { - boss_hadronoxAI(Creature* c) : ScriptedAI(c) + boss_hadronoxAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); fMaxDistance = 50.0f; bFirstTime = true; } @@ -99,7 +99,7 @@ public: me->ModifyHealth(int32(me->CountPctFromMaxHealth(10))); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { if (instance) instance->SetData(DATA_HADRONOX_EVENT, DONE); @@ -136,7 +136,8 @@ public: void UpdateAI(const uint32 diff) { //Return since we have no target - if (!UpdateVictim()) return; + if (!UpdateVictim()) + return; // Without he comes up through the air to players on the bridge after krikthir if players crossing this bridge! CheckDistance(fMaxDistance, diff); diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp index 878e1f7555f..4d83be53c93 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp @@ -94,9 +94,9 @@ public: struct boss_krik_thirAI : public ScriptedAI { - boss_krik_thirAI(Creature* c) : ScriptedAI(c) + boss_krik_thirAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -212,7 +212,7 @@ public: struct npc_skittering_infectorAI : public ScriptedAI { - npc_skittering_infectorAI(Creature* c) : ScriptedAI(c) {} + npc_skittering_infectorAI(Creature* creature) : ScriptedAI(creature) {} void JustDied(Unit* /*killer*/) { @@ -234,7 +234,7 @@ public: struct npc_anub_ar_skirmisherAI : public ScriptedAI { - npc_anub_ar_skirmisherAI(Creature* c) : ScriptedAI(c) {} + npc_anub_ar_skirmisherAI(Creature* creature) : ScriptedAI(creature) {} uint32 uiChargeTimer; uint32 uiBackstabTimer; @@ -285,7 +285,7 @@ public: struct npc_anub_ar_shadowcasterAI : public ScriptedAI { - npc_anub_ar_shadowcasterAI(Creature* c) : ScriptedAI(c) {} + npc_anub_ar_shadowcasterAI(Creature* creature) : ScriptedAI(creature) {} uint32 uiShadowBoltTimer; uint32 uiShadowNovaTimer; @@ -331,7 +331,7 @@ public: struct npc_anub_ar_warriorAI : public ScriptedAI { - npc_anub_ar_warriorAI(Creature* c) : ScriptedAI(c){} + npc_anub_ar_warriorAI(Creature* creature) : ScriptedAI(creature){} uint32 uiCleaveTimer; uint32 uiStrikeTimer; @@ -376,7 +376,7 @@ public: struct npc_watcher_gashraAI : public ScriptedAI { - npc_watcher_gashraAI(Creature* c) : ScriptedAI(c) {} + npc_watcher_gashraAI(Creature* creature) : ScriptedAI(creature) {} uint32 uiWebWrapTimer; uint32 uiInfectedBiteTimer; @@ -427,7 +427,7 @@ public: struct npc_watcher_narjilAI : public ScriptedAI { - npc_watcher_narjilAI(Creature* c) : ScriptedAI(c) {} + npc_watcher_narjilAI(Creature* creature) : ScriptedAI(creature) {} uint32 uiWebWrapTimer; uint32 uiInfectedBiteTimer; @@ -481,7 +481,7 @@ public: struct npc_watcher_silthikAI : public ScriptedAI { - npc_watcher_silthikAI(Creature* c) : ScriptedAI(c) {} + npc_watcher_silthikAI(Creature* creature) : ScriptedAI(creature) {} uint32 uiWebWrapTimer; uint32 uiInfectedBiteTimer; diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp index e00db5d6494..12622174e29 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp @@ -64,7 +64,8 @@ public: bool IsEncounterInProgress() const { for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (auiEncounter[i] == IN_PROGRESS) return true; + if (auiEncounter[i] == IN_PROGRESS) + return true; return false; } diff --git a/src/server/scripts/Northrend/CMakeLists.txt b/src/server/scripts/Northrend/CMakeLists.txt index 53b47884e57..3502e7fb104 100644 --- a/src/server/scripts/Northrend/CMakeLists.txt +++ b/src/server/scripts/Northrend/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/> +# Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> # # This file is free software; as a special exception the author gives # unlimited permission to copy and/or distribute it, with or without @@ -22,7 +22,7 @@ set(scripts_STAT_SRCS Northrend/Ulduar/Ulduar/ulduar_teleporter.cpp Northrend/Ulduar/Ulduar/boss_thorim.cpp Northrend/Ulduar/Ulduar/boss_ignis.cpp - Northrend/Ulduar/Ulduar/boss_algalon.cpp + Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp Northrend/Ulduar/Ulduar/instance_ulduar.cpp Northrend/Ulduar/Ulduar/boss_auriaya.cpp Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp index 3e9d8144c19..b115a4ee827 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp @@ -480,7 +480,7 @@ public: if (temp->isAlive() && !temp->getVictim()) { if (temp->HasUnitMovementFlag(MOVEMENTFLAG_WALKING)) - temp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + temp->SetWalk(false); if (temp->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -926,9 +926,7 @@ struct dummy_dragonAI : public ScriptedAI if (instance && instance->GetData(TYPE_SARTHARION_EVENT) != IN_PROGRESS) instance->SetData(TYPE_SHADRON_PREKILLED, 1); if (Creature* pAcolyte = me->FindNearestCreature(NPC_ACOLYTE_OF_SHADRON, 100.0f)) - { pAcolyte->Kill(pAcolyte); - } break; case NPC_VESPERON: iTextId = SAY_VESPERON_DEATH; @@ -936,9 +934,7 @@ struct dummy_dragonAI : public ScriptedAI if (instance && instance->GetData(TYPE_SARTHARION_EVENT) != IN_PROGRESS) instance->SetData(TYPE_VESPERON_PREKILLED, 1); if (Creature* pAcolyte = me->FindNearestCreature(NPC_ACOLYTE_OF_VESPERON, 100.0f)) - { pAcolyte->Kill(pAcolyte); - } break; } @@ -955,7 +951,7 @@ struct dummy_dragonAI : public ScriptedAI return; // Twilight Revenge to main boss - if (Unit* pSartharion = Unit::GetUnit((*me), instance->GetData64(DATA_SARTHARION))) + if (Unit* pSartharion = Unit::GetUnit(*me, instance->GetData64(DATA_SARTHARION))) if (pSartharion->isAlive()) { pSartharion->RemoveAurasDueToSpell(uiSpellId); diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp index f41522f844d..b2cf755c7af 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp @@ -227,9 +227,9 @@ class npc_onyx_flamecaller : public CreatureScript zarithrian->AI()->JustSummoned(me); } - void WaypointReached(uint32 pointId) + void WaypointReached(uint32 waypointId) { - if (pointId == MAX_PATH_FLAMECALLER_WAYPOINTS || pointId == MAX_PATH_FLAMECALLER_WAYPOINTS*2) + if (waypointId == MAX_PATH_FLAMECALLER_WAYPOINTS || waypointId == MAX_PATH_FLAMECALLER_WAYPOINTS*2) { DoZoneInCombat(); SetEscortPaused(true); diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp index 78810e27b05..4e5e01cc745 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp @@ -105,8 +105,8 @@ class boss_saviana_ragefire : public CreatureScript Talk(SAY_CONFLAGRATION); break; case POINT_LAND: - me->SetFlying(false); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetCanFly(false); + me->SetDisableGravity(false); me->SetReactState(REACT_AGGRESSIVE); if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) me->GetMotionMaster()->MovementExpired(); @@ -120,8 +120,8 @@ class boss_saviana_ragefire : public CreatureScript void JustReachedHome() { _JustReachedHome(); - me->SetFlying(false); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetCanFly(false); + me->SetDisableGravity(false); } void KilledUnit(Unit* victim) @@ -146,8 +146,8 @@ class boss_saviana_ragefire : public CreatureScript { case EVENT_FLIGHT: { - me->SetFlying(true); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetCanFly(true); + me->SetDisableGravity(true); me->SetReactState(REACT_PASSIVE); me->GetMotionMaster()->MovePoint(POINT_FLIGHT, SavianaRagefireFlyPos); events.ScheduleEvent(EVENT_FLIGHT, 50000); @@ -206,7 +206,7 @@ class spell_saviana_conflagration_init : public SpellScriptLoader unitList.remove_if (ConflagrationTargetSelector()); uint8 maxSize = uint8(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 6 : 3); if (unitList.size() > maxSize) - Trinity::RandomResizeList(unitList, maxSize); + Trinity::Containers::RandomResizeList(unitList, maxSize); } void HandleDummy(SpellEffIndex effIndex) diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp index cfbbb79c5f6..19ae66b6a60 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp @@ -71,7 +71,7 @@ class npc_xerestrasza : public CreatureScript _isIntro = false; Talk(SAY_XERESTRASZA_EVENT); - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(true); me->GetMotionMaster()->MovePoint(0, xerestraszaMovePos); _events.ScheduleEvent(EVENT_XERESTRASZA_EVENT_1, 16000); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp index 19ed96e8885..305266ee628 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp @@ -414,8 +414,8 @@ public: void JustDied(Unit* /*killer*/) { - if (me->isSummon()) - if (Unit* summoner = me->ToTempSummon()->GetSummoner()) + if (TempSummon* summ = me->ToTempSummon()) + if (Unit* summoner = summ->GetSummoner()) if (summoner->isAlive()) summoner->GetAI()->SetData(1, 0); } @@ -447,9 +447,9 @@ public: uint8 uiWaypoint; - void WaypointReached(uint32 uiPoint) + void WaypointReached(uint32 waypointId) { - if (uiPoint == 0) + if (waypointId == 0) { switch (uiWaypoint) { diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp index 0848d1e9524..9768b50b214 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp @@ -356,7 +356,7 @@ public: Start(false, true, 0, NULL); } - void WaypointReached(uint32 /*i*/) + void WaypointReached(uint32 /*waypointId*/) { } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp index 9fcfcfa47e5..18c972b966c 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp @@ -203,17 +203,19 @@ public: Start(false, true, 0, NULL); } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { - switch (i) + if (!instance) + return; + + switch (waypointId) { case 2: - if ((instance && uiWaypointPath == 3) || uiWaypointPath == 2) + if (uiWaypointPath == 3 || uiWaypointPath == 2) instance->SetData(DATA_MOVEMENT_DONE, instance->GetData(DATA_MOVEMENT_DONE)+1); break; case 3: - if (instance) - instance->SetData(DATA_MOVEMENT_DONE, instance->GetData(DATA_MOVEMENT_DONE)+1); + instance->SetData(DATA_MOVEMENT_DONE, instance->GetData(DATA_MOVEMENT_DONE)+1); break; } } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp index c17ea7411a0..c8236ace88c 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp @@ -125,8 +125,8 @@ public: break; case DATA_IN_POSITION: //movement done. me->GetMotionMaster()->MovePoint(1, 735.81f, 661.92f, 412.39f); - if (GameObject* pGO = GameObject::GetGameObject(*me, instance->GetData64(DATA_MAIN_GATE))) - instance->HandleGameObject(pGO->GetGUID(), false); + if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_MAIN_GATE))) + instance->HandleGameObject(go->GetGUID(), false); NextStep(10000, false, 3); break; case DATA_LESSER_CHAMPIONS_DEFEATED: @@ -488,10 +488,10 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { player->CLOSE_GOSSIP_MENU(); CAST_AI(npc_announcer_toc5::npc_announcer_toc5AI, creature->AI())->StartEncounter(); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp index a9e41d90899..e4dcf978574 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -104,7 +104,7 @@ enum BossSpells SPELL_SPIKE_TELE = 66170, }; -#define SPELL_PERMAFROST_HELPER RAID_MODE<uint32>(66193, 67856, 67855, 67857) +#define SPELL_PERMAFROST_HELPER RAID_MODE<uint32>(66193, 67855, 67856, 67857) enum SummonActions { @@ -141,10 +141,10 @@ public: { boss_anubarak_trialAI(Creature* creature) : ScriptedAI(creature), Summons(me) { - m_instance = (InstanceScript*)creature->GetInstanceScript(); + instance = creature->GetInstanceScript(); } - InstanceScript* m_instance; + InstanceScript* instance; SummonList Summons; std::list<uint64> m_vBurrowGUID; @@ -195,8 +195,8 @@ public: if (who->GetTypeId() == TYPEID_PLAYER) { DoScriptText(urand(0, 1) ? SAY_KILL1 : SAY_KILL2, me); - if (m_instance) - m_instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); + if (instance) + instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); } } @@ -211,8 +211,8 @@ public: void JustReachedHome() { - if (m_instance) - m_instance->SetData(TYPE_ANUBARAK, FAIL); + if (instance) + instance->SetData(TYPE_ANUBARAK, FAIL); //Summon Scarab Swarms neutral at random places for (int i=0; i < 10; i++) if (Creature* temp = me->SummonCreature(NPC_SCARAB, AnubarakLoc[1].GetPositionX()+urand(0, 50)-25, AnubarakLoc[1].GetPositionY()+urand(0, 50)-25, AnubarakLoc[1].GetPositionZ())) @@ -223,8 +223,8 @@ public: { Summons.DespawnAll(); DoScriptText(SAY_DEATH, me); - if (m_instance) - m_instance->SetData(TYPE_ANUBARAK, DONE); + if (instance) + instance->SetData(TYPE_ANUBARAK, DONE); } void JustSummoned(Creature* summoned) @@ -260,10 +260,11 @@ public: DoScriptText(SAY_AGGRO, me); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); me->SetInCombatWithZone(); - if (m_instance) - m_instance->SetData(TYPE_ANUBARAK, IN_PROGRESS); + if (instance) + instance->SetData(TYPE_ANUBARAK, IN_PROGRESS); //Despawn Scarab Swarms neutral - Summons.DoAction(NPC_SCARAB, ACTION_SCARAB_SUBMERGE); + EntryCheckPredicate pred(NPC_SCARAB); + Summons.DoAction(ACTION_SCARAB_SUBMERGE, pred); //Spawn Burrow for (int i=0; i < 4; i++) me->SummonCreature(NPC_BURROW, AnubarakLoc[i+2]); @@ -278,6 +279,9 @@ public: if (!UpdateVictim()) return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + switch (m_uiStage) { case 0: @@ -301,7 +305,8 @@ public: if (IsHeroic() && m_uiNerubianShadowStrikeTimer <= uiDiff) { - Summons.DoAction(NPC_BURROWER, ACTION_SHADOW_STRIKE); + EntryCheckPredicate pred(NPC_BURROWER); + Summons.DoAction(ACTION_SHADOW_STRIKE, pred); m_uiNerubianShadowStrikeTimer = 30*IN_MILLISECONDS; } else m_uiNerubianShadowStrikeTimer -= uiDiff; @@ -426,10 +431,10 @@ public: { mob_swarm_scarabAI(Creature* creature) : ScriptedAI(creature) { - m_instance = (InstanceScript*)creature->GetInstanceScript(); + instance = creature->GetInstanceScript(); } - InstanceScript* m_instance; + InstanceScript* instance; uint32 m_uiDeterminationTimer; @@ -493,10 +498,10 @@ public: { mob_nerubian_burrowerAI(Creature* creature) : ScriptedAI(creature) { - m_instance = (InstanceScript*)creature->GetInstanceScript(); + instance = creature->GetInstanceScript(); } - InstanceScript* m_instance; + InstanceScript* instance; uint32 m_uiSpiderFrenzyTimer; uint32 m_uiSubmergeTimer; @@ -571,8 +576,11 @@ class mob_frost_sphere : public CreatureScript { _isFalling = false; me->SetReactState(REACT_PASSIVE); - me->SetFlying(true); - me->SetDisplayId(me->GetCreatureInfo()->Modelid2); + //! Confirmed sniff 3.3.5.a + me->SetDisableGravity(true); + me->SetByteValue(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); + //! end + me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); me->SetSpeed(MOVE_RUN, 0.5f, false); me->GetMotionMaster()->MoveRandom(20.0f); DoCast(SPELL_FROST_SPHERE); @@ -604,10 +612,10 @@ class mob_frost_sphere : public CreatureScript { case POINT_FALL_GROUND: me->RemoveAurasDueToSpell(SPELL_FROST_SPHERE); - me->SetDisplayId(me->GetCreatureInfo()->Modelid1); + me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); DoCast(SPELL_PERMAFROST_VISUAL); DoCast(SPELL_PERMAFROST); - me->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.0f); + me->SetObjectScale(2.0f); break; } } @@ -636,10 +644,10 @@ public: { mob_anubarak_spikeAI(Creature* creature) : ScriptedAI(creature) { - m_instance = (InstanceScript*)creature->GetInstanceScript(); + instance = creature->GetInstanceScript(); } - InstanceScript* m_instance; + InstanceScript* instance; uint32 m_uiIncreaseSpeedTimer; uint8 m_uiSpeed; uint64 m_uiTargetGUID; @@ -651,6 +659,11 @@ public: m_uiTargetGUID = 0; } + bool CanAIAttack(Unit const* victim) const + { + return victim->GetTypeId() == TYPEID_PLAYER; + } + void EnterCombat(Unit* who) { m_uiTargetGUID = who->GetGUID(); @@ -671,7 +684,7 @@ public: Unit* target = Unit::GetPlayer(*me, m_uiTargetGUID); if (!target || !target->isAlive() || !target->HasAura(SPELL_MARK)) { - if (Creature* pAnubarak = Unit::GetCreature((*me), m_instance->GetData64(NPC_ANUBARAK))) + if (Creature* pAnubarak = Unit::GetCreature((*me), instance->GetData64(NPC_ANUBARAK))) pAnubarak->CastSpell(pAnubarak, SPELL_SPIKE_TELE, false); me->DisappearAndDie(); return; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp index 2fe0bd3f397..79bbb470edf 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp @@ -64,10 +64,10 @@ public: { boss_toc_champion_controllerAI(Creature* creature) : ScriptedAI(creature), Summons(me) { - m_instance = (InstanceScript*) creature->GetInstanceScript(); + instance = creature->GetInstanceScript(); } - InstanceScript* m_instance; + InstanceScript* instance; SummonList Summons; uint32 m_uiChampionsNotStarted; uint32 m_uiChampionsFailed; @@ -101,7 +101,7 @@ public: vOtherEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_WARRIOR : NPC_ALLIANCE_WARRIOR); uint8 healersSubtracted = 2; - if (m_instance->instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_NORMAL || m_instance->instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_HEROIC) + if (instance->instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_NORMAL || instance->instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_HEROIC) healersSubtracted = 1; for (uint8 i = 0; i < healersSubtracted; ++i) { @@ -136,7 +136,7 @@ public: vHealersEntries.erase(vHealersEntries.begin()+pos); } - if (m_instance->instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_NORMAL || m_instance->instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_HEROIC) + if (instance->instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_NORMAL || instance->instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_HEROIC) for (uint8 i = 0; i < 4; ++i) vOtherEntries.erase(vOtherEntries.begin()+urand(0, vOtherEntries.size()-1)); @@ -214,7 +214,7 @@ public: m_uiChampionsFailed++; if (m_uiChampionsFailed + m_uiChampionsKilled >= Summons.size()) { - m_instance->SetData(TYPE_CRUSADERS, FAIL); + instance->SetData(TYPE_CRUSADERS, FAIL); Summons.DespawnAll(); me->DespawnOrUnsummon(); } @@ -227,16 +227,16 @@ public: m_uiChampionsKilled = 0; m_bInProgress = true; Summons.DoZoneInCombat(); - m_instance->SetData(TYPE_CRUSADERS, IN_PROGRESS); + instance->SetData(TYPE_CRUSADERS, IN_PROGRESS); } break; case DONE: m_uiChampionsKilled++; if (m_uiChampionsKilled == 1) - m_instance->SetData(TYPE_CRUSADERS, SPECIAL); + instance->SetData(TYPE_CRUSADERS, SPECIAL); else if (m_uiChampionsKilled >= Summons.size()) { - m_instance->SetData(TYPE_CRUSADERS, DONE); + instance->SetData(TYPE_CRUSADERS, DONE); Summons.DespawnAll(); me->DespawnOrUnsummon(); } @@ -253,11 +253,11 @@ struct boss_faction_championsAI : public ScriptedAI { boss_faction_championsAI(Creature* creature, uint32 aitype) : ScriptedAI(creature) { - m_instance = (InstanceScript*) creature->GetInstanceScript(); + instance = creature->GetInstanceScript(); mAIType = aitype; } - InstanceScript* m_instance; + InstanceScript* instance; uint64 championControllerGUID; uint32 mAIType; @@ -273,8 +273,8 @@ struct boss_faction_championsAI : public ScriptedAI void JustReachedHome() { - if (m_instance) - if (Creature* pChampionController = Unit::GetCreature((*me), m_instance->GetData64(NPC_CHAMPIONS_CONTROLLER))) + if (instance) + if (Creature* pChampionController = Unit::GetCreature((*me), instance->GetData64(NPC_CHAMPIONS_CONTROLLER))) pChampionController->AI()->SetData(2, FAIL); me->DespawnOrUnsummon(); } @@ -292,7 +292,7 @@ struct boss_faction_championsAI : public ScriptedAI std::list<HostileReference*> const& tList = me->getThreatManager().getThreatList(); for (std::list<HostileReference*>::const_iterator itr = tList.begin(); itr != tList.end(); ++itr) { - Unit* unit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); + Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()); if (unit && me->getThreatManager().getThreat(unit)) { if (unit->GetTypeId()==TYPEID_PLAYER) @@ -326,8 +326,8 @@ struct boss_faction_championsAI : public ScriptedAI void JustDied(Unit* /*killer*/) { if (mAIType != AI_PET) - if (m_instance) - if (Creature* pChampionController = Unit::GetCreature((*me), m_instance->GetData64(NPC_CHAMPIONS_CONTROLLER))) + if (instance) + if (Creature* pChampionController = Unit::GetCreature((*me), instance->GetData64(NPC_CHAMPIONS_CONTROLLER))) pChampionController->AI()->SetData(2, DONE); } @@ -335,8 +335,8 @@ struct boss_faction_championsAI : public ScriptedAI { DoCast(me, SPELL_ANTI_AOE, true); me->SetInCombatWithZone(); - if (m_instance) - if (Creature* pChampionController = Unit::GetCreature((*me), m_instance->GetData64(NPC_CHAMPIONS_CONTROLLER))) + if (instance) + if (Creature* pChampionController = Unit::GetCreature((*me), instance->GetData64(NPC_CHAMPIONS_CONTROLLER))) pChampionController->AI()->SetData(2, IN_PROGRESS); } @@ -351,18 +351,18 @@ struct boss_faction_championsAI : public ScriptedAI if (Player* player = players.begin()->getSource()) TeamInInstance = player->GetTeam(); - if (m_instance) + if (instance) { if (TeamInInstance == ALLIANCE) { - if (Creature* temp = Unit::GetCreature(*me, m_instance->GetData64(NPC_VARIAN))) + if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_VARIAN))) DoScriptText(SAY_VARIAN_KILL_HORDE_PLAYER4+urand(0, 3), temp); // + cause we are on negative } else if (Creature* temp = me->FindNearestCreature(NPC_GARROSH, 300.f)) DoScriptText(SAY_GARROSH_KILL_ALLIANCE_PLAYER4+urand(0, 3), temp); // + cause we are on negative - m_instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); + instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); } } } @@ -384,7 +384,7 @@ struct boss_faction_championsAI : public ScriptedAI Unit* target; for (iter = tList.begin(); iter!=tList.end(); ++iter) { - target = Unit::GetUnit((*me), (*iter)->getUnitGuid()); + target = Unit::GetUnit(*me, (*iter)->getUnitGuid()); if (target && target->getPowerType() == POWER_MANA) return target; } @@ -399,7 +399,7 @@ struct boss_faction_championsAI : public ScriptedAI Unit* target; for (iter = tList.begin(); iter!=tList.end(); ++iter) { - target = Unit::GetUnit((*me), (*iter)->getUnitGuid()); + target = Unit::GetUnit(*me, (*iter)->getUnitGuid()); if (target && me->GetDistance2d(target) < distance) ++count; } @@ -408,7 +408,8 @@ struct boss_faction_championsAI : public ScriptedAI void AttackStart(Unit* who) { - if (!who) return; + if (!who) + return; if (me->Attack(who, true)) { @@ -494,7 +495,8 @@ public: void UpdateAI(const uint32 uiDiff) { - if (!UpdateVictim()) return; + if (!UpdateVictim()) + return; if (m_uiNatureGraspTimer <= uiDiff) { @@ -588,7 +590,8 @@ public: void UpdateAI(const uint32 uiDiff) { - if (!UpdateVictim()) return; + if (!UpdateVictim()) + return; if (m_uiHeroismOrBloodlustTimer <= uiDiff) { @@ -687,7 +690,8 @@ public: void UpdateAI(const uint32 uiDiff) { - if (!UpdateVictim()) return; + if (!UpdateVictim()) + return; if (m_uiBubbleTimer <= uiDiff) { @@ -786,7 +790,8 @@ public: void UpdateAI(const uint32 uiDiff) { - if (!UpdateVictim()) return; + if (!UpdateVictim()) + return; if (m_uiPsychicScreamTimer <= uiDiff) { @@ -879,7 +884,8 @@ public: void UpdateAI(const uint32 uiDiff) { - if (!UpdateVictim()) return; + if (!UpdateVictim()) + return; if (m_uiPsychicScreamTimer <= uiDiff) { @@ -990,7 +996,8 @@ public: void UpdateAI(const uint32 uiDiff) { - if (!UpdateVictim()) return; + if (!UpdateVictim()) + return; if (m_uiFearTimer <= uiDiff) { @@ -1093,7 +1100,8 @@ public: void UpdateAI(const uint32 uiDiff) { - if (!UpdateVictim()) return; + if (!UpdateVictim()) + return; if (m_uiCounterspellTimer <= uiDiff) { @@ -1204,7 +1212,8 @@ public: void UpdateAI(const uint32 uiDiff) { - if (!UpdateVictim()) return; + if (!UpdateVictim()) + return; if (m_uiDisengageTimer <= uiDiff) { @@ -1312,7 +1321,8 @@ public: void UpdateAI(const uint32 uiDiff) { - if (!UpdateVictim()) return; + if (!UpdateVictim()) + return; if (m_uiBarkskinTimer <= uiDiff) { @@ -1424,7 +1434,8 @@ public: void UpdateAI(const uint32 uiDiff) { - if (!UpdateVictim()) return; + if (!UpdateVictim()) + return; if (m_uiBladestormTimer <= uiDiff) { @@ -1534,7 +1545,8 @@ public: void UpdateAI(const uint32 uiDiff) { - if (!UpdateVictim()) return; + if (!UpdateVictim()) + return; if (m_uiIceboundFortitudeTimer <= uiDiff) { @@ -1636,7 +1648,8 @@ public: void UpdateAI(const uint32 uiDiff) { - if (!UpdateVictim()) return; + if (!UpdateVictim()) + return; if (m_uiFanOfKnivesTimer <= uiDiff) { @@ -1773,7 +1786,8 @@ public: void UpdateAI(const uint32 uiDiff) { - if (!UpdateVictim()) return; + if (!UpdateVictim()) + return; if (m_uiHeroismOrBloodlustTimer <= uiDiff) { @@ -1873,7 +1887,8 @@ public: void UpdateAI(const uint32 uiDiff) { - if (!UpdateVictim()) return; + if (!UpdateVictim()) + return; if (m_uiRepeteanceTimer <= uiDiff) { @@ -1951,7 +1966,8 @@ public: void UpdateAI(const uint32 uiDiff) { - if (!UpdateVictim()) return; + if (!UpdateVictim()) + return; if (m_uiDevourMagicTimer <= uiDiff) { @@ -2000,7 +2016,8 @@ public: void UpdateAI(const uint32 uiDiff) { - if (!UpdateVictim()) return; + if (!UpdateVictim()) + return; if (m_uiClawTimer <= uiDiff) { @@ -2011,11 +2028,8 @@ public: boss_faction_championsAI::UpdateAI(uiDiff); } }; - }; -/*========================================================*/ - void AddSC_boss_faction_champions() { new boss_toc_champion_controller(); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp index 6cd049967c1..a7328b43826 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp @@ -106,11 +106,11 @@ public: { boss_jaraxxusAI(Creature* creature) : ScriptedAI(creature), Summons(me) { - m_instance = creature->GetInstanceScript(); + instance = creature->GetInstanceScript(); Reset(); } - InstanceScript* m_instance; + InstanceScript* instance; SummonList Summons; @@ -124,8 +124,8 @@ public: void Reset() { - if (m_instance) - m_instance->SetData(TYPE_JARAXXUS, NOT_STARTED); + if (instance) + instance->SetData(TYPE_JARAXXUS, NOT_STARTED); SetEquipmentSlots(false, EQUIP_MAIN, EQUIP_OFFHAND, EQUIP_RANGED); m_uiFelFireballTimer = 5*IN_MILLISECONDS; m_uiFelLightningTimer = urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS); @@ -139,8 +139,8 @@ public: void JustReachedHome() { - if (m_instance) - m_instance->SetData(TYPE_JARAXXUS, FAIL); + if (instance) + instance->SetData(TYPE_JARAXXUS, FAIL); DoCast(me, SPELL_JARAXXUS_CHAINS); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->SetReactState(REACT_PASSIVE); @@ -150,8 +150,8 @@ public: { if (who->GetTypeId() == TYPEID_PLAYER) { - if (m_instance) - m_instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); + if (instance) + instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); } } @@ -159,8 +159,8 @@ public: { Summons.DespawnAll(); DoScriptText(SAY_DEATH, me); - if (m_instance) - m_instance->SetData(TYPE_JARAXXUS, DONE); + if (instance) + instance->SetData(TYPE_JARAXXUS, DONE); } void JustSummoned(Creature* summoned) @@ -171,8 +171,8 @@ public: void EnterCombat(Unit* /*who*/) { me->SetInCombatWithZone(); - if (m_instance) - m_instance->SetData(TYPE_JARAXXUS, IN_PROGRESS); + if (instance) + instance->SetData(TYPE_JARAXXUS, IN_PROGRESS); DoScriptText(SAY_AGGRO, me); } @@ -289,11 +289,11 @@ public: { mob_infernal_volcanoAI(Creature* creature) : Scripted_NoMovementAI(creature), Summons(me) { - m_instance = (InstanceScript*)creature->GetInstanceScript(); + instance = creature->GetInstanceScript(); Reset(); } - InstanceScript* m_instance; + InstanceScript* instance; SummonList Summons; @@ -344,11 +344,11 @@ public: { mob_fel_infernalAI(Creature* creature) : ScriptedAI(creature) { - m_instance = (InstanceScript*)creature->GetInstanceScript(); + instance = creature->GetInstanceScript(); Reset(); } - InstanceScript* m_instance; + InstanceScript* instance; uint32 m_uiFelStreakTimer; void Reset() @@ -368,7 +368,7 @@ public: if (!UpdateVictim()) return; - if (m_instance && m_instance->GetData(TYPE_JARAXXUS) != IN_PROGRESS) + if (instance && instance->GetData(TYPE_JARAXXUS) != IN_PROGRESS) me->DespawnOrUnsummon(); if (m_uiFelStreakTimer <= uiDiff) @@ -398,11 +398,11 @@ public: { mob_nether_portalAI(Creature* creature) : ScriptedAI(creature), Summons(me) { - m_instance = (InstanceScript*)creature->GetInstanceScript(); + instance = creature->GetInstanceScript(); Reset(); } - InstanceScript* m_instance; + InstanceScript* instance; SummonList Summons; @@ -453,13 +453,13 @@ public: { mob_mistress_of_painAI(Creature* creature) : ScriptedAI(creature) { - m_instance = (InstanceScript*)creature->GetInstanceScript(); - if (m_instance) - m_instance->SetData(DATA_MISTRESS_OF_PAIN_COUNT, INCREASE); + instance = creature->GetInstanceScript(); + if (instance) + instance->SetData(DATA_MISTRESS_OF_PAIN_COUNT, INCREASE); Reset(); } - InstanceScript* m_instance; + InstanceScript* instance; uint32 m_uiShivanSlashTimer; uint32 m_uiSpinningStrikeTimer; uint32 m_uiMistressKissTimer; @@ -474,13 +474,13 @@ public: void JustDied(Unit* /*killer*/) { - if (m_instance) - m_instance->SetData(DATA_MISTRESS_OF_PAIN_COUNT, DECREASE); + if (instance) + instance->SetData(DATA_MISTRESS_OF_PAIN_COUNT, DECREASE); } void UpdateAI(const uint32 uiDiff) { - if (m_instance && m_instance->GetData(TYPE_JARAXXUS) != IN_PROGRESS) + if (instance && instance->GetData(TYPE_JARAXXUS) != IN_PROGRESS) { me->DespawnOrUnsummon(); return; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp index 1eca7edb590..5bda32941c2 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp @@ -123,10 +123,10 @@ public: { boss_gormokAI(Creature* creature) : ScriptedAI(creature), Summons(me) { - m_instance = (InstanceScript*)creature->GetInstanceScript(); + instance = creature->GetInstanceScript(); } - InstanceScript* m_instance; + InstanceScript* instance; uint32 m_uiImpaleTimer; uint32 m_uiStaggeringStompTimer; @@ -151,7 +151,7 @@ public: void EnterEvadeMode() { - m_instance->DoUseDoorOrButton(m_instance->GetData64(GO_MAIN_GATE_DOOR)); + instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); ScriptedAI::EnterEvadeMode(); } @@ -163,7 +163,7 @@ public: switch (pointId) { case 0: - m_instance->DoUseDoorOrButton(m_instance->GetData64(GO_MAIN_GATE_DOOR)); + instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_AGGRESSIVE); me->SetInCombatWithZone(); @@ -173,16 +173,16 @@ public: void JustDied(Unit* /*killer*/) { - if (m_instance) - m_instance->SetData(TYPE_NORTHREND_BEASTS, GORMOK_DONE); + if (instance) + instance->SetData(TYPE_NORTHREND_BEASTS, GORMOK_DONE); } void JustReachedHome() { - if (m_instance) + if (instance) { - m_instance->DoUseDoorOrButton(m_instance->GetData64(GO_MAIN_GATE_DOOR)); - m_instance->SetData(TYPE_NORTHREND_BEASTS, FAIL); + instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); + instance->SetData(TYPE_NORTHREND_BEASTS, FAIL); } me->DespawnOrUnsummon(); } @@ -190,7 +190,7 @@ public: void EnterCombat(Unit* /*who*/) { me->SetInCombatWithZone(); - m_instance->SetData(TYPE_NORTHREND_BEASTS, GORMOK_IN_PROGRESS); + instance->SetData(TYPE_NORTHREND_BEASTS, GORMOK_IN_PROGRESS); } void JustSummoned(Creature* summon) @@ -263,12 +263,12 @@ public: { mob_snobold_vassalAI(Creature* creature) : ScriptedAI(creature) { - m_instance = (InstanceScript*)creature->GetInstanceScript(); - if (m_instance) - m_instance->SetData(DATA_SNOBOLD_COUNT, INCREASE); + instance = creature->GetInstanceScript(); + if (instance) + instance->SetData(DATA_SNOBOLD_COUNT, INCREASE); } - InstanceScript* m_instance; + InstanceScript* instance; uint32 m_uiFireBombTimer; uint32 m_uiBatterTimer; uint32 m_uiHeadCrackTimer; @@ -284,15 +284,15 @@ public: m_uiTargetGUID = 0; m_bTargetDied = false; - if (m_instance) - m_uiBossGUID = m_instance->GetData64(NPC_GORMOK); + if (instance) + m_uiBossGUID = instance->GetData64(NPC_GORMOK); //Workaround for Snobold me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); } void EnterEvadeMode() { - m_instance->DoUseDoorOrButton(m_instance->GetData64(GO_MAIN_GATE_DOOR)); + instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); ScriptedAI::EnterEvadeMode(); } @@ -328,8 +328,8 @@ public: if (Unit* target = Unit::GetPlayer(*me, m_uiTargetGUID)) if (target->isAlive()) target->RemoveAurasDueToSpell(SPELL_SNOBOLLED); - if (m_instance) - m_instance->SetData(DATA_SNOBOLD_COUNT, DECREASE); + if (instance) + instance->SetData(DATA_SNOBOLD_COUNT, DECREASE); } void UpdateAI(uint32 const diff) @@ -341,9 +341,9 @@ public: { if (!target->isAlive()) { - if (m_instance) + if (instance) { - Unit* gormok = ObjectAccessor::GetCreature(*me, m_instance->GetData64(NPC_GORMOK)); + Unit* gormok = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_GORMOK)); if (gormok && gormok->isAlive()) { SetCombatMovement(false); @@ -454,7 +454,8 @@ struct boss_jormungarAI : public ScriptedAI void UpdateAI(uint32 const diff) { - if (!UpdateVictim()) return; + if (!UpdateVictim()) + return; if (instanceScript && instanceScript->GetData(TYPE_NORTHREND_BEASTS) == SNAKES_SPECIAL && !enraged) { @@ -757,10 +758,10 @@ public: { boss_icehowlAI(Creature* creature) : ScriptedAI(creature) { - m_instance = (InstanceScript*)creature->GetInstanceScript(); + instance = creature->GetInstanceScript(); } - InstanceScript* m_instance; + InstanceScript* instance; uint32 m_uiFerociousButtTimer; uint32 m_uiArticBreathTimer; @@ -794,8 +795,8 @@ public: void JustDied(Unit* /*killer*/) { - if (m_instance) - m_instance->SetData(TYPE_NORTHREND_BEASTS, ICEHOWL_DONE); + if (instance) + instance->SetData(TYPE_NORTHREND_BEASTS, ICEHOWL_DONE); } void MovementInform(uint32 type, uint32 pointId) @@ -826,7 +827,7 @@ public: m_bMovementFinish = true; break; case 2: - m_instance->DoUseDoorOrButton(m_instance->GetData64(GO_MAIN_GATE_DOOR)); + instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_AGGRESSIVE); me->SetInCombatWithZone(); @@ -836,16 +837,16 @@ public: void EnterEvadeMode() { - m_instance->DoUseDoorOrButton(m_instance->GetData64(GO_MAIN_GATE_DOOR)); + instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); ScriptedAI::EnterEvadeMode(); } void JustReachedHome() { - if (m_instance) + if (instance) { - m_instance->DoUseDoorOrButton(m_instance->GetData64(GO_MAIN_GATE_DOOR)); - m_instance->SetData(TYPE_NORTHREND_BEASTS, FAIL); + instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); + instance->SetData(TYPE_NORTHREND_BEASTS, FAIL); } me->DespawnOrUnsummon(); } @@ -854,15 +855,15 @@ public: { if (who->GetTypeId() == TYPEID_PLAYER) { - if (m_instance) - m_instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); + if (instance) + instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); } } void EnterCombat(Unit* /*who*/) { - if (m_instance) - m_instance->SetData(TYPE_NORTHREND_BEASTS, ICEHOWL_IN_PROGRESS); + if (instance) + instance->SetData(TYPE_NORTHREND_BEASTS, ICEHOWL_IN_PROGRESS); me->SetInCombatWithZone(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index 242b2f2f0ea..cf84abb482f 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -143,10 +143,10 @@ struct boss_twin_baseAI : public ScriptedAI { boss_twin_baseAI(Creature* creature) : ScriptedAI(creature), Summons(me) { - m_instance = (InstanceScript*)creature->GetInstanceScript(); + instance = creature->GetInstanceScript(); } - InstanceScript* m_instance; + InstanceScript* instance; SummonList Summons; AuraStateType m_uiAuraState; @@ -176,7 +176,7 @@ struct boss_twin_baseAI : public ScriptedAI me->SetReactState(REACT_PASSIVE); me->ModifyAuraState(m_uiAuraState, true); /* Uncomment this once that they are flying above the ground - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetLevitate(true); me->SetFlying(true); */ m_bIsBerserk = false; @@ -190,8 +190,8 @@ struct boss_twin_baseAI : public ScriptedAI void JustReachedHome() { - if (m_instance) - m_instance->SetData(TYPE_VALKIRIES, FAIL); + if (instance) + instance->SetData(TYPE_VALKIRIES, FAIL); Summons.DespawnAll(); me->DespawnOrUnsummon(); @@ -199,12 +199,13 @@ struct boss_twin_baseAI : public ScriptedAI void MovementInform(uint32 uiType, uint32 uiId) { - if (uiType != POINT_MOTION_TYPE) return; + if (uiType != POINT_MOTION_TYPE) + return; switch (uiId) { case 1: - m_instance->DoUseDoorOrButton(m_instance->GetData64(GO_MAIN_GATE_DOOR)); + instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_AGGRESSIVE); break; @@ -216,8 +217,8 @@ struct boss_twin_baseAI : public ScriptedAI if (who->GetTypeId() == TYPEID_PLAYER) { DoScriptText(urand(0, 1) ? SAY_KILL1 : SAY_KILL2, me); - if (m_instance) - m_instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); + if (instance) + instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); } } @@ -231,12 +232,12 @@ struct boss_twin_baseAI : public ScriptedAI switch (summoned->GetEntry()) { case NPC_LIGHT_ESSENCE: - m_instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_LIGHT_ESSENCE_HELPER); - m_instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_POWERING_UP_HELPER); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_LIGHT_ESSENCE_HELPER); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_POWERING_UP_HELPER); break; case NPC_DARK_ESSENCE: - m_instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_DARK_ESSENCE_HELPER); - m_instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_POWERING_UP_HELPER); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_DARK_ESSENCE_HELPER); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_POWERING_UP_HELPER); break; case NPC_BULLET_CONTROLLER: me->m_Events.AddEvent(new OrbsDespawner(me), me->m_Events.CalculateTime(100)); @@ -248,7 +249,7 @@ struct boss_twin_baseAI : public ScriptedAI void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); - if (m_instance) + if (instance) { if (Creature* pSister = GetSister()) { @@ -257,13 +258,13 @@ struct boss_twin_baseAI : public ScriptedAI me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); pSister->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - m_instance->SetData(TYPE_VALKIRIES, DONE); + instance->SetData(TYPE_VALKIRIES, DONE); Summons.DespawnAll(); } else { me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - m_instance->SetData(TYPE_VALKIRIES, SPECIAL); + instance->SetData(TYPE_VALKIRIES, SPECIAL); } } } @@ -273,20 +274,20 @@ struct boss_twin_baseAI : public ScriptedAI // Called when sister pointer needed Creature* GetSister() { - return Unit::GetCreature((*me), m_instance->GetData64(m_uiSisterNpcId)); + return Unit::GetCreature((*me), instance->GetData64(m_uiSisterNpcId)); } void EnterCombat(Unit* /*who*/) { me->SetInCombatWithZone(); - if (m_instance) + if (instance) { if (Creature* pSister = GetSister()) { me->AddAura(m_uiMyEmphatySpellId, pSister); pSister->SetInCombatWithZone(); } - m_instance->SetData(TYPE_VALKIRIES, IN_PROGRESS); + instance->SetData(TYPE_VALKIRIES, IN_PROGRESS); } DoScriptText(SAY_AGGRO, me); @@ -315,7 +316,7 @@ struct boss_twin_baseAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) { - if (!m_instance || !UpdateVictim()) + if (!instance || !UpdateVictim()) return; switch (m_uiStage) @@ -406,10 +407,10 @@ public: { boss_fjolaAI(Creature* creature) : boss_twin_baseAI(creature) { - m_instance = (InstanceScript*)creature->GetInstanceScript(); + instance = creature->GetInstanceScript(); } - InstanceScript* m_instance; + InstanceScript* instance; void Reset() { boss_twin_baseAI::Reset(); @@ -429,17 +430,17 @@ public: m_uiTouchSpellId = SPELL_LIGHT_TOUCH; m_uiSpikeSpellId = SPELL_LIGHT_TWIN_SPIKE; - if (m_instance) + if (instance) { - m_instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, EVENT_START_TWINS_FIGHT); + instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, EVENT_START_TWINS_FIGHT); } } void EnterCombat(Unit* who) { - if (m_instance) + if (instance) { - m_instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, EVENT_START_TWINS_FIGHT); + instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, EVENT_START_TWINS_FIGHT); } me->SummonCreature(NPC_BULLET_CONTROLLER, ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 0.0f, TEMPSUMMON_MANUAL_DESPAWN); @@ -448,14 +449,14 @@ public: void EnterEvadeMode() { - m_instance->DoUseDoorOrButton(m_instance->GetData64(GO_MAIN_GATE_DOOR)); + instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); boss_twin_baseAI::EnterEvadeMode(); } void JustReachedHome() { - if (m_instance) - m_instance->DoUseDoorOrButton(m_instance->GetData64(GO_MAIN_GATE_DOOR)); + if (instance) + instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); boss_twin_baseAI::JustReachedHome(); } @@ -552,10 +553,10 @@ struct mob_unleashed_ballAI : public ScriptedAI { mob_unleashed_ballAI(Creature* creature) : ScriptedAI(creature) { - m_instance = (InstanceScript*)creature->GetInstanceScript(); + instance = creature->GetInstanceScript(); } - InstanceScript* m_instance; + InstanceScript* instance; uint32 m_uiRangeCheckTimer; void MoveToNextPoint() @@ -576,8 +577,8 @@ struct mob_unleashed_ballAI : public ScriptedAI { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_PASSIVE); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->SetFlying(true); + me->SetDisableGravity(true); + me->SetCanFly(true); SetCombatMovement(false); MoveToNextPoint(); m_uiRangeCheckTimer = IN_MILLISECONDS; @@ -585,7 +586,8 @@ struct mob_unleashed_ballAI : public ScriptedAI void MovementInform(uint32 uiType, uint32 uiId) { - if (uiType != POINT_MOTION_TYPE) return; + if (uiType != POINT_MOTION_TYPE) + return; switch (uiId) { @@ -617,8 +619,7 @@ public: { if (m_uiRangeCheckTimer < uiDiff) { - if (Unit* target = me->SelectNearestTarget(2.0f)) - if (target->GetTypeId() == TYPEID_PLAYER && target->isAlive()) + if (me->SelectNearestPlayer(2.0f)) { DoCastAOE(SPELL_UNLEASHED_DARK); me->GetMotionMaster()->MoveIdle(); @@ -659,8 +660,7 @@ public: { if (m_uiRangeCheckTimer < uiDiff) { - if (Unit* target = me->SelectNearestTarget(2.0f)) - if (target->GetTypeId() == TYPEID_PLAYER && target->isAlive()) + if (me->SelectNearestPlayer(2.0f)) { DoCastAOE(SPELL_UNLEASHED_LIGHT); me->GetMotionMaster()->MoveIdle(); @@ -759,7 +759,7 @@ class spell_powering_up : public SpellScriptLoader uint32 spellId; - bool Validate(SpellEntry const* /*spellEntry*/) + bool Load() { spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_SURGE_OF_SPEED, GetCaster()); if (!sSpellMgr->GetSpellInfo(spellId)) @@ -769,7 +769,7 @@ class spell_powering_up : public SpellScriptLoader void HandleScriptEffect(SpellEffIndex /*effIndex*/) { - if (Unit* target = GetTargetUnit()) + if (Unit* target = GetExplTargetUnit()) if (urand(0, 99) < 15) target->CastSpell(target, spellId, true); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp index 03de3d374ef..1966e26b128 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp @@ -105,7 +105,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript bool IsEncounterInProgress() const { - for (uint8 i = 0; i < MAX_ENCOUNTERS ; ++i) + for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) if (EncounterStatus[i] == IN_PROGRESS) return true; return false; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp index 3831e4824ad..2643b8d60c7 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp @@ -106,10 +106,10 @@ class npc_announcer_toc10 : public CreatureScript { npc_announcer_toc10AI(Creature* creature) : ScriptedAI(creature) { - m_instance = (InstanceScript*)creature->GetInstanceScript(); + instance = creature->GetInstanceScript(); } - InstanceScript* m_instance; + InstanceScript* instance; void Reset() { @@ -239,10 +239,10 @@ class boss_lich_king_toc : public CreatureScript { boss_lich_king_tocAI(Creature* creature) : ScriptedAI(creature) { - m_instance = (InstanceScript*)creature->GetInstanceScript(); + instance = creature->GetInstanceScript(); } - InstanceScript* m_instance; + InstanceScript* instance; uint32 m_uiUpdateTimer; void Reset() @@ -254,8 +254,8 @@ class boss_lich_king_toc : public CreatureScript summoned->CastSpell(summoned, 51807, false); summoned->SetDisplayId(11686); } - if (m_instance) m_instance->SetData(TYPE_LICH_KING, IN_PROGRESS); - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + if (instance) instance->SetData(TYPE_LICH_KING, IN_PROGRESS); + me->SetWalk(true); } void MovementInform(uint32 uiType, uint32 uiId) @@ -265,77 +265,80 @@ class boss_lich_king_toc : public CreatureScript switch (uiId) { case 0: - m_instance->SetData(TYPE_EVENT, 5030); + instance->SetData(TYPE_EVENT, 5030); break; case 1: - m_instance->SetData(TYPE_EVENT, 5050); + instance->SetData(TYPE_EVENT, 5050); break; } } void UpdateAI(const uint32 uiDiff) { - if (!m_instance) return; - if (m_instance->GetData(TYPE_EVENT_NPC) != NPC_LICH_KING_1) return; + if (!instance) + return; + + if (instance->GetData(TYPE_EVENT_NPC) != NPC_LICH_KING_1) + return; - m_uiUpdateTimer = m_instance->GetData(TYPE_EVENT_TIMER); + m_uiUpdateTimer = instance->GetData(TYPE_EVENT_TIMER); if (m_uiUpdateTimer <= uiDiff) { - switch (m_instance->GetData(TYPE_EVENT)) + switch (instance->GetData(TYPE_EVENT)) { case 5010: DoScriptText(SAY_STAGE_4_02, me); m_uiUpdateTimer = 3000; me->GetMotionMaster()->MovePoint(0, LichKingLoc[0]); - m_instance->SetData(TYPE_EVENT, 5020); + instance->SetData(TYPE_EVENT, 5020); break; case 5030: DoScriptText(SAY_STAGE_4_04, me); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_TALK); m_uiUpdateTimer = 10000; - m_instance->SetData(TYPE_EVENT, 5040); + instance->SetData(TYPE_EVENT, 5040); break; case 5040: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); me->GetMotionMaster()->MovePoint(1, LichKingLoc[1]); m_uiUpdateTimer = 1000; - m_instance->SetData(TYPE_EVENT, 0); + instance->SetData(TYPE_EVENT, 0); break; case 5050: me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); m_uiUpdateTimer = 3000; - m_instance->SetData(TYPE_EVENT, 5060); + instance->SetData(TYPE_EVENT, 5060); break; case 5060: DoScriptText(SAY_STAGE_4_05, me); me->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL); m_uiUpdateTimer = 2500; - m_instance->SetData(TYPE_EVENT, 5070); + instance->SetData(TYPE_EVENT, 5070); break; case 5070: me->CastSpell(me, 68198, false); m_uiUpdateTimer = 1500; - m_instance->SetData(TYPE_EVENT, 5080); + instance->SetData(TYPE_EVENT, 5080); break; case 5080: - if (GameObject* pGoFloor = m_instance->instance->GetGameObject(m_instance->GetData64(GO_ARGENT_COLISEUM_FLOOR))) - pGoFloor->SetDestructibleState(GO_DESTRUCTIBLE_DESTROYED); + if (GameObject* go = instance->instance->GetGameObject(instance->GetData64(GO_ARGENT_COLISEUM_FLOOR))) + go->SetDestructibleState(GO_DESTRUCTIBLE_DESTROYED); me->CastSpell(me, 69016, false); - if (m_instance) + if (instance) { - m_instance->SetData(TYPE_LICH_KING, DONE); - Creature* temp = Unit::GetCreature(*me, m_instance->GetData64(NPC_ANUBARAK)); + instance->SetData(TYPE_LICH_KING, DONE); + Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_ANUBARAK)); if (!temp || !temp->isAlive()) temp = me->SummonCreature(NPC_ANUBARAK, AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 3, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME); - m_instance->SetData(TYPE_EVENT, 0); + instance->SetData(TYPE_EVENT, 0); } me->DespawnOrUnsummon(); m_uiUpdateTimer = 20000; break; } } else m_uiUpdateTimer -= uiDiff; - m_instance->SetData(TYPE_EVENT_TIMER, m_uiUpdateTimer); + instance->SetData(TYPE_EVENT_TIMER, m_uiUpdateTimer); } }; @@ -355,10 +358,10 @@ class npc_fizzlebang_toc : public CreatureScript { npc_fizzlebang_tocAI(Creature* creature) : ScriptedAI(creature), Summons(me) { - m_instance = (InstanceScript*)me->GetInstanceScript(); + instance = me->GetInstanceScript(); } - InstanceScript* m_instance; + InstanceScript* instance; SummonList Summons; uint32 m_uiUpdateTimer; uint64 m_uiPortalGUID; @@ -367,8 +370,8 @@ class npc_fizzlebang_toc : public CreatureScript void JustDied(Unit* killer) { DoScriptText(SAY_STAGE_1_06, me, killer); - m_instance->SetData(TYPE_EVENT, 1180); - if (Creature* temp = Unit::GetCreature(*me, m_instance->GetData64(NPC_JARAXXUS))) + instance->SetData(TYPE_EVENT, 1180); + if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_JARAXXUS))) { temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); temp->SetReactState(REACT_AGGRESSIVE); @@ -378,24 +381,25 @@ class npc_fizzlebang_toc : public CreatureScript void Reset() { - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(true); m_uiPortalGUID = 0; me->GetMotionMaster()->MovePoint(1, ToCCommonLoc[10].GetPositionX(), ToCCommonLoc[10].GetPositionY()-60, ToCCommonLoc[10].GetPositionZ()); } void MovementInform(uint32 uiType, uint32 uiId) { - if (uiType != POINT_MOTION_TYPE) return; + if (uiType != POINT_MOTION_TYPE) + return; switch (uiId) { case 1: - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - if (m_instance) + me->SetWalk(false); + if (instance) { - m_instance->DoUseDoorOrButton(m_instance->GetData64(GO_MAIN_GATE_DOOR)); - m_instance->SetData(TYPE_EVENT, 1120); - m_instance->SetData(TYPE_EVENT_TIMER, 1000); + instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); + instance->SetData(TYPE_EVENT, 1120); + instance->SetData(TYPE_EVENT_TIMER, 1000); } break; } @@ -408,22 +412,24 @@ class npc_fizzlebang_toc : public CreatureScript void UpdateAI(const uint32 uiDiff) { - if (!m_instance) return; + if (!instance) + return; - if (m_instance->GetData(TYPE_EVENT_NPC) != NPC_FIZZLEBANG) return; + if (instance->GetData(TYPE_EVENT_NPC) != NPC_FIZZLEBANG) + return; - m_uiUpdateTimer = m_instance->GetData(TYPE_EVENT_TIMER); + m_uiUpdateTimer = instance->GetData(TYPE_EVENT_TIMER); if (m_uiUpdateTimer <= uiDiff) { - switch (m_instance->GetData(TYPE_EVENT)) + switch (instance->GetData(TYPE_EVENT)) { case 1110: - m_instance->SetData(TYPE_EVENT, 1120); + instance->SetData(TYPE_EVENT, 1120); m_uiUpdateTimer = 4000; break; case 1120: DoScriptText(SAY_STAGE_1_02, me); - m_instance->SetData(TYPE_EVENT, 1130); + instance->SetData(TYPE_EVENT, 1130); m_uiUpdateTimer = 12000; break; case 1130: @@ -433,16 +439,16 @@ class npc_fizzlebang_toc : public CreatureScript if (Unit* pTrigger = me->SummonCreature(NPC_TRIGGER, ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 4.69494f, TEMPSUMMON_MANUAL_DESPAWN)) { m_uiTriggerGUID = pTrigger->GetGUID(); - pTrigger->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.0f); + pTrigger->SetObjectScale(2.0f); pTrigger->SetDisplayId(22862); pTrigger->CastSpell(pTrigger, SPELL_WILFRED_PORTAL, false); } - m_instance->SetData(TYPE_EVENT, 1132); + instance->SetData(TYPE_EVENT, 1132); m_uiUpdateTimer = 4000; break; case 1132: me->GetMotionMaster()->MovementExpired(); - m_instance->SetData(TYPE_EVENT, 1134); + instance->SetData(TYPE_EVENT, 1134); m_uiUpdateTimer = 4000; break; case 1134: @@ -450,15 +456,15 @@ class npc_fizzlebang_toc : public CreatureScript if (Creature* pPortal = me->SummonCreature(NPC_WILFRED_PORTAL, ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 4.71239f, TEMPSUMMON_MANUAL_DESPAWN)) { pPortal->SetReactState(REACT_PASSIVE); - pPortal->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.0f); + pPortal->SetObjectScale(2.0f); pPortal->CastSpell(pPortal, SPELL_WILFRED_PORTAL, false); m_uiPortalGUID = pPortal->GetGUID(); } m_uiUpdateTimer = 4000; - m_instance->SetData(TYPE_EVENT, 1135); + instance->SetData(TYPE_EVENT, 1135); break; case 1135: - m_instance->SetData(TYPE_EVENT, 1140); + instance->SetData(TYPE_EVENT, 1140); m_uiUpdateTimer = 3000; break; case 1140: @@ -469,27 +475,27 @@ class npc_fizzlebang_toc : public CreatureScript temp->SetReactState(REACT_PASSIVE); temp->GetMotionMaster()->MovePoint(0, ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY()-10, ToCCommonLoc[1].GetPositionZ()); } - m_instance->SetData(TYPE_EVENT, 1142); + instance->SetData(TYPE_EVENT, 1142); m_uiUpdateTimer = 5000; break; case 1142: - if (Creature* temp = Unit::GetCreature(*me, m_instance->GetData64(NPC_JARAXXUS))) + if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_JARAXXUS))) temp->SetTarget(me->GetGUID()); if (Creature* pTrigger = Unit::GetCreature(*me, m_uiTriggerGUID)) pTrigger->DespawnOrUnsummon(); if (Creature* pPortal = Unit::GetCreature(*me, m_uiPortalGUID)) pPortal->DespawnOrUnsummon(); - m_instance->SetData(TYPE_EVENT, 1144); + instance->SetData(TYPE_EVENT, 1144); m_uiUpdateTimer = 10000; break; case 1144: - if (Creature* temp = Unit::GetCreature(*me, m_instance->GetData64(NPC_JARAXXUS))) + if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_JARAXXUS))) DoScriptText(SAY_STAGE_1_05, temp); - m_instance->SetData(TYPE_EVENT, 1150); + instance->SetData(TYPE_EVENT, 1150); m_uiUpdateTimer = 5000; break; case 1150: - if (Creature* temp = Unit::GetCreature(*me, m_instance->GetData64(NPC_JARAXXUS))) + if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_JARAXXUS))) { //1-shot Fizzlebang temp->CastSpell(me, 67888, false); @@ -497,12 +503,12 @@ class npc_fizzlebang_toc : public CreatureScript temp->AddThreat(me, 1000.0f); temp->AI()->AttackStart(me); } - m_instance->SetData(TYPE_EVENT, 1160); + instance->SetData(TYPE_EVENT, 1160); m_uiUpdateTimer = 3000; break; } } else m_uiUpdateTimer -= uiDiff; - m_instance->SetData(TYPE_EVENT_TIMER, m_uiUpdateTimer); + instance->SetData(TYPE_EVENT_TIMER, m_uiUpdateTimer); } }; @@ -522,10 +528,10 @@ class npc_tirion_toc : public CreatureScript { npc_tirion_tocAI(Creature* creature) : ScriptedAI(creature) { - m_instance = (InstanceScript*)me->GetInstanceScript(); + instance = me->GetInstanceScript(); } - InstanceScript* m_instance; + InstanceScript* instance; uint32 m_uiUpdateTimer; void Reset() {} @@ -534,31 +540,34 @@ class npc_tirion_toc : public CreatureScript void UpdateAI(const uint32 uiDiff) { - if (!m_instance) return; - if (m_instance->GetData(TYPE_EVENT_NPC) != NPC_TIRION) return; + if (!instance) + return; - m_uiUpdateTimer = m_instance->GetData(TYPE_EVENT_TIMER); + if (instance->GetData(TYPE_EVENT_NPC) != NPC_TIRION) + return; + + m_uiUpdateTimer = instance->GetData(TYPE_EVENT_TIMER); if (m_uiUpdateTimer <= uiDiff) { - switch (m_instance->GetData(TYPE_EVENT)) + switch (instance->GetData(TYPE_EVENT)) { case 110: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK); DoScriptText(SAY_STAGE_0_01, me); m_uiUpdateTimer = 22000; - m_instance->SetData(TYPE_EVENT, 120); + instance->SetData(TYPE_EVENT, 120); break; case 140: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK); DoScriptText(SAY_STAGE_0_02, me); m_uiUpdateTimer = 5000; - m_instance->SetData(TYPE_EVENT, 150); + instance->SetData(TYPE_EVENT, 150); break; case 150: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); - if (m_instance->GetData(TYPE_BEASTS) != DONE) + if (instance->GetData(TYPE_BEASTS) != DONE) { - m_instance->DoUseDoorOrButton(m_instance->GetData64(GO_MAIN_GATE_DOOR)); + instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); if (Creature* temp = me->SummonCreature(NPC_GORMOK, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 5, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30*IN_MILLISECONDS)) { @@ -568,26 +577,26 @@ class npc_tirion_toc : public CreatureScript } } m_uiUpdateTimer = 3000; - m_instance->SetData(TYPE_EVENT, 155); + instance->SetData(TYPE_EVENT, 155); break; case 155: - m_instance->SetData(TYPE_BEASTS, IN_PROGRESS); + instance->SetData(TYPE_BEASTS, IN_PROGRESS); m_uiUpdateTimer = 5000; - m_instance->SetData(TYPE_EVENT, 160); + instance->SetData(TYPE_EVENT, 160); break; case 200: DoScriptText(SAY_STAGE_0_04, me); m_uiUpdateTimer = 8000; - m_instance->SetData(TYPE_EVENT, 205); + instance->SetData(TYPE_EVENT, 205); break; case 205: m_uiUpdateTimer = 3000; - m_instance->SetData(TYPE_EVENT, 210); + instance->SetData(TYPE_EVENT, 210); break; case 210: - if (m_instance->GetData(TYPE_BEASTS) != DONE) + if (instance->GetData(TYPE_BEASTS) != DONE) { - m_instance->DoUseDoorOrButton(m_instance->GetData64(GO_MAIN_GATE_DOOR)); + instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); if (Creature* temp = me->SummonCreature(NPC_DREADSCALE, ToCSpawnLoc[1].GetPositionX(), ToCSpawnLoc[1].GetPositionY(), ToCSpawnLoc[1].GetPositionZ(), 5, TEMPSUMMON_MANUAL_DESPAWN)) { temp->GetMotionMaster()->MovePoint(0, ToCCommonLoc[8].GetPositionX(), ToCCommonLoc[8].GetPositionY(), ToCCommonLoc[8].GetPositionZ()); @@ -602,24 +611,24 @@ class npc_tirion_toc : public CreatureScript } } m_uiUpdateTimer = 5000; - m_instance->SetData(TYPE_EVENT, 220); + instance->SetData(TYPE_EVENT, 220); break; case 220: - m_instance->SetData(TYPE_EVENT, 230); + instance->SetData(TYPE_EVENT, 230); break; case 300: DoScriptText(SAY_STAGE_0_05, me); m_uiUpdateTimer = 8000; - m_instance->SetData(TYPE_EVENT, 305); + instance->SetData(TYPE_EVENT, 305); break; case 305: m_uiUpdateTimer = 3000; - m_instance->SetData(TYPE_EVENT, 310); + instance->SetData(TYPE_EVENT, 310); break; case 310: - if (m_instance->GetData(TYPE_BEASTS) != DONE) + if (instance->GetData(TYPE_BEASTS) != DONE) { - m_instance->DoUseDoorOrButton(m_instance->GetData64(GO_MAIN_GATE_DOOR)); + instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); if (Creature* temp = me->SummonCreature(NPC_ICEHOWL, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 5, TEMPSUMMON_DEAD_DESPAWN)) { temp->GetMotionMaster()->MovePoint(2, ToCCommonLoc[5].GetPositionX(), ToCCommonLoc[5].GetPositionY(), ToCCommonLoc[5].GetPositionZ()); @@ -629,92 +638,92 @@ class npc_tirion_toc : public CreatureScript } } m_uiUpdateTimer = 5000; - m_instance->SetData(TYPE_EVENT, 315); + instance->SetData(TYPE_EVENT, 315); break; case 315: - m_instance->SetData(TYPE_EVENT, 320); + instance->SetData(TYPE_EVENT, 320); break; case 400: DoScriptText(SAY_STAGE_0_06, me); m_uiUpdateTimer = 5000; - m_instance->SetData(TYPE_EVENT, 0); + instance->SetData(TYPE_EVENT, 0); break; case 666: DoScriptText(SAY_STAGE_0_WIPE, me); m_uiUpdateTimer = 5000; - m_instance->SetData(TYPE_EVENT, 0); + instance->SetData(TYPE_EVENT, 0); break; case 1010: DoScriptText(SAY_STAGE_1_01, me); m_uiUpdateTimer = 7000; - m_instance->DoUseDoorOrButton(m_instance->GetData64(GO_MAIN_GATE_DOOR)); + instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); me->SummonCreature(NPC_FIZZLEBANG, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 2, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME); - m_instance->SetData(TYPE_EVENT, 0); + instance->SetData(TYPE_EVENT, 0); break; case 1180: DoScriptText(SAY_STAGE_1_07, me); m_uiUpdateTimer = 3000; - m_instance->SetData(TYPE_EVENT, 0); + instance->SetData(TYPE_EVENT, 0); break; case 2000: DoScriptText(SAY_STAGE_1_08, me); m_uiUpdateTimer = 18000; - m_instance->SetData(TYPE_EVENT, 2010); + instance->SetData(TYPE_EVENT, 2010); break; case 2030: DoScriptText(SAY_STAGE_1_11, me); m_uiUpdateTimer = 5000; - m_instance->SetData(TYPE_EVENT, 0); + instance->SetData(TYPE_EVENT, 0); break; case 3000: DoScriptText(SAY_STAGE_2_01, me); m_uiUpdateTimer = 12000; - m_instance->SetData(TYPE_EVENT, 3050); + instance->SetData(TYPE_EVENT, 3050); break; case 3001: DoScriptText(SAY_STAGE_2_01, me); m_uiUpdateTimer = 12000; - m_instance->SetData(TYPE_EVENT, 3051); + instance->SetData(TYPE_EVENT, 3051); break; case 3060: DoScriptText(SAY_STAGE_2_03, me); m_uiUpdateTimer = 5000; - m_instance->SetData(TYPE_EVENT, 3070); + instance->SetData(TYPE_EVENT, 3070); break; case 3061: DoScriptText(SAY_STAGE_2_03, me); m_uiUpdateTimer = 5000; - m_instance->SetData(TYPE_EVENT, 3071); + instance->SetData(TYPE_EVENT, 3071); break; //Summoning crusaders case 3091: if (Creature* pChampionController = me->SummonCreature(NPC_CHAMPIONS_CONTROLLER, ToCCommonLoc[1])) pChampionController->AI()->SetData(0, HORDE); m_uiUpdateTimer = 3000; - m_instance->SetData(TYPE_EVENT, 3092); + instance->SetData(TYPE_EVENT, 3092); break; //Summoning crusaders case 3090: if (Creature* pChampionController = me->SummonCreature(NPC_CHAMPIONS_CONTROLLER, ToCCommonLoc[1])) pChampionController->AI()->SetData(0, ALLIANCE); m_uiUpdateTimer = 3000; - m_instance->SetData(TYPE_EVENT, 3092); + instance->SetData(TYPE_EVENT, 3092); break; case 3092: - if (Creature* pChampionController = Unit::GetCreature((*me), m_instance->GetData64(NPC_CHAMPIONS_CONTROLLER))) + if (Creature* pChampionController = Unit::GetCreature((*me), instance->GetData64(NPC_CHAMPIONS_CONTROLLER))) pChampionController->AI()->SetData(1, NOT_STARTED); - m_instance->SetData(TYPE_EVENT, 3095); + instance->SetData(TYPE_EVENT, 3095); break; //Crusaders battle end case 3100: DoScriptText(SAY_STAGE_2_06, me); m_uiUpdateTimer = 5000; - m_instance->SetData(TYPE_EVENT, 0); + instance->SetData(TYPE_EVENT, 0); break; case 4000: DoScriptText(SAY_STAGE_3_01, me); m_uiUpdateTimer = 13000; - m_instance->SetData(TYPE_EVENT, 4010); + instance->SetData(TYPE_EVENT, 4010); break; case 4010: DoScriptText(SAY_STAGE_3_02, me); @@ -733,72 +742,72 @@ class npc_tirion_toc : public CreatureScript temp->SummonCreature(NPC_DARK_ESSENCE, TwinValkyrsLoc[3].GetPositionX(), TwinValkyrsLoc[3].GetPositionY(), TwinValkyrsLoc[3].GetPositionZ()); } m_uiUpdateTimer = 3000; - m_instance->SetData(TYPE_EVENT, 4015); + instance->SetData(TYPE_EVENT, 4015); break; case 4015: - m_instance->DoUseDoorOrButton(m_instance->GetData64(GO_MAIN_GATE_DOOR)); - if (Creature* temp = Unit::GetCreature((*me), m_instance->GetData64(NPC_LIGHTBANE))) + instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); + if (Creature* temp = Unit::GetCreature((*me), instance->GetData64(NPC_LIGHTBANE))) { temp->GetMotionMaster()->MovePoint(1, ToCCommonLoc[8].GetPositionX(), ToCCommonLoc[8].GetPositionY(), ToCCommonLoc[8].GetPositionZ()); temp->SetVisible(true); } - if (Creature* temp = Unit::GetCreature((*me), m_instance->GetData64(NPC_DARKBANE))) + if (Creature* temp = Unit::GetCreature((*me), instance->GetData64(NPC_DARKBANE))) { temp->GetMotionMaster()->MovePoint(1, ToCCommonLoc[9].GetPositionX(), ToCCommonLoc[9].GetPositionY(), ToCCommonLoc[9].GetPositionZ()); temp->SetVisible(true); } m_uiUpdateTimer = 5000; - m_instance->SetData(TYPE_EVENT, 4016); + instance->SetData(TYPE_EVENT, 4016); break; case 4016: - m_instance->SetData(TYPE_EVENT, 4017); + instance->SetData(TYPE_EVENT, 4017); break; case 4040: m_uiUpdateTimer = 60000; - m_instance->SetData(TYPE_EVENT, 5000); + instance->SetData(TYPE_EVENT, 5000); break; case 5000: DoScriptText(SAY_STAGE_4_01, me); m_uiUpdateTimer = 10000; - m_instance->SetData(TYPE_EVENT, 5005); + instance->SetData(TYPE_EVENT, 5005); break; case 5005: m_uiUpdateTimer = 8000; - m_instance->SetData(TYPE_EVENT, 5010); + instance->SetData(TYPE_EVENT, 5010); me->SummonCreature(NPC_LICH_KING_1, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 5); break; case 5020: DoScriptText(SAY_STAGE_4_03, me); m_uiUpdateTimer = 1000; - m_instance->SetData(TYPE_EVENT, 0); + instance->SetData(TYPE_EVENT, 0); break; case 6000: me->NearTeleportTo(AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 4.0f); m_uiUpdateTimer = 20000; - m_instance->SetData(TYPE_EVENT, 6005); + instance->SetData(TYPE_EVENT, 6005); break; case 6005: DoScriptText(SAY_STAGE_4_06, me); m_uiUpdateTimer = 20000; - m_instance->SetData(TYPE_EVENT, 6010); + instance->SetData(TYPE_EVENT, 6010); break; case 6010: if (IsHeroic()) { DoScriptText(SAY_STAGE_4_07, me); m_uiUpdateTimer = 60000; - m_instance->SetData(TYPE_ANUBARAK, SPECIAL); - m_instance->SetData(TYPE_EVENT, 6020); - } else m_instance->SetData(TYPE_EVENT, 6030); + instance->SetData(TYPE_ANUBARAK, SPECIAL); + instance->SetData(TYPE_EVENT, 6020); + } else instance->SetData(TYPE_EVENT, 6030); break; case 6020: me->DespawnOrUnsummon(); m_uiUpdateTimer = 5000; - m_instance->SetData(TYPE_EVENT, 6030); + instance->SetData(TYPE_EVENT, 6030); break; } } else m_uiUpdateTimer -= uiDiff; - m_instance->SetData(TYPE_EVENT_TIMER, m_uiUpdateTimer); + instance->SetData(TYPE_EVENT_TIMER, m_uiUpdateTimer); } }; @@ -818,10 +827,10 @@ class npc_garrosh_toc : public CreatureScript { npc_garrosh_tocAI(Creature* creature) : ScriptedAI(creature) { - m_instance = (InstanceScript*)me->GetInstanceScript(); + instance = me->GetInstanceScript(); } - InstanceScript* m_instance; + InstanceScript* instance; uint32 m_uiUpdateTimer; void Reset() {} @@ -830,53 +839,56 @@ class npc_garrosh_toc : public CreatureScript void UpdateAI(const uint32 uiDiff) { - if (!m_instance) return; - if (m_instance->GetData(TYPE_EVENT_NPC) != NPC_GARROSH) return; + if (!instance) + return; + + if (instance->GetData(TYPE_EVENT_NPC) != NPC_GARROSH) + return; - m_uiUpdateTimer = m_instance->GetData(TYPE_EVENT_TIMER); + m_uiUpdateTimer = instance->GetData(TYPE_EVENT_TIMER); if (m_uiUpdateTimer <= uiDiff) { - switch (m_instance->GetData(TYPE_EVENT)) + switch (instance->GetData(TYPE_EVENT)) { case 130: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK); DoScriptText(SAY_STAGE_0_03h, me); m_uiUpdateTimer = 3000; - m_instance->SetData(TYPE_EVENT, 132); + instance->SetData(TYPE_EVENT, 132); break; case 132: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); m_uiUpdateTimer = 5000; - m_instance->SetData(TYPE_EVENT, 140); + instance->SetData(TYPE_EVENT, 140); break; case 2010: DoScriptText(SAY_STAGE_1_09, me); m_uiUpdateTimer = 9000; - m_instance->SetData(TYPE_EVENT, 2020); + instance->SetData(TYPE_EVENT, 2020); break; case 3050: DoScriptText(SAY_STAGE_2_02h, me); m_uiUpdateTimer = 15000; - m_instance->SetData(TYPE_EVENT, 3060); + instance->SetData(TYPE_EVENT, 3060); break; case 3070: DoScriptText(SAY_STAGE_2_04h, me); m_uiUpdateTimer = 6000; - m_instance->SetData(TYPE_EVENT, 3080); + instance->SetData(TYPE_EVENT, 3080); break; case 3081: DoScriptText(SAY_STAGE_2_05h, me); m_uiUpdateTimer = 3000; - m_instance->SetData(TYPE_EVENT, 3091); + instance->SetData(TYPE_EVENT, 3091); break; case 4030: DoScriptText(SAY_STAGE_3_03h, me); m_uiUpdateTimer = 5000; - m_instance->SetData(TYPE_EVENT, 4040); + instance->SetData(TYPE_EVENT, 4040); break; } } else m_uiUpdateTimer -= uiDiff; - m_instance->SetData(TYPE_EVENT_TIMER, m_uiUpdateTimer); + instance->SetData(TYPE_EVENT_TIMER, m_uiUpdateTimer); } }; @@ -896,10 +908,10 @@ class npc_varian_toc : public CreatureScript { npc_varian_tocAI(Creature* creature) : ScriptedAI(creature) { - m_instance = (InstanceScript*)me->GetInstanceScript(); + instance = me->GetInstanceScript(); } - InstanceScript* m_instance; + InstanceScript* instance; uint32 m_uiUpdateTimer; void Reset() {} @@ -908,53 +920,56 @@ class npc_varian_toc : public CreatureScript void UpdateAI(const uint32 uiDiff) { - if (!m_instance) return; - if (m_instance->GetData(TYPE_EVENT_NPC) != NPC_VARIAN) return; + if (!instance) + return; + + if (instance->GetData(TYPE_EVENT_NPC) != NPC_VARIAN) + return; - m_uiUpdateTimer = m_instance->GetData(TYPE_EVENT_TIMER); + m_uiUpdateTimer = instance->GetData(TYPE_EVENT_TIMER); if (m_uiUpdateTimer <= uiDiff) { - switch (m_instance->GetData(TYPE_EVENT)) + switch (instance->GetData(TYPE_EVENT)) { case 120: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK); DoScriptText(SAY_STAGE_0_03a, me); m_uiUpdateTimer = 2000; - m_instance->SetData(TYPE_EVENT, 122); + instance->SetData(TYPE_EVENT, 122); break; case 122: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); m_uiUpdateTimer = 3000; - m_instance->SetData(TYPE_EVENT, 130); + instance->SetData(TYPE_EVENT, 130); break; case 2020: DoScriptText(SAY_STAGE_1_10, me); m_uiUpdateTimer = 5000; - m_instance->SetData(TYPE_EVENT, 2030); + instance->SetData(TYPE_EVENT, 2030); break; case 3051: DoScriptText(SAY_STAGE_2_02a, me); m_uiUpdateTimer = 10000; - m_instance->SetData(TYPE_EVENT, 3061); + instance->SetData(TYPE_EVENT, 3061); break; case 3071: DoScriptText(SAY_STAGE_2_04a, me); m_uiUpdateTimer = 5000; - m_instance->SetData(TYPE_EVENT, 3081); + instance->SetData(TYPE_EVENT, 3081); break; case 3080: DoScriptText(SAY_STAGE_2_05a, me); m_uiUpdateTimer = 3000; - m_instance->SetData(TYPE_EVENT, 3090); + instance->SetData(TYPE_EVENT, 3090); break; case 4020: DoScriptText(SAY_STAGE_3_03a, me); m_uiUpdateTimer = 5000; - m_instance->SetData(TYPE_EVENT, 4040); + instance->SetData(TYPE_EVENT, 4040); break; } } else m_uiUpdateTimer -= uiDiff; - m_instance->SetData(TYPE_EVENT_TIMER, m_uiUpdateTimer); + instance->SetData(TYPE_EVENT_TIMER, m_uiUpdateTimer); } }; diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp index e96ef4ff366..95acc79231d 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp @@ -161,7 +161,7 @@ class boss_dred : public CreatureScript return 0; } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { if (instance) instance->SetData(DATA_DRED_EVENT, DONE); @@ -211,7 +211,7 @@ class npc_drakkari_gutripper : public CreatureScript DoMeleeAttackIfReady(); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { if (Creature* Dred = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DRED))) Dred->AI()->DoAction(ACTION_RAPTOR_KILLED); @@ -261,7 +261,7 @@ class npc_drakkari_scytheclaw : public CreatureScript DoMeleeAttackIfReady(); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { if (Creature* Dred = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DRED))) Dred->AI()->DoAction(ACTION_RAPTOR_KILLED); diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp index 5418cf8c4d0..9ff8ee9c9ed 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp @@ -72,9 +72,9 @@ public: struct boss_novosAI : public Scripted_NoMovementAI { - boss_novosAI(Creature* c) : Scripted_NoMovementAI(c), lSummons(me) + boss_novosAI(Creature* creature) : Scripted_NoMovementAI(creature), lSummons(me) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 uiTimer; @@ -260,9 +260,9 @@ public: struct mob_crystal_handlerAI : public ScriptedAI { - mob_crystal_handlerAI(Creature* c) : ScriptedAI(c) + mob_crystal_handlerAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 uiFlashOfDarknessTimer; @@ -317,9 +317,9 @@ public: struct mob_novos_minionAI : public ScriptedAI { - mob_novos_minionAI(Creature* c) : ScriptedAI(c) + mob_novos_minionAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp index 97f2ee4e9a1..b1d588a0d0d 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp @@ -71,9 +71,9 @@ public: struct boss_tharon_jaAI : public ScriptedAI { - boss_tharon_jaAI(Creature* c) : ScriptedAI(c) + boss_tharon_jaAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 uiPhaseTimer; diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp index 9fc964000e3..26e4e9db99e 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp @@ -61,9 +61,9 @@ public: struct boss_trollgoreAI : public ScriptedAI { - boss_trollgoreAI(Creature* c) : ScriptedAI(c), lSummons(me) + boss_trollgoreAI(Creature* creature) : ScriptedAI(creature), lSummons(me) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 uiConsumeTimer; diff --git a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp index 8e5e7c3e185..aff3f1b8e36 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp @@ -83,7 +83,8 @@ public: bool IsEncounterInProgress() const { for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; + if (m_auiEncounter[i] == IN_PROGRESS) + return true; return false; } diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp index c8f18dba1d0..1469e26fd20 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp @@ -18,53 +18,6 @@ #include "ScriptPCH.h" #include "forge_of_souls.h" -enum Spells -{ - //Spiteful Apparition - SPELL_SPITE = 68895, - H_SPELL_SPITE = 70212, - - //Spectral Warden - SPELL_VEIL_OF_SHADOWS = 69633, - SPELL_WAIL_OF_SOULS = 69148, - H_SPELL_WAIL_OF_SOULS = 70210, - - //Soulguard Watchman - SPELL_SHROUD_OF_RUNES = 69056, - SPELL_UNHOLY_RAGE = 69053, - - //Soulguard Reaper - SPELL_FROST_NOVA = 69060, - H_SPELL_FROST_NOVA = 70209, - SPELL_SHADOW_LANCE = 69058, - - //Soulguard Bonecaster - SPELL_BONE_VOLLEY = 69080, - H_SPELL_BONE_VOLLEY = 70206, - SPELL_RAISE_DEAD = 69562, - SPELL_SHIELD_OF_BONES = 69069, - H_SPELL_SHIELD_OF_BONES = 70207, - - //Soulguard Animator - // Raise dead 69562 - SPELL_SHADOW_BOLT = 69068, - H_SPELL_SHADOW_BOLT = 70208, - SPELL_SOUL_SICKNESS = 69131, - SPELL_SOUL_SIPHON = 69128, - - //Soulguard Adept - //Raise dead 69562 - //Shadow Bolt 69068/70208 - SPELL_DRAIN_LIFE = 69066, - H_SPELL_DRAIN_LIFE = 70213, - SPELL_SHADOW_MEND = 69564, - H_SPELL_SHADOW_MEND = 70205, - - //Soul Horror - SPELL_SOUL_STRIKE = 69088, - H_SPELL_SOUL_STRIKE = 70211, -}; - enum Events { EVENT_NONE, @@ -78,38 +31,6 @@ enum Events EVENT_INTRO_6, EVENT_INTRO_7, EVENT_INTRO_8, - - //Spiteful Apparition - EVENT_SPITE, - - //Spectral Warden - EVENT_VEIL_OF_SHADOWS, - EVENT_WAIL_OF_SOULS, - - //Soulguard Watchman - EVENT_SHROUD_OF_RUNES, - EVENT_UNHOLY_RAGE, - - //Soulguard Reaper - EVENT_FROST_NOVA, - EVENT_SHADOW_LANCE, - - //Soulguard Bonecaster - EVENT_BONE_VOLLEY, - EVENT_RAISE_DEAD, - EVENT_SHIELD_OF_BONES, - - //Soulguard Animator - EVENT_SHADOW_BOLT, - EVENT_SOUL_SICKNESS, - EVENT_SOUL_SIPHON, - - //Soulguard Adept - EVENT_DRAIN_LIFE, - EVENT_SHADOW_MEND, - - //Soul Horror - EVENT_SOUL_STRIKE, }; /****************************************SYLVANAS************************************/ @@ -251,10 +172,10 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: player->CLOSE_GOSSIP_MENU(); @@ -388,10 +309,10 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: player->CLOSE_GOSSIP_MENU(); @@ -410,508 +331,8 @@ public: } }; -class mob_spiteful_apparition : public CreatureScript -{ -public: - mob_spiteful_apparition() : CreatureScript("mob_spiteful_apparition") { } - - struct mob_spiteful_apparitionAI: public ScriptedAI - { - mob_spiteful_apparitionAI(Creature* creature) : ScriptedAI(creature) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_SPITE, 8000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_SPITE: - DoCastVictim(SPELL_SPITE); - events.RescheduleEvent(EVENT_SPITE, 8000); - return; - } - } - - DoMeleeAttackIfReady(); - } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_spiteful_apparitionAI(creature); - } -}; - -class mob_spectral_warden : public CreatureScript -{ -public: - mob_spectral_warden() : CreatureScript("mob_spectral_warden") { } - - struct mob_spectral_wardenAI: public ScriptedAI - { - mob_spectral_wardenAI(Creature* creature) : ScriptedAI(creature) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_VEIL_OF_SHADOWS, 5000); - events.ScheduleEvent(EVENT_WAIL_OF_SOULS, 10000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_VEIL_OF_SHADOWS: - DoCastVictim(SPELL_VEIL_OF_SHADOWS); - events.RescheduleEvent(EVENT_VEIL_OF_SHADOWS, 10000); - return; - case EVENT_WAIL_OF_SOULS: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_WAIL_OF_SOULS); - events.RescheduleEvent(EVENT_WAIL_OF_SOULS, 5000); - return; - } - } - DoMeleeAttackIfReady(); - } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_spectral_wardenAI(creature); - } -}; - -class mob_soulguard_watchman : public CreatureScript -{ -public: - mob_soulguard_watchman() : CreatureScript("mob_soulguard_watchman") { } - - struct mob_soulguard_watchmanAI: public ScriptedAI - { - mob_soulguard_watchmanAI(Creature* creature) : ScriptedAI(creature) { } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_SHROUD_OF_RUNES, 1000); - events.ScheduleEvent(EVENT_UNHOLY_RAGE, 1000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_SHROUD_OF_RUNES: - DoCast(me, SPELL_SHROUD_OF_RUNES); - events.RescheduleEvent(EVENT_SHROUD_OF_RUNES, 5000); - return; - case EVENT_UNHOLY_RAGE: - DoCast(me, SPELL_UNHOLY_RAGE); - events.RescheduleEvent(EVENT_UNHOLY_RAGE, 99999); - return; - } - } - DoMeleeAttackIfReady(); - } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_soulguard_watchmanAI(creature); - } -}; - -class mob_soulguard_reaper : public CreatureScript -{ -public: - mob_soulguard_reaper() : CreatureScript("mob_soulguard_reaper") { } - - struct mob_soulguard_reaperAI: public ScriptedAI - { - mob_soulguard_reaperAI(Creature* creature) : ScriptedAI(creature) { } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_FROST_NOVA, 8000); - events.ScheduleEvent(EVENT_SHADOW_LANCE, 5000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_FROST_NOVA: - DoCast(me, SPELL_FROST_NOVA); - events.RescheduleEvent(EVENT_FROST_NOVA, 9600); - return; - case EVENT_SHADOW_LANCE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_SHADOW_LANCE); - events.RescheduleEvent(EVENT_SHADOW_LANCE, 8000); - return; - } - } - - DoMeleeAttackIfReady(); - } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_soulguard_reaperAI(creature); - } -}; - -class mob_soulguard_bonecaster : public CreatureScript -{ -public: - mob_soulguard_bonecaster() : CreatureScript("mob_soulguard_bonecaster") { } - - struct mob_soulguard_bonecasterAI: public ScriptedAI - { - mob_soulguard_bonecasterAI(Creature* creature) : ScriptedAI(creature) { } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_BONE_VOLLEY, 6000); - events.ScheduleEvent(EVENT_RAISE_DEAD, 25000); - events.ScheduleEvent(EVENT_SHIELD_OF_BONES, 6000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_BONE_VOLLEY: - DoCastAOE(SPELL_BONE_VOLLEY); - events.RescheduleEvent(EVENT_BONE_VOLLEY, 7000); - return; - case EVENT_RAISE_DEAD: - DoCast(me, SPELL_RAISE_DEAD); - events.RescheduleEvent(EVENT_RAISE_DEAD, 25000); - return; - case EVENT_SHIELD_OF_BONES: - DoCast(me, SPELL_SHIELD_OF_BONES); - events.RescheduleEvent(EVENT_SHIELD_OF_BONES, 8000); - return; - } - } - - DoMeleeAttackIfReady(); - } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_soulguard_bonecasterAI(creature); - } -}; - -class mob_soulguard_animator : public CreatureScript -{ -public: - mob_soulguard_animator() : CreatureScript("mob_soulguard_animator") { } - - struct mob_soulguard_animatorAI : public ScriptedAI - { - mob_soulguard_animatorAI(Creature* creature) : ScriptedAI(creature) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_RAISE_DEAD, 25000); - events.ScheduleEvent(EVENT_SHADOW_BOLT, 5000); - events.ScheduleEvent(EVENT_SOUL_SICKNESS, 8000); - events.ScheduleEvent(EVENT_SOUL_SIPHON, 10000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_RAISE_DEAD: - DoCast(me, SPELL_RAISE_DEAD); - events.RescheduleEvent(EVENT_RAISE_DEAD, 25000); - return; - case EVENT_SHADOW_BOLT: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_SHADOW_BOLT); - events.RescheduleEvent(EVENT_SHADOW_BOLT, 5000); - return; - case EVENT_SOUL_SICKNESS: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_SOUL_SICKNESS); - events.RescheduleEvent(EVENT_SOUL_SICKNESS, 10000); - return; - case EVENT_SOUL_SIPHON: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_SOUL_SIPHON); - events.RescheduleEvent(EVENT_SOUL_SIPHON, 8000); - return; - } - } - - DoMeleeAttackIfReady(); - } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_soulguard_animatorAI(creature); - } -}; - -class mob_soulguard_adept : public CreatureScript -{ -public: - mob_soulguard_adept() : CreatureScript("mob_soulguard_adept") { } - - struct mob_soulguard_adeptAI: public ScriptedAI - { - mob_soulguard_adeptAI(Creature* creature) : ScriptedAI(creature) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_RAISE_DEAD, 25000); - events.ScheduleEvent(EVENT_SHADOW_BOLT, 8000); - events.ScheduleEvent(EVENT_DRAIN_LIFE, 7000); - events.ScheduleEvent(EVENT_SHADOW_MEND, 35000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_RAISE_DEAD: - DoCast(me, SPELL_RAISE_DEAD); - events.RescheduleEvent(EVENT_RAISE_DEAD, 25000); - return; - case EVENT_SHADOW_BOLT: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_SHADOW_BOLT); - events.RescheduleEvent(EVENT_SHADOW_BOLT, 4000); - return; - case EVENT_DRAIN_LIFE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_DRAIN_LIFE); - events.RescheduleEvent(EVENT_DRAIN_LIFE, 9000); - return; - case EVENT_SHADOW_MEND: - DoCast(me, SPELL_SHADOW_MEND); - events.RescheduleEvent(EVENT_SHADOW_MEND, 20000); - return; - } - } - - DoMeleeAttackIfReady(); - } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_soulguard_adeptAI(creature); - } -}; - -class mob_soul_horror : public CreatureScript -{ -public: - mob_soul_horror() : CreatureScript("mob_soul_horror") { } - - struct mob_soul_horrorAI : public ScriptedAI - { - mob_soul_horrorAI(Creature* creature) : ScriptedAI(creature) { } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_SOUL_STRIKE, 6000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_SOUL_STRIKE: - DoCast(me->getVictim(), SPELL_SOUL_STRIKE); - events.RescheduleEvent(EVENT_SOUL_STRIKE, 8000); - return; - } - } - - DoMeleeAttackIfReady(); - } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_soul_horrorAI(creature); - } -}; - void AddSC_forge_of_souls() { new npc_sylvanas_fos(); new npc_jaina_fos(); - new mob_spiteful_apparition(); - new mob_spectral_warden(); - new mob_soulguard_watchman(); - new mob_soulguard_reaper(); - new mob_soulguard_bonecaster(); - new mob_soulguard_animator(); - new mob_soulguard_adept(); - new mob_soul_horror(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp index 1583bdbdcd4..2abb60d5de2 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp @@ -157,10 +157,10 @@ private: public: npc_jaina_or_sylvanas_hor(bool isSylvana, const char* name) : CreatureScript(name), m_isSylvana(isSylvana) { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: player->CLOSE_GOSSIP_MENU(); @@ -248,7 +248,7 @@ public: { case EVENT_START_INTRO: me->GetMotionMaster()->MovePoint(0, MoveThronePos); - // Begining of intro is differents between factions as the speech sequence and timers are differents. + // Begining of intro is differents between fActions as the speech sequence and timers are differents. if (instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) events.ScheduleEvent(EVENT_INTRO_A2_1, 0); else @@ -633,7 +633,7 @@ public: struct npc_ghostly_priestAI: public ScriptedAI { - npc_ghostly_priestAI(Creature* c) : ScriptedAI(c) + npc_ghostly_priestAI(Creature* creature) : ScriptedAI(creature) { } @@ -715,7 +715,7 @@ public: struct npc_phantom_mageAI: public ScriptedAI { - npc_phantom_mageAI(Creature* c) : ScriptedAI(c) + npc_phantom_mageAI(Creature* creature) : ScriptedAI(creature) { } @@ -792,11 +792,11 @@ public: struct npc_phantom_hallucinationAI : public npc_phantom_mage::npc_phantom_mageAI { - npc_phantom_hallucinationAI(Creature* c) : npc_phantom_mage::npc_phantom_mageAI(c) + npc_phantom_hallucinationAI(Creature* creature) : npc_phantom_mage::npc_phantom_mageAI(creature) { } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { DoCast(SPELL_HALLUCINATION_2); } @@ -816,7 +816,7 @@ public: struct npc_shadowy_mercenaryAI: public ScriptedAI { - npc_shadowy_mercenaryAI(Creature* c) : ScriptedAI(c) + npc_shadowy_mercenaryAI(Creature* creature) : ScriptedAI(creature) { } @@ -887,7 +887,7 @@ public: struct npc_spectral_footmanAI: public ScriptedAI { - npc_spectral_footmanAI(Creature* c) : ScriptedAI(c) + npc_spectral_footmanAI(Creature* creature) : ScriptedAI(creature) { } @@ -952,7 +952,7 @@ public: struct npc_tortured_riflemanAI : public ScriptedAI { - npc_tortured_riflemanAI(Creature* c) : ScriptedAI(c) + npc_tortured_riflemanAI(Creature* creature) : ScriptedAI(creature) { } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp index 64609efd7ff..a3b8c5df4e7 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp @@ -20,14 +20,15 @@ enum Yells { - SAY_AGGRO = -1658001, - SAY_SLAY_1 = -1658002, - SAY_SLAY_2 = -1658003, - SAY_DEATH = -1658004, - SAY_PHASE2 = -1658005, - SAY_PHASE3 = -1658006, - - SAY_TYRANNUS_DEATH = -1658007, + SAY_AGGRO = 0, + SAY_PHASE2 = 1, + SAY_PHASE3 = 2, + SAY_DEATH = 3, + SAY_SLAY = 4, + SAY_THROW_SARONITE = 5, + SAY_CAST_DEEP_FREEZE = 6, + + SAY_TYRANNUS_DEATH = -1658007, // todo }; enum Spells @@ -107,8 +108,9 @@ class boss_garfrost : public CreatureScript void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); DoCast(me, SPELL_PERMAFROST); + me->CallForHelp(70.0f); events.ScheduleEvent(EVENT_THROW_SARONITE, 7000); instance->SetBossState(DATA_GARFROST, IN_PROGRESS); @@ -117,12 +119,13 @@ class boss_garfrost : public CreatureScript void KilledUnit(Unit* victim) { if (victim->GetTypeId() == TYPEID_PLAYER) - DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me); + Talk(SAY_SLAY); } void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_DEATH, me); + Talk(SAY_DEATH); + if (Creature* tyrannus = me->GetCreature(*me, instance->GetData64(DATA_TYRANNUS))) DoScriptText(SAY_TYRANNUS_DEATH, tyrannus); @@ -134,6 +137,7 @@ class boss_garfrost : public CreatureScript if (events.GetPhaseMask() & PHASE_ONE_MASK && !HealthAbovePct(66)) { events.SetPhase(PHASE_TWO); + Talk(SAY_PHASE2); events.DelayEvents(8000); DoCast(me, SPELL_THUNDERING_STOMP); events.ScheduleEvent(EVENT_JUMP, 1500); @@ -143,6 +147,7 @@ class boss_garfrost : public CreatureScript if (events.GetPhaseMask() & PHASE_TWO_MASK && !HealthAbovePct(33)) { events.SetPhase(PHASE_THREE); + Talk(SAY_PHASE3); events.DelayEvents(8000); DoCast(me, SPELL_THUNDERING_STOMP); events.ScheduleEvent(EVENT_JUMP, 1500); @@ -199,7 +204,10 @@ class boss_garfrost : public CreatureScript { case EVENT_THROW_SARONITE: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + { + Talk(SAY_THROW_SARONITE); DoCast(target, SPELL_THROW_SARONITE); + } events.ScheduleEvent(EVENT_THROW_SARONITE, urand(12500, 20000)); break; case EVENT_CHILLING_WAVE: @@ -208,7 +216,10 @@ class boss_garfrost : public CreatureScript break; case EVENT_DEEP_FREEZE: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + { + Talk(SAY_CAST_DEEP_FREEZE); DoCast(target, SPELL_DEEP_FREEZE); + } events.ScheduleEvent(EVENT_DEEP_FREEZE, 35000, 0, PHASE_THREE); break; case EVENT_JUMP: diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp index 8e211cbd2cb..fa260cb298d 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp @@ -347,7 +347,7 @@ class boss_krick : public CreatureScript else tyrannusPtr = me->SummonCreature(NPC_TYRANNUS_EVENTS, outroPos[1], TEMPSUMMON_MANUAL_DESPAWN); - tyrannusPtr->SetFlying(true); + tyrannusPtr->SetCanFly(true); me->GetMotionMaster()->MovePoint(POINT_KRICK_INTRO, outroPos[0].GetPositionX(), outroPos[0].GetPositionY(), outroPos[0].GetPositionZ()); tyrannusPtr->SetFacingToObject(me); } @@ -439,6 +439,7 @@ class boss_krick : public CreatureScript _events.ScheduleEvent(EVENT_OUTRO_8, 5000); break; case EVENT_OUTRO_8: + //! HACK: Creature's can't have MOVEMENTFLAG_FLYING me->AddUnitMovementFlag(MOVEMENTFLAG_FLYING); me->GetMotionMaster()->MovePoint(0, outroPos[5]); DoCast(me, SPELL_STRANGULATING); @@ -453,8 +454,9 @@ class boss_krick : public CreatureScript _events.ScheduleEvent(EVENT_OUTRO_10, 1000); break; case EVENT_OUTRO_10: + //! HACK: Creature's can't have MOVEMENTFLAG_FLYING me->RemoveUnitMovementFlag(MOVEMENTFLAG_FLYING); - me->AddUnitMovementFlag(MOVEMENTFLAG_FALLING); + me->AddUnitMovementFlag(MOVEMENTFLAG_FALLING_FAR); me->GetMotionMaster()->MovePoint(0, outroPos[6]); _events.ScheduleEvent(EVENT_OUTRO_11, 2000); break; diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp index d6b2c2e3a97..8d015adf4a4 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp @@ -295,7 +295,7 @@ class boss_rimefang : public CreatureScript _events.SetPhase(PHASE_NONE); _currentWaypoint = 0; _hoarfrostTargetGUID = 0; - me->SetFlying(true); + me->SetCanFly(true); me->SetReactState(REACT_PASSIVE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } @@ -387,8 +387,7 @@ class player_overlord_brandAI : public PlayerAI void SetGUID(uint64 guid, int32 /*type*/) { tyrannus = ObjectAccessor::GetCreature(*me, guid); - if (!tyrannus) - me->IsAIEnabled = false; + me->IsAIEnabled = tyrannus != NULL; } void DamageDealt(Unit* /*victim*/, uint32& damage, DamageEffectType /*damageType*/) @@ -423,10 +422,9 @@ class spell_tyrannus_overlord_brand : public SpellScriptLoader return; oldAI = GetTarget()->GetAI(); + oldAIState = GetTarget()->IsAIEnabled; GetTarget()->SetAI(new player_overlord_brandAI(GetTarget()->ToPlayer())); GetTarget()->GetAI()->SetGUID(GetCasterGUID()); - oldAIState = GetTarget()->IsAIEnabled; - GetTarget()->IsAIEnabled = true; } void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp index 24529801564..1301acf4c99 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp @@ -23,6 +23,13 @@ Position const SlaveLeaderPos = {689.7158f, -104.8736f, 513.7360f, 0.0f}; // position for Jaina and Sylvanas Position const EventLeaderPos2 = {1054.368f, 107.14620f, 628.4467f, 0.0f}; +DoorData const Doors[] = +{ + {GO_ICE_WALL, DATA_GARFROST, DOOR_TYPE_PASSAGE, BOUNDARY_NONE}, + {GO_ICE_WALL, DATA_ICK, DOOR_TYPE_PASSAGE, BOUNDARY_NONE}, + {GO_HALLS_OF_REFLECTION_PORTCULLIS, DATA_TYRANNUS, DOOR_TYPE_PASSAGE, BOUNDARY_NONE}, +}; + class instance_pit_of_saron : public InstanceMapScript { public: @@ -33,6 +40,7 @@ class instance_pit_of_saron : public InstanceMapScript instance_pit_of_saron_InstanceScript(Map* map) : InstanceScript(map) { SetBossNumber(MAX_ENCOUNTER); + LoadDoorData(Doors); _garfrostGUID = 0; _krickGUID = 0; _ickGUID = 0; @@ -154,6 +162,28 @@ class instance_pit_of_saron : public InstanceMapScript } } + void OnGameObjectCreate(GameObject* go) + { + switch (go->GetEntry()) + { + case GO_ICE_WALL: + case GO_HALLS_OF_REFLECTION_PORTCULLIS: + AddDoor(go, true); + break; + } + } + + void OnGameObjectRemove(GameObject* go) + { + switch (go->GetEntry()) + { + case GO_ICE_WALL: + case GO_HALLS_OF_REFLECTION_PORTCULLIS: + AddDoor(go, false); + break; + } + } + bool SetBossState(uint32 type, EncounterState state) { if (!InstanceScript::SetBossState(type, state)) diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp index a91951ca25e..b6c821ef66a 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp @@ -25,9 +25,6 @@ enum eSpells SPELL_HELLFIRE = 69586, SPELL_TACTICAL_BLINK = 69584, SPELL_FROST_BREATH = 69527, //Iceborn Proto-Drake - SPELL_BLINDING_DIRT = 70302, //Wrathbone Laborer - SPELL_PUNCTURE_WOUND = 70278, - SPELL_SHOVELLED = 69572, SPELL_LEAPING_FACE_MAUL = 69504, // Geist Ambusher }; @@ -36,11 +33,6 @@ enum eEvents // Ymirjar Flamebearer EVENT_FIREBALL = 1, EVENT_TACTICAL_BLINK = 2, - - //Wrathbone Laborer - EVENT_BLINDING_DIRT = 3, - EVENT_PUNCTURE_WOUND = 4, - EVENT_SHOVELLED = 5, }; class mob_ymirjar_flamebearer : public CreatureScript @@ -157,73 +149,6 @@ class mob_iceborn_protodrake : public CreatureScript } }; -class mob_wrathbone_laborer : public CreatureScript -{ - public: - mob_wrathbone_laborer() : CreatureScript("mob_wrathbone_laborer") { } - - struct mob_wrathbone_laborerAI: public ScriptedAI - { - mob_wrathbone_laborerAI(Creature* creature) : ScriptedAI(creature) - { - } - - void Reset() - { - _events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - _events.ScheduleEvent(EVENT_BLINDING_DIRT, 8000); - _events.ScheduleEvent(EVENT_PUNCTURE_WOUND, 9000); - _events.ScheduleEvent(EVENT_SHOVELLED, 5000); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - _events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = _events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_BLINDING_DIRT: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 10.0f, true)) - DoCast(target, SPELL_BLINDING_DIRT); - _events.RescheduleEvent(EVENT_BLINDING_DIRT, 10000); - return; - case EVENT_PUNCTURE_WOUND: - DoCastVictim(SPELL_PUNCTURE_WOUND); - _events.RescheduleEvent(EVENT_PUNCTURE_WOUND, 9000); - return; - case EVENT_SHOVELLED: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, -5.0f)) - DoCast(target, SPELL_SHOVELLED); - _events.RescheduleEvent(EVENT_SHOVELLED, 7000); - return; - } - } - - DoMeleeAttackIfReady(); - } - - private: - EventMap _events; - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_wrathbone_laborerAI(creature); - } -}; - class mob_geist_ambusher : public CreatureScript { public: @@ -240,12 +165,13 @@ class mob_geist_ambusher : public CreatureScript _leapingFaceMaulCooldown = 9000; } - void MoveInLineOfSight(Unit* who) + void EnterCombat(Unit* who) { if (who->GetTypeId() != TYPEID_PLAYER) return; - if (me->IsWithinDistInMap(who, 30.0f)) + // the max range is determined by aggro range + if (me->GetDistance(who) > 5.0f) DoCast(who, SPELL_LEAPING_FACE_MAUL); } @@ -309,7 +235,6 @@ class spell_trash_mob_glacial_strike : public SpellScriptLoader void AddSC_pit_of_saron() { new mob_ymirjar_flamebearer(); - new mob_wrathbone_laborer(); new mob_iceborn_protodrake(); new mob_geist_ambusher(); new spell_trash_mob_glacial_strike(); diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h index 728e0ccd955..768c3ba40ec 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h @@ -90,6 +90,8 @@ enum CreatureIds enum GameObjectIds { GO_SARONITE_ROCK = 196485, + GO_ICE_WALL = 201885, + GO_HALLS_OF_REFLECTION_PORTCULLIS = 201848, }; #endif diff --git a/src/server/scripts/Northrend/Gundrak/boss_eck.cpp b/src/server/scripts/Northrend/Gundrak/boss_eck.cpp index c665d3cdf5a..3e803c24d61 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_eck.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_eck.cpp @@ -41,9 +41,9 @@ public: struct boss_eckAI : public ScriptedAI { - boss_eckAI(Creature* c) : ScriptedAI(c) + boss_eckAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 uiBerserkTimer; @@ -145,14 +145,14 @@ public: struct npc_ruins_dwellerAI : public ScriptedAI { - npc_ruins_dwellerAI(Creature* c) : ScriptedAI(c) + npc_ruins_dwellerAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { if (instance) { diff --git a/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp b/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp index daa5ee86483..be9b09a1263 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp @@ -75,9 +75,9 @@ public: struct boss_gal_darahAI : public ScriptedAI { - boss_gal_darahAI(Creature* c) : ScriptedAI(c) + boss_gal_darahAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 uiStampedeTimer; diff --git a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp index 5071802f897..b827f43dc99 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp @@ -80,9 +80,9 @@ public: struct boss_slad_ranAI : public ScriptedAI { - boss_slad_ranAI(Creature* c) : ScriptedAI(c), lSummons(me) + boss_slad_ranAI(Creature* creature) : ScriptedAI(creature), lSummons(me) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 uiPoisonNovaTimer; @@ -219,7 +219,7 @@ public: struct mob_slad_ran_constrictorAI : public ScriptedAI { - mob_slad_ran_constrictorAI(Creature* c) : ScriptedAI(c) {} + mob_slad_ran_constrictorAI(Creature* creature) : ScriptedAI(creature) {} uint32 uiGripOfSladRanTimer; @@ -272,7 +272,7 @@ public: struct mob_slad_ran_viperAI : public ScriptedAI { - mob_slad_ran_viperAI(Creature* c) : ScriptedAI(c) {} + mob_slad_ran_viperAI(Creature* creature) : ScriptedAI(creature) {} uint32 uiVenomousBiteTimer; diff --git a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp index c0fc722385b..c22a0e17cd5 100644 --- a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp +++ b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp @@ -131,7 +131,8 @@ public: bool IsEncounterInProgress() const { for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; + if (m_auiEncounter[i] == IN_PROGRESS) + return true; return false; } @@ -519,17 +520,17 @@ class go_gundrak_altar : public GameObjectScript public: go_gundrak_altar() : GameObjectScript("go_gundrak_altar") { } - bool OnGossipHello(Player* /*player*/, GameObject* pGO) + bool OnGossipHello(Player* /*player*/, GameObject* go) { - InstanceScript* instance = pGO->GetInstanceScript(); + InstanceScript* instance = go->GetInstanceScript(); uint64 uiStatue = 0; - pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - pGO->SetGoState(GO_STATE_ACTIVE); + go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + go->SetGoState(GO_STATE_ACTIVE); if (instance) { - switch (pGO->GetEntry()) + switch (go->GetEntry()) { case 192518: uiStatue = instance->GetData64(DATA_SLAD_RAN_STATUE); @@ -545,8 +546,8 @@ public: if (!instance->GetData64(DATA_STATUE_ACTIVATE)) { instance->SetData64(DATA_STATUE_ACTIVATE, uiStatue); - pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - pGO->SetGoState(GO_STATE_ACTIVE); + go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + go->SetGoState(GO_STATE_ACTIVE); } return true; } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp index 70b07c61e79..d091a87dbfe 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp @@ -103,6 +103,7 @@ enum Spells SPELL_UNSTABLE = 72059, SPELL_KINETIC_BOMB_VISUAL = 72054, SPELL_KINETIC_BOMB_EXPLOSION = 72052, + SPELL_KINETIC_BOMB_KNOCKBACK = 72087, // Shock Vortex SPELL_SHOCK_VORTEX_PERIODIC = 71945, @@ -210,19 +211,19 @@ class boss_blood_council_controller : public CreatureScript if (Creature* keleseth = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_KELESETH_GUID))) { - instance->SendEncounterUnit(ENCOUNTER_FRAME_ADD, keleseth); + instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, keleseth); DoZoneInCombat(keleseth); } if (Creature* taldaram = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_TALDARAM_GUID))) { - instance->SendEncounterUnit(ENCOUNTER_FRAME_ADD, taldaram); + instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, taldaram); DoZoneInCombat(taldaram); } if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_VALANAR_GUID))) { - instance->SendEncounterUnit(ENCOUNTER_FRAME_ADD, valanar); + instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, valanar); DoZoneInCombat(valanar); } @@ -412,12 +413,12 @@ class boss_prince_keleseth_icc : public CreatureScript summons.DespawnAll(); Talk(SAY_KELESETH_DEATH); - instance->SendEncounterUnit(ENCOUNTER_FRAME_REMOVE, me); + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); } void JustReachedHome() { - instance->SendEncounterUnit(ENCOUNTER_FRAME_REMOVE, me); + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); me->SetHealth(_spawnHealth); _isEmpowered = false; if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BLOOD_PRINCES_CONTROL))) @@ -443,20 +444,12 @@ class boss_prince_keleseth_icc : public CreatureScript { summons.Summon(summon); Position pos; - pos.Relocate(summon); + me->GetPosition(&pos); float maxRange = me->GetDistance2d(summon); float angle = me->GetAngle(summon); - // prevent spawning outside of room - while (!me->IsWithinLOS(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ())) - { - maxRange -= 5.0f; - if (maxRange < 5.0f) - break; - - summon->MovePosition(pos, float(rand_norm() * maxRange), angle); - } - + me->MovePositionToFirstCollision(pos, maxRange, angle); summon->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); + summon->ToTempSummon()->SetTempSummonType(TEMPSUMMON_CORPSE_DESPAWN); } void DamageDealt(Unit* /*target*/, uint32& damage, DamageEffectType damageType) @@ -636,12 +629,12 @@ class boss_prince_taldaram_icc : public CreatureScript summons.DespawnAll(); Talk(EMOTE_TALDARAM_DEATH); - instance->SendEncounterUnit(ENCOUNTER_FRAME_REMOVE, me); + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); } void JustReachedHome() { - instance->SendEncounterUnit(ENCOUNTER_FRAME_REMOVE, me); + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); me->SetHealth(_spawnHealth); _isEmpowered = false; if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BLOOD_PRINCES_CONTROL))) @@ -859,12 +852,12 @@ class boss_prince_valanar_icc : public CreatureScript summons.DespawnAll(); Talk(SAY_VALANAR_DEATH); - instance->SendEncounterUnit(ENCOUNTER_FRAME_REMOVE, me); + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); } void JustReachedHome() { - instance->SendEncounterUnit(ENCOUNTER_FRAME_REMOVE, me); + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); me->SetHealth(me->GetMaxHealth()); _isEmpowered = false; if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BLOOD_PRINCES_CONTROL))) @@ -894,6 +887,7 @@ class boss_prince_valanar_icc : public CreatureScript summon->GetPosition(x, y, z); float ground_Z = summon->GetMap()->GetHeight(summon->GetPhaseMask(), x, y, z, true, 500.0f); summon->GetMotionMaster()->MovePoint(POINT_KINETIC_BOMB_IMPACT, x, y, ground_Z); + summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); break; } case NPC_SHOCK_VORTEX: @@ -1058,7 +1052,7 @@ class npc_blood_queen_lana_thel : public CreatureScript void Reset() { _events.Reset(); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetDisableGravity(true); if (_instance->GetBossState(DATA_BLOOD_PRINCE_COUNCIL) == DONE) { me->SetVisible(false); @@ -1073,7 +1067,7 @@ class npc_blood_queen_lana_thel : public CreatureScript if (_introDone) return; - if (!me->IsWithinDistInMap(who, 35.0f)) + if (!me->IsWithinDistInMap(who, 35.0f, false)) return; _introDone = true; @@ -1232,12 +1226,12 @@ class npc_kinetic_bomb : public CreatureScript void Reset() { _events.Reset(); - me->SetDisplayId(DISPLAY_KINETIC_BOMB); + me->SetWalk(true); me->CastSpell(me, SPELL_UNSTABLE, true); me->CastSpell(me, SPELL_KINETIC_BOMB_VISUAL, true); me->SetReactState(REACT_PASSIVE); - me->SetSpeed(MOVE_FLIGHT, IsHeroic() ? 0.3f : 0.15f, true); me->GetPosition(_x, _y, _groundZ); + me->DespawnOrUnsummon(60000); _groundZ = me->GetMap()->GetHeight(me->GetPhaseMask(), _x, _y, _groundZ, true, 500.0f); } @@ -1247,9 +1241,9 @@ class npc_kinetic_bomb : public CreatureScript _events.ScheduleEvent(EVENT_BOMB_DESPAWN, 1000); else if (action == ACTION_KINETIC_BOMB_JUMP) { - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MoveJump(_x, _y, me->GetPositionZ() + 7.0f, 1.0f, 7.0f); - _events.ScheduleEvent(EVENT_CONTINUE_FALLING, 700); + if (!me->HasAura(SPELL_KINETIC_BOMB_KNOCKBACK)) + me->GetMotionMaster()->MoveCharge(_x, _y, me->GetPositionZ() + 100.0f, me->GetSpeed(MOVE_RUN), 0); + _events.RescheduleEvent(EVENT_CONTINUE_FALLING, 3000); } } @@ -1263,10 +1257,10 @@ class npc_kinetic_bomb : public CreatureScript { case EVENT_BOMB_DESPAWN: me->SetVisible(false); + me->DespawnOrUnsummon(5000); break; case EVENT_CONTINUE_FALLING: - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MovePoint(POINT_KINETIC_BOMB_IMPACT, _x, _y, _groundZ); + me->GetMotionMaster()->MoveCharge(_x, _y, _groundZ, me->GetSpeed(MOVE_WALK), POINT_KINETIC_BOMB_IMPACT); break; default: break; @@ -1329,17 +1323,16 @@ class npc_dark_nucleus : public CreatureScript void DamageTaken(Unit* attacker, uint32& /*damage*/) { - if (attacker == me) + if (attacker == me || attacker == me->getVictim()) return; - if (!_lockedTarget) - if (me->getVictim() == attacker) - _lockedTarget = true; + me->DeleteThreatList(); + me->AddThreat(attacker, 500000000.0f); } - void UpdateAI(const uint32 diff) + void UpdateAI(uint32 const diff) { - if (!me->isInCombat()) + if (!UpdateVictim()) return; if (_targetAuraCheck <= diff) @@ -1355,23 +1348,6 @@ class npc_dark_nucleus : public CreatureScript } else _targetAuraCheck -= diff; - - if (!_lockedTarget) - { - if (Unit* victim = me->SelectVictim()) - { - if (me->getVictim() && me->getVictim() != victim) - { - me->getVictim()->RemoveAurasDueToSpell(SPELL_SHADOW_RESONANCE_RESIST, me->GetGUID()); - _lockedTarget = true; - } - - _lockedTarget = true; - AttackStart(victim); - DoCast(victim, SPELL_SHADOW_RESONANCE_RESIST); - me->ClearUnitState(UNIT_STATE_CASTING); - } - } } private: @@ -1521,10 +1497,11 @@ class spell_valanar_kinetic_bomb : public SpellScriptLoader void ChangeSummonPos(SpellEffIndex /*effIndex*/) { - WorldLocation summonPos = *GetTargetDest(); + WorldLocation summonPos = *GetExplTargetDest(); Position offset = {0.0f, 0.0f, 20.0f, 0.0f}; summonPos.RelocateOffset(offset); - SetTargetDest(summonPos); + SetExplTargetDest(summonPos); + GetHitDest()->RelocateOffset(offset); } void Register() @@ -1586,7 +1563,7 @@ class spell_valanar_kinetic_bomb_knockback : public SpellScriptLoader void Register() { - AfterHit += SpellHitFn(spell_valanar_kinetic_bomb_knockback_SpellScript::KnockIntoAir); + BeforeHit += SpellHitFn(spell_valanar_kinetic_bomb_knockback_SpellScript::KnockIntoAir); } }; @@ -1663,7 +1640,7 @@ class spell_blood_council_shadow_prison_damage : public SpellScriptLoader void AddExtraDamage() { if (Aura* aur = GetHitUnit()->GetAura(GetSpellInfo()->Id)) - if (AuraEffect const* eff = aur->GetEffect(1)) + if (AuraEffect const* eff = aur->GetEffect(EFFECT_1)) SetHitDamage(GetHitDamage() + eff->GetAmount()); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp index 79a577f6591..ee966256e2b 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp @@ -149,7 +149,7 @@ class boss_blood_queen_lana_thel : public CreatureScript events.ScheduleEvent(EVENT_SWARMING_SHADOWS, 30500, EVENT_GROUP_NORMAL); events.ScheduleEvent(EVENT_TWILIGHT_BLOODBOLT, urand(20000, 25000), EVENT_GROUP_NORMAL); events.ScheduleEvent(EVENT_AIR_PHASE, 124000 + uint32(Is25ManRaid() ? 3000 : 0)); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_UNCONTROLLABLE_FRENZY); + CleanAuras(); me->SetSpeed(MOVE_FLIGHT, 0.642857f, true); _offtank = NULL; _vampires.clear(); @@ -170,6 +170,7 @@ class boss_blood_queen_lana_thel : public CreatureScript DoZoneInCombat(); Talk(SAY_AGGRO); instance->SetBossState(DATA_BLOOD_QUEEN_LANA_THEL, IN_PROGRESS); + CleanAuras(); DoCast(me, SPELL_SHROUD_OF_SORROW, true); DoCast(me, SPELL_FRENZIED_BLOODTHIRST_VISUAL, true); @@ -180,15 +181,7 @@ class boss_blood_queen_lana_thel : public CreatureScript { _JustDied(); Talk(SAY_DEATH); - instance->DoRemoveAurasDueToSpellOnPlayers(ESSENCE_OF_BLOOD_QUEEN); - instance->DoRemoveAurasDueToSpellOnPlayers(ESSENCE_OF_BLOOD_QUEEN_PLR); - instance->DoRemoveAurasDueToSpellOnPlayers(FRENZIED_BLOODTHIRST); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_UNCONTROLLABLE_FRENZY); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_DAMAGE); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_VISUAL); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_DUMMY); - instance->DoRemoveAurasDueToSpellOnPlayers(DELIRIOUS_SLASH); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_PACT_OF_THE_DARKFALLEN); + CleanAuras(); // Blah, credit the quest if (_creditBloodQuickening) { @@ -198,8 +191,8 @@ class boss_blood_queen_lana_thel : public CreatureScript if (Creature* minchar = me->FindNearestCreature(NPC_INFILTRATOR_MINCHAR_BQ, 200.0f)) { minchar->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); - minchar->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, 0x01); - minchar->SetFlying(false); + minchar->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND); + minchar->SetCanFly(false); minchar->SendMovementFlagUpdate(); minchar->RemoveAllAuras(); minchar->GetMotionMaster()->MoveCharge(4629.3711f, 2782.6089f, 401.5301f, SPEED_CHARGE/3.0f); @@ -207,6 +200,19 @@ class boss_blood_queen_lana_thel : public CreatureScript } } + void CleanAuras() + { + instance->DoRemoveAurasDueToSpellOnPlayers(ESSENCE_OF_BLOOD_QUEEN); + instance->DoRemoveAurasDueToSpellOnPlayers(ESSENCE_OF_BLOOD_QUEEN_PLR); + instance->DoRemoveAurasDueToSpellOnPlayers(FRENZIED_BLOODTHIRST); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_UNCONTROLLABLE_FRENZY); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_DAMAGE); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_VISUAL); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_DUMMY); + instance->DoRemoveAurasDueToSpellOnPlayers(DELIRIOUS_SLASH); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_PACT_OF_THE_DARKFALLEN); + } + void DoAction(int32 const action) { if (action != ACTION_KILL_MINCHAR) @@ -216,9 +222,9 @@ class boss_blood_queen_lana_thel : public CreatureScript _killMinchar = true; else { - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, 0x01); - me->SetFlying(true); + me->SetDisableGravity(true); + me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND); + me->SetCanFly(true); me->SendMovementFlagUpdate(); me->GetMotionMaster()->MovePoint(POINT_MINCHAR, mincharPos); } @@ -227,12 +233,13 @@ class boss_blood_queen_lana_thel : public CreatureScript void EnterEvadeMode() { _EnterEvadeMode(); + CleanAuras(); if (_killMinchar) { _killMinchar = false; - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, 0x01); - me->SetFlying(true); + me->SetDisableGravity(true); + me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND); + me->SetCanFly(true); me->GetMotionMaster()->MovePoint(POINT_MINCHAR, mincharPos); } else @@ -244,9 +251,9 @@ class boss_blood_queen_lana_thel : public CreatureScript void JustReachedHome() { - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, 0x01); - me->SetFlying(false); + me->SetDisableGravity(false); + me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND); + me->SetCanFly(false); me->SetReactState(REACT_AGGRESSIVE); _JustReachedHome(); Talk(SAY_WIPE); @@ -295,9 +302,9 @@ class boss_blood_queen_lana_thel : public CreatureScript events.ScheduleEvent(EVENT_AIR_FLY_DOWN, 10000); break; case POINT_GROUND: - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, 0x01); - me->SetFlying(false); + me->SetDisableGravity(false); + me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND); + me->SetCanFly(false); me->SendMovementFlagUpdate(); me->SetReactState(REACT_AGGRESSIVE); if (Unit* victim = me->SelectVictim()) @@ -372,7 +379,7 @@ class boss_blood_queen_lana_thel : public CreatureScript break; } case EVENT_DELIRIOUS_SLASH: - if (_offtank && !me->HasByteFlag(UNIT_FIELD_BYTES_1, 3, 0x03)) + if (_offtank && !me->HasByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER)) DoCast(_offtank, SPELL_DELIRIOUS_SLASH); events.ScheduleEvent(EVENT_DELIRIOUS_SLASH, urand(20000, 24000), EVENT_GROUP_NORMAL); break; @@ -386,7 +393,7 @@ class boss_blood_queen_lana_thel : public CreatureScript ++targetCount; if (Is25ManRaid()) ++targetCount; - Trinity::RandomResizeList<Player*>(targets, targetCount); + Trinity::Containers::RandomResizeList<Player*>(targets, targetCount); if (targets.size() > 1) { Talk(SAY_PACT_OF_THE_DARKFALLEN); @@ -409,7 +416,7 @@ class boss_blood_queen_lana_thel : public CreatureScript { std::list<Player*> targets; SelectRandomTarget(false, &targets); - Trinity::RandomResizeList<Player*>(targets, uint32(Is25ManRaid() ? 4 : 2)); + Trinity::Containers::RandomResizeList<Player*>(targets, uint32(Is25ManRaid() ? 4 : 2)); for (std::list<Player*>::iterator itr = targets.begin(); itr != targets.end(); ++itr) DoCast(*itr, SPELL_TWILIGHT_BLOODBOLT); DoCast(me, SPELL_TWILIGHT_BLOODBOLT_TARGET); @@ -424,9 +431,9 @@ class boss_blood_queen_lana_thel : public CreatureScript me->GetMotionMaster()->MovePoint(POINT_CENTER, centerPos); break; case EVENT_AIR_START_FLYING: - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, 0x01); - me->SetFlying(true); + me->SetDisableGravity(true); + me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND); + me->SetCanFly(true); me->SendMovementFlagUpdate(); me->GetMotionMaster()->MovePoint(POINT_AIR, airPos); break; @@ -481,7 +488,7 @@ class boss_blood_queen_lana_thel : public CreatureScript return tempTargets.front(); } - return SelectRandomContainerElement(tempTargets); + return Trinity::Containers::SelectRandomContainerElement(tempTargets); } std::set<uint64> _vampires; @@ -522,7 +529,7 @@ class spell_blood_queen_vampiric_bite : public SpellScriptLoader SpellCastResult CheckTarget() { - if (IsVampire(GetTargetUnit())) + if (IsVampire(GetExplTargetUnit())) { SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_CANT_TARGET_VAMPIRES); return SPELL_FAILED_CUSTOM_ERROR; @@ -658,7 +665,7 @@ class spell_blood_queen_bloodbolt : public SpellScriptLoader { uint32 targetCount = (targets.size() + 2) / 3; targets.remove_if (BloodboltHitCheck(static_cast<LanaThelAI*>(GetCaster()->GetAI()))); - Trinity::RandomResizeList(targets, targetCount); + Trinity::Containers::RandomResizeList(targets, targetCount); // mark targets now, effect hook has missile travel time delay (might cast next in that time) for (std::list<Unit*>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) GetCaster()->GetAI()->SetGUID((*itr)->GetGUID(), GUID_BLOODBOLT); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp index 3c795187f43..494be259baa 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp @@ -39,6 +39,7 @@ enum ScriptTexts SAY_FRENZY = 11, SAY_BERSERK = 12, SAY_DEATH = 13, + EMOTE_SCENT_OF_BLOOD = 14, // High Overlord Saurfang SAY_INTRO_HORDE_1 = 0, @@ -111,6 +112,8 @@ enum Spells SPELL_RIDE_VEHICLE = 70640, // Outro SPELL_ACHIEVEMENT = 72928, + SPELL_REMOVE_MARKS_OF_THE_FALLEN_CHAMPION = 72257, + SPELL_PERMANENT_FEIGN_DEATH = 70628, }; // Helper to get id of the aura on different modes (HasAura(baseId) wont work) @@ -143,6 +146,7 @@ enum EventTypes EVENT_BOILING_BLOOD = 20, EVENT_BLOOD_NOVA = 21, EVENT_RUNE_OF_BLOOD = 22, + EVENT_SCENT_OF_BLOOD = 52, EVENT_OUTRO_ALLIANCE_1 = 23, EVENT_OUTRO_ALLIANCE_2 = 24, @@ -254,6 +258,7 @@ class boss_deathbringer_saurfang : public CreatureScript me->SetReactState(REACT_DEFENSIVE); events.SetPhase(PHASE_COMBAT); _frenzied = false; + _dead = false; me->SetPower(POWER_ENERGY, 0); DoCast(me, SPELL_ZERO_POWER, true); DoCast(me, SPELL_BLOOD_LINK, true); @@ -266,6 +271,9 @@ class boss_deathbringer_saurfang : public CreatureScript void EnterCombat(Unit* who) { + if (_dead) + return; + if (!instance->CheckRequiredBosses(DATA_DEATHBRINGER_SAURFANG, who->ToPlayer())) { EnterEvadeMode(); @@ -291,7 +299,7 @@ class boss_deathbringer_saurfang : public CreatureScript Talk(SAY_AGGRO); events.ScheduleEvent(EVENT_SUMMON_BLOOD_BEAST, 30000, 0, PHASE_COMBAT); - events.ScheduleEvent(EVENT_BERSERK, 480000, 0, PHASE_COMBAT); + events.ScheduleEvent(EVENT_BERSERK, IsHeroic() ? 360000 : 480000, 0, PHASE_COMBAT); events.ScheduleEvent(EVENT_BOILING_BLOOD, 15500, 0, PHASE_COMBAT); events.ScheduleEvent(EVENT_BLOOD_NOVA, 17000, 0, PHASE_COMBAT); events.ScheduleEvent(EVENT_RUNE_OF_BLOOD, 20000, 0, PHASE_COMBAT); @@ -303,13 +311,6 @@ class boss_deathbringer_saurfang : public CreatureScript void JustDied(Unit* /*killer*/) { - _JustDied(); - DoCast(me, SPELL_ACHIEVEMENT, true); - Talk(SAY_DEATH); - - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_MARK_OF_THE_FALLEN_CHAMPION); - if (Creature* creature = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SAURFANG_EVENT_NPC))) - creature->AI()->DoAction(ACTION_START_OUTRO); } void AttackStart(Unit* victim) @@ -340,14 +341,34 @@ class boss_deathbringer_saurfang : public CreatureScript Talk(SAY_KILL); } - void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/) + void DamageTaken(Unit* /*attacker*/, uint32& damage) { + if (damage >= me->GetHealth()) + damage = me->GetHealth() - 1; + if (!_frenzied && HealthBelowPct(31)) // AT 30%, not below { _frenzied = true; DoCast(me, SPELL_FRENZY); Talk(SAY_FRENZY); } + + if (!_dead && me->GetHealth() < FightWonValue) + { + _dead = true; + _JustDied(); + _EnterEvadeMode(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + + DoCastAOE(SPELL_REMOVE_MARKS_OF_THE_FALLEN_CHAMPION); + DoCast(me, SPELL_ACHIEVEMENT, true); + Talk(SAY_DEATH); + + //instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_MARK_OF_THE_FALLEN_CHAMPION); + DoCast(me, SPELL_PERMANENT_FEIGN_DEATH); + if (Creature* creature = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SAURFANG_EVENT_NPC))) + creature->AI()->DoAction(ACTION_START_OUTRO); + } } void JustSummoned(Creature* summon) @@ -355,16 +376,13 @@ class boss_deathbringer_saurfang : public CreatureScript if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true)) summon->AI()->AttackStart(target); - if (IsHeroic()) - DoCast(summon, SPELL_SCENT_OF_BLOOD); - - summon->AI()->DoCast(summon, SPELL_BLOOD_LINK_BEAST, true); - summon->AI()->DoCast(summon, SPELL_RESISTANT_SKIN, true); + summon->CastSpell(summon, SPELL_BLOOD_LINK_BEAST, true); + summon->CastSpell(summon, SPELL_RESISTANT_SKIN, true); summons.Summon(summon); DoZoneInCombat(summon); } - void SummonedCreatureDespawn(Creature* summon) + void SummonedCreatureDies(Creature* summon, Unit* /*killer*/) { summons.Despawn(summon); } @@ -444,18 +462,13 @@ class boss_deathbringer_saurfang : public CreatureScript DoCast(me, SPELL_SUMMON_BLOOD_BEAST_25_MAN+i25); Talk(SAY_BLOOD_BEASTS); events.ScheduleEvent(EVENT_SUMMON_BLOOD_BEAST, 40000, 0, PHASE_COMBAT); + if (IsHeroic()) + events.ScheduleEvent(EVENT_SCENT_OF_BLOOD, 10000, 0, PHASE_COMBAT); break; case EVENT_BLOOD_NOVA: - { - // select at range only - Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, -10.0f, true); - if (!target) - target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true); // noone? select melee - if (target) - DoCast(target, SPELL_BLOOD_NOVA_TRIGGER); + DoCastAOE(SPELL_BLOOD_NOVA_TRIGGER); events.ScheduleEvent(EVENT_BLOOD_NOVA, urand(20000, 25000), 0, PHASE_COMBAT); break; - } case EVENT_RUNE_OF_BLOOD: DoCastVictim(SPELL_RUNE_OF_BLOOD); events.ScheduleEvent(EVENT_RUNE_OF_BLOOD, urand(20000, 25000), 0, PHASE_COMBAT); @@ -468,6 +481,13 @@ class boss_deathbringer_saurfang : public CreatureScript DoCast(me, SPELL_BERSERK); Talk(SAY_BERSERK); break; + case EVENT_SCENT_OF_BLOOD: + if (!summons.empty()) + { + Talk(EMOTE_SCENT_OF_BLOOD); + DoCastAOE(SPELL_SCENT_OF_BLOOD); + } + break; default: break; } @@ -542,10 +562,13 @@ class boss_deathbringer_saurfang : public CreatureScript } } + static uint32 const FightWonValue; + private: uint32 _fallenChampionCastCount; bool _introDone; bool _frenzied; // faster than iterating all auras to find Frenzy + bool _dead; }; CreatureAI* GetAI(Creature* creature) const @@ -554,6 +577,8 @@ class boss_deathbringer_saurfang : public CreatureScript } }; +uint32 const boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::FightWonValue = 100000; + class npc_high_overlord_saurfang_icc : public CreatureScript { public: @@ -605,10 +630,8 @@ class npc_high_overlord_saurfang_icc : public CreatureScript _events.ScheduleEvent(EVENT_OUTRO_HORDE_3, 18000); // say _events.ScheduleEvent(EVENT_OUTRO_HORDE_4, 24000); // cast _events.ScheduleEvent(EVENT_OUTRO_HORDE_5, 30000); // move - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->SendMovementFlagUpdate(); - me->Relocate(me->GetPositionX(), me->GetPositionY(), 539.2917f); - me->MonsterMoveWithSpeed(me->GetPositionX(), me->GetPositionY(), 539.2917f, 0.0f); + me->SetDisableGravity(false); + me->GetMotionMaster()->MoveFall(); for (std::list<Creature*>::iterator itr = _guardList.begin(); itr != _guardList.end(); ++itr) (*itr)->AI()->DoAction(ACTION_DESPAWN); break; @@ -629,7 +652,7 @@ class npc_high_overlord_saurfang_icc : public CreatureScript { if (spell->Id == SPELL_GRIP_OF_AGONY) { - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetDisableGravity(true); me->GetMotionMaster()->MovePoint(POINT_CHOKE, chokePos[0]); } } @@ -641,7 +664,7 @@ class npc_high_overlord_saurfang_icc : public CreatureScript switch (id) { case POINT_FIRST_STEP: - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(false); Talk(SAY_INTRO_HORDE_3); _events.ScheduleEvent(EVENT_INTRO_HORDE_5, 15500, 0, PHASE_INTRO_H); _events.ScheduleEvent(EVENT_INTRO_HORDE_6, 29500, 0, PHASE_INTRO_H); @@ -655,7 +678,7 @@ class npc_high_overlord_saurfang_icc : public CreatureScript { deathbringer->CastSpell(me, SPELL_RIDE_VEHICLE, true); // for the packet logs. deathbringer->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - deathbringer->setDeathState(ALIVE); + deathbringer->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_DROWNED); } _events.ScheduleEvent(EVENT_OUTRO_HORDE_5, 1000); // move _events.ScheduleEvent(EVENT_OUTRO_HORDE_6, 4000); // say @@ -687,7 +710,7 @@ class npc_high_overlord_saurfang_icc : public CreatureScript switch (eventId) { case EVENT_INTRO_HORDE_3: - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(true); me->GetMotionMaster()->MovePoint(POINT_FIRST_STEP, firstStepPos.GetPositionX(), firstStepPos.GetPositionY(), firstStepPos.GetPositionZ()); break; case EVENT_INTRO_HORDE_5: @@ -718,7 +741,7 @@ class npc_high_overlord_saurfang_icc : public CreatureScript { float x, y, z; deathbringer->GetClosePoint(x, y, z, deathbringer->GetObjectSize()); - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(true); me->GetMotionMaster()->MovePoint(POINT_CORPSE, x, y, z); } break; @@ -812,12 +835,14 @@ class npc_muradin_bronzebeard_icc : public CreatureScript { me->RemoveAurasDueToSpell(SPELL_GRIP_OF_AGONY); Talk(SAY_OUTRO_ALLIANCE_1); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->SendMovementFlagUpdate(); - me->Relocate(me->GetPositionX(), me->GetPositionY(), 539.2917f); - me->MonsterMoveWithSpeed(me->GetPositionX(), me->GetPositionY(), 539.2917f, 0.0f); + me->SetDisableGravity(false); + me->GetMotionMaster()->MoveFall(); for (std::list<Creature*>::iterator itr = _guardList.begin(); itr != _guardList.end(); ++itr) (*itr)->AI()->DoAction(ACTION_DESPAWN); + + // temp until outro fully done - to put deathbringer on respawn timer (until next reset) + if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG))) + deathbringer->DespawnOrUnsummon(5000); break; } case ACTION_INTERRUPT_INTRO: @@ -832,7 +857,7 @@ class npc_muradin_bronzebeard_icc : public CreatureScript { if (spell->Id == SPELL_GRIP_OF_AGONY) { - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetDisableGravity(true); me->GetMotionMaster()->MovePoint(POINT_CHOKE, chokePos[0]); } } @@ -841,7 +866,7 @@ class npc_muradin_bronzebeard_icc : public CreatureScript { if (type == POINT_MOTION_TYPE && id == POINT_FIRST_STEP) { - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(false); Talk(SAY_INTRO_ALLIANCE_4); _events.ScheduleEvent(EVENT_INTRO_ALLIANCE_5, 5000, 0, PHASE_INTRO_A); if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG))) @@ -865,7 +890,7 @@ class npc_muradin_bronzebeard_icc : public CreatureScript switch (eventId) { case EVENT_INTRO_ALLIANCE_4: - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(true); me->GetMotionMaster()->MovePoint(POINT_FIRST_STEP, firstStepPos.GetPositionX(), firstStepPos.GetPositionY(), firstStepPos.GetPositionZ()); break; case EVENT_INTRO_ALLIANCE_5: @@ -934,7 +959,7 @@ class npc_saurfang_event : public CreatureScript { if (spell->Id == SPELL_GRIP_OF_AGONY) { - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetDisableGravity(true); me->GetMotionMaster()->MovePoint(POINT_CHOKE, chokePos[_index]); } } @@ -1175,6 +1200,9 @@ class spell_deathbringer_blood_nova_targeting : public SpellScriptLoader void FilterTargetsInitial(std::list<Unit*>& unitList) { + if (unitList.empty()) + return; + // select one random target, with preference of ranged targets uint32 targetsAtRange = 0; uint32 const minTargets = uint32(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 10 : 4); @@ -1189,7 +1217,9 @@ class spell_deathbringer_blood_nova_targeting : public SpellScriptLoader if (targetsAtRange < minTargets) targetsAtRange = std::min<uint32>(unitList.size() - 1, minTargets); - target = SelectRandomContainerElement(unitList); + std::list<Unit*>::const_iterator itr = unitList.begin(); + std::advance(itr, urand(0, targetsAtRange)); + target = *itr; unitList.clear(); unitList.push_back(target); } @@ -1204,10 +1234,16 @@ class spell_deathbringer_blood_nova_targeting : public SpellScriptLoader unitList.push_back(target); } + void HandleForceCast(SpellEffIndex /*effIndex*/) + { + GetCaster()->CastSpell(GetHitUnit(), uint32(GetEffectValue()), TRIGGERED_FULL_MASK); + } + void Register() { OnUnitTargetSelect += SpellUnitTargetFn(spell_deathbringer_blood_nova_targeting_SpellScript::FilterTargetsInitial, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); OnUnitTargetSelect += SpellUnitTargetFn(spell_deathbringer_blood_nova_targeting_SpellScript::FilterTargetsSubsequent, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + OnEffectHitTarget += SpellEffectFn(spell_deathbringer_blood_nova_targeting_SpellScript::HandleForceCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST); } Unit* target; @@ -1239,7 +1275,7 @@ class spell_deathbringer_boiling_blood : public SpellScriptLoader if (unitList.empty()) return; - Unit* target = SelectRandomContainerElement(unitList); + Unit* target = Trinity::Containers::SelectRandomContainerElement(unitList); unitList.clear(); unitList.push_back(target); } @@ -1256,6 +1292,33 @@ class spell_deathbringer_boiling_blood : public SpellScriptLoader } }; +class spell_deathbringer_remove_marks : public SpellScriptLoader +{ + public: + spell_deathbringer_remove_marks() : SpellScriptLoader("spell_deathbringer_remove_marks") { } + + class spell_deathbringer_remove_marks_SpellScript : public SpellScript + { + PrepareSpellScript(spell_deathbringer_remove_marks_SpellScript); + + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + GetHitUnit()->RemoveAurasDueToSpell(uint32(GetEffectValue())); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_deathbringer_remove_marks_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_deathbringer_remove_marks_SpellScript(); + } +}; + class achievement_ive_gone_and_made_a_mess : public AchievementCriteriaScript { public: @@ -1285,5 +1348,6 @@ void AddSC_boss_deathbringer_saurfang() new spell_deathbringer_blood_nova(); new spell_deathbringer_blood_nova_targeting(); new spell_deathbringer_boiling_blood(); + new spell_deathbringer_remove_marks(); new achievement_ive_gone_and_made_a_mess(); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp index a97c6f7d138..58856f9fb44 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp @@ -328,7 +328,7 @@ class npc_stinky_icc : public CreatureScript DoMeleeAttackIfReady(); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { if (Creature* festergut = me->GetCreature(*me, _instance->GetData64(DATA_FESTERGUT))) if (festergut->isAlive()) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp index 6edf3fe300b..0515ba83480 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp @@ -605,7 +605,7 @@ class boss_lady_deathwhisper : public CreatureScript return; // select random cultist - Creature* cultist = SelectRandomContainerElement(temp); + Creature* cultist = Trinity::Containers::SelectRandomContainerElement(temp); DoCast(cultist, cultist->GetEntry() == NPC_CULT_FANATIC ? SPELL_DARK_TRANSFORMATION_T : SPELL_DARK_EMPOWERMENT_T, true); Talk(uint8(cultist->GetEntry() == NPC_CULT_FANATIC ? SAY_DARK_TRANSFORMATION : SAY_DARK_EMPOWERMENT)); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index 8623fcfde81..a0fca522f61 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -64,6 +64,9 @@ enum Spells SPELL_MALLEABLE_GOO = 70852, SPELL_UNSTABLE_EXPERIMENT = 70351, SPELL_TEAR_GAS = 71617, // phase transition + SPELL_TEAR_GAS_CREATURE = 71618, + SPELL_TEAR_GAS_CANCEL = 71620, + SPELL_TEAR_GAS_PERIODIC_TRIGGER = 73170, SPELL_CREATE_CONCOCTION = 71621, SPELL_GUZZLE_POTIONS = 71893, SPELL_OOZE_TANK_PROTECTION = 71770, // protects the tank @@ -86,6 +89,7 @@ enum Spells SPELL_GASEOUS_BLOAT_PROC = 70215, SPELL_GASEOUS_BLOAT = 70672, SPELL_GASEOUS_BLOAT_PROTECTION = 70812, + SPELL_EXPUNGED_GAS = 70701, // Volatile Ooze SPELL_OOZE_ERUPTION = 70492, @@ -167,6 +171,33 @@ enum PutricideData #define EXPERIMENT_STATE_OOZE false #define EXPERIMENT_STATE_GAS true +class AbominationDespawner +{ + public: + explicit AbominationDespawner(Unit* owner) : _owner(owner) { } + + bool operator()(uint64 guid) + { + if (Unit* summon = ObjectAccessor::GetUnit(*_owner, guid)) + { + if (summon->GetEntry() == NPC_MUTATED_ABOMINATION_10 || summon->GetEntry() == NPC_MUTATED_ABOMINATION_25) + { + if (Vehicle* veh = summon->GetVehicleKit()) + veh->RemoveAllPassengers(); // also despawns the vehicle + + return true; + } + + return false; + } + + return true; + } + + private: + Unit* _owner; +}; + class boss_professor_putricide : public CreatureScript { public: @@ -191,7 +222,7 @@ class boss_professor_putricide : public CreatureScript SetPhase(PHASE_COMBAT_1); _experimentState = EXPERIMENT_STATE_OOZE; me->SetReactState(REACT_DEFENSIVE); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(false); if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) me->GetMotionMaster()->MovementExpired(); @@ -230,7 +261,7 @@ class boss_professor_putricide : public CreatureScript void JustReachedHome() { _JustReachedHome(); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(false); if (events.GetPhaseMask() & PHASE_MASK_COMBAT) instance->SetBossState(DATA_PROFESSOR_PUTRICIDE, FAIL); } @@ -477,8 +508,7 @@ class boss_professor_putricide : public CreatureScript SetPhase(PHASE_COMBAT_3); events.ScheduleEvent(EVENT_MUTATED_PLAGUE, 25000); events.CancelEvent(EVENT_UNSTABLE_EXPERIMENT); - summons.DespawnEntry(NPC_MUTATED_ABOMINATION_10); - summons.DespawnEntry(NPC_MUTATED_ABOMINATION_25); + summons.remove_if(AbominationDespawner(me)); break; default: break; @@ -514,7 +544,7 @@ class boss_professor_putricide : public CreatureScript void UpdateAI(uint32 const diff) { - if ((!UpdateVictim() && !(events.GetPhaseMask() & PHASE_MASK_NOT_SELF)) || !CheckInRoom()) + if ((!(events.GetPhaseMask() & PHASE_MASK_NOT_SELF) && !UpdateVictim()) || !CheckInRoom()) return; events.Update(diff); @@ -569,13 +599,15 @@ class boss_professor_putricide : public CreatureScript break; case EVENT_TEAR_GAS: me->GetMotionMaster()->MovePoint(POINT_TABLE, tablePos); + DoCast(me, SPELL_TEAR_GAS_PERIODIC_TRIGGER, true); break; case EVENT_RESUME_ATTACK: me->SetReactState(REACT_DEFENSIVE); AttackStart(me->getVictim()); // remove Tear Gas + me->RemoveAurasDueToSpell(SPELL_TEAR_GAS_PERIODIC_TRIGGER); instance->DoRemoveAurasDueToSpellOnPlayers(71615); - instance->DoRemoveAurasDueToSpellOnPlayers(71618); + DoCastAOE(SPELL_TEAR_GAS_CANCEL); instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_GAS_VARIABLE); instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_OOZE_VARIABLE); break; @@ -673,27 +705,36 @@ class npc_volatile_ooze : public CreatureScript public: npc_volatile_ooze() : CreatureScript("npc_volatile_ooze") { } - struct npc_volatile_oozeAI : public ScriptedAI + struct npc_putricide_oozeAI : public ScriptedAI { - npc_volatile_oozeAI(Creature* creature) : ScriptedAI(creature) + npc_putricide_oozeAI(Creature* creature) : ScriptedAI(creature) { _newTargetSelectTimer = 0; } void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) { - if (!_newTargetSelectTimer && sSpellMgr->GetSpellDifficultyId(spell->Id) == sSpellMgr->GetSpellDifficultyId(SPELL_OOZE_ERUPTION)) + if (!_newTargetSelectTimer && spell->Id == sSpellMgr->GetSpellIdForDifficulty(SPELL_OOZE_ERUPTION, me)) + _newTargetSelectTimer = 1000; + } + + void SpellHit(Unit* /*caster*/, SpellInfo const* spell) + { + if (spell->Id == SPELL_TEAR_GAS_CREATURE) _newTargetSelectTimer = 1000; } void UpdateAI(uint32 const diff) { - if (!UpdateVictim()) + if (!UpdateVictim() && !_newTargetSelectTimer) return; if (!_newTargetSelectTimer) return; + if (me->HasAura(SPELL_TEAR_GAS_CREATURE)) + return; + if (_newTargetSelectTimer <= diff) { _newTargetSelectTimer = 0; @@ -704,13 +745,68 @@ class npc_volatile_ooze : public CreatureScript } private: - // no need to use EventMap for just one event uint32 _newTargetSelectTimer; }; CreatureAI* GetAI(Creature* creature) const { - return GetIcecrownCitadelAI<npc_volatile_oozeAI>(creature); + return GetIcecrownCitadelAI<npc_putricide_oozeAI>(creature); + } +}; + +class npc_gas_cloud : public CreatureScript +{ + public: + npc_gas_cloud() : CreatureScript("npc_gas_cloud") { } + + struct npc_gas_cloudAI : public ScriptedAI + { + npc_gas_cloudAI(Creature* creature) : ScriptedAI(creature) + { + _newTargetSelectTimer = 0; + } + + void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) + { + if (!_newTargetSelectTimer && spell->Id == sSpellMgr->GetSpellIdForDifficulty(SPELL_EXPUNGED_GAS, me)) + _newTargetSelectTimer = 1000; + } + + void SpellHit(Unit* /*caster*/, SpellInfo const* spell) + { + if (spell->Id == SPELL_TEAR_GAS_CREATURE) + _newTargetSelectTimer = 1000; + } + + void UpdateAI(uint32 const diff) + { + if (!UpdateVictim() && !_newTargetSelectTimer) + return; + + DoMeleeAttackIfReady(); + + if (!_newTargetSelectTimer) + return; + + if (me->HasAura(SPELL_TEAR_GAS_CREATURE)) + return; + + if (_newTargetSelectTimer <= diff) + { + _newTargetSelectTimer = 0; + me->CastCustomSpell(SPELL_GASEOUS_BLOAT, SPELLVALUE_AURA_STACK, 10, me, false); + } + else + _newTargetSelectTimer -= diff; + } + + private: + uint32 _newTargetSelectTimer; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI<npc_gas_cloudAI>(creature); } }; @@ -729,8 +825,8 @@ class spell_putricide_gaseous_bloat : public SpellScriptLoader if (Unit* caster = GetCaster()) { target->RemoveAuraFromStack(GetSpellInfo()->Id, GetCasterGUID()); - if (!target->HasAura(GetId())&& caster->GetTypeId() == TYPEID_UNIT) - caster->ToCreature()->DespawnOrUnsummon(); + if (!target->HasAura(GetId())) + caster->CastCustomSpell(SPELL_GASEOUS_BLOAT, SPELLVALUE_AURA_STACK, 10, caster, false); } } @@ -781,7 +877,7 @@ class spell_putricide_ooze_channel : public SpellScriptLoader return; } - Unit* target = SelectRandomContainerElement(targetList); + Unit* target = Trinity::Containers::SelectRandomContainerElement(targetList); targetList.clear(); targetList.push_back(target); _target = target; @@ -797,7 +893,19 @@ class spell_putricide_ooze_channel : public SpellScriptLoader void StartAttack() { GetCaster()->ClearUnitState(UNIT_STATE_CASTING); + GetCaster()->DeleteThreatList(); GetCaster()->ToCreature()->AI()->AttackStart(GetHitUnit()); + GetCaster()->AddThreat(GetHitUnit(), 500000000.0f); // value seen in sniff + } + + // temporary, until SelectTarget are not called on empty lists + void CheckTarget() + { + if (_target) + return; + + FinishCast(SPELL_FAILED_NO_VALID_TARGETS); + GetCaster()->ToCreature()->DespawnOrUnsummon(1); // despawn next update } void Register() @@ -806,6 +914,7 @@ class spell_putricide_ooze_channel : public SpellScriptLoader OnUnitTargetSelect += SpellUnitTargetFn(spell_putricide_ooze_channel_SpellScript::SetTarget, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); OnUnitTargetSelect += SpellUnitTargetFn(spell_putricide_ooze_channel_SpellScript::SetTarget, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY); AfterHit += SpellHitFn(spell_putricide_ooze_channel_SpellScript::StartAttack); + OnCast += SpellCastFn(spell_putricide_ooze_channel_SpellScript::CheckTarget); } Unit* _target; @@ -905,13 +1014,13 @@ class spell_putricide_unstable_experiment : public SpellScriptLoader uint32 stage = GetCaster()->ToCreature()->AI()->GetData(DATA_EXPERIMENT_STAGE); Creature* target = NULL; std::list<Creature*> creList; - GetCreatureListWithEntryInGrid(creList, GetCaster(), NPC_ABOMINATION_WING_MAD_SCIENTIST_STALKER, 100.0f); + GetCreatureListWithEntryInGrid(creList, GetCaster(), NPC_ABOMINATION_WING_MAD_SCIENTIST_STALKER, 200.0f); // 2 of them are spawned at green place - weird trick blizz for (std::list<Creature*>::iterator itr = creList.begin(); itr != creList.end(); ++itr) { target = *itr; std::list<Creature*> tmp; - GetCreatureListWithEntryInGrid(tmp, target, NPC_ABOMINATION_WING_MAD_SCIENTIST_STALKER, 1.0f); + GetCreatureListWithEntryInGrid(tmp, target, NPC_ABOMINATION_WING_MAD_SCIENTIST_STALKER, 10.0f); if ((!stage && tmp.size() > 1) || (stage && tmp.size() == 1)) break; } @@ -931,42 +1040,6 @@ class spell_putricide_unstable_experiment : public SpellScriptLoader } }; -class spell_putricide_ooze_summon : public SpellScriptLoader -{ - public: - spell_putricide_ooze_summon() : SpellScriptLoader("spell_putricide_ooze_summon") { } - - class spell_putricide_ooze_summon_AuraScript : public AuraScript - { - PrepareAuraScript(spell_putricide_ooze_summon_AuraScript); - - void HandleTriggerSpell(AuraEffect const* aurEff) - { - PreventDefaultAction(); - if (Unit* caster = GetCaster()) - { - uint32 triggerSpellId = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell; - float x, y, z; - GetTarget()->GetPosition(x, y, z); - z = GetTarget()->GetMap()->GetHeight(GetTarget()->GetPhaseMask(), x, y, z, true, 25.0f); - x += 10.0f * cosf(caster->GetOrientation()); - y += 10.0f * sinf(caster->GetOrientation()); - caster->CastSpell(x, y, z, triggerSpellId, true, NULL, NULL, GetCasterGUID()); - } - } - - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_putricide_ooze_summon_AuraScript::HandleTriggerSpell, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; - - AuraScript* GetAuraScript() const - { - return new spell_putricide_ooze_summon_AuraScript(); - } -}; - class spell_putricide_ooze_eruption_searcher : public SpellScriptLoader { public: @@ -1207,11 +1280,11 @@ class spell_putricide_mutation_init : public SpellScriptLoader SpellCastResult CheckRequirementInternal(SpellCustomErrors& extendedError) { - InstanceScript* instance = GetTargetUnit()->GetInstanceScript(); + InstanceScript* instance = GetExplTargetUnit()->GetInstanceScript(); if (!instance) return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; - Creature* professor = ObjectAccessor::GetCreature(*GetTargetUnit(), instance->GetData64(DATA_PROFESSOR_PUTRICIDE)); + Creature* professor = ObjectAccessor::GetCreature(*GetExplTargetUnit(), instance->GetData64(DATA_PROFESSOR_PUTRICIDE)); if (!professor) return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; @@ -1232,17 +1305,17 @@ class spell_putricide_mutation_init : public SpellScriptLoader SpellCastResult CheckRequirement() { - if (!GetTargetUnit()) + if (!GetExplTargetUnit()) return SPELL_FAILED_BAD_TARGETS; - if (GetTargetUnit()->GetTypeId() != TYPEID_PLAYER) + if (GetExplTargetUnit()->GetTypeId() != TYPEID_PLAYER) return SPELL_FAILED_TARGET_NOT_PLAYER; SpellCustomErrors extension = SPELL_CUSTOM_ERROR_NONE; SpellCastResult result = CheckRequirementInternal(extension); if (result != SPELL_CAST_OK) { - Spell::SendCastResult(GetTargetUnit()->ToPlayer(), GetSpellInfo(), 0, result, extension); + Spell::SendCastResult(GetExplTargetUnit()->ToPlayer(), GetSpellInfo(), 0, result, extension); return result; } @@ -1429,14 +1502,15 @@ class spell_putricide_regurgitated_ooze : public SpellScriptLoader } }; -class spell_putricide_clear_mutated_plague : public SpellScriptLoader +// Removes aura with id stored in effect value +class spell_putricide_clear_aura_effect_value : public SpellScriptLoader { public: - spell_putricide_clear_mutated_plague() : SpellScriptLoader("spell_putricide_clear_mutated_plague") { } + spell_putricide_clear_aura_effect_value() : SpellScriptLoader("spell_putricide_clear_aura_effect_value") { } - class spell_putricide_clear_mutated_plague_SpellScript : public SpellScript + class spell_putricide_clear_aura_effect_value_SpellScript : public SpellScript { - PrepareSpellScript(spell_putricide_clear_mutated_plague_SpellScript); + PrepareSpellScript(spell_putricide_clear_aura_effect_value_SpellScript); void HandleScript(SpellEffIndex effIndex) { @@ -1447,13 +1521,13 @@ class spell_putricide_clear_mutated_plague : public SpellScriptLoader void Register() { - OnEffectHitTarget += SpellEffectFn(spell_putricide_clear_mutated_plague_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_putricide_clear_aura_effect_value_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; SpellScript* GetSpellScript() const { - return new spell_putricide_clear_mutated_plague_SpellScript(); + return new spell_putricide_clear_aura_effect_value_SpellScript(); } }; @@ -1492,12 +1566,12 @@ void AddSC_boss_professor_putricide() { new boss_professor_putricide(); new npc_volatile_ooze(); + new npc_gas_cloud(); new spell_putricide_gaseous_bloat(); new spell_putricide_ooze_channel(); new spell_putricide_slime_puddle(); new spell_putricide_slime_puddle_aura(); new spell_putricide_unstable_experiment(); - new spell_putricide_ooze_summon(); new spell_putricide_ooze_eruption_searcher(); new spell_putricide_choking_gas_bomb(); new spell_putricide_unbound_plague(); @@ -1508,6 +1582,6 @@ void AddSC_boss_professor_putricide() new spell_putricide_mutated_transformation(); new spell_putricide_mutated_transformation_dmg(); new spell_putricide_regurgitated_ooze(); - new spell_putricide_clear_mutated_plague(); + new spell_putricide_clear_aura_effect_value(); new spell_stinky_precious_decimate(); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp index 9649b6c8ef8..a4ab13f6ada 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp @@ -441,6 +441,10 @@ class spell_rotface_ooze_flood : public SpellScriptLoader std::list<Creature*> triggers; GetHitUnit()->GetCreatureListWithEntryInGrid(triggers, GetHitUnit()->GetEntry(), 12.5f); + + if (triggers.empty()) + return; + triggers.sort(Trinity::ObjectDistanceOrderPred(GetHitUnit())); GetHitUnit()->CastSpell(triggers.back(), uint32(GetEffectValue()), false, NULL, NULL, GetOriginalCaster() ? GetOriginalCaster()->GetGUID() : 0); } @@ -494,7 +498,7 @@ class spell_rotface_mutated_infection : public SpellScriptLoader if (targets.empty()) return; - Unit* target = SelectRandomContainerElement(targets); + Unit* target = Trinity::Containers::SelectRandomContainerElement(targets); targets.clear(); targets.push_back(target); _target = target; @@ -712,13 +716,13 @@ class spell_rotface_unstable_ooze_explosion : public SpellScriptLoader void CheckTarget(SpellEffIndex effIndex) { PreventHitDefaultEffect(EFFECT_0); - if (!GetTargetDest()) + if (!GetExplTargetDest()) return; uint32 triggered_spell_id = GetSpellInfo()->Effects[effIndex].TriggerSpell; float x, y, z; - GetTargetDest()->GetPosition(x, y, z); + GetExplTargetDest()->GetPosition(x, y, z); // let Rotface handle the cast - caster dies before this executes if (InstanceScript* script = GetCaster()->GetInstanceScript()) if (Creature* rotface = script->instance->GetCreature(script->GetData64(DATA_ROTFACE))) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index 1d9c3c14897..6039ace44ab 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -61,6 +61,7 @@ enum Spells SPELL_ASPHYXIATION = 71665, SPELL_FROST_BOMB_TRIGGER = 69846, SPELL_FROST_BOMB_VISUAL = 70022, + SPELL_BIRTH_NO_VISUAL = 40031, SPELL_FROST_BOMB = 69845, SPELL_MYSTIC_BUFFET = 70128, @@ -98,6 +99,8 @@ enum Events EVENT_LAND = 12, EVENT_AIR_MOVEMENT = 21, EVENT_THIRD_PHASE_CHECK = 22, + EVENT_AIR_MOVEMENT_FAR = 23, + EVENT_LAND_GROUND = 24, // Spinestalker EVENT_BELLOWING_ROAR = 13, @@ -133,6 +136,8 @@ enum MovementPoints POINT_AIR_PHASE = 3, POINT_TAKEOFF = 4, POINT_LAND = 5, + POINT_AIR_PHASE_FAR = 6, + POINT_LAND_GROUND = 7, }; enum Shadowmourne @@ -152,6 +157,8 @@ Position const SindragosaSpawnPos = {4818.700f, 2483.710f, 287.0650f, 3.089233f Position const SindragosaFlyPos = {4475.190f, 2484.570f, 234.8510f, 3.141593f}; Position const SindragosaLandPos = {4419.190f, 2484.570f, 203.3848f, 3.141593f}; Position const SindragosaAirPos = {4475.990f, 2484.430f, 247.9340f, 3.141593f}; +Position const SindragosaAirPosFar = {4525.600f, 2485.150f, 245.0820f, 3.141593f}; +Position const SindragosaFlyInPos = {4419.190f, 2484.360f, 232.5150f, 3.141593f}; class FrostwyrmLandEvent : public BasicEvent { @@ -169,6 +176,23 @@ class FrostwyrmLandEvent : public BasicEvent Position const& _dest; }; +class FrostBombExplosion : public BasicEvent +{ + public: + FrostBombExplosion(Creature* owner, uint64 sindragosaGUID) : _owner(owner), _sindragosaGUID(sindragosaGUID) { } + + bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) + { + _owner->CastSpell((Unit*)NULL, SPELL_FROST_BOMB, true, NULL, NULL, _sindragosaGUID); + _owner->RemoveAurasDueToSpell(SPELL_FROST_BOMB_VISUAL); + return true; + } + + private: + Creature* _owner; + uint64 _sindragosaGUID; +}; + class boss_sindragosa : public CreatureScript { public: @@ -198,8 +222,8 @@ class boss_sindragosa : public CreatureScript if (instance->GetData(DATA_SINDRAGOSA_FROSTWYRMS) != 255) { - me->SetFlying(true); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetCanFly(true); + me->SetDisableGravity(true); } } @@ -228,8 +252,8 @@ class boss_sindragosa : public CreatureScript { BossAI::JustReachedHome(); instance->SetBossState(DATA_SINDRAGOSA, FAIL); - me->SetFlying(false); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetCanFly(false); + me->SetDisableGravity(false); } void KilledUnit(Unit* victim) @@ -250,6 +274,9 @@ class boss_sindragosa : public CreatureScript return; me->setActive(true); + me->SetCanFly(true); + me->SetDisableGravity(true); + me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); me->SetSpeed(MOVE_FLIGHT, 4.0f); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); float moveTime = me->GetExactDist(&SindragosaFlyPos) / (me->GetSpeed(MOVE_FLIGHT) * 0.001f); @@ -275,11 +302,12 @@ class boss_sindragosa : public CreatureScript { case POINT_FROSTWYRM_LAND: me->setActive(false); - me->SetFlying(false); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetCanFly(false); + me->SetDisableGravity(false); + me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); me->SetHomePosition(SindragosaLandPos); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetSpeed(MOVE_FLIGHT, 2.0f); + me->SetSpeed(MOVE_FLIGHT, 2.5f); // Sindragosa enters combat as soon as she lands DoZoneInCombat(); @@ -289,19 +317,31 @@ class boss_sindragosa : public CreatureScript break; case POINT_AIR_PHASE: me->CastCustomSpell(SPELL_ICE_TOMB_TARGET, SPELLVALUE_MAX_TARGETS, RAID_MODE<int32>(2, 5, 2, 6), NULL); - events.ScheduleEvent(EVENT_FROST_BOMB, 8000); + me->SetFacingTo(float(M_PI)); + events.ScheduleEvent(EVENT_AIR_MOVEMENT_FAR, 1); + events.ScheduleEvent(EVENT_FROST_BOMB, 9000); + break; + case POINT_AIR_PHASE_FAR: + me->SetFacingTo(float(M_PI)); + events.ScheduleEvent(EVENT_LAND, 30000); break; case POINT_LAND: - me->SetFlying(false); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + events.ScheduleEvent(EVENT_LAND_GROUND, 1); + break; + case POINT_LAND_GROUND: + { + me->SetCanFly(false); + me->SetDisableGravity(false); + me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); me->SetReactState(REACT_DEFENSIVE); if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) me->GetMotionMaster()->MovementExpired(); - DoStartMovement(me->getVictim()); _isInAirPhase = false; // trigger Asphyxiation - summons.DoAction(NPC_ICE_TOMB, ACTION_TRIGGER_ASPHYXIATION); + EntryCheckPredicate pred(NPC_ICE_TOMB); + summons.DoAction(ACTION_TRIGGER_ASPHYXIATION, pred); break; + } default: break; } @@ -320,6 +360,12 @@ class boss_sindragosa : public CreatureScript void JustSummoned(Creature* summon) { summons.Summon(summon); + if (summon->GetEntry() == NPC_FROST_BOMB) + { + summon->CastSpell(summon, SPELL_FROST_BOMB_VISUAL, true); + summon->CastSpell(summon, SPELL_BIRTH_NO_VISUAL, true); + summon->m_Events.AddEvent(new FrostBombExplosion(summon, me->GetGUID()), summon->m_Events.CalculateTime(5500)); + } } void SummonedCreatureDespawn(Creature* summon) @@ -332,18 +378,25 @@ class boss_sindragosa : public CreatureScript void SpellHitTarget(Unit* target, SpellInfo const* spell) { if (uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(70127, me)) + { if (spellId == spell->Id) + { if (Aura const* mysticBuffet = target->GetAura(spell->Id)) _mysticBuffetStack = std::max<uint8>(_mysticBuffetStack, mysticBuffet->GetStackAmount()); + return; + } + } + // Frost Infusion if (Player* player = target->ToPlayer()) { if (uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(_isThirdPhase ? SPELL_FROST_BREATH_P2 : SPELL_FROST_BREATH_P1, me)) { - if (player->GetQuestStatus(QUEST_FROST_INFUSION) == QUEST_STATUS_INCOMPLETE && spellId == spell->Id) + if (spellId == spell->Id) { - if (Item* shadowsEdge = player->GetWeaponForAttack(BASE_ATTACK, true)) + Item* shadowsEdge = player->GetWeaponForAttack(BASE_ATTACK, true); + if (player->GetQuestStatus(QUEST_FROST_INFUSION) == QUEST_STATUS_INCOMPLETE && shadowsEdge) { if (!player->HasAura(SPELL_FROST_IMBUED_BLADE) && shadowsEdge->GetEntry() == ITEM_SHADOW_S_EDGE) { @@ -361,15 +414,11 @@ class boss_sindragosa : public CreatureScript player->CastSpell(player, SPELL_FROST_INFUSION, true); } } + + return; } } } - - if (spell->Id == SPELL_FROST_BOMB_TRIGGER) - { - target->CastSpell(target, SPELL_FROST_BOMB, true); - target->RemoveAurasDueToSpell(SPELL_FROST_BOMB_VISUAL); - } } void UpdateAI(uint32 const diff) @@ -410,7 +459,6 @@ class boss_sindragosa : public CreatureScript break; case EVENT_ICY_GRIP: DoCast(me, SPELL_ICY_GRIP); - events.ScheduleEvent(EVENT_ICY_GRIP, urand(70000, 75000), EVENT_GROUP_LAND_PHASE); events.ScheduleEvent(EVENT_BLISTERING_COLD, 1000, EVENT_GROUP_LAND_PHASE); break; case EVENT_BLISTERING_COLD: @@ -425,22 +473,25 @@ class boss_sindragosa : public CreatureScript { _isInAirPhase = true; Talk(SAY_AIR_PHASE); - me->SetFlying(true); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetCanFly(true); + me->SetDisableGravity(true); + me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); me->SetReactState(REACT_PASSIVE); + me->AttackStop(); Position pos; pos.Relocate(me); pos.m_positionZ += 17.0f; me->GetMotionMaster()->MoveTakeoff(POINT_TAKEOFF, pos, 8.30078125f); - events.DelayEvents(45000, EVENT_GROUP_LAND_PHASE); + events.CancelEventGroup(EVENT_GROUP_LAND_PHASE); events.ScheduleEvent(EVENT_AIR_PHASE, 110000); - events.RescheduleEvent(EVENT_UNCHAINED_MAGIC, urand(55000, 60000), EVENT_GROUP_LAND_PHASE); - events.ScheduleEvent(EVENT_LAND, 45000); break; } case EVENT_AIR_MOVEMENT: me->GetMotionMaster()->MovePoint(POINT_AIR_PHASE, SindragosaAirPos); break; + case EVENT_AIR_MOVEMENT_FAR: + me->GetMotionMaster()->MovePoint(POINT_AIR_PHASE_FAR, SindragosaAirPosFar); + break; case EVENT_ICE_TOMB: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true, -SPELL_ICE_TOMB_UNTARGETABLE)) { @@ -452,30 +503,28 @@ class boss_sindragosa : public CreatureScript case EVENT_FROST_BOMB: { float destX, destY, destZ; - destX = float(rand_norm()) * 117.25f + 4339.25f; - if (destX > 4371.5f && destX < 4432.0f) - destY = float(rand_norm()) * 111.0f + 2429.0f; - else - destY = float(rand_norm()) * 31.23f + 2454.64f; + destX = float(rand_norm()) * 75.0f + 4350.0f; + destY = float(rand_norm()) * 75.0f + 2450.0f; destZ = 205.0f; // random number close to ground, get exact in next call me->UpdateGroundPositionZ(destX, destY, destZ); - Position pos; - pos.Relocate(destX, destY, destZ, 0.0f); - if (TempSummon* summ = me->SummonCreature(NPC_FROST_BOMB, pos, TEMPSUMMON_TIMED_DESPAWN, 40000)) - { - summ->CastSpell(summ, SPELL_FROST_BOMB_VISUAL, true); - DoCast(summ, SPELL_FROST_BOMB_TRIGGER); - //me->CastSpell(destX, destY, destZ, SPELL_FROST_BOMB_TRIGGER, false); - } - events.ScheduleEvent(EVENT_FROST_BOMB, urand(5000, 10000)); + me->CastSpell(destX, destY, destZ, SPELL_FROST_BOMB_TRIGGER, false); + events.ScheduleEvent(EVENT_FROST_BOMB, urand(6000, 8000)); break; } case EVENT_LAND: { events.CancelEvent(EVENT_FROST_BOMB); - me->GetMotionMaster()->MovePoint(POINT_LAND, SindragosaLandPos); + me->GetMotionMaster()->MovePoint(POINT_LAND, SindragosaFlyInPos); break; } + case EVENT_LAND_GROUND: + events.ScheduleEvent(EVENT_CLEAVE, urand(13000, 15000), EVENT_GROUP_LAND_PHASE); + events.ScheduleEvent(EVENT_TAIL_SMASH, urand(19000, 23000), EVENT_GROUP_LAND_PHASE); + events.ScheduleEvent(EVENT_FROST_BREATH, urand(10000, 15000), EVENT_GROUP_LAND_PHASE); + events.ScheduleEvent(EVENT_UNCHAINED_MAGIC, urand(12000, 17000), EVENT_GROUP_LAND_PHASE); + events.ScheduleEvent(EVENT_ICY_GRIP, urand(35000, 40000), EVENT_GROUP_LAND_PHASE); + me->GetMotionMaster()->MoveLand(POINT_LAND_GROUND, SindragosaLandPos, 0.0f); + break; case EVENT_THIRD_PHASE_CHECK: { if (!_isInAirPhase) @@ -617,8 +666,8 @@ class npc_spinestalker : public CreatureScript if (_instance->GetData(DATA_SPINESTALKER) != 255) { - me->SetFlying(true); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetCanFly(true); + me->SetDisableGravity(true); } } @@ -660,9 +709,11 @@ class npc_spinestalker : public CreatureScript return; me->setActive(false); - me->SetFlying(false); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetCanFly(false); + me->SetDisableGravity(false); + me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); me->SetHomePosition(SpinestalkerLandPos); + me->SetFacingTo(SpinestalkerLandPos.GetOrientation()); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } @@ -742,8 +793,8 @@ class npc_rimefang : public CreatureScript if (_instance->GetData(DATA_RIMEFANG) != 255) { - me->SetFlying(true); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetCanFly(true); + me->SetDisableGravity(true); } } @@ -785,9 +836,11 @@ class npc_rimefang : public CreatureScript return; me->setActive(false); - me->SetFlying(false); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetCanFly(false); + me->SetDisableGravity(false); + me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); me->SetHomePosition(RimefangLandPos); + me->SetFacingTo(RimefangLandPos.GetOrientation()); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); } @@ -819,7 +872,7 @@ class npc_rimefang : public CreatureScript _icyBlastCounter = RAID_MODE<uint8>(5, 7, 6, 8); me->SetReactState(REACT_PASSIVE); me->AttackStop(); - me->SetFlying(true); + me->SetCanFly(true); me->GetMotionMaster()->MovePoint(POINT_FROSTWYRM_FLY_IN, RimefangFlyPos); float moveTime = me->GetExactDist(&RimefangFlyPos)/(me->GetSpeed(MOVE_FLIGHT)*0.001f); _events.ScheduleEvent(EVENT_ICY_BLAST, uint64(moveTime) + urand(60000, 70000)); @@ -840,7 +893,7 @@ class npc_rimefang : public CreatureScript { me->SetReactState(REACT_DEFENSIVE); AttackStart(victim); - me->SetFlying(false); + me->SetCanFly(false); } break; default: @@ -1046,10 +1099,10 @@ class spell_sindragosa_unchained_magic : public SpellScriptLoader void FilterTargets(std::list<Unit*>& unitList) { - unitList.remove_if (UnchainedMagicTargetSelector()); - uint32 maxSize = uint32(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 5 : 2); + unitList.remove_if(UnchainedMagicTargetSelector()); + uint32 maxSize = uint32(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 6 : 2); if (unitList.size() > maxSize) - Trinity::RandomResizeList(unitList, maxSize); + Trinity::Containers::RandomResizeList(unitList, maxSize); } void Register() @@ -1198,94 +1251,77 @@ class spell_sindragosa_ice_tomb : public SpellScriptLoader } }; -class FrostBombTargetSelector -{ - public: - FrostBombTargetSelector(Unit* caster, std::list<Creature*> const& collisionList) : _caster(caster), _collisionList(collisionList) { } - - bool operator()(Unit* unit) - { - if (unit->HasAura(SPELL_ICE_TOMB_DAMAGE)) - return true; - - for (std::list<Creature*>::const_iterator itr = _collisionList.begin(); itr != _collisionList.end(); ++itr) - if ((*itr)->IsInBetween(_caster, unit)) - return true; - - return false; - } - - private: - Unit* _caster; - std::list<Creature*> const& _collisionList; -}; - -class spell_sindragosa_collision_filter : public SpellScriptLoader +class spell_sindragosa_icy_grip : public SpellScriptLoader { public: - spell_sindragosa_collision_filter() : SpellScriptLoader("spell_sindragosa_collision_filter") { } + spell_sindragosa_icy_grip() : SpellScriptLoader("spell_sindragosa_icy_grip") { } - class spell_sindragosa_collision_filter_SpellScript : public SpellScript + class spell_sindragosa_icy_grip_SpellScript : public SpellScript { - PrepareSpellScript(spell_sindragosa_collision_filter_SpellScript); + PrepareSpellScript(spell_sindragosa_icy_grip_SpellScript); bool Validate(SpellInfo const* /*spell*/) { - if (!sSpellMgr->GetSpellInfo(SPELL_ICE_TOMB_DAMAGE)) + if (!sSpellMgr->GetSpellInfo(SPELL_ICY_GRIP_JUMP)) return false; return true; } - void FilterTargets(std::list<Unit*>& unitList) + void HandleScript(SpellEffIndex effIndex) { - std::list<Creature*> tombs; - GetCreatureListWithEntryInGrid(tombs, GetCaster(), NPC_ICE_TOMB, 200.0f); - unitList.remove_if (FrostBombTargetSelector(GetCaster(), tombs)); + PreventHitDefaultEffect(effIndex); + GetHitUnit()->CastSpell(GetCaster(), SPELL_ICY_GRIP_JUMP, true); } void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_sindragosa_collision_filter_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnEffectHitTarget += SpellEffectFn(spell_sindragosa_icy_grip_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; SpellScript* GetSpellScript() const { - return new spell_sindragosa_collision_filter_SpellScript(); + return new spell_sindragosa_icy_grip_SpellScript(); } }; -class spell_sindragosa_icy_grip : public SpellScriptLoader +class MysticBuffetTargetFilter { public: - spell_sindragosa_icy_grip() : SpellScriptLoader("spell_sindragosa_icy_grip") { } + explicit MysticBuffetTargetFilter(Unit* caster) : _caster(caster) { } - class spell_sindragosa_icy_grip_SpellScript : public SpellScript + bool operator()(Unit* unit) { - PrepareSpellScript(spell_sindragosa_icy_grip_SpellScript); + return !unit->IsWithinLOSInMap(_caster); + } - bool Validate(SpellInfo const* /*spell*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_ICY_GRIP_JUMP)) - return false; - return true; - } + private: + Unit* _caster; +}; - void HandleScript(SpellEffIndex effIndex) +class spell_sindragosa_mystic_buffet : public SpellScriptLoader +{ + public: + spell_sindragosa_mystic_buffet() : SpellScriptLoader("spell_sindragosa_mystic_buffet") { } + + class spell_sindragosa_mystic_buffet_SpellScript : public SpellScript + { + PrepareSpellScript(spell_sindragosa_mystic_buffet_SpellScript); + + void FilterTargets(std::list<Unit*>& unitList) { - PreventHitDefaultEffect(effIndex); - GetHitUnit()->CastSpell(GetCaster(), SPELL_ICY_GRIP_JUMP, true); + unitList.remove_if(MysticBuffetTargetFilter(GetCaster())); } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_sindragosa_icy_grip_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnUnitTargetSelect += SpellUnitTargetFn(spell_sindragosa_mystic_buffet_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); } }; SpellScript* GetSpellScript() const { - return new spell_sindragosa_icy_grip_SpellScript(); + return new spell_sindragosa_mystic_buffet_SpellScript(); } }; @@ -1308,7 +1344,7 @@ class spell_rimefang_icy_blast : public SpellScriptLoader void HandleTriggerMissile(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); - if (Position const* pos = GetTargetDest()) + if (Position const* pos = GetExplTargetDest()) if (TempSummon* summon = GetCaster()->SummonCreature(NPC_ICY_BLAST, *pos, TEMPSUMMON_TIMED_DESPAWN, 40000)) summon->CastSpell(summon, SPELL_ICY_BLAST_AREA, true); } @@ -1370,7 +1406,7 @@ class spell_frostwarden_handler_order_whelp : public SpellScriptLoader if (unitList.empty()) return; - Unit* target = SelectRandomContainerElement(unitList); + Unit* target = Trinity::Containers::SelectRandomContainerElement(unitList); unitList.clear(); unitList.push_back(target); } @@ -1387,7 +1423,7 @@ class spell_frostwarden_handler_order_whelp : public SpellScriptLoader if (unitList.empty()) return; - SelectRandomContainerElement(unitList)->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true); + Trinity::Containers::SelectRandomContainerElement(unitList)->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true); } void Register() @@ -1513,8 +1549,8 @@ void AddSC_boss_sindragosa() new spell_sindragosa_instability(); new spell_sindragosa_frost_beacon(); new spell_sindragosa_ice_tomb(); - new spell_sindragosa_collision_filter(); new spell_sindragosa_icy_grip(); + new spell_sindragosa_mystic_buffet(); new spell_rimefang_icy_blast(); new spell_frostwarden_handler_order_whelp(); new spell_frostwarden_handler_focus_fire(); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index fbed870eb19..4dab215d1da 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -26,6 +26,7 @@ #include "CellImpl.h" #include "GridNotifiers.h" #include "GridNotifiersImpl.h" +#include "CreatureTextMgr.h" #include "icecrown_citadel.h" enum Texts @@ -499,8 +500,8 @@ class boss_the_lich_king : public CreatureScript { _JustDied(); DoCastAOE(SPELL_PLAY_MOVIE, false); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, 0x03); + me->SetDisableGravity(false); + me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); me->GetMotionMaster()->MoveFall(); } @@ -553,7 +554,8 @@ class boss_the_lich_king : public CreatureScript if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING))) tirion->AI()->EnterEvadeMode(); DoCastAOE(SPELL_KILL_FROSTMOURNE_PLAYERS); - summons.DoAction(NPC_STRANGULATE_VEHICLE, ACTION_TELEPORT_BACK); + EntryCheckPredicate pred(NPC_STRANGULATE_VEHICLE); + summons.DoAction(ACTION_TELEPORT_BACK, pred); } void KilledUnit(Unit* victim) @@ -584,8 +586,8 @@ class boss_the_lich_king : public CreatureScript SendLightOverride(0, 5000); break; case ACTION_BREAK_FROSTMOURNE: - DoCastAOE(SPELL_SUMMON_BROKEN_FROSTMOURNE); - DoCastAOE(SPELL_SUMMON_BROKEN_FROSTMOURNE_2); + me->CastSpell((Unit*)NULL, SPELL_SUMMON_BROKEN_FROSTMOURNE, TRIGGERED_IGNORE_CAST_IN_PROGRESS); + me->CastSpell((Unit*)NULL, SPELL_SUMMON_BROKEN_FROSTMOURNE_2, TRIGGERED_IGNORE_CAST_IN_PROGRESS); SetEquipmentSlots(false, EQUIP_BROKEN_FROSTMOURNE); events.ScheduleEvent(EVENT_OUTRO_TALK_6, 2500, 0, PHASE_OUTRO); break; @@ -594,12 +596,15 @@ class boss_the_lich_king : public CreatureScript events.ScheduleEvent(EVENT_OUTRO_TALK_8, 17000, 0, PHASE_OUTRO); break; case ACTION_TELEPORT_BACK: - summons.DoAction(NPC_STRANGULATE_VEHICLE, ACTION_TELEPORT_BACK); + { + EntryCheckPredicate pred(NPC_STRANGULATE_VEHICLE); + summons.DoAction(ACTION_TELEPORT_BACK, pred); if (!IsHeroic()) Talk(SAY_LK_FROSTMOURNE_ESCAPE); else DoCastAOE(SPELL_TRIGGER_VILE_SPIRIT_HEROIC); break; + } default: break; } @@ -660,7 +665,7 @@ class boss_the_lich_king : public CreatureScript summons.DespawnAll(); SendMusicToPlayers(MUSIC_FURY_OF_FROSTMOURNE); DoCastAOE(SPELL_FURY_OF_FROSTMOURNE); - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(true); events.ScheduleEvent(EVENT_OUTRO_TALK_1, 2600, 0, PHASE_OUTRO); events.ScheduleEvent(EVENT_OUTRO_EMOTE_TALK, 6600, 0, PHASE_OUTRO); events.ScheduleEvent(EVENT_OUTRO_EMOTE_TALK, 17600, 0, PHASE_OUTRO); @@ -864,7 +869,7 @@ class boss_the_lich_king : public CreatureScript case EVENT_INTRO_MOVE_1: me->SetSheath(SHEATH_STATE_MELEE); me->RemoveAurasDueToSpell(SPELL_EMOTE_SIT_NO_SHEATH); - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(true); me->GetMotionMaster()->MovePoint(POINT_LK_INTRO_1, LichKingIntro[0]); break; case EVENT_INTRO_MOVE_2: @@ -894,7 +899,7 @@ class boss_the_lich_king : public CreatureScript events.ScheduleEvent(EVENT_FINISH_INTRO, 1000, 0, PHASE_INTRO); break; case EVENT_FINISH_INTRO: - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(false); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->SetReactState(REACT_AGGRESSIVE); events.SetPhase(PHASE_ONE); @@ -1064,16 +1069,15 @@ class boss_the_lich_king : public CreatureScript Talk(SAY_LK_OUTRO_6); if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING))) tirion->SetFacingToObject(me); - me->ClearUnitState(UNIT_STATE_CASTING); - DoCastAOE(SPELL_SUMMON_BROKEN_FROSTMOURNE_3); + me->CastSpell((Unit*)NULL, SPELL_SUMMON_BROKEN_FROSTMOURNE_3, TRIGGERED_IGNORE_CAST_IN_PROGRESS); SetEquipmentSlots(false, EQUIP_UNEQUIP); break; case EVENT_OUTRO_SOUL_BARRAGE: - DoCastAOE(SPELL_SOUL_BARRAGE); + me->CastSpell((Unit*)NULL, SPELL_SOUL_BARRAGE, TRIGGERED_IGNORE_CAST_IN_PROGRESS); sCreatureTextMgr->SendSound(me, SOUND_PAIN, CHAT_MSG_MONSTER_YELL, 0, TEXT_RANGE_NORMAL, TEAM_OTHER, false); // set flight - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, 0x03); + me->SetDisableGravity(true); + me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); me->GetMotionMaster()->MovePoint(POINT_LK_OUTRO_2, OutroFlying); break; case EVENT_OUTRO_TALK_7: @@ -1222,11 +1226,11 @@ class npc_tirion_fordring_tft : public CreatureScript void sGossipSelect(Player* /*player*/, uint32 sender, uint32 action) { - if (me->GetCreatureInfo()->GossipMenuId == sender && !action) + if (me->GetCreatureTemplate()->GossipMenuId == sender && !action) { _events.SetPhase(PHASE_INTRO); me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(true); me->GetMotionMaster()->MovePoint(POINT_TIRION_INTRO, TirionIntro); } } @@ -1264,7 +1268,7 @@ class npc_tirion_fordring_tft : public CreatureScript me->HandleEmoteCommand(EMOTE_ONESHOT_POINT_NO_SHEATHE); break; case EVENT_INTRO_CHARGE: - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(false); me->GetMotionMaster()->MovePoint(POINT_TIRION_CHARGE, TirionCharge); break; case EVENT_OUTRO_TALK_1: @@ -2466,7 +2470,7 @@ class spell_the_lich_king_summon_into_air : public SpellScriptLoader void ModDestHeight(SpellEffIndex effIndex) { static Position const offset = {0.0f, 0.0f, 15.0f, 0.0f}; - WorldLocation* dest = const_cast<WorldLocation*>(GetTargetDest()); + WorldLocation* dest = const_cast<WorldLocation*>(GetExplTargetDest()); dest->RelocateOffset(offset); // spirit bombs get higher if (GetSpellInfo()->Effects[effIndex].MiscValue == NPC_SPIRIT_BOMB) @@ -2550,7 +2554,7 @@ class spell_the_lich_king_valkyr_target_search : public SpellScriptLoader if (unitList.empty()) return; - _target = SelectRandomContainerElement(unitList); + _target = Trinity::Containers::SelectRandomContainerElement(unitList); unitList.clear(); unitList.push_back(_target); GetCaster()->GetAI()->SetGUID(_target->GetGUID()); @@ -2723,7 +2727,7 @@ class spell_the_lich_king_vile_spirits_visual : public SpellScriptLoader void ModDestHeight(SpellEffIndex /*effIndex*/) { Position offset = {0.0f, 0.0f, 15.0f, 0.0f}; - const_cast<WorldLocation*>(GetTargetDest())->RelocateOffset(offset); + const_cast<WorldLocation*>(GetExplTargetDest())->RelocateOffset(offset); } void Register() @@ -2758,7 +2762,7 @@ class spell_the_lich_king_vile_spirit_move_target_search : public SpellScriptLoa if (targets.empty()) return; - _target = SelectRandomContainerElement(targets); + _target = Trinity::Containers::SelectRandomContainerElement(targets); } void HandleScript(SpellEffIndex effIndex) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp index e0993178890..c40a521c794 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp @@ -232,7 +232,7 @@ class ValithriaDespawner : public BasicEvent { case NPC_VALITHRIA_DREAMWALKER: if (InstanceScript* instance = creature->GetInstanceScript()) - instance->SendEncounterUnit(ENCOUNTER_FRAME_REMOVE, creature); + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, creature); break; case NPC_BLAZING_SKELETON: case NPC_SUPPRESSER: @@ -262,7 +262,7 @@ class ValithriaDespawner : public BasicEvent if (CreatureData const* data = creature->GetCreatureData()) creature->SetPosition(data->posX, data->posY, data->posZ, data->orientation); - creature->ForcedDespawn(); + creature->DespawnOrUnsummon(); creature->SetCorpseDelay(corpseDelay); creature->SetRespawnDelay(respawnDelay); @@ -304,7 +304,7 @@ class boss_valithria_dreamwalker : public CreatureScript me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_HEAL_PCT, true); // Glyph of Dispel Magic - not a percent heal by effect, its cast with custom basepoints me->ApplySpellImmune(0, IMMUNITY_ID, 56131, true); - _instance->SendEncounterUnit(ENCOUNTER_FRAME_REMOVE, me); + _instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); _missedPortals = 0; _under25PercentTalkDone = false; _over75PercentTalkDone = false; @@ -322,21 +322,26 @@ class boss_valithria_dreamwalker : public CreatureScript return; DoCast(me, SPELL_COPY_DAMAGE); - _instance->SendEncounterUnit(ENCOUNTER_FRAME_ADD, me); + _instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me); _events.ScheduleEvent(EVENT_INTRO_TALK, 15000); _events.ScheduleEvent(EVENT_DREAM_PORTAL, urand(45000, 48000)); if (IsHeroic()) _events.ScheduleEvent(EVENT_BERSERK, 420000); } - void HealReceived(Unit* /*healer*/, uint32& heal) + void HealReceived(Unit* healer, uint32& heal) { + if (!me->hasLootRecipient()) + me->SetLootRecipient(healer); + + me->LowerPlayerDamageReq(heal); + // encounter complete if (me->HealthAbovePctHealed(100, heal) && !_done) { _done = true; Talk(SAY_VALITHRIA_SUCCESS); - _instance->SendEncounterUnit(ENCOUNTER_FRAME_REMOVE, me); + _instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); me->RemoveAurasDueToSpell(SPELL_CORRUPTION_VALITHRIA); DoCast(me, SPELL_ACHIEVEMENT_CHECK); DoCastAOE(SPELL_DREAMWALKERS_RAGE); @@ -371,7 +376,7 @@ class boss_valithria_dreamwalker : public CreatureScript { _justDied = true; Talk(SAY_VALITHRIA_DEATH); - _instance->SendEncounterUnit(ENCOUNTER_FRAME_REMOVE, me); + _instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); if (Creature* trigger = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_TRIGGER))) trigger->AI()->DoAction(ACTION_DEATH); } @@ -1082,7 +1087,7 @@ class npc_dream_cloud : public CreatureScript me->GetMotionMaster()->MoveIdle(); // must use originalCaster the same for all clouds to allow stacking me->CastSpell(me, EMERALD_VIGOR, false, NULL, NULL, _instance->GetData64(DATA_VALITHRIA_DREAMWALKER)); - me->ForcedDespawn(100); + me->DespawnOrUnsummon(100); break; default: break; @@ -1191,7 +1196,7 @@ class spell_dreamwalker_summoner : public SpellScriptLoader if (targets.empty()) return; - Unit* target = SelectRandomContainerElement(targets); + Unit* target = Trinity::Containers::SelectRandomContainerElement(targets); targets.clear(); targets.push_back(target); } @@ -1237,7 +1242,7 @@ class spell_dreamwalker_summon_suppresser : public SpellScriptLoader std::list<Creature*> summoners; GetCreatureListWithEntryInGrid(summoners, caster, NPC_WORLD_TRIGGER, 100.0f); summoners.remove_if (Trinity::UnitAuraCheck(true, SPELL_RECENTLY_SPAWNED)); - Trinity::RandomResizeList(summoners, 2); + Trinity::Containers::RandomResizeList(summoners, 2); if (summoners.empty()) return; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index 60e85165cd5..fab9a5f0740 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -346,7 +346,7 @@ class FrostwingGauntletRespawner if (CreatureData const* data = creature->GetCreatureData()) creature->SetPosition(data->posX, data->posY, data->posZ, data->orientation); - creature->ForcedDespawn(); + creature->DespawnOrUnsummon(); creature->SetCorpseDelay(corpseDelay); creature->SetRespawnDelay(respawnDelay); @@ -796,7 +796,8 @@ class boss_sister_svalna : public CreatureScript { _JustReachedHome(); me->SetReactState(REACT_PASSIVE); - me->SetFlying(false); + me->SetDisableGravity(false); + me->SetHover(false); } void DoAction(int32 const action) @@ -838,13 +839,14 @@ class boss_sister_svalna : public CreatureScript void MovementInform(uint32 type, uint32 id) { - if (type != POINT_MOTION_TYPE || id != POINT_LAND) + if (type != EFFECT_MOTION_TYPE || id != POINT_LAND) return; _isEventInProgress = false; me->setActive(false); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); - me->SetFlying(false); + me->SetDisableGravity(false); + me->SetHover(false); } void SpellHitTarget(Unit* target, SpellInfo const* spell) @@ -1204,7 +1206,7 @@ class npc_crok_scourgebane : public CreatureScript struct npc_argent_captainAI : public ScriptedAI { public: - npc_argent_captainAI(Creature* creature) : ScriptedAI(creature), Instance(creature->GetInstanceScript()), _firstDeath(true) + npc_argent_captainAI(Creature* creature) : ScriptedAI(creature), instance(creature->GetInstanceScript()), _firstDeath(true) { FollowAngle = PET_FOLLOW_ANGLE; FollowDist = PET_FOLLOW_DIST; @@ -1232,7 +1234,7 @@ struct npc_argent_captainAI : public ScriptedAI { if (action == ACTION_START_GAUNTLET) { - if (Creature* crok = ObjectAccessor::GetCreature(*me, Instance->GetData64(DATA_CROK_SCOURGEBANE))) + if (Creature* crok = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_CROK_SCOURGEBANE))) { me->SetReactState(REACT_DEFENSIVE); FollowAngle = me->GetAngle(crok) + me->GetOrientation(); @@ -1276,7 +1278,7 @@ struct npc_argent_captainAI : public ScriptedAI if (!me->GetVehicle()) { me->GetMotionMaster()->Clear(false); - if (Creature* crok = ObjectAccessor::GetCreature(*me, Instance->GetData64(DATA_CROK_SCOURGEBANE))) + if (Creature* crok = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_CROK_SCOURGEBANE))) me->GetMotionMaster()->MoveFollow(crok, FollowDist, FollowAngle, MOTION_SLOT_IDLE); } @@ -1288,7 +1290,7 @@ struct npc_argent_captainAI : public ScriptedAI if (spell->Id == SPELL_REVIVE_CHAMPION && !IsUndead) { IsUndead = true; - me->setDeathState(JUST_ALIVED); + me->setDeathState(JUST_RESPAWNED); uint32 newEntry = 0; switch (me->GetEntry()) { @@ -1309,14 +1311,14 @@ struct npc_argent_captainAI : public ScriptedAI } Talk(SAY_CAPTAIN_RESURRECTED); - me->UpdateEntry(newEntry, Instance->GetData(DATA_TEAM_IN_INSTANCE), me->GetCreatureData()); + me->UpdateEntry(newEntry, instance->GetData(DATA_TEAM_IN_INSTANCE), me->GetCreatureData()); DoCast(me, SPELL_UNDEATH, true); } } protected: EventMap Events; - InstanceScript* Instance; + InstanceScript* instance; float FollowAngle; float FollowDist; bool IsUndead; @@ -1368,7 +1370,7 @@ class npc_captain_arnath : public CreatureScript case EVENT_ARNATH_PW_SHIELD: { std::list<Creature*> targets = DoFindFriendlyMissingBuff(40.0f, SPELL_POWER_WORD_SHIELD); - DoCast(SelectRandomContainerElement(targets), SPELL_POWER_WORD_SHIELD); + DoCast(Trinity::Containers::SelectRandomContainerElement(targets), SPELL_POWER_WORD_SHIELD); Events.ScheduleEvent(EVENT_ARNATH_PW_SHIELD, urand(15000, 20000)); break; } @@ -1822,7 +1824,7 @@ class spell_frost_giant_death_plague : public SpellScriptLoader unitList.remove_if (DeathPlagueTargetSelector(GetCaster())); if (!unitList.empty()) { - Unit* target = SelectRandomContainerElement(unitList); + Unit* target = Trinity::Containers::SelectRandomContainerElement(unitList); unitList.clear(); unitList.push_back(target); } @@ -1909,7 +1911,7 @@ class spell_svalna_revive_champion : public SpellScriptLoader void RemoveAliveTarget(std::list<Unit*>& unitList) { unitList.remove_if(AliveCheck()); - Trinity::RandomResizeList(unitList, 2); + Trinity::Containers::RandomResizeList(unitList, 2); } void Land(SpellEffIndex /*effIndex*/) @@ -1921,10 +1923,10 @@ class spell_svalna_revive_champion : public SpellScriptLoader Position pos; caster->GetPosition(&pos); caster->GetNearPosition(pos, 5.0f, 0.0f); - pos.m_positionZ = caster->GetBaseMap()->GetHeight(caster->GetPhaseMask(), pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), true, 20.0f); - pos.m_positionZ += 0.05f; + //pos.m_positionZ = caster->GetBaseMap()->GetHeight(caster->GetPhaseMask(), pos.GetPositionX(), pos.GetPositionY(), caster->GetPositionZ(), true, 50.0f); + //pos.m_positionZ += 0.05f; caster->SetHomePosition(pos); - caster->GetMotionMaster()->MovePoint(POINT_LAND, pos); + caster->GetMotionMaster()->MoveLand(POINT_LAND, pos, caster->GetSpeed(MOVE_FLIGHT)); } void Register() diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h index 085aea139a3..224777c3db7 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h @@ -331,6 +331,10 @@ enum GameObjectsIds GO_DOODAD_ICECROWN_ROOSTPORTCULLIS_02 = 201381, GO_DOODAD_ICECROWN_ROOSTPORTCULLIS_03 = 201382, GO_DOODAD_ICECROWN_ROOSTPORTCULLIS_04 = 201383, + GO_CACHE_OF_THE_DREAMWALKER_10N = 201959, + GO_CACHE_OF_THE_DREAMWALKER_25N = 202339, + GO_CACHE_OF_THE_DREAMWALKER_10H = 202338, + GO_CACHE_OF_THE_DREAMWALKER_25H = 202340, // Sindragosa GO_SINDRAGOSA_ENTRANCE_DOOR = 201373, diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp index 98f5c04ba42..cb83efc748f 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp @@ -452,6 +452,14 @@ class instance_icecrown_citadel : public InstanceMapScript case GO_DRINK_ME: PutricideTableGUID = go->GetGUID(); break; + case GO_CACHE_OF_THE_DREAMWALKER_10N: + case GO_CACHE_OF_THE_DREAMWALKER_25N: + case GO_CACHE_OF_THE_DREAMWALKER_10H: + case GO_CACHE_OF_THE_DREAMWALKER_25H: + if (Creature* valithria = instance->GetCreature(ValithriaDreamwalkerGUID)) + go->SetLootRecipient(valithria->GetLootRecipient()); + go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED | GO_FLAG_NOT_SELECTABLE | GO_FLAG_NODESPAWN); + break; case GO_ARTHAS_PLATFORM: // this enables movement at The Frozen Throne, when printed this value is 0.000000f // however, when represented as integer client will accept only this value @@ -638,7 +646,13 @@ class instance_icecrown_citadel : public InstanceMapScript switch (state) { case DONE: - DoRespawnGameObject(DeathbringersCacheGUID, 7*DAY); + if (GameObject* loot = instance->GetGameObject(DeathbringersCacheGUID)) + { + if (Creature* deathbringer = instance->GetCreature(DeathbringerSaurfangGUID)) + loot->SetLootRecipient(deathbringer->GetLootRecipient()); + loot->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED | GO_FLAG_NOT_SELECTABLE | GO_FLAG_NODESPAWN); + } + // no break case NOT_STARTED: if (GameObject* teleporter = instance->GetGameObject(SaurfangTeleportGUID)) { diff --git a/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp index 942cfd7c5a8..1671eab0b32 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp @@ -63,7 +63,7 @@ public: struct boss_anubrekhanAI : public BossAI { - boss_anubrekhanAI(Creature* c) : BossAI(c, BOSS_ANUBREKHAN) {} + boss_anubrekhanAI(Creature* creature) : BossAI(creature, BOSS_ANUBREKHAN) {} bool hasTaunted; @@ -99,7 +99,7 @@ public: DoScriptText(SAY_SLAY, me); } - void JustDied(Unit*) + void JustDied(Unit* /*killer*/) { _JustDied(); diff --git a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp index 47151ef6d80..17ed6a79c76 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp @@ -89,7 +89,7 @@ public: struct boss_four_horsemenAI : public BossAI { - boss_four_horsemenAI(Creature* c) : BossAI(c, BOSS_HORSEMEN) + boss_four_horsemenAI(Creature* creature) : BossAI(creature, BOSS_HORSEMEN) { id = Horsemen(0); for (uint8 i = 0; i < 4; ++i) @@ -113,7 +113,7 @@ public: void Reset() { if (!encounterActionReset) - DoEncounterAction(NULL, false, true, false); + DoEncounteraction(NULL, false, true, false); if (instance) instance->SetData(DATA_HORSEMEN0 + id, NOT_STARTED); @@ -131,15 +131,15 @@ public: _Reset(); } - bool DoEncounterAction(Unit* who, bool attack, bool reset, bool checkAllDead) + bool DoEncounteraction(Unit* who, bool attack, bool reset, bool checkAllDead) { if (!instance) return false; - Creature* Thane = CAST_CRE(Unit::GetUnit(*me, instance->GetData64(DATA_THANE))); - Creature* Lady = CAST_CRE(Unit::GetUnit(*me, instance->GetData64(DATA_LADY))); - Creature* Baron = CAST_CRE(Unit::GetUnit(*me, instance->GetData64(DATA_BARON))); - Creature* Sir = CAST_CRE(Unit::GetUnit(*me, instance->GetData64(DATA_SIR))); + Creature* Thane = Unit::GetCreature(*me, instance->GetData64(DATA_THANE)); + Creature* Lady = Unit::GetCreature(*me, instance->GetData64(DATA_LADY)); + Creature* Baron = Unit::GetCreature(*me, instance->GetData64(DATA_BARON)); + Creature* Sir = Unit::GetCreature(*me, instance->GetData64(DATA_SIR)); if (Thane && Lady && Baron && Sir) { @@ -194,7 +194,7 @@ public: { movementStarted = true; me->SetReactState(REACT_PASSIVE); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(false); me->SetSpeed(MOVE_RUN, me->GetSpeedRate(MOVE_RUN), true); switch (id) @@ -272,7 +272,7 @@ public: BeginFourHorsemenMovement(); if (!encounterActionAttack) - DoEncounterAction(who, true, false, false); + DoEncounteraction(who, true, false, false); } else if (movementCompleted && movementStarted) { @@ -302,7 +302,7 @@ public: if (instance) instance->SetData(DATA_HORSEMEN0 + id, DONE); - if (instance && DoEncounterAction(NULL, false, false, true)) + if (instance && DoEncounteraction(NULL, false, false, true)) { instance->SetBossState(BOSS_HORSEMEN, DONE); instance->SaveToDB(); diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp index 0ef4e3d74c2..47dfaa7f772 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp @@ -57,7 +57,7 @@ public: struct boss_gluthAI : public BossAI { - boss_gluthAI(Creature* c) : BossAI(c, BOSS_GLUTH) + boss_gluthAI(Creature* creature) : BossAI(creature, BOSS_GLUTH) { // Do not let Gluth be affected by zombies' debuff me->ApplySpellImmune(0, IMMUNITY_ID, SPELL_INFECTED_WOUND, true); diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp index 8c6afba18fd..8d23de5427c 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp @@ -234,7 +234,7 @@ class boss_gothik : public CreatureScript DoScriptText(SAY_KILL, me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { LiveTriggerGUID.clear(); DeadTriggerGUID.clear(); @@ -424,7 +424,8 @@ class boss_gothik : public CreatureScript { if (instance) instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE); - summons.DoAction(0, 0); + DummyEntryCheckPredicate pred; + summons.DoAction(0, pred); //! Magic numbers fail summons.DoZoneInCombat(); mergedSides = true; } @@ -447,7 +448,8 @@ class boss_gothik : public CreatureScript DoScriptText(SAY_TELEPORT, me); DoTeleportTo(PosGroundLiveSide); me->SetReactState(REACT_AGGRESSIVE); - summons.DoAction(0, 0); + DummyEntryCheckPredicate pred; + summons.DoAction(0, pred); //! Magic numbers fail summons.DoZoneInCombat(); events.ScheduleEvent(EVENT_BOLT, 1000); events.ScheduleEvent(EVENT_HARVEST, urand(3000, 15000)); diff --git a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp index e353a71b0b9..039b9b1e007 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp @@ -45,7 +45,7 @@ public: struct boss_grobbulusAI : public BossAI { - boss_grobbulusAI(Creature* c) : BossAI(c, BOSS_GROBBULUS) + boss_grobbulusAI(Creature* creature) : BossAI(creature, BOSS_GROBBULUS) { me->ApplySpellImmune(0, IMMUNITY_ID, SPELL_POISON_CLOUD_ADD, true); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp index 7a2d3ec55ab..d84cfb8949e 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp @@ -57,7 +57,7 @@ public: struct boss_heiganAI : public BossAI { - boss_heiganAI(Creature* c) : BossAI(c, BOSS_HEIGAN) {} + boss_heiganAI(Creature* creature) : BossAI(creature, BOSS_HEIGAN) {} uint32 eruptSection; bool eruptDirection; @@ -86,7 +86,7 @@ public: return 0; } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { _JustDied(); DoScriptText(SAY_DEATH, me); diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp index 161c9160293..0a4fdec7222 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp @@ -266,7 +266,7 @@ public: struct boss_kelthuzadAI : public BossAI { - boss_kelthuzadAI(Creature* c) : BossAI(c, BOSS_KELTHUZAD), spawns(c) + boss_kelthuzadAI(Creature* creature) : BossAI(creature, BOSS_KELTHUZAD), spawns(creature) { uiFaction = me->getFaction(); } @@ -299,7 +299,7 @@ public: for (itr = chained.begin(); itr != chained.end(); ++itr) { if (Player* charmed = Unit::GetPlayer(*me, (*itr).first)) - charmed->SetFloatValue(OBJECT_FIELD_SCALE_X, (*itr).second); + charmed->SetObjectScale((*itr).second); } chained.clear(); @@ -338,7 +338,7 @@ public: DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { _JustDied(); DoScriptText(SAY_DEATH, me); @@ -347,7 +347,7 @@ public: for (itr = chained.begin(); itr != chained.end(); ++itr) { if (Player* player = Unit::GetPlayer(*me, (*itr).first)) - player->SetFloatValue(OBJECT_FIELD_SCALE_X, (*itr).second); + player->SetObjectScale((*itr).second); } chained.clear(); } @@ -457,7 +457,7 @@ public: { if (HealthBelowPct(45)) { - Phase = 3 ; + Phase = 3; DoScriptText(SAY_REQUEST_AID, me); //here Lich King should respond to KelThuzad but I don't know which Creature to make talk //so for now just make Kelthuzad says it. @@ -512,7 +512,7 @@ public: DoCast(target, SPELL_CHAINS_OF_KELTHUZAD); float scale = target->GetFloatValue(OBJECT_FIELD_SCALE_X); chained.insert(std::make_pair(target->GetGUID(), scale)); - target->SetFloatValue(OBJECT_FIELD_SCALE_X, scale * 2); + target->SetObjectScale(scale * 2); events.ScheduleEvent(EVENT_CHAINED_SPELL, 2000); //core has 2000ms to set unit flag charm } } @@ -530,7 +530,7 @@ public: { if (!player->isCharmed()) { - player->SetFloatValue(OBJECT_FIELD_SCALE_X, (*itr).second); + player->SetObjectScale((*itr).second); std::map<uint64, float>::iterator next = itr; ++next; chained.erase(itr); @@ -667,7 +667,7 @@ public: if (!instance || instance->IsEncounterInProgress() || instance->GetBossState(BOSS_KELTHUZAD) == DONE) return false; - Creature* pKelthuzad = CAST_CRE(Unit::GetUnit(*player, instance->GetData64(DATA_KELTHUZAD))); + Creature* pKelthuzad = Unit::GetCreature(*player, instance->GetData64(DATA_KELTHUZAD)); if (!pKelthuzad) return false; @@ -714,7 +714,6 @@ public: return true; } - }; class npc_kelthuzad_abomination : public CreatureScript @@ -726,16 +725,13 @@ class npc_kelthuzad_abomination : public CreatureScript { npc_kelthuzad_abominationAI(Creature* creature) : ScriptedAI(creature) { - instance = me->GetInstanceScript(); + _instance = creature->GetInstanceScript(); } - InstanceScript* instance; - EventMap events; - void Reset() { - events.Reset(); - events.ScheduleEvent(EVENT_MORTAL_WOUND, urand(2000, 5000)); + _events.Reset(); + _events.ScheduleEvent(EVENT_MORTAL_WOUND, urand(2000, 5000)); DoCast(me, SPELL_FRENZY, true); } @@ -744,15 +740,15 @@ class npc_kelthuzad_abomination : public CreatureScript if (!UpdateVictim()) return; - events.Update(diff); + _events.Update(diff); - while (uint32 eventId = events.ExecuteEvent()) + while (uint32 eventId = _events.ExecuteEvent()) { switch (eventId) { case EVENT_MORTAL_WOUND: DoCastVictim(SPELL_MORTAL_WOUND, true); - events.ScheduleEvent(EVENT_MORTAL_WOUND, urand(10000, 15000)); + _events.ScheduleEvent(EVENT_MORTAL_WOUND, urand(10000, 15000)); break; default: break; @@ -760,11 +756,15 @@ class npc_kelthuzad_abomination : public CreatureScript } } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { - if (instance) - instance->SetData(DATA_ABOMINATION_KILLED, instance->GetData(DATA_ABOMINATION_KILLED) + 1); + if (_instance) + _instance->SetData(DATA_ABOMINATION_KILLED, _instance->GetData(DATA_ABOMINATION_KILLED) + 1); } + + private: + InstanceScript* _instance; + EventMap _events; }; CreatureAI* GetAI(Creature* creature) const @@ -776,9 +776,7 @@ class npc_kelthuzad_abomination : public CreatureScript class achievement_just_cant_get_enough : public AchievementCriteriaScript { public: - achievement_just_cant_get_enough() : AchievementCriteriaScript("achievement_just_cant_get_enough") - { - } + achievement_just_cant_get_enough() : AchievementCriteriaScript("achievement_just_cant_get_enough") { } bool OnCheck(Player* /*player*/, Unit* target) { diff --git a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp index 0163101b8ed..3c258f08030 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp @@ -68,7 +68,7 @@ public: struct boss_maexxnaAI : public BossAI { - boss_maexxnaAI(Creature* c) : BossAI(c, BOSS_MAEXXNA) {} + boss_maexxnaAI(Creature* creature) : BossAI(creature, BOSS_MAEXXNA) {} bool enraged; @@ -159,7 +159,7 @@ public: struct mob_webwrapAI : public NullCreatureAI { - mob_webwrapAI(Creature* c) : NullCreatureAI(c), victimGUID(0) {} + mob_webwrapAI(Creature* creature) : NullCreatureAI(creature), victimGUID(0) {} uint64 victimGUID; diff --git a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp index 7143b940916..75be596fd77 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp @@ -75,7 +75,7 @@ public: struct boss_nothAI : public BossAI { - boss_nothAI(Creature* c) : BossAI(c, BOSS_NOTH) {} + boss_nothAI(Creature* creature) : BossAI(creature, BOSS_NOTH) {} uint32 waveCount, balconyCount; @@ -124,7 +124,7 @@ public: summon->AI()->DoZoneInCombat(); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { _JustDied(); DoScriptText(SAY_DEATH, me); diff --git a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp index a9ed499c5e5..b826a530719 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp @@ -62,7 +62,7 @@ public: struct boss_patchwerkAI : public BossAI { - boss_patchwerkAI(Creature* c) : BossAI(c, BOSS_PATCHWERK) {} + boss_patchwerkAI(Creature* creature) : BossAI(creature, BOSS_PATCHWERK) {} bool Enraged; @@ -80,7 +80,7 @@ public: DoScriptText(SAY_SLAY, me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { _JustDied(); DoScriptText(SAY_DEATH, me); diff --git a/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp b/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp index b27ab3730da..e06aa6b03c5 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp @@ -64,7 +64,7 @@ public: struct boss_razuviousAI : public BossAI { - boss_razuviousAI(Creature* c) : BossAI(c, BOSS_RAZUVIOUS) {} + boss_razuviousAI(Creature* creature) : BossAI(creature, BOSS_RAZUVIOUS) {} void KilledUnit(Unit* /*victim*/) { diff --git a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp index 16b1e7ac996..37fb5f3f4a9 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp @@ -81,7 +81,7 @@ public: struct boss_sapphironAI : public BossAI { - boss_sapphironAI(Creature* c) : BossAI(c, BOSS_SAPPHIRON) + boss_sapphironAI(Creature* creature) : BossAI(creature, BOSS_SAPPHIRON) , phase(PHASE_NULL) { map = me->GetMap(); @@ -145,7 +145,7 @@ public: } } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { _JustDied(); me->CastSpell(me, SPELL_DIES, true); @@ -153,7 +153,7 @@ public: CheckPlayersFrostResist(); if (CanTheHundredClub) { - AchievementEntry const* AchievTheHundredClub = GetAchievementStore()->LookupEntry(ACHIEVEMENT_THE_HUNDRED_CLUB); + AchievementEntry const* AchievTheHundredClub = sAchievementStore.LookupEntry(ACHIEVEMENT_THE_HUNDRED_CLUB); if (AchievTheHundredClub) { if (map && map->IsDungeon()) @@ -296,7 +296,7 @@ public: { case EVENT_LIFTOFF: me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetDisableGravity(true); me->SendMovementFlagUpdate(); events.ScheduleEvent(EVENT_ICEBOLT, 1500); iceboltCount = RAID_MODE(2, 3); @@ -340,7 +340,7 @@ public: return; case EVENT_LAND: me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetDisableGravity(false); me->SendMovementFlagUpdate(); events.ScheduleEvent(EVENT_GROUND, 1500); return; diff --git a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp index e64099da3ac..ccc8e9a5663 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp @@ -120,7 +120,7 @@ public: struct boss_thaddiusAI : public BossAI { - boss_thaddiusAI(Creature* c) : BossAI(c, BOSS_THADDIUS) + boss_thaddiusAI(Creature* creature) : BossAI(creature, BOSS_THADDIUS) { // init is a bit tricky because thaddius shall track the life of both adds, but not if there was a wipe // and, in particular, if there was a crash after both adds were killed (should not respawn) @@ -158,7 +158,7 @@ public: DoScriptText(SAY_SLAY, me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { _JustDied(); DoScriptText(SAY_DEATH, me); @@ -295,9 +295,9 @@ public: struct mob_stalaggAI : public ScriptedAI { - mob_stalaggAI(Creature* c) : ScriptedAI(c) + mob_stalaggAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -381,9 +381,9 @@ public: struct mob_feugenAI : public ScriptedAI { - mob_feugenAI(Creature* c) : ScriptedAI(c) + mob_feugenAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; diff --git a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp index c05d9a21850..50eb52cc4c2 100644 --- a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp +++ b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp @@ -465,7 +465,6 @@ public: playerDied = buff2; } }; - }; void AddSC_instance_naxxramas() diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index 437d9980af3..ac5520b025a 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -240,8 +240,8 @@ public: _cannotMove = true; - me->SetFlying(true); - + me->SetCanFly(true); + if (instance) instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); } @@ -271,7 +271,7 @@ public: { me->SetHomePosition(_homePosition); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetDisableGravity(true); BossAI::EnterEvadeMode(); @@ -354,15 +354,15 @@ public: { _EnterCombat(); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->SetFlying(false); + me->SetDisableGravity(false); + me->SetCanFly(false); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Talk(SAY_AGGRO_P_ONE); DoCast(SPELL_BERSEKER); // periodic aura, first tick in 10 minutes - + if (instance) instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); } @@ -412,8 +412,8 @@ public: void PrepareForVortex() { - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->SetFlying(true); + me->SetDisableGravity(true); + me->SetCanFly(true); me->GetMotionMaster()->MovementExpired(); me->GetMotionMaster()->MovePoint(MOVE_VORTEX, MalygosPositions[1].GetPositionX(), MalygosPositions[1].GetPositionY(), MalygosPositions[1].GetPositionZ()); @@ -461,8 +461,8 @@ public: { SetPhase(PHASE_TWO, true); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->SetFlying(true); + me->SetDisableGravity(true); + me->SetCanFly(true); me->GetMotionMaster()->MoveIdle(); me->GetMotionMaster()->MovePoint(MOVE_DEEP_BREATH_ROTATION, MalygosPhaseTwoWaypoints[0]); @@ -704,8 +704,8 @@ class spell_malygos_vortex_visual : public SpellScriptLoader // Anyway even with this issue, the boss does not enter in evade mode - this prevents iterate an empty list in the next vortex execution. malygos->SetInCombatWithZone(); - malygos->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - malygos->SetFlying(false); + malygos->SetDisableGravity(false); + malygos->SetCanFly(false); malygos->GetMotionMaster()->MoveChase(caster->getVictim()); malygos->RemoveAura(SPELL_VORTEX_1); @@ -963,8 +963,9 @@ public: // we dont do melee damage! } - void WaypointReached(uint32 /*i*/) + void WaypointReached(uint32 /*waypointId*/) { + } private: diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp index 5e87ffb8973..7552ba4f389 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp @@ -101,7 +101,7 @@ class boss_anomalus : public CreatureScript instance->SetData(DATA_ANOMALUS_EVENT, IN_PROGRESS); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp index 44c6c25fa3e..5c1dee1d4e4 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp @@ -61,9 +61,9 @@ public: struct boss_keristraszaAI : public ScriptedAI { - boss_keristraszaAI(Creature* c) : ScriptedAI(c) + boss_keristraszaAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -208,16 +208,16 @@ class containment_sphere : public GameObjectScript public: containment_sphere() : GameObjectScript("containment_sphere") { } - bool OnGossipHello(Player* /*player*/, GameObject* pGO) + bool OnGossipHello(Player* /*player*/, GameObject* go) { - InstanceScript* instance = pGO->GetInstanceScript(); + InstanceScript* instance = go->GetInstanceScript(); - Creature* pKeristrasza = Unit::GetCreature(*pGO, instance ? instance->GetData64(DATA_KERISTRASZA) : 0); + Creature* pKeristrasza = Unit::GetCreature(*go, instance ? instance->GetData64(DATA_KERISTRASZA) : 0); if (pKeristrasza && pKeristrasza->isAlive()) { // maybe these are hacks :( - pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - pGO->SetGoState(GO_STATE_ACTIVE); + go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + go->SetGoState(GO_STATE_ACTIVE); CAST_AI(boss_keristrasza::boss_keristraszaAI, pKeristrasza->AI())->CheckContainmentSpheres(true); } diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp index 03f467ce180..ad188738c12 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp @@ -67,9 +67,9 @@ public: struct boss_magus_telestraAI : public ScriptedAI { - boss_magus_telestraAI(Creature* c) : ScriptedAI(c) + boss_magus_telestraAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp index 4453ec94494..c70db7d4ebc 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp @@ -61,9 +61,9 @@ public: struct boss_ormorokAI : public ScriptedAI { - boss_ormorokAI(Creature* c) : ScriptedAI(c) + boss_ormorokAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -195,7 +195,7 @@ public: std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); for (; i != me->getThreatManager().getThreatList().end(); ++i) { - Unit* temp = Unit::GetUnit((*me), (*i)->getUnitGuid()); + Unit* temp = Unit::GetUnit(*me, (*i)->getUnitGuid()); if (temp && temp->GetTypeId() == TYPEID_PLAYER && temp->getClass() == Healer) { target = temp; @@ -234,7 +234,7 @@ public: struct mob_crystal_spikeAI : public Scripted_NoMovementAI { - mob_crystal_spikeAI(Creature* c) : Scripted_NoMovementAI(c) + mob_crystal_spikeAI(Creature* creature) : Scripted_NoMovementAI(creature) { } @@ -277,7 +277,7 @@ public: struct mob_crystalline_tanglerAI : public ScriptedAI { - mob_crystalline_tanglerAI(Creature* c) : ScriptedAI(c) {} + mob_crystalline_tanglerAI(Creature* creature) : ScriptedAI(creature) {} uint32 uiRootsTimer; diff --git a/src/server/scripts/Northrend/Nexus/Nexus/commander_kolurg.cpp b/src/server/scripts/Northrend/Nexus/Nexus/commander_kolurg.cpp index 6d07ac960b5..5ea3eb32c1d 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/commander_kolurg.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/commander_kolurg.cpp @@ -49,7 +49,7 @@ public: struct boss_commander_kolurgAI : public ScriptedAI { - boss_commander_kolurgAI(Creature* c) : ScriptedAI(c) {} + boss_commander_kolurgAI(Creature* creature) : ScriptedAI(creature) {} void Reset() {} void EnterCombat(Unit* /*who*/) {} diff --git a/src/server/scripts/Northrend/Nexus/Nexus/commander_stoutbeard.cpp b/src/server/scripts/Northrend/Nexus/Nexus/commander_stoutbeard.cpp index 71a153c802a..da4b49740c1 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/commander_stoutbeard.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/commander_stoutbeard.cpp @@ -49,7 +49,7 @@ public: struct boss_commander_stoutbeardAI : public ScriptedAI { - boss_commander_stoutbeardAI(Creature* c) : ScriptedAI(c) {} + boss_commander_stoutbeardAI(Creature* creature) : ScriptedAI(creature) {} void Reset() {} void EnterCombat(Unit* /*who*/) diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp index 9671d59bcec..b96d7c4aa84 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp @@ -203,7 +203,7 @@ public: if (!instance || instance->GetData(DATA_UROM_PLATAFORM) > 2) return; - for (uint8 i = 0; i < 4 ; i++) + for (uint8 i = 0; i < 4; i++) { SetPosition(i); me->SummonCreature(Group[group[instance->GetData(DATA_UROM_PLATAFORM)]].entry[i], x, y, me->GetPositionZ(), me->GetOrientation()); @@ -316,7 +316,9 @@ public: LeaveCombat(); break; case SPELL_TELEPORT: - me->AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY); // with out it the npc will fall down while is casting + //! Unconfirmed, previous below + me->SetDisableGravity(true); + //me->AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY); // with out it the npc will fall down while is casting canCast = true; break; default: diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp index 8852338c362..19a84fdae84 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp @@ -169,7 +169,9 @@ class npc_azure_ring_captain : public CreatureScript { targetGUID = 0; - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING | MOVEMENTFLAG_FLYING); + me->SetWalk(true); + //! HACK: Creature's can't have MOVEMENTFLAG_FLYING + me->AddUnitMovementFlag(MOVEMENTFLAG_FLYING); me->SetReactState(REACT_AGGRESSIVE); } @@ -214,7 +216,7 @@ class npc_azure_ring_captain : public CreatureScript if (Unit* victim = varos->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0)) { me->SetReactState(REACT_PASSIVE); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(false); me->GetMotionMaster()->MovePoint(ACTION_CALL_DRAGON_EVENT, victim->GetPositionX(), victim->GetPositionY(), victim->GetPositionZ() + 20.0f); targetGUID = victim->GetGUID(); } @@ -306,7 +308,7 @@ class spell_varos_energize_core_area_enemy : public SpellScriptLoader float orientation = CAST_AI(boss_varos::boss_varosAI, varos->AI())->GetCoreEnergizeOrientation(); - for (std::list<Unit*>::iterator itr = targetList.begin() ; itr != targetList.end();) + for (std::list<Unit*>::iterator itr = targetList.begin(); itr != targetList.end();) { Position pos; (*itr)->GetPosition(&pos); @@ -353,7 +355,7 @@ class spell_varos_energize_core_area_entry : public SpellScriptLoader float orientation = CAST_AI(boss_varos::boss_varosAI, varos->AI())->GetCoreEnergizeOrientation(); - for (std::list<Unit*>::iterator itr = targetList.begin() ; itr != targetList.end();) + for (std::list<Unit*>::iterator itr = targetList.begin(); itr != targetList.end();) { Position pos; (*itr)->GetPosition(&pos); diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp index 11433bfde37..23f55a3033b 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp @@ -61,13 +61,13 @@ class npc_oculus_drake : public CreatureScript public: npc_oculus_drake() : CreatureScript("npc_oculus_drake") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); switch (creature->GetEntry()) { case NPC_VERDISA: //Verdisa - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF + 1: if (!HAS_ESSENCE(player)) @@ -97,7 +97,7 @@ public: } break; case NPC_BELGARISTRASZ: //Belgaristrasz - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF + 1: if (!HAS_ESSENCE(player)) @@ -127,7 +127,7 @@ public: } break; case NPC_ETERNOS: //Eternos - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF + 1: if (!HAS_ESSENCE(player)) diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp index c6f72890d1f..9f39cecbb23 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp @@ -29,17 +29,15 @@ EndScriptData */ enum eEnums { //Yell - SAY_AGGRO = -1602000, - SAY_SLAY_1 = -1602001, - SAY_SLAY_2 = -1602002, - SAY_SLAY_3 = -1602003, - SAY_DEATH = -1602004, - SAY_BATTLE_STANCE = -1602005, - EMOTE_BATTLE_STANCE = -1602006, - SAY_BERSEKER_STANCE = -1602007, - EMOTE_BERSEKER_STANCE = -1602008, - SAY_DEFENSIVE_STANCE = -1602009, - EMOTE_DEFENSIVE_STANCE = -1602010, + SAY_AGGRO = 0, + SAY_DEFENSIVE_STANCE = 1, + SAY_BATTLE_STANCE = 2, + SAY_BERSEKER_STANCE = 3, + SAY_SLAY = 4, + SAY_DEATH = 5, + EMOTE_DEFENSIVE_STANCE = 6, + EMOTE_BATTLE_STANCE = 7, + EMOTE_BERSEKER_STANCE = 8, SPELL_DEFENSIVE_STANCE = 53790, //SPELL_DEFENSIVE_AURA = 41105, @@ -95,13 +93,13 @@ public: { boss_bjarngrimAI(Creature* creature) : ScriptedAI(creature) { - m_instance = creature->GetInstanceScript(); + instance = creature->GetInstanceScript(); m_uiStance = STANCE_DEFENSIVE; memset(&m_auiStormforgedLieutenantGUID, 0, sizeof(m_auiStormforgedLieutenantGUID)); canBuff = true; } - InstanceScript* m_instance; + InstanceScript* instance; bool m_bIsChangingStance; bool canBuff; @@ -169,8 +167,8 @@ public: SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SHIELD, EQUIP_NO_CHANGE); - if (m_instance) - m_instance->SetData(TYPE_BJARNGRIM, NOT_STARTED); + if (instance) + instance->SetData(TYPE_BJARNGRIM, NOT_STARTED); } void EnterEvadeMode() @@ -185,26 +183,26 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); //must get both lieutenants here and make sure they are with him me->CallForHelp(30.0f); - if (m_instance) - m_instance->SetData(TYPE_BJARNGRIM, IN_PROGRESS); + if (instance) + instance->SetData(TYPE_BJARNGRIM, IN_PROGRESS); } void KilledUnit(Unit* /*victim*/) { - DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3), me); + Talk(SAY_SLAY); } void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_DEATH, me); + Talk(SAY_DEATH); - if (m_instance) - m_instance->SetData(TYPE_BJARNGRIM, DONE); + if (instance) + instance->SetData(TYPE_BJARNGRIM, DONE); } //TODO: remove when removal is done by the core @@ -249,20 +247,20 @@ public: switch (m_uiStance) { case STANCE_DEFENSIVE: - DoScriptText(SAY_DEFENSIVE_STANCE, me); - DoScriptText(EMOTE_DEFENSIVE_STANCE, me); + Talk(SAY_DEFENSIVE_STANCE); + Talk(EMOTE_DEFENSIVE_STANCE); DoCast(me, SPELL_DEFENSIVE_STANCE); SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SHIELD, EQUIP_NO_CHANGE); break; case STANCE_BERSERKER: - DoScriptText(SAY_BERSEKER_STANCE, me); - DoScriptText(EMOTE_BERSEKER_STANCE, me); + Talk(SAY_BERSEKER_STANCE); + Talk(EMOTE_BERSEKER_STANCE); DoCast(me, SPELL_BERSEKER_STANCE); SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SWORD, EQUIP_NO_CHANGE); break; case STANCE_BATTLE: - DoScriptText(SAY_BATTLE_STANCE, me); - DoScriptText(EMOTE_BATTLE_STANCE, me); + Talk(SAY_BATTLE_STANCE); + Talk(EMOTE_BATTLE_STANCE); DoCast(me, SPELL_BATTLE_STANCE); SetEquipmentSlots(false, EQUIP_MACE, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); break; @@ -387,10 +385,10 @@ public: { mob_stormforged_lieutenantAI(Creature* creature) : ScriptedAI(creature) { - m_instance = creature->GetInstanceScript(); + instance = creature->GetInstanceScript(); } - InstanceScript* m_instance; + InstanceScript* instance; uint32 m_uiArcWeld_Timer; uint32 m_uiRenewSteel_Timer; @@ -403,9 +401,9 @@ public: void EnterCombat(Unit* who) { - if (m_instance) + if (instance) { - if (Creature* pBjarngrim = m_instance->instance->GetCreature(m_instance->GetData64(DATA_BJARNGRIM))) + if (Creature* pBjarngrim = instance->instance->GetCreature(instance->GetData64(DATA_BJARNGRIM))) { if (pBjarngrim->isAlive() && !pBjarngrim->getVictim()) pBjarngrim->AI()->AttackStart(who); @@ -429,9 +427,9 @@ public: if (m_uiRenewSteel_Timer <= uiDiff) { - if (m_instance) + if (instance) { - if (Creature* pBjarngrim = m_instance->instance->GetCreature(m_instance->GetData64(DATA_BJARNGRIM))) + if (Creature* pBjarngrim = instance->instance->GetCreature(instance->GetData64(DATA_BJARNGRIM))) { if (pBjarngrim->isAlive()) DoCast(pBjarngrim, SPELL_RENEW_STEEL_N); diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp index 016c4d27cfa..abdf5ecb1e1 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp @@ -41,13 +41,10 @@ enum Spells enum Yells { - SAY_AGGRO = -1602011, - SAY_SLAY_1 = -1602012, - SAY_SLAY_2 = -1602013, - SAY_SLAY_3 = -1602014, - SAY_DEATH = -1602015, - SAY_SPLIT_1 = -1602016, - SAY_SPLIT_2 = -1602017 + SAY_AGGRO = 0, + SAY_SPLIT = 1, + SAY_SLAY = 2, + SAY_DEATH = 3 }; enum Creatures @@ -122,7 +119,7 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); if (instance) instance->SetData(TYPE_IONAR, IN_PROGRESS); @@ -130,7 +127,7 @@ public: void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_DEATH, me); + Talk(SAY_DEATH); lSparkList.DespawnAll(); @@ -140,7 +137,7 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3), me); + Talk(SAY_SLAY); } void SpellHit(Unit* /*caster*/, const SpellInfo* spell) @@ -278,7 +275,7 @@ public: { bHasDispersed = true; - DoScriptText(RAND(SAY_SPLIT_1, SAY_SPLIT_2), me); + Talk(SAY_SPLIT); if (me->IsNonMeleeSpellCasted(false)) me->InterruptNonMeleeSpells(false); diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp index 171215c605a..2e2744baa3c 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp @@ -30,20 +30,16 @@ enum eEnums { ACHIEV_TIMELY_DEATH_START_EVENT = 20384, - SAY_AGGRO = -1602018, - SAY_INTRO_1 = -1602019, - SAY_INTRO_2 = -1602020, - SAY_SLAY_1 = -1602021, - SAY_SLAY_2 = -1602022, - SAY_SLAY_3 = -1602023, - SAY_DEATH = -1602024, - SAY_NOVA_1 = -1602025, - SAY_NOVA_2 = -1602026, - SAY_NOVA_3 = -1602027, - SAY_75HEALTH = -1602028, - SAY_50HEALTH = -1602029, - SAY_25HEALTH = -1602030, - EMOTE_NOVA = -1602031, + SAY_INTRO_1 = 0, + SAY_INTRO_2 = 1, + SAY_AGGRO = 2, + SAY_NOVA = 3, + SAY_SLAY = 4, + SAY_75HEALTH = 5, + SAY_50HEALTH = 6, + SAY_25HEALTH = 7, + SAY_DEATH = 8, + EMOTE_NOVA = 9, SPELL_ARC_LIGHTNING = 52921, SPELL_LIGHTNING_NOVA_N = 52960, @@ -72,10 +68,10 @@ public: { boss_lokenAI(Creature* creature) : ScriptedAI(creature) { - m_instance = creature->GetInstanceScript(); + instance = creature->GetInstanceScript(); } - InstanceScript* m_instance; + InstanceScript* instance; bool m_bIsAura; @@ -97,35 +93,35 @@ public: m_uiHealthAmountModifier = 1; - if (m_instance) + if (instance) { - m_instance->SetData(TYPE_LOKEN, NOT_STARTED); - m_instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMELY_DEATH_START_EVENT); + instance->SetData(TYPE_LOKEN, NOT_STARTED); + instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMELY_DEATH_START_EVENT); } } void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); - if (m_instance) + if (instance) { - m_instance->SetData(TYPE_LOKEN, IN_PROGRESS); - m_instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMELY_DEATH_START_EVENT); + instance->SetData(TYPE_LOKEN, IN_PROGRESS); + instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMELY_DEATH_START_EVENT); } } void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_DEATH, me); + Talk(SAY_DEATH); - if (m_instance) - m_instance->SetData(TYPE_LOKEN, DONE); + if (instance) + instance->SetData(TYPE_LOKEN, DONE); } void KilledUnit(Unit* /*victim*/) { - DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3), me); + Talk(SAY_SLAY); } void UpdateAI(const uint32 uiDiff) @@ -190,8 +186,8 @@ public: if (m_uiLightningNova_Timer <= uiDiff) { - DoScriptText(RAND(SAY_NOVA_1, SAY_NOVA_2, SAY_NOVA_3), me); - DoScriptText(EMOTE_NOVA, me); + Talk(SAY_NOVA); + Talk(EMOTE_NOVA); DoCast(me, SPELL_LIGHTNING_NOVA_N); m_bIsAura = false; @@ -206,9 +202,9 @@ public: { switch (m_uiHealthAmountModifier) { - case 1: DoScriptText(SAY_75HEALTH, me); break; - case 2: DoScriptText(SAY_50HEALTH, me); break; - case 3: DoScriptText(SAY_25HEALTH, me); break; + case 1: Talk(SAY_75HEALTH); break; + case 2: Talk(SAY_50HEALTH); break; + case 3: Talk(SAY_25HEALTH); break; } ++m_uiHealthAmountModifier; diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp index 1fc724c8b6c..5c7bf0d1c1e 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp @@ -28,17 +28,13 @@ EndScriptData */ enum eEnums { - SAY_AGGRO = -1602032, - SAY_SLAY_1 = -1602033, - SAY_SLAY_2 = -1602034, - SAY_SLAY_3 = -1602035, - SAY_DEATH = -1602036, - SAY_STOMP_1 = -1602037, - SAY_STOMP_2 = -1602038, - SAY_FORGE_1 = -1602039, - SAY_FORGE_2 = -1602040, - EMOTE_TO_ANVIL = -1602041, - EMOTE_SHATTER = -1602042, + SAY_AGGRO = 0, + SAY_FORGE = 1, + SAY_STOMP = 2, + SAY_SLAY = 3, + SAY_DEATH = 4, + EMOTE_TO_ANVIL = 5, + EMOTE_SHATTER = 6, SPELL_HEAT_N = 52387, SPELL_HEAT_H = 59528, @@ -83,10 +79,10 @@ public: { boss_volkhanAI(Creature* creature) : ScriptedAI(creature) { - m_instance = creature->GetInstanceScript(); + instance = creature->GetInstanceScript(); } - InstanceScript* m_instance; + InstanceScript* instance; std::list<uint64> m_lGolemGUIDList; @@ -121,16 +117,16 @@ public: DespawnGolem(); m_lGolemGUIDList.clear(); - if (m_instance) - m_instance->SetData(TYPE_VOLKHAN, NOT_STARTED); + if (instance) + instance->SetData(TYPE_VOLKHAN, NOT_STARTED); } void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); - if (m_instance) - m_instance->SetData(TYPE_VOLKHAN, IN_PROGRESS); + if (instance) + instance->SetData(TYPE_VOLKHAN, IN_PROGRESS); } void AttackStart(Unit* who) @@ -148,15 +144,15 @@ public: void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_DEATH, me); + Talk(SAY_DEATH); DespawnGolem(); - if (m_instance) - m_instance->SetData(TYPE_VOLKHAN, DONE); + if (instance) + instance->SetData(TYPE_VOLKHAN, DONE); if (IsHeroic() && GolemsShattered < 5) { - AchievementEntry const* AchievShatterResistant = GetAchievementStore()->LookupEntry(ACHIEVEMENT_SHATTER_RESISTANT); + AchievementEntry const* AchievShatterResistant = sAchievementStore.LookupEntry(ACHIEVEMENT_SHATTER_RESISTANT); if (AchievShatterResistant) { Map* map = me->GetMap(); @@ -172,7 +168,7 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3), me); + Talk(SAY_SLAY); } void DespawnGolem() @@ -263,11 +259,11 @@ public: if (m_uiShatteringStomp_Timer <= uiDiff) { // Should he stomp even if he has no brittle golem to shatter? - DoScriptText(RAND(SAY_STOMP_1, SAY_STOMP_2), me); + Talk(SAY_STOMP); DoCast(me, SPELL_SHATTERING_STOMP_N); - DoScriptText(EMOTE_SHATTER, me); + Talk(EMOTE_SHATTER); m_uiShatteringStomp_Timer = 30000; m_bCanShatterGolem = true; @@ -297,7 +293,7 @@ public: if (me->IsNonMeleeSpellCasted(false)) me->InterruptNonMeleeSpells(false); - DoScriptText(RAND(SAY_FORGE_1, SAY_FORGE_2), me); + Talk(SAY_FORGE); m_bHasTemper = true; @@ -308,7 +304,7 @@ public: { case 1: // 1 - Start run to Anvil - DoScriptText(EMOTE_TO_ANVIL, me); + Talk(EMOTE_TO_ANVIL); me->GetMotionMaster()->MoveTargetedHome(); m_uiSummonPhase = 2; // Set Next Phase break; diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp index d1aba800094..bc57ce21a4d 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp @@ -61,9 +61,9 @@ public: struct boss_krystallusAI : public ScriptedAI { - boss_krystallusAI(Creature* c) : ScriptedAI(c) + boss_krystallusAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 uiBoulderTossTimer; diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp index cd4d7ae94a1..65711643827 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp @@ -65,7 +65,7 @@ public: struct boss_maiden_of_griefAI : public ScriptedAI { - boss_maiden_of_griefAI(Creature* c) : ScriptedAI(c) + boss_maiden_of_griefAI(Creature* creature) : ScriptedAI(creature) { instance = me->GetInstanceScript(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp index 2c7026207e5..c2a8e905950 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp @@ -90,9 +90,9 @@ public: struct boss_sjonnirAI : public ScriptedAI { - boss_sjonnirAI(Creature* c) : ScriptedAI(c), lSummons(me) + boss_sjonnirAI(Creature* creature) : ScriptedAI(creature), lSummons(me) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } bool bIsFrenzy; @@ -258,7 +258,7 @@ public: struct mob_malformed_oozeAI : public ScriptedAI { - mob_malformed_oozeAI(Creature* c) : ScriptedAI(c) {} + mob_malformed_oozeAI(Creature* creature) : ScriptedAI(creature) {} uint32 uiMergeTimer; @@ -301,9 +301,9 @@ public: struct mob_iron_sludgeAI : public ScriptedAI { - mob_iron_sludgeAI(Creature* c) : ScriptedAI(c) + mob_iron_sludgeAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp index 1c8d9380a2b..a608de5fcf3 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp @@ -142,9 +142,9 @@ public: struct mob_tribuna_controllerAI : public ScriptedAI { - mob_tribuna_controllerAI(Creature* c) : ScriptedAI(c) + mob_tribuna_controllerAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); SetCombatMovement(false); } @@ -268,10 +268,10 @@ class npc_brann_hos : public CreatureScript public: npc_brann_hos() : CreatureScript("npc_brann_hos") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1 || uiAction == GOSSIP_ACTION_INFO_DEF+2) + if (action == GOSSIP_ACTION_INFO_DEF+1 || action == GOSSIP_ACTION_INFO_DEF+2) { player->CLOSE_GOSSIP_MENU(); CAST_AI(npc_brann_hos::npc_brann_hosAI, creature->AI())->StartWP(); @@ -298,9 +298,9 @@ public: struct npc_brann_hosAI : public npc_escortAI { - npc_brann_hosAI(Creature* c) : npc_escortAI(c) + npc_brann_hosAI(Creature* creature) : npc_escortAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 uiStep; @@ -346,9 +346,9 @@ public: lDwarfGUIDList.clear(); } - void WaypointReached(uint32 uiPointId) + void WaypointReached(uint32 waypointId) { - switch (uiPointId) + switch (waypointId) { case 7: if (Creature* creature = GetClosestCreatureWithEntry(me, CREATURE_TRIBUNAL_OF_THE_AGES, 100.0f)) diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon.cpp deleted file mode 100644 index e54d8a898de..00000000000 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon.cpp +++ /dev/null @@ -1,376 +0,0 @@ -/* - * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> - * - * 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/>. - */ - -#include "ScriptMgr.h" -#include "ScriptedCreature.h" -#include "ulduar.h" - -#define GAMEOBJECT_GIVE_OF_THE_OBSERVER 194821 - -enum Spells -{ - SPELL_ASCEND = 64487, - SPELL_BERSERK = 47008, - SPELL_BIG_BANG = 64443, - H_SPELL_BIG_BANG = 64584, - SPELL_COSMIC_SMASH = 62301, - H_SPELL_COSMIC_SMASH = 64598, - SPELL_PHASE_PUNCH = 64412, - SPELL_QUANTUM_STRIKE = 64395, - H_SPELL_QUANTUM_STRIKE = 64592, - SPELL_BLACK_HOLE_EXPLOSION = 64122, - SPELL_ARCANE_BARAGE = 64599, - H_SPELL_ARCANE_BARAGE = 64607 -}; - -enum Creatures -{ - CREATURE_COLLAPSING_STAR = 32955, - CREATURE_BLACK_HOLE = 32953, - CREATURE_LIVING_CONSTELLATION = 33052, - CREATURE_DARK_MATTER = 33089 -}; - -enum Yells -{ - SAY_AGGRO = -1603000, - SAY_SLAY_1 = -1603001, - SAY_SLAY_2 = -1603002, - SAY_ENGADED_FOR_FIRTS_TIME = -1603003, - SAY_PHASE_2 = -1603004, - SAY_SUMMON_COLLAPSING_STAR = -1603005, - SAY_DEATH_1 = -1603006, - SAY_DEATH_2 = -1603007, - SAY_DEATH_3 = -1603008, - SAY_DEATH_4 = -1603009, - SAY_DEATH_5 = -1603010, - SAY_BERSERK = -1603011, - SAY_BIG_BANG_1 = -1603012, - SAY_BIG_BANG_2 = -1603013, - SAY_TIMER_1 = -1603014, - SAY_TIMER_2 = -1603015, - SAY_TIMER_3 = -1603016, - SAY_SUMMON_1 = -1603017, - SAY_SUMMON_2 = -1603018, - SAY_SUMMON_3 = -1603019, -}; - -class boss_algalon : public CreatureScript -{ -public: - boss_algalon() : CreatureScript("boss_algalon") { } - - CreatureAI* GetAI(Creature* creature) const - { - return GetUlduarAI<boss_algalonAI>(creature); - } - - struct boss_algalonAI : public ScriptedAI - { - boss_algalonAI(Creature* c) : ScriptedAI(c) - { - instance = c->GetInstanceScript(); - Summon = false; // not in reset. intro speech done only once. - } - - InstanceScript* instance; - - std::list<uint64> m_lCollapsingStarGUIDList; - - uint32 Phase; - uint32 Ascend_Timer; - uint32 Berserk_Timer; - uint32 BigBang_Timer; - uint32 CosmicSmash_Timer; - uint32 PhasePunch_Timer; - uint32 QuantumStrike_Timer; - uint32 CollapsingStar_Timer; - uint32 uiPhase_timer; - uint32 uiStep; - - uint64 BlackHoleGUID; - - bool Enrage; - bool Summon; - - void EnterCombat(Unit* who) - { - if (Summon) - { - DoScriptText(SAY_AGGRO, me); - me->InterruptSpell(CURRENT_CHANNELED_SPELL); - DoZoneInCombat(who->ToCreature()); - } - else - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_PASSIVE); - uiStep = 1; - } - - if (instance) - instance->SetData(BOSS_ALGALON, IN_PROGRESS); - } - - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me); - } - - void Reset() - { - Phase = 1; - - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (instance) - instance->SetData(BOSS_ALGALON, NOT_STARTED); - - BlackHoleGUID = 0; - - uiPhase_timer = 0; - Ascend_Timer = 480000; //8 minutes - QuantumStrike_Timer = urand(4000, 14000); - Berserk_Timer = 360000; //6 minutes - CollapsingStar_Timer = urand(15000, 20000); //Spawns between 15 to 20 seconds - BigBang_Timer = 90000; - PhasePunch_Timer = 8000; - CosmicSmash_Timer = urand(30000, 60000); - Enrage = false; - } - - void JumpToNextStep(uint32 uiTimer) - { - uiPhase_timer = uiTimer; - ++uiStep; - } - - void DespawnCollapsingStar() - { - if (m_lCollapsingStarGUIDList.empty()) - return; - - for (std::list<uint64>::const_iterator itr = m_lCollapsingStarGUIDList.begin(); itr != m_lCollapsingStarGUIDList.end(); ++itr) - { - if (Creature* temp = Unit::GetCreature(*me, *itr)) - { - if (temp->isAlive()) - temp->DespawnOrUnsummon(); - } - } - m_lCollapsingStarGUIDList.clear(); - } - - void JustSummoned(Creature* summoned) - { - if (summoned->GetEntry() == CREATURE_COLLAPSING_STAR) - { - Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0); - if (me->getVictim()) - summoned->AI()->AttackStart(target ? target : me->getVictim()); - m_lCollapsingStarGUIDList.push_back(summoned->GetGUID()); - } - } - - void SummonCollapsingStar(Unit* target) - { - DoScriptText(SAY_SUMMON_COLLAPSING_STAR, me); - me->SummonCreature(CREATURE_COLLAPSING_STAR, target->GetPositionX()+15.0f, target->GetPositionY()+15.0f, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 100000); - me->SummonCreature(CREATURE_BLACK_HOLE, target->GetPositionX()+15.0f, target->GetPositionY()+15.0f, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 27000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (Phase == 1 && HealthBelowPct(20)) - { - Phase = 2; - DoScriptText(SAY_PHASE_2, me); - } - - if (HealthBelowPct(2)) - { - me->SummonGameObject(GAMEOBJECT_GIVE_OF_THE_OBSERVER, 1634.258667f, -295.101166f, 417.321381f, 0, 0, 0, 0, 0, 0); - - // All of them. or random? - DoScriptText(SAY_DEATH_1, me); - DoScriptText(SAY_DEATH_2, me); - DoScriptText(SAY_DEATH_3, me); - DoScriptText(SAY_DEATH_4, me); - DoScriptText(SAY_DEATH_5, me); - - me->DisappearAndDie(); - - if (instance) - instance->SetData(BOSS_ALGALON, DONE); - - return; - } - - if (Phase == 1) - { - if (!Summon) - { - if (uiPhase_timer <= diff) - { - switch (uiStep) - { - case 1: - DoScriptText(SAY_SUMMON_1, me); - JumpToNextStep(3000); - break; - case 2: - DoScriptText(SAY_SUMMON_2, me); - JumpToNextStep(3000); - break; - case 3: - DoScriptText(SAY_SUMMON_3, me); - JumpToNextStep(3000); - break; - case 4: - DoScriptText(SAY_ENGADED_FOR_FIRTS_TIME, me); - JumpToNextStep(3000); - break; - case 5: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_AGGRESSIVE); - Summon = true; - break; - } - } else uiPhase_timer -= diff; - - return; - } - - if (QuantumStrike_Timer <= diff) - { - DoCast(me->getVictim(), RAID_MODE(SPELL_QUANTUM_STRIKE, H_SPELL_QUANTUM_STRIKE), true); - - QuantumStrike_Timer = urand(4000, 14000); - } else QuantumStrike_Timer -= diff; - - if (BigBang_Timer <= diff) - { - DoScriptText(RAND(SAY_BIG_BANG_1, SAY_BIG_BANG_2), me); - DoCast(me->getVictim(), RAID_MODE(SPELL_BIG_BANG, H_SPELL_BIG_BANG), true); - - BigBang_Timer = 90000; - } else BigBang_Timer -= diff; - - if (Ascend_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_ASCEND, true); - - Ascend_Timer = 480000; - } else Ascend_Timer -= diff; - - if (PhasePunch_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_PHASE_PUNCH, true); - - PhasePunch_Timer = 8000; - } else PhasePunch_Timer -= diff; - - if (CosmicSmash_Timer <= diff) - { - DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0), RAID_MODE(SPELL_COSMIC_SMASH, H_SPELL_COSMIC_SMASH), true); - - CosmicSmash_Timer = urand(30000, 60000); - } else CosmicSmash_Timer -= diff; - - if (Berserk_Timer <= diff) - { - DoScriptText(SAY_BERSERK, me); - DoCast(me->getVictim(), SPELL_BERSERK, true); - - Berserk_Timer = 360000; - } else Berserk_Timer -= diff; - - DoMeleeAttackIfReady(); - - EnterEvadeIfOutOfCombatArea(diff); - } - - if (Phase == 2) - { - if (Enrage) - { - if (Ascend_Timer <= diff) - { - DoCast(me, SPELL_ASCEND); - DoScriptText(SAY_BERSERK, me); - Ascend_Timer = urand(360000, 365000); - Enrage = false; - } else Ascend_Timer -= diff; - } - } - - DoMeleeAttackIfReady(); - } - }; - -}; - -//Collapsing Star -class mob_collapsing_star : public CreatureScript -{ -public: - mob_collapsing_star() : CreatureScript("mob_collapsing_star") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_collapsing_starAI(creature); - } - - struct mob_collapsing_starAI : public ScriptedAI - { - mob_collapsing_starAI(Creature* creature) : ScriptedAI(creature) - { - instance = creature->GetInstanceScript(); - } - - InstanceScript* instance; - - uint32 BlackHoleExplosion_Timer; - - void Reset() - { - BlackHoleExplosion_Timer = 0; - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (BlackHoleExplosion_Timer <= diff) - { - me->CastSpell(me, SPELL_BLACK_HOLE_EXPLOSION, false); - BlackHoleExplosion_Timer = 0; - } else BlackHoleExplosion_Timer -= diff; - } - }; - -}; - -void AddSC_boss_Algalon() -{ - new boss_algalon(); - new mob_collapsing_star(); -} diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp new file mode 100644 index 00000000000..2af73389ecb --- /dev/null +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp @@ -0,0 +1,1374 @@ +/* + * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> + * + * 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/>. + */ + +#include "ObjectMgr.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "PassiveAI.h" +#include "GameObjectAI.h" +#include "MapManager.h" +#include "MoveSplineInit.h" +#include "ulduar.h" + +enum Texts +{ + SAY_BRANN_ALGALON_INTRO_1 = 0, + SAY_BRANN_ALGALON_INTRO_2 = 1, + SAY_BRANN_ALGALON_OUTRO = 2, + + SAY_ALGALON_INTRO_1 = 0, + SAY_ALGALON_INTRO_2 = 1, + SAY_ALGALON_INTRO_3 = 2, + SAY_ALGALON_START_TIMER = 3, + SAY_ALGALON_AGGRO = 4, + SAY_ALGALON_COLLAPSING_STAR = 5, + EMOTE_ALGALON_COLLAPSING_STAR = 6, + SAY_ALGALON_BIG_BANG = 7, + EMOTE_ALGALON_BIG_BANG = 8, + SAY_ALGALON_ASCEND = 9, + EMOTE_ALGALON_COSMIC_SMASH = 10, + SAY_ALGALON_PHASE_TWO = 11, + SAY_ALGALON_OUTRO_1 = 12, + SAY_ALGALON_OUTRO_2 = 13, + SAY_ALGALON_OUTRO_3 = 14, + SAY_ALGALON_OUTRO_4 = 15, + SAY_ALGALON_OUTRO_5 = 16, + SAY_ALGALON_DESPAWN_1 = 17, + SAY_ALGALON_DESPAWN_2 = 18, + SAY_ALGALON_DESPAWN_3 = 19, + SAY_ALGALON_KILL = 20, +}; + +enum Spells +{ + // Algalon the Observer + SPELL_ARRIVAL = 64997, + SPELL_RIDE_THE_LIGHTNING = 64986, + SPELL_SUMMON_AZEROTH = 64994, + SPELL_REORIGINATION = 64996, + SPELL_SUPERMASSIVE_FAIL = 65311, + SPELL_QUANTUM_STRIKE = 64395, + SPELL_PHASE_PUNCH = 64412, + SPELL_BIG_BANG = 64443, + SPELL_ASCEND_TO_THE_HEAVENS = 64487, + SPELL_COSMIC_SMASH = 62301, + SPELL_COSMIC_SMASH_TRIGGERED = 62304, + SPELL_COSMIC_SMASH_VISUAL_STATE = 62300, + SPELL_SELF_STUN = 65256, + SPELL_KILL_CREDIT = 65184, + SPELL_TELEPORT = 62940, + + // Algalon Stalker + SPELL_TRIGGER_3_ADDS = 62266, // Triggers Living Constellation + + // Living Constellation + SPELL_ARCANE_BARRAGE = 64599, + + // Collapsing Star + SPELL_COLLAPSE = 62018, + SPELL_BLACK_HOLE_SPAWN_VISUAL = 62003, + SPELL_SUMMON_BLACK_HOLE = 62189, + + // Black Hole + SPELL_BLACK_HOLE_TRIGGER = 62185, + SPELL_CONSTELLATION_PHASE_TRIGGER = 65508, + SPELL_CONSTELLATION_PHASE_EFFECT = 65509, + SPELL_BLACK_HOLE_EXPLOSION = 64122, + SPELL_SUMMON_VOID_ZONE_VISUAL = 64470, + SPELL_VOID_ZONE_VISUAL = 64469, + SPELL_BLACK_HOLE_CREDIT = 65312, + + // Worm Hole + SPELL_WORM_HOLE_TRIGGER = 65251, + SPELL_SUMMON_UNLEASHED_DARK_MATTER = 64450, +}; + +uint32 const PhasePunchAlphaId[5] = {64435, 64434, 64428, 64421, 64417}; + +enum Events +{ + // Celestial Planetarium Access + EVENT_DESPAWN_CONSOLE = 1, + + // Brann Bronzebeard + EVENT_BRANN_MOVE_INTRO = 2, + EVENT_SUMMON_ALGALON = 3, + EVENT_BRANN_OUTRO_1 = 4, + EVENT_BRANN_OUTRO_2 = 5, + + // Algalon the Observer + EVENT_INTRO_1 = 6, + EVENT_INTRO_2 = 7, + EVENT_INTRO_3 = 8, + EVENT_INTRO_FINISH = 9, + EVENT_START_COMBAT = 10, + EVENT_INTRO_TIMER_DONE = 11, + EVENT_QUANTUM_STRIKE = 12, + EVENT_PHASE_PUNCH = 13, + EVENT_SUMMON_COLLAPSING_STAR = 14, + EVENT_BIG_BANG = 15, + EVENT_RESUME_UPDATING = 16, + EVENT_ASCEND_TO_THE_HEAVENS = 17, + EVENT_EVADE = 18, + EVENT_COSMIC_SMASH = 19, + EVENT_UNLOCK_YELL = 20, + EVENT_OUTRO_START = 21, + EVENT_OUTRO_1 = 22, + EVENT_OUTRO_2 = 23, + EVENT_OUTRO_3 = 24, + EVENT_OUTRO_4 = 25, + EVENT_OUTRO_5 = 26, + EVENT_OUTRO_6 = 27, + EVENT_OUTRO_7 = 28, + EVENT_OUTRO_8 = 29, + EVENT_OUTRO_9 = 30, + EVENT_OUTRO_10 = 31, + EVENT_OUTRO_11 = 32, + EVENT_OUTRO_12 = 33, + EVENT_OUTRO_13 = 34, + EVENT_OUTRO_14 = 35, + EVENT_DESPAWN_ALGALON_1 = 36, + EVENT_DESPAWN_ALGALON_2 = 37, + EVENT_DESPAWN_ALGALON_3 = 38, + + // Living Constellation + EVENT_ARCANE_BARRAGE = 39, +}; + +enum Actions +{ + ACTION_START_INTRO = 0, + ACTION_FINISH_INTRO = 1, + ACTION_ACTIVATE_STAR = 2, + ACTION_BIG_BANG = 3, + ACTION_ASCEND = 4, + ACTION_OUTRO = 5, +}; + +enum Points +{ + POINT_BRANN_INTRO = 0, + MAX_BRANN_WAYPOINTS_INTRO = 10, + POINT_BRANN_OUTRO = 10, + POINT_BRANN_OUTRO_END = 11, + + POINT_ALGALON_LAND = 1, + POINT_ALGALON_OUTRO = 2, +}; + +enum EncounterPhases +{ + PHASE_NORMAL = 0, + PHASE_ROLE_PLAY = 1, + PHASE_BIG_BANG = 2, + + PHASE_MASK_NO_UPDATE = (1 << PHASE_ROLE_PLAY) | (1 << PHASE_BIG_BANG), + PHASE_MASK_NO_CAST_CHECK = 1 << PHASE_ROLE_PLAY, +}; + +enum AchievmentInfo +{ + EVENT_ID_SUPERMASSIVE_START = 21697, + DATA_HAS_FED_ON_TEARS = 30043005, +}; + + +Position const BrannIntroSpawnPos = {1676.277f, -162.5308f, 427.3326f, 3.235537f}; +Position const BrannIntroWaypoint[MAX_BRANN_WAYPOINTS_INTRO] = +{ + {1642.482f, -164.0812f, 427.2602f, 0.0f}, + {1635.000f, -169.5145f, 427.2523f, 0.0f}, + {1632.814f, -173.9334f, 427.2621f, 0.0f}, + {1632.676f, -190.5927f, 425.8831f, 0.0f}, + {1631.497f, -214.2221f, 418.1152f, 0.0f}, + {1624.717f, -224.6876f, 418.1152f, 0.0f}, + {1631.497f, -214.2221f, 418.1152f, 0.0f}, + {1632.676f, -190.5927f, 425.8831f, 0.0f}, + {1632.814f, -173.9334f, 427.2621f, 0.0f}, + {1635.000f, -169.5145f, 427.2523f, 0.0f}, +}; +Position const AlgalonSummonPos = {1632.531f, -304.8516f, 450.1123f, 1.530165f}; +Position const AlgalonLandPos = {1632.668f, -302.7656f, 417.3211f, 1.530165f}; + +#define LIVING_CONSTELLATION_COUNT 11 +Position const ConstellationPos[LIVING_CONSTELLATION_COUNT] = +{ + {1625.208f, -267.2771f, 446.4296f, 5.044002f}, + {1658.279f, -262.5490f, 441.9073f, 4.188790f}, + {1678.677f, -276.3280f, 427.7531f, 3.979351f}, + {1593.389f, -299.4325f, 432.4636f, 6.073746f}, + {1685.613f, -300.1219f, 443.2366f, 3.385939f}, + {1591.706f, -263.8201f, 441.4153f, 5.253441f}, + {1668.317f, -324.7676f, 457.9394f, 3.211406f}, + {1592.242f, -325.5323f, 446.9508f, 0.226893f}, + {1635.821f, -363.3442f, 424.3459f, 1.466077f}, + {1672.188f, -357.2484f, 436.7337f, 2.338741f}, + {1615.800f, -348.0065f, 442.9586f, 1.134464f}, +}; + +#define COLLAPSING_STAR_COUNT 4 +Position const CollapsingStarPos[COLLAPSING_STAR_COUNT] = +{ + {1649.438f, -319.8127f, 418.3941f, 1.082104f}, + {1647.005f, -288.6790f, 417.3955f, 3.490659f}, + {1622.451f, -321.1563f, 417.6188f, 4.677482f}, + {1615.060f, -291.6816f, 417.7796f, 3.490659f}, +}; +Position const AlgalonOutroPos = {1633.64f, -317.78f, 417.3211f, 0.0f}; +Position const BrannOutroPos[3] = +{ + {1632.023f, -243.7434f, 417.9118f, 0.0f}, + {1631.986f, -297.7831f, 417.3210f, 0.0f}, + {1633.832f, -216.2948f, 417.0463f, 0.0f}, +}; + +class ActivateLivingConstellation : public BasicEvent +{ + public: + ActivateLivingConstellation(Unit* owner) : _owner(owner), _instance(owner->GetInstanceScript()) + { + } + + bool Execute(uint64 execTime, uint32 /*diff*/) + { + if (!_instance || _instance->GetBossState(BOSS_ALGALON) != IN_PROGRESS) + return true; // delete event + + _owner->CastSpell((Unit*)NULL, SPELL_TRIGGER_3_ADDS, TRIGGERED_FULL_MASK); + _owner->m_Events.AddEvent(this, execTime + urand(45000, 50000)); + return false; + } + + private: + Unit* _owner; + InstanceScript* _instance; +}; + +class CosmicSmashDamageEvent : public BasicEvent +{ + public: + CosmicSmashDamageEvent(Unit* caster) : _caster(caster) + { + } + + bool Execute(uint64 /*execTime*/, uint32 /*diff*/) + { + _caster->CastSpell((Unit*)NULL, SPELL_COSMIC_SMASH_TRIGGERED, TRIGGERED_FULL_MASK); + return true; + } + + private: + Unit* _caster; +}; + +class SummonUnleashedDarkMatter : public BasicEvent +{ + public: + SummonUnleashedDarkMatter(Unit* caster) : _caster(caster) + { + } + + bool Execute(uint64 execTime, uint32 /*diff*/) + { + _caster->CastSpell((Unit*)NULL, SPELL_SUMMON_UNLEASHED_DARK_MATTER, TRIGGERED_FULL_MASK); + _caster->m_Events.AddEvent(this, execTime + 30000); + return false; + } + + private: + Unit* _caster; +}; + +class boss_algalon_the_observer : public CreatureScript +{ + public: + boss_algalon_the_observer() : CreatureScript("boss_algalon_the_observer") {} + + struct boss_algalon_the_observerAI : public BossAI + { + boss_algalon_the_observerAI(Creature* creature) : BossAI(creature, BOSS_ALGALON) + { + _firstPull = true; + _fedOnTears = false; + } + + void Reset() + { + _Reset(); + me->SetReactState(REACT_PASSIVE); + _phaseTwo = false; + _fightWon = false; + _hasYelled = false; + } + + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() == TYPEID_UNIT) + { + _fedOnTears = true; + if (!_hasYelled) + { + _hasYelled = true; + events.ScheduleEvent(EVENT_UNLOCK_YELL, 1000); + Talk(SAY_ALGALON_KILL); + } + } + } + + void DoAction(int32 const action) + { + switch (action) + { + case ACTION_START_INTRO: + { + me->SetFlag(UNIT_FIELD_FLAGS_2, 0x20); + me->SetDisableGravity(true); + DoCast(me, SPELL_ARRIVAL, true); + DoCast(me, SPELL_RIDE_THE_LIGHTNING, true); + me->GetMotionMaster()->MovePoint(POINT_ALGALON_LAND, AlgalonLandPos); + me->SetHomePosition(AlgalonLandPos); + Movement::MoveSplineInit init(*me); + init.MoveTo(AlgalonLandPos.GetPositionX(), AlgalonLandPos.GetPositionY(), AlgalonLandPos.GetPositionZ()); + init.SetOrientationFixed(true); + init.Launch(); + events.Reset(); + events.SetPhase(PHASE_ROLE_PLAY); + events.ScheduleEvent(EVENT_INTRO_1, 5000, 0, PHASE_ROLE_PLAY); + events.ScheduleEvent(EVENT_INTRO_2, 15000, 0, PHASE_ROLE_PLAY); + events.ScheduleEvent(EVENT_INTRO_3, 23000, 0, PHASE_ROLE_PLAY); + events.ScheduleEvent(EVENT_INTRO_FINISH, 36000, 0, PHASE_ROLE_PLAY); + break; + } + case ACTION_ASCEND: + events.SetPhase(PHASE_BIG_BANG); + events.CancelEvent(EVENT_RESUME_UPDATING); + events.ScheduleEvent(EVENT_ASCEND_TO_THE_HEAVENS, 1500); + break; + case EVENT_DESPAWN_ALGALON: + events.Reset(); + events.SetPhase(PHASE_ROLE_PLAY); + if (me->isInCombat()) + events.ScheduleEvent(EVENT_ASCEND_TO_THE_HEAVENS, 1); + events.ScheduleEvent(EVENT_DESPAWN_ALGALON_1, 5000); + events.ScheduleEvent(EVENT_DESPAWN_ALGALON_2, 17000); + events.ScheduleEvent(EVENT_DESPAWN_ALGALON_3, 26000); + me->DespawnOrUnsummon(34000); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_NPC); + break; + case ACTION_INIT_ALGALON: + _firstPull = false; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + break;; + } + } + + uint32 GetData(uint32 type) + { + return type == DATA_HAS_FED_ON_TEARS ? _fedOnTears : 1; + } + + void EnterCombat(Unit* /*target*/) + { + uint32 introDelay = 0; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_NPC); + events.Reset(); + events.SetPhase(PHASE_ROLE_PLAY); + + if (!_firstPull) + { + Talk(SAY_ALGALON_AGGRO); + _EnterCombat(); + introDelay = 8000; + } + else + { + _firstPull = false; + Talk(SAY_ALGALON_START_TIMER); + if (Creature* brann = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BRANN_BRONZEBEARD_ALG))) + brann->AI()->DoAction(ACTION_FINISH_INTRO); + + me->setActive(true); + DoZoneInCombat(); + introDelay = 26000; + summons.DespawnEntry(NPC_AZEROTH); + instance->SetData(EVENT_DESPAWN_ALGALON, 0); + events.ScheduleEvent(EVENT_START_COMBAT, 18000); + } + + events.ScheduleEvent(EVENT_INTRO_TIMER_DONE, introDelay); + events.ScheduleEvent(EVENT_QUANTUM_STRIKE, 3500 + introDelay); + events.ScheduleEvent(EVENT_PHASE_PUNCH, 15500 + introDelay); + events.ScheduleEvent(EVENT_SUMMON_COLLAPSING_STAR, 18000 + introDelay); + events.ScheduleEvent(EVENT_BIG_BANG, 90000 + introDelay); + events.ScheduleEvent(EVENT_ASCEND_TO_THE_HEAVENS, 360000 + introDelay); + events.ScheduleEvent(EVENT_COSMIC_SMASH, 25000 + introDelay); + + std::list<Creature*> stalkers; + me->GetCreatureListWithEntryInGrid(stalkers, NPC_ALGALON_STALKER, 200.0f); + for (std::list<Creature*>::iterator itr = stalkers.begin(); itr != stalkers.end(); ++itr) + (*itr)->m_Events.KillAllEvents(true); + } + + void MovementInform(uint32 movementType, uint32 pointId) + { + if (movementType != POINT_MOTION_TYPE) + return; + + if (pointId == POINT_ALGALON_LAND) + me->SetDisableGravity(false); + else if (pointId == POINT_ALGALON_OUTRO) + { + me->SetFacingTo(1.605703f); + events.ScheduleEvent(EVENT_OUTRO_3, 1200); + events.ScheduleEvent(EVENT_OUTRO_4, 2400); + events.ScheduleEvent(EVENT_OUTRO_5, 8500); + events.ScheduleEvent(EVENT_OUTRO_6, 15500); + events.ScheduleEvent(EVENT_OUTRO_7, 55500); + events.ScheduleEvent(EVENT_OUTRO_8, 73500); + events.ScheduleEvent(EVENT_OUTRO_9, 85500); + events.ScheduleEvent(EVENT_OUTRO_10, 108500); + events.ScheduleEvent(EVENT_OUTRO_11, 123500); + } + } + + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + switch (summon->GetEntry()) + { + case NPC_AZEROTH: + DoCastAOE(SPELL_REORIGINATION, true); + break; + case NPC_COLLAPSING_STAR: + summon->SetReactState(REACT_PASSIVE); + summon->GetMotionMaster()->MoveRandom(20.0f); + summon->CastSpell(summon, SPELL_COLLAPSE, TRIGGERED_FULL_MASK); + break; + case NPC_BLACK_HOLE: + summon->SetReactState(REACT_PASSIVE); + summon->CastSpell((Unit*)NULL, SPELL_BLACK_HOLE_TRIGGER, TRIGGERED_FULL_MASK); + summon->CastSpell(summon, SPELL_CONSTELLATION_PHASE_TRIGGER, TRIGGERED_FULL_MASK); + summon->CastSpell((Unit*)NULL, SPELL_BLACK_HOLE_EXPLOSION); + summon->CastSpell(summon, SPELL_SUMMON_VOID_ZONE_VISUAL, TRIGGERED_FULL_MASK); + break; + case NPC_ALGALON_VOID_ZONE_VISUAL_STALKER: + summon->CastSpell(summon, SPELL_VOID_ZONE_VISUAL, TRIGGERED_FULL_MASK); + break; + case NPC_ALGALON_STALKER_ASTEROID_TARGET_01: + summon->CastSpell(summon, SPELL_COSMIC_SMASH_VISUAL_STATE, TRIGGERED_FULL_MASK); + break; + case NPC_ALGALON_STALKER_ASTEROID_TARGET_02: + summon->m_Events.AddEvent(new CosmicSmashDamageEvent(summon), summon->m_Events.CalculateTime(3250)); + break; + case NPC_WORM_HOLE: + summon->SetReactState(REACT_PASSIVE); + summon->CastSpell(summon, SPELL_WORM_HOLE_TRIGGER, TRIGGERED_FULL_MASK); + summon->CastSpell(summon, SPELL_SUMMON_VOID_ZONE_VISUAL, TRIGGERED_FULL_MASK); + break; + case NPC_UNLEASHED_DARK_MATTER: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me))) + if (summon->Attack(target, true)) + summon->GetMotionMaster()->MoveChase(target); + break; + } + } + + void EnterEvadeMode() + { + instance->SetBossState(BOSS_ALGALON, FAIL); + BossAI::EnterEvadeMode(); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetSheath(SHEATH_STATE_UNARMED); + } + + void DamageTaken(Unit* /*attacker*/, uint32& damage) + { + if (_fightWon) + { + damage = 0; + return; + } + + if (!_phaseTwo && me->HealthBelowPctDamaged(20, damage)) + { + _phaseTwo = true; + Talk(SAY_ALGALON_PHASE_TWO); + summons.DespawnEntry(NPC_LIVING_CONSTELLATION); + summons.DespawnEntry(NPC_COLLAPSING_STAR); + summons.DespawnEntry(NPC_BLACK_HOLE); + summons.DespawnEntry(NPC_ALGALON_VOID_ZONE_VISUAL_STALKER); + events.CancelEvent(EVENT_SUMMON_COLLAPSING_STAR); + std::list<Creature*> stalkers; + me->GetCreatureListWithEntryInGrid(stalkers, NPC_ALGALON_STALKER, 200.0f); + for (std::list<Creature*>::iterator itr = stalkers.begin(); itr != stalkers.end(); ++itr) + (*itr)->m_Events.KillAllEvents(true); + for (uint32 i = 0; i < COLLAPSING_STAR_COUNT; ++i) + if (Creature* wormHole = DoSummon(NPC_WORM_HOLE, CollapsingStarPos[i], TEMPSUMMON_MANUAL_DESPAWN)) + wormHole->m_Events.AddEvent(new SummonUnleashedDarkMatter(wormHole), wormHole->m_Events.CalculateTime(i >= 2 ? 8000 : 6000)); + } + else if ((int32(me->GetHealth()) - int32(damage)) < CalculatePctF<int32>(int32(me->GetMaxHealth()), 2.5f) && !_fightWon) + { + _fightWon = true; + damage = 0; + me->SetReactState(REACT_PASSIVE); + me->AttackStop(); + me->setFaction(35); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + DoCast(me, SPELL_SELF_STUN); + events.Reset(); + summons.DespawnAll(); + events.SetPhase(PHASE_ROLE_PLAY); + events.ScheduleEvent(EVENT_OUTRO_START, 1500); + events.ScheduleEvent(EVENT_OUTRO_1, 7200); + events.ScheduleEvent(EVENT_OUTRO_2, 8700); + } + } + + void UpdateAI(uint32 const diff) + { + if ((!(events.GetPhaseMask() & PHASE_MASK_NO_UPDATE) && !UpdateVictim()) || !CheckInRoom()) + return; + + events.Update(diff); + + if (!(events.GetPhaseMask() & PHASE_MASK_NO_CAST_CHECK)) + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_INTRO_1: + me->RemoveAurasDueToSpell(SPELL_RIDE_THE_LIGHTNING); + Talk(SAY_ALGALON_INTRO_1); + break; + case EVENT_INTRO_2: + DoCastAOE(SPELL_SUMMON_AZEROTH, true); + Talk(SAY_ALGALON_INTRO_2); + break; + case EVENT_INTRO_3: + Talk(SAY_ALGALON_INTRO_3); + break; + case EVENT_INTRO_FINISH: + events.Reset(); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + break; + case EVENT_START_COMBAT: + instance->SetBossState(BOSS_ALGALON, IN_PROGRESS); + break; + case EVENT_INTRO_TIMER_DONE: + { + events.SetPhase(PHASE_NORMAL); + me->SetSheath(SHEATH_STATE_MELEE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetReactState(REACT_DEFENSIVE); + DoCastAOE(SPELL_SUPERMASSIVE_FAIL, true); + //! Workaround for Creature::_IsTargetAcceptable returning false + //! for creatures that start combat in REACT_PASSIVE and UNIT_FLAG_NOT_SELECTABLE + //! causing them to immediately evade + if (!me->getThreatManager().isThreatListEmpty()) + AttackStart(me->getThreatManager().getHostilTarget()); + for (uint32 i = 0; i < LIVING_CONSTELLATION_COUNT; ++i) + if (Creature* summon = DoSummon(NPC_LIVING_CONSTELLATION, ConstellationPos[i], 0, TEMPSUMMON_DEAD_DESPAWN)) + summon->SetReactState(REACT_PASSIVE); + + std::list<Creature*> stalkers; + me->GetCreatureListWithEntryInGrid(stalkers, NPC_ALGALON_STALKER, 200.0f); + if (!stalkers.empty()) + { + Unit* stalker = Trinity::Containers::SelectRandomContainerElement(stalkers); + stalker->m_Events.AddEvent(new ActivateLivingConstellation(stalker), stalker->m_Events.CalculateTime(urand(45000, 50000))); + } + break; + } + case EVENT_QUANTUM_STRIKE: + DoCastVictim(SPELL_QUANTUM_STRIKE); + events.ScheduleEvent(EVENT_QUANTUM_STRIKE, urand(3000, 5000)); + break; + case EVENT_PHASE_PUNCH: + DoCastVictim(SPELL_PHASE_PUNCH); + events.ScheduleEvent(EVENT_PHASE_PUNCH, 15500); + break; + case EVENT_SUMMON_COLLAPSING_STAR: + Talk(SAY_ALGALON_COLLAPSING_STAR); + Talk(EMOTE_ALGALON_COLLAPSING_STAR); + for (uint32 i = 0; i < COLLAPSING_STAR_COUNT; ++i) + me->SummonCreature(NPC_COLLAPSING_STAR, CollapsingStarPos[i], TEMPSUMMON_CORPSE_DESPAWN); + events.ScheduleEvent(EVENT_SUMMON_COLLAPSING_STAR, 60000); + break; + case EVENT_BIG_BANG: + { + Talk(SAY_ALGALON_BIG_BANG); + Talk(EMOTE_ALGALON_BIG_BANG); + events.SetPhase(PHASE_BIG_BANG); + std::list<Creature*> constellations; + me->GetCreatureListWithEntryInGrid(constellations, NPC_LIVING_CONSTELLATION, 200.0f); + for (std::list<Creature*>::iterator itr = constellations.begin(); itr != constellations.end(); ++itr) + (*itr)->AI()->DoAction(ACTION_BIG_BANG); + DoCastAOE(SPELL_BIG_BANG); + events.ScheduleEvent(EVENT_BIG_BANG, 90500); + events.ScheduleEvent(EVENT_RESUME_UPDATING, 9500); + break; + } + case EVENT_RESUME_UPDATING: + events.SetPhase(0); + break; + case EVENT_ASCEND_TO_THE_HEAVENS: + Talk(SAY_ALGALON_ASCEND); + DoCastAOE(SPELL_ASCEND_TO_THE_HEAVENS); + events.ScheduleEvent(EVENT_EVADE, 2500); + break; + case EVENT_EVADE: + EnterEvadeMode(); + break; + case EVENT_COSMIC_SMASH: + Talk(EMOTE_ALGALON_COSMIC_SMASH); + DoCastAOE(SPELL_COSMIC_SMASH); + events.ScheduleEvent(EVENT_COSMIC_SMASH, 25500); + break; + case EVENT_UNLOCK_YELL: + _hasYelled = false; + break; + case EVENT_OUTRO_START: + instance->SetBossState(BOSS_ALGALON, DONE); + break; + case EVENT_OUTRO_1: + me->RemoveAllAuras(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_RENAME); + break; + case EVENT_OUTRO_2: + _EnterEvadeMode(); + me->AddUnitState(UNIT_STATE_EVADE); + me->GetMotionMaster()->MovePoint(POINT_ALGALON_OUTRO, AlgalonOutroPos); + break; + case EVENT_OUTRO_3: + DoCastAOE(SPELL_KILL_CREDIT); + break; + case EVENT_OUTRO_4: + DoCastAOE(SPELL_SUPERMASSIVE_FAIL); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + break; + case EVENT_OUTRO_5: + if (Creature* brann = DoSummon(NPC_BRANN_BRONZBEARD_ALG, BrannOutroPos[0], 131500, TEMPSUMMON_TIMED_DESPAWN)) + brann->AI()->DoAction(ACTION_OUTRO); + break; + case EVENT_OUTRO_6: + Talk(SAY_ALGALON_OUTRO_1); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + break; + case EVENT_OUTRO_7: + Talk(SAY_ALGALON_OUTRO_2); + break; + case EVENT_OUTRO_8: + Talk(SAY_ALGALON_OUTRO_3); + break; + case EVENT_OUTRO_9: + Talk(SAY_ALGALON_OUTRO_4); + break; + case EVENT_OUTRO_10: + Talk(SAY_ALGALON_OUTRO_5); + break; + case EVENT_OUTRO_11: + me->SetStandState(UNIT_STAND_STATE_STAND); + DoCast(me, SPELL_TELEPORT); + me->DespawnOrUnsummon(1500); + break; + } + } + + DoMeleeAttackIfReady(); + } + + private: + bool _firstPull; + bool _fedOnTears; + bool _phaseTwo; + bool _fightWon; + bool _hasYelled; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetUlduarAI<boss_algalon_the_observerAI>(creature); + } +}; + +class npc_living_constellation : public CreatureScript +{ + public: + npc_living_constellation() : CreatureScript("npc_living_constellation") { } + + struct npc_living_constellationAI : public CreatureAI + { + npc_living_constellationAI(Creature* creature) : CreatureAI(creature) + { + } + + void Reset() + { + _events.Reset(); + _events.ScheduleEvent(EVENT_ARCANE_BARRAGE, 2500); + _isActive = false; + } + + uint32 GetData(uint32 /*type*/) + { + return _isActive ? 1 : 0; + } + + void DoAction(int32 const action) + { + switch (action) + { + case ACTION_ACTIVATE_STAR: + if (Creature* algalon = me->FindNearestCreature(NPC_ALGALON, 200.0f)) + { + if (Unit* target = algalon->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(algalon))) + { + me->SetReactState(REACT_AGGRESSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + AttackStart(target); + DoZoneInCombat(); + _isActive = true; + } + } + break; + case ACTION_BIG_BANG: + _events.SetPhase(PHASE_BIG_BANG); + _events.DelayEvents(9500); + _events.ScheduleEvent(EVENT_RESUME_UPDATING, 9500); + break; + } + } + + void SpellHit(Unit* caster, SpellInfo const* spell) + { + if (spell->Id != SPELL_CONSTELLATION_PHASE_EFFECT || caster->GetTypeId() != TYPEID_UNIT) + return; + + me->DespawnOrUnsummon(1); + if (InstanceScript* instance = me->GetInstanceScript()) + instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, EVENT_ID_SUPERMASSIVE_START); + caster->CastSpell((Unit*)NULL, SPELL_BLACK_HOLE_CREDIT, TRIGGERED_FULL_MASK); + caster->ToCreature()->DespawnOrUnsummon(1); + } + + void UpdateAI(uint32 const diff) + { + if (!(_events.GetPhaseMask() & PHASE_MASK_NO_UPDATE) && !UpdateVictim()) + return; + + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_ARCANE_BARRAGE: + DoCastAOE(SPELL_ARCANE_BARRAGE); + _events.ScheduleEvent(EVENT_ARCANE_BARRAGE, 2500); + break; + case EVENT_RESUME_UPDATING: + _events.SetPhase(0); + break; + } + } + } + + private: + EventMap _events; + bool _isActive; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetUlduarAI<npc_living_constellationAI>(creature); + } +}; + +class npc_collapsing_star : public CreatureScript +{ + public: + npc_collapsing_star() : CreatureScript("npc_collapsing_star") { } + + struct npc_collapsing_starAI : public PassiveAI + { + npc_collapsing_starAI(Creature* creature) : PassiveAI(creature) + { + _dying = false; + } + + void JustSummoned(Creature* summon) + { + if (summon->GetEntry() != NPC_BLACK_HOLE) + return; + + if (TempSummon* summ = me->ToTempSummon()) + if (Creature* algalon = ObjectAccessor::GetCreature(*me, summ->GetSummonerGUID())) + algalon->AI()->JustSummoned(summon); + + me->DespawnOrUnsummon(1); + } + + void DamageTaken(Unit* /*attacker*/, uint32& damage) + { + if (_dying) + { + damage = 0; + return; + } + + if (damage >= me->GetHealth()) + { + _dying = true; + damage = 0; + DoCast(me, SPELL_BLACK_HOLE_SPAWN_VISUAL, true); + DoCast(me, SPELL_SUMMON_BLACK_HOLE, true); + } + } + + bool _dying; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetUlduarAI<npc_collapsing_starAI>(creature); + } +}; + +class npc_brann_bronzebeard_algalon : public CreatureScript +{ + public: + npc_brann_bronzebeard_algalon() : CreatureScript("npc_brann_bronzebeard_algalon") { } + + struct npc_brann_bronzebeard_algalonAI : public CreatureAI + { + npc_brann_bronzebeard_algalonAI(Creature* creature) : CreatureAI(creature) + { + } + + void DoAction(int32 const action) + { + switch (action) + { + case ACTION_START_INTRO: + _currentPoint = 0; + _events.Reset(); + me->SetWalk(false); + _events.ScheduleEvent(EVENT_BRANN_MOVE_INTRO, 1); + break; + case ACTION_FINISH_INTRO: + Talk(SAY_BRANN_ALGALON_INTRO_2); + _events.ScheduleEvent(EVENT_BRANN_MOVE_INTRO, 1); + break; + case ACTION_OUTRO: + me->GetMotionMaster()->MovePoint(POINT_BRANN_OUTRO, BrannOutroPos[1]); + _events.ScheduleEvent(EVENT_BRANN_OUTRO_1, 89500); + _events.ScheduleEvent(EVENT_BRANN_OUTRO_2, 116500); + break; + } + } + + void MovementInform(uint32 movementType, uint32 pointId) + { + if (movementType != POINT_MOTION_TYPE) + return; + + uint32 delay = 1; + _currentPoint = pointId + 1; + switch (pointId) + { + case 2: + delay = 8000; + me->SetWalk(true); + break; + case 5: + me->SetWalk(false); + Talk(SAY_BRANN_ALGALON_INTRO_1); + _events.ScheduleEvent(EVENT_SUMMON_ALGALON, 7500); + return; + case 9: + me->DespawnOrUnsummon(1); + return; + case POINT_BRANN_OUTRO: + case POINT_BRANN_OUTRO_END: + return; + } + + _events.ScheduleEvent(EVENT_BRANN_MOVE_INTRO, delay); + } + + void UpdateAI(uint32 const diff) + { + UpdateVictim(); + + if (_events.Empty()) + return; + + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_BRANN_MOVE_INTRO: + if (_currentPoint < MAX_BRANN_WAYPOINTS_INTRO) + me->GetMotionMaster()->MovePoint(_currentPoint, BrannIntroWaypoint[_currentPoint]); + break; + case EVENT_SUMMON_ALGALON: + if (Creature* algalon = me->GetMap()->SummonCreature(NPC_ALGALON, AlgalonSummonPos)) + algalon->AI()->DoAction(ACTION_START_INTRO); + break; + case EVENT_BRANN_OUTRO_1: + Talk(SAY_BRANN_ALGALON_OUTRO); + break; + case EVENT_BRANN_OUTRO_2: + me->GetMotionMaster()->MovePoint(POINT_BRANN_OUTRO_END, BrannOutroPos[2]); + break; + } + } + } + + private: + EventMap _events; + uint32 _currentPoint; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetUlduarAI<npc_brann_bronzebeard_algalonAI>(creature); + } +}; + +class go_celestial_planetarium_access : public GameObjectScript +{ + public: + go_celestial_planetarium_access() : GameObjectScript("go_celestial_planetarium_access") {} + + struct go_celestial_planetarium_accessAI : public GameObjectAI + { + go_celestial_planetarium_accessAI(GameObject* go) : GameObjectAI(go) + { + } + + bool GossipHello(Player* player) + { + bool hasKey = true; + if (LockEntry const* lock = sLockStore.LookupEntry(go->GetGOInfo()->goober.lockId)) + { + hasKey = false; + for (uint32 i = 0; i < MAX_LOCK_CASE; ++i) + { + if (!lock->Index[i]) + continue; + + if (player->HasItemCount(lock->Index[i], 1)) + { + hasKey = true; + break; + } + } + } + + if (!hasKey) + return false; + + // Start Algalon event + go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); + _events.ScheduleEvent(EVENT_DESPAWN_CONSOLE, 5000); + if (Creature* brann = go->SummonCreature(NPC_BRANN_BRONZBEARD_ALG, BrannIntroSpawnPos)) + brann->AI()->DoAction(ACTION_START_INTRO); + + if (InstanceScript* instance = go->GetInstanceScript()) + { + instance->SetData(DATA_ALGALON_SUMMON_STATE, 1); + if (GameObject* sigil = ObjectAccessor::GetGameObject(*go, instance->GetData64(DATA_SIGILDOOR_01))) + sigil->SetGoState(GO_STATE_ACTIVE); + + if (GameObject* sigil = ObjectAccessor::GetGameObject(*go, instance->GetData64(DATA_SIGILDOOR_02))) + sigil->SetGoState(GO_STATE_ACTIVE); + } + + return false; + } + + void UpdateAI(uint32 diff) + { + if (_events.Empty()) + return; + + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_DESPAWN_CONSOLE: + go->Delete(); + break; + } + } + } + + EventMap _events; + }; + + GameObjectAI* GetAI(GameObject* go) const + { + return GetUlduarAI<go_celestial_planetarium_accessAI>(go); + } +}; + +class spell_algalon_phase_punch : public SpellScriptLoader +{ + public: + spell_algalon_phase_punch() : SpellScriptLoader("spell_algalon_phase_punch") { } + + class spell_algalon_phase_punch_AuraScript : public AuraScript + { + PrepareAuraScript(spell_algalon_phase_punch_AuraScript); + + void HandlePeriodic(AuraEffect const* /*aurEff*/) + { + PreventDefaultAction(); + if (GetStackAmount() != 1) + GetTarget()->RemoveAurasDueToSpell(PhasePunchAlphaId[GetStackAmount() - 2]); + GetTarget()->CastSpell(GetTarget(), PhasePunchAlphaId[GetStackAmount() - 1], TRIGGERED_FULL_MASK); + if (GetStackAmount() == 5) + Remove(AURA_REMOVE_BY_DEFAULT); + } + + void OnRemove(AuraEffect const*, AuraEffectHandleModes) + { + if (GetStackAmount() != 5) + GetTarget()->RemoveAurasDueToSpell(PhasePunchAlphaId[GetStackAmount() - 1]); + } + + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_algalon_phase_punch_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + OnEffectRemove += AuraEffectRemoveFn(spell_algalon_phase_punch_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_algalon_phase_punch_AuraScript(); + } +}; + +class NotVictimFilter +{ + public: + NotVictimFilter(Unit* caster) : _victim(caster->getVictim()) + { + } + + bool operator()(Unit* target) + { + return target != _victim; + } + + private: + Unit* _victim; +}; + +class spell_algalon_arcane_barrage : public SpellScriptLoader +{ + public: + spell_algalon_arcane_barrage() : SpellScriptLoader("spell_algalon_arcane_barrage") { } + + class spell_algalon_arcane_barrage_SpellScript : public SpellScript + { + PrepareSpellScript(spell_algalon_arcane_barrage_SpellScript); + + void SelectTarget(std::list<Unit*>& targets) + { + targets.remove_if(NotVictimFilter(GetCaster())); + } + + void Register() + { + OnUnitTargetSelect += SpellUnitTargetFn(spell_algalon_arcane_barrage_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_algalon_arcane_barrage_SpellScript(); + } +}; + +class ActiveConstellationFilter +{ + public: + bool operator()(Unit* target) const + { + return target->GetAI()->GetData(0); + } +}; + +class spell_algalon_trigger_3_adds : public SpellScriptLoader +{ + public: + spell_algalon_trigger_3_adds() : SpellScriptLoader("spell_algalon_trigger_3_adds") { } + + class spell_algalon_trigger_3_adds_SpellScript : public SpellScript + { + PrepareSpellScript(spell_algalon_trigger_3_adds_SpellScript); + + void SelectTarget(std::list<Unit*>& targets) + { + targets.remove_if(ActiveConstellationFilter()); + } + + void HandleDummy(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + Creature* target = GetHitCreature(); + if (!target) + return; + + target->AI()->DoAction(ACTION_ACTIVATE_STAR); + } + + void Register() + { + OnUnitTargetSelect += SpellUnitTargetFn(spell_algalon_trigger_3_adds_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_algalon_trigger_3_adds_SpellScript(); + } +}; + +class spell_algalon_collapse : public SpellScriptLoader +{ + public: + spell_algalon_collapse() : SpellScriptLoader("spell_algalon_collapse") { } + + class spell_algalon_collapse_AuraScript : public AuraScript + { + PrepareAuraScript(spell_algalon_collapse_AuraScript); + + void HandlePeriodic(AuraEffect const* /*aurEff*/) + { + PreventDefaultAction(); + GetTarget()->DealDamage(GetTarget(), GetTarget()->CountPctFromMaxHealth(1), NULL, NODAMAGE); + } + + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_algalon_collapse_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_algalon_collapse_AuraScript(); + } +}; + +class spell_algalon_big_bang : public SpellScriptLoader +{ + public: + spell_algalon_big_bang() : SpellScriptLoader("spell_algalon_big_bang") { } + + class spell_algalon_big_bang_SpellScript : public SpellScript + { + PrepareSpellScript(spell_algalon_big_bang_SpellScript); + + bool Load() + { + _targetCount = 0; + return true; + } + + void CountTargets(std::list<Unit*>& targets) + { + _targetCount = targets.size(); + } + + void CheckTargets() + { + if (!_targetCount) + GetCaster()->GetAI()->DoAction(ACTION_ASCEND); + } + + void Register() + { + OnUnitTargetSelect += SpellUnitTargetFn(spell_algalon_big_bang_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + AfterCast += SpellCastFn(spell_algalon_big_bang_SpellScript::CheckTargets); + } + + uint32 _targetCount; + }; + + SpellScript* GetSpellScript() const + { + return new spell_algalon_big_bang_SpellScript(); + } +}; + +class spell_algalon_remove_phase : public SpellScriptLoader +{ + public: + spell_algalon_remove_phase() : SpellScriptLoader("spell_algalon_remove_phase") { } + + class spell_algalon_remove_phase_AuraScript : public AuraScript + { + PrepareAuraScript(spell_algalon_remove_phase_AuraScript); + + void HandlePeriodic(AuraEffect const* /*aurEff*/) + { + PreventDefaultAction(); + GetTarget()->RemoveAurasByType(SPELL_AURA_PHASE); + } + + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_algalon_remove_phase_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_algalon_remove_phase_AuraScript(); + } +}; + +class spell_algalon_cosmic_smash : public SpellScriptLoader +{ + public: + spell_algalon_cosmic_smash() : SpellScriptLoader("spell_algalon_cosmic_smash") { } + + class spell_algalon_cosmic_smash_SpellScript : public SpellScript + { + PrepareSpellScript(spell_algalon_cosmic_smash_SpellScript); + + void ModDestHeight(SpellEffIndex /*effIndex*/) + { + Position offset = {0.0f, 0.0f, 65.0f, 0.0f}; + const_cast<WorldLocation*>(GetExplTargetDest())->RelocateOffset(offset); + GetHitDest()->RelocateOffset(offset); + } + + void Register() + { + OnEffectLaunch += SpellEffectFn(spell_algalon_cosmic_smash_SpellScript::ModDestHeight, EFFECT_0, SPELL_EFFECT_SUMMON); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_algalon_cosmic_smash_SpellScript(); + } +}; + +class spell_algalon_cosmic_smash_damage : public SpellScriptLoader +{ + public: + spell_algalon_cosmic_smash_damage() : SpellScriptLoader("spell_algalon_cosmic_smash_damage") { } + + class spell_algalon_cosmic_smash_damage_SpellScript : public SpellScript + { + PrepareSpellScript(spell_algalon_cosmic_smash_damage_SpellScript); + + void RecalculateDamage() + { + if (!GetExplTargetDest() || !GetHitUnit()) + return; + + float distance = GetHitUnit()->GetDistance2d(GetExplTargetDest()->GetPositionX(), GetExplTargetDest()->GetPositionY()); + if (distance > 6.0f) + SetHitDamage(int32(float(GetHitDamage()) / distance) * 2); + } + + void Register() + { + OnHit += SpellHitFn(spell_algalon_cosmic_smash_damage_SpellScript::RecalculateDamage); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_algalon_cosmic_smash_damage_SpellScript(); + } +}; + +class spell_algalon_supermassive_fail : public SpellScriptLoader +{ + public: + spell_algalon_supermassive_fail() : SpellScriptLoader("spell_algalon_supermassive_fail") { } + + class spell_algalon_supermassive_fail_SpellScript : public SpellScript + { + PrepareSpellScript(spell_algalon_supermassive_fail_SpellScript); + + void RecalculateDamage() + { + if (!GetHitPlayer()) + return; + + GetHitPlayer()->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, ACHIEVEMENT_CRITERIA_CONDITION_NO_SPELL_HIT, GetSpellInfo()->Id, true); + } + + void Register() + { + OnHit += SpellHitFn(spell_algalon_supermassive_fail_SpellScript::RecalculateDamage); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_algalon_supermassive_fail_SpellScript(); + } +}; + +class achievement_he_feeds_on_your_tears : public AchievementCriteriaScript +{ + public: + achievement_he_feeds_on_your_tears() : AchievementCriteriaScript("achievement_he_feeds_on_your_tears") { } + + bool OnCheck(Player* /*source*/, Unit* target) + { + return !target->GetAI()->GetData(DATA_HAS_FED_ON_TEARS); + } +}; + +void AddSC_boss_algalon_the_observer() +{ + new boss_algalon_the_observer(); + new npc_living_constellation(); + new npc_collapsing_star(); + new npc_brann_bronzebeard_algalon(); + new go_celestial_planetarium_access(); + new spell_algalon_phase_punch(); + new spell_algalon_arcane_barrage(); + new spell_algalon_trigger_3_adds(); + new spell_algalon_collapse(); + new spell_algalon_big_bang(); + new spell_algalon_remove_phase(); + new spell_algalon_cosmic_smash(); + new spell_algalon_cosmic_smash_damage(); + new spell_algalon_supermassive_fail(); + new achievement_he_feeds_on_your_tears(); +} diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp index eadc524348b..0967c38c2e7 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp @@ -251,7 +251,7 @@ class boss_steelbreaker : public CreatureScript } } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { DoScriptText(RAND(SAY_STEELBREAKER_DEATH_1, SAY_STEELBREAKER_DEATH_2), me); if (IsEncounterComplete(instance, me)) @@ -375,7 +375,7 @@ class boss_runemaster_molgeim : public CreatureScript } } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { DoScriptText(RAND(SAY_MOLGEIM_DEATH_1, SAY_MOLGEIM_DEATH_2), me); if (IsEncounterComplete(instance, me)) @@ -575,7 +575,7 @@ class boss_stormcaller_brundir : public CreatureScript _Reset(); phase = 0; me->RemoveAllAuras(); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetDisableGravity(false); me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_INTERRUPT, false); // Should be interruptable unless overridden by spell (Overload) me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, false); // Reset immumity, Brundir should be stunnable by default RespawnEncounter(instance, me); @@ -616,7 +616,7 @@ class boss_stormcaller_brundir : public CreatureScript } } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { DoScriptText(RAND(SAY_BRUNDIR_DEATH_1, SAY_BRUNDIR_DEATH_2), me); if (IsEncounterComplete(instance, me)) @@ -681,7 +681,7 @@ class boss_stormcaller_brundir : public CreatureScript DoCast(RAID_MODE(SPELL_LIGHTNING_TENDRILS_10M, SPELL_LIGHTNING_TENDRILS_25M)); DoCast(SPELL_LIGHTNING_TENDRILS_VISUAL); me->AttackStop(); - //me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + //me->SetLevitate(true); me->GetMotionMaster()->Initialize(); me->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), FINAL_FLIGHT_Z); events.DelayEvents(35000); @@ -708,7 +708,7 @@ class boss_stormcaller_brundir : public CreatureScript events.ScheduleEvent(EVENT_GROUND, 2500); break; case EVENT_GROUND: - //me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + //me->SetLevitate(false); me->RemoveAurasDueToSpell(RAID_MODE(SPELL_LIGHTNING_TENDRILS_10M, SPELL_LIGHTNING_TENDRILS_25M)); me->RemoveAurasDueToSpell(SPELL_LIGHTNING_TENDRILS_VISUAL); DoStartMovement(me->getVictim()); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp index 1c478cd83e9..472ff153d73 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp @@ -204,7 +204,7 @@ class boss_auriaya : public CreatureScript } } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); _JustDied(); @@ -298,14 +298,14 @@ class npc_auriaya_seeping_trigger : public CreatureScript void Reset() { - me->ForcedDespawn(600000); + me->DespawnOrUnsummon(600000); DoCast(me, SPELL_SEEPING_ESSENCE); } void UpdateAI(uint32 const /*diff*/) { if (instance->GetBossState(BOSS_AURIAYA) != IN_PROGRESS) - me->ForcedDespawn(); + me->DespawnOrUnsummon(); } private: @@ -376,7 +376,7 @@ class npc_sanctum_sentry : public CreatureScript DoMeleeAttackIfReady(); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { if (Creature* Auriaya = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_AURIAYA))) Auriaya->AI()->DoAction(ACTION_CRAZY_CAT_LADY); @@ -451,7 +451,7 @@ class npc_feral_defender : public CreatureScript DoMeleeAttackIfReady(); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { DoCast(me, SPELL_SUMMON_ESSENCE); if (Creature* Auriaya = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_AURIAYA))) diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index c4f973726bc..0e453eceaa1 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -26,6 +26,10 @@ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" +#include "Cell.h" +#include "CellImpl.h" +#include "GridNotifiers.h" +#include "GridNotifiersImpl.h" #include "CombatAI.h" #include "PassiveAI.h" #include "ObjectMgr.h" @@ -167,7 +171,7 @@ enum Yells enum MiscellanousData { - // Other actions are in Ulduar.h + // Other Actions are in Ulduar.h ACTION_START_HARD_MODE = 5, ACTION_SPAWN_VEHICLES = 6, // Amount of seats depending on Raid mode @@ -324,7 +328,7 @@ class boss_flame_leviathan : public CreatureScript DoScriptText(SAY_AGGRO, me); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { _JustDied(); // Set Field Flags 67108928 = 64 | 67108864 = UNIT_FLAG_UNK_6 | UNIT_FLAG_SKINNABLE @@ -573,7 +577,7 @@ class boss_flame_leviathan_seat : public CreatureScript { ASSERT(vehicle); me->SetReactState(REACT_PASSIVE); - me->SetDisplayId(me->GetCreatureInfo()->Modelid2); + me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); instance = creature->GetInstanceScript(); } @@ -639,7 +643,7 @@ class boss_flame_leviathan_defense_cannon : public CreatureScript uint32 NapalmTimer; - void Reset () + void Reset() { NapalmTimer = 5*IN_MILLISECONDS; DoCast(me, AURA_STEALTH_DETECTION); @@ -883,7 +887,7 @@ class npc_colossus : public CreatureScript InstanceScript* instance; - void JustDied(Unit* /*Who*/) + void JustDied(Unit* /*killer*/) { if (me->GetHomePosition().IsInDist(Center, 50.f)) instance->SetData(DATA_COLOSSUS, instance->GetData(DATA_COLOSSUS)+1); @@ -960,8 +964,9 @@ public: me->SetReactState(REACT_PASSIVE); } - void WaypointReached(uint32 /*i*/) + void WaypointReached(uint32 /*waypointId*/) { + } void Reset() @@ -1151,7 +1156,7 @@ class npc_lorekeeper : public CreatureScript } }; - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 action) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); InstanceScript* instance = creature->GetInstanceScript(); @@ -1224,10 +1229,10 @@ class npc_brann_bronzebeard : public CreatureScript public: npc_brann_bronzebeard() : CreatureScript("npc_brann_bronzebeard") { } - //bool OnGossipSelect(Player* player, Creature* creature, uint32 uiSender, uint32 uiAction) + //bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) //{ // player->PlayerTalkClass->ClearMenus(); - // switch(uiAction) + // switch(action) // { // case GOSSIP_ACTION_INFO_DEF+1: // if (player) @@ -1268,7 +1273,7 @@ class go_ulduar_tower : public GameObjectScript public: go_ulduar_tower() : GameObjectScript("go_ulduar_tower") { } - void OnDestroyed(GameObject* go, Player* /*player*/, uint32 /*value*/) + void OnDestroyed(GameObject* go, Player* /*player*/) { InstanceScript* instance = go->GetInstanceScript(); if (!instance) @@ -1673,7 +1678,7 @@ class spell_pursue : public SpellScriptLoader else { //! In the end, only one target should be selected - _target = SelectRandomContainerElement(targets); + _target = Trinity::Containers::SelectRandomContainerElement(targets); FilterTargetsSubsequently(targets); } } @@ -1681,7 +1686,7 @@ class spell_pursue : public SpellScriptLoader void FilterTargetsSubsequently(std::list<Unit*>& targets) { targets.clear(); - if(_target) + if (_target) targets.push_back(_target); } @@ -1738,7 +1743,7 @@ class spell_vehicle_throw_passenger : public SpellScriptLoader { // use 99 because it is 3d search std::list<WorldObject*> targetList; - Trinity::WorldObjectSpellAreaTargetCheck check(99, GetTargetDest(), GetCaster(), GetCaster(), GetSpellInfo(), TARGET_CHECK_DEFAULT, NULL); + Trinity::WorldObjectSpellAreaTargetCheck check(99, GetExplTargetDest(), GetCaster(), GetCaster(), GetSpellInfo(), TARGET_CHECK_DEFAULT, NULL); Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellAreaTargetCheck> searcher(GetCaster(), targetList, check); GetCaster()->GetMap()->VisitAll(GetCaster()->m_positionX, GetCaster()->m_positionY, 99, searcher); float minDist = 99 * 99; @@ -1752,7 +1757,7 @@ class spell_vehicle_throw_passenger : public SpellScriptLoader if (Unit* device = seat->GetPassenger(2)) if (!device->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) { - float dist = unit->GetExactDistSq(targets.GetDst()); + float dist = unit->GetExactDistSq(targets.GetDstPos()); if (dist < minDist) { minDist = dist; @@ -1760,13 +1765,13 @@ class spell_vehicle_throw_passenger : public SpellScriptLoader } } } - if (target && target->IsWithinDist2d(targets.GetDst(), GetSpellInfo()->Effects[effIndex].CalcRadius() * 2)) // now we use *2 because the location of the seat is not correct + if (target && target->IsWithinDist2d(targets.GetDstPos(), GetSpellInfo()->Effects[effIndex].CalcRadius() * 2)) // now we use *2 because the location of the seat is not correct passenger->EnterVehicle(target, 0); else { passenger->ExitVehicle(); float x, y, z; - targets.GetDst()->GetPosition(x, y, z); + targets.GetDstPos()->GetPosition(x, y, z); passenger->GetMotionMaster()->MoveJump(x, y, z, targets.GetSpeedXY(), targets.GetSpeedZ()); } } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp index 159e2a9702b..a3c9cb847e5 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp @@ -245,7 +245,7 @@ class npc_iron_roots : public CreatureScript me->SetInCombatWith(summoner); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { if (Player* target = ObjectAccessor::GetPlayer(*me, summonerGUID)) { @@ -507,7 +507,7 @@ class boss_freya : public CreatureScript for (uint8 n = 0; n < 3; ++n) { summons.remove(Elemental[n][i]->GetGUID()); - Elemental[n][i]->ForcedDespawn(5000); + Elemental[n][i]->DespawnOrUnsummon(5000); trioDefeated[i] = true; Elemental[n][i]->CastSpell(me, SPELL_REMOVE_10STACK, true); } @@ -590,7 +590,7 @@ class boss_freya : public CreatureScript waveCount++; } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { //! Freya's chest is dynamically spawned on death by different spells. const uint32 summonSpell[2][4] = @@ -664,12 +664,12 @@ class boss_freya : public CreatureScript case NPC_DETONATING_LASHER: summoned->CastSpell(me, SPELL_REMOVE_2STACK, true); summoned->CastSpell(who, SPELL_DETONATE, true); - summoned->ForcedDespawn(5000); + summoned->DespawnOrUnsummon(5000); summons.remove(summoned->GetGUID()); break; case NPC_ANCIENT_CONSERVATOR: summoned->CastSpell(me, SPELL_REMOVE_25STACK, true); - summoned->ForcedDespawn(5000); + summoned->DespawnOrUnsummon(5000); summons.remove(summoned->GetGUID()); break; } @@ -710,12 +710,12 @@ class boss_elder_brightleaf : public CreatureScript DoScriptText(RAND(SAY_BRIGHTLEAF_SLAY_1, SAY_BRIGHTLEAF_SLAY_2), me); } - void JustDied(Unit* who) + void JustDied(Unit* killer) { _JustDied(); DoScriptText(SAY_BRIGHTLEAF_DEATH, me); - if (who && who->GetTypeId() == TYPEID_PLAYER) + if (killer && killer->GetTypeId() == TYPEID_PLAYER) { if (Creature* Ironbranch = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_IRONBRANCH))) Ironbranch->AI()->DoAction(ACTION_ELDER_DEATH); @@ -830,12 +830,12 @@ class boss_elder_stonebark : public CreatureScript DoScriptText(RAND(SAY_STONEBARK_SLAY_1, SAY_STONEBARK_SLAY_2), me); } - void JustDied(Unit* who) + void JustDied(Unit* killer) { _JustDied(); DoScriptText(SAY_STONEBARK_DEATH, me); - if (who && who->GetTypeId() == TYPEID_PLAYER) + if (killer && killer->GetTypeId() == TYPEID_PLAYER) { if (Creature* Ironbranch = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_IRONBRANCH))) Ironbranch->AI()->DoAction(ACTION_ELDER_DEATH); @@ -956,12 +956,12 @@ class boss_elder_ironbranch : public CreatureScript DoScriptText(RAND(SAY_IRONBRANCH_SLAY_1, SAY_IRONBRANCH_SLAY_2), me); } - void JustDied(Unit* who) + void JustDied(Unit* killer) { _JustDied(); DoScriptText(SAY_IRONBRANCH_DEATH, me); - if (who && who->GetTypeId() == TYPEID_PLAYER) + if (killer && killer->GetTypeId() == TYPEID_PLAYER) { if (Creature* Brightleaf = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_BRIGHTLEAF))) Brightleaf->AI()->DoAction(ACTION_ELDER_DEATH); @@ -1138,7 +1138,7 @@ class npc_ancient_water_spirit : public CreatureScript DoMeleeAttackIfReady(); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_FREYA))) { @@ -1204,7 +1204,7 @@ class npc_storm_lasher : public CreatureScript DoMeleeAttackIfReady(); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_FREYA))) { @@ -1251,7 +1251,7 @@ class npc_snaplasher : public CreatureScript DoMeleeAttackIfReady(); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_FREYA))) { @@ -1385,7 +1385,7 @@ class npc_healthy_spore : public CreatureScript if (lifeTimer <= diff) { me->RemoveAurasDueToSpell(SPELL_GROW); - me->ForcedDespawn(2200); + me->DespawnOrUnsummon(2200); lifeTimer = urand(22000, 30000); } else @@ -1423,7 +1423,7 @@ class npc_eonars_gift : public CreatureScript { me->RemoveAurasDueToSpell(SPELL_GROW); DoCast(SPELL_LIFEBINDERS_GIFT); - me->ForcedDespawn(2500); + me->DespawnOrUnsummon(2500); lifeBindersGiftTimer = 12000; } else diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp index c7918f85245..3556bf188de 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp @@ -211,7 +211,7 @@ class boss_general_vezax : public CreatureScript DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { _JustDied(); DoScriptText(SAY_DEATH, me); @@ -290,7 +290,7 @@ class boss_general_vezax : public CreatureScript if (size < playersMin) return NULL; - return SelectRandomContainerElement(PlayerList); + return Trinity::Containers::SelectRandomContainerElement(PlayerList); } return NULL; @@ -323,7 +323,7 @@ class boss_saronite_animus : public CreatureScript events.ScheduleEvent(EVENT_PROFOUND_OF_DARKNESS, 3000); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { if (Creature* Vezax = me->GetCreature(*me, instance->GetData64(BOSS_VEZAX))) Vezax->AI()->DoAction(ACTION_ANIMUS_DIE); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp index 33f50d0b3de..c9fe1c5b707 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp @@ -179,7 +179,7 @@ class npc_flash_freeze : public CreatureScript npc_flash_freezeAI(Creature* creature) : ScriptedAI(creature) { instance = me->GetInstanceScript(); - me->SetDisplayId(me->GetCreatureInfo()->Modelid2); + me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_STUNNED | UNIT_FLAG_PACIFIED); } @@ -246,7 +246,7 @@ class npc_ice_block : public CreatureScript npc_ice_blockAI(Creature* creature) : ScriptedAI(creature) { instance = me->GetInstanceScript(); - me->SetDisplayId(me->GetCreatureInfo()->Modelid2); + me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_STUNNED | UNIT_FLAG_PACIFIED); targetGUID = 0; } @@ -512,7 +512,7 @@ class npc_icicle : public CreatureScript { npc_icicleAI(Creature* creature) : ScriptedAI(creature) { - me->SetDisplayId(me->GetCreatureInfo()->Modelid1); + me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PACIFIED | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_PASSIVE); } @@ -560,7 +560,7 @@ class npc_snowpacked_icicle : public CreatureScript { npc_snowpacked_icicleAI(Creature* creature) : ScriptedAI(creature) { - me->SetDisplayId(me->GetCreatureInfo()->Modelid2); + me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PACIFIED); me->SetReactState(REACT_PASSIVE); } @@ -651,7 +651,7 @@ class npc_hodir_priest : public CreatureScript DoSpellAttackIfReady(SPELL_SMITE); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance ? instance->GetData64(BOSS_HODIR) : 0)) Hodir->AI()->DoAction(ACTION_I_HAVE_THE_COOLEST_FRIENDS); @@ -713,7 +713,7 @@ class npc_hodir_shaman : public CreatureScript DoSpellAttackIfReady(SPELL_LAVA_BURST); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance ? instance->GetData64(BOSS_HODIR) : 0)) Hodir->AI()->DoAction(ACTION_I_HAVE_THE_COOLEST_FRIENDS); @@ -774,7 +774,7 @@ class npc_hodir_druid : public CreatureScript DoSpellAttackIfReady(SPELL_WRATH); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance ? instance->GetData64(BOSS_HODIR) : 0)) Hodir->AI()->DoAction(ACTION_I_HAVE_THE_COOLEST_FRIENDS); @@ -854,7 +854,7 @@ class npc_hodir_mage : public CreatureScript DoSpellAttackIfReady(SPELL_FIREBALL); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance ? instance->GetData64(BOSS_HODIR) : 0)) Hodir->AI()->DoAction(ACTION_I_HAVE_THE_COOLEST_FRIENDS); @@ -881,7 +881,7 @@ class npc_toasty_fire : public CreatureScript { npc_toasty_fireAI(Creature* creature) : ScriptedAI(creature) { - me->SetDisplayId(me->GetCreatureInfo()->Modelid2); + me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); } void Reset() diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp index d8a3ef0b8df..540876f421b 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp @@ -148,7 +148,7 @@ class boss_ignis : public CreatureScript instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEVEMENT_IGNIS_START_EVENT); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { _JustDied(); DoScriptText(SAY_DEATH, me); @@ -371,15 +371,15 @@ class npc_scorch_ground : public CreatureScript creature->SetDisplayId(16925); //model 2 in db cannot overwrite wdb fields } - void MoveInLineOfSight(Unit* unit) + void MoveInLineOfSight(Unit* who) { if (!_heat) { - if (unit->GetEntry() == NPC_IRON_CONSTRUCT) + if (who->GetEntry() == NPC_IRON_CONSTRUCT) { - if (!unit->HasAura(SPELL_HEAT) || !unit->HasAura(SPELL_MOLTEN)) + if (!who->HasAura(SPELL_HEAT) || !who->HasAura(SPELL_MOLTEN)) { - _constructGUID = unit->GetGUID(); + _constructGUID = who->GetGUID(); _heat = true; } } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp index d5034e4827e..d89d640b083 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp @@ -135,7 +135,7 @@ class boss_kologarn : public CreatureScript eyebeamTarget = 0; } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); DoCast(SPELL_KOLOGARN_PACIFY); @@ -184,11 +184,8 @@ class boss_kologarn : public CreatureScript if (Creature* rubbleStalker = who->FindNearestCreature(NPC_RUBBLE_STALKER, 70.0f)) { - if (rubbleStalker) - { - rubbleStalker->CastSpell(rubbleStalker, SPELL_FALLING_RUBBLE, true); - rubbleStalker->CastSpell(rubbleStalker, SPELL_SUMMON_RUBBLE, true); - } + rubbleStalker->CastSpell(rubbleStalker, SPELL_FALLING_RUBBLE, true); + rubbleStalker->CastSpell(rubbleStalker, SPELL_SUMMON_RUBBLE, true); } if (!right && !left) diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp index 45f9a1fa012..e8e938dc06b 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp @@ -177,7 +177,7 @@ class boss_razorscale_controller : public CreatureScript { boss_razorscale_controllerAI(Creature* creature) : BossAI(creature, DATA_RAZORSCALE_CONTROL) { - me->SetDisplayId(me->GetCreatureInfo()->Modelid2); + me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); } void Reset() @@ -211,7 +211,7 @@ class boss_razorscale_controller : public CreatureScript } } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { _JustDied(); } @@ -330,7 +330,7 @@ class boss_razorscale : public CreatureScript void Reset() { _Reset(); - me->SetFlying(true); + me->SetCanFly(true); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_PASSIVE); PermaGround = false; @@ -354,7 +354,7 @@ class boss_razorscale : public CreatureScript events.ScheduleEvent(EVENT_FLIGHT, 0, 0, PHASE_GROUND); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { _JustDied(); if (Creature* controller = ObjectAccessor::GetCreature(*me, instance ? instance->GetData64(DATA_RAZORSCALE_CONTROL) : 0)) @@ -419,7 +419,7 @@ class boss_razorscale : public CreatureScript case EVENT_FLIGHT: phase = PHASE_FLIGHT; events.SetPhase(PHASE_FLIGHT); - me->SetFlying(true); + me->SetCanFly(true); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_PASSIVE); me->AttackStop(); @@ -430,7 +430,7 @@ class boss_razorscale : public CreatureScript ++FlyCount; return; case EVENT_LAND: - me->SetFlying(false); + me->SetCanFly(false); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED | UNIT_FLAG_PACIFIED); if (Creature* commander = ObjectAccessor::GetCreature(*me, instance ? instance->GetData64(DATA_EXPEDITION_COMMANDER) : 0)) @@ -524,7 +524,7 @@ class boss_razorscale : public CreatureScript me->MonsterTextEmote(EMOTE_PERMA, 0, true); phase = PHASE_PERMAGROUND; events.SetPhase(PHASE_PERMAGROUND); - me->SetFlying(false); + me->SetCanFly(false); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_AGGRESSIVE); me->RemoveAurasDueToSpell(SPELL_HARPOON_TRIGGER); @@ -647,7 +647,7 @@ class npc_expedition_commander : public CreatureScript for (uint8 n = 0; n < RAID_MODE(2, 4); n++) { Engineer[n] = me->SummonCreature(NPC_ENGINEER, PosEngSpawn, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000); - Engineer[n]->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + Engineer[n]->SetWalk(false); Engineer[n]->SetSpeed(MOVE_RUN, 0.5f); Engineer[n]->SetHomePosition(PosEngRepair[n]); Engineer[n]->GetMotionMaster()->MoveTargetedHome(); @@ -660,7 +660,7 @@ class npc_expedition_commander : public CreatureScript for (uint8 n = 0; n < 4; n++) { Defender[n] = me->SummonCreature(NPC_DEFENDER, PosDefSpawn[n], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000); - Defender[n]->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + Defender[n]->SetWalk(false); Defender[n]->SetHomePosition(PosDefCombat[n]); Defender[n]->GetMotionMaster()->MoveTargetedHome(); } @@ -1006,7 +1006,7 @@ class spell_razorscale_devouring_flame : public SpellScriptLoader PreventHitDefaultEffect(effIndex); Unit* caster = GetCaster(); uint32 entry = uint32(GetSpellInfo()->Effects[effIndex].MiscValue); - WorldLocation const* summonLocation = GetTargetDest(); + WorldLocation const* summonLocation = GetExplTargetDest(); if (!caster || !summonLocation) return; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp index 72741ee0679..084cd3e0f86 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp @@ -73,7 +73,7 @@ public: DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); _JustDied(); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp index 724eb45d586..c7091b42c5a 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp @@ -244,7 +244,7 @@ class boss_xt002 : public CreatureScript DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); _JustDied(); @@ -947,13 +947,19 @@ class spell_xt002_tympanic_tantrum : public SpellScriptLoader void FilterTargets(std::list<Unit*>& unitList) { - unitList.remove_if (PlayerOrPetCheck()); + unitList.remove_if(PlayerOrPetCheck()); + } + + void RecalculateDamage() + { + SetHitDamage(GetHitUnit()->CountPctFromMaxHealth(GetHitDamage())); } void Register() { OnUnitTargetSelect += SpellUnitTargetFn(spell_xt002_tympanic_tantrum_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); OnUnitTargetSelect += SpellUnitTargetFn(spell_xt002_tympanic_tantrum_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + OnHit += SpellHitFn(spell_xt002_tympanic_tantrum_SpellScript::RecalculateDamage); } }; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp index 3f01f21b189..58ba125b994 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp @@ -18,18 +18,27 @@ #include "ScriptMgr.h" #include "ulduar.h" -enum Sara_Yells +enum Sara { - SAY_SARA_PREFIGHT_1 = -1603310, - SAY_SARA_PREFIGHT_2 = -1603311, - SAY_SARA_AGGRO_1 = -1603312, - SAY_SARA_AGGRO_2 = -1603313, - SAY_SARA_AGGRO_3 = -1603314, - SAY_SARA_SLAY_1 = -1603315, - SAY_SARA_SLAY_2 = -1603316, - WHISP_SARA_INSANITY = -1603317, - SAY_SARA_PHASE2_1 = -1603318, - SAY_SARA_PHASE2_2 = -1603319, + // text + YELL_SARA_PREFIGHT = 0, + YELL_COMBAT_PHASE_1 = 1, + YELL_COMBAT_PHASE_2 = 2, + YELL_SLAY = 3, + + // Phase 1 spells + SPELL_SARAS_ANGER_1 = 63147, // Target Entry 33136 + SPELL_SARAS_ANGER_2 = 63744, // Target Entry 33136 + SPELL_SARAS_FEVOR_1 = 63138, // Target Player + SPELL_SARAS_FEVOR_2 = 63747, // Target Player + SPELL_SARAS_BLESSING_1 = 63134, // Target Player + SPELL_SARAS_BLESSING_2 = 63745, // Target Self + + // Phase 2 spells + SPELL_PHYCHOSIS = 63795, // Target Self + SPELL_MALADY_OF_THE_MIND = 63830, // Target Self + SPELL_DEATH_RAY = 63891, // Target Self + SPELL_BRAIN_LINK = 63802, // Target Self }; enum YoggSaron_Yells diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp index e12393f047f..654d763ddbc 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp @@ -22,9 +22,14 @@ static DoorData const doorData[] = { - { GO_LEVIATHAN_DOOR, BOSS_LEVIATHAN, DOOR_TYPE_ROOM, BOUNDARY_S }, - { GO_XT_002_DOOR, BOSS_XT002, DOOR_TYPE_ROOM, BOUNDARY_S }, - { 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE }, + {GO_LEVIATHAN_DOOR, BOSS_LEVIATHAN, DOOR_TYPE_ROOM, BOUNDARY_S }, + {GO_XT_002_DOOR, BOSS_XT002, DOOR_TYPE_ROOM, BOUNDARY_S }, + {GO_DOODAD_UL_SIGILDOOR_03, BOSS_ALGALON, DOOR_TYPE_ROOM, BOUNDARY_W }, + {GO_DOODAD_UL_UNIVERSEFLOOR_01, BOSS_ALGALON, DOOR_TYPE_ROOM, BOUNDARY_NONE }, + {GO_DOODAD_UL_UNIVERSEFLOOR_02, BOSS_ALGALON, DOOR_TYPE_SPAWN_HOLE, BOUNDARY_NONE }, + {GO_DOODAD_UL_UNIVERSEGLOBE01, BOSS_ALGALON, DOOR_TYPE_SPAWN_HOLE, BOUNDARY_NONE }, + {GO_DOODAD_UL_ULDUAR_TRAPDOOR_03, BOSS_ALGALON, DOOR_TYPE_SPAWN_HOLE, BOUNDARY_NONE }, + {0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE }, }; class instance_ulduar : public InstanceMapScript @@ -36,7 +41,6 @@ class instance_ulduar : public InstanceMapScript { instance_ulduar_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { } - uint32 Encounter[MAX_ENCOUNTER]; std::string m_strInstData; // Creatures @@ -72,6 +76,12 @@ class instance_ulduar : public InstanceMapScript uint64 HodirDoorGUID; uint64 HodirIceDoorGUID; uint64 ArchivumDoorGUID; + uint64 AlgalonSigilDoorGUID[3]; + uint64 AlgalonFloorGUID[2]; + uint64 AlgalonUniverseGUID; + uint64 AlgalonTrapdoorGUID; + uint64 BrannBronzebeardAlgGUID; + uint64 GiftOfTheObserverGUID; // Miscellaneous uint32 TeamInInstance; @@ -111,35 +121,49 @@ class instance_ulduar : public InstanceMapScript HodirDoorGUID = 0; HodirIceDoorGUID = 0; ArchivumDoorGUID = 0; + AlgalonUniverseGUID = 0; + AlgalonTrapdoorGUID = 0; + BrannBronzebeardAlgGUID = 0; + GiftOfTheObserverGUID = 0; + _algalonTimer = 61; + _maxArmorItemLevel = 0; + _maxWeaponItemLevel = 0; TeamInInstance = 0; HodirRareCacheData = 0; ColossusData = 0; elderCount = 0; conSpeedAtory = false; Unbroken = true; + _summonAlgalon = false; - memset(Encounter, 0, sizeof(Encounter)); + memset(AlgalonSigilDoorGUID, 0, sizeof(AlgalonSigilDoorGUID)); + memset(AlgalonFloorGUID, 0, sizeof(AlgalonFloorGUID)); memset(XTToyPileGUIDs, 0, sizeof(XTToyPileGUIDs)); memset(AssemblyGUIDs, 0, sizeof(AssemblyGUIDs)); memset(RazorHarpoonGUIDs, 0, sizeof(RazorHarpoonGUIDs)); memset(KeeperGUIDs, 0, sizeof(KeeperGUIDs)); } - bool IsEncounterInProgress() const + void FillInitialWorldStates(WorldPacket& packet) { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - { - if (Encounter[i] == IN_PROGRESS) - return true; - } - - return false; + packet << uint32(WORLD_STATE_ALGALON_TIMER_ENABLED) << uint32(_algalonTimer && _algalonTimer <= 60); + packet << uint32(WORLD_STATE_ALGALON_DESPAWN_TIMER) << uint32(std::min<uint32>(_algalonTimer, 60)); } void OnPlayerEnter(Player* player) { if (!TeamInInstance) TeamInInstance = player->GetTeam(); + + if (_summonAlgalon) + { + _summonAlgalon = false; + TempSummon* algalon = instance->SummonCreature(NPC_ALGALON, AlgalonLandPos); + if (_algalonTimer && _algalonTimer <= 60) + algalon->AI()->DoAction(ACTION_INIT_ALGALON); + else + algalon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + } } void OnCreatureCreate(Creature* creature) @@ -234,7 +258,6 @@ class instance_ulduar : public InstanceMapScript case NPC_ALGALON: AlgalonGUID = creature->GetGUID(); break; - // Hodir's Helper NPCs case NPC_EIVI_NIGHTFEATHER: if (TeamInInstance == HORDE) @@ -268,9 +291,32 @@ class instance_ulduar : public InstanceMapScript if (TeamInInstance == HORDE) creature->UpdateEntry(NPC_BATTLE_PRIEST_GINA, HORDE); break; + case NPC_BRANN_BRONZBEARD_ALG: + BrannBronzebeardAlgGUID = creature->GetGUID(); + break; + //! These creatures are summoned by something else than Algalon + //! but need to be controlled/despawned by him - so they need to be + //! registered in his summon list + case NPC_ALGALON_VOID_ZONE_VISUAL_STALKER: + case NPC_ALGALON_STALKER_ASTEROID_TARGET_01: + case NPC_ALGALON_STALKER_ASTEROID_TARGET_02: + case NPC_UNLEASHED_DARK_MATTER: + if (Creature* algalon = instance->GetCreature(AlgalonGUID)) + algalon->AI()->JustSummoned(creature); + break; } + } - } + void OnCreatureRemove(Creature* creature) + { + switch (creature->GetEntry()) + { + case NPC_BRANN_BRONZBEARD_ALG: + if (BrannBronzebeardAlgGUID == creature->GetGUID()) + BrannBronzebeardAlgGUID = 0; + break; + } + } void OnGameObjectCreate(GameObject* gameObject) { @@ -341,6 +387,45 @@ class instance_ulduar : public InstanceMapScript if (GetBossState(BOSS_ASSEMBLY_OF_IRON) != DONE) HandleGameObject(ArchivumDoorGUID, false); break; + case GO_CELESTIAL_PLANETARIUM_ACCESS_10: + case GO_CELESTIAL_PLANETARIUM_ACCESS_25: + if (_algalonSummoned) + gameObject->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); + break; + case GO_DOODAD_UL_SIGILDOOR_01: + AlgalonSigilDoorGUID[0] = gameObject->GetGUID(); + if (_algalonSummoned) + gameObject->SetGoState(GO_STATE_ACTIVE); + break; + case GO_DOODAD_UL_SIGILDOOR_02: + AlgalonSigilDoorGUID[1] = gameObject->GetGUID(); + if (_algalonSummoned) + gameObject->SetGoState(GO_STATE_ACTIVE); + break; + case GO_DOODAD_UL_SIGILDOOR_03: + AlgalonSigilDoorGUID[2] = gameObject->GetGUID(); + AddDoor(gameObject, true); + break; + case GO_DOODAD_UL_UNIVERSEFLOOR_01: + AlgalonFloorGUID[0] = gameObject->GetGUID(); + AddDoor(gameObject, true); + break; + case GO_DOODAD_UL_UNIVERSEFLOOR_02: + AlgalonFloorGUID[1] = gameObject->GetGUID(); + AddDoor(gameObject, true); + break; + case GO_DOODAD_UL_UNIVERSEGLOBE01: + AlgalonUniverseGUID = gameObject->GetGUID(); + AddDoor(gameObject, true); + break; + case GO_DOODAD_UL_ULDUAR_TRAPDOOR_03: + AlgalonTrapdoorGUID = gameObject->GetGUID(); + AddDoor(gameObject, true); + break; + case GO_GIFT_OF_THE_OBSERVER_10: + case GO_GIFT_OF_THE_OBSERVER_25: + GiftOfTheObserverGUID = gameObject->GetGUID(); + break; } } @@ -349,10 +434,14 @@ class instance_ulduar : public InstanceMapScript switch (gameObject->GetEntry()) { case GO_LEVIATHAN_DOOR: - AddDoor(gameObject, false); - break; case GO_XT_002_DOOR: + case GO_DOODAD_UL_SIGILDOOR_03: + case GO_DOODAD_UL_UNIVERSEFLOOR_01: + case GO_DOODAD_UL_UNIVERSEFLOOR_02: + case GO_DOODAD_UL_UNIVERSEGLOBE01: + case GO_DOODAD_UL_ULDUAR_TRAPDOOR_03: AddDoor(gameObject, false); + break; default: break; } @@ -390,6 +479,7 @@ class instance_ulduar : public InstanceMapScript // Flame Leviathan's Tower Event triggers Creature* FlameLeviathan = instance->GetCreature(LeviathanGUID); if (FlameLeviathan && FlameLeviathan->isAlive()) // No leviathan, no event triggering ;) + { switch (eventId) { case EVENT_TOWER_OF_STORM_DESTROYED: @@ -405,6 +495,7 @@ class instance_ulduar : public InstanceMapScript FlameLeviathan->AI()->DoAction(ACTION_TOWER_OF_LIFE_DESTROYED); break; } + } } @@ -465,6 +556,52 @@ class instance_ulduar : public InstanceMapScript if (GameObject* gameObject = instance->GetGameObject(ThorimChestGUID)) gameObject->SetRespawnTime(gameObject->GetRespawnDelay()); break; + case BOSS_ALGALON: + if (state == DONE) + { + _events.CancelEvent(EVENT_UPDATE_ALGALON_TIMER); + _events.CancelEvent(EVENT_DESPAWN_ALGALON); + DoUpdateWorldState(WORLD_STATE_ALGALON_TIMER_ENABLED, 0); + _algalonTimer = 61; + if (GameObject* gameObject = instance->GetGameObject(GiftOfTheObserverGUID)) + gameObject->SetRespawnTime(gameObject->GetRespawnDelay()); + // get item level (recheck weapons) + Map::PlayerList const& players = instance->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + if (Player* player = itr->getSource()) + for (uint8 slot = EQUIPMENT_SLOT_MAINHAND; slot <= EQUIPMENT_SLOT_RANGED; ++slot) + if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot)) + if (item->GetTemplate()->ItemLevel > _maxWeaponItemLevel) + _maxWeaponItemLevel = item->GetTemplate()->ItemLevel; + } + else if (state == IN_PROGRESS) + { + // get item level (armor cannot be swapped in combat) + Map::PlayerList const& players = instance->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* player = itr->getSource()) + { + for (uint8 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot) + { + if (slot == EQUIPMENT_SLOT_TABARD || slot == EQUIPMENT_SLOT_BODY) + continue; + + if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot)) + { + if (slot >= EQUIPMENT_SLOT_MAINHAND && slot <= EQUIPMENT_SLOT_RANGED) + { + if (item->GetTemplate()->ItemLevel > _maxWeaponItemLevel) + _maxWeaponItemLevel = item->GetTemplate()->ItemLevel; + } + else if (item->GetTemplate()->ItemLevel > _maxArmorItemLevel) + _maxArmorItemLevel = item->GetTemplate()->ItemLevel; + } + } + } + } + } + break; } return true; @@ -497,6 +634,16 @@ class instance_ulduar : public InstanceMapScript case DATA_UNBROKEN: Unbroken = bool(data); break; + case EVENT_DESPAWN_ALGALON: + DoUpdateWorldState(WORLD_STATE_ALGALON_TIMER_ENABLED, 1); + DoUpdateWorldState(WORLD_STATE_ALGALON_DESPAWN_TIMER, 60); + _algalonTimer = 60; + _events.ScheduleEvent(EVENT_DESPAWN_ALGALON, 3600000); + _events.ScheduleEvent(EVENT_UPDATE_ALGALON_TIMER, 60000); + break; + case DATA_ALGALON_SUMMON_STATE: + _algalonSummoned = true; + break; default: break; } @@ -571,6 +718,22 @@ class instance_ulduar : public InstanceMapScript return KeeperGUIDs[1]; case BOSS_STONEBARK: return KeeperGUIDs[2]; + case DATA_SIGILDOOR_01: + return AlgalonSigilDoorGUID[0]; + case DATA_SIGILDOOR_02: + return AlgalonSigilDoorGUID[1]; + case DATA_SIGILDOOR_03: + return AlgalonSigilDoorGUID[2]; + case DATA_UNIVERSE_FLOOR_01: + return AlgalonFloorGUID[0]; + case DATA_UNIVERSE_FLOOR_02: + return AlgalonFloorGUID[1]; + case DATA_UNIVERSE_GLOBE: + return AlgalonUniverseGUID; + case DATA_ALGALON_TRAPDOOR: + return AlgalonTrapdoorGUID; + case DATA_BRANN_BRONZEBEARD_ALG: + return BrannBronzebeardAlgGUID; } return 0; @@ -593,12 +756,23 @@ class instance_ulduar : public InstanceMapScript return 0; } + bool CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* , Unit const* /* = NULL */, uint32 /* = 0 */) + { + switch (criteriaId) + { + case CRITERIA_HERALD_OF_TITANS: + return _maxArmorItemLevel <= MAX_HERALD_ARMOR_ITEMLEVEL && _maxWeaponItemLevel <= MAX_HERALD_WEAPON_ITEMLEVEL; + } + + return false; + } + std::string GetSaveData() { OUT_SAVE_INST_DATA; std::ostringstream saveStream; - saveStream << "U U " << GetBossSaveData() << GetData(DATA_COLOSSUS); + saveStream << "U U " << GetBossSaveData() << GetData(DATA_COLOSSUS) << ' ' << _algalonTimer << ' ' << (_algalonSummoned ? 1 : 0); OUT_SAVE_INST_DATA_COMPLETE; return saveStream.str(); @@ -628,15 +802,68 @@ class instance_ulduar : public InstanceMapScript if (tmpState == IN_PROGRESS || tmpState > SPECIAL) tmpState = NOT_STARTED; - if (i == DATA_COLOSSUS) - SetData(i, tmpState); - else - SetBossState(i, EncounterState(tmpState)); + SetBossState(i, EncounterState(tmpState)); + } + + uint32 tempState; + loadStream >> tempState; + if (tempState == IN_PROGRESS || tempState > SPECIAL) + tempState = NOT_STARTED; + SetData(DATA_COLOSSUS, tempState); + + loadStream >> _algalonTimer; + loadStream >> tempState; + _algalonSummoned = tempState != 0; + if (_algalonSummoned && GetBossState(BOSS_ALGALON) != DONE) + { + _summonAlgalon = true; + if (_algalonTimer && _algalonTimer <= 60) + { + _events.ScheduleEvent(EVENT_UPDATE_ALGALON_TIMER, 60000); + DoUpdateWorldState(WORLD_STATE_ALGALON_TIMER_ENABLED, 1); + DoUpdateWorldState(WORLD_STATE_ALGALON_DESPAWN_TIMER, _algalonTimer); + } } } OUT_LOAD_INST_DATA_COMPLETE; } + + void Update(uint32 diff) + { + if (_events.Empty()) + return; + + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_UPDATE_ALGALON_TIMER: + SaveToDB(); + DoUpdateWorldState(WORLD_STATE_ALGALON_DESPAWN_TIMER, --_algalonTimer); + if (_algalonTimer) + _events.ScheduleEvent(EVENT_UPDATE_ALGALON_TIMER, 60000); + else + { + DoUpdateWorldState(WORLD_STATE_ALGALON_TIMER_ENABLED, 0); + _events.CancelEvent(EVENT_UPDATE_ALGALON_TIMER); + if (Creature* algalon = instance->GetCreature(AlgalonGUID)) + algalon->AI()->DoAction(EVENT_DESPAWN_ALGALON); + } + break; + } + } + } + + private: + EventMap _events; + uint32 _algalonTimer; + bool _summonAlgalon; + bool _algalonSummoned; + uint32 _maxArmorItemLevel; + uint32 _maxWeaponItemLevel; }; InstanceScript* GetInstanceScript(InstanceMap* map) const diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h index a31954b8a16..d35f0559080 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h @@ -21,6 +21,8 @@ #include "ObjectMgr.h" #define UlduarScriptName "instance_ulduar" +extern Position const AlgalonLandPos; + enum UlduarBosses { MAX_ENCOUNTER = 20, @@ -50,98 +52,124 @@ enum UlduarBosses enum UlduarNPCs { // General - NPC_LEVIATHAN = 33113, - NPC_SALVAGED_DEMOLISHER = 33109, - NPC_SALVAGED_SIEGE_ENGINE = 33060, - NPC_IGNIS = 33118, - NPC_RAZORSCALE = 33186, - NPC_RAZORSCALE_CONTROLLER = 33233, - NPC_STEELFORGED_DEFFENDER = 33236, - NPC_EXPEDITION_COMMANDER = 33210, - NPC_XT002 = 33293, - NPC_XT_TOY_PILE = 33337, - NPC_STEELBREAKER = 32867, - NPC_MOLGEIM = 32927, - NPC_BRUNDIR = 32857, - NPC_KOLOGARN = 32930, - NPC_FOCUSED_EYEBEAM = 33632, - NPC_FOCUSED_EYEBEAM_RIGHT = 33802, - NPC_LEFT_ARM = 32933, - NPC_RIGHT_ARM = 32934, - NPC_RUBBLE = 33768, - NPC_AURIAYA = 33515, - NPC_MIMIRON = 33350, - NPC_HODIR = 32845, - NPC_THORIM = 32865, - NPC_FREYA = 32906, - NPC_VEZAX = 33271, - NPC_YOGGSARON = 33288, - NPC_ALGALON = 32871, + NPC_LEVIATHAN = 33113, + NPC_SALVAGED_DEMOLISHER = 33109, + NPC_SALVAGED_SIEGE_ENGINE = 33060, + NPC_IGNIS = 33118, + NPC_RAZORSCALE = 33186, + NPC_RAZORSCALE_CONTROLLER = 33233, + NPC_STEELFORGED_DEFFENDER = 33236, + NPC_EXPEDITION_COMMANDER = 33210, + NPC_XT002 = 33293, + NPC_XT_TOY_PILE = 33337, + NPC_STEELBREAKER = 32867, + NPC_MOLGEIM = 32927, + NPC_BRUNDIR = 32857, + NPC_KOLOGARN = 32930, + NPC_FOCUSED_EYEBEAM = 33632, + NPC_FOCUSED_EYEBEAM_RIGHT = 33802, + NPC_LEFT_ARM = 32933, + NPC_RIGHT_ARM = 32934, + NPC_RUBBLE = 33768, + NPC_AURIAYA = 33515, + NPC_MIMIRON = 33350, + NPC_HODIR = 32845, + NPC_THORIM = 32865, + NPC_FREYA = 32906, + NPC_VEZAX = 33271, + NPC_YOGGSARON = 33288, + NPC_ALGALON = 32871, // Mimiron - NPC_LEVIATHAN_MKII = 33432, - NPC_VX_001 = 33651, - NPC_AERIAL_COMMAND_UNIT = 33670, + NPC_LEVIATHAN_MKII = 33432, + NPC_VX_001 = 33651, + NPC_AERIAL_COMMAND_UNIT = 33670, // Freya's Keepers - NPC_IRONBRANCH = 32913, - NPC_BRIGHTLEAF = 32915, - NPC_STONEBARK = 32914, + NPC_IRONBRANCH = 32913, + NPC_BRIGHTLEAF = 32915, + NPC_STONEBARK = 32914, // Hodir's Helper NPCs - NPC_TOR_GREYCLOUD = 32941, - NPC_KAR_GREYCLOUD = 33333, - NPC_EIVI_NIGHTFEATHER = 33325, - NPC_ELLIE_NIGHTFEATHER = 32901, - NPC_SPIRITWALKER_TARA = 33332, - NPC_SPIRITWALKER_YONA = 32950, - NPC_ELEMENTALIST_MAHFUUN = 33328, - NPC_ELEMENTALIST_AVUUN = 32900, - NPC_AMIRA_BLAZEWEAVER = 33331, - NPC_VEESHA_BLAZEWEAVER = 32946, - NPC_MISSY_FLAMECUFFS = 32893, - NPC_SISSY_FLAMECUFFS = 33327, - NPC_BATTLE_PRIEST_ELIZA = 32948, - NPC_BATTLE_PRIEST_GINA = 33330, - NPC_FIELD_MEDIC_PENNY = 32897, - NPC_FIELD_MEDIC_JESSI = 33326, + NPC_TOR_GREYCLOUD = 32941, + NPC_KAR_GREYCLOUD = 33333, + NPC_EIVI_NIGHTFEATHER = 33325, + NPC_ELLIE_NIGHTFEATHER = 32901, + NPC_SPIRITWALKER_TARA = 33332, + NPC_SPIRITWALKER_YONA = 32950, + NPC_ELEMENTALIST_MAHFUUN = 33328, + NPC_ELEMENTALIST_AVUUN = 32900, + NPC_AMIRA_BLAZEWEAVER = 33331, + NPC_VEESHA_BLAZEWEAVER = 32946, + NPC_MISSY_FLAMECUFFS = 32893, + NPC_SISSY_FLAMECUFFS = 33327, + NPC_BATTLE_PRIEST_ELIZA = 32948, + NPC_BATTLE_PRIEST_GINA = 33330, + NPC_FIELD_MEDIC_PENNY = 32897, + NPC_FIELD_MEDIC_JESSI = 33326, // Freya's trash NPCs - NPC_CORRUPTED_SERVITOR = 33354, - NPC_MISGUIDED_NYMPH = 33355, - NPC_GUARDIAN_LASHER = 33430, - NPC_FOREST_SWARMER = 33431, - NPC_MANGROVE_ENT = 33525, - NPC_IRONROOT_LASHER = 33526, - NPC_NATURES_BLADE = 33527, - NPC_GUARDIAN_OF_LIFE = 33528, + NPC_CORRUPTED_SERVITOR = 33354, + NPC_MISGUIDED_NYMPH = 33355, + NPC_GUARDIAN_LASHER = 33430, + NPC_FOREST_SWARMER = 33431, + NPC_MANGROVE_ENT = 33525, + NPC_IRONROOT_LASHER = 33526, + NPC_NATURES_BLADE = 33527, + NPC_GUARDIAN_OF_LIFE = 33528, + + // Algalon the Observer + NPC_BRANN_BRONZBEARD_ALG = 34064, + NPC_AZEROTH = 34246, + NPC_LIVING_CONSTELLATION = 33052, + NPC_ALGALON_STALKER = 33086, + NPC_COLLAPSING_STAR = 32955, + NPC_BLACK_HOLE = 32953, + NPC_WORM_HOLE = 34099, + NPC_ALGALON_VOID_ZONE_VISUAL_STALKER = 34100, + NPC_ALGALON_STALKER_ASTEROID_TARGET_01 = 33104, + NPC_ALGALON_STALKER_ASTEROID_TARGET_02 = 33105, + NPC_UNLEASHED_DARK_MATTER = 34097, }; enum UlduarGameObjects { - GO_KOLOGARN_CHEST_HERO = 195047, - GO_KOLOGARN_CHEST = 195046, - GO_KOLOGARN_BRIDGE = 194232, - GO_KOLOGARN_DOOR = 194553, - GO_THORIM_CHEST_HERO = 194315, - GO_THORIM_CHEST = 194314, - GO_HODIR_RARE_CACHE_OF_WINTER = 194200, - GO_HODIR_RARE_CACHE_OF_WINTER_HERO = 194201, - GO_HODIR_CHEST_HERO = 194308, - GO_HODIR_CHEST = 194307, - GO_LEVIATHAN_DOOR = 194905, - GO_LEVIATHAN_GATE = 194630, - GO_XT_002_DOOR = 194631, - GO_VEZAX_DOOR = 194750, - GO_MOLE_MACHINE = 194316, - GO_RAZOR_HARPOON_1 = 194542, - GO_RAZOR_HARPOON_2 = 194541, - GO_RAZOR_HARPOON_3 = 194543, - GO_RAZOR_HARPOON_4 = 194519, - GO_RAZOR_BROKEN_HARPOON = 194565, - GO_HODIR_DOOR = 194634, - GO_HODIR_ICE_DOOR = 194441, - GO_ARCHIVUM_DOOR = 194556, + GO_KOLOGARN_CHEST_HERO = 195047, + GO_KOLOGARN_CHEST = 195046, + GO_KOLOGARN_BRIDGE = 194232, + GO_KOLOGARN_DOOR = 194553, + GO_THORIM_CHEST_HERO = 194315, + GO_THORIM_CHEST = 194314, + GO_HODIR_RARE_CACHE_OF_WINTER = 194200, + GO_HODIR_RARE_CACHE_OF_WINTER_HERO = 194201, + GO_HODIR_CHEST_HERO = 194308, + GO_HODIR_CHEST = 194307, + GO_LEVIATHAN_DOOR = 194905, + GO_LEVIATHAN_GATE = 194630, + GO_XT_002_DOOR = 194631, + GO_VEZAX_DOOR = 194750, + GO_MOLE_MACHINE = 194316, + GO_RAZOR_HARPOON_1 = 194542, + GO_RAZOR_HARPOON_2 = 194541, + GO_RAZOR_HARPOON_3 = 194543, + GO_RAZOR_HARPOON_4 = 194519, + GO_RAZOR_BROKEN_HARPOON = 194565, + GO_HODIR_DOOR = 194634, + GO_HODIR_ICE_DOOR = 194441, + GO_ARCHIVUM_DOOR = 194556, + + // Algalon the Observer + GO_CELESTIAL_PLANETARIUM_ACCESS_10 = 194628, + GO_CELESTIAL_PLANETARIUM_ACCESS_25 = 194752, + GO_DOODAD_UL_SIGILDOOR_01 = 194767, + GO_DOODAD_UL_SIGILDOOR_02 = 194911, + GO_DOODAD_UL_SIGILDOOR_03 = 194910, + GO_DOODAD_UL_UNIVERSEFLOOR_01 = 194715, + GO_DOODAD_UL_UNIVERSEFLOOR_02 = 194716, + GO_DOODAD_UL_UNIVERSEGLOBE01 = 194148, + GO_DOODAD_UL_ULDUAR_TRAPDOOR_03 = 194253, + GO_GIFT_OF_THE_OBSERVER_10 = 194821, + GO_GIFT_OF_THE_OBSERVER_25 = 194822, }; enum LeviathanData @@ -161,6 +189,7 @@ enum UlduarAchievementCriteriaIds { CRITERIA_CON_SPEED_ATORY = 21597, CRITERIA_DISARMED = 21687, + CRITERIA_HERALD_OF_TITANS = 10678, }; enum UlduarData @@ -180,12 +209,38 @@ enum UlduarData // Hodir DATA_HODIR_RARE_CACHE, + + // Algalon the Observer + DATA_ALGALON_SUMMON_STATE, + DATA_SIGILDOOR_01, + DATA_SIGILDOOR_02, + DATA_SIGILDOOR_03, + DATA_UNIVERSE_FLOOR_01, + DATA_UNIVERSE_FLOOR_02, + DATA_UNIVERSE_GLOBE, + DATA_ALGALON_TRAPDOOR, + DATA_BRANN_BRONZEBEARD_ALG, +}; + +enum UlduarWorldStates +{ + WORLD_STATE_ALGALON_DESPAWN_TIMER = 4131, + WORLD_STATE_ALGALON_TIMER_ENABLED = 4132, }; enum UlduarAchievementData { // FL Achievement boolean DATA_UNBROKEN = 29052906, // 2905, 2906 are achievement IDs, + MAX_HERALD_ARMOR_ITEMLEVEL = 226, + MAX_HERALD_WEAPON_ITEMLEVEL = 232, +}; + +enum UlduarEvents +{ + EVENT_DESPAWN_ALGALON = 1, + EVENT_UPDATE_ALGALON_TIMER = 2, + ACTION_INIT_ALGALON = 6, }; template<class AI> @@ -199,6 +254,17 @@ CreatureAI* GetUlduarAI(Creature* creature) return NULL; } +template<class AI> +GameObjectAI* GetUlduarAI(GameObject* go) +{ + if (InstanceMap* instance = go->GetMap()->ToInstanceMap()) + if (instance->GetInstanceScript()) + if (instance->GetScriptId() == sObjectMgr->GetScriptId(UlduarScriptName)) + return new AI(go); + + return NULL; +} + class PlayerOrPetCheck { public: diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp index a11f88fc6af..a7853a07e22 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp @@ -309,9 +309,9 @@ public: struct mob_annhylde_the_callerAI : public ScriptedAI { - mob_annhylde_the_callerAI(Creature* c) : ScriptedAI(c) + mob_annhylde_the_callerAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } float x, y, z; @@ -321,6 +321,7 @@ public: void Reset() { + //! HACK: Creature's can't have MOVEMENTFLAG_FLYING me->AddUnitMovementFlag(MOVEMENTFLAG_FLYING | MOVEMENTFLAG_HOVER); me->SetSpeed(MOVE_SWIM, 1.0f); me->SetSpeed(MOVE_RUN, 1.0f); @@ -343,7 +344,7 @@ public: { if (type != POINT_MOTION_TYPE) return; - Unit* ingvar = Unit::GetUnit((*me), instance ? instance->GetData64(DATA_INGVAR) : 0); + Unit* ingvar = Unit::GetUnit(*me, instance ? instance->GetData64(DATA_INGVAR) : 0); if (ingvar) { switch (id) @@ -423,7 +424,7 @@ public: struct mob_ingvar_throw_dummyAI : public ScriptedAI { - mob_ingvar_throw_dummyAI(Creature* c) : ScriptedAI(c) + mob_ingvar_throw_dummyAI(Creature* creature) : ScriptedAI(creature) { } @@ -444,6 +445,7 @@ public: void AttackStart(Unit* /*who*/) {} void MoveInLineOfSight(Unit* /*who*/) {} void EnterCombat(Unit* /*who*/) {} + void UpdateAI(const uint32 diff) { if (uiDespawnTimer <= diff) @@ -454,7 +456,6 @@ public: } else uiDespawnTimer -= diff; } }; - }; void AddSC_boss_ingvar_the_plunderer() diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp index 333278daa10..915d1c71bb2 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp @@ -69,9 +69,9 @@ public: struct boss_skarvald_the_constructorAI : public ScriptedAI { - boss_skarvald_the_constructorAI(Creature* c) : ScriptedAI(c) + boss_skarvald_the_constructorAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -93,7 +93,7 @@ public: ghost = (me->GetEntry() == MOB_SKARVALD_GHOST); if (!ghost && instance) { - Unit* dalronn = Unit::GetUnit((*me), instance->GetData64(DATA_DALRONN)); + Unit* dalronn = Unit::GetUnit(*me, instance->GetData64(DATA_DALRONN)); if (dalronn && dalronn->isDead()) CAST_CRE(dalronn)->Respawn(); @@ -107,7 +107,7 @@ public: { DoScriptText(YELL_SKARVALD_AGGRO, me); - Unit* dalronn = Unit::GetUnit((*me), instance->GetData64(DATA_DALRONN)); + Unit* dalronn = Unit::GetUnit(*me, instance->GetData64(DATA_DALRONN)); if (dalronn && dalronn->isAlive() && !dalronn->getVictim()) dalronn->getThreatManager().addThreat(who, 0.0f); @@ -115,11 +115,11 @@ public: } } - void JustDied(Unit* Killer) + void JustDied(Unit* killer) { if (!ghost && instance) { - Unit* dalronn = Unit::GetUnit((*me), instance->GetData64(DATA_DALRONN)); + Unit* dalronn = Unit::GetUnit(*me, instance->GetData64(DATA_DALRONN)); if (dalronn) { if (dalronn->isDead()) @@ -138,7 +138,7 @@ public: if (temp) { temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - temp->AI()->AttackStart(Killer); + temp->AI()->AttackStart(killer); } } } @@ -221,9 +221,9 @@ public: struct boss_dalronn_the_controllerAI : public ScriptedAI { - boss_dalronn_the_controllerAI(Creature* c) : ScriptedAI(c) + boss_dalronn_the_controllerAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -250,7 +250,7 @@ public: ghost = me->GetEntry() == MOB_DALRONN_GHOST; if (!ghost && instance) { - Unit* skarvald = Unit::GetUnit((*me), instance->GetData64(DATA_SKARVALD)); + Unit* skarvald = Unit::GetUnit(*me, instance->GetData64(DATA_SKARVALD)); if (skarvald && skarvald->isDead()) CAST_CRE(skarvald)->Respawn(); @@ -262,7 +262,7 @@ public: { if (!ghost && instance) { - Unit* skarvald = Unit::GetUnit((*me), instance->GetData64(DATA_SKARVALD)); + Unit* skarvald = Unit::GetUnit(*me, instance->GetData64(DATA_SKARVALD)); if (skarvald && skarvald->isAlive() && !skarvald->getVictim()) skarvald->getThreatManager().addThreat(who, 0.0f); @@ -273,11 +273,11 @@ public: } } - void JustDied(Unit* Killer) + void JustDied(Unit* killer) { if (!ghost && instance) { - Unit* skarvald = Unit::GetUnit((*me), instance->GetData64(DATA_SKARVALD)); + Unit* skarvald = Unit::GetUnit(*me, instance->GetData64(DATA_SKARVALD)); if (skarvald) { if (skarvald->isDead()) @@ -297,7 +297,7 @@ public: if (temp) { temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - temp->AI()->AttackStart(Killer); + temp->AI()->AttackStart(killer); } } } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp index 6ecc1883afc..fda4767e16b 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp @@ -100,7 +100,8 @@ public: bool IsEncounterInProgress() const { for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; + if (m_auiEncounter[i] == IN_PROGRESS) + return true; return false; } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp index d660b1516b3..95d2cb1709e 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp @@ -37,9 +37,9 @@ public: struct npc_dragonflayer_forge_masterAI : public ScriptedAI { - npc_dragonflayer_forge_masterAI(Creature* c) : ScriptedAI(c) + npc_dragonflayer_forge_masterAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); fm_Type = 0; } @@ -48,65 +48,77 @@ public: void Reset() { - if (fm_Type == 0) fm_Type = GetForgeMasterType(); + if (fm_Type == 0) + fm_Type = GetForgeMasterType(); + CheckForge(); } void CheckForge() { - if (instance) + if (instance) { switch (fm_Type) { - case 1: - instance->SetData(EVENT_FORGE_1, me->isAlive() ? NOT_STARTED : DONE); - break; - case 2: - instance->SetData(EVENT_FORGE_2, me->isAlive() ? NOT_STARTED : DONE); - break; - case 3: - instance->SetData(EVENT_FORGE_3, me->isAlive() ? NOT_STARTED : DONE); - break; + case 1: + instance->SetData(EVENT_FORGE_1, me->isAlive() ? NOT_STARTED : DONE); + break; + + case 2: + instance->SetData(EVENT_FORGE_2, me->isAlive() ? NOT_STARTED : DONE); + break; + + case 3: + instance->SetData(EVENT_FORGE_3, me->isAlive() ? NOT_STARTED : DONE); + break; } } } void JustDied(Unit* /*killer*/) { - if (fm_Type == 0) fm_Type = GetForgeMasterType(); + if (fm_Type == 0) + fm_Type = GetForgeMasterType(); + if (instance) { switch (fm_Type) { - case 1: - instance->SetData(EVENT_FORGE_1, DONE); - break; - case 2: - instance->SetData(EVENT_FORGE_2, DONE); - break; - case 3: - instance->SetData(EVENT_FORGE_3, DONE); - break; + case 1: + instance->SetData(EVENT_FORGE_1, DONE); + break; + + case 2: + instance->SetData(EVENT_FORGE_2, DONE); + break; + + case 3: + instance->SetData(EVENT_FORGE_3, DONE); + break; } } } void EnterCombat(Unit* /*who*/) { - if (fm_Type == 0) fm_Type = GetForgeMasterType(); + if (fm_Type == 0) + fm_Type = GetForgeMasterType(); + if (instance) { switch (fm_Type) { - case 1: - instance->SetData(EVENT_FORGE_1, IN_PROGRESS); - break; - case 2: - instance->SetData(EVENT_FORGE_2, IN_PROGRESS); - break; - case 3: - instance->SetData(EVENT_FORGE_3, IN_PROGRESS); - break; + case 1: + instance->SetData(EVENT_FORGE_1, IN_PROGRESS); + break; + + case 2: + instance->SetData(EVENT_FORGE_2, IN_PROGRESS); + break; + + case 3: + instance->SetData(EVENT_FORGE_3, IN_PROGRESS); + break; } } me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); @@ -115,29 +127,26 @@ public: uint8 GetForgeMasterType() { float diff = 30.0f; - int near_f = 0; + uint8 near_f = 0; - for (uint8 i = 0; i < 3 ; ++i) + for (uint8 i = 0; i < 3; ++i) { - GameObject* temp; - temp = me->FindNearestGameObject(entry_search[i], 30); - if (temp) + if (GameObject* go = me->FindNearestGameObject(entry_search[i], 30)) { - if (me->IsWithinDist(temp, diff, false)) + if (me->IsWithinDist(go, diff, false)) { near_f = i + 1; - diff = me->GetDistance2d(temp); - + diff = me->GetDistance2d(go); } } } switch (near_f) { - case 1: return 1; - case 2: return 2; - case 3: return 3; - default: return 0; + case 1: return 1; + case 2: return 2; + case 3: return 3; + default: return 0; } } @@ -152,7 +161,6 @@ public: DoMeleeAttackIfReady(); } }; - }; void AddSC_utgarde_keep() diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp index 656b2931abb..e2943f491f6 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp @@ -94,9 +94,9 @@ public: struct boss_palehoofAI : public ScriptedAI { - boss_palehoofAI(Creature* c) : ScriptedAI(c) + boss_palehoofAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 uiArcingSmashTimer; @@ -297,9 +297,9 @@ public: struct mob_ravenous_furbolgAI : public ScriptedAI { - mob_ravenous_furbolgAI(Creature* c) : ScriptedAI(c) + mob_ravenous_furbolgAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 uiChainLightingTimer; @@ -410,9 +410,9 @@ public: struct mob_frenzied_worgenAI : public ScriptedAI { - mob_frenzied_worgenAI(Creature* c) : ScriptedAI(c) + mob_frenzied_worgenAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 uiMortalWoundTimer; @@ -526,9 +526,9 @@ public: struct mob_ferocious_rhinoAI : public ScriptedAI { - mob_ferocious_rhinoAI(Creature* c) : ScriptedAI(c) + mob_ferocious_rhinoAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 uiStompTimer; @@ -646,9 +646,9 @@ public: struct mob_massive_jormungarAI : public ScriptedAI { - mob_massive_jormungarAI(Creature* c) : ScriptedAI(c) + mob_massive_jormungarAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 uiAcidSpitTimer; @@ -752,9 +752,9 @@ public: struct mob_palehoof_orbAI : public ScriptedAI { - mob_palehoof_orbAI(Creature* c) : ScriptedAI(c) + mob_palehoof_orbAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -765,6 +765,7 @@ public: { currentPhase = PHASE_NONE; SummonTimer = 5000; + //! HACK: Creature's can't have MOVEMENTFLAG_FLYING me->AddUnitMovementFlag(MOVEMENTFLAG_FLYING); me->RemoveAurasDueToSpell(SPELL_ORB_VISUAL); me->SetSpeed(MOVE_FLIGHT, 0.5f); @@ -834,15 +835,15 @@ class go_palehoof_sphere : public GameObjectScript public: go_palehoof_sphere() : GameObjectScript("go_palehoof_sphere") { } - bool OnGossipHello(Player* /*player*/, GameObject* pGO) + bool OnGossipHello(Player* /*player*/, GameObject* go) { - InstanceScript* instance = pGO->GetInstanceScript(); + InstanceScript* instance = go->GetInstanceScript(); - Creature* pPalehoof = Unit::GetCreature(*pGO, instance ? instance->GetData64(DATA_GORTOK_PALEHOOF) : 0); + Creature* pPalehoof = Unit::GetCreature(*go, instance ? instance->GetData64(DATA_GORTOK_PALEHOOF) : 0); if (pPalehoof && pPalehoof->isAlive()) { - pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - pGO->SetGoState(GO_STATE_ACTIVE); + go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + go->SetGoState(GO_STATE_ACTIVE); CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->NextPhase(); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp index d5cd79b25f1..5132dd0f046 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp @@ -168,12 +168,12 @@ public: struct boss_skadiAI : public ScriptedAI { - boss_skadiAI(Creature* c) : ScriptedAI(c), Summons(me) + boss_skadiAI(Creature* creature) : ScriptedAI(creature), Summons(me) { - m_instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } - InstanceScript* m_instance; + InstanceScript* instance; SummonList Summons; uint64 m_uiGraufGUID; std::vector<uint64> triggersGUID; @@ -208,16 +208,16 @@ public: me->SetSpeed(MOVE_FLIGHT, 3.0f); if ((Unit::GetCreature((*me), m_uiGraufGUID) == NULL) && !me->IsMounted()) me->SummonCreature(CREATURE_GRAUF, Location[0].GetPositionX(), Location[0].GetPositionY(), Location[0].GetPositionZ(), 3.0f); - if (m_instance) + if (instance) { - m_instance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, NOT_STARTED); - m_instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + instance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, NOT_STARTED); + instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); } } void JustReachedHome() { - me->SetFlying(false); + me->SetCanFly(false); me->Dismount(); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); if (Unit::GetCreature((*me), m_uiGraufGUID) == NULL) @@ -235,12 +235,12 @@ public: m_uiMovementTimer = 1000; m_uiSummonTimer = 10000; me->SetInCombatWithZone(); - if (m_instance) + if (instance) { - m_instance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, IN_PROGRESS); - m_instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + instance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, IN_PROGRESS); + instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); me->GetMotionMaster()->MoveJump(Location[0].GetPositionX(), Location[0].GetPositionY(), Location[0].GetPositionZ(), 5.0f, 10.0f); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(false); m_uiMountTimer = 1000; Summons.DespawnEntry(CREATURE_GRAUF); } @@ -284,7 +284,7 @@ public: if (m_uiSpellHitCount >= 3) { Phase = SKADI; - me->SetFlying(false); + me->SetCanFly(false); me->Dismount(); if (Creature* pGrauf = me->SummonCreature(CREATURE_GRAUF, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3*IN_MILLISECONDS)) { @@ -328,7 +328,7 @@ public: if (m_uiMountTimer && m_uiMountTimer <= diff) { me->Mount(DATA_MOUNT); - me->SetFlying(true); + me->SetCanFly(true); m_uiMountTimer = 0; } else m_uiMountTimer -= diff; @@ -411,8 +411,8 @@ public: { DoScriptText(SAY_DEATH, me); Summons.DespawnAll(); - if (m_instance) - m_instance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, DONE); + if (instance) + instance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, DONE); } void KilledUnit(Unit* /*victim*/) @@ -426,9 +426,17 @@ public: { switch (urand(0, 2)) { - case 0: me->SummonCreature(CREATURE_YMIRJAR_WARRIOR, SpawnLoc.GetPositionX()+rand()%5, SpawnLoc.GetPositionY()+rand()%5, SpawnLoc.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); break; - case 1: me->SummonCreature(CREATURE_YMIRJAR_WITCH_DOCTOR, SpawnLoc.GetPositionX()+rand()%5, SpawnLoc.GetPositionY()+rand()%5, SpawnLoc.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); break; - case 2: me->SummonCreature(CREATURE_YMIRJAR_HARPOONER, SpawnLoc.GetPositionX()+rand()%5, SpawnLoc.GetPositionY()+rand()%5, SpawnLoc.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); break; + case 0: + me->SummonCreature(CREATURE_YMIRJAR_WARRIOR, SpawnLoc.GetPositionX()+rand()%5, SpawnLoc.GetPositionY()+rand()%5, SpawnLoc.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + + case 1: + me->SummonCreature(CREATURE_YMIRJAR_WITCH_DOCTOR, SpawnLoc.GetPositionX()+rand()%5, SpawnLoc.GetPositionY()+rand()%5, SpawnLoc.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + + case 2: + me->SummonCreature(CREATURE_YMIRJAR_HARPOONER, SpawnLoc.GetPositionX()+rand()%5, SpawnLoc.GetPositionY()+rand()%5, SpawnLoc.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; } } } @@ -461,15 +469,15 @@ class go_harpoon_launcher : public GameObjectScript public: go_harpoon_launcher() : GameObjectScript("go_harpoon_launcher") { } - bool OnGossipHello(Player* player, GameObject* pGO) + bool OnGossipHello(Player* player, GameObject* go) { - InstanceScript* m_instance = pGO->GetInstanceScript(); - if (!m_instance) return false; + InstanceScript* instance = go->GetInstanceScript(); + if (!instance) + return false; - if (Creature* pSkadi = Unit::GetCreature((*pGO), m_instance->GetData64(DATA_SKADI_THE_RUTHLESS))) - { + if (Creature* pSkadi = Unit::GetCreature(*go, instance->GetData64(DATA_SKADI_THE_RUTHLESS))) player->CastSpell(pSkadi, SPELL_RAPID_FIRE, true); - } + return false; } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp index 915ead98bb7..29b8f2e7f48 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp @@ -94,11 +94,6 @@ enum SvalaPhase SVALADEAD }; -enum SvalaPoint -{ - POINT_FALL_GROUND = 1, -}; - #define DATA_INCREDIBLE_HULK 2043 static const float spectatorWP[2][3] = @@ -158,15 +153,11 @@ public: summons.DespawnAll(); me->RemoveAllAuras(); - if (Phase > INTRO) - { - me->SetFlying(true); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - } - if (Phase > NORMAL) Phase = NORMAL; + me->SetDisableGravity(Phase == NORMAL); + introTimer = 1 * IN_MILLISECONDS; introPhase = 0; arthasGUID = 0; @@ -178,17 +169,6 @@ public: } } - void JustReachedHome() - { - if (Phase > INTRO) - { - me->SetFlying(false); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->SetOrientation(1.58f); - me->SendMovementFlagUpdate(); - } - } - void EnterCombat(Unit* /*who*/) { Talk(SAY_AGGRO); @@ -240,44 +220,13 @@ public: Talk(SAY_SLAY); } - void DamageTaken(Unit* attacker, uint32 &damage) - { - if (Phase == SVALADEAD) - { - if (attacker != me) - damage = 0; - return; - } - - if (damage >= me->GetHealth()) - { - if (Phase == SACRIFICING) - SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); - - damage = 0; - Phase = SVALADEAD; - me->InterruptNonMeleeSpells(true); - me->RemoveAllAuras(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetHealth(1); - - SetCombatMovement(false); - me->HandleEmoteCommand(EMOTE_ONESHOT_FLYDEATH); - me->GetMotionMaster()->MoveFall(POINT_FALL_GROUND); - } - } - - void MovementInform(uint32 motionType, uint32 pointId) + void JustDied(Unit* /*killer*/) { - if (motionType != EFFECT_MOTION_TYPE) - return; + if (Phase == SACRIFICING) + SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); - if (pointId == POINT_FALL_GROUND) - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - } + me->HandleEmoteCommand(EMOTE_ONESHOT_FLYDEATH); - void JustDied(Unit* /*killer*/) - { summons.DespawnAll(); if (instance) @@ -325,8 +274,6 @@ public: break; case 2: arthas->CastSpell(me, SPELL_TRANSFORMING_CHANNEL, false); - me->SetFlying(true); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); pos.Relocate(me); pos.m_positionZ += 8.0f; me->GetMotionMaster()->MoveTakeoff(0, pos, 3.30078125f); @@ -340,7 +287,7 @@ public: if ((*itr)->isAlive()) { (*itr)->SetStandState(UNIT_STAND_STATE_STAND); - (*itr)->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + (*itr)->SetWalk(false); (*itr)->GetMotionMaster()->MovePoint(1, spectatorWP[0][0], spectatorWP[0][1], spectatorWP[0][2]); } } @@ -382,14 +329,13 @@ public: introTimer = 13800; break; case 8: - me->SetFlying(false); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->SendMovementFlagUpdate(); pos.Relocate(me); pos.m_positionX = me->GetHomePosition().GetPositionX(); pos.m_positionY = me->GetHomePosition().GetPositionY(); pos.m_positionZ = 90.6065f; me->GetMotionMaster()->MoveLand(0, pos, 6.247422f); + me->SetDisableGravity(false, true); + me->SetHover(true); ++introPhase; introTimer = 3000; break; @@ -403,7 +349,8 @@ public: break; } } - else introTimer -= diff; + else + introTimer -= diff; return; } @@ -414,33 +361,29 @@ public: if (!UpdateVictim()) return; - if (me->IsWithinMeleeRange(me->getVictim()) && me->HasUnitMovementFlag(MOVEMENTFLAG_LEVITATING)) - { - me->SetFlying(false); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->SendMovementFlagUpdate(); - } - if (sinsterStrikeTimer <= diff) { DoCast(me->getVictim(), SPELL_SINSTER_STRIKE); sinsterStrikeTimer = urand(5 * IN_MILLISECONDS, 9 * IN_MILLISECONDS); - } else sinsterStrikeTimer -= diff; + } + else + sinsterStrikeTimer -= diff; if (callFlamesTimer <= diff) { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) { DoCast(target, SPELL_CALL_FLAMES); callFlamesTimer = urand(10 * IN_MILLISECONDS, 20 * IN_MILLISECONDS); } - } else callFlamesTimer -= diff; + } + else callFlamesTimer -= diff; if (!sacrificed) { if (HealthBelowPct(50)) { - if (Unit* sacrificeTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 80, true)) + if (Unit* sacrificeTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 80.0f, true)) { if (instance) instance->SetData64(DATA_SACRIFICED_PLAYER, sacrificeTarget->GetGUID()); @@ -450,8 +393,6 @@ public: DoCast(sacrificeTarget, SPELL_RITUAL_PREPARATION); SetCombatMovement(false); - me->SetFlying(true); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); Phase = SACRIFICING; sacrePhase = 0; diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp index 29d6278124f..f9251c637ba 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp @@ -108,9 +108,9 @@ public: struct boss_ymironAI : public ScriptedAI { - boss_ymironAI(Creature* c) : ScriptedAI(c) + boss_ymironAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); for (int i = 0; i < 4; ++i) m_uiActiveOrder[i] = i; for (int i = 0; i < 3; ++i) @@ -218,7 +218,7 @@ public: m_uiActivedCreatureGUID = temp->GetGUID(); temp->CastSpell(me, SPELL_CHANNEL_SPIRIT_TO_YMIRON, true); temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - temp->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + temp->SetDisableGravity(true); switch (m_uiActiveOrder[m_uiActivedNumber]) { case 0: m_bIsActiveWithBJORN = true; break; diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp index cb596f284c5..26fbbf4d717 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp @@ -97,7 +97,8 @@ public: bool IsEncounterInProgress() const { for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; + if (m_auiEncounter[i] == IN_PROGRESS) + return true; return false; } diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp index 2f4079d4e3c..4980ed36ec3 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp @@ -139,7 +139,7 @@ class boss_emalon : public CreatureScript case EVENT_OVERCHARGE: if (!summons.empty()) { - Creature* minion = Unit::GetCreature(*me, SelectRandomContainerElement(summons)); + Creature* minion = Unit::GetCreature(*me, Trinity::Containers::SelectRandomContainerElement(summons)); if (minion && minion->isAlive()) { minion->CastSpell(me, SPELL_OVERCHARGED, true); @@ -189,7 +189,7 @@ class mob_tempest_minion : public CreatureScript OverchargedTimer = 0; } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { if (Creature* emalon = Unit::GetCreature(*me, instance ? instance->GetData64(DATA_EMALON) : 0)) { diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp index 162f59fa5b7..100f1fccac8 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp @@ -125,7 +125,7 @@ class mob_frost_warder : public CreatureScript struct mob_frost_warderAI : public ScriptedAI { - mob_frost_warderAI(Creature* c) : ScriptedAI(c) {} + mob_frost_warderAI(Creature* creature) : ScriptedAI(creature) {} void Reset() { diff --git a/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp b/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp index 74fc2505969..37ef8bf2788 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp @@ -57,9 +57,9 @@ public: struct boss_cyanigosaAI : public ScriptedAI { - boss_cyanigosaAI(Creature* c) : ScriptedAI(c) + boss_cyanigosaAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 uiArcaneVacuumTimer; @@ -168,7 +168,7 @@ class achievement_defenseless : public AchievementCriteriaScript bool OnCheck(Player* /*player*/, Unit* target) { - if(!target) + if (!target) return false; InstanceScript* instance = target->GetInstanceScript(); diff --git a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp index 63f0cd39893..31902acfc46 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp @@ -55,9 +55,9 @@ public: struct boss_erekemAI : public ScriptedAI { - boss_erekemAI(Creature* c) : ScriptedAI(c) + boss_erekemAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 uiBloodlustTimer; @@ -270,9 +270,9 @@ public: struct mob_erekem_guardAI : public ScriptedAI { - mob_erekem_guardAI(Creature* c) : ScriptedAI(c) + mob_erekem_guardAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 uiGushingWoundTimer; diff --git a/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp b/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp index c5b2cb3c327..7a8254ad2b6 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp @@ -41,9 +41,9 @@ public: struct boss_lavanthorAI : public ScriptedAI { - boss_lavanthorAI(Creature* c) : ScriptedAI(c) + boss_lavanthorAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 uiFireboltTimer; diff --git a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp index 84b04579681..1a70846e1b6 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp @@ -37,9 +37,9 @@ public: struct boss_moraggAI : public ScriptedAI { - boss_moraggAI(Creature* c) : ScriptedAI(c) + boss_moraggAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 uiOpticLinkTimer; diff --git a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp index ff2009c2a17..4569741e459 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp @@ -61,9 +61,9 @@ public: struct boss_zuramatAI : public ScriptedAI { - boss_zuramatAI(Creature* c) : ScriptedAI(c) + boss_zuramatAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; diff --git a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp index 5980c534595..37a13388b5f 100644 --- a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp @@ -221,7 +221,8 @@ public: bool IsEncounterInProgress() const { for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; + if (m_auiEncounter[i] == IN_PROGRESS) + return true; return false; } @@ -689,7 +690,8 @@ public: { AddWave(); bActive = false; - uiActivationTimer = 5000; + // 1 minute waiting time after each boss fight + uiActivationTimer = (uiWaveCount == 6 || uiWaveCount == 12) ? 60000 : 5000; } else uiActivationTimer -= diff; } @@ -795,7 +797,7 @@ public: } } - void ProcessEvent(WorldObject* /*pGO*/, uint32 uiEventId) + void ProcessEvent(WorldObject* /*go*/, uint32 uiEventId) { switch (uiEventId) { diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp index 8b77cb250da..e9d2c85e13e 100644 --- a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp @@ -253,10 +253,10 @@ class npc_sinclari_vh : public CreatureScript public: npc_sinclari_vh() : CreatureScript("npc_sinclari_vh") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: player->CLOSE_GOSSIP_MENU(); @@ -363,7 +363,7 @@ public: { if (Creature* pGuard = *itr) { - pGuard->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pGuard->SetWalk(false); pGuard->GetMotionMaster()->MovePoint(0, MovePosition); } } @@ -426,9 +426,9 @@ public: struct mob_azure_saboteurAI : public npc_escortAI { - mob_azure_saboteurAI(Creature* c):npc_escortAI(c) + mob_azure_saboteurAI(Creature* creature):npc_escortAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); bHasGotMovingPoints = false; uiBoss = 0; Reset(); @@ -447,32 +447,32 @@ public: me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - void WaypointReached(uint32 uiWPointId) + void WaypointReached(uint32 waypointId) { switch (uiBoss) { case 1: - if (uiWPointId == 2) + if (waypointId == 2) FinishPointReached(); break; case 2: - if (uiWPointId == 2) + if (waypointId == 2) FinishPointReached(); break; case 3: - if (uiWPointId == 1) + if (waypointId == 1) FinishPointReached(); break; case 4: - if (uiWPointId == 0) + if (waypointId == 0) FinishPointReached(); break; case 5: - if (uiWPointId == 0) + if (waypointId == 0) FinishPointReached(); break; case 6: - if (uiWPointId == 4) + if (waypointId == 4) FinishPointReached(); break; } @@ -550,9 +550,9 @@ public: struct npc_teleportation_portalAI : public ScriptedAI { - npc_teleportation_portalAI(Creature* c) : ScriptedAI(c), listOfMobs(me) + npc_teleportation_portalAI(Creature* creature) : ScriptedAI(creature), listOfMobs(me) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); uiTypeOfMobsPortal = urand(0, 1); // 0 - elite mobs 1 - portal guardian or portal keeper with regular mobs bPortalGuardianOrKeeperOrEliteSpawn = false; } @@ -675,9 +675,9 @@ public: struct violet_hold_trashAI : public npc_escortAI { - violet_hold_trashAI(Creature* c):npc_escortAI(c) + violet_hold_trashAI(Creature* creature):npc_escortAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); bHasGotMovingPoints = false; if (instance) portalLocationID = instance->GetData(DATA_PORTAL_LOCATION); @@ -690,32 +690,32 @@ struct violet_hold_trashAI : public npc_escortAI uint32 portalLocationID; uint32 secondPortalRouteID; - void WaypointReached(uint32 uiPointId) + void WaypointReached(uint32 waypointId) { switch (portalLocationID) { case 0: - if (uiPointId == 5) + if (waypointId == 5) CreatureStartAttackDoor(); break; case 1: - if ((uiPointId == 8 && secondPortalRouteID == 0) || (uiPointId == 7 && secondPortalRouteID == 1)) + if ((waypointId == 8 && secondPortalRouteID == 0) || (waypointId == 7 && secondPortalRouteID == 1)) CreatureStartAttackDoor(); break; case 2: - if (uiPointId == 7) + if (waypointId == 7) CreatureStartAttackDoor(); break; case 3: - if (uiPointId == 8) + if (waypointId == 8) CreatureStartAttackDoor(); break; case 4: - if (uiPointId == 5) + if (waypointId == 5) CreatureStartAttackDoor(); break; case 5: - if (uiPointId == 3) + if (waypointId == 3) CreatureStartAttackDoor(); break; } @@ -778,7 +778,7 @@ struct violet_hold_trashAI : public npc_escortAI } } - void JustDied(Unit* /*unit*/) + void JustDied(Unit* /*killer*/) { if (Creature* portal = Unit::GetCreature((*me), instance->GetData64(DATA_TELEPORTATION_PORTAL))) CAST_AI(npc_teleportation_portal_vh::npc_teleportation_portalAI, portal->AI())->SummonedMobDied(me); @@ -808,9 +808,9 @@ public: struct mob_azure_invaderAI : public violet_hold_trashAI { - mob_azure_invaderAI(Creature* c) : violet_hold_trashAI(c) + mob_azure_invaderAI(Creature* creature) : violet_hold_trashAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 uiCleaveTimer; @@ -886,9 +886,9 @@ public: struct mob_azure_binderAI : public violet_hold_trashAI { - mob_azure_binderAI(Creature* c) : violet_hold_trashAI(c) + mob_azure_binderAI(Creature* creature) : violet_hold_trashAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 uiArcaneExplosionTimer; @@ -964,9 +964,9 @@ public: struct mob_azure_mage_slayerAI : public violet_hold_trashAI { - mob_azure_mage_slayerAI(Creature* c) : violet_hold_trashAI(c) + mob_azure_mage_slayerAI(Creature* creature) : violet_hold_trashAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 uiArcaneEmpowermentTimer; @@ -1024,9 +1024,9 @@ public: struct mob_azure_raiderAI : public violet_hold_trashAI { - mob_azure_raiderAI(Creature* c) : violet_hold_trashAI(c) + mob_azure_raiderAI(Creature* creature) : violet_hold_trashAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 uiConcussionBlowTimer; @@ -1076,9 +1076,9 @@ public: struct mob_azure_stalkerAI : public violet_hold_trashAI { - mob_azure_stalkerAI(Creature* c) : violet_hold_trashAI(c) + mob_azure_stalkerAI(Creature* creature) : violet_hold_trashAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 uiBackstabTimer; uint32 uiTacticalBlinkTimer; @@ -1135,9 +1135,9 @@ public: struct mob_azure_spellbreakerAI : public violet_hold_trashAI { - mob_azure_spellbreakerAI(Creature* c) : violet_hold_trashAI(c) + mob_azure_spellbreakerAI(Creature* creature) : violet_hold_trashAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 uiArcaneBlastTimer; @@ -1219,9 +1219,9 @@ public: struct mob_azure_captainAI : public violet_hold_trashAI { - mob_azure_captainAI(Creature* c) : violet_hold_trashAI(c) + mob_azure_captainAI(Creature* creature) : violet_hold_trashAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 uiMortalStrikeTimer; @@ -1271,9 +1271,9 @@ public: struct mob_azure_sorcerorAI : public violet_hold_trashAI { - mob_azure_sorcerorAI(Creature* c) : violet_hold_trashAI(c) + mob_azure_sorcerorAI(Creature* creature) : violet_hold_trashAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 uiArcaneStreamTimer; diff --git a/src/server/scripts/Northrend/borean_tundra.cpp b/src/server/scripts/Northrend/borean_tundra.cpp index 11fb0933b9b..8b51618eedd 100644 --- a/src/server/scripts/Northrend/borean_tundra.cpp +++ b/src/server/scripts/Northrend/borean_tundra.cpp @@ -60,7 +60,7 @@ public: struct npc_sinkhole_kill_creditAI : public ScriptedAI { - npc_sinkhole_kill_creditAI(Creature* c) : ScriptedAI(c){} + npc_sinkhole_kill_creditAI(Creature* creature) : ScriptedAI(creature){} uint32 uiPhaseTimer; uint8 Phase; @@ -139,7 +139,7 @@ public: case 7: DoCast(me, SPELL_EXPLODE_CART, true); if (Player* caster = Unit::GetPlayer(*me, casterGuid)) - caster->KilledMonster(me->GetCreatureInfo(), me->GetGUID()); + caster->KilledMonster(me->GetCreatureTemplate(), me->GetGUID()); uiPhaseTimer = 5000; Phase = 8; break; @@ -170,7 +170,7 @@ public: struct npc_khunok_the_behemothAI : public ScriptedAI { - npc_khunok_the_behemothAI(Creature* c) : ScriptedAI(c) {} + npc_khunok_the_behemothAI(Creature* creature) : ScriptedAI(creature) {} void MoveInLineOfSight(Unit* who) { @@ -186,7 +186,7 @@ public: if (owner->GetTypeId() == TYPEID_PLAYER) { owner->CastSpell(owner, 46231, true); - CAST_CRE(who)->ForcedDespawn(); + CAST_CRE(who)->DespawnOrUnsummon(); } } } @@ -228,10 +228,10 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) + if (action == GOSSIP_ACTION_INFO_DEF + 1) { player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, SPELL_TELEPORT_TO_SARAGOSA, true); @@ -273,10 +273,10 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { player->CLOSE_GOSSIP_MENU(); @@ -309,7 +309,6 @@ public: bool OnGossipHello(Player* player, Creature* creature) { - if (player->GetQuestStatus(QUEST_SPIRITS_WATCH_OVER_US) == QUEST_STATUS_INCOMPLETE) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_I, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); @@ -317,10 +316,10 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: player->CastSpell(player, SPELL_CREATURE_TOTEM_OF_ISSLIRUK, true); @@ -350,27 +349,28 @@ public: struct mob_nerubar_victimAI : public ScriptedAI { - mob_nerubar_victimAI(Creature* c) : ScriptedAI(c) {} + mob_nerubar_victimAI(Creature* creature) : ScriptedAI(creature) {} void Reset() {} void EnterCombat(Unit* /*who*/) {} void MoveInLineOfSight(Unit* /*who*/) {} - void JustDied(Unit* Killer) + void JustDied(Unit* killer) { - if (Killer->GetTypeId() == TYPEID_PLAYER) + Player* player = killer->ToPlayer(); + if (!player) + return; + + if (player->GetQuestStatus(11611) == QUEST_STATUS_INCOMPLETE) { - if (CAST_PLR(Killer)->GetQuestStatus(11611) == QUEST_STATUS_INCOMPLETE) + uint8 uiRand = urand(0, 99); + if (uiRand < 25) { - uint8 uiRand = urand(0, 99); - if (uiRand < 25) - { - Killer->CastSpell(me, 45532, true); - CAST_PLR(Killer)->KilledMonsterCredit(WARSONG_PEON, 0); - } - else if (uiRand < 75) - Killer->CastSpell(me, nerubarVictims[urand(0, 2)], true); + player->CastSpell(me, 45532, true); + player->KilledMonsterCredit(WARSONG_PEON, 0); } + else if (uiRand < 75) + player->CastSpell(me, nerubarVictims[urand(0, 2)], true); } } }; @@ -403,9 +403,9 @@ public: { me->SetReactState(REACT_PASSIVE); - if (GameObject* pGO = me->FindNearestGameObject(GO_SCOURGE_CAGE, 5.0f)) - if (pGO->GetGoState() == GO_STATE_ACTIVE) - pGO->SetGoState(GO_STATE_READY); + if (GameObject* go = me->FindNearestGameObject(GO_SCOURGE_CAGE, 5.0f)) + if (go->GetGoState() == GO_STATE_ACTIVE) + go->SetGoState(GO_STATE_READY); } }; @@ -575,7 +575,7 @@ public: struct npc_nesingwary_trapperAI : public ScriptedAI { - npc_nesingwary_trapperAI(Creature* c) : ScriptedAI(c) { c->SetVisible(false); } + npc_nesingwary_trapperAI(Creature* creature) : ScriptedAI(creature) { creature->SetVisible(false); } uint64 go_caribouGUID; uint8 Phase; @@ -588,10 +588,11 @@ public: Phase = 1; go_caribouGUID = 0; } + void EnterCombat(Unit* /*who*/) {} void MoveInLineOfSight(Unit* /*who*/) {} - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { if (GameObject* go_caribou = me->GetMap()->GetGameObject(go_caribouGUID)) go_caribou->SetLootState(GO_JUST_DEACTIVATED); @@ -617,7 +618,6 @@ public: uiPhaseTimer = 2000; Phase = 2; break; - case 2: if (GameObject* go_fur = me->FindNearestGameObject(GO_HIGH_QUALITY_FUR, 11.0f)) me->GetMotionMaster()->MovePoint(0, go_fur->GetPositionX(), go_fur->GetPositionY(), go_fur->GetPositionZ()); @@ -645,7 +645,6 @@ public: uiPhaseTimer = 500; Phase = 7; break; - case 7: { GameObject* go_caribou = NULL; @@ -662,7 +661,7 @@ public: Phase = 8; uiPhaseTimer = 1000; } - break; + break; case 8: DoCast(me, SPELL_TRAPPED, true); Phase = 0; @@ -718,9 +717,9 @@ public: } } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { - switch (i) + switch (waypointId) { case 0: IntroPhase = 1; @@ -849,7 +848,7 @@ public: struct npc_nexus_drake_hatchlingAI : public FollowerAI //The spell who makes the npc follow the player is missing, also we can use FollowerAI! { - npc_nexus_drake_hatchlingAI(Creature* c) : FollowerAI(c) {} + npc_nexus_drake_hatchlingAI(Creature* creature) : FollowerAI(creature) {} uint64 HarpoonerGUID; bool WithRedDragonBlood; @@ -1014,14 +1013,13 @@ public: uiPhaseTimer = 0; } - void WaypointReached(uint32 uiPointId) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); - if (!player) return; - switch (uiPointId) + switch (waypointId) { case 3: SetEscortPaused(true); @@ -1030,18 +1028,17 @@ public: uiArthas = pArthas->GetGUID(); pArthas->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pArthas->SetReactState(REACT_PASSIVE); - pArthas->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pArthas->SetWalk(true); pArthas->GetMotionMaster()->MovePoint(0, 3737.374756f, 3564.841309f, 477.433014f); } if (Creature* pTalbot = me->SummonCreature(NPC_COUNSELOR_TALBOT, 3747.23f, 3614.936f, 473.321f, 4.462012f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 120000)) { uiTalbot = pTalbot->GetGUID(); - pTalbot->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTalbot->SetWalk(true); pTalbot->GetMotionMaster()->MovePoint(0, 3738.000977f, 3568.882080f, 477.433014f); } - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(false); break; - case 4: SetEscortPaused(true); uiPhase = 7; @@ -1118,13 +1115,13 @@ public: if (Creature* pArlos = me->SummonCreature(NPC_GENERAL_ARLOS, 3745.527100f, 3615.655029f, 473.321533f, 4.447805f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 120000)) { uiArlos = pArlos->GetGUID(); - pArlos->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pArlos->SetWalk(true); pArlos->GetMotionMaster()->MovePoint(0, 3735.570068f, 3572.419922f, 477.441010f); } if (Creature* pLeryssa = me->SummonCreature(NPC_LERYSSA, 3749.654541f, 3614.959717f, 473.323486f, 4.524959f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 120000)) { uiLeryssa = pLeryssa->GetGUID(); - pLeryssa->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pLeryssa->SetWalk(false); pLeryssa->SetReactState(REACT_PASSIVE); pLeryssa->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pLeryssa->GetMotionMaster()->MovePoint(0, 3741.969971f, 3571.439941f, 477.441010f); @@ -1256,10 +1253,10 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: CAST_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID()); @@ -1446,11 +1443,11 @@ public: pArlos->Kill(pArlos, false); pLeryssa->RemoveAura(SPELL_STUN); pLeryssa->ClearUnitState(UNIT_STATE_STUNNED); - pLeryssa->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pLeryssa->SetWalk(false); pLeryssa->GetMotionMaster()->MovePoint(0, 3722.114502f, 3564.201660f, 477.441437f); - if (killer->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(killer)->RewardPlayerAndGroupAtEvent(NPC_PRINCE_VALANAR, 0); + if (Player* player = killer->ToPlayer()) + player->RewardPlayerAndGroupAtEvent(NPC_PRINCE_VALANAR, 0); } }; @@ -1631,7 +1628,10 @@ public: StartFollow(pCaster->ToPlayer(), 0, NULL); me->UpdateEntry(NPC_CAPTURED_BERLY_SORCERER, TEAM_NEUTRAL); DoCast(me, SPELL_COSMETIC_ENSLAVE_CHAINS_SELF, true); - CAST_PLR(pCaster)->KilledMonsterCredit(NPC_CAPTURED_BERLY_SORCERER, 0); + + if (Player* player = pCaster->ToPlayer()) + player->KilledMonsterCredit(NPC_CAPTURED_BERLY_SORCERER, 0); + bEnslaved = true; } } @@ -1841,7 +1841,7 @@ public: struct npc_mootoo_the_youngerAI : public npc_escortAI { - npc_mootoo_the_youngerAI(Creature* c) : npc_escortAI(c) {} + npc_mootoo_the_youngerAI(Creature* creature) : npc_escortAI(creature) {} void Reset() { @@ -1854,35 +1854,33 @@ public: player->FailQuest(QUEST_ESCAPING_THE_MIST); } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); - if (!player) return; - switch (i) + switch (waypointId) { - case 10: - me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); - DoScriptText(SAY_2, me); - break; - case 12: - DoScriptText(SAY_3, me); - me->HandleEmoteCommand(EMOTE_ONESHOT_LOOT); - break; - case 16: - DoScriptText(SAY_4, me); - me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); - break; - case 20: - me->SetPhaseMask(1, true); - DoScriptText(SAY_5, me); - me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); - if (player) + case 10: + me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); + DoScriptText(SAY_2, me); + break; + case 12: + DoScriptText(SAY_3, me); + me->HandleEmoteCommand(EMOTE_ONESHOT_LOOT); + break; + case 16: + DoScriptText(SAY_4, me); + me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); + break; + case 20: + me->SetPhaseMask(1, true); + DoScriptText(SAY_5, me); + me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); player->GroupEventHappens(QUEST_ESCAPING_THE_MIST, me); - SetRun(true); - break; + SetRun(true); + break; } } }; @@ -1926,7 +1924,7 @@ public: struct npc_bonker_togglevoltAI : public npc_escortAI { - npc_bonker_togglevoltAI(Creature* c) : npc_escortAI(c) {} + npc_bonker_togglevoltAI(Creature* creature) : npc_escortAI(creature) {} uint32 Bonker_agro; void Reset() @@ -1955,18 +1953,16 @@ public: else Bonker_agro=0; } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); - if (!player) return; - switch (i) + switch (waypointId) { case 29: - if (player) - player->GroupEventHappens(QUEST_GET_ME_OUTA_HERE, me); + player->GroupEventHappens(QUEST_GET_ME_OUTA_HERE, me); break; } } @@ -2026,7 +2022,7 @@ public: struct npc_trapped_mammoth_calfAI : public ScriptedAI { - npc_trapped_mammoth_calfAI(Creature* c) : ScriptedAI(c) {} + npc_trapped_mammoth_calfAI(Creature* creature) : ScriptedAI(creature) {} uint32 uiTimer; bool bStarted; @@ -2036,7 +2032,7 @@ public: uiTimer = 1500; bStarted = false; - GameObject* pTrap; + GameObject* pTrap = NULL; for (uint8 i = 0; i < MammothTrapsNum; ++i) { pTrap = me->FindNearestGameObject(MammothTraps[i], 11.0f); @@ -2071,11 +2067,12 @@ public: void MovementInform(uint32 uiType, uint32 /*uiId*/) { - if (uiType != POINT_MOTION_TYPE) return; + me->DisappearAndDie(); - GameObject* pTrap; + + GameObject* pTrap = NULL; for (uint8 i = 0; i < MammothTrapsNum; ++i) { pTrap = me->FindNearestGameObject(MammothTraps[i], 11.0f); @@ -2114,18 +2111,21 @@ public: struct npc_magmoth_crusherAI : public ScriptedAI { - npc_magmoth_crusherAI(Creature* c) : ScriptedAI(c) {} + npc_magmoth_crusherAI(Creature* creature) : ScriptedAI(creature) {} void JustDied(Unit* killer) { - if (killer->GetTypeId() == TYPEID_PLAYER && - CAST_PLR(killer)->GetQuestStatus(QUEST_YOU_RE_NOT_SO_BIG_NOW) == QUEST_STATUS_INCOMPLETE && + Player* player = killer->ToPlayer(); + if (!player) + return; + + if (player->GetQuestStatus(QUEST_YOU_RE_NOT_SO_BIG_NOW) == QUEST_STATUS_INCOMPLETE && (me->HasAura(SPELL_AURA_NOTSOBIG_1) || me->HasAura(SPELL_AURA_NOTSOBIG_2) || me->HasAura(SPELL_AURA_NOTSOBIG_3) || me->HasAura(SPELL_AURA_NOTSOBIG_4))) { Quest const* qInfo = sObjectMgr->GetQuestTemplate(QUEST_YOU_RE_NOT_SO_BIG_NOW); if (qInfo) - CAST_PLR(killer)->KilledMonsterCredit(qInfo->RequiredNpcOrGo[0], 0); + player->KilledMonsterCredit(qInfo->RequiredNpcOrGo[0], 0); } } }; @@ -2150,13 +2150,15 @@ public: struct npc_seaforium_depth_chargeAI : public ScriptedAI { - npc_seaforium_depth_chargeAI(Creature* c) : ScriptedAI(c) {} + npc_seaforium_depth_chargeAI(Creature* creature) : ScriptedAI(creature) { } uint32 uiExplosionTimer; + void Reset() { uiExplosionTimer = urand(5000, 10000); } + void UpdateAI(const uint32 diff) { if (uiExplosionTimer < diff) @@ -2203,7 +2205,7 @@ public: struct npc_valiance_keep_cannoneerAI : public ScriptedAI { - npc_valiance_keep_cannoneerAI(Creature* c) : ScriptedAI(c) {} + npc_valiance_keep_cannoneerAI(Creature* creature) : ScriptedAI(creature) {} uint32 uiTimer; @@ -2229,7 +2231,6 @@ public: if (!UpdateVictim()) return; } - }; CreatureAI* GetAI(Creature* creature) const @@ -2540,18 +2541,18 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { player->CLOSE_GOSSIP_MENU(); creature->AI()->SetGUID(player->GetGUID()); creature->AI()->DoAction(1); } - if (uiAction == GOSSIP_ACTION_TRADE) + if (action == GOSSIP_ACTION_TRADE) player->GetSession()->SendListInventory(creature->GetGUID()); return true; @@ -2561,31 +2562,31 @@ public: void AddSC_borean_tundra() { - new npc_sinkhole_kill_credit; - new npc_khunok_the_behemoth; - new npc_keristrasza; - new npc_corastrasza; - new npc_iruk; - new mob_nerubar_victim; - new npc_scourge_prisoner; - new npc_jenny; - new npc_fezzix_geartwist; - new npc_nesingwary_trapper; - new npc_lurgglbr; - new npc_nexus_drake_hatchling; - new npc_thassarian; - new npc_image_lich_king; - new npc_counselor_talbot; - new npc_leryssa; - new npc_general_arlos; - new npc_beryl_sorcerer; - new npc_imprisoned_beryl_sorcerer; - new npc_mootoo_the_younger; - new npc_bonker_togglevolt; - new npc_trapped_mammoth_calf; - new npc_magmoth_crusher; - new npc_seaforium_depth_charge; - new npc_valiance_keep_cannoneer; - new npc_warmage_coldarra; - new npc_hidden_cultist; + new npc_sinkhole_kill_credit(); + new npc_khunok_the_behemoth(); + new npc_keristrasza(); + new npc_corastrasza(); + new npc_iruk(); + new mob_nerubar_victim(); + new npc_scourge_prisoner(); + new npc_jenny(); + new npc_fezzix_geartwist(); + new npc_nesingwary_trapper(); + new npc_lurgglbr(); + new npc_nexus_drake_hatchling(); + new npc_thassarian(); + new npc_image_lich_king(); + new npc_counselor_talbot(); + new npc_leryssa(); + new npc_general_arlos(); + new npc_beryl_sorcerer(); + new npc_imprisoned_beryl_sorcerer(); + new npc_mootoo_the_younger(); + new npc_bonker_togglevolt(); + new npc_trapped_mammoth_calf(); + new npc_magmoth_crusher(); + new npc_seaforium_depth_charge(); + new npc_valiance_keep_cannoneer(); + new npc_warmage_coldarra(); + new npc_hidden_cultist(); } diff --git a/src/server/scripts/Northrend/dalaran.cpp b/src/server/scripts/Northrend/dalaran.cpp index 258d038ee4b..e7b92732066 100644 --- a/src/server/scripts/Northrend/dalaran.cpp +++ b/src/server/scripts/Northrend/dalaran.cpp @@ -153,13 +153,13 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_TRAIN) + if (action == GOSSIP_ACTION_TRAIN) player->GetSession()->SendTrainerList(creature->GetGUID()); - if (uiAction == GOSSIP_ACTION_TRADE) + if (action == GOSSIP_ACTION_TRADE) player->GetSession()->SendListInventory(creature->GetGUID()); return true; diff --git a/src/server/scripts/Northrend/dragonblight.cpp b/src/server/scripts/Northrend/dragonblight.cpp index 0c1837ec37d..4cbe280a9f2 100644 --- a/src/server/scripts/Northrend/dragonblight.cpp +++ b/src/server/scripts/Northrend/dragonblight.cpp @@ -56,10 +56,10 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { player->CLOSE_GOSSIP_MENU(); player->SendMovieStart(MOVIE_ID_GATES); diff --git a/src/server/scripts/Northrend/grizzly_hills.cpp b/src/server/scripts/Northrend/grizzly_hills.cpp index ccb31c869a4..2da84dd3fdb 100644 --- a/src/server/scripts/Northrend/grizzly_hills.cpp +++ b/src/server/scripts/Northrend/grizzly_hills.cpp @@ -74,12 +74,13 @@ public: summoned->AI()->AttackStart(me->getVictim()); } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); if (!player) return; - switch (i) + + switch (waypointId) { case 9: if (Creature* Mrfloppy = GetClosestCreatureWithEntry(me, NPC_MRFLOPPY, 100.0f)) @@ -162,7 +163,7 @@ public: player->GroupEventHappens(QUEST_PERILOUS_ADVENTURE, me); DoScriptText(SAY_QUEST_COMPLETE, me, player); } - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(false); break; case 25: DoScriptText(SAY_VICTORY4, me); @@ -194,9 +195,7 @@ public: if (HasEscortState(STATE_ESCORT_ESCORTING)) { if (m_uiChatTimer <= uiDiff) - { m_uiChatTimer = 12000; - } else m_uiChatTimer -= uiDiff; } @@ -209,9 +208,7 @@ public: { DoScriptText(SAY_QUEST_ACCEPT, creature); if (Creature* Mrfloppy = GetClosestCreatureWithEntry(creature, NPC_MRFLOPPY, 180.0f)) - { Mrfloppy->GetMotionMaster()->MoveFollow(creature, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); - } if (npc_escortAI* pEscortAI = CAST_AI(npc_emily::npc_emilyAI, (creature->AI()))) pEscortAI->Start(true, false, player->GetGUID()); @@ -233,7 +230,7 @@ public: struct npc_mrfloppyAI : public ScriptedAI { - npc_mrfloppyAI(Creature* c) : ScriptedAI(c) {} + npc_mrfloppyAI(Creature* creature) : ScriptedAI(creature) {} uint64 EmilyGUID; uint64 RWORGGUID; @@ -318,7 +315,7 @@ public: void SpellHit(Unit* pCaster, const SpellInfo* pSpell) { if (pSpell->Id == SPELL_OUTHOUSE_GROANS) - { + { ++m_counter; if (m_counter < 5) DoCast(pCaster, SPELL_CAMERA_SHAKE, true); @@ -327,8 +324,13 @@ public: DoCast(me, SPELL_DUST_FIELD, true); switch (m_gender) { - case GENDER_FEMALE: DoPlaySoundToSet(me, SOUND_FEMALE); break; - case GENDER_MALE: DoPlaySoundToSet(me, SOUND_MALE); break; + case GENDER_FEMALE: + DoPlaySoundToSet(me, SOUND_FEMALE); + break; + + case GENDER_MALE: + DoPlaySoundToSet(me, SOUND_MALE); + break; } } } @@ -471,13 +473,13 @@ public: struct npc_wounded_skirmisherAI : public ScriptedAI { - npc_wounded_skirmisherAI(Creature* c) : ScriptedAI(c) {} + npc_wounded_skirmisherAI(Creature* creature) : ScriptedAI(creature) {} uint64 uiPlayerGUID; uint32 DespawnTimer; - void Reset () + void Reset() { DespawnTimer = 5000; uiPlayerGUID = 0; @@ -503,7 +505,6 @@ public: me->SetStandState(UNIT_STAND_STATE_STAND); me->DespawnOrUnsummon(DespawnTimer); } - } } @@ -511,6 +512,7 @@ public: { if (!UpdateVictim()) return; + DoMeleeAttackIfReady(); } }; @@ -695,12 +697,12 @@ public: void AddSC_grizzly_hills() { - new npc_emily; - new npc_mrfloppy; - new npc_outhouse_bunny; - new npc_tallhorn_stag; - new npc_amberpine_woodsman; - new npc_wounded_skirmisher; + new npc_emily(); + new npc_mrfloppy(); + new npc_outhouse_bunny(); + new npc_tallhorn_stag(); + new npc_amberpine_woodsman(); + new npc_wounded_skirmisher(); new npc_lightning_sentry(); new npc_venture_co_straggler(); } diff --git a/src/server/scripts/Northrend/howling_fjord.cpp b/src/server/scripts/Northrend/howling_fjord.cpp index 3c44fa0eb44..88cc297868b 100644 --- a/src/server/scripts/Northrend/howling_fjord.cpp +++ b/src/server/scripts/Northrend/howling_fjord.cpp @@ -71,7 +71,7 @@ public: npc_Apothecary_HanesAI(Creature* creature) : npc_escortAI(creature){} uint32 PotTimer; - void Reset () + void Reset() { SetDespawnAtFar(false); PotTimer = 10000; //10 sec cooldown on potion @@ -97,20 +97,20 @@ public: DoMeleeAttackIfReady(); } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); if (!player) return; - switch (i) + + switch (waypointId) { case 1: me->SetReactState(REACT_AGGRESSIVE); SetRun(true); break; case 23: - if (player) - player->GroupEventHappens(QUEST_TRAIL_OF_FIRE, me); + player->GroupEventHappens(QUEST_TRAIL_OF_FIRE, me); me->DespawnOrUnsummon(); break; case 5: @@ -254,10 +254,10 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF + 1: player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_RAZAEL2, creature->GetGUID()); @@ -303,10 +303,10 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_MG_II, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); @@ -389,7 +389,7 @@ public: { if (player->isAlive()) { - summon->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + summon->SetWalk(false); summon->GetMotionMaster()->MovePoint(0, afCenter[0], afCenter[1], afCenter[2]); summon->AI()->AttackStart(player); return; diff --git a/src/server/scripts/Northrend/icecrown.cpp b/src/server/scripts/Northrend/icecrown.cpp index 8da992af8fb..fb2e0f6c389 100644 --- a/src/server/scripts/Northrend/icecrown.cpp +++ b/src/server/scripts/Northrend/icecrown.cpp @@ -75,10 +75,10 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); @@ -149,10 +149,10 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { player->CLOSE_GOSSIP_MENU(); creature->SummonCreature(NPC_ARGENT_VALIANT, 8575.451f, 952.472f, 547.554f, 0.38f); diff --git a/src/server/scripts/Northrend/sholazar_basin.cpp b/src/server/scripts/Northrend/sholazar_basin.cpp index 36dc6177f64..93d0182ea08 100644 --- a/src/server/scripts/Northrend/sholazar_basin.cpp +++ b/src/server/scripts/Northrend/sholazar_basin.cpp @@ -55,7 +55,7 @@ public: struct npc_injured_rainspeaker_oracleAI : public npc_escortAI { - npc_injured_rainspeaker_oracleAI(Creature* c) : npc_escortAI(c) { c_guid = c->GetGUID(); } + npc_injured_rainspeaker_oracleAI(Creature* creature) : npc_escortAI(creature) { c_guid = creature->GetGUID(); } uint64 c_guid; @@ -70,39 +70,40 @@ public: } } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); - if (!player) return; - switch (i) + switch (waypointId) { - case 1: SetRun(); break; - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - me->RemoveUnitMovementFlag(MOVEMENTFLAG_SWIMMING); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_JUMPING); - me->SetSpeed(MOVE_SWIM, 0.85f, true); - me->AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_LEVITATING); - break; - case 19: - me->SetUnitMovementFlags(MOVEMENTFLAG_JUMPING); - break; - case 28: - player->GroupEventHappens(QUEST_FORTUNATE_MISUNDERSTANDINGS, me); - // me->RestoreFaction(); - DoScriptText(SAY_END_IRO, me); - SetRun(false); - break; + case 1: + SetRun(); + break; + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + me->RemoveUnitMovementFlag(MOVEMENTFLAG_SWIMMING); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_FALLING); + me->SetSpeed(MOVE_SWIM, 0.85f, true); + me->AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_DISABLE_GRAVITY); + break; + case 19: + me->SetUnitMovementFlags(MOVEMENTFLAG_FALLING); + break; + case 28: + player->GroupEventHappens(QUEST_FORTUNATE_MISUNDERSTANDINGS, me); + // me->RestoreFaction(); + DoScriptText(SAY_END_IRO, me); + SetRun(false); + break; } } @@ -113,8 +114,8 @@ public: if (Player* player = GetPlayerForEscort()) { - if (player->GetQuestStatus(QUEST_FORTUNATE_MISUNDERSTANDINGS) != QUEST_STATUS_COMPLETE) - player->FailQuest(QUEST_FORTUNATE_MISUNDERSTANDINGS); + if (player->GetQuestStatus(QUEST_FORTUNATE_MISUNDERSTANDINGS) != QUEST_STATUS_COMPLETE) + player->FailQuest(QUEST_FORTUNATE_MISUNDERSTANDINGS); } } }; @@ -132,14 +133,14 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { CAST_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID()); CAST_AI(npc_escortAI, (creature->AI()))->SetMaxPlayerDistance(35.0f); - creature->SetUnitMovementFlags(MOVEMENTFLAG_JUMPING); + creature->SetUnitMovementFlags(MOVEMENTFLAG_FALLING); DoScriptText(SAY_START_IRO, creature); switch (player->GetTeam()){ @@ -206,10 +207,10 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_VEKJIK_ITEM2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); @@ -263,10 +264,10 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AOF2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); @@ -305,10 +306,9 @@ public: if (me->isDead()) return; - if (me->isSummon()) - if (Unit* summoner = me->ToTempSummon()->GetSummoner()) - if (summoner) - me->GetMotionMaster()->MovePoint(0, summoner->GetPositionX(), summoner->GetPositionY(), summoner->GetPositionZ()); + if (TempSummon* summ = me->ToTempSummon()) + if (Unit* summoner = summ->GetSummoner()) + me->GetMotionMaster()->MovePoint(0, summoner->GetPositionX(), summoner->GetPositionY(), summoner->GetPositionZ()); Reset(); } @@ -359,10 +359,11 @@ public: uint32 m_uiChatTimer; - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); - switch (i) + + switch (waypointId) { case 0: DoScriptText(SAY_WP_2, me); @@ -401,12 +402,12 @@ public: { m_uiChatTimer = 4000; } + void JustDied(Unit* /*killer*/) { - Player* player = GetPlayerForEscort(); if (HasEscortState(STATE_ESCORT_ESCORTING)) { - if (player) + if (Player* player = GetPlayerForEscort()) player->FailQuest(QUEST_DISASTER); } } @@ -647,11 +648,11 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); uint32 spellId = 0; - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF + 1: spellId = SPELL_ADD_ORANGE; break; case GOSSIP_ACTION_INFO_DEF + 2: spellId = SPELL_ADD_BANANAS; break; diff --git a/src/server/scripts/Northrend/storm_peaks.cpp b/src/server/scripts/Northrend/storm_peaks.cpp index 7bd59b92b7f..15239e9f836 100644 --- a/src/server/scripts/Northrend/storm_peaks.cpp +++ b/src/server/scripts/Northrend/storm_peaks.cpp @@ -61,10 +61,10 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { DoScriptText(SAY_AGGRO, creature); player->CLOSE_GOSSIP_MENU(); @@ -106,10 +106,10 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); @@ -166,10 +166,10 @@ public: return false; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: player->ADD_GOSSIP_ITEM(0, GOSSIP_SN1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); @@ -193,43 +193,6 @@ public: }; /*###### -## npc_goblin_prisoner -######*/ - -enum eGoblinPrisoner -{ - GO_RUSTY_CAGE = 191544 -}; - -class npc_goblin_prisoner : public CreatureScript -{ -public: - npc_goblin_prisoner() : CreatureScript("npc_goblin_prisoner") { } - - struct npc_goblin_prisonerAI : public ScriptedAI - { - npc_goblin_prisonerAI(Creature* creature) : ScriptedAI (creature){} - - void Reset() - { - me->SetReactState(REACT_PASSIVE); - - if (GameObject* pGO = me->FindNearestGameObject(GO_RUSTY_CAGE, 5.0f)) - { - if (pGO->GetGoState() == GO_STATE_ACTIVE) - pGO->SetGoState(GO_STATE_READY); - } - } - - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new npc_goblin_prisonerAI(creature); - } -}; - -/*###### ## npc_victorious_challenger ######*/ @@ -307,10 +270,10 @@ public: return false; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { player->CLOSE_GOSSIP_MENU(); creature->setFaction(14); @@ -363,10 +326,10 @@ public: return false; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOKLIRACRONE1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); @@ -411,18 +374,20 @@ public: { npc_injured_goblinAI(Creature* creature) : npc_escortAI(creature) { } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); - switch (i) + if (!player) + return; + + switch (waypointId) { - case 26: - DoScriptText(SAY_END_WP_REACHED, me, player); - break; - case 27: - if (player) + case 26: + DoScriptText(SAY_END_WP_REACHED, me, player); + break; + case 27: player->GroupEventHappens(QUEST_BITTER_DEPARTURE, me); - break; + break; } } @@ -474,12 +439,12 @@ public: return false; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); npc_escortAI* pEscortAI = CAST_AI(npc_injured_goblin::npc_injured_goblinAI, creature->AI()); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { pEscortAI->Start(true, true, player->GetGUID()); creature->setFaction(113); @@ -585,7 +550,7 @@ public: // drake unsummoned, passengers dropped if (!me->IsOnVehicle(drake) && !hasEmptySeats) - me->ForcedDespawn(3000); + me->DespawnOrUnsummon(3000); if (enter_timer <= 0) return; @@ -602,9 +567,9 @@ public: enter_timer -= diff; } - void MoveInLineOfSight(Unit* unit) + void MoveInLineOfSight(Unit* who) { - if (!unit || !drakeGUID) + if (!who || !drakeGUID) return; Creature* drake = Unit::GetCreature(*me, drakeGUID); @@ -616,21 +581,21 @@ public: if (!me->IsOnVehicle(drake) && !me->HasAura(SPELL_ICE_PRISON)) { - if (unit->IsVehicle() && me->IsWithinDist(unit, 25.0f, true) && unit->ToCreature() && unit->ToCreature()->GetEntry() == 29709) + if (who->IsVehicle() && me->IsWithinDist(who, 25.0f, true) && who->ToCreature() && who->ToCreature()->GetEntry() == 29709) { - uint8 seat = unit->GetVehicleKit()->GetNextEmptySeat(0, true); + uint8 seat = who->GetVehicleKit()->GetNextEmptySeat(0, true); if (seat <= 0) return; - me->EnterVehicle(unit, seat); + me->EnterVehicle(who, seat); me->SendMovementFlagUpdate(); hasEmptySeats = false; } } - if (unit->ToCreature() && me->IsOnVehicle(drake)) + if (who->ToCreature() && me->IsOnVehicle(drake)) { - if (unit->ToCreature()->GetEntry() == NPC_QUEST_GIVER && me->IsWithinDist(unit, 15.0f, false)) + if (who->ToCreature()->GetEntry() == NPC_QUEST_GIVER && me->IsWithinDist(who, 15.0f, false)) { Unit* rider = drake->GetVehicleKit()->GetPassenger(0); if (!rider) @@ -640,7 +605,7 @@ public: me->ExitVehicle(); me->CastSpell(me, SPELL_SUMMON_LIBERATED, true); - me->ForcedDespawn(500); + me->DespawnOrUnsummon(500); // drake is empty now, deliver credit for drake and despawn him if (drake->GetVehicleKit()->HasEmptySeat(1) && @@ -651,7 +616,7 @@ public: if (rider->ToPlayer()) rider->ToPlayer()->KilledMonsterCredit(29709, 0); - drake->ToCreature()->ForcedDespawn(0); + drake->DespawnOrUnsummon(0); } } } @@ -706,7 +671,7 @@ public: } } - void WaypointReached(uint32 /*wp*/) + void WaypointReached(uint32 /*waypointId*/) { } @@ -746,7 +711,7 @@ class npc_hyldsmeet_protodrake : public CreatureScript class npc_hyldsmeet_protodrakeAI : public CreatureAI { public: - npc_hyldsmeet_protodrakeAI(Creature* c) : CreatureAI(c), _accessoryRespawnTimer(0), _vehicleKit(c->GetVehicleKit()) {} + npc_hyldsmeet_protodrakeAI(Creature* creature) : CreatureAI(creature), _accessoryRespawnTimer(0), _vehicleKit(creature->GetVehicleKit()) {} void PassengerBoarded(Unit* who, int8 /*seat*/, bool apply) { @@ -783,15 +748,14 @@ class npc_hyldsmeet_protodrake : public CreatureScript void AddSC_storm_peaks() { - new npc_agnetta_tyrsdottar; - new npc_frostborn_scout; - new npc_thorim; - new npc_goblin_prisoner; - new npc_victorious_challenger; - new npc_loklira_crone; - new npc_injured_goblin; - new npc_roxi_ramrocket; - new npc_brunnhildar_prisoner; - new npc_icefang; - new npc_hyldsmeet_protodrake; + new npc_agnetta_tyrsdottar(); + new npc_frostborn_scout(); + new npc_thorim(); + new npc_victorious_challenger(); + new npc_loklira_crone(); + new npc_injured_goblin(); + new npc_roxi_ramrocket(); + new npc_brunnhildar_prisoner(); + new npc_icefang(); + new npc_hyldsmeet_protodrake(); } diff --git a/src/server/scripts/Northrend/zuldrak.cpp b/src/server/scripts/Northrend/zuldrak.cpp index 0af82345dce..369f47cfb1c 100644 --- a/src/server/scripts/Northrend/zuldrak.cpp +++ b/src/server/scripts/Northrend/zuldrak.cpp @@ -52,8 +52,7 @@ public: float x, y, z; me->GetClosePoint(x, y, z, me->GetObjectSize() / 3, 0.1f); - if (Unit* summon = me->SummonCreature(NPC_RAGECLAW, x, y, z, - 0, TEMPSUMMON_DEAD_DESPAWN, 1000)) + if (Unit* summon = me->SummonCreature(NPC_RAGECLAW, x, y, z, 0, TEMPSUMMON_DEAD_DESPAWN, 1000)) { RageclawGUID = summon->GetGUID(); LockRageclaw(); @@ -92,7 +91,7 @@ public: if (Creature* pRageclaw = Unit::GetCreature(*me, RageclawGUID)) { UnlockRageclaw(pCaster); - pCaster->ToPlayer()->KilledMonster(pRageclaw->GetCreatureInfo(), RageclawGUID); + pCaster->ToPlayer()->KilledMonster(pRageclaw->GetCreatureTemplate(), RageclawGUID); me->DisappearAndDie(); } else @@ -156,7 +155,7 @@ public: me->RemoveAurasDueToSpell(SPELL_KNEEL); - me->setFaction(me->GetCreatureInfo()->faction_H); + me->setFaction(me->GetCreatureTemplate()->faction_H); DoCast(me, SPELL_UNSHACKLED, true); me->MonsterSay(SAY_RAGECLAW, LANG_UNIVERSAL, 0); @@ -223,10 +222,10 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, SPELL_GYMER, true); @@ -617,9 +616,9 @@ public: pWhisker->RemoveFromWorld(); } - void MovementInform(uint32 uiType, uint32 /*uiId*/) + void MovementInform(uint32 type, uint32 /*pointId*/) { - if (uiType != POINT_MOTION_TYPE) + if (type != EFFECT_MOTION_TYPE) return; me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); @@ -741,9 +740,9 @@ public: bEnrage = false; } - void WaypointReached(uint32 uiI) + void WaypointReached(uint32 waypointId) { - switch (uiI) + switch (waypointId) { case 6: me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0); @@ -935,9 +934,9 @@ public: bThunderClap = false; } - void WaypointReached(uint32 uiI) + void WaypointReached(uint32 waypointId) { - switch (uiI) + switch (waypointId) { case 7: me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); @@ -1072,7 +1071,7 @@ public: SummonList.clear(); - for (uint8 uiI = 0; uiI < 16 ; uiI++) + for (uint8 uiI = 0; uiI < 16; uiI++) { if (Creature* summon = me->SummonCreature(Boss[uiBossRandom].uiAdd, AddSpawnPosition[uiI])) { @@ -1328,7 +1327,7 @@ public: break; case 2: // walk forward - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(true); me->GetMotionMaster()->MovePoint(0, me->GetPositionX() + (cos(m_heading) * 10), me->GetPositionY() + (sin(m_heading) * 10), me->GetPositionZ()); m_uiTimer = 5000; m_uiPhase = 3; @@ -1365,10 +1364,10 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF +1) + if (action == GOSSIP_ACTION_INFO_DEF +1) { player->CLOSE_GOSSIP_MENU(); creature->CastSpell(player, SPELL_QUEST_CREDIT, true); @@ -1397,14 +1396,14 @@ class go_scourge_enclosure : public GameObjectScript public: go_scourge_enclosure() : GameObjectScript("go_scourge_enclosure") { } - bool OnGossipHello(Player* player, GameObject* pGO) + bool OnGossipHello(Player* player, GameObject* go) { if (player->GetQuestStatus(QUEST_OUR_ONLY_HOPE) == QUEST_STATUS_INCOMPLETE) { - Creature* pGymerDummy = pGO->FindNearestCreature(NPC_GYMER_DUMMY, 20.0f); + Creature* pGymerDummy = go->FindNearestCreature(NPC_GYMER_DUMMY, 20.0f); if (pGymerDummy) { - pGO->UseDoorOrButton(); + go->UseDoorOrButton(); player->KilledMonsterCredit(pGymerDummy->GetEntry(), pGymerDummy->GetGUID()); pGymerDummy->CastSpell(pGymerDummy, 55529, true); pGymerDummy->DisappearAndDie(); diff --git a/src/server/scripts/OutdoorPvP/CMakeLists.txt b/src/server/scripts/OutdoorPvP/CMakeLists.txt index 450f0f6cc7d..237b974aa9d 100644 --- a/src/server/scripts/OutdoorPvP/CMakeLists.txt +++ b/src/server/scripts/OutdoorPvP/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/> +# Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> # # This file is free software; as a special exception the author gives # unlimited permission to copy and/or distribute it, with or without diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp index 6eb306b52af..1db4fb4dfc9 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp @@ -244,7 +244,6 @@ void OPvPCapturePointEP_NPT::ChangeState() // complete quest objective if (m_TowerState == EP_TS_A || m_TowerState == EP_TS_H) SendObjectiveComplete(EP_NPT_CM, 0); - } void OPvPCapturePointEP_NPT::SendChangePhase() diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h index e019ba7ed7b..14712e0150d 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h @@ -329,4 +329,3 @@ class OutdoorPvPEP : public OutdoorPvP }; #endif - diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp index 5b3468de203..38fed30f542 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp @@ -176,7 +176,6 @@ OutdoorPvPZM::OutdoorPvPZM() m_GraveYard = NULL; m_AllianceTowersControlled = 0; m_HordeTowersControlled = 0; - } bool OutdoorPvPZM::SetupOutdoorPvP() diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h index 2a11139a701..8d2124a3791 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h @@ -219,7 +219,7 @@ class OPvPCapturePointZM_GraveYard : public OPvPCapturePoint bool HandleDropFlag(Player* player, uint32 spellId); - bool CanTalkTo(Player* player, Creature* c, GossipMenuItems const& gso); + bool CanTalkTo(Player* player, Creature* creature, GossipMenuItems const& gso); uint32 GetGraveYardState() const; diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp index ef160a3a5c5..ae1a7296de6 100644 --- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp +++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp @@ -53,7 +53,7 @@ public: struct mob_stolen_soulAI : public ScriptedAI { - mob_stolen_soulAI(Creature* c) : ScriptedAI(c) {} + mob_stolen_soulAI(Creature* creature) : ScriptedAI(creature) {} uint8 myClass; uint32 Class_Timer; @@ -162,7 +162,7 @@ public: struct boss_exarch_maladaarAI : public ScriptedAI { - boss_exarch_maladaarAI(Creature* c) : ScriptedAI(c) + boss_exarch_maladaarAI(Creature* creature) : ScriptedAI(creature) { HasTaunted = false; } @@ -233,7 +233,7 @@ public: DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); //When Exarch Maladar is defeated D'ore appear. @@ -319,7 +319,7 @@ public: struct mob_avatar_of_martyredAI : public ScriptedAI { - mob_avatar_of_martyredAI(Creature* c) : ScriptedAI(c) {} + mob_avatar_of_martyredAI(Creature* creature) : ScriptedAI(creature) {} uint32 Mortal_Strike_timer; diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp index d359917ab28..5fc912f2a01 100644 --- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp +++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp @@ -52,7 +52,7 @@ public: struct boss_shirrak_the_dead_watcherAI : public ScriptedAI { - boss_shirrak_the_dead_watcherAI(Creature* c) : ScriptedAI(c) + boss_shirrak_the_dead_watcherAI(Creature* creature) : ScriptedAI(creature) { } @@ -170,7 +170,7 @@ public: struct mob_focus_fireAI : public ScriptedAI { - mob_focus_fireAI(Creature* c) : ScriptedAI(c) + mob_focus_fireAI(Creature* creature) : ScriptedAI(creature) { } diff --git a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp index aa63f1adf18..a4bba5f28fb 100644 --- a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp +++ b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp @@ -67,7 +67,7 @@ public: struct boss_nexusprince_shaffarAI : public ScriptedAI { - boss_nexusprince_shaffarAI(Creature* c) : ScriptedAI(c), summons(me) { HasTaunted = false; } + boss_nexusprince_shaffarAI(Creature* creature) : ScriptedAI(creature), summons(me) { HasTaunted = false; } uint32 Blink_Timer; uint32 Beacon_Timer; @@ -145,7 +145,7 @@ public: DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEAD, me); summons.DespawnAll(); @@ -233,7 +233,7 @@ public: struct mob_ethereal_beaconAI : public ScriptedAI { - mob_ethereal_beaconAI(Creature* c) : ScriptedAI(c) + mob_ethereal_beaconAI(Creature* creature) : ScriptedAI(creature) { } @@ -325,7 +325,7 @@ public: struct mob_ethereal_apprenticeAI : public ScriptedAI { - mob_ethereal_apprenticeAI(Creature* c) : ScriptedAI(c) {} + mob_ethereal_apprenticeAI(Creature* creature) : ScriptedAI(creature) {} uint32 Cast_Timer; diff --git a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp index d9ba99fcf24..487a1dd41ea 100644 --- a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp +++ b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp @@ -53,7 +53,7 @@ public: struct boss_pandemoniusAI : public ScriptedAI { - boss_pandemoniusAI(Creature* c) : ScriptedAI(c) + boss_pandemoniusAI(Creature* creature) : ScriptedAI(creature) { } @@ -68,7 +68,7 @@ public: VoidBlast_Counter = 0; } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); } diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp index 2fd7498ea82..37544f9377b 100644 --- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp +++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp @@ -65,7 +65,7 @@ public: struct boss_darkweaver_sythAI : public ScriptedAI { - boss_darkweaver_sythAI(Creature* c) : ScriptedAI(c) + boss_darkweaver_sythAI(Creature* creature) : ScriptedAI(creature) { } @@ -97,7 +97,7 @@ public: DoScriptText(RAND(SAY_AGGRO_1, SAY_AGGRO_2, SAY_AGGRO_3), me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); } @@ -206,7 +206,7 @@ public: struct mob_syth_fireAI : public ScriptedAI { - mob_syth_fireAI(Creature* c) : ScriptedAI(c) + mob_syth_fireAI(Creature* creature) : ScriptedAI(creature) { } @@ -265,7 +265,7 @@ public: struct mob_syth_arcaneAI : public ScriptedAI { - mob_syth_arcaneAI(Creature* c) : ScriptedAI(c) + mob_syth_arcaneAI(Creature* creature) : ScriptedAI(creature) { } @@ -319,7 +319,7 @@ public: struct mob_syth_frostAI : public ScriptedAI { - mob_syth_frostAI(Creature* c) : ScriptedAI(c) + mob_syth_frostAI(Creature* creature) : ScriptedAI(creature) { } @@ -374,7 +374,7 @@ public: struct mob_syth_shadowAI : public ScriptedAI { - mob_syth_shadowAI(Creature* c) : ScriptedAI(c) + mob_syth_shadowAI(Creature* creature) : ScriptedAI(creature) { } diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp index c3c53416a9b..768c4bf12d3 100644 --- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp +++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp @@ -64,9 +64,9 @@ public: struct boss_talon_king_ikissAI : public ScriptedAI { - boss_talon_king_ikissAI(Creature* c) : ScriptedAI(c) + boss_talon_king_ikissAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -101,7 +101,7 @@ public: DoScriptText(SAY_INTRO, me); } - if (!me->canFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) + if (!me->CanFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) return; float attackRadius = me->GetAttackDistance(who); @@ -118,7 +118,7 @@ public: DoScriptText(RAND(SAY_AGGRO_1, SAY_AGGRO_2, SAY_AGGRO_3), me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp index d3ea73c5ba0..d92e76685d1 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp @@ -58,10 +58,10 @@ public: { boss_ambassador_hellmawAI(Creature* creature) : npc_escortAI(creature) { - m_instance = creature->GetInstanceScript(); + instance = creature->GetInstanceScript(); } - InstanceScript* m_instance; + InstanceScript* instance; uint32 EventCheck_Timer; uint32 CorrosiveAcid_Timer; @@ -81,17 +81,17 @@ public: IsBanished = true; Enraged = false; - if (m_instance && me->isAlive()) + if (instance && me->isAlive()) { - if (m_instance->GetData(TYPE_OVERSEER) != DONE) + if (instance->GetData(TYPE_OVERSEER) != DONE) DoCast(me, SPELL_BANISH, true); } } void JustReachedHome() { - if (m_instance) - m_instance->SetData(TYPE_HELLMAW, FAIL); + if (instance) + instance->SetData(TYPE_HELLMAW, FAIL); } void MoveInLineOfSight(Unit* who) @@ -102,7 +102,7 @@ public: npc_escortAI::MoveInLineOfSight(who); } - void WaypointReached(uint32 /*i*/) + void WaypointReached(uint32 /*waypointId*/) { } @@ -114,15 +114,15 @@ public: IsBanished = false; Intro = true; - if (m_instance) + if (instance) { - if (m_instance->GetData(TYPE_HELLMAW) != FAIL) + if (instance->GetData(TYPE_HELLMAW) != FAIL) { DoScriptText(SAY_INTRO, me); Start(true, false, 0, NULL, false, true); } - m_instance->SetData(TYPE_HELLMAW, IN_PROGRESS); + instance->SetData(TYPE_HELLMAW, IN_PROGRESS); } } @@ -136,12 +136,12 @@ public: DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); - if (m_instance) - m_instance->SetData(TYPE_HELLMAW, DONE); + if (instance) + instance->SetData(TYPE_HELLMAW, DONE); } void UpdateAI(const uint32 diff) @@ -150,9 +150,9 @@ public: { if (EventCheck_Timer <= diff) { - if (m_instance) + if (instance) { - if (m_instance->GetData(TYPE_OVERSEER) == DONE) + if (instance->GetData(TYPE_OVERSEER) == DONE) { DoIntro(); return; diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp index f7032d78bb6..6eac36f71c8 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp @@ -66,9 +66,9 @@ public: struct boss_blackheart_the_inciterAI : public ScriptedAI { - boss_blackheart_the_inciterAI(Creature* c) : ScriptedAI(c) + boss_blackheart_the_inciterAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -96,7 +96,7 @@ public: DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp index 81a7750d512..8d971c37559 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp @@ -74,7 +74,7 @@ public: struct mob_voidtravelerAI : public ScriptedAI { - mob_voidtravelerAI(Creature* c) : ScriptedAI(c) + mob_voidtravelerAI(Creature* creature) : ScriptedAI(creature) { } @@ -147,9 +147,9 @@ public: struct boss_grandmaster_vorpilAI : public ScriptedAI { - boss_grandmaster_vorpilAI(Creature* c) : ScriptedAI(c) + boss_grandmaster_vorpilAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); Intro = false; } @@ -201,7 +201,7 @@ public: { for (uint8 i = 0; i < 5; ++i) { - Unit* Portal = Unit::GetUnit((*me), PortalsGuid[i]); + Unit* Portal = Unit::GetUnit(*me, PortalsGuid[i]); if (Portal && Portal->isAlive()) Portal->DealDamage(Portal, Portal->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); PortalsGuid[i] = 0; @@ -232,7 +232,7 @@ public: DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); destroyPortals(); diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp index 5fd908c44e8..99661d8818c 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp @@ -48,7 +48,7 @@ public: struct boss_murmurAI : public ScriptedAI { - boss_murmurAI(Creature* c) : ScriptedAI(c) + boss_murmurAI(Creature* creature) : ScriptedAI(creature) { SetCombatMovement(false); } @@ -166,7 +166,7 @@ public: { std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList(); for (std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i) - if (Unit* target = Unit::GetUnit((*me), (*i)->getUnitGuid())) + if (Unit* target = Unit::GetUnit(*me, (*i)->getUnitGuid())) if (target->isAlive() && !me->IsWithinDist(target, 35, false)) DoCast(target, SPELL_THUNDERING_STORM, true); ThunderingStorm_Timer = 15000; @@ -189,7 +189,7 @@ public: { std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList(); for (std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i) - if (Unit* target = Unit::GetUnit((*me), (*i)->getUnitGuid())) + if (Unit* target = Unit::GetUnit(*me, (*i)->getUnitGuid())) if (target->isAlive() && me->IsWithinMeleeRange(target)) { me->TauntApply(target); diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp index 1a9155dacb2..846669552ba 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp @@ -75,7 +75,8 @@ public: bool IsEncounterInProgress() const { for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; + if (m_auiEncounter[i] == IN_PROGRESS) + return true; return false; } diff --git a/src/server/scripts/Outland/BlackTemple/black_temple.cpp b/src/server/scripts/Outland/BlackTemple/black_temple.cpp index a934d5587c2..546f9ee1e7d 100644 --- a/src/server/scripts/Outland/BlackTemple/black_temple.cpp +++ b/src/server/scripts/Outland/BlackTemple/black_temple.cpp @@ -42,10 +42,10 @@ class npc_spirit_of_olum : public CreatureScript public: npc_spirit_of_olum() : CreatureScript("npc_spirit_of_olum") { } - bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) + if (action == GOSSIP_ACTION_INFO_DEF + 1) player->CLOSE_GOSSIP_MENU(); player->InterruptNonMeleeSpells(false); diff --git a/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp b/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp index 3227e685fc4..caac89da765 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp @@ -67,9 +67,9 @@ public: struct boss_gurtogg_bloodboilAI : public ScriptedAI { - boss_gurtogg_bloodboilAI(Creature* c) : ScriptedAI(c) + boss_gurtogg_bloodboilAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -130,7 +130,7 @@ public: DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { if (instance) instance->SetData(DATA_GURTOGGBLOODBOILEVENT, DONE); @@ -186,7 +186,7 @@ public: void RevertThreatOnTarget(uint64 guid) { Unit* unit = NULL; - unit = Unit::GetUnit((*me), guid); + unit = Unit::GetUnit(*me, guid); if (unit) { if (DoGetThreat(unit)) diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp index 58f0e10c950..1926929c97c 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp @@ -379,7 +379,7 @@ public: struct flame_of_azzinothAI : public ScriptedAI { - flame_of_azzinothAI(Creature* c) : ScriptedAI(c) {} + flame_of_azzinothAI(Creature* creature) : ScriptedAI(creature) {} uint32 FlameBlastTimer; uint32 CheckTimer; @@ -392,7 +392,10 @@ public: GlaiveGUID = 0; } - void EnterCombat(Unit* /*who*/) {DoZoneInCombat();} + void EnterCombat(Unit* /*who*/) + { + DoZoneInCombat(); + } void ChargeCheck() { @@ -430,7 +433,10 @@ public: } } - void SetGlaiveGUID(uint64 guid){ GlaiveGUID = guid; } + void SetGlaiveGUID(uint64 guid) + { + GlaiveGUID = guid; + } void UpdateAI(const uint32 diff) { @@ -471,9 +477,9 @@ public: struct boss_illidan_stormrageAI : public ScriptedAI { - boss_illidan_stormrageAI(Creature* c) : ScriptedAI(c), Summons(me) + boss_illidan_stormrageAI(Creature* creature) : ScriptedAI(creature), Summons(me) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); DoCast(me, SPELL_DUAL_WIELD, true); } @@ -502,7 +508,7 @@ public: void SummonedCreatureDespawn(Creature* summon) { - if (summon->GetCreatureInfo()->Entry == FLAME_OF_AZZINOTH) + if (summon->GetCreatureTemplate()->Entry == FLAME_OF_AZZINOTH) { for (uint8 i = 0; i < 2; ++i) if (summon->GetGUID() == FlameGUID[i]) @@ -566,7 +572,9 @@ public: void KilledUnit(Unit* victim) { - if (victim == me) return; + if (victim == me) + return; + // TODO: Find better way to handle emote switch (urand(0, 1)) { @@ -747,10 +755,11 @@ public: final.y = 2 * final.y - initial.y; Creature* Trigger = me->SummonCreature(23069, initial.x, initial.y, initial.z, 0, TEMPSUMMON_TIMED_DESPAWN, 13000); - if (!Trigger) return; + if (!Trigger) + return; Trigger->SetSpeed(MOVE_WALK, 3); - Trigger->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + Trigger->SetWalk(true); Trigger->GetMotionMaster()->MovePoint(0, final.x, final.y, final.z); // Trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -798,7 +807,7 @@ public: { case 1: // lift off me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - me->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); + me->SetUnitMovementFlags(MOVEMENTFLAG_DISABLE_GRAVITY); me->StopMoving(); me->MonsterYell(SAY_TAKEOFF, LANG_UNIVERSAL, 0); DoPlaySoundToSet(me, SOUND_TAKEOFF); @@ -856,7 +865,7 @@ public: { if (GlaiveGUID[i]) { - Unit* Glaive = Unit::GetUnit((*me), GlaiveGUID[i]); + Unit* Glaive = Unit::GetUnit(*me, GlaiveGUID[i]); if (Glaive) { Glaive->CastSpell(me, SPELL_GLAIVE_RETURNS, false); // Make it look like the Glaive flies back up to us @@ -867,7 +876,7 @@ public: Timer[EVENT_FLIGHT_SEQUENCE] = 2000; break; case 9: // land - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetDisableGravity(false); me->StopMoving(); me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); for (uint8 i = 0; i < 2; ++i) @@ -1157,7 +1166,7 @@ public: struct boss_maievAI : public ScriptedAI { - boss_maievAI(Creature* c) : ScriptedAI(c) {}; + boss_maievAI(Creature* creature) : ScriptedAI(creature) {}; uint64 IllidanGUID; @@ -1181,7 +1190,11 @@ public: void EnterCombat(Unit* /*who*/) {} void MoveInLineOfSight(Unit* /*who*/) {} void EnterEvadeMode() {} - void GetIllidanGUID(uint64 guid) { IllidanGUID = guid; } + + void GetIllidanGUID(uint64 guid) + { + IllidanGUID = guid; + } void DamageTaken(Unit* done_by, uint32 &damage) { @@ -1372,9 +1385,9 @@ public: struct npc_akama_illidanAI : public ScriptedAI { - npc_akama_illidanAI(Creature* c) : ScriptedAI(c) + npc_akama_illidanAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); JustCreated = true; } bool JustCreated; @@ -1479,7 +1492,7 @@ public: std::vector<Unit*> eliteList; for (std::list<HostileReference*>::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr) { - Unit* unit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); + Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()); if (unit && unit->GetEntry() == ILLIDARI_ELITE) eliteList.push_back(unit); } @@ -1537,7 +1550,7 @@ public: void BeginWalk() { - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(false); me->SetSpeed(MOVE_RUN, 1.0f); me->GetMotionMaster()->MovePoint(0, AkamaWP[WalkCount].x, AkamaWP[WalkCount].y, AkamaWP[WalkCount].z); } @@ -1636,9 +1649,9 @@ public: Unit* Channel = NULL, *Spirit[2] = { NULL, NULL }; if (ChannelCount <= 5) { - Channel = Unit::GetUnit((*me), ChannelGUID); - Spirit[0] = Unit::GetUnit((*me), SpiritGUID[0]); - Spirit[1] = Unit::GetUnit((*me), SpiritGUID[1]); + Channel = Unit::GetUnit(*me, ChannelGUID); + Spirit[0] = Unit::GetUnit(*me, SpiritGUID[0]); + Spirit[1] = Unit::GetUnit(*me, SpiritGUID[1]); if (!Channel || !Spirit[0] || !Spirit[1]) return; } @@ -1801,10 +1814,10 @@ public: } }; - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF) // Time to begin the Event + if (action == GOSSIP_ACTION_INFO_DEF) // Time to begin the Event { player->CLOSE_GOSSIP_MENU(); CAST_AI(npc_akama_illidan::npc_akama_illidanAI, creature->AI())->EnterPhase(PHASE_CHANNEL); @@ -1869,7 +1882,7 @@ void boss_illidan_stormrage::boss_illidan_stormrageAI::Reset() me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetDisableGravity(false); me->setActive(false); Summons.DespawnAll(); } @@ -1932,7 +1945,7 @@ void boss_illidan_stormrage::boss_illidan_stormrageAI::HandleTalkSequence() // Equip our warglaives! SetEquipmentSlots(false, EQUIP_ID_MAIN_HAND, EQUIP_ID_OFF_HAND, EQUIP_NO_CHANGE); me->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(false); break; case 9: if (GETCRE(Akama, AkamaGUID)) @@ -2019,7 +2032,7 @@ public: struct cage_trap_triggerAI : public ScriptedAI { - cage_trap_triggerAI(Creature* c) : ScriptedAI(c) {} + cage_trap_triggerAI(Creature* creature) : ScriptedAI(creature) {} uint64 IllidanGUID; uint32 DespawnTimer; @@ -2083,7 +2096,6 @@ public: // } } }; - }; class gameobject_cage_trap : public GameObjectScript @@ -2102,7 +2114,6 @@ public: go->SetGoState(GO_STATE_ACTIVE); return true; } - }; class mob_shadow_demon : public CreatureScript @@ -2117,11 +2128,14 @@ public: struct shadow_demonAI : public ScriptedAI { - shadow_demonAI(Creature* c) : ScriptedAI(c) {} + shadow_demonAI(Creature* creature) : ScriptedAI(creature) {} uint64 TargetGUID; - void EnterCombat(Unit* /*who*/) {DoZoneInCombat();} + void EnterCombat(Unit* /*who*/) + { + DoZoneInCombat(); + } void Reset() { @@ -2131,15 +2145,17 @@ public: void JustDied(Unit* /*killer*/) { - if (Unit* target = Unit::GetUnit((*me), TargetGUID)) + if (Unit* target = Unit::GetUnit(*me, TargetGUID)) target->RemoveAurasDueToSpell(SPELL_PARALYZE); } void UpdateAI(const uint32 /*diff*/) { - if (!UpdateVictim()) return; + if (!UpdateVictim()) + return; - if (me->getVictim()->GetTypeId() != TYPEID_PLAYER) return; // Only cast the below on players. + if (me->getVictim()->GetTypeId() != TYPEID_PLAYER) + return; // Only cast the below on players. if (!me->getVictim()->HasAura(SPELL_PARALYZE)) { @@ -2153,7 +2169,6 @@ public: DoCast(me->getVictim(), SPELL_CONSUME_SOUL); } }; - }; class mob_blade_of_azzinoth : public CreatureScript @@ -2168,7 +2183,7 @@ public: struct blade_of_azzinothAI : public NullCreatureAI { - blade_of_azzinothAI(Creature* c) : NullCreatureAI(c) {} + blade_of_azzinothAI(Creature* creature) : NullCreatureAI(creature) {} void SpellHit(Unit* /*caster*/, const SpellInfo* spell) { @@ -2192,9 +2207,9 @@ public: // Shadowfiends interact with Illidan, setting more targets in Illidan's hashmap struct mob_parasitic_shadowfiendAI : public ScriptedAI { - mob_parasitic_shadowfiendAI(Creature* c) : ScriptedAI(c) + mob_parasitic_shadowfiendAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -2212,7 +2227,10 @@ public: DoCast(me, SPELL_SHADOWFIEND_PASSIVE, true); } - void EnterCombat(Unit* /*who*/) { DoZoneInCombat(); } + void EnterCombat(Unit* /*who*/) + { + DoZoneInCombat(); + } void DoMeleeAttackIfReady() { @@ -2258,7 +2276,6 @@ public: DoMeleeAttackIfReady(); } }; - }; void AddSC_boss_illidan() diff --git a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp index 3c7f0d3b89c..4e4607a7d44 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp @@ -90,9 +90,9 @@ public: struct boss_shahrazAI : public ScriptedAI { - boss_shahrazAI(Creature* c) : ScriptedAI(c) + boss_shahrazAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -149,7 +149,7 @@ public: DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { if (instance) instance->SetData(DATA_MOTHERSHAHRAZEVENT, DONE); @@ -250,7 +250,7 @@ public: Unit* unit = NULL; if (TargetGUID[i]) { - unit = Unit::GetUnit((*me), TargetGUID[i]); + unit = Unit::GetUnit(*me, TargetGUID[i]); if (unit) unit->CastSpell(unit, SPELL_ATTRACTION, true); TargetGUID[i] = 0; diff --git a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp index b0c29afda34..c5e78f2fa7b 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp @@ -113,7 +113,7 @@ public: struct npc_enslaved_soulAI : public ScriptedAI { - npc_enslaved_soulAI(Creature* c) : ScriptedAI(c) {} + npc_enslaved_soulAI(Creature* creature) : ScriptedAI(creature) {} uint64 ReliquaryGUID; @@ -142,9 +142,9 @@ public: struct boss_reliquary_of_soulsAI : public ScriptedAI { - boss_reliquary_of_soulsAI(Creature* c) : ScriptedAI(c) + boss_reliquary_of_soulsAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); EssenceGUID = 0; } @@ -197,8 +197,11 @@ public: uint32 random = rand()%6; float x = Coords[random].x; float y = Coords[random].y; + Creature* Soul = me->SummonCreature(CREATURE_ENSLAVED_SOUL, x, y, me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_CORPSE_DESPAWN, 0); - if (!Soul) return false; + if (!Soul) + return false; + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { CAST_AI(npc_enslaved_soul::npc_enslaved_soulAI, Soul->AI())->ReliquaryGUID = me->GetGUID(); @@ -216,7 +219,7 @@ public: std::list<HostileReference*>::const_iterator itr = m_threatlist.begin(); for (; itr != m_threatlist.end(); ++itr) { - Unit* unit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); + Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()); if (unit) { DoModifyThreatPercent(unit, -100); @@ -379,7 +382,7 @@ public: struct boss_essence_of_sufferingAI : public ScriptedAI { - boss_essence_of_sufferingAI(Creature* c) : ScriptedAI(c) {} + boss_essence_of_sufferingAI(Creature* creature) : ScriptedAI(creature) {} uint64 StatAuraGUID; @@ -438,7 +441,7 @@ public: std::list<HostileReference*>::const_iterator itr = m_threatlist.begin(); for (; itr != m_threatlist.end(); ++itr) { - Unit* unit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); + Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()); if (unit && unit->isAlive() && (unit->GetTypeId() == TYPEID_PLAYER)) // Only alive players targets.push_back(unit); } @@ -504,7 +507,7 @@ public: struct boss_essence_of_desireAI : public ScriptedAI { - boss_essence_of_desireAI(Creature* c) : ScriptedAI(c) {} + boss_essence_of_desireAI(Creature* creature) : ScriptedAI(creature) {} uint32 RuneShieldTimer; uint32 DeadenTimer; @@ -607,7 +610,7 @@ public: struct boss_essence_of_angerAI : public ScriptedAI { - boss_essence_of_angerAI(Creature* c) : ScriptedAI(c) {} + boss_essence_of_angerAI(Creature* creature) : ScriptedAI(creature) {} uint64 AggroTargetGUID; @@ -640,7 +643,7 @@ public: DoCast(me, AURA_OF_ANGER, true); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { DoScriptText(ANGER_SAY_DEATH, me); } diff --git a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp index 5ca3189ebca..630e44429fa 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp @@ -121,7 +121,10 @@ public: struct mob_ashtongue_channelerAI : public ScriptedAI { - mob_ashtongue_channelerAI(Creature* c) : ScriptedAI(c) {ShadeGUID = 0;} + mob_ashtongue_channelerAI(Creature* creature) : ScriptedAI(creature) + { + ShadeGUID = 0; + } uint64 ShadeGUID; @@ -147,7 +150,10 @@ public: struct mob_ashtongue_sorcererAI : public ScriptedAI { - mob_ashtongue_sorcererAI(Creature* c) : ScriptedAI(c) {ShadeGUID = 0;} + mob_ashtongue_sorcererAI(Creature* creature) : ScriptedAI(creature) + { + ShadeGUID = 0; + } uint64 ShadeGUID; uint32 CheckTimer; @@ -202,9 +208,9 @@ public: struct boss_shade_of_akamaAI : public ScriptedAI { - boss_shade_of_akamaAI(Creature* c) : ScriptedAI(c), summons(me) + boss_shade_of_akamaAI(Creature* creature) : ScriptedAI(creature), summons(me) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); AkamaGUID = instance ? instance->GetData64(DATA_AKAMA_SHADE) : 0; me->setActive(true);//if view distance is too low me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); @@ -320,7 +326,8 @@ public: void AttackStart(Unit* who) { - if (!who || IsBanished) return; + if (!who || IsBanished) + return; if (who->isTargetableForAttack() && who != me) DoStartMovement(who); @@ -354,7 +361,7 @@ public: if (Sorcerer) { CAST_AI(mob_ashtongue_sorcerer::mob_ashtongue_sorcererAI, Sorcerer->AI())->ShadeGUID = me->GetGUID(); - Sorcerer->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + Sorcerer->SetWalk(false); Sorcerer->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); Sorcerer->SetTarget(me->GetGUID()); Sorcerers.push_back(Sorcerer->GetGUID()); @@ -369,7 +376,7 @@ public: Creature* Spawn = me->SummonCreature(spawnEntries[i], X, Y, Z_SPAWN, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 25000); if (Spawn) { - Spawn->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + Spawn->SetWalk(false); Spawn->GetMotionMaster()->MovePoint(0, AGGRO_X, AGGRO_Y, AGGRO_Z); Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1); Spawn->AI()->AttackStart(target); @@ -430,7 +437,7 @@ public: Creature* Defender = me->SummonCreature(CREATURE_DEFENDER, SpawnLocations[ran].x, SpawnLocations[ran].y, Z_SPAWN, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 25000); if (Defender) { - Defender->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + Defender->SetWalk(false); bool move = true; if (AkamaGUID) { @@ -541,10 +548,10 @@ class npc_akama_shade : public CreatureScript public: npc_akama_shade() : CreatureScript("npc_akama_shade") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) //Fight time + if (action == GOSSIP_ACTION_INFO_DEF + 1) //Fight time { player->CLOSE_GOSSIP_MENU(); CAST_AI(npc_akama_shade::npc_akamaAI, creature->AI())->BeginEvent(player); @@ -571,11 +578,11 @@ public: struct npc_akamaAI : public ScriptedAI { - npc_akamaAI(Creature* c) : ScriptedAI(c), summons(me) + npc_akamaAI(Creature* creature) : ScriptedAI(creature), summons(me) { ShadeHasDied = false; StartCombat = false; - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); if (instance) ShadeGUID = instance->GetData64(DATA_SHADEOFAKAMA); else @@ -662,7 +669,8 @@ public: me->CombatStart(Shade); Shade->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); Shade->SetTarget(me->GetGUID()); - if (player) Shade->AddThreat(player, 1.0f); + if (player) + Shade->AddThreat(player, 1.0f); DoZoneInCombat(Shade); EventBegun = true; } @@ -675,17 +683,19 @@ public: switch (id) { - case 0: ++WayPointId; break; + case 0: + ++WayPointId; + break; - case 1: - if (Creature* Shade = Unit::GetCreature(*me, ShadeGUID)) - { - me->SetTarget(ShadeGUID); - DoCast(Shade, SPELL_AKAMA_SOUL_RETRIEVE); - EndingTalkCount = 0; - SoulRetrieveTimer = 16000; - } - break; + case 1: + if (Creature* Shade = Unit::GetCreature(*me, ShadeGUID)) + { + me->SetTarget(ShadeGUID); + DoCast(Shade, SPELL_AKAMA_SOUL_RETRIEVE); + EndingTalkCount = 0; + SoulRetrieveTimer = 16000; + } + break; } } @@ -760,7 +770,7 @@ public: { ShadeHasDied = true; WayPointId = 0; - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(true); me->GetMotionMaster()->MovePoint(WayPointId, AkamaWP[0].x, AkamaWP[0].y, AkamaWP[0].z); } if (Shade && Shade->isAlive()) @@ -878,7 +888,6 @@ public: DoMeleeAttackIfReady(); } }; - }; void AddSC_boss_shade_of_akama() diff --git a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp index 5a02ffc891f..ce1732433c8 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp @@ -65,7 +65,7 @@ public: struct molten_flameAI : public NullCreatureAI { - molten_flameAI(Creature* c) : NullCreatureAI(c) {} + molten_flameAI(Creature* creature) : NullCreatureAI(creature) {} void InitializeAI() { @@ -91,9 +91,9 @@ public: struct boss_supremusAI : public ScriptedAI { - boss_supremusAI(Creature* c) : ScriptedAI(c), summons(me) + boss_supremusAI(Creature* creature) : ScriptedAI(creature), summons(me) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -134,7 +134,8 @@ public: if (!phase || phase == PHASE_CHASE) { phase = PHASE_STRIKE; - summons.DoAction(EVENT_VOLCANO, 0); + DummyEntryCheckPredicate pred; + summons.DoAction(EVENT_VOLCANO, pred); events.ScheduleEvent(EVENT_HATEFUL_STRIKE, 5000, GCD_CAST, PHASE_STRIKE); me->SetSpeed(MOVE_RUN, 1.2f); me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false); @@ -165,8 +166,15 @@ public: summons.DespawnAll(); } - void JustSummoned(Creature* summon) {summons.Summon(summon);} - void SummonedCreatureDespawn(Creature* summon) {summons.Despawn(summon);} + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + } + + void SummonedCreatureDespawn(Creature* summon) + { + summons.Despawn(summon); + } Unit* CalculateHatefulStrikeTarget() { @@ -177,7 +185,7 @@ public: std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); for (i = m_threatlist.begin(); i!= m_threatlist.end(); ++i) { - Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()); if (unit && me->IsWithinMeleeRange(unit)) { if (unit->GetHealth() > health) @@ -263,7 +271,7 @@ public: struct npc_volcanoAI : public Scripted_NoMovementAI { - npc_volcanoAI(Creature* c) : Scripted_NoMovementAI(c) {} + npc_volcanoAI(Creature* creature) : Scripted_NoMovementAI(creature) {} void Reset() { diff --git a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp index 278488eac9e..bc12a6c1c6c 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp @@ -63,7 +63,7 @@ public: struct mob_doom_blossomAI : public ScriptedAI { - mob_doom_blossomAI(Creature* c) : ScriptedAI(c) {} + mob_doom_blossomAI(Creature* creature) : ScriptedAI(creature) {} uint32 CheckTeronTimer; uint32 ShadowBoltTimer; @@ -112,9 +112,11 @@ public: return; } - void SetTeronGUID(uint64 guid){ TeronGUID = guid; } + void SetTeronGUID(uint64 guid) + { + TeronGUID = guid; + } }; - }; class mob_shadowy_construct : public CreatureScript @@ -129,7 +131,7 @@ public: struct mob_shadowy_constructAI : public ScriptedAI { - mob_shadowy_constructAI(Creature* c) : ScriptedAI(c) {} + mob_shadowy_constructAI(Creature* creature) : ScriptedAI(creature) {} uint64 GhostGUID; uint64 TeronGUID; @@ -173,7 +175,7 @@ public: std::list<Unit*> targets; for (; itr != m_threatlist.end(); ++itr) { - Unit* unit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); + Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()); if (unit && unit->isAlive()) targets.push_back(unit); } @@ -219,9 +221,9 @@ public: struct boss_teron_gorefiendAI : public ScriptedAI { - boss_teron_gorefiendAI(Creature* c) : ScriptedAI(c) + boss_teron_gorefiendAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -291,7 +293,7 @@ public: DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { if (instance) instance->SetData(DATA_TERONGOREFIENDEVENT, DONE); @@ -316,13 +318,14 @@ public: void SetThreatList(Creature* Blossom) { - if (!Blossom) return; + if (!Blossom) + return; std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList(); std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); for (i = m_threatlist.begin(); i != m_threatlist.end(); ++i) { - Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()); if (unit && unit->isAlive()) { float threat = DoGetThreat(unit); @@ -342,7 +345,7 @@ public: Unit* Ghost = NULL; if (GhostGUID) - Ghost = Unit::GetUnit((*me), GhostGUID); + Ghost = Unit::GetUnit(*me, GhostGUID); if (Ghost && Ghost->isAlive() && Ghost->HasAura(SPELL_SHADOW_OF_DEATH)) { /*float x, y, z; @@ -389,7 +392,7 @@ public: Done = true; if (AggroTargetGUID) { - Unit* unit = Unit::GetUnit((*me), AggroTargetGUID); + Unit* unit = Unit::GetUnit(*me, AggroTargetGUID); if (unit) AttackStart(unit); diff --git a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp index 47f82447a80..5b2bb8e7bf5 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp @@ -72,9 +72,9 @@ public: struct boss_najentusAI : public ScriptedAI { - boss_najentusAI(Creature* c) : ScriptedAI(c) + boss_najentusAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -98,7 +98,7 @@ public: events.DelayEvents(5000, GCD_YELL); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { if (instance) instance->SetData(DATA_HIGHWARLORDNAJENTUSEVENT, DONE); @@ -130,7 +130,9 @@ public: bool RemoveImpalingSpine() { - if (!SpineTargetGUID) return false; + if (!SpineTargetGUID) + return false; + Unit* target = Unit::GetUnit(*me, SpineTargetGUID); if (target && target->HasAura(SPELL_IMPALING_SPINE)) target->RemoveAurasDueToSpell(SPELL_IMPALING_SPINE); diff --git a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp index b0c6dcdda41..0742f174ccf 100644 --- a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp +++ b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp @@ -122,7 +122,7 @@ public: struct mob_blood_elf_council_voice_triggerAI : public ScriptedAI { - mob_blood_elf_council_voice_triggerAI(Creature* c) : ScriptedAI(c) + mob_blood_elf_council_voice_triggerAI(Creature* creature) : ScriptedAI(creature) { for (uint8 i = 0; i < 4; ++i) Council[i] = 0; @@ -217,9 +217,9 @@ public: struct mob_illidari_councilAI : public ScriptedAI { - mob_illidari_councilAI(Creature* c) : ScriptedAI(c) + mob_illidari_councilAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); for (uint8 i = 0; i < 4; ++i) Council[i] = 0; } @@ -299,7 +299,7 @@ public: Unit* Member = NULL; if (Council[i]) { - Member = Unit::GetUnit((*me), Council[i]); + Member = Unit::GetUnit(*me, Council[i]); if (Member && Member->isAlive()) CAST_CRE(Member)->AI()->AttackStart(target); } @@ -313,7 +313,8 @@ public: void UpdateAI(const uint32 diff) { - if (!EventBegun) return; + if (!EventBegun) + return; if (EndEventTimer) { @@ -378,9 +379,9 @@ public: struct boss_illidari_councilAI : public ScriptedAI { - boss_illidari_councilAI(Creature* c) : ScriptedAI(c) + boss_illidari_councilAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); for (uint8 i = 0; i < 4; ++i) Council[i] = 0; LoadedGUIDs = false; @@ -475,7 +476,7 @@ public: struct boss_gathios_the_shattererAI : public boss_illidari_councilAI { - boss_gathios_the_shattererAI(Creature* c) : boss_illidari_councilAI(c) {} + boss_gathios_the_shattererAI(Creature* creature) : boss_illidari_councilAI(creature) {} uint32 ConsecrationTimer; uint32 HammerOfJusticeTimer; @@ -497,7 +498,7 @@ public: DoScriptText(SAY_GATH_SLAY, me); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_GATH_DEATH, me); } @@ -511,7 +512,7 @@ public: member = urand(1, 3); if (member != 2) // No need to create another pointer to us using Unit::GetUnit - unit = Unit::GetUnit((*me), Council[member]); + unit = Unit::GetUnit(*me, Council[member]); return unit; } @@ -525,7 +526,7 @@ public: } for (uint8 i = 0; i < 4; ++i) { - Unit* unit = Unit::GetUnit((*me), Council[i]); + Unit* unit = Unit::GetUnit(*me, Council[i]); if (unit) unit->CastSpell(unit, spellid, true, 0, 0, me->GetGUID()); } @@ -542,8 +543,13 @@ public: { switch (urand(0, 1)) { - case 0: DoCast(unit, SPELL_BLESS_SPELLWARD); break; - case 1: DoCast(unit, SPELL_BLESS_PROTECTION); break; + case 0: + DoCast(unit, SPELL_BLESS_SPELLWARD); + break; + + case 1: + DoCast(unit, SPELL_BLESS_PROTECTION); + break; } } BlessingTimer = 60000; @@ -602,7 +608,7 @@ public: struct boss_high_nethermancer_zerevorAI : public boss_illidari_councilAI { - boss_high_nethermancer_zerevorAI(Creature* c) : boss_illidari_councilAI(c) {} + boss_high_nethermancer_zerevorAI(Creature* creature) : boss_illidari_councilAI(creature) {} uint32 BlizzardTimer; uint32 FlamestrikeTimer; @@ -626,7 +632,7 @@ public: DoScriptText(SAY_ZERE_SLAY, me); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_ZERE_DEATH, me); } @@ -706,7 +712,7 @@ public: struct boss_lady_malandeAI : public boss_illidari_councilAI { - boss_lady_malandeAI(Creature* c) : boss_illidari_councilAI(c) {} + boss_lady_malandeAI(Creature* creature) : boss_illidari_councilAI(creature) {} uint32 EmpoweredSmiteTimer; uint32 CircleOfHealingTimer; @@ -726,7 +732,7 @@ public: DoScriptText(SAY_MALA_SLAY, me); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_MALA_DEATH, me); } @@ -784,7 +790,7 @@ public: struct boss_veras_darkshadowAI : public boss_illidari_councilAI { - boss_veras_darkshadowAI(Creature* c) : boss_illidari_councilAI(c) {} + boss_veras_darkshadowAI(Creature* creature) : boss_illidari_councilAI(creature) {} uint64 EnvenomTargetGUID; @@ -812,7 +818,7 @@ public: DoScriptText(SAY_VERA_SLAY, me); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_VERA_DEATH, me); } diff --git a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp index d4184a0b145..49bce6d82c0 100644 --- a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp +++ b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp @@ -118,7 +118,8 @@ public: bool IsEncounterInProgress() const { for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; + if (m_auiEncounter[i] == IN_PROGRESS) + return true; return false; } @@ -163,28 +164,75 @@ public: { switch (go->GetEntry()) { - case 185483: NajentusGate = go->GetGUID();// Gate past Naj'entus (at the entrance to Supermoose's courtyards) - if (m_auiEncounter[0] == DONE)HandleGameObject(0, true, go);break; - case 185882: MainTempleDoors = go->GetGUID();// Main Temple Doors - right past Supermoose (Supremus) - if (m_auiEncounter[1] == DONE)HandleGameObject(0, true, go);break; - case 185478: ShadeOfAkamaDoor = go->GetGUID();break; - case 185480: CommonDoor = go->GetGUID(); - if (m_auiEncounter[3] == DONE)HandleGameObject(0, true, go);break; - case 186153: TeronDoor = go->GetGUID(); - if (m_auiEncounter[3] == DONE)HandleGameObject(0, true, go);break; - case 185892: GuurtogDoor = go->GetGUID(); - if (m_auiEncounter[4] == DONE)HandleGameObject(0, true, go);break; - case 185479: TempleDoor = go->GetGUID(); - if (m_auiEncounter[5] == DONE)HandleGameObject(0, true, go);break; - case 185482: MotherDoor = go->GetGUID(); - if (m_auiEncounter[6] == DONE)HandleGameObject(0, true, go);break; - case 185481: CouncilDoor = go->GetGUID(); - if (m_auiEncounter[7] == DONE)HandleGameObject(0, true, go);break; - case 186152: SimpleDoor = go->GetGUID(); - if (m_auiEncounter[7] == DONE)HandleGameObject(0, true, go);break; - case 185905: IllidanGate = go->GetGUID(); break; // Gate leading to Temple Summit - case 186261: IllidanDoor[0] = go->GetGUID(); break; // Right door at Temple Summit - case 186262: IllidanDoor[1] = go->GetGUID(); break; // Left door at Temple Summit + case 185483: + NajentusGate = go->GetGUID();// Gate past Naj'entus (at the entrance to Supermoose's courtyards) + if (m_auiEncounter[0] == DONE) + HandleGameObject(0, true, go); + break; + + case 185882: + MainTempleDoors = go->GetGUID();// Main Temple Doors - right past Supermoose (Supremus) + if (m_auiEncounter[1] == DONE) + HandleGameObject(0, true, go); + break; + + case 185478: + ShadeOfAkamaDoor = go->GetGUID(); + break; + + case 185480: + CommonDoor = go->GetGUID(); + if (m_auiEncounter[3] == DONE) + HandleGameObject(0, true, go); + break; + + case 186153: + TeronDoor = go->GetGUID(); + if (m_auiEncounter[3] == DONE) + HandleGameObject(0, true, go); + break; + + case 185892: + GuurtogDoor = go->GetGUID(); + if (m_auiEncounter[4] == DONE) + HandleGameObject(0, true, go); + break; + + case 185479: + TempleDoor = go->GetGUID(); + if (m_auiEncounter[5] == DONE) + HandleGameObject(0, true, go); + break; + + case 185482: + MotherDoor = go->GetGUID(); + if (m_auiEncounter[6] == DONE) + HandleGameObject(0, true, go); + break; + + case 185481: + CouncilDoor = go->GetGUID(); + if (m_auiEncounter[7] == DONE) + HandleGameObject(0, true, go); + break; + + case 186152: + SimpleDoor = go->GetGUID(); + if (m_auiEncounter[7] == DONE) + HandleGameObject(0, true, go); + break; + + case 185905: + IllidanGate = go->GetGUID(); // Gate leading to Temple Summit + break; + + case 186261: + IllidanDoor[0] = go->GetGUID(); // Right door at Temple Summit + break; + + case 186262: + IllidanDoor[1] = go->GetGUID(); // Left door at Temple Summit + break; } } @@ -220,63 +268,65 @@ public: { case DATA_HIGHWARLORDNAJENTUSEVENT: if (data == DONE) - { HandleGameObject(NajentusGate, true); - } - m_auiEncounter[0] = data;break; + m_auiEncounter[0] = data; + break; case DATA_SUPREMUSEVENT: if (data == DONE) - { HandleGameObject(NajentusGate, true); - } - m_auiEncounter[1] = data; break; + m_auiEncounter[1] = data; + break; case DATA_SHADEOFAKAMAEVENT: if (data == IN_PROGRESS) - { HandleGameObject(ShadeOfAkamaDoor, false); - } else HandleGameObject(ShadeOfAkamaDoor, true); - m_auiEncounter[2] = data; break; + else + HandleGameObject(ShadeOfAkamaDoor, true); + m_auiEncounter[2] = data; + break; case DATA_TERONGOREFIENDEVENT: if (data == IN_PROGRESS) { HandleGameObject(TeronDoor, false); HandleGameObject(CommonDoor, false); - }else + } + else { HandleGameObject(TeronDoor, true); HandleGameObject(CommonDoor, true); } - m_auiEncounter[3] = data; break; + m_auiEncounter[3] = data; + break; case DATA_GURTOGGBLOODBOILEVENT: if (data == DONE) - { HandleGameObject(GuurtogDoor, true); - } - m_auiEncounter[4] = data; break; + m_auiEncounter[4] = data; + break; case DATA_RELIQUARYOFSOULSEVENT: if (data == DONE) - { HandleGameObject(TempleDoor, true); - } - m_auiEncounter[5] = data; break; + m_auiEncounter[5] = data; + break; case DATA_MOTHERSHAHRAZEVENT: if (data == DONE) - { HandleGameObject(MotherDoor, true); - } - m_auiEncounter[6] = data; break; + m_auiEncounter[6] = data; + break; case DATA_ILLIDARICOUNCILEVENT: if (data == IN_PROGRESS) { HandleGameObject(CouncilDoor, false); HandleGameObject(SimpleDoor, false); - }else + } + else { HandleGameObject(CouncilDoor, true); HandleGameObject(SimpleDoor, true); } - m_auiEncounter[7] = data; break; - case DATA_ILLIDANSTORMRAGEEVENT: m_auiEncounter[8] = data; break; + m_auiEncounter[7] = data; + break; + case DATA_ILLIDANSTORMRAGEEVENT: + m_auiEncounter[8] = data; + break; } if (data == DONE) diff --git a/src/server/scripts/Outland/CMakeLists.txt b/src/server/scripts/Outland/CMakeLists.txt index 229f7de72ec..6056fa8b143 100644 --- a/src/server/scripts/Outland/CMakeLists.txt +++ b/src/server/scripts/Outland/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/> +# Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> # # This file is free software; as a special exception the author gives # unlimited permission to copy and/or distribute it, with or without diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp index 9edc7179d5e..3937b213e7e 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp @@ -107,9 +107,9 @@ public: struct boss_fathomlord_karathressAI : public ScriptedAI { - boss_fathomlord_karathressAI(Creature* c) : ScriptedAI(c) + boss_fathomlord_karathressAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); Advisors[0] = 0; Advisors[1] = 0; Advisors[2] = 0; @@ -225,7 +225,7 @@ public: //Only if not incombat check if the event is started if (!me->isInCombat() && instance && instance->GetData(DATA_KARATHRESSEVENT)) { - Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_KARATHRESSEVENT_STARTER)); + Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER)); if (target) { @@ -317,9 +317,9 @@ public: struct boss_fathomguard_sharkkisAI : public ScriptedAI { - boss_fathomguard_sharkkisAI(Creature* c) : ScriptedAI(c) + boss_fathomguard_sharkkisAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -354,7 +354,7 @@ public: instance->SetData(DATA_KARATHRESSEVENT, NOT_STARTED); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { if (instance) { @@ -381,7 +381,7 @@ public: //Only if not incombat check if the event is started if (!me->isInCombat() && instance && instance->GetData(DATA_KARATHRESSEVENT)) { - Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_KARATHRESSEVENT_STARTER)); + Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER)); if (target) { @@ -471,9 +471,9 @@ public: struct boss_fathomguard_tidalvessAI : public ScriptedAI { - boss_fathomguard_tidalvessAI(Creature* c) : ScriptedAI(c) + boss_fathomguard_tidalvessAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -494,7 +494,7 @@ public: instance->SetData(DATA_KARATHRESSEVENT, NOT_STARTED); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { if (instance) { @@ -522,7 +522,7 @@ public: //Only if not incombat check if the event is started if (!me->isInCombat() && instance && instance->GetData(DATA_KARATHRESSEVENT)) { - Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_KARATHRESSEVENT_STARTER)); + Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER)); if (target) { @@ -598,9 +598,9 @@ public: struct boss_fathomguard_caribdisAI : public ScriptedAI { - boss_fathomguard_caribdisAI(Creature* c) : ScriptedAI(c) + boss_fathomguard_caribdisAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -621,7 +621,7 @@ public: instance->SetData(DATA_KARATHRESSEVENT, NOT_STARTED); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { if (instance) { @@ -648,7 +648,7 @@ public: //Only if not incombat check if the event is started if (!me->isInCombat() && instance && instance->GetData(DATA_KARATHRESSEVENT)) { - Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_KARATHRESSEVENT_STARTER)); + Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER)); if (target) { @@ -691,7 +691,7 @@ public: Creature* Cyclone = me->SummonCreature(CREATURE_CYCLONE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), float(rand()%5), TEMPSUMMON_TIMED_DESPAWN, 15000); if (Cyclone) { - CAST_CRE(Cyclone)->SetFloatValue(OBJECT_FIELD_SCALE_X, 3.0f); + CAST_CRE(Cyclone)->SetObjectScale(3.0f); Cyclone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Cyclone->setFaction(me->getFaction()); Cyclone->CastSpell(Cyclone, SPELL_CYCLONE_CYCLONE, true); @@ -730,13 +730,13 @@ public: switch (rand()%4) { case 0: - unit = Unit::GetUnit((*me), instance->GetData64(DATA_KARATHRESS)); + unit = Unit::GetUnit(*me, instance->GetData64(DATA_KARATHRESS)); break; case 1: - unit = Unit::GetUnit((*me), instance->GetData64(DATA_SHARKKIS)); + unit = Unit::GetUnit(*me, instance->GetData64(DATA_SHARKKIS)); break; case 2: - unit = Unit::GetUnit((*me), instance->GetData64(DATA_TIDALVESS)); + unit = Unit::GetUnit(*me, instance->GetData64(DATA_TIDALVESS)); break; case 3: unit = me; diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp index 6f020c16402..7abd2bbc8a8 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp @@ -88,9 +88,9 @@ public: struct boss_hydross_the_unstableAI : public ScriptedAI { - boss_hydross_the_unstableAI(Creature* c) : ScriptedAI(c), Summons(me) + boss_hydross_the_unstableAI(Creature* creature) : ScriptedAI(creature), Summons(me) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -177,13 +177,9 @@ public: void KilledUnit(Unit* /*victim*/) { if (CorruptedForm) - { DoScriptText(RAND(SAY_CORRUPT_SLAY1, SAY_CORRUPT_SLAY2), me); - } else - { DoScriptText(RAND(SAY_CLEAN_SLAY1, SAY_CLEAN_SLAY2), me); - } } void JustSummoned(Creature* summoned) @@ -207,7 +203,7 @@ public: Summons.Despawn(summon); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { if (CorruptedForm) DoScriptText(SAY_CORRUPT_DEATH, me); @@ -242,12 +238,29 @@ public: switch (MarkOfCorruption_Count) { - case 0: mark_spell = SPELL_MARK_OF_CORRUPTION1; break; - case 1: mark_spell = SPELL_MARK_OF_CORRUPTION2; break; - case 2: mark_spell = SPELL_MARK_OF_CORRUPTION3; break; - case 3: mark_spell = SPELL_MARK_OF_CORRUPTION4; break; - case 4: mark_spell = SPELL_MARK_OF_CORRUPTION5; break; - case 5: mark_spell = SPELL_MARK_OF_CORRUPTION6; break; + case 0: + mark_spell = SPELL_MARK_OF_CORRUPTION1; + break; + + case 1: + mark_spell = SPELL_MARK_OF_CORRUPTION2; + break; + + case 2: + mark_spell = SPELL_MARK_OF_CORRUPTION3; + break; + + case 3: + mark_spell = SPELL_MARK_OF_CORRUPTION4; + break; + + case 4: + mark_spell = SPELL_MARK_OF_CORRUPTION5; + break; + + case 5: + mark_spell = SPELL_MARK_OF_CORRUPTION6; + break; } DoCast(me->getVictim(), mark_spell); @@ -309,12 +322,29 @@ public: switch (MarkOfHydross_Count) { - case 0: mark_spell = SPELL_MARK_OF_HYDROSS1; break; - case 1: mark_spell = SPELL_MARK_OF_HYDROSS2; break; - case 2: mark_spell = SPELL_MARK_OF_HYDROSS3; break; - case 3: mark_spell = SPELL_MARK_OF_HYDROSS4; break; - case 4: mark_spell = SPELL_MARK_OF_HYDROSS5; break; - case 5: mark_spell = SPELL_MARK_OF_HYDROSS6; break; + case 0: + mark_spell = SPELL_MARK_OF_HYDROSS1; + break; + + case 1: + mark_spell = SPELL_MARK_OF_HYDROSS2; + break; + + case 2: + mark_spell = SPELL_MARK_OF_HYDROSS3; + break; + + case 3: + mark_spell = SPELL_MARK_OF_HYDROSS4; + break; + + case 4: + mark_spell = SPELL_MARK_OF_HYDROSS5; + break; + + case 5: + mark_spell = SPELL_MARK_OF_HYDROSS6; + break; } DoCast(me->getVictim(), mark_spell); @@ -375,7 +405,6 @@ public: DoMeleeAttackIfReady(); } }; - }; void AddSC_boss_hydross_the_unstable() diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp index 33ce04e45e3..18d8b2b5a1e 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp @@ -25,7 +25,6 @@ EndScriptData */ #include "ScriptPCH.h" #include "serpent_shrine.h" -#include "ScriptedSimpleAI.h" #include "Spell.h" #define SAY_INTRO -1548042 @@ -132,7 +131,6 @@ float ShieldGeneratorChannelPos[4][4] = {49.3126f, -943.398f, 42.5501f, 2.40174f} }; -//Lady Vashj AI class boss_lady_vashj : public CreatureScript { public: @@ -145,12 +143,12 @@ public: struct boss_lady_vashjAI : public ScriptedAI { - boss_lady_vashjAI (Creature* c) : ScriptedAI(c) + boss_lady_vashjAI (Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); Intro = false; JustCreated = true; - c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); //set it only once on Creature create (no need do intro if wiped) + creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); // set it only once on Creature create (no need do intro if wiped) } InstanceScript* instance; @@ -158,18 +156,18 @@ public: uint64 ShieldGeneratorChannel[4]; uint32 AggroTimer; - uint32 ShockBlast_Timer; - uint32 Entangle_Timer; - uint32 StaticCharge_Timer; - uint32 ForkedLightning_Timer; - uint32 Check_Timer; - uint32 EnchantedElemental_Timer; - uint32 TaintedElemental_Timer; - uint32 CoilfangElite_Timer; - uint32 CoilfangStrider_Timer; - uint32 SummonSporebat_Timer; - uint32 SummonSporebat_StaticTimer; - uint8 EnchantedElemental_Pos; + uint32 ShockBlastTimer; + uint32 EntangleTimer; + uint32 StaticChargeTimer; + uint32 ForkedLightningTimer; + uint32 CheckTimer; + uint32 EnchantedElementalTimer; + uint32 TaintedElementalTimer; + uint32 CoilfangEliteTimer; + uint32 CoilfangStriderTimer; + uint32 SummonSporebatTimer; + uint32 SummonSporebatStaticTimer; + uint8 EnchantedElementalPos; uint8 Phase; bool Entangle; @@ -180,18 +178,18 @@ public: void Reset() { AggroTimer = 19000; - ShockBlast_Timer = 1+rand()%60000; - Entangle_Timer = 30000; - StaticCharge_Timer = 10000+rand()%15000; - ForkedLightning_Timer = 2000; - Check_Timer = 15000; - EnchantedElemental_Timer = 5000; - TaintedElemental_Timer = 50000; - CoilfangElite_Timer = 45000+rand()%5000; - CoilfangStrider_Timer = 60000+rand()%10000; - SummonSporebat_Timer = 10000; - SummonSporebat_StaticTimer = 30000; - EnchantedElemental_Pos = 0; + ShockBlastTimer = 1+rand()%60000; + EntangleTimer = 30000; + StaticChargeTimer = 10000+rand()%15000; + ForkedLightningTimer = 2000; + CheckTimer = 15000; + EnchantedElementalTimer = 5000; + TaintedElementalTimer = 50000; + CoilfangEliteTimer = 45000+rand()%5000; + CoilfangStriderTimer = 60000+rand()%10000; + SummonSporebatTimer = 10000; + SummonSporebatStaticTimer = 30000; + EnchantedElementalPos = 0; Phase = 0; Entangle = false; @@ -201,13 +199,10 @@ public: JustCreated = false; } else CanAttack = true; - Unit* remo; + for (uint8 i = 0; i < 4; ++i) - { - remo = Unit::GetUnit(*me, ShieldGeneratorChannel[i]); - if (remo) + if (Unit* remo = Unit::GetUnit(*me, ShieldGeneratorChannel[i])) remo->setDeathState(JUST_DIED); - } if (instance) instance->SetData(DATA_LADYVASHJEVENT, NOT_STARTED); @@ -219,19 +214,19 @@ public: me->SetCorpseDelay(1000*60*60); } - //Called when a tainted elemental dies + // Called when a tainted elemental dies void EventTaintedElementalDeath() { - //the next will spawn 50 seconds after the previous one's death - if (TaintedElemental_Timer > 50000) - TaintedElemental_Timer = 50000; + // the next will spawn 50 seconds after the previous one's death + if (TaintedElementalTimer > 50000) + TaintedElementalTimer = 50000; } void KilledUnit(Unit* /*victim*/) { DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2, SAY_SLAY3), me); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); @@ -253,18 +248,14 @@ public: { if (instance) { - //remove old tainted cores to prevent cheating in phase 2 + // remove old tainted cores to prevent cheating in phase 2 Map* map = me->GetMap(); Map::PlayerList const &PlayerList = map->GetPlayers(); - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - { - if (Player* i_pl = i->getSource()) - { - i_pl->DestroyItemCount(31088, 1, true); - } - } + for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr) + if (Player* player = itr->getSource()) + player->DestroyItemCount(31088, 1, true); } - StartEvent();//this is EnterCombat(), so were are 100% in combat, start the event + StartEvent(); // this is EnterCombat(), so were are 100% in combat, start the event if (Phase != 2) AttackStart(who); @@ -287,10 +278,7 @@ public: float attackRadius = me->GetAttackDistance(who); if (me->IsWithinDistInMap(who, attackRadius) && me->GetDistanceZ(who) <= CREATURE_Z_ATTACK_RANGE && me->IsWithinLOSInMap(who)) { - //if (who->HasStealthAura()) - // who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); - - if (!me->isInCombat())//AttackStart() sets UNIT_FLAG_IN_COMBAT, so this msut be before attacking + if (!me->isInCombat()) // AttackStart() sets UNIT_FLAG_IN_COMBAT, so this msut be before attacking StartEvent(); if (Phase != 2) @@ -304,13 +292,13 @@ public: switch (urand(0, 1)) { case 0: - //Shoot - //Used in Phases 1 and 3 after Entangle or while having nobody in melee range. A shot that hits her target for 4097-5543 Physical damage. + // Shoot + // Used in Phases 1 and 3 after Entangle or while having nobody in melee range. A shot that hits her target for 4097-5543 Physical damage. DoCast(me->getVictim(), SPELL_SHOOT); break; case 1: - //Multishot - //Used in Phases 1 and 3 after Entangle or while having nobody in melee range. A shot that hits 1 person and 4 people around him for 6475-7525 physical damage. + // Multishot + // Used in Phases 1 and 3 after Entangle or while having nobody in melee range. A shot that hits 1 person and 4 people around him for 6475-7525 physical damage. DoCast(me->getVictim(), SPELL_MULTI_SHOT); break; } @@ -329,231 +317,209 @@ public: CanAttack = true; me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); AggroTimer=19000; - }else + } + else { AggroTimer-=diff; return; } } - //to prevent abuses during phase 2 + // to prevent abuses during phase 2 if (Phase == 2 && !me->getVictim() && me->isInCombat()) { EnterEvadeMode(); return; } - //Return since we have no target + // Return since we have no target if (!UpdateVictim()) return; if (Phase == 1 || Phase == 3) { - //ShockBlast_Timer - if (ShockBlast_Timer <= diff) + // ShockBlastTimer + if (ShockBlastTimer <= diff) { - //Shock Burst - //Randomly used in Phases 1 and 3 on Vashj's target, it's a Shock spell doing 8325-9675 nature damage and stunning the target for 5 seconds, during which she will not attack her target but switch to the next person on the aggro list. + // Shock Burst + // Randomly used in Phases 1 and 3 on Vashj's target, it's a Shock spell doing 8325-9675 nature damage and stunning the target for 5 seconds, during which she will not attack her target but switch to the next person on the aggro list. DoCast(me->getVictim(), SPELL_SHOCK_BLAST); me->TauntApply(me->getVictim()); - ShockBlast_Timer = 1000+rand()%14000; //random cooldown - } else ShockBlast_Timer -= diff; + ShockBlastTimer = 1000+rand()%14000; // random cooldown + } else ShockBlastTimer -= diff; - //StaticCharge_Timer - if (StaticCharge_Timer <= diff) + // StaticChargeTimer + if (StaticChargeTimer <= diff) { - //Static Charge - //Used on random people (only 1 person at any given time) in Phases 1 and 3, it's a debuff doing 2775 to 3225 Nature damage to the target and everybody in about 5 yards around it, every 1 seconds for 30 seconds. It can be removed by Cloak of Shadows, Iceblock, Divine Shield, etc, but not by Cleanse or Dispel Magic. - Unit* target = NULL; - target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true); - - if (target && !target->HasAura(SPELL_STATIC_CHARGE_TRIGGER)) - //cast Static Charge every 2 seconds for 20 seconds - DoCast(target, SPELL_STATIC_CHARGE_TRIGGER); + // Static Charge + // Used on random people (only 1 person at any given time) in Phases 1 and 3, it's a debuff doing 2775 to 3225 Nature damage to the target and everybody in about 5 yards around it, every 1 seconds for 30 seconds. It can be removed by Cloak of Shadows, Iceblock, Divine Shield, etc, but not by Cleanse or Dispel Magic. + Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true); + if (target && !target->HasAura(SPELL_STATIC_CHARGE_TRIGGER)) + DoCast(target, SPELL_STATIC_CHARGE_TRIGGER); // cast Static Charge every 2 seconds for 20 seconds - StaticCharge_Timer = 10000+rand()%20000; //blizzlike - } else StaticCharge_Timer -= diff; + StaticChargeTimer = 10000+rand()%20000; + } else StaticChargeTimer -= diff; - //Entangle_Timer - if (Entangle_Timer <= diff) + // EntangleTimer + if (EntangleTimer <= diff) { if (!Entangle) { - //Entangle - //Used in Phases 1 and 3, it casts Entangling Roots on everybody in a 15 yard radius of Vashj, immobilzing them for 10 seconds and dealing 500 damage every 2 seconds. It's not a magic effect so it cannot be dispelled, but is removed by various buffs such as Cloak of Shadows or Blessing of Freedom. + // Entangle + // Used in Phases 1 and 3, it casts Entangling Roots on everybody in a 15 yard radius of Vashj, immobilzing them for 10 seconds and dealing 500 damage every 2 seconds. It's not a magic effect so it cannot be dispelled, but is removed by various buffs such as Cloak of Shadows or Blessing of Freedom. DoCast(me->getVictim(), SPELL_ENTANGLE); Entangle = true; - Entangle_Timer = 10000; + EntangleTimer = 10000; } else { CastShootOrMultishot(); Entangle = false; - Entangle_Timer = 20000+rand()%5000; + EntangleTimer = 20000+rand()%5000; } - } else Entangle_Timer -= diff; + } else EntangleTimer -= diff; - //Phase 1 + // Phase 1 if (Phase == 1) { - //Start phase 2 + // Start phase 2 if (HealthBelowPct(70)) { - //Phase 2 begins when Vashj hits 70%. She will run to the middle of her platform and surround herself in a shield making her invulerable. + // Phase 2 begins when Vashj hits 70%. She will run to the middle of her platform and surround herself in a shield making her invulerable. Phase = 2; me->GetMotionMaster()->Clear(); DoTeleportTo(MIDDLE_X, MIDDLE_Y, MIDDLE_Z); - Creature* creature; for (uint8 i = 0; i < 4; ++i) - { - creature = me->SummonCreature(SHIED_GENERATOR_CHANNEL, ShieldGeneratorChannelPos[i][0], ShieldGeneratorChannelPos[i][1], ShieldGeneratorChannelPos[i][2], ShieldGeneratorChannelPos[i][3], TEMPSUMMON_CORPSE_DESPAWN, 0); - if (creature) + if (Creature* creature = me->SummonCreature(SHIED_GENERATOR_CHANNEL, ShieldGeneratorChannelPos[i][0], ShieldGeneratorChannelPos[i][1], ShieldGeneratorChannelPos[i][2], ShieldGeneratorChannelPos[i][3], TEMPSUMMON_CORPSE_DESPAWN, 0)) ShieldGeneratorChannel[i] = creature->GetGUID(); - } + DoScriptText(SAY_PHASE2, me); } } - //Phase 3 + // Phase 3 else { - //SummonSporebat_Timer - if (SummonSporebat_Timer <= diff) + // SummonSporebatTimer + if (SummonSporebatTimer <= diff) { - Creature* Sporebat = NULL; - Sporebat = me->SummonCreature(TOXIC_SPOREBAT, SPOREBAT_X, SPOREBAT_Y, SPOREBAT_Z, SPOREBAT_O, TEMPSUMMON_CORPSE_DESPAWN, 0); + if (Creature* sporebat = me->SummonCreature(TOXIC_SPOREBAT, SPOREBAT_X, SPOREBAT_Y, SPOREBAT_Z, SPOREBAT_O, TEMPSUMMON_CORPSE_DESPAWN, 0)) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + sporebat->AI()->AttackStart(target); - if (Sporebat) - { - Unit* target = NULL; - target = SelectTarget(SELECT_TARGET_RANDOM, 0); - if (target) - Sporebat->AI()->AttackStart(target); - } + // summon sporebats faster and faster + if (SummonSporebatStaticTimer > 1000) + SummonSporebatStaticTimer -= 1000; - //summon sporebats faster and faster - if (SummonSporebat_StaticTimer > 1000) - SummonSporebat_StaticTimer -= 1000; + SummonSporebatTimer = SummonSporebatStaticTimer; - SummonSporebat_Timer = SummonSporebat_StaticTimer; + if (SummonSporebatTimer < 5000) + SummonSporebatTimer = 5000; - if (SummonSporebat_Timer < 5000) - SummonSporebat_Timer = 5000; - - } else SummonSporebat_Timer -= diff; + } else SummonSporebatTimer -= diff; } - //Melee attack + // Melee attack DoMeleeAttackIfReady(); - //Check_Timer - used to check if somebody is in melee range - if (Check_Timer <= diff) + // CheckTimer - used to check if somebody is in melee range + if (CheckTimer <= diff) { - bool InMeleeRange = false; - Unit* target; + bool inMeleeRange = false; std::list<HostileReference*> t_list = me->getThreatManager().getThreatList(); for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { - target = Unit::GetUnit(*me, (*itr)->getUnitGuid()); - //if in melee range - if (target && target->IsWithinDistInMap(me, 5)) + Unit* target = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + if (target && target->IsWithinDistInMap(me, 5)) // if in melee range { - InMeleeRange = true; + inMeleeRange = true; break; } } - //if nobody is in melee range - if (!InMeleeRange) + // if nobody is in melee range + if (!inMeleeRange) CastShootOrMultishot(); - Check_Timer = 5000; - } else Check_Timer -= diff; + CheckTimer = 5000; + } else CheckTimer -= diff; } - //Phase 2 + // Phase 2 else { - //ForkedLightning_Timer - if (ForkedLightning_Timer <= diff) + // ForkedLightningTimer + if (ForkedLightningTimer <= diff) { - //Forked Lightning - //Used constantly in Phase 2, it shoots out completely randomly targeted bolts of lightning which hit everybody in a roughtly 60 degree cone in front of Vashj for 2313-2687 nature damage. - Unit* target = NULL; - target = SelectTarget(SELECT_TARGET_RANDOM, 0); + // Forked Lightning + // Used constantly in Phase 2, it shoots out completely randomly targeted bolts of lightning which hit everybody in a roughtly 60 degree cone in front of Vashj for 2313-2687 nature damage. + Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0); if (!target) target = me->getVictim(); DoCast(target, SPELL_FORKED_LIGHTNING); - ForkedLightning_Timer = 2000+rand()%6000; //blizzlike - } else ForkedLightning_Timer -= diff; + ForkedLightningTimer = 2000+rand()%6000; + } else ForkedLightningTimer -= diff; - //EnchantedElemental_Timer - if (EnchantedElemental_Timer <= diff) + // EnchantedElementalTimer + if (EnchantedElementalTimer <= diff) { - me->SummonCreature(ENCHANTED_ELEMENTAL, ElementPos[EnchantedElemental_Pos][0], ElementPos[EnchantedElemental_Pos][1], ElementPos[EnchantedElemental_Pos][2], ElementPos[EnchantedElemental_Pos][3], TEMPSUMMON_CORPSE_DESPAWN, 0); + me->SummonCreature(ENCHANTED_ELEMENTAL, ElementPos[EnchantedElementalPos][0], ElementPos[EnchantedElementalPos][1], ElementPos[EnchantedElementalPos][2], ElementPos[EnchantedElementalPos][3], TEMPSUMMON_CORPSE_DESPAWN, 0); - if (EnchantedElemental_Pos == 7) - EnchantedElemental_Pos = 0; + if (EnchantedElementalPos == 7) + EnchantedElementalPos = 0; else - ++EnchantedElemental_Pos; + ++EnchantedElementalPos; - EnchantedElemental_Timer = 10000+rand()%5000; - } else EnchantedElemental_Timer -= diff; + EnchantedElementalTimer = 10000+rand()%5000; + } else EnchantedElementalTimer -= diff; - //TaintedElemental_Timer - if (TaintedElemental_Timer <= diff) + // TaintedElementalTimer + if (TaintedElementalTimer <= diff) { uint32 pos = rand()%8; me->SummonCreature(TAINTED_ELEMENTAL, ElementPos[pos][0], ElementPos[pos][1], ElementPos[pos][2], ElementPos[pos][3], TEMPSUMMON_DEAD_DESPAWN, 0); - TaintedElemental_Timer = 120000; - } else TaintedElemental_Timer -= diff; + TaintedElementalTimer = 120000; + } else TaintedElementalTimer -= diff; - //CoilfangElite_Timer - if (CoilfangElite_Timer <= diff) + // CoilfangEliteTimer + if (CoilfangEliteTimer <= diff) { uint32 pos = rand()%3; - Creature* CoilfangElite = NULL; - CoilfangElite = me->SummonCreature(COILFANG_ELITE, CoilfangElitePos[pos][0], CoilfangElitePos[pos][1], CoilfangElitePos[pos][2], CoilfangElitePos[pos][3], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - if (CoilfangElite) + Creature* coilfangElite = me->SummonCreature(COILFANG_ELITE, CoilfangElitePos[pos][0], CoilfangElitePos[pos][1], CoilfangElitePos[pos][2], CoilfangElitePos[pos][3], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + if (coilfangElite) { - Unit* target = NULL; - target = SelectTarget(SELECT_TARGET_RANDOM, 0); - if (target) - CoilfangElite->AI()->AttackStart(target); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + coilfangElite->AI()->AttackStart(target); else if (me->getVictim()) - CoilfangElite->AI()->AttackStart(me->getVictim()); + coilfangElite->AI()->AttackStart(me->getVictim()); } - CoilfangElite_Timer = 45000+rand()%5000; - } else CoilfangElite_Timer -= diff; + CoilfangEliteTimer = 45000+rand()%5000; + } else CoilfangEliteTimer -= diff; - //CoilfangStrider_Timer - if (CoilfangStrider_Timer <= diff) + // CoilfangStriderTimer + if (CoilfangStriderTimer <= diff) { uint32 pos = rand()%3; - Creature* CoilfangStrider = NULL; - CoilfangStrider = me->SummonCreature(COILFANG_STRIDER, CoilfangStriderPos[pos][0], CoilfangStriderPos[pos][1], CoilfangStriderPos[pos][2], CoilfangStriderPos[pos][3], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - if (CoilfangStrider) + if (Creature* CoilfangStrider = me->SummonCreature(COILFANG_STRIDER, CoilfangStriderPos[pos][0], CoilfangStriderPos[pos][1], CoilfangStriderPos[pos][2], CoilfangStriderPos[pos][3], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000)) { - Unit* target = NULL; - target = SelectTarget(SELECT_TARGET_RANDOM, 0); - if (target) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) CoilfangStrider->AI()->AttackStart(target); else if (me->getVictim()) CoilfangStrider->AI()->AttackStart(me->getVictim()); } - CoilfangStrider_Timer = 60000+rand()%10000; - } else CoilfangStrider_Timer -= diff; + CoilfangStriderTimer = 60000+rand()%10000; + } else CoilfangStriderTimer -= diff; - //Check_Timer - if (Check_Timer <= diff) + // CheckTimer + if (CheckTimer <= diff) { - //Start Phase 3 + // Start Phase 3 if (instance && instance->GetData(DATA_CANSTARTPHASE3)) { - //set life 50% + // set life 50% me->SetHealth(me->CountPctFromMaxHealth(50)); me->RemoveAurasDueToSpell(SPELL_MAGIC_BARRIER); @@ -562,19 +528,19 @@ public: Phase = 3; - //return to the tank + // return to the tank me->GetMotionMaster()->MoveChase(me->getVictim()); } - Check_Timer = 1000; - } else Check_Timer -= diff; + CheckTimer = 1000; + } else CheckTimer -= diff; } } }; }; -//Enchanted Elemental -//If one of them reaches Vashj he will increase her damage done by 5%. +// Enchanted Elemental +// If one of them reaches Vashj he will increase her damage done by 5%. class mob_enchanted_elemental : public CreatureScript { public: @@ -587,45 +553,42 @@ public: struct mob_enchanted_elementalAI : public ScriptedAI { - mob_enchanted_elementalAI(Creature* c) : ScriptedAI(c) + mob_enchanted_elementalAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; - uint32 move; - uint32 phase; - float x, y, z; + uint32 Move; + uint32 Phase; + float X, Y, Z; uint64 VashjGUID; void Reset() { - me->SetSpeed(MOVE_WALK, 0.6f);//walk - me->SetSpeed(MOVE_RUN, 0.6f);//run - move = 0; - phase = 1; + me->SetSpeed(MOVE_WALK, 0.6f); // walk + me->SetSpeed(MOVE_RUN, 0.6f); // run + Move = 0; + Phase = 1; VashjGUID = 0; - for (int i = 0; i<8; ++i)//search for nearest waypoint (up on stairs) + X = ElementWPPos[0][0]; + Y = ElementWPPos[0][1]; + Z = ElementWPPos[0][2]; + + //search for nearest waypoint (up on stairs) + for (uint32 i = 1; i < 8; ++i) { - if (!x || !y || !z) + if (me->GetDistance(ElementWPPos[i][0], ElementWPPos[i][1], ElementWPPos[i][2]) < me->GetDistance(X, Y, Z)) { - x = ElementWPPos[i][0]; - y = ElementWPPos[i][1]; - z = ElementWPPos[i][2]; - } - else - { - if (me->GetDistance(ElementWPPos[i][0], ElementWPPos[i][1], ElementWPPos[i][2]) < me->GetDistance(x, y, z)) - { - x = ElementWPPos[i][0]; - y = ElementWPPos[i][1]; - z = ElementWPPos[i][2]; - } + X = ElementWPPos[i][0]; + Y = ElementWPPos[i][1]; + Z = ElementWPPos[i][2]; } } + if (instance) VashjGUID = instance->GetData64(DATA_LADYVASHJ); } @@ -642,41 +605,36 @@ public: if (!VashjGUID) return; - if (move <= diff) + if (Move <= diff) { - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - if (phase == 1) - me->GetMotionMaster()->MovePoint(0, x, y, z); - if (phase == 1 && me->IsWithinDist3d(x, y, z, 0.1f)) - phase = 2; - if (phase == 2) + me->SetWalk(true); + if (Phase == 1) + me->GetMotionMaster()->MovePoint(0, X, Y, Z); + if (Phase == 1 && me->IsWithinDist3d(X, Y, Z, 0.1f)) + Phase = 2; + if (Phase == 2) { me->GetMotionMaster()->MovePoint(0, MIDDLE_X, MIDDLE_Y, MIDDLE_Z); - phase = 3; + Phase = 3; } - if (phase == 3) + if (Phase == 3) { me->GetMotionMaster()->MovePoint(0, MIDDLE_X, MIDDLE_Y, MIDDLE_Z); if (me->IsWithinDist3d(MIDDLE_X, MIDDLE_Y, MIDDLE_Z, 3)) DoCast(me, SPELL_SURGE); } - if (Creature* Vashj = Unit::GetCreature(*me, VashjGUID)) - { - if (!Vashj->isInCombat() || CAST_AI(boss_lady_vashj::boss_lady_vashjAI, Vashj->AI())->Phase != 2 || Vashj->isDead()) - { - //call Unsummon() + if (Creature* vashj = Unit::GetCreature(*me, VashjGUID)) + if (!vashj->isInCombat() || CAST_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->Phase != 2 || vashj->isDead()) me->Kill(me); - } - } - move = 1000; - } else move -= diff; + Move = 1000; + } else Move -= diff; } }; }; -//Tainted Elemental -//This mob has 7, 900 life, doesn't move, and shoots Poison Bolts at one person anywhere in the area, doing 3, 000 nature damage and placing a posion doing 2, 000 damage every 2 seconds. He will switch targets often, or sometimes just hang on a single player, but there is nothing you can do about it except heal the damage and kill the Tainted Elemental +// Tainted Elemental +// This mob has 7, 900 life, doesn't move, and shoots Poison Bolts at one person anywhere in the area, doing 3, 000 nature damage and placing a posion doing 2, 000 damage every 2 seconds. He will switch targets often, or sometimes just hang on a single player, but there is nothing you can do about it except heal the damage and kill the Tainted Elemental class mob_tainted_elemental : public CreatureScript { public: @@ -689,32 +647,27 @@ public: struct mob_tainted_elementalAI : public ScriptedAI { - mob_tainted_elementalAI(Creature* c) : ScriptedAI(c) + mob_tainted_elementalAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; - uint32 PoisonBolt_Timer; - uint32 Despawn_Timer; + uint32 PoisonBoltTimer; + uint32 DespawnTimer; void Reset() { - PoisonBolt_Timer = 5000+rand()%5000; - Despawn_Timer = 30000; + PoisonBoltTimer = 5000+rand()%5000; + DespawnTimer = 30000; } void JustDied(Unit* /*killer*/) { if (instance) - { - Creature* Vashj = NULL; - Vashj = (Unit::GetCreature((*me), instance->GetData64(DATA_LADYVASHJ))); - - if (Vashj) - CAST_AI(boss_lady_vashj::boss_lady_vashjAI, Vashj->AI())->EventTaintedElementalDeath(); - } + if (Creature* vashj = Unit::GetCreature((*me), instance->GetData64(DATA_LADYVASHJ))) + CAST_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->EventTaintedElementalDeath(); } void EnterCombat(Unit* who) @@ -724,27 +677,26 @@ public: void UpdateAI(const uint32 diff) { - //PoisonBolt_Timer - if (PoisonBolt_Timer <= diff) + // PoisonBoltTimer + if (PoisonBoltTimer <= diff) { - Unit* target = NULL; - target = SelectTarget(SELECT_TARGET_RANDOM, 0); + Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0); if (target && target->IsWithinDistInMap(me, 30)) DoCast(target, SPELL_POISON_BOLT); - PoisonBolt_Timer = 5000+rand()%5000; - } else PoisonBolt_Timer -= diff; + PoisonBoltTimer = 5000+rand()%5000; + } else PoisonBoltTimer -= diff; - //Despawn_Timer - if (Despawn_Timer <= diff) + // DespawnTimer + if (DespawnTimer <= diff) { - //call Unsummon() + // call Unsummon() me->setDeathState(DEAD); - //to prevent crashes - Despawn_Timer = 1000; - } else Despawn_Timer -= diff; + // to prevent crashes + DespawnTimer = 1000; + } else DespawnTimer -= diff; } }; @@ -764,37 +716,31 @@ public: struct mob_toxic_sporebatAI : public ScriptedAI { - mob_toxic_sporebatAI(Creature* c) : ScriptedAI(c) + mob_toxic_sporebatAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); EnterEvadeMode(); } InstanceScript* instance; - uint32 movement_timer; - uint32 ToxicSpore_Timer; - uint32 bolt_timer; - uint32 Check_Timer; + uint32 MovementTimer; + uint32 ToxicSporeTimer; + uint32 BoltTimer; + uint32 CheckTimer; void Reset() { - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetDisableGravity(true); me->setFaction(14); - movement_timer = 0; - ToxicSpore_Timer = 5000; - bolt_timer = 5500; - Check_Timer = 1000; - } - - void EnterCombat(Unit* /*who*/) - { - + MovementTimer = 0; + ToxicSporeTimer = 5000; + BoltTimer = 5500; + CheckTimer = 1000; } void MoveInLineOfSight(Unit* /*who*/) { - } void MovementInform(uint32 type, uint32 id) @@ -803,113 +749,57 @@ public: return; if (id == 1) - movement_timer = 0; + MovementTimer = 0; } void UpdateAI (const uint32 diff) { - //Random movement - if (movement_timer <= diff) + // Random movement + if (MovementTimer <= diff) { uint32 rndpos = rand()%8; me->GetMotionMaster()->MovePoint(1, SporebatWPPos[rndpos][0], SporebatWPPos[rndpos][1], SporebatWPPos[rndpos][2]); - movement_timer = 6000; - } else movement_timer -= diff; + MovementTimer = 6000; + } else MovementTimer -= diff; - //toxic spores - if (bolt_timer <= diff) + // toxic spores + if (BoltTimer <= diff) { - Unit* target = NULL; - target = SelectTarget(SELECT_TARGET_RANDOM, 0); - if (target) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { - Creature* trig = me->SummonCreature(TOXIC_SPORES_TRIGGER, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 30000); - if (trig) + if (Creature* trig = me->SummonCreature(TOXIC_SPORES_TRIGGER, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 30000)) { trig->setFaction(14); trig->CastSpell(trig, SPELL_TOXIC_SPORES, true); } } - bolt_timer = 10000+rand()%5000; + BoltTimer = 10000+rand()%5000; } - else bolt_timer -= diff; + else BoltTimer -= diff; - //Check_Timer - if (Check_Timer <= diff) + // CheckTimer + if (CheckTimer <= diff) { if (instance) { - //check if vashj is death - Unit* Vashj = NULL; - Vashj = Unit::GetUnit((*me), instance->GetData64(DATA_LADYVASHJ)); + // check if vashj is death + Unit* Vashj = Unit::GetUnit(*me, instance->GetData64(DATA_LADYVASHJ)); if (!Vashj || (Vashj && !Vashj->isAlive()) || (Vashj && CAST_AI(boss_lady_vashj::boss_lady_vashjAI, CAST_CRE(Vashj)->AI())->Phase != 3)) { - //remove + // remove me->setDeathState(DEAD); me->RemoveCorpse(); me->setFaction(35); } } - Check_Timer = 1000; - } else Check_Timer -= diff; + CheckTimer = 1000; + } else CheckTimer -= diff; } }; }; -//Coilfang Elite -//It's an elite Naga mob with 170, 000 HP. It does about 5000 damage on plate, and has a nasty cleave hitting for about 7500 damage -class mob_coilfang_elite : public CreatureScript -{ -public: - mob_coilfang_elite() : CreatureScript("mob_coilfang_elite") { } - - CreatureAI* GetAI(Creature* creature) const - { - SimpleAI* ai = new SimpleAI (creature); - - ai->Spell[0].Enabled = true; - ai->Spell[0].Spell_Id = 31345; //Cleave - ai->Spell[0].Cooldown = 15000; - ai->Spell[0].CooldownRandomAddition = 5000; - ai->Spell[0].First_Cast = 5000; - ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_RANDOM; - - ai->EnterEvadeMode(); - - return ai; - } - -}; - -//Coilfang Strider -//It hits plate for about 8000 damage, has a Mind Blast spell doing about 3000 shadow damage, and a Psychic Scream Aura, which fears everybody in a 8 yard range of it every 2-3 seconds, for 5 seconds and increasing their movement speed by 150% during the fear. -class mob_coilfang_strider : public CreatureScript -{ -public: - mob_coilfang_strider() : CreatureScript("mob_coilfang_strider") { } - - CreatureAI* GetAI(Creature* creature) const - { - SimpleAI* ai = new SimpleAI (creature); - - ai->Spell[0].Enabled = true; - ai->Spell[0].Spell_Id = 41374; //Mind Blast - ai->Spell[0].Cooldown = 30000; - ai->Spell[0].CooldownRandomAddition = 10000; - ai->Spell[0].First_Cast = 8000; - ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_TARGET; - - //Scream aura not implemented - - ai->EnterEvadeMode(); - - return ai; - } - -}; - class mob_shield_generator_channel : public CreatureScript { public: @@ -922,25 +812,24 @@ public: struct mob_shield_generator_channelAI : public ScriptedAI { - mob_shield_generator_channelAI(Creature* c) : ScriptedAI(c) + mob_shield_generator_channelAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; - uint32 Check_Timer; + uint32 CheckTimer; bool Casted; + void Reset() { - Check_Timer = 0; + CheckTimer = 0; Casted = false; - me->SetDisplayId(11686); //invisible + me->SetDisplayId(11686); // invisible me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - void EnterCombat(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} void UpdateAI (const uint32 diff) @@ -948,22 +837,21 @@ public: if (!instance) return; - if (Check_Timer <= diff) + if (CheckTimer <= diff) { - Unit* Vashj = NULL; - Vashj = Unit::GetUnit((*me), instance->GetData64(DATA_LADYVASHJ)); + Unit* vashj = Unit::GetUnit(*me, instance->GetData64(DATA_LADYVASHJ)); - if (Vashj && Vashj->isAlive()) + if (vashj && vashj->isAlive()) { - //start visual channel - if (!Casted || !Vashj->HasAura(SPELL_MAGIC_BARRIER)) + // start visual channel + if (!Casted || !vashj->HasAura(SPELL_MAGIC_BARRIER)) { - DoCast(Vashj, SPELL_MAGIC_BARRIER, true); + DoCast(vashj, SPELL_MAGIC_BARRIER, true); Casted = true; } } - Check_Timer = 1000; - } else Check_Timer -= diff; + CheckTimer = 1000; + } else CheckTimer -= diff; } }; @@ -974,41 +862,39 @@ class item_tainted_core : public ItemScript public: item_tainted_core() : ItemScript("item_tainted_core") { } - bool OnUse(Player* player, Item* /*_Item*/, SpellCastTargets const& targets) + bool OnUse(Player* player, Item* /*item*/, SpellCastTargets const& targets) { InstanceScript* instance = player->GetInstanceScript(); - if (!instance) { player->GetSession()->SendNotification(TEXT_NOT_INITIALIZED); return true; } - Creature* Vashj = NULL; - Vashj = (Unit::GetCreature((*player), instance->GetData64(DATA_LADYVASHJ))); - if (Vashj && (CAST_AI(boss_lady_vashj::boss_lady_vashjAI, Vashj->AI())->Phase == 2)) + Creature* vashj = Unit::GetCreature((*player), instance->GetData64(DATA_LADYVASHJ)); + if (vashj && (CAST_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->Phase == 2)) { if (GameObject* gObj = targets.GetGOTarget()) { uint32 identifier; - uint8 channel_identifier; + uint8 channelIdentifier; switch (gObj->GetEntry()) { case 185052: identifier = DATA_SHIELDGENERATOR1; - channel_identifier = 0; + channelIdentifier = 0; break; case 185053: identifier = DATA_SHIELDGENERATOR2; - channel_identifier = 1; + channelIdentifier = 1; break; case 185051: identifier = DATA_SHIELDGENERATOR3; - channel_identifier = 2; + channelIdentifier = 2; break; case 185054: identifier = DATA_SHIELDGENERATOR4; - channel_identifier = 3; + channelIdentifier = 3; break; default: return true; @@ -1020,18 +906,13 @@ public: return true; } - //get and remove channel - Unit* Channel = NULL; - Channel = Unit::GetCreature(*Vashj, CAST_AI(boss_lady_vashj::boss_lady_vashjAI, Vashj->AI())->ShieldGeneratorChannel[channel_identifier]); - if (Channel) - { - //call Unsummon() - Channel->setDeathState(JUST_DIED); - } + // get and remove channel + if (Unit* channel = Unit::GetCreature(*vashj, CAST_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->ShieldGeneratorChannel[channelIdentifier])) + channel->setDeathState(JUST_DIED); // call Unsummon() instance->SetData(identifier, 1); - //remove this item + // remove this item player->DestroyItemCount(31088, 1, true); return true; } @@ -1055,8 +936,6 @@ void AddSC_boss_lady_vashj() new mob_enchanted_elemental(); new mob_tainted_elemental(); new mob_toxic_sporebat(); - new mob_coilfang_elite(); - new mob_coilfang_strider(); new mob_shield_generator_channel(); new item_tainted_core(); } diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp index 5111a8eaa8e..4876410890c 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp @@ -53,6 +53,7 @@ EndScriptData */ #define MODEL_NIGHTELF 20514 #define DEMON_FORM 21875 #define MOB_SPELLBINDER 21806 +#define INNER_DEMON_VICTIM 1 #define SAY_AGGRO -1548009 #define SAY_SWITCH_TO_DEMON -1548010 @@ -79,7 +80,7 @@ public: struct mob_inner_demonAI : public ScriptedAI { - mob_inner_demonAI(Creature* c) : ScriptedAI(c) + mob_inner_demonAI(Creature* creature) : ScriptedAI(creature) { victimGUID = 0; } @@ -94,9 +95,23 @@ public: ShadowBolt_Timer = 10000; Link_Timer = 1000; } - void JustDied(Unit* /*victim*/) + + void SetGUID(uint64 guid, int32 id/* = 0 */) + { + if (id == INNER_DEMON_VICTIM) + victimGUID = guid; + } + + uint64 GetGUID(int32 id/* = 0 */) { - Unit* unit = Unit::GetUnit((*me), victimGUID); + if (id == INNER_DEMON_VICTIM) + return victimGUID; + return 0; + } + + void JustDied(Unit* /*killer*/) + { + Unit* unit = Unit::GetUnit(*me, victimGUID); if (unit && unit->HasAura(SPELL_INSIDIOUS_WHISPER)) unit->RemoveAurasDueToSpell(SPELL_INSIDIOUS_WHISPER); } @@ -112,7 +127,8 @@ public: void EnterCombat(Unit* /*who*/) { - if (!victimGUID) return; + if (!victimGUID) + return; } void UpdateAI(const uint32 diff) @@ -124,7 +140,7 @@ public: if (me->getVictim()->GetGUID() != victimGUID) { DoModifyThreatPercent(me->getVictim(), -100); - Unit* owner = Unit::GetUnit((*me), victimGUID); + Unit* owner = Unit::GetUnit(*me, victimGUID); if (owner && owner->isAlive()) { me->AddThreat(owner, 999999); @@ -170,10 +186,10 @@ public: struct boss_leotheras_the_blindAI : public ScriptedAI { - boss_leotheras_the_blindAI(Creature* c) : ScriptedAI(c) + boss_leotheras_the_blindAI(Creature* creature) : ScriptedAI(creature) { - c->GetPosition(x, y, z); - instance = c->GetInstanceScript(); + creature->GetPosition(x, y, z); + instance = creature->GetInstanceScript(); Demon = 0; for (uint8 i = 0; i < 3; ++i)//clear guids @@ -218,6 +234,7 @@ public: IsFinalForm = false; NeedThreatReset = false; EnrageUsed = false; + memset(InnderDemon, 0, sizeof(InnderDemon)); InnerDemon_Count = 0; me->SetSpeed(MOVE_RUN, 2.0f, true); me->SetDisplayId(MODEL_NIGHTELF); @@ -356,7 +373,7 @@ public: Creature* unit = Unit::GetCreature((*me), InnderDemon[i]); if (unit && unit->isAlive()) { - Unit* unit_target = Unit::GetUnit(*unit, CAST_AI(mob_inner_demon::mob_inner_demonAI, unit->AI())->victimGUID); + Unit* unit_target = Unit::GetUnit(*unit, unit->AI()->GetGUID(INNER_DEMON_VICTIM)); if (unit_target && unit_target->isAlive()) { unit->CastSpell(unit_target, SPELL_CONSUMING_MADNESS, true); @@ -382,7 +399,7 @@ public: } } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); @@ -524,7 +541,7 @@ public: if (demon) { demon->AI()->AttackStart((*itr)); - CAST_AI(mob_inner_demon::mob_inner_demonAI, demon->AI())->victimGUID = (*itr)->GetGUID(); + demon->AI()->SetGUID((*itr)->GetGUID(), INNER_DEMON_VICTIM); (*itr)->AddAura(SPELL_INSIDIOUS_WHISPER, *itr); @@ -600,7 +617,7 @@ public: struct boss_leotheras_the_blind_demonformAI : public ScriptedAI { - boss_leotheras_the_blind_demonformAI(Creature* c) : ScriptedAI(c) {} + boss_leotheras_the_blind_demonformAI(Creature* creature) : ScriptedAI(creature) {} uint32 ChaosBlast_Timer; bool DealDamage; @@ -624,7 +641,7 @@ public: DoScriptText(RAND(SAY_DEMON_SLAY1, SAY_DEMON_SLAY2, SAY_DEMON_SLAY3), me); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { //invisibility (blizzlike, at the end of the fight he doesn't die, he disappears) DoCast(me, 8149, true); @@ -673,9 +690,9 @@ public: struct mob_greyheart_spellbinderAI : public ScriptedAI { - mob_greyheart_spellbinderAI(Creature* c) : ScriptedAI(c) + mob_greyheart_spellbinderAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); leotherasGUID = 0; AddedBanish = false; } diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp index 0ed9d8e7833..00de1802bc9 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp @@ -25,7 +25,6 @@ EndScriptData */ #include "ScriptPCH.h" #include "serpent_shrine.h" -#include "ScriptedSimpleAI.h" #include "Spell.h" #define SPELL_SPOUT 37433 @@ -55,15 +54,16 @@ EndScriptData */ float AddPos[9][3] = { - {2.8553810f, -459.823914f, -19.182686f}, //MOVE_AMBUSHER_1 X, Y, Z - {12.400000f, -466.042267f, -19.182686f}, //MOVE_AMBUSHER_2 X, Y, Z - {51.366653f, -460.836060f, -19.182686f}, //MOVE_AMBUSHER_3 X, Y, Z - {62.597980f, -457.433044f, -19.182686f}, //MOVE_AMBUSHER_4 X, Y, Z - {77.607452f, -384.302765f, -19.182686f}, //MOVE_AMBUSHER_5 X, Y, Z - {63.897900f, -378.984924f, -19.182686f}, //MOVE_AMBUSHER_6 X, Y, Z - {34.447250f, -387.333618f, -19.182686f}, //MOVE_GUARDIAN_1 X, Y, Z - {14.388216f, -423.468018f, -19.625271f}, //MOVE_GUARDIAN_2 X, Y, Z - {42.471519f, -445.115295f, -19.769423f} //MOVE_GUARDIAN_3 X, Y, Z + // MOVE_AMBUSHER_1 X, Y, Z + {2.8553810f, -459.823914f, -19.182686f}, + {12.400000f, -466.042267f, -19.182686f}, + {51.366653f, -460.836060f, -19.182686f}, + {62.597980f, -457.433044f, -19.182686f}, + {77.607452f, -384.302765f, -19.182686f}, + {63.897900f, -378.984924f, -19.182686f}, + {34.447250f, -387.333618f, -19.182686f}, + {14.388216f, -423.468018f, -19.625271f}, + {42.471519f, -445.115295f, -19.769423f} }; class boss_the_lurker_below : public CreatureScript @@ -78,9 +78,9 @@ public: struct boss_the_lurker_belowAI : public Scripted_NoMovementAI { - boss_the_lurker_belowAI(Creature* c) : Scripted_NoMovementAI(c), Summons(me) + boss_the_lurker_belowAI(Creature* creature) : Scripted_NoMovementAI(creature), Summons(me) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -109,19 +109,19 @@ public: } void Reset() { - me->AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_LEVITATING); + me->AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_DISABLE_GRAVITY); SpoutAnimTimer = 1000; RotTimer = 0; - WaterboltTimer = 15000;//give time to get in range when fight starts + WaterboltTimer = 15000; // give time to get in range when fight starts SpoutTimer = 45000; - WhirlTimer = 18000;//after avery spout + WhirlTimer = 18000; // after avery spout PhaseTimer = 120000; GeyserTimer = rand()%5000 + 15000; - CheckTimer = 15000;//give time to get in range when fight starts - WaitTimer = 60000;//never reached - WaitTimer2 = 60000;//never reached + CheckTimer = 15000; // give time to get in range when fight starts + WaitTimer = 60000; // never reached + WaitTimer2 = 60000; // never reached - Submerged = true;//will be false at combat start + Submerged = true; // will be false at combat start Spawned = false; InRange = false; CanStartEvent = false; @@ -133,13 +133,13 @@ public: instance->SetData(DATA_THELURKERBELOWEVENT, NOT_STARTED); instance->SetData(DATA_STRANGE_POOL, NOT_STARTED); } - DoCast(me, SPELL_SUBMERGE);//submerge anim - me->SetVisible(false);//we start invis under water, submerged + DoCast(me, SPELL_SUBMERGE); // submerge anim + me->SetVisible(false); // we start invis under water, submerged me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { if (instance) { @@ -159,15 +159,13 @@ public: void MoveInLineOfSight(Unit* who) { - if (!CanStartEvent)//boss is invisible, don't attack + if (!CanStartEvent) // boss is invisible, don't attack return; if (!me->getVictim() && who->IsValidAttackTarget(me)) { float attackRadius = me->GetAttackDistance(who); if (me->IsWithinDistInMap(who, attackRadius)) - { AttackStart(who); - } } } @@ -179,7 +177,7 @@ public: void UpdateAI(const uint32 diff) { - if (!CanStartEvent)//boss is invisible, don't attack + if (!CanStartEvent) // boss is invisible, don't attack { if (CheckCanStart()) { @@ -190,21 +188,21 @@ public: WaitTimer2 = 500; } - if (!Submerged && WaitTimer2 <= diff)//wait 500ms before emerge anim + if (!Submerged && WaitTimer2 <= diff) // wait 500ms before emerge anim { me->RemoveAllAuras(); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); DoCast(me, SPELL_EMERGE, false); - WaitTimer2 = 60000;//never reached + WaitTimer2 = 60000; // never reached WaitTimer = 3000; } else WaitTimer2 -= diff; - if (WaitTimer <= diff)//wait 3secs for emerge anim, then attack + if (WaitTimer <= diff) // wait 3secs for emerge anim, then attack { WaitTimer = 3000; - CanStartEvent = true;//fresh fished from pool + CanStartEvent = true; // fresh fished from pool me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } @@ -214,7 +212,7 @@ public: return; } - if (me->getThreatManager().getThreatList().empty())//check if should evade + if (me->getThreatManager().getThreatList().empty()) // check if should evade { if (me->isInCombat()) EnterEvadeMode(); @@ -226,7 +224,7 @@ public: { me->InterruptNonMeleeSpells(false); DoCast(me, SPELL_SUBMERGE); - PhaseTimer = 60000;//60secs submerged + PhaseTimer = 60000; // 60secs submerged Submerged = true; } else PhaseTimer-=diff; @@ -236,12 +234,12 @@ public: me->SetReactState(REACT_PASSIVE); me->GetMotionMaster()->MoveRotate(20000, urand(0, 1) ? ROTATE_DIRECTION_LEFT : ROTATE_DIRECTION_RIGHT); SpoutTimer = 45000; - WhirlTimer = 20000;//whirl directly after spout + WhirlTimer = 20000; // whirl directly after spout RotTimer = 20000; return; } else SpoutTimer -= diff; - //Whirl directly after a Spout and at random times + // Whirl directly after a Spout and at random times if (WhirlTimer <= diff) { WhirlTimer = 18000; @@ -273,7 +271,7 @@ public: for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { if (i->getSource() && i->getSource()->isAlive() && me->HasInArc(float(diff/20000*M_PI*2), i->getSource()) && me->IsWithinDist(i->getSource(), SPOUT_DIST) && !i->getSource()->IsInWater()) - DoCast(i->getSource(), SPELL_SPOUT, true);//only knock back palyers in arc, in 100yards, not in water + DoCast(i->getSource(), SPELL_SPOUT, true); // only knock back players in arc, in 100yards, not in water } } @@ -300,7 +298,7 @@ public: GeyserTimer = rand()%5000 + 15000; } else GeyserTimer -= diff; - if (!InRange)//if on players in melee range cast Waterbolt + if (!InRange) // if on players in melee range cast Waterbolt { if (WaterboltTimer <= diff) { @@ -318,12 +316,13 @@ public: DoMeleeAttackIfReady(); - }else//submerged + } + else // submerged { if (PhaseTimer <= diff) { Submerged = false; - me->InterruptNonMeleeSpells(false);//shouldn't be any + me->InterruptNonMeleeSpells(false); // shouldn't be any me->RemoveAllAuras(); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->RemoveFlag(UNIT_NPC_EMOTESTATE, EMOTE_STATE_SUBMERGED); @@ -334,28 +333,22 @@ public: return; } else PhaseTimer-=diff; - if (me->getThreatManager().getThreatList().empty())//check if should evade + if (me->getThreatManager().getThreatList().empty()) // check if should evade { EnterEvadeMode(); return; } + if (!me->isInCombat()) DoZoneInCombat(); if (!Spawned) { me->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - //spawn adds + // spawn adds for (uint8 i = 0; i < 9; ++i) - { - Creature* Summoned; - if (i < 6) - Summoned = me->SummonCreature(MOB_COILFANG_AMBUSHER, AddPos[i][0], AddPos[i][1], AddPos[i][2], 0, TEMPSUMMON_CORPSE_DESPAWN, 0); - else Summoned = me->SummonCreature(MOB_COILFANG_GUARDIAN, AddPos[i][0], AddPos[i][1], AddPos[i][2], 0, TEMPSUMMON_CORPSE_DESPAWN, 0); - - if (Summoned) - Summons.Summon(Summoned); - } + if (Creature* summoned = me->SummonCreature(i < 6 ? MOB_COILFANG_AMBUSHER : MOB_COILFANG_GUARDIAN, AddPos[i][0], AddPos[i][1], AddPos[i][2], 0, TEMPSUMMON_CORPSE_DESPAWN, 0)) + Summons.Summon(summoned); Spawned = true; } } @@ -363,32 +356,6 @@ public: }; }; -class mob_coilfang_guardian : public CreatureScript -{ -public: - mob_coilfang_guardian() : CreatureScript("mob_coilfang_guardian") { } - - CreatureAI* GetAI(Creature* creature) const - { - SimpleAI* ai = new SimpleAI (creature); - - ai->Spell[0].Enabled = true; - ai->Spell[0].Spell_Id = SPELL_ARCINGSMASH; - ai->Spell[0].Cooldown = 15000; - ai->Spell[0].First_Cast = 5000; - ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_TARGET; - - ai->Spell[1].Enabled = true; - ai->Spell[1].Spell_Id = SPELL_HAMSTRING; - ai->Spell[1].Cooldown = 10000; - ai->Spell[1].First_Cast = 2000; - ai->Spell[1].Cast_Target_Type = CAST_HOSTILE_TARGET; - - return ai; - } - -}; - class mob_coilfang_ambusher : public CreatureScript { public: @@ -401,7 +368,7 @@ public: struct mob_coilfang_ambusherAI : public Scripted_NoMovementAI { - mob_coilfang_ambusherAI(Creature* c) : Scripted_NoMovementAI(c) + mob_coilfang_ambusherAI(Creature* creature) : Scripted_NoMovementAI(creature) { } @@ -412,22 +379,15 @@ public: { MultiShotTimer = 10000; ShootBowTimer = 4000; - - } - - void EnterCombat(Unit* /*who*/) - { - } void MoveInLineOfSight(Unit* who) { - if (!who || me->getVictim()) return; + if (!who || me->getVictim()) + return; if (who->isInAccessiblePlaceFor(me) && me->IsValidAttackTarget(who) && me->IsWithinDistInMap(who, 45)) - { AttackStart(who); - } } void UpdateAI(const uint32 diff) @@ -438,18 +398,16 @@ public: DoCast(me->getVictim(), SPELL_SPREAD_SHOT, true); MultiShotTimer = 10000+rand()%10000; - ShootBowTimer += 1500;//add global cooldown + ShootBowTimer += 1500; // add global cooldown } else MultiShotTimer -= diff; if (ShootBowTimer <= diff) { - Unit* target = NULL; - target = SelectTarget(SELECT_TARGET_RANDOM, 0); int bp0 = 1100; - if (target) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) me->CastCustomSpell(target, SPELL_SHOOT, &bp0, NULL, NULL, true); ShootBowTimer = 4000+rand()%5000; - MultiShotTimer += 1500;//add global cooldown + MultiShotTimer += 1500; // add global cooldown } else ShootBowTimer -= diff; } }; @@ -482,7 +440,6 @@ class go_strange_pool : public GameObjectScript void AddSC_boss_the_lurker_below() { new boss_the_lurker_below(); - new mob_coilfang_guardian(); new mob_coilfang_ambusher(); new go_strange_pool(); } diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp index eeef50e3f9c..865fb143800 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp @@ -89,9 +89,9 @@ public: struct boss_morogrim_tidewalkerAI : public ScriptedAI { - boss_morogrim_tidewalkerAI(Creature* c) : ScriptedAI(c) + boss_morogrim_tidewalkerAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -140,7 +140,7 @@ public: DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2, SAY_SLAY3), me); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); @@ -296,7 +296,7 @@ public: struct mob_water_globuleAI : public ScriptedAI { - mob_water_globuleAI(Creature* c) : ScriptedAI(c) {} + mob_water_globuleAI(Creature* creature) : ScriptedAI(creature) {} uint32 Check_Timer; diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp index 6c4019c7989..3ed3d1a82de 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp @@ -153,7 +153,7 @@ class instance_serpent_shrine : public InstanceMapScript if (Creature* frenzy = player->SummonCreature(MOB_COILFANG_FRENZY, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 2000)) { frenzy->Attack(player, false); - frenzy->AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_LEVITATING); + frenzy->AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_DISABLE_GRAVITY); } DoSpawnFrenzy = false; } diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp index c3203621dbb..48c5a360619 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp @@ -58,9 +58,9 @@ public: struct boss_thespiaAI : public ScriptedAI { - boss_thespiaAI(Creature* c) : ScriptedAI(c) + boss_thespiaAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -79,7 +79,7 @@ public: instance->SetData(TYPE_HYDROMANCER_THESPIA, NOT_STARTED); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEAD, me); @@ -158,7 +158,7 @@ public: struct mob_coilfang_waterelementalAI : public ScriptedAI { - mob_coilfang_waterelementalAI(Creature* c) : ScriptedAI(c) {} + mob_coilfang_waterelementalAI(Creature* creature) : ScriptedAI(creature) {} uint32 WaterBoltVolley_Timer; diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp index ce73e467c0c..739168863f4 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp @@ -60,9 +60,9 @@ public: struct boss_mekgineer_steamriggerAI : public ScriptedAI { - boss_mekgineer_steamriggerAI(Creature* c) : ScriptedAI(c) + boss_mekgineer_steamriggerAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -88,7 +88,7 @@ public: instance->SetData(TYPE_MEKGINEER_STEAMRIGGER, NOT_STARTED); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); @@ -204,9 +204,9 @@ public: struct mob_steamrigger_mechanicAI : public ScriptedAI { - mob_steamrigger_mechanicAI(Creature* c) : ScriptedAI(c) + mob_steamrigger_mechanicAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -231,7 +231,7 @@ public: { if (instance && instance->GetData64(DATA_MEKGINEERSTEAMRIGGER) && instance->GetData(TYPE_MEKGINEER_STEAMRIGGER) == IN_PROGRESS) { - if (Unit* pMekgineer = Unit::GetUnit((*me), instance->GetData64(DATA_MEKGINEERSTEAMRIGGER))) + if (Unit* pMekgineer = Unit::GetUnit(*me, instance->GetData64(DATA_MEKGINEERSTEAMRIGGER))) { if (me->IsWithinDistInMap(pMekgineer, MAX_REPAIR_RANGE)) { diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp index bfbeff81d3e..cae1117805a 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp @@ -54,9 +54,9 @@ public: struct mob_naga_distillerAI : public ScriptedAI { - mob_naga_distillerAI(Creature* c) : ScriptedAI(c) + mob_naga_distillerAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -112,9 +112,9 @@ public: struct boss_warlord_kalithreshAI : public ScriptedAI { - boss_warlord_kalithreshAI(Creature* c) : ScriptedAI(c) + boss_warlord_kalithreshAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -157,7 +157,7 @@ public: me->RemoveAurasDueToSpell(SPELL_WARLORDS_RAGE_PROC); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); diff --git a/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_hungarfen.cpp b/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_hungarfen.cpp index aebd71bbd47..42d617992ed 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_hungarfen.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_hungarfen.cpp @@ -40,7 +40,7 @@ public: struct boss_hungarfenAI : public ScriptedAI { - boss_hungarfenAI(Creature* c) : ScriptedAI(c) + boss_hungarfenAI(Creature* creature) : ScriptedAI(creature) { } @@ -112,7 +112,7 @@ public: struct mob_underbog_mushroomAI : public ScriptedAI { - mob_underbog_mushroomAI(Creature* c) : ScriptedAI(c) {} + mob_underbog_mushroomAI(Creature* creature) : ScriptedAI(creature) {} bool Stop; uint32 Grow_Timer; diff --git a/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_the_black_stalker.cpp b/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_the_black_stalker.cpp index fb3be660b5e..f7079e5c664 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_the_black_stalker.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_the_black_stalker.cpp @@ -47,7 +47,7 @@ public: struct boss_the_black_stalkerAI : public ScriptedAI { - boss_the_black_stalkerAI(Creature* c) : ScriptedAI(c) + boss_the_black_stalkerAI(Creature* creature) : ScriptedAI(creature) { } @@ -88,7 +88,7 @@ public: } } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { for (std::list<uint64>::const_iterator i = Striders.begin(); i != Striders.end(); ++i) if (Creature* strider = Unit::GetCreature(*me, *i)) diff --git a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp index b7604c41794..0e654ade995 100644 --- a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp +++ b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp @@ -66,9 +66,9 @@ public: struct boss_gruulAI : public ScriptedAI { - boss_gruulAI(Creature* c) : ScriptedAI(c) + boss_gruulAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } InstanceScript* instance; @@ -109,7 +109,7 @@ public: DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2, SAY_SLAY3), me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); @@ -130,8 +130,13 @@ public: { switch (urand(0, 1)) { - case 0: target->CastSpell(target, SPELL_MAGNETIC_PULL, true, NULL, NULL, me->GetGUID()); break; - case 1: target->CastSpell(target, SPELL_KNOCK_BACK, true, NULL, NULL, me->GetGUID()); break; + case 0: + target->CastSpell(target, SPELL_MAGNETIC_PULL, true, NULL, NULL, me->GetGUID()); + break; + + case 1: + target->CastSpell(target, SPELL_KNOCK_BACK, true, NULL, NULL, me->GetGUID()); + break; } } } diff --git a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp index 4636334e668..0f42b1b7e53 100644 --- a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp +++ b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp @@ -118,9 +118,9 @@ public: struct boss_high_king_maulgarAI : public ScriptedAI { - boss_high_king_maulgarAI(Creature* c) : ScriptedAI(c) + boss_high_king_maulgarAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); for (uint8 i = 0; i < 4; ++i) Council[i] = 0; } @@ -173,7 +173,7 @@ public: DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2, SAY_SLAY3), me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); @@ -223,7 +223,7 @@ public: //Only if not incombat check if the event is started if (!me->isInCombat() && instance && instance->GetData(DATA_MAULGAREVENT)) { - Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_MAULGAREVENT_TANK)); + Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_MAULGAREVENT_TANK)); if (target) { @@ -317,9 +317,9 @@ public: struct boss_olm_the_summonerAI : public ScriptedAI { - boss_olm_the_summonerAI(Creature* c) : ScriptedAI(c) + boss_olm_the_summonerAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 DarkDecay_Timer; @@ -363,7 +363,7 @@ public: } } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { if (instance) { @@ -383,7 +383,7 @@ public: //Only if not incombat check if the event is started if (!me->isInCombat() && instance && instance->GetData(DATA_MAULGAREVENT)) { - Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_MAULGAREVENT_TANK)); + Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_MAULGAREVENT_TANK)); if (target) { @@ -445,9 +445,9 @@ public: struct boss_kiggler_the_crazedAI : public ScriptedAI { - boss_kiggler_the_crazedAI(Creature* c) : ScriptedAI(c) + boss_kiggler_the_crazedAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 GreaterPolymorph_Timer; @@ -478,7 +478,7 @@ public: } } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { if (instance) { @@ -498,7 +498,7 @@ public: //Only if not incombat check if the event is started if (!me->isInCombat() && instance && instance->GetData(DATA_MAULGAREVENT)) { - Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_MAULGAREVENT_TANK)); + Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_MAULGAREVENT_TANK)); if (target) { @@ -567,9 +567,9 @@ public: struct boss_blindeye_the_seerAI : public ScriptedAI { - boss_blindeye_the_seerAI(Creature* c) : ScriptedAI(c) + boss_blindeye_the_seerAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 GreaterPowerWordShield_Timer; @@ -598,7 +598,7 @@ public: } } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { if (instance) { @@ -618,7 +618,7 @@ public: //Only if not incombat check if the event is started if (!me->isInCombat() && instance && instance->GetData(DATA_MAULGAREVENT)) { - Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_MAULGAREVENT_TANK)); + Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_MAULGAREVENT_TANK)); if (target) { @@ -677,9 +677,9 @@ public: struct boss_krosh_firehandAI : public ScriptedAI { - boss_krosh_firehandAI(Creature* c) : ScriptedAI(c) + boss_krosh_firehandAI(Creature* creature) : ScriptedAI(creature) { - instance = c->GetInstanceScript(); + instance = creature->GetInstanceScript(); } uint32 GreaterFireball_Timer; @@ -708,7 +708,7 @@ public: } } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { if (instance) { @@ -728,7 +728,7 @@ public: //Only if not incombat check if the event is started if (!me->isInCombat() && instance && instance->GetData(DATA_MAULGAREVENT)) { - Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_MAULGAREVENT_TANK)); + Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_MAULGAREVENT_TANK)); if (target) { diff --git a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp index bd4f91e8e39..3514732b53a 100644 --- a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp +++ b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp @@ -77,7 +77,8 @@ public: bool IsEncounterInProgress() const { for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; + if (m_auiEncounter[i] == IN_PROGRESS) + return true; return false; } @@ -136,12 +137,18 @@ public: switch (type) { case DATA_MAULGAREVENT: - if (data == DONE) HandleGameObject(MaulgarDoor, true); - m_auiEncounter[0] = data; break; + if (data == DONE) + HandleGameObject(MaulgarDoor, true); + m_auiEncounter[0] = data; + break; + case DATA_GRUULEVENT: - if (data == IN_PROGRESS) HandleGameObject(GruulDoor, false); - else HandleGameObject(GruulDoor, true); - m_auiEncounter[1] = data; break; + if (data == IN_PROGRESS) + HandleGameObject(GruulDoor, false); + else + HandleGameObject(GruulDoor, true); + m_auiEncounter[1] = data; + break; } if (data == DONE) diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp index 7fa417cacb2..f6b7518661e 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp @@ -121,7 +121,7 @@ class boss_broggok : public CreatureScript DoMeleeAttackIfReady(); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { if (instance) { @@ -133,9 +133,9 @@ class boss_broggok : public CreatureScript }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new boss_broggokAI (Creature); + return new boss_broggokAI(creature); } }; diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp index b847500fc36..01873afeaa9 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp @@ -158,7 +158,9 @@ class boss_kelidan_the_breaker : public CreatureScript uint64 GetChanneled(Creature* channeler1) { SummonChannelers(); - if (!channeler1) return 0; + if (!channeler1) + return 0; + uint8 i; for (i=0; i<5; ++i) { @@ -183,7 +185,7 @@ class boss_kelidan_the_breaker : public CreatureScript } } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DIE, me); @@ -268,9 +270,9 @@ class boss_kelidan_the_breaker : public CreatureScript }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new boss_kelidan_the_breakerAI (Creature); + return new boss_kelidan_the_breakerAI(creature); } }; @@ -324,10 +326,10 @@ class mob_shadowmoon_channeler : public CreatureScript DoStartMovement(who); } - void JustDied(Unit* Killer) + void JustDied(Unit* killer) { if (Creature* Kelidan = me->FindNearestCreature(ENTRY_KELIDAN, 100)) - CAST_AI(boss_kelidan_the_breaker::boss_kelidan_the_breakerAI, Kelidan->AI())->ChannelerDied(Killer); + CAST_AI(boss_kelidan_the_breaker::boss_kelidan_the_breakerAI, Kelidan->AI())->ChannelerDied(killer); } void UpdateAI(const uint32 diff) @@ -371,9 +373,9 @@ class mob_shadowmoon_channeler : public CreatureScript } }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new mob_shadowmoon_channelerAI (Creature); + return new mob_shadowmoon_channelerAI(creature); } }; diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp index f056ccd40ee..dc9f83b073d 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp @@ -94,7 +94,7 @@ class boss_the_maker : public CreatureScript DoScriptText(RAND(SAY_KILL_1, SAY_KILL_2), me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DIE, me); @@ -153,9 +153,9 @@ class boss_the_maker : public CreatureScript } }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new boss_the_makerAI (Creature); + return new boss_the_makerAI(creature); } }; diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp index a6adb6b952e..2ab2b2b5b2e 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp @@ -113,7 +113,7 @@ class boss_omor_the_unscarred : public CreatureScript ++SummonedCount; } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DIE, me); } @@ -143,7 +143,7 @@ class boss_omor_the_unscarred : public CreatureScript if (Player* temp = Unit::GetPlayer(*me, PlayerGUID)) { //if unit dosen't have this flag, then no pulling back (script will attempt cast, even if orbital strike was resisted) - if (temp->HasUnitMovementFlag(MOVEMENTFLAG_FALLING)) + if (temp->HasUnitMovementFlag(MOVEMENTFLAG_FALLING_FAR)) { me->InterruptNonMeleeSpells(false); DoCast(temp, SPELL_SHADOW_WHIP); @@ -219,9 +219,9 @@ class boss_omor_the_unscarred : public CreatureScript } }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new boss_omor_the_unscarredAI (Creature); + return new boss_omor_the_unscarredAI(creature); } }; diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp index ecea5e6abb4..a5cdebea754 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp @@ -145,8 +145,8 @@ class boss_nazan : public CreatureScript flight = false; BellowingRoar_Timer = 6000; ConeOfFire_Timer = 12000; - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetDisableGravity(false); + me->SetWalk(true); me->GetMotionMaster()->Clear(); if (Unit* victim = SelectTarget(SELECT_TARGET_NEAREST, 0)) me->AI()->AttackStart(victim); @@ -194,9 +194,9 @@ class boss_nazan : public CreatureScript } }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new boss_nazanAI (Creature); + return new boss_nazanAI(creature); } }; @@ -236,9 +236,9 @@ class boss_vazruden : public CreatureScript DoScriptText(RAND(SAY_KILL_1, SAY_KILL_2), me); } - void JustDied(Unit* who) + void JustDied(Unit* killer) { - if (who && who != me) + if (killer && killer != me) DoScriptText(SAY_DIE, me); } @@ -272,9 +272,9 @@ class boss_vazruden : public CreatureScript DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new boss_vazrudenAI (Creature); + return new boss_vazrudenAI(creature); } }; @@ -374,7 +374,7 @@ class boss_vazruden_the_herald : public CreatureScript if (summoned->GetEntry() == ENTRY_NAZAN) { CAST_AI(boss_nazan::boss_nazanAI, summoned->AI())->VazrudenGUID = VazrudenGUID; - summoned->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + summoned->SetDisableGravity(true); summoned->SetSpeed(MOVE_FLIGHT, 2.5f); if (victim) AttackStartNoMove(victim); @@ -453,9 +453,9 @@ class boss_vazruden_the_herald : public CreatureScript } }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new boss_vazruden_the_heraldAI (Creature); + return new boss_vazruden_the_heraldAI(creature); } }; @@ -480,10 +480,10 @@ class mob_hellfire_sentry : public CreatureScript void EnterCombat(Unit* /*who*/) {} - void JustDied(Unit* who) + void JustDied(Unit* killer) { if (Creature* herald = me->FindNearestCreature(ENTRY_VAZRUDEN_HERALD, 150)) - CAST_AI(boss_vazruden_the_herald::boss_vazruden_the_heraldAI, herald->AI())->SentryDownBy(who); + CAST_AI(boss_vazruden_the_herald::boss_vazruden_the_heraldAI, herald->AI())->SentryDownBy(killer); } void UpdateAI(const uint32 diff) @@ -503,9 +503,9 @@ class mob_hellfire_sentry : public CreatureScript DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new mob_hellfire_sentryAI (Creature); + return new mob_hellfire_sentryAI(creature); } }; void AddSC_boss_vazruden_the_herald() diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp index b2f8af2c80d..2c00a68321a 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp @@ -87,7 +87,7 @@ class boss_watchkeeper_gargolmar : public CreatureScript { if (!me->getVictim() && me->canCreatureAttack(who)) { - if (!me->canFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) + if (!me->CanFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) return; float attackRadius = me->GetAttackDistance(who); @@ -109,7 +109,7 @@ class boss_watchkeeper_gargolmar : public CreatureScript DoScriptText(RAND(SAY_KILL_1, SAY_KILL_2), me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DIE, me); } @@ -163,9 +163,9 @@ class boss_watchkeeper_gargolmar : public CreatureScript } }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new boss_watchkeeper_gargolmarAI (Creature); + return new boss_watchkeeper_gargolmarAI(creature); } }; diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp index c355079e0e8..1b29abf1afc 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp @@ -198,9 +198,9 @@ class mob_abyssal : public CreatureScript } }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new mob_abyssalAI(Creature); + return new mob_abyssalAI(creature); } }; @@ -322,7 +322,7 @@ class boss_magtheridon : public CreatureScript DoScriptText(SAY_PLAYER_KILLED, me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { if (instance) instance->SetData(DATA_MAGTHERIDON_EVENT, DONE); @@ -464,9 +464,9 @@ class boss_magtheridon : public CreatureScript } }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new boss_magtheridonAI(Creature); + return new boss_magtheridonAI(creature); } }; @@ -533,7 +533,7 @@ class mob_hellfire_channeler : public CreatureScript DoCast(me, SPELL_SOUL_TRANSFER, true); } - void JustDied(Unit* /*who*/) + void JustDied(Unit* /*killer*/) { if (instance) instance->SetData(DATA_CHANNELER_EVENT, DONE); @@ -583,9 +583,9 @@ class mob_hellfire_channeler : public CreatureScript } }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new mob_hellfire_channelerAI(Creature); + return new mob_hellfire_channelerAI(creature); } }; @@ -597,16 +597,16 @@ public: { } - bool OnGossipHello(Player* player, GameObject* pGO) + bool OnGossipHello(Player* player, GameObject* go) { - InstanceScript* instance = pGO->GetInstanceScript(); + InstanceScript* instance = go->GetInstanceScript(); if (!instance) return true; if (instance->GetData(DATA_MAGTHERIDON_EVENT) != IN_PROGRESS) return true; - Creature* Magtheridon =Unit::GetCreature(*pGO, instance->GetData64(DATA_MAGTHERIDON)); + Creature* Magtheridon =Unit::GetCreature(*go, instance->GetData64(DATA_MAGTHERIDON)); if (!Magtheridon || !Magtheridon->isAlive()) return true; @@ -617,7 +617,7 @@ public: player->InterruptNonMeleeSpells(false); player->CastSpell(player, SPELL_SHADOW_GRASP, true); player->CastSpell(player, SPELL_SHADOW_GRASP_VISUAL, false); - CAST_AI(boss_magtheridon::boss_magtheridonAI, Magtheridon->AI())->SetClicker(pGO->GetGUID(), player->GetGUID()); + CAST_AI(boss_magtheridon::boss_magtheridonAI, Magtheridon->AI())->SetClicker(go->GetGUID(), player->GetGUID()); return true; } }; diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp index caaedc4c51b..cb55d627f7d 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp @@ -80,7 +80,9 @@ class instance_magtheridons_lair : public InstanceMapScript bool IsEncounterInProgress() const { for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; + if (m_auiEncounter[i] == IN_PROGRESS) + return true; + return false; } diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp index 970c089918e..7dfdc40a787 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp @@ -224,7 +224,7 @@ class boss_grand_warlock_nethekurse : public CreatureScript DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DIE, me); @@ -301,9 +301,9 @@ class boss_grand_warlock_nethekurse : public CreatureScript } }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new boss_grand_warlock_nethekurseAI (Creature); + return new boss_grand_warlock_nethekurseAI(creature); } }; @@ -356,7 +356,7 @@ class mob_fel_orc_convert : public CreatureScript } } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { if (instance) { @@ -383,9 +383,9 @@ class mob_fel_orc_convert : public CreatureScript } }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new mob_fel_orc_convertAI (Creature); + return new mob_fel_orc_convertAI(creature); } }; diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp index 5e8ed53fa4b..5371473e21e 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp @@ -143,9 +143,9 @@ class mob_omrogg_heads : public CreatureScript } }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new mob_omrogg_headsAI (Creature); + return new mob_omrogg_headsAI(creature); } }; @@ -295,7 +295,7 @@ class boss_warbringer_omrogg : public CreatureScript } } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { Unit* pLeftHead = Unit::GetUnit(*me, LeftHeadGUID); Unit* pRightHead = Unit::GetUnit(*me, RightHeadGUID); diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp index 3f07552441b..c1489671292 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp @@ -95,7 +95,7 @@ class boss_warchief_kargath_bladefist : public CreatureScript removeAdds(); me->SetSpeed(MOVE_RUN, 2); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(false); summoned = 2; InBlade = false; @@ -137,7 +137,7 @@ class boss_warchief_kargath_bladefist : public CreatureScript } } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); removeAdds(); @@ -166,7 +166,7 @@ class boss_warchief_kargath_bladefist : public CreatureScript { for (std::vector<uint64>::const_iterator itr = adds.begin(); itr!= adds.end(); ++itr) { - Unit* temp = Unit::GetUnit((*me), *itr); + Unit* temp = Unit::GetUnit(*me, *itr); if (temp && temp->isAlive()) { (*temp).GetMotionMaster()->Clear(true); @@ -178,7 +178,7 @@ class boss_warchief_kargath_bladefist : public CreatureScript for (std::vector<uint64>::const_iterator itr = assassins.begin(); itr!= assassins.end(); ++itr) { - Unit* temp = Unit::GetUnit((*me), *itr); + Unit* temp = Unit::GetUnit(*me, *itr); if (temp && temp->isAlive()) { (*temp).GetMotionMaster()->Clear(true); @@ -236,8 +236,8 @@ class boss_warchief_kargath_bladefist : public CreatureScript float x, y, randx, randy; randx = 0.0f + rand()%40; randy = 0.0f + rand()%40; - x = 210+ randx ; - y = -60- randy ; + x = 210+ randx; + y = -60- randy; me->GetMotionMaster()->MovePoint(1, x, y, me->GetPositionZ()); Wait_Timer = 0; } @@ -316,9 +316,9 @@ class boss_warchief_kargath_bladefist : public CreatureScript } }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new boss_warchief_kargath_bladefistAI (Creature); + return new boss_warchief_kargath_bladefistAI(creature); } }; diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp index fcfe6c0ea16..25207073708 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp @@ -130,7 +130,7 @@ class boss_alar : public CreatureScript //me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 10); //me->SetFloatValue(UNIT_FIELD_COMBATREACH, 10); me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true); - me->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); + me->SetUnitMovementFlags(MOVEMENTFLAG_DISABLE_GRAVITY); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->setActive(false); } @@ -140,12 +140,12 @@ class boss_alar : public CreatureScript if (instance) instance->SetData(DATA_ALAREVENT, IN_PROGRESS); - me->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); // after enterevademode will be set walk movement + me->SetUnitMovementFlags(MOVEMENTFLAG_DISABLE_GRAVITY); // after enterevademode will be set walk movement DoZoneInCombat(); me->setActive(true); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { if (instance) instance->SetData(DATA_ALAREVENT, DONE); @@ -409,7 +409,7 @@ class boss_alar : public CreatureScript if (Summoned) { Summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - Summoned->SetFloatValue(OBJECT_FIELD_SCALE_X, Summoned->GetFloatValue(OBJECT_FIELD_SCALE_X)*2.5f); + Summoned->SetObjectScale(Summoned->GetFloatValue(OBJECT_FIELD_SCALE_X)*2.5f); Summoned->SetDisplayId(11686); Summoned->setFaction(me->getFaction()); Summoned->SetLevel(me->getLevel()); @@ -450,9 +450,9 @@ class boss_alar : public CreatureScript } }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new boss_alarAI(Creature); + return new boss_alarAI(creature); } }; @@ -470,7 +470,7 @@ class mob_ember_of_alar : public CreatureScript mob_ember_of_alarAI(Creature* creature) : ScriptedAI(creature) { instance = creature->GetInstanceScript(); - creature->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); + creature->SetUnitMovementFlags(MOVEMENTFLAG_DISABLE_GRAVITY); creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true); } @@ -500,7 +500,7 @@ class mob_ember_of_alar : public CreatureScript me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); if (instance && instance->GetData(DATA_ALAREVENT) == 2) { - if (Unit* Alar = Unit::GetUnit((*me), instance->GetData64(DATA_ALAR))) + if (Unit* Alar = Unit::GetUnit(*me, instance->GetData64(DATA_ALAR))) { int32 AlarHealth = int32(Alar->GetHealth()) - int32(Alar->CountPctFromMaxHealth(3)); if (AlarHealth > 0) @@ -529,9 +529,9 @@ class mob_ember_of_alar : public CreatureScript }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new mob_ember_of_alarAI(Creature); + return new mob_ember_of_alarAI(creature); } }; @@ -554,9 +554,9 @@ class mob_flame_patch_alar : public CreatureScript void UpdateAI(const uint32 /*diff*/) {} }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new mob_flame_patch_alarAI(Creature); + return new mob_flame_patch_alarAI(creature); } }; diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp index 05fad24f35e..d202fdd2f44 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp @@ -140,7 +140,7 @@ class boss_high_astromancer_solarian : public CreatureScript me->SetArmor(defaultarmor); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetVisible(true); - me->SetFloatValue(OBJECT_FIELD_SCALE_X, defaultsize); + me->SetObjectScale(defaultsize); me->SetDisplayId(MODEL_HUMAN); Summons.DespawnAll(); @@ -151,9 +151,9 @@ class boss_high_astromancer_solarian : public CreatureScript DoScriptText(RAND(SAY_KILL1, SAY_KILL2, SAY_KILL3), me); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { - me->SetFloatValue(OBJECT_FIELD_SCALE_X, defaultsize); + me->SetObjectScale(defaultsize); me->SetDisplayId(MODEL_HUMAN); DoScriptText(SAY_DEATH, me); if (instance) @@ -397,7 +397,7 @@ class boss_high_astromancer_solarian : public CreatureScript DoScriptText(SAY_VOIDB, me); me->SetArmor(WV_ARMOR); me->SetDisplayId(MODEL_VOIDWALKER); - me->SetFloatValue(OBJECT_FIELD_SCALE_X, defaultsize*2.5f); + me->SetObjectScale(defaultsize*2.5f); } DoMeleeAttackIfReady(); } @@ -454,7 +454,7 @@ class mob_solarium_priest : public CreatureScript { case 0: if (instance) - target = Unit::GetUnit((*me), instance->GetData64(DATA_ASTROMANCER)); + target = Unit::GetUnit(*me, instance->GetData64(DATA_ASTROMANCER)); break; case 1: target = me; @@ -490,9 +490,9 @@ class mob_solarium_priest : public CreatureScript } }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new mob_solarium_priestAI (Creature); + return new mob_solarium_priestAI(creature); } }; diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp index 7a60b1545d0..b66fc5f5e24 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp @@ -147,11 +147,11 @@ struct advisorbase_ai : public ScriptedAI { advisorbase_ai(Creature* creature) : ScriptedAI(creature) { - m_instance = creature->GetInstanceScript(); + instance = creature->GetInstanceScript(); m_bDoubled_Health = false; } - InstanceScript* m_instance; + InstanceScript* instance; bool FakeDeath; bool m_bDoubled_Health; uint32 DelayRes_Timer; @@ -174,8 +174,8 @@ struct advisorbase_ai : public ScriptedAI me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); //reset encounter - if (m_instance && (m_instance->GetData(DATA_KAELTHASEVENT) == 1 || m_instance->GetData(DATA_KAELTHASEVENT) == 3)) - if (Creature* Kaelthas = Unit::GetCreature((*me), m_instance->GetData64(DATA_KAELTHAS))) + if (instance && (instance->GetData(DATA_KAELTHASEVENT) == 1 || instance->GetData(DATA_KAELTHASEVENT) == 3)) + if (Creature* Kaelthas = Unit::GetCreature((*me), instance->GetData64(DATA_KAELTHAS))) Kaelthas->AI()->EnterEvadeMode(); } @@ -214,14 +214,14 @@ struct advisorbase_ai : public ScriptedAI return; //Prevent glitch if in fake death - if (FakeDeath && m_instance && m_instance->GetData(DATA_KAELTHASEVENT) != 0) + if (FakeDeath && instance && instance->GetData(DATA_KAELTHASEVENT) != 0) { damage = 0; return; } //Don't really die in phase 1 & 3, only die after that - if (m_instance && m_instance->GetData(DATA_KAELTHASEVENT) != 0) + if (instance && instance->GetData(DATA_KAELTHASEVENT) != 0) { //prevent death damage = 0; @@ -253,7 +253,7 @@ struct advisorbase_ai : public ScriptedAI DelayRes_Timer = 0; FakeDeath = false; - Unit* Target = Unit::GetUnit((*me), DelayRes_Target); + Unit* Target = Unit::GetUnit(*me, DelayRes_Target); if (!Target) Target = me->getVictim(); @@ -280,11 +280,11 @@ class boss_kaelthas : public CreatureScript { boss_kaelthasAI(Creature* creature) : ScriptedAI(creature), summons(me) { - m_instance = creature->GetInstanceScript(); + instance = creature->GetInstanceScript(); memset(&m_auiAdvisorGuid, 0, sizeof(m_auiAdvisorGuid)); } - InstanceScript* m_instance; + InstanceScript* instance; uint32 Fireball_Timer; uint32 ArcaneDisruption_Timer; @@ -335,8 +335,8 @@ class boss_kaelthas : public CreatureScript me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (m_instance) - m_instance->SetData(DATA_KAELTHASEVENT, 0); + if (instance) + instance->SetData(DATA_KAELTHASEVENT, 0); } void PrepareAdvisors() @@ -355,13 +355,13 @@ class boss_kaelthas : public CreatureScript void StartEvent() { - if (!m_instance) + if (!instance) return; - m_auiAdvisorGuid[0] = m_instance->GetData64(DATA_THALADREDTHEDARKENER); - m_auiAdvisorGuid[1] = m_instance->GetData64(DATA_LORDSANGUINAR); - m_auiAdvisorGuid[2] = m_instance->GetData64(DATA_GRANDASTROMANCERCAPERNIAN); - m_auiAdvisorGuid[3] = m_instance->GetData64(DATA_MASTERENGINEERTELONICUS); + m_auiAdvisorGuid[0] = instance->GetData64(DATA_THALADREDTHEDARKENER); + m_auiAdvisorGuid[1] = instance->GetData64(DATA_LORDSANGUINAR); + m_auiAdvisorGuid[2] = instance->GetData64(DATA_GRANDASTROMANCERCAPERNIAN); + m_auiAdvisorGuid[3] = instance->GetData64(DATA_MASTERENGINEERTELONICUS); if (!m_auiAdvisorGuid[0] || !m_auiAdvisorGuid[1] || !m_auiAdvisorGuid[2] || !m_auiAdvisorGuid[3]) { @@ -371,7 +371,7 @@ class boss_kaelthas : public CreatureScript Phase = 4; - m_instance->SetData(DATA_KAELTHASEVENT, 4); + instance->SetData(DATA_KAELTHASEVENT, 4); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -386,7 +386,7 @@ class boss_kaelthas : public CreatureScript DoScriptText(SAY_INTRO, me); - m_instance->SetData(DATA_KAELTHASEVENT, 1); + instance->SetData(DATA_KAELTHASEVENT, 1); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); PhaseSubphase = 0; @@ -399,7 +399,7 @@ class boss_kaelthas : public CreatureScript { if (!me->HasUnitState(UNIT_STATE_STUNNED) && me->canCreatureAttack(who)) { - if (!me->canFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) + if (!me->CanFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) return; float attackRadius = me->GetAttackDistance(who); @@ -412,7 +412,7 @@ class boss_kaelthas : public CreatureScript } else if (me->GetMap()->IsDungeon()) { - if (m_instance && !m_instance->GetData(DATA_KAELTHASEVENT) && !Phase) + if (instance && !instance->GetData(DATA_KAELTHASEVENT) && !Phase) StartEvent(); who->SetInCombatWith(me); @@ -424,7 +424,7 @@ class boss_kaelthas : public CreatureScript void EnterCombat(Unit* /*who*/) { - if (m_instance && !m_instance->GetData(DATA_KAELTHASEVENT) && !Phase) + if (instance && !instance->GetData(DATA_KAELTHASEVENT) && !Phase) StartEvent(); } @@ -445,9 +445,12 @@ class boss_kaelthas : public CreatureScript } } - void SummonedCreatureDespawn(Creature* summon) {summons.Despawn(summon);} + void SummonedCreatureDespawn(Creature* summon) + { + summons.Despawn(summon); + } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -456,12 +459,12 @@ class boss_kaelthas : public CreatureScript summons.DespawnAll(); - if (m_instance) - m_instance->SetData(DATA_KAELTHASEVENT, 0); + if (instance) + instance->SetData(DATA_KAELTHASEVENT, 0); for (uint8 i = 0; i < MAX_ADVISORS; ++i) { - if (Unit* pAdvisor = Unit::GetUnit((*me), m_auiAdvisorGuid[i])) + if (Unit* pAdvisor = Unit::GetUnit(*me, m_auiAdvisorGuid[i])) pAdvisor->Kill(pAdvisor); } } @@ -621,8 +624,8 @@ class boss_kaelthas : public CreatureScript if (Advisor && (Advisor->getStandState() == UNIT_STAND_STATE_DEAD)) { Phase = 2; - if (m_instance) - m_instance->SetData(DATA_KAELTHASEVENT, 2); + if (instance) + instance->SetData(DATA_KAELTHASEVENT, 2); DoScriptText(SAY_PHASE2_WEAPON, me); @@ -666,8 +669,8 @@ class boss_kaelthas : public CreatureScript if (Phase_Timer <= diff) { DoScriptText(SAY_PHASE3_ADVANCE, me); - if (m_instance) - m_instance->SetData(DATA_KAELTHASEVENT, 3); + if (instance) + instance->SetData(DATA_KAELTHASEVENT, 3); Phase = 3; PhaseSubphase = 0; } @@ -704,8 +707,8 @@ class boss_kaelthas : public CreatureScript DoScriptText(SAY_PHASE4_INTRO2, me); Phase = 4; - if (m_instance) - m_instance->SetData(DATA_KAELTHASEVENT, 4); + if (instance) + instance->SetData(DATA_KAELTHASEVENT, 4); // Sometimes people can collect Aggro in Phase 1-3. Reset threat before releasing Kael. DoResetThreat(); @@ -809,8 +812,8 @@ class boss_kaelthas : public CreatureScript { if (HealthBelowPct(50)) { - if (m_instance) - m_instance->SetData(DATA_KAELTHASEVENT, 4); + if (instance) + instance->SetData(DATA_KAELTHASEVENT, 4); Phase = 5; Phase_Timer = 10000; @@ -892,7 +895,7 @@ class boss_kaelthas : public CreatureScript // 1) Kael'thas will portal the whole raid right into his body for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) { - Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()); if (unit && (unit->GetTypeId() == TYPEID_PLAYER)) { //Use work around packet to prevent player from being dropped from combat @@ -913,7 +916,7 @@ class boss_kaelthas : public CreatureScript // 2) At that point he will put a Gravity Lapse debuff on everyone for (i = me->getThreatManager().getThreatList().begin(); i != me->getThreatManager().getThreatList().end(); ++i) { - if (Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid())) + if (Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid())) { DoCast(unit, SPELL_KNOCKBACK, true); //Gravity lapse - needs an exception in Spell system to work @@ -945,7 +948,7 @@ class boss_kaelthas : public CreatureScript //Remove flight for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) { - if (Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid())) + if (Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid())) { //Using packet workaround WorldPacket data(SMSG_MOVE_UNSET_CAN_FLY, 12); @@ -996,9 +999,9 @@ class boss_kaelthas : public CreatureScript } } }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new boss_kaelthasAI(Creature); + return new boss_kaelthasAI(creature); } }; @@ -1042,7 +1045,7 @@ class boss_thaladred_the_darkener : public CreatureScript void JustDied(Unit* /*killer*/) { - if (m_instance && m_instance->GetData(DATA_KAELTHASEVENT) == 3) + if (instance && instance->GetData(DATA_KAELTHASEVENT) == 3) DoScriptText(SAY_THALADRED_DEATH, me); } @@ -1094,9 +1097,9 @@ class boss_thaladred_the_darkener : public CreatureScript } }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new boss_thaladred_the_darkenerAI(Creature); + return new boss_thaladred_the_darkenerAI(creature); } }; @@ -1132,9 +1135,9 @@ class boss_lord_sanguinar : public CreatureScript DoScriptText(SAY_SANGUINAR_AGGRO, me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { - if (m_instance && m_instance->GetData(DATA_KAELTHASEVENT) == 3) + if (instance && instance->GetData(DATA_KAELTHASEVENT) == 3) DoScriptText(SAY_SANGUINAR_DEATH, me); } @@ -1162,9 +1165,9 @@ class boss_lord_sanguinar : public CreatureScript DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new boss_lord_sanguinarAI(Creature); + return new boss_lord_sanguinarAI(creature); } }; //Grand Astromancer Capernian AI @@ -1199,7 +1202,7 @@ class boss_grand_astromancer_capernian : public CreatureScript void JustDied(Unit* /*killer*/) { - if (m_instance && m_instance->GetData(DATA_KAELTHASEVENT) == 3) + if (instance && instance->GetData(DATA_KAELTHASEVENT) == 3) DoScriptText(SAY_CAPERNIAN_DEATH, me); } @@ -1284,7 +1287,7 @@ class boss_grand_astromancer_capernian : public CreatureScript std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList(); for (std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); i!= m_threatlist.end(); ++i) { - Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()); //if in melee range if (unit && unit->IsWithinDistInMap(me, 5)) { @@ -1306,9 +1309,9 @@ class boss_grand_astromancer_capernian : public CreatureScript } }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new boss_grand_astromancer_capernianAI(Creature); + return new boss_grand_astromancer_capernianAI(creature); } }; @@ -1338,7 +1341,7 @@ class boss_master_engineer_telonicus : public CreatureScript void JustDied(Unit* /*killer*/) { - if (m_instance && m_instance->GetData(DATA_KAELTHASEVENT) == 3) + if (instance && instance->GetData(DATA_KAELTHASEVENT) == 3) DoScriptText(SAY_TELONICUS_DEATH, me); } @@ -1389,9 +1392,9 @@ class boss_master_engineer_telonicus : public CreatureScript } }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new boss_master_engineer_telonicusAI(Creature); + return new boss_master_engineer_telonicusAI(creature); } }; @@ -1453,9 +1456,9 @@ class mob_kael_flamestrike : public CreatureScript } }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new mob_kael_flamestrikeAI(Creature); + return new mob_kael_flamestrikeAI(creature); } }; @@ -1507,9 +1510,9 @@ class mob_phoenix_tk : public CreatureScript } }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new mob_phoenix_tkAI(Creature); + return new mob_phoenix_tkAI(creature); } }; diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp index 576d0a8bbf2..275a72e75ac 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp @@ -76,8 +76,8 @@ class boss_void_reaver : public CreatureScript Enraged = false; - if (instance && me->isAlive()) - instance->SetData(DATA_VOIDREAVEREVENT, NOT_STARTED); + if (instance && me->isAlive()) + instance->SetData(DATA_VOIDREAVEREVENT, NOT_STARTED); } void KilledUnit(Unit* /*victim*/) @@ -85,7 +85,7 @@ class boss_void_reaver : public CreatureScript DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2, SAY_SLAY3), me); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); DoZoneInCombat(); diff --git a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp index 1ec4a6e55ec..f25b6749055 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp @@ -78,7 +78,8 @@ class instance_the_eye : public InstanceMapScript bool IsEncounterInProgress() const { for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; + if (m_auiEncounter[i] == IN_PROGRESS) + return true; return false; } diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp index b8b0ffd4d2e..a1287a57402 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp @@ -86,7 +86,7 @@ class boss_gatewatcher_iron_hand : public CreatureScript DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH_1, me); //TODO: Add door check/open code diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp index 7e435187be9..59837fdbed1 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp @@ -101,7 +101,7 @@ class boss_nethermancer_sepethrea : public CreatureScript DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); if (instance) diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp index cdc3b799b2c..3a4d449707d 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp @@ -103,7 +103,7 @@ class boss_pathaleon_the_calculator : public CreatureScript DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp index 9db2b660d2a..ad3c899237f 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp @@ -66,7 +66,7 @@ class instance_mechanar : public InstanceMapScript return false; } - uint64 GetData64 (uint32 /*identifier*/) + uint64 GetData64(uint32 /*identifier*/) { return 0; } diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp index db95f60f556..d675b438968 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp @@ -128,7 +128,7 @@ class npc_millhouse_manastorm : public CreatureScript Talk(SAY_KILL); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { Talk(SAY_DEATH); @@ -316,7 +316,7 @@ class npc_warden_mellichar : public CreatureScript if (!me->getVictim() && me->canCreatureAttack(who)) { - if (!me->canFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) + if (!me->CanFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) return; if (who->GetTypeId() != TYPEID_PLAYER) return; diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp index de86ec8672c..c2eeaf9fe7a 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp @@ -112,7 +112,7 @@ class boss_harbinger_skyriss : public CreatureScript void EnterCombat(Unit* /*who*/) {} - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); if (instance) diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp index 6a27d295ebc..ffe96fb7bd1 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp @@ -93,7 +93,8 @@ class instance_arcatraz : public InstanceMapScript bool IsEncounterInProgress() const { for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; + if (m_auiEncounter[i] == IN_PROGRESS) + return true; return false; } @@ -102,15 +103,41 @@ class instance_arcatraz : public InstanceMapScript { switch (go->GetEntry()) { - case CONTAINMENT_CORE_SECURITY_FIELD_ALPHA: Containment_Core_Security_Field_AlphaGUID = go->GetGUID(); break; - case CONTAINMENT_CORE_SECURITY_FIELD_BETA: Containment_Core_Security_Field_BetaGUID = go->GetGUID(); break; - case POD_ALPHA: Pod_AlphaGUID = go->GetGUID(); break; - case POD_GAMMA: Pod_GammaGUID = go->GetGUID(); break; - case POD_BETA: Pod_BetaGUID = go->GetGUID(); break; - case POD_DELTA: Pod_DeltaGUID = go->GetGUID(); break; - case POD_OMEGA: Pod_OmegaGUID = go->GetGUID(); break; - case SEAL_SPHERE: GoSphereGUID = go->GetGUID(); break; - //case WARDENS_SHIELD: Wardens_ShieldGUID = go->GetGUID(); break; + case CONTAINMENT_CORE_SECURITY_FIELD_ALPHA: + Containment_Core_Security_Field_AlphaGUID = go->GetGUID(); + break; + + case CONTAINMENT_CORE_SECURITY_FIELD_BETA: + Containment_Core_Security_Field_BetaGUID = go->GetGUID(); + break; + + case POD_ALPHA: + Pod_AlphaGUID = go->GetGUID(); + break; + + case POD_GAMMA: + Pod_GammaGUID = go->GetGUID(); + break; + + case POD_BETA: + Pod_BetaGUID = go->GetGUID(); + break; + + case POD_DELTA: + Pod_DeltaGUID = go->GetGUID(); + break; + + case POD_OMEGA: + Pod_OmegaGUID = go->GetGUID(); + break; + + case SEAL_SPHERE: + GoSphereGUID = go->GetGUID(); + break; + + /*case WARDENS_SHIELD: + Wardens_ShieldGUID = go->GetGUID(); + break;*/ } } diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp index ccac73c5dc6..ba61a1bfb12 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp @@ -107,7 +107,7 @@ class boss_high_botanist_freywinn : public CreatureScript DoScriptText(RAND(SAY_KILL_1, SAY_KILL_2), me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); } @@ -195,9 +195,9 @@ class boss_high_botanist_freywinn : public CreatureScript } }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new boss_high_botanist_freywinnAI (Creature); + return new boss_high_botanist_freywinnAI(creature); } }; diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp index 488ddba40cf..e8188f892b3 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp @@ -211,9 +211,9 @@ class boss_laj : public CreatureScript } }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new boss_lajAI (Creature); + return new boss_lajAI(creature); } }; diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp index 7e9960225bb..3acde2455db 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp @@ -118,9 +118,9 @@ class mob_warp_splinter_treant : public CreatureScript DoMeleeAttackIfReady(); } }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new mob_warp_splinter_treantAI (Creature); + return new mob_warp_splinter_treantAI(creature); } }; @@ -169,7 +169,7 @@ class boss_warp_splinter : public CreatureScript DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); } @@ -226,9 +226,9 @@ class boss_warp_splinter : public CreatureScript } }; - CreatureAI* GetAI(Creature* Creature) const + CreatureAI* GetAI(Creature* creature) const { - return new boss_warp_splinterAI (Creature); + return new boss_warp_splinterAI(creature); } }; diff --git a/src/server/scripts/Outland/blades_edge_mountains.cpp b/src/server/scripts/Outland/blades_edge_mountains.cpp index f99851f013e..4ec1d04b6ad 100644 --- a/src/server/scripts/Outland/blades_edge_mountains.cpp +++ b/src/server/scripts/Outland/blades_edge_mountains.cpp @@ -61,7 +61,7 @@ public: struct mobs_bladespire_ogreAI : public ScriptedAI { - mobs_bladespire_ogreAI(Creature* c) : ScriptedAI(c) {} + mobs_bladespire_ogreAI(Creature* creature) : ScriptedAI(creature) {} void Reset() { } @@ -73,7 +73,6 @@ public: DoMeleeAttackIfReady(); } }; - }; /*###### @@ -113,7 +112,7 @@ public: struct mobs_nether_drakeAI : public ScriptedAI { - mobs_nether_drakeAI(Creature* c) : ScriptedAI(c) {} + mobs_nether_drakeAI(Creature* creature) : ScriptedAI(creature) {} bool IsNihil; uint32 NihilSpeech_Timer; @@ -253,7 +252,6 @@ public: DoMeleeAttackIfReady(); } }; - }; /*###### @@ -278,7 +276,7 @@ public: struct npc_daranelleAI : public ScriptedAI { - npc_daranelleAI(Creature* c) : ScriptedAI(c) {} + npc_daranelleAI(Creature* creature) : ScriptedAI(creature) {} void Reset() { } @@ -299,7 +297,6 @@ public: ScriptedAI::MoveInLineOfSight(who); } }; - }; /*###### @@ -313,10 +310,10 @@ class npc_overseer_nuaar : public CreatureScript public: npc_overseer_nuaar() : CreatureScript("npc_overseer_nuaar") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { player->SEND_GOSSIP_MENU(10533, creature->GetGUID()); player->AreaExploredOrEventHappens(10682); @@ -333,7 +330,6 @@ public: return true; } - }; /*###### @@ -348,10 +344,10 @@ class npc_saikkal_the_elder : public CreatureScript public: npc_saikkal_the_elder() : CreatureScript("npc_saikkal_the_elder") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_STE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); @@ -374,7 +370,6 @@ public: return true; } - }; /*###### @@ -423,7 +418,6 @@ public: return true; } - }; /*###### @@ -469,7 +463,6 @@ public: void UpdateAI(const uint32 /*uiDiff*/) {} }; - }; /*###### @@ -499,7 +492,8 @@ public: void MoveInLineOfSight(Unit* who) { - if (!who || (!who->isAlive())) return; + if (!who || (!who->isAlive())) + return; if (me->IsWithinDistInMap(who, 50.0f)) { @@ -523,7 +517,7 @@ public: me->GetMotionMaster()->MoveTargetedHome(); Creature* Credit = me->FindNearestCreature(NPC_QUEST_CREDIT, 50, true); if (player && Credit) - player->KilledMonster(Credit->GetCreatureInfo(), Credit->GetGUID()); + player->KilledMonster(Credit->GetCreatureTemplate(), Credit->GetGUID()); } } @@ -534,7 +528,6 @@ public: DoMeleeAttackIfReady(); } }; - }; /*###### @@ -759,7 +752,7 @@ class npc_simon_bunny : public CreatureScript // Used for getting involved player guid. Parameter id is used for defining if is a large(Monument) or small(Relic) node void SetGUID(uint64 guid, int32 id) { - me->SetFlying(true); + me->SetCanFly(true); large = (bool)id; playerGUID = guid; @@ -781,7 +774,7 @@ class npc_simon_bunny : public CreatureScript colorSequence.clear(); playableSequence.clear(); playerSequence.clear(); - me->SetFloatValue(OBJECT_FIELD_SCALE_X, large ? 2 : 1); + me->SetObjectScale(large ? 2.0f : 1.0f); std::list<WorldObject*> ClusterList; Trinity::AllWorldObjectsInRange objects(me, searchDistance); @@ -797,20 +790,42 @@ class npc_simon_bunny : public CreatureScript { switch (go->GetGOInfo()->displayId) { - case GO_BLUE_CLUSTER_DISPLAY_LARGE: clusterIds[SIMON_BLUE] = go->GetEntry(); break; - case GO_RED_CLUSTER_DISPLAY_LARGE: clusterIds[SIMON_RED] = go->GetEntry(); break; - case GO_GREEN_CLUSTER_DISPLAY_LARGE: clusterIds[SIMON_GREEN] = go->GetEntry(); break; - case GO_YELLOW_CLUSTER_DISPLAY_LARGE: clusterIds[SIMON_YELLOW] = go->GetEntry(); break; + case GO_BLUE_CLUSTER_DISPLAY_LARGE: + clusterIds[SIMON_BLUE] = go->GetEntry(); + break; + + case GO_RED_CLUSTER_DISPLAY_LARGE: + clusterIds[SIMON_RED] = go->GetEntry(); + break; + + case GO_GREEN_CLUSTER_DISPLAY_LARGE: + clusterIds[SIMON_GREEN] = go->GetEntry(); + break; + + case GO_YELLOW_CLUSTER_DISPLAY_LARGE: + clusterIds[SIMON_YELLOW] = go->GetEntry(); + break; } } else { switch (go->GetGOInfo()->displayId) { - case GO_BLUE_CLUSTER_DISPLAY: clusterIds[SIMON_BLUE] = go->GetEntry(); break; - case GO_RED_CLUSTER_DISPLAY: clusterIds[SIMON_RED] = go->GetEntry(); break; - case GO_GREEN_CLUSTER_DISPLAY: clusterIds[SIMON_GREEN] = go->GetEntry(); break; - case GO_YELLOW_CLUSTER_DISPLAY: clusterIds[SIMON_YELLOW] = go->GetEntry(); break; + case GO_BLUE_CLUSTER_DISPLAY: + clusterIds[SIMON_BLUE] = go->GetEntry(); + break; + + case GO_RED_CLUSTER_DISPLAY: + clusterIds[SIMON_RED] = go->GetEntry(); + break; + + case GO_GREEN_CLUSTER_DISPLAY: + clusterIds[SIMON_GREEN] = go->GetEntry(); + break; + + case GO_YELLOW_CLUSTER_DISPLAY: + clusterIds[SIMON_YELLOW] = go->GetEntry(); + break; } } } @@ -840,7 +855,7 @@ class npc_simon_bunny : public CreatureScript if (GameObject* relic = me->FindNearestGameObject(large ? GO_APEXIS_MONUMENT : GO_APEXIS_RELIC, searchDistance)) relic->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - me->ForcedDespawn(1000); + me->DespawnOrUnsummon(1000); } /* diff --git a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp index 2f6e0823da1..a213713ae1a 100644 --- a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp +++ b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp @@ -18,7 +18,7 @@ #include "ScriptPCH.h" -enum Yells +enum Texts { SAY_INTRO = 0, SAY_AGGRO = 1, @@ -31,15 +31,15 @@ enum Yells enum Spells { - SPELL_SHADOWVOLLEY = 32963, + SPELL_SHADOW_VOLLEY = 32963, SPELL_CLEAVE = 31779, SPELL_THUNDERCLAP = 36706, - SPELL_VOIDBOLT = 39329, - SPELL_MARKOFKAZZAK = 32960, - SPELL_MARKOFKAZZAK_DAMAGE = 32961, + SPELL_VOID_BOLT = 39329, + SPELL_MARK_OF_KAZZAK = 32960, SPELL_ENRAGE = 32964, - SPELL_CAPTURESOUL = 32966, - SPELL_TWISTEDREFLECTION = 21063 + SPELL_CAPTURE_SOUL = 32966, + SPELL_TWISTED_REFLECTION = 21063, + SPELL_BERSERK = 32965, }; enum Events @@ -47,10 +47,11 @@ enum Events EVENT_SHADOW_VOLLEY = 1, EVENT_CLEAVE = 2, EVENT_THUNDERCLAP = 3, - EVENT_VOIDBOLT = 4, + EVENT_VOID_BOLT = 4, EVENT_MARK_OF_KAZZAK = 5, EVENT_ENRAGE = 6, - EVENT_TWISTED_REFLECTION = 7 + EVENT_TWISTED_REFLECTION = 7, + EVENT_BERSERK = 8 }; class boss_doomlord_kazzak : public CreatureScript @@ -70,10 +71,11 @@ class boss_doomlord_kazzak : public CreatureScript _events.ScheduleEvent(EVENT_SHADOW_VOLLEY, urand(6000, 10000)); _events.ScheduleEvent(EVENT_CLEAVE, 7000); _events.ScheduleEvent(EVENT_THUNDERCLAP, urand(14000, 18000)); - _events.ScheduleEvent(EVENT_VOIDBOLT, 30000); + _events.ScheduleEvent(EVENT_VOID_BOLT, 30000); _events.ScheduleEvent(EVENT_MARK_OF_KAZZAK, 25000); _events.ScheduleEvent(EVENT_ENRAGE, 60000); _events.ScheduleEvent(EVENT_TWISTED_REFLECTION, 33000); + _events.ScheduleEvent(EVENT_BERSERK, 180000); } void JustRespawned() @@ -92,12 +94,12 @@ class boss_doomlord_kazzak : public CreatureScript if (victim->GetTypeId() != TYPEID_PLAYER) return; - DoCast(me, SPELL_CAPTURESOUL); + DoCast(me, SPELL_CAPTURE_SOUL); Talk(SAY_KILL); } - void JustDied(Unit* /*victim*/) + void JustDied(Unit* /*killer*/) { Talk(SAY_DEATH); } @@ -118,7 +120,7 @@ class boss_doomlord_kazzak : public CreatureScript switch (eventId) { case EVENT_SHADOW_VOLLEY: - DoCastVictim(SPELL_SHADOWVOLLEY); + DoCastVictim(SPELL_SHADOW_VOLLEY); _events.ScheduleEvent(EVENT_SHADOW_VOLLEY, urand(4000, 6000)); break; case EVENT_CLEAVE: @@ -129,13 +131,13 @@ class boss_doomlord_kazzak : public CreatureScript DoCastVictim(SPELL_THUNDERCLAP); _events.ScheduleEvent(EVENT_THUNDERCLAP, urand(10000, 14000)); break; - case EVENT_VOIDBOLT: - DoCastVictim(SPELL_VOIDBOLT); - _events.ScheduleEvent(EVENT_VOIDBOLT, urand(15000, 18000)); + case EVENT_VOID_BOLT: + DoCastVictim(SPELL_VOID_BOLT); + _events.ScheduleEvent(EVENT_VOID_BOLT, urand(15000, 18000)); break; case EVENT_MARK_OF_KAZZAK: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) - DoCast(target, SPELL_MARKOFKAZZAK); + DoCast(target, SPELL_MARK_OF_KAZZAK); _events.ScheduleEvent(EVENT_MARK_OF_KAZZAK, 20000); break; case EVENT_ENRAGE: @@ -145,9 +147,12 @@ class boss_doomlord_kazzak : public CreatureScript break; case EVENT_TWISTED_REFLECTION: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) - DoCast(target, SPELL_TWISTEDREFLECTION); + DoCast(target, SPELL_TWISTED_REFLECTION); _events.ScheduleEvent(EVENT_TWISTED_REFLECTION, 15000); break; + case EVENT_BERSERK: + DoCast(me, SPELL_BERSERK); + break; default: break; } diff --git a/src/server/scripts/Outland/boss_doomwalker.cpp b/src/server/scripts/Outland/boss_doomwalker.cpp index c4bd232cc85..67834601d6f 100644 --- a/src/server/scripts/Outland/boss_doomwalker.cpp +++ b/src/server/scripts/Outland/boss_doomwalker.cpp @@ -18,7 +18,7 @@ #include "ScriptPCH.h" -enum Yells +enum Texts { SAY_AGGRO = 0, SAY_EARTHQUAKE = 1, @@ -79,7 +79,7 @@ class boss_doomwalker : public CreatureScript Talk(SAY_SLAY); } - void JustDied(Unit* /*Killer*/) + void JustDied(Unit* /*killer*/) { Talk(SAY_DEATH); } diff --git a/src/server/scripts/Outland/hellfire_peninsula.cpp b/src/server/scripts/Outland/hellfire_peninsula.cpp index 7d4de409b8b..b0e19f0e322 100644 --- a/src/server/scripts/Outland/hellfire_peninsula.cpp +++ b/src/server/scripts/Outland/hellfire_peninsula.cpp @@ -66,7 +66,7 @@ public: struct npc_aeranasAI : public ScriptedAI { - npc_aeranasAI(Creature* c) : ScriptedAI(c) {} + npc_aeranasAI(Creature* creature) : ScriptedAI(creature) {} uint32 Faction_Timer; uint32 EnvelopingWinds_Timer; @@ -124,7 +124,6 @@ public: DoMeleeAttackIfReady(); } }; - }; /*###### @@ -181,9 +180,9 @@ public: npc_escortAI::MoveInLineOfSight(who); } - void WaypointReached(uint32 uiPointId) + void WaypointReached(uint32 waypointId) { - switch (uiPointId) + switch (waypointId) { case 0: DoScriptText(EMOTE_WOLF_LIFT_HEAD, me); @@ -198,7 +197,6 @@ public: } } }; - }; /*###### @@ -215,7 +213,6 @@ public: go->SummonCreature(C_AERANAS, -1321.79f, 4043.80f, 116.24f, 1.25f, TEMPSUMMON_TIMED_DESPAWN, 180000); return false; } - }; /*###### @@ -234,10 +231,10 @@ class npc_naladu : public CreatureScript public: npc_naladu() : CreatureScript("npc_naladu") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_NALADU1, creature->GetGUID()); return true; @@ -252,7 +249,6 @@ public: player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); return true; } - }; /*###### @@ -274,10 +270,10 @@ class npc_tracy_proudwell : public CreatureScript public: npc_tracy_proudwell() : CreatureScript("npc_tracy_proudwell") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TRACY_PROUDWELL_ITEM2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); @@ -308,7 +304,6 @@ public: player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); return true; } - }; /*###### @@ -331,10 +326,10 @@ class npc_trollbane : public CreatureScript public: npc_trollbane() : CreatureScript("npc_trollbane") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TROLLBANE_ITEM2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); @@ -361,7 +356,6 @@ public: player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); return true; } - }; /*###### @@ -406,40 +400,39 @@ public: struct npc_wounded_blood_elfAI : public npc_escortAI { - npc_wounded_blood_elfAI(Creature* c) : npc_escortAI(c) {} + npc_wounded_blood_elfAI(Creature* creature) : npc_escortAI(creature) {} - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); - if (!player) return; - switch (i) + switch (waypointId) { - case 0: - DoScriptText(SAY_ELF_START, me, player); - break; - case 9: - DoScriptText(SAY_ELF_SUMMON1, me, player); - // Spawn two Haal'eshi Talonguard - DoSpawnCreature(16967, -15, -15, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - DoSpawnCreature(16967, -17, -17, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - break; - case 13: - DoScriptText(SAY_ELF_RESTING, me, player); - break; - case 14: - DoScriptText(SAY_ELF_SUMMON2, me, player); - // Spawn two Haal'eshi Windwalker - DoSpawnCreature(16966, -15, -15, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - DoSpawnCreature(16966, -17, -17, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - break; - case 27: - DoScriptText(SAY_ELF_COMPLETE, me, player); - // Award quest credit - player->GroupEventHappens(QUEST_ROAD_TO_FALCON_WATCH, me); - break; + case 0: + DoScriptText(SAY_ELF_START, me, player); + break; + case 9: + DoScriptText(SAY_ELF_SUMMON1, me, player); + // Spawn two Haal'eshi Talonguard + DoSpawnCreature(16967, -15, -15, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + DoSpawnCreature(16967, -17, -17, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + break; + case 13: + DoScriptText(SAY_ELF_RESTING, me, player); + break; + case 14: + DoScriptText(SAY_ELF_SUMMON2, me, player); + // Spawn two Haal'eshi Windwalker + DoSpawnCreature(16966, -15, -15, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + DoSpawnCreature(16966, -17, -17, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + break; + case 27: + DoScriptText(SAY_ELF_COMPLETE, me, player); + // Award quest credit + player->GroupEventHappens(QUEST_ROAD_TO_FALCON_WATCH, me); + break; } } @@ -456,7 +449,6 @@ public: summoned->AI()->AttackStart(me); } }; - }; /*###### @@ -529,7 +521,6 @@ public: DoMeleeAttackIfReady(); } }; - }; void AddSC_hellfire_peninsula() diff --git a/src/server/scripts/Outland/nagrand.cpp b/src/server/scripts/Outland/nagrand.cpp index 668db2efcbb..871a2f200bb 100644 --- a/src/server/scripts/Outland/nagrand.cpp +++ b/src/server/scripts/Outland/nagrand.cpp @@ -57,10 +57,10 @@ class npc_greatmother_geyah : public CreatureScript public: npc_greatmother_geyah() : CreatureScript("npc_greatmother_geyah") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF + 1: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); @@ -90,7 +90,6 @@ public: player->AreaExploredOrEventHappens(10044); player->CLOSE_GOSSIP_MENU(); break; - case GOSSIP_ACTION_INFO_DEF + 10: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); @@ -135,12 +134,10 @@ public: player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); } else - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); return true; } - }; /*##### @@ -224,9 +221,9 @@ public: DoCast(me, SPELL_EARTHBIND_TOTEM, false); } - void WaypointReached(uint32 uiPointId) + void WaypointReached(uint32 waypointId) { - switch (uiPointId) + switch (waypointId) { case 7: DoScriptText(SAY_MAG_MORE, me); @@ -235,7 +232,6 @@ public: DoScriptText(SAY_MAG_MORE_REPLY, temp); me->SummonCreature(NPC_MURK_PUTRIFIER, m_afAmbushB[0]-2.5f, m_afAmbushB[1]-2.5f, m_afAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(NPC_MURK_SCAVENGER, m_afAmbushB[0]+2.5f, m_afAmbushB[1]+2.5f, m_afAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); me->SummonCreature(NPC_MURK_SCAVENGER, m_afAmbushB[0]+2.5f, m_afAmbushB[1]-2.5f, m_afAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); break; @@ -258,7 +254,7 @@ public: if (summoned->isTotem()) return; - summoned->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + summoned->SetWalk(false); summoned->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); summoned->AI()->AttackStart(me); @@ -311,7 +307,6 @@ public: DoMeleeAttackIfReady(); } }; - }; /*###### @@ -330,7 +325,7 @@ public: struct npc_creditmarker_visit_with_ancestorsAI : public ScriptedAI { - npc_creditmarker_visit_with_ancestorsAI(Creature* c) : ScriptedAI(c) {} + npc_creditmarker_visit_with_ancestorsAI(Creature* creature) : ScriptedAI(creature) {} void Reset() {} @@ -356,7 +351,6 @@ public: } } }; - }; /*###### @@ -401,6 +395,7 @@ public: player->KilledMonsterCredit(NPC_CORKI_CREDIT_1, 0); } } + if (go->GetEntry() == GO_CORKIS_PRISON_2) { if (Creature* corki = go->FindNearestCreature(NPC_CORKI_2, 25, true)) @@ -411,6 +406,7 @@ public: player->KilledMonsterCredit(NPC_CORKI_2, 0); } } + if (go->GetEntry() == GO_CORKIS_PRISON_3) { if (Creature* corki = go->FindNearestCreature(NPC_CORKI_3, 25, true)) @@ -444,18 +440,22 @@ public: void Reset() { + Say_Timer = 5000; ReleasedFromCage = false; } void UpdateAI(uint32 const diff) { - if (Say_Timer <= diff && ReleasedFromCage) + if (ReleasedFromCage) { - me->ForcedDespawn(); - ReleasedFromCage = false; + if (Say_Timer <= diff) + { + me->DespawnOrUnsummon(); + ReleasedFromCage = false; + } + else + Say_Timer -= diff; } - else - Say_Timer -= diff; } void MovementInform(uint32 type, uint32 id) @@ -565,9 +565,9 @@ public: } } - void WaypointReached(uint32 PointId) + void WaypointReached(uint32 waypointId) { - switch(PointId) + switch (waypointId) { case 3: { @@ -603,7 +603,7 @@ public: if (summoned->isTotem()) return; - summoned->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + summoned->SetWalk(false); summoned->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); summoned->AI()->AttackStart(me); } @@ -685,15 +685,11 @@ class go_warmaul_prison : public GameObjectScript if (Creature* prisoner = go->FindNearestCreature(NPC_MAGHAR_PRISONER, 5.0f)) { - if (prisoner) - { - go->UseDoorOrButton(); - if (player) - player->KilledMonsterCredit(NPC_MAGHAR_PRISONER, 0); + go->UseDoorOrButton(); + player->KilledMonsterCredit(NPC_MAGHAR_PRISONER, 0); - prisoner->AI()->Talk(SAY_FREE, player->GetGUID()); - prisoner->ForcedDespawn(6000); - } + prisoner->AI()->Talk(SAY_FREE, player->GetGUID()); + prisoner->DespawnOrUnsummon(6000); } return true; } diff --git a/src/server/scripts/Outland/netherstorm.cpp b/src/server/scripts/Outland/netherstorm.cpp index 79811069402..afc18c71b92 100644 --- a/src/server/scripts/Outland/netherstorm.cpp +++ b/src/server/scripts/Outland/netherstorm.cpp @@ -78,7 +78,7 @@ public: struct npc_manaforge_control_consoleAI : public ScriptedAI { - npc_manaforge_control_consoleAI(Creature* c) : ScriptedAI(c) {} + npc_manaforge_control_consoleAI(Creature* creature) : ScriptedAI(creature) {} uint32 Event_Timer; uint32 Wave_Timer; @@ -115,7 +115,7 @@ public: if (someplayer) { - Unit* p = Unit::GetUnit((*me), someplayer); + Unit* p = Unit::GetUnit(*me, someplayer); if (p && p->GetTypeId() == TYPEID_PLAYER) { switch (me->GetEntry()) @@ -142,7 +142,7 @@ public: if (goConsole) { - if (GameObject* go = GameObject::GetGameObject((*me), goConsole)) + if (GameObject* go = GameObject::GetGameObject(*me, goConsole)) go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); } } @@ -243,7 +243,7 @@ public: case 1: if (someplayer) { - Unit* u = Unit::GetUnit((*me), someplayer); + Unit* u = Unit::GetUnit(*me, someplayer); if (u && u->GetTypeId() == TYPEID_PLAYER) DoScriptText(EMOTE_START, me, u); } Event_Timer = 60000; @@ -271,14 +271,14 @@ public: DoScriptText(EMOTE_COMPLETE, me); if (someplayer) { - Unit* u = Unit::GetUnit((*me), someplayer); + Unit* u = Unit::GetUnit(*me, someplayer); if (u && u->GetTypeId() == TYPEID_PLAYER) CAST_PLR(u)->KilledMonsterCredit(me->GetEntry(), me->GetGUID()); DoCast(me, SPELL_DISABLE_VISUAL); } if (goConsole) { - if (GameObject* go = GameObject::GetGameObject((*me), goConsole)) + if (GameObject* go = GameObject::GetGameObject(*me, goConsole)) go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); } ++Phase; @@ -295,7 +295,6 @@ public: } } }; - }; /*###### @@ -350,7 +349,6 @@ public: } return true; } - }; /*###### @@ -396,7 +394,7 @@ public: struct npc_commander_dawnforgeAI : public ScriptedAI { - npc_commander_dawnforgeAI(Creature* c) : ScriptedAI(c) { Reset (); } + npc_commander_dawnforgeAI(Creature* creature) : ScriptedAI(creature) { Reset(); } uint64 PlayerGUID; uint64 ardonisGUID; @@ -633,7 +631,6 @@ public: } } }; - }; class at_commander_dawnforge : public AreaTriggerScript @@ -650,7 +647,6 @@ public: if (player->isAlive() && player->GetQuestStatus(QUEST_INFO_GATHERING) == QUEST_STATUS_INCOMPLETE) { Creature* Dawnforge = player->FindNearestCreature(CreatureEntry[1], 30.0f); - if (!Dawnforge) return false; @@ -659,7 +655,6 @@ public: } return false; } - }; /*###### @@ -690,10 +685,10 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { creature->CastSpell(player, SPELL_PHASE_DISTRUPTOR, false); player->CLOSE_GOSSIP_MENU(); @@ -714,7 +709,6 @@ public: return true; } - }; /*###### @@ -750,7 +744,7 @@ public: struct mob_phase_hunterAI : public ScriptedAI { - mob_phase_hunterAI(Creature* c) : ScriptedAI(c) {} + mob_phase_hunterAI(Creature* creature) : ScriptedAI(creature) {} bool Weak; bool Materialize; @@ -818,7 +812,7 @@ public: } if (!UnitsWithMana.empty()) { - DoCast(SelectRandomContainerElement(UnitsWithMana), SPELL_MANA_BURN); + DoCast(Trinity::Containers::SelectRandomContainerElement(UnitsWithMana), SPELL_MANA_BURN); ManaBurnTimer = 8000 + (rand() % 10 * 1000); // 8-18 sec cd } else @@ -849,7 +843,6 @@ public: DoMeleeAttackIfReady(); } }; - }; /*###### @@ -888,8 +881,7 @@ public: struct npc_bessyAI : public npc_escortAI { - - npc_bessyAI(Creature* c) : npc_escortAI(c) {} + npc_bessyAI(Creature* creature) : npc_escortAI(creature) {} void JustDied(Unit* /*killer*/) { @@ -897,34 +889,32 @@ public: player->FailQuest(Q_ALMABTRIEB); } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); - if (!player) return; - switch (i) + switch (waypointId) { case 3: //first spawn me->SummonCreature(SPAWN_FIRST, 2449.67f, 2183.11f, 96.85f, 6.20f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); me->SummonCreature(SPAWN_FIRST, 2449.53f, 2184.43f, 96.36f, 6.27f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); me->SummonCreature(SPAWN_FIRST, 2449.85f, 2186.34f, 97.57f, 6.08f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); break; - case 7: me->SummonCreature(SPAWN_SECOND, 2309.64f, 2186.24f, 92.25f, 6.06f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); me->SummonCreature(SPAWN_SECOND, 2309.25f, 2183.46f, 91.75f, 6.22f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); break; - case 12: - if (player) - player->GroupEventHappens(Q_ALMABTRIEB, me); + player->GroupEventHappens(Q_ALMABTRIEB, me); if (me->FindNearestCreature(N_THADELL, 30)) - DoScriptText(SAY_THADELL_1, me); break; + DoScriptText(SAY_THADELL_1, me); + break; case 13: if (me->FindNearestCreature(N_THADELL, 30)) - DoScriptText(SAY_THADELL_2, me, player); break; + DoScriptText(SAY_THADELL_2, me, player); + break; } } @@ -937,9 +927,7 @@ public: { me->RestoreFaction(); } - }; - }; /*###### @@ -975,13 +963,13 @@ public: uiTakeTimer=3000; } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); if (!player) return; - switch (i) + switch (waypointId) { case 7: case 17: @@ -996,16 +984,14 @@ public: } break; case 36: //return and quest_complete - if (player) - player->CompleteQuest(QUEST_MARK_V_IS_ALIVE); + player->CompleteQuest(QUEST_MARK_V_IS_ALIVE); break; } } void JustDied(Unit* /*killer*/) { - Player* player = GetPlayerForEscort(); - if (player) + if (Player* player = GetPlayerForEscort()) player->FailQuest(QUEST_MARK_V_IS_ALIVE); } @@ -1018,12 +1004,12 @@ public: if (uiTakeTimer < uiDiff) { me->HandleEmoteCommand(EMOTE_STATE_NONE); - if (GameObject* pGO = GetClosestGameObjectWithEntry(me, GO_DRAENEI_MACHINE, INTERACTION_DISTANCE)) + if (GameObject* go = GetClosestGameObjectWithEntry(me, GO_DRAENEI_MACHINE, INTERACTION_DISTANCE)) { SetEscortPaused(false); bTake=false; uiTakeTimer = 3000; - pGO->Delete(); + go->Delete(); } } else @@ -1071,7 +1057,7 @@ class go_captain_tyralius_prison : public GameObjectScript player->KilledMonsterCredit(NPC_CAPTAIN_TYRALIUS, 0); tyralius->AI()->Talk(SAY_FREE); - tyralius->ForcedDespawn(8000); + tyralius->DespawnOrUnsummon(8000); } return true; } diff --git a/src/server/scripts/Outland/shadowmoon_valley.cpp b/src/server/scripts/Outland/shadowmoon_valley.cpp index 19c4754c4fd..340049ba4fa 100644 --- a/src/server/scripts/Outland/shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/shadowmoon_valley.cpp @@ -75,7 +75,7 @@ public: struct mob_mature_netherwing_drakeAI : public ScriptedAI { - mob_mature_netherwing_drakeAI(Creature* c) : ScriptedAI(c) { } + mob_mature_netherwing_drakeAI(Creature* creature) : ScriptedAI(creature) { } uint64 uiPlayerGUID; @@ -96,12 +96,12 @@ public: CastTimer = 5000; } - void SpellHit(Unit* pCaster, SpellInfo const* pSpell) + void SpellHit(Unit* pCaster, SpellInfo const* spell) { if (bCanEat || bIsEating) return; - if (pCaster->GetTypeId() == TYPEID_PLAYER && pSpell->Id == SPELL_PLACE_CARCASS && !me->HasAura(SPELL_JUST_EATEN)) + if (pCaster->GetTypeId() == TYPEID_PLAYER && spell->Id == SPELL_PLACE_CARCASS && !me->HasAura(SPELL_JUST_EATEN)) { uiPlayerGUID = pCaster->GetGUID(); bCanEat = true; @@ -179,7 +179,6 @@ public: DoMeleeAttackIfReady(); } }; - }; /*### @@ -207,7 +206,7 @@ public: struct mob_enslaved_netherwing_drakeAI : public ScriptedAI { - mob_enslaved_netherwing_drakeAI(Creature* c) : ScriptedAI(c) + mob_enslaved_netherwing_drakeAI(Creature* creature) : ScriptedAI(creature) { PlayerGUID = 0; Tapped = false; @@ -224,7 +223,7 @@ public: me->setFaction(FACTION_DEFAULT); FlyTimer = 10000; - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetDisableGravity(false); me->SetVisible(true); } @@ -242,7 +241,6 @@ public: DoCast(caster, SPELL_FORCE_OF_NELTHARAKU, true); Unit* Dragonmaw = me->FindNearestCreature(CREATURE_DRAGONMAW_SUBJUGATOR, 50); - if (Dragonmaw) { me->AddThreat(Dragonmaw, 100000.0f); @@ -264,14 +262,14 @@ public: { if (PlayerGUID) { - Unit* player = Unit::GetUnit((*me), PlayerGUID); + Unit* player = Unit::GetUnit(*me, PlayerGUID); if (player) DoCast(player, SPELL_FORCE_OF_NELTHARAKU, true); PlayerGUID = 0; } me->SetVisible(false); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetDisableGravity(false); me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); me->RemoveCorpse(); } @@ -309,7 +307,7 @@ public: pos.m_positionZ += 25; } - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetDisableGravity(true); me->GetMotionMaster()->MovePoint(1, pos); } } @@ -321,7 +319,6 @@ public: DoMeleeAttackIfReady(); } }; - }; /*##### @@ -340,7 +337,7 @@ public: struct mob_dragonmaw_peonAI : public ScriptedAI { - mob_dragonmaw_peonAI(Creature* c) : ScriptedAI(c) {} + mob_dragonmaw_peonAI(Creature* creature) : ScriptedAI(creature) {} uint64 PlayerGUID; bool Tapped; @@ -366,7 +363,7 @@ public: float x, y, z; caster->GetClosePoint(x, y, z, me->GetObjectSize()); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(false); me->GetMotionMaster()->MovePoint(1, x, y, z); } } @@ -401,7 +398,6 @@ public: } } }; - }; /*###### @@ -413,10 +409,10 @@ class npc_drake_dealer_hurlunk : public CreatureScript public: npc_drake_dealer_hurlunk() : CreatureScript("npc_drake_dealer_hurlunk") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_TRADE) + if (action == GOSSIP_ACTION_TRADE) player->GetSession()->SendListInventory(creature->GetGUID()); return true; @@ -431,7 +427,6 @@ public: return true; } - }; /*###### @@ -446,10 +441,10 @@ class npcs_flanis_swiftwing_and_kagrosh : public CreatureScript public: npcs_flanis_swiftwing_and_kagrosh() : CreatureScript("npcs_flanis_swiftwing_and_kagrosh") { } - bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { ItemPosCountVec dest; uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 30658, 1, NULL); @@ -459,7 +454,7 @@ public: player->PlayerTalkClass->ClearMenus(); } } - if (uiAction == GOSSIP_ACTION_INFO_DEF+2) + if (action == GOSSIP_ACTION_INFO_DEF+2) { ItemPosCountVec dest; uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 30659, 1, NULL); @@ -483,7 +478,6 @@ public: return true; } - }; /*###### @@ -504,10 +498,10 @@ class npc_murkblood_overseer : public CreatureScript public: npc_murkblood_overseer() : CreatureScript("npc_murkblood_overseer") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); @@ -552,7 +546,6 @@ public: player->SEND_GOSSIP_MENU(10940, creature->GetGUID()); return true; } - }; /*###### @@ -572,10 +565,10 @@ class npc_oronok_tornheart : public CreatureScript public: npc_oronok_tornheart() : CreatureScript("npc_oronok_tornheart") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_TRADE: player->GetSession()->SendListInventory(creature->GetGUID()); @@ -628,7 +621,6 @@ public: return true; } - }; /*#### @@ -721,7 +713,7 @@ public: struct npc_overlord_morghorAI : public ScriptedAI { - npc_overlord_morghorAI(Creature* c) : ScriptedAI(c) {} + npc_overlord_morghorAI(Creature* creature) : ScriptedAI(creature) {} uint64 PlayerGUID; uint64 IllidanGUID; @@ -766,9 +758,8 @@ public: uint32 NextStep(uint32 Step) { - Unit* player = Unit::GetUnit((*me), PlayerGUID); - - Unit* Illi = Unit::GetUnit((*me), IllidanGUID); + Player* player = Unit::GetPlayer(*me, PlayerGUID); + Unit* Illi = Unit::GetUnit(*me, IllidanGUID); if (!player || !Illi) { @@ -778,95 +769,178 @@ public: switch (Step) { - case 0: return 0; break; - case 1: me->GetMotionMaster()->MovePoint(0, -5104.41f, 595.297f, 85.6838f); return 9000; break; - case 2: DoScriptText(OVERLORD_YELL_1, me, player); return 4500; break; - case 3: me->SetInFront(player); return 3200; break; - case 4: DoScriptText(OVERLORD_SAY_2, me, player); return 2000; break; - case 5: Illi->SetVisible(true); - Illi->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); return 350; break; - case 6: - Illi->CastSpell(Illi, SPELL_ONE, true); - Illi->SetTarget(me->GetGUID()); - me->SetTarget(IllidanGUID); - return 2000; break; - case 7: DoScriptText(OVERLORD_YELL_2, me); return 4500; break; - case 8: me->SetUInt32Value(UNIT_FIELD_BYTES_1, 8); return 2500; break; - case 9: DoScriptText(OVERLORD_SAY_3, me); return 6500; break; - case 10: DoScriptText(LORD_ILLIDAN_SAY_1, Illi); return 5000; break; - case 11: DoScriptText(OVERLORD_SAY_4, me, player); return 6000; break; - case 12: DoScriptText(LORD_ILLIDAN_SAY_2, Illi); return 5500; break; - case 13: DoScriptText(LORD_ILLIDAN_SAY_3, Illi); return 4000; break; - case 14: Illi->SetTarget(PlayerGUID); return 1500; break; - case 15: DoScriptText(LORD_ILLIDAN_SAY_4, Illi); return 1500; break; - case 16: - if (player) - { - Illi->CastSpell(player, SPELL_TWO, true); - player->RemoveAurasDueToSpell(SPELL_THREE); - player->RemoveAurasDueToSpell(SPELL_FOUR); + case 0: + return 0; + break; + case 1: + me->GetMotionMaster()->MovePoint(0, -5104.41f, 595.297f, 85.6838f); + return 9000; + break; + case 2: + DoScriptText(OVERLORD_YELL_1, me, player); + return 4500; + break; + case 3: + me->SetInFront(player); + return 3200; + break; + case 4: + DoScriptText(OVERLORD_SAY_2, me, player); + return 2000; + break; + case 5: + Illi->SetVisible(true); + Illi->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + return 350; + break; + case 6: + Illi->CastSpell(Illi, SPELL_ONE, true); + Illi->SetTarget(me->GetGUID()); + me->SetTarget(IllidanGUID); + return 2000; + break; + case 7: + DoScriptText(OVERLORD_YELL_2, me); + return 4500; + break; + case 8: + me->SetUInt32Value(UNIT_FIELD_BYTES_1, 8); + return 2500; + break; + case 9: + DoScriptText(OVERLORD_SAY_3, me); + return 6500; + break; + case 10: + DoScriptText(LORD_ILLIDAN_SAY_1, Illi); return 5000; - }else{ - CAST_PLR(player)->FailQuest(QUEST_LORD_ILLIDAN_STORMRAGE); Step = 30; return 100; - } - break; - case 17: DoScriptText(LORD_ILLIDAN_SAY_5, Illi); return 5000; break; - case 18: DoScriptText(LORD_ILLIDAN_SAY_6, Illi); return 5000; break; - case 19: DoScriptText(LORD_ILLIDAN_SAY_7, Illi); return 5000; break; - case 20: - Illi->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - Illi->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - return 500; break; - case 21: DoScriptText(OVERLORD_SAY_5, me); return 500; break; - case 22: - Illi->SetVisible(false); - Illi->setDeathState(JUST_DIED); - return 1000; break; - case 23: me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); return 2000; break; - case 24: me->SetTarget(PlayerGUID); return 5000; break; - case 25: DoScriptText(OVERLORD_SAY_6, me); return 2000; break; - case 26: - if (player) - CAST_PLR(player)->GroupEventHappens(QUEST_LORD_ILLIDAN_STORMRAGE, me); - return 6000; break; - case 27: - { - Unit* Yarzill = me->FindNearestCreature(C_YARZILL, 50); - if (Yarzill) - Yarzill->SetTarget(PlayerGUID); - return 500; } - break; - case 28: - player->RemoveAurasDueToSpell(SPELL_TWO); - player->RemoveAurasDueToSpell(41519); - player->CastSpell(player, SPELL_THREE, true); - player->CastSpell(player, SPELL_FOUR, true); - return 1000; break; - case 29: - { - Unit* Yarzill = me->FindNearestCreature(C_YARZILL, 50); - if (Yarzill) - DoScriptText(YARZILL_THE_MERC_SAY, Yarzill, player); - return 5000; } - break; - case 30: - { - Unit* Yarzill = me->FindNearestCreature(C_YARZILL, 50); - if (Yarzill) - Yarzill->SetTarget(0); - return 5000; } - break; - case 31: - { - Unit* Yarzill = me->FindNearestCreature(C_YARZILL, 50); - if (Yarzill) - Yarzill->CastSpell(player, 41540, true); - return 1000;} - break; - case 32: me->GetMotionMaster()->MovePoint(0, -5085.77f, 577.231f, 86.6719f); return 5000; break; - case 33: Reset(); return 100; break; - - default : return 0; + break; + case 11: + DoScriptText(OVERLORD_SAY_4, me, player); + return 6000; + break; + case 12: + DoScriptText(LORD_ILLIDAN_SAY_2, Illi); + return 5500; + break; + case 13: + DoScriptText(LORD_ILLIDAN_SAY_3, Illi); + return 4000; + break; + case 14: + Illi->SetTarget(PlayerGUID); + return 1500; + break; + case 15: + DoScriptText(LORD_ILLIDAN_SAY_4, Illi); + return 1500; + break; + case 16: + if (player) + { + Illi->CastSpell(player, SPELL_TWO, true); + player->RemoveAurasDueToSpell(SPELL_THREE); + player->RemoveAurasDueToSpell(SPELL_FOUR); + return 5000; + } + else + { + player->FailQuest(QUEST_LORD_ILLIDAN_STORMRAGE); + Step = 30; + return 100; + } + break; + case 17: + DoScriptText(LORD_ILLIDAN_SAY_5, Illi); + return 5000; + break; + case 18: + DoScriptText(LORD_ILLIDAN_SAY_6, Illi); + return 5000; + break; + case 19: + DoScriptText(LORD_ILLIDAN_SAY_7, Illi); + return 5000; + break; + case 20: + Illi->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); + Illi->SetDisableGravity(true); + return 500; + break; + case 21: + DoScriptText(OVERLORD_SAY_5, me); + return 500; + break; + case 22: + Illi->SetVisible(false); + Illi->setDeathState(JUST_DIED); + return 1000; + break; + case 23: + me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); + return 2000; + break; + case 24: + me->SetTarget(PlayerGUID); + return 5000; + break; + case 25: + DoScriptText(OVERLORD_SAY_6, me); + return 2000; + break; + case 26: + player->GroupEventHappens(QUEST_LORD_ILLIDAN_STORMRAGE, me); + return 6000; + break; + case 27: + { + Unit* Yarzill = me->FindNearestCreature(C_YARZILL, 50); + if (Yarzill) + Yarzill->SetTarget(PlayerGUID); + return 500; + } + break; + case 28: + player->RemoveAurasDueToSpell(SPELL_TWO); + player->RemoveAurasDueToSpell(41519); + player->CastSpell(player, SPELL_THREE, true); + player->CastSpell(player, SPELL_FOUR, true); + return 1000; + break; + case 29: + { + Unit* Yarzill = me->FindNearestCreature(C_YARZILL, 50); + if (Yarzill) + DoScriptText(YARZILL_THE_MERC_SAY, Yarzill, player); + return 5000; + } + break; + case 30: + { + Unit* Yarzill = me->FindNearestCreature(C_YARZILL, 50); + if (Yarzill) + Yarzill->SetTarget(0); + return 5000; + } + break; + case 31: + { + Unit* Yarzill = me->FindNearestCreature(C_YARZILL, 50); + if (Yarzill) + Yarzill->CastSpell(player, 41540, true); + return 1000; + } + break; + case 32: + me->GetMotionMaster()->MovePoint(0, -5085.77f, 577.231f, 86.6719f); return 5000; + break; + case 33: + Reset(); + return 100; + break; + default : + return 0; + break; } } @@ -878,13 +952,10 @@ public: if (ConversationTimer <= diff) { if (Event && IllidanGUID && PlayerGUID) - { ConversationTimer = NextStep(++Step); - } } else ConversationTimer -= diff; } }; - }; /*#### @@ -948,14 +1019,13 @@ public: m_uiHealingTimer = 0; } - void WaypointReached(uint32 uiPointId) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); - if (!player) return; - switch (uiPointId) + switch (waypointId) { case 13: DoScriptText(SAY_WIL_PROGRESS1, me, player); @@ -1002,7 +1072,6 @@ public: break; case 50: DoScriptText(SAY_WIL_END, me, player); - player->GroupEventHappens(QUEST_ESCAPE_COILSCAR, me); break; } @@ -1061,7 +1130,6 @@ public: } } }; - }; /*##### @@ -1176,7 +1244,7 @@ public: struct mob_torloth_the_magnificentAI : public ScriptedAI { - mob_torloth_the_magnificentAI(Creature* c) : ScriptedAI(c) {} + mob_torloth_the_magnificentAI(Creature* creature) : ScriptedAI(creature) {} uint32 AnimationTimer, SpellTimer1, SpellTimer2, SpellTimer3; @@ -1265,7 +1333,6 @@ public: me->CombatStop(); } else if (!Timers) { - SpellTimer1 = SpawnCast[6].Timer1; SpellTimer2 = SpawnCast[7].Timer1; SpellTimer3 = SpawnCast[8].Timer1; @@ -1296,32 +1363,29 @@ public: DoMeleeAttackIfReady(); } - void JustDied(Unit* slayer) + void JustDied(Unit* killer) { - if (slayer) - switch (slayer->GetTypeId()) - { - case TYPEID_UNIT: - if (Unit* owner = slayer->GetOwner()) - if (owner->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(owner)->GroupEventHappens(QUEST_BATTLE_OF_THE_CRIMSON_WATCH, me); - break; - - case TYPEID_PLAYER: - CAST_PLR(slayer)->GroupEventHappens(QUEST_BATTLE_OF_THE_CRIMSON_WATCH, me); - break; - default: - break; - } + switch (killer->GetTypeId()) + { + case TYPEID_UNIT: + if (Unit* owner = killer->GetOwner()) + if (owner->GetTypeId() == TYPEID_PLAYER) + CAST_PLR(owner)->GroupEventHappens(QUEST_BATTLE_OF_THE_CRIMSON_WATCH, me); + break; + case TYPEID_PLAYER: + CAST_PLR(killer)->GroupEventHappens(QUEST_BATTLE_OF_THE_CRIMSON_WATCH, me); + break; + default: + break; + } if (Creature* LordIllidan = (Unit::GetCreature(*me, LordIllidanGUID))) { - DoScriptText(END_TEXT, LordIllidan, slayer); + DoScriptText(END_TEXT, LordIllidan, killer); LordIllidan->AI()->EnterEvadeMode(); } } }; - }; /*##### @@ -1340,7 +1404,7 @@ public: struct npc_lord_illidan_stormrageAI : public ScriptedAI { - npc_lord_illidan_stormrageAI(Creature* c) : ScriptedAI(c) {} + npc_lord_illidan_stormrageAI(Creature* creature) : ScriptedAI(creature) {} uint64 PlayerGUID; @@ -1467,7 +1531,6 @@ public: EnterEvadeMode(); } }; - }; /*###### @@ -1486,7 +1549,7 @@ public: struct mob_illidari_spawnAI : public ScriptedAI { - mob_illidari_spawnAI(Creature* c) : ScriptedAI(c) {} + mob_illidari_spawnAI(Creature* creature) : ScriptedAI(creature) {} uint64 LordIllidanGUID; uint32 SpellTimer1, SpellTimer2, SpellTimer3; @@ -1499,7 +1562,8 @@ public: } void EnterCombat(Unit* /*who*/) {} - void JustDied(Unit* /*slayer*/) + + void JustDied(Unit* /*killer*/) { me->RemoveCorpse(); if (Creature* LordIllidan = (Unit::GetCreature(*me, LordIllidanGUID))) @@ -1586,7 +1650,6 @@ public: DoMeleeAttackIfReady(); } }; - }; void npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::SummonNextWave() @@ -1680,7 +1743,6 @@ public: } return true; } - }; /*#### @@ -1739,9 +1801,9 @@ public: struct npc_enraged_spiritAI : public ScriptedAI { - npc_enraged_spiritAI(Creature* c) : ScriptedAI(c) {} + npc_enraged_spiritAI(Creature* creature) : ScriptedAI(creature) {} - void Reset() { } + void Reset() { } void EnterCombat(Unit* /*who*/){} @@ -1753,7 +1815,8 @@ public: uint32 entry = 0; uint32 credit = 0; - switch (me->GetEntry()) { + switch (me->GetEntry()) + { case ENTRY_ENRAGED_FIRE_SPIRIT: entry = ENTRY_FIERY_SOUL; //credit = SPELL_FIERY_SOUL_CAPTURED_CREDIT; @@ -1801,7 +1864,6 @@ public: } } }; - }; /*##### diff --git a/src/server/scripts/Outland/shattrath_city.cpp b/src/server/scripts/Outland/shattrath_city.cpp index ed68f55aeb5..79cce47e16c 100644 --- a/src/server/scripts/Outland/shattrath_city.cpp +++ b/src/server/scripts/Outland/shattrath_city.cpp @@ -55,10 +55,10 @@ class npc_raliq_the_drunk : public CreatureScript public: npc_raliq_the_drunk() : CreatureScript("npc_raliq_the_drunk") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { player->CLOSE_GOSSIP_MENU(); creature->setFaction(FACTION_HOSTILE_RD); @@ -83,9 +83,9 @@ public: struct npc_raliq_the_drunkAI : public ScriptedAI { - npc_raliq_the_drunkAI(Creature* c) : ScriptedAI(c) + npc_raliq_the_drunkAI(Creature* creature) : ScriptedAI(creature) { - m_uiNormFaction = c->getFaction(); + m_uiNormFaction = creature->getFaction(); } uint32 m_uiNormFaction; @@ -111,7 +111,6 @@ public: DoMeleeAttackIfReady(); } }; - }; /*###### @@ -152,7 +151,7 @@ public: struct npc_salsalabimAI : public ScriptedAI { - npc_salsalabimAI(Creature* c) : ScriptedAI(c) {} + npc_salsalabimAI(Creature* creature) : ScriptedAI(creature) {} uint32 MagneticPull_Timer; @@ -187,12 +186,11 @@ public: DoMeleeAttackIfReady(); } }; - }; /* ################################################## -Shattrath City Flask Vendors provides flasks to people exalted with 3 factions: +Shattrath City Flask Vendors provides flasks to people exalted with 3 fActions: Haldor the Compulsive Arcanist Xorith Both sell special flasks for use in Outlands 25man raids only, @@ -206,10 +204,10 @@ class npc_shattrathflaskvendors : public CreatureScript public: npc_shattrathflaskvendors() : CreatureScript("npc_shattrathflaskvendors") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_TRADE) + if (action == GOSSIP_ACTION_TRADE) player->GetSession()->SendListInventory(creature->GetGUID()); return true; @@ -247,7 +245,6 @@ public: return true; } - }; /*###### @@ -261,10 +258,10 @@ class npc_zephyr : public CreatureScript public: npc_zephyr() : CreatureScript("npc_zephyr") { } - bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) player->CastSpell(player, 37778, false); return true; @@ -279,7 +276,6 @@ public: return true; } - }; /*###### @@ -321,41 +317,82 @@ public: struct npc_kservantAI : public npc_escortAI { public: - npc_kservantAI(Creature* c) : npc_escortAI(c) {} + npc_kservantAI(Creature* creature) : npc_escortAI(creature) {} - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); - if (!player) return; - switch (i) + switch (waypointId) { - case 0: DoScriptText(SAY1, me, player); break; - case 4: DoScriptText(WHISP1, me, player); break; - case 6: DoScriptText(WHISP2, me, player); break; - case 7: DoScriptText(WHISP3, me, player); break; - case 8: DoScriptText(WHISP4, me, player); break; - case 17: DoScriptText(WHISP5, me, player); break; - case 18: DoScriptText(WHISP6, me, player); break; - case 19: DoScriptText(WHISP7, me, player); break; - case 33: DoScriptText(WHISP8, me, player); break; - case 34: DoScriptText(WHISP9, me, player); break; - case 35: DoScriptText(WHISP10, me, player); break; - case 36: DoScriptText(WHISP11, me, player); break; - case 43: DoScriptText(WHISP12, me, player); break; - case 44: DoScriptText(WHISP13, me, player); break; - case 49: DoScriptText(WHISP14, me, player); break; - case 50: DoScriptText(WHISP15, me, player); break; - case 51: DoScriptText(WHISP16, me, player); break; - case 52: DoScriptText(WHISP17, me, player); break; - case 53: DoScriptText(WHISP18, me, player); break; - case 54: DoScriptText(WHISP19, me, player); break; - case 55: DoScriptText(WHISP20, me, player); break; - case 56: DoScriptText(WHISP21, me, player); - if (player) - player->GroupEventHappens(10211, me); + case 0: + DoScriptText(SAY1, me, player); + break; + case 4: + DoScriptText(WHISP1, me, player); + break; + case 6: + DoScriptText(WHISP2, me, player); + break; + case 7: + DoScriptText(WHISP3, me, player); + break; + case 8: + DoScriptText(WHISP4, me, player); + break; + case 17: + DoScriptText(WHISP5, me, player); + break; + case 18: + DoScriptText(WHISP6, me, player); + break; + case 19: + DoScriptText(WHISP7, me, player); + break; + case 33: + DoScriptText(WHISP8, me, player); + break; + case 34: + DoScriptText(WHISP9, me, player); + break; + case 35: + DoScriptText(WHISP10, me, player); + break; + case 36: + DoScriptText(WHISP11, me, player); + break; + case 43: + DoScriptText(WHISP12, me, player); + break; + case 44: + DoScriptText(WHISP13, me, player); + break; + case 49: + DoScriptText(WHISP14, me, player); + break; + case 50: + DoScriptText(WHISP15, me, player); + break; + case 51: + DoScriptText(WHISP16, me, player); + break; + case 52: + DoScriptText(WHISP17, me, player); + break; + case 53: + DoScriptText(WHISP18, me, player); + break; + case 54: + DoScriptText(WHISP19, me, player); + break; + case 55: + DoScriptText(WHISP20, me, player); + break; + case 56: + DoScriptText(WHISP21, me, player); + player->GroupEventHappens(10211, me); break; } } @@ -406,7 +443,7 @@ public: struct npc_dirty_larryAI : public ScriptedAI { - npc_dirty_larryAI(Creature* c) : ScriptedAI(c) {} + npc_dirty_larryAI(Creature* creature) : ScriptedAI(creature) {} bool Event; bool Attack; @@ -543,10 +580,10 @@ public: } }; - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { CAST_AI(npc_dirty_larry::npc_dirty_larryAI, creature->AI())->Event = true; CAST_AI(npc_dirty_larry::npc_dirty_larryAI, creature->AI())->PlayerGUID = player->GetGUID(); @@ -572,7 +609,6 @@ public: { return new npc_dirty_larryAI (creature); } - }; /*###### @@ -587,12 +623,12 @@ class npc_ishanah : public CreatureScript public: npc_ishanah() : CreatureScript("npc_ishanah") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) player->SEND_GOSSIP_MENU(9458, creature->GetGUID()); - else if (uiAction == GOSSIP_ACTION_INFO_DEF+2) + else if (action == GOSSIP_ACTION_INFO_DEF+2) player->SEND_GOSSIP_MENU(9459, creature->GetGUID()); return true; @@ -610,7 +646,6 @@ public: return true; } - }; /*###### @@ -629,10 +664,10 @@ class npc_khadgar : public CreatureScript public: npc_khadgar() : CreatureScript("npc_khadgar") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, KHADGAR_GOSSIP_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); @@ -678,7 +713,6 @@ public: return true; } - }; void AddSC_shattrath_city() diff --git a/src/server/scripts/Outland/terokkar_forest.cpp b/src/server/scripts/Outland/terokkar_forest.cpp index 043b74b6924..6c2214cde37 100644 --- a/src/server/scripts/Outland/terokkar_forest.cpp +++ b/src/server/scripts/Outland/terokkar_forest.cpp @@ -62,7 +62,7 @@ public: struct mob_unkor_the_ruthlessAI : public ScriptedAI { - mob_unkor_the_ruthlessAI(Creature* c) : ScriptedAI(c) {} + mob_unkor_the_ruthlessAI(Creature* creature) : ScriptedAI(creature) {} bool CanDoQuest; uint32 UnkorUnfriendly_Timer; @@ -99,12 +99,12 @@ public: { for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { - Player* pGroupie = itr->getSource(); - if (pGroupie && - pGroupie->GetQuestStatus(QUEST_DONTKILLTHEFATONE) == QUEST_STATUS_INCOMPLETE && - pGroupie->GetReqKillOrCastCurrentCount(QUEST_DONTKILLTHEFATONE, 18260) == 10) + Player* groupie = itr->getSource(); + if (groupie && + groupie->GetQuestStatus(QUEST_DONTKILLTHEFATONE) == QUEST_STATUS_INCOMPLETE && + groupie->GetReqKillOrCastCurrentCount(QUEST_DONTKILLTHEFATONE, 18260) == 10) { - pGroupie->AreaExploredOrEventHappens(QUEST_DONTKILLTHEFATONE); + groupie->AreaExploredOrEventHappens(QUEST_DONTKILLTHEFATONE); if (!CanDoQuest) CanDoQuest = true; } @@ -150,7 +150,6 @@ public: DoMeleeAttackIfReady(); } }; - }; /*###### @@ -169,7 +168,7 @@ public: struct mob_infested_root_walkerAI : public ScriptedAI { - mob_infested_root_walkerAI(Creature* c) : ScriptedAI(c) {} + mob_infested_root_walkerAI(Creature* creature) : ScriptedAI(creature) {} void Reset() { } void EnterCombat(Unit* /*who*/) { } @@ -183,7 +182,6 @@ public: DoCast(me, 39130, true); } }; - }; /*###### @@ -202,15 +200,15 @@ public: struct npc_skywingAI : public npc_escortAI { public: - npc_skywingAI(Creature* c) : npc_escortAI(c) {} + npc_skywingAI(Creature* creature) : npc_escortAI(creature) {} - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); if (!player) return; - switch (i) + switch (waypointId) { case 8: player->AreaExploredOrEventHappens(10898); @@ -245,7 +243,6 @@ public: npc_escortAI::UpdateAI(diff); } }; - }; /*###### @@ -264,7 +261,7 @@ public: struct mob_rotting_forest_ragerAI : public ScriptedAI { - mob_rotting_forest_ragerAI(Creature* c) : ScriptedAI(c) {} + mob_rotting_forest_ragerAI(Creature* creature) : ScriptedAI(creature) {} void Reset() { } void EnterCombat(Unit* /*who*/) { } @@ -278,7 +275,6 @@ public: DoCast(me, 39134, true); } }; - }; /*###### @@ -304,34 +300,35 @@ public: struct mob_netherweb_victimAI : public ScriptedAI { - mob_netherweb_victimAI(Creature* c) : ScriptedAI(c) {} + mob_netherweb_victimAI(Creature* creature) : ScriptedAI(creature) {} void Reset() { } void EnterCombat(Unit* /*who*/) { } void MoveInLineOfSight(Unit* /*who*/) { } - void JustDied(Unit* Killer) + void JustDied(Unit* killer) { - if (Killer->GetTypeId() == TYPEID_PLAYER) + Player* player = killer->ToPlayer(); + if (!player) + return; + + if (player->GetQuestStatus(10873) == QUEST_STATUS_INCOMPLETE) { - if (CAST_PLR(Killer)->GetQuestStatus(10873) == QUEST_STATUS_INCOMPLETE) + if (rand()%100 < 25) { - if (rand()%100 < 25) - { - me->SummonCreature(QUEST_TARGET, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); - CAST_PLR(Killer)->KilledMonsterCredit(QUEST_TARGET, 0); - } - else - me->SummonCreature(netherwebVictims[rand()%6], 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + me->SummonCreature(QUEST_TARGET, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + player->KilledMonsterCredit(QUEST_TARGET, 0); + } + else + me->SummonCreature(netherwebVictims[rand()%6], 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); - if (rand()%100 < 75) - me->SummonCreature(netherwebVictims[rand()%6], 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + if (rand()%100 < 75) me->SummonCreature(netherwebVictims[rand()%6], 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); - } + + me->SummonCreature(netherwebVictims[rand()%6], 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); } } }; - }; /*###### @@ -358,15 +355,15 @@ class npc_floon : public CreatureScript public: npc_floon() : CreatureScript("npc_floon") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF) + if (action == GOSSIP_ACTION_INFO_DEF) { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_FLOON2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(9443, creature->GetGUID()); } - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { player->CLOSE_GOSSIP_MENU(); creature->setFaction(FACTION_HOSTILE_FL); @@ -392,9 +389,9 @@ public: struct npc_floonAI : public ScriptedAI { - npc_floonAI(Creature* c) : ScriptedAI(c) + npc_floonAI(Creature* creature) : ScriptedAI(creature) { - m_uiNormFaction = c->getFaction(); + m_uiNormFaction = creature->getFaction(); } uint32 m_uiNormFaction; @@ -439,7 +436,6 @@ public: DoMeleeAttackIfReady(); } }; - }; /*###### @@ -465,39 +461,44 @@ public: struct npc_isla_starmaneAI : public npc_escortAI { - npc_isla_starmaneAI(Creature* c) : npc_escortAI(c) {} + npc_isla_starmaneAI(Creature* creature) : npc_escortAI(creature) {} - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); - if (!player) return; - switch (i) + switch (waypointId) { - case 0: - { - GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 10); - if (Cage) - Cage->SetGoState(GO_STATE_ACTIVE); - } - break; - case 2: DoScriptText(SAY_PROGRESS_1, me, player); break; - case 5: DoScriptText(SAY_PROGRESS_2, me, player); break; - case 6: DoScriptText(SAY_PROGRESS_3, me, player); break; - case 29:DoScriptText(SAY_PROGRESS_4, me, player); - if (player) - { + case 0: + if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 10)) + Cage->SetGoState(GO_STATE_ACTIVE); + break; + case 2: + DoScriptText(SAY_PROGRESS_1, me, player); + break; + case 5: + DoScriptText(SAY_PROGRESS_2, me, player); + break; + case 6: + DoScriptText(SAY_PROGRESS_3, me, player); + break; + case 29: + DoScriptText(SAY_PROGRESS_4, me, player); if (player->GetTeam() == ALLIANCE) player->GroupEventHappens(QUEST_EFTW_A, me); else if (player->GetTeam() == HORDE) player->GroupEventHappens(QUEST_EFTW_H, me); - } - me->SetInFront(player); break; - case 30: me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); break; - case 31: DoCast(me, SPELL_CAT); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); break; + me->SetInFront(player); + break; + case 30: + me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); + break; + case 31: + DoCast(me, SPELL_CAT); + me->SetWalk(false); + break; } } @@ -532,7 +533,6 @@ public: { return new npc_isla_starmaneAI(creature); } - }; /*###### @@ -548,12 +548,12 @@ class go_skull_pile : public GameObjectScript public: go_skull_pile() : GameObjectScript("go_skull_pile") { } - bool OnGossipSelect(Player* player, GameObject* go, uint32 uiSender, uint32 uiAction) + bool OnGossipSelect(Player* player, GameObject* go, uint32 sender, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiSender) + switch (sender) { - case GOSSIP_SENDER_MAIN: SendActionMenu(player, go, uiAction); break; + case GOSSIP_SENDER_MAIN: SendActionMenu(player, go, action); break; } return true; } @@ -572,9 +572,9 @@ public: return true; } - void SendActionMenu(Player* player, GameObject* /*go*/, uint32 uiAction) + void SendActionMenu(Player* player, GameObject* /*go*/, uint32 action) { - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF + 1: player->CastSpell(player, 40642, false); @@ -606,10 +606,10 @@ class npc_slim : public CreatureScript public: npc_slim() : CreatureScript("npc_slim") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_TRADE) + if (action == GOSSIP_ACTION_TRADE) player->GetSession()->SendListInventory(creature->GetGUID()); return true; @@ -627,7 +627,6 @@ public: return true; } - }; /*######## @@ -667,23 +666,22 @@ public: struct npc_akunoAI : public npc_escortAI { - npc_akunoAI(Creature* c) : npc_escortAI(c) {} + npc_akunoAI(Creature* creature) : npc_escortAI(creature) {} - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); - if (!player) return; - switch (i) + switch (waypointId) { case 3: me->SummonCreature(NPC_CABAL_SKRIMISHER, -2795.99f, 5420.33f, -34.53f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); me->SummonCreature(NPC_CABAL_SKRIMISHER, -2793.55f, 5412.79f, -34.53f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); break; case 11: - if (player && player->GetTypeId() == TYPEID_PLAYER) + if (player->GetTypeId() == TYPEID_PLAYER) player->GroupEventHappens(QUEST_ESCAPING_THE_TOMB, me); break; } @@ -694,7 +692,6 @@ public: summon->AI()->AttackStart(me); } }; - }; void AddSC_terokkar_forest() diff --git a/src/server/scripts/Outland/zangarmarsh.cpp b/src/server/scripts/Outland/zangarmarsh.cpp index fc7a3f4d667..90ce070ecc7 100644 --- a/src/server/scripts/Outland/zangarmarsh.cpp +++ b/src/server/scripts/Outland/zangarmarsh.cpp @@ -56,6 +56,7 @@ public: { if (creature->GetEntry() == 17900) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BLESS_ASH, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + if (creature->GetEntry() == 17901) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BLESS_KEL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); } @@ -64,10 +65,10 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF+1) { creature->setPowerType(POWER_MANA); creature->SetMaxPower(POWER_MANA, 200); //set a "fake" mana value, we can't depend on database doing it in this case @@ -149,9 +150,9 @@ public: struct npc_cooshcooshAI : public ScriptedAI { - npc_cooshcooshAI(Creature* c) : ScriptedAI(c) + npc_cooshcooshAI(Creature* creature) : ScriptedAI(creature) { - m_uiNormFaction = c->getFaction(); + m_uiNormFaction = creature->getFaction(); } uint32 m_uiNormFaction; @@ -195,10 +196,10 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF) + if (action == GOSSIP_ACTION_INFO_DEF) { player->CLOSE_GOSSIP_MENU(); creature->setFaction(FACTION_HOSTILE_CO); @@ -231,10 +232,10 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KUR2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -284,10 +285,10 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_TRADE) + if (action == GOSSIP_ACTION_TRADE) player->GetSession()->SendListInventory(creature->GetGUID()); return true; } @@ -317,18 +318,17 @@ public: struct npc_kayra_longmaneAI : public npc_escortAI { - npc_kayra_longmaneAI(Creature* c) : npc_escortAI(c) {} + npc_kayra_longmaneAI(Creature* creature) : npc_escortAI(creature) {} void Reset() { } - void WaypointReached(uint32 i) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); - if (!player) return; - switch (i) + switch (waypointId) { case 4: DoScriptText(SAY_AMBUSH1, me, player); @@ -404,10 +404,10 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF+1: player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_TIMOTHY_DANIELS1, creature->GetGUID()); diff --git a/src/server/scripts/Spells/CMakeLists.txt b/src/server/scripts/Spells/CMakeLists.txt index 496324e4de9..04dcee9287c 100644 --- a/src/server/scripts/Spells/CMakeLists.txt +++ b/src/server/scripts/Spells/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/> +# Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> # # This file is free software; as a special exception the author gives # unlimited permission to copy and/or distribute it, with or without diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index eb42b377128..36dcb53ad00 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -337,11 +337,11 @@ class spell_dk_death_pact : public SpellScriptLoader void FilterTargets(std::list<Unit*>& unitList) { Unit* unit_to_add = NULL; - for (std::list<Unit*>::iterator itr = unitList.begin() ; itr != unitList.end(); ++itr) + for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr) { if ((*itr)->GetTypeId() == TYPEID_UNIT && (*itr)->GetOwnerGUID() == GetCaster()->GetGUID() - && (*itr)->ToCreature()->GetCreatureInfo()->type == CREATURE_TYPE_UNDEAD) + && (*itr)->ToCreature()->GetCreatureTemplate()->type == CREATURE_TYPE_UNDEAD) { unit_to_add = (*itr); break; @@ -642,9 +642,7 @@ public: void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Unit* target = GetTarget(); - if (target->HasAura(DK_SPELL_UNHOLY_PRESENCE)) - target->RemoveAura(DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED); + GetTarget()->RemoveAura(DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED); } void Register() @@ -713,6 +711,7 @@ enum DeathCoil { SPELL_DEATH_COIL_DAMAGE = 47632, SPELL_DEATH_COIL_HEAL = 47633, + SPELL_SIGIL_VENGEFUL_HEART = 64962, }; class spell_dk_death_coil : public SpellScriptLoader @@ -743,12 +742,34 @@ class spell_dk_death_coil : public SpellScriptLoader caster->CastCustomSpell(target, SPELL_DEATH_COIL_HEAL, &bp, NULL, NULL, true); } else + { + if (AuraEffect const* auraEffect = caster->GetAuraEffect(SPELL_SIGIL_VENGEFUL_HEART, EFFECT_1)) + damage += auraEffect->GetBaseAmount(); caster->CastCustomSpell(target, SPELL_DEATH_COIL_DAMAGE, &damage, NULL, NULL, true); + } } } + SpellCastResult CheckCast() + { + Unit* caster = GetCaster(); + if (Unit* target = GetExplTargetUnit()) + { + if (!caster->IsFriendlyTo(target) && !caster->isInFront(target)) + return SPELL_FAILED_UNIT_NOT_INFRONT; + + if (target->IsFriendlyTo(caster) && target->GetCreatureType() != CREATURE_TYPE_UNDEAD) + return SPELL_FAILED_BAD_TARGETS; + } + else + return SPELL_FAILED_BAD_TARGETS; + + return SPELL_CAST_OK; + } + void Register() { + OnCheckCast += SpellCheckCastFn(spell_dk_death_coil_SpellScript::CheckCast); OnEffectHitTarget += SpellEffectFn(spell_dk_death_coil_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } @@ -769,16 +790,14 @@ class spell_dk_death_grip : public SpellScriptLoader { PrepareSpellScript(spell_dk_death_grip_SpellScript); - void HandleDummy(SpellEffIndex effIndex) + void HandleDummy(SpellEffIndex /*effIndex*/) { int32 damage = GetEffectValue(); - Position pos; + Position const* pos = GetExplTargetDest(); if (Unit* target = GetHitUnit()) { - GetSummonPosition(effIndex, pos, 0.0f, 0); - if (!target->HasAuraType(SPELL_AURA_DEFLECT_SPELLS)) // Deterrence - target->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), damage, true); + target->CastSpell(pos->GetPositionX(), pos->GetPositionY(), pos->GetPositionZ(), damage, true); } } diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 4c440f18bd9..898350dbd71 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -237,7 +237,7 @@ class spell_dru_t10_restoration_4p_bonus : public SpellScriptLoader } else { - unitList.remove(GetTargetUnit()); + unitList.remove(GetExplTargetUnit()); std::list<Unit*> tempTargets; for (std::list<Unit*>::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr) if ((*itr)->GetTypeId() == TYPEID_PLAYER && GetCaster()->IsInRaidWith(*itr)) @@ -250,7 +250,7 @@ class spell_dru_t10_restoration_4p_bonus : public SpellScriptLoader return; } - Unit* target = SelectRandomContainerElement(tempTargets); + Unit* target = Trinity::Containers::SelectRandomContainerElement(tempTargets); unitList.clear(); unitList.push_back(target); } @@ -279,7 +279,7 @@ class spell_dru_starfall_aoe : public SpellScriptLoader void FilterTargets(std::list<Unit*>& unitList) { - unitList.remove(GetTargetUnit()); + unitList.remove(GetExplTargetUnit()); } void Register() diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 886384a1c68..0c879cfb029 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -169,7 +169,7 @@ class spell_gen_burn_brutallus : public SpellScriptLoader } }; -enum eCannibalizeSpells +enum CannibalizeSpells { SPELL_CANNIBALIZE_TRIGGERED = 20578, }; @@ -224,7 +224,7 @@ class spell_gen_cannibalize : public SpellScriptLoader }; // 45472 Parachute -enum eParachuteSpells +enum ParachuteSpells { SPELL_PARACHUTE = 45472, SPELL_PARACHUTE_BUFF = 44795, @@ -365,7 +365,7 @@ class spell_gen_remove_flight_auras : public SpellScriptLoader }; // 66118 Leeching Swarm -enum eLeechingSwarmSpells +enum LeechingSwarmSpells { SPELL_LEECHING_SWARM_DMG = 66240, SPELL_LEECHING_SWARM_HEAL = 66125, @@ -481,7 +481,7 @@ class spell_gen_elune_candle : public SpellScriptLoader }; // 24750 Trick -enum eTrickSpells +enum TrickSpells { SPELL_PIRATE_COSTUME_MALE = 24708, SPELL_PIRATE_COSTUME_FEMALE = 24709, @@ -557,7 +557,7 @@ class spell_gen_trick : public SpellScriptLoader }; // 24751 Trick or Treat -enum eTrickOrTreatSpells +enum TrickOrTreatSpells { SPELL_TRICK = 24714, SPELL_TREAT = 24715, @@ -1234,30 +1234,30 @@ class spell_gen_magic_rooster : public SpellScriptLoader class spell_gen_allow_cast_from_item_only : public SpellScriptLoader { -public: - spell_gen_allow_cast_from_item_only() : SpellScriptLoader("spell_gen_allow_cast_from_item_only") { } - - class spell_gen_allow_cast_from_item_only_SpellScript : public SpellScript - { - PrepareSpellScript(spell_gen_allow_cast_from_item_only_SpellScript); + public: + spell_gen_allow_cast_from_item_only() : SpellScriptLoader("spell_gen_allow_cast_from_item_only") { } - SpellCastResult CheckRequirement() + class spell_gen_allow_cast_from_item_only_SpellScript : public SpellScript { - if (!GetCastItem()) - return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; - return SPELL_CAST_OK; - } + PrepareSpellScript(spell_gen_allow_cast_from_item_only_SpellScript); - void Register() + SpellCastResult CheckRequirement() + { + if (!GetCastItem()) + return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; + return SPELL_CAST_OK; + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_gen_allow_cast_from_item_only_SpellScript::CheckRequirement); + } + }; + + SpellScript* GetSpellScript() const { - OnCheckCast += SpellCheckCastFn(spell_gen_allow_cast_from_item_only_SpellScript::CheckRequirement); + return new spell_gen_allow_cast_from_item_only_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_gen_allow_cast_from_item_only_SpellScript(); - } }; enum Launch @@ -1282,7 +1282,7 @@ class spell_gen_launch : public SpellScriptLoader void Launch() { - WorldLocation const* const position = GetTargetDest(); + WorldLocation const* const position = GetExplTargetDest(); if (Player* player = GetHitPlayer()) { @@ -1312,6 +1312,11 @@ class spell_gen_launch : public SpellScriptLoader } }; +enum VehicleScaling +{ + SPELL_GEAR_SCALING = 66668, +}; + class spell_gen_vehicle_scaling : public SpellScriptLoader { public: @@ -1323,7 +1328,7 @@ class spell_gen_vehicle_scaling : public SpellScriptLoader bool Load() { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster() && GetCaster()->GetTypeId() == TYPEID_PLAYER; } void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) @@ -1335,7 +1340,7 @@ class spell_gen_vehicle_scaling : public SpellScriptLoader // TODO: Reserach coeffs for different vehicles switch (GetId()) { - case 66668: + case SPELL_GEAR_SCALING: factor = 1.0f; baseItemLevel = 205; break; @@ -1508,7 +1513,7 @@ class spell_gen_luck_of_the_draw : public SpellScriptLoader if (group->isLFGGroup()) if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true)) if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId)) - if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == map->GetDifficulty()) + if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == uint32(map->GetDifficulty())) if (randomDungeon && randomDungeon->type == LFG_TYPE_RANDOM) return; // in correct dungeon @@ -1585,19 +1590,17 @@ class spell_gen_spirit_healer_res : public SpellScriptLoader bool Load() { - return GetOriginalCaster()->GetTypeId() == TYPEID_PLAYER; + return GetOriginalCaster() && GetOriginalCaster()->GetTypeId() == TYPEID_PLAYER; } void HandleDummy(SpellEffIndex /* effIndex */) { - if (Player* originalCaster = GetOriginalCaster()->ToPlayer()) + Player* originalCaster = GetOriginalCaster()->ToPlayer(); + if (Unit* target = GetHitUnit()) { - if (Unit* target = GetHitUnit()) - { - WorldPacket data(SMSG_SPIRIT_HEALER_CONFIRM, 8); - data << uint64(target->GetGUID()); - originalCaster->GetSession()->SendPacket(&data); - } + WorldPacket data(SMSG_SPIRIT_HEALER_CONFIRM, 8); + data << uint64(target->GetGUID()); + originalCaster->GetSession()->SendPacket(&data); } } @@ -2550,6 +2553,141 @@ class spell_gen_chaos_blast : public SpellScriptLoader }; +class spell_gen_ds_flush_knockback : public SpellScriptLoader +{ + public: + spell_gen_ds_flush_knockback() : SpellScriptLoader("spell_gen_ds_flush_knockback") {} + + class spell_gen_ds_flush_knockback_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_ds_flush_knockback_SpellScript); + + void HandleScript(SpellEffIndex /*effIndex*/) + { + // Here the target is the water spout and determines the position where the player is knocked from + if (Unit* target = GetHitUnit()) + { + if (Player* player = GetCaster()->ToPlayer()) + { + float horizontalSpeed = 20.0f + (40.0f - GetCaster()->GetDistance(target)); + float verticalSpeed = 8.0f; + // This method relies on the Dalaran Sewer map disposition and Water Spout position + // What we do is knock the player from a position exactly behind him and at the end of the pipe + player->KnockbackFrom(target->GetPositionX(), player->GetPositionY(), horizontalSpeed, verticalSpeed); + } + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_gen_ds_flush_knockback_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_ds_flush_knockback_SpellScript(); + } +}; + +class spell_gen_wg_water : public SpellScriptLoader +{ + public: + spell_gen_wg_water() : SpellScriptLoader("spell_gen_wg_water") {} + + class spell_gen_wg_water_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_wg_water_SpellScript); + + SpellCastResult CheckCast() + { + if (!GetSpellInfo()->CheckTargetCreatureType(GetCaster())) + return SPELL_FAILED_DONT_REPORT; + return SPELL_CAST_OK; + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_gen_wg_water_SpellScript::CheckCast); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_wg_water_SpellScript(); + } +}; + +class spell_gen_count_pct_from_max_hp : public SpellScriptLoader +{ + public: + spell_gen_count_pct_from_max_hp(char const* name, int32 damagePct = 0) : SpellScriptLoader(name), _damagePct(damagePct) { } + + class spell_gen_count_pct_from_max_hp_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_count_pct_from_max_hp_SpellScript) + + public: + spell_gen_count_pct_from_max_hp_SpellScript(int32 damagePct) : SpellScript(), _damagePct(damagePct) { } + + void RecalculateDamage() + { + if (!_damagePct) + _damagePct = GetHitDamage(); + + SetHitDamage(GetHitUnit()->CountPctFromMaxHealth(_damagePct)); + } + + void Register() + { + OnHit += SpellHitFn(spell_gen_count_pct_from_max_hp_SpellScript::RecalculateDamage); + } + + private: + int32 _damagePct; + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_count_pct_from_max_hp_SpellScript(_damagePct); + } + + private: + int32 _damagePct; +}; + +class spell_gen_despawn_self : public SpellScriptLoader +{ +public: + spell_gen_despawn_self() : SpellScriptLoader("spell_gen_despawn_self") { } + + class spell_gen_despawn_self_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_despawn_self_SpellScript); + + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_UNIT; + } + + void HandleDummy(SpellEffIndex effIndex) + { + if (GetSpellInfo()->Effects[effIndex].Effect == SPELL_EFFECT_DUMMY || GetSpellInfo()->Effects[effIndex].Effect == SPELL_EFFECT_SCRIPT_EFFECT) + GetCaster()->ToCreature()->DespawnOrUnsummon(); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_gen_despawn_self_SpellScript::HandleDummy, EFFECT_ALL, SPELL_EFFECT_ANY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_despawn_self_SpellScript(); + } +}; + void AddSC_generic_spell_scripts() { new spell_gen_absorb0_hitlimit1(); @@ -2599,4 +2737,9 @@ void AddSC_generic_spell_scripts() new spell_gen_on_tournament_mount(); new spell_gen_tournament_pennant(); new spell_gen_chaos_blast(); + new spell_gen_ds_flush_knockback(); + new spell_gen_wg_water(); + new spell_gen_count_pct_from_max_hp("spell_gen_default_count_pct_from_max_hp"); + new spell_gen_count_pct_from_max_hp("spell_gen_50pct_count_pct_from_max_hp", 50); + new spell_gen_despawn_self(); } diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 855af75cd83..896ed331bde 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -137,8 +137,9 @@ class spell_hun_chimera_shot : public SpellScriptLoader { int32 TickCount = aurEff->GetTotalTicks(); spellId = HUNTER_SPELL_CHIMERA_SHOT_SERPENT; - basePoint = caster->SpellDamageBonus(unitTarget, aura->GetSpellInfo(), aurEff->GetAmount(), DOT, aura->GetStackAmount()); + basePoint = caster->SpellDamageBonusDone(unitTarget, aura->GetSpellInfo(), aurEff->GetAmount(), DOT, aura->GetStackAmount()); ApplyPctN(basePoint, TickCount * 40); + basePoint = unitTarget->SpellDamageBonusTaken(caster, aura->GetSpellInfo(), basePoint, DOT, aura->GetStackAmount()); } // Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting. else if (familyFlag[1] & 0x00000080) @@ -286,8 +287,8 @@ class spell_hun_masters_call : public SpellScriptLoader target->CastSpell(target, HUNTER_SPELL_MASTERS_CALL_TRIGGERED, castMask); // there is a possibility that this effect should access effect 0 (dummy) target, but i dubt that // it's more likely that on on retail it's possible to call target selector based on dbc values - // anyways, we're using GetTargetUnit() here and it's ok - if (Unit* ally = GetTargetUnit()) + // anyways, we're using GetExplTargetUnit() here and it's ok + if (Unit* ally = GetExplTargetUnit()) { target->CastSpell(ally, GetEffectValue(), castMask); target->CastSpell(ally, GetSpellInfo()->Effects[EFFECT_0].CalcValue(), castMask); @@ -560,6 +561,64 @@ class spell_hun_pet_carrion_feeder : public SpellScriptLoader } }; +// 34477 Misdirection +class spell_hun_misdirection : public SpellScriptLoader +{ + public: + spell_hun_misdirection() : SpellScriptLoader("spell_hun_misdirection") { } + + class spell_hun_misdirection_AuraScript : public AuraScript + { + PrepareAuraScript(spell_hun_misdirection_AuraScript); + + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + if (!GetDuration()) + caster->SetReducedThreatPercent(0, 0); + } + + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_hun_misdirection_AuraScript::OnRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_hun_misdirection_AuraScript(); + } +}; + +// 35079 Misdirection proc +class spell_hun_misdirection_proc : public SpellScriptLoader +{ + public: + spell_hun_misdirection_proc() : SpellScriptLoader("spell_hun_misdirection_proc") { } + + class spell_hun_misdirection_proc_AuraScript : public AuraScript + { + PrepareAuraScript(spell_hun_misdirection_proc_AuraScript); + + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (GetCaster()) + GetCaster()->SetReducedThreatPercent(0, 0); + } + + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_hun_misdirection_proc_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_hun_misdirection_proc_AuraScript(); + } +}; + + void AddSC_hunter_spell_scripts() { new spell_hun_aspect_of_the_beast(); @@ -572,4 +631,6 @@ void AddSC_hunter_spell_scripts() new spell_hun_sniper_training(); new spell_hun_pet_heart_of_the_phoenix(); new spell_hun_pet_carrion_feeder(); + new spell_hun_misdirection(); + new spell_hun_misdirection_proc(); } diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 416869d98ce..4e2eb633662 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -55,8 +55,8 @@ class spell_item_trigger_spell : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { Unit* caster = GetCaster(); - if (Item* pItem = GetCastItem()) - caster->CastSpell(caster, _triggeredSpellId, true, pItem); + if (Item* item = GetCastItem()) + caster->CastSpell(caster, _triggeredSpellId, true, item); } void Register() @@ -1095,7 +1095,7 @@ class spell_item_shimmering_vessel : public SpellScriptLoader void HandleDummy(SpellEffIndex /* effIndex */) { if (Creature* target = GetHitCreature()) - target->setDeathState(JUST_ALIVED); + target->setDeathState(JUST_RESPAWNED); } void Register() @@ -1513,7 +1513,7 @@ class spell_item_complete_raptor_capture : public SpellScriptLoader enum ImpaleLeviroth { NPC_LEVIROTH = 26452, - SPELL_LEVIROTH_SELF_IMPALE = 49882 + SPELL_LEVIROTH_SELF_IMPALE = 49882, }; class spell_item_impale_leviroth : public SpellScriptLoader @@ -1534,11 +1534,9 @@ class spell_item_impale_leviroth : public SpellScriptLoader void HandleDummy(SpellEffIndex /* effIndex */) { - Unit* target = GetHitCreature(); - if (!target || target->GetEntry() != NPC_LEVIROTH || !target->HealthBelowPct(95)) - return; - - target->CastSpell(target, SPELL_LEVIROTH_SELF_IMPALE, true); + if (Unit* target = GetHitCreature()) + if (target->GetEntry() == NPC_LEVIROTH && !target->HealthBelowPct(95)) + target->CastSpell(target, SPELL_LEVIROTH_SELF_IMPALE, true); } void Register() @@ -1591,15 +1589,15 @@ class spell_item_brewfest_mount_transformation : public SpellScriptLoader { case SPELL_BREWFEST_MOUNT_TRANSFORM: if (caster->GetSpeedRate(MOVE_RUN) >= 2.0f) - spell_id = caster->GetTeam() == ALLIANCE ? SPELL_MOUNT_RAM_100 : SPELL_MOUNT_KODO_100 ; + spell_id = caster->GetTeam() == ALLIANCE ? SPELL_MOUNT_RAM_100 : SPELL_MOUNT_KODO_100; else - spell_id = caster->GetTeam() == ALLIANCE ? SPELL_MOUNT_RAM_60 : SPELL_MOUNT_KODO_60 ; + spell_id = caster->GetTeam() == ALLIANCE ? SPELL_MOUNT_RAM_60 : SPELL_MOUNT_KODO_60; break; case SPELL_BREWFEST_MOUNT_TRANSFORM_REVERSE: if (caster->GetSpeedRate(MOVE_RUN) >= 2.0f) - spell_id = caster->GetTeam() == HORDE ? SPELL_MOUNT_RAM_100 : SPELL_MOUNT_KODO_100 ; + spell_id = caster->GetTeam() == HORDE ? SPELL_MOUNT_RAM_100 : SPELL_MOUNT_KODO_100; else - spell_id = caster->GetTeam() == HORDE ? SPELL_MOUNT_RAM_60 : SPELL_MOUNT_KODO_60 ; + spell_id = caster->GetTeam() == HORDE ? SPELL_MOUNT_RAM_60 : SPELL_MOUNT_KODO_60; break; default: return; @@ -1746,11 +1744,20 @@ class spell_item_rocket_boots : public SpellScriptLoader if (Battleground* bg = caster->GetBattleground()) bg->EventPlayerDroppedFlag(caster); + caster->RemoveSpellCooldown(SPELL_ROCKET_BOOTS_PROC); caster->CastSpell(caster, SPELL_ROCKET_BOOTS_PROC, true, NULL); } + SpellCastResult CheckCast() + { + if (GetCaster()->IsInWater()) + return SPELL_FAILED_ONLY_ABOVEWATER; + return SPELL_CAST_OK; + } + void Register() { + OnCheckCast += SpellCheckCastFn(spell_item_rocket_boots_SpellScript::CheckCast); OnEffectHitTarget += SpellEffectFn(spell_item_rocket_boots_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; @@ -1994,6 +2001,65 @@ class spell_item_refocus : public SpellScriptLoader } }; +class spell_item_muisek_vessel : public SpellScriptLoader +{ + public: + spell_item_muisek_vessel() : SpellScriptLoader("spell_item_muisek_vessel") { } + + class spell_item_muisek_vessel_SpellScript : public SpellScript + { + PrepareSpellScript(spell_item_muisek_vessel_SpellScript); + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Creature* target = GetHitCreature()) + if (target->isDead()) + target->DespawnOrUnsummon(); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_item_muisek_vessel_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_item_muisek_vessel_SpellScript(); + } +}; + +enum GreatmothersSoulcather +{ + SPELL_FORCE_CAST_SUMMON_GNOME_SOUL = 46486, +}; +class spell_item_greatmothers_soulcatcher : public SpellScriptLoader +{ +public: + spell_item_greatmothers_soulcatcher() : SpellScriptLoader("spell_item_greatmothers_soulcatcher") { } + + class spell_item_greatmothers_soulcatcher_SpellScript : public SpellScript + { + PrepareSpellScript(spell_item_greatmothers_soulcatcher_SpellScript); + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (GetHitUnit()) + GetCaster()->CastSpell(GetCaster(),SPELL_FORCE_CAST_SUMMON_GNOME_SOUL); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_item_greatmothers_soulcatcher_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_item_greatmothers_soulcatcher_SpellScript(); + } +}; + void AddSC_item_spell_scripts() { // 23074 Arcanite Dragonling @@ -2045,4 +2111,6 @@ void AddSC_item_spell_scripts() new spell_item_unusual_compass(); new spell_item_uded(); new spell_item_chicken_cover(); + new spell_item_muisek_vessel(); + new spell_item_greatmothers_soulcatcher(); } diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index ea1af10816b..050741ffaba 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -123,6 +123,12 @@ class spell_mage_cold_snap : public SpellScriptLoader } }; +enum SilvermoonPolymorph +{ + NPC_AUROSALIA = 18744, +}; + +// TODO: move out of here and rename - not a mage spell class spell_mage_polymorph_cast_visual : public SpellScriptLoader { public: @@ -132,22 +138,22 @@ class spell_mage_polymorph_cast_visual : public SpellScriptLoader { PrepareSpellScript(spell_mage_polymorph_cast_visual_SpellScript); - static const uint32 spell_list[6]; + static const uint32 PolymorhForms[6]; bool Validate(SpellInfo const* /*spellEntry*/) { // check if spell ids exist in dbc - for (int i = 0; i < 6; i++) - if (!sSpellMgr->GetSpellInfo(spell_list[i])) + for (uint32 i = 0; i < 6; i++) + if (!sSpellMgr->GetSpellInfo(PolymorhForms[i])) return false; return true; } void HandleDummy(SpellEffIndex /*effIndex*/) { - if (Unit* unitTarget = GetHitUnit()) - if (unitTarget->GetTypeId() == TYPEID_UNIT) - unitTarget->CastSpell(unitTarget, spell_list[urand(0, 5)], true); + if (Unit* target = GetCaster()->FindNearestCreature(NPC_AUROSALIA, 30.0f)) + if (target->GetTypeId() == TYPEID_UNIT) + target->CastSpell(target, PolymorhForms[urand(0, 5)], true); } void Register() @@ -163,7 +169,7 @@ class spell_mage_polymorph_cast_visual : public SpellScriptLoader } }; -const uint32 spell_mage_polymorph_cast_visual::spell_mage_polymorph_cast_visual_SpellScript::spell_list[6] = +const uint32 spell_mage_polymorph_cast_visual::spell_mage_polymorph_cast_visual_SpellScript::PolymorhForms[6] = { SPELL_MAGE_SQUIRREL_FORM, SPELL_MAGE_GIRAFFE_FORM, @@ -244,9 +250,11 @@ class spell_mage_frost_warding_trigger : public SpellScriptLoader if (roll_chance_i(chance)) { - absorbAmount = dmgInfo.GetDamage(); - int32 bp = absorbAmount; + int32 bp = dmgInfo.GetDamage(); + dmgInfo.AbsorbDamage(bp); target->CastCustomSpell(target, SPELL_MAGE_FROST_WARDING_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff); + absorbAmount = 0; + PreventDefaultAction(); } } } diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index d823c629d4b..4baa1eb3735 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -285,9 +285,29 @@ class spell_pal_holy_shock : public SpellScriptLoader } } + SpellCastResult CheckCast() + { + Player* caster = GetCaster()->ToPlayer(); + if (Unit* target = GetExplTargetUnit()) + { + if (!caster->IsFriendlyTo(target)) + { + if (!caster->IsValidAttackTarget(target)) + return SPELL_FAILED_BAD_TARGETS; + + if (!caster->isInFront(target)) + return SPELL_FAILED_UNIT_NOT_INFRONT; + } + } + else + return SPELL_FAILED_BAD_TARGETS; + return SPELL_CAST_OK; + } + void Register() { // add dummy effect spell handler to Holy Shock + OnCheckCast += SpellCheckCastFn(spell_pal_holy_shock_SpellScript::CheckCast); OnEffectHitTarget += SpellEffectFn(spell_pal_holy_shock_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index b012fe5f183..8088004c9d1 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -185,6 +185,11 @@ class spell_pri_penance : public SpellScriptLoader { PrepareSpellScript(spell_pri_penance_SpellScript); + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + bool Validate(SpellInfo const* spellEntry) { if (!sSpellMgr->GetSpellInfo(PRIEST_SPELL_PENANCE_R1)) @@ -207,7 +212,7 @@ class spell_pri_penance : public SpellScriptLoader Unit* caster = GetCaster(); if (Unit* unitTarget = GetHitUnit()) { - if(!unitTarget->isAlive()) + if (!unitTarget->isAlive()) return; uint8 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id); @@ -219,10 +224,20 @@ class spell_pri_penance : public SpellScriptLoader } } + SpellCastResult CheckCast() + { + Player* caster = GetCaster()->ToPlayer(); + if (Unit* target = GetExplTargetUnit()) + if (!caster->IsFriendlyTo(target) && !caster->IsValidAttackTarget(target)) + return SPELL_FAILED_BAD_TARGETS; + return SPELL_CAST_OK; + } + void Register() { // add dummy effect spell handler to Penance OnEffectHitTarget += SpellEffectFn(spell_pri_penance_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnCheckCast += SpellCheckCastFn(spell_pri_penance_SpellScript::CheckCast); } }; @@ -275,12 +290,53 @@ class spell_pri_reflective_shield_trigger : public SpellScriptLoader } }; +enum PrayerOfMending +{ + SPELL_T9_HEALING_2_PIECE = 67201, +}; +// Prayer of Mending Heal +class spell_pri_prayer_of_mending_heal : public SpellScriptLoader +{ +public: + spell_pri_prayer_of_mending_heal() : SpellScriptLoader("spell_pri_prayer_of_mending_heal") { } + + class spell_pri_prayer_of_mending_heal_SpellScript : public SpellScript + { + PrepareSpellScript(spell_pri_prayer_of_mending_heal_SpellScript); + + void HandleHeal(SpellEffIndex /*effIndex*/) + { + if (Unit* caster = GetOriginalCaster()) + { + if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_T9_HEALING_2_PIECE,EFFECT_0)) + { + int32 heal = GetHitHeal(); + AddPctN(heal, aurEff->GetAmount()); + SetHitHeal(heal); + } + } + + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_pri_prayer_of_mending_heal_SpellScript::HandleHeal, EFFECT_0, SPELL_EFFECT_HEAL); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_pri_prayer_of_mending_heal_SpellScript(); + } +}; + void AddSC_priest_spell_scripts() { new spell_pri_guardian_spirit(); - new spell_pri_mana_burn; - new spell_pri_pain_and_suffering_proc; - new spell_pri_penance; + new spell_pri_mana_burn(); + new spell_pri_pain_and_suffering_proc(); + new spell_pri_penance(); new spell_pri_reflective_shield_trigger(); new spell_pri_mind_sear(); + new spell_pri_prayer_of_mending_heal(); } diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 09c34e3499d..810cc20e04b 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -275,7 +275,7 @@ class spell_q11396_11399_scourging_crystal_controller : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { - if (Unit* target = GetTargetUnit()) + if (Unit* target = GetExplTargetUnit()) if (target->GetTypeId() == TYPEID_UNIT && target->HasAura(SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3)) // Make sure nobody else is channeling the same target if (!target->HasAura(SPELL_SCOURGING_CRYSTAL_CONTROLLER)) @@ -636,6 +636,10 @@ class spell_q12851_going_bearback : public SpellScriptLoader if (Unit* caster = GetCaster()) { Unit* target = GetTarget(); + // Already in fire + if (target->HasAura(SPELL_ABLAZE)) + return; + if (Player* player = caster->GetCharmerOrOwnerPlayerOrPlayerItself()) { switch (target->GetEntry()) @@ -833,7 +837,7 @@ class spell_q12659_ahunaes_knife : public SpellScriptLoader Player* caster = GetCaster()->ToPlayer(); if (Creature* target = GetHitCreature()) { - target->ForcedDespawn(); + target->DespawnOrUnsummon(); caster->KilledMonsterCredit(NPC_SCALPS_KC_BUNNY, 0); } } @@ -1025,9 +1029,9 @@ class spell_q14112_14145_chum_the_water: public SpellScriptLoader // http://old01.wowhead.com/quest=9452 - Red Snapper - Very Tasty! enum RedSnapperVeryTasty { - SPELL_CAST_NET = 29866, - ITEM_RED_SNAPPER = 23614, - NPC_ANGRY_MURLOC = 17102, + SPELL_CAST_NET = 29866, + ITEM_RED_SNAPPER = 23614, + SPELL_NEW_SUMMON_TEST = 49214, }; class spell_q9452_cast_net: public SpellScriptLoader @@ -1047,16 +1051,10 @@ class spell_q9452_cast_net: public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { Player* caster = GetCaster()->ToPlayer(); - switch (urand(0, 2)) - { - case 0: case 1: - caster->AddItem(ITEM_RED_SNAPPER, 1); - break; - case 2: - if (Creature* murloc = caster->SummonCreature(NPC_ANGRY_MURLOC, caster->GetPositionX()+5, caster->GetPositionY(), caster->GetPositionZ(), 0.0f, TEMPSUMMON_MANUAL_DESPAWN, 120000)) - murloc->AI()->AttackStart(caster); - break; - } + if (roll_chance_i(66)) + caster->AddItem(ITEM_RED_SNAPPER, 1); + else + caster->CastSpell(caster, SPELL_NEW_SUMMON_TEST, true); } void Register() @@ -1107,6 +1105,63 @@ public: } }; +enum LeaveNothingToChance +{ + NPC_UPPER_MINE_SHAFT = 27436, + NPC_LOWER_MINE_SHAFT = 27437, + + SPELL_UPPER_MINE_SHAFT_CREDIT = 48744, + SPELL_LOWER_MINE_SHAFT_CREDIT = 48745, +}; + +class spell_q12277_wintergarde_mine_explosion : public SpellScriptLoader +{ + public: + spell_q12277_wintergarde_mine_explosion() : SpellScriptLoader("spell_q12277_wintergarde_mine_explosion") { } + + class spell_q12277_wintergarde_mine_explosion_SpellScript : public SpellScript + { + PrepareSpellScript(spell_q12277_wintergarde_mine_explosion_SpellScript); + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Creature* unitTarget = GetHitCreature()) + { + if (Unit* caster = GetCaster()) + { + if (caster->GetTypeId() == TYPEID_UNIT) + { + if (Unit* owner = caster->GetOwner()) + { + switch (unitTarget->GetEntry()) + { + case NPC_UPPER_MINE_SHAFT: + caster->CastSpell(owner, SPELL_UPPER_MINE_SHAFT_CREDIT, true); + break; + case NPC_LOWER_MINE_SHAFT: + caster->CastSpell(owner, SPELL_LOWER_MINE_SHAFT_CREDIT, true); + break; + default: + break; + } + } + } + } + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_q12277_wintergarde_mine_explosion_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_q12277_wintergarde_mine_explosion_SpellScript(); + } +}; + void AddSC_quest_spell_scripts() { new spell_q55_sacred_cleansing(); @@ -1133,4 +1188,5 @@ void AddSC_quest_spell_scripts() new spell_q14112_14145_chum_the_water(); new spell_q9452_cast_net(); new spell_q12987_read_pronouncement(); + new spell_q12277_wintergarde_mine_explosion(); } diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index 96ee7a18429..c9c036d5329 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -35,6 +35,9 @@ enum ShamanSpells SHAMAN_SPELL_FIRE_NOVA_TRIGGERED_R1 = 8349, SHAMAN_SPELL_SATED = 57724, SHAMAN_SPELL_EXHAUSTION = 57723, + + SHAMAN_SPELL_STORM_EARTH_AND_FIRE = 51483, + EARTHBIND_TOTEM_SPELL_EARTHGRAB = 64695, // For Earthen Power SHAMAN_TOTEM_SPELL_EARTHBIND_TOTEM = 6474, @@ -210,20 +213,35 @@ class spell_sha_earthbind_totem : public SpellScriptLoader return true; } - void HandleEffectPeriodic(AuraEffect const* aurEff) + void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) { - if (Unit* target = GetTarget()) - if (Unit* caster = aurEff->GetBase()->GetCaster()) - if (TempSummon* summon = caster->ToTempSummon()) - if (Unit* owner = summon->GetOwner()) - if (AuraEffect* aur = owner->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 2289, 0)) - if (roll_chance_i(aur->GetBaseAmount()) && target->HasAuraWithMechanic(1 << MECHANIC_SNARE)) - caster->CastSpell(caster, SHAMAN_TOTEM_SPELL_EARTHEN_POWER, true, NULL, aurEff); + if (!GetCaster()) + return; + if (Player* owner = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself()) + if (AuraEffect* aur = owner->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 2289, 0)) + if (roll_chance_i(aur->GetBaseAmount())) + GetTarget()->CastSpell((Unit*)NULL, SHAMAN_TOTEM_SPELL_EARTHEN_POWER, true); + } + + void Apply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (!GetCaster()) + return; + Player* owner = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself(); + if (!owner) + return; + // Storm, Earth and Fire + if (AuraEffect* aurEff = owner->GetAuraEffectOfRankedSpell(SHAMAN_SPELL_STORM_EARTH_AND_FIRE, EFFECT_1)) + { + if (roll_chance_i(aurEff->GetAmount())) + GetCaster()->CastSpell(GetCaster(), EARTHBIND_TOTEM_SPELL_EARTHGRAB, false); + } } void Register() { OnEffectPeriodic += AuraEffectPeriodicFn(spell_sha_earthbind_totem_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + OnEffectApply += AuraEffectApplyFn(spell_sha_earthbind_totem_AuraScript::Apply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); } }; @@ -233,6 +251,46 @@ class spell_sha_earthbind_totem : public SpellScriptLoader } }; +class EarthenPowerTargetSelector +{ + public: + EarthenPowerTargetSelector() { } + + bool operator() (Unit* target) + { + if (!target->HasAuraWithMechanic(1 << MECHANIC_SNARE)) + return true; + + return false; + } +}; + +class spell_sha_earthen_power : public SpellScriptLoader +{ + public: + spell_sha_earthen_power() : SpellScriptLoader("spell_sha_earthen_power") { } + + class spell_sha_earthen_power_SpellScript : public SpellScript + { + PrepareSpellScript(spell_sha_earthen_power_SpellScript); + + void FilterTargets(std::list<Unit*>& unitList) + { + unitList.remove_if(EarthenPowerTargetSelector()); + } + + void Register() + { + OnUnitTargetSelect += SpellUnitTargetFn(spell_sha_earthen_power_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_sha_earthen_power_SpellScript(); + } +}; + class spell_sha_bloodlust : public SpellScriptLoader { public: @@ -251,7 +309,7 @@ class spell_sha_bloodlust : public SpellScriptLoader void RemoveInvalidTargets(std::list<Unit*>& targets) { - targets.remove_if (Trinity::UnitAuraCheck(true, SHAMAN_SPELL_SATED)); + targets.remove_if(Trinity::UnitAuraCheck(true, SHAMAN_SPELL_SATED)); } void ApplyDebuff() @@ -430,7 +488,7 @@ class spell_sha_healing_stream_totem : public SpellScriptLoader if (Unit* owner = caster->GetOwner()) { if (triggeringSpell) - damage = int32(owner->SpellHealingBonus(target, triggeringSpell, damage, HEAL)); + damage = int32(owner->SpellHealingBonusDone(target, triggeringSpell, damage, HEAL)); // Restorative Totems if (AuraEffect* dummy = owner->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, ICON_ID_RESTORATIVE_TOTEMS, 1)) @@ -439,6 +497,8 @@ class spell_sha_healing_stream_totem : public SpellScriptLoader // Glyph of Healing Stream Totem if (AuraEffect const* aurEff = owner->GetAuraEffect(SPELL_GLYPH_OF_HEALING_STREAM_TOTEM, EFFECT_0)) AddPctN(damage, aurEff->GetAmount()); + + damage = int32(target->SpellHealingBonusTaken(owner, triggeringSpell, damage, HEAL)); } caster->CastCustomSpell(target, SPELL_HEALING_STREAM_TOTEM_HEAL, &damage, 0, 0, true, 0, 0, GetOriginalCaster()->GetGUID()); } @@ -542,6 +602,55 @@ class spell_sha_lava_lash : public SpellScriptLoader } }; +// 1064 Chain Heal +class spell_sha_chain_heal : public SpellScriptLoader +{ + public: + spell_sha_chain_heal() : SpellScriptLoader("spell_sha_chain_heal") { } + + class spell_sha_chain_heal_SpellScript : public SpellScript + { + PrepareSpellScript(spell_sha_chain_heal_SpellScript); + + bool Load() + { + firstHeal = true; + riptide = false; + return true; + } + + void HandleHeal(SpellEffIndex /*effIndex*/) + { + if (firstHeal) + { + // Check if the target has Riptide + if (AuraEffect* aurEff = GetHitUnit()->GetAuraEffect(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_SHAMAN, 0, 0, 0x10, GetCaster()->GetGUID())) + { + riptide = true; + // Consume it + GetHitUnit()->RemoveAura(aurEff->GetBase()); + } + firstHeal = false; + } + // Riptide increases the Chain Heal effect by 25% + if (riptide) + SetHitHeal(GetHitHeal() * 1.25f); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_sha_chain_heal_SpellScript::HandleHeal, EFFECT_0, SPELL_EFFECT_HEAL); + } + + bool firstHeal; + bool riptide; + }; + + SpellScript* GetSpellScript() const + { + return new spell_sha_chain_heal_SpellScript(); + } +}; void AddSC_shaman_spell_scripts() { @@ -549,6 +658,7 @@ void AddSC_shaman_spell_scripts() new spell_sha_fire_nova(); new spell_sha_mana_tide_totem(); new spell_sha_earthbind_totem(); + new spell_sha_earthen_power(); new spell_sha_bloodlust(); new spell_sha_heroism(); new spell_sha_ancestral_awakening_proc(); @@ -556,4 +666,5 @@ void AddSC_shaman_spell_scripts() new spell_sha_healing_stream_totem(); new spell_sha_mana_spring_totem(); new spell_sha_lava_lash(); + new spell_sha_chain_heal(); } diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index b1aff706db0..838b9e4f932 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -34,6 +34,9 @@ enum WarlockSpells WARLOCK_DEMONIC_EMPOWERMENT_IMP = 54444, WARLOCK_IMPROVED_HEALTHSTONE_R1 = 18692, WARLOCK_IMPROVED_HEALTHSTONE_R2 = 18693, + WARLOCK_DEMONIC_CIRCLE_SUMMON = 48018, + WARLOCK_DEMONIC_CIRCLE_TELEPORT = 48020, + WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST = 62388, }; class spell_warl_banish : public SpellScriptLoader @@ -169,6 +172,19 @@ class spell_warl_create_healthstone : public SpellScriptLoader return true; } + SpellCastResult CheckCast() + { + if (Player* caster = GetCaster()->ToPlayer()) + { + uint8 spellRank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id); + ItemPosCountVec dest; + InventoryResult msg = caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, iTypes[spellRank - 1][0], 1, NULL); + if (msg != EQUIP_ERR_OK) + return SPELL_FAILED_TOO_MANY_OF_ITEM; + } + return SPELL_CAST_OK; + } + void HandleScriptEffect(SpellEffIndex effIndex) { if (Unit* unitTarget = GetHitUnit()) @@ -195,6 +211,7 @@ class spell_warl_create_healthstone : public SpellScriptLoader void Register() { OnEffectHitTarget += SpellEffectFn(spell_warl_create_healthstone_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnCheckCast += SpellCheckCastFn(spell_warl_create_healthstone_SpellScript::CheckCast); } }; @@ -284,8 +301,8 @@ class spell_warl_seed_of_corruption : public SpellScriptLoader void FilterTargets(std::list<Unit*>& unitList) { - if (GetTargetUnit()) - unitList.remove(GetTargetUnit()); + if (GetExplTargetUnit()) + unitList.remove(GetExplTargetUnit()); } void Register() @@ -327,11 +344,7 @@ class spell_warl_soulshatter : public SpellScriptLoader if (Unit* target = GetHitUnit()) { if (target->CanHaveThreatList() && target->getThreatManager().getThreat(caster) > 0.0f) - { - sLog->outString("THREATREDUCTION"); caster->CastSpell(target, SPELL_SOULSHATTER, true); - } else - sLog->outString("can have threat? %u . threat number? %f ",target->CanHaveThreatList(),target->getThreatManager().getThreat(caster)); } } @@ -349,9 +362,6 @@ class spell_warl_soulshatter : public SpellScriptLoader enum LifeTap { - SPELL_LIFE_TAP_RANK_6 = 11689, - SPELL_LIFE_TAP_RANK_7 = 27222, - SPELL_LIFE_TAP_RANK_8 = 57946, SPELL_LIFE_TAP_ENERGIZE = 31818, SPELL_LIFE_TAP_ENERGIZE_2 = 32553, ICON_ID_IMPROVED_LIFE_TAP = 208, @@ -374,9 +384,7 @@ class spell_warl_life_tap : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) { - if (!sSpellMgr->GetSpellInfo(SPELL_LIFE_TAP_RANK_6) || !sSpellMgr->GetSpellInfo(SPELL_LIFE_TAP_RANK_7) - || !sSpellMgr->GetSpellInfo(SPELL_LIFE_TAP_RANK_8) || !sSpellMgr->GetSpellInfo(SPELL_LIFE_TAP_ENERGIZE) - || !sSpellMgr->GetSpellInfo(SPELL_LIFE_TAP_ENERGIZE_2)) + if (!sSpellMgr->GetSpellInfo(SPELL_LIFE_TAP_ENERGIZE) || !sSpellMgr->GetSpellInfo(SPELL_LIFE_TAP_ENERGIZE_2)) return false; return true; } @@ -386,18 +394,8 @@ class spell_warl_life_tap : public SpellScriptLoader Player* caster = GetCaster()->ToPlayer(); if (Unit* target = GetHitUnit()) { - SpellInfo const* spellInfo = GetSpellInfo(); - float spFactor = 0.0f; - int32 damage = int32(GetEffectValue() + (6.3875 * spellInfo->BaseLevel)); - switch (spellInfo->Id) - { - case SPELL_LIFE_TAP_RANK_6: spFactor = 0.2f; break; - case SPELL_LIFE_TAP_RANK_7: - case SPELL_LIFE_TAP_RANK_8: spFactor = 0.5f; break; - default: break; - } - - int32 mana = int32(damage + (caster->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+SPELL_SCHOOL_SHADOW) * spFactor)); + int32 damage = GetEffectValue(); + int32 mana = int32(damage + (caster->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+SPELL_SCHOOL_SHADOW) * 0.5f)); // Shouldn't Appear in Combat Log target->ModifyHealth(-damage); @@ -424,9 +422,7 @@ class spell_warl_life_tap : public SpellScriptLoader SpellCastResult CheckCast() { if ((int32(GetCaster()->GetHealth()) > int32(GetSpellInfo()->Effects[EFFECT_0].CalcValue() + (6.3875 * GetSpellInfo()->BaseLevel)))) - { return SPELL_CAST_OK; - } return SPELL_FAILED_FIZZLE; } @@ -443,6 +439,90 @@ class spell_warl_life_tap : public SpellScriptLoader } }; +class spell_warl_demonic_circle_summon : public SpellScriptLoader +{ + public: + spell_warl_demonic_circle_summon() : SpellScriptLoader("spell_warl_demonic_circle_summon") { } + + class spell_warl_demonic_circle_summon_AuraScript : public AuraScript + { + PrepareAuraScript(spell_warl_demonic_circle_summon_AuraScript); + + void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes mode) + { + // If effect is removed by expire remove the summoned demonic circle too. + if (!(mode & AURA_EFFECT_HANDLE_REAPPLY)) + GetTarget()->RemoveGameObject(GetId(), true); + + GetTarget()->RemoveAura(WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST); + } + + void HandleDummyTick(AuraEffect const* /*aurEff*/) + { + if (GameObject* circle = GetTarget()->GetGameObject(GetId())) + { + // Here we check if player is in demonic circle teleport range, if so add + // WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST; allowing him to cast the WARLOCK_DEMONIC_CIRCLE_TELEPORT. + // If not in range remove the WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST. + + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_CIRCLE_TELEPORT); + + if (GetTarget()->IsWithinDist(circle, spellInfo->GetMaxRange(true))) + { + if (!GetTarget()->HasAura(WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST)) + GetTarget()->CastSpell(GetTarget(), WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST, true); + } + else + GetTarget()->RemoveAura(WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST); + } + } + + void Register() + { + OnEffectRemove += AuraEffectApplyFn(spell_warl_demonic_circle_summon_AuraScript::HandleRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_warl_demonic_circle_summon_AuraScript::HandleDummyTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_warl_demonic_circle_summon_AuraScript(); + } +}; + +class spell_warl_demonic_circle_teleport : public SpellScriptLoader +{ + public: + spell_warl_demonic_circle_teleport() : SpellScriptLoader("spell_warl_demonic_circle_teleport") { } + + class spell_warl_demonic_circle_teleport_AuraScript : public AuraScript + { + PrepareAuraScript(spell_warl_demonic_circle_teleport_AuraScript); + + void HandleTeleport(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Player* player = GetTarget()->ToPlayer()) + { + if (GameObject* circle = player->GetGameObject(WARLOCK_DEMONIC_CIRCLE_SUMMON)) + { + player->NearTeleportTo(circle->GetPositionX(), circle->GetPositionY(), circle->GetPositionZ(), circle->GetOrientation()); + player->RemoveMovementImpairingAuras(); + } + } + } + + void Register() + { + OnEffectApply += AuraEffectApplyFn(spell_warl_demonic_circle_teleport_AuraScript::HandleTeleport, EFFECT_0, SPELL_AURA_MECHANIC_IMMUNITY, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_warl_demonic_circle_teleport_AuraScript(); + } +}; + void AddSC_warlock_spell_scripts() { new spell_warl_banish(); @@ -453,4 +533,6 @@ void AddSC_warlock_spell_scripts() new spell_warl_seed_of_corruption(); new spell_warl_soulshatter(); new spell_warl_life_tap(); + new spell_warl_demonic_circle_summon(); + new spell_warl_demonic_circle_teleport(); } diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 1084398c37d..0ba5c866d63 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -177,24 +177,27 @@ class spell_warr_deep_wounds : public SpellScriptLoader void HandleDummy(SpellEffIndex /* effIndex */) { int32 damage = GetEffectValue(); + Unit* caster = GetCaster(); if (Unit* target = GetHitUnit()) - if (Unit* caster = GetCaster()) - { - // apply percent damage mods - damage = caster->SpellDamageBonus(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); + { + // apply percent damage mods + damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); - ApplyPctN(damage, 16 * sSpellMgr->GetSpellRank(GetSpellInfo()->Id)); + ApplyPctN(damage, 16 * sSpellMgr->GetSpellRank(GetSpellInfo()->Id)); + + damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); + + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_DEEP_WOUNDS_RANK_PERIODIC); + uint32 ticks = spellInfo->GetDuration() / spellInfo->Effects[EFFECT_0].Amplitude; - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_DEEP_WOUNDS_RANK_PERIODIC); - uint32 ticks = spellInfo->GetDuration() / spellInfo->Effects[EFFECT_0].Amplitude; + // Add remaining ticks to damage done + if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_DEEP_WOUNDS_RANK_PERIODIC, EFFECT_0, caster->GetGUID())) + damage += aurEff->GetAmount() * (ticks - aurEff->GetTickNumber()); - // Add remaining ticks to damage done - if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_DEEP_WOUNDS_RANK_PERIODIC, EFFECT_0, caster->GetGUID())) - damage += aurEff->GetAmount() * (ticks - aurEff->GetTickNumber()); + damage = damage / ticks; - damage = damage / ticks; - caster->CastCustomSpell(target, SPELL_DEEP_WOUNDS_RANK_PERIODIC, &damage, NULL, NULL, true); - } + caster->CastCustomSpell(target, SPELL_DEEP_WOUNDS_RANK_PERIODIC, &damage, NULL, NULL, true); + } } void Register() @@ -365,7 +368,7 @@ class spell_warr_concussion_blow : public SpellScriptLoader void HandleDummy(SpellEffIndex /* effIndex */) { - SetHitDamage(GetHitDamage() + CalculatePctF(GetHitDamage(),GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK))); + SetHitDamage(CalculatePctN(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK), GetEffectValue())); } void Register() @@ -397,8 +400,7 @@ class spell_warr_bloodthirst : public SpellScriptLoader void HandleDummy(SpellEffIndex /* effIndex */) { int32 damage = GetEffectValue(); - if (GetHitUnit()) - GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_BLOODTHIRST, &damage, NULL, NULL, true, NULL); + GetCaster()->CastCustomSpell(GetCaster(), SPELL_BLOODTHIRST, &damage, NULL, NULL, true, NULL); } void Register() @@ -413,6 +415,51 @@ class spell_warr_bloodthirst : public SpellScriptLoader } }; +enum Overpower +{ + SPELL_UNRELENTING_ASSAULT_RANK_1 = 46859, + SPELL_UNRELENTING_ASSAULT_RANK_2 = 46860, + SPELL_UNRELENTING_ASSAULT_TRIGGER_1 = 64849, + SPELL_UNRELENTING_ASSAULT_TRIGGER_2 = 64850, +}; + +class spell_warr_overpower : public SpellScriptLoader +{ +public: + spell_warr_overpower() : SpellScriptLoader("spell_warr_overpower") { } + + class spell_warr_overpower_SpellScript : public SpellScript + { + PrepareSpellScript(spell_warr_overpower_SpellScript); + + void HandleEffect(SpellEffIndex /* effIndex */) + { + uint32 spellId = 0; + if (GetCaster()->HasAura(SPELL_UNRELENTING_ASSAULT_RANK_1)) + spellId = SPELL_UNRELENTING_ASSAULT_TRIGGER_1; + else if (GetCaster()->HasAura(SPELL_UNRELENTING_ASSAULT_RANK_2)) + spellId = SPELL_UNRELENTING_ASSAULT_TRIGGER_2; + + if (!spellId) + return; + + if (Player* target = GetHitPlayer()) + if (target->HasUnitState(UNIT_STATE_CASTING)) + target->CastSpell(target, spellId, true); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_warr_overpower_SpellScript::HandleEffect, EFFECT_0, SPELL_EFFECT_ANY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_warr_overpower_SpellScript(); + } +}; + void AddSC_warrior_spell_scripts() { new spell_warr_last_stand(); @@ -424,4 +471,5 @@ void AddSC_warrior_spell_scripts() new spell_warr_execute(); new spell_warr_concussion_blow(); new spell_warr_bloodthirst(); + new spell_warr_overpower(); } diff --git a/src/server/scripts/World/CMakeLists.txt b/src/server/scripts/World/CMakeLists.txt index 41ba775efec..f081a5225e4 100644 --- a/src/server/scripts/World/CMakeLists.txt +++ b/src/server/scripts/World/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/> +# Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> # # This file is free software; as a special exception the author gives # unlimited permission to copy and/or distribute it, with or without diff --git a/src/server/scripts/World/areatrigger_scripts.cpp b/src/server/scripts/World/areatrigger_scripts.cpp index 8f86f760775..daf0ef213d9 100644 --- a/src/server/scripts/World/areatrigger_scripts.cpp +++ b/src/server/scripts/World/areatrigger_scripts.cpp @@ -32,6 +32,7 @@ at_sholazar_waygate q12548 at_nats_landing q11209 at_bring_your_orphan_to q910 q910 q1800 q1479 q1687 q1558 q10951 q10952 at_brewfest +at_area_52_entrance EndContentData */ #include "ScriptPCH.h" @@ -251,8 +252,13 @@ class AreaTrigger_at_sholazar_waygate : public AreaTriggerScript { switch (trigger->id) { - case AT_SHOLAZAR: player->CastSpell(player, SPELL_SHOLAZAR_TO_UNGORO_TELEPORT, false); break; - case AT_UNGORO: player->CastSpell(player, SPELL_UNGORO_TO_SHOLAZAR_TELEPORT, false); break; + case AT_SHOLAZAR: + player->CastSpell(player, SPELL_SHOLAZAR_TO_UNGORO_TELEPORT, false); + break; + + case AT_UNGORO: + player->CastSpell(player, SPELL_UNGORO_TO_SHOLAZAR_TELEPORT, false); + break; } } @@ -420,6 +426,75 @@ class AreaTrigger_at_brewfest : public AreaTriggerScript std::map<uint32, time_t> _triggerTimes; }; +/*###### +## at_area_52_entrance +######*/ + +enum Area52Entrance +{ + SPELL_A52_NEURALYZER = 34400, + NPC_SPOTLIGHT = 19913, + SUMMON_COOLDOWN = 5, + + AT_AREA_52_SOUTH = 4472, + AT_AREA_52_NORTH = 4466, + AT_AREA_52_WEST = 4471, + AT_AREA_52_EAST = 4422, +}; + +class AreaTrigger_at_area_52_entrance : public AreaTriggerScript +{ + public: + AreaTrigger_at_area_52_entrance() : AreaTriggerScript("at_area_52_entrance") + { + _triggerTimes[AT_AREA_52_SOUTH] = _triggerTimes[AT_AREA_52_NORTH] = _triggerTimes[AT_AREA_52_WEST] = _triggerTimes[AT_AREA_52_EAST] = 0; + } + + bool OnTrigger(Player* player, AreaTriggerEntry const* trigger) + { + float x = 0.0f, y = 0.0f, z = 0.0f; + + if (!player->isAlive()) + return false; + + uint32 triggerId = trigger->id; + if (sWorld->GetGameTime() - _triggerTimes[trigger->id] < SUMMON_COOLDOWN) + return false; + + switch (triggerId) + { + case AT_AREA_52_EAST: + x = 3044.176f; + y = 3610.692f; + z = 143.61f; + break; + case AT_AREA_52_NORTH: + x = 3114.87f; + y = 3687.619f; + z = 143.62f; + break; + case AT_AREA_52_WEST: + x = 3017.79f; + y = 3746.806f; + z = 144.27f; + break; + case AT_AREA_52_SOUTH: + x = 2950.63f; + y = 3719.905f; + z = 143.33f; + break; + } + + player->SummonCreature(NPC_SPOTLIGHT, x, y, z, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 5000); + player->AddAura(SPELL_A52_NEURALYZER, player); + _triggerTimes[trigger->id] = sWorld->GetGameTime(); + return false; + } + + private: + std::map<uint32, time_t> _triggerTimes; +}; + void AddSC_areatrigger_scripts() { new AreaTrigger_at_coilfang_waterfall(); @@ -431,4 +506,5 @@ void AddSC_areatrigger_scripts() new AreaTrigger_at_nats_landing(); new AreaTrigger_at_bring_your_orphan_to(); new AreaTrigger_at_brewfest(); + new AreaTrigger_at_area_52_entrance(); } diff --git a/src/server/scripts/World/boss_emerald_dragons.cpp b/src/server/scripts/World/boss_emerald_dragons.cpp index 9f652e7a859..045dea9c9a9 100644 --- a/src/server/scripts/World/boss_emerald_dragons.cpp +++ b/src/server/scripts/World/boss_emerald_dragons.cpp @@ -198,7 +198,7 @@ class npc_dream_fog : public CreatureScript me->GetMotionMaster()->MoveRandom(25.0f); } // Seeping fog movement is slow enough for a player to be able to walk backwards and still outpace it - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(true); me->SetSpeed(MOVE_WALK, 0.75f); } else @@ -371,7 +371,7 @@ class boss_ysondre : public CreatureScript { Talk(SAY_YSONDRE_SUMMON_DRUIDS); - for (uint8 i = 0 ; i < 10 ; ++i) + for (uint8 i = 0; i < 10; ++i) DoCast(me, SPELL_SUMMON_DRUID_SPIRITS, true); ++_stage; } diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index 3dfc85d7eb4..790a9d0f814 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -34,7 +34,6 @@ go_tablet_of_madness go_tablet_of_the_seven go_tele_to_dalaran_crystal go_tele_to_violet_stand -go_rusty_cage go_scourge_cage go_jotunheim_cage go_table_theka @@ -44,7 +43,6 @@ go_ethereal_teleport_pad go_soulwell go_dragonflayer_cage go_tadpole_cage -go_black_cage go_amberpine_outhouse go_hive_pod go_gjalerbron_cage @@ -68,7 +66,7 @@ class go_cat_figurine : public GameObjectScript public: go_cat_figurine() : GameObjectScript("go_cat_figurine") { } - bool OnGossipHello(Player* player, GameObject* /*pGO*/) + bool OnGossipHello(Player* player, GameObject* /*go*/) { player->CastSpell(player, SPELL_SUMMON_GHOST_SABER, true); return false; @@ -83,12 +81,12 @@ class go_northern_crystal_pylon : public GameObjectScript public: go_northern_crystal_pylon() : GameObjectScript("go_northern_crystal_pylon") { } - bool OnGossipHello(Player* player, GameObject* pGO) + bool OnGossipHello(Player* player, GameObject* go) { - if (pGO->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) + if (go->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) { - player->PrepareQuestMenu(pGO->GetGUID()); - player->SendPreparedQuest(pGO->GetGUID()); + player->PrepareQuestMenu(go->GetGUID()); + player->SendPreparedQuest(go->GetGUID()); } if (player->GetQuestStatus(4285) == QUEST_STATUS_INCOMPLETE) @@ -103,12 +101,12 @@ class go_eastern_crystal_pylon : public GameObjectScript public: go_eastern_crystal_pylon() : GameObjectScript("go_eastern_crystal_pylon") { } - bool OnGossipHello(Player* player, GameObject* pGO) + bool OnGossipHello(Player* player, GameObject* go) { - if (pGO->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) + if (go->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) { - player->PrepareQuestMenu(pGO->GetGUID()); - player->SendPreparedQuest(pGO->GetGUID()); + player->PrepareQuestMenu(go->GetGUID()); + player->SendPreparedQuest(go->GetGUID()); } if (player->GetQuestStatus(4287) == QUEST_STATUS_INCOMPLETE) @@ -123,12 +121,12 @@ class go_western_crystal_pylon : public GameObjectScript public: go_western_crystal_pylon() : GameObjectScript("go_western_crystal_pylon") { } - bool OnGossipHello(Player* player, GameObject* pGO) + bool OnGossipHello(Player* player, GameObject* go) { - if (pGO->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) + if (go->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) { - player->PrepareQuestMenu(pGO->GetGUID()); - player->SendPreparedQuest(pGO->GetGUID()); + player->PrepareQuestMenu(go->GetGUID()); + player->SendPreparedQuest(go->GetGUID()); } if (player->GetQuestStatus(4288) == QUEST_STATUS_INCOMPLETE) @@ -147,12 +145,11 @@ class go_barov_journal : public GameObjectScript public: go_barov_journal() : GameObjectScript("go_barov_journal") { } - bool OnGossipHello(Player* player, GameObject* /*pGO*/) + bool OnGossipHello(Player* player, GameObject* /*go*/) { if (player->HasSkill(SKILL_TAILORING) && player->GetBaseSkillValue(SKILL_TAILORING) >= 280 && !player->HasSpell(26086)) - { player->CastSpell(player, 26095, false); - } + return true; } }; @@ -166,12 +163,11 @@ class go_field_repair_bot_74A : public GameObjectScript public: go_field_repair_bot_74A() : GameObjectScript("go_field_repair_bot_74A") { } - bool OnGossipHello(Player* player, GameObject* /*pGO*/) + bool OnGossipHello(Player* player, GameObject* /*go*/) { if (player->HasSkill(SKILL_ENGINEERING) && player->GetBaseSkillValue(SKILL_ENGINEERING) >= 300 && !player->HasSpell(22704)) - { player->CastSpell(player, 22864, false); - } + return true; } }; @@ -190,9 +186,9 @@ class go_gilded_brazier : public GameObjectScript public: go_gilded_brazier() : GameObjectScript("go_gilded_brazier") { } - bool OnGossipHello(Player* player, GameObject* pGO) + bool OnGossipHello(Player* player, GameObject* go) { - if (pGO->GetGoType() == GAMEOBJECT_TYPE_GOOBER) + if (go->GetGoType() == GAMEOBJECT_TYPE_GOOBER) { if (player->GetQuestStatus(9678) == QUEST_STATUS_INCOMPLETE) { @@ -213,7 +209,7 @@ class go_orb_of_command : public GameObjectScript public: go_orb_of_command() : GameObjectScript("go_orb_of_command") { } - bool OnGossipHello(Player* player, GameObject* /*pGO*/) + bool OnGossipHello(Player* player, GameObject* /*go*/) { if (player->GetQuestRewardStatus(7761)) player->CastSpell(player, 23460, true); @@ -231,12 +227,11 @@ class go_tablet_of_madness : public GameObjectScript public: go_tablet_of_madness() : GameObjectScript("go_tablet_of_madness") { } - bool OnGossipHello(Player* player, GameObject* /*pGO*/) + bool OnGossipHello(Player* player, GameObject* /*go*/) { if (player->HasSkill(SKILL_ALCHEMY) && player->GetSkillValue(SKILL_ALCHEMY) >= 300 && !player->HasSpell(24266)) - { player->CastSpell(player, 24267, false); - } + return true; } }; @@ -251,9 +246,9 @@ public: go_tablet_of_the_seven() : GameObjectScript("go_tablet_of_the_seven") { } //TODO: use gossip option ("Transcript the Tablet") instead, if Trinity adds support. - bool OnGossipHello(Player* player, GameObject* pGO) + bool OnGossipHello(Player* player, GameObject* go) { - if (pGO->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER) + if (go->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER) return true; if (player->GetQuestStatus(4296) == QUEST_STATUS_INCOMPLETE) @@ -272,10 +267,10 @@ class go_jump_a_tron : public GameObjectScript public: go_jump_a_tron() : GameObjectScript("go_jump_a_tron") { } - bool OnGossipHello(Player* player, GameObject* /*pGO*/) + bool OnGossipHello(Player* player, GameObject* /*go*/) { if (player->GetQuestStatus(10111) == QUEST_STATUS_INCOMPLETE) - player->CastSpell(player, 33382, true); + player->CastSpell(player, 33382, true); return true; } @@ -306,12 +301,11 @@ class go_ethereum_prison : public GameObjectScript public: go_ethereum_prison() : GameObjectScript("go_ethereum_prison") { } - bool OnGossipHello(Player* player, GameObject* pGO) + bool OnGossipHello(Player* player, GameObject* go) { int Random = rand() % (sizeof(NpcPrisonEntry) / sizeof(uint32)); - if (Creature* creature = player->SummonCreature(NpcPrisonEntry[Random], - pGO->GetPositionX(), pGO->GetPositionY(), pGO->GetPositionZ(), pGO->GetAngle(player), + if (Creature* creature = player->SummonCreature(NpcPrisonEntry[Random], go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), go->GetAngle(player), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) { if (!creature->IsHostileTo(player)) @@ -356,12 +350,11 @@ class go_ethereum_stasis : public GameObjectScript public: go_ethereum_stasis() : GameObjectScript("go_ethereum_stasis") { } - bool OnGossipHello(Player* player, GameObject* pGO) + bool OnGossipHello(Player* player, GameObject* go) { int Random = rand() % (sizeof(NpcStasisEntry) / sizeof(uint32)); - player->SummonCreature(NpcStasisEntry[Random], - pGO->GetPositionX(), pGO->GetPositionY(), pGO->GetPositionZ(), pGO->GetAngle(player), + player->SummonCreature(NpcStasisEntry[Random], go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), go->GetAngle(player), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); return false; @@ -382,10 +375,10 @@ class go_resonite_cask : public GameObjectScript public: go_resonite_cask() : GameObjectScript("go_resonite_cask") { } - bool OnGossipHello(Player* /*player*/, GameObject* pGO) + bool OnGossipHello(Player* /*player*/, GameObject* go) { - if (pGO->GetGoType() == GAMEOBJECT_TYPE_GOOBER) - pGO->SummonCreature(NPC_GOGGEROC, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 300000); + if (go->GetGoType() == GAMEOBJECT_TYPE_GOOBER) + go->SummonCreature(NPC_GOGGEROC, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 300000); return false; } @@ -402,9 +395,9 @@ class go_sacred_fire_of_life : public GameObjectScript public: go_sacred_fire_of_life() : GameObjectScript("go_sacred_fire_of_life") { } - bool OnGossipHello(Player* player, GameObject* pGO) + bool OnGossipHello(Player* player, GameObject* go) { - if (pGO->GetGoType() == GAMEOBJECT_TYPE_GOOBER) + if (go->GetGoType() == GAMEOBJECT_TYPE_GOOBER) player->SummonCreature(NPC_ARIKARA, -5008.338f, -2118.894f, 83.657f, 0.874f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); return true; @@ -430,14 +423,14 @@ class go_shrine_of_the_birds : public GameObjectScript public: go_shrine_of_the_birds() : GameObjectScript("go_shrine_of_the_birds") { } - bool OnGossipHello(Player* player, GameObject* pGO) + bool OnGossipHello(Player* player, GameObject* go) { uint32 BirdEntry = 0; float fX, fY, fZ; - pGO->GetClosePoint(fX, fY, fZ, pGO->GetObjectSize(), INTERACTION_DISTANCE); + go->GetClosePoint(fX, fY, fZ, go->GetObjectSize(), INTERACTION_DISTANCE); - switch (pGO->GetEntry()) + switch (go->GetEntry()) { case GO_SHRINE_HAWK: BirdEntry = NPC_HAWK_GUARD; @@ -451,7 +444,7 @@ public: } if (BirdEntry) - player->SummonCreature(BirdEntry, fX, fY, fZ, pGO->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + player->SummonCreature(BirdEntry, fX, fY, fZ, go->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); return false; } @@ -473,7 +466,7 @@ class go_southfury_moonstone : public GameObjectScript public: go_southfury_moonstone() : GameObjectScript("go_southfury_moonstone") { } - bool OnGossipHello(Player* player, GameObject* /*pGO*/) + bool OnGossipHello(Player* player, GameObject* /*go*/) { //implicitTarget=48 not implemented as of writing this code, and manual summon may be just ok for our purpose //player->CastSpell(player, SPELL_SUMMON_RIZZLE, false); @@ -496,19 +489,18 @@ enum eDalaranCrystal }; #define GO_TELE_TO_DALARAN_CRYSTAL_FAILED "This teleport crystal cannot be used until the teleport crystal in Dalaran has been used at least once." + class go_tele_to_dalaran_crystal : public GameObjectScript { public: go_tele_to_dalaran_crystal() : GameObjectScript("go_tele_to_dalaran_crystal") { } - bool OnGossipHello(Player* player, GameObject* /*pGO*/) + bool OnGossipHello(Player* player, GameObject* /*go*/) { if (player->GetQuestRewardStatus(QUEST_TELE_CRYSTAL_FLAG)) - { return false; - } - else - player->GetSession()->SendNotification(GO_TELE_TO_DALARAN_CRYSTAL_FAILED); + + player->GetSession()->SendNotification(GO_TELE_TO_DALARAN_CRYSTAL_FAILED); return true; } @@ -523,7 +515,7 @@ class go_tele_to_violet_stand : public GameObjectScript public: go_tele_to_violet_stand() : GameObjectScript("go_tele_to_violet_stand") { } - bool OnGossipHello(Player* player, GameObject* /*pGO*/) + bool OnGossipHello(Player* player, GameObject* /*go*/) { if (player->GetQuestRewardStatus(QUEST_LEARN_LEAVE_RETURN) || player->GetQuestStatus(QUEST_LEARN_LEAVE_RETURN) == QUEST_STATUS_INCOMPLETE) return false; @@ -553,38 +545,38 @@ class go_fel_crystalforge : public GameObjectScript public: go_fel_crystalforge() : GameObjectScript("go_fel_crystalforge") { } - bool OnGossipHello(Player* player, GameObject* pGO) + bool OnGossipHello(Player* player, GameObject* go) { - if (pGO->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) /* != GAMEOBJECT_TYPE_QUESTGIVER) */ - player->PrepareQuestMenu(pGO->GetGUID()); /* return true*/ + if (go->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) /* != GAMEOBJECT_TYPE_QUESTGIVER) */ + player->PrepareQuestMenu(go->GetGUID()); /* return true*/ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_FEL_CRYSTALFORGE_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_FEL_CRYSTALFORGE_ITEM_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - player->SEND_GOSSIP_MENU(GOSSIP_FEL_CRYSTALFORGE_TEXT, pGO->GetGUID()); + player->SEND_GOSSIP_MENU(GOSSIP_FEL_CRYSTALFORGE_TEXT, go->GetGUID()); return true; } - bool OnGossipSelect(Player* player, GameObject* pGO, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, GameObject* go, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF: player->CastSpell(player, SPELL_CREATE_1_FLASK_OF_BEAST, false); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_FEL_CRYSTALFORGE_ITEM_RETURN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - player->SEND_GOSSIP_MENU(GOSSIP_FEL_CRYSTALFORGE_ITEM_TEXT_RETURN, pGO->GetGUID()); + player->SEND_GOSSIP_MENU(GOSSIP_FEL_CRYSTALFORGE_ITEM_TEXT_RETURN, go->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 1: player->CastSpell(player, SPELL_CREATE_5_FLASK_OF_BEAST, false); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_FEL_CRYSTALFORGE_ITEM_RETURN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - player->SEND_GOSSIP_MENU(GOSSIP_FEL_CRYSTALFORGE_ITEM_TEXT_RETURN, pGO->GetGUID()); + player->SEND_GOSSIP_MENU(GOSSIP_FEL_CRYSTALFORGE_ITEM_TEXT_RETURN, go->GetGUID()); break; - case GOSSIP_ACTION_INFO_DEF + 2: + case GOSSIP_ACTION_INFO_DEF + 2: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_FEL_CRYSTALFORGE_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_FEL_CRYSTALFORGE_ITEM_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - player->SEND_GOSSIP_MENU(GOSSIP_FEL_CRYSTALFORGE_TEXT, pGO->GetGUID()); + player->SEND_GOSSIP_MENU(GOSSIP_FEL_CRYSTALFORGE_TEXT, go->GetGUID()); break; } return true; @@ -612,38 +604,38 @@ class go_bashir_crystalforge : public GameObjectScript public: go_bashir_crystalforge() : GameObjectScript("go_bashir_crystalforge") { } - bool OnGossipHello(Player* player, GameObject* pGO) + bool OnGossipHello(Player* player, GameObject* go) { - if (pGO->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) /* != GAMEOBJECT_TYPE_QUESTGIVER) */ - player->PrepareQuestMenu(pGO->GetGUID()); /* return true*/ + if (go->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) /* != GAMEOBJECT_TYPE_QUESTGIVER) */ + player->PrepareQuestMenu(go->GetGUID()); /* return true*/ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BASHIR_CRYSTALFORGE_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BASHIR_CRYSTALFORGE_ITEM_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - player->SEND_GOSSIP_MENU(GOSSIP_BASHIR_CRYSTALFORGE_TEXT, pGO->GetGUID()); + player->SEND_GOSSIP_MENU(GOSSIP_BASHIR_CRYSTALFORGE_TEXT, go->GetGUID()); return true; } - bool OnGossipSelect(Player* player, GameObject* pGO, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, GameObject* go, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF: player->CastSpell(player, SPELL_CREATE_1_FLASK_OF_SORCERER, false); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BASHIR_CRYSTALFORGE_ITEM_RETURN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - player->SEND_GOSSIP_MENU(GOSSIP_BASHIR_CRYSTALFORGE_ITEM_TEXT_RETURN, pGO->GetGUID()); + player->SEND_GOSSIP_MENU(GOSSIP_BASHIR_CRYSTALFORGE_ITEM_TEXT_RETURN, go->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 1: player->CastSpell(player, SPELL_CREATE_5_FLASK_OF_SORCERER, false); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BASHIR_CRYSTALFORGE_ITEM_RETURN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - player->SEND_GOSSIP_MENU(GOSSIP_BASHIR_CRYSTALFORGE_ITEM_TEXT_RETURN, pGO->GetGUID()); + player->SEND_GOSSIP_MENU(GOSSIP_BASHIR_CRYSTALFORGE_ITEM_TEXT_RETURN, go->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 2: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BASHIR_CRYSTALFORGE_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BASHIR_CRYSTALFORGE_ITEM_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - player->SEND_GOSSIP_MENU(GOSSIP_BASHIR_CRYSTALFORGE_TEXT, pGO->GetGUID()); + player->SEND_GOSSIP_MENU(GOSSIP_BASHIR_CRYSTALFORGE_TEXT, go->GetGUID()); break; } return true; @@ -676,9 +668,9 @@ class go_matrix_punchograph : public GameObjectScript public: go_matrix_punchograph() : GameObjectScript("go_matrix_punchograph") { } - bool OnGossipHello(Player* player, GameObject* pGO) + bool OnGossipHello(Player* player, GameObject* go) { - switch (pGO->GetEntry()) + switch (go->GetEntry()) { case MATRIX_PUNCHOGRAPH_3005_A: if (player->HasItemCount(ITEM_WHITE_PUNCH_CARD, 1)) @@ -716,33 +708,6 @@ public: }; /*###### -## go_rusty_cage -######*/ - -enum eRustyCage -{ - NPC_GOBLIN_PRISIONER = 29466 -}; - -class go_rusty_cage : public GameObjectScript -{ -public: - go_rusty_cage() : GameObjectScript("go_rusty_cage") { } - - bool OnGossipHello(Player* player, GameObject* pGO) - { - if (Creature* pGoblinPrisoner = pGO->FindNearestCreature(NPC_GOBLIN_PRISIONER, 5.0f, true)) - { - pGO->SetGoState(GO_STATE_ACTIVE); - player->KilledMonsterCredit(NPC_GOBLIN_PRISIONER, pGoblinPrisoner->GetGUID()); - pGoblinPrisoner->DisappearAndDie(); - } - - return true; - } -}; - -/*###### ## go_scourge_cage ######*/ @@ -756,11 +721,11 @@ class go_scourge_cage : public GameObjectScript public: go_scourge_cage() : GameObjectScript("go_scourge_cage") { } - bool OnGossipHello(Player* player, GameObject* pGO) + bool OnGossipHello(Player* player, GameObject* go) { - if (Creature* pNearestPrisoner = pGO->FindNearestCreature(NPC_SCOURGE_PRISONER, 5.0f, true)) + if (Creature* pNearestPrisoner = go->FindNearestCreature(NPC_SCOURGE_PRISONER, 5.0f, true)) { - pGO->SetGoState(GO_STATE_ACTIVE); + go->SetGoState(GO_STATE_ACTIVE); player->KilledMonsterCredit(NPC_SCOURGE_PRISONER, pNearestPrisoner->GetGUID()); pNearestPrisoner->DisappearAndDie(); } @@ -784,15 +749,15 @@ class go_arcane_prison : public GameObjectScript public: go_arcane_prison() : GameObjectScript("go_arcane_prison") { } - bool OnGossipHello(Player* player, GameObject* pGO) + bool OnGossipHello(Player* player, GameObject* go) { if (player->GetQuestStatus(QUEST_PRISON_BREAK) == QUEST_STATUS_INCOMPLETE) { - pGO->SummonCreature(25318, 3485.089844f, 6115.7422188f, 70.966812f, 0, TEMPSUMMON_TIMED_DESPAWN, 60000); + go->SummonCreature(25318, 3485.089844f, 6115.7422188f, 70.966812f, 0, TEMPSUMMON_TIMED_DESPAWN, 60000); player->CastSpell(player, SPELL_ARCANE_PRISONER_KILL_CREDIT, true); return true; - } else - return false; + } + return false; } }; @@ -807,9 +772,9 @@ class go_blood_filled_orb : public GameObjectScript public: go_blood_filled_orb() : GameObjectScript("go_blood_filled_orb") { } - bool OnGossipHello(Player* player, GameObject* pGO) + bool OnGossipHello(Player* player, GameObject* go) { - if (pGO->GetGoType() == GAMEOBJECT_TYPE_GOOBER) + if (go->GetGoType() == GAMEOBJECT_TYPE_GOOBER) player->SummonCreature(NPC_ZELEMAR, -369.746f, 166.759f, -21.50f, 5.235f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); return true; @@ -838,17 +803,17 @@ class go_jotunheim_cage : public GameObjectScript public: go_jotunheim_cage() : GameObjectScript("go_jotunheim_cage") { } - bool OnGossipHello(Player* player, GameObject* pGO) + bool OnGossipHello(Player* player, GameObject* go) { - Creature* pPrisoner = pGO->FindNearestCreature(NPC_EBON_BLADE_PRISONER_HUMAN, 5.0f, true); + Creature* pPrisoner = go->FindNearestCreature(NPC_EBON_BLADE_PRISONER_HUMAN, 5.0f, true); if (!pPrisoner) { - pPrisoner = pGO->FindNearestCreature(NPC_EBON_BLADE_PRISONER_TROLL, 5.0f, true); + pPrisoner = go->FindNearestCreature(NPC_EBON_BLADE_PRISONER_TROLL, 5.0f, true); if (!pPrisoner) { - pPrisoner = pGO->FindNearestCreature(NPC_EBON_BLADE_PRISONER_ORC, 5.0f, true); + pPrisoner = go->FindNearestCreature(NPC_EBON_BLADE_PRISONER_ORC, 5.0f, true); if (!pPrisoner) - pPrisoner = pGO->FindNearestCreature(NPC_EBON_BLADE_PRISONER_NE, 5.0f, true); + pPrisoner = go->FindNearestCreature(NPC_EBON_BLADE_PRISONER_NE, 5.0f, true); } } if (!pPrisoner || !pPrisoner->isAlive()) @@ -887,12 +852,12 @@ class go_table_theka : public GameObjectScript public: go_table_theka() : GameObjectScript("go_table_theka") { } - bool OnGossipHello(Player* player, GameObject* pGO) + bool OnGossipHello(Player* player, GameObject* go) { if (player->GetQuestStatus(QUEST_SPIDER_GOLD) == QUEST_STATUS_INCOMPLETE) player->AreaExploredOrEventHappens(QUEST_SPIDER_GOLD); - player->SEND_GOSSIP_MENU(GOSSIP_TABLE_THEKA, pGO->GetGUID()); + player->SEND_GOSSIP_MENU(GOSSIP_TABLE_THEKA, go->GetGUID()); return true; } @@ -913,7 +878,7 @@ class go_inconspicuous_landmark : public GameObjectScript public: go_inconspicuous_landmark() : GameObjectScript("go_inconspicuous_landmark") { } - bool OnGossipHello(Player* player, GameObject* /*pGO*/) + bool OnGossipHello(Player* player, GameObject* /*go*/) { if (player->HasItemCount(ITEM_CUERGOS_KEY, 1)) return false; @@ -939,12 +904,12 @@ class go_ethereal_teleport_pad : public GameObjectScript public: go_ethereal_teleport_pad() : GameObjectScript("go_ethereal_teleport_pad") { } - bool OnGossipHello(Player* player, GameObject* pGO) + bool OnGossipHello(Player* player, GameObject* go) { if (!player->HasItemCount(ITEM_TELEPORTER_POWER_PACK, 1)) return false; - pGO->SummonCreature(NPC_IMAGE_WIND_TRADER, pGO->GetPositionX(), pGO->GetPositionY(), pGO->GetPositionZ(), pGO->GetAngle(player), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); + go->SummonCreature(NPC_IMAGE_WIND_TRADER, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), go->GetAngle(player), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); return true; } @@ -959,9 +924,9 @@ class go_soulwell : public GameObjectScript public: go_soulwell() : GameObjectScript("go_soulwell") { } - bool OnGossipHello(Player* player, GameObject* pGO) + bool OnGossipHello(Player* player, GameObject* go) { - Unit* caster = pGO->GetOwner(); + Unit* caster = go->GetOwner(); if (!caster || caster->GetTypeId() != TYPEID_PLAYER) return true; @@ -972,7 +937,7 @@ public: // GO scripting with at least On Create and On Update events, the other options are no less // ugly and hacky. uint32 newSpell = 0; - if (pGO->GetEntry() == 193169) // Soulwell for rank 2 + if (go->GetEntry() == 193169) // Soulwell for rank 2 { if (caster->HasAura(18693)) // Improved Healthstone rank 2 newSpell = 58898; @@ -980,7 +945,7 @@ public: newSpell = 58896; else newSpell = 58890; } - else if (pGO->GetEntry() == 181621) // Soulwell for rank 1 + else if (go->GetEntry() == 181621) // Soulwell for rank 1 { if (caster->HasAura(18693)) // Improved Healthstone rank 2 newSpell = 34150; @@ -989,7 +954,7 @@ public: else newSpell = 34130; } - pGO->AddUse(); + go->AddUse(); player->CastSpell(player, newSpell, true); return true; } @@ -1014,20 +979,20 @@ class go_dragonflayer_cage : public GameObjectScript public: go_dragonflayer_cage() : GameObjectScript("go_dragonflayer_cage") { } - bool OnGossipHello(Player* player, GameObject* pGO) + bool OnGossipHello(Player* player, GameObject* go) { if (player->GetQuestStatus(QUEST_PRISONERS_OF_WYRMSKULL) != QUEST_STATUS_INCOMPLETE) return true; - Creature* pPrisoner = pGO->FindNearestCreature(NPC_PRISONER_PRIEST, 2.0f); + Creature* pPrisoner = go->FindNearestCreature(NPC_PRISONER_PRIEST, 2.0f); if (!pPrisoner) { - pPrisoner = pGO->FindNearestCreature(NPC_PRISONER_MAGE, 2.0f); + pPrisoner = go->FindNearestCreature(NPC_PRISONER_MAGE, 2.0f); if (!pPrisoner) { - pPrisoner = pGO->FindNearestCreature(NPC_PRISONER_WARRIOR, 2.0f); + pPrisoner = go->FindNearestCreature(NPC_PRISONER_WARRIOR, 2.0f); if (!pPrisoner) - pPrisoner = pGO->FindNearestCreature(NPC_PRISONER_PALADIN, 2.0f); + pPrisoner = go->FindNearestCreature(NPC_PRISONER_PALADIN, 2.0f); } } @@ -1061,14 +1026,14 @@ class go_tadpole_cage : public GameObjectScript public: go_tadpole_cage() : GameObjectScript("go_tadpole_cage") { } - bool OnGossipHello(Player* player, GameObject* pGO) + bool OnGossipHello(Player* player, GameObject* go) { if (player->GetQuestStatus(QUEST_OH_NOES_THE_TADPOLES) == QUEST_STATUS_INCOMPLETE) { - Creature* pTadpole = pGO->FindNearestCreature(NPC_WINTERFIN_TADPOLE, 1.0f); + Creature* pTadpole = go->FindNearestCreature(NPC_WINTERFIN_TADPOLE, 1.0f); if (pTadpole) { - pGO->UseDoorOrButton(); + go->UseDoorOrButton(); pTadpole->DisappearAndDie(); player->KilledMonsterCredit(NPC_WINTERFIN_TADPOLE, 0); //FIX: Summon minion tadpole @@ -1079,43 +1044,6 @@ public: }; /*###### -## Quest 14096 & 14142: You've Really Done It This Time, Kul -## go_black_cage -######*/ - -enum eReallyDoneItThisTime -{ - QUEST_ALLIANCE_YOU_VE_REALLY_DONE_IT_THIS_TIME_KUL = 14096, - QUEST_HORDE_YOU_VE_REALLY_DONE_IT_THIS_TIME_KUL = 14142, - NPC_CAPTIVE_ASPIRANT = 34716, - NPC_KUL = 34956 -}; - -class go_black_cage : public GameObjectScript -{ -public: - go_black_cage() : GameObjectScript("go_black_cage") { } - - bool OnGossipHello(Player* player, GameObject* pGO) - { - if ((player->GetTeamId() == TEAM_ALLIANCE && player->GetQuestStatus(QUEST_ALLIANCE_YOU_VE_REALLY_DONE_IT_THIS_TIME_KUL) == QUEST_STATUS_INCOMPLETE) || - (player->GetTeamId() == TEAM_HORDE && player->GetQuestStatus(QUEST_HORDE_YOU_VE_REALLY_DONE_IT_THIS_TIME_KUL) == QUEST_STATUS_INCOMPLETE)) - { - Creature* pPrisoner = pGO->FindNearestCreature(NPC_CAPTIVE_ASPIRANT, 1.0f); - if (!pPrisoner) - pPrisoner = pGO->FindNearestCreature(NPC_KUL, 1.0f); - if (pPrisoner) - { - pGO->UseDoorOrButton(); - pPrisoner->DisappearAndDie(); - player->KilledMonsterCredit(pPrisoner->GetEntry(), 0); - } - } - return true; - } -}; - -/*###### ## go_amberpine_outhouse ######*/ @@ -1139,35 +1067,35 @@ class go_amberpine_outhouse : public GameObjectScript public: go_amberpine_outhouse() : GameObjectScript("go_amberpine_outhouse") { } - bool OnGossipHello(Player* player, GameObject* pGO) + bool OnGossipHello(Player* player, GameObject* go) { QuestStatus status = player->GetQuestStatus(QUEST_DOING_YOUR_DUTY); if (status == QUEST_STATUS_INCOMPLETE || status == QUEST_STATUS_COMPLETE || status == QUEST_STATUS_REWARDED) { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_USE_OUTHOUSE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - player->SEND_GOSSIP_MENU(GOSSIP_OUTHOUSE_VACANT, pGO->GetGUID()); + player->SEND_GOSSIP_MENU(GOSSIP_OUTHOUSE_VACANT, go->GetGUID()); return true; } else - player->SEND_GOSSIP_MENU(GOSSIP_OUTHOUSE_INUSE, pGO->GetGUID()); + player->SEND_GOSSIP_MENU(GOSSIP_OUTHOUSE_INUSE, go->GetGUID()); return true; } - bool OnGossipSelect(Player* player, GameObject* pGO, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, GameObject* go, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF +1) + if (action == GOSSIP_ACTION_INFO_DEF +1) { player->CLOSE_GOSSIP_MENU(); Creature* target = GetClosestCreatureWithEntry(player, NPC_OUTHOUSE_BUNNY, 3.0f); if (target) { target->AI()->SetData(1, player->getGender()); - pGO->CastSpell(target, SPELL_INDISPOSED_III); + go->CastSpell(target, SPELL_INDISPOSED_III); } - pGO->CastSpell(player, SPELL_INDISPOSED); + go->CastSpell(player, SPELL_INDISPOSED); if (player->HasItemCount(ITEM_ANDERHOLS_SLIDER_CIDER, 1)) - pGO->CastSpell(player, SPELL_CREATE_AMBERSEEDS); + go->CastSpell(player, SPELL_CREATE_AMBERSEEDS); return true; } else @@ -1195,11 +1123,11 @@ class go_hive_pod : public GameObjectScript public: go_hive_pod() : GameObjectScript("go_hive_pod") { } - bool OnGossipHello(Player* player, GameObject* pGO) + bool OnGossipHello(Player* player, GameObject* go) { - player->SendLoot(pGO->GetGUID(), LOOT_CORPSE); - pGO->SummonCreature(NPC_HIVE_AMBUSHER, pGO->GetPositionX()+1, pGO->GetPositionY(), pGO->GetPositionZ(), pGO->GetAngle(player), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); - pGO->SummonCreature(NPC_HIVE_AMBUSHER, pGO->GetPositionX(), pGO->GetPositionY()+1, pGO->GetPositionZ(), pGO->GetAngle(player), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); + player->SendLoot(go->GetGUID(), LOOT_CORPSE); + go->SummonCreature(NPC_HIVE_AMBUSHER, go->GetPositionX()+1, go->GetPositionY(), go->GetPositionZ(), go->GetAngle(player), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); + go->SummonCreature(NPC_HIVE_AMBUSHER, go->GetPositionX(), go->GetPositionY()+1, go->GetPositionZ(), go->GetAngle(player), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); return true; } }; @@ -1246,7 +1174,7 @@ class go_gjalerbron_cage : public GameObjectScript player->KilledMonsterCredit(NPC_GJALERBRON_PRISONER, 0); prisoner->AI()->Talk(SAY_FREE); - prisoner->ForcedDespawn(6000); + prisoner->DespawnOrUnsummon(6000); } } return true; @@ -1273,7 +1201,7 @@ class go_large_gjalerbron_cage : public GameObjectScript { go->UseDoorOrButton(); player->KilledMonsterCredit(NPC_GJALERBRON_PRISONER, (*itr)->GetGUID()); - (*itr)->ForcedDespawn(6000); + (*itr)->DespawnOrUnsummon(6000); (*itr)->AI()->Talk(SAY_FREE); } } @@ -1307,7 +1235,7 @@ class go_veil_skith_cage : public GameObjectScript { go->UseDoorOrButton(); player->KilledMonsterCredit(NPC_CAPTIVE_CHILD, (*itr)->GetGUID()); - (*itr)->ForcedDespawn(5000); + (*itr)->DespawnOrUnsummon(5000); (*itr)->GetMotionMaster()->MovePoint(1, go->GetPositionX()+5, go->GetPositionY(), go->GetPositionZ()); (*itr)->AI()->Talk(SAY_FREE_0); (*itr)->GetMotionMaster()->Clear(); @@ -1341,7 +1269,6 @@ void AddSC_go_scripts() new go_fel_crystalforge; new go_bashir_crystalforge; new go_matrix_punchograph; - new go_rusty_cage; new go_scourge_cage; new go_arcane_prison; new go_blood_filled_orb; @@ -1352,7 +1279,6 @@ void AddSC_go_scripts() new go_soulwell; new go_tadpole_cage; new go_dragonflayer_cage; - new go_black_cage; new go_amberpine_outhouse; new go_hive_pod; new go_massive_seaforium_charge; diff --git a/src/server/scripts/World/guards.cpp b/src/server/scripts/World/guards.cpp index 9bc511931b9..e3100522fbe 100644 --- a/src/server/scripts/World/guards.cpp +++ b/src/server/scripts/World/guards.cpp @@ -177,7 +177,6 @@ public: //Set our global cooldown globalCooldown = GENERIC_CREATURE_COOLDOWN; - } //If no spells available and we arn't moving run to target else if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != CHASE_MOTION_TYPE) { @@ -196,12 +195,26 @@ public: { switch (emote) { - case TEXT_EMOTE_KISS: me->HandleEmoteCommand(EMOTE_ONESHOT_BOW); break; - case TEXT_EMOTE_WAVE: me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); break; - case TEXT_EMOTE_SALUTE: me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); break; - case TEXT_EMOTE_SHY: me->HandleEmoteCommand(EMOTE_ONESHOT_FLEX); break; + case TEXT_EMOTE_KISS: + me->HandleEmoteCommand(EMOTE_ONESHOT_BOW); + break; + + case TEXT_EMOTE_WAVE: + me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); + break; + + case TEXT_EMOTE_SALUTE: + me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); + break; + + case TEXT_EMOTE_SHY: + me->HandleEmoteCommand(EMOTE_ONESHOT_FLEX); + break; + case TEXT_EMOTE_RUDE: - case TEXT_EMOTE_CHICKEN: me->HandleEmoteCommand(EMOTE_ONESHOT_POINT); break; + case TEXT_EMOTE_CHICKEN: + me->HandleEmoteCommand(EMOTE_ONESHOT_POINT); + break; } } diff --git a/src/server/scripts/World/item_scripts.cpp b/src/server/scripts/World/item_scripts.cpp index 165ef9f18b1..ae69744ea2b 100644 --- a/src/server/scripts/World/item_scripts.cpp +++ b/src/server/scripts/World/item_scripts.cpp @@ -47,9 +47,9 @@ class item_only_for_flight : public ItemScript public: item_only_for_flight() : ItemScript("item_only_for_flight") { } - bool OnUse(Player* player, Item* pItem, SpellCastTargets const& /*targets*/) + bool OnUse(Player* player, Item* item, SpellCastTargets const& /*targets*/) { - uint32 itemId = pItem->GetEntry(); + uint32 itemId = item->GetEntry(); bool disabled = false; //for special scripts @@ -64,8 +64,8 @@ public: disabled = true; break; case 34475: - if (const SpellInfo* pSpellInfo = sSpellMgr->GetSpellInfo(SPELL_ARCANE_CHARGES)) - Spell::SendCastResult(player, pSpellInfo, 1, SPELL_FAILED_NOT_ON_GROUND); + if (const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(SPELL_ARCANE_CHARGES)) + Spell::SendCastResult(player, spellInfo, 1, SPELL_FAILED_NOT_ON_GROUND); break; } @@ -74,7 +74,7 @@ public: return false; // error - player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pItem, NULL); + player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, NULL); return true; } }; @@ -94,6 +94,7 @@ public: { if (Creature* nether = player->SummonCreature(22408, player->GetPositionX(), player->GetPositionY()+20, player->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 180000)) nether->AI()->AttackStart(player); + if (Creature* nether = player->SummonCreature(22408, player->GetPositionX(), player->GetPositionY()-20, player->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 180000)) nether->AI()->AttackStart(player); } @@ -110,13 +111,13 @@ class item_gor_dreks_ointment : public ItemScript public: item_gor_dreks_ointment() : ItemScript("item_gor_dreks_ointment") { } - bool OnUse(Player* player, Item* pItem, SpellCastTargets const& targets) + bool OnUse(Player* player, Item* item, SpellCastTargets const& targets) { if (targets.GetUnitTarget() && targets.GetUnitTarget()->GetTypeId() == TYPEID_UNIT && targets.GetUnitTarget()->GetEntry() == 20748 && !targets.GetUnitTarget()->HasAura(32578)) return false; - player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pItem, NULL); + player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, NULL); return true; } }; @@ -130,13 +131,13 @@ class item_incendiary_explosives : public ItemScript public: item_incendiary_explosives() : ItemScript("item_incendiary_explosives") { } - bool OnUse(Player* player, Item* pItem, SpellCastTargets const & /*targets*/) + bool OnUse(Player* player, Item* item, SpellCastTargets const & /*targets*/) { if (player->FindNearestCreature(26248, 15) || player->FindNearestCreature(26249, 15)) return false; else { - player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, pItem, NULL); + player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, item, NULL); return true; } } @@ -150,6 +151,7 @@ class item_mysterious_egg : public ItemScript { public: item_mysterious_egg() : ItemScript("item_mysterious_egg") { } + bool OnExpire(Player* player, ItemTemplate const* /*pItemProto*/) { ItemPosCountVec dest; @@ -219,7 +221,7 @@ class item_pile_fake_furs : public ItemScript public: item_pile_fake_furs() : ItemScript("item_pile_fake_furs") { } - bool OnUse(Player* player, Item* /*pItem*/, SpellCastTargets const & /*targets*/) + bool OnUse(Player* player, Item* /*item*/, SpellCastTargets const & /*targets*/) { GameObject* go = NULL; for (uint8 i = 0; i < CaribouTrapsNum; ++i) @@ -264,17 +266,17 @@ class item_petrov_cluster_bombs : public ItemScript public: item_petrov_cluster_bombs() : ItemScript("item_petrov_cluster_bombs") { } - bool OnUse(Player* player, Item* pItem, const SpellCastTargets & /*pTargets*/) + bool OnUse(Player* player, Item* item, const SpellCastTargets & /*targets*/) { if (player->GetZoneId() != ZONE_ID_HOWLING) return false; if (!player->GetTransport() || player->GetAreaId() != AREA_ID_SHATTERED_STRAITS) { - player->SendEquipError(EQUIP_ERR_NONE, pItem, NULL); + player->SendEquipError(EQUIP_ERR_NONE, item, NULL); - if (const SpellInfo* pSpellInfo = sSpellMgr->GetSpellInfo(SPELL_PETROV_BOMB)) - Spell::SendCastResult(player, pSpellInfo, 1, SPELL_FAILED_NOT_HERE); + if (const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(SPELL_PETROV_BOMB)) + Spell::SendCastResult(player, spellInfo, 1, SPELL_FAILED_NOT_HERE); return true; } @@ -330,17 +332,16 @@ class item_dehta_trap_smasher : public ItemScript public: item_dehta_trap_smasher() : ItemScript("item_dehta_trap_smasher") { } - bool OnUse(Player* player, Item* /*pItem*/, const SpellCastTargets & /*pTargets*/) + bool OnUse(Player* player, Item* /*item*/, const SpellCastTargets & /*targets*/) { if (player->GetQuestStatus(QUEST_CANNOT_HELP_THEMSELVES) != QUEST_STATUS_INCOMPLETE) return false; - Creature* pMammoth; - pMammoth = player->FindNearestCreature(NPC_TRAPPED_MAMMOTH_CALF, 5.0f); + Creature* pMammoth = player->FindNearestCreature(NPC_TRAPPED_MAMMOTH_CALF, 5.0f); if (!pMammoth) return false; - GameObject* pTrap; + GameObject* pTrap = NULL; for (uint8 i = 0; i < MammothTrapsNum; ++i) { pTrap = player->FindNearestGameObject(MammothTraps[i], 11.0f); @@ -367,7 +368,7 @@ class item_trident_of_nazjan : public ItemScript public: item_trident_of_nazjan() : ItemScript("item_Trident_of_Nazjan") { } - bool OnUse(Player* player, Item* pItem, const SpellCastTargets & /*pTargets*/) + bool OnUse(Player* player, Item* item, const SpellCastTargets & /*targets*/) { if (player->GetQuestStatus(QUEST_THE_EMISSARY) == QUEST_STATUS_INCOMPLETE) { @@ -376,9 +377,9 @@ public: pLeviroth->AI()->AttackStart(player); return false; } else - player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, pItem, NULL); + player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, item, NULL); } else - player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pItem, NULL); + player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, NULL); return true; } }; @@ -394,17 +395,17 @@ class item_captured_frog : public ItemScript public: item_captured_frog() : ItemScript("item_captured_frog") { } - bool OnUse(Player* player, Item* pItem, SpellCastTargets const& /*targets*/) + bool OnUse(Player* player, Item* item, SpellCastTargets const& /*targets*/) { if (player->GetQuestStatus(QUEST_THE_PERFECT_SPIES) == QUEST_STATUS_INCOMPLETE) { if (player->FindNearestCreature(NPC_VANIRAS_SENTRY_TOTEM, 10.0f)) return false; else - player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, pItem, NULL); + player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, item, NULL); } else - player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pItem, NULL); + player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, NULL); return true; } }; diff --git a/src/server/scripts/World/mob_generic_creature.cpp b/src/server/scripts/World/mob_generic_creature.cpp index 3a61b9f9e18..208effee61b 100644 --- a/src/server/scripts/World/mob_generic_creature.cpp +++ b/src/server/scripts/World/mob_generic_creature.cpp @@ -34,7 +34,7 @@ public: struct generic_creatureAI : public ScriptedAI { - generic_creatureAI(Creature* c) : ScriptedAI(c) {} + generic_creatureAI(Creature* creature) : ScriptedAI(creature) {} uint32 GlobalCooldown; //This variable acts like the global cooldown that players have (1.5 seconds) uint32 BuffTimer; //This variable keeps track of buffs @@ -105,7 +105,7 @@ public: else info = SelectSpell(me->getVictim(), 0, 0, SELECT_TARGET_ANY_ENEMY, 0, 0, 0, 0, SELECT_EFFECT_DONTCARE); //50% chance if elite or higher, 20% chance if not, to replace our white hit with a spell - if (info && (rand() % (me->GetCreatureInfo()->rank > 1 ? 2 : 5) == 0) && !GlobalCooldown) + if (info && (rand() % (me->GetCreatureTemplate()->rank > 1 ? 2 : 5) == 0) && !GlobalCooldown) { //Cast the spell if (Healing)DoCastSpell(me, info); @@ -174,7 +174,7 @@ public: struct trigger_periodicAI : public NullCreatureAI { - trigger_periodicAI(Creature* c) : NullCreatureAI(c) + trigger_periodicAI(Creature* creature) : NullCreatureAI(creature) { spell = me->m_spells[0] ? sSpellMgr->GetSpellInfo(me->m_spells[0]) : NULL; interval = me->GetAttackTime(BASE_ATTACK); @@ -210,7 +210,7 @@ public: struct trigger_deathAI : public NullCreatureAI { - trigger_deathAI(Creature* c) : NullCreatureAI(c) {} + trigger_deathAI(Creature* creature) : NullCreatureAI(creature) {} void JustDied(Unit* killer) { if (me->m_spells[0]) diff --git a/src/server/scripts/World/npc_innkeeper.cpp b/src/server/scripts/World/npc_innkeeper.cpp index 334eb48cb05..fb7c0833d22 100644 --- a/src/server/scripts/World/npc_innkeeper.cpp +++ b/src/server/scripts/World/npc_innkeeper.cpp @@ -79,10 +79,10 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+HALLOWEEN_EVENTID && IsEventActive(HALLOWEEN_EVENTID) && !player->HasAura(SPELL_TRICK_OR_TREATED)) + if (action == GOSSIP_ACTION_INFO_DEF+HALLOWEEN_EVENTID && IsEventActive(HALLOWEEN_EVENTID) && !player->HasAura(SPELL_TRICK_OR_TREATED)) { player->CastSpell(player, SPELL_TRICK_OR_TREATED, true); @@ -116,7 +116,7 @@ public: player->CLOSE_GOSSIP_MENU(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_TRADE: player->GetSession()->SendListInventory(creature->GetGUID()); break; case GOSSIP_ACTION_INN: player->SetBindPoint(creature->GetGUID()); break; diff --git a/src/server/scripts/World/npc_professions.cpp b/src/server/scripts/World/npc_professions.cpp index 336e232236d..2afa80dd42c 100644 --- a/src/server/scripts/World/npc_professions.cpp +++ b/src/server/scripts/World/npc_professions.cpp @@ -83,11 +83,8 @@ there is no difference here (except that default text is chosen with `gameobject #define BOX_UNLEARN_WEAPON_SPEC "Do you really want to unlearn your weaponsmith specialty and lose all associated recipes? \n Cost: " -#define GOSSIP_LEARN_DRAGON "I am absolutely certain that i want to learn dragonscale leatherworking" #define GOSSIP_UNLEARN_DRAGON "I wish to unlearn Dragonscale Leatherworking" -#define GOSSIP_LEARN_ELEMENTAL "I am absolutely certain that i want to learn elemental leatherworking" #define GOSSIP_UNLEARN_ELEMENTAL "I wish to unlearn Elemental Leatherworking" -#define GOSSIP_LEARN_TRIBAL "I am absolutely certain that i want to learn tribal leatherworking" #define GOSSIP_UNLEARN_TRIBAL "I wish to unlearn Tribal Leatherworking" #define BOX_UNLEARN_LEATHER_SPEC "Do you really want to unlearn your leatherworking specialty and lose all associated recipes? \n Cost: " @@ -101,9 +98,6 @@ there is no difference here (except that default text is chosen with `gameobject #define BOX_UNLEARN_TAILOR_SPEC "Do you really want to unlearn your tailoring specialty and lose all associated recipes? \n Cost: " -#define GOSSIP_LEARN_GOBLIN "I am absolutely certain that i want to learn Goblin engineering" -#define GOSSIP_LEARN_GNOMISH "I am absolutely certain that i want to learn Gnomish engineering" - /*### # spells defines ###*/ @@ -213,7 +207,7 @@ int32 DoLowUnlearnCost(Player* player) //blacksmith return 100000; } -void ProcessCastAction(Player* player, Creature* creature, uint32 spellId, uint32 triggeredSpellId, int32 cost) +void ProcessCastaction(Player* player, Creature* creature, uint32 spellId, uint32 triggeredSpellId, int32 cost) { if (!(spellId && player->HasSpell(spellId)) && player->HasEnoughMoney(cost)) { @@ -241,14 +235,14 @@ bool EquippedOk(Player* player, uint32 spellId) if (!reqSpell) continue; - Item* pItem; + Item* item = NULL; for (uint8 j = EQUIPMENT_SLOT_START; j < EQUIPMENT_SLOT_END; ++j) { - pItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, j); - if (pItem && pItem->GetTemplate()->RequiredSpell == reqSpell) + item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, j); + if (item && item->GetTemplate()->RequiredSpell == reqSpell) { //player has item equipped that require specialty. Not allow to unlearn, player has to unequip first - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: player attempt to unlearn spell %u, but item %u is equipped.", reqSpell, pItem->GetEntry()); + sLog->outDebug(LOG_FILTER_TSCR, "TSCR: player attempt to unlearn spell %u, but item %u is equipped.", reqSpell, item->GetEntry()); return false; } } @@ -387,8 +381,10 @@ public: { if (creature->isQuestGiver()) player->PrepareQuestMenu(creature->GetGUID()); + if (creature->isVendor()) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + if (creature->isTrainer()) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); @@ -424,9 +420,9 @@ public: return true; } - void SendActionMenu(Player* player, Creature* creature, uint32 uiAction) + void SendActionMenu(Player* player, Creature* creature, uint32 action) { - switch (uiAction) + switch (action) { case GOSSIP_ACTION_TRADE: player->GetSession()->SendListInventory(creature->GetGUID()); @@ -436,45 +432,45 @@ public: break; //Learn Alchemy case GOSSIP_ACTION_INFO_DEF + 1: - ProcessCastAction(player, creature, S_TRANSMUTE, S_LEARN_TRANSMUTE, DoLearnCost(player)); + ProcessCastaction(player, creature, S_TRANSMUTE, S_LEARN_TRANSMUTE, DoLearnCost(player)); break; case GOSSIP_ACTION_INFO_DEF + 2: - ProcessCastAction(player, creature, S_ELIXIR, S_LEARN_ELIXIR, DoLearnCost(player)); + ProcessCastaction(player, creature, S_ELIXIR, S_LEARN_ELIXIR, DoLearnCost(player)); break; case GOSSIP_ACTION_INFO_DEF + 3: - ProcessCastAction(player, creature, S_POTION, S_LEARN_POTION, DoLearnCost(player)); + ProcessCastaction(player, creature, S_POTION, S_LEARN_POTION, DoLearnCost(player)); break; //Unlearn Alchemy case GOSSIP_ACTION_INFO_DEF + 4: - ProcessCastAction(player, creature, 0, S_UNLEARN_TRANSMUTE, DoHighUnlearnCost(player)); + ProcessCastaction(player, creature, 0, S_UNLEARN_TRANSMUTE, DoHighUnlearnCost(player)); break; case GOSSIP_ACTION_INFO_DEF + 5: - ProcessCastAction(player, creature, 0, S_UNLEARN_ELIXIR, DoHighUnlearnCost(player)); + ProcessCastaction(player, creature, 0, S_UNLEARN_ELIXIR, DoHighUnlearnCost(player)); break; case GOSSIP_ACTION_INFO_DEF + 6: - ProcessCastAction(player, creature, 0, S_UNLEARN_POTION, DoHighUnlearnCost(player)); + ProcessCastaction(player, creature, 0, S_UNLEARN_POTION, DoHighUnlearnCost(player)); break; } } - void SendConfirmLearn(Player* player, Creature* creature, uint32 uiAction) + void SendConfirmLearn(Player* player, Creature* creature, uint32 action) { - if (uiAction) + if (action) { switch (creature->GetEntry()) { case 22427: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_TRANSMUTE, GOSSIP_SENDER_CHECK, uiAction); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_TRANSMUTE, GOSSIP_SENDER_CHECK, action); //unknown textID () player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); break; case 19052: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_ELIXIR, GOSSIP_SENDER_CHECK, uiAction); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_ELIXIR, GOSSIP_SENDER_CHECK, action); //unknown textID () player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); break; case 17909: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_POTION, GOSSIP_SENDER_CHECK, uiAction); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_POTION, GOSSIP_SENDER_CHECK, action); //unknown textID () player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); break; @@ -482,24 +478,24 @@ public: } } - void SendConfirmUnlearn(Player* player, Creature* creature, uint32 uiAction) + void SendConfirmUnlearn(Player* player, Creature* creature, uint32 action) { - if (uiAction) + if (action) { switch (creature->GetEntry()) { case 22427: //Zarevhi - player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_TRANSMUTE, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_ALCHEMY_SPEC, DoHighUnlearnCost(player), false); + player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_TRANSMUTE, GOSSIP_SENDER_CHECK, action, BOX_UNLEARN_ALCHEMY_SPEC, DoHighUnlearnCost(player), false); //unknown textID () player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); break; case 19052: //Lorokeem - player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_ELIXIR, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_ALCHEMY_SPEC, DoHighUnlearnCost(player), false); + player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_ELIXIR, GOSSIP_SENDER_CHECK, action, BOX_UNLEARN_ALCHEMY_SPEC, DoHighUnlearnCost(player), false); //unknown textID () player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); break; case 17909: //Lauranna Thar'well - player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_POTION, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_ALCHEMY_SPEC, DoHighUnlearnCost(player), false); + player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_POTION, GOSSIP_SENDER_CHECK, action, BOX_UNLEARN_ALCHEMY_SPEC, DoHighUnlearnCost(player), false); //unknown textID () player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); break; @@ -507,15 +503,26 @@ public: } } - bool OnGossipSelect(Player* player, Creature* creature, uint32 uiSender, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiSender) + switch (sender) { - case GOSSIP_SENDER_MAIN: SendActionMenu(player, creature, uiAction); break; - case GOSSIP_SENDER_LEARN: SendConfirmLearn(player, creature, uiAction); break; - case GOSSIP_SENDER_UNLEARN: SendConfirmUnlearn(player, creature, uiAction); break; - case GOSSIP_SENDER_CHECK: SendActionMenu(player, creature, uiAction); break; + case GOSSIP_SENDER_MAIN: + SendActionMenu(player, creature, action); + break; + + case GOSSIP_SENDER_LEARN: + SendConfirmLearn(player, creature, action); + break; + + case GOSSIP_SENDER_UNLEARN: + SendConfirmUnlearn(player, creature, action); + break; + + case GOSSIP_SENDER_CHECK: + SendActionMenu(player, creature, action); + break; } return true; } @@ -539,16 +546,18 @@ public: { if (creature->isQuestGiver()) player->PrepareQuestMenu(creature->GetGUID()); + if (creature->isVendor()) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + if (creature->isTrainer()) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); - uint32 eCreature = creature->GetEntry(); + uint32 creatureId = creature->GetEntry(); //WEAPONSMITH & ARMORSMITH if (player->GetBaseSkillValue(SKILL_BLACKSMITHING) >= 225) { - switch (eCreature) + switch (creatureId) { case 11145: //Myolor Sunderfury case 11176: //Krathok Moltenfist @@ -572,7 +581,7 @@ public: //WEAPONSMITH SPEC if (player->HasSpell(S_WEAPON) && player->getLevel() > 49 && player->GetBaseSkillValue(SKILL_BLACKSMITHING) >= 250) { - switch (eCreature) + switch (creatureId) { case 11191: //Lilith the Lithe if (!HasWeaponSub(player)) @@ -599,9 +608,9 @@ public: return true; } - void SendActionMenu(Player* player, Creature* creature, uint32 uiAction) + void SendActionMenu(Player* player, Creature* creature, uint32 action) { - switch (uiAction) + switch (action) { case GOSSIP_ACTION_TRADE: player->GetSession()->SendListInventory(creature->GetGUID()); @@ -665,24 +674,24 @@ public: } } - void SendConfirmLearn(Player* player, Creature* creature, uint32 uiAction) + void SendConfirmLearn(Player* player, Creature* creature, uint32 action) { - if (uiAction) + if (action) { switch (creature->GetEntry()) { case 11191: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_HAMMER, GOSSIP_SENDER_CHECK, uiAction); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_HAMMER, GOSSIP_SENDER_CHECK, action); //unknown textID (TALK_HAMMER_LEARN) player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); break; case 11192: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_AXE, GOSSIP_SENDER_CHECK, uiAction); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_AXE, GOSSIP_SENDER_CHECK, action); //unknown textID (TALK_AXE_LEARN) player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); break; case 11193: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_SWORD, GOSSIP_SENDER_CHECK, uiAction); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_SWORD, GOSSIP_SENDER_CHECK, action); //unknown textID (TALK_SWORD_LEARN) player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); break; @@ -690,9 +699,9 @@ public: } } - void SendConfirmUnlearn(Player* player, Creature* creature, uint32 uiAction) + void SendConfirmUnlearn(Player* player, Creature* creature, uint32 action) { - if (uiAction) + if (action) { switch (creature->GetEntry()) { @@ -700,23 +709,23 @@ public: case 11178: //Borgosh Corebender case 5164: //Grumnus Steelshaper case 11177: //Okothos Ironrager - player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_SMITH_SPEC, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_ARMORORWEAPON, DoLowUnlearnCost(player), false); + player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_SMITH_SPEC, GOSSIP_SENDER_CHECK, action, BOX_UNLEARN_ARMORORWEAPON, DoLowUnlearnCost(player), false); //unknown textID (TALK_UNLEARN_AXEORWEAPON) player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); break; case 11191: - player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_HAMMER, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_WEAPON_SPEC, DoMedUnlearnCost(player), false); + player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_HAMMER, GOSSIP_SENDER_CHECK, action, BOX_UNLEARN_WEAPON_SPEC, DoMedUnlearnCost(player), false); //unknown textID (TALK_HAMMER_UNLEARN) player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); break; case 11192: - player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_AXE, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_WEAPON_SPEC, DoMedUnlearnCost(player), false); + player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_AXE, GOSSIP_SENDER_CHECK, action, BOX_UNLEARN_WEAPON_SPEC, DoMedUnlearnCost(player), false); //unknown textID (TALK_AXE_UNLEARN) player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); break; case 11193: - player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_SWORD, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_WEAPON_SPEC, DoMedUnlearnCost(player), false); + player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_SWORD, GOSSIP_SENDER_CHECK, action, BOX_UNLEARN_WEAPON_SPEC, DoMedUnlearnCost(player), false); //unknown textID (TALK_SWORD_UNLEARN) player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); break; @@ -724,15 +733,26 @@ public: } } - bool OnGossipSelect(Player* player, Creature* creature, uint32 uiSender, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiSender) + switch (sender) { - case GOSSIP_SENDER_MAIN: SendActionMenu(player, creature, uiAction); break; - case GOSSIP_SENDER_LEARN: SendConfirmLearn(player, creature, uiAction); break; - case GOSSIP_SENDER_UNLEARN: SendConfirmUnlearn(player, creature, uiAction); break; - case GOSSIP_SENDER_CHECK: SendActionMenu(player, creature, uiAction); break; + case GOSSIP_SENDER_MAIN: + SendActionMenu(player, creature, action); + break; + + case GOSSIP_SENDER_LEARN: + SendConfirmLearn(player, creature, action); + break; + + case GOSSIP_SENDER_UNLEARN: + SendConfirmUnlearn(player, creature, action); + break; + + case GOSSIP_SENDER_CHECK: + SendActionMenu(player, creature, action); + break; } return true; } @@ -763,7 +783,6 @@ enum eEngineeringTrinkets #define GOSSIP_ITEM_ZAP "[PH] Unknown" #define GOSSIP_ITEM_JHORDY "I must build a beacon for this marvelous device!" #define GOSSIP_ITEM_KABLAM "[PH] Unknown" -#define GOSSIP_ITEM_SMILES "[PH] Unknown" class npc_engineering_tele_trinket : public CreatureScript { @@ -824,16 +843,16 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 uiSender, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) + if (action == GOSSIP_ACTION_INFO_DEF + 1) player->CLOSE_GOSSIP_MENU(); - if (uiSender != creature->GetEntry()) + if (sender != creature->GetEntry()) return true; - switch (uiSender) + switch (sender) { case NPC_ZAP: player->CastSpell(player, SPELL_LEARN_TO_EVERLOOK, false); @@ -866,8 +885,10 @@ public: { if (creature->isQuestGiver()) player->PrepareQuestMenu(creature->GetGUID()); + if (creature->isVendor()) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + if (creature->isTrainer()) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); @@ -897,9 +918,9 @@ public: return true; } - void SendActionMenu(Player* player, Creature* creature, uint32 uiAction) + void SendActionMenu(Player* player, Creature* creature, uint32 action) { - switch (uiAction) + switch (action) { case GOSSIP_ACTION_TRADE: player->GetSession()->SendListInventory(creature->GetGUID()); @@ -920,27 +941,27 @@ public: } } - void SendConfirmUnlearn(Player* player, Creature* creature, uint32 uiAction) + void SendConfirmUnlearn(Player* player, Creature* creature, uint32 action) { - if (uiAction) + if (action) { switch (creature->GetEntry()) { case 7866: //Peter Galen case 7867: //Thorkaf Dragoneye - player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_DRAGON, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_LEATHER_SPEC, DoMedUnlearnCost(player), false); + player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_DRAGON, GOSSIP_SENDER_CHECK, action, BOX_UNLEARN_LEATHER_SPEC, DoMedUnlearnCost(player), false); //unknown textID () player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); break; case 7868: //Sarah Tanner case 7869: //Brumn Winterhoof - player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_ELEMENTAL, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_LEATHER_SPEC, DoMedUnlearnCost(player), false); + player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_ELEMENTAL, GOSSIP_SENDER_CHECK, action, BOX_UNLEARN_LEATHER_SPEC, DoMedUnlearnCost(player), false); //unknown textID () player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); break; case 7870: //Caryssia Moonhunter case 7871: //Se'Jib - player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_TRIBAL, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_LEATHER_SPEC, DoMedUnlearnCost(player), false); + player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_TRIBAL, GOSSIP_SENDER_CHECK, action, BOX_UNLEARN_LEATHER_SPEC, DoMedUnlearnCost(player), false); //unknown textID () player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); break; @@ -948,14 +969,22 @@ public: } } - bool OnGossipSelect(Player* player, Creature* creature, uint32 uiSender, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiSender) + switch (sender) { - case GOSSIP_SENDER_MAIN: SendActionMenu(player, creature, uiAction); break; - case GOSSIP_SENDER_UNLEARN: SendConfirmUnlearn(player, creature, uiAction); break; - case GOSSIP_SENDER_CHECK: SendActionMenu(player, creature, uiAction); break; + case GOSSIP_SENDER_MAIN: + SendActionMenu(player, creature, action); + break; + + case GOSSIP_SENDER_UNLEARN: + SendConfirmUnlearn(player, creature, action); + break; + + case GOSSIP_SENDER_CHECK: + SendActionMenu(player, creature, action); + break; } return true; } @@ -979,8 +1008,10 @@ public: { if (creature->isQuestGiver()) player->PrepareQuestMenu(creature->GetGUID()); + if (creature->isVendor()) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + if (creature->isTrainer()) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); @@ -1017,9 +1048,9 @@ public: return true; } - void SendActionMenu(Player* player, Creature* creature, uint32 uiAction) + void SendActionMenu(Player* player, Creature* creature, uint32 action) { - switch (uiAction) + switch (action) { case GOSSIP_ACTION_TRADE: player->GetSession()->SendListInventory(creature->GetGUID()); @@ -1029,13 +1060,13 @@ public: break; //Learn Tailor case GOSSIP_ACTION_INFO_DEF + 1: - ProcessCastAction(player, creature, S_SPELLFIRE, S_LEARN_SPELLFIRE, DoLearnCost(player)); + ProcessCastaction(player, creature, S_SPELLFIRE, S_LEARN_SPELLFIRE, DoLearnCost(player)); break; case GOSSIP_ACTION_INFO_DEF + 2: - ProcessCastAction(player, creature, S_MOONCLOTH, S_LEARN_MOONCLOTH, DoLearnCost(player)); + ProcessCastaction(player, creature, S_MOONCLOTH, S_LEARN_MOONCLOTH, DoLearnCost(player)); break; case GOSSIP_ACTION_INFO_DEF + 3: - ProcessCastAction(player, creature, S_SHADOWEAVE, S_LEARN_SHADOWEAVE, DoLearnCost(player)); + ProcessCastaction(player, creature, S_SHADOWEAVE, S_LEARN_SHADOWEAVE, DoLearnCost(player)); break; //Unlearn Tailor case GOSSIP_ACTION_INFO_DEF + 4: @@ -1050,24 +1081,24 @@ public: } } - void SendConfirmLearn(Player* player, Creature* creature, uint32 uiAction) + void SendConfirmLearn(Player* player, Creature* creature, uint32 action) { - if (uiAction) + if (action) { switch (creature->GetEntry()) { case 22213: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_SPELLFIRE, GOSSIP_SENDER_CHECK, uiAction); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_SPELLFIRE, GOSSIP_SENDER_CHECK, action); //unknown textID () player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); break; case 22208: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_MOONCLOTH, GOSSIP_SENDER_CHECK, uiAction); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_MOONCLOTH, GOSSIP_SENDER_CHECK, action); //unknown textID () player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); break; case 22212: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_SHADOWEAVE, GOSSIP_SENDER_CHECK, uiAction); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_SHADOWEAVE, GOSSIP_SENDER_CHECK, action); //unknown textID () player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); break; @@ -1075,24 +1106,24 @@ public: } } - void SendConfirmUnlearn(Player* player, Creature* creature, uint32 uiAction) + void SendConfirmUnlearn(Player* player, Creature* creature, uint32 action) { - if (uiAction) + if (action) { switch (creature->GetEntry()) { case 22213: //Gidge Spellweaver - player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_SPELLFIRE, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_TAILOR_SPEC, DoHighUnlearnCost(player), false); + player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_SPELLFIRE, GOSSIP_SENDER_CHECK, action, BOX_UNLEARN_TAILOR_SPEC, DoHighUnlearnCost(player), false); //unknown textID () player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); break; case 22208: //Nasmara Moonsong - player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_MOONCLOTH, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_TAILOR_SPEC, DoHighUnlearnCost(player), false); + player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_MOONCLOTH, GOSSIP_SENDER_CHECK, action, BOX_UNLEARN_TAILOR_SPEC, DoHighUnlearnCost(player), false); //unknown textID () player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); break; case 22212: //Andrion Darkspinner - player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_SHADOWEAVE, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_TAILOR_SPEC, DoHighUnlearnCost(player), false); + player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_SHADOWEAVE, GOSSIP_SENDER_CHECK, action, BOX_UNLEARN_TAILOR_SPEC, DoHighUnlearnCost(player), false); //unknown textID () player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); break; @@ -1100,29 +1131,36 @@ public: } } - bool OnGossipSelect(Player* player, Creature* creature, uint32 uiSender, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiSender) + switch (sender) { - case GOSSIP_SENDER_MAIN: SendActionMenu(player, creature, uiAction); break; - case GOSSIP_SENDER_LEARN: SendConfirmLearn(player, creature, uiAction); break; - case GOSSIP_SENDER_UNLEARN: SendConfirmUnlearn(player, creature, uiAction); break; - case GOSSIP_SENDER_CHECK: SendActionMenu(player, creature, uiAction); break; + case GOSSIP_SENDER_MAIN: + SendActionMenu(player, creature, action); + break; + + case GOSSIP_SENDER_LEARN: + SendConfirmLearn(player, creature, action); + break; + + case GOSSIP_SENDER_UNLEARN: + SendConfirmUnlearn(player, creature, action); + break; + + case GOSSIP_SENDER_CHECK: + SendActionMenu(player, creature, action); + break; } return true; } }; -/*### -# -###*/ - void AddSC_npc_professions() { - new npc_prof_alchemy; - new npc_prof_blacksmith; - new npc_engineering_tele_trinket; - new npc_prof_leather; - new npc_prof_tailor; + new npc_prof_alchemy(); + new npc_prof_blacksmith(); + new npc_engineering_tele_trinket(); + new npc_prof_leather(); + new npc_prof_tailor(); } diff --git a/src/server/scripts/World/npc_taxi.cpp b/src/server/scripts/World/npc_taxi.cpp index aff326e152d..ceda8e0f6ac 100644 --- a/src/server/scripts/World/npc_taxi.cpp +++ b/src/server/scripts/World/npc_taxi.cpp @@ -38,7 +38,7 @@ EndScriptData #define GOSSIP_BRACK2 "Fly me to The Abyssal Shelf" #define GOSSIP_BRACK3 "Fly me to Spinebreaker Post" #define GOSSIP_IRENA "Fly me to Skettis please" -#define GOSSIP_CLOUDBREAKER1 "Speaking of uiAction, I've been ordered to undertake an air strike." +#define GOSSIP_CLOUDBREAKER1 "Speaking of action, I've been ordered to undertake an air strike." #define GOSSIP_CLOUDBREAKER2 "I need to intercept the Dawnblade reinforcements." #define GOSSIP_DRAGONHAWK "<Ride the dragonhawk to Sun's Reach>" #define GOSSIP_VERONIA "Fly me to Manaforge Coruu please" @@ -186,10 +186,10 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch (uiAction) + switch (action) { case GOSSIP_ACTION_INFO_DEF: //spellId is correct, however it gives flight a somewhat funny effect //TaxiPath 506. @@ -201,9 +201,10 @@ public: player->ActivateTaxiPathTo(627); //TaxiPath 627 (possibly 627+628(152->153->154->155)) break; case GOSSIP_ACTION_INFO_DEF + 2: - if (!player->HasItemCount(25853, 1)) { + if (!player->HasItemCount(25853, 1)) player->SEND_GOSSIP_MENU(9780, creature->GetGUID()); - } else { + else + { player->CLOSE_GOSSIP_MENU(); player->ActivateTaxiPathTo(534); //TaxiPath 534 } diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 1e1e34431a2..ecd1a439a58 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -137,8 +137,8 @@ public: if (!spawnedTemplate) { - SpawnAssoc = NULL; sLog->outErrorDb("TCSR: Creature template entry %u does not exist in DB, which is required by npc_air_force_bots", SpawnAssoc->spawnedCreatureEntry); + SpawnAssoc = NULL; return; } } @@ -315,7 +315,7 @@ public: struct npc_chicken_cluckAI : public ScriptedAI { - npc_chicken_cluckAI(Creature* c) : ScriptedAI(c) {} + npc_chicken_cluckAI(Creature* creature) : ScriptedAI(creature) {} uint32 ResetFlagTimer; @@ -407,7 +407,7 @@ public: struct npc_dancing_flamesAI : public ScriptedAI { - npc_dancing_flamesAI(Creature* c) : ScriptedAI(c) {} + npc_dancing_flamesAI(Creature* creature) : ScriptedAI(creature) {} bool Active; uint32 CanIteract; @@ -421,7 +421,7 @@ public: float x, y, z; me->GetPosition(x, y, z); me->Relocate(x, y, z + 0.94f); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetDisableGravity(true); me->HandleEmoteCommand(EMOTE_ONESHOT_DANCE); WorldPacket data; //send update position to client me->BuildHeartBeatMsg(&data); @@ -558,7 +558,7 @@ public: struct npc_doctorAI : public ScriptedAI { - npc_doctorAI(Creature* c) : ScriptedAI(c) {} + npc_doctorAI(Creature* creature) : ScriptedAI(creature) {} uint64 PlayerGUID; @@ -703,7 +703,7 @@ public: struct npc_injured_patientAI : public ScriptedAI { - npc_injured_patientAI(Creature* c) : ScriptedAI(c) {} + npc_injured_patientAI(Creature* creature) : ScriptedAI(creature) {} uint64 DoctorGUID; Location* Coord; @@ -764,7 +764,7 @@ public: DoScriptText(RAND(SAY_DOC1, SAY_DOC2, SAY_DOC3), me); uint32 mobId = me->GetEntry(); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetWalk(false); switch (mobId) { @@ -905,7 +905,7 @@ public: struct npc_garments_of_questsAI : public npc_escortAI { - npc_garments_of_questsAI(Creature* c) : npc_escortAI(c) {Reset();} + npc_garments_of_questsAI(Creature* creature) : npc_escortAI(creature) {Reset();} uint64 CasterGUID; @@ -1040,8 +1040,9 @@ public: } } - void WaypointReached(uint32 /*point*/) + void WaypointReached(uint32 /*waypointId*/) { + } void UpdateAI(uint32 const diff) @@ -1105,7 +1106,7 @@ public: struct npc_guardianAI : public ScriptedAI { - npc_guardianAI(Creature* c) : ScriptedAI(c) {} + npc_guardianAI(Creature* creature) : ScriptedAI(creature) {} void Reset() { @@ -1477,7 +1478,7 @@ public: struct npc_steam_tonkAI : public ScriptedAI { - npc_steam_tonkAI(Creature* c) : ScriptedAI(c) {} + npc_steam_tonkAI(Creature* creature) : ScriptedAI(creature) {} void Reset() {} void EnterCombat(Unit* /*who*/) {} @@ -1495,7 +1496,6 @@ public: else me->SetReactState(REACT_AGGRESSIVE); } - }; CreatureAI* GetAI(Creature* creature) const @@ -1513,7 +1513,7 @@ public: struct npc_tonk_mineAI : public ScriptedAI { - npc_tonk_mineAI(Creature* c) : ScriptedAI(c) + npc_tonk_mineAI(Creature* creature) : ScriptedAI(creature) { me->SetReactState(REACT_PASSIVE); } @@ -1558,7 +1558,7 @@ public: struct npc_brewfest_revelerAI : public ScriptedAI { - npc_brewfest_revelerAI(Creature* c) : ScriptedAI(c) {} + npc_brewfest_revelerAI(Creature* creature) : ScriptedAI(creature) {} void ReceiveEmote(Player* player, uint32 emote) { if (!IsHolidayActive(HOLIDAY_BREWFEST)) @@ -1594,7 +1594,7 @@ class npc_winter_reveler : public CreatureScript struct npc_winter_revelerAI : public ScriptedAI { - npc_winter_revelerAI(Creature* c) : ScriptedAI(c) {} + npc_winter_revelerAI(Creature* creature) : ScriptedAI(creature) {} void ReceiveEmote(Player* player, uint32 emote) { @@ -1639,7 +1639,7 @@ public: struct npc_snake_trap_serpentsAI : public ScriptedAI { - npc_snake_trap_serpentsAI(Creature* c) : ScriptedAI(c) {} + npc_snake_trap_serpentsAI(Creature* creature) : ScriptedAI(creature) {} uint32 SpellTimer; bool IsViper; @@ -1650,7 +1650,7 @@ public: { SpellTimer = 0; - CreatureTemplate const* Info = me->GetCreatureInfo(); + CreatureTemplate const* Info = me->GetCreatureTemplate(); IsViper = Info->Entry == C_VIPER ? true : false; @@ -1753,15 +1753,13 @@ public: struct mob_mojoAI : public ScriptedAI { - mob_mojoAI(Creature* c) : ScriptedAI(c) {Reset();} - - uint32 Hearts; - uint64 VictimGUID; - + mob_mojoAI(Creature* creature) : ScriptedAI(creature) {Reset();} + uint32 hearts; + uint64 victimGUID; void Reset() { - VictimGUID = 0; - Hearts = 15000; + victimGUID = 0; + hearts = 15000; if (Unit* own = me->GetOwner()) me->GetMotionMaster()->MoveFollow(own, 0, 0); } @@ -1772,12 +1770,11 @@ public: { if (me->HasAura(20372)) { - if (Hearts <= diff) + if (hearts <= diff) { me->RemoveAurasDueToSpell(20372); - Hearts = 15000; - } - Hearts -= diff; + hearts = 15000; + } hearts -= diff; } } @@ -1821,14 +1818,14 @@ public: } me->MonsterWhisper(whisp.c_str(), player->GetGUID()); - if (VictimGUID) - if (Player* victim = Unit::GetPlayer(*me, VictimGUID)) + if (victimGUID) + if (Player* victim = Unit::GetPlayer(*me, victimGUID)) victim->RemoveAura(43906);//remove polymorph frog thing me->AddAura(43906, player);//add polymorph frog thing - VictimGUID = player->GetGUID(); + victimGUID = player->GetGUID(); DoCast(me, 20372, true);//tag.hearts me->GetMotionMaster()->MoveFollow(player, 0, 0); - Hearts = 15000; + hearts = 15000; } } }; @@ -1846,7 +1843,7 @@ public: struct npc_mirror_imageAI : CasterAI { - npc_mirror_imageAI(Creature* c) : CasterAI(c) {} + npc_mirror_imageAI(Creature* creature) : CasterAI(creature) {} void InitializeAI() { @@ -1892,9 +1889,9 @@ public: struct npc_ebon_gargoyleAI : CasterAI { - npc_ebon_gargoyleAI(Creature* c) : CasterAI(c) {} + npc_ebon_gargoyleAI(Creature* creature) : CasterAI(creature) {} - uint32 DespawnTimer; + uint32 despawnTimer; void InitializeAI() { @@ -1903,7 +1900,7 @@ public: if (!ownerGuid) return; // Not needed to be despawned now - DespawnTimer = 0; + despawnTimer = 0; // Find victim of Summon Gargoyle spell std::list<Unit*> targets; Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(me, me, 30); @@ -1941,6 +1938,7 @@ public: me->CastSpell(me, 54661, true); me->SetReactState(REACT_PASSIVE); + //! HACK: Creature's can't have MOVEMENTFLAG_FLYING // Fly Away me->AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY|MOVEMENTFLAG_ASCENDING|MOVEMENTFLAG_FLYING); me->SetSpeed(MOVE_FLIGHT, 0.75f, true); @@ -1952,15 +1950,15 @@ public: me->GetMotionMaster()->MovePoint(0, x, y, z); // Despawn as soon as possible - DespawnTimer = 4 * IN_MILLISECONDS; + despawnTimer = 4 * IN_MILLISECONDS; } void UpdateAI(const uint32 diff) { - if (DespawnTimer > 0) + if (despawnTimer > 0) { - if (DespawnTimer > diff) - DespawnTimer -= diff; + if (despawnTimer > diff) + despawnTimer -= diff; else me->DespawnOrUnsummon(); return; @@ -1977,33 +1975,31 @@ public: class npc_lightwell : public CreatureScript { -public: - npc_lightwell() : CreatureScript("npc_lightwell") { } - - struct npc_lightwellAI : public PassiveAI - { - npc_lightwellAI(Creature* c) : PassiveAI(c) {} + public: + npc_lightwell() : CreatureScript("npc_lightwell") { } - void Reset() + struct npc_lightwellAI : public PassiveAI { - DoCast(me, 59907, false); // Spell for Lightwell Charges - } + npc_lightwellAI(Creature* creature) : PassiveAI(creature) + { + DoCast(me, 59907, false); + } - void EnterEvadeMode() - { - if (!me->isAlive()) - return; + void EnterEvadeMode() + { + if (!me->isAlive()) + return; - me->DeleteThreatList(); - me->CombatStop(true); - me->ResetPlayerDamageReq(); - } - }; + me->DeleteThreatList(); + me->CombatStop(true); + me->ResetPlayerDamageReq(); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new npc_lightwellAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_lightwellAI(creature); + } }; enum eTrainingDummy @@ -2021,20 +2017,20 @@ public: { npc_training_dummyAI(Creature* creature) : Scripted_NoMovementAI(creature) { - Entry = creature->GetEntry(); + entry = creature->GetEntry(); } - uint32 Entry; - uint32 ResetTimer; - uint32 DespawnTimer; + uint32 entry; + uint32 resetTimer; + uint32 despawnTimer; void Reset() { me->SetControlled(true, UNIT_STATE_STUNNED);//disable rotate me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);//imune to knock aways like blast wave - ResetTimer = 5000; - DespawnTimer = 15000; + resetTimer = 5000; + despawnTimer = 15000; } void EnterEvadeMode() @@ -2047,13 +2043,13 @@ public: void DamageTaken(Unit* /*doneBy*/, uint32& damage) { - ResetTimer = 5000; + resetTimer = 5000; damage = 0; } void EnterCombat(Unit* /*who*/) { - if (Entry != NPC_ADVANCED_TARGET_DUMMY && Entry != NPC_TARGET_DUMMY) + if (entry != NPC_ADVANCED_TARGET_DUMMY && entry != NPC_TARGET_DUMMY) return; } @@ -2065,23 +2061,23 @@ public: if (!me->HasUnitState(UNIT_STATE_STUNNED)) me->SetControlled(true, UNIT_STATE_STUNNED);//disable rotate - if (Entry != NPC_ADVANCED_TARGET_DUMMY && Entry != NPC_TARGET_DUMMY) + if (entry != NPC_ADVANCED_TARGET_DUMMY && entry != NPC_TARGET_DUMMY) { - if (ResetTimer <= diff) + if (resetTimer <= diff) { EnterEvadeMode(); - ResetTimer = 5000; + resetTimer = 5000; } else - ResetTimer -= diff; + resetTimer -= diff; return; } else { - if (DespawnTimer <= diff) + if (despawnTimer <= diff) me->DespawnOrUnsummon(); else - DespawnTimer -= diff; + despawnTimer -= diff; } } void MoveInLineOfSight(Unit* /*who*/){return;} @@ -2101,34 +2097,26 @@ public: class npc_shadowfiend : public CreatureScript { -public: - npc_shadowfiend() : CreatureScript("npc_shadowfiend") { } - - struct npc_shadowfiendAI : public ScriptedAI - { - npc_shadowfiendAI(Creature* creature) : ScriptedAI(creature) {} + public: + npc_shadowfiend() : CreatureScript("npc_shadowfiend") { } - void DamageTaken(Unit* /*killer*/, uint32& damage) + struct npc_shadowfiendAI : public ScriptedAI { - if (me->isSummon()) - if (Unit* owner = me->ToTempSummon()->GetSummoner()) - if (owner->HasAura(GLYPH_OF_SHADOWFIEND) && damage >= me->GetHealth()) - owner->CastSpell(owner, GLYPH_OF_SHADOWFIEND_MANA, true); - } + npc_shadowfiendAI(Creature* creature) : ScriptedAI(creature) {} - void UpdateAI(uint32 const /*diff*/) - { - if (!UpdateVictim()) - return; + void DamageTaken(Unit* /*killer*/, uint32& damage) + { + if (me->isSummon()) + if (Unit* owner = me->ToTempSummon()->GetSummoner()) + if (owner->HasAura(GLYPH_OF_SHADOWFIEND) && damage >= me->GetHealth()) + owner->CastSpell(owner, GLYPH_OF_SHADOWFIEND_MANA, true); + } + }; - DoMeleeAttackIfReady(); + CreatureAI* GetAI(Creature* creature) const + { + return new npc_shadowfiendAI(creature); } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new npc_shadowfiendAI(creature); - } }; /*###### @@ -2195,7 +2183,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_fire_elementalAI(creature); } @@ -2240,7 +2228,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_earth_elementalAI(creature); } @@ -2250,78 +2238,111 @@ public: # npc_wormhole ######*/ -#define GOSSIP_ENGINEERING1 "Borean Tundra." -#define GOSSIP_ENGINEERING2 "Howling Fjord." -#define GOSSIP_ENGINEERING3 "Sholazar Basin." -#define GOSSIP_ENGINEERING4 "Icecrown." -#define GOSSIP_ENGINEERING5 "Storm Peaks." +#define GOSSIP_ENGINEERING1 "Borean Tundra" +#define GOSSIP_ENGINEERING2 "Howling Fjord" +#define GOSSIP_ENGINEERING3 "Sholazar Basin" +#define GOSSIP_ENGINEERING4 "Icecrown" +#define GOSSIP_ENGINEERING5 "Storm Peaks" +#define GOSSIP_ENGINEERING6 "Underground..." -enum eWormhole +enum WormholeSpells { - SPELL_HOWLING_FJORD = 67838, + SPELL_BOREAN_TUNDRA = 67834, SPELL_SHOLAZAR_BASIN = 67835, SPELL_ICECROWN = 67836, SPELL_STORM_PEAKS = 67837, + SPELL_HOWLING_FJORD = 67838, + SPELL_UNDERGROUND = 68081, - TEXT_WORMHOLE = 907 + TEXT_WORMHOLE = 907, + + DATA_SHOW_UNDERGROUND = 1, }; class npc_wormhole : public CreatureScript { -public: - npc_wormhole() : CreatureScript("npc_wormhole") { } + public: + npc_wormhole() : CreatureScript("npc_wormhole") {} - bool OnGossipHello(Player* player, Creature* creature) - { - if (creature->isSummon()) + struct npc_wormholeAI : public PassiveAI { - if (player == creature->ToTempSummon()->GetSummoner()) + npc_wormholeAI(Creature* creature) : PassiveAI(creature) {} + + void InitializeAI() { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); + _showUnderground = urand(0, 100) == 0; // Guessed value, it is really rare though + } - player->PlayerTalkClass->SendGossipMenu(TEXT_WORMHOLE, creature->GetGUID()); + uint32 GetData(uint32 type) + { + return (type == DATA_SHOW_UNDERGROUND && _showUnderground) ? 1 : 0; } + + private: + bool _showUnderground; + }; + + bool OnGossipHello(Player* player, Creature* creature) + { + if (creature->isSummon()) + { + if (player == creature->ToTempSummon()->GetSummoner()) + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); + + if (creature->AI()->GetData(DATA_SHOW_UNDERGROUND)) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); + + player->PlayerTalkClass->SendGossipMenu(TEXT_WORMHOLE, creature->GetGUID()); + } + } + + return true; } - return true; - } - bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) - { - player->PlayerTalkClass->ClearMenus(); - bool roll = urand(0, 1); + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) + { + player->PlayerTalkClass->ClearMenus(); - switch (action) + switch (action) + { + case GOSSIP_ACTION_INFO_DEF + 1: // Borean Tundra + player->CLOSE_GOSSIP_MENU(); + creature->CastSpell(player, SPELL_BOREAN_TUNDRA, false); + break; + case GOSSIP_ACTION_INFO_DEF + 2: // Howling Fjord + player->CLOSE_GOSSIP_MENU(); + creature->CastSpell(player, SPELL_HOWLING_FJORD, false); + break; + case GOSSIP_ACTION_INFO_DEF + 3: // Sholazar Basin + player->CLOSE_GOSSIP_MENU(); + creature->CastSpell(player, SPELL_SHOLAZAR_BASIN, false); + break; + case GOSSIP_ACTION_INFO_DEF + 4: // Icecrown + player->CLOSE_GOSSIP_MENU(); + creature->CastSpell(player, SPELL_ICECROWN, false); + break; + case GOSSIP_ACTION_INFO_DEF + 5: // Storm peaks + player->CLOSE_GOSSIP_MENU(); + creature->CastSpell(player, SPELL_STORM_PEAKS, false); + break; + case GOSSIP_ACTION_INFO_DEF + 6: // Underground + player->CLOSE_GOSSIP_MENU(); + creature->CastSpell(player, SPELL_UNDERGROUND, false); + break; + } + + return true; + } + + CreatureAI* GetAI(Creature* creature) const { - case GOSSIP_ACTION_INFO_DEF + 1: //Borean Tundra - player->CLOSE_GOSSIP_MENU(); - if (roll) //At the moment we don't have chance on spell_target_position table so we hack this - player->TeleportTo(571, 4305.505859f, 5450.839844f, 63.005806f, 0.627286f); - else - player->TeleportTo(571, 3201.936279f, 5630.123535f, 133.658798f, 3.855272f); - break; - case GOSSIP_ACTION_INFO_DEF + 2: //Howling Fjord - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_HOWLING_FJORD, true); - break; - case GOSSIP_ACTION_INFO_DEF + 3: //Sholazar Basin - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_SHOLAZAR_BASIN, true); - break; - case GOSSIP_ACTION_INFO_DEF + 4: //Icecrown - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_ICECROWN, true); - break; - case GOSSIP_ACTION_INFO_DEF + 5: //Storm peaks - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_STORM_PEAKS, true); - break; + return new npc_wormholeAI(creature); } - return true; - } }; /*###### @@ -2402,6 +2423,9 @@ enum eLockSmith QUEST_HOTTER_THAN_HELL_H = 10764, QUEST_RETURN_TO_KHAGDAR = 9837, QUEST_CONTAINMENT = 13159, + QUEST_ETERNAL_VIGILANCE = 11011, + QUEST_KEY_TO_THE_FOCUSING_IRIS = 13372, + QUEST_HC_KEY_TO_THE_FOCUSING_IRIS = 13375, ITEM_ARCATRAZ_KEY = 31084, ITEM_SHADOWFORGE_KEY = 11000, @@ -2409,21 +2433,28 @@ enum eLockSmith ITEM_SHATTERED_HALLS_KEY = 28395, ITEM_THE_MASTERS_KEY = 24490, ITEM_VIOLET_HOLD_KEY = 42482, + ITEM_ESSENCE_INFUSED_MOONSTONE = 32449, + ITEM_KEY_TO_THE_FOCUSING_IRIS = 44582, + ITEM_HC_KEY_TO_THE_FOCUSING_IRIS = 44581, SPELL_ARCATRAZ_KEY = 54881, SPELL_SHADOWFORGE_KEY = 54882, SPELL_SKELETON_KEY = 54883, SPELL_SHATTERED_HALLS_KEY = 54884, SPELL_THE_MASTERS_KEY = 54885, - SPELL_VIOLET_HOLD_KEY = 67253 + SPELL_VIOLET_HOLD_KEY = 67253, + SPELL_ESSENCE_INFUSED_MOONSTONE = 40173, }; -#define GOSSIP_LOST_ARCATRAZ_KEY "I've lost my key to the Arcatraz." -#define GOSSIP_LOST_SHADOWFORGE_KEY "I've lost my key to the Blackrock Depths." -#define GOSSIP_LOST_SKELETON_KEY "I've lost my key to the Scholomance." -#define GOSSIP_LOST_SHATTERED_HALLS_KEY "I've lost my key to the Shattered Halls." -#define GOSSIP_LOST_THE_MASTERS_KEY "I've lost my key to the Karazhan." -#define GOSSIP_LOST_VIOLET_HOLD_KEY "I've lost my key to the Violet Hold." +#define GOSSIP_LOST_ARCATRAZ_KEY "I've lost my key to the Arcatraz." +#define GOSSIP_LOST_SHADOWFORGE_KEY "I've lost my key to the Blackrock Depths." +#define GOSSIP_LOST_SKELETON_KEY "I've lost my key to the Scholomance." +#define GOSSIP_LOST_SHATTERED_HALLS_KEY "I've lost my key to the Shattered Halls." +#define GOSSIP_LOST_THE_MASTERS_KEY "I've lost my key to the Karazhan." +#define GOSSIP_LOST_VIOLET_HOLD_KEY "I've lost my key to the Violet Hold." +#define GOSSIP_LOST_ESSENCE_INFUSED_MOONSTONE "I've lost my Essence-Infused Moonstone." +#define GOSSIP_LOST_KEY_TO_THE_FOCUSING_IRIS "I've lost my Key to the Focusing Iris." +#define GOSSIP_LOST_HC_KEY_TO_THE_FOCUSING_IRIS "I've lost my Heroic Key to the Focusing Iris." class npc_locksmith : public CreatureScript { @@ -2458,6 +2489,18 @@ public: if (player->GetQuestRewardStatus(QUEST_CONTAINMENT) && !player->HasItemCount(ITEM_VIOLET_HOLD_KEY, 1, true)) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_VIOLET_HOLD_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); + // Essence-Infused Moonstone + if (player->GetQuestRewardStatus(QUEST_ETERNAL_VIGILANCE) && !player->HasItemCount(ITEM_ESSENCE_INFUSED_MOONSTONE, 1, true)) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_ESSENCE_INFUSED_MOONSTONE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); + + // Key to the Focusing Iris + if (player->GetQuestRewardStatus(QUEST_KEY_TO_THE_FOCUSING_IRIS) && !player->HasItemCount(ITEM_KEY_TO_THE_FOCUSING_IRIS, 1, true)) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_KEY_TO_THE_FOCUSING_IRIS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 8); + + // Heroic Key to the Focusing Iris + if (player->GetQuestRewardStatus(QUEST_HC_KEY_TO_THE_FOCUSING_IRIS) && !player->HasItemCount(ITEM_HC_KEY_TO_THE_FOCUSING_IRIS, 1, true)) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_HC_KEY_TO_THE_FOCUSING_IRIS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9); + player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); return true; @@ -2492,171 +2535,17 @@ public: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, SPELL_VIOLET_HOLD_KEY, false); break; - } - return true; - } -}; - -/*###### -## npc_tabard_vendor -######*/ - -enum -{ - QUEST_TRUE_MASTERS_OF_LIGHT = 9737, - QUEST_THE_UNWRITTEN_PROPHECY = 9762, - QUEST_INTO_THE_BREACH = 10259, - QUEST_BATTLE_OF_THE_CRIMSON_WATCH = 10781, - QUEST_SHARDS_OF_AHUNE = 11972, - - ACHIEVEMENT_EXPLORE_NORTHREND = 45, - ACHIEVEMENT_TWENTYFIVE_TABARDS = 1021, - ACHIEVEMENT_THE_LOREMASTER_A = 1681, - ACHIEVEMENT_THE_LOREMASTER_H = 1682, - - ITEM_TABARD_OF_THE_HAND = 24344, - ITEM_TABARD_OF_THE_BLOOD_KNIGHT = 25549, - ITEM_TABARD_OF_THE_PROTECTOR = 28788, - ITEM_OFFERING_OF_THE_SHATAR = 31408, - ITEM_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI = 31404, - ITEM_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI = 31405, - ITEM_TABARD_OF_THE_SUMMER_SKIES = 35279, - ITEM_TABARD_OF_THE_SUMMER_FLAMES = 35280, - ITEM_TABARD_OF_THE_ACHIEVER = 40643, - ITEM_LOREMASTERS_COLORS = 43300, - ITEM_TABARD_OF_THE_EXPLORER = 43348, - - SPELL_TABARD_OF_THE_BLOOD_KNIGHT = 54974, - SPELL_TABARD_OF_THE_HAND = 54976, - SPELL_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI = 54977, - SPELL_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI = 54982, - SPELL_TABARD_OF_THE_ACHIEVER = 55006, - SPELL_TABARD_OF_THE_PROTECTOR = 55008, - SPELL_LOREMASTERS_COLORS = 58194, - SPELL_TABARD_OF_THE_EXPLORER = 58224, - SPELL_TABARD_OF_SUMMER_SKIES = 62768, - SPELL_TABARD_OF_SUMMER_FLAMES = 62769 -}; - -#define GOSSIP_LOST_TABARD_OF_BLOOD_KNIGHT "I've lost my Tabard of Blood Knight." -#define GOSSIP_LOST_TABARD_OF_THE_HAND "I've lost my Tabard of the Hand." -#define GOSSIP_LOST_TABARD_OF_THE_PROTECTOR "I've lost my Tabard of the Protector." -#define GOSSIP_LOST_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI "I've lost my Green Trophy Tabard of the Illidari." -#define GOSSIP_LOST_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI "I've lost my Purple Trophy Tabard of the Illidari." -#define GOSSIP_LOST_TABARD_OF_SUMMER_SKIES "I've lost my Tabard of Summer Skies." -#define GOSSIP_LOST_TABARD_OF_SUMMER_FLAMES "I've lost my Tabard of Summer Flames." -#define GOSSIP_LOST_LOREMASTERS_COLORS "I've lost my Loremaster's Colors." -#define GOSSIP_LOST_TABARD_OF_THE_EXPLORER "I've lost my Tabard of the Explorer." -#define GOSSIP_LOST_TABARD_OF_THE_ACHIEVER "I've lost my Tabard of the Achiever." - -class npc_tabard_vendor : public CreatureScript -{ -public: - npc_tabard_vendor() : CreatureScript("npc_tabard_vendor") { } - - bool OnGossipHello(Player* player, Creature* creature) - { - bool lostBloodKnight = false; - bool lostHand = false; - bool lostProtector = false; - bool lostIllidari = false; - bool lostSummer = false; - - //Tabard of the Blood Knight - if (player->GetQuestRewardStatus(QUEST_TRUE_MASTERS_OF_LIGHT) && !player->HasItemCount(ITEM_TABARD_OF_THE_BLOOD_KNIGHT, 1, true)) - lostBloodKnight = true; - - //Tabard of the Hand - if (player->GetQuestRewardStatus(QUEST_THE_UNWRITTEN_PROPHECY) && !player->HasItemCount(ITEM_TABARD_OF_THE_HAND, 1, true)) - lostHand = true; - - //Tabard of the Protector - if (player->GetQuestRewardStatus(QUEST_INTO_THE_BREACH) && !player->HasItemCount(ITEM_TABARD_OF_THE_PROTECTOR, 1, true)) - lostProtector = true; - - //Green Trophy Tabard of the Illidari - //Purple Trophy Tabard of the Illidari - if (player->GetQuestRewardStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH) && - (!player->HasItemCount(ITEM_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI, 1, true) && - !player->HasItemCount(ITEM_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI, 1, true) && - !player->HasItemCount(ITEM_OFFERING_OF_THE_SHATAR, 1, true))) - lostIllidari = true; - - //Tabard of Summer Skies - //Tabard of Summer Flames - if (player->GetQuestRewardStatus(QUEST_SHARDS_OF_AHUNE) && - !player->HasItemCount(ITEM_TABARD_OF_THE_SUMMER_SKIES, 1, true) && - !player->HasItemCount(ITEM_TABARD_OF_THE_SUMMER_FLAMES, 1, true)) - lostSummer = true; - - if (lostBloodKnight || lostHand || lostProtector || lostIllidari || lostSummer) - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - - if (lostBloodKnight) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_BLOOD_KNIGHT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - - if (lostHand) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_THE_HAND, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - - if (lostProtector) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_THE_PROTECTOR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - - if (lostIllidari) - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); - } - - if (lostSummer) - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_SUMMER_SKIES, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_SUMMER_FLAMES, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); - } - - player->SEND_GOSSIP_MENU(13583, creature->GetGUID()); - } - else - player->GetSession()->SendListInventory(creature->GetGUID()); - - return true; - } - - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) - { - player->PlayerTalkClass->ClearMenus(); - switch (action) - { - case GOSSIP_ACTION_TRADE: - player->GetSession()->SendListInventory(creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 1: - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_TABARD_OF_THE_BLOOD_KNIGHT, false); - break; - case GOSSIP_ACTION_INFO_DEF + 2: - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_TABARD_OF_THE_HAND, false); - break; - case GOSSIP_ACTION_INFO_DEF + 3: - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_TABARD_OF_THE_PROTECTOR, false); - break; - case GOSSIP_ACTION_INFO_DEF + 4: - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI, false); - break; - case GOSSIP_ACTION_INFO_DEF + 5: + case GOSSIP_ACTION_INFO_DEF + 7: player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI, false); + player->CastSpell(player, SPELL_ESSENCE_INFUSED_MOONSTONE, false); break; - case GOSSIP_ACTION_INFO_DEF + 6: + case GOSSIP_ACTION_INFO_DEF + 8: player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_TABARD_OF_SUMMER_SKIES, false); + player->AddItem(ITEM_KEY_TO_THE_FOCUSING_IRIS,1); break; - case GOSSIP_ACTION_INFO_DEF + 7: + case GOSSIP_ACTION_INFO_DEF + 9: player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_TABARD_OF_SUMMER_FLAMES, false); + player->AddItem(ITEM_HC_KEY_TO_THE_FOCUSING_IRIS,1); break; } return true; @@ -2999,7 +2888,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_fireworkAI(creature); } @@ -3031,7 +2920,7 @@ public: struct npc_spring_rabbitAI : public ScriptedAI { - npc_spring_rabbitAI(Creature* c) : ScriptedAI(c) { } + npc_spring_rabbitAI(Creature* creature) : ScriptedAI(creature) { } bool inLove; uint32 jumpTimer; @@ -3101,35 +2990,34 @@ public: void AddSC_npcs_special() { - new npc_air_force_bots; - new npc_lunaclaw_spirit; - new npc_chicken_cluck; - new npc_dancing_flames; - new npc_doctor; - new npc_injured_patient; - new npc_garments_of_quests; - new npc_guardian; - new npc_mount_vendor; - new npc_rogue_trainer; - new npc_sayge; - new npc_steam_tonk; - new npc_tonk_mine; - new npc_winter_reveler; - new npc_brewfest_reveler; - new npc_snake_trap; - new npc_mirror_image; - new npc_ebon_gargoyle; - new npc_lightwell; - new mob_mojo; - new npc_training_dummy; - new npc_shadowfiend; - new npc_wormhole; - new npc_pet_trainer; - new npc_locksmith; - new npc_tabard_vendor; - new npc_experience; - new npc_fire_elemental; - new npc_earth_elemental; - new npc_firework; + new npc_air_force_bots(); + new npc_lunaclaw_spirit(); + new npc_chicken_cluck(); + new npc_dancing_flames(); + new npc_doctor(); + new npc_injured_patient(); + new npc_garments_of_quests(); + new npc_guardian(); + new npc_mount_vendor(); + new npc_rogue_trainer(); + new npc_sayge(); + new npc_steam_tonk(); + new npc_tonk_mine(); + new npc_winter_reveler(); + new npc_brewfest_reveler(); + new npc_snake_trap(); + new npc_mirror_image(); + new npc_ebon_gargoyle(); + new npc_lightwell(); + new mob_mojo(); + new npc_training_dummy(); + new npc_shadowfiend(); + new npc_wormhole(); + new npc_pet_trainer(); + new npc_locksmith(); + new npc_experience(); + new npc_fire_elemental(); + new npc_earth_elemental(); + new npc_firework(); new npc_spring_rabbit(); } diff --git a/src/server/shared/AutoPtr.h b/src/server/shared/AutoPtr.h new file mode 100644 index 00000000000..988c46cc5a2 --- /dev/null +++ b/src/server/shared/AutoPtr.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> + * + * 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/>. + */ + +#ifndef _TRINITY_AUTO_PTR_H +#define _TRINITY_AUTO_PTR_H + +#include <ace/Bound_Ptr.h> + +namespace Trinity +{ + template <class Pointer, class Lock> + class AutoPtr : public ACE_Strong_Bound_Ptr<Pointer, Lock> + { + public: + AutoPtr() : ACE_Strong_Bound_Ptr<Pointer, Lock>() {} + + AutoPtr(Pointer* x) + { + ACE_Strong_Bound_Ptr<Pointer, Lock>::reset(x); + } + + operator bool() const + { + return ACE_Strong_Bound_Ptr<Pointer, Lock>::get() != NULL; + } + + bool operator !() const + { + return ACE_Strong_Bound_Ptr<Pointer, Lock>::get() == NULL; + } + + bool operator !=(Pointer* x) const + { + return ACE_Strong_Bound_Ptr<Pointer, Lock>::get() != x; + } + }; +}; + +#endif
\ No newline at end of file diff --git a/src/server/shared/CMakeLists.txt b/src/server/shared/CMakeLists.txt index 3ec35b5394a..de998442419 100644 --- a/src/server/shared/CMakeLists.txt +++ b/src/server/shared/CMakeLists.txt @@ -53,7 +53,6 @@ set(shared_STAT_SRCS include_directories( ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/dep/SFMT - ${CMAKE_SOURCE_DIR}/dep/mersennetwister ${CMAKE_SOURCE_DIR}/dep/sockets/include ${CMAKE_SOURCE_DIR}/dep/utf8cpp ${CMAKE_SOURCE_DIR}/src/server diff --git a/src/server/shared/Common.h b/src/server/shared/Common.h index 57809cca255..259c60ade20 100755 --- a/src/server/shared/Common.h +++ b/src/server/shared/Common.h @@ -208,10 +208,14 @@ typedef std::vector<std::string> StringVector; ACE_Guard< MUTEX > TRINITY_GUARD_OBJECT (LOCK); \ if (TRINITY_GUARD_OBJECT.locked() == 0) ASSERT(false); +//! For proper implementation of multiple-read, single-write pattern, use +//! ACE_RW_Mutex as underlying @MUTEX # define TRINITY_WRITE_GUARD(MUTEX, LOCK) \ ACE_Write_Guard< MUTEX > TRINITY_GUARD_OBJECT (LOCK); \ if (TRINITY_GUARD_OBJECT.locked() == 0) ASSERT(false); +//! For proper implementation of multiple-read, single-write pattern, use +//! ACE_RW_Mutex as underlying @MUTEX # define TRINITY_READ_GUARD(MUTEX, LOCK) \ ACE_Read_Guard< MUTEX > TRINITY_GUARD_OBJECT (LOCK); \ if (TRINITY_GUARD_OBJECT.locked() == 0) ASSERT(false); diff --git a/src/server/shared/Containers.h b/src/server/shared/Containers.h new file mode 100644 index 00000000000..f0242cbff0e --- /dev/null +++ b/src/server/shared/Containers.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> + * + * 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/>. + */ + +#ifndef TRINITY_CONTAINERS_H +#define TRINITY_CONTAINERS_H + +#include <list> + +//! Because circular includes are bad +extern uint32 urand(uint32 min, uint32 max); + +namespace Trinity +{ + namespace Containers + { + template<class T> + void RandomResizeList(std::list<T> &list, uint32 size) + { + size_t list_size = list.size(); + + while (list_size > size) + { + typename std::list<T>::iterator itr = list.begin(); + std::advance(itr, urand(0, list_size - 1)); + list.erase(itr); + --list_size; + } + } + + template<class T, class Predicate> + void RandomResizeList(std::list<T> &list, Predicate& predicate, uint32 size) + { + //! First use predicate filter + std::list<T> listCopy; + for (typename std::list<T>::iterator itr = list.begin(); itr != list.end(); ++itr) + if (predicate(*itr)) + listCopy.push_back(*itr); + + if (size) + RandomResizeList(listCopy, size); + + list = listCopy; + } + + /* Select a random element from a container. Note: make sure you explicitly empty check the container */ + template <class C> typename C::value_type const& SelectRandomContainerElement(C const& container) + { + typename C::const_iterator it = container.begin(); + std::advance(it, urand(0, container.size() - 1)); + return *it; + } + }; + //! namespace Containers +}; +//! namespace Trinity + +#endif //! #ifdef TRINITY_CONTAINERS_H
\ No newline at end of file diff --git a/src/server/shared/Cryptography/BigNumber.cpp b/src/server/shared/Cryptography/BigNumber.cpp index f55e87c99fc..364ee76ec75 100755 --- a/src/server/shared/Cryptography/BigNumber.cpp +++ b/src/server/shared/Cryptography/BigNumber.cpp @@ -16,6 +16,8 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <ace/Guard_T.h> + #include "Cryptography/BigNumber.h" #include <openssl/bn.h> #include <openssl/crypto.h> @@ -169,6 +171,8 @@ uint8 *BigNumber::AsByteArray(int minSize, bool reverse) { int length = (minSize >= GetNumBytes()) ? minSize : GetNumBytes(); + ACE_GUARD_RETURN(ACE_Mutex, g, _lock, 0); + if (_array) { delete[] _array; diff --git a/src/server/shared/Cryptography/BigNumber.h b/src/server/shared/Cryptography/BigNumber.h index 7196aae6579..6646245a6a0 100755 --- a/src/server/shared/Cryptography/BigNumber.h +++ b/src/server/shared/Cryptography/BigNumber.h @@ -20,6 +20,7 @@ #define _AUTH_BIGNUMBER_H #include "Define.h" +#include <ace/Mutex.h> struct bignum_st; @@ -89,6 +90,10 @@ class BigNumber private: struct bignum_st *_bn; uint8 *_array; + + // This mutex only controls thread-safe access to AsByteArray() and should be replaced with a thread-safe implementation of BigNumber + ACE_Mutex _lock; + }; #endif diff --git a/src/server/shared/Cryptography/HMACSHA1.cpp b/src/server/shared/Cryptography/HMACSHA1.cpp index 447d0b58efc..c9de1191464 100755 --- a/src/server/shared/Cryptography/HMACSHA1.cpp +++ b/src/server/shared/Cryptography/HMACSHA1.cpp @@ -31,19 +31,9 @@ HmacHash::~HmacHash() HMAC_CTX_cleanup(&m_ctx); } -void HmacHash::UpdateBigNumber(BigNumber* bn) -{ - UpdateData(bn->AsByteArray(), bn->GetNumBytes()); -} - -void HmacHash::UpdateData(const uint8 *data, int length) -{ - HMAC_Update(&m_ctx, data, length); -} - void HmacHash::UpdateData(const std::string &str) { - UpdateData((uint8 const*)str.c_str(), str.length()); + HMAC_Update(&m_ctx, (uint8 const*)str.c_str(), str.length()); } void HmacHash::Finalize() diff --git a/src/server/shared/Cryptography/HMACSHA1.h b/src/server/shared/Cryptography/HMACSHA1.h index bd0418b600e..4b7667968ca 100755 --- a/src/server/shared/Cryptography/HMACSHA1.h +++ b/src/server/shared/Cryptography/HMACSHA1.h @@ -33,8 +33,6 @@ class HmacHash public: HmacHash(uint32 len, uint8 *seed); ~HmacHash(); - void UpdateBigNumber(BigNumber* bn); - void UpdateData(const uint8 *data, int length); void UpdateData(const std::string &str); void Finalize(); uint8 *ComputeHash(BigNumber* bn); diff --git a/src/server/shared/Cryptography/SHA1.h b/src/server/shared/Cryptography/SHA1.h index b5bf97fd7d9..7c77defebfa 100755 --- a/src/server/shared/Cryptography/SHA1.h +++ b/src/server/shared/Cryptography/SHA1.h @@ -31,7 +31,6 @@ class SHA1Hash SHA1Hash(); ~SHA1Hash(); - void UpdateFinalizeBigNumbers(BigNumber* bn0, ...); void UpdateBigNumbers(BigNumber* bn0, ...); void UpdateData(const uint8 *dta, int len); diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h index b91972e5b0c..314d196cc06 100755 --- a/src/server/shared/Database/DatabaseWorkerPool.h +++ b/src/server/shared/Database/DatabaseWorkerPool.h @@ -33,17 +33,11 @@ class PingOperation : public SQLOperation { - /// Operation for idle delaythreads + //! Operation for idle delaythreads bool Execute() { - if (m_conn->LockIfReady()) - { - m_conn->Ping(); - m_conn->Unlock(); - return true; - } - - return false; + m_conn->Ping(); + return true; } }; @@ -53,10 +47,10 @@ class DatabaseWorkerPool public: /* Activity state */ DatabaseWorkerPool() : - m_queue(new ACE_Activation_Queue(new ACE_Message_Queue<ACE_MT_SYNCH>)) + _queue(new ACE_Activation_Queue()) { - memset(m_connectionCount, 0, sizeof(m_connectionCount)); - m_connections.resize(IDX_SIZE); + memset(_connectionCount, 0, sizeof(_connectionCount)); + _connections.resize(IDX_SIZE); WPFatal (mysql_thread_safe(), "Used MySQL library isn't thread-safe."); } @@ -68,64 +62,72 @@ class DatabaseWorkerPool bool Open(const std::string& infoString, uint8 async_threads, uint8 synch_threads) { bool res = true; - m_connectionInfo = MySQLConnectionInfo(infoString); + _connectionInfo = MySQLConnectionInfo(infoString); - sLog->outSQLDriver("Opening databasepool '%s'. Async threads: %u, synch threads: %u", m_connectionInfo.database.c_str(), async_threads, synch_threads); + sLog->outSQLDriver("Opening DatabasePool '%s'. Asynchronous connections: %u, synchronous connections: %u.", + GetDatabaseName(), async_threads, synch_threads); - /// Open asynchronous connections (delayed operations) - m_connections[IDX_ASYNC].resize(async_threads); + //! Open asynchronous connections (delayed operations) + _connections[IDX_ASYNC].resize(async_threads); for (uint8 i = 0; i < async_threads; ++i) { - T* t = new T(m_queue, m_connectionInfo); + T* t = new T(_queue, _connectionInfo); res &= t->Open(); - m_connections[IDX_ASYNC][i] = t; - ++m_connectionCount[IDX_ASYNC]; + _connections[IDX_ASYNC][i] = t; + ++_connectionCount[IDX_ASYNC]; } - /// Open synchronous connections (direct, blocking operations) - m_connections[IDX_SYNCH].resize(synch_threads); + //! Open synchronous connections (direct, blocking operations) + _connections[IDX_SYNCH].resize(synch_threads); for (uint8 i = 0; i < synch_threads; ++i) { - T* t = new T(m_connectionInfo); + T* t = new T(_connectionInfo); res &= t->Open(); - m_connections[IDX_SYNCH][i] = t; - ++m_connectionCount[IDX_SYNCH]; + _connections[IDX_SYNCH][i] = t; + ++_connectionCount[IDX_SYNCH]; } - sLog->outSQLDriver("Databasepool opened successfully. %u total connections running.", (m_connectionCount[IDX_SYNCH] + m_connectionCount[IDX_ASYNC])); + if (res) + sLog->outSQLDriver("DatabasePool '%s' opened successfully. %u total connections running.", GetDatabaseName(), + (_connectionCount[IDX_SYNCH] + _connectionCount[IDX_ASYNC])); + else + sLog->outError("DatabasePool %s NOT opened. There were errors opening the MySQL connections. Check your SQLDriverLogFile " + "for specific errors.", GetDatabaseName()); return res; } void Close() { - sLog->outSQLDriver("Closing down databasepool '%s'.", m_connectionInfo.database.c_str()); + sLog->outSQLDriver("Closing down DatabasePool '%s'.", GetDatabaseName()); - /// Shuts down delaythreads for this connection pool by underlying deactivate() - m_queue->queue()->close(); + //! Shuts down delaythreads for this connection pool by underlying deactivate(). + //! The next dequeue attempt in the worker thread tasks will result in an error, + //! ultimately ending the worker thread task. + _queue->queue()->close(); - for (uint8 i = 0; i < m_connectionCount[IDX_ASYNC]; ++i) + for (uint8 i = 0; i < _connectionCount[IDX_ASYNC]; ++i) { - /// TODO: Better way. probably should flip a boolean and check it on low level code before doing anything on the mysql ctx - /// Now we just wait until m_queue gives the signal to the worker threads to stop - T* t = m_connections[IDX_ASYNC][i]; + T* t = _connections[IDX_ASYNC][i]; DatabaseWorker* worker = t->m_worker; - worker->wait(); + worker->wait(); //! Block until no more threads are running this task. delete worker; - t->Close(); + t->Close(); //! Closes the actualy MySQL connection. } - sLog->outSQLDriver("Asynchronous connections on databasepool '%s' terminated. Proceeding with synchronous connections.", m_connectionInfo.database.c_str()); + sLog->outSQLDriver("Asynchronous connections on DatabasePool '%s' terminated. Proceeding with synchronous connections.", + GetDatabaseName()); - /// Shut down the synchronous connections - for (uint8 i = 0; i < m_connectionCount[IDX_SYNCH]; ++i) - { - T* t = m_connections[IDX_SYNCH][i]; - //while (1) - // if (t->LockIfReady()) -- For some reason deadlocks us - t->Close(); - } + //! Shut down the synchronous connections + //! There's no need for locking the connection, because DatabaseWorkerPool<>::Close + //! should only be called after any other thread tasks in the core have exited, + //! meaning there can be no concurrent access at this point. + for (uint8 i = 0; i < _connectionCount[IDX_SYNCH]; ++i) + _connections[IDX_SYNCH][i]->Close(); + + //! Deletes the ACE_Activation_Queue object and its underlying ACE_Message_Queue + delete _queue; - sLog->outSQLDriver("All connections on databasepool %s closed.", m_connectionInfo.database.c_str()); + sLog->outSQLDriver("All connections on DatabasePool '%s' closed.", GetDatabaseName()); } /** @@ -133,6 +135,7 @@ class DatabaseWorkerPool */ //! Enqueues a one-way SQL operation in string format that will be executed asynchronously. + //! This method should only be used for queries that are only executed once, e.g during startup. void Execute(const char* sql) { if (!sql) @@ -143,6 +146,7 @@ class DatabaseWorkerPool } //! Enqueues a one-way SQL operation in string format -with variable args- that will be executed asynchronously. + //! This method should only be used for queries that are only executed once, e.g during startup. void PExecute(const char* sql, ...) { if (!sql) @@ -166,10 +170,11 @@ class DatabaseWorkerPool } /** - Direct syncrhonous one-way statement methods. + Direct synchronous one-way statement methods. */ //! Directly executes a one-way SQL operation in string format, that will block the calling thread until finished. + //! This method should only be used for queries that are only executed once, e.g during startup. void DirectExecute(const char* sql) { if (!sql) @@ -181,6 +186,7 @@ class DatabaseWorkerPool } //! Directly executes a one-way SQL operation in string format -with variable args-, that will block the calling thread until finished. + //! This method should only be used for queries that are only executed once, e.g during startup. void DirectPExecute(const char* sql, ...) { if (!sql) @@ -233,7 +239,7 @@ class DatabaseWorkerPool va_list ap; char szQuery[MAX_QUERY_LEN]; - va_start(ap, sql); + va_start(ap, conn); vsnprintf(szQuery, MAX_QUERY_LEN, sql, ap); va_end(ap); @@ -265,6 +271,9 @@ class DatabaseWorkerPool PreparedResultSet* ret = t->Query(stmt); t->Unlock(); + //! Delete proxy-class. Not needed anymore + delete stmt; + if (!ret || !ret->GetRowCount()) return PreparedQueryResult(NULL); @@ -335,20 +344,22 @@ class DatabaseWorkerPool //! were appended to the transaction will be respected during execution. void CommitTransaction(SQLTransaction transaction) { - if (sLog->GetSQLDriverQueryLogging()) + #ifdef TRINITY_DEBUG + //! Only analyze transaction weaknesses in Debug mode. + //! Ideally we catch the faults in Debug mode and then correct them, + //! so there's no need to waste these CPU cycles in Release mode. + switch (transaction->GetSize()) { - switch (transaction->GetSize()) - { - case 0: - sLog->outSQLDriver("Transaction contains 0 queries. Not executing."); - return; - case 1: - sLog->outSQLDriver("Warning: Transaction only holds 1 query, consider removing Transaction context in code."); - break; - default: - break; - } + case 0: + sLog->outSQLDriver("Transaction contains 0 queries. Not executing."); + return; + case 1: + sLog->outSQLDriver("Warning: Transaction only holds 1 query, consider removing Transaction context in code."); + break; + default: + break; } + #endif // TRINITY_DEBUG Enqueue(new TransactionTask(transaction)); } @@ -364,9 +375,11 @@ class DatabaseWorkerPool return; } + //! Handle MySQL Errno 1213 without extending deadlock to the core itself + //! TODO: More elegant way if (con->GetLastError() == 1213) { - uint8 loopBreaker = 5; // Handle MySQL Errno 1213 without extending deadlock to the core itself + uint8 loopBreaker = 5; for (uint8 i = 0; i < loopBreaker; ++i) { if (con->ExecuteTransaction(transaction)) @@ -374,7 +387,7 @@ class DatabaseWorkerPool } } - // Clean up now. + //! Clean up now. transaction->Cleanup(); con->Unlock(); @@ -405,6 +418,7 @@ class DatabaseWorkerPool */ //! Automanaged (internally) pointer to a prepared statement object for usage in upper level code. + //! Pointer is deleted in this->Query(PreparedStatement*) or PreparedStatementTask::~PreparedStatementTask. //! This object is not tied to the prepared statement on the MySQL context yet until execution. PreparedStatement* GetPreparedStatement(uint32 index) { @@ -426,10 +440,10 @@ class DatabaseWorkerPool //! Keeps all our MySQL connections alive, prevent the server from disconnecting us. void KeepAlive() { - /// Ping synchronous connections - for (uint8 i = 0; i < m_connectionCount[IDX_SYNCH]; ++i) + //! Ping synchronous connections + for (uint8 i = 0; i < _connectionCount[IDX_SYNCH]; ++i) { - T* t = m_connections[IDX_SYNCH][i]; + T* t = _connections[IDX_SYNCH][i]; if (t->LockIfReady()) { t->Ping(); @@ -437,10 +451,10 @@ class DatabaseWorkerPool } } - /// Assuming all worker threads are free, every worker thread will receive 1 ping operation request - /// If one or more worker threads are busy, the ping operations will not be split evenly, but this doesn't matter - /// as the sole purpose is to prevent connections from idling. - for (size_t i = 0; i < m_connections[IDX_ASYNC].size(); ++i) + //! Assuming all worker threads are free, every worker thread will receive 1 ping operation request + //! If one or more worker threads are busy, the ping operations will not be split evenly, but this doesn't matter + //! as the sole purpose is to prevent connections from idling. + for (size_t i = 0; i < _connections[IDX_ASYNC].size(); ++i) Enqueue(new PingOperation); } @@ -450,41 +464,50 @@ class DatabaseWorkerPool if (!to || !from || !length) return 0; - return mysql_real_escape_string(m_connections[IDX_SYNCH][0]->GetHandle(), to, from, length); + return mysql_real_escape_string(_connections[IDX_SYNCH][0]->GetHandle(), to, from, length); } void Enqueue(SQLOperation* op) { - m_queue->enqueue(op); + _queue->enqueue(op); } + //! Gets a free connection in the synchronous connection pool. + //! Caller MUST call t->Unlock() after touching the MySQL context to prevent deadlocks. T* GetFreeConnection() { uint8 i = 0; - size_t num_cons = m_connectionCount[IDX_SYNCH]; - for (;;) /// Block forever until a connection is free + size_t num_cons = _connectionCount[IDX_SYNCH]; + //! Block forever until a connection is free + for (;;) { - T* t = m_connections[IDX_SYNCH][++i % num_cons ]; - if (t->LockIfReady()) /// Must be matched with t->Unlock() or you will get deadlocks + T* t = _connections[IDX_SYNCH][++i % num_cons]; + //! Must be matched with t->Unlock() or you will get deadlocks + if (t->LockIfReady()) return t; } - // This will be called when Celine Dion learns to sing + //! This will be called when Celine Dion learns to sing return NULL; } + char const* GetDatabaseName() const + { + return _connectionInfo.database.c_str(); + } + private: - enum + enum _internalIndex { IDX_ASYNC, IDX_SYNCH, IDX_SIZE, }; - ACE_Activation_Queue* m_queue; //! Queue shared by async worker threads. - std::vector< std::vector<T*> > m_connections; - uint32 m_connectionCount[2]; //! Counter of MySQL connections; - MySQLConnectionInfo m_connectionInfo; + ACE_Activation_Queue* _queue; //! Queue shared by async worker threads. + std::vector< std::vector<T*> > _connections; + uint32 _connectionCount[2]; //! Counter of MySQL connections; + MySQLConnectionInfo _connectionInfo; }; #endif diff --git a/src/server/shared/Database/Field.h b/src/server/shared/Database/Field.h index 355f6b47ff2..bfa42dbe574 100755 --- a/src/server/shared/Database/Field.h +++ b/src/server/shared/Database/Field.h @@ -41,12 +41,13 @@ class Field return 0; #ifdef TRINITY_DEBUG - if (!IsNumeric()) + if (!IsType(MYSQL_TYPE_TINY)) { - sLog->outSQLDriver("Error: GetUInt8() on non-numeric field."); + sLog->outSQLDriver("Warning: GetUInt8() on non-tinyint field. Using type: %s.", FieldTypeToString(data.type)); return 0; } #endif + if (data.raw) return *reinterpret_cast<uint8*>(data.value); return static_cast<uint8>(atol((char*)data.value)); @@ -58,12 +59,13 @@ class Field return 0; #ifdef TRINITY_DEBUG - if (!IsNumeric()) + if (!IsType(MYSQL_TYPE_TINY)) { - sLog->outSQLDriver("Error: GeInt8() on non-numeric field."); + sLog->outSQLDriver("Warning: GetInt8() on non-tinyint field. Using type: %s.", FieldTypeToString(data.type)); return 0; } #endif + if (data.raw) return *reinterpret_cast<int8*>(data.value); return static_cast<int8>(atol((char*)data.value)); @@ -75,12 +77,13 @@ class Field return 0; #ifdef TRINITY_DEBUG - if (!IsNumeric()) + if (!IsType(MYSQL_TYPE_SHORT) && !IsType(MYSQL_TYPE_YEAR)) { - sLog->outSQLDriver("Error: GetUInt16() on non-numeric field."); + sLog->outSQLDriver("Warning: GetUInt16() on non-smallint field. Using type: %s.", FieldTypeToString(data.type)); return 0; } #endif + if (data.raw) return *reinterpret_cast<uint16*>(data.value); return static_cast<uint16>(atol((char*)data.value)); @@ -92,12 +95,13 @@ class Field return 0; #ifdef TRINITY_DEBUG - if (!IsNumeric()) + if (!IsType(MYSQL_TYPE_SHORT) && !IsType(MYSQL_TYPE_YEAR)) { - sLog->outSQLDriver("Error: GetInt16() on non-numeric field."); + sLog->outSQLDriver("Warning: GetInt16() on non-smallint field. Using type: %s.", FieldTypeToString(data.type)); return 0; } #endif + if (data.raw) return *reinterpret_cast<int16*>(data.value); return static_cast<int16>(atol((char*)data.value)); @@ -109,12 +113,13 @@ class Field return 0; #ifdef TRINITY_DEBUG - if (!IsNumeric()) + if (!IsType(MYSQL_TYPE_INT24) && !IsType(MYSQL_TYPE_LONG)) { - sLog->outSQLDriver("Error: GetUInt32() on non-numeric field."); + sLog->outSQLDriver("Warning: GetUInt32() on non-(medium)int field. Using type: %s.", FieldTypeToString(data.type)); return 0; } #endif + if (data.raw) return *reinterpret_cast<uint32*>(data.value); return static_cast<uint32>(atol((char*)data.value)); @@ -126,12 +131,13 @@ class Field return 0; #ifdef TRINITY_DEBUG - if (!IsNumeric()) + if (!IsType(MYSQL_TYPE_INT24) && !IsType(MYSQL_TYPE_LONG)) { - sLog->outSQLDriver("Error: GetInt32() on non-numeric field."); + sLog->outSQLDriver("Warning: GetInt32() on non-(medium)int field. Using type: %s.", FieldTypeToString(data.type)); return 0; } #endif + if (data.raw) return *reinterpret_cast<int32*>(data.value); return static_cast<int32>(atol((char*)data.value)); @@ -143,12 +149,13 @@ class Field return 0; #ifdef TRINITY_DEBUG - if (!IsNumeric()) + if (!IsType(MYSQL_TYPE_LONGLONG) && !IsType(MYSQL_TYPE_BIT)) { - sLog->outSQLDriver("Error: GetUInt64() on non-numeric field."); + sLog->outSQLDriver("Warning: GetUInt64() on non-bigint field. Using type: %s.", FieldTypeToString(data.type)); return 0; } #endif + if (data.raw) return *reinterpret_cast<uint64*>(data.value); return static_cast<uint64>(atol((char*)data.value)); @@ -160,12 +167,13 @@ class Field return 0; #ifdef TRINITY_DEBUG - if (!IsNumeric()) + if (!IsType(MYSQL_TYPE_LONGLONG) && !IsType(MYSQL_TYPE_BIT)) { - sLog->outSQLDriver("Error: GetInt64() on non-numeric field."); + sLog->outSQLDriver("Warning: GetInt64() on non-bigint field. Using type: %s.", FieldTypeToString(data.type)); return 0; } #endif + if (data.raw) return *reinterpret_cast<int64*>(data.value); return static_cast<int64>(strtol((char*)data.value, NULL, 10)); @@ -177,12 +185,13 @@ class Field return 0.0f; #ifdef TRINITY_DEBUG - if (!IsNumeric()) + if (!IsType(MYSQL_TYPE_FLOAT)) { - sLog->outSQLDriver("Error: GetFloat() on non-numeric field."); + sLog->outSQLDriver("Warning: GetFloat() on non-float field. Using type: %s.", FieldTypeToString(data.type)); return 0.0f; } #endif + if (data.raw) return *reinterpret_cast<float*>(data.value); return static_cast<float>(atof((char*)data.value)); @@ -194,18 +203,19 @@ class Field return 0.0f; #ifdef TRINITY_DEBUG - if (!IsNumeric()) + if (!IsType(MYSQL_TYPE_DOUBLE)) { - sLog->outSQLDriver("Error: GetDouble() on non-numeric field."); + sLog->outSQLDriver("Warning: GetDouble() on non-double field. Using type: %s.", FieldTypeToString(data.type)); return 0.0f; } #endif + if (data.raw) return *reinterpret_cast<double*>(data.value); return static_cast<double>(atof((char*)data.value)); } - const char* GetCString() const + char const* GetCString() const { if (!data.value) return NULL; @@ -213,11 +223,12 @@ class Field #ifdef TRINITY_DEBUG if (IsNumeric()) { - sLog->outSQLDriver("Error: GetCString() on numeric field."); + sLog->outSQLDriver("Error: GetCString() on numeric field. Using type: %s.", FieldTypeToString(data.type)); return NULL; } #endif - return static_cast<const char*>(data.value); + return static_cast<char const*>(data.value); + } std::string GetString() const @@ -227,7 +238,7 @@ class Field if (data.raw) { - const char* string = GetCString(); + char const* string = GetCString(); if (!string) string = ""; return std::string(string, data.length); @@ -257,7 +268,7 @@ class Field #pragma pack(pop) #endif - void SetByteValue(const void* newValue, const size_t newSize, enum_field_types newType, uint32 length); + void SetByteValue(void const* newValue, size_t const newSize, enum_field_types newType, uint32 length); void SetStructuredValue(char* newValue, enum_field_types newType); void CleanUp() @@ -316,6 +327,11 @@ class Field } } + bool IsType(enum_field_types type) const + { + return data.type == type; + } + bool IsNumeric() const { return (data.type == MYSQL_TYPE_TINY || @@ -326,6 +342,43 @@ class Field data.type == MYSQL_TYPE_DOUBLE || data.type == MYSQL_TYPE_LONGLONG ); } + + private: + #ifdef TRINITY_DEBUG + static char const* FieldTypeToString(enum_field_types type) + { + switch (type) + { + case MYSQL_TYPE_BIT: return "BIT"; + case MYSQL_TYPE_BLOB: return "BLOB"; + case MYSQL_TYPE_DATE: return "DATE"; + case MYSQL_TYPE_DATETIME: return "DATETIME"; + case MYSQL_TYPE_NEWDECIMAL: return "NEWDECIMAL"; + case MYSQL_TYPE_DECIMAL: return "DECIMAL"; + case MYSQL_TYPE_DOUBLE: return "DOUBLE"; + case MYSQL_TYPE_ENUM: return "ENUM"; + case MYSQL_TYPE_FLOAT: return "FLOAT"; + case MYSQL_TYPE_GEOMETRY: return "GEOMETRY"; + case MYSQL_TYPE_INT24: return "INT24"; + case MYSQL_TYPE_LONG: return "LONG"; + case MYSQL_TYPE_LONGLONG: return "LONGLONG"; + case MYSQL_TYPE_LONG_BLOB: return "LONG_BLOB"; + case MYSQL_TYPE_MEDIUM_BLOB: return "MEDIUM_BLOB"; + case MYSQL_TYPE_NEWDATE: return "NEWDATE"; + case MYSQL_TYPE_NULL: return "NULL"; + case MYSQL_TYPE_SET: return "SET"; + case MYSQL_TYPE_SHORT: return "SHORT"; + case MYSQL_TYPE_STRING: return "STRING"; + case MYSQL_TYPE_TIME: return "TIME"; + case MYSQL_TYPE_TIMESTAMP: return "TIMESTAMP"; + case MYSQL_TYPE_TINY: return "TINY"; + case MYSQL_TYPE_TINY_BLOB: return "TINY_BLOB"; + case MYSQL_TYPE_VAR_STRING: return "VAR_STRING"; + case MYSQL_TYPE_YEAR: return "YEAR"; + default: return "-Unknown-"; + } + } + #endif }; #endif diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index 72f509706e8..42e7fdbe087 100755 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -27,13 +27,15 @@ void CharacterDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(CHAR_DEL_NONEXISTENT_GUILD_BANK_ITEM, "DELETE FROM guild_bank_item WHERE guildid = ? AND TabId = ? AND SlotId = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_DEL_EXPIRED_BANS, "UPDATE character_banned SET active = 0 WHERE unbandate <= UNIX_TIMESTAMP() AND unbandate <> bandate", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_SEL_GUID_BY_NAME, "SELECT guid FROM characters WHERE name = ?", CONNECTION_BOTH); - PREPARE_STATEMENT(CHAR_SEL_CHECK_NAME, "SELECT 1 FROM characters WHERE name = ?", CONNECTION_ASYNC); - PREPARE_STATEMENT(CHAR_SEL_SUM_CHARS, "SELECT COUNT(guid) FROM characters WHERE account = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_SEL_CHECK_NAME, "SELECT 1 FROM characters WHERE name = ?", CONNECTION_BOTH); + PREPARE_STATEMENT(CHAR_SEL_CHECK_GUID, "SELECT 1 FROM characters WHERE guid = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_SUM_CHARS, "SELECT COUNT(guid) FROM characters WHERE account = ?", CONNECTION_BOTH); PREPARE_STATEMENT(CHAR_SEL_CHAR_CREATE_INFO, "SELECT level, race, class FROM characters WHERE account = ? LIMIT 0, ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_INS_CHARACTER_BAN, "INSERT INTO character_banned VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, ?, ?, 1)", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_UPD_CHARACTER_BAN, "UPDATE character_banned SET active = 0 WHERE guid = ? AND active != 0", CONNECTION_ASYNC) + PREPARE_STATEMENT(CHAR_DEL_CHARACTER_BAN, "DELETE cb FROM character_banned cb INNER JOIN characters c ON c.guid = cb.guid WHERE c.account = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_SEL_BANINFO, "SELECT FROM_UNIXTIME(bandate), unbandate-bandate, active, unbandate, banreason, bannedby FROM character_banned WHERE guid = ? ORDER BY bandate ASC", CONNECTION_SYNCH) - PREPARE_STATEMENT(CHAR_SEL_GUID_BY_NAME_FILTER, "SELECT guid, name FROM characters WHERE name LIKE CONCAT('%', ?, '%')", CONNECTION_SYNCH) + PREPARE_STATEMENT(CHAR_SEL_GUID_BY_NAME_FILTER, "SELECT guid, name FROM characters WHERE name LIKE CONCAT('%%', ?, '%%')", CONNECTION_SYNCH) PREPARE_STATEMENT(CHAR_SEL_BANINFO_LIST, "SELECT bandate, unbandate, bannedby, banreason FROM character_banned WHERE guid = ? ORDER BY unbandate", CONNECTION_SYNCH) PREPARE_STATEMENT(CHAR_SEL_BANNED_NAME, "SELECT characters.name FROM characters, character_banned WHERE character_banned.guid = ? AND character_banned.guid = characters.guid", CONNECTION_SYNCH) PREPARE_STATEMENT(CHAR_SEL_ENUM, "SELECT c.guid, c.name, c.race, c.class, c.gender, c.playerBytes, c.playerBytes2, c.level, c.zone, c.map, c.position_x, c.position_y, c.position_z, gm.guildid, c.playerFlags, c.at_login, cp.entry, cp.modelid, cp.level, c.equipmentCache, cb.guid FROM characters AS c LEFT JOIN character_pet AS cp ON c.guid = cp.owner AND cp.slot = ? LEFT JOIN guild_member AS gm ON c.guid = gm.guid LEFT JOIN character_banned AS cb ON c.guid = cb.guid AND cb.active = 1 WHERE c.account = ? ORDER BY c.guid", CONNECTION_ASYNC); @@ -43,7 +45,13 @@ void CharacterDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(CHAR_SEL_PET_ENTRY, "SELECT entry FROM character_pet WHERE owner = ? AND id = ? AND slot >= ? AND slot <= ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_SEL_PET_SLOT_BY_ID, "SELECT slot, entry FROM character_pet WHERE owner = ? AND id = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_SEL_FREE_NAME, "SELECT guid, name FROM characters WHERE guid = ? AND account = ? AND (at_login & ?) = ? AND NOT EXISTS (SELECT NULL FROM characters WHERE name = ?)", CONNECTION_ASYNC); - PREPARE_STATEMENT(CHAR_SEL_GUID_RACE_ACC_BY_NAME, "SELECT guid, race, account FROM characters WHERE name = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_SEL_GUID_RACE_ACC_BY_NAME, "SELECT guid, race, account FROM characters WHERE name = ?", CONNECTION_BOTH); + PREPARE_STATEMENT(CHAR_SEL_CHAR_RACE, "SELECT race FROM characters WHERE guid = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHAR_LEVEL, "SELECT level FROM characters WHERE guid = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHAR_ZONE, "SELECT zone FROM characters WHERE guid = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHARACTER_NAME_DATA, "SELECT race, class, gender FROM characters WHERE guid = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHAR_POSITION_XYZ, "SELECT map, position_x, position_y, position_z FROM characters WHERE guid = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHAR_POSITION, "SELECT position_x, position_y, position_z, orientation, map, taxi_path FROM characters WHERE guid = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_DEL_QUEST_STATUS_DAILY, "DELETE FROM character_queststatus_daily", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_DEL_QUEST_STATUS_WEEKLY, "DELETE FROM character_queststatus_weekly", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_DEL_QUEST_STATUS_SEASONAL, "DELETE FROM character_queststatus_seasonal WHERE event = ?", CONNECTION_ASYNC); @@ -59,13 +67,13 @@ void CharacterDatabaseConnection::DoPrepareStatements() "resettalents_time, talentTree, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, instance_mode_mask, " "conquestPoints, totalHonorPoints, totalKills, todayKills, yesterdayKills, chosenTitle, watchedFaction, drunk, " "health, power1, power2, power3, power4, power5, instance_id, speccount, activespec, exploredZones, equipmentCache, knownTitles, actionBars, grantableLevels, guildId FROM characters WHERE guid = ?", CONNECTION_ASYNC) - PREPARE_STATEMENT(CHAR_SEL_GROUP_MEMBER, "SELECT guid FROM group_member WHERE memberGuid = ?", CONNECTION_ASYNC) + PREPARE_STATEMENT(CHAR_SEL_GROUP_MEMBER, "SELECT guid FROM group_member WHERE memberGuid = ?", CONNECTION_BOTH) PREPARE_STATEMENT(CHAR_SEL_CHARACTER_INSTANCE, "SELECT id, permanent, map, difficulty, resettime FROM character_instance LEFT JOIN instance ON instance = id WHERE guid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_SEL_CHARACTER_AURAS, "SELECT caster_guid, spell, effect_mask, recalculate_mask, stackcount, amount0, amount1, amount2, " "base_amount0, base_amount1, base_amount2, maxduration, remaintime, remaincharges FROM character_aura WHERE guid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_SEL_CHARACTER_SPELL, "SELECT spell, active, disabled FROM character_spell WHERE guid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_SEL_CHARACTER_QUESTSTATUS, "SELECT quest, status, explored, timer, mobcount1, mobcount2, mobcount3, mobcount4, " - "itemcount1, itemcount2, itemcount3, itemcount4, playercount FROM character_queststatus WHERE guid = ?", CONNECTION_ASYNC) + "itemcount1, itemcount2, itemcount3, itemcount4, playercount FROM character_queststatus WHERE guid = ? AND status <> 0", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_SEL_CHARACTER_DAILYQUESTSTATUS, "SELECT quest, time FROM character_queststatus_daily WHERE guid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_SEL_CHARACTER_WEEKLYQUESTSTATUS, "SELECT quest FROM character_queststatus_weekly WHERE guid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_SEL_CHARACTER_SEASONALQUESTSTATUS, "SELECT quest, event FROM character_queststatus_seasonal WHERE guid = ?", CONNECTION_ASYNC) @@ -78,11 +86,12 @@ void CharacterDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(CHAR_SEL_CHARACTER_ACTIONS, "SELECT a.button, a.action, a.type FROM character_action as a, characters as c WHERE a.guid = c.guid AND a.spec = c.activespec AND a.guid = ? ORDER BY button", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_SEL_CHARACTER_MAILCOUNT, "SELECT COUNT(id) FROM mail WHERE receiver = ? AND (checked & 1) = 0 AND deliver_time <= ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_SEL_CHARACTER_MAILDATE, "SELECT MIN(deliver_time) FROM mail WHERE receiver = ? AND (checked & 1) = 0", CONNECTION_ASYNC) + PREPARE_STATEMENT(CHAR_SEL_MAIL_COUNT, "SELECT COUNT(*) FROM mail WHERE receiver = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_SEL_CHARACTER_SOCIALLIST, "SELECT friend, flags, note FROM character_social JOIN characters ON characters.guid = character_social.friend WHERE character_social.guid = ? AND deleteinfos_name IS NULL LIMIT 255", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_SEL_CHARACTER_HOMEBIND, "SELECT mapId, zoneId, posX, posY, posZ FROM character_homebind WHERE guid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_SEL_CHARACTER_SPELLCOOLDOWNS, "SELECT spell, item, time FROM character_spell_cooldown WHERE guid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_SEL_CHARACTER_DECLINEDNAMES, "SELECT genitive, dative, accusative, instrumental, prepositional FROM character_declinedname WHERE guid = ?", CONNECTION_ASYNC) - PREPARE_STATEMENT(CHAR_SEL_GUILD_MEMBER, "SELECT guildid, rank FROM guild_member WHERE guid = ?", CONNECTION_ASYNC) + PREPARE_STATEMENT(CHAR_SEL_GUILD_MEMBER, "SELECT guildid, rank FROM guild_member WHERE guid = ?", CONNECTION_BOTH) PREPARE_STATEMENT(CHAR_SEL_CHARACTER_ACHIEVEMENTS, "SELECT achievement, date FROM character_achievement WHERE guid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_SEL_CHARACTER_CRITERIAPROGRESS, "SELECT criteria, counter, date FROM character_achievement_progress WHERE guid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_SEL_CHARACTER_EQUIPMENTSETS, "SELECT setguid, setindex, name, iconname, item0, item1, item2, item3, item4, item5, item6, item7, item8, " @@ -103,8 +112,10 @@ void CharacterDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(CHAR_SEL_AUCTIONS, "SELECT id, auctioneerguid, itemguid, itemEntry, itemowner, buyoutprice, time, buyguid, lastbid, startbid, deposit FROM auctionhouse ah INNER JOIN item_instance ii ON ii.guid = ah.itemguid", CONNECTION_SYNCH) PREPARE_STATEMENT(CHAR_INS_AUCTION, "INSERT INTO auctionhouse (id, auctioneerguid, itemguid, itemowner, buyoutprice, time, buyguid, lastbid, startbid, deposit) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_DEL_AUCTION, "DELETE FROM auctionhouse WHERE id = ?", CONNECTION_ASYNC) + PREPARE_STATEMENT(CHAR_SEL_AUCTION_BY_TIME, "SELECT id FROM auctionhouse WHERE time <= ? ORDER BY TIME ASC", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_UPD_AUCTION_BID, "UPDATE auctionhouse SET buyguid = ?, lastbid = ? WHERE id = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_INS_MAIL, "INSERT INTO mail(id, messageType, stationery, mailTemplateId, sender, receiver, subject, body, has_items, expire_time, deliver_time, money, cod, checked) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC) - PREPARE_STATEMENT(CHAR_DEL_MAIL, "DELETE FROM mail WHERE id = ?", CONNECTION_ASYNC) + PREPARE_STATEMENT(CHAR_DEL_MAIL_BY_ID, "DELETE FROM mail WHERE id = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_INS_MAIL_ITEM, "INSERT INTO mail_items(mail_id, item_guid, receiver) VALUES (?, ?, ?)", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_DEL_MAIL_ITEM, "DELETE FROM mail_items WHERE item_guid = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_DEL_INVALID_MAIL_ITEM, "DELETE FROM mail_items WHERE item_guid = ?", CONNECTION_ASYNC); @@ -120,17 +131,20 @@ void CharacterDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(CHAR_DEL_ITEM_BOP_TRADE, "DELETE FROM item_soulbound_trade_data WHERE itemGuid = ? LIMIT 1", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_INS_ITEM_BOP_TRADE, "INSERT INTO item_soulbound_trade_data VALUES (?, ?)", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_REP_INVENTORY_ITEM, "REPLACE INTO character_inventory (guid, bag, slot, item) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC) - PREPARE_STATEMENT(CHAR_DEL_INVENTORY_ITEM, "DELETE FROM character_inventory WHERE item = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_REP_ITEM_INSTANCE, "REPLACE INTO item_instance (itemEntry, owner_guid, creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text, guid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_UPD_ITEM_INSTANCE, "UPDATE item_instance SET itemEntry = ?, owner_guid = ?, creatorGuid = ?, giftCreatorGuid = ?, count = ?, duration = ?, charges = ?, flags = ?, enchantments = ?, randomPropertyId = ?, durability = ?, playedTime = ?, text = ? WHERE guid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_UPD_ITEM_INSTANCE_ON_LOAD, "UPDATE item_instance SET duration = ?, flags = ?, durability = ? WHERE guid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_DEL_ITEM_INSTANCE, "DELETE FROM item_instance WHERE guid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_UPD_GIFT_OWNER, "UPDATE character_gifts SET guid = ? WHERE item_guid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_DEL_GIFT, "DELETE FROM character_gifts WHERE item_guid = ?", CONNECTION_ASYNC) + PREPARE_STATEMENT(CHAR_SEL_CHARACTER_GIFT_BY_ITEM, "SELECT entry, flags FROM character_gifts WHERE item_guid = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_SEL_ACCOUNT_BY_NAME, "SELECT account FROM characters WHERE name = ?", CONNECTION_SYNCH) + PREPARE_STATEMENT(CHAR_SEL_ACCOUNT_BY_GUID, "SELECT account FROM characters WHERE guid = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_ACCOUNT_NAME_BY_GUID, "SELECT account, name FROM characters WHERE guid = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_DEL_ACCOUNT_INSTANCE_LOCK_TIMES, "DELETE FROM account_instance_times WHERE accountId = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_INS_ACCOUNT_INSTANCE_LOCK_TIMES, "INSERT INTO account_instance_times (accountId, instanceId, releaseTime) VALUES (?, ?, ?)", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_SEL_CHARACTER_NAME_CLASS, "SELECT name, class FROM characters WHERE guid = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHARACTER_NAME, "SELECT name FROM characters WHERE guid = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_SEL_MATCH_MAKER_RATING, "SELECT matchMakerRating FROM character_arena_stats WHERE guid = ? AND slot = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_SEL_CHARACTER_COUNT, "SELECT account, COUNT(guid) FROM characters WHERE account = ? GROUP BY account", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_UPD_NAME, "UPDATE characters set name = ?, at_login = at_login & ~ ? WHERE guid = ?", CONNECTION_ASYNC); @@ -229,13 +243,12 @@ void CharacterDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(CHAR_DEL_EQUIP_SET, "DELETE FROM character_equipmentsets WHERE setguid=?", CONNECTION_ASYNC) // Auras - PREPARE_STATEMENT(CHAR_DEL_AURA, "DELETE FROM character_aura WHERE guid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_INS_AURA, "INSERT INTO character_aura (guid, caster_guid, item_guid, spell, effect_mask, recalculate_mask, stackcount, amount0, amount1, amount2, base_amount0, base_amount1, base_amount2, maxduration, remaintime, remaincharges) " "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC) // Account data PREPARE_STATEMENT(CHAR_SEL_ACCOUNT_DATA, "SELECT type, time, data FROM account_data WHERE accountId = ?", CONNECTION_SYNCH) - PREPARE_STATEMENT(CHAR_REP_ACCOUNT_DATA, "REPLACE INTO account_data(accountId, type, time, data) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC) + PREPARE_STATEMENT(CHAR_REP_ACCOUNT_DATA, "REPLACE INTO account_data (accountId, type, time, data) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_DEL_ACCOUNT_DATA, "DELETE FROM account_data WHERE accountId = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_SEL_PLAYER_ACCOUNT_DATA, "SELECT type, time, data FROM character_account_data WHERE guid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_REP_PLAYER_ACCOUNT_DATA, "REPLACE INTO character_account_data(guid, type, time, data) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC) @@ -266,6 +279,13 @@ void CharacterDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(CHAR_SEL_PETITION_SIGNATURE, "SELECT playerguid FROM petition_sign WHERE petitionguid = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_DEL_ALL_PETITION_SIGNATURES, "DELETE FROM petition_sign WHERE playerguid = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_DEL_PETITION_SIGNATURE, "DELETE FROM petition_sign WHERE playerguid = ? AND type = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_SEL_PETITION_BY_OWNER, "SELECT petitionguid FROM petition WHERE ownerguid = ? AND type = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_PETITION_TYPE, "SELECT type FROM petition WHERE petitionguid = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_PETITION_SIGNATURES, "SELECT ownerguid, (SELECT COUNT(playerguid) FROM petition_sign WHERE petition_sign.petitionguid = ?) AS signs, type FROM petition WHERE petitionguid = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_PETITION_SIG_BY_ACCOUNT, "SELECT playerguid FROM petition_sign WHERE player_account = ? AND petitionguid = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_PETITION_OWNER_BY_GUID, "SELECT ownerguid FROM petition WHERE petitionguid = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_PETITION_SIG_BY_GUID, "SELECT ownerguid, petitionguid FROM petition_sign WHERE playerguid = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_PETITION_SIG_BY_GUID_TYPE, "SELECT ownerguid, petitionguid FROM petition_sign WHERE playerguid = ? AND type = ?", CONNECTION_SYNCH); // Arena teams PREPARE_STATEMENT(CHAR_SEL_CHARACTER_ARENAINFO, "SELECT arenaTeamId, weekGames, seasonGames, seasonWins, personalRating FROM arena_team_member WHERE guid = ?", CONNECTION_ASYNC) @@ -283,7 +303,6 @@ void CharacterDatabaseConnection::DoPrepareStatements() // Character battleground data PREPARE_STATEMENT(CHAR_INS_PLAYER_BGDATA, "INSERT INTO character_battleground_data (guid, instanceId, team, joinX, joinY, joinZ, joinO, joinMapId, taxiStart, taxiEnd, mountSpell) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_DEL_PLAYER_BGDATA, "DELETE FROM character_battleground_data WHERE guid = ?", CONNECTION_ASYNC) - PREPARE_STATEMENT(CHAR_UPD_PLAYERS_BGDATA, "UPDATE character_battleground_data SET instanceId = 0", CONNECTION_SYNCH) // Character homebind PREPARE_STATEMENT(CHAR_INS_PLAYER_HOMEBIND, "INSERT INTO character_homebind (guid, mapId, zoneId, posX, posY, posZ) VALUES (?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC) @@ -296,7 +315,6 @@ void CharacterDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(CHAR_DEL_CORPSE, "DELETE FROM corpse WHERE corpseGuid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_DEL_PLAYER_CORPSES, "DELETE FROM corpse WHERE guid = ? AND corpseType <> 0", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_DEL_OLD_CORPSES, "DELETE FROM corpse WHERE corpseType = 0 OR time < (UNIX_TIMESTAMP(NOW()) - ?)", CONNECTION_ASYNC) - PREPARE_STATEMENT(CHAR_UPD_NONEXISTENT_INSTANCE_FOR_CORPSES, "UPDATE corpse SET instanceId = 0 WHERE instanceId > 0 AND instanceId NOT IN (SELECT id FROM instance)", CONNECTION_SYNCH) // Creature respawn PREPARE_STATEMENT(CHAR_SEL_CREATURE_RESPAWNS, "SELECT guid, respawnTime, instanceId FROM creature_respawn", CONNECTION_SYNCH) @@ -305,15 +323,12 @@ void CharacterDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(CHAR_DEL_CREATURE_RESPAWN_BY_GUID, "DELETE FROM creature_respawn WHERE guid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_DEL_CREATURE_RESPAWN_BY_INSTANCE, "DELETE FROM creature_respawn WHERE instanceId = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_SEL_MAX_CREATURE_RESPAWNS, "SELECT MAX(respawnTime), instanceId FROM creature_respawn WHERE instanceId > 0 GROUP BY instanceId", CONNECTION_SYNCH) - PREPARE_STATEMENT(CHAR_DEL_NONEXISTENT_INSTANCE_CREATURE_RESPAWNS, "DELETE FROM creature_respawn WHERE instanceId > 0 AND instanceId NOT IN (SELECT id FROM instance)", CONNECTION_SYNCH) // Gameobject respawn PREPARE_STATEMENT(CHAR_SEL_GO_RESPAWNS, "SELECT guid, respawnTime, instanceId FROM gameobject_respawn", CONNECTION_SYNCH) PREPARE_STATEMENT(CHAR_REP_GO_RESPAWN, "REPLACE INTO gameobject_respawn (guid, respawnTime, instanceId) VALUES (?, ?, ?)", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_DEL_GO_RESPAWN, "DELETE FROM gameobject_respawn WHERE guid = ? AND instanceId = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_DEL_GO_RESPAWN_BY_INSTANCE, "DELETE FROM gameobject_respawn WHERE instanceId = ?", CONNECTION_ASYNC) - PREPARE_STATEMENT(CHAR_DEL_EXPIRED_GO_RESPAWNS, "DELETE FROM gameobject_respawn WHERE respawnTime <= UNIX_TIMESTAMP(NOW())", CONNECTION_SYNCH) - PREPARE_STATEMENT(CHAR_DEL_NONEXISTENT_INSTANCE_GO_RESPAWNS, "DELETE FROM gameobject_respawn WHERE instanceId > 0 AND instanceId NOT IN (SELECT id FROM instance)", CONNECTION_SYNCH) // GM Tickets PREPARE_STATEMENT(CHAR_SEL_GM_TICKETS, "SELECT ticketId, guid, name, message, createTime, mapId, posX, posY, posZ, lastModifiedTime, closedBy, assignedTo, comment, completed, escalated, viewed FROM gm_tickets", CONNECTION_SYNCH) @@ -324,7 +339,7 @@ void CharacterDatabaseConnection::DoPrepareStatements() // GM Survey/subsurvey/lag report PREPARE_STATEMENT(CHAR_INS_GM_SURVEY, "INSERT INTO gm_surveys (guid, surveyId, mainSurvey, overallComment, createTime) VALUES (?, ?, ?, ?, UNIX_TIMESTAMP(NOW()))", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_INS_GM_SUBSURVEY, "INSERT INTO gm_subsurveys (surveyId, subsurveyId, rank, comment) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC) - PREPARE_STATEMENT(CHAR_INS_LAG_REPORT, "INSERT INTO lag_reports (guid, lagType, mapId, posX, posY, posZ) VALUES (?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC) + PREPARE_STATEMENT(CHAR_INS_LAG_REPORT, "INSERT INTO lag_reports (guid, lagType, mapId, posX, posY, posZ, latency, createTime) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC) // For loading and deleting expired auctions at startup PREPARE_STATEMENT(CHAR_SEL_EXPIRED_AUCTIONS, "SELECT id, auctioneerguid, itemguid, itemEntry, itemowner, buyoutprice, time, buyguid, lastbid, startbid, deposit FROM auctionhouse ah INNER JOIN item_instance ii ON ii.guid = ah.itemguid WHERE ah.time <= ?", CONNECTION_SYNCH) @@ -386,7 +401,7 @@ void CharacterDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(CHAR_UPD_CHAR_NAME_AT_LOGIN, "UPDATE characters set name = ?, at_login = at_login & ~ ? WHERE guid = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_UPD_WORLDSTATE, "UPDATE worldstates SET value = ? WHERE entry = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_INS_WORLDSTATE, "INSERT INTO worldstates (entry, value) VALUES (?, ?)", CONNECTION_ASYNC); - PREPARE_STATEMENT(CHAR_DEL_CHAR_INSTANCE, "DELETE FROM character_instance WHERE guid = ? AND instance = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_INSTANCE_BY_INSTANCE_GUID, "DELETE FROM character_instance WHERE guid = ? AND instance = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_UPD_CHAR_INSTANCE, "UPDATE character_instance SET instance = ?, permanent = ? WHERE guid = ? AND instance = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_INS_CHAR_INSTANCE, "INSERT INTO character_instance (guid, instance, permanent) VALUES (?, ?, ?)", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_UPD_GENDER_PLAYERBYTES, "UPDATE characters SET gender = ?, playerBytes = ?, playerBytes2 = ? WHERE guid = ?", CONNECTION_ASYNC); @@ -397,5 +412,145 @@ void CharacterDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(CHAR_DEL_CHARACTER_SOCIAL, "DELETE FROM character_social WHERE guid = ? AND friend = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_UPD_CHARACTER_SOCIAL_NOTE, "UPDATE character_social SET note = ? WHERE guid = ? AND friend = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_UPD_CHARACTER_POSITION, "UPDATE characters SET position_x = ?, position_y = ?, position_z = ?, orientation = ?, map = ?, zone = ?, trans_x = 0, trans_y = 0, trans_z = 0, transguid = 0, taxi_path = '' WHERE guid = ?", CONNECTION_ASYNC); - + PREPARE_STATEMENT(CHAR_SEL_CHARACTER_AURA_FROZEN, "SELECT characters.name FROM characters LEFT JOIN character_aura ON (characters.guid = character_aura.guid) WHERE character_aura.spell = 9454", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHARACTER_ONLINE, "SELECT name, account, map, zone FROM characters WHERE online > 0", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHAR_DEL_INFO_BY_GUID, "SELECT guid, deleteInfos_Name, deleteInfos_Account, deleteDate FROM characters WHERE deleteDate IS NOT NULL AND guid = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHAR_DEL_INFO_BY_NAME, "SELECT guid, deleteInfos_Name, deleteInfos_Account, deleteDate FROM characters WHERE deleteDate IS NOT NULL AND deleteInfos_Name LIKE CONCAT('%%', ?, '%%')", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHAR_DEL_INFO, "SELECT guid, deleteInfos_Name, deleteInfos_Account, deleteDate FROM characters WHERE deleteDate IS NOT NULL", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHARS_BY_ACCOUNT_ID, "SELECT guid FROM characters WHERE account = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHAR_PINFO, "SELECT totaltime, level, money, account, race, class, map, zone FROM characters WHERE guid = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_PINFO_BANS, "SELECT unbandate, bandate = unbandate, bannedby, banreason FROM character_banned WHERE guid = ? AND active ORDER BY bandate ASC LIMIT 1", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHAR_HOMEBIND, "SELECT mapId, zoneId, posX, posY, posZ FROM character_homebind WHERE guid = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHAR_GUID_NAME_BY_ACC, "SELECT guid, name FROM characters WHERE account = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_POOL_QUEST_SAVE, "SELECT quest_id FROM pool_quest_save WHERE pool_id = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHARACTER_AT_LOGIN, "SELECT at_login FROM characters WHERE guid = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHAR_CLASS_LVL_AT_LOGIN, "SELECT class, level, at_login FROM characters WHERE guid = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_INSTANCE, "SELECT data, completedEncounters FROM instance WHERE map = ? AND id = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_PET_SPELL_LIST, "SELECT DISTINCT pet_spell.spell FROM pet_spell, character_pet WHERE character_pet.owner = ? AND character_pet.id = pet_spell.guid AND character_pet.id <> ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHAR_PET, "SELECT id FROM character_pet WHERE owner = ? AND id <> ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHAR_PETS, "SELECT id FROM character_pet WHERE owner = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHAR_COD_ITEM_MAIL, "SELECT id, messageType, mailTemplateId, sender, subject, body, money, has_items FROM mail WHERE receiver = ? AND has_items <> 0 AND cod <> 0", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHAR_SOCIAL, "SELECT DISTINCT guid FROM character_social WHERE friend = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_PET_AURA, "SELECT caster_guid, spell, effect_mask, recalculate_mask, stackcount, amount0, amount1, amount2, base_amount0, base_amount1, base_amount2, maxduration, remaintime, remaincharges FROM pet_aura WHERE guid = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHAR_OLD_CHARS, "SELECT guid, deleteInfos_Account FROM characters WHERE deleteDate IS NOT NULL AND deleteDate < ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_ARENA_TEAM_ID_BY_PLAYER_GUID, "SELECT arena_team_member.arenateamid FROM arena_team_member JOIN arena_team ON arena_team_member.arenateamid = arena_team.arenateamid WHERE guid = ? AND type = ? LIMIT 1", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_MAIL, "SELECT id, messageType, sender, receiver, subject, body, has_items, expire_time, deliver_time, money, cod, checked, stationery, mailTemplateId FROM mail WHERE receiver = ? ORDER BY id DESC", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHAR_PLAYERBYTES2, "SELECT playerBytes2 FROM characters WHERE guid = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_PET_SPELL, "SELECT spell, active FROM pet_spell WHERE guid = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_PET_SPELL_COOLDOWN, "SELECT spell, time FROM pet_spell_cooldown WHERE guid = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_PET_DECLINED_NAME, "SELECT genitive, dative, accusative, instrumental, prepositional FROM character_pet_declinedname WHERE owner = ? AND id = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHAR_GUID_BY_NAME, "SELECT guid FROM characters WHERE name = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_DEL_CHAR_AURA_FROZEN, "DELETE FROM character_aura WHERE spell = 9454 AND guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_SEL_CHAR_INVENTORY_COUNT_ITEM, "SELECT COUNT(itemEntry) FROM character_inventory ci INNER JOIN item_instance ii ON ii.guid = ci.item WHERE itemEntry = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_MAIL_COUNT_ITEM, "SELECT COUNT(itemEntry) FROM mail_items mi INNER JOIN item_instance ii ON ii.guid = mi.item_guid WHERE itemEntry = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_AUCTIONHOUSE_COUNT_ITEM,"SELECT COUNT(itemEntry) FROM auctionhouse ah INNER JOIN item_instance ii ON ii.guid = ah.itemguid WHERE itemEntry = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_GUILD_BANK_COUNT_ITEM, "SELECT COUNT(itemEntry) FROM guild_bank_item gbi INNER JOIN item_instance ii ON ii.guid = gbi.item_guid WHERE itemEntry = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHAR_INVENTORY_ITEM_BY_ENTRY, "SELECT ci.item, cb.slot AS bag, ci.slot, ci.guid, c.account, c.name FROM characters c INNER JOIN character_inventory ci ON ci.guid = c.guid INNER JOIN item_instance ii ON ii.guid = ci.item LEFT JOIN character_inventory cb ON cb.item = ci.bag WHERE ii.itemEntry = ? LIMIT ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_MAIL_ITEMS_BY_ENTRY, "SELECT mi.item_guid, m.sender, m.receiver, cs.account, cs.name, cr.account, cr.name FROM mail m INNER JOIN mail_items mi ON mi.mail_id = m.id INNER JOIN item_instance ii ON ii.guid = mi.item_guid INNER JOIN characters cs ON cs.guid = m.sender INNER JOIN characters cr ON cr.guid = m.receiver WHERE ii.itemEntry = ? LIMIT ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_AUCTIONHOUSE_ITEM_BY_ENTRY, "SELECT ah.itemguid, ah.itemowner, c.account, c.name FROM auctionhouse ah INNER JOIN characters c ON c.guid = ah.itemowner INNER JOIN item_instance ii ON ii.guid = ah.itemguid WHERE ii.itemEntry = ? LIMIT ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_GUILD_BANK_ITEM_BY_ENTRY, "SELECT gi.item_guid, gi.guildid, g.name FROM guild_bank_item gi INNER JOIN guild g ON g.guildid = gi.guildid INNER JOIN item_instance ii ON ii.guid = gi.item_guid WHERE ii.itemEntry = ? LIMIT ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHAR_PET_BY_ENTRY, "SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, curhappiness, abdata, savetime, CreatedBySpell, PetType FROM character_pet WHERE owner = ? AND id = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHAR_PET_BY_ENTRY_AND_SLOT_2, "SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, curhappiness, abdata, savetime, CreatedBySpell, PetType FROM character_pet WHERE owner = ? AND entry = ? AND (slot = ? OR slot > ?)", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHAR_PET_BY_SLOT, "SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, curhappiness, abdata, savetime, CreatedBySpell, PetType FROM character_pet WHERE owner = ? AND (slot = ? OR slot > ?) ", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_DEL_CHAR_ACHIEVEMENT, "DELETE FROM character_achievement WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_ACHIEVEMENT_PROGRESS, "DELETE FROM character_achievement_progress WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_REPUTATION_BY_FACTION, "DELETE FROM character_reputation WHERE guid = ? AND faction = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_INS_CHAR_REPUTATION_BY_FACTION, "INSERT INTO character_reputation (guid, faction, standing, flags) VALUES (?, ?, ? , ?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_UPD_CHAR_ARENA_POINTS, "UPDATE characters SET arenaPoints = (arenaPoints + ?) WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_ITEM_REFUND_INSTANCE, "DELETE FROM item_refund_instance WHERE item_guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_INS_ITEM_REFUND_INSTANCE, "INSERT INTO item_refund_instance (item_guid, player_guid, paidMoney, paidExtendedCost) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_GROUP, "DELETE FROM groups WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_GROUP_MEMBER_ALL, "DELETE FROM group_member WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_INS_CHAR_GIFT, "INSERT INTO character_gifts (guid, item_guid, entry, flags) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_INSTANCE_BY_INSTANCE, "DELETE FROM instance WHERE id = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_INSTANCE_BY_INSTANCE, "DELETE FROM character_instance WHERE instance = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_INSTANCE_BY_MAP_DIFF, "DELETE FROM character_instance USING character_instance LEFT JOIN instance ON character_instance.instance = id WHERE map = ? and difficulty = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_GROUP_INSTANCE_BY_MAP_DIFF, "DELETE FROM group_instance USING group_instance LEFT JOIN instance ON group_instance.instance = id WHERE map = ? and difficulty = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_INSTANCE_BY_MAP_DIFF, "DELETE FROM instance WHERE map = ? and difficulty = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_MAIL_ITEM_BY_ID, "DELETE FROM mail_items WHERE mail_id = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_PET_DECLINEDNAME, "DELETE FROM character_pet_declinedname WHERE id = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_ADD_CHAR_PET_DECLINEDNAME, "INSERT INTO character_pet_declinedname (id, owner, genitive, dative, accusative, instrumental, prepositional) VALUES (?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_UPD_CHAR_PET_NAME, "UPDATE character_pet SET name = ?, renamed = 1 WHERE owner = ? AND id = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_INS_PETITION, "INSERT INTO petition (ownerguid, petitionguid, name, type) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_PETITION_BY_GUID, "DELETE FROM petition WHERE petitionguid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_PETITION_SIGNATURE_BY_GUID, "DELETE FROM petition_sign WHERE petitionguid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_UDP_CHAR_PET_SLOT_BY_SLOT_EXCLUDE_ID, "UPDATE character_pet SET slot = ? WHERE owner = ? AND slot = ? AND id <> ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_UDP_CHAR_PET_SLOT_BY_SLOT, "UPDATE character_pet SET slot = ? WHERE owner = ? AND slot = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_UPD_CHAR_PET_SLOT_BY_ID, "UPDATE character_pet SET slot = ? WHERE owner = ? AND id = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_PET_BY_ID, "DELETE FROM character_pet WHERE id = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_PET_BY_SLOT, "DELETE FROM character_pet WHERE owner = ? AND (slot = ? OR slot > ?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_PET_AURAS, "DELETE FROM pet_aura WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_PET_SPELLS, "DELETE FROM pet_spell WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_PET_SPELL_COOLDOWNS, "DELETE FROM pet_spell_cooldown WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_INS_PET_SPELL_COOLDOWN, "INSERT INTO pet_spell_cooldown (guid, spell, time) VALUES (?, ?, ?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_PET_SPELL_BY_SPELL, "DELETE FROM pet_spell WHERE guid = ? and spell = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_INS_PET_SPELL, "INSERT INTO pet_spell (guid, spell, active) VALUES (?, ?, ?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_INS_PET_AURA, "INSERT INTO pet_aura (guid, caster_guid, spell, effect_mask, recalculate_mask, stackcount, amount0, amount1, amount2, base_amount0, base_amount1, base_amount2, maxduration, remaintime, remaincharges) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_DECLINED_NAME, "DELETE FROM character_declinedname WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_INS_CHAR_DECLINED_NAME, "INSERT INTO character_declinedname (guid, genitive, dative, accusative, instrumental, prepositional) VALUES (?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_UPD_FACTION_OR_RACE, "UPDATE characters SET name = ?, race = ?, at_login = at_login & ~ ? WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_SKILL_LANGUAGES, "DELETE FROM character_skills WHERE skill IN (98, 113, 759, 111, 313, 109, 115, 315, 673, 137) AND guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_INS_CHAR_SKILL_LANGUAGE, "INSERT INTO `character_skills` (guid, skill, value, max) VALUES (?, ?, 300, 300)", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_UPD_CHAR_TAXI_PATH, "UPDATE characters SET taxi_path = '' WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_UPD_CHAR_TAXIMASK, "UPDATE characters SET taximask = ? WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_QUESTSTATUS, "DELETE FROM character_queststatus WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_SOCIAL_BY_GUID, "DELETE FROM character_social WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_SOCIAL_BY_FRIEND, "DELETE FROM character_social WHERE friend = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_ACHIEVEMENT_BY_ACHIEVEMENT, "DELETE FROM character_achievement WHERE achievement = ? AND guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_UPD_CHAR_ACHIEVEMENT, "UPDATE character_achievement SET achievement = ? where achievement = ? AND guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_UPD_CHAR_INVENTORY_FACTION_CHANGE, "UPDATE item_instance ii, character_inventory ci SET ii.itemEntry = ? WHERE ii.itemEntry = ? AND ci.guid = ? AND ci.item = ii.guid", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_SPELL_BY_SPELL, "DELETE FROM character_spell WHERE spell = ? AND guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_UPD_CHAR_SPELL_FACTION_CHANGE, "UPDATE character_spell SET spell = ? where spell = ? AND guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_REP_BY_FACTION, "DELETE FROM character_reputation WHERE faction = ? AND guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_UPD_CHAR_REP_FACTION_CHANGE, "UPDATE character_reputation SET faction = ? where faction = ? AND guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_SPELL_COOLDOWN, "DELETE FROM character_spell_cooldown WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHARACTER, "DELETE FROM characters WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_ACTION, "DELETE FROM character_action WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_AURA, "DELETE FROM character_aura WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_GIFT, "DELETE FROM character_gifts WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_INSTANCE, "DELETE FROM character_instance WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_INVENTORY, "DELETE FROM character_inventory WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_QUESTSTATUS_REWARDED, "DELETE FROM character_queststatus_rewarded WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_REPUTATION, "DELETE FROM character_reputation WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_SPELL, "DELETE FROM character_spell WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_MAIL, "DELETE FROM mail WHERE receiver = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_MAIL_ITEMS, "DELETE FROM mail_items WHERE receiver = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_PET_BY_OWNER, "DELETE FROM character_pet WHERE owner = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_PET_DECLINEDNAME_BY_OWNER, "DELETE FROM character_pet_declinedname WHERE owner = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_ACHIEVEMENTS, "DELETE FROM character_achievement WHERE guid = ? AND achievement NOT BETWEEN '456' AND '467' AND achievement NOT BETWEEN '1400' AND '1427' AND achievement NOT IN(1463, 3117, 3259)", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_EQUIPMENTSETS, "DELETE FROM character_equipmentsets WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_GUILD_EVENTLOG_BY_PLAYER, "DELETE FROM guild_eventlog WHERE PlayerGuid1 = ? OR PlayerGuid2 = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_GUILD_BANK_EVENTLOG_BY_PLAYER, "DELETE FROM guild_bank_eventlog WHERE PlayerGuid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_GLYPHS, "DELETE FROM character_glyphs WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_QUESTSTATUS_DAILY, "DELETE FROM character_queststatus_daily WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_TALENT, "DELETE FROM character_talent WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_SKILLS, "DELETE FROM character_skills WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_UDP_CHAR_HONOR_POINTS, "UPDATE characters SET totalHonorPoints = ? WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_UDP_CHAR_ARENA_POINTS, "UPDATE characters SET arenaPoints = ? WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_UDP_CHAR_MONEY, "UPDATE characters SET money = ? WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_INS_CHAR_ACTION, "INSERT INTO character_action (guid, spec, button, action, type) VALUES (?, ?, ?, ?, ?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_UPD_CHAR_ACTION, "UPDATE character_action SET action = ?, type = ? WHERE guid = ? AND button = ? AND spec = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_ACTION_BY_BUTTON_SPEC, "DELETE FROM character_action WHERE guid = ? and button = ? and spec = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_INVENTORY_BY_ITEM, "DELETE FROM character_inventory WHERE item = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_INVENTORY_BY_BAG_SLOT, "DELETE FROM character_inventory WHERE bag = ? AND slot = ? AND guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_UPD_MAIL, "UPDATE mail SET has_items = ?, expire_time = ?, deliver_time = ?, money = ?, cod = ?, checked = ? WHERE id = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_REP_CHAR_QUESTSTATUS, "REPLACE INTO character_queststatus (guid, quest, status, explored, timer, mobcount1, mobcount2, mobcount3, mobcount4, itemcount1, itemcount2, itemcount3, itemcount4, playercount) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_QUESTSTATUS_BY_QUEST, "DELETE FROM character_queststatus WHERE guid = ? AND quest = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_INS_CHAR_QUESTSTATUS, "INSERT IGNORE INTO character_queststatus_rewarded (guid, quest) VALUES (?, ?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_QUESTSTATUS_REWARDED_BY_QUEST, "DELETE FROM character_queststatus_rewarded WHERE guid = ? AND quest = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_SKILL_BY_SKILL, "DELETE FROM character_skills WHERE guid = ? AND skill = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_INS_CHAR_SKILLS, "INSERT INTO character_skills (guid, skill, value, max) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_UDP_CHAR_SKILLS, "UPDATE character_skills SET value = ?, max = ? WHERE guid = ? AND skill = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_INS_CHAR_SPELL, "INSERT INTO character_spell (guid, spell, active, disabled) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_STATS, "DELETE FROM character_stats WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_INS_CHAR_STATS, "INSERT INTO character_stats (guid, maxhealth, maxpower1, maxpower2, maxpower3, maxpower4, maxpower5, maxpower6, maxpower7, strength, agility, stamina, intellect, spirit, armor, resHoly, resFire, resNature, resFrost, resShadow, resArcane, blockPct, dodgePct, parryPct, critPct, rangedCritPct, spellCritPct, attackPower, rangedAttackPower, spellPower, resilience) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_PETITION_BY_OWNER, "DELETE FROM petition WHERE ownerguid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_PETITION_SIGNATURE_BY_OWNER, "DELETE FROM petition_sign WHERE ownerguid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_PETITION_BY_OWNER_AND_TYPE, "DELETE FROM petition WHERE ownerguid = ? AND type = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_PETITION_SIGNATURE_BY_OWNER_AND_TYPE, "DELETE FROM petition_sign WHERE ownerguid = ? AND type = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_INS_CHAR_GLYPHS, "INSERT INTO character_glyphs VALUES(?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_TALENT_BY_SPELL_SPEC, "DELETE FROM character_talent WHERE guid = ? and spell = ? and spec = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_INS_CHAR_TALENT, "INSERT INTO character_talent (guid, spell, spec) VALUES (?, ?, ?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_ACTION_EXCEPT_SPEC, "DELETE FROM character_action WHERE spec<>? AND guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_SEL_CHAR_PET_BY_ENTRY_AND_SLOT, "SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, curhappiness, abdata, savetime, CreatedBySpell, PetType FROM character_pet WHERE owner = ? AND slot = ?", CONNECTION_SYNCH); } diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h index fa3654dc0c9..85b948f6ce6 100755 --- a/src/server/shared/Database/Implementation/CharacterDatabase.h +++ b/src/server/shared/Database/Implementation/CharacterDatabase.h @@ -48,10 +48,12 @@ enum CharacterDatabaseStatements CHAR_DEL_EXPIRED_BANS, CHAR_SEL_GUID_BY_NAME, CHAR_SEL_CHECK_NAME, + CHAR_SEL_CHECK_GUID, CHAR_SEL_SUM_CHARS, CHAR_SEL_CHAR_CREATE_INFO, CHAR_INS_CHARACTER_BAN, CHAR_UPD_CHARACTER_BAN, + CHAR_DEL_CHARACTER_BAN, CHAR_SEL_BANINFO, CHAR_SEL_GUID_BY_NAME_FILTER, CHAR_SEL_BANINFO_LIST, @@ -64,6 +66,12 @@ enum CharacterDatabaseStatements CHAR_SEL_PET_SLOT_BY_ID, CHAR_SEL_FREE_NAME, CHAR_SEL_GUID_RACE_ACC_BY_NAME, + CHAR_SEL_CHAR_RACE, + CHAR_SEL_CHAR_LEVEL, + CHAR_SEL_CHAR_ZONE, + CHAR_SEL_CHARACTER_NAME_DATA, + CHAR_SEL_CHAR_POSITION_XYZ, + CHAR_SEL_CHAR_POSITION, CHAR_DEL_QUEST_STATUS_DAILY, CHAR_DEL_QUEST_STATUS_WEEKLY, CHAR_DEL_QUEST_STATUS_SEASONAL, @@ -91,6 +99,7 @@ enum CharacterDatabaseStatements CHAR_SEL_CHARACTER_ACTIONS_SPEC, CHAR_SEL_CHARACTER_MAILCOUNT, CHAR_SEL_CHARACTER_MAILDATE, + CHAR_SEL_MAIL_COUNT, CHAR_SEL_CHARACTER_SOCIALLIST, CHAR_SEL_CHARACTER_HOMEBIND, CHAR_SEL_CHARACTER_SPELLCOOLDOWNS, @@ -112,9 +121,11 @@ enum CharacterDatabaseStatements CHAR_SEL_AUCTION_ITEMS, CHAR_INS_AUCTION, CHAR_DEL_AUCTION, + CHAR_SEL_AUCTION_BY_TIME, + CHAR_UPD_AUCTION_BID, CHAR_SEL_AUCTIONS, CHAR_INS_MAIL, - CHAR_DEL_MAIL, + CHAR_DEL_MAIL_BY_ID, CHAR_INS_MAIL_ITEM, CHAR_DEL_MAIL_ITEM, CHAR_DEL_INVALID_MAIL_ITEM, @@ -129,21 +140,24 @@ enum CharacterDatabaseStatements CHAR_DEL_ITEM_BOP_TRADE, CHAR_INS_ITEM_BOP_TRADE, CHAR_REP_INVENTORY_ITEM, - CHAR_DEL_INVENTORY_ITEM, CHAR_REP_ITEM_INSTANCE, CHAR_UPD_ITEM_INSTANCE, CHAR_UPD_ITEM_INSTANCE_ON_LOAD, CHAR_DEL_ITEM_INSTANCE, CHAR_UPD_GIFT_OWNER, CHAR_DEL_GIFT, + CHAR_SEL_CHARACTER_GIFT_BY_ITEM, CHAR_SEL_ACCOUNT_BY_NAME, + CHAR_SEL_ACCOUNT_BY_GUID, CHAR_DEL_ACCOUNT_INSTANCE_LOCK_TIMES, CHAR_INS_ACCOUNT_INSTANCE_LOCK_TIMES, CHAR_SEL_CHARACTER_NAME_CLASS, + CHAR_SEL_CHARACTER_NAME, CHAR_SEL_MATCH_MAKER_RATING, CHAR_SEL_CHARACTER_COUNT, CHAR_UPD_NAME, CHAR_DEL_DECLINED_NAME, + CHAR_SEL_ACCOUNT_NAME_BY_GUID, CHAR_INS_GUILD, CHAR_DEL_GUILD, @@ -220,7 +234,6 @@ enum CharacterDatabaseStatements CHAR_INS_EQUIP_SET, CHAR_DEL_EQUIP_SET, - CHAR_DEL_AURA, CHAR_INS_AURA, CHAR_SEL_ACCOUNT_DATA, @@ -261,10 +274,16 @@ enum CharacterDatabaseStatements CHAR_SEL_PETITION_SIGNATURE, CHAR_DEL_ALL_PETITION_SIGNATURES, CHAR_DEL_PETITION_SIGNATURE, + CHAR_SEL_PETITION_BY_OWNER, + CHAR_SEL_PETITION_TYPE, + CHAR_SEL_PETITION_SIGNATURES, + CHAR_SEL_PETITION_SIG_BY_ACCOUNT, + CHAR_SEL_PETITION_OWNER_BY_GUID, + CHAR_SEL_PETITION_SIG_BY_GUID, + CHAR_SEL_PETITION_SIG_BY_GUID_TYPE, CHAR_INS_PLAYER_BGDATA, CHAR_DEL_PLAYER_BGDATA, - CHAR_UPD_PLAYERS_BGDATA, CHAR_INS_PLAYER_HOMEBIND, CHAR_UPD_PLAYER_HOMEBIND, @@ -275,7 +294,6 @@ enum CharacterDatabaseStatements CHAR_DEL_CORPSE, CHAR_DEL_PLAYER_CORPSES, CHAR_DEL_OLD_CORPSES, - CHAR_UPD_NONEXISTENT_INSTANCE_FOR_CORPSES, CHAR_SEL_CREATURE_RESPAWNS, CHAR_REP_CREATURE_RESPAWN, @@ -283,14 +301,11 @@ enum CharacterDatabaseStatements CHAR_DEL_CREATURE_RESPAWN_BY_GUID, CHAR_DEL_CREATURE_RESPAWN_BY_INSTANCE, CHAR_SEL_MAX_CREATURE_RESPAWNS, - CHAR_DEL_NONEXISTENT_INSTANCE_CREATURE_RESPAWNS, CHAR_SEL_GO_RESPAWNS, CHAR_REP_GO_RESPAWN, CHAR_DEL_GO_RESPAWN, CHAR_DEL_GO_RESPAWN_BY_INSTANCE, - CHAR_DEL_EXPIRED_GO_RESPAWNS, - CHAR_DEL_NONEXISTENT_INSTANCE_GO_RESPAWNS, CHAR_SEL_GM_TICKETS, CHAR_REP_GM_TICKET, @@ -342,7 +357,7 @@ enum CharacterDatabaseStatements CHAR_UPD_CHAR_NAME_AT_LOGIN, CHAR_UPD_WORLDSTATE, CHAR_INS_WORLDSTATE, - CHAR_DEL_CHAR_INSTANCE, + CHAR_DEL_CHAR_INSTANCE_BY_INSTANCE_GUID, CHAR_UPD_CHAR_INSTANCE, CHAR_INS_CHAR_INSTANCE, CHAR_UPD_GENDER_PLAYERBYTES, @@ -357,6 +372,150 @@ enum CharacterDatabaseStatements CHAR_INS_LFG_DATA, CHAR_DEL_LFG_DATA, + CHAR_SEL_CHARACTER_AURA_FROZEN, + CHAR_SEL_CHARACTER_ONLINE, + + CHAR_SEL_CHAR_DEL_INFO_BY_GUID, + CHAR_SEL_CHAR_DEL_INFO_BY_NAME, + CHAR_SEL_CHAR_DEL_INFO, + + CHAR_SEL_CHARS_BY_ACCOUNT_ID, + CHAR_SEL_CHAR_PINFO, + CHAR_SEL_PINFO_BANS, + CHAR_SEL_CHAR_HOMEBIND, + CHAR_SEL_CHAR_GUID_NAME_BY_ACC, + CHAR_SEL_POOL_QUEST_SAVE, + CHAR_SEL_CHARACTER_AT_LOGIN, + CHAR_SEL_CHAR_CLASS_LVL_AT_LOGIN, + CHAR_SEL_INSTANCE, + CHAR_SEL_PET_SPELL_LIST, + CHAR_SEL_CHAR_PET, + CHAR_SEL_CHAR_PETS, + CHAR_SEL_CHAR_COD_ITEM_MAIL, + CHAR_SEL_CHAR_SOCIAL, + CHAR_SEL_PET_AURA, + CHAR_SEL_CHAR_OLD_CHARS, + CHAR_SEL_ARENA_TEAM_ID_BY_PLAYER_GUID, + CHAR_SEL_MAIL, + CHAR_SEL_CHAR_PLAYERBYTES2, + CHAR_SEL_PET_SPELL, + CHAR_SEL_PET_SPELL_COOLDOWN, + CHAR_SEL_PET_DECLINED_NAME, + CHAR_SEL_CHAR_GUID_BY_NAME, + CHAR_DEL_CHAR_AURA_FROZEN, + CHAR_SEL_CHAR_INVENTORY_COUNT_ITEM, + CHAR_SEL_MAIL_COUNT_ITEM, + CHAR_SEL_AUCTIONHOUSE_COUNT_ITEM, + CHAR_SEL_GUILD_BANK_COUNT_ITEM, + CHAR_SEL_CHAR_INVENTORY_ITEM_BY_ENTRY, + CHAR_SEL_MAIL_ITEMS_BY_ENTRY, + CHAR_SEL_AUCTIONHOUSE_ITEM_BY_ENTRY, + CHAR_SEL_GUILD_BANK_ITEM_BY_ENTRY, + CHAR_SEL_CHAR_PET_BY_ENTRY, + CHAR_SEL_CHAR_PET_BY_ENTRY_AND_SLOT_2, + CHAR_SEL_CHAR_PET_BY_SLOT, + CHAR_DEL_CHAR_ACHIEVEMENT, + CHAR_DEL_CHAR_ACHIEVEMENT_PROGRESS, + CHAR_DEL_CHAR_REPUTATION_BY_FACTION, + CHAR_INS_CHAR_REPUTATION_BY_FACTION, + CHAR_UPD_CHAR_ARENA_POINTS, + CHAR_DEL_ITEM_REFUND_INSTANCE, + CHAR_INS_ITEM_REFUND_INSTANCE, + CHAR_DEL_GROUP, + CHAR_DEL_GROUP_MEMBER_ALL, + CHAR_INS_CHAR_GIFT, + CHAR_DEL_INSTANCE_BY_INSTANCE, + CHAR_DEL_CHAR_INSTANCE_BY_INSTANCE, + CHAR_DEL_CHAR_INSTANCE_BY_MAP_DIFF, + CHAR_DEL_GROUP_INSTANCE_BY_MAP_DIFF, + CHAR_DEL_INSTANCE_BY_MAP_DIFF, + CHAR_DEL_MAIL_ITEM_BY_ID, + CHAR_DEL_CHAR_PET_DECLINEDNAME, + CHAR_ADD_CHAR_PET_DECLINEDNAME, + CHAR_UPD_CHAR_PET_NAME, + CHAR_INS_PETITION, + CHAR_DEL_PETITION_BY_GUID, + CHAR_DEL_PETITION_SIGNATURE_BY_GUID, + CHAR_UDP_CHAR_PET_SLOT_BY_SLOT_EXCLUDE_ID, + CHAR_UDP_CHAR_PET_SLOT_BY_SLOT, + CHAR_UPD_CHAR_PET_SLOT_BY_ID, + CHAR_DEL_CHAR_PET_BY_ID, + CHAR_DEL_CHAR_PET_BY_SLOT, + CHAR_DEL_PET_AURAS, + CHAR_DEL_PET_SPELLS, + CHAR_DEL_PET_SPELL_COOLDOWNS, + CHAR_INS_PET_SPELL_COOLDOWN, + CHAR_DEL_PET_SPELL_BY_SPELL, + CHAR_INS_PET_SPELL, + CHAR_INS_PET_AURA, + CHAR_DEL_CHAR_DECLINED_NAME, + CHAR_INS_CHAR_DECLINED_NAME, + CHAR_UPD_FACTION_OR_RACE, + CHAR_DEL_CHAR_SKILL_LANGUAGES, + CHAR_INS_CHAR_SKILL_LANGUAGE, + CHAR_UPD_CHAR_TAXI_PATH, + CHAR_UPD_CHAR_TAXIMASK, + CHAR_DEL_CHAR_QUESTSTATUS, + CHAR_DEL_CHAR_SOCIAL_BY_GUID, + CHAR_DEL_CHAR_SOCIAL_BY_FRIEND, + CHAR_DEL_CHAR_ACHIEVEMENT_BY_ACHIEVEMENT, + CHAR_UPD_CHAR_ACHIEVEMENT, + CHAR_UPD_CHAR_INVENTORY_FACTION_CHANGE, + CHAR_DEL_CHAR_SPELL_BY_SPELL, + CHAR_UPD_CHAR_SPELL_FACTION_CHANGE, + CHAR_DEL_CHAR_REP_BY_FACTION, + CHAR_UPD_CHAR_REP_FACTION_CHANGE, + CHAR_DEL_CHAR_SPELL_COOLDOWN, + CHAR_DEL_CHARACTER, + CHAR_DEL_CHAR_ACTION, + CHAR_DEL_CHAR_AURA, + CHAR_DEL_CHAR_GIFT, + CHAR_DEL_CHAR_INSTANCE, + CHAR_DEL_CHAR_INVENTORY, + CHAR_DEL_CHAR_QUESTSTATUS_REWARDED, + CHAR_DEL_CHAR_REPUTATION, + CHAR_DEL_CHAR_SPELL, + CHAR_DEL_MAIL, + CHAR_DEL_MAIL_ITEMS, + CHAR_DEL_CHAR_PET_BY_OWNER, + CHAR_DEL_CHAR_PET_DECLINEDNAME_BY_OWNER, + CHAR_DEL_CHAR_ACHIEVEMENTS, + CHAR_DEL_CHAR_EQUIPMENTSETS, + CHAR_DEL_GUILD_EVENTLOG_BY_PLAYER, + CHAR_DEL_GUILD_BANK_EVENTLOG_BY_PLAYER, + CHAR_DEL_CHAR_GLYPHS, + CHAR_DEL_CHAR_QUESTSTATUS_DAILY, + CHAR_DEL_CHAR_TALENT, + CHAR_DEL_CHAR_SKILLS, + CHAR_UDP_CHAR_HONOR_POINTS, + CHAR_UDP_CHAR_ARENA_POINTS, + CHAR_UDP_CHAR_MONEY, + CHAR_INS_CHAR_ACTION, + CHAR_UPD_CHAR_ACTION, + CHAR_DEL_CHAR_ACTION_BY_BUTTON_SPEC, + CHAR_DEL_CHAR_INVENTORY_BY_ITEM, + CHAR_DEL_CHAR_INVENTORY_BY_BAG_SLOT, + CHAR_UPD_MAIL, + CHAR_REP_CHAR_QUESTSTATUS, + CHAR_DEL_CHAR_QUESTSTATUS_BY_QUEST, + CHAR_INS_CHAR_QUESTSTATUS, + CHAR_DEL_CHAR_QUESTSTATUS_REWARDED_BY_QUEST, + CHAR_DEL_CHAR_SKILL_BY_SKILL, + CHAR_INS_CHAR_SKILLS, + CHAR_UDP_CHAR_SKILLS, + CHAR_INS_CHAR_SPELL, + CHAR_DEL_CHAR_STATS, + CHAR_INS_CHAR_STATS, + CHAR_DEL_PETITION_BY_OWNER, + CHAR_DEL_PETITION_SIGNATURE_BY_OWNER, + CHAR_DEL_PETITION_BY_OWNER_AND_TYPE, + CHAR_DEL_PETITION_SIGNATURE_BY_OWNER_AND_TYPE, + CHAR_INS_CHAR_GLYPHS, + CHAR_DEL_CHAR_TALENT_BY_SPELL_SPEC, + CHAR_INS_CHAR_TALENT, + CHAR_DEL_CHAR_ACTION_EXCEPT_SPEC, + CHAR_SEL_CHAR_PET_BY_ENTRY_AND_SLOT, + MAX_CHARACTERDATABASE_STATEMENTS, }; diff --git a/src/server/shared/Database/Implementation/LoginDatabase.cpp b/src/server/shared/Database/Implementation/LoginDatabase.cpp index 8ef8d3b48cf..028d927a720 100755 --- a/src/server/shared/Database/Implementation/LoginDatabase.cpp +++ b/src/server/shared/Database/Implementation/LoginDatabase.cpp @@ -22,13 +22,18 @@ void LoginDatabaseConnection::DoPrepareStatements() if (!m_reconnecting) m_stmts.resize(MAX_LOGINDATABASE_STATEMENTS); - PREPARE_STATEMENT(LOGIN_SEL_REALMLIST, "SELECT id, name, address, port, icon, color, timezone, allowedSecurityLevel, population, gamebuild FROM realmlist WHERE color <> 3 ORDER BY name", CONNECTION_SYNCH) + PREPARE_STATEMENT(LOGIN_SEL_REALMLIST, "SELECT id, name, address, port, icon, flag, timezone, allowedSecurityLevel, population, gamebuild FROM realmlist WHERE flag <> 3 ORDER BY name", CONNECTION_SYNCH) PREPARE_STATEMENT(LOGIN_DEL_EXPIRED_IP_BANS, "DELETE FROM ip_banned WHERE unbandate<>bandate AND unbandate<=UNIX_TIMESTAMP()", CONNECTION_ASYNC) PREPARE_STATEMENT(LOGIN_UPD_EXPIRED_ACCOUNT_BANS, "UPDATE account_banned SET active = 0 WHERE active = 1 AND unbandate<>bandate AND unbandate<=UNIX_TIMESTAMP()", CONNECTION_ASYNC) PREPARE_STATEMENT(LOGIN_SEL_IP_BANNED, "SELECT * FROM ip_banned WHERE ip = ?", CONNECTION_SYNCH) PREPARE_STATEMENT(LOGIN_INS_IP_AUTO_BANNED, "INSERT INTO ip_banned VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, 'Trinity realmd', 'Failed login autoban')", CONNECTION_ASYNC) + PREPARE_STATEMENT(LOGIN_SEL_IP_BANNED_ALL, "SELECT ip, bandate, unbandate, bannedby, banreason FROM ip_banned WHERE (bandate = unbandate OR unbandate > UNIX_TIMESTAMP()) ORDER BY unbandate", CONNECTION_SYNCH); + PREPARE_STATEMENT(LOGIN_SEL_IP_BANNED_BY_IP, "SELECT ip, bandate, unbandate, bannedby, banreason FROM ip_banned WHERE (bandate = unbandate OR unbandate > UNIX_TIMESTAMP()) AND ip LIKE CONCAT('%%', ?, '%%') ORDER BY unbandate", CONNECTION_SYNCH); PREPARE_STATEMENT(LOGIN_SEL_ACCOUNT_BANNED, "SELECT bandate, unbandate FROM account_banned WHERE id = ? AND active = 1", CONNECTION_SYNCH) + PREPARE_STATEMENT(LOGIN_SEL_ACCOUNT_BANNED_ALL, "SELECT account.id, username FROM account, account_banned WHERE account.id = account_banned.id AND active = 1 GROUP BY account.id", CONNECTION_SYNCH); + PREPARE_STATEMENT(LOGIN_SEL_ACCOUNT_BANNED_BY_USERNAME, "SELECT account.id, username FROM account, account_banned WHERE account.id = account_banned.id AND active = 1 AND username LIKE CONCAT('%%', ?, '%%') GROUP BY account.id", CONNECTION_SYNCH); PREPARE_STATEMENT(LOGIN_INS_ACCOUNT_AUTO_BANNED, "INSERT INTO account_banned VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, 'Trinity realmd', 'Failed login autoban', 1)", CONNECTION_ASYNC) + PREPARE_STATEMENT(LOGIN_DEL_ACCOUNT_BANNED, "DELETE FROM account_banned WHERE id = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_SEL_SESSIONKEY, "SELECT a.sessionkey, a.id, aa.gmlevel FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE username = ?", CONNECTION_SYNCH) PREPARE_STATEMENT(LOGIN_UPD_VS, "UPDATE account SET v = ?, s = ? WHERE username = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(LOGIN_UPD_LOGONPROOF, "UPDATE account SET sessionkey = ?, last_ip = ?, last_login = NOW(), locale = ?, failed_logins = 0, os = ? WHERE username = ?", CONNECTION_ASYNC) @@ -36,19 +41,22 @@ void LoginDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(LOGIN_UPD_FAILEDLOGINS, "UPDATE account SET failed_logins = failed_logins + 1 WHERE username = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(LOGIN_SEL_FAILEDLOGINS, "SELECT id, failed_logins FROM account WHERE username = ?", CONNECTION_SYNCH) PREPARE_STATEMENT(LOGIN_SEL_ACCOUNT_ID_BY_NAME, "SELECT id FROM account WHERE username = ?", CONNECTION_SYNCH) + PREPARE_STATEMENT(LOGIN_SEL_ACCOUNT_LIST_BY_NAME, "SELECT id, username FROM account WHERE username = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(LOGIN_SEL_ACCOUNT_INFO_BY_NAME, "SELECT id, sessionkey, last_ip, locked, v, s, expansion, mutetime, locale, recruiter, os FROM account WHERE username = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(LOGIN_SEL_ACCOUNT_LIST_BY_EMAIL, "SELECT id, username FROM account WHERE email = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(LOGIN_SEL_NUM_CHARS_ON_REALM, "SELECT numchars FROM realmcharacters WHERE realmid = ? AND acctid= ?", CONNECTION_SYNCH) - PREPARE_STATEMENT(LOGIN_SEL_ACCOUNT_BY_IP, "SELECT id FROM account WHERE last_ip = ?", CONNECTION_SYNCH) + PREPARE_STATEMENT(LOGIN_SEL_ACCOUNT_BY_IP, "SELECT id, username FROM account WHERE last_ip = ?", CONNECTION_SYNCH) + PREPARE_STATEMENT(LOGIN_SEL_ACCOUNT_BY_ID, "SELECT 1 FROM account WHERE id = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(LOGIN_INS_IP_BANNED, "INSERT INTO ip_banned VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, ?, ?)", CONNECTION_ASYNC) PREPARE_STATEMENT(LOGIN_DEL_IP_NOT_BANNED, "DELETE FROM ip_banned WHERE ip = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(LOGIN_INS_ACCOUNT_BANNED, "INSERT INTO account_banned VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, ?, ?, 1)", CONNECTION_ASYNC) PREPARE_STATEMENT(LOGIN_UPD_ACCOUNT_NOT_BANNED, "UPDATE account_banned SET active = 0 WHERE id = ? AND active != 0", CONNECTION_ASYNC) - PREPARE_STATEMENT(LOGIN_DEL_REALM_CHARACTERS, "DELETE FROM realmcharacters WHERE acctid = ? AND realmid = ?", CONNECTION_ASYNC) + PREPARE_STATEMENT(LOGIN_DEL_REALM_CHARACTERS_BY_REALM, "DELETE FROM realmcharacters WHERE acctid = ? AND realmid = ?", CONNECTION_ASYNC) + PREPARE_STATEMENT(LOGIN_DEL_REALM_CHARACTERS, "DELETE FROM realmcharacters WHERE acctid = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_INS_REALM_CHARACTERS, "INSERT INTO realmcharacters (numchars, acctid, realmid) VALUES (?, ?, ?)", CONNECTION_ASYNC) PREPARE_STATEMENT(LOGIN_SEL_SUM_REALM_CHARACTERS, "SELECT SUM(numchars) FROM realmcharacters WHERE acctid = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_INS_ACCOUNT, "INSERT INTO account(username, sha_pass_hash, joindate) VALUES(?, ?, NOW())", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_INS_REALM_CHARACTERS_INIT, "INSERT INTO realmcharacters (realmid, acctid, numchars) SELECT realmlist.id, account.id, 0 FROM realmlist, account LEFT JOIN realmcharacters ON acctid=account.id WHERE acctid IS NULL", CONNECTION_ASYNC); - PREPARE_STATEMENT(LOGIN_DEL_OLD_BANS, "DELETE FROM ip_banned WHERE unbandate <= UNIX_TIMESTAMP() AND unbandate<>bandate", CONNECTION_ASYNC); - PREPARE_STATEMENT(LOGIN_DEL_OLD_IP_BANS, "DELETE FROM ip_banned WHERE unbandate <= UNIX_TIMESTAMP() AND unbandate<>bandate", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_UPD_EXPANSION, "UPDATE account SET expansion = ? WHERE id = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_UPD_ACCOUNT_LOCK, "UPDATE account SET locked = ? WHERE id = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_INS_LOG, "INSERT INTO logs (time, realm, type, string) VALUES (UNIX_TIMESTAMP(), ? , ?, ?)", CONNECTION_ASYNC); @@ -62,4 +70,21 @@ void LoginDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(LOGIN_DEL_ACCOUNT_ACCESS, "DELETE FROM account_access WHERE id = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_DEL_ACCOUNT_ACCESS_BY_REALM, "DELETE FROM account_access WHERE id = ? AND (RealmID = ? OR RealmID = -1)", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_INS_ACCOUNT_ACCESS, "INSERT INTO account_access (id,gmlevel,RealmID) VALUES (?, ?, ?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(LOGIN_GET_ACCOUNT_ID_BY_USERNAME, "SELECT id FROM account WHERE username = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(LOGIN_GET_ACCOUNT_ACCESS_GMLEVEL, "SELECT gmlevel FROM account_access WHERE id = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(LOGIN_GET_GMLEVEL_BY_REALMID, "SELECT gmlevel FROM account_access WHERE id = ? AND (RealmID = ? OR RealmID = -1)", CONNECTION_SYNCH); + PREPARE_STATEMENT(LOGIN_GET_USERNAME_BY_ID, "SELECT username FROM account WHERE id = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(LOGIN_SEL_CHECK_PASSWORD, "SELECT 1 FROM account WHERE id = ? AND sha_pass_hash = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(LOGIN_SEL_CHECK_PASSWORD_BY_NAME, "SELECT 1 FROM account WHERE username = ? AND sha_pass_hash = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(LOGIN_SEL_PINFO, "SELECT a.username, aa.gmlevel, a.email, a.last_ip, DATE_FORMAT(a.last_login, '%Y-%m-%d %T'), a.mutetime FROM account a LEFT JOIN account_access aa ON (a.id = aa.id AND (aa.RealmID = ? OR aa.RealmID = -1)) WHERE a.id = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(LOGIN_SEL_PINFO_BANS, "SELECT unbandate, bandate = unbandate, bannedby, banreason FROM account_banned WHERE id = ? AND active ORDER BY bandate ASC LIMIT 1", CONNECTION_SYNCH); + PREPARE_STATEMENT(LOGIN_SEL_GM_ACCOUNTS, "SELECT a.username, aa.gmlevel FROM account a, account_access aa WHERE a.id=aa.id AND aa.gmlevel >= ? AND (aa.realmid = -1 OR aa.realmid = ?)", CONNECTION_SYNCH); + PREPARE_STATEMENT(LOGIN_SEL_ACCOUNT_INFO, "SELECT a.username, a.last_ip, aa.gmlevel, a.expansion FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE a.id = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(LOGIN_SEL_ACCOUNT_ACCESS_GMLEVEL_TEST, "SELECT 1 FROM account_access WHERE id = ? AND gmlevel > ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(LOGIN_SEL_ACCOUNT_ACCESS, "SELECT a.id, aa.gmlevel, aa.RealmID FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE a.username = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(LOGIN_SEL_ACCOUNT_RECRUITER, "SELECT 1 FROM account WHERE recruiter = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(LOGIN_SEL_BANS, "SELECT 1 FROM account_banned WHERE id = ? AND active = 1 UNION SELECT 1 FROM ip_banned WHERE ip = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(LOGIN_SEL_ACCOUNT_WHOIS, "SELECT username, email, last_ip FROM account WHERE id = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(LOGIN_SEL_REALMLIST_SECURITY_LEVEL, "SELECT allowedSecurityLevel from realmlist WHERE id = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(LOGIN_DEL_ACCOUNT, "DELETE FROM account WHERE id = ?", CONNECTION_ASYNC); } diff --git a/src/server/shared/Database/Implementation/LoginDatabase.h b/src/server/shared/Database/Implementation/LoginDatabase.h index afb188020c7..7c2a94eec94 100755 --- a/src/server/shared/Database/Implementation/LoginDatabase.h +++ b/src/server/shared/Database/Implementation/LoginDatabase.h @@ -48,7 +48,10 @@ enum LoginDatabaseStatements LOGIN_SEL_IP_BANNED, LOGIN_INS_IP_AUTO_BANNED, LOGIN_SEL_ACCOUNT_BANNED, + LOGIN_SEL_ACCOUNT_BANNED_ALL, + LOGIN_SEL_ACCOUNT_BANNED_BY_USERNAME, LOGIN_INS_ACCOUNT_AUTO_BANNED, + LOGIN_DEL_ACCOUNT_BANNED, LOGIN_SEL_SESSIONKEY, LOGIN_UPD_VS, LOGIN_UPD_LOGONPROOF, @@ -56,19 +59,24 @@ enum LoginDatabaseStatements LOGIN_UPD_FAILEDLOGINS, LOGIN_SEL_FAILEDLOGINS, LOGIN_SEL_ACCOUNT_ID_BY_NAME, + LOGIN_SEL_ACCOUNT_LIST_BY_NAME, + LOGIN_SEL_ACCOUNT_INFO_BY_NAME, + LOGIN_SEL_ACCOUNT_LIST_BY_EMAIL, LOGIN_SEL_NUM_CHARS_ON_REALM, LOGIN_SEL_ACCOUNT_BY_IP, LOGIN_INS_IP_BANNED, LOGIN_DEL_IP_NOT_BANNED, + LOGIN_SEL_IP_BANNED_ALL, + LOGIN_SEL_IP_BANNED_BY_IP, + LOGIN_SEL_ACCOUNT_BY_ID, LOGIN_INS_ACCOUNT_BANNED, LOGIN_UPD_ACCOUNT_NOT_BANNED, + LOGIN_DEL_REALM_CHARACTERS_BY_REALM, LOGIN_DEL_REALM_CHARACTERS, LOGIN_INS_REALM_CHARACTERS, LOGIN_SEL_SUM_REALM_CHARACTERS, LOGIN_INS_ACCOUNT, LOGIN_INS_REALM_CHARACTERS_INIT, - LOGIN_DEL_OLD_BANS, - LOGIN_DEL_OLD_IP_BANS, LOGIN_UPD_EXPANSION, LOGIN_UPD_ACCOUNT_LOCK, LOGIN_INS_LOG, @@ -82,6 +90,23 @@ enum LoginDatabaseStatements LOGIN_DEL_ACCOUNT_ACCESS, LOGIN_DEL_ACCOUNT_ACCESS_BY_REALM, LOGIN_INS_ACCOUNT_ACCESS, + LOGIN_GET_ACCOUNT_ID_BY_USERNAME, + LOGIN_GET_ACCOUNT_ACCESS_GMLEVEL, + LOGIN_GET_GMLEVEL_BY_REALMID, + LOGIN_GET_USERNAME_BY_ID, + LOGIN_SEL_CHECK_PASSWORD, + LOGIN_SEL_CHECK_PASSWORD_BY_NAME, + LOGIN_SEL_PINFO, + LOGIN_SEL_PINFO_BANS, + LOGIN_SEL_GM_ACCOUNTS, + LOGIN_SEL_ACCOUNT_INFO, + LOGIN_SEL_ACCOUNT_ACCESS_GMLEVEL_TEST, + LOGIN_SEL_ACCOUNT_ACCESS, + LOGIN_SEL_ACCOUNT_RECRUITER, + LOGIN_SEL_BANS, + LOGIN_SEL_ACCOUNT_WHOIS, + LOGIN_SEL_REALMLIST_SECURITY_LEVEL, + LOGIN_DEL_ACCOUNT, MAX_LOGINDATABASE_STATEMENTS, }; diff --git a/src/server/shared/Database/Implementation/WorldDatabase.cpp b/src/server/shared/Database/Implementation/WorldDatabase.cpp index d7d8491008b..e3455891909 100755 --- a/src/server/shared/Database/Implementation/WorldDatabase.cpp +++ b/src/server/shared/Database/Implementation/WorldDatabase.cpp @@ -36,6 +36,7 @@ void WorldDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(WORLD_DEL_GAME_TELE, "DELETE FROM game_tele WHERE name = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(WORLD_INS_NPC_VENODR, "INSERT INTO npc_vendor (entry, item, maxcount, incrtime, extendedcost) VALUES(?, ?, ?, ?, ?)", CONNECTION_ASYNC); PREPARE_STATEMENT(WORLD_DEL_NPC_VENDOR, "DELETE FROM npc_vendor WHERE entry = ? AND item = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(WORLD_SEL_NPC_VENDOR_REF, "SELECT item, maxcount, incrtime, ExtendedCost FROM npc_vendor WHERE entry = ? ORDER BY slot ASC", CONNECTION_SYNCH); PREPARE_STATEMENT(WORLD_UPD_CREATURE_MOVEMENT_TYPE, "UPDATE creature SET MovementType = ? WHERE guid = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(WORLD_UPD_CREATURE_FACTION, "UPDATE creature_template SET faction_A = ?, faction_H = ? WHERE entry = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(WORLD_UPD_CREATURE_NPCFLAG, "UPDATE creature_template SET npcflag = ? WHERE entry = ?", CONNECTION_ASYNC); @@ -48,10 +49,23 @@ void WorldDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(WORLD_UPD_WAYPOINT_DATA_POINT, "UPDATE waypoint_data SET point = point - 1 WHERE id = ? AND point > ?", CONNECTION_ASYNC); PREPARE_STATEMENT(WORLD_UPD_WAYPOINT_DATA_POSITION, "UPDATE waypoint_data SET position_x = ?, position_y = ?, position_z = ? where id = ? AND point = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(WORLD_UPD_WAYPOINT_DATA_WPGUID, "UPDATE waypoint_data SET wpguid = ? WHERE id = ? and point = ?", CONNECTION_ASYNC); - PREPARE_STATEMENT(WORLD_UPD_ALL_WAYPOINT_DATA_WPGUID, "UPDATE waypoint_data SET wpguid = 0", CONNECTION_ASYNC); + PREPARE_STATEMENT(WORLD_SEL_WAYPOINT_DATA_MAX_ID, "SELECT MAX(id) FROM waypoint_data", CONNECTION_SYNCH); + PREPARE_STATEMENT(WORLD_SEL_WAYPOINT_DATA_MAX_POINT, "SELECT MAX(point) FROM waypoint_data WHERE id = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(WORLD_SEL_WAYPOINT_DATA_BY_ID, "SELECT point, position_x, position_y, position_z, orientation, move_flag, delay, action, action_chance FROM waypoint_data WHERE id = ? ORDER BY point", CONNECTION_SYNCH); + PREPARE_STATEMENT(WORLD_SEL_WAYPOINT_DATA_POS_BY_ID, "SELECT point, position_x, position_y, position_z FROM waypoint_data WHERE id = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(WORLD_SEL_WAYPOINT_DATA_POS_FIRST_BY_ID, "SELECT position_x, position_y, position_z FROM waypoint_data WHERE point = 1 AND id = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(WORLD_SEL_WAYPOINT_DATA_POS_LAST_BY_ID, "SELECT position_x, position_y, position_z, orientation FROM waypoint_data WHERE id = ? ORDER BY point DESC LIMIT 1", CONNECTION_SYNCH); + PREPARE_STATEMENT(WORLD_SEL_WAYPOINT_DATA_BY_WPGUID, "SELECT id, point FROM waypoint_data WHERE wpguid = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(WORLD_SEL_WAYPOINT_DATA_ALL_BY_WPGUID, "SELECT id, point, delay, move_flag, action, action_chance FROM waypoint_data WHERE wpguid = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(WORLD_UPD_WAYPOINT_DATA_ALL_WPGUID, "UPDATE waypoint_data SET wpguid = 0", CONNECTION_ASYNC); + PREPARE_STATEMENT(WORLD_SEL_WAYPOINT_DATA_BY_POS, "SELECT id, point FROM waypoint_data WHERE (abs(position_x - ?) <= ?) and (abs(position_y - ?) <= ?) and (abs(position_z - ?) <= ?)", CONNECTION_SYNCH); + PREPARE_STATEMENT(WORLD_SEL_WAYPOINT_DATA_WPGUID_BY_ID, "SELECT wpguid FROM waypoint_data WHERE id = ? and wpguid <> 0", CONNECTION_SYNCH); + PREPARE_STATEMENT(WOLRD_SEL_WAYPOINT_DATA_ACTION, "SELECT DISTINCT action FROM waypoint_data", CONNECTION_SYNCH); + PREPARE_STATEMENT(WORLD_SEL_WAYPOINT_SCRIPTS_MAX_ID, "SELECT MAX(guid) FROM waypoint_scripts", CONNECTION_SYNCH); PREPARE_STATEMENT(WORLD_INS_CREATURE_ADDON, "INSERT INTO creature_addon(guid, path_id) VALUES (?, ?)", CONNECTION_ASYNC); PREPARE_STATEMENT(WORLD_UPD_CREATURE_ADDON_PATH, "UPDATE creature_addon SET path_id = ? WHERE guid = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(WORLD_DEL_CREATURE_ADDON, "DELETE FROM creature_addon WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(WORLD_SEL_CREATURE_ADDON_BY_GUID, "SELECT guid FROM creature_addon WHERE guid = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(WORLD_INS_WAYPOINT_SCRIPT, "INSERT INTO waypoint_scripts (guid) VALUES (?)", CONNECTION_ASYNC); PREPARE_STATEMENT(WORLD_DEL_WAYPOINT_SCRIPT, "DELETE FROM waypoint_scripts WHERE guid = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(WORLD_UPD_WAYPOINT_SCRIPT_ID, "UPDATE waypoint_scripts SET id = ? WHERE guid = ?", CONNECTION_ASYNC); @@ -59,5 +73,19 @@ void WorldDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(WORLD_UPD_WAYPOINT_SCRIPT_Y, "UPDATE waypoint_scripts SET y = ? WHERE guid = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(WORLD_UPD_WAYPOINT_SCRIPT_Z, "UPDATE waypoint_scripts SET z = ? WHERE guid = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(WORLD_UPD_WAYPOINT_SCRIPT_O, "UPDATE waypoint_scripts SET o = ? WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(WORLD_SEL_WAYPOINT_SCRIPT_ID_BY_GUID, "SELECT id FROM waypoint_scripts WHERE guid = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(WORLD_DEL_CREATURE, "DELETE FROM creature WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(WORLD_INS_CREATURE_TRANSPORT, "INSERT INTO creature_transport (guid, npc_entry, transport_entry, TransOffsetX, TransOffsetY, TransOffsetZ, TransOffsetO) values (?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(WORLD_UPD_CREATURE_TRANSPORT_EMOTE, "UPDATE creature_transport SET emote = ? WHERE transport_entry = ? AND guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(WORLD_SEL_COMMANDS, "SELECT name, security, help FROM command", CONNECTION_SYNCH); + PREPARE_STATEMENT(WORLD_SEL_CREATURE_TEMPLATE, "SELECT difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction_A, faction_H, npcflag, speed_walk, speed_run, scale, rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, InhabitType, HoverHeight, Health_mod, Mana_mod, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, questItem6, movementId, RegenHealth, equipment_id, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template WHERE entry = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(WORLD_SEL_WAYPOINT_SCRIPT_BY_ID, "SELECT guid, delay, command, datalong, datalong2, dataint, x, y, z, o FROM waypoint_scripts WHERE id = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(WORLD_SEL_IP2NATION_COUNTRY, "SELECT c.country FROM ip2nationCountries c, ip2nation i WHERE i.ip < ? AND c.code = i.country ORDER BY i.ip DESC LIMIT 0,1", CONNECTION_SYNCH); + PREPARE_STATEMENT(WORLD_SEL_ITEM_TEMPLATE_BY_NAME, "SELECT entry FROM item_template WHERE name = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(WORLD_SEL_CREATURE_BY_ID, "SELECT guid FROM creature WHERE id = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(WORLD_SEL_GAMEOBJECT_NEAREST, "SELECT guid, id, position_x, position_y, position_z, map, (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) AS order_ FROM gameobject WHERE map = ? AND (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) <= ? ORDER BY order_", CONNECTION_SYNCH); + PREPARE_STATEMENT(WORLD_INS_CREATURE, "INSERT INTO creature (guid, id , map, spawnMask, phaseMask, modelid, equipment_id, position_x, position_y, position_z, orientation, spawntimesecs, spawndist, currentwaypoint, curhealth, curmana, MovementType, npcflag, unit_flags, dynamicflags) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(WORLD_DEL_GAME_EVENT_CREATURE, "DELETE FROM game_event_creature WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(WORLD_DEL_GAME_EVENT_MODEL_EQUIP, "DELETE FROM game_event_model_equip WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(WORLD_INS_GAMEOBJECT, "INSERT INTO gameobject (guid, id, map, spawnMask, phaseMask, position_x, position_y, position_z, orientation, rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); } diff --git a/src/server/shared/Database/Implementation/WorldDatabase.h b/src/server/shared/Database/Implementation/WorldDatabase.h index e708177503f..0580cecec7e 100755 --- a/src/server/shared/Database/Implementation/WorldDatabase.h +++ b/src/server/shared/Database/Implementation/WorldDatabase.h @@ -56,6 +56,7 @@ enum WorldDatabaseStatements WORLD_DEL_GAME_TELE, WORLD_INS_NPC_VENODR, WORLD_DEL_NPC_VENDOR, + WORLD_SEL_NPC_VENDOR_REF, WORLD_UPD_CREATURE_MOVEMENT_TYPE, WORLD_UPD_CREATURE_FACTION, WORLD_UPD_CREATURE_NPCFLAG, @@ -68,10 +69,23 @@ enum WorldDatabaseStatements WORLD_UPD_WAYPOINT_DATA_POINT, WORLD_UPD_WAYPOINT_DATA_POSITION, WORLD_UPD_WAYPOINT_DATA_WPGUID, - WORLD_UPD_ALL_WAYPOINT_DATA_WPGUID, + WORLD_UPD_WAYPOINT_DATA_ALL_WPGUID, + WORLD_SEL_WAYPOINT_DATA_MAX_ID, + WORLD_SEL_WAYPOINT_DATA_BY_ID, + WORLD_SEL_WAYPOINT_DATA_POS_BY_ID, + WORLD_SEL_WAYPOINT_DATA_POS_FIRST_BY_ID, + WORLD_SEL_WAYPOINT_DATA_POS_LAST_BY_ID, + WORLD_SEL_WAYPOINT_DATA_BY_WPGUID, + WORLD_SEL_WAYPOINT_DATA_ALL_BY_WPGUID, + WORLD_SEL_WAYPOINT_DATA_MAX_POINT, + WORLD_SEL_WAYPOINT_DATA_BY_POS, + WORLD_SEL_WAYPOINT_DATA_WPGUID_BY_ID, + WOLRD_SEL_WAYPOINT_DATA_ACTION, + WORLD_SEL_WAYPOINT_SCRIPTS_MAX_ID, WORLD_UPD_CREATURE_ADDON_PATH, WORLD_INS_CREATURE_ADDON, WORLD_DEL_CREATURE_ADDON, + WORLD_SEL_CREATURE_ADDON_BY_GUID, WORLD_INS_WAYPOINT_SCRIPT, WORLD_DEL_WAYPOINT_SCRIPT, WORLD_UPD_WAYPOINT_SCRIPT_ID, @@ -79,7 +93,22 @@ enum WorldDatabaseStatements WORLD_UPD_WAYPOINT_SCRIPT_Y, WORLD_UPD_WAYPOINT_SCRIPT_Z, WORLD_UPD_WAYPOINT_SCRIPT_O, + WORLD_SEL_WAYPOINT_SCRIPT_ID_BY_GUID, WORLD_DEL_CREATURE, + WORLD_INS_CREATURE_TRANSPORT, + WORLD_UPD_CREATURE_TRANSPORT_EMOTE, + WORLD_SEL_COMMANDS, + WORLD_SEL_CREATURE_TEMPLATE, + WORLD_SEL_WAYPOINT_SCRIPT_BY_ID, + WORLD_SEL_IP2NATION_COUNTRY, + WORLD_SEL_ITEM_TEMPLATE_BY_NAME, + WORLD_SEL_CREATURE_BY_ID, + WORLD_SEL_GAMEOBJECT_NEAREST, + WORLD_SEL_GAMEOBJECT_TARGET, + WORLD_INS_CREATURE, + WORLD_DEL_GAME_EVENT_CREATURE, + WORLD_DEL_GAME_EVENT_MODEL_EQUIP, + WORLD_INS_GAMEOBJECT, MAX_WORLDDATABASE_STATEMENTS, }; diff --git a/src/server/shared/Database/MySQLConnection.cpp b/src/server/shared/Database/MySQLConnection.cpp index f686db4c199..7fb4a4f7025 100755 --- a/src/server/shared/Database/MySQLConnection.cpp +++ b/src/server/shared/Database/MySQLConnection.cpp @@ -58,17 +58,13 @@ MySQLConnection::~MySQLConnection() { ASSERT (m_Mysql); /// MySQL context must be present at this point - sLog->outSQLDriver("MySQLConnection::~MySQLConnection()"); for (size_t i = 0; i < m_stmts.size(); ++i) delete m_stmts[i]; for (PreparedStatementMap::const_iterator itr = m_queries.begin(); itr != m_queries.end(); ++itr) - { free((void *)m_queries[itr->first].first); - } mysql_close(m_Mysql); - Unlock(); /// Unlock while we die, how ironic } void MySQLConnection::Close() diff --git a/src/server/shared/Database/PreparedStatement.cpp b/src/server/shared/Database/PreparedStatement.cpp index baeb591ffb1..db26dabaee7 100755 --- a/src/server/shared/Database/PreparedStatement.cpp +++ b/src/server/shared/Database/PreparedStatement.cpp @@ -42,12 +42,20 @@ void PreparedStatement::BindParameters() m_stmt->setBool(i, statement_data[i].data.boolean); break; case TYPE_UI8: + m_stmt->setUInt8(i, statement_data[i].data.ui8); + break; case TYPE_UI16: + m_stmt->setUInt16(i, statement_data[i].data.ui16); + break; case TYPE_UI32: m_stmt->setUInt32(i, statement_data[i].data.ui32); break; case TYPE_I8: + m_stmt->setInt8(i, statement_data[i].data.i8); + break; case TYPE_I16: + m_stmt->setInt16(i, statement_data[i].data.i16); + break; case TYPE_I32: m_stmt->setInt32(i, statement_data[i].data.i32); break; @@ -89,7 +97,7 @@ void PreparedStatement::setUInt8(const uint8 index, const uint8 value) if (index >= statement_data.size()) statement_data.resize(index+1); - statement_data[index].data.ui32 = value; + statement_data[index].data.ui8 = value; statement_data[index].type = TYPE_UI8; } @@ -98,7 +106,7 @@ void PreparedStatement::setUInt16(const uint8 index, const uint16 value) if (index >= statement_data.size()) statement_data.resize(index+1); - statement_data[index].data.ui32 = value; + statement_data[index].data.ui16 = value; statement_data[index].type = TYPE_UI16; } @@ -125,7 +133,7 @@ void PreparedStatement::setInt8(const uint8 index, const int8 value) if (index >= statement_data.size()) statement_data.resize(index+1); - statement_data[index].data.i32 = value; + statement_data[index].data.i8 = value; statement_data[index].type = TYPE_I8; } @@ -134,7 +142,7 @@ void PreparedStatement::setInt16(const uint8 index, const int16 value) if (index >= statement_data.size()) statement_data.resize(index+1); - statement_data[index].data.i32 = value; + statement_data[index].data.i16 = value; statement_data[index].type = TYPE_I16; } @@ -201,6 +209,11 @@ m_bind(NULL) MySQLPreparedStatement::~MySQLPreparedStatement() { ClearParameters(); + if(m_Mstmt->bind_result_done) + { + delete[] m_Mstmt->bind->length; + delete[] m_Mstmt->bind->is_null; + } mysql_stmt_close(m_Mstmt); delete[] m_bind; } @@ -230,17 +243,23 @@ bool MySQLPreparedStatement::CheckValidIndex(uint8 index) void MySQLPreparedStatement::setBool(const uint8 index, const bool value) { - setUInt32(index, value); + setUInt8(index, value ? 1 : 0); } void MySQLPreparedStatement::setUInt8(const uint8 index, const uint8 value) { - setUInt32(index, value); + CheckValidIndex(index); + m_paramsSet[index] = true; + MYSQL_BIND* param = &m_bind[index]; + setValue(param, MYSQL_TYPE_TINY, &value, sizeof(uint8), true); } void MySQLPreparedStatement::setUInt16(const uint8 index, const uint16 value) { - setUInt32(index, value); + CheckValidIndex(index); + m_paramsSet[index] = true; + MYSQL_BIND* param = &m_bind[index]; + setValue(param, MYSQL_TYPE_SHORT, &value, sizeof(uint16), true); } void MySQLPreparedStatement::setUInt32(const uint8 index, const uint32 value) @@ -261,12 +280,18 @@ void MySQLPreparedStatement::setUInt64(const uint8 index, const uint64 value) void MySQLPreparedStatement::setInt8(const uint8 index, const int8 value) { - setInt32(index, value); + CheckValidIndex(index); + m_paramsSet[index] = true; + MYSQL_BIND* param = &m_bind[index]; + setValue(param, MYSQL_TYPE_TINY, &value, sizeof(int8), false); } void MySQLPreparedStatement::setInt16(const uint8 index, const int16 value) { - setInt32(index, value); + CheckValidIndex(index); + m_paramsSet[index] = true; + MYSQL_BIND* param = &m_bind[index]; + setValue(param, MYSQL_TYPE_SHORT, &value, sizeof(int16), false); } void MySQLPreparedStatement::setInt32(const uint8 index, const int32 value) @@ -348,12 +373,20 @@ std::string MySQLPreparedStatement::getQueryString(const char *query) replace << (m_stmt->statement_data[i].data.boolean ? '1' : '0'); break; case TYPE_UI8: + replace << uint16(m_stmt->statement_data[i].data.ui8); // stringstream will append a character with that code instead of numeric representation + break; case TYPE_UI16: + replace << m_stmt->statement_data[i].data.ui16; + break; case TYPE_UI32: replace << m_stmt->statement_data[i].data.ui32; break; case TYPE_I8: + replace << int16(m_stmt->statement_data[i].data.i8); // stringstream will append a character with that code instead of numeric representation + break; case TYPE_I16: + replace << m_stmt->statement_data[i].data.i16; + break; case TYPE_I32: replace << m_stmt->statement_data[i].data.i32; break; diff --git a/src/server/shared/Database/QueryResult.h b/src/server/shared/Database/QueryResult.h index 524532f30ec..e32b16555bc 100755 --- a/src/server/shared/Database/QueryResult.h +++ b/src/server/shared/Database/QueryResult.h @@ -19,7 +19,7 @@ #ifndef QUERYRESULT_H #define QUERYRESULT_H -#include <ace/Refcounted_Auto_Ptr.h> +#include "AutoPtr.h" #include <ace/Thread_Mutex.h> #include "Field.h" @@ -58,7 +58,7 @@ class ResultSet MYSQL_FIELD* _fields; }; -typedef ACE_Refcounted_Auto_Ptr<ResultSet, ACE_Null_Mutex> QueryResult; +typedef Trinity::AutoPtr<ResultSet, ACE_Thread_Mutex> QueryResult; class PreparedResultSet { @@ -103,7 +103,7 @@ class PreparedResultSet }; -typedef ACE_Refcounted_Auto_Ptr<PreparedResultSet, ACE_Null_Mutex> PreparedQueryResult; +typedef Trinity::AutoPtr<PreparedResultSet, ACE_Thread_Mutex> PreparedQueryResult; #endif diff --git a/src/server/shared/Database/Transaction.h b/src/server/shared/Database/Transaction.h index 92002819951..805d48f76cf 100755 --- a/src/server/shared/Database/Transaction.h +++ b/src/server/shared/Database/Transaction.h @@ -47,7 +47,7 @@ class Transaction bool _cleanedUp; }; -typedef ACE_Refcounted_Auto_Ptr<Transaction, ACE_Null_Mutex> SQLTransaction; +typedef Trinity::AutoPtr<Transaction, ACE_Thread_Mutex> SQLTransaction; /*! Low level class*/ class TransactionTask : public SQLOperation diff --git a/src/server/shared/Debugging/Errors.h b/src/server/shared/Debugging/Errors.h index 6927fdb483f..48a8bda32ed 100755 --- a/src/server/shared/Debugging/Errors.h +++ b/src/server/shared/Debugging/Errors.h @@ -24,10 +24,10 @@ #include <ace/Stack_Trace.h> #include <ace/OS_NS_unistd.h> -#define WPAssert( assertion ) { if (!(assertion)) { ACE_Stack_Trace st; sLog->outError( "\n%s:%i in %s ASSERTION FAILED:\n %s\n%s\n", __FILE__, __LINE__, __FUNCTION__, #assertion, st.c_str()); assert( #assertion &&0 ); ((void(*)())NULL)();} } -#define WPError( assertion, errmsg ) if ( ! (assertion) ) { sLog->outError( "%\n%s:%i in %s ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg ); assert( false ); } -#define WPWarning( assertion, errmsg ) if ( ! (assertion) ) { sLog->outError( "\n%s:%i in %s WARNING:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg ); } -#define WPFatal( assertion, errmsg ) if ( ! (assertion) ) { sLog->outError( "\n%s:%i in %s FATAL ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg ); ACE_OS::sleep(10); assert( #assertion &&0 ); abort(); } +#define WPAssert(assertion) { if (!(assertion)) { ACE_Stack_Trace st; sLog->outError("\n%s:%i in %s ASSERTION FAILED:\n %s\n%s\n", __FILE__, __LINE__, __FUNCTION__, #assertion, st.c_str()); *((volatile int*)NULL) = 0; } } +#define WPError(assertion, errmsg) { if (!(assertion)) { sLog->outError("%\n%s:%i in %s ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); *((volatile int*)NULL) = 0; } } +#define WPWarning(assertion, errmsg) { if (!(assertion)) { sLog->outError("\n%s:%i in %s WARNING:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); } } +#define WPFatal(assertion, errmsg) { if (!(assertion)) { sLog->outError("\n%s:%i in %s FATAL ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); ACE_OS::sleep(10); *((volatile int*)NULL) = 0; } } #define ASSERT WPAssert #endif diff --git a/src/server/shared/Debugging/WheatyExceptionReport.cpp b/src/server/shared/Debugging/WheatyExceptionReport.cpp index 63648f66e29..febc5ef3573 100644 --- a/src/server/shared/Debugging/WheatyExceptionReport.cpp +++ b/src/server/shared/Debugging/WheatyExceptionReport.cpp @@ -195,7 +195,23 @@ BOOL WheatyExceptionReport::_GetWindowsVersion(TCHAR* szVersion, DWORD cntMax) case VER_PLATFORM_WIN32_NT: // Test for the specific product family. if (osvi.dwMajorVersion == 6) - _tcsncat(szVersion, _T("Windows Vista or Windows Server 2008 "), cntMax); + { + #if WINVER < 0x0500 + if (osvi.wReserved[1] == VER_NT_WORKSTATION) + #else + if (osvi.wProductType == VER_NT_WORKSTATION) + #endif // WINVER < 0x0500 + { + if (osvi.dwMinorVersion == 1) + _tcsncat(szVersion, _T("Windows 7 "), cntMax); + else + _tcsncat(szVersion, _T("Windows Vista "), cntMax); + } + else if (osvi.dwMinorVersion == 1) + _tcsncat(szVersion, _T("Windows Server 2008 R2 "), cntMax); + else + _tcsncat(szVersion, _T("Windows Server 2008 "), cntMax); + } if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2) _tcsncat(szVersion, _T("Microsoft Windows Server 2003 "), cntMax); if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1) diff --git a/src/server/shared/Dynamic/TypeContainerFunctionsPtr.h b/src/server/shared/Dynamic/TypeContainerFunctionsPtr.h deleted file mode 100755 index 2c065d96d4a..00000000000 --- a/src/server/shared/Dynamic/TypeContainerFunctionsPtr.h +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (C) 2008-2012 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/>. - */ - -#ifndef TYPECONTAINER_FUNCTIONS_PTR_H -#define TYPECONTAINER_FUNCTIONS_PTR_H - -/* - * Here you'll find a list of helper functions to make - * the TypeContainer usefull. Without it, its hard - * to access or mutate the container. - */ - -#include "Platform/Define.h" -#include "Utilities/TypeList.h" -#include <map> - -namespace Trinity -{ - /* ContainerMapList Helpers */ - // count functions - // template<class SPECIFIC_TYPE> size_t Count(const ContainerMapList<SPECIFIC_TYPE> &elements, CountedPtr<SPECIFIC_TYPE>* /*fake*/) - // { - // return elements._element.size(); - // }; - // - // template<class SPECIFIC_TYPE> size_t Count(const ContainerMapList<TypeNull> &elements, CountedPtr<SPECIFIC_TYPE>* /*fake*/) - // { - // return 0; - // } - // - // template<class SPECIFIC_TYPE, class T> size_t Count(const ContainerMapList<T> &elements, CountedPtr<SPECIFIC_TYPE>* /*fake*/) - // { - // return 0; - // } - // - // template<class SPECIFIC_TYPE, class T> size_t Count(const ContainerMapList<TypeList<SPECIFIC_TYPE, T> >&elements, SPECIFIC_TYPE* fake) - // { - // return Count(elements._elements, fake); - // } - // - // template<class SPECIFIC_TYPE, class H, class T> size_t Count(const ContainerMapList<TypeList<H, T> >&elements, SPECIFIC_TYPE* fake) - // { - // return Count(elements._TailElements, fake); - // } - - // non-const find functions - template<class SPECIFIC_TYPE> CountedPtr<SPECIFIC_TYPE>& Find(ContainerMapList<SPECIFIC_TYPE> &elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* /*fake*/) - { - typename std::map<OBJECT_HANDLE, CountedPtr<SPECIFIC_TYPE> >::iterator iter = elements._element.find(hdl); - return (iter == elements._element.end() ? NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)NULL) : iter->second); - }; - - template<class SPECIFIC_TYPE> CountedPtr<SPECIFIC_TYPE>& Find(ContainerMapList<TypeNull> &elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* /*fake*/) - { - return NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)NULL);// terminate recursion - } - - template<class SPECIFIC_TYPE, class T> CountedPtr<SPECIFIC_TYPE>& Find(ContainerMapList<T> &elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* /*fake*/) - { - return NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)NULL);// this is a missed - } - - template<class SPECIFIC_TYPE, class H, class T> CountedPtr<SPECIFIC_TYPE>& Find(ContainerMapList<TypeList<H, T> >&elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* fake) - { - CountedPtr<SPECIFIC_TYPE> &t = Find(elements._elements, hdl, fake); - return (!t ? Find(elements._TailElements, hdl, fake) : t); - } - - // const find functions - template<class SPECIFIC_TYPE> const CountedPtr<SPECIFIC_TYPE>& Find(const ContainerMapList<SPECIFIC_TYPE> &elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* /*fake*/) - { - typename CountedPtr<SPECIFIC_TYPE>::iterator iter = elements._element.find(hdl); - return (iter == elements._element.end() ? NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)NULL) : iter->second); - }; - - template<class SPECIFIC_TYPE> const CountedPtr<SPECIFIC_TYPE>& Find(const ContainerMapList<TypeNull> &elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* /*fake*/) - { - return NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)NULL); - } - - template<class SPECIFIC_TYPE, class T> const CountedPtr<SPECIFIC_TYPE>& Find(const ContainerMapList<T> &elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* /*fake*/) - { - return NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)NULL); - } - - template<class SPECIFIC_TYPE, class H, class T> CountedPtr<SPECIFIC_TYPE>& Find(const ContainerMapList<TypeList<H, T> >&elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* fake) - { - CountedPtr<SPECIFIC_TYPE> &t = Find(elements._elements, hdl, fake); - if (!t) - t = Find(elements._TailElement, hdl, fake); - - return t; - } - - // non-const insert functions - template<class SPECIFIC_TYPE> CountedPtr<SPECIFIC_TYPE>& Insert(ContainerMapList<SPECIFIC_TYPE> &elements, CountedPtr<SPECIFIC_TYPE> &obj, OBJECT_HANDLE hdl) - { - elements._element[hdl] = obj; - return obj; - }; - - template<class SPECIFIC_TYPE> CountedPtr<SPECIFIC_TYPE>& Insert(ContainerMapList<TypeNull> &elements, CountedPtr<SPECIFIC_TYPE> &obj, OBJECT_HANDLE hdl) - { - return NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)NULL); - } - - // this is a missed - template<class SPECIFIC_TYPE, class T> CountedPtr<SPECIFIC_TYPE>& Insert(ContainerMapList<T> &elements, CountedPtr<SPECIFIC_TYPE> &obj, OBJECT_HANDLE hdl) - { - return NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)NULL);// a missed - } - - // Recursion - template<class SPECIFIC_TYPE, class H, class T> CountedPtr<SPECIFIC_TYPE>& Insert(ContainerMapList<TypeList<H, T> >&elements, CountedPtr<SPECIFIC_TYPE> &obj, OBJECT_HANDLE hdl) - { - CountedPtr<SPECIFIC_TYPE> &t= Insert(elements._elements, obj, hdl); - return (!t ? Insert(elements._TailElements, obj, hdl) : t); - } - - // non-const remove method - template<class SPECIFIC_TYPE> bool Remove(ContainerMapList<SPECIFIC_TYPE> &elements, CountedPtr<SPECIFIC_TYPE> &obj, OBJECT_HANDLE hdl) - { - typename std::map<OBJECT_HANDLE, CountedPtr<SPECIFIC_TYPE> >::iterator iter = elements._element.find(hdl); - if ( iter != elements._element.end() ) - { - elements._element.erase(iter); - return true; - } - - return false; // found... terminate the search - } - - template<class SPECIFIC_TYPE> bool Remove(ContainerMapList<TypeNull> &elements, CountedPtr<SPECIFIC_TYPE> &obj, OBJECT_HANDLE hdl) - { - return false; - } - - // this is a missed - template<class SPECIFIC_TYPE, class T> bool Remove(ContainerMapList<T> &elements, CountedPtr<SPECIFIC_TYPE> &obj, OBJECT_HANDLE hdl) - { - return false; - } - - template<class SPECIFIC_TYPE, class T, class H> bool Remove(ContainerMapList<TypeList<H, T> > &elements, CountedPtr<SPECIFIC_TYPE> &obj, OBJECT_HANDLE hdl) - { - // The head element is bad - bool t = Remove(elements._elements, obj, hdl); - return ( !t ? Remove(elements._TailElements, obj, hdl) : t ); - } - -} -#endif - diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index b583d742748..493e30d36c0 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -38,11 +38,11 @@ Log::Log() : Log::~Log() { - if ( logfile != NULL ) + if (logfile != NULL) fclose(logfile); logfile = NULL; - if ( gmLogfile != NULL ) + if (gmLogfile != NULL) fclose(gmLogfile); gmLogfile = NULL; @@ -50,7 +50,7 @@ Log::~Log() fclose(charLogfile); charLogfile = NULL; - if ( dberLogfile != NULL ) + if (dberLogfile != NULL) fclose(dberLogfile); dberLogfile = NULL; @@ -81,32 +81,32 @@ Log::~Log() void Log::SetLogLevel(char *Level) { - int32 NewLevel =atoi((char*)Level); - if ( NewLevel <0 ) + int32 NewLevel = atoi((char*)Level); + if (NewLevel < 0) NewLevel = 0; m_logLevel = NewLevel; - outString( "LogLevel is %u", m_logLevel ); + outString("LogLevel is %u", m_logLevel); } void Log::SetLogFileLevel(char *Level) { - int32 NewLevel =atoi((char*)Level); - if ( NewLevel <0 ) + int32 NewLevel = atoi((char*)Level); + if (NewLevel < 0) NewLevel = 0; m_logFileLevel = NewLevel; - outString( "LogFileLevel is %u", m_logFileLevel ); + outString("LogFileLevel is %u", m_logFileLevel); } void Log::SetDBLogLevel(char *Level) { int32 NewLevel = atoi((char*)Level); - if ( NewLevel < 0 ) + if (NewLevel < 0) NewLevel = 0; m_dbLogLevel = NewLevel; - outString( "DBLogLevel is %u", m_dbLogLevel ); + outString("DBLogLevel is %u", m_dbLogLevel); } void Log::Initialize() @@ -382,7 +382,7 @@ void Log::outDB(LogTypes type, const char * str) PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_LOG); stmt->setInt32(0, realm); - stmt->setInt32(1, type); + stmt->setUInt8(1, uint8(type)); stmt->setString(2, logStr); LoginDatabase.Execute(stmt); diff --git a/src/server/shared/Logging/Log.h b/src/server/shared/Logging/Log.h index cbaa2d80451..e32ea7765a9 100755 --- a/src/server/shared/Logging/Log.h +++ b/src/server/shared/Logging/Log.h @@ -31,7 +31,7 @@ enum DebugLogFilters LOG_FILTER_PETS = 0x00000002, LOG_FILTER_VEHICLES = 0x00000004, LOG_FILTER_TSCR = 0x00000008, // C++ AI, instance scripts, etc. - LOG_FILTER_DATABASE_AI = 0x08000010, // SmartAI, EventAI, CreatureAI + LOG_FILTER_DATABASE_AI = 0x00000010, // SmartAI, EventAI, CreatureAI LOG_FILTER_MAPSCRIPTS = 0x00000020, LOG_FILTER_NETWORKIO = 0x00000040, // Anything packet/netcode related LOG_FILTER_SPELLS_AURAS = 0x00000080, @@ -118,28 +118,28 @@ class Log void SetColor(bool stdout_stream, ColorTypes color); void ResetColor(bool stdout_stream); - void outErrorST( const char * err, ... ) ATTR_PRINTF(2, 3); - void outDB( LogTypes type, const char * str ); - void outString( const char * str, ... ) ATTR_PRINTF(2, 3); - void outString( ); - void outStringInLine( const char * str, ... ) ATTR_PRINTF(2, 3); - void outError( const char * err, ... ) ATTR_PRINTF(2, 3); - void outCrash( const char * err, ... ) ATTR_PRINTF(2, 3); - void outBasic( const char * str, ... ) ATTR_PRINTF(2, 3); - void outDetail( const char * str, ... ) ATTR_PRINTF(2, 3); - void outSQLDev( const char * str, ... ) ATTR_PRINTF(2, 3); + void outErrorST(const char * err, ...) ATTR_PRINTF(2, 3); + void outDB(LogTypes type, const char * str); + void outString(const char * str, ...) ATTR_PRINTF(2, 3); + void outString(); + void outStringInLine(const char * str, ...) ATTR_PRINTF(2, 3); + void outError(const char * err, ...) ATTR_PRINTF(2, 3); + void outCrash(const char * err, ...) ATTR_PRINTF(2, 3); + void outBasic(const char * str, ...) ATTR_PRINTF(2, 3); + void outDetail(const char * str, ...) ATTR_PRINTF(2, 3); + void outSQLDev(const char * str, ...) ATTR_PRINTF(2, 3); void outDebug(DebugLogFilters f, const char* str, ...) ATTR_PRINTF(3, 4); - void outStaticDebug( const char * str, ... ) ATTR_PRINTF(2, 3); - void outDebugInLine( const char * str, ... ) ATTR_PRINTF(2, 3); - void outErrorDb( const char * str, ... ) ATTR_PRINTF(2, 3); - void outChar( const char * str, ... ) ATTR_PRINTF(2, 3); - void outCommand( uint32 account, const char * str, ...) ATTR_PRINTF(3, 4); - void outRemote( const char * str, ... ) ATTR_PRINTF(2, 3); - void outChat( const char * str, ... ) ATTR_PRINTF(2, 3); - void outArena( const char * str, ... ) ATTR_PRINTF(2, 3); - void outSQLDriver( const char* str, ... ) ATTR_PRINTF(2, 3); - void outWarden( const char * str, ... ) ATTR_PRINTF(2, 3); - void outCharDump( const char * str, uint32 account_id, uint32 guid, const char * name ); + void outStaticDebug(const char * str, ...) ATTR_PRINTF(2, 3); + void outDebugInLine(const char * str, ...) ATTR_PRINTF(2, 3); + void outErrorDb(const char * str, ...) ATTR_PRINTF(2, 3); + void outChar(const char * str, ...) ATTR_PRINTF(2, 3); + void outCommand(uint32 account, const char * str, ...) ATTR_PRINTF(3, 4); + void outRemote(const char * str, ...) ATTR_PRINTF(2, 3); + void outChat(const char * str, ...) ATTR_PRINTF(2, 3); + void outArena(const char * str, ...) ATTR_PRINTF(2, 3); + void outSQLDriver(const char* str, ...) ATTR_PRINTF(2, 3); + void outWarden(const char * str, ...) ATTR_PRINTF(2, 3); + void outCharDump(const char * str, uint32 account_id, uint32 guid, const char * name); void outOpCode(uint32 op, const char * name, bool smsg = true); static void outTimestamp(FILE* file); diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h index 3506913fc23..24ca412d6f2 100755 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -29,22 +29,52 @@ class ByteBufferException { public: - ByteBufferException(bool _add, size_t _pos, size_t _esize, size_t _size) - : add(_add), pos(_pos), esize(_esize), size(_size) + ByteBufferException(size_t pos, size_t size, size_t valueSize) + : Pos(pos), Size(size), ValueSize(valueSize) { - PrintPosError(); } - void PrintPosError() const + protected: + size_t Pos; + size_t Size; + size_t ValueSize; +}; + +class ByteBufferPositionException : public ByteBufferException +{ + public: + ByteBufferPositionException(bool add, size_t pos, size_t size, size_t valueSize) + : ByteBufferException(pos, size, valueSize), _add(add) + { + PrintError(); + } + + protected: + void PrintError() const { - sLog->outError("Attempted to %s in ByteBuffer (pos: " SIZEFMTD " size: "SIZEFMTD") value with size: " SIZEFMTD, - (add ? "put" : "get"), pos, size, esize); + sLog->outError("Attempted to %s value with size: "SIZEFMTD" in ByteBuffer (pos: " SIZEFMTD " size: "SIZEFMTD") " , + (_add ? "put" : "get"), ValueSize, Pos, Size); } + private: - bool add; - size_t pos; - size_t esize; - size_t size; + bool _add; +}; + +class ByteBufferSourceException : public ByteBufferException +{ + public: + ByteBufferSourceException(size_t pos, size_t size, size_t valueSize) + : ByteBufferException(pos, size, valueSize) + { + PrintError(); + } + + protected: + void PrintError() const + { + sLog->outError("Attempted to put a %s in ByteBuffer (pos: "SIZEFMTD" size: "SIZEFMTD")", + (ValueSize > 0 ? "NULL-pointer" : "zero-sized value"), Pos, Size); + } }; class BitStream @@ -288,14 +318,17 @@ class ByteBuffer ByteBuffer &operator<<(const std::string &value) { - append((uint8 const*)value.c_str(), value.length()); + if (size_t len = value.length()) + append((uint8 const*)value.c_str(), len); append((uint8)0); return *this; } ByteBuffer &operator<<(const char *str) { - append((uint8 const*)str, str ? strlen(str) : 0); + size_t len = 0; + if (str && (len = strlen(str))) + append((uint8 const*)str, len); append((uint8)0); return *this; } @@ -421,7 +454,7 @@ class ByteBuffer void read_skip(size_t skip) { if (_rpos + skip > size()) - throw ByteBufferException(false, _rpos, skip, size()); + throw ByteBufferPositionException(false, _rpos, skip, size()); _rpos += skip; } @@ -435,7 +468,7 @@ class ByteBuffer template <typename T> T read(size_t pos) const { if (pos + sizeof(T) > size()) - throw ByteBufferException(false, pos, sizeof(T), size()); + throw ByteBufferPositionException(false, pos, sizeof(T), size()); T val = *((T const*)&_storage[pos]); EndianConvert(val); return val; @@ -444,7 +477,7 @@ class ByteBuffer void read(uint8 *dest, size_t len) { if (_rpos + len > size()) - throw ByteBufferException(false, _rpos, len, size()); + throw ByteBufferPositionException(false, _rpos, len, size()); memcpy(dest, &_storage[_rpos], len); _rpos += len; } @@ -452,7 +485,7 @@ class ByteBuffer void readPackGUID(uint64& guid) { if (rpos() + 1 > size()) - throw ByteBufferException(false, _rpos, 1, size()); + throw ByteBufferPositionException(false, _rpos, 1, size()); guid = 0; @@ -464,7 +497,7 @@ class ByteBuffer if (guidmark & (uint8(1) << i)) { if (rpos() + 1 > size()) - throw ByteBufferException(false, _rpos, 1, size()); + throw ByteBufferPositionException(false, _rpos, 1, size()); uint8 bit; (*this) >> bit; @@ -557,7 +590,7 @@ class ByteBuffer void resize(size_t newsize) { - _storage.resize(newsize); + _storage.resize(newsize, 0); _rpos = 0; _wpos = size(); } @@ -568,11 +601,6 @@ class ByteBuffer _storage.reserve(ressize); } - void append(const std::string& str) - { - append((uint8 const*)str.c_str(), str.size() + 1); - } - void append(const char *src, size_t cnt) { return append((const uint8 *)src, cnt); @@ -586,7 +614,10 @@ class ByteBuffer void append(const uint8 *src, size_t cnt) { if (!cnt) - return; + throw ByteBufferSourceException(_wpos, size(), cnt); + + if (!src) + throw ByteBufferSourceException(_wpos, size(), cnt); ASSERT(size() < 10000000); @@ -634,7 +665,11 @@ class ByteBuffer void put(size_t pos, const uint8 *src, size_t cnt) { if (pos + cnt > size()) - throw ByteBufferException(true, pos, cnt, size()); + throw ByteBufferPositionException(true, pos, cnt, size()); + + if (!src) + throw ByteBufferSourceException(_wpos, size(), cnt); + memcpy(&_storage[pos], src, cnt); } diff --git a/src/server/shared/Utilities/Util.cpp b/src/server/shared/Utilities/Util.cpp index 52ce74be8f8..7bedf9690ca 100755 --- a/src/server/shared/Utilities/Util.cpp +++ b/src/server/shared/Utilities/Util.cpp @@ -19,15 +19,10 @@ #include <iostream> #include "Util.h" #include "utf8.h" -#ifdef USE_SFMT_FOR_RNG #include "SFMT.h" -#else -#include "MersenneTwister.h" -#endif #include <ace/TSS_T.h> #include <ace/INET_Addr.h> -#ifdef USE_SFMT_FOR_RNG typedef ACE_TSS<SFMTRand> SFMTRandTSS; static SFMTRandTSS sfmtRand; @@ -61,41 +56,6 @@ double rand_chance(void) return sfmtRand->Random() * 100.0; } -#else -typedef ACE_TSS<MTRand> MTRandTSS; -static MTRandTSS mtRand; - -int32 irand(int32 min, int32 max) -{ - return int32(mtRand->randInt(max - min)) + min; -} - -uint32 urand(uint32 min, uint32 max) -{ - return mtRand->randInt(max - min) + min; -} - -float frand(float min, float max) -{ - return float(mtRand->randExc(max - min) + min); -} - -int32 rand32() -{ - return mtRand->randInt(); -} - -double rand_norm(void) -{ - return mtRand->randExc(); -} - -double rand_chance(void) -{ - return mtRand->randExc(100.0); -} -#endif - Tokens::Tokens(const std::string &src, const char sep, uint32 vectorReserve) { m_str = new char[src.length() + 1]; diff --git a/src/server/shared/Utilities/Util.h b/src/server/shared/Utilities/Util.h index 4c2c1936993..196882dc2a0 100755 --- a/src/server/shared/Utilities/Util.h +++ b/src/server/shared/Utilities/Util.h @@ -20,7 +20,7 @@ #define _UTIL_H #include "Common.h" - +#include "Containers.h" #include <string> #include <vector> @@ -73,7 +73,7 @@ inline uint32 secsToTimeBitFields(time_t secs) double rand_norm(void); /* Return a random double from 0.0 to 99.9999999999999. Floats support only 7 valid decimal digits. - * A double supports up to 15 valid decimal digits and is used internaly (RAND32_MAX has 10 digits). + * A double supports up to 15 valid decimal digits and is used internally (RAND32_MAX has 10 digits). * With an FPU, there is usually no difference in performance between float and double. */ double rand_chance(void); @@ -653,12 +653,4 @@ public: }; }; -/* Select a random element from a container. Note: make sure you explicitly empty check the container */ -template <class C> typename C::value_type const& SelectRandomContainerElement(C const& container) -{ - typename C::const_iterator it = container.begin(); - std::advance(it, urand(0, container.size() - 1)); - return *it; -} - #endif diff --git a/src/server/worldserver/CMakeLists.txt b/src/server/worldserver/CMakeLists.txt index b75dfcfc064..0d51f30449e 100644 --- a/src/server/worldserver/CMakeLists.txt +++ b/src/server/worldserver/CMakeLists.txt @@ -48,7 +48,6 @@ include_directories( ${CMAKE_SOURCE_DIR}/dep/gsoap ${CMAKE_SOURCE_DIR}/dep/sockets/include ${CMAKE_SOURCE_DIR}/dep/SFMT - ${CMAKE_SOURCE_DIR}/dep/mersennetwister ${CMAKE_SOURCE_DIR}/src/server/collision ${CMAKE_SOURCE_DIR}/src/server/collision/Management ${CMAKE_SOURCE_DIR}/src/server/collision/Models @@ -134,6 +133,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/server/game/Weather ${CMAKE_SOURCE_DIR}/src/server/game/World ${CMAKE_SOURCE_DIR}/src/server/authserver/Server + ${CMAKE_SOURCE_DIR}/src/server/authserver/Realms ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/CommandLine ${CMAKE_CURRENT_SOURCE_DIR}/RemoteAccess @@ -201,4 +201,3 @@ if( USE_COREPCH ) add_native_precompiled_header(worldserver ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders/worldPCH) endif() endif() - diff --git a/src/server/worldserver/CommandLine/CliRunnable.cpp b/src/server/worldserver/CommandLine/CliRunnable.cpp index 8e04a9c2f34..e85a3e1870d 100755 --- a/src/server/worldserver/CommandLine/CliRunnable.cpp +++ b/src/server/worldserver/CommandLine/CliRunnable.cpp @@ -125,29 +125,44 @@ void commandFinished(void*, bool /*success*/) */ bool ChatHandler::GetDeletedCharacterInfoList(DeletedInfoList& foundList, std::string searchString) { - QueryResult resultChar; + PreparedQueryResult result; + PreparedStatement* stmt; if (!searchString.empty()) { // search by GUID if (isNumeric(searchString.c_str())) - resultChar = CharacterDatabase.PQuery("SELECT guid, deleteInfos_Name, deleteInfos_Account, deleteDate FROM characters WHERE deleteDate IS NOT NULL AND guid = %u", uint64(atoi(searchString.c_str()))); + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO_BY_GUID); + + stmt->setUInt32(0, uint32(atoi(searchString.c_str()))); + + result = CharacterDatabase.Query(stmt); + } // search by name else { if (!normalizePlayerName(searchString)) return false; - resultChar = CharacterDatabase.PQuery("SELECT guid, deleteInfos_Name, deleteInfos_Account, deleteDate FROM characters WHERE deleteDate IS NOT NULL AND deleteInfos_Name " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), searchString.c_str()); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO_BY_NAME); + + stmt->setString(0, searchString); + + result = CharacterDatabase.Query(stmt); } } else - resultChar = CharacterDatabase.Query("SELECT guid, deleteInfos_Name, deleteInfos_Account, deleteDate FROM characters WHERE deleteDate IS NOT NULL"); + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO); - if (resultChar) + result = CharacterDatabase.Query(stmt); + } + + if (result) { do { - Field* fields = resultChar->Fetch(); + Field* fields = result->Fetch(); DeletedInfo info; @@ -161,7 +176,7 @@ bool ChatHandler::GetDeletedCharacterInfoList(DeletedInfoList& foundList, std::s info.deleteDate = time_t(fields[3].GetUInt32()); foundList.push_back(info); - } while (resultChar->NextRow()); + } while (result->NextRow()); } return true; @@ -299,6 +314,11 @@ void ChatHandler::HandleCharacterDeletedRestoreHelper(DeletedInfo const& delInfo stmt->setUInt32(2, delInfo.lowguid); CharacterDatabase.Execute(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME_DATA); + stmt->setUInt32(0, delInfo.lowguid); + if (PreparedQueryResult result = CharacterDatabase.Query(stmt)) + sWorld->AddCharacterNameData(delInfo.lowguid, delInfo.name, (*result)[2].GetUInt8(), (*result)[0].GetUInt8(), (*result)[1].GetUInt8()); } /** diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp index 23f925dedef..04820f59355 100755 --- a/src/server/worldserver/Main.cpp +++ b/src/server/worldserver/Main.cpp @@ -137,8 +137,8 @@ extern int main(int argc, char **argv) } sLog->outString("Using configuration file %s.", cfg_file); - sLog->outDetail("%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); - sLog->outDetail("Using ACE: %s", ACE_VERSION); + sLog->outString("Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); + sLog->outString("Using ACE version: %s", ACE_VERSION); ///- and run the 'Master' /// \todo Why do we need this 'Master'? Can't all of this be in the Main as for Realmd? diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp index d84cfc1a4a4..03b2859c514 100755 --- a/src/server/worldserver/Master.cpp +++ b/src/server/worldserver/Master.cpp @@ -41,6 +41,7 @@ #include "Timer.h" #include "Util.h" #include "AuthSocket.h" +#include "RealmList.h" #include "BigNumber.h" @@ -136,13 +137,6 @@ int Master::Run() sLog->outString(" C O R E /\\___/"); sLog->outString("http://TrinityCore.org \\/__/\n"); -#ifdef USE_SFMT_FOR_RNG - sLog->outString("\n"); - sLog->outString("SFMT has been enabled as the random number generator, if worldserver"); - sLog->outString("freezes or crashes randomly, first, try disabling SFMT in CMAKE configuration"); - sLog->outString("\n"); -#endif //USE_SFMT_FOR_RNG - /// worldserver PID file creation std::string pidfile = ConfigMgr::GetStringDefault("PidFile", ""); if (!pidfile.empty()) @@ -162,7 +156,7 @@ int Master::Run() return 1; // set server offline (not connectable) - LoginDatabase.DirectPExecute("UPDATE realmlist SET color = (color & ~%u) | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, REALM_FLAG_INVALID, realmID); + LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = (flag & ~%u) | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, REALM_FLAG_INVALID, realmID); ///- Initialize the World sWorld->SetInitialWorldSettings(); @@ -273,10 +267,14 @@ int Master::Run() } // set server online (allow connecting now) - LoginDatabase.DirectPExecute("UPDATE realmlist SET color = color & ~%u, population = 0 WHERE id = '%u'", REALM_FLAG_INVALID, realmID); + LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag & ~%u, population = 0 WHERE id = '%u'", REALM_FLAG_INVALID, realmID); sLog->outString("%s (worldserver-daemon) ready...", _FULLVERSION); - sWorldSocketMgr->Wait(); + + // when the main thread closes the singletons get unloaded + // since worldrunnable uses them, it will crash if unloaded after master + world_thread.wait(); + rar_thread.wait(); if (soap_thread) { @@ -286,15 +284,10 @@ int Master::Run() } // set server offline - LoginDatabase.DirectPExecute("UPDATE realmlist SET color = color | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, realmID); - - // when the main thread closes the singletons get unloaded - // since worldrunnable uses them, it will crash if unloaded after master - world_thread.wait(); - rar_thread.wait(); + LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, realmID); ///- Clean database before leaving - clearOnlineAccounts(); + ClearOnlineAccounts(); _StopDB(); @@ -454,7 +447,7 @@ bool Master::_StartDB() sLog->SetRealmID(realmID); ///- Clean the database before starting - clearOnlineAccounts(); + ClearOnlineAccounts(); ///- Insert version info into DB WorldDatabase.PExecute("UPDATE version SET core_version = '%s', core_revision = '%s'", _FULLVERSION, _HASH); // One-time query @@ -475,16 +468,14 @@ void Master::_StopDB() } /// Clear 'online' status for all accounts with characters in this realm -void Master::clearOnlineAccounts() +void Master::ClearOnlineAccounts() { - // Cleanup online status for characters hosted at current realm - /// \todo Only accounts with characters logged on *this* realm should have online status reset. Move the online column from 'account' to 'realmcharacters'? - LoginDatabase.DirectPExecute( - "UPDATE account SET online = 0 WHERE online > 0 " - "AND id IN (SELECT acctid FROM realmcharacters WHERE realmid = '%d')", realmID); + // Reset online status for all accounts with characters on the current realm + LoginDatabase.DirectPExecute("UPDATE account SET online = 0 WHERE online > 0 AND id IN (SELECT acctid FROM realmcharacters WHERE realmid = %d)", realmID); + // Reset online status for all characters CharacterDatabase.DirectExecute("UPDATE characters SET online = 0 WHERE online <> 0"); // Battleground instance ids reset at server restart - CharacterDatabase.DirectExecute(CharacterDatabase.GetPreparedStatement(CHAR_UPD_PLAYERS_BGDATA)); + CharacterDatabase.DirectExecute("UPDATE character_battleground_data SET instanceId = 0"); } diff --git a/src/server/worldserver/Master.h b/src/server/worldserver/Master.h index 17c230ef7c7..548cd02c64a 100755 --- a/src/server/worldserver/Master.h +++ b/src/server/worldserver/Master.h @@ -37,7 +37,7 @@ class Master bool _StartDB(); void _StopDB(); - void clearOnlineAccounts(); + void ClearOnlineAccounts(); }; #define sMaster ACE_Singleton<Master, ACE_Null_Mutex>::instance() diff --git a/src/server/worldserver/RemoteAccess/RASocket.cpp b/src/server/worldserver/RemoteAccess/RASocket.cpp index e5637d282c6..ebc7c7624d9 100755 --- a/src/server/worldserver/RemoteAccess/RASocket.cpp +++ b/src/server/worldserver/RemoteAccess/RASocket.cpp @@ -32,7 +32,7 @@ RASocket::RASocket() { - iMinLevel = ConfigMgr::GetIntDefault("RA.MinLevel", 3); + _minLevel = ConfigMgr::GetIntDefault("RA.MinLevel", 3); } RASocket::~RASocket() @@ -174,12 +174,15 @@ int RASocket::process_command(const std::string& command) int RASocket::check_access_level(const std::string& user) { - std::string safe_user = user; + std::string safeUser = user; + + AccountMgr::normalizeString(safeUser); + - AccountMgr::normalizeString(safe_user); - LoginDatabase.EscapeString(safe_user); - QueryResult result = LoginDatabase.PQuery("SELECT a.id, aa.gmlevel, aa.RealmID FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE a.username = '%s'", safe_user.c_str()); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_ACCESS); + stmt->setString(0, safeUser); + PreparedQueryResult result = LoginDatabase.Query(stmt); if (!result) { @@ -189,7 +192,7 @@ int RASocket::check_access_level(const std::string& user) Field* fields = result->Fetch(); - if (fields[1].GetUInt32() < iMinLevel) + if (fields[1].GetUInt8() < _minLevel) { sLog->outRemote("User %s has no privilege to login", user.c_str()); return -1; @@ -207,19 +210,20 @@ int RASocket::check_password(const std::string& user, const std::string& pass) { std::string safe_user = user; AccountMgr::normalizeString(safe_user); - LoginDatabase.EscapeString(safe_user); std::string safe_pass = pass; AccountMgr::normalizeString(safe_pass); - LoginDatabase.EscapeString(safe_pass); std::string hash = AccountMgr::CalculateShaPassHash(safe_user, safe_pass); - QueryResult check = LoginDatabase.PQuery( - "SELECT 1 FROM account WHERE username = '%s' AND sha_pass_hash = '%s'", - safe_user.c_str(), hash.c_str()); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_CHECK_PASSWORD_BY_NAME); - if (!check) + stmt->setString(0, safe_user); + stmt->setString(1, hash); + + PreparedQueryResult result = LoginDatabase.Query(stmt); + + if (!result) { sLog->outRemote("Wrong password for user: %s", user.c_str()); return -1; diff --git a/src/server/worldserver/RemoteAccess/RASocket.h b/src/server/worldserver/RemoteAccess/RASocket.h index 1c9b1ac24b5..450245a0ff4 100755 --- a/src/server/worldserver/RemoteAccess/RASocket.h +++ b/src/server/worldserver/RemoteAccess/RASocket.h @@ -56,7 +56,7 @@ class RASocket: public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_MT_SYNCH> private: /// Minimum security level required to connect - uint8 iMinLevel; + uint8 _minLevel; }; #endif /// @} diff --git a/src/server/worldserver/WorldThread/WorldRunnable.cpp b/src/server/worldserver/WorldThread/WorldRunnable.cpp index 8ea54ca599e..42cfaae41ec 100755 --- a/src/server/worldserver/WorldThread/WorldRunnable.cpp +++ b/src/server/worldserver/WorldThread/WorldRunnable.cpp @@ -30,6 +30,7 @@ #include "MapManager.h" #include "Timer.h" #include "WorldRunnable.h" +#include "OutdoorPvPMgr.h" #define WORLD_SLEEP_CONST 50 @@ -93,4 +94,5 @@ void WorldRunnable::run() sMapMgr->UnloadAll(); // unload all grids (including locked in memory) sObjectAccessor->UnloadAll(); // unload 'i_player2corpse' storage and remove from world sScriptMgr->Unload(); + sOutdoorPvPMgr->Die(); } diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index ac4d3fb1bc0..6c598667a1f 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -1409,10 +1409,10 @@ AllowTickets = 1 # # DungeonFinder.Enable # Description: Dungeon and raid finder system. -# Default: 0 - (Disabled) -# 1 - (Enabled, Experimental as of still being in development) +# Default: 1 - (Enabled) +# 0 - (Disabled) -DungeonFinder.Enable = 0 +DungeonFinder.Enable = 1 # # DBC.EnforceItemAttributes diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp index fb64adb3c61..241be4982ab 100644 --- a/src/tools/map_extractor/System.cpp +++ b/src/tools/map_extractor/System.cpp @@ -313,16 +313,16 @@ void ReadLiquidTypeTableDBC() exit(1); } - size_t LiqType_count = dbc.getRecordCount(); - size_t LiqType_maxid = dbc.getMaxId(); - LiqType = new uint16[LiqType_maxid + 1]; - memset(LiqType, 0xff, (LiqType_maxid + 1) * sizeof(uint16)); + size_t liqTypeCount = dbc.getRecordCount(); + size_t liqTypeMaxId = dbc.getMaxId(); + LiqType = new uint16[liqTypeMaxId + 1]; + memset(LiqType, 0xff, (liqTypeMaxId + 1) * sizeof(uint16)); - for(uint32 x = 0; x < LiqType_count; ++x) + for(uint32 x = 0; x < liqTypeCount; ++x) LiqType[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3); SFileCloseFile(dbcFile); - printf("Done! (%u LiqTypes loaded)\n", LiqType_count); + printf("Done! (%u LiqTypes loaded)\n", liqTypeCount); } // @@ -331,7 +331,7 @@ void ReadLiquidTypeTableDBC() // Map file format data static char const* MAP_MAGIC = "MAPS"; -static char const* MAP_VERSION_MAGIC = "v1.1"; +static char const* MAP_VERSION_MAGIC = "v1.2"; static char const* MAP_AREA_MAGIC = "AREA"; static char const* MAP_HEIGHT_MAGIC = "MHGT"; static char const* MAP_LIQUID_MAGIC = "MLIQ"; @@ -414,7 +414,8 @@ uint16 uint16_V9[ADT_GRID_SIZE+1][ADT_GRID_SIZE+1]; uint8 uint8_V8[ADT_GRID_SIZE][ADT_GRID_SIZE]; uint8 uint8_V9[ADT_GRID_SIZE+1][ADT_GRID_SIZE+1]; -uint8 liquid_type[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID]; +uint16 liquid_entry[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID]; +uint8 liquid_flags[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID]; bool liquid_show[ADT_GRID_SIZE][ADT_GRID_SIZE]; float liquid_height[ADT_GRID_SIZE+1][ADT_GRID_SIZE+1]; @@ -426,7 +427,8 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32 return false; memset(liquid_show, 0, sizeof(liquid_show)); - memset(liquid_type, 0, sizeof(liquid_type)); + memset(liquid_flags, 0, sizeof(liquid_flags)); + memset(liquid_entry, 0, sizeof(liquid_entry)); // Prepare map header map_fileheader map; @@ -663,13 +665,75 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32 map.heightMapSize+= sizeof(V9) + sizeof(V8); } + // Get from MCLQ chunk (old) + for (int i = 0; i < ADT_CELLS_PER_GRID; i++) + { + for(int j = 0; j < ADT_CELLS_PER_GRID; j++) + { + adt_MCNK *cell = cells->getMCNK(i, j); + if (!cell) + continue; + + adt_MCLQ *liquid = cell->getMCLQ(); + int count = 0; + if (!liquid || cell->sizeMCLQ <= 8) + continue; + + for (int y = 0; y < ADT_CELL_SIZE; y++) + { + int cy = i * ADT_CELL_SIZE + y; + for (int x = 0; x < ADT_CELL_SIZE; x++) + { + int cx = j * ADT_CELL_SIZE + x; + if (liquid->flags[y][x] != 0x0F) + { + liquid_show[cy][cx] = true; + if (liquid->flags[y][x] & (1<<7)) + liquid_flags[i][j] |= MAP_LIQUID_TYPE_DARK_WATER; + ++count; + } + } + } + + uint32 c_flag = cell->flags; + if (c_flag & (1<<2)) + { + liquid_entry[i][j] = 1; + liquid_flags[i][j] |= MAP_LIQUID_TYPE_WATER; // water + } + if (c_flag & (1<<3)) + { + liquid_entry[i][j] = 2; + liquid_flags[i][j] |= MAP_LIQUID_TYPE_OCEAN; // ocean + } + if (c_flag & (1<<4)) + { + liquid_entry[i][j] = 3; + liquid_flags[i][j] |= MAP_LIQUID_TYPE_MAGMA; // magma/slime + } + + if (!count && liquid_flags[i][j]) + fprintf(stderr, "Wrong liquid detect in MCLQ chunk"); + + for (int y = 0; y <= ADT_CELL_SIZE; y++) + { + int cy = i * ADT_CELL_SIZE + y; + for (int x = 0; x <= ADT_CELL_SIZE; x++) + { + int cx = j * ADT_CELL_SIZE + x; + liquid_height[cy][cx] = liquid->liquid[y][x].height; + } + } + } + } + // Get liquid map for grid (in WOTLK used MH2O chunk) adt_MH2O * h2o = adt.a_grid->getMH2O(); if (h2o) { - for (int i=0;i<ADT_CELLS_PER_GRID;i++) + for (int i = 0; i < ADT_CELLS_PER_GRID; i++) { - for(int j=0;j<ADT_CELLS_PER_GRID;j++) + for(int j = 0; j < ADT_CELLS_PER_GRID; j++) { adt_liquid_header *h = h2o->getLiquidData(i,j); if (!h) @@ -677,111 +741,58 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32 int count = 0; uint64 show = h2o->getLiquidShowMap(h); - for (int y=0; y < h->height;y++) + for (int y = 0; y < h->height; y++) { - int cy = i*ADT_CELL_SIZE + y + h->yOffset; - for (int x=0; x < h->width; x++) + int cy = i * ADT_CELL_SIZE + y + h->yOffset; + for (int x = 0; x < h->width; x++) { - int cx = j*ADT_CELL_SIZE + x + h->xOffset; + int cx = j * ADT_CELL_SIZE + x + h->xOffset; if (show & 1) { liquid_show[cy][cx] = true; ++count; } - show>>=1; + show >>= 1; } } - uint32 type = LiqType[h->liquidType]; - switch (type) + liquid_entry[i][j] = h->liquidType; + switch (LiqType[h->liquidType]) { - case LIQUID_TYPE_WATER: liquid_type[i][j] |= MAP_LIQUID_TYPE_WATER; break; - case LIQUID_TYPE_OCEAN: liquid_type[i][j] |= MAP_LIQUID_TYPE_OCEAN; break; - case LIQUID_TYPE_MAGMA: liquid_type[i][j] |= MAP_LIQUID_TYPE_MAGMA; break; - case LIQUID_TYPE_SLIME: liquid_type[i][j] |= MAP_LIQUID_TYPE_SLIME; break; + case LIQUID_TYPE_WATER: liquid_flags[i][j] |= MAP_LIQUID_TYPE_WATER; break; + case LIQUID_TYPE_OCEAN: liquid_flags[i][j] |= MAP_LIQUID_TYPE_OCEAN; break; + case LIQUID_TYPE_MAGMA: liquid_flags[i][j] |= MAP_LIQUID_TYPE_MAGMA; break; + case LIQUID_TYPE_SLIME: liquid_flags[i][j] |= MAP_LIQUID_TYPE_SLIME; break; default: printf("\nCan't find Liquid type %u for map %s\nchunk %d,%d\n", h->liquidType, filename, i, j); break; } // Dark water detect - if (type == LIQUID_TYPE_OCEAN) + if (LiqType[h->liquidType] == LIQUID_TYPE_OCEAN) { - uint8 *lm = h2o->getLiquidLightMap(h); + uint8* lm = h2o->getLiquidLightMap(h); if (!lm) - liquid_type[i][j]|=MAP_LIQUID_TYPE_DARK_WATER; + liquid_flags[i][j] |= MAP_LIQUID_TYPE_DARK_WATER; } - if (!count && liquid_type[i][j]) + if (!count && liquid_flags[i][j]) printf("Wrong liquid detect in MH2O chunk"); - float *height = h2o->getLiquidHeightMap(h); + float* height = h2o->getLiquidHeightMap(h); int pos = 0; - for (int y=0; y<=h->height;y++) + for (int y = 0; y <= h->height; y++) { - int cy = i*ADT_CELL_SIZE + y + h->yOffset; - for (int x=0; x<= h->width; x++) + int cy = i * ADT_CELL_SIZE + y + h->yOffset; + for (int x = 0; x <= h->width; x++) { - int cx = j*ADT_CELL_SIZE + x + h->xOffset; + int cx = j * ADT_CELL_SIZE + x + h->xOffset; + if (height) liquid_height[cy][cx] = height[pos]; else liquid_height[cy][cx] = h->heightLevel1; - pos++; - } - } - } - } - } - else - { - // Get from MCLQ chunk (old) - for (int i=0;i<ADT_CELLS_PER_GRID;i++) - { - for(int j=0;j<ADT_CELLS_PER_GRID;j++) - { - adt_MCNK *cell = adt.cells[i][j]; - if (!cell) - continue; - - adt_MCLQ *liquid = cell->getMCLQ(); - int count = 0; - if (!liquid || cell->sizeMCLQ <= 8) - continue; - - for (int y=0; y < ADT_CELL_SIZE; y++) - { - int cy = i*ADT_CELL_SIZE + y; - for (int x=0; x < ADT_CELL_SIZE; x++) - { - int cx = j*ADT_CELL_SIZE + x; - if (liquid->flags[y][x] != 0x0F) - { - liquid_show[cy][cx] = true; - if (liquid->flags[y][x]&(1<<7)) - liquid_type[i][j]|=MAP_LIQUID_TYPE_DARK_WATER; - ++count; - } - } - } - - uint32 c_flag = cell->flags; - if(c_flag & (1<<2)) - liquid_type[i][j]|=MAP_LIQUID_TYPE_WATER; // water - if(c_flag & (1<<3)) - liquid_type[i][j]|=MAP_LIQUID_TYPE_OCEAN; // ochean - if(c_flag & (1<<4)) - liquid_type[i][j]|=MAP_LIQUID_TYPE_MAGMA; // magma/slime - if (!count && liquid_type[i][j]) - printf("Wrong liquid detect in MCLQ chunk"); - - for (int y=0; y <= ADT_CELL_SIZE; y++) - { - int cy = i*ADT_CELL_SIZE + y; - for (int x=0; x<= ADT_CELL_SIZE; x++) - { - int cx = j*ADT_CELL_SIZE + x; - liquid_height[cy][cx] = liquid->liquid[y][x].height; + pos++; } } } @@ -791,13 +802,13 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32 //============================================ // Pack liquid data //============================================ - uint8 type = liquid_type[0][0]; + uint8 type = liquid_flags[0][0]; bool fullType = false; - for (int y=0;y<ADT_CELLS_PER_GRID;y++) + for (int y = 0; y < ADT_CELLS_PER_GRID; y++) { - for(int x=0;x<ADT_CELLS_PER_GRID;x++) + for (int x = 0; x < ADT_CELLS_PER_GRID; x++) { - if (liquid_type[y][x]!=type) + if (liquid_flags[y][x] != type) { fullType = true; y = ADT_CELLS_PER_GRID; @@ -846,8 +857,8 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32 liquidHeader.liquidType = 0; liquidHeader.offsetX = minX; liquidHeader.offsetY = minY; - liquidHeader.width = maxX - minX + 1; - liquidHeader.height = maxY - minY + 1; + liquidHeader.width = maxX - minX + 1 + 1; + liquidHeader.height = maxY - minY + 1 + 1; liquidHeader.liquidLevel = minHeight; if (maxHeight == minHeight) @@ -863,7 +874,7 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32 if (liquidHeader.flags & MAP_LIQUID_NO_TYPE) liquidHeader.liquidType = type; else - map.liquidMapSize+=sizeof(liquid_type); + map.liquidMapSize += sizeof(liquid_entry) + sizeof(liquid_flags); if (!(liquidHeader.flags & MAP_LIQUID_NO_HEIGHT)) map.liquidMapSize += sizeof(float)*liquidHeader.width*liquidHeader.height; @@ -907,12 +918,16 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32 if (map.liquidMapOffset) { fwrite(&liquidHeader, sizeof(liquidHeader), 1, output); - if (!(liquidHeader.flags&MAP_LIQUID_NO_TYPE)) - fwrite(liquid_type, sizeof(liquid_type), 1, output); - if (!(liquidHeader.flags&MAP_LIQUID_NO_HEIGHT)) + if (!(liquidHeader.flags & MAP_LIQUID_NO_TYPE)) + { + fwrite(liquid_entry, sizeof(liquid_entry), 1, output); + fwrite(liquid_flags, sizeof(liquid_flags), 1, output); + } + + if (!(liquidHeader.flags & MAP_LIQUID_NO_HEIGHT)) { - for (int y=0; y<liquidHeader.height;y++) - fwrite(&liquid_height[y+liquidHeader.offsetY][liquidHeader.offsetX], sizeof(float), liquidHeader.width, output); + for (int y = 0; y < liquidHeader.height; y++) + fwrite(&liquid_height[y + liquidHeader.offsetY][liquidHeader.offsetX], sizeof(float), liquidHeader.width, output); } } fclose(output); diff --git a/src/tools/vmap4_extractor/model.cpp b/src/tools/vmap4_extractor/model.cpp index ac28e1ff086..e81972f521f 100644 --- a/src/tools/vmap4_extractor/model.cpp +++ b/src/tools/vmap4_extractor/model.cpp @@ -167,7 +167,7 @@ ModelInstance::ModelInstance(MPQFile &f,const char* ModelInstName, uint32 mapID, uint16 adtId = 0;// not used for models uint32 flags = MOD_M2; - if(tileX == 65 && tileY == 65) flags |= MOD_WORLDSPAWN; + if(tileX == 65 && tileY == 65) flags |= MOD_WORLDSPAWN; //write mapID, tileX, tileY, Flags, ID, Pos, Rot, Scale, name fwrite(&mapID, sizeof(uint32), 1, pDirfile); fwrite(&tileX, sizeof(uint32), 1, pDirfile); diff --git a/src/tools/vmap4_extractor/mpq_libmpq04.h b/src/tools/vmap4_extractor/mpq_libmpq04.h index 56a6b787dcd..5101309002e 100644 --- a/src/tools/vmap4_extractor/mpq_libmpq04.h +++ b/src/tools/vmap4_extractor/mpq_libmpq04.h @@ -23,14 +23,14 @@ public: void close(); void GetFileListTo(vector<string>& filelist) { - uint32 filenum; - if(libmpq__file_number(mpq_a, "(listfile)", &filenum)) return; - libmpq__off_t size, transferred; - libmpq__file_unpacked_size(mpq_a, filenum, &size); + uint32 filenum; + if(libmpq__file_number(mpq_a, "(listfile)", &filenum)) return; + libmpq__off_t size, transferred; + libmpq__file_unpacked_size(mpq_a, filenum, &size); char *buffer = new char[size]; - libmpq__file_read(mpq_a, filenum, (unsigned char*)buffer, size, &transferred); + libmpq__file_read(mpq_a, filenum, (unsigned char*)buffer, size, &transferred); char seps[] = "\n"; char *token; diff --git a/src/tools/vmap4_extractor/vmapexport.cpp b/src/tools/vmap4_extractor/vmapexport.cpp index 599290a9254..e60a773c6de 100644 --- a/src/tools/vmap4_extractor/vmapexport.cpp +++ b/src/tools/vmap4_extractor/vmapexport.cpp @@ -76,7 +76,7 @@ bool preciseVectorData = false; //static const char * szWorkDirMaps = ".\\Maps"; const char* szWorkDirWmo = "./Buildings"; -const char* szRawVMAPMagic = "VMAP004"; +const char* szRawVMAPMagic = "VMAP041"; // Local testing functions @@ -261,20 +261,7 @@ void ParsMapFiles() void getGamePath() { #ifdef _WIN32 - HKEY key; - DWORD t,s; - LONG l; - s = sizeof(input_path); - memset(input_path,0,s); - l = RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\\Blizzard Entertainment\\World of Warcraft",0,KEY_QUERY_VALUE,&key); - //l = RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\\Blizzard Entertainment\\Burning Crusade Closed Beta",0,KEY_QUERY_VALUE,&key); - l = RegQueryValueEx(key,"InstallPath",0,&t,(LPBYTE)input_path,&s); - RegCloseKey(key); - if (strlen(input_path) > 0) - { - if (input_path[strlen(input_path) - 1] != '\\') strcat(input_path, "\\"); - } - strcat(input_path,"Data\\"); + strcpy(input_path,"Data\\"); #else strcpy(input_path,"Data/"); #endif diff --git a/src/tools/vmap4_extractor/vmapexport.h b/src/tools/vmap4_extractor/vmapexport.h index b407e7a106e..0381011efb7 100644 --- a/src/tools/vmap4_extractor/vmapexport.h +++ b/src/tools/vmap4_extractor/vmapexport.h @@ -23,8 +23,8 @@ enum ModelFlags { - MOD_M2 = 1, - MOD_WORLDSPAWN = 1<<1, + MOD_M2 = 1, + MOD_WORLDSPAWN = 1<<1, MOD_HAS_BOUND = 1<<2 }; diff --git a/src/tools/vmap4_extractor/wmo.cpp b/src/tools/vmap4_extractor/wmo.cpp index 58957e007c1..6703872111b 100644 --- a/src/tools/vmap4_extractor/wmo.cpp +++ b/src/tools/vmap4_extractor/wmo.cpp @@ -404,11 +404,53 @@ int WMOGroup::ConvertToVMAPGroupWmo(FILE *output, WMORoot *rootWMO, bool pPrecis if (rootWMO->liquidType & 4) liquidEntry = liquidType; else if (liquidType == 15) - liquidEntry = 1; // first entry, generic "Water" + liquidEntry = 0; else liquidEntry = liquidType + 1; - // overwrite material type in header... - hlq->type = LiqType[liquidEntry]; + + if (!liquidEntry) + { + int v1; // edx@1 + int v2; // eax@1 + + v1 = hlq->xtiles * hlq->ytiles; + v2 = 0; + if (v1 > 0) + { + while ((LiquBytes[v2] & 0xF) == 15) + { + ++v2; + if (v2 >= v1) + break; + } + + if (v2 < v1 && (LiquBytes[v2] & 0xF) != 15) + liquidEntry = (LiquBytes[v2] & 0xF) + 1; + } + } + + if (liquidEntry && liquidEntry < 21) + { + switch (((uint8)liquidEntry - 1) & 3) + { + case 0: + liquidEntry = ((mogpFlags & 0x80000) != 0) + 13; + break; + case 1: + liquidEntry = 14; + break; + case 2: + liquidEntry = 19; + break; + case 3: + liquidEntry = 20; + break; + default: + break; + } + } + + hlq->type = liquidEntry; /* std::ofstream llog("Buildings/liquid.log", ios_base::out | ios_base::app); llog << filename; |