Example #1
0
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);
}
Example #2
0
Spawn::Spawn(uint16_t id, 
	     int16_t x, int16_t y, int16_t z,
	     int16_t deltaX, int16_t deltaY, int16_t deltaZ,
	     int8_t heading, int8_t deltaHeading,
	     uint8_t animation) 
  : Item(tSpawn, id)
{
  // apply the unknown mob values
  m_name = "unknown";
  setNPC(SPAWN_NPC_UNKNOWN);

  // set what is known
  setPos(x, y, z);
  setDeltas(deltaX, deltaY, deltaZ);
  setHeading(heading, deltaHeading);
  setAnimation(animation);
  
  // initialize what isn't to 0
  setPetOwnerID(0);
  setLight(0);
  setGender(0);
  setDeity(0);
  setRace(0);
  setClassVal(0);
  setHP(0);
  setMaxHP(0);
  setLevel(0);
  for (int i = 0; i < tNumWearSlots; i++)
    setEquipment(i, 0);
  setTypeflag(0);
  setConsidered(false);

  // turn on auto delete for the track list
  m_spawnTrackList.setAutoDelete(true);
}
Example #3
0
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, SlotEmpty);
    setTypeflag(s->typeflag());
    setGM(s->gm());
    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);
}
Example #4
0
//----------------------------------------------------------------------
// Spawn
Spawn::Spawn()
  : Item(tSpawn, 0)
{
  m_name = "fake";
  setNPC(SPAWN_NPC_UNKNOWN);

  Item::setPos(0, 0, 0);
  setDeltas(0, 0, 0);
  setHeading(0, 0);
  setAnimation(0);
  setPetOwnerID(0);
  setLight(0);
  setGender(0);
  setDeity(0);
  setRace(0);
  setClassVal(0);
  setHP(0);
  setMaxHP(0);
  setGuildID(0xffff);
  setGuildTag(NULL);
  setLevel(0);
  setTypeflag(0);
  for (int i = 0; i < tNumWearSlots; i++)
    setEquipment(i, 0);

  // just clear the considred flag since data would be outdated
  setConsidered(false);

  // finally, note when this update occurred.
  updateLast();
}
Example #5
0
void Spawn::update(const spawnStruct* s)
{
  if (m_name.find(Spawn_Corpse_Designator) == -1)
  {
    setName(s->name);
    setLastName(s->lastName);
  }

  setPos(s->x >> 3, s->y >> 3, s->z >> 3);
  setPetOwnerID(s->petOwnerId);
  setLight(s->light);
  setGender(s->gender);
  setDeity(s->deity);
  setRace(s->race);
  setClassVal(s->class_);
  setHP(s->curHp);
  //setMaxHP(s->maxHp);
  setMaxHP(s->curHp); //maxHp is no longer part of the struct
  setGuildID(s->guildID);
  setLevel(s->level);
  for (int i = 0; i <= tLastCoreWearSlot; i++)
    setEquipment(i, s->equipment[i]);
  setEquipment(tUnknown1, 0);

  setTypeflag(s->bodytype);
  setGM(s->gm);

  // If it is a corpse with Unknown (NPC) religion.
  if ((s->NPC == SPAWN_PC_CORPSE) && (s->deity == DEITY_UNKNOWN))
    setNPC(SPAWN_NPC_CORPSE); // it's a dead monster
  else
    setNPC(s->NPC); // otherwise it is what it is

  setAnimation(s->animation);

  // only non corpses and things with animation != 66 move
  if (!isCorpse() && (s->animation != 66))
  {
    setDeltas(s->deltaX >> 2, s->deltaY >> 2, s->deltaZ >> 2);
    setHeading(s->heading, s->deltaHeading);
  }