mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-26 14:54:12 -04:00
Combine /eco stats into /money, rename /money to /balance (with the shortcut of /money still)
This commit is contained in:
parent
9b645b6e0d
commit
c76d8edb82
@ -47,6 +47,7 @@ namespace MCGalaxy.Commands {
|
||||
new CommandKeywords((new CmdAward()), "reward trophy price");
|
||||
new CommandKeywords((new CmdAwards()), "price list trophy info");
|
||||
new CommandKeywords((new CmdAwardMod()), "trophy add del price");
|
||||
new CommandKeywords((new CmdBalance()), "cash " + Server.moneys);
|
||||
new CommandKeywords((new CmdBan()), "kick mod punish");
|
||||
new CommandKeywords((new CmdBanEdit()), "reason edit ban");
|
||||
new CommandKeywords((new CmdBaninfo()), "info ban details");
|
||||
@ -147,7 +148,6 @@ namespace MCGalaxy.Commands {
|
||||
new CommandKeywords((new CmdMissile()), "gun missil");
|
||||
new CommandKeywords((new CmdMode()), "block place");
|
||||
new CommandKeywords((new CmdModerate()), "chat enable disable allow disallow");
|
||||
new CommandKeywords((new CmdMoney()), "cash " + Server.moneys);
|
||||
new CommandKeywords((new CmdMove()), "player pos");
|
||||
new CommandKeywords((new CmdMoveAll()), "move all player pos");
|
||||
new CommandKeywords((new CmdMuseum()), "musea map lvl level");
|
||||
|
69
Commands/Economy/CmdBalance.cs
Normal file
69
Commands/Economy/CmdBalance.cs
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
Copyright 2011 MCForge
|
||||
|
||||
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||
not use this file except in compliance with the Licenses. You may
|
||||
obtain a copy of the Licenses at
|
||||
|
||||
http://www.opensource.org/licenses/ecl2.php
|
||||
http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the Licenses are distributed on an "AS IS"
|
||||
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
or implied. See the Licenses for the specific language governing
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
using System;
|
||||
|
||||
namespace MCGalaxy.Commands {
|
||||
|
||||
public sealed class CmdBalance : Command {
|
||||
|
||||
public override string name { get { return "balance"; } }
|
||||
public override string shortcut { get { return "money"; } }
|
||||
public override string type { get { return CommandTypes.Economy; } }
|
||||
public override bool museumUsable { get { return true; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
Economy.EcoStats ecos;
|
||||
if (p == null && message == "") {
|
||||
Player.SendMessage(p, "You must provide a name when using the command from console."); return;
|
||||
}
|
||||
|
||||
if (message != "") {
|
||||
Player who = PlayerInfo.Find(message);
|
||||
if (who == null) {
|
||||
ecos = Economy.RetrieveEcoStats(message);
|
||||
Player.SendMessage(p, "%3===Economy stats for: %f" + ecos.playerName + "%7(offline)%3===");
|
||||
} else {
|
||||
ecos = Economy.RetrieveEcoStats(who.name);
|
||||
Player.SendMessage(p, "%3===Economy stats for: " + who.color + who.name + "%3===");
|
||||
}
|
||||
} else {
|
||||
ecos = Economy.RetrieveEcoStats(p.name);
|
||||
Player.SendMessage(p, "%3===Economy stats for: " + p.color + p.name + "%3===");
|
||||
}
|
||||
|
||||
Player.SendMessage(p, "Current balance: %f" + ecos.money + " %3" + Server.moneys);
|
||||
Player.SendMessage(p, "Total spent: %f" + ecos.totalSpent + " %3" + Server.moneys);
|
||||
if (!String.IsNullOrEmpty(ecos.purchase))
|
||||
Player.SendMessage(p, "Last purchase: " + ecos.purchase);
|
||||
if (!String.IsNullOrEmpty(ecos.payment))
|
||||
Player.SendMessage(p, "Last payment: " + ecos.payment);
|
||||
if (!String.IsNullOrEmpty(ecos.salary))
|
||||
Player.SendMessage(p, "Last receipt: " + ecos.salary);
|
||||
if (!String.IsNullOrEmpty(ecos.fine))
|
||||
Player.SendMessage(p, "Last fine: " + ecos.fine);
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
Player.SendMessage(p, "%T/balance <player>");
|
||||
Player.SendMessage(p, "%HShows how much %3" + Server.moneys + " %H<player> has, " +
|
||||
"plus their most recent transactions.");
|
||||
Player.SendMessage(p, "%HIf <player> is not given, shows how much %3" + Server.moneys + " %Hyou have.");
|
||||
}
|
||||
}
|
||||
}
|
@ -38,18 +38,10 @@ namespace MCGalaxy.Commands {
|
||||
for (int i = 0; i < raw.Length; i++)
|
||||
args[i] = i < 2 ? raw[i].ToLower() : raw[i];
|
||||
|
||||
switch (args[0]) {
|
||||
case "setup":
|
||||
HandleSetup(p, message, args); break;
|
||||
case "stats":
|
||||
case "balance":
|
||||
case "amount":
|
||||
HandleStats(p, message, args); break;
|
||||
case "help":
|
||||
HandleHelp(p, message, args); break;
|
||||
default:
|
||||
Help(p); break;
|
||||
}
|
||||
if (args[0] == "setup")
|
||||
HandleSetup(p, message, args);
|
||||
else
|
||||
Help(p);
|
||||
}
|
||||
|
||||
void HandleSetup(Player p, string message, string[] args) {
|
||||
@ -304,6 +296,9 @@ namespace MCGalaxy.Commands {
|
||||
if (!Economy.Settings.Enabled) { Player.SendMessage(p, "%cThe economy system is already disabled"); return; }
|
||||
else { Economy.Settings.Enabled = false; Player.SendMessage(p, "%aThe economy system is now disabled"); return; }
|
||||
|
||||
case "help":
|
||||
SetupHelp(p); return;
|
||||
|
||||
default:
|
||||
if (args[1] == "") { SetupHelp(p); return; }
|
||||
Player.SendMessage(p, "%cThat wasn't a valid command addition!");
|
||||
@ -312,88 +307,16 @@ namespace MCGalaxy.Commands {
|
||||
Economy.Save();
|
||||
}
|
||||
|
||||
void HandleStats(Player p, string message, string[] args) {
|
||||
Economy.EcoStats ecostats;
|
||||
if (p == null && args[1] == "") {
|
||||
Player.SendMessage(p, "You must provide a name when using the command from console."); return;
|
||||
}
|
||||
|
||||
if (args[1] != "") {
|
||||
Player who = PlayerInfo.Find(args[1]);
|
||||
if (who == null) {
|
||||
ecostats = Economy.RetrieveEcoStats(args[1]);
|
||||
Player.SendMessage(p, "%3===Economy stats for: %f" + ecostats.playerName + "%7(offline)%3===");
|
||||
} else {
|
||||
ecostats = Economy.RetrieveEcoStats(who.name);
|
||||
Player.SendMessage(p, "%3===Economy stats for: " + who.color + who.name + "%3===");
|
||||
}
|
||||
} else {
|
||||
ecostats = Economy.RetrieveEcoStats(p.name);
|
||||
Player.SendMessage(p, "%3===Economy stats for: " + p.color + p.name + "%3===");
|
||||
}
|
||||
|
||||
Player.SendMessage(p, "Balance: %f" + ecostats.money + " %3" + Server.moneys);
|
||||
Player.SendMessage(p, "Total spent: %f" + ecostats.totalSpent + " %3" + Server.moneys);
|
||||
Player.SendMessage(p, "Recent purchase: " + ecostats.purchase);
|
||||
Player.SendMessage(p, "Recent payment: " + ecostats.payment);
|
||||
Player.SendMessage(p, "Recent receivement: " + ecostats.salary);
|
||||
Player.SendMessage(p, "Recent fine: " + ecostats.fine);
|
||||
}
|
||||
|
||||
void HandleHelp(Player p, string message, string[] args) {
|
||||
switch (args[1]) {
|
||||
case "":
|
||||
Help(p);
|
||||
return;
|
||||
|
||||
case "buy":
|
||||
Player.SendMessage(p, "%3===Economy Help: Buy===");
|
||||
Player.SendMessage(p, "Buying titles: %f/eco buy title [title_name]");
|
||||
Player.SendMessage(p, "Buying colors: %f/eco buy color [color]");
|
||||
Player.SendMessage(p, "Buying titlecolors: %f/eco buy tcolor [color]");
|
||||
Player.SendMessage(p, "Buying ranks: %f/eco buy the NEXT rank");
|
||||
Player.SendMessage(p, "%7Check out the ranks and their prices with: %f/eco info rank");
|
||||
Player.SendMessage(p, "Buy your own maps: %f/eco buy map [map_preset_name] [custom_map_name]");
|
||||
Player.SendMessage(p, "%7Check out the map presets with: %f/eco info map");
|
||||
return;
|
||||
|
||||
case "stats":
|
||||
case "balance":
|
||||
case "amount":
|
||||
Player.SendMessage(p, "%3===Economy Help: Stats===");
|
||||
Player.SendMessage(p, "Check your stats: %f/eco stats");
|
||||
Player.SendMessage(p, "Check the stats of a player: %f/eco stats [player_name]");
|
||||
return;
|
||||
|
||||
case "info":
|
||||
case "about":
|
||||
Player.SendMessage(p, "%3===Economy Help: Info===");
|
||||
Player.SendMessage(p, "To get info and prices about features: %f/eco info [color/title/titlecolor/rank/map]");
|
||||
return;
|
||||
|
||||
case "setup":
|
||||
if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this)) {
|
||||
SetupHelp(p); return;
|
||||
} else { Player.SendMessage(p, "%cYou are not allowed to use %f/eco help setup"); return; }
|
||||
|
||||
default:
|
||||
Player.SendMessage(p, "%cThat wasn't a valid command addition, sending you to help");
|
||||
Help(p); return;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
Player.SendMessage(p, "%3===Welcome to the Economy Help Menu===");
|
||||
Player.SendMessage(p, "%f/eco stats [%aplayer%f] %e- view ecostats about yourself or [player]");
|
||||
Player.SendMessage(p, "%f/eco info <title/color/tcolor/rank/map> %e- view information about buying the specific feature");
|
||||
Player.SendMessage(p, "%cMost commands have been removed from /economy, " +
|
||||
"use the appropriate command from %T/help economy %cinstead.");
|
||||
if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this)) {
|
||||
Player.SendMessage(p, "%f/eco setup <type> %e- to setup economy");
|
||||
Player.SendMessage(p, "%f/eco help <buy/stats/info/setup> %e- get more specific help");
|
||||
} else { Player.SendMessage(p, "%f/eco help <buy/stats/info> %e- get more specific help"); }
|
||||
Player.SendMessage(p, "%f/eco setup help %e- get more specific help for setting up the economy");
|
||||
}
|
||||
}
|
||||
|
||||
void SetupHelp(Player p) {
|
||||
Player.SendMessage(p, "%3===Economy Setup Help Menu===");
|
||||
if (p == null || p.name == Server.server_owner) {
|
||||
Player.SendMessage(p, "%4/eco setup apply %e- applies the changes made to 'economy.properties'");
|
||||
}
|
||||
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
Copyright 2011 MCForge
|
||||
|
||||
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||
not use this file except in compliance with the Licenses. You may
|
||||
obtain a copy of the Licenses at
|
||||
|
||||
http://www.opensource.org/licenses/ecl2.php
|
||||
http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the Licenses are distributed on an "AS IS"
|
||||
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
or implied. See the Licenses for the specific language governing
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
using System;
|
||||
|
||||
namespace MCGalaxy.Commands {
|
||||
|
||||
public sealed class CmdMoney : Command {
|
||||
|
||||
public override string name { get { return "money"; } }
|
||||
public override string shortcut { get { return ""; } }
|
||||
public override string type { get { return CommandTypes.Economy; } }
|
||||
public override bool museumUsable { get { return true; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
if (message == "") {
|
||||
if (p != null) Player.SendMessage(p, "You currently have %f" + p.money + " %3" + Server.moneys);
|
||||
else Player.SendMessage(p, "You must provide a player name when using this command from console.");
|
||||
return;
|
||||
}
|
||||
|
||||
Player who = PlayerInfo.Find(message);
|
||||
if (who == null) {
|
||||
Economy.EcoStats ecos = Economy.RetrieveEcoStats(message);
|
||||
Player.SendMessage(p, ecos.playerName + "(%foffline%S) currently has %f" + ecos.money + " %3" + Server.moneys);
|
||||
} else {
|
||||
Player.SendMessage(p, who.FullName + " %Scurrently has %f" + who.money + " %3" + Server.moneys);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
Player.SendMessage(p, "%T/money <player>");
|
||||
Player.SendMessage(p, "%HShows how much %3" + Server.moneys + " %H<player> has.");
|
||||
Player.SendMessage(p, "%HIf <player> is not given, shows how much %3" + Server.moneys + " %Hyou have.");
|
||||
}
|
||||
}
|
||||
}
|
@ -171,7 +171,7 @@
|
||||
<Compile Include="Commands\Economy\CmdEconomy.cs" />
|
||||
<Compile Include="Commands\Economy\CmdFakePay.cs" />
|
||||
<Compile Include="Commands\Economy\CmdGive.cs" />
|
||||
<Compile Include="Commands\Economy\CmdMoney.cs" />
|
||||
<Compile Include="Commands\Economy\CmdBalance.cs" />
|
||||
<Compile Include="Commands\Economy\CmdPay.cs" />
|
||||
<Compile Include="Commands\Economy\CmdStore.cs" />
|
||||
<Compile Include="Commands\Economy\CmdTake.cs" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user