Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: e023251e9d
Fetching contributors…

Cannot retrieve contributors at this time

46 lines (44 sloc) 1.319 kB
id_to_canonical_card = {}
name_to_ids = {}
function cards_init()
local file = love.filesystem.newFile("swogi.json")
file:open("r")
local teh_json = file:read(file:getSize())
decoded = json.decode(teh_json)
decoded.id_to_card.ID = nil
decoded.name_to_ids.NAME = nil
decoded.name_to_ids["KR NAME"] = nil
cards = decoded.id_to_card
for id,in_card in pairs(cards) do
id = id + 0
print("LOADING "..id)
card = {}
id_to_canonical_card[id] = card
card.type = in_card.type:lower()
card.faction = in_card.faction[1]
card.name = in_card.name
card.id = in_card.id + 0
if card.type == "follower" then
card.atk = in_card.attack + 0
card.def = in_card.defense + 0
card.sta = in_card.stamina + 0
card.size = in_card.size + 0
elseif card.type == "spell" then
card.size = in_card.size + 0
elseif card.type == "character" then
card.life = in_card.life + 0
else
print("Got card "..in_card.name.." with id "..in_card.id..
" and unexpected type "..card.type)
end
end
for name,ids in pairs(decoded.name_to_ids) do
for i=1,#ids do
ids[i] = ids[i] + 0
end
end
for id,skills in pairs(decoded.id_to_skills) do
id_to_canonical_card[id+0].skills = skills
end
name_to_ids = decoded.name_to_ids
end
Jump to Line
Something went wrong with that request. Please try again.