From b0a7c128c951aa9d73325f3fb5e5a712b0831a45 Mon Sep 17 00:00:00 2001 From: Chris Kearney <chris@kearneymail.com> Date: Sat, 13 May 2017 15:29:48 -0700 Subject: [PATCH] new item system is working, seems to be working, haven't quite found enough bugs yet. --- .../creeper/configuration/ConfigureNpc.java | 46 ++- .../creeper/items/EquipmentBuilder.java | 186 +++++----- .../com/comandante/creeper/items/Forage.java | 18 +- .../creeper/items/ForageBuilder.java | 26 +- .../creeper/items/ForageManager.java | 16 +- .../comandante/creeper/items/ItemBuilder.java | 2 + .../creeper/items/ItemMetadata.java | 16 + .../comandante/creeper/items/ItemType.java | 20 +- .../creeper/items/ItemUseHandler.java | 29 +- .../creeper/storage/ItemStorage.java | 2 +- .../creeper/items/ItemMetadataTest.java | 332 +++++++++++++----- world/items/basic_key.json | 28 ++ world/items/beserker_baton.json | 40 +++ world/items/beserker_boots.json | 41 +++ world/items/beserker_bracers.json | 40 +++ world/items/beserker_chest.json | 40 +++ world/items/beserker_helm.json | 40 +++ world/items/beserker_shorts.json | 40 +++ world/items/biggers_skin_satchel.json | 39 ++ world/items/lightning_spellbook.json | 18 + world/items/marijuana.json | 38 ++ world/items/purple_drank.json | 40 +++ world/items/rad_claw_hoodie.json | 40 +++ world/items/rad_claw_pants.json | 40 +++ world/items/red_claw_beanie.json | 40 +++ world/items/small_health_potion.json | 62 ++++ world/items/stick_of_justice.json | 17 + world/npcs/demon_cat.json | 2 +- world/npcs/red-eyed_bear.json | 8 +- world/npcs/swamp_bear.json | 4 +- world/npcs/swamp_berserker.json | 2 +- world/npcs/tree_berserker.json | 6 +- 32 files changed, 1048 insertions(+), 270 deletions(-) create mode 100644 world/items/basic_key.json create mode 100644 world/items/beserker_baton.json create mode 100644 world/items/beserker_boots.json create mode 100644 world/items/beserker_bracers.json create mode 100644 world/items/beserker_chest.json create mode 100644 world/items/beserker_helm.json create mode 100644 world/items/beserker_shorts.json create mode 100644 world/items/biggers_skin_satchel.json create mode 100644 world/items/lightning_spellbook.json create mode 100644 world/items/marijuana.json create mode 100644 world/items/purple_drank.json create mode 100644 world/items/rad_claw_hoodie.json create mode 100644 world/items/rad_claw_pants.json create mode 100644 world/items/red_claw_beanie.json create mode 100644 world/items/small_health_potion.json create mode 100644 world/items/stick_of_justice.json diff --git a/src/main/java/com/comandante/creeper/configuration/ConfigureNpc.java b/src/main/java/com/comandante/creeper/configuration/ConfigureNpc.java index 65ddb451..2999e9b4 100644 --- a/src/main/java/com/comandante/creeper/configuration/ConfigureNpc.java +++ b/src/main/java/com/comandante/creeper/configuration/ConfigureNpc.java @@ -4,16 +4,12 @@ package com.comandante.creeper.configuration; import com.comandante.creeper.Main; import com.comandante.creeper.core_game.GameManager; import com.comandante.creeper.entity.EntityManager; -import com.comandante.creeper.items.ForageBuilder; +import com.comandante.creeper.items.Forage; import com.comandante.creeper.items.ItemMetadata; import com.comandante.creeper.npc.Npc; import com.comandante.creeper.spawner.ItemSpawner; import com.comandante.creeper.spawner.NpcSpawner; import com.comandante.creeper.spawner.SpawnRule; -import com.comandante.creeper.storage.ItemStorage; -import com.comandante.creeper.world.model.Area; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; import java.io.IOException; import java.util.List; @@ -38,25 +34,27 @@ public class ConfigureNpc { configureAllNpcs(gameManager); - - - Gson gson = new GsonBuilder().setPrettyPrinting().create(); - - ItemStorage itemStorage = new ItemStorage(gson); - List<ItemMetadata> allItemMetadata = itemStorage.getAllItemMetadata(); - + List<ItemMetadata> allItemMetadata = gameManager.getItemStorage().getAllItemMetadata(); 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); } } - Main.startUpMessage("Adding beer"); + for (ItemMetadata itemMetadata: allItemMetadata) { + for (Forage forage: itemMetadata.getForages()) { + Main.startUpMessage("Processing forages for " + itemMetadata.getInternalItemName()); + gameManager.getForageManager().addForage(itemMetadata.getInternalItemName(), forage); + } + } + // 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); @@ -108,16 +106,16 @@ public class ConfigureNpc { // 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); +// 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/items/EquipmentBuilder.java b/src/main/java/com/comandante/creeper/items/EquipmentBuilder.java index d58a774c..d7f35ca3 100644 --- a/src/main/java/com/comandante/creeper/items/EquipmentBuilder.java +++ b/src/main/java/com/comandante/creeper/items/EquipmentBuilder.java @@ -1,113 +1,85 @@ package com.comandante.creeper.items; +import com.comandante.creeper.stats.Stats; +import com.comandante.creeper.stats.StatsBuilder; + public class EquipmentBuilder { -// public static Item build(Item item) { -// ItemType itemType = ItemType.itemTypeFromCode(item.getItemTypeId()); -// if (itemType != null) { -// switch (itemType) { -// case BERSERKER_BATON: -// return getBerserkerBaton(item); -// case BERSEKER_BOOTS: -// return getBerserkerBoots(item); -// case BERSERKER_CHEST: -// return getBerserkerChest(item); -// case BERSEKER_SHORTS: -// return getBerserkerShorts(item); -// case BERSERKER_BRACERS: -// return getBerserkerBracers(item); -// case BERSEKER_HELM: -// return getBerserkerHelm(item); -// case LEATHER_SATCHEL: -// return getLeatherSatchel(item); -// case BIGGERS_SKIN_SATCHEL: -// return getBiggersSkinSatchel(item); -// case RED_CLAW_BEANIE: -// return getRedClawBeanie(item); -// case RED_CLAW_HOODIE: -// return getRedClawHoodie(item); -// case RED_CLAW_PANTS: -// return getRedClawPants(item); -// } -// } -// return null; -// } -// -// public static Item getBerserkerBaton(Item item) { -// Stats stats = new StatsBuilder().setWeaponRatingMin(4).setWeaponRatingMax(6).createStats(); -// final Equipment equipment = new Equipment(EquipmentSlotType.HAND, stats); -// item.setEquipment(equipment); -// return item; -// } -// -// public static Item getBerserkerBoots(Item item) { -// Stats stats = new StatsBuilder().setArmorRating(3).createStats(); -// final Equipment equipment = new Equipment(EquipmentSlotType.FEET, stats); -// item.setEquipment(equipment); -// return item; -// } -// -// public static Item getBerserkerChest(Item item) { -// Stats stats = new StatsBuilder().setArmorRating(6).createStats(); -// final Equipment equipment = new Equipment(EquipmentSlotType.CHEST, stats); -// item.setEquipment(equipment); -// return item; -// } -// -// public static Item getBerserkerShorts(Item item) { -// Stats stats = new StatsBuilder().setArmorRating(4).createStats(); -// final Equipment equipment = new Equipment(EquipmentSlotType.LEGS, stats); -// item.setEquipment(equipment); -// return item; -// } -// -// public static Item getBerserkerBracers(Item item) { -// Stats stats = new StatsBuilder().setArmorRating(4).createStats(); -// final Equipment equipment = new Equipment(EquipmentSlotType.WRISTS, stats); -// item.setEquipment(equipment); -// return item; -// } -// -// public static Item getBerserkerHelm(Item item) { -// Stats stats = new StatsBuilder().setArmorRating(3).createStats(); -// final Equipment equipment = new Equipment(EquipmentSlotType.HEAD, stats); -// item.setEquipment(equipment); -// return item; -// } -// -// public static Item getLeatherSatchel(Item item) { -// Stats stats = new StatsBuilder().setInventorySize(15).createStats(); -// final Equipment equipment = new Equipment(EquipmentSlotType.BAG, stats); -// item.setEquipment(equipment); -// return item; -// } -// -// public static Item getBiggersSkinSatchel(Item item) { -// Stats stats = new StatsBuilder().setInventorySize(100).createStats(); -// final Equipment equipment = new Equipment(EquipmentSlotType.BAG, stats); -// item.setEquipment(equipment); -// return item; -// } -// -// public static Item getRedClawBeanie(Item item) { -// Stats stats = new StatsBuilder().setArmorRating(8).setStrength(4).setMaxHealth(50).createStats(); -// final Equipment equipment = new Equipment(EquipmentSlotType.HEAD, stats); -// item.setEquipment(equipment); -// return item; -// } -// -// public static Item getRedClawHoodie(Item item) { -// Stats stats = new StatsBuilder().setArmorRating(15).setStrength(7).createStats(); -// final Equipment equipment = new Equipment(EquipmentSlotType.CHEST, stats); -// item.setEquipment(equipment); -// return item; -// } -// -// public static Item getRedClawPants(Item item) { -// Stats stats = new StatsBuilder().setAgile(7).setForaging(6).createStats(); -// final Equipment equipment = new Equipment(EquipmentSlotType.LEGS, stats); -// item.setEquipment(equipment); -// return item; -// } + public static Item getBerserkerBaton(Item item) { + Stats stats = new StatsBuilder().setWeaponRatingMin(4).setWeaponRatingMax(6).createStats(); + final Equipment equipment = new Equipment(EquipmentSlotType.HAND, stats); + item.setEquipment(equipment); + return item; + } + + public static Item getBerserkerBoots(Item item) { + Stats stats = new StatsBuilder().setArmorRating(3).createStats(); + final Equipment equipment = new Equipment(EquipmentSlotType.FEET, stats); + item.setEquipment(equipment); + return item; + } + + public static Item getBerserkerChest(Item item) { + Stats stats = new StatsBuilder().setArmorRating(6).createStats(); + final Equipment equipment = new Equipment(EquipmentSlotType.CHEST, stats); + item.setEquipment(equipment); + return item; + } + + public static Item getBerserkerShorts(Item item) { + Stats stats = new StatsBuilder().setArmorRating(4).createStats(); + final Equipment equipment = new Equipment(EquipmentSlotType.LEGS, stats); + item.setEquipment(equipment); + return item; + } + + public static Item getBerserkerBracers(Item item) { + Stats stats = new StatsBuilder().setArmorRating(4).createStats(); + final Equipment equipment = new Equipment(EquipmentSlotType.WRISTS, stats); + item.setEquipment(equipment); + return item; + } + + public static Item getBerserkerHelm(Item item) { + Stats stats = new StatsBuilder().setArmorRating(3).createStats(); + final Equipment equipment = new Equipment(EquipmentSlotType.HEAD, stats); + item.setEquipment(equipment); + return item; + } + + public static Item getLeatherSatchel(Item item) { + Stats stats = new StatsBuilder().setInventorySize(15).createStats(); + final Equipment equipment = new Equipment(EquipmentSlotType.BAG, stats); + item.setEquipment(equipment); + return item; + } + + public static Item getBiggersSkinSatchel(Item item) { + Stats stats = new StatsBuilder().setInventorySize(100).createStats(); + final Equipment equipment = new Equipment(EquipmentSlotType.BAG, stats); + item.setEquipment(equipment); + return item; + } + + public static Item getRedClawBeanie(Item item) { + Stats stats = new StatsBuilder().setArmorRating(8).setStrength(4).setMaxHealth(50).createStats(); + final Equipment equipment = new Equipment(EquipmentSlotType.HEAD, stats); + item.setEquipment(equipment); + return item; + } + + public static Item getRedClawHoodie(Item item) { + Stats stats = new StatsBuilder().setArmorRating(15).setStrength(7).createStats(); + final Equipment equipment = new Equipment(EquipmentSlotType.CHEST, stats); + item.setEquipment(equipment); + return item; + } + + public static Item getRedClawPants(Item item) { + Stats stats = new StatsBuilder().setAgile(7).setForaging(6).createStats(); + final Equipment equipment = new Equipment(EquipmentSlotType.LEGS, stats); + item.setEquipment(equipment); + return item; + } } \ No newline at end of file diff --git a/src/main/java/com/comandante/creeper/items/Forage.java b/src/main/java/com/comandante/creeper/items/Forage.java index 3731e1ed..a5467b84 100644 --- a/src/main/java/com/comandante/creeper/items/Forage.java +++ b/src/main/java/com/comandante/creeper/items/Forage.java @@ -2,6 +2,9 @@ package com.comandante.creeper.items; import com.comandante.creeper.entity.CreeperEntity; +import com.comandante.creeper.world.model.Area; + +import java.util.Set; public class Forage extends CreeperEntity { @@ -13,8 +16,9 @@ public class Forage extends CreeperEntity { private final int forageExperience; private final int coolDownTicks; private int coolDownTicksLeft; + private final Set<Area> forageAreas; - public Forage(String internalItemName, int minLevel, double pctOfSuccess, int minAmt, int maxAmt, int forageExperience, int coolDownTicks) { + protected Forage(String internalItemName, int minLevel, double pctOfSuccess, int minAmt, int maxAmt, int forageExperience, int coolDownTicks, Set<Area> forageAreas) { this.internalItemName = internalItemName; this.minLevel = minLevel; this.pctOfSuccess = pctOfSuccess; @@ -23,17 +27,11 @@ public class Forage extends CreeperEntity { this.coolDownTicksLeft = 0; this.forageExperience = forageExperience; this.coolDownTicks = coolDownTicks; + this.forageAreas = forageAreas; } - public Forage(Forage forage) { - this.internalItemName = forage.internalItemName; - this.minLevel = new Integer(forage.getMinLevel()); - this.pctOfSuccess = new Double(forage.getPctOfSuccess()); - this.minAmt = new Integer(forage.getMinAmt()); - this.maxAmt = new Integer(forage.getMaxAmt()); - this.coolDownTicks = new Integer(forage.getCoolDownTicks()); - this.coolDownTicksLeft = new Integer(0); - this.forageExperience = new Integer(forage.getForageExperience()); + public Set<Area> getForageAreas() { + return forageAreas; } public String getInternalItemName() { diff --git a/src/main/java/com/comandante/creeper/items/ForageBuilder.java b/src/main/java/com/comandante/creeper/items/ForageBuilder.java index 4bce0c4f..3fd19631 100644 --- a/src/main/java/com/comandante/creeper/items/ForageBuilder.java +++ b/src/main/java/com/comandante/creeper/items/ForageBuilder.java @@ -1,5 +1,9 @@ package com.comandante.creeper.items; +import com.comandante.creeper.world.model.Area; + +import java.util.Set; + public class ForageBuilder { private String internalItemName; private int minLevel; @@ -8,6 +12,26 @@ public class ForageBuilder { private int maxAmt; private int forageExperience; private int coolDownTicks; + private Set<Area> forageAreas; + + + public ForageBuilder from(Forage forage) { + this.internalItemName = forage.getInternalItemName(); + this.minLevel = new Integer(forage.getMinLevel()); + this.pctOfSuccess = new Double(forage.getPctOfSuccess()); + this.minAmt = new Integer(forage.getMinAmt()); + this.maxAmt = new Integer(forage.getMaxAmt()); + this.coolDownTicks = new Integer(forage.getCoolDownTicks()); + //this.coolDownTicksLeft = new Integer(0); + this.forageExperience = new Integer(forage.getForageExperience()); + this.forageAreas = forage.getForageAreas(); + return this; + } + + public ForageBuilder setAreas(Set<Area> forageAreas) { + this.forageAreas = forageAreas; + return this; + } public ForageBuilder setInternalItemName(String internalItemName) { this.internalItemName = internalItemName; @@ -45,6 +69,6 @@ public class ForageBuilder { } public Forage createForage() { - return new Forage(internalItemName, minLevel, pctOfSuccess, minAmt, maxAmt, forageExperience, coolDownTicks); + return new Forage(internalItemName, minLevel, pctOfSuccess, minAmt, maxAmt, forageExperience, coolDownTicks, forageAreas); } } \ No newline at end of file diff --git a/src/main/java/com/comandante/creeper/items/ForageManager.java b/src/main/java/com/comandante/creeper/items/ForageManager.java index c5aaf862..9931b583 100644 --- a/src/main/java/com/comandante/creeper/items/ForageManager.java +++ b/src/main/java/com/comandante/creeper/items/ForageManager.java @@ -27,12 +27,16 @@ public class ForageManager { this.gameManager = gameManager; } - public void addForageToArea(Area area, ForageBuilder forageBuilder) { - Set<Room> roomsByArea = gameManager.getRoomManager().getRoomsByArea(area); - for (Room room : roomsByArea) { - Forage newForage = forageBuilder.createForage(); - room.addForage(newForage); - gameManager.getEntityManager().addEntity(newForage); + public void addForage(String internalItemName, Forage forage) { + for (Area area: forage.getForageAreas()) { + Set<Room> roomsByArea = gameManager.getRoomManager().getRoomsByArea(area); + for (Room room : roomsByArea) { + ForageBuilder forageBuiler = new ForageBuilder().from(forage); + forageBuiler.setInternalItemName(internalItemName); + Forage newForage = forageBuiler.createForage(); + room.addForage(newForage); + gameManager.getEntityManager().addEntity(newForage); + } } } diff --git a/src/main/java/com/comandante/creeper/items/ItemBuilder.java b/src/main/java/com/comandante/creeper/items/ItemBuilder.java index e5d3d4c6..8d0a70fd 100644 --- a/src/main/java/com/comandante/creeper/items/ItemBuilder.java +++ b/src/main/java/com/comandante/creeper/items/ItemBuilder.java @@ -49,6 +49,7 @@ public class ItemBuilder { this.equipment = itemMetadata.getEquipment(); this.validTimeOfDays = itemMetadata.getValidTimeOfDays(); this.effects = itemMetadata.getEffects(); + this.itemApplyStats = itemMetadata.getItemApplyStats(); return this; } @@ -73,6 +74,7 @@ public class ItemBuilder { this.maxUses = origItem.getMaxUses(); this.isDisposable = origItem.isDisposable(); this.validTimeOfDays = origItem.getValidTimeOfDays(); + this.itemApplyStats = origItem.getItemApplyStats(); return this; } diff --git a/src/main/java/com/comandante/creeper/items/ItemMetadata.java b/src/main/java/com/comandante/creeper/items/ItemMetadata.java index bac90a40..dd3519a1 100644 --- a/src/main/java/com/comandante/creeper/items/ItemMetadata.java +++ b/src/main/java/com/comandante/creeper/items/ItemMetadata.java @@ -4,6 +4,7 @@ package com.comandante.creeper.items; import com.comandante.creeper.core_game.service.TimeTracker; import com.comandante.creeper.spawner.SpawnRule; import com.comandante.creeper.stats.Stats; +import com.google.common.collect.Sets; import java.util.List; import java.util.Set; @@ -30,6 +31,18 @@ public class ItemMetadata { private int maxUses; private Set<SpawnRule> spawnRules; private Stats itemApplyStats; + private Set<Forage> forages; + + public Set<Forage> getForages() { + if (forages == null) { + return Sets.newHashSet(); + } + return forages; + } + + public void setForages(Set<Forage> forages) { + this.forages = forages; + } public Stats getItemApplyStats() { return itemApplyStats; @@ -140,6 +153,9 @@ public class ItemMetadata { } public Set<SpawnRule> getSpawnRules() { + if (spawnRules == null) { + return Sets.newHashSet(); + } return spawnRules; } diff --git a/src/main/java/com/comandante/creeper/items/ItemType.java b/src/main/java/com/comandante/creeper/items/ItemType.java index 755cc440..fe1d2988 100644 --- a/src/main/java/com/comandante/creeper/items/ItemType.java +++ b/src/main/java/com/comandante/creeper/items/ItemType.java @@ -1,7 +1,17 @@ -package com.comandante.creeper.items; - -public enum ItemType { - +//package com.comandante.creeper.items; +// +//import com.comandante.creeper.core_game.service.TimeTracker; +//import com.comandante.creeper.server.player_communication.Color; +//import com.google.common.collect.Sets; +// +//import java.util.Arrays; +//import java.util.List; +//import java.util.Set; +// +//import static com.comandante.creeper.server.player_communication.Color.*; +// +//public enum ItemType { +// // UNKNOWN(0, Arrays.asList(""), "", "", "", false, 0, 0, false, com.comandante.creeper.items.Rarity.RARE, 0, Sets.<TimeTracker.TimeOfDay>newHashSet()), // KEY(1, Arrays.asList("key", "gold key", "shiny gold key"), // "a shiny " + YELLOW + "gold key" + RESET, @@ -339,4 +349,4 @@ public enum ItemType { // } // return ItemType.UNKNOWN; // } -} +//} diff --git a/src/main/java/com/comandante/creeper/items/ItemUseHandler.java b/src/main/java/com/comandante/creeper/items/ItemUseHandler.java index 488e1e96..e2bd92aa 100644 --- a/src/main/java/com/comandante/creeper/items/ItemUseHandler.java +++ b/src/main/java/com/comandante/creeper/items/ItemUseHandler.java @@ -7,8 +7,6 @@ import com.comandante.creeper.items.use.DefaultApplyEffectAction; import com.comandante.creeper.items.use.LightningSpellBookUseAction; import com.comandante.creeper.items.use.StickOfJusticeUseAction; import com.comandante.creeper.player.Player; -import com.comandante.creeper.stats.Stats; -import com.comandante.creeper.stats.StatsBuilder; import org.apache.log4j.Logger; import java.util.Optional; @@ -30,23 +28,17 @@ public class ItemUseHandler { } ItemMetadata itemMetadata = itemMetadataOptional.get(); switch (itemMetadata.getInternalItemName()) { - case "Lighting Spell": + case "lightning spellbook": itemUseAction = new LightningSpellBookUseAction(itemMetadata); break; - case "Purple Drank": - itemUseAction = new DefaultApplyEffectAction(itemMetadata); - break; - case "Marijuana": - itemUseAction = new DefaultApplyEffectAction(itemMetadata); + case "stick of justice": + itemUseAction = new StickOfJusticeUseAction(itemMetadata); break; - case "Small Health Potion": - itemUseAction = new DefaultApplyEffectAction(itemMetadata); + default: + if ((item.getEffects() != null && item.getEffects().size() > 0) || (item.getItemApplyStats() != null)) { + itemUseAction = new DefaultApplyEffectAction(itemMetadata); + } break; - case "Stick Of Justice": - itemUseAction = new StickOfJusticeUseAction(itemMetadata); - } - if (itemUseAction == null && item.getEffects() != null && item.getEffects().size() > 0) { - itemUseAction = new DefaultApplyEffectAction(itemMetadata); } if (itemUseAction != null) { itemUseAction.executeAction(gameManager, player, item, useItemOn); @@ -54,13 +46,6 @@ public class ItemUseHandler { } } - private static Stats buildStats(int health, int mana) { - StatsBuilder statsBuilder = new StatsBuilder(); - statsBuilder.setCurrentHealth(health); - statsBuilder.setCurrentMana(mana); - return statsBuilder.createStats(); - } - public static void incrementUses(Item item) { item.setNumberOfUses(item.getNumberOfUses() + 1); } diff --git a/src/main/java/com/comandante/creeper/storage/ItemStorage.java b/src/main/java/com/comandante/creeper/storage/ItemStorage.java index 7578d6cd..e32b7456 100644 --- a/src/main/java/com/comandante/creeper/storage/ItemStorage.java +++ b/src/main/java/com/comandante/creeper/storage/ItemStorage.java @@ -28,7 +28,7 @@ public class ItemStorage { } public List<ItemMetadata> getAllItemMetadata() { - return readAllItemMetadatas(); + return itemMetadatas; } public void saveItemMetaData(ItemMetadata itemMetadata) throws IOException { diff --git a/src/test/com/comandante/creeper/items/ItemMetadataTest.java b/src/test/com/comandante/creeper/items/ItemMetadataTest.java index 2ac9a252..354c03f6 100644 --- a/src/test/com/comandante/creeper/items/ItemMetadataTest.java +++ b/src/test/com/comandante/creeper/items/ItemMetadataTest.java @@ -1,83 +1,249 @@ -package com.comandante.creeper.items; - -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.ItemStorage; -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; - - -public class ItemMetadataTest { - - private final Gson gson = new GsonBuilder().setPrettyPrinting().create(); - - @Test - public void testSerialization() throws Exception { - -// private String itemName; -// private String itemDescription; -// private String restingName; -// private int numberOfUses; -// private int valueInGold; -// private int itemHalfLifeTicks; -// private Rarity rarity; -// private Equipment equipment; -// private Set<Effect> effects; -// private List<String> itemTriggers; - - - ItemMetadata itemMetadata = new ItemMetadata(); - itemMetadata.setInternalItemName("little potion"); - itemMetadata.setItemName("a " + Color.RED + "little potion" + Color.RESET); - itemMetadata.setItemDescription("a " + Color.RED + "little potion" + Color.RESET); - itemMetadata.setRestingName("a " + Color.GREEN + "little potion" + Color.RESET); - itemMetadata.setMaxUses(1); - itemMetadata.setDisposable(true); - itemMetadata.setValueInGold(30); - itemMetadata.setItemHalfLifeTicks(60); - itemMetadata.setRarity(Rarity.BASIC); - // itemMetadata.setValidTimeOfDays(Sets.newHashSet(TimeTracker.TimeOfDay.MORNING, TimeTracker.TimeOfDay.NIGHT)); - - SpawnRule spawnRule1 = new SpawnRuleBuilder().setArea(Area.NEWBIE_ZONE).setSpawnIntervalTicks(600).setMaxInstances(100).setMaxPerRoom(5).setRandomPercent(40).createSpawnRule(); - SpawnRule spawnRule2 = new SpawnRuleBuilder().setArea(Area.FANCYHOUSE_ZONE).setSpawnIntervalTicks(600).setMaxInstances(12).setMaxPerRoom(2).setRandomPercent(50).createSpawnRule(); - SpawnRule spawnRule3 = new SpawnRuleBuilder().setArea(Area.HOUSE_ZONE).setSpawnIntervalTicks(600).setMaxInstances(12).setMaxPerRoom(2).setRandomPercent(50).createSpawnRule(); - itemMetadata.setSpawnRules(Sets.newHashSet(spawnRule1, spawnRule2, spawnRule3)); - - Stats stats = new StatsBuilder().setInventorySize(100).createStats(); - // final Equipment equipment = new Equipment(EquipmentSlotType.BAG, stats); - - // itemMetadata.setEquipment(equipment); - itemMetadata.setItemTriggers(Lists.newArrayList("p", "little potion", "potion")); - - - EffectBuilder effectBuilder = new EffectBuilder() - .setDurationStats(new StatsBuilder().setCurrentHealth(25).createStats()) - .setEffectApplyMessages(Lists.newArrayList("You start to feel a healing effect.")) - .setEffectDescription("Little healing.") - .setEffectName("Little Potion Heal") - .setFrozenMovement(false) - .setLifeSpanTicks(0); - - - itemMetadata.setEffects(Sets.newHashSet(effectBuilder.createEffect())); - - - ItemStorage itemStorage = new ItemStorage(gson); - itemStorage.saveItemMetaData(itemMetadata); - - - String s = gson.toJson(itemMetadata); - System.out.println(s); - - } - - - -} \ No newline at end of file +//package com.comandante.creeper.items; +// +//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.ItemStorage; +//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; +// +//import java.util.Set; +// +// +//public class ItemMetadataTest { +// +// private final Gson gson = new GsonBuilder().setPrettyPrinting().create(); +// +// @Test +// public void testSerialization() throws Exception { +// +//// private String itemName; +//// private String itemDescription; +//// private String restingName; +//// private int numberOfUses; +//// private int valueInGold; +//// private int itemHalfLifeTicks; +//// private Rarity rarity; +//// private Equipment equipment; +//// private Set<Effect> effects; +//// private List<String> itemTriggers; +// +// +// ItemMetadata itemMetadata = new ItemMetadata(); +// itemMetadata.setInternalItemName("little potion"); +// itemMetadata.setItemName("a " + Color.RED + "little potion" + Color.RESET); +// itemMetadata.setItemDescription("a " + Color.RED + "little potion" + Color.RESET); +// itemMetadata.setRestingName("a " + Color.GREEN + "little potion" + Color.RESET); +// itemMetadata.setMaxUses(1); +// itemMetadata.setDisposable(true); +// itemMetadata.setValueInGold(30); +// itemMetadata.setItemHalfLifeTicks(60); +// itemMetadata.setRarity(Rarity.BASIC); +// // itemMetadata.setValidTimeOfDays(Sets.newHashSet(TimeTracker.TimeOfDay.MORNING, TimeTracker.TimeOfDay.NIGHT)); +// +// SpawnRule spawnRule1 = new SpawnRuleBuilder().setArea(Area.NEWBIE_ZONE).setSpawnIntervalTicks(600).setMaxInstances(100).setMaxPerRoom(5).setRandomPercent(40).createSpawnRule(); +// SpawnRule spawnRule2 = new SpawnRuleBuilder().setArea(Area.FANCYHOUSE_ZONE).setSpawnIntervalTicks(600).setMaxInstances(12).setMaxPerRoom(2).setRandomPercent(50).createSpawnRule(); +// SpawnRule spawnRule3 = new SpawnRuleBuilder().setArea(Area.HOUSE_ZONE).setSpawnIntervalTicks(600).setMaxInstances(12).setMaxPerRoom(2).setRandomPercent(50).createSpawnRule(); +// itemMetadata.setSpawnRules(Sets.newHashSet(spawnRule1, spawnRule2, spawnRule3)); +// +// Stats stats = new StatsBuilder().setInventorySize(100).createStats(); +// // final Equipment equipment = new Equipment(EquipmentSlotType.BAG, stats); +// +// // itemMetadata.setEquipment(equipment); +// itemMetadata.setItemTriggers(Lists.newArrayList("p", "little potion", "potion")); +// +// +// EffectBuilder effectBuilder = new EffectBuilder() +// .setDurationStats(new StatsBuilder().setCurrentHealth(25).createStats()) +// .setEffectApplyMessages(Lists.newArrayList("You start to feel a healing effect.")) +// .setEffectDescription("Little healing.") +// .setEffectName("Little Potion Heal") +// .setFrozenMovement(false) +// .setLifeSpanTicks(0); +// +// +// itemMetadata.setEffects(Sets.newHashSet(effectBuilder.createEffect())); +// +// +// ItemStorage itemStorage = new ItemStorage(gson); +// itemStorage.saveItemMetaData(itemMetadata); +// +// +// String s = gson.toJson(itemMetadata); +// System.out.println(s); +// +// } +// +// @Test +// public void generator() throws Exception { +// +// ItemStorage itemStorage = new ItemStorage(gson); +// +// // 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); +// } +// +// +// private ItemMetadata metadataFrom(ItemType itemType) { +// ItemMetadata itemMetadata = new ItemMetadata(); +// itemMetadata.setInternalItemName(null); +// itemMetadata.setItemName(itemType.getItemName()); +// itemMetadata.setRestingName(itemType.getRestingName()); +// itemMetadata.setItemDescription(itemType.getItemDescription()); +// itemMetadata.setItemHalfLifeTicks(itemType.getItemHalfLifeTicks()); +// itemMetadata.setItemTriggers(itemType.getItemTriggers()); +// itemMetadata.setMaxUses(itemType.getMaxUses()); +// itemMetadata.setRarity(itemType.getRarity()); +// itemMetadata.setSpawnRules(null); +// itemMetadata.setValidTimeOfDays(itemType.getValidTimeOfDays()); +// itemMetadata.setValueInGold(itemType.getValueInGold()); +// itemMetadata.setItemApplyStats(null); +// itemMetadata.setEquipment(null); +// itemMetadata.setEffects(null); +// itemMetadata.setDisposable(itemType.isDisposable()); +// return itemMetadata; +// } +// +// +//} \ No newline at end of file diff --git a/world/items/basic_key.json b/world/items/basic_key.json new file mode 100644 index 00000000..3f408dae --- /dev/null +++ b/world/items/basic_key.json @@ -0,0 +1,28 @@ +{ + "internalItemName": "basic key", + "itemName": "a shiny \u001b[33mgold key\u001b[m", + "itemDescription": "A basic key with nothing really remarkable other than its made of gold.", + "restingName": "a shiny \u001b[33mgold key\u001b[m catches your eye.", + "valueInGold": 10, + "itemHalfLifeTicks": 60, + "rarity": "BASIC", + "itemTriggers": [ + "key", + "gold key", + "shiny gold key" + ], + "validTimeOfDays": [ + "NIGHT" + ], + "isDisposable": false, + "maxUses": 0, + "spawnRules": [ + { + "area": "LOBBY", + "randomChance": 5, + "spawnIntervalTicks": 600, + "maxInstances": 1, + "maxPerRoom": 1 + } + ] +} \ No newline at end of file diff --git a/world/items/beserker_baton.json b/world/items/beserker_baton.json new file mode 100644 index 00000000..87fba918 --- /dev/null +++ b/world/items/beserker_baton.json @@ -0,0 +1,40 @@ +{ + "internalItemName": "beserker baton", + "itemName": "\u001b[36ma berserker baton\u001b[m", + "itemDescription": "a berserker baton", + "restingName": "a berserker baton rests upon the ground.", + "valueInGold": 100, + "itemHalfLifeTicks": 60, + "rarity": "BASIC", + "equipment": { + "equipmentSlotType": "HAND", + "statsIncreaseWhileEquipped": { + "strength": 0, + "intelligence": 0, + "willpower": 0, + "aim": 0, + "agile": 0, + "armorRating": 0, + "meleSkill": 0, + "currentHealth": 0, + "maxHealth": 0, + "weaponRatingMax": 6, + "weaponRatingMin": 4, + "numberOfWeaponRolls": 0, + "experience": 0, + "currentMana": 0, + "maxMana": 0, + "foraging": 0, + "inventorySize": 0, + "maxEffects": 0 + } + }, + "itemTriggers": [ + "baton", + "a berserker baton", + "b" + ], + "validTimeOfDays": [], + "isDisposable": false, + "maxUses": 0 +} \ No newline at end of file diff --git a/world/items/beserker_boots.json b/world/items/beserker_boots.json new file mode 100644 index 00000000..eb5f0bd7 --- /dev/null +++ b/world/items/beserker_boots.json @@ -0,0 +1,41 @@ +{ + "internalItemName": "beserker boots", + "itemName": "\u001b[36mberserker boots\u001b[m", + "itemDescription": "a pair of berserker boots", + "restingName": "a pair of berserker boots are here on the ground.", + "valueInGold": 50, + "itemHalfLifeTicks": 60, + "rarity": "BASIC", + "equipment": { + "equipmentSlotType": "FEET", + "statsIncreaseWhileEquipped": { + "strength": 0, + "intelligence": 0, + "willpower": 0, + "aim": 0, + "agile": 0, + "armorRating": 3, + "meleSkill": 0, + "currentHealth": 0, + "maxHealth": 0, + "weaponRatingMax": 0, + "weaponRatingMin": 0, + "numberOfWeaponRolls": 0, + "experience": 0, + "currentMana": 0, + "maxMana": 0, + "foraging": 0, + "inventorySize": 0, + "maxEffects": 0 + } + }, + "itemTriggers": [ + "boots", + "boot", + "berserker boots", + "b" + ], + "validTimeOfDays": [], + "isDisposable": false, + "maxUses": 0 +} \ No newline at end of file diff --git a/world/items/beserker_bracers.json b/world/items/beserker_bracers.json new file mode 100644 index 00000000..9cd91c21 --- /dev/null +++ b/world/items/beserker_bracers.json @@ -0,0 +1,40 @@ +{ + "internalItemName": "beserker bracers", + "itemName": "\u001b[36mberserker bracers\u001b[m", + "itemDescription": "a pair of berserker bracers", + "restingName": "a pair of berserker bracers are here on the ground.", + "valueInGold": 40, + "itemHalfLifeTicks": 60, + "rarity": "BASIC", + "equipment": { + "equipmentSlotType": "WRISTS", + "statsIncreaseWhileEquipped": { + "strength": 0, + "intelligence": 0, + "willpower": 0, + "aim": 0, + "agile": 0, + "armorRating": 4, + "meleSkill": 0, + "currentHealth": 0, + "maxHealth": 0, + "weaponRatingMax": 0, + "weaponRatingMin": 0, + "numberOfWeaponRolls": 0, + "experience": 0, + "currentMana": 0, + "maxMana": 0, + "foraging": 0, + "inventorySize": 0, + "maxEffects": 0 + } + }, + "itemTriggers": [ + "bracers", + "berserker bracers", + "b" + ], + "validTimeOfDays": [], + "isDisposable": false, + "maxUses": 0 +} \ No newline at end of file diff --git a/world/items/beserker_chest.json b/world/items/beserker_chest.json new file mode 100644 index 00000000..813b8c50 --- /dev/null +++ b/world/items/beserker_chest.json @@ -0,0 +1,40 @@ +{ + "internalItemName": "beserker chest", + "itemName": "\u001b[36mberserker chest\u001b[m", + "itemDescription": "a berserker chest", + "restingName": "a berserker chest is on the ground.", + "valueInGold": 70, + "itemHalfLifeTicks": 60, + "rarity": "BASIC", + "equipment": { + "equipmentSlotType": "CHEST", + "statsIncreaseWhileEquipped": { + "strength": 0, + "intelligence": 0, + "willpower": 0, + "aim": 0, + "agile": 0, + "armorRating": 6, + "meleSkill": 0, + "currentHealth": 0, + "maxHealth": 0, + "weaponRatingMax": 0, + "weaponRatingMin": 0, + "numberOfWeaponRolls": 0, + "experience": 0, + "currentMana": 0, + "maxMana": 0, + "foraging": 0, + "inventorySize": 0, + "maxEffects": 0 + } + }, + "itemTriggers": [ + "chest", + "berserker chest", + "c" + ], + "validTimeOfDays": [], + "isDisposable": false, + "maxUses": 0 +} \ No newline at end of file diff --git a/world/items/beserker_helm.json b/world/items/beserker_helm.json new file mode 100644 index 00000000..41167b08 --- /dev/null +++ b/world/items/beserker_helm.json @@ -0,0 +1,40 @@ +{ + "internalItemName": "beserker helm", + "itemName": "\u001b[36mberserker helm\u001b[m", + "itemDescription": "a berserker helm", + "restingName": "a berserker helm is on the ground.", + "valueInGold": 40, + "itemHalfLifeTicks": 60, + "rarity": "BASIC", + "equipment": { + "equipmentSlotType": "HEAD", + "statsIncreaseWhileEquipped": { + "strength": 0, + "intelligence": 0, + "willpower": 0, + "aim": 0, + "agile": 0, + "armorRating": 3, + "meleSkill": 0, + "currentHealth": 0, + "maxHealth": 0, + "weaponRatingMax": 0, + "weaponRatingMin": 0, + "numberOfWeaponRolls": 0, + "experience": 0, + "currentMana": 0, + "maxMana": 0, + "foraging": 0, + "inventorySize": 0, + "maxEffects": 0 + } + }, + "itemTriggers": [ + "helm", + "berserker helm", + "h" + ], + "validTimeOfDays": [], + "isDisposable": false, + "maxUses": 0 +} \ No newline at end of file diff --git a/world/items/beserker_shorts.json b/world/items/beserker_shorts.json new file mode 100644 index 00000000..f223c806 --- /dev/null +++ b/world/items/beserker_shorts.json @@ -0,0 +1,40 @@ +{ + "internalItemName": "beserker shorts", + "itemName": "\u001b[36mberserker shorts\u001b[m", + "itemDescription": "a pair of berserker shorts", + "restingName": "a pair of berserker shorts are here on the ground.", + "valueInGold": 80, + "itemHalfLifeTicks": 60, + "rarity": "BASIC", + "equipment": { + "equipmentSlotType": "LEGS", + "statsIncreaseWhileEquipped": { + "strength": 0, + "intelligence": 0, + "willpower": 0, + "aim": 0, + "agile": 0, + "armorRating": 4, + "meleSkill": 0, + "currentHealth": 0, + "maxHealth": 0, + "weaponRatingMax": 0, + "weaponRatingMin": 0, + "numberOfWeaponRolls": 0, + "experience": 0, + "currentMana": 0, + "maxMana": 0, + "foraging": 0, + "inventorySize": 0, + "maxEffects": 0 + } + }, + "itemTriggers": [ + "shorts", + "berserker shorts", + "s" + ], + "validTimeOfDays": [], + "isDisposable": false, + "maxUses": 0 +} \ No newline at end of file diff --git a/world/items/biggers_skin_satchel.json b/world/items/biggers_skin_satchel.json new file mode 100644 index 00000000..b458e768 --- /dev/null +++ b/world/items/biggers_skin_satchel.json @@ -0,0 +1,39 @@ +{ + "internalItemName": "biggers skin satchel", + "itemName": "a \u001b[32mbiggers skin satchel\u001b[m", + "itemDescription": "a \u001b[32mbiggers skin satchel\u001b[m with room to store 100 items.", + "restingName": "a \u001b[32mbiggers skin satchel\u001b[m", + "valueInGold": 3000, + "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": 100, + "maxEffects": 0 + } + }, + "itemTriggers": [ + "biggers skin satchel", + "skin satchel" + ], + "validTimeOfDays": [], + "isDisposable": false, + "maxUses": 0 +} \ No newline at end of file diff --git a/world/items/lightning_spellbook.json b/world/items/lightning_spellbook.json new file mode 100644 index 00000000..b0d55c1f --- /dev/null +++ b/world/items/lightning_spellbook.json @@ -0,0 +1,18 @@ +{ + "internalItemName": "lightning spellbook", + "itemName": "a \u001b[33mlightning\u001b[m spell book.\u001b[m", + "itemDescription": "a \u001b[33mlightning\u001b[m spell book.\u001b[m", + "restingName": "a \u001b[33mlightning\u001b[m spell book.\u001b[m", + "valueInGold": 3000, + "itemHalfLifeTicks": 60, + "rarity": "RARE", + "itemTriggers": [ + "lightning book", + "lightning spell book", + "book", + "spell book" + ], + "validTimeOfDays": [], + "isDisposable": true, + "maxUses": 0 +} \ No newline at end of file diff --git a/world/items/marijuana.json b/world/items/marijuana.json new file mode 100644 index 00000000..d32983c0 --- /dev/null +++ b/world/items/marijuana.json @@ -0,0 +1,38 @@ +{ + "internalItemName": "marijuana", + "itemName": "\u001b[32mmarijuana\u001b[m flowers\u001b[m", + "itemDescription": "some \u001b[32mmarijuana\u001b[m flowers\u001b[m", + "restingName": "some \u001b[32mmarijuana\u001b[m flowers\u001b[m are here on the ground.", + "valueInGold": 10, + "itemHalfLifeTicks": 60, + "rarity": "BASIC", + "itemTriggers": [ + "marijuana", + "weed", + "m", + "w", + "f", + "flowers" + ], + "validTimeOfDays": [], + "isDisposable": true, + "maxUses": 0, + "forages": [ + { + "minLevel": 0, + "pctOfSuccess": 40.0, + "minAmt": 1, + "maxAmt": 3, + "forageExperience": 4, + "coolDownTicks": 600, + "coolDownTicksLeft": 0, + "forageAreas": [ + "BLOODRIDGE2_ZONE", + "BLOODRIDGE1_ZONE", + "WESTERN9_ZONE", + "NORTH3_ZONE" + ], + "entityId": "8fe8b5a9-55e3-4706-9aee-474d52684d05" + } + ] +} \ No newline at end of file diff --git a/world/items/purple_drank.json b/world/items/purple_drank.json new file mode 100644 index 00000000..81e4f82e --- /dev/null +++ b/world/items/purple_drank.json @@ -0,0 +1,40 @@ +{ + "internalItemName": "purple drank", + "itemName": "a double cup of \u001b[35mpurple\u001b[m drank", + "itemDescription": "a tonic called \u001b[35mpurple\u001b[m drank that restores health\u001b[m", + "restingName": "a double cup of \u001b[35mpurple\u001b[m drank rests on the ground.", + "valueInGold": 30, + "itemHalfLifeTicks": 60, + "rarity": "BASIC", + "itemTriggers": [ + "drank", + "purple drank", + "p", + "purple", + "lean", + "sizzurp" + ], + "validTimeOfDays": [], + "isDisposable": true, + "maxUses": 0, + "itemApplyStats": { + "strength": 0, + "intelligence": 0, + "willpower": 0, + "aim": 0, + "agile": 0, + "armorRating": 0, + "meleSkill": 0, + "currentHealth": 50, + "maxHealth": 0, + "weaponRatingMax": 0, + "weaponRatingMin": 0, + "numberOfWeaponRolls": 0, + "experience": 0, + "currentMana": 0, + "maxMana": 0, + "foraging": 0, + "inventorySize": 0, + "maxEffects": 0 + } +} \ No newline at end of file diff --git a/world/items/rad_claw_hoodie.json b/world/items/rad_claw_hoodie.json new file mode 100644 index 00000000..f2d64214 --- /dev/null +++ b/world/items/rad_claw_hoodie.json @@ -0,0 +1,40 @@ +{ + "internalItemName": "rad claw hoodie", + "itemName": "\u001b[31mred-claw \u001b[mhoodie\u001b[m", + "itemDescription": "a red-claw hoodie", + "restingName": "a \u001b[31mred-claw \u001b[mhoodie is on the ground.", + "valueInGold": 3500, + "itemHalfLifeTicks": 60, + "rarity": "LEGENDARY", + "equipment": { + "equipmentSlotType": "CHEST", + "statsIncreaseWhileEquipped": { + "strength": 7, + "intelligence": 0, + "willpower": 0, + "aim": 0, + "agile": 0, + "armorRating": 15, + "meleSkill": 0, + "currentHealth": 0, + "maxHealth": 0, + "weaponRatingMax": 0, + "weaponRatingMin": 0, + "numberOfWeaponRolls": 0, + "experience": 0, + "currentMana": 0, + "maxMana": 0, + "foraging": 0, + "inventorySize": 0, + "maxEffects": 0 + } + }, + "itemTriggers": [ + "hoodie", + "red-claw hoodie", + "h" + ], + "validTimeOfDays": [], + "isDisposable": false, + "maxUses": 0 +} \ No newline at end of file diff --git a/world/items/rad_claw_pants.json b/world/items/rad_claw_pants.json new file mode 100644 index 00000000..ee9f6b53 --- /dev/null +++ b/world/items/rad_claw_pants.json @@ -0,0 +1,40 @@ +{ + "internalItemName": "rad claw pants", + "itemName": "\u001b[31mred-claw \u001b[mpants\u001b[m", + "itemDescription": "a red-claw pants", + "restingName": "a \u001b[31mred-claw \u001b[mpants is on the ground.", + "valueInGold": 3500, + "itemHalfLifeTicks": 60, + "rarity": "LEGENDARY", + "equipment": { + "equipmentSlotType": "LEGS", + "statsIncreaseWhileEquipped": { + "strength": 7, + "intelligence": 0, + "willpower": 0, + "aim": 0, + "agile": 0, + "armorRating": 15, + "meleSkill": 0, + "currentHealth": 0, + "maxHealth": 0, + "weaponRatingMax": 0, + "weaponRatingMin": 0, + "numberOfWeaponRolls": 0, + "experience": 0, + "currentMana": 0, + "maxMana": 0, + "foraging": 0, + "inventorySize": 0, + "maxEffects": 0 + } + }, + "itemTriggers": [ + "pants", + "red-claw pants", + "p" + ], + "validTimeOfDays": [], + "isDisposable": false, + "maxUses": 0 +} \ No newline at end of file diff --git a/world/items/red_claw_beanie.json b/world/items/red_claw_beanie.json new file mode 100644 index 00000000..6c8503bd --- /dev/null +++ b/world/items/red_claw_beanie.json @@ -0,0 +1,40 @@ +{ + "internalItemName": "red claw beanie", + "itemName": "\u001b[31mred-claw \u001b[mbeanie\u001b[m", + "itemDescription": "a red-claw beanie", + "restingName": "a \u001b[31mred-claw \u001b[mbeanie is on the ground.", + "valueInGold": 3500, + "itemHalfLifeTicks": 60, + "rarity": "LEGENDARY", + "equipment": { + "equipmentSlotType": "HEAD", + "statsIncreaseWhileEquipped": { + "strength": 4, + "intelligence": 0, + "willpower": 0, + "aim": 0, + "agile": 0, + "armorRating": 8, + "meleSkill": 0, + "currentHealth": 0, + "maxHealth": 50, + "weaponRatingMax": 0, + "weaponRatingMin": 0, + "numberOfWeaponRolls": 0, + "experience": 0, + "currentMana": 0, + "maxMana": 0, + "foraging": 0, + "inventorySize": 0, + "maxEffects": 0 + } + }, + "itemTriggers": [ + "beanie", + "red-claw beanie", + "b" + ], + "validTimeOfDays": [], + "isDisposable": false, + "maxUses": 0 +} \ No newline at end of file diff --git a/world/items/small_health_potion.json b/world/items/small_health_potion.json new file mode 100644 index 00000000..662f162b --- /dev/null +++ b/world/items/small_health_potion.json @@ -0,0 +1,62 @@ +{ + "internalItemName": "small health potion", + "itemName": "a small vial of \u001b[31mhealth potion\u001b[m", + "itemDescription": "a small vial of \u001b[31mhealth potion\u001b[m that restores 50 health\u001b[m", + "restingName": "a small vial of \u001b[31mhealth potion\u001b[m rests on the ground.", + "valueInGold": 1, + "itemHalfLifeTicks": 60, + "rarity": "OFTEN", + "itemTriggers": [ + "potion", + "health potion", + "vial", + "small vial of health potion", + "p" + ], + "validTimeOfDays": [], + "isDisposable": true, + "maxUses": 0, + "spawnRules": [ + { + "area": "NEWBIE_ZONE", + "randomChance": 40, + "spawnIntervalTicks": 600, + "maxInstances": 100, + "maxPerRoom": 5 + }, + { + "area": "FANCYHOUSE_ZONE", + "randomChance": 50, + "spawnIntervalTicks": 600, + "maxInstances": 12, + "maxPerRoom": 2 + }, + { + "area": "HOUSE_ZONE", + "randomChance": 50, + "spawnIntervalTicks": 600, + "maxInstances": 12, + "maxPerRoom": 2 + } + ], + "itemApplyStats": { + "strength": 0, + "intelligence": 0, + "willpower": 0, + "aim": 0, + "agile": 0, + "armorRating": 0, + "meleSkill": 0, + "currentHealth": 20, + "maxHealth": 0, + "weaponRatingMax": 0, + "weaponRatingMin": 0, + "numberOfWeaponRolls": 0, + "experience": 0, + "currentMana": 0, + "maxMana": 0, + "foraging": 0, + "inventorySize": 0, + "maxEffects": 0 + } +} \ No newline at end of file diff --git a/world/items/stick_of_justice.json b/world/items/stick_of_justice.json new file mode 100644 index 00000000..4a2e3230 --- /dev/null +++ b/world/items/stick_of_justice.json @@ -0,0 +1,17 @@ +{ + "internalItemName": "stick of justice", + "itemName": "a \u001b[1m\u001b[35mstick\u001b[22m\u001b[32m of \u001b[1m\u001b[34mjustice\u001b[m", + "itemDescription": "a \u001b[1m\u001b[35mstick\u001b[22m\u001b[32m of \u001b[1m\u001b[34mjustice\u001b[m", + "restingName": "a \u001b[1m\u001b[35mstick\u001b[22m\u001b[32m of \u001b[1m\u001b[34mjustice\u001b[m", + "valueInGold": 3000, + "itemHalfLifeTicks": 60, + "rarity": "RARE", + "itemTriggers": [ + "stick of justice", + "justice", + "stick" + ], + "validTimeOfDays": [], + "isDisposable": true, + "maxUses": 0 +} \ No newline at end of file diff --git a/world/npcs/demon_cat.json b/world/npcs/demon_cat.json index 03eabb52..5b5578f6 100644 --- a/world/npcs/demon_cat.json +++ b/world/npcs/demon_cat.json @@ -43,7 +43,7 @@ ], "loot": { "items": [ - "SMALL_HEALTH_POTION" + "small health potion" ], "lootGoldMax": 3, "lootGoldMin": 1 diff --git a/world/npcs/red-eyed_bear.json b/world/npcs/red-eyed_bear.json index 068528a7..33f66f03 100644 --- a/world/npcs/red-eyed_bear.json +++ b/world/npcs/red-eyed_bear.json @@ -53,10 +53,10 @@ ], "loot": { "items": [ - "BERSEKER_HELM", - "RED_CLAW_BEANIE", - "RED_CLAW_HOODIE", - "RED_CLAW_PANTS" + "berserker healm", + "red claw beanie", + "red claw pants", + "red claw hoodie" ], "lootGoldMax": 24, "lootGoldMin": 18 diff --git a/world/npcs/swamp_bear.json b/world/npcs/swamp_bear.json index d6705697..bb064a67 100644 --- a/world/npcs/swamp_bear.json +++ b/world/npcs/swamp_bear.json @@ -52,8 +52,8 @@ ], "loot": { "items": [ - "BERSERKER_BRACERS", - "BERSERKER_CHEST" + "berserker bracers", + "berserker chest" ], "lootGoldMax": 18, "lootGoldMin": 12 diff --git a/world/npcs/swamp_berserker.json b/world/npcs/swamp_berserker.json index d8869852..90ecbccd 100644 --- a/world/npcs/swamp_berserker.json +++ b/world/npcs/swamp_berserker.json @@ -43,7 +43,7 @@ ], "loot": { "items": [ - "BERSERKER_BATON" + "berserker baton" ], "lootGoldMax": 10, "lootGoldMin": 5 diff --git a/world/npcs/tree_berserker.json b/world/npcs/tree_berserker.json index ed5f53e5..b0cbf189 100644 --- a/world/npcs/tree_berserker.json +++ b/world/npcs/tree_berserker.json @@ -44,9 +44,9 @@ ], "loot": { "items": [ - "BERSEKER_BOOTS", - "BERSEKER_SHORTS", - "SMALL_HEALTH_POTION" + "beserker boots", + "beserker shorts", + "small health potion" ], "lootGoldMax": 14, "lootGoldMin": 8 -- GitLab