public Boolean BuyObject(int LineID, int Count, long Price, Player Character) { Boolean possible = true; try { if (Character.Kamas < Price) { return(false); } var Line = getLine(LineID); var ObjectToBuy = Line.Have(Count, Price); Character.InventoryCache.SubstractKamas(Price); if (ObjectToBuy.Owner != -1) { var OwnerClient = Network.WorldServer.Clients.Find(x => x.Account != null && x.Account.ID == ObjectToBuy.Owner); if (OwnerClient != null) { OwnerClient.Account.Data.BankKamas += ObjectToBuy.Price; OwnerClient.Send(new TextInformationMessage(TextInformationTypeEnum.INFO, 65, new String[] { Price.ToString(), ObjectToBuy.Item.TemplateID.ToString(), 1 + "" })); } else { AccountDataTable.UpdateKamas(ObjectToBuy.Price, ObjectToBuy.Owner); //TODO Cache vous IM MSG } } Character.Send(new AccountStatsMessage(Character)); var OldItem = ObjectToBuy.Item; Character.InventoryCache.Add(OldItem); OldItem.Template.newSold(ObjectToBuy.getQuantity(true), Price); DestroyObject(ObjectToBuy); BidHouseTable.Delete(ObjectToBuy.Item.ID); if (ObjectToBuy.Owner == -1) { InventoryItemTable.Add(OldItem); } ObjectToBuy = null; } catch (Exception e) { possible = false; } return(possible); }