Weaponsmith jobs buffs implemented.

dev
sigonasr2 11 years ago
parent 5b11795dce
commit 24aec85f85
  1. 1134
      BankEconomyMod/src/me/kaZep/Base/EnchantLevelDatabase.java
  2. 26
      BankEconomyMod/src/me/kaZep/Base/Main.java
  3. 65
      BankEconomyMod/src/me/kaZep/Base/PlayerListener.java

File diff suppressed because it is too large Load Diff

@ -3827,7 +3827,7 @@ public void payDay(int time)
//DERP
if (item.getType()==Material.BOW) {enchant_data=ENCHANTMENT_DATA.bow;} else
if (item.getType()==Material.IRON_SWORD) {enchant_data=ENCHANTMENT_DATA.iron_sword;} else
if (item.getType()==Material.GOLD_SWORD) {enchant_data=ENCHANTMENT_DATA.gold_sword;} else
if (item.getType()==Material.GOLD_SWORD) {enchant_data=ENCHANTMENT_DATA.golden_sword;} else
if (item.getType()==Material.DIAMOND_SWORD) {enchant_data=ENCHANTMENT_DATA.diamond_sword;} else
if (item.getType()==Material.STONE_SPADE) {enchant_data=ENCHANTMENT_DATA.stone_shovel;} else
if (item.getType()==Material.STONE_PICKAXE) {enchant_data=ENCHANTMENT_DATA.stone_pickaxe;} else
@ -3901,19 +3901,17 @@ public void payDay(int time)
}
//see if we should try for a second/third/fourth enchantment.
boolean keepgoing=false;
if (lv==5) {
if (enchantments==1 && Math.random()<=0.07) {
keepgoing=true;
} else
if (enchantments==2 && Math.random()<=0.045) {
keepgoing=true;
} else
if (enchantments==3 && Math.random()<=0.03) {
keepgoing=true;
}
if (!keepgoing) {
break;
}
if (enchantments==1 && Math.random()<=0.07*((double)lv)) {
keepgoing=true;
} else
if (enchantments==2 && Math.random()<=0.045*((double)lv)) {
keepgoing=true;
} else
if (enchantments==3 && Math.random()<=0.03*((double)lv)) {
keepgoing=true;
}
if (!keepgoing) {
break;
}
}
}

@ -5192,6 +5192,42 @@ implements Listener
if (result.getResult().getType()==Material.DIAMOND_SWORD) {
crafteditem=true;
}
if (this.plugin.hasJobBuff("Weaponsmith", p, Job.JOB40) && crafteditem) {
ItemStack[] crafteditems = result.getMatrix();
if (e.getClick()==ClickType.SHIFT_RIGHT || e.getClick()==ClickType.SHIFT_LEFT) {
int lowestamt=9999;
for (int i=0;i<crafteditems.length;i++) {
if (crafteditems[i]!=null && crafteditems[i].getType()!=Material.AIR) {
if (crafteditems[i].getAmount()<lowestamt) {
lowestamt=crafteditems[i].getAmount();
}
}
}
for (int i=0;i<crafteditems.length;i++) {
if (crafteditems[i]!=null && crafteditems[i].getType()!=Material.AIR) {
for (int j=0;j<lowestamt;j++) {
if (Math.random()<=0.5) {
//p.sendMessage("Restored an item.");
ItemStack replenishitem = crafteditems[i].clone();
replenishitem.setAmount(1);
p.getInventory().addItem(replenishitem);
}
}
}
}
} else {
for (int i=0;i<crafteditems.length;i++) {
if (crafteditems[i]!=null && crafteditems[i].getType()!=Material.AIR) {
if (Math.random()<=0.5) {
//p.sendMessage("Restored an item.");
ItemStack replenishitem = crafteditems[i].clone();
replenishitem.setAmount(1);
p.getInventory().addItem(replenishitem);
}
}
}
}
} else
if (this.plugin.hasJobBuff("Weaponsmith", p, Job.JOB20) && crafteditem) {
ItemStack[] crafteditems = result.getMatrix();
if (e.getClick()==ClickType.SHIFT_RIGHT || e.getClick()==ClickType.SHIFT_LEFT) {
@ -5267,7 +5303,17 @@ implements Listener
if (this.plugin.hasJobBuff("Weaponsmith", p, Job.JOB10) && crafteditem) {
//Bukkit.getPlayer("sigonasr2").sendMessage("Valid item. Going to attempt to enchant.");
if (e.getClick()!=ClickType.SHIFT_RIGHT && e.getClick()!=ClickType.SHIFT_LEFT) {
ItemStack resulting = EnchantItem(result.getResult(),5,p);
ItemStack resulting = result.getResult();
if (hasJobBuff("Weaponsmith", p.getName(), Job.JOB40)) {
resulting = EnchantItem(resulting,25,(Player)p);
int finalstack=1;
while (Math.random()<=0.3) {
finalstack++;
}
resulting.setAmount(finalstack);
} else {
resulting = EnchantItem(result.getResult(),5,p);
}
if (hasJobBuff("Weaponsmith", p.getName(), Job.JOB30A)) {
ItemMeta meta = resulting.getItemMeta();
List<String> lore = new ArrayList<String>();
@ -5921,8 +5967,8 @@ implements Listener
if (p.getGameMode()!=GameMode.CREATIVE) {
p.setAllowFlight(false);
p.setFlying(false);
p.sendMessage(ChatColor.DARK_RED+""+ChatColor.ITALIC+"Flight disabled...");
}
p.sendMessage(ChatColor.DARK_RED+""+ChatColor.ITALIC+"Flight disabled...");
}
}
}
@ -11493,10 +11539,23 @@ implements Listener
newItemsCount += post.getAmount();
//Do any enchants we need to do here.
ItemStack clone = post.clone();
if (hasJobBuff("Weaponsmith", player.getName(), Job.JOB40) && validItem_Weaponsmith(post)) {
ItemStack resulting = clone;
resulting = EnchantItem(clone,25,(Player)player);
int finalstack=1;
while (Math.random()<=0.3) {
finalstack++;
}
resulting.setAmount(finalstack);
player.getInventory().setItem(i, resulting);
}
if (PlayerinJob((Player)player,"Weaponsmith")) {
if (getJobLv("Weaponsmith", player.getName())>=10 && validItem_Weaponsmith(post)) {
//Bukkit.getPlayer("sigonasr2").sendMessage("Valid item. Going to attempt to enchant.");
ItemStack resulting = EnchantItem(clone,5,(Player)player);
ItemStack resulting = clone;
if (!hasJobBuff("Weaponsmith", player.getName(), Job.JOB40)) {
resulting = EnchantItem(clone,5,(Player)player);
}
if (hasJobBuff("Weaponsmith", player.getName(), Job.JOB30A)) {
ItemMeta meta = resulting.getItemMeta();
List<String> lore = new ArrayList<String>();

Loading…
Cancel
Save