otland / forgottenserver

A free and open-source MMORPG server emulator written in C++
https://otland.net
GNU General Public License v2.0
1.55k stars 1.04k forks source link

fix issues with house invites string cases #4753

Open unclecellphone opened 3 weeks ago

unclecellphone commented 3 weeks ago

Pull Request Prelude

Changes Proposed

  1. Do not use toLower() on player inputs for House, Subowner, and Door invite list, it will break for guilds and/or guild ranks with uppercase letters.
  2. Fix an issue where parseList(...) did not properly parse strings for guild rank (off-by-1 error in substring math)
  3. Additionally, to prevent issues like this in the future, compare guild names and ranks ignoring case.

Issues addressed:

The code in TFS does not ignore case for guild invites, but it does force toLower() on inputs, so any guilds with uppercase letters in the name, or ranks with uppercase letters in the name, will not work via @guildName or guildName@rank invites, subowners, or for door control.

Note that this is okay on some versions, including master, for guild names. Guild names in fact will function on master here, but guild RANKS are still compared by string comparison across the board. However, I think forcing both to be toLower() is much more readable in both scenarios, despite the fact that it is only fixing a bug for the ranks not the guild names.

example

aleta sio -->

@guildName  
guildName@guildRank
guildName@guildrank
  1. first line would work on most systems, although it would previously have done toLower() for no real reason
  2. second line would be broken because of the capital R in guild Rank
  3. third line would also be broken, because of the bug in the substring math