public override void OnDoubleClickSecureTrade(Mobile from) { if (!from.InRange(GetWorldLocation(), 2)) { from.SendLocalizedMessage(500446); // That is too far away. } else { from.SendGump(new RecipeBookGump(from, this)); SecureTradeContainer cont = GetSecureTradeCont(); if (cont != null) { SecureTrade trade = cont.Trade; if (trade != null && trade.From.Mobile == from) { trade.To.Mobile.SendGump(new RecipeBookGump(trade.To.Mobile, this)); } else if (trade != null && trade.To.Mobile == from) { trade.From.Mobile.SendGump(new RecipeBookGump(trade.From.Mobile, this)); } } } }
public override void OnDoubleClickSecureTrade(Mobile from) { if (!from.InRange(GetWorldLocation(), 2)) { from.SendLocalizedMessage(500446); // That is too far away. } else if (m_Entries.Count == 0) { from.SendLocalizedMessage(1062381); // The book is empty. } else { from.SendGump(new PowerScrollBookGump((PlayerMobile)from, this)); SecureTradeContainer cont = GetSecureTradeCont(); if (cont != null) { SecureTrade trade = cont.Trade; if (trade != null && trade.From.Mobile == from) { trade.To.Mobile.SendGump(new PowerScrollBookGump((PlayerMobile)(trade.To.Mobile), this)); } else if (trade != null && trade.To.Mobile == from) { trade.From.Mobile.SendGump(new PowerScrollBookGump((PlayerMobile)(trade.From.Mobile), this)); } } } }
public override void OnDoubleClickSecureTrade(Mobile from) { if (from.InRange(GetWorldLocation(), 2)) { DisplayTo(from); SecureTradeContainer cont = GetSecureTradeCont(); if (cont != null) { SecureTrade trade = cont.Trade; if (trade != null && trade.From.Mobile == from) { DisplayTo(trade.To.Mobile); } else if (trade != null && trade.To.Mobile == from) { DisplayTo(trade.From.Mobile); } } } else { from.SendLocalizedMessage(500446); // That is too far away. } }
public override bool IsAccessibleTo(Mobile check) { Items.SecureTradeContainer c = GetSecureTradeCont(); if (check == null || c == null) { return(base.IsAccessibleTo(check)); } return(c.RootParent == check && IsChildOf(c)); }
public void UpdateTrade(Mobile user) { Items.SecureTradeContainer c = GetSecureTradeCont(); if (c == null || c.Trade == null) { return; } if (user == c.Trade.From.Mobile) { c.Trade.UpdateFromCurrency(); } else if (user == c.Trade.To.Mobile) { c.Trade.UpdateToCurrency(); } c.ClearChecks(); }
public SecureTradeInfo(SecureTrade owner, Mobile m, SecureTradeContainer c) { Owner = owner; Mobile = m; Container = c; Mobile.AddItem(Container); VirtualCheck = new VirtualCheck(0, 0); Container.DropItem(VirtualCheck); }
public override bool CheckTrade(Mobile to, Item item, SecureTradeContainer cont, bool message, bool checkItems, int plusItems, int plusWeight) { int msgNum = 0; if (cont == null) { if (to.Holding != null) msgNum = 1062727; // You cannot trade with someone who is dragging something. else if (this.HasTrade) msgNum = 1062781; // You are already trading with someone else! else if (to.HasTrade) msgNum = 1062779; // That person is already involved in a trade } if (msgNum == 0) { if (cont != null) { plusItems += cont.TotalItems; plusWeight += cont.TotalWeight; } if (this.Backpack == null || !this.Backpack.CheckHold(this, item, false, checkItems, plusItems, plusWeight)) msgNum = 1004040; // You would not be able to hold this if the trade failed. else if (to.Backpack == null || !to.Backpack.CheckHold(to, item, false, checkItems, plusItems, plusWeight)) msgNum = 1004039; // The recipient of this trade would not be able to carry this. else msgNum = CheckContentForTrade(item); } if (msgNum != 0) { if (message) this.SendLocalizedMessage(msgNum); return false; } return true; }
public SecureTradeInfo( SecureTrade owner, Mobile m, SecureTradeContainer c ) { m_Owner = owner; m_Mobile = m; m_Container = c; m_Mobile.AddItem( m_Container ); }
public override void OnAdded(object parent) #endif { base.OnAdded(parent); if (!AccountGold.Enabled) { return; } Mobile owner = null; SecureTradeInfo tradeInfo = null; Container root = parent as Container; while (root != null && root.Parent is Container) { root = (Container)root.Parent; } parent = root ?? parent; if (parent is SecureTradeContainer && AccountGold.ConvertOnTrade) { SecureTradeContainer trade = (SecureTradeContainer)parent; if (trade.Trade.From.Container == trade) { tradeInfo = trade.Trade.From; owner = tradeInfo.Mobile; } else if (trade.Trade.To.Container == trade) { tradeInfo = trade.Trade.To; owner = tradeInfo.Mobile; } } else if (parent is BankBox && AccountGold.ConvertOnBank) { owner = ((BankBox)parent).Owner; } if (owner == null || owner.Account == null || !owner.Account.DepositGold(Worth)) { return; } if (tradeInfo != null) { if (tradeInfo.VirtualCheck != null) { tradeInfo.VirtualCheck.UpdateTrade(tradeInfo.Mobile); } } owner.SendLocalizedMessage(1042763, Worth.ToString("#,0")); Delete(); ((Container)parent).UpdateTotals(); }
public virtual bool CheckTrade( Mobile to, Item item, SecureTradeContainer cont, bool message, bool checkItems, int plusItems, int plusWeight ) { return true; }
public SecureTradeInfo(SecureTrade owner, Mobile m, SecureTradeContainer c) { this.m_Owner = owner; this.m_Mobile = m; this.m_Container = c; this.m_Mobile.AddItem(this.m_Container); }
public override bool CheckTrade( Mobile to, Item item, SecureTradeContainer cont, bool message, bool checkItems, int plusItems, int plusWeight) { int msgNum = 0; if (cont == null) { var topm = to as PlayerMobile; if (to.Holding != null) { msgNum = 1062727; // You cannot trade with someone who is dragging something. } else if (HasTrade) { msgNum = 1062781; // You are already trading with someone else! } else if (to.HasTrade) { msgNum = 1062779; // That person is already involved in a trade } else if (to is PlayerMobile && ((PlayerMobile)to).RefuseTrades) { msgNum = 1154111; // ~1_NAME~ is refusing all trades } else if (topm != null && topm.PokerGame != null) { SendMessage(61, "You cannot trade with another player while they are playing poker."); return false; } } if (msgNum == 0) { if (cont != null) { plusItems += cont.TotalItems; plusWeight += cont.TotalWeight; } if (Backpack == null || !Backpack.CheckHold(this, item, false, checkItems, plusItems, plusWeight)) { msgNum = 1004040; // You would not be able to hold this if the trade failed. } else if (to.Backpack == null || !to.Backpack.CheckHold(to, item, false, checkItems, plusItems, plusWeight)) { msgNum = 1004039; // The recipient of this trade would not be able to carry this. } else { msgNum = CheckContentForTrade(item); } } if (msgNum != 0) { if (message) { SendLocalizedMessage(msgNum); } return false; } item.SendPropertiesTo(to); return true; }
public override void OnAdded(object parent) #endif { base.OnAdded(parent); if (!AccountGold.Enabled) { return; } Mobile owner = null; SecureTradeInfo tradeInfo = null; Container root = parent as Container; while (root != null && root.Parent is Container) { root = (Container)root.Parent; } parent = root ?? parent; if (parent is SecureTradeContainer && AccountGold.ConvertOnTrade) { SecureTradeContainer trade = (SecureTradeContainer)parent; if (trade.Trade.From.Container == trade) { tradeInfo = trade.Trade.From; owner = tradeInfo.Mobile; } else if (trade.Trade.To.Container == trade) { tradeInfo = trade.Trade.To; owner = tradeInfo.Mobile; } } else if (parent is BankBox && AccountGold.ConvertOnBank) { owner = ((BankBox)parent).Owner; } if (owner == null || owner.Account == null || !owner.Account.DepositGold(Amount)) { return; } if (tradeInfo != null) { if (owner.NetState != null && !owner.NetState.NewSecureTrading) { double total = Amount / Math.Max(1.0, Account.CurrencyThreshold); int plat = (int)Math.Truncate(total); int gold = (int)((total - plat) * Account.CurrencyThreshold); tradeInfo.Plat += plat; tradeInfo.Gold += gold; } if (tradeInfo.VirtualCheck != null) { tradeInfo.VirtualCheck.UpdateTrade(tradeInfo.Mobile); } } owner.SendLocalizedMessage(1042763, Amount.ToString("#,0")); Delete(); ((Container)parent).UpdateTotals(); }
public override bool CheckTrade( Mobile to, Item item, SecureTradeContainer cont, bool message, bool checkItems, int plusItems, int plusWeight ) { int msgNum = 0; string msg = ""; if ( cont == null ) { if (to.Holding != null) { msgNum = 1062727; msg = "You cannot trade with someone who is dragging something.";// You cannot trade with someone who is dragging something. } else if (this.HasTrade) { msgNum = 1062781; // You are already trading with someone else! msg = "You are already trading with someone else!"; } else if (to.HasTrade) { msgNum = 1062779; // That person is already involved in a trade msg = "That person is already involved in a trade."; } } if ( msgNum == 0 ) { if ( cont != null ) { plusItems += cont.TotalItems; plusWeight += cont.TotalWeight; } /*if ( this.Backpack == null || !this.Backpack.CheckHold( this, item, false, checkItems, plusItems, plusWeight ) ) msgNum = 1004040; // You would not be able to hold this if the trade failed. else if ( to.Backpack == null || !to.Backpack.CheckHold( to, item, false, checkItems, plusItems, plusWeight ) ) msgNum = 1004039; // The recipient of this trade would not be able to carry this. else*/ msgNum = CheckContentForTrade( item ); if (msgNum == 1004044) msg = "You may not trade trapped items."; else if (msgNum == 1004043) msg = "You may not trade recently stolen items."; } if ( msgNum != 0 ) { if ( message ) this.SendAsciiMessage( msg ); return false; } return true; }