Example #1
0
        public override void Deserialize(OtFileReader fileReader, OtFileNode node, OtPropertyReader reader, OtItems items)
        {
            base.Deserialize(fileReader, node, reader, items);

            var itemNode = node.Child;

            while (itemNode != null)
            {
                if ((OtMap.OtMapNodeTypes)itemNode.Type != OtMap.OtMapNodeTypes.ITEM)
                    throw new Exception("Invalid item node inside container.");

                OtPropertyReader props = fileReader.GetPropertyReader(itemNode);

                var itemId = props.ReadUInt16();
                var itemType = items.GetItem(itemId);
                if (itemType == null)
                    throw new Exception("Unkonw item type " + itemId + " inside container.");

                var item = OtItem.Create(itemType);
                item.Deserialize(fileReader, itemNode, props, items);

                Items.Add(item);

                itemNode = itemNode.Next;
            }
        }
        public Connection(Socket socket, OtItems items)
        {
            this.socket = socket;
            this.items = items;

            message = new InMessage();
            map = new OtMap(items);

            BeginReceive();
        }
        public NpcInfo(Creature creature, OtItems items)
        {
            this.name = creature.Name;
            this.outfit = creature.Outfit;

            this.statements = new Dictionary<string, string>();
            this.triedWords = new HashSet<string>();
            this.voices = new HashSet<NpcVoice>();

            NpcWordList.Words.Add(creature.Name.ToLower());
        }
Example #4
0
        public OtMap(OtItems items)
        {
            tiles = new Dictionary<ulong, OtTile>();
            creatures = new Dictionary<uint, OtCreature>();
            spawns = new Dictionary<ulong, OtSpawn>();
            towns = new Dictionary<uint, OtTown>();
            npcs = new HashSet<string>();

            Version = 2;
            Width = 0xFCFC;
            Height = 0xFCFC;

            Items = items;

            Descriptions = new List<string>();
        }
Example #5
0
        public OtMap(OtItems items)
        {
            tiles     = new Dictionary <ulong, OtTile>();
            creatures = new Dictionary <uint, OtCreature>();
            spawns    = new Dictionary <ulong, OtSpawn>();
            towns     = new Dictionary <uint, OtTown>();
            npcs      = new HashSet <string>();

            Version = 2;
            Width   = 0xFCFC;
            Height  = 0xFCFC;

            Items = items;

            Descriptions = new List <string>();
        }
 private void LoadItems()
 {
     try
     {
         otItems = new OtItems();
         otItems.Load("items.otb");
         Trace.WriteLine("Open Tibia items successfully loaded.");
     }
     catch (Exception e)
     {
         MessageBox.Show(this, "Unable to load items. Details: " + e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Application.Exit();
     }
 }
Example #7
0
 public virtual void Deserialize(OtFileReader fileReader, OtFileNode itemNode, OtPropertyReader reader, OtItems items)
 {
     Deserialize(reader);
 }
Example #8
0
        public override void Deserialize(OtFileReader fileReader, OtFileNode node, OtPropertyReader reader, OtItems items)
        {
            base.Deserialize(fileReader, node, reader, items);

            var itemNode = node.Child;

            while (itemNode != null)
            {
                if ((OtMap.OtMapNodeTypes)itemNode.Type != OtMap.OtMapNodeTypes.ITEM)
                {
                    throw new Exception("Invalid item node inside container.");
                }

                OtPropertyReader props = fileReader.GetPropertyReader(itemNode);

                var itemId   = props.ReadUInt16();
                var itemType = items.GetItem(itemId);
                if (itemType == null)
                {
                    throw new Exception("Unkonw item type " + itemId + " inside container.");
                }

                var item = OtItem.Create(itemType);
                item.Deserialize(fileReader, itemNode, props, items);

                Items.Add(item);

                itemNode = itemNode.Next;
            }
        }
 public virtual void Deserialize(OtFileReader fileReader, OtFileNode itemNode, OtPropertyReader reader, OtItems items)
 {
     Deserialize(reader);
 }