AvatarsConquest/Scripts/Commands/Player/Status.cs

104 lines
3.1 KiB
C#

using System;
using Server;
using Server.Commands;
using Server.Gumps;
using Server.Mobiles;
using Server.Network;
namespace Server.Scripts.Commands
{
// ------- STATUS COMMAND REGISTRATION START
public class StatusCommand
{
public static void Initialize()
{
// Registered at Player access level so everyone can use it
CommandSystem.Register("Status", AccessLevel.Player, new CommandEventHandler(StatusCommand_OnCommand));
}
[Usage("Status")]
[Description("Opens a gump displaying detailed character status.")]
private static void StatusCommand_OnCommand(CommandEventArgs e)
{
Mobile m = e.Mobile;
if (m is PlayerMobile)
{
// Closes any existing status gump to prevent spamming duplicates
m.CloseGump(typeof(StatusGump));
m.SendGump(new StatusGump((PlayerMobile)m));
}
}
}
// ------- STATUS COMMAND REGISTRATION END
}
namespace Server.Gumps
{
// ------- STATUS GUMP UI START
public class StatusGump : Gump
{
public StatusGump(PlayerMobile pm) : base(50, 50)
{
this.Closable = true;
this.Disposable = true;
this.Dragable = true;
this.Resizable = false;
AddPage(0);
// Modern semi-transparent background (expanded height to 375 to fit Stat Cap)
AddBackground(0, 0, 300, 375, 9270);
AddAlphaRegion(10, 10, 280, 355);
// Gump Title
AddLabel(75, 15, 1153, "CHARACTER STATUS");
int y = 55;
int spacing = 25;
// --- ATTRIBUTES START ---
AddLabel(20, y, 1153, "Attributes");
y += spacing;
// Displays player's total stat cap limit
AddLabel(30, y, 1152, String.Format("Stat Cap: {0}", pm.StatCap));
y += spacing;
// Displays Raw Stat / Total Stat (including modifiers from spells/gear)
AddLabel(30, y, 1152, String.Format("Strength: {0} / {1}", pm.RawStr, pm.Str));
y += spacing;
AddLabel(30, y, 1152, String.Format("Dexterity: {0} / {1}", pm.RawDex, pm.Dex));
y += spacing;
AddLabel(30, y, 1152, String.Format("Intelligence: {0} / {1}", pm.RawInt, pm.Int));
y += spacing + 10;
// --- ATTRIBUTES END ---
// --- REPUTATION START ---
AddLabel(20, y, 1153, "Reputation");
y += spacing;
AddLabel(30, y, 1152, String.Format("Fame: {0}", pm.Fame));
y += spacing;
AddLabel(30, y, 1152, String.Format("Karma: {0}", pm.Karma));
y += spacing + 10;
// --- REPUTATION END ---
// --- SURVIVAL NEEDS START ---
AddLabel(20, y, 1153, "Survival Needs");
y += spacing;
AddLabel(30, y, 1152, String.Format("Hunger: {0}", pm.Hunger));
y += spacing;
AddLabel(30, y, 1152, String.Format("Thirst: {0}", pm.Thirst));
// --- SURVIVAL NEEDS END ---
}
}
// ------- STATUS GUMP UI END
}