From f9ce0d353c8d3c4a87c9facb759fb563e72379db Mon Sep 17 00:00:00 2001 From: Chiss Date: Wed, 27 Aug 2014 08:57:11 +1000 Subject: [PATCH 1/2] Achievements now need 75%+ players at START of game --- .../src/nautilus/game/arcade/game/Game.java | 2 ++ .../nautilus/game/arcade/managers/GameManager.java | 14 ++++++++++++++ .../nautilus/game/arcade/stats/StatTracker.java | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index d77a2b868..b79839c7f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -207,6 +207,8 @@ public abstract class Game implements Listener public boolean EloRanking = false; public int EloStart = 1000; + public boolean CanAddStats = true; + public ArrayList GemBoosters = new ArrayList(); private final Set> _statTrackers = new HashSet<>(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index 14de468dd..77035d669 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -271,6 +271,20 @@ public class GameManager implements Listener event.GetGame().DeregisterKits(); } + @EventHandler + public void StatEnableDisable(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Live) + return; + + int requirement = (int)((double)event.GetGame().Manager.GetPlayerFull() * 0.75d); + + event.GetGame().CanAddStats = (double)event.GetGame().GetPlayers(true).size() >= requirement; + + if (!event.GetGame().CanAddStats) + event.GetGame().Announce(C.Bold + "Stats/Achievements Disabled. Requires " + requirement + " Players."); + } + @EventHandler public void StatRegister(GameStateChangeEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/StatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/StatTracker.java index 704e355ad..1c7630a6c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/StatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/StatTracker.java @@ -21,7 +21,7 @@ public class StatTracker implements Listener public boolean canAddStats() { - return getGame().GetPlayers(false).size() * 4 >= 3 * getGame().Manager.GetPlayerFull(); + return getGame().CanAddStats; } public void addStat(Player player, String stat, int value, boolean limitTo1, boolean global) From 5540835052a049456267166b3949d392688f6174 Mon Sep 17 00:00:00 2001 From: Chiss Date: Wed, 27 Aug 2014 09:09:06 +1000 Subject: [PATCH 2/2] removed micro debug fixed a bug in achievement output --- .../src/nautilus/game/arcade/game/games/micro/Micro.java | 4 ++-- .../nautilus/game/arcade/managers/GameAchievementManager.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java index 9d816df01..780517b8a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java @@ -101,7 +101,7 @@ public class Micro extends TeamGame if (_blocks.isEmpty()) return; - TimingManager.start("Block Fall"); + //TimingManager.start("Block Fall"); for (int i = 0 ; i < 3 ; i++) { @@ -134,7 +134,7 @@ public class Micro extends TeamGame } } - TimingManager.stop("Block Fall"); + //TimingManager.stop("Block Fall"); } @EventHandler 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 df07b0848..1d9dac378 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 @@ -95,9 +95,9 @@ public class GameAchievementManager implements Listener boolean displayDesc = true; //Completed Achievement - if (data.getLevel() == type.getMaxLevel()) + if (data.getLevel() >= type.getMaxLevel()) { - //Finishing for the first time + //Finishing for the first time if (!Manager.GetTaskManager().hasCompletedTask(player, type.getName())) { UtilPlayer.message(player, nameLevel + " " + F.elem(C.cAqua + C.Bold + "Completed!") +