{"action":"created","comment":{"url":"https://api.github.com/repos/HabitRPG/habitrpg/pulls/comments/59295321","id":59295321,"diff_hunk":"@@ -0,0 +1,30 @@\n+import _ from 'lodash';\n+import content from '../content/index';\n+import splitWhitespace from '../libs/splitWhitespace';\n+const $w = splitWhitespace;\n+import * as statHelpers from '../statHelpers';\n+\n+module.exports = function statsComputed (user) {\n+  let thisArr = $w('stats stats.buffs items.gear.equipped.weapon items.gear.equipped.armor items.gear.equipped.head items.gear.equipped.shield');\n+  let computed = _.reduce(['per', 'con', 'str', 'int'], (m, stat) => {\n+    m[stat] = _.reduce(thisArr, (m2, path) => {\n+      let val = _.get(user, path);\n+      let item = content.gear.flat[val];\n+      if (!item) item = {};\n+      if (!item[stat]) {\n+        item[stat] = 0;\n+      } else {\n+        item[stat] = Number(item[stat]);\n+      }\n+      let thisMultiplier = item.klass === user.stats.class || item.specialClass === user.stats.class ? 1.5 : 1;\n+      let thisReturn = path.indexOf('items.gear') !== -1 ? item[stat] * thisMultiplier : Number(val[stat]);\n+      return m2 + thisReturn || 0;\n+    }, 0);\n+    m[stat] += Math.floor(statHelpers.capByLevel(user.stats.lvl) / 2);\n+    return m;\n+  }, {});\n+\n+  computed.maxMP = computed.int * 2 + 30;\n+  return computed;\n+};\n+","path":"common/script/libs/statsComputed.js","position":30,"original_position":30,"commit_id":"d4ae37c3f21c6ad4a6310212eb4e93d983eb1e55","original_commit_id":"d4ae37c3f21c6ad4a6310212eb4e93d983eb1e55","user":{"login":"crookedneighbor","id":2916945,"avatar_url":"https://avatars.githubusercontent.com/u/2916945?v=3","gravatar_id":"","url":"https://api.github.com/users/crookedneighbor","html_url":"https://github.com/crookedneighbor","followers_url":"https://api.github.com/users/crookedneighbor/followers","following_url":"https://api.github.com/users/crookedneighbor/following{/other_user}","gists_url":"https://api.github.com/users/crookedneighbor/gists{/gist_id}","starred_url":"https://api.github.com/users/crookedneighbor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crookedneighbor/subscriptions","organizations_url":"https://api.github.com/users/crookedneighbor/orgs","repos_url":"https://api.github.com/users/crookedneighbor/repos","events_url":"https://api.github.com/users/crookedneighbor/events{/privacy}","received_events_url":"https://api.github.com/users/crookedneighbor/received_events","type":"User","site_admin":false},"body":"Extra line.","created_at":"2016-04-11T22:50:51Z","updated_at":"2016-04-11T22:50:51Z","html_url":"https://github.com/HabitRPG/habitrpg/pull/7067#discussion_r59295321","pull_request_url":"https://api.github.com/repos/HabitRPG/habitrpg/pulls/7067","_links":{"self":{"href":"https://api.github.com/repos/HabitRPG/habitrpg/pulls/comments/59295321"},"html":{"href":"https://github.com/HabitRPG/habitrpg/pull/7067#discussion_r59295321"},"pull_request":{"href":"https://api.github.com/repos/HabitRPG/habitrpg/pulls/7067"}}},"pull_request":{"url":"https://api.github.com/repos/HabitRPG/habitrpg/pulls/7067","id":66070216,"html_url":"https://github.com/HabitRPG/habitrpg/pull/7067","diff_url":"https://github.com/HabitRPG/habitrpg/pull/7067.diff","patch_url":"https://github.com/HabitRPG/habitrpg/pull/7067.patch","issue_url":"https://api.github.com/repos/HabitRPG/habitrpg/issues/7067","number":7067,"state":"open","locked":false,"title":"shared-code-statsComputed","user":{"login":"piousbox","id":831744,"avatar_url":"https://avatars.githubusercontent.com/u/831744?v=3","gravatar_id":"","url":"https://api.github.com/users/piousbox","html_url":"https://github.com/piousbox","followers_url":"https://api.github.com/users/piousbox/followers","following_url":"https://api.github.com/users/piousbox/following{/other_user}","gists_url":"https://api.github.com/users/piousbox/gists{/gist_id}","starred_url":"https://api.github.com/users/piousbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piousbox/subscriptions","organizations_url":"https://api.github.com/users/piousbox/orgs","repos_url":"https://api.github.com/users/piousbox/repos","events_url":"https://api.github.com/users/piousbox/events{/privacy}","received_events_url":"https://api.github.com/users/piousbox/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-04-11T22:03:51Z","updated_at":"2016-04-11T22:50:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"643c281bbb0c039555ee4dc0ada44be6b9f098d0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/HabitRPG/habitrpg/pulls/7067/commits","review_comments_url":"https://api.github.com/repos/HabitRPG/habitrpg/pulls/7067/comments","review_comment_url":"https://api.github.com/repos/HabitRPG/habitrpg/pulls/comments{/number}","comments_url":"https://api.github.com/repos/HabitRPG/habitrpg/issues/7067/comments","statuses_url":"https://api.github.com/repos/HabitRPG/habitrpg/statuses/d4ae37c3f21c6ad4a6310212eb4e93d983eb1e55","head":{"label":"piousbox:shared-code-statsComputed","ref":"shared-code-statsComputed","sha":"d4ae37c3f21c6ad4a6310212eb4e93d983eb1e55","user":{"login":"piousbox","id":831744,"avatar_url":"https://avatars.githubusercontent.com/u/831744?v=3","gravatar_id":"","url":"https://api.github.com/users/piousbox","html_url":"https://github.com/piousbox","followers_url":"https://api.github.com/users/piousbox/followers","following_url":"https://api.github.com/users/piousbox/following{/other_user}","gists_url":"https://api.github.com/users/piousbox/gists{/gist_id}","starred_url":"https://api.github.com/users/piousbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piousbox/subscriptions","organizations_url":"https://api.github.com/users/piousbox/orgs","repos_url":"https://api.github.com/users/piousbox/repos","events_url":"https://api.github.com/users/piousbox/events{/privacy}","received_events_url":"https://api.github.com/users/piousbox/received_events","type":"User","site_admin":false},"repo":{"id":52387429,"name":"habitrpg","full_name":"piousbox/habitrpg","owner":{"login":"piousbox","id":831744,"avatar_url":"https://avatars.githubusercontent.com/u/831744?v=3","gravatar_id":"","url":"https://api.github.com/users/piousbox","html_url":"https://github.com/piousbox","followers_url":"https://api.github.com/users/piousbox/followers","following_url":"https://api.github.com/users/piousbox/following{/other_user}","gists_url":"https://api.github.com/users/piousbox/gists{/gist_id}","starred_url":"https://api.github.com/users/piousbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piousbox/subscriptions","organizations_url":"https://api.github.com/users/piousbox/orgs","repos_url":"https://api.github.com/users/piousbox/repos","events_url":"https://api.github.com/users/piousbox/events{/privacy}","received_events_url":"https://api.github.com/users/piousbox/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/piousbox/habitrpg","description":"A habit tracker app which treats your goals like a Role Playing Game.","fork":true,"url":"https://api.github.com/repos/piousbox/habitrpg","forks_url":"https://api.github.com/repos/piousbox/habitrpg/forks","keys_url":"https://api.github.com/repos/piousbox/habitrpg/keys{/key_id}","collaborators_url":"https://api.github.com/repos/piousbox/habitrpg/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/piousbox/habitrpg/teams","hooks_url":"https://api.github.com/repos/piousbox/habitrpg/hooks","issue_events_url":"https://api.github.com/repos/piousbox/habitrpg/issues/events{/number}","events_url":"https://api.github.com/repos/piousbox/habitrpg/events","assignees_url":"https://api.github.com/repos/piousbox/habitrpg/assignees{/user}","branches_url":"https://api.github.com/repos/piousbox/habitrpg/branches{/branch}","tags_url":"https://api.github.com/repos/piousbox/habitrpg/tags","blobs_url":"https://api.github.com/repos/piousbox/habitrpg/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/piousbox/habitrpg/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/piousbox/habitrpg/git/refs{/sha}","trees_url":"https://api.github.com/repos/piousbox/habitrpg/git/trees{/sha}","statuses_url":"https://api.github.com/repos/piousbox/habitrpg/statuses/{sha}","languages_url":"https://api.github.com/repos/piousbox/habitrpg/languages","stargazers_url":"https://api.github.com/repos/piousbox/habitrpg/stargazers","contributors_url":"https://api.github.com/repos/piousbox/habitrpg/contributors","subscribers_url":"https://api.github.com/repos/piousbox/habitrpg/subscribers","subscription_url":"https://api.github.com/repos/piousbox/habitrpg/subscription","commits_url":"https://api.github.com/repos/piousbox/habitrpg/commits{/sha}","git_commits_url":"https://api.github.com/repos/piousbox/habitrpg/git/commits{/sha}","comments_url":"https://api.github.com/repos/piousbox/habitrpg/comments{/number}","issue_comment_url":"https://api.github.com/repos/piousbox/habitrpg/issues/comments{/number}","contents_url":"https://api.github.com/repos/piousbox/habitrpg/contents/{+path}","compare_url":"https://api.github.com/repos/piousbox/habitrpg/compare/{base}...{head}","merges_url":"https://api.github.com/repos/piousbox/habitrpg/merges","archive_url":"https://api.github.com/repos/piousbox/habitrpg/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/piousbox/habitrpg/downloads","issues_url":"https://api.github.com/repos/piousbox/habitrpg/issues{/number}","pulls_url":"https://api.github.com/repos/piousbox/habitrpg/pulls{/number}","milestones_url":"https://api.github.com/repos/piousbox/habitrpg/milestones{/number}","notifications_url":"https://api.github.com/repos/piousbox/habitrpg/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/piousbox/habitrpg/labels{/name}","releases_url":"https://api.github.com/repos/piousbox/habitrpg/releases{/id}","deployments_url":"https://api.github.com/repos/piousbox/habitrpg/deployments","created_at":"2016-02-23T19:57:41Z","updated_at":"2016-02-23T19:57:49Z","pushed_at":"2016-04-11T22:28:54Z","git_url":"git://github.com/piousbox/habitrpg.git","ssh_url":"git@github.com:piousbox/habitrpg.git","clone_url":"https://github.com/piousbox/habitrpg.git","svn_url":"https://github.com/piousbox/habitrpg","homepage":"https://habitica.com","size":359725,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"HabitRPG:api-v3","ref":"api-v3","sha":"26b718ba1ffd7889b9f620f7007228c192586f68","user":{"login":"HabitRPG","id":3834775,"avatar_url":"https://avatars.githubusercontent.com/u/3834775?v=3","gravatar_id":"","url":"https://api.github.com/users/HabitRPG","html_url":"https://github.com/HabitRPG","followers_url":"https://api.github.com/users/HabitRPG/followers","following_url":"https://api.github.com/users/HabitRPG/following{/other_user}","gists_url":"https://api.github.com/users/HabitRPG/gists{/gist_id}","starred_url":"https://api.github.com/users/HabitRPG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HabitRPG/subscriptions","organizations_url":"https://api.github.com/users/HabitRPG/orgs","repos_url":"https://api.github.com/users/HabitRPG/repos","events_url":"https://api.github.com/users/HabitRPG/events{/privacy}","received_events_url":"https://api.github.com/users/HabitRPG/received_events","type":"Organization","site_admin":false},"repo":{"id":4578898,"name":"habitrpg","full_name":"HabitRPG/habitrpg","owner":{"login":"HabitRPG","id":3834775,"avatar_url":"https://avatars.githubusercontent.com/u/3834775?v=3","gravatar_id":"","url":"https://api.github.com/users/HabitRPG","html_url":"https://github.com/HabitRPG","followers_url":"https://api.github.com/users/HabitRPG/followers","following_url":"https://api.github.com/users/HabitRPG/following{/other_user}","gists_url":"https://api.github.com/users/HabitRPG/gists{/gist_id}","starred_url":"https://api.github.com/users/HabitRPG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HabitRPG/subscriptions","organizations_url":"https://api.github.com/users/HabitRPG/orgs","repos_url":"https://api.github.com/users/HabitRPG/repos","events_url":"https://api.github.com/users/HabitRPG/events{/privacy}","received_events_url":"https://api.github.com/users/HabitRPG/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/HabitRPG/habitrpg","description":"A habit tracker app which treats your goals like a Role Playing Game.","fork":false,"url":"https://api.github.com/repos/HabitRPG/habitrpg","forks_url":"https://api.github.com/repos/HabitRPG/habitrpg/forks","keys_url":"https://api.github.com/repos/HabitRPG/habitrpg/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HabitRPG/habitrpg/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HabitRPG/habitrpg/teams","hooks_url":"https://api.github.com/repos/HabitRPG/habitrpg/hooks","issue_events_url":"https://api.github.com/repos/HabitRPG/habitrpg/issues/events{/number}","events_url":"https://api.github.com/repos/HabitRPG/habitrpg/events","assignees_url":"https://api.github.com/repos/HabitRPG/habitrpg/assignees{/user}","branches_url":"https://api.github.com/repos/HabitRPG/habitrpg/branches{/branch}","tags_url":"https://api.github.com/repos/HabitRPG/habitrpg/tags","blobs_url":"https://api.github.com/repos/HabitRPG/habitrpg/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HabitRPG/habitrpg/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HabitRPG/habitrpg/git/refs{/sha}","trees_url":"https://api.github.com/repos/HabitRPG/habitrpg/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HabitRPG/habitrpg/statuses/{sha}","languages_url":"https://api.github.com/repos/HabitRPG/habitrpg/languages","stargazers_url":"https://api.github.com/repos/HabitRPG/habitrpg/stargazers","contributors_url":"https://api.github.com/repos/HabitRPG/habitrpg/contributors","subscribers_url":"https://api.github.com/repos/HabitRPG/habitrpg/subscribers","subscription_url":"https://api.github.com/repos/HabitRPG/habitrpg/subscription","commits_url":"https://api.github.com/repos/HabitRPG/habitrpg/commits{/sha}","git_commits_url":"https://api.github.com/repos/HabitRPG/habitrpg/git/commits{/sha}","comments_url":"https://api.github.com/repos/HabitRPG/habitrpg/comments{/number}","issue_comment_url":"https://api.github.com/repos/HabitRPG/habitrpg/issues/comments{/number}","contents_url":"https://api.github.com/repos/HabitRPG/habitrpg/contents/{+path}","compare_url":"https://api.github.com/repos/HabitRPG/habitrpg/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HabitRPG/habitrpg/merges","archive_url":"https://api.github.com/repos/HabitRPG/habitrpg/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HabitRPG/habitrpg/downloads","issues_url":"https://api.github.com/repos/HabitRPG/habitrpg/issues{/number}","pulls_url":"https://api.github.com/repos/HabitRPG/habitrpg/pulls{/number}","milestones_url":"https://api.github.com/repos/HabitRPG/habitrpg/milestones{/number}","notifications_url":"https://api.github.com/repos/HabitRPG/habitrpg/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HabitRPG/habitrpg/labels{/name}","releases_url":"https://api.github.com/repos/HabitRPG/habitrpg/releases{/id}","deployments_url":"https://api.github.com/repos/HabitRPG/habitrpg/deployments","created_at":"2012-06-06T22:49:48Z","updated_at":"2016-04-11T20:21:46Z","pushed_at":"2016-04-11T22:46:35Z","git_url":"git://github.com/HabitRPG/habitrpg.git","ssh_url":"git@github.com:HabitRPG/habitrpg.git","clone_url":"https://github.com/HabitRPG/habitrpg.git","svn_url":"https://github.com/HabitRPG/habitrpg","homepage":"https://habitica.com","size":377622,"stargazers_count":3735,"watchers_count":3735,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1557,"mirror_url":null,"open_issues_count":483,"forks":1557,"open_issues":483,"watchers":3735,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/HabitRPG/habitrpg/pulls/7067"},"html":{"href":"https://github.com/HabitRPG/habitrpg/pull/7067"},"issue":{"href":"https://api.github.com/repos/HabitRPG/habitrpg/issues/7067"},"comments":{"href":"https://api.github.com/repos/HabitRPG/habitrpg/issues/7067/comments"},"review_comments":{"href":"https://api.github.com/repos/HabitRPG/habitrpg/pulls/7067/comments"},"review_comment":{"href":"https://api.github.com/repos/HabitRPG/habitrpg/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/HabitRPG/habitrpg/pulls/7067/commits"},"statuses":{"href":"https://api.github.com/repos/HabitRPG/habitrpg/statuses/d4ae37c3f21c6ad4a6310212eb4e93d983eb1e55"}}}}