From 2d67d4ce36e7238681f9ae2dce60f1ef86d385e5 Mon Sep 17 00:00:00 2001 From: Chiss Date: Tue, 12 Aug 2014 11:23:53 +1000 Subject: [PATCH] Achievement fix + active --- .../core/achievement/Achievement.java | 23 +++++++++++++--- .../src/mineplex/core/stats/StatsManager.java | 4 +-- .../managers/GameAchievementManager.java | 22 ++++++++++----- .../game/arcade/managers/GameGemManager.java | 27 +++++++------------ 4 files changed, 45 insertions(+), 31 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index 83b32cfcc..ec43784d9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -2,17 +2,27 @@ package mineplex.core.achievement; public enum Achievement { - GLOBAL_GEM_HUNTER("Gem Hunter", new String[] {"Global.GemsEarned"}, new int[] {10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000, 55000, 60000, 65000}), - - GAME_SPLEEF_SMASHER("Spleef Smasher", new String[] {"Super Spleef.BlocksBroken"}, new int[] {100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200}); + GLOBAL_GEM_HUNTER("Gem Hunter", + new String[] {"Global.GemsEarned"}, + new String[] {"+1 for every Gem earned in any game."}, + new int[] {10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000, 55000, 60000, 65000}); + /* + GAME_SPLEEF_SMASHER("Spleef Smasher", + new String[] {"Super Spleef.BlocksBroken"}, + new String[] {"+1 for every broken Block in Spleef."}, + new int[] {100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200}); + */ + private String _name; + private String[] _desc; private String[] _stats; private int[] _levels; - Achievement(String name, String[] stats, int[] levels) + Achievement(String name, String[] stats, String[] desc, int[] levels) { _name = name; + _desc = desc; _stats = stats; _levels = levels; } @@ -22,6 +32,11 @@ public enum Achievement return _name; } + public String[] getDesc() + { + return _desc; + } + public String[] getStats() { return _stats; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java index 5384a45a5..6610ccce6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java @@ -50,10 +50,8 @@ public class StatsManager extends MiniClientPlugin public void incrementStat(Player player, final String statName, int value) { - int newValue = Get(player).addStat(statName, Get(player).getStat(statName) + value); + int newValue = Get(player).addStat(statName, value); - System.out.println(player.getName() + " - " + statName + " - " + value + " ? " + newValue); - //Event UtilServer.getServer().getPluginManager().callEvent(new StatChangeEvent(player.getName(), statName, newValue - value, newValue)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameAchievementManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameAchievementManager.java index 268b090c3..d5dfd24e7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameAchievementManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameAchievementManager.java @@ -42,7 +42,7 @@ public class GameAchievementManager implements Listener Manager.GetAchievement().clearLog(event.getPlayer()); } - //@EventHandler(priority = EventPriority.MONITOR) + @EventHandler(priority = EventPriority.MONITOR) public void processAchievementLog(final GameStateChangeEvent event) { if (Manager.IsTournamentServer()) @@ -85,19 +85,29 @@ public class GameAchievementManager implements Listener AchivementData data = Manager.GetAchievement().get(player, type); + String nameLevel = F.elem(C.cGold + C.Bold + type.getName() + " " + ChatColor.RESET + C.cYellow + data.getLevel() + C.cGold + "/" + C.cYellow + type.getMaxLevel()); + String progress = F.elem(C.cGreen + "+" + log.get(type).Amount); + if (log.get(type).LevelUp) { - UtilPlayer.message(player, F.elem(type.getName() + " " + data.getLevel() + "/" + type.getMaxLevel()) + - " " + F.elem(C.cGreen + "+" + log.get(type).Amount) + - " " + F.elem(C.cAqua + "LEVELED UP!")); + UtilPlayer.message(player, nameLevel + " " + progress + + " " + F.elem(C.cAqua + C.Bold + "LEVEL UP!")); + + player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f); } else { - UtilPlayer.message(player, F.elem(type.getName() + " " + data.getLevel() + "/" + type.getMaxLevel()) + - " " + F.elem(C.cGreen + "+" + log.get(type).Amount) + + UtilPlayer.message(player, nameLevel + " " + progress + " " + F.elem(ChatColor.YELLOW + "" + (data.getExpNextLevel() - data.getExpRemainder()) + " to Next Level")); } + for (String desc : type.getDesc()) + { + UtilPlayer.message(player, desc); + out++; + } + + out++; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java index fede05b4a..53637ca29 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java @@ -32,7 +32,6 @@ public class GameGemManager implements Listener ArcadeManager Manager; boolean DoubleGem = false; - boolean GemFinder = false; public GameGemManager(ArcadeManager manager) { @@ -166,16 +165,12 @@ public class GameGemManager implements Listener total += (int)(earned * game.GetGemBoostAmount()); //Gem Finder - if (GemFinder) + int gemFinder = Manager.GetAchievement().get(player.getName(), Achievement.GLOBAL_GEM_HUNTER).getLevel(); + if (gemFinder > 0) { - int gemFinder = Manager.GetAchievement().get(player.getName(), Achievement.GLOBAL_GEM_HUNTER).getLevel(); - if (gemFinder > 0) - { - total += (int)(earned * (gemFinder * 0.25)); - } + total += (int)(earned * (gemFinder * 0.25)); } - - + if (DoubleGem) total += earned; @@ -233,18 +228,14 @@ public class GameGemManager implements Listener totalGems += earnedGems * game.GetGemBoostAmount(); } - //Gem Finder - if (GemFinder) + int gemFinder = Manager.GetAchievement().get(player.getName(), Achievement.GLOBAL_GEM_HUNTER).getLevel(); + if (gemFinder > 0) { - int gemFinder = Manager.GetAchievement().get(player.getName(), Achievement.GLOBAL_GEM_HUNTER).getLevel(); - if (gemFinder > 0) - { - UtilPlayer.message(player, F.elem(C.cGreen + "+" + ((int)(earnedGems*(gemFinder * 0.25)) + " Gems") + " for " + - F.elem("Gem Hunter " + gemFinder + C.cGreen + " +" + (gemFinder*25) + "%"))); + UtilPlayer.message(player, F.elem(C.cGreen + "+" + ((int)(earnedGems*(gemFinder * 0.25)) + " Gems") + " for " + + F.elem("Gem Hunter " + gemFinder + C.cGreen + " +" + (gemFinder*25) + "%"))); - totalGems += earnedGems * (gemFinder * 0.25); - } + totalGems += earnedGems * (gemFinder * 0.25); } //Double Gem