diff options
author | Vincent_Michael <Vincent_Michael@gmx.de> | 2013-03-20 22:07:56 +0100 |
---|---|---|
committer | Vincent_Michael <Vincent_Michael@gmx.de> | 2013-03-20 22:07:56 +0100 |
commit | 41822a8ed392357aed43e52135a51456b0a42f96 (patch) | |
tree | a358f6b3a69d5f928c331e7ccf56849281a956e3 /src | |
parent | 455da45d9c476214e1d5567f79c9f029719330be (diff) | |
parent | 69e81d46b16ab9172c0a0999e387a0fb7f0f939c (diff) |
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts:
src/server/game/AI/EventAI/CreatureEventAI.cpp
src/server/game/AI/EventAI/CreatureEventAI.h
src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
src/server/game/Battlegrounds/Battleground.cpp
src/server/game/DataStores/DBCStores.cpp
src/server/game/Entities/Object/Object.h
src/server/game/Entities/Player/Player.h
src/server/game/Entities/Unit/Unit.cpp
src/server/game/Entities/Unit/Unit.h
src/server/game/Spells/Auras/SpellAuraEffects.cpp
src/server/game/Spells/SpellInfo.h
Diffstat (limited to 'src')
30 files changed, 192 insertions, 236 deletions
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index dd32d2363d7..85864cab493 100644 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -40,7 +40,6 @@ int PetAI::Permissible(const Creature* creature) PetAI::PetAI(Creature* c) : CreatureAI(c), i_tracker(TIME_INTERVAL_LOOK) { - m_AllySet.clear(); UpdateAllies(); } diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index b5af76a1219..9c476ea55fc 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -83,7 +83,6 @@ SmartScript::SmartScript() mEventPhase = 0; mPathId = 0; mTargetStorage = new ObjectListMap(); - mStoredEvents.clear(); mTextTimer = 0; mLastTextID = 0; mTextGUID = 0; @@ -313,10 +312,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { if (CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(e.action.morphOrMount.creature)) { - uint32 display_id = sObjectMgr->ChooseDisplayId(0, ci); - (*itr)->ToCreature()->SetDisplayId(display_id); + uint32 displayId = ObjectMgr::ChooseDisplayId(ci); + (*itr)->ToCreature()->SetDisplayId(displayId); sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL: Creature entry %u, GuidLow %u set displayid to %u", - (*itr)->GetEntry(), (*itr)->GetGUIDLow(), display_id); + (*itr)->GetEntry(), (*itr)->GetGUIDLow(), displayId); } } //if no param1, then use value from param2 (modelId) @@ -1050,10 +1049,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (e.action.morphOrMount.creature > 0) { if (CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(e.action.morphOrMount.creature)) - { - uint32 display_id = sObjectMgr->ChooseDisplayId(0, cInfo); - (*itr)->ToUnit()->Mount(display_id); - } + (*itr)->ToUnit()->Mount(ObjectMgr::ChooseDisplayId(cInfo)); } else (*itr)->ToUnit()->Mount(e.action.morphOrMount.model); diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index e01fd51ddfb..e14c8783136 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -101,8 +101,6 @@ SmartWaypointMgr::~SmartWaypointMgr() delete itr->second; } - - waypoint_map.clear(); } void SmartAIMgr::LoadSmartAIFromDB() diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp index 83f1252e1f1..716aabd9a98 100644 --- a/src/server/game/Accounts/AccountMgr.cpp +++ b/src/server/game/Accounts/AccountMgr.cpp @@ -308,16 +308,6 @@ bool AccountMgr::IsPlayerAccount(uint32 gmlevel) return gmlevel == SEC_PLAYER; } -bool AccountMgr::IsModeratorAccount(uint32 gmlevel) -{ - return gmlevel >= SEC_MODERATOR && gmlevel <= SEC_CONSOLE; -} - -bool AccountMgr::IsGMAccount(uint32 gmlevel) -{ - return gmlevel >= SEC_GAMEMASTER && gmlevel <= SEC_CONSOLE; -} - bool AccountMgr::IsAdminAccount(uint32 gmlevel) { return gmlevel >= SEC_ADMINISTRATOR && gmlevel <= SEC_CONSOLE; diff --git a/src/server/game/Accounts/AccountMgr.h b/src/server/game/Accounts/AccountMgr.h index 16b4355585a..878ecde24f9 100644 --- a/src/server/game/Accounts/AccountMgr.h +++ b/src/server/game/Accounts/AccountMgr.h @@ -63,8 +63,6 @@ class AccountMgr static std::string CalculateShaPassHash(std::string const& name, std::string const& password); static bool normalizeString(std::string& utf8String); static bool IsPlayerAccount(uint32 gmlevel); - static bool IsModeratorAccount(uint32 gmlevel); - static bool IsGMAccount(uint32 gmlevel); static bool IsAdminAccount(uint32 gmlevel); static bool IsConsoleAccount(uint32 gmlevel); static bool HasPermission(uint32 accountId, uint32 permission, uint32 realmId); diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index 327d2187730..ed03d1e1d04 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -52,13 +52,13 @@ AuctionHouseObject* AuctionHouseMgr::GetAuctionsMap(uint32 factionTemplateId) if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) return &mNeutralAuctions; - // team have linked auction houses - FactionTemplateEntry const* u_entry = sFactionTemplateStore.LookupEntry(factionTemplateId); - if (!u_entry) + // teams have linked auction houses + FactionTemplateEntry const* uEntry = sFactionTemplateStore.LookupEntry(factionTemplateId); + if (!uEntry) return &mNeutralAuctions; - else if (u_entry->ourMask & FACTION_MASK_ALLIANCE) + else if (uEntry->ourMask & FACTION_MASK_ALLIANCE) return &mAllianceAuctions; - else if (u_entry->ourMask & FACTION_MASK_HORDE) + else if (uEntry->ourMask & FACTION_MASK_HORDE) return &mHordeAuctions; else return &mNeutralAuctions; @@ -329,7 +329,7 @@ void AuctionHouseMgr::LoadAuctions() } GetAuctionsMap(aItem->factionTemplateId)->AddAuction(aItem); - count++; + ++count; } while (result->NextRow()); CharacterDatabase.CommitTransaction(trans); @@ -368,7 +368,7 @@ AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(uint32 factionTem if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) { - //FIXME: found way for proper auctionhouse selection by another way + // FIXME: found way for proper auctionhouse selection by another way // AuctionHouse.dbc have faction field with _player_ factions associated with auction house races. // but no easy way convert creature faction to player race faction for specific city switch (factionTemplateId) @@ -780,7 +780,8 @@ void AuctionHouseMgr::DeleteExpiredAuctionsAtStartup() delete auction; ++expirecount; - } while (expAuctions->NextRow()); + } + while (expAuctions->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Deleted %u expired auctions in %u ms", expirecount, GetMSTimeDiffToNow(oldMSTime)); diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.h b/src/server/game/AuctionHouse/AuctionHouseMgr.h index b1517fe0f40..7c870c20b65 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.h +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.h @@ -99,8 +99,6 @@ struct AuctionEntry class AuctionHouseObject { public: - // Initialize storage - AuctionHouseObject() { next = AuctionsMap.begin(); } ~AuctionHouseObject() { for (AuctionEntryMap::iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr) @@ -135,9 +133,6 @@ class AuctionHouseObject private: AuctionEntryMap AuctionsMap; - - // storage for "next" auction item for next Update() - AuctionEntryMap::const_iterator next; }; class AuctionHouseMgr diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index daab9b79f21..a81fb5e093a 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -66,8 +66,6 @@ Battlefield::~Battlefield() for (GraveyardVect::const_iterator itr = m_GraveyardList.begin(); itr != m_GraveyardList.end(); ++itr) delete *itr; - - m_capturePoints.clear(); } // Called when a player enters the zone @@ -684,7 +682,6 @@ BfGraveyard::BfGraveyard(Battlefield* battlefield) m_ControlTeam = TEAM_NEUTRAL; m_SpiritGuide[0] = 0; m_SpiritGuide[1] = 0; - m_ResurrectQueue.clear(); } void BfGraveyard::Initialize(TeamId startControl, uint32 graveyardId) diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp index 013c9352242..11df69b0d11 100644 --- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp +++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp @@ -49,14 +49,12 @@ BattlegroundQueue::~BattlegroundQueue() { m_events.KillAllEvents(false); - m_QueuedPlayers.clear(); for (int i = 0; i < MAX_BATTLEGROUND_BRACKETS; ++i) { for (uint32 j = 0; j < BG_QUEUE_GROUP_TYPES_COUNT; ++j) { for (GroupsQueueType::iterator itr = m_QueuedGroups[i][j].begin(); itr!= m_QueuedGroups[i][j].end(); ++itr) delete (*itr); - m_QueuedGroups[i][j].clear(); } } } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp index b0ffc7855dd..9d1c12a8903 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp @@ -157,18 +157,3 @@ void BattlegroundBE::UpdatePlayerScore(Player* Source, uint32 type, uint32 value Battleground::UpdatePlayerScore(Source, type, value, doAddHonor); } - -/* -21:45:46 id:231310 [S2C] SMSG_INIT_WORLD_STATES (706 = 0x02C2) len: 86 -0000: 32 02 00 00 76 0e 00 00 00 00 00 00 09 00 f3 09 | 2...v........... -0010: 00 00 01 00 00 00 f1 09 00 00 01 00 00 00 f0 09 | ................ -0020: 00 00 02 00 00 00 d4 08 00 00 00 00 00 00 d8 08 | ................ -0030: 00 00 00 00 00 00 d7 08 00 00 00 00 00 00 d6 08 | ................ -0040: 00 00 00 00 00 00 d5 08 00 00 00 00 00 00 d3 08 | ................ -0050: 00 00 00 00 00 00 | ...... - -spell 32724 - Gold Team -spell 32725 - Green Team -35774 Gold Team -35775 Green Team -*/ diff --git a/src/server/game/Chat/Channels/ChannelMgr.cpp b/src/server/game/Chat/Channels/ChannelMgr.cpp index 117afc8bc85..aab67fb03bd 100644 --- a/src/server/game/Chat/Channels/ChannelMgr.cpp +++ b/src/server/game/Chat/Channels/ChannelMgr.cpp @@ -25,8 +25,6 @@ ChannelMgr::~ChannelMgr() { for (ChannelMap::iterator itr = channels.begin(); itr != channels.end(); ++itr) delete itr->second; - - channels.clear(); } ChannelMgr* ChannelMgr::forTeam(uint32 team) diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index de05fd200b3..b34ab0283a5 100644 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -22,6 +22,8 @@ #include "SpellMgr.h" #include "DBCfmt.h" #include "ItemPrototype.h" +#include "Timer.h" +#include "ObjectDefines.h" #include <map> diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 99c1813b7e5..892f44dba73 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -16,13 +16,13 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "Creature.h" #include "BattlegroundMgr.h" #include "CellImpl.h" #include "Common.h" #include "CreatureAI.h" #include "CreatureAISelector.h" #include "CreatureGroups.h" -#include "Creature.h" #include "DatabaseEnv.h" #include "Formulas.h" #include "GameEventMgr.h" @@ -169,8 +169,6 @@ m_creatureInfo(NULL), m_creatureData(NULL), m_path_id(0), m_formation(NULL) Creature::~Creature() { - m_vendorItemCounts.clear(); - delete i_AI; i_AI = NULL; @@ -258,12 +256,12 @@ void Creature::RemoveCorpse(bool setSpawnTime) /** * change the entry of creature until respawn */ -bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData* data) +bool Creature::InitEntry(uint32 entry, uint32 /*team*/, const CreatureData* data) { - CreatureTemplate const* normalInfo = sObjectMgr->GetCreatureTemplate(Entry); + CreatureTemplate const* normalInfo = sObjectMgr->GetCreatureTemplate(entry); if (!normalInfo) { - sLog->outError(LOG_FILTER_SQL, "Creature::InitEntry creature entry %u does not exist.", Entry); + sLog->outError(LOG_FILTER_SQL, "Creature::InitEntry creature entry %u does not exist.", entry); return false; } @@ -293,7 +291,7 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData* data if (GetMap()->Is25ManRaid()) loot.maxDuplicates = 3; - SetEntry(Entry); // normal entry always + SetEntry(entry); // normal entry always m_creatureInfo = cinfo; // map mode related always // equal to player Race field, but creature does not have race @@ -305,15 +303,15 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData* data // Cancel load if no model defined if (!(cinfo->GetFirstValidModelId())) { - sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ", Entry); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ", entry); return false; } - uint32 displayID = sObjectMgr->ChooseDisplayId(0, GetCreatureTemplate(), data); + uint32 displayID = ObjectMgr::ChooseDisplayId(GetCreatureTemplate(), data); CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID); if (!minfo) // Cancel load if no model defined { - sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ", Entry); + sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ", entry); return false; } @@ -1248,7 +1246,7 @@ float Creature::_GetDamageMod(int32 Rank) } } -float Creature::GetSpellDamageMod(int32 Rank) +float Creature::GetSpellDamageMod(int32 Rank) const { switch (Rank) // define rates for each elite rank { @@ -1708,7 +1706,7 @@ void Creature::DespawnOrUnsummon(uint32 msTimeToDespawn /*= 0*/) ForcedDespawn(msTimeToDespawn); } -bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo) +bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo) const { if (!spellInfo) return false; diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index e5ef3586406..c4c768c445a 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -157,13 +157,18 @@ struct CreatureTemplate return SKILL_SKINNING; // normal case } - bool isTameable(bool exotic) const + bool isExotic() const + { + return (type_flags & CREATURE_TYPEFLAGS_EXOTIC) != 0; + } + + bool isTameable(bool canTameExotic) const { if (type != CREATURE_TYPE_BEAST || family == 0 || (type_flags & CREATURE_TYPEFLAGS_TAMEABLE) == 0) return false; - // if can tame exotic then can tame any temable - return exotic || (type_flags & CREATURE_TYPEFLAGS_EXOTIC) == 0; + // if can tame exotic then can tame any tameable + return canTameExotic || !isExotic(); } }; @@ -480,8 +485,8 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature bool isCanInteractWithBattleMaster(Player* player, bool msg) const; bool isCanTrainingAndResetTalentsOf(Player* player) const; bool canCreatureAttack(Unit const* victim, bool force = true) const; - bool IsImmunedToSpell(SpellInfo const* spellInfo); //override Unit::IsImmunedToSpell - bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const; //override Unit::IsImmunedToSpellEffect + bool IsImmunedToSpell(SpellInfo const* spellInfo) const; // override Unit::IsImmunedToSpell + bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const; // override Unit::IsImmunedToSpellEffect bool isElite() const; bool isWorldBoss() const; @@ -527,7 +532,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature uint8 GetCurrentEquipmentId() { return m_equipmentId; } void SetCurrentEquipmentId(uint8 id) { m_equipmentId = id; } - float GetSpellDamageMod(int32 Rank); + float GetSpellDamageMod(int32 Rank) const; VendorItemData const* GetVendorItems() const; uint32 GetVendorItemCurrentCount(VendorItem const* vItem); @@ -656,8 +661,8 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature uint32 GetWaypointPath(){return m_path_id;} void LoadPath(uint32 pathid) { m_path_id = pathid; } - uint32 GetCurrentWaypointID(){return m_waypointID;} - void UpdateWaypointID(uint32 wpID){m_waypointID = wpID;} + uint32 GetCurrentWaypointID() const { return m_waypointID; } + void UpdateWaypointID(uint32 wpID) { m_waypointID = wpID; } void SearchFormation(); CreatureGroup* GetFormation() {return m_formation;} diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index 7da910f1841..db972a0d550 100644 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -702,7 +702,7 @@ void Item::RemoveFromUpdateQueueOf(Player* player) if (!IsInUpdateQueue()) return; - ASSERT(player != NULL) + ASSERT(player != NULL); if (player->GetGUID() != GetOwnerGUID()) { @@ -999,27 +999,27 @@ void Item::SendTimeUpdate(Player* owner) owner->GetSession()->SendPacket(&data); } -Item* Item::CreateItem(uint32 item, uint32 count, Player const* player) +Item* Item::CreateItem(uint32 itemEntry, uint32 count, Player const* player) { if (count < 1) return NULL; //don't create item at zero count - ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item); - if (pProto) + ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemEntry); + if (proto) { - if (count > pProto->GetMaxStackSize()) - count = pProto->GetMaxStackSize(); + if (count > proto->GetMaxStackSize()) + count = proto->GetMaxStackSize(); ASSERT(count != 0 && "pProto->Stackable == 0 but checked at loading already"); - Item* pItem = NewItemOrBag(pProto); - if (pItem->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), item, player)) + Item* item = NewItemOrBag(proto); + if (item->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), itemEntry, player)) { - pItem->SetCount(count); - return pItem; + item->SetCount(count); + return item; } else - delete pItem; + delete item; } else ASSERT(false); @@ -1157,7 +1157,7 @@ bool Item::IsRefundExpired() return (GetPlayedTime() > 2*HOUR); } -void Item::SetSoulboundTradeable(AllowedLooterSet& allowedLooters) +void Item::SetSoulboundTradeable(AllowedLooterSet const& allowedLooters) { SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_BOP_TRADEABLE); allowedGUIDs = allowedLooters; diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h index 9879d056fef..f69ac0f8965 100644 --- a/src/server/game/Entities/Item/Item.h +++ b/src/server/game/Entities/Item/Item.h @@ -215,7 +215,7 @@ bool ItemCanGoIntoBag(ItemTemplate const* proto, ItemTemplate const* pBagProto); class Item : public Object { public: - static Item* CreateItem(uint32 item, uint32 count, Player const* player = NULL); + static Item* CreateItem(uint32 itemEntry, uint32 count, Player const* player = NULL); Item* CloneItem(uint32 count, Player const* player = NULL) const; Item(); @@ -341,16 +341,17 @@ class Item : public Object void SetRefundRecipient(uint32 pGuidLow) { m_refundRecipient = pGuidLow; } void SetPaidMoney(uint32 money) { m_paidMoney = money; } void SetPaidExtendedCost(uint32 iece) { m_paidExtendedCost = iece; } - uint32 GetRefundRecipient() { return m_refundRecipient; } - uint32 GetPaidMoney() { return m_paidMoney; } - uint32 GetPaidExtendedCost() { return m_paidExtendedCost; } + + uint32 GetRefundRecipient() const { return m_refundRecipient; } + uint32 GetPaidMoney() const { return m_paidMoney; } + uint32 GetPaidExtendedCost() const { return m_paidExtendedCost; } void UpdatePlayedTime(Player* owner); uint32 GetPlayedTime(); bool IsRefundExpired(); // Soulbound trade system - void SetSoulboundTradeable(AllowedLooterSet& allowedLooters); + void SetSoulboundTradeable(AllowedLooterSet const& allowedLooters); void ClearSoulboundTradeable(Player* currentOwner); bool CheckSoulboundTradeExpire(); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 3b50df73ed1..b78c632dd08 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -23716,7 +23716,7 @@ OutdoorPvP* Player::GetOutdoorPvP() const return sOutdoorPvPMgr->GetOutdoorPvPToZoneId(GetZoneId()); } -bool Player::HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item const* ignoreItem) +bool Player::HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item const* ignoreItem) const { if (spellInfo->EquippedItemClass < 0) return true; @@ -23727,7 +23727,7 @@ bool Player::HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item cons { case ITEM_CLASS_WEAPON: { - for (uint8 i= EQUIPMENT_SLOT_MAINHAND; i < EQUIPMENT_SLOT_TABARD; ++i) + for (uint8 i = EQUIPMENT_SLOT_MAINHAND; i < EQUIPMENT_SLOT_TABARD; ++i) if (Item* item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, i)) if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo)) return true; @@ -23736,7 +23736,7 @@ bool Player::HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item cons case ITEM_CLASS_ARMOR: { // tabard not have dependent spells - for (uint8 i= EQUIPMENT_SLOT_START; i< EQUIPMENT_SLOT_MAINHAND; ++i) + for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_MAINHAND; ++i) if (Item* item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, i)) if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo)) return true; diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index ab02b316ce5..097376970dd 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1362,7 +1362,7 @@ class Player : public Unit, public GridObject<Player> uint8 GetBankBagSlotCount() const { return GetByteValue(PLAYER_BYTES_2, 2); } void SetBankBagSlotCount(uint8 count) { SetByteValue(PLAYER_BYTES_2, 2, count); } bool HasItemCount(uint32 item, uint32 count = 1, bool inBankAlso = false) const; - bool HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item const* ignoreItem = NULL); + bool HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item const* ignoreItem = NULL) const; bool CanNoReagentCast(SpellInfo const* spellInfo) const; bool HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_slot = NULL_SLOT) const; bool HasItemOrGemWithLimitCategoryEquipped(uint32 limitCategory, uint32 count, uint8 except_slot = NULL_SLOT) const; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 54454e46a4a..69fc0aa9d62 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -3925,7 +3925,7 @@ AuraEffect* Unit::GetAuraEffect(AuraType type, SpellFamilyNames name, uint32 ico return NULL; } -AuraEffect* Unit::GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID) +AuraEffect* Unit::GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID) const { AuraEffectList const& auras = GetAuraEffectsByType(type); for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i) @@ -4241,7 +4241,7 @@ float Unit::GetTotalAuraMultiplier(AuraType auratype) const return multiplier; } -int32 Unit::GetMaxPositiveAuraModifier(AuraType auratype) +int32 Unit::GetMaxPositiveAuraModifier(AuraType auratype) const { int32 modifier = 0; @@ -4267,7 +4267,7 @@ int32 Unit::GetMaxNegativeAuraModifier(AuraType auratype) const return modifier; } -int32 Unit::GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const +int32 Unit::GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 miscMask) const { std::map<SpellGroup, int32> SameEffectSpellGroup; int32 modifier = 0; @@ -4275,7 +4275,7 @@ int32 Unit::GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype); for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) - if ((*i)->GetMiscValue() & misc_mask) + if ((*i)->GetMiscValue() & miscMask) if (!sSpellMgr->AddSameEffectStackRuleSpellGroups((*i)->GetSpellInfo(), (*i)->GetAmount(), SameEffectSpellGroup)) modifier += (*i)->GetAmount(); @@ -4285,7 +4285,7 @@ int32 Unit::GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) return modifier; } -float Unit::GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask) const +float Unit::GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 miscMask) const { std::map<SpellGroup, int32> SameEffectSpellGroup; float multiplier = 1.0f; @@ -4293,7 +4293,7 @@ float Unit::GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype); for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) { - if (((*i)->GetMiscValue() & misc_mask)) + if (((*i)->GetMiscValue() & miscMask)) { // Check if the Aura Effect has a the Same Effect Stack Rule and if so, use the highest amount of that SpellGroup // If the Aura Effect does not have this Stack Rule, it returns false so we can add to the multiplier as usual @@ -4308,35 +4308,35 @@ float Unit::GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask return multiplier; } -int32 Unit::GetMaxPositiveAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask, const AuraEffect* except) const +int32 Unit::GetMaxPositiveAuraModifierByMiscMask(AuraType auratype, uint32 miscMask, const AuraEffect* except) const { int32 modifier = 0; AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype); for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) { - if (except != (*i) && (*i)->GetMiscValue()& misc_mask && (*i)->GetAmount() > modifier) + if (except != (*i) && (*i)->GetMiscValue()& miscMask && (*i)->GetAmount() > modifier) modifier = (*i)->GetAmount(); } return modifier; } -int32 Unit::GetMaxNegativeAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const +int32 Unit::GetMaxNegativeAuraModifierByMiscMask(AuraType auratype, uint32 miscMask) const { int32 modifier = 0; AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype); for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) { - if ((*i)->GetMiscValue()& misc_mask && (*i)->GetAmount() < modifier) + if ((*i)->GetMiscValue()& miscMask && (*i)->GetAmount() < modifier) modifier = (*i)->GetAmount(); } return modifier; } -int32 Unit::GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const +int32 Unit::GetTotalAuraModifierByMiscValue(AuraType auratype, int32 miscValue) const { std::map<SpellGroup, int32> SameEffectSpellGroup; int32 modifier = 0; @@ -4344,7 +4344,7 @@ int32 Unit::GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value) AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype); for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) { - if ((*i)->GetMiscValue() == misc_value) + if ((*i)->GetMiscValue() == miscValue) if (!sSpellMgr->AddSameEffectStackRuleSpellGroups((*i)->GetSpellInfo(), (*i)->GetAmount(), SameEffectSpellGroup)) modifier += (*i)->GetAmount(); } @@ -4355,7 +4355,7 @@ int32 Unit::GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value) return modifier; } -float Unit::GetTotalAuraMultiplierByMiscValue(AuraType auratype, int32 misc_value) const +float Unit::GetTotalAuraMultiplierByMiscValue(AuraType auratype, int32 miscValue) const { std::map<SpellGroup, int32> SameEffectSpellGroup; float multiplier = 1.0f; @@ -4363,7 +4363,7 @@ float Unit::GetTotalAuraMultiplierByMiscValue(AuraType auratype, int32 misc_valu AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype); for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) { - if ((*i)->GetMiscValue() == misc_value) + if ((*i)->GetMiscValue() == miscValue) if (!sSpellMgr->AddSameEffectStackRuleSpellGroups((*i)->GetSpellInfo(), (*i)->GetAmount(), SameEffectSpellGroup)) AddPct(multiplier, (*i)->GetAmount()); } @@ -4374,28 +4374,28 @@ float Unit::GetTotalAuraMultiplierByMiscValue(AuraType auratype, int32 misc_valu return multiplier; } -int32 Unit::GetMaxPositiveAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const +int32 Unit::GetMaxPositiveAuraModifierByMiscValue(AuraType auratype, int32 miscValue) const { int32 modifier = 0; AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype); for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) { - if ((*i)->GetMiscValue() == misc_value && (*i)->GetAmount() > modifier) + if ((*i)->GetMiscValue() == miscValue && (*i)->GetAmount() > modifier) modifier = (*i)->GetAmount(); } return modifier; } -int32 Unit::GetMaxNegativeAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const +int32 Unit::GetMaxNegativeAuraModifierByMiscValue(AuraType auratype, int32 miscValue) const { int32 modifier = 0; AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype); for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) { - if ((*i)->GetMiscValue() == misc_value && (*i)->GetAmount() < modifier) + if ((*i)->GetMiscValue() == miscValue && (*i)->GetAmount() < modifier) modifier = (*i)->GetAmount(); } @@ -8889,7 +8889,7 @@ void Unit::UnsummonAllTotems() void Unit::SendHealSpellLog(Unit* victim, uint32 SpellID, uint32 Damage, uint32 OverHeal, uint32 Absorb, bool critical) { // we guess size - WorldPacket data(SMSG_SPELLHEALLOG, 8+8+4+4+4+4+1+1); + WorldPacket data(SMSG_SPELLHEALLOG, 8 + 8 + 4 + 4 + 4 + 4 + 1 + 1); data.append(victim->GetPackGUID()); data.append(GetPackGUID()); data << uint32(SpellID); @@ -8912,28 +8912,28 @@ int32 Unit::HealBySpell(Unit* victim, SpellInfo const* spellInfo, uint32 addHeal return gain; } -void Unit::SendEnergizeSpellLog(Unit* victim, uint32 spellID, uint32 damage, Powers powerType) +void Unit::SendEnergizeSpellLog(Unit* victim, uint32 spellId, int32 damage, Powers powerType) { WorldPacket data(SMSG_SPELLENERGIZELOG, (8+8+4+4+4+1)); data.append(victim->GetPackGUID()); data.append(GetPackGUID()); - data << uint32(spellID); + data << uint32(spellId); data << uint32(powerType); - data << uint32(damage); + data << int32(damage); SendMessageToSet(&data, true); } -void Unit::EnergizeBySpell(Unit* victim, uint32 spellID, int32 damage, Powers powerType) +void Unit::EnergizeBySpell(Unit* victim, uint32 spellId, int32 damage, Powers powerType) { - SendEnergizeSpellLog(victim, spellID, damage, powerType); + SendEnergizeSpellLog(victim, spellId, damage, powerType); // needs to be called after sending spell log victim->ModifyPower(powerType, damage); - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellID); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); victim->getHostileRefManager().threatAssist(this, float(damage) * 0.5f, spellInfo); } -uint32 Unit::SpellDamageBonusDone(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) const { if (!spellProto || !victim || damagetype == DIRECT_DAMAGE) return pdamage; @@ -9000,7 +9000,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin AddPct(DoneTotalMod, GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_DAMAGE_DONE_FOR_MECHANIC, spellProto->Mechanic)); // done scripted mod (take it from owner) - Unit* owner = GetOwner() ? GetOwner() : this; + Unit const * const owner = GetOwner() ? GetOwner() : this; AuraEffectList const& mOverrideClassScript= owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i) { @@ -9204,7 +9204,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin return uint32(std::max(tmpDamage, 0.0f)); } -uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack) +uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack) const { if (!spellProto || damagetype == DIRECT_DAMAGE) return pdamage; @@ -9303,7 +9303,7 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui return uint32(std::max(tmpDamage, 0.0f)); } -int32 Unit::SpellBaseDamageBonusDone(SpellSchoolMask schoolMask) +int32 Unit::SpellBaseDamageBonusDone(SpellSchoolMask schoolMask) const { int32 DoneAdvertisedBenefit = 0; @@ -9346,7 +9346,7 @@ int32 Unit::SpellBaseDamageBonusDone(SpellSchoolMask schoolMask) return DoneAdvertisedBenefit; } -int32 Unit::SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask) +int32 Unit::SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask) const { int32 TakenAdvertisedBenefit = 0; @@ -9605,7 +9605,7 @@ uint32 Unit::SpellCriticalHealingBonus(SpellInfo const* /*spellProto*/, uint32 d return damage; } -uint32 Unit::SpellHealingBonusDone(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) const { // For totems get healing bonus from owner (statue isn't totem in fact) if (GetTypeId() == TYPEID_UNIT && isTotem()) @@ -9625,7 +9625,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui AddPct(DoneTotalMod, (*i)->GetAmount()); // done scripted mod (take it from owner) - Unit* owner = GetOwner() ? GetOwner() : this; + Unit const* owner = GetOwner() ? GetOwner() : this; AuraEffectList const& mOverrideClassScript= owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i) { @@ -9740,7 +9740,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui return uint32(std::max(heal, 0.0f)); } -uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack) +uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack) const { float TakenTotalMod = 1.0f; @@ -9829,24 +9829,24 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, u return uint32(std::max(heal, 0.0f)); } -int32 Unit::SpellBaseHealingBonusDone(SpellSchoolMask schoolMask) +int32 Unit::SpellBaseHealingBonusDone(SpellSchoolMask schoolMask) const { - int32 AdvertisedBenefit = 0; + int32 advertisedBenefit = 0; AuraEffectList const& mHealingDone = GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_DONE); for (AuraEffectList::const_iterator i = mHealingDone.begin(); i != mHealingDone.end(); ++i) if (!(*i)->GetMiscValue() || ((*i)->GetMiscValue() & schoolMask) != 0) - AdvertisedBenefit += (*i)->GetAmount(); + advertisedBenefit += (*i)->GetAmount(); // Healing bonus of spirit, intellect and strength if (GetTypeId() == TYPEID_PLAYER) { // Base value - AdvertisedBenefit += ToPlayer()->GetBaseSpellPowerBonus(); + advertisedBenefit += ToPlayer()->GetBaseSpellPowerBonus(); // Check if we are ever using mana - PaperDollFrame.lua if (GetPowerIndex(POWER_MANA) != MAX_POWERS) - AdvertisedBenefit += std::max(0, int32(GetStat(STAT_INTELLECT)) - 10); // spellpower from intellect + advertisedBenefit += std::max(0, int32(GetStat(STAT_INTELLECT)) - 10); // spellpower from intellect // Healing bonus from stats AuraEffectList const& mHealingDoneOfStatPercent = GetAuraEffectsByType(SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT); @@ -9854,31 +9854,31 @@ int32 Unit::SpellBaseHealingBonusDone(SpellSchoolMask schoolMask) { // stat used dependent from misc value (stat index) Stats usedStat = Stats((*i)->GetSpellInfo()->Effects[(*i)->GetEffIndex()].MiscValue); - AdvertisedBenefit += int32(CalculatePct(GetStat(usedStat), (*i)->GetAmount())); + advertisedBenefit += int32(CalculatePct(GetStat(usedStat), (*i)->GetAmount())); } // ... and attack power AuraEffectList const& mHealingDonebyAP = GetAuraEffectsByType(SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER); for (AuraEffectList::const_iterator i = mHealingDonebyAP.begin(); i != mHealingDonebyAP.end(); ++i) if ((*i)->GetMiscValue() & schoolMask) - AdvertisedBenefit += int32(CalculatePct(GetTotalAttackPowerValue(BASE_ATTACK), (*i)->GetAmount())); + advertisedBenefit += int32(CalculatePct(GetTotalAttackPowerValue(BASE_ATTACK), (*i)->GetAmount())); } - return AdvertisedBenefit; + return advertisedBenefit; } -int32 Unit::SpellBaseHealingBonusTaken(SpellSchoolMask schoolMask) +int32 Unit::SpellBaseHealingBonusTaken(SpellSchoolMask schoolMask) const { - int32 AdvertisedBenefit = 0; + int32 advertisedBenefit = 0; 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(); + advertisedBenefit += (*i)->GetAmount(); - return AdvertisedBenefit; + return advertisedBenefit; } -bool Unit::IsImmunedToDamage(SpellSchoolMask shoolMask) +bool Unit::IsImmunedToDamage(SpellSchoolMask shoolMask) const { // If m_immuneToSchool type contain this school type, IMMUNE damage. SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL]; @@ -9895,7 +9895,7 @@ bool Unit::IsImmunedToDamage(SpellSchoolMask shoolMask) return false; } -bool Unit::IsImmunedToDamage(SpellInfo const* spellInfo) +bool Unit::IsImmunedToDamage(SpellInfo const* spellInfo) const { if (spellInfo->Attributes & SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY) return false; @@ -9919,7 +9919,7 @@ bool Unit::IsImmunedToDamage(SpellInfo const* spellInfo) return false; } -bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo) +bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo) const { if (!spellInfo) return false; diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index e6bc56432a4..44d56b3eb99 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -767,16 +767,6 @@ namespace Movement{ class MoveSpline; } -enum DiminishingLevels -{ - DIMINISHING_LEVEL_1 = 0, - DIMINISHING_LEVEL_2 = 1, - DIMINISHING_LEVEL_3 = 2, - DIMINISHING_LEVEL_IMMUNE = 3, - DIMINISHING_LEVEL_4 = 3, - DIMINISHING_LEVEL_TAUNT_IMMUNE = 4 -}; - struct DiminishingReturn { DiminishingReturn(DiminishingGroup group, uint32 t, uint32 count) @@ -850,16 +840,16 @@ public: void ResistDamage(uint32 amount); void BlockDamage(uint32 amount); - Unit* GetAttacker() const { return m_attacker; }; - Unit* GetVictim() const { return m_victim; }; - SpellInfo const* GetSpellInfo() const { return m_spellInfo; }; - SpellSchoolMask GetSchoolMask() const { return m_schoolMask; }; - DamageEffectType GetDamageType() const { return m_damageType; }; - WeaponAttackType GetAttackType() const { return m_attackType; }; - uint32 GetDamage() const { return m_damage; }; - uint32 GetAbsorb() const { return m_absorb; }; - uint32 GetResist() const { return m_resist; }; - uint32 GetBlock() const { return m_block; }; + Unit* GetAttacker() const { return m_attacker; } + Unit* GetVictim() const { return m_victim; } + SpellInfo const* GetSpellInfo() const { return m_spellInfo; } + SpellSchoolMask GetSchoolMask() const { return m_schoolMask; } + DamageEffectType GetDamageType() const { return m_damageType; } + WeaponAttackType GetAttackType() const { return m_attackType; } + uint32 GetDamage() const { return m_damage; } + uint32 GetAbsorb() const { return m_absorb; } + uint32 GetResist() const { return m_resist; } + uint32 GetBlock() const { return m_block; } }; class HealInfo @@ -884,35 +874,42 @@ public: m_heal -= amount; } - uint32 GetHeal() const { return m_heal; }; + uint32 GetHeal() const { return m_heal; } }; class ProcEventInfo { -private: - Unit* const _actor; - Unit* const _actionTarget; - Unit* const _procTarget; - uint32 _typeMask; - uint32 _spellTypeMask; - uint32 _spellPhaseMask; - uint32 _hitMask; - Spell* _spell; - DamageInfo* _damageInfo; - HealInfo* _healInfo; public: - explicit ProcEventInfo(Unit* actor, Unit* actionTarget, Unit* procTarget, uint32 typeMask, uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, Spell* spell, DamageInfo* damageInfo, HealInfo* healInfo); - Unit* GetActor() { return _actor; }; + ProcEventInfo(Unit* actor, Unit* actionTarget, Unit* procTarget, uint32 typeMask, + uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, + Spell* spell, DamageInfo* damageInfo, HealInfo* healInfo); + + Unit* GetActor() { return _actor; } Unit* GetActionTarget() const { return _actionTarget; } Unit* GetProcTarget() const { return _procTarget; } + uint32 GetTypeMask() const { return _typeMask; } uint32 GetSpellTypeMask() const { return _spellTypeMask; } uint32 GetSpellPhaseMask() const { return _spellPhaseMask; } uint32 GetHitMask() const { return _hitMask; } + SpellInfo const* GetSpellInfo() const { return NULL; } SpellSchoolMask GetSchoolMask() const { return SPELL_SCHOOL_MASK_NONE; } + DamageInfo* GetDamageInfo() const { return _damageInfo; } HealInfo* GetHealInfo() const { return _healInfo; } + +private: + Unit* const _actor; + Unit* const _actionTarget; + Unit* const _procTarget; + uint32 _typeMask; + uint32 _spellTypeMask; + uint32 _spellPhaseMask; + uint32 _hitMask; + Spell* _spell; + DamageInfo* _damageInfo; + HealInfo* _healInfo; }; // Struct for use in Unit::CalculateMeleeDamage @@ -1525,7 +1522,7 @@ class Unit : public WorldObject 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 SendEnergizeSpellLog(Unit* victim, uint32 spellID, int32 damage, Powers powertype); void EnergizeBySpell(Unit* victim, uint32 SpellID, int32 Damage, Powers powertype); uint32 SpellNonMeleeDamageLog(Unit* victim, uint32 spellID, uint32 damage); @@ -1604,10 +1601,10 @@ class Unit : public WorldObject void BuildHeartBeatMsg(WorldPacket* data) const; - bool isAlive() const { return (m_deathState == ALIVE); }; - bool isDying() const { return (m_deathState == JUST_DIED); }; - bool isDead() const { return (m_deathState == DEAD || m_deathState == CORPSE); }; - DeathState getDeathState() { return m_deathState; }; + bool isAlive() const { return (m_deathState == ALIVE); } + bool isDying() const { return (m_deathState == JUST_DIED); } + bool isDead() const { return (m_deathState == DEAD || m_deathState == CORPSE); } + DeathState getDeathState() const { return m_deathState; } virtual void setDeathState(DeathState s); // overwrited in Creature/Player/Pet uint64 GetOwnerGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMONEDBY); } @@ -1740,7 +1737,7 @@ class Unit : public WorldObject AuraEffect* GetAuraEffect(uint32 spellId, uint8 effIndex, uint64 casterGUID = 0) const; AuraEffect* GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, uint64 casterGUID = 0) const; AuraEffect* GetAuraEffect(AuraType type, SpellFamilyNames name, uint32 iconId, uint8 effIndex) const; // spell mustn't have familyflags - AuraEffect* GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID =0); + AuraEffect* GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID =0) const; AuraEffect* GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const; AuraApplication * GetAuraApplication(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0, AuraApplication * except = NULL) const; @@ -1769,7 +1766,7 @@ class Unit : public WorldObject int32 GetTotalAuraModifier(AuraType auratype) const; float GetTotalAuraMultiplier(AuraType auratype) const; - int32 GetMaxPositiveAuraModifier(AuraType auratype); + int32 GetMaxPositiveAuraModifier(AuraType auratype) const; int32 GetMaxNegativeAuraModifier(AuraType auratype) const; int32 GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const; @@ -1934,14 +1931,14 @@ class Unit : public WorldObject Unit* GetMagicHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo); Unit* GetMeleeHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo = NULL); - 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); + int32 SpellBaseDamageBonusDone(SpellSchoolMask schoolMask) const; + int32 SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask) const; + uint32 SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack = 1) const; + uint32 SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack = 1) const; + int32 SpellBaseHealingBonusDone(SpellSchoolMask schoolMask) const; + int32 SpellBaseHealingBonusTaken(SpellSchoolMask schoolMask) const; + uint32 SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1) const; + uint32 SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1) const; uint32 MeleeDamageBonusDone(Unit* pVictim, uint32 damage, WeaponAttackType attType, SpellInfo const* spellProto = NULL); uint32 MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackType attType, SpellInfo const* spellProto = NULL); @@ -1962,10 +1959,10 @@ class Unit : public WorldObject void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply); void ApplySpellDispelImmunity(const SpellInfo* spellProto, DispelType type, bool apply); - virtual bool IsImmunedToSpell(SpellInfo const* spellInfo); + virtual bool IsImmunedToSpell(SpellInfo const* spellInfo) const; // redefined in Creature - bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask); - bool IsImmunedToDamage(SpellInfo const* spellInfo); + bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask) const; + bool IsImmunedToDamage(SpellInfo const* spellInfo) const; 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); diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index e2650a91aee..e6d7fb58928 100644 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -1362,7 +1362,7 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate) if (data2 && activate) { CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(data2->id); - uint32 displayID = sObjectMgr->ChooseDisplayId(0, cinfo, data2); + uint32 displayID = ObjectMgr::ChooseDisplayId(cinfo, data2); sObjectMgr->GetCreatureModelRandomGender(&displayID); if (data2->equipmentId == 0) diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index c897219604f..7982b8486b4 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -1108,19 +1108,13 @@ CreatureModelInfo const* ObjectMgr::GetCreatureModelInfo(uint32 modelId) return NULL; } -uint32 ObjectMgr::ChooseDisplayId(uint32 /*team*/, const CreatureTemplate* cinfo, const CreatureData* data /*= NULL*/) +uint32 ObjectMgr::ChooseDisplayId(CreatureTemplate const* cinfo, CreatureData const* data /*= NULL*/) { // Load creature model (display id) - uint32 display_id = 0; - - if (!data || data->displayid == 0) - { - display_id = cinfo->GetRandomValidModelId(); - } - else + if (data && data->displayid) return data->displayid; - return display_id; + return cinfo->GetRandomValidModelId(); } void ObjectMgr::ChooseCreatureFlags(const CreatureTemplate* cinfo, uint32& npcflag, uint32& unit_flags, uint32& dynamicflags, const CreatureData* data /*= NULL*/) diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 9e5b94a9242..4e7d2ab75cf 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -693,8 +693,8 @@ class ObjectMgr CreatureTemplateContainer const* GetCreatureTemplates() const { return &_creatureTemplateStore; } CreatureModelInfo const* GetCreatureModelInfo(uint32 modelId); CreatureModelInfo const* GetCreatureModelRandomGender(uint32* displayID); - static uint32 ChooseDisplayId(uint32 team, const CreatureTemplate* cinfo, const CreatureData* data = NULL); - static void ChooseCreatureFlags(const CreatureTemplate* cinfo, uint32& npcflag, uint32& unit_flags, uint32& dynamicflags, const CreatureData* data = NULL); + static uint32 ChooseDisplayId(CreatureTemplate const* cinfo, CreatureData const* data = NULL); + static void ChooseCreatureFlags(CreatureTemplate const* cinfo, uint32& npcflag, uint32& unit_flags, uint32& dynamicflags, CreatureData const* data = NULL); EquipmentInfo const* GetEquipmentInfo(uint32 entry, int8& id); CreatureAddon const* GetCreatureAddon(uint32 lowguid); CreatureAddon const* GetCreatureTemplateAddon(uint32 entry); diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index 2adaa196ed0..57faa5f3ebc 100644 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -4075,4 +4075,14 @@ enum NavTerrain // we only have 8 bits }; +enum DiminishingLevels +{ + DIMINISHING_LEVEL_1 = 0, + DIMINISHING_LEVEL_2 = 1, + DIMINISHING_LEVEL_3 = 2, + DIMINISHING_LEVEL_IMMUNE = 3, + DIMINISHING_LEVEL_4 = 3, + DIMINISHING_LEVEL_TAUNT_IMMUNE = 4 +}; + #endif diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index f9843a060c7..4381c6a0620 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -2128,11 +2128,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode, uint32 cr_id = target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).front()->GetMiscValue(); if (CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(cr_id)) { - uint32 team = 0; - if (target->GetTypeId() == TYPEID_PLAYER) - team = target->ToPlayer()->GetTeam(); - - uint32 displayID = sObjectMgr->ChooseDisplayId(team, ci); + uint32 displayID = ObjectMgr::ChooseDisplayId(ci); sObjectMgr->GetCreatureModelRandomGender(&displayID); target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, displayID); @@ -2592,16 +2588,12 @@ void AuraEffect::HandleAuraMounted(AuraApplication const* aurApp, uint8 mode, bo creatureEntry = 15665; } - if (CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(creatureEntry)) + if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry)) { - uint32 team = 0; - if (target->GetTypeId() == TYPEID_PLAYER) - team = target->ToPlayer()->GetTeam(); - - displayId = ObjectMgr::ChooseDisplayId(team, ci); + uint32 displayID = ObjectMgr::ChooseDisplayId(creatureInfo); sObjectMgr->GetCreatureModelRandomGender(&displayId); - vehicleId = ci->VehicleId; + vehicleId = creatureInfo->VehicleId; //some spell has one aura of mount and one of vehicle for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i) @@ -4935,11 +4927,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry)) { - uint32 team = 0; - if (target->GetTypeId() == TYPEID_PLAYER) - team = target->ToPlayer()->GetTeam(); - - uint32 displayID = sObjectMgr->ChooseDisplayId(team, creatureInfo); + uint32 displayID = ObjectMgr::ChooseDisplayId(creatureInfo); sObjectMgr->GetCreatureModelRandomGender(&displayID); target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, displayID); diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h index 18443421dfe..4be90e5c100 100644 --- a/src/server/game/Spells/SpellInfo.h +++ b/src/server/game/Spells/SpellInfo.h @@ -21,6 +21,7 @@ #include "SharedDefines.h" #include "Util.h" #include "DBCStructure.h" +#include "Object.h" #include "SpellAuraDefines.h" class Unit; diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h index 391be0c7311..d63aa679381 100644 --- a/src/server/game/Spells/SpellMgr.h +++ b/src/server/game/Spells/SpellMgr.h @@ -22,9 +22,15 @@ // For static or at-server-startup loaded spell data #include <ace/Singleton.h> -#include "Common.h" + +#include "DBCStructure.h" #include "SharedDefines.h" -#include "Unit.h" +#include "UnorderedMap.h" +#include "Util.h" + +#include <map> +#include <set> +#include <vector> class SpellInfo; class Player; @@ -442,10 +448,7 @@ class PetAura typedef UNORDERED_MAP<uint32, uint32> PetAuraMap; public: - PetAura() : removeOnChangePet(false), damage(0) - { - auras.clear(); - } + PetAura() : removeOnChangePet(false), damage(0) { } PetAura(uint32 petEntry, uint32 aura, bool _removeOnChangePet, int _damage) : removeOnChangePet(_removeOnChangePet), damage(_damage) 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 8d2d9f8b4c1..172423187e1 100644 --- 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 @@ -263,6 +263,8 @@ class instance_trial_of_the_crusader : public InstanceMapScript if (ResilienceWillFixItTimer > 0) DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_CHAMPIONS_KILLED_IN_MINUTE); DoRespawnGameObject(CrusadersCacheGUID, 7*DAY); + if (GameObject* cache = instance->GetGameObject(CrusadersCacheGUID)) + cache->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); EventStage = 3100; break; default: diff --git a/src/tools/mesh_extractor/DBC.cpp b/src/tools/mesh_extractor/DBC.cpp index 9a55ff6d7ed..281a11d10dc 100644 --- a/src/tools/mesh_extractor/DBC.cpp +++ b/src/tools/mesh_extractor/DBC.cpp @@ -56,7 +56,7 @@ std::string DBC::GetStringByOffset( int offset ) strcpy(d, (const char*)(StringBlock + offset)); d[len] = '\0'; std::string val = std::string(d); - delete d; + delete [] d; return val; } diff --git a/src/tools/mesh_extractor/Utils.cpp b/src/tools/mesh_extractor/Utils.cpp index acb1ed38e27..33c30d7522c 100644 --- a/src/tools/mesh_extractor/Utils.cpp +++ b/src/tools/mesh_extractor/Utils.cpp @@ -226,7 +226,7 @@ void Utils::SaveToDisk( FILE* stream, std::string path ) // Close the filestream fclose(disk); // Free the used memory - delete data; + delete [] data; } Vector3 Utils::ToWoWCoords( Vector3 vec ) |