-
-
Notifications
You must be signed in to change notification settings - Fork 497
Spirit Tree cache for PoH #1493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a9a1af0
5dec5e4
c7f09d6
07a1f3c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -15,6 +15,7 @@ | |||
| import net.runelite.client.plugins.microbot.questhelper.helpers.mischelpers.farmruns.CropState; | ||||
| import net.runelite.client.plugins.microbot.questhelper.helpers.mischelpers.farmruns.FarmingPatch; | ||||
| import net.runelite.client.plugins.microbot.util.cache.Rs2SpiritTreeCache; | ||||
| import net.runelite.client.plugins.microbot.util.gameobject.Rs2GameObject; | ||||
| import net.runelite.client.plugins.microbot.util.misc.Rs2UiHelper; | ||||
| import net.runelite.client.plugins.microbot.util.player.Rs2Player; | ||||
| import net.runelite.client.plugins.microbot.util.poh.PohTeleports; | ||||
|
|
@@ -199,9 +200,9 @@ public enum SpiritTree { | |||
| null, // Location is dynamic based on player's house | ||||
| SpiritTreeType.POH, | ||||
| List.of(Quest.TREE_GNOME_VILLAGE, Quest.THE_GRAND_TREE, Quest.FAIRYTALE_II__CURE_A_QUEEN), | ||||
| 75, // Requires 75 Construction | ||||
| 95, // Requires 95 Construction | ||||
| VarbitID.POH_SPIRIT_TREE_UPROOTED, // TODO Must be checkedPOH Spirit Tree varbit (combined tree/ring uses same varbit) | ||||
| List.of(ObjectID.POH_SPIRIT_RING), // TODO Must be checked Spirit Ring object ID // we must update it. here are also variations for it.. leauge skins | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why use Rs2GameObject here and not the actual IDs from ObjectID? Not using the variations and also only the spirit tree variation with the fairy ring.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Well, the Rs2GameObjects.getObjectIdsByName function returns a list of all IDS we're interested in, which is exactly what you also want I believe? Line 1868 in 2239281
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The requirement for Spirit tree with fairy rings is 95 construction: https://oldschool.runescape.wiki/w/Spirit_tree_%26_fairy_ring
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i see why it better to use the reflection approach here, because of the different IDs per configuration, great job on the changes otherwise.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Aah I understand your confusion. It is unclear from the diff that I am changing only the Spirit Rings, not Spirit Tree enum value. |
||||
| Rs2GameObject.getObjectIdsByName("poh_spirit_ring"), | ||||
| new int[] {-1}, // Region must be player's own house | ||||
| "Your house" | ||||
| ); | ||||
|
|
@@ -249,16 +250,6 @@ public boolean isAvailableForTravel() { | |||
| return isPatchHealthyAndGrown(); | ||||
| } | ||||
|
|
||||
| // Check construction level for POH trees | ||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you elaborate why you removed this? I'm not fully understanding this change.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I removed it from the function Additional rant: There is also a
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Makes sense |
||||
| if (type == SpiritTreeType.POH) { | ||||
| if (Rs2Player.getRealSkillLevel(Skill.CONSTRUCTION) < requiredSkillLevel || !Rs2Farming.hasRequiredFarmingLevel(75)) { | ||||
| return false; | ||||
| } | ||||
|
|
||||
| // For POH trees, check if they are built and player is in their house | ||||
| return isPOHTreeAvailable(); | ||||
| } | ||||
|
|
||||
| // Built-in trees are always available if quest requirements are met | ||||
| return true; | ||||
| } | ||||
|
|
||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove these functions entirely, and why can't we update the state based on the varbit for the spirit tree?We must wait for the object cache check to complete the scan and have populated the update. In the handleGameStateChanged, you cannot use the cache because it's not updated, so we would need to wait for the object cache to be updated on the object spawn and despawn events, also on a gamestate change event.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use the varbit still. I didn't touch the part for POH spirit tree varbits that you left with //TODO to still be implemented:
What I removed from handleVarbitChange was just a proxy for scanning for gameobjects:
This is what I gave as a reason to remove scanning for objects in POH from the handleGameStateChanged function. I'm not sure what you're saying here exaclty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to delay the scan, of course, until the data are stable. This is what I'm referring to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that would be an option. How long are you going to delay it for? Until the game object spawns preferably, right? So how about we just look at the gameobjectspawns event instead and skip the delaying setup altogether?