mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 03:55:18 -04:00
Cleanup /eco help.
This commit is contained in:
parent
f2f1889c60
commit
c197436b55
@ -30,11 +30,9 @@ namespace MCGalaxy.Commands {
|
||||
public override void Use(Player p, string message) {
|
||||
if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
|
||||
string[] parts = message.Split(' ');
|
||||
Item item = Economy.GetItem(parts[0]);
|
||||
if (item == null) { Help(p); return; }
|
||||
|
||||
foreach (Item item in Economy.Items)
|
||||
foreach (string alias in item.Aliases)
|
||||
{
|
||||
if (!parts[0].CaselessEq(alias)) continue;
|
||||
|
||||
if (!item.Enabled) {
|
||||
Player.Message(p, "%cThe {0} item is not currently buyable.", item.Name); return;
|
||||
@ -43,16 +41,13 @@ namespace MCGalaxy.Commands {
|
||||
Formatter.MessageNeedMinPerm(p, "purchase a " + item.Name, item.PurchaseRank); return;
|
||||
}
|
||||
item.OnBuyCommand(this, p, message, parts);
|
||||
return;
|
||||
}
|
||||
Help(p);
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "%T/buy [item] [value] <map name>");
|
||||
Player.Message(p, "%Hmap name is only used for %T/buy map%H.");
|
||||
Player.Message(p, "%HUse %T/store [item] %Hto see more information for an item.");
|
||||
Player.Message(p, "%H Available items: %f" + Economy.GetItemNames(", "));
|
||||
Player.Message(p, "%H Available items: %S" + Economy.GetItemNames());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,10 +16,8 @@
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
using MCGalaxy.Eco;
|
||||
using MCGalaxy.SQL;
|
||||
|
||||
namespace MCGalaxy.Commands {
|
||||
|
||||
/// <summary> Economy Beta v1.0 QuantumHive </summary>
|
||||
@ -44,38 +42,26 @@ namespace MCGalaxy.Commands {
|
||||
void HandleSetup(Player p, string[] args) {
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, "setup the economy."); return; }
|
||||
|
||||
switch (args[0].ToLower()) {
|
||||
case "apply":
|
||||
if (args[0].CaselessEq("apply")) {
|
||||
Economy.Load();
|
||||
Player.Message(p, "%aApplied changes");
|
||||
return;
|
||||
|
||||
case "enable":
|
||||
} else if (args[0].CaselessEq("enable")) {
|
||||
Player.Message(p, "%aThe economy system is now enabled");
|
||||
Economy.Enabled = true;
|
||||
Economy.Save(); return;
|
||||
|
||||
case "disable":
|
||||
Economy.Enabled = true; Economy.Save();
|
||||
} else if (args[0].CaselessEq("disable")) {
|
||||
Player.Message(p, "%aThe economy system is now disabled");
|
||||
Economy.Enabled = false;
|
||||
Economy.Save();return;
|
||||
|
||||
case "help":
|
||||
SetupHelp(p); return;
|
||||
|
||||
default:
|
||||
foreach (Item item in Economy.Items)
|
||||
foreach (string alias in item.Aliases)
|
||||
{
|
||||
if (args[0].CaselessEq(alias)) {
|
||||
Economy.Enabled = false; Economy.Save();
|
||||
} else if (args[0].CaselessEq("help")) {
|
||||
SetupHelp(p, args);
|
||||
} else {
|
||||
Item item = Economy.GetItem(args[0]);
|
||||
if (item != null) {
|
||||
item.OnSetupCommand(p, args);
|
||||
Economy.Save(); return;
|
||||
}
|
||||
}
|
||||
|
||||
if (args[1] == "") { SetupHelp(p); return; }
|
||||
if (args[1] == "") { SetupHelp(p, args); return; }
|
||||
Player.Message(p, "%cThat wasn't a valid command addition!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,21 +69,22 @@ namespace MCGalaxy.Commands {
|
||||
Player.Message(p, "%cMost commands have been removed from /economy, " +
|
||||
"use the appropriate command from %T/help economy %cinstead.");
|
||||
if (CheckExtraPerm(p)) {
|
||||
Player.Message(p, "%f/eco <type> %e- to setup economy");
|
||||
Player.Message(p, "%f/eco help %e- get more specific help for setting up the economy");
|
||||
Player.Message(p, "%T/eco <type> %H- to setup economy");
|
||||
Player.Message(p, "%T/eco help %H- get more specific help for setting up the economy");
|
||||
}
|
||||
}
|
||||
|
||||
void SetupHelp(Player p) {
|
||||
Player.Message(p, "%4/eco apply %e- reloads changes made to 'economy.properties'");
|
||||
Player.Message(p, "%4/eco [%aenable%4/%cdisable%4] %e- to enable/disable the economy system");
|
||||
Player.Message(p, "%4/eco [title/color/tcolor/rank/map] [%aenable%4/%cdisable%4] %e- to enable/disable that feature");
|
||||
Player.Message(p, "%4/eco [title/color/tcolor] [%3price%4] %e- to setup the prices for these features");
|
||||
Player.Message(p, "%4/eco rank price [%frank%4] [%3price%4] %e- to set the price for that rank");
|
||||
Player.Message(p, "%4/eco rank maxrank [%frank%4] %e- to set the max buyable rank");
|
||||
Player.Message(p, "%4/eco map new [%fname%4] [%fx%4] [%fy%4] [%fz%4] [%ftype%4] [%3price%4] %e- to setup a map preset");
|
||||
Player.Message(p, "%4/eco map delete [%fname%4] %e- to delete a map");
|
||||
Player.Message(p, "%4/eco map edit [%fname%4] [name/x/y/z/type/price] [%fvalue%4] %e- to edit a map preset");
|
||||
void SetupHelp(Player p, string[] args) {
|
||||
if (args[1] == "") {
|
||||
Player.Message(p, "%T/eco apply %H- Reload changes made to 'economy.properties'");
|
||||
Player.Message(p, "%T/eco enable/disable %H- Enables/disables the economy system");
|
||||
Player.Message(p, "%T/eco help [item] %H- Outputs help for setting up that item");
|
||||
Player.Message(p, " %HAll items: %S" + Economy.Items.Join(item => item.Name));
|
||||
} else {
|
||||
Item item = Economy.GetItem(args[1]);
|
||||
if (item == null) { Player.Message(p, "No item by that name, see %T/eco help %Sfor a list of items."); return; }
|
||||
item.OnSetupCommandHelp(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,29 +37,23 @@ namespace MCGalaxy.Commands {
|
||||
item.OnStoreOverview(p);
|
||||
}
|
||||
Player.Message(p, "%HUse %T/store [item] %Hto see more information about that item.");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
Item item = Economy.GetItem(message);
|
||||
if (item == null) { Help(p); return; }
|
||||
|
||||
foreach (Item item in Economy.Items)
|
||||
foreach (string alias in item.Aliases)
|
||||
{
|
||||
if (message.CaselessEq(alias)) {
|
||||
if (!item.Enabled) {
|
||||
Player.Message(p, "%cThe " + item.ShopName + " item is not currently buyable."); return;
|
||||
}
|
||||
item.OnStoreCommand(p);
|
||||
return;
|
||||
}
|
||||
}
|
||||
Help(p);
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "%T/store [item]");
|
||||
Player.Message(p, "%HViews information about the specific item, such as its cost.");
|
||||
Player.Message(p, "%T/store");
|
||||
Player.Message(p, "%HViews information about all enabled items.");
|
||||
Player.Message(p, "%H Available items: %f" + Economy.GetItemNames(", "));
|
||||
Player.Message(p, "%H Available items: %S" + Economy.GetItemNames());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -153,12 +153,16 @@ PRIMARY KEY(player)
|
||||
public static Item GetItem(string name) {
|
||||
foreach (Item item in Items) {
|
||||
if (name.CaselessEq(item.Name)) return item;
|
||||
|
||||
foreach (string alias in item.Aliases) {
|
||||
if (name.CaselessEq(alias)) return item;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static string GetItemNames(string separator) {
|
||||
string items = Items.Join(x => x.Enabled ? x.ShopName : null, separator);
|
||||
public static string GetItemNames() {
|
||||
string items = Items.Join(x => x.Enabled ? x.ShopName : null);
|
||||
return items.Length == 0 ? "(no enabled items)" : items;
|
||||
}
|
||||
|
||||
|
@ -71,6 +71,13 @@ namespace MCGalaxy.Eco {
|
||||
|
||||
protected internal abstract void OnSetupCommandOther(Player p, string[] args);
|
||||
|
||||
protected internal virtual void OnSetupCommandHelp(Player p) {
|
||||
Player.Message(p, "%T/eco {0} enable/disable", Name.ToLower());
|
||||
Player.Message(p, "%HEnables/disables purchasing this item.");
|
||||
Player.Message(p, "%T/eco {0} purchaserank [rank]", Name.ToLower());
|
||||
Player.Message(p, "%HSets the lowest rank which can purchase this item.");
|
||||
}
|
||||
|
||||
protected internal abstract void OnStoreOverview(Player p);
|
||||
|
||||
protected internal abstract void OnStoreCommand(Player p);
|
||||
@ -125,6 +132,12 @@ namespace MCGalaxy.Eco {
|
||||
}
|
||||
}
|
||||
|
||||
protected internal override void OnSetupCommandHelp(Player p) {
|
||||
base.OnSetupCommandHelp(p);
|
||||
Player.Message(p, "%T/eco {0} price [amount]", Name.ToLower());
|
||||
Player.Message(p, "%HSets how many &3{0} %Hthis item costs.", Server.moneys);
|
||||
}
|
||||
|
||||
protected internal override void OnStoreOverview(Player p) {
|
||||
if (p == null || p.Rank >= PurchaseRank) {
|
||||
Player.Message(p, "{0} - costs &f{1} &3{2}", Name, Price, Server.moneys);
|
||||
|
@ -204,17 +204,24 @@ namespace MCGalaxy.Eco {
|
||||
break;
|
||||
|
||||
default:
|
||||
Player.Message(p, "%cThat wasn't a valid command addition!");
|
||||
Player.Message(p, "Supported properties to edit: name, title, x, y, z, type, price");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
Player.Message(p, "%cThat wasn't a valid command addition!");
|
||||
break;
|
||||
OnSetupCommandHelp(p); break;
|
||||
}
|
||||
}
|
||||
|
||||
protected internal override void OnSetupCommandHelp(Player p) {
|
||||
base.OnSetupCommandHelp(p);
|
||||
Player.Message(p, "%T/eco level add [name] [x] [y] [z] [type] [price]");
|
||||
Player.Message(p, "%T/eco level remove [name]");
|
||||
Player.Message(p, "%T/eco level edit [name] [name/x/y/z/type/price] [value]");
|
||||
Player.Message(p, "%HAdds, removes, or edits a level preset.");
|
||||
}
|
||||
|
||||
protected internal override void OnStoreOverview(Player p) {
|
||||
Player.Message(p, "Maps - see /store maps");
|
||||
}
|
||||
|
@ -110,10 +110,18 @@ namespace MCGalaxy.Eco {
|
||||
UpdatePrices();
|
||||
break;
|
||||
default:
|
||||
Player.Message(p, "Supported actions: enable, disable, price [rank] [cost], maxrank [rank]"); break;
|
||||
OnSetupCommandHelp(p); break;
|
||||
}
|
||||
}
|
||||
|
||||
protected internal override void OnSetupCommandHelp(Player p) {
|
||||
base.OnSetupCommandHelp(p);
|
||||
Player.Message(p, "%T/eco rank price [rank] [amount]");
|
||||
Player.Message(p, "%HSets how many &3{0} %Hthat rank costs.", Server.moneys);
|
||||
Player.Message(p, "%T/eco rank maxrank [rank]");
|
||||
Player.Message(p, "%HSets the maximum rank that can be bought.", Server.moneys);
|
||||
}
|
||||
|
||||
protected internal override void OnStoreOverview(Player p) {
|
||||
Group maxrank = Group.Find(MaxRank);
|
||||
if (p == null || p.Rank >= maxrank.Permission) {
|
||||
|
@ -61,7 +61,7 @@ namespace MCGalaxy.Games {
|
||||
|
||||
p.Game.BlocksLeft--;
|
||||
if ((p.Game.BlocksLeft % 10) == 0 || (p.Game.BlocksLeft >= 0 && p.Game.BlocksLeft <= 10))
|
||||
p.SendMessage("Blocks Left: " + Colors.maroon + p.Game.BlocksLeft);
|
||||
p.SendMessage("Blocks Left: &4" + p.Game.BlocksLeft);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user