コード例 #1
0
ファイル: spawn.cpp プロジェクト: xbackupx/showeqx
Spawn::Spawn(Spawn& s, uint16_t id)
  : Item(tSpawn, id)
{
  setName(s.name());
  setLastName(s.lastName());
  Item::setPoint(s.x(), s.y(), s.z());
  setPetOwnerID(s.petOwnerID());
  setLight(s.light());
  setGender(s.gender());
  setDeity(s.deity());
  setRace(s.race());
  setClassVal(s.classVal());
  setHP(s.HP());
  setMaxHP(s.maxHP());
  setGuildID(s.GuildID());
  setLevel(s.level());
  for (int i = 0; i <= tLastCoreWearSlot; i++)
    setEquipment(i, s.equipment(i));
  setEquipment(tUnknown1, 0);
  setTypeflag(s.typeflag());
  setNPC(s.NPC());
  setAnimation(s.animation());
  setDeltas(s.deltaX(), s.deltaY(), s.deltaZ());
  setHeading(s.heading(), s.deltaHeading());
  setConsidered(s.considered());

  // the new copy will own the spawn track list
  m_spawnTrackList.setAutoDelete(false);
  m_spawnTrackList = s.m_spawnTrackList;
  s.m_spawnTrackList.setAutoDelete(false);
  m_spawnTrackList.setAutoDelete(true);
}
コード例 #2
0
void SpawnShell::consMessage(const considerStruct * con, uint32_t, uint8_t dir) 
{
  Item* item;
  Spawn* spawn;

  if (dir == DIR_CLIENT)
  {
    if (con->playerid != con->targetid) 
    {
      item = m_spawns.find(con->targetid);
      if (item != NULL)
      {
	spawn = (Spawn*)item;

	// note that this spawn has been considered
	spawn->setConsidered(true);
	
	emit spawnConsidered(item);
      }
    }
    return;
  }

  QString lvl("");
  QString hps("");
  QString cn("");

  QString msg("Faction: Your faction standing with ");

  //printf("%i, %i, %i, %i\n", con->unknown1[0], con->unknown1[1], con->unknown2[0], con->unknown2[1]);

  // is it you that you've conned?
  if (con->playerid == con->targetid) 
  {
    // print it's deity
    printf("Diety: %s\n", (const char*)m_player->deityName());
    
    // well, this is You
    msg += "YOU";
  }
  else 
  {
    // find the spawn if it exists
    item = m_spawns.find(con->targetid);
    
    // has the spawn been seen before?
    if (item != NULL)
    {
      Spawn* spawn = (Spawn*)item;
      // yes
      printf("Diety: %s\n", (const char*)spawn->deityName());

      int changed = tSpawnChangedNone;

      /* maxhp and curhp are available when considering players, */
      /* but not when considering mobs. */
      if (con->maxHp || con->curHp)
      {
         if (spawn->NPC() == SPAWN_NPC_UNKNOWN)
         {
	   spawn->setNPC(SPAWN_PLAYER);        // player
	   changed |= tSpawnChangedNPC;
         }
         spawn->setMaxHP(con->maxHp);
         spawn->setHP(con->curHp);
         changed |= tSpawnChangedHP;
      }
      else if (item->NPC() == SPAWN_NPC_UNKNOWN)
      {
         spawn->setNPC(SPAWN_NPC);
         changed |= tSpawnChangedNPC;
      }

      // note the updates if any
      if (changed != tSpawnChangedNone)
      {
        if (updateFilterFlags(item))
           changed |= tSpawnChangedFilter;
        if (updateRuntimeFilterFlags(item))
           changed |= tSpawnChangedRuntimeFilter;

	item->updateLastChanged();
        emit changeItem(item, changed);
      }

      // note that this spawn has been considered
      spawn->setConsidered(true);

      emit spawnConsidered(item);

      msg += item->name();
    } // end if spawn found
    else
      msg += "Spawn:" + QString::number(con->targetid, 16);
  } // else not yourself
  
  switch (con->level) 
  {
     case 0:
     {
        cn.sprintf(" (even)");
        break;
     }
     case 2:
     {
        cn.sprintf(" (green)");
        break;
     }
     case 4:
     {
        cn.sprintf(" (blue)");
        break;
     }
     case 13:
     {
        cn.sprintf(" (red)");
        break;
     }
     case 15:
     {
        cn.sprintf(" (yellow)");
        break;
     }
     case 18:
     {
        cn.sprintf(" (cyan)");
        break;
     }
     default:
     {
        cn.sprintf(" (unknown: %d)", con->level);
        break;
     }
  }

  msg += cn;

  if (con->maxHp || con->curHp)
  {
    lvl.sprintf(" (%i/%i HP)", con->curHp, con->maxHp);
    msg += lvl;
  }
  
  msg += QString(" is: ") + print_faction(con->faction) + " (" 
    + QString::number(con->faction) + ")!";
  
  emit msgReceived(msg);
} // end consMessage()