mirror of
https://github.com/MinetestForFun/minercantile.git
synced 2024-12-22 15:50:20 +01:00
Add Travis CI and LuaCheck (#5)
This commit is contained in:
parent
29fe3ac467
commit
70a485f793
15
.luacheckrc
Normal file
15
.luacheckrc
Normal file
@ -0,0 +1,15 @@
|
||||
unused_args = false
|
||||
allow_defined_top = true
|
||||
max_line_length = 999
|
||||
|
||||
globals = {
|
||||
"minercantile",
|
||||
}
|
||||
|
||||
read_globals = {
|
||||
string = {fields = {"split", "trim"}},
|
||||
table = {fields = {"copy", "getn"}},
|
||||
|
||||
"minetest", "ItemStack",
|
||||
"default", "unified_inventory",
|
||||
}
|
11
.travis.yml
Normal file
11
.travis.yml
Normal file
@ -0,0 +1,11 @@
|
||||
language: generic
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- luarocks
|
||||
before_install:
|
||||
- luarocks install --local luacheck
|
||||
script:
|
||||
- $HOME/.luarocks/bin/luacheck .
|
||||
notifications:
|
||||
email: false
|
@ -1,5 +1,7 @@
|
||||
# Miner Cantile
|
||||
|
||||
[![Build Status](https://travis-ci.org/MinetestForFun/minercantile.svg)](https://travis-ci.org/MinetestForFun/minercantile)
|
||||
|
||||
A Minetest trading mod by crabman, under the original idea of Cyberpangolin.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
|
11
shop.lua
11
shop.lua
@ -265,7 +265,7 @@ end
|
||||
|
||||
-- sell fonction
|
||||
function minercantile.shop.get_buy_price(shop_type, itname)
|
||||
local price = nil
|
||||
local price
|
||||
local money = minercantile.shop.get_money()
|
||||
if not minercantile.stock.items[itname] then
|
||||
minercantile.stock.items[itname] = {nb=0}
|
||||
@ -288,7 +288,7 @@ end
|
||||
|
||||
-- sell fonction
|
||||
function minercantile.shop.get_sell_price(itname, wear)
|
||||
local price = nil
|
||||
local price
|
||||
local money = minercantile.shop.get_money()
|
||||
if not minercantile.stock.items[itname] then
|
||||
minercantile.stock.items[itname] = {nb=0}
|
||||
@ -380,7 +380,6 @@ function minercantile.shop.buy(name, itname, nb, price)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if not player then return false end
|
||||
local player_inv = player:get_inventory()
|
||||
local shop_money = minercantile.shop.get_money()
|
||||
local player_money = minercantile.wallet.get_money(name)
|
||||
if player_money < 1 then
|
||||
minetest.show_formspec(name, "minercantile:confirmed", "size[6,3]bgcolor[#2A2A2A;]label[2.6,0;Shop]label[1,1;Sorry, you have not enough money]button[1.3,2.1;1.5,1;return_buy;Return]button_exit[3.3,2.1;1.5,1;close;Close]")
|
||||
@ -466,7 +465,6 @@ end
|
||||
|
||||
local function get_formspec_buy_items(name)
|
||||
local itname = shop_buy[name].itname
|
||||
local max = shop_buy[name].max
|
||||
local nb = shop_buy[name].nb
|
||||
local price = shop_buy[name].price
|
||||
local formspec = {"size[8,6]bgcolor[#2A2A2A;]label[3.5,0;Buy Items]"}
|
||||
@ -610,7 +608,6 @@ local function get_formspec_sell_items(name)
|
||||
local item = shop_sell[name].item
|
||||
local itname = item.name
|
||||
local index = shop_sell[name].index
|
||||
local max = shop_sell[name].max
|
||||
local nb = shop_sell[name].nb
|
||||
local price = minercantile.shop.get_sell_price(itname, item.wear)
|
||||
shop_sell[name].price = price
|
||||
@ -969,7 +966,7 @@ minetest.register_chatcommand("shop_additem",{
|
||||
minetest.chat_send_player(name, "invalid param amount")
|
||||
return
|
||||
end
|
||||
local amount = tonumber(amount)
|
||||
amount = tonumber(amount)
|
||||
if amount < 1 then
|
||||
minetest.chat_send_player(name, "invalid param amount")
|
||||
return
|
||||
@ -1001,7 +998,7 @@ minetest.register_chatcommand("shop_delitem",{
|
||||
minetest.chat_send_player(name, "invalid param amount")
|
||||
return
|
||||
end
|
||||
local amount = tonumber(amount)
|
||||
amount = tonumber(amount)
|
||||
if amount < 1 then
|
||||
minetest.chat_send_player(name, "invalid param amount")
|
||||
return
|
||||
|
@ -5,7 +5,7 @@ function minercantile.wallet.load_wallet(name)
|
||||
if minercantile.wallets[name] == nil then
|
||||
minercantile.wallets[name] = {}
|
||||
end
|
||||
local file, err = io.open(minercantile.path_wallet..name, "r")
|
||||
local file, _ = io.open(minercantile.path_wallet..name, "r")
|
||||
if file then
|
||||
local data = minetest.deserialize(file:read("*all"))
|
||||
file:close()
|
||||
|
Loading…
Reference in New Issue
Block a user