LandSandBoat / server

:sailboat: LandSandBoat - a server emulator for Final Fantasy XI
https://landsandboat.github.io/server/
GNU General Public License v3.0
291 stars 579 forks source link

🐛 Map.exe Crash - Fishing - Trumpet Shell #4099

Open CactuarXI opened 1 year ago

CactuarXI commented 1 year ago

I affirm:

OS / platform the server is running (if known)

Windows 10

Branch affected by issue

base LandSandBoat

Steps to reproduce

Map.exe crashes when attempting to fish up "Trumpet Shell". Currently unknown if any other fish are affected by this issue.

Steps I took to isolate this issue:

image

Info for quick reference. Trumpet Shell has a fishing_fish.sql entry.

INSERT INTO `fishing_fish` VALUES (5466,'Trumpet Shell',63,18,10,5,1,1,99,0,0,255,255,0,0,0,1,3,0,0,0,1,550,0,'',0,0,0,0);

Trumpet Shell currently has 4 existing entries in fishing_bait_affinity.sql

INSERT INTO `fishing_bait_affinity` VALUES (17002,5466,1); -- Trumpet Shell, Robber Rig, Power 1
INSERT INTO `fishing_bait_affinity` VALUES (16997,5466,2); -- Trumpet Shell, Crayfish Ball, Power 2
INSERT INTO `fishing_bait_affinity` VALUES (17398,5466,1); -- Trumpet Shell, Rogue Rig, Power 1
INSERT INTO `fishing_bait_affinity` VALUES (17400,5466,2); -- Trumpet Shell, Sinking Minnow, Power 2

Expected behavior

Map.exe should not crash. You should either get a bite or get a "You do not catch anything" message.

CactuarXI commented 1 year ago

New info: Replacing Trumpet Shells fishing_fish.sql entry with the stats from moat carp results in no crash when fishing up the Trumpet Shell. Likely something wrong in this entry.

CactuarXI commented 1 year ago

Further info:

Changing Trumpet Shell's 'ranking' in fishing_fish.sql to not be 99 caused the game to not crash.

CactuarXI commented 1 year ago

fishingutils.cpp

```void LoadFishItems()
{
    const char* Query = "SELECT "
                        "distinct "
                        "ff.fishid, "           // 0
                        "ff.name, "             // 1
                        "ff.skill_level, "      // 2
                        "ff.difficulty, "       // 3
                        "ff.base_delay, "       // 4
                        "ff.base_move, "        // 5
                        "ff.min_length, "       // 6
                        "ff.max_length, "       // 7
                        "ff.size_type, "        // 8
                        "ff.water_type, "       // 9
                        "ff.log, "              // 10
                        "ff.quest, "            // 11
                        "ff.flags, "            // 12
                        "ff.legendary, "        // 13
                        "ff.legendary_flags, "  // 14
                        "ff.item, "             // 15
                        "ff.max_hook, "         // 16
                        "ff.rarity, "           // 17
                        "ff.required_keyitem, " // 18
                        "ff.required_catches, " // 19
                        "ff.quest_status, "     // 20
                        "ff.quest_only, "       // 21
                        "ff.ranking, "          // 22
                        "ff.contest "
                        "FROM fishing_fish ff "
                        "WHERE ff.disabled = 0 and ff.ranking < 99";```

"WHERE ff.disabled = 0 and ff.ranking < 99"; 99 is out of range and possibly not pulling a value?

Could change to "WHERE ff.disabled = 0 and ff.ranking <= 99";` to solve the crash or set and current fish with a ranking of 99 to 98 or less. I'm not sure what the rankings should be so that's outside the scope of this.

CactuarXI commented 1 year ago

Adding onto this issue related to above.

"WHERE ff.disabled = 0 and ff.ranking < 99";

Fish that are disabled in fishing_fish.sql will cause a map.exe crash if a player tries to fish within a fishing group that contains them as a possible catch.