mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
Use spell_loot_table for item creating in case SPELL_EFFECT_CREATE_ITEM_2 (157) and itemType==0
This commit is contained in:
parent
118eb563b5
commit
f94377622e
6 changed files with 30 additions and 6 deletions
|
|
@ -1273,7 +1273,7 @@ void LoadLootTemplates_Spell()
|
|||
continue;
|
||||
|
||||
// possible cases
|
||||
if(!IsExplicitDiscoverySpell (spellInfo))
|
||||
if( !IsLootCraftingSpell(spellInfo))
|
||||
continue;
|
||||
|
||||
if(!ids_set.count(spell_id))
|
||||
|
|
|
|||
|
|
@ -19413,7 +19413,7 @@ void Player::InitRunes()
|
|||
SetFloatValue(PLAYER_RUNE_REGEN_1 + i, 0.1f);
|
||||
}
|
||||
|
||||
void Player::AutoStoreLootItem(uint8 bag, uint8 slot, uint32 loot_id, LootStore const& store)
|
||||
bool Player::AutoStoreLootItem(uint8 bag, uint8 slot, uint32 loot_id, LootStore const& store)
|
||||
{
|
||||
Loot loot;
|
||||
loot.FillLoot (loot_id,store,this);
|
||||
|
|
@ -19430,7 +19430,8 @@ void Player::AutoStoreLootItem(uint8 bag, uint8 slot, uint32 loot_id, LootStore
|
|||
if(msg != EQUIP_ERR_OK)
|
||||
return;
|
||||
|
||||
StoreNewItem (dest,lootItem->itemid,true,lootItem->randomPropertyId);
|
||||
if(Item* pItem = StoreNewItem (dest,lootItem->itemid,true,lootItem->randomPropertyId))
|
||||
SendNewItem(pItem, lootItem->count, true, true);
|
||||
}
|
||||
|
||||
uint32 Player::CalculateTalentsPoints() const
|
||||
|
|
|
|||
|
|
@ -1110,8 +1110,8 @@ class MANGOS_DLL_SPEC Player : public Unit
|
|||
Item* EquipItem( uint16 pos, Item *pItem, bool update );
|
||||
void AutoUnequipOffhandIfNeed();
|
||||
bool StoreNewItemInBestSlots(uint32 item_id, uint32 item_count);
|
||||
void AutoStoreLootItem(uint8 bag, uint8 slot, uint32 loot_id, LootStore const& store);
|
||||
void AutoStoreLootItem(uint32 loot_id, LootStore const& store) { AutoStoreLootItem(NULL_BAG,NULL_SLOT,loot_id,store); }
|
||||
bool AutoStoreLootItem(uint8 bag, uint8 slot, uint32 loot_id, LootStore const& store);
|
||||
bool AutoStoreLootItem(uint32 loot_id, LootStore const& store) { return AutoStoreLootItem(NULL_BAG,NULL_SLOT,loot_id,store); }
|
||||
|
||||
uint8 _CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count = NULL) const;
|
||||
uint8 _CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item *pItem = NULL, bool swap = false, uint32* no_space_count = NULL ) const;
|
||||
|
|
|
|||
|
|
@ -231,6 +231,7 @@ class Spell
|
|||
void EffectHealthLeech(uint32 i);
|
||||
void EffectQuestComplete(uint32 i);
|
||||
void EffectCreateItem(uint32 i);
|
||||
void EffectCreateItem2(uint32 i);
|
||||
void EffectPersistentAA(uint32 i);
|
||||
void EffectEnergize(uint32 i);
|
||||
void EffectOpenLock(uint32 i);
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
|
|||
&Spell::EffectNULL, //154 unused
|
||||
&Spell::EffectTitanGrip, //155 SPELL_EFFECT_TITAN_GRIP Allows you to equip two-handed axes, maces and swords in one hand, but you attack $49152s1% slower than normal.
|
||||
&Spell::EffectEnchantItemPrismatic, //156 SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC
|
||||
&Spell::EffectCreateItem, //157 SPELL_EFFECT_CREATE_ITEM_2 create/learn item/spell for profession
|
||||
&Spell::EffectCreateItem2, //157 SPELL_EFFECT_CREATE_ITEM_2 create/learn item/spell for profession
|
||||
&Spell::EffectMilling, //158 SPELL_EFFECT_MILLING milling
|
||||
&Spell::EffectRenamePet //159 SPELL_EFFECT_ALLOW_RENAME_PET allow rename pet once again
|
||||
};
|
||||
|
|
@ -2682,6 +2682,22 @@ void Spell::EffectCreateItem(uint32 i)
|
|||
DoCreateItem(i,m_spellInfo->EffectItemType[i]);
|
||||
}
|
||||
|
||||
void Spell::EffectCreateItem2(uint32 i)
|
||||
{
|
||||
// special case: generate using spell_loot_template
|
||||
if(!m_spellInfo->EffectItemType[i])
|
||||
{
|
||||
if(m_caster->GetTypeId()!=TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
// create some random items
|
||||
if(!((Player*)m_caster)->AutoStoreLootItem(m_spellInfo->Id,LootTemplates_Spell))
|
||||
player->SendEquipError( msg, NULL, NULL );
|
||||
return;
|
||||
}
|
||||
DoCreateItem(i,m_spellInfo->EffectItemType[i]);
|
||||
}
|
||||
|
||||
void Spell::EffectPersistentAA(uint32 i)
|
||||
{
|
||||
float radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
|
||||
|
|
|
|||
|
|
@ -317,6 +317,12 @@ inline bool IsExplicitDiscoverySpell(SpellEntry const *spellInfo)
|
|||
return spellInfo->Effect[0]==SPELL_EFFECT_CREATE_ITEM_2 && spellInfo->Effect[1]==SPELL_EFFECT_SCRIPT_EFFECT;
|
||||
}
|
||||
|
||||
inline bool IsLootCraftingSpell(SpellEntry const *spellInfo)
|
||||
{
|
||||
return spellInfo->Effect[0]==SPELL_EFFECT_CREATE_ITEM_2 &&
|
||||
(spellInfo->Effect[1]==SPELL_EFFECT_SCRIPT_EFFECT || !spellInfo->EffectItemType[0]);
|
||||
}
|
||||
|
||||
int32 CompareAuraRanks(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2);
|
||||
bool IsSingleFromSpellSpecificPerCaster(uint32 spellSpec1,uint32 spellSpec2);
|
||||
bool IsPassiveSpell(uint32 spellId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue