[8249] Implement support spell_proc_item_enchant table for ppm item enchantments triggering at hit.
* Added a new SQL table, spell_proc_item_enchant, for "custom" ppmRates on Item Enchants that do not use auras.
With table data this must fix ppm for effect from 8033 and ranks enchanting, and item 6947/10918 and ranks enchanting.
* Implemented SPELLMOD_FREQUENCY_OF_SUCCESS (26).
That must fix work talent 14113, spell 32645 with ranks, glyph 41094 and item set effect 64917 in frequency part.
Thanks to MaS0n as author alternative patch that partly used in this patch.
Thanks to Thenecromancer as author alternative patch that ideas inspire MaS0n's patch writing and then this patch also.
Author: nos4r2zod
*Note: has been implemented before. Only use part of the patch.
--HG--
branch : trunk
This commit is contained in:
@@ -489,6 +489,7 @@ ChatCommand * ChatHandler::getCommandTable()
|
||||
{ "spell_linked_spell", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellLinkedSpellCommand, "", NULL },
|
||||
{ "spell_pet_auras", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellPetAurasCommand, "", NULL },
|
||||
{ "spell_proc_event", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellProcEventCommand, "", NULL },
|
||||
{ "spell_proc_item_enchant", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellProcItemEnchantCommand, "", NULL },
|
||||
{ "spell_script_target", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellScriptTargetCommand, "", NULL },
|
||||
{ "spell_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellScriptsCommand, "", NULL },
|
||||
{ "spell_target_position", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellTargetPositionCommand, "", NULL },
|
||||
|
||||
@@ -405,6 +405,7 @@ class ChatHandler
|
||||
bool HandleReloadSpellLearnSpellCommand(const char* args);
|
||||
bool HandleReloadSpellLinkedSpellCommand(const char* args);
|
||||
bool HandleReloadSpellProcEventCommand(const char* args);
|
||||
bool HandleReloadSpellProcItemEnchantCommand(const char* args);
|
||||
bool HandleReloadSpellBonusesCommand(const char* args);
|
||||
bool HandleReloadSpellScriptTargetCommand(const char* args);
|
||||
bool HandleReloadSpellScriptsCommand(const char* args);
|
||||
|
||||
@@ -651,6 +651,7 @@ bool ChatHandler::HandleReloadAllSpellCommand(const char*)
|
||||
HandleReloadSpellLinkedSpellCommand("a");
|
||||
HandleReloadSpellProcEventCommand("a");
|
||||
HandleReloadSpellBonusesCommand("a");
|
||||
HandleReloadSpellProcItemEnchantCommand("a");
|
||||
HandleReloadSpellScriptTargetCommand("a");
|
||||
HandleReloadSpellTargetPositionCommand("a");
|
||||
HandleReloadSpellThreatsCommand("a");
|
||||
@@ -1047,6 +1048,14 @@ bool ChatHandler::HandleReloadSpellBonusesCommand(const char*)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleReloadSpellProcItemEnchantCommand(const char*)
|
||||
{
|
||||
sLog.outString( "Re-Loading Spell Proc Item Enchant..." );
|
||||
spellmgr.LoadSpellProcItemEnchant();
|
||||
SendGlobalSysMessage("DB table `spell_proc_item_enchant` (item enchantment ppm) reloaded.");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleReloadSpellScriptTargetCommand(const char*)
|
||||
{
|
||||
sLog.outString( "Re-Loading SpellsScriptTarget..." );
|
||||
|
||||
@@ -7222,6 +7222,7 @@ void Player::CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32
|
||||
|
||||
// Apply spell mods
|
||||
ApplySpellMod(pEnchant->spellid[s],SPELLMOD_CHANCE_OF_SUCCESS,chance);
|
||||
//ApplySpellMod(spellInfo->Id,SPELLMOD_FREQUENCY_OF_SUCCESS,chance);
|
||||
|
||||
if (roll_chance_f(chance))
|
||||
{
|
||||
|
||||
+60
-1
@@ -1217,6 +1217,65 @@ void SpellMgr::LoadSpellProcEvents()
|
||||
sLog.outString( ">> Loaded %u extra spell proc event conditions", count );
|
||||
}
|
||||
|
||||
/*
|
||||
void SpellMgr::LoadSpellProcItemEnchant()
|
||||
{
|
||||
mSpellProcItemEnchantMap.clear(); // need for reload case
|
||||
|
||||
uint32 count = 0;
|
||||
|
||||
// 0 1
|
||||
QueryResult *result = WorldDatabase.Query("SELECT entry, ppmRate FROM spell_proc_item_enchant");
|
||||
if( !result )
|
||||
{
|
||||
|
||||
barGoLink bar( 1 );
|
||||
|
||||
bar.step();
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u proc item enchant definitions", count );
|
||||
return;
|
||||
}
|
||||
|
||||
barGoLink bar( result->GetRowCount() );
|
||||
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
|
||||
bar.step();
|
||||
|
||||
uint32 entry = fields[0].GetUInt32();
|
||||
float ppmRate = fields[1].GetFloat();
|
||||
|
||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(entry);
|
||||
|
||||
if (!spellInfo)
|
||||
{
|
||||
sLog.outErrorDb("Spell %u listed in `spell_proc_item_enchant` does not exist", entry);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( GetFirstSpellInChain(entry) != entry )
|
||||
{
|
||||
sLog.outErrorDb("Spell %u listed in `spell_proc_item_enchant` is not first rank in chain", entry);
|
||||
// prevent loading since it won't have an effect anyway
|
||||
continue;
|
||||
}
|
||||
|
||||
mSpellProcItemEnchantMap[entry] = ppmRate;
|
||||
|
||||
++count;
|
||||
} while( result->NextRow() );
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u proc item enchant definitions", count );
|
||||
}
|
||||
*/
|
||||
|
||||
void SpellMgr::LoadSpellBonusess()
|
||||
{
|
||||
mSpellBonusMap.clear(); // need for reload case
|
||||
@@ -3226,7 +3285,7 @@ bool IsDispelableBySpell(SpellEntry const * dispelSpell, uint32 spellId, bool de
|
||||
return def;
|
||||
}
|
||||
|
||||
void SpellMgr::LoadSpellEnchantProcData()
|
||||
void SpellMgr::LoadSpellProcItemEnchant()
|
||||
{
|
||||
mSpellEnchantProcEventMap.clear(); // need for reload case
|
||||
|
||||
|
||||
+5
-3
@@ -526,6 +526,7 @@ typedef UNORDERED_MAP<uint32, SpellBonusEntry> SpellBonusMap;
|
||||
#define ELIXIR_SHATTRATH_MASK 0x8
|
||||
|
||||
typedef std::map<uint32, uint8> SpellElixirMap;
|
||||
typedef std::map<uint32, float> SpellProcItemEnchantMap;
|
||||
|
||||
// Spell script target related declarations (accessed using SpellMgr functions)
|
||||
enum SpellScriptTargetType
|
||||
@@ -772,8 +773,6 @@ class SpellMgr
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool IsSpellProcEventCanTriggeredBy( SpellProcEventEntry const * spellProcEvent, uint32 EventProcFlag, SpellEntry const * procSpell, uint32 procFlags, uint32 procExtra, bool active);
|
||||
|
||||
SpellEnchantProcEntry const* GetSpellEnchantProcEvent(uint32 enchId) const
|
||||
{
|
||||
SpellEnchantProcEventMap::const_iterator itr = mSpellEnchantProcEventMap.find(enchId);
|
||||
@@ -782,6 +781,8 @@ class SpellMgr
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool IsSpellProcEventCanTriggeredBy( SpellProcEventEntry const * spellProcEvent, uint32 EventProcFlag, SpellEntry const * procSpell, uint32 procFlags, uint32 procExtra, bool active);
|
||||
|
||||
// Spell bonus data
|
||||
SpellBonusEntry const* GetSpellBonusData(uint32 spellId) const
|
||||
{
|
||||
@@ -1056,6 +1057,7 @@ class SpellMgr
|
||||
void LoadSpellScriptTarget();
|
||||
void LoadSpellElixirs();
|
||||
void LoadSpellProcEvents();
|
||||
void LoadSpellProcItemEnchant();
|
||||
void LoadSpellBonusess();
|
||||
void LoadSpellTargetPositions();
|
||||
void LoadSpellThreats();
|
||||
@@ -1063,7 +1065,6 @@ class SpellMgr
|
||||
void LoadSpellPetAuras();
|
||||
void LoadSpellCustomAttr();
|
||||
void LoadEnchantCustomAttr();
|
||||
void LoadSpellEnchantProcData();
|
||||
void LoadSpellLinked();
|
||||
void LoadPetLevelupSpellMap();
|
||||
void LoadPetDefaultSpells();
|
||||
@@ -1081,6 +1082,7 @@ class SpellMgr
|
||||
SpellTargetPositionMap mSpellTargetPositions;
|
||||
SpellElixirMap mSpellElixirs;
|
||||
SpellProcEventMap mSpellProcEventMap;
|
||||
SpellProcItemEnchantMap mSpellProcItemEnchantMap;
|
||||
SpellBonusMap mSpellBonusMap;
|
||||
SkillLineAbilityMap mSkillLineAbilityMap;
|
||||
SpellPetAuraMap mSpellPetAuraMap;
|
||||
|
||||
@@ -13686,7 +13686,9 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura * aura, SpellEntry co
|
||||
if(Player* modOwner = GetSpellModOwner())
|
||||
{
|
||||
modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_CHANCE_OF_SUCCESS,chance);
|
||||
//modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_FREQUENCY_OF_SUCCESS,chance);
|
||||
}
|
||||
|
||||
return roll_chance_f(chance);
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -111,7 +111,7 @@ enum SpellModOp
|
||||
SPELLMOD_CRIT_DAMAGE_BONUS = 15,
|
||||
SPELLMOD_RESIST_MISS_CHANCE = 16,
|
||||
SPELLMOD_JUMP_TARGETS = 17,
|
||||
SPELLMOD_CHANCE_OF_SUCCESS = 18,
|
||||
SPELLMOD_CHANCE_OF_SUCCESS = 18, // Only used with SPELL_AURA_ADD_FLAT_MODIFIER and affects proc spells
|
||||
SPELLMOD_ACTIVATION_TIME = 19,
|
||||
SPELLMOD_EFFECT_PAST_FIRST = 20,
|
||||
SPELLMOD_GLOBAL_COOLDOWN = 21, //TODO: GCD is not checked by server currently
|
||||
@@ -120,6 +120,7 @@ enum SpellModOp
|
||||
SPELLMOD_SPELL_BONUS_DAMAGE = 24,
|
||||
// spellmod 25
|
||||
SPELLMOD_PROC_PER_MINUTE = 26,
|
||||
//SPELLMOD_FREQUENCY_OF_SUCCESS = 26, // Only used with SPELL_AURA_ADD_PCT_MODIFIER and affects used on proc spells
|
||||
SPELLMOD_MULTIPLE_VALUE = 27,
|
||||
SPELLMOD_RESIST_DISPEL_CHANCE = 28,
|
||||
SPELLMOD_CRIT_DAMAGE_BONUS_2 = 29, //one not used spell
|
||||
|
||||
+3
-3
@@ -1250,15 +1250,15 @@ void World::SetInitialWorldSettings()
|
||||
sLog.outString( "Loading Spell Bonus Data..." );
|
||||
spellmgr.LoadSpellBonusess();
|
||||
|
||||
sLog.outString( "Loading Spell Proc Item Enchant..." );
|
||||
spellmgr.LoadSpellProcItemEnchant(); // must be after LoadSpellChains
|
||||
|
||||
sLog.outString( "Loading Aggro Spells Definitions...");
|
||||
spellmgr.LoadSpellThreats();
|
||||
|
||||
sLog.outString( "Loading NPC Texts..." );
|
||||
objmgr.LoadGossipText();
|
||||
|
||||
sLog.outString( "Loading Enchant Spells Proc datas...");
|
||||
spellmgr.LoadSpellEnchantProcData();
|
||||
|
||||
sLog.outString( "Loading Item Random Enchantments Table..." );
|
||||
LoadRandomEnchantmentsTable();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user