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

Orb of Rebirth remains non-free an extra day (creates misleading message on website) #11297

Closed
Alys opened this issue Aug 6, 2019 · 18 comments · Fixed by #11505
Closed

Orb of Rebirth remains non-free an extra day (creates misleading message on website) #11297

Alys opened this issue Aug 6, 2019 · 18 comments · Fixed by #11505

Comments

@Alys
Copy link
Contributor

Alys commented Aug 6, 2019

When the Orb of Rebirth stopped being free consistently from level 100, it was announced in the Aspiring Socialites guild with this message (emphasis is mine):

"Hey Socialites! We deployed a tweak with this Gala that power users might run into. Previously, there was a sort of exploit where folks could use Fix Character Values + the Orb of Rebirth to evade having to pay Gems to change classes. Now, the freebie level 100+ Rebirth is only usable once every 45 days. Users who are affected by the limitation will see a small orange banner when they open the Orb from the Market saying how many days are left in this countdown."

However with the current code, it actually becomes free again after 46 days, not 45. I realise this is pretty minor but it would be easy to fix, and it's causing a misleading display message on the website (described below).

The current API code is this:

module.exports = function isFreeRebirth (user) {
let daysFromLastFreeRebirth = user.flags.lastFreeRebirth;
if (daysFromLastFreeRebirth) {
daysFromLastFreeRebirth = moment().diff(moment(user.flags.lastFreeRebirth), 'days');
} else {
daysFromLastFreeRebirth = 999;
}
return user.stats.lvl >= MAX_LEVEL && daysFromLastFreeRebirth > 45;
};

It could be changed to match the official announcement by changing > 45 to >= 45


The website's behaviour matches the API (i.e., it shows the Orb as free or not free according to the decision made by the API), but because the API makes you wait one extra day, the website's message is confusing on the final day (the day when it should already be free again) - on that day the website says "0 days until FREE Orb of Rebirth", as reported by @Evil_Overmom (0396e6e1-0edc-46f5-9449-24891ba16698):

"Hi -- I'm having a problem with the orb of rebirth. It tells me I have 0 days til I get a free orb, but no option to get the free orb.
Selection_001

If the API's code is fixed as described above, then the Orb will become available a day earlier and you'll never see that misleading message.

FYI this is the website's code but it does not need to be changed if the API change above is made:

nextFreeRebirth () {
return 45 - moment().diff(moment(this.user.flags.lastFreeRebirth), 'days');
},

.free-rebirth.d-flex.align-items-center(v-if='item.key === "rebirth_orb" && item.value > 0 && user.stats.lvl >= 100')
.m-auto
span.svg-icon.inline.icon-16.mr-2.pt-015(v-html="icons.whiteClock")
span(v-html='$t("nextFreeRebirth", {days: nextFreeRebirth})')

@martineizayaga
Copy link

martineizayaga commented Aug 6, 2019

@Alys can I be assigned to this issue? I want to work on this

@Alys
Copy link
Contributor Author

Alys commented Aug 7, 2019

@martineizayaga Sure, thank you! Please go ahead. Comment here if you have questions.

@anushkajj
Copy link

Hi! Beginner here. Can I work on this issue?

@Alys
Copy link
Contributor Author

Alys commented Sep 8, 2019

@martineizayaga how are you going with this? Would you like to keep working on it? If you've become too busy just let us know - we know what that's like. :)

@martineizayaga
Copy link

martineizayaga commented Sep 8, 2019 via email

@Alys
Copy link
Contributor Author

Alys commented Sep 8, 2019

@martineizayaga Sure, carry on, thanks! :)

@anushkajj I'm sorry, no, this issue is taken. :)

@anushkajj
Copy link

@Alys No issues! Thank you :)

@bmasetto
Copy link

@martineizayaga, do you still working on it? I've passed the last couple days reading about how to contribute with Habitica project and now I'm excited to solve my first issue in the project . If you happen too busy to go on with this issue, I could take it for me :)

@Alys
Copy link
Contributor Author

Alys commented Oct 8, 2019

@martineizayaga Is it okay with you if @bmasetto takes this over?

@martineizayaga
Copy link

Yes, please!

@Alys
Copy link
Contributor Author

Alys commented Oct 8, 2019

@martineizayaga Thanks!

@bmasetto Please go ahead if you're still interested!

@mistergij
Copy link
Contributor

@bmasetto, are you still working on this? I am new to Habitica, and also excited to solve my first project. If you don't mind, I could take it off your hands.

@bmasetto
Copy link

bmasetto commented Nov 2, 2019

For sure, @mistergij! Unfortunately, I was not able to start solving this issue 😞

If @Alys agree, go ahead 😃

@Alys
Copy link
Contributor Author

Alys commented Nov 3, 2019

@mistergij and @bmasetto Thanks! @mistergij you're welcome to work on this.

@mistergij
Copy link
Contributor

@Alys, created a pull request, waiting for confirmation.

@mistergij
Copy link
Contributor

#11505

@binamkayastha
Copy link

Out of curiosity how would you test something like this? Is there a way to award yourself gems in dev and speed up time (Skip to 45 days)?

@Alys
Copy link
Contributor Author

Alys commented Nov 4, 2019

@mistergij Thanks! Just so you know, you don't need to post to the issue to tell us when you've created a pull request. :) Instead, in your pull request, you can write "Fixes #11297" (that's the issue number) - you put that in the top post in the pull request (the PR template has a comment there as a reminder). That makes an automatic link between the pull request and issue, and then if the pull request is accepted, the issue will be closed automatically. See Using Your Local Install to Modify Habitica%27s Website and API > "Submitting your Change for Review in a Pull Request" for more details about what you can add to your PR. You should include your User ID too so that you can be given credit towards a contributor tier if your PR is accepted. You can edit your PR's top comment if you want to add those things now.

@binamkayastha Yes, you can give yourself Gems, using the Debug menu in the footer (see Using Your Local Install to Modify Habitica%27s Website and API > "Testing your Change Manually" for details).
To speed up time you could adjust the time on your PC, or you could use database commands (see Guidance for Blacksmiths > "MongoDB") to change the date stored in flags.lastFreeRebirth in your test user account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants