Browse Source

Merging

remotes/origin/develop
Tanja Herche 2 years ago
parent
commit
bc849695a6
  1. 4
      playerconfig.json
  2. 14
      src/main/java/org/bitbiome/entities/Player.java
  3. 18
      src/main/resources/gameconfig.json
  4. 44
      src/main/resources/items.json

4
playerconfig.json

@ -1,6 +1,6 @@
{
"gold": 0,
"name": "Julia",
"name": "null",
"hp": 10,
"inventory": [
{
@ -20,5 +20,5 @@
"doesDamage": true
}
],
"currentLocation": "Wald"
"currentLocation": "Berge"
}

14
src/main/java/org/bitbiome/entities/Player.java

@ -2,6 +2,9 @@ package org.bitbiome.entities;
import org.bitbiome.classes.JsonParser;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
@ -23,6 +26,14 @@ public class Player {
hp = 100.0F;
location = new Location(JsonParser.getJSONObject("src/main/resources/playerconfig.json").getString("currentLocation"), new ArrayList<>(), new ArrayList<>());
inventory = new ArrayList<>();
JSONArray items = JsonParser.getJSONObject("src/main/resources/playerconfig.json").getJSONArray("inventory");
for (int i = 0; i < items.length(); i++) {
JSONObject o = items.getJSONObject(i);
inventory.add(new Item(o.getString("name"), o.getBoolean("doesDamage"), o.getString("damage"), o.getInt("amount"), o.getInt("gold")));
}
}
public Player() {
@ -69,4 +80,7 @@ public class Player {
public int setGold(int gold) { this.gold = gold; return gold; }
public void setInventory(ArrayList<Item> inventory) {
this.inventory = inventory;
}
}

18
src/main/resources/gameconfig.json

@ -1,19 +1,19 @@
{
"shopitems": [
{
"gold": 1000,
"amount": 1,
"name": "Heiliges Schwert der Engel"
"gold": 10,
"amount": 10,
"name": "Holz"
},
{
"gold": 2,
"amount": 450,
"name": "Knochen"
"gold": 3,
"amount": 400,
"name": "Loewenkralle"
},
{
"gold": 1,
"amount": 100,
"name": "Schnee"
"gold": 3,
"amount": 200,
"name": "Drachenhaut"
}
],
"locations": [

44
src/main/resources/items.json

@ -1,4 +1,3 @@
<<<<<<< HEAD
[
{
"name": "Holz",
@ -180,45 +179,4 @@
"amountShop": 700,
"gold": 2
}
]
=======
[
{
"name": "Holz",
"damage": "1-3",
"crafting": true,
"doesDamage": true,
"durability": 1000,
"amountShop": 10,
"gold": 10
},
{
"name": "Heiliges Schwert der Engel",
"damage": "1000",
"crafting": false,
"doesDamage": true,
"durability": 1000,
"amountShop": 1,
"gold": 1000
},
{
"name": "Stein",
"damage": "5-10",
"crafting": true,
"doesDamage": true,
"durability": 1000,
"amountShop": 1500,
"gold": 2
},
{
"name": "Fell",
"damage": "0",
"crafting": true,
"doesDamage": false,
"durability": 1000,
"amountShop": 500,
"gold": 100
}
]
>>>>>>> 1ffe7490e8fd33b80231ec4852d6ca37658dcd5f
]
Loading…
Cancel
Save