diff --git a/mcMMO/Changelog.txt b/mcMMO/Changelog.txt index 0a8b10173..3a4164534 100644 --- a/mcMMO/Changelog.txt +++ b/mcMMO/Changelog.txt @@ -1,5 +1,16 @@ Changelog: #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 Maps dropped from excavation are created correctly, and represent the area they are found in Fixed an exploit with clay and excavation diff --git a/mcMMO/com/gmail/nossr50/Combat.java b/mcMMO/com/gmail/nossr50/Combat.java index 35c86f834..f4e3e7348 100644 --- a/mcMMO/com/gmail/nossr50/Combat.java +++ b/mcMMO/com/gmail/nossr50/Combat.java @@ -86,12 +86,14 @@ public class Combat && ((PPd.getLastLogin()+5)*1000) < System.currentTimeMillis() && defender.getHealth() >= 1) { + int xp = (int) (event.getDamage() * 2 * LoadProperties.pvpxprewardmodifier); + 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)) - PPa.addXP(SkillType.SWORDS, (event.getDamage() * 2) * LoadProperties.pvpxprewardmodifier); + PPa.addXP(SkillType.SWORDS, xp); 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; if(event.getEntity() instanceof Creeper) - xp = (event.getDamage() * 4) * LoadProperties.xpGainMultiplier; + xp = (event.getDamage() * 4); if(event.getEntity() instanceof Spider) - xp = (event.getDamage() * 3) * LoadProperties.xpGainMultiplier; + xp = (event.getDamage() * 3); if(event.getEntity() instanceof Skeleton) - xp = (event.getDamage() * 2) * LoadProperties.xpGainMultiplier; + xp = (event.getDamage() * 2); if(event.getEntity() instanceof Zombie) - xp = (event.getDamage() * 2) * LoadProperties.xpGainMultiplier; + xp = (event.getDamage() * 2); if(event.getEntity() instanceof PigZombie) - xp = (event.getDamage() * 3) * LoadProperties.xpGainMultiplier; + xp = (event.getDamage() * 3); if(event.getEntity() instanceof Slime) - xp = (event.getDamage() * 3) * LoadProperties.xpGainMultiplier; + xp = (event.getDamage() * 3); if(event.getEntity() instanceof Ghast) - xp = (event.getDamage() * 3) * LoadProperties.xpGainMultiplier; + xp = (event.getDamage() * 3); if(m.isSwords(attacker.getItemInHand()) && mcPermissions.getInstance().swords(attacker)) PPa.addXP(SkillType.SWORDS, xp); @@ -191,24 +193,24 @@ public class Combat if(event.getEntity() instanceof Monster) { if(event.getEntity() instanceof Creeper) - xp = (event.getDamage() * 6) * LoadProperties.xpGainMultiplier; + xp = (event.getDamage() * 6); if(event.getEntity() instanceof Spider) - xp = (event.getDamage() * 5) * LoadProperties.xpGainMultiplier; + xp = (event.getDamage() * 5); if(event.getEntity() instanceof Skeleton) - xp = (event.getDamage() * 3) * LoadProperties.xpGainMultiplier; + xp = (event.getDamage() * 3); if(event.getEntity() instanceof Zombie) - xp = (event.getDamage() * 3) * LoadProperties.xpGainMultiplier; + xp = (event.getDamage() * 3); if(event.getEntity() instanceof PigZombie) - xp = (event.getDamage() * 4) * LoadProperties.xpGainMultiplier; + xp = (event.getDamage() * 4); if(event.getEntity() instanceof Slime) - xp = (event.getDamage() * 4) * LoadProperties.xpGainMultiplier; + xp = (event.getDamage() * 4); if(event.getEntity() instanceof Ghast) - xp = (event.getDamage() * 4) * LoadProperties.xpGainMultiplier; + xp = (event.getDamage() * 4); Users.getProfile(master).addXP(SkillType.TAMING, xp); } if(event.getEntity() instanceof Player) { - xp = (event.getDamage() * 2) * LoadProperties.xpGainMultiplier; + xp = (event.getDamage() * 2); Users.getProfile(master).addXP(SkillType.TAMING, xp); } Skills.XpCheckSkill(SkillType.TAMING, master); @@ -335,19 +337,19 @@ public class Combat { //XP if(x instanceof Creeper) - PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 4) * LoadProperties.xpGainMultiplier); + PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 4)); if(x instanceof Spider) - PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 3) * LoadProperties.xpGainMultiplier); + PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 3)); if(x instanceof Skeleton) - PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 2) * LoadProperties.xpGainMultiplier); + PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 2)); if(x instanceof Zombie) - PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 2) * LoadProperties.xpGainMultiplier); + PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 2)); if(x instanceof PigZombie) - PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 3) * LoadProperties.xpGainMultiplier); + PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 3)); if(x instanceof Slime) - PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 3) * LoadProperties.xpGainMultiplier); + PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 3)); if(x instanceof Ghast) - PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 3) * LoadProperties.xpGainMultiplier); + PPa.addXP(SkillType.ARCHERY, (event.getDamage() * 3)); } /* * Attacker is Player @@ -372,7 +374,8 @@ public class Combat if(LoadProperties.pvpxp && !Party.getInstance().inSameParty(attacker, defender) && ((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 diff --git a/mcMMO/com/gmail/nossr50/command/Commands.java b/mcMMO/com/gmail/nossr50/command/Commands.java index 7fd92987c..46dd916d7 100644 --- a/mcMMO/com/gmail/nossr50/command/Commands.java +++ b/mcMMO/com/gmail/nossr50/command/Commands.java @@ -20,6 +20,8 @@ import com.gmail.nossr50.m; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcPermissions; 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.SkillType; import com.gmail.nossr50.locale.mcLocale; @@ -968,8 +970,6 @@ public class Commands } else if(LoadProperties.ptpEnable && label.equalsIgnoreCase(LoadProperties.ptp) && PP.inParty()) { - - if(!mcPermissions.getInstance().partyTeleport(player)) { player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission")); @@ -1595,6 +1595,25 @@ public class Commands 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; } } diff --git a/mcMMO/com/gmail/nossr50/config/LoadProperties.java b/mcMMO/com/gmail/nossr50/config/LoadProperties.java index 73c4e58cb..11c060157 100644 --- a/mcMMO/com/gmail/nossr50/config/LoadProperties.java +++ b/mcMMO/com/gmail/nossr50/config/LoadProperties.java @@ -5,9 +5,29 @@ import org.bukkit.util.config.Configuration; 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 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 = 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; + 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 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/"; File file = new File(directory + File.separator + "config.yml"); Configuration config = null; @@ -46,6 +66,12 @@ public class LoadProperties config.save(); 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) { //Configuration config = load(); @@ -107,60 +133,60 @@ public class LoadProperties write("Items.Chimaera_Wing.Feather_Cost", 10); write("Items.Chimaera_Wing.Item_ID", 288); - write("XP.PVP.Rewards", true); - write("XP.Gains.Multiplier.PVP", 1); - write("XP.Gains.Mobspawners.Enabled", false); - write("XP.Gains.Multiplier.Global", 1); - write("XP.Formula.Multiplier.Global", 1); - write("XP.Formula.Multiplier.Taming", 2); - write("XP.Formula.Multiplier.Mining", 2); - write("XP.Formula.Multiplier.Repair", 2); - write("XP.Formula.Multiplier.Woodcutting", 2); - write("XP.Formula.Multiplier.Unarmed", 2); - write("XP.Formula.Multiplier.Herbalism", 2); - write("XP.Formula.Multiplier.Excavation", 2); - write("XP.Formula.Multiplier.Swords", 2); - write("XP.Formula.Multiplier.Archery", 2); - write("XP.Formula.Multiplier.Axes", 2); - write("XP.Formula.Multiplier.Sorcery", 2); - write("XP.Formula.Multiplier.Acrobatics", 2); - write("XP.Mining.Gold", 35); - write("XP.Mining.Diamond", 75); - write("XP.Mining.Iron", 25); - write("XP.Mining.Redstone", 15); - write("XP.Mining.lapis", 40); - write("XP.Mining.Obsidian", 15); - write("XP.Mining.Netherrack", 3); - write("XP.Mining.Glowstone", 3); - write("XP.Mining.Coal", 10); - write("XP.Mining.Stone", 3); - write("XP.Mining.Sandstone", 3); - write("XP.Herbalism.Sugar_Cane", 3); - write("XP.Herbalism.Cactus", 3); - write("XP.Herbalism.Pumpkin", 55); - write("XP.Herbalism.Flowers", 10); - write("XP.Herbalism.Wheat", 5); - write("XP.Herbalism.Mushrooms", 15); - write("XP.Woodcutting.Pine", 9); - write("XP.Woodcutting.Birch", 7); - write("XP.Woodcutting.Spruce", 8); - write("XP.Excavation.Base", 4); - write("XP.Excavation.Mushroom", 8); - write("XP.Excavation.Sulphur", 3); - write("XP.Excavation.Slowsand", 8); - write("XP.Excavation.Glowstone", 8); - write("XP.Excavation.Music", 300); - write("XP.Excavation.Bones", 3); - write("XP.Excavation.Diamond", 100); - write("XP.Excavation.Apple", 10); - write("XP.Excavation.Eggs", 10); - write("XP.Excavation.Cake", 300); - write("XP.Excavation.Slimeballs", 10); - write("XP.Excavation.Cocoa_Beans", 10); - write("XP.Excavation.Map", 20); - write("XP.Excavation.String", 20); - write("XP.Excavation.Bucket", 10); - write("XP.Excavation.Web", 15); + write("Experience.PVP.Rewards", true); + write("Experience.Gains.Multiplier.PVP", 1); + write("Experience.Gains.Mobspawners.Enabled", false); + write("Experience.Gains.Multiplier.Global", 1); + write("Experience.Formula.Multiplier.Global", 1); + write("Experience.Formula.Multiplier.Taming", 2); + write("Experience.Formula.Multiplier.Mining", 2); + write("Experience.Formula.Multiplier.Repair", 2); + write("Experience.Formula.Multiplier.Woodcutting", 2); + write("Experience.Formula.Multiplier.Unarmed", 2); + write("Experience.Formula.Multiplier.Herbalism", 2); + write("Experience.Formula.Multiplier.Excavation", 2); + write("Experience.Formula.Multiplier.Swords", 2); + write("Experience.Formula.Multiplier.Archery", 2); + write("Experience.Formula.Multiplier.Axes", 2); + write("Experience.Formula.Multiplier.Sorcery", 2); + write("Experience.Formula.Multiplier.Acrobatics", 2); + write("Experience.Mining.Gold", 35); + write("Experience.Mining.Diamond", 75); + write("Experience.Mining.Iron", 25); + write("Experience.Mining.Redstone", 15); + write("Experience.Mining.lapis", 40); + write("Experience.Mining.Obsidian", 15); + write("Experience.Mining.Netherrack", 3); + write("Experience.Mining.Glowstone", 3); + write("Experience.Mining.Coal", 10); + write("Experience.Mining.Stone", 3); + write("Experience.Mining.Sandstone", 3); + write("Experience.Herbalism.Sugar_Cane", 3); + write("Experience.Herbalism.Cactus", 3); + write("Experience.Herbalism.Pumpkin", 55); + write("Experience.Herbalism.Flowers", 10); + write("Experience.Herbalism.Wheat", 5); + write("Experience.Herbalism.Mushrooms", 15); + write("Experience.Woodcutting.Pine", 9); + write("Experience.Woodcutting.Birch", 7); + write("Experience.Woodcutting.Spruce", 8); + write("Experience.Excavation.Base", 4); + write("Experience.Excavation.Mushroom", 8); + write("Experience.Excavation.Sulphur", 3); + write("Experience.Excavation.Slowsand", 8); + write("Experience.Excavation.Glowstone", 8); + write("Experience.Excavation.Music", 300); + write("Experience.Excavation.Bones", 3); + write("Experience.Excavation.Diamond", 100); + write("Experience.Excavation.Apple", 10); + write("Experience.Excavation.Eggs", 10); + write("Experience.Excavation.Cake", 300); + write("Experience.Excavation.Slimeballs", 10); + write("Experience.Excavation.Cocoa_Beans", 10); + write("Experience.Excavation.Map", 20); + write("Experience.Excavation.String", 20); + write("Experience.Excavation.Bucket", 10); + write("Experience.Excavation.Web", 15); //write("Sorcery.Spells.Water.Thunder", 75); //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_spacing = readInteger("Spout.Party.HP.SPACING", 16); - msulphur = readInteger("XP.Excavation.Sulphur", 3); - mbones = readInteger("XP.Excavation.Bones", 3); - mbase = readInteger("XP.Excavation.Base", 4); - mmushroom2 = readInteger("XP.Excavation.Mushroom", 8); - mslowsand = readInteger("XP.Excavation.Slowsand", 8); - mglowstone2 = readInteger("XP.Excavation.Glowstone", 8); - mmusic = readInteger("XP.Excavation.Music", 300); - mdiamond2 = readInteger("XP.Excavation.Diamond", 100); - mapple = readInteger("XP.Excavation.Apple", 10); - meggs = readInteger("XP.Excavation.Eggs", 10); - mcake = readInteger("XP.Excavation.Cake", 300); - mcocoa = readInteger("XP.Excavation.Cocoa_Beans", 10); - mslimeballs = readInteger("XP.Excavation.Slimeballs", 10); - mstring = readInteger("XP.Excavation.String", 20); - mbucket = readInteger("XP.Excavation.Bucket", 10); - mweb = readInteger("XP.Excavation.Web", 15); - mmap = readInteger("XP.Excavation.Map", 20); + msulphur = readInteger("Experience.Excavation.Sulphur", 30); + mbones = readInteger("Experience.Excavation.Bones", 30); + mbase = readInteger("Experience.Excavation.Base", 40); + mmushroom2 = readInteger("Experience.Excavation.Mushroom", 80); + mslowsand = readInteger("Experience.Excavation.Slowsand", 80); + mglowstone2 = readInteger("Experience.Excavation.Glowstone", 80); + mmusic = readInteger("Experience.Excavation.Music", 3000); + mdiamond2 = readInteger("Experience.Excavation.Diamond", 1000); + mapple = readInteger("Experience.Excavation.Apple", 100); + meggs = readInteger("Experience.Excavation.Eggs", 100); + mcake = readInteger("Experience.Excavation.Cake", 3000); + mcocoa = readInteger("Experience.Excavation.Cocoa_Beans", 100); + mslimeballs = readInteger("Experience.Excavation.Slimeballs", 100); + mstring = readInteger("Experience.Excavation.String", 200); + mbucket = readInteger("Experience.Excavation.Bucket", 100); + mweb = readInteger("Experience.Excavation.Web", 150); + mmap = readInteger("Experience.Excavation.Map", 200); - msugar = readInteger("XP.Herbalism.Sugar_Cane", 3); - mwheat = readInteger("XP.Herbalism.Wheat", 5); - mcactus = readInteger("XP.Herbalism.Cactus", 3); - mpumpkin = readInteger("XP.Herbalism.Pumpkin", 55); - mflower = readInteger("XP.Herbalism.Flowers", 10); - mmushroom = readInteger("XP.Herbalism.Mushrooms", 15); + msugar = readInteger("Experience.Herbalism.Sugar_Cane", 30); + mwheat = readInteger("Experience.Herbalism.Wheat", 50); + mcactus = readInteger("Experience.Herbalism.Cactus", 30); + mpumpkin = readInteger("Experience.Herbalism.Pumpkin", 550); + mflower = readInteger("Experience.Herbalism.Flowers", 100); + mmushroom = readInteger("Experience.Herbalism.Mushrooms", 150); - mpine = readInteger("XP.Woodcutting.Pine", 7); - mbirch = readInteger("XP.Woodcutting.Birch", 8); - mspruce = readInteger("XP.Woodcutting.Spruce", 9); + mpine = readInteger("Experience.Woodcutting.Pine", 70); + mbirch = readInteger("Experience.Woodcutting.Birch", 80); + mspruce = readInteger("Experience.Woodcutting.Spruce", 90); - mgold = readInteger("XP.Mining.Gold", 25); - mdiamond = readInteger("XP.Mining.Diamond", 75); - miron = readInteger("XP.Mining.Iron", 25); - mredstone = readInteger("XP.Mining.Redstone", 15); - mlapis = readInteger("XP.Mining.lapis", 40); - mobsidian = readInteger("XP.Mining.Obsidian", 15); - mnetherrack = readInteger("XP.Mining.Netherrack", 3); - mglowstone = readInteger("XP.Mining.Glowstone", 3); - mcoal = readInteger("XP.Mining.Coal", 10); - mstone = readInteger("XP.Mining.Stone", 3); - msandstone = readInteger("XP.Mining.Sandstone", 3); + mgold = readInteger("Experience.Mining.Gold", 250); + mdiamond = readInteger("Experience.Mining.Diamond", 750); + miron = readInteger("Experience.Mining.Iron", 250); + mredstone = readInteger("Experience.Mining.Redstone", 150); + mlapis = readInteger("Experience.Mining.lapis", 400); + mobsidian = readInteger("Experience.Mining.Obsidian", 150); + mnetherrack = readInteger("Experience.Mining.Netherrack", 30); + mglowstone = readInteger("Experience.Mining.Glowstone", 30); + mcoal = readInteger("Experience.Mining.Coal", 100); + mstone = readInteger("Experience.Mining.Stone", 30); + msandstone = readInteger("Experience.Mining.Sandstone", 30); greenTerraCooldown = readInteger("Abilities.Cooldowns.Green_Terra", 240); superBreakerCooldown = readInteger("Abilities.Cooldowns.Super_Breaker", 240); @@ -341,7 +367,7 @@ public class LoadProperties archeryFireRateLimit = readBoolean("Skills.Archery.Fire_Rate_Limiter.Enabled", true); 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); abilityDurabilityLoss = readInteger("Abilities.Tools.Durability_Loss", 2); @@ -350,24 +376,24 @@ public class LoadProperties chimaeraWingEnable = readBoolean("Items.Chimaera_Wing.Enabled", 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); woodcuttingrequiresaxe = readBoolean("Skills.Woodcutting.Requires_Axe", true); repairdiamondlevel = readInteger("Skills.Repair.Diamond.Level_Required", 50); - globalxpmodifier = readInteger("XP.Formula.Multiplier.Global", 1); - sorceryxpmodifier = readInteger("XP.Formula.Multiplier.Sorcery", 2); - tamingxpmodifier = readInteger("XP.Formula.Multiplier.Taming", 2); - miningxpmodifier = readInteger("XP.Formula.Multiplier.Mining", 2); - repairxpmodifier = readInteger("XP.Formula.Multiplier.Repair", 2); - woodcuttingxpmodifier = readInteger("XP.Formula.Multiplier.Woodcutting", 2); - unarmedxpmodifier = readInteger("XP.Formula.Multiplier.Unarmed", 2); - herbalismxpmodifier = readInteger("XP.Formula.Multiplier.Herbalism", 2); - excavationxpmodifier = readInteger("XP.Formula.Multiplier.Excavation", 2); - archeryxpmodifier = readInteger("XP.Formula.Multiplier.Archery", 2); - swordsxpmodifier = readInteger("XP.Formula.Multiplier.Swords", 2); - axesxpmodifier = readInteger("XP.Formula.Multiplier.Axes", 2); - acrobaticsxpmodifier = readInteger("XP.Formula.Multiplier.Acrobatics", 2); + globalxpmodifier = readDouble("Experience.Formula.Multiplier.Global", 1.0); + sorceryxpmodifier = readDouble("Experience.Formula.Multiplier.Sorcery", 1.0); + tamingxpmodifier = readDouble("Experience.Formula.Multiplier.Taming", 1.0); + miningxpmodifier = readDouble("Experience.Formula.Multiplier.Mining", 1.0); + repairxpmodifier = readDouble("Experience.Formula.Multiplier.Repair", 1.0); + woodcuttingxpmodifier = readDouble("Experience.Formula.Multiplier.Woodcutting", 1.0); + unarmedxpmodifier = readDouble("Experience.Formula.Multiplier.Unarmed", 1.0); + herbalismxpmodifier = readDouble("Experience.Formula.Multiplier.Herbalism", 1.0); + excavationxpmodifier = readDouble("Experience.Formula.Multiplier.Excavation", 1.0); + archeryxpmodifier = readDouble("Experience.Formula.Multiplier.Archery", 1.0); + swordsxpmodifier = readDouble("Experience.Formula.Multiplier.Swords", 1.0); + axesxpmodifier = readDouble("Experience.Formula.Multiplier.Axes", 1.0); + acrobaticsxpmodifier = readDouble("Experience.Formula.Multiplier.Acrobatics", 1.0); anvilmessages = readBoolean("Skills.Repair.Anvil_Messages", true); diff --git a/mcMMO/com/gmail/nossr50/datatypes/HUDmmo.java b/mcMMO/com/gmail/nossr50/datatypes/HUDmmo.java new file mode 100644 index 000000000..78a18b240 --- /dev/null +++ b/mcMMO/com/gmail/nossr50/datatypes/HUDmmo.java @@ -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); + } +} \ No newline at end of file diff --git a/mcMMO/com/gmail/nossr50/datatypes/PlayerProfile.java b/mcMMO/com/gmail/nossr50/datatypes/PlayerProfile.java index 0fa0a6f50..b9e0fc0f0 100644 --- a/mcMMO/com/gmail/nossr50/datatypes/PlayerProfile.java +++ b/mcMMO/com/gmail/nossr50/datatypes/PlayerProfile.java @@ -14,7 +14,6 @@ import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; import com.gmail.nossr50.config.LoadProperties; -import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.m; import com.gmail.nossr50.mcMMO; @@ -24,11 +23,14 @@ public class PlayerProfile { protected final Logger log = Logger.getLogger("Minecraft"); + //HUD + private HUDType hud = HUDType.RETRO; + //MISC private String party, myspawn, myspawnworld, invite; //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, 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); } } + 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() { return xpbarlocked; @@ -857,30 +880,61 @@ public class PlayerProfile { if(skillType == SkillType.ALL) { - skillsXp.put(SkillType.TAMING, skillsXp.get(SkillType.TAMING)+newvalue); - skillsXp.put(SkillType.MINING, skillsXp.get(SkillType.MINING)+newvalue); - skillsXp.put(SkillType.WOODCUTTING, skillsXp.get(SkillType.WOODCUTTING)+newvalue); - skillsXp.put(SkillType.REPAIR, skillsXp.get(SkillType.REPAIR)+newvalue); - skillsXp.put(SkillType.HERBALISM, skillsXp.get(SkillType.HERBALISM)+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); + for(SkillType x : SkillType.values()) + { + if(x == SkillType.ALL) + continue; + skillsXp.put(x, skillsXp.get(x)+newvalue); + } } 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) { - SkillType prevLastGained = lastgained; - lastgained = skillType; - - //In case of an xp bar switch - if(prevLastGained != skillType || prevLastGained == null) - xpbarinc = SpoutStuff.getXpInc(this.getSkillXpLevel(lastgained), this.getXpToLevel(lastgained)); + //switch } } //save(); @@ -954,36 +1008,8 @@ public class PlayerProfile } public Integer getXpToLevel(SkillType skillType) { - switch(skillType) - { - 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; - } - } + return (int) ((100+(skills.get(skillType) * LoadProperties.globalxpmodifier))*10); + } //Store the player's party public void setParty(String newParty) diff --git a/mcMMO/com/gmail/nossr50/listeners/mcBlockListener.java b/mcMMO/com/gmail/nossr50/listeners/mcBlockListener.java index 03e440c7e..f14dff505 100644 --- a/mcMMO/com/gmail/nossr50/listeners/mcBlockListener.java +++ b/mcMMO/com/gmail/nossr50/listeners/mcBlockListener.java @@ -157,13 +157,13 @@ public class mcBlockListener extends BlockListener WoodCutting.woodCuttingProcCheck(player, block); //Default if(block.getData() == (byte)0) - PP.addXP(SkillType.WOODCUTTING, LoadProperties.mpine * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.WOODCUTTING, LoadProperties.mpine); //Spruce if(block.getData() == (byte)1) - PP.addXP(SkillType.WOODCUTTING, LoadProperties.mspruce * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.WOODCUTTING, LoadProperties.mspruce); //Birch if(block.getData() == (byte)2) - PP.addXP(SkillType.WOODCUTTING, LoadProperties.mbirch * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.WOODCUTTING, LoadProperties.mbirch); } } } else @@ -173,13 +173,13 @@ public class mcBlockListener extends BlockListener WoodCutting.woodCuttingProcCheck(player, block); //Default if(block.getData() == (byte)0) - PP.addXP(SkillType.WOODCUTTING, LoadProperties.mpine * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.WOODCUTTING, LoadProperties.mpine); //Spruce if(block.getData() == (byte)1) - PP.addXP(SkillType.WOODCUTTING, LoadProperties.mspruce * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.WOODCUTTING, LoadProperties.mspruce); //Birch if(block.getData() == (byte)2) - PP.addXP(SkillType.WOODCUTTING, LoadProperties.mbirch * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.WOODCUTTING, LoadProperties.mbirch); } } Skills.XpCheckSkill(SkillType.WOODCUTTING, player); @@ -316,8 +316,10 @@ public class mcBlockListener extends BlockListener Material mat = Material.getMaterial(block.getTypeId()); - if(block.getTypeId() == 2) + if(block.getType() == Material.GRASS) mat = Material.DIRT; + if(block.getType() == Material.CLAY) + mat = Material.CLAY_BALL; byte type = block.getData(); ItemStack item = new ItemStack(mat, 1, (byte)0, type); @@ -329,7 +331,16 @@ public class mcBlockListener extends BlockListener if(LoadProperties.toolsLoseDurabilityFromAbilities) 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 if(LoadProperties.spoutEnabled) @@ -344,15 +355,31 @@ public class mcBlockListener extends BlockListener && (Excavation.canBeGigaDrillBroken(block) || block.getTypeId() == 78)) { Material mat = Material.getMaterial(block.getTypeId()); + if(block.getTypeId() == 2) mat = Material.DIRT; if(block.getTypeId() == 78) mat = Material.SNOW_BALL; + if(block.getTypeId() == 82) + mat = Material.CLAY_BALL; + byte type = block.getData(); + ItemStack item = new ItemStack(mat, 1, (byte)0, type); player.incrementStatistic(Statistic.MINE_BLOCK, event.getBlock().getType()); + 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) SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation()); diff --git a/mcMMO/com/gmail/nossr50/listeners/mcPlayerListener.java b/mcMMO/com/gmail/nossr50/listeners/mcPlayerListener.java index d583a8772..daf5455ed 100644 --- a/mcMMO/com/gmail/nossr50/listeners/mcPlayerListener.java +++ b/mcMMO/com/gmail/nossr50/listeners/mcPlayerListener.java @@ -55,7 +55,6 @@ public class mcPlayerListener extends PlayerListener } } - public void onPlayerRespawn(PlayerRespawnEvent event) { @@ -103,10 +102,8 @@ public class mcPlayerListener extends PlayerListener if(LoadProperties.spoutEnabled) { - if(SpoutStuff.xpbars.containsKey(event.getPlayer())) - SpoutStuff.xpbars.remove(event.getPlayer()); - if(SpoutStuff.xpicons.containsKey(event.getPlayer())) - SpoutStuff.xpicons.remove(event.getPlayer()); + if(SpoutStuff.playerHUDs.containsKey(player)) + SpoutStuff.playerHUDs.remove(player); if(SpoutStuff.partyHealthBars.containsKey(event.getPlayer())) SpoutStuff.partyHealthBars.remove(event.getPlayer()); } @@ -213,7 +210,9 @@ public class mcPlayerListener extends PlayerListener { Skills.hoeReadinessCheck(player); Skills.abilityActivationCheck(player); - + } + if(action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK) + { /* * HERBALISM MODIFIERS */ diff --git a/mcMMO/com/gmail/nossr50/listeners/mcSpoutListener.java b/mcMMO/com/gmail/nossr50/listeners/mcSpoutListener.java index d016cecec..43077386d 100644 --- a/mcMMO/com/gmail/nossr50/listeners/mcSpoutListener.java +++ b/mcMMO/com/gmail/nossr50/listeners/mcSpoutListener.java @@ -6,6 +6,7 @@ import org.getspout.spoutapi.player.SpoutPlayer; import com.gmail.nossr50.Users; import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.datatypes.HUDmmo; import com.gmail.nossr50.spout.SpoutStuff; public class mcSpoutListener extends SpoutListener @@ -16,12 +17,12 @@ public class mcSpoutListener extends SpoutListener if(sPlayer.isSpoutCraftEnabled()) { //Setup Party HUD stuff + SpoutStuff.playerHUDs.put(sPlayer, new HUDmmo(sPlayer)); + if(LoadProperties.partybar && Users.getProfile(sPlayer).inParty()) SpoutStuff.initializePartyTracking(sPlayer); - //Setup player XP-Bar & XP-Icon - if(LoadProperties.xpbar) - SpoutStuff.initializeXpBarDisplay(sPlayer); + Users.getProfile(sPlayer).toggleSpoutEnabled(); } } } \ No newline at end of file diff --git a/mcMMO/com/gmail/nossr50/skills/Acrobatics.java b/mcMMO/com/gmail/nossr50/skills/Acrobatics.java index cad714436..795d988a5 100644 --- a/mcMMO/com/gmail/nossr50/skills/Acrobatics.java +++ b/mcMMO/com/gmail/nossr50/skills/Acrobatics.java @@ -7,7 +7,6 @@ import org.bukkit.event.entity.EntityDamageEvent; import com.gmail.nossr50.Users; import com.gmail.nossr50.mcPermissions; -import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; @@ -37,7 +36,7 @@ public class Acrobatics { */ if(player.getHealth() - newDamage >= 1){ if(!event.isCancelled()) - PP.addXP(SkillType.ACROBATICS, (event.getDamage() * 8) * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.ACROBATICS, (event.getDamage() * 8)); Skills.XpCheckSkill(SkillType.ACROBATICS, player); event.setDamage(newDamage); if(event.getDamage() <= 0) @@ -50,7 +49,7 @@ public class Acrobatics { } } else if (!event.isCancelled()){ 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); } } diff --git a/mcMMO/com/gmail/nossr50/skills/Excavation.java b/mcMMO/com/gmail/nossr50/skills/Excavation.java index e5109bbfc..093b445d3 100644 --- a/mcMMO/com/gmail/nossr50/skills/Excavation.java +++ b/mcMMO/com/gmail/nossr50/skills/Excavation.java @@ -8,7 +8,6 @@ import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.map.MapView; - import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.Users; import com.gmail.nossr50.m; @@ -75,13 +74,13 @@ public class Excavation //CHANCE TO GET EGGS 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)); } //CHANCE TO GET APPLES 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)); } } @@ -90,7 +89,7 @@ public class Excavation //CHANCE TO GET NETHERRACK 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)); } @@ -99,7 +98,7 @@ public class Excavation { if(Math.random() * 10 > 9) { - xp+= LoadProperties.msulphur * LoadProperties.xpGainMultiplier; + xp+= LoadProperties.msulphur; is.add(new ItemStack(Material.SULPHUR, 1, (byte)0, (byte)0)); } } @@ -108,7 +107,7 @@ public class Excavation { if(Math.random() * 10 > 9) { - xp+= LoadProperties.mbones * LoadProperties.xpGainMultiplier; + xp+= LoadProperties.mbones; is.add(new ItemStack(Material.BONE, 1, (byte)0, (byte)0)); } } @@ -117,14 +116,14 @@ public class Excavation //CHANCE TO GET GLOWSTONE 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)); } //CHANCE TO GET SOUL SAND 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)); } break; @@ -133,7 +132,7 @@ public class Excavation { 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)); } } @@ -141,7 +140,7 @@ public class Excavation { if(Math.random() * 20 > 19) { - xp+= LoadProperties.mstring * LoadProperties.xpGainMultiplier; + xp+= LoadProperties.mstring; is.add(new ItemStack(Material.STRING, 1, (byte)0, (byte)0)); } } @@ -149,17 +148,16 @@ public class Excavation { if(Math.random() * 50 > 49) { - MapView mv = Bukkit.getServer().createMap(loc.getWorld()); - - xp+= LoadProperties.mmap * LoadProperties.xpGainMultiplier; - is.add(new ItemStack(Material.MAP, 1, (byte)0, (byte) mv.getId())); + MapView mv = Bukkit.getServer().createMap(loc.getWorld()); + xp+= LoadProperties.mmap; + is.add(new ItemStack(Material.MAP, 1, mv.getId())); } } if(LoadProperties.bucket && PP.getSkillLevel(SkillType.EXCAVATION) >= 500) { if(Math.random() * 100 > 99) { - xp+= LoadProperties.mbucket * LoadProperties.xpGainMultiplier; + xp+= LoadProperties.mbucket; is.add(new ItemStack(Material.BUCKET, 1, (byte)0, (byte)0)); } } @@ -167,7 +165,7 @@ public class Excavation { if(Math.random() * 20 > 19) { - xp+= LoadProperties.mweb * LoadProperties.xpGainMultiplier; + xp+= LoadProperties.mweb; is.add(new ItemStack(Material.WEB, 1, (byte)0, (byte)0)); } } @@ -177,13 +175,13 @@ public class Excavation //DIRT SAND OR GRAVEL 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) { //CHANCE TO GET CAKE 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)); } } @@ -192,7 +190,7 @@ public class Excavation //CHANCE TO GET DIAMOND 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)); } } @@ -201,7 +199,7 @@ public class Excavation //CHANCE TO GET YELLOW MUSIC 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)); } } @@ -210,7 +208,7 @@ public class Excavation //CHANCE TO GET GREEN MUSIC 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)); } } @@ -224,14 +222,14 @@ public class Excavation //CHANCE FOR COCOA BEANS 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)); } } //CHANCE FOR SHROOMS 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) { case 0: @@ -246,7 +244,7 @@ public class Excavation //CHANCE TO GET GLOWSTONE 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)); } } diff --git a/mcMMO/com/gmail/nossr50/skills/Herbalism.java b/mcMMO/com/gmail/nossr50/skills/Herbalism.java index bacefb9ee..ed9db6465 100644 --- a/mcMMO/com/gmail/nossr50/skills/Herbalism.java +++ b/mcMMO/com/gmail/nossr50/skills/Herbalism.java @@ -65,7 +65,7 @@ public class Herbalism Material mat = Material.getMaterial(296); Location loc = block.getLocation(); 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); //DROP SOME SEEDS @@ -141,7 +141,7 @@ public class Herbalism { mat = Material.getMaterial(296); 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(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM)) @@ -215,7 +215,7 @@ public class Herbalism { loc.getWorld().dropItemNaturally(target.getLocation(), is); } - PP.addXP(SkillType.HERBALISM, LoadProperties.mcactus * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.HERBALISM, LoadProperties.mcactus); } } x++; @@ -254,7 +254,7 @@ public class Herbalism { loc.getWorld().dropItemNaturally(target.getLocation(), is); } - PP.addXP(SkillType.HERBALISM, LoadProperties.msugar * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.HERBALISM, LoadProperties.msugar); } } x++; @@ -273,7 +273,7 @@ public class Herbalism loc.getWorld().dropItemNaturally(loc, is); } } - PP.addXP(SkillType.HERBALISM, LoadProperties.mpumpkin * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.HERBALISM, LoadProperties.mpumpkin); } //Mushroom if(type == 39 || type == 40) @@ -287,7 +287,7 @@ public class Herbalism loc.getWorld().dropItemNaturally(loc, is); } } - PP.addXP(SkillType.HERBALISM, LoadProperties.mmushroom * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.HERBALISM, LoadProperties.mmushroom); } //Flower if(type == 37 || type == 38){ @@ -298,7 +298,7 @@ public class Herbalism loc.getWorld().dropItemNaturally(loc, is); } } - PP.addXP(SkillType.HERBALISM, LoadProperties.mflower * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.HERBALISM, LoadProperties.mflower); } } Skills.XpCheckSkill(SkillType.HERBALISM, player); diff --git a/mcMMO/com/gmail/nossr50/skills/Mining.java b/mcMMO/com/gmail/nossr50/skills/Mining.java index b5fd4ee1c..4f6e91773 100644 --- a/mcMMO/com/gmail/nossr50/skills/Mining.java +++ b/mcMMO/com/gmail/nossr50/skills/Mining.java @@ -217,7 +217,7 @@ public class Mining else blockProcCheck(block, player); } - PP.addXP(SkillType.MINING, xp * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.MINING, xp); Skills.XpCheckSkill(SkillType.MINING, player); } /* @@ -406,7 +406,7 @@ public class Mining block.setType(Material.AIR); } if(block.getData() != (byte) 5) - PP.addXP(SkillType.MINING, xp * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.MINING, xp); if(LoadProperties.spoutEnabled) SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation()); diff --git a/mcMMO/com/gmail/nossr50/skills/Repair.java b/mcMMO/com/gmail/nossr50/skills/Repair.java index 05503a24e..97aeeadfc 100644 --- a/mcMMO/com/gmail/nossr50/skills/Repair.java +++ b/mcMMO/com/gmail/nossr50/skills/Repair.java @@ -53,7 +53,7 @@ public class Repair { durabilityAfter = player.getItemInHand().getDurability(); dif = (short) (durabilityBefore - durabilityAfter); dif = (short) (dif * 6); //Boost XP - PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.REPAIR, dif); //CLANG CLANG if(LoadProperties.spoutEnabled) @@ -68,7 +68,7 @@ public class Repair { durabilityAfter = player.getItemInHand().getDurability(); dif = (short) (durabilityBefore - durabilityAfter); dif = (short) (dif * 2); //Boost XP - PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.REPAIR, dif); //CLANG CLANG if(LoadProperties.spoutEnabled) @@ -80,7 +80,7 @@ public class Repair { durabilityAfter = player.getItemInHand().getDurability(); dif = (short) (durabilityBefore - durabilityAfter); 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 if(LoadProperties.spoutEnabled) @@ -110,7 +110,7 @@ public class Repair { //STONE NERF dif = (short) (dif / 2); - PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.REPAIR, dif); } else if(isWoodTools(is) && hasItem(player,rWood)){ removeItem(player,rWood); /* @@ -128,7 +128,7 @@ public class Repair { //WOOD NERF dif = (short) (dif / 2); - PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.REPAIR, dif); } else if(isIronTools(is) && hasItem(player, rIron)){ removeItem(player, rIron); /* @@ -143,7 +143,7 @@ public class Repair { dif = (short) (dif / 2); if(m.isHoe(is)) dif = (short) (dif / 2); - PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.REPAIR, dif); //CLANG CLANG if(LoadProperties.spoutEnabled) @@ -162,7 +162,7 @@ public class Repair { dif = (short) (dif / 2); if(m.isHoe(is)) dif = (short) (dif / 2); - PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.REPAIR, dif); //CLANG CLANG if(LoadProperties.spoutEnabled) @@ -179,7 +179,7 @@ public class Repair { dif = (short) (dif / 2); if(m.isHoe(is)) dif = (short) (dif / 2); - PP.addXP(SkillType.REPAIR, dif * LoadProperties.xpGainMultiplier); + PP.addXP(SkillType.REPAIR, dif); //CLANG CLANG if(LoadProperties.spoutEnabled) diff --git a/mcMMO/com/gmail/nossr50/spout/SpoutStuff.java b/mcMMO/com/gmail/nossr50/spout/SpoutStuff.java index f99fffb2a..6954f2778 100644 --- a/mcMMO/com/gmail/nossr50/spout/SpoutStuff.java +++ b/mcMMO/com/gmail/nossr50/spout/SpoutStuff.java @@ -11,8 +11,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.bukkit.event.Event.Priority; import org.getspout.spoutapi.SpoutManager; -import org.getspout.spoutapi.gui.GenericTexture; -import org.getspout.spoutapi.gui.RenderPriority; +import org.getspout.spoutapi.gui.Color; import org.getspout.spoutapi.gui.Widget; import org.getspout.spoutapi.player.SpoutPlayer; import org.getspout.spoutapi.sound.SoundEffect; @@ -22,6 +21,8 @@ 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.datatypes.HUDType; +import com.gmail.nossr50.datatypes.HUDmmo; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.HealthBarMMO; @@ -31,8 +32,7 @@ import com.gmail.nossr50.party.Party; public class SpoutStuff { private final static mcSpoutListener spoutListener = new mcSpoutListener(); - public static HashMap xpbars = new HashMap(); - public static HashMap xpicons = new HashMap(); + public static HashMap playerHUDs = new HashMap(); public static HashMap> partyHealthBars = new HashMap>(); 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")); } - public static void initializeXpBarDisplay(SpoutPlayer sPlayer) + + public static Color getRetroColor(SkillType type) { - //Setup xp bar - GenericTexture xpbar = new GenericTexture(); - - if(LoadProperties.xpicon) + switch(type) { - GenericTexture 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); - - SpoutStuff.xpicons.put(sPlayer, xpicon); - - sPlayer.getMainScreen().attachWidget(plugin, SpoutStuff.xpicons.get(sPlayer)); + case ACROBATICS: + return new Color(0.3f, 0.3f, 0.75f, 1f); + case ARCHERY: + return new Color(0.3f, 0.3f, 0.75f, 1f); + case AXES: + return new Color(0.3f, 0.3f, 0.75f, 1f); + case EXCAVATION: + return new Color(0.3f, 0.3f, 0.75f, 1f); + 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. - 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); - - SpoutStuff.xpbars.put(sPlayer, xpbar); - - sPlayer.getMainScreen().attachWidget(plugin, xpbar); - sPlayer.getMainScreen().attachWidget(plugin, xpbar_fill); - - sPlayer.getMainScreen().setDirty(true); + for(Player x : Bukkit.getServer().getOnlinePlayers()) + { + if(x.getName().equalsIgnoreCase(playerName)) + { + return SpoutManager.getPlayer(x); + } + } + return null; } public static String getHealthBarURL(Integer hp) @@ -94,9 +91,9 @@ public class SpoutStuff String url = ""; 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 - url = LoadProperties.web_url+"/HUD/Standard/health_inc0"+hp+".png"; + url = LoadProperties.web_url+"HUD/Standard/health_inc0"+hp+".png"; return url; } @@ -269,13 +266,13 @@ public class SpoutStuff { SoundManager SM = SpoutManager.getSoundManager(); 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) { - //SoundManager SM = SpoutManager.getSoundManager(); - //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); + SoundManager SM = SpoutManager.getSoundManager(); + SpoutPlayer sPlayer = SpoutManager.getPlayer(player); + SM.playCustomSoundEffect(Bukkit.getServer().getPluginManager().getPlugin("mcMMO"), sPlayer, LoadProperties.web_url+"/Sound/level.wav", false); } public static void levelUpNotification(SkillType skillType, SpoutPlayer sPlayer) @@ -513,84 +510,46 @@ public class SpoutStuff 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; - double inc = 0.0039370078740157; - return (int) (percentage/inc); + if(hud == HUDType.STANDARD) + { + 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) { - PlayerProfile PP = Users.getProfile(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); - } + playerHUDs.get(player).updateXpBarDisplay(Users.getProfile(player).getHUDType(), player); } public static String getUrlBar(Integer number) { 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) { - return LoadProperties.web_url+"/HUD/Standard/xpbar_inc0"+number+".png"; + return LoadProperties.web_url+"HUD/Standard/xpbar_inc0"+number+".png"; } 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) { - 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) { - 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); } } diff --git a/mcMMO/plugin.yml b/mcMMO/plugin.yml index eb69fca0b..315fc8d59 100644 --- a/mcMMO/plugin.yml +++ b/mcMMO/plugin.yml @@ -1,8 +1,10 @@ name: mcMMO main: com.gmail.nossr50.mcMMO -version: 1.1.05 +version: 1.1.06 softdepend: [Spout] commands: + mchud: + description: Change your HUD xplock: description: Lock your xp bar xprate: