mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +00:00
Allow rule access from lua, double checked and fixed up the spell mitigation stuff
This commit is contained in:
parent
70b3a7ba84
commit
16cbf9bbf1
@ -1,27 +1,27 @@
|
|||||||
SoftcapFactor = 1.88;
|
MonkACBonusWeight = RuleI.Get(Rule.MonkACBonusWeight);
|
||||||
MonkACBonusWeight = 15;
|
NPCACFactor = RuleR.Get(Rule.NPCACFactor);
|
||||||
NPCACFactor = 2.25;
|
OldACSoftcapRules = RuleB.Get(Rule.OldACSoftcapRules);
|
||||||
OldACSoftcapRules = true;
|
ClothACSoftcap = RuleI.Get(Rule.ClothACSoftcap);
|
||||||
ClothACSoftcap = 75;
|
LeatherACSoftcap = RuleI.Get(Rule.LeatherACSoftcap);
|
||||||
LeatherACSoftcap = 100;
|
MonkACSoftcap = RuleI.Get(Rule.MonkACSoftcap);
|
||||||
MonkACSoftcap = 120;
|
ChainACSoftcap = RuleI.Get(Rule.ChainACSoftcap);
|
||||||
ChainACSoftcap = 200;
|
PlateACSoftcap = RuleI.Get(Rule.PlateACSoftcap);
|
||||||
PlateACSoftcap = 300;
|
|
||||||
AAMitigationACFactor = 3.0;
|
AAMitigationACFactor = RuleR.Get(Rule.AAMitigationACFactor);
|
||||||
WarriorACSoftcapReturn = 0.45;
|
WarriorACSoftcapReturn = RuleR.Get(Rule.WarriorACSoftcapReturn);
|
||||||
KnightACSoftcapReturn = 0.33;
|
KnightACSoftcapReturn = RuleR.Get(Rule.KnightACSoftcapReturn);
|
||||||
LowPlateChainACSoftcapReturn = 0.23;
|
LowPlateChainACSoftcapReturn = RuleR.Get(Rule.LowPlateChainACSoftcapReturn);
|
||||||
LowChainLeatherACSoftcapReturn = 0.17;
|
LowChainLeatherACSoftcapReturn = RuleR.Get(Rule.LowChainLeatherACSoftcapReturn);
|
||||||
CasterACSoftcapReturn = 0.06;
|
CasterACSoftcapReturn = RuleR.Get(Rule.CasterACSoftcapReturn);
|
||||||
MiscACSoftcapReturn = 0.3;
|
MiscACSoftcapReturn = RuleR.Get(Rule.MiscACSoftcapReturn);
|
||||||
WarACSoftcapReturn = 0.3448;
|
WarACSoftcapReturn = RuleR.Get(Rule.WarACSoftcapReturn);
|
||||||
ClrRngMnkBrdACSoftcapReturn = 0.3030;
|
ClrRngMnkBrdACSoftcapReturn = RuleR.Get(Rule.ClrRngMnkBrdACSoftcapReturn);
|
||||||
PalShdACSoftcapReturn = 0.3226;
|
PalShdACSoftcapReturn = RuleR.Get(Rule.PalShdACSoftcapReturn);
|
||||||
DruNecWizEncMagACSoftcapReturn = 0.2000;
|
DruNecWizEncMagACSoftcapReturn = RuleR.Get(Rule.DruNecWizEncMagACSoftcapReturn);
|
||||||
RogShmBstBerACSoftcapReturn = 0.2500;
|
RogShmBstBerACSoftcapReturn = RuleR.Get(Rule.RogShmBstBerACSoftcapReturn);
|
||||||
SoftcapFactor = 1.88;
|
SoftcapFactor = RuleR.Get(Rule.SoftcapFactor);
|
||||||
ACthac0Factor = 0.55;
|
ACthac0Factor = RuleR.Get(Rule.ACthac0Factor);
|
||||||
ACthac20Factor = 0.55;
|
ACthac20Factor = RuleR.Get(Rule.ACthac20Factor);
|
||||||
|
|
||||||
MeleeBaseCritChance = 0.0;
|
MeleeBaseCritChance = 0.0;
|
||||||
ClientBaseCritChance = 0.0;
|
ClientBaseCritChance = 0.0;
|
||||||
@ -31,16 +31,16 @@ RogueCritThrowingChance = 25;
|
|||||||
RogueDeadlyStrikeChance = 80;
|
RogueDeadlyStrikeChance = 80;
|
||||||
RogueDeadlyStrikeMod = 2;
|
RogueDeadlyStrikeMod = 2;
|
||||||
|
|
||||||
BaseHitChance = 69.0;
|
BaseHitChance = RuleR.Get(Rule.BaseHitChance);
|
||||||
NPCBonusHitChance = 26.0;
|
NPCBonusHitChance = RuleR.Get(Rule.NPCBonusHitChance);
|
||||||
HitFalloffMinor = 5.0;
|
HitFalloffMinor = RuleR.Get(Rule.HitFalloffMinor);
|
||||||
HitFalloffModerate = 7.0;
|
HitFalloffModerate = RuleR.Get(Rule.HitFalloffModerate);
|
||||||
HitFalloffMajor = 50.0;
|
HitFalloffMajor = RuleR.Get(Rule.HitFalloffMajor);
|
||||||
HitBonusPerLevel = 1.2;
|
HitBonusPerLevel = RuleR.Get(Rule.HitBonusPerLevel);
|
||||||
AgiHitFactor = 0.01;
|
AgiHitFactor = RuleR.Get(Rule.AgiHitFactor);
|
||||||
WeaponSkillFalloff = 0.33;
|
WeaponSkillFalloff = RuleR.Get(Rule.WeaponSkillFalloff);
|
||||||
ArcheryHitPenalty = 0.25;
|
ArcheryHitPenalty = RuleR.Get(Rule.ArcheryHitPenalty);
|
||||||
UseOldDamageIntervalRules = true;
|
UseOldDamageIntervalRules = RuleB.Get(Rule.UseOldDamageIntervalRules);
|
||||||
|
|
||||||
function MeleeMitigation(e)
|
function MeleeMitigation(e)
|
||||||
e.IgnoreDefault = true;
|
e.IgnoreDefault = true;
|
||||||
@ -588,7 +588,7 @@ function ClientGetMeleeMitDmg(defender, attacker, damage, min_damage, mitigation
|
|||||||
end
|
end
|
||||||
|
|
||||||
dmg_bonus = dmg_bonus - (dmg_bonus * (defender:GetItemBonuses():MeleeMitigation() / 100.0));
|
dmg_bonus = dmg_bonus - (dmg_bonus * (defender:GetItemBonuses():MeleeMitigation() / 100.0));
|
||||||
dmg_interval = dmg_interval - (dmg_interval * spellMeleeMit);
|
dmg_interval = dmg_interval + (dmg_interval * spellMeleeMit);
|
||||||
|
|
||||||
local mit_roll = Random.Real(0, mitigation_rating);
|
local mit_roll = Random.Real(0, mitigation_rating);
|
||||||
local atk_roll = Random.Real(0, attack_rating);
|
local atk_roll = Random.Real(0, attack_rating);
|
||||||
@ -656,7 +656,7 @@ function MobGetMeleeMitDmg(defender, attacker, damage, min_damage, mitigation_ra
|
|||||||
local interval = (damage - min_damage) / 20.0;
|
local interval = (damage - min_damage) / 20.0;
|
||||||
damage = damage - (math.floor(d) * interval);
|
damage = damage - (math.floor(d) * interval);
|
||||||
damage = damage - (min_damage * defender:GetItemBonuses():MeleeMitigation() / 100);
|
damage = damage - (min_damage * defender:GetItemBonuses():MeleeMitigation() / 100);
|
||||||
damage = damage - (damage * (-defender:GetSpellBonuses():MeleeMitigationEffect() + defender:GetItemBonuses():MeleeMitigationEffect() + defender:GetAABonuses():MeleeMitigationEffect()) / 100);
|
damage = damage + (damage * (defender:GetSpellBonuses():MeleeMitigationEffect() + defender:GetItemBonuses():MeleeMitigationEffect() + defender:GetAABonuses():MeleeMitigationEffect()) / 100);
|
||||||
|
|
||||||
return damage;
|
return damage;
|
||||||
end
|
end
|
||||||
|
|||||||
@ -10,6 +10,7 @@
|
|||||||
#include "../common/timer.h"
|
#include "../common/timer.h"
|
||||||
#include "../common/eqemu_logsys.h"
|
#include "../common/eqemu_logsys.h"
|
||||||
#include "../common/classes.h"
|
#include "../common/classes.h"
|
||||||
|
#include "../common/rulesys.h"
|
||||||
#include "lua_parser.h"
|
#include "lua_parser.h"
|
||||||
#include "lua_item.h"
|
#include "lua_item.h"
|
||||||
#include "lua_iteminst.h"
|
#include "lua_iteminst.h"
|
||||||
@ -33,6 +34,7 @@ struct Skills { };
|
|||||||
struct BodyTypes { };
|
struct BodyTypes { };
|
||||||
struct Filters { };
|
struct Filters { };
|
||||||
struct MessageTypes { };
|
struct MessageTypes { };
|
||||||
|
struct Rule { };
|
||||||
|
|
||||||
struct lua_registered_event {
|
struct lua_registered_event {
|
||||||
std::string encounter_name;
|
std::string encounter_name;
|
||||||
@ -1485,6 +1487,18 @@ int random_roll0(int max) {
|
|||||||
return zone->random.Roll0(max);
|
return zone->random.Roll0(max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int get_rulei(int rule) {
|
||||||
|
return RuleManager::Instance()->GetIntRule((RuleManager::IntType)rule);
|
||||||
|
}
|
||||||
|
|
||||||
|
float get_ruler(int rule) {
|
||||||
|
return RuleManager::Instance()->GetRealRule((RuleManager::RealType)rule);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool get_ruleb(int rule) {
|
||||||
|
return RuleManager::Instance()->GetBoolRule((RuleManager::BoolType)rule);
|
||||||
|
}
|
||||||
|
|
||||||
luabind::scope lua_register_general() {
|
luabind::scope lua_register_general() {
|
||||||
return luabind::namespace_("eq")
|
return luabind::namespace_("eq")
|
||||||
[
|
[
|
||||||
@ -2205,4 +2219,46 @@ luabind::scope lua_register_message_types() {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
luabind::scope lua_register_rules_const() {
|
||||||
|
return luabind::class_<Rule>("Rule")
|
||||||
|
.enum_("constants")
|
||||||
|
[
|
||||||
|
#define RULE_INT(cat, rule, default_value) \
|
||||||
|
luabind::value(#rule, RuleManager::Int__##rule),
|
||||||
|
#include "../common/ruletypes.h"
|
||||||
|
luabind::value("_IntRuleCount", RuleManager::_IntRuleCount),
|
||||||
|
#undef RULE_INT
|
||||||
|
#define RULE_REAL(cat, rule, default_value) \
|
||||||
|
luabind::value(#rule, RuleManager::Real__##rule),
|
||||||
|
#include "../common/ruletypes.h"
|
||||||
|
luabind::value("_RealRuleCount", RuleManager::_RealRuleCount),
|
||||||
|
#undef RULE_REAL
|
||||||
|
#define RULE_BOOL(cat, rule, default_value) \
|
||||||
|
luabind::value(#rule, RuleManager::Bool__##rule),
|
||||||
|
#include "../common/ruletypes.h"
|
||||||
|
luabind::value("_BoolRuleCount", RuleManager::_BoolRuleCount)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
luabind::scope lua_register_rulei() {
|
||||||
|
return luabind::namespace_("RuleI")
|
||||||
|
[
|
||||||
|
luabind::def("Get", &get_rulei)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
luabind::scope lua_register_ruler() {
|
||||||
|
return luabind::namespace_("RuleR")
|
||||||
|
[
|
||||||
|
luabind::def("Get", &get_ruler)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
luabind::scope lua_register_ruleb() {
|
||||||
|
return luabind::namespace_("RuleB")
|
||||||
|
[
|
||||||
|
luabind::def("Get", &get_ruleb)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -15,6 +15,10 @@ luabind::scope lua_register_skills();
|
|||||||
luabind::scope lua_register_bodytypes();
|
luabind::scope lua_register_bodytypes();
|
||||||
luabind::scope lua_register_filters();
|
luabind::scope lua_register_filters();
|
||||||
luabind::scope lua_register_message_types();
|
luabind::scope lua_register_message_types();
|
||||||
|
luabind::scope lua_register_rules_const();
|
||||||
|
luabind::scope lua_register_rulei();
|
||||||
|
luabind::scope lua_register_ruler();
|
||||||
|
luabind::scope lua_register_ruleb();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -1096,7 +1096,11 @@ void LuaParser::MapFunctions(lua_State *L) {
|
|||||||
lua_register_object(),
|
lua_register_object(),
|
||||||
lua_register_packet(),
|
lua_register_packet(),
|
||||||
lua_register_packet_opcodes(),
|
lua_register_packet_opcodes(),
|
||||||
lua_register_stat_bonuses()
|
lua_register_stat_bonuses(),
|
||||||
|
lua_register_rules_const(),
|
||||||
|
lua_register_rulei(),
|
||||||
|
lua_register_ruler(),
|
||||||
|
lua_register_ruleb()
|
||||||
];
|
];
|
||||||
|
|
||||||
} catch(std::exception &ex) {
|
} catch(std::exception &ex) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user