79 lines
2.3 KiB
Lua
79 lines
2.3 KiB
Lua
--[[
|
||
Fate of the Gods - Adds roleplay mechanics.
|
||
Copyright © 2020 Hamlet and contributors.
|
||
|
||
Licensed under the EUPL, Version 1.2 or – as soon they will be
|
||
approved by the European Commission – subsequent versions of the
|
||
EUPL (the "Licence");
|
||
You may not use this work except in compliance with the Licence.
|
||
You may obtain a copy of the Licence at:
|
||
|
||
https://joinup.ec.europa.eu/software/page/eupl
|
||
https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32017D0863
|
||
|
||
Unless required by applicable law or agreed to in writing,
|
||
software distributed under the Licence is distributed on an
|
||
"AS IS" basis,
|
||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||
implied.
|
||
See the Licence for the specific language governing permissions
|
||
and limitations under the Licence.
|
||
|
||
--]]
|
||
|
||
|
||
--
|
||
-- Functions
|
||
--
|
||
|
||
-- This is used to read values from the database
|
||
fog.fn_ReadDatabase = function(a_s_keyword)
|
||
local i_value = fog.t_MOD_DATABASE:get_int(a_s_keyword)
|
||
return i_value
|
||
end
|
||
|
||
|
||
-- This is used to update the character's sheet inventory tab
|
||
fog.fn_FogMTGstats = function(a_s_player)
|
||
|
||
-- Constants
|
||
local s_LEVEL_AXE = fog.l10n('Axe: ');
|
||
local s_LEVEL_HOE = fog.l10n('Hoe: ');
|
||
local s_LEVEL_PICK = fog.l10n('Pick: ');
|
||
local s_LEVEL_SHOVEL = fog.l10n('Shovel: ');
|
||
local s_LEVEL_SWORD = fog.l10n('Sword: ');
|
||
|
||
-- Variables
|
||
local s_formspecText = '';
|
||
local s_keyword = a_s_player:get_player_name() .. '_';
|
||
|
||
local i_levelAxe, i_levelHoe, i_levelPick, i_levelShovel, i_levelSword
|
||
|
||
i_levelAxe = fog.fn_ReadDatabase(s_keyword .. 'i_xp_axe');
|
||
i_levelHoe = fog.fn_ReadDatabase(s_keyword .. 'i_xp_hoe');
|
||
i_levelPick = fog.fn_ReadDatabase(s_keyword .. 'i_xp_pick');
|
||
i_levelShovel = fog.fn_ReadDatabase(s_keyword .. 'i_xp_shovel');
|
||
i_levelSword = fog.fn_ReadDatabase(s_keyword .. 'i_xp_sword');
|
||
|
||
s_formspecText = s_LEVEL_AXE .. i_levelAxe .. ',' ..
|
||
s_LEVEL_HOE .. i_levelHoe .. ',' ..
|
||
s_LEVEL_PICK .. i_levelPick .. ',' ..
|
||
s_LEVEL_SHOVEL .. i_levelShovel .. ',' ..
|
||
s_LEVEL_SWORD .. i_levelSword
|
||
|
||
return s_formspecText
|
||
end
|
||
|
||
|
||
-- This is used to register the charaxter's sheet inventory tab
|
||
sfinv.register_page('fog:charsheet', {
|
||
title = fog.l10n('Character\'s sheet'),
|
||
get = function(self, player, context)
|
||
|
||
local s_formspecString = fog.fn_FogMTGstats(player)
|
||
|
||
return sfinv.make_formspec(player, context,
|
||
'textlist[0,0;7.8,4.5;;' .. s_formspecString .. ']', true)
|
||
end
|
||
})
|