Example #1
0
        public InventoryObject(string paquete)
        {
            string[] separador = paquete.Split('~');

            id_inventario = Convert.ToUInt32(separador[0], 16);
            id_modelo     = Convert.ToInt32(separador[1], 16);
            cantidad      = Convert.ToInt32(separador[2], 16);

            if (!string.IsNullOrEmpty(separador[3]))
            {
                posicion = (InventorySlots)Convert.ToSByte(separador[3], 16);
            }

            stats = separador[4];

            string[] split = separador[4].Split(',');
            foreach (string stat in split)
            {
                string[] separador_stats = stat.Split('#');
                string   id = separador_stats[0];

                if (string.IsNullOrEmpty(id))
                {
                    continue;
                }

                int stat_id = Convert.ToInt32(id, 16);
                if (stat_id == 110)
                {
                    vida_regenerada = Convert.ToInt16(separador_stats[1], 16);
                }
            }

            FileInfo archivo_item = new FileInfo("items/" + id_modelo + ".xml");

            if (archivo_item.Exists)
            {
                archivo_objeto  = XElement.Load(archivo_item.FullName);
                nombre          = archivo_objeto.Element("NOMBRE").Value;
                pods            = short.Parse(archivo_objeto.Element("PODS").Value);
                tipo            = byte.Parse(archivo_objeto.Element("TIPO").Value);
                nivel           = short.Parse(archivo_objeto.Element("NIVEL").Value);
                tipo_inventario = InventoryUtilities.get_Objetos_Inventario(tipo);

                archivo_objeto = null;
            }
        }