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 _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 _minY, _maxY;
|
||||
|
||||
|
@ -30,6 +30,7 @@ import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.MiniDbClientPlugin;
|
||||
import mineplex.core.ReflectivelyCreateMiniPlugin;
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.account.permissions.PermissionGroup;
|
||||
import mineplex.core.achievement.leveling.rewards.LevelReward;
|
||||
@ -61,7 +62,16 @@ public class MissionManager extends MiniDbClientPlugin<MissionClient>
|
||||
{
|
||||
VIEW_MISSION_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;
|
||||
@ -109,6 +119,11 @@ public class MissionManager extends MiniDbClientPlugin<MissionClient>
|
||||
PermissionGroup.PLAYER.setPermission(Perm.VIEW_MISSION_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.SET_MISSIONS_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())
|
||||
{
|
||||
@ -531,21 +546,18 @@ public class MissionManager extends MiniDbClientPlugin<MissionClient>
|
||||
|
||||
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:
|
||||
return 0;
|
||||
case ULTRA:
|
||||
return 0.5;
|
||||
case HERO:
|
||||
return 1;
|
||||
case LEGEND:
|
||||
return 1.5;
|
||||
case TITAN:
|
||||
return 2;
|
||||
default:
|
||||
return 2.5;
|
||||
if (client.hasPermission(perm))
|
||||
{
|
||||
bonus += 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
return bonus;
|
||||
}
|
||||
|
||||
public void createNPC(Location location)
|
||||
|
@ -343,7 +343,7 @@ public class MissionPopulator
|
||||
.build();
|
||||
|
||||
MissionContext.<Material>newBuilder(manager, 406)
|
||||
.name("Why Thou")
|
||||
.name("Why Tho")
|
||||
.description("Craft %s gold shovels")
|
||||
.games(SurvivalGames, SurvivalGamesTeams)
|
||||
.xRange(1, 3)
|
||||
|
@ -10,9 +10,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.account.permissions.PermissionGroup;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
|
||||
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 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 String _name;
|
||||
private final ItemStack _itemStack;
|
||||
@ -88,7 +67,7 @@ public abstract class Vote<T extends Voteable>
|
||||
}
|
||||
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;
|
||||
|
@ -11,6 +11,7 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.account.permissions.PermissionGroup;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -38,6 +39,15 @@ public class VotingManager extends ListenerComponent implements Lifetimed
|
||||
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 MAPS_TO_VOTE_ON = 5;
|
||||
|
||||
@ -63,6 +73,11 @@ public class VotingManager extends ListenerComponent implements Lifetimed
|
||||
private void generatePermissions()
|
||||
{
|
||||
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)
|
||||
@ -209,6 +224,22 @@ public class VotingManager extends ListenerComponent implements Lifetimed
|
||||
_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()
|
||||
{
|
||||
return _finishedVote;
|
||||
|
Loading…
Reference in New Issue
Block a user