r2d2atemyhomework |
12-24-2003 04:50 PM |
Here's a fix for 5.3DR2 Mob Healthbar not updating in client
The problem with the mob healthbar was that, the SpawnHPUpdate packets are no longer different. The mob packet is the same as the client packet now. Replace the Mob::CreateHPPacket in mob.cpp with the code below and it will work:
Code:
void Mob::CreateHPPacket(APPLAYER* app)
{
this->IsFullHP=(cur_hp>=max_hp);
app->opcode = OP_HPUpdate;
app->size = sizeof(SpawnHPUpdate_Struct);
app->pBuffer = new uchar[app->size];
memset(app->pBuffer, 0, sizeof(SpawnHPUpdate_Struct));
SpawnHPUpdate_Struct* ds = (SpawnHPUpdate_Struct*)app->pBuffer;
ds->spawn_id = GetID();
if(IsClient())
{
ds->max_hp=max_hp;
ds->cur_hp=GetHP()-itembonuses->HP;
ds->cur_hp=ds->cur_hp>30000?30000:ds->cur_hp;
}
else
{
ds->cur_hp=IsNPC()?(sint32)GetHPRatio():cur_hp;
ds->max_hp=100;
}
}
I haven't extensively tested this, but the healthbar was working on all the mobs I attacked. Merry Christmas. :)
|