Added new config - catalog.ltd.random

This commit is contained in:
Beny 2019-05-12 09:15:24 +01:00
parent 40ab27002b
commit e225d4d7b4
2 changed files with 15 additions and 2 deletions

View File

@ -66,5 +66,6 @@ UPDATE `users_pets` LEFT JOIN `rooms` ON `users_pets`.`room_id` = `rooms`.`id` S
ALTER TABLE `users_settings` ADD COLUMN `forums_post_count` int(11) NULL DEFAULT 0 AFTER `perk_trade`;
INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('catalog.guild.hc_required', '1');
INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('catalog.ltd.random', '1');
#END DATABASE UPDATE: 2.0.0 -> DEV

View File

@ -21,8 +21,14 @@ public class CatalogLimitedConfiguration implements Runnable
this.itemId = itemId;
this.totalSet = totalSet;
this.limitedNumbers = availableNumbers;
if(Emulator.getConfig().getBoolean("catalog.ltd.random", true)) {
Collections.shuffle(this.limitedNumbers);
}
else {
Collections.reverse(this.limitedNumbers);
}
}
public int getNumber()
{
@ -80,8 +86,14 @@ public class CatalogLimitedConfiguration implements Runnable
}
this.totalSet += amount;
if(Emulator.getConfig().getBoolean("catalog.ltd.random", true)) {
Collections.shuffle(this.limitedNumbers);
}
else {
Collections.reverse(this.limitedNumbers);
}
}
}
public int available()