From 86b70728c7e313599c073b6b88f2a2f36cefb923 Mon Sep 17 00:00:00 2001 From: P0nk Date: Sat, 3 Apr 2021 15:39:04 +0200 Subject: [PATCH 1/2] Fix Zombie Mushroom Signal 3 --- scripts/quest/2251.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/quest/2251.js b/scripts/quest/2251.js index 3de79f99d4..55f1143a59 100644 --- a/scripts/quest/2251.js +++ b/scripts/quest/2251.js @@ -1,4 +1,4 @@ --/* +/* Author: Kevin Quest: Zombie Mushroom Signal 3 (2251) NPC: The Rememberer (1061011) From a36c7c5057868bae6cb73cb6b7e6aec2df947478 Mon Sep 17 00:00:00 2001 From: P0nk Date: Sat, 3 Apr 2021 15:52:07 +0200 Subject: [PATCH 2/2] Fix loading pet ignores slowly Explained by me on Discord, 20 February 2020: "Found a bug that causes characters to load slower based on the number of items in their inventory. Every item causes a query to be executed in the db. On my local machine, the specific section of code is now ~40ms faster when loading 1 character full of items. Here is what I'm referring to: "AND petid IS NOT NULL" should be "AND petid > 0" or something similar Basically, the petid field is not a boolean. The check will always pass since -1 is not null, and the number -1 is used to indicate if the item is a pet or not." --- src/main/java/client/MapleCharacter.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/client/MapleCharacter.java b/src/main/java/client/MapleCharacter.java index 479450066d..081640b84b 100644 --- a/src/main/java/client/MapleCharacter.java +++ b/src/main/java/client/MapleCharacter.java @@ -7223,14 +7223,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject { PreparedStatement ps2, ps3; ResultSet rs2, rs3; - ps3 = con.prepareStatement("SELECT petid FROM inventoryitems WHERE characterid = ? AND petid IS NOT NULL"); + ps3 = con.prepareStatement("SELECT petid FROM inventoryitems WHERE characterid = ? AND petid > -1"); ps3.setInt(1, charid); rs3 = ps3.executeQuery(); - while(rs3.next()) { - int petId = rs3.getInt("petid"); - if (rs3.wasNull()) { - petId = -1; - } + while (rs3.next()) { + final int petId = rs3.getInt("petid"); ps2 = con.prepareStatement("SELECT itemid FROM petignores WHERE petid = ?"); ps2.setInt(1, petId);