Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bestiary in Lua #4402

Merged
merged 12 commits into from
Apr 19, 2023
Merged

Bestiary in Lua #4402

merged 12 commits into from
Apr 19, 2023

Conversation

MillhioreBT
Copy link
Contributor

Pull Request Prelude

  • I have followed [proper The Forgotten Server code styling][code].
  • I have read and understood the [contribution guidelines][cont] before making this PR.
  • I am aware that this PR may be closed if the above-mentioned criteria are not fulfilled.

Changes Proposed

These changes are inspired by the PR linked as Based.
Basically, this PR adds the possibility of partially enabling the bestiary system, more information needs to be added, but this is a good starting point.

The MonsterType function now also accepts a raceId to obtain the MonsterType linked to that raceId.
New function Game.getBestiary() that returns a table with other tables containing name and list of MonsterTypes, both compatible with the Lua # operator.
Compatible with Revscript.

Based: #4356

@MillhioreBT MillhioreBT added the feature New feature or functionality label Apr 12, 2023
Copy link
Contributor

@EPuncker EPuncker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add an example for xml entry too

config.lua.dist Outdated Show resolved Hide resolved
@omarcopires
Copy link
Contributor

After killing some Dragon Lords using bestiaryPointsPerKill = 100 the client is crashing and returning the following console error:

Lua Script Error: [Event Interface]
data/events/scripts/player.lua:Player@onNetworkMessage
LuaScriptInterface::getNumber(). Argument 2 has out-of-range value for unsigned char: 512
stack traceback:
        ...os Git\forgottenserver\data\scripts\network\bestiary.lua:156: in function 'handler'
        data/events/scripts/player.lua:358: in function <data/events/scripts/player.lua:351>

Lua Script Error: [Event Interface]
data/events/scripts/player.lua:Player@onNetworkMessage
LuaScriptInterface::getNumber(). Argument 2 has out-of-range value for unsigned short: -10
stack traceback:
        ...os Git\forgottenserver\data\scripts\network\bestiary.lua:157: in function 'handler'
        data/events/scripts/player.lua:358: in function <data/events/scripts/player.lua:351>

@MillhioreBT
Copy link
Contributor Author

MillhioreBT commented Apr 13, 2023

Oops sorry, I forgot not all elements are counted here, I'll fix this in a bit, thanks for reminding me <3

@omarcopires
Copy link
Contributor

omarcopires commented Apr 14, 2023

Okay, no errors were returned in any of the bestiary steps and no crash occurred to me.

image

However I encountered a problem when killing a monster in a party:

Lua Script Error: [Scripts Interface]
D:\Repositorios Git\forgottenserver\data\scripts\creaturescripts\bestiary_kills.lua:callback
...enserver\data\scripts\creaturescripts\bestiary_kills.lua:18: attempt to perform arithmetic on local 'killers' (a table value)
stack traceback:
        ...enserver\data\scripts\creaturescripts\bestiary_kills.lua:18: in function 'getKillersForBestiary'
        ...enserver\data\scripts\creaturescripts\bestiary_kills.lua:38: in function <...enserver\data\scripts\creaturescripts\bestiary_kills.lua:27>

@omarcopires
Copy link
Contributor

omarcopires commented Apr 14, 2023

  • All bestiary steps work as I expect;
  • The description works as expected;
  • bestiaryPointsPerKill works as expected;
  • bestiaryPartyKillSharing works as expected in both scenarios.

On the client side everything is as it should, I believe it can be merged as it is. If there is no change suggested by any staff member.

Thanks Arthur and Sarah for the content.

omarcopires
omarcopires previously approved these changes Apr 14, 2023
EPuncker
EPuncker previously approved these changes Apr 14, 2023
config.lua.dist Outdated Show resolved Hide resolved
data/lib/core/player.lua Outdated Show resolved Hide resolved
@MillhioreBT MillhioreBT dismissed stale reviews from EPuncker and omarcopires via 7053282 April 14, 2023 19:14
EPuncker
EPuncker previously approved these changes Apr 14, 2023
@MillhioreBT
Copy link
Contributor Author

MillhioreBT commented Apr 16, 2023

The points will no longer be counted twice for those who inflict damage to the monsters and are in the same group.
The behavior without sharing in the party was also fixed, which basically means giving the point to everyone who participated in the monster's death.

@EPuncker EPuncker merged commit ec3eb0e into otland:master Apr 19, 2023
@MillhioreBT MillhioreBT deleted the bestiary branch May 31, 2023 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants