Alright so I'm going to try and clean this thread up some and share all of my testing results.
Mounted OOC Testing
5-18-2011
Test 0 Base Case
Unaltered EQEmulator Source
Results: With Database Rule enables OOC regeneration works while sitting but not while on a mount.
Test 1
Zone
Code:
client_process.cpp
void Client::CalcRestState() method
if(AggroCount || !IsSitting() || !GetHorseId())
return;
Results:
Game does not add OOC regeneration while on a mount with this code
Most likely due to when/how this code updates. It also disables OOC regeneration while
/sit elemenating OOC regeneration from the game.
Test 2
Zone
client_process.cpp
Code:
void Client::CalcRestState() method
if(AggroCount || !IsSitting() || GetHorseId())
return;
Results:
Game does not add OOC regeneration while on a mount with this code
Most likely due to when/how this code updates
So my testing shows that even though the logic of that code does seem right, it does not work (That was the first way I tried to fix the issue also).
Because of the issues brought up my code has changed a little and I will explain each part.
Test 3
(This first part allows the client to see the player as sitting when the player is mounted and still, when moving the client sees the player as standing. This allows for OOC regeneration while mounted, but stops regeneration when the player moves. All +argo, +dmg of sitting would still happen, this is because sitting on a mount is viewed the same /sit).
Zone
client_packet.cpp
void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) method
Insert code after // Break Hide if moving without sneaking and set rewind timer if moved
code block.
Code:
//allow player to have OOC regeneration on a mount
if(ppu->y_pos == y_pos || ppu->x_pos == x_pos)
{
if(GetHorseId() != 0)
{
playeraction = 1;
}
}
else if(ppu->y_pos != y_pos || ppu->x_pos != x_pos)
{
if(GetHorseId() != 0)
{
playeraction = 0;
}
}
(This second part tells the client that a user is "standing" when an aa ability is used this will stop OOC regen for that tick and allow a player to cast their aa ability while mounted. After the ability is used the OOC regeneration will start again on the next tick unless the AA used created an in combat situation.)
Zone
client_packet.cpp
void Client::Handle_OP_AAAction(const EQApplicationPacket *app) method
insert code before mlog(AA__IN, "Received OP_AAAction");
Code:
//check if you are on a mount
if (GetHorseId() != 0)
{
playeraction = 0;
}
(This final part simply sets the player to standing after they dismount. Without this the player would not be able to use an AA right after dismounting unless they moved, sat, etc.)
Zone
horse.cpp
void Client::SetHorseId(int16 horseid_in) method
Code:
void Client::SetHorseId(int16 horseid_in) {
//if its the same, do nothing
if(horseId == horseid_in)
return;
//otherwise it changed.
//if we have a horse, get rid of it no matter what.
if(horseId) {
Mob *horse = entity_list.GetMob(horseId);
if(horse != NULL)
{
horse->Depop();
//set player to standing
playeraction = 0;
}
}
//now we take whatever they gave us.
horseId = horseid_in;
}
Results: Player recieves OOC bonus while on a mount.
Extended Testing:
Test 1
Player moves
Results:
Player does not gain OOC bonus until they have come to a complete stop.
Test 2
Player is in combat
Results:
Player does not gain OOC bonus until compat has ended, OOC Timer is finished, and player is not moving.
Test 3
Player cast spell
Results
Spell cast as normal
Test 4
Player uses aa
Results: AA skill works as normal
Test 5
Player uses skill (Kick)
Results: Skill works as normal
Test 6
Player dismounts
Results: OOC regeneration stops
Test 7
Player dismounts and cast a spell
Results: Spell cast as normal
Test 8
Player dismounts and uses a aa skill
Results: AA works as normal
After all of this testing I am pretty confident in this fix. It maintains the rule set in the database so if OOC regeneration is turned off it will have no effect on the game. If anyone has any questions or any more testing they would like me to do feel free to let me know.
Sikkun