{"action":"created","issue":{"url":"https://api.github.com/repos/Tuxemon/Tuxemon/issues/167","repository_url":"https://api.github.com/repos/Tuxemon/Tuxemon","labels_url":"https://api.github.com/repos/Tuxemon/Tuxemon/issues/167/labels{/name}","comments_url":"https://api.github.com/repos/Tuxemon/Tuxemon/issues/167/comments","events_url":"https://api.github.com/repos/Tuxemon/Tuxemon/issues/167/events","html_url":"https://github.com/Tuxemon/Tuxemon/issues/167","id":165288466,"number":167,"title":"Convert the world.npcs list to a dictionary","user":{"login":"xirsoi","id":6570408,"avatar_url":"https://avatars.githubusercontent.com/u/6570408?v=3","gravatar_id":"","url":"https://api.github.com/users/xirsoi","html_url":"https://github.com/xirsoi","followers_url":"https://api.github.com/users/xirsoi/followers","following_url":"https://api.github.com/users/xirsoi/following{/other_user}","gists_url":"https://api.github.com/users/xirsoi/gists{/gist_id}","starred_url":"https://api.github.com/users/xirsoi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xirsoi/subscriptions","organizations_url":"https://api.github.com/users/xirsoi/orgs","repos_url":"https://api.github.com/users/xirsoi/repos","events_url":"https://api.github.com/users/xirsoi/events{/privacy}","received_events_url":"https://api.github.com/users/xirsoi/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Tuxemon/Tuxemon/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-07-13T10:29:25Z","updated_at":"2016-07-18T18:02:33Z","closed_at":null,"body":"Right now, to find a particular npc in the list requires looping over the entire list, which is annoying and has linear complexity. If we convert it to a dictionary it becomes trivial to find the npc we are after and change it to constant complexity, a small performance boost (for what is likely a frequently used action).\r\n\r\nThe going suggestion is to key the dictionary on the name, but we already know that creates problems with collisions. I think it might be better to switch to a uint character id. Some might think this would be too hard for modders to keep track of, but as a modder, I think you need to give us more credit ;)\r\n\r\nIf we implement a world.search_npcs(funct compare) we could return lists of npcs based on arbitrary criteria, including the name.\r\n\r\nThoughts?"},"comment":{"url":"https://api.github.com/repos/Tuxemon/Tuxemon/issues/comments/233408245","html_url":"https://github.com/Tuxemon/Tuxemon/issues/167#issuecomment-233408245","issue_url":"https://api.github.com/repos/Tuxemon/Tuxemon/issues/167","id":233408245,"user":{"login":"bitcraft","id":556711,"avatar_url":"https://avatars.githubusercontent.com/u/556711?v=3","gravatar_id":"","url":"https://api.github.com/users/bitcraft","html_url":"https://github.com/bitcraft","followers_url":"https://api.github.com/users/bitcraft/followers","following_url":"https://api.github.com/users/bitcraft/following{/other_user}","gists_url":"https://api.github.com/users/bitcraft/gists{/gist_id}","starred_url":"https://api.github.com/users/bitcraft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitcraft/subscriptions","organizations_url":"https://api.github.com/users/bitcraft/orgs","repos_url":"https://api.github.com/users/bitcraft/repos","events_url":"https://api.github.com/users/bitcraft/events{/privacy}","received_events_url":"https://api.github.com/users/bitcraft/received_events","type":"User","site_admin":false},"created_at":"2016-07-18T18:02:33Z","updated_at":"2016-07-18T18:02:33Z","body":"Just a note here, I've been working on extending the slugs from items and techniques to monsters and npc's as well (all one of ours, maple).  The format shouldn't have any surprises; the slugs are prefixed with txmn_ and are all lower case, underscore spaced.\r\n\r\nFor example: txmn_fruitera, and npc_maple.  I'll open a PR sometime this week.  The change was non-trivial as it covered pretty much everything from maps, the json db, and a few events that expected english names or numeric id's.\r\n\r\nAs for uniqueness, I've kinda started doing simple scripts that verify aspects of the json data.  It would be simple to add another one that extracts all the slugs and checks for duplicates.  Eventually, scripts like this could be part of an automatic build process."}}
{"actor":{"display_login":"bitcraft"}}