aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/LootMgr.cpp2
-rw-r--r--src/game/Player.cpp5
-rw-r--r--src/game/Player.h4
-rw-r--r--src/game/Spell.h1
-rw-r--r--src/game/SpellEffects.cpp18
-rw-r--r--src/game/SpellMgr.h6
6 files changed, 30 insertions, 6 deletions
diff --git a/src/game/LootMgr.cpp b/src/game/LootMgr.cpp
index 30471366202..452efe4e5da 100644
--- a/src/game/LootMgr.cpp
+++ b/src/game/LootMgr.cpp
@@ -1276,7 +1276,7 @@ void LoadLootTemplates_Spell()
continue;
// possible cases
- if(!IsExplicitDiscoverySpell (spellInfo))
+ if( !IsLootCraftingSpell(spellInfo))
continue;
if(!ids_set.count(spell_id))
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 57ab42128da..b66df6ce197 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -20232,7 +20232,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);
@@ -20249,7 +20249,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
diff --git a/src/game/Player.h b/src/game/Player.h
index eeac9ca53f0..142910b8db1 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -1114,8 +1114,8 @@ class TRINITY_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;
diff --git a/src/game/Spell.h b/src/game/Spell.h
index c38ebb617ad..9bfc2ce686c 100644
--- a/src/game/Spell.h
+++ b/src/game/Spell.h
@@ -260,6 +260,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);
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 65e198d8af2..2827a777759 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -221,7 +221,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
};
@@ -2729,6 +2729,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]));
diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h
index 5ee1ab5dab8..8d9f7e54972 100644
--- a/src/game/SpellMgr.h
+++ b/src/game/SpellMgr.h
@@ -355,6 +355,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 IsSingleFromSpellSpecificPerTarget(uint32 spellSpec1, uint32 spellSpec2);