mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 09:31:30 +00:00
Revision of slow mitigation code.
Fix for the slow mitigation spam messages Converted value from FLOAT to INT Use SQL to update your npc_types table
This commit is contained in:
parent
983c7a9c91
commit
f9b46b46b1
@ -1,5 +1,13 @@
|
||||
EQEMu Changelog (Started on Sept 24, 2003 15:50)
|
||||
-------------------------------------------------------
|
||||
|
||||
== 04/12/2014 ==
|
||||
Kayen: Fixed an with the slow mitigation code that would cause it to spam the message. Optimized the way the variable is handled for slow mitigation.
|
||||
|
||||
Required SQL: utils/sql/git/required/2014_04_12_SlowMitigation.sql
|
||||
Note: This changes the variable type in the sql table from FLOAT to INT and updates your database.
|
||||
(When setting slow mitigation 50 = 50%, 100 = 100% ect. You can also set > 100 which will cause slow to become haste now with appropriate in game msg given)
|
||||
|
||||
== 04/10/2014 ==
|
||||
Kayen: Added 'no_target_hotkey' field to npc_types table. This will prevent the NPC from being targeted with F8 (Warning: Will also turn it's name YELLOW)
|
||||
Kayen: Added a rule to make all (Player cast) Swarm Pets not targetable with F8 (nearest NPC) by default (Warning: Will also turn pets names YELLOW). This is semi-hack but it works.
|
||||
|
||||
7
utils/sql/git/required/2014_04_12_SlowMitigation.sql
Normal file
7
utils/sql/git/required/2014_04_12_SlowMitigation.sql
Normal file
@ -0,0 +1,7 @@
|
||||
-- Convert all values from FLOAT to INT
|
||||
UPDATE npc_types SET slow_mitigation = slow_mitigation * 100;
|
||||
|
||||
-- Change variable type from FLOAT TO INT
|
||||
ALTER TABLE npc_types MODIFY slow_mitigation smallint(4);
|
||||
|
||||
|
||||
@ -243,12 +243,12 @@
|
||||
#define TRADESKILL_LEARN_RECIPE 3457 //You have learned the recipe %1!
|
||||
#define EXPEDITION_MIN_REMAIN 3551 //You only have %1 minutes remaining before this expedition comes to an end.
|
||||
#define REWIND_WAIT 4059 //You must wait a bit longer before using the rewind command again.
|
||||
#define CORPSEDRAG_LIMIT 4061 //You are already dragging as much as you can!
|
||||
#define CORPSEDRAG_ALREADY 4062 //You are already dragging %1.
|
||||
#define CORPSEDRAG_LIMIT 4061 //You are already dragging as much as you can!
|
||||
#define CORPSEDRAG_ALREADY 4062 //You are already dragging %1.
|
||||
#define CORPSEDRAG_SOMEONE_ELSE 4063 //Someone else is dragging %1.
|
||||
#define CORPSEDRAG_BEGIN 4064 //You begin to drag %1.
|
||||
#define CORPSEDRAG_STOPALL 4065 //You stop dragging the corpses.
|
||||
#define CORPSEDRAG_STOP 4066 //You stop dragging the corpse.
|
||||
#define CORPSEDRAG_BEGIN 4064 //You begin to drag %1.
|
||||
#define CORPSEDRAG_STOPALL 4065 //You stop dragging the corpses.
|
||||
#define CORPSEDRAG_STOP 4066 //You stop dragging the corpse.
|
||||
#define WHOALL_NO_RESULTS 5029 //There are no players in EverQuest that match those who filters.
|
||||
#define PETITION_NO_DELETE 5053 //You do not have a petition in the queue.
|
||||
#define PETITION_DELETED 5054 //Your petition was successfully deleted.
|
||||
@ -300,6 +300,10 @@
|
||||
#define GAIN_RAID_LEADERSHIP_EXP 8789 //
|
||||
#define BUFF_MINUTES_REMAINING 8799 //%1 (%2 minutes remaining)
|
||||
#define FEAR_TOO_HIGH 9035 //Your target is too high of a level for your fear spell.
|
||||
#define SLOW_MOSTLY_SUCCESSFUL 9029 //Your spell was mostly successful.
|
||||
#define SLOW_PARTIALLY_SUCCESSFUL 9030 // Your spell was partially successful.
|
||||
#define SLOW_SLIGHTLY_SUCCESSFUL 9031 //Your spell was slightly successful.
|
||||
#define SPELL_OPPOSITE_EFFECT 9032 //Your spell may have had the opposite effect of what you desired.
|
||||
#define YOU_HEAL 9068 //You have healed %1 for %2 points of damage.
|
||||
#define YOUR_HIT_DOT 9072 //%1 has taken %2 damage from your %3.
|
||||
#define HIT_NON_MELEE 9073 //%1 hit %2 for %3 points of non-melee damage.
|
||||
|
||||
@ -1338,19 +1338,10 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne
|
||||
}
|
||||
}
|
||||
else if ((effect_value - 100) < 0) { // Slow
|
||||
//Slow Mitigation works by taking the amount that would be slowed, and adding a multiplied version of the difference.
|
||||
int real_slow_value = (100 - effect_value) * -1;
|
||||
if (slow_mitigation){
|
||||
int new_effect_value = SlowMitigation(false,caster,real_slow_value);
|
||||
if (new_effect_value < newbon->haste) {
|
||||
newbon->haste = new_effect_value;
|
||||
SlowMitigation(true,caster);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (real_slow_value < newbon->haste)
|
||||
newbon->haste = real_slow_value;
|
||||
}
|
||||
real_slow_value -= ((real_slow_value * GetSlowMitigation()/100));
|
||||
if (real_slow_value < newbon->haste)
|
||||
newbon->haste = real_slow_value;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1365,6 +1356,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne
|
||||
}
|
||||
else if ((effect_value - 100) < 0) { // Slow
|
||||
int real_slow_value = (100 - effect_value) * -1;
|
||||
real_slow_value -= ((real_slow_value * GetSlowMitigation()/100));
|
||||
if (real_slow_value < newbon->hastetype2)
|
||||
newbon->hastetype2 = real_slow_value;
|
||||
}
|
||||
@ -1374,6 +1366,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne
|
||||
case SE_AttackSpeed3:
|
||||
{
|
||||
if (effect_value < 0){ //Slow
|
||||
effect_value -= ((effect_value * GetSlowMitigation()/100));
|
||||
if (effect_value < newbon->hastetype3)
|
||||
newbon->hastetype3 = effect_value;
|
||||
}
|
||||
@ -1392,18 +1385,9 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne
|
||||
effect_value = effect_value * -1;
|
||||
|
||||
if (effect_value > 0 && effect_value > newbon->inhibitmelee) {
|
||||
|
||||
if (slow_mitigation){
|
||||
int new_effect_value = SlowMitigation(false,caster,effect_value);
|
||||
if (new_effect_value > newbon->inhibitmelee) {
|
||||
newbon->inhibitmelee = new_effect_value;
|
||||
SlowMitigation(true,caster);
|
||||
}
|
||||
}
|
||||
|
||||
else if (effect_value > newbon->inhibitmelee) {
|
||||
effect_value -= ((effect_value * GetSlowMitigation()/100));
|
||||
if (effect_value > newbon->inhibitmelee)
|
||||
newbon->inhibitmelee = effect_value;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@ -408,7 +408,7 @@ void Lua_NPC::SetSpellFocusHeal(int focus) {
|
||||
}
|
||||
|
||||
float Lua_NPC::GetSlowMitigation() {
|
||||
Lua_Safe_Call_Real();
|
||||
Lua_Safe_Call_Int();
|
||||
return self->GetSlowMitigation();
|
||||
}
|
||||
|
||||
@ -526,7 +526,7 @@ luabind::scope lua_register_npc() {
|
||||
.def("RemoveAISpell", (void(Lua_NPC::*)(int))&Lua_NPC::RemoveAISpell)
|
||||
.def("SetSpellFocusDMG", (void(Lua_NPC::*)(int))&Lua_NPC::SetSpellFocusDMG)
|
||||
.def("SetSpellFocusHeal", (void(Lua_NPC::*)(int))&Lua_NPC::SetSpellFocusHeal)
|
||||
.def("GetSlowMitigation", (float(Lua_NPC::*)(void))&Lua_NPC::GetSlowMitigation)
|
||||
.def("GetSlowMitigation", (int(Lua_NPC::*)(void))&Lua_NPC::GetSlowMitigation)
|
||||
.def("GetAttackSpeed", (float(Lua_NPC::*)(void))&Lua_NPC::GetAttackSpeed)
|
||||
.def("GetAccuracyRating", (int(Lua_NPC::*)(void))&Lua_NPC::GetAccuracyRating)
|
||||
.def("GetSpawnKillCount", (int(Lua_NPC::*)(void))&Lua_NPC::GetSpawnKillCount)
|
||||
|
||||
27
zone/mob.cpp
27
zone/mob.cpp
@ -4651,8 +4651,12 @@ void Mob::CastOnNumHitFade(uint32 spell_id)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
int Mob::SlowMitigation(bool slow_msg, Mob *caster, int slow_value)
|
||||
{
|
||||
if (slow_mitigation)
|
||||
return 0;
|
||||
|
||||
float int_slow_mitigation = slow_mitigation * 100.0f;
|
||||
|
||||
if (int_slow_mitigation > 100.0f)
|
||||
@ -4663,10 +4667,10 @@ int Mob::SlowMitigation(bool slow_msg, Mob *caster, int slow_value)
|
||||
if (caster && caster->IsClient())
|
||||
{
|
||||
if ((int_slow_mitigation > 0.0f) && (int_slow_mitigation < 26.0f))
|
||||
caster->Message(262, "Your spell was mostly successful");
|
||||
caster->Message_StringID(MT_Spells, SLOW_MOSTLY_SUCCESSFUL);
|
||||
|
||||
else if ((int_slow_mitigation >= 26.0f) && (int_slow_mitigation < 74.0f))
|
||||
caster->Message(262, "Your spell was partially successful");
|
||||
caster->Message_StringID(MT_Spells, SLOW_PARTIALLY_SUCCESSFUL);
|
||||
|
||||
else if ((int_slow_mitigation >= 74.0f) && (int_slow_mitigation < 101.0f))
|
||||
caster->Message(262, "Your spell was slightly successful");
|
||||
@ -4680,6 +4684,25 @@ int Mob::SlowMitigation(bool slow_msg, Mob *caster, int slow_value)
|
||||
return slow_value;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void Mob::SlowMitigation(Mob* caster)
|
||||
{
|
||||
if (GetSlowMitigation() && caster && caster->IsClient())
|
||||
{
|
||||
if ((GetSlowMitigation() > 0) && (GetSlowMitigation() < 26))
|
||||
caster->Message_StringID(MT_SpellFailure, SLOW_MOSTLY_SUCCESSFUL);
|
||||
|
||||
else if ((GetSlowMitigation() >= 26) && (GetSlowMitigation() < 74))
|
||||
caster->Message_StringID(MT_SpellFailure, SLOW_PARTIALLY_SUCCESSFUL);
|
||||
|
||||
else if ((GetSlowMitigation() >= 74) && (GetSlowMitigation() < 101))
|
||||
caster->Message_StringID(MT_SpellFailure, SLOW_SLIGHTLY_SUCCESSFUL);
|
||||
|
||||
else if (GetSlowMitigation() > 100)
|
||||
caster->Message_StringID(MT_SpellFailure, SPELL_OPPOSITE_EFFECT);
|
||||
}
|
||||
}
|
||||
|
||||
uint16 Mob::GetSkillByItemType(int ItemType)
|
||||
{
|
||||
|
||||
@ -580,7 +580,7 @@ public:
|
||||
void CastOnCurer(uint32 spell_id);
|
||||
void CastOnCure(uint32 spell_id);
|
||||
void CastOnNumHitFade(uint32 spell_id);
|
||||
int SlowMitigation(bool slow_msg=false, Mob *caster = nullptr,int slow_value = 0);
|
||||
void SlowMitigation(Mob* caster);
|
||||
int16 GetCritDmgMob(uint16 skill);
|
||||
int16 GetMeleeDamageMod_SE(uint16 skill);
|
||||
int16 GetMeleeMinDamageMod_SE(uint16 skill);
|
||||
@ -598,6 +598,7 @@ public:
|
||||
bool PassCastRestriction(bool UseCastRestriction = true, int16 value = 0, bool IsDamage = true);
|
||||
bool ImprovedTaunt();
|
||||
bool TryRootFadeByDamage(int buffslot, Mob* attacker);
|
||||
int16 GetSlowMitigation() const {return slow_mitigation;}
|
||||
|
||||
void ModSkillDmgTaken(SkillUseTypes skill_num, int value);
|
||||
int16 GetModSkillDmgTaken(const SkillUseTypes skill_num);
|
||||
@ -1023,7 +1024,7 @@ protected:
|
||||
Timer attack_dw_timer;
|
||||
Timer ranged_timer;
|
||||
float attack_speed; //% increase/decrease in attack speed (not haste)
|
||||
float slow_mitigation; // Allows for a slow mitigation based on a % in decimal form. IE, 1 = 100% mitigation, .5 is 50%
|
||||
float slow_mitigation; // Allows for a slow mitigation (100 = 100%, 50% = 50%)
|
||||
Timer tic_timer;
|
||||
Timer mana_timer;
|
||||
|
||||
|
||||
@ -2004,7 +2004,7 @@ void NPC::ModifyNPCStat(const char *identifier, const char *newValue)
|
||||
|
||||
if(id == "slow_mitigation")
|
||||
{
|
||||
slow_mitigation = atof(val.c_str());
|
||||
slow_mitigation = atoi(val.c_str());
|
||||
return;
|
||||
}
|
||||
if(id == "loottable_id")
|
||||
|
||||
@ -233,7 +233,7 @@ public:
|
||||
|
||||
uint32 GetMaxDMG() const {return max_dmg;}
|
||||
uint32 GetMinDMG() const {return min_dmg;}
|
||||
float GetSlowMitigation() const {return slow_mitigation;}
|
||||
int16 GetSlowMitigation() const {return slow_mitigation;}
|
||||
float GetAttackSpeed() const {return attack_speed;}
|
||||
bool IsAnimal() const { return(bodytype == BT_Animal); }
|
||||
uint16 GetPetSpellID() const {return pet_spell_id;}
|
||||
|
||||
@ -2023,7 +2023,7 @@ XS(XS_NPC_GetSlowMitigation)
|
||||
Perl_croak(aTHX_ "Usage: NPC::GetSlowMitigation(THIS)");
|
||||
{
|
||||
NPC * THIS;
|
||||
float RETVAL;
|
||||
int16 RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
if (sv_derived_from(ST(0), "NPC")) {
|
||||
@ -2036,7 +2036,7 @@ XS(XS_NPC_GetSlowMitigation)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = THIS->GetSlowMitigation();
|
||||
XSprePUSH; PUSHn((double)RETVAL);
|
||||
XSprePUSH; PUSHn((UV)RETVAL);
|
||||
}
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
@ -2624,14 +2624,37 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
|
||||
HealDamage(dmg, caster);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SE_Taunt:
|
||||
{
|
||||
if (IsNPC())
|
||||
caster->Taunt(this->CastToNPC(), false, spell.base[i]);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SE_AttackSpeed:
|
||||
if (spell.base[i] < 100)
|
||||
SlowMitigation(caster);
|
||||
break;
|
||||
|
||||
case SE_AttackSpeed2:
|
||||
if (spell.base[i] < 100)
|
||||
SlowMitigation(caster);
|
||||
break;
|
||||
|
||||
case SE_AttackSpeed3:
|
||||
if (spell.base[i] < 0)
|
||||
SlowMitigation(caster);
|
||||
break;
|
||||
|
||||
case SE_AttackSpeed4:
|
||||
SlowMitigation(caster);
|
||||
break;
|
||||
|
||||
// Handled Elsewhere
|
||||
case SE_ImmuneFleeing:
|
||||
case SE_NegateSpellEffect:
|
||||
@ -2717,10 +2740,6 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
|
||||
case SE_DivineSave:
|
||||
case SE_Accuracy:
|
||||
case SE_Flurry:
|
||||
case SE_AttackSpeed:
|
||||
case SE_AttackSpeed2:
|
||||
case SE_AttackSpeed3:
|
||||
case SE_AttackSpeed4:
|
||||
case SE_ImprovedDamage:
|
||||
case SE_ImprovedHeal:
|
||||
case SE_IncreaseSpellHaste:
|
||||
|
||||
@ -1273,7 +1273,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) {
|
||||
tmpNPCType->see_improved_hide = atoi(row[r++])==0?false:true;
|
||||
tmpNPCType->ATK = atoi(row[r++]);
|
||||
tmpNPCType->accuracy_rating = atoi(row[r++]);
|
||||
tmpNPCType->slow_mitigation = atof(row[r++]);
|
||||
tmpNPCType->slow_mitigation = atoi(row[r++]);
|
||||
tmpNPCType->maxlevel = atoi(row[r++]);
|
||||
tmpNPCType->scalerate = atoi(row[r++]);
|
||||
tmpNPCType->private_corpse = atoi(row[r++]) == 1 ? true : false;
|
||||
|
||||
@ -111,7 +111,7 @@ struct NPCType
|
||||
int accuracy_rating; //10 = 1% accuracy
|
||||
bool findable; //can be found with find command
|
||||
bool trackable;
|
||||
float slow_mitigation; // Slow mitigation % in decimal form.
|
||||
int16 slow_mitigation;
|
||||
uint8 maxlevel;
|
||||
uint32 scalerate;
|
||||
bool private_corpse;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user