ZhengPeiRu21 / mod-challenge-modes

Challenge Modes Module for AzerothCore
MIT License
40 stars 40 forks source link

Reset on logout #12

Closed dkapte closed 1 year ago

dkapte commented 1 year ago

I have tested the new commit (2022-12-08) and thank you for changing the talent reward. The talents are now added during gameplay but in my guess because of the follow in Player.cpp, the talents are resetted to the default talenPointsForLevel once you logout and login once again. I have tried to work around the resetTalents(true) method but i can't seem to figure out how to avoid this as a overflow is noticed in my worldserver console output when trying to avoid the resetTalents method.

void Player::InitTalentForLevel()
{
    uint32 talentPointsForLevel = CalculateTalentsPoints();

    // xinef: more talent points that we have are used, reset
    if (m_usedTalentCount > talentPointsForLevel)
        resetTalents(true);
    // xinef: else, recalculate free talent points count
    else
        SetFreeTalentPoints(talentPointsForLevel - m_usedTalentCount);

Also ItemRewards are still not working; SlowXpGain.ItemRewards = "10 51809, 15 41600" doesnt work on level 10 and level 15

ZhengPeiRu21 commented 1 year ago

Thank you for reporting the issue. I will investigate.

For ItemRewards, they are sent to you in the mail. This is to avoid complex logic checking if the player has enough bag space.

dkapte commented 1 year ago

Thank you and indeed i have noticed that by looking at the source at player->SendItemRetrievalMail. Didn't receive any mail on the character on the set level in the config although the mail time is set to 10 in the worldconfig so it should be instant. Let's hope you got the time to review that as well and if you need any help or testing i'm more than willing to help

ZhengPeiRu21 commented 1 year ago

It looks like this is due to a core issue. I have opened an AC PR to resolve it.

I am not able to reproduce your issue with items. They are mailing for me correctly. If you are still experience the issue, could you share more details about your configuration and how you are testing?

dkapte commented 1 year ago

Zheng do you have any update on how to solve this? Thanks

dkapte commented 1 year ago

Zheng , I have changed the playerstorage and altered the table characters as you described in the core issue and now the talents are not resetted so that works, thank you. But I have noticed another thing; when you enable challengemode on a character... the settings are not saved on logout.

I can enable the challenge mode and everything now works, from talents to items and titles being given. But when I logout and login the challenge mode is disabled once again. I noticed you are using getPlayerSettings and updatePlayerSettings but I can't find any reference table in the database containing data for mod-challenge-mode as described in the code. So for now the player needs to activate challengemode every time on the gameobject when they log back in.

Furthermore challengemode can be enabled at any level. Is it possible to set a configure parameter for this to disable entering challenge mode when higher than lvl x (so for example level 1). The XP is also getting overruled by module-weekend-xp and module-individual-xp but when the bool 1 or 0 for challengemode is present in the database I can make a check for that in the XP modules.

Thanks again for the provided solution on extra talents being saved, that works great

jshplayer commented 1 year ago

Hi there, great module - i notice the challenge modes still drop and don't persist after a relog. Was there a fix or work around to this? Currently players would have to complete a challenge in a single session.

ZhengPeiRu21 commented 1 year ago

Do you have EnablePlayerSettings set to 1 in your worldserver config? This is required to save player challenges.

jshplayer commented 1 year ago

Thanks so much for replying Zhen, such simple thing - i didn't realize that toggle existed and was required. Hopefully this helps someone in future.

ZhengPeiRu21 commented 1 year ago

Thanks so much for replying Zhen, such simple thing - i didn't realize that toggle existed and was required. Hopefully this helps someone in future.

Thank you for noticing that it wasn't documented that this is required, I will add a note to the README. Please let me know if there is any more trouble!