diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index e697251..ceba703 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/plugin.yml b/src/plugin.yml index f00271d..bc07a58 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: TwosideKeeper main: sig.plugin.TwosideKeeper.TwosideKeeper -version: 3.8.5b +version: 3.8.5c commands: money: description: Tells the player the amount of money they are holding. diff --git a/src/sig/plugin/TwosideKeeper/AutoUpdatePlugin.java b/src/sig/plugin/TwosideKeeper/AutoUpdatePlugin.java index 9cd97eb..6b06283 100644 --- a/src/sig/plugin/TwosideKeeper/AutoUpdatePlugin.java +++ b/src/sig/plugin/TwosideKeeper/AutoUpdatePlugin.java @@ -75,10 +75,10 @@ public class AutoUpdatePlugin implements Runnable { public void run() { if (!TwosideKeeper.restarting_server) { if (Bukkit.getOnlinePlayers().size()!=0) { - DiscordMessageSender.sendItalicizedRawMessageDiscord("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(ii).name+". The server will restart in 3 minutes!"); + aPlugin.API.discordSendRawItalicized("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(ii).name+". The server will restart in 3 minutes!"); Bukkit.broadcastMessage("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(ii).name+". The server will restart in 3 minutes!\n\n"+ChatColor.GRAY+ChatColor.ITALIC+"If all players leave, the update will occur immediately."); } else { - DiscordMessageSender.sendItalicizedRawMessageDiscord("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(ii).name+"."); + aPlugin.API.discordSendRawItalicized("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(ii).name+"."); Bukkit.broadcastMessage("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(ii).name+"."+ChatColor.GRAY+ChatColor.ITALIC+"If all players leave, the update will occur immediately."); } restarting=true; @@ -86,7 +86,7 @@ public class AutoUpdatePlugin implements Runnable { //Save the new plugin hash. } else { - DiscordMessageSender.sendItalicizedRawMessageDiscord("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(ii).name+"."); + aPlugin.API.discordSendRawItalicized("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(ii).name+"."); Bukkit.broadcastMessage("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(ii).name+"."+ChatColor.GRAY+ChatColor.ITALIC+"If all players leave, the update will occur immediately."); } if (restarting) { diff --git a/src/sig/plugin/TwosideKeeper/CustomDamage.java b/src/sig/plugin/TwosideKeeper/CustomDamage.java index 7cc7f4e..aa94310 100644 --- a/src/sig/plugin/TwosideKeeper/CustomDamage.java +++ b/src/sig/plugin/TwosideKeeper/CustomDamage.java @@ -45,6 +45,8 @@ import sig.plugin.TwosideKeeper.HelperStructures.BowMode; import sig.plugin.TwosideKeeper.HelperStructures.ItemSet; import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty; import sig.plugin.TwosideKeeper.HelperStructures.MonsterType; +import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode; +import sig.plugin.TwosideKeeper.HelperStructures.WorldShop; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; public class CustomDamage { @@ -169,6 +171,9 @@ public class CustomDamage { } } dmg += addToPlayerLogger(damager,target,"Execute",(((GenericFunctions.getAbilityValue(ArtifactAbility.EXECUTION, weapon)*5.0)*(1-(target.getHealth()/target.getMaxHealth()))))); + if (shooter instanceof Player) { + dmg += addToPlayerLogger(damager,target,"Execute Set Bonus",(((ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.LORASAADI, 4, 4)*5.0)*(1-(target.getHealth()/target.getMaxHealth()))))); + } dmg += addMultiplierToPlayerLogger(damager,target,"Striker Mult",dmg * calculateStrikerMultiplier(shooter,target)); double preemptivedmg = addMultiplierToPlayerLogger(damager,target,"Preemptive Strike Mult",dmg * calculatePreemptiveStrikeMultiplier(target,shooter)); if (preemptivedmg!=0.0) {preemptive=true;} @@ -297,7 +302,7 @@ public class CustomDamage { String reason, int flags) { if (target instanceof Player) { Player p = (Player)target; - if (GenericFunctions.isDefender(p)) { + if (PlayerMode.isDefender(p)) { int resistlevel = GenericFunctions.getPotionEffectLevel(PotionEffectType.DAMAGE_RESISTANCE, p); if (resistlevel<4) { p.removePotionEffect(PotionEffectType.DAMAGE_RESISTANCE); @@ -333,6 +338,7 @@ public class CustomDamage { if (GenericFunctions.AttemptRevive(p, damage, reason)) { damage=0; } + reduceSwiftAegisBuff(p); if (damage0) { + if (p.hasPotionEffect(PotionEffectType.DAMAGE_RESISTANCE)) { + int resistancelv = GenericFunctions.getPotionEffectLevel(PotionEffectType.DAMAGE_RESISTANCE, p); + int resistance_duration = GenericFunctions.getPotionEffectDuration(PotionEffectType.DAMAGE_RESISTANCE, p); + if (resistancelv>0) { + p.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Math.max(resistance_duration,20*20),resistancelv-1),true); + } else { + p.removePotionEffect(PotionEffectType.DAMAGE_RESISTANCE); + } + pd.swiftaegisamt--; + TwosideKeeper.log(pd.swiftaegisamt+" stacks of Aegis remaining.", 5); + } else { + pd.swiftaegisamt=0; + TwosideKeeper.log(pd.swiftaegisamt+" stacks of Aegis remaining.", 5); + } + if (p.hasPotionEffect(PotionEffectType.DAMAGE_RESISTANCE)) { + aPlugin.API.sendActionBarMessage(p, ChatColor.GRAY+"Resistance "+WorldShop.toRomanNumeral(GenericFunctions.getPotionEffectLevel(PotionEffectType.DAMAGE_RESISTANCE, p)+1)); + } else { + aPlugin.API.sendActionBarMessage(p, ChatColor.GRAY+"Swift Aegis Resistance Removed."); + } + } + } + private static void triggerEliteBreakEvent(LivingEntity target) { if (target instanceof Monster && TwosideKeeper.monsterdata.containsKey(target.getUniqueId())) { @@ -553,7 +584,7 @@ public class CustomDamage { } private static void reduceDefenderKnockback(Player p) { - if (GenericFunctions.isDefender(p) && p.isBlocking()) { + if (PlayerMode.isDefender(p) && p.isBlocking()) { Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() { @Override public void run() { @@ -604,7 +635,7 @@ public class CustomDamage { } static void applyDefenderAggro(Monster m, Player p) { - if (GenericFunctions.isDefender(p)) { + if (PlayerMode.isDefender(p)) { setMonsterTarget(m,p); setAggroGlowTickTime(m,100); } @@ -627,12 +658,14 @@ public class CustomDamage { MonsterStructure ms = (MonsterStructure)TwosideKeeper.monsterdata.get(m.getUniqueId()); ms.SetTarget(p); } else { - TwosideKeeper.monsterdata.put(m.getUniqueId(),new MonsterStructure(m,p)); + MonsterStructure ms = new MonsterStructure(m,p); + TwosideKeeper.monsterdata.put(m.getUniqueId(),ms); + ms.SetTarget(p); } } private static void healDefenderSaturation(Player p) { - if (GenericFunctions.isDefender(p) && p.getSaturation()<20) { + if (PlayerMode.isDefender(p) && p.getSaturation()<20) { p.setSaturation(p.getSaturation()+1); } } @@ -738,6 +771,7 @@ public class CustomDamage { duration += GenericFunctions.getAbilityValue(ArtifactAbility.GRACEFULDODGE, equip[i]); } } + duration+=ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target,ItemSet.JAMDAK,4,4)/20d; //Convert from seconds to ticks. int tick_duration = (int)(duration*20); //Apply iframes. @@ -817,14 +851,21 @@ public class CustomDamage { if (p.isBlocking()) { dodgechance+=ItemSet.GetTotalBaseAmount(p, ItemSet.SONGSTEEL)/100d; } + dodgechance+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.JAMDAK,2,2)/100d; + dodgechance+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.JAMDAK,3,3)/100d; - if (GenericFunctions.isStriker(p) && + if (PlayerMode.isStriker(p) && 93.182445*pd.velocity>4.317) { dodgechance+=0.2; } - if (GenericFunctions.isRanger(p)) { + if (PlayerMode.isRanger(p)) { dodgechance+=0.5; } + + if (dodgechance>0.95) { + dodgechance=0.95; + } + if (pd.fulldodge) { dodgechance = 1.0; } @@ -845,10 +886,12 @@ public class CustomDamage { if (target instanceof LivingEntity) { ItemStack[] armor = GenericFunctions.getEquipment(target); if (target instanceof Player) { - rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.ALIKAHN, 2, 2)/100d; + rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.DARNYS, 2, 2)/100d; + rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.DARNYS, 3, 3)/100d; + /*rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.ALIKAHN, 2, 2)/100d; rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.JAMDAK, 2, 2)/100d; rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.DARNYS, 2, 2)/100d; - rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.LORASAADI, 2, 2)/100d; + rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.LORASAADI, 2, 2)/100d;*/ } for (int i=0;i=4 || GenericFunctions.isRanger(p)) { + if (proj.getTicksLived()>=4 || PlayerMode.isRanger(p)) { if (arrowLoc.distanceSquared(monsterHead)<=0.3*headshotvaly) { PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); - if (GenericFunctions.isRanger(p) && GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.SNIPE) { + if (PlayerMode.isRanger(p) && GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.SNIPE) { if (pd.headshotcombo<8) {pd.headshotcombo++;} double headshotincrease = (2+(pd.headshotcombo*0.25)); mult+=headshotincrease; @@ -1353,7 +1398,7 @@ public class CustomDamage { mult+=2.0; p.sendMessage(ChatColor.DARK_RED+"Headshot! x2 Damage"); - if (GenericFunctions.isRanger(p) && GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.DEBILITATION) { + if (PlayerMode.isRanger(p) && GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.DEBILITATION) { if (m.hasPotionEffect(PotionEffectType.BLINDNESS)) { //Add to the current stack of BLINDNESS. for (int i1=0;i1In here",2); + TwosideKeeper.log("->In here",5); ItemSet set = TwosideKeeperAPI.getItemSet(item); if (set==ItemSet.JAMDAK) { lm.setColor(org.bukkit.Color.fromRGB(128, 64, 0)); @@ -3717,4 +3701,31 @@ public class GenericFunctions { item.setItemMeta(meta); } } + + public static void ApplySwiftAegis(Player p) { + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + int swiftaegislv=(int)ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DARNYS, 4, 4); + if (swiftaegislv>0) { + TwosideKeeper.log("Applying "+swiftaegislv+" levels of Swift Aegis.",5); + int resistancelv = 0; + int resistance_duration = 0; + if (p.hasPotionEffect(PotionEffectType.DAMAGE_RESISTANCE)) { + resistancelv = GenericFunctions.getPotionEffectLevel(PotionEffectType.DAMAGE_RESISTANCE, p); + resistance_duration = GenericFunctions.getPotionEffectDuration(PotionEffectType.DAMAGE_RESISTANCE, p); + } + if (resistancelv<9) { + //Try to apply as many levels as we can onto it. + if (resistancelv+swiftaegislv<9) { + //Apply it directly. + pd.swiftaegisamt+=swiftaegislv; + p.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, Math.max(20*20, resistance_duration), (resistancelv+swiftaegislv)),true); + } else { + pd.swiftaegisamt+=Math.max(9-resistancelv,0); + p.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, Math.max(20*20, resistance_duration), 9),true); + } + } + TwosideKeeper.log("New Aegis level: "+pd.swiftaegisamt,5); + aPlugin.API.sendActionBarMessage(p, ChatColor.GRAY+"Resistance "+WorldShop.toRomanNumeral(GenericFunctions.getPotionEffectLevel(PotionEffectType.DAMAGE_RESISTANCE, p)+1)); + } + } } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/CustomRecipe.java b/src/sig/plugin/TwosideKeeper/HelperStructures/CustomRecipe.java index 3f0385c..4de5284 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/CustomRecipe.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/CustomRecipe.java @@ -1,17 +1,60 @@ package sig.plugin.TwosideKeeper.HelperStructures; +import java.util.ArrayList; +import java.util.List; + import org.bukkit.ChatColor; import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; import org.bukkit.event.inventory.PrepareItemCraftEvent; import org.bukkit.inventory.CraftingInventory; +import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.Recipe; +import org.bukkit.inventory.ShapedRecipe; +import org.bukkit.inventory.ShapelessRecipe; import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.PotionMeta; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; import sig.plugin.TwosideKeeper.TwosideKeeper; public enum CustomRecipe { - ENDER_ITEM_CUBE_DUPLICATE; + ENDER_ITEM_CUBE_DUPLICATE(); + + Recipe rec; + ItemStack result; + String listname; + + CustomRecipe() { + rec=null; + result=null; + listname=null; + } + + CustomRecipe(Recipe recipe, ItemStack result, String listname) { + this.rec=recipe; + this.result=result; + this.listname=listname; + } + + public static void DisplayRecipe(Player p, CustomRecipe recipe) { + if (isNotGoingToMakeAMillionErrors(recipe)) { + if (recipe.rec instanceof ShapedRecipe) { + aPlugin.API.viewRecipe(p, (ShapedRecipe)recipe.rec); + } else { + aPlugin.API.viewRecipe(p, (ShapelessRecipe)recipe.rec); + } + } + } + + private static boolean isNotGoingToMakeAMillionErrors(CustomRecipe recipe) { + return (recipe.rec!=null && recipe.result!=null && recipe.listname!=null); + } + public boolean isSameRecipe(ItemStack item) { if (item!=null && item.hasItemMeta() && @@ -83,4 +126,103 @@ public enum CustomRecipe { } } } + + public static CustomPotion DefineHardeningVial() { + ItemStack HARDENING_VIAL = new ItemStack(Material.POTION); + List effects = new ArrayList(); + effects.add(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,20*60*15,0)); + List lore = new ArrayList(); + lore.add("A fantastic potion, it comes straight"); + lore.add("from the elixir of the gods."); + PotionMeta pm = (PotionMeta)HARDENING_VIAL.getItemMeta(); + pm.setLore(lore); + pm.setDisplayName(ChatColor.GREEN+"Hardening Vial"); + pm.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS); + HARDENING_VIAL.setItemMeta(pm); + return new CustomPotion(HARDENING_VIAL,effects,6,9); + } + + public static CustomPotion DefineLifeVial() { + ItemStack LIFE_VIAL = new ItemStack(Material.POTION); + List effects = new ArrayList(); + effects.add(new PotionEffect(PotionEffectType.ABSORPTION,20*60*15,0)); + List lore = new ArrayList(); + lore.add("A fantastic potion, it comes straight"); + lore.add("from the elixir of the gods."); + PotionMeta pm = (PotionMeta)LIFE_VIAL.getItemMeta(); + pm.setLore(lore); + pm.setDisplayName(ChatColor.GREEN+"Life Vial"); + pm.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS); + LIFE_VIAL.setItemMeta(pm); + return new CustomPotion(LIFE_VIAL,effects,50,100); + } + + public static CustomPotion DefineStrengtheningVial() { + ItemStack STRENGTHENING_VIAL = new ItemStack(Material.POTION); + List effects = new ArrayList(); + effects.add(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,20*60*15,0)); + List lore = new ArrayList(); + lore.add("A fantastic potion, it comes straight"); + lore.add("from the elixir of the gods."); + PotionMeta pm = (PotionMeta)STRENGTHENING_VIAL.getItemMeta(); + pm.setLore(lore); + pm.setDisplayName(ChatColor.GREEN+"Strengthing Vial"); + pm.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS); + STRENGTHENING_VIAL.setItemMeta(pm); + return new CustomPotion(STRENGTHENING_VIAL,effects,20,40); + /*//LEGACY CODE + ItemStack STRENGTHENING_VIAL = new ItemStack(Material.POTION); + PotionMeta pm = (PotionMeta)STRENGTHENING_VIAL.getItemMeta(); + int val=(int)(Math.random()*20+20); + pm.addCustomEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,20*60*15,val+1), true); + List lore = new ArrayList(); + lore.add(ChatColor.GRAY+"Strength "+WorldShop.toRomanNumeral(val)+" ("+WorldShop.toReadableDuration(20*60*15)+")"); + lore.add(""); + lore.add("A fantastic potion, it comes straight"); + lore.add("from the elixir of the gods."); + pm.setLore(lore); + pm.setDisplayName("Strengthing Vial"); + pm.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS); + STRENGTHENING_VIAL.setItemMeta(pm); + return new CustomItem(STRENGTHENING_VIAL);*/ + } + + public static CustomItem DefineUpgradeShard() { + ItemStack UPGRADE_SHARD = new ItemStack(Material.PRISMARINE_SHARD); + ItemMeta meta = UPGRADE_SHARD.getItemMeta(); + meta.setDisplayName(ChatColor.GREEN+"Upgrade Shard"); + meta.addItemFlags(ItemFlag.HIDE_ENCHANTS); + List UPGRADE_SHARD_lore = new ArrayList(); + UPGRADE_SHARD_lore.add("An eerie glow radiates from"); + UPGRADE_SHARD_lore.add("this item. It seems to possess"); + UPGRADE_SHARD_lore.add("some other-worldly powers."); + meta.setLore(UPGRADE_SHARD_lore); + UPGRADE_SHARD.setItemMeta(meta); + UPGRADE_SHARD.addUnsafeEnchantment(Enchantment.LUCK, 1); + return new CustomItem(UPGRADE_SHARD); + } + + public static CustomItem DefineHuntersCompass() { + ItemStack temp = new ItemStack(Material.COMPASS); + temp.addUnsafeEnchantment(Enchantment.LUCK, 1); + ItemMeta m = temp.getItemMeta(); + m.addItemFlags(ItemFlag.HIDE_ENCHANTS); + m.setDisplayName(ChatColor.RED+"Hunter's Compass"); + List lore = new ArrayList(); + lore.add("A compass for the true hunter."); + lore.add("Legends tell of hunters that have"); + lore.add("come back with great treasures and"); + lore.add("much wealth from following the."); + lore.add("directions of the guided arrow."); + lore.add(""); + lore.add("You may need to calibrate it by"); + lore.add("right-clicking with it first."); + lore.add(""); + lore.add("The compass appears to be slightly"); + lore.add("unstable..."); + m.setLore(lore); + temp.setItemMeta(m); + temp.addUnsafeEnchantment(Enchantment.LUCK, 1); + return new CustomItem(temp); + } } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java b/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java index 9a4f36d..1365dde 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java @@ -12,6 +12,7 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import sig.plugin.TwosideKeeper.TwosideKeeper; +import sig.plugin.TwosideKeeper.WorldShopManager; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; public enum ItemSet { @@ -19,10 +20,12 @@ public enum ItemSet { SONGSTEEL(4,2, 6,2, 8,4, 20,10), DAWNTRACKER(4,4, 20,10, 20,10, 6,4), LORASYS(0,0, 0,0, 0,0, 0,0), - JAMDAK(1,1, 3,9, 4,4, 10,5), - DARNYS(2,1, 6,13, 5,5, 10,8), - ALIKAHN(3,1, 9,15, 6,6, 10,10), - LORASAADI(4,1, 12,17, 8,8, 10,15); + JAMDAK(1,1, 5,1, 10,1, 10,2), //Graceful Dodge is in ticks. + DARNYS(1,1, 10,5, 20,5, 1,1), + ALIKAHN(1,1, 15,6, 30,10, 12,6), + LORASAADI(1,1, 1,1, 3,2, 2,1), + MOONSHADOW(4,1, 12,17, 8,8, 10,15), + GLADOMAIN(4,1, 12,17, 8,8, 10,15); int baseval; int increase_val; @@ -75,8 +78,8 @@ public enum ItemSet { return Integer.parseInt(lore.get(i).replace(ChatColor.GOLD+""+ChatColor.BOLD+"T", "").split(" ")[0]); } } + TwosideKeeper.log(ChatColor.RED+"[ERROR] Could not detect proper tier of "+item.toString()+"!", 1); } - TwosideKeeper.log(ChatColor.RED+"[ERROR] Could not detect proper tier of "+item.toString()+"!", 1); return 0; } @@ -304,14 +307,60 @@ public enum ItemSet { lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Debilitation Mode:"); lore.add(ChatColor.GRAY+" Increases Armor Penetration by +50%."); }break; - case JAMDAK: - case DARNYS: - case ALIKAHN: - case LORASAADI:{ + case JAMDAK: { + lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+"% Dodge Chance"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+"% Dodge Chance"); + lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+(ItemSet.GetBaseAmount(set, tier, 4)/20d)+"s Graceful Dodge"); + lore.add(ChatColor.GRAY+" Gives you invulnerability after a"); + lore.add(ChatColor.GRAY+" successful dodge."); + lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" Boosts All Modes of Ranger"); + lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Close Range Mode:"); + lore.add(ChatColor.GRAY+" Increases Tumble Invincibility from"); + lore.add(ChatColor.GRAY+" 1 -> 3 seconds"); + lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Sniper Mode:"); + lore.add(ChatColor.GRAY+" Increases Critical Damage by +100%"); + lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Debilitation Mode:"); + lore.add(ChatColor.GRAY+" Increases Armor Penetration by +50%."); + }break; + case DARNYS: { lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+"% Damage Reduction"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+"% Damage Reduction"); + lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" Swift Aegis "+WorldShop.toRomanNumeral(ItemSet.GetBaseAmount(set, tier, 4))); + lore.add(ChatColor.GRAY+" Builds "+ItemSet.GetBaseAmount(set, tier, 4)+" stack"+((ItemSet.GetBaseAmount(set, tier, 4))!=1?"s":"")+" of Resistance every"); + lore.add(ChatColor.GRAY+" 5 seconds of sprinting, and for every"); + lore.add(ChatColor.GRAY+" Tumble. Each hit removes one stack of"); + lore.add(ChatColor.GRAY+" Resistance. Caps at Resistance 10."); + lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" Boosts All Modes of Ranger"); + lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Close Range Mode:"); + lore.add(ChatColor.GRAY+" Increases Tumble Invincibility from"); + lore.add(ChatColor.GRAY+" 1 -> 3 seconds"); + lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Sniper Mode:"); + lore.add(ChatColor.GRAY+" Increases Critical Damage by +100%"); + lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Debilitation Mode:"); + lore.add(ChatColor.GRAY+" Increases Armor Penetration by +50%."); + }break; + case ALIKAHN: { + lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+" Max Health"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Max Health"); + lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+"+"+ItemSet.GetBaseAmount(set, tier, 4)+" Health Regen / 5 seconds"); + lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" Boosts All Modes of Ranger"); + lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Close Range Mode:"); + lore.add(ChatColor.GRAY+" Increases Tumble Invincibility from"); + lore.add(ChatColor.GRAY+" 1 -> 3 seconds"); + lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Sniper Mode:"); + lore.add(ChatColor.GRAY+" Increases Critical Damage by +100%"); + lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Debilitation Mode:"); + lore.add(ChatColor.GRAY+" Increases Armor Penetration by +50%."); + }break; + case LORASAADI:{ + lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+" Damage"); lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Damage"); - lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+" Max Health"); + lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+" Execution Damage"); + lore.add(ChatColor.DARK_AQUA+" per 20% Missing Health"); lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" Boosts All Modes of Ranger"); lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Close Range Mode:"); lore.add(ChatColor.GRAY+" Increases Tumble Invincibility from"); diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java index 3ed46cc..4670287 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java @@ -15,6 +15,10 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.LeatherArmorMeta; +import aPlugin.Drop; +import aPlugin.DropItem; +import aPlugin.DropMaterial; +import sig.plugin.TwosideKeeper.Artifact; import sig.plugin.TwosideKeeper.CustomDamage; import sig.plugin.TwosideKeeper.MonsterController; import sig.plugin.TwosideKeeper.TwosideKeeper; @@ -24,6 +28,91 @@ public class Loot { static double HARDENED_ENCHANT_MULT = 1.4; static int MAX_ENCHANT_LEVEL = 10; + + //NORMAL: 100% Rate. (<=1000) + //RARE: 7.8% Rate. (<=78) + //LEGENDARY: 1.9% Rate. (<=19) + + public static void DefineLootChests() { + aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.STONE_SWORD,8)); + aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.MYSTERIOUS_ESSENCE),11)); + aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.IRON_INGOT,3,19)); + aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.DIAMOND,3,18)); + aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.GOLD_NUGGET,3,17)); + aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.ENDER_PEARL,3,19)); + aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.ENDER_CHEST,19)); + aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.ARTIFACT_CORE),4)); + aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.IRON_INGOT,78)); + aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.DIAMOND,78)); + aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.GOLD_NUGGET,78)); + aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.LEATHER_HELMET,78)); + aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.LEATHER_CHESTPLATE,78)); + aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.LEATHER_LEGGINGS,78)); + aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.LEATHER_BOOTS,78)); + aPlugin.API.Chests.LOOT_NORMAL.printDrops(); + + aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropMaterial(Material.IRON_INGOT,1000)); + aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropMaterial(Material.IRON_BLOCK,78)); + aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropMaterial(Material.IRON_CHESTPLATE,78)); + aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropMaterial(Material.IRON_LEGGINGS,78)); + aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropMaterial(Material.IRON_BOOTS,78)); + aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropMaterial(Material.IRON_HELMET,78)); + aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropMaterial(Material.STONE_AXE,8)); + aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropMaterial(Material.STONE_PICKAXE,8)); + aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropMaterial(Material.STONE_HOE,8)); + aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropMaterial(Material.STONE_SPADE,8)); + aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropMaterial(Material.FISHING_ROD,8)); + aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.ANCIENT_CORE),4)); + aPlugin.API.Chests.LOOT_DANGEROUS.printDrops(); + + aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.IRON_INGOT,2,1000)); + aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.DIAMOND,1000)); + aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.GOLD_NUGGET,3,1000)); + aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.IRON_BLOCK,2,78)); + aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.DIAMOND_BLOCK,78)); + aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.GOLD_INGOT,78)); + aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.DIAMOND_SWORD,8)); + aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.IRON_AXE,8)); + aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.IRON_PICKAXE,8)); + aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.IRON_HOE,8)); + aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.IRON_SPADE,8)); + aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.DIAMOND_CHESTPLATE,78)); + aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.DIAMOND_LEGGINGS,78)); + aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.DIAMOND_BOOTS,78)); + aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.DIAMOND_HELMET,78)); + aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.FISHING_ROD,8)); + aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.BOW,8)); + aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.LOST_CORE),4)); + aPlugin.API.Chests.LOOT_DEADLY.printDrops(); + + aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.EMERALD,3,1000)); + aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.DIAMOND,3,1000)); + aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.GOLD_INGOT,3,1000)); + aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.EMERALD_BLOCK,78)); + aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.DIAMOND_BLOCK,2,78)); + aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.GOLD_BLOCK,78)); + aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.DIAMOND_SWORD,8)); + aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.GOLD_SWORD,8)); + aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.DIAMOND_AXE,8)); + aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.DIAMOND_PICKAXE,8)); + aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.DIAMOND_HOE,8)); + aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.DIAMOND_SPADE,8)); + aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.BOW,8)); + aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.FISHING_ROD,8)); + aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.DIAMOND_CHESTPLATE,78)); + aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.DIAMOND_LEGGINGS,78)); + aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.DIAMOND_BOOTS,78)); + aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.DIAMOND_HELMET,78)); + aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.GOLD_CHESTPLATE,78)); + aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.GOLD_LEGGINGS,78)); + aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.GOLD_BOOTS,78)); + aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.GOLD_HELMET,78)); + aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.DIVINE_CORE),4)); + aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(TwosideKeeper.HUNTERS_COMPASS.getItemStack(),10)); + aPlugin.API.Chests.LOOT_HELLFIRE.printDrops(); + + //aPlugin.API.Chests..addDrop(new DropItem(TwosideKeeper.HUNTERS_COMPASS.getItemStack(),10)); + } public static ItemStack GenerateMegaPiece(Material mat_type, boolean hardened) { return GenerateMegaPiece(mat_type, hardened, false); @@ -38,6 +127,7 @@ public class Loot { } public static ItemStack GenerateMegaPiece(Material mat_type, boolean hardened, boolean setitem, int settier, Entity damager, Monster m) { + TwosideKeeper.log("Calling this with "+mat_type.name()+","+hardened+","+setitem+".", 2); ItemStack raresword = new ItemStack(mat_type); ItemMeta sword_meta = raresword.getItemMeta(); sword_meta.setDisplayName(ChatColor.AQUA+""+ChatColor.BOLD+"Mega "+GenericFunctions.UserFriendlyMaterialName(mat_type)); @@ -54,8 +144,9 @@ public class Loot { raresword.setItemMeta(sword_meta); raresword = addEnchantments(raresword,true); } - + /* //LEGACY CODE. if (setitem && (raresword.getType().toString().contains("SWORD") || GenericFunctions.isArmor(raresword))) { + if (damager==null && m==null) { raresword = GenerateSetPiece(raresword,hardened,settier); } else { @@ -73,13 +164,13 @@ public class Loot { MonsterDifficulty md = MonsterController.getMonsterDifficulty(m); ItemSet set = null; if (p!=null) { - if (GenericFunctions.isStriker(p)) { + if (PlayerMode.isStriker(p)) { set=ItemSet.PANROS; } else - if (GenericFunctions.isRanger(p)) { + if (PlayerMode.isRanger(p)) { set = PickRandomRangerSet(); } else - if (GenericFunctions.isDefender(p)) { + if (PlayerMode.isDefender(p)) { set=ItemSet.SONGSTEEL; } else { //RANDOM SET! because we are not a mode of any sort. @@ -101,33 +192,33 @@ public class Loot { raresword = GenerateSetPiece(new ItemStack(Material.STONE_SWORD),hardened,settier+2); }break; case DANGEROUS:{ - if (Math.random()<=0.2) { - if (GenericFunctions.isStriker(p)) { //Only do this weapon for all tiers since the other weapons don't have tiers. Those require hellfires. + if (Math.random()<=0.1) { + if (PlayerMode.isStriker(p)) { //Only do this weapon for all tiers since the other weapons don't have tiers. Those require hellfires. raresword = GenerateSetPiece(new ItemStack(Material.IRON_SWORD),set,(Math.random()<=0.1)?true:false,settier); } } else { if (Math.random()<=0.25) { - if (GenericFunctions.isRanger(p)) { + if (PlayerMode.isRanger(p)) { raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_HELMET),set,hardened,settier); } else { raresword = GenerateSetPiece(new ItemStack(Material.IRON_HELMET),set,hardened,settier+1); } } else if (Math.random()<=0.25) { - if (GenericFunctions.isRanger(p)) { + if (PlayerMode.isRanger(p)) { raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_CHESTPLATE),set,hardened,settier); } else { raresword = GenerateSetPiece(new ItemStack(Material.IRON_CHESTPLATE),set,hardened,settier+1); } } else if (Math.random()<=0.25) { - if (GenericFunctions.isRanger(p)) { + if (PlayerMode.isRanger(p)) { raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_LEGGINGS),set,hardened,settier); } else { raresword = GenerateSetPiece(new ItemStack(Material.IRON_LEGGINGS),set,hardened,settier+1); } } else { - if (GenericFunctions.isRanger(p)) { + if (PlayerMode.isRanger(p)) { raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_BOOTS),set,hardened,settier); } else { raresword = GenerateSetPiece(new ItemStack(Material.IRON_BOOTS),set,hardened,settier+1); @@ -136,33 +227,33 @@ public class Loot { } }break; case DEADLY:{ - if (Math.random()<=0.2) { - if (GenericFunctions.isStriker(p)) { //Only do this weapon for all tiers since the other weapons don't have tiers. Those require hellfires. + if (Math.random()<=0.1) { + if (PlayerMode.isStriker(p)) { //Only do this weapon for all tiers since the other weapons don't have tiers. Those require hellfires. raresword = GenerateSetPiece(new ItemStack(Material.DIAMOND_SWORD),set,(Math.random()<=0.1)?true:false,settier); } } else { if (Math.random()<=0.25) { - if (GenericFunctions.isRanger(p)) { + if (PlayerMode.isRanger(p)) { raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_HELMET),set,hardened,settier); } else { raresword = GenerateSetPiece(new ItemStack(Material.DIAMOND_HELMET),set,hardened,settier); } } else if (Math.random()<=0.25) { - if (GenericFunctions.isRanger(p)) { + if (PlayerMode.isRanger(p)) { raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_CHESTPLATE),set,hardened,settier); } else { raresword = GenerateSetPiece(new ItemStack(Material.DIAMOND_CHESTPLATE),set,hardened,settier); } } else if (Math.random()<=0.25) { - if (GenericFunctions.isRanger(p)) { + if (PlayerMode.isRanger(p)) { raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_LEGGINGS),set,hardened,settier); } else { raresword = GenerateSetPiece(new ItemStack(Material.DIAMOND_LEGGINGS),set,hardened,settier); } } else { - if (GenericFunctions.isRanger(p)) { + if (PlayerMode.isRanger(p)) { raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_BOOTS),set,hardened,settier); } else { raresword = GenerateSetPiece(new ItemStack(Material.DIAMOND_BOOTS),set,hardened,settier); @@ -171,31 +262,31 @@ public class Loot { } }break; case HELLFIRE:{ - if (Math.random()<=0.2) { + if (Math.random()<=0.1) { raresword = GenerateSetPiece(new ItemStack(Material.GOLD_SWORD),set,(Math.random()<=0.1)?true:false,settier); } else { if (Math.random()<=0.25) { - if (GenericFunctions.isRanger(p)) { + if (PlayerMode.isRanger(p)) { raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_HELMET),set,hardened,settier+1); } else { raresword = GenerateSetPiece(new ItemStack(Material.GOLD_HELMET),set,hardened,settier); } } else if (Math.random()<=0.25) { - if (GenericFunctions.isRanger(p)) { + if (PlayerMode.isRanger(p)) { raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_CHESTPLATE),set,hardened,settier+1); } else { raresword = GenerateSetPiece(new ItemStack(Material.GOLD_CHESTPLATE),set,hardened,settier); } } else if (Math.random()<=0.25) { - if (GenericFunctions.isRanger(p)) { + if (PlayerMode.isRanger(p)) { raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_LEGGINGS),set,hardened,settier+1); } else { raresword = GenerateSetPiece(new ItemStack(Material.GOLD_LEGGINGS),set,hardened,settier); } } else { - if (GenericFunctions.isRanger(p)) { + if (PlayerMode.isRanger(p)) { raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_BOOTS),set,hardened,settier+1); } else { raresword = GenerateSetPiece(new ItemStack(Material.GOLD_BOOTS),set,hardened,settier); @@ -209,7 +300,7 @@ public class Loot { } } } - + raresword = addEnchantments(raresword,hardened);*/ return raresword; } @@ -355,6 +446,7 @@ public class Loot { } public static ItemStack GenerateSetPiece(ItemStack item, ItemSet set, boolean hardened, int tierbonus) { + item = GenerateMegaPiece(item.getType(),hardened).clone(); List lore = new ArrayList(); String set_name = ""; String prefix = ""; diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/MonsterDifficulty.java b/src/sig/plugin/TwosideKeeper/HelperStructures/MonsterDifficulty.java index e0ef61f..efcf3cf 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/MonsterDifficulty.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/MonsterDifficulty.java @@ -1,19 +1,25 @@ package sig.plugin.TwosideKeeper.HelperStructures; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Monster; +import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.PotionMeta; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; +import aPlugin.API.Chests; import net.md_5.bungee.api.ChatColor; +import sig.plugin.TwosideKeeper.CustomDamage; +import sig.plugin.TwosideKeeper.MonsterController; import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; @@ -223,6 +229,9 @@ public enum MonsterDifficulty { } public List RandomizeDrops(double dropmult, boolean isBoss, boolean isElite, boolean isRanger, Entity damager, Monster m) { + + MonsterDifficulty diff = MonsterController.getMonsterDifficulty(m); + TwosideKeeper.log(ChatColor.AQUA+"->Entering RandomizeDrops()", 5); List droplist = new ArrayList(); dropmult += 1; //Base dropmult is 1.0. @@ -236,185 +245,173 @@ public enum MonsterDifficulty { //an additional roll.) for (int i=0;i0) { - TwosideKeeper.log(">Attempting Common roll.", 4); - //This is a common roll. - ItemStack gen_loot = DistributeRandomLoot(this.loot_regular, isRanger, damager, m); - TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4); - droplist.add(gen_loot); + TwosideKeeper.log("Attempting a roll...", 2); + ItemStack goodie = null; + if (Math.random()<=0.1 || isBoss) { + TwosideKeeper.log("Inside!", 5); + switch (diff) { + case DANGEROUS:{ + goodie=aPlugin.API.Chests.LOOT_DANGEROUS.getSingleDrop(); + KeepRollingForBosses(isBoss, droplist, goodie, aPlugin.API.Chests.LOOT_DANGEROUS, damager); + }break; + case DEADLY:{ + goodie=aPlugin.API.Chests.LOOT_DEADLY.getSingleDrop(); + KeepRollingForBosses(isBoss, droplist, goodie, aPlugin.API.Chests.LOOT_DEADLY, damager); + }break; + case HELLFIRE:{ + goodie=aPlugin.API.Chests.LOOT_HELLFIRE.getSingleDrop(); + KeepRollingForBosses(isBoss, droplist, goodie, aPlugin.API.Chests.LOOT_HELLFIRE, damager); + }break; + case ELITE:{ + + }break; + default:{ + goodie=aPlugin.API.Chests.LOOT_NORMAL.getSingleDrop(); + KeepRollingForBosses(isBoss, droplist, goodie, aPlugin.API.Chests.LOOT_NORMAL, damager); + } + } TwosideKeeper.Loot_Logger.AddCommonLoot(); - } - //Rare Loot roll. - if (Math.random()0) { - TwosideKeeper.log(">Attempting Rare roll.", 3); - //This is a common roll. - ItemStack gen_loot = DistributeRandomLoot(this.loot_rare, isRanger, damager, m); - TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4); - droplist.add(gen_loot); - double randomness = Math.random(); - TwosideKeeper.log(ChatColor.DARK_GREEN+" Randomness is "+randomness, 4); - if (randomness<=0.2) { - TwosideKeeper.log(ChatColor.DARK_GREEN+" Spawn an essence!", 4); - switch (this) { - case DANGEROUS: - droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ANCIENT_ESSENCE)); - break; - case DEADLY: - droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.LOST_ESSENCE)); - break; - case HELLFIRE: - droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.DIVINE_ESSENCE)); - break; - case ELITE: - droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.DIVINE_ESSENCE)); - break; - case NORMAL: - droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE)); - break; - default: { - TwosideKeeper.log("Invalid Monster Type!", 1); - } - } - } - TwosideKeeper.Loot_Logger.AddRareLoot(); - } - //Legendary Loot roll. - if (Math.random()0) { - TwosideKeeper.log(">Attempting Legendary roll.", 3); - //This is a common roll. - ItemStack gen_loot = DistributeRandomLoot(this.loot_legendary, isRanger, damager, m); - TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4); - droplist.add(gen_loot); - double randomness = Math.random(); - if (this.equals(MonsterDifficulty.HELLFIRE) || this.equals(MonsterDifficulty.ELITE)) { - if (randomness<=0.5) { - ItemStack hunters_compass = TwosideKeeper.HUNTERS_COMPASS.getItemStack(); - droplist.add(hunters_compass); - } - } - randomness = Math.random(); - TwosideKeeper.log(ChatColor.DARK_GREEN+" Randomness is "+randomness, 4); - if (randomness<=0.2) { - TwosideKeeper.log(ChatColor.DARK_GREEN+" Spawn a Core!", 4); - switch (this) { - case DANGEROUS: - droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ANCIENT_CORE)); - break; - case DEADLY: - droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.LOST_CORE)); - break; - case HELLFIRE: - droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.DIVINE_CORE)); - break; - case ELITE: - droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.DIVINE_CORE)); - break; - case NORMAL: - droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ARTIFACT_CORE)); - break; - default: { - TwosideKeeper.log("Invalid Monster Type!", 1); - } - } - } - randomness = Math.random(); - TwosideKeeper.log(ChatColor.DARK_GREEN+" Randomness is "+randomness, 4); - if (randomness<=0.6) { - switch (this) { - case NORMAL: - TwosideKeeper.log(ChatColor.DARK_GREEN+" Spawn a Mysterious Essence!", 4); - droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.MYSTERIOUS_ESSENCE)); - break; - } - } - TwosideKeeper.Loot_Logger.AddLegendaryLoot(); - } - if (isBoss) { //50% of the time, we drop something great. - if (Math.random()<=0.5 && this.loot_legendary.length>0) { - TwosideKeeper.log(">Boss Legendary roll.", 1); - ItemStack gen_loot = DistributeRandomLoot(this.loot_legendary, isRanger, damager, m); - TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4); - droplist.add(gen_loot); - TwosideKeeper.Loot_Logger.AddLegendaryLoot(); - } - else - if (this.loot_rare.length>0) { //Consolation Prize. - TwosideKeeper.log(">Boss Rare roll.", 1); - ItemStack gen_loot = DistributeRandomLoot(this.loot_rare, isRanger, damager, m); - TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4); - droplist.add(gen_loot); - TwosideKeeper.Loot_Logger.AddRareLoot(); - } + ModifyAndAddDropToList(droplist,goodie,damager); } } - TwosideKeeper.log(" Drop List "+"["+(droplist.size())+"]: "+ChatColor.LIGHT_PURPLE+ChatColor.stripColor(droplist.toString()),5); + TwosideKeeper.log("New Droplist: "+droplist.toString(), 5); return droplist; } - - private ItemStack DistributeRandomLoot(LootStructure[] lootlist, boolean isRanger, Entity damager, Monster m) { - //Choose an item randomly from the loot list. - if (lootlist.length>0) { - //Choose an element. - LootStructure ls = lootlist[(int)((Math.random())*lootlist.length)]; - if (ls.GetMaterial()==Material.PRISMARINE_SHARD) { - ItemStack item = TwosideKeeper.UPGRADE_SHARD.getItemStack(); - return item; - } - if (ls.GetMaterial()==Material.POTION) { - //Create a Strengthing Vial. - if (Math.random()<=0.85) { - ItemStack item = TwosideKeeper.STRENGTHENING_VIAL.getItemStack(); - return item; - } else if (Math.random()<=0.85) { - ItemStack item = TwosideKeeper.LIFE_VIAL.getItemStack(); - return item; - } else { - ItemStack item = TwosideKeeper.HARDENING_VIAL.getItemStack(); - return item; - } - } - if (ls.GetMinSetLevel()>0) { - //Make a set piece. - return Loot.GenerateMegaPiece(ls.GetMaterial(), ls.GetHardened(),true,ls.GetMinSetLevel()); - } - if (GenericFunctions.isEquip(new ItemStack(ls.GetMaterial()))) { - //Turn it into a Mega Piece. - if (GenericFunctions.isTool(new ItemStack(ls.GetMaterial()))) { - if (Math.random()<=0.1) { - if (Math.random()<=0.8) { - return Loot.GenerateMegaPiece(ls.GetMaterial(), ls.GetHardened(), true, 0, damager, m); - } else { - return Loot.GenerateMegaPiece(ls.GetMaterial(), ls.GetHardened(),false); - } - } else { - return new ItemStack(ls.GetMaterial(),1,(short)(Math.random()*ls.GetMaterial().getMaxDurability())); - } - } else { - /*if (ls.GetMaterial().toString().contains("LEATHER")) { //LEGACY CODE. - if (isRanger) { - return Loot.GenerateRangerPiece(ls.GetMaterial(), ls.GetHardened(), ls.GetAmount()); - } else { - //Re-roll if a ranger did not kill, as we cannot reward ranger armor to non-rangers. - return DistributeRandomLoot(lootlist,isRanger); - } - } else {*/ - if (Math.random()<=0.8) { - return Loot.GenerateMegaPiece(ls.GetMaterial(), ls.GetHardened(), true, 0, damager, m); - } else { - return Loot.GenerateMegaPiece(ls.GetMaterial(), ls.GetHardened(),false); - } - //} //LEGACY CODE. - } - } else { - //Turn it into a normal item. - return new ItemStack(ls.GetMaterial(),ls.GetAmount()); - } - } else { //Something bad happened if we got here... - return new ItemStack(Material.AIR); + + public void KeepRollingForBosses(boolean isBoss, List droplist, ItemStack goodie, Chests chest, Entity damager) { + int roll=0; + while (isBoss && !GenericFunctions.isEquip(goodie) && roll<50) { + goodie=chest.getSingleDrop(); + ModifyAndAddDropToList(droplist,goodie,damager); + roll++; + TwosideKeeper.Loot_Logger.AddCommonLoot(); } } + + private void ModifyAndAddDropToList(List droplist, ItemStack goodie, Entity damager) { + LivingEntity shooter = CustomDamage.getDamagerEntity(damager); + if (shooter instanceof Player) { + Player p = (Player)shooter; + if (GenericFunctions.isEquip(goodie)) { + if (Math.random()<0.8 && isValidSetItem(goodie)) { + //Convert it to a set piece. + PlayerMode pm = PlayerMode.getPlayerMode(p); + ItemSet set = PickAnItemSet(pm); + goodie = ConvertSetPieceIfNecessary(goodie, set); + goodie = Loot.GenerateSetPiece(goodie.getType(), set, (Math.random()<0.1)?true:false, 0); + } else { + //Convert it to a mega piece. + PlayerMode pm = PlayerMode.getPlayerMode(p); + goodie = Loot.GenerateMegaPiece(goodie.getType(), (Math.random()<0.1)?true:false); + } + } + } + TwosideKeeper.log("Adding item "+goodie, 2); + droplist.add(goodie); + } + + private ItemStack ConvertSetPieceIfNecessary(ItemStack goodie, ItemSet set) { + if ((set==ItemSet.JAMDAK || + set==ItemSet.ALIKAHN || + set==ItemSet.DARNYS || + set==ItemSet.LORASAADI) && + !goodie.getType().name().contains("LEATHER") && + GenericFunctions.isArmor(goodie)) { + goodie.setType(Material.valueOf("LEATHER_"+goodie.getType().name().split("_")[1])); + } else + if (goodie.getType().name().contains("LEATHER") && + !(set==ItemSet.JAMDAK || + set==ItemSet.ALIKAHN || + set==ItemSet.DARNYS || + set==ItemSet.LORASAADI) && + GenericFunctions.isArmor(goodie)) { + goodie.setType(Material.valueOf("IRON_"+goodie.getType().name().split("_")[1])); + } + return goodie; + } + + private boolean isValidSetItem(ItemStack goodie) { + return TwosideKeeper.validsetitems.contains(goodie.getType()); + } + + public ItemSet PickAnItemSet(PlayerMode pm) { + ItemSet set; + switch (pm) { + case STRIKER:{ + set = ItemSet.PANROS; + }break; + case DEFENDER:{ + set = ItemSet.SONGSTEEL; + }break; + case BARBARIAN:{ + set = ItemSet.DAWNTRACKER; + }break; + case RANGER:{ + final int NUMBER_OF_MODES=4; + int totalweight=50*NUMBER_OF_MODES; //50 for each mode. + int selectweight=(int)(Math.random()*totalweight); + if (selectweight<50) { + set = ItemSet.JAMDAK; + } else + if (selectweight<100) { + set = ItemSet.ALIKAHN; + } else + if (selectweight<150) { + set = ItemSet.DARNYS; + } else + { + set = ItemSet.LORASAADI; + } + }break; + case SLAYER:{ + final int NUMBER_OF_MODES=3; + int totalweight=50*NUMBER_OF_MODES; //50 for each mode. + int selectweight=(int)(Math.random()*totalweight); + if (selectweight<50) { + set = ItemSet.LORASYS; + } else + if (selectweight<100) { + set = ItemSet.MOONSHADOW; + } else + { + set = ItemSet.GLADOMAIN; + } + }break; + default:{ + set = PickRandomSet(); + } + } + return set; + } + + private ItemSet PickRandomSet() { + final int NUMBER_OF_MODES=4; + int totalweight=50*NUMBER_OF_MODES; //50 for each mode. + int selectweight=(int)(Math.random()*totalweight); + if (selectweight<50) { + return ItemSet.PANROS; + } else + if (selectweight<100) { + return ItemSet.SONGSTEEL; + } else + if (selectweight<150) { + return ItemSet.DAWNTRACKER; + } else + if (selectweight<200) { + //12.5 per set type. + if (selectweight<162.5) { + return ItemSet.JAMDAK; + } else + if (selectweight<175) { + return ItemSet.ALIKAHN; + } else + if (selectweight<187.5) { + return ItemSet.DARNYS; + } else + if (selectweight<200) { + return ItemSet.LORASAADI; + } + } + return ItemSet.PANROS; + } } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/PlayerMode.java b/src/sig/plugin/TwosideKeeper/HelperStructures/PlayerMode.java new file mode 100644 index 0000000..91bc82e --- /dev/null +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/PlayerMode.java @@ -0,0 +1,127 @@ +package sig.plugin.TwosideKeeper.HelperStructures; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import sig.plugin.TwosideKeeper.PlayerStructure; +import sig.plugin.TwosideKeeper.TwosideKeeper; +import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; + +public enum PlayerMode { + STRIKER(ChatColor.RED,"S","Striker"), + RANGER(ChatColor.GREEN,"R","Ranger"), + DEFENDER(ChatColor.GRAY,"D","Defender"), + BARBARIAN(ChatColor.GOLD,"B","Barbarian"), + SLAYER(ChatColor.DARK_BLUE,"SL","Slayer"), + SUMMONER(ChatColor.DARK_PURPLE,"SM","Summoner"), + NORMAL(ChatColor.WHITE,"",""); + ; + + final public static int UPDATE_GRACE_PERIOD=9; //How often to update the mode of the player. + + ChatColor col=ChatColor.WHITE; + String symbol=""; + + public ChatColor getColor() { + return col; + } + + public String getAbbreviation() { + return symbol; + } + + public String getName() { + return name; + } + + public static PlayerMode getPlayerMode(Player p) { + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + if (needsUpdating(pd)) { + if (isStriker(p)) { + pd.lastmode=PlayerMode.STRIKER; + } else + if (isDefender(p)) { + pd.lastmode=PlayerMode.DEFENDER; + } else + if (isRanger(p)) { + pd.lastmode=PlayerMode.RANGER; + } else { + pd.lastmode=PlayerMode.NORMAL; + } + return pd.lastmode; + } else { + return pd.lastmode; + } + } + + public static boolean needsUpdating(PlayerStructure pd) { + return pd.lastmodeupdate+UPDATE_GRACE_PERIOD<=TwosideKeeper.getServerTickTime(); + } + + public static boolean isRanger(Player p) { + if (p!=null && !p.isDead()) { + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + if (needsUpdating(pd)) { + if ((((p.getEquipment().getItemInMainHand()!=null && p.getEquipment().getItemInMainHand().getType()==Material.BOW && (p.getInventory().getExtraContents()[0]==null || p.getInventory().getExtraContents()[0].getType()==Material.AIR)) || //Satisfy just a bow in main hand. + (p.getEquipment().getItemInMainHand()!=null && p.getEquipment().getItemInMainHand().getType()==Material.BOW && p.getInventory().getExtraContents()[0]!=null && !GenericFunctions.isEquip(p.getInventory().getExtraContents()[0])) || /*Satisfy a bow in main hand and no shield in off-hand.*/ + (p.getEquipment().getItemInMainHand()!=null && !GenericFunctions.isEquip(p.getEquipment().getItemInMainHand()) && p.getInventory().getExtraContents()[0]!=null && p.getInventory().getExtraContents()[0].getType()==Material.BOW) || /*Satisfy a bow in off-hand and no shield in main hand.*/ + ((p.getEquipment().getItemInMainHand()==null || p.getEquipment().getItemInMainHand().getType()==Material.AIR) && p.getInventory().getExtraContents()[0]!=null && p.getInventory().getExtraContents()[0].getType()==Material.BOW)) /*Satisfy just a bow in off-hand.*/ && + GenericFunctions.AllLeatherArmor(p))) { + return true; + } else { + return false; + } + } else { + return pd.lastmode==PlayerMode.RANGER; + } + } else { + return false; + } + } + + public static boolean isDefender(Player p) { + if (p!=null && !p.isDead()) { + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + if (needsUpdating(pd)) { + if (p.getEquipment().getItemInMainHand()!=null && p.getEquipment().getItemInMainHand().getType()==Material.SHIELD) { + return true; + } else { + return false; + } + } else { + return pd.lastmode==PlayerMode.DEFENDER; + } + } else { + return false; + } + } + + public static boolean isStriker(Player p) { + if (p!=null && !p.isDead()) { + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + if (needsUpdating(pd)) { + if (p.getEquipment().getItemInMainHand()!=null && p.getEquipment().getItemInMainHand().getType().toString().contains("SWORD") && + p.getInventory().getExtraContents()[0]==null) { + return true; + } else { + return false; + } + } else { + return pd.lastmode==PlayerMode.STRIKER; + } + } else { + return false; + } + } + + String name=""; + + PlayerMode(ChatColor col, String abbreviation, String fullname) { + this.col=col; + this.symbol=abbreviation; + this.name=fullname; + } + + +} diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/ShopPurchase.java b/src/sig/plugin/TwosideKeeper/HelperStructures/ShopPurchase.java index 992e6bc..5a6fee1 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/ShopPurchase.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/ShopPurchase.java @@ -9,7 +9,6 @@ import org.bukkit.inventory.ItemStack; import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.HoverEvent; import net.md_5.bungee.api.chat.TextComponent; -import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.WorldShopManager; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; diff --git a/src/sig/plugin/TwosideKeeper/MonsterController.java b/src/sig/plugin/TwosideKeeper/MonsterController.java index b43ec80..2951173 100644 --- a/src/sig/plugin/TwosideKeeper/MonsterController.java +++ b/src/sig/plugin/TwosideKeeper/MonsterController.java @@ -171,6 +171,7 @@ public class MonsterController { * Lv2: Iron/Diamond Armor. * Lv3: Diamond Armor. */ + m.setCanPickupItems(false); switch (lv) { case 1:{ if (Math.random()<0.5) { diff --git a/src/sig/plugin/TwosideKeeper/PlayerStructure.java b/src/sig/plugin/TwosideKeeper/PlayerStructure.java index ba00300..5361fa7 100644 --- a/src/sig/plugin/TwosideKeeper/PlayerStructure.java +++ b/src/sig/plugin/TwosideKeeper/PlayerStructure.java @@ -22,6 +22,7 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.util.Vector; import sig.plugin.TwosideKeeper.HelperStructures.DeathStructure; +import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode; import sig.plugin.TwosideKeeper.HelperStructures.ServerType; import sig.plugin.TwosideKeeper.Logging.DamageLogger; @@ -97,6 +98,10 @@ public class PlayerStructure { public String lasthitdesc=""; public double lastdamagetaken=0; public double lastrawdamage=0; + public long lastmodeupdate=0; + public long lastsprintcheck=0; + public int swiftaegisamt=0; + public PlayerMode lastmode=PlayerMode.NORMAL; public long iframetime = 0; diff --git a/src/sig/plugin/TwosideKeeper/RecyclingCenter.java b/src/sig/plugin/TwosideKeeper/RecyclingCenter.java index cec7f6b..58584ab 100644 --- a/src/sig/plugin/TwosideKeeper/RecyclingCenter.java +++ b/src/sig/plugin/TwosideKeeper/RecyclingCenter.java @@ -194,7 +194,7 @@ public class RecyclingCenter { } c.getBlockInventory().setItem(itemslot, i.getItemStack()); populateItemList(i.getItemStack()); - TwosideKeeper.log("Sent "+ChatColor.AQUA+GenericFunctions.UserFriendlyMaterialName(i.getItemStack())+((i.getItemStack().getAmount()>1)?ChatColor.YELLOW+" x"+i.getItemStack().getAmount():"")+ChatColor.RESET+" to Recycling Center Node "+rand_node.toString(),3); + TwosideKeeper.log("Sent "+ChatColor.AQUA+GenericFunctions.UserFriendlyMaterialName(i.getItemStack())+((i.getItemStack().getAmount()>1)?ChatColor.YELLOW+" x"+i.getItemStack().getAmount():"")+ChatColor.RESET+" to Recycling Center Node "+rand_node.toString(),2); } } } diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java index 653f622..f497191 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java @@ -112,6 +112,7 @@ import org.bukkit.event.inventory.InventoryMoveItemEvent; import org.bukkit.event.inventory.InventoryOpenEvent; import org.bukkit.event.inventory.InventoryPickupItemEvent; import org.bukkit.event.inventory.InventoryType; +import org.bukkit.event.inventory.InventoryType.SlotType; import org.bukkit.event.inventory.PrepareAnvilEvent; import org.bukkit.event.inventory.PrepareItemCraftEvent; import org.bukkit.event.player.AsyncPlayerChatEvent; @@ -138,6 +139,7 @@ import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; +import org.bukkit.event.player.PlayerToggleSprintEvent; import org.bukkit.event.server.ServerCommandEvent; import org.bukkit.event.server.ServerListPingEvent; import org.bukkit.event.vehicle.VehicleCreateEvent; @@ -175,6 +177,7 @@ import com.google.common.collect.Iterables; import com.google.common.collect.Iterators; import aPlugin.DiscordMessageSender; +import events.PluginLoadEvent; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.HoverEvent; @@ -195,19 +198,17 @@ import sig.plugin.TwosideKeeper.HelperStructures.CubeType; import sig.plugin.TwosideKeeper.HelperStructures.CustomItem; import sig.plugin.TwosideKeeper.HelperStructures.CustomPotion; import sig.plugin.TwosideKeeper.HelperStructures.CustomRecipe; -import sig.plugin.TwosideKeeper.HelperStructures.DeathStructure; import sig.plugin.TwosideKeeper.HelperStructures.ItemCube; -import sig.plugin.TwosideKeeper.HelperStructures.ItemRarity; import sig.plugin.TwosideKeeper.HelperStructures.ItemSet; +import sig.plugin.TwosideKeeper.HelperStructures.Loot; import sig.plugin.TwosideKeeper.HelperStructures.MalleableBaseQuest; import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty; -import sig.plugin.TwosideKeeper.HelperStructures.MonsterType; +import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode; import sig.plugin.TwosideKeeper.HelperStructures.Pronouns; import sig.plugin.TwosideKeeper.HelperStructures.QuestStatus; import sig.plugin.TwosideKeeper.HelperStructures.ServerType; import sig.plugin.TwosideKeeper.HelperStructures.SessionState; import sig.plugin.TwosideKeeper.HelperStructures.SpleefArena; -import sig.plugin.TwosideKeeper.HelperStructures.UpgradePath; import sig.plugin.TwosideKeeper.HelperStructures.WorldShop; import sig.plugin.TwosideKeeper.HelperStructures.WorldShopSession; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; @@ -260,10 +261,97 @@ public class TwosideKeeper extends JavaPlugin implements Listener { public static int COMMONITEMPCT=3; public static long LAST_ELITE_SPAWN = 0; public static Location ELITE_LOCATION = null; + public static boolean LOOT_TABLE_NEEDS_POPULATING=true; public static List TEMPORARYABILITIES = new ArrayList(); public static CustomItem HUNTERS_COMPASS; public static CustomItem UPGRADE_SHARD; + public static CustomItem ITEM_CUBE; + public static CustomItem LARGE_ITEM_CUBE; + public static CustomItem ENDER_ITEM_CUBE; + public static CustomItem DUPLICATE_ENDER_ITEM_CUBE; + public static CustomItem ARROW_QUIVER; + public static CustomItem HARDENED_IRON_HELMET; + public static CustomItem HARDENED_IRON_CHESTPLATE; + public static CustomItem HARDENED_IRON_LEGGINGS; + public static CustomItem HARDENED_IRON_BOOTS; + public static CustomItem HARDENED_DIAMOND_HELMET; + public static CustomItem HARDENED_DIAMOND_CHESTPLATE; + public static CustomItem HARDENED_DIAMOND_LEGGINGS; + public static CustomItem HARDENED_DIAMOND_BOOTS; + public static CustomItem HARDENED_GOLD_HELMET; + public static CustomItem HARDENED_GOLD_CHESTPLATE; + public static CustomItem HARDENED_GOLD_LEGGINGS; + public static CustomItem HARDENED_GOLD_BOOTS; + public static CustomItem WOOL_RECOLOR; + public static CustomItem SLAB_RECONSTRUCTION; + public static CustomItem ARTIFACT_RECIPE_T1; + public static CustomItem ARTIFACT_RECIPE_T2; + public static CustomItem ARTIFACT_RECIPE_T3; + public static CustomItem ARTIFACT_RECIPE_T4; + public static CustomItem ARTIFACT_RECIPE_T5; + public static CustomItem ARTIFACT_RECIPE_T6; + public static CustomItem ARTIFACT_RECIPE_T7; + public static CustomItem ARTIFACT_RECIPE_T8; + public static CustomItem ARTIFACT_RECIPE_T9; + public static CustomItem ARTIFACT_RECIPE_T10; + public static CustomItem ARTIFACT_RECIPE_T11; + public static CustomItem ARTIFACT_RECIPE_T12; + public static CustomItem ARTIFACT_RECIPE_T13; + public static CustomItem ARTIFACT_RECIPE_T14; + public static CustomItem ARTIFACT_RECIPE_T15; + public static CustomItem INCREASE_ARTIFACT_CRAFTING_TIER; + public static CustomItem DECREASE_ARTIFACT_CRAFTING_TIER; + public static CustomItem EMPOWER_ARTIFACT_CRAFTING_ITEM; + public static CustomItem MONEY_CHECK; + public static CustomItem HANDMADE_ARROW; + public static CustomItem DIAMONDTIPPED_ARROW; + public static CustomItem POISON_ARROW; + public static CustomItem TRAPPING_ARROW; + public static CustomItem EXPLODING_ARROW; + public static ShapedRecipe ITEM_CUBE_RECIPE; + public static ShapedRecipe LARGE_ITEM_CUBE_RECIPE; + public static ShapedRecipe ENDER_ITEM_CUBE_RECIPE; + public static ShapedRecipe DUPLICATE_ENDER_ITEM_CUBE_RECIPE; + public static ShapedRecipe ARROW_QUIVER_RECIPE; + public static ShapedRecipe HARDENED_IRON_HELMET_RECIPE; + public static ShapedRecipe HARDENED_IRON_CHESTPLATE_RECIPE; + public static ShapedRecipe HARDENED_IRON_LEGGINGS_RECIPE; + public static ShapedRecipe HARDENED_IRON_BOOTS_RECIPE; + public static ShapedRecipe HARDENED_DIAMOND_HELMET_RECIPE; + public static ShapedRecipe HARDENED_DIAMOND_CHESTPLATE_RECIPE; + public static ShapedRecipe HARDENED_DIAMOND_LEGGINGS_RECIPE; + public static ShapedRecipe HARDENED_DIAMOND_BOOTS_RECIPE; + public static ShapedRecipe HARDENED_GOLD_HELMET_RECIPE; + public static ShapedRecipe HARDENED_GOLD_CHESTPLATE_RECIPE; + public static ShapedRecipe HARDENED_GOLD_LEGGINGS_RECIPE; + public static ShapedRecipe HARDENED_GOLD_BOOTS_RECIPE; + public static ShapedRecipe WOOL_RECOLOR_RECIPE; + public static ShapedRecipe SLAB_RECONSTRUCTION_RECIPE; + public static ShapedRecipe ARTIFACT_RECIPE_T1_RECIPE; + public static ShapedRecipe ARTIFACT_RECIPE_T2_RECIPE; + public static ShapedRecipe ARTIFACT_RECIPE_T3_RECIPE; + public static ShapedRecipe ARTIFACT_RECIPE_T4_RECIPE; + public static ShapedRecipe ARTIFACT_RECIPE_T5_RECIPE; + public static ShapedRecipe ARTIFACT_RECIPE_T6_RECIPE; + public static ShapedRecipe ARTIFACT_RECIPE_T7_RECIPE; + public static ShapedRecipe ARTIFACT_RECIPE_T8_RECIPE; + public static ShapedRecipe ARTIFACT_RECIPE_T9_RECIPE; + public static ShapedRecipe ARTIFACT_RECIPE_T10_RECIPE; + public static ShapedRecipe ARTIFACT_RECIPE_T11_RECIPE; + public static ShapedRecipe ARTIFACT_RECIPE_T12_RECIPE; + public static ShapedRecipe ARTIFACT_RECIPE_T13_RECIPE; + public static ShapedRecipe ARTIFACT_RECIPE_T14_RECIPE; + public static ShapedRecipe ARTIFACT_RECIPE_T15_RECIPE; + public static ShapedRecipe INCREASE_ARTIFACT_CRAFTING_TIER_RECIPE; + public static ShapedRecipe DECREASE_ARTIFACT_CRAFTING_TIER_RECIPE; + public static ShapedRecipe EMPOWER_ARTIFACT_CRAFTING_ITEM_RECIPE; + public static ShapedRecipe MONEY_CHECK_RECIPE; + public static ShapedRecipe HANDMADE_ARROW_RECIPE; + public static ShapedRecipe DIAMONDTIPPED_ARROW_RECIPE; + public static ShapedRecipe POISON_ARROW_RECIPE; + public static ShapedRecipe TRAPPING_ARROW_RECIPE; + public static ShapedRecipe EXPLODING_ARROW_RECIPE; public static CustomPotion STRENGTHENING_VIAL; public static CustomPotion LIFE_VIAL; public static CustomPotion HARDENING_VIAL; @@ -303,6 +391,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { public static Plugin plugin; public int sleepingPlayers=0; + public static List validsetitems = new ArrayList(); boolean reloadedchunk=false; @@ -409,14 +498,35 @@ public class TwosideKeeper extends JavaPlugin implements Listener { banksessions = new HashMap(); monsterdata = new HashMap(); + validsetitems.add(Material.LEATHER_BOOTS); + validsetitems.add(Material.LEATHER_CHESTPLATE); + validsetitems.add(Material.LEATHER_HELMET); + validsetitems.add(Material.LEATHER_LEGGINGS); + validsetitems.add(Material.IRON_BOOTS); + validsetitems.add(Material.IRON_CHESTPLATE); + validsetitems.add(Material.IRON_HELMET); + validsetitems.add(Material.IRON_LEGGINGS); + validsetitems.add(Material.DIAMOND_BOOTS); + validsetitems.add(Material.DIAMOND_CHESTPLATE); + validsetitems.add(Material.DIAMOND_HELMET); + validsetitems.add(Material.DIAMOND_LEGGINGS); + validsetitems.add(Material.GOLD_BOOTS); + validsetitems.add(Material.GOLD_CHESTPLATE); + validsetitems.add(Material.GOLD_HELMET); + validsetitems.add(Material.GOLD_LEGGINGS); + validsetitems.add(Material.STONE_SWORD); + validsetitems.add(Material.IRON_SWORD); + validsetitems.add(Material.DIAMOND_SWORD); + validsetitems.add(Material.GOLD_SWORD); + TEMPORARYABILITIES.add(ArtifactAbility.GREED); TEMPORARYABILITIES.add(ArtifactAbility.SURVIVOR); - HUNTERS_COMPASS = DefineHuntersCompass(); - UPGRADE_SHARD = DefineUpgradeShard(); - STRENGTHENING_VIAL = DefineStrengtheningVial(); - LIFE_VIAL = DefineLifeVial(); - HARDENING_VIAL = DefineHardeningVial(); + HUNTERS_COMPASS = CustomRecipe.DefineHuntersCompass(); + UPGRADE_SHARD = CustomRecipe.DefineUpgradeShard(); + STRENGTHENING_VIAL = CustomRecipe.DefineStrengtheningVial(); + LIFE_VIAL = CustomRecipe.DefineLifeVial(); + HARDENING_VIAL = CustomRecipe.DefineHardeningVial(); //tpstracker = new Lag(); //Let's not assume there are no players online. Load their data. @@ -426,7 +536,21 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } Player p; //Announce the server has restarted soon after. + + if (!LOOT_TABLE_NEEDS_POPULATING) { + Loot.DefineLootChests(); + } + + getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){ + public void run(){ + for (Player p : Bukkit.getOnlinePlayers()) { + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + PlayerMode.getPlayerMode(p); + } + } + },0l,10l); + getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){ public void run(){ //Control charge zombies.. @@ -653,6 +777,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } pd.debuffcount=GenericFunctions.CountDebuffs(p); + if (p.isSprinting() && pd.lastsprintcheck+(20*5) effects = new ArrayList(); - effects.add(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,20*60*15,0)); - List lore = new ArrayList(); - lore.add("A fantastic potion, it comes straight"); - lore.add("from the elixir of the gods."); - PotionMeta pm = (PotionMeta)HARDENING_VIAL.getItemMeta(); - pm.setLore(lore); - pm.setDisplayName(ChatColor.GREEN+"Hardening Vial"); - pm.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS); - HARDENING_VIAL.setItemMeta(pm); - return new CustomPotion(HARDENING_VIAL,effects,6,9); - } - - private CustomPotion DefineLifeVial() { - ItemStack LIFE_VIAL = new ItemStack(Material.POTION); - List effects = new ArrayList(); - effects.add(new PotionEffect(PotionEffectType.ABSORPTION,20*60*15,0)); - List lore = new ArrayList(); - lore.add("A fantastic potion, it comes straight"); - lore.add("from the elixir of the gods."); - PotionMeta pm = (PotionMeta)LIFE_VIAL.getItemMeta(); - pm.setLore(lore); - pm.setDisplayName(ChatColor.GREEN+"Life Vial"); - pm.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS); - LIFE_VIAL.setItemMeta(pm); - return new CustomPotion(LIFE_VIAL,effects,50,100); - } - - private CustomPotion DefineStrengtheningVial() { - ItemStack STRENGTHENING_VIAL = new ItemStack(Material.POTION); - List effects = new ArrayList(); - effects.add(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,20*60*15,0)); - List lore = new ArrayList(); - lore.add("A fantastic potion, it comes straight"); - lore.add("from the elixir of the gods."); - PotionMeta pm = (PotionMeta)STRENGTHENING_VIAL.getItemMeta(); - pm.setLore(lore); - pm.setDisplayName(ChatColor.GREEN+"Strengthing Vial"); - pm.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS); - STRENGTHENING_VIAL.setItemMeta(pm); - return new CustomPotion(STRENGTHENING_VIAL,effects,20,40); - /*//LEGACY CODE - ItemStack STRENGTHENING_VIAL = new ItemStack(Material.POTION); - PotionMeta pm = (PotionMeta)STRENGTHENING_VIAL.getItemMeta(); - int val=(int)(Math.random()*20+20); - pm.addCustomEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,20*60*15,val+1), true); - List lore = new ArrayList(); - lore.add(ChatColor.GRAY+"Strength "+WorldShop.toRomanNumeral(val)+" ("+WorldShop.toReadableDuration(20*60*15)+")"); - lore.add(""); - lore.add("A fantastic potion, it comes straight"); - lore.add("from the elixir of the gods."); - pm.setLore(lore); - pm.setDisplayName("Strengthing Vial"); - pm.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS); - STRENGTHENING_VIAL.setItemMeta(pm); - return new CustomItem(STRENGTHENING_VIAL);*/ - } - - private CustomItem DefineUpgradeShard() { - ItemStack UPGRADE_SHARD = new ItemStack(Material.PRISMARINE_SHARD); - ItemMeta meta = UPGRADE_SHARD.getItemMeta(); - meta.setDisplayName(ChatColor.GREEN+"Upgrade Shard"); - meta.addItemFlags(ItemFlag.HIDE_ENCHANTS); - List UPGRADE_SHARD_lore = new ArrayList(); - UPGRADE_SHARD_lore.add("An eerie glow radiates from"); - UPGRADE_SHARD_lore.add("this item. It seems to possess"); - UPGRADE_SHARD_lore.add("some other-worldly powers."); - meta.setLore(UPGRADE_SHARD_lore); - UPGRADE_SHARD.setItemMeta(meta); - UPGRADE_SHARD.addUnsafeEnchantment(Enchantment.LUCK, 1); - return new CustomItem(UPGRADE_SHARD); - } - - private CustomItem DefineHuntersCompass() { - ItemStack temp = new ItemStack(Material.COMPASS); - temp.addUnsafeEnchantment(Enchantment.LUCK, 1); - ItemMeta m = temp.getItemMeta(); - m.addItemFlags(ItemFlag.HIDE_ENCHANTS); - m.setDisplayName(ChatColor.RED+"Hunter's Compass"); - List lore = new ArrayList(); - lore.add("A compass for the true hunter."); - lore.add("Legends tell of hunters that have"); - lore.add("come back with great treasures and"); - lore.add("much wealth from following the."); - lore.add("directions of the guided arrow."); - lore.add(""); - lore.add("You may need to calibrate it by"); - lore.add("right-clicking with it first."); - lore.add(""); - lore.add("The compass appears to be slightly"); - lore.add("unstable..."); - m.setLore(lore); - temp.setItemMeta(m); - temp.addUnsafeEnchantment(Enchantment.LUCK, 1); - return new CustomItem(temp); - } @Override public void onDisable() { @@ -1126,7 +1158,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (p.getLocation().add(0,0,0).getBlock().getType()==Material.PISTON_MOVING_PIECE) { p.getLocation().add(0,0,0).getBlock().setType(Material.AIR); } - if (SERVER_TYPE==ServerType.TEST || SERVER_TYPE==ServerType.QUIET || p.isOp()) { + if (SERVER_TYPE==ServerType.TEST && p.isOp()) { /*PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); pd.swordcombo=20;*/ /*float f = ((org.bukkit.craftbukkit.v1_9_R1.entity.CraftLivingEntity)p).getHandle().getAbsorptionHearts(); @@ -1432,12 +1464,19 @@ public class TwosideKeeper extends JavaPlugin implements Listener { }*/ // if (!msg.equalsIgnoreCase("")) { if (SERVER_TYPE==ServerType.MAIN) { - DiscordMessageSender.sendItalicizedRawMessageDiscord(SERVER_TYPE.GetServerName()+msg); + aPlugin.API.discordSendRawItalicized(SERVER_TYPE.GetServerName()+msg); } Bukkit.broadcastMessage(msg); } } + @EventHandler(priority=EventPriority.LOW,ignoreCancelled = true) + public void onServerCommand(PluginLoadEvent ev) { + //log("Called",2); + LOOT_TABLE_NEEDS_POPULATING=false; + Loot.DefineLootChests(); + } + @EventHandler(priority=EventPriority.LOW,ignoreCancelled = true) public void onWorldSave(WorldSaveEvent ev) { if (ev.getWorld().getName().equalsIgnoreCase("world")) { @@ -1495,7 +1534,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { public void run() { if (Bukkit.getOnlinePlayers().size()==0 && restarting_server) { Bukkit.savePlayers(); - DiscordMessageSender.sendItalicizedRawMessageDiscord("All players have disconnected. Server is shutting down..."); + aPlugin.API.discordSendRawItalicized("All players have disconnected. Server is shutting down..."); for (int i=0;i1)?" x"+ev.getPlayer().getEquipment().getItemInMainHand().getAmount():"")+"]**"+"\n```"+WorldShop.GetItemInfo(ev.getPlayer().getEquipment().getItemInMainHand())+" ```\n"+ev.getMessage().substring(pos))); + //aPlugin.API.discordSendRaw(("**"+ev.getPlayer().getName()+"** "+ev.getMessage().substring(0, pos)+"**["+ChatColor.stripColor(GenericFunctions.GetItemName(ev.getPlayer().getEquipment().getItemInMainHand()))+((ev.getPlayer().getEquipment().getItemInMainHand().getAmount()>1)?" x"+ev.getPlayer().getEquipment().getItemInMainHand().getAmount():"")+"]**"+"\n```"+WorldShop.GetItemInfo(ev.getPlayer().getEquipment().getItemInMainHand())+" ```\n"+ev.getMessage().substring(pos))); + aPlugin.API.discordSendChat(ev.getPlayer().getName(), ev.getMessage().substring(0, pos)+"**["+ChatColor.stripColor(GenericFunctions.GetItemName(ev.getPlayer().getEquipment().getItemInMainHand()))+((ev.getPlayer().getEquipment().getItemInMainHand().getAmount()>1)?" x"+ev.getPlayer().getEquipment().getItemInMainHand().getAmount():"")+"]**"+"\n```"+WorldShop.GetItemInfo(ev.getPlayer().getEquipment().getItemInMainHand())+" ```\n"+ev.getMessage().substring(pos)); Bukkit.dispatchCommand(Bukkit.getConsoleSender(),"tellraw @a [\"\",{\"text\":\"<"+ev.getPlayer().getName()+"> \"},{\"text\":\""+ev.getMessage().substring(0, pos)+"\"},{\"text\":\""+ChatColor.GREEN+"["+GenericFunctions.GetItemName(ev.getPlayer().getEquipment().getItemInMainHand())+ChatColor.RESET+ChatColor.YELLOW+((ev.getPlayer().getEquipment().getItemInMainHand().getAmount()>1)?" x"+ev.getPlayer().getEquipment().getItemInMainHand().getAmount():"")+ChatColor.GREEN+"]"+ChatColor.WHITE+"\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""+GenericFunctions.GetItemName(ev.getPlayer().getEquipment().getItemInMainHand())+""+WorldShop.GetItemInfo(ev.getPlayer().getEquipment().getItemInMainHand()).replace("\"", "\\\"")+"\"}},{\"text\":\""+ev.getMessage().substring(pos)+"\"}]"); ev.setCancelled(true); } //Bukkit.dispatchCommand(Bukkit.getConsoleSender(),"tellraw @a [\"\",{\"text\":\""+ChatColor.GREEN+"[Item]"+ChatColor.WHITE+"\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""+(ev.getPlayer().getEquipment().getItemInMainHand().getType())+"\"}},{\"text\":\" "+ev.getMessage().substring(0, pos)+" \"}]"); - } } } @@ -2221,7 +2260,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { || ev.getAction()==Action.LEFT_CLICK_BLOCK || ev.getAction()==Action.LEFT_CLICK_AIR) { Player p = ev.getPlayer(); - if (GenericFunctions.isRanger(p) && p.isSneaking() && p.getEquipment().getItemInMainHand().getType()==Material.BOW) { + if (PlayerMode.isRanger(p) && p.isSneaking() && p.getEquipment().getItemInMainHand().getType()==Material.BOW) { //Rotate Bow Modes. p.removePotionEffect(PotionEffectType.SLOW); BowMode mode = GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand()); @@ -2264,7 +2303,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { //Check for a Sword left click. if (ev.getAction()==Action.LEFT_CLICK_AIR || ev.getAction()==Action.LEFT_CLICK_BLOCK) { Player p = ev.getPlayer(); - if (GenericFunctions.isStriker(p)) { + if (PlayerMode.isStriker(p)) { //Check for nearby arrows to deflect. List nearby = p.getNearbyEntities(3.5, 3.5, 3.5); for (int i=0;i entities = player.getNearbyEntities(16, 16, 16); for (int i=0;i nearby = player.getNearbyEntities(10, 10, 10); + boolean reset=false; for (int i=0;i=5 && pd.vendetta_amt>0.0) { //Deal Vendetta damage instead. + if (PlayerMode.isDefender(p) && ItemSet.GetSetCount(ItemSet.SONGSTEEL, p)>=5 && pd.vendetta_amt>0.0) { //Deal Vendetta damage instead. p.playSound(p.getLocation(), Sound.BLOCK_GLASS_BREAK, 1.0f, 0.5f); double dmg = pd.vendetta_amt; CustomDamage.ApplyDamage(pd.vendetta_amt, ev.getDamager(), (LivingEntity)ev.getEntity(), null, "Vendetta"); @@ -4360,7 +4441,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { Monster m = (Monster)ev.getEntity(); if (m.getTarget() instanceof Player) { Player p = (Player)m.getTarget(); - if (GenericFunctions.isRanger(p)) { + if (PlayerMode.isRanger(p)) { //Teleport it into oblivion. log("Going into another dimension...",5); m.teleport(new Location(Bukkit.getWorld("world_nether"),m.getLocation().getX(),m.getLocation().getY(),m.getLocation().getZ())); @@ -4448,8 +4529,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { break; } } - if (em.targetlist.size()==0) { - if (em!=null && (ev.getTarget() instanceof Player) && !em.targetlist.contains((Player)ev.getTarget())) { + if (em!=null && em.targetlist.size()==0) { + if ((ev.getTarget() instanceof Player) && !em.targetlist.contains((Player)ev.getTarget())) { Player p = (Player)ev.getTarget(); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); if (pd.lastdeath+em.WAIT_TIME<=TwosideKeeper.getServerTickTime() && !CustomDamage.isInIframe(p)) { @@ -4542,7 +4623,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { log("Killed by a player.",5); killedByPlayer = true; Player p = (Player)ms.GetTarget(); - if (p!=null && p.isOnline()) { + if (p!=null) { if (GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand()) && GenericFunctions.isArtifactWeapon(p.getEquipment().getItemInMainHand()) && p.getEquipment().getItemInMainHand().getType()==Material.BOW) { @@ -4555,7 +4636,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId()); - if (GenericFunctions.isRanger(p) && + if (PlayerMode.isRanger(p) && GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.CLOSE) { pd.fulldodge=true; } @@ -4565,6 +4646,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (item!=null && item.getType()!=Material.AIR && GenericFunctions.isWeapon(item)) { + log("Adding "+(item.getEnchantmentLevel(Enchantment.LOOT_BONUS_MOBS)*0.1)+"to dropmult for Looting.",5); dropmult+=item.getEnchantmentLevel(Enchantment.LOOT_BONUS_MOBS)*0.1; //Looting increases drop rate by 10% per level. } for (int i=0;i