otland / forgottenserver

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

weapons.h breaks weapons.xml #4265

Closed uberlerd closed 5 months ago

uberlerd commented 1 year ago

I'm running TFS 1.5 (latest) and after the update this week it appears that the behavior in weapons.xml has switched from explicitly allowing vocations to use weaponry to disallowing the specified vocation(s) from using that weaponry.

For example, the wand of vortex allows sorcerers to use it per the weapons.xml, however the sorcerer is now the only vocation that cannot use this wand.

<wand id="2190" level="7" mana="2" min="8" max="18" type="energy"> <!-- Wand of Vortex -->
    <vocation name="Sorcerer" />
</wand>

Expected behavior

The vocation name(s) listed per item in weapons.xml explicitly allow only those specified vocation(s) to use it.

Actual behavior

The vocation name(s) not listed per item in weapons.xml explicitly allow only those not specified vocation(s) to use it.

Confirmation

I confirmed this bug by changing the allowed vocation to Knight, and then knight was the only vocation incapable of using the wand of vortex.

Resolution

Changing the following line in weapons.h from "!=" return !vocationWeaponSet.empty() && vocationWeaponSet.find(vocationId) != vocationWeaponSet.end();

to "==" return !vocationWeaponSet.empty() && vocationWeaponSet.find(vocationId) == vocationWeaponSet.end();

and building the docker from the modified sources resolves this issue.

EPuncker commented 1 year ago

https://github.com/otland/forgottenserver/pull/4262