Permalink
Browse files

Update to Rocket 4.6

  • Loading branch information...
1 parent 904d062 commit bc046a9d95422f50e42b319890bf34fbc96ec0c1 @Zamirathe Zamirathe committed Jul 27, 2015
View
@@ -8,7 +8,7 @@ namespace ZaupShop
{
public class CommandBuy : IRocketCommand
{
- public bool RunFromConsole
+ public bool AllowFromConsole
{
get
{
@@ -40,10 +40,13 @@ public List<string> Aliases
{
get { return new List<string>(); }
}
-
- public void Execute(RocketPlayer playerid, string[] msg)
+ public List<string> Permissions
+ {
+ get { return new List<string>(); }
+ }
+ public void Execute(IRocketPlayer playerid, string[] msg)
{
- ZaupShop.Instance.Buy(playerid, msg);
+ ZaupShop.Instance.Buy((UnturnedPlayer)playerid, msg);
}
}
}
View
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+
using Rocket.API;
using Rocket.Unturned.Commands;
using Rocket.Unturned.Player;
@@ -12,7 +13,7 @@ namespace ZaupShop
{
public class CommandCost : IRocketCommand
{
- public bool RunFromConsole
+ public bool AllowFromConsole
{
get
{
@@ -44,10 +45,13 @@ public List<string> Aliases
{
get { return new List<string>(); }
}
-
- public void Execute(RocketPlayer playerid, string[] msg)
+ public List<string> Permissions
+ {
+ get { return new List<string>(); }
+ }
+ public void Execute(IRocketPlayer playerid, string[] msg)
{
- ZaupShop.Instance.Cost(playerid, msg);
+ ZaupShop.Instance.Cost((UnturnedPlayer)playerid, msg);
}
}
}
View
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+
using Rocket.API;
using Rocket.Unturned.Commands;
using Rocket.Unturned.Player;
@@ -8,7 +9,7 @@ namespace ZaupShop
{
public class CommandSell : IRocketCommand
{
- public bool RunFromConsole
+ public bool AllowFromConsole
{
get
{
@@ -40,10 +41,13 @@ public List<string> Aliases
{
get { return new List<string>(); }
}
-
- public void Execute(RocketPlayer playerid, string[] msg)
+ public List<string> Permissions
+ {
+ get { return new List<string>(); }
+ }
+ public void Execute(IRocketPlayer playerid, string[] msg)
{
- ZaupShop.Instance.Sell(playerid, msg);
+ ZaupShop.Instance.Sell((UnturnedPlayer)playerid, msg);
}
}
}
View
@@ -1,9 +1,13 @@
using System;
using System.Collections.Generic;
+
using Rocket.API;
+using Rocket.Core;
+using Rocket.Core.Logging;
+using Rocket.Core.Permissions;
using Rocket.Unturned;
+using Rocket.Unturned.Chat;
using Rocket.Unturned.Commands;
-using Rocket.Unturned.Logging;
using Rocket.Unturned.Player;
using SDG.Unturned;
using UnityEngine;
@@ -13,7 +17,7 @@ namespace ZaupShop
{
public class CommandShop : IRocketCommand
{
- public bool RunFromConsole
+ public bool AllowFromConsole
{
get
{
@@ -45,15 +49,19 @@ public List<string> Aliases
{
get { return new List<string>(); }
}
-
- public void Execute(RocketPlayer playerid, string[] msg)
+ public List<string> Permissions
+ {
+ get { return new List<string>() { "shop.*", "shop.add", "shop.rem", "shop.chng", "shop.buy" }; }
+ }
+ public void Execute(IRocketPlayer caller, string[] msg)
{
- bool console = (playerid == null) ? true : false;
+ bool console = (caller is ConsolePlayer);
+ UnturnedPlayer playerid = (UnturnedPlayer)caller;
string[] permnames = { "shop.*", "shop.add", "shop.rem", "shop.chng", "shop.buy" };
bool[] perms = { false, false, false, false, false };
bool anyuse = false;
string message;
- List<string> permlist = (console) ? new List<string>() : playerid.Permissions;
+ List<string> permlist = (console) ? new List<string>() : R.Permissions.GetPermissions(playerid);
foreach (string s in permlist)
{
switch (s)
@@ -100,7 +108,7 @@ public void Execute(RocketPlayer playerid, string[] msg)
if (!anyuse)
{
// Assume this is a player
- RocketChat.Say(playerid, "You don't have permission to use the /shop command.");
+ UnturnedChat.Say(playerid, "You don't have permission to use the /shop command.");
return;
}
if (msg.Length == 0)
@@ -177,7 +185,7 @@ public void Execute(RocketPlayer playerid, string[] msg)
switch (type[0])
{
case "v":
- VehicleAsset va = (VehicleAsset)Assets.find(EAssetType.Vehicle, id);
+ VehicleAsset va = (VehicleAsset)Assets.find(EAssetType.VEHICLE, id);
message = ZaupShop.Instance.Translate("changed_or_added_to_shop", new object[] {
ac,
va.Name,
@@ -191,7 +199,7 @@ public void Execute(RocketPlayer playerid, string[] msg)
this.sendMessage(playerid, message, console);
break;
default:
- ItemAsset ia = (ItemAsset)Assets.find(EAssetType.Item, id);
+ ItemAsset ia = (ItemAsset)Assets.find(EAssetType.ITEM, id);
message = ZaupShop.Instance.Translate("changed_or_added_to_shop", new object[] {
ac,
ia.Name,
@@ -216,7 +224,7 @@ public void Execute(RocketPlayer playerid, string[] msg)
switch (type[0])
{
case "v":
- VehicleAsset va = (VehicleAsset)Assets.find(EAssetType.Vehicle, id);
+ VehicleAsset va = (VehicleAsset)Assets.find(EAssetType.VEHICLE, id);
message = ZaupShop.Instance.Translate("removed_from_shop", new object[] { va.Name });
success = ZaupShop.Instance.ShopDB.DeleteVehicle((int)id);
if (!success)
@@ -226,7 +234,7 @@ public void Execute(RocketPlayer playerid, string[] msg)
this.sendMessage(playerid, message, console);
break;
default:
- ItemAsset ia = (ItemAsset)Assets.find(EAssetType.Item, id);
+ ItemAsset ia = (ItemAsset)Assets.find(EAssetType.ITEM, id);
message = ZaupShop.Instance.Translate("removed_from_shop", new object[] { ia.Name });
success = ZaupShop.Instance.ShopDB.DeleteItem((int)id);
if (!success)
@@ -244,7 +252,7 @@ public void Execute(RocketPlayer playerid, string[] msg)
this.sendMessage(playerid, message, console);
return;
}
- ItemAsset iab = (ItemAsset)Assets.find(EAssetType.Item, id);
+ ItemAsset iab = (ItemAsset)Assets.find(EAssetType.ITEM, id);
decimal buyb;
decimal.TryParse(msg[2], out buyb);
message = ZaupShop.Instance.Translate("set_buyback_price", new object[] {
@@ -266,15 +274,15 @@ public void Execute(RocketPlayer playerid, string[] msg)
}
}
}
- private void sendMessage(RocketPlayer playerid, string message, bool console)
+ private void sendMessage(UnturnedPlayer playerid, string message, bool console)
{
if (console)
{
Logger.Log(message);
}
else
{
- RocketChat.Say(playerid, message);
+ UnturnedChat.Say(playerid, message);
}
}
}
View
@@ -1,6 +1,6 @@
using I18N.West;
using MySql.Data.MySqlClient;
-using Rocket.Unturned.Logging;
+using Rocket.Core.Logging;
using Rocket.API;
using System;
using unturned.ROCKS.Uconomy;
@@ -23,11 +23,11 @@ internal void CheckSchema()
{
MySqlConnection mySqlConnection = this.createConnection();
MySqlCommand mySqlCommand = mySqlConnection.CreateCommand();
- mySqlCommand.CommandText = string.Concat("show tables like '", ZaupShop.Instance.Configuration.ItemShopTableName, "'");
+ mySqlCommand.CommandText = string.Concat("show tables like '", ZaupShop.Instance.Configuration.Instance.ItemShopTableName, "'");
mySqlConnection.Open();
if (mySqlCommand.ExecuteScalar() == null)
{
- mySqlCommand.CommandText = string.Concat("CREATE TABLE `", ZaupShop.Instance.Configuration.ItemShopTableName, "` (`id` int(6) NOT NULL,`itemname` varchar(32) NOT NULL,`cost` decimal(15,2) NOT NULL DEFAULT '20.00',`buyback` decimal(15,2) NOT NULL DEFAULT '0.00',PRIMARY KEY (`id`)) ");
+ mySqlCommand.CommandText = string.Concat("CREATE TABLE `", ZaupShop.Instance.Configuration.Instance.ItemShopTableName, "` (`id` int(6) NOT NULL,`itemname` varchar(32) NOT NULL,`cost` decimal(15,2) NOT NULL DEFAULT '20.00',`buyback` decimal(15,2) NOT NULL DEFAULT '0.00',PRIMARY KEY (`id`)) ");
mySqlCommand.ExecuteNonQuery();
}
mySqlConnection.Close();
@@ -40,11 +40,11 @@ internal void CheckSchema()
{
MySqlConnection mySqlConnection = this.createConnection();
MySqlCommand mySqlCommand = mySqlConnection.CreateCommand();
- mySqlCommand.CommandText = string.Concat("show tables like '", ZaupShop.Instance.Configuration.VehicleShopTableName, "'");
+ mySqlCommand.CommandText = string.Concat("show tables like '", ZaupShop.Instance.Configuration.Instance.VehicleShopTableName, "'");
mySqlConnection.Open();
if (mySqlCommand.ExecuteScalar() == null)
{
- mySqlCommand.CommandText = string.Concat("CREATE TABLE `", ZaupShop.Instance.Configuration.VehicleShopTableName, "` (`id` int(6) NOT NULL,`vehiclename` varchar(32) NOT NULL,`cost` decimal(15,2) NOT NULL DEFAULT '100.00',PRIMARY KEY (`id`)) ");
+ mySqlCommand.CommandText = string.Concat("CREATE TABLE `", ZaupShop.Instance.Configuration.Instance.VehicleShopTableName, "` (`id` int(6) NOT NULL,`vehiclename` varchar(32) NOT NULL,`cost` decimal(15,2) NOT NULL DEFAULT '100.00',PRIMARY KEY (`id`)) ");
mySqlCommand.ExecuteNonQuery();
}
mySqlConnection.Close();
@@ -57,11 +57,11 @@ internal void CheckSchema()
{
MySqlConnection mySqlConnection = this.createConnection();
MySqlCommand mySqlCommand = mySqlConnection.CreateCommand();
- mySqlCommand.CommandText = string.Concat("show columns from `", ZaupShop.Instance.Configuration.ItemShopTableName, "` like 'buyback'");
+ mySqlCommand.CommandText = string.Concat("show columns from `", ZaupShop.Instance.Configuration.Instance.ItemShopTableName, "` like 'buyback'");
mySqlConnection.Open();
if (mySqlCommand.ExecuteScalar() == null)
{
- mySqlCommand.CommandText = string.Concat("ALTER TABLE `", ZaupShop.Instance.Configuration.ItemShopTableName, "` ADD `buyback` decimal(15,2) NOT NULL DEFAULT '0.00'");
+ mySqlCommand.CommandText = string.Concat("ALTER TABLE `", ZaupShop.Instance.Configuration.Instance.ItemShopTableName, "` ADD `buyback` decimal(15,2) NOT NULL DEFAULT '0.00'");
mySqlCommand.ExecuteNonQuery();
}
mySqlConnection.Close();
@@ -77,16 +77,16 @@ private MySqlConnection createConnection()
MySqlConnection mySqlConnection = null;
try
{
- if (Uconomy.Instance.Configuration.DatabasePort == 0)
+ if (Uconomy.Instance.Configuration.Instance.DatabasePort == 0)
{
- Uconomy.Instance.Configuration.DatabasePort = 3306;
+ Uconomy.Instance.Configuration.Instance.DatabasePort = 3306;
}
mySqlConnection = new MySqlConnection(string.Format("SERVER={0};DATABASE={1};UID={2};PASSWORD={3};PORT={4};", new object[] {
- Uconomy.Instance.Configuration.DatabaseAddress,
- Uconomy.Instance.Configuration.DatabaseName,
- Uconomy.Instance.Configuration.DatabaseUsername,
- Uconomy.Instance.Configuration.DatabasePassword,
- Uconomy.Instance.Configuration.DatabasePort}));
+ Uconomy.Instance.Configuration.Instance.DatabaseAddress,
+ Uconomy.Instance.Configuration.Instance.DatabaseName,
+ Uconomy.Instance.Configuration.Instance.DatabaseUsername,
+ Uconomy.Instance.Configuration.Instance.DatabasePassword,
+ Uconomy.Instance.Configuration.Instance.DatabasePort}));
}
catch (Exception exception)
{
@@ -106,7 +106,7 @@ public bool AddItem(int id, string name, decimal cost, bool change)
mySqlCommand.CommandText = string.Concat(
new string[] {
"Insert into `",
- ZaupShop.Instance.Configuration.ItemShopTableName,
+ ZaupShop.Instance.Configuration.Instance.ItemShopTableName,
"` (`id`, `itemname`, `cost`) VALUES ('",
id.ToString(),
"', '",
@@ -121,7 +121,7 @@ public bool AddItem(int id, string name, decimal cost, bool change)
mySqlCommand.CommandText = string.Concat(
new string[] {
"update `",
- ZaupShop.Instance.Configuration.ItemShopTableName,
+ ZaupShop.Instance.Configuration.Instance.ItemShopTableName,
"` set itemname='",
name,
"', cost='",
@@ -161,7 +161,7 @@ public bool AddVehicle(int id, string name, decimal cost, bool change)
mySqlCommand.CommandText = string.Concat(
new string[] {
"Insert into `",
- ZaupShop.Instance.Configuration.VehicleShopTableName,
+ ZaupShop.Instance.Configuration.Instance.VehicleShopTableName,
"` (`id`, `vehiclename`, `cost`) VALUES ('",
id.ToString(),
"', '",
@@ -176,7 +176,7 @@ public bool AddVehicle(int id, string name, decimal cost, bool change)
mySqlCommand.CommandText = string.Concat(
new string[] {
"update `",
- ZaupShop.Instance.Configuration.VehicleShopTableName,
+ ZaupShop.Instance.Configuration.Instance.VehicleShopTableName,
"` set vehiclename='",
name,
"', cost='",
@@ -214,7 +214,7 @@ public decimal GetItemCost(int id)
MySqlCommand mySqlCommand = mySqlConnection.CreateCommand();
mySqlCommand.CommandText = string.Concat(new string[] {
"select `cost` from `",
- ZaupShop.Instance.Configuration.ItemShopTableName,
+ ZaupShop.Instance.Configuration.Instance.ItemShopTableName,
"` where `id` = '",
id.ToString(),
"';"
@@ -243,7 +243,7 @@ public decimal GetVehicleCost(int id)
MySqlCommand mySqlCommand = mySqlConnection.CreateCommand();
mySqlCommand.CommandText = string.Concat(new string[] {
"select `cost` from `",
- ZaupShop.Instance.Configuration.VehicleShopTableName,
+ ZaupShop.Instance.Configuration.Instance.VehicleShopTableName,
"` where `id` = '",
id.ToString(),
"';"
@@ -272,7 +272,7 @@ public bool DeleteItem(int id)
mySqlCommand.CommandText = string.Concat(
new string[] {
"delete from `",
- ZaupShop.Instance.Configuration.ItemShopTableName,
+ ZaupShop.Instance.Configuration.Instance.ItemShopTableName,
"` where id='",
id.ToString(),
"';"
@@ -305,7 +305,7 @@ public bool DeleteVehicle(int id)
mySqlCommand.CommandText = string.Concat(
new string[] {
"delete from `",
- ZaupShop.Instance.Configuration.VehicleShopTableName,
+ ZaupShop.Instance.Configuration.Instance.VehicleShopTableName,
"` where id='",
id.ToString(),
"';"
@@ -338,7 +338,7 @@ public bool SetBuyPrice(int id, decimal cost)
mySqlCommand.CommandText = string.Concat(
new string[] {
"update `",
- ZaupShop.Instance.Configuration.ItemShopTableName,
+ ZaupShop.Instance.Configuration.Instance.ItemShopTableName,
"` set `buyback`='",
cost.ToString(),
"' where id='",
@@ -373,7 +373,7 @@ public decimal GetItemBuyPrice(int id)
MySqlCommand mySqlCommand = mySqlConnection.CreateCommand();
mySqlCommand.CommandText = string.Concat(new string[] {
"select `buyback` from `",
- ZaupShop.Instance.Configuration.ItemShopTableName,
+ ZaupShop.Instance.Configuration.Instance.ItemShopTableName,
"` where `id` = '",
id.ToString(),
"';"
@@ -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.2.5")]
-[assembly: AssemblyFileVersion("1.2.2.5")]
+[assembly: AssemblyVersion("1.3.0.0")]
+[assembly: AssemblyFileVersion("1.3.0.0")]
Oops, something went wrong.

0 comments on commit bc046a9

Please sign in to comment.