-
-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Purse API and Purse Change Event (#950)
* Created Purse API and event for when it changes to allow for use in upcoming feature I am making * Removed unnecessary log statements and formatted files * Update src/main/java/de/hysky/skyblocker/utils/Utils.java Co-authored-by: Kevin <[email protected]> * Update src/main/java/de/hysky/skyblocker/utils/purse/PurseChangeCause.java Co-authored-by: Kevin <[email protected]> * Created Purse API and event for when it changes to allow for use in upcoming feature I am making * Refactor purse api * Update src/main/java/de/hysky/skyblocker/utils/purse/PurseChangeCause.java --------- Co-authored-by: Kevin <[email protected]>
- Loading branch information
1 parent
1772577
commit beeb590
Showing
3 changed files
with
83 additions
and
17 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
45 changes: 45 additions & 0 deletions
45
src/main/java/de/hysky/skyblocker/utils/purse/PurseChangeCause.java
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,45 @@ | ||
package de.hysky.skyblocker.utils.purse; | ||
|
||
import de.hysky.skyblocker.utils.Utils; | ||
import net.minecraft.client.MinecraftClient; | ||
|
||
public enum PurseChangeCause { | ||
// Gain | ||
MOB_KILL, | ||
TALISMAN_OF_COINS, | ||
DICE_SIX, | ||
TAKE_BANK, | ||
UNKNOWN_GAIN, | ||
// Loss | ||
SLAYER_QUEST, | ||
DICE_ROLL, | ||
DEPO_BANK, | ||
UNKNOWN_LOSS; | ||
|
||
public static PurseChangeCause getCause(double diff) { | ||
if (diff > 0) { | ||
if (diff == 5 || diff == 25) { | ||
return TALISMAN_OF_COINS; | ||
} | ||
|
||
if (diff == 15000000 || diff == 100000000) { | ||
return DICE_SIX; | ||
} | ||
|
||
if (MinecraftClient.getInstance().currentScreen == null) { | ||
// UI closed | ||
// need to make this more specific, but atm might as well attrib to mob kill | ||
return MOB_KILL; | ||
} else if (Utils.getIslandArea().replaceAll("\\P{InBasic_Latin}", "").strip().equals("Bank")) { | ||
return TAKE_BANK; | ||
} | ||
return UNKNOWN_GAIN; | ||
} else { | ||
// TODO: implement slayer quest loss | ||
if (diff == -6666666 || diff == -666666) { | ||
return DICE_ROLL; | ||
} | ||
return UNKNOWN_LOSS; | ||
} | ||
} | ||
} |