Basic Artifact leveling up and enchanting implementation in.

This commit is contained in:
sigonasr2 2016-07-10 02:21:14 -05:00
parent 6cc89d3426
commit 727030e2cd
11 changed files with 711 additions and 164 deletions

View File

@ -1,6 +1,6 @@
name: TwosideKeeper
main: sig.plugin.TwosideKeeper.TwosideKeeper
version: 3.4.7e
version: 3.5.0
commands:
money:
description: Tells the player the amount of money they are holding.
@ -76,4 +76,9 @@ commands:
description: Display statistics for damage and defense.
usage: /stats [username]
permission: TwosideKeeper.money
permission-message: No permissions!
awakenedartifact:
description: Used for upgrading awakened artifacts.
usage: /awakenedartifact
permission: TwosideKeeper.money
permission-message: No permissions!

View File

@ -126,6 +126,7 @@ public class Artifact {
}
public static ItemStack convert(ItemStack item, ArtifactItem type, boolean reprint_lore) {
//Converts an item to an artifact.
item = item.clone();
ItemMeta m = item.getItemMeta();
List<String> l = new ArrayList<String>();
if (item.getItemMeta().hasLore()) {
@ -272,6 +273,9 @@ public class Artifact {
} else
if (type.toString().contains("BOOTS")) {
return "BOOTS";
} else
if (type.toString().contains("ROD")) {
return "FISHING ROD";
} else {
return "";
}

View File

@ -2,6 +2,7 @@ package sig.plugin.TwosideKeeper;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.bukkit.ChatColor;
@ -11,15 +12,21 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import net.md_5.bungee.api.chat.ClickEvent;
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.HelperStructures.ArtifactAbility;
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItemType;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public class AwakenedArtifact {
int experience_points=0;
public static HashMap<ArtifactAbility,String> ability_map = new HashMap();
public static HashMap<String,ArtifactAbility> name_map = new HashMap();
private static String drawEXPMeter(int exp) {
String bar ="";
for (int i=0;i<exp/100;i++) {
for (int i=0;i<(exp/100)%1000;i++) {
bar+=Character.toString((char)0x2588);
}
if (exp%100>=50) {
@ -67,13 +74,24 @@ public class AwakenedArtifact {
int totalval = getEXP(artifact)+amt;
if (totalval>1000) {
//LEVEL UP!
ItemStack item = addLV(artifact,totalval/1000, p);
item = setEXP(item,totalval%1000);
item = addAP(item,1);
p.sendMessage("Your "+artifact.getItemMeta().getDisplayName()+ChatColor.RESET+" has upgraded to "+ChatColor.YELLOW+"Level "+getLV(artifact)+"!");
p.sendMessage("You have "+getAP(item)+" Ability Points to spend!");
p.spigot().sendMessage(new TextComponent("Test"));
return item;
if (getLV(artifact)<999) {
ItemStack item = addLV(artifact,totalval/1000, p);
item = setEXP(item,totalval%1000);
item = addAP(item,1);
p.sendMessage("Your "+artifact.getItemMeta().getDisplayName()+ChatColor.RESET+" has upgraded to "+ChatColor.YELLOW+"Level "+getLV(artifact)+"!");
p.sendMessage("You have "+getAP(item)+" Ability Point"+((getAP(item)==1)?"":"s")+" to spend!");
TextComponent tc = new TextComponent("Click ");
TextComponent ac = new TextComponent(ChatColor.GREEN+"[HERE]"+ChatColor.WHITE);
ac.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder(ChatColor.ITALIC+"Click to add another skill point!").create()));
ac.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/awakenedartifact"));
tc.addExtra(ac);
tc.addExtra(" to open up the ability upgrade menu.");
p.spigot().sendMessage(tc);
return item;
} else {
return artifact;
}
} else {
return setEXP(artifact,totalval);
}
@ -150,19 +168,23 @@ public class AwakenedArtifact {
}
public static ItemStack addPotentialEXP(ItemStack artifact,int exp,Player p) {
//Adds experience, but only based on the potential of the item.
int missingdurability = artifact.getDurability();
if (missingdurability!=0) {
double mult = Math.min(10d/missingdurability, 1);
//Multiply the value. If it's less than 1, there is only a chance exp will be added.
double expadded = exp*mult;
if (expadded<1 &&
Math.random()<=expadded) {
return addEXP(artifact,1,p);
if (GenericFunctions.isArtifactEquip(artifact)) {
int missingdurability = artifact.getDurability();
if (missingdurability!=0) {
double mult = Math.min(10d/missingdurability, 1);
//Multiply the value. If it's less than 1, there is only a chance exp will be added.
double expadded = exp*mult;
if (expadded<1 &&
Math.random()<=expadded) {
return addEXP(artifact,1,p);
} else {
return addEXP(artifact,(int)expadded,p);
}
} else {
return addEXP(artifact,(int)expadded,p);
return addEXP(artifact,exp,p);
}
} else {
return addEXP(artifact,exp,p);
return artifact;
}
}
public static String drawPotential(ItemStack artifact) {
@ -191,7 +213,8 @@ public class AwakenedArtifact {
}
public static ItemStack convertToAwakenedArtifact(ItemStack artifact, int tier, int dataval) {
ItemStack item = artifact.clone();
item = Artifact.convert(item,true);
TwosideKeeper.log("Trying to create data "+dataval, 5);
item = Artifact.convert(item,false);
GenericFunctions.addObscureHardenedItemBreaks(item, 5);
ItemMeta m = item.getItemMeta();
m.setDisplayName(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" "+GenericFunctions.CapitalizeFirstLetters(ArtifactItemType.getTypeFromData(dataval).getItemName())+" Artifact");
@ -205,7 +228,8 @@ public class AwakenedArtifact {
lore.add(ChatColor.BLUE+" (0/1000) "+"Potential: "+drawPotential(artifact));
df = new DecimalFormat("000");
lore.add(ChatColor.GRAY+"Level "+df.format(0));
lore.add(ChatColor.GOLD+"Ability Points: 0/0");
lore.add(ChatColor.GOLD+"Ability Points: 0/0");
//AP is on line 7 (element 6)
m.setLore(lore);
item.setItemMeta(m);
item.addUnsafeEnchantment(Enchantment.LUCK, tier);

View File

@ -1,8 +1,24 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.apache.commons.lang.WordUtils;
import org.bukkit.ChatColor;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import net.md_5.bungee.api.chat.ClickEvent;
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.AwakenedArtifact;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public enum ArtifactAbility {
//Enum Structure:
@ -10,59 +26,422 @@ public enum ArtifactAbility {
//Temporary abilities: Work for 1 level and wear off afterward.
//Weapon Abilities
DAMAGE("Strike","Improves Base Damage by [VAL]",1.0,1.0,100),
ARMOR_PEN("Piercing","[VAL]% of your damage is ignored by resistances. ([PENDMG] damage)",1.0,1.0,100,1),
EXECUTION("Execute","Deals [VAL] extra damage for every 20% of target's missing health.",2.0,1.0,100,1),
LIFESTEAL("Lifesteal","Heals [VAL]% of the damage dealt to targets back to your health pool.",1.0,1.0,100,1),
DAMAGE("Strike","Improves Base Damage by [VAL]",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1),
ARMOR_PEN("Piercing","[VAL]% of your damage is ignored by resistances. ([PENDMG] damage)",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1),
EXECUTION("Execute","Deals [VAL] extra damage for every 20% of target's missing health.",new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1),
LIFESTEAL("Lifesteal","Heals [VAL]% of the damage dealt to targets back to your health pool.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1),
CRITICAL("Critical","[VAL]% chance to deal double damage.",new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1),
CRIT_DMG("Crit Damage","Critical Strikes deal [VAL]% damage.",new double[]{210.0,210.0,210.0,210.0,210.0,210.0,210.0,210.0,210.0,210.0},
new double[]{5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0},100,1),
PROVOKE("Provoke","Your attacks provoke enemies for [VAL] seconds.",new double[]{3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,10),
HIGHWINDER("Highwinder","While moving, you deal [VAL] extra damage for every 1m of speed.",new double[]{0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5},
new double[]{0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7},100,15),
COMBO("Belligerent","[VAL]% more damage for each successive strike on a mob. Resets on a failed swing or after 5 seconds of no combat.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,30),
//Bow Abilities
MARKSMAN("Marksman","Increases headshot hitbox size by [VAL]% .",new double[]{8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0},
new double[]{0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8},100,1),
SIEGESTANCE("Siege Stance","Activate by Sneaking for three seconds. Sneak again to de-activate.\n\n"
+ "Applies Slowness V and Resistance VI. While in Siege Stance you fire clusters of 7 arrows per shot. Each arrow deals [VAL] damage.",new double[]{3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,20),
ARROWSHOWER("Arrow Shower","Shift-Left Click to activate. Applies Slowness X for three seconds while firing arrows into the sky and onto enemies in a large area in front of you. Each arrow deals [VAL] damage.",new double[]{0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7},
new double[]{0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4},100,40),
TARGETING("Targeting","Left-click a mob to target them. Fire arrows to release homing missiles at your target. Each missile explodes and deals [VAL] damage.",new double[]{10,10,10,10,10,10,10,10,10,10},
new double[]{0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3},100,75),
ENDERTURRET("Ender Turret","Place Eyes of Ender in your hotbar to use as ammo. Each eye fired launches forward and upward before releasing a barrage of homing missiles that lock onto enemy targets. Each missile explodes and deals [VAL] damage.",new double[]{25,25,25,25,25,25,25,25,25,25},
new double[]{0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5},100,100),
//Armor abilities
DAMAGE_REDUCTION("Defense","Increases Base Damage reduction by [VAL]%",1.0,2.0,100,1),
HEALTH("Health","Increases Maximum Health by [VAL].",1.0,1.0,100,1),
HEALTH_REGEN("Regeneration","Regenerates an extra [VAL] health every 5 seconds.",0.5,1.0,100,1),
STATUS_EFFECT_RESISTANCE("Resistance","When a debuff is applied",0.5,1.0,100,1),
SURVIVOR("Survivor","Taking fatal damage will not kill you and instead consume this ability, removes all debuffs, and leaving you with 1 HP.",-1,0,1,10),
DAMAGE_REDUCTION("Defense","Increases Base Damage reduction by [VAL]%",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0},100,1),
HEALTH("Health","Increases Maximum Health by [VAL].",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1),
HEALTH_REGEN("Regeneration","Regenerates an extra [VAL] health every 5 seconds.",new double[]{0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1),
STATUS_EFFECT_RESISTANCE("Resistance","When a debuff is applied, there is a [VAL]% chance to remove it.",new double[]{20,20,20,20,20,20,20,20,20,20},
new double[]{4.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0},100,1),
SHADOWWALKER("Shadow Walker","Increases your speed in dark areas. Damage Reduction increases by [VAL]% in dark areas. Dodge chance increases by [DODGEVAL]% in dark areas.",new double[]{5,5,5,5,5,5,5,5,5,5},
new double[]{1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5},100,5),
SURVIVOR("Survivor","Taking fatal damage will not kill you and instead consume this ability, removes all debuffs, and leaving you with 1 HP.",new double[]{-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0},
new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},1,10),
DODGE("Dodge","You have a [VAL]% chance to dodge incoming damage from any damage source.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new double[]{3,3,3,3,3,3,3,3,3,3},100,20),
GRACEFULDODGE("Graceful Dodge","You have a [VAL]% chance to dodge incoming damage from attacks that deal [FATALDMG] or more damage.",new double[]{10,10,10,10,10,10,10,10,10,10},
new double[]{0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8},100,45),
//Pickaxe abilities
SCAVENGE("Scavenge","Breaks off resources from armor. [VAL]% chance per hit.",new double[]{5,5,5,5,5,5,5,5,5,5},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,20),
//Shovel abilities
SUPPRESS("Suppression","Suppresses a mob on hit for [VAL] seconds.\n\n"
+ "Suppression prevents movement, attacking, and teleportation.",new double[]{0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,10),
//Axe abilities
BREAKDOWN("Break Down","Breaks down armor on mobs. Each hit has a [VAL]% chance to remove a piece of armor from a mob.",new double[]{3,3,3,3,3,3,3,3,3,3},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1),
BUTCHERY("Butchery","Broken down armor have a [VAL]% chance to drop onto the ground.",new double[]{10,10,10,10,10,10,10,10,10,10},
new double[]{0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8},100,5),
//Scythe abilities
DEATHMARK("Death Mark","Applies a Death Mark stack to a target. Death marks last for 5 seconds, and refresh on each hit.\n\nMarks can be detonated at any time by right-clicking. Each death mark stack applied deals [VAL] damage.",new double[]{0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1},
new double[]{0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6},100,10),
AOE("Area of Effect","Deals damage to targets up to [VAL]m from the main target hit.",new double[]{0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1),
//General abilities
GREED("Greed","Increases Drop rate by [VAL]% . Health is halved, health regeneration is halved, and damage reduction is halved. Consumes one level of Greed per level up.",new double[]{50,50,50,50,50,50,50,50,50,50},
new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0},100,10),
GROWTH("Growth","Increases artifact EXP gained by [VAL]% . Health is halved, health regeneration is halved, and damage reduction is halved. Consumes one level of Growth per level up.",new double[]{100,100,100,100,100,100,100,100,100,100},
new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0},100,10),
REMOVE_CURSE("Remove Curse","Removes a level of a curse from the Artifact.",new double[]{-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0},
new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},1,1),
PRESERVATION("Preservation","Potential decays [VAL]% slower.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},1,20),
EXP_MULT("Mega XP","Increases experience dropped from monsters by [VAL]% .",new double[]{5,5,5,5,5,5,5,5,5,5},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,20),
//Bad stuff
REDUCEDMG("Weakness","[VAL]% Decrease in Base Damage.",new double[]{8,8,8,8,8,8,8,8,8,8},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,3),
REDUCEDEF("Imperil","[VAL]% Decrease in Damage Reduction",new double[]{8,8,8,8,8,8,8,8,8,8},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,5),
LIFE_REDUCTION("Health Cut","[VAL]% decrease in maximum health.",new double[]{30,30,30,30,30,30,30,30,30,30},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,5),
LOWER_DEFENSE("Debilitate","[VAL]% decrease in damage reduction.",new double[]{30,30,30,30,30,30,30,30,30,30},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,5),
TELEPORT("Teleport","[VAL]% chance to teleport the player to a random location on artifact experience gain.",new double[]{3,3,3,3,3,3,3,3,3,3},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,10),
DRAINING("Draining","[VAL]% chance to remove a level of experience on artifact experience gain.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,10),
NOREGEN("Weary","No health regenerates.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,15),
STARVATION("Starvation","[VAL]% chance to cause [HUNGERVAL] seconds of Hunger on experience gain.",new double[]{5,5,5,5,5,5,5,5,5,5},
new double[]{0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1},100,15),
BURN("Flammable","All burn damage deals x[VAL] damage.",new double[]{4.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,25),
FROZEN("Frozen","Player will be inflicted with increasing levels of slowness and fatigue until finally frozen and killed.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},1,45),
PETRIFICATION("Petrification","Player will be inflicted with increasing levels of slowness and fatigue until finally petrified and killed.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},1,45),
;
static int LINE_SIZE=50;
String name;
String desc;
double baseval;
double decayval;
double[] baseval;
double[] decayval;
int maxlv;
int requirement;
ArtifactAbility(String name, String desc, double baseval, double decayval, int maxlv) {
ArtifactAbility(String name, String desc, double[] baseval, double[] decayval, int maxlv, int requirement) {
this.name=name;
this.desc=desc;
this.baseval=baseval;
this.decayval=decayval;
this.maxlv=maxlv;
this.requirement=requirement;
AwakenedArtifact.ability_map.put(this,this.name);
AwakenedArtifact.name_map.put(this.name,this);
}
public double calculateValue(int lv) {
public String GetName() {
return this.name;
}
public String GetDescription() {
return this.desc;
}
public double GetBaseValue(int tier) {
return this.baseval[tier-1];
}
public double GetDecayValue(int tier) {
return this.decayval[tier-1];
}
public int GetMaxLevel() {
return maxlv;
}
public int GetMinLevel() {
return requirement;
}
public static double calculateValue(ArtifactAbility ability, int artifacttier, int abilitylevel) {
double sum=0;
for(int i=0;i<lv;i++){
sum+=1/(1+this.decayval*i);
if (artifacttier<=0) {artifacttier=1;}
TwosideKeeper.log("Ability "+ability.GetName(), 4);
for(int i=0;i<abilitylevel;i++){
TwosideKeeper.log("Old Sum:"+sum+"::i:"+i, 5);
sum+=1/(1+(ability.GetDecayValue(artifacttier)*i));
TwosideKeeper.log("New Sum:"+sum+"::i:"+i, 5);
}
return sum*this.baseval;
TwosideKeeper.log("Sum is "+sum, 5);
TwosideKeeper.log("Base value is "+ability.GetBaseValue(artifacttier), 4);
return sum*ability.GetBaseValue(artifacttier);
}
public String displayDescription(int lv, double playerdmgval) { //Level to display information for.
String msg = this.desc;
static HashMap<ArtifactAbility,Integer> getEnchantments(ItemStack item) {
HashMap<ArtifactAbility,Integer> abilities = new HashMap<ArtifactAbility,Integer>();
if (GenericFunctions.isArtifactEquip(item)) {
List<String> lore = item.getItemMeta().getLore();
//From Element 7 and onwards, we know these are abilities added to the item. Retrieve them.
for (int i=7;i<lore.size();i++) {
String[] splitstring = lore.get(i).split(" ");
TwosideKeeper.log(splitstring.length+"",5);
String newstring = "";
TwosideKeeper.log(lore.get(i), 5);
for (int j=1;j<splitstring.length-1;j++) {
if (newstring.equalsIgnoreCase("")) {
newstring+=splitstring[j];
} else {
newstring+=" "+splitstring[j];
}
}
TwosideKeeper.log(newstring,5);
//This is the name of the enchantment. Now connect it with the name map we made.
abilities.put(AwakenedArtifact.name_map.get(ChatColor.stripColor(newstring)),Integer.parseInt(splitstring[splitstring.length-1]));
}
}
return abilities;
}
public static int getEnchantmentLevel(ArtifactAbility ability, ItemStack item) {
//Get the enchantment level of a particular enchantment.
HashMap enchants = getEnchantments(item);
if (enchants.containsKey(ability)) {
return (int)enchants.get(ability);
} else {
return 0;
}
}
static ItemStack applyEnchantment(ArtifactAbility ability, int lv, ItemStack item) {
ItemMeta m = item.getItemMeta();
List<String> lore = m.getLore();
if (containsEnchantment(ability,item)) {
//We just need to find the line and upgrade it then.
for (int i=0;i<lore.size();i++) {
if (lore.get(i).contains(ability.GetName())) {
//This is the line! Modify it.
lore.set(i, ChatColor.YELLOW+" "+ability.GetName()+" "+(lv));
break;
}
}
m.setLore(lore);
item.setItemMeta(m);
return item;
} else {
//Otherwise we are just appending it.
lore.add(ChatColor.YELLOW+" "+ability.GetName()+" "+lv);
m.setLore(lore);
item.setItemMeta(m);
return item;
}
}
static boolean hasCurse(ItemStack item) {
HashMap<ArtifactAbility,Integer> map = getEnchantments(item);
if (map.containsKey(REDUCEDMG) ||
map.containsKey(REDUCEDEF) ||
map.containsKey(LIFE_REDUCTION) ||
map.containsKey(LOWER_DEFENSE) ||
map.containsKey(TELEPORT) ||
map.containsKey(DRAINING) ||
map.containsKey(NOREGEN) ||
map.containsKey(STARVATION) ||
map.containsKey(BURN) ||
map.containsKey(FROZEN) ||
map.containsKey(PETRIFICATION)) {
return true;
} else {
return false;
}
}
static boolean containsEnchantment(ArtifactAbility ability, ItemStack item) {
return getEnchantments(item).containsKey(ability);
}
public static ItemStack upgradeEnchantment(Player p, ItemStack item, ArtifactAbility ability) {
//Verifies that the enchantment can be upgraded firstly.
//Get the level we are upgrading to.
int level = getEnchantmentLevel(ability,item);
if (AwakenedArtifact.getAP(item)>0) {
if (ability.GetMaxLevel()>level && ability.GetMinLevel()<=AwakenedArtifact.getLV(item)) {
//This is allowed. Proceed.
item = applyEnchantment(ability,level+1,item);
AwakenedArtifact.addAP(item, -1);
p.sendMessage(ChatColor.AQUA+"Successfully applied "+ChatColor.BLUE+ability.GetName()+" "+(level+1)+ChatColor.AQUA+" to your artifact!");
int apamt = AwakenedArtifact.getAP(item);
if (apamt>0) {
TextComponent tc = new TextComponent(" You have "+ChatColor.GREEN+apamt+ChatColor.WHITE+" ability point"+((apamt==1)?"":"s")+" remaining! Click ");
TextComponent ac = new TextComponent(ChatColor.GREEN+"[HERE]"+ChatColor.WHITE);
ac.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder(ChatColor.ITALIC+"Click to add another skill point!").create()));
ac.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/awakenedartifact"));
tc.addExtra(ac);
tc.addExtra(" to open up the ability upgrade menu.");
p.spigot().sendMessage(tc);
}
} else {
if (ability.GetMaxLevel()<=level) {
p.sendMessage(ChatColor.RED+"This ability cannot be upgraded any further!");
} else {
p.sendMessage(ChatColor.RED+"You need to reach level "+ability.GetMinLevel()+" on your artifact item first!");
}
}
} else {
p.sendMessage(ChatColor.RED+"Insufficient AP to level up this upgrade! Earn more AP first!");
}
return item;
}
public static TextComponent DisplayAbility(ArtifactAbility ability, double playerdmgval, ItemStack targetitem, int slot) {
boolean unlocked=true;
String lockedreason = "";
if (AwakenedArtifact.getLV(targetitem)<ability.GetMinLevel() || getEnchantmentLevel(ability,targetitem)>=ability.GetMaxLevel()) {
unlocked=false;
if (AwakenedArtifact.getLV(targetitem)<ability.GetMinLevel()) {
lockedreason=ChatColor.GRAY+""+ChatColor.ITALIC+"Your Artifact needs to reach Level "+ability.GetMinLevel()+" to obtain this ability.";
} else if (getEnchantmentLevel(ability,targetitem)>=ability.GetMaxLevel()) {
lockedreason=ChatColor.GRAY+""+ChatColor.ITALIC+"Your Artifact has reached the maximum level for this ability!";
}
}
int enchantlevel=0;
if (containsEnchantment(ability,targetitem)) {
enchantlevel=getEnchantmentLevel(ability,targetitem);
}
String displaystring = "";
if (enchantlevel>0) {
displaystring = displayDescriptionUpgrade(ability,targetitem.getEnchantmentLevel(Enchantment.LUCK),enchantlevel,enchantlevel+1,playerdmgval);
} else {
displaystring = displayDescription(ability,targetitem.getEnchantmentLevel(Enchantment.LUCK),enchantlevel+1,playerdmgval);
}
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()));
if (slot!=0) {
//Apply the enchantment to the proper item slot.
tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/awakenedartifact levelup "+ability.name()+" "+slot));
} else {
tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/awakenedartifact levelup "+ability.name()));
}
if (getEnchantmentLevel(ability,targetitem)<ability.GetMaxLevel()) {
return tc;
} else {
return new TextComponent(""); //We don't want to display enchantments that are capped in the menu.
}
}
public static TextComponent GenerateMenu(UpgradePath path, double playerdmgval, ItemStack targetitem) {
return GenerateMenu(path,playerdmgval,targetitem,0);
}
public static TextComponent GenerateMenu(UpgradePath path, double playerdmgval, ItemStack targetitem, int slot) {
TextComponent msg1 = new TextComponent("Choose an ability to upgrade "+((targetitem.hasItemMeta() && targetitem.getItemMeta().hasDisplayName())?targetitem.getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(targetitem))+ChatColor.RESET+":\n\n");
int i=0;
TextComponent text = new TextComponent("");
switch (path) {
//Populate menu lists.
case ARMOR:
text=DisplayAbility(DAMAGE_REDUCTION,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(HEALTH,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(HEALTH_REGEN,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(STATUS_EFFECT_RESISTANCE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(SHADOWWALKER,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(SURVIVOR,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(DODGE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(GRACEFULDODGE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
break;
case BOW:
text=DisplayAbility(DAMAGE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(ARMOR_PEN,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(EXECUTION,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(MARKSMAN,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(CRITICAL,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(CRIT_DMG,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(SIEGESTANCE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(ARROWSHOWER,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(TARGETING,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(ENDERTURRET,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
break;
case TOOL:
text=DisplayAbility(DAMAGE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(ARMOR_PEN,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(EXECUTION,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(LIFESTEAL,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(CRITICAL,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(CRIT_DMG,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
if (targetitem.getType().toString().contains("PICKAXE")) {
text=DisplayAbility(SCAVENGE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
} else if (targetitem.getType().toString().contains("SPADE")) {
text=DisplayAbility(SUPPRESS,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
} else if (targetitem.getType().toString().contains("AXE")) {
text=DisplayAbility(BREAKDOWN,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(BUTCHERY,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
} else if (targetitem.getType().toString().contains("HOE")) {
text=DisplayAbility(DEATHMARK,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(AOE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
}
break;
case WEAPON:
text=DisplayAbility(DAMAGE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(ARMOR_PEN,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(EXECUTION,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(LIFESTEAL,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(CRITICAL,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(CRIT_DMG,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(PROVOKE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(HIGHWINDER,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(COMBO,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
break;
}
text=DisplayAbility(GREED,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(GROWTH,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(REMOVE_CURSE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(PRESERVATION,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(EXP_MULT,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
return msg1;
}
public static String displayDescription(ArtifactAbility ability, int tier, int abilitylv, double playerdmgval) { //Level to display information for.
String msg = ability.GetDescription();
DecimalFormat df = new DecimalFormat("0.00");
msg.replace("[VAL]", df.format(calculateValue(lv)));
msg.replace("[PENDMG]", df.format(calculateValue(lv)/100*playerdmgval)); //Based on multiplying [VAL] by the base damage value.
msg=msg.replace("[VAL]", df.format(calculateValue(ability,tier,abilitylv)));
msg=msg.replace("[PENDMG]", df.format(calculateValue(ability,tier,abilitylv)/100*playerdmgval)); //Based on multiplying [VAL] by the base damage value.
msg=msg.replace("[HUNGERVAL]", df.format(10*abilitylv));
msg=msg.replace("[FATALDMG]", df.format(120*abilitylv));
return msg;
}
public String displayDescriptionUpgrade(int fromlv, int tolv, double playerdmgval) { //Level to display information for.
String msg = this.desc;
public static String displayDescriptionUpgrade(ArtifactAbility ability, int tier, int fromlv, int tolv, double playerdmgval) { //Level to display information for.
String msg = ability.GetDescription();
DecimalFormat df = new DecimalFormat("0.00");
msg.replace("[VAL]", DisplayChangedValue(df.format(calculateValue(fromlv)),df.format(calculateValue(tolv))));
msg.replace("[PENDMG]", DisplayChangedValue(df.format(calculateValue(fromlv)/100*playerdmgval),df.format(calculateValue(tolv)/100*playerdmgval))); //Based on multiplying [VAL] by the base damage value.
msg=msg.replace("[VAL]", DisplayChangedValue(df.format(calculateValue(ability,tier,fromlv)),df.format(calculateValue(ability,tier,tolv))));
msg=msg.replace("[PENDMG]", DisplayChangedValue(df.format(calculateValue(ability,tier,fromlv)/100*playerdmgval),df.format(calculateValue(ability,tier,tolv)/100*playerdmgval))); //Based on multiplying [VAL] by the base damage value.
msg=msg.replace("[HUNGERVAL]", DisplayBadChangedValue(df.format(10*fromlv),df.format(10*tolv)));
msg=msg.replace("[FATALDMG]", DisplayChangedValue(df.format(120-fromlv),df.format(120-tolv)));
return msg;
}
String DisplayChangedValue(String val1,String val2) {
static String DisplayChangedValue(String val1,String val2) {
return ChatColor.DARK_GRAY+""+ChatColor.STRIKETHROUGH+val1+ChatColor.RESET+ChatColor.GREEN+val2+ChatColor.DARK_GREEN+ChatColor.BOLD+"^"+ChatColor.RESET;
}
static String DisplayBadChangedValue(String val1,String val2) {
return ChatColor.DARK_RED+""+ChatColor.STRIKETHROUGH+val1+ChatColor.RESET+ChatColor.RED+val2+ChatColor.DARK_RED+ChatColor.BOLD+"v"+ChatColor.RESET;
}
}

View File

@ -249,6 +249,43 @@ public enum ArtifactItemType {
18.75d, //T9
22.50d //T10
},
new int[]{
2, //T1
3, //T2
4, //T3
5, //T4
6, //T5
7, //T6
9, //T7
10, //T8
12, //T9
14 //T10
}),
FISHING_ROD(10,"FISHING ROD",TierType.ALL,UpgradePath.WEAPON,new String[]{"xxE","xEE","ExE"},
new ItemStack[]{
new ItemStack(Material.FISHING_ROD), //T1
new ItemStack(Material.FISHING_ROD), //T2
new ItemStack(Material.FISHING_ROD), //T3
new ItemStack(Material.FISHING_ROD), //T4
new ItemStack(Material.FISHING_ROD), //T5
new ItemStack(Material.FISHING_ROD), //T6
new ItemStack(Material.FISHING_ROD), //T7
new ItemStack(Material.FISHING_ROD), //T8
new ItemStack(Material.FISHING_ROD), //T9
new ItemStack(Material.FISHING_ROD), //T10
},
new double[]{
3.75d, //T1
5.0d, //T2
6.25d, //T3
7.50d, //T4
8.75d, //T5
11.25d, //T6
13.75d, //T7
16.25d, //T8
18.75d, //T9
22.50d //T10
},
new int[]{
2, //T1
3, //T2
@ -303,6 +340,19 @@ public enum ArtifactItemType {
return null;
}
public static ArtifactItemType getArtifactItemTypeFromItemStack(ItemStack item) {
String check = item.getType().toString();
String[] checktypes = new String[]{"PICKAXE","AXE","SWORD","PICKAXE","HOE",
"BOW","SPADE","HELMET","CHESTPLATE","LEGGINGS","BOOTS","FISHING_ROD"};
for (int i=0;i<checktypes.length;i++) {
if (check.contains(checktypes[i])) {
if (checktypes[i].equalsIgnoreCase("SPADE")) {checktypes[i]="SHOVEL";}
return ArtifactItemType.valueOf(checktypes[i]);
}
}
return null;
}
public int getDataValue() {
return this.data;
}
@ -404,7 +454,7 @@ public enum ArtifactItemType {
ouritem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 1);
}break;
case BOW:{
ouritem.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 4);
ouritem.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 3);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 3);
}break;
case ARMOR:{
@ -429,7 +479,7 @@ public enum ArtifactItemType {
ouritem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 1);
}break;
case BOW:{
ouritem.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 5);
ouritem.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 4);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 4);
}break;
case ARMOR:{
@ -438,7 +488,7 @@ public enum ArtifactItemType {
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 1);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 1);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 2);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 5);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 4);
}break;
case TOOL:{
ouritem.addUnsafeEnchantment(Enchantment.DIG_SPEED, 4);
@ -449,50 +499,50 @@ public enum ArtifactItemType {
case 5:{
switch (upgrade) {
case WEAPON:{
ouritem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 6);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 6);
ouritem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 5);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 5);
ouritem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 2);
}break;
case BOW:{
ouritem.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 7);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 6);
ouritem.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 5);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 5);
}break;
case ARMOR:{
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 6);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 5);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 4);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 2);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 2);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 4);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 7);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 5);
}break;
case TOOL:{
ouritem.addUnsafeEnchantment(Enchantment.DIG_SPEED, 6);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 6);
ouritem.addUnsafeEnchantment(Enchantment.DIG_SPEED, 5);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 5);
}break;
}
}break;
case 6:{
switch (upgrade) {
case WEAPON:{
ouritem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 8);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 8);
ouritem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 6);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 6);
ouritem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 3);
}break;
case BOW:{
ouritem.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 10);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 8);
ouritem.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 6);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 6);
}break;
case ARMOR:{
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 8);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 6);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 6);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 4);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 4);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 6);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 6);
}break;
case TOOL:{
ouritem.addUnsafeEnchantment(Enchantment.DIG_SPEED, 8);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 8);
ouritem.addUnsafeEnchantment(Enchantment.DIG_SPEED, 6);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 6);
ouritem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 1);
}break;
}
@ -500,27 +550,27 @@ public enum ArtifactItemType {
case 7:{
switch (upgrade) {
case WEAPON:{
ouritem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 10);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
ouritem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 7);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 7);
ouritem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 5);
ouritem.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1);
}break;
case BOW:{
ouritem.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 12);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
ouritem.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 7);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 7);
ouritem.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 1);
}break;
case ARMOR:{
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 10);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 10);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 10);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 10);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 10);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 14);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 7);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 7);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 7);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 7);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 7);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 7);
}break;
case TOOL:{
ouritem.addUnsafeEnchantment(Enchantment.DIG_SPEED, 10);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
ouritem.addUnsafeEnchantment(Enchantment.DIG_SPEED, 7);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 7);
ouritem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 2);
ouritem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 2);
}break;
@ -529,27 +579,27 @@ public enum ArtifactItemType {
case 8:{
switch (upgrade) {
case WEAPON:{
ouritem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 14);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
ouritem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 8);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 8);
ouritem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 7);
ouritem.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1);
}break;
case BOW:{
ouritem.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 14);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
ouritem.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 8);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 8);
ouritem.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 1);
}break;
case ARMOR:{
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 12);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 12);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 12);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 12);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 12);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 14);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 8);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 8);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 8);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 8);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 8);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 8);
}break;
case TOOL:{
ouritem.addUnsafeEnchantment(Enchantment.DIG_SPEED, 14);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
ouritem.addUnsafeEnchantment(Enchantment.DIG_SPEED, 8);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 8);
ouritem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 4);
ouritem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 6);
}break;
@ -558,65 +608,65 @@ public enum ArtifactItemType {
case 9:{
switch (upgrade) {
case WEAPON:{
ouritem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 18);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
ouritem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 9);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 9);
ouritem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 9);
ouritem.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1);
}break;
case BOW:{
ouritem.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 18);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
ouritem.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 9);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 9);
ouritem.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 1);
ouritem.addUnsafeEnchantment(Enchantment.ARROW_INFINITE, 1);
}break;
case ARMOR:{
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 16);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 16);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 16);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 16);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 16);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 18);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 9);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 9);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 9);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 9);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 9);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 9);
}break;
case TOOL:{
ouritem.addUnsafeEnchantment(Enchantment.DIG_SPEED, 18);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
ouritem.addUnsafeEnchantment(Enchantment.DIG_SPEED, 9);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 9);
ouritem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 7);
ouritem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 12);
ouritem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 9);
}break;
}
}break;
case 10:{
switch (upgrade) {
case WEAPON:{
ouritem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 40);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 20);
ouritem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 10);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
ouritem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 10);
ouritem.addUnsafeEnchantment(Enchantment.KNOCKBACK, 2);
}break;
case BOW:{
ouritem.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 40);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 20);
ouritem.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 10);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
ouritem.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 2);
ouritem.addUnsafeEnchantment(Enchantment.ARROW_INFINITE, 1);
}break;
case ARMOR:{
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 20);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 20);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 20);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 20);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 20);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 75);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 10);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 10);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 10);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 10);
ouritem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 10);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
}break;
case TOOL:{
ouritem.addUnsafeEnchantment(Enchantment.DIG_SPEED, 40);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 20);
ouritem.addUnsafeEnchantment(Enchantment.DIG_SPEED, 10);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
ouritem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 10);
ouritem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 20);
ouritem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 10);
}break;
}break;
}
}
return ouritem;
return Artifact.convert(ouritem,true);
}
}
@ -627,9 +677,3 @@ enum TierType {
ARMOR //The armor type contains Leather, Iron, Gold, and Diamond Variants.
}
enum UpgradePath {
WEAPON, //Weapon Upgrade Path - Boosts mostly offensive based statistics.
BOW, //Bow Upgrade Path - Boosts mostly offensive based statistics, but for a bow.
ARMOR, //Armor Upgrade Path - Boosts mostly defensive based statistics.
TOOL //Tool Upgrade Path - Boosts mostly utility based statistics.
}

View File

@ -112,12 +112,14 @@ public class GenericFunctions {
item.getItemMeta().hasLore()) {
lore = m.getLore();
}
if (isArmor(item)) {
lore.add(ChatColor.BLUE+""+ChatColor.ITALIC+"Hardened Armor");
lore.add(ChatColor.GRAY+"Twice as strong");
} else
if (isWeapon(item)) {
lore.add(ChatColor.GRAY+"Twice as strong");
if (!Artifact.isArtifact(item)) {
if (isArmor(item)) {
lore.add(ChatColor.BLUE+""+ChatColor.ITALIC+"Hardened Armor");
lore.add(ChatColor.GRAY+"Twice as strong");
} else
if (isWeapon(item)) {
lore.add(ChatColor.GRAY+"Twice as strong");
}
}
lore.add(ChatColor.GRAY+"Breaks Remaining: "+ChatColor.YELLOW+breaks);
m.setLore(lore);
@ -143,12 +145,14 @@ public class GenericFunctions {
item.getItemMeta().hasLore()) {
lore = m.getLore();
}
if (isArmor(item)) {
lore.add(ChatColor.BLUE+""+ChatColor.ITALIC+"Hardened Armor");
lore.add(ChatColor.GRAY+"Twice as strong");
} else
if (isWeapon(item)) {
lore.add(ChatColor.GRAY+"Twice as strong");
if (!Artifact.isArtifact(item)) {
if (isArmor(item)) {
lore.add(ChatColor.BLUE+""+ChatColor.ITALIC+"Hardened Armor");
lore.add(ChatColor.GRAY+"Twice as strong");
} else
if (isWeapon(item)) {
lore.add(ChatColor.GRAY+"Twice as strong");
}
}
lore.add(ChatColor.GRAY+"Breaks Remaining: "+ChatColor.MAGIC+breaks);
lore.add(ChatColor.BLUE+""+ChatColor.MAGIC+TwosideKeeper.getServerTickTime());
@ -1607,7 +1611,8 @@ public class GenericFunctions {
item.getType().toString().contains("BOOTS") ||
item.getType().toString().contains("CHESTPLATE") ||
item.getType().toString().contains("LEGGINGS") ||
item.getType().toString().contains("HELMET")) {
item.getType().toString().contains("HELMET") ||
item.getType().toString().contains("FISHING_ROD")) {
return true;
} else {
return false;
@ -1640,7 +1645,8 @@ public class GenericFunctions {
public static boolean isWeapon(ItemStack item) {
if (item.getType().toString().contains("BOW") ||
item.getType().toString().contains("AXE") ||
item.getType().toString().contains("SWORD")) {
item.getType().toString().contains("SWORD") ||
item.getType().toString().contains("FISHING_ROD")) {
return true;
} else {
return false;

View File

@ -0,0 +1,8 @@
package sig.plugin.TwosideKeeper.HelperStructures;
public enum UpgradePath {
WEAPON, //Weapon Upgrade Path - Boosts mostly offensive based statistics.
BOW, //Bow Upgrade Path - Boosts mostly offensive based statistics, but for a bow.
ARMOR, //Armor Upgrade Path - Boosts mostly defensive based statistics.
TOOL //Tool Upgrade Path - Boosts mostly utility based statistics.
}

View File

@ -205,4 +205,14 @@ public class Party {
}
}
}
public static List<Player> getPartyMembers(Player p) {
//Find the party this player is in.
Party part = null;
for (int i=0;i<TwosideKeeper.PartyList.size();i++) {
if (TwosideKeeper.PartyList.get(i).IsInParty(p)) {
return TwosideKeeper.PartyList.get(i).partyplayers;
}
}
return null;
}
}

View File

@ -488,21 +488,21 @@ public class Recipes {
//T0
for (int i=0;i<ArtifactItemType.values().length;i++) {
Bukkit.addRecipe(ArtifactItemType.values()[i].defineBaseRecipe());
ArtifactItemType.values()[i].defineAllDecompRecipes();
//ArtifactItemType.values()[i].defineAllDecompRecipes();
//T1,T4,T7 Recipes
ShapelessRecipe newrecipe = new ShapelessRecipe(new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)ArtifactItemType.values()[i].getDataValue()));
ShapelessRecipe newrecipe = new ShapelessRecipe(Artifact.convert(new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)ArtifactItemType.values()[i].getDataValue())));
newrecipe.addIngredient(2, Material.STAINED_GLASS_PANE, ArtifactItemType.values()[i].getDataValue());
newrecipe.addIngredient(Material.SUGAR);
Bukkit.addRecipe(newrecipe);
newrecipe = new ShapelessRecipe(new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)ArtifactItemType.values()[i].getDataValue()));
newrecipe = new ShapelessRecipe(Artifact.convert(new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)ArtifactItemType.values()[i].getDataValue())));
newrecipe.addIngredient(2, Material.STAINED_GLASS_PANE, ArtifactItemType.values()[i].getDataValue());
newrecipe.addIngredient(Material.MAGMA_CREAM);
Bukkit.addRecipe(newrecipe);
newrecipe = new ShapelessRecipe(new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)ArtifactItemType.values()[i].getDataValue()));
newrecipe = new ShapelessRecipe(Artifact.convert(new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)ArtifactItemType.values()[i].getDataValue())));
newrecipe.addIngredient(2, Material.STAINED_GLASS_PANE, ArtifactItemType.values()[i].getDataValue());
newrecipe.addIngredient(Material.CLAY_BALL);
Bukkit.addRecipe(newrecipe);
newrecipe = new ShapelessRecipe(new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)ArtifactItemType.values()[i].getDataValue()));
newrecipe = new ShapelessRecipe(Artifact.convert(new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)ArtifactItemType.values()[i].getDataValue())));
newrecipe.addIngredient(2, Material.STAINED_GLASS_PANE, ArtifactItemType.values()[i].getDataValue());
newrecipe.addIngredient(Material.SUGAR);
newrecipe.addIngredient(Material.MAGMA_CREAM);

View File

@ -141,6 +141,7 @@ import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import net.minecraft.server.v1_9_R1.MinecraftServer;
import net.minecraft.server.v1_9_R1.Vector3f;
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility;
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItem;
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItemType;
import sig.plugin.TwosideKeeper.HelperStructures.BankSession;
@ -156,6 +157,7 @@ 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;
@ -206,7 +208,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static Lag tpstracker;
public int TeamCounter = 0;
public List<Party> PartyList = new ArrayList<Party>();
public static List<Party> PartyList = new ArrayList<Party>();
public List<Integer> colors_used = new ArrayList<Integer>();
public List<ChargeZombie> chargezombies = new ArrayList<ChargeZombie>();
@ -250,7 +252,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
sig.plugin.TwosideKeeper.Recipes.Initialize_ItemDeconstruction_Recipes();
sig.plugin.TwosideKeeper.Recipes.Initialize_WoolRecolor_Recipes();
sig.plugin.TwosideKeeper.Recipes.Initialize_SlabReconstruction_Recipes();
//sig.plugin.TwosideKeeper.Recipes.Initialize_Artifact_Recipes();
sig.plugin.TwosideKeeper.Recipes.Initialize_Artifact_Recipes();
sig.plugin.TwosideKeeper.Recipes.Initialize_ArtifactHelper_Recipes();
sig.plugin.TwosideKeeper.Recipes.Initialize_Check_Recipe();
@ -313,6 +315,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
playerdata.put(((Player)Bukkit.getOnlinePlayers().toArray()[i]).getUniqueId(), new PlayerStructure((Player)Bukkit.getOnlinePlayers().toArray()[i],getServerTickTime()));
//playerdata.add(new PlayerStructure((Player)Bukkit.getOnlinePlayers().toArray()[i],getServerTickTime()));
}
Player p;
//Announce the server has restarted soon after.
if (SERVER_TYPE!=ServerType.QUIET) {
@ -606,16 +609,17 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
DecimalFormat df = new DecimalFormat("0.00");
if (cmd.getName().equalsIgnoreCase("fix")) {
Player p = (Player)sender;
//p.sendMessage(p.getEquipment().getItemInMainHand().toString());
//sender.sendMessage("Localized Name is "+GenericFunctions.UserFriendlyMaterialName(p.getEquipment().getItemInMainHand().getType(),p.getEquipment().getItemInMainHand().getData().getData()));
if (Artifact.isMalleableBase(p.getEquipment().getItemInMainHand()) &&
MalleableBaseQuest.getTimeStarted(p.getEquipment().getItemInMainHand())<=147337849) {
p.getEquipment().setItemInMainHand(MalleableBaseQuest.setTimeStarted(p.getEquipment().getItemInMainHand(), getServerTickTime()));
}
//ItemStack item = p.getEquipment().getItemInMainHand();
//AwakenedArtifact.addPotentialEXP(item, 100, p);
//p.sendMessage(tpstracker.getTPS()+"");
//GenericFunctions.addObscureHardenedItemBreaks(p.getEquipment().getItemInMainHand(), 4);
if (SERVER_TYPE==ServerType.TEST || SERVER_TYPE==ServerType.QUIET) {
//ItemStack item = p.getEquipment().getItemInMainHand();
//AwakenedArtifact.addPotentialEXP(item, 100, p);
//p.sendMessage(tpstracker.getTPS()+"");
//GenericFunctions.addObscureHardenedItemBreaks(p.getEquipment().getItemInMainHand(), 4);
}
return true;
} else
if (cmd.getName().equalsIgnoreCase("money")) {
@ -766,6 +770,27 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
showPlayerStats((Player)sender);
return true;
}
} else
if (cmd.getName().equalsIgnoreCase("awakenedartifact")) {
if (args.length==2 && args[0].equalsIgnoreCase("levelup")) {
Player p = (Player)sender;
//Argument0 is "levelup"
//Argument1 is the enum of the ability.
//See if we can level this item up!
//Upgrade!
ArtifactAbility.upgradeEnchantment(p,p.getEquipment().getItemInMainHand(),ArtifactAbility.valueOf(args[1]));
} else
if (args.length==3 && args[0].equalsIgnoreCase("levelup")) {
//argument2 is the equip slot to apply it to.
Player p = (Player)sender;
ArtifactAbility.upgradeEnchantment(p,p.getInventory().getItem(Integer.parseInt(args[2])),ArtifactAbility.valueOf(args[1]));
} else {
//Display the generic levelup message.
Player p = Bukkit.getPlayer(sender.getName());
p.sendMessage("");p.sendMessage("");
p.spigot().sendMessage(ArtifactAbility.GenerateMenu(ArtifactItemType.getArtifactItemTypeFromItemStack(p.getEquipment().getItemInMainHand()).getUpgradePath(), CalculateDamageReduction(1,p,p), p.getEquipment().getItemInMainHand()));
}
return true;
}
} else {
//Implement console/admin version later (Let's you check any name's money.)
@ -914,6 +939,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (thisp.getLevel()>=value) {
//Take that amount of exp away from the player. Give them money in return.
int startlv = thisp.getLevel();
double amtgained=0;
for (int i=startlv;i>=startlv-value;i--) {
switch (i) {
case 0:
@ -934,7 +960,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
case 15:
case 16:
{
givePlayerMoney(thisp,(2*i+7)*XP_CONVERSION_RATE);
amtgained = (2*i+7)*XP_CONVERSION_RATE;
givePlayerMoney(thisp,amtgained);
}break;
case 17:
case 18:
@ -952,15 +979,17 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
case 30:
case 31:
{
givePlayerMoney(thisp,(5*i-38)*XP_CONVERSION_RATE);
amtgained = (5*i-38)*XP_CONVERSION_RATE;
givePlayerMoney(thisp,amtgained);
}break;
default:{
givePlayerMoney(thisp,(9*i-158)*XP_CONVERSION_RATE);
amtgained = (9*i-158)*XP_CONVERSION_RATE;
givePlayerMoney(thisp,amtgained);
}
}
}
thisp.setLevel(thisp.getLevel()-value);
ev.getPlayer().sendMessage(ChatColor.GOLD+"CONVERSION COMPLETE!");
ev.getPlayer().sendMessage(ChatColor.GOLD+"CONVERSION COMPLETE!"+ChatColor.WHITE+" Converted "+value+" levels of experience into "+ChatColor.YELLOW+"$"+df.format(amtgained)+ChatColor.WHITE+".");
ev.getPlayer().sendMessage(" Now Holding: "+ChatColor.BLUE+"$"+df.format(getPlayerMoney(ev.getPlayer())));
} else {
thisp.sendMessage(ChatColor.RED+"You do not have that many levels. You can convert as many as "+ChatColor.WHITE+thisp.getLevel()+ChatColor.RED+" levels.");
@ -1600,11 +1629,15 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
Location oldBedPos = ev.getPlayer().getBedSpawnLocation();
log(ev.getPlayer()+" Right-clicked bed. Set bed spawn to "+BedPos.toString(),3);
ev.getPlayer().setBedSpawnLocation(BedPos);
log(oldBedPos.toString()+"::"+ev.getPlayer().getBedSpawnLocation().toString(),5);
if (oldBedPos.getBlockX()!=ev.getPlayer().getBedSpawnLocation().getBlockX() ||
oldBedPos.getBlockY()!=ev.getPlayer().getBedSpawnLocation().getBlockY() ||
oldBedPos.getBlockZ()!=ev.getPlayer().getBedSpawnLocation().getBlockZ())
ev.getPlayer().sendMessage(ChatColor.BLUE+""+ChatColor.ITALIC+"New bed respawn location set.");
if (ev.getPlayer().getBedSpawnLocation()!=null) {
log(oldBedPos.toString()+"::"+ev.getPlayer().getBedSpawnLocation().toString(),5);
if (oldBedPos.getBlockX()!=ev.getPlayer().getBedSpawnLocation().getBlockX() ||
oldBedPos.getBlockY()!=ev.getPlayer().getBedSpawnLocation().getBlockY() ||
oldBedPos.getBlockZ()!=ev.getPlayer().getBedSpawnLocation().getBlockZ())
ev.getPlayer().sendMessage(ChatColor.BLUE+""+ChatColor.ITALIC+"New bed respawn location set.");
} else {
ev.getPlayer().sendMessage(ChatColor.BLUE+""+ChatColor.ITALIC+"New bed respawn location set.");
}
}
if (ev.getAction()==Action.RIGHT_CLICK_BLOCK &&
ev.getClickedBlock().getType().toString().contains("RAIL") &&
@ -2343,7 +2376,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
@EventHandler(priority=EventPriority.LOW)
public void onInventoryClick(InventoryClickEvent ev) {
final Player player = (Player)ev.getWhoClicked();
log("Raw Slot Clicked: "+ev.getRawSlot(),5);
log("Raw Slot Clicked: "+ev.getRawSlot(),5); //5,6,7,8 for gear slots.
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
@Override
public void run() {
@ -2856,9 +2889,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public void MonsterSpawnEvent(CreatureSpawnEvent ev) {
if ((ev.getSpawnReason().equals(SpawnReason.NATURAL) ||
ev.getSpawnReason().equals(SpawnReason.SPAWNER_EGG) ||
ev.getSpawnReason().equals(SpawnReason.REINFORCEMENTS)) &&
ev.getSpawnReason().equals(SpawnReason.REINFORCEMENTS) ||
ev.getSpawnReason().equals(SpawnReason.VILLAGE_INVASION)) &&
ev.getEntity() instanceof Monster) {
if (ev.getSpawnReason().equals(SpawnReason.REINFORCEMENTS)) {
if (ev.getSpawnReason().equals(SpawnReason.REINFORCEMENTS) || ev.getSpawnReason().equals(SpawnReason.VILLAGE_INVASION)) {
//Remove this one and spawn another one.
Location loc = ev.getEntity().getLocation().clone();
Monster m = (Monster)loc.getWorld().spawnEntity(loc, EntityType.ZOMBIE);
@ -3594,6 +3628,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
TwosideSpleefGames.PassEvent(ev);
Player p = ev.getPlayer();
TwosideKeeperAPI.addArtifactEXP(p.getEquipment().getItemInMainHand(), 100, p);
if (p!=null) {
log(p.getName()+" has broken block "+GenericFunctions.UserFriendlyMaterialName(new ItemStack(ev.getBlock().getType())),3);
}
@ -4048,6 +4083,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ev.getInventory().getItem(i).getType()!=Material.AIR &&
Artifact.isArtifact(ev.getInventory().getItem(i))) {
items_found++;
TwosideKeeper.log("Items Found: "+items_found, 5);
if (ev.getInventory().getItem(i).getType()==Material.PUMPKIN_SEEDS) {
//We are not supposed to be in here!
pumpkin_seeds=true;
@ -4085,11 +4121,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (ev.getInventory().getItem(i)!=null &&
ev.getInventory().getItem(i).getType()!=Material.AIR &&
!Artifact.isArtifact(ev.getInventory().getItem(i))) {
log("One of these is not an artifact",2);
log("One of these is not an artifact",5);
ev.getInventory().setResult(new ItemStack(Material.AIR)); //Don't allow it, an item is not an artifact!
}
}
if (items_found==1 && slot_found!=0 && ev.getInventory().getResult().getType()!=null && ev.getInventory().getResult().getType()!=Material.AIR) {
if (items_found==1 && ev.getInventory().getResult().getType()!=null && ev.getInventory().getResult().getType()!=Material.AIR) {
//This is a recipe->Base item conversion.
ItemStack newitem = ArtifactItemType.getTypeFromData(ev.getInventory().getItem(slot_found).getDurability()).getTieredItem(tier_found);
@ -4111,12 +4147,34 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
m.setLore(transferlore);
newartifact.setItemMeta(m);
//Lines can all be transferred over. No lines need to be preserved.
//Transfer over all old enchantments. Don't transfer enchantments weaker than current enchantments.
ItemStack resultitem = ev.getInventory().getResult().clone();
for (int i=0;i<resultitem.getEnchantments().size();i++) {
Enchantment e = (Enchantment)resultitem.getEnchantments().keySet().toArray()[i];
if (newartifact.containsEnchantment(e) && artifact_item.getEnchantmentLevel(e)>newartifact.getEnchantmentLevel(e)) {
log("Contains "+e.toString()+" "+newartifact.getEnchantmentLevel(e), 2);
//These are the enchantments that clash. If the resultitem ones are greater, apply them to the new item.
newartifact.addUnsafeEnchantment(e, artifact_item.getEnchantmentLevel(e));
log("Applied "+e.getName()+" "+artifact_item.getEnchantmentLevel(e)+" to the artifact",2);
}
}
for (int i=0;i<artifact_item.getEnchantments().size();i++) {
Enchantment e = (Enchantment)artifact_item.getEnchantments().keySet().toArray()[i];
if (!newartifact.containsEnchantment(e)) {
//log("Contains "+e.toString()+" "+newartifact.getEnchantmentLevel(e), 2);
//These are the enchantments that clash. If the resultitem ones are greater, apply them to the new item.
newartifact.addUnsafeEnchantment(e, artifact_item.getEnchantmentLevel(e));
log("Applied "+e.getName()+" "+artifact_item.getEnchantmentLevel(e)+" to the artifact",2);
}
}
ev.getInventory().setResult(newartifact);
}
}
if (items_found==3 && !pumpkin_seeds && ev.getInventory().getResult().getType()!=null && ev.getInventory().getResult().getType()!=Material.AIR) {
int tier = ev.getInventory().getItem(slot_found).getEnchantmentLevel(Enchantment.LUCK);
//log("This is tier "+tier+". Enchantment level of "+ev.getInventory().getItem(slot_found).toString(),2);
log("This is tier "+tier+". Enchantment level of "+ev.getInventory().getItem(slot_found).toString(),2);
//Decompose this into a higher tier of the next item.
if (tier==tier_recipe && tier<9) {
ItemStack newitem1 = Artifact.convert(new ItemStack(Material.STAINED_GLASS_PANE,1,ev.getInventory().getItem(slot_found).getDurability()));
@ -4138,6 +4196,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
) {
if (essence_tier==4 && core_tier==4 && base_tier==4) {
//It's allowed! Set the result to T10 recipe.
TwosideKeeper.log("It is found.", 2);
ItemStack newitem1 = Artifact.convert(new ItemStack(Material.STAINED_GLASS_PANE,1,ev.getInventory().getItem(slot_found).getDurability()));
ItemMeta m = newitem1.getItemMeta();
List<String> lore = m.getLore();
@ -5516,6 +5575,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
store2 = CalculateWeaponDamage(p,null);
}
pd.damagedealt=store2;
pd.damagereduction=store1;
DecimalFormat df = new DecimalFormat("0.0");
p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Base Damage: "+ChatColor.RESET+""+ChatColor.DARK_PURPLE+df.format(pd.damagedealt));
p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Damage Reduction: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format((1.0-pd.damagereduction)*100)+"%");

View File

@ -1,5 +1,7 @@
package sig.plugin.TwosideKeeper;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
@ -112,6 +114,11 @@ public final class TwosideKeeperAPI {
public static ServerType getServerType() {
return TwosideKeeper.getServerType();
}
//Party COMMANDS.
public static List<Player> getPartyMembers(Player p) {
return Party.getPartyMembers(p);
}
//Combat COMMANDS.
public static double getModifiedDamage(double dmg_amt, LivingEntity p) {