I am trying to take a second look into getting this fixed. Looking at the code, there is something that I don't understand the purpose of, and if possible, maybe it could be used for level2 instead.
eq_packet_structs.h
Code:
/*
** Level Update
** Length: 12 Bytes
*/
struct LevelUpdate_Struct
{
/*00*/ uint32 level; // New level
/*04*/ uint32 level_old; // Old level
/*08*/ uint32 exp; // Current Experience
};
I am not sure what the point of level_old is. Maybe that is supposed to be level2. If so, then I think the solution to fix this bug wouldn't be too bad. I think we could change the code above to this:
eq_packet_structs.h
Code:
/*
** Level Update
** Length: 12 Bytes
*/
struct LevelUpdate_Struct
{
/*00*/ uint32 level; // New level
/*04*/ uint32 level2; // Level2 for retaining max level reached (Don't think this is used anywhere)
/*08*/ uint32 exp; // Current Experience
};
Then, in exp.cpp change this:
Code:
EQApplicationPacket* outapp = new EQApplicationPacket(OP_LevelUpdate, sizeof(LevelUpdate_Struct));
LevelUpdate_Struct* lu = (LevelUpdate_Struct*)outapp->pBuffer;
lu->level = set_level;
lu->level_old = level;
level = set_level;
if(IsRaidGrouped())
{
Raid *r = this->GetRaid();
if(r){
r->UpdateLevel(GetName(), set_level);
}
}
if(set_level > m_pp.level) { // Yes I am aware that you could delevel yourself and relevel this is just to test!
m_pp.points += 5 * (set_level - m_pp.level);
#ifdef EMBPERL
((PerlembParser*)parse)->Event(EVENT_LEVEL_UP, 0, "", (NPC*)NULL, this);
#endif
}
m_pp.level = set_level;
To this:
Code:
EQApplicationPacket* outapp = new EQApplicationPacket(OP_LevelUpdate, sizeof(LevelUpdate_Struct));
LevelUpdate_Struct* lu = (LevelUpdate_Struct*)outapp->pBuffer;
lu->level = set_level;
if(IsRaidGrouped())
{
Raid *r = this->GetRaid();
if(r){
r->UpdateLevel(GetName(), set_level);
}
}
#ifdef EMBPERL
((PerlembParser*)parse)->Event(EVENT_LEVEL_UP, 0, "", (NPC*)NULL, this);
#endif
}
m_pp.level = set_level;
if(set_level > m_pp.level2) {
m_pp.points += 5 * (set_level - m_pp.level2);
m_pp.level2 = set_level;
}
And, I think this SQL would add the level2 field to the character_ table:
Code:
ALTER TABLE `character_` ADD column `level2` mediumint(8) unsigned NOT NULL default '1';
Note that I haven't tested this yet, and am not sure if it would work or not. But, at least it should be a start to getting this bug resolved. Anyone have thoughts on it so far?