diff --git a/lib/ecard-art.json b/lib/ecard-art.json index 3771fe5..feee1a5 100644 --- a/lib/ecard-art.json +++ b/lib/ecard-art.json @@ -1,4 +1,4 @@ { "cards": [1,2,3,4,5,7,8,86,118,119,124,128,152,154,155,201,283,284,329,346,355,356,361,380,382,384,385,387,388,389,390,391,1188,1206,1211,1222,1228,1242,1249,1250,1251,1354,1426,1520,1627,1768,1933,2235,2649,2697,2700,2702,2703,2704,2705,2706,2707,2708,2709,2711,2712,2713,2714,2715,2716,2717,2720,2723,2762,2763,2805,2806,2807,2808,2809,2810,2811,2812,2813,2814,2815,2816,2817,2818,2819,2820,2821,2822,2823,2824,2825,2826,2827,2828,3749,4393,4410,4411,4434,4435,4451,4452,4453,4454,4455,4457,4460,4461,4462,4464,4465,4466,4467,4468,4469,4470,4477,4478,4479,4538,4539,4540,4541,4542,4543,4544,4545,4546,4547,4548,4549,4777,4778,4779,4780,4855,4856,4946,5023,5024,5026,5066,5067,5068,5069,5070,5071,5073,5074,5075,5076,5077,5078,5079,5080,5081,5082,5083,5084,5085,5086,5087,5088,5089,5090,5091,5092,5093,5094,5095,5099,5100,5738,5980,5981,6130,6138,9013,9014,9015,9016,9017,9167,9170,9172,9174,9175,9326,9327,9328,9329,9330,9331,9332], - "stamps": [10,11,12,13,15,16,17,18,19,20,21,22,23] + "stamps": [13,11,2889,2896,1602,2886,1604,12,2877,2885,1603,2894,10,2899,2891,2876,376,2878,2879,2880,2881,2882,2884,2888,2898,2887,2890,377,2892,2893,2895,2900,378,2901,2902] } diff --git a/lib/ecards.js b/lib/ecards.js index ddf9288..d1cb52e 100644 --- a/lib/ecards.js +++ b/lib/ecards.js @@ -17,9 +17,12 @@ const {CURRENCIES, hasRoom, addClothing, sendClothingAdded, sendClothingRemoved} // ECardXtCommManager): a card, a stamp, a short message and perhaps a gift, // kept in the receiver's inbox (account.ecards) until they delete it. // -// which cards and stamps exist was a list on the official servers. the ones +// which cards and stamps exist was a list on the official servers. the cards // offered here were found by looking through the CDN's media files for card -// artwork (tools/find-art.py found what is in lib/ecard-art.json). +// artwork (tools/find-art.py found what is in lib/ecard-art.json); the +// stamps are the official list itself, as a recording of the official game +// has it (lib/official-lists.json, list 44): the ones guessed before were +// partly not stamps at all, and showed nothing. // ECard.type: what, if anything, comes with the card const TYPE_PLAIN = 0; diff --git a/lib/games.json b/lib/games.json index 7311eff..bfe9c01 100644 --- a/lib/games.json +++ b/lib/games.json @@ -1,84 +1,118 @@ [ - {"id": 4, "swf": "Pachinko", "title": "Gem Ball", "type": 1, "vars": [16, 17, 0], "icon": 4295}, - {"id": 5, "swf": "MiniGame_Memory", "title": "Double Up", "type": 1, "vars": [6, 7, 83], "icon": 4291}, - {"id": 6, "swf": "MoatMadness", "title": "Overflow", "type": 1, "vars": [8, 9, 80], "icon": 4300}, - {"id": 10, "swf": "ParachuteGlider", "title": "Wind Rider", "type": 1, "vars": [12, 13, 79], "start": "seed", "icon": 4311}, - {"id": 11, "swf": "Trivia", "title": "Temple of Trivia", "type": 1, "vars": [10, 11, 0], "ready": false, "icon": 4309}, - {"id": 12, "swf": "RiverRace", "title": "River Race", "type": 1, "vars": [22, 23, 0], "start": "seed"}, - {"id": 13, "swf": "PhantomFighter", "title": "Phantom Fighter", "type": 1, "vars": [14, 15, 84], "icon": 4312}, - {"id": 14, "swf": "SpiderShooter", "title": "Spider Zapper", "type": 1, "vars": [18, 19, 82], "start": "seed", "icon": 4305}, + {"id": 1, "swf": "PVP_TicTacToe", "title": "Tic Tac Toe", "type": 0, "vars": [63,0,0], "icon": 5063, "card": 5055, "buddy": true}, + {"id": 4, "swf": "Pachinko", "title": "Gem Ball", "type": 1, "vars": [16,17,0], "icon": 4295, "card": 58}, + {"id": 5, "swf": "MiniGame_Memory", "title": "Double Up", "type": 1, "vars": [6,7,0], "icon": 4291, "card": 61}, + {"id": 6, "swf": "MoatMadness", "title": "Overflow", "type": 1, "vars": [8,9,9], "icon": 4300, "card": 59}, + {"id": 10, "swf": "ParachuteGlider", "title": "Wind Rider", "type": 1, "vars": [12,13,0], "start": "seed", "icon": 4311, "card": 65}, + {"id": 11, "swf": "Trivia", "title": "Temple of Trivia", "type": 1, "vars": [10,11,0], "icon": 4309, "card": 64, "ready": false}, + {"id": 12, "swf": "RiverRace", "title": "River Race", "type": 1, "vars": [22,23,0], "start": "seed", "card": 62}, + {"id": 13, "swf": "PhantomFighter", "title": "Phantom Fighter", "type": 1, "vars": [14,15,0], "icon": 4312, "card": 60}, + {"id": 14, "swf": "SpiderShooter", "title": "Spider Zapper", "type": 1, "vars": [18,19,0], "start": "seed", "icon": 4305, "card": 63}, {"id": 15, "swf": "MicroPopcorn", "title": "Popcorn Machine", "type": 0}, {"id": 16, "swf": "MicroCrane", "title": "The Claw", "type": 0}, {"id": 17, "swf": "MicroSmoothie", "title": "Smoothie Machine", "type": 0}, - {"id": 19, "swf": "WindRider", "title": "Sky High", "type": 1, "vars": [26, 27, 0], "icon": 4304}, - {"id": 20, "swf": "Twister", "title": "Twister", "type": 1, "vars": [24, 25, 81], "icon": 4310}, - {"id": 22, "swf": "DistanceChallenge", "title": "Long Shot", "type": 1, "vars": [20, 21, 0], "icon": 4298}, - {"id": 23, "swf": "ArtStudioPrint", "title": "Coloring", "type": 1}, - {"id": 26, "swf": "ArtStudioPottery", "title": "Pottery", "type": 1}, - {"id": 27, "swf": "MicroPhantom", "title": "Phantom Vortex", "type": 0}, - {"id": 28, "swf": "TowerDefense", "title": "Pest Control", "type": 1, "vars": [130, 131, 132], "icon": 4301}, - {"id": 30, "swf": "GemBreaker", "title": "Gem Breaker", "type": 1, "vars": [91, 93, 92], "start": "seedAndPlayers", "icon": 4313}, - {"id": 34, "swf": "MicroMiraSays", "title": "Mira Says", "type": 1, "vars": [77, 76, 0], "icon": 4299}, - {"id": 35, "swf": "FortSmasher", "title": "Fruit Slinger", "type": 1, "vars": [143, 144, 145], "ready": false, "icon": 4294}, - {"id": 36, "swf": "MicroHotCocoa", "title": "Hot Cocoa Machine", "type": 0}, - {"id": 37, "swf": "SuperSort", "title": "Super Sort", "type": 1, "vars": [31, 32, 37], "icon": 4307}, - {"id": 39, "swf": "PillBugs", "title": "Pill Bugs", "type": 1, "vars": [277, 278, 279], "icon": 4303}, - {"id": 40, "swf": "BradyExpeditions", "title": "Brady Expeditions", "type": 1}, - {"id": 41, "swf": "PhantomsTreasure", "title": "Phantom's Treasure", "type": 1, "vars": [281, 283, 282], "icon": 4302}, - {"id": 42, "swf": "FeedingFrenzy", "title": "Eat 'Em Up", "type": 1, "vars": [284, 285, 0], "icon": 4292}, - {"id": 43, "swf": "MicroPetWash", "title": "Pet Wash", "type": 0}, - {"id": 48, "swf": "FashionShow", "title": "Best Dressed", "type": 1, "vars": [292, 293, 294], "ready": false, "icon": 4288}, - {"id": 51, "swf": "ArtStudioPainting", "title": "Painting", "type": 1}, - {"id": 52, "swf": "MicroPetSalon", "title": "Pet Stop", "type": 0}, - {"id": 55, "swf": "MicroGameInvasion", "title": "Phantom Invasion", "type": 0}, + {"id": 18, "swf": "MicroCrane", "title": "The Claw", "type": 0}, + {"id": 19, "swf": "WindRider", "title": "Sky High", "type": 1, "vars": [26,27,0], "icon": 4304, "card": 78}, + {"id": 20, "swf": "Twister", "title": "Twister", "type": 1, "vars": [24,25,0], "icon": 4310, "card": 79}, + {"id": 21, "swf": "FrogFlyer", "title": "Long Shot", "type": 1, "ready": false}, + {"id": 22, "swf": "DistanceChallenge", "title": "Long Shot", "type": 1, "vars": [20,21,21], "icon": 4298, "card": 80}, + {"id": 23, "swf": "ArtStudioPrint", "title": "Coloring", "type": 1, "card": 58}, + {"id": 24, "swf": "ArtStudioColor", "title": "Coloring", "type": 1, "card": 58, "ready": false}, + {"id": 25, "swf": "ParachuteGliderTest", "title": "Wind Rider", "type": 1, "card": 65, "ready": false}, + {"id": 26, "swf": "ArtStudioPottery", "title": "Pottery", "type": 1, "card": 58}, + {"id": 27, "swf": "MicroPhantom", "title": "Phantom Vortex", "type": 0, "card": 69}, + {"id": 28, "swf": "TowerDefense", "title": "Pest Control", "type": 1, "vars": [130,131,132], "icon": 4301, "card": 456}, + {"id": 29, "swf": "GemBreaker", "title": "Gem Breaker", "type": 1, "start": "seedAndPlayers", "card": 58}, + {"id": 30, "swf": "GemBreaker", "title": "Gem Breaker", "type": 1, "vars": [91,32,0], "start": "seedAndPlayers", "icon": 4313, "card": 354}, + {"id": 31, "swf": "PVP_ConnectFour", "title": "Four Gems", "type": 0, "icon": 5057, "card": 5049, "buddy": true}, + {"id": 32, "swf": "PVP_RockPaperScissor", "title": "Rock Paper Scissors", "type": 0, "icon": 5060, "card": 5052, "buddy": true}, + {"id": 34, "swf": "MicroMiraSays", "title": "Mira Says", "type": 1, "vars": [77,76,0], "icon": 4299, "card": 288}, + {"id": 35, "swf": "FortSmasher", "title": "Fruit Slinger", "type": 1, "vars": [74,75,0], "icon": 4294, "card": 541, "ready": false}, + {"id": 36, "swf": "MicroHotCocoa", "title": "Hot Cocoa Machine", "type": 0, "vars": [95,0,0]}, + {"id": 37, "swf": "SuperSort", "title": "Super Sort", "type": 1, "vars": [31,32,37], "icon": 4307, "card": 353}, + {"id": 38, "swf": "PVP_ShellGame", "title": "Shell Game", "type": 0, "icon": 5062, "card": 5054, "buddy": true}, + {"id": 39, "swf": "PillBugs", "title": "Pill Bugs", "type": 1, "vars": [277,278,279], "icon": 4303, "card": 1098}, + {"id": 40, "swf": "BradyChemistrySet", "title": "Brady's Lab", "type": 0, "vars": [115,0,0]}, + {"id": 41, "swf": "PhantomsTreasure", "title": "Phantom's Treasure", "type": 1, "vars": [281,283,282], "icon": 4302, "card": 1140}, + {"id": 42, "swf": "FeedingFrenzy", "title": "Eat 'Em Up", "type": 1, "vars": [284,0,0], "icon": 4292, "card": 1170}, + {"id": 43, "swf": "MicroPetWash", "title": "Pet Wash", "type": 0, "vars": [51,0,0]}, + {"id": 45, "swf": "PVP_Marbles", "title": "Marbles", "type": 0, "icon": 5058, "card": 5050, "buddy": true}, + {"id": 46, "swf": "OffTheHook", "title": "Off the Hook", "type": 1, "card": 79, "ready": false}, + {"id": 47, "swf": "Pinball", "title": "Double Up", "type": 1, "card": 61, "ready": false}, + {"id": 48, "swf": "FashionShow", "title": "Best Dressed", "type": 1, "vars": [292,293,294], "icon": 4288, "card": 1205, "ready": false}, + {"id": 49, "swf": "Geography", "title": "Geography", "type": 1, "card": 79, "ready": false}, + {"id": 51, "swf": "ArtStudioPainting", "title": "Painting", "type": 1, "vars": [78,0,0], "card": 4849}, + {"id": 52, "swf": "MicroPetSalon", "title": "Pet Stop", "type": 0, "vars": [280,0,0], "card": 1205}, + {"id": 53, "swf": "PVP_Scooped", "title": "Scooped", "type": 0, "icon": 5061, "card": 5053, "buddy": true}, + {"id": 54, "swf": "Glide", "title": "Glide", "type": 1, "card": 79, "ready": false}, + {"id": 55, "swf": "MicroGameInvasion", "title": "Phantom Invasion", "type": 0, "card": 1205}, + {"id": 56, "swf": "ActivityGeography", "title": "Eat 'Em Up", "type": 1, "card": 1205, "ready": false}, {"id": 57, "swf": "MicroCrane", "title": "The Claw", "type": 0}, + {"id": 58, "swf": "MicroCrane", "title": "The Claw", "type": 0}, {"id": 59, "swf": "MicroCrane", "title": "The Claw", "type": 0, "icon": 4290}, - {"id": 60, "swf": "TouchPool", "title": "Touch Pool", "type": 1, "vars": [310, 308, 309], "icon": 5229}, - {"id": 61, "swf": "MicroCrane", "title": "The Claw", "type": 0}, - {"id": 62, "swf": "HorseRace", "title": "Jamaa Derby", "type": 1, "vars": [327, 328, 330], "ready": false, "icon": 4297}, - {"id": 63, "swf": "MicroPuppy", "title": "Disc Toss", "type": 0, "vars": [313, 314, 315], "pet": 4}, - {"id": 64, "swf": "MicroDucky", "title": "Ducky Dash", "type": 0, "vars": [316, 317, 318], "pet": 3}, - {"id": 65, "swf": "MicroSnake", "title": "Sssssnake", "type": 0, "vars": [321, 322, 323], "pet": 11}, - {"id": 66, "swf": "FashionShow", "title": "Best Dressed", "type": 1, "vars": [292, 293, 294], "ready": false, "icon": 4289}, - {"id": 68, "swf": "Skeeball", "title": "Phantom Ball", "type": 1, "tickets": 10}, - {"id": 69, "swf": "WhackPhantom", "title": "Whack-A-Phantom", "type": 1, "tickets": 10}, - {"id": 70, "swf": "CandyCatcher", "title": "Candy Catch", "type": 1, "tickets": 10}, + {"id": 60, "swf": "TouchPool", "title": "Touch Pool", "type": 1, "vars": [310,308,309], "icon": 5229, "card": 5228}, + {"id": 61, "swf": "MicroCrane", "title": "The Claw", "type": 0, "card": 65}, + {"id": 62, "swf": "HorseRace", "title": "Jamaa Derby", "type": 1, "vars": [327,328,330], "icon": 4297, "card": 1510, "ready": false}, + {"id": 63, "swf": "MicroPuppy", "title": "Disc Toss", "type": 0, "vars": [313,314,315], "pet": 4}, + {"id": 64, "swf": "MicroDucky", "title": "Ducky Dash", "type": 0, "vars": [316,317,318], "pet": 3}, + {"id": 65, "swf": "MicroSnake", "title": "Sssssnake", "type": 0, "vars": [321,322,323], "pet": 11}, + {"id": 66, "swf": "FashionShow", "title": "Best Dressed", "type": 1, "vars": [292,293,294], "icon": 4289, "card": 1482, "ready": false}, + {"id": 67, "swf": "MicroCrane", "title": "The Claw", "type": 0}, + {"id": 68, "swf": "Skeeball", "title": "Phantom Ball", "type": 0, "tickets": 10}, + {"id": 69, "swf": "WhackPhantom", "title": "Whack-A-Phantom", "type": 0, "vars": [78,0,0], "tickets": 10, "card": 300}, + {"id": 70, "swf": "CandyCatcher", "title": "Candy Catch", "type": 0, "tickets": 10, "card": 300}, {"id": 71, "swf": "MicroCrane", "title": "The Claw", "type": 0}, - {"id": 72, "swf": "MicroGameInvasion", "title": "Phantom Invasion", "type": 0}, - {"id": 73, "swf": "ArtPrintPlayPortrait", "title": "Painting", "type": 1}, - {"id": 74, "swf": "CottonCandy", "title": "Cotton Candy Machine", "type": 0}, - {"id": 75, "swf": "MicroCrane", "title": "The Claw", "type": 0}, - {"id": 76, "swf": "ArtStudioPrint", "title": "Coloring", "type": 1}, - {"id": 77, "swf": "FallingPhantoms", "title": "Falling Phantoms", "type": 1, "vars": [344, 345, 346], "ready": false, "icon": 4293}, - {"id": 78, "swf": "DolphinRace", "title": "Splash and Dash", "type": 1, "vars": [357, 358, 360], "ready": false, "icon": 4306}, - {"id": 80, "swf": "ShootingGallery", "title": "Carnival Darts", "type": 1, "tickets": 100}, - {"id": 81, "swf": "MicroPetSalon", "title": "Pet Stop", "type": 0}, - {"id": 82, "swf": "FastFoodies", "title": "Fast Foodies", "type": 1, "vars": [445, 444, 446], "icon": 5727}, - {"id": 83, "swf": "HedgeHog", "title": "Hedge Hog", "type": 1, "vars": [349, 350, 351], "icon": 4296}, + {"id": 72, "swf": "MicroGameInvasion", "title": "Phantom Invasion", "type": 0, "card": 259}, + {"id": 73, "swf": "ArtPrintPlayPortrait", "title": "Painting", "type": 1, "vars": [78,0,0], "card": 1205}, + {"id": 74, "swf": "CottonCandy", "title": "Cotton Candy Machine", "type": 0, "vars": [78,0,0]}, + {"id": 75, "swf": "MicroCrane", "title": "The Claw", "type": 0, "card": 300}, + {"id": 76, "swf": "ArtPrintPlayPortrait", "title": "Painting", "type": 0}, + {"id": 77, "swf": "FallingPhantoms", "title": "Falling Phantoms", "type": 1, "vars": [344,345,346], "icon": 4293, "card": 1622, "ready": false}, + {"id": 78, "swf": "DolphinRace", "title": "Splash and Dash", "type": 1, "vars": [357,358,360], "icon": 4306, "card": 1804, "ready": false}, + {"id": 80, "swf": "ShootingGallery", "title": "Carnival Darts", "type": 0, "tickets": 100}, + {"id": 81, "swf": "MicroPetSalon", "title": "Pet Stop", "type": 0, "vars": [57,0,0], "card": 259}, + {"id": 82, "swf": "FastFoodies", "title": "Fast Foodies", "type": 1, "vars": [445,444,446], "icon": 5727}, + {"id": 83, "swf": "HedgeHog", "title": "Hedge Hog", "type": 1, "vars": [349,350,351], "icon": 4296, "card": 1713}, {"id": 85, "swf": "MicroCrane", "title": "The Claw", "type": 0}, - {"id": 86, "swf": "ArtStudioPrint", "title": "Coloring", "type": 1}, - {"id": 87, "swf": "BradyChemistrySet", "title": "Brady's Lab", "type": 0}, + {"id": 86, "swf": "ArtPrintPlayPortrait", "title": "Painting", "type": 0}, + {"id": 87, "swf": "ArtPrintPlayPortrait", "title": "Painting", "type": 0}, {"id": 88, "swf": "SafetyQuiz", "title": "Safety Quiz", "type": 0}, - {"id": 94, "swf": "EagleFlap", "title": "Swoopy Eagle", "type": 1, "vars": [378, 377, 0], "icon": 4308}, - {"id": 96, "swf": "DunkAPhantom", "title": "Dunk-A-Phantom", "type": 1, "tickets": 10}, - {"id": 97, "swf": "SpotOn", "title": "Spot On", "type": 1, "vars": [386, 387, 388], "icon": 4321}, + {"id": 89, "swf": "ArtStudioPrint", "title": "Coloring", "type": 0}, + {"id": 90, "swf": "BradyExpeditions", "title": "Brady Expeditions", "type": 1}, + {"id": 91, "swf": "MicroSmoothie", "title": "Smoothie Machine", "type": 0}, + {"id": 92, "swf": "ParachuteGlider2", "title": "Wind Rider", "type": 1, "card": 65, "ready": false}, + {"id": 93, "swf": "QuestParachuteGlider", "title": "Wind Rider", "type": 1, "vars": [12,13,0], "card": 65, "ready": false}, + {"id": 94, "swf": "EagleFlap", "title": "Swoopy Eagle", "type": 1, "vars": [378,377,0], "icon": 4308, "card": 2647}, + {"id": 95, "swf": "ArtPrintPlayPortrait", "title": "Painting", "type": 0}, + {"id": 96, "swf": "DunkAPhantom", "title": "Dunk-A-Phantom", "type": 0, "tickets": 10, "card": 300}, + {"id": 97, "swf": "SpotOn", "title": "Spot On", "type": 1, "vars": [386,387,388], "icon": 4321, "card": 3561}, + {"id": 98, "swf": "MicroCrane", "title": "The Claw", "type": 0, "vars": [5,0,0]}, {"id": 99, "swf": "MicroCrane", "title": "The Claw", "type": 0}, {"id": 100, "swf": "MicroCrane", "title": "The Claw", "type": 0}, - {"id": 102, "swf": "TrueFalse", "title": "Best Guess", "type": 1, "vars": [403, 405, 0], "ready": false}, + {"id": 101, "swf": "PVP_Memory", "title": "Pairs", "type": 0, "icon": 5059, "card": 5051, "buddy": true}, + {"id": 102, "swf": "TrueFalse", "title": "Best Guess", "type": 1, "vars": [403,0,0], "card": 3748, "ready": false}, {"id": 103, "swf": "MicroCrane", "title": "The Claw", "type": 0}, - {"id": 104, "swf": "MicroCrane", "title": "The Claw", "type": 0}, - {"id": 105, "swf": "MicroCrane", "title": "The Claw", "type": 0}, - {"id": 106, "swf": "MicroCrane", "title": "The Claw", "type": 0}, + {"id": 104, "swf": "MicroCrane", "title": "The Claw", "type": 0, "card": 300}, + {"id": 105, "swf": "MicroCrane", "title": "The Claw", "type": 0, "card": 61}, + {"id": 106, "swf": "MicroCrane", "title": "The Claw", "type": 0, "card": 61}, {"id": 107, "swf": "MicroCrane", "title": "The Claw", "type": 0}, + {"id": 108, "swf": "PVP_Bowling", "title": "Bowling", "type": 0, "icon": 5056, "card": 5048, "buddy": true}, {"id": 109, "swf": "MicroCrane", "title": "The Claw", "type": 0}, {"id": 110, "swf": "MicroCrane", "title": "The Claw", "type": 0}, + {"id": 111, "swf": "MicroGoldPanning", "title": "Long Shot", "type": 0, "vars": [415,0,0], "ready": false}, + {"id": 112, "swf": "MicroOatHarvest", "title": "Slingshot", "type": 0, "vars": [415,0,0], "ready": false}, + {"id": 113, "swf": "MicroWoodGather", "title": "Slingshot", "type": 0, "vars": [415,0,0], "ready": false}, + {"id": 114, "swf": "MicroStoneMining", "title": "Slingshot", "type": 0, "vars": [415,0,0], "ready": false}, + {"id": 115, "swf": "MicroBambooHarvest", "title": "Slingshot", "type": 0, "vars": [415,0,0], "ready": false}, {"id": 116, "swf": "MicroCrane", "title": "The Claw", "type": 0}, {"id": 117, "swf": "MicroCrane", "title": "The Claw", "type": 0}, {"id": 118, "swf": "MicroCrane", "title": "The Claw", "type": 0}, {"id": 119, "swf": "MicroCrane", "title": "The Claw", "type": 0}, {"id": 120, "swf": "MicroCrane", "title": "The Claw", "type": 0}, {"id": 121, "swf": "MicroCrane", "title": "The Claw", "type": 0}, + {"id": 122, "swf": "ArtPrintPlayPortrait", "title": "Painting", "type": 0}, {"id": 123, "swf": "MicroCrane", "title": "The Claw", "type": 0}, + {"id": 124, "swf": "ArtPrintPlayPortrait", "title": "Painting", "type": 0}, {"id": 125, "swf": "MicroCrane", "title": "The Claw", "type": 0}, {"id": 126, "swf": "MicroCrane", "title": "The Claw", "type": 0}, {"id": 127, "swf": "MicroCrane", "title": "The Claw", "type": 0}, @@ -89,9 +123,11 @@ {"id": 132, "swf": "MicroCrane", "title": "The Claw", "type": 0}, {"id": 133, "swf": "MicroCrane", "title": "The Claw", "type": 0}, {"id": 134, "swf": "MicroCrane", "title": "The Claw", "type": 0}, - {"id": 136, "swf": "ArtStudioPrint", "title": "Coloring", "type": 1}, - {"id": 138, "swf": "FastFoodies", "title": "Fast Foodies", "type": 1, "vars": [445, 444, 446]}, - {"id": 139, "swf": "ArtStudioGridDrawing", "title": "Pixel Painting", "type": 1}, + {"id": 135, "swf": "ArtPrintPlayPortrait", "title": "Painting", "type": 0}, + {"id": 136, "swf": "ArtPrintPlayPortrait", "title": "Painting", "type": 0}, + {"id": 137, "swf": "ArtPrintPlayPortrait", "title": "Painting", "type": 0}, + {"id": 138, "swf": "FastFoodies", "title": "Fast Foodies", "type": 1, "vars": [445,444,446], "icon": 5727, "card": 5723}, + {"id": 139, "swf": "ArtStudioGridDrawing", "title": "Pixel Painting", "type": 1, "card": 5958}, {"id": 140, "swf": "MicroCrane", "title": "The Claw", "type": 0}, {"id": 141, "swf": "MicroCrane", "title": "The Claw", "type": 0}, {"id": 142, "swf": "MicroCrane", "title": "The Claw", "type": 0}, @@ -103,16 +139,11 @@ {"id": 148, "swf": "MicroCrane", "title": "The Claw", "type": 0}, {"id": 149, "swf": "MicroCrane", "title": "The Claw", "type": 0}, {"id": 150, "swf": "MicroCrane", "title": "The Claw", "type": 0}, + {"id": 151, "swf": "ArtStudioGridDrawing", "title": "Pixel Painting", "type": 1, "vars": [78,0,0], "card": 5958}, + {"id": 152, "swf": "ArtStudioPrint", "title": "Coloring", "type": 0}, {"id": 153, "swf": "MicroCrane", "title": "The Claw", "type": 0}, {"id": 154, "swf": "MicroCrane", "title": "The Claw", "type": 0}, {"id": 155, "swf": "MicroCrane", "title": "The Claw", "type": 0}, {"id": 156, "swf": "MicroCrane", "title": "The Claw", "type": 0}, - {"id": 89, "swf": "PVP_TicTacToe", "title": "Tic Tac Toe", "type": 0, "vars": [86, 87, 0], "buddy": true, "card": 5063}, - {"id": 90, "swf": "PVP_ConnectFour", "title": "Four Gems", "type": 0, "vars": [86, 87, 0], "buddy": true, "card": 5057}, - {"id": 91, "swf": "PVP_RockPaperScissor", "title": "Rock Paper Scissors", "type": 0, "vars": [86, 87, 0], "buddy": true, "card": 5060}, - {"id": 92, "swf": "PVP_ShellGame", "title": "Shell Game", "type": 0, "vars": [86, 87, 0], "buddy": true, "card": 5062}, - {"id": 93, "swf": "PVP_Memory", "title": "Pairs", "type": 0, "vars": [86, 87, 0], "buddy": true, "card": 5059}, - {"id": 95, "swf": "PVP_Scooped", "title": "Scooped", "type": 0, "vars": [86, 87, 0], "buddy": true, "card": 5061}, - {"id": 98, "swf": "PVP_Bowling", "title": "Bowling", "type": 0, "vars": [86, 87, 0], "buddy": true, "card": 5056}, - {"id": 101, "swf": "PVP_Marbles", "title": "Marbles", "type": 0, "vars": [86, 87, 0], "buddy": true, "card": 5058} + {"id": 158, "swf": "ArtPrintPlayPortrait", "title": "Painting", "type": 1, "vars": [78,0,0], "card": 1205} ] diff --git a/lib/items.js b/lib/items.js index b997ef7..f506acd 100644 --- a/lib/items.js +++ b/lib/items.js @@ -19,6 +19,7 @@ const LAYER_EYES = "3"; const MAX_RECYCLED_AT_ONCE = 500; const MAX_USED_AT_ONCE = 200; // pieces put on or taken off in one message const RECYCLE_FRACTION = 0.3; // matches recyclePercentage sent at login +const CURRENCY_GEMS = 0; // ItemXtCommManager.currencyUpdateResponse's currency type module.exports = ({others, sendItemList}) => { // ItemXtCommManager.itemBuyResponse: [status, shopId, newAmount, currencyType] @@ -141,6 +142,24 @@ module.exports = ({others, sendItemList}) => { session.sendXt("ce", -1, 1, account.currency[paid]); }, + // gui.MuseumDonation: [amount], gems given to the museum's causes. the + // reply (currencyDonationResponse) is [1] or [0]; the gems go, and the + // account keeps count of what it has given. + cd(session, roomId, [amount]) { + const {account} = session; + const gems = /^\d{1,9}$/.test(String(amount)) ? Number(amount) : 0; + if (gems < 1 || (account.currency.gems || 0) < gems) { + session.sendXt("cd", -1, 0); + return; + } + account.currency.gems -= gems; + account.gemsDonated = (account.gemsDonated || 0) + gems; + achievements.currencyChanged(account, "gems", -gems); + accounts.save(account); + session.sendXt("cu", -1, CURRENCY_GEMS, account.currency.gems, 0); + session.sendXt("cd", -1, 1); + }, + // ItemXtCommManager.requestItemRecycle: [invIdx, ...]. the reply // (itemRecycleResponse) is [count, newGemTotal, ...recycledInvIdx], and // the recycling window then waits, behind its spinner, for the item diff --git a/lib/minigames.js b/lib/minigames.js index 830286a..b08d069 100644 --- a/lib/minigames.js +++ b/lib/minigames.js @@ -17,10 +17,14 @@ const {activeAvatar, addClothing, sendClothingAdded} = require("./player.js"); // game: the room it runs in, the start signal, gem awards, and for some // games a few messages of their own. // -// lib/games.json is that table, put back together from what still names the -// ids: arcade-machine den items (gameDefId and a name), the room files (which -// id stands where), the names GameCardPopup has for each game class, and the -// achievement defs (which user vars a game counts in). entries: +// lib/games.json is that table, as a recording of the official game has it +// (its "mi" reply, made with tools/recorder.js): which class each id runs, +// in a window or in the room's place, its user vars and its pictures. it +// was first put back together from what still names the ids (arcade-machine +// den items, the room files, GameCardPopup's names, the achievement defs), +// which had some ids wrong: the print kits, the carnival games (run in the +// room, not in its place), Brady's lab, and the buddy games, given ids of +// other games' as nothing then named theirs. entries: // id game def id // swf the game's key in game.IncludeMinigames // title its name; sent as the id of the localization string that says so @@ -33,10 +37,9 @@ const {activeAvatar, addClothing, sendClothingAdded} = require("./player.js"); // icon media id of its picture in the HUD's Games window; the games with // one are the ones that window lists // buddy true: one of the eight games two players play from a player's -// card (lib/buddygames.js). their ids are ours: nothing in the -// client names them, and the official table is gone. -// card a buddy game's picture, on the card's game tab and in the -// invitation +// card (lib/buddygames.js) +// card the game's title picture on its "Play!" popup; a buddy game's +// in the invitation // // every other game is played alone (minPlayers = maxPlayers = 1): the // multiplayer ones each have a protocol of their own between the players. @@ -123,8 +126,8 @@ module.exports = ({tell, leaveRoom, findOnline, blocks, watchers}) => { game.buddy ? 2 : MULTIPLAYER[game.swf] ? MULTIPLAYER[game.swf].max : 1, 0, // max spectators game.type, - // the game card: the title picture on the "play" popup (not known), and - // for a buddy game the picture in the invitation. + // the game card: the title picture on the "play" popup, and for a buddy + // game the picture in the invitation. game.card || 0, ...(game.vars || [0, 0, 0]), game.buddy ? 1 : 0, // ready for player-versus-player: listed on players' cards diff --git a/lib/official-lists.json b/lib/official-lists.json new file mode 100644 index 0000000..d546494 --- /dev/null +++ b/lib/official-lists.json @@ -0,0 +1 @@ +{"10":{"type":1033,"count":141,"entries":["9329","0","9326","0","9332","0","9330","0","9331","0","9327","0","9328","0","9167","0","9170","0","9172","0","9174","0","9175","0","9176","0","9013","0","9014","0","9015","0","9016","0","9017","0","4452","0","2702","0","4451","0","2706","0","4453","0","2762","0","2711","0","2716","0","2715","0","2723","0","2697","0","2717","0","4478","0","1250","0","1251","0","1354","0","1426","0","1627","0","5738","0","346","0","86","0","124","0","118","0","2805","0","2806","0","2807","0","2808","0","2809","0","2810","0","2811","0","2812","0","2813","0","2814","0","2815","0","2816","0","2817","0","2818","0","2819","0","2820","0","2821","0","2822","0","2823","0","2824","0","2825","0","2826","0","2827","0","2828","0","1","0","4547","0","4542","0","4544","0","4549","0","4540","0","4548","0","4538","0","4539","0","4541","0","4543","0","4545","0","4546","0","2708","0","4470","0","356","0","5077","0","5078","0","5079","0","2705","0","4457","0","4465","0","2703","0","2709","0","5092","0","5093","0","5094","0","5095","0","4856","0","2712","0","2713","0","2714","0","4477","0","6130","0","6138","0","4777","0","4778","0","4779","0","4780","0","4855","0","5980","0","5981","0","4435","0","4946","0","4460","0","4461","0","4462","0","2707","0","4454","0","5088","0","5089","0","5090","0","5091","0","4455","0","2700","0","1188","0","2704","0","4459","0","4467","0","4468","0","4469","0","4393","0","5073","0","5074","0","5075","0","5076","0","4410","0","5084","0","5085","0","5086","0","5087","0","4466","0","5080","0","5081","0","5082","0","5083","0"]},"16":{"type":1023,"count":50,"entries":["551","552","553","554","555","556","557","564","558","569","559","1831","573","560","578","561","576","562","563","579","565","1841","568","574","566","1845","567","570","577","575","1830","571","1844","1826","572","1835","1839","1832","1843","1829","1827","1842","1828","1846","1838","1833","1840","1836","1837","1834"]},"44":{"type":1033,"count":35,"entries":["13","0","11","0","2889","0","2896","0","1602","0","2886","0","1604","0","12","0","2877","0","2885","0","1603","0","2894","0","10","0","2899","0","2891","0","2876","0","376","0","2878","0","2879","0","2880","0","2881","0","2882","0","2884","0","2888","0","2898","0","2887","0","2890","0","377","0","2892","0","2893","0","2895","0","2900","0","378","0","2901","0","2902","0"]},"53":{"type":1033,"count":14,"entries":["1389","1603","1545","1600","1595","1601","1265","1604","1470","1599","1232","1790","2279","3726","2015","0","7061","18253","1185","912","1192","1571","1186","913","1187","914","6189","0"],"note":"not recorded: the Journey Book's pages, found among the media files by their jb_title parts, and each land's name"},"54":{"type":1035,"count":160,"entries":["634","7044","32198","32199","10","459","0","635","7045","32200","32201","10","459","1","636","7046","32202","32203","10","459","2","637","7047","32204","32205","10","459","3","638","7048","32206","32207","10","459","4","639","7049","32208","32209","10","459","5","640","7050","32210","32211","10","459","6","641","7051","32212","32213","10","459","7","642","7052","32214","32215","10","459","8","643","7053","32216","32217","10","459","9","606","6667","31309","31310","14","457","0","607","6666","31311","31312","14","457","1","608","6668","31313","31314","14","457","2","609","6670","31303","31304","14","457","3","610","6665","31307","31308","14","457","4","611","6669","31305","31306","14","457","5","578","6180","30096","30097","14","456","11","577","6181","30094","30095","14","456","10","576","6187","30092","30093","14","456","9","575","6186","30090","30091","14","456","8","574","6179","30088","30089","14","456","7","573","6178","30086","30087","14","456","6","572","6177","30084","30085","14","456","5","571","6176","30082","30083","14","456","4","570","6183","30080","30081","14","456","3","569","6182","30078","30079","14","456","2","568","6185","30076","30077","14","456","1","567","6184","30074","30075","14","456","0","140","775","812","848","10","289","0","141","777","814","850","10","289","1","142","780","817","853","10","289","2","143","125","808","844","10","289","3","144","776","813","849","10","289","4","145","772","809","845","10","289","5","146","774","811","847","10","289","6","147","778","815","851","10","289","7","148","781","818","854","10","289","8","149","779","816","852","10","289","9","150","773","810","846","10","289","10","151","815","832","868","10","291","0","152","821","840","876","10","291","1","153","817","834","871","10","291","2","154","824","843","883","10","291","3","155","820","839","875","10","291","4","156","819","838","873","10","291","5","157","818","835","872","10","291","6","158","822","841","879","10","291","7","159","823","842","880","10","291","8","160","816","833","869","10","291","9","161","784","821","857","10","290","0","162","786","823","859","10","290","1","163","813","830","866","10","290","2","164","788","825","861","10","290","3","165","783","820","856","10","290","4","166","814","831","867","10","290","5","167","790","827","863","10","290","6","168","782","819","855","10","290","7","169","812","829","865","10","290","8","170","787","824","860","10","290","9","171","793","828","864","10","290","10","172","785","822","858","10","290","11","174","789","862","826","10","288","0","175","830","917","916","10","288","1","176","831","1552","1553","10","288","2","177","832","1554","1555","10","288","3","178","833","1556","1557","10","288","4","179","834","1558","1559","10","288","5","180","835","1560","1561","10","288","6","181","836","1562","1563","10","288","7","182","838","1564","1565","10","288","8","183","837","1566","1567","10","288","9","173","852","1747","1748","10","295","0","184","853","1745","1746","10","295","1","185","854","1743","1744","10","295","2","186","855","1741","1742","10","295","3","187","856","1739","1740","10","295","4","188","857","1737","1738","10","295","5","189","858","1735","1736","10","295","6","190","859","1733","1734","10","295","7","191","860","1625","1626","10","295","8","192","862","1622","1623","10","295","9","193","863","1731","1732","10","295","10","195","1253","1926","1925","10","298","0","196","1254","1928","1927","10","298","1","197","1255","1930","1929","10","298","2","198","1256","1932","1931","10","298","3","199","1257","1934","1933","10","298","4","200","1258","1936","1935","10","298","5","201","1259","1938","1937","10","298","6","202","1260","1940","1939","10","298","7","203","1261","1942","1941","10","298","8","204","1262","1944","1943","10","298","9","205","1263","1946","1945","10","298","10","207","1356","2059","2060","10","311","0","208","1357","2061","2062","10","311","1","209","1358","2063","2064","10","311","2","210","1359","2065","2066","10","311","3","211","1360","2067","2068","10","311","4","212","1361","2069","2070","10","311","5","213","1362","2071","2072","10","311","6","214","1363","2073","2074","10","311","7","215","1364","2075","2076","10","311","8","216","1365","2077","2078","10","311","9","217","1366","2079","2080","10","311","10","233","1468","2245","2244","10","320","0","234","1458","2225","2224","10","320","1","235","1459","2227","2226","10","320","2","236","1460","2229","2228","10","320","3","237","1461","2231","2230","10","320","4","238","1462","2233","2232","10","320","5","239","1463","2235","2234","10","320","6","240","1464","2237","2236","10","320","7","241","1465","2239","2238","10","320","8","242","1466","2241","2240","10","320","9","243","1467","2243","2242","10","320","10","245","1530","2319","2318","10","333","0","246","1526","2321","2320","10","333","1","247","1531","2323","2322","10","333","2","248","1528","2325","2324","10","333","3","249","1521","2327","2326","10","333","4","250","1524","2329","2328","10","333","5","251","1525","2331","2330","10","333","6","252","1523","2333","2332","10","333","7","253","1527","2335","2334","10","333","8","254","1522","2337","2336","10","333","9","255","1529","2339","2338","10","333","10","266","1555","2400","2399","10","337","0","267","1556","2402","2401","10","337","1","268","1557","2404","2403","10","337","2","269","1558","2406","2405","10","337","3","270","1559","2408","2407","10","337","4","271","1560","2410","2409","10","337","5","272","1561","2412","2411","10","337","6","273","1562","2414","2413","10","337","7","274","1563","2416","2415","10","337","8","275","1564","2418","2417","10","337","9","276","1565","2420","2419","10","337","10","282","2003","3036","3037","14","365","0","283","2004","3038","3039","14","365","1","284","2005","3040","3041","14","365","2","285","2006","3042","3043","14","365","3","286","2007","3044","3045","14","365","4","287","2008","3046","3047","14","365","5","288","2009","3048","3049","14","365","6","289","2010","3050","3051","14","365","7","290","2011","3052","3053","14","365","8","291","2012","3054","3055","14","365","9","292","2013","3056","3057","14","365","10","293","2014","3058","3059","14","365","11","312","2224","3511","3510","10","371","0","313","2225","3513","3512","10","371","1","314","2226","3515","3514","10","371","2","315","2227","3517","3516","10","371","3","316","2228","3519","3518","10","371","4","317","2229","3521","3520","10","371","5","318","2230","3523","3522","10","371","6","319","2231","3525","3524","10","371","7","320","2232","3527","3526","10","371","8","321","2233","3529","3528","10","371","9","322","2234","3531","3530","10","371","10"]},"64":{"type":1003,"count":53,"entries":["53","3","52","51","50","48","49","47","46","45","44","43","42","41","40","39","38","37","36","35","34","33","32","14","12","4","11","25","13","26","8","10","30","23","1","31","2","16","27","15","9","18","5","28","6","24","7","17","29","19","20","22","21"]},"110":{"type":1049,"count":62,"entries":["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59","60","61","62"]},"166":{"type":1054,"count":9,"entries":["841","954","664","835","262","34","156","55","2"]},"214":{"type":1054,"count":50,"entries":["3355","14","153","254","675","79","1214","3251","69","1159","80","772","145","207","3550","87","111","4","290","123","3511","930","83","49","219","932","147","172","534","604","3409","2957","488","1238","157","880","1008","195","651","1404","216","289","615","103","444","100","415","403","56","68"]},"293":{"type":1054,"count":43,"entries":["835","1160","34","917","1192","1","1216","1107","1106","1007","988","954","914","889","732","664","635","594","487","438","362","309","285","262","253","231","224","201","171","156","610","150","133","2","71","55","15","97","113","86","3","841","382"]},"353":{"type":1058,"count":4,"entries":["11","4532","364","12","4741","404","13","4797","414","14","4847","418"],"note":"not recorded: rebuilt from the media files, where each book is its title page, pages and quiz just before its cover. only these four books could be found that way"},"354":{"type":1058,"count":4,"entries":["11","4532","364","12","4741","404","13","4797","414","14","4847","418"],"note":"not recorded: rebuilt from the media files, where each book is its title page, pages and quiz just before its cover. only these four books could be found that way"},"355":{"type":1058,"count":4,"entries":["11","4532","364","12","4741","404","13","4797","414","14","4847","418"],"note":"not recorded: rebuilt from the media files, where each book is its title page, pages and quiz just before its cover. only these four books could be found that way"},"356":{"type":1058,"count":4,"entries":["11","4532","364","12","4741","404","13","4797","414","14","4847","418"],"note":"not recorded: rebuilt from the media files, where each book is its title page, pages and quiz just before its cover. only these four books could be found that way"},"364":{"type":1033,"count":16,"entries":["4516","0","4517","0","4518","0","4519","0","4520","0","4521","0","4522","0","4523","0","4524","0","4525","0","4526","0","4527","0","4528","0","4529","0","4530","0","4531","0"],"note":"not recorded: rebuilt from the media files, where each book is its title page, pages and quiz just before its cover. only these four books could be found that way"},"404":{"type":1033,"count":15,"entries":["4726","0","4727","0","4728","0","4729","0","4730","0","4731","0","4732","0","4733","0","4734","0","4735","0","4736","0","4737","0","4738","0","4739","0","4740","0"],"note":"not recorded: rebuilt from the media files, where each book is its title page, pages and quiz just before its cover. only these four books could be found that way"},"414":{"type":1033,"count":16,"entries":["4781","0","4782","0","4783","0","4784","0","4785","0","4786","0","4787","0","4788","0","4789","0","4790","0","4791","0","4792","0","4793","0","4794","0","4795","0","4796","0"],"note":"not recorded: rebuilt from the media files, where each book is its title page, pages and quiz just before its cover. only these four books could be found that way"},"418":{"type":1033,"count":16,"entries":["4831","0","4832","0","4833","0","4834","0","4835","0","4836","0","4837","0","4838","0","4839","0","4840","0","4841","0","4842","0","4843","0","4844","0","4845","0","4846","0"],"note":"not recorded: rebuilt from the media files, where each book is its title page, pages and quiz just before its cover. only these four books could be found that way"},"627":{"type":1065,"count":1170,"entries":["1828","1829","1826","1827","1823","1824","1825","1830","1820","1821","1822","1811","1812","1813","1814","1815","1816","1817","1818","1819","1809","1810","1807","1808","1806","1801","1802","1803","1804","1805","1794","1795","1800","1792","1793","1782","1796","1799","1789","1790","1791","1798","1780","1797","1781","1783","1784","1785","1786","1787","1788","1777","1778","1779","1775","1776","1770","1771","1772","1773","1774","1769","1762","1763","1764","1765","1766","1767","1768","1759","1760","1756","1757","1758","1754","1755","1747","1748","1749","1761","1750","1751","1752","1753","1744","1745","1746","1742","1743","1732","1733","1734","1735","1736","1737","1738","1739","1740","1741","1730","1729","1727","1728","1731","1719","1720","1722","1723","1725","1726","1721","1717","1718","1715","1716","1698","1708","1709","1710","1711","1712","1713","1714","1707","1705","1706","1695","1696","1697","1699","1700","1701","1702","1703","1704","1694","1692","1693","1690","1691","1686","1687","1688","1689","1683","1684","1685","1682","1680","1681","1678","1679","1669","1670","1671","1672","1668","1673","1674","1675","1676","1677","1664","1665","1662","1663","1660","1661","1654","1666","1667","1655","1656","1657","1658","1659","1646","1647","1645","1644","1653","1643","1649","1650","1651","1652","1648","1634","1635","1637","1636","1638","1639","1640","1641","1642","1633","1631","1632","1629","1630","1623","1624","1625","1626","1627","1628","1621","1622","1617","1618","1619","1620","1612","1613","1614","1615","1616","1603","1604","1605","1606","1607","1608","1609","1610","1611","1599","1600","1601","1602","1598","1594","1595","1596","1597","1591","1592","1593","1584","1585","1586","1587","1588","1589","1590","1582","1583","1577","1578","1579","1580","1581","1574","1575","1576","1563","1564","1565","1566","1567","1568","1569","1570","1571","1572","1573","1562","1561","1559","1560","1558","1557","1536","1550","1551","1552","1553","1554","1555","1556","1548","1549","1545","1546","1547","1543","1542","1544","1534","1535","1537","1538","1539","1540","1541","1532","1533","1531","1530","1527","1528","1529","1523","1524","1525","1526","1514","1515","1516","1517","1518","1519","1520","1521","1522","1512","1513","1510","1511","1505","1506","1507","1508","1509","1503","1504","1501","1502","1499","1500","1494","1495","1496","1497","1498","1492","1493","1490","1491","1487","1488","1489","1479","1480","1481","1482","1483","1484","1485","1486","1478","1476","1477","1475","1470","1471","1472","1473","1474","1468","1469","1467","1463","1464","1465","1466","1462","1451","1452","1453","1454","1455","1456","1457","1458","1459","1460","1461","1450","1449","1448","1447","1446","1439","1440","1441","1442","1443","1444","1445","1438","1437","1435","1436","1427","1428","1429","1430","1431","1432","1433","1434","1425","1422","1423","1424","1421","1426","1419","1420","1409","1410","1408","1411","1412","1413","1414","1415","1416","1417","1418","1406","1407","1403","1404","1405","1402","1399","1400","1401","1394","1395","1396","1397","1398","1391","1392","1393","1389","1390","1386","1387","1388","1385","1378","1379","1380","1381","1382","1383","1384","1374","1375","1372","1373","1370","1371","1376","1377","1363","1364","1365","1366","1367","1368","1369","1360","1361","1362","1357","1358","1359","1353","1354","1355","1356","1346","1347","1348","1349","1350","1351","1352","1342","1343","1344","1345","1334","1335","1336","1337","1338","1339","1340","1341","1330","1331","1332","1333","1324","1325","1326","1327","1328","1329","1321","1322","1320","1317","1318","1319","1323","1314","1315","1316","1306","1307","1308","1309","1310","1311","1312","1313","1302","1303","1304","1300","1301","1298","1299","1291","1292","1293","1294","1295","1296","1297","1290","1286","1287","1284","1285","1289","1282","1283","1288","1276","1277","1278","1279","1280","1281","1275","1272","1273","1274","1269","1270","1271","1267","1268","1263","1264","1265","1266","1261","1262","1258","1259","1260","1256","1257","1254","1255","1247","1248","1249","1250","1251","1252","1253","1243","1244","1245","1246","1239","1240","1241","1242","1236","1237","1238","1229","1230","1231","1232","1233","1234","1235","1225","1226","1227","1228","1222","1223","1224","1218","1219","1220","1221","1214","1215","1216","1217","1207","1208","1209","1210","1211","1212","1213","1204","1205","1206","1202","1203","1198","1199","1200","1201","1192","1193","1194","1195","1196","1197","1190","1191","1186","1187","1181","1188","1189","1184","1185","1177","1178","1179","1180","1182","1183","1175","1176","1173","1174","1171","1172","1162","1163","1164","1165","1166","1167","1168","1169","1170","1161","1158","1159","1160","1152","1153","1154","1155","1156","1157","1151","1148","1149","1150","1143","1144","1145","1146","1147","1140","1141","1142","1138","1139","1135","1136","1137","1128","1129","1130","1131","1132","1133","1134","1125","1126","1127","1123","1124","1117","1118","1119","1120","1121","1122","1113","1114","1115","1116","1112","1105","1106","1107","1108","1110","1111","1097","1098","1099","1100","1101","1102","1103","1104","1096","1095","1094","1092","1093","1085","1086","1087","1088","1089","1090","1091","1084","1082","1080","1081","1078","1079","1083","1070","1071","1073","1072","1074","1075","1076","1077","1066","1067","1068","1062","1063","1064","1065","1057","1058","1059","1060","1061","1048","1049","1050","1051","1052","1069","1053","1054","1055","1056","1046","1047","1040","1045","1037","1038","1039","1041","1044","1035","1036","1043","1032","1033","1034","1042","1026","1027","1028","1029","1030","1031","1025","1022","1024","1013","1015","1021","1010","1011","1012","1008","1023","1016","1009","1014","1017","1018","1019","1020","1006","1007","1003","1005","1000","1001","1002","992","993","994","995","996","997","998","999","990","991","986","987","988","989","978","979","980","981","982","983","984","985","977","976","969","970","971","972","973","974","975","968","960","961","962","963","964","965","966","967","959","957","958","954","955","956","945","946","947","948","949","950","951","952","953","944","943","935","936","937","938","939","940","941","942","926","934","925","933","924","931","932","921","922","923","927","928","929","914","919","920","913","917","918","910","911","912","915","916","905","904","895","896","897","898","899","900","906","901","907","902","908","903","909","890","891","892","888","889","885","886","887","878","879","880","881","882","883","884","876","877","874","875","872","873","867","868","869","870","871","863","864","865","866","855","857","858","859","860","861","862","853","854","846","847","848","849","850","851","852","843","844","845","834","835","836","837","838","839","840","841","842","830","831","832","833","828","829","823","824","825","826","827","822","809","810","811","812","813","814","815","816","817","818","819","820","821","806","802","803","807","801","804","805","799","800","793","794","795","796","797","798","790","791","792","782","783","784","785","786","787","788","775","776","777","778","779","780","781","770","772","773","774","766","767","768","769","760","761","762","763","764","765","753","754","755","756","757","758","759","746","747","748","749","750","751","752","739","740","741","742","743","744","745","736","737","738","731","732","733","734","735","725","726","727","728","729","730","724","719","720","721","722","723","718","713","714","715","716","717","706","707","708","709","710","711","712","701","702","703","704","705","695","696","697","698","699","700","690","691","692","693","694","686","687","688","689","680","681","682","683","684","685","668","669","670","671","672","673","674","675","676","679","677","678","662","663","664","665","666","667","656","657","658","659","660","661","649","650","651","652","653","654"]},"741":{"type":1000,"count":1,"entries":["926"]},"742":{"type":1000,"count":1,"entries":["1458"]},"743":{"type":1000,"count":1,"entries":["1766"]},"744":{"type":1000,"count":1,"entries":["1787"]},"745":{"type":1000,"count":1,"entries":["1788"]},"746":{"type":1000,"count":1,"entries":["1789"]},"747":{"type":1000,"count":1,"entries":["1790"]},"748":{"type":1000,"count":4,"entries":["1963","1964","1965","1966"]},"749":{"type":1000,"count":1,"entries":["1976"]},"756":{"type":1000,"count":1,"entries":["1981"]},"761":{"type":1000,"count":1,"entries":["2073"]},"770":{"type":1000,"count":1,"entries":["2121"]}} \ No newline at end of file diff --git a/lib/world.js b/lib/world.js index f6651f3..8412664 100644 --- a/lib/world.js +++ b/lib/world.js @@ -19,6 +19,7 @@ const badges = require("./badges.js"); const bans = require("./bans.js"); const devices = require("./devices.js"); const chatlog = require("./chatlog.js"); +const support = require("./support.js"); const chatFilter = require("./chatfilter.js"); const chatSpam = require("./chatspam.js"); const chatStyles = require("./chatstyles.js"); @@ -128,6 +129,15 @@ const DEF_COMBINED_LIST = 1060; const DEF_DEN_ROOM = 1040; const DEF_CURRENCY_EXCHANGE = 1051; const DEF_DIAMOND = 1054; +// generic lists as the official server answered them (gl), recorded with +// tools/recorder.js: used where this server has none of its own. one was +// not recorded and is made up the same way: the Journey Book's pages (53), +// found among the media files (each has a "jb_title_" part) with the +// name of each land, which opens the book at the page of the land the +// player is in (GuiManager.onJourneyBookMediaListReceived). likewise the +// books of the Chamber of Knowledge (EBookChooser, lists 353-356) and their +// pages, for the four whose pages could be found. +const OFFICIAL_LISTS = require("./official-lists.json"); const SHOP_LIST_TYPES = [DEF_ITEM, DEF_DEN_ITEM, DEF_DEN_ROOM, DEF_COMBINED_LIST, DEF_CURRENCY_EXCHANGE, DEF_DIAMOND]; // a shop's title when its room gives it none (a shop in a land's main room, // or one opened from elsewhere): what it sells (strings in lib/defpacks.js). @@ -226,6 +236,11 @@ const sees = (viewer, subject) => (!subject.invisible || roles.isActiveStaff(vie && !(viewer.account.hideBlocked && blocks.has(viewer.account, subject.account)); // everyone else in the room who should hear about this player's animal. const watchers = session => others(session).filter(other => sees(other, session)); +// the game's feedback windows by type (FeedbackManager.frameLabelForType; +// the titles are the feedback defs' own), for the panel to say where a +// message came from +const FEEDBACK_KINDS = new Map([[1, "Theatre feedback"], [3, "Feedback"], [4, "Jamaa Journal feedback"], [5, "Feedback"], + [11, "Theatre feedback"], [18, "Jammer Wall feedback"], [19, "Chat feedback"], [21, "Theatre feedback"], [22, "Theatre feedback"]]); const TYPING_EVERY_MS = 2000; // "typing" passed on at most this often per player (xty) // tags ("@name") in chat and on Jammer Walls (xmn): the longest player's @@ -937,6 +952,16 @@ const handlers = { count = defpacks.petIds().length; entries = defpacks.petIds().flatMap(id => [id, 1]); } + // what the official server answered, where this one has nothing of its + // own (lib/official-lists.json, from recordings of the official game: + // the Journey Book's facts and pictures among them) + if ((count === undefined ? entries.length : count) === 0 && Object.hasOwn(OFFICIAL_LISTS, String(Number(listId)))) { + const official = OFFICIAL_LISTS[String(Number(listId))]; + if (official.type === type) { + entries = official.entries; + count = official.count; + } + } // for shops the first unused field is the title's string id; left empty // it keeps the shop window's own title (Shop.gotItemListCallback). const title = SHOP_LIST_TYPES.includes(type) ? (session.room && roomInfo.shopTitle(session.room.base, listId)) || SHOP_KIND_TITLES.get(type) : 0; @@ -1078,6 +1103,24 @@ const handlers = { } }, + // the game's feedback windows (the purple Help and Feedback buttons, the + // orbs in rooms, the newspaper's and the theatre's: the patched + // gui.FeedbackManager): xfb [the window's feedback type, the text]. it + // goes to the staff panels' feedback (lib/support.js), named by where it + // was written. + xfb(session, roomId, [type, ...text]) { + const where = FEEDBACK_KINDS.get(Number(type)) || "Feedback"; + const said = text.join("%").trim(); + if (!said) { + return; + } + const result = support.sendFeedback(session.account, "feedback", `${where} (in ${session.room ? session.room.displayName : "the game"}): ${said}`); + // the window has thanked them already; said only when it did not go + if (!result.ok) { + tell(session, result.error === "too_many" ? "You have sent a lot of feedback today. Try again tomorrow." : "That feedback could not be sent."); + } + }, + // the patched client's tags (AJClient.resolveMentions): xmn [id, the text // after each "@", ...] -> "xmn" [.., .., id, then for each text: how many // of its characters are a player's name (0 for none), the name as it is diff --git a/swf-src/FeedbackManager.as b/swf-src/FeedbackManager.as new file mode 100644 index 0000000..cbee2b1 --- /dev/null +++ b/swf-src/FeedbackManager.as @@ -0,0 +1,592 @@ +package gui +{ + import achievement.AchievementXtCommManager; + import com.sbi.analytics.SBTracker; + import com.sbi.client.KeepAlive; + import com.sbi.popup.SBStandardTitlePopup; + import flash.display.DisplayObjectContainer; + import flash.display.MovieClip; + import flash.events.Event; + import flash.events.MouseEvent; + import flash.external.ExternalInterface; + import flash.net.URLLoader; + import flash.net.URLRequest; + import flash.net.URLRequestHeader; + import flash.utils.ByteArray; + import loader.FeedbackDefHelper; + import loader.MediaHelper; + import localization.LocalizationManager; + + public class FeedbackManager + { + + public static const TYPE_ASK_BRADY:int = 1; + + public static const TYPE_ITEMS:int = 2; + + public static const TYPE_HOWL:int = 3; + + public static const TYPE_WORK:int = 4; + + public static const TYPE_GENERIC:int = 5; + + public static const TYPE_FLAGS:int = 6; + + public static const TYPE_PETS:int = 7; + + public static const TYPE_PARTIES:int = 8; + + public static const TYPE_EPIC_ITEMS:int = 9; + + public static const TYPE_ARCADE:int = 10; + + public static const TYPE_ASK_TIERNEY:int = 11; + + public static const TYPE_DONATION:int = 12; + + public static const TYPE_CARNIVAL:int = 13; + + public static const TYPE_ARTSTUDIO:int = 14; + + public static const TYPE_JAMSESSION:int = 15; + + public static const TYPE_DIAMOND:int = 16; + + public static const TYPE_ADVENTURE:int = 17; + + public static const TYPE_DICTIONARY:int = 18; + + public static const TYPE_CHAT_EXPERIENCE:int = 19; + + public static const TYPE_MASTERPIECES:int = 20; + + public static const TYPE_ASK_CAMI:int = 21; + + public static const TYPE_ASK_GABBY:int = 22; + + private static const TAB_MEDIA_ID:int = 153; + + private static const POPUP_MEDIA_ID:int = 457; + + private static const TAB_FRAME_LABEL:String = "answer"; + + private static var _feedbackDefCache:Array; + + private static var _feedbackLocs:Array; + + private static var _feedbackDefHelpers:Array; + + private static var _tabMediaHelper:MediaHelper; + + private static var _tabTemplate:MovieClip; + + private static var _popupMediaHelper:MediaHelper; + + private static var _popup:MovieClip; + + private static var _imageUploader:UserImageUpload; + + private static var _guiLayer:DisplayLayer; + + private static var _worldLayer:DisplayLayer; + + private static var _secondaryType:int; + + public function FeedbackManager() + { + super(); + } + + public static function init(param1:DisplayLayer, param2:DisplayLayer) : void + { + _feedbackDefCache = []; + _guiLayer = param1; + _worldLayer = param2; + _popupMediaHelper = new MediaHelper(); + _tabMediaHelper = new MediaHelper(); + _tabMediaHelper.init(153,mediaHelperCallback,true); + _imageUploader = new UserImageUpload(); + _imageUploader.init(); + if(ExternalInterface.available) + { + ExternalInterface.addCallback("openFeedback",handleOpenDefaultFeedback); + } + } + + public static function setUpOrbs(param1:Array, param2:Array) : void + { + var _loc4_:int = 0; + var _loc3_:Object = null; + var _loc5_:FeedbackDefHelper = null; + _feedbackLocs = param2; + _feedbackDefHelpers = []; + _loc4_ = 0; + while(_loc4_ < param1.length) + { + if(param1[_loc4_] == 0) + { + DarkenManager.showLoadingSpiral(false); + throw new Error("Id == 0"); + } + _loc3_ = _feedbackDefCache[param1[_loc4_]]; + if(!_loc3_) + { + _loc5_ = new FeedbackDefHelper(); + _loc5_.init(param1[_loc4_],onDefReceived); + _feedbackDefHelpers[param1[_loc4_]] = _loc5_; + } + else + { + setUpOrb(_loc3_); + } + _loc4_++; + } + } + + public static function openFeedbackPopup(param1:int) : void + { + var _loc3_:FeedbackDefHelper = null; + if(param1 == 0) + { + DarkenManager.showLoadingSpiral(false); + throw new Error("Id == 0"); + } + DarkenManager.showLoadingSpiral(true); + if(!_feedbackDefHelpers) + { + _feedbackDefHelpers = []; + } + var _loc2_:Object = _feedbackDefCache[param1]; + if(!_loc2_) + { + _loc3_ = new FeedbackDefHelper(); + _loc3_.init(param1,onDefReceived); + _feedbackDefHelpers[param1] = _loc3_; + } + else + { + displayFeedbackPopup(_loc2_); + } + } + + private static function handleOpenDefaultFeedback() : void + { + openFeedbackPopup(5); + } + + private static function onDefReceived(param1:FeedbackDefHelper) : void + { + var _loc5_:Object = param1.def; + var _loc4_:String = LocalizationManager.translateIdOnly(int(_loc5_.defaultStrRef)); + var _loc3_:RegExp = /\r\n/g; + _loc4_ = _loc4_.replace(_loc3_,"\n"); + _loc3_ = /\r/g; + _loc4_ = _loc4_.replace(_loc3_,"\n"); + var _loc2_:Object = { + "id":int(_loc5_.id), + "titleTxt":LocalizationManager.translateIdOnly(int(_loc5_.titleStrRef)), + "defaultTxt":_loc4_, + "thanksTxt":LocalizationManager.translateIdOnly(int(_loc5_.thankStrRef)), + "allowImg":Boolean(int(_loc5_.bAcceptImage)), + "userVarId":int(_loc5_.userVarRef), + "bitIdx":int(_loc5_.bitIndex) + }; + _feedbackDefCache[_loc2_.id] = _loc2_; + _feedbackDefHelpers[_loc2_.id] = null; + _loc2_.seen = gMainFrame.userInfo.userVarCache.isBitSet(_loc2_.userVarId,_loc2_.bitIdx); + if(_loc2_.id == 1 || _loc2_.id == 11 || _loc2_.id == 3 || _loc2_.id == 4 || _loc2_.id == 5 || _loc2_.id == 18 || _loc2_.id == 19 || _loc2_.id == 21 || _loc2_.id == 22) + { + displayFeedbackPopup(_loc2_); + } + else + { + setUpOrb(_loc2_); + } + } + + private static function setUpOrb(param1:Object) : void + { + var _loc3_:MovieClip = null; + var _loc2_:int = 0; + if(_tabTemplate) + { + _loc3_ = new _tabTemplate.constructor(); + _loc3_.def = param1; + _loc2_ = int(_loc3_.id = int(param1.id)); + _loc3_.x = _feedbackLocs[_loc2_].x; + _loc3_.y = _feedbackLocs[_loc2_].y; + if(param1.seen) + { + _loc3_.gotoAndPlay("answerDim"); + } + else + { + _loc3_.gotoAndPlay("answer"); + } + _loc3_.addEventListener("mouseDown",onTabMouseDown,false,0,true); + _worldLayer.addChild(_loc3_); + } + } + + private static function mediaHelperCallback(param1:MovieClip) : void + { + var _loc2_:int = 0; + if(param1) + { + if(param1.mediaHelper.id == 153) + { + _loc2_ = int(param1.mediaHelper.id); + _tabTemplate = MovieClip(param1.getChildAt(0)); + _tabMediaHelper.destroy(); + _tabMediaHelper = null; + } + else if(param1.mediaHelper.id == 457) + { + _popup = param1; + _popupMediaHelper.destroy(); + _popupMediaHelper = null; + _popup.x = 900 * 0.5; + _popup.y = 550 * 0.5; + _popup.parent.x = _popup.x; + _popup.parent.y = _popup.y; + displayFeedbackPopup(param1.passback); + } + } + } + + private static function onTabMouseDown(param1:MouseEvent) : void + { + param1.stopPropagation(); + var _loc2_:MovieClip = MovieClip(param1.currentTarget); + var _loc3_:Object = _loc2_.def; + SBTracker.push(); + SBTracker.trackPageview("/game/play/popup/feedback/" + _loc3_.id); + DarkenManager.showLoadingSpiral(true); + if(!_loc3_.seen) + { + _loc2_.gotoAndPlay("answerDim"); + } + displayFeedbackPopup(_loc3_); + } + + public static function displayFeedbackPopup(param1:Object) : void + { + var _loc3_:Array = null; + var _loc2_:int = int(param1.id); + if(!_popup) + { + _popupMediaHelper.init(457,mediaHelperCallback,param1); + return; + } + if(!param1.seen) + { + param1.seen = true; + AchievementXtCommManager.requestSetUserVar(param1.userVarId,param1.bitIdx); + } + removePopup(); + _popup.gotoAndStop(frameLabelForType(_loc2_)); + _popup.submitBtn.addEventListener("mouseDown",onMouseDown,false,0,true); + _popup.bx.addEventListener("mouseDown",onMouseDown,false,0,true); + _popup.addEventListener("mouseDown",onMouseDown,false,0,true); + _popup.txt.addEventListener("mouseDown",onMouseDown,false,0,true); + _popup.def = param1; + if(_popup["descTxt"]) + { + _loc3_ = param1.defaultTxt.split("|"); + LocalizationManager.updateToFit(_popup.descTxt,_loc3_[0]); + LocalizationManager.updateToFit(_popup.txt,_loc3_[1]); + } + else + { + LocalizationManager.updateToFit(_popup.txt,param1.defaultTxt); + } + _popup.defaultTxt = _popup.txt.text; + _popup.titleTxt.text = param1.titleTxt; + if(param1.allowImg) + { + _popup.addFileBtn.visible = true; + _imageUploader.setUploadBtn(_popup.addFileBtn); + _popup.removeFileBtn.addEventListener("mouseDown",onRemoveFileBtn,false,0,true); + } + else + { + if(_popup.addFileBtn) + { + _popup.addFileBtn.visible = false; + } + if(_popup.removeFileBtn) + { + _popup.removeFileBtn.visible = false; + } + } + _popup.txt.maxChars = maxCharsForType(_loc2_); + if(_loc2_ == 18) + { + _popup.txt.restrict = "^ "; + } + else + { + _popup.txt.restrict = null; + } + _popup.visible = true; + _popup.clickedTextBox = false; + KeepAlive.startKATimer(_popup); + DarkenManager.showLoadingSpiral(false); + DarkenManager.darken(DisplayObjectContainer(_popup)); + _guiLayer.addChild(DisplayObjectContainer(_popup)); + } + + private static function frameLabelForType(param1:int) : int + { + switch(param1) + { + case 1: + return 1; + case 3: + case 19: + return 2; + case 4: + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 13: + case 15: + case 16: + case 17: + break; + case 11: + return 4; + case 18: + return 6; + case 21: + return 7; + case 22: + return 8; + default: + return 1; + } + return 3; + } + + private static function maxCharsForType(param1:int) : int + { + switch(param1) + { + case 1: + case 11: + case 21: + case 22: + return 150; + case 3: + return 50; + case 4: + return 3000; + case 2: + case 9: + case 16: + case 10: + case 17: + case 5: + return 300; + case 12: + case 8: + case 7: + case 15: + case 6: + case 13: + case 14: + break; + case 19: + return 200; + case 18: + return 25; + default: + return 1; + } + return 100; + } + + private static function onRemoveFileBtn(param1:MouseEvent) : void + { + param1.stopPropagation(); + _imageUploader.resetUploader(); + _popup.addFileBtn.visible = true; + } + + private static function onMouseDown(param1:MouseEvent) : void + { + var _loc3_:String = null; + var _loc2_:RegExp = null; + param1.stopPropagation(); + if(param1.currentTarget == _popup) + { + return; + } + if(param1.currentTarget == _popup.txt) + { + if(!_popup.clickedTextBox) + { + _popup.txt.text = ""; + _popup.clickedTextBox = true; + gMainFrame.stage.focus = _popup.txt; + _popup.txt.setSelection(0,0); + } + return; + } + if(param1.currentTarget.name == "submitBtn") + { + _loc3_ = _popup.txt.text; + _loc2_ = /\r\n/g; + _loc3_ = _loc3_.replace(_loc2_,"\n"); + _loc2_ = /\r/g; + _loc3_ = _loc3_.replace(_loc2_,"\n"); + if(_loc3_.length > 0 && _loc3_ != _popup.defaultTxt || _imageUploader.fileName != "") + { + if(_loc3_ == _popup.def.defaultTxt) + { + _loc3_ = _popup.txt.text = ""; + } + setupRequest(_imageUploader,_loc3_,_popup.def.id,_secondaryType,onSendComplete,onSendError); + } + } + removePopup(param1.currentTarget.name == "bx"); + } + + private static function removePopup(param1:Boolean = true) : void + { + if(_popup) + { + _popup.removeEventListener("mouseDown",onMouseDown); + _popup.bx.removeEventListener("mouseDown",onMouseDown); + _popup.submitBtn.removeEventListener("mouseDown",onMouseDown); + _popup.txt.removeEventListener("mouseDown",onMouseDown); + if(_popup.def && _popup.def.allowImg) + { + _imageUploader.resetUploader(); + _popup.addFileBtn.visible = true; + _popup.removeFileBtn.removeEventListener("mouseDown",onRemoveFileBtn); + } + DarkenManager.unDarken(_popup); + _popup.visible = false; + SBTracker.pop(); + if(!param1) + { + new SBStandardTitlePopup(_guiLayer,_popup.def.thanksTxt); + } + KeepAlive.stopKATimer(_popup); + } + } + + // feedback goes to this server's staff (lib/world.js xfb) over the + // game's own connection, which says who wrote it: it went to the + // official moderation server's "fb", which here answered nothing. a + // museum donation (type 12) is the gems themselves + // (ItemXtCommManager.requestDonateGems): nothing more goes. pictures + // are not taken. + public static function setupRequest(param1:UserImageUpload, param2:String, param3:int, param4:int, param5:Function, param6:Function) : void + { + var _loc7_:String = param2 != null ? param2.split("%").join("").replace(/[\r\n]+/g," ") : ""; + if(param3 != 12 && _loc7_.replace(/\s+/g,"").length > 0) + { + gMainFrame.server.setXtObject_Str("xfb",[param3,_loc7_.substr(0,1000)]); + } + if(param5 != null) + { + param5(new Event("complete")); + } + } + + public static function createPostData(param1:String, param2:ByteArray, param3:String, param4:Object = null) : ByteArray + { + var _loc5_:String = null; + var _loc7_:int = 0; + var _loc8_:ByteArray = new ByteArray(); + _loc8_.endian = "bigEndian"; + if(param4 == null) + { + param4 = {}; + } + for(var _loc6_:String in param4) + { + writeBoundary(_loc8_,param3); + writeLineBreak(_loc8_); + _loc5_ = "Content-Disposition: form-data; name=\"" + _loc6_ + "\""; + _loc7_ = 0; + while(_loc7_ < _loc5_.length) + { + _loc8_.writeByte(_loc5_.charCodeAt(_loc7_)); + _loc7_++; + } + writeLineBreak(_loc8_); + writeLineBreak(_loc8_); + _loc8_.writeUTFBytes(param4[_loc6_]); + writeLineBreak(_loc8_); + } + if(param2) + { + writeBoundary(_loc8_,param3); + writeLineBreak(_loc8_); + _loc5_ = "Content-Disposition: form-data; name=\"image\"; filename=\"" + param1 + "\""; + _loc7_ = 0; + while(_loc7_ < _loc5_.length) + { + _loc8_.writeByte(_loc5_.charCodeAt(_loc7_)); + _loc7_++; + } + writeLineBreak(_loc8_); + _loc5_ = "Content-Type: image/jpeg"; + _loc7_ = 0; + while(_loc7_ < _loc5_.length) + { + _loc8_.writeByte(_loc5_.charCodeAt(_loc7_)); + _loc7_++; + } + writeLineBreak(_loc8_); + writeLineBreak(_loc8_); + _loc8_.writeBytes(param2,0,param2.length); + writeLineBreak(_loc8_); + } + writeBoundary(_loc8_,param3); + writeDoubleDash(_loc8_); + writeLineBreak(_loc8_); + return _loc8_; + } + + private static function writeLineBreak(param1:ByteArray) : void + { + param1.writeShort(3338); + } + + private static function writeDoubleDash(param1:ByteArray) : void + { + param1.writeShort(11565); + } + + private static function writeBoundary(param1:ByteArray, param2:String) : void + { + var _loc3_:int = 0; + writeDoubleDash(param1); + _loc3_ = 0; + while(_loc3_ < param2.length) + { + param1.writeByte(param2.charCodeAt(_loc3_)); + _loc3_++; + } + } + + private static function onSendComplete(param1:Event) : void + { + trace("w00t!"); + } + + private static function onSendError(param1:Event) : void + { + trace("Argh! Error sending...."); + } + } +} + diff --git a/swf-src/NGFactManager.as b/swf-src/NGFactManager.as index a354ab0..5bc4250 100644 --- a/swf-src/NGFactManager.as +++ b/swf-src/NGFactManager.as @@ -809,6 +809,11 @@ package gui private static function reloadGenericFactPopup(param1:Object) : void { + // a fact had by its id is in no list: the arrows have nowhere to go + if(param1 == null) + { + return; + } factCloseHandler(null); if(param1.type == 18 || param1.type == 12 || param1.type == 17 || param1.type == 9 || param1.type == 19) { @@ -824,6 +829,11 @@ package gui { var _loc3_:String = null; var _loc5_:Array = null; + // a fact had by its id is in no list: the arrows have nowhere to go + if(param1 == null) + { + return; + } _factPopup.index = param1.index; _factPopup.bitIdx = param1.bitIdx; while(_factPopup.imgBlock.numChildren > 0) @@ -1022,10 +1032,12 @@ package gui } DarkenManager.showLoadingSpiral(false); _loc2_ = _genericFactDefList[_genericFactId]; - // the fact lists came from the official server; one this server has - // no entry for opens nothing (#1009) + // the fact lists came from the official server, and this one + // answers them empty: the fact is had by its id instead, from the + // CDN's factDefs (requestFactInfo), as the game's other facts are if(_loc2_ == null) { + requestFactInfo([_genericFactId]); return; } if(_loc2_.type == 18 || _loc2_.type == 12 || _loc2_.type == 17 || _loc2_.type == 9 || _loc2_.type == 19) @@ -1063,6 +1075,14 @@ package gui _museumFactDefIndexList[_loc3_] = _loc2_.id; _loc3_++; } + // as above: an exhibit this server's list does not have is had by + // its id. opening nothing left the game behind its spinner. + if(_museumFactDefList[_museumRequest] == null) + { + DarkenManager.showLoadingSpiral(false); + requestFactInfo([_museumRequest]); + return; + } displayMuseumEngangermentPopup(_museumFactDefList[_museumRequest]); } diff --git a/swf/ajclient.swf b/swf/ajclient.swf index 79d6291..f168043 100644 Binary files a/swf/ajclient.swf and b/swf/ajclient.swf differ diff --git a/test/buddygames.js b/test/buddygames.js index 2babb97..8d07ac8 100644 --- a/test/buddygames.js +++ b/test/buddygames.js @@ -11,7 +11,7 @@ const GAME_PORT = 19342; const BASE = `http://127.0.0.1:${HTTP_PORT}`; const TOWNSHIP = "jamaa_township.room_main#1"; const {postJson} = harness; -const GAMES = {ticTacToe: 89, fourGems: 90, rockPaperScissors: 91, shellGame: 92, pairs: 93, scooped: 95, bowling: 98, marbles: 101}; +const GAMES = {ticTacToe: 1, fourGems: 31, rockPaperScissors: 32, shellGame: 38, pairs: 101, scooped: 53, bowling: 108, marbles: 45}; const arrive = async username => { const auth = await (await postJson(`${BASE}/authenticate`, {username, password: "KettlePass01"})).json(); @@ -48,22 +48,22 @@ const run = async () => { const perGame = (told.length - 3) / 8; assert.strictEqual(perGame, 19); const first = told.slice(3, 3 + perGame); - assert.deepStrictEqual([first[0], first[2], first[4], first[5], first[7], first[8], first[12], first[17]], ["89", "PVP_TicTacToe", "2", "2", "0", "5063", "1", "5063"]); + assert.deepStrictEqual([first[0], first[2], first[4], first[5], first[7], first[8], first[12], first[17]], ["1", "PVP_TicTacToe", "2", "2", "0", "5055", "1", "5063"]); // --- invitations // Ann asks Ben; he says no, and she is told. a.xt("mp", ann.roomId, GAMES.ticTacToe, 0, "Ben"); - assert.deepStrictEqual((await b.nextXt("mp")).slice(2), ["89", "0", "Ann", "1"]); + assert.deepStrictEqual((await b.nextXt("mp")).slice(2), ["1", "0", "Ann", "1"]); // while that is open neither can be asked, nor ask, anything else. c.xt("mp", cat.roomId, GAMES.pairs, 0, "Ann"); - assert.deepStrictEqual((await c.nextXt("mp")).slice(2), ["93", "1"]); + assert.deepStrictEqual((await c.nextXt("mp")).slice(2), ["101", "1"]); b.xt("mp", ben.roomId, GAMES.ticTacToe, 1); - assert.deepStrictEqual((await a.nextXt("mp")).slice(2), ["89", "1"]); + assert.deepStrictEqual((await a.nextXt("mp")).slice(2), ["1", "1"]); // asked again, and taken back. a.xt("mp", ann.roomId, GAMES.ticTacToe, 0, "Ben"); await b.nextXt("mp"); a.xt("mp", ann.roomId, GAMES.ticTacToe, 1); - assert.deepStrictEqual((await b.nextXt("mp")).slice(2), ["89", "1"]); + assert.deepStrictEqual((await b.nextXt("mp")).slice(2), ["1", "1"]); // nobody of that name, a game that is not a buddy game, oneself: all "no". for (const [game, name] of [[GAMES.ticTacToe, "Nobody"], [4, "Ben"], [GAMES.ticTacToe, "Ann"]]) { a.xt("mp", ann.roomId, game, 0, name); @@ -301,13 +301,13 @@ const run = async () => { const bubble = (client, me, word, game) => client.send(``); bubble(a, ann, "on", GAMES.pairs); for (const client of [a, b, c]) { - assert.deepStrictEqual((await client.untilXt("uc")).slice(1), [ann.roomId, ann.id, "on|93", "12", "0"]); + assert.deepStrictEqual((await client.untilXt("uc")).slice(1), [ann.roomId, ann.id, "on|101", "12", "0"]); } // A game that is not the one in the bubble, or a bubble nobody has up: "no". c.xt("mcp", cat.roomId, GAMES.ticTacToe, 0, "Ann"); - assert.deepStrictEqual((await c.untilXt("mp")).slice(2), ["89", "1"]); + assert.deepStrictEqual((await c.untilXt("mp")).slice(2), ["1", "1"]); c.xt("mcp", cat.roomId, GAMES.pairs, 0, "Ben"); - assert.deepStrictEqual((await c.untilXt("mp")).slice(2), ["93", "1"]); + assert.deepStrictEqual((await c.untilXt("mp")).slice(2), ["101", "1"]); // Ben clicks it: the game starts for the two of them and the bubble goes // for Cat. Ann hears her own "off" only once the game is over. b.xt("mcp", ben.roomId, GAMES.pairs, 0, "Ann"); @@ -319,7 +319,7 @@ const run = async () => { } // too late for Cat c.xt("mcp", cat.roomId, GAMES.pairs, 0, "Ann"); - assert.deepStrictEqual((await c.untilXt("mp")).slice(2), ["93", "1"]); + assert.deepStrictEqual((await c.untilXt("mp")).slice(2), ["101", "1"]); // while in it, Ann's client turning the bubble off is not answered yet bubble(a, ann, "off", 0); b.xt("rl", pairsRoom, pairsRoom); @@ -327,8 +327,8 @@ const run = async () => { assert.deepStrictEqual((await a.untilXt("uc")).slice(1), [ann.roomId, ann.id, "off", "12"]); // put up and taken down again outside a game: answered at once bubble(a, ann, "on", GAMES.bowling); - assert.deepStrictEqual((await a.untilXt("uc")).slice(3), ["on|98", "12", "0"]); - assert.deepStrictEqual((await c.untilXt("uc")).slice(3), ["on|98", "12", "0"]); + assert.deepStrictEqual((await a.untilXt("uc")).slice(3), ["on|108", "12", "0"]); + assert.deepStrictEqual((await c.untilXt("uc")).slice(3), ["on|108", "12", "0"]); bubble(a, ann, "off", 0); assert.deepStrictEqual((await a.untilXt("uc")).slice(3), ["off", "12"]); assert.deepStrictEqual((await c.untilXt("uc")).slice(3), ["off", "12"]); @@ -351,7 +351,7 @@ const run = async () => { do { seen = await dee.client.untilXt("uc"); } while (seen[2] !== ann.id); - assert.deepStrictEqual(seen.slice(3), ["on|92", "12", "0"]); + assert.deepStrictEqual(seen.slice(3), ["on|38", "12", "0"]); bubble(a, ann, "off", 0); await a.untilXt("uc"); dee.client.socket.destroy(); @@ -367,7 +367,7 @@ const run = async () => { a.xt("mp", ann.roomId, GAMES.marbles, 0, "Ben"); await b.untilXt("mp"); a.socket.destroy(); - assert.deepStrictEqual((await b.untilXt("mp")).slice(2), ["101", "1"]); + assert.deepStrictEqual((await b.untilXt("mp")).slice(2), ["45", "1"]); // --- a room game played together (lib/minigames.js MULTIPLAYER): Gem // Breaker offers its waiting list, Ben waits in the room, Cat joins, both diff --git a/tools/build-client.sh b/tools/build-client.sh index 7dbd172..6336143 100755 --- a/tools/build-client.sh +++ b/tools/build-client.sh @@ -97,6 +97,7 @@ set -- \ item.Item Item.as \ loader.DenItemHelper DenItemHelper.as \ game.MinigameManager MinigameManager.as \ + gui.FeedbackManager FeedbackManager.as \ game.microSmoothie.MicroSmoothie MicroSmoothie.as \ room.DenItemHolder ../tools/decompiled/room/DenItemHolder.as # not in the game: added before the replace (game.ArtStudioKit is Strawberry