mirror of
https://github.com/mangosfour/server.git
synced 2025-12-25 22:37:04 +00:00
[9507] Implement SPELL_EFFECT_RESTORE_ITEM_CHARGES
Also it application in special case of item 5513 and similar.
This commit is contained in:
parent
d775eea9a4
commit
4c4629e861
11 changed files with 105 additions and 3 deletions
|
|
@ -1055,3 +1055,28 @@ bool ItemRequiredTarget::IsFitToRequirements( Unit* pUnitTarget ) const
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Item::HasMaxCharges() const
|
||||
{
|
||||
ItemPrototype const* itemProto = GetProto();
|
||||
|
||||
for(int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
|
||||
if (GetSpellCharges(i) != itemProto->Spells[i].SpellCharges)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Item::RestoreCharges()
|
||||
{
|
||||
ItemPrototype const* itemProto = GetProto();
|
||||
|
||||
for(int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
|
||||
{
|
||||
if (GetSpellCharges(i) != itemProto->Spells[i].SpellCharges)
|
||||
{
|
||||
SetSpellCharges(i, itemProto->Spells[i].SpellCharges);
|
||||
SetState(ITEM_CHANGED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue