Alex;s PR comments
This commit is contained in:
parent
2bd4b1889b
commit
e0ff1f733b
@ -17,6 +17,15 @@ public class MissionContext<T> implements Mission<T>
|
|||||||
private final boolean _eventMission;
|
private final boolean _eventMission;
|
||||||
private final boolean _scaleDownRewards;
|
private final boolean _scaleDownRewards;
|
||||||
|
|
||||||
|
/*
|
||||||
|
To explain what these x and y values mean.
|
||||||
|
When a mission is generated for a player it picks a random x and y value between the set values.
|
||||||
|
x is used for the required progress of the mission, so for example "Kill x players".
|
||||||
|
y is used for as a requirement for progressing the mission and the tracker much provide a y less than or equal to the
|
||||||
|
y that the mission has set, for example "Kill x players within y seconds of each other".
|
||||||
|
x is used to calculate the rewards for a mission.
|
||||||
|
y values do not affect the rewards.
|
||||||
|
*/
|
||||||
private final int _minX, _maxX;
|
private final int _minX, _maxX;
|
||||||
private final int _minY, _maxY;
|
private final int _minY, _maxY;
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ import org.bukkit.util.Vector;
|
|||||||
|
|
||||||
import mineplex.core.MiniDbClientPlugin;
|
import mineplex.core.MiniDbClientPlugin;
|
||||||
import mineplex.core.ReflectivelyCreateMiniPlugin;
|
import mineplex.core.ReflectivelyCreateMiniPlugin;
|
||||||
|
import mineplex.core.account.CoreClient;
|
||||||
import mineplex.core.account.permissions.Permission;
|
import mineplex.core.account.permissions.Permission;
|
||||||
import mineplex.core.account.permissions.PermissionGroup;
|
import mineplex.core.account.permissions.PermissionGroup;
|
||||||
import mineplex.core.achievement.leveling.rewards.LevelReward;
|
import mineplex.core.achievement.leveling.rewards.LevelReward;
|
||||||
@ -61,7 +62,16 @@ public class MissionManager extends MiniDbClientPlugin<MissionClient>
|
|||||||
{
|
{
|
||||||
VIEW_MISSION_COMMAND,
|
VIEW_MISSION_COMMAND,
|
||||||
SET_MISSIONS_COMMAND,
|
SET_MISSIONS_COMMAND,
|
||||||
DEBUG_MISSION_COMMAND
|
DEBUG_MISSION_COMMAND,
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum BonusPerm implements Permission
|
||||||
|
{
|
||||||
|
MISSION_BONUS_0_5,
|
||||||
|
MISSION_BONUS_1,
|
||||||
|
MISSION_BONUS_1_5,
|
||||||
|
MISSION_BONUS_2,
|
||||||
|
MISSION_BONUS_2_5
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int MAX_DAILY = 5;
|
private static final int MAX_DAILY = 5;
|
||||||
@ -109,6 +119,11 @@ public class MissionManager extends MiniDbClientPlugin<MissionClient>
|
|||||||
PermissionGroup.PLAYER.setPermission(Perm.VIEW_MISSION_COMMAND, true, true);
|
PermissionGroup.PLAYER.setPermission(Perm.VIEW_MISSION_COMMAND, true, true);
|
||||||
PermissionGroup.ADMIN.setPermission(Perm.SET_MISSIONS_COMMAND, true, true);
|
PermissionGroup.ADMIN.setPermission(Perm.SET_MISSIONS_COMMAND, true, true);
|
||||||
PermissionGroup.ADMIN.setPermission(Perm.DEBUG_MISSION_COMMAND, true, true);
|
PermissionGroup.ADMIN.setPermission(Perm.DEBUG_MISSION_COMMAND, true, true);
|
||||||
|
PermissionGroup.ULTRA.setPermission(BonusPerm.MISSION_BONUS_0_5, true, true);
|
||||||
|
PermissionGroup.HERO.setPermission(BonusPerm.MISSION_BONUS_1, true, true);
|
||||||
|
PermissionGroup.LEGEND.setPermission(BonusPerm.MISSION_BONUS_1_5, true, true);
|
||||||
|
PermissionGroup.TITAN.setPermission(BonusPerm.MISSION_BONUS_2, true, true);
|
||||||
|
PermissionGroup.ETERNAL.setPermission(BonusPerm.MISSION_BONUS_2_5, true, true);
|
||||||
|
|
||||||
if (UtilServer.isTestServer())
|
if (UtilServer.isTestServer())
|
||||||
{
|
{
|
||||||
@ -531,23 +546,20 @@ public class MissionManager extends MiniDbClientPlugin<MissionClient>
|
|||||||
|
|
||||||
private double getRankBonus(Player player)
|
private double getRankBonus(Player player)
|
||||||
{
|
{
|
||||||
switch (ClientManager.Get(player).getPrimaryGroup())
|
CoreClient client = ClientManager.Get(player);
|
||||||
|
int bonus = 0;
|
||||||
|
|
||||||
|
for (BonusPerm perm : BonusPerm.values())
|
||||||
{
|
{
|
||||||
case PLAYER:
|
if (client.hasPermission(perm))
|
||||||
return 0;
|
{
|
||||||
case ULTRA:
|
bonus += 0.5;
|
||||||
return 0.5;
|
|
||||||
case HERO:
|
|
||||||
return 1;
|
|
||||||
case LEGEND:
|
|
||||||
return 1.5;
|
|
||||||
case TITAN:
|
|
||||||
return 2;
|
|
||||||
default:
|
|
||||||
return 2.5;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return bonus;
|
||||||
|
}
|
||||||
|
|
||||||
public void createNPC(Location location)
|
public void createNPC(Location location)
|
||||||
{
|
{
|
||||||
NPC npc = SimpleNPC.of(location, Slime.class, NPC_METADATA, 3);
|
NPC npc = SimpleNPC.of(location, Slime.class, NPC_METADATA, 3);
|
||||||
|
@ -343,7 +343,7 @@ public class MissionPopulator
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
MissionContext.<Material>newBuilder(manager, 406)
|
MissionContext.<Material>newBuilder(manager, 406)
|
||||||
.name("Why Thou")
|
.name("Why Tho")
|
||||||
.description("Craft %s gold shovels")
|
.description("Craft %s gold shovels")
|
||||||
.games(SurvivalGames, SurvivalGamesTeams)
|
.games(SurvivalGames, SurvivalGamesTeams)
|
||||||
.xRange(1, 3)
|
.xRange(1, 3)
|
||||||
|
@ -10,9 +10,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import mineplex.core.account.permissions.PermissionGroup;
|
|
||||||
import mineplex.core.common.util.UtilAlg;
|
import mineplex.core.common.util.UtilAlg;
|
||||||
import mineplex.core.common.util.UtilServer;
|
|
||||||
|
|
||||||
import nautilus.game.arcade.ArcadeManager;
|
import nautilus.game.arcade.ArcadeManager;
|
||||||
|
|
||||||
@ -38,25 +36,6 @@ public abstract class Vote<T extends Voteable>
|
|||||||
|
|
||||||
private static final int VOTE_TIME = 30;
|
private static final int VOTE_TIME = 30;
|
||||||
|
|
||||||
private static double getRankWeight(PermissionGroup group)
|
|
||||||
{
|
|
||||||
switch (group)
|
|
||||||
{
|
|
||||||
case PLAYER:
|
|
||||||
return 1.0;
|
|
||||||
case ULTRA:
|
|
||||||
return 1.1;
|
|
||||||
case HERO:
|
|
||||||
return 1.2;
|
|
||||||
case LEGEND:
|
|
||||||
return 1.3;
|
|
||||||
case TITAN:
|
|
||||||
return 1.4;
|
|
||||||
default:
|
|
||||||
return 1.5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private final ArcadeManager _manager;
|
private final ArcadeManager _manager;
|
||||||
private final String _name;
|
private final String _name;
|
||||||
private final ItemStack _itemStack;
|
private final ItemStack _itemStack;
|
||||||
@ -88,7 +67,7 @@ public abstract class Vote<T extends Voteable>
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_voteData.put(player, new VoteData<>(value, getRankWeight(_manager.GetClients().Get(player).getPrimaryGroup())));
|
_voteData.put(player, new VoteData<>(value, _manager.GetGameCreationManager().getVotingManager().getVoteWeight(player)));
|
||||||
}
|
}
|
||||||
|
|
||||||
_winnerCache = null;
|
_winnerCache = null;
|
||||||
|
@ -11,6 +11,7 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
|||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import mineplex.core.account.CoreClient;
|
||||||
import mineplex.core.account.permissions.Permission;
|
import mineplex.core.account.permissions.Permission;
|
||||||
import mineplex.core.account.permissions.PermissionGroup;
|
import mineplex.core.account.permissions.PermissionGroup;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
@ -38,6 +39,15 @@ public class VotingManager extends ListenerComponent implements Lifetimed
|
|||||||
MAP_RATINGS_COMMAND
|
MAP_RATINGS_COMMAND
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum WeightPerm implements Permission
|
||||||
|
{
|
||||||
|
VOTING_WEIGHT_10,
|
||||||
|
VOTING_WEIGHT_20,
|
||||||
|
VOTING_WEIGHT_30,
|
||||||
|
VOTING_WEIGHT_40,
|
||||||
|
VOTING_WEIGHT_50,
|
||||||
|
}
|
||||||
|
|
||||||
public static final int GAMES_TO_VOTE_ON = 3;
|
public static final int GAMES_TO_VOTE_ON = 3;
|
||||||
public static final int MAPS_TO_VOTE_ON = 5;
|
public static final int MAPS_TO_VOTE_ON = 5;
|
||||||
|
|
||||||
@ -63,6 +73,11 @@ public class VotingManager extends ListenerComponent implements Lifetimed
|
|||||||
private void generatePermissions()
|
private void generatePermissions()
|
||||||
{
|
{
|
||||||
PermissionGroup.ADMIN.setPermission(Perm.MAP_RATINGS_COMMAND, true, true);
|
PermissionGroup.ADMIN.setPermission(Perm.MAP_RATINGS_COMMAND, true, true);
|
||||||
|
PermissionGroup.ULTRA.setPermission(WeightPerm.VOTING_WEIGHT_10, true, true);
|
||||||
|
PermissionGroup.HERO.setPermission(WeightPerm.VOTING_WEIGHT_20, true, true);
|
||||||
|
PermissionGroup.LEGEND.setPermission(WeightPerm.VOTING_WEIGHT_30, true, true);
|
||||||
|
PermissionGroup.TITAN.setPermission(WeightPerm.VOTING_WEIGHT_40, true, true);
|
||||||
|
PermissionGroup.ETERNAL.setPermission(WeightPerm.VOTING_WEIGHT_50, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void callVote(Vote vote)
|
public void callVote(Vote vote)
|
||||||
@ -209,6 +224,22 @@ public class VotingManager extends ListenerComponent implements Lifetimed
|
|||||||
_manager.runAsync(() -> callback.accept(_repository.getRatings(gameDisplay.getGameId())));
|
_manager.runAsync(() -> callback.accept(_repository.getRatings(gameDisplay.getGameId())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getVoteWeight(Player player)
|
||||||
|
{
|
||||||
|
CoreClient client = _manager.GetClients().Get(player);
|
||||||
|
double weight = 1;
|
||||||
|
|
||||||
|
for (WeightPerm perm : WeightPerm.values())
|
||||||
|
{
|
||||||
|
if (client.hasPermission(perm))
|
||||||
|
{
|
||||||
|
weight += 0.1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return weight;
|
||||||
|
}
|
||||||
|
|
||||||
public Vote<?> getFinishedVote()
|
public Vote<?> getFinishedVote()
|
||||||
{
|
{
|
||||||
return _finishedVote;
|
return _finishedVote;
|
||||||
|
Loading…
Reference in New Issue
Block a user