aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/Chat.cpp1
-rw-r--r--src/game/Chat.h1
-rw-r--r--src/game/DBCStructure.h7
-rw-r--r--src/game/Level3.cpp9
-rw-r--r--src/game/Player.cpp1
-rw-r--r--src/game/Spell.cpp9
-rw-r--r--src/game/SpellMgr.cpp105
-rw-r--r--src/game/SpellMgr.h21
-rw-r--r--src/game/Unit.cpp2
-rw-r--r--src/game/Unit.h3
-rw-r--r--src/game/World.cpp6
-rw-r--r--src/shared/Database/SQLStorage.cpp2
12 files changed, 141 insertions, 26 deletions
diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp
index 4dcc603afc4..98f02c1e4e6 100644
--- a/src/game/Chat.cpp
+++ b/src/game/Chat.cpp
@@ -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 },
diff --git a/src/game/Chat.h b/src/game/Chat.h
index be4ad5f31c2..c6bf1032662 100644
--- a/src/game/Chat.h
+++ b/src/game/Chat.h
@@ -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);
diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h
index ffc37e1ee9b..910316881a4 100644
--- a/src/game/DBCStructure.h
+++ b/src/game/DBCStructure.h
@@ -1463,13 +1463,6 @@ struct SpellFocusObjectEntry
// 16 string flags, unused
};
-// stored in SQL table
-struct SpellThreatEntry
-{
- uint32 spellId;
- int32 threat;
-};
-
struct SpellRadiusEntry
{
uint32 ID;
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index 5abc05260f1..e17d1fc975a 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -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..." );
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 5659f14f28a..701017a45a1 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -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))
{
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index f4e992b6a7b..5c1b2fc3687 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -4200,13 +4200,14 @@ void Spell::HandleThreatSpells(uint32 spellId)
if(!m_targets.getUnitTarget()->CanHaveThreatList())
return;
- SpellThreatEntry const *threatSpell = sSpellThreatStore.LookupEntry<SpellThreatEntry>(spellId);
- if(!threatSpell)
+ uint16 threat = spellmgr.GetSpellThreat(spellId);
+
+ if(!threat)
return;
- m_targets.getUnitTarget()->AddThreat(m_caster, float(threatSpell->threat));
+ m_targets.getUnitTarget()->AddThreat(m_caster, float(threat));
- DEBUG_LOG("Spell %u, rank %u, added an additional %i threat", spellId, spellmgr.GetSpellRank(spellId), threatSpell->threat);
+ DEBUG_LOG("Spell %u, rank %u, added an additional %i threat", spellId, spellmgr.GetSpellRank(spellId), threat);
}
void Spell::HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTarget,uint32 i)
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
index f3e02e6d8f3..942ab52e3da 100644
--- a/src/game/SpellMgr.cpp
+++ b/src/game/SpellMgr.cpp
@@ -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
@@ -1446,12 +1505,50 @@ void SpellMgr::LoadSpellElixirs()
void SpellMgr::LoadSpellThreats()
{
- sSpellThreatStore.Free(); // for reload
+ mSpellThreatMap.clear(); // need for reload case
+
+ uint32 count = 0;
+
+ // 0 1
+ QueryResult *result = WorldDatabase.Query("SELECT entry, Threat FROM spell_threat");
+ if( !result )
+ {
+
+ barGoLink bar( 1 );
+
+ bar.step();
+
+ sLog.outString();
+ sLog.outString( ">> Loaded %u aggro generating spells", count );
+ return;
+ }
+
+ barGoLink bar( result->GetRowCount() );
+
+ do
+ {
+ Field *fields = result->Fetch();
+
+ bar.step();
+
+ uint32 entry = fields[0].GetUInt32();
+ uint16 Threat = fields[1].GetUInt16();
+
+ if (!sSpellStore.LookupEntry(entry))
+ {
+ sLog.outErrorDb("Spell %u listed in `spell_threat` does not exist", entry);
+ continue;
+ }
- sSpellThreatStore.Load();
+ mSpellThreatMap[entry] = Threat;
+
+ ++count;
+ } while( result->NextRow() );
+
+ delete result;
- sLog.outString( ">> Loaded %u aggro generating spells", sSpellThreatStore.RecordCount );
sLog.outString();
+ sLog.outString( ">> Loaded %u aggro generating spells", count );
}
bool SpellMgr::IsRankSpellDueToSpell(SpellEntry const *spellInfo_1,uint32 spellId_2) const
@@ -3226,7 +3323,7 @@ bool IsDispelableBySpell(SpellEntry const * dispelSpell, uint32 spellId, bool de
return def;
}
-void SpellMgr::LoadSpellEnchantProcData()
+void SpellMgr::LoadSpellProcItemEnchant()
{
mSpellEnchantProcEventMap.clear(); // need for reload case
diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h
index db1473bcb3b..d71306e5b86 100644
--- a/src/game/SpellMgr.h
+++ b/src/game/SpellMgr.h
@@ -40,8 +40,6 @@ class Player;
class Spell;
struct SpellModifier;
-extern SQLStorage sSpellThreatStore;
-
// only used in code
enum SpellCategories
{
@@ -526,6 +524,8 @@ typedef UNORDERED_MAP<uint32, SpellBonusEntry> SpellBonusMap;
#define ELIXIR_SHATTRATH_MASK 0x8
typedef std::map<uint32, uint8> SpellElixirMap;
+typedef std::map<uint32, float> SpellProcItemEnchantMap;
+typedef std::map<uint32, uint16> SpellThreatMap;
// Spell script target related declarations (accessed using SpellMgr functions)
enum SpellScriptTargetType
@@ -763,6 +763,15 @@ class SpellMgr
return SPELL_NORMAL;
}
+ uint16 GetSpellThreat(uint32 spellid) const
+ {
+ SpellThreatMap::const_iterator itr = mSpellThreatMap.find(spellid);
+ if(itr==mSpellThreatMap.end())
+ return 0;
+
+ return itr->second;
+ }
+
// Spell proc events
SpellProcEventEntry const* GetSpellProcEvent(uint32 spellId) const
{
@@ -772,8 +781,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 +789,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 +1065,7 @@ class SpellMgr
void LoadSpellScriptTarget();
void LoadSpellElixirs();
void LoadSpellProcEvents();
+ void LoadSpellProcItemEnchant();
void LoadSpellBonusess();
void LoadSpellTargetPositions();
void LoadSpellThreats();
@@ -1063,7 +1073,6 @@ class SpellMgr
void LoadSpellPetAuras();
void LoadSpellCustomAttr();
void LoadEnchantCustomAttr();
- void LoadSpellEnchantProcData();
void LoadSpellLinked();
void LoadPetLevelupSpellMap();
void LoadPetDefaultSpells();
@@ -1080,7 +1089,9 @@ class SpellMgr
SpellLearnSpellMap mSpellLearnSpells;
SpellTargetPositionMap mSpellTargetPositions;
SpellElixirMap mSpellElixirs;
+ SpellThreatMap mSpellThreatMap;
SpellProcEventMap mSpellProcEventMap;
+ SpellProcItemEnchantMap mSpellProcItemEnchantMap;
SpellBonusMap mSpellBonusMap;
SkillLineAbilityMap mSkillLineAbilityMap;
SpellPetAuraMap mSpellPetAuraMap;
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index b0b3968d07c..20889177ea6 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -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);
}
diff --git a/src/game/Unit.h b/src/game/Unit.h
index 85f2ed154dd..f9bdba95dde 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -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
diff --git a/src/game/World.cpp b/src/game/World.cpp
index db59f101389..0f93322daad 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -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();
diff --git a/src/shared/Database/SQLStorage.cpp b/src/shared/Database/SQLStorage.cpp
index 50fd484bff5..4113d35236d 100644
--- a/src/shared/Database/SQLStorage.cpp
+++ b/src/shared/Database/SQLStorage.cpp
@@ -38,7 +38,6 @@ const char GameObjectInfodstfmt[]="iiissssiifiiiiiiiiiiiiiiiiiiiiiiiiiiiii";
const char ItemPrototypesrcfmt[]="iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifiiisiiii";
const char ItemPrototypedstfmt[]="iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifiiiiiiii";
const char PageTextfmt[]="isi";
-const char SpellThreatfmt[]="ii";
const char InstanceTemplatesrcfmt[]="iiiiiiffffs";
const char InstanceTemplatedstfmt[]="iiiiiiffffi";
@@ -50,7 +49,6 @@ SQLStorage sEquipmentStorage(EquipmentInfofmt,"entry","creature_equip_template")
SQLStorage sGOStorage(GameObjectInfosrcfmt, GameObjectInfodstfmt, "entry","gameobject_template");
SQLStorage sItemStorage(ItemPrototypesrcfmt, ItemPrototypedstfmt, "entry","item_template");
SQLStorage sPageTextStore(PageTextfmt,"entry","page_text");
-SQLStorage sSpellThreatStore(SpellThreatfmt,"entry","spell_threat");
SQLStorage sInstanceTemplate(InstanceTemplatesrcfmt, InstanceTemplatedstfmt, "map","instance_template");
void SQLStorage::Free ()