aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/SpellEffects.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Spells/SpellEffects.cpp')
-rw-r--r--src/server/game/Spells/SpellEffects.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index a00db8cbd68..3431eb71898 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -1456,6 +1456,22 @@ void Spell::DoCreateItem(uint32 /*i*/, uint32 itemtype, std::vector<int32> const
if (num_to_add > pProto->GetMaxStackSize())
num_to_add = pProto->GetMaxStackSize();
+ /* == gem perfection handling == */
+
+ // the chance of getting a perfect result
+ float perfectCreateChance = 0.0f;
+ // the resulting perfect item if successful
+ uint32 perfectItemType = itemtype;
+ // get perfection capability and chance
+ if (CanCreatePerfectItem(player, m_spellInfo->Id, perfectCreateChance, perfectItemType))
+ if (roll_chance_f(perfectCreateChance)) // if the roll succeeds...
+ newitemid = perfectItemType; // the perfect item replaces the regular one
+
+ /* == gem perfection handling over == */
+
+
+ /* == profession specialization handling == */
+
// init items_count to 1, since 1 item will be created regardless of specialization
int items_count=1;
// the chance to create additional items
@@ -1464,15 +1480,16 @@ void Spell::DoCreateItem(uint32 /*i*/, uint32 itemtype, std::vector<int32> const
uint8 additionalMaxNum=0;
// get the chance and maximum number for creating extra items
if (CanCreateExtraItems(player, m_spellInfo->Id, additionalCreateChance, additionalMaxNum))
- {
// roll with this chance till we roll not to create or we create the max num
while (roll_chance_f(additionalCreateChance) && items_count <= additionalMaxNum)
++items_count;
- }
// really will be created more items
num_to_add *= items_count;
+ /* == profession specialization handling over == */
+
+
// can the player store the new item?
ItemPosCountVec dest;
uint32 no_space = 0;