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.
This commit is contained in:
treeston committed 2015-10-11 11:36:18 +02:00
1 parent 2415646d9e
commit 4771740d42
7 files changed
+340 -54

No files matched your search

+19 -2
View File
@@ -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;