mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-06 02:02:25 +00:00
[Quest API] Default ScaleNPC to always scale. (#2818)
* [Quest API] Default ScaleNPC to always scale. # Notes - ScaleNPC will now always override stats, with the option to override special abilities. * Update npc_scale_manager.h
This commit is contained in:
parent
ee6f6f683c
commit
c1584da9cc
@ -761,16 +761,10 @@ void Lua_NPC::ScaleNPC(uint8 npc_level)
|
|||||||
self->ScaleNPC(npc_level);
|
self->ScaleNPC(npc_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lua_NPC::ScaleNPC(uint8 npc_level, bool always_scale_stats)
|
void Lua_NPC::ScaleNPC(uint8 npc_level, bool override_special_abilities)
|
||||||
{
|
{
|
||||||
Lua_Safe_Call_Void();
|
Lua_Safe_Call_Void();
|
||||||
self->ScaleNPC(npc_level, always_scale_stats);
|
self->ScaleNPC(npc_level, true, override_special_abilities);
|
||||||
}
|
|
||||||
|
|
||||||
void Lua_NPC::ScaleNPC(uint8 npc_level, bool always_scale_stats, bool always_scale_special_abilities)
|
|
||||||
{
|
|
||||||
Lua_Safe_Call_Void();
|
|
||||||
self->ScaleNPC(npc_level, always_scale_stats, always_scale_special_abilities);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
luabind::scope lua_register_npc() {
|
luabind::scope lua_register_npc() {
|
||||||
@ -887,7 +881,6 @@ luabind::scope lua_register_npc() {
|
|||||||
.def("SaveGuardSpot", (void(Lua_NPC::*)(float,float,float,float))&Lua_NPC::SaveGuardSpot)
|
.def("SaveGuardSpot", (void(Lua_NPC::*)(float,float,float,float))&Lua_NPC::SaveGuardSpot)
|
||||||
.def("ScaleNPC", (void(Lua_NPC::*)(uint8))&Lua_NPC::ScaleNPC)
|
.def("ScaleNPC", (void(Lua_NPC::*)(uint8))&Lua_NPC::ScaleNPC)
|
||||||
.def("ScaleNPC", (void(Lua_NPC::*)(uint8,bool))&Lua_NPC::ScaleNPC)
|
.def("ScaleNPC", (void(Lua_NPC::*)(uint8,bool))&Lua_NPC::ScaleNPC)
|
||||||
.def("ScaleNPC", (void(Lua_NPC::*)(uint8,bool,bool))&Lua_NPC::ScaleNPC)
|
|
||||||
.def("SendPayload", (void(Lua_NPC::*)(int))&Lua_NPC::SendPayload)
|
.def("SendPayload", (void(Lua_NPC::*)(int))&Lua_NPC::SendPayload)
|
||||||
.def("SendPayload", (void(Lua_NPC::*)(int,std::string))&Lua_NPC::SendPayload)
|
.def("SendPayload", (void(Lua_NPC::*)(int,std::string))&Lua_NPC::SendPayload)
|
||||||
.def("SetCopper", (void(Lua_NPC::*)(uint32))&Lua_NPC::SetCopper)
|
.def("SetCopper", (void(Lua_NPC::*)(uint32))&Lua_NPC::SetCopper)
|
||||||
|
|||||||
@ -173,8 +173,7 @@ public:
|
|||||||
bool IsLDoNTrapDetected();
|
bool IsLDoNTrapDetected();
|
||||||
void SetLDoNTrapDetected(bool is_detected);
|
void SetLDoNTrapDetected(bool is_detected);
|
||||||
void ScaleNPC(uint8 npc_level);
|
void ScaleNPC(uint8 npc_level);
|
||||||
void ScaleNPC(uint8 npc_level, bool always_scale_stats);
|
void ScaleNPC(uint8 npc_level, bool override_special_abilities);
|
||||||
void ScaleNPC(uint8 npc_level, bool always_scale_stats, bool always_scale_special_abilities);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -3691,7 +3691,7 @@ void NPC::ReloadSpells() {
|
|||||||
AI_AddNPCSpellsEffects(GetNPCSpellsEffectsID());
|
AI_AddNPCSpellsEffects(GetNPCSpellsEffectsID());
|
||||||
}
|
}
|
||||||
|
|
||||||
void NPC::ScaleNPC(uint8 npc_level, bool always_scale_stats, bool always_scale_special_abilities) {
|
void NPC::ScaleNPC(uint8 npc_level, bool always_scale, bool override_special_abilities) {
|
||||||
if (GetLevel() != npc_level) {
|
if (GetLevel() != npc_level) {
|
||||||
SetLevel(npc_level);
|
SetLevel(npc_level);
|
||||||
RecalculateSkills();
|
RecalculateSkills();
|
||||||
@ -3699,7 +3699,7 @@ void NPC::ScaleNPC(uint8 npc_level, bool always_scale_stats, bool always_scale_s
|
|||||||
}
|
}
|
||||||
|
|
||||||
npc_scale_manager->ResetNPCScaling(this);
|
npc_scale_manager->ResetNPCScaling(this);
|
||||||
npc_scale_manager->ScaleNPC(this, always_scale_stats, always_scale_special_abilities);
|
npc_scale_manager->ScaleNPC(this, always_scale, override_special_abilities);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NPC::IsGuard()
|
bool NPC::IsGuard()
|
||||||
|
|||||||
@ -531,7 +531,7 @@ public:
|
|||||||
|
|
||||||
inline bool IsSkipAutoScale() const { return skip_auto_scale; }
|
inline bool IsSkipAutoScale() const { return skip_auto_scale; }
|
||||||
|
|
||||||
void ScaleNPC(uint8 npc_level, bool always_scale_stats = false, bool always_scale_special_abilities = false);
|
void ScaleNPC(uint8 npc_level, bool always_scale = false, bool override_special_abilities = false);
|
||||||
|
|
||||||
void RecalculateSkills();
|
void RecalculateSkills();
|
||||||
void ReloadSpells();
|
void ReloadSpells();
|
||||||
|
|||||||
@ -28,8 +28,8 @@
|
|||||||
*/
|
*/
|
||||||
void NpcScaleManager::ScaleNPC(
|
void NpcScaleManager::ScaleNPC(
|
||||||
NPC *npc,
|
NPC *npc,
|
||||||
bool stats_always_scale,
|
bool always_scale,
|
||||||
bool special_abilities_always_scale
|
bool override_special_abilities
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (npc->IsSkipAutoScale() || npc->GetNPCTypeID() == 0) {
|
if (npc->IsSkipAutoScale() || npc->GetNPCTypeID() == 0) {
|
||||||
@ -53,84 +53,84 @@ void NpcScaleManager::ScaleNPC(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats_always_scale || (npc->GetAC() == 0 && is_auto_scaled)) {
|
if (always_scale || (npc->GetAC() == 0 && is_auto_scaled)) {
|
||||||
npc->ModifyNPCStat("ac", std::to_string(scale_data.ac));
|
npc->ModifyNPCStat("ac", std::to_string(scale_data.ac));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats_always_scale || npc->GetMaxHP() == 0) {
|
if (always_scale || npc->GetMaxHP() == 0) {
|
||||||
npc->ModifyNPCStat("max_hp", std::to_string(scale_data.hp));
|
npc->ModifyNPCStat("max_hp", std::to_string(scale_data.hp));
|
||||||
npc->Heal();
|
npc->Heal();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats_always_scale || npc->GetAccuracyRating() == 0) {
|
if (always_scale || npc->GetAccuracyRating() == 0) {
|
||||||
npc->ModifyNPCStat("accuracy", std::to_string(scale_data.accuracy));
|
npc->ModifyNPCStat("accuracy", std::to_string(scale_data.accuracy));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats_always_scale || npc->GetSlowMitigation() == 0) {
|
if (always_scale || npc->GetSlowMitigation() == 0) {
|
||||||
npc->ModifyNPCStat("slow_mitigation", std::to_string(scale_data.slow_mitigation));
|
npc->ModifyNPCStat("slow_mitigation", std::to_string(scale_data.slow_mitigation));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats_always_scale || npc->GetATK() == 0) {
|
if (always_scale || npc->GetATK() == 0) {
|
||||||
npc->ModifyNPCStat("atk", std::to_string(scale_data.attack));
|
npc->ModifyNPCStat("atk", std::to_string(scale_data.attack));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats_always_scale || npc->GetSTR() == 0) {
|
if (always_scale || npc->GetSTR() == 0) {
|
||||||
npc->ModifyNPCStat("str", std::to_string(scale_data.strength));
|
npc->ModifyNPCStat("str", std::to_string(scale_data.strength));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats_always_scale || npc->GetSTA() == 0) {
|
if (always_scale || npc->GetSTA() == 0) {
|
||||||
npc->ModifyNPCStat("sta", std::to_string(scale_data.stamina));
|
npc->ModifyNPCStat("sta", std::to_string(scale_data.stamina));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats_always_scale || npc->GetDEX() == 0) {
|
if (always_scale || npc->GetDEX() == 0) {
|
||||||
npc->ModifyNPCStat("dex", std::to_string(scale_data.dexterity));
|
npc->ModifyNPCStat("dex", std::to_string(scale_data.dexterity));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats_always_scale || npc->GetAGI() == 0) {
|
if (always_scale || npc->GetAGI() == 0) {
|
||||||
npc->ModifyNPCStat("agi", std::to_string(scale_data.agility));
|
npc->ModifyNPCStat("agi", std::to_string(scale_data.agility));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats_always_scale || npc->GetINT() == 0) {
|
if (always_scale || npc->GetINT() == 0) {
|
||||||
npc->ModifyNPCStat("int", std::to_string(scale_data.intelligence));
|
npc->ModifyNPCStat("int", std::to_string(scale_data.intelligence));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats_always_scale || npc->GetWIS() == 0) {
|
if (always_scale || npc->GetWIS() == 0) {
|
||||||
npc->ModifyNPCStat("wis", std::to_string(scale_data.wisdom));
|
npc->ModifyNPCStat("wis", std::to_string(scale_data.wisdom));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats_always_scale || npc->GetCHA() == 0) {
|
if (always_scale || npc->GetCHA() == 0) {
|
||||||
npc->ModifyNPCStat("cha", std::to_string(scale_data.charisma));
|
npc->ModifyNPCStat("cha", std::to_string(scale_data.charisma));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats_always_scale || npc->GetMR() == 0) {
|
if (always_scale || npc->GetMR() == 0) {
|
||||||
npc->ModifyNPCStat("mr", std::to_string(scale_data.magic_resist));
|
npc->ModifyNPCStat("mr", std::to_string(scale_data.magic_resist));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats_always_scale || npc->GetCR() == 0) {
|
if (always_scale || npc->GetCR() == 0) {
|
||||||
npc->ModifyNPCStat("cr", std::to_string(scale_data.cold_resist));
|
npc->ModifyNPCStat("cr", std::to_string(scale_data.cold_resist));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats_always_scale || npc->GetFR() == 0) {
|
if (always_scale || npc->GetFR() == 0) {
|
||||||
npc->ModifyNPCStat("fr", std::to_string(scale_data.fire_resist));
|
npc->ModifyNPCStat("fr", std::to_string(scale_data.fire_resist));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats_always_scale || npc->GetPR() == 0) {
|
if (always_scale || npc->GetPR() == 0) {
|
||||||
npc->ModifyNPCStat("pr", std::to_string(scale_data.poison_resist));
|
npc->ModifyNPCStat("pr", std::to_string(scale_data.poison_resist));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats_always_scale || npc->GetDR() == 0) {
|
if (always_scale || npc->GetDR() == 0) {
|
||||||
npc->ModifyNPCStat("dr", std::to_string(scale_data.disease_resist));
|
npc->ModifyNPCStat("dr", std::to_string(scale_data.disease_resist));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats_always_scale || (npc->GetCorrup() == 0 && is_auto_scaled)) {
|
if (always_scale || (npc->GetCorrup() == 0 && is_auto_scaled)) {
|
||||||
npc->ModifyNPCStat("cor", std::to_string(scale_data.corruption_resist));
|
npc->ModifyNPCStat("cor", std::to_string(scale_data.corruption_resist));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats_always_scale || (npc->GetPhR() == 0 && is_auto_scaled)) {
|
if (always_scale || (npc->GetPhR() == 0 && is_auto_scaled)) {
|
||||||
npc->ModifyNPCStat("phr", std::to_string(scale_data.physical_resist));
|
npc->ModifyNPCStat("phr", std::to_string(scale_data.physical_resist));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats_always_scale || npc->GetMinDMG() == 0) {
|
if (always_scale || npc->GetMinDMG() == 0) {
|
||||||
int min_dmg = scale_data.min_dmg;
|
int min_dmg = scale_data.min_dmg;
|
||||||
if (RuleB(Combat, UseNPCDamageClassLevelMods)) {
|
if (RuleB(Combat, UseNPCDamageClassLevelMods)) {
|
||||||
int32 class_level_damage_mod = GetClassLevelDamageMod(npc->GetLevel(), npc->GetClass());
|
int32 class_level_damage_mod = GetClassLevelDamageMod(npc->GetLevel(), npc->GetClass());
|
||||||
@ -142,7 +142,7 @@ void NpcScaleManager::ScaleNPC(
|
|||||||
npc->ModifyNPCStat("min_hit", std::to_string(min_dmg));
|
npc->ModifyNPCStat("min_hit", std::to_string(min_dmg));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats_always_scale || npc->GetMaxDMG() == 0) {
|
if (always_scale || npc->GetMaxDMG() == 0) {
|
||||||
int max_dmg = scale_data.max_dmg;
|
int max_dmg = scale_data.max_dmg;
|
||||||
if (RuleB(Combat, UseNPCDamageClassLevelMods)) {
|
if (RuleB(Combat, UseNPCDamageClassLevelMods)) {
|
||||||
int32 class_level_damage_mod = GetClassLevelDamageMod(npc->GetLevel(), npc->GetClass());
|
int32 class_level_damage_mod = GetClassLevelDamageMod(npc->GetLevel(), npc->GetClass());
|
||||||
@ -154,23 +154,23 @@ void NpcScaleManager::ScaleNPC(
|
|||||||
npc->ModifyNPCStat("max_hit", std::to_string(max_dmg));
|
npc->ModifyNPCStat("max_hit", std::to_string(max_dmg));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats_always_scale || (npc->GetHPRegen() == 0 && is_auto_scaled)) {
|
if (always_scale || (npc->GetHPRegen() == 0 && is_auto_scaled)) {
|
||||||
npc->ModifyNPCStat("hp_regen", std::to_string(scale_data.hp_regen_rate));
|
npc->ModifyNPCStat("hp_regen", std::to_string(scale_data.hp_regen_rate));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats_always_scale || npc->GetAttackDelay() == 0) {
|
if (always_scale || npc->GetAttackDelay() == 0) {
|
||||||
npc->ModifyNPCStat("attack_delay", std::to_string(scale_data.attack_delay));
|
npc->ModifyNPCStat("attack_delay", std::to_string(scale_data.attack_delay));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats_always_scale || npc->GetSpellScale() == 0) {
|
if (always_scale || npc->GetSpellScale() == 0) {
|
||||||
npc->ModifyNPCStat("spell_scale", std::to_string(scale_data.spell_scale));
|
npc->ModifyNPCStat("spell_scale", std::to_string(scale_data.spell_scale));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats_always_scale || npc->GetHealScale() == 0) {
|
if (always_scale || npc->GetHealScale() == 0) {
|
||||||
npc->ModifyNPCStat("heal_scale", std::to_string(scale_data.heal_scale));
|
npc->ModifyNPCStat("heal_scale", std::to_string(scale_data.heal_scale));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (special_abilities_always_scale || (!npc->HasSpecialAbilities() && is_auto_scaled)) {
|
if (override_special_abilities || (!npc->HasSpecialAbilities() && is_auto_scaled)) {
|
||||||
npc->ModifyNPCStat("special_abilities", scale_data.special_abilities);
|
npc->ModifyNPCStat("special_abilities", scale_data.special_abilities);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -86,7 +86,7 @@ public:
|
|||||||
"special_abilities"
|
"special_abilities"
|
||||||
};
|
};
|
||||||
|
|
||||||
void ScaleNPC(NPC* npc, bool always_scale_stats = false, bool always_scale_special_abilities = false);
|
void ScaleNPC(NPC* npc, bool always_scale = false, bool override_special_abilities = false);
|
||||||
void ResetNPCScaling(NPC* npc);
|
void ResetNPCScaling(NPC* npc);
|
||||||
bool IsAutoScaled(NPC* npc);
|
bool IsAutoScaled(NPC* npc);
|
||||||
bool LoadScaleData();
|
bool LoadScaleData();
|
||||||
|
|||||||
@ -750,14 +750,9 @@ void Perl_NPC_ScaleNPC(NPC* self, uint8 npc_level)
|
|||||||
return self->ScaleNPC(npc_level);
|
return self->ScaleNPC(npc_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Perl_NPC_ScaleNPC(NPC* self, uint8 npc_level, bool always_scale_stats)
|
void Perl_NPC_ScaleNPC(NPC* self, uint8 npc_level, bool override_special_abilities)
|
||||||
{
|
{
|
||||||
return self->ScaleNPC(npc_level, always_scale_stats);
|
return self->ScaleNPC(npc_level, override_special_abilities);
|
||||||
}
|
|
||||||
|
|
||||||
void Perl_NPC_ScaleNPC(NPC* self, uint8 npc_level, bool always_scale_stats, bool always_scale_special_abilities)
|
|
||||||
{
|
|
||||||
return self->ScaleNPC(npc_level, always_scale_stats, always_scale_special_abilities);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void perl_register_npc()
|
void perl_register_npc()
|
||||||
@ -884,7 +879,6 @@ void perl_register_npc()
|
|||||||
package.add("SaveGuardSpot", (void(*)(NPC*, float, float, float, float))&Perl_NPC_SaveGuardSpot);
|
package.add("SaveGuardSpot", (void(*)(NPC*, float, float, float, float))&Perl_NPC_SaveGuardSpot);
|
||||||
package.add("ScaleNPC", (void(*)(NPC*, uint8))&Perl_NPC_ScaleNPC);
|
package.add("ScaleNPC", (void(*)(NPC*, uint8))&Perl_NPC_ScaleNPC);
|
||||||
package.add("ScaleNPC", (void(*)(NPC*, uint8, bool))&Perl_NPC_ScaleNPC);
|
package.add("ScaleNPC", (void(*)(NPC*, uint8, bool))&Perl_NPC_ScaleNPC);
|
||||||
package.add("ScaleNPC", (void(*)(NPC*, uint8, bool, bool))&Perl_NPC_ScaleNPC);
|
|
||||||
package.add("SendPayload", (void(*)(NPC*, int))&Perl_NPC_SendPayload);
|
package.add("SendPayload", (void(*)(NPC*, int))&Perl_NPC_SendPayload);
|
||||||
package.add("SendPayload", (void(*)(NPC*, int, std::string))&Perl_NPC_SendPayload);
|
package.add("SendPayload", (void(*)(NPC*, int, std::string))&Perl_NPC_SendPayload);
|
||||||
package.add("SetCopper", &Perl_NPC_SetCopper);
|
package.add("SetCopper", &Perl_NPC_SetCopper);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user