The issue is that if you set an NPC to a certain appearance either via quest scripts or command, any player that zones in after the new appearance has been set will still see the NPC as standing normally. So, if you have a script that sets NPCs to lie down, when you zone in, they will all be standing up. I have found a cheap work around for it by setting them on 1 minute timers to stand and lie down again, but that isn't a real fix to the issue.
I think all that needs to be done is to have NPCs send their appearance value to players when they zone. We should just be able to add a SendAppearancePacket to the zoning code. I can't seem to find where exactly this would need to get added. I imagine that it would be directly after sending spawn location information, but I don't see where that is in the code.
Here are the related commands that might be useful for getting this issue resolved:
mob.cpp
Code:
int32 Mob::GetAppearanceValue(EmuAppearance iAppearance) {
switch (iAppearance) {
// 0 standing, 1 sitting, 2 ducking, 3 lieing down, 4 looting
case eaStanding: {
return ANIM_STAND;
}
case eaSitting: {
return ANIM_SIT;
}
case eaCrouching: {
return ANIM_CROUCH;
}
case eaDead: {
return ANIM_DEATH;
}
case eaLooting: {
return ANIM_LOOT;
}
//to shup up compiler:
case _eaMaxAppearance:
break;
}
return(ANIM_STAND);
}
Code:
void Mob::SendAppearancePacket(int32 type, int32 value, bool WholeZone, bool iIgnoreSelf, Client *specific_target) {
if (!GetID())
return;
EQApplicationPacket* outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct));
SpawnAppearance_Struct* appearance = (SpawnAppearance_Struct*)outapp->pBuffer;
appearance->spawn_id = this->GetID();
appearance->type = type;
appearance->parameter = value;
if (WholeZone)
entity_list.QueueClients(this, outapp, iIgnoreSelf);
else if(specific_target != NULL)
specific_target->QueuePacket(outapp, false, Client::CLIENT_CONNECTED);
else if (this->IsClient())
this->CastToClient()->QueuePacket(outapp, false, Client::CLIENT_CONNECTED);
safe_delete(outapp);
}
I don't think we need to be sending appearance packets all of the time, just when people zone or if the appearance changes. Right now, it only appears to send them if the appearance changes while you are in the zone.