added mineplex level
removed ability to go into negative gems as villager morph
This commit is contained in:
parent
6ded835ba4
commit
fadaa59526
@ -2,6 +2,12 @@ package mineplex.core.achievement;
|
||||
|
||||
public enum Achievement
|
||||
{
|
||||
GLOBAL_MINEPLEX_LEVEL("Mineplex Level", 20000,
|
||||
new String[]{"Global.ExpEarned"},
|
||||
new String[]{"Level up by doing well in games!"},
|
||||
getExperienceLevels(),
|
||||
AchievementCategory.GLOBAL),
|
||||
|
||||
GLOBAL_GEM_HUNTER("Gem Hunter", 10000,
|
||||
new String[]{"Global.GemsEarned"},
|
||||
new String[]{"+1 for every Gem earned in any game."},
|
||||
@ -582,6 +588,16 @@ public enum Achievement
|
||||
_category = category;
|
||||
}
|
||||
|
||||
private static int[] getExperienceLevels()
|
||||
{
|
||||
int[] levels = new int[200];
|
||||
|
||||
for (int i=0 ; i<levels.length ; i++)
|
||||
levels[i] = 1000 * i;
|
||||
|
||||
return levels;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
|
@ -19,8 +19,8 @@ import mineplex.core.stats.StatsManager;
|
||||
public enum AchievementCategory
|
||||
{
|
||||
GLOBAL("Global", null,
|
||||
new String[] { "GemsEarned", null, "GamesPlayed", "TimeInGame" },
|
||||
new String[] { "Gems Earned", null, "Games Played", "Time In Game" },
|
||||
new String[] { "ExpEarned", "GemsEarned", null, "GamesPlayed", "TimeInGame" },
|
||||
new String[] { "Mineplex Level", "Gems Earned", null, "Games Played", "Time In Game" },
|
||||
Material.EMERALD, 0, GameCategory.GLOBAL, null),
|
||||
|
||||
//Survival
|
||||
|
@ -16,6 +16,7 @@ import org.bukkit.event.player.*;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
@ -70,7 +71,7 @@ public class MorphVillager extends MorphGadget implements IThrown
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Audio(PlayerInteractEvent event)
|
||||
public void skill(PlayerInteractEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
@ -80,6 +81,12 @@ public class MorphVillager extends MorphGadget implements IThrown
|
||||
if (!UtilEvent.isAction(event, ActionType.L))
|
||||
return;
|
||||
|
||||
if (Manager.getDonationManager().Get(player.getName()).GetBalance(CurrencyType.Gems) < 20)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Gadget", "You do not have enough Gems."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Recharge.Instance.use(player, GetName(), 800, false, false))
|
||||
return;
|
||||
|
||||
|
@ -44,6 +44,7 @@ import mineplex.core.RankBenefitsGiver9000;
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.event.RetrieveClientInformationEvent;
|
||||
import mineplex.core.achievement.Achievement;
|
||||
import mineplex.core.achievement.AchievementManager;
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.common.Rank;
|
||||
@ -613,6 +614,9 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
|
||||
boolean ownsUltra = _donationManager.Get(player.getName()).OwnsUltraPackage();
|
||||
|
||||
//Level Prefix
|
||||
String levelStr = ChatColor.WHITE + "" + _achievementManager.get(player, Achievement.GLOBAL_MINEPLEX_LEVEL).getLevel() + " ";
|
||||
|
||||
//Rank Prefix
|
||||
String rankStr = "";
|
||||
if (rank != Rank.ALL)
|
||||
@ -630,7 +634,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
event.getRecipients().clear();
|
||||
|
||||
event.setMessage(event.getMessage().substring(1, event.getMessage().length()));
|
||||
event.setFormat(C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + "%1$s " + C.cPurple + "%2$s");
|
||||
event.setFormat(levelStr + C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + "%1$s " + C.cPurple + "%2$s");
|
||||
|
||||
for (String name : party.GetPlayers())
|
||||
{
|
||||
@ -659,7 +663,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
}
|
||||
|
||||
event.setMessage(event.getMessage());
|
||||
event.setFormat(rankStr + C.cYellow + "%1$s " + C.cWhite + "%2$s");
|
||||
event.setFormat(levelStr + rankStr + C.cYellow + "%1$s " + C.cWhite + "%2$s");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -286,6 +286,7 @@ public abstract class Game implements Listener
|
||||
new KillsStatTracker(this),
|
||||
new DeathsStatTracker(this),
|
||||
new AssistsStatTracker(this),
|
||||
new ExperienceStatTracker(this),
|
||||
new WinStatTracker(this),
|
||||
new LoseStatTracker(this),
|
||||
new DamageDealtStatTracker(this),
|
||||
|
@ -2,6 +2,7 @@ package nautilus.game.arcade.managers;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import mineplex.core.achievement.Achievement;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
@ -59,6 +60,13 @@ public class GameChatManager implements Listener
|
||||
if (Manager.GetGame() != null)
|
||||
ownsUltra= Manager.GetDonation().Get(sender.getName()).OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA");
|
||||
|
||||
//Level Prefix
|
||||
String levelStr = "";
|
||||
if (!Manager.GetGame().IsLive())
|
||||
{
|
||||
levelStr = ChatColor.WHITE + "" + Manager.GetAchievement().get(sender, Achievement.GLOBAL_MINEPLEX_LEVEL).getLevel() + " ";
|
||||
}
|
||||
|
||||
//Rank Prefix
|
||||
String rankStr = "";
|
||||
if (rank != Rank.ALL)
|
||||
@ -68,7 +76,7 @@ public class GameChatManager implements Listener
|
||||
rankStr = Rank.ULTRA.GetTag(true, true) + " ";
|
||||
|
||||
//Base Format
|
||||
event.setFormat(dead + rankStr + Manager.GetColor(sender) + "%1$s " + ChatColor.WHITE + "%2$s");
|
||||
event.setFormat(dead + levelStr + rankStr + Manager.GetColor(sender) + "%1$s " + ChatColor.WHITE + "%2$s");
|
||||
|
||||
//Public/Private (Not If Player Dead)
|
||||
if (Manager.GetGame() != null && Manager.GetGame().GetState() == GameState.Live)
|
||||
@ -84,13 +92,13 @@ public class GameChatManager implements Listener
|
||||
if (event.getMessage().charAt(0) == '@')
|
||||
{
|
||||
event.setMessage(event.getMessage().substring(1, event.getMessage().length()));
|
||||
event.setFormat(C.cWhite + C.Bold + "Team" + " " + dead + rankStr + team.GetColor() + "%1$s " + C.cWhite + "%2$s");
|
||||
event.setFormat(C.cWhite + C.Bold + "Team" + " " + dead + levelStr + rankStr + team.GetColor() + "%1$s " + C.cWhite + "%2$s");
|
||||
}
|
||||
//All Chat
|
||||
else
|
||||
{
|
||||
globalMessage = true;
|
||||
event.setFormat(dead + rankStr + team.GetColor() + "%1$s " + C.cWhite + "%2$s");
|
||||
event.setFormat(dead + levelStr + rankStr + team.GetColor() + "%1$s " + C.cWhite + "%2$s");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,66 @@
|
||||
package nautilus.game.arcade.stats;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.GemData;
|
||||
|
||||
public class ExperienceStatTracker extends StatTracker<Game>
|
||||
{
|
||||
private long _startTime;
|
||||
|
||||
public ExperienceStatTracker(Game game)
|
||||
{
|
||||
super(game);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onGameStart(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() == Game.GameState.Live)
|
||||
_startTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onGameEnd(GameStateChangeEvent event)
|
||||
{
|
||||
if (!event.GetGame().Manager.IsRewardStats() || !event.GetGame().Manager.IsRewardAchievements())
|
||||
return;
|
||||
|
||||
if (event.GetState() == Game.GameState.End)
|
||||
{
|
||||
List<Player> winners = getGame().getWinners();
|
||||
|
||||
if (winners != null)
|
||||
{
|
||||
for (Player player : event.GetGame().GetPlayers(false))
|
||||
{
|
||||
//Tally Gems
|
||||
double gems = 0;
|
||||
for (GemData gem : event.GetGame().GetGems(player).values())
|
||||
gems += (int)gem.Gems;
|
||||
|
||||
//Game Time
|
||||
double time = (int) ((System.currentTimeMillis() - _startTime)/60000d);
|
||||
|
||||
//Mult
|
||||
double mult = 1;
|
||||
if (!winners.contains(player))
|
||||
mult = 0.5;
|
||||
|
||||
//Exp
|
||||
int expGained = (int)(time*gems*mult);
|
||||
|
||||
//Record Global and per Game
|
||||
addStat(player, "ExpEarned", expGained, false, true);
|
||||
addStat(player, "ExpEarned", expGained, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user