public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; switch (info.ButtonID) { case 1: { try { TextRelay getTehText = info.GetTextEntry(0); m_Amount = Convert.ToInt32(getTehText.Text); } catch { m_Victim.SendMessage("Bounty Amount was improperly formatted!"); m_Victim.SendGump(new BountyGump(m_Victim, m_Killer)); break; } Container cont = m_Victim.BankBox; if (m_Amount < 500) { m_Victim.SendMessage("No one would hunt for that low of a bounty!"); m_Victim.SendGump(new BountyGump(m_Victim, m_Killer)); break; } else if (cont != null && cont.ConsumeTotal(typeof(Gold), m_Amount)) { BountyKeeper.Add(new Bounty((PlayerMobile)m_Victim, (PlayerMobile)m_Killer, m_Amount, true)); m_Victim.SendMessage("You have posted a bounty for the head of " + m_Killer.Name + "!"); m_Victim.SendMessage("Amount of GP removed from your bank: " + m_Amount); } else { m_Victim.SendMessage("You do not have that much GP in your bank!"); m_Victim.SendGump(new BountyGump(m_Victim, m_Killer)); break; } break; } case 2: { m_Victim.SendMessage("You decide not to post a bounty."); break; } } }
public override void Execute(CommandEventArgs e, object obj) { Mobile m = (Mobile)obj; //CommandLogging.WriteLine( e.Mobile, "{0} {1} {2} {3}", e.Mobile.AccessLevel, CommandLogging.Format( e.Mobile ), m_Value ? "hiding" : "unhiding", CommandLogging.Format( m ) ); if (e.Length == 1) { if ((m is PlayerMobile) && (m.AccessLevel == AccessLevel.Player)) // Can't put bounty on staff. { PlayerMobile bountyPlacer = (PlayerMobile)e.Mobile; Container cont = bountyPlacer.BankBox; int amount = 0; try { amount = Int32.Parse(e.GetString(0)); } catch { AddResponse("Bounty Amount was improperly formatted!"); return; } if (amount < 500) { AddResponse("No one would hunt for that low of a bounty!"); } else if (cont != null && cont.ConsumeTotal(typeof(Gold), amount)) { BountyKeeper.Add(new Bounty(bountyPlacer, (PlayerMobile)m, amount, false)); AddResponse("You have posted a bounty for the head of " + m.Name + "!"); AddResponse("Amount of GP removed from your bank: " + amount); ((PlayerMobile)m).SendMessage(bountyPlacer.Name + " has just placed a bounty on your head for " + amount + " gold."); //Flag player criminal, but don't guardwhack //bountyPlacer.Criminal = true; //Flag to only the player you place the bounty on. if (!bountyPlacer.PermaFlags.Contains(m)) { bountyPlacer.PermaFlags.Add(m); bountyPlacer.Delta(MobileDelta.Noto); ExpireTimer et = new ExpireTimer(bountyPlacer, m, TimeSpan.FromMinutes(2.0)); et.Start(); } } else { AddResponse("You do not have that much GP in your bank!"); } } else { AddResponse("Please target a player."); } } else { AddResponse("You must specify the amount of the bounty."); } }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; switch (info.ButtonID) { case 1: { try { TextRelay getTehText = info.GetTextEntry(0); m_Amount = Convert.ToInt32(getTehText.Text); } catch { m_Victim.SendMessage("Bounty Amount was improperly formatted!"); m_Victim.SendGump(new BountyGump(m_Victim, m_Killer)); break; } Container cont = m_Victim.BankBox; if (m_Amount < 500) { m_Victim.SendMessage("No one would hunt for that low of a bounty!"); m_Victim.SendGump(new BountyGump(m_Victim, m_Killer)); break; } else if (cont != null && cont.ConsumeTotal(typeof(Gold), m_Amount)) { int bountyAmount = m_Amount % 10000; int murderCounts = m_Amount / 10000; bool GuardsAcceptBribe = true; // don't allow the adding additional murder counts if we're not talking about a *real* murderer if (m_Killer.Murderer == false) { bountyAmount = m_Amount; murderCounts = 0; GuardsAcceptBribe = false; } if (bountyAmount > 0) { BountyKeeper.Add(new Bounty((PlayerMobile)m_Victim, (PlayerMobile)m_Killer, bountyAmount, true)); m_Victim.SendMessage("You have posted a bounty for the head of " + m_Killer.Name + "!"); m_Killer.SendMessage("{0} has placed a bounty on your head!", m_Victim.Name); } if (murderCounts > 0) { m_Victim.SendMessage("{0}'s sentence has been increased by {1} term{2}.", m_Killer.Name, murderCounts, murderCounts == 1 ? "" : "s"); m_Killer.SendMessage("{0} bribed the court and your sentence has been increased by {1} term{2}.", m_Victim.Name, murderCounts, murderCounts == 1 ? "" : "s"); m_Killer.ShortTermMurders += murderCounts; m_Killer.LongTermMurders += murderCounts; LogHelper Logger = new LogHelper("BountySystem.log", false, true); Logger.Log(LogType.Mobile, m_Killer, string.Format("STM before {0}, STM after {1}, LTM before {2}, LTM after {3}", m_Killer.ShortTermMurders - murderCounts, m_Killer.ShortTermMurders, m_Killer.LongTermMurders - murderCounts, m_Killer.LongTermMurders)); Logger.Finish(); } if (GuardsAcceptBribe == false) { m_Victim.SendMessage("The Angel Island Prison guards refuse your bribe."); } m_Victim.SendMessage("A total of {0} GP has been removed from your bank.", m_Amount); } else { m_Victim.SendMessage("You do not have that much GP in your bank!"); m_Victim.SendGump(new BountyGump(m_Victim, m_Killer)); break; } break; } case 2: { m_Victim.SendMessage("You decide not to post a bounty."); break; } } }