吾爱尚玩资源基地
标题:
魔兽世界私服模拟器职业平衡控制系统
[打印本页]
作者:
admin
时间:
2016-4-18 22:31
标题:
魔兽世界私服模拟器职业平衡控制系统
Index: Chat.cpp===================================================================
--- Chat.cpp (revision 456)
+++ Chat.cpp (working copy)
@@ -471,6 +471,7 @@
{ "creature_addtemp", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadCreatureAddtempCommand, "", NULL }, //重载灾变系统
{ "spell_cost", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellCostCommand, "", NULL }, //使用技能的消耗数据库从载
{ "item_price", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadBuyItemPriceCommand, "", NULL }, //购买物品消耗系统
+ { "attack_power", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAttackPowerCommand, "", NULL }, //职业伤害治疗倍率系统
{ NULL, 0, false, NULL, "", NULL }
};
Index: Chat.h
===================================================================
--- Chat.h (revision 456)
+++ Chat.h (working copy)
@@ -397,6 +397,7 @@
bool HandleReloadCreatureAddtempCommand(const char* args); //重载灾变秒年2 2系统
bool HandleReloadSpellCostCommand(const char* args); //使用技能的消耗数据库从载
bool HandleReloadBuyItemPriceCommand(const char* args); //购买物品消耗系统
+ bool HandleReloadAttackPowerCommand(const char* args); //职业伤害治疗倍率系统
bool HandleResetAchievementsCommand(const char * args);
bool HandleResetAllCommand(const char * args);
Index: Level3.cpp
===================================================================
--- Level3.cpp (revision 456)
+++ Level3.cpp (working copy)
@@ -169,6 +169,7 @@
HandleReloadCreatureAddtempCommand("a"); //重载灾变系统
HandleReloadSpellCostCommand("a"); //使用技能的消耗数据库从载
HandleReloadBuyItemPriceCommand("a"); //购买物品消耗系统
+ HandleReloadAttackPowerCommand("a"); //职业伤害治疗倍率系统
return true;
}
@@ -819,6 +820,17 @@
return true;
}
+bool ChatHandler::HandleReloadAttackPowerCommand(const char* /*arg*/) //职业伤害治疗倍率系统
+{
+ sLog.outString( "Re-Loading attack power table...");
+
+ objmgr.LoadAttackPowerEntrys();
+
+ SendGlobalSysMessage("DB table `attack_power` reloaded.");
+
+ return true;
+}
+
bool ChatHandler::HandleReloadLocalesAchievementRewardCommand(const char*)
{
sLog.outString( "Re-Loading Locales Achievement Reward Data..." );
Index: ObjectMgr.cpp
===================================================================
--- ObjectMgr.cpp (revision 456)
+++ ObjectMgr.cpp (working copy)
@@ -7329,6 +7329,53 @@
sLog.outString( ">> Loaded %u item price from `item_price`", total_count);
}//重载物品购买消费系统
+void ObjectMgr::LoadAttackPowerEntrys() //重载职业伤害治疗倍率系统系统
+{
+ m_Attack_Power.clear();
+ QueryResult *result = WorldDatabase.Query("SELECT class, aura_healing, spell_damage, physic_damage FROM attack_power");
+
+ uint32 total_count = 0;
+
+ if( !result )
+ {
+ barGoLink bar( 1 );
+ bar.step();
+
+ sLog.outString();
+ sLog.outString( ">> Loaded %u attck power", total_count );
+ return;
+ }
+
+ barGoLink bar( result->GetRowCount() );
+
+ Field* fields;
+ do
+ {
+ AttackPower temp; //定义内存
+ bar.step();
+ fields = result->Fetch();
+ uint32 entry = fields[0].GetUInt32();
+ if(!sChrClassesStore.LookupEntry(entry))
+ {
+ sLog.outErrorDb("Wrong class %u in `attack_power` table, ignoring.",entry);
+ continue;
+ }
+ temp.cClass = entry;
+ temp.Aurahealing = fields[1].GetFloat();
+ temp.Spelldamage = fields[2].GetFloat();
+ temp.Physicdamage = fields[3].GetFloat();
+
+ m_Attack_Power[entry] = temp; //把值放到内存
+
+ ++total_count;
+ } while ( result->NextRow() );
+
+ delete result;
+
+ sLog.outString();
+ sLog.outString( ">> Loaded %u attack power from `attack_power`", total_count);
+}//重载职业伤害治疗倍率系统系统
+
void ObjectMgr::LoadFishingBaseSkillLevel()
{
mFishingBaseForArea.clear(); // for reload case
Index: ObjectMgr.h
===================================================================
--- ObjectMgr.h (revision 456)
+++ ObjectMgr.h (working copy)
@@ -111,6 +111,15 @@
uint32 itemcount;
};
+struct AttackPower //职业伤害治疗倍率系统
+{
+ uint32 entry;
+ uint32 cClass;
+ float Aurahealing;
+ float Spelldamage;
+ float Physicdamage;
+};
+
struct ScriptInfo
{
uint32 id;
@@ -362,6 +371,8 @@
typedef UNORDERED_MAP<uint32, BuyItemPrice> BuyItemPriceMap;//购买物品消耗系统
+ typedef UNORDERED_MAP<uint32, AttackPower> AttackPowerMap;//重载职业伤害治疗倍率系统系统
+
typedef UNORDERED_MAP<uint32, uint32> AreaTriggerScriptMap;
typedef UNORDERED_MAP<uint32, ReputationOnKillEntry> RepOnKillMap;
@@ -486,6 +497,33 @@
}
BuyItemPriceMap const& GetItemPrice() const { return m_BuyItem_Price; }
+ float GetAurahealing(uint32 pClass) const //职业伤害治疗倍率系统系统
+ {
+ float result=1.0f;
+ AttackPowerMap::const_iterator itr = m_Attack_Power.find(pClass);
+ if( itr != m_Attack_Power.end( ) )
+ result = itr->second.Aurahealing;
+ return result;
+ }
+
+ float GetSpelldamage(uint32 pClass) const //职业法术伤害倍率系统系统
+ {
+ float result=1.0f;
+ AttackPowerMap::const_iterator itr = m_Attack_Power.find(pClass);
+ if( itr != m_Attack_Power.end( ) )
+ result = itr->second.Spelldamage;
+ return result;
+ }
+
+ float GetPhysicdamage(uint32 pClass) const //职业物理攻击倍率系统系统
+ {
+ float result=1.0f;
+ AttackPowerMap::const_iterator itr = m_Attack_Power.find(pClass);
+ if( itr != m_Attack_Power.end( ) )
+ result = itr->second.Physicdamage;
+ return result;
+ }
+
uint32 GetQuestForAreaTrigger(uint32 Trigger_ID) const
{
QuestAreaTriggerMap::const_iterator itr = mQuestAreaTriggerMap.find(Trigger_ID);
@@ -832,6 +870,8 @@
void LoadBuyItemPriceEntrys(); //重载购买物品消耗系统
+ void LoadAttackPowerEntrys(); //重载职业伤害治疗倍率系统
+
int GetIndexForLocale(LocaleConstant loc);
LocaleConstant GetLocaleForIndex(int i);
@@ -966,6 +1006,8 @@
BuyItemPriceMap m_BuyItem_Price;//购买物品消耗系统
+ AttackPowerMap m_Attack_Power;//职业伤害治疗倍率系统系统
+
GraveYardMap mGraveYardMap;
GameTeleMap m_GameTeleMap;
Index: Unit.cpp
===================================================================
--- Unit.cpp (revision 456)
+++ Unit.cpp (working copy)
@@ -8811,9 +8811,26 @@
tmpDamage = (tmpDamage + TakenTotal) * TakenTotalMod;
- if(GetTypeId() == TYPEID_PLAYER)
- {
- tmpDamage *= sConfig.GetFloatDefault("Spell.Damage", 1);//法术技能伤害
+ if(sConfig.GetIntDefault("Attack.Power.System", 0) == 1)//法术技能伤害
+ {
+ if (GetTypeId() == TYPEID_PLAYER)
+ {
+ uint32 pClassis = getClass();
+ switch (pClassis)
+ {
+ case CLASS_WARRIOR: tmpDamage *= objmgr.GetSpelldamage(1); break;
+ case CLASS_PALADIN: tmpDamage *= objmgr.GetSpelldamage(2); break;
+ case CLASS_HUNTER: tmpDamage *= objmgr.GetSpelldamage(3); break;
+ case CLASS_ROGUE: tmpDamage *= objmgr.GetSpelldamage(4); break;
+ case CLASS_PRIEST: tmpDamage *= objmgr.GetSpelldamage(5); break;
+ case CLASS_DEATH_KNIGHT: tmpDamage *= objmgr.GetSpelldamage(6); break;
+ case CLASS_SHAMAN: tmpDamage *= objmgr.GetSpelldamage(7); break;
+ case CLASS_MAGE: tmpDamage *= objmgr.GetSpelldamage(8); break;
+ case CLASS_WARLOCK: tmpDamage *= objmgr.GetSpelldamage(9); break;
+ case CLASS_DRUID: tmpDamage *= objmgr.GetSpelldamage(11); break;
+ }
+ }
+ //tmpDamage *= sConfig.GetFloatDefault("Spell.Damage", 1);//法术技能伤害
}
return tmpDamage > 0 ? uint32(tmpDamage) : 0;
}
@@ -9287,7 +9304,25 @@
if ((*i)->isAffectedOnSpell(spellProto))
TakenTotalMod *= ((*i)->GetModifier()->m_amount + 100.0f) / 100.0f;
- heal = (heal + TakenTotal) * TakenTotalMod * sConfig.GetFloatDefault("Aura.Healing", 1);//法术技能治疗的办法
+ if(sConfig.GetIntDefault("Attack.Power.System", 0) == 1)//职业伤害治疗倍率系统系统
+ {
+ uint32 pClassis = getClass();
+ switch (pClassis)
+ {
+ case CLASS_WARRIOR: heal = (heal + TakenTotal) * TakenTotalMod * objmgr.GetAurahealing(1); break;
+ case CLASS_PALADIN: heal = (heal + TakenTotal) * TakenTotalMod * objmgr.GetAurahealing(2); break;
+ case CLASS_HUNTER: heal = (heal + TakenTotal) * TakenTotalMod * objmgr.GetAurahealing(3); break;
+ case CLASS_ROGUE: heal = (heal + TakenTotal) * TakenTotalMod * objmgr.GetAurahealing(4); break;
+ case CLASS_PRIEST: heal = (heal + TakenTotal) * TakenTotalMod * objmgr.GetAurahealing(5); break;
+ case CLASS_DEATH_KNIGHT: heal = (heal + TakenTotal) * TakenTotalMod * objmgr.GetAurahealing(6); break;
+ case CLASS_SHAMAN: heal = (heal + TakenTotal) * TakenTotalMod * objmgr.GetAurahealing(7); break;
+ case CLASS_MAGE: heal = (heal + TakenTotal) * TakenTotalMod * objmgr.GetAurahealing(8); break;
+ case CLASS_WARLOCK: heal = (heal + TakenTotal) * TakenTotalMod * objmgr.GetAurahealing(9); break;
+ case CLASS_DRUID: heal = (heal + TakenTotal) * TakenTotalMod * objmgr.GetAurahealing(11); break;
+ }
+ }
+ else
+ heal = (heal + TakenTotal) * TakenTotalMod;
return heal < 0 ? 0 : uint32(heal);
}
@@ -9734,9 +9769,26 @@
float tmpDamage = float(int32(pdamage) + DoneFlat) * DonePercent;
- if(GetTypeId() == TYPEID_PLAYER)
- {
- tmpDamage *= sConfig.GetFloatDefault("Physic.Damage", 1); //提高物理攻击伤害
+ if(sConfig.GetIntDefault("Attack.Power.System", 0) == 1)//提高物理攻击伤害
+ {
+ if (GetTypeId() == TYPEID_PLAYER)
+ {
+ uint32 pClassis = getClass();
+ switch (pClassis)
+ {
+ case CLASS_WARRIOR: tmpDamage *= objmgr.GetPhysicdamage(1); break;
+ case CLASS_PALADIN: tmpDamage *= objmgr.GetPhysicdamage(2); break;
+ case CLASS_HUNTER: tmpDamage *= objmgr.GetPhysicdamage(3); break;
+ case CLASS_ROGUE: tmpDamage *= objmgr.GetPhysicdamage(4); break;
+ case CLASS_PRIEST: tmpDamage *= objmgr.GetPhysicdamage(5); break;
+ case CLASS_DEATH_KNIGHT: tmpDamage *= objmgr.GetPhysicdamage(6); break;
+ case CLASS_SHAMAN: tmpDamage *= objmgr.GetPhysicdamage(7); break;
+ case CLASS_MAGE: tmpDamage *= objmgr.GetPhysicdamage(8); break;
+ case CLASS_WARLOCK: tmpDamage *= objmgr.GetPhysicdamage(9); break;
+ case CLASS_DRUID: tmpDamage *= objmgr.GetPhysicdamage(11); break;
+ }
+ }
+ //tmpDamage *= sConfig.GetFloatDefault("Physic.Damage", 1); //提高物理攻击伤害
}
// apply spellmod to Done damage
if(spellProto)
Index: World.cpp
===================================================================
--- World.cpp (revision 456)
+++ World.cpp (working copy)
@@ -1361,6 +1361,9 @@
sLog.outString( "Loading Item Price..." );//载入购买物品消耗系统
objmgr.LoadBuyItemPriceEntrys();
+ sLog.outString( "Loading Attack Power..." );//载入购买物品消耗系统
+ objmgr.LoadAttackPowerEntrys();
+
sLog.outString( "Loading Loot Tables..." );
sLog.outString();
LoadLootTables();
SQL部分
/*
MySQL Data Transfer
Source Host: localhost
Source Database: mangos
Target Host: localhost
Target Database: mangos
Date: 2009-11-3 13:38:37
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for attack_power
-- ----------------------------
CREATE TABLE `attack_power` (
`class` int(3) NOT NULL default '0',
`name` varchar(255) NOT NULL,
`aura_healing` varchar(3) NOT NULL default '1',
`spell_damage` varchar(3) NOT NULL default '1',
`physic_damage` varchar(3) NOT NULL default '1',
PRIMARY KEY (`class`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Chat System';
-- ----------------------------
-- Records
-- ----------------------------
INSERT INTO `attack_power` VALUES ('1', '战士', '1', '1', '1');
INSERT INTO `attack_power` VALUES ('2', '圣骑士', '1', '1', '1');
INSERT INTO `attack_power` VALUES ('3', '猎人', '1', '1', '1');
INSERT INTO `attack_power` VALUES ('4', '盗贼', '1', '1', '1');
INSERT INTO `attack_power` VALUES ('5', '牧师', '1', '1', '1');
INSERT INTO `attack_power` VALUES ('6', '死亡骑士', '1', '1', '1');
INSERT INTO `attack_power` VALUES ('7', '萨满', '1', '1', '1');
INSERT INTO `attack_power` VALUES ('8', '法师', '1', '1', '1');
INSERT INTO `attack_power` VALUES ('9', '术士', '1', '1', '1');
INSERT INTO `attack_power` VALUES ('11', '德鲁伊', '1', '1', '1');
欢迎光临 吾爱尚玩资源基地 (http://bbs.523play.com/)
Powered by Discuz! X3.4