diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Battlegrounds/Battleground.h | 44 | ||||
-rw-r--r-- | src/server/game/Entities/GameObject/GameObject.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Entities/Item/Item.cpp | 4 | ||||
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 33 | ||||
-rw-r--r-- | src/server/game/Entities/Player/Player.h | 3 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/Unit.h | 3 | ||||
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 32 | ||||
-rw-r--r-- | src/server/game/Globals/ObjectMgr.h | 18 | ||||
-rw-r--r-- | src/server/game/Handlers/QuestHandler.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Miscellaneous/Language.h | 4 | ||||
-rw-r--r-- | src/server/game/Miscellaneous/SharedDefines.h | 3 | ||||
-rw-r--r-- | src/server/game/Spells/SpellMgr.cpp | 2 | ||||
-rw-r--r-- | src/server/game/World/World.cpp | 4 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_npc.cpp | 104 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_reload.cpp | 44 | ||||
-rw-r--r-- | src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp | 8 | ||||
-rw-r--r-- | src/server/scripts/World/achievement_scripts.cpp | 14 |
17 files changed, 252 insertions, 72 deletions
diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h index 52f86b98b79..dcca0804977 100644 --- a/src/server/game/Battlegrounds/Battleground.h +++ b/src/server/game/Battlegrounds/Battleground.h @@ -29,6 +29,17 @@ class Group; class Player; class WorldPacket; class BattlegroundMap; +class BattlegroundAV; +class BattlegroundWS; +class BattlegroundAB; +class BattlegroundNA; +class BattlegroundBE; +class BattlegroundEY; +class BattlegroundRL; +class BattlegroundSA; +class BattlegroundDS; +class BattlegroundRV; +class BattlegroundIC; struct PvPDifficultyEntry; struct WorldSafeLocsEntry; @@ -534,6 +545,39 @@ class Battleground virtual uint32 GetPrematureWinner(); + BattlegroundAV* ToBattlegroundAV() { if (GetTypeID() == BATTLEGROUND_AV) return reinterpret_cast<BattlegroundAV*>(this); else return NULL; } + BattlegroundAV const* ToBattlegroundAV() const { if (GetTypeID() == BATTLEGROUND_AV) return reinterpret_cast<const BattlegroundAV*>(this); else return NULL; } + + BattlegroundWS* ToBattlegroundWS() { if (GetTypeID() == BATTLEGROUND_WS) return reinterpret_cast<BattlegroundWS*>(this); else return NULL; } + BattlegroundWS const* ToBattlegroundWS() const { if (GetTypeID() == BATTLEGROUND_WS) return reinterpret_cast<const BattlegroundWS*>(this); else return NULL; } + + BattlegroundAB* ToBattlegroundAB() { if (GetTypeID() == BATTLEGROUND_AB) return reinterpret_cast<BattlegroundAB*>(this); else return NULL; } + BattlegroundAB const* ToBattlegroundAB() const { if (GetTypeID() == BATTLEGROUND_AB) return reinterpret_cast<const BattlegroundAB*>(this); else return NULL; } + + BattlegroundNA* ToBattlegroundNA() { if (GetTypeID() == BATTLEGROUND_NA) return reinterpret_cast<BattlegroundNA*>(this); else return NULL; } + BattlegroundNA const* ToBattlegroundNA() const { if (GetTypeID() == BATTLEGROUND_NA) return reinterpret_cast<const BattlegroundNA*>(this); else return NULL; } + + BattlegroundBE* ToBattlegroundBE() { if (GetTypeID() == BATTLEGROUND_BE) return reinterpret_cast<BattlegroundBE*>(this); else return NULL; } + BattlegroundBE const* ToBattlegroundBE() const { if (GetTypeID() == BATTLEGROUND_BE) return reinterpret_cast<const BattlegroundBE*>(this); else return NULL; } + + BattlegroundEY* ToBattlegroundEY() { if (GetTypeID() == BATTLEGROUND_EY) return reinterpret_cast<BattlegroundEY*>(this); else return NULL; } + BattlegroundEY const* ToBattlegroundEY() const { if (GetTypeID() == BATTLEGROUND_EY) return reinterpret_cast<const BattlegroundEY*>(this); else return NULL; } + + BattlegroundRL* ToBattlegroundRL() { if (GetTypeID() == BATTLEGROUND_RL) return reinterpret_cast<BattlegroundRL*>(this); else return NULL; } + BattlegroundRL const* ToBattlegroundRL() const { if (GetTypeID() == BATTLEGROUND_RL) return reinterpret_cast<const BattlegroundRL*>(this); else return NULL; } + + BattlegroundSA* ToBattlegroundSA() { if (GetTypeID() == BATTLEGROUND_SA) return reinterpret_cast<BattlegroundSA*>(this); else return NULL; } + BattlegroundSA const* ToBattlegroundSA() const { if (GetTypeID() == BATTLEGROUND_SA) return reinterpret_cast<const BattlegroundSA*>(this); else return NULL; } + + BattlegroundDS* ToBattlegroundDS() { if (GetTypeID() == BATTLEGROUND_DS) return reinterpret_cast<BattlegroundDS*>(this); else return NULL; } + BattlegroundDS const* ToBattlegroundDS() const { if (GetTypeID() == BATTLEGROUND_DS) return reinterpret_cast<const BattlegroundDS*>(this); else return NULL; } + + BattlegroundRV* ToBattlegroundRV() { if (GetTypeID() == BATTLEGROUND_RV) return reinterpret_cast<BattlegroundRV*>(this); else return NULL; } + BattlegroundRV const* ToBattlegroundRV() const { if (GetTypeID() == BATTLEGROUND_RV) return reinterpret_cast<const BattlegroundRV*>(this); else return NULL; } + + BattlegroundIC* ToBattlegroundIC() { if (GetTypeID() == BATTLEGROUND_IC) return reinterpret_cast<BattlegroundIC*>(this); else return NULL; } + BattlegroundIC const* ToBattlegroundIC() const { if (GetTypeID() == BATTLEGROUND_IC) return reinterpret_cast<const BattlegroundIC*>(this); else return NULL; } + protected: // this method is called, when BG cannot spawn its own spirit guide, or something is wrong, It correctly ends Battleground void EndNow(); diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 0915d19cdfa..31e625ae3e1 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -952,7 +952,7 @@ bool GameObject::ActivateToQuest(Player* target) const //look for battlegroundAV for some objects which are only activated after mine gots captured by own team if (GetEntry() == BG_AV_OBJECTID_MINE_N || GetEntry() == BG_AV_OBJECTID_MINE_S) if (Battleground* bg = target->GetBattleground()) - if (bg->GetTypeID(true) == BATTLEGROUND_AV && !(((BattlegroundAV*)bg)->PlayerCanDoMineQuest(GetEntry(), target->GetTeam()))) + if (bg->GetTypeID(true) == BATTLEGROUND_AV && !bg->ToBattlegroundAV()->PlayerCanDoMineQuest(GetEntry(), target->GetTeam())) return false; return true; } diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index d87e1e8fbbc..ed4341dea8a 100644 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -1278,7 +1278,7 @@ void Item::ItemContainerSaveLootToDB() stmt_items->setBool(6, _li->is_counted); stmt_items->setBool(7, _li->is_underthreshold); stmt_items->setBool(8, _li->needs_quest); - stmt_items->setUInt32(9, _li->randomPropertyId); + stmt_items->setInt32(9, _li->randomPropertyId); stmt_items->setUInt32(10, _li->randomSuffix); trans->Append(stmt_items); } @@ -1339,7 +1339,7 @@ bool Item::ItemContainerLoadLootFromDB() loot_item.canSave = true; loot_item.is_underthreshold = fields[6].GetBool(); loot_item.needs_quest = fields[7].GetBool(); - loot_item.randomPropertyId = fields[8].GetUInt32(); + loot_item.randomPropertyId = fields[8].GetInt32(); loot_item.randomSuffix = fields[9].GetUInt32(); // Copy the extra loot conditions from the item in the loot template diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 37f9b0c4b21..ac8b7d92f21 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -8773,13 +8773,19 @@ void Player::SendLoot(uint64 guid, LootType loot_type) /// @todo fix this big hack if ((go->GetEntry() == BG_AV_OBJECTID_MINE_N || go->GetEntry() == BG_AV_OBJECTID_MINE_S)) + { if (Battleground* bg = GetBattleground()) + { if (bg->GetTypeID(true) == BATTLEGROUND_AV) - if (!(((BattlegroundAV*)bg)->PlayerCanDoMineQuest(go->GetEntry(), GetTeam()))) + { + if (!bg->ToBattlegroundAV()->PlayerCanDoMineQuest(go->GetEntry(), GetTeam())) { SendLootRelease(guid); return; } + } + } + } if (lootid) { @@ -26266,6 +26272,31 @@ float Player::GetCollisionHeight(bool mounted) const } } +std::string Player::GetMapAreaAndZoneString() +{ + uint32 areaId = GetAreaId(); + std::string areaName = "Unknown"; + std::string zoneName = "Unknown"; + if (AreaTableEntry const* area = GetAreaEntryByAreaID(areaId)) + { + int locale = GetSession()->GetSessionDbcLocale(); + areaName = area->area_name[locale]; + if (AreaTableEntry const* zone = GetAreaEntryByAreaID(area->zone)) + zoneName = zone->area_name[locale]; + } + + std::ostringstream str; + str << "Map: " << GetMapId() << " (" << (FindMap() ? FindMap()->GetMapName() : "Unknown") << ") Area: " << areaId << " (" << areaName.c_str() << ") Zone: " << zoneName.c_str(); + return str.str(); +} + +std::string Player::GetCoordsMapAreaAndZoneString() +{ + std::ostringstream str; + str << Position::ToString() << " " << GetMapAreaAndZoneString(); + return str.str(); +} + Guild* Player::GetGuild() { uint32 guildId = GetGuildId(); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 7500755a101..550a48bfe8a 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -2291,6 +2291,9 @@ class Player : public Unit, public GridObject<Player> //! Return collision height sent to client float GetCollisionHeight(bool mounted) const; + std::string GetMapAreaAndZoneString(); + std::string GetCoordsMapAreaAndZoneString(); + protected: // Gamemaster whisper whitelist WhisperListContainer WhisperList; diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 8a1eb78250b..56f4e7142a2 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -628,7 +628,8 @@ enum UnitFlags UNIT_FLAG_UNK_28 = 0x10000000, UNIT_FLAG_UNK_29 = 0x20000000, // used in Feing Death spell UNIT_FLAG_SHEATHE = 0x40000000, - UNIT_FLAG_UNK_31 = 0x80000000 + UNIT_FLAG_UNK_31 = 0x80000000, + MAX_UNIT_FLAGS = 33 }; // Value masks for UNIT_FIELD_FLAGS_2 diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 33003de4e6d..88a8664e8a4 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -7212,59 +7212,59 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string const& TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest relations from %s in %u ms", count, table.c_str(), GetMSTimeDiffToNow(oldMSTime)); } -void ObjectMgr::LoadGameobjectQuestRelations() +void ObjectMgr::LoadGameobjectQuestStarters() { - LoadQuestRelationsHelper(_goQuestRelations, "gameobject_questrelation", true, true); + LoadQuestRelationsHelper(_goQuestRelations, "gameobject_queststarter", true, true); for (QuestRelations::iterator itr = _goQuestRelations.begin(); itr != _goQuestRelations.end(); ++itr) { GameObjectTemplate const* goInfo = GetGameObjectTemplate(itr->first); if (!goInfo) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `gameobject_questrelation` have data for not existed gameobject entry (%u) and existed quest %u", itr->first, itr->second); + TC_LOG_ERROR(LOG_FILTER_SQL, "Table `gameobject_queststarter` have data for not existed gameobject entry (%u) and existed quest %u", itr->first, itr->second); else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `gameobject_questrelation` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second); + TC_LOG_ERROR(LOG_FILTER_SQL, "Table `gameobject_queststarter` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second); } } -void ObjectMgr::LoadGameobjectInvolvedRelations() +void ObjectMgr::LoadGameobjectQuestEnders() { - LoadQuestRelationsHelper(_goQuestInvolvedRelations, "gameobject_involvedrelation", false, true); + LoadQuestRelationsHelper(_goQuestInvolvedRelations, "gameobject_questender", false, true); for (QuestRelations::iterator itr = _goQuestInvolvedRelations.begin(); itr != _goQuestInvolvedRelations.end(); ++itr) { GameObjectTemplate const* goInfo = GetGameObjectTemplate(itr->first); if (!goInfo) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `gameobject_involvedrelation` have data for not existed gameobject entry (%u) and existed quest %u", itr->first, itr->second); + TC_LOG_ERROR(LOG_FILTER_SQL, "Table `gameobject_questender` have data for not existed gameobject entry (%u) and existed quest %u", itr->first, itr->second); else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `gameobject_involvedrelation` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second); + TC_LOG_ERROR(LOG_FILTER_SQL, "Table `gameobject_questender` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second); } } -void ObjectMgr::LoadCreatureQuestRelations() +void ObjectMgr::LoadCreatureQuestStarters() { - LoadQuestRelationsHelper(_creatureQuestRelations, "creature_questrelation", true, false); + LoadQuestRelationsHelper(_creatureQuestRelations, "creature_queststarter", true, false); for (QuestRelations::iterator itr = _creatureQuestRelations.begin(); itr != _creatureQuestRelations.end(); ++itr) { CreatureTemplate const* cInfo = GetCreatureTemplate(itr->first); if (!cInfo) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature_questrelation` have data for not existed creature entry (%u) and existed quest %u", itr->first, itr->second); + TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature_queststarter` have data for not existed creature entry (%u) and existed quest %u", itr->first, itr->second); else if (!(cInfo->npcflag & UNIT_NPC_FLAG_QUESTGIVER)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature_questrelation` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second); + TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature_queststarter` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second); } } -void ObjectMgr::LoadCreatureInvolvedRelations() +void ObjectMgr::LoadCreatureQuestEnders() { - LoadQuestRelationsHelper(_creatureQuestInvolvedRelations, "creature_involvedrelation", false, false); + LoadQuestRelationsHelper(_creatureQuestInvolvedRelations, "creature_questender", false, false); for (QuestRelations::iterator itr = _creatureQuestInvolvedRelations.begin(); itr != _creatureQuestInvolvedRelations.end(); ++itr) { CreatureTemplate const* cInfo = GetCreatureTemplate(itr->first); if (!cInfo) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature_involvedrelation` have data for not existed creature entry (%u) and existed quest %u", itr->first, itr->second); + TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature_questender` have data for not existed creature entry (%u) and existed quest %u", itr->first, itr->second); else if (!(cInfo->npcflag & UNIT_NPC_FLAG_QUESTGIVER)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature_involvedrelation` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second); + TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature_questender` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second); } } diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index ddabc56fbb6..aad699fe9c1 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -851,21 +851,21 @@ class ObjectMgr } void LoadQuests(); - void LoadQuestRelations() + void LoadQuestStartersAndEnders() { TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading GO Start Quest Data..."); - LoadGameobjectQuestRelations(); + LoadGameobjectQuestStarters(); TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading GO End Quest Data..."); - LoadGameobjectInvolvedRelations(); + LoadGameobjectQuestEnders(); TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Creature Start Quest Data..."); - LoadCreatureQuestRelations(); + LoadCreatureQuestStarters(); TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Creature End Quest Data..."); - LoadCreatureInvolvedRelations(); + LoadCreatureQuestEnders(); } - void LoadGameobjectQuestRelations(); - void LoadGameobjectInvolvedRelations(); - void LoadCreatureQuestRelations(); - void LoadCreatureInvolvedRelations(); + void LoadGameobjectQuestStarters(); + void LoadGameobjectQuestEnders(); + void LoadCreatureQuestStarters(); + void LoadCreatureQuestEnders(); QuestRelations* GetGOQuestRelationMap() { diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp index 6cd999bc496..cee5b3d1164 100644 --- a/src/server/game/Handlers/QuestHandler.cpp +++ b/src/server/game/Handlers/QuestHandler.cpp @@ -530,7 +530,7 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recvData) if (_player->InBattleground()) if (Battleground* bg = _player->GetBattleground()) if (bg->GetTypeID() == BATTLEGROUND_AV) - ((BattlegroundAV*)bg)->HandleQuestComplete(questId, _player); + bg->ToBattlegroundAV()->HandleQuestComplete(questId, _player); if (_player->GetQuestStatus(questId) != QUEST_STATUS_COMPLETE) { diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index 0da63a61b43..772d5bcfb75 100644 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -1083,7 +1083,9 @@ enum TrinityStrings LANG_COMMAND_NO_OUTDOOR_PVP_FORUND = 5034, LANG_CALL_FOR_HELP = 5035, LANG_NPCINFO_EQUIPMENT = 5036, - // Room for more Trinity strings 5037-9999 + LANG_NPCINFO_MECHANIC_IMMUNE = 5037, + LANG_NPCINFO_UNIT_FIELD_FLAGS = 5038, + // Room for more Trinity strings 5039-9999 // Level requirement notifications LANG_SAY_REQ = 6604, diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index 4d5245cffb1..e561d37ed36 100644 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -1233,7 +1233,8 @@ enum Mechanics MECHANIC_DISCOVERY = 28, MECHANIC_IMMUNE_SHIELD = 29, // Divine (Blessing) Shield/Protection and Ice Block MECHANIC_SAPPED = 30, - MECHANIC_ENRAGED = 31 + MECHANIC_ENRAGED = 31, + MAX_MECHANIC = 32 }; // Used for spell 42292 Immune Movement Impairment and Loss of Control (0x49967ca6) diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 42d408ebbad..db0102f4307 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -1136,7 +1136,7 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 uint8 nodeType = spellId == 68719 ? NODE_TYPE_REFINERY : NODE_TYPE_QUARRY; uint8 nodeState = player->GetTeamId() == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H; - BattlegroundIC* pIC = static_cast<BattlegroundIC*>(player->GetBattleground()); + BattlegroundIC* pIC = player->GetBattleground()->ToBattlegroundIC(); if (pIC->GetNodeState(nodeType) == nodeState) return true; diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 159d315e808..410fbee9931 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1460,8 +1460,8 @@ void World::SetInitialWorldSettings() TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Quest POI"); sObjectMgr->LoadQuestPOI(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Quests Relations..."); - sObjectMgr->LoadQuestRelations(); // must be after quest load + TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Quests Starters and Enders..."); + sObjectMgr->LoadQuestStartersAndEnders(); // must be after quest load TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Objects Pooling Data..."); sPoolMgr->LoadFromDB(); diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 939075690c9..f708acc3dee 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -41,7 +41,7 @@ struct NpcFlagText #define NPCFLAG_COUNT 24 -const NpcFlagText npcFlagTexts[NPCFLAG_COUNT] = +NpcFlagText const npcFlagTexts[NPCFLAG_COUNT] = { { UNIT_NPC_FLAG_AUCTIONEER, LANG_NPCINFO_AUCTIONEER }, { UNIT_NPC_FLAG_BANKER, LANG_NPCINFO_BANKER }, @@ -69,6 +69,91 @@ const NpcFlagText npcFlagTexts[NPCFLAG_COUNT] = { UNIT_NPC_FLAG_VENDOR_REAGENT, LANG_NPCINFO_VENDOR_REAGENT } }; +struct MechanicImmune +{ + uint32 flag; + char const* text; +}; + +MechanicImmune const mechanicImmunes[MAX_MECHANIC] = +{ + { MECHANIC_NONE , "MECHANIC_NONE" }, + { MECHANIC_CHARM , "MECHANIC_CHARM" }, + { MECHANIC_DISORIENTED , "MECHANIC_DISORIENTED" }, + { MECHANIC_DISARM , "MECHANIC_DISARM" }, + { MECHANIC_DISTRACT , "MECHANIC_DISTRACT" }, + { MECHANIC_FEAR , "MECHANIC_FEAR" }, + { MECHANIC_GRIP , "MECHANIC_GRIP" }, + { MECHANIC_ROOT , "MECHANIC_ROOT" }, + { MECHANIC_SLOW_ATTACK , "MECHANIC_SLOW_ATTACK" }, + { MECHANIC_SILENCE , "MECHANIC_SILENCE" }, + { MECHANIC_SLEEP , "MECHANIC_SLEEP" }, + { MECHANIC_SNARE , "MECHANIC_SNARE" }, + { MECHANIC_STUN , "MECHANIC_STUN" }, + { MECHANIC_FREEZE , "MECHANIC_FREEZE" }, + { MECHANIC_KNOCKOUT , "MECHANIC_KNOCKOUT" }, + { MECHANIC_BLEED , "MECHANIC_BLEED" }, + { MECHANIC_BANDAGE , "MECHANIC_BANDAGE" }, + { MECHANIC_POLYMORPH , "MECHANIC_POLYMORPH" }, + { MECHANIC_BANISH , "MECHANIC_BANISH" }, + { MECHANIC_SHIELD , "MECHANIC_SHIELD" }, + { MECHANIC_SHACKLE , "MECHANIC_SHACKLE" }, + { MECHANIC_MOUNT , "MECHANIC_MOUNT" }, + { MECHANIC_INFECTED , "MECHANIC_INFECTED" }, + { MECHANIC_TURN , "MECHANIC_TURN" }, + { MECHANIC_HORROR , "MECHANIC_HORROR" }, + { MECHANIC_INVULNERABILITY , "MECHANIC_INVULNERABILITY" }, + { MECHANIC_INTERRUPT , "MECHANIC_INTERRUPT" }, + { MECHANIC_DAZE , "MECHANIC_DAZE" }, + { MECHANIC_DISCOVERY , "MECHANIC_DISCOVERY" }, + { MECHANIC_IMMUNE_SHIELD , "MECHANIC_IMMUNE_SHIELD" }, + { MECHANIC_SAPPED , "MECHANIC_SAPPED" }, + { MECHANIC_ENRAGED , "MECHANIC_ENRAGED" } +}; + + +struct UnitFlag +{ + uint32 flag; + char const* text; +}; + +UnitFlag const unitFlags[MAX_UNIT_FLAGS] = +{ + { UNIT_FLAG_SERVER_CONTROLLED , "UNIT_FLAG_SERVER_CONTROLLED" }, + { UNIT_FLAG_NON_ATTACKABLE , "UNIT_FLAG_NON_ATTACKABLE" }, + { UNIT_FLAG_DISABLE_MOVE , "UNIT_FLAG_DISABLE_MOVE" }, + { UNIT_FLAG_PVP_ATTACKABLE , "UNIT_FLAG_PVP_ATTACKABLE" }, + { UNIT_FLAG_RENAME , "UNIT_FLAG_RENAME" }, + { UNIT_FLAG_PREPARATION , "UNIT_FLAG_PREPARATION" }, + { UNIT_FLAG_UNK_6 , "UNIT_FLAG_UNK_6" }, + { UNIT_FLAG_NOT_ATTACKABLE_1 , "UNIT_FLAG_NOT_ATTACKABLE_1" }, + { UNIT_FLAG_IMMUNE_TO_PC , "UNIT_FLAG_IMMUNE_TO_PC" }, + { UNIT_FLAG_IMMUNE_TO_NPC , "UNIT_FLAG_IMMUNE_TO_NPC" }, + { UNIT_FLAG_LOOTING , "UNIT_FLAG_LOOTING" }, + { UNIT_FLAG_PET_IN_COMBAT , "UNIT_FLAG_PET_IN_COMBAT" }, + { UNIT_FLAG_PVP , "UNIT_FLAG_PVP" }, + { UNIT_FLAG_SILENCED , "UNIT_FLAG_SILENCED" }, + { UNIT_FLAG_UNK_14 , "UNIT_FLAG_UNK_14" }, + { UNIT_FLAG_UNK_15 , "UNIT_FLAG_UNK_15" }, + { UNIT_FLAG_UNK_16 , "UNIT_FLAG_UNK_16" }, + { UNIT_FLAG_PACIFIED , "UNIT_FLAG_PACIFIED" }, + { UNIT_FLAG_STUNNED , "UNIT_FLAG_STUNNED" }, + { UNIT_FLAG_IN_COMBAT , "UNIT_FLAG_IN_COMBAT" }, + { UNIT_FLAG_TAXI_FLIGHT , "UNIT_FLAG_TAXI_FLIGHT" }, + { UNIT_FLAG_DISARMED , "UNIT_FLAG_DISARMED" }, + { UNIT_FLAG_CONFUSED , "UNIT_FLAG_CONFUSED" }, + { UNIT_FLAG_FLEEING , "UNIT_FLAG_FLEEING" }, + { UNIT_FLAG_PLAYER_CONTROLLED , "UNIT_FLAG_PLAYER_CONTROLLED" }, + { UNIT_FLAG_NOT_SELECTABLE , "UNIT_FLAG_NOT_SELECTABLE" }, + { UNIT_FLAG_SKINNABLE , "UNIT_FLAG_SKINNABLE" }, + { UNIT_FLAG_MOUNT , "UNIT_FLAG_MOUNT" }, + { UNIT_FLAG_UNK_28 , "UNIT_FLAG_UNK_28" }, + { UNIT_FLAG_UNK_29 , "UNIT_FLAG_UNK_29" }, + { UNIT_FLAG_SHEATHE , "UNIT_FLAG_SHEATHE" }, + { UNIT_FLAG_UNK_31 , "UNIT_FLAG_UNK_31" } +}; + class npc_commandscript : public CommandScript { public: @@ -630,12 +715,14 @@ public: return false; } + CreatureTemplate const* cInfo = target->GetCreatureTemplate(); + uint32 faction = target->getFaction(); uint32 npcflags = target->GetUInt32Value(UNIT_NPC_FLAGS); + uint32 mechanicImmuneMask = cInfo->MechanicImmuneMask; uint32 displayid = target->GetDisplayId(); uint32 nativeid = target->GetNativeDisplayId(); uint32 Entry = target->GetEntry(); - CreatureTemplate const* cInfo = target->GetCreatureTemplate(); int64 curRespawnDelay = target->GetRespawnTimeEx()-time(NULL); if (curRespawnDelay < 0) @@ -647,7 +734,13 @@ public: handler->PSendSysMessage(LANG_NPCINFO_LEVEL, target->getLevel()); handler->PSendSysMessage(LANG_NPCINFO_EQUIPMENT, target->GetCurrentEquipmentId(), target->GetOriginalEquipmentId()); handler->PSendSysMessage(LANG_NPCINFO_HEALTH, target->GetCreateHealth(), target->GetMaxHealth(), target->GetHealth()); - handler->PSendSysMessage(LANG_NPCINFO_FLAGS, target->GetUInt32Value(UNIT_FIELD_FLAGS), target->GetUInt32Value(UNIT_FIELD_FLAGS_2), target->GetUInt32Value(UNIT_DYNAMIC_FLAGS), target->getFaction()); + + handler->PSendSysMessage(LANG_NPCINFO_UNIT_FIELD_FLAGS, target->GetUInt32Value(UNIT_FIELD_FLAGS)); + for (uint8 i = 0; i < MAX_UNIT_FLAGS; ++i) + if (target->GetUInt32Value(UNIT_FIELD_FLAGS) & unitFlags[i].flag) + handler->PSendSysMessage(unitFlags[i].text, unitFlags[i].flag); + + handler->PSendSysMessage(LANG_NPCINFO_FLAGS, target->GetUInt32Value(UNIT_FIELD_FLAGS_2), target->GetUInt32Value(UNIT_DYNAMIC_FLAGS), target->getFaction()); handler->PSendSysMessage(LANG_COMMAND_RAWPAWNTIMES, defRespawnDelayStr.c_str(), curRespawnDelayStr.c_str()); handler->PSendSysMessage(LANG_NPCINFO_LOOT, cInfo->lootid, cInfo->pickpocketLootId, cInfo->SkinLootId); handler->PSendSysMessage(LANG_NPCINFO_DUNGEON_ID, target->GetInstanceId()); @@ -660,6 +753,11 @@ public: if (npcflags & npcFlagTexts[i].flag) handler->PSendSysMessage(npcFlagTexts[i].text, npcFlagTexts[i].flag); + handler->PSendSysMessage(LANG_NPCINFO_MECHANIC_IMMUNE, mechanicImmuneMask); + for (uint8 i = 0; i < MAX_MECHANIC; ++i) + if ((mechanicImmuneMask << 1) & mechanicImmunes[i].flag) + handler->PSendSysMessage(mechanicImmunes[i].text, mechanicImmunes[i].flag); + return true; } diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp index 5351f3edda0..829152b7fa7 100644 --- a/src/server/scripts/Commands/cs_reload.cpp +++ b/src/server/scripts/Commands/cs_reload.cpp @@ -82,11 +82,11 @@ public: { "creature_text", SEC_ADMINISTRATOR, true, &HandleReloadCreatureText, "", NULL }, { "creature_ai_scripts", SEC_ADMINISTRATOR, true, &HandleReloadEventAIScriptsCommand, "", NULL }, { "creature_ai_texts", SEC_ADMINISTRATOR, true, &HandleReloadEventAITextsCommand, "", NULL }, - { "creature_involvedrelation", SEC_ADMINISTRATOR, true, &HandleReloadCreatureQuestInvRelationsCommand, "", NULL }, + { "creature_questender", SEC_ADMINISTRATOR, true, &HandleReloadCreatureQuestEnderCommand, "", NULL }, { "creature_linked_respawn", SEC_GAMEMASTER, true, &HandleReloadLinkedRespawnCommand, "", NULL }, { "creature_loot_template", SEC_ADMINISTRATOR, true, &HandleReloadLootTemplatesCreatureCommand, "", NULL }, { "creature_onkill_reputation", SEC_ADMINISTRATOR, true, &HandleReloadOnKillReputationCommand, "", NULL }, - { "creature_questrelation", SEC_ADMINISTRATOR, true, &HandleReloadCreatureQuestRelationsCommand, "", NULL }, + { "creature_queststarter", SEC_ADMINISTRATOR, true, &HandleReloadCreatureQuestStarterCommand, "", NULL }, { "creature_summon_groups", SEC_ADMINISTRATOR, true, &HandleReloadCreatureSummonGroupsCommand, "", NULL }, { "creature_template", SEC_ADMINISTRATOR, true, &HandleReloadCreatureTemplateCommand, "", NULL }, //{ "db_script_string", SEC_ADMINISTRATOR, true, &HandleReloadDbScriptStringCommand, "", NULL }, @@ -96,9 +96,9 @@ public: { "fishing_loot_template", SEC_ADMINISTRATOR, true, &HandleReloadLootTemplatesFishingCommand, "", NULL }, { "game_graveyard_zone", SEC_ADMINISTRATOR, true, &HandleReloadGameGraveyardZoneCommand, "", NULL }, { "game_tele", SEC_ADMINISTRATOR, true, &HandleReloadGameTeleCommand, "", NULL }, - { "gameobject_involvedrelation", SEC_ADMINISTRATOR, true, &HandleReloadGOQuestInvRelationsCommand, "", NULL }, + { "gameobject_questender", SEC_ADMINISTRATOR, true, &HandleReloadGOQuestEnderCommand, "", NULL }, { "gameobject_loot_template", SEC_ADMINISTRATOR, true, &HandleReloadLootTemplatesGameobjectCommand, "", NULL }, - { "gameobject_questrelation", SEC_ADMINISTRATOR, true, &HandleReloadGOQuestRelationsCommand, "", NULL }, + { "gameobject_queststarter", SEC_ADMINISTRATOR, true, &HandleReloadGOQuestStarterCommand, "", NULL }, { "gm_tickets", SEC_ADMINISTRATOR, true, &HandleReloadGMTicketsCommand, "", NULL }, { "gossip_menu", SEC_ADMINISTRATOR, true, &HandleReloadGossipMenuCommand, "", NULL }, { "gossip_menu_option", SEC_ADMINISTRATOR, true, &HandleReloadGossipMenuOptionCommand, "", NULL }, @@ -249,8 +249,8 @@ public: HandleReloadQuestTemplateCommand(handler, "a"); TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Quests Relations..."); - sObjectMgr->LoadQuestRelations(); - handler->SendGlobalGMSysMessage("DB tables `*_questrelation` and `*_involvedrelation` reloaded."); + sObjectMgr->LoadQuestStartersAndEnders(); + handler->SendGlobalGMSysMessage("DB tables `*_queststarter` and `*_questender` reloaded."); return true; } @@ -532,11 +532,11 @@ public: return true; } - static bool HandleReloadCreatureQuestRelationsCommand(ChatHandler* handler, const char* /*args*/) + static bool HandleReloadCreatureQuestStarterCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Loading Quests Relations... (`creature_questrelation`)"); - sObjectMgr->LoadCreatureQuestRelations(); - handler->SendGlobalGMSysMessage("DB table `creature_questrelation` (creature quest givers) reloaded."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Loading Quests Relations... (`creature_queststarter`)"); + sObjectMgr->LoadCreatureQuestStarters(); + handler->SendGlobalGMSysMessage("DB table `creature_queststarter` reloaded."); return true; } @@ -548,11 +548,11 @@ public: return true; } - static bool HandleReloadCreatureQuestInvRelationsCommand(ChatHandler* handler, const char* /*args*/) + static bool HandleReloadCreatureQuestEnderCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Loading Quests Relations... (`creature_involvedrelation`)"); - sObjectMgr->LoadCreatureInvolvedRelations(); - handler->SendGlobalGMSysMessage("DB table `creature_involvedrelation` (creature quest takers) reloaded."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Loading Quests Relations... (`creature_questender`)"); + sObjectMgr->LoadCreatureQuestEnders(); + handler->SendGlobalGMSysMessage("DB table `creature_questender` reloaded."); return true; } @@ -574,19 +574,19 @@ public: return true; } - static bool HandleReloadGOQuestRelationsCommand(ChatHandler* handler, const char* /*args*/) + static bool HandleReloadGOQuestStarterCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Loading Quests Relations... (`gameobject_questrelation`)"); - sObjectMgr->LoadGameobjectQuestRelations(); - handler->SendGlobalGMSysMessage("DB table `gameobject_questrelation` (gameobject quest givers) reloaded."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Loading Quests Relations... (`gameobject_queststarter`)"); + sObjectMgr->LoadGameobjectQuestStarters(); + handler->SendGlobalGMSysMessage("DB table `gameobject_queststarter` reloaded."); return true; } - static bool HandleReloadGOQuestInvRelationsCommand(ChatHandler* handler, const char* /*args*/) + static bool HandleReloadGOQuestEnderCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Loading Quests Relations... (`gameobject_involvedrelation`)"); - sObjectMgr->LoadGameobjectInvolvedRelations(); - handler->SendGlobalGMSysMessage("DB table `gameobject_involvedrelation` (gameobject quest takers) reloaded."); + TC_LOG_INFO(LOG_FILTER_GENERAL, "Loading Quests Relations... (`gameobject_questender`)"); + sObjectMgr->LoadGameobjectQuestEnders(); + handler->SendGlobalGMSysMessage("DB table `gameobject_questender` reloaded."); return true; } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp index e6969d1f519..fd15cd19b37 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp @@ -535,13 +535,13 @@ class spell_oculus_touch_the_nightmare : public SpellScriptLoader SetHitDamage(int32(GetCaster()->CountPctFromMaxHealth(30))); } - void Register() + void Register() OVERRIDE { OnEffectHitTarget += SpellEffectFn(spell_oculus_touch_the_nightmare_SpellScript::HandleDamageCalc, EFFECT_2, SPELL_EFFECT_SCHOOL_DAMAGE); } }; - SpellScript* GetSpellScript() const + SpellScript* GetSpellScript() const OVERRIDE { return new spell_oculus_touch_the_nightmare_SpellScript(); } @@ -564,14 +564,14 @@ class spell_oculus_dream_funnel: public SpellScriptLoader canBeRecalculated = false; } - void Register() + void Register() OVERRIDE { DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_oculus_dream_funnel_AuraScript::HandleEffectCalcAmount, EFFECT_0, SPELL_AURA_PERIODIC_HEAL); DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_oculus_dream_funnel_AuraScript::HandleEffectCalcAmount, EFFECT_2, SPELL_AURA_PERIODIC_DAMAGE); } }; - AuraScript* GetAuraScript() const + AuraScript* GetAuraScript() const OVERRIDE { return new spell_oculus_dream_funnel_AuraScript(); } diff --git a/src/server/scripts/World/achievement_scripts.cpp b/src/server/scripts/World/achievement_scripts.cpp index 774c4e63071..0243b08e80e 100644 --- a/src/server/scripts/World/achievement_scripts.cpp +++ b/src/server/scripts/World/achievement_scripts.cpp @@ -40,7 +40,7 @@ class achievement_resilient_victory : public AchievementCriteriaScript if (bg->GetTypeID(true) != BATTLEGROUND_AB) return false; - if (!static_cast<BattlegroundAB*>(bg)->IsTeamScores500Disadvantage(source->GetTeam())) + if (!bg->ToBattlegroundAB()->IsTeamScores500Disadvantage(source->GetTeam())) return false; return true; @@ -84,7 +84,7 @@ class achievement_save_the_day : public AchievementCriteriaScript if (bg->GetTypeID(true) != BATTLEGROUND_WS) return false; - if (static_cast<BattlegroundWS*>(bg)->GetFlagState(player->GetTeam()) == BG_WS_FLAG_STATE_ON_BASE) + if (bg->ToBattlegroundWS()->GetFlagState(player->GetTeam()) == BG_WS_FLAG_STATE_ON_BASE) return true; } return false; @@ -209,7 +209,7 @@ class achievement_everything_counts : public AchievementCriteriaScript if (bg->GetTypeID(true) != BATTLEGROUND_AV) return false; - if (static_cast<BattlegroundAV*>(bg)->IsBothMinesControlledByTeam(source->GetTeam())) + if (bg->ToBattlegroundAV()->IsBothMinesControlledByTeam(source->GetTeam())) return true; return false; @@ -230,7 +230,7 @@ class achievement_bg_av_perfection : public AchievementCriteriaScript if (bg->GetTypeID(true) != BATTLEGROUND_AV) return false; - if (static_cast<BattlegroundAV*>(bg)->IsAllTowersControlledAndCaptainAlive(source->GetTeam())) + if (bg->ToBattlegroundAV()->IsAllTowersControlledAndCaptainAlive(source->GetTeam())) return true; return false; @@ -253,10 +253,10 @@ class achievement_bg_sa_defense_of_ancients : public AchievementCriteriaScript if (!battleground) return false; - if (player->GetTeamId() == static_cast<BattlegroundSA*>(battleground)->Attackers) + if (player->GetTeamId() == battleground->ToBattlegroundSA()->Attackers) return false; - if (!static_cast<BattlegroundSA*>(battleground)->gateDestroyed) + if (!battleground->ToBattlegroundSA()->gateDestroyed) return true; return false; @@ -308,7 +308,7 @@ class achievement_not_even_a_scratch : public AchievementCriteriaScript if (!battleground) return false; - if (static_cast<BattlegroundSA*>(battleground)->notEvenAScratch(source->GetTeam())) + if (battleground->ToBattlegroundSA()->notEvenAScratch(source->GetTeam())) return true; return false; |