TryReadSByte() public method

public TryReadSByte ( sbyte &pValue ) : bool
pValue sbyte
return bool
Esempio n. 1
0
 public static void EnhancementHandler(ZoneClient client, Packet packet)
 {
     sbyte weapslot, stoneslot;
     if (!packet.TryReadSByte(out weapslot) ||
         !packet.TryReadSByte(out stoneslot))
     {
         Log.WriteLine(LogLevel.Warn, "Invalid item enhance request.");
         return;
     }
     client.Character.UpgradeItem(weapslot, stoneslot);
 }
Esempio n. 2
0
 public static void EquipHandler(ZoneClient client, Packet packet)
 {
     sbyte slot;
     if (!packet.TryReadSByte(out slot))
     {
         Log.WriteLine(LogLevel.Warn, "Error reading equipping slot.");
         return;
     }
     Item item;
     if (client.Character.InventoryItems.TryGetValue(slot, out item))
     {
         if (item is Equip)
         {
             if (((Equip)item).Info.Level > client.Character.Level)
             {
                 FailedEquip(client.Character, 645); // 85 02
             }
             else
             {
                 client.Character.EquipItem((Equip)item);
             }
         }
         else
         {
             FailedEquip(client.Character);
             Log.WriteLine(LogLevel.Warn, "{0} equippped an item. What a moron.", client.Character.Name);
         }
     }
 }
Esempio n. 3
0
 public static void DropItemHandler(ZoneClient client, Packet packet)
 {
     sbyte slot;
     if (!packet.TryReadSByte(out slot))
     {
         Log.WriteLine(LogLevel.Warn, "Invalid drop request.");
         return;
     }
     client.Character.DropItemRequest(slot);
 }
Esempio n. 4
0
 public static void UseHandler(ZoneClient client, Packet packet)
 {
     sbyte slot;
     if (!packet.TryReadSByte(out slot))
     {
         Log.WriteLine(LogLevel.Warn, "Error reading used item slot.");
         return;
     }
     client.Character.UseItem(slot);
 }
Esempio n. 5
0
        public static void UnequipHandler(ZoneClient client, Packet packet)
        {
            ZoneCharacter character = client.Character;

            byte sourceSlot;
            sbyte destinationSlot; //not so sure about this one anymore
            if (!packet.TryReadByte(out sourceSlot) ||
                !packet.TryReadSByte(out destinationSlot))
            {
                Log.WriteLine(LogLevel.Warn, "Could not read unequip values from {0}.", character.Name);
                return;
            }
            character.UnequipItem((ItemSlot)sourceSlot, destinationSlot);
        }