{"action":"created","issue":{"url":"https://api.github.com/repos/pajlada/pajbot/issues/118","repository_url":"https://api.github.com/repos/pajlada/pajbot","labels_url":"https://api.github.com/repos/pajlada/pajbot/issues/118/labels{/name}","comments_url":"https://api.github.com/repos/pajlada/pajbot/issues/118/comments","events_url":"https://api.github.com/repos/pajlada/pajbot/issues/118/events","html_url":"https://github.com/pajlada/pajbot/issues/118","id":125740274,"number":118,"title":"Quest System","user":{"login":"pajlada","id":962989,"avatar_url":"https://avatars.githubusercontent.com/u/962989?v=3","gravatar_id":"","url":"https://api.github.com/users/pajlada","html_url":"https://github.com/pajlada","followers_url":"https://api.github.com/users/pajlada/followers","following_url":"https://api.github.com/users/pajlada/following{/other_user}","gists_url":"https://api.github.com/users/pajlada/gists{/gist_id}","starred_url":"https://api.github.com/users/pajlada/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pajlada/subscriptions","organizations_url":"https://api.github.com/users/pajlada/orgs","repos_url":"https://api.github.com/users/pajlada/repos","events_url":"https://api.github.com/users/pajlada/events{/privacy}","received_events_url":"https://api.github.com/users/pajlada/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-01-09T05:41:37Z","updated_at":"2016-03-09T15:26:11Z","closed_at":null,"body":"## Overview\r\nThe quest system should be a module.\r\nWhenever a stream is started, emit the stream_started signal.\r\nThis signal is read by the Quest module.\r\nWe randomize a daily quest out of all available quests.\r\nThis is the quest that's shown in the !quest or !currentquest command.\r\nThe quest should be its own object that has a start() and stop() method.\r\nthe start() method will register all signals that it needs to track.\r\nThe quest status of each user should be stored in redis.\r\n\r\n\r\n## Quests\r\n - [ ] Time out a trump/reynad/nostam/massan sub\r\n - [ ] Create an X-width pyramid\r\n - [x] Use X emote Y times\r\n - [ ] Type X lines in Y time\r\n - [ ] Get timed out by someone\r\n - [ ] Have your name written in chat by others X amount of times, or Have your name written in chat by X people\r\n - [ ] Russian roulette someone: One of you finish the quest, the other doesn't.\r\n - [ ] Spend X amount of points.\r\n - [x] Win X points in a single duel\r\n - [ ] Win X points in duels in one day\r\n - [x] Win a raffle/emote bingo.\r\n - [ ] Be the first (or only?) user to type a certain emote within the last X minutes?\r\n - [ ] Use an emote that hasn't been used in the last X minutes or Y lines\r\n - [ ] Be part of an emote combo of at least X size. Should the emote be specific?\r\n - [ ] Timeout a user who used emote X in the last minute.\r\n - [ ] Win a bet on a hearthstone game. This would require a shit ton of coding to get done, but would be really dank. Some sort of modified Hearthstone Deck Tracker could be run on Forsens PC to keep track of the matches. Check out trackobot? seems to have an open API. SeemsGood trying now\r\n - [ ] Use X different emotes in Y time\r\n - [ ] How about a quest where you must commit sudoku (with the sudoku command), which times you out for like 5 minutes?\r\n - [ ] a personal emote bingo (or what u call it) , everyone has to guess their own unique emote (OG and bttv)\r\n - [ ] don't type in chat for XX minutes\r\n - [ ] A Russian roulette raffle where a percentage of players lose all their points while the rest get the tokens pajlada\r\n - [ ] The Lover's Ball. Make 2 users \"lovers\", they have to type eachothers name in chat in a 1 minute span, and get rewarded when that's done. So when you ask the bot you get the name of your lover.\r\n - [ ] Roulette 1000 points?\r\n - [ ] not sure if it's in log or mentioned by something, It'd just do a quest where you have to ask friends to make the quest for you - like that they have to tune in to stream and type command for you !watchingfor nickname (like 5friends have to do that) -- 5friends would know you listen to gachi gachiGASM\r\n - [ ] win X duels in a day\r\n - [ ] show text on screen like \"type memes123\", and you have to do it within 5 seconds. Kappa\r\n - [ ] only type messages with /me for X lines or X minutes?\r\n - [ ] go all in in a roulette\r\n - [ ] hide and seek quest: one user types !hide and after 1 minute someone has to type !found \"username\". if no one types it in a 1 minute timeframe the quest is fullfilled\r\n - [ ] write alphabet, one letter at a time, in sequence\r\n - [ ] ajlada he meant snusbot types an emote and you have to be in the top x people to type it pajaW\r\n - [ ] somehow, have X people type your name Y times\r\n - [ ] A quest that when a key word (color) appears like \"green\", you have to type green emotes ( FeelsBadMan ) , when it is \"black\" you type black emotes ( TryHard )\r\n - [ ] quest to morn the loss of a chat member when they are timed out by typing something like RIP <name>\r\n - [ ] (TWITCH PLAYS, chat moves emote on screen) yah, its hard as a quest, since you have to repeat that shit and it would be too much spam on screen. How about making it like a bonus event? Where a certain amount of viewers have to enter a command to trigger it\r\n\r\n## Collective quests\r\n  * Have 10 people type the same message in a row.\r\n  * Be part of a 200 emote combo.\r\n  * Be part of the winning team of an \"emote war\"/\"emote counter war\"\r\n  * 5 people join a team with something like !teamup <names> and then these 5 people ONLY join the boss battle. if they lose they lose points\r\n  * subs vs plebs in factions, spend points to timeout someone of the other faction. meter on stream that resets every 5 minutes that shows total points spent timing members of the other faction out.\r\n  * be part of building a pyramid\r\n   * chaining token-commands? same playsoud/showemote\r\n  *  tug of war in the chat? KKona The harder you spam in chat the harder you pull the rope. That could be some kind of subs vs plebs quest. Those who outspam the others win the quest\r\n\r\n## Rewards\r\n * Show X emotes on screen?\r\n * X points?"},"comment":{"url":"https://api.github.com/repos/pajlada/pajbot/issues/comments/194344644","html_url":"https://github.com/pajlada/pajbot/issues/118#issuecomment-194344644","issue_url":"https://api.github.com/repos/pajlada/pajbot/issues/118","id":194344644,"user":{"login":"Kruhlmann","id":3380818,"avatar_url":"https://avatars.githubusercontent.com/u/3380818?v=3","gravatar_id":"","url":"https://api.github.com/users/Kruhlmann","html_url":"https://github.com/Kruhlmann","followers_url":"https://api.github.com/users/Kruhlmann/followers","following_url":"https://api.github.com/users/Kruhlmann/following{/other_user}","gists_url":"https://api.github.com/users/Kruhlmann/gists{/gist_id}","starred_url":"https://api.github.com/users/Kruhlmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kruhlmann/subscriptions","organizations_url":"https://api.github.com/users/Kruhlmann/orgs","repos_url":"https://api.github.com/users/Kruhlmann/repos","events_url":"https://api.github.com/users/Kruhlmann/events{/privacy}","received_events_url":"https://api.github.com/users/Kruhlmann/received_events","type":"User","site_admin":false},"created_at":"2016-03-09T15:26:11Z","updated_at":"2016-03-09T15:26:11Z","body":"For the color-specific emotes maybe this is a start\r\n\r\nIt grabs an image from a web destination and compares it with predefined RGB color sets. For now it ignores all alpha pixels with a < 200.\r\n\r\n_colortest.py_\r\n\r\n    from PIL import Image\r\n\timport sys\r\n\timport os.path\r\n\timport io\r\n\ttry:\r\n\t\timport urllib.request as urllib2\r\n\texcept ImportError:\r\n\t\timport urllib2\r\n\r\n\tclass Color():\r\n\t\tr = 0\r\n\t\tg = 0\r\n\t\tb = 0\r\n\t\tname = \"\"\r\n\r\n\t\tdef __init__(self, r, g, b, name):\r\n\t\t\tself.r = r\r\n\t\t\tself.g = g\r\n\t\t\tself.b = b\r\n\t\t\tself.name = name\r\n\r\n\tcolors = {\r\n\t\tColor(255,235,205, \"beige\"),\r\n\t\tColor(0, 126, 0, \"green\"),\r\n\t\tColor(0, 0, 255, \"blue\"),\r\n\t\tColor(255, 0, 0, \"red\"),\r\n\t\tColor(0, 255, 0, \"lime\"),\r\n\t\tColor(0, 255, 0, \"yellow\"),\r\n\t\tColor(0,255,255, \"cyan\"),\r\n\t\tColor(128,128,128, \"gray\"),\r\n\t\tColor(255,255,255, \"white\"),\r\n\t\tColor(0,0,0,\"black\"),\r\n\t\tColor(165,42,42, \"brown\")\r\n\t}\r\n\r\n\tdef analyze(img):\r\n\t\tprint(\"Analysis engaged...\")\r\n\t\t# grab width and height\r\n\t\twidth, height = img.size\r\n\r\n\t\t# make a list of all pixels in the image\r\n\t\tpixels = img.load()\r\n\t\tdata = []\r\n\t\tfor x in range(width):\r\n\t\t\tfor y in range(height):\r\n\t\t\t\tcpixel = pixels[x, y]\r\n\t\t\t\tdata.append(cpixel)\r\n\r\n\t\tr = 0\r\n\t\tg = 0\r\n\t\tb = 0\r\n\t\tcounter = 0\r\n\r\n\t\t# loop through all pixels\r\n\t\t# if alpha value is greater than 200/255, add it to the average\r\n\t\t# (note: could also use criteria like, if not a black pixel or not a white pixel...)\r\n\t\tfor x in range(len(data)):\r\n\t\t\ttry:\r\n\t\t\t\tif data[x][3] > 200:\r\n\t\t\t\t\tr+=data[x][0]\r\n\t\t\t\t\tg+=data[x][1]\r\n\t\t\t\t\tb+=data[x][2]\r\n\t\t\texcept:\r\n\t\t\t\ttry:\r\n\t\t\t\t\tr+=data[x][0]\r\n\t\t\t\t\tg+=data[x][1]\r\n\t\t\t\t\tb+=data[x][2]\r\n\t\t\t\texcept:\r\n\t\t\t\t\tprint(\"RGB error on index \" + str(x) + \" : \")\r\n\t\t\t\t\tprint(*data, sep='\\n')\r\n\r\n\t\t\tcounter+=1\r\n\r\n\t\t# compute average RGB values\r\n\t\trAvg = r/counter\r\n\t\tgAvg = g/counter\r\n\t\tbAvg = b/counter\r\n\r\n\t\tprint(\"Average rgb of image R:\" + str(rAvg) + \" G:\" + str(gAvg) + \" B:\" + str(bAvg))\r\n\t\treturn (rAvg, gAvg, bAvg)\r\n\r\n\tif __name__ == \"__main__\":\r\n\t\tprint(\"Initializing...\")\r\n\t\tfile = urllib2.urlopen(\"https://static-cdn.jtvnw.net/emoticons/v1/171/1.0\")\r\n\t\timg = Image.open(io.BytesIO(file.read()))\r\n\t\tr, g, b = analyze(img)\r\n\t\tclosest_match = 255\r\n\t\tclosest_color = \"No match\"\r\n\t\tfor color in colors:\r\n\t\t\ttotal = 0\r\n\t\t\ttotal += abs(color.r - r)\r\n\t\t\ttotal += abs(color.g - g)\r\n\t\t\ttotal += abs(color.b - b)\r\n\t\t\ttotal = total / 3\r\n\t\t\tprint(\"Result for color: \" + color.name + \" - \" + str(total))\r\n\t\t\tif total < closest_match:\r\n\t\t\t\tclosest_match = total\r\n\t\t\t\tclosest_color = color.name\r\n\t\tprint(\"Result: \" + str(closest_match) + \" \" + closest_color)\r\n\r\n\t\t\r\n\r\n\t\t\t"}}