Working HUD Style, users can switch between RETRO and STANDARD in this ver

This commit is contained in:
nossr50 2011-08-19 08:40:14 -07:00
parent 1011084d3b
commit c5334bcdc8
16 changed files with 633 additions and 360 deletions

View File

@ -1,5 +1,16 @@
Changelog: Changelog:
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code #Versions without changelogs probably had very small misc fixes, like tweaks to the source code
Version 1.1.06
Retro HUD implemented!
With the help of Randomage the XP Formulas have been vastly changed for flexability
Global modifiers and skill modifiers now support decimals
GigaDrillBreaker/Berserk doesn't drop clay blocks anymore
Fixed bug where Herbalism didn't heal more for bread/stew when right clicking a block
Fixed bug where Wheat did not use the values form the config file
In order to streamline the configuration of how XP/Levels are gained, we rewrote the formulas, it is paramount to understand that from a game perspective that does NOT change how fast you level up, it just changes how easy it is to configure the system, current configuration files will be automatically updated maintaining your selected leveling speed
Version 1.1.05 Version 1.1.05
Maps dropped from excavation are created correctly, and represent the area they are found in Maps dropped from excavation are created correctly, and represent the area they are found in
Fixed an exploit with clay and excavation Fixed an exploit with clay and excavation

View File

@ -86,12 +86,14 @@ public class Combat
&& ((PPd.getLastLogin()+5)*1000) < System.currentTimeMillis() && ((PPd.getLastLogin()+5)*1000) < System.currentTimeMillis()
&& defender.getHealth() >= 1) && defender.getHealth() >= 1)
{ {
int xp = (int) (event.getDamage() * 2 * LoadProperties.pvpxprewardmodifier);
if(m.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)) if(m.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker))
PPa.addXP(SkillType.AXES, (event.getDamage() * 2) * LoadProperties.pvpxprewardmodifier); PPa.addXP(SkillType.AXES, xp);
if(m.isSwords(attacker.getItemInHand()) && mcPermissions.getInstance().swords(attacker)) if(m.isSwords(attacker.getItemInHand()) && mcPermissions.getInstance().swords(attacker))
PPa.addXP(SkillType.SWORDS, (event.getDamage() * 2) * LoadProperties.pvpxprewardmodifier); PPa.addXP(SkillType.SWORDS, xp);
if(attacker.getItemInHand().getTypeId() == 0 && mcPermissions.getInstance().unarmed(attacker)) if(attacker.getItemInHand().getTypeId() == 0 && mcPermissions.getInstance().unarmed(attacker))
PPa.addXP(SkillType.UNARMED, (event.getDamage() * 2) * LoadProperties.pvpxprewardmodifier); PPa.addXP(SkillType.UNARMED, xp);
} }
} }
} }
@ -100,19 +102,19 @@ public class Combat
{ {
int xp = 0; int xp = 0;
if(event.getEntity() instanceof Creeper) if(event.getEntity() instanceof Creeper)
xp = (event.getDamage() * 4) * LoadProperties.xpGainMultiplier; xp = (event.getDamage() * 4);
if(event.getEntity() instanceof Spider) if(event.getEntity() instanceof Spider)
xp = (event.getDamage() * 3) * LoadProperties.xpGainMultiplier; xp = (event.getDamage() * 3);
if(event.getEntity() instanceof Skeleton) if(event.getEntity() instanceof Skeleton)
xp = (event.getDamage() * 2) * LoadProperties.xpGainMultiplier; xp = (event.getDamage() * 2);
if(event.getEntity() instanceof Zombie) if(event.getEntity() instanceof Zombie)
xp = (event.getDamage() * 2) * LoadProperties.xpGainMultiplier; xp = (event.getDamage() * 2);
if(event.getEntity() instanceof PigZombie) if(event.getEntity() instanceof PigZombie)
xp = (event.getDamage() * 3) * LoadProperties.xpGainMultiplier; xp = (event.getDamage() * 3);
if(event.getEntity() instanceof Slime) if(event.getEntity() instanceof Slime)
xp = (event.getDamage() * 3) * LoadProperties.xpGainMultiplier; xp = (event.getDamage() * 3);
if(event.getEntity() instanceof Ghast) if(event.getEntity() instanceof Ghast)
xp = (event.getDamage() * 3) * LoadProperties.xpGainMultiplier; xp = (event.getDamage() * 3);
if(m.isSwords(attacker.getItemInHand()) && mcPermissions.getInstance().swords(attacker)) if(m.isSwords(attacker.getItemInHand()) && mcPermissions.getInstance().swords(attacker))
PPa.addXP(SkillType.SWORDS, xp); PPa.addXP(SkillType.SWORDS, xp);
@ -191,24 +193,24 @@ public class Combat
if(event.getEntity() instanceof Monster) if(event.getEntity() instanceof Monster)
{ {
if(event.getEntity() instanceof Creeper) if(event.getEntity() instanceof Creeper)
xp = (event.getDamage() * 6) * LoadProperties.xpGainMultiplier; xp = (event.getDamage() * 6);
if(event.getEntity() instanceof Spider) if(event.getEntity() instanceof Spider)
xp = (event.getDamage() * 5) * LoadProperties.xpGainMultiplier; xp = (event.getDamage() * 5);
if(event.getEntity() instanceof Skeleton) if(event.getEntity() instanceof Skeleton)
xp = (event.getDamage() * 3) * LoadProperties.xpGainMultiplier; xp = (event.getDamage() * 3);
if(event.getEntity() instanceof Zombie) if(event.getEntity() instanceof Zombie)
xp = (event.getDamage() * 3) * LoadProperties.xpGainMultiplier; xp = (event.getDamage() * 3);
if(event.getEntity() instanceof PigZombie) if(event.getEntity() instanceof PigZombie)
xp = (event.getDamage() * 4) * LoadProperties.xpGainMultiplier; xp = (event.getDamage() * 4);
if(event.getEntity() instanceof Slime) if(event.getEntity() instanceof Slime)
xp = (event.getDamage() * 4) * LoadProperties.xpGainMultiplier; xp = (event.getDamage() * 4);
if(event.getEntity() instanceof Ghast) if(event.getEntity() instanceof Ghast)
xp = (event.getDamage() * 4) * LoadProperties.xpGainMultiplier; xp = (event.getDamage() * 4);
Users.getProfile(master).addXP(SkillType.TAMING, xp); Users.getProfile(master).addXP(SkillType.TAMING, xp);
} }
if(event.getEntity() instanceof Player) if(event.getEntity() instanceof Player)
{ {
xp = (event.getDamage() * 2) * LoadProperties.xpGainMultiplier; xp = (event.getDamage() * 2);
Users.getProfile(master).addXP(SkillType.TAMING, xp); Users.getProfile(master).addXP(SkillType.TAMING, xp);
} }
Skills.XpCheckSkill(SkillType.TAMING, master); Skills.XpCheckSkill(SkillType.TAMING, master);
@ -335,19 +337,19 @@ public class Combat
{ {
//XP //XP
if(x instanceof Creeper) if(x instanceof Creeper)
PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 4) * LoadProperties.xpGainMultiplier); PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 4));
if(x instanceof Spider) if(x instanceof Spider)
PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 3) * LoadProperties.xpGainMultiplier); PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 3));
if(x instanceof Skeleton) if(x instanceof Skeleton)
PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 2) * LoadProperties.xpGainMultiplier); PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 2));
if(x instanceof Zombie) if(x instanceof Zombie)
PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 2) * LoadProperties.xpGainMultiplier); PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 2));
if(x instanceof PigZombie) if(x instanceof PigZombie)
PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 3) * LoadProperties.xpGainMultiplier); PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 3));
if(x instanceof Slime) if(x instanceof Slime)
PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 3) * LoadProperties.xpGainMultiplier); PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 3));
if(x instanceof Ghast) if(x instanceof Ghast)
PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 3) * LoadProperties.xpGainMultiplier); PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 3));
} }
/* /*
* Attacker is Player * Attacker is Player
@ -372,7 +374,8 @@ public class Combat
if(LoadProperties.pvpxp && !Party.getInstance().inSameParty(attacker, defender) if(LoadProperties.pvpxp && !Party.getInstance().inSameParty(attacker, defender)
&& ((PPd.getLastLogin()+5)*1000) < System.currentTimeMillis()) && ((PPd.getLastLogin()+5)*1000) < System.currentTimeMillis())
{ {
PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 3) * LoadProperties.pvpxprewardmodifier); int xp = (int) (event.getDamage() * 2 * LoadProperties.pvpxprewardmodifier);
PPa.addXP(SkillType.ARCHERY, xp);
} }
/* /*
* DAZE PROC * DAZE PROC

View File

@ -20,6 +20,8 @@ import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions; import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.HUDType;
import com.gmail.nossr50.datatypes.HUDmmo;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.mcLocale;
@ -968,8 +970,6 @@ public class Commands
} }
else if(LoadProperties.ptpEnable && label.equalsIgnoreCase(LoadProperties.ptp) && PP.inParty()) else if(LoadProperties.ptpEnable && label.equalsIgnoreCase(LoadProperties.ptp) && PP.inParty())
{ {
if(!mcPermissions.getInstance().partyTeleport(player)) if(!mcPermissions.getInstance().partyTeleport(player))
{ {
player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission")); player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
@ -1595,6 +1595,25 @@ public class Commands
return true; return true;
} }
} }
else if (LoadProperties.spoutEnabled && label.equalsIgnoreCase("mchud"))
{
if(split.length >= 2)
{
for(HUDType x : HUDType.values())
{
if(x.toString().toLowerCase().equals(split[1].toLowerCase()))
{
if(SpoutStuff.playerHUDs.containsKey(player))
{
SpoutStuff.playerHUDs.get(player).resetHUD();
SpoutStuff.playerHUDs.remove(player);
PP.setHUDType(x);
SpoutStuff.playerHUDs.put(player, new HUDmmo(player));
}
}
}
}
}
return true; return true;
} }
} }

View File

@ -5,9 +5,29 @@ import org.bukkit.util.config.Configuration;
public class LoadProperties public class LoadProperties
{ {
public static Boolean xplockEnable, xpbar, xpicon, partybar, map, string, bucket, web, xprateEnable, slimeballs, spoutEnabled, donateMessage, chimaeraWingEnable, xpGainsMobSpawners, myspawnEnable, mccEnable, mcmmoEnable, partyEnable, inviteEnable, acceptEnable, whoisEnable, statsEnable, addxpEnable, ptpEnable, mmoeditEnable, clearmyspawnEnable, mcgodEnable, mcabilityEnable, mctopEnable, mcrefreshEnable, enableMotd, enableMySpawn, enableRegen, enableCobbleToMossy, useMySQL, cocoabeans, archeryFireRateLimit, mushrooms, toolsLoseDurabilityFromAbilities, pvpxp, miningrequirespickaxe, woodcuttingrequiresaxe, eggs, apples, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages; public static Boolean xplockEnable, xpbar, xpicon, partybar, map, string, bucket, web, xprateEnable, slimeballs, spoutEnabled,
public static String xplock, web_url, MySQLtablePrefix, MySQLuserName, MySQLserverName, MySQLdbName, MySQLdbPass, mctop, addxp, xprate, mcability, mcmmo, mcc, mcrefresh, mcgod, stats, mmoedit, ptp, party, myspawn, whois, invite, accept, clearmyspawn, nWood, nStone, nIron, nGold, nDiamond, locale; donateMessage, chimaeraWingEnable, xpGainsMobSpawners, myspawnEnable, mccEnable, mcmmoEnable, partyEnable, inviteEnable, acceptEnable,
public static int xpbar_x, xpbar_y, xpicon_x, xpicon_y, partybar_x, partybar_y, partybar_spacing, mmap, mstring, mbucket, mweb, archeryLimit, chimaeraId, msandstone, mcocoa, water_thunder, cure_self, cure_other, mslimeballs, mbones, msulphur, mslowsand, mmushroom2, mglowstone2, mmusic, mdiamond2, mbase, mapple, meggs, mcake, mpine, mbirch, mspruce, mcactus, mmushroom, mflower, msugar, mpumpkin, mwheat, mgold, mdiamond, miron, mredstone, mlapis, mobsidian, mnetherrack, mglowstone, mcoal, mstone, MySQLport, xpGainMultiplier, superBreakerCooldown = 240, greenTerraCooldown = 240, gigaDrillBreakerCooldown = 240, treeFellerCooldown = 240, berserkCooldown = 240, serratedStrikeCooldown = 240, skullSplitterCooldown = 240, abilityDurabilityLoss, feathersConsumedByChimaeraWing, pvpxprewardmodifier, repairdiamondlevel, globalxpmodifier, tamingxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, sorceryxpmodifier = 2, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier, rWood, rStone, rIron, rGold, rDiamond; whoisEnable, statsEnable, addxpEnable, ptpEnable, mmoeditEnable, clearmyspawnEnable, mcgodEnable, mcabilityEnable, mctopEnable,
mcrefreshEnable, enableMotd, enableMySpawn, enableRegen, enableCobbleToMossy, useMySQL, cocoabeans, archeryFireRateLimit, mushrooms,
toolsLoseDurabilityFromAbilities, pvpxp, miningrequirespickaxe, woodcuttingrequiresaxe, eggs, apples, cake, music, diamond, glowstone,
slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages;
public static String xplock, web_url, MySQLtablePrefix, MySQLuserName, MySQLserverName, MySQLdbName, MySQLdbPass, mctop, addxp,
xprate, mcability, mcmmo, mcc, mcrefresh, mcgod, stats, mmoedit, ptp, party, myspawn, whois, invite, accept, clearmyspawn, nWood,
nStone, nIron, nGold, nDiamond, locale;
public static int xpbar_x, xpbar_y, xpicon_x, xpicon_y, partybar_x, partybar_y, partybar_spacing, mmap, mstring, mbucket, mweb,
archeryLimit, chimaeraId, msandstone, mcocoa, water_thunder, cure_self, cure_other, mslimeballs, mbones, msulphur, mslowsand,
mmushroom2, mglowstone2, mmusic, mdiamond2, mbase, mapple, meggs, mcake, mpine, mbirch, mspruce, mcactus, mmushroom, mflower,
msugar, mpumpkin, mwheat, mgold, mdiamond, miron, mredstone, mlapis, mobsidian, mnetherrack, mglowstone, mcoal, mstone, MySQLport,
xpGainMultiplier, superBreakerCooldown, greenTerraCooldown, gigaDrillBreakerCooldown, treeFellerCooldown,
berserkCooldown, serratedStrikeCooldown, skullSplitterCooldown, abilityDurabilityLoss,
feathersConsumedByChimaeraWing, repairdiamondlevel, rWood, rStone, rIron, rGold, rDiamond;
public static double pvpxprewardmodifier, globalxpmodifier, tamingxpmodifier, miningxpmodifier,
repairxpmodifier, woodcuttingxpmodifier, sorceryxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier,
archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier;
public String directory = "plugins/mcMMO/"; public String directory = "plugins/mcMMO/";
File file = new File(directory + File.separator + "config.yml"); File file = new File(directory + File.separator + "config.yml");
Configuration config = null; Configuration config = null;
@ -46,6 +66,12 @@ public class LoadProperties
config.save(); config.save();
return result; return result;
} }
private Double readDouble(String root, Double def)
{
Double result = config.getDouble(root, def);
config.save();
return result;
}
private Integer readInteger(String root, Integer def) private Integer readInteger(String root, Integer def)
{ {
//Configuration config = load(); //Configuration config = load();
@ -107,60 +133,60 @@ public class LoadProperties
write("Items.Chimaera_Wing.Feather_Cost", 10); write("Items.Chimaera_Wing.Feather_Cost", 10);
write("Items.Chimaera_Wing.Item_ID", 288); write("Items.Chimaera_Wing.Item_ID", 288);
write("XP.PVP.Rewards", true); write("Experience.PVP.Rewards", true);
write("XP.Gains.Multiplier.PVP", 1); write("Experience.Gains.Multiplier.PVP", 1);
write("XP.Gains.Mobspawners.Enabled", false); write("Experience.Gains.Mobspawners.Enabled", false);
write("XP.Gains.Multiplier.Global", 1); write("Experience.Gains.Multiplier.Global", 1);
write("XP.Formula.Multiplier.Global", 1); write("Experience.Formula.Multiplier.Global", 1);
write("XP.Formula.Multiplier.Taming", 2); write("Experience.Formula.Multiplier.Taming", 2);
write("XP.Formula.Multiplier.Mining", 2); write("Experience.Formula.Multiplier.Mining", 2);
write("XP.Formula.Multiplier.Repair", 2); write("Experience.Formula.Multiplier.Repair", 2);
write("XP.Formula.Multiplier.Woodcutting", 2); write("Experience.Formula.Multiplier.Woodcutting", 2);
write("XP.Formula.Multiplier.Unarmed", 2); write("Experience.Formula.Multiplier.Unarmed", 2);
write("XP.Formula.Multiplier.Herbalism", 2); write("Experience.Formula.Multiplier.Herbalism", 2);
write("XP.Formula.Multiplier.Excavation", 2); write("Experience.Formula.Multiplier.Excavation", 2);
write("XP.Formula.Multiplier.Swords", 2); write("Experience.Formula.Multiplier.Swords", 2);
write("XP.Formula.Multiplier.Archery", 2); write("Experience.Formula.Multiplier.Archery", 2);
write("XP.Formula.Multiplier.Axes", 2); write("Experience.Formula.Multiplier.Axes", 2);
write("XP.Formula.Multiplier.Sorcery", 2); write("Experience.Formula.Multiplier.Sorcery", 2);
write("XP.Formula.Multiplier.Acrobatics", 2); write("Experience.Formula.Multiplier.Acrobatics", 2);
write("XP.Mining.Gold", 35); write("Experience.Mining.Gold", 35);
write("XP.Mining.Diamond", 75); write("Experience.Mining.Diamond", 75);
write("XP.Mining.Iron", 25); write("Experience.Mining.Iron", 25);
write("XP.Mining.Redstone", 15); write("Experience.Mining.Redstone", 15);
write("XP.Mining.lapis", 40); write("Experience.Mining.lapis", 40);
write("XP.Mining.Obsidian", 15); write("Experience.Mining.Obsidian", 15);
write("XP.Mining.Netherrack", 3); write("Experience.Mining.Netherrack", 3);
write("XP.Mining.Glowstone", 3); write("Experience.Mining.Glowstone", 3);
write("XP.Mining.Coal", 10); write("Experience.Mining.Coal", 10);
write("XP.Mining.Stone", 3); write("Experience.Mining.Stone", 3);
write("XP.Mining.Sandstone", 3); write("Experience.Mining.Sandstone", 3);
write("XP.Herbalism.Sugar_Cane", 3); write("Experience.Herbalism.Sugar_Cane", 3);
write("XP.Herbalism.Cactus", 3); write("Experience.Herbalism.Cactus", 3);
write("XP.Herbalism.Pumpkin", 55); write("Experience.Herbalism.Pumpkin", 55);
write("XP.Herbalism.Flowers", 10); write("Experience.Herbalism.Flowers", 10);
write("XP.Herbalism.Wheat", 5); write("Experience.Herbalism.Wheat", 5);
write("XP.Herbalism.Mushrooms", 15); write("Experience.Herbalism.Mushrooms", 15);
write("XP.Woodcutting.Pine", 9); write("Experience.Woodcutting.Pine", 9);
write("XP.Woodcutting.Birch", 7); write("Experience.Woodcutting.Birch", 7);
write("XP.Woodcutting.Spruce", 8); write("Experience.Woodcutting.Spruce", 8);
write("XP.Excavation.Base", 4); write("Experience.Excavation.Base", 4);
write("XP.Excavation.Mushroom", 8); write("Experience.Excavation.Mushroom", 8);
write("XP.Excavation.Sulphur", 3); write("Experience.Excavation.Sulphur", 3);
write("XP.Excavation.Slowsand", 8); write("Experience.Excavation.Slowsand", 8);
write("XP.Excavation.Glowstone", 8); write("Experience.Excavation.Glowstone", 8);
write("XP.Excavation.Music", 300); write("Experience.Excavation.Music", 300);
write("XP.Excavation.Bones", 3); write("Experience.Excavation.Bones", 3);
write("XP.Excavation.Diamond", 100); write("Experience.Excavation.Diamond", 100);
write("XP.Excavation.Apple", 10); write("Experience.Excavation.Apple", 10);
write("XP.Excavation.Eggs", 10); write("Experience.Excavation.Eggs", 10);
write("XP.Excavation.Cake", 300); write("Experience.Excavation.Cake", 300);
write("XP.Excavation.Slimeballs", 10); write("Experience.Excavation.Slimeballs", 10);
write("XP.Excavation.Cocoa_Beans", 10); write("Experience.Excavation.Cocoa_Beans", 10);
write("XP.Excavation.Map", 20); write("Experience.Excavation.Map", 20);
write("XP.Excavation.String", 20); write("Experience.Excavation.String", 20);
write("XP.Excavation.Bucket", 10); write("Experience.Excavation.Bucket", 10);
write("XP.Excavation.Web", 15); write("Experience.Excavation.Web", 15);
//write("Sorcery.Spells.Water.Thunder", 75); //write("Sorcery.Spells.Water.Thunder", 75);
//write("Sorcery.Spells.Curative.Cure_Self.Mana_Cost", 5); //write("Sorcery.Spells.Curative.Cure_Self.Mana_Cost", 5);
@ -271,46 +297,46 @@ public class LoadProperties
partybar_y = readInteger("Spout.Party.HP.Y_POS", 0); partybar_y = readInteger("Spout.Party.HP.Y_POS", 0);
partybar_spacing = readInteger("Spout.Party.HP.SPACING", 16); partybar_spacing = readInteger("Spout.Party.HP.SPACING", 16);
msulphur = readInteger("XP.Excavation.Sulphur", 3); msulphur = readInteger("Experience.Excavation.Sulphur", 30);
mbones = readInteger("XP.Excavation.Bones", 3); mbones = readInteger("Experience.Excavation.Bones", 30);
mbase = readInteger("XP.Excavation.Base", 4); mbase = readInteger("Experience.Excavation.Base", 40);
mmushroom2 = readInteger("XP.Excavation.Mushroom", 8); mmushroom2 = readInteger("Experience.Excavation.Mushroom", 80);
mslowsand = readInteger("XP.Excavation.Slowsand", 8); mslowsand = readInteger("Experience.Excavation.Slowsand", 80);
mglowstone2 = readInteger("XP.Excavation.Glowstone", 8); mglowstone2 = readInteger("Experience.Excavation.Glowstone", 80);
mmusic = readInteger("XP.Excavation.Music", 300); mmusic = readInteger("Experience.Excavation.Music", 3000);
mdiamond2 = readInteger("XP.Excavation.Diamond", 100); mdiamond2 = readInteger("Experience.Excavation.Diamond", 1000);
mapple = readInteger("XP.Excavation.Apple", 10); mapple = readInteger("Experience.Excavation.Apple", 100);
meggs = readInteger("XP.Excavation.Eggs", 10); meggs = readInteger("Experience.Excavation.Eggs", 100);
mcake = readInteger("XP.Excavation.Cake", 300); mcake = readInteger("Experience.Excavation.Cake", 3000);
mcocoa = readInteger("XP.Excavation.Cocoa_Beans", 10); mcocoa = readInteger("Experience.Excavation.Cocoa_Beans", 100);
mslimeballs = readInteger("XP.Excavation.Slimeballs", 10); mslimeballs = readInteger("Experience.Excavation.Slimeballs", 100);
mstring = readInteger("XP.Excavation.String", 20); mstring = readInteger("Experience.Excavation.String", 200);
mbucket = readInteger("XP.Excavation.Bucket", 10); mbucket = readInteger("Experience.Excavation.Bucket", 100);
mweb = readInteger("XP.Excavation.Web", 15); mweb = readInteger("Experience.Excavation.Web", 150);
mmap = readInteger("XP.Excavation.Map", 20); mmap = readInteger("Experience.Excavation.Map", 200);
msugar = readInteger("XP.Herbalism.Sugar_Cane", 3); msugar = readInteger("Experience.Herbalism.Sugar_Cane", 30);
mwheat = readInteger("XP.Herbalism.Wheat", 5); mwheat = readInteger("Experience.Herbalism.Wheat", 50);
mcactus = readInteger("XP.Herbalism.Cactus", 3); mcactus = readInteger("Experience.Herbalism.Cactus", 30);
mpumpkin = readInteger("XP.Herbalism.Pumpkin", 55); mpumpkin = readInteger("Experience.Herbalism.Pumpkin", 550);
mflower = readInteger("XP.Herbalism.Flowers", 10); mflower = readInteger("Experience.Herbalism.Flowers", 100);
mmushroom = readInteger("XP.Herbalism.Mushrooms", 15); mmushroom = readInteger("Experience.Herbalism.Mushrooms", 150);
mpine = readInteger("XP.Woodcutting.Pine", 7); mpine = readInteger("Experience.Woodcutting.Pine", 70);
mbirch = readInteger("XP.Woodcutting.Birch", 8); mbirch = readInteger("Experience.Woodcutting.Birch", 80);
mspruce = readInteger("XP.Woodcutting.Spruce", 9); mspruce = readInteger("Experience.Woodcutting.Spruce", 90);
mgold = readInteger("XP.Mining.Gold", 25); mgold = readInteger("Experience.Mining.Gold", 250);
mdiamond = readInteger("XP.Mining.Diamond", 75); mdiamond = readInteger("Experience.Mining.Diamond", 750);
miron = readInteger("XP.Mining.Iron", 25); miron = readInteger("Experience.Mining.Iron", 250);
mredstone = readInteger("XP.Mining.Redstone", 15); mredstone = readInteger("Experience.Mining.Redstone", 150);
mlapis = readInteger("XP.Mining.lapis", 40); mlapis = readInteger("Experience.Mining.lapis", 400);
mobsidian = readInteger("XP.Mining.Obsidian", 15); mobsidian = readInteger("Experience.Mining.Obsidian", 150);
mnetherrack = readInteger("XP.Mining.Netherrack", 3); mnetherrack = readInteger("Experience.Mining.Netherrack", 30);
mglowstone = readInteger("XP.Mining.Glowstone", 3); mglowstone = readInteger("Experience.Mining.Glowstone", 30);
mcoal = readInteger("XP.Mining.Coal", 10); mcoal = readInteger("Experience.Mining.Coal", 100);
mstone = readInteger("XP.Mining.Stone", 3); mstone = readInteger("Experience.Mining.Stone", 30);
msandstone = readInteger("XP.Mining.Sandstone", 3); msandstone = readInteger("Experience.Mining.Sandstone", 30);
greenTerraCooldown = readInteger("Abilities.Cooldowns.Green_Terra", 240); greenTerraCooldown = readInteger("Abilities.Cooldowns.Green_Terra", 240);
superBreakerCooldown = readInteger("Abilities.Cooldowns.Super_Breaker", 240); superBreakerCooldown = readInteger("Abilities.Cooldowns.Super_Breaker", 240);
@ -341,7 +367,7 @@ public class LoadProperties
archeryFireRateLimit = readBoolean("Skills.Archery.Fire_Rate_Limiter.Enabled", true); archeryFireRateLimit = readBoolean("Skills.Archery.Fire_Rate_Limiter.Enabled", true);
archeryLimit = readInteger("Skills.Archery.Fire_Rate_Limiter.Interval", 1000); archeryLimit = readInteger("Skills.Archery.Fire_Rate_Limiter.Interval", 1000);
xpGainMultiplier = readInteger("XP.Gains.Multiplier.Global", 1); xpGainMultiplier = readInteger("Experience.Gains.Multiplier.Global", 1);
toolsLoseDurabilityFromAbilities = readBoolean("Abilities.Tools.Durability_Loss_Enabled", true); toolsLoseDurabilityFromAbilities = readBoolean("Abilities.Tools.Durability_Loss_Enabled", true);
abilityDurabilityLoss = readInteger("Abilities.Tools.Durability_Loss", 2); abilityDurabilityLoss = readInteger("Abilities.Tools.Durability_Loss", 2);
@ -350,24 +376,24 @@ public class LoadProperties
chimaeraWingEnable = readBoolean("Items.Chimaera_Wing.Enabled", true); chimaeraWingEnable = readBoolean("Items.Chimaera_Wing.Enabled", true);
pvpxp = readBoolean("XP.PVP.Rewards", true); pvpxp = readBoolean("XP.PVP.Rewards", true);
pvpxprewardmodifier = readInteger("XP.Gains.Multiplier.PVP", 1); pvpxprewardmodifier = readDouble("Experience.Gains.Multiplier.PVP", 1.0);
miningrequirespickaxe = readBoolean("Skills.Mining.Requires_Pickaxe", true); miningrequirespickaxe = readBoolean("Skills.Mining.Requires_Pickaxe", true);
woodcuttingrequiresaxe = readBoolean("Skills.Woodcutting.Requires_Axe", true); woodcuttingrequiresaxe = readBoolean("Skills.Woodcutting.Requires_Axe", true);
repairdiamondlevel = readInteger("Skills.Repair.Diamond.Level_Required", 50); repairdiamondlevel = readInteger("Skills.Repair.Diamond.Level_Required", 50);
globalxpmodifier = readInteger("XP.Formula.Multiplier.Global", 1); globalxpmodifier = readDouble("Experience.Formula.Multiplier.Global", 1.0);
sorceryxpmodifier = readInteger("XP.Formula.Multiplier.Sorcery", 2); sorceryxpmodifier = readDouble("Experience.Formula.Multiplier.Sorcery", 1.0);
tamingxpmodifier = readInteger("XP.Formula.Multiplier.Taming", 2); tamingxpmodifier = readDouble("Experience.Formula.Multiplier.Taming", 1.0);
miningxpmodifier = readInteger("XP.Formula.Multiplier.Mining", 2); miningxpmodifier = readDouble("Experience.Formula.Multiplier.Mining", 1.0);
repairxpmodifier = readInteger("XP.Formula.Multiplier.Repair", 2); repairxpmodifier = readDouble("Experience.Formula.Multiplier.Repair", 1.0);
woodcuttingxpmodifier = readInteger("XP.Formula.Multiplier.Woodcutting", 2); woodcuttingxpmodifier = readDouble("Experience.Formula.Multiplier.Woodcutting", 1.0);
unarmedxpmodifier = readInteger("XP.Formula.Multiplier.Unarmed", 2); unarmedxpmodifier = readDouble("Experience.Formula.Multiplier.Unarmed", 1.0);
herbalismxpmodifier = readInteger("XP.Formula.Multiplier.Herbalism", 2); herbalismxpmodifier = readDouble("Experience.Formula.Multiplier.Herbalism", 1.0);
excavationxpmodifier = readInteger("XP.Formula.Multiplier.Excavation", 2); excavationxpmodifier = readDouble("Experience.Formula.Multiplier.Excavation", 1.0);
archeryxpmodifier = readInteger("XP.Formula.Multiplier.Archery", 2); archeryxpmodifier = readDouble("Experience.Formula.Multiplier.Archery", 1.0);
swordsxpmodifier = readInteger("XP.Formula.Multiplier.Swords", 2); swordsxpmodifier = readDouble("Experience.Formula.Multiplier.Swords", 1.0);
axesxpmodifier = readInteger("XP.Formula.Multiplier.Axes", 2); axesxpmodifier = readDouble("Experience.Formula.Multiplier.Axes", 1.0);
acrobaticsxpmodifier = readInteger("XP.Formula.Multiplier.Acrobatics", 2); acrobaticsxpmodifier = readDouble("Experience.Formula.Multiplier.Acrobatics", 1.0);
anvilmessages = readBoolean("Skills.Repair.Anvil_Messages", true); anvilmessages = readBoolean("Skills.Repair.Anvil_Messages", true);

View File

@ -0,0 +1,203 @@
package com.gmail.nossr50.datatypes;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.getspout.spoutapi.SpoutManager;
import org.getspout.spoutapi.gui.Color;
import org.getspout.spoutapi.gui.GenericGradient;
import org.getspout.spoutapi.gui.GenericTexture;
import org.getspout.spoutapi.gui.RenderPriority;
import org.getspout.spoutapi.gui.Widget;
import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.spout.SpoutStuff;
public class HUDmmo
{
String playerName = null;
Widget xpbar = null;
GenericGradient xpfill = null;
GenericGradient xpbg = null;
GenericTexture xpicon = null;
mcMMO plugin = (mcMMO) Bukkit.getServer().getPluginManager().getPlugin("mcMMO");
public HUDmmo(Player player)
{
playerName = player.getName();
initializeHUD(player);
}
public void initializeHUD(Player player)
{
HUDType type = Users.getProfile(player).getHUDType();
switch(type)
{
case RETRO:
{
initializeXpBarDisplayRetro(SpoutManager.getPlayer(player));
break;
}
case STANDARD:
{
initializeXpBarDisplayStandard(SpoutManager.getPlayer(player));
break;
}
case SMALL:
{
initializeXpBarDisplaySmall(SpoutManager.getPlayer(player));
break;
}
}
}
public void updateXpBarDisplay(HUDType type, Player player)
{
switch(type)
{
case RETRO:
{
updateXpBarRetro(player, Users.getProfile(player));
break;
}
case STANDARD:
{
updateXpBarStandard(player, Users.getProfile(player));
break;
}
case SMALL:
{
break;
}
}
}
public void resetHUD()
{
SpoutPlayer sPlayer = SpoutStuff.getSpoutPlayer(playerName);
if(sPlayer != null)
{
sPlayer.getMainScreen().removeWidgets(plugin);
//Reset the objects
xpbar = null;
xpfill = null;
xpbg = null;
xpicon = null;
sPlayer.getMainScreen().setDirty(true);
}
}
private void initializeXpBarDisplayRetro(SpoutPlayer sPlayer)
{
Color black = new Color(0, 0, 0, 1f);
Color green = new Color(0, 1f, 0, 1f);
Color gray = new Color(0.75f, 0.75f, 0.75f, 1f);
xpicon = new GenericTexture();
xpbar = new GenericGradient();
xpfill = new GenericGradient();
xpbg = new GenericGradient();
xpicon.setWidth(6).setHeight(6).setX(149-6).setY(9).setDirty(true);
xpicon.setUrl(LoadProperties.web_url+"HUD/Retro/Icon_r.png");
xpbar.setWidth(128).setHeight(4).setX(149).setY(10);
((GenericGradient) xpbar).setBottomColor(black).setTopColor(black).setPriority(RenderPriority.Highest).setDirty(true);
xpfill.setWidth(0).setHeight(2).setX(150).setY(11);
xpfill.setBottomColor(green).setTopColor(green).setPriority(RenderPriority.Lowest).setDirty(true);
xpbg.setWidth(126).setHeight(2).setX(150).setY(11);
xpbg.setBottomColor(gray).setTopColor(gray).setPriority(RenderPriority.Low).setDirty(true);
sPlayer.getMainScreen().attachWidget(plugin, (GenericGradient)xpbar);
sPlayer.getMainScreen().attachWidget(plugin, (GenericGradient)xpfill);
sPlayer.getMainScreen().attachWidget(plugin, (GenericGradient)xpbg);
sPlayer.getMainScreen().attachWidget(plugin, (GenericTexture)xpicon);
sPlayer.getMainScreen().setDirty(true);
}
private void initializeXpBarDisplayStandard(SpoutPlayer sPlayer)
{
//Setup xp bar
xpbar = new GenericTexture();
if(LoadProperties.xpicon)
{
xpicon = new GenericTexture();
xpicon.setUrl(LoadProperties.web_url+"HUD/Standard/Icon.png");
xpicon.setHeight(16).setWidth(32).setX(LoadProperties.xpicon_x).setY(LoadProperties.xpicon_y);
xpicon.setDirty(true);
sPlayer.getMainScreen().attachWidget(plugin, xpicon);
}
((GenericTexture)xpbar).setUrl(LoadProperties.web_url+"HUD/Standard/xpbar_inc000.png");
xpbar.setX(LoadProperties.xpbar_x).setY(LoadProperties.xpbar_y).setHeight(8).setWidth(256);
sPlayer.getMainScreen().attachWidget(plugin, xpbar);
sPlayer.getMainScreen().setDirty(true);
}
private void initializeXpBarDisplaySmall(SpoutPlayer sPlayer)
{
//Coordinates 240, 427 are the bottom right.
GenericTexture xpbar = new GenericTexture();
GenericTexture xpbar_fill = new GenericTexture();
xpbar.setUrl("http://dl.dropbox.com/u/18212134/xpbar/mini/bar.png");
xpbar_fill.setUrl("http://dl.dropbox.com/u/18212134/xpbar/mini/bar_fill.png");
xpbar.setWidth(128).setHeight(4).setX(149).setY(10).setDirty(true);
xpbar_fill.setWidth(2).setHeight(2).setX(150).setY(11).setPriority(RenderPriority.High).setDirty(true);
sPlayer.getMainScreen().attachWidget(plugin, xpbar);
sPlayer.getMainScreen().attachWidget(plugin, xpbar_fill);
sPlayer.getMainScreen().setDirty(true);
}
private void updateXpBarStandard(Player player, PlayerProfile PP)
{
SkillType theType = null;
if(PP.getXpBarLocked())
theType=PP.getSkillLock();
else
theType=PP.getLastGained();
((GenericTexture) xpicon).setUrl(LoadProperties.web_url+"HUD/Standard/"+m.getCapitalized(theType.toString())+".png");
xpicon.setDirty(true);
((GenericTexture) xpbar).setUrl(SpoutStuff.getUrlBar(SpoutStuff.getXpInc(PP.getSkillXpLevel(theType), PP.getXpToLevel(theType), HUDType.STANDARD)));
xpbar.setDirty(true);
SpoutManager.getPlayer(player).getMainScreen().setDirty(true);
}
private void updateXpBarRetro(Player player, PlayerProfile PP)
{
SkillType theType = null;
if(PP.getXpBarLocked())
theType=PP.getSkillLock();
else
theType=PP.getLastGained();
Color color = SpoutStuff.getRetroColor(theType);
((GenericTexture) xpicon).setUrl(LoadProperties.web_url+"HUD/Retro/"+m.getCapitalized(theType.toString())+"_r.png");
xpfill.setBottomColor(color).setTopColor(color).setWidth(SpoutStuff.getXpInc(PP.getSkillXpLevel(theType), PP.getXpToLevel(theType), HUDType.RETRO)).setDirty(true);
SpoutManager.getPlayer(player).getMainScreen().setDirty(true);
}
}

View File

@ -14,7 +14,6 @@ import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.m; import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
@ -24,11 +23,14 @@ public class PlayerProfile
{ {
protected final Logger log = Logger.getLogger("Minecraft"); protected final Logger log = Logger.getLogger("Minecraft");
//HUD
private HUDType hud = HUDType.RETRO;
//MISC //MISC
private String party, myspawn, myspawnworld, invite; private String party, myspawn, myspawnworld, invite;
//TOGGLES //TOGGLES
private boolean xpbarlocked = false, placedAnvil = false, partyChatMode = false, adminChatMode = false, godMode = false, greenTerraMode, partyChatOnly = false, greenTerraInformed = true, berserkInformed = true, skullSplitterInformed = true, gigaDrillBreakerInformed = true, private boolean spoutcraft = false, filling = false, xpbarlocked = false, placedAnvil = false, partyChatMode = false, adminChatMode = false, godMode = false, greenTerraMode, partyChatOnly = false, greenTerraInformed = true, berserkInformed = true, skullSplitterInformed = true, gigaDrillBreakerInformed = true,
superBreakerInformed = true, serratedStrikesInformed = true, treeFellerInformed = true, dead, abilityuse = true, treeFellerMode, superBreakerMode, gigaDrillBreakerMode, superBreakerInformed = true, serratedStrikesInformed = true, treeFellerInformed = true, dead, abilityuse = true, treeFellerMode, superBreakerMode, gigaDrillBreakerMode,
serratedStrikesMode, hoePreparationMode = false, shovelPreparationMode = false, swordsPreparationMode = false, fistsPreparationMode = false, pickaxePreparationMode = false, axePreparationMode = false, skullSplitterMode, berserkMode; serratedStrikesMode, hoePreparationMode = false, shovelPreparationMode = false, swordsPreparationMode = false, fistsPreparationMode = false, pickaxePreparationMode = false, axePreparationMode = false, skullSplitterMode, berserkMode;
@ -424,6 +426,27 @@ public class PlayerProfile
log.log(Level.SEVERE, "Exception while writing to " + location + " (Are you sure you formatted it correctly?)", e); log.log(Level.SEVERE, "Exception while writing to " + location + " (Are you sure you formatted it correctly?)", e);
} }
} }
public void toggleSpoutEnabled()
{
spoutcraft = !spoutcraft;
}
public boolean isFilling()
{
return filling;
}
public void toggleFilling()
{
filling = !filling;
}
public HUDType getHUDType()
{
return hud;
}
public void setHUDType(HUDType type)
{
hud = type;
}
public boolean getXpBarLocked() public boolean getXpBarLocked()
{ {
return xpbarlocked; return xpbarlocked;
@ -857,30 +880,61 @@ public class PlayerProfile
{ {
if(skillType == SkillType.ALL) if(skillType == SkillType.ALL)
{ {
skillsXp.put(SkillType.TAMING, skillsXp.get(SkillType.TAMING)+newvalue); for(SkillType x : SkillType.values())
skillsXp.put(SkillType.MINING, skillsXp.get(SkillType.MINING)+newvalue); {
skillsXp.put(SkillType.WOODCUTTING, skillsXp.get(SkillType.WOODCUTTING)+newvalue); if(x == SkillType.ALL)
skillsXp.put(SkillType.REPAIR, skillsXp.get(SkillType.REPAIR)+newvalue); continue;
skillsXp.put(SkillType.HERBALISM, skillsXp.get(SkillType.HERBALISM)+newvalue); skillsXp.put(x, skillsXp.get(x)+newvalue);
skillsXp.put(SkillType.ACROBATICS, skillsXp.get(SkillType.ACROBATICS)+newvalue); }
skillsXp.put(SkillType.SWORDS, skillsXp.get(SkillType.SWORDS)+newvalue);
skillsXp.put(SkillType.ARCHERY, skillsXp.get(SkillType.ARCHERY)+newvalue);
skillsXp.put(SkillType.UNARMED, skillsXp.get(SkillType.UNARMED)+newvalue);
skillsXp.put(SkillType.EXCAVATION, skillsXp.get(SkillType.EXCAVATION)+newvalue);
skillsXp.put(SkillType.AXES, skillsXp.get(SkillType.AXES)+newvalue);
skillsXp.put(SkillType.SORCERY, skillsXp.get(SkillType.SORCERY)+newvalue);
} else { } else {
skillsXp.put(skillType, skillsXp.get(skillType)+newvalue); int xp = newvalue;
switch(skillType)
{
case TAMING:
xp=(int) (xp/LoadProperties.tamingxpmodifier);
break;
case MINING:
xp=(int) (xp/LoadProperties.miningxpmodifier);
break;
case WOODCUTTING:
xp=(int) (xp/LoadProperties.woodcuttingxpmodifier);
break;
case REPAIR:
xp=(int) (xp/LoadProperties.repairxpmodifier);
break;
case HERBALISM:
xp=(int) (xp/LoadProperties.herbalismxpmodifier);
break;
case ACROBATICS:
xp=(int) (xp/LoadProperties.acrobaticsxpmodifier);
break;
case SWORDS:
xp=(int) (xp/LoadProperties.swordsxpmodifier);
break;
case ARCHERY:
xp=(int) (xp/LoadProperties.archeryxpmodifier);
break;
case UNARMED:
xp=(int) (xp/LoadProperties.unarmedxpmodifier);
break;
case EXCAVATION:
xp=(int) (xp/LoadProperties.excavationxpmodifier);
break;
case AXES:
xp=(int) (xp/LoadProperties.axesxpmodifier);
break;
case SORCERY:
xp=(int) (xp/LoadProperties.sorceryxpmodifier);
break;
}
skillsXp.put(skillType, skillsXp.get(skillType)+xp);
if(LoadProperties.spoutEnabled) if(LoadProperties.spoutEnabled)
{ {
SkillType prevLastGained = lastgained;
lastgained = skillType; lastgained = skillType;
//switch
//In case of an xp bar switch
if(prevLastGained != skillType || prevLastGained == null)
xpbarinc = SpoutStuff.getXpInc(this.getSkillXpLevel(lastgained), this.getXpToLevel(lastgained));
} }
} }
//save(); //save();
@ -954,36 +1008,8 @@ public class PlayerProfile
} }
public Integer getXpToLevel(SkillType skillType) public Integer getXpToLevel(SkillType skillType)
{ {
switch(skillType) return (int) ((100+(skills.get(skillType) * LoadProperties.globalxpmodifier))*10);
{ }
case SORCERY:
return 100+(skills.get(skillType) * LoadProperties.sorceryxpmodifier * LoadProperties.globalxpmodifier);
case TAMING:
return 100+(skills.get(skillType) * LoadProperties.tamingxpmodifier * LoadProperties.globalxpmodifier);
case MINING:
return 100+(skills.get(skillType) * LoadProperties.miningxpmodifier * LoadProperties.globalxpmodifier);
case WOODCUTTING:
return 100+(skills.get(skillType) * LoadProperties.woodcuttingxpmodifier * LoadProperties.globalxpmodifier);
case REPAIR:
return 100+(skills.get(skillType) * LoadProperties.repairxpmodifier * LoadProperties.globalxpmodifier);
case HERBALISM:
return 100+(skills.get(skillType) * LoadProperties.herbalismxpmodifier * LoadProperties.globalxpmodifier);
case ACROBATICS:
return 100+(skills.get(skillType) * LoadProperties.acrobaticsxpmodifier * LoadProperties.globalxpmodifier);
case SWORDS:
return 100+(skills.get(skillType) * LoadProperties.swordsxpmodifier * LoadProperties.globalxpmodifier);
case ARCHERY:
return 100+(skills.get(skillType) * LoadProperties.archeryxpmodifier * LoadProperties.globalxpmodifier);
case UNARMED:
return 100+(skills.get(skillType) * LoadProperties.unarmedxpmodifier * LoadProperties.globalxpmodifier);
case EXCAVATION:
return 100+(skills.get(skillType) * LoadProperties.excavationxpmodifier * LoadProperties.globalxpmodifier);
case AXES:
return 100+(skills.get(skillType) * LoadProperties.axesxpmodifier * LoadProperties.globalxpmodifier);
default:
return null;
}
}
//Store the player's party //Store the player's party
public void setParty(String newParty) public void setParty(String newParty)

View File

@ -157,13 +157,13 @@ public class mcBlockListener extends BlockListener
WoodCutting.woodCuttingProcCheck(player, block); WoodCutting.woodCuttingProcCheck(player, block);
//Default //Default
if(block.getData() == (byte)0) if(block.getData() == (byte)0)
PP.addXP(SkillType.WOODCUTTING, LoadProperties.mpine * LoadProperties.xpGainMultiplier); PP.addXP(SkillType.WOODCUTTING, LoadProperties.mpine);
//Spruce //Spruce
if(block.getData() == (byte)1) if(block.getData() == (byte)1)
PP.addXP(SkillType.WOODCUTTING, LoadProperties.mspruce * LoadProperties.xpGainMultiplier); PP.addXP(SkillType.WOODCUTTING, LoadProperties.mspruce);
//Birch //Birch
if(block.getData() == (byte)2) if(block.getData() == (byte)2)
PP.addXP(SkillType.WOODCUTTING, LoadProperties.mbirch * LoadProperties.xpGainMultiplier); PP.addXP(SkillType.WOODCUTTING, LoadProperties.mbirch);
} }
} }
} else } else
@ -173,13 +173,13 @@ public class mcBlockListener extends BlockListener
WoodCutting.woodCuttingProcCheck(player, block); WoodCutting.woodCuttingProcCheck(player, block);
//Default //Default
if(block.getData() == (byte)0) if(block.getData() == (byte)0)
PP.addXP(SkillType.WOODCUTTING, LoadProperties.mpine * LoadProperties.xpGainMultiplier); PP.addXP(SkillType.WOODCUTTING, LoadProperties.mpine);
//Spruce //Spruce
if(block.getData() == (byte)1) if(block.getData() == (byte)1)
PP.addXP(SkillType.WOODCUTTING, LoadProperties.mspruce * LoadProperties.xpGainMultiplier); PP.addXP(SkillType.WOODCUTTING, LoadProperties.mspruce);
//Birch //Birch
if(block.getData() == (byte)2) if(block.getData() == (byte)2)
PP.addXP(SkillType.WOODCUTTING, LoadProperties.mbirch * LoadProperties.xpGainMultiplier); PP.addXP(SkillType.WOODCUTTING, LoadProperties.mbirch);
} }
} }
Skills.XpCheckSkill(SkillType.WOODCUTTING, player); Skills.XpCheckSkill(SkillType.WOODCUTTING, player);
@ -316,8 +316,10 @@ public class mcBlockListener extends BlockListener
Material mat = Material.getMaterial(block.getTypeId()); Material mat = Material.getMaterial(block.getTypeId());
if(block.getTypeId() == 2) if(block.getType() == Material.GRASS)
mat = Material.DIRT; mat = Material.DIRT;
if(block.getType() == Material.CLAY)
mat = Material.CLAY_BALL;
byte type = block.getData(); byte type = block.getData();
ItemStack item = new ItemStack(mat, 1, (byte)0, type); ItemStack item = new ItemStack(mat, 1, (byte)0, type);
@ -329,7 +331,16 @@ public class mcBlockListener extends BlockListener
if(LoadProperties.toolsLoseDurabilityFromAbilities) if(LoadProperties.toolsLoseDurabilityFromAbilities)
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss); m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item); if(item.getType() == Material.CLAY_BALL)
{
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
} else
{
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
}
//Spout stuff //Spout stuff
if(LoadProperties.spoutEnabled) if(LoadProperties.spoutEnabled)
@ -344,15 +355,31 @@ public class mcBlockListener extends BlockListener
&& (Excavation.canBeGigaDrillBroken(block) || block.getTypeId() == 78)) && (Excavation.canBeGigaDrillBroken(block) || block.getTypeId() == 78))
{ {
Material mat = Material.getMaterial(block.getTypeId()); Material mat = Material.getMaterial(block.getTypeId());
if(block.getTypeId() == 2) if(block.getTypeId() == 2)
mat = Material.DIRT; mat = Material.DIRT;
if(block.getTypeId() == 78) if(block.getTypeId() == 78)
mat = Material.SNOW_BALL; mat = Material.SNOW_BALL;
if(block.getTypeId() == 82)
mat = Material.CLAY_BALL;
byte type = block.getData(); byte type = block.getData();
ItemStack item = new ItemStack(mat, 1, (byte)0, type); ItemStack item = new ItemStack(mat, 1, (byte)0, type);
player.incrementStatistic(Statistic.MINE_BLOCK, event.getBlock().getType()); player.incrementStatistic(Statistic.MINE_BLOCK, event.getBlock().getType());
block.setType(Material.AIR); block.setType(Material.AIR);
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
if(item.getType() == Material.CLAY_BALL)
{
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
} else
{
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
}
if(LoadProperties.spoutEnabled) if(LoadProperties.spoutEnabled)
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation()); SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());

View File

@ -55,7 +55,6 @@ public class mcPlayerListener extends PlayerListener
} }
} }
public void onPlayerRespawn(PlayerRespawnEvent event) public void onPlayerRespawn(PlayerRespawnEvent event)
{ {
@ -103,10 +102,8 @@ public class mcPlayerListener extends PlayerListener
if(LoadProperties.spoutEnabled) if(LoadProperties.spoutEnabled)
{ {
if(SpoutStuff.xpbars.containsKey(event.getPlayer())) if(SpoutStuff.playerHUDs.containsKey(player))
SpoutStuff.xpbars.remove(event.getPlayer()); SpoutStuff.playerHUDs.remove(player);
if(SpoutStuff.xpicons.containsKey(event.getPlayer()))
SpoutStuff.xpicons.remove(event.getPlayer());
if(SpoutStuff.partyHealthBars.containsKey(event.getPlayer())) if(SpoutStuff.partyHealthBars.containsKey(event.getPlayer()))
SpoutStuff.partyHealthBars.remove(event.getPlayer()); SpoutStuff.partyHealthBars.remove(event.getPlayer());
} }
@ -213,7 +210,9 @@ public class mcPlayerListener extends PlayerListener
{ {
Skills.hoeReadinessCheck(player); Skills.hoeReadinessCheck(player);
Skills.abilityActivationCheck(player); Skills.abilityActivationCheck(player);
}
if(action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK)
{
/* /*
* HERBALISM MODIFIERS * HERBALISM MODIFIERS
*/ */

View File

@ -6,6 +6,7 @@ import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.Users; import com.gmail.nossr50.Users;
import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.HUDmmo;
import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.spout.SpoutStuff;
public class mcSpoutListener extends SpoutListener public class mcSpoutListener extends SpoutListener
@ -16,12 +17,12 @@ public class mcSpoutListener extends SpoutListener
if(sPlayer.isSpoutCraftEnabled()) if(sPlayer.isSpoutCraftEnabled())
{ {
//Setup Party HUD stuff //Setup Party HUD stuff
SpoutStuff.playerHUDs.put(sPlayer, new HUDmmo(sPlayer));
if(LoadProperties.partybar && Users.getProfile(sPlayer).inParty()) if(LoadProperties.partybar && Users.getProfile(sPlayer).inParty())
SpoutStuff.initializePartyTracking(sPlayer); SpoutStuff.initializePartyTracking(sPlayer);
//Setup player XP-Bar & XP-Icon Users.getProfile(sPlayer).toggleSpoutEnabled();
if(LoadProperties.xpbar)
SpoutStuff.initializeXpBarDisplay(sPlayer);
} }
} }
} }

View File

@ -7,7 +7,6 @@ import org.bukkit.event.entity.EntityDamageEvent;
import com.gmail.nossr50.Users; import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcPermissions; import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
@ -37,7 +36,7 @@ public class Acrobatics {
*/ */
if(player.getHealth() - newDamage >= 1){ if(player.getHealth() - newDamage >= 1){
if(!event.isCancelled()) if(!event.isCancelled())
PP.addXP(SkillType.ACROBATICS, (event.getDamage() * 8) * LoadProperties.xpGainMultiplier); PP.addXP(SkillType.ACROBATICS, (event.getDamage() * 8));
Skills.XpCheckSkill(SkillType.ACROBATICS, player); Skills.XpCheckSkill(SkillType.ACROBATICS, player);
event.setDamage(newDamage); event.setDamage(newDamage);
if(event.getDamage() <= 0) if(event.getDamage() <= 0)
@ -50,7 +49,7 @@ public class Acrobatics {
} }
} else if (!event.isCancelled()){ } else if (!event.isCancelled()){
if(player.getHealth() - event.getDamage() >= 1){ if(player.getHealth() - event.getDamage() >= 1){
PP.addXP(SkillType.ACROBATICS, (event.getDamage() * 12) * LoadProperties.xpGainMultiplier); PP.addXP(SkillType.ACROBATICS, (event.getDamage() * 12));
Skills.XpCheckSkill(SkillType.ACROBATICS, player); Skills.XpCheckSkill(SkillType.ACROBATICS, player);
} }
} }

View File

@ -8,7 +8,6 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.map.MapView; import org.bukkit.map.MapView;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.Users; import com.gmail.nossr50.Users;
import com.gmail.nossr50.m; import com.gmail.nossr50.m;
@ -75,13 +74,13 @@ public class Excavation
//CHANCE TO GET EGGS //CHANCE TO GET EGGS
if(LoadProperties.eggs == true && Math.random() * 100 > 99) if(LoadProperties.eggs == true && Math.random() * 100 > 99)
{ {
xp+= LoadProperties.meggs * LoadProperties.xpGainMultiplier; xp+= LoadProperties.meggs;
is.add(new ItemStack(Material.EGG, 1, (byte)0, (byte)0)); is.add(new ItemStack(Material.EGG, 1, (byte)0, (byte)0));
} }
//CHANCE TO GET APPLES //CHANCE TO GET APPLES
if(LoadProperties.apples == true && Math.random() * 100 > 99) if(LoadProperties.apples == true && Math.random() * 100 > 99)
{ {
xp+= LoadProperties.mapple * LoadProperties.xpGainMultiplier; xp+= LoadProperties.mapple;
is.add(new ItemStack(Material.APPLE, 1, (byte)0, (byte)0)); is.add(new ItemStack(Material.APPLE, 1, (byte)0, (byte)0));
} }
} }
@ -90,7 +89,7 @@ public class Excavation
//CHANCE TO GET NETHERRACK //CHANCE TO GET NETHERRACK
if(LoadProperties.netherrack == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 850 && Math.random() * 200 > 199) if(LoadProperties.netherrack == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 850 && Math.random() * 200 > 199)
{ {
xp+= LoadProperties.mnetherrack * LoadProperties.xpGainMultiplier; xp+= LoadProperties.mnetherrack;
is.add(new ItemStack(Material.NETHERRACK, 1, (byte)0, (byte)0)); is.add(new ItemStack(Material.NETHERRACK, 1, (byte)0, (byte)0));
} }
@ -99,7 +98,7 @@ public class Excavation
{ {
if(Math.random() * 10 > 9) if(Math.random() * 10 > 9)
{ {
xp+= LoadProperties.msulphur * LoadProperties.xpGainMultiplier; xp+= LoadProperties.msulphur;
is.add(new ItemStack(Material.SULPHUR, 1, (byte)0, (byte)0)); is.add(new ItemStack(Material.SULPHUR, 1, (byte)0, (byte)0));
} }
} }
@ -108,7 +107,7 @@ public class Excavation
{ {
if(Math.random() * 10 > 9) if(Math.random() * 10 > 9)
{ {
xp+= LoadProperties.mbones * LoadProperties.xpGainMultiplier; xp+= LoadProperties.mbones;
is.add(new ItemStack(Material.BONE, 1, (byte)0, (byte)0)); is.add(new ItemStack(Material.BONE, 1, (byte)0, (byte)0));
} }
} }
@ -117,14 +116,14 @@ public class Excavation
//CHANCE TO GET GLOWSTONE //CHANCE TO GET GLOWSTONE
if(LoadProperties.glowstone == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 50 && Math.random() * 100 > 95) if(LoadProperties.glowstone == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 50 && Math.random() * 100 > 95)
{ {
xp+= LoadProperties.mglowstone2 * LoadProperties.xpGainMultiplier; xp+= LoadProperties.mglowstone2;
is.add(new ItemStack(Material.GLOWSTONE_DUST, 1, (byte)0, (byte)0)); is.add(new ItemStack(Material.GLOWSTONE_DUST, 1, (byte)0, (byte)0));
} }
//CHANCE TO GET SOUL SAND //CHANCE TO GET SOUL SAND
if(LoadProperties.slowsand == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 650 && Math.random() * 200 > 199) if(LoadProperties.slowsand == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 650 && Math.random() * 200 > 199)
{ {
xp+= LoadProperties.mslowsand * LoadProperties.xpGainMultiplier; xp+= LoadProperties.mslowsand;
is.add(new ItemStack(Material.SOUL_SAND, 1, (byte)0, (byte)0)); is.add(new ItemStack(Material.SOUL_SAND, 1, (byte)0, (byte)0));
} }
break; break;
@ -133,7 +132,7 @@ public class Excavation
{ {
if(Math.random() * 20 > 19) if(Math.random() * 20 > 19)
{ {
xp+= LoadProperties.mslimeballs * LoadProperties.xpGainMultiplier; xp+= LoadProperties.mslimeballs;
is.add(new ItemStack(Material.SLIME_BALL, 1, (byte)0, (byte)0)); is.add(new ItemStack(Material.SLIME_BALL, 1, (byte)0, (byte)0));
} }
} }
@ -141,7 +140,7 @@ public class Excavation
{ {
if(Math.random() * 20 > 19) if(Math.random() * 20 > 19)
{ {
xp+= LoadProperties.mstring * LoadProperties.xpGainMultiplier; xp+= LoadProperties.mstring;
is.add(new ItemStack(Material.STRING, 1, (byte)0, (byte)0)); is.add(new ItemStack(Material.STRING, 1, (byte)0, (byte)0));
} }
} }
@ -149,17 +148,16 @@ public class Excavation
{ {
if(Math.random() * 50 > 49) if(Math.random() * 50 > 49)
{ {
MapView mv = Bukkit.getServer().createMap(loc.getWorld()); MapView mv = Bukkit.getServer().createMap(loc.getWorld());
xp+= LoadProperties.mmap;
xp+= LoadProperties.mmap * LoadProperties.xpGainMultiplier; is.add(new ItemStack(Material.MAP, 1, mv.getId()));
is.add(new ItemStack(Material.MAP, 1, (byte)0, (byte) mv.getId()));
} }
} }
if(LoadProperties.bucket && PP.getSkillLevel(SkillType.EXCAVATION) >= 500) if(LoadProperties.bucket && PP.getSkillLevel(SkillType.EXCAVATION) >= 500)
{ {
if(Math.random() * 100 > 99) if(Math.random() * 100 > 99)
{ {
xp+= LoadProperties.mbucket * LoadProperties.xpGainMultiplier; xp+= LoadProperties.mbucket;
is.add(new ItemStack(Material.BUCKET, 1, (byte)0, (byte)0)); is.add(new ItemStack(Material.BUCKET, 1, (byte)0, (byte)0));
} }
} }
@ -167,7 +165,7 @@ public class Excavation
{ {
if(Math.random() * 20 > 19) if(Math.random() * 20 > 19)
{ {
xp+= LoadProperties.mweb * LoadProperties.xpGainMultiplier; xp+= LoadProperties.mweb;
is.add(new ItemStack(Material.WEB, 1, (byte)0, (byte)0)); is.add(new ItemStack(Material.WEB, 1, (byte)0, (byte)0));
} }
} }
@ -177,13 +175,13 @@ public class Excavation
//DIRT SAND OR GRAVEL //DIRT SAND OR GRAVEL
if(type == Material.GRASS || type == Material.DIRT || type == Material.GRAVEL || type == Material.SAND || type == Material.CLAY) if(type == Material.GRASS || type == Material.DIRT || type == Material.GRAVEL || type == Material.SAND || type == Material.CLAY)
{ {
xp+= LoadProperties.mbase * LoadProperties.xpGainMultiplier; xp+= LoadProperties.mbase;
if(PP.getSkillLevel(SkillType.EXCAVATION) >= 750) if(PP.getSkillLevel(SkillType.EXCAVATION) >= 750)
{ {
//CHANCE TO GET CAKE //CHANCE TO GET CAKE
if(LoadProperties.cake == true && Math.random() * 2000 > 1999) if(LoadProperties.cake == true && Math.random() * 2000 > 1999)
{ {
xp+= LoadProperties.mcake * LoadProperties.xpGainMultiplier; xp+= LoadProperties.mcake;
is.add(new ItemStack(Material.CAKE, 1, (byte)0, (byte)0)); is.add(new ItemStack(Material.CAKE, 1, (byte)0, (byte)0));
} }
} }
@ -192,7 +190,7 @@ public class Excavation
//CHANCE TO GET DIAMOND //CHANCE TO GET DIAMOND
if(LoadProperties.diamond == true && Math.random() * 750 > 749) if(LoadProperties.diamond == true && Math.random() * 750 > 749)
{ {
xp+= LoadProperties.mdiamond2 * LoadProperties.xpGainMultiplier; xp+= LoadProperties.mdiamond2;
is.add(new ItemStack(Material.DIAMOND, 1, (byte)0, (byte)0)); is.add(new ItemStack(Material.DIAMOND, 1, (byte)0, (byte)0));
} }
} }
@ -201,7 +199,7 @@ public class Excavation
//CHANCE TO GET YELLOW MUSIC //CHANCE TO GET YELLOW MUSIC
if(LoadProperties.music == true && Math.random() * 2000 > 1999) if(LoadProperties.music == true && Math.random() * 2000 > 1999)
{ {
xp+= LoadProperties.mmusic * LoadProperties.xpGainMultiplier; xp+= LoadProperties.mmusic;
is.add(new ItemStack(Material.GOLD_RECORD, 1, (byte)0, (byte)0)); is.add(new ItemStack(Material.GOLD_RECORD, 1, (byte)0, (byte)0));
} }
} }
@ -210,7 +208,7 @@ public class Excavation
//CHANCE TO GET GREEN MUSIC //CHANCE TO GET GREEN MUSIC
if(LoadProperties.music == true && Math.random() * 2000 > 1999) if(LoadProperties.music == true && Math.random() * 2000 > 1999)
{ {
xp+= LoadProperties.mmusic * LoadProperties.xpGainMultiplier; xp+= LoadProperties.mmusic;
is.add(new ItemStack(Material.GREEN_RECORD, 1, (byte)0, (byte)0)); is.add(new ItemStack(Material.GREEN_RECORD, 1, (byte)0, (byte)0));
} }
} }
@ -224,14 +222,14 @@ public class Excavation
//CHANCE FOR COCOA BEANS //CHANCE FOR COCOA BEANS
if(LoadProperties.cocoabeans == true && Math.random() * 75 > 74) if(LoadProperties.cocoabeans == true && Math.random() * 75 > 74)
{ {
xp+= LoadProperties.mcocoa * LoadProperties.xpGainMultiplier; xp+= LoadProperties.mcocoa;
is.add(new ItemStack(Material.getMaterial(351), 1, (byte)0, (byte)3)); is.add(new ItemStack(Material.getMaterial(351), 1, (byte)0, (byte)3));
} }
} }
//CHANCE FOR SHROOMS //CHANCE FOR SHROOMS
if(LoadProperties.mushrooms == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 500 && Math.random() * 200 > 199) if(LoadProperties.mushrooms == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 500 && Math.random() * 200 > 199)
{ {
xp+= LoadProperties.mmushroom2 * LoadProperties.xpGainMultiplier; xp+= LoadProperties.mmushroom2;
switch((int) Math.random() * 1) switch((int) Math.random() * 1)
{ {
case 0: case 0:
@ -246,7 +244,7 @@ public class Excavation
//CHANCE TO GET GLOWSTONE //CHANCE TO GET GLOWSTONE
if(LoadProperties.glowstone == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 25 && Math.random() * 100 > 95) if(LoadProperties.glowstone == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 25 && Math.random() * 100 > 95)
{ {
xp+= LoadProperties.mglowstone2 * LoadProperties.xpGainMultiplier; xp+= LoadProperties.mglowstone2;
is.add(new ItemStack(Material.GLOWSTONE_DUST, 1, (byte)0, (byte)0)); is.add(new ItemStack(Material.GLOWSTONE_DUST, 1, (byte)0, (byte)0));
} }
} }

View File

@ -65,7 +65,7 @@ public class Herbalism
Material mat = Material.getMaterial(296); Material mat = Material.getMaterial(296);
Location loc = block.getLocation(); Location loc = block.getLocation();
ItemStack is = new ItemStack(mat, 1, (byte)0, (byte)0); ItemStack is = new ItemStack(mat, 1, (byte)0, (byte)0);
PP.addXP(SkillType.HERBALISM, 5 * LoadProperties.xpGainMultiplier); PP.addXP(SkillType.HERBALISM, LoadProperties.mwheat);
loc.getWorld().dropItemNaturally(loc, is); loc.getWorld().dropItemNaturally(loc, is);
//DROP SOME SEEDS //DROP SOME SEEDS
@ -141,7 +141,7 @@ public class Herbalism
{ {
mat = Material.getMaterial(296); mat = Material.getMaterial(296);
is = new ItemStack(mat, 1, (byte)0, (byte)0); is = new ItemStack(mat, 1, (byte)0, (byte)0);
PP.addXP(SkillType.HERBALISM, LoadProperties.mwheat * LoadProperties.xpGainMultiplier); PP.addXP(SkillType.HERBALISM, LoadProperties.mwheat);
if(player != null) if(player != null)
{ {
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM)) if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM))
@ -215,7 +215,7 @@ public class Herbalism
{ {
loc.getWorld().dropItemNaturally(target.getLocation(), is); loc.getWorld().dropItemNaturally(target.getLocation(), is);
} }
PP.addXP(SkillType.HERBALISM, LoadProperties.mcactus * LoadProperties.xpGainMultiplier); PP.addXP(SkillType.HERBALISM, LoadProperties.mcactus);
} }
} }
x++; x++;
@ -254,7 +254,7 @@ public class Herbalism
{ {
loc.getWorld().dropItemNaturally(target.getLocation(), is); loc.getWorld().dropItemNaturally(target.getLocation(), is);
} }
PP.addXP(SkillType.HERBALISM, LoadProperties.msugar * LoadProperties.xpGainMultiplier); PP.addXP(SkillType.HERBALISM, LoadProperties.msugar);
} }
} }
x++; x++;
@ -273,7 +273,7 @@ public class Herbalism
loc.getWorld().dropItemNaturally(loc, is); loc.getWorld().dropItemNaturally(loc, is);
} }
} }
PP.addXP(SkillType.HERBALISM, LoadProperties.mpumpkin * LoadProperties.xpGainMultiplier); PP.addXP(SkillType.HERBALISM, LoadProperties.mpumpkin);
} }
//Mushroom //Mushroom
if(type == 39 || type == 40) if(type == 39 || type == 40)
@ -287,7 +287,7 @@ public class Herbalism
loc.getWorld().dropItemNaturally(loc, is); loc.getWorld().dropItemNaturally(loc, is);
} }
} }
PP.addXP(SkillType.HERBALISM, LoadProperties.mmushroom * LoadProperties.xpGainMultiplier); PP.addXP(SkillType.HERBALISM, LoadProperties.mmushroom);
} }
//Flower //Flower
if(type == 37 || type == 38){ if(type == 37 || type == 38){
@ -298,7 +298,7 @@ public class Herbalism
loc.getWorld().dropItemNaturally(loc, is); loc.getWorld().dropItemNaturally(loc, is);
} }
} }
PP.addXP(SkillType.HERBALISM, LoadProperties.mflower * LoadProperties.xpGainMultiplier); PP.addXP(SkillType.HERBALISM, LoadProperties.mflower);
} }
} }
Skills.XpCheckSkill(SkillType.HERBALISM, player); Skills.XpCheckSkill(SkillType.HERBALISM, player);

View File

@ -217,7 +217,7 @@ public class Mining
else else
blockProcCheck(block, player); blockProcCheck(block, player);
} }
PP.addXP(SkillType.MINING, xp * LoadProperties.xpGainMultiplier); PP.addXP(SkillType.MINING, xp);
Skills.XpCheckSkill(SkillType.MINING, player); Skills.XpCheckSkill(SkillType.MINING, player);
} }
/* /*
@ -406,7 +406,7 @@ public class Mining
block.setType(Material.AIR); block.setType(Material.AIR);
} }
if(block.getData() != (byte) 5) if(block.getData() != (byte) 5)
PP.addXP(SkillType.MINING, xp * LoadProperties.xpGainMultiplier); PP.addXP(SkillType.MINING, xp);
if(LoadProperties.spoutEnabled) if(LoadProperties.spoutEnabled)
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation()); SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());

View File

@ -53,7 +53,7 @@ public class Repair {
durabilityAfter = player.getItemInHand().getDurability(); durabilityAfter = player.getItemInHand().getDurability();
dif = (short) (durabilityBefore - durabilityAfter); dif = (short) (durabilityBefore - durabilityAfter);
dif = (short) (dif * 6); //Boost XP dif = (short) (dif * 6); //Boost XP
PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier); PP.addXP(SkillType.REPAIR, dif);
//CLANG CLANG //CLANG CLANG
if(LoadProperties.spoutEnabled) if(LoadProperties.spoutEnabled)
@ -68,7 +68,7 @@ public class Repair {
durabilityAfter = player.getItemInHand().getDurability(); durabilityAfter = player.getItemInHand().getDurability();
dif = (short) (durabilityBefore - durabilityAfter); dif = (short) (durabilityBefore - durabilityAfter);
dif = (short) (dif * 2); //Boost XP dif = (short) (dif * 2); //Boost XP
PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier); PP.addXP(SkillType.REPAIR, dif);
//CLANG CLANG //CLANG CLANG
if(LoadProperties.spoutEnabled) if(LoadProperties.spoutEnabled)
@ -80,7 +80,7 @@ public class Repair {
durabilityAfter = player.getItemInHand().getDurability(); durabilityAfter = player.getItemInHand().getDurability();
dif = (short) (durabilityBefore - durabilityAfter); dif = (short) (durabilityBefore - durabilityAfter);
dif = (short) (dif * 4); //Boost XP of Gold to around Iron dif = (short) (dif * 4); //Boost XP of Gold to around Iron
PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier); PP.addXP(SkillType.REPAIR, dif);
//CLANG CLANG //CLANG CLANG
if(LoadProperties.spoutEnabled) if(LoadProperties.spoutEnabled)
@ -110,7 +110,7 @@ public class Repair {
//STONE NERF //STONE NERF
dif = (short) (dif / 2); dif = (short) (dif / 2);
PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier); PP.addXP(SkillType.REPAIR, dif);
} else if(isWoodTools(is) && hasItem(player,rWood)){ } else if(isWoodTools(is) && hasItem(player,rWood)){
removeItem(player,rWood); removeItem(player,rWood);
/* /*
@ -128,7 +128,7 @@ public class Repair {
//WOOD NERF //WOOD NERF
dif = (short) (dif / 2); dif = (short) (dif / 2);
PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier); PP.addXP(SkillType.REPAIR, dif);
} else if(isIronTools(is) && hasItem(player, rIron)){ } else if(isIronTools(is) && hasItem(player, rIron)){
removeItem(player, rIron); removeItem(player, rIron);
/* /*
@ -143,7 +143,7 @@ public class Repair {
dif = (short) (dif / 2); dif = (short) (dif / 2);
if(m.isHoe(is)) if(m.isHoe(is))
dif = (short) (dif / 2); dif = (short) (dif / 2);
PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier); PP.addXP(SkillType.REPAIR, dif);
//CLANG CLANG //CLANG CLANG
if(LoadProperties.spoutEnabled) if(LoadProperties.spoutEnabled)
@ -162,7 +162,7 @@ public class Repair {
dif = (short) (dif / 2); dif = (short) (dif / 2);
if(m.isHoe(is)) if(m.isHoe(is))
dif = (short) (dif / 2); dif = (short) (dif / 2);
PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier); PP.addXP(SkillType.REPAIR, dif);
//CLANG CLANG //CLANG CLANG
if(LoadProperties.spoutEnabled) if(LoadProperties.spoutEnabled)
@ -179,7 +179,7 @@ public class Repair {
dif = (short) (dif / 2); dif = (short) (dif / 2);
if(m.isHoe(is)) if(m.isHoe(is))
dif = (short) (dif / 2); dif = (short) (dif / 2);
PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier); PP.addXP(SkillType.REPAIR, dif);
//CLANG CLANG //CLANG CLANG
if(LoadProperties.spoutEnabled) if(LoadProperties.spoutEnabled)

View File

@ -11,8 +11,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.Event.Priority; import org.bukkit.event.Event.Priority;
import org.getspout.spoutapi.SpoutManager; import org.getspout.spoutapi.SpoutManager;
import org.getspout.spoutapi.gui.GenericTexture; import org.getspout.spoutapi.gui.Color;
import org.getspout.spoutapi.gui.RenderPriority;
import org.getspout.spoutapi.gui.Widget; import org.getspout.spoutapi.gui.Widget;
import org.getspout.spoutapi.player.SpoutPlayer; import org.getspout.spoutapi.player.SpoutPlayer;
import org.getspout.spoutapi.sound.SoundEffect; import org.getspout.spoutapi.sound.SoundEffect;
@ -22,6 +21,8 @@ import com.gmail.nossr50.Users;
import com.gmail.nossr50.m; import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.HUDType;
import com.gmail.nossr50.datatypes.HUDmmo;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.datatypes.HealthBarMMO; import com.gmail.nossr50.datatypes.HealthBarMMO;
@ -31,8 +32,7 @@ import com.gmail.nossr50.party.Party;
public class SpoutStuff public class SpoutStuff
{ {
private final static mcSpoutListener spoutListener = new mcSpoutListener(); private final static mcSpoutListener spoutListener = new mcSpoutListener();
public static HashMap<Player, GenericTexture> xpbars = new HashMap<Player, GenericTexture>(); public static HashMap<Player, HUDmmo> playerHUDs = new HashMap<Player, HUDmmo>();
public static HashMap<Player, GenericTexture> xpicons = new HashMap<Player, GenericTexture>();
public static HashMap<Player, ArrayList<HealthBarMMO>> partyHealthBars = new HashMap<Player, ArrayList<HealthBarMMO>>(); public static HashMap<Player, ArrayList<HealthBarMMO>> partyHealthBars = new HashMap<Player, ArrayList<HealthBarMMO>>();
static mcMMO plugin = (mcMMO) Bukkit.getServer().getPluginManager().getPlugin("mcMMO"); static mcMMO plugin = (mcMMO) Bukkit.getServer().getPluginManager().getPlugin("mcMMO");
@ -41,52 +41,49 @@ public class SpoutStuff
{ {
Bukkit.getServer().getPluginManager().registerEvent(Event.Type.CUSTOM_EVENT, spoutListener, Priority.Normal, Bukkit.getServer().getPluginManager().getPlugin("mcMMO")); Bukkit.getServer().getPluginManager().registerEvent(Event.Type.CUSTOM_EVENT, spoutListener, Priority.Normal, Bukkit.getServer().getPluginManager().getPlugin("mcMMO"));
} }
public static void initializeXpBarDisplay(SpoutPlayer sPlayer)
public static Color getRetroColor(SkillType type)
{ {
//Setup xp bar switch(type)
GenericTexture xpbar = new GenericTexture();
if(LoadProperties.xpicon)
{ {
GenericTexture xpicon = new GenericTexture(); case ACROBATICS:
return new Color(0.3f, 0.3f, 0.75f, 1f);
xpicon.setUrl(LoadProperties.web_url+"/HUD/Standard/icon.png"); case ARCHERY:
return new Color(0.3f, 0.3f, 0.75f, 1f);
xpicon.setHeight(16).setWidth(32).setX(LoadProperties.xpicon_x).setY(LoadProperties.xpicon_y); case AXES:
return new Color(0.3f, 0.3f, 0.75f, 1f);
SpoutStuff.xpicons.put(sPlayer, xpicon); case EXCAVATION:
return new Color(0.3f, 0.3f, 0.75f, 1f);
sPlayer.getMainScreen().attachWidget(plugin, SpoutStuff.xpicons.get(sPlayer)); case HERBALISM:
return new Color(0.3f, 0.3f, 0.75f, 1f);
case MINING:
return new Color(0.3f, 0.3f, 0.75f, 1f);
case REPAIR:
return new Color(0.3f, 0.3f, 0.75f, 1f);
case SORCERY:
return new Color(0.3f, 0.3f, 0.75f, 1f);
case SWORDS:
return new Color(0.3f, 0.3f, 0.75f, 1f);
case TAMING:
return new Color(0.3f, 0.3f, 0.75f, 1f);
case UNARMED:
return new Color(0.3f, 0.3f, 0.75f, 1f);
case WOODCUTTING:
return new Color(0.3f, 0.3f, 0.75f, 1f);
default:
return new Color(0.3f, 0.3f, 0.75f, 1f);
} }
xpbar.setUrl(LoadProperties.web_url+"/HUD/Standard/xpbar_inc000.png");
xpbar.setX(LoadProperties.xpbar_x).setY(LoadProperties.xpbar_y).setHeight(8).setWidth(256);
SpoutStuff.xpbars.put(sPlayer, xpbar);
sPlayer.getMainScreen().attachWidget(plugin, SpoutStuff.xpbars.get(sPlayer));
sPlayer.getMainScreen().setDirty(true);
} }
public static void initializeXpBarMiniDisplay(SpoutPlayer sPlayer) public static SpoutPlayer getSpoutPlayer(String playerName)
{ {
//Coordinates 240, 427 are the bottom right. for(Player x : Bukkit.getServer().getOnlinePlayers())
GenericTexture xpbar = new GenericTexture(); {
GenericTexture xpbar_fill = new GenericTexture(); if(x.getName().equalsIgnoreCase(playerName))
{
xpbar.setUrl("http://dl.dropbox.com/u/18212134/xpbar/mini/bar.png"); return SpoutManager.getPlayer(x);
xpbar_fill.setUrl("http://dl.dropbox.com/u/18212134/xpbar/mini/bar_fill.png"); }
}
xpbar.setWidth(128).setHeight(4).setX(149).setY(10).setDirty(true); return null;
xpbar_fill.setWidth(2).setHeight(2).setX(150).setY(11).setPriority(RenderPriority.High).setDirty(true);
SpoutStuff.xpbars.put(sPlayer, xpbar);
sPlayer.getMainScreen().attachWidget(plugin, xpbar);
sPlayer.getMainScreen().attachWidget(plugin, xpbar_fill);
sPlayer.getMainScreen().setDirty(true);
} }
public static String getHealthBarURL(Integer hp) public static String getHealthBarURL(Integer hp)
@ -94,9 +91,9 @@ public class SpoutStuff
String url = ""; String url = "";
if(hp.toString().toCharArray().length > 1) if(hp.toString().toCharArray().length > 1)
url = LoadProperties.web_url+"/HUD/Standard/health_inc"+hp+".png"; url = LoadProperties.web_url+"HUD/Standard/health_inc"+hp+".png";
else else
url = LoadProperties.web_url+"/HUD/Standard/health_inc0"+hp+".png"; url = LoadProperties.web_url+"HUD/Standard/health_inc0"+hp+".png";
return url; return url;
} }
@ -269,13 +266,13 @@ public class SpoutStuff
{ {
SoundManager SM = SpoutManager.getSoundManager(); SoundManager SM = SpoutManager.getSoundManager();
SpoutPlayer sPlayer = SpoutManager.getPlayer(player); SpoutPlayer sPlayer = SpoutManager.getPlayer(player);
SM.playCustomMusic(Bukkit.getServer().getPluginManager().getPlugin("mcMMO"), sPlayer, LoadProperties.web_url+"/Sound/repair.wav", false); SM.playCustomSoundEffect(Bukkit.getServer().getPluginManager().getPlugin("mcMMO"), sPlayer, LoadProperties.web_url+"/Sound/repair.wav", false);
} }
public static void playLevelUpNoise(Player player) public static void playLevelUpNoise(Player player)
{ {
//SoundManager SM = SpoutManager.getSoundManager(); SoundManager SM = SpoutManager.getSoundManager();
//SpoutPlayer sPlayer = SpoutManager.getPlayer(player); SpoutPlayer sPlayer = SpoutManager.getPlayer(player);
//SM.playCustomMusic(Bukkit.getServer().getPluginManager().getPlugin("mcMMO"), sPlayer, "http://dl.dropbox.com/u/18212134/ANUSOUND/"+(int)Math.random()*8+".wav", false); SM.playCustomSoundEffect(Bukkit.getServer().getPluginManager().getPlugin("mcMMO"), sPlayer, LoadProperties.web_url+"/Sound/level.wav", false);
} }
public static void levelUpNotification(SkillType skillType, SpoutPlayer sPlayer) public static void levelUpNotification(SkillType skillType, SpoutPlayer sPlayer)
@ -513,84 +510,46 @@ public class SpoutStuff
return 5; return 5;
} }
public static Integer getXpInc(int skillxp, int xptolevel) public static Integer getXpInc(int skillxp, int xptolevel, HUDType hud)
{ {
double percentage = (double) skillxp/xptolevel; if(hud == HUDType.STANDARD)
double inc = 0.0039370078740157; {
return (int) (percentage/inc); double percentage = (double) skillxp/xptolevel;
double inc = 0.0039370078740157;
return (int) (percentage/inc);
} else if (hud == HUDType.RETRO)
{
double percentage = (double) skillxp/xptolevel;
double inc = 0.0079365079365079;
return (int) (percentage/inc);
} else {
return 1;
}
} }
public static void updateXpBar(Player player) public static void updateXpBar(Player player)
{ {
PlayerProfile PP = Users.getProfile(player); playerHUDs.get(player).updateXpBarDisplay(Users.getProfile(player).getHUDType(), player);
if(PP.getLastGained() != null && !PP.getXpBarLocked())
{
int num = getXpInc(PP.getSkillXpLevel(PP.getLastGained()), PP.getXpToLevel(PP.getLastGained()));
xpbars.get(player).setUrl(getUrlBar(num)).setDirty(true);
xpicons.get(player).setUrl(getUrlIcon(PP.getLastGained())).setDirty(true);
SpoutManager.getPlayer(player).getMainScreen().setDirty(true);
} else if (PP.getXpBarLocked())
{
if(xpbars.get(player) != null && xpicons.get(player) != null)
{
updateXpBarUrl(PP, player);
} else
{
initializeXpBarDisplay(SpoutManager.getPlayer(player));
updateXpBarUrl(PP, player);
}
}
}
public static void updateXpBarUrl(PlayerProfile PP, Player player)
{
int num = getXpInc(PP.getSkillXpLevel(PP.getSkillLock()), PP.getXpToLevel(PP.getSkillLock()));
xpbars.get(player).setUrl(getUrlBar(num)).setDirty(true);
xpicons.get(player).setUrl(getUrlIcon(PP.getSkillLock())).setDirty(true);
SpoutManager.getPlayer(player).getMainScreen().setDirty(true);
}
public static void updateXpBarFill(Player player)
{
PlayerProfile PP = Users.getProfile(player);
if(PP.getLastGained() != null)
{
if(PP.getXpBarInc() < 254)
xpbars.get(player).setUrl(getUrlBar(PP.getXpBarInc()+1)).setDirty(true);
else
xpbars.get(player).setUrl(getUrlBar(0)).setDirty(true);
PP.setXpBarInc(PP.getXpBarInc()+1);
if(LoadProperties.xpicon)
xpicons.get(player).setUrl(getUrlIcon(PP.getLastGained())).setDirty(true);
((SpoutPlayer)player).getMainScreen().setDirty(true);
}
} }
public static String getUrlBar(Integer number) public static String getUrlBar(Integer number)
{ {
if(number.toString().toCharArray().length == 1) if(number.toString().toCharArray().length == 1)
{ {
return LoadProperties.web_url+"/HUD/Standard/xpbar_inc00"+number+".png"; return LoadProperties.web_url+"HUD/Standard/xpbar_inc00"+number+".png";
} else if (number.toString().toCharArray().length == 2) } else if (number.toString().toCharArray().length == 2)
{ {
return LoadProperties.web_url+"/HUD/Standard/xpbar_inc0"+number+".png"; return LoadProperties.web_url+"HUD/Standard/xpbar_inc0"+number+".png";
} else { } else {
return LoadProperties.web_url+"/HUD/Standard/xpbar_inc"+number+".png"; return LoadProperties.web_url+"HUD/Standard/xpbar_inc"+number+".png";
} }
} }
public static String getUrlIcon(SkillType skillType) public static String getUrlIcon(SkillType skillType)
{ {
return LoadProperties.web_url+"/HUD/Standard/"+m.getCapitalized(skillType.toString())+".png"; return LoadProperties.web_url+"HUD/Standard/"+m.getCapitalized(skillType.toString())+".png";
} }
public static boolean shouldBeFilled(PlayerProfile PP) public static boolean shouldBeFilled(PlayerProfile PP)
{ {
return PP.getXpBarInc() < getXpInc(PP.getSkillXpLevel(PP.getLastGained()), PP.getXpToLevel(PP.getLastGained())); return PP.getXpBarInc() < getXpInc(PP.getSkillXpLevel(PP.getLastGained()), PP.getXpToLevel(PP.getLastGained()), HUDType.STANDARD);
} }
} }

View File

@ -1,8 +1,10 @@
name: mcMMO name: mcMMO
main: com.gmail.nossr50.mcMMO main: com.gmail.nossr50.mcMMO
version: 1.1.05 version: 1.1.06
softdepend: [Spout] softdepend: [Spout]
commands: commands:
mchud:
description: Change your HUD
xplock: xplock:
description: Lock your xp bar description: Lock your xp bar
xprate: xprate: