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

Fix #77 skillpoints and SP/hour being wrong by guessing account status based on skill queue #80

Closed
wants to merge 5 commits into from

Conversation

wbSD
Copy link

@wbSD wbSD commented Feb 9, 2018

This fixed #77 which is caused by the account status defaulting to Alpha when the AccountStatus API doesn't provide an expiry date.
The number of trained skillpoints in a partially trained skill is calculated backwards based on the endtime and current skillpoints of the skill, but due to the training time incorrectly being interpreted as alpha based, even though it's omega.

The account status is now guessed based on the currently training skill, but it means that it won't be correct for Alpha characters that aren't training a skill.

var hoursToTrain = (CurrentlyTrainingSkill.EndTime - CurrentlyTrainingSkill.StartTime).TotalHours;
if (hoursToTrain > 0)
{
var spToTrain = (CurrentlyTrainingSkill.EndSP - CurrentlyTrainingSkill.StartSP);
Copy link

Choose a reason for hiding this comment

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

These really don't need to be nested. You can rewrite this to something like:

var hoursToTrain = (CurrentlyTrainingSkill.EndTime - CurrentlyTrainingSkill.StartTime).TotalHours;
var spToTrain = (CurrentlyTrainingSkill.EndSP - CurrentlyTrainingSkill.StartSP);
var spPerHour = hoursToTrain == 0 ? 0 : spToTrain/hoursToTrain;
var rate = spPerHour == 0 ? 0 : (int)Math.Round(GetOmegaSPPerHour(CurrentlyTrainingSkill.Skill) / spPerHour, 0);
then your switch statement. You could also set the spPerHour to some ludicrous value instead of 0 to avoid the second ternary operation if you wanted to

@wbSD wbSD closed this May 14, 2018
NevarrTivianne pushed a commit to NevarrTivianne/evemon that referenced this pull request Apr 3, 2021
… by the current character. Fixes evemondevteam#77.

- Update skill queue about to end message. Fixes evemondevteam#80
- Fix text overflow on notification popup if show location is enabled
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SP/Hour, and total SP incorrect
2 participants