Fixing some stats and disabling Chat spam messages.

This commit is contained in:
Sarah 2015-12-10 02:02:36 +01:00
parent 484dce18e1
commit 76b29756ff
3 changed files with 51 additions and 10 deletions

View File

@ -268,12 +268,7 @@ public enum AchievementCategory
if(stat == 0)
statNumber = statNumber / 1;
else
{
if(statName.contentEquals("TimeInGame"))
statNumber = (double) statNumber / (double) (stat / 60000);
else
statNumber = (double) statNumber / stat;
}
statNumber = (double) statNumber / stat;
}
else
statNumber += stats.getStat(statToPull + "." + statName);
@ -287,9 +282,9 @@ public enum AchievementCategory
// Special display for Words per Minute
if (displayName.equalsIgnoreCase("Words Per Minute"))
{
statString = C.cWhite + statNumber;
statString = C.cWhite + (double) statNumber * 60000;
if(statString.length() > 7)
statString.substring(0, 6);
statString = statString.substring(0, 7);
lore.add(C.cYellow + displayName + ": " + statString);
continue;

View File

@ -39,11 +39,13 @@ import nautilus.game.arcade.game.games.typewars.stats.DumbledontStatTracker;
import nautilus.game.arcade.game.games.typewars.stats.HoarderStatTracker;
import nautilus.game.arcade.game.games.typewars.stats.KillsStatTracker;
import nautilus.game.arcade.game.games.typewars.stats.PerfectionistStatTracker;
import nautilus.game.arcade.game.games.typewars.stats.TimeInGameTracker;
import nautilus.game.arcade.game.games.typewars.stats.WaitForItStatTracker;
import nautilus.game.arcade.game.games.typewars.tutorial.TutorialTypeWars;
import nautilus.game.arcade.gametutorial.events.GameTutorialEndEvent;
import nautilus.game.arcade.gametutorial.events.GameTutorialStartEvent;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.TimeInGameStatTracker;
import nautilus.game.arcade.world.WorldData;
import org.bukkit.Bukkit;
@ -162,10 +164,12 @@ public class TypeWars extends TeamGame
new HoarderStatTracker(this),
new PerfectionistStatTracker(this),
new WaitForItStatTracker(this),
new KillsStatTracker(this)
new KillsStatTracker(this),
new TimeInGameTracker(this)
);
manager.GetCreature().SetDisableCustomDrops(true);
manager.GetChat().setThreeSecondDelay(false);
}
@EventHandler
@ -290,16 +294,20 @@ public class TypeWars extends TeamGame
@EventHandler
public void Players(UpdateEvent event)
{
if(GetState() != GameState.Live && GetState() != GameState.End)
return;
if(event.getType() != UpdateType.TICK)
return;
for(Player player : GetPlayers(true))
{
player.setAllowFlight(true);
player.setFlying(true);
UtilTextBottom.display(C.cGreen + "You have $" + _moneyMap.get(player), player);
Recharge.Instance.Reset(player, "Chat Message");
for(Minion minion : _activeMinions)
{
if(UtilMath.offset(minion.getEntity().getLocation(), player.getLocation()) < 1)
@ -928,8 +936,13 @@ public class TypeWars extends TeamGame
}
for (Player player : team.GetPlayers(false))
{
if (player.isOnline())
{
AddGems(player, 10, "Participation", false, false);
AddGems(player, getPlayerKills(player), getPlayerKills(player) + " Minions killed", false, true);
}
}
}
Iterator<Minion> minionIterator = _activeMinions.iterator();
@ -963,6 +976,7 @@ public class TypeWars extends TeamGame
//End
Manager.GetCreature().SetDisableCustomDrops(false);
Manager.GetChat().setThreeSecondDelay(true);
SetState(GameState.End);
}

View File

@ -0,0 +1,32 @@
package nautilus.game.arcade.game.games.typewars.stats;
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;
public class TimeInGameTracker extends StatTracker<Game>
{
public TimeInGameTracker(Game game)
{
super(game);
}
@EventHandler
public void end(GameStateChangeEvent event)
{
if(event.GetState() != GameState.End)
return;
for(Player player : getGame().GetPlayers(true))
{
addStat(player, "TimeInGame", (int) (System.currentTimeMillis() - getGame().getGameLiveTime()), false, false);
}
}
}