Esempio n. 1
0
 public static Item SerializableToItem(SerializableObjects.Item item)
 {
     return(new Item()
     {
         id = item.id,
         item_id = item.item_id,
         iconName = item.iconName,
         modelName = item.modelName,
         isDefaultItem = item.isDefaultItem,
         name = item.name,
         item_type = item.item_type,
         attack = item.attack,
         health = item.health,
         defence = item.defence,
         speed = item.speed,
         visibility = item.visibility,
         rotation = item.rotation,
         cannon_reload_speed = item.cannon_reload_speed,
         crit_chance = item.crit_chance,
         cannon_force = item.cannon_force,
         stackable = item.stackable,
         energy = item.energy,
         max_energy = item.max_energy,
         max_health = item.max_health,
         overtime = item.overtime,
         buff_duration = item.buff_duration,
         cooldown = item.cooldown
     });
 }
Esempio n. 2
0
 public int RandomQuantity(SerializableObjects.Item item)
 {
     if (item.maxLootQuantity != 0)
     {
         return((int)Random.Range(1, item.maxLootQuantity));
     }
     return(1);
 }
Esempio n. 3
0
    public static SerializableObjects.InventorySlot SlotToSerializable(InventorySlot slot)
    {
        SerializableObjects.Item item = null;

        if (slot.item != null)
        {
            item = new SerializableObjects.Item()
            {
                id                  = slot.item.id,
                item_id             = slot.item.item_id,
                iconName            = slot.item.iconName,
                modelName           = slot.item.modelName,
                isDefaultItem       = slot.item.isDefaultItem,
                name                = slot.item.name,
                item_type           = slot.item.item_type,
                attack              = slot.item.attack,
                health              = slot.item.health,
                defence             = slot.item.defence,
                speed               = slot.item.speed,
                visibility          = slot.item.visibility,
                rotation            = slot.item.rotation,
                cannon_reload_speed = slot.item.cannon_reload_speed,
                crit_chance         = slot.item.crit_chance,
                cannon_force        = slot.item.cannon_force,
                stackable           = slot.item.stackable,
                energy              = slot.item.energy,
                max_energy          = slot.item.max_energy,
                max_health          = slot.item.max_health,
                overtime            = slot.item.overtime,
                buff_duration       = slot.item.buff_duration,
                cooldown            = slot.item.cooldown
            };
        }

        return(new SerializableObjects.InventorySlot()
        {
            slotID = slot.slotID,
            quantity = slot.quantity,
            item = item
        });
    }
Esempio n. 4
0
 public void Write(SerializableObjects.Item _value)
 {
     byte[] data = ObjectToByteArray(_value);
     Write(data.Length);    // Add the length of the string to the packet
     buffer.AddRange(data); // Add the string itself
 }