#W# Reworking Inn rooms.
This commit is contained in:
parent
7104f56ebf
commit
66eafd3451
15 changed files with 918 additions and 576 deletions
49
Scripts/Commands/CheckBalance.cs
Normal file
49
Scripts/Commands/CheckBalance.cs
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Commands;
|
||||
using Server.Mobiles;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Custom.Commands
|
||||
{
|
||||
public class CheckBalance
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
CommandSystem.Register("CheckBalance", AccessLevel.GameMaster, new CommandEventHandler(CheckBalance_OnCommand));
|
||||
}
|
||||
|
||||
[Usage("CheckBalance")]
|
||||
[Description("Checks the true Banker balance (including AccountGold) of a targeted player.")]
|
||||
public static void CheckBalance_OnCommand(CommandEventArgs e)
|
||||
{
|
||||
e.Mobile.Target = new BalanceTarget();
|
||||
e.Mobile.SendMessage(68, "Target a player to check their total bank balance.");
|
||||
}
|
||||
|
||||
private class BalanceTarget : Target
|
||||
{
|
||||
// The '-1' means standard range, 'false' means it doesn't allow ground targeting
|
||||
public BalanceTarget() : base(-1, false, TargetFlags.None)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (targeted is PlayerMobile)
|
||||
{
|
||||
PlayerMobile pm = (PlayerMobile)targeted;
|
||||
|
||||
// Banker.GetBalance checks both AccountGold AND physical bank gold
|
||||
long balance = Banker.GetBalance(pm);
|
||||
|
||||
from.SendMessage(68, $"{pm.Name} has a true bank balance of: {balance} gold.");
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage(33, "You must target a player character.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue