mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 05:21:29 +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 = 15;
|
||||
NPCACFactor = 2.25;
|
||||
OldACSoftcapRules = true;
|
||||
ClothACSoftcap = 75;
|
||||
LeatherACSoftcap = 100;
|
||||
MonkACSoftcap = 120;
|
||||
ChainACSoftcap = 200;
|
||||
PlateACSoftcap = 300;
|
||||
AAMitigationACFactor = 3.0;
|
||||
WarriorACSoftcapReturn = 0.45;
|
||||
KnightACSoftcapReturn = 0.33;
|
||||
LowPlateChainACSoftcapReturn = 0.23;
|
||||
LowChainLeatherACSoftcapReturn = 0.17;
|
||||
CasterACSoftcapReturn = 0.06;
|
||||
MiscACSoftcapReturn = 0.3;
|
||||
WarACSoftcapReturn = 0.3448;
|
||||
ClrRngMnkBrdACSoftcapReturn = 0.3030;
|
||||
PalShdACSoftcapReturn = 0.3226;
|
||||
DruNecWizEncMagACSoftcapReturn = 0.2000;
|
||||
RogShmBstBerACSoftcapReturn = 0.2500;
|
||||
SoftcapFactor = 1.88;
|
||||
ACthac0Factor = 0.55;
|
||||
ACthac20Factor = 0.55;
|
||||
MonkACBonusWeight = RuleI.Get(Rule.MonkACBonusWeight);
|
||||
NPCACFactor = RuleR.Get(Rule.NPCACFactor);
|
||||
OldACSoftcapRules = RuleB.Get(Rule.OldACSoftcapRules);
|
||||
ClothACSoftcap = RuleI.Get(Rule.ClothACSoftcap);
|
||||
LeatherACSoftcap = RuleI.Get(Rule.LeatherACSoftcap);
|
||||
MonkACSoftcap = RuleI.Get(Rule.MonkACSoftcap);
|
||||
ChainACSoftcap = RuleI.Get(Rule.ChainACSoftcap);
|
||||
PlateACSoftcap = RuleI.Get(Rule.PlateACSoftcap);
|
||||
|
||||
AAMitigationACFactor = RuleR.Get(Rule.AAMitigationACFactor);
|
||||
WarriorACSoftcapReturn = RuleR.Get(Rule.WarriorACSoftcapReturn);
|
||||
KnightACSoftcapReturn = RuleR.Get(Rule.KnightACSoftcapReturn);
|
||||
LowPlateChainACSoftcapReturn = RuleR.Get(Rule.LowPlateChainACSoftcapReturn);
|
||||
LowChainLeatherACSoftcapReturn = RuleR.Get(Rule.LowChainLeatherACSoftcapReturn);
|
||||
CasterACSoftcapReturn = RuleR.Get(Rule.CasterACSoftcapReturn);
|
||||
MiscACSoftcapReturn = RuleR.Get(Rule.MiscACSoftcapReturn);
|
||||
WarACSoftcapReturn = RuleR.Get(Rule.WarACSoftcapReturn);
|
||||
ClrRngMnkBrdACSoftcapReturn = RuleR.Get(Rule.ClrRngMnkBrdACSoftcapReturn);
|
||||
PalShdACSoftcapReturn = RuleR.Get(Rule.PalShdACSoftcapReturn);
|
||||
DruNecWizEncMagACSoftcapReturn = RuleR.Get(Rule.DruNecWizEncMagACSoftcapReturn);
|
||||
RogShmBstBerACSoftcapReturn = RuleR.Get(Rule.RogShmBstBerACSoftcapReturn);
|
||||
SoftcapFactor = RuleR.Get(Rule.SoftcapFactor);
|
||||
ACthac0Factor = RuleR.Get(Rule.ACthac0Factor);
|
||||
ACthac20Factor = RuleR.Get(Rule.ACthac20Factor);
|
||||
|
||||
MeleeBaseCritChance = 0.0;
|
||||
ClientBaseCritChance = 0.0;
|
||||
@ -31,16 +31,16 @@ RogueCritThrowingChance = 25;
|
||||
RogueDeadlyStrikeChance = 80;
|
||||
RogueDeadlyStrikeMod = 2;
|
||||
|
||||
BaseHitChance = 69.0;
|
||||
NPCBonusHitChance = 26.0;
|
||||
HitFalloffMinor = 5.0;
|
||||
HitFalloffModerate = 7.0;
|
||||
HitFalloffMajor = 50.0;
|
||||
HitBonusPerLevel = 1.2;
|
||||
AgiHitFactor = 0.01;
|
||||
WeaponSkillFalloff = 0.33;
|
||||
ArcheryHitPenalty = 0.25;
|
||||
UseOldDamageIntervalRules = true;
|
||||
BaseHitChance = RuleR.Get(Rule.BaseHitChance);
|
||||
NPCBonusHitChance = RuleR.Get(Rule.NPCBonusHitChance);
|
||||
HitFalloffMinor = RuleR.Get(Rule.HitFalloffMinor);
|
||||
HitFalloffModerate = RuleR.Get(Rule.HitFalloffModerate);
|
||||
HitFalloffMajor = RuleR.Get(Rule.HitFalloffMajor);
|
||||
HitBonusPerLevel = RuleR.Get(Rule.HitBonusPerLevel);
|
||||
AgiHitFactor = RuleR.Get(Rule.AgiHitFactor);
|
||||
WeaponSkillFalloff = RuleR.Get(Rule.WeaponSkillFalloff);
|
||||
ArcheryHitPenalty = RuleR.Get(Rule.ArcheryHitPenalty);
|
||||
UseOldDamageIntervalRules = RuleB.Get(Rule.UseOldDamageIntervalRules);
|
||||
|
||||
function MeleeMitigation(e)
|
||||
e.IgnoreDefault = true;
|
||||
@ -588,7 +588,7 @@ function ClientGetMeleeMitDmg(defender, attacker, damage, min_damage, mitigation
|
||||
end
|
||||
|
||||
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 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;
|
||||
damage = damage - (math.floor(d) * interval);
|
||||
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;
|
||||
end
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
#include "../common/timer.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
#include "../common/classes.h"
|
||||
#include "../common/rulesys.h"
|
||||
#include "lua_parser.h"
|
||||
#include "lua_item.h"
|
||||
#include "lua_iteminst.h"
|
||||
@ -33,6 +34,7 @@ struct Skills { };
|
||||
struct BodyTypes { };
|
||||
struct Filters { };
|
||||
struct MessageTypes { };
|
||||
struct Rule { };
|
||||
|
||||
struct lua_registered_event {
|
||||
std::string encounter_name;
|
||||
@ -1485,6 +1487,18 @@ int random_roll0(int 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() {
|
||||
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
|
||||
|
||||
@ -15,6 +15,10 @@ luabind::scope lua_register_skills();
|
||||
luabind::scope lua_register_bodytypes();
|
||||
luabind::scope lua_register_filters();
|
||||
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
|
||||
|
||||
@ -1096,7 +1096,11 @@ void LuaParser::MapFunctions(lua_State *L) {
|
||||
lua_register_object(),
|
||||
lua_register_packet(),
|
||||
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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user