From 454893ecd7e27fd34254d4ae4d321b45ef41bd81 Mon Sep 17 00:00:00 2001 From: sindoring Date: Sun, 25 Oct 2026 15:38:44 +0400 Subject: [PATCH] Sync upstream through d3b5df3f Co-Authored-By: Claude Opus 5.5 (1M context) --- .gitattributes | 3 + Cargo.lock | 14 +- Cargo.toml | 8 + crates/benilla-app/Cargo.toml | 2 + crates/benilla-app/assets/ui/OptionsFrame.xml | 3 - .../benilla-app/examples/extended_launcher.rs | 6 +- crates/benilla-app/src/addon_harness/mod.rs | 24 +- crates/benilla-app/src/area.rs | 449 ++- crates/benilla-app/src/bindings.rs | 46 +- .../benilla-app/src/bindings/script_input.rs | 16 +- crates/benilla-app/src/capture/fixtures.rs | 855 ++--- .../benilla-app/src/capture/probe_auction.rs | 8 +- crates/benilla-app/src/capture/probe_bank.rs | 6 +- .../benilla-app/src/capture/probe_binder.rs | 27 +- crates/benilla-app/src/capture/probe_book.rs | 12 +- .../benilla-app/src/capture/probe_charter.rs | 39 +- crates/benilla-app/src/capture/probe_chest.rs | 22 +- crates/benilla-app/src/capture/probe_clam.rs | 37 +- .../benilla-app/src/capture/probe_crossing.rs | 4 +- .../src/capture/probe_guard_poi.rs | 1 + crates/benilla-app/src/capture/probe_mail.rs | 38 +- .../benilla-app/src/capture/probe_partner.rs | 5 +- .../benilla-app/src/capture/probe_service.rs | 73 +- .../src/capture/probe_vendor_swap.rs | 17 +- .../src/capture/probes/lift_census.rs | 2 +- .../benilla-app/src/capture/probes/reveal.rs | 89 +- crates/benilla-app/src/chat_bubble.rs | 27 +- crates/benilla-app/src/chr_classes.rs | 57 +- crates/benilla-app/src/cinematic.rs | 771 ++++- crates/benilla-app/src/client_state.rs | 7 +- crates/benilla-app/src/combat_log/chat.rs | 22 +- .../benilla-app/src/combat_log/chat/tests.rs | 21 +- .../combat_log/chat/tests/emitters/dispel.rs | 56 + .../benilla-app/src/combat_log/death_tests.rs | 28 +- crates/benilla-app/src/combat_log/feedback.rs | 47 +- crates/benilla-app/src/combat_log/mod.rs | 48 +- crates/benilla-app/src/combat_log/text.rs | 14 +- crates/benilla-app/src/console.rs | 449 ++- crates/benilla-app/src/crash.rs | 82 + crates/benilla-app/src/creature_anim.rs | 690 +++- .../benilla-app/src/creature_anim/driver.rs | 3 +- .../src/creature_anim/driver/tests.rs | 84 +- .../driver/tests/state_kit_pin.rs | 3 +- crates/benilla-app/src/creature_anim/edits.rs | 199 +- .../benilla-app/src/creature_anim/impact.rs | 1 + crates/benilla-app/src/creature_anim/net.rs | 38 +- .../benilla-app/src/creature_anim/precast.rs | 3 +- .../benilla-app/src/creature_anim/select.rs | 3 + .../benilla-app/src/creature_anim/sheath.rs | 25 + .../src/creature_anim/spell_visual.rs | 252 +- .../src/creature_anim/spell_visual/tests.rs | 411 ++- crates/benilla-app/src/cursor.rs | 81 +- crates/benilla-app/src/cvars/inert.rs | 9 +- crates/benilla-app/src/cvars/mod.rs | 197 +- .../benilla-app/src/cvars/reference_table.rs | 2 +- crates/benilla-app/src/cvars/table.rs | 53 +- crates/benilla-app/src/death/mod.rs | 737 ++-- crates/benilla-app/src/death/net.rs | 2 +- crates/benilla-app/src/debug_panel/inspect.rs | 12 +- crates/benilla-app/src/debug_panel/journal.rs | 2 + crates/benilla-app/src/entities.rs | 42 +- crates/benilla-app/src/entities/attach/mod.rs | 113 +- crates/benilla-app/src/entities/chain_beam.rs | 2 + .../benilla-app/src/entities/equipment/mod.rs | 30 +- .../benilla-app/src/entities/live_display.rs | 2 +- crates/benilla-app/src/entities/missile.rs | 618 +++- crates/benilla-app/src/entities/mount.rs | 24 +- .../benilla-app/src/entities/scene_drawn.rs | 28 + .../benilla-app/src/entities/spell_fx/mod.rs | 56 +- crates/benilla-app/src/field_watch.rs | 561 ++- crates/benilla-app/src/game_plugins.rs | 408 ++- crates/benilla-app/src/glue_session/login.rs | 9 +- crates/benilla-app/src/glue_session/mod.rs | 2 +- crates/benilla-app/src/go_anim.rs | 73 +- crates/benilla-app/src/go_templates.rs | 213 +- crates/benilla-app/src/item_lane.rs | 555 +++ crates/benilla-app/src/item_names.rs | 73 + crates/benilla-app/src/item_watch.rs | 1068 ++++-- crates/benilla-app/src/items.rs | 283 +- crates/benilla-app/src/lanes.rs | 591 ++++ .../benilla-app/src/lanes/aura_live_tests.rs | 530 +++ .../benilla-app/src/lanes/aura_view_tests.rs | 183 + crates/benilla-app/src/lanes/bag_tests.rs | 480 +++ .../benilla-app/src/lanes/group_view_tests.rs | 749 ++++ crates/benilla-app/src/lanes/guard_tests.rs | 1817 ++++++++++ .../benilla-app/src/lanes/item_live_tests.rs | 577 ++++ crates/benilla-app/src/lanes/item_tests.rs | 501 +++ .../src/lanes/packet_signal_tests.rs | 350 ++ crates/benilla-app/src/lanes/quiet_tests.rs | 104 + .../benilla-app/src/lanes/stat_live_tests.rs | 579 ++++ crates/benilla-app/src/lanes/storm_tests.rs | 207 ++ crates/benilla-app/src/lanes/tests.rs | 683 ++++ .../benilla-app/src/lanes/token_live_tests.rs | 539 +++ .../benilla-app/src/lanes/unit_live_tests.rs | 277 ++ .../benilla-app/src/lanes/unit_view_tests.rs | 658 ++++ crates/benilla-app/src/lib.rs | 8 +- crates/benilla-app/src/loading_screen.rs | 287 +- crates/benilla-app/src/loading_screen/hold.rs | 532 +++ .../benilla-app/src/loading_screen/route.rs | 408 +++ crates/benilla-app/src/local_state.rs | 21 +- crates/benilla-app/src/minimap/blips/dots.rs | 258 +- crates/benilla-app/src/minimap/blips/mod.rs | 195 +- .../src/minimap/blips/tooltip_tests.rs | 118 +- crates/benilla-app/src/minimap/interior.rs | 302 +- crates/benilla-app/src/minimap/mod.rs | 73 +- crates/benilla-app/src/minimap/ping.rs | 123 +- crates/benilla-app/src/name_persist.rs | 249 -- crates/benilla-app/src/nameplates.rs | 199 +- crates/benilla-app/src/names.rs | 379 +-- crates/benilla-app/src/net.rs | 204 +- .../benilla-app/src/net/apply/seam_tests.rs | 4 +- crates/benilla-app/src/net/handlers.rs | 121 +- crates/benilla-app/src/net/io.rs | 195 +- crates/benilla-app/src/net/io/cycle_tests.rs | 266 ++ crates/benilla-app/src/net/io/fake.rs | 108 +- crates/benilla-app/src/net/objects.rs | 271 +- crates/benilla-app/src/net/objects/update.rs | 271 +- .../src/net/objects/update_tests.rs | 335 +- crates/benilla-app/src/net/reputations.rs | 139 + crates/benilla-app/src/net/session.rs | 434 ++- .../src/net/session/reputation_tests.rs | 452 ++- crates/benilla-app/src/npc_text.rs | 71 +- crates/benilla-app/src/perf/phases.rs | 5 +- crates/benilla-app/src/pipe_warm/mod.rs | 40 +- crates/benilla-app/src/player.rs | 129 +- crates/benilla-app/src/player/approach.rs | 7 +- crates/benilla-app/src/player/camera.rs | 351 +- .../src/player/camera/mouselook_tests.rs | 163 +- crates/benilla-app/src/player/camera_axes.rs | 262 ++ crates/benilla-app/src/player/camera_saved.rs | 5 +- crates/benilla-app/src/player/camera_view.rs | 58 + crates/benilla-app/src/player/camera_zoom.rs | 32 +- crates/benilla-app/src/player/controller.rs | 546 ++- .../src/player/controller/tests.rs | 166 +- crates/benilla-app/src/player/flags.rs | 60 + crates/benilla-app/src/player/input.rs | 15 +- crates/benilla-app/src/player/movement_net.rs | 240 +- crates/benilla-app/src/player/net.rs | 2 +- crates/benilla-app/src/player/posture.rs | 326 +- .../benilla-app/src/player/posture/tests.rs | 333 +- crates/benilla-app/src/player/ride.rs | 182 +- crates/benilla-app/src/player/state.rs | 97 +- crates/benilla-app/src/player/swim.rs | 193 ++ .../src/player/teleport_hold_tests.rs | 262 ++ crates/benilla-app/src/player/view_subject.rs | 385 ++- crates/benilla-app/src/player/walk.rs | 2 +- crates/benilla-app/src/player/wire_in.rs | 358 +- crates/benilla-app/src/player/world_focus.rs | 79 +- crates/benilla-app/src/player_commands.rs | 133 +- crates/benilla-app/src/portrait/drain.rs | 581 ++++ .../benilla-app/src/portrait/loading_tests.rs | 263 ++ crates/benilla-app/src/portrait/mod.rs | 759 ++++- .../benilla-app/src/portrait/unheld_tests.rs | 119 + crates/benilla-app/src/query_cache.rs | 2 + crates/benilla-app/src/quest_markers/mod.rs | 8 + crates/benilla-app/src/quest_markers/query.rs | 91 +- crates/benilla-app/src/run_mode.rs | 147 + crates/benilla-app/src/screenshot.rs | 73 +- crates/benilla-app/src/script_calls.rs | 1499 ++++++-- crates/benilla-app/src/script_calls/census.rs | 20 + .../benilla-app/src/script_calls/disjoint.rs | 282 ++ crates/benilla-app/src/script_calls/engine.rs | 189 ++ .../src/script_calls/tests/asks.rs | 705 ++++ .../src/script_calls/tests/cast_reports.rs | 63 +- .../src/script_calls/tests/census.rs | 55 + .../src/script_calls/tests/closes.rs | 405 +++ .../src/script_calls/tests/dialogs.rs | 654 ++++ .../src/script_calls/tests/engine.rs | 183 + .../src/script_calls/tests/refusals.rs | 314 ++ .../src/script_calls/tests/selection.rs | 908 +++++ .../src/script_calls/tests/sends.rs | 724 ++++ .../src/script_calls/tests/systems.rs | 204 ++ .../src/script_calls/tests/window_verbs.rs | 157 + .../benilla-app/src/script_calls/windows.rs | 229 ++ crates/benilla-app/src/shaders.rs | 2 +- crates/benilla-app/src/sound/kit.rs | 140 +- crates/benilla-app/src/sound/mod.rs | 28 +- crates/benilla-app/src/sound/money.rs | 7 +- crates/benilla-app/src/sound/mount.rs | 15 +- crates/benilla-app/src/sound/movie.rs | 110 + crates/benilla-app/src/sound/zone.rs | 479 ++- crates/benilla-app/src/spell/bind_gates.rs | 7 +- crates/benilla-app/src/spell/cast_send.rs | 428 ++- .../src/spell/cast_send/unit_caster.rs | 4 +- crates/benilla-app/src/spell/cast_target.rs | 76 +- crates/benilla-app/src/spell/cooldowns.rs | 65 +- .../benilla-app/src/spell/group_relation.rs | 13 +- crates/benilla-app/src/spell/inflight.rs | 128 +- crates/benilla-app/src/spell/known.rs | 139 + crates/benilla-app/src/spell/mod.rs | 287 +- crates/benilla-app/src/spell/mods.rs | 5 +- crates/benilla-app/src/spell/net.rs | 608 ++-- .../src/spell/net/tests/cooldown_sites.rs | 11 +- .../src/spell/net/tests/dispatch.rs | 105 +- .../src/spell/net/tests/learned.rs | 85 + .../src/spell/net/tests/openers.rs | 49 + crates/benilla-app/src/spell/range_units.rs | 138 +- crates/benilla-app/src/spell/reads.rs | 16 +- crates/benilla-app/src/spell/report.rs | 62 +- .../benilla-app/src/spell/targeting/corpse.rs | 5 +- .../benilla-app/src/spell/targeting/cursor.rs | 183 +- .../benilla-app/src/spell/targeting/item.rs | 309 +- crates/benilla-app/src/spell/targeting/mod.rs | 149 +- .../benilla-app/src/spell/targeting/pick.rs | 128 +- .../benilla-app/src/spell/targeting/world.rs | 12 +- crates/benilla-app/src/spell/usable.rs | 70 +- crates/benilla-app/src/spell/validator.rs | 159 +- .../benilla-app/src/spell/validator_tests.rs | 174 +- crates/benilla-app/src/swing_refusal.rs | 12 +- crates/benilla-app/src/target/by_name.rs | 647 +++- crates/benilla-app/src/target/click.rs | 1373 ++++++-- .../src/target/click_loot_tests.rs | 540 +++ .../src/target/click_order_tests.rs | 201 ++ crates/benilla-app/src/target/cursor_mode.rs | 143 +- crates/benilla-app/src/target/died.rs | 1467 ++++++++ crates/benilla-app/src/target/flash.rs | 77 +- crates/benilla-app/src/target/front.rs | 17 +- crates/benilla-app/src/target/front_tests.rs | 284 +- crates/benilla-app/src/target/gate_tests.rs | 28 + crates/benilla-app/src/target/highlight.rs | 4 +- crates/benilla-app/src/target/hover.rs | 518 ++- crates/benilla-app/src/target/hover_probe.rs | 80 +- crates/benilla-app/src/target/lock.rs | 79 +- crates/benilla-app/src/target/mod.rs | 175 +- crates/benilla-app/src/target/relations.rs | 26 +- .../src/target/relations/fixture.rs | 5 +- .../src/target/relations/snapshot.rs | 3 + crates/benilla-app/src/target/ring.rs | 51 +- crates/benilla-app/src/target/scan.rs | 442 ++- crates/benilla-app/src/target/script.rs | 267 +- crates/benilla-app/src/target/track.rs | 89 + crates/benilla-app/src/target/unheld_tests.rs | 707 ++++ crates/benilla-app/src/test_support.rs | 71 +- crates/benilla-app/src/text_filter.rs | 89 +- crates/benilla-app/src/transport.rs | 679 ++-- crates/benilla-app/src/tutorial.rs | 786 ++++- .../benilla-app/src/ui_action/cast_lines.rs | 5 + crates/benilla-app/src/ui_action/drain.rs | 239 +- crates/benilla-app/src/ui_action/drop_item.rs | 372 +- .../src/ui_action/drop_item_tests.rs | 209 ++ crates/benilla-app/src/ui_action/errors.rs | 55 +- crates/benilla-app/src/ui_action/feed.rs | 73 +- .../benilla-app/src/ui_action/feed_tests.rs | 216 +- crates/benilla-app/src/ui_action/mod.rs | 116 +- .../benilla-app/src/ui_action/range_tests.rs | 205 ++ crates/benilla-app/src/ui_action/ranks.rs | 27 +- .../src/ui_action/reactive_tests.rs | 16 +- crates/benilla-app/src/ui_action/recount.rs | 65 +- crates/benilla-app/src/ui_action/state.rs | 569 +++- .../benilla-app/src/ui_action/state_tests.rs | 285 +- crates/benilla-app/src/ui_action/unlearn.rs | 208 ++ crates/benilla-app/src/ui_auction/mod.rs | 866 +++-- crates/benilla-app/src/ui_auction/net.rs | 1255 ++++++- .../benilla-app/src/ui_auction/sort_tests.rs | 612 +++- .../benilla-app/src/ui_auction/verb_tests.rs | 497 +++ crates/benilla-app/src/ui_auction/verbs.rs | 247 ++ crates/benilla-app/src/ui_aura.rs | 810 ++++- crates/benilla-app/src/ui_aura/units.rs | 297 +- crates/benilla-app/src/ui_bank/mod.rs | 126 +- crates/benilla-app/src/ui_battlefield.rs | 170 +- .../src/ui_battlefield_positions.rs | 214 +- .../benilla-app/src/ui_battlefield_score.rs | 146 +- crates/benilla-app/src/ui_bind_confirm.rs | 207 +- crates/benilla-app/src/ui_binder.rs | 51 +- crates/benilla-app/src/ui_cast.rs | 270 +- crates/benilla-app/src/ui_char.rs | 1099 +++--- crates/benilla-app/src/ui_char_call_tests.rs | 73 + crates/benilla-app/src/ui_chat.rs | 98 +- .../benilla-app/src/ui_chat/ace_gate_tests.rs | 7 +- crates/benilla-app/src/ui_chat/away.rs | 8 +- crates/benilla-app/src/ui_chat/broadcast.rs | 69 +- crates/benilla-app/src/ui_chat/channels.rs | 879 +++-- crates/benilla-app/src/ui_chat/combat.rs | 30 +- .../src/ui_chat/combat/outcome/tests.rs | 2 +- .../benilla-app/src/ui_chat/combat/tests.rs | 22 +- .../benilla-app/src/ui_chat/combat/watch.rs | 345 +- .../src/ui_chat/combat/watch/tests.rs | 307 +- .../src/ui_chat/combat_drain_tests.rs | 39 + crates/benilla-app/src/ui_chat/edit.rs | 372 +- crates/benilla-app/src/ui_chat/feed.rs | 1683 +++++---- crates/benilla-app/src/ui_chat/frames.rs | 7 + crates/benilla-app/src/ui_chat/idle.rs | 222 +- .../benilla-app/src/ui_chat/input/channel.rs | 124 + crates/benilla-app/src/ui_chat/input/drunk.rs | 187 + crates/benilla-app/src/ui_chat/input/emote.rs | 221 ++ crates/benilla-app/src/ui_chat/input/mod.rs | 413 +-- crates/benilla-app/src/ui_chat/input/parse.rs | 9 +- crates/benilla-app/src/ui_chat/input/send.rs | 186 +- crates/benilla-app/src/ui_chat/language.rs | 3 +- .../benilla-app/src/ui_chat/monster_tests.rs | 283 ++ crates/benilla-app/src/ui_chat/net.rs | 88 +- .../benilla-app/src/ui_chat/notice_tests.rs | 2 +- crates/benilla-app/src/ui_chat/recruitment.rs | 103 +- crates/benilla-app/src/ui_chat/roster.rs | 333 ++ crates/benilla-app/src/ui_chat/settings.rs | 170 +- crates/benilla-app/src/ui_chat/slot_tests.rs | 904 +++++ crates/benilla-app/src/ui_chat/tests.rs | 521 ++- crates/benilla-app/src/ui_craft.rs | 1202 ++++++- crates/benilla-app/src/ui_dialog_verbs.rs | 429 ++- crates/benilla-app/src/ui_dressup.rs | 691 +++- crates/benilla-app/src/ui_duel.rs | 143 +- .../src/ui_duel/challenge_tests.rs | 152 + crates/benilla-app/src/ui_follow.rs | 58 +- crates/benilla-app/src/ui_gm_ticket.rs | 177 +- crates/benilla-app/src/ui_gossip/mod.rs | 351 +- .../benilla-app/src/ui_gossip/verb_tests.rs | 280 ++ crates/benilla-app/src/ui_gossip/verbs.rs | 117 + crates/benilla-app/src/ui_guild/call_tests.rs | 317 ++ crates/benilla-app/src/ui_guild/feed.rs | 434 +-- crates/benilla-app/src/ui_guild/lines.rs | 4 +- crates/benilla-app/src/ui_guild/mod.rs | 377 +- crates/benilla-app/src/ui_guild/steps.rs | 153 + crates/benilla-app/src/ui_honor.rs | 186 +- crates/benilla-app/src/ui_inspect.rs | 264 +- crates/benilla-app/src/ui_instance.rs | 22 +- crates/benilla-app/src/ui_item_text.rs | 487 ++- crates/benilla-app/src/ui_items/calls.rs | 346 ++ crates/benilla-app/src/ui_items/drain.rs | 1125 +++--- .../benilla-app/src/ui_items/equip_error.rs | 205 +- crates/benilla-app/src/ui_items/feed.rs | 1400 ++++---- .../src/ui_items/feed_cooldown_tests.rs | 6 +- .../src/ui_items/feed_link_tests.rs | 101 + crates/benilla-app/src/ui_items/live.rs | 250 ++ crates/benilla-app/src/ui_items/locks.rs | 645 +--- crates/benilla-app/src/ui_items/mod.rs | 151 +- crates/benilla-app/src/ui_items/net.rs | 496 +-- crates/benilla-app/src/ui_items/verb_tests.rs | 616 ++++ crates/benilla-app/src/ui_logout.rs | 679 +++- crates/benilla-app/src/ui_loot/call_tests.rs | 947 ++++++ crates/benilla-app/src/ui_loot/calls.rs | 460 +++ crates/benilla-app/src/ui_loot/mod.rs | 2634 +++++++------- crates/benilla-app/src/ui_loot/net.rs | 568 +++- .../benilla-app/src/ui_loot/receive_tests.rs | 177 + crates/benilla-app/src/ui_loot/sweep_tests.rs | 281 ++ crates/benilla-app/src/ui_loot_roll.rs | 390 ++- .../src/ui_loot_roll/line_tests.rs | 182 + crates/benilla-app/src/ui_macro/mod.rs | 187 +- crates/benilla-app/src/ui_macro/run.rs | 425 +-- crates/benilla-app/src/ui_macro/store.rs | 353 +- crates/benilla-app/src/ui_macro/tests.rs | 361 +- crates/benilla-app/src/ui_mail/invoice.rs | 179 +- crates/benilla-app/src/ui_mail/mod.rs | 1466 +++++--- crates/benilla-app/src/ui_mail/net.rs | 226 +- crates/benilla-app/src/ui_mail/verb_tests.rs | 531 +++ crates/benilla-app/src/ui_mail/verbs.rs | 155 + .../benilla-app/src/ui_merchant/call_tests.rs | 267 ++ crates/benilla-app/src/ui_merchant/calls.rs | 171 + crates/benilla-app/src/ui_merchant/mod.rs | 451 ++- crates/benilla-app/src/ui_merchant/net.rs | 203 +- crates/benilla-app/src/ui_party/call_tests.rs | 177 + crates/benilla-app/src/ui_party/calls.rs | 252 ++ crates/benilla-app/src/ui_party/feed.rs | 1653 +++++---- .../src/ui_party/feed/roster_update_tests.rs | 10 +- .../ui_party/feed/tests/token_verb_tests.rs | 150 + crates/benilla-app/src/ui_party/mod.rs | 436 ++- crates/benilla-app/src/ui_party/net.rs | 351 +- crates/benilla-app/src/ui_party/pets.rs | 121 +- crates/benilla-app/src/ui_party/records.rs | 116 +- crates/benilla-app/src/ui_pet/bar.rs | 91 +- crates/benilla-app/src/ui_pet/call_tests.rs | 218 ++ crates/benilla-app/src/ui_pet/drain.rs | 311 +- crates/benilla-app/src/ui_pet/flush_tests.rs | 190 +- crates/benilla-app/src/ui_pet/menu.rs | 86 +- crates/benilla-app/src/ui_pet/mod.rs | 151 +- crates/benilla-app/src/ui_pet/net.rs | 167 +- crates/benilla-app/src/ui_pet/press_tests.rs | 81 +- crates/benilla-app/src/ui_pet/steps.rs | 152 + crates/benilla-app/src/ui_pet/tests.rs | 387 ++- crates/benilla-app/src/ui_pet/unit.rs | 301 +- crates/benilla-app/src/ui_pet/usable_tests.rs | 43 +- crates/benilla-app/src/ui_pet_book.rs | 120 +- crates/benilla-app/src/ui_pet_stats.rs | 135 +- .../benilla-app/src/ui_petition/call_tests.rs | 281 ++ crates/benilla-app/src/ui_petition/feed.rs | 356 +- crates/benilla-app/src/ui_petition/mod.rs | 186 +- crates/benilla-app/src/ui_petition/steps.rs | 248 ++ crates/benilla-app/src/ui_quest/lines.rs | 73 +- crates/benilla-app/src/ui_quest/mod.rs | 771 ++--- crates/benilla-app/src/ui_quest/net.rs | 7 +- crates/benilla-app/src/ui_quest/verb_tests.rs | 700 ++++ crates/benilla-app/src/ui_quest/verbs.rs | 244 ++ crates/benilla-app/src/ui_quest_log.rs | 324 +- crates/benilla-app/src/ui_quest_share.rs | 53 +- crates/benilla-app/src/ui_reputation.rs | 341 +- .../src/ui_reputation_call_tests.rs | 326 ++ .../src/ui_script/action_bar_tests.rs | 34 +- .../src/ui_script/auction_tests.rs | 21 +- crates/benilla-app/src/ui_script/bag_tests.rs | 39 + .../src/ui_script/bagnon_render_tests.rs | 14 +- .../benilla-app/src/ui_script/bank_tests.rs | 19 +- .../ui_script/battlefield_minimap_tests.rs | 4 + .../src/ui_script/battlefield_tests.rs | 1 + .../benilla-app/src/ui_script/binder_tests.rs | 1 + .../benilla-app/src/ui_script/buff_tests.rs | 4 + .../src/ui_script/character_tests.rs | 30 +- .../src/ui_script/chat_options_tests.rs | 1 + .../src/ui_script/chat_resize_tests.rs | 1 + .../benilla-app/src/ui_script/chat_tests.rs | 10 + .../src/ui_script/cinematic_tests.rs | 1 + .../src/ui_script/combat_text_tests.rs | 4 +- .../benilla-app/src/ui_script/death_tests.rs | 42 + .../src/ui_script/delete_item_tests.rs | 4 + .../benilla-app/src/ui_script/duel_tests.rs | 18 +- .../src/ui_script/durability_tests.rs | 1 + .../benilla-app/src/ui_script/escape_tests.rs | 10 +- .../benilla-app/src/ui_script/extract/mod.rs | 45 +- .../benilla-app/src/ui_script/fade_tests.rs | 2 + .../src/ui_script/frame_step_tests.rs | 42 + .../src/ui_script/friends_tests.rs | 132 +- .../src/ui_script/game_menu_addon_tests.rs | 1 + .../src/ui_script/game_menu_tests.rs | 5 +- crates/benilla-app/src/ui_script/glue.rs | 197 +- .../src/ui_script/glue_input_tests.rs | 65 +- crates/benilla-app/src/ui_script/glue_mgr.rs | 193 +- .../src/ui_script/glue_mgr_tests.rs | 500 +++ .../src/ui_script/group_loot_tests.rs | 3 + .../benilla-app/src/ui_script/guild_tests.rs | 2 + .../src/ui_script/help_frame_tests.rs | 9 + .../src/ui_script/honor_frame_tests.rs | 3 +- crates/benilla-app/src/ui_script/input.rs | 26 +- .../src/ui_script/inspect_tests.rs | 1 + .../src/ui_script/instance_tests.rs | 2 + .../src/ui_script/keybindings_tests.rs | 4 +- .../benilla-app/src/ui_script/layer_tests.rs | 6 +- crates/benilla-app/src/ui_script/lifecycle.rs | 382 ++- .../benilla-app/src/ui_script/loot_tests.rs | 144 +- .../benilla-app/src/ui_script/macro_tests.rs | 1 + .../src/ui_script/merchant_tests.rs | 27 +- .../src/ui_script/minimap_tests.rs | 9 + crates/benilla-app/src/ui_script/mod.rs | 157 +- crates/benilla-app/src/ui_script/movie.rs | 318 ++ .../src/ui_script/multibar_stance_tests.rs | 4 + .../src/ui_script/options_tests.rs | 37 +- .../src/ui_script/panel_template_tests.rs | 1 + .../benilla-app/src/ui_script/panel_tests.rs | 45 +- .../src/ui_script/perf_bar_tests.rs | 1 + .../src/ui_script/pet_bar_tests.rs | 17 +- .../src/ui_script/pet_frame_tests.rs | 1 + .../src/ui_script/protected_gate_tests.rs | 2 + .../src/ui_script/quest_share_tests.rs | 18 +- .../benilla-app/src/ui_script/quest_tests.rs | 24 +- .../src/ui_script/questlog_tests.rs | 27 +- .../benilla-app/src/ui_script/quiver_tests.rs | 40 +- .../benilla-app/src/ui_script/raid_tests.rs | 6 +- .../benilla-app/src/ui_script/reference_ui.rs | 27 +- .../src/ui_script/reputation_frame_tests.rs | 17 +- crates/benilla-app/src/ui_script/session.rs | 12 + .../benilla-app/src/ui_script/shape_gate.rs | 2 + .../src/ui_script/shipped_xml_tests.rs | 26 +- .../src/ui_script/static_popup_tests.rs | 10 +- .../benilla-app/src/ui_script/summon_tests.rs | 2 + crates/benilla-app/src/ui_script/sweep.rs | 6 +- .../benilla-app/src/ui_script/sweep_tests.rs | 3 + .../benilla-app/src/ui_script/tabard_tests.rs | 10 +- .../src/ui_script/talent_wipe_tests.rs | 14 +- .../src/ui_script/target_aura_tests.rs | 2 + .../benilla-app/src/ui_script/taxi_tests.rs | 10 +- .../src/ui_script/tick_order_tests.rs | 366 ++ .../src/ui_script/tooltip_anchor_tests.rs | 1 + .../src/ui_script/tooltip_compare_tests.rs | 5 + .../src/ui_script/tot_frame_tests.rs | 1 + .../src/ui_script/trainer_tests.rs | 32 +- .../src/ui_script/tutorial_tests.rs | 21 +- .../src/ui_script/unit_frame_tests.rs | 84 +- .../src/ui_script/unit_popup_tests.rs | 36 +- .../src/ui_script/verb_event_gate.rs | 37 - .../src/ui_script/world_entry_tests.rs | 330 +- .../src/ui_script/world_map_tests.rs | 11 + .../src/ui_script/world_state_tests.rs | 1 + .../src/ui_script/zone_text_tests.rs | 21 +- crates/benilla-app/src/ui_session.rs | 28 +- crates/benilla-app/src/ui_session/latch.rs | 201 +- .../benilla-app/src/ui_session/latch_tests.rs | 114 +- crates/benilla-app/src/ui_session/release.rs | 90 +- .../src/ui_session/release_tests.rs | 160 +- crates/benilla-app/src/ui_shapeshift.rs | 9 +- .../benilla-app/src/ui_social/call_tests.rs | 921 +++++ crates/benilla-app/src/ui_social/feed.rs | 831 ++--- crates/benilla-app/src/ui_social/mod.rs | 1130 ++++-- crates/benilla-app/src/ui_social/query.rs | 534 +-- .../benilla-app/src/ui_social/query/tests.rs | 328 ++ crates/benilla-app/src/ui_social/steps.rs | 179 + crates/benilla-app/src/ui_social/who_tests.rs | 447 +++ crates/benilla-app/src/ui_social/whois.rs | 12 +- crates/benilla-app/src/ui_spellbook.rs | 15 + .../benilla-app/src/ui_stable/call_tests.rs | 147 + crates/benilla-app/src/ui_stable/mod.rs | 132 +- crates/benilla-app/src/ui_stable/net.rs | 2 +- crates/benilla-app/src/ui_summon.rs | 115 +- crates/benilla-app/src/ui_tabard.rs | 260 +- crates/benilla-app/src/ui_talent.rs | 436 ++- .../benilla-app/src/ui_talent_call_tests.rs | 137 + crates/benilla-app/src/ui_talent_wipe.rs | 143 +- crates/benilla-app/src/ui_taxi/call_tests.rs | 184 + crates/benilla-app/src/ui_taxi/calls.rs | 136 + crates/benilla-app/src/ui_taxi/drain_tests.rs | 62 +- crates/benilla-app/src/ui_taxi/mod.rs | 293 +- crates/benilla-app/src/ui_taxi/net.rs | 85 +- crates/benilla-app/src/ui_taxi/routing.rs | 8 +- crates/benilla-app/src/ui_tooltip/bench.rs | 3 +- .../benilla-app/src/ui_tooltip/deps_tests.rs | 67 +- .../benilla-app/src/ui_tooltip/feed_tests.rs | 3 + .../src/ui_tooltip/go_lock_tests.rs | 40 +- crates/benilla-app/src/ui_tooltip/mod.rs | 118 +- .../benilla-app/src/ui_tooltip/spell_deps.rs | 26 +- .../benilla-app/src/ui_tooltip/spell_feed.rs | 98 +- crates/benilla-app/src/ui_tooltip/tests.rs | 184 +- crates/benilla-app/src/ui_trade/call_tests.rs | 1151 +++++++ crates/benilla-app/src/ui_trade/calls.rs | 180 + crates/benilla-app/src/ui_trade/mod.rs | 3022 +++-------------- crates/benilla-app/src/ui_trade/net.rs | 148 +- crates/benilla-app/src/ui_trade/tests.rs | 2070 +++++++++++ crates/benilla-app/src/ui_tradeskill.rs | 1318 ++++++- .../benilla-app/src/ui_trainer/call_tests.rs | 103 + crates/benilla-app/src/ui_trainer/law.rs | 133 +- crates/benilla-app/src/ui_trainer/mod.rs | 578 +++- crates/benilla-app/src/ui_trainer/net.rs | 14 +- crates/benilla-app/src/ui_trainer/reeval.rs | 9 +- crates/benilla-app/src/ui_trainer/tests.rs | 749 +++- crates/benilla-app/src/ui_unit.rs | 1255 ++++--- .../benilla-app/src/ui_unit/field_events.rs | 906 ++++- crates/benilla-app/src/ui_unit/held.rs | 122 +- crates/benilla-app/src/ui_unit/relations.rs | 11 +- crates/benilla-app/src/ui_unit/views.rs | 1131 ++++++ .../benilla-app/src/ui_unit/views/families.rs | 244 ++ crates/benilla-app/src/ui_unit/wire_order.rs | 107 - crates/benilla-app/src/ui_world_map.rs | 13 +- crates/benilla-app/src/video.rs | 296 +- crates/benilla-app/src/vm_pass.rs | 214 +- crates/benilla-app/src/vplates.rs | 184 +- crates/benilla-app/src/vplates/gate_tests.rs | 355 ++ .../benilla-app/src/vplates/unheld_tests.rs | 24 + crates/benilla-app/src/wdb.rs | 560 +++ crates/benilla-app/src/wdb/tests.rs | 693 ++++ crates/benilla-app/src/world_console.rs | 524 +++ crates/benilla-app/src/world_state_ui.rs | 131 +- crates/benilla-app/tests/auction_frame.rs | 119 +- crates/benilla-app/tests/cover_input_wall.rs | 1 + crates/benilla-app/tests/item_text_frame.rs | 18 +- crates/benilla-app/tests/mail_frame.rs | 130 +- crates/benilla-app/tests/talent_frame.rs | 8 +- crates/benilla-app/tests/trade_frame.rs | 74 +- crates/benilla-app/tests/tradeskill_frame.rs | 13 +- crates/benilla-app/tests/ui_script_wall.rs | 7 +- crates/benilla-app/tests/world_api_wall.rs | 123 +- crates/benilla-assets/src/wmo.rs | 4 + crates/benilla-assets/src/world_assets/mod.rs | 461 ++- .../benilla-formats/examples/order_probe.rs | 2 +- crates/benilla-formats/src/area_sound.rs | 21 +- crates/benilla-formats/src/area_table.rs | 32 +- crates/benilla-formats/src/auction_house.rs | 5 + .../src/bank_bag_slot_prices.rs | 5 + crates/benilla-formats/src/chat_channels.rs | 50 +- crates/benilla-formats/src/chr_classes.rs | 8 + crates/benilla-formats/src/chr_races.rs | 5 + crates/benilla-formats/src/cinematics.rs | 34 + .../benilla-formats/src/creature_families.rs | 29 + crates/benilla-formats/src/emotes.rs | 18 + crates/benilla-formats/src/factions.rs | 41 +- .../src/item_random_properties.rs | 20 +- crates/benilla-formats/src/lib.rs | 49 +- crates/benilla-formats/src/loading_route.rs | 316 ++ .../src/loading_route/tests.rs | 174 + crates/benilla-formats/src/mail_template.rs | 60 + crates/benilla-formats/src/models/wmo/root.rs | 95 + crates/benilla-formats/src/race_pvp_team.rs | 2 +- crates/benilla-formats/src/skill_lines/mod.rs | 233 +- .../benilla-formats/src/skill_lines/tests.rs | 79 +- crates/benilla-formats/src/sound_entries.rs | 155 +- .../benilla-formats/src/spell_visual/mod.rs | 12 +- .../benilla-formats/src/spell_visual/tests.rs | 6 + .../src/spells/catalog_tests.rs | 57 +- .../src/spells/dispel_types.rs | 9 + crates/benilla-formats/src/spells/display.rs | 7 +- crates/benilla-formats/src/spells/mod.rs | 55 +- crates/benilla-formats/src/spells/ranges.rs | 111 +- crates/benilla-formats/src/spells/tokens.rs | 88 +- crates/benilla-formats/src/stationery.rs | 14 +- crates/benilla-formats/src/talents.rs | 58 +- crates/benilla-formats/src/taxi.rs | 96 +- crates/benilla-formats/src/tga.rs | 76 +- .../benilla-formats/src/transport_period.rs | 192 -- .../benilla-formats/src/transports/curve.rs | 188 + crates/benilla-formats/src/transports/mod.rs | 893 ++--- .../benilla-formats/src/transports/tests.rs | 295 +- .../benilla-formats/src/transports/timing.rs | 182 + .../tests/transport_speed_profile.rs | 12 +- crates/benilla-mlua/src/lib.rs | 61 + crates/benilla-mlua/tests/api.rs | 46 + crates/benilla-movie/Cargo.toml | 20 + crates/benilla-movie/src/avi.rs | 190 ++ crates/benilla-movie/src/bits.rs | 95 + crates/benilla-movie/src/color.rs | 66 + crates/benilla-movie/src/decoder.rs | 755 ++++ crates/benilla-movie/src/headers.rs | 202 ++ crates/benilla-movie/src/idct.rs | 184 + crates/benilla-movie/src/lib.rs | 406 +++ crates/benilla-movie/src/scan.rs | 77 + crates/benilla-movie/src/testing.rs | 83 + crates/benilla-movie/src/vlc.rs | 588 ++++ crates/benilla-movie/tests/install.rs | 206 ++ crates/benilla-protocol/Cargo.toml | 2 + .../examples/srp_encoding_probe.rs | 2 +- .../examples/version_check_probe.rs | 1 + crates/benilla-protocol/src/auth.rs | 263 +- crates/benilla-protocol/src/auth/pin.rs | 313 ++ crates/benilla-protocol/src/events.rs | 71 +- crates/benilla-protocol/src/events/decode.rs | 29 +- crates/benilla-protocol/src/lib.rs | 93 +- .../benilla-protocol/src/messages/attack.rs | 21 +- .../benilla-protocol/src/messages/auction.rs | 11 +- crates/benilla-protocol/src/messages/chat.rs | 2 +- .../benilla-protocol/src/messages/client.rs | 14 + .../src/messages/gameobject.rs | 18 + .../benilla-protocol/src/messages/gossip.rs | 16 +- crates/benilla-protocol/src/messages/group.rs | 8 +- crates/benilla-protocol/src/messages/items.rs | 53 +- crates/benilla-protocol/src/messages/loot.rs | 80 +- crates/benilla-protocol/src/messages/mail.rs | 14 +- crates/benilla-protocol/src/messages/mod.rs | 18 +- .../benilla-protocol/src/messages/movement.rs | 40 + .../benilla-protocol/src/messages/opcode.rs | 20 + .../benilla-protocol/src/messages/packet.rs | 26 +- crates/benilla-protocol/src/messages/parse.rs | 29 +- crates/benilla-protocol/src/messages/pet.rs | 6 +- .../src/messages/reputation.rs | 5 +- .../benilla-protocol/src/messages/social.rs | 219 +- .../benilla-protocol/src/messages/spells.rs | 23 +- crates/benilla-protocol/src/messages/taxi.rs | 16 +- crates/benilla-protocol/src/messages/trade.rs | 29 +- .../messages/update_object/fields/player.rs | 25 + .../messages/update_object/fields/tests.rs | 12 +- .../src/messages/update_object/fields/unit.rs | 9 +- .../benilla-protocol/src/messages/vendor.rs | 11 +- crates/benilla-protocol/src/world/mod.rs | 16 + crates/benilla-protocol/src/world/reader.rs | 82 +- .../benilla-protocol/src/world/writer/chat.rs | 5 + .../src/world/writer/gossip.rs | 2 +- .../src/world/writer/group.rs | 6 +- .../src/world/writer/items.rs | 8 + .../benilla-protocol/src/world/writer/mail.rs | 9 +- .../benilla-protocol/src/world/writer/pet.rs | 6 + .../src/world/writer/spells.rs | 9 + .../src/world/writer/trade.rs | 9 +- crates/benilla-protocol/tests/auction.rs | 22 + crates/benilla-protocol/tests/auth.rs | 154 + .../benilla-protocol/tests/gossip_vendor.rs | 48 +- crates/benilla-protocol/tests/group.rs | 13 +- crates/benilla-protocol/tests/items.rs | 37 + crates/benilla-protocol/tests/mail.rs | 11 +- crates/benilla-protocol/tests/reputation.rs | 31 + .../benilla-protocol/tests/simple_packets.rs | 6 +- crates/benilla-protocol/tests/spells.rs | 40 + crates/benilla-protocol/tests/taxi.rs | 20 +- .../benilla-protocol/tests/update_object.rs | 2 +- crates/benilla-ui/Cargo.toml | 9 + crates/benilla-ui/src/civil.rs | 201 +- crates/benilla-ui/src/crt.rs | 24 + crates/benilla-ui/src/script/action.rs | 55 +- .../src/script/action_bar_toggles.rs | 27 +- crates/benilla-ui/src/script/addon_message.rs | 69 +- crates/benilla-ui/src/script/auction.rs | 1175 +++++-- crates/benilla-ui/src/script/aura/mod.rs | 126 +- .../benilla-ui/src/script/aura/player_buff.rs | 15 +- crates/benilla-ui/src/script/aura/read.rs | 123 + crates/benilla-ui/src/script/bank.rs | 81 +- .../src/script/battlefield_positions.rs | 90 +- .../src/script/battlefield_queue.rs | 95 +- .../src/script/battlefield_score.rs | 49 +- crates/benilla-ui/src/script/bind_confirm.rs | 66 +- crates/benilla-ui/src/script/binder.rs | 17 +- crates/benilla-ui/src/script/button.rs | 16 +- crates/benilla-ui/src/script/calls.rs | 740 +++- crates/benilla-ui/src/script/census.rs | 205 ++ crates/benilla-ui/src/script/channel.rs | 421 +-- crates/benilla-ui/src/script/char_stats.rs | 668 ++-- crates/benilla-ui/src/script/chat_misc.rs | 91 +- crates/benilla-ui/src/script/chat_window.rs | 24 +- crates/benilla-ui/src/script/client.rs | 43 +- crates/benilla-ui/src/script/console_exec.rs | 21 +- crates/benilla-ui/src/script/container.rs | 693 +++- crates/benilla-ui/src/script/craft.rs | 929 ++++- crates/benilla-ui/src/script/cursor.rs | 185 +- .../benilla-ui/src/script/cursor/bag_verbs.rs | 447 ++- crates/benilla-ui/src/script/cursor/bar.rs | 122 +- crates/benilla-ui/src/script/cursor/doll.rs | 358 +- crates/benilla-ui/src/script/cursor/equip.rs | 344 +- crates/benilla-ui/src/script/cursor/money.rs | 108 +- crates/benilla-ui/src/script/cursor/pet.rs | 102 +- crates/benilla-ui/src/script/cursor/swap.rs | 385 +++ crates/benilla-ui/src/script/cvar_checks.rs | 19 +- crates/benilla-ui/src/script/cvars.rs | 27 +- crates/benilla-ui/src/script/death.rs | 50 +- crates/benilla-ui/src/script/dialog_verbs.rs | 143 +- crates/benilla-ui/src/script/dressup.rs | 8 +- crates/benilla-ui/src/script/duel.rs | 118 +- .../benilla-ui/src/script/duel/start_tests.rs | 47 + crates/benilla-ui/src/script/extract.rs | 7 +- crates/benilla-ui/src/script/follow.rs | 27 +- crates/benilla-ui/src/script/font.rs | 12 +- crates/benilla-ui/src/script/glue_core.rs | 148 +- crates/benilla-ui/src/script/glue_create.rs | 4 +- crates/benilla-ui/src/script/glue_select.rs | 4 +- crates/benilla-ui/src/script/gm_survey.rs | 9 +- crates/benilla-ui/src/script/gm_ticket.rs | 92 +- crates/benilla-ui/src/script/gossip.rs | 203 +- crates/benilla-ui/src/script/guild.rs | 435 ++- crates/benilla-ui/src/script/host.rs | 211 +- crates/benilla-ui/src/script/input_verbs.rs | 322 +- crates/benilla-ui/src/script/inspect.rs | 90 +- crates/benilla-ui/src/script/instance.rs | 15 +- .../benilla-ui/src/script/inventory_verbs.rs | 2 +- crates/benilla-ui/src/script/item_calls.rs | 193 ++ crates/benilla-ui/src/script/item_read.rs | 410 +++ crates/benilla-ui/src/script/item_stats.rs | 181 +- crates/benilla-ui/src/script/item_text.rs | 49 +- crates/benilla-ui/src/script/lfg.rs | 29 +- crates/benilla-ui/src/script/loot.rs | 381 ++- crates/benilla-ui/src/script/loot_roll.rs | 78 +- crates/benilla-ui/src/script/lottery.rs | 46 +- crates/benilla-ui/src/script/lua50.rs | 4 +- crates/benilla-ui/src/script/macros.rs | 193 +- crates/benilla-ui/src/script/macros/bind.rs | 397 +++ .../benilla-ui/src/script/macros/lua_tests.rs | 86 + crates/benilla-ui/src/script/mail.rs | 1374 ++++++-- crates/benilla-ui/src/script/merchant.rs | 204 +- crates/benilla-ui/src/script/minimap.rs | 44 +- crates/benilla-ui/src/script/mod.rs | 171 +- crates/benilla-ui/src/script/model.rs | 669 ++-- crates/benilla-ui/src/script/modelframe.rs | 2 +- crates/benilla-ui/src/script/movieframe.rs | 549 ++- .../src/script/movieframe/captions.rs | 140 + .../src/script/movieframe/player.rs | 322 ++ .../benilla-ui/src/script/movieframe/tests.rs | 350 ++ crates/benilla-ui/src/script/nameplate.rs | 49 +- crates/benilla-ui/src/script/object.rs | 313 +- crates/benilla-ui/src/script/party.rs | 801 +++-- crates/benilla-ui/src/script/pet.rs | 332 +- crates/benilla-ui/src/script/petition.rs | 298 +- crates/benilla-ui/src/script/protected.rs | 17 - crates/benilla-ui/src/script/pvp/mod.rs | 68 +- crates/benilla-ui/src/script/pvp/tests.rs | 13 +- crates/benilla-ui/src/script/quest.rs | 415 +-- crates/benilla-ui/src/script/quest_log.rs | 577 +++- .../src/script/quest_log_detail_tests.rs | 414 +++ crates/benilla-ui/src/script/region.rs | 91 +- crates/benilla-ui/src/script/region_map.rs | 11 +- crates/benilla-ui/src/script/reputation.rs | 1123 ++++-- crates/benilla-ui/src/script/session.rs | 174 +- crates/benilla-ui/src/script/skills.rs | 318 +- crates/benilla-ui/src/script/social.rs | 468 +-- crates/benilla-ui/src/script/spellbook.rs | 68 +- crates/benilla-ui/src/script/stable.rs | 219 +- crates/benilla-ui/src/script/stat_read.rs | 341 ++ crates/benilla-ui/src/script/stdlib.rs | 80 +- crates/benilla-ui/src/script/summon.rs | 39 +- crates/benilla-ui/src/script/tabard.rs | 75 +- crates/benilla-ui/src/script/talent.rs | 130 +- crates/benilla-ui/src/script/taxi.rs | 78 +- crates/benilla-ui/src/script/tests/button.rs | 2 +- crates/benilla-ui/src/script/tests/channel.rs | 256 +- .../benilla-ui/src/script/tests/cooldown.rs | 4 + .../benilla-ui/src/script/tests/flag_args.rs | 34 +- .../src/script/tests/glue_surface.rs | 1 - .../benilla-ui/src/script/tests/gm_ticket.rs | 78 +- .../benilla-ui/src/script/tests/host_state.rs | 60 +- .../src/script/tests/hover_publish.rs | 8 +- .../src/script/tests/is_number_gates.rs | 9 +- crates/benilla-ui/src/script/tests/minimap.rs | 38 + crates/benilla-ui/src/script/tests/mod.rs | 14 +- .../src/script/tests/number_text.rs | 1 + .../src/script/tests/protected_gate.rs | 9 +- .../src/script/tests/reference_surface.rs | 3 +- .../benilla-ui/src/script/tests/region_map.rs | 8 +- crates/benilla-ui/src/script/tests/regions.rs | 293 +- .../src/script/tests/reputation_list.rs | 208 ++ .../src/script/tests/script_lengths.rs | 1 + .../benilla-ui/src/script/tests/skill_list.rs | 150 + crates/benilla-ui/src/script/tests/stdlib.rs | 108 +- crates/benilla-ui/src/script/tests/talent.rs | 103 +- crates/benilla-ui/src/script/tests/taxi.rs | 18 +- .../src/script/tests/tooltip_item/bindings.rs | 18 + .../src/script/tests/tooltip_item/law.rs | 3 +- .../script/tests/tooltip_item/mechanics.rs | 7 +- .../src/script/tests/tooltip_item/rebuild.rs | 52 + .../src/script/tests/tooltip_item/sources.rs | 6 +- .../src/script/tests/tooltip_setter_flags.rs | 3 +- .../src/script/tests/tooltip_spell.rs | 83 +- .../src/script/tests/tooltip_unit.rs | 8 +- .../src/script/tests/usage_lines.rs | 19 + crates/benilla-ui/src/script/tick.rs | 69 +- crates/benilla-ui/src/script/tooltip/verbs.rs | 41 +- crates/benilla-ui/src/script/tooltip_aura.rs | 49 +- .../src/script/tooltip_item/build.rs | 12 +- .../src/script/tooltip_item/compare.rs | 5 +- .../benilla-ui/src/script/tooltip_item/mod.rs | 120 +- .../src/script/tooltip_item/render.rs | 3 +- crates/benilla-ui/src/script/tooltip_spell.rs | 9 +- crates/benilla-ui/src/script/tooltip_unit.rs | 34 +- crates/benilla-ui/src/script/trade.rs | 982 ++++-- .../benilla-ui/src/script/tradeskill/api.rs | 163 +- .../src/script/tradeskill/itemstats.rs | 2 + .../benilla-ui/src/script/tradeskill/mod.rs | 223 +- .../benilla-ui/src/script/tradeskill/tests.rs | 290 +- .../benilla-ui/src/script/tradeskill/view.rs | 357 +- crates/benilla-ui/src/script/trainer/mod.rs | 698 ++-- crates/benilla-ui/src/script/trainer/tests.rs | 529 ++- crates/benilla-ui/src/script/tutorial.rs | 78 +- crates/benilla-ui/src/script/types.rs | 7 + crates/benilla-ui/src/script/ui_errors.rs | 77 +- crates/benilla-ui/src/script/unit/bindings.rs | 286 +- crates/benilla-ui/src/script/unit/by_name.rs | 47 +- crates/benilla-ui/src/script/unit/mod.rs | 224 +- crates/benilla-ui/src/script/unit/object.rs | 127 + .../benilla-ui/src/script/unit/relations.rs | 12 +- crates/benilla-ui/src/script/unit/resolve.rs | 599 +++- .../src/script/unit/selection_tests.rs | 71 + crates/benilla-ui/src/script/unit/tests.rs | 104 +- crates/benilla-ui/src/script/who_sort.rs | 53 +- crates/benilla-ui/src/script/worn_display.rs | 36 +- crates/benilla-ui/src/script/zone_text.rs | 71 +- .../benilla-ui/tests/vm_parity_surface.golden | 4 +- crates/benilla-world/src/clutter.rs | 54 +- crates/benilla-world/src/collision.rs | 10 +- crates/benilla-world/src/interact/mod.rs | 93 +- crates/benilla-world/src/interact/pick.rs | 25 + crates/benilla-world/src/lib.rs | 1 + crates/benilla-world/src/liquid/drift.rs | 78 +- crates/benilla-world/src/schedule.rs | 3 +- crates/benilla-world/src/static_gx/cull.rs | 3 + crates/benilla-world/src/static_gx/mod.rs | 44 +- crates/benilla-world/src/static_gx/pick.rs | 227 +- crates/benilla-world/src/sun/follow.rs | 98 +- crates/benilla-world/src/sun/mod.rs | 67 +- crates/benilla-world/src/terrain_stream.rs | 150 +- .../src/terrain_stream/residency.rs | 25 + .../src/terrain_stream/spawn/assemble.rs | 10 + .../src/terrain_stream/spawn/mod.rs | 27 +- .../benilla-world/src/terrain_stream/weld.rs | 15 +- crates/benilla-world/src/water_fx/mod.rs | 43 +- .../benilla-world/src/wmo_portal/audit/mod.rs | 1 + .../benilla-world/src/wmo_portal/interior.rs | 353 +- crates/benilla-world/src/wmo_portal/mod.rs | 8 +- crates/benilla-world/src/wmo_portal/seed.rs | 197 +- crates/benilla-world/src/world_flags.rs | 37 + crates/benilla-world/src/world_map.rs | 2 +- crates/benilla-world/src/world_point.rs | 21 + docs/CONTRIBUTING.md | 7 + docs/DEVIATIONS.md | 400 ++- docs/MAP.md | 16 +- scripts/check.sh | 13 +- third_party/wgpu-hal/BENILLA.md | 65 + third_party/wgpu-hal/Cargo.toml | 420 +++ third_party/wgpu-hal/LICENSE.APACHE | 176 + third_party/wgpu-hal/LICENSE.MIT | 21 + third_party/wgpu-hal/README.md | 120 + third_party/wgpu-hal/build.rs | 31 + third_party/wgpu-hal/src/auxil/dxgi/conv.rs | 295 ++ .../wgpu-hal/src/auxil/dxgi/exception.rs | 95 + .../wgpu-hal/src/auxil/dxgi/factory.rs | 181 + third_party/wgpu-hal/src/auxil/dxgi/mod.rs | 6 + third_party/wgpu-hal/src/auxil/dxgi/name.rs | 24 + third_party/wgpu-hal/src/auxil/dxgi/result.rs | 28 + third_party/wgpu-hal/src/auxil/dxgi/time.rs | 97 + third_party/wgpu-hal/src/auxil/mod.rs | 128 + third_party/wgpu-hal/src/auxil/renderdoc.rs | 141 + third_party/wgpu-hal/src/dx12/adapter.rs | 1025 ++++++ third_party/wgpu-hal/src/dx12/command.rs | 1856 ++++++++++ third_party/wgpu-hal/src/dx12/conv.rs | 442 +++ third_party/wgpu-hal/src/dx12/dcomp.rs | 118 + third_party/wgpu-hal/src/dx12/descriptor.rs | 329 ++ third_party/wgpu-hal/src/dx12/device.rs | 2587 ++++++++++++++ third_party/wgpu-hal/src/dx12/instance.rs | 171 + third_party/wgpu-hal/src/dx12/mod.rs | 1732 ++++++++++ third_party/wgpu-hal/src/dx12/sampler.rs | 252 ++ .../wgpu-hal/src/dx12/shader_compilation.rs | 437 +++ .../wgpu-hal/src/dx12/suballocation.rs | 657 ++++ third_party/wgpu-hal/src/dx12/types.rs | 39 + third_party/wgpu-hal/src/dx12/view.rs | 340 ++ third_party/wgpu-hal/src/dynamic/adapter.rs | 69 + third_party/wgpu-hal/src/dynamic/command.rs | 750 ++++ third_party/wgpu-hal/src/dynamic/device.rs | 558 +++ third_party/wgpu-hal/src/dynamic/instance.rs | 70 + third_party/wgpu-hal/src/dynamic/mod.rs | 221 ++ third_party/wgpu-hal/src/dynamic/queue.rs | 56 + third_party/wgpu-hal/src/dynamic/surface.rs | 74 + third_party/wgpu-hal/src/gles/adapter.rs | 1321 +++++++ third_party/wgpu-hal/src/gles/command.rs | 1270 +++++++ third_party/wgpu-hal/src/gles/conv.rs | 429 +++ third_party/wgpu-hal/src/gles/device.rs | 1644 +++++++++ third_party/wgpu-hal/src/gles/egl.rs | 1628 +++++++++ third_party/wgpu-hal/src/gles/emscripten.rs | 26 + third_party/wgpu-hal/src/gles/fence.rs | 168 + third_party/wgpu-hal/src/gles/mod.rs | 1135 +++++++ third_party/wgpu-hal/src/gles/queue.rs | 1935 +++++++++++ .../wgpu-hal/src/gles/shaders/clear.frag | 7 + .../wgpu-hal/src/gles/shaders/clear.vert | 9 + .../src/gles/shaders/srgb_present.frag | 16 + .../src/gles/shaders/srgb_present.vert | 18 + third_party/wgpu-hal/src/gles/web.rs | 453 +++ third_party/wgpu-hal/src/gles/wgl.rs | 885 +++++ third_party/wgpu-hal/src/lib.rs | 2694 +++++++++++++++ third_party/wgpu-hal/src/metal/adapter.rs | 1290 +++++++ third_party/wgpu-hal/src/metal/command.rs | 1375 ++++++++ third_party/wgpu-hal/src/metal/conv.rs | 355 ++ third_party/wgpu-hal/src/metal/device.rs | 1677 +++++++++ .../wgpu-hal/src/metal/layer_observer.rs | 190 ++ third_party/wgpu-hal/src/metal/mod.rs | 1024 ++++++ third_party/wgpu-hal/src/metal/surface.rs | 233 ++ third_party/wgpu-hal/src/metal/time.rs | 38 + third_party/wgpu-hal/src/noop/buffer.rs | 88 + third_party/wgpu-hal/src/noop/command.rs | 337 ++ third_party/wgpu-hal/src/noop/mod.rs | 479 +++ third_party/wgpu-hal/src/validation_canary.rs | 39 + third_party/wgpu-hal/src/vulkan/adapter.rs | 2869 ++++++++++++++++ third_party/wgpu-hal/src/vulkan/command.rs | 1374 ++++++++ third_party/wgpu-hal/src/vulkan/conv.rs | 1025 ++++++ third_party/wgpu-hal/src/vulkan/device.rs | 2993 ++++++++++++++++ third_party/wgpu-hal/src/vulkan/drm.rs | 166 + third_party/wgpu-hal/src/vulkan/instance.rs | 1274 +++++++ third_party/wgpu-hal/src/vulkan/mod.rs | 1846 ++++++++++ third_party/wgpu-hal/src/vulkan/sampler.rs | 177 + .../wgpu-hal/src/vulkan/semaphore_list.rs | 115 + 923 files changed, 180934 insertions(+), 35014 deletions(-) create mode 100644 crates/benilla-app/src/combat_log/chat/tests/emitters/dispel.rs create mode 100644 crates/benilla-app/src/entities/scene_drawn.rs create mode 100644 crates/benilla-app/src/item_lane.rs create mode 100644 crates/benilla-app/src/item_names.rs create mode 100644 crates/benilla-app/src/lanes.rs create mode 100644 crates/benilla-app/src/lanes/aura_live_tests.rs create mode 100644 crates/benilla-app/src/lanes/aura_view_tests.rs create mode 100644 crates/benilla-app/src/lanes/bag_tests.rs create mode 100644 crates/benilla-app/src/lanes/group_view_tests.rs create mode 100644 crates/benilla-app/src/lanes/guard_tests.rs create mode 100644 crates/benilla-app/src/lanes/item_live_tests.rs create mode 100644 crates/benilla-app/src/lanes/item_tests.rs create mode 100644 crates/benilla-app/src/lanes/packet_signal_tests.rs create mode 100644 crates/benilla-app/src/lanes/quiet_tests.rs create mode 100644 crates/benilla-app/src/lanes/stat_live_tests.rs create mode 100644 crates/benilla-app/src/lanes/storm_tests.rs create mode 100644 crates/benilla-app/src/lanes/tests.rs create mode 100644 crates/benilla-app/src/lanes/token_live_tests.rs create mode 100644 crates/benilla-app/src/lanes/unit_live_tests.rs create mode 100644 crates/benilla-app/src/lanes/unit_view_tests.rs create mode 100644 crates/benilla-app/src/loading_screen/hold.rs create mode 100644 crates/benilla-app/src/loading_screen/route.rs delete mode 100644 crates/benilla-app/src/name_persist.rs create mode 100644 crates/benilla-app/src/net/reputations.rs create mode 100644 crates/benilla-app/src/player/camera_axes.rs create mode 100644 crates/benilla-app/src/player/teleport_hold_tests.rs create mode 100644 crates/benilla-app/src/portrait/drain.rs create mode 100644 crates/benilla-app/src/portrait/loading_tests.rs create mode 100644 crates/benilla-app/src/portrait/unheld_tests.rs create mode 100644 crates/benilla-app/src/script_calls/census.rs create mode 100644 crates/benilla-app/src/script_calls/disjoint.rs create mode 100644 crates/benilla-app/src/script_calls/engine.rs create mode 100644 crates/benilla-app/src/script_calls/tests/asks.rs create mode 100644 crates/benilla-app/src/script_calls/tests/census.rs create mode 100644 crates/benilla-app/src/script_calls/tests/closes.rs create mode 100644 crates/benilla-app/src/script_calls/tests/dialogs.rs create mode 100644 crates/benilla-app/src/script_calls/tests/engine.rs create mode 100644 crates/benilla-app/src/script_calls/tests/refusals.rs create mode 100644 crates/benilla-app/src/script_calls/tests/selection.rs create mode 100644 crates/benilla-app/src/script_calls/tests/sends.rs create mode 100644 crates/benilla-app/src/script_calls/tests/systems.rs create mode 100644 crates/benilla-app/src/script_calls/tests/window_verbs.rs create mode 100644 crates/benilla-app/src/script_calls/windows.rs create mode 100644 crates/benilla-app/src/sound/movie.rs create mode 100644 crates/benilla-app/src/spell/known.rs create mode 100644 crates/benilla-app/src/spell/net/tests/learned.rs create mode 100644 crates/benilla-app/src/target/click_loot_tests.rs create mode 100644 crates/benilla-app/src/target/click_order_tests.rs create mode 100644 crates/benilla-app/src/target/died.rs create mode 100644 crates/benilla-app/src/target/track.rs create mode 100644 crates/benilla-app/src/target/unheld_tests.rs create mode 100644 crates/benilla-app/src/ui_action/drop_item_tests.rs create mode 100644 crates/benilla-app/src/ui_action/range_tests.rs create mode 100644 crates/benilla-app/src/ui_action/unlearn.rs create mode 100644 crates/benilla-app/src/ui_auction/verb_tests.rs create mode 100644 crates/benilla-app/src/ui_auction/verbs.rs create mode 100644 crates/benilla-app/src/ui_char_call_tests.rs create mode 100644 crates/benilla-app/src/ui_chat/input/channel.rs create mode 100644 crates/benilla-app/src/ui_chat/input/drunk.rs create mode 100644 crates/benilla-app/src/ui_chat/input/emote.rs create mode 100644 crates/benilla-app/src/ui_chat/monster_tests.rs create mode 100644 crates/benilla-app/src/ui_chat/roster.rs create mode 100644 crates/benilla-app/src/ui_chat/slot_tests.rs create mode 100644 crates/benilla-app/src/ui_duel/challenge_tests.rs create mode 100644 crates/benilla-app/src/ui_gossip/verb_tests.rs create mode 100644 crates/benilla-app/src/ui_gossip/verbs.rs create mode 100644 crates/benilla-app/src/ui_guild/call_tests.rs create mode 100644 crates/benilla-app/src/ui_guild/steps.rs create mode 100644 crates/benilla-app/src/ui_items/calls.rs create mode 100644 crates/benilla-app/src/ui_items/feed_link_tests.rs create mode 100644 crates/benilla-app/src/ui_items/live.rs create mode 100644 crates/benilla-app/src/ui_items/verb_tests.rs create mode 100644 crates/benilla-app/src/ui_loot/call_tests.rs create mode 100644 crates/benilla-app/src/ui_loot/calls.rs create mode 100644 crates/benilla-app/src/ui_loot/receive_tests.rs create mode 100644 crates/benilla-app/src/ui_loot/sweep_tests.rs create mode 100644 crates/benilla-app/src/ui_loot_roll/line_tests.rs create mode 100644 crates/benilla-app/src/ui_mail/verb_tests.rs create mode 100644 crates/benilla-app/src/ui_mail/verbs.rs create mode 100644 crates/benilla-app/src/ui_merchant/call_tests.rs create mode 100644 crates/benilla-app/src/ui_merchant/calls.rs create mode 100644 crates/benilla-app/src/ui_party/call_tests.rs create mode 100644 crates/benilla-app/src/ui_party/calls.rs create mode 100644 crates/benilla-app/src/ui_party/feed/tests/token_verb_tests.rs create mode 100644 crates/benilla-app/src/ui_pet/call_tests.rs create mode 100644 crates/benilla-app/src/ui_pet/steps.rs create mode 100644 crates/benilla-app/src/ui_petition/call_tests.rs create mode 100644 crates/benilla-app/src/ui_petition/steps.rs create mode 100644 crates/benilla-app/src/ui_quest/verb_tests.rs create mode 100644 crates/benilla-app/src/ui_quest/verbs.rs create mode 100644 crates/benilla-app/src/ui_reputation_call_tests.rs create mode 100644 crates/benilla-app/src/ui_script/movie.rs create mode 100644 crates/benilla-app/src/ui_script/tick_order_tests.rs create mode 100644 crates/benilla-app/src/ui_social/call_tests.rs create mode 100644 crates/benilla-app/src/ui_social/query/tests.rs create mode 100644 crates/benilla-app/src/ui_social/steps.rs create mode 100644 crates/benilla-app/src/ui_social/who_tests.rs create mode 100644 crates/benilla-app/src/ui_stable/call_tests.rs create mode 100644 crates/benilla-app/src/ui_talent_call_tests.rs create mode 100644 crates/benilla-app/src/ui_taxi/call_tests.rs create mode 100644 crates/benilla-app/src/ui_taxi/calls.rs create mode 100644 crates/benilla-app/src/ui_trade/call_tests.rs create mode 100644 crates/benilla-app/src/ui_trade/calls.rs create mode 100644 crates/benilla-app/src/ui_trade/tests.rs create mode 100644 crates/benilla-app/src/ui_trainer/call_tests.rs create mode 100644 crates/benilla-app/src/ui_unit/views.rs create mode 100644 crates/benilla-app/src/ui_unit/views/families.rs delete mode 100644 crates/benilla-app/src/ui_unit/wire_order.rs create mode 100644 crates/benilla-app/src/vplates/gate_tests.rs create mode 100644 crates/benilla-app/src/vplates/unheld_tests.rs create mode 100644 crates/benilla-app/src/wdb.rs create mode 100644 crates/benilla-app/src/wdb/tests.rs create mode 100644 crates/benilla-app/src/world_console.rs create mode 100644 crates/benilla-formats/src/loading_route.rs create mode 100644 crates/benilla-formats/src/loading_route/tests.rs create mode 100644 crates/benilla-formats/src/mail_template.rs delete mode 100644 crates/benilla-formats/src/transport_period.rs create mode 100644 crates/benilla-formats/src/transports/curve.rs create mode 100644 crates/benilla-formats/src/transports/timing.rs create mode 100644 crates/benilla-movie/Cargo.toml create mode 100644 crates/benilla-movie/src/avi.rs create mode 100644 crates/benilla-movie/src/bits.rs create mode 100644 crates/benilla-movie/src/color.rs create mode 100644 crates/benilla-movie/src/decoder.rs create mode 100644 crates/benilla-movie/src/headers.rs create mode 100644 crates/benilla-movie/src/idct.rs create mode 100644 crates/benilla-movie/src/lib.rs create mode 100644 crates/benilla-movie/src/scan.rs create mode 100644 crates/benilla-movie/src/testing.rs create mode 100644 crates/benilla-movie/src/vlc.rs create mode 100644 crates/benilla-movie/tests/install.rs create mode 100644 crates/benilla-protocol/src/auth/pin.rs create mode 100644 crates/benilla-ui/src/script/aura/read.rs create mode 100644 crates/benilla-ui/src/script/census.rs create mode 100644 crates/benilla-ui/src/script/cursor/swap.rs create mode 100644 crates/benilla-ui/src/script/duel/start_tests.rs create mode 100644 crates/benilla-ui/src/script/item_calls.rs create mode 100644 crates/benilla-ui/src/script/item_read.rs create mode 100644 crates/benilla-ui/src/script/macros/bind.rs create mode 100644 crates/benilla-ui/src/script/movieframe/captions.rs create mode 100644 crates/benilla-ui/src/script/movieframe/player.rs create mode 100644 crates/benilla-ui/src/script/movieframe/tests.rs create mode 100644 crates/benilla-ui/src/script/quest_log_detail_tests.rs create mode 100644 crates/benilla-ui/src/script/stat_read.rs create mode 100644 crates/benilla-ui/src/script/tests/reputation_list.rs create mode 100644 crates/benilla-ui/src/script/tests/skill_list.rs create mode 100644 crates/benilla-ui/src/script/unit/object.rs create mode 100644 crates/benilla-ui/src/script/unit/selection_tests.rs create mode 100644 crates/benilla-world/src/world_flags.rs create mode 100644 third_party/wgpu-hal/BENILLA.md create mode 100644 third_party/wgpu-hal/Cargo.toml create mode 100644 third_party/wgpu-hal/LICENSE.APACHE create mode 100644 third_party/wgpu-hal/LICENSE.MIT create mode 100644 third_party/wgpu-hal/README.md create mode 100644 third_party/wgpu-hal/build.rs create mode 100644 third_party/wgpu-hal/src/auxil/dxgi/conv.rs create mode 100644 third_party/wgpu-hal/src/auxil/dxgi/exception.rs create mode 100644 third_party/wgpu-hal/src/auxil/dxgi/factory.rs create mode 100644 third_party/wgpu-hal/src/auxil/dxgi/mod.rs create mode 100644 third_party/wgpu-hal/src/auxil/dxgi/name.rs create mode 100644 third_party/wgpu-hal/src/auxil/dxgi/result.rs create mode 100644 third_party/wgpu-hal/src/auxil/dxgi/time.rs create mode 100644 third_party/wgpu-hal/src/auxil/mod.rs create mode 100644 third_party/wgpu-hal/src/auxil/renderdoc.rs create mode 100644 third_party/wgpu-hal/src/dx12/adapter.rs create mode 100644 third_party/wgpu-hal/src/dx12/command.rs create mode 100644 third_party/wgpu-hal/src/dx12/conv.rs create mode 100644 third_party/wgpu-hal/src/dx12/dcomp.rs create mode 100644 third_party/wgpu-hal/src/dx12/descriptor.rs create mode 100644 third_party/wgpu-hal/src/dx12/device.rs create mode 100644 third_party/wgpu-hal/src/dx12/instance.rs create mode 100644 third_party/wgpu-hal/src/dx12/mod.rs create mode 100644 third_party/wgpu-hal/src/dx12/sampler.rs create mode 100644 third_party/wgpu-hal/src/dx12/shader_compilation.rs create mode 100644 third_party/wgpu-hal/src/dx12/suballocation.rs create mode 100644 third_party/wgpu-hal/src/dx12/types.rs create mode 100644 third_party/wgpu-hal/src/dx12/view.rs create mode 100644 third_party/wgpu-hal/src/dynamic/adapter.rs create mode 100644 third_party/wgpu-hal/src/dynamic/command.rs create mode 100644 third_party/wgpu-hal/src/dynamic/device.rs create mode 100644 third_party/wgpu-hal/src/dynamic/instance.rs create mode 100644 third_party/wgpu-hal/src/dynamic/mod.rs create mode 100644 third_party/wgpu-hal/src/dynamic/queue.rs create mode 100644 third_party/wgpu-hal/src/dynamic/surface.rs create mode 100644 third_party/wgpu-hal/src/gles/adapter.rs create mode 100644 third_party/wgpu-hal/src/gles/command.rs create mode 100644 third_party/wgpu-hal/src/gles/conv.rs create mode 100644 third_party/wgpu-hal/src/gles/device.rs create mode 100644 third_party/wgpu-hal/src/gles/egl.rs create mode 100644 third_party/wgpu-hal/src/gles/emscripten.rs create mode 100644 third_party/wgpu-hal/src/gles/fence.rs create mode 100644 third_party/wgpu-hal/src/gles/mod.rs create mode 100644 third_party/wgpu-hal/src/gles/queue.rs create mode 100644 third_party/wgpu-hal/src/gles/shaders/clear.frag create mode 100644 third_party/wgpu-hal/src/gles/shaders/clear.vert create mode 100644 third_party/wgpu-hal/src/gles/shaders/srgb_present.frag create mode 100644 third_party/wgpu-hal/src/gles/shaders/srgb_present.vert create mode 100644 third_party/wgpu-hal/src/gles/web.rs create mode 100644 third_party/wgpu-hal/src/gles/wgl.rs create mode 100644 third_party/wgpu-hal/src/lib.rs create mode 100644 third_party/wgpu-hal/src/metal/adapter.rs create mode 100644 third_party/wgpu-hal/src/metal/command.rs create mode 100644 third_party/wgpu-hal/src/metal/conv.rs create mode 100644 third_party/wgpu-hal/src/metal/device.rs create mode 100644 third_party/wgpu-hal/src/metal/layer_observer.rs create mode 100644 third_party/wgpu-hal/src/metal/mod.rs create mode 100644 third_party/wgpu-hal/src/metal/surface.rs create mode 100644 third_party/wgpu-hal/src/metal/time.rs create mode 100644 third_party/wgpu-hal/src/noop/buffer.rs create mode 100644 third_party/wgpu-hal/src/noop/command.rs create mode 100644 third_party/wgpu-hal/src/noop/mod.rs create mode 100644 third_party/wgpu-hal/src/validation_canary.rs create mode 100644 third_party/wgpu-hal/src/vulkan/adapter.rs create mode 100644 third_party/wgpu-hal/src/vulkan/command.rs create mode 100644 third_party/wgpu-hal/src/vulkan/conv.rs create mode 100644 third_party/wgpu-hal/src/vulkan/device.rs create mode 100644 third_party/wgpu-hal/src/vulkan/drm.rs create mode 100644 third_party/wgpu-hal/src/vulkan/instance.rs create mode 100644 third_party/wgpu-hal/src/vulkan/mod.rs create mode 100644 third_party/wgpu-hal/src/vulkan/sampler.rs create mode 100644 third_party/wgpu-hal/src/vulkan/semaphore_list.rs diff --git a/.gitattributes b/.gitattributes index aedd42bd1..c543aee43 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7,3 +7,6 @@ reference/*.tsv -text # The vendored kira tree is CRLF in the index and stays byte for byte. third_party/kira/** -text + +# The vendored wgpu-hal tree is the registry crate byte for byte (one CRLF file stays CRLF). +third_party/wgpu-hal/** -text diff --git a/Cargo.lock b/Cargo.lock index 0a5042526..4ca9196b5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -585,6 +585,7 @@ dependencies = [ "avian3d", "benilla-assets", "benilla-formats", + "benilla-movie", "benilla-protocol", "benilla-srp", "benilla-ui", @@ -702,6 +703,14 @@ dependencies = [ "benilla-lua", ] +[[package]] +name = "benilla-movie" +version = "0.3.0" +dependencies = [ + "benilla-bytes", + "benilla-formats", +] + [[package]] name = "benilla-mpq" version = "0.3.0" @@ -718,6 +727,7 @@ dependencies = [ "benilla-srp", "clap", "flate2", + "libc", "num-bigint", "rand 0.8.6", "sha1", @@ -738,6 +748,8 @@ name = "benilla-ui" version = "0.3.0" dependencies = [ "benilla-mlua", + "benilla-movie", + "libc", "roxmltree", ] @@ -8024,8 +8036,6 @@ dependencies = [ [[package]] name = "wgpu-hal" version = "27.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b21cb61c57ee198bc4aff71aeadff4cbb80b927beb912506af9c780d64313ce" dependencies = [ "android_system_properties", "arrayvec", diff --git a/Cargo.toml b/Cargo.toml index 4d05f0d1d..3aa66f9a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,6 +42,9 @@ kira = { path = "third_party/kira" } # A lock-only stand-in: bevy_audio's unbuilt cpal 0.15 would otherwise hold `alsa-sys` 0.3 against # cpal 0.17's 0.4, and a lock holds one `links = "alsa"` (`third_party/alsa-0.9/BENILLA.md`). alsa = { path = "third_party/alsa-0.9" } +# wgpu-hal 27.0.4, patched so a presentation stall past wgpu-core's 1 s frame timeout is waited out +# and not turned into a lost device (`third_party/wgpu-hal/BENILLA.md`). +wgpu-hal = { path = "third_party/wgpu-hal" } # Dependencies at opt-level 3 in dev: at opt-level 0, avian/parry collision drops a run to <1 fps. [profile.dev.package."*"] @@ -51,6 +54,11 @@ opt-level = 3 # build is no slower. codegen-units = 1 +# The movie decoder at opt-level 3 in dev as well: at 1, decoding the 1024-wide intro takes its +# install test 29 s, at 3 under 6 s. +[profile.dev.package.benilla-movie] +opt-level = 3 + # Our crates at opt-level 1: Bevy's generic hot paths monomorphize into them, and at opt-level 0 # Stormwind drops from a pinned 60 fps to ~45. [profile.dev] diff --git a/crates/benilla-app/Cargo.toml b/crates/benilla-app/Cargo.toml index d62b44efb..06b3f299a 100644 --- a/crates/benilla-app/Cargo.toml +++ b/crates/benilla-app/Cargo.toml @@ -125,6 +125,8 @@ windows-sys = { version = "0.59", features = [ # The login cycle's fake realmd runs the server half of SRP6 (`net::io::cycle_tests`). [dev-dependencies] benilla-srp = { path = "../benilla-srp" } +# The synthetic movie the movie screen's tests open. +benilla-movie = { path = "../benilla-movie", features = ["test-support"] } # The UI's geometry comparisons (`benilla_ui::assert_near!`). benilla-ui = { path = "../benilla-ui", features = ["test-support"] } # The schedule census keeps the build's own graph, sync points included, through a build pass, diff --git a/crates/benilla-app/assets/ui/OptionsFrame.xml b/crates/benilla-app/assets/ui/OptionsFrame.xml index 507296efd..7737b7c48 100644 --- a/crates/benilla-app/assets/ui/OptionsFrame.xml +++ b/crates/benilla-app/assets/ui/OptionsFrame.xml @@ -1628,9 +1628,6 @@ BenillaOptionsRow_OnLoad(this, "BlockTrades", "Block Trades", "OPTION_TOOLTIP_BLOCK_TRADES") - diff --git a/crates/benilla-app/examples/extended_launcher.rs b/crates/benilla-app/examples/extended_launcher.rs index ab09473af..15214e7e1 100644 --- a/crates/benilla-app/examples/extended_launcher.rs +++ b/crates/benilla-app/examples/extended_launcher.rs @@ -29,11 +29,13 @@ //! benilla-buildstamp = { git = "https://github.com/samwhosung/benilla" } //! //! # Cargo reads `[patch]` and `[profile]` from the root manifest only, so benilla's are repeated: -//! # without the kira patch the mixer is not benilla's, and without the alsa one the lock holds two -//! # `alsa-sys` and does not resolve. +//! # without the kira patch the mixer is not benilla's, without the alsa one the lock holds two +//! # `alsa-sys` and does not resolve, and without the wgpu-hal one a presentation stall past a +//! # second loses the device on Vulkan. //! [patch.crates-io] //! kira = { git = "https://github.com/samwhosung/benilla" } //! alsa = { git = "https://github.com/samwhosung/benilla" } +//! wgpu-hal = { git = "https://github.com/samwhosung/benilla" } //! //! [profile.dev] //! opt-level = 1 diff --git a/crates/benilla-app/src/addon_harness/mod.rs b/crates/benilla-app/src/addon_harness/mod.rs index 0732d2a23..2a409bda9 100644 --- a/crates/benilla-app/src/addon_harness/mod.rs +++ b/crates/benilla-app/src/addon_harness/mod.rs @@ -1099,6 +1099,9 @@ fn global_strings() -> Option<&'static str> { /// Every seat below is a state an in-world character is always in, kept minimal and ordinary: a VM /// answering nil or zero there would fail addons on a state the 1.12 client cannot be in. fn seat_a_session(script: &mut UiScript) { + // No engine behind it: a verb's call is kept, not refused (stock `RaidFrame_OnEvent` asks + // `RequestRaidInfo()` on `PLAYER_ENTERING_WORLD`, `RaidFrame.lua:28-29`). + script.keep_calls(); // The 1.12 client boots FrameXML with this file first; so does our app. if let Some(src) = global_strings() { let _ = script.run(src); @@ -1154,8 +1157,9 @@ fn seat_a_session(script: &mut UiScript) { // `UnitFactionGroup("player")`: every playable race has a side, and AceDB-2.0 // concatenates it into its per-realm key at file scope. faction_group: Some("Alliance".into()), - // `0x5efe00`'s team digit for Human (race 1), the rank-title key's second `%d`. - pvp_team: crate::ui_unit::race_pvp_team(1), + // `0x5efe00`'s team digit for Human (race 1), the rank-title key's second `%d`: the + // stock row's template has group mask 3, Alliance. + pvp_team: 1, ..Default::default() }), ); @@ -1313,7 +1317,7 @@ fn seat_a_session(script: &mut UiScript) { // The talent tree (`Talent.dbc` x `TalentTab.dbc`), read by position at file scope // (`KTM_Data.lua:376`). Zero ranks and the full pool, a fresh 60 (51 points, `level - 9`), so a // rank is a number rather than nil. - if let Some(state) = talent_snapshot(script) { + if let Some(state) = talent_snapshot() { script.set_talents(state); } } @@ -1342,9 +1346,8 @@ fn auction_item_classes() -> Vec { } /// The seated character's talent pages, built by the live client's `build_pages`. The DBCs are read -/// once per process; the pages are built per VM, since the requirement lines come from that VM's -/// `GlobalStrings.lua`. `None` with no install. -fn talent_snapshot(script: &UiScript) -> Option { +/// once per process; the pages are built per VM. `None` with no install. +fn talent_snapshot() -> Option { use std::sync::OnceLock; #[allow(clippy::type_complexity)] static DBCS: OnceLock< @@ -1362,14 +1365,6 @@ fn talent_snapshot(script: &UiScript) -> Option(key) - .ok() - .filter(|t| !t.is_empty()) - }; // Human (`ChrRaces.dbc` 1) warrior (`ChrClasses.dbc` 1), the character `seat_a_session` seats. Some(crate::ui_talent::build_pages( talents, @@ -1378,7 +1373,6 @@ fn talent_snapshot(script: &UiScript) -> Option, } /// One resolve's compare inputs. @@ -102,21 +105,48 @@ fn elect_event(cache: &ZoneCache, next: &ZoneSignal) -> Option<&'static str> { } /// Resolves the texts and PvP info, pushes the zone caches, then fires the elected zone event and, -/// independently, `MINIMAP_ZONE_CHANGED`. +/// independently, `MINIMAP_ZONE_CHANGED`. The poll `0x5db900` counts every tick in `ticks` +/// (`0xc4d790`), which nothing resets, and reports only on the tenth, subtracting ten (`0x5db906`, +/// `0x5db917`); the other nine return at once. It reports the active mover's position, else the +/// active player's, and nothing with neither held (`0x5db937`, `0x5db956`, `0x5db95d`): after a +/// worldport frees every object, the commit waits for our player's create. It runs on the tick +/// after the tick's packets (category 6's drain `0x403620`, then category 5's `0x401ec0`), so it +/// reads what the unit feed pushed of a player that arrived this frame. +#[allow(clippy::too_many_arguments)] // a Bevy system's full input set fn feed_zone_events( + mut ticks: Local, mut hosted_vm: crate::script_calls::HostedVm, + me: Query<(), (With, With)>, world: benilla_world::world_point::WorldPoint, areas: Option>, factions: Option>, - self_store: Query<&ObjectStore, With>, realm_pvp: Option>, mut cache: Local>, ) { + *ticks += 1; + let due = *ticks >= 10; + if due { + *ticks -= 10; + } hosted_vm.run(|script| { - let (Some(script), Some(areas)) = (script, areas) else { + let Some(script) = script else { return; }; let cache = cache.get(script); + let realm_pvp = realm_pvp.is_some_and(|r| r.0); + if cache.realm_pvp != Some(realm_pvp) { + cache.realm_pvp = Some(realm_pvp); + script.set_realm_pvp(realm_pvp); + } + if !due { + return; + } + let Some(areas) = areas else { + return; + }; + if me.is_empty() { + return; + } let Some(leaf) = world.area() else { return }; let Some(leaf_row) = areas.0.get(leaf) else { // An unknown id keeps the last state, as the resolver does for areaId 0. @@ -165,7 +195,7 @@ fn feed_zone_events( } }); if let Some(a) = a_name.filter(|n| !n.is_empty()) { - if a != subzone_text { + if whole_wmo_name_takes_the_zone(&a, &subzone_text) { zone_text = a; subzone_text = String::new(); } @@ -197,39 +227,19 @@ fn feed_zone_events( return; } - let zone_row = areas.0.get(zone); - let template = factions - .as_ref() - .zip(self_store.single().ok()) - .and_then(|(f, store)| f.catalog().template(store.0.unit_faction_template()?)) - .map(|t| (t.friend_group_mask, t.enemy_group_mask)); - let realm_pvp = realm_pvp.is_some_and(|r| r.0); - let (ty, is_arena) = zone_pvp_info(realm_pvp, leaf_row, zone_row, template); - // factionName is FactionGroup.dbc's Name for the zone's mask bit. - let pvp = ty.map(|ty| { - let mask = zone_row.map_or(0, |r| r.faction_group_mask); - let name = factions - .as_ref() - .and_then(|f| f.catalog().faction_group_name(mask)) - .unwrap_or(""); - (ty, name) - }); - let pvp_type = pvp.map_or("", |(ty, _)| ty); - script.set_zone_texts(benilla_ui::script::ZoneTexts { zone: signal.zone_text.clone(), real_zone: real_zone_text, subzone: signal.subzone_text.clone(), minimap: minimap_text.clone(), - pvp_type: pvp.map(|(ty, _)| ty.to_string()), - pvp_faction: pvp_faction_text(pvp), - is_arena, + pvp_zone: zone_pvp(areas.0.get(zone), factions.as_deref()), + is_arena: leaf_row.flags & 0x80 != 0, }); if let Some(event) = event { script.fire_event(event, vec![]); debug!( - "area: {event} → zone {:?} / sub {:?} ({pvp_type})", + "area: {event} → zone {:?} / sub {:?}", signal.zone_text, signal.subzone_text ); } @@ -246,40 +256,24 @@ fn feed_zone_events( }) } -/// `GetZonePVPInfo`'s second value: with a type answered, the faction name is always a string, -/// starting as the empty string (`0x48d633`, `0x882748`) and pushed by `lua_pushstring` -/// (`0x48d68f`) whether or not a FactionGroup row supplied one; only the bail (`0x48d6b5`) pushes -/// nil. -fn pvp_faction_text(pvp: Option<(&str, &str)>) -> Option { - pvp.map(|(_, faction)| faction.to_string()) -} - -/// `GetZonePVPInfo` (`0x48d540`): `(pvpType, isArena)`. isArena is the leaf's Flags `0x80`, read -/// before any bail. The type is nil with no zone row, no faction template, or the display gate -/// closed: it opens on a PvP realm ([`RealmPvp`]) or in a zone whose Flags carry `0x10`, the six -/// capitals (`0x48d5c2`/`0x48d5cc`). Open, it is the zone's FactionGroupMask against the template's -/// `(friend, enemy)` masks, "contested" when neither, never "arena". -fn zone_pvp_info( - realm_pvp: bool, - leaf: &AreaTableRow, +/// What `GetZonePVPInfo` (`0x48d540`) reads of the committed zone's row `zone`: the capital bit +/// (Flags `0x10`, `0x48d5cc`), the `FactionGroupMask` (`+0x50`) and the faction name, +/// `FactionGroup.dbc`'s for the mask, `""` when no row names one (`0x48d633`). `None` with no row +/// (`0x48d5b4`). +fn zone_pvp( zone: Option<&AreaTableRow>, - template: Option<(u32, u32)>, -) -> (Option<&'static str>, bool) { - let is_arena = leaf.flags & 0x80 != 0; - let ty = zone - .filter(|z| realm_pvp || z.flags & 0x10 != 0) - .zip(template) - .map(|(z, (friend, enemy))| { - let mask = z.faction_group_mask; - if mask & friend != 0 { - "friendly" - } else if mask & enemy != 0 { - "hostile" - } else { - "contested" - } - }); - (ty, is_arena) + factions: Option<&Factions>, +) -> Option { + let zone = zone?; + let mask = zone.faction_group_mask; + Some(benilla_ui::script::ZonePvp { + capital: zone.flags & 0x10 != 0, + faction_group_mask: mask, + faction_name: factions + .and_then(|f| f.catalog().faction_group_name(mask)) + .unwrap_or("") + .to_string(), + }) } /// `[0x88272c]`, the realm's PvP flag the display gate reads: the selected realm's @@ -307,6 +301,12 @@ fn latched_realm_pvp(previous: bool, row_pvp: Option) -> bool { row_pvp.unwrap_or(previous) } +/// Indoors the whole-WMO row's name replaces the zone text, and clears the subzone, only when it +/// differs from the subzone text, ASCII case folded (`SStrCmpI` at `0x67e6e4`). +fn whole_wmo_name_takes_the_zone(name: &str, subzone: &str) -> bool { + !name.eq_ignore_ascii_case(subzone) +} + /// The shared area catalog and the zone-event feed. pub(crate) struct AreaPlugin; @@ -322,9 +322,10 @@ impl Plugin for AreaPlugin { Update, // After the leaf authority: leaf, indoor bit and names must come from one frame, // as in the client's single-pass resolve (`0x67e510`), or a stale leaf fires a - // spurious splash. + // spurious splash. After the unit feed too, by the sets: the commit's handlers read + // our template as the frame's packets left it. feed_zone_events - .after(crate::ui_script::UiInput) + .after(crate::ui_script::UiTick) .after(benilla_world::terrain_stream::AreaAuthoritySet), ); } @@ -406,75 +407,22 @@ mod tests { } } - /// An Alliance player's template: friend Alliance (2), enemy Horde (4). - const ALLIANCE: Option<(u32, u32)> = Some((2, 4)); - - /// The display gate (`0x48d5c2`/`0x48d5cc`): a PvE realm outside a capital gets no type; a - /// capital's Flags `0x10` opens it there, and a PvP realm opens it everywhere. + /// The zone's row as the getter reads it: the capital bit, the mask and its faction name, + /// `""` for a mask no `FactionGroup` row names; no row, nothing to read. #[test] - fn the_pvp_type_shows_on_a_pvp_realm_or_in_a_capital() { - let elwynn = row(0x40, 2); - let stormwind = row(0x138, 2); + fn the_commit_pushes_the_zones_capital_bit_mask_and_faction_name() { let orgrimmar = row(0x138, 4); let stranglethorn = row(0x40, 0); - let pvp = - |realm_pvp, zone: &AreaTableRow| zone_pvp_info(realm_pvp, zone, Some(zone), ALLIANCE).0; - - assert_eq!(pvp(false, &elwynn), None, "PvE realm, outside a capital"); assert_eq!( - pvp(false, &stranglethorn), - None, - "PvE realm, ownerless zone" - ); - assert_eq!( - pvp(false, &stormwind), - Some("friendly"), - "PvE realm, own capital" - ); - assert_eq!( - pvp(false, &orgrimmar), - Some("hostile"), - "PvE realm, enemy capital" - ); - - assert_eq!(pvp(true, &elwynn), Some("friendly")); - assert_eq!(pvp(true, &stranglethorn), Some("contested")); - assert_eq!(pvp(true, &orgrimmar), Some("hostile")); - } - - /// An answered type always carries a faction string, `""` in an ownerless zone such as - /// Stranglethorn Vale (`0x48d633`); no type, no string (`0x48d6b5`). - #[test] - fn an_answered_type_carries_an_empty_faction_name_not_nil() { - assert_eq!( - pvp_faction_text(Some(("contested", ""))), - Some(String::new()) - ); - assert_eq!( - pvp_faction_text(Some(("friendly", "Alliance"))), - Some("Alliance".to_string()) - ); - assert_eq!(pvp_faction_text(None), None); - } - - /// isArena is the leaf's `0x80`, read before any bail, so a closed gate keeps it. - #[test] - fn is_arena_survives_a_closed_gate() { - let battle_ring = row(0xd0, 0); - let stranglethorn = row(0x40, 0); - assert_eq!( - zone_pvp_info(false, &battle_ring, Some(&stranglethorn), ALLIANCE), - (None, true) - ); - assert_eq!( - zone_pvp_info(true, &battle_ring, Some(&stranglethorn), ALLIANCE), - (Some("contested"), true) - ); - assert_eq!( - zone_pvp_info(true, &battle_ring, Some(&stranglethorn), None), - (None, true), - "no faction template" + zone_pvp(Some(&orgrimmar), None), + Some(benilla_ui::script::ZonePvp { + capital: true, + faction_group_mask: 4, + faction_name: String::new(), + }) ); + assert!(!zone_pvp(Some(&stranglethorn), None).unwrap().capital); + assert_eq!(zone_pvp(None, None), None); } /// A realm type with no row keeps what the last world entry stored. @@ -486,15 +434,6 @@ mod tests { assert!(latched_realm_pvp(false, Some(true))); } - /// No zone row is a bail, not an ownerless zone. - #[test] - fn a_missing_zone_row_has_no_pvp_type() { - assert_eq!( - zone_pvp_info(true, &row(0, 0), None, ALLIANCE), - (None, false) - ); - } - /// On the install's AreaTable the gate opens in exactly the six capitals for a PvE realm. #[test] fn the_six_capitals_are_the_zones_a_pve_realm_colours() { @@ -503,9 +442,8 @@ mod tests { let cat = benilla_formats::load_area_table_catalog(&mut chain).expect("AreaTable"); let open: Vec = (0..=u32::from(u16::MAX)) .filter(|&id| { - cat.get(id).is_some_and(|r| { - r.zone_id == 0 && zone_pvp_info(false, r, Some(r), ALLIANCE).0.is_some() - }) + cat.get(id) + .is_some_and(|r| r.zone_id == 0 && zone_pvp(Some(r), None).unwrap().capital) }) .collect(); assert_eq!(open, [1497, 1519, 1537, 1637, 1638, 1657]); @@ -544,4 +482,235 @@ mod tests { "no named group rows — query B leaves the nulled subzone alone" ); } + + /// `GetZonePVPInfo` (`0x48d540`) reads, at the call, the zone the last commit stored + /// (`0xb4e314`) and the active player's faction template (`0x48d5b4`-`0x48d5fe`): a capital + /// entered before our template arrives answers once it is there, with no zone change between, + /// and the type follows a template that changes. + #[test] + fn the_zone_pvp_type_reads_our_template_at_the_call() { + use crate::net::{Guid, GuidIndex, NetCommands, ObjectStore, SelfGuid, SelfPlayer}; + use crate::target::relations::fixture::{factions, HUMAN, ORC}; + use benilla_protocol::messages::ObjectType; + use benilla_protocol::ObjectFields; + use benilla_ui::script::UiScript; + const ME: u64 = 0x7; + const ORGRIMMAR: u32 = 1637; + /// `UNIT_FIELD_FACTIONTEMPLATE`. + const TEMPLATE: u16 = 35; + + let mut app = crate::game_plugins::schedule_tests::headless_client_unrun(); + let world = app.world_mut(); + benilla_world::world_point::init_world_point_resources(world); + let (tx, _rx) = crossbeam_channel::unbounded(); + world.insert_resource(NetCommands(tx)); + world.resource_mut::().0 = Some(ME); + world.insert_resource(factions()); + world.insert_resource(AreaTableRes(AreaTableCatalog::from_rows(vec![( + ORGRIMMAR, + AreaTableRow { + name: "Orgrimmar".into(), + ..row(0x138, 4) + }, + )]))); + world.insert_resource(benilla_world::terrain_stream::CurrentArea(Some(ORGRIMMAR))); + world.insert_non_send_resource(UiScript::new().unwrap()); + let store = |template: Option| { + let pairs: Vec<(u16, u32)> = template.map(|t| (TEMPLATE, t)).into_iter().collect(); + ObjectStore(ObjectFields::from_pairs(&pairs).into_created(ObjectType::Player)) + }; + let me = world.spawn((SelfPlayer, Guid(ME), store(None))).id(); + world.resource_mut::().0.insert(ME, me); + let pvp = |app: &mut App| { + let world = app.world_mut(); + crate::ui_unit::run_feed_units_once(world); + // The poll's tenth tick (`0x5db906`). + for _ in 0..10 { + world.run_system_cached(feed_zone_events).unwrap(); + } + world + .non_send_resource::() + .eval::<(Option, Option)>( + "local t, f = GetZonePVPInfo() return t, f", + ) + .unwrap() + }; + assert_eq!(pvp(&mut app), (None, None), "no template: nil"); + app.world_mut().entity_mut(me).insert(store(Some(ORC))); + assert_eq!(pvp(&mut app).0.as_deref(), Some("friendly")); + app.world_mut().entity_mut(me).insert(store(Some(HUMAN))); + assert_eq!(pvp(&mut app).0.as_deref(), Some("hostile")); + } + + /// A worldport frees our player with every object (`0x467700`) and its create comes after the + /// load. The zone poll reports only the active mover's, else the active player's, position + /// (`0x5db937`, `0x5db956`), and runs on the tick's category 5 after the category 6 packet + /// drain (`0x401ec0`, `0x403620`), so the commit `0x494780` waits for our player and follows + /// its arrival. A capital entered on a PvE realm answers its type inside the new area's event. + #[test] + fn a_worldport_commits_the_zone_once_our_player_is_back() { + use crate::net::{Guid, GuidIndex, NetCommands, ObjectStore, SelfGuid, SelfPlayer}; + use crate::target::relations::fixture::{factions, ORC}; + use benilla_protocol::messages::ObjectType; + use benilla_protocol::ObjectFields; + use benilla_ui::script::UiScript; + const ME: u64 = 0x7; + const ORGRIMMAR: u32 = 1637; + /// `UNIT_FIELD_FACTIONTEMPLATE`. + const TEMPLATE: u16 = 35; + + let mut app = crate::game_plugins::schedule_tests::headless_client_unrun(); + let world = app.world_mut(); + benilla_world::world_point::init_world_point_resources(world); + let (tx, _rx) = crossbeam_channel::unbounded(); + world.insert_resource(NetCommands(tx)); + world.resource_mut::().0 = Some(ME); + world.insert_resource(factions()); + world.insert_resource(AreaTableRes(AreaTableCatalog::from_rows(vec![( + ORGRIMMAR, + AreaTableRow { + name: "Orgrimmar".into(), + ..row(0x138, 4) + }, + )]))); + // The body is at the port's destination before our player's create arrives. + world.insert_resource(benilla_world::terrain_stream::CurrentArea(Some(ORGRIMMAR))); + let script = UiScript::new().unwrap(); + script + .run( + r#" + Seen = {} + local f = CreateFrame("Frame") + f:RegisterEvent("ZONE_CHANGED_NEW_AREA") + f:SetScript("OnEvent", function() + table.insert(Seen, tostring((GetZonePVPInfo()))) + end) + "#, + ) + .unwrap(); + world.insert_non_send_resource(script); + let frame = |app: &mut App| { + let world = app.world_mut(); + crate::ui_unit::run_feed_units_once(world); + // The poll's tenth tick (`0x5db906`). + for _ in 0..10 { + world.run_system_cached(feed_zone_events).unwrap(); + } + let s = world.non_send_resource::(); + let seen = s.eval::>("return Seen").unwrap(); + s.run("Seen = {}").unwrap(); + seen + }; + assert_eq!( + frame(&mut app), + Vec::::new(), + "no player, no commit" + ); + let store = ObjectStore( + ObjectFields::from_pairs(&[(TEMPLATE, ORC)]).into_created(ObjectType::Player), + ); + let me = app.world_mut().spawn((SelfPlayer, Guid(ME), store)).id(); + app.world_mut().resource_mut::().0.insert(ME, me); + assert_eq!(frame(&mut app), ["friendly"]); + } + + /// The commit reads what the unit feed pushed of a player that arrived this frame. + #[test] + fn the_zone_commit_runs_after_the_unit_feed() { + let mut app = crate::game_plugins::schedule_tests::headless_client(); + assert!(crate::ui_unit::feed_units_runs_before( + &mut app, + feed_zone_events + )); + } + + /// The poll `0x5db900` counts its calls (`0xc4d790`) and reports the area only on the tenth + /// (`0x5db906`, `jl 0x5db975`), subtracting ten (`0x5db917`): the first commit lands on the + /// tenth tick, and a subzone crossed and recrossed between two polls signals nothing. + #[test] + fn the_area_commits_on_every_tenth_tick() { + use crate::net::{Guid, GuidIndex, ObjectStore, SelfGuid, SelfPlayer}; + use benilla_protocol::messages::ObjectType; + use benilla_ui::script::UiScript; + use benilla_world::terrain_stream::CurrentArea; + const ME: u64 = 0x7; + const ELWYNN: u32 = 12; + const GOLDSHIRE: u32 = 87; + + let mut app = crate::game_plugins::schedule_tests::headless_client_unrun(); + let world = app.world_mut(); + benilla_world::world_point::init_world_point_resources(world); + world.resource_mut::().0 = Some(ME); + world.insert_resource(AreaTableRes(AreaTableCatalog::from_rows(vec![ + ( + ELWYNN, + AreaTableRow { + name: "Elwynn Forest".into(), + ..row(0, 0) + }, + ), + ( + GOLDSHIRE, + AreaTableRow { + name: "Goldshire".into(), + zone_id: ELWYNN, + ..row(0, 0) + }, + ), + ]))); + world.insert_resource(CurrentArea(Some(ELWYNN))); + let script = UiScript::new().unwrap(); + script + .run( + r#" + Seen = {} + local f = CreateFrame("Frame") + f:RegisterEvent("ZONE_CHANGED_NEW_AREA") + f:RegisterEvent("ZONE_CHANGED") + f:SetScript("OnEvent", function() table.insert(Seen, event) end) + "#, + ) + .unwrap(); + world.insert_non_send_resource(script); + let store = ObjectStore(ObjectFields::from_pairs(&[]).into_created(ObjectType::Player)); + let me = world.spawn((SelfPlayer, Guid(ME), store)).id(); + world.resource_mut::().0.insert(ME, me); + let ticks = |app: &mut App, area: u32, n: usize| { + let world = app.world_mut(); + world.insert_resource(CurrentArea(Some(area))); + for _ in 0..n { + world.run_system_cached(feed_zone_events).unwrap(); + } + let s = world.non_send_resource::(); + let seen = s.eval::>("return Seen").unwrap(); + s.run("Seen = {}").unwrap(); + seen + }; + use benilla_protocol::ObjectFields; + assert!(ticks(&mut app, ELWYNN, 9).is_empty(), "nine ticks return"); + assert_eq!(ticks(&mut app, ELWYNN, 1), ["ZONE_CHANGED_NEW_AREA"]); + assert!(ticks(&mut app, GOLDSHIRE, 3).is_empty()); + assert!( + ticks(&mut app, ELWYNN, 7).is_empty(), + "Goldshire left before the next poll" + ); + assert!(ticks(&mut app, GOLDSHIRE, 9).is_empty()); + assert_eq!(ticks(&mut app, GOLDSHIRE, 1), ["ZONE_CHANGED"]); + } + + /// `0x67e6e4` compares the whole-WMO name with the subzone by `SStrCmpI` (`0x64a4c0`, limit + /// `0x7fffffff`): a name that differs only in case keeps both texts. + #[test] + fn the_whole_wmo_name_compares_without_case() { + assert!(!whole_wmo_name_takes_the_zone( + "The Great Forge", + "the great forge" + )); + assert!(!whole_wmo_name_takes_the_zone("Ironforge", "Ironforge")); + assert!(whole_wmo_name_takes_the_zone( + "Ironforge", + "The Great Forge" + )); + assert!(whole_wmo_name_takes_the_zone("Ironforge", "")); + } } diff --git a/crates/benilla-app/src/bindings.rs b/crates/benilla-app/src/bindings.rs index 2594f9f8d..ef604bb93 100644 --- a/crates/benilla-app/src/bindings.rs +++ b/crates/benilla-app/src/bindings.rs @@ -88,6 +88,8 @@ pub(crate) struct BindingsState { fired: Vec, /// Amount per one-shot this frame: a zoom's yards, else 1.0. amounts: Vec<(Input, f32)>, + /// This frame's `MoveView*` calls in call order, `(axis, start)`, for the camera's axes. + view_calls: Vec<(script_input::ViewAxis, bool)>, /// The keys we believe are down: a press of one is a repeat. The reference classifies /// auto-repeat off its own list (`0x4248b3`), never the Win32 `lParam` repeat bit. /// Normalized like [`latched`](Self::latched) and reconciled against `ButtonInput` every @@ -157,6 +159,16 @@ impl BindingsState { pub(crate) fn fired(&self, i: Input) -> bool { self.fired.contains(&i) } + /// Fire the one-shot `i` this frame, as a body's Lua call would. + #[cfg(test)] + pub(crate) fn fire_for_test(&mut self, i: Input) { + self.fired.push(i); + } + /// End the frame's one-shots. + #[cfg(test)] + pub(crate) fn clear_for_test(&mut self) { + self.fired.clear(); + } /// Total amount for a one-shot this frame (0.0 when idle): the camera zoom's yards. pub(crate) fn amount(&self, i: Input) -> f32 { self.amounts @@ -165,6 +177,10 @@ impl BindingsState { .map(|&(_, v)| v) .sum() } + /// This frame's `MoveView*` calls in call order, `(axis, start)`. + pub(crate) fn view_calls(&self) -> &[(script_input::ViewAxis, bool)] { + &self.view_calls + } /// Both mouse bits held by their Lua Starts, the both-button run: MOVEANDSTEER's body /// (`Bindings.xml:3-11`) runs `CameraOrSelectOrMoveStart` and `TurnOrActionStart`. pub(crate) fn steering(&self) -> bool { @@ -452,6 +468,7 @@ fn latch_and_dispatch( state.just.clear(); state.fired.clear(); state.amounts.clear(); + state.view_calls.clear(); // Deviation: latches die with the VM that made them, because a latch names a command of that // VM's table and releasing it against a new one would run another load's up-half. The @@ -1631,7 +1648,7 @@ mod tests { } /// The ungated one-shots fire as the keys do: `CameraZoomIn(yards)` carries its amount to the - /// zoom (1.0 when absent, `0x50b42d`), `SitOrStand` and `ToggleSheath` fire. + /// zoom (1.0 when absent, `0x50b42d`), and `ToggleSheath` fires, one frame only. #[test] fn the_one_shot_functions_fire_their_inputs() { let mut app = harness(); @@ -1652,11 +1669,10 @@ mod tests { 0.0, "one frame only" ); - run(&mut app, "SitOrStand()"); - assert!(state(&app).fired(Input::SitOrStand)); run(&mut app, "ToggleSheath()"); assert!(state(&app).fired(Input::ToggleSheath)); - assert!(!state(&app).fired(Input::SitOrStand)); + run(&mut app, "CameraZoomOut()"); + assert!(!state(&app).fired(Input::ToggleSheath)); } /// Two keys on one command share its one bit: W and UP both run MOVEFORWARD's body, so the @@ -1925,10 +1941,10 @@ mod tests { state(&app).pressed(Input::MoveForward), "the capture edge is not a release — holding W keeps you running while you type" ); - press_key(&mut app, KeyCode::KeyX); + press_key(&mut app, KeyCode::KeyZ); app.update(); assert!( - !state(&app).fired(Input::SitOrStand), + !state(&app).fired(Input::ToggleSheath), "typed keys are not bindings" ); // Letting go still stops you, box focused or not. @@ -1939,12 +1955,12 @@ mod tests { "the release is delivered regardless of focus" ); // Focus drops; keys work again. - release_key(&mut app, KeyCode::KeyX); + release_key(&mut app, KeyCode::KeyZ); app.world_mut().resource_mut::().typing = false; app.update(); - press_key(&mut app, KeyCode::KeyX); + press_key(&mut app, KeyCode::KeyZ); app.update(); - assert!(state(&app).fired(Input::SitOrStand)); + assert!(state(&app).fired(Input::ToggleSheath)); } /// A shown keyboard frame eating the key that closes it costs that key its binding and @@ -1968,22 +1984,22 @@ mod tests { // The eaten key loses its binding... release_key(&mut app, KeyCode::KeyM); app.update(); - frame_ate(&mut app, &[KeyCode::KeyX]); - press_key(&mut app, KeyCode::KeyX); + frame_ate(&mut app, &[KeyCode::KeyZ]); + press_key(&mut app, KeyCode::KeyZ); app.update(); assert!( - !state(&app).fired(Input::SitOrStand), + !state(&app).fired(Input::ToggleSheath), "the frame ate this key: its binding must not also fire" ); // ...and only that key. - release_key(&mut app, KeyCode::KeyX); + release_key(&mut app, KeyCode::KeyZ); app.update(); frame_ate(&mut app, &[KeyCode::KeyM]); - press_key(&mut app, KeyCode::KeyX); + press_key(&mut app, KeyCode::KeyZ); app.update(); assert!( - state(&app).fired(Input::SitOrStand), + state(&app).fired(Input::ToggleSheath), "consumption is per key, not per frame" ); assert!( diff --git a/crates/benilla-app/src/bindings/script_input.rs b/crates/benilla-app/src/bindings/script_input.rs index 42d0658ff..18852ee13 100644 --- a/crates/benilla-app/src/bindings/script_input.rs +++ b/crates/benilla-app/src/bindings/script_input.rs @@ -7,6 +7,8 @@ use benilla_ui::script::{BindingInput, FiredInput, HeldInput}; +pub(crate) use benilla_ui::script::ViewAxis; + use super::BindingsState; /// One engine input a binding function drives: a held bit of `[InputControl+4]` or a one-shot. @@ -28,14 +30,16 @@ pub(crate) enum Input { TurnOrAction, /// `CameraOrSelectOrMoveStart`/`Stop`, bit `0x2`. CameraOrSelectOrMove, + /// `PitchUpStart`/`Stop`, bit `0x400`. + PitchUp, + /// `PitchDownStart`/`Stop`, bit `0x800`. + PitchDown, /// `Jump()`. Jump, /// `ToggleRun()`, the walk toggle. ToggleRun, /// `ToggleAutoRun()`. ToggleAutoRun, - /// `SitOrStand()`. - SitOrStand, /// `ToggleSheath()`. ToggleSheath, /// `CameraZoomIn([yards])`, its yards in [`BindingsState::amount`]. @@ -55,6 +59,8 @@ fn held_input(input: HeldInput) -> Input { HeldInput::StrafeRight => Input::StrafeRight, HeldInput::TurnOrAction => Input::TurnOrAction, HeldInput::CameraOrSelectOrMove => Input::CameraOrSelectOrMove, + HeldInput::PitchUp => Input::PitchUp, + HeldInput::PitchDown => Input::PitchDown, } } @@ -64,7 +70,6 @@ fn fired_input(input: FiredInput) -> (Input, f32) { FiredInput::Jump => (Input::Jump, 1.0), FiredInput::ToggleRun => (Input::ToggleRun, 1.0), FiredInput::ToggleAutoRun => (Input::ToggleAutoRun, 1.0), - FiredInput::SitOrStand => (Input::SitOrStand, 1.0), FiredInput::ToggleSheath => (Input::ToggleSheath, 1.0), FiredInput::CameraZoomIn(yards) => (Input::CameraZoomIn, yards), FiredInput::CameraZoomOut(yards) => (Input::CameraZoomOut, yards), @@ -98,6 +103,10 @@ impl BindingsState { self.just.push(i); self.amounts.push((i, amount)); } + // The camera's axes are its own state (`[cam+0x128]`), not `[InputControl+4]`: + // passed through in call order for the camera to apply. + BindingInput::ViewStart(axis) => self.view_calls.push((axis, true)), + BindingInput::ViewStop(axis) => self.view_calls.push((axis, false)), } } } @@ -111,6 +120,7 @@ impl BindingsState { state.just.clear(); state.fired.clear(); state.amounts.clear(); + state.view_calls.clear(); state.apply_script_input(now); state } diff --git a/crates/benilla-app/src/capture/fixtures.rs b/crates/benilla-app/src/capture/fixtures.rs index 1d3bfd99e..380dc7aaf 100644 --- a/crates/benilla-app/src/capture/fixtures.rs +++ b/crates/benilla-app/src/capture/fixtures.rs @@ -2,6 +2,7 @@ use super::*; use benilla_protocol::messages::trainer_spell_state; +use benilla_ui::script::UiScript; /// The `vplates` fixture's wolf, the reference screenshot's subject (vmangos `creature_template` /// 69 "Timber Wolf": level 2, faction template 32, display 604), at the scenario's look point. @@ -105,20 +106,24 @@ pub(super) fn seed_ui_fixture( ResMut<'static, crate::ui_bank::BankOpen>, MessageWriter<'static, AppExit>, ResMut<'static, crate::loading_screen::LoadingScreen>, + ResMut<'static, crate::ui_gossip::GossipState>, + ResMut<'static, crate::ui_quest::QuestGiver>, ), )>, mut ctx: ResMut, mut commands: Commands, progress: Res, - mut gossip: ResMut, - mut quest: ResMut, mut quest_log: ResMut, mut trainer: ResMut, icons: Option>, ) { - vm.turn(|mut script, parts| { + let icons = icons.as_deref(); + // The seed's Lua (its pushes, chunks and hovers) runs once the turn's world writes are in, + // with the host lent: what it fires runs in place, and what it calls applies inside the verb. + let mut lua: Option> = None; + vm.turn(|script, parts| { let (mut merchant, mut loot, mut names, mut selection, mut player, store, rest) = parts; - let (mut actions, mut bank, mut exit, mut loading) = rest; + let (mut actions, mut bank, mut exit, mut loading, mut gossip, mut quest) = rest; let (mut items, mut index, mut home_bind) = store; // A glue-screen capture has no world scenario, and no glue screen opens a UI fixture. let Some(scenario) = ctx.scenario else { @@ -268,14 +273,14 @@ pub(super) fn seed_ui_fixture( merchant.open(NPC_GUID, rows); // The usable gate's player half, by hand: with no SelfPlayer in capture, // `feed_player_req` never runs to overwrite it. A level-12 human warrior. - if let Some(s) = script.as_mut() { + lua = Some(Box::new(move |s: &mut UiScript| { s.set_player_req_state(benilla_ui::script::PlayerReqState { level: 12, class_id: 1, race_id: 1, ..Default::default() }); - } + })); } UiFixture::Trainer(list) => { // The seed's rows are the wire list: its copper costs, level gates and the states @@ -302,21 +307,6 @@ pub(super) fn seed_ui_fixture( }), ); home_bind.0 = Some(seed.bind); - let Some(script) = script.as_mut() else { - return; - }; - // The window's title and portrait read `UnitName("npc")`; no session seats it here. - script.set_unit( - "npc", - Some(benilla_ui::script::UnitState { - exists: true, - name: Some(seed.name.into()), - level: 12, - ..Default::default() - }), - ); - // A purse large enough for every cost above, so the money frame renders white. - script.set_money(10_000); let services: Vec = seed .rows .iter() @@ -333,6 +323,21 @@ pub(super) fn seed_ui_fixture( }) .collect(); trainer.open(NPC_GUID, seed.trainer_type, services, seed.greeting.into()); + lua = Some(Box::new(move |script: &mut UiScript| { + // The window's title and portrait read `UnitName("npc")`; no session seats it + // here. + script.set_unit( + "npc", + Some(benilla_ui::script::UnitState { + exists: true, + name: Some(seed.name.into()), + level: 12, + ..Default::default() + }), + ); + // A purse large enough for every cost above, so the money frame renders white. + script.set_money(10_000); + })); } UiFixture::Gossip => { names.insert_creature( @@ -482,19 +487,18 @@ pub(super) fn seed_ui_fixture( // Opens bank bag 1 once its container feed lands (`GetContainerNumSlots(5) > 0`); // `BankFrameBag1`'s `GetID()` is 5, the container id its handler passes to // `ToggleBag`. - if let Some(s) = script.as_mut() { - if let Err(e) = s.run( - "BankFrame:SetScript(\"OnUpdate\", function()\n\ - if not benillaBankPopoutDone and GetContainerNumSlots(5) > 0 then\n\ - benillaBankPopoutDone = 1\n\ - this = getglobal(\"BankFrameBag1\")\n\ - BankFrameItemButtonBag_OnClick(\"LeftButton\")\n\ - end\n\ - end)", - ) { + let popout = "BankFrame:SetScript(\"OnUpdate\", function()\n\ + if not benillaBankPopoutDone and GetContainerNumSlots(5) > 0 then\n\ + benillaBankPopoutDone = 1\n\ + this = getglobal(\"BankFrameBag1\")\n\ + BankFrameItemButtonBag_OnClick(\"LeftButton\")\n\ + end\n\ + end)"; + lua = Some(Box::new(move |s: &mut UiScript| { + if let Err(e) = s.run(popout) { warn!("capture: ui-bank popout hook failed: {e}"); } - } + })); } UiFixture::Quest => { names.insert_creature( @@ -744,11 +748,11 @@ pub(super) fn seed_ui_fixture( )); // The L binding's path; the feed pushes over the settle window. - if let Some(s) = script.as_mut() { + lua = Some(Box::new(move |s: &mut UiScript| { if let Err(e) = s.run("ToggleQuestLog()") { warn!("capture: ui-questlog seed failed to open the log: {e}"); } - } + })); } UiFixture::Loot => { items.insert_template(90_117, Some(template("Chipped Boar Tusk", 0))); @@ -778,201 +782,195 @@ pub(super) fn seed_ui_fixture( ); } UiFixture::Bag => { - let Some(script) = script else { - return; - }; - seed_bag_window(script, icons.as_deref()); - seed_equipped_bags(script, icons.as_deref()); + lua = Some(Box::new(move |script: &mut UiScript| { + seed_bag_window(script, icons); + seed_equipped_bags(script, icons); + })); } UiFixture::Cooldown => { - let Some(script) = script else { - return; - }; - seed_cooldown_filmstrip(script, icons.as_deref()); + lua = Some(Box::new(move |script: &mut UiScript| { + seed_cooldown_filmstrip(script, icons); + })); } UiFixture::CooldownShine => { - let Some(script) = script else { - return; - }; - seed_cooldown_filmstrip(script, icons.as_deref()); - // The pet bar's autocast shine, raised by hand, as no pet is fed. - if let Err(e) = script.run( - "PetActionBarFrame:Show()\n\ - for i = 1, 4 do\n\ - local b = getglobal(\"PetActionButton\"..i)\n\ - if b then b:Show(); getglobal(b:GetName()..\"AutoCast\"):Show() end\n\ - end", - ) { - warn!("capture: ui-cooldown-shine failed to raise the autocast shine: {e}"); - } + lua = Some(Box::new(move |script: &mut UiScript| { + seed_cooldown_filmstrip(script, icons); + // The pet bar's autocast shine, raised by hand, as no pet is fed. + if let Err(e) = script.run( + "PetActionBarFrame:Show()\n\ + for i = 1, 4 do\n\ + local b = getglobal(\"PetActionButton\"..i)\n\ + if b then b:Show(); getglobal(b:GetName()..\"AutoCast\"):Show() end\n\ + end", + ) { + warn!("capture: ui-cooldown-shine failed to raise the autocast shine: {e}"); + } + })); } UiFixture::WorldMap => { - let Some(script) = script else { - return; - }; // At the default origin the player is off every zone rect and the arrow hides, so // park it at the scenario's Northshire spot. player.pos = benilla_assets::coords::wow_to_bevy(scenario.eye); - // Alternating explore bits, so about half of each zone's overlays reveal. - script.set_world_map_explored(vec![0x5555_5555; 64]); - // The Elwynn zone map: continent 2, zone 10 in the alphabetical zone list. - if let Err(e) = script.run("ToggleWorldMap(); SetMapZoom(2, 10)") { - warn!("capture: ui-worldmap seed failed to open the map: {e}"); - } + lua = Some(Box::new(move |script: &mut UiScript| { + // Alternating explore bits, so about half of each zone's overlays reveal. + script.set_world_map_explored(vec![0x5555_5555; 64]); + // The Elwynn zone map: continent 2, zone 10 in the alphabetical zone list. + if let Err(e) = script.run("ToggleWorldMap(); SetMapZoom(2, 10)") { + warn!("capture: ui-worldmap seed failed to open the map: {e}"); + } + })); } UiFixture::PartyInvite => { - let Some(script) = script else { - return; - }; - // Raised through the real `StaticPopupDialogs` entry, as a real invite is. - if let Err(e) = script.run(r#"StaticPopup_Show("PARTY_INVITE", "Brisca")"#) { - warn!("capture: ui-partyinvite seed failed to raise the dialog: {e}"); - } + lua = Some(Box::new(move |script: &mut UiScript| { + // Raised through the real `StaticPopupDialogs` entry, as a real invite is. + if let Err(e) = script.run(r#"StaticPopup_Show("PARTY_INVITE", "Brisca")"#) { + warn!("capture: ui-partyinvite seed failed to raise the dialog: {e}"); + } + })); } UiFixture::Tooltip => { - let Some(script) = script else { - return; - }; - seed_bag_window(script, icons.as_deref()); - // The hovered shield's full template and a player under its level requirement: - // quality name, bind, slot and type, armor and block, stats, durability, a red - // requirement, a long green Use: line that wraps, a charges line after it, and the - // flavor text. - script.set_player_req_state(benilla_ui::script::PlayerReqState { - level: 12, - class_id: 1, - race_id: 1, - skills: Default::default(), - ..Default::default() - }); - script.set_item_template( - 2362, - benilla_ui::script::ItemTemplateView { - name: "Small Shield".into(), - quality: 2, - class: 4, - subclass: 6, - inventory_type: 14, - bonding: 2, - stats: vec![(7, 3)], - armor: 85, - block: 4, - max_durability: 45, - required_level: 20, - spell_lines: vec![benilla_ui::script::ItemSpellLine { - trigger: 0, - spell_id: 72, - text: "Restores 243 health over 21 sec. Must remain seated while \ - eating." - .into(), - charges: 1, - block: 0, - recipe: None, - }], - description: "A stout little shield of Northshire pine.".into(), - sell_price: 152, - item_set: 161, + lua = Some(Box::new(move |script: &mut UiScript| { + seed_bag_window(script, icons); + // The hovered shield's full template and a player under its level requirement: + // quality name, bind, slot and type, armor and block, stats, durability, a red + // requirement, a long green Use: line that wraps, a charges line after it, and + // the flavor text. + script.set_player_req_state(benilla_ui::script::PlayerReqState { + level: 12, + class_id: 1, + race_id: 1, + skills: Default::default(), ..Default::default() - }, - ); - // The item-set block (`0x52b650`), Defias Leather with one of 5 equipped: the gold - // "(1/5)" header, the member ladder, a green (2) bonus and a gray (4) one. - let mut inv: benilla_ui::script::InventorySlots = Default::default(); - inv[4] = Some(benilla_ui::script::InvSlotView { - durability: None, - item_id: 6303, - ..Default::default() - }); - script.set_inventory_slots(inv); - script.set_item_set( - 161, - benilla_ui::script::ItemSetView { - name: "Defias Leather".into(), - members: vec![ - (6303, Some("Defias Mark".into())), - (6304, Some("Defias Belt".into())), - (6305, Some("Defias Gloves".into())), - (6306, Some("Defias Trousers".into())), - (6307, Some("Defias Boots".into())), - ], - bonuses: vec![ - (2, "Increases movement speed slightly.".into()), - ( - 4, - "Immune to Defias Pillager and Defias Looter spells.".into(), - ), - ], + }); + script.set_item_template( + 2362, + benilla_ui::script::ItemTemplateView { + name: "Small Shield".into(), + quality: 2, + class: 4, + subclass: 6, + inventory_type: 14, + bonding: 2, + stats: vec![(7, 3)], + armor: 85, + block: 4, + max_durability: 45, + required_level: 20, + spell_lines: vec![benilla_ui::script::ItemSpellLine { + trigger: 0, + spell_id: 72, + text: "Restores 243 health over 21 sec. Must remain seated while \ + eating." + .into(), + charges: 1, + block: 0, + recipe: None, + }], + description: "A stout little shield of Northshire pine.".into(), + sell_price: 152, + item_set: 161, + ..Default::default() + }, + ); + // The item-set block (`0x52b650`), Defias Leather with one of 5 equipped: the + // gold "(1/5)" header, the member ladder, a green (2) bonus and a gray (4) one. + let mut inv: benilla_ui::script::InventorySlots = Default::default(); + inv[4] = Some(benilla_ui::script::InvSlotView { + durability: None, + item_id: 6303, ..Default::default() - }, - ); - // Opens the tooltip over the top-left button (`Item16`, game slot 1, the Small - // Shield) through the hover's OnEnter path. `IsBagOpen` names the backpack's - // window, as the twelve `ContainerFrame`s are recycled across containers. - if let Err(e) = script.run( - "local i = IsBagOpen(0)\n\ - if i then\n\ - local button = getglobal(\"ContainerFrame\"..i..\"Item16\")\n\ - ContainerFrameItemButton_OnEnter(button)\n\ - end", - ) { - warn!("capture: ui-tooltip seed failed to open the tooltip: {e}"); - } + }); + script.set_inventory_slots(inv); + script.set_item_set( + 161, + benilla_ui::script::ItemSetView { + name: "Defias Leather".into(), + members: vec![ + (6303, Some("Defias Mark".into())), + (6304, Some("Defias Belt".into())), + (6305, Some("Defias Gloves".into())), + (6306, Some("Defias Trousers".into())), + (6307, Some("Defias Boots".into())), + ], + bonuses: vec![ + (2, "Increases movement speed slightly.".into()), + ( + 4, + "Immune to Defias Pillager and Defias Looter spells.".into(), + ), + ], + ..Default::default() + }, + ); + // Opens the tooltip over the top-left button (`Item16`, game slot 1, the Small + // Shield) through the hover's OnEnter path. `IsBagOpen` names the backpack's + // window, as the twelve `ContainerFrame`s are recycled across containers. + if let Err(e) = script.run( + "local i = IsBagOpen(0)\n\ + if i then\n\ + local button = getglobal(\"ContainerFrame\"..i..\"Item16\")\n\ + ContainerFrameItemButton_OnEnter(button)\n\ + end", + ) { + warn!("capture: ui-tooltip seed failed to open the tooltip: {e}"); + } + })); } UiFixture::TooltipWorld => { - let Some(script) = script else { - return; - }; - // A PvP-flagged friendly guard under the cursor, pushed as the mouseover feed does, - // then the call `drive_mouseover_tooltip` makes. The subject is the placement, the - // `GameTooltip_SetDefaultAnchor` corner (`GameTooltip.lua:73-77`). - script.set_unit( - "mouseover", - Some(benilla_ui::script::UnitState { - exists: true, - // A unit is found by its guid; the builder hides for guid 0 (`0x52a04e`). - guid: 0xF130_0000_0044_0001, - name: Some("Stormwind Guard".into()), - health: 38, - max_health: 50, - level: 25, - reaction: 5, - creature_type_name: Some("Humanoid".into()), - // The faction-name line, white, between level and PvP. - faction_name: Some("Stormwind".into()), - pvp: true, - ..Default::default() - }), - ); - if !script.world_tooltip_unit("mouseover") { - warn!("capture: ui-tooltip-world seed failed to open the tooltip"); - } + lua = Some(Box::new(move |script: &mut UiScript| { + // A PvP-flagged friendly guard under the cursor, pushed as the mouseover feed + // does, then the call `drive_mouseover_tooltip` makes. The subject is the + // placement, the `GameTooltip_SetDefaultAnchor` corner + // (`GameTooltip.lua:73-77`). + script.set_unit( + "mouseover", + Some(benilla_ui::script::UnitState { + exists: true, + // A unit is found by its guid; the builder hides for guid 0 + // (`0x52a04e`). + guid: 0xF130_0000_0044_0001, + name: Some("Stormwind Guard".into()), + health: 38, + max_health: 50, + level: 25, + reaction: 5, + creature_type_name: Some("Humanoid".into()), + // The faction-name line, white, between level and PvP. + faction_name: Some("Stormwind".into()), + pvp: true, + ..Default::default() + }), + ); + if !script.world_tooltip_unit("mouseover") { + warn!("capture: ui-tooltip-world seed failed to open the tooltip"); + } + })); } UiFixture::TooltipRank => { - let Some(script) = script else { - return; - }; - // A ranked player under the cursor, pushed as the mouseover feed does, then the - // call `drive_mouseover_tooltip` makes: the title is `0x609370`'s rank leg over the - // name, "Sergeant Bob". - script.set_unit( - "mouseover", - Some(benilla_ui::script::UnitState { - exists: true, - guid: 0x0000_0000_0000_0B0B, - is_player: true, - name: Some("Bob".into()), - level: 60, - reaction: 5, - pvp: true, - pvp_rank: 7, - pvp_team: 1, - sex: 2, - ..Default::default() - }), - ); - if !script.world_tooltip_unit("mouseover") { - warn!("capture: ui-tooltip-rank seed failed to open the tooltip"); - } + lua = Some(Box::new(move |script: &mut UiScript| { + // A ranked player under the cursor, pushed as the mouseover feed does, then the + // call `drive_mouseover_tooltip` makes: the title is `0x609370`'s rank leg over + // the name, "Sergeant Bob". + script.set_unit( + "mouseover", + Some(benilla_ui::script::UnitState { + exists: true, + guid: 0x0000_0000_0000_0B0B, + is_player: true, + name: Some("Bob".into()), + level: 60, + reaction: 5, + pvp: true, + pvp_rank: 7, + pvp_team: 1, + sex: 2, + ..Default::default() + }), + ); + if !script.world_tooltip_unit("mouseover") { + warn!("capture: ui-tooltip-rank seed failed to open the tooltip"); + } + })); } UiFixture::Character => { // A synthetic self player carrying the full stat block, which the `ui_char` feed @@ -1081,11 +1079,11 @@ pub(super) fn seed_ui_fixture( )); // The C binding's path; the feed pushes over the settle window. - if let Some(s) = script.as_mut() { + lua = Some(Box::new(move |s: &mut UiScript| { if let Err(e) = s.run("ToggleCharacter(\"PaperDollFrame\")") { warn!("capture: ui-char seed failed to open the window: {e}"); } - } + })); } UiFixture::VPlates => { use benilla_protocol::messages::ObjectFields; @@ -1146,122 +1144,123 @@ pub(super) fn seed_ui_fixture( )) .id(); // As the V binding does, so FrameXML's replay at `PLAYER_ENTERING_WORLD` agrees. - set_enemy_plates(script.as_deref(), true); - // The wolf is the target, so its plate draws lit with the target ring. + lua = Some(Box::new(|script: &mut UiScript| { + set_enemy_plates(Some(script), true) + })); + // The wolf is the target, so its plate draws lit with the target ring: indexed + // under its guid, the object the selection's tracker keeps, and lit as + // `SetSelection` lights its object (`0x493701`). + index.0.insert(WOLF_GUID, wolf); selection.target = Some(wolf); selection.guid = Some(WOLF_GUID); + selection.lit = Some(wolf); } UiFixture::Options => { - let Some(script) = script else { - return; - }; - // Opened through the live panel path, with Controls selected by its OnShow. - if let Err(e) = script.run("ShowUIPanel(BenillaOptionsFrame)") { - warn!("capture: ui-options seed failed to open the window: {e}"); - } + lua = Some(Box::new(move |script: &mut UiScript| { + // Opened through the live panel path, with Controls selected by its OnShow. + if let Err(e) = script.run("ShowUIPanel(BenillaOptionsFrame)") { + warn!("capture: ui-options seed failed to open the window: {e}"); + } + })); } UiFixture::OptionsAudio => { - let Some(script) = script else { - return; - }; - // The Audio page: the real CVar set first, so the rows read real values, then the - // live open and select paths. - script.register_cvars(crate::cvars::registered_pairs()); - if let Err(e) = script.run( - "ShowUIPanel(BenillaOptionsFrame); \ - BenillaOptionsFrameCategoryListRowAudio:Click()", - ) { - warn!("capture: ui-options-audio seed failed: {e}"); - } + lua = Some(Box::new(move |script: &mut UiScript| { + // The Audio page: the real CVar set first, so the rows read real values, then + // the live open and select paths. + script.register_cvars(crate::cvars::registered_pairs()); + if let Err(e) = script.run( + "ShowUIPanel(BenillaOptionsFrame); \ + BenillaOptionsFrameCategoryListRowAudio:Click()", + ) { + warn!("capture: ui-options-audio seed failed: {e}"); + } + })); } UiFixture::OptionsGraphics => { - let Some(script) = script else { - return; - }; - // The Graphics page, as the Audio fixture. - script.register_cvars(crate::cvars::registered_pairs()); - if let Err(e) = script.run( - "ShowUIPanel(BenillaOptionsFrame); \ - BenillaOptionsFrameCategoryListRowGraphics:Click()", - ) { - warn!("capture: ui-options-graphics seed failed: {e}"); - } + lua = Some(Box::new(move |script: &mut UiScript| { + // The Graphics page, as the Audio fixture. + script.register_cvars(crate::cvars::registered_pairs()); + if let Err(e) = script.run( + "ShowUIPanel(BenillaOptionsFrame); \ + BenillaOptionsFrameCategoryListRowGraphics:Click()", + ) { + warn!("capture: ui-options-graphics seed failed: {e}"); + } + })); } UiFixture::OptionsChat => { - let Some(script) = script else { - return; - }; - // The Chat page, as the Audio fixture. Its Remove Chat Hover Delay row reads a - // saved variable `ChatFrame.xml` declares, so it paints unchecked, the shipped "0". - script.register_cvars(crate::cvars::registered_pairs()); - if let Err(e) = script.run( - "ShowUIPanel(BenillaOptionsFrame); \ - BenillaOptionsFrameCategoryListRowChat:Click()", - ) { - warn!("capture: ui-options-chat seed failed: {e}"); - } + lua = Some(Box::new(move |script: &mut UiScript| { + // The Chat page, as the Audio fixture. Its Remove Chat Hover Delay row reads a + // saved variable `ChatFrame.xml` declares, so it paints unchecked, the shipped + // "0". + script.register_cvars(crate::cvars::registered_pairs()); + if let Err(e) = script.run( + "ShowUIPanel(BenillaOptionsFrame); \ + BenillaOptionsFrameCategoryListRowChat:Click()", + ) { + warn!("capture: ui-options-chat seed failed: {e}"); + } + })); } UiFixture::ColorPicker => { - let Some(script) = script else { - return; - }; - // An addon's usual opening: set the colour, ask for opacity, show the window. The - // colour puts both markers off their defaults, so a mirrored axis shows. - if let Err(e) = script.run( - "ColorPickerFrame.hasOpacity = 1; ColorPickerFrame.opacity = 0.3; \ - ColorPickerFrame:SetColorRGB(0.15, 0.55, 0.75); \ - ShowUIPanel(ColorPickerFrame)", - ) { - warn!("capture: ui-color-picker seed failed: {e}"); - } + lua = Some(Box::new(move |script: &mut UiScript| { + // An addon's usual opening: set the colour, ask for opacity, show the window. + // The colour puts both markers off their defaults, so a mirrored axis shows. + if let Err(e) = script.run( + "ColorPickerFrame.hasOpacity = 1; ColorPickerFrame.opacity = 0.3; \ + ColorPickerFrame:SetColorRGB(0.15, 0.55, 0.75); \ + ShowUIPanel(ColorPickerFrame)", + ) { + warn!("capture: ui-color-picker seed failed: {e}"); + } + })); } UiFixture::OptionsDropdownList => { - let Some(script) = script else { - return; - }; - // The Camera Following Style list open. Its width lands inside the opening click: - // `UIDropDownMenu_Refresh` sizes buttons from `normalText:GetWidth() + 60` - // (`UIDropDownMenu.lua:405`), which the engine answers in the same call. - script.register_cvars(crate::cvars::registered_pairs()); - if let Err(e) = script.run( - "ShowUIPanel(BenillaOptionsFrame); \ - BenillaOptionsFrameCategoryListRowControls:Click(); \ - BenillaOptionsFrameContainerBodyControlsRowCameraFollowStyleDropdownButton\ - :Click()", - ) { - warn!("capture: ui-options-dropdown seed failed: {e}"); - } + lua = Some(Box::new(move |script: &mut UiScript| { + // The Camera Following Style list open. Its width lands inside the opening + // click: `UIDropDownMenu_Refresh` sizes buttons from + // `normalText:GetWidth() + 60` (`UIDropDownMenu.lua:405`), which the engine + // answers in the same call. + script.register_cvars(crate::cvars::registered_pairs()); + if let Err(e) = script.run( + "ShowUIPanel(BenillaOptionsFrame); \ + BenillaOptionsFrameCategoryListRowControls:Click(); \ + BenillaOptionsFrameContainerBodyControlsRowCameraFollowStyleDropdownButton\ + :Click()", + ) { + warn!("capture: ui-options-dropdown seed failed: {e}"); + } + })); } UiFixture::KeyBindings => { - let Some(script) = script else { - return; - }; - // The Keybindings page over the commands the load registered: the real CVar set - // first, then the live open path, with Movement expanded to show a header row and - // the default bindings. - script.register_cvars(crate::cvars::registered_pairs()); - if let Err(e) = script.run( - "ShowUIPanel(BenillaOptionsFrame); \ - BenillaOptionsFrameCategoryListRowKeybindings:Click(); \ - BenillaKeyBindings_ExpandSection(1, true); BenillaKeyBindingsPage_Update()", - ) { - warn!("capture: ui-keybindings seed failed: {e}"); - } + lua = Some(Box::new(move |script: &mut UiScript| { + // The Keybindings page over the commands the load registered: the real CVar set + // first, then the live open path, with Movement expanded to show a header row + // and the default bindings. + script.register_cvars(crate::cvars::registered_pairs()); + if let Err(e) = script.run( + "ShowUIPanel(BenillaOptionsFrame); \ + BenillaOptionsFrameCategoryListRowKeybindings:Click(); \ + BenillaKeyBindings_ExpandSection(1, true); \ + BenillaKeyBindingsPage_Update()", + ) { + warn!("capture: ui-keybindings seed failed: {e}"); + } + })); } UiFixture::OptionsSearch => { - let Some(script) = script else { - return; - }; - // Mid-search: "volume" gathers the four volume sliders under the Audio head. The - // box is focused, so the caret shows at the text's end. - script.register_cvars(crate::cvars::registered_pairs()); - if let Err(e) = script.run( - "ShowUIPanel(BenillaOptionsFrame); \ - BenillaOptionsFrameSearchBox:SetText(\"volume\"); \ - BenillaOptionsFrameSearchBox:SetFocus()", - ) { - warn!("capture: ui-options-search seed failed: {e}"); - } + lua = Some(Box::new(move |script: &mut UiScript| { + // Mid-search: "volume" gathers the four volume sliders under the Audio head. + // The box is focused, so the caret shows at the text's end. + script.register_cvars(crate::cvars::registered_pairs()); + if let Err(e) = script.run( + "ShowUIPanel(BenillaOptionsFrame); \ + BenillaOptionsFrameSearchBox:SetText(\"volume\"); \ + BenillaOptionsFrameSearchBox:SetFocus()", + ) { + warn!("capture: ui-options-search seed failed: {e}"); + } + })); } UiFixture::SpellBook => { // A human warrior who also knows two cross-class spells. The book resolves through @@ -1292,9 +1291,6 @@ pub(super) fn seed_ui_fixture( let mut sword = template("Militia Shortsword", 2); sword.display_info_id = DISP_SWORD; items.insert_template(93_011, Some(sword)); - let Some(script) = script.as_mut() else { - return; - }; actions.spells.extend([ // The auto-attack shows the equipped sword's icon, not the placeholder of spell // 6603, in General (no skill line). @@ -1315,14 +1311,13 @@ pub(super) fn seed_ui_fixture( 9078, // Cloth proficiency ]); // The P binding's path; the feed pushes over the settle window. - if let Err(e) = script.run("ToggleSpellBook(BOOKTYPE_SPELL)") { - warn!("capture: ui-spellbook seed failed to open the book: {e}"); - } + lua = Some(Box::new(|script: &mut UiScript| { + if let Err(e) = script.run("ToggleSpellBook(BOOKTYPE_SPELL)") { + warn!("capture: ui-spellbook seed failed to open the book: {e}"); + } + })); } UiFixture::Macro | UiFixture::MacroPopup => { - let Some(script) = script.as_mut() else { - return; - }; // Made through the live `CreateMacro` path, so `UPDATE_MACROS` reaches the window // as a player's edit does; icons index `SpellIcon.dbc`. The bodies: a plain // `/cast`, a multi-line macro, and a `/script` line the bar's bound-spell resolve @@ -1351,118 +1346,112 @@ pub(super) fn seed_ui_fixture( if fixture == UiFixture::MacroPopup { seed.push_str("MacroEditButton:Click()\n"); } - if let Err(e) = script.run(&seed) { - warn!("capture: ui-macro seed failed: {e}"); - } + lua = Some(Box::new(move |script: &mut UiScript| { + if let Err(e) = script.run(&seed) { + warn!("capture: ui-macro seed failed: {e}"); + } + })); } UiFixture::Social => { // Nothing to seed: an empty friends list opens the same frames a full one does. - let Some(script) = script.as_mut() else { - return; - }; - if let Err(e) = script.run("ToggleFriendsFrame(1)") { - warn!("capture: ui-social seed failed to open the pane: {e}"); - } + lua = Some(Box::new(move |script: &mut UiScript| { + if let Err(e) = script.run("ToggleFriendsFrame(1)") { + warn!("capture: ui-social seed failed to open the pane: {e}"); + } + })); } UiFixture::ChatEdit => { - let Some(script) = script.as_mut() else { - return; - }; - // Say and yell lines behind the open edit box, opened through the live path; - // `chat_edit_live` then drives the header and the `15 + headerWidth` insets as - // in-game. - for (text, r, g, b) in [ - ("[One] says: testing the box", 1.0, 1.0, 1.0), - ("[One] says: a second line to stack", 1.0, 1.0, 1.0), - ("[One] yells: FUU", 1.0, 64.0 / 255.0, 64.0 / 255.0), - ] { - script.add_chat_message("ChatFrame1", text, r, g, b); - } - script.focus_editbox("ChatFrameEditBox"); - // A draft with "northshire" selected: the gray selection highlight (`0xFF606060`) - // under the glyphs and the caret at its end. The tab and window tint follow the - // cursor in `FCF_OnUpdate`, so a fixed-reveal OnUpdate pins them; it calls - // `PanelTemplates_TabResize` every frame until the label's measure lands. - if let Err(e) = script.run( - "ChatFrameEditBox:SetText(\"hello northshire\")\n\ - ChatFrameEditBox:HighlightText(6, 16)\n\ - ChatFrame1:SetScript('OnUpdate', function()\n\ - PanelTemplates_TabResize(10, ChatFrame1Tab)\n\ - ChatFrame1Tab:SetAlpha(1.0)\n\ - FCF_SetWindowAlpha(ChatFrame1, 0.25, 1)\n\ - end)", - ) { - warn!("capture: ui-chatedit seed failed: {e}"); - } + lua = Some(Box::new(move |script: &mut UiScript| { + // Say and yell lines behind the open edit box, opened through the live path; + // `chat_edit_live` then drives the header and the `15 + headerWidth` insets as + // in-game. + for (text, r, g, b) in [ + ("[One] says: testing the box", 1.0, 1.0, 1.0), + ("[One] says: a second line to stack", 1.0, 1.0, 1.0), + ("[One] yells: FUU", 1.0, 64.0 / 255.0, 64.0 / 255.0), + ] { + script.add_chat_message("ChatFrame1", text, r, g, b); + } + script.focus_editbox("ChatFrameEditBox"); + // A draft with "northshire" selected: the gray selection highlight + // (`0xFF606060`) under the glyphs and the caret at its end. The tab and window + // tint follow the cursor in `FCF_OnUpdate`, so a fixed-reveal OnUpdate pins + // them; it calls `PanelTemplates_TabResize` every frame until the label's + // measure lands. + if let Err(e) = script.run( + "ChatFrameEditBox:SetText(\"hello northshire\")\n\ + ChatFrameEditBox:HighlightText(6, 16)\n\ + ChatFrame1:SetScript('OnUpdate', function()\n\ + PanelTemplates_TabResize(10, ChatFrame1Tab)\n\ + ChatFrame1Tab:SetAlpha(1.0)\n\ + FCF_SetWindowAlpha(ChatFrame1, 0.25, 1)\n\ + end)", + ) { + warn!("capture: ui-chatedit seed failed: {e}"); + } + })); } UiFixture::ChatTabHover => { - let Some(script) = script.as_mut() else { - return; - }; - // Lines for content, the Combat Log selected, and the cursor on the General tab: an - // unselected tab's hover. A capture can hover, as the OS cursor only reaches the VM - // on a non-synthetic run, so a fed `mouse_move` stands. - for (text, r, g, b) in [ - ("[One] says: hello northshire", 1.0, 1.0, 1.0), - ("[One] says: a second line to stack", 1.0, 1.0, 1.0), - ] { - script.add_chat_message("ChatFrame1", text, r, g, b); - } - // `$WOW_TABHOVER` picks one of five dock states for an A/B: - // 1 (default) Combat Log selected, hovering General - // 3 General selected, hovering Combat Log - // 2 Combat Log selected, hovering Combat Log (the selected tab) - // 0 revealed, hovering neither tab (no glow) - // 9 cursor off the dock (bare scene, the baseline) - let mode = std::env::var("WOW_TABHOVER").unwrap_or_else(|_| "1".into()); - let select = if mode == "3" { 1 } else { 2 }; - if let Err(e) = script.run(&format!("FCF_SelectDockFrame(ChatFrame{select})")) { - warn!("capture: ui-chat-tabhover select failed: {e}"); - } - script.resolve(); - // Each in the root's units the cursor is fed in: the frame's own times its scale. - let expr = match mode.as_str() { - "2" | "3" => { - "local x, y = ChatFrame2Tab:GetCenter() \ - local k = ChatFrame2Tab:GetEffectiveScale() return x * k, y * k" + lua = Some(Box::new(move |script: &mut UiScript| { + // Lines for content, the Combat Log selected, and the cursor on the General + // tab: an unselected tab's hover. A capture can hover, as the OS cursor only + // reaches the VM on a non-synthetic run, so a fed `mouse_move` stands. + for (text, r, g, b) in [ + ("[One] says: hello northshire", 1.0, 1.0, 1.0), + ("[One] says: a second line to stack", 1.0, 1.0, 1.0), + ] { + script.add_chat_message("ChatFrame1", text, r, g, b); } - "0" => { - "local k = ChatFrame2:GetEffectiveScale() \ - return (ChatFrame2:GetLeft() + ChatFrame2:GetRight()) / 2 * k, \ - (ChatFrame2:GetBottom() + ChatFrame2:GetTop()) / 2 * k" + // `$WOW_TABHOVER` picks one of five dock states for an A/B: + // 1 (default) Combat Log selected, hovering General + // 3 General selected, hovering Combat Log + // 2 Combat Log selected, hovering Combat Log (the selected tab) + // 0 revealed, hovering neither tab (no glow) + // 9 cursor off the dock (bare scene, the baseline) + let mode = std::env::var("WOW_TABHOVER").unwrap_or_else(|_| "1".into()); + let select = if mode == "3" { 1 } else { 2 }; + if let Err(e) = script.run(&format!("FCF_SelectDockFrame(ChatFrame{select})")) { + warn!("capture: ui-chat-tabhover select failed: {e}"); } - // 9: park far away, so the dock conceals itself. - "9" => "return 2000, 2000", - _ => { - "local x, y = ChatFrame1Tab:GetCenter() \ - local k = ChatFrame1Tab:GetEffectiveScale() return x * k, y * k" - } - }; - let centre: Result<(f32, f32), _> = script.eval(expr); - match centre { - Ok((x, y)) => { - script.mouse_move(x, y); - // Settle the reveal ramp without waiting on the app's own frames. - for _ in 0..40 { - if let Err(e) = script.run("FCF_OnUpdate(0.05)") { - warn!("capture: ui-chat-tabhover pump failed: {e}"); - break; - } - script.resolve(); + script.resolve(); + // Each in the root's units the cursor is fed in: the frame's own times its + // scale. + let expr = match mode.as_str() { + "2" | "3" => { + "local x, y = ChatFrame2Tab:GetCenter() \ + local k = ChatFrame2Tab:GetEffectiveScale() return x * k, y * k" } + "0" => { + "local k = ChatFrame2:GetEffectiveScale() \ + return (ChatFrame2:GetLeft() + ChatFrame2:GetRight()) / 2 * k, \ + (ChatFrame2:GetBottom() + ChatFrame2:GetTop()) / 2 * k" + } + // 9: park far away, so the dock conceals itself. + "9" => "return 2000, 2000", + _ => { + "local x, y = ChatFrame1Tab:GetCenter() \ + local k = ChatFrame1Tab:GetEffectiveScale() return x * k, y * k" + } + }; + let centre: Result<(f32, f32), _> = script.eval(expr); + match centre { + Ok((x, y)) => { + script.mouse_move(x, y); + // Settle the reveal ramp without waiting on the app's own frames. + for _ in 0..40 { + if let Err(e) = script.run("FCF_OnUpdate(0.05)") { + warn!("capture: ui-chat-tabhover pump failed: {e}"); + break; + } + script.resolve(); + } + } + Err(e) => warn!("capture: ui-chat-tabhover centre failed: {e}"), } - Err(e) => warn!("capture: ui-chat-tabhover centre failed: {e}"), - } + })); } UiFixture::NameWater => { use benilla_protocol::messages::ObjectFields; - // The subject is an NPC's overhead name, and `UnitNameNPC` defaults to "0"; set - // through Lua as a player would, so the sync drains it into `NameConfig`. - if let Some(script) = script.as_deref_mut() { - if let Err(e) = script.run("SetCVar(\"UnitNameNPC\", \"1\")") { - warn!("capture: name fixture could not enable UnitNameNPC: {e}"); - } - } // The self player at the eye; the name colour is its reaction to the wolf. const SELF_GUID: u64 = 0x51; names.insert_player(SELF_GUID, "Benilla".into(), None); @@ -1513,8 +1502,16 @@ pub(super) fn seed_ui_fixture( }, Visibility::default(), )); - // A plated unit draws no floating name, so enemy plates go off. - set_enemy_plates(script.as_deref(), false); + lua = Some(Box::new(|script: &mut UiScript| { + // The subject is an NPC's overhead name, and `UnitNameNPC` defaults to "0"; + // set through Lua as a player would, so the sync drains it into + // `NameConfig`. + if let Err(e) = script.run("SetCVar(\"UnitNameNPC\", \"1\")") { + warn!("capture: name fixture could not enable UnitNameNPC: {e}"); + } + // A plated unit draws no floating name, so enemy plates go off. + set_enemy_plates(Some(script), false); + })); } UiFixture::NameRank => { use benilla_protocol::messages::ObjectFields; @@ -1559,7 +1556,9 @@ pub(super) fn seed_ui_fixture( Visibility::default(), )); // A plated unit draws no floating name, so enemy plates go off. - set_enemy_plates(script.as_deref(), false); + lua = Some(Box::new(|script: &mut UiScript| { + set_enemy_plates(Some(script), false) + })); } // The lighting matrix: one spawn with a streamed entity's component set, anonymous and // with plates off, so no glyph rides over the body. @@ -1603,10 +1602,19 @@ pub(super) fn seed_ui_fixture( )); } } - set_enemy_plates(script.as_deref(), false); + lua = Some(Box::new(|script: &mut UiScript| { + set_enemy_plates(Some(script), false) + })); } } - }) + }); + if let Some(lua) = lua { + vm.run(|script| { + if let Some(script) = script { + lua(script); + } + }); + } } /// The `GetTime()` the cooldown filmstrip pins the VM's session clock at, seconds. Large, as @@ -1639,6 +1647,7 @@ fn seed_cooldown_filmstrip( slots.insert( slot, benilla_ui::script::ContainerSlot { + uncached_link: None, use_fork: Default::default(), item_class: None, petition: None, @@ -1704,6 +1713,7 @@ fn seed_bag_window( }; let slot = |disp: u32, count: u32, id: u32, name: &str, quality: u32| { benilla_ui::script::ContainerSlot { + uncached_link: None, use_fork: Default::default(), item_class: None, petition: None, @@ -1803,6 +1813,7 @@ fn seed_equipped_bags( }; let slot = |disp: u32, count: u32, name: &str, quality: u32| benilla_ui::script::ContainerSlot { + uncached_link: None, use_fork: Default::default(), item_class: None, petition: None, diff --git a/crates/benilla-app/src/capture/probe_auction.rs b/crates/benilla-app/src/capture/probe_auction.rs index 94972fdc7..8dbdf71ca 100644 --- a/crates/benilla-app/src/capture/probe_auction.rs +++ b/crates/benilla-app/src/capture/probe_auction.rs @@ -366,15 +366,17 @@ fn error_name(error: u32) -> &'static str { fn auction_probe( time: ProbeClock, mut probe: ResMut, - auction: Res, - mut hosted_vm: crate::script_calls::HostedVm, + mut vm: crate::script_calls::VmWith>, self_player: Query<&ObjectStore, With>, player: Res, units: Query<(&Guid, &NetEntity, &ObjectStore, &Transform), Without>, net: Res, mut exit: MessageWriter, ) { - hosted_vm.run(|script| { + // The house as this frame found it: the verbs the probe's Lua calls apply in the call, through + // the host, which holds the house while it does. + let auction = vm.own().clone(); + vm.run(|script| { let Ok(store) = self_player.single() else { return; // not in-world yet }; diff --git a/crates/benilla-app/src/capture/probe_bank.rs b/crates/benilla-app/src/capture/probe_bank.rs index d4f17d6cd..69eff2e45 100644 --- a/crates/benilla-app/src/capture/probe_bank.rs +++ b/crates/benilla-app/src/capture/probe_bank.rs @@ -156,9 +156,8 @@ fn find_bank_slot(store: &ObjectStore, guid: u64) -> Option { fn bank_probe( time: ProbeClock, mut probe: ResMut, - open: Res, prices: Option>, - mut hosted_vm: crate::script_calls::HostedVm, + mut hosted_vm: crate::script_calls::VmWith>, self_player: Query<(), With>, self_store: Query<&ObjectStore, With>, player: Res, @@ -166,6 +165,7 @@ fn bank_probe( net: Res, mut exit: MessageWriter, ) { + let bank_open = hosted_vm.own().is_open(); hosted_vm.run(|script| { if self_player.is_empty() { return; // not in-world yet @@ -241,7 +241,7 @@ fn bank_probe( } } Phase::Activating { sent_at } => { - if open.is_open() { + if bank_open { info!( "PROBE_BANK: PASS (2 activate) — BankOpen is_open (SMSG_SHOW_BANK \ landed)" diff --git a/crates/benilla-app/src/capture/probe_binder.rs b/crates/benilla-app/src/capture/probe_binder.rs index 54ca9fe69..43da750b6 100644 --- a/crates/benilla-app/src/capture/probe_binder.rs +++ b/crates/benilla-app/src/capture/probe_binder.rs @@ -179,21 +179,39 @@ fn vm_bind_location(script: &UiScript) -> String { .unwrap_or_default() } +/// The gossip menu as the step reads it, taken outside the VM: the gossip verbs write the state +/// in the host, which the step's Lua runs with. +struct Menu { + npc: Option, + options: Vec, +} + +impl Menu { + fn of(gossip: &GossipState) -> Self { + Menu { + npc: gossip.npc, + options: gossip.options.clone(), + } + } +} + fn binder_probe( time: ProbeClock, mut probe: ResMut, - gossip: Res, binder: Res, mut home: ResMut, areas: Option>, - mut hosted_vm: crate::script_calls::HostedVm, + // The gossip slots, read outside the VM: the gossip verbs write them in the host. + mut vm: crate::script_calls::VmWith>, self_player: Query<(), With>, player: Res, units: Query<(&Guid, &NetEntity, &ObjectStore, &Transform), Without>, net: Res, mut exit: MessageWriter, ) { - hosted_vm.run(|script| { + // The step's Lua runs with the host lent, so the calls it makes apply inside their verbs. + let gossip = Menu::of(&vm.own()); + vm.run(|script| { if self_player.is_empty() { return; // not in-world yet } @@ -436,7 +454,7 @@ fn binder_probe( /// Steps 3 and 4: the bind row's icon, then the click. Sets `probe.phase` on every path. fn assert_icon_and_select( probe: &mut BinderProbe, - gossip: &GossipState, + gossip: &Menu, script: &UiScript, net: &NetCommands, innkeeper: u64, @@ -515,6 +533,7 @@ fn assert_icon_and_select( let _ = net.0.send(ClientCommand::GossipSelectOption { guid: innkeeper, option: opt.index, + code: None, }); info!( "PROBE_BINDER: (4 select) GossipSelectOption({innkeeper:#x}, wire index {}) sent for {:?}", diff --git a/crates/benilla-app/src/capture/probe_book.rs b/crates/benilla-app/src/capture/probe_book.rs index b42349dd7..5886e1201 100644 --- a/crates/benilla-app/src/capture/probe_book.rs +++ b/crates/benilla-app/src/capture/probe_book.rs @@ -214,7 +214,10 @@ fn book_probe( net: Res, mut exit: MessageWriter, ) { - vm.turn(|script, mut reader| { + // The step's Lua runs with the host lent, so the calls it makes apply inside their verbs; the + // reader opens outside it, once it has run. + let mut open_pages = None; + vm.run(|script| { if self_player.is_empty() { return; // not in-world yet } @@ -286,7 +289,7 @@ fn book_probe( "PROBE_BOOK: opening the reader on {guid:#x} (the right-click's own \ route — `ItemTextOpen::read_pages`)" ); - reader.read_pages(guid); + open_pages = Some(guid); probe.phase = Phase::WaitReady { since: now }; } } @@ -342,5 +345,8 @@ fn book_probe( }); } } - }) + }); + if let Some(guid) = open_pages { + vm.own().read_pages(guid); + } } diff --git a/crates/benilla-app/src/capture/probe_charter.rs b/crates/benilla-app/src/capture/probe_charter.rs index f2a78a375..e863b9fc3 100644 --- a/crates/benilla-app/src/capture/probe_charter.rs +++ b/crates/benilla-app/src/capture/probe_charter.rs @@ -323,21 +323,45 @@ fn probe_guild_name(prefix: &str) -> String { format!("{prefix} {secs:08}") } +/// The gossip menu as the step reads it, taken outside the VM: the gossip verbs write the state +/// in the host, which the step's Lua runs with. +struct Menu { + npc: Option, + options: Vec, +} + +impl Menu { + fn of(gossip: &GossipState) -> Self { + Menu { + npc: gossip.npc, + options: gossip.options.clone(), + } + } +} + fn charter_probe( time: ProbeClock, mut probe: ResMut, - gossip: Res, - registrar: Res, objects: Objects, items: Res, - mut hosted_vm: crate::script_calls::HostedVm, + // The gossip slots and the registrar's, read outside the VM: their verbs write them in the + // host. + mut vm: crate::script_calls::VmWith<( + Res<'static, GossipState>, + Res<'static, GuildRegistrarState>, + )>, self_q: Query<&ObjectStore, With>, player: Res, units: Query<(&Guid, &NetEntity, &ObjectStore, &Transform), Without>, net: Res, mut exit: MessageWriter, ) { - hosted_vm.run(|script| { + // The step's Lua runs with the host lent, so the calls it makes apply inside their verbs. + let (gossip, registrar_npc) = { + let (gossip, registrar) = vm.own(); + (Menu::of(&gossip), registrar.npc()) + }; + vm.run(|script| { let Ok(store) = self_q.single() else { return; // not in-world yet }; @@ -540,7 +564,7 @@ fn charter_probe( probe.phase = Phase::Done; return; }; - let parked = registrar.npc() == Some(npc); + let parked = registrar_npc == Some(npc); let visible = vm_visible(script, "GuildRegistrarFrame"); let cost = vm_charter_cost(script); if parked && visible && cost == CHARTER_COST_COPPER { @@ -592,7 +616,7 @@ fn charter_probe( An SMSG_PETITION_SHOWLIST with no parse arm at all \ falls through to ServerPacket::Other — that is what this reading looks \ like. Lines seen: {:?}", - registrar.npc(), + registrar_npc, probe_lines(script) ), ); @@ -1067,7 +1091,7 @@ fn hop(probe: &mut CharterProbe, net: &NetCommands, now: f64) { /// select by the row's wire index, never its list position. Sets `probe.phase` on every path. fn assert_icon_and_select( probe: &mut CharterProbe, - gossip: &GossipState, + gossip: &Menu, script: &UiScript, net: &NetCommands, npc: u64, @@ -1165,6 +1189,7 @@ fn assert_icon_and_select( let _ = net.0.send(ClientCommand::GossipSelectOption { guid: npc, option: opt.index, + code: None, }); info!( "PROBE_CHARTER: 4 (registrar) GossipSelectOption({npc:#x}, wire index {}) sent for {:?}", diff --git a/crates/benilla-app/src/capture/probe_chest.rs b/crates/benilla-app/src/capture/probe_chest.rs index e33b96741..13d716565 100644 --- a/crates/benilla-app/src/capture/probe_chest.rs +++ b/crates/benilla-app/src/capture/probe_chest.rs @@ -125,7 +125,20 @@ fn target() -> [f32; 4] { } /// Whether `LootFrame` is shown (after `LOOT_OPENED`), else the app-side loot session. -fn window_open(script: &UiScript, loot: &LootState) -> bool { +/// The loot window's source as the step reads it, taken outside the VM: the loot verbs write the +/// state in the host, which the step's Lua runs with. +struct LootView(Option); + +impl LootView { + fn source(&self) -> Option { + self.0 + } +} + +/// The loot latch's guid ([`LootLatch`]), taken as [`LootView`] is. +struct LatchView(Option); + +fn window_open(script: &UiScript, loot: &LootView) -> bool { script .eval::("return LootFrame:IsShown() and 1 or nil") .unwrap_or_else(|_| loot.source().is_some()) @@ -178,7 +191,12 @@ fn chest_probe( net: Res, mut exit: MessageWriter, ) { - vm.turn(|script, (loot, latch)| { + // The step's Lua runs with the host lent, so the calls it makes apply inside their verbs. + let (loot, latch) = { + let (loot, latch) = vm.own(); + (LootView(loot.source()), LatchView(latch.0)) + }; + vm.run(|script| { let Ok(driver) = self_q.single() else { return; // not in-world yet }; diff --git a/crates/benilla-app/src/capture/probe_clam.rs b/crates/benilla-app/src/capture/probe_clam.rs index c2a726a32..129cc1655 100644 --- a/crates/benilla-app/src/capture/probe_clam.rs +++ b/crates/benilla-app/src/capture/probe_clam.rs @@ -54,7 +54,16 @@ pub(crate) struct ProbeClamPlugin; impl Plugin for ProbeClamPlugin { fn build(&self, app: &mut App) { app.init_resource::() - .add_systems(Update, clam_probe); + .add_systems(Update, (hold_auto_loot_off, clam_probe).chain()); + } +} + +/// The window must survive to be looked at: with auto-loot on, the single row is taken at the open +/// edge and the last-row auto-release shuts it again immediately. Its own system, as the VM's call +/// host reads the config the probe writes. +fn hold_auto_loot_off(mut cfg: ResMut) { + if cfg.auto_loot { + cfg.auto_loot = false; } } @@ -143,7 +152,20 @@ fn slot_grey(script: &UiScript, slot: u32) -> bool { /// Whether the live `LootFrame` is shown, which needs `LOOT_OPENED` to have fired; falls back to /// the app-side session when the frame cannot be read. -fn window_open(script: &UiScript, loot: &LootState) -> bool { +/// The loot window's source as the step reads it, taken outside the VM: the loot verbs write the +/// state in the host, which the step's Lua runs with. +struct LootView(Option); + +impl LootView { + fn source(&self) -> Option { + self.0 + } +} + +/// The loot latch's guid ([`LootLatch`]), taken as [`LootView`] is. +struct LatchView(Option); + +fn window_open(script: &UiScript, loot: &LootView) -> bool { script .eval::("return LootFrame:IsShown() and 1 or nil") .unwrap_or_else(|_| loot.source().is_some()) @@ -182,11 +204,15 @@ fn clam_probe( self_store: Query<&ObjectStore, With>, objects: Objects, items: Res, - mut cfg: ResMut, net: Res, mut exit: MessageWriter, ) { - vm.turn(|script, (loot, latch)| { + // The step's Lua runs with the host lent, so the calls it makes apply inside their verbs. + let (loot, latch) = { + let (loot, latch) = vm.own(); + (LootView(loot.source()), LatchView(latch.0)) + }; + vm.run(|script| { let Ok(store) = self_store.single() else { return; // not in-world yet }; @@ -198,9 +224,6 @@ fn clam_probe( match probe.phase { Phase::Wait => { - // The window must survive to be looked at: with auto-loot on, the single row is - // taken at the open edge and the last-row auto-release shuts it again immediately. - cfg.auto_loot = false; info!( "PROBE_CLAM: stocking one openable item (entry {entry}) — auto-loot forced off" ); diff --git a/crates/benilla-app/src/capture/probe_crossing.rs b/crates/benilla-app/src/capture/probe_crossing.rs index 031646d85..39cb10f16 100644 --- a/crates/benilla-app/src/capture/probe_crossing.rs +++ b/crates/benilla-app/src/capture/probe_crossing.rs @@ -148,7 +148,7 @@ fn crossing_probe( continue; } let sample = transport.sample_at(anchor, map); - if sample.map != map || sample.moving { + if sample.map != map || sample.moving() { continue; } // Only a nearby ferry: after a cross-continent `.go` the departed surroundings' @@ -214,7 +214,7 @@ fn crossing_probe( transports.iter().find(|(g, ..)| g.0 == boat) { let sample = transport.sample_at(anchor, map); - if sample.map == to_map && !sample.moving { + if sample.map == to_map && !sample.moving() { info!( "PROBE crossing: SUCCESS — docked on map {to_map} still aboard {boat:#x}" ); diff --git a/crates/benilla-app/src/capture/probe_guard_poi.rs b/crates/benilla-app/src/capture/probe_guard_poi.rs index e4e707c2c..4080b6733 100644 --- a/crates/benilla-app/src/capture/probe_guard_poi.rs +++ b/crates/benilla-app/src/capture/probe_guard_poi.rs @@ -133,6 +133,7 @@ fn guard_poi_probe( let _ = net.0.send(ClientCommand::GossipSelectOption { guid: guard, option, + code: None, }); probe.phase = Phase::Asked { sent_at: now }; } else if now - sent_at > 8.0 { diff --git a/crates/benilla-app/src/capture/probe_mail.rs b/crates/benilla-app/src/capture/probe_mail.rs index 41de4a1f6..1a94f3ad0 100644 --- a/crates/benilla-app/src/capture/probe_mail.rs +++ b/crates/benilla-app/src/capture/probe_mail.rs @@ -140,20 +140,41 @@ enum Phase { Done, } +/// The inbox as the step reads it, taken outside the VM: the mail verbs write the session in the +/// host, which the step's Lua runs with. +struct Inbox { + mails: Vec, + /// The bodies the rows' `item_text_id`s have, as the cache holds them. + bodies: std::collections::HashMap, +} + +impl Inbox { + fn of(mail: &MailOpen) -> Self { + Inbox { + mails: mail.mails.clone(), + bodies: mail + .mails + .iter() + .filter_map(|e| Some((e.item_text_id, mail.bodies.get(e.item_text_id)?.clone()))) + .collect(), + } + } +} + /// The first row matching `pred`, by its stable `message_id`. -fn find_by(mail: &MailOpen, pred: impl Fn(&MailListEntry) -> bool) -> Option { +fn find_by(mail: &Inbox, pred: impl Fn(&MailListEntry) -> bool) -> Option { mail.mails.iter().find(|e| pred(e)).map(|e| e.message_id) } /// The 1-based display index a `message_id` currently sits at, `None` once it is gone. -fn index_of(mail: &MailOpen, mail_id: u32) -> Option { +fn index_of(mail: &Inbox, mail_id: u32) -> Option { mail.mails .iter() .position(|e| e.message_id == mail_id) .map(|i| i as u32 + 1) } -fn entry_of(mail: &MailOpen, mail_id: u32) -> Option<&MailListEntry> { +fn entry_of(mail: &Inbox, mail_id: u32) -> Option<&MailListEntry> { mail.mails.iter().find(|e| e.message_id == mail_id) } @@ -174,16 +195,19 @@ fn last_event(script: &UiScript) -> String { fn mail_probe( time: ProbeClock, mut probe: ResMut, - mail: Res, mut windows: Commands, - mut hosted_vm: crate::script_calls::HostedVm, + // The session is the call host's too ([`crate::ui_mail::MailVerbs`]), so it is read outside + // the VM. + mut vm: crate::script_calls::VmWith>, self_player: Query<(), With>, player: Res, objects: Query<(&Guid, &NetEntity, &ObjectStore, &Transform), Without>, net: Res, mut exit: MessageWriter, ) { - hosted_vm.run(|script| { + // The step's Lua runs with the host lent, so the calls it makes apply inside their verbs. + let mail = Inbox::of(&vm.own()); + vm.run(|script| { if self_player.is_empty() { return; // not in-world yet } @@ -355,7 +379,7 @@ fn mail_probe( }; let landed = entry_of(&mail, letter_id).and_then(|e| { (e.item_text_id != 0) - .then(|| mail.bodies.get(e.item_text_id).cloned()) + .then(|| mail.bodies.get(&e.item_text_id).cloned()) .flatten() .map(|body| (body, e.checked & CHECKED_READ != 0)) }); diff --git a/crates/benilla-app/src/capture/probe_partner.rs b/crates/benilla-app/src/capture/probe_partner.rs index a221e8359..7570d0885 100644 --- a/crates/benilla-app/src/capture/probe_partner.rs +++ b/crates/benilla-app/src/capture/probe_partner.rs @@ -16,8 +16,9 @@ impl Plugin for ProbePartnerPlugin { } } -/// Accept a pending invite the frame it lands; taking `pending_invite` keeps the invite popup -/// from arming, and a racing `DeclineGroup` is a no-op once grouped (`GroupHandler.cpp:200`). +/// Accept each invite the frame it lands, by the inviter [`GroupState::pending_invite`] keeps for +/// this probe. The invite popup still shows, and a `DeclineGroup` it sends later is a no-op once +/// grouped (`GroupHandler.cpp:200`). fn partner_probe( self_player: Query<(), With>, mut group: ResMut, diff --git a/crates/benilla-app/src/capture/probe_service.rs b/crates/benilla-app/src/capture/probe_service.rs index 6fac8f1b6..e25123821 100644 --- a/crates/benilla-app/src/capture/probe_service.rs +++ b/crates/benilla-app/src/capture/probe_service.rs @@ -281,13 +281,18 @@ fn open_window( None } +/// The NPC windows' cells the probe reads, lent with the VM since the host holds them. +type ServiceWindows = ( + ResMut<'static, MerchantOpen>, + ResMut<'static, GossipState>, + ResMut<'static, QuestGiver>, + ResMut<'static, TrainerOpen>, +); + fn service_probe( - mut vm: crate::script_calls::VmWith>, + mut vm: crate::script_calls::VmWith, time: ProbeClock, mut probe: ResMut, - mut gossip: ResMut, - mut giver: ResMut, - mut trainer: ResMut, // `[0xb4e2d0]`'s mirror, what the re-click gate reads: armed by a window and only by one. interact: Res, objects: crate::net::Objects, @@ -300,12 +305,16 @@ fn service_probe( ) { // The cursor legs pick up through the binding and read the bags through Lua, with the host // lent so a call that Lua makes applies inside its verb; the rest is an engine turn over the - // merchant window. + // merchant, gossip and questgiver windows. let lent = matches!( probe.phase, Phase::VendorArm { .. } | Phase::VendorSell { .. } ); - let mut step = |script: Option<&mut UiScript>, mut merchant: Option<&mut MerchantOpen>| { + let mut step = |script: Option<&mut UiScript>, + mut merchant: Option<&mut MerchantOpen>, + mut gossip: Option<&mut GossipState>, + mut giver: Option<&mut QuestGiver>, + mut trainer: Option<&mut TrainerOpen>| { if self_player.is_empty() { return; // not in-world yet } @@ -316,6 +325,13 @@ fn service_probe( hop(&mut probe, &net, 0, 0, now); } Phase::Hop { i, hop: h, sent_at } => { + let (Some(gossip), Some(giver), Some(trainer)) = ( + gossip.as_deref_mut(), + giver.as_deref_mut(), + trainer.as_deref_mut(), + ) else { + return; + }; if now - sent_at < SETTLE_SECS { return; } @@ -454,6 +470,15 @@ fn service_probe( let _ = net.0.send(cmd); named } + // `TalkToTrainer`'s asked guid (`0x5df69f`), which the list's open tests, and + // its send; no trainer is open here for its close. + ServiceAction::TalkToTrainer => { + trainer.asked = guid; + let cmd = ClientCommand::TrainerList { trainer: guid }; + let named = format!("{cmd:?}"); + let _ = net.0.send(cmd); + named + } // No leg here takes a dialog arm; if one ever does, say so rather than hang. other => { let why: &str = match other { @@ -463,9 +488,9 @@ fn service_probe( "adopts the area spirit healer; the packet leaves from the cache" } ServiceAction::Silent(w) => w, - ServiceAction::Send(_) | ServiceAction::SellFromCursor(_) => { - unreachable!() - } + ServiceAction::Send(_) + | ServiceAction::SellFromCursor(_) + | ServiceAction::TalkToTrainer => unreachable!(), }; warn!( "PROBE_SERVICE: SKIP ({}) — arm {arm:?} opens no window from a packet \ @@ -490,8 +515,15 @@ fn service_probe( }; } Phase::Await { i, since, guid } => { + let (Some(gossip), Some(giver), Some(trainer)) = ( + gossip.as_deref_mut(), + giver.as_deref_mut(), + trainer.as_deref_mut(), + ) else { + return; + }; let leg = &LEGS[i]; - match open_window(guid, &gossip, &giver, &trainer) { + match open_window(guid, gossip, giver, trainer) { Some(open) if open == leg.want_window => { info!( "PROBE_SERVICE: PASS ({}) — {:?} window open on {guid:#x}{}", @@ -576,6 +608,13 @@ fn service_probe( } // ── The vendor fork ────────────────────────────────────────────────── Phase::VendorHop { sent_at } => { + let (Some(gossip), Some(giver), Some(trainer)) = ( + gossip.as_deref_mut(), + giver.as_deref_mut(), + trainer.as_deref_mut(), + ) else { + return; + }; if now - sent_at < SETTLE_SECS { return; } @@ -807,9 +846,19 @@ fn service_probe( } }; if lent { - vm.run(|script| step(script, None)); + vm.run(|script| step(script, None, None, None, None)); } else { - vm.turn(|script, mut merchant| step(script, Some(&mut *merchant))); + vm.turn( + |script, (mut merchant, mut gossip, mut giver, mut trainer)| { + step( + script, + Some(&mut *merchant), + Some(&mut *gossip), + Some(&mut *giver), + Some(&mut *trainer), + ) + }, + ); } } diff --git a/crates/benilla-app/src/capture/probe_vendor_swap.rs b/crates/benilla-app/src/capture/probe_vendor_swap.rs index bb9d819e0..d580cdd5d 100644 --- a/crates/benilla-app/src/capture/probe_vendor_swap.rs +++ b/crates/benilla-app/src/capture/probe_vendor_swap.rs @@ -142,8 +142,7 @@ fn clear_log(script: &UiScript) { fn vendor_swap_probe( time: ProbeClock, mut probe: ResMut, - merchant: Res, - mut hosted_vm: crate::script_calls::HostedVm, + mut hosted_vm: crate::script_calls::VmWith>, names: Res, panes: Res, images: Res, @@ -153,6 +152,8 @@ fn vendor_swap_probe( net: Res, mut exit: MessageWriter, ) { + // The cell as the frame found it; a call inside the run below writes it through the host. + let vendor = hosted_vm.own().vendor; hosted_vm.run(|script| { if self_player.is_empty() { return; // not in-world yet @@ -235,7 +236,7 @@ fn vendor_swap_probe( .resolve_unit(brog, None, Ask::Read) .unwrap_or("") .to_string(); - match (merchant.vendor == Some(brog), first_show(script)) { + match (vendor == Some(brog), first_show(script)) { (true, Some((npc, title))) => { if npc == expect && title == expect { info!( @@ -256,7 +257,7 @@ fn vendor_swap_probe( error!( "PROBE_VENDOR_SWAP: open FAIL — no merchant window + MERCHANT_SHOW on \ Brog within {WINDOW_TIMEOUT_SECS}s (vendor = {:?})", - merchant.vendor + vendor ); probe.fails += 1; probe.phase = Phase::Done; @@ -296,7 +297,7 @@ fn vendor_swap_probe( .resolve_unit(dobbins, None, Ask::Read) .unwrap_or("") .to_string(); - match (merchant.vendor == Some(dobbins), first_show(script)) { + match (vendor == Some(dobbins), first_show(script)) { (true, Some((npc, title))) => { if npc == expect && title == expect { info!( @@ -317,7 +318,7 @@ fn vendor_swap_probe( error!( "PROBE_VENDOR_SWAP: swap FAIL — no window swap + MERCHANT_SHOW on \ Dobbins within {WINDOW_TIMEOUT_SECS}s (vendor = {:?})", - merchant.vendor + vendor ); probe.fails += 1; probe.phase = Phase::Done; @@ -357,7 +358,7 @@ fn vendor_swap_probe( } Phase::Clear { since, closed_at } => { match closed_at { - None if merchant.vendor.is_none() => { + None if vendor.is_none() => { probe.phase = Phase::Clear { since, closed_at: Some(now), @@ -367,7 +368,7 @@ fn vendor_swap_probe( error!( "PROBE_VENDOR_SWAP: clear FAIL — the session never cleared after \ HideUIPanel (vendor = {:?})", - merchant.vendor + vendor ); probe.fails += 1; probe.phase = Phase::Done; diff --git a/crates/benilla-app/src/capture/probes/lift_census.rs b/crates/benilla-app/src/capture/probes/lift_census.rs index dcdefe9e0..409e2d249 100644 --- a/crates/benilla-app/src/capture/probes/lift_census.rs +++ b/crates/benilla-app/src/capture/probes/lift_census.rs @@ -134,7 +134,7 @@ fn fire_lift_census( net.display_id.unwrap_or(0), transport.map_or(0, Transport::period_ms), cycle.map_or_else(|| "-".into(), |c| c.to_string()), - sample.map_or(0, |s| u8::from(s.moving)), + sample.map_or(0, |s| u8::from(s.moving())), vis.map_or_else(|| "absent".into(), |v| format!("{v:?}")), inherited.map_or(0, |i| u8::from(i.get())), u8::from(attached), diff --git a/crates/benilla-app/src/capture/probes/reveal.rs b/crates/benilla-app/src/capture/probes/reveal.rs index a9e3b31e3..d9ee8f44b 100644 --- a/crates/benilla-app/src/capture/probes/reveal.rs +++ b/crates/benilla-app/src/capture/probes/reveal.rs @@ -2,7 +2,15 @@ //! worldport), naming every term that decides whether the destination is drawn. Residency columns //! (`res`, `focus`, `scene`, `place`, `coll`, `merge`, `gx`) are the terms behind //! [`WorldLoadProgress::presentable`], which the cover waits on; draw columns (`drawn`, `hid`, -//! `sel`, `room`, `win`, `pvslag`) are what the frame put on screen. +//! `sel`, `room`, `win`, `pvslag`) are what the frame put on screen, and `pres` the frames the +//! window has presented since the snap ([`crate::loading_screen::hold::Presents`]). +//! +//! At the settle release one `REVEAL_SUM` line closes the window from the snap to residency: +//! `frames`, the frames it took; `presented`, how many the window presented (counted at the +//! release frame, so the release frame's own present is not in it); and `drawn` and `wmo`, the +//! submeshes and retained-pass WMOs that came on screen after the first frame shown, the sum of +//! each shown frame's growth over the last one shown (a frame +//! [`crate::loading_screen::hold::PresentHold`] holds is not shown). //! //! Runs in `Last`: visibility, the exterior-scene gate and the retained pass settle in //! `PostUpdate`, so an `Update` line would report them a frame late. @@ -22,6 +30,20 @@ struct RevealAudit { n: Option, /// [`ProbeClock`] seconds at the arming snap, the base of the `t=` column. since: f32, + /// The snap-to-residency window's tally, `None` once its summary is printed. + window: Option, +} + +/// One snap's tally up to the settle release, for the `REVEAL_SUM` line. +struct RevealWindow { + /// [`crate::loading_screen::hold::Presents`] at the snap. + presents_at_snap: u64, + frames: u32, + /// Submeshes and WMOs drawn in the last frame shown, the baseline for growth. + last_drawn: Option<(usize, usize)>, + /// What came on screen in frames shown. + drawn_grew: usize, + wmo_grew: usize, } pub(crate) struct RevealAuditPlugin; @@ -36,6 +58,7 @@ impl Plugin for RevealAuditPlugin { frames, n: None, since: 0.0, + window: None, }) // `Last`: after residency, the loading screen and `PostUpdate`'s visibility. .add_systems(Last, drive_reveal_audit); @@ -51,22 +74,33 @@ fn drive_reveal_audit( census: WorldCensus, cam: Query<&GlobalTransform, With>, time: ProbeClock, + presents: Option>, + hold: Option>, mut teleports: MessageReader, mut worldports: MessageReader, ) { let now = time.elapsed_secs(); + let presented = presents + .as_deref() + .map_or(0, crate::loading_screen::hold::Presents::count); if teleports.read().next().is_some() || worldports.read().next().is_some() { audit.n = Some(0); audit.since = now; + audit.window = Some(RevealWindow { + presents_at_snap: presented, + frames: 0, + last_drawn: None, + drawn_grew: 0, + wmo_grew: 0, + }); } - let Some(n) = audit.n else { - return; - }; - if n >= audit.frames { - audit.n = None; + // The per-frame lines run for `frames` after the snap; the summary's tally runs to the release. + let in_window = audit.n.is_some_and(|n| n < audit.frames); + let n = audit.n.unwrap_or(0); + audit.n = in_window.then_some(n + 1); + if !in_window && audit.window.is_none() { return; } - audit.n = Some(n + 1); let (collected, published, selected) = gx .as_deref() @@ -75,6 +109,39 @@ fn drive_reveal_audit( .as_deref() .map_or((0, 0, 0), benilla_world::static_gx::StaticGx::draw_census); let seen = census.take(); + let settling = player.as_ref().is_some_and(|p| p.settling); + let since = audit.since; + if let Some(w) = audit.window.as_mut() { + w.frames += 1; + // A held frame never reaches the window, so what it drew is not on screen. + if !hold + .as_deref() + .is_some_and(crate::loading_screen::hold::PresentHold::held) + { + let shown = (seen.drawn, wmo_drawn); + if let Some((d, g)) = w.last_drawn { + w.drawn_grew += shown.0.saturating_sub(d); + w.wmo_grew += shown.1.saturating_sub(g); + } + w.last_drawn = Some(shown); + } + // A snap the stream already holds releases on its own frame: `frames=1`. + if !settling { + info!( + "REVEAL_SUM frames={} t={:.0}ms presented={} drawn={} wmo={} cover={}", + w.frames, + (now - since) * 1000.0, + presented - w.presents_at_snap, + w.drawn_grew, + w.wmo_grew, + u8::from(screen.covering()), + ); + audit.window = None; + } + } + if !in_window { + return; + } // Distance from the visibility authority's eye to the drawn camera: ~0 in steady play. let pvs_lag = match (seen.pvs_eye, cam.iter().next()) { (Some(eye), Some(now_eye)) => eye.distance(now_eye.translation()), @@ -82,7 +149,7 @@ fn drive_reveal_audit( }; info!( "REVEAL n={n} t={:.0}ms cover={} res={}/{} focus={} scene={} place={} coll={} merge={} \ - gx={} wmo={collected}/{published}/{selected} settling={} | drawn={}/{} hid={}/{} \ + gx={} wmo={collected}/{published}/{selected} settling={} pres={} | drawn={}/{} hid={}/{} \ sel={cells_drawn}/{wmo_drawn}/{groups_drawn} room={} win={} pvslag={pvs_lag:.0}", (now - audit.since) * 1000.0, u8::from(screen.covering()), @@ -94,7 +161,11 @@ fn drive_reveal_audit( progress.colliders_pending, progress.merge_pending, progress.gx_pending, - u8::from(player.is_some_and(|p| p.settling)), + u8::from(settling), + audit + .window + .as_ref() + .map_or(0, |w| presented - w.presents_at_snap), seen.drawn, seen.submeshes, seen.hidden, diff --git a/crates/benilla-app/src/chat_bubble.rs b/crates/benilla-app/src/chat_bubble.rs index 5838f928e..a66ead169 100644 --- a/crates/benilla-app/src/chat_bubble.rs +++ b/crates/benilla-app/src/chat_bubble.rs @@ -9,7 +9,8 @@ //! 20 yd (3-D). Self is not excluded. A new line replaces the old bubble, never queues. //! - Lifetime and fade (`0x4b0c30`): a 250 ms fade in, the line's [`duration_ms`], a 250 ms fade //! out, then the frame goes back to the pool. Out of range, or with the speaker not drawn in the -//! last render ([`speaker_drawn`]), it fades out and hides, and fades back in on return. +//! last render ([`crate::entities::SceneDrawn`]), it fades out and hides, and fades back in on +//! return. //! - Anchor (`0x4b0c30`): unit z + height × model scale + 0.7, the text's BOTTOM on the projected //! point (`0x4b157a`), growing upward. The height is the Stand sequence box's Z extent from the //! model header (`0x711a20`), not the posed attachment the overhead name reads (`0x608640`), @@ -312,22 +313,6 @@ struct Bubble { depth: Option, } -/// Whether the speaker was drawn in the last render: the reference's scene-node test `0x6704c0` -/// (`node && [node+0x94] == 0`, read at `0x4b0cab`). Every frame sets `[node+0x94]` on every node -/// in the scene list `[0xca7d70]` (`0x698a07`) and clears it only for a node that passes the -/// frustum test `0x682ef0` and the horizon test `0x686000` (`0x6833dd`-`0x6833ec`, and -/// `0x68359b`-`0x6835aa` in WMO groups). Here it is any of the unit's meshes passing last frame's -/// visibility check; benilla has no horizon cull yet, so that is the frustum verdict alone. -fn speaker_drawn( - unit: Entity, - children: &Query<&Children>, - meshes: &Query<&ViewVisibility, With>, -) -> bool { - children - .get(unit) - .is_ok_and(|kids| kids.iter().any(|c| meshes.get(c).is_ok_and(|v| v.get()))) -} - /// The live bubbles by speaker guid, at most one per unit, their stacking, and the next line's /// number. #[derive(Resource, Default)] @@ -419,8 +404,8 @@ fn drive_bubbles( time: Res