示例#1
0
        public static Packet SpawnMonster(Mob pMob, int pSpawnType, int pLink, bool pAzwan)
        {
            Packet p = new Packet();

            p.WriteShort((short)SendOpcodes.Monster_Spawn);
            p.WriteInt(pMob.SpawnID);
            p.WriteByte(1);
            p.WriteInt(pMob.MobID);
            MobPacketHelper.AddMonsterStatus(p, pMob);
            p.WriteShort(pMob.Position.X);
            p.WriteShort(pMob.Position.Y);
            p.WriteByte(pMob.Stance); // Stance, TODO.
            p.WriteShort(pMob.Foothold);
            p.WriteShort(pMob.OriginalFoothold);
            p.WriteByte((byte)pSpawnType);
            if (pSpawnType == -3 || pSpawnType >= 0)
                p.WriteInt(pLink);
            p.WriteByte(0); // TODO: Carnival.
            p.WriteInt(125);
            p.WriteZero(16);
            p.WriteByte(0);
            p.WriteInt(-1);
            p.WriteInt(0);
            p.WriteInt(46);
            p.WriteInt(0);
            p.WriteByte(0);
            p.WriteByte(0xFF);

            return p;
        }
示例#2
0
 public static void AddMonsterStatus(Packet pPacket, Mob pMob)
 {
     pPacket.WriteByte(0);
     pPacket.WriteZero(40);
     pPacket.WriteShort(5088);
     pPacket.WriteShort(72);
     pPacket.WriteZero(3);
     pPacket.WriteByte(136);
     for (int i = 0; i < 4; i++)
     {
         pPacket.WriteLong(0);
         pPacket.WriteHexString("30 3B");
     }
     pPacket.WriteZero(7);
     pPacket.WriteZero(12);
 }
示例#3
0
 public void UpdateMobControl(Mob mob, bool spawn, Character chr)
 {
     int maxpos = 200000;
     foreach (Character c in Characters)
     {
         int curpos = mob.Position - c.Position;
         if (curpos < maxpos)
         {
             mob.setControl(c, spawn, chr);
             return;
         }
     }
     mob.setControl(null, spawn, chr);
 }
示例#4
0
        public int spawnMobNoRespawn(int mobid, Pos position, short foothold, Mob owner, byte summonEffect)
        {
            int id = ObjectIDs.NextValue();
            Mob mob = new Mob(id, ID, mobid, position, foothold, MobControlStatus.ControlNormal);
            mob.DoesRespawn = false;
            _Mobs.Add(mob);
            if (summonEffect != 0)
            {
                mob.Owner = owner;
                if (owner != null)
                {
                    mob.DoesRespawn = false; // Is mob of owner
                    owner.SpawnedMobs.Add(id, mob);
                }
            }
            //MobPacket.SendMobSpawn(null, mob, summonEffect, owner, (owner == null), false);

            UpdateMobControl(mob, true, null);
            return id;
        }
示例#5
0
        public int spawnMobNoRespawn(int mobid, Pos position, short foothold)
        {
            int id = ObjectIDs.NextValue();
            Mob mob = new Mob(id, ID, mobid, position, foothold, MobControlStatus.ControlNormal);
            mob.DoesRespawn = false;
            _Mobs.Add(mob);
            //MobPacket.SendMobSpawn(null, mob, 0, null, true, false);

            UpdateMobControl(mob, true, null);
            return id;
        }
示例#6
0
 public int spawnMob(int spawnid, Life life)
 {
     int id = ObjectIDs.NextValue();
     Mob mob = new Mob(id, ID, life.ID, new Pos((short)life.X, (short)life.Y), (short)life.Foothold, MobControlStatus.ControlNormal);
     mob.SetSpawnData(life);
     _Mobs.Add(mob);
     SendPacket(MobPacket.SpawnMonster(mob, 0, 0, false));
     UpdateMobControl(mob, true, null);
     return id;
 }
示例#7
0
 public void RemoveMob(Mob mob)
 {
     _Mobs.Remove(mob);
 }