Permalink
Browse files

Update Translations for shop command and update to Rocket 3.9.1.0

  • Loading branch information...
1 parent 13f236d commit d6fc26d177b7e52a6f3b999423c68f781acd8ab9 @Zamirathe Zamirathe committed May 9, 2015
@@ -27,7 +27,7 @@ public string Help
}
}
- public void Execute(RocketPlayer playerid, string msg)
+ public void Execute(RocketPlayer playerid, string[] msg)
{
UconomyBasicShop.Instance.Buy(playerid, msg);
}
@@ -32,7 +32,7 @@ public string Help
}
}
- public void Execute(RocketPlayer playerid, string msg)
+ public void Execute(RocketPlayer playerid, string[] msg)
{
UconomyBasicShop.Instance.Cost(playerid, msg);
}
@@ -27,7 +27,7 @@ public string Help
}
}
- public void Execute(RocketPlayer playerid, string msg)
+ public void Execute(RocketPlayer playerid, string[] msg)
{
UconomyBasicShop.Instance.Sell(playerid, msg);
}
@@ -32,7 +32,7 @@ public string Help
}
}
- public void Execute(RocketPlayer playerid, string msg)
+ public void Execute(RocketPlayer playerid, string[] msg)
{
bool console = (playerid == null) ? true : false;
string[] permnames = { "shop.*", "shop.add", "shop.rem", "shop.chng", "shop.buy" };
@@ -89,47 +89,46 @@ public void Execute(RocketPlayer playerid, string msg)
RocketChatManager.Say(playerid, "You don't have permission to use the /shop command.");
return;
}
- if (string.IsNullOrEmpty(msg))
+ if (msg.Length == 0)
{
- message = "Usage: /shop <add/rem/chng/buy>/[v.]<itemid>/<cost> <cost> is not required for rem, buy is only for items.";
+ message = UconomyBasicShop.Instance.Translate("shop_command_usage", new object[] {});
// We are going to print how to use
this.sendMessage(playerid, message, console);
return;
}
- string[] command = Parser.getComponentsFromSerial(msg, '/');
- if (command.Length < 2)
+ if (msg.Length < 2)
{
- message = "An itemid is required.";
+ message = UconomyBasicShop.Instance.Translate("no_itemid_given", new object[] {});
this.sendMessage(playerid, message, console);
return;
}
- if (command.Length == 2 && command[0] != "rem")
+ if (msg.Length == 2 && msg[0] != "rem")
{
- message = "A cost is required.";
+ message = UconomyBasicShop.Instance.Translate("no_cost_given", new object[] { });
this.sendMessage(playerid, message, console);
return;
}
- else if (command.Length >= 2)
+ else if (msg.Length >= 2)
{
- string[] type = Parser.getComponentsFromSerial(command[1], '.');
+ string[] type = Parser.getComponentsFromSerial(msg[1], '.');
if (type.Length > 1 && type[0] != "v")
{
- message = "You must specify v for vehicle or just an item id. Ex. /shop rem/101";
+ message = UconomyBasicShop.Instance.Translate("v_not_provided", new object[] { });
this.sendMessage(playerid, message, console);
return;
}
ushort id;
if (type.Length > 1)
{
if (!ushort.TryParse(type[1], out id)) {
- message = "You need to provide an item or vehicle id.";
+ message = UconomyBasicShop.Instance.Translate("invalid_id_given", new object[] { });
this.sendMessage(playerid, message, console);
return;
}
} else {
if (!ushort.TryParse(type[0], out id))
{
- message = "You need to provide an item or vehicle id.";
+ message = UconomyBasicShop.Instance.Translate("invalid_id_given", new object[] { });
this.sendMessage(playerid, message, console);
return;
}
@@ -138,12 +137,12 @@ public void Execute(RocketPlayer playerid, string msg)
bool success = false;
bool change = false;
bool pass = false;
- switch (command[0])
+ switch (msg[0])
{
case "chng":
if (!perms[3] && !perms[0])
{
- message = "You don't have permission to use the shop chng command.";
+ message = UconomyBasicShop.Instance.Translate("no_permission_shop_chng", new object[] { });
this.sendMessage(playerid, message, console);
return;
}
@@ -155,31 +154,39 @@ public void Execute(RocketPlayer playerid, string msg)
{
if (!perms[1] && !perms[0])
{
- message = "You don't have permission to use the shop add command.";
+ message = UconomyBasicShop.Instance.Translate("no_permission_shop_add", new object[] { });
this.sendMessage(playerid, message, console);
return;
}
}
- string ac = (pass) ? "changed" : "added";
+ string ac = (pass) ? UconomyBasicShop.Instance.Translate("changed", new object[] { }) : UconomyBasicShop.Instance.Translate("added", new object[] { });
switch (type[0])
{
case "v":
VehicleAsset va = (VehicleAsset)Assets.find(EAssetType.Vehicle, id);
- message = "You have " + ac + " the " + va.Name + " with cost " + command[2] + " to the shop.";
- success = UconomyBasicShop.Instance.ShopDB.AddVehicle((int)id, va.Name, decimal.Parse(command[2]), change);
+ message = UconomyBasicShop.Instance.Translate("changed_or_added_to_shop", new object[] {
+ ac,
+ va.Name,
+ msg[2]
+ });
+ success = UconomyBasicShop.Instance.ShopDB.AddVehicle((int)id, va.Name, decimal.Parse(msg[2]), change);
if (!success)
{
- message = "There was an error adding/changing " + va.Name + "!";
+ message = UconomyBasicShop.Instance.Translate("error_adding_or_changing", new object[] { va.Name });
}
this.sendMessage(playerid, message, console);
break;
default:
ItemAsset ia = (ItemAsset)Assets.find(EAssetType.Item, id);
- message = "You have " + ac + " the " + ia.Name + " with cost " + command[2] + " to the shop.";
- success = UconomyBasicShop.Instance.ShopDB.AddItem((int)id, ia.Name, decimal.Parse(command[2]), change);
+ message = UconomyBasicShop.Instance.Translate("changed_or_added_to_shop", new object[] {
+ ac,
+ ia.Name,
+ msg[2]
+ });
+ success = UconomyBasicShop.Instance.ShopDB.AddItem((int)id, ia.Name, decimal.Parse(msg[2]), change);
if (!success)
{
- message = "There was an error adding/changing " + ia.Name + "!";
+ message = UconomyBasicShop.Instance.Translate("error_adding_or_changing", new object[] { ia.Name });
}
this.sendMessage(playerid, message, console);
break;
@@ -188,29 +195,29 @@ public void Execute(RocketPlayer playerid, string msg)
case "rem":
if (!perms[2] && !perms[0])
{
- message = "You don't have permission to use the shop rem command.";
+ message = UconomyBasicShop.Instance.Translate("no_permission_shop_rem", new object[] { });
this.sendMessage(playerid, message, console);
return;
}
switch (type[0])
{
case "v":
VehicleAsset va = (VehicleAsset)Assets.find(EAssetType.Vehicle, id);
- message = "You have removed the " + va.Name + "from the shop.";
+ message = UconomyBasicShop.Instance.Translate("removed_from_shop", new object[] { va.Name });
success = UconomyBasicShop.Instance.ShopDB.DeleteVehicle((int)id);
if (!success)
{
- message = va.Name + " wasn't in the shop, so couldn't be removed.";
+ message = UconomyBasicShop.Instance.Translate("not_in_shop_to_remove", new object[] { va.Name });
}
this.sendMessage(playerid, message, console);
break;
default:
ItemAsset ia = (ItemAsset)Assets.find(EAssetType.Item, id);
- message = "You have removed the " + ia.Name + " from the shop.";
+ message = UconomyBasicShop.Instance.Translate("removed_from_shop", new object[] { ia.Name });
success = UconomyBasicShop.Instance.ShopDB.DeleteItem((int)id);
if (!success)
{
- message = ia.Name + " wasn't in the shop, so couldn't be removed.";
+ message = UconomyBasicShop.Instance.Translate("not_in_shop_to_remove", new object[] { ia.Name });
}
this.sendMessage(playerid, message, console);
break;
@@ -219,24 +226,27 @@ public void Execute(RocketPlayer playerid, string msg)
case "buy":
if (!perms[4] && !perms[0])
{
- message = "You don't have permission to use the shop buy command.";
+ message = UconomyBasicShop.Instance.Translate("no_permission_shop_buy", new object[] { });
this.sendMessage(playerid, message, console);
return;
}
ItemAsset iab = (ItemAsset)Assets.find(EAssetType.Item, id);
decimal buyb;
- decimal.TryParse(command[2], out buyb);
- message = "You set the buyback price for " + iab.Name + " to " + buyb.ToString() + " in the shop.";
+ decimal.TryParse(msg[2], out buyb);
+ message = UconomyBasicShop.Instance.Translate("set_buyback_price", new object[] {
+ iab.Name,
+ buyb.ToString()
+ });
success = UconomyBasicShop.Instance.ShopDB.SetBuyPrice((int)id, buyb);
if (!success)
{
- message = iab.Name + " isn't in the shop so can't set a buyback price.";
+ message = UconomyBasicShop.Instance.Translate("not_in_shop_to_buyback", new object[] { iab.Name });
}
this.sendMessage(playerid, message, console);
break;
default:
// We shouldn't get this, but if we do send an error.
- message = "You entered an invalid shop command.";
+ message = UconomyBasicShop.Instance.Translate("not_in_shop_to_remove", new object[] { });;
this.sendMessage(playerid, message, console);
return;
}
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.2.0.1")]
-[assembly: AssemblyFileVersion("1.2.0.1")]
+[assembly: AssemblyVersion("1.2.1.0")]
+[assembly: AssemblyFileVersion("1.2.1.0")]
@@ -21,15 +21,19 @@ public class UconomyBasicShop : RocketPlugin<UconomyBasicShopConfiguration>
{
{
"buy_command_usage",
- "Usage: /buy [v.]<name or id>/[amount]/[quality of 25, 50, 75, or 100] (last 2 optional and only for items, default 1 amount, 100 quality)."
+ "Usage: /buy [v.]<name or id> [amount] [quality of 25, 50, 75, or 100] (last 2 optional and only for items, default 1 amount, 100 quality)."
},
{
"cost_command_usage",
"Usage: /cost [v.]<name or id>."
},
{
"sell_command_usage",
- "Usage: /sell <name or id>/[amount] (optional)."
+ "Usage: /sell <name or id> [amount] (optional)."
+ },
+ {
+ "shop_command_usage",
+ "Usage: /shop <add/rem/chng/buy> [v.]<itemid> <cost> <cost> is not required for rem, buy is only for items."
},
{
"error_giving_item",
@@ -102,6 +106,74 @@ public class UconomyBasicShop : RocketPlugin<UconomyBasicShopConfiguration>
{
"no_sell_price_set",
"The shop is not buying {0} right now"
+ },
+ {
+ "no_itemid_given",
+ "An itemid is required."
+ },
+ {
+ "no_cost_given",
+ "A cost is required."
+ },
+ {
+ "v_not_provided",
+ "You must specify v for vehicle or just an item id. Ex. /shop rem/101"
+ },
+ {
+ "invalid_id_given",
+ "You need to provide an item or vehicle id."
+ },
+ {
+ "no_permission_shop_chng",
+ "You don't have permission to use the shop chng msg."
+ },
+ {
+ "no_permission_shop_add",
+ "You don't have permission to use the shop add msg."
+ },
+ {
+ "no_permission_shop_rem",
+ "You don't have permission to use the shop rem msg."
+ },
+ {
+ "no_permission_shop_buy",
+ "You don't have permission to use the shop buy msg."
+ },
+ {
+ "changed",
+ "changed"
+ },
+ {
+ "added",
+ "added"
+ },
+ {
+ "changed_or_added_to_shop",
+ "You have {0} the {1} with cost {2} to the shop."
+ },
+ {
+ "error_adding_or_changing",
+ "There was an error adding/changing {0}!"
+ },
+ {
+ "removed_from_shop",
+ "You have removed the {0} from the shop."
+ },
+ {
+ "not_in_shop_to_remove",
+ "{0} wasn't in the shop, so couldn't be removed."
+ },
+ {
+ "not_in_shop_to_set_buyback",
+ "{0} isn't in the shop so can't set a buyback price."
+ },
+ {
+ "set_buyback_price",
+ "You set the buyback price for {0} to {1} in the shop."
+ },
+ {
+ "invalid_shop_command",
+ "You entered an invalid shop command."
}
};
}
@@ -118,18 +190,17 @@ protected override void Load()
public delegate void PlayerShopSell(RocketPlayer player, decimal amt, byte items, ushort item);
public event PlayerShopSell OnShopSell;
- public void Buy(RocketPlayer playerid, string msg)
+ public void Buy(RocketPlayer playerid, string[] components0)
{
string message;
- if (string.IsNullOrEmpty(msg))
+ if (components0.Length == 0)
{
message = UconomyBasicShop.Instance.Translate("buy_command_usage", new object[] {});
// We are going to print how to use
RocketChatManager.Say(playerid, message);
return;
}
byte amttobuy = 1;
- string[] components0 = Parser.getComponentsFromSerial(msg, '/');
if (components0.Length > 1)
{
amttobuy = byte.Parse(components0[1]);
@@ -264,17 +335,16 @@ public void Buy(RocketPlayer playerid, string msg)
break;
}
}
- public void Cost(RocketPlayer playerid, string msg)
+ public void Cost(RocketPlayer playerid, string[] components)
{
string message;
- if (string.IsNullOrEmpty(msg))
+ if (components.Length == 0)
{
message = UconomyBasicShop.Instance.Translate("cost_command_usage", new object[] { });
// We are going to print how to use
RocketChatManager.Say(playerid, message);
return;
}
- string[] components = Parser.getComponentsFromSerial(msg, '.');
if (components.Length == 2 && components[0] != "v")
{
message = UconomyBasicShop.Instance.Translate("cost_command_usage", new object[] { });
@@ -358,18 +428,17 @@ public void Cost(RocketPlayer playerid, string msg)
break;
}
}
- public void Sell(RocketPlayer playerid, string msg)
+ public void Sell(RocketPlayer playerid, string[] components)
{
string message;
- if (string.IsNullOrEmpty(msg))
+ if (components.Length == 0)
{
message = UconomyBasicShop.Instance.Translate("sell_command_usage", new object[] { });
// We are going to print how to use
RocketChatManager.Say(playerid, message);
return;
}
byte amttosell = 1;
- string[] components = Parser.getComponentsFromSerial(msg, '/');
if (components.Length > 1)
{
amttosell = byte.Parse(components[1]);

0 comments on commit d6fc26d

Please sign in to comment.