Angelox
07-05-2007, 07:01 PM
Here's some codes made by Leara (Cbodmer in eqemu forums) and has been in use on the Legacy of the Rathe server, I got permission to post them here, but credit goes to Cbmoder;
The XP loss is defined here in zone/attack.cpp:
...
// figure out if they should lose exp
// cb: this formula is based on what? how about xp loss=% of total XP?
//exploss = (int)(GetLevel() * (GetLevel() / 18.0) * 12000);
exploss=(int)( (float)GetEXP() * 0.055f ); // loose 5.5% of total XP
...
The original formula is commented out and Cbmoders is added. The original formula calculates a value of experience lost based on level and an assumed "experience progression". It's rather silly because the EQ experience progression is not linear so that formula just fails. Cbmoders formula simply takes a fixed % of XP from the total experience the player has acquired. 5.5% is what I set it at, but of course you could tweak that. Also, it could be changed to use a new rule to define the XP % loss.
aggro.cpp patch (This fixes harmony/lull type spells IIRC):
--- EQEmu-0.7.0-911/zone/aggro.cpp 2006-10-31 04:04:24.000000000 +0100
+++ EQEmu-0.7.0-cb911/zone/aggro.cpp 2006-11-17 09:47:26.000000000 +0100
@@ -494,9 +494,10 @@
becomenpc = mob2->CastToClient();
//who made up this rule???
- /*if(c1->GetLevel() > becomenpc->GetBecomeNPCLevel())
+ // cb: this rule is correct - /becomenpc has an attack level limit
+ if(c1->GetLevel() > becomenpc->GetBecomeNPCLevel())
return false;
- else*/
+ else
return true;
}
else if(_CLIENTCORPSE(mob2)) // client vs client corpse
@@ -642,6 +643,7 @@
}
else if(_NPC(mob2)) // client to npc
{
+ return true;
}
else if(_BECOMENPC(mob2)) // client to becomenpc
{
spell_effects.cpp patch (This fix tells the owner of a pet when any of its buffs wear off, just like it does on EQ live):
--- EQEmu-0.7.0-911/zone/spell_effects.cpp 2006-11-04 19:10:22.000000000 +0100
+++ EQEmu-0.7.0-cb911/zone/spell_effects.cpp 2006-11-17 10:45:20.000000000 +0100
@@ -2458,10 +2458,18 @@
// notify caster of buff that it's worn off
Mob *p = entity_list.GetMob(buffs[slot].casterid);
- if (p && p->IsClient() && p != this && !IsBardSong(buffs[slot].spellid))
+ if (p && (p->IsClient() || p->IsPet()) && p != this && !IsBardSong(buffs[slot].spellid))
{
- p->Message_StringID(MT_Broadcasts, SPELL_WORN_OFF_OF,
- spells[buffs[slot].spellid].name, GetCleanName());
+ if(p->IsPet())
+ {
+ p->GetOwner()->Message_StringID(MT_Broadcasts, SPELL_WORN_OFF_OF,
+ spells[buffs[slot].spellid].name, GetCleanName());
+ }
+ else
+ {
+ p->Message_StringID(MT_Broadcasts, SPELL_WORN_OFF_OF,
+ spells[buffs[slot].spellid].name, GetCleanName());
+ }
}
buffs[slot].spellid = SPELL_UNKNOWN;
Both latter patches are vs the 911 tree, but they should be easy enough to apply to the latest tree unless those parts have been fixed/changed meanwhile. The XP loss has already been applied to 1002 and works good.
The XP loss is defined here in zone/attack.cpp:
...
// figure out if they should lose exp
// cb: this formula is based on what? how about xp loss=% of total XP?
//exploss = (int)(GetLevel() * (GetLevel() / 18.0) * 12000);
exploss=(int)( (float)GetEXP() * 0.055f ); // loose 5.5% of total XP
...
The original formula is commented out and Cbmoders is added. The original formula calculates a value of experience lost based on level and an assumed "experience progression". It's rather silly because the EQ experience progression is not linear so that formula just fails. Cbmoders formula simply takes a fixed % of XP from the total experience the player has acquired. 5.5% is what I set it at, but of course you could tweak that. Also, it could be changed to use a new rule to define the XP % loss.
aggro.cpp patch (This fixes harmony/lull type spells IIRC):
--- EQEmu-0.7.0-911/zone/aggro.cpp 2006-10-31 04:04:24.000000000 +0100
+++ EQEmu-0.7.0-cb911/zone/aggro.cpp 2006-11-17 09:47:26.000000000 +0100
@@ -494,9 +494,10 @@
becomenpc = mob2->CastToClient();
//who made up this rule???
- /*if(c1->GetLevel() > becomenpc->GetBecomeNPCLevel())
+ // cb: this rule is correct - /becomenpc has an attack level limit
+ if(c1->GetLevel() > becomenpc->GetBecomeNPCLevel())
return false;
- else*/
+ else
return true;
}
else if(_CLIENTCORPSE(mob2)) // client vs client corpse
@@ -642,6 +643,7 @@
}
else if(_NPC(mob2)) // client to npc
{
+ return true;
}
else if(_BECOMENPC(mob2)) // client to becomenpc
{
spell_effects.cpp patch (This fix tells the owner of a pet when any of its buffs wear off, just like it does on EQ live):
--- EQEmu-0.7.0-911/zone/spell_effects.cpp 2006-11-04 19:10:22.000000000 +0100
+++ EQEmu-0.7.0-cb911/zone/spell_effects.cpp 2006-11-17 10:45:20.000000000 +0100
@@ -2458,10 +2458,18 @@
// notify caster of buff that it's worn off
Mob *p = entity_list.GetMob(buffs[slot].casterid);
- if (p && p->IsClient() && p != this && !IsBardSong(buffs[slot].spellid))
+ if (p && (p->IsClient() || p->IsPet()) && p != this && !IsBardSong(buffs[slot].spellid))
{
- p->Message_StringID(MT_Broadcasts, SPELL_WORN_OFF_OF,
- spells[buffs[slot].spellid].name, GetCleanName());
+ if(p->IsPet())
+ {
+ p->GetOwner()->Message_StringID(MT_Broadcasts, SPELL_WORN_OFF_OF,
+ spells[buffs[slot].spellid].name, GetCleanName());
+ }
+ else
+ {
+ p->Message_StringID(MT_Broadcasts, SPELL_WORN_OFF_OF,
+ spells[buffs[slot].spellid].name, GetCleanName());
+ }
}
buffs[slot].spellid = SPELL_UNKNOWN;
Both latter patches are vs the 911 tree, but they should be easy enough to apply to the latest tree unless those parts have been fixed/changed meanwhile. The XP loss has already been applied to 1002 and works good.