Update game achievements

This commit is contained in:
Thanos paravantis 2016-04-24 13:37:39 +03:00
parent bfabfab2d1
commit e2a6500bce
15 changed files with 193 additions and 162 deletions

View File

@ -714,51 +714,66 @@ public enum Achievement
new int[]{1},
AchievementCategory.MINE_STRIKE),
//MineWare
MINEWARE_VETERAN("Mineware Veteran", 1500,
new String[]{"MineWare.Veteran"},
new String[]{"Win 50 games of Mineware"},
//Bawk Bawk Battles
BAWK_BAWK_BATTLES_VETERAN("Bawk Bawk Battles Veteran", 1500,
new String[]{"BawkBawkBattles.Veteran"},
new String[]{"Win 50 games of Bawk Bawk Battles"},
new int[] {50},
AchievementCategory.MINEWARE),
AchievementCategory.BAWK_BAWK_BATTLES),
MINEWARE_LAURA_CRAFT("Laura Craft", 800,
new String[]{"MineWare.LauraCraft"},
new String[]{"Complete the maze challenge in under 8 seconds 3 times"},
BAWK_BAWK_BATTLES_LAURA_CRAFT("Laura Craft", 800,
new String[]{"BawkBawkBattles.LauraCraft"},
new String[]{
C.cGray + "Maze Runner Challenge",
"Finish 3 times in a row, in under 8 seconds"
},
new int[] {3},
AchievementCategory.MINEWARE),
AchievementCategory.BAWK_BAWK_BATTLES),
MINEWARE_PINATA_MASTER("Pinata Master", 800,
new String[]{"MineWare.PinataMaster"},
new String[]{"In chicken shooter, hit 6 chickens without missing one"},
BAWK_BAWK_BATTLES_PINATA_MASTER("Pinata Master", 800,
new String[]{"BawkBawkBattles.PinataMaster"},
new String[]{
C.cGray + "Chicken Shooting Challenge",
"Hit 6 chickens without missing one"
},
new int[] {1},
AchievementCategory.MINEWARE),
AchievementCategory.BAWK_BAWK_BATTLES),
MINEWARE_MILK_MAN("Professional Milk Man", 700,
new String[]{"MineWare.MilkMan"},
new String[]{"In Milk the Cows, Collect 100 buckets of milk to the Farmer"},
BAWK_BAWK_BATTLES_MILK_MAN("Professional Milk Man", 700,
new String[]{"BawkBawkBattles.MilkMan"},
new String[]{
C.cGray + "Milk a Cow Challenge",
"Deliver 100 buckets of milk to the farmer"
},
new int[] {100},
AchievementCategory.MINEWARE),
AchievementCategory.BAWK_BAWK_BATTLES),
MINEWARE_TAG_MASTER("Tag Master", 700,
new String[]{"MineWare.TagMaster"},
new String[]{"In reverse tag, Win an entire round without losing the tag"},
BAWK_BAWK_BATTLES_TAG_MASTER("Tag Master", 700,
new String[]{"BawkBawkBattles.TagMaster"},
new String[]{
C.cGray + "Reverse Tag Challenge",
"Win an entire round without being untagged"
},
new int[] {1},
AchievementCategory.MINEWARE),
AchievementCategory.BAWK_BAWK_BATTLES),
MINEWARE_SURF_UP("Surf Up", 850,
new String[]{"MineWare.SurfUp"},
new String[]{"Avoid 250 waves in Wave Crush"},
BAWK_BAWK_BATTLES_SURF_UP("Surf Up", 850,
new String[]{"BawkBawkBattles.SurfUp"},
new String[]{
C.cGray + "Wave Crush Challenge",
"Avoid 250 waves"
},
new int[] {250},
AchievementCategory.MINEWARE),
AchievementCategory.BAWK_BAWK_BATTLES),
MINEWARE_KANGAROO_AT_HEART("Kangaroo at Heart", 900,
new String[]{"MineWare.Kangaroo"},
new String[]{"Complete Kangaroo Jump without falling once, 15 times"},
BAWK_BAWK_BATTLES_KANGAROO_AT_HEART("Kangaroo at Heart", 900,
new String[]{"BawkBawkBattles.Kangaroo"},
new String[]{
C.cGray + "Kangaroo Jump Challenge",
"Complete the challenge 15 times in a row without falling"
},
new int[] {15},
AchievementCategory.MINEWARE),
AchievementCategory.BAWK_BAWK_BATTLES),
//Bomb Lobbers
BOMB_LOBBERS_WINS("Master Bomber", 1200,

View File

@ -2,19 +2,18 @@ package mineplex.core.achievement;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilTime;
import mineplex.core.game.GameCategory;
import mineplex.core.game.GameDisplay;
import mineplex.core.stats.PlayerStats;
import mineplex.core.stats.StatsManager;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
public enum AchievementCategory
{
GLOBAL("Global", null,
@ -63,9 +62,9 @@ public enum AchievementCategory
new StatDisplay("Kills as Undead"), new StatDisplay("Deaths as Undead"), StatDisplay.GEMS_EARNED },
Material.DIAMOND_CHESTPLATE, 0, GameCategory.CLASSICS, null),
MINEWARE("Mineware", null,
BAWK_BAWK_BATTLES("Bawk Bawk Battles", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED },
Material.SPONGE, 0, GameCategory.CLASSICS, null),
Material.EGG, 0, GameCategory.CLASSICS, null),
BLOCK_HUNT("Block Hunt", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },

View File

@ -46,7 +46,7 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
protected void buildPage()
{
ArrayList<Integer> pageLayout = new ItemLayout(
"XXXXOXXXO",
"XXXXOXOXO",
"OXOXOXOXO",
"OXOXOXOXO",
"OXOXOXOXO").getItemSlots();

View File

@ -105,7 +105,7 @@ import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengePunchThe
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeRedLightGreenLight;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeReverseTag;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeRushPush;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeShootChickens;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeChickenShooting;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeSmashOff;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeTreasureDigger;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeVolleyPig;
@ -117,13 +117,13 @@ import nautilus.game.arcade.game.games.mineware.effect.DeathEffectData;
import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent;
import nautilus.game.arcade.game.games.mineware.events.ChallengeStartEvent;
import nautilus.game.arcade.game.games.mineware.kit.KitBawksFood;
import nautilus.game.arcade.game.games.mineware.stats.MinewareKangarooAtHeart;
import nautilus.game.arcade.game.games.mineware.stats.MinewareLauraCraftTracker;
import nautilus.game.arcade.game.games.mineware.stats.MinewareMilkManTracker;
import nautilus.game.arcade.game.games.mineware.stats.MinewarePinataMasterTracker;
import nautilus.game.arcade.game.games.mineware.stats.MinewareSurfUpTracker;
import nautilus.game.arcade.game.games.mineware.stats.MinewareTagMasterTracker;
import nautilus.game.arcade.game.games.mineware.stats.MinewareVeteranTracker;
import nautilus.game.arcade.game.games.mineware.stats.StatTrackerKangarooAtHeart;
import nautilus.game.arcade.game.games.mineware.stats.StatTrackerLauraCraftTracker;
import nautilus.game.arcade.game.games.mineware.stats.StatTrackerMilkManTracker;
import nautilus.game.arcade.game.games.mineware.stats.StatTrackerPinataMasterTracker;
import nautilus.game.arcade.game.games.mineware.stats.StatTrackerSurfUpTracker;
import nautilus.game.arcade.game.games.mineware.stats.StatTrackerTagMasterTracker;
import nautilus.game.arcade.game.games.mineware.stats.StatTrackerVeteranTracker;
import nautilus.game.arcade.kit.Kit;
/**
@ -167,7 +167,6 @@ public class BawkBawkBattles extends TeamGame implements IThrown
*
* High Priority
* - Define team spawns on correct side
* - Fix delay on map generation (NPE's on console)
* - Fix item rendering exception (kangaroo jump http://i.imgur.com/CPYIogC.jpg)
*
* Medium Priority
@ -226,13 +225,14 @@ public class BawkBawkBattles extends TeamGame implements IThrown
populateChallenges();
registerStatTrackers(
new MinewareVeteranTracker(this),
new MinewareSurfUpTracker(this),
new MinewareLauraCraftTracker(this),
new MinewareMilkManTracker(this),
new MinewarePinataMasterTracker(this),
new MinewareTagMasterTracker(this),
new MinewareKangarooAtHeart(this));
new StatTrackerKangarooAtHeart(this),
new StatTrackerLauraCraftTracker(this),
new StatTrackerMilkManTracker(this),
new StatTrackerPinataMasterTracker(this),
new StatTrackerSurfUpTracker(this),
new StatTrackerTagMasterTracker(this),
new StatTrackerVeteranTracker(this)
);
}
@SuppressWarnings("unchecked")
@ -244,6 +244,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
ChallengeBlockLobbers.class,
ChallengeBouncingBlock.class,
ChallengeBuildRace.class,
ChallengeChickenShooting.class,
ChallengeDiamondSeeker.class,
ChallengeCloudFall.class,
ChallengeColorChange.class,
@ -268,7 +269,6 @@ public class BawkBawkBattles extends TeamGame implements IThrown
ChallengeRedLightGreenLight.class,
ChallengeReverseTag.class,
ChallengeRushPush.class,
ChallengeShootChickens.class,
ChallengeSmashOff.class,
ChallengeTreasureDigger.class,
ChallengeVolleyPig.class,

View File

@ -32,13 +32,13 @@ import nautilus.game.arcade.game.games.mineware.BawkBawkBattles;
import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
import nautilus.game.arcade.game.games.mineware.challenge.ChallengeType;
public class ChallengeShootChickens extends Challenge
public class ChallengeChickenShooting extends Challenge
{
private ArrayList<Chicken> _chickens = new ArrayList<Chicken>();
private HashMap<Player, Integer> _score = new HashMap<Player, Integer>();
private HashMap<Player, Integer> _arrowsShot = new HashMap<Player, Integer>();
public ChallengeShootChickens(BawkBawkBattles host)
public ChallengeChickenShooting(BawkBawkBattles host)
{
super(
host,

View File

@ -224,7 +224,7 @@ public class ChallengeKangarooJump extends Challenge
return players;
}
public HashMap<Player, Integer> getPlayerHeight()
public HashMap<Player, Integer> getPlayerHeights()
{
return _playerJumpHeight;
}

View File

@ -1,56 +0,0 @@
package nautilus.game.arcade.game.games.mineware.stats;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeNavigationMaze;
import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent;
import nautilus.game.arcade.game.games.mineware.events.ChallengeStartEvent;
import nautilus.game.arcade.stats.StatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
public class MinewareLauraCraftTracker extends StatTracker<Game>
{
private long _challengeStartTime;
private int _timeForCompletion = 8; // Measured in seconds.
public MinewareLauraCraftTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onMazeChallengeStart(ChallengeStartEvent event)
{
if (getGame().GetState() != GameState.Live)
return;
Challenge challenge = event.getStartedChallenge();
if (!(challenge instanceof ChallengeNavigationMaze))
return;
_challengeStartTime = System.currentTimeMillis();
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onMazeChallengeEnd(ChallengeEndEvent event)
{
if (getGame().GetState() != GameState.Live)
return;
Challenge challenge = event.getEndedChallenge();
if (!(challenge instanceof ChallengeNavigationMaze))
return;
ChallengeNavigationMaze challengeMaze = (ChallengeNavigationMaze) challenge;
for (Player player : challengeMaze.getPlayerTimes().keySet())
if (challengeMaze.getPlayerTimes().get(player) <= (_challengeStartTime + (_timeForCompletion * 1000)))
addStat(player, "LauraCraft", 1, false, false);
}
}

View File

@ -11,9 +11,9 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
public class MinewareKangarooAtHeart extends StatTracker<Game>
public class StatTrackerKangarooAtHeart extends StatTracker<Game>
{
public MinewareKangarooAtHeart(Game game)
public StatTrackerKangarooAtHeart(Game game)
{
super(game);
}
@ -29,10 +29,17 @@ public class MinewareKangarooAtHeart extends StatTracker<Game>
if (!(challenge instanceof ChallengeKangarooJump))
return;
ChallengeKangarooJump kJump = (ChallengeKangarooJump) challenge;
ChallengeKangarooJump kangarooJump = (ChallengeKangarooJump) challenge;
for (Player player : kJump.getPlayerHeight().keySet())
if (!kJump.getData().isLost(player))
for (Player player : kangarooJump.getPlayerHeights().keySet())
{
if (!player.isOnline())
continue;
if (!kangarooJump.getData().isLost(player))
{
addStat(player, "Kangaroo", 1, false, false);
}
}
}
}

View File

@ -0,0 +1,47 @@
package nautilus.game.arcade.game.games.mineware.stats;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeNavigationMaze;
import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent;
import nautilus.game.arcade.stats.StatTracker;
public class StatTrackerLauraCraftTracker extends StatTracker<Game>
{
private int _timeForCompletion = 8; // Seconds
public StatTrackerLauraCraftTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onChallengeEnd(ChallengeEndEvent event)
{
if (getGame().GetState() != GameState.Live)
return;
Challenge challenge = event.getEndedChallenge();
if (!(challenge instanceof ChallengeNavigationMaze))
return;
ChallengeNavigationMaze navigationMaze = (ChallengeNavigationMaze) challenge;
for (Player player : navigationMaze.getPlayerTimes().keySet())
{
if (!player.isOnline())
continue;
if (navigationMaze.getPlayerTimes().get(player) <= (navigationMaze.getSettings().getStartTime() + (_timeForCompletion * 1000)))
{
addStat(player, "LauraCraft", 1, false, false);
}
}
}
}

View File

@ -11,9 +11,9 @@ import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeMilkACow
import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent;
import nautilus.game.arcade.stats.StatTracker;
public class MinewareMilkManTracker extends StatTracker<Game>
public class StatTrackerMilkManTracker extends StatTracker<Game>
{
public MinewareMilkManTracker(Game game)
public StatTrackerMilkManTracker(Game game)
{
super(game);
}
@ -29,15 +29,15 @@ public class MinewareMilkManTracker extends StatTracker<Game>
if (!(challenge instanceof ChallengeMilkACow))
return;
ChallengeMilkACow milk = (ChallengeMilkACow) challenge;
ChallengeMilkACow milkeACow = (ChallengeMilkACow) challenge;
for (Player player : milk.getScore().keySet())
for (Player player : milkeACow.getScore().keySet())
{
int score = milk.getScore().get(player);
if (!player.isOnline())
continue;
int score = milkeACow.getScore().get(player);
addStat(player, "MilkMan", score, false, false);
}
}

View File

@ -3,7 +3,7 @@ package nautilus.game.arcade.game.games.mineware.stats;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeShootChickens;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeChickenShooting;
import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent;
import nautilus.game.arcade.stats.StatTracker;
@ -11,9 +11,9 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
public class MinewarePinataMasterTracker extends StatTracker<Game>
public class StatTrackerPinataMasterTracker extends StatTracker<Game>
{
public MinewarePinataMasterTracker(Game game)
public StatTrackerPinataMasterTracker(Game game)
{
super(game);
}
@ -26,13 +26,22 @@ public class MinewarePinataMasterTracker extends StatTracker<Game>
Challenge challenge = event.getEndedChallenge();
if (!(challenge instanceof ChallengeShootChickens))
if (!(challenge instanceof ChallengeChickenShooting))
return;
ChallengeShootChickens chickChallenge = (ChallengeShootChickens) challenge;
ChallengeChickenShooting chickenShooting = (ChallengeChickenShooting) challenge;
for (Player player : chickChallenge.getArrowsShot().keySet())
if (chickChallenge.getArrowsShot().get(player) == 6 && challenge.getData().isCompleted(player))
for (Player player : chickenShooting.getArrowsShot().keySet())
{
if (!player.isOnline())
continue;
int shots = chickenShooting.getArrowsShot().get(player);
if (shots == 6 && challenge.getData().isCompleted(player))
{
addStat(player, "PinataMaster", 1, true, false);
}
}
}
}

View File

@ -11,9 +11,9 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
public class MinewareSurfUpTracker extends StatTracker<Game>
public class StatTrackerSurfUpTracker extends StatTracker<Game>
{
public MinewareSurfUpTracker(Game game)
public StatTrackerSurfUpTracker(Game game)
{
super(game);
}
@ -29,16 +29,19 @@ public class MinewareSurfUpTracker extends StatTracker<Game>
if (!(challenge instanceof ChallengeWaveCrush))
return;
ChallengeWaveCrush wave = (ChallengeWaveCrush) challenge;
ChallengeWaveCrush waveCrush = (ChallengeWaveCrush) challenge;
for (Player player : wave.getSurvivedWaves().keySet())
for (Player player : waveCrush.getSurvivedWaves().keySet())
{
int survivedWavesAmount = wave.getSurvivedWaves().get(player);
if (survivedWavesAmount < 1)
if (!player.isOnline())
continue;
addStat(player, "SurfUp", survivedWavesAmount, false, false);
int amount = waveCrush.getSurvivedWaves().get(player);
if (amount < 1)
continue;
addStat(player, "SurfUp", amount, false, false);
}
}
}

View File

@ -11,15 +11,15 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
public class MinewareTagMasterTracker extends StatTracker<Game>
public class StatTrackerTagMasterTracker extends StatTracker<Game>
{
public MinewareTagMasterTracker(Game game)
public StatTrackerTagMasterTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onGameEnd(ChallengeEndEvent event)
public void onChallengeEnd(ChallengeEndEvent event)
{
if (getGame().GetState() != GameState.Live)
return;
@ -29,12 +29,15 @@ public class MinewareTagMasterTracker extends StatTracker<Game>
if (!(challenge instanceof ChallengeReverseTag))
return;
ChallengeReverseTag tag = (ChallengeReverseTag) challenge;
ChallengeReverseTag reverseTag = (ChallengeReverseTag) challenge;
for (Player player : tag.getNonTagged().getPlayers())
for (Player player : reverseTag.getNonTagged().getPlayers())
{
if (tag.getData().isLost(player))
return;
if (!player.isOnline())
continue;
if (reverseTag.getData().isLost(player))
continue;
addStat(player, "TagMaster", 1, true, false);
}

View File

@ -1,26 +1,30 @@
package nautilus.game.arcade.game.games.mineware.stats;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.stats.StatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
public class MinewareVeteranTracker extends StatTracker<Game>
public class StatTrackerVeteranTracker extends StatTracker<Game>
{
public MinewareVeteranTracker(Game game)
public StatTrackerVeteranTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void tracePlayerWin(GameStateChangeEvent event)
public void onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() == GameState.End)
{
for (Player player : getGame().getWinners())
{
addStat(player, "Veteran", 1, true, false);
}
}
}
}