zaup-shop

last built 4 weeks ago
Build #247
By downloading this file, you agree to our license terms.
Source: github.com
License: MIT
Maintainer: Community Plugin
This plugin is maintained by the RocketMod Community.
The RocketMod team curates a dozen of community plugins and could need your support.
Consider a donation to RocketMod and sponsor your favourite plugins or contribute code to them.

ZaupShop

A simple shop using the chat line. This allows you to have a shop for players to use Uconomy currency to buy items and vehicles. Buying vehicles is turned off by default.

There are 3 commands: /shop, /cost, /buy, and /sell.
/cost, /buy, and /sell are meant to be used by everyone that has permissions for them. Just put the command in the permissions file for the group.
/shop is meant for admins only, but is not limited to that. You can add groups to have the ability to use this command by adding shop in their group of commands and one or more of the following: shop.add (adding to the shop), shop.rem (removing from the shop), shop.chng (changing costs), shop.buy (buyback costs), or shop.* (all 4) to the group permissions.

Usage:
/buy [v.]<item name or id>/[amount] – This will use the same name to id find as /i. Use v for vehicles.  Amount is only available for items and is optional, default is 1.
/cost [v.]<item name or id> – Same as above but will display the user the cost of asked for item/vehicle as well as the sell cost if there is one (sell cost for magazines and ammunition boxes is for full capacity not individual bullets).
/sell <item name or id>/[amount] – This will allow you to sell items (no vehicles) back to the shop. If QualityCounts is set to true, the quality of the item will determine how much of the price is received.  If buyback is 1.00 and quality is 45%, you’ll receive 0.45 for example.  For magazines and ammunition boxes, it will buy back individual bullets. Quality isn’t used here as there is none.  So if you want to sell a full military ammo box of 40, you’ll do /sell military ammunition/40.
/shop <add/rem/chng/buy>/[v.]<itemid>/<cost> – This is the most complicated as it has multiple options. add (Adding), rem (Removing), chng (Change cost), buy (Buyback amount), v is needed if dealing with vehicles. Itemids only (no names) for this command and one is required. Cost is not required for rem, but is required for the others.  You do have to add the buyback amount separately from the add or chng.

Only /shop can be run from both the console and in game.

Requirements:
Uconomy
Mysql

This will run off the same database as Uconomy, but just create 2 new tables for the items and vehicles in the shop to be stored in. The tables are created blank. An admin, or someone with ability to use /shop, will have to add the items/vehicles. These can only be added one at a time through the command. If you can access the table with something like phpmyadmin, feel free to add them in mass that way.

Costs cannot be lower than 0.01. You cannot create any “free” items.  Anything at 0.00 or less will trigger the not available message.

With the 1.1.0.0 update, there was a new column added to the table for the item shop.  It should automatically create it though please let me know if you encounter an error.  A lot more added to the configuration file too so please update or you’ll get errors.

With the 1.2.0.0 update, the config file was drastically changed.  Please backup your info, delete or rename the file, and let the plugin recreate it.  You can also use the defaults given above.

 

 

Are you tired of adding each item with commands to the shop? Look at the UUU to be able to add multiple items directly to your database.

Default configuration


<?xml version="1.0" encoding="utf-8"?>
<ZaupShopConfiguration xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <ItemShopTableName>uconomyitemshop</ItemShopTableName>
  <VehicleShopTableName>uconomyvehicleshop</VehicleShopTableName>
  <CanBuyItems>true</CanBuyItems>
  <CanBuyVehicles>false</CanBuyVehicles>
  <CanSellItems>true</CanSellItems>
  <QualityCounts>true</QualityCounts>
</ZaupShopConfiguration>

Default english translation


<?xml version="1.0" encoding="utf-8"?>
<Translations xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Translation Id="buy_command_usage" Value="Usage: /buy [v.]&lt;name or id&gt; [amount] [quality of 25, 50, 75, or 100] (last 2 optional and only for items, default 1 amount, 100 quality)." />
  <Translation Id="cost_command_usage" Value="Usage: /cost [v.]&lt;name or id&gt;." />
  <Translation Id="sell_command_usage" Value="Usage: /sell &lt;name or id&gt; [amount] (optional)." />
  <Translation Id="shop_command_usage" Value="Usage: /shop &lt;add/rem/chng/buy&gt; [v.]&lt;itemid&gt; &lt;cost&gt;  &lt;cost&gt; is not required for rem, buy is only for items." />
  <Translation Id="error_giving_item" Value="There was an error giving you {0}.  You have not been charged." />
  <Translation Id="error_getting_cost" Value="There was an error getting the cost of {0}!" />
  <Translation Id="item_cost_msg" Value="The item {0} costs {1} {2} to buy and gives {3} {4} when you sell it." />
  <Translation Id="vehicle_cost_msg" Value="The vehicle {0} costs {1} {2} to buy." />
  <Translation Id="item_buy_msg" Value="You have bought {5} {0} for {1} {2}.  You now have {3} {4}." />
  <Translation Id="vehicle_buy_msg" Value="You have bought 1 {0} for {1} {2}.  You now have {3} {4}." />
  <Translation Id="not_enough_currency_msg" Value="You do not have enough {0} to buy {1} {2}." />
  <Translation Id="buy_items_off" Value="I'm sorry, but the ability to buy items is turned off." />
  <Translation Id="buy_vehicles_off" Value="I'm sorry, but the ability to buy vehicles is turned off." />
  <Translation Id="item_not_available" Value="I'm sorry, but {0} is not available in the shop." />
  <Translation Id="vehicle_not_available" Value="I'm sorry, but {0} is not available in the shop." />
  <Translation Id="could_not_find" Value="I'm sorry, I couldn't find an id for {0}." />
  <Translation Id="sell_items_off" Value="I'm sorry, but the ability to sell items is turned off." />
  <Translation Id="not_have_item_sell" Value="I'm sorry, but you don't have any {0} to sell." />
  <Translation Id="not_enough_items_sell" Value="I'm sorry, but you don't have {0} {1} to sell." />
  <Translation Id="not_enough_ammo_sell" Value="I'm sorry, but you don't have enough ammo in {0} to sell." />
  <Translation Id="sold_items" Value="You have sold {0} {1} to the shop and receive {2} {3} in return.  Your balance is now {4} {5}." />
  <Translation Id="no_sell_price_set" Value="The shop is not buying {0} right now" />
  <Translation Id="no_itemid_given" Value="An itemid is required." />
  <Translation Id="no_cost_given" Value="A cost is required." />
  <Translation Id="invalid_amt" Value="You have entered in an invalid amount." />
  <Translation Id="v_not_provided" Value="You must specify v for vehicle or just an item id.  Ex. /shop rem/101" />
  <Translation Id="invalid_id_given" Value="You need to provide a valid item or vehicle id." />
  <Translation Id="no_permission_shop_chng" Value="You don't have permission to use the shop chng msg." />
  <Translation Id="no_permission_shop_add" Value="You don't have permission to use the shop add msg." />
  <Translation Id="no_permission_shop_rem" Value="You don't have permission to use the shop rem msg." />
  <Translation Id="no_permission_shop_buy" Value="You don't have permission to use the shop buy msg." />
  <Translation Id="changed" Value="changed" />
  <Translation Id="added" Value="added" />
  <Translation Id="changed_or_added_to_shop" Value="You have {0} the {1} with cost {2} to the shop." />
  <Translation Id="error_adding_or_changing" Value="There was an error adding/changing {0}!" />
  <Translation Id="removed_from_shop" Value="You have removed the {0} from the shop." />
  <Translation Id="not_in_shop_to_remove" Value="{0} wasn't in the shop, so couldn't be removed." />
  <Translation Id="not_in_shop_to_set_buyback" Value="{0} isn't in the shop so can't set a buyback price." />
  <Translation Id="set_buyback_price" Value="You set the buyback price for {0} to {1} in the shop." />
  <Translation Id="invalid_shop_command" Value="You entered an invalid shop command." />
</Translations>

Commands and permissions


/buy [v.]<name or id> [amount] [25 | 50 | 75 | 100]

Permissions: buy

Allows you to buy items from the shop.


/cost [v.]<name or id>

Permissions: cost

Tells you the cost of a selected item.


/sell <name or id> [amount]

Permissions: sell

Allows you to sell items to the shop from your inventory.


/shop <add | rem | chng | buy> [v.]<itemid> <cost>

Permissions: shop

Allows admins to change, add, or remove items/vehicles from the shop.


Git changelog


62aee3acaa9e7ab 2019-07-16 21:04:21

Update LICENSE

    a56299ab0683cd1 2018-06-26 20:44:58

    Update to latest RocketMod + .NET Core Project structure

      1b4757f27603f72 2018-06-10 23:41:15

      Fix build errors

        4d36ba8d76b6fc6 2018-06-10 23:40:26

        Update to latest RocketMod

          11ebe9f6b5aedde 2018-05-22 09:57:59

          Update to latest RocketMod

            f53d3526ee4dd0a 2018-05-21 18:32:42

            Remove static stuff

              368144ab03e11ba 2018-05-21 17:54:35

              RocketMod 5.

                39cfbaa021e37b8 2018-05-17 21:52:38

                Upstream merge

                  82c7e9527f12fdb 2017-11-03 16:43:23

                  Patch1 => Master

                    90ec26db66388c8 2017-11-03 16:40:12

                    Changed void Sell to bool Sell

                      63f75d8d4123c11 2017-11-02 19:31:48

                      Fix for upcoming super cool plugin

                        2e9e73e4ef88826 2017-11-02 18:40:18

                        Update libs

                          c7b7794d8649dfd 2017-11-02 17:28:31

                          Update gitinore

                            3cb3cd713f84717 2016-12-04 02:28:05

                            Update ZaupShop.cs

                            • Potential fix

                            07d31de4569e802 2016-12-03 10:38:52

                            Delete UnityEngine.dll

                              1cf331926d25ab3 2016-12-03 10:38:47

                              Delete Assembly-CSharp.dll

                                acea9fbbcdfe223 2016-12-03 10:38:43

                                Delete Rocket.Unturned.dll

                                  a7a97b555e593fc 2016-12-03 10:38:39

                                  Delete Rocket.Core.dll

                                    2145226496855c1 2016-12-03 10:38:36

                                    Delete Rocket.API.dll

                                      4312069a80ea848 2016-12-03 10:38:32

                                      Delete Assembly-CSharp-firstpass.dll

                                        f8038ca52d355a9 2016-12-03 10:38:23

                                        Create .gitkeep

                                          fbb717121d7abdf 2016-11-04 15:25:50

                                          ..

                                            c6ae98c0b36f2bf 2016-10-09 18:27:03

                                            ..

                                              b9e97c8b613a6db 2016-10-08 17:24:10

                                              ..

                                                f5bf443073fa752 2016-10-08 17:20:54

                                                ..

                                                  3e4240b5e5ddbd6 2016-02-03 12:03:05

                                                  ..

                                                    b11fc224cc3775e 2015-12-23 18:27:16

                                                    Fix

                                                      a68b15d71d91181 2015-10-13 07:08:09

                                                      Updated for Uconomy and Rocket

                                                        61fbf85d3fde1b9 2015-08-16 21:03:55

                                                        Handle empty input stings properly in /buy, /cost and /sell, and fix getting the name, when buying vehicles by id.

                                                          0b997ba1bae6bd0 2015-07-31 04:31:47

                                                          Fixed config

                                                            61d073f61b9447e 2015-07-31 04:31:08

                                                            Fix for issues

                                                              8e2205b6f44b962 2015-07-31 04:29:42

                                                              Update libs

                                                                ab6fb3f004cb126 2015-07-30 18:29:07

                                                                Simplified code for .IsAdmin check.

                                                                  d498e025d24d345 2015-07-30 04:13:05

                                                                  This is the fix for the error's on invalid amounts on the sell and buy commands, and alse invalid item/vehicle id's on the buy/sell/cost commands.

                                                                    135f9fae4529d18 2015-07-30 00:17:09

                                                                    Fix: Trying to cast caller to UnturnedPlayer when ran from the console will result in a Invalid Cast Exception.

                                                                    • I've also fixed the NRE error on the shop command if you enter in an invalid item/vehicle id.

                                                                    bc046a9d95422f5 2015-07-27 05:18:48

                                                                    Update to Rocket 4.6

                                                                      904d0621e543a74 2015-06-23 22:35:02

                                                                      Updated to Unturned 3.11.0.0 and Rocket 4.5.0.0

                                                                        34b3069bef5098f 2015-06-03 23:17:15

                                                                        fix

                                                                          7b3d9de882ca5bb 2015-06-03 23:06:43

                                                                          Updated sln

                                                                            a685ffdef2f5a3c 2015-06-03 23:06:20

                                                                            Changed file names

                                                                              4999e5d63990e8b 2015-06-03 23:02:34

                                                                              Updated project

                                                                                52c66fbd1fcca9b 2015-06-03 22:55:48

                                                                                Update UconomyBasicShop.csproj

                                                                                  7b72acadd294adf 2015-06-03 22:39:11

                                                                                  Updated references

                                                                                    561e6d5abffb296 2015-06-03 21:35:35

                                                                                    Added lib and Libaries

                                                                                      7f1d8b83e00b5e2 2015-05-30 18:03:11

                                                                                      Fix for /sell throwing error when don't have the item

                                                                                        1bdff41211fd125 2015-05-27 00:26:40

                                                                                        Fix for buying items

                                                                                          217a66d056418bf 2015-05-26 18:21:07

                                                                                          Update Rocket 4.2.0.0

                                                                                            b8afd7f83e02254 2015-05-17 03:31:36

                                                                                            Update to Rocket 4.0

                                                                                              d6fc26d177b7e52 2015-05-09 03:33:04

                                                                                              Update Translations for shop command and update to Rocket 3.9.1.0

                                                                                                13f236d0abb0d91 2015-05-06 00:54:48

                                                                                                Update for Rocket 3.8.0.0 and fix for selling ammo

                                                                                                  162a952366b4925 2015-05-04 21:06:47

                                                                                                  Fixed for Rocket 3.4.2.0, added quality matters for selling items, changed config and added translations, items will no longer sell if no buyback price is set

                                                                                                    fe76f7a429a2b52 2015-04-22 05:46:59

                                                                                                    Hot fix for sell event

                                                                                                      617ad9bd6670f63 2015-04-20 20:36:10

                                                                                                      No longer used obfuscated code

                                                                                                        ed4e300c91e6431 2015-04-20 04:12:44

                                                                                                        1.1.0.0 release, reworked commands to not require i, added events, added sell command

                                                                                                          fa13d948f259c28 2015-04-10 18:45:20

                                                                                                          Added database port

                                                                                                            f11e681dd1e17c9 2015-04-06 16:34:13

                                                                                                            Update to new Rocket 3.2.0.1

                                                                                                              372512e45da54a1 2015-03-29 03:36:00

                                                                                                              Update to work with rocket 3.1.0.0

                                                                                                                5490e3dd6f6abb7 2015-03-23 19:05:33

                                                                                                                Release 1.0.1.6