diff options
-rw-r--r-- | src/server/game/DataStores/DB2Structure.h | 18 | ||||
-rw-r--r-- | src/server/game/Entities/Item/Item.cpp | 4 | ||||
-rw-r--r-- | src/server/game/Entities/Item/ItemTemplate.h | 16 | ||||
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 65 | ||||
-rw-r--r-- | src/server/game/Entities/Player/Player.h | 13 | ||||
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 9 | ||||
-rw-r--r-- | src/server/game/Handlers/CalendarHandler.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Handlers/SpellHandler.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Loot/LootMgr.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Spells/Spell.cpp | 28 | ||||
-rw-r--r-- | src/server/game/Spells/SpellEffects.cpp | 4 | ||||
-rw-r--r-- | src/server/game/Spells/SpellHistory.cpp | 10 | ||||
-rw-r--r-- | src/server/game/Spells/SpellHistory.h | 3 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_lookup.cpp | 3 |
14 files changed, 74 insertions, 105 deletions
diff --git a/src/server/game/DataStores/DB2Structure.h b/src/server/game/DataStores/DB2Structure.h index be0ee1b9e75..30044aed5ce 100644 --- a/src/server/game/DataStores/DB2Structure.h +++ b/src/server/game/DataStores/DB2Structure.h @@ -64,7 +64,7 @@ struct HolidaysEntry uint32 CalendarFlags[MAX_HOLIDAY_FLAGS]; // 29-38 //uint32 HolidayNameID; // 39 HolidayNames.dbc //uint32 HolidayDescriptionID; // 40 HolidayDescriptions.dbc - char* TextureFilename; // 41 + LocalizedString* TextureFilename; // 41 uint32 Priority; // 42 uint32 CalendarFilterType; // 43 (-1 = Fishing Contest, 0 = Unk, 1 = Darkmoon Festival, 2 = Yearly holiday) //uint32 Flags; // 44 (0 = Darkmoon Faire, Fishing Contest and Wotlk Launch, rest is 1) @@ -389,14 +389,14 @@ struct SpellTotemsEntry struct TaxiNodesEntry { - uint32 ID; // 0 - uint32 MapID; // 1 - DBCPosition3D Pos; // 2-4 - char* Name_lang; // 5 - uint32 MountCreatureID[2]; // 6-7 - uint32 ConditionID; // 8 - uint32 Flags; // 9 - float MapOffset[2]; // 10-11 + uint32 ID; // 0 + uint32 MapID; // 1 + DBCPosition3D Pos; // 2-4 + LocalizedString* Name_lang; // 5 + uint32 MountCreatureID[2]; // 6-7 + uint32 ConditionID; // 8 + uint32 Flags; // 9 + float MapOffset[2]; // 10-11 }; struct TaxiPathEntry diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index 0c88ea937e7..5534b6e08e3 100644 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -289,8 +289,8 @@ bool Item::Create(ObjectGuid::LowType guidlow, uint32 itemid, Player const* owne SetUInt32Value(ITEM_FIELD_MAXDURABILITY, itemProto->MaxDurability); SetUInt32Value(ITEM_FIELD_DURABILITY, itemProto->MaxDurability); - for (uint8 i = 0; i < itemProto->Effects.size(); ++i) - SetSpellCharges(i, itemProto->Effects[i].Charges); + for (uint8 i = 0; i < itemProto->Effects.size() && i < 5; ++i) + SetSpellCharges(i, itemProto->Effects[i]->Charges); SetUInt32Value(ITEM_FIELD_DURATION, itemProto->GetDuration()); SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, 0); diff --git a/src/server/game/Entities/Item/ItemTemplate.h b/src/server/game/Entities/Item/ItemTemplate.h index 0a089a09b15..abba96cf6dc 100644 --- a/src/server/game/Entities/Item/ItemTemplate.h +++ b/src/server/game/Entities/Item/ItemTemplate.h @@ -581,20 +581,6 @@ const uint32 MaxItemSubclassValues[MAX_ITEM_CLASS] = MAX_ITEM_SUBCLASS_GLYPH }; -#pragma pack(push, 1) - -struct ItemEffect -{ - uint32 SpellID; - uint32 Trigger; - int32 Charges; - int32 Cooldown; - uint32 Category; - int32 CategoryCooldown; -}; - -#pragma pack(pop) - #define MIN_ITEM_LEVEL 1 #define MAX_ITEM_LEVEL 1000 @@ -657,7 +643,7 @@ struct ItemTemplate void GetBaseDamage(float& minDamage, float& maxDamage) const { GetDamage(ExtendedData->ItemLevel, minDamage, maxDamage); } uint32 MaxDurability; - std::vector<ItemEffect> Effects; + std::vector<ItemEffectEntry const*> Effects; // extra fields, not part of db2 files uint32 ScriptId; diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index d5d550ba4b9..c23e5311c9c 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -1164,7 +1164,7 @@ bool Player::Create(ObjectGuid::LowType guidlow, WorldPackets::Character::Charac { if (iProto->Effects.size() >= 1) { - switch (iProto->Effects[0].Category) + switch (iProto->Effects[0]->Category) { case SPELL_CATEGORY_FOOD: // food count = getClass() == CLASS_DEATH_KNIGHT ? 10 : 4; @@ -7967,14 +7967,14 @@ void Player::ApplyItemEquipSpell(Item* item, bool apply, bool form_change) for (uint8 i = 0; i < proto->Effects.size(); ++i) { - ItemEffect const& effectData = proto->Effects[i]; + ItemEffectEntry const* effectData = proto->Effects[i]; // wrong triggering type - if (apply && effectData.Trigger != ITEM_SPELLTRIGGER_ON_EQUIP) + if (apply && effectData->Trigger != ITEM_SPELLTRIGGER_ON_EQUIP) continue; // check if it is valid spell - SpellInfo const* spellproto = sSpellMgr->GetSpellInfo(effectData.SpellID); + SpellInfo const* spellproto = sSpellMgr->GetSpellInfo(effectData->SpellID); if (!spellproto) continue; @@ -8091,16 +8091,16 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 { for (uint8 i = 0; i < proto->Effects.size(); ++i) { - ItemEffect const& effectData = proto->Effects[i]; + ItemEffectEntry const* effectData = proto->Effects[i]; // wrong triggering type - if (effectData.Trigger != ITEM_SPELLTRIGGER_CHANCE_ON_HIT) + if (effectData->Trigger != ITEM_SPELLTRIGGER_CHANCE_ON_HIT) continue; - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(effectData.SpellID); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(effectData->SpellID); if (!spellInfo) { - TC_LOG_ERROR("entities.player.items", "WORLD: unknown Item spellid %i", effectData.SpellID); + TC_LOG_ERROR("entities.player.items", "WORLD: unknown Item spellid %i", effectData->SpellID); continue; } @@ -8194,10 +8194,10 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8 // special learning case if (proto->Effects.size() >= 2) { - if (proto->Effects[0].SpellID == 483 || proto->Effects[0].SpellID == 55884) + if (proto->Effects[0]->SpellID == 483 || proto->Effects[0]->SpellID == 55884) { - uint32 learn_spell_id = proto->Effects[0].SpellID; - uint32 learning_spell_id = proto->Effects[1].SpellID; + uint32 learn_spell_id = proto->Effects[0]->SpellID; + uint32 learning_spell_id = proto->Effects[1]->SpellID; SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(learn_spell_id); if (!spellInfo) @@ -8222,16 +8222,16 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8 // item spells cast at use for (uint8 i = 0; i < proto->Effects.size(); ++i) { - ItemEffect const& effectData = proto->Effects[i]; + ItemEffectEntry const* effectData = proto->Effects[i]; // wrong triggering type - if (effectData.Trigger != ITEM_SPELLTRIGGER_ON_USE) + if (effectData->Trigger != ITEM_SPELLTRIGGER_ON_USE) continue; - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(effectData.SpellID); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(effectData->SpellID); if (!spellInfo) { - TC_LOG_ERROR("entities.player", "Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring", proto->GetId(), effectData.SpellID); + TC_LOG_ERROR("entities.player", "Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring", proto->GetId(), effectData->SpellID); continue; } @@ -11365,8 +11365,8 @@ InventoryResult Player::CanUseItem(ItemTemplate const* proto) const // learning (recipes, mounts, pets, etc.) if (proto->Effects.size() >= 2) - if (proto->Effects[0].SpellID == 483 || proto->Effects[0].SpellID == 55884) - if (HasSpell(proto->Effects[1].SpellID)) + if (proto->Effects[0]->SpellID == 483 || proto->Effects[0]->SpellID == 55884) + if (HasSpell(proto->Effects[1]->SpellID)) return EQUIP_ERR_INTERNAL_BAG_ERROR; return EQUIP_ERR_OK; @@ -11573,10 +11573,10 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool const ItemTemplate* proto = pItem->GetTemplate(); for (uint8 i = 0; i < proto->Effects.size(); ++i) - if (proto->Effects[i].Trigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE) // On obtain trigger + if (proto->Effects[i]->Trigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE) // On obtain trigger if (bag == INVENTORY_SLOT_BAG_0 || (bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END)) - if (!HasAura(proto->Effects[i].SpellID)) - CastSpell(this, proto->Effects[i].SpellID, true, pItem); + if (!HasAura(proto->Effects[i]->SpellID)) + CastSpell(this, proto->Effects[i]->SpellID, true, pItem); return pItem; } @@ -11616,10 +11616,10 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool const ItemTemplate* proto = pItem2->GetTemplate(); for (uint8 i = 0; i < proto->Effects.size(); ++i) - if (proto->Effects[i].Trigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE) // On obtain trigger + if (proto->Effects[i]->Trigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE) // On obtain trigger if (bag == INVENTORY_SLOT_BAG_0 || (bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END)) - if (!HasAura(proto->Effects[i].SpellID)) - CastSpell(this, proto->Effects[i].SpellID, true, pItem2); + if (!HasAura(proto->Effects[i]->SpellID)) + CastSpell(this, proto->Effects[i]->SpellID, true, pItem2); return pItem2; } @@ -11964,8 +11964,8 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update) const ItemTemplate* proto = pItem->GetTemplate(); for (uint8 i = 0; i < proto->Effects.size(); ++i) - if (proto->Effects[i].Trigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE) // On obtain trigger - RemoveAurasDueToSpell(proto->Effects[i].SpellID); + if (proto->Effects[i]->Trigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE) // On obtain trigger + RemoveAurasDueToSpell(proto->Effects[i]->SpellID); ItemRemovedQuestCheck(pItem->GetEntry(), pItem->GetCount()); sScriptMgr->OnItemRemove(this, pItem); @@ -21618,8 +21618,8 @@ void Player::UpdatePotionCooldown(Spell* spell) // spell/item pair let set proper cooldown (except not existed charged spell cooldown spellmods for potions) if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(m_lastPotionId)) for (uint8 idx = 0; idx < proto->Effects.size(); ++idx) - if (proto->Effects[idx].Trigger == ITEM_SPELLTRIGGER_ON_USE) - if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(proto->Effects[idx].SpellID)) + if (proto->Effects[idx]->Trigger == ITEM_SPELLTRIGGER_ON_USE) + if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(proto->Effects[idx]->SpellID)) GetSpellHistory()->SendCooldownEvent(spellInfo, m_lastPotionId); } // from spell cases (m_lastPotionId set in Spell::SendSpellCooldown) @@ -22543,22 +22543,21 @@ void Player::ApplyEquipCooldown(Item* pItem) for (uint8 i = 0; i < proto->Effects.size(); ++i) { - ItemEffect const& effectData = proto->Effects[i]; + ItemEffectEntry const* effectData = proto->Effects[i]; // wrong triggering type (note: ITEM_SPELLTRIGGER_ON_NO_DELAY_USE not have cooldown) - if (effectData.Trigger != ITEM_SPELLTRIGGER_ON_USE) + if (effectData->Trigger != ITEM_SPELLTRIGGER_ON_USE) continue; // Don't replace longer cooldowns by equip cooldown if we have any. - SpellCooldowns::iterator itr = m_spellCooldowns.find(effectData.SpellID); - if (itr != m_spellCooldowns.end() && itr->second.itemid == pItem->GetEntry() && itr->second.end > time(NULL) + 30) + if (GetSpellHistory()->GetRemainingCooldown(effectData->SpellID) > 30 * IN_MILLISECONDS) continue; - GetSpellHistory()->AddCooldown(effectData.SpellID, pItem->GetEntry(), std::chrono::seconds(30)); + GetSpellHistory()->AddCooldown(effectData->SpellID, pItem->GetEntry(), std::chrono::seconds(30)); WorldPacket data(SMSG_ITEM_COOLDOWN, 12); data << pItem->GetGUID(); - data << uint32(effectData.SpellID); + data << uint32(effectData->SpellID); GetSession()->SendPacket(&data); } } diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index b981b316d0c..a2d5ed72bd8 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -285,13 +285,6 @@ struct CUFProfile // More fields can be added to BoolOptions without changing DB schema (up to 32, currently 27) }; -struct SpellCooldown -{ - time_t end; - uint16 itemid; -}; - -typedef std::map<uint32, SpellCooldown> SpellCooldowns; typedef std::unordered_map<uint32 /*instanceId*/, time_t/*releaseTime*/> InstanceTimeMap; enum TrainerSpellState @@ -1938,8 +1931,6 @@ class Player : public Unit, public GridObject<Player> PlayerSpellMap const& GetSpellMap() const { return m_spells; } PlayerSpellMap & GetSpellMap() { return m_spells; } - SpellCooldowns const& GetSpellCooldownMap() const { return m_spellCooldowns; } - void AddSpellMod(SpellModifier* mod, bool apply); bool IsAffectedBySpellmod(SpellInfo const* spellInfo, SpellModifier* mod, Spell* spell = NULL); template <class T> T ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell* spell = NULL); @@ -2243,8 +2234,6 @@ class Player : public Unit, public GridObject<Player> //End of PvP System - inline SpellCooldowns GetSpellCooldowns() const { return m_spellCooldowns; } - void SetDrunkValue(uint8 newDrunkValue, uint32 itemId = 0); uint8 GetDrunkValue() const { return GetByteValue(PLAYER_BYTES_3, PLAYER_BYTES_3_OFFSET_INEBRIATION); } static DrunkenState GetDrunkenstateByValue(uint8 value); @@ -2980,8 +2969,6 @@ class Player : public Unit, public GridObject<Player> AchievementMgr<Player>* m_achievementMgr; ReputationMgr* m_reputationMgr; - SpellCooldowns m_spellCooldowns; - uint32 m_ChampioningFaction; std::queue<uint32> m_timeSyncQueue; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 25d6512acaf..479b63008d4 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -2438,14 +2438,7 @@ void ObjectMgr::LoadItemTemplates() if (itemItr == _itemTemplateStore.end()) continue; - ItemEffect effect; - effect.SpellID = effectEntry->SpellID; - effect.Trigger = effectEntry->Trigger; - effect.Charges = effectEntry->Charges; - effect.Cooldown = effectEntry->Cooldown; - effect.Category = effectEntry->Category; - effect.CategoryCooldown = effectEntry->CategoryCooldown; - itemItr->second.Effects.push_back(effect); + itemItr->second.Effects.push_back(effectEntry); } // Check if item templates for DBC referenced character start outfit are present diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp index 74df5b443bd..ee5bc6cd84a 100644 --- a/src/server/game/Handlers/CalendarHandler.cpp +++ b/src/server/game/Handlers/CalendarHandler.cpp @@ -173,7 +173,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/) for (uint8 j = 0; j < MAX_HOLIDAY_FLAGS; ++j) data << uint32(holiday->CalendarFlags[j]); // 10 * m_calendarFlags - data << holiday->TextureFilename; // m_textureFilename (holiday name) + data << holiday->TextureFilename->Str[sWorld->GetDefaultDbcLocale()]; // m_textureFilename (holiday name) } SendPacket(&data); diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp index c86ff147559..b3a094b86c5 100644 --- a/src/server/game/Handlers/SpellHandler.cpp +++ b/src/server/game/Handlers/SpellHandler.cpp @@ -98,7 +98,7 @@ void WorldSession::HandleUseItemOpcode(WorldPackets::Spells::UseItem& packet) { for (uint32 i = 0; i < proto->Effects.size(); ++i) { - if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(proto->Effects[i].SpellID)) + if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(proto->Effects[i]->SpellID)) { if (!spellInfo->CanBeUsedInCombat()) { diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index 5cffc0eb7aa..53413dc55f3 100644 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -392,7 +392,7 @@ bool LootItem::AllowedForPlayer(Player const* player) const return false; // not show loot for players without profession or those who already know the recipe - if ((pProto->GetFlags() & ITEM_PROTO_FLAG_SMART_LOOT) && (!player->HasSkill(pProto->GetRequiredSkill()) || player->HasSpell(pProto->Effects[1].SpellID))) + if ((pProto->GetFlags() & ITEM_PROTO_FLAG_SMART_LOOT) && (!player->HasSkill(pProto->GetRequiredSkill()) || player->HasSpell(pProto->Effects[1]->SpellID))) return false; // not show loot for not own team diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 3279e524b0c..61315062b10 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -4398,12 +4398,12 @@ void Spell::TakeCastItem() bool expendable = false; bool withoutCharges = false; - for (uint8 i = 0; i < proto->Effects.size(); ++i) + for (uint8 i = 0; i < proto->Effects.size() && i < 5; ++i) { // item has limited charges - if (proto->Effects[i].Charges) + if (proto->Effects[i]->Charges) { - if (proto->Effects[i].Charges < 0) + if (proto->Effects[i]->Charges < 0) expendable = true; int32 charges = m_CastItem->GetSpellCharges(i); @@ -4640,11 +4640,11 @@ void Spell::TakeReagents() // if CastItem is also spell reagent if (castItemTemplate && castItemTemplate->GetId() == itemid) { - for (uint8 s = 0; s < castItemTemplate->Effects.size(); ++s) + for (uint8 s = 0; s < castItemTemplate->Effects.size() && s < 5; ++s) { // CastItem will be used up and does not count as reagent int32 charges = m_CastItem->GetSpellCharges(s); - if (castItemTemplate->Effects[s].Charges < 0 && abs(charges) < 2) + if (castItemTemplate->Effects[s]->Charges < 0 && abs(charges) < 2) { ++itemcount; break; @@ -6014,8 +6014,8 @@ SpellCastResult Spell::CheckItems() if (!proto) return SPELL_FAILED_ITEM_NOT_READY; - for (uint8 i = 0; i < proto->Effects.size(); ++i) - if (proto->Effects[i].Charges) + for (uint8 i = 0; i < proto->Effects.size() && i < 5; ++i) + if (proto->Effects[i]->Charges) if (m_CastItem->GetSpellCharges(i) == 0) return SPELL_FAILED_NO_CHARGES_REMAIN; @@ -6115,11 +6115,11 @@ SpellCastResult Spell::CheckItems() ItemTemplate const* proto = m_CastItem->GetTemplate(); if (!proto) return SPELL_FAILED_ITEM_NOT_READY; - for (uint8 s = 0; s < proto->Effects.size(); ++s) + for (uint8 s = 0; s < proto->Effects.size() && s < 5; ++s) { // CastItem will be used up and does not count as reagent int32 charges = m_CastItem->GetSpellCharges(s); - if (proto->Effects[s].Charges < 0 && abs(charges) < 2) + if (proto->Effects[s]->Charges < 0 && abs(charges) < 2) { ++itemcount; break; @@ -6220,9 +6220,9 @@ SpellCastResult Spell::CheckItems() ItemTemplate const* proto = targetItem->GetTemplate(); for (uint8 e = 0; e < proto->Effects.size(); ++e) { - if (proto->Effects[e].SpellID && ( - proto->Effects[e].Trigger == ITEM_SPELLTRIGGER_ON_USE || - proto->Effects[e].Trigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE)) + if (proto->Effects[e]->SpellID && ( + proto->Effects[e]->Trigger == ITEM_SPELLTRIGGER_ON_USE || + proto->Effects[e]->Trigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE)) { isItemUsable = true; break; @@ -6399,8 +6399,8 @@ SpellCastResult Spell::CheckItems() if (Item* pitem = player->GetItemByEntry(item_id)) { - for (uint8 x = 0; x < pProto->Effects.size(); ++x) - if (pProto->Effects[x].Charges != 0 && pitem->GetSpellCharges(x) == pProto->Effects[x].Charges) + for (uint8 x = 0; x < pProto->Effects.size() && x < 5; ++x) + if (pProto->Effects[x]->Charges != 0 && pitem->GetSpellCharges(x) == pProto->Effects[x]->Charges) return SPELL_FAILED_ITEM_AT_MAX_CHARGES; } break; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index c08b3e6ec23..db332f2fc49 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -5655,8 +5655,8 @@ void Spell::EffectRechargeManaGem(SpellEffIndex /*effIndex*/) if (Item* pItem = player->GetItemByEntry(item_id)) { - for (size_t x = 0; x < pProto->Effects.size(); ++x) - pItem->SetSpellCharges(x, pProto->Effects[x].Charges); + for (size_t x = 0; x < pProto->Effects.size() && x < 5; ++x) + pItem->SetSpellCharges(x, pProto->Effects[x]->Charges); pItem->SetState(ITEM_CHANGED, player); } } diff --git a/src/server/game/Spells/SpellHistory.cpp b/src/server/game/Spells/SpellHistory.cpp index 4060122630d..4ad1311c10b 100644 --- a/src/server/game/Spells/SpellHistory.cpp +++ b/src/server/game/Spells/SpellHistory.cpp @@ -366,13 +366,13 @@ void SpellHistory::StartCooldown(SpellInfo const* spellInfo, uint32 itemId, Spel { if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemId)) { - for (uint8 idx = 0; idx < proto->Effects.size(); ++idx) + for (ItemEffectEntry const* itemEffect : proto->Effects) { - if (uint32(proto->Effects[idx].SpellID) == spellInfo->Id) + if (itemEffect->SpellID == spellInfo->Id) { - categoryId = proto->Effects[idx].Category; - cooldown = proto->Effects[idx].Cooldown; - categoryCooldown = proto->Effects[idx].CategoryCooldown; + categoryId = itemEffect->Category; + cooldown = itemEffect->Cooldown; + categoryCooldown = itemEffect->CategoryCooldown; break; } } diff --git a/src/server/game/Spells/SpellHistory.h b/src/server/game/Spells/SpellHistory.h index 38ae922750c..a55f57aa9f4 100644 --- a/src/server/game/Spells/SpellHistory.h +++ b/src/server/game/Spells/SpellHistory.h @@ -107,7 +107,10 @@ public: for (auto itr = _spellCooldowns.begin(); itr != _spellCooldowns.end();) { if (predicate(itr)) + { + resetCooldowns.push_back(int32(itr->first)); ResetCooldown(itr, false); + } else ++itr; } diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp index 41bd04c5dca..9119fdbe76d 100644 --- a/src/server/scripts/Commands/cs_lookup.cpp +++ b/src/server/scripts/Commands/cs_lookup.cpp @@ -946,6 +946,7 @@ public: bool found = false; uint32 count = 0; uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); + int32 locale = handler->GetSessionDbcLocale(); // Search in TaxiNodes.dbc for (uint32 id = 0; id < sTaxiNodesStore.GetNumRows(); id++) @@ -953,7 +954,7 @@ public: TaxiNodesEntry const* nodeEntry = sTaxiNodesStore.LookupEntry(id); if (nodeEntry) { - std::string name = nodeEntry->Name_lang; + std::string name = nodeEntry->Name_lang->Str[locale]; if (name.empty()) continue; |