aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/SpellEffects.cpp
diff options
context:
space:
mode:
authortreeston <treeston.mmoc@gmail.com>2015-09-11 20:44:53 +0200
committertreeston <treeston.mmoc@gmail.com>2015-10-11 11:36:18 +0200
commit4771740d424bea45a12e9d47d7919f2f44929226 (patch)
tree620ad54080f0c1bdca405f5567cf74d98f9da458 /src/server/game/Spells/SpellEffects.cpp
parent2415646d9e317a97ecc93b1a8cdc3913d7167d95 (diff)
Gem Perfection implemented:
- Add new DB table `skill_perfect_item_template` that holds information about "perfect" crafts that replace the normal result - Implement this new DB table into core (SkillExtraItems.cpp, SkillExtraItems.h, SpellEffects.cpp) - Add data about perfect crafts to new DB table (2015_09_11_00_world.sql) - Add reload capability to this new table (latch onto skill_extra_item_template to avoid changing command IDs) Random other change because I stumbled across it and it annoyed me: - npc_professions.cpp no longer uses magic numbers for quest IDs and creature IDs.
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 10dfbd511df..e587a59858a 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -1571,6 +1571,22 @@ void Spell::DoCreateItem(uint32 /*i*/, uint32 itemtype)
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
@@ -1579,15 +1595,16 @@ void Spell::DoCreateItem(uint32 /*i*/, uint32 itemtype)
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;