Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-17-2009, 09:28 AM
drakelord
Hill Giant
 
Join Date: Nov 2002
Location: NC, USA
Posts: 182
Default COMMITTED: Slow Mitigation

As requested, I have setup slow mitigation for mobs. I felt bad last time I submitted and Derision had to go back and change a bunch of things, so I made sure everything looked a lot cleaner this time. I have also been studying the emu code a bit more, so hopefully this submission doesn't need any changes.

~~Fully tested. Compiled and works in game.~~

How it works: Mobs have a new added column under npc_types that is a float. 0 = 0%, 1 = 100%, .5 = 50%, etc. With the way the code currently is, if you try to go past 100%, it will default to 100. However, this can easily be changed for anyone who wants to say, penalize a party for trying to slow a mob by hasting it instead. And for those that are worried, this defaults to 0 for all NPCs unless you change it in the database. *Pokes Trev*

Code time~
===============================
----SQL CHANGES----
Code:
ALTER TABLE `npc_types` ADD COLUMN `slow_mitigation` FLOAT UNSIGNED NOT NULL DEFAULT 0;
----FILE CHANGES----
Code:
mob.h
--------

REPLACE
		int8	in_qglobal
WITH
		int8	in_qglobal,
		float	in_slow_mitigation //Drakelord:  Allows for mobs to mitigate how much they are slowed.  
AFTER
		sint16	in_hp_regen,
		sint16	in_mana_regen,


ADD
	float	slow_mitigation; //Allows for a slow mitigation based on a % in decimal form.  IE, 1 = 100% mitigation, .5 is 50%
AFTER
	sint32	max_mana;
	sint16	hp_regen;
	sint16	mana_regen;
	sint32	oocregen; //Out of Combat Regen, % per tick
Code:
mob.cpp
--------

REPLACE
		 int8	in_qglobal
WITH
		 int8	in_qglobal,
		 float	in_slow_mitigation //Drakelord:  Allows for mobs to mitigate how much they are slowed. 
AFTER
		 int8   in_see_improved_hide,
		 sint16 in_hp_regen,
		 sint16 in_mana_regen,


ADD
	slow_mitigation = in_slow_mitigation;
AFTER
	hp_regen = in_hp_regen;
	mana_regen = in_mana_regen;
	oocregen = RuleI(NPC, OOCRegen); //default Out of Combat Regen
Code:
zonedb.cpp
---------

REPLACE
			"npc_types.Accuracy"
WITH
			"npc_types.Accuracy,"
			"npc_types.slow_mitigation";
AFTER
			"npc_types.see_improved_hide,"
			"npc_types.ATK,"

ADD
				tmpNPCType->slow_mitigation = atoi(row[r++]);
AFTER
				tmpNPCType->see_improved_hide = atoi(row[r++])==0?false:true;
				tmpNPCType->ATK = atoi(row[r++]);
				tmpNPCType->accuracy_rating = atoi(row[r++]);
Code:
zonedump.h
--------

ADD
	float	slow_mitigation; //Drakelord:  Slow mitigation % in decimal form.
AFTER
	int		accuracy_rating;  //10 = 1% accuracy
	bool	findable;		//can be found with find command
	bool	trackable;
Code:
npc.cpp
---------

REPLACE
	  d->qglobal ),
WITH
	  d->qglobal,
	  d->slow_mitigation ),
AFTER
	  d->see_improved_hide,
	  d->hp_regen,
	  d->mana_regen,
Code:
client.cpp
----------

REPLACE
	0	// qglobal
WITH
	0,	// qglobal
	0 //Drakelord:  slow_mitigation
AFTER
	0xff,	// AA Title
	0,	// see_invis
	0,	// see_invis_undead
	0,
	0,
	0,
	0,
Code:
beacon.cpp
------------

REPLACE
(
	NULL, NULL, 0, 0, 0, INVISIBLE_MAN, 0, BT_NoTarget, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
),
WITH
(
	NULL, NULL, 0, 0, 0, INVISIBLE_MAN, 0, BT_NoTarget, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
),
AFTER
Beacon::Beacon(Mob *at_mob, int lifetime)
:Mob
Code:
PlayerCorpse.cpp
----------------

REPLACE
Corpse::Corpse(NPC* in_npc, ItemList* in_itemlist, int32 in_npctypeid, const NPCType** in_npctypedata, int32 in_decaytime)
// vesuvias - appearence fix
 : Mob("Unnamed_Corpse","",0,0,in_npc->GetGender(),in_npc->GetRace(),in_npc->GetClass(),BT_Humanoid//bodytype added
       ,in_npc->GetDeity(),in_npc->GetLevel(),in_npc->GetNPCTypeID(),in_npc->GetSize(),0,
	 in_npc->GetHeading(),in_npc->GetX(),in_npc->GetY(),in_npc->GetZ(),0,
	 in_npc->GetTexture(),in_npc->GetHelmTexture(),
	 0,0,0,0,0,0,0,0,0,
	 0,0,0,0,0,0,0,0,0,0,0,0xff,0,0,0,0,0,0,0),
	 corpse_decay_timer(in_decaytime),
	corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)),
	corpse_graveyard_timer(0)
WITH
 : Mob("Unnamed_Corpse","",0,0,in_npc->GetGender(),in_npc->GetRace(),in_npc->GetClass(),BT_Humanoid//bodytype added
       ,in_npc->GetDeity(),in_npc->GetLevel(),in_npc->GetNPCTypeID(),in_npc->GetSize(),0,
	 in_npc->GetHeading(),in_npc->GetX(),in_npc->GetY(),in_npc->GetZ(),0,
	 in_npc->GetTexture(),in_npc->GetHelmTexture(),
	 0,0,0,0,0,0,0,0,0,
	 0,0,0,0,0,0,0,0,0,0,0,0xff,0,0,0,0,0,0,0,0),
	 corpse_decay_timer(in_decaytime),
	corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)),
	corpse_graveyard_timer(0)
AFTER
// To be used on NPC death and ZoneStateLoad
// Mongrel: added see_invis and see_invis_undead


REPLACE
	0	// qglobal
WITH
	0,	// qglobal
	0 //Drakelord:  slow_mitigation
AFTER
	client->GetPP().drakkin_heritage,
	client->GetPP().drakkin_tattoo,
	client->GetPP().drakkin_details,
	0,
	0xff,	// aa title
	0,
	0,
	0,
	0,
	0,
	0,

REPLACE
Corpse::Corpse(int32 in_dbid, int32 in_charid, char* in_charname, ItemList* in_itemlist, int32 in_copper, int32 in_silver, int32 in_gold, int32 in_plat, float in_x, float in_y, float in_z, float in_heading, float in_size, int8 in_gender, int16 in_race, int8 in_class, int8 in_deity, int8 in_level, int8 in_texture, int8 in_helmtexture,int32 in_rezexp, bool wasAtGraveyard)
 : Mob("Unnamed_Corpse","",0,0,in_gender, in_race, in_class, BT_Humanoid, in_deity, in_level,0, in_size, 0, in_heading, in_x, in_y, in_z,0,in_texture,in_helmtexture,
	 0,0,0,0,0,0,0,0,0,
	 0,0,0,0,0,0,0,0,0,0,0,0xff,
	 0,0,0,0,0,0,0),
WITH
Corpse::Corpse(int32 in_dbid, int32 in_charid, char* in_charname, ItemList* in_itemlist, int32 in_copper, int32 in_silver, int32 in_gold, int32 in_plat, float in_x, float in_y, float in_z, float in_heading, float in_size, int8 in_gender, int16 in_race, int8 in_class, int8 in_deity, int8 in_level, int8 in_texture, int8 in_helmtexture,int32 in_rezexp, bool wasAtGraveyard)
 : Mob("Unnamed_Corpse","",0,0,in_gender, in_race, in_class, BT_Humanoid, in_deity, in_level,0, in_size, 0, in_heading, in_x, in_y, in_z,0,in_texture,in_helmtexture,
	 0,0,0,0,0,0,0,0,0,
	 0,0,0,0,0,0,0,0,0,0,0,0xff,
	 0,0,0,0,0,0,0,0),
AFTER
// To be called from LoadFromDBData
// Mongrel: added see_invis and see_invis_undead
Code:
bonuses.cpp
----------------------

REPLACE

			case SE_AttackSpeed:
			{
				if ((effect_value - 100) > 0) { // Haste
					if (newbon->haste < 0) break; // Slowed - Don't apply haste
					if ((effect_value - 100) > newbon->haste) {
						newbon->haste = effect_value - 100;
					}
				} else if ((effect_value - 100) < 0) { // Slow
					if ((effect_value - 100) < newbon->haste) {
						newbon->haste = effect_value - 100;
					}
				}
				break;
			}



WITH
			case SE_AttackSpeed:
			{
				if ((effect_value - 100) > 0) // Haste
				{ 
					if (newbon->haste < 0) 
						break; // Slowed - Don't apply haste
					if ((effect_value - 100) > newbon->haste) 
					{
						newbon->haste = effect_value - 100;
					}
				} 
				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 new_effect_value;
					float slow_amount_mitigated = 100 - effect_value; //Gives us a value that actually represents the slow amount.
					slow_amount_mitigated = slow_amount_mitigated * this->slow_mitigation;  // Use *= if you really want?
					new_effect_value = effect_value + slow_amount_mitigated;
					if (new_effect_value > 100)
						new_effect_value = 100;
					if ((new_effect_value - 100) < newbon->haste) 
					{
						newbon->haste = new_effect_value - 100;
					}
				}
				break;
			}
__________________
Hmm.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 10:57 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3