Starting player's inventory

pull/2/head
bgiraudr 5 months ago
parent 3c15b5d4a5
commit 3d3361151b
  1. 21
      assets-cg/converters.py
  2. 4
      assets-cg/items/1.json
  3. 4
      assets-cg/items/2.json
  4. 3
      assets-cg/items/fxconv-metadata.txt
  5. 0
      assets-cg/items/items.txt
  6. 2
      assets-cg/maps/testCarte.tmx

@ -15,6 +15,9 @@ def convert(input, output, params, target):
elif params["custom-type"] == "player_moves":
convert_player_moves(input, output, params, target)
return 0
elif params["custom-type"] == "items":
convert_items(input, output, params, target)
return 0
else:
return 1
@ -294,4 +297,20 @@ def convert_player_moves(input, output, params, target):
levelup += fxconv.u32(int(i.split(":")[1]))
levelupplayer += fxconv.ptr(levelup)
fxconv.elf(levelupplayer, output, "_" + params["name"], **target)
fxconv.elf(levelupplayer, output, "_" + params["name"], **target)
def convert_items(input, output, params, target):
liste_file = list(pathlib.Path(input).parent.glob('*.json'))
items = fxconv.Structure()
items += fxconv.u32(len(liste_file))
for f in liste_file:
file = open(f,"r")
data = json.load(file)
item = fxconv.Structure()
item += fxconv.string(data["name"])
item += fxconv.u32(data["id"])
items += fxconv.ptr(item)
fxconv.elf(items, output, "_" + params["name"], **target)

@ -0,0 +1,4 @@
{
"name":"Test1",
"id":1
}

@ -0,0 +1,4 @@
{
"name":"Obj2",
"id":2
}

@ -0,0 +1,3 @@
items.txt:
custom-type: items
name: items

@ -182,7 +182,7 @@
<object id="61" gid="267" x="464" y="432" width="16" height="16">
<properties>
<property name="name" value="Pancarte"/>
<property name="text" value="De quoi bien commencer l'aventure !;~xp:500;De rien :)"/>
<property name="text" value="De quoi bien commencer l'aventure !;~move:3;De rien :)"/>
</properties>
</object>
</objectgroup>

Loading…
Cancel
Save