private bool VerifyTrade_Inventory(Player partner) { var self_items = GetItemsInTradeWindow(this); var partner_items = GetItemsInTradeWindow(partner); var playerACanAddToInventory = CanAddToInventory(partner_items, out var selfEncumbered, out var selfPackSpace); var playerBCanAddToInventory = partner.CanAddToInventory(self_items, out var partnerEncumbered, out var partnerPackSpace); if (playerACanAddToInventory && playerBCanAddToInventory) { return(true); } var selfReason = ""; var partnerReason = ""; if (!playerACanAddToInventory) { selfReason = "You "; partnerReason = "Your trading partner "; if (selfEncumbered) { selfReason += "are too encumbered to complete the trade!"; partnerReason += "is too encumbered to complete the trade!"; } else if (selfPackSpace) { selfReason += "do not have enough free slots to complete the trade!"; partnerReason += "does not have enough free slots to complete the trade!"; } } else if (!playerBCanAddToInventory) { selfReason = "Your trading partner "; partnerReason = "You "; if (partnerEncumbered) { selfReason += "is too encumbered to complete the trade!"; partnerReason += "are too encumbered to complete the trade!"; } else if (partnerPackSpace) { selfReason += "does not have enough free slots to complete the trade!"; partnerReason += "do not have enough free slots to complete the trade!"; } } Session.Network.EnqueueSend(new GameEventCommunicationTransientString(Session, selfReason)); partner.Session.Network.EnqueueSend(new GameEventCommunicationTransientString(partner.Session, partnerReason)); ClearTradeAcceptance(); partner.ClearTradeAcceptance(); return(false); }
private bool VerifyTrade_BusyState(Player partner) { if (!IsBusy && !partner.IsBusy) { return(true); } var selfBusy = "You are too busy to complete the trade!"; var otherBusy = "Your trading partner is too busy to complete the trade!"; var selfMsg = IsBusy ? selfBusy : otherBusy; var partnerMsg = IsBusy ? otherBusy : selfBusy; Session.Network.EnqueueSend(new GameEventCommunicationTransientString(Session, selfMsg)); partner.Session.Network.EnqueueSend(new GameEventCommunicationTransientString(partner.Session, partnerMsg)); ClearTradeAcceptance(); partner.ClearTradeAcceptance(); return(false); }