吾爱尚玩资源基地
标题:
变态魔兽私服的一个模拟器技能伤害倍率的扩展设置
[打印本页]
作者:
admin
时间:
2016-4-19 22:55
标题:
变态魔兽私服的一个模拟器技能伤害倍率的扩展设置
diff --git a/src/game/Chat.cpp b/src/game/Chat.cppindex 1357c61..24e46bb 100644
--- a/src/game/Chat.cpp
+++ b/src/game/Chat.cpp
@@ -527,7 +527,7 @@ ChatCommand * ChatHandler::getCommandTable()
{ "spell_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellScriptsCommand, "", NULL },
{ "spell_target_position", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellTargetPositionCommand, "", NULL },
{ "spell_threats", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellThreatsCommand, "", NULL },
-
+ { "spell_threat_multiplicator", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellThreatMultiplicatorCommand,"", NULL },
{ NULL, 0, false, NULL, "", NULL }
};
diff --git a/src/game/Chat.h b/src/game/Chat.h
index 9950ad4..3a4746a 100644
--- a/src/game/Chat.h
+++ b/src/game/Chat.h
@@ -444,7 +444,8 @@ class ChatHandler
bool HandleReloadSpellScriptsCommand(char* args);
bool HandleReloadSpellTargetPositionCommand(char* args);
bool HandleReloadSpellThreatsCommand(char* args);
- bool HandleReloadSpellPetAurasCommand(char* args);
+ bool HandleReloadSpellThreatMultiplicatorCommand(char* args);
+ bool HandleReloadSpellPetAurasCommand(char* args);
bool HandleResetAchievementsCommand(char* args);
bool HandleResetAllCommand(char* args);
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index 6b4298b..88d9f26 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -167,6 +167,7 @@ bool ChatHandler::HandleReloadAllSpellCommand(char* /*args*/)
HandleReloadSpellScriptTargetCommand((char*)"a");
HandleReloadSpellTargetPositionCommand((char*)"a");
HandleReloadSpellThreatsCommand((char*)"a");
+ HandleReloadSpellThreatMultiplicatorCommand((char*)"a");
HandleReloadSpellPetAurasCommand((char*)"a");
return true;
}
@@ -632,6 +633,14 @@ bool ChatHandler::HandleReloadSpellThreatsCommand(char* /*args*/)
return true;
}
+bool ChatHandler::HandleReloadSpellThreatMultiplicatorCommand(char* /*args*/)
+{
+ sLog.outString( "Re-Loading spell threat multiplicator definitions..." );
+ sSpellMgr.LoadSpellThreatMultiplicators();
+ SendGlobalSysMessage("DB table `spell_threat_multiplicator` (spell threat multiplicator definitions) reloaded.");
+ return true;
+}
+
bool ChatHandler::HandleReloadSpellPetAurasCommand(char* /*args*/)
{
sLog.outString( "Re-Loading Spell pet auras...");
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
index 970fe5b..9deae4b 100644
--- a/src/game/SpellMgr.cpp
+++ b/src/game/SpellMgr.cpp
@@ -1645,6 +1645,52 @@ void SpellMgr::LoadSpellThreats()
sLog.outString( ">> Loaded %u aggro generating spells", count );
}
+void SpellMgr::LoadSpellThreatMultiplicators()
+{
+ mSpellThreatMultiplicatorMap.clear();
+
+ uint32 count = 0;
+
+ QueryResult* result = WorldDatabase.Query("SELECT entry, threat_multiplicator FROM spell_threat_multiplicator");
+ if(!result)
+ {
+ barGoLink bar(1);
+
+ bar.step();
+
+ sLog.outString();
+ sLog.outString(">> Loaded %u aggro multiplicating spells", count);
+ return;
+ }
+
+ barGoLink bar((int)result->GetRowCount());
+
+ do
+ {
+ Field *fields = result->Fetch();
+
+ bar.step();
+
+ uint32 entry = fields[0].GetUInt32();
+ float threat_multiplicator = fields[1].GetFloat();
+
+ if(!sSpellStore.LookupEntry(entry))
+ {
+ sLog.outErrorDb("Spell %u listed in `spell_threat_multiplier` does not exist", entry);
+ continue;
+ }
+
+ mSpellThreatMultiplicatorMap[entry] = threat_multiplicator;
+
+ ++count;
+ } while (result->NextRow());
+
+ delete result;
+
+ sLog.outString();
+ sLog.outString(">> Loaded %u aggro multiplicating spells", count);
+}
+
bool SpellMgr::IsRankSpellDueToSpell(SpellEntry const *spellInfo_1,uint32 spellId_2) const
{
SpellEntry const *spellInfo_2 = sSpellStore.LookupEntry(spellId_2);
diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h
index cae2fbc..ef979ff 100644
--- a/src/game/SpellMgr.h
+++ b/src/game/SpellMgr.h
@@ -631,6 +631,7 @@ typedef UNORDERED_MAP<uint32, SpellBonusEntry> SpellBonusMap;
typedef std::map<uint32, uint8> SpellElixirMap;
typedef std::map<uint32, float> SpellProcItemEnchantMap;
typedef std::map<uint32, uint16> SpellThreatMap;
+typedef std::map<uint32, float> SpellThreatMultiplicatorMap;
// Spell script target related declarations (accessed using SpellMgr functions)
enum SpellTargetType
@@ -861,6 +862,15 @@ class SpellMgr
return itr->second;
}
+ float GetSpellThreatMultiplicator(uint32 spellid) const
+ {
+ SpellThreatMultiplicatorMap::const_iterator itr = mSpellThreatMultiplicatorMap.find(spellid);
+ if(itr==mSpellThreatMultiplicatorMap.end())
+ return 1.0f;
+
+ return itr->second;
+ }
+
// Spell proc events
SpellProcEventEntry const* GetSpellProcEvent(uint32 spellId) const
{
@@ -1104,6 +1114,7 @@ class SpellMgr
void LoadSpellBonuses();
void LoadSpellTargetPositions();
void LoadSpellThreats();
+ void LoadSpellThreatMultiplicators();
void LoadSkillLineAbilityMap();
void LoadSpellPetAuras();
void LoadPetLevelupSpellMap();
@@ -1121,6 +1132,7 @@ class SpellMgr
SpellTargetPositionMap mSpellTargetPositions;
SpellElixirMap mSpellElixirs;
SpellThreatMap mSpellThreatMap;
+ SpellThreatMultiplicatorMap mSpellThreatMultiplicatorMap;
SpellProcEventMap mSpellProcEventMap;
SpellProcItemEnchantMap mSpellProcItemEnchantMap;
SpellBonusMap mSpellBonusMap;
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index b1f62a9..8918ea0 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -946,11 +946,9 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
}
if (pVictim->GetTypeId() != TYPEID_PLAYER)
{
- if(spellProto && IsDamageToThreatSpell(spellProto))
- pVictim->AddThreat(this, float(damage*2), (cleanDamage && cleanDamage->hitOutCome == MELEE_HIT_CRIT), damageSchoolMask, spellProto);
- else
- pVictim->AddThreat(this, float(damage), (cleanDamage && cleanDamage->hitOutCome == MELEE_HIT_CRIT), damageSchoolMask, spellProto);
- }
+ if(spellProto)
+ pVictim->AddThreat(this, float(damage*100*getSpellThreatMultiplicator(spellProto)), (cleanDamage && cleanDamage->hitOutCome == MELEE_HIT_CRIT), damageSchoolMask, spellProto);
+ }
else // victim is a player
{
// Rage from damage received
@@ -7062,20 +7060,17 @@ bool Unit::IsImmunedToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex
return false;
}
-bool Unit::IsDamageToThreatSpell(SpellEntry const * spellInfo) const
+float Unit::getSpellThreatMultiplicator(SpellEntry const * spellInfo) const
{
if (!spellInfo)
- return false;
+ return 1.0f;
- uint32 family = spellInfo->SpellFamilyName;
- uint64 flags = spellInfo->SpellFamilyFlags;
+ float fSpellThreatMultiplicator = sSpellMgr.GetSpellThreatMultiplicator(spellInfo->Id);
- if ((family == 5 && flags == 256) || //Searing Pain
- (family == 6 && flags == 8192) || //Mind Blast
- (family == 11 && flags == 1048576)) //Earth Shock
- return true;
+ if(!fSpellThreatMultiplicator)
+ return 1.0f;
- return false;
+ return fSpellThreatMultiplicator;
}
/**
diff --git a/src/game/Unit.h b/src/game/Unit.h
index a7c5667..a1aedf4 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -1435,7 +1435,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
void CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item *castItem = NULL, Aura* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid());
void CastSpell(float x, float y, float z, SpellEntry const *spellInfo, bool triggered, Item *castItem = NULL, Aura* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid());
- bool IsDamageToThreatSpell(SpellEntry const * spellInfo) const;
+ float getSpellThreatMultiplicator(SpellEntry const * spellInfo) const;
void DeMorph();
diff --git a/src/game/World.cpp b/src/game/World.cpp
index d4042de..daf4d84 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -987,6 +987,9 @@ void World::SetInitialWorldSettings()
sLog.outString( "Loading Aggro Spells Definitions...");
sSpellMgr.LoadSpellThreats();
+ sLog.outString( "Loading Spell Threat Multiplicator Definitions...");
+ sSpellMgr.LoadSpellThreatMultiplicators();
+
sLog.outString( "Loading NPC Texts..." );
sObjectMgr.LoadGossipText();
DROP TABLE IF EXISTS `spell_threat_multiplicator`;
CREATE TABLE `spell_threat_multiplicator` (
`entry` mediumint(9) NOT NULL,
`threat_multiplicator` float NOT NULL,
PRIMARY KEY (`entry`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
作者:
爱上你的人
时间:
2016-12-9 03:11
感谢楼主分享,祝愿吾爱尚玩越来越好!
欢迎光临 吾爱尚玩资源基地 (http://bbs.523play.com/)
Powered by Discuz! X3.4