PDA

View Full Version : Some codes from Cbodmer


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.

KLS
07-08-2007, 04:27 AM
Hope you don't mind me asking, what about lull/harmony spells is this changing?

The other fixes look very nice, the percent experience lost can probably be put into a rule.

uncommon
07-08-2007, 05:51 AM
I applied this lull fix against 1002. Compiled Ok, but.

Before patch :

- Monk lull disc (phantom shadow and such) would give you a message "your spell did not take hold" except if you were casting it as a gm. But it was not working.
- Pacification or any other lull type spell cause the mob to aggro you. No resist message or whatever.

After i applied that patch :

- Monk disc land even if you're not a gm. But it's still not working.
- Nothing changed about paci. Still instant aggro.

Angelox
07-08-2007, 11:05 AM
I asked Leara and here's the reply I got;

My memory doesn't reach back that far. What I remember is that harmony/lull/charm type spells would tell you that it can't be cast on the target.

I remember tracing the issue and I *think* that part of the code fixed it for me. However, like I said, I am not 100% sure that that's the harmony fix. And it could have some consequence(s) I haven't foreseen/understood.

As for charm, the most important one (to me) was the pet buff-wear off thing.

Wish I had time to work on a more recent code base but I am swamped with work (that pays the bills) as it is still.

gernblan
08-26-2007, 10:54 AM
Hope you don't mind me asking, what about lull/harmony spells is this changing?

The other fixes look very nice, the percent experience lost can probably be put into a rule.

I would HIGHLY recommend connecting this to the variables table if used... not everyone wants 5.5% exactly. Not everyone will know how to change it if not configurable via the variables table.

Just thinking of the newer serverops that are still trying to understand the emu internals.