Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Development

Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum)

Reply
 
Thread Tools Display Modes
  #1  
Old 03-01-2008, 09:01 PM
Bulle
Hill Giant
 
Join Date: Jan 2008
Posts: 102
Default

One word about the previous hooks (and some coming others) : I did not indent the hook code as should normally be. the reason is that it avoids getting changes in diffs on all the regular code I enclosed in "ifs".
Reply With Quote
  #2  
Old 03-01-2008, 09:03 PM
Bulle
Hill Giant
 
Join Date: Jan 2008
Posts: 102
Default Hook 3 : More item bonuses computation

Index: bonuses.cpp
================================================== =================
RCS file: /cvsroot/eqemulator/EQEmuCVS/Source/zone/bonuses.cpp,v
retrieving revision 1.7.2.15
diff -u -b -B -r1.7.2.15 bonuses.cpp
--- bonuses.cpp 21 Feb 2007 16:04:20 -0000 1.7.2.15
+++ bonuses.cpp 2 Mar 2008 09:06:47 -0000
@@ -25,6 +25,7 @@
#include "../common/skills.h"
#include "../common/bodytypes.h"
#include "../common/classes.h"
+#include "../common/rulesys.h"
#include <math.h>
#include <assert.h>
#ifndef WIN32
@@ -277,6 +278,9 @@
for(i = 0; i < MAX_AUGMENT_SLOTS; i++) {
AddItemBonuses(inst->GetAugment(i),newbon);
}
+
+ if(RuleH(Character, PostAddItemBonuses) != NULL)
+ ((Hook_Character_PostAddItemBonuses) RuleH(Character, PostAddItemBonuses))(inst, newbon);
}

void Client::CalcEdibleBonuses(StatBonuses* newbon) {

Last edited by Bulle; 03-02-2008 at 05:07 AM.. Reason: Replacing mistake post
Reply With Quote
  #3  
Old 03-01-2008, 09:08 PM
Bulle
Hill Giant
 
Join Date: Jan 2008
Posts: 102
Default Hook 4 : Tweak skill-up chance

Index: client.cpp
================================================== =================
RCS file: /cvsroot/eqemulator/EQEmuCVS/Source/zone/client.cpp,v
retrieving revision 1.36.2.51
diff -u -b -B -r1.36.2.51 client.cpp
--- client.cpp 21 Feb 2007 16:04:20 -0000 1.36.2.51
+++ client.cpp 2 Mar 2008 09:08:20 -0000
@@ -1654,9 +1654,15 @@
if (skillval < maxskill)
{
// the higher your current skill level, the harder it is
- sint16 Chance = 10 + chancemodi + ((252 - skillval) / 20);
+ sint16 Chance;
+if(RuleH(Character, ChanceOfSkillIncrease) != NULL)
+ Chance = ((Hook_Character_ChanceOfSkillIncrease) RuleH(Character, ChanceOfSkillIncrease))(skillid, skillval, maxskill, chancemodi);
+else
+{
+ Chance = 10 + chancemodi + ((252 - skillval) / 20);
if (Chance < 1)
Chance = 1; // Make it always possible
+}
if(MakeRandomFloat(0, 99) < Chance)
{
SetSkill(skillid, GetRawSkill(skillid) + 1);
Reply With Quote
  #4  
Old 03-01-2008, 09:12 PM
Bulle
Hill Giant
 
Join Date: Jan 2008
Posts: 102
Default Hook 5 : Tweak AC calculation

Index: client_mods.cpp
================================================== =================
RCS file: /cvsroot/eqemulator/EQEmuCVS/Source/zone/client_mods.cpp,v
retrieving revision 1.6.4.19
diff -u -b -B -r1.6.4.19 client_mods.cpp
--- client_mods.cpp 21 Feb 2007 16:04:20 -0000 1.6.4.19
+++ client_mods.cpp 2 Mar 2008 09:11:32 -0000
@@ -28,6 +28,7 @@
#include "../common/moremath.h"
#include "../common/guilds.h"
#include "../common/logsys.h"
+#include "../common/rulesys.h"
#include "StringIDs.h"
#include "NpcAI.h"

@@ -714,7 +715,10 @@
// AC from spells are not included (cant even cast spells yet..)
sint16 Client::CalcAC() {

- // new formula
+if(RuleH(Character, CalcAC) != NULL)
+ AC = ((Hook_Character_CalcAC) RuleH(Character, CalcAC))(GetLevel(), GetSkill(DEFENSE), itembonuses.AC, spellbonuses.AC);
+else
+{ // new formula
int avoidance = 0;
avoidance = (acmod() + ((GetSkill(DEFENSE)*16)/9));
if (avoidance < 0)
@@ -749,8 +753,8 @@

//spell AC bonuses are added directly to natural total
displayed += spellbonuses.AC;
-
AC = displayed;
+}
return(AC);
}
Reply With Quote
  #5  
Old 03-01-2008, 09:15 PM
Bulle
Hill Giant
 
Join Date: Jan 2008
Posts: 102
Default Hook 6 : Tweak Mana pool computation

Index: client_process.cpp
================================================== =================
RCS file: /cvsroot/eqemulator/EQEmuCVS/Source/zone/client_process.cpp,v
retrieving revision 1.50.2.23
diff -u -b -B -r1.50.2.23 client_process.cpp
--- client_process.cpp 21 Feb 2007 16:04:21 -0000 1.50.2.23
+++ client_process.cpp 2 Mar 2008 09:13:34 -0000
@@ -1466,7 +1466,13 @@
return;
int32 level=GetLevel();
int32 regen = 0;
- if (IsSitting()) { //this should be changed so we dont med while camping, etc...
+
+if(RuleH(Character, ManaRegen) != NULL)
+{ regen = ((Hook_Character_ManaRegen) RuleH(Character, ManaRegen))(IsSitting(), GetLevel(), GetMaxMana(), GetINT(), GetSkill(MEDITATE), itembonuses.ManaRegen, spellbonuses.ManaRegen);
+ medding = IsSitting() && HasSkill(MEDITATE);
+}
+else
+{ if (IsSitting()) { //this should be changed so we dont med while camping, etc...
if(HasSkill(MEDITATE)) {
medding = true;
regen = (((GetSkill(MEDITATE)/10)+(level-(level/4)))/4)+4;
@@ -1480,12 +1486,13 @@
medding = false;
regen = 2+spellbonuses.ManaRegen+itembonuses.ManaRegen+(le vel/5);
}
+}
regen += GetAA(aaMentalClarity);
regen += GetAA(aaBodyAndMindRejuvenation);
regen = (regen * RuleI(Character, ManaRegenMultiplier)) / 100;

SetMana(GetMana() + regen);
Reply With Quote
  #6  
Old 03-01-2008, 09:18 PM
Bulle
Hill Giant
 
Join Date: Jan 2008
Posts: 102
Default Hook 7 : Pre-XP change hook and Tweak XP per level value

Index: exp.cpp
================================================== =================
RCS file: /cvsroot/eqemulator/EQEmuCVS/Source/zone/exp.cpp,v
retrieving revision 1.2.2.14
diff -u -b -B -r1.2.2.14 exp.cpp
--- exp.cpp 16 Jan 2007 04:04:53 -0000 1.2.2.14
+++ exp.cpp 2 Mar 2008 09:17:01 -0000
@@ -34,7 +34,6 @@
void Client::AddEXP(int32 add_exp, int8 conlevel, bool resexp) {
if (m_epp.perAA<0 || m_epp.perAA>100)
m_epp.perAA=0; // stop exploit with sanity check
-
int32 add_aaxp;
if(resexp) {
add_aaxp = 0;
@@ -117,6 +116,8 @@
return; // Must be invalid class/race
}

+ if(RuleH(XP, PreChange) != NULL)
+ ((Hook_XP_PreChange) RuleH(XP, PreChange))(this, set_exp, set_aaxp, isrezzexp, m_pp.exp, m_pp.expAA);

if ((set_exp + set_aaxp) > (m_pp.exp+m_pp.expAA)) {
if (isrezzexp)
@@ -312,7 +320,10 @@
uint32 Client::GetEXPForLevel(int16 check_level)
{

- int16 check_levelm1 = check_level-1;
+if(RuleH(Character, EXPForLevel) != NULL)
+ return ((Hook_Character_EXPForLevel) RuleH(Character, EXPForLevel))(check_level, GetBaseRace(), GetClass());
+else
+{ int16 check_levelm1 = check_level-1;
float mod;
if (check_level < 31)
mod = 1.0;
@@ -368,6 +379,7 @@

return(uint32(base * mod));
}
+}

void Group::SplitExp(uint32 exp, Mob* other) {
if( other->CastToNPC()->MerchantType != 0 ) // Ensure NPC isn't a merchant
Reply With Quote
  #7  
Old 03-01-2008, 09:25 PM
Bulle
Hill Giant
 
Join Date: Jan 2008
Posts: 102
Default Hooks 8 : Tweak fizzle and resist chance

Index: spells.cpp
================================================== =================
RCS file: /cvsroot/eqemulator/EQEmuCVS/Source/zone/spells.cpp,v
retrieving revision 1.14.2.44
diff -u -b -B -r1.14.2.44 spells.cpp
--- spells.cpp 21 Feb 2007 16:04:23 -0000 1.14.2.44
+++ spells.cpp 2 Mar 2008 09:24:51 -0000
@@ -480,7 +480,8 @@
}

bool Client::CheckFizzle(int16 spell_id)
-{
+{ float fizzlechance, diff;
+
// GMs don't fizzle
if (GetGM()) return(true);

@@ -516,7 +517,12 @@
//is there any sort of focus that affects fizzling?


- // neotokyo: this is my try to get something going
+if(RuleH(Spells, FizzleChance) != NULL)
+{ fizzlechance = ((Hook_Spells_FizzleChance) RuleH(Spells, FizzleChance))(this, spells, spell_id);
+ diff = 0;
+}
+else
+{ // neotokyo: this is my try to get something going
int par_skill;
int act_skill;

@@ -556,7 +562,7 @@
// > 0 --> skill is lower, higher chance of fizzle
// < 0 --> skill is better, lower chance of fizzle
// the max that diff can be is +- 235
- float diff = par_skill + spells[spell_id].basediff - act_skill;
+ diff = par_skill + spells[spell_id].basediff - act_skill;

// if you have high int/wis you fizzle less, you fizzle more if you are stupid
if (GetCasterClass() == 'W')
@@ -566,10 +572,11 @@

// base fizzlechance is lets say 5%, we can make it lower for AA skills or whatever
float basefizzle = 10;
- float fizzlechance = basefizzle - specialize + diff / 5.0;
+ fizzlechance = basefizzle - specialize + diff / 5.0;

// always at least 5% chance to fail or succeed
fizzlechance = fizzlechance < 5 ? 5 : (fizzlechance > 95 ? 95 : fizzlechance);
+}
float fizzle_roll = MakeRandomFloat(0, 100);

mlog(SPELLS__CASTING, "Check Fizzle %s spell %d fizzlechance: %0.2f%% diff: %0.2f roll: %0.2f", GetName(), spell_id, fizzlechance, diff, fizzle_roll);
@@ -2717,7 +2724,24 @@
break;
}

- // value in spell to adjust base resist by
+if(RuleH(Spells, FinalResistChance) != NULL)
+{ struct _Hook_Spells_FinalResistChance_Parameters Parameters;
+ Parameters.AttackerIsClient = caster->IsClient();
+ Parameters.AttackerLevel = caster->GetLevel();
+ Parameters.AttackerCha = caster->GetCHA();
+ if(Parameters.AttackerIsClient)
+ Parameters.AttackerMeditation = caster->GetSkill(MEDITATE);
+ Parameters.DefenderIsClient = this->IsClient();
+ Parameters.DefenderLevel = this->GetLevel();
+ Parameters.DefenderResist = resist;
+ Parameters.spells = spells;
+ Parameters.spell_id = spell_id;
+ resistchance = ((Hook_Spells_FinalResistChance) RuleH(Spells, FinalResistChance))(&Parameters);
+ if(caster->IsClient())
+ caster->CastToClient()->CheckIncreaseSkill(MEDITATE);
+}
+else
+{ // value in spell to adjust base resist by
if(spell_id != 0)
resist += spells[spell_id].ResistDiff;

@@ -2743,7 +2767,7 @@
resistchance -= (lvldiff)*0.8;
}
}
-
+}
/*The idea is we come up with 3 ranges of numbers and a roll between 0 and 100
[[[Empty Space above the resistchance line]]] - If the roll lands up here the spell wasn't resisted, the lower the resist chance the larger this range is
[[[Space between resistchance line and full resist chance line]]] - If the roll ends up here then the spell is resisted but only partially, we take the roll in porportion to where it landed in this range to det how
Reply With Quote
Reply

Thread Tools
Display Modes

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 09:10 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 - 2026, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3