diff --git a/src/main/java/com/comandante/creeper/configuration/ConfigureNpc.java b/src/main/java/com/comandante/creeper/configuration/ConfigureNpc.java index 674cd47fc02af2dd6810d2452d15400be3934234..52046eff2f847cd3c8c470dcf7fd40a030766d2a 100644 --- a/src/main/java/com/comandante/creeper/configuration/ConfigureNpc.java +++ b/src/main/java/com/comandante/creeper/configuration/ConfigureNpc.java @@ -22,7 +22,7 @@ public class ConfigureNpc { EntityManager entityManager = gameManager.getEntityManager(); List<Npc> npcsFromFile = gameManager.getNpcStorage().getAllNpcs(); for (Npc npc : npcsFromFile) { - Main.startUpMessage("Added " + npc.getName()); + Main.startUpMessage("Adding spawn: " + npc.getName()); entityManager.addEntity(npc); Set<SpawnRule> spawnRules = npc.getSpawnRules(); for (SpawnRule spawnRule : spawnRules) { @@ -37,91 +37,26 @@ public class ConfigureNpc { List<ItemMetadata> allItemMetadata = gameManager.getItemStorage().getAllItemMetadata(); - for (ItemMetadata itemMetadata: allItemMetadata) { - for (SpawnRule spawnRule: itemMetadata.getSpawnRules()) { + for (ItemMetadata itemMetadata : allItemMetadata) { + for (SpawnRule spawnRule : itemMetadata.getSpawnRules()) { Main.startUpMessage("Adding spawn: " + itemMetadata.getInternalItemName()); ItemSpawner itemSpawner = new ItemSpawner(itemMetadata, spawnRule, gameManager); entityManager.addEntity(itemSpawner); } } - for (ItemMetadata itemMetadata: allItemMetadata) { - for (Forage forage: itemMetadata.getForages()) { - Main.startUpMessage("Processing forages for " + itemMetadata.getInternalItemName()); + for (ItemMetadata itemMetadata : allItemMetadata) { + for (Forage forage : itemMetadata.getForages()) { + Main.startUpMessage("Adding forage: " + itemMetadata.getInternalItemName()); gameManager.getForageManager().addForage(itemMetadata.getInternalItemName(), forage); } } List<Merchant> allMerchantMetadatas = gameManager.getMerchantStorage().getAllMerchants(); - for (Merchant merchant: allMerchantMetadatas) { + for (Merchant merchant : allMerchantMetadatas) { + Main.startUpMessage("Adding merchant: " + merchant.getInternalName()); gameManager.getRoomManager().addMerchant(merchant); } -// ItemSpawner itemSpawner = new ItemSpawner(ItemType.SMALL_HEALTH_POTION, new SpawnRuleBuilder().setArea(Area.NEWBIE_ZONE).setSpawnIntervalTicks(600).setMaxInstances(100).setMaxPerRoom(5).setRandomPercent(40).createSpawnRule(), gameManager); -// ItemSpawner itemSpawner1 = new ItemSpawner(ItemType.SMALL_HEALTH_POTION, new SpawnRuleBuilder().setArea(Area.FANCYHOUSE_ZONE).setSpawnIntervalTicks(600).setMaxInstances(12).setMaxPerRoom(2).setRandomPercent(50).createSpawnRule(), gameManager); -// ItemSpawner itemSpawner2 = new ItemSpawner(ItemType.SMALL_HEALTH_POTION, new SpawnRuleBuilder().setArea(Area.HOUSE_ZONE).setSpawnIntervalTicks(600).setMaxInstances(12).setMaxPerRoom(2).setRandomPercent(50).createSpawnRule(), gameManager); - -// ItemSpawner itemSpawner5 = new ItemSpawner(ItemType.KEY, new SpawnRuleBuilder().setArea(Area.LOBBY).setSpawnIntervalTicks(600).setMaxInstances(1).setMaxPerRoom(1).setRandomPercent(5).createSpawnRule(), gameManager); - -// entityManager.addEntity(itemSpawner); -// entityManager.addEntity(itemSpawner1 -//); -// entityManager.addEntity(itemSpawner2); -// entityManager.addEntity(itemSpawner5); - -// List<MerchantItemForSale> itemsForSale = Lists.newArrayList(); -// itemsForSale.add(new MerchantItemForSale("small health potion", 8)); -// itemsForSale.add(new MerchantItemForSale("purple drank", 80)); -// itemsForSale.add(new MerchantItemForSale("biggers skin satchel", 25000)); -//// -// LloydBartender lloydBartender = new LloydBartender(gameManager, itemsForSale); -// gameManager.getRoomManager().addMerchant(64, lloydBartender); -//// -// Map<Integer, MerchantItemForSale> nigelForSale = Maps.newLinkedHashMap(); -// nigelForSale.put(1, new MerchantItemForSale(ItemType.SMALL_HEALTH_POTION, 6)); -// -// NigelBartender nigelBartender = new NigelBartender(gameManager, new Loot(18, 26, Sets.<ItemType>newHashSet()), nigelForSale); -// gameManager.getRoomManager().addMerchant(377, nigelBartender); -// -// Map<Integer, MerchantItemForSale> blacksmithItems = Maps.newHashMap(); -// blacksmithItems.put(1, new MerchantItemForSale(ItemType.BERSERKER_BATON, 10000)); -// blacksmithItems.put(2, new MerchantItemForSale(ItemType.BERSEKER_BOOTS, 3500)); -// blacksmithItems.put(3, new MerchantItemForSale(ItemType.BERSERKER_BRACERS, 3500)); -// blacksmithItems.put(4, new MerchantItemForSale(ItemType.BERSEKER_HELM, 3500)); -// blacksmithItems.put(5, new MerchantItemForSale(ItemType.BERSERKER_CHEST, 7000)); -// blacksmithItems.put(6, new MerchantItemForSale(ItemType.BERSEKER_SHORTS, 8500)); -// blacksmithItems.put(7, new MerchantItemForSale(ItemType.LEATHER_SATCHEL, 600)); -// -// Blacksmith blacksmith = new Blacksmith(gameManager, new Loot(18, 26, Sets.<ItemType>newHashSet()), blacksmithItems); -// gameManager.getRoomManager().addMerchant(66, blacksmith); -// gameManager.getRoomManager().addMerchant(253, blacksmith); -// -// Map<Integer, MerchantItemForSale> wizarditems = Maps.newHashMap(); -// wizarditems.put(1, new MerchantItemForSale(ItemType.LIGHTNING_SPELLBOOKNG, 50000)); -// -// Wizard wizard = new Wizard(gameManager, new Loot(18, 26, Sets.<ItemType>newHashSet()), wizarditems); -// gameManager.getRoomManager().addMerchant(98, wizard); -// -// JimBanker jimBanker = new JimBanker(gameManager, new Loot(18, 26, Sets.<ItemType>newHashSet()), null); -// gameManager.getRoomManager().addMerchant(65, jimBanker); -// gameManager.getRoomManager().addMerchant(209, jimBanker); -// -// OldWiseMan oldWiseMan = new OldWiseMan(gameManager, new Loot(18, 26, Sets.<ItemType>newHashSet()), null); -// gameManager.getRoomManager().addMerchant(2, oldWiseMan); -// -// LockerRoomGuy lockerRoomGuy = new LockerRoomGuy(gameManager, new Loot(18, 26, Sets.<ItemType>newHashSet()), null); -// gameManager.getRoomManager().addMerchant(63, lockerRoomGuy); - -// ForageBuilder marijuanaForageBuilder = new ForageBuilder(); -// marijuanaForageBuilder.setInternalItemName("Marijuana"); -// marijuanaForageBuilder.setMinAmt(1); -// marijuanaForageBuilder.setMaxAmt(3); -// marijuanaForageBuilder.setPctOfSuccess(40); -// marijuanaForageBuilder.setForageExperience(4); -// marijuanaForageBuilder.setCoolDownTicks(600); -// gameManager.getForageManager().addForageToArea(Area.WESTERN9_ZONE, marijuanaForageBuilder); -// gameManager.getForageManager().addForageToArea(Area.NORTH3_ZONE, marijuanaForageBuilder); -// gameManager.getForageManager().addForageToArea(Area.BLOODRIDGE2_ZONE, marijuanaForageBuilder); -// gameManager.getForageManager().addForageToArea(Area.BLOODRIDGE1_ZONE, marijuanaForageBuilder); } } diff --git a/src/main/java/com/comandante/creeper/merchant/BlackbeardRogue.java b/src/main/java/com/comandante/creeper/merchant/BlackbeardRogue.java deleted file mode 100644 index fc8e379afebfb5289187afb105fcbbfb4a62d8a5..0000000000000000000000000000000000000000 --- a/src/main/java/com/comandante/creeper/merchant/BlackbeardRogue.java +++ /dev/null @@ -1,28 +0,0 @@ -/* -package com.comandante.creeper.merchant; - -import com.comandante.creeper.core_game.GameManager; -import com.comandante.creeper.server.player_communication.Color; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import static com.comandante.creeper.server.player_communication.Color.BOLD_ON; - -public class BlackbeardRogue extends Merchant { - private final static long phraseIntervalMs = 300000; - private final static String NAME = "blackbeard"; - private final static String welcomeMessage = "Welcome to Blackbeard's Rogue Shop.\r\n"; - private final static Set<String> validTriggers = new HashSet<String>(Arrays.asList(new String[] - {"blackbeard", "b", "rogue", "r", NAME} - )); - - private final static String colorName = BOLD_ON + Color.CYAN + NAME + Color.RESET ; - - public BlackbeardRogue(GameManager gameManager, List<MerchantItemForSale> merchantItemForSales) { - super(gameManager, NAME, colorName, validTriggers, merchantItemForSales, welcomeMessage); - } -} -*/ diff --git a/src/main/java/com/comandante/creeper/merchant/Blacksmith.java b/src/main/java/com/comandante/creeper/merchant/Blacksmith.java deleted file mode 100644 index dae36afa690b42a56642eaf8cf57dddbbee7f93f..0000000000000000000000000000000000000000 --- a/src/main/java/com/comandante/creeper/merchant/Blacksmith.java +++ /dev/null @@ -1,39 +0,0 @@ -/* -package com.comandante.creeper.merchant; - - -import com.comandante.creeper.core_game.GameManager; -import com.comandante.creeper.server.player_communication.Color; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import static com.comandante.creeper.server.player_communication.Color.BOLD_ON; - -public class Blacksmith extends Merchant { - private final static long phraseIntervalMs = 300000; - private final static String NAME = "biggers the blacksmith"; - private final static String welcomeMessage = " ____ _ \r\n" + - " | __ )(_) __ _ __ _ ___ _ __ ___ \r\n" + - " | _ \\| |/ _` |/ _` |/ _ \\ '__/ __| \r\n" + - " | |_) | | (_| | (_| | __/ | \\__ \\ \r\n" + - " |____/|_|\\__, |\\__, |\\___|_| |___/ \r\n" + - " ____ |___/ |___/ _ _ _ _ \r\n" + - " | __ )| | __ _ ___| | _____ _ __ ___ (_) |_| |__ \r\n" + - " | _ \\| |/ _` |/ __| |/ / __| '_ ` _ \\| | __| '_ \\ \r\n" + - " | |_) | | (_| | (__| <\\__ \\ | | | | | | |_| | | |\r\n" + - " |____/|_|\\__,_|\\___|_|\\_\\___/_| |_| |_|_|\\__|_| |_|\r\n" + - " "; - private final static Set<String> validTriggers = new HashSet<String>(Arrays.asList(new String[] - {"blacksmith", "biggers the blacksmith", "biggers", NAME} - )); - - private final static String colorName = BOLD_ON + Color.CYAN + NAME + Color.RESET ; - - public Blacksmith(GameManager gameManager, List<MerchantItemForSale> merchantItemForSales) { - super(gameManager, NAME, colorName, validTriggers, merchantItemForSales, welcomeMessage); - } -} -*/ diff --git a/src/main/java/com/comandante/creeper/merchant/GrimulfWizard.java b/src/main/java/com/comandante/creeper/merchant/GrimulfWizard.java deleted file mode 100644 index 620b8a86517d6ff71594fb0da6620ffb8a215c4f..0000000000000000000000000000000000000000 --- a/src/main/java/com/comandante/creeper/merchant/GrimulfWizard.java +++ /dev/null @@ -1,29 +0,0 @@ -/* -package com.comandante.creeper.merchant; - - -import com.comandante.creeper.core_game.GameManager; -import com.comandante.creeper.server.player_communication.Color; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import static com.comandante.creeper.server.player_communication.Color.BOLD_ON; - -public class GrimulfWizard extends Merchant { - private final static long phraseIntervalMs = 300000; - private final static String NAME = "grimulf the wizard"; - private final static String welcomeMessage = "Welcome to my den.\r\n"; - private final static Set<String> validTriggers = new HashSet<String>(Arrays.asList(new String[] - {"grimulf", "g", "wizard", "w", NAME} - )); - - private final static String colorName = BOLD_ON + Color.CYAN + NAME + Color.RESET ; - - public GrimulfWizard(GameManager gameManager, List<MerchantItemForSale> merchantItemForSales) { - super(gameManager, NAME, colorName, validTriggers, merchantItemForSales, welcomeMessage); - } -} -*/ diff --git a/src/main/java/com/comandante/creeper/merchant/JimBanker.java b/src/main/java/com/comandante/creeper/merchant/JimBanker.java deleted file mode 100644 index 495ebf4f2acbf1bab39a921f4831a6a6b9d05cb8..0000000000000000000000000000000000000000 --- a/src/main/java/com/comandante/creeper/merchant/JimBanker.java +++ /dev/null @@ -1,35 +0,0 @@ -/* -package com.comandante.creeper.merchant; - - -import com.comandante.creeper.core_game.GameManager; -import com.comandante.creeper.server.player_communication.Color; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import static com.comandante.creeper.server.player_communication.Color.BOLD_ON; - -public class JimBanker extends Merchant { - private final static long phraseIntervalMs = 300000; - private final static String NAME = "jim the banker"; - private final static String welcomeMessage = "Welcome to the First National Bank of Creeper."; - private final static Set<String> validTriggers = new HashSet<String>(Arrays.asList(new String[] - {"bank", "banker", "jim the banker", "jim", "j", NAME} - )); - - private final static String colorName = BOLD_ON + Color.CYAN + NAME + Color.RESET; - - public JimBanker(GameManager gameManager, List<MerchantItemForSale> merchantItemForSales) { - super(gameManager, NAME, colorName, validTriggers, merchantItemForSales, welcomeMessage, MerchantType.BANK); - } - - @Override - public String getMenu() { - return null; - } -} - -*/ diff --git a/src/main/java/com/comandante/creeper/merchant/KetilCommissary.java b/src/main/java/com/comandante/creeper/merchant/KetilCommissary.java deleted file mode 100644 index 5ee11e8eb820473527c8de766aaab3d8d925cc16..0000000000000000000000000000000000000000 --- a/src/main/java/com/comandante/creeper/merchant/KetilCommissary.java +++ /dev/null @@ -1,28 +0,0 @@ -/* -package com.comandante.creeper.merchant; - -import com.comandante.creeper.core_game.GameManager; -import com.comandante.creeper.server.player_communication.Color; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import static com.comandante.creeper.server.player_communication.Color.BOLD_ON; - -public class KetilCommissary extends Merchant { - private final static long phraseIntervalMs = 300000; - private final static String NAME = "ketil"; - private final static String welcomeMessage = "Welcome to the Ketil Commissary.\r\n"; - private final static Set<String> validTriggers = new HashSet<String>(Arrays.asList(new String[] - {"ketil", "k", "commissary", "c", NAME} - )); - - private final static String colorName = BOLD_ON + Color.CYAN + NAME + Color.RESET ; - - public KetilCommissary(GameManager gameManager, List<MerchantItemForSale> merchantItemForSales) { - super(gameManager, NAME, colorName, validTriggers, merchantItemForSales, welcomeMessage); - } -} -*/ diff --git a/src/main/java/com/comandante/creeper/merchant/LloydBartender.java b/src/main/java/com/comandante/creeper/merchant/LloydBartender.java deleted file mode 100644 index a6eff8cf171c817a0d6efd4a69c61ae034b1c3a4..0000000000000000000000000000000000000000 --- a/src/main/java/com/comandante/creeper/merchant/LloydBartender.java +++ /dev/null @@ -1,36 +0,0 @@ -/* -package com.comandante.creeper.merchant; - -import com.comandante.creeper.core_game.GameManager; -import com.comandante.creeper.server.player_communication.Color; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import static com.comandante.creeper.server.player_communication.Color.BOLD_ON; - -public class LloydBartender extends Merchant { - private final static long phraseIntervalMs = 300000; - private final static String NAME = "lloyd the bartender"; - private final static String welcomeMessage = " _ _ _______ ______ _ _______ \r\n" + - "( \\ ( \\ ( ___ )|\\ /|( __ \\ ( )( ____ \\\r\n" + - "| ( | ( | ( ) |( \\ / )| ( \\ )|/ | ( \\/\r\n" + - "| | | | | | | | \\ (_) / | | ) | | (_____ \r\n" + - "| | | | | | | | \\ / | | | | (_____ )\r\n" + - "| | | | | | | | ) ( | | ) | ) |\r\n" + - "| (____/\\| (____/\\| (___) | | | | (__/ ) /\\____) |\r\n" + - "(_______/(_______/(_______) \\_/ (______/ \\_______)\r\n" + - " "; - private final static Set<String> validTriggers = new HashSet<String>(Arrays.asList(new String[] - {"lloyd", "bartender", "barkeep", "Lloyd", "LLOYD", NAME} - )); - - private final static String colorName = BOLD_ON + Color.CYAN + NAME + Color.RESET ; - - public LloydBartender(GameManager gameManager, List<MerchantItemForSale> merchantItemForSales) { - super(gameManager, NAME, colorName, validTriggers, merchantItemForSales, welcomeMessage); - } -} -*/ diff --git a/src/main/java/com/comandante/creeper/merchant/LockerRoomGuy.java b/src/main/java/com/comandante/creeper/merchant/LockerRoomGuy.java deleted file mode 100644 index 72e18877d04f21f61840024558ba033580309a7d..0000000000000000000000000000000000000000 --- a/src/main/java/com/comandante/creeper/merchant/LockerRoomGuy.java +++ /dev/null @@ -1,34 +0,0 @@ -/* -package com.comandante.creeper.merchant; - -import com.comandante.creeper.core_game.GameManager; -import com.comandante.creeper.server.player_communication.Color; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import static com.comandante.creeper.server.player_communication.Color.BOLD_ON; - -public class LockerRoomGuy extends Merchant { - private final static long phraseIntervalMs = 300000; - private final static String NAME = "a bank of lockers"; - private final static String welcomeMessage = "Locker opened."; - private final static Set<String> validTriggers = new HashSet<String>(Arrays.asList(new String[] - {"lockers", "locker", "l", NAME} - )); - - private final static String colorName = BOLD_ON + Color.RED + NAME + Color.RESET; - - public LockerRoomGuy(GameManager gameManager, List<MerchantItemForSale> merchantItemForSales) { - super(gameManager, NAME, colorName, validTriggers, merchantItemForSales, welcomeMessage, MerchantType.LOCKER); - } - - @Override - public String getMenu() { - return null; - } -} - -*/ diff --git a/src/main/java/com/comandante/creeper/merchant/Merchant.java b/src/main/java/com/comandante/creeper/merchant/Merchant.java index 1c8f21d5e1c1aee8c10c49666e9543c8be970c4a..cb0ebc2e7441260f869d3ff037ebf30e4b856288 100644 --- a/src/main/java/com/comandante/creeper/merchant/Merchant.java +++ b/src/main/java/com/comandante/creeper/merchant/Merchant.java @@ -19,13 +19,13 @@ public class Merchant { private final List<MerchantItemForSale> merchantItemForSales; private final String welcomeMessage; private final MerchantType merchantType; - private final Integer roomId; + private final Set<Integer> roomIds; - public Merchant(GameManager gameManager, String internalName, String name, String colorName, Set<String> validTriggers, List<MerchantItemForSale> merchantItemForSales, String welcomeMessage, Integer roomId) { - this(gameManager, internalName, name, colorName, validTriggers, merchantItemForSales, welcomeMessage, roomId, MerchantType.BASIC); + public Merchant(GameManager gameManager, String internalName, String name, String colorName, Set<String> validTriggers, List<MerchantItemForSale> merchantItemForSales, String welcomeMessage, Set<Integer> roomIds) { + this(gameManager, internalName, name, colorName, validTriggers, merchantItemForSales, welcomeMessage, roomIds, MerchantType.BASIC); } - public Merchant(GameManager gameManager, String internalName, String name, String colorName, Set<String> validTriggers, List<MerchantItemForSale> merchantItemForSales, String welcomeMessage, Integer roomId, MerchantType merchantType) { + public Merchant(GameManager gameManager, String internalName, String name, String colorName, Set<String> validTriggers, List<MerchantItemForSale> merchantItemForSales, String welcomeMessage, Set<Integer> roomIds, MerchantType merchantType) { this.gameManager = gameManager; this.name = name; this.colorName = colorName; @@ -33,7 +33,7 @@ public class Merchant { this.merchantItemForSales = merchantItemForSales; this.welcomeMessage = welcomeMessage; this.merchantType = merchantType; - this.roomId = roomId; + this.roomIds = roomIds; this.internalName = internalName; } @@ -72,8 +72,8 @@ public class Merchant { return gameManager; } - public Integer getRoomId() { - return roomId; + public Set<Integer> getRoomIds() { + return roomIds; } public String getName() { diff --git a/src/main/java/com/comandante/creeper/merchant/MerchantMetadata.java b/src/main/java/com/comandante/creeper/merchant/MerchantMetadata.java index 541304ed7eac217272353c93a1062d3636645e99..ba4dc8f59854d2905187b65d52575797e080481e 100644 --- a/src/main/java/com/comandante/creeper/merchant/MerchantMetadata.java +++ b/src/main/java/com/comandante/creeper/merchant/MerchantMetadata.java @@ -6,13 +6,26 @@ import java.util.Set; public class MerchantMetadata { private String internalName; - private Integer roomId; + private Set<Integer> roomIds; private String name; private String colorName; private Set<String> validTriggers; private List<MerchantItemForSale> merchantItemForSales; private String welcomeMessage; + private Merchant.MerchantType merchantType; + public void setMerchantType(Merchant.MerchantType merchantType) { + this.merchantType = merchantType; + } + + public Set<Integer> getRoomIds() { + + return roomIds; + } + + public Merchant.MerchantType getMerchantType() { + return merchantType; + } public String getInternalName() { return internalName; @@ -50,12 +63,12 @@ public class MerchantMetadata { this.internalName = internalName; } - public Integer getRoomId() { - return roomId; + public Set<Integer> getRoomId() { + return roomIds; } - public void setRoomId(Integer roomId) { - this.roomId = roomId; + public void setRoomIds(Set<Integer> roomIds) { + this.roomIds = roomIds; } public void setMerchantItemForSales(List<MerchantItemForSale> merchantItemForSales) { diff --git a/src/main/java/com/comandante/creeper/merchant/NigelBartender.java b/src/main/java/com/comandante/creeper/merchant/NigelBartender.java deleted file mode 100644 index 0829e940f493930f6be08e22d437c12a3c4feabf..0000000000000000000000000000000000000000 --- a/src/main/java/com/comandante/creeper/merchant/NigelBartender.java +++ /dev/null @@ -1,28 +0,0 @@ -/* -package com.comandante.creeper.merchant; - -import com.comandante.creeper.core_game.GameManager; -import com.comandante.creeper.server.player_communication.Color; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import static com.comandante.creeper.server.player_communication.Color.BOLD_ON; - -public class NigelBartender extends Merchant { - private final static long phraseIntervalMs = 300000; - private final static String NAME = "nigel the bartender"; - private final static String welcomeMessage = "\r\n N I G E L 'S B A R \r\n"; - private final static Set<String> validTriggers = new HashSet<String>(Arrays.asList(new String[] - {"nigel", "bartender", "barkeep", "Nigel", "NIGEL", NAME} - )); - - private final static String colorName = BOLD_ON + Color.CYAN + NAME + Color.RESET ; - - public NigelBartender(GameManager gameManager, List<MerchantItemForSale> merchantItemForSales) { - super(gameManager, NAME, colorName, validTriggers, merchantItemForSales, welcomeMessage); - } -} -*/ diff --git a/src/main/java/com/comandante/creeper/merchant/OldWiseMan.java b/src/main/java/com/comandante/creeper/merchant/OldWiseMan.java deleted file mode 100644 index 164caef6bcb07d008cde4e84d6a939f8f0e0a7c4..0000000000000000000000000000000000000000 --- a/src/main/java/com/comandante/creeper/merchant/OldWiseMan.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.comandante.creeper.merchant; - -public class OldWiseMan { - /* private final static long phraseIntervalMs = 300000; - private final static String NAME = "old wise man"; - private final static String colorName = BOLD_ON + Color.CYAN + NAME + Color.RESET; - private final static String welcomeMessage = "The "+ colorName +" can assist you in choosing a character class.\r\n"; - private final static Set<String> validTriggers = new HashSet<String>(Arrays.asList(new String[] - {"wise", "man", "old", "old wise man", "m", "w", NAME} - )); - - - public OldWiseMan(GameManager gameManager, List<MerchantItemForSale> merchantItemForSales) { - super(gameManager, NAME, colorName, validTriggers, merchantItemForSales, welcomeMessage, MerchantType.PLAYERCLASS_SELECTOR); - } - - @Override - public String getMenu() { - return null; - }*/ -} - diff --git a/src/main/java/com/comandante/creeper/merchant/WentworthTailor.java b/src/main/java/com/comandante/creeper/merchant/WentworthTailor.java deleted file mode 100644 index 3df29817e6e297a4b0693b2c899dcd8c0868087b..0000000000000000000000000000000000000000 --- a/src/main/java/com/comandante/creeper/merchant/WentworthTailor.java +++ /dev/null @@ -1,28 +0,0 @@ -/* -package com.comandante.creeper.merchant; - -import com.comandante.creeper.core_game.GameManager; -import com.comandante.creeper.server.player_communication.Color; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import static com.comandante.creeper.server.player_communication.Color.BOLD_ON; - -public class WentworthTailor extends Merchant { - private final static long phraseIntervalMs = 300000; - private final static String NAME = "wentworth"; - private final static String welcomeMessage = "Welcome to WENTWORTH's TAILOR SHOP.\r\n"; - private final static Set<String> validTriggers = new HashSet<String>(Arrays.asList(new String[] - {"wentworth", "w", "tailor", "t", NAME} - )); - - private final static String colorName = BOLD_ON + Color.CYAN + NAME + Color.RESET ; - - public WentworthTailor(GameManager gameManager, List<MerchantItemForSale> merchantItemForSales) { - super(gameManager, NAME, colorName, validTriggers, merchantItemForSales, welcomeMessage); - } -} -*/ diff --git a/src/main/java/com/comandante/creeper/merchant/Wizard.java b/src/main/java/com/comandante/creeper/merchant/Wizard.java deleted file mode 100644 index 23577bcce2258e4b7c301794b1895db8f75a6770..0000000000000000000000000000000000000000 --- a/src/main/java/com/comandante/creeper/merchant/Wizard.java +++ /dev/null @@ -1,42 +0,0 @@ -/* -package com.comandante.creeper.merchant; - -import com.comandante.creeper.core_game.GameManager; -import com.comandante.creeper.server.player_communication.Color; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import static com.comandante.creeper.server.player_communication.Color.BOLD_ON; - -public class Wizard extends Merchant { - private final static long phraseIntervalMs = 300000; - private final static String NAME = "willy the wizard"; - private final static String welcomeMessage = " ____ \n" + - " 6MMMMb\\ \n" + - "6M' ` / \n" + - "MM /M _____ _____ __ ____ \n" + - "YM. /MMMMM 6MMMMMb 6MMMMMb `M6MMMMb \n" + - " YMMMMb MM 6M' `Mb 6M' `Mb MM' `Mb\n" + - " `Mb MM MM MM MM MM MM MM\n" + - " MM MM MM MM MM MM MM MM\n" + - " MM MM MM MM MM MM MM MM\n" + - "L ,M9 YM. , YM. ,M9 YM. ,M9 MM. ,M9\n" + - "MYMMMM9 YMMM9 YMMMMM9 YMMMMM9 MMYMMM9 \n" + - " MM \n" + - " MM \n" + - " _MM_ \n" + - "\n"; - private final static Set<String> validTriggers = new HashSet<String>(Arrays.asList(new String[] - {"wizard", "willy the wizard", "willy", NAME} - )); - - private final static String colorName = BOLD_ON + Color.BLUE + NAME + Color.RESET ; - - public Wizard(GameManager gameManager, List<MerchantItemForSale> merchantItemForSales) { - super(gameManager, NAME, colorName, validTriggers, merchantItemForSales, welcomeMessage); - } -} -*/ diff --git a/src/main/java/com/comandante/creeper/storage/MerchantStorage.java b/src/main/java/com/comandante/creeper/storage/MerchantStorage.java index ec867a65cddf3ab60ed26a419d24861634b0c83b..00e4db471522bb8cf4753d0b6bfbfe2b5a2dc919 100644 --- a/src/main/java/com/comandante/creeper/storage/MerchantStorage.java +++ b/src/main/java/com/comandante/creeper/storage/MerchantStorage.java @@ -32,6 +32,19 @@ public class MerchantStorage { } public Merchant create(MerchantMetadata merchantMetadata) { + + if (merchantMetadata.getMerchantType() != null) { + return new Merchant(gameManager, + merchantMetadata.getInternalName(), + merchantMetadata.getName(), + merchantMetadata.getColorName(), + merchantMetadata.getValidTriggers(), + merchantMetadata.getMerchantItemForSales(), + merchantMetadata.getWelcomeMessage(), + merchantMetadata.getRoomId(), + merchantMetadata.getMerchantType()); + } + return new Merchant(gameManager, merchantMetadata.getInternalName(), merchantMetadata.getName(), @@ -42,11 +55,6 @@ public class MerchantStorage { merchantMetadata.getRoomId()); } - - public List<MerchantMetadata> getAllMerchantMetadatas() { - return merchantMetadatas; - } - public void saveMerchantMetadata(MerchantMetadata merchantMetadata) throws IOException { filebasedJsonStorage.saveMetadata(merchantMetadata.getInternalName(), LOCAL_MERCHANT_DIRECTORY, merchantMetadata); } diff --git a/src/main/java/com/comandante/creeper/world/RoomManager.java b/src/main/java/com/comandante/creeper/world/RoomManager.java index 6f300cec1d765c4726a1f5d7f7ad19acaa54552a..ddb6b3464d8c22d47ad937c65f00d4ddc88ff27f 100644 --- a/src/main/java/com/comandante/creeper/world/RoomManager.java +++ b/src/main/java/com/comandante/creeper/world/RoomManager.java @@ -44,7 +44,9 @@ public class RoomManager { } public void addMerchant(Merchant merchant) { - getRoom(merchant.getRoomId()).addMerchant(merchant); + for (Integer roomId: merchant.getRoomIds()) { + getRoom(roomId).addMerchant(merchant); + }; } public Room getRoom(Integer roomId) { diff --git a/src/test/com/comandante/creeper/items/ItemMetadataTest.java b/src/test/com/comandante/creeper/items/ItemMetadataTest.java index f86d59a32876da6e1c396c1da02007747e313b4d..68f60545a9f32c7ebedb5af61d384ba99336fb07 100644 --- a/src/test/com/comandante/creeper/items/ItemMetadataTest.java +++ b/src/test/com/comandante/creeper/items/ItemMetadataTest.java @@ -1,12 +1,19 @@ package com.comandante.creeper.items; +import com.comandante.creeper.merchant.Merchant; import com.comandante.creeper.merchant.MerchantItemForSale; import com.comandante.creeper.merchant.MerchantMetadata; import com.comandante.creeper.server.player_communication.Color; +import com.comandante.creeper.spawner.SpawnRule; +import com.comandante.creeper.spawner.SpawnRuleBuilder; +import com.comandante.creeper.stats.Stats; +import com.comandante.creeper.stats.StatsBuilder; import com.comandante.creeper.storage.FilebasedJsonStorage; import com.comandante.creeper.storage.ItemStorage; import com.comandante.creeper.storage.MerchantStorage; +import com.comandante.creeper.world.model.Area; import com.google.common.collect.Lists; +import com.google.common.collect.Sets; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import org.junit.Test; @@ -88,144 +95,184 @@ public class ItemMetadataTest { FilebasedJsonStorage filebasedJsonStorage = new FilebasedJsonStorage(new GsonBuilder().setPrettyPrinting().create()); ItemStorage itemStorage = new ItemStorage(filebasedJsonStorage); -// -// BERSERKER BOOTS -// ItemMetadata itemMetadata = metadataFrom(ItemType.BERSEKER_BOOTS); -// Stats stats = new StatsBuilder().setArmorRating(3).createStats(); -// final Equipment equipment = new Equipment(EquipmentSlotType.FEET, stats); -// itemMetadata.setEquipment(equipment); -// itemMetadata.setInternalItemName("beserker boots"); -// itemStorage.saveItemMetadata(itemMetadata); -// -// BERSERKER HELM -// ItemMetadata itemMetadataHelm = metadataFrom(ItemType.BERSEKER_HELM); -// Stats statsHelm = new StatsBuilder().setArmorRating(3).createStats(); -// final Equipment equipmentHeml = new Equipment(EquipmentSlotType.HEAD, statsHelm); -// itemMetadataHelm.setEquipment(equipmentHeml); -// itemMetadataHelm.setInternalItemName("beserker helm"); -// itemStorage.saveItemMetadata(itemMetadataHelm); -// -// -// BERSERKER SHORTS -// ItemMetadata itemMetadataShorts = metadataFrom(ItemType.BERSEKER_SHORTS); -// Stats statsShorts = new StatsBuilder().setArmorRating(4).createStats(); -// final Equipment equipmentShorts = new Equipment(EquipmentSlotType.LEGS, statsShorts); -// itemMetadataShorts.setEquipment(equipmentShorts); -// itemMetadataShorts.setInternalItemName("beserker shorts"); -// itemStorage.saveItemMetadata(itemMetadataShorts); -// -// -// BERSERKER BATON -// ItemMetadata itemMetadataBaton = metadataFrom(ItemType.BERSERKER_BATON); -// Stats statsBaton = new StatsBuilder().setWeaponRatingMin(4).setWeaponRatingMax(6).createStats(); -// final Equipment equipmentBaton = new Equipment(EquipmentSlotType.HAND, statsBaton); -// itemMetadataBaton.setEquipment(equipmentBaton); -// itemMetadataBaton.setInternalItemName("beserker baton"); -// itemStorage.saveItemMetadata(itemMetadataBaton); -// -// BERSERKER BATON -// ItemMetadata itemMetadataBracers = metadataFrom(ItemType.BERSERKER_BRACERS); -// Stats statsBracers = new StatsBuilder().setArmorRating(4).createStats(); -// final Equipment equipmentBracers = new Equipment(EquipmentSlotType.WRISTS, statsBracers); -// itemMetadataBracers.setEquipment(equipmentBracers); -// itemMetadataBracers.setInternalItemName("beserker bracers"); -// itemStorage.saveItemMetadata(itemMetadataBracers); -// -// -// BERSERKER BATON -// ItemMetadata itemMetadataChest = metadataFrom(ItemType.BERSERKER_CHEST); -// Stats statsChest = new StatsBuilder().setArmorRating(6).createStats(); -// final Equipment equipmentChest = new Equipment(EquipmentSlotType.CHEST, statsChest); -// itemMetadataChest.setEquipment(equipmentChest); -// itemMetadataChest.setInternalItemName("beserker chest"); -// itemStorage.saveItemMetadata(itemMetadataChest); -// -// BIGGERS SKIN SATCHEL -// ItemMetadata itemMetadataBiggersSkinSatchel = metadataFrom(ItemType.BIGGERS_SKIN_SATCHEL); -// Stats statsBiggersSkinSatchel = new StatsBuilder().setInventorySize(100).createStats(); -// final Equipment equipmentBiggersSkinSatchel= new Equipment(EquipmentSlotType.BAG, statsBiggersSkinSatchel); -// itemMetadataBiggersSkinSatchel.setEquipment(equipmentBiggersSkinSatchel); -// itemMetadataBiggersSkinSatchel.setInternalItemName("biggers skin satchel"); -// itemStorage.saveItemMetadata(itemMetadataBiggersSkinSatchel); -// -// -// Key -// ItemMetadata itemMetadataKey = metadataFrom(ItemType.KEY); -// itemMetadataKey.setInternalItemName("basic key"); -// SpawnRule spawnRule = new SpawnRuleBuilder().setArea(Area.LOBBY).setSpawnIntervalTicks(600).setMaxInstances(1).setMaxPerRoom(1).setRandomPercent(5).createSpawnRule(); -// itemMetadataKey.setSpawnRules(Sets.newHashSet(spawnRule)); -// itemStorage.saveItemMetadata(itemMetadataKey); -// -// -// Marijuana -// ItemMetadata itemMetadataMarijuana = metadataFrom(ItemType.MARIJUANA); -// itemMetadataMarijuana.setInternalItemName("marijuana"); -// ForageBuilder marijuanaForageBuilder = new ForageBuilder(); -// marijuanaForageBuilder.setMinAmt(1); -// marijuanaForageBuilder.setMaxAmt(3); -// marijuanaForageBuilder.setPctOfSuccess(40); -// marijuanaForageBuilder.setForageExperience(4); -// marijuanaForageBuilder.setCoolDownTicks(600); -// marijuanaForageBuilder.setAreas(Sets.newHashSet(Area.WESTERN9_ZONE, Area.NORTH3_ZONE, Area.BLOODRIDGE2_ZONE, Area.BLOODRIDGE1_ZONE)); -// itemMetadataMarijuana.setForages(Sets.newHashSet(marijuanaForageBuilder.createForage())); -// itemStorage.saveItemMetadata(itemMetadataMarijuana); -// -// Drank -// ItemMetadata itemMetadataDrank = metadataFrom(ItemType.PURPLE_DRANK); -// itemMetadataDrank.setInternalItemName("purple drank"); -// Stats statsDrank = new StatsBuilder().setCurrentHealth(50).createStats(); -// itemMetadataDrank.setItemApplyStats(statsDrank); -// itemStorage.saveItemMetadata(itemMetadataDrank); -// -// Smell Health Potion -// Set<SpawnRule> spawnRulesHealthPotion = Sets.newHashSet( -// new SpawnRuleBuilder().setArea(Area.NEWBIE_ZONE).setSpawnIntervalTicks(600).setMaxInstances(100).setMaxPerRoom(5).setRandomPercent(40).createSpawnRule(), -// new SpawnRuleBuilder().setArea(Area.FANCYHOUSE_ZONE).setSpawnIntervalTicks(600).setMaxInstances(12).setMaxPerRoom(2).setRandomPercent(50).createSpawnRule(), -// new SpawnRuleBuilder().setArea(Area.HOUSE_ZONE).setSpawnIntervalTicks(600).setMaxInstances(12).setMaxPerRoom(2).setRandomPercent(50).createSpawnRule() -// ); -// ItemMetadata itemMetadataHealthPotion = metadataFrom(ItemType.SMALL_HEALTH_POTION); -// itemMetadataHealthPotion.setInternalItemName("small health potion"); -// Stats statsHealthPotion = new StatsBuilder().setCurrentHealth(20).createStats(); -// itemMetadataHealthPotion.setSpawnRules(spawnRulesHealthPotion); -// itemMetadataHealthPotion.setItemApplyStats(statsHealthPotion); -// itemStorage.saveItemMetadata(itemMetadataHealthPotion); -// -// -// BIGGERS SKIN SATCHEL -// ItemMetadata itemMetadataSpellbook = metadataFrom(ItemType.LIGHTNING_SPELLBOOKNG); -// itemMetadataSpellbook.setInternalItemName("lightning spellbook"); -// itemStorage.saveItemMetadata(itemMetadataSpellbook); -// -// Stick OF Justice -// ItemMetadata itemMetadataStickOfJustice = metadataFrom(ItemType.STICK_OF_JUSTICE); -// itemMetadataStickOfJustice.setInternalItemName("stick of justice"); -// itemStorage.saveItemMetadata(itemMetadataStickOfJustice); -// -// RED CLAW BEANIE -// ItemMetadata itemMetadataBeanie = metadataFrom(ItemType.RED_CLAW_BEANIE); -// Stats statsBeanie = new StatsBuilder().setArmorRating(8).setStrength(4).setMaxHealth(50).createStats(); -// final Equipment equipmentBeanie = new Equipment(EquipmentSlotType.HEAD, statsBeanie); -// itemMetadataBeanie.setEquipment(equipmentBeanie); -// itemMetadataBeanie.setInternalItemName("red claw beanie"); -// itemStorage.saveItemMetadata(itemMetadataBeanie); -// -// -// RED CLAW Hoodie -// ItemMetadata itemMetadataHoodie = metadataFrom(ItemType.RED_CLAW_HOODIE); -// Stats statsHoodie = new StatsBuilder().setArmorRating(15).setStrength(7).createStats(); -// final Equipment equipmentHoodie = new Equipment(EquipmentSlotType.CHEST, statsHoodie); -// itemMetadataHoodie.setEquipment(equipmentHoodie); -// itemMetadataHoodie.setInternalItemName("rad claw hoodie"); -// itemStorage.saveItemMetadata(itemMetadataHoodie); -// -// - // RED CLAW PANTS -// ItemMetadata itemMetadataPants = metadataFrom(ItemType.RED_CLAW_PANTS); -// Stats statsPants = new StatsBuilder().setArmorRating(15).setStrength(7).createStats(); -// final Equipment equipmentPants = new Equipment(EquipmentSlotType.LEGS, statsPants); -// itemMetadataPants.setEquipment(equipmentPants); -// itemMetadataPants.setInternalItemName("rad claw pants1"); -// itemStorage.saveItemMetadata(itemMetadataPants); + + //BERSERKER BOOTS + { + ItemMetadata itemMetadata = metadataFrom(ItemType.BERSEKER_BOOTS); + Stats stats = new StatsBuilder().setArmorRating(3).createStats(); + final Equipment equipment = new Equipment(EquipmentSlotType.FEET, stats); + itemMetadata.setEquipment(equipment); + itemMetadata.setInternalItemName("beserker boots"); + itemStorage.saveItemMetadata(itemMetadata); + } + + // BERSERKER HELM + { + ItemMetadata itemMetadataHelm = metadataFrom(ItemType.BERSEKER_HELM); + Stats statsHelm = new StatsBuilder().setArmorRating(3).createStats(); + final Equipment equipmentHeml = new Equipment(EquipmentSlotType.HEAD, statsHelm); + itemMetadataHelm.setEquipment(equipmentHeml); + itemMetadataHelm.setInternalItemName("beserker helm"); + itemStorage.saveItemMetadata(itemMetadataHelm); + } + + + //BERSERKER SHORTS + { + ItemMetadata itemMetadataShorts = metadataFrom(ItemType.BERSEKER_SHORTS); + Stats statsShorts = new StatsBuilder().setArmorRating(4).createStats(); + final Equipment equipmentShorts = new Equipment(EquipmentSlotType.LEGS, statsShorts); + itemMetadataShorts.setEquipment(equipmentShorts); + itemMetadataShorts.setInternalItemName("beserker shorts"); + itemStorage.saveItemMetadata(itemMetadataShorts); + } + + + // BERSERKER BATON + { + ItemMetadata itemMetadataBaton = metadataFrom(ItemType.BERSERKER_BATON); + Stats statsBaton = new StatsBuilder().setWeaponRatingMin(4).setWeaponRatingMax(6).createStats(); + final Equipment equipmentBaton = new Equipment(EquipmentSlotType.HAND, statsBaton); + itemMetadataBaton.setEquipment(equipmentBaton); + itemMetadataBaton.setInternalItemName("beserker baton"); + itemStorage.saveItemMetadata(itemMetadataBaton); + } + + // BERSERKER BATON + { + ItemMetadata itemMetadataBracers = metadataFrom(ItemType.BERSERKER_BRACERS); + Stats statsBracers = new StatsBuilder().setArmorRating(4).createStats(); + final Equipment equipmentBracers = new Equipment(EquipmentSlotType.WRISTS, statsBracers); + itemMetadataBracers.setEquipment(equipmentBracers); + itemMetadataBracers.setInternalItemName("beserker bracers"); + itemStorage.saveItemMetadata(itemMetadataBracers); + } + + + // BERSERKER BATON + { + ItemMetadata itemMetadataChest = metadataFrom(ItemType.BERSERKER_CHEST); + Stats statsChest = new StatsBuilder().setArmorRating(6).createStats(); + final Equipment equipmentChest = new Equipment(EquipmentSlotType.CHEST, statsChest); + itemMetadataChest.setEquipment(equipmentChest); + itemMetadataChest.setInternalItemName("beserker chest"); + itemStorage.saveItemMetadata(itemMetadataChest); + } + + // BIGGERS SKIN SATCHEL + { + ItemMetadata itemMetadataBiggersSkinSatchel = metadataFrom(ItemType.BIGGERS_SKIN_SATCHEL); + Stats statsBiggersSkinSatchel = new StatsBuilder().setInventorySize(100).createStats(); + final Equipment equipmentBiggersSkinSatchel = new Equipment(EquipmentSlotType.BAG, statsBiggersSkinSatchel); + itemMetadataBiggersSkinSatchel.setEquipment(equipmentBiggersSkinSatchel); + itemMetadataBiggersSkinSatchel.setInternalItemName("biggers skin satchel"); + itemStorage.saveItemMetadata(itemMetadataBiggersSkinSatchel); + } + + //Key + { + ItemMetadata itemMetadataKey = metadataFrom(ItemType.KEY); + itemMetadataKey.setInternalItemName("basic key"); + SpawnRule spawnRule = new SpawnRuleBuilder().setArea(Area.LOBBY).setSpawnIntervalTicks(600).setMaxInstances(1).setMaxPerRoom(1).setRandomPercent(5).createSpawnRule(); + itemMetadataKey.setSpawnRules(Sets.newHashSet(spawnRule)); + itemStorage.saveItemMetadata(itemMetadataKey); + } + + + // Marijuana + { + ItemMetadata itemMetadataMarijuana = metadataFrom(ItemType.MARIJUANA); + itemMetadataMarijuana.setInternalItemName("marijuana"); + ForageBuilder marijuanaForageBuilder = new ForageBuilder(); + marijuanaForageBuilder.setMinAmt(1); + marijuanaForageBuilder.setMaxAmt(3); + marijuanaForageBuilder.setPctOfSuccess(40); + marijuanaForageBuilder.setForageExperience(4); + marijuanaForageBuilder.setCoolDownTicks(600); + marijuanaForageBuilder.setAreas(Sets.newHashSet(Area.WESTERN9_ZONE, Area.NORTH3_ZONE, Area.BLOODRIDGE2_ZONE, Area.BLOODRIDGE1_ZONE)); + itemMetadataMarijuana.setForages(Sets.newHashSet(marijuanaForageBuilder.createForage())); + itemStorage.saveItemMetadata(itemMetadataMarijuana); + } + + // Drank + { + ItemMetadata itemMetadataDrank = metadataFrom(ItemType.PURPLE_DRANK); + itemMetadataDrank.setInternalItemName("purple drank"); + Stats statsDrank = new StatsBuilder().setCurrentHealth(50).createStats(); + itemMetadataDrank.setItemApplyStats(statsDrank); + itemStorage.saveItemMetadata(itemMetadataDrank); + } + + // Smell Health Potion + { + Set<SpawnRule> spawnRulesHealthPotion = Sets.newHashSet( + new SpawnRuleBuilder().setArea(Area.NEWBIE_ZONE).setSpawnIntervalTicks(600).setMaxInstances(100).setMaxPerRoom(5).setRandomPercent(40).createSpawnRule(), + new SpawnRuleBuilder().setArea(Area.FANCYHOUSE_ZONE).setSpawnIntervalTicks(600).setMaxInstances(12).setMaxPerRoom(2).setRandomPercent(50).createSpawnRule(), + new SpawnRuleBuilder().setArea(Area.HOUSE_ZONE).setSpawnIntervalTicks(600).setMaxInstances(12).setMaxPerRoom(2).setRandomPercent(50).createSpawnRule() + ); + ItemMetadata itemMetadataHealthPotion = metadataFrom(ItemType.SMALL_HEALTH_POTION); + itemMetadataHealthPotion.setInternalItemName("small health potion"); + Stats statsHealthPotion = new StatsBuilder().setCurrentHealth(20).createStats(); + itemMetadataHealthPotion.setSpawnRules(spawnRulesHealthPotion); + itemMetadataHealthPotion.setItemApplyStats(statsHealthPotion); + itemStorage.saveItemMetadata(itemMetadataHealthPotion); + } + + { + + // BIGGERS SKIN SATCHEL + ItemMetadata itemMetadataSpellbook = metadataFrom(ItemType.LIGHTNING_SPELLBOOKNG); + itemMetadataSpellbook.setInternalItemName("lightning spellbook"); + itemStorage.saveItemMetadata(itemMetadataSpellbook); + } + + { + // Stick OF Justice + ItemMetadata itemMetadataStickOfJustice = metadataFrom(ItemType.STICK_OF_JUSTICE); + itemMetadataStickOfJustice.setInternalItemName("stick of justice"); + itemStorage.saveItemMetadata(itemMetadataStickOfJustice); + } + + + { + // RED CLAW BEANIE + ItemMetadata itemMetadataBeanie = metadataFrom(ItemType.RED_CLAW_BEANIE); + Stats statsBeanie = new StatsBuilder().setArmorRating(8).setStrength(4).setMaxHealth(50).createStats(); + final Equipment equipmentBeanie = new Equipment(EquipmentSlotType.HEAD, statsBeanie); + itemMetadataBeanie.setEquipment(equipmentBeanie); + itemMetadataBeanie.setInternalItemName("red claw beanie"); + itemStorage.saveItemMetadata(itemMetadataBeanie); + } + + { + // RED CLAW Hoodie + ItemMetadata itemMetadataHoodie = metadataFrom(ItemType.RED_CLAW_HOODIE); + Stats statsHoodie = new StatsBuilder().setArmorRating(15).setStrength(7).createStats(); + final Equipment equipmentHoodie = new Equipment(EquipmentSlotType.CHEST, statsHoodie); + itemMetadataHoodie.setEquipment(equipmentHoodie); + itemMetadataHoodie.setInternalItemName("rad claw hoodie"); + itemStorage.saveItemMetadata(itemMetadataHoodie); + } + + { + // RED CLAW PANTS + ItemMetadata itemMetadataPants = metadataFrom(ItemType.RED_CLAW_PANTS); + Stats statsPants = new StatsBuilder().setArmorRating(15).setStrength(7).createStats(); + final Equipment equipmentPants = new Equipment(EquipmentSlotType.LEGS, statsPants); + itemMetadataPants.setEquipment(equipmentPants); + itemMetadataPants.setInternalItemName("rad claw pants"); + itemStorage.saveItemMetadata(itemMetadataPants); + //Lether Satchel + } + + { + ItemMetadata itemMetadataPants = metadataFrom(ItemType.LEATHER_SATCHEL); + Stats stats = new StatsBuilder().setInventorySize(15).createStats(); + final Equipment equipment = new Equipment(EquipmentSlotType.BAG, stats); + itemMetadataPants.setEquipment(equipment); + itemMetadataPants.setInternalItemName("leather satchel"); + itemStorage.saveItemMetadata(itemMetadataPants); + } } @@ -267,9 +314,9 @@ public class ItemMetadataTest { String name = "lloyd the bartender"; - String colorName = BOLD_ON + Color.CYAN + name + Color.RESET; + String colorName = BOLD_ON + Color.CYAN + name + Color.RESET; Set<String> validTriggers = new HashSet<String>(Arrays.asList(new String[] - {"lloyd", "bartender", "barkeep", "Lloyd", "LLOYD", name})); + {"lloyd", "bartender", "barkeep", "Lloyd", "LLOYD", name})); List<MerchantItemForSale> itemsForSale = Lists.newArrayList(); itemsForSale.add(new MerchantItemForSale("small health potion", 8)); @@ -280,10 +327,170 @@ public class ItemMetadataTest { merchantMetadata.setInternalName(name); merchantMetadata.setColorName(colorName); merchantMetadata.setMerchantItemForSales(itemsForSale); - merchantMetadata.setRoomId(64); + merchantMetadata.setRoomIds(Sets.newHashSet(64)); + merchantMetadata.setValidTriggers(validTriggers); + merchantMetadata.setWelcomeMessage(welcomeMessage); + + FilebasedJsonStorage filebasedJsonStorage = new FilebasedJsonStorage(new GsonBuilder().setPrettyPrinting().create()); + MerchantStorage merchantStorage = new MerchantStorage(null, filebasedJsonStorage); + merchantStorage.saveMerchantMetadata(merchantMetadata); + + } + + // BIGGER BLACKSMITH + { + final String welcomeMessage = " ____ _ \n" + + "\" +\n" + + " \" | __ )(_) __ _ __ _ ___ _ __ ___ \\r\\n\" +\n" + + " \" | _ \\\\| |/ _` |/ _` |/ _ \\\\ '__/ __| \\r\\n\" +\n" + + " \" | |_) | | (_| | (_| | __/ | \\\\__ \\\\ \\r\\n\" +\n" + + " \" |____/|_|\\\\__, |\\\\__, |\\\\___|_| |___/ \\r\\n\" +\n" + + " \" ____ |___/ |___/ _ _ _ _ \\r\\n\" +\n" + + " \" | __ )| | __ _ ___| | _____ _ __ ___ (_) |_| |__ \\r\\n\" +\n" + + " \" | _ \\\\| |/ _` |/ __| |/ / __| '_ ` _ \\\\| | __| '_ \\\\ \\r\\n\" +\n" + + " \" | |_) | | (_| | (__| <\\\\__ \\\\ | | | | | | |_| | | |\\r\\n\" +\n" + + " \" |____/|_|\\__,_|\\___|_|\\_\\___/_| |_| |_|_|\\__|_| |_|\n"; + + + String name = "biggers the blacksmith"; + String colorName = BOLD_ON + Color.CYAN + name + Color.RESET; + Set<String> validTriggers = new HashSet<String>(Arrays.asList(new String[] + {"blacksmith", "biggers the blacksmith", "biggers", name})); + + List<MerchantItemForSale> blacksmithItems = Lists.newArrayList(); + blacksmithItems.add(new MerchantItemForSale("berserker baton", 10000)); + blacksmithItems.add(new MerchantItemForSale("berserker boots", 3500)); + blacksmithItems.add(new MerchantItemForSale("berserker bracers", 3500)); + blacksmithItems.add(new MerchantItemForSale("berserker helm", 3500)); + blacksmithItems.add(new MerchantItemForSale("berserker chest", 7000)); + blacksmithItems.add(new MerchantItemForSale("berserker shorts", 8500)); + blacksmithItems.add(new MerchantItemForSale("leather satchel", 600)); + MerchantMetadata merchantMetadata = new MerchantMetadata(); + merchantMetadata.setName(name); + merchantMetadata.setInternalName(name); + merchantMetadata.setColorName(colorName); + merchantMetadata.setMerchantItemForSales(blacksmithItems); + merchantMetadata.setRoomIds(Sets.newHashSet(66, 253)); + merchantMetadata.setValidTriggers(validTriggers); + merchantMetadata.setWelcomeMessage(welcomeMessage); + FilebasedJsonStorage filebasedJsonStorage = new FilebasedJsonStorage(new GsonBuilder().setPrettyPrinting().create()); + MerchantStorage merchantStorage = new MerchantStorage(null, filebasedJsonStorage); + merchantStorage.saveMerchantMetadata(merchantMetadata); + } + + { + String name = "nigel the bartender"; + String colorName = BOLD_ON + Color.CYAN + name + Color.RESET; + Set<String> validTriggers = new HashSet<String>(Arrays.asList(new String[] + {"nigel", "bartender", "barkeep", "Nigel", "NIGEL", name})); + + List<MerchantItemForSale> blacksmithItems = Lists.newArrayList(); + blacksmithItems.add(new MerchantItemForSale("small health potion", 6)); + MerchantMetadata merchantMetadata = new MerchantMetadata(); + merchantMetadata.setName(name); + merchantMetadata.setInternalName(name); + merchantMetadata.setColorName(colorName); + merchantMetadata.setMerchantItemForSales(blacksmithItems); + merchantMetadata.setRoomIds(Sets.newHashSet(377)); + merchantMetadata.setValidTriggers(validTriggers); + merchantMetadata.setWelcomeMessage("\r\n N I G E L 'S B A R \r\n"); + FilebasedJsonStorage filebasedJsonStorage = new FilebasedJsonStorage(new GsonBuilder().setPrettyPrinting().create()); + MerchantStorage merchantStorage = new MerchantStorage(null, filebasedJsonStorage); + merchantStorage.saveMerchantMetadata(merchantMetadata); + + } + + { + String name = "willy the wizard"; + String colorName = BOLD_ON + Color.CYAN + name + Color.RESET; + Set<String> validTriggers = new HashSet<String>(Arrays.asList(new String[] + {"wizard", "willy the wizard", "willy", name})); + + List<MerchantItemForSale> items = Lists.newArrayList(); + items.add(new MerchantItemForSale("lightning spellbook", 50000)); + MerchantMetadata merchantMetadata = new MerchantMetadata(); + merchantMetadata.setName(name); + merchantMetadata.setInternalName(name); + merchantMetadata.setColorName(colorName); + merchantMetadata.setMerchantItemForSales(items); + merchantMetadata.setRoomIds(Sets.newHashSet(98)); + merchantMetadata.setValidTriggers(validTriggers); + String welcomeMessage = " ____ \n" + + " 6MMMMb\\ \n" + + "6M' ` / \n" + + "MM /M _____ _____ __ ____ \n" + + "YM. /MMMMM 6MMMMMb 6MMMMMb `M6MMMMb \n" + + " YMMMMb MM 6M' `Mb 6M' `Mb MM' `Mb\n" + + " `Mb MM MM MM MM MM MM MM\n" + + " MM MM MM MM MM MM MM MM\n" + + " MM MM MM MM MM MM MM MM\n" + + "L ,M9 YM. , YM. ,M9 YM. ,M9 MM. ,M9\n" + + "MYMMMM9 YMMM9 YMMMMM9 YMMMMM9 MMYMMM9 \n" + + " MM \n" + + " MM \n" + + " _MM_ \n" + + "\n"; + merchantMetadata.setWelcomeMessage(welcomeMessage); + FilebasedJsonStorage filebasedJsonStorage = new FilebasedJsonStorage(new GsonBuilder().setPrettyPrinting().create()); + MerchantStorage merchantStorage = new MerchantStorage(null, filebasedJsonStorage); + merchantStorage.saveMerchantMetadata(merchantMetadata); + + } + + + + { + String welcomeMessage = "Welcome to the First National Bank of Creeper."; + final String name = "jim the banker"; + final String colorName = BOLD_ON + Color.CYAN + name + Color.RESET; + Set<String> validTriggers = new HashSet<String>(Arrays.asList(new String[] + {"bank", "banker", "jim the banker", "jim", "j", name})); + MerchantMetadata merchantMetadata = new MerchantMetadata(); + merchantMetadata.setWelcomeMessage(welcomeMessage); + merchantMetadata.setName(name); + merchantMetadata.setInternalName(name); + merchantMetadata.setColorName(colorName); merchantMetadata.setValidTriggers(validTriggers); + merchantMetadata.setMerchantType(Merchant.MerchantType.BANK); + merchantMetadata.setRoomIds(Sets.newHashSet(65, 209)); + FilebasedJsonStorage filebasedJsonStorage = new FilebasedJsonStorage(new GsonBuilder().setPrettyPrinting().create()); + MerchantStorage merchantStorage = new MerchantStorage(null, filebasedJsonStorage); + merchantStorage.saveMerchantMetadata(merchantMetadata); + } + + { + final String name = "old wise man"; + final String colorName = BOLD_ON + Color.CYAN + name + Color.RESET; + String welcomeMessage = "The " + colorName + " can assist you in choosing a character class.\r\n"; + Set<String> validTriggers = new HashSet<String>(Arrays.asList(new String[] + {"wise", "man", "old", "old wise man", "m", "w", name})); + MerchantMetadata merchantMetadata = new MerchantMetadata(); merchantMetadata.setWelcomeMessage(welcomeMessage); + merchantMetadata.setName(name); + merchantMetadata.setInternalName(name); + merchantMetadata.setColorName(colorName); + merchantMetadata.setValidTriggers(validTriggers); + merchantMetadata.setMerchantType(Merchant.MerchantType.PLAYERCLASS_SELECTOR); + merchantMetadata.setRoomIds(Sets.newHashSet(2)); + FilebasedJsonStorage filebasedJsonStorage = new FilebasedJsonStorage(new GsonBuilder().setPrettyPrinting().create()); + MerchantStorage merchantStorage = new MerchantStorage(null, filebasedJsonStorage); + merchantStorage.saveMerchantMetadata(merchantMetadata); + } + { + final String name = "a bank of lockers"; + final String colorName = BOLD_ON + Color.CYAN + name + Color.RESET; + String welcomeMessage = "Locker opened."; + Set<String> validTriggers = new HashSet<String>(Arrays.asList(new String[] + {"lockers", "locker", "l", name})); + MerchantMetadata merchantMetadata = new MerchantMetadata(); + merchantMetadata.setWelcomeMessage(welcomeMessage); + merchantMetadata.setName(name); + merchantMetadata.setInternalName(name); + merchantMetadata.setColorName(colorName); + merchantMetadata.setValidTriggers(validTriggers); + merchantMetadata.setMerchantType(Merchant.MerchantType.LOCKER); + merchantMetadata.setRoomIds(Sets.newHashSet(63)); FilebasedJsonStorage filebasedJsonStorage = new FilebasedJsonStorage(new GsonBuilder().setPrettyPrinting().create()); MerchantStorage merchantStorage = new MerchantStorage(null, filebasedJsonStorage); merchantStorage.saveMerchantMetadata(merchantMetadata); diff --git a/world/items/leather_satchel.json b/world/items/leather_satchel.json new file mode 100644 index 0000000000000000000000000000000000000000..6cc70f06bad0cfcc954ce94d3099007677087486 --- /dev/null +++ b/world/items/leather_satchel.json @@ -0,0 +1,39 @@ +{ + "internalItemName": "leather satchel", + "itemName": "a \u001b[32mleather satchel\u001b[m", + "itemDescription": "a \u001b[32mleather satchel\u001b[m (15 items)", + "restingName": "a \u001b[32mleather satchel\u001b[m", + "valueInGold": 800, + "itemHalfLifeTicks": 60, + "rarity": "BASIC", + "equipment": { + "equipmentSlotType": "BAG", + "statsIncreaseWhileEquipped": { + "strength": 0, + "intelligence": 0, + "willpower": 0, + "aim": 0, + "agile": 0, + "armorRating": 0, + "meleSkill": 0, + "currentHealth": 0, + "maxHealth": 0, + "weaponRatingMax": 0, + "weaponRatingMin": 0, + "numberOfWeaponRolls": 0, + "experience": 0, + "currentMana": 0, + "maxMana": 0, + "foraging": 0, + "inventorySize": 15, + "maxEffects": 0 + } + }, + "itemTriggers": [ + "leather satchel", + "satchel" + ], + "validTimeOfDays": [], + "isDisposable": false, + "maxUses": 0 +} \ No newline at end of file diff --git a/world/items/marijuana.json b/world/items/marijuana.json index d32983c0802058c4d231931bae864f3a5e82c922..59a82bcdf70919fc6d590fc92066b6cb2dd736fd 100644 --- a/world/items/marijuana.json +++ b/world/items/marijuana.json @@ -31,8 +31,7 @@ "BLOODRIDGE1_ZONE", "WESTERN9_ZONE", "NORTH3_ZONE" - ], - "entityId": "8fe8b5a9-55e3-4706-9aee-474d52684d05" + ] } ] } \ No newline at end of file diff --git a/world/merchants/a_bank_of_lockers.json b/world/merchants/a_bank_of_lockers.json new file mode 100644 index 0000000000000000000000000000000000000000..094a16ae97ed82df9d7d1fa40f52bc7b029bb9c4 --- /dev/null +++ b/world/merchants/a_bank_of_lockers.json @@ -0,0 +1,16 @@ +{ + "internalName": "a bank of lockers", + "roomIds": [ + 63 + ], + "name": "a bank of lockers", + "colorName": "\u001b[1m\u001b[36ma bank of lockers\u001b[m", + "validTriggers": [ + "a bank of lockers", + "lockers", + "l", + "locker" + ], + "welcomeMessage": "Locker opened.", + "merchantType": "LOCKER" +} \ No newline at end of file diff --git a/world/merchants/biggers_the_blacksmith.json b/world/merchants/biggers_the_blacksmith.json new file mode 100644 index 0000000000000000000000000000000000000000..afa9c10b28a25c15a96aaa1628de360c8e444a4b --- /dev/null +++ b/world/merchants/biggers_the_blacksmith.json @@ -0,0 +1,45 @@ +{ + "internalName": "biggers the blacksmith", + "roomIds": [ + 253, + 66 + ], + "name": "biggers the blacksmith", + "colorName": "\u001b[1m\u001b[36mbiggers the blacksmith\u001b[m", + "validTriggers": [ + "blacksmith", + "biggers", + "biggers the blacksmith" + ], + "merchantItemForSales": [ + { + "internalItemName": "berserker baton", + "cost": 10000 + }, + { + "internalItemName": "berserker boots", + "cost": 3500 + }, + { + "internalItemName": "berserker bracers", + "cost": 3500 + }, + { + "internalItemName": "berserker helm", + "cost": 3500 + }, + { + "internalItemName": "berserker chest", + "cost": 7000 + }, + { + "internalItemName": "berserker shorts", + "cost": 8500 + }, + { + "internalItemName": "leather satchel", + "cost": 600 + } + ], + "welcomeMessage": " ____ _ \n\" +\n \" | __ )(_) __ _ __ _ ___ _ __ ___ \\r\\n\" +\n \" | _ \\\\| |/ _` |/ _` |/ _ \\\\ \u0027__/ __| \\r\\n\" +\n \" | |_) | | (_| | (_| | __/ | \\\\__ \\\\ \\r\\n\" +\n \" |____/|_|\\\\__, |\\\\__, |\\\\___|_| |___/ \\r\\n\" +\n \" ____ |___/ |___/ _ _ _ _ \\r\\n\" +\n \" | __ )| | __ _ ___| | _____ _ __ ___ (_) |_| |__ \\r\\n\" +\n \" | _ \\\\| |/ _` |/ __| |/ / __| \u0027_ ` _ \\\\| | __| \u0027_ \\\\ \\r\\n\" +\n \" | |_) | | (_| | (__| \u003c\\\\__ \\\\ | | | | | | |_| | | |\\r\\n\" +\n \" |____/|_|\\__,_|\\___|_|\\_\\___/_| |_| |_|_|\\__|_| |_|\n" +} \ No newline at end of file diff --git a/world/merchants/jim_the_banker.json b/world/merchants/jim_the_banker.json new file mode 100644 index 0000000000000000000000000000000000000000..868c0a5586846c3b4164b06806f4da71728ede71 --- /dev/null +++ b/world/merchants/jim_the_banker.json @@ -0,0 +1,18 @@ +{ + "internalName": "jim the banker", + "roomIds": [ + 65, + 209 + ], + "name": "jim the banker", + "colorName": "\u001b[1m\u001b[36mjim the banker\u001b[m", + "validTriggers": [ + "bank", + "j", + "banker", + "jim the banker", + "jim" + ], + "welcomeMessage": "Welcome to the First National Bank of Creeper.", + "merchantType": "BANK" +} \ No newline at end of file diff --git a/world/merchants/lloyd_the_bartender.json b/world/merchants/lloyd_the_bartender.json index 3ece7ce52efa0ccf572e51a8781a219b562bf373..49660afd28dfae9c8340b486c131490a5fc88499 100644 --- a/world/merchants/lloyd_the_bartender.json +++ b/world/merchants/lloyd_the_bartender.json @@ -1,6 +1,8 @@ { "internalName": "lloyd the bartender", - "roomId": 64, + "roomIds": [ + 64 + ], "name": "lloyd the bartender", "colorName": "\u001b[1m\u001b[36mlloyd the bartender\u001b[m", "validTriggers": [ diff --git a/world/merchants/nigel_the_bartender.json b/world/merchants/nigel_the_bartender.json new file mode 100644 index 0000000000000000000000000000000000000000..be98637d92eb33d4f0f8fd34a73fc3120581d01f --- /dev/null +++ b/world/merchants/nigel_the_bartender.json @@ -0,0 +1,23 @@ +{ + "internalName": "nigel the bartender", + "roomIds": [ + 377 + ], + "name": "nigel the bartender", + "colorName": "\u001b[1m\u001b[36mnigel the bartender\u001b[m", + "validTriggers": [ + "nigel the bartender", + "bartender", + "barkeep", + "nigel", + "NIGEL", + "Nigel" + ], + "merchantItemForSales": [ + { + "internalItemName": "small health potion", + "cost": 6 + } + ], + "welcomeMessage": "\r\n N I G E L \u0027S B A R \r\n" +} \ No newline at end of file diff --git a/world/merchants/old_wise_man.json b/world/merchants/old_wise_man.json new file mode 100644 index 0000000000000000000000000000000000000000..08bd894b1f5a1fa7f78f608ff08e04274f932275 --- /dev/null +++ b/world/merchants/old_wise_man.json @@ -0,0 +1,18 @@ +{ + "internalName": "old wise man", + "roomIds": [ + 2 + ], + "name": "old wise man", + "colorName": "\u001b[1m\u001b[36mold wise man\u001b[m", + "validTriggers": [ + "old wise man", + "wise", + "old", + "w", + "man", + "m" + ], + "welcomeMessage": "The \u001b[1m\u001b[36mold wise man\u001b[m can assist you in choosing a character class.\r\n", + "merchantType": "PLAYERCLASS_SELECTOR" +} \ No newline at end of file diff --git a/world/merchants/willy_the_wizard.json b/world/merchants/willy_the_wizard.json new file mode 100644 index 0000000000000000000000000000000000000000..8da84c20f97e7137bdfd414ae06c4b145a8e7bcf --- /dev/null +++ b/world/merchants/willy_the_wizard.json @@ -0,0 +1,20 @@ +{ + "internalName": "willy the wizard", + "roomIds": [ + 98 + ], + "name": "willy the wizard", + "colorName": "\u001b[1m\u001b[36mwilly the wizard\u001b[m", + "validTriggers": [ + "willy the wizard", + "willy", + "wizard" + ], + "merchantItemForSales": [ + { + "internalItemName": "lightning spellbook", + "cost": 50000 + } + ], + "welcomeMessage": " ____ \n 6MMMMb\\ \n6M\u0027 ` / \nMM /M _____ _____ __ ____ \nYM. /MMMMM 6MMMMMb 6MMMMMb `M6MMMMb \n YMMMMb MM 6M\u0027 `Mb 6M\u0027 `Mb MM\u0027 `Mb\n `Mb MM MM MM MM MM MM MM\n MM MM MM MM MM MM MM MM\n MM MM MM MM MM MM MM MM\nL ,M9 YM. , YM. ,M9 YM. ,M9 MM. ,M9\nMYMMMM9 YMMM9 YMMMMM9 YMMMMM9 MMYMMM9 \n MM \n MM \n _MM_ \n\n" +} \ No newline at end of file diff --git a/world/npcs/red-eyed_bear.json b/world/npcs/red-eyed_bear.json index 33f66f03eecf75d51c387ade744bf5e922aab189..cbf9498e9030a72883b319eedd0a5b5e1498ba00 100644 --- a/world/npcs/red-eyed_bear.json +++ b/world/npcs/red-eyed_bear.json @@ -53,7 +53,7 @@ ], "loot": { "items": [ - "berserker healm", + "berserker helm", "red claw beanie", "red claw pants", "red claw hoodie"