Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -r 864820a88a38 -r 301845e6ca3b src/game/Spell.cpp
- --- a/src/game/Spell.cpp Mon Sep 05 13:27:30 2011 +0600
- +++ b/src/game/Spell.cpp Thu Sep 08 15:03:26 2011 +0600
- @@ -2747,6 +2747,7 @@
- TakePower();
- TakeReagents(); // we must remove reagents before HandleEffects to allow place crafted item in same slot
- + TakeAmmo();
- SendCastResult(castResult);
- SendSpellGo(); // we must send smsg_spell_go packet before m_castItem delete in TakeCastItem()...
- @@ -3714,6 +3715,35 @@
- m_caster->SetLastManaUse();
- }
- +void Spell::TakeAmmo()
- +{
- + if (m_attackType == RANGED_ATTACK && m_caster->GetTypeId() == TYPEID_PLAYER)
- + {
- + Item* pItem = ((Player*)m_caster)->GetWeaponForAttack(RANGED_ATTACK, true, false);
- +
- + // wands don't have ammo
- + if (!pItem || pItem->GetProto()->SubClass == ITEM_SUBCLASS_WEAPON_WAND)
- + return;
- +
- + if (pItem->GetProto()->InventoryType == INVTYPE_THROWN)
- + {
- + if (pItem->GetMaxStackCount() == 1)
- + {
- + // decrease durability for non-stackable throw weapon
- + ((Player*)m_caster)->DurabilityPointLossForEquipSlot(EQUIPMENT_SLOT_RANGED);
- + }
- + else
- + {
- + // decrease items amount for stackable throw weapon
- + uint32 count = 1;
- + ((Player*)m_caster)->DestroyItemCount(pItem, count, true);
- + }
- + }
- + else if (uint32 ammo = ((Player*)m_caster)->GetUInt32Value(PLAYER_AMMO_ID))
- + ((Player*)m_caster)->DestroyItemCount(ammo, 1, true);
- + }
- +}
- +
- void Spell::TakeReagents()
- {
- if (m_caster->GetTypeId() != TYPEID_PLAYER)
- diff -r 864820a88a38 -r 301845e6ca3b src/game/Spell.h
- --- a/src/game/Spell.h Mon Sep 05 13:27:30 2011 +0600
- +++ b/src/game/Spell.h Thu Sep 08 15:03:26 2011 +0600
- @@ -305,6 +305,7 @@
- void cast(bool skipCheck = false);
- void finish(bool ok = true);
- void TakePower();
- + void TakeAmmo();
- void TakeReagents();
- void TakeCastItem();
- diff -r 864820a88a38 -r 301845e6ca3b src/game/SpellEffects.cpp
- --- a/src/game/SpellEffects.cpp Mon Sep 05 13:27:30 2011 +0600
- +++ b/src/game/SpellEffects.cpp Thu Sep 08 15:03:26 2011 +0600
- @@ -3207,33 +3207,6 @@
- if(m_caster->GetTypeId()==TYPEID_PLAYER)
- ((Player*)m_caster)->AddComboPoints(unitTarget, 1);
- }
- -
- - // take ammo
- - if(m_attackType == RANGED_ATTACK && m_caster->GetTypeId() == TYPEID_PLAYER)
- - {
- - Item *pItem = ((Player*)m_caster)->GetWeaponForAttack(RANGED_ATTACK, true, false);
- -
- - // wands don't have ammo
- - if (!pItem || pItem->GetProto()->SubClass == ITEM_SUBCLASS_WEAPON_WAND)
- - return;
- -
- - if (pItem->GetProto()->InventoryType == INVTYPE_THROWN)
- - {
- - if(pItem->GetMaxStackCount()==1)
- - {
- - // decrease durability for non-stackable throw weapon
- - ((Player*)m_caster)->DurabilityPointLossForEquipSlot(EQUIPMENT_SLOT_RANGED);
- - }
- - else
- - {
- - // decrease items amount for stackable throw weapon
- - uint32 count = 1;
- - ((Player*)m_caster)->DestroyItemCount( pItem, count, true);
- - }
- - }
- - else if(uint32 ammo = ((Player*)m_caster)->GetUInt32Value(PLAYER_AMMO_ID))
- - ((Player*)m_caster)->DestroyItemCount(ammo, 1, true);
- - }
- }
- void Spell::EffectThreat(SpellEffectIndex /*eff_idx*/)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement