chore: use as much as possible the new data system
This commit is contained in:
parent
7f2135fd50
commit
f574bcd362
23 changed files with 33 additions and 199 deletions
|
@ -1,8 +1,7 @@
|
||||||
local CharacterData = Object:extend()
|
local CharacterData = Object:extend()
|
||||||
local charutils = require "game.utils.characters"
|
|
||||||
|
|
||||||
function CharacterData:getCommonData()
|
function CharacterData:getCommonData()
|
||||||
self.data = charutils.getCharacterData(self.simplename)
|
self.data = core.datas:get("characters", self.simplename)
|
||||||
self.name = self.data.name
|
self.name = self.data.name
|
||||||
self.fullname = self.data.fullname
|
self.fullname = self.data.fullname
|
||||||
self.turns = self.data.turns
|
self.turns = self.data.turns
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
local CharacterEquip = Object:extend()
|
local CharacterEquip = Object:extend()
|
||||||
local itemutils = require "game.utils.items"
|
|
||||||
|
|
||||||
local categories = {"gloves", "shoes", "accessories"}
|
local categories = {"gloves", "shoes", "accessories"}
|
||||||
|
|
||||||
|
@ -35,7 +34,7 @@ function CharacterEquip:removeEquip(category)
|
||||||
end
|
end
|
||||||
|
|
||||||
function CharacterEquip:predictStat(statName, category, name)
|
function CharacterEquip:predictStat(statName, category, name)
|
||||||
local data = itemutils.getItemData(category, name)
|
local data = core.datas:get("items", name)
|
||||||
local boost = data.statsBoost[statName] or 0
|
local boost = data.statsBoost[statName] or 0
|
||||||
return self:getStat(statName, category) + boost
|
return self:getStat(statName, category) + boost
|
||||||
end
|
end
|
||||||
|
@ -53,7 +52,7 @@ end
|
||||||
|
|
||||||
function CharacterEquip:getStatByType(stat, category)
|
function CharacterEquip:getStatByType(stat, category)
|
||||||
if (not utils.string.isEmpty(self.equip[category])) then
|
if (not utils.string.isEmpty(self.equip[category])) then
|
||||||
local data = itemutils.getItemData(category, self.equip[category])
|
local data = core.datas:get("items", self.equip[category])
|
||||||
local boost = data.statsBoost[stat] or 0
|
local boost = data.statsBoost[stat] or 0
|
||||||
return boost
|
return boost
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,8 +2,6 @@ local AbstractMobParent = require "game.abstractmobs.parent"
|
||||||
|
|
||||||
local AbstractEnnemy = AbstractMobParent:extend()
|
local AbstractEnnemy = AbstractMobParent:extend()
|
||||||
|
|
||||||
local ennutils = require "game.utils.ennemies"
|
|
||||||
|
|
||||||
function AbstractEnnemy:new(directory, name)
|
function AbstractEnnemy:new(directory, name)
|
||||||
self.simplename = name
|
self.simplename = name
|
||||||
self.directory = directory
|
self.directory = directory
|
||||||
|
@ -19,7 +17,7 @@ function AbstractEnnemy:getProtecTypes()
|
||||||
end
|
end
|
||||||
|
|
||||||
function AbstractEnnemy:initBasicElements()
|
function AbstractEnnemy:initBasicElements()
|
||||||
self.data = ennutils.getData(self.directory, self.simplename)
|
self.data = core.datas:get("ennemies", self.simplename)
|
||||||
self.name = self.data.name
|
self.name = self.data.name
|
||||||
self.fullname = self.data.fullname
|
self.fullname = self.data.fullname
|
||||||
self.turns = self.data.turns
|
self.turns = self.data.turns
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
local CoreCBS = Object:extend()
|
local CoreCBS = Object:extend()
|
||||||
|
|
||||||
local battleutils = require "game.utils.battle"
|
|
||||||
local defTransitions = require "birb.modules.transitions"
|
local defTransitions = require "birb.modules.transitions"
|
||||||
local radTransitions = require "game.modules.transitions"
|
local radTransitions = require "game.modules.transitions"
|
||||||
|
|
||||||
|
@ -12,7 +11,7 @@ function CoreCBS:new()
|
||||||
end
|
end
|
||||||
|
|
||||||
function CoreCBS:startBattle(category, name, x, y)
|
function CoreCBS:startBattle(category, name, x, y)
|
||||||
local data = battleutils.getBattleData(category, name)
|
local data = core.datas:get("battles", name)
|
||||||
self.lastx, self.lasty = x or DEFAULTX, y or DEFAULTY
|
self.lastx, self.lasty = x or DEFAULTX, y or DEFAULTY
|
||||||
core.screen:startTransition(radTransitions.eggman, radTransitions.borders, function() scenes.cbs(data) end, x, y)
|
core.screen:startTransition(radTransitions.eggman, radTransitions.borders, function() scenes.cbs(data) end, x, y)
|
||||||
end
|
end
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
local Serializable = require "birb.classes.serializable"
|
local Serializable = require "birb.classes.serializable"
|
||||||
local CharacterManager = Serializable:extend()
|
local CharacterManager = Serializable:extend()
|
||||||
|
|
||||||
local charutils = require "game.utils.characters"
|
|
||||||
local AbstractCharacter = require "game.abstractmobs.character"
|
local AbstractCharacter = require "game.abstractmobs.character"
|
||||||
local startdata = require "datas.gamedata.startdata"
|
local startdata = require "datas.gamedata.startdata"
|
||||||
|
|
||||||
|
@ -41,7 +40,7 @@ end
|
||||||
|
|
||||||
function CharacterManager:init()
|
function CharacterManager:init()
|
||||||
for k, name in pairs(self.namelist) do
|
for k, name in pairs(self.namelist) do
|
||||||
if (charutils.charDataExists(name)) then
|
if (core.datas:exists("characters", name)) then
|
||||||
self.list[name] = AbstractCharacter(name)
|
self.list[name] = AbstractCharacter(name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,7 +8,7 @@ function EffectManager:new()
|
||||||
end
|
end
|
||||||
|
|
||||||
function EffectManager:getItemData(category, item)
|
function EffectManager:getItemData(category, item)
|
||||||
self.itemdata = itemutils.getItemData(category, item)
|
self.itemdata = core.datas:get("items", item)
|
||||||
end
|
end
|
||||||
|
|
||||||
function EffectManager:applyEffects(character)
|
function EffectManager:applyEffects(character)
|
||||||
|
|
|
@ -3,8 +3,6 @@ local LootManager = Serializable:extend()
|
||||||
local Pocket = require "game.loot.pocket"
|
local Pocket = require "game.loot.pocket"
|
||||||
local EffectManager = require "game.loot.effectManager"
|
local EffectManager = require "game.loot.effectManager"
|
||||||
|
|
||||||
local itemutils = require "game.utils.items"
|
|
||||||
|
|
||||||
function LootManager:new(controller)
|
function LootManager:new(controller)
|
||||||
self.controller = controller
|
self.controller = controller
|
||||||
self.rings = 0
|
self.rings = 0
|
||||||
|
@ -39,22 +37,18 @@ end
|
||||||
|
|
||||||
function LootManager:addItem(type, item, number)
|
function LootManager:addItem(type, item, number)
|
||||||
local pocket = self:getPocketByName(type)
|
local pocket = self:getPocketByName(type)
|
||||||
if (itemutils.itemExists(type, item)) then
|
if (core.datas:exists("items", item)) then
|
||||||
pocket:addItem(item, number)
|
pocket:addItem(item, number)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function LootManager:removeItem(type, item, number)
|
function LootManager:removeItem(type, item, number)
|
||||||
local pocket = self:getPocketByName(type)
|
local pocket = self:getPocketByName(type)
|
||||||
if (itemutils.itemExists(type, item)) then
|
if (core.datas:exists("items", item)) then
|
||||||
pocket:removeItem(item, number)
|
pocket:removeItem(item, number)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function LootManager:getItemData(type, item)
|
|
||||||
return itemutils.getItemData(type, item)
|
|
||||||
end
|
|
||||||
|
|
||||||
function LootManager:getItemNumber(type, item)
|
function LootManager:getItemNumber(type, item)
|
||||||
local pocket = self:getPocketByName(type)
|
local pocket = self:getPocketByName(type)
|
||||||
return pocket:getItemNumber(item)
|
return pocket:getItemNumber(item)
|
||||||
|
|
|
@ -5,27 +5,23 @@ function SkillManager:new(controller)
|
||||||
end
|
end
|
||||||
|
|
||||||
function SkillManager:getSkillData(skillname)
|
function SkillManager:getSkillData(skillname)
|
||||||
if self:skillDataExists(skillname) then
|
if core.datas:exists("skills", skillname) then
|
||||||
return require("datas.gamedata.skills." .. skillname )
|
return core.datas:get("skills", skillname)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function SkillManager:skillDataExists(skillname)
|
function SkillManager:skillDataExists(skillname)
|
||||||
local dir = "datas/gamedata/skills/" .. skillname .. ".lua"
|
return core.datas:exists("skills", skillname)
|
||||||
local fileinfo = love.filesystem.getInfo(dir)
|
|
||||||
return (fileinfo ~= nil)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function SkillManager:getEnnemySkillData(skillname)
|
function SkillManager:getEnnemySkillData(skillname)
|
||||||
if self:ennemySkillDataExists(skillname) then
|
if core.datas:exists("badskills", skillname) then
|
||||||
return require("datas.gamedata.ennemies.skills." .. skillname )
|
return core.datas:get("badskills", skillname)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function SkillManager:ennemySkillDataExists(skillname)
|
function SkillManager:ennemySkillDataExists(skillname)
|
||||||
local dir = "datas/gamedata/ennemies/skills/" .. skillname .. ".lua"
|
return core.datas:exists("badskills", skillname)
|
||||||
local fileinfo = love.filesystem.getInfo(dir)
|
|
||||||
return (fileinfo ~= nil)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function SkillManager:getActionArguments(choregraphyAction)
|
function SkillManager:getActionArguments(choregraphyAction)
|
||||||
|
|
|
@ -1,34 +1,5 @@
|
||||||
local BattleUtils = {}
|
local BattleUtils = {}
|
||||||
|
|
||||||
local DIR = "battles"
|
|
||||||
|
|
||||||
function BattleUtils.getBaseDirectory(lua)
|
|
||||||
return utils.datas.concatDataFolder(DIR, lua)
|
|
||||||
end
|
|
||||||
|
|
||||||
function BattleUtils.listCategories()
|
|
||||||
return love.filesystem.getDirectoryItems(BattleUtils.getBaseDirectory(false))
|
|
||||||
end
|
|
||||||
|
|
||||||
function BattleUtils.getCategoryDirectory(directory, lua)
|
|
||||||
local baseDir = BattleUtils.getBaseDirectory(lua)
|
|
||||||
return utils.datas.concatFolder(baseDir, directory, lua)
|
|
||||||
end
|
|
||||||
|
|
||||||
function BattleUtils.getDirectoryLuaStyle(directory)
|
|
||||||
return DIR .. "." .. directory
|
|
||||||
end
|
|
||||||
|
|
||||||
function BattleUtils.getBattleFromCategory(directory)
|
|
||||||
local folder = BattleUtils.getCategoryDirectory(directory, false)
|
|
||||||
return utils.datas.luaFileListToModuleList(love.filesystem.getDirectoryItems(folder))
|
|
||||||
end
|
|
||||||
|
|
||||||
function BattleUtils.getBattleData(directory, battlename)
|
|
||||||
local categoryDir = BattleUtils.getCategoryDirectory(directory, true)
|
|
||||||
return utils.datas.require(categoryDir, battlename)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- ENNEMY FUNCTIONS
|
-- ENNEMY FUNCTIONS
|
||||||
|
|
||||||
function BattleUtils.getEnnemyTypeStructure(type)
|
function BattleUtils.getEnnemyTypeStructure(type)
|
||||||
|
|
|
@ -13,18 +13,6 @@ CONST.MULT_HP = 7.5
|
||||||
CONST.SALT_HP = 35
|
CONST.SALT_HP = 35
|
||||||
CONST.MULT_MP = 1.5
|
CONST.MULT_MP = 1.5
|
||||||
|
|
||||||
local DIR = "characters"
|
|
||||||
|
|
||||||
function CharUtils.getBaseDirectory(lua)
|
|
||||||
return utils.datas.concatDataFolder(DIR, lua)
|
|
||||||
end
|
|
||||||
|
|
||||||
function CharUtils.getCharacterDirectory(name, lua)
|
|
||||||
local baseDirectory = CharUtils.getBaseDirectory(lua)
|
|
||||||
return utils.datas.concatFolder(baseDirectory, name, lua)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function CharUtils.getExpValue(level)
|
function CharUtils.getExpValue(level)
|
||||||
return math.floor( ( CONST.EXP_MULTIPLICATOR * ( level ^ 3 ) ) / CONST.EXP_RATIO )
|
return math.floor( ( CONST.EXP_MULTIPLICATOR * ( level ^ 3 ) ) / CONST.EXP_RATIO )
|
||||||
end
|
end
|
||||||
|
@ -53,21 +41,4 @@ function CharUtils.getPPValue(level, base)
|
||||||
return math.floor( (((base * CONST.MULT_MP) * level)/100) ) + CONST.BASE_MP
|
return math.floor( (((base * CONST.MULT_MP) * level)/100) ) + CONST.BASE_MP
|
||||||
end
|
end
|
||||||
|
|
||||||
function CharUtils.charDataExists(name)
|
|
||||||
local dir = CharUtils.getCharacterDirectory(name, false) .. "/init.lua"
|
|
||||||
local fileinfo = love.filesystem.getInfo(dir)
|
|
||||||
return (fileinfo ~= nil)
|
|
||||||
end
|
|
||||||
|
|
||||||
function CharUtils.getCharacterData(charname)
|
|
||||||
-- va eprmettre de récupérer les données d'un personnage
|
|
||||||
local charfolder = CharUtils.getCharacterDirectory(charname, true)
|
|
||||||
local character = utils.datas.copy(charfolder)
|
|
||||||
character.stats = utils.datas.copyDataset(charfolder, "stats")
|
|
||||||
character.inventory = utils.datas.copyDataset(charfolder, "inventory")
|
|
||||||
character.skills = utils.datas.copyDataset(charfolder, "skills")
|
|
||||||
|
|
||||||
return character
|
|
||||||
end
|
|
||||||
|
|
||||||
return CharUtils
|
return CharUtils
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
local EnnemyUtils = {}
|
|
||||||
|
|
||||||
local DIR = "ennemies"
|
|
||||||
|
|
||||||
function EnnemyUtils.getBaseDirectory(lua)
|
|
||||||
return utils.datas.concatDataFolder(DIR, lua)
|
|
||||||
end
|
|
||||||
|
|
||||||
function EnnemyUtils.listCategories()
|
|
||||||
return require(EnnemyUtils.getBaseDirectory(true))
|
|
||||||
end
|
|
||||||
|
|
||||||
function EnnemyUtils.getCategoryDirectory(directory, lua)
|
|
||||||
return utils.datas.concatFolder(EnnemyUtils.getBaseDirectory(lua), directory, lua)
|
|
||||||
end
|
|
||||||
|
|
||||||
function EnnemyUtils.getEnnemyFolder(directory, ennemy, lua)
|
|
||||||
local categoryDirectory = EnnemyUtils.getCategoryDirectory(directory, lua)
|
|
||||||
return utils.datas.concatFolder(categoryDirectory, ennemy, lua)
|
|
||||||
end
|
|
||||||
|
|
||||||
function EnnemyUtils.getEnnemiesFromCategory(directory)
|
|
||||||
local folder = EnnemyUtils.getCategoryDirectory(directory, false)
|
|
||||||
return love.filesystem.getDirectoryItems(folder)
|
|
||||||
end
|
|
||||||
|
|
||||||
function EnnemyUtils.dataExists(directory, name)
|
|
||||||
local dir = utils.datas.concatFolder(EnnemyUtils.getEnnemyFolder(directory, name, false), "init.lua", false)
|
|
||||||
local fileinfo = love.filesystem.getInfo(dir)
|
|
||||||
return (fileinfo ~= nil)
|
|
||||||
end
|
|
||||||
|
|
||||||
function EnnemyUtils.getData(directory, name)
|
|
||||||
-- va eprmettre de récupérer les données d'un personnage
|
|
||||||
local folder = EnnemyUtils.getEnnemyFolder(directory, name, true)
|
|
||||||
local ennemy = utils.datas.copy(folder)
|
|
||||||
ennemy.stats = utils.datas.copyDataset(folder, "stats")
|
|
||||||
ennemy.skills = utils.datas.copyDataset(folder, "skills")
|
|
||||||
|
|
||||||
return ennemy
|
|
||||||
end
|
|
||||||
|
|
||||||
return EnnemyUtils
|
|
|
@ -1,45 +1,5 @@
|
||||||
local ItemUtils = {}
|
local ItemUtils = {}
|
||||||
|
|
||||||
local DIR = "items"
|
|
||||||
|
|
||||||
function ItemUtils.getBaseDirectory(lua)
|
|
||||||
return utils.datas.concatDataFolder(DIR, lua)
|
|
||||||
end
|
|
||||||
|
|
||||||
function ItemUtils.listCategories()
|
|
||||||
return require(ItemUtils.getBaseDirectory(true))
|
|
||||||
end
|
|
||||||
|
|
||||||
function ItemUtils.getCategoryDirectory(directory, lua)
|
|
||||||
return utils.datas.concatFolder(ItemUtils.getBaseDirectory(lua), directory, lua)
|
|
||||||
end
|
|
||||||
|
|
||||||
function ItemUtils.getItemsFromCategory(directory)
|
|
||||||
local folder = ItemUtils.getCategoryDirectory(directory, false)
|
|
||||||
local baseTable = love.filesystem.getDirectoryItems(folder)
|
|
||||||
return utils.datas.luaFileListToModuleList(baseTable)
|
|
||||||
end
|
|
||||||
|
|
||||||
function ItemUtils.getItemFile(category, item, lua)
|
|
||||||
local dir = ItemUtils.getCategoryDirectory(category, lua)
|
|
||||||
local path = utils.datas.concatFolder(dir, item, lua)
|
|
||||||
if (not lua) then
|
|
||||||
path = path .. ".lua"
|
|
||||||
end
|
|
||||||
return path
|
|
||||||
end
|
|
||||||
|
|
||||||
function ItemUtils.itemExists(category, item)
|
|
||||||
local path = ItemUtils.getItemFile(category, item, false)
|
|
||||||
local fileinfo = love.filesystem.getInfo(path)
|
|
||||||
return (fileinfo ~= nil)
|
|
||||||
end
|
|
||||||
|
|
||||||
function ItemUtils.getItemData(category, item)
|
|
||||||
local path = ItemUtils.getItemFile(category, item, true)
|
|
||||||
return utils.datas.copy(path)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- VALIDATION FUNCTIONS
|
-- VALIDATION FUNCTIONS
|
||||||
|
|
||||||
function ItemUtils.getItemEffectStructure(type)
|
function ItemUtils.getItemEffectStructure(type)
|
||||||
|
|
|
@ -6,7 +6,7 @@ function ItemAction:new(fighter, category, item)
|
||||||
ItemAction.super.new(self, fighter)
|
ItemAction.super.new(self, fighter)
|
||||||
self.category = category
|
self.category = category
|
||||||
self.item = item
|
self.item = item
|
||||||
self.itemdata = game.loot:getItemData(category, item)
|
self.itemdata = core.datas:get("items", item)
|
||||||
self.effectManager = EffectManager()
|
self.effectManager = EffectManager()
|
||||||
self.effectManager:getItemData(category, item)
|
self.effectManager:getItemData(category, item)
|
||||||
end
|
end
|
||||||
|
|
|
@ -136,7 +136,7 @@ function widgets.ItemWidget:new(character, menu_name, item)
|
||||||
local label2 = "00"
|
local label2 = "00"
|
||||||
|
|
||||||
self.number = game.loot:getItemNumber(menu_name, item)
|
self.number = game.loot:getItemNumber(menu_name, item)
|
||||||
self.itemdata = game.loot:getItemData(menu_name, item)
|
self.itemdata = core.datas:get("items", item)
|
||||||
|
|
||||||
label2 = self.number
|
label2 = self.number
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,6 @@ local BATTLECOMPLETE_STOP = 4
|
||||||
|
|
||||||
local gui = require "game.modules.gui"
|
local gui = require "game.modules.gui"
|
||||||
|
|
||||||
local charutils = require "game.utils.characters"
|
|
||||||
|
|
||||||
local tw, th = 128, 32
|
local tw, th = 128, 32
|
||||||
|
|
||||||
function VictoryScreen:new(scene)
|
function VictoryScreen:new(scene)
|
||||||
|
|
|
@ -3,8 +3,6 @@ local menu = require "scenes.debug.menu.menu"
|
||||||
|
|
||||||
local DebugMenu = Scene:extend()
|
local DebugMenu = Scene:extend()
|
||||||
local panels = require "scenes.debug.menu.infopanel"
|
local panels = require "scenes.debug.menu.infopanel"
|
||||||
local battleutils = require "game.utils.battle"
|
|
||||||
local itemutils = require "game.utils.items"
|
|
||||||
|
|
||||||
local gui = require "game.modules.gui"
|
local gui = require "game.modules.gui"
|
||||||
local MenuBack = require "game.modules.gui.menuback"
|
local MenuBack = require "game.modules.gui.menuback"
|
||||||
|
@ -56,7 +54,7 @@ function DebugMenu:buildBattleMenu()
|
||||||
self:addSubMenu("combat", "debug", "Battle System")
|
self:addSubMenu("combat", "debug", "Battle System")
|
||||||
self:addSubMenu("launchBattle", "combat", "Launch Battle")
|
self:addSubMenu("launchBattle", "combat", "Launch Battle")
|
||||||
|
|
||||||
local listCat = battleutils.listCategories()
|
local listCat = core.datas:getCategories("battles")
|
||||||
for i,battleCat in ipairs(listCat) do
|
for i,battleCat in ipairs(listCat) do
|
||||||
self:addBattles(battleCat)
|
self:addBattles(battleCat)
|
||||||
end
|
end
|
||||||
|
@ -69,8 +67,8 @@ function DebugMenu:addBattles(battleCat)
|
||||||
local menuName = "b_" .. battleCat
|
local menuName = "b_" .. battleCat
|
||||||
self:addSubMenu(menuName, "launchBattle", battleCat)
|
self:addSubMenu(menuName, "launchBattle", battleCat)
|
||||||
|
|
||||||
for i,battleName in ipairs(battleutils.getBattleFromCategory(battleCat)) do
|
for i,battleName in ipairs(core.datas:getFromCategory("battles", battleCat)) do
|
||||||
local data = battleutils.getBattleData(battleCat, battleName)
|
local data = core.datas:get("battles", battleName)
|
||||||
menu.commons.SceneWidget(self, menuName, scenes.cbs, "Launch " .. battleName, data)
|
menu.commons.SceneWidget(self, menuName, scenes.cbs, "Launch " .. battleName, data)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -103,8 +101,8 @@ function DebugMenu:addInventory()
|
||||||
self:addSubMenu("inventory", "save", "Inventory")
|
self:addSubMenu("inventory", "save", "Inventory")
|
||||||
for i,pocket in ipairs(game.loot.inventory) do
|
for i,pocket in ipairs(game.loot.inventory) do
|
||||||
self:addSubMenu(pocket.name, "inventory", pocket.fullname)
|
self:addSubMenu(pocket.name, "inventory", pocket.fullname)
|
||||||
for j, item in ipairs(itemutils.getItemsFromCategory(pocket.name)) do
|
for j, item in ipairs(core.datas:getFromCategory("items", pocket.name)) do
|
||||||
menu.ItemWidget(self, pocket.name, itemutils.getItemData(pocket.name, item))
|
menu.ItemWidget(self, pocket.name, core.datas:get("items", item))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,8 +6,6 @@ local ChoregraphyViewer = Scene:extend()
|
||||||
local World = require "scenes.battlesystem.world"
|
local World = require "scenes.battlesystem.world"
|
||||||
local Fighter = require "scenes.debug.viewers.choregraphy.mocks.fighter"
|
local Fighter = require "scenes.debug.viewers.choregraphy.mocks.fighter"
|
||||||
|
|
||||||
local ennutils = require "game.utils.ennemies"
|
|
||||||
|
|
||||||
function ChoregraphyViewer:new()
|
function ChoregraphyViewer:new()
|
||||||
ChoregraphyViewer.super.new(self)
|
ChoregraphyViewer.super.new(self)
|
||||||
self.assets:batchImport("scenes.battlesystem.assets")
|
self.assets:batchImport("scenes.battlesystem.assets")
|
||||||
|
@ -30,7 +28,7 @@ function ChoregraphyViewer:buildMenu()
|
||||||
end
|
end
|
||||||
|
|
||||||
function ChoregraphyViewer:buildCharacterMenu()
|
function ChoregraphyViewer:buildCharacterMenu()
|
||||||
for i,category in ipairs(ennutils.listCategories()) do
|
for i,category in ipairs(core.datas:getCategories("ennemies")) do
|
||||||
self:buildEnnemyListMenu(category)
|
self:buildEnnemyListMenu(category)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -44,14 +42,14 @@ end
|
||||||
|
|
||||||
function ChoregraphyViewer:buildEnnemyListMenu(category)
|
function ChoregraphyViewer:buildEnnemyListMenu(category)
|
||||||
self:addSubMenu(category, "MainMenu", category)
|
self:addSubMenu(category, "MainMenu", category)
|
||||||
for i,ennemy in ipairs(ennutils.getEnnemiesFromCategory(category)) do
|
for i,ennemy in ipairs(core.datas.getFromCategory("ennemies", category)) do
|
||||||
self:buildEnnemySkillMenu(category, ennemy)
|
self:buildEnnemySkillMenu(category, ennemy)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ChoregraphyViewer:buildEnnemySkillMenu(category, ennemy)
|
function ChoregraphyViewer:buildEnnemySkillMenu(category, ennemy)
|
||||||
self:addSubMenu(ennemy, category, ennemy)
|
self:addSubMenu(ennemy, category, ennemy)
|
||||||
local data = ennutils.getData(category, ennemy)
|
local data = core.datas:get("ennemies", ennemy)
|
||||||
for j,skillName in ipairs(data.skills) do
|
for j,skillName in ipairs(data.skills) do
|
||||||
if (game.skills:ennemySkillDataExists(skillName)) then
|
if (game.skills:ennemySkillDataExists(skillName)) then
|
||||||
menu.EnnemyChoregraphyWidget(self, category, ennemy, game.skills:getEnnemySkillData(skillName))
|
menu.EnnemyChoregraphyWidget(self, category, ennemy, game.skills:getEnnemySkillData(skillName))
|
||||||
|
|
|
@ -4,7 +4,6 @@ local SaveMenu = RadianceMenu:extend()
|
||||||
local SaveWidget = RadianceWidget:extend()
|
local SaveWidget = RadianceWidget:extend()
|
||||||
|
|
||||||
local gui = require "game.modules.gui"
|
local gui = require "game.modules.gui"
|
||||||
local charutils = require "game.utils.characters"
|
|
||||||
|
|
||||||
local defTransitions = require "birb.modules.transitions"
|
local defTransitions = require "birb.modules.transitions"
|
||||||
local radTransitions = require "game.modules.transitions"
|
local radTransitions = require "game.modules.transitions"
|
||||||
|
@ -50,7 +49,7 @@ function SaveWidget:drawCanvas()
|
||||||
self.font:draw(str, basex + 8, basey + 4)
|
self.font:draw(str, basex + 8, basey + 4)
|
||||||
|
|
||||||
for i, charName in ipairs(self.savedata.team) do
|
for i, charName in ipairs(self.savedata.team) do
|
||||||
local data = charutils.getCharacterData(charName)
|
local data = core.datas:get("characters", charName)
|
||||||
local x = 18*(#self.savedata.team - i + 1) + 4 + basex
|
local x = 18*(#self.savedata.team - i + 1) + 4 + basex
|
||||||
self.scene.assets.tileset["charicons"]:drawTile(data.icon,self.width - x, basey + 4)
|
self.scene.assets.tileset["charicons"]:drawTile(data.icon,self.width - x, basey + 4)
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,7 +8,6 @@ local const = require "scenes.overworld.screens.mainmenu.const"
|
||||||
local EquipMenu = menu.ListMenu:extend()
|
local EquipMenu = menu.ListMenu:extend()
|
||||||
local EquipWidget = menu.DualTextWidget:extend()
|
local EquipWidget = menu.DualTextWidget:extend()
|
||||||
|
|
||||||
local itemutils = require "game.utils.items"
|
|
||||||
local STATS = require "datas.stats"
|
local STATS = require "datas.stats"
|
||||||
|
|
||||||
function StatPage:new(view, character)
|
function StatPage:new(view, character)
|
||||||
|
@ -75,7 +74,7 @@ function EquipWidget:getLabel()
|
||||||
if (utils.string.isEmpty(obj)) then
|
if (utils.string.isEmpty(obj)) then
|
||||||
return "No " .. self.type
|
return "No " .. self.type
|
||||||
end
|
end
|
||||||
local data = itemutils.getItemData(self.type, obj)
|
local data = core.datas:get("items", obj)
|
||||||
return data.fullname
|
return data.fullname
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ local CharacterWidget = baseWidget:extend()
|
||||||
|
|
||||||
local ComplexHPBar = require "game.modules.gui.complexhpbar"
|
local ComplexHPBar = require "game.modules.gui.complexhpbar"
|
||||||
local Emblem = require "game.modules.gui.emblem"
|
local Emblem = require "game.modules.gui.emblem"
|
||||||
local itemutils = require "game.utils.items"
|
|
||||||
|
|
||||||
-- Hero custom widget
|
-- Hero custom widget
|
||||||
--
|
--
|
||||||
|
@ -40,7 +39,7 @@ function CharacterWidget:drawCanvas()
|
||||||
local charEquip = character.equip[self.showEquip]
|
local charEquip = character.equip[self.showEquip]
|
||||||
local equipString = "None"
|
local equipString = "None"
|
||||||
if (not utils.string.isEmpty(charEquip)) then
|
if (not utils.string.isEmpty(charEquip)) then
|
||||||
local data = itemutils.getItemData(self.showEquip, charEquip)
|
local data = core.datas:get("items", charEquip)
|
||||||
equipString = data.fullname
|
equipString = data.fullname
|
||||||
end
|
end
|
||||||
self.font:draw(equipString, xDebut, debut + 16, -1, "left")
|
self.font:draw(equipString, xDebut, debut + 16, -1, "left")
|
||||||
|
|
|
@ -17,7 +17,7 @@ local DESC_SIZE = 32 * 6
|
||||||
function EquipScreen:new(scene, category, item, widgetId)
|
function EquipScreen:new(scene, category, item, widgetId)
|
||||||
self.category = category
|
self.category = category
|
||||||
self.item = item
|
self.item = item
|
||||||
self.itemData = game.loot:getItemData(category, self.item.name)
|
self.itemData = core.datas:get("items", self.item.name)
|
||||||
self.widgetId = widgetId
|
self.widgetId = widgetId
|
||||||
|
|
||||||
self.choiceBack = gui.newChoiceBack(48 + 16)
|
self.choiceBack = gui.newChoiceBack(48 + 16)
|
||||||
|
|
|
@ -144,7 +144,7 @@ end
|
||||||
-- Items Widgets
|
-- Items Widgets
|
||||||
function ItemWidget:new(scene, pocket, item, widgetId)
|
function ItemWidget:new(scene, pocket, item, widgetId)
|
||||||
self.item = item
|
self.item = item
|
||||||
self.itemData = game.loot:getItemData(pocket, self.item.name)
|
self.itemData = core.datas:get("items", self.item.name)
|
||||||
self.pocket = pocket
|
self.pocket = pocket
|
||||||
self.widgetId = widgetId
|
self.widgetId = widgetId
|
||||||
ItemWidget.super.new(self, scene, "menu", self.itemData.fullname, "x" .. utils.math.numberToString(self.item.number, 2))
|
ItemWidget.super.new(self, scene, "menu", self.itemData.fullname, "x" .. utils.math.numberToString(self.item.number, 2))
|
||||||
|
@ -178,7 +178,7 @@ end
|
||||||
|
|
||||||
function UseWidget:new(scene, pocket, item, widgetId)
|
function UseWidget:new(scene, pocket, item, widgetId)
|
||||||
self.item = item
|
self.item = item
|
||||||
self.itemData = game.loot:getItemData(pocket, self.item.name)
|
self.itemData = core.datas:get("items", self.item.name)
|
||||||
self.pocket = pocket
|
self.pocket = pocket
|
||||||
self.pocketData = game.loot:getPocketByName(self.pocket)
|
self.pocketData = game.loot:getPocketByName(self.pocket)
|
||||||
self.widgetId = widgetId
|
self.widgetId = widgetId
|
||||||
|
@ -202,7 +202,7 @@ end
|
||||||
|
|
||||||
function DropWidget:new(scene, pocket, item, widgetId)
|
function DropWidget:new(scene, pocket, item, widgetId)
|
||||||
self.item = item
|
self.item = item
|
||||||
self.itemData = game.loot:getItemData(pocket, self.item.name)
|
self.itemData = core.datas:get("items", self.item.name)
|
||||||
self.pocket = pocket
|
self.pocket = pocket
|
||||||
self.max = self.item.number
|
self.max = self.item.number
|
||||||
self.widgetId = widgetId
|
self.widgetId = widgetId
|
||||||
|
|
|
@ -18,7 +18,7 @@ function UseItemsScreen:new(scene, category, item, widgetId)
|
||||||
UseItemsScreen.super.new(self, scene, "Use item")
|
UseItemsScreen.super.new(self, scene, "Use item")
|
||||||
self.category = category
|
self.category = category
|
||||||
self.item = item
|
self.item = item
|
||||||
self.itemData = game.loot:getItemData(category, self.item.name)
|
self.itemData = core.datas:get("items", self.item.name)
|
||||||
self.widgetId = widgetId
|
self.widgetId = widgetId
|
||||||
|
|
||||||
self.choiceBack = gui.newChoiceBack(48 + 16)
|
self.choiceBack = gui.newChoiceBack(48 + 16)
|
||||||
|
|
Loading…
Reference in a new issue