Core/Spells: Removed leftovers of old cooldown handling
* Use ItemEffect.db2 data directly instead of copying it to another structure
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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())
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user