mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-12-13 22:59:02 +00:00
Added support for multiple dimensions
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package net.simon987.npcplugin;
|
||||
|
||||
public class VaultDimension {
|
||||
|
||||
/**
|
||||
* Name of the dimension
|
||||
*/
|
||||
private String name;
|
||||
|
||||
public VaultDimension(long vaultDoorId) {
|
||||
|
||||
name = "v" + vaultDoorId + "-";
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -44,6 +44,7 @@ public class VaultDoor extends GameObject implements Programmable, Enterable, Up
|
||||
this.cypherId = cypherId;
|
||||
this.randomStringGenerator = new RandomStringGenerator();
|
||||
|
||||
this.password = "12345678".toCharArray();
|
||||
}
|
||||
|
||||
|
||||
@@ -66,6 +67,9 @@ public class VaultDoor extends GameObject implements Programmable, Enterable, Up
|
||||
@Override
|
||||
public boolean sendMessage(char[] message) {
|
||||
|
||||
System.out.println("message: " + new String(message));
|
||||
System.out.println("password: " + new String(password));
|
||||
|
||||
if (Arrays.equals(message, password)) {
|
||||
if (!open) {
|
||||
openVault();
|
||||
@@ -78,16 +82,16 @@ public class VaultDoor extends GameObject implements Programmable, Enterable, Up
|
||||
}
|
||||
}
|
||||
|
||||
private void openVault(){
|
||||
private void openVault() {
|
||||
open = true;
|
||||
openedTimer = OPEN_TIME;
|
||||
LogManager.LOGGER.fine("Opened Vault door ID: " + getObjectId());
|
||||
}
|
||||
|
||||
private void keepVaultOpen(){
|
||||
private void keepVaultOpen() {
|
||||
open = true;
|
||||
openedTimer = OPEN_TIME;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean enter(GameObject object) {
|
||||
@@ -96,6 +100,8 @@ public class VaultDoor extends GameObject implements Programmable, Enterable, Up
|
||||
|
||||
if (open) {
|
||||
//TODO: Enter in the vault
|
||||
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -116,6 +122,7 @@ public class VaultDoor extends GameObject implements Programmable, Enterable, Up
|
||||
dbObject.put("x", getX());
|
||||
dbObject.put("y", getY());
|
||||
dbObject.put("t", ID);
|
||||
dbObject.put("pw", new String(password));
|
||||
|
||||
return dbObject;
|
||||
}
|
||||
@@ -129,6 +136,7 @@ public class VaultDoor extends GameObject implements Programmable, Enterable, Up
|
||||
json.put("x", getX());
|
||||
json.put("y", getY());
|
||||
json.put("t", ID);
|
||||
//Don't send the password to the client!
|
||||
|
||||
return json;
|
||||
}
|
||||
@@ -139,6 +147,7 @@ public class VaultDoor extends GameObject implements Programmable, Enterable, Up
|
||||
vaultDoor.setObjectId((long) obj.get("i"));
|
||||
vaultDoor.setX((int) obj.get("x"));
|
||||
vaultDoor.setY((int) obj.get("y"));
|
||||
// vaultDoor.password = (char[]) obj.get("pw");
|
||||
|
||||
return vaultDoor;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package net.simon987.npcplugin;
|
||||
|
||||
import net.simon987.server.game.TileMap;
|
||||
import net.simon987.server.game.World;
|
||||
|
||||
public class VaultWorld extends World {
|
||||
|
||||
private String dimension;
|
||||
|
||||
public VaultWorld(int x, int y, TileMap tileMap) {
|
||||
super(x, y, tileMap);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package net.simon987.npcplugin;
|
||||
|
||||
public class VaultWorldGenerator {
|
||||
|
||||
public VaultWorld generateVaultWorld() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user