コード例 #1
0
ファイル: spawnshell.cpp プロジェクト: xbackupx/showeqx
// same-name slots, connecting to Packet signals
void SpawnShell::newGroundItem(const makeDropStruct *d, uint32_t, uint8_t dir)
{
#ifdef SPAWNSHELL_DIAG
    printf("SpawnShell::newGroundItem(makeDropStruct *)\n");
#endif
    // if zoning, then don't do anything
    if (m_zoneMgr->isZoning())
        return;

    if (dir != DIR_SERVER)
        return;

    if (!d)
        return;

    // attempt to get the item name
    QString name;
    if (m_itemDB != NULL)
        name = m_itemDB->GetItemLoreName(d->itemNr);

    Drop* item = (Drop*)m_drops.find(d->dropId);
    if (item != NULL)
    {
        item->update(d, name);
        if (!showeq_params->fast_machine)
            item->setDistanceToPlayer(m_player->calcDist2DInt(*item));
        else
            item->setDistanceToPlayer(m_player->calcDist(*item));
        updateFilterFlags(item);
        item->updateLastChanged();
        emit changeItem(item, tSpawnChangedALL);
    }
    else
    {
        item = new Drop(d, name);
        if (!showeq_params->fast_machine)
            item->setDistanceToPlayer(m_player->calcDist2DInt(*item));
        else
            item->setDistanceToPlayer(m_player->calcDist(*item));
        updateFilterFlags(item);
        m_drops.insert(d->dropId, item);
        emit addItem(item);
    }

    if (item->filterFlags() & FILTER_FLAG_ALERT)
        emit handleAlert(item, tNewSpawn);
}
コード例 #2
0
// same-name slots, connecting to Packet signals
void SpawnShell::newGroundItem(const uint8_t* data, size_t, uint8_t dir)
{
  const makeDropStruct *d = (const makeDropStruct *)data;
#ifdef SPAWNSHELL_DIAG
   seqDebug("SpawnShell::newGroundItem(makeDropStruct *)");
#endif
  // if zoning, then don't do anything
  if (m_zoneMgr->isZoning())
    return;

  if (dir != DIR_Server)
    return;

  if (!d)
    return;
  
  QString name;
  Drop* item = (Drop*)m_drops.find(d->dropId);
  if (item != NULL)
  {
    item->update(d, name);
    if (!showeq_params->fast_machine)
       item->setDistanceToPlayer(m_player->calcDist2DInt(*item));
    else
       item->setDistanceToPlayer(m_player->calcDist(*item));
    updateFilterFlags(item);
    item->updateLastChanged();
    emit changeItem(item, tSpawnChangedALL);
  }
  else
  {
    item = new Drop(d, name);
    if (!showeq_params->fast_machine)
       item->setDistanceToPlayer(m_player->calcDist2DInt(*item));
     else
       item->setDistanceToPlayer(m_player->calcDist(*item));
    updateFilterFlags(item);
    m_drops.insert(d->dropId, item);
    emit addItem(item);
  }
}
コード例 #3
0
// same-name slots, connecting to Packet signals
void SpawnShell::newGroundItem(const makeDropStruct *d)
{
#ifdef SPAWNSHELL_DIAG
   printf("SpawnShell::newGroundItem(makeDropStruct *)\n");
#endif
  // if zoning, then don't do anything
  if (m_zoneMgr->isZoning())
    return;

  if (!d)
    return;
  
  // attempt to get the item name
  QString name;
  if (m_itemDB != NULL)
    name = m_itemDB->GetItemLoreName(d->itemNr);
  
  Drop* item = (Drop*)m_drops.find(d->dropId);
  if (item != NULL)
  {
    item->update(d, name);
    updateFilterFlags(item);
    item->updateLastChanged();
    emit changeItem(item, tSpawnChangedALL);
  }
  else
  {
    item = new Drop(d, name);
    updateFilterFlags(item);
    m_drops.insert(d->dropId, item);
    emit addItem(item);
  }

  if (item->filterFlags() & FILTER_FLAG_ALERT)
    emit handleAlert(item, tNewSpawn);
}
コード例 #4
0
// same-name slots, connecting to Packet signals
// this packet is variable in length.  everything is dwords except the "idFile" field
// which can be variable
void SpawnShell::newGroundItem(const uint8_t* data, size_t len, uint8_t dir)
{
   if (m_zoneMgr->isZoning())
      return;

   if (dir != DIR_Server)
      return;

   if (!data)
      return;

   NetStream netStream(data, len);
   makeDropStruct ds;
   QString name;
   union { uint32_t n; float f; } x;
   memset(&ds, 0, sizeof(makeDropStruct));

   // read drop id
   ds.dropId = netStream.readUInt32NC();

   // read name
   name = netStream.readText();
   if(name.length())
   {
      strcpy(ds.idFile, name.latin1());
   }

   // read past zone id
   netStream.readUInt32NC();

   // read past zone instance
   netStream.readUInt32NC();

   // read past unknown dword field
   netStream.readUInt32NC();

   // read heading
   x.n = netStream.readUInt32NC();
   ds.heading = x.f;

   // read past unknown dword field
   netStream.readUInt32NC();

   // read past unknown dword field
   netStream.readUInt32NC();

   // read past unknown dword field
   netStream.readUInt32NC();

   // read y pos
   x.n = netStream.readUInt32NC();
   ds.y = x.f;

   // read x pos
   x.n = netStream.readUInt32NC();
   ds.x = x.f;

   // read z pos
   x.n = netStream.readUInt32NC();
   ds.z = x.f;

#ifdef SPAWNSHELL_DIAG
   seqDebug("SpawnShell::newGroundItem(makeDropStruct *)");
#endif

  Drop* item = (Drop*)m_drops.find(ds.dropId);
  if (item != NULL)
  {
    item->update(&ds, name);
    if (!showeq_params->fast_machine)
       item->setDistanceToPlayer(m_player->calcDist2DInt(*item));
    else
       item->setDistanceToPlayer(m_player->calcDist(*item));
    updateFilterFlags(item);
    item->updateLastChanged();
    emit changeItem(item, tSpawnChangedALL);
  }
  else
  {
    item = new Drop(&ds, name);
    if (!showeq_params->fast_machine)
       item->setDistanceToPlayer(m_player->calcDist2DInt(*item));
     else
       item->setDistanceToPlayer(m_player->calcDist(*item));
    updateFilterFlags(item);
    m_drops.insert(ds.dropId, item);
    emit addItem(item);
  }
}