public void MoveToStore(PlayerInventory bag, int fromSolt, int toSolt, PlayerInventory tobag, int maxCount) { ItemInfo item = bag.GetItemAt(fromSolt); ItemInfo toItem = tobag.GetItemAt(toSolt); if (item == null && toItem == null) return; if (toItem == null && (toSolt < 0 || toSolt > 80) || (tobag.BagType == 11 && toSolt >= maxCount)) { if (tobag.BagType == 11 || tobag.BagType == 1) toSolt = tobag.FindFirstEmptySlot(0); //else if(bag.BagType==12&&tobag.BagType==0){ // toSolt=tobag.FindFirstEmptySlot(7); //} else toSolt = tobag.FindFirstEmptySlot(31); } if ((item.Template.CategoryID == 10 || item.Template.CategoryID == 11 || item.Template.CategoryID == 12) && tobag.BagType != 0 || ((item.Template.CategoryID != 10 && item.Template.CategoryID != 11 && item.Template.CategoryID != 12) && tobag.BagType != 1)) { if (toItem != null && item != null) { int place = item.Place; int bagtype = item.BagType; int place1 = toItem.Place; int bagtype1 = toItem.BagType; bag.RemoveItem(item); tobag.RemoveItem(toItem); item.IsExist = true; item.BagType = bagtype1; tobag.AddItemTo(item, place1); toItem.IsExist = true; toItem.BagType = bagtype; if (place == -1 && (eBageType)bag.BagType == eBageType.MainBag) { place = bag.FindFirstEmptySlot(31); } if (place < 31) place = bag.FindFirstEmptySlot(31); bag.AddItemTo(toItem, place); } else { if (toItem != null) { tobag.RemoveItem(item); bag.AddItemTo(item, toSolt); } if (item != null) { if (tobag.BagType == 11 && toSolt >= maxCount) { UpdateItem(item); return; } else { bag.RemoveItem(item); tobag.AddItemTo(item, toSolt); } } } } else { if (toItem != null) UpdateItem(toItem); if (item != null) UpdateItem(item); } }
public void MoveToStore(PlayerInventory bag, int fromSolt, int toSolt, PlayerInventory tobag, int maxCount) { ItemInfo item = bag.GetItemAt(fromSolt); ItemInfo toItem = tobag.GetItemAt(toSolt); if (item == null && toItem == null) { return; } if (toItem == null && (toSolt < 0 || toSolt > 80) || (tobag.BagType == 11 && toSolt >= maxCount)) { //if (tobag.BagType == 11 || tobag.BagType == 1) if ((tobag.BagType == (int)eBageType.Bank) || (tobag.BagType == (int)eBageType.PropBag)) { toSolt = tobag.FindFirstEmptySlot(0); } else { toSolt = tobag.FindFirstEmptySlot(31); } } if ((item.Template.CategoryID == 10 || item.Template.CategoryID == 11 || item.Template.CategoryID == 12) && tobag.BagType != 0 || ((item.Template.CategoryID != 10 && item.Template.CategoryID != 11 && item.Template.CategoryID != 12) && tobag.BagType != 1)) { if (toItem != null && item != null) { int place = item.Place; int bagtype = item.BagType; int place1 = toItem.Place; int bagtype1 = toItem.BagType; bag.RemoveItem(item); tobag.RemoveItem(toItem); item.IsExist = true; item.BagType = bagtype1; tobag.AddItemTo(item, place1); toItem.IsExist = true; toItem.BagType = bagtype; if (place == -1 && (eBageType)bag.BagType == eBageType.MainBag) { place = bag.FindFirstEmptySlot(31); } if (place < 31) { place = bag.FindFirstEmptySlot(31); } bag.AddItemTo(toItem, place); } else { if (toItem != null) { tobag.RemoveItem(item); bag.AddItemTo(item, toSolt); } if (item != null) { if (tobag.BagType == (int)eBageType.Bank && toSolt >= maxCount) { //Console.WriteLine("+++++Stage 12!"); UpdateItem(item); return; } else { //Console.WriteLine("+++++Stage 13!"); bag.RemoveItem(item); tobag.AddItemTo(item, toSolt); } } } } else { if (toItem != null) { UpdateItem(toItem); } //Console.WriteLine("+++++UpdateItem(toItem);"); if (item != null) { UpdateItem(item); } //Console.WriteLine("+++++UpdateItem(item);"); } }