CountExp.inc
Posted: Thu Dec 31, 2009 11:51 pm
Here is an include file I made since I found I was running some kind of exp per mob calculation in most of the macros I was using. I previously had some errors with the calculations showing negative numbers, or other strangeness if you gained a level or dinged an AA, but I (think) I now have a special condition for each one, that should display the exp correctly even when dinging an AA or leveling up. As there are 8 different conditions for group and solo exp, please let me know if any of them don't work correctly. I have never had a toon level up, get an AA, and gain a leadership point all at the same time, but I thought I'd make it handle everything, just in case, although, some parts like these are yet untested as that's extremely difficult to plan.
Anyway, here's the code.
Anyway, here's the code.
Code: Select all
|Countexp.inc Version 1.0
|Written by Dregs
|Based on exp-calculating code from the rogue helper macro
|------------------------------------------------------------------------------
|Usage: Make sure to include a line for /doevents
| Post these variables into the macro you want to call this snippet from:
|
| /declare MobsKilled int outer 0
| /declare LDExp float outer ${Me.PctGroupLeaderExp}
| /declare AAExp float outer ${Me.PctAAExp}
| /declare Exp float outer ${Me.PctExp}
| /declare CurrentAA int outer ${Me.AAPointsTotal}
| /declare CurrentLevel int outer ${Me.Level}
| /declare CurrentLeaderPoints int outer ${Me.GroupLeaderPoints}
|------------------------------------------------------------------------------
#event GroupExp "#*#You gain party experience#*#"
#event SoloExp "#*#You gain experience#*#"
Sub Event_GroupExp
/varcalc MobsKilled (1+${MobsKilled})
/if (${Me.Level}>${CurrentLevel} && ${Me.AAPointsTotal}>${CurrentAA} && ${Me.GroupLeaderPoints}>${CurrentLeaderPoints}) {
/echo Kill number ${MobsKilled} yielded Group XP: REG (${Math.Calc[100+${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[100+${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[100+${Me.PctGroupLeaderExp}-${LDExp}]}%)
}
/if (${Me.Level}>${CurrentLevel} && ${Me.AAPointsTotal}>${CurrentAA} && ${Me.GroupLeaderPoints}==${CurrentLeaderPoints}) {
/echo Kill number ${MobsKilled} yielded Group XP: REG (${Math.Calc[100+${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[100+${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[${Me.PctGroupLeaderExp}-${LDExp}]}%)
}
/if (${Me.Level}>${CurrentLevel} && ${Me.AAPointsTotal}==${CurrentAA} && ${Me.GroupLeaderPoints}==${CurrentLeaderPoints}) {
/echo Kill number ${MobsKilled} yielded Group XP: Reg (${Math.Calc[100+${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[${Me.PctGroupLeaderExp}-${LDExp}]}%
}
/if (${Me.Level}>${CurrentLevel} && ${Me.AAPointsTotal}==${CurrentAA} && ${Me.GroupLeaderPoints}>${CurrentLeaderPoints}) {
/echo Kill number ${MobsKilled} yielded Group XP: Reg (${Math.Calc[100+${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[100+${Me.PctGroupLeaderExp}-${LDExp}]}%
}
/if (${Me.Level}==${CurrentLevel} && ${Me.AAPointsTotal}>${CurrentAA} && ${Me.GroupLeaderPoints}>${CurrentLeaderPoints}) {
/echo Kill number ${MobsKilled} yielded Group XP: Reg (${Math.Calc[${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[100+${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[100+${Me.PctGroupLeaderExp}-${LDExp}]}%
}
/if (${Me.Level}==${CurrentLevel} && ${Me.AAPointsTotal}==${CurrentAA} && ${Me.GroupLeaderPoints}==${CurrentLeaderPoints}) {
/echo Kill number ${MobsKilled} yielded Group XP: REG (${Math.Calc[${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[${Me.PctGroupLeaderExp}-${LDExp}]}%)
}
/if (${Me.Level}==${CurrentLevel} && ${Me.AAPointsTotal}==${CurrentAA} && ${Me.GroupLeaderPoints}>${CurrentLeaderPoints}) {
/echo Kill number ${MobsKilled} yielded Group XP: Reg (${Math.Calc[${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[100+${Me.PctGroupLeaderExp}-${LDExp}]}%
}
/if (${Me.Level}==${CurrentLevel} && ${Me.AAPointsTotal}>${CurrentAA} && ${Me.GroupLeaderPoints}==${CurrentLeaderPoints}) {
/echo Kill number ${MobsKilled} yielded Group XP: Reg (${Math.Calc[${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[100+${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[${Me.PctGroupLeaderExp}-${LDExp}]}%
}
/varset CurrentAA ${Me.AAPointsTotal}
/varset CurrentLevel ${Me.Level}
/varset CurrentLeaderPoints ${Me.GroupLeaderPoints}
/varset LDExp ${Me.PctGroupLeaderExp}
/varset AAExp ${Me.PctAAExp}
/varset Exp ${Me.PctExp}
/return
Sub Event_SoloExp
/varcalc MobsKilled (1+${MobsKilled})
/if (${Me.Level}>${CurrentLevel} && ${Me.AAPointsTotal}>${CurrentAA} && ${Me.GroupLeaderPoints}>${CurrentLeaderPoints}) {
/echo Kill number ${MobsKilled} yielded Solo XP: REG (${Math.Calc[100+${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[100+${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[100+${Me.PctGroupLeaderExp}-${LDExp}]}%)
}
/if (${Me.Level}>${CurrentLevel} && ${Me.AAPointsTotal}>${CurrentAA} && ${Me.GroupLeaderPoints}==${CurrentLeaderPoints}) {
/echo Kill number ${MobsKilled} yielded Solo XP: REG (${Math.Calc[100+${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[100+${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[${Me.PctGroupLeaderExp}-${LDExp}]}%)
}
/if (${Me.Level}>${CurrentLevel} && ${Me.AAPointsTotal}==${CurrentAA} && ${Me.GroupLeaderPoints}==${CurrentLeaderPoints}) {
/echo Kill number ${MobsKilled} yielded Solo XP: Reg (${Math.Calc[100+${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[${Me.PctGroupLeaderExp}-${LDExp}]}%
}
/if (${Me.Level}>${CurrentLevel} && ${Me.AAPointsTotal}==${CurrentAA} && ${Me.GroupLeaderPoints}>${CurrentLeaderPoints}) {
/echo Kill number ${MobsKilled} yielded Solo XP: Reg (${Math.Calc[100+${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[100+${Me.PctGroupLeaderExp}-${LDExp}]}%
}
/if (${Me.Level}==${CurrentLevel} && ${Me.AAPointsTotal}>${CurrentAA} && ${Me.GroupLeaderPoints}>${CurrentLeaderPoints}) {
/echo Kill number ${MobsKilled} yielded Solo XP: Reg (${Math.Calc[${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[100+${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[100+${Me.PctGroupLeaderExp}-${LDExp}]}%
}
/if (${Me.Level}==${CurrentLevel} && ${Me.AAPointsTotal}==${CurrentAA} && ${Me.GroupLeaderPoints}==${CurrentLeaderPoints}) {
/echo Kill number ${MobsKilled} yielded Solo XP: REG (${Math.Calc[${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[${Me.PctGroupLeaderExp}-${LDExp}]}%)
}
/if (${Me.Level}==${CurrentLevel} && ${Me.AAPointsTotal}==${CurrentAA} && ${Me.GroupLeaderPoints}>${CurrentLeaderPoints}) {
/echo Kill number ${MobsKilled} yielded Solo XP: Reg (${Math.Calc[${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[100+${Me.PctGroupLeaderExp}-${LDExp}]}%
}
/if (${Me.Level}==${CurrentLevel} && ${Me.AAPointsTotal}>${CurrentAA} && ${Me.GroupLeaderPoints}==${CurrentLeaderPoints}) {
/echo Kill number ${MobsKilled} yielded Solo XP: Reg (${Math.Calc[${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[100+${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[${Me.PctGroupLeaderExp}-${LDExp}]}%
}
/varset CurrentAA ${Me.AAPointsTotal}
/varset CurrentLevel ${Me.Level}
/varset CurrentLeaderPoints ${Me.GroupLeaderPoints}
/varset LDExp ${Me.PctGroupLeaderExp}
/varset AAExp ${Me.PctAAExp}
/varset Exp ${Me.PctExp}
/return