{"action":"created","issue":{"url":"https://api.github.com/repos/HabitRPG/habitrpg/issues/6482","repository_url":"https://api.github.com/repos/HabitRPG/habitrpg","labels_url":"https://api.github.com/repos/HabitRPG/habitrpg/issues/6482/labels{/name}","comments_url":"https://api.github.com/repos/HabitRPG/habitrpg/issues/6482/comments","events_url":"https://api.github.com/repos/HabitRPG/habitrpg/issues/6482/events","html_url":"https://github.com/HabitRPG/habitrpg/issues/6482","id":125760541,"number":6482,"title":"incorrect attribute / stats points from various ways of changing levels - need generic function to do allocation / deallocation","user":{"login":"Alys","id":1495809,"avatar_url":"https://avatars.githubusercontent.com/u/1495809?v=3","gravatar_id":"","url":"https://api.github.com/users/Alys","html_url":"https://github.com/Alys","followers_url":"https://api.github.com/users/Alys/followers","following_url":"https://api.github.com/users/Alys/following{/other_user}","gists_url":"https://api.github.com/users/Alys/gists{/gist_id}","starred_url":"https://api.github.com/users/Alys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alys/subscriptions","organizations_url":"https://api.github.com/users/Alys/orgs","repos_url":"https://api.github.com/users/Alys/repos","events_url":"https://api.github.com/users/Alys/events{/privacy}","received_events_url":"https://api.github.com/users/Alys/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/HabitRPG/habitrpg/labels/priority:%20minor","name":"priority: minor","color":"f9d0c4"},{"url":"https://api.github.com/repos/HabitRPG/habitrpg/labels/status:%20issue:%20help%20welcome%20now","name":"status: issue: help welcome now","color":"0e8a16"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-01-09T14:03:21Z","updated_at":"2016-09-02T02:06:01Z","closed_at":null,"body":"Staff/Admins: Adjust anything here as you see fit. \r\n\r\nThe bugs described here happen only under non-standard conditions and aren't critical to fix. I recommend that we don't work on this issue until after the API v3 changes are live.\r\n\r\nA player's allocated plus unallocated attribute points should add up to their current level (or to 100 if their level is over 100, with exceptions listed below). Under some circumstances, this does not occur - e.g., from past bugs or from using Fix Character Values to adjust level. Once the points have got out of sync with the level, they aren't always brought back into sync during levelling up or dying.\r\n\r\nTo fix this, we could have a generic function that performs the following actions:\r\n- adds up the allocated and unallocated attribute points\r\n- compares them to the current level OR to 100 if the level is over 100\r\n- if there are too few points, EITHER:\r\n   - run the `autoAllocate` function if the user has chosen auto-allocation\r\n   - add unallocated attribute points (`stats.points`)\r\n- if there are too many points:\r\n   - first subtract from the unallocated points, as much as necessary or until the unallocated points are zero\r\n   - if still too many points AND if the user is not above level 100, subtract from allocated points, choosing the affected stat(s) in the same manner they are currently chosen after death\r\n- never let any attribute have negative points\r\n- never let unallocated points be negative\r\n\r\nThat function could then be run under the following circumstances:\r\n- levelling up\r\n- death\r\n- rebirth\r\n- reset\r\n- Fix Character Values when the level is changed\r\n- class change\r\n- anything else?\r\n\r\nThere are special conditions for players who are above level 100, and special treatment for those who already have more than 100 points. Note the decision that is documented in \"Attribute Points Change\" in [Skills Rebalancing and Other Changes](http://habitica.wikia.com/wiki/User_blog:LadyAlys/Skills_Rebalancing_and_Other_Changes):\r\n_\"Players who already have attribute points above 100 will not have those points removed.\"_\r\n- If they level up, they are not given a point unless their points are less than 100.\r\n- If they rebirth or reset, their points drop to 1 as for any other player, and from that time on, they cannot ever gain more than 100 points.\r\n- If they do a class change, their points drop to 100 and from that time on, they cannot ever gain more than 100 points.\r\n- If they die and they have **un**allocated points, they lose all those unallocated points. If they die and have no unallocated points, they lose only **one** allocated point.\r\n- Under any other circumstances, if they happen to have more **allocated** points than 100, the function described above does **not** reduced them to 100.\r\n\r\nWe allow players over level 100 to have more than 100 points solely because of the decision to let them keep their points when the stats/skills rebalancing occurred in early 2015. However any code that allowed them to keep excess points would also allow newer players to keep excess points if they got those points due to future bugs, and that is undesirable. I'm thinking that maybe we should put a flag in the accounts of any players now who are over 100 and have more than 100 points. The function could then use that flag to apply the special treatment, allowing all new players to be treated normally above level 100."},"comment":{"url":"https://api.github.com/repos/HabitRPG/habitrpg/issues/comments/244264687","html_url":"https://github.com/HabitRPG/habitrpg/issues/6482#issuecomment-244264687","issue_url":"https://api.github.com/repos/HabitRPG/habitrpg/issues/6482","id":244264687,"user":{"login":"Alys","id":1495809,"avatar_url":"https://avatars.githubusercontent.com/u/1495809?v=3","gravatar_id":"","url":"https://api.github.com/users/Alys","html_url":"https://github.com/Alys","followers_url":"https://api.github.com/users/Alys/followers","following_url":"https://api.github.com/users/Alys/following{/other_user}","gists_url":"https://api.github.com/users/Alys/gists{/gist_id}","starred_url":"https://api.github.com/users/Alys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alys/subscriptions","organizations_url":"https://api.github.com/users/Alys/orgs","repos_url":"https://api.github.com/users/Alys/repos","events_url":"https://api.github.com/users/Alys/events{/privacy}","received_events_url":"https://api.github.com/users/Alys/received_events","type":"User","site_admin":false},"created_at":"2016-09-02T02:06:01Z","updated_at":"2016-09-02T02:06:01Z","body":"@DrStrangepork Yes, that's correct, unless the person who works on this comes up with a different solution."}}
{"actor":{"display_login":"Alys"}}