Artifact tiers are no longer tied to the "Luck of the Sea" enchantment
and have their own line to track tier now.
This commit is contained in:
parent
bcf29de763
commit
26a465adea
Binary file not shown.
@ -12,6 +12,7 @@ import org.bukkit.inventory.meta.ItemMeta;
|
|||||||
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItem;
|
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItem;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItemType;
|
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItemType;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
||||||
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
|
||||||
|
|
||||||
public class Artifact {
|
public class Artifact {
|
||||||
public static ItemStack createArtifactItem(ArtifactItem type) {
|
public static ItemStack createArtifactItem(ArtifactItem type) {
|
||||||
@ -133,6 +134,9 @@ public class Artifact {
|
|||||||
}
|
}
|
||||||
if (reprint_lore) {
|
if (reprint_lore) {
|
||||||
l.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Artifact Crafting Item");
|
l.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Artifact Crafting Item");
|
||||||
|
if (GenericFunctions.isEquip(item)) {
|
||||||
|
l.add(ChatColor.GOLD+""+ChatColor.BOLD+"T1 Artifact");
|
||||||
|
}
|
||||||
if (type==ArtifactItem.MALLEABLE_BASE) {
|
if (type==ArtifactItem.MALLEABLE_BASE) {
|
||||||
l.add(ChatColor.YELLOW+" Right-click to activate");
|
l.add(ChatColor.YELLOW+" Right-click to activate");
|
||||||
l.add(ChatColor.YELLOW+" this base.");
|
l.add(ChatColor.YELLOW+" this base.");
|
||||||
@ -172,11 +176,11 @@ public class Artifact {
|
|||||||
if (item.getItemMeta().hasLore()) {
|
if (item.getItemMeta().hasLore()) {
|
||||||
l = item.getItemMeta().getLore();
|
l = item.getItemMeta().getLore();
|
||||||
}
|
}
|
||||||
l.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+ChatColor.RESET+ChatColor.GOLD+" "+GenericFunctions.CapitalizeFirstLetters(ait.getItemName())+" Artifact");
|
l.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Artifact");
|
||||||
l.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Artifact Item");
|
l.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Artifact Item");
|
||||||
m.setLore(l);
|
m.setLore(l);
|
||||||
item.setItemMeta(m);
|
item.setItemMeta(m);
|
||||||
item.addUnsafeEnchantment(Enchantment.LUCK, tier);
|
//item.addUnsafeEnchantment(Enchantment.LUCK, tier);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
public static boolean isArtifact(ItemStack item) {
|
public static boolean isArtifact(ItemStack item) {
|
||||||
@ -185,7 +189,9 @@ public class Artifact {
|
|||||||
item.hasItemMeta() &&
|
item.hasItemMeta() &&
|
||||||
item.getItemMeta().hasLore() &&
|
item.getItemMeta().hasLore() &&
|
||||||
(GenericFunctions.searchfor(item.getItemMeta().getLore(),ChatColor.GOLD+""+ChatColor.ITALIC+"Artifact Crafting Item") ||
|
(GenericFunctions.searchfor(item.getItemMeta().getLore(),ChatColor.GOLD+""+ChatColor.ITALIC+"Artifact Crafting Item") ||
|
||||||
item.getItemMeta().getLore().contains(ChatColor.GOLD+""+ChatColor.ITALIC+"Artifact Item"))) {
|
item.getItemMeta().getLore().contains(ChatColor.GOLD+""+ChatColor.ITALIC+"Artifact Item") ||
|
||||||
|
(ItemUtils.LoreContainsSubstring(item, ChatColor.GOLD+""+ChatColor.BOLD+"T") &&
|
||||||
|
ItemUtils.LoreContainsSubstring(item, " Artifact")))) {
|
||||||
//This is an artifact.
|
//This is an artifact.
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -19,6 +19,7 @@ import net.md_5.bungee.api.chat.TextComponent;
|
|||||||
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility;
|
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItemType;
|
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItemType;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
||||||
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
|
||||||
|
|
||||||
public class AwakenedArtifact {
|
public class AwakenedArtifact {
|
||||||
int experience_points=0;
|
int experience_points=0;
|
||||||
@ -391,7 +392,10 @@ public class AwakenedArtifact {
|
|||||||
//AP is on line 7 (element 6)
|
//AP is on line 7 (element 6)
|
||||||
m.setLore(lore);
|
m.setLore(lore);
|
||||||
item.setItemMeta(m);
|
item.setItemMeta(m);
|
||||||
item.addUnsafeEnchantment(Enchantment.LUCK, tier);
|
//ItemUtils.addLoreLineUnderneathLineContainingSubstring(artifact, "Artifact Crafting Item", ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Artifact");
|
||||||
|
item=ItemUtils.ModifyLoreLineContainingSubstring(item, ChatColor.GOLD+""+ChatColor.BOLD+"T", ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Artifact");
|
||||||
|
//item.addUnsafeEnchantment(Enchantment.LUCK, tier);
|
||||||
|
item.removeEnchantment(Enchantment.LUCK);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,6 +62,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.MonsterType;
|
|||||||
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
|
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
|
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
||||||
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArtifactUtils;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.EntityUtils;
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.EntityUtils;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
|
||||||
import sig.plugin.TwosideKeeper.HolidayEvents.Christmas;
|
import sig.plugin.TwosideKeeper.HolidayEvents.Christmas;
|
||||||
@ -1755,9 +1756,9 @@ public class CustomDamage {
|
|||||||
if (it!=null) {
|
if (it!=null) {
|
||||||
if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, it) &&
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, it) &&
|
||||||
p.isOnGround() && p.getLocation().getY()>=0 && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=7) {
|
p.isOnGround() && p.getLocation().getY()>=0 && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=7) {
|
||||||
dodgechance+=0.01*it.getEnchantmentLevel(Enchantment.LUCK);
|
dodgechance+=0.01*ArtifactUtils.getArtifactTier(it);
|
||||||
}
|
}
|
||||||
dodgechance+=(ArtifactAbility.calculateValue(ArtifactAbility.DODGE, it.getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.DODGE, it))/100d);
|
dodgechance+=(ArtifactAbility.calculateValue(ArtifactAbility.DODGE, ArtifactUtils.getArtifactTier(it), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.DODGE, it))/100d);
|
||||||
|
|
||||||
/*ItemStack equip = p.getEquipment().getArmorContents()[i];
|
/*ItemStack equip = p.getEquipment().getArmorContents()[i];
|
||||||
if (GenericFunctions.isRanger(p) && equip!=null
|
if (GenericFunctions.isRanger(p) && equip!=null
|
||||||
@ -1789,7 +1790,7 @@ public class CustomDamage {
|
|||||||
|
|
||||||
if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, p.getEquipment().getItemInMainHand()) &&
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, p.getEquipment().getItemInMainHand()) &&
|
||||||
p.isOnGround() && p.getLocation().getY()>=0 && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=7) {
|
p.isOnGround() && p.getLocation().getY()>=0 && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=7) {
|
||||||
dodgechance+=0.01*p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK);
|
dodgechance+=0.01*ArtifactUtils.getArtifactTier(p.getEquipment().getItemInMainHand());
|
||||||
}
|
}
|
||||||
|
|
||||||
dodgechance+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p,ItemSet.PANROS,3,3)/100d;
|
dodgechance+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p,ItemSet.PANROS,3,3)/100d;
|
||||||
|
@ -19,6 +19,7 @@ import sig.plugin.TwosideKeeper.AwakenedArtifact;
|
|||||||
import sig.plugin.TwosideKeeper.CustomDamage;
|
import sig.plugin.TwosideKeeper.CustomDamage;
|
||||||
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
||||||
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArtifactUtils;
|
||||||
|
|
||||||
public enum ArtifactAbility {
|
public enum ArtifactAbility {
|
||||||
//Enum Structure:
|
//Enum Structure:
|
||||||
@ -515,9 +516,9 @@ public enum ArtifactAbility {
|
|||||||
}
|
}
|
||||||
String displaystring = "";
|
String displaystring = "";
|
||||||
if (enchantlevel>0) {
|
if (enchantlevel>0) {
|
||||||
displaystring = displayDescriptionUpgrade(ability,targetitem.getEnchantmentLevel(Enchantment.LUCK),enchantlevel,enchantlevel+1,playerdmgval);
|
displaystring = displayDescriptionUpgrade(ability,ArtifactUtils.getArtifactTier(targetitem),enchantlevel,enchantlevel+1,playerdmgval);
|
||||||
} else {
|
} else {
|
||||||
displaystring = displayDescription(ability,targetitem.getEnchantmentLevel(Enchantment.LUCK),enchantlevel+1,playerdmgval);
|
displaystring = displayDescription(ability,ArtifactUtils.getArtifactTier(targetitem),enchantlevel+1,playerdmgval);
|
||||||
}
|
}
|
||||||
TextComponent tc = new TextComponent(((unlocked)?ChatColor.GREEN:ChatColor.RED)+"["+ability.GetName()+" "+(enchantlevel+1)+"] ");
|
TextComponent tc = new TextComponent(((unlocked)?ChatColor.GREEN:ChatColor.RED)+"["+ability.GetName()+" "+(enchantlevel+1)+"] ");
|
||||||
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder(WordUtils.wrap(ChatColor.BLUE+ability.GetName()+"\n\n"+displaystring+((lockedreason.equalsIgnoreCase(""))?"":"\n\n"),LINE_SIZE,"\n",true)+WordUtils.wrap(lockedreason,LINE_SIZE,"\n"+net.md_5.bungee.api.ChatColor.GRAY,true)).create()));
|
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder(WordUtils.wrap(ChatColor.BLUE+ability.GetName()+"\n\n"+displaystring+((lockedreason.equalsIgnoreCase(""))?"":"\n\n"),LINE_SIZE,"\n",true)+WordUtils.wrap(lockedreason,LINE_SIZE,"\n"+net.md_5.bungee.api.ChatColor.GRAY,true)).create()));
|
||||||
|
@ -491,6 +491,7 @@ public enum ArtifactItemType {
|
|||||||
ouritem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 1);
|
ouritem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 1);
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 1);
|
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 1);
|
||||||
if (upgrade==UpgradePath.FISHING_ROD) {
|
if (upgrade==UpgradePath.FISHING_ROD) {
|
||||||
|
ouritem.addUnsafeEnchantment(Enchantment.LUCK, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (upgrade==UpgradePath.ARMOR) {
|
if (upgrade==UpgradePath.ARMOR) {
|
||||||
@ -518,6 +519,7 @@ public enum ArtifactItemType {
|
|||||||
ouritem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 2);
|
ouritem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 2);
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 2);
|
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 2);
|
||||||
if (upgrade==UpgradePath.FISHING_ROD) {
|
if (upgrade==UpgradePath.FISHING_ROD) {
|
||||||
|
ouritem.addUnsafeEnchantment(Enchantment.LUCK, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (upgrade==UpgradePath.ARMOR) {
|
if (upgrade==UpgradePath.ARMOR) {
|
||||||
@ -547,6 +549,7 @@ public enum ArtifactItemType {
|
|||||||
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 3);
|
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 3);
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 1);
|
ouritem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 1);
|
||||||
if (upgrade==UpgradePath.FISHING_ROD) {
|
if (upgrade==UpgradePath.FISHING_ROD) {
|
||||||
|
ouritem.addUnsafeEnchantment(Enchantment.LUCK, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (upgrade==UpgradePath.ARMOR) {
|
if (upgrade==UpgradePath.ARMOR) {
|
||||||
@ -580,6 +583,7 @@ public enum ArtifactItemType {
|
|||||||
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 4);
|
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 4);
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 1);
|
ouritem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 1);
|
||||||
if (upgrade==UpgradePath.FISHING_ROD) {
|
if (upgrade==UpgradePath.FISHING_ROD) {
|
||||||
|
ouritem.addUnsafeEnchantment(Enchantment.LUCK, 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (upgrade==UpgradePath.ARMOR) {
|
if (upgrade==UpgradePath.ARMOR) {
|
||||||
@ -614,6 +618,7 @@ public enum ArtifactItemType {
|
|||||||
ouritem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 2);
|
ouritem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 2);
|
||||||
if (upgrade==UpgradePath.FISHING_ROD) {
|
if (upgrade==UpgradePath.FISHING_ROD) {
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.LURE, 1);
|
ouritem.addUnsafeEnchantment(Enchantment.LURE, 1);
|
||||||
|
ouritem.addUnsafeEnchantment(Enchantment.LUCK, 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (upgrade==UpgradePath.ARMOR) {
|
if (upgrade==UpgradePath.ARMOR) {
|
||||||
@ -648,6 +653,7 @@ public enum ArtifactItemType {
|
|||||||
ouritem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 3);
|
ouritem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 3);
|
||||||
if (upgrade==UpgradePath.FISHING_ROD) {
|
if (upgrade==UpgradePath.FISHING_ROD) {
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.LURE, 2);
|
ouritem.addUnsafeEnchantment(Enchantment.LURE, 2);
|
||||||
|
ouritem.addUnsafeEnchantment(Enchantment.LUCK, 5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (upgrade==UpgradePath.ARMOR) {
|
if (upgrade==UpgradePath.ARMOR) {
|
||||||
@ -683,6 +689,7 @@ public enum ArtifactItemType {
|
|||||||
ouritem.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1);
|
ouritem.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1);
|
||||||
if (upgrade==UpgradePath.FISHING_ROD) {
|
if (upgrade==UpgradePath.FISHING_ROD) {
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.LURE, 3);
|
ouritem.addUnsafeEnchantment(Enchantment.LURE, 3);
|
||||||
|
ouritem.addUnsafeEnchantment(Enchantment.LUCK, 6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (upgrade==UpgradePath.ARMOR) {
|
if (upgrade==UpgradePath.ARMOR) {
|
||||||
@ -721,6 +728,7 @@ public enum ArtifactItemType {
|
|||||||
ouritem.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1);
|
ouritem.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1);
|
||||||
if (upgrade==UpgradePath.FISHING_ROD) {
|
if (upgrade==UpgradePath.FISHING_ROD) {
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.LURE, 4);
|
ouritem.addUnsafeEnchantment(Enchantment.LURE, 4);
|
||||||
|
ouritem.addUnsafeEnchantment(Enchantment.LUCK, 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (upgrade==UpgradePath.ARMOR) {
|
if (upgrade==UpgradePath.ARMOR) {
|
||||||
@ -758,6 +766,7 @@ public enum ArtifactItemType {
|
|||||||
ouritem.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1);
|
ouritem.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1);
|
||||||
if (upgrade==UpgradePath.FISHING_ROD) {
|
if (upgrade==UpgradePath.FISHING_ROD) {
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.LURE, 5);
|
ouritem.addUnsafeEnchantment(Enchantment.LURE, 5);
|
||||||
|
ouritem.addUnsafeEnchantment(Enchantment.LUCK, 9);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (upgrade==UpgradePath.ARMOR) {
|
if (upgrade==UpgradePath.ARMOR) {
|
||||||
@ -796,6 +805,7 @@ public enum ArtifactItemType {
|
|||||||
ouritem.addUnsafeEnchantment(Enchantment.KNOCKBACK, 2);
|
ouritem.addUnsafeEnchantment(Enchantment.KNOCKBACK, 2);
|
||||||
if (upgrade==UpgradePath.FISHING_ROD) {
|
if (upgrade==UpgradePath.FISHING_ROD) {
|
||||||
ouritem.addUnsafeEnchantment(Enchantment.LURE, 6);
|
ouritem.addUnsafeEnchantment(Enchantment.LURE, 6);
|
||||||
|
ouritem.addUnsafeEnchantment(Enchantment.LUCK, 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (upgrade==UpgradePath.ARMOR) {
|
if (upgrade==UpgradePath.ARMOR) {
|
||||||
|
@ -83,6 +83,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.ItemSet;
|
|||||||
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
|
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
|
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArrayUtils;
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArrayUtils;
|
||||||
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArtifactUtils;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
|
||||||
|
|
||||||
@ -2088,8 +2089,7 @@ public class GenericFunctions {
|
|||||||
}
|
}
|
||||||
public static boolean isArtifactEquip(ItemStack item) {
|
public static boolean isArtifactEquip(ItemStack item) {
|
||||||
if (Artifact.isArtifact(item) &&
|
if (Artifact.isArtifact(item) &&
|
||||||
isEquip(item) &&
|
isEquip(item)) {
|
||||||
item.containsEnchantment(Enchantment.LUCK)) {
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -2701,7 +2701,7 @@ public class GenericFunctions {
|
|||||||
for (int i=0;i<9;i++) {
|
for (int i=0;i<9;i++) {
|
||||||
if (ArtifactAbility.containsEnchantment(ArtifactAbility.AUTOREPAIR, p.getInventory().getItem(i))) {
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.AUTOREPAIR, p.getInventory().getItem(i))) {
|
||||||
//Chance to auto repair.
|
//Chance to auto repair.
|
||||||
double repairamt = ArtifactAbility.calculateValue(ArtifactAbility.AUTOREPAIR, p.getInventory().getItem(i).getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.AUTOREPAIR, p.getInventory().getItem(i)));
|
double repairamt = ArtifactAbility.calculateValue(ArtifactAbility.AUTOREPAIR, ArtifactUtils.getArtifactTier(p.getInventory().getItem(i)), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.AUTOREPAIR, p.getInventory().getItem(i)));
|
||||||
if (Math.random() <= repairamt%1) {
|
if (Math.random() <= repairamt%1) {
|
||||||
repairamt++;
|
repairamt++;
|
||||||
}
|
}
|
||||||
@ -2727,7 +2727,7 @@ public class GenericFunctions {
|
|||||||
ItemStack equip = contents[i];
|
ItemStack equip = contents[i];
|
||||||
if (ArtifactAbility.containsEnchantment(ArtifactAbility.AUTOREPAIR, equip)) {
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.AUTOREPAIR, equip)) {
|
||||||
//Chance to auto repair.
|
//Chance to auto repair.
|
||||||
double repairamt = ArtifactAbility.calculateValue(ArtifactAbility.AUTOREPAIR, equip.getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.AUTOREPAIR, equip));
|
double repairamt = ArtifactAbility.calculateValue(ArtifactAbility.AUTOREPAIR, ArtifactUtils.getArtifactTier(equip), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.AUTOREPAIR, equip));
|
||||||
if (Math.random() <= repairamt%1) {
|
if (Math.random() <= repairamt%1) {
|
||||||
repairamt++;
|
repairamt++;
|
||||||
}
|
}
|
||||||
@ -2758,7 +2758,7 @@ public class GenericFunctions {
|
|||||||
if (isArtifactEquip(item) &&
|
if (isArtifactEquip(item) &&
|
||||||
ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, item)) {
|
ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, item)) {
|
||||||
TwosideKeeper.log("Found one.",5);
|
TwosideKeeper.log("Found one.",5);
|
||||||
int tier = item.getEnchantmentLevel(Enchantment.LUCK);
|
int tier = ArtifactUtils.getArtifactTier(item);
|
||||||
if (Math.random()<=(8-(tier/2d))/100d) {
|
if (Math.random()<=(8-(tier/2d))/100d) {
|
||||||
item = ArtifactAbility.downgradeEnchantment(p, item, ArtifactAbility.GREED);
|
item = ArtifactAbility.downgradeEnchantment(p, item, ArtifactAbility.GREED);
|
||||||
p.sendMessage(ChatColor.DARK_AQUA+"A level of "+ChatColor.YELLOW+"Greed"+ChatColor.DARK_AQUA+" has been knocked off of your "+((item.hasItemMeta() && item.getItemMeta().hasDisplayName())?item.getItemMeta().getDisplayName():UserFriendlyMaterialName(item)));
|
p.sendMessage(ChatColor.DARK_AQUA+"A level of "+ChatColor.YELLOW+"Greed"+ChatColor.DARK_AQUA+" has been knocked off of your "+((item.hasItemMeta() && item.getItemMeta().hasDisplayName())?item.getItemMeta().getDisplayName():UserFriendlyMaterialName(item)));
|
||||||
@ -2775,7 +2775,7 @@ public class GenericFunctions {
|
|||||||
ItemStack item = p.getEquipment().getItemInMainHand();
|
ItemStack item = p.getEquipment().getItemInMainHand();
|
||||||
if (isArtifactEquip(item) &&
|
if (isArtifactEquip(item) &&
|
||||||
ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, item)) {
|
ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, item)) {
|
||||||
int tier = item.getEnchantmentLevel(Enchantment.LUCK);
|
int tier = ArtifactUtils.getArtifactTier(item);
|
||||||
//TwosideKeeper.log("Chance is "+((8-(tier/2d))/100d), 0);
|
//TwosideKeeper.log("Chance is "+((8-(tier/2d))/100d), 0);
|
||||||
if (Math.random()<=(8-(tier/2d))/100d) {
|
if (Math.random()<=(8-(tier/2d))/100d) {
|
||||||
item = ArtifactAbility.downgradeEnchantment(p, item, ArtifactAbility.GREED);
|
item = ArtifactAbility.downgradeEnchantment(p, item, ArtifactAbility.GREED);
|
||||||
@ -2949,7 +2949,7 @@ public class GenericFunctions {
|
|||||||
|
|
||||||
public static double getAbilityValue(ArtifactAbility ab, ItemStack weapon) {
|
public static double getAbilityValue(ArtifactAbility ab, ItemStack weapon) {
|
||||||
if (isArtifactEquip(weapon)) {
|
if (isArtifactEquip(weapon)) {
|
||||||
return ArtifactAbility.calculateValue(ab, weapon.getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ab, weapon));
|
return ArtifactAbility.calculateValue(ab, ArtifactUtils.getArtifactTier(weapon), ArtifactAbility.getEnchantmentLevel(ab, weapon));
|
||||||
} else {
|
} else {
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
@ -3264,9 +3264,30 @@ public class GenericFunctions {
|
|||||||
UpdateUpgradeShard(item);
|
UpdateUpgradeShard(item);
|
||||||
UpdateOldQuivers(item);
|
UpdateOldQuivers(item);
|
||||||
UpdateItemCubeContentsList(item);
|
UpdateItemCubeContentsList(item);
|
||||||
|
UpdateArtifactTier(item);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void UpdateArtifactTier(ItemStack item) {
|
||||||
|
if (GenericFunctions.isOldArtifactEquip(item)) {
|
||||||
|
//Remove the Luck of the Sea enchantment.
|
||||||
|
int oldtier = item.getEnchantmentLevel(Enchantment.LUCK);
|
||||||
|
item.removeEnchantment(Enchantment.LUCK);
|
||||||
|
item=ItemUtils.addLoreLineUnderneathLineContainingSubstring(item, "Artifact Crafting Item", ChatColor.GOLD+""+ChatColor.BOLD+"T"+oldtier+" Artifact");
|
||||||
|
TwosideKeeper.log("Converted an old artifact to "+item.toString(), 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isOldArtifactEquip(ItemStack item) {
|
||||||
|
if (Artifact.isArtifact(item) &&
|
||||||
|
isEquip(item) &&
|
||||||
|
item.containsEnchantment(Enchantment.LUCK)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//TODO Item Cube Contents list.
|
//TODO Item Cube Contents list.
|
||||||
private static void UpdateItemCubeContentsList(ItemStack item) {
|
private static void UpdateItemCubeContentsList(ItemStack item) {
|
||||||
/*if (ItemUtils.isValidLoreItem(item) &&
|
/*if (ItemUtils.isValidLoreItem(item) &&
|
||||||
@ -3324,12 +3345,10 @@ public class GenericFunctions {
|
|||||||
Set<Enchantment> map = item.getEnchantments().keySet();
|
Set<Enchantment> map = item.getEnchantments().keySet();
|
||||||
ItemMeta m = item.getItemMeta();
|
ItemMeta m = item.getItemMeta();
|
||||||
List<String> lore = m.getLore();
|
List<String> lore = m.getLore();
|
||||||
int artifact_lv = item.getEnchantmentLevel(Enchantment.LUCK);
|
int artifact_lv = ArtifactUtils.getArtifactTier(item);
|
||||||
for (Enchantment e : map) {
|
for (Enchantment e : map) {
|
||||||
int lv = item.getEnchantments().get(e);
|
int lv = item.getEnchantments().get(e);
|
||||||
if (!e.getName().equalsIgnoreCase("luck")) {
|
lore.add(0," "+ChatColor.BLACK+ChatColor.WHITE+ChatColor.GRAY+WorldShop.getRealName(e)+" "+WorldShop.toRomanNumeral(lv));
|
||||||
lore.add(0," "+ChatColor.BLACK+ChatColor.WHITE+ChatColor.GRAY+WorldShop.getRealName(e)+" "+WorldShop.toRomanNumeral(lv));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
lore.add(0,ChatColor.GOLD+""+ChatColor.BLACK+ChatColor.GOLD+"Tier "+artifact_lv+ChatColor.RESET+ChatColor.GOLD+" "+GenericFunctions.UserFriendlyMaterialName(item.getType())+" Artifact");
|
lore.add(0,ChatColor.GOLD+""+ChatColor.BLACK+ChatColor.GOLD+"Tier "+artifact_lv+ChatColor.RESET+ChatColor.GOLD+" "+GenericFunctions.UserFriendlyMaterialName(item.getType())+" Artifact");
|
||||||
m.setLore(lore);
|
m.setLore(lore);
|
||||||
|
@ -104,6 +104,7 @@ public enum ItemSet {
|
|||||||
|
|
||||||
public static ItemSet GetSet(ItemStack item) {
|
public static ItemSet GetSet(ItemStack item) {
|
||||||
if ((GenericFunctions.isEquip(item) || GenericFunctions.isSkullItem(item)) &&
|
if ((GenericFunctions.isEquip(item) || GenericFunctions.isSkullItem(item)) &&
|
||||||
|
!GenericFunctions.isArtifactEquip(item) &&
|
||||||
item.getItemMeta().hasLore()) {
|
item.getItemMeta().hasLore()) {
|
||||||
List<String> lore = item.getItemMeta().getLore();
|
List<String> lore = item.getItemMeta().getLore();
|
||||||
for (int i=0;i<lore.size();i++) {
|
for (int i=0;i<lore.size();i++) {
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
package sig.plugin.TwosideKeeper.HelperStructures.Utils;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||||
|
|
||||||
|
public class ArtifactUtils {
|
||||||
|
public static int getArtifactTier(ItemStack item) {
|
||||||
|
String str = ChatColor.stripColor(ItemUtils.GetLoreLineContainingSubstring(item, ChatColor.GOLD+""+ChatColor.BOLD+"T"));
|
||||||
|
TwosideKeeper.log("String is "+str+". Parse 1 is "+str.replace("T", "")+". Parse 2 is "+str.replace("T", "").split(" ")[0], 5);
|
||||||
|
return Integer.parseInt(str.replace("T", "").split(" ")[0]);
|
||||||
|
}
|
||||||
|
public static ItemStack setArtifactTier(ItemStack item, int tier) {
|
||||||
|
item=ItemUtils.ModifyLoreLineContainingSubstring(item, ChatColor.GOLD+""+ChatColor.BOLD+"T", ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Artifact");
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
public static ItemStack addArtifactTier(ItemStack item, int incr) {
|
||||||
|
item=setArtifactTier(item,getArtifactTier(item)+incr);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
}
|
@ -109,6 +109,42 @@ public class ItemUtils {
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ItemStack addLoreLineUnderneathLineContainingSubstring(ItemStack item, String string, String newline) {
|
||||||
|
if (isValidLoreItem(item)) {
|
||||||
|
ItemMeta meta = item.getItemMeta();
|
||||||
|
List<String> lore = meta.getLore();
|
||||||
|
for (int i=0;i<lore.size();i++) {
|
||||||
|
if (lore.get(i).contains(string)) {
|
||||||
|
lore.add(i+1, newline);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
meta.setLore(lore);
|
||||||
|
item.setItemMeta(meta);
|
||||||
|
}
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStack DeleteAllLoreLinesAtAndAfterLineContainingSubstring(ItemStack item, String string) {
|
||||||
|
if (isValidLoreItem(item)) {
|
||||||
|
ItemMeta meta = item.getItemMeta();
|
||||||
|
List<String> lore = meta.getLore();
|
||||||
|
boolean delete=false;
|
||||||
|
for (int i=0;i<lore.size();i++) {
|
||||||
|
if (lore.get(i).contains(string)) {
|
||||||
|
delete=true;
|
||||||
|
}
|
||||||
|
if (delete) {
|
||||||
|
lore.remove(i);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
meta.setLore(lore);
|
||||||
|
item.setItemMeta(meta);
|
||||||
|
}
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
public static String GetLoreLine(ItemStack item, int line_numb) {
|
public static String GetLoreLine(ItemStack item, int line_numb) {
|
||||||
if (isValidLoreItem(item)) {
|
if (isValidLoreItem(item)) {
|
||||||
List<String> lore = item.getItemMeta().getLore();
|
List<String> lore = item.getItemMeta().getLore();
|
||||||
|
@ -57,6 +57,7 @@ import sig.plugin.TwosideKeeper.Artifact;
|
|||||||
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||||
import sig.plugin.TwosideKeeper.WorldShopManager;
|
import sig.plugin.TwosideKeeper.WorldShopManager;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
||||||
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArtifactUtils;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.BlockUtils;
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.BlockUtils;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
|
||||||
|
|
||||||
@ -260,7 +261,7 @@ public class WorldShop {
|
|||||||
if (GenericFunctions.isArtifactEquip(item) && !GenericFunctions.isArtifactArmor(item) /*Artifact armor already has this info displayed.*/) {
|
if (GenericFunctions.isArtifactEquip(item) && !GenericFunctions.isArtifactArmor(item) /*Artifact armor already has this info displayed.*/) {
|
||||||
if (item.hasItemMeta() &&
|
if (item.hasItemMeta() &&
|
||||||
item.getItemMeta().hasDisplayName()) {
|
item.getItemMeta().hasDisplayName()) {
|
||||||
message+="\n"+ChatColor.GOLD+ChatColor.BOLD+"T"+item.getEnchantmentLevel(Enchantment.LUCK)+ChatColor.RESET+ChatColor.GOLD+" "+GenericFunctions.UserFriendlyMaterialName(item.getType())+" Artifact \n";
|
message+="\n"+ChatColor.GOLD+ChatColor.BOLD+"T"+ArtifactUtils.getArtifactTier(item)+ChatColor.RESET+ChatColor.GOLD+" "+GenericFunctions.UserFriendlyMaterialName(item.getType())+" Artifact \n";
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (!GenericFunctions.isArtifactArmor(item) && item.hasItemMeta() &&
|
if (!GenericFunctions.isArtifactArmor(item) && item.hasItemMeta() &&
|
||||||
|
@ -230,6 +230,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.Effects.LavaPlume;
|
|||||||
import sig.plugin.TwosideKeeper.HelperStructures.Effects.TemporaryIce;
|
import sig.plugin.TwosideKeeper.HelperStructures.Effects.TemporaryIce;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Effects.TemporaryLava;
|
import sig.plugin.TwosideKeeper.HelperStructures.Effects.TemporaryLava;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArrayUtils;
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArrayUtils;
|
||||||
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArtifactUtils;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.BlockUtils;
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.BlockUtils;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.EntityUtils;
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.EntityUtils;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.InventoryUtils;
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.InventoryUtils;
|
||||||
@ -1248,7 +1249,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
p.getEquipment().setItemInMainHand(MalleableBaseQuest.setTimeStarted(p.getEquipment().getItemInMainHand(), getServerTickTime()));
|
p.getEquipment().setItemInMainHand(MalleableBaseQuest.setTimeStarted(p.getEquipment().getItemInMainHand(), getServerTickTime()));
|
||||||
}
|
}
|
||||||
if (GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand()) &&
|
if (GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand()) &&
|
||||||
p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK)<=3) {
|
ArtifactUtils.getArtifactTier(p.getEquipment().getItemInMainHand())<=3) {
|
||||||
//Change the tool to Stone. If possible.
|
//Change the tool to Stone. If possible.
|
||||||
if (p.getEquipment().getItemInMainHand().getType().toString().contains("SWORD")) {
|
if (p.getEquipment().getItemInMainHand().getType().toString().contains("SWORD")) {
|
||||||
p.getEquipment().getItemInMainHand().setType(Material.STONE_SWORD);
|
p.getEquipment().getItemInMainHand().setType(Material.STONE_SWORD);
|
||||||
@ -8267,7 +8268,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
|
|
||||||
if (GenericFunctions.isEquip(ev.getInventory().getItem(i))) {
|
if (GenericFunctions.isEquip(ev.getInventory().getItem(i))) {
|
||||||
artifact_item = ev.getInventory().getItem(i);
|
artifact_item = ev.getInventory().getItem(i);
|
||||||
artifact_tier = ev.getInventory().getItem(i).getEnchantmentLevel(Enchantment.LUCK);
|
artifact_tier = ArtifactUtils.getArtifactTier(ev.getInventory().getItem(i));
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (ev.getInventory().getItem(i)!=null &&
|
if (ev.getInventory().getItem(i)!=null &&
|
||||||
@ -8327,7 +8328,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
log("Applied "+e.getName()+" "+artifact_item.getEnchantmentLevel(e)+" to the artifact",2);
|
log("Applied "+e.getName()+" "+artifact_item.getEnchantmentLevel(e)+" to the artifact",2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
newartifact=ItemUtils.ModifyLoreLineContainingSubstring(newartifact, ChatColor.GOLD+""+ChatColor.BOLD+"T", ChatColor.GOLD+""+ChatColor.BOLD+"T"+(tier_found+1)+" Artifact");
|
||||||
newartifact.setDurability((short)(newartifact.getType().getMaxDurability()*(artifact_item.getDurability()/artifact_item.getType().getMaxDurability())));
|
newartifact.setDurability((short)(newartifact.getType().getMaxDurability()*(artifact_item.getDurability()/artifact_item.getType().getMaxDurability())));
|
||||||
ev.getInventory().setResult(newartifact);
|
ev.getInventory().setResult(newartifact);
|
||||||
}
|
}
|
||||||
@ -9533,7 +9534,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
ArtifactAbility ab = (ArtifactAbility)enchants.keySet().toArray()[i];
|
ArtifactAbility ab = (ArtifactAbility)enchants.keySet().toArray()[i];
|
||||||
//p.sendMessage(ChatColor.BLUE+ab.GetName()+" "+(int)enchants.values().toArray()[i]);
|
//p.sendMessage(ChatColor.BLUE+ab.GetName()+" "+(int)enchants.values().toArray()[i]);
|
||||||
TextComponent tc1 = new TextComponent(ChatColor.GREEN+"["+ab.GetName()+" "+(int)enchants.values().toArray()[i]+"] ");
|
TextComponent tc1 = new TextComponent(ChatColor.GREEN+"["+ab.GetName()+" "+(int)enchants.values().toArray()[i]+"] ");
|
||||||
tc1.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder(WordUtils.wrap(ArtifactAbility.displayDescription(ab, item.getEnchantmentLevel(Enchantment.LUCK), (int)enchants.values().toArray()[i], CustomDamage.getBaseWeaponDamage(item, p, null)),ArtifactAbility.LINE_SIZE,"\n",true)).create()));
|
tc1.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder(WordUtils.wrap(ArtifactAbility.displayDescription(ab, ArtifactUtils.getArtifactTier(item), (int)enchants.values().toArray()[i], CustomDamage.getBaseWeaponDamage(item, p, null)),ArtifactAbility.LINE_SIZE,"\n",true)).create()));
|
||||||
j++;
|
j++;
|
||||||
if (j>=4 && i!=enchants.size()-1) {
|
if (j>=4 && i!=enchants.size()-1) {
|
||||||
tc1.addExtra("\n");
|
tc1.addExtra("\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user