Пример #1
0
void SpawnShell::zoneSpawns(const uint8_t* data, size_t len)
{
   NetStream netStream(data,len);
   spawnStruct *spawn = new spawnStruct;
   uint32_t spawnStructSize;
   uint16_t parm1;

   while(!netStream.end())
   {
      memset(spawn,0,sizeof(spawnStruct));
      parm1=netStream.readUInt16NC();
      if(parm1==0x1ff)
         parm1=netStream.readUInt16NC();

      netStream.skipBytes(1);
      spawnStructSize=fillSpawnStruct(spawn,netStream.pos(),len,false);
      newSpawn(*spawn);
      netStream.skipBytes(spawnStructSize);
   }
}
Пример #2
0
void SpawnShell::zoneEntry(const uint8_t* data, size_t len)
{
  // Zone Entry. Sent when players are added to the zone.

  spawnStruct *spawn = new spawnStruct;

  memset(spawn,0,sizeof(spawnStruct));

  fillSpawnStruct(spawn,data,len,true);

 #ifdef SPAWNSHELL_DIAG
  seqDebug("SpawnShell::zoneEntry(spawnStruct *(name='%s'))", spawn->name);
 #endif

  Item *item;

  if(!strcmp(spawn->name,m_player->realName()))
  {
    // Multiple zoneEntry packets are received for your spawn after you zone
    m_player->update(spawn);
    emit changeItem(m_player, tSpawnChangedALL);
  }
  else
  {
    if((item=m_spawns.find(spawn->spawnId)))
    {
        // Update existing spawn
      Spawn *s=(Spawn*)item;
      s->update(spawn);
    }
    else
    {
        // Create a new spawn
      newSpawn(*spawn);
    }
  }
}