public void owner_of_property_recieves_money_from_rent() { _tradeableProperty.SetOwner(ref _banker); var bankerBalanceBefore = _banker.GetBalance(); _tradeableProperty.PayRent(ref _player); var bankerBalanceAfter = _banker.GetBalance(); Assert.AreEqual(bankerBalanceBefore + _tradeableProperty.GetRent(), bankerBalanceAfter); }
public void ChairmanOfTheBoardMakesThePlayerPayEachOtherPlayer50Dollars() { var player3 = "Dog"; players.Add(player3); banker = new Banker(players, 1500); var chairmanOfTheBoard = new PayEachPlayer(banker, 50); var previousBalance = banker.GetBalance(player1); chairmanOfTheBoard.Play(player1); Assert.That(banker.GetBalance(player1), Is.EqualTo(previousBalance - 100)); }
public void GrandOperaLetsThePlayerCollect50DollarsFromEachPlayer() { var player2 = "Car"; var player3 = "Dog"; players.AddRange(new[] { player2, player3 }); banker = new Banker(players, 1500); var grandOpera = new CollectFromEachPlayer(banker, 50); var previousBalance = banker.GetBalance(player1); grandOpera.Play(player1); Assert.That(banker.GetBalance(player1), Is.EqualTo(previousBalance + 100)); }
public static int GetCurrency(Mobile m, bool sendMessage = false) { switch (Configuration.CurrencyType) { case CurrencyType.None: return(0); case CurrencyType.Sovereigns: if (m is PlayerMobile) { return(((PlayerMobile)m).AccountSovereigns); } return(0); case CurrencyType.Gold: return(Banker.GetBalance(m)); case CurrencyType.PointsSystem: var sys = PointsSystem.GetSystemInstance(Configuration.PointsSystemCurrency); if (sys != null) { return((int)sys.GetPoints(m)); } return(0); case CurrencyType.Custom: return((int)Configuration.GetCustomCurrency(m)); } return(0); }
public override void AddGumpLayout() { base.AddGumpLayout(); int gold = Citizenship.GetTitleCost(Title); LoyaltyRating rating = Citizenship.GetMinimumRating(Title); AddHtmlLocalized(60, 40, 300, 20, 1152901, false, false); // Obtain Title AddHtmlLocalized(75, 60, 200, 16, CityLoyaltySystem.GetTitleLocalization(User, Title, Citizenship.City), false, false); AddHtmlLocalized(60, 120, 200, 16, 1152899, false, false); // Loyalty Required: AddHtmlLocalized(60, 140, 200, 16, 1152900, false, false); // Donation Required: AddHtmlLocalized(200, 120, 150, 16, CityLoyaltySystem.RatingLocalization(Citizenship.GetMinimumRating(Title)), false, false); AddHtml(200, 140, 150, 16, Citizenship.GetTitleCost(Title).ToString("N0", System.Globalization.CultureInfo.GetCultureInfo("en-US")), false, false); if (gold > Banker.GetBalance(User)) { AddHtmlLocalized(30, 180, 280, 80, 1152902, false, false); // You do not have enough funds in your bank box to donate for this title. } else if (rating > Citizenship.GetLoyaltyRating(User)) { AddHtmlLocalized(30, 180, 280, 80, 1152903, false, false); // You do not have the required minimum loyalty rating to receive this title. } else { AddHtmlLocalized(60, 345, 150, 16, 1152904, false, false); // Gain Title AddButton(40, 350, 2103, 2104, 1, GumpButtonType.Reply, 0); } AddHtmlLocalized(60, 365, 150, 16, 1152889, false, false); // Cancel AddButton(40, 370, 2103, 2104, 2, GumpButtonType.Reply, 0); }
public BuyGump(PlayerMobile from, byte p) : base(10, 0x69) { page = p; Closable = true; Disposable = false; Dragable = true; AddPage(0); AddBackground(60, 70, 300, 440, 3500); AddLabel(80, 460, 50, string.Format("存款: {0}", Banker.GetBalance(from).ToString())); AddButton(320, 75, 0xfb2, 0xfb3, close, GumpButtonType.Reply, 0); //button close AddPage(1); buylabel(); //画表了 if (page > 0) { AddButton(205, 460, 2443, 2444, prev, GumpButtonType.Reply, 0); AddLabel(210, 460, 60, "上一頁"); } if (page < onsells.Length - 1) { AddButton(275, 460, 2443, 2444, next, GumpButtonType.Reply, 0); AddLabel(280, 460, 60, "下一頁"); } }
public static int GetCurrency(Mobile m, bool sendMessage = false) { switch (Configuration.CurrencyImpl) { case CurrencyType.Sovereigns: { if (m is PlayerMobile) { return(((PlayerMobile)m).AccountSovereigns); } } break; case CurrencyType.Gold: return(Banker.GetBalance(m)); case CurrencyType.PointsSystem: { var sys = PointsSystem.GetSystemInstance(Configuration.PointsImpl); if (sys != null) { return((int)Math.Min(Int32.MaxValue, sys.GetPoints(m))); } } break; case CurrencyType.Custom: return(Configuration.GetCustomCurrency(m)); } return(0); }
public TithingGump(Mobile from, int offer) : base(100, 100) { int totalGold = Banker.GetBalance(from); string gold = totalGold >= MaxTithing ? "100,000+" : totalGold.ToString("N0", CultureInfo.GetCultureInfo("en-US")); AddPage(0); AddBackground(0, 0, 250, 355, 0x6DB); AddImage(8, 0, 0x66); AddHtmlLocalized(73, 65, 100, 150, 1114513, "#1060198", 0xC63, false, false); // <DIV ALIGN=CENTER>~1_TOKEN~</DIV> AddHtmlLocalized(85, 245, 50, 18, 3000311, 0xC63, false, false); // Gold: AddLabel(117, 245, 0x35, gold); AddHtmlLocalized(43, 275, 200, 18, 1159137, 0x7FFF, false, false); // How much whilst thou tithe? AddBackground(85, 295, 80, 22, 0x2486); AddTextEntry(87, 297, 76, 18, 0x0, 1, offer > 0 ? string.Format("{0}", offer) : "", 6); AddButton(205, 321, 0xFB7, 0xFB8, 2, GumpButtonType.Reply, 0); // OK AddButton(15, 326, 0x845, 0x846, 1, GumpButtonType.Reply, 0); AddHtmlLocalized(35, 323, 200, 18, 1159139, 0x7FFF, false, false); // Tithe Maximum }
public override void OnResponse(RelayInfo info) { switch (info.ButtonID) { default: break; case 1: { if (Banker.GetBalance(User) < AuctionMap.TeleportCost) { User.SendLocalizedMessage(1154672); // You cannot afford to teleport to the vendor. } else if (!AuctionMap.CheckItem()) { User.SendLocalizedMessage(1154643); // That item is no longer for sale. } else if (AuctionMap.SetLocation != Point3D.Zero && (!Utility.InRange(AuctionMap.SetLocation, User.Location, 100) || AuctionMap.SetMap != User.Map)) { User.SendLocalizedMessage(501035); // You cannot teleport from here to the destination. } else { new Spells.Fourth.RecallSpell(User, AuctionMap, AuctionMap).Cast(); } break; } } }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; from.CloseGump(typeof(ResurrectGump)); if (info.ButtonID == 1 || info.ButtonID == 2) { if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false)) { from.SendLocalizedMessage(502391); // Thou can not be resurrected there! return; } if (m_Price > 0) { if (info.IsSwitched(1)) { if (Banker.Withdraw(from, m_Price)) { from.SendLocalizedMessage(1060398, m_Price.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box. from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString()); // You have ~1_AMOUNT~ gold in cash remaining in your bank box. } else { from.SendLocalizedMessage(1060020); // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing. return; } } else { from.SendLocalizedMessage(1060019); // You decide against paying the healer, and thus remain dead. return; } } from.PlaySound(0x214); from.FixedEffect(0x376A, 10, 16); from.Resurrect(); if (m_Healer != null && from != m_Healer) { VirtueLevel level = VirtueHelper.GetLevel(m_Healer, VirtueName.Compassion); switch (level) { case VirtueLevel.Seeker: from.Hits = AOS.Scale(from.HitsMax, 20); break; case VirtueLevel.Follower: from.Hits = AOS.Scale(from.HitsMax, 40); break; case VirtueLevel.Knight: from.Hits = AOS.Scale(from.HitsMax, 80); break; } } Mobile m = from; Misc.Titles.AwardFame(from, -100, true); // TODO: Proper fame loss } }
public override void OnResponse(RelayInfo info) { switch (info.ButtonID) { default: break; case 1: { if (Banker.GetBalance(User) < VendorMap.TeleportCost) { User.SendLocalizedMessage(1154672); // You cannot afford to teleport to the vendor. } else if (VendorMap.SetLocation == Point3D.Zero && !VendorSearch.CanSearch(User)) { User.SendLocalizedMessage(1154680); //Before using vendor search, you must be in a justice region or a safe log-out location (such as an inn or a house which has you on its Owner, Co-owner, or Friends list). } else if (VendorMap.SetLocation == Point3D.Zero && !VendorSearch.CanSearch(User)) { User.SendLocalizedMessage(501035); // You cannot teleport from here to the destination. } else { new Spells.Fourth.RecallSpell(User, VendorMap, VendorMap).Cast(); } break; } } }
private void BuildGump() { AddBackground(265, 205, 393, 270, 70000); AddImage(265, 205, 1140); Closable = false; Resizable = false; AddPage(0); AddHtml(325, 255, 300, 60, "<BIG>Would you like to report " + _killers[_idx].Name + " as a murderer?</BIG>", false, false); var bountymax = Banker.GetBalance(_victim); if (_killers[_idx].Kills >= 4 && bountymax > 0) { AddHtml(325, 325, 300, 60, "<BIG>Optional Bounty: [" + bountymax + " max] </BIG>", false, false); AddImage(323, 343, 0x475); AddTextEntry(329, 346, 311, 16, 0, 1, ""); } AddButton(385, 395, 0x47B, 0x47D, 1, GumpButtonType.Reply, 0); AddButton(465, 395, 0x478, 0x47A, 2, GumpButtonType.Reply, 0); }
public PetBrokerGump(PetBroker broker, Mobile from) { m_Broker = broker; AddHtmlLocalized(215, 10, 200, 18, 1150311, RedColor16, false, false); // Animal Broker if (m_Broker.Plot.ShopName != null && m_Broker.Plot.ShopName.Length > 0) { AddHtml(173, 40, 173, 18, Color(FormatStallName(m_Broker.Plot.ShopName), BlueColor), false, false); } else { AddHtmlLocalized(180, 40, 200, 18, 1150314, BlueColor16, false, false); // This Shop Has No Name } AddHtml(173, 65, 173, 18, Color(FormatBrokerName(String.Format("Proprietor: {0}", broker.Name)), BlueColor), false, false); AddHtmlLocalized(215, 100, 200, 18, 1150328, GreenColor16, false, false); // Owner Menu AddButton(150, 150, 4005, 4007, 1, GumpButtonType.Reply, 0); AddHtmlLocalized(190, 150, 200, 18, 1150392, OrangeColor16, false, false); // INFORMATION AddHtmlLocalized(39, 180, 200, 18, 1150199, RedColor16, false, false); // Broker Account Balance AddHtml(190, 180, 300, 18, FormatAmt(broker.BankBalance), false, false); int balance = Banker.GetBalance(from); AddHtmlLocalized(68, 200, 200, 18, 1150149, GreenColor16, false, false); // Your Bank Balance: AddHtml(190, 200, 200, 18, FormatAmt(balance), false, false); AddHtmlLocalized(32, 230, 200, 18, 1150329, OrangeColor16, false, false); // Broker Sales Comission AddHtmlLocalized(190, 230, 100, 18, 1150330, false, false); // 5% AddHtmlLocalized(110, 250, 200, 18, 1150331, OrangeColor16, false, false); // Weekly Fee: AddHtml(190, 250, 250, 18, FormatAmt(broker.GetWeeklyFee()), false, false); AddHtmlLocalized(113, 280, 200, 18, 1150332, OrangeColor16, false, false); // Shop Name: AddBackground(190, 280, 285, 22, 9350); AddTextEntry(191, 280, 285, 20, LabelHueBlue, 0, m_Broker.Plot.ShopName == null ? "" : m_Broker.Plot.ShopName); AddButton(480, 280, 4014, 4016, 2, GumpButtonType.Reply, 0); AddHtmlLocalized(83, 305, 150, 18, 1150195, OrangeColor16, false, false); // Withdraw Funds AddBackground(190, 305, 285, 22, 9350); AddTextEntry(191, 305, 285, 20, LabelHueBlue, 1, ""); AddButton(480, 305, 4014, 4016, 3, GumpButtonType.Reply, 0); AddHtmlLocalized(95, 330, 150, 18, 1150196, OrangeColor16, false, false); // Deposit Funds AddBackground(190, 330, 285, 22, 9350); AddTextEntry(191, 330, 285, 20, LabelHueBlue, 2, ""); AddButton(480, 330, 4014, 4016, 4, GumpButtonType.Reply, 0); AddButton(150, 365, 4005, 4007, 5, GumpButtonType.Reply, 0); AddHtmlLocalized(190, 365, 350, 18, 1150276, OrangeColor16, false, false); // TRANSFER STABLED PETS TO MERCHANT AddButton(150, 390, 4005, 4007, 6, GumpButtonType.Reply, 0); AddHtmlLocalized(190, 390, 350, 18, 1150277, OrangeColor16, false, false); // TRANSFER MERCHANT INVENTORY TO STABLE AddButton(150, 415, 4005, 4007, 7, GumpButtonType.Reply, 0); AddHtmlLocalized(190, 415, 350, 18, 1150334, OrangeColor16, false, false); // VIEW INVENTORY / EDIT PRICES }
public CommodityBrokerGump(CommodityBroker broker, Mobile from) { m_Broker = broker; AddHtmlLocalized(205, 10, 200, 18, 1150636, RedColor16, false, false); // Commodity Broker if (m_Broker.Plot.ShopName != null && m_Broker.Plot.ShopName.Length > 0) { AddHtml(173, 40, 173, 18, Color(FormatStallName(m_Broker.Plot.ShopName), BlueColor), false, false); } else { AddHtmlLocalized(180, 40, 200, 18, 1150314, BlueColor16, false, false); // This Shop Has No Name } AddHtml(173, 65, 173, 18, Color(FormatBrokerName(String.Format("Proprieter: {0}", broker.Name)), BlueColor), false, false); AddHtmlLocalized(215, 100, 200, 18, 1150328, GreenColor16, false, false); // OWNER MENU AddButton(150, 150, 4005, 4007, 1, GumpButtonType.Reply, 0); AddHtmlLocalized(190, 150, 200, 18, 1150392, OrangeColor16, false, false); // INFORMATION AddHtmlLocalized(38, 180, 200, 18, 1150199, RedColor16, false, false); // Broker Account Balance AddHtml(190, 180, 300, 18, FormatAmt(broker.BankBalance), false, false); int balance = Banker.GetBalance(from); AddHtmlLocalized(68, 200, 200, 18, 1150149, GreenColor16, false, false); // Your Bank Balance: AddHtml(190, 200, 200, 18, FormatAmt(balance), false, false); AddHtmlLocalized(32, 230, 200, 18, 1150329, OrangeColor16, false, false); // Broker Sales Comission AddHtmlLocalized(190, 230, 100, 18, 1150330, 0x000000, false, false); // 5% AddHtmlLocalized(109, 250, 200, 18, 1150331, OrangeColor16, false, false); // Weekly Fee: AddHtml(190, 250, 100, 18, FormatAmt(broker.GetWeeklyFee()), false, false); AddHtmlLocalized(113, 280, 200, 18, 1150332, OrangeColor16, false, false); // Shop Name: AddBackground(190, 280, 285, 22, 9350); AddTextEntry(191, 280, 285, 20, LabelHueBlue, 0, m_Broker.Plot.ShopName == null ? "" : m_Broker.Plot.ShopName); AddButton(480, 280, 4014, 4016, 2, GumpButtonType.Reply, 0); AddHtmlLocalized(85, 305, 150, 18, 1150195, OrangeColor16, false, false); // Withdraw Funds AddBackground(190, 305, 285, 22, 9350); AddTextEntry(191, 305, 285, 20, LabelHueBlue, 1, ""); AddButton(480, 305, 4014, 4016, 3, GumpButtonType.Reply, 0); AddHtmlLocalized(97, 330, 150, 18, 1150196, OrangeColor16, false, false); // Deposit Funds AddBackground(190, 330, 285, 22, 9350); AddTextEntry(191, 330, 285, 20, LabelHueBlue, 2, ""); AddButton(480, 330, 4014, 4016, 4, GumpButtonType.Reply, 0); AddButton(150, 365, 4005, 4007, 5, GumpButtonType.Reply, 0); AddHtmlLocalized(190, 365, 200, 18, 1150192, OrangeColor16, false, false); // ADD TO INVENTORY AddButton(150, 390, 4005, 4007, 6, GumpButtonType.Reply, 0); AddHtmlLocalized(190, 390, 300, 18, 1150193, OrangeColor16, false, false); // VIEW INVENTORY / REMOVE ITEMS AddButton(150, 415, 4005, 4007, 7, GumpButtonType.Reply, 0); AddHtmlLocalized(190, 415, 300, 18, 1150194, OrangeColor16, false, false); // SET PRICES AND LIMITS }
public override void OnResponse(NetState sender, RelayInfo info) { var index = info.ButtonID - 1; if (index >= 0 && index < m_SellList.Length) { var buyInfo = m_SellList[index]; var balance = Banker.GetBalance(m_From); var isFemale = m_From.Female || m_From.Body.IsFemale; if (buyInfo.FacialHair && isFemale) { m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1010639, m_From.NetState); } else if (balance >= buyInfo.Price) { try { var origArgs = buyInfo.GumpArgs; var args = new object[origArgs.Length]; for (var i = 0; i < args.Length; ++i) { if (origArgs[i] == CustomHairstylist.Price) { args[i] = m_SellList[index].Price; } else if (origArgs[i] == CustomHairstylist.From) { args[i] = m_From; } else if (origArgs[i] == CustomHairstylist.Vendor) { args[i] = m_Vendor; } else { args[i] = origArgs[i]; } } var g = buyInfo.GumpType.CreateInstance <Gump>(args); m_From.SendGump(g); } catch { // ignored } } else { m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1042293, m_From.NetState); } } }
private bool CanAfford() { if (Banker.GetBalance(Caster) < ShopMap.TeleportCost) { Caster.SendLocalizedMessage(1154672); // You cannot afford to teleport to the vendor. return(false); } return(true); }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; from.CloseGump(typeof(ResurrectGump)); if (info.ButtonID == 1 || info.ButtonID == 2) { if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false)) { from.SendLocalizedMessage(502391); // Thou can not be resurrected there! return; } if (m_Price > 0) { if (info.IsSwitched(1)) { if (Banker.Withdraw(from, m_Price)) { from.SendLocalizedMessage(1060398, m_Price.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box. from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString()); // You have ~1_AMOUNT~ gold in cash remaining in your bank box. } else { from.SendLocalizedMessage(1060020); // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing. return; } } else { from.SendLocalizedMessage(1060019); // You decide against paying the healer, and thus remain dead. return; } } from.PlaySound(0x214); from.FixedEffect(0x376A, 10, 16); from.Resurrect(); if (from.Fame > 0) { int amount = from.Fame / 10; Misc.FameKarmaTitles.AwardFame(from, -amount, true); } if (from.Alive && m_HitsScalar > 0) { from.Hits = (int)(from.HitsMax * m_HitsScalar); } } }
private static void EventSink_Login(LoginEventArgs args) { int userCount = NetState.Instances.Count; int itemCount = World.Items.Count; int mobileCount = World.Mobiles.Count; Mobile m = args.Mobile; //THESE LINES ADDED TO BRING NEW SKILL CAPS TO PRE-EXISTING PLAYERMOBILES //THESE LINES ADDED TO BRING NEW SKILL CAPS TO PRE-EXISTING PLAYERMOBILES for (int i = 0; i < SkillInfo.Table.Length; i++) //THESE LINES ADDED TO BRING NEW SKILL CAPS TO PRE-EXISTING PLAYERMOBILES { //THESE LINES ADDED TO BRING NEW SKILL CAPS TO PRE-EXISTING PLAYERMOBILES m.Skills[i].Cap = 15100.0; //ADD NEW INDIVIDUAL SKILL CAPS HERE //THESE LINES ADDED TO BRING NEW SKILL CAPS TO PRE-EXISTING PLAYERMOBILES //THESE LINES ADDED TO BRING NEW SKILL CAPS TO PRE-EXISTING PLAYERMOBILES m.SendMessage("Welcome, {0}! There {1} currently {2} user{3} online, with {4} item{5} and {6} mobile{7} in the world.", args.Mobile.Name, userCount == 1 ? "is" : "are", userCount, userCount == 1 ? "" : "s", itemCount, itemCount == 1 ? "" : "s", mobileCount, mobileCount == 1 ? "" : "s"); PlayerMobile pm = (PlayerMobile)m; if (pm.OwesBackTaxes == true) { if (pm.City != null) { if (Banker.Withdraw(m, pm.BackTaxesAmount)) { m.SendMessage("You have paid your back taxes in full from the money in your bank account."); pm.City.CityTreasury += pm.BackTaxesAmount; pm.OwesBackTaxes = false; pm.BackTaxesAmount = 0; } else { int balance = Banker.GetBalance(m); if (Banker.Withdraw(m, balance)) { pm.City.CityTreasury += balance; pm.BackTaxesAmount -= 0; m.SendMessage("You have made a payment on your back taxes of {0} you now owe {1} in back taxes.", balance, pm.BackTaxesAmount); } } } else { pm.OwesBackTaxes = false; pm.BackTaxesAmount = 0; } } } }
public static float GoldDump(Mobile m) { StreamWriter w = new StreamWriter("gold.txt"); float goldcount = 0; float bankgold = 0; float packgold = 0; float inbank = 0; float inpack = 0; m.SendMessage("Exporting list of gold to \"gold.txt\"..."); w.WriteLine("Character Gold (bank pack total name)"); foreach (Mobile MiW in World.Mobiles.Values) { if (MiW is PlayerMobile) { PlayerMobile pm = (PlayerMobile)MiW; if (pm.AccessLevel < AccessLevel.GameMaster) { inbank = Banker.GetBalance(pm); inpack = SearchForGold(pm.Backpack); w.WriteLine("{0}\t{1}\t{2}\t{3}", inbank, inpack, inbank + inpack, pm.Name); bankgold += inbank; packgold += inpack; } } } w.WriteLine(""); w.WriteLine("Total in banks: {0}", bankgold); w.WriteLine("Total in packs: {0}", packgold); w.WriteLine("Total player gold: {0}", bankgold + packgold); // Total gold in world foreach (Item i in World.Items.Values) { if (i is Gold) { goldcount += ((Gold)i).Amount; } else if (i is BankCheck) { goldcount += ((BankCheck)i).Worth; } } w.WriteLine(""); w.WriteLine("Total in world: {0}", goldcount); w.Close(); m.SendMessage("Export complete."); return(goldcount); }
public void LuxuryTaxTakes75DollarsFromAPlayer() { var player = "Horse"; var players = new List<String> { player }; var banker = new Banker(players, 1500); var luxuryTax = new LuxuryTax(banker, 75); luxuryTax.LandOnSpace(player); var afterTaxMoney = banker.GetBalance(player); Assert.That(afterTaxMoney, Is.EqualTo(1425)); }
public override void OnResponse(NetState state, RelayInfo info) { int btd = info.ButtonID; Mobile m = state.Mobile; if (info.ButtonID == 1) { TextRelay entry = info.GetTextEntry(0); //parse out the text entry try{ int balance = Banker.GetBalance(m); int num = int.Parse(entry.Text); int maxGameBal = ds.getGameBalanceMax(); //take out the full amount of bank if applicable if (num > balance) { num = balance; } //if its over the max size, set num to it if (num > maxGameBal) { num = maxGameBal; m.SendMessage("You entered more than the max of " + maxGameBal + " gp. on this table, you are buying in with the max instead."); } //check if they have minimum game balance if (num >= ds.getGameBalanceMin()) { //withdrawl Banker.Withdraw(m, num); ds.AddPlayer(m, num); } else { ds.ShowNewGameGump(m); m.SendMessage("You did not enter a sufficient minimum amount to play,try again."); } }catch { m.Frozen = false; m.SendMessage("You did not enter a amount of gold to play with, try again."); } } else if (info.ButtonID == 2) { m.Frozen = false; m.SendMessage("You decided not to play Liars Dice."); } else { state.Mobile.SendMessage("Illegal option selected"); } }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; from.CloseGump(typeof(ScriptCorpseGump)); if (info.ButtonID == 1 || info.ButtonID == 2) { Item corpse = from.Corpse; if (corpse != null) { if (m_Price > 0) { if (info.IsSwitched(1)) { if (Banker.Withdraw(from, m_Price)) { from.SendLocalizedMessage(1060398, m_Price.ToString()); // Amount charged from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString()); // Amount left, from bank } else { from.SendMessage("Unfortunately, you do not have enough cash in your bank to summon your corpse"); from.CantWalk = false; return; } } else { from.SendMessage("You decide against paying the stone, leaving your corpse behind."); from.CantWalk = false; return; } } from.Corpse.Location = new Point3D(from.Location); Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0x3728, 10, 30, 5052); Effects.PlaySound(from.Location, from.Map, 0x201); from.Corpse.Map = from.Map; from.CantWalk = false; } else { from.SendMessage("Your corpse has decayed, or you did not have one to start out with."); from.CantWalk = false; } } }
public ShowToolHouse(PlayerMobile owner) : base(10, 110) { pm = owner; Closable = true; Disposable = true; Dragable = true; Resizable = true; AddPage(0); AddPage(1); AddBackground(0, 0, 150, 360, 5054); // AddImageTiled(10, 10, 130, 340, 0xa8e); AddAlphaRegion(10, 10, 130, 340); AddButton(12, 50, 4005, 4007, 1, GumpButtonType.Reply, 0); AddButton(12, 80, 4005, 4007, 2, GumpButtonType.Reply, 0); AddButton(12, 110, 4005, 4007, 3, GumpButtonType.Reply, 0); AddButton(12, 140, 4005, 4007, 4, GumpButtonType.Reply, 0); AddButton(12, 170, 4005, 4007, 5, GumpButtonType.Reply, 0); AddButton(12, 200, 4005, 4007, 6, GumpButtonType.Reply, 0); // AddButton(12, 230, 4026, 4027, 7, GumpButtonType.Reply, 0); AddButton(12, 260, 4026, 4027, 8, GumpButtonType.Reply, 0); AddButton(12, 290, 4037, 4036, 9, GumpButtonType.Reply, 0); AddButton(12, 320, 4037, 4036, 10, GumpButtonType.Reply, 0); AddButton(0x60, 0x26, 0x900, 0x901, 0, GumpButtonType.Page, 2); AddLabel(15, 15, 50, string.Format("存款: {0}", Banker.GetBalance(pm).ToString()));//存款余额 AddLabel(45, 50, 0x40, "锁定"); AddLabel(45, 80, 0x40, "释放"); AddLabel(45, 110, 0x40, "保险"); AddLabel(45, 140, 0x40, "释保"); AddLabel(45, 170, 0x40, "Ban"); AddLabel(45, 200, 0x40, "垃圾桶"); // AddLabel(45, 230, 94, "存款余额"); AddButton(40, 256, 0x2a44, 0x2a58, 8, GumpButtonType.Reply, 0); AddLabel(45, 260, 94, "打开保险箱"); AddButton(40, 286, 0x2a44, 0x2a58, 9, GumpButtonType.Reply, 0); AddLabel(45, 290, 49, "取五千块钱"); AddButton(40, 316, 0x2a44, 0x2a58, 10, GumpButtonType.Reply, 0); AddLabel(45, 320, 49, "取两万块钱"); AddPage(2); AddButton(0x60, 0x26, 0x900, 0x901, 0, GumpButtonType.Page, 1); }
public TithingGump(Mobile from, int offer) : base(160, 40) { int totalGold = Banker.GetBalance(from); //from.TotalGold; if (offer > totalGold) { offer = totalGold; } else if (offer < 0) { offer = 0; } m_From = from; m_Offer = offer; AddPage(0); AddImage(30, 30, 102); AddHtmlLocalized(95, 100, 120, 100, 1060198, 0, false, false); // May your wealth bring blessings to those in need, if tithed upon this most sacred site. string total = totalGold - offer > 100000 ? "100000+" : (totalGold - offer).ToString(); AddLabel(57, 274, 0, "Gold:"); AddLabel(87, 274, 53, total); AddLabel(137, 274, 0, "Tithe:"); AddLabel(172, 274, 53, offer.ToString()); AddButton(105, 230, 5220, 5220, 2, GumpButtonType.Reply, 0); AddButton(113, 230, 5222, 5222, 2, GumpButtonType.Reply, 0); AddLabel(108, 228, 0, "<"); AddLabel(112, 228, 0, "<"); AddButton(127, 230, 5223, 5223, 1, GumpButtonType.Reply, 0); AddLabel(131, 228, 0, "<"); AddButton(147, 230, 5224, 5224, 3, GumpButtonType.Reply, 0); AddLabel(153, 228, 0, ">"); AddButton(168, 230, 5220, 5220, 4, GumpButtonType.Reply, 0); AddButton(176, 230, 5222, 5222, 4, GumpButtonType.Reply, 0); AddLabel(172, 228, 0, ">"); AddLabel(176, 228, 0, ">"); AddButton(217, 272, 4023, 4024, 5, GumpButtonType.Reply, 0); }
public PokerRebuy(Mobile from, PokerGame game) : base(50, 50) { m_Game = game; PokerPlayer pokerplayer; game.IsPlayer(from as PlayerMobile, out pokerplayer); AddBackground(0, 0, 400, 300, 9270); AddAlphaRegion(92, 10, 215, 24); AddHtml(14, 14, 371, 24, String.Format("<CENTER><BIG><BASEFONT COLOR=#FFFFFF>{0}</BASEFONT></BIG></CENTER>", "Rebuy in to the Poker Game?"), false, false); AddImageTiled(20, 34, 347, 2, 9277); AddImageTiled(34, 36, 347, 2, 9277); AddHtml(20, 41, 365, 130, String.Format("<LEFT><BASEFONT COLOR=#F7D358>{0}</BASEFONT><</LEFT>", "Are you sure you want to rebuy in to the poke game? Your new buy-in + your current chips must be greater than or equal to the minimum buy-in and cannot exceed the maximum buy-in. Please note that this is an easy way for irresponsible people to lose money. No gold will be refunded."), false, false); AddImageTiled(20, 150, 347, 2, 9277); AddImageTiled(34, 152, 347, 2, 9277); AddHtml(53, 160, 100, 25, String.Format("<LEFT><BASEFONT COLOR=#FFFFFF>{0}</BASEFONT></LEFT>", "Min Buy-In:"), false, false); AddLabel(125, 160, 1258, m_Game.Dealer.MinBuyIn.ToString("#,0") + " " + (m_Game.Dealer.IsDonation ? "donation coins" : "gold")); AddHtml(50, 180, 100, 25, String.Format("<LEFT><BASEFONT COLOR=#FFFFFF>{0}</BASEFONT></LEFT>", "Max Buy-In:"), false, false); AddLabel(125, 180, 1258, m_Game.Dealer.MaxBuyIn.ToString("#,0") + " " + (m_Game.Dealer.IsDonation ? "donation coins" : "gold")); AddHtml(40, 200, 100, 25, String.Format("<LEFT><BASEFONT COLOR=#FFFFFF>{0}</BASEFONT></LEFT>", "Bank Balance:"), false, false); int balance = Banker.GetBalance(from, m_Game.TypeOfCurrency); AddLabel(125, 200, balance + pokerplayer.Currency >= m_Game.Dealer.MinBuyIn ? 63 : 137, balance.ToString("#,0") + " " + (m_Game.Dealer.IsDonation ? "donation coins" : "gold")); AddHtml(34, 220, 100, 25, String.Format("<LEFT><BASEFONT COLOR=#FFFFFF>{0}</BASEFONT></LEFT>", "Current Chips:"), false, false); AddLabel(125, 220, 1258, pokerplayer.Currency.ToString("#,0") + " " + (m_Game.Dealer.IsDonation ? "donation coins" : "gold")); AddHtml(32, 240, 100, 25, String.Format("<LEFT><BASEFONT COLOR=#FFFFFF>{0}</BASEFONT></LEFT>", "Pending Credit:"), false, false); AddLabel(125, 240, 1258, pokerplayer.PendingCredit.ToString("#,0") + " " + (m_Game.Dealer.IsDonation ? "donation coins" : "gold")); AddHtml(31, 260, 100, 25, String.Format("<LEFT><BASEFONT COLOR=#FFFFFF>{0}</BASEFONT></LEFT>", "Buy-In Amount:"), false, false); AddImageTiled(125, 260, 80, 19, 0xBBC); AddAlphaRegion(125, 260, 80, 19); if (pokerplayer.Currency + pokerplayer.PendingCredit > m_Game.Dealer.MaxBuyIn) { AddTextEntry(128, 260, 77, 19, 99, (int)Handlers.txtBuyInAmount, 0.ToString()); } else { AddTextEntry(128, 260, 77, 19, 99, (int)Handlers.txtBuyInAmount, (m_Game.Dealer.MaxBuyIn - pokerplayer.Currency - pokerplayer.PendingCredit).ToString()); } AddButton(250, 260, 247, 248, (int)Handlers.btnOkay, GumpButtonType.Reply, 0); AddButton(320, 260, 242, 241, (int)Handlers.btnCancel, GumpButtonType.Reply, 0); }
private static void DiceCommand_OnCommand(CommandEventArgs e) { Mobile m = e.Mobile; int val = Banker.GetBalance(e.Mobile); //make sure user has enough gold in bank if (val >= GAME_BALANCE_MIN) { ds.ShowNewGameGump(m); } else { e.Mobile.SendMessage("Sorry, but you must have at least " + GAME_BALANCE_MIN + " gold in your bank to play!"); } }
private static void EventSink_Login(LoginEventArgs args) { int userCount = NetState.Instances.Count; int itemCount = World.Items.Count; int mobileCount = World.Mobiles.Count; Mobile m = args.Mobile; m.SendMessage("Welcome, {0}! There {1} currently {2} user{3} online, with {4} item{5} and {6} mobile{7} in the world.", args.Mobile.Name, userCount == 1 ? "is" : "are", userCount, userCount == 1 ? "" : "s", itemCount, itemCount == 1 ? "" : "s", mobileCount, mobileCount == 1 ? "" : "s"); PlayerMobile pm = (PlayerMobile)m; if (pm.OwesBackTaxes == true) { if (pm.City != null) { if (Banker.Withdraw(m, pm.BackTaxesAmount)) { m.SendMessage("You have paid your back taxes in full from the money in your bank account."); pm.City.CityTreasury += pm.BackTaxesAmount; pm.OwesBackTaxes = false; pm.BackTaxesAmount = 0; } else { int balance = Banker.GetBalance(m); if (Banker.Withdraw(m, balance)) { pm.City.CityTreasury += balance; pm.BackTaxesAmount -= 0; m.SendMessage("You have made a payment on your back taxes of {0} you now owe {1} in back taxes.", balance, pm.BackTaxesAmount); } } } else { pm.OwesBackTaxes = false; pm.BackTaxesAmount = 0; } } }
private bool SpendGold(int amount) { bool bought = (Owner.AccessLevel >= AccessLevel.GameMaster); bool fromBank = false; // Container cont = Owner.Backpack; if (!bought) { // if (cont.ConsumeTotal(typeof(Gold), amount)) // bought = true; if (Banker.GetBalance(Owner) >= amount) { bought = true; Withdraw(Owner, amount); // cont = Owner.FindBankNoCreate(); // if (cont != null && cont.ConsumeTotal(typeof(Gold), amount)) // { // bought = true; // fromBank = true; // } //else // { // Owner.SendLocalizedMessage(500192); // } } else { Owner.SendLocalizedMessage(500192); } } if (bought) { if (Owner.AccessLevel >= AccessLevel.GameMaster) { Owner.SendMessage("{0} gold would have been withdrawn from your bank if you were not a GM.", amount); } //else if (fromBank) else { Owner.SendMessage("The total of your purchase is {0} gold, which has been withdrawn from your bank account. My thanks for your patronage.", amount); } // else // Owner.SendMessage("The total of your purchase is {0} gold. My thanks for your patronage.", amount); } return(bought); }
public HairstylistBuyGump(Mobile from, Mobile vendor, HairstylistBuyInfo[] sellList) : base(50, 50) { m_From = from; m_Vendor = vendor; m_SellList = sellList; from.CloseGump <HairstylistBuyGump>(); from.CloseGump <ChangeHairHueGump>(); from.CloseGump <ChangeHairstyleGump>(); var isFemale = from.Female || from.Body.IsFemale; var balance = Banker.GetBalance(from); var canAfford = 0; for (var i = 0; i < sellList.Length; ++i) { if (balance >= sellList[i].Price && (!sellList[i].FacialHair || !isFemale)) { ++canAfford; } } AddPage(0); AddBackground(50, 10, 450, 100 + canAfford * 25, 2600); AddHtmlLocalized(100, 40, 350, 20, 1018356); // Choose your hairstyle change: var index = 0; for (var i = 0; i < sellList.Length; ++i) { if (balance >= sellList[i].Price && (!sellList[i].FacialHair || !isFemale)) { if (sellList[i].TitleString != null) { AddHtml(140, 75 + index * 25, 300, 20, sellList[i].TitleString); } else { AddHtmlLocalized(140, 75 + index * 25, 300, 20, sellList[i].Title); } AddButton(100, 75 + index++ *25, 4005, 4007, 1 + i); } } }
private void OnCounteroffer() { if (_CounterOffer <= 0) { User.SendMessage("Counteroffer amount must be more than nothing!"); Refresh(true); return; } if (_CounterOffer > MurderSystemController._HeadRansomCap) { _CounterOffer = MurderSystemController._HeadRansomCap; User.SendMessage( "There is a cap of {0:#,0} for the counteroffer! Please enter a lower number.", MurderSystemController._HeadRansomCap); Refresh(true); return; } Type cType = Head.Expansion == Expansion.T2A ? typeof(Silver) : typeof(Gold); int bal = Banker.GetBalance(User, cType); if (bal < _CounterOffer) { _CounterOffer = bal; User.SendMessage("You cannot afford this amount! Please make a new counteroffer."); Refresh(true); return; } new KillerReceiveOfferGump(_Killer, User, Head, _CounterOffer, _ReplyMessage).Send(); User.SendMessage("Your counteroffer request has been sent to {0}!", _Killer.RawName); LoggingCustom.Log( "MurdererNegotiate.txt", String.Format( "[Victim -> Killer][COUNTER][{0}]:\t[{1} -> {2}]\t[{3}]\t[{4:#,0} {5}]\t\"{6}\"", ServerTime.ShortDateTimeNow, User, _Killer, Head, _CounterOffer, cType.Name, _ReplyMessage)); }
private bool ChargePlayer(PlayerMobile p) { if (m_CostToRez > 0) { if (Banker.Withdraw(p, m_CostToRez)) { p.SendLocalizedMessage(1060398, m_CostToRez.ToString("N0")); // Amount charged p.SendLocalizedMessage(1060022, Banker.GetBalance(p).ToString("N0")); // Amount left, from bank } else { p.SendMessage("Unfortunately, you don't have enough gold in the bank to resurrect your pet."); return(false); } } return(true); }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; int buyInAmount = 0; if (info.ButtonID == 1) { int balance = Banker.GetBalance(from); if (balance >= m_Game.Dealer.MinBuyIn) { try { buyInAmount = Convert.ToInt32((info.TextEntries[0]).Text); } catch { from.SendMessage(0x22, "Use numbers without commas to input your buy-in amount (ie 25000)"); return; } if (buyInAmount <= balance && buyInAmount >= m_Game.Dealer.MinBuyIn && buyInAmount <= m_Game.Dealer.MaxBuyIn) { PokerPlayer player = new PokerPlayer(from); player.Gold = buyInAmount; m_Game.AddPlayer(player); } else { from.SendMessage(0x22, "You may not join with that amount of gold. Minimum buy-in: " + Convert.ToString(m_Game.Dealer.MinBuyIn) + ", Maximum buy-in: " + Convert.ToString(m_Game.Dealer.MaxBuyIn)); } } else { from.SendMessage(0x22, "You may not join with that amount of gold. Minimum buy-in: " + Convert.ToString(m_Game.Dealer.MinBuyIn) + ", Maximum buy-in: " + Convert.ToString(m_Game.Dealer.MaxBuyIn)); } } else if (info.ButtonID == 2) { return; } }
public override void OnDoubleClick(Mobile from) { if (!from.InRange(this.GetWorldLocation(), 2)) { return; } int val = Banker.GetBalance(from); //make sure user has enough gold in bank if (val >= GAME_BALANCE_MIN) { from.Frozen = true; ds.ShowNewGameGump(from); } else { from.SendMessage("Sorry, but you must have at least " + GAME_BALANCE_MIN + " gold in your bank to play!"); } }
public void MoveToTheNextRailroadDoublesRent() { banker = new Banker(players, 1500); var railroads = new List<RealEstate>(); var railroadRentStrategy = new RailroadRentStrategy(railroads); var readingRailroad = new RealEstate(banker, 200, 25, railroadRentStrategy); var pennsylvaniaRailroad = new RealEstate(banker, 200, 25, railroadRentStrategy); var bORailroad = new RealEstate(banker, 200, 25, railroadRentStrategy); var shortLineRailroad = new RealEstate(banker, 200, 25, railroadRentStrategy); railroads.AddRange(new[] { readingRailroad, pennsylvaniaRailroad, bORailroad, shortLineRailroad }); var spaces = new Dictionary<Int32, IBoardSpace> { { 5, readingRailroad }, { 15, pennsylvaniaRailroad }, { 25, bORailroad }, { 35, shortLineRailroad } }; var moveToNearestRailroad = new AdvanceToNearest(board, new[] { 5, 15, 25, 35 }, railroadRentStrategy); board.SetSpaces(spaces); board.MoveTo(player2, 15); board.MoveTo(player1, 7); var previousBalance = banker.GetBalance(player1); moveToNearestRailroad.Play(player1); Assert.That(banker.GetBalance(player1), Is.EqualTo(previousBalance - 50)); }
public void MoveToNearestGivesTheOwner10TimesDiceAmount() { banker = new Banker(players, 1500); board = boardFactory.Create(banker, players, dice, guard); var utilities = new List<RealEstate>(); var utilityRentStrategy = new UtilityRentStrategy(utilities, dice); var electric = new RealEstate(banker, 150, 0, utilityRentStrategy); var water = new RealEstate(banker, 150, 0, utilityRentStrategy); utilities.AddRange(new[] { electric, water }); var spaces = new Dictionary<Int32, IBoardSpace> { { 12, electric }, { 28, water } }; board.SetSpaces(spaces); board.MoveTo(player2, 12); board.MoveTo(player1, 7); var previousBalance = banker.GetBalance(player2); dice.SetNumberToRoll(new[] { 4, 1 }); dice.Roll(); var MoveToNearest = new AdvanceToNearest(board, new[] { 12, 28 }, utilityRentStrategy); MoveToNearest.Play(player1); Assert.That(banker.GetBalance(player2), Is.EqualTo(previousBalance + 50)); }