Exemplo n.º 1
0
        public void init()
        {
            int[] sp = null;
            if (x > 0 || y > 0)
            {
                sp = new int[] { x, y, z }
            }
            ;
            else
            {
                try
                {
                    sp = zone.getSpawnLocation();
                }
                catch (Exception asd)
                {
                    sp = new int[] { 0, 0, 0, 0 };
                    //  throw asd;
                }
            }

            obj = NpcTable.getInstance().spawnNpc(NpcId, sp[0], sp[1], sp[2], (zone == null) ? h : zone.rnd.Next(64000));

            if (obj == null)
            {
                return;
            }

            if (obj is L2Warrior)
            {
                ((L2Warrior)obj).TerritorySpawn = this;
            }

            STATUS = STATUS_ACTIVE;
        }
Exemplo n.º 2
0
        public L2Object spawnOne(int id, int x, int y, int z, int h)
        {
            NpcTemplate template = NpcTable.getInstance().getNpcTemplate(id);

            L2Warrior o = new L2Warrior();

            o.setTemplate(template);
            //switch (template._type)
            //{
            //    case NpcTemplate.L2NpcType.warrior:
            //    case NpcTemplate.L2NpcType.zzoldagu:
            //    case NpcTemplate.L2NpcType.herb_warrior:
            //    case NpcTemplate.L2NpcType.boss:
            //        o = new L2Warrior();
            //        ((L2Warrior)o).setTemplate(template);
            //        break;

            //    default:
            //        o = new L2Citizen();
            //        ((L2Citizen)o).setTemplate(template);
            //        break;
            //}
            o.X       = x;
            o.Y       = y;
            o.Z       = z;
            o.Heading = h;

            o.SpawnX = x;
            o.SpawnY = y;
            o.SpawnZ = z;

            L2World.Instance.RealiseEntry(o, null, true);
            o.onSpawn();

            return(o);
        }