{"action":"created","comment":{"url":"https://api.github.com/repos/mc-server/MCServer/pulls/comments/31498597","id":31498597,"diff_hunk":"@@ -1126,8 +1127,137 @@ void cSlotAreaAnvil::UpdateResult(cPlayer & a_Player)\n \t\t\t\t\tNeedExp += std::max(1, Damage / 100);\n \t\t\t\t}\n \t\t\t}\n+\t\t}\n+\n+\t\t// Enchantments for items and books\n+\t\tAStringVector Enchantments = StringSplit(SecondInput.m_Enchantments.ToString(), \";\");\n+\n+\t\t// Loop through each enchantment in the book\n+\t\tfor (AString itr : Enchantments)\n+\t\t{\n+\t\t\tint CurrentEnchantment = cEnchantments::StringToEnchantmentID(StringSplit(itr, \"=\").at(0));\n+\t\t\tint CurrentLevel = SecondInput.m_Enchantments.GetLevel(CurrentEnchantment);\n+\n+\t\t\t// The enchantment could be illegal (Example: Sharpness II on an iron helmet) - Should happen only with Books\n+\t\t\tif ((((Input.m_ItemType == 298) || (Input.m_ItemType == 302) || (Input.m_ItemType == 306) || (Input.m_ItemType == 310) || (Input.m_ItemType == 314))\n+\t\t\t\t&& ((CurrentEnchantment != 0) && (CurrentEnchantment != 1) &&( CurrentEnchantment != 3) && (CurrentEnchantment != 4) && (CurrentEnchantment != 5) && (CurrentEnchantment != 6) && (CurrentEnchantment != 7) && (CurrentEnchantment != 34)))\n+\t\t\t\t/* Helmet */\n+\t\t\t\t|| (((Input.m_ItemType == 299) || (Input.m_ItemType == 303) || (Input.m_ItemType == 307) || (Input.m_ItemType == 311) || (Input.m_ItemType == 315))\n+\t\t\t\t&& ((CurrentEnchantment != 0) && (CurrentEnchantment != 1) && (CurrentEnchantment != 3) && (CurrentEnchantment != 4) && (CurrentEnchantment != 7) && (CurrentEnchantment != 34)))\n+\t\t\t\t/* Chestplate */\n+\t\t\t\t|| (((Input.m_ItemType == 300) || (Input.m_ItemType == 304) || (Input.m_ItemType == 308) || (Input.m_ItemType == 312) || (Input.m_ItemType == 316))\n+\t\t\t\t&& ((CurrentEnchantment != 0) && (CurrentEnchantment != 1) && (CurrentEnchantment != 3) && (CurrentEnchantment != 4) && (CurrentEnchantment != 7) && (CurrentEnchantment != 34)))\n+\t\t\t\t/* Leggings */\n+\t\t\t\t|| (((Input.m_ItemType == 301) || (Input.m_ItemType == 305) || (Input.m_ItemType == 309) || (Input.m_ItemType == 313) || (Input.m_ItemType == 317))\n+\t\t\t\t&& ((CurrentEnchantment != 0) && (CurrentEnchantment != 1) && (CurrentEnchantment != 2) && (CurrentEnchantment != 3) && (CurrentEnchantment != 4) && (CurrentEnchantment != 7) && (CurrentEnchantment != 8) && (CurrentEnchantment != 34)))\n+\t\t\t\t/* Boots */\n+\t\t\t\t|| (((Input.m_ItemType == 268) || (Input.m_ItemType == 272) || (Input.m_ItemType == 267) || (Input.m_ItemType == 276)|| (Input.m_ItemType == 283))\n+\t\t\t\t&& ((CurrentEnchantment != 16) && (CurrentEnchantment != 17) && (CurrentEnchantment != 18) && (CurrentEnchantment != 19) && (CurrentEnchantment != 20) && (CurrentEnchantment != 21) && (CurrentEnchantment != 34)))\n+\t\t\t\t/* Swords */\n+\t\t\t\t|| (((Input.m_ItemType == 271) || (Input.m_ItemType == 275) || (Input.m_ItemType == 258) || (Input.m_ItemType == 279) || (Input.m_ItemType == 286))\n+\t\t\t\t&& ((CurrentEnchantment != 16) && (CurrentEnchantment != 17) && (CurrentEnchantment != 18) && (CurrentEnchantment != 32) && (CurrentEnchantment != 33) && (CurrentEnchantment != 34) && (CurrentEnchantment != 35)))\n+\t\t\t\t/* Axe */\n+\t\t\t\t|| (((Input.m_ItemType == 269) || (Input.m_ItemType == 273) || (Input.m_ItemType == 256) || (Input.m_ItemType == 277) || (Input.m_ItemType == 284))\n+\t\t\t\t&& ((CurrentEnchantment != 32) && (CurrentEnchantment != 33) && (CurrentEnchantment != 34) && (CurrentEnchantment != 35)))\n+\t\t\t\t/* Shovels */\n+\t\t\t\t|| (((Input.m_ItemType == 290) || (Input.m_ItemType == 291) || (Input.m_ItemType == 292) || (Input.m_ItemType == 293) || (Input.m_ItemType == 294))\n+\t\t\t\t&& (CurrentEnchantment != 34))\n+\t\t\t\t/* Hoes */\n+\t\t\t\t|| ((Input.m_ItemType == 261)\n+\t\t\t\t&& ((CurrentEnchantment != 48) && (CurrentEnchantment != 49) && (CurrentEnchantment != 50) && (CurrentEnchantment != 51) && (CurrentEnchantment != 34)))\n+\t\t\t\t/* Bow */\n+\t\t\t\t|| ((Input.m_ItemType == 346)\n+\t\t\t\t&& ((CurrentEnchantment != 34) && (CurrentEnchantment != 61) && (CurrentEnchantment != 62)))\n+\t\t\t\t/* Fishing Rod */\n+\t\t\t\t|| ((Input.m_ItemType == 398)\n+\t\t\t\t&& (CurrentEnchantment != 34))\n+\t\t\t\t/* Carrot on a Stick */\n+\t\t\t\t|| ((Input.m_ItemType == 359)\n+\t\t\t\t&& ((CurrentEnchantment != 34) && (CurrentEnchantment != 32) && (CurrentEnchantment != 33)))\n+\t\t\t\t/* Shears */\n+\t\t\t\t|| ((Input.m_ItemType == 259)\n+\t\t\t\t&& (CurrentEnchantment != 34))\n+\t\t\t\t/* Flint and Steel */\n+\t\t\t\t)","path":"src/UI/SlotArea.cpp","position":72,"original_position":72,"commit_id":"b3f889174a6c9b2b4f6be45a9ae03d574b321929","original_commit_id":"b3f889174a6c9b2b4f6be45a9ae03d574b321929","user":{"login":"madmaxoft","id":4388386,"avatar_url":"https://avatars.githubusercontent.com/u/4388386?v=3","gravatar_id":"","url":"https://api.github.com/users/madmaxoft","html_url":"https://github.com/madmaxoft","followers_url":"https://api.github.com/users/madmaxoft/followers","following_url":"https://api.github.com/users/madmaxoft/following{/other_user}","gists_url":"https://api.github.com/users/madmaxoft/gists{/gist_id}","starred_url":"https://api.github.com/users/madmaxoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madmaxoft/subscriptions","organizations_url":"https://api.github.com/users/madmaxoft/orgs","repos_url":"https://api.github.com/users/madmaxoft/repos","events_url":"https://api.github.com/users/madmaxoft/events{/privacy}","received_events_url":"https://api.github.com/users/madmaxoft/received_events","type":"User","site_admin":false},"body":"This is just TERRIBLE!\r\nUse symbolic names (`E_ITEM_ABC`) instead of the numbers. Format the conditions properly, use indent to indicate the depth of the comparisons.","created_at":"2015-06-02T07:40:04Z","updated_at":"2015-06-02T07:40:04Z","html_url":"https://github.com/mc-server/MCServer/pull/2183#discussion_r31498597","pull_request_url":"https://api.github.com/repos/mc-server/MCServer/pulls/2183","_links":{"self":{"href":"https://api.github.com/repos/mc-server/MCServer/pulls/comments/31498597"},"html":{"href":"https://github.com/mc-server/MCServer/pull/2183#discussion_r31498597"},"pull_request":{"href":"https://api.github.com/repos/mc-server/MCServer/pulls/2183"}}},"pull_request":{"url":"https://api.github.com/repos/mc-server/MCServer/pulls/2183","id":36652577,"html_url":"https://github.com/mc-server/MCServer/pull/2183","diff_url":"https://github.com/mc-server/MCServer/pull/2183.diff","patch_url":"https://github.com/mc-server/MCServer/pull/2183.patch","issue_url":"https://api.github.com/repos/mc-server/MCServer/issues/2183","number":2183,"state":"open","locked":false,"title":"Fixed Anvil Mechanics with Enchantments #1608","user":{"login":"Rakete1111","id":8321423,"avatar_url":"https://avatars.githubusercontent.com/u/8321423?v=3","gravatar_id":"","url":"https://api.github.com/users/Rakete1111","html_url":"https://github.com/Rakete1111","followers_url":"https://api.github.com/users/Rakete1111/followers","following_url":"https://api.github.com/users/Rakete1111/following{/other_user}","gists_url":"https://api.github.com/users/Rakete1111/gists{/gist_id}","starred_url":"https://api.github.com/users/Rakete1111/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rakete1111/subscriptions","organizations_url":"https://api.github.com/users/Rakete1111/orgs","repos_url":"https://api.github.com/users/Rakete1111/repos","events_url":"https://api.github.com/users/Rakete1111/events{/privacy}","received_events_url":"https://api.github.com/users/Rakete1111/received_events","type":"User","site_admin":false},"body":"This fixes anvil behavior when fusing/enchanting items and books.\r\n#1608","created_at":"2015-06-01T17:46:54Z","updated_at":"2015-06-02T07:40:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"394278e58e35eeeda8ac7b00bdc3ba9101440e34","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mc-server/MCServer/pulls/2183/commits","review_comments_url":"https://api.github.com/repos/mc-server/MCServer/pulls/2183/comments","review_comment_url":"https://api.github.com/repos/mc-server/MCServer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mc-server/MCServer/issues/2183/comments","statuses_url":"https://api.github.com/repos/mc-server/MCServer/statuses/b3f889174a6c9b2b4f6be45a9ae03d574b321929","head":{"label":"Rakete1111:master","ref":"master","sha":"b3f889174a6c9b2b4f6be45a9ae03d574b321929","user":{"login":"Rakete1111","id":8321423,"avatar_url":"https://avatars.githubusercontent.com/u/8321423?v=3","gravatar_id":"","url":"https://api.github.com/users/Rakete1111","html_url":"https://github.com/Rakete1111","followers_url":"https://api.github.com/users/Rakete1111/followers","following_url":"https://api.github.com/users/Rakete1111/following{/other_user}","gists_url":"https://api.github.com/users/Rakete1111/gists{/gist_id}","starred_url":"https://api.github.com/users/Rakete1111/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rakete1111/subscriptions","organizations_url":"https://api.github.com/users/Rakete1111/orgs","repos_url":"https://api.github.com/users/Rakete1111/repos","events_url":"https://api.github.com/users/Rakete1111/events{/privacy}","received_events_url":"https://api.github.com/users/Rakete1111/received_events","type":"User","site_admin":false},"repo":{"id":36375200,"name":"MCServer","full_name":"Rakete1111/MCServer","owner":{"login":"Rakete1111","id":8321423,"avatar_url":"https://avatars.githubusercontent.com/u/8321423?v=3","gravatar_id":"","url":"https://api.github.com/users/Rakete1111","html_url":"https://github.com/Rakete1111","followers_url":"https://api.github.com/users/Rakete1111/followers","following_url":"https://api.github.com/users/Rakete1111/following{/other_user}","gists_url":"https://api.github.com/users/Rakete1111/gists{/gist_id}","starred_url":"https://api.github.com/users/Rakete1111/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rakete1111/subscriptions","organizations_url":"https://api.github.com/users/Rakete1111/orgs","repos_url":"https://api.github.com/users/Rakete1111/repos","events_url":"https://api.github.com/users/Rakete1111/events{/privacy}","received_events_url":"https://api.github.com/users/Rakete1111/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Rakete1111/MCServer","description":"A performant C++ Minecraft Server","fork":true,"url":"https://api.github.com/repos/Rakete1111/MCServer","forks_url":"https://api.github.com/repos/Rakete1111/MCServer/forks","keys_url":"https://api.github.com/repos/Rakete1111/MCServer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Rakete1111/MCServer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Rakete1111/MCServer/teams","hooks_url":"https://api.github.com/repos/Rakete1111/MCServer/hooks","issue_events_url":"https://api.github.com/repos/Rakete1111/MCServer/issues/events{/number}","events_url":"https://api.github.com/repos/Rakete1111/MCServer/events","assignees_url":"https://api.github.com/repos/Rakete1111/MCServer/assignees{/user}","branches_url":"https://api.github.com/repos/Rakete1111/MCServer/branches{/branch}","tags_url":"https://api.github.com/repos/Rakete1111/MCServer/tags","blobs_url":"https://api.github.com/repos/Rakete1111/MCServer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Rakete1111/MCServer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Rakete1111/MCServer/git/refs{/sha}","trees_url":"https://api.github.com/repos/Rakete1111/MCServer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Rakete1111/MCServer/statuses/{sha}","languages_url":"https://api.github.com/repos/Rakete1111/MCServer/languages","stargazers_url":"https://api.github.com/repos/Rakete1111/MCServer/stargazers","contributors_url":"https://api.github.com/repos/Rakete1111/MCServer/contributors","subscribers_url":"https://api.github.com/repos/Rakete1111/MCServer/subscribers","subscription_url":"https://api.github.com/repos/Rakete1111/MCServer/subscription","commits_url":"https://api.github.com/repos/Rakete1111/MCServer/commits{/sha}","git_commits_url":"https://api.github.com/repos/Rakete1111/MCServer/git/commits{/sha}","comments_url":"https://api.github.com/repos/Rakete1111/MCServer/comments{/number}","issue_comment_url":"https://api.github.com/repos/Rakete1111/MCServer/issues/comments{/number}","contents_url":"https://api.github.com/repos/Rakete1111/MCServer/contents/{+path}","compare_url":"https://api.github.com/repos/Rakete1111/MCServer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Rakete1111/MCServer/merges","archive_url":"https://api.github.com/repos/Rakete1111/MCServer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Rakete1111/MCServer/downloads","issues_url":"https://api.github.com/repos/Rakete1111/MCServer/issues{/number}","pulls_url":"https://api.github.com/repos/Rakete1111/MCServer/pulls{/number}","milestones_url":"https://api.github.com/repos/Rakete1111/MCServer/milestones{/number}","notifications_url":"https://api.github.com/repos/Rakete1111/MCServer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Rakete1111/MCServer/labels{/name}","releases_url":"https://api.github.com/repos/Rakete1111/MCServer/releases{/id}","created_at":"2015-05-27T15:09:46Z","updated_at":"2015-05-27T15:09:50Z","pushed_at":"2015-06-01T18:29:48Z","git_url":"git://github.com/Rakete1111/MCServer.git","ssh_url":"git@github.com:Rakete1111/MCServer.git","clone_url":"https://github.com/Rakete1111/MCServer.git","svn_url":"https://github.com/Rakete1111/MCServer","homepage":"mc-server.org","size":76106,"stargazers_count":0,"watchers_count":0,"language":"C","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":"mc-server:master","ref":"master","sha":"a54fa15bc6326d5482fae27b5fbcd42c8a34427a","user":{"login":"mc-server","id":5096476,"avatar_url":"https://avatars.githubusercontent.com/u/5096476?v=3","gravatar_id":"","url":"https://api.github.com/users/mc-server","html_url":"https://github.com/mc-server","followers_url":"https://api.github.com/users/mc-server/followers","following_url":"https://api.github.com/users/mc-server/following{/other_user}","gists_url":"https://api.github.com/users/mc-server/gists{/gist_id}","starred_url":"https://api.github.com/users/mc-server/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mc-server/subscriptions","organizations_url":"https://api.github.com/users/mc-server/orgs","repos_url":"https://api.github.com/users/mc-server/repos","events_url":"https://api.github.com/users/mc-server/events{/privacy}","received_events_url":"https://api.github.com/users/mc-server/received_events","type":"Organization","site_admin":false},"repo":{"id":11693709,"name":"MCServer","full_name":"mc-server/MCServer","owner":{"login":"mc-server","id":5096476,"avatar_url":"https://avatars.githubusercontent.com/u/5096476?v=3","gravatar_id":"","url":"https://api.github.com/users/mc-server","html_url":"https://github.com/mc-server","followers_url":"https://api.github.com/users/mc-server/followers","following_url":"https://api.github.com/users/mc-server/following{/other_user}","gists_url":"https://api.github.com/users/mc-server/gists{/gist_id}","starred_url":"https://api.github.com/users/mc-server/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mc-server/subscriptions","organizations_url":"https://api.github.com/users/mc-server/orgs","repos_url":"https://api.github.com/users/mc-server/repos","events_url":"https://api.github.com/users/mc-server/events{/privacy}","received_events_url":"https://api.github.com/users/mc-server/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mc-server/MCServer","description":"A performant C++ Minecraft Server","fork":false,"url":"https://api.github.com/repos/mc-server/MCServer","forks_url":"https://api.github.com/repos/mc-server/MCServer/forks","keys_url":"https://api.github.com/repos/mc-server/MCServer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mc-server/MCServer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mc-server/MCServer/teams","hooks_url":"https://api.github.com/repos/mc-server/MCServer/hooks","issue_events_url":"https://api.github.com/repos/mc-server/MCServer/issues/events{/number}","events_url":"https://api.github.com/repos/mc-server/MCServer/events","assignees_url":"https://api.github.com/repos/mc-server/MCServer/assignees{/user}","branches_url":"https://api.github.com/repos/mc-server/MCServer/branches{/branch}","tags_url":"https://api.github.com/repos/mc-server/MCServer/tags","blobs_url":"https://api.github.com/repos/mc-server/MCServer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mc-server/MCServer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mc-server/MCServer/git/refs{/sha}","trees_url":"https://api.github.com/repos/mc-server/MCServer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mc-server/MCServer/statuses/{sha}","languages_url":"https://api.github.com/repos/mc-server/MCServer/languages","stargazers_url":"https://api.github.com/repos/mc-server/MCServer/stargazers","contributors_url":"https://api.github.com/repos/mc-server/MCServer/contributors","subscribers_url":"https://api.github.com/repos/mc-server/MCServer/subscribers","subscription_url":"https://api.github.com/repos/mc-server/MCServer/subscription","commits_url":"https://api.github.com/repos/mc-server/MCServer/commits{/sha}","git_commits_url":"https://api.github.com/repos/mc-server/MCServer/git/commits{/sha}","comments_url":"https://api.github.com/repos/mc-server/MCServer/comments{/number}","issue_comment_url":"https://api.github.com/repos/mc-server/MCServer/issues/comments{/number}","contents_url":"https://api.github.com/repos/mc-server/MCServer/contents/{+path}","compare_url":"https://api.github.com/repos/mc-server/MCServer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mc-server/MCServer/merges","archive_url":"https://api.github.com/repos/mc-server/MCServer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mc-server/MCServer/downloads","issues_url":"https://api.github.com/repos/mc-server/MCServer/issues{/number}","pulls_url":"https://api.github.com/repos/mc-server/MCServer/pulls{/number}","milestones_url":"https://api.github.com/repos/mc-server/MCServer/milestones{/number}","notifications_url":"https://api.github.com/repos/mc-server/MCServer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mc-server/MCServer/labels{/name}","releases_url":"https://api.github.com/repos/mc-server/MCServer/releases{/id}","created_at":"2013-07-26T19:56:59Z","updated_at":"2015-06-01T16:33:55Z","pushed_at":"2015-06-01T22:44:19Z","git_url":"git://github.com/mc-server/MCServer.git","ssh_url":"git@github.com:mc-server/MCServer.git","clone_url":"https://github.com/mc-server/MCServer.git","svn_url":"https://github.com/mc-server/MCServer","homepage":"mc-server.org","size":166254,"stargazers_count":663,"watchers_count":663,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":195,"mirror_url":null,"open_issues_count":333,"forks":195,"open_issues":333,"watchers":663,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mc-server/MCServer/pulls/2183"},"html":{"href":"https://github.com/mc-server/MCServer/pull/2183"},"issue":{"href":"https://api.github.com/repos/mc-server/MCServer/issues/2183"},"comments":{"href":"https://api.github.com/repos/mc-server/MCServer/issues/2183/comments"},"review_comments":{"href":"https://api.github.com/repos/mc-server/MCServer/pulls/2183/comments"},"review_comment":{"href":"https://api.github.com/repos/mc-server/MCServer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mc-server/MCServer/pulls/2183/commits"},"statuses":{"href":"https://api.github.com/repos/mc-server/MCServer/statuses/b3f889174a6c9b2b4f6be45a9ae03d574b321929"}}}}