void ItemMoveInStorage(byte fromSlot, byte toSlot, short quantity)
{
#region Move Inside Storage
try
{
//Get item information of selected item
Global.slotItem fromItem = GetItem((uint)Character.Information.CharacterID, fromSlot, 1);
//Check item where we are moving to
Global.slotItem toItem = GetItem((uint)Character.Information.CharacterID, toSlot, 1);
//If the slot where we are moving to has an item
//Check what type of storage we use.
int storagetype = 1;
//Set storage type
if (Character.Network.Guild.UsingStorage) storagetype = 3;
if (!Character.Network.Guild.UsingStorage)
{
if (toItem.ID != 0)
{
//Visual packet
client.Send(Packet.MoveItem(0, toSlot, fromSlot, quantity, 0, "MOVE_INSIDE_STORAGE"));
//First we update database with the 2 items (From item).
MsSQL.UpdateData("UPDATE char_items SET itemnumber='item" + toSlot + "',slot='" + toSlot + "' WHERE itemnumber='" + "item" + fromSlot + "' AND owner='" + Player.ID + "' AND itemid='" + fromItem.ID + "' AND id='" + fromItem.dbID + "' AND storagetype='" + storagetype + "'");
//To item database update
MsSQL.UpdateData("UPDATE char_items SET itemnumber='item" + fromSlot + "',slot='" + fromSlot + "' WHERE itemnumber='" + "item" + toSlot + "' AND owner='" + Player.ID + "' AND itemid='" + toItem.ID + "' AND id='" + toItem.dbID + "' AND storagetype='" + storagetype + "'");
}
else
{
client.Send(Packet.MoveItem(0, fromSlot, toSlot, quantity, 0, "MOVE_INSIDE_STORAGE"));
MsSQL.UpdateData("UPDATE char_items SET itemnumber='item" + toSlot + "',slot='" + toSlot + "' WHERE itemnumber='" + "item" + fromSlot + "' AND owner='" + Player.ID + "' AND itemid='" + fromItem.ID + "' AND storagetype='"+ storagetype +"'");
}
}
//Guild storage
else
{
fromItem = GetItem((uint)Character.Information.CharacterID, fromSlot, 3);
//Check item where we are moving to
toItem = GetItem((uint)Character.Information.CharacterID, toSlot, 3);
if (toItem.ID != 0)
{
//Visual packet
client.Send(Packet.MoveItem(0, toSlot, fromSlot, quantity, 0, "MOVE_INSIDE_GUILD_STORAGE"));
//First we update database with the 2 items (From item).
MsSQL.UpdateData("UPDATE char_items SET itemnumber='item" + toSlot + "',slot='" + toSlot + "' WHERE itemnumber='" + "item" + fromSlot + "' AND guild_storage_id='" + Character.Network.Guild.Guildid + "' AND itemid='" + fromItem.ID + "' AND id='" + fromItem.dbID + "' AND storagetype='" + storagetype + "'");
//To item database update
MsSQL.UpdateData("UPDATE char_items SET itemnumber='item" + fromSlot + "',slot='" + fromSlot + "' WHERE itemnumber='" + "item" + toSlot + "' AND guild_storage_id='" + Character.Network.Guild.Guildid + "' AND itemid='" + toItem.ID + "' AND id='" + toItem.dbID + "' AND storagetype='" + storagetype + "'");
}
else
{
client.Send(Packet.MoveItem(0, fromSlot, toSlot, quantity, 0, "MOVE_INSIDE_GUILD_STORAGE"));
MsSQL.UpdateData("UPDATE char_items SET itemnumber='item" + toSlot + "',slot='" + toSlot + "' WHERE itemnumber='" + "item" + fromSlot + "' AND guild_storage_id='" + Character.Network.Guild.Guildid + "' AND itemid='" + fromItem.ID + "' AND storagetype='"+ storagetype +"'");
}
}
}
catch (Exception ex)
{
Console.WriteLine("Move inside storage error {0}", ex);
Systems.Debugger.Write(ex);
}
//Save player information
SavePlayerInfo();
#endregion
}