From a6725ff100fc716512434e03ccff1b352ced2334 Mon Sep 17 00:00:00 2001 From: Nonoriri Date: Wed, 27 Nov 2013 17:09:59 -0500 Subject: [PATCH] Fixed comments to be consistent with code, added chaos chests, several fishing changes during event, event XP doubling now occurs. --- BankEconomyMod/src/me/kaZep/Base/Main.java | 27 +++++-- .../src/me/kaZep/Base/PlayerListener.java | 80 ++++++++++++++----- .../me/kaZep/Commands/commandBankEconomy.java | 6 +- 3 files changed, 87 insertions(+), 26 deletions(-) diff --git a/BankEconomyMod/src/me/kaZep/Base/Main.java b/BankEconomyMod/src/me/kaZep/Base/Main.java index 8930121..5ff4529 100644 --- a/BankEconomyMod/src/me/kaZep/Base/Main.java +++ b/BankEconomyMod/src/me/kaZep/Base/Main.java @@ -3716,7 +3716,7 @@ public void payDay(int time) public void gainMoneyExp(Player p,String job,double amount,double exp) { String[] jobs = getJobs(p); int slot=-1; - if (getConfig().getBoolean("halloween-enabled")) { + if (getConfig().getBoolean("halloween-enabled") || getConfig().getBoolean("thanksgiving-enabled")) { amount*=2; exp*=2; } @@ -3805,7 +3805,7 @@ public void payDay(int time) public void gainMoney(Player p,String job,double amount) { String[] jobs = getJobs(p); int slot=-1; - if (getConfig().getBoolean("halloween-enabled")) { + if (getConfig().getBoolean("halloween-enabled") || getConfig().getBoolean("thanksgiving-enabled")) { amount*=2; } //Add to how much we've earned so far. @@ -4716,6 +4716,9 @@ public void payDay(int time) if (chest.getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.GRAY+""+ChatColor.ITALIC+"You can feel a variety of")) { return 4; // Multiloot } + if (chest.getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.GRAY+""+ChatColor.ITALIC+"A torrential flow of dark")) { + return 5; // Chaos loot + } } @@ -4767,9 +4770,23 @@ public void payDay(int time) chest_name.setLore(chestlore); chest.setItemMeta(chest_name); - } else if (rand < 0.1 || tier == 4) { - // Generate a double chest - chest_name.setDisplayName(ChatColor.YELLOW+"Closed Chest"); + } else if (rand < 0.04 || tier == 5) { + // Generate a chaos chest + chest_name.setDisplayName(ChatColor.RED+"Chaos Chest"); + + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"A mysterious chest!"); + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+""); + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"A torrential flow of dark"); + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"energy causes the chest to"); + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"shake uncontrollably! You"); + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"have absolutely zero idea"); + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"what may be inside."); + chest_name.setLore(chestlore); + + chest.setItemMeta(chest_name); + } else if (rand < 0.12 || tier == 4) { + // Generate a loaded chest + chest_name.setDisplayName(ChatColor.YELLOW+"Loaded Chest"); chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"A mysterious chest!"); chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+""); diff --git a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java index 7de3af4..5d3e4c3 100644 --- a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java @@ -21,6 +21,7 @@ import net.milkbowl.vault.economy.EconomyResponse; + import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Chunk; @@ -178,6 +179,8 @@ import org.bukkit.scoreboard.Team; import org.bukkit.util.Vector; import org.bukkit.potion.Potion; +import sig.ItemSets.DiabloDropsHook; + import com.google.common.base.Objects; import com.sk89q.worldedit.CuboidClipboard; import com.sk89q.worldedit.EditSession; @@ -319,7 +322,7 @@ implements Listener if (this.plugin.PlayerinJob(p, "Enchanter") && this.plugin.getJobLv("Enchanter", p)>=5) { e.setAmount(e.getAmount()*2); } - if (this.plugin.getAccountsConfig().getBoolean("halloween-enabled")) { + if (this.plugin.getAccountsConfig().getBoolean("halloween-enabled") || this.plugin.getConfig().getBoolean("thanksgiving-enabled")) { e.setAmount(e.getAmount()*2); } if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify3")) { @@ -5279,6 +5282,8 @@ implements Listener // 2 = mythic item // 3 = plentiful items // 4 = multiple items + // 5 = chaos items (diablodrops items) + // 999 = Survivor's kit switch (tier) { case 1: { loc.getWorld().dropItemNaturally(loc, getGoodie(0)); @@ -5288,13 +5293,13 @@ implements Listener }break; case 3: { if (Math.random() < 0.1) { - loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.LOG, (int)(Math.random() * 64) + 1)); + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.NETHER_BRICK, (int)(Math.random() * 64) + 1)); } else if (Math.random() < 0.1) { loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.RAW_FISH, (int)(Math.random() * 64) + 1)); } else if (Math.random() < 0.1) { - loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.BOOKSHELF, (int)(Math.random() * 64) + 1)); + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.HAY_BLOCK, (int)(Math.random() * 64) + 1)); } else if (Math.random() < 0.1) { loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.CLAY, (int)(Math.random() * 64) + 1)); @@ -5303,36 +5308,57 @@ implements Listener loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.EXP_BOTTLE, (int)(Math.random() * 64) + 1)); } else if (Math.random() < 0.1) { - loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.OBSIDIAN, (int)(Math.random() * 64) + 1)); + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.NOTE_BLOCK, (int)(Math.random() * 64) + 1)); } else if (Math.random() < 0.1) { loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.MOSSY_COBBLESTONE, (int)(Math.random() * 64) + 1)); } else if (Math.random() < 0.1) { - loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.HAY_BLOCK, (int)(Math.random() * 64) + 1)); + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.BOOKSHELF, (int)(Math.random() * 64) + 1)); } else if (Math.random() < 0.1) { loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.QUARTZ_BLOCK, (int)(Math.random() * 64) + 1)); } else if (Math.random() < 0.1) { - loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.NETHER_BRICK, (int)(Math.random() * 64) + 1)); + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.OBSIDIAN, (int)(Math.random() * 64) + 1)); + } else + if (Math.random() < 0.1) { + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.REDSTONE_LAMP_OFF, (int)(Math.random() * 64) + 1)); } else { + // Damn you got unlucky, better try next time loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.WOOL, (int)(Math.random() * 64) + 1)); } }break; case 4: { - // Drop at least one stack, and five rolls for a 20% chance at an extra stack. + // Drop at least two stacks, and four rolls for a 20% chance at an extra stack. + loc.getWorld().dropItemNaturally(loc, getGoodie(0)); loc.getWorld().dropItemNaturally(loc, getGoodie(0)); - for (int i = 0; i < 5; i++) { + for (int i = 0; i < 4; i++) { + // Averages one extra drop. Can be up to 4. if (Math.random() < 0.2) { loc.getWorld().dropItemNaturally(loc, getGoodie(0)); } - } }break; case 5: { + loc.getWorld().dropItemNaturally(loc, DiabloDropsHook.getRandomItem()); + for (int i = 0; i < 10 && Math.random() < 0.2; i++) { + // 20% for one extra, 4% for two extra, 0.8% for three extra, etc. + loc.getWorld().dropItemNaturally(loc, DiabloDropsHook.getRandomItem()); + } + }break; + case 6: { // OMG NOT CODED YET WTF THIS SHOULDN'T HAPPEN }break; + case 999: { + // Not yet obtainable + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.WORKBENCH)); + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.FURNACE)); + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.WOOD, 16)); + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.COBBLESTONE, 16)); + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.TORCH, 16)); + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.BREAD, 16)); + }break; } } @@ -5343,7 +5369,7 @@ implements Listener public ItemStack getGoodie(int rar /*1=Mythical 0=Normal -1=Only an equipment*/) { ItemStack item = null; - if (Math.random()<0.33 || rar==-1) { + if (Math.random()<0.33 || rar==-1 || rar==1) { //Add a weapon/armor piece. int rand = (int)(Math.random()*5); String type = ""; @@ -6225,7 +6251,7 @@ implements Listener } } } - if (this.plugin.getAccountsConfig().getBoolean("halloween-enabled")) { + if (this.plugin.getAccountsConfig().getBoolean("halloween-enabled") || this.plugin.getConfig().getBoolean("thanksgiving-enabled")) { e.setDroppedExp(e.getDroppedExp()*2); } if (f.getKiller()!=null && f.getKiller().getType()==EntityType.PLAYER) { @@ -6480,9 +6506,23 @@ implements Listener @EventHandler public void onFishCatch(PlayerFishEvent e) { if (e.getState()==State.CAUGHT_FISH) { - if (this.plugin.getConfig().getBoolean("thanksgiving-enabled") && Math.random() < 0.10) { - // 5% chance of fishing up a loot chest - e.getPlayer().getWorld().dropItemNaturally(e.getPlayer().getLocation(), this.plugin.generate_LootChest()); + if (this.plugin.getConfig().getBoolean("thanksgiving-enabled")) { + if (Math.random() < 0.50) { + // 50% chance of fishing up a chicken plus feathers + e.setExpToDrop(e.getExpToDrop() * 2); + e.getPlayer().getWorld().dropItemNaturally(e.getPlayer().getLocation(), new ItemStack(Material.RAW_CHICKEN)); + e.getPlayer().getWorld().dropItemNaturally(e.getPlayer().getLocation(), new ItemStack(Material.FEATHER, 1 + (int)(Math.random() * 4))); + } + for (int c = 0; c < 5 && Math.random() < 0.20; c++) { + // 20% chance each of catching additional fish + e.setExpToDrop(e.getExpToDrop() + (int)(Math.random() * 6) + 1); + e.getPlayer().getWorld().dropItemNaturally(e.getPlayer().getLocation(), new ItemStack(Material.RAW_FISH)); + } + if (Math.random() < 0.10) { + // 10% chance of fishing up a loot chest + e.setExpToDrop(e.getExpToDrop() + (int)(Math.random() * 6) + 1); + e.getPlayer().getWorld().dropItemNaturally(e.getPlayer().getLocation(), this.plugin.generate_LootChest()); + } } Player p = e.getPlayer(); if (this.plugin.PlayerinJob(p, "Fisherman")) { @@ -11529,7 +11569,7 @@ implements Listener item = new ItemStack(Material.BROWN_MUSHROOM); }break; case 92:{ - item = new ItemStack(Material.SNOW_BALL); + item = new ItemStack(Material.SNOW_BALL, 1 + (int)(Math.random() * 16)); }break; case 93:{ item = new ItemStack(Material.FENCE); @@ -11697,7 +11737,7 @@ implements Listener item = new ItemStack(Material.DIAMOND); }break; case 3:{ - item = new ItemStack(Material.GOLD_INGOT); + item = new ItemStack(Material.GOLD_INGOT, 1 + (int)(Math.random() * 2)); }break; case 4:{ item = new ItemStack(Material.GOLDEN_APPLE); @@ -11756,7 +11796,7 @@ implements Listener case 1: case 2: case 3:{ - item = new ItemStack(Material.SKULL_ITEM); + item = new ItemStack(Material.SKULL_ITEM, 1 + (int)(Math.random() * 6)); item.setData(new MaterialData(Material.SKULL_ITEM, (byte) 1)); }break; case 4:{ @@ -11774,13 +11814,13 @@ implements Listener } }break; case 107:{ - item = new ItemStack(Material.COOKIE, 8); + item = new ItemStack(Material.COOKIE, 1 + (int)(Math.random() * 8)); }break; case 108:{ - item = new ItemStack(Material.SEEDS, 42); + item = new ItemStack(Material.SEEDS, 1 + (int)(Math.random() * 64)); }break; case 109:{ - item = new ItemStack(Material.PAINTING, 16); + item = new ItemStack(Material.PAINTING, 1 + (int)(Math.random() * 32)); }break; case 110:{ item = getGoodie(0); diff --git a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java index 8211bff..1fac25d 100644 --- a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java +++ b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java @@ -559,9 +559,13 @@ public String convertToItemName(String val) { } } if (args[0].equalsIgnoreCase("loot")) { - p.getWorld().dropItemNaturally(p.getLocation(), this.plugin.generate_LootChest()); } + p.getWorld().dropItemNaturally(p.getLocation(), this.plugin.generate_LootChest()); + } } else if (cmd.getName().toLowerCase().equalsIgnoreCase("event") && args.length==2 && p.hasPermission("maintenance-mode-admin")) { + if (args[0].equalsIgnoreCase("loot")) { + p.getWorld().dropItemNaturally(p.getLocation(), this.plugin.generate_LootChest(Integer.valueOf(args[1]))); + } if (args[0].equalsIgnoreCase("head")) { ItemStack m = new ItemStack(Material.SKULL_ITEM, 64, (short)SkullType.PLAYER.ordinal()); SkullMeta skullMeta = (SkullMeta) m.getItemMeta();