-
Notifications
You must be signed in to change notification settings - Fork 1
Improve bot hunting routes and party recruitment #82
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
94df4ae
Improve bot hunting ground scheduling
pmbstyle c91162e
Optimize cold gear planning
pmbstyle a248d26
Fix cold travel state churn
pmbstyle 2d6f142
Prioritize required party requests
pmbstyle 8ac8645
Address PR review feedback
pmbstyle 366ba34
Guard stale plans by active status
pmbstyle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,93 @@ | ||
| const ServerResponse = invoke('GameServer/Network/Response'); | ||
| const SpotService = invoke('GameServer/Bot/AI/SpotService'); | ||
| const BotEventJournal = invoke('GameServer/Bot/AI/BotEventJournal'); | ||
|
|
||
| const SOE_SKILL_ID = 2013; | ||
| const SOE_CAST_MS = 20000; | ||
| const TELEPORT_SETTLE_MS = 1200; | ||
|
|
||
| function hasFiniteCoordinate(value) { | ||
| return value !== null | ||
| && value !== undefined | ||
| && String(value).trim() !== '' | ||
| && Number.isFinite(Number(value)); | ||
| } | ||
|
|
||
| function active(session) { | ||
| return !!session?.spotRelocation; | ||
| } | ||
|
|
||
| function cancel(session, bot, reason = 'cancelled') { | ||
| if (!session?.spotRelocation) return false; | ||
| if (session.spotRelocation.arrivalPending) return false; | ||
| session.spotRelocation = undefined; | ||
| bot?.state?.setCasts?.(false); | ||
| session.lastSpotRelocation = { reason, at: Date.now() }; | ||
| return true; | ||
| } | ||
|
|
||
| function start(session, bot, spot, targetLoc = null) { | ||
| if (!session || !bot || !spot) return false; | ||
| if (session.spotRelocation) return session.spotRelocation.spotId === spot.id; | ||
|
|
||
| const token = Symbol('spot-relocation'); | ||
| const destination = { ...(targetLoc || spot.center) }; | ||
| if (!['locX', 'locY', 'locZ'].every((key) => hasFiniteCoordinate(destination[key]))) return false; | ||
| destination.locX = Number(destination.locX); | ||
| destination.locY = Number(destination.locY); | ||
| destination.locZ = Number(destination.locZ); | ||
| session.spotRelocation = { | ||
| token, | ||
| spotId: spot.id, | ||
| destination, | ||
| startedAt: Date.now(), | ||
| completesAt: Date.now() + SOE_CAST_MS, | ||
| method: 'soe_gatekeeper' | ||
| }; | ||
| bot.state.setCasts(true); | ||
| const skill = { | ||
| fetchSelfId: () => SOE_SKILL_ID, | ||
| fetchCalculatedHitTime: () => SOE_CAST_MS, | ||
| fetchReuseTime: () => 0 | ||
| }; | ||
| session.dataSendToMeAndOthers?.(ServerResponse.skillStarted(bot, bot.fetchId(), skill), bot); | ||
|
|
||
| setTimeout(() => { | ||
| const relocation = session.spotRelocation; | ||
| if (!relocation || relocation.token !== token) return; | ||
| if (bot.isDead?.() || session.currentTargetId || session.incomingThreatId) { | ||
| cancel(session, bot, 'combat_interrupt'); | ||
| return; | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| } | ||
|
|
||
| bot.state.setCasts(false); | ||
| const TeleportTo = invoke('GameServer/Actor/Generics/TeleportTo'); | ||
| TeleportTo(session, bot, destination); | ||
| const arrivedSpot = SpotService.findById(spot.id) || spot; | ||
| SpotService.assignSpot(session, arrivedSpot); | ||
| session.initialSpawnCoord = { ...arrivedSpot.center }; | ||
| session.townRoutePlan = null; | ||
| session.spotRelocation = { ...relocation, arrivalPending: true }; | ||
| setTimeout(() => { | ||
| if (session.spotRelocation?.token !== token) return; | ||
| session.spotRelocation = undefined; | ||
| session.lastSpotRelocation = { | ||
| spotId: arrivedSpot.id, | ||
| method: 'soe_gatekeeper', | ||
| at: Date.now() | ||
| }; | ||
| }, TELEPORT_SETTLE_MS); | ||
| Promise.resolve(BotEventJournal.record({ | ||
| botId: bot.fetchId(), | ||
| eventType: 'travel_complete', | ||
| summary: `${bot.fetchName?.() || 'Bot'} reached ${arrivedSpot.name || 'a hunting ground'} via SoE and gatekeeper.`, | ||
| weight: 2, | ||
| dedupeKey: `spot-travel:${bot.fetchId()}:${arrivedSpot.id}`, | ||
| coalesceWindowMs: 30000, | ||
| meta: { spotId: arrivedSpot.id, method: 'soe_gatekeeper' } | ||
| })).catch(() => {}); | ||
| }, SOE_CAST_MS); | ||
| return true; | ||
| } | ||
|
|
||
| module.exports = { SOE_CAST_MS, TELEPORT_SETTLE_MS, active, cancel, start }; | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.