zaup-shop

#201 - published lessthan a minute ago

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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <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


a56299ab0683cd1 2018-06-26 20:44:58

Update to latest RocketMod + .NET Core Project structure

    Download

    Build #201
    By downloading this file, you agree to our license terms.

    Repository

    github.com

    License

    MIT

    Author

    Zamirathe