fixed inventory and improved saving
This commit is contained in:
parent
6fac3fdeee
commit
227c6751fc
138
src/main/java/ruscz/game/gameOfProd/Cells/ChestCell.java
Normal file
138
src/main/java/ruscz/game/gameOfProd/Cells/ChestCell.java
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
package ruscz.game.gameOfProd.Cells;
|
||||||
|
|
||||||
|
import ruscz.game.gameOfProd.Dialog.Dialog;
|
||||||
|
import ruscz.game.gameOfProd.Image.ImageCell;
|
||||||
|
import ruscz.game.gameOfProd.Inventory.InventoryManager;
|
||||||
|
import ruscz.game.gameOfProd.Inventory.Item;
|
||||||
|
import ruscz.game.gameOfProd.Windows.WindowOfFreeMove;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
public class ChestCell extends InteractionCell {
|
||||||
|
private LinkedList<Item> chestInventory;
|
||||||
|
private boolean showItem;
|
||||||
|
private boolean isActive;
|
||||||
|
|
||||||
|
public ChestCell(int x, int y, String inventory, Dialog dialog, ImageCell imageCell, WindowOfFreeMove window, boolean paint) {
|
||||||
|
super(x, y, null, dialog, imageCell, window, paint);
|
||||||
|
this.showItem = false;
|
||||||
|
this.chestInventory = new LinkedList<>();
|
||||||
|
this.isActive = true;
|
||||||
|
fillChest(inventory);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ChestCell(int x, int y, String inventory, Dialog dialog, ImageCell imageCell, WindowOfFreeMove window) {
|
||||||
|
super(x, y, null, dialog, imageCell, window, false);
|
||||||
|
this.showItem = true;
|
||||||
|
this.chestInventory = new LinkedList<>();
|
||||||
|
this.isActive = true;
|
||||||
|
fillChest(inventory);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fillChest(String inventory) {
|
||||||
|
try {
|
||||||
|
File inventoryInfo = new File("src/main/resources/chests/" + inventory + ".txt");
|
||||||
|
Scanner scanner = new Scanner(inventoryInfo);
|
||||||
|
while (scanner.hasNextLine()) {
|
||||||
|
String[] itemData = scanner.nextLine().split(" ");
|
||||||
|
if(itemData[0].equals("<message>")) this.message = itemData[1];
|
||||||
|
else {
|
||||||
|
if (itemData.length == 4) {
|
||||||
|
Item item = new Item(itemData[0], Integer.parseInt(itemData[1]), Integer.parseInt(itemData[2]), itemData[3]);
|
||||||
|
chestInventory.add(item);
|
||||||
|
} else {
|
||||||
|
Item item = new Item(itemData[0], Integer.parseInt(itemData[1]), itemData[2]);
|
||||||
|
chestInventory.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void putItemToInventory() {
|
||||||
|
if (chestInventory.size() == 0) {
|
||||||
|
endEvent();
|
||||||
|
isActive = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Item item = chestInventory.getFirst();
|
||||||
|
InventoryManager.addItem(item);
|
||||||
|
chestInventory.remove(item);
|
||||||
|
String data = item.getName() + " was added to your inventory.";
|
||||||
|
dialog.hideText();
|
||||||
|
dialog.setText(data);
|
||||||
|
dialog.showText();
|
||||||
|
if (chestInventory.size() == 0 && message == null) {
|
||||||
|
showItem = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startEvent() {
|
||||||
|
if (message != null)
|
||||||
|
super.startEvent();
|
||||||
|
else readNextLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readNextLine() {
|
||||||
|
if (message != null) {
|
||||||
|
if (scanner.hasNextLine() && !dialog.getTimerIsRunning()) {
|
||||||
|
String data = scanner.nextLine();
|
||||||
|
if (data.equals("<end>")) {
|
||||||
|
isActive = false;
|
||||||
|
endEvent();
|
||||||
|
}
|
||||||
|
else if (data.equals("<item>")) {
|
||||||
|
putItemToInventory();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (data.contains("<br/>"))
|
||||||
|
data = "<html>" + data + "</html>";
|
||||||
|
dialog.hideText();
|
||||||
|
dialog.setText(data);
|
||||||
|
dialog.showText();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dialog.skipShowText();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
putItemToInventory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void paint(Graphics2D g) {
|
||||||
|
if (showItem)
|
||||||
|
g.drawImage(super.getImageCell().getImagesOfItems().get(chestInventory.getFirst().getImage()), getX() * getSize(),
|
||||||
|
getY() * getSize(), getSize() / 2, getSize() / 2, null);
|
||||||
|
else if (paint) {
|
||||||
|
g.drawImage(super.getImageCell().getImagesOfTiles().get(super.getImageCell().getImageFromCellMap("CHEST")), getX() * getSize(),
|
||||||
|
getY() * getSize(), getSize(), getSize(), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isActive() {
|
||||||
|
return isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActive(boolean active) {
|
||||||
|
isActive = active;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getPaint() {
|
||||||
|
return paint;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getShowItem() {
|
||||||
|
return showItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -15,10 +15,10 @@ import java.util.Scanner;
|
|||||||
public class InteractionCell extends Cell {
|
public class InteractionCell extends Cell {
|
||||||
protected String message;
|
protected String message;
|
||||||
protected ruscz.game.gameOfProd.Dialog.Dialog dialog;
|
protected ruscz.game.gameOfProd.Dialog.Dialog dialog;
|
||||||
private Scanner scanner;
|
protected Scanner scanner;
|
||||||
private ImageCell imageCell;
|
private ImageCell imageCell;
|
||||||
private WindowOfFreeMove window;
|
private WindowOfFreeMove window;
|
||||||
private boolean paint;
|
protected boolean paint;
|
||||||
|
|
||||||
public InteractionCell(int x, int y, String message, Dialog dialog, ImageCell imageCell, WindowOfFreeMove window, boolean paint) {
|
public InteractionCell(int x, int y, String message, Dialog dialog, ImageCell imageCell, WindowOfFreeMove window, boolean paint) {
|
||||||
super(x, y, WindowOfFreeMove.CELL_SIZE, Color.ORANGE);
|
super(x, y, WindowOfFreeMove.CELL_SIZE, Color.ORANGE);
|
||||||
@ -93,11 +93,11 @@ public class InteractionCell extends Cell {
|
|||||||
else if (data.contains("<additem>")) {
|
else if (data.contains("<additem>")) {
|
||||||
String[] dialogInfo = data.split(" ");
|
String[] dialogInfo = data.split(" ");
|
||||||
Item item;
|
Item item;
|
||||||
if (dialogInfo.length == 4) {
|
if (dialogInfo.length == 5) {
|
||||||
item = new Item(dialogInfo[1], Integer.parseInt(dialogInfo[2]), dialogInfo[3]);
|
item = new Item(dialogInfo[1], Integer.parseInt(dialogInfo[2]), Integer.parseInt(dialogInfo[3]), dialogInfo[4]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
item = new Item(dialogInfo[1], dialogInfo[2]);
|
item = new Item(dialogInfo[1], Integer.parseInt(dialogInfo[2]), dialogInfo[3]);
|
||||||
}
|
}
|
||||||
InventoryManager.addItem(item);
|
InventoryManager.addItem(item);
|
||||||
String name = dialogInfo[1].replace("-", " ");
|
String name = dialogInfo[1].replace("-", " ");
|
||||||
|
|||||||
@ -110,19 +110,19 @@ public class Person extends Cell {
|
|||||||
else {
|
else {
|
||||||
door.readNextLine();
|
door.readNextLine();
|
||||||
}
|
}
|
||||||
} else if (isItemInFront(x, y, directionSight)) {
|
} else if (isChestInFront(x, y, directionSight)) {
|
||||||
if (!isInEvent) {
|
if (!isInEvent) {
|
||||||
isInEvent = true;
|
isInEvent = true;
|
||||||
map.findItemByXY(x, y, directionSight).startEvent();
|
map.findChestByXY(x, y, directionSight).startEvent();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
map.findItemByXY(x, y, directionSight).endEvent();
|
map.findChestByXY(x, y, directionSight).readNextLine();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (directionMove != WindowOfFreeMove.KEY_EVENT) {
|
if (directionMove != WindowOfFreeMove.KEY_EVENT) {
|
||||||
if (directionMove != 0 && !map.isBusyCell(x, y, true) && !map.isInteractionCell(x, y) && !map.isClosedDoor(x, y) && !map.isItem(x, y)) {
|
if (directionMove != 0 && !map.isBusyCell(x, y, true) && !map.isInteractionCell(x, y) && !map.isClosedDoor(x, y) && !map.isChest(x, y)) {
|
||||||
directionMoveLast = directionMove;
|
directionMoveLast = directionMove;
|
||||||
isMoving = true;
|
isMoving = true;
|
||||||
} else if (directionMove != 0 && map.isBusyCell(x, y, true)) {
|
} else if (directionMove != 0 && map.isBusyCell(x, y, true)) {
|
||||||
@ -131,7 +131,7 @@ public class Person extends Cell {
|
|||||||
directionMoveLast = 0;
|
directionMoveLast = 0;
|
||||||
} else if (directionMove != 0 && map.isClosedDoor(x, y)) {
|
} else if (directionMove != 0 && map.isClosedDoor(x, y)) {
|
||||||
directionMoveLast = 0;
|
directionMoveLast = 0;
|
||||||
} else if (directionMove != 0 && map.isItem(x, y)) {
|
} else if (directionMove != 0 && map.isChest(x, y)) {
|
||||||
directionMoveLast = 0;
|
directionMoveLast = 0;
|
||||||
}
|
}
|
||||||
if (map.isCellMoveTo(x, y) && !map.isClosedDoor(x, y)) {
|
if (map.isCellMoveTo(x, y) && !map.isClosedDoor(x, y)) {
|
||||||
@ -141,7 +141,7 @@ public class Person extends Cell {
|
|||||||
map.findEventByXY(x, y).moveToMap();
|
map.findEventByXY(x, y).moveToMap();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!map.isInteractionCell(x, y) && !map.isBusyCell(x, y, true) && !map.isClosedDoor(x, y) && !map.isItem(x, y)) {
|
if (!map.isInteractionCell(x, y) && !map.isBusyCell(x, y, true) && !map.isClosedDoor(x, y) && !map.isChest(x, y)) {
|
||||||
set(x, y);
|
set(x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -171,9 +171,9 @@ public class Person extends Cell {
|
|||||||
return map.isDoor(coords[0], coords[1]);
|
return map.isDoor(coords[0], coords[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isItemInFront(int x, int y, int directionSight) {
|
private boolean isChestInFront(int x, int y, int directionSight) {
|
||||||
int[] coords = map.directionSightSwitch(x, y, directionSight);
|
int[] coords = map.directionSightSwitch(x, y, directionSight);
|
||||||
return map.isActiveItem(coords[0], coords[1]);
|
return map.isActiveChest(coords[0], coords[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopPerson(){
|
public void stopPerson(){
|
||||||
@ -287,4 +287,8 @@ public class Person extends Cell {
|
|||||||
public static void setInEvent(boolean isInEvent) {
|
public static void setInEvent(boolean isInEvent) {
|
||||||
Person.isInEvent = isInEvent;
|
Person.isInEvent = isInEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getDirectionSight() {
|
||||||
|
return directionSight;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,70 +1,29 @@
|
|||||||
package ruscz.game.gameOfProd.Inventory;
|
package ruscz.game.gameOfProd.Inventory;
|
||||||
|
|
||||||
import ruscz.game.gameOfProd.Cells.InteractionCell;
|
public class Item {
|
||||||
import ruscz.game.gameOfProd.Cells.Person;
|
|
||||||
import ruscz.game.gameOfProd.Dialog.Dialog;
|
|
||||||
import ruscz.game.gameOfProd.Image.ImageCell;
|
|
||||||
import ruscz.game.gameOfProd.Windows.WindowOfFreeMove;
|
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
public class Item extends InteractionCell {
|
|
||||||
private ItemAction itemAction;
|
private ItemAction itemAction;
|
||||||
private String name;
|
private String name;
|
||||||
private int multiplicity;
|
private int multiplicity;
|
||||||
private int image;
|
private int image;
|
||||||
private boolean isActive;
|
|
||||||
|
|
||||||
public Item(int x, int y, String name, Dialog dialog, ImageCell imageCell, WindowOfFreeMove window, int multiplicity, int image, String itemAction) {
|
public Item(String name, int multiplicity, int image, String itemAction) {
|
||||||
super(x, y, null, dialog, imageCell, window, true);
|
this.name = parseName(name);
|
||||||
message = parseNameToMessage(name);
|
|
||||||
this.image = image;
|
this.image = image;
|
||||||
this.multiplicity = multiplicity;
|
this.multiplicity = multiplicity;
|
||||||
setItemActionByName(itemAction);
|
setItemActionByName(itemAction);
|
||||||
this.isActive = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item(int x, int y, String name, Dialog dialog, ImageCell imageCell, WindowOfFreeMove window, int image, String itemAction) {
|
public Item(String name, int image, String itemAction) {
|
||||||
super(x, y, null, dialog, imageCell, window, true);
|
this.name = parseName(name);
|
||||||
message = parseNameToMessage(name);
|
|
||||||
this.image = image;
|
this.image = image;
|
||||||
this.multiplicity = 1;
|
this.multiplicity = 1;
|
||||||
setItemActionByName(itemAction);
|
setItemActionByName(itemAction);
|
||||||
this.isActive = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item(String name, String itemAction) {
|
private String parseName(String name) {
|
||||||
super(-1, -1, null, null, null, null, true);
|
name = name.replace("-", " ");
|
||||||
message = parseNameToMessage(name);
|
name = name.substring(0, 1).toUpperCase() + name.substring(1);
|
||||||
this.multiplicity = 1;
|
return name;
|
||||||
setItemActionByName(itemAction);
|
|
||||||
this.isActive = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Item(String name, int multiplicity, String itemAction) {
|
|
||||||
super(-1, -1, null, null, null, null, true);
|
|
||||||
message = parseNameToMessage(name);
|
|
||||||
this.multiplicity = multiplicity;
|
|
||||||
setItemActionByName(itemAction);
|
|
||||||
this.isActive = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void startEvent() {
|
|
||||||
WindowOfFreeMove.setCanPersonMove(false);
|
|
||||||
this.dialog.hideText();
|
|
||||||
this.dialog.setText(message);
|
|
||||||
this.dialog.showText();
|
|
||||||
InventoryManager.addItem(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void endEvent() {
|
|
||||||
this.isActive = false;
|
|
||||||
this.dialog.hideText();
|
|
||||||
this.dialog.setImageDialog(null);
|
|
||||||
Person.setInEvent(false);
|
|
||||||
WindowOfFreeMove.setCanPersonMove(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setItemActionByName(String action) {
|
private void setItemActionByName(String action) {
|
||||||
@ -87,32 +46,13 @@ public class Item extends InteractionCell {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String parseNameToMessage(String name) {
|
|
||||||
name = name.replace("-", " ");
|
|
||||||
this.name = name.substring(0,1).toUpperCase() + name.substring(1);
|
|
||||||
String message = this.name + " was added to your inventory.";
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() { return name; }
|
public String getName() { return name; }
|
||||||
|
|
||||||
public int getImage() { return image; }
|
public int getImage() { return image; }
|
||||||
|
|
||||||
public int getMultiplicity() { return multiplicity; }
|
public int getMultiplicity() { return multiplicity; }
|
||||||
|
|
||||||
public void hideItem() {
|
public ItemAction getItemAction() {
|
||||||
isActive = false;
|
return itemAction;
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isActive() {
|
|
||||||
return isActive;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void paint(Graphics2D g) {
|
|
||||||
if (isActive) {
|
|
||||||
g.drawImage(super.getImageCell().getImagesOfItems().get(image), getX() * getSize(),
|
|
||||||
getY() * getSize(), getSize() / 2, getSize() / 2, null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,7 +21,7 @@ public class Map {
|
|||||||
private LinkedList<InteractionCell> interactionCells;
|
private LinkedList<InteractionCell> interactionCells;
|
||||||
private LinkedList<TriggerCell> triggerCells;
|
private LinkedList<TriggerCell> triggerCells;
|
||||||
private LinkedList<DoorCell> doorCells;
|
private LinkedList<DoorCell> doorCells;
|
||||||
private LinkedList<Item> items;
|
private LinkedList<ChestCell> chestCells;
|
||||||
private LinkedList<Npc> npcs;
|
private LinkedList<Npc> npcs;
|
||||||
private int idExit;
|
private int idExit;
|
||||||
private ImageCell imageCell;
|
private ImageCell imageCell;
|
||||||
@ -30,14 +30,14 @@ public class Map {
|
|||||||
private static Scanner scanner;
|
private static Scanner scanner;
|
||||||
|
|
||||||
public Map(TypeOfCell[][] mapArray) {
|
public Map(TypeOfCell[][] mapArray) {
|
||||||
idExit = 0;
|
idExit = -1;
|
||||||
moveToCells = new LinkedList<>();
|
moveToCells = new LinkedList<>();
|
||||||
interactionCells = new LinkedList<>();
|
interactionCells = new LinkedList<>();
|
||||||
triggerCells = new LinkedList<>();
|
triggerCells = new LinkedList<>();
|
||||||
doorCells = new LinkedList<>();
|
doorCells = new LinkedList<>();
|
||||||
block = new LinkedList<>();
|
block = new LinkedList<>();
|
||||||
imageCell = new ImageCell();
|
imageCell = new ImageCell();
|
||||||
items = new LinkedList<>();
|
chestCells = new LinkedList<>();
|
||||||
npcs = new LinkedList<>();
|
npcs = new LinkedList<>();
|
||||||
this.mapArray = mapArray;
|
this.mapArray = mapArray;
|
||||||
person = new Person(this);
|
person = new Person(this);
|
||||||
@ -111,18 +111,19 @@ public class Map {
|
|||||||
map.addInteractionEvent(new TriggerCell(x, y, trigger[1], new Dialog(window.getDialogBar()), map.getImageCell(), window));
|
map.addInteractionEvent(new TriggerCell(x, y, trigger[1], new Dialog(window.getDialogBar()), map.getImageCell(), window));
|
||||||
} else if (line[x].equals("SPAWN")) {
|
} else if (line[x].equals("SPAWN")) {
|
||||||
map.setSpawnPoint(x, y);
|
map.setSpawnPoint(x, y);
|
||||||
|
map.idExit = 0;
|
||||||
} else if (line[x].contains("DOOR") && !line[x].contains("DOORTO")) {
|
} else if (line[x].contains("DOOR") && !line[x].contains("DOORTO")) {
|
||||||
String[] door = line[x].split(",");
|
String[] door = line[x].split(",");
|
||||||
if (door.length == 2)
|
if (door.length == 2)
|
||||||
map.addInteractionEvent(new DoorCell(x, y, Boolean.parseBoolean(door[1]), map.getImageCell(), window));
|
map.addInteractionEvent(new DoorCell(x, y, Boolean.parseBoolean(door[1]), map.getImageCell(), window));
|
||||||
else
|
else
|
||||||
map.addInteractionEvent(new DoorCell(x, y, Boolean.parseBoolean(door[1]), door[2], new Dialog(window.getDialogBar()), map.getImageCell(), window));
|
map.addInteractionEvent(new DoorCell(x, y, Boolean.parseBoolean(door[1]), door[2], new Dialog(window.getDialogBar()), map.getImageCell(), window));
|
||||||
} else if (line[x].contains("ITEM")) {
|
} else if (line[x].contains("CHEST")) {
|
||||||
String[] item = line[x].split(",");
|
String[] chest = line[x].split(",");
|
||||||
if (item.length == 5)
|
if (chest.length == 3)
|
||||||
map.addInteractionEvent(new Item(x, y, item[1], new Dialog(window.getDialogBar()), map.getImageCell(), window, Integer.parseInt(item[2]), Integer.parseInt(item[3]), item[4]));
|
map.addInteractionEvent(new ChestCell(x, y, chest[1], new Dialog(window.getDialogBar()), map.getImageCell(), window, Boolean.parseBoolean(chest[2])));
|
||||||
else
|
else
|
||||||
map.addInteractionEvent(new Item(x, y, item[1], new Dialog(window.getDialogBar()), map.getImageCell(), window, Integer.parseInt(item[2]), item[3]));
|
map.addInteractionEvent(new ChestCell(x, y, chest[1], new Dialog(window.getDialogBar()), map.getImageCell(), window));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -186,9 +187,9 @@ public class Map {
|
|||||||
doorCells.add(doorCell);
|
doorCells.add(doorCell);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addInteractionEvent(Item item) {
|
public void addInteractionEvent(ChestCell chestCell) {
|
||||||
mapArray[item.getX()][item.getY()] = TypeOfCell.EVENT;
|
mapArray[chestCell.getX()][chestCell.getY()] = TypeOfCell.EVENT;
|
||||||
items.add(item);
|
chestCells.add(chestCell);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNpcs(Npc npc){
|
public void setNpcs(Npc npc){
|
||||||
@ -231,7 +232,7 @@ public class Map {
|
|||||||
|
|
||||||
public LinkedList<DoorCell> getDoorCells() { return doorCells; }
|
public LinkedList<DoorCell> getDoorCells() { return doorCells; }
|
||||||
|
|
||||||
public LinkedList<Item> getItems() { return items; }
|
public LinkedList<ChestCell> getChestCells() { return chestCells; }
|
||||||
|
|
||||||
public void setIdExit(int id) {
|
public void setIdExit(int id) {
|
||||||
this.idExit = id;
|
this.idExit = id;
|
||||||
@ -304,16 +305,16 @@ public class Map {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isActiveItem(int x, int y) {
|
public boolean isActiveChest(int x, int y) {
|
||||||
for (Item item : items)
|
for (ChestCell cell : chestCells)
|
||||||
if (x == item.getX() && y == item.getY() && item.getClass().getName().equals("ruscz.game.gameOfProd.Inventory.Item") && item.isActive())
|
if (x == cell.getX() && y == cell.getY() && cell.getClass().getName().equals("ruscz.game.gameOfProd.Cells.ChestCell") && cell.isActive())
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isItem(int x, int y) {
|
public boolean isChest(int x, int y) {
|
||||||
for (Item item : items)
|
for (ChestCell cell : chestCells)
|
||||||
if (x == item.getX() && y == item.getY() && item.getClass().getName().equals("ruscz.game.gameOfProd.Inventory.Item"))
|
if (x == cell.getX() && y == cell.getY() && cell.getClass().getName().equals("ruscz.game.gameOfProd.Cells.ChestCell"))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -369,11 +370,18 @@ public class Map {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item findItemByXY(int x, int y, int directionSight) {
|
public ChestCell findChestByXY(int x, int y, int directionSight) {
|
||||||
int[] coords = directionSightSwitch(x, y, directionSight);
|
int[] coords = directionSightSwitch(x, y, directionSight);
|
||||||
for (Item item : items)
|
for (ChestCell cell : chestCells)
|
||||||
if (coords[0] == item.getX() && coords[1] == item.getY())
|
if (coords[0] == cell.getX() && coords[1] == cell.getY())
|
||||||
return item;
|
return cell;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ChestCell findChestByXY(int x, int y) {
|
||||||
|
for (ChestCell cell : chestCells)
|
||||||
|
if (x == cell.getX() && y == cell.getY())
|
||||||
|
return cell;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
package ruscz.game.gameOfProd.Save;
|
package ruscz.game.gameOfProd.Save;
|
||||||
|
|
||||||
|
import ruscz.game.gameOfProd.Cells.ChestCell;
|
||||||
import ruscz.game.gameOfProd.Cells.TriggerCell;
|
import ruscz.game.gameOfProd.Cells.TriggerCell;
|
||||||
|
import ruscz.game.gameOfProd.Inventory.InventoryManager;
|
||||||
|
import ruscz.game.gameOfProd.Inventory.Item;
|
||||||
import ruscz.game.gameOfProd.Map.Map;
|
import ruscz.game.gameOfProd.Map.Map;
|
||||||
import ruscz.game.gameOfProd.Map.MapManager;
|
import ruscz.game.gameOfProd.Map.MapManager;
|
||||||
import ruscz.game.gameOfProd.Windows.WindowOfFreeMove;
|
import ruscz.game.gameOfProd.Windows.WindowOfFreeMove;
|
||||||
@ -30,8 +33,8 @@ public class LoadManager {
|
|||||||
loadNewGame();
|
loadNewGame();
|
||||||
loadPerson();
|
loadPerson();
|
||||||
loadEvents();
|
loadEvents();
|
||||||
loadVillage();
|
|
||||||
loadInventory();
|
loadInventory();
|
||||||
|
loadVillage();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearSave() {
|
public void clearSave() {
|
||||||
@ -93,6 +96,8 @@ public class LoadManager {
|
|||||||
case "<location>":
|
case "<location>":
|
||||||
window.setMapManager(Map.findMapByName(getValue(scanner.nextLine()), window));
|
window.setMapManager(Map.findMapByName(getValue(scanner.nextLine()), window));
|
||||||
mapManager.getActualMap().getPerson().set(Integer.parseInt(getValue(scanner.nextLine())), Integer.parseInt(getValue(scanner.nextLine())));
|
mapManager.getActualMap().getPerson().set(Integer.parseInt(getValue(scanner.nextLine())), Integer.parseInt(getValue(scanner.nextLine())));
|
||||||
|
mapManager.getActualMap().getPerson().setDirectionSight(Integer.parseInt(getValue(scanner.nextLine())));
|
||||||
|
mapManager.getActualMap().setIdExit(100);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -109,15 +114,17 @@ public class LoadManager {
|
|||||||
Map map = null;
|
Map map = null;
|
||||||
|
|
||||||
while (scanner.hasNextLine()) {
|
while (scanner.hasNextLine()) {
|
||||||
if (scanner.nextLine().equals("<map>")) {
|
String data = scanner.nextLine();
|
||||||
|
if (data.equals("<map>")) {
|
||||||
map = Map.findMapByName(getValue(scanner.nextLine()), window);
|
map = Map.findMapByName(getValue(scanner.nextLine()), window);
|
||||||
}
|
}
|
||||||
else if (scanner.nextLine().contains("<event>")) {
|
else if (data.contains("<trigger>")) {
|
||||||
TriggerCell triggerCell = map.findTriggerByXY(Integer.parseInt(getValue(scanner.nextLine())), Integer.parseInt(getValue(scanner.nextLine())));
|
TriggerCell triggerCell = map.findTriggerByXY(Integer.parseInt(getValue(scanner.nextLine())), Integer.parseInt(getValue(scanner.nextLine())));
|
||||||
triggerCell.setActive(Boolean.parseBoolean(getValue(scanner.nextLine())));
|
triggerCell.setActive(Boolean.parseBoolean(getValue(scanner.nextLine())));
|
||||||
}
|
}
|
||||||
else {
|
else if (data.contains("<chest>")) {
|
||||||
scanner.nextLine();
|
ChestCell chestCell = map.findChestByXY(Integer.parseInt(getValue(scanner.nextLine())), Integer.parseInt(getValue(scanner.nextLine())));
|
||||||
|
chestCell.setActive(Boolean.parseBoolean(getValue(scanner.nextLine())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scanner.close();
|
scanner.close();
|
||||||
@ -126,6 +133,27 @@ public class LoadManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void loadInventory() {
|
||||||
|
try {
|
||||||
|
File inventoryFile = new File("src/main/resources/save/savedGame/inventory.txt");
|
||||||
|
Scanner scanner = new Scanner(inventoryFile);
|
||||||
|
|
||||||
|
while (scanner.hasNextLine()) {
|
||||||
|
String data = scanner.nextLine();
|
||||||
|
switch (data) {
|
||||||
|
case "<item>":
|
||||||
|
Item item = new Item(getValue(scanner.nextLine()), Integer.parseInt(getValue(scanner.nextLine())), Integer.parseInt(getValue(scanner.nextLine())), getValue(scanner.nextLine()));
|
||||||
|
InventoryManager.addItem(item);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
scanner.close();
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void loadVillage() {
|
private void loadVillage() {
|
||||||
try {
|
try {
|
||||||
File villageFile = new File("src/main/resources/save/savedGame/village.txt");
|
File villageFile = new File("src/main/resources/save/savedGame/village.txt");
|
||||||
@ -137,17 +165,6 @@ public class LoadManager {
|
|||||||
//TODO: loadVillage
|
//TODO: loadVillage
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadInventory() {
|
|
||||||
try {
|
|
||||||
File inventoryFile = new File("src/main/resources/save/savedGame/inventory.txt");
|
|
||||||
Scanner scanner = new Scanner(inventoryFile);
|
|
||||||
scanner.close();
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
//TODO: loadInventory
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getValue(String line) {
|
private String getValue(String line) {
|
||||||
return line.substring(line.indexOf(">") + 1, line.lastIndexOf("<"));
|
return line.substring(line.indexOf(">") + 1, line.lastIndexOf("<"));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,10 @@
|
|||||||
package ruscz.game.gameOfProd.Save;
|
package ruscz.game.gameOfProd.Save;
|
||||||
|
|
||||||
|
import ruscz.game.gameOfProd.Cells.ChestCell;
|
||||||
import ruscz.game.gameOfProd.Cells.Person;
|
import ruscz.game.gameOfProd.Cells.Person;
|
||||||
import ruscz.game.gameOfProd.Cells.TriggerCell;
|
import ruscz.game.gameOfProd.Cells.TriggerCell;
|
||||||
|
import ruscz.game.gameOfProd.Inventory.InventoryManager;
|
||||||
|
import ruscz.game.gameOfProd.Inventory.Item;
|
||||||
import ruscz.game.gameOfProd.Map.Map;
|
import ruscz.game.gameOfProd.Map.Map;
|
||||||
import ruscz.game.gameOfProd.Map.MapManager;
|
import ruscz.game.gameOfProd.Map.MapManager;
|
||||||
|
|
||||||
@ -19,8 +22,8 @@ public class SaveManager {
|
|||||||
public void saveGame() {
|
public void saveGame() {
|
||||||
savePerson();
|
savePerson();
|
||||||
saveEvents();
|
saveEvents();
|
||||||
saveVillage();
|
|
||||||
saveInventory();
|
saveInventory();
|
||||||
|
saveVillage();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void savePerson() {
|
private void savePerson() {
|
||||||
@ -32,6 +35,7 @@ public class SaveManager {
|
|||||||
" <map>" + mapManager.getActualMap().getName() + "</map>" + System.lineSeparator() +
|
" <map>" + mapManager.getActualMap().getName() + "</map>" + System.lineSeparator() +
|
||||||
" <x>" + person.getX() + "</x>" + System.lineSeparator() +
|
" <x>" + person.getX() + "</x>" + System.lineSeparator() +
|
||||||
" <y>" + person.getY() + "</y>" + System.lineSeparator() +
|
" <y>" + person.getY() + "</y>" + System.lineSeparator() +
|
||||||
|
" <direction>" + person.getDirectionSight() + "</direction>" + System.lineSeparator() +
|
||||||
"</location>";
|
"</location>";
|
||||||
writer.write(location);
|
writer.write(location);
|
||||||
writer.close();
|
writer.close();
|
||||||
@ -52,11 +56,20 @@ public class SaveManager {
|
|||||||
" <events>" + System.lineSeparator();
|
" <events>" + System.lineSeparator();
|
||||||
for (TriggerCell triggerCell : map.getTriggerCells()) {
|
for (TriggerCell triggerCell : map.getTriggerCells()) {
|
||||||
String event =
|
String event =
|
||||||
" <event>" + System.lineSeparator() +
|
" <trigger>" + System.lineSeparator() +
|
||||||
" <x>" + triggerCell.getX() + "</x>" + System.lineSeparator() +
|
" <x>" + triggerCell.getX() + "</x>" + System.lineSeparator() +
|
||||||
" <y>" + triggerCell.getY() + "</y>" + System.lineSeparator() +
|
" <y>" + triggerCell.getY() + "</y>" + System.lineSeparator() +
|
||||||
" <active>" + triggerCell.getActive() + "</active>" + System.lineSeparator() +
|
" <active>" + triggerCell.getActive() + "</active>" + System.lineSeparator() +
|
||||||
" </event>" + System.lineSeparator();
|
" </trigger>" + System.lineSeparator();
|
||||||
|
mapInfo += event;
|
||||||
|
}
|
||||||
|
for (ChestCell chestCell : map.getChestCells()) {
|
||||||
|
String event =
|
||||||
|
" <chest>" + System.lineSeparator() +
|
||||||
|
" <x>" + chestCell.getX() + "</x>" + System.lineSeparator() +
|
||||||
|
" <y>" + chestCell.getY() + "</y>" + System.lineSeparator() +
|
||||||
|
" <active>" + chestCell.isActive() + "</active>" + System.lineSeparator() +
|
||||||
|
" </chest>" + System.lineSeparator();
|
||||||
mapInfo += event;
|
mapInfo += event;
|
||||||
}
|
}
|
||||||
mapInfo +=
|
mapInfo +=
|
||||||
@ -71,6 +84,25 @@ public class SaveManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void saveInventory() {
|
||||||
|
try {
|
||||||
|
FileWriter writer = new FileWriter("src/main/resources/save/savedGame/inventory.txt");
|
||||||
|
String inventory = "";
|
||||||
|
for (Item item : InventoryManager.getInventory()) {
|
||||||
|
inventory += "<item>" + System.lineSeparator() +
|
||||||
|
" <name>" + item.getName().toLowerCase().replace(" ", "-") + "</name>" + System.lineSeparator() +
|
||||||
|
" <multiplicity>" + item.getMultiplicity() + "</multiplicity>" + System.lineSeparator() +
|
||||||
|
" <image>" + item.getImage() + "</image>" + System.lineSeparator() +
|
||||||
|
" <action>" + item.getItemAction().toString().toLowerCase() + "</action>" + System.lineSeparator() +
|
||||||
|
"</item>" + System.lineSeparator();
|
||||||
|
}
|
||||||
|
writer.write(inventory);
|
||||||
|
writer.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void saveVillage() {
|
private void saveVillage() {
|
||||||
try {
|
try {
|
||||||
FileWriter writer = new FileWriter("src/main/resources/save/savedGame/village.txt");
|
FileWriter writer = new FileWriter("src/main/resources/save/savedGame/village.txt");
|
||||||
@ -81,15 +113,4 @@ public class SaveManager {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveInventory() {
|
|
||||||
try {
|
|
||||||
FileWriter writer = new FileWriter("src/main/resources/save/savedGame/inventory.txt");
|
|
||||||
String inventory = "TODO: Inventory";
|
|
||||||
writer.write(inventory);
|
|
||||||
writer.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -170,7 +170,7 @@ public class WindowOfFreeMove extends JLayeredPane {
|
|||||||
boss.setNpcs(npc2);
|
boss.setNpcs(npc2);
|
||||||
|
|
||||||
musicManager = new MusicManager("Town1.wav");
|
musicManager = new MusicManager("Town1.wav");
|
||||||
// musicManager.playMusic();
|
musicManager.playMusic();
|
||||||
|
|
||||||
Timer timer = new Timer(10, actionEvent -> {
|
Timer timer = new Timer(10, actionEvent -> {
|
||||||
mapManager.getActualMap().getPerson().move();
|
mapManager.getActualMap().getPerson().move();
|
||||||
@ -203,6 +203,9 @@ public class WindowOfFreeMove extends JLayeredPane {
|
|||||||
for (Cell cell : mapManager.getActualMap().getInteractionEventCells()) {
|
for (Cell cell : mapManager.getActualMap().getInteractionEventCells()) {
|
||||||
if (cell.getY() == i) cell.paint(g2D);
|
if (cell.getY() == i) cell.paint(g2D);
|
||||||
}
|
}
|
||||||
|
for (ChestCell cell : mapManager.getActualMap().getChestCells()) {
|
||||||
|
if (cell.getY() == i && cell.getPaint()) cell.paint(g2D);
|
||||||
|
}
|
||||||
if (mapManager.getActualMap().getPerson().getY() == (i-1) && mapManager.getActualMap().getPerson().getDirectionMoveLast() == KEY_UP) mapManager.getActualMap().getPerson().paint(g2D);
|
if (mapManager.getActualMap().getPerson().getY() == (i-1) && mapManager.getActualMap().getPerson().getDirectionMoveLast() == KEY_UP) mapManager.getActualMap().getPerson().paint(g2D);
|
||||||
for (Block cell : mapManager.getActualMap().getBlocks()) {
|
for (Block cell : mapManager.getActualMap().getBlocks()) {
|
||||||
if (cell.getY() == i && cell.isPartial()) cell.paint(g2D);
|
if (cell.getY() == i && cell.isPartial()) cell.paint(g2D);
|
||||||
@ -216,8 +219,8 @@ public class WindowOfFreeMove extends JLayeredPane {
|
|||||||
for (int j = 0; j < mapManager.getActualMap().getCanvasSize()[1]; j++) {
|
for (int j = 0; j < mapManager.getActualMap().getCanvasSize()[1]; j++) {
|
||||||
mapManager.getActualMap().getImageCell().paintForeground(g2D, j, i);
|
mapManager.getActualMap().getImageCell().paintForeground(g2D, j, i);
|
||||||
}
|
}
|
||||||
for (Item item : mapManager.getActualMap().getItems()) {
|
for (ChestCell cell : mapManager.getActualMap().getChestCells()) {
|
||||||
if (item.getY() == i) item.paint(g2D);
|
if (cell.getY() == i && cell.getShowItem()) cell.paint(g2D);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1
src/main/resources/chests/confroom.txt
Normal file
1
src/main/resources/chests/confroom.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
white-key-card 19 key
|
||||||
2
src/main/resources/chests/trashcan.txt
Normal file
2
src/main/resources/chests/trashcan.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
blue-key-card 39 key
|
||||||
|
<message> trash
|
||||||
@ -1,4 +1,3 @@
|
|||||||
Just like the trash you are..
|
Just like the trash you are..
|
||||||
You found a Blue key card.
|
<item>
|
||||||
<additem> blue-key-card key
|
|
||||||
<end>
|
<end>
|
||||||
@ -2,4 +2,5 @@ BLOCK 2
|
|||||||
MOVETO 1
|
MOVETO 1
|
||||||
EVENT 3
|
EVENT 3
|
||||||
TRIGGER 4
|
TRIGGER 4
|
||||||
DOOR dark-door.png,32
|
DOOR dark-door.png,32
|
||||||
|
CHEST 390
|
||||||
@ -7,6 +7,6 @@
|
|||||||
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||||
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||||
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||||
0 390 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8
|
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8
|
||||||
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||||
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||||
@ -8,7 +8,7 @@ BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY EMPTY EMPTY BLOCK BL
|
|||||||
BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY moveto,1,2,openspace EMPTY EMPTY EMPTY EMPTY BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK
|
BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY moveto,1,2,openspace EMPTY EMPTY EMPTY EMPTY BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK
|
||||||
BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY moveto,1,2,openspace EMPTY EMPTY EMPTY EMPTY BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK
|
BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY moveto,1,2,openspace EMPTY EMPTY EMPTY EMPTY BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK
|
||||||
BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY EMPTY EMPTY BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK
|
BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY EMPTY EMPTY BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK
|
||||||
BLOCK inter,trash EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK
|
BLOCK CHEST,trashcan,true EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK
|
||||||
BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY block
|
BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY block
|
||||||
BLOCK BLOCK,d EMPTY BLOCK,d BLOCK,d BLOCK,d BLOCK,d EMPTY BLOCK,d BLOCK,d BLOCK,d BLOCK,d EMPTY BLOCK,d BLOCK,d BLOCK,d BLOCK,d EMPTY BLOCK,d BLOCK
|
BLOCK BLOCK,d EMPTY BLOCK,d BLOCK,d BLOCK,d BLOCK,d EMPTY BLOCK,d BLOCK,d BLOCK,d BLOCK,d EMPTY BLOCK,d BLOCK,d BLOCK,d BLOCK,d EMPTY BLOCK,d BLOCK
|
||||||
BLOCK BLOCK DOOR,true,locked BLOCK BLOCK BLOCK BLOCK DOOR,true,locked BLOCK BLOCK BLOCK BLOCK DOOR,true,locked BLOCK BLOCK BLOCK BLOCK DOORTO,locked,true,white-key-card,2,1,treasure BLOCK BLOCK
|
BLOCK BLOCK DOOR,true,locked BLOCK BLOCK BLOCK BLOCK DOOR,true,locked BLOCK BLOCK BLOCK BLOCK DOOR,true,locked BLOCK BLOCK BLOCK BLOCK DOORTO,locked,true,white-key-card,2,1,treasure BLOCK BLOCK
|
||||||
@ -6,7 +6,7 @@ BLOCK block EMPTY EMPTY EMPTY EMPTY EMPTY block BLOCK,u EMPTY EMPTY EMPTY BLOCK
|
|||||||
BLOCK block EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY DOOR,false EMPTY EMPTY EMPTY BLOCK EMPTY block block block block EMPTY block
|
BLOCK block EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY DOOR,false EMPTY EMPTY EMPTY BLOCK EMPTY block block block block EMPTY block
|
||||||
BLOCK BLOCK,d EMPTY BLOCK,d BLOCK,d BLOCK,d EMPTY BLOCK,d BLOCK EMPTY EMPTY EMPTY BLOCK EMPTY block block block block EMPTY block
|
BLOCK BLOCK,d EMPTY BLOCK,d BLOCK,d BLOCK,d EMPTY BLOCK,d BLOCK EMPTY EMPTY EMPTY BLOCK EMPTY block block block block EMPTY block
|
||||||
BLOCK BLOCK DOOR,true,locked,false BLOCK BLOCK BLOCK DOOR,true BLOCK BLOCK EMPTY EMPTY EMPTY BLOCK EMPTY block block block block EMPTY block
|
BLOCK BLOCK DOOR,true,locked,false BLOCK BLOCK BLOCK DOOR,true BLOCK BLOCK EMPTY EMPTY EMPTY BLOCK EMPTY block block block block EMPTY block
|
||||||
BLOCK block EMPTY block BLOCK block EMPTY block BLOCK EMPTY EMPTY EMPTY BLOCK EMPTY block ITEM,white-key-card,19,key block block EMPTY block
|
BLOCK block EMPTY block BLOCK block EMPTY block BLOCK EMPTY EMPTY EMPTY BLOCK EMPTY block CHEST,confroom block block EMPTY block
|
||||||
BLOCK block EMPTY block BLOCK block EMPTY block BLOCK EMPTY EMPTY EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK
|
BLOCK block EMPTY block BLOCK block EMPTY block BLOCK EMPTY EMPTY EMPTY BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK
|
||||||
BLOCK block EMPTY block BLOCK block EMPTY block BLOCK EMPTY EMPTY EMPTY BLOCK BLOCK,d BLOCK,d BLOCK,d EMPTY BLOCK,d BLOCK,d BLOCK
|
BLOCK block EMPTY block BLOCK block EMPTY block BLOCK EMPTY EMPTY EMPTY BLOCK BLOCK,d BLOCK,d BLOCK,d EMPTY BLOCK,d BLOCK,d BLOCK
|
||||||
BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY EMPTY EMPTY BLOCK BLOCK BLOCK BLOCK DOOR,true,blue-key-card BLOCK BLOCK BLOCK
|
BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY EMPTY EMPTY BLOCK BLOCK BLOCK BLOCK DOOR,true,blue-key-card BLOCK BLOCK BLOCK
|
||||||
|
|||||||
5
src/main/resources/maps/treasure-cellmap.txt
Normal file
5
src/main/resources/maps/treasure-cellmap.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
BLOCK 0
|
||||||
|
MOVETO 0
|
||||||
|
EVENT 0
|
||||||
|
TRIGGER 0
|
||||||
|
DOOR dark-door.png,32
|
||||||
10
src/main/resources/maps/treasure-objectset.txt
Normal file
10
src/main/resources/maps/treasure-objectset.txt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||||
|
0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||||
|
0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||||
|
0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||||
|
0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||||
|
0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||||
|
0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||||
|
0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||||
|
0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||||
|
0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||||
@ -5,7 +5,7 @@
|
|||||||
3 13 23 33 43 53 63 73 83 93 103 113 123
|
3 13 23 33 43 53 63 73 83 93 103 113 123
|
||||||
4 14 24 34 44 54 64 74 84 94 104 114 124
|
4 14 24 34 44 54 64 74 84 94 104 114 124
|
||||||
5 15 25 35 45 55 65 75 85 95 105 115 125
|
5 15 25 35 45 55 65 75 85 95 105 115 125
|
||||||
6 13 26 36 46 56 66 76 86 96 106 116 126
|
6 16 26 36 46 56 66 76 86 96 106 116 126
|
||||||
7 17 27 37 47 57 67 77 87 97 107 117 127
|
7 17 27 37 47 57 67 77 87 97 107 117 127
|
||||||
8 18 28 38 48 58 68 78 88 98 108 118 128
|
8 18 28 38 48 58 68 78 88 98 108 118 128
|
||||||
9 19 29 39 49 59 69 79 89 99 109 119 129
|
9 19 29 39 49 59 69 79 89 99 109 119 129
|
||||||
@ -1,75 +0,0 @@
|
|||||||
<map>
|
|
||||||
<mapName>m1</mapName>
|
|
||||||
<events>
|
|
||||||
</events>
|
|
||||||
</map>
|
|
||||||
<map>
|
|
||||||
<mapName>m2</mapName>
|
|
||||||
<events>
|
|
||||||
<event>
|
|
||||||
<x>7</x>
|
|
||||||
<y>2</y>
|
|
||||||
<active>true</active>
|
|
||||||
</event>
|
|
||||||
</events>
|
|
||||||
</map>
|
|
||||||
<map>
|
|
||||||
<mapName>m3</mapName>
|
|
||||||
<events>
|
|
||||||
<event>
|
|
||||||
<x>2</x>
|
|
||||||
<y>5</y>
|
|
||||||
<active>true</active>
|
|
||||||
</event>
|
|
||||||
</events>
|
|
||||||
</map>
|
|
||||||
<map>
|
|
||||||
<mapName>m4</mapName>
|
|
||||||
<events>
|
|
||||||
<event>
|
|
||||||
<x>3</x>
|
|
||||||
<y>3</y>
|
|
||||||
<active>true</active>
|
|
||||||
</event>
|
|
||||||
</events>
|
|
||||||
</map>
|
|
||||||
<map>
|
|
||||||
<mapName>m5</mapName>
|
|
||||||
<events>
|
|
||||||
</events>
|
|
||||||
</map>
|
|
||||||
<map>
|
|
||||||
<mapName>m6</mapName>
|
|
||||||
<events>
|
|
||||||
<event>
|
|
||||||
<x>11</x>
|
|
||||||
<y>11</y>
|
|
||||||
<active>true</active>
|
|
||||||
</event>
|
|
||||||
</events>
|
|
||||||
</map>
|
|
||||||
<map>
|
|
||||||
<mapName>openspace</mapName>
|
|
||||||
<events>
|
|
||||||
</events>
|
|
||||||
</map>
|
|
||||||
<map>
|
|
||||||
<mapName>office</mapName>
|
|
||||||
<events>
|
|
||||||
</events>
|
|
||||||
</map>
|
|
||||||
<map>
|
|
||||||
<mapName>boss</mapName>
|
|
||||||
<events>
|
|
||||||
<event>
|
|
||||||
<x>4</x>
|
|
||||||
<y>18</y>
|
|
||||||
<active>true</active>
|
|
||||||
</event>
|
|
||||||
</events>
|
|
||||||
</map>
|
|
||||||
<map>
|
|
||||||
<mapName>treasure</mapName>
|
|
||||||
<events>
|
|
||||||
</events>
|
|
||||||
</map>
|
|
||||||
@ -1 +0,0 @@
|
|||||||
TODO: Inventory
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
<location>
|
|
||||||
<map>office</map>
|
|
||||||
<x>17</x>
|
|
||||||
<y>11</y>
|
|
||||||
</location>
|
|
||||||
@ -1 +0,0 @@
|
|||||||
TODO: Village
|
|
||||||
Loading…
x
Reference in New Issue
Block a user