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

The problem with the attributes of the character in the 3.1 update #102

Open
Muderru opened this issue Aug 30, 2019 · 6 comments
Open

The problem with the attributes of the character in the 3.1 update #102

Muderru opened this issue Aug 30, 2019 · 6 comments
Labels
bug Something isn't working

Comments

@Muderru
Copy link

Muderru commented Aug 30, 2019

Character attributes do not change from wearing items. For example, I wear a +2 armor vest and my character has armor still 0.

@shawncplus
Copy link
Member

Gonna need some more detail. When you say "do not change" what are you referring to? Effects modifiers aren't working, applying damage/healing isn't lowering them, computed attributes aren't calculating correctly?

@Muderru
Copy link
Author

Muderru commented Aug 30, 2019

Yes, computed attributes aren't calculating correctly. For example, I wear a +2 armor vest and my character has armor still 0.

@Muderru
Copy link
Author

Muderru commented Sep 1, 2019

A bit of additional information about the bug.
When I wear a vest for the first time, the command “score” shows +2 armor. Then I restart the server and enter the character on which the vest is worn. The command “score” shows armor 0. After that, removing and putting on a vest does not have any effect on the character’s armor. The “score” command shows armor 0. Similarly with other attributes.

@Muderru
Copy link
Author

Muderru commented Sep 1, 2019

In other words, equipped items after stopping the server lose the ability to modify the attributes of the character. If you just exit the game, then the properties of the items are saved and they behave normally. In general, all this is very strange and confusing.

@Muderru
Copy link
Author

Muderru commented Sep 1, 2019

I thought it could be important, I use code from the instancing branch.

@shawncplus shawncplus added the bug Something isn't working label Sep 9, 2019
@ratacat
Copy link
Contributor

ratacat commented Sep 11, 2019

I think maybe I partially figured this out @Muderru & @shawncplus. After you equip an item for the first time, that equip effect becomes active on your character. If you restart the server, it's reloading your character from JSON, effects get serialized and stored in JSON. For some reason, the this.state.stats of the equip effect becomes empty, I'm not sure why. Maybe something to do with a shallow copy?

Unless you specifically set the equip effect's persist config to false, you start to see certain instances where the effect remains, even when the item is gone. When that combines with empty this.state.stats object happening, you get to a place where your character doesn't get any attributes applied to them from objects equipped in that slot, because when the new effect tries to get applied, the old one is already there with the same id, making it seem like the attributes aren't being applied.

Best I can tell, once I set the persist config in the equip effect to false, problem goes away, because the equip effects don't get serialized, and the rebuilt ones on login take hold. Seems to do the trick here...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants