Fix dodgy rewards for big weeklys

This commit is contained in:
Sam 2018-06-30 15:26:19 +01:00 committed by Alexander Meech
parent cece5910a2
commit 89d95adfb2
2 changed files with 5 additions and 4 deletions

View File

@ -161,7 +161,8 @@ public class MissionManager extends MiniDbClientPlugin<MissionClient>
// Here we attempt to fix a duplication bug caused by players joining US and EU at the same time.
// How? well we know that players can have a maximum of 8 (non-event) missions total. So in that case
// when they join a server with more than they should we'll clear everything from their 9th mission
// onwards.
// onwards. But isn't that going to remove missions with higher ids? No, look down and you'll see that
// we sort the missions by the time they were started.
if (!context.isEventMission() && ++nonEventMissions > MAX_TOTAL)
{
runAsync(() -> _repository.clearMission(accountId, missionId));
@ -199,7 +200,7 @@ public class MissionManager extends MiniDbClientPlugin<MissionClient>
@Override
public String getQuery(int accountId, String uuid, String name)
{
return "SELECT * FROM accountMissions WHERE accountId=" + accountId + ";";
return "SELECT * FROM accountMissions WHERE accountId=" + accountId + " ORDER BY startTime;";
}
@EventHandler(priority = EventPriority.LOW)

View File

@ -46,9 +46,9 @@ public class PlayerMission<T> implements Mission<T>
{
_rewards = new LevelReward[_context.getRewards().length];
// Reduce the reward scaling if the number is >= 500
// Reduce the reward scaling if the number is really big
// This is only the case for things like the "Walk x blocks" missions.
int x = _x >= 500 ? _x / 100 : _x;
int x = _x >= (_length == MissionLength.WEEK ? 1000 : 500) ? _x / 100 : _x;
for (int i = 0; i < _rewards.length; i++)
{