From 4c98a8d981af25db1df718d35be48b1d0b6e34e0 Mon Sep 17 00:00:00 2001 From: badmagick329 <63713349+badmagick329@users.noreply.github.com> Date: Fri, 16 Oct 2026 11:25:22 +0100 Subject: [PATCH] GetTradeSkillNumMade answers 1, 1 on a header or past the rows (#1459) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `GetTradeSkillNumMade` answered 0, 0 for a header row or an index past the rows. 1.12.1's `GetTradeSkillNumMade` (`0x4fdc50`) sends a bad index, a header (spell -1, `0x4fdcaa`) and a missing spell record to the fallback at `0x4fdd13`, which pushes 1 twice. A recipe with no spell record never becomes a row in benilla, so the past-the-rows case covers it. The miss now answers 1, 1. Tests: the header, no-window and past-the-rows cases pin 1, 1. Fixes #1262 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 5.5 (cherry picked from commit 129b3bb852b2f328de529f3c698595c14baf5fa5) --- crates/benilla-ui/src/script/tradeskill/api.rs | 3 ++- crates/benilla-ui/src/script/tradeskill/tests.rs | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/crates/benilla-ui/src/script/tradeskill/api.rs b/crates/benilla-ui/src/script/tradeskill/api.rs index cbe03f04..242d7c68 100644 --- a/crates/benilla-ui/src/script/tradeskill/api.rs +++ b/crates/benilla-ui/src/script/tradeskill/api.rs @@ -252,12 +252,13 @@ pub(in crate::script) fn install(lua: &Lua) -> mlua::Result<()> { })?, )?; + // GetTradeSkillNumMade(index) (`0x4fdc50`): 1, 1 on a header or past the rows (`0x4fdd13`). g.set( "GetTradeSkillNumMade", lua.create_function(|lua, index: usize| { let model = lua.app_data_ref::().expect("model app_data"); let (min_made, max_made) = - recipe_at(&model, index).map_or((0, 0), |r| (r.min_made, r.max_made)); + recipe_at(&model, index).map_or((1, 1), |r| (r.min_made, r.max_made)); Ok(MultiValue::from_vec(vec![ Value::Integer(i64::from(min_made)), Value::Integer(i64::from(max_made)), diff --git a/crates/benilla-ui/src/script/tradeskill/tests.rs b/crates/benilla-ui/src/script/tradeskill/tests.rs index 779761a3..5be58cc0 100644 --- a/crates/benilla-ui/src/script/tradeskill/tests.rs +++ b/crates/benilla-ui/src/script/tradeskill/tests.rs @@ -235,10 +235,16 @@ fn do_trade_skill_and_getters_no_op_on_a_header_index() { assert!(s .eval::("return GetTradeSkillIcon(1) == nil") .unwrap()); + // But the made counts, which answer 1, 1 on a header and past the last row (`0x4fdd13`). assert_eq!( s.eval::<(i64, i64)>("return GetTradeSkillNumMade(1)") .unwrap(), - (0, 0) + (1, 1) + ); + assert_eq!( + s.eval::<(i64, i64)>("return GetTradeSkillNumMade(99)") + .unwrap(), + (1, 1) ); assert!(s .eval::("return GetTradeSkillCooldown(1) == nil") @@ -488,7 +494,7 @@ fn no_snapshot_shapes_unknown_line_and_nil_info() { assert_eq!( s.eval::<(i64, i64)>("return GetTradeSkillNumMade(1)") .unwrap(), - (0, 0) + (1, 1) ); assert!(s .eval::("return GetTradeSkillCooldown(1) == nil")