Fixes bundle 3 + new things#4212
Merged
Merged
Conversation
Henrybk
referenced
this pull request
May 19, 2026
* Added missing keys to config * bundle * Update config.txt * Update Misc.pm * pot * Update config.txt
alisonrag
approved these changes
Jul 4, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR is a follow-up fixes bundle for the previous routing, attack, eventMacro, teleport, and automation updates.
It now includes a broader set of stability and correctness fixes around:
portalsLOS.txtrecovery;Main changes
Portal recording and portal coordinate updates
Adds:
When enabled, OpenKore can update existing portal coordinates in
portals.txtinstead of blindly appending duplicate portal records.This helps when a known portal is slightly wrong, for example:
but the real observed transition is:
Instead of appending a second near-duplicate line, OpenKore can replace the old canonical entry.
New/updated helpers:
replacePortalLUTcan:updatePortalLUTandupdatePortalLUT2now usereplacePortalLUTinstead of direct file append.Portal update candidate tracking
Task::MapRoute::mapChangednow stores a portal update candidate when a route uses a known simple portal:After the map change,
processPortalRecordingcompares the expected transition against the real arrival and updatesportals.txtif needed.Nearby sibling correction is also supported with conservative drift thresholds:
Corrupted
portalsLOS.txtrecoveryAdds startup validation for
portalsLOS.txt.If OpenKore detects malformed LOS entries, such as:
it removes the corrupted file and forces a clean portal LOS rebuild.
This prevents route compilation from reusing broken portal LOS data.
Cast-aware condition checks
Adds new condition checks for self/player/monster config blocks.
Self conditions:
Player/monster target conditions:
New helpers:
These allow configs to detect whether a specific skill is already being cast on an actor, or whether a visible party member is currently casting a specific skill.
Skill matching now supports:
Skill->new(auto => ...)resolution.Example:
partySkill Assumptio { lvl 5 target target_hp < 95% target_notWhileBeingCasted HP_ASSUMPTIO # [checkSelfCondition] # [checkPlayerCondition] }Example:
attackSkillSlot Decrease Agility { lvl 10 target_notWhileBeingCasted MER_DECAGI # [checkSelfCondition] # [checkMonsterCondition] }Example:
useSelf_skill Magnificat { lvl 5 whenNoNearPartyMemberCasting PR_MAGNIFICAT # [checkSelfCondition] }eCast self cast-blocking status support
eCastnow hookscheckSelfConditionand blocks skill usage when self has statuses that prevent casting.Examples of blocked statuses include:
This prevents
attackSkillSlot,attackComboSlot,useSelf_skill,partySkill, andmonsterSkillfrom attempting casts while the character is unable to cast.Attack target switching improvements
attackChangeTargetcan now switch not only from a passive target to an aggressive target, but also from a lower-priority aggressive target to a higher-priority aggressive target.New logic compares:
This makes
priority.txtmore meaningful during active combat.Default
priority.txtnow includes:Example:
With
attackChangeTarget 1, the bot can now prefer a higher-priority aggressive target when one appears.Target selection safety
getBestTargetnow skips monsters that recently failed due to:through the new helper:
It also skips targets whose distance/path exceeds:
This prevents the attack AI from repeatedly selecting targets that are too far, recently unreachable, or recently failed LOS/path checks.
Slave attack predictive wait fix
AI::SlaveAttacknow bounds predictive waiting.If a slave cannot attack right now but prediction says the target will soon enter range/LOS, it waits only up to:
If that wait times out, predictive waiting is disabled until the slave hits the target again.
This prevents slaves from getting stuck forever waiting for a future attack window that never actually happens.
Teleport fallback and skill availability fixes
Teleport skill checks now account for:
New shared helpers:
Random teleport now requires enough SP for level 1 Teleport.
Respawn teleport now requires enough SP for level 2 Teleport.
If skill teleport is unavailable but a valid item exists, OpenKore can still use the item fallback.
Example behavior:
Route calculation and route output
Task::CalcMapRoute::getRouteStringnow includes coordinates and walk cost.Old format:
New format:
This improves debugging for route decisions, shop lookup routes, warp-item routes, and portal route choices.
searchStepnow logs route expansion with a step counter and openlist size, making route debugging easier.Route weights now include:
This makes zeny and ticket costs explicit in route scoring.
MapRoute and Route portal handling
Task::MapRoutenow marks portal route subtasks with:Task::Routenow acceptsisPortalRouteas route metadata.Missing portal detection is slightly more tolerant:
instead of requiring exact position match.
Occupied destination handling is also less brittle. If the destination cell is occupied and the actor is already adjacent to it, the route can finish one cell away instead of failing or trying to step into the occupied cell.
Auto-sell handling fix
processAutoSellnow uses the global@sellListdirectly instead of a local@sellItems.This matches
sell_result, which reads@sellList.sell_resultnow:sellAutoaction by index instead of assuming it is the current AI action.Network receive fixes
Skill delay statuses now use stable skill handles:
instead of localized skill names plus “Delay”.
skill_castnow stores:inside the actor casting state. This is required for the new cast-aware condition checks.
Self job changes now call:
Other player job-change logging remains unchanged.
EventMacro hook lifecycle cleanup
eventMacro::Corenow uses weak references for callbacks that capture$self.This helps avoid reference cycles caused by plugin hooks and log hooks keeping the eventMacro core object alive after reload/unload.
New helper:
Updated areas include:
AI_state_changehook;Unload/cleanup now also deletes stored hook handles and clears hook hashes after unregistering.
Several noisy debug messages were moved from level
2to level3.Tk, Inventory, and XKore2 hook cleanup
Several long-lived objects now use weak hook callbacks and clean up hooks in
DESTROY.Updated components:
This reduces the risk of stale hooks keeping UI/network/inventory objects alive after reloads or reconnections.
Logging overhead reduction
Log::processMsgnow only callscaller()when hooks exist.Before, caller information was computed for every log message even when no log hooks needed it.
Log level handling was centralized into:
This applies consistent
squelchDomains,debugDomains, and default-level behavior to:Interface title throttling
Interface title updates are now throttled through:
The title is only updated when the timeout allows it, reducing UI overhead from setting the same title repeatedly every main loop.
Safer
dataWaitingUtils::dataWaitingnow safely returns false for:select()failures.This prevents runtime errors when socket/file handles become invalid.
XSTools / XS / C++ cleanup
This PR includes several low-level safety fixes.
BufferedOutputStream:delete[].Unix and Win32 sockets:
inandouttoNULL;constructpath;Win32 socket output close:
instead of
SD_RECEIVE.Unix/Win32 server sockets:
strdup/free;inet_addr(address)directly.PathFinding.xs:secondWeightMapbeforeCalcPath_init;NPC shop table cleanup
tables/npc_shops.txtwas updated to normalize and improve several shop entries.Examples include standardizing tool-shop style entries with expected common items such as:
This improves
searchshopand closest-shop routing quality.New/updated tests
New tests:
Updated test registration:
New test coverage includes:
canUseTeleportbehavior with skill-only vs item fallback;dataWaitingbehavior with undefined, closed, or invalid handles.Suggested test command:
Example configs
Prevent duplicate Assumptio casts
partySkill Assumptio { lvl 5 target target_hp < 95% target_notWhileBeingCasted HP_ASSUMPTIO # [checkSelfCondition] # [checkPlayerCondition] }Prevent duplicate Magnificat casts in party
useSelf_skill Magnificat { lvl 5 sp > 40% whenNoNearPartyMemberCasting PR_MAGNIFICAT # [checkSelfCondition] }Avoid duplicate monster debuff casts
attackSkillSlot Decrease Agility { lvl 10 target_notWhileBeingCasted MER_DECAGI # [checkSelfCondition] # [checkMonsterCondition] }Portal coordinate updates
Attack target switching by priority
Example
priority.txt:Manual test notes
Portal update behavior should be tested by routing through a known portal and confirming that slightly different observed coordinates update the old
portals.txtline instead of appending duplicates.Cast-aware conditions should be tested with self casts, party target casts, monster target casts, and nearby party members casting the same skill.
Teleport fallback should be tested with low SP, muted status, silence status, Fly Wings, Butterfly Wings, and skill-only teleport setups.
Attack target switching should be tested with
attackChangeTarget 1, an already aggressive low-priority target, and a higher-priority aggressive monster entering range.Route output should be checked anywhere
getRouteStringis displayed, especiallysearchshopand map-route debug output.EventMacro reload/unload behavior should be tested to ensure hooks are removed cleanly and automacros continue to trigger normally.
Compatibility notes
portalUpdatePositiondefaults to1.<SKILL_HANDLE>_DELAY.canUseTeleportnow rejects skill teleport if the character is muted, silenced, or lacks SP, but still allows valid item fallbacks.priority.txtnow containsall, which can affect target switching whenattackChangeTargetis enabled.getBestTargetnow skips recently failed targets and targets beyondattackRouteMaxPathDistance.DESTROY, which may affect plugins relying on stale hook handles.Review focus
Please review:
replacePortalLUTbehavior with comments, blank lines, duplicates, and stepped portals.portalUpdatePositiondefault behavior.castMatchesAnySkill.actorIsBeingCastedOnscanning all visible actor lists.nearPartyMemberIsCastingonly considering visible party members.getBestTargetfiltering after recent failures.dataWaitingbehavior on invalid handles.Changed file groups
Config and tables
Plugins
Core Perl
XS / C++
Tests
Short changelog
portalUpdatePosition.replacePortalLUT.portalsLOS.txtdetection and rebuild.actorIsBeingCastedOn,nearPartyMemberIsCasting, andcastMatchesAnySkill.attackChangeTargetwith higher-priority aggressive target switching.getBestTarget.attackRouteMaxPathDistancefiltering in target selection.job_changedhook.isPortalRoute.dataWaiting.