PDA

View Full Version : NPC Appearance Breaks When Zoning


trevius
10-23-2008, 12:08 AM
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
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);
}

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.

KLS
10-23-2008, 02:17 AM
You know what's funny I was actually thinking about this just yesterday "hey maybe I should fix that".

trevius
10-23-2008, 03:42 AM
Lmao! I swear that every time I mention something, you were already thinking of the same thing :P

I really don't think it will hard to fix, I just don't know where the actual code is that sends the spawn information when a player zones. I figured it would be in zoning.cpp, but I didn't see anything that stood out in there.

KLS
10-23-2008, 04:36 PM
I put in a change to send appearance updates when player zones in, from what I can tell it works.