*Do not apply auras with 4th diminishing level
*Some fixes related to last commit. --HG-- branch : trunk
This commit is contained in:
@@ -117,7 +117,7 @@ enum ITEM_FLAGS
|
|||||||
ITEM_FLAGS_THROWABLE = 0x00400000, // not used in game for check trow possibility, only for item in game tooltip
|
ITEM_FLAGS_THROWABLE = 0x00400000, // not used in game for check trow possibility, only for item in game tooltip
|
||||||
ITEM_FLAGS_SPECIALUSE = 0x00800000, // last used flag in 2.3.0
|
ITEM_FLAGS_SPECIALUSE = 0x00800000, // last used flag in 2.3.0
|
||||||
ITEM_FLAGS_BOA = 0x08000000, // bind on account
|
ITEM_FLAGS_BOA = 0x08000000, // bind on account
|
||||||
ITEM_FLAGS_NO_REAGENT_CAST = 0x10000000, // used by enchanting scrolls made with vellum
|
ITEM_FLAGS_TRIGGERED_CAST = 0x10000000, // used by enchanting scrolls made with vellum
|
||||||
ITEM_FLAGS_MILLABLE = 0x20000000
|
ITEM_FLAGS_MILLABLE = 0x20000000
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -6957,7 +6957,7 @@ void Player::CastItemUseSpell(Item *item,SpellCastTargets const& targets,uint8 c
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Spell *spell = new Spell(this, spellInfo, false);
|
Spell *spell = new Spell(this, spellInfo,false);
|
||||||
spell->m_CastItem = item;
|
spell->m_CastItem = item;
|
||||||
spell->m_cast_count = cast_count; //set count of casts
|
spell->m_cast_count = cast_count; //set count of casts
|
||||||
spell->m_currentBasePoints[0] = learning_spell_id;
|
spell->m_currentBasePoints[0] = learning_spell_id;
|
||||||
|
|||||||
+69
-71
@@ -590,11 +590,8 @@ void Spell::FillTargetMap()
|
|||||||
if(Guardian* pet = m_caster->GetGuardianPet())
|
if(Guardian* pet = m_caster->GetGuardianPet())
|
||||||
tmpUnitMap.push_back(pet);
|
tmpUnitMap.push_back(pet);
|
||||||
break;
|
break;
|
||||||
case SPELL_EFFECT_ENCHANT_ITEM:
|
/*case SPELL_EFFECT_ENCHANT_ITEM:
|
||||||
// add caster as unit target-needed by vellums to define who gets item
|
case SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY:
|
||||||
AddUnitTarget(m_caster, i);
|
|
||||||
break;
|
|
||||||
/*case SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY:
|
|
||||||
case SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC:
|
case SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC:
|
||||||
case SPELL_EFFECT_DISENCHANT:
|
case SPELL_EFFECT_DISENCHANT:
|
||||||
case SPELL_EFFECT_PROSPECTING:
|
case SPELL_EFFECT_PROSPECTING:
|
||||||
@@ -3508,13 +3505,13 @@ void Spell::TakeReagents()
|
|||||||
if(m_IsTriggeredSpell) // reagents used in triggered spell removed by original spell or don't must be removed.
|
if(m_IsTriggeredSpell) // reagents used in triggered spell removed by original spell or don't must be removed.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_CastItem)
|
|
||||||
if (m_CastItem->GetProto()->Flags & ITEM_FLAGS_NO_REAGENT_CAST)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// do not take reagents for these item casts
|
||||||
|
if (m_CastItem && m_CastItem->GetProto()->Flags & ITEM_FLAGS_TRIGGERED_CAST)
|
||||||
|
return;
|
||||||
|
|
||||||
Player* p_caster = (Player*)m_caster;
|
Player* p_caster = (Player*)m_caster;
|
||||||
if (p_caster->CanNoReagentCast(m_spellInfo))
|
if (p_caster->CanNoReagentCast(m_spellInfo))
|
||||||
return;
|
return;
|
||||||
@@ -3636,8 +3633,8 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||||||
return SPELL_FAILED_DONT_REPORT;
|
return SPELL_FAILED_DONT_REPORT;
|
||||||
|
|
||||||
// only check at first call, Stealth auras are already removed at second call
|
// only check at first call, Stealth auras are already removed at second call
|
||||||
// for now, ignore triggered by aura spells
|
// for now, ignore triggered spells
|
||||||
if( strict && !m_triggeredByAuraSpell)
|
if( strict && !m_IsTriggeredSpell)
|
||||||
{
|
{
|
||||||
bool checkForm = true;
|
bool checkForm = true;
|
||||||
// Ignore form req aura
|
// Ignore form req aura
|
||||||
@@ -4923,73 +4920,77 @@ SpellCastResult Spell::CheckItems()
|
|||||||
focusObject = ok; // game object found in range
|
focusObject = ok; // game object found in range
|
||||||
}
|
}
|
||||||
|
|
||||||
// check reagents (ignore triggered spells with reagents processed by original spell) and special reagent ignore case.
|
// do not take reagents for these item casts
|
||||||
if (!m_IsTriggeredSpell && !p_caster->CanNoReagentCast(m_spellInfo))
|
if (!(m_CastItem && m_CastItem->GetProto()->Flags & ITEM_FLAGS_TRIGGERED_CAST))
|
||||||
{
|
{
|
||||||
for(uint32 i=0;i<8;i++)
|
// check reagents (ignore triggered spells with reagents processed by original spell) and special reagent ignore case.
|
||||||
|
if (!m_IsTriggeredSpell && !p_caster->CanNoReagentCast(m_spellInfo))
|
||||||
{
|
{
|
||||||
if(m_spellInfo->Reagent[i] <= 0)
|
for(uint32 i=0;i<8;i++)
|
||||||
continue;
|
|
||||||
|
|
||||||
uint32 itemid = m_spellInfo->Reagent[i];
|
|
||||||
uint32 itemcount = m_spellInfo->ReagentCount[i];
|
|
||||||
|
|
||||||
// if CastItem is also spell reagent
|
|
||||||
if( m_CastItem && m_CastItem->GetEntry() == itemid )
|
|
||||||
{
|
{
|
||||||
ItemPrototype const *proto = m_CastItem->GetProto();
|
if(m_spellInfo->Reagent[i] <= 0)
|
||||||
if(!proto)
|
continue;
|
||||||
return SPELL_FAILED_ITEM_NOT_READY;
|
|
||||||
for(int s=0; s < MAX_ITEM_PROTO_SPELLS; ++s)
|
uint32 itemid = m_spellInfo->Reagent[i];
|
||||||
|
uint32 itemcount = m_spellInfo->ReagentCount[i];
|
||||||
|
|
||||||
|
// if CastItem is also spell reagent
|
||||||
|
if( m_CastItem && m_CastItem->GetEntry() == itemid )
|
||||||
{
|
{
|
||||||
// CastItem will be used up and does not count as reagent
|
ItemPrototype const *proto = m_CastItem->GetProto();
|
||||||
int32 charges = m_CastItem->GetSpellCharges(s);
|
if(!proto)
|
||||||
if (proto->Spells[s].SpellCharges < 0 && abs(charges) < 2)
|
return SPELL_FAILED_ITEM_NOT_READY;
|
||||||
|
for(int s=0; s < MAX_ITEM_PROTO_SPELLS; ++s)
|
||||||
{
|
{
|
||||||
++itemcount;
|
// CastItem will be used up and does not count as reagent
|
||||||
break;
|
int32 charges = m_CastItem->GetSpellCharges(s);
|
||||||
|
if (proto->Spells[s].SpellCharges < 0 && abs(charges) < 2)
|
||||||
|
{
|
||||||
|
++itemcount;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if( !p_caster->HasItemCount(itemid,itemcount) )
|
||||||
|
return SPELL_FAILED_ITEM_NOT_READY; //0x54
|
||||||
}
|
}
|
||||||
if( !p_caster->HasItemCount(itemid,itemcount) )
|
|
||||||
return SPELL_FAILED_ITEM_NOT_READY; //0x54
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// check totem-item requirements (items presence in inventory)
|
// check totem-item requirements (items presence in inventory)
|
||||||
uint32 totems = 2;
|
uint32 totems = 2;
|
||||||
for(int i=0;i<2;++i)
|
for(int i=0;i<2;++i)
|
||||||
{
|
|
||||||
if(m_spellInfo->Totem[i] != 0)
|
|
||||||
{
|
{
|
||||||
if( p_caster->HasItemCount(m_spellInfo->Totem[i],1) )
|
if(m_spellInfo->Totem[i] != 0)
|
||||||
{
|
{
|
||||||
totems -= 1;
|
if( p_caster->HasItemCount(m_spellInfo->Totem[i],1) )
|
||||||
continue;
|
{
|
||||||
|
totems -= 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}else
|
||||||
|
totems -= 1;
|
||||||
|
}
|
||||||
|
if(totems != 0)
|
||||||
|
return SPELL_FAILED_TOTEMS; //0x7C
|
||||||
|
|
||||||
|
// Check items for TotemCategory (items presence in inventory)
|
||||||
|
uint32 TotemCategory = 2;
|
||||||
|
for(int i=0;i<2;++i)
|
||||||
|
{
|
||||||
|
if(m_spellInfo->TotemCategory[i] != 0)
|
||||||
|
{
|
||||||
|
if( p_caster->HasItemTotemCategory(m_spellInfo->TotemCategory[i]) )
|
||||||
|
{
|
||||||
|
TotemCategory -= 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}else
|
else
|
||||||
totems -= 1;
|
|
||||||
}
|
|
||||||
if(totems != 0)
|
|
||||||
return SPELL_FAILED_TOTEMS; //0x7C
|
|
||||||
|
|
||||||
// Check items for TotemCategory (items presence in inventory)
|
|
||||||
uint32 TotemCategory = 2;
|
|
||||||
for(int i=0;i<2;++i)
|
|
||||||
{
|
|
||||||
if(m_spellInfo->TotemCategory[i] != 0)
|
|
||||||
{
|
|
||||||
if( p_caster->HasItemTotemCategory(m_spellInfo->TotemCategory[i]) )
|
|
||||||
{
|
|
||||||
TotemCategory -= 1;
|
TotemCategory -= 1;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
if(TotemCategory != 0)
|
||||||
TotemCategory -= 1;
|
return SPELL_FAILED_TOTEM_CATEGORY; //0x7B
|
||||||
}
|
}
|
||||||
if(TotemCategory != 0)
|
|
||||||
return SPELL_FAILED_TOTEM_CATEGORY; //0x7B
|
|
||||||
|
|
||||||
// special checks for spell effects
|
// special checks for spell effects
|
||||||
for(int i = 0; i < 3; i++)
|
for(int i = 0; i < 3; i++)
|
||||||
@@ -5018,7 +5019,7 @@ SpellCastResult Spell::CheckItems()
|
|||||||
if (m_targets.getItemTarget()->GetOwner()!=m_caster)
|
if (m_targets.getItemTarget()->GetOwner()!=m_caster)
|
||||||
return SPELL_FAILED_NOT_TRADEABLE;
|
return SPELL_FAILED_NOT_TRADEABLE;
|
||||||
// do not allow to enchant vellum from scroll made by vellum-prevent exploit
|
// do not allow to enchant vellum from scroll made by vellum-prevent exploit
|
||||||
if (m_CastItem && m_CastItem->GetProto()->Flags & ITEM_FLAGS_NO_REAGENT_CAST)
|
if (m_CastItem && m_CastItem->GetProto()->Flags & ITEM_FLAGS_TRIGGERED_CAST)
|
||||||
return SPELL_FAILED_TOTEM_CATEGORY;
|
return SPELL_FAILED_TOTEM_CATEGORY;
|
||||||
ItemPosCountVec dest;
|
ItemPosCountVec dest;
|
||||||
uint8 msg = p_caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->EffectItemType[i], 1 );
|
uint8 msg = p_caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->EffectItemType[i], 1 );
|
||||||
@@ -5665,15 +5666,12 @@ void Spell::CalculateDamageDoneForAllTargets()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool usesAmmo = !m_IsTriggeredSpell || m_autoRepeat;
|
bool usesAmmo=true;
|
||||||
if (usesAmmo)
|
Unit::AuraEffectList const& Auras = m_caster->GetAurasByType(SPELL_AURA_ABILITY_CONSUME_NO_AMMO);
|
||||||
|
for(Unit::AuraEffectList::const_iterator j = Auras.begin();j != Auras.end(); ++j)
|
||||||
{
|
{
|
||||||
Unit::AuraEffectList const& Auras = m_caster->GetAurasByType(SPELL_AURA_ABILITY_CONSUME_NO_AMMO);
|
if((*j)->isAffectedOnSpell(m_spellInfo))
|
||||||
for(Unit::AuraEffectList::const_iterator j = Auras.begin();j != Auras.end(); ++j)
|
usesAmmo=false;
|
||||||
{
|
|
||||||
if((*j)->isAffectedOnSpell(m_spellInfo))
|
|
||||||
usesAmmo=false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
|
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ class TRINITY_DLL_SPEC Aura
|
|||||||
int32 GetAuraDuration() const { return m_duration; }
|
int32 GetAuraDuration() const { return m_duration; }
|
||||||
void SetAuraDuration(int32 duration);
|
void SetAuraDuration(int32 duration);
|
||||||
void RefreshAura(){ SetAuraDuration (m_maxduration); }
|
void RefreshAura(){ SetAuraDuration (m_maxduration); }
|
||||||
|
inline bool IsExpired() { if(!GetAuraDuration() && !(IsPermanent() || (IsPassive()))) return true; return false;};
|
||||||
|
|
||||||
void SendAuraUpdate();
|
void SendAuraUpdate();
|
||||||
uint8 GetAuraSlot() const { return m_auraSlot; }
|
uint8 GetAuraSlot() const { return m_auraSlot; }
|
||||||
|
|||||||
@@ -3688,15 +3688,10 @@ void Spell::EffectEnchantItemPerm(uint32 effect_idx)
|
|||||||
// Handle vellums
|
// Handle vellums
|
||||||
if (itemTarget->IsWeaponVellum() || itemTarget->IsArmorVellum())
|
if (itemTarget->IsWeaponVellum() || itemTarget->IsArmorVellum())
|
||||||
{
|
{
|
||||||
// item can be in trade slot and have owner diff. from caster
|
|
||||||
Player* item_owner = itemTarget->GetOwner();
|
|
||||||
if(!item_owner)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// destroy one vellum from stack
|
// destroy one vellum from stack
|
||||||
uint32 count=1;
|
uint32 count=1;
|
||||||
item_owner->DestroyItemCount(itemTarget,count,true);
|
p_caster->DestroyItemCount(itemTarget,count,true);
|
||||||
unitTarget=item_owner;
|
unitTarget=p_caster;
|
||||||
// and add a scroll
|
// and add a scroll
|
||||||
DoCreateItem(effect_idx,m_spellInfo->EffectItemType[effect_idx]);
|
DoCreateItem(effect_idx,m_spellInfo->EffectItemType[effect_idx]);
|
||||||
itemTarget=NULL;
|
itemTarget=NULL;
|
||||||
@@ -3704,8 +3699,9 @@ void Spell::EffectEnchantItemPerm(uint32 effect_idx)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// not grow at item use at item case
|
// do not increase skill if vellum used
|
||||||
p_caster->UpdateCraftSkill(m_spellInfo->Id);
|
if (!(m_CastItem && m_CastItem->GetProto()->Flags & ITEM_FLAGS_TRIGGERED_CAST))
|
||||||
|
p_caster->UpdateCraftSkill(m_spellInfo->Id);
|
||||||
|
|
||||||
uint32 enchant_id = m_spellInfo->EffectMiscValue[effect_idx];
|
uint32 enchant_id = m_spellInfo->EffectMiscValue[effect_idx];
|
||||||
if (!enchant_id)
|
if (!enchant_id)
|
||||||
|
|||||||
+2
-2
@@ -3259,7 +3259,7 @@ void Unit::_UpdateSpells( uint32 time )
|
|||||||
|
|
||||||
for(AuraMap::iterator i = m_Auras.begin(); i != m_Auras.end();)
|
for(AuraMap::iterator i = m_Auras.begin(); i != m_Auras.end();)
|
||||||
{
|
{
|
||||||
if(!i->second->GetAuraDuration() && !(i->second->IsPermanent() || (i->second->IsPassive())))
|
if(i->second->IsExpired())
|
||||||
RemoveAura(i, AURA_REMOVE_BY_EXPIRE);
|
RemoveAura(i, AURA_REMOVE_BY_EXPIRE);
|
||||||
else
|
else
|
||||||
++i;
|
++i;
|
||||||
@@ -3673,7 +3673,7 @@ int32 Unit::GetMaxNegativeAuraModifierByMiscValue(AuraType auratype, int32 misc_
|
|||||||
bool Unit::AddAura(Aura *Aur)
|
bool Unit::AddAura(Aura *Aur)
|
||||||
{
|
{
|
||||||
// aura doesn't apply effects-return
|
// aura doesn't apply effects-return
|
||||||
if (!Aur->GetEffectMask())
|
if (!Aur->GetEffectMask() || Aur->IsExpired())
|
||||||
{
|
{
|
||||||
delete Aur;
|
delete Aur;
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user