|
@ -2,6 +2,9 @@ package org.bitbiome.entities; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.bitbiome.classes.JsonParser; |
|
|
import org.bitbiome.classes.JsonParser; |
|
|
|
|
|
import org.json.JSONArray; |
|
|
|
|
|
import org.json.JSONObject; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
@ -23,6 +26,14 @@ public class Player { |
|
|
hp = 100.0F; |
|
|
hp = 100.0F; |
|
|
location = new Location(JsonParser.getJSONObject("src/main/resources/playerconfig.json").getString("currentLocation"), new ArrayList<>(), new ArrayList<>()); |
|
|
location = new Location(JsonParser.getJSONObject("src/main/resources/playerconfig.json").getString("currentLocation"), new ArrayList<>(), new ArrayList<>()); |
|
|
inventory = 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() { |
|
|
public Player() { |
|
@ -69,4 +80,7 @@ public class Player { |
|
|
|
|
|
|
|
|
public int setGold(int gold) { this.gold = gold; return gold; } |
|
|
public int setGold(int gold) { this.gold = gold; return gold; } |
|
|
|
|
|
|
|
|
|
|
|
public void setInventory(ArrayList<Item> inventory) { |
|
|
|
|
|
this.inventory = inventory; |
|
|
|
|
|
} |
|
|
} |
|
|
} |