示例#1
0
        public L2Npc Spawn(bool notifyOthers = true)
        {
            L2Npc npc;

            if (Type.GetType("L2dotNET.Models.Npcs." + Template.Type) != null)
            {
                //TODO this is shit. Change it
                npc = (L2Npc)Activator.CreateInstance(Type.GetType("L2dotNET.Models.Npcs." + Template.Type),
                                                      _spawnTable, _idFactory.NextId(), Template, this);
                npc.X       = Location.X;
                npc.Y       = Location.Y;
                npc.Z       = Location.Z;
                npc.Heading = Location.Heading;
            }
            else
            {
                npc = new L2Npc(_spawnTable, _idFactory.NextId(), Template, this)
                {
                    X       = Location.X,
                    Y       = Location.Y,
                    Z       = Location.Z,
                    Heading = Location.Heading
                };
            }

            npc.SpawnMeAsync(notifyOthers);
            return(npc);
        }
示例#2
0
        public L2Item CreateItem(int itemId, int count, L2Player actor)
        {
            L2Item item = new L2Item(_itemService, _idFactory, GetItem(itemId), _idFactory.NextId());

            L2World.Instance.AddObject(item);

            if (item.Template.Stackable && (count > 1))
            {
                item.Count = count;
            }

            return(item);
        }