addItem audit

What has been done in this MR?

Went over all uses of addItem() in the code base and replaced them with addItemOrDrop() or with explicit inventory-space checks if they looked like they might be unsafe.

  • Fixed weeding farming patches with a full inventory getting rid of weeds rather than dropping them. (source is OSRS, but it's better than literally nothing: https://www.reddit.com/r/2007scape/comments/rfjruh/when_you_rake_a_farming_patch_with_a_full/?rdt=47685) -> greg found a source showing that weeds getting lost is 2009-authentic
  • Fixed a bug where getting a proc of the fishing skillcape effect caused loss of the extra fish if you only had 1 free inventory slot.
  • Fixed getting scammed by the fighter torso guy if you didn't have a free inventory slot (i.e. you had more than the required minimum amount of coins on you).
  • Fixed getting scammed by Zaff if you didn't have a free inventory slot. Closes #2036 (closed)
  • Fixed various unimportant potential inventory-full-related issues, mostly during quests.

In addition:

  • Cleaned up various unused imports that I happened to run across on my quest.
  • Fixed typos when getting a reward from the Grain of Plenty and when talking to Roavar.
  • Fixed Professor Henry addressing you as player_name rather than as Player Name.
  • Completely refactored ScorpionCatcherUseListener.kt to resolve code duplication and to use more contentapi.

Things I deliberately left alone:

  • I didn't touch cases where there were explicit inventory-space checks already provided for. I mostly didn't touch patterns of the type if (removeItem(...)) addItem(...) if removeItem was guaranteed to be an unstackable item.
  • Did not touch this issue in CatOnArdougneCivilian.kt because Greg is already fixing it in the plague city MR.
  • Did not touch this issue in Plague City (BravekDialogue, AlrenaDialogue) because I know Greg is auditing that whole thing anyway so I trust that it'll come up in testing there if it's actually an issue.

What should testers check?

Test the below things especially with full inventories.

  • Ideally, go over the entire code base and confirm that I didn't miss any, but I know that's an unreasonable thing to ask
  • Fur trading interface continues to work (a couple of item 10095, lots of item 995, npc 554)
  • Making a crystal key continues to work (items 985 987)
  • Making an oily fishing rod continues to work (items 1582 307)
  • Making blamish snail slime continues to work (items 3363 3377 233, use pestle and mortar on the snail)
  • Making scarecrows continues to work (items 6058 5982)
  • Filling buckets with sand continues to work (item 1925 scenery 2645)
  • Collecting tree sap continues to work (item 1925, item 946, scenery 1276, use knife on tree; I have no clue what this is used for)
  • Blessing spirit shields continues to work (items 13754 13734, scenery 36972)
  • Ecto refill continues to work (item 4251)
  • Enchant tabs continue to work (items 1656 8016)
  • Sheep-shearing continues to work (item 1735)
  • Scooping up flour and cornflour continues to work (items 1947 5986, then go to a mill)
  • Crafting anything silver continues to work (items 2355 1599, scenery 36956)
  • Raking weeds with a full inv drops the weeds on the floor (item 5341)
  • Getting a fishing skillcape proc when you're on your last free inventory slot drops the extra fish on the floor (item 9798)
  • Charging orbs continues to work (::runekit, item 567, scenery 2152)
  • Taking eggs out of the incubator continues to work (item 11964, please actually go to the incubator and don't spawn in the scenery because I seem to recall that this matters)
  • Buying a fighter torso continues to work, unless your inv is full in which case the dude doesn't scam (npc 5030)
  • Obtaining the dusty key continues to work (npc 798, just talk to him and pick the first option)
  • Making darklight continues to work (items 2402 4622)
  • Buying beer from the Khazard barman continues to work (tele 2566 3143, spawning the npc doesn't work because the coding of this quest is shit)
  • Plucking chompy birds continues to work (npc 1016)
  • Finding the elemental workshop book continues to work (scenery 26613, setqueststage 52 0), as does slashing it with a knife (946) after you've read the book
  • Finding needles and leather in Elemental Workshop crates 3400 and 3394 continues to work. Needs attributes /save:ew1:got_needle and /save:ew1:got_leather set to false
  • Peeling the address label in Tribal Totem works. Setqueststage 126 19. Spawn object 2708 and "Investigate" it.
  • Getting the totem in Tribal Totem works. ::object 2710
  • At ::setattribute /save:tutorial:stage 54, the combat instructor 944 correctly gives you stuff
  • At ::setattribute /save:tutorial:stage 70, the magic instructor 946 correctly gives you stuff
  • At ::setattribute /save:tutorial:stage 19, the cooking instructor 942 correctly gives you stuff (relog to get your chatbox back)
  • At ::setattribute /save:tutorial:stage 35, the mining instructor 948 correctly gives you stuff (relog to get your chatbox back)
  • The tutorial island furnace (object 3044) continues to smelt copper 436 and tin 438 into a bronze bar
  • Zaff 546 no longer scams you if your inventory is too full to carry any bstaves, and doesn't incorrectly reduce his stock in this case
  • Buying Moonlight Mead from Roavar 1042 continues to work
  • Getting food rotten by ghasts continues to work (e.g. item 385; I do note that the ghasts seem to have some pathfinding troubles, and I'm unsure if this may need allowaggro true. If they don't seem to engage with you, just keep trying!)
  • Getting pouches 2958 taken from you by ghasts continues to work
  • Using item 2968 while standing at e.g. 3434 3364 0 continues to give you a used spell
  • Getting another bloom spell from Filiman Tarlock 1050 (wear item 552) continues to work. Needs nature spirit 95 set to stage 35
  • Make sure you correctly receive items during Frem Trials:
    • ::setattribute sigmund-steps 6. ::item 3702. Talk to npc 1281.
    • ::setattribute sigmund-returning true. ::setqueststage 64 99. Drop Sigli's bowstring or any other of Sigmund's quest items if you have any. Talk to npc 1282.
    • ::item 3703, talk to npc 1303
    • ::item 3705, talk to npc 1283
    • ::item 3706, talk to npc 1289
    • ::item 3708, talk to npc 1301
    • Make the cherry bomb; items 590 and 3713
  • Make sure Scorpion Catcher works:
    • ::setqueststage 108 1. ::npc 389. Talk to him, he gives you a cage.
    • Give yourself 3 of each of items 457, 458, 459. Then spawn the scorpions - npc 385, 386, 387 - spawning six each. Use all 3 cages on all 3 scorpions each. Then use all three of those filled scorpion cages on the six scorpions each.
  • Give yourself ::item 12626. ::setplayerstrong 2. Talk to npc 7143. Note also that he calls you Player Name rather than player_name.
  • I have tested these changes thoroughly.
  • I used the relevant Zaros tool for any JSON edits where possible, and have attached screenshots of any changes.
Edited by Player Name

Merge request reports

Loading