Debug ExperienceTable

This commit is contained in:
Ka0rX 2022-07-03 10:10:11 +02:00
parent b6f26a627f
commit e018836a6d
3 changed files with 6 additions and 3 deletions

View File

@ -936,7 +936,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
* checks if they could potentially upgrade to one of these * checks if they could potentially upgrade to one of these
* *
* @return If the player can change its current class to * @return If the player can change its current class to
* a subclass * a subclass
*/ */
public boolean canChooseSubclass() { public boolean canChooseSubclass() {
for (Subclass subclass : getProfess().getSubclasses()) for (Subclass subclass : getProfess().getSubclasses())

View File

@ -5,6 +5,7 @@ import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.quest.trigger.Trigger; import net.Indyuce.mmocore.api.quest.trigger.Trigger;
import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.PlayerData;
import org.apache.commons.lang.Validate; import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import java.util.ArrayList; import java.util.ArrayList;
@ -50,7 +51,7 @@ public class ExperienceItem {
Validate.isTrue(config.contains("triggers")); Validate.isTrue(config.contains("triggers"));
id = config.getName(); id = config.getName();
period = config.getInt("period", 0); period = config.getInt("period", 1);
firstTrigger = config.getInt("first-trigger", period); firstTrigger = config.getInt("first-trigger", period);
claimChance = config.getDouble("chance", 100) / 100; claimChance = config.getDouble("chance", 100) / 100;
failReduction = config.getDouble("fail-reduction", 80) / 100; failReduction = config.getDouble("fail-reduction", 80) / 100;
@ -71,7 +72,7 @@ public class ExperienceItem {
* account the randomness factor from the 'chance' parameter * account the randomness factor from the 'chance' parameter
*/ */
public boolean roll(int professionLevel, int timesCollected) { public boolean roll(int professionLevel, int timesCollected) {
int claimsRequired = professionLevel + 1 - (firstTrigger - timesCollected * period); int claimsRequired = (professionLevel + 1 - (firstTrigger + (timesCollected) * period));
if (claimsRequired < 1) if (claimsRequired < 1)
return false; return false;

View File

@ -4,6 +4,7 @@ import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.experience.ExperienceObject; import net.Indyuce.mmocore.experience.ExperienceObject;
import org.apache.commons.lang.Validate; import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import java.util.ArrayList; import java.util.ArrayList;
@ -44,6 +45,7 @@ public class ExperienceTable {
*/ */
public void claim(PlayerData levelingUp, int professionLevel, ExperienceObject object) { public void claim(PlayerData levelingUp, int professionLevel, ExperienceObject object) {
for (ExperienceItem item : items) { for (ExperienceItem item : items) {
int timesClaimed = levelingUp.getClaims(object, this, item); int timesClaimed = levelingUp.getClaims(object, this, item);
if (!item.roll(professionLevel, timesClaimed)) if (!item.roll(professionLevel, timesClaimed))
continue; continue;