{"action":"opened","number":34,"pull_request":{"url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/pulls/34","id":34528228,"html_url":"https://github.com/cameroncondry/cbc-kitten-scientists/pull/34","diff_url":"https://github.com/cameroncondry/cbc-kitten-scientists/pull/34.diff","patch_url":"https://github.com/cameroncondry/cbc-kitten-scientists/pull/34.patch","issue_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/issues/34","number":34,"state":"open","locked":false,"title":"Prevent over trading, and allow controlling which seasons to trade","user":{"login":"jacob-keller","id":874719,"avatar_url":"https://avatars.githubusercontent.com/u/874719?v=3","gravatar_id":"","url":"https://api.github.com/users/jacob-keller","html_url":"https://github.com/jacob-keller","followers_url":"https://api.github.com/users/jacob-keller/followers","following_url":"https://api.github.com/users/jacob-keller/following{/other_user}","gists_url":"https://api.github.com/users/jacob-keller/gists{/gist_id}","starred_url":"https://api.github.com/users/jacob-keller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacob-keller/subscriptions","organizations_url":"https://api.github.com/users/jacob-keller/orgs","repos_url":"https://api.github.com/users/jacob-keller/repos","events_url":"https://api.github.com/users/jacob-keller/events{/privacy}","received_events_url":"https://api.github.com/users/jacob-keller/received_events","type":"User","site_admin":false},"body":"This patch series intends to fix up trading and should resolve some following issues and new features\r\n\r\na) trading would greedily trade with the first race only. That is, we would trade with the first race, and then re-check gold again for the second race and might stop if we got below our gold trigger percentage. This is bad, because we need to ensure multiple races all have a chance to trade. In my way, the first race has gold/catpower priority, and the second race will use up what it can if any is left. This is not really ideal, but I haven't figured out a masterful solution for it. At least this way we don't recheck if gold is actually *at* the cap each time.\r\n\r\nb) trade only as much as we can store. Takes into account the maximum amount that we can receive for clicking trade once, and then calculates a capacity for each resource. It opts to allow trading as long as at least *one* resource has capacity to store more (excepting any resources which do not stock up like blueprints.) There is some rather funky code involved for calculating Zebra's titanium. This was taken directly from the base game code. I don't want to remove it because I want our calculations to be accurate.\r\n\r\nc) enable user control for per-season trading. This is easier with the season refactor done in the first patch, and hopefully it's not too hacked in. It definitely could use a bit more TLC, but I can't think of a better way at this time of night.\r\n\r\nThe end result is a bit more control over trading. I added a couple races (disabled by default) that the user can configure. We could theoretically add every race now, but I didn't think most of the others are all that useful. I could be wrong though.\r\n\r\nHopefully this patch series is useful and acceptable.","created_at":"2015-05-01T09:11:30Z","updated_at":"2015-05-01T09:11:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/pulls/34/commits","review_comments_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/pulls/34/comments","review_comment_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/issues/34/comments","statuses_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/statuses/9cf546c65bc0135b5ccf040fd4afed6791264c4b","head":{"label":"jacob-keller:jk/prevent-over-trading","ref":"jk/prevent-over-trading","sha":"9cf546c65bc0135b5ccf040fd4afed6791264c4b","user":{"login":"jacob-keller","id":874719,"avatar_url":"https://avatars.githubusercontent.com/u/874719?v=3","gravatar_id":"","url":"https://api.github.com/users/jacob-keller","html_url":"https://github.com/jacob-keller","followers_url":"https://api.github.com/users/jacob-keller/followers","following_url":"https://api.github.com/users/jacob-keller/following{/other_user}","gists_url":"https://api.github.com/users/jacob-keller/gists{/gist_id}","starred_url":"https://api.github.com/users/jacob-keller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacob-keller/subscriptions","organizations_url":"https://api.github.com/users/jacob-keller/orgs","repos_url":"https://api.github.com/users/jacob-keller/repos","events_url":"https://api.github.com/users/jacob-keller/events{/privacy}","received_events_url":"https://api.github.com/users/jacob-keller/received_events","type":"User","site_admin":false},"repo":{"id":33436896,"name":"cbc-kitten-scientists","full_name":"jacob-keller/cbc-kitten-scientists","owner":{"login":"jacob-keller","id":874719,"avatar_url":"https://avatars.githubusercontent.com/u/874719?v=3","gravatar_id":"","url":"https://api.github.com/users/jacob-keller","html_url":"https://github.com/jacob-keller","followers_url":"https://api.github.com/users/jacob-keller/followers","following_url":"https://api.github.com/users/jacob-keller/following{/other_user}","gists_url":"https://api.github.com/users/jacob-keller/gists{/gist_id}","starred_url":"https://api.github.com/users/jacob-keller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacob-keller/subscriptions","organizations_url":"https://api.github.com/users/jacob-keller/orgs","repos_url":"https://api.github.com/users/jacob-keller/repos","events_url":"https://api.github.com/users/jacob-keller/events{/privacy}","received_events_url":"https://api.github.com/users/jacob-keller/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jacob-keller/cbc-kitten-scientists","description":"Add-on for the wonderful incremental browser game: http://bloodrizer.ru/games/kittens/","fork":true,"url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists","forks_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/forks","keys_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/teams","hooks_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/hooks","issue_events_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/issues/events{/number}","events_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/events","assignees_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/assignees{/user}","branches_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/branches{/branch}","tags_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/tags","blobs_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/git/refs{/sha}","trees_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/statuses/{sha}","languages_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/languages","stargazers_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/stargazers","contributors_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/contributors","subscribers_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/subscribers","subscription_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/subscription","commits_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/commits{/sha}","git_commits_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/git/commits{/sha}","comments_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/comments{/number}","issue_comment_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/issues/comments{/number}","contents_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/contents/{+path}","compare_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/merges","archive_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/downloads","issues_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/issues{/number}","pulls_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/pulls{/number}","milestones_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/milestones{/number}","notifications_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/labels{/name}","releases_url":"https://api.github.com/repos/jacob-keller/cbc-kitten-scientists/releases{/id}","created_at":"2015-04-05T09:56:13Z","updated_at":"2015-04-06T08:08:22Z","pushed_at":"2015-05-01T09:06:14Z","git_url":"git://github.com/jacob-keller/cbc-kitten-scientists.git","ssh_url":"git@github.com:jacob-keller/cbc-kitten-scientists.git","clone_url":"https://github.com/jacob-keller/cbc-kitten-scientists.git","svn_url":"https://github.com/jacob-keller/cbc-kitten-scientists","homepage":null,"size":348,"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":"master"}},"base":{"label":"cameroncondry:feature/optional-crafting","ref":"feature/optional-crafting","sha":"e8c5b6ca7c392fade21b60ba0bba8e87cf5148e5","user":{"login":"cameroncondry","id":2709431,"avatar_url":"https://avatars.githubusercontent.com/u/2709431?v=3","gravatar_id":"","url":"https://api.github.com/users/cameroncondry","html_url":"https://github.com/cameroncondry","followers_url":"https://api.github.com/users/cameroncondry/followers","following_url":"https://api.github.com/users/cameroncondry/following{/other_user}","gists_url":"https://api.github.com/users/cameroncondry/gists{/gist_id}","starred_url":"https://api.github.com/users/cameroncondry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cameroncondry/subscriptions","organizations_url":"https://api.github.com/users/cameroncondry/orgs","repos_url":"https://api.github.com/users/cameroncondry/repos","events_url":"https://api.github.com/users/cameroncondry/events{/privacy}","received_events_url":"https://api.github.com/users/cameroncondry/received_events","type":"User","site_admin":false},"repo":{"id":31290497,"name":"cbc-kitten-scientists","full_name":"cameroncondry/cbc-kitten-scientists","owner":{"login":"cameroncondry","id":2709431,"avatar_url":"https://avatars.githubusercontent.com/u/2709431?v=3","gravatar_id":"","url":"https://api.github.com/users/cameroncondry","html_url":"https://github.com/cameroncondry","followers_url":"https://api.github.com/users/cameroncondry/followers","following_url":"https://api.github.com/users/cameroncondry/following{/other_user}","gists_url":"https://api.github.com/users/cameroncondry/gists{/gist_id}","starred_url":"https://api.github.com/users/cameroncondry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cameroncondry/subscriptions","organizations_url":"https://api.github.com/users/cameroncondry/orgs","repos_url":"https://api.github.com/users/cameroncondry/repos","events_url":"https://api.github.com/users/cameroncondry/events{/privacy}","received_events_url":"https://api.github.com/users/cameroncondry/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cameroncondry/cbc-kitten-scientists","description":"Add-on for the wonderful incremental browser game: http://bloodrizer.ru/games/kittens/","fork":false,"url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists","forks_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/forks","keys_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/teams","hooks_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/hooks","issue_events_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/issues/events{/number}","events_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/events","assignees_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/assignees{/user}","branches_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/branches{/branch}","tags_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/tags","blobs_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/git/refs{/sha}","trees_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/statuses/{sha}","languages_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/languages","stargazers_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/stargazers","contributors_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/contributors","subscribers_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/subscribers","subscription_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/subscription","commits_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/commits{/sha}","git_commits_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/git/commits{/sha}","comments_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/comments{/number}","issue_comment_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/issues/comments{/number}","contents_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/contents/{+path}","compare_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/merges","archive_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/downloads","issues_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/issues{/number}","pulls_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/pulls{/number}","milestones_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/milestones{/number}","notifications_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/labels{/name}","releases_url":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/releases{/id}","created_at":"2015-02-25T01:04:35Z","updated_at":"2015-05-01T05:17:29Z","pushed_at":"2015-05-01T05:17:28Z","git_url":"git://github.com/cameroncondry/cbc-kitten-scientists.git","ssh_url":"git@github.com:cameroncondry/cbc-kitten-scientists.git","clone_url":"https://github.com/cameroncondry/cbc-kitten-scientists.git","svn_url":"https://github.com/cameroncondry/cbc-kitten-scientists","homepage":null,"size":875,"stargazers_count":6,"watchers_count":6,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":4,"forks":10,"open_issues":4,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/pulls/34"},"html":{"href":"https://github.com/cameroncondry/cbc-kitten-scientists/pull/34"},"issue":{"href":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/issues/34"},"comments":{"href":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/issues/34/comments"},"review_comments":{"href":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/pulls/34/comments"},"review_comment":{"href":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/pulls/34/commits"},"statuses":{"href":"https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/statuses/9cf546c65bc0135b5ccf040fd4afed6791264c4b"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":2,"additions":133,"deletions":18,"changed_files":1}}