-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from xiv-gear-planner/gear-acquisition-source
Gear acquisition source logic
- Loading branch information
Showing
15 changed files
with
359 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/groovy/gg/xp/xivgear/dataapi/gear/Expansion.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package gg.xp.xivgear.dataapi.gear | ||
|
||
enum Expansion { | ||
|
||
Stormblood(290, 310, 340), | ||
Shadowbringers(430, 440, 470), | ||
Endwalker(560, 570, 600), | ||
Dawntrail(690, 700, 730) | ||
|
||
final int artifactLevel | ||
final int basicTomeLevel | ||
final List<Integer> raidTierLevels | ||
|
||
private Expansion(int artifactLevel, int basicTomeLevel, int firstRaidTierLevel) { | ||
this.artifactLevel = artifactLevel | ||
this.basicTomeLevel = basicTomeLevel | ||
this.raidTierLevels = [firstRaidTierLevel, firstRaidTierLevel + 30, firstRaidTierLevel + 60].asImmutable() | ||
} | ||
|
||
|
||
} |
66 changes: 66 additions & 0 deletions
66
src/main/groovy/gg/xp/xivgear/dataapi/gear/GearLevels.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package gg.xp.xivgear.dataapi.gear | ||
|
||
|
||
import jakarta.inject.Singleton | ||
|
||
@Singleton | ||
class GearLevels { | ||
|
||
/** | ||
* Check whether an ilvl matches the basic start-of-expac artifact level | ||
* | ||
* @param ilvl | ||
* @return | ||
*/ | ||
static boolean isArtifactLevel(int ilvl) { | ||
return Expansion.values().any { | ||
it.artifactLevel == ilvl | ||
} | ||
} | ||
|
||
/** | ||
* Check whether an ilvl matches the basic start-of-expac tome ilvl (e.g. Ronkan) | ||
* | ||
* @param ilvl | ||
* @return | ||
*/ | ||
static boolean isBasicTomeLevel(int ilvl) { | ||
return Expansion.values().any { | ||
it.basicTomeLevel == ilvl | ||
} | ||
} | ||
|
||
private static boolean checkRelativeToRaid(int ilvl, int offset) { | ||
return Expansion.values().any { | ||
it.raidTierLevels.any { raidIlvl -> | ||
raidIlvl + offset == ilvl | ||
} | ||
} | ||
} | ||
|
||
static boolean isSavageRaidLevel(int ilvl) { | ||
return checkRelativeToRaid(ilvl, 0) | ||
} | ||
|
||
static boolean isSavageRaidWeaponLevel(int ilvl) { | ||
return checkRelativeToRaid(ilvl, 5) | ||
} | ||
|
||
static boolean isNormalRaidLevel(int ilvl) { | ||
return checkRelativeToRaid(ilvl, -20) | ||
} | ||
|
||
static boolean isUnAugmentedTomeLevel(int ilvl) { | ||
return checkRelativeToRaid(ilvl, -10) | ||
} | ||
|
||
/** | ||
* Check whether an ilvl matches the non-start-of-expac extreme trial ilvls | ||
* | ||
* @param ilvl | ||
* @return | ||
*/ | ||
static boolean isExTrialLevel(int ilvl) { | ||
return checkRelativeToRaid(ilvl, -5) || checkRelativeToRaid(ilvl, -15) | ||
} | ||
} |
Oops, something went wrong.