Commit Graph
5 Commits
Author SHA1 Message Date
Levi Schuck b7a59d0558 FPS plugin: fix startup not applying limits
Issue:
@deathbeam reported that the limits were not applying immediately after start up
and this required dirtying the config manually to get it to apply.

Problem:
The draw listener expects `reloadConfig` to be called prior to its active use, so it is also an initalizing method.
`reloadConfig` was only being called if the config changed, and not when the plugin was activated.

Solution:
Call `reloadConfig` when the plugin is activated so it has been initialized.
2018-05-05 12:20:12 -05:00
Levi Schuck b52025ae72 Fix negative total XP calculation when skill starts
Closes #1734

Summary:
If you start a skill like fishing lobster after logging in,
you will have the xpGained value as `90`.
But, since you just started the skill, it will divide by `0`.
This results in the max integer value of `2147483647`.

If you did fletching before fishing, and had a XP per hour of `40000`.
Then when you add the fishing XP per hour of `2147483647`, the
result overflows and you get a negative number as the total XP per hour.

Solution:
Don't divide by zero, instead suppose that the skill has been active
for **at least** 60 seconds. This will result in a fair estimate that
improves as the skill continues to be used, rather than the ridiculous
estimate of 2 Billion one second and 200K the next second.

60 seconds is chosen over 1 or 5 or 10 seconds as the result is more
conservative and closer matches my hourly XP experiences.
2018-05-02 17:42:46 -05:00
Levi Schuck db4830e83a Sort Fishing spots by distance from camera
The default sort of fishing spots ends up drawing further things on top
of closer things, as it has no relation to the camera.

To solve this, convert the camera point to a `LocalPoint` and then
sort by comparing local points from the NPC to the camera's point.
However, the sort is inverted by `-1 *` so that further things are drawn
first, and closer things are drawn last--this way closer things are
always on top.

Fixes #1737
2018-04-21 15:08:35 -05:00
Levi Schuck f287cf7721 Reset XP on log-in of another character / mode 2018-04-09 23:04:28 -05:00
Levi Schuck d184a908f7 Lumbridge npcs have some bad compositions and return null in the dev tools. 2018-04-08 17:25:10 -04:00