From 6e671be0b53f7cdc065832179283929fbeb31122 Mon Sep 17 00:00:00 2001 From: SilicaAndPina Date: Sun, 3 Jan 2021 13:18:43 +1300 Subject: [PATCH] make brickpoet functional --- DataCollection/gamedata.json | 2367 +++++++++++++++++ .../Game/SwfModules/Brickpoet.cs | 163 ++ .../Horse Isle Server.csproj | 1 + .../Horse Isle Server/Program.cs | 2 + .../Horse Isle Server/Server/Database.cs | 103 + .../Horse Isle Server/Server/GameClient.cs | 3 + .../Horse Isle Server/Server/GameDataJson.cs | 14 + .../Horse Isle Server/Server/GameServer.cs | 134 + .../Horse Isle Server/Server/PacketBuilder.cs | 51 + 9 files changed, 2838 insertions(+) create mode 100644 Horse Isle Server/Horse Isle Server/Game/SwfModules/Brickpoet.cs diff --git a/DataCollection/gamedata.json b/DataCollection/gamedata.json index afb8b65..425d560 100644 --- a/DataCollection/gamedata.json +++ b/DataCollection/gamedata.json @@ -129,6 +129,11 @@ "fountain":"Although it's not recommended, you could drink from this fountain if you are thirsty...^T6Drink from the public fountain. ^B1D^R1^X^Z", "venus_flytrap_format":"The Giant Venus Flytrap chomped at you!
OUCH!!
It chomped your pocket, taking $%MONEY% with it!!", "password_input":"
^PLReply:|^PS14|ANSWER^R1", + "poetry":{ + "other_players_participating":"
^LThe following other players are participating:", + "partcipent_format":"^R1^T3%USERNAME%", + "lastplayer_format":"^R1^LLast Player Poet:%USERNAME% ^R1" + }, "bank":{ "made_interest":"^LYou made $%MONEY% in interest since your last visit.^R1", "carrying_message":"^L(You are carrying $%MONEY% and have $%BANKMONEY% in the bank.)^R1", @@ -35013,6 +35018,2368 @@ } ] }, + "poetry":[ + { + "id": 1, + "word": "a", + "room_id": 1 + }, + { + "id": 2, + "word": "horse", + "room_id": 1 + }, + { + "id": 3, + "word": "the", + "room_id": 1 + }, + { + "id": 4, + "word": "mane", + "room_id": 1 + }, + { + "id": 5, + "word": "and", + "room_id": 1 + }, + { + "id": 6, + "word": "an", + "room_id": 1 + }, + { + "id": 7, + "word": "tail", + "room_id": 1 + }, + { + "id": 8, + "word": "pony", + "room_id": 1 + }, + { + "id": 9, + "word": "mare", + "room_id": 1 + }, + { + "id": 10, + "word": "stallion", + "room_id": 1 + }, + { + "id": 11, + "word": "gelding", + "room_id": 1 + }, + { + "id": 12, + "word": "groom", + "room_id": 1 + }, + { + "id": 13, + "word": "speedy", + "room_id": 1 + }, + { + "id": 14, + "word": "are", + "room_id": 1 + }, + { + "id": 15, + "word": "I", + "room_id": 1 + }, + { + "id": 16, + "word": "am", + "room_id": 1 + }, + { + "id": 17, + "word": "zippy", + "room_id": 1 + }, + { + "id": 18, + "word": "island", + "room_id": 1 + }, + { + "id": 19, + "word": "water", + "room_id": 1 + }, + { + "id": 20, + "word": "brown", + "room_id": 1 + }, + { + "id": 21, + "word": "black", + "room_id": 1 + }, + { + "id": 22, + "word": "fuzzy", + "room_id": 1 + }, + { + "id": 23, + "word": "funky", + "room_id": 1 + }, + { + "id": 24, + "word": "gallop", + "room_id": 1 + }, + { + "id": 25, + "word": "jump", + "room_id": 1 + }, + { + "id": 26, + "word": "you", + "room_id": 1 + }, + { + "id": 27, + "word": "we", + "room_id": 1 + }, + { + "id": 28, + "word": "black", + "room_id": 1 + }, + { + "id": 29, + "word": "ride", + "room_id": 1 + }, + { + "id": 30, + "word": "pretty", + "room_id": 1 + }, + { + "id": 31, + "word": "purple", + "room_id": 1 + }, + { + "id": 32, + "word": "curly", + "room_id": 1 + }, + { + "id": 34, + "word": "wild", + "room_id": 1 + }, + { + "id": 35, + "word": "but", + "room_id": 1 + }, + { + "id": 36, + "word": "or", + "room_id": 1 + }, + { + "id": 37, + "word": "it", + "room_id": 1 + }, + { + "id": 38, + "word": "tame", + "room_id": 1 + }, + { + "id": 39, + "word": "they", + "room_id": 1 + }, + { + "id": 40, + "word": "go", + "room_id": 1 + }, + { + "id": 41, + "word": "happy", + "room_id": 1 + }, + { + "id": 42, + "word": "amazing", + "room_id": 1 + }, + { + "id": 43, + "word": "chestnut", + "room_id": 1 + }, + { + "id": 44, + "word": "gray", + "room_id": 1 + }, + { + "id": 45, + "word": "rides", + "room_id": 1 + }, + { + "id": 46, + "word": "my", + "room_id": 1 + }, + { + "id": 47, + "word": "sad", + "room_id": 1 + }, + { + "id": 48, + "word": "is", + "room_id": 1 + }, + { + "id": 49, + "word": "rein", + "room_id": 1 + }, + { + "id": 50, + "word": "ing", + "room_id": 1 + }, + { + "id": 51, + "word": "s", + "room_id": 1 + }, + { + "id": 52, + "word": "s", + "room_id": 1 + }, + { + "id": 53, + "word": "must", + "room_id": 1 + }, + { + "id": 54, + "word": "without", + "room_id": 1 + }, + { + "id": 55, + "word": "believe", + "room_id": 1 + }, + { + "id": 56, + "word": "beautiful", + "room_id": 1 + }, + { + "id": 57, + "word": "sunset", + "room_id": 1 + }, + { + "id": 58, + "word": "breeze", + "room_id": 1 + }, + { + "id": 59, + "word": "magnificent", + "room_id": 1 + }, + { + "id": 60, + "word": "fantastic", + "room_id": 1 + }, + { + "id": 61, + "word": "unrivaled", + "room_id": 1 + }, + { + "id": 62, + "word": "adventure", + "room_id": 1 + }, + { + "id": 63, + "word": "my", + "room_id": 1 + }, + { + "id": 64, + "word": "you", + "room_id": 1 + }, + { + "id": 65, + "word": "our", + "room_id": 1 + }, + { + "id": 66, + "word": "is", + "room_id": 1 + }, + { + "id": 67, + "word": "the", + "room_id": 1 + }, + { + "id": 68, + "word": "greatest", + "room_id": 1 + }, + { + "id": 69, + "word": "love", + "room_id": 1 + }, + { + "id": 70, + "word": "wonderful", + "room_id": 1 + }, + { + "id": 71, + "word": "very", + "room_id": 1 + }, + { + "id": 72, + "word": "is", + "room_id": 1 + }, + { + "id": 73, + "word": "he", + "room_id": 1 + }, + { + "id": 74, + "word": "she", + "room_id": 1 + }, + { + "id": 75, + "word": "beyond", + "room_id": 1 + }, + { + "id": 76, + "word": "against", + "room_id": 1 + }, + { + "id": 77, + "word": "be", + "room_id": 1 + }, + { + "id": 78, + "word": "into", + "room_id": 1 + }, + { + "id": 79, + "word": "and", + "room_id": 1 + }, + { + "id": 80, + "word": "also", + "room_id": 1 + }, + { + "id": 81, + "word": "because", + "room_id": 1 + }, + { + "id": 82, + "word": "forever", + "room_id": 1 + }, + { + "id": 83, + "word": "always", + "room_id": 1 + }, + { + "id": 84, + "word": "bird", + "room_id": 2 + }, + { + "id": 85, + "word": "wing", + "room_id": 2 + }, + { + "id": 86, + "word": "fly", + "room_id": 2 + }, + { + "id": 87, + "word": "fast", + "room_id": 2 + }, + { + "id": 88, + "word": "beak", + "room_id": 2 + }, + { + "id": 89, + "word": "feather", + "room_id": 2 + }, + { + "id": 90, + "word": "the", + "room_id": 2 + }, + { + "id": 91, + "word": "red", + "room_id": 2 + }, + { + "id": 92, + "word": "green", + "room_id": 2 + }, + { + "id": 93, + "word": "blue", + "room_id": 2 + }, + { + "id": 94, + "word": "shimmer", + "room_id": 2 + }, + { + "id": 95, + "word": "oily", + "room_id": 2 + }, + { + "id": 96, + "word": "talon", + "room_id": 2 + }, + { + "id": 97, + "word": "sparrow", + "room_id": 2 + }, + { + "id": 98, + "word": "eagle", + "room_id": 2 + }, + { + "id": 239, + "word": "ing", + "room_id": 2 + }, + { + "id": 99, + "word": "it", + "room_id": 3 + }, + { + "id": 100, + "word": "s", + "room_id": 3 + }, + { + "id": 101, + "word": "ly", + "room_id": 3 + }, + { + "id": 102, + "word": "on", + "room_id": 3 + }, + { + "id": 103, + "word": "a", + "room_id": 3 + }, + { + "id": 104, + "word": "the", + "room_id": 3 + }, + { + "id": 105, + "word": "ing", + "room_id": 3 + }, + { + "id": 106, + "word": "and", + "room_id": 3 + }, + { + "id": 107, + "word": "delicate", + "room_id": 3 + }, + { + "id": 108, + "word": "breeze", + "room_id": 3 + }, + { + "id": 109, + "word": "tell", + "room_id": 3 + }, + { + "id": 110, + "word": "say", + "room_id": 3 + }, + { + "id": 240, + "word": "s", + "room_id": 2 + }, + { + "id": 112, + "word": "child", + "room_id": 3 + }, + { + "id": 113, + "word": "morning", + "room_id": 3 + }, + { + "id": 114, + "word": "green", + "room_id": 3 + }, + { + "id": 115, + "word": "pink", + "room_id": 3 + }, + { + "id": 116, + "word": "yellow", + "room_id": 3 + }, + { + "id": 117, + "word": "soft", + "room_id": 3 + }, + { + "id": 118, + "word": "out", + "room_id": 3 + }, + { + "id": 119, + "word": "in", + "room_id": 3 + }, + { + "id": 120, + "word": "on", + "room_id": 3 + }, + { + "id": 121, + "word": "you", + "room_id": 3 + }, + { + "id": 122, + "word": "I", + "room_id": 3 + }, + { + "id": 123, + "word": "me", + "room_id": 3 + }, + { + "id": 124, + "word": "she", + "room_id": 3 + }, + { + "id": 125, + "word": "he", + "room_id": 3 + }, + { + "id": 126, + "word": "after", + "room_id": 3 + }, + { + "id": 127, + "word": "before", + "room_id": 3 + }, + { + "id": 128, + "word": "today", + "room_id": 3 + }, + { + "id": 129, + "word": "tomorrow", + "room_id": 3 + }, + { + "id": 130, + "word": "dream", + "room_id": 3 + }, + { + "id": 131, + "word": "rose", + "room_id": 3 + }, + { + "id": 132, + "word": "flower", + "room_id": 3 + }, + { + "id": 133, + "word": "window", + "room_id": 3 + }, + { + "id": 134, + "word": "river", + "room_id": 3 + }, + { + "id": 135, + "word": "our", + "room_id": 3 + }, + { + "id": 136, + "word": "my", + "room_id": 3 + }, + { + "id": 137, + "word": "house", + "room_id": 3 + }, + { + "id": 138, + "word": "your", + "room_id": 3 + }, + { + "id": 139, + "word": "up", + "room_id": 3 + }, + { + "id": 140, + "word": "down", + "room_id": 3 + }, + { + "id": 141, + "word": "will", + "room_id": 3 + }, + { + "id": 142, + "word": "go", + "room_id": 3 + }, + { + "id": 143, + "word": "sea", + "room_id": 3 + }, + { + "id": 144, + "word": "shell", + "room_id": 3 + }, + { + "id": 145, + "word": "pearl", + "room_id": 3 + }, + { + "id": 146, + "word": "try", + "room_id": 3 + }, + { + "id": 147, + "word": "tree", + "room_id": 3 + }, + { + "id": 148, + "word": "moon", + "room_id": 3 + }, + { + "id": 149, + "word": "bird", + "room_id": 3 + }, + { + "id": 150, + "word": "from", + "room_id": 3 + }, + { + "id": 151, + "word": "there", + "room_id": 3 + }, + { + "id": 152, + "word": "to", + "room_id": 3 + }, + { + "id": 153, + "word": "here", + "room_id": 3 + }, + { + "id": 154, + "word": "ed", + "room_id": 3 + }, + { + "id": 155, + "word": "please", + "room_id": 3 + }, + { + "id": 156, + "word": "through", + "room_id": 3 + }, + { + "id": 157, + "word": "not", + "room_id": 3 + }, + { + "id": 158, + "word": "no", + "room_id": 3 + }, + { + "id": 159, + "word": "yes", + "room_id": 3 + }, + { + "id": 241, + "word": "s", + "room_id": 2 + }, + { + "id": 161, + "word": "may", + "room_id": 3 + }, + { + "id": 162, + "word": "be", + "room_id": 3 + }, + { + "id": 163, + "word": "like", + "room_id": 3 + }, + { + "id": 164, + "word": "as", + "room_id": 3 + }, + { + "id": 165, + "word": "how", + "room_id": 3 + }, + { + "id": 166, + "word": "fast", + "room_id": 3 + }, + { + "id": 167, + "word": "slow", + "room_id": 3 + }, + { + "id": 168, + "word": "still", + "room_id": 3 + }, + { + "id": 169, + "word": "cookies", + "room_id": 3 + }, + { + "id": 170, + "word": "dress", + "room_id": 3 + }, + { + "id": 171, + "word": "sweet", + "room_id": 3 + }, + { + "id": 242, + "word": "the", + "room_id": 2 + }, + { + "id": 173, + "word": "laugh", + "room_id": 3 + }, + { + "id": 174, + "word": "giggle", + "room_id": 3 + }, + { + "id": 175, + "word": "above", + "room_id": 3 + }, + { + "id": 243, + "word": "a", + "room_id": 2 + }, + { + "id": 177, + "word": "some", + "room_id": 3 + }, + { + "id": 178, + "word": "said", + "room_id": 3 + }, + { + "id": 179, + "word": "have", + "room_id": 3 + }, + { + "id": 180, + "word": "little", + "room_id": 3 + }, + { + "id": 181, + "word": "sister", + "room_id": 3 + }, + { + "id": 182, + "word": "friend", + "room_id": 3 + }, + { + "id": 183, + "word": "best", + "room_id": 3 + }, + { + "id": 184, + "word": "turtle", + "room_id": 3 + }, + { + "id": 185, + "word": "find", + "room_id": 3 + }, + { + "id": 186, + "word": "with", + "room_id": 3 + }, + { + "id": 187, + "word": "music", + "room_id": 3 + }, + { + "id": 188, + "word": "would", + "room_id": 3 + }, + { + "id": 189, + "word": "could", + "room_id": 3 + }, + { + "id": 190, + "word": "her", + "room_id": 3 + }, + { + "id": 191, + "word": "short", + "room_id": 3 + }, + { + "id": 192, + "word": "long", + "room_id": 3 + }, + { + "id": 193, + "word": "these", + "room_id": 3 + }, + { + "id": 194, + "word": "put", + "room_id": 3 + }, + { + "id": 195, + "word": "am", + "room_id": 3 + }, + { + "id": 196, + "word": "are", + "room_id": 3 + }, + { + "id": 197, + "word": "but", + "room_id": 3 + }, + { + "id": 198, + "word": "garden", + "room_id": 3 + }, + { + "id": 199, + "word": "know", + "room_id": 3 + }, + { + "id": 200, + "word": "think", + "room_id": 3 + }, + { + "id": 201, + "word": "see", + "room_id": 3 + }, + { + "id": 202, + "word": "do", + "room_id": 3 + }, + { + "id": 203, + "word": "picture", + "room_id": 3 + }, + { + "id": 204, + "word": "petal", + "room_id": 3 + }, + { + "id": 205, + "word": "as", + "room_id": 3 + }, + { + "id": 206, + "word": "by", + "room_id": 3 + }, + { + "id": 207, + "word": "day", + "room_id": 3 + }, + { + "id": 208, + "word": "night", + "room_id": 3 + }, + { + "id": 209, + "word": "is", + "room_id": 3 + }, + { + "id": 210, + "word": "miss", + "room_id": 3 + }, + { + "id": 211, + "word": "without", + "room_id": 3 + }, + { + "id": 212, + "word": "re", + "room_id": 3 + }, + { + "id": 213, + "word": "next", + "room_id": 3 + }, + { + "id": 214, + "word": "summer", + "room_id": 3 + }, + { + "id": 215, + "word": "spring", + "room_id": 3 + }, + { + "id": 216, + "word": "book", + "room_id": 3 + }, + { + "id": 217, + "word": "for", + "room_id": 3 + }, + { + "id": 218, + "word": "so", + "room_id": 3 + }, + { + "id": 219, + "word": "teach", + "room_id": 3 + }, + { + "id": 220, + "word": "d", + "room_id": 3 + }, + { + "id": 221, + "word": "dazzle", + "room_id": 3 + }, + { + "id": 222, + "word": "lucky", + "room_id": 3 + }, + { + "id": 223, + "word": "lose", + "room_id": 3 + }, + { + "id": 224, + "word": "sing", + "room_id": 3 + }, + { + "id": 225, + "word": "song", + "room_id": 3 + }, + { + "id": 226, + "word": "puppy", + "room_id": 3 + }, + { + "id": 227, + "word": "fairy", + "room_id": 3 + }, + { + "id": 228, + "word": "sparkle", + "room_id": 3 + }, + { + "id": 229, + "word": "tiny", + "room_id": 3 + }, + { + "id": 230, + "word": "shine", + "room_id": 3 + }, + { + "id": 231, + "word": "y", + "room_id": 3 + }, + { + "id": 232, + "word": "very", + "room_id": 3 + }, + { + "id": 233, + "word": "the", + "room_id": 3 + }, + { + "id": 234, + "word": "the", + "room_id": 3 + }, + { + "id": 235, + "word": "a", + "room_id": 3 + }, + { + "id": 236, + "word": "a", + "room_id": 3 + }, + { + "id": 237, + "word": "it", + "room_id": 3 + }, + { + "id": 238, + "word": "s", + "room_id": 3 + }, + { + "id": 244, + "word": "a", + "room_id": 2 + }, + { + "id": 245, + "word": "robin", + "room_id": 2 + }, + { + "id": 246, + "word": "I", + "room_id": 2 + }, + { + "id": 247, + "word": "am", + "room_id": 2 + }, + { + "id": 248, + "word": "north", + "room_id": 2 + }, + { + "id": 249, + "word": "south", + "room_id": 2 + }, + { + "id": 250, + "word": "east", + "room_id": 2 + }, + { + "id": 251, + "word": "west", + "room_id": 2 + }, + { + "id": 252, + "word": "as", + "room_id": 2 + }, + { + "id": 253, + "word": "and", + "room_id": 2 + }, + { + "id": 254, + "word": "thought", + "room_id": 2 + }, + { + "id": 255, + "word": "hop", + "room_id": 2 + }, + { + "id": 256, + "word": "break", + "room_id": 2 + }, + { + "id": 257, + "word": "speed", + "room_id": 2 + }, + { + "id": 258, + "word": "es", + "room_id": 2 + }, + { + "id": 259, + "word": "dive", + "room_id": 2 + }, + { + "id": 260, + "word": "soar", + "room_id": 2 + }, + { + "id": 261, + "word": "up", + "room_id": 2 + }, + { + "id": 262, + "word": "down", + "room_id": 2 + }, + { + "id": 263, + "word": "above", + "room_id": 2 + }, + { + "id": 264, + "word": "pigeon", + "room_id": 2 + }, + { + "id": 265, + "word": "deliver", + "room_id": 2 + }, + { + "id": 266, + "word": "song", + "room_id": 2 + }, + { + "id": 267, + "word": "sing", + "room_id": 2 + }, + { + "id": 268, + "word": "falcon", + "room_id": 2 + }, + { + "id": 269, + "word": "egg", + "room_id": 2 + }, + { + "id": 270, + "word": "lay", + "room_id": 2 + }, + { + "id": 271, + "word": "tree", + "room_id": 2 + }, + { + "id": 272, + "word": "nest", + "room_id": 2 + }, + { + "id": 273, + "word": "he", + "room_id": 2 + }, + { + "id": 274, + "word": "she", + "room_id": 2 + }, + { + "id": 275, + "word": "these", + "room_id": 2 + }, + { + "id": 276, + "word": "they", + "room_id": 2 + }, + { + "id": 277, + "word": "are", + "room_id": 2 + }, + { + "id": 278, + "word": "you", + "room_id": 2 + }, + { + "id": 279, + "word": "day", + "room_id": 2 + }, + { + "id": 280, + "word": "migrate", + "room_id": 2 + }, + { + "id": 281, + "word": "night", + "room_id": 2 + }, + { + "id": 282, + "word": "on", + "room_id": 2 + }, + { + "id": 283, + "word": "in", + "room_id": 2 + }, + { + "id": 284, + "word": "through", + "room_id": 2 + }, + { + "id": 285, + "word": "to", + "room_id": 1 + }, + { + "id": 286, + "word": "be", + "room_id": 1 + }, + { + "id": 287, + "word": "into", + "room_id": 1 + }, + { + "id": 288, + "word": "through", + "room_id": 1 + }, + { + "id": 289, + "word": "around", + "room_id": 1 + }, + { + "id": 290, + "word": "a", + "room_id": 4 + }, + { + "id": 291, + "word": "in", + "room_id": 4 + }, + { + "id": 292, + "word": "a", + "room_id": 4 + }, + { + "id": 293, + "word": "the", + "room_id": 4 + }, + { + "id": 294, + "word": "the", + "room_id": 4 + }, + { + "id": 295, + "word": "and", + "room_id": 4 + }, + { + "id": 296, + "word": "the", + "room_id": 4 + }, + { + "id": 297, + "word": "a", + "room_id": 4 + }, + { + "id": 298, + "word": "an", + "room_id": 4 + }, + { + "id": 299, + "word": "s", + "room_id": 4 + }, + { + "id": 300, + "word": "s", + "room_id": 4 + }, + { + "id": 301, + "word": "s", + "room_id": 4 + }, + { + "id": 302, + "word": "in", + "room_id": 4 + }, + { + "id": 303, + "word": "this", + "room_id": 4 + }, + { + "id": 304, + "word": "then", + "room_id": 4 + }, + { + "id": 305, + "word": "toboggan", + "room_id": 4 + }, + { + "id": 306, + "word": "ice", + "room_id": 4 + }, + { + "id": 307, + "word": "icicle", + "room_id": 4 + }, + { + "id": 308, + "word": "peppermint", + "room_id": 4 + }, + { + "id": 309, + "word": "patty", + "room_id": 4 + }, + { + "id": 310, + "word": "sculpture", + "room_id": 4 + }, + { + "id": 311, + "word": "snow", + "room_id": 4 + }, + { + "id": 312, + "word": "snowball", + "room_id": 4 + }, + { + "id": 313, + "word": "snowstorm", + "room_id": 4 + }, + { + "id": 314, + "word": "blizzard", + "room_id": 4 + }, + { + "id": 315, + "word": "cold", + "room_id": 4 + }, + { + "id": 316, + "word": "chill", + "room_id": 4 + }, + { + "id": 317, + "word": "y", + "room_id": 4 + }, + { + "id": 318, + "word": "y", + "room_id": 4 + }, + { + "id": 319, + "word": "y", + "room_id": 4 + }, + { + "id": 320, + "word": "slippery", + "room_id": 4 + }, + { + "id": 321, + "word": "slip", + "room_id": 4 + }, + { + "id": 322, + "word": "sled", + "room_id": 4 + }, + { + "id": 323, + "word": "ing", + "room_id": 4 + }, + { + "id": 324, + "word": "ing", + "room_id": 4 + }, + { + "id": 325, + "word": "ed", + "room_id": 4 + }, + { + "id": 326, + "word": "ed", + "room_id": 4 + }, + { + "id": 327, + "word": "slide", + "room_id": 4 + }, + { + "id": 328, + "word": "ice skates", + "room_id": 4 + }, + { + "id": 329, + "word": "ice skating", + "room_id": 4 + }, + { + "id": 330, + "word": "snowshoe", + "room_id": 4 + }, + { + "id": 331, + "word": "downhill", + "room_id": 4 + }, + { + "id": 332, + "word": "ski", + "room_id": 4 + }, + { + "id": 333, + "word": "frost", + "room_id": 4 + }, + { + "id": 334, + "word": "windowpane", + "room_id": 4 + }, + { + "id": 335, + "word": "slush", + "room_id": 4 + }, + { + "id": 336, + "word": "marshmallow", + "room_id": 4 + }, + { + "id": 337, + "word": "draft", + "room_id": 4 + }, + { + "id": 338, + "word": "cinnamon", + "room_id": 4 + }, + { + "id": 339, + "word": "mitten", + "room_id": 4 + }, + { + "id": 340, + "word": "hat", + "room_id": 4 + }, + { + "id": 341, + "word": "scarf", + "room_id": 4 + }, + { + "id": 342, + "word": "wrap", + "room_id": 4 + }, + { + "id": 343, + "word": "wear", + "room_id": 4 + }, + { + "id": 344, + "word": "cocoa", + "room_id": 4 + }, + { + "id": 345, + "word": "boot", + "room_id": 4 + }, + { + "id": 346, + "word": "fireplace", + "room_id": 4 + }, + { + "id": 347, + "word": "warm", + "room_id": 4 + }, + { + "id": 348, + "word": "firewood", + "room_id": 4 + }, + { + "id": 349, + "word": "wool", + "room_id": 4 + }, + { + "id": 350, + "word": "sock", + "room_id": 4 + }, + { + "id": 351, + "word": "sweater", + "room_id": 4 + }, + { + "id": 352, + "word": "winter", + "room_id": 4 + }, + { + "id": 353, + "word": "jacket", + "room_id": 4 + }, + { + "id": 354, + "word": "heat", + "room_id": 4 + }, + { + "id": 355, + "word": "snow", + "room_id": 4 + }, + { + "id": 356, + "word": "blanket", + "room_id": 4 + }, + { + "id": 357, + "word": "bonfire", + "room_id": 4 + }, + { + "id": 358, + "word": "snowfort", + "room_id": 4 + }, + { + "id": 359, + "word": "wind", + "room_id": 4 + }, + { + "id": 360, + "word": "stove", + "room_id": 4 + }, + { + "id": 361, + "word": "wood", + "room_id": 4 + }, + { + "id": 362, + "word": "fire", + "room_id": 4 + }, + { + "id": 363, + "word": "evergreen", + "room_id": 4 + }, + { + "id": 364, + "word": "white", + "room_id": 3 + }, + { + "id": 365, + "word": "white", + "room_id": 4 + }, + { + "id": 368, + "word": "polar bear", + "room_id": 4 + }, + { + "id": 367, + "word": "shovel", + "room_id": 4 + }, + { + "id": 369, + "word": "penguin", + "room_id": 4 + }, + { + "id": 370, + "word": "slip", + "room_id": 4 + }, + { + "id": 371, + "word": "fall", + "room_id": 4 + }, + { + "id": 372, + "word": "blue", + "room_id": 4 + }, + { + "id": 373, + "word": "under", + "room_id": 4 + }, + { + "id": 374, + "word": "over", + "room_id": 4 + }, + { + "id": 375, + "word": "then", + "room_id": 4 + }, + { + "id": 376, + "word": "where", + "room_id": 4 + }, + { + "id": 377, + "word": "was", + "room_id": 4 + }, + { + "id": 378, + "word": "is", + "room_id": 4 + }, + { + "id": 379, + "word": "is", + "room_id": 4 + }, + { + "id": 380, + "word": "as", + "room_id": 4 + }, + { + "id": 381, + "word": "as", + "room_id": 4 + }, + { + "id": 454, + "word": "pineapple", + "room_id": 5 + }, + { + "id": 458, + "word": "s", + "room_id": 4 + }, + { + "id": 382, + "word": "desert", + "room_id": 5 + }, + { + "id": 383, + "word": "sun", + "room_id": 5 + }, + { + "id": 384, + "word": "hot", + "room_id": 5 + }, + { + "id": 385, + "word": "bake", + "room_id": 5 + }, + { + "id": 386, + "word": "fry", + "room_id": 5 + }, + { + "id": 387, + "word": "sizzle", + "room_id": 5 + }, + { + "id": 388, + "word": "scorch", + "room_id": 5 + }, + { + "id": 389, + "word": "burn", + "room_id": 5 + }, + { + "id": 390, + "word": "parch", + "room_id": 5 + }, + { + "id": 391, + "word": "dry", + "room_id": 5 + }, + { + "id": 392, + "word": "sand", + "room_id": 5 + }, + { + "id": 393, + "word": "dune", + "room_id": 5 + }, + { + "id": 394, + "word": "pyramid", + "room_id": 5 + }, + { + "id": 395, + "word": "buggy", + "room_id": 5 + }, + { + "id": 396, + "word": "lost", + "room_id": 5 + }, + { + "id": 397, + "word": "mirage", + "room_id": 5 + }, + { + "id": 398, + "word": "oasis", + "room_id": 5 + }, + { + "id": 399, + "word": "cactus", + "room_id": 5 + }, + { + "id": 400, + "word": "tumbleweed", + "room_id": 5 + }, + { + "id": 401, + "word": "sagebrush", + "room_id": 5 + }, + { + "id": 402, + "word": "dust", + "room_id": 5 + }, + { + "id": 403, + "word": "wind", + "room_id": 5 + }, + { + "id": 404, + "word": "scorpion", + "room_id": 5 + }, + { + "id": 405, + "word": "gecko", + "room_id": 5 + }, + { + "id": 406, + "word": "snake", + "room_id": 5 + }, + { + "id": 407, + "word": "horizon", + "room_id": 5 + }, + { + "id": 408, + "word": "sharp", + "room_id": 5 + }, + { + "id": 409, + "word": "brown", + "room_id": 5 + }, + { + "id": 410, + "word": "tan", + "room_id": 5 + }, + { + "id": 411, + "word": "yellow", + "room_id": 5 + }, + { + "id": 412, + "word": "sandal", + "room_id": 5 + }, + { + "id": 413, + "word": "burn", + "room_id": 5 + }, + { + "id": 414, + "word": "hat", + "room_id": 5 + }, + { + "id": 415, + "word": "help", + "room_id": 5 + }, + { + "id": 416, + "word": "water", + "room_id": 5 + }, + { + "id": 417, + "word": "donkey", + "room_id": 5 + }, + { + "id": 418, + "word": "he", + "room_id": 5 + }, + { + "id": 419, + "word": "along", + "room_id": 5 + }, + { + "id": 420, + "word": "she", + "room_id": 5 + }, + { + "id": 421, + "word": "for", + "room_id": 4 + }, + { + "id": 422, + "word": "they", + "room_id": 4 + }, + { + "id": 423, + "word": "he", + "room_id": 4 + }, + { + "id": 424, + "word": "she", + "room_id": 4 + }, + { + "id": 425, + "word": "I", + "room_id": 4 + }, + { + "id": 426, + "word": "along", + "room_id": 4 + }, + { + "id": 427, + "word": "around", + "room_id": 4 + }, + { + "id": 428, + "word": "I", + "room_id": 5 + }, + { + "id": 429, + "word": "the", + "room_id": 5 + }, + { + "id": 430, + "word": "the", + "room_id": 5 + }, + { + "id": 431, + "word": "the", + "room_id": 5 + }, + { + "id": 432, + "word": "them", + "room_id": 4 + }, + { + "id": 433, + "word": "them", + "room_id": 5 + }, + { + "id": 434, + "word": "jump", + "room_id": 5 + }, + { + "id": 435, + "word": "s", + "room_id": 5 + }, + { + "id": 436, + "word": "s", + "room_id": 5 + }, + { + "id": 437, + "word": "y", + "room_id": 5 + }, + { + "id": 438, + "word": "y", + "room_id": 5 + }, + { + "id": 439, + "word": "y", + "room_id": 5 + }, + { + "id": 440, + "word": "s", + "room_id": 5 + }, + { + "id": 441, + "word": "a", + "room_id": 5 + }, + { + "id": 442, + "word": "with", + "room_id": 4 + }, + { + "id": 443, + "word": "with", + "room_id": 4 + }, + { + "id": 444, + "word": "with", + "room_id": 5 + }, + { + "id": 445, + "word": "the", + "room_id": 5 + }, + { + "id": 446, + "word": "an", + "room_id": 5 + }, + { + "id": 447, + "word": "ed", + "room_id": 5 + }, + { + "id": 448, + "word": "ed", + "room_id": 5 + }, + { + "id": 449, + "word": "ing", + "room_id": 5 + }, + { + "id": 450, + "word": "ing", + "room_id": 5 + }, + { + "id": 451, + "word": "and", + "room_id": 5 + }, + { + "id": 452, + "word": "or", + "room_id": 5 + }, + { + "id": 453, + "word": "for", + "room_id": 5 + }, + { + "id": 455, + "word": "silver", + "room_id": 1 + }, + { + "id": 456, + "word": "orange", + "room_id": 5 + }, + { + "id": 457, + "word": "purple", + "room_id": 3 + }, + { + "id": 459, + "word": "s", + "room_id": 4 + }, + { + "id": 460, + "word": "s", + "room_id": 5 + }, + { + "id": 461, + "word": "because", + "room_id": 4 + }, + { + "id": 462, + "word": "because", + "room_id": 5 + }, + { + "id": 463, + "word": "through", + "room_id": 4 + }, + { + "id": 464, + "word": "what", + "room_id": 4 + }, + { + "id": 465, + "word": "through", + "room_id": 5 + }, + { + "id": 466, + "word": "if", + "room_id": 4 + }, + { + "id": 467, + "word": "if", + "room_id": 5 + }, + { + "id": 468, + "word": "what", + "room_id": 4 + }, + { + "id": 469, + "word": "what", + "room_id": 5 + }, + { + "id": 470, + "word": "around", + "room_id": 4 + }, + { + "id": 471, + "word": "under", + "room_id": 5 + }, + { + "id": 472, + "word": "air", + "room_id": 5 + }, + { + "id": 473, + "word": "on", + "room_id": 4 + }, + { + "id": 474, + "word": "on", + "room_id": 5 + }, + { + "id": 475, + "word": "see", + "room_id": 4 + }, + { + "id": 476, + "word": "see", + "room_id": 5 + }, + { + "id": 477, + "word": "will", + "room_id": 4 + }, + { + "id": 478, + "word": "will", + "room_id": 5 + } + ], "transport":{ "wagon_cutscene":"wagoncutscene", "boat_cutscene":"boatcutscene", diff --git a/Horse Isle Server/Horse Isle Server/Game/SwfModules/Brickpoet.cs b/Horse Isle Server/Horse Isle Server/Game/SwfModules/Brickpoet.cs new file mode 100644 index 0000000..a0e3772 --- /dev/null +++ b/Horse Isle Server/Horse Isle Server/Game/SwfModules/Brickpoet.cs @@ -0,0 +1,163 @@ +using HISP.Server; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HISP.Game.SwfModules +{ + class Brickpoet + { + public struct PoetryEntry { + public int Id; + public string Word; + public int Room; + + } + + public class PoetryPeice + { + public PoetryPeice(int PoetId, int RoomId, string PeiceWord) + { + if(!Database.GetPoetExist(PoetId, RoomId)) + { + Id = PoetId; + x = GameServer.RandomNumberGenerator.Next(0, 365); + y = GameServer.RandomNumberGenerator.Next(0, 280); + Word = PeiceWord; + roomId = RoomId; + Database.AddPoetWord(PoetId, x, y, RoomId); + } + else + { + Id = PoetId; + roomId = RoomId; + Word = PeiceWord; + x = Database.GetPoetPositionX(Id, roomId); + y = Database.GetPoetPositionY(Id, roomId); + } + } + public int Id; + public int RoomId + { + get + { + return roomId; + } + } + public int X + { + get + { + return x; + } + set + { + Database.SetPoetPosition(Id, value, y, roomId); + x = value; + } + + } + public int Y + { + get + { + return y; + } + set + { + Database.SetPoetPosition(Id, x, value, roomId); + y = value; + } + + } + + public string Word; + + private int x; + private int y; + + private int roomId; + + } + + public static List PoetList = new List(); + private static List poetryRooms = new List(); + public static PoetryPeice[][] PoetryRooms + { + get + { + return poetryRooms.ToArray(); + } + } + + private static PoetryEntry[] getPoetsInRoom(int roomId) + { + List entries = new List(); + + foreach(PoetryEntry poet in PoetList.ToArray()) + { + if(poet.Room == roomId) + { + entries.Add(poet); + } + } + + return entries.ToArray(); + } + private static PoetryPeice[] getPoetryRoom(int roomId) + { + PoetryEntry[] poetryEntries = getPoetsInRoom(roomId); + List peices = new List(); + foreach (PoetryEntry poetryEntry in poetryEntries) + { + PoetryPeice peice = new PoetryPeice(poetryEntry.Id, roomId, poetryEntry.Word); + peices.Add(peice); + } + + return peices.ToArray(); + } + + public static PoetryPeice[] GetPoetryRoom(int roomId) + { + foreach(PoetryPeice[] peices in PoetryRooms) + { + if (peices[0].RoomId == roomId) + return peices; + } + throw new KeyNotFoundException("No poetry room of id: " + roomId + " exists."); + } + public static PoetryPeice GetPoetryPeice(PoetryPeice[] room, int id) + { + foreach(PoetryPeice peice in room) + { + if (peice.Id == id) + return peice; + } + throw new KeyNotFoundException("Peice with id: " + id + " not found in room."); + } + public static void LoadPoetryRooms() + { + List rooms = new List(); + foreach(PoetryEntry entry in PoetList) + { + if (!rooms.Contains(entry.Room)) + rooms.Add(entry.Room); + } + + foreach(int room in rooms) + { + Logger.InfoPrint("Loading poetry room: " + room.ToString()); + poetryRooms.Add(getPoetryRoom(room)); + } + + } + + + + + + + } +} diff --git a/Horse Isle Server/Horse Isle Server/Horse Isle Server.csproj b/Horse Isle Server/Horse Isle Server/Horse Isle Server.csproj index 37c8bc1..ecb54b7 100644 --- a/Horse Isle Server/Horse Isle Server/Horse Isle Server.csproj +++ b/Horse Isle Server/Horse Isle Server/Horse Isle Server.csproj @@ -83,6 +83,7 @@ + diff --git a/Horse Isle Server/Horse Isle Server/Program.cs b/Horse Isle Server/Horse Isle Server/Program.cs index f1e5471..e38384b 100644 --- a/Horse Isle Server/Horse Isle Server/Program.cs +++ b/Horse Isle Server/Horse Isle Server/Program.cs @@ -2,6 +2,7 @@ using System.IO; using System.Reflection; using HISP.Game; +using HISP.Game.SwfModules; using HISP.Security; using HISP.Server; namespace HISP @@ -19,6 +20,7 @@ namespace HISP Map.OpenMap(); World.ReadWorldData(); DroppedItems.Init(); + Brickpoet.LoadPoetryRooms(); GameServer.StartServer(); } diff --git a/Horse Isle Server/Horse Isle Server/Server/Database.cs b/Horse Isle Server/Horse Isle Server/Server/Database.cs index 6d856be..1bf6e01 100644 --- a/Horse Isle Server/Horse Isle Server/Server/Database.cs +++ b/Horse Isle Server/Horse Isle Server/Server/Database.cs @@ -32,6 +32,7 @@ namespace HISP.Server string AbuseReorts = "CREATE TABLE AbuseReports(ReportCreator TEXT(1028), Reporting TEXT(1028), ReportReason TEXT(1028))"; string Leaderboards = "CREATE TABLE Leaderboards(playerId INT, minigame TEXT(128), wins INT, looses INT, timesplayed INT, score INT, type TEXT(128))"; string NpcStartPoint = "CREATE TABLE NpcStartPoint(playerId INT, npcId INT, chatpointId INT)"; + string PoetryRooms = "CREATE TABLE PoetryRooms(poetId INT, X INT, Y INT, roomId INT)"; string DeleteOnlineUsers = "DELETE FROM OnlineUsers"; @@ -175,6 +176,19 @@ namespace HISP.Server { Logger.WarnPrint(e.Message); }; + + try + { + MySqlCommand sqlCommand = db.CreateCommand(); + sqlCommand.CommandText = PoetryRooms; + sqlCommand.ExecuteNonQuery(); + sqlCommand.Dispose(); + } + catch (Exception e) + { + Logger.WarnPrint(e.Message); + }; + try { @@ -263,6 +277,93 @@ namespace HISP.Server } + public static void AddPoetWord(int id, int x, int y, int room) + { + using (MySqlConnection db = new MySqlConnection(ConnectionString)) + { + db.Open(); + MySqlCommand sqlCommand = db.CreateCommand(); + sqlCommand.CommandText = "INSERT INTO PoetryRooms VALUES(@id,@x,@y,@room)"; + sqlCommand.Parameters.AddWithValue("@id", id); + sqlCommand.Parameters.AddWithValue("@x", x); + sqlCommand.Parameters.AddWithValue("@y", y); + sqlCommand.Parameters.AddWithValue("@room", room); + sqlCommand.Prepare(); + sqlCommand.ExecuteNonQuery(); + + sqlCommand.Dispose(); + } + } + + public static void SetPoetPosition(int id, int x, int y, int room) + { + using (MySqlConnection db = new MySqlConnection(ConnectionString)) + { + db.Open(); + MySqlCommand sqlCommand = db.CreateCommand(); + sqlCommand.CommandText = "UPDATE PoetryRooms SET X=@x, Y=@y WHERE poetId=@id AND roomId=@room"; + sqlCommand.Parameters.AddWithValue("@id", id); + sqlCommand.Parameters.AddWithValue("@x", x); + sqlCommand.Parameters.AddWithValue("@y", y); + sqlCommand.Parameters.AddWithValue("@room", room); + sqlCommand.Prepare(); + sqlCommand.ExecuteNonQuery(); + + sqlCommand.Dispose(); + } + } + + public static bool GetPoetExist(int id, int room) + { + using (MySqlConnection db = new MySqlConnection(ConnectionString)) + { + db.Open(); + MySqlCommand sqlCommand = db.CreateCommand(); + sqlCommand.CommandText = "SELECT COUNT(1) FROM PoetryRooms WHERE poetId=@id AND roomId=@room"; + sqlCommand.Parameters.AddWithValue("@id", id); + sqlCommand.Parameters.AddWithValue("@room", room); + sqlCommand.Prepare(); + int count = Convert.ToInt32(sqlCommand.ExecuteScalar()); + + sqlCommand.Dispose(); + return count > 0; + } + } + public static int GetPoetPositionX(int id, int room) + { + using (MySqlConnection db = new MySqlConnection(ConnectionString)) + { + db.Open(); + MySqlCommand sqlCommand = db.CreateCommand(); + sqlCommand.CommandText = "SELECT X FROM PoetryRooms WHERE poetId=@id AND roomId=@room"; + sqlCommand.Parameters.AddWithValue("@id", id); + sqlCommand.Parameters.AddWithValue("@room", room); + sqlCommand.Prepare(); + int xpos = Convert.ToInt32(sqlCommand.ExecuteScalar()); + + sqlCommand.Dispose(); + return xpos; + } + } + + public static int GetPoetPositionY(int id, int room) + { + using (MySqlConnection db = new MySqlConnection(ConnectionString)) + { + db.Open(); + MySqlCommand sqlCommand = db.CreateCommand(); + sqlCommand.CommandText = "SELECT Y FROM PoetryRooms WHERE poetId=@id AND roomId=@room"; + sqlCommand.Parameters.AddWithValue("@id", id); + sqlCommand.Parameters.AddWithValue("@room", room); + sqlCommand.Prepare(); + int ypos = Convert.ToInt32(sqlCommand.ExecuteScalar()); + + sqlCommand.Dispose(); + return ypos; + } + } + + public static void SetServerTime(int time, int day, int year) { using (MySqlConnection db = new MySqlConnection(ConnectionString)) @@ -418,6 +519,8 @@ namespace HISP.Server } } + + public static void SetJewelrySlot1(int playerId, int itemId) { using (MySqlConnection db = new MySqlConnection(ConnectionString)) diff --git a/Horse Isle Server/Horse Isle Server/Server/GameClient.cs b/Horse Isle Server/Horse Isle Server/Server/GameClient.cs index 31562dd..58a74bc 100644 --- a/Horse Isle Server/Horse Isle Server/Server/GameClient.cs +++ b/Horse Isle Server/Horse Isle Server/Server/GameClient.cs @@ -242,6 +242,9 @@ namespace HISP.Server case PacketBuilder.PACKET_NPC: GameServer.OnNpcInteraction(this, Packet); break; + case PacketBuilder.PACKET_SWFMODULE: + GameServer.OnSwfModuleCommunication(this, Packet); + break; case PacketBuilder.PACKET_WISH: GameServer.OnWish(this, Packet); break; diff --git a/Horse Isle Server/Horse Isle Server/Server/GameDataJson.cs b/Horse Isle Server/Horse Isle Server/Server/GameDataJson.cs index 343367b..9cf6455 100644 --- a/Horse Isle Server/Horse Isle Server/Server/GameDataJson.cs +++ b/Horse Isle Server/Horse Isle Server/Server/GameDataJson.cs @@ -5,6 +5,7 @@ using HISP.Game; using HISP.Game.Chat; using HISP.Player; using HISP.Game.Services; +using HISP.Game.SwfModules; namespace HISP.Server { @@ -439,6 +440,19 @@ namespace HISP.Server Logger.DebugPrint("Reigstered Inn: " + inn.Id + " Buying at: " + inn.BuyPercentage.ToString() + "%!"); } + int totalPoets = gameData.poetry.Count; + for(int i = 0; i < totalPoets; i++) + { + Brickpoet.PoetryEntry entry = new Brickpoet.PoetryEntry(); + entry.Id = gameData.poetry[i].id; + entry.Word = gameData.poetry[i].word; + entry.Room = gameData.poetry[i].room_id; + Brickpoet.PoetList.Add(entry); + + Logger.DebugPrint("Registed poet: " + entry.Id.ToString() + " word: " + entry.Word + " in room " + entry.Room.ToString()); + } + + Item.Present = gameData.item.special.present; Item.MailMessage = gameData.item.special.mail_message; Item.DorothyShoes = gameData.item.special.dorothy_shoes; diff --git a/Horse Isle Server/Horse Isle Server/Server/GameServer.cs b/Horse Isle Server/Horse Isle Server/Server/GameServer.cs index f617422..5a096dc 100644 --- a/Horse Isle Server/Horse Isle Server/Server/GameServer.cs +++ b/Horse Isle Server/Horse Isle Server/Server/GameServer.cs @@ -13,6 +13,7 @@ using HISP.Player.Equips; using System.Drawing; using HISP.Game.Services; using HISP.Game.Inventory; +using HISP.Game.SwfModules; namespace HISP.Server { @@ -417,6 +418,139 @@ namespace HISP.Server } + public static void OnSwfModuleCommunication(GameClient sender, byte[] packet) + { + if (!sender.LoggedIn) + { + Logger.ErrorPrint(sender.RemoteIp + " tried to send swf communication when not logged in."); + return; + } + if (packet.Length < 4) + { + Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid swf commmunication Packet"); + return; + } + + + byte module = packet[1]; + switch(module) + { + case PacketBuilder.SWFMODULE_BRICKPOET: + if(packet.Length < 5) + { + Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent invalid BRICKPOET packet (swf communication, WRONG SIZE)"); + break; + } + if(packet[2] == PacketBuilder.BRICKPOET_LIST_ALL) + { + if (packet.Length < 6) + { + Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent invalid BRICKPOET LIST ALL packet (swf communication, WRONG SIZE)"); + break; + } + + int roomId = packet[3] - 40; + Brickpoet.PoetryPeice[] room; + try + { + room = Brickpoet.GetPoetryRoom(roomId); + } + catch(KeyNotFoundException) + { + Logger.ErrorPrint(sender.LoggedinUser.Username + " tried to load an invalid brickpoet room: " + roomId); + break; + } + + byte[] poetPacket = PacketBuilder.CreateBrickPoetListPacket(room); + sender.SendPacket(poetPacket); + } + else if(packet[3] == PacketBuilder.BRICKPOET_MOVE) + { + if (packet.Length < 0xB) + { + Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent invalid BRICKPOET MOVE packet (swf communication, WRONG SIZE)"); + break; + } + string packetStr = Encoding.UTF8.GetString(packet); + if(!packetStr.Contains('|')) + { + Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent invalid BRICKPOET MOVE packet (swf communication, NO | SEPERATOR)"); + break; + } + string[] args = packetStr.Split('|'); + if(args.Length < 5) + { + Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent invalid BRICKPOET MOVE Packet (swf communication, NOT ENOUGH | SEPERATORS."); + break; + } + + + int roomId = packet[2] - 40; + int peiceId; + int x; + int y; + Brickpoet.PoetryPeice[] room; + Brickpoet.PoetryPeice peice; + + try + { + peiceId = int.Parse(args[1]); + x = int.Parse(args[2]); + y = int.Parse(args[3]); + + + room = Brickpoet.GetPoetryRoom(roomId); + peice = Brickpoet.GetPoetryPeice(room, peiceId); + } + catch (Exception) + { + Logger.ErrorPrint(sender.LoggedinUser.Username + " tried to move a peice in an invalid brickpoet room: " + roomId); + break; + } + peice.X = x; + peice.Y = y; + + foreach(GameClient client in connectedClients) + { + if(client.LoggedIn) + { + if (client.LoggedinUser.Id == sender.LoggedinUser.Id) + continue; + + if (World.InSpecialTile(client.LoggedinUser.X, client.LoggedinUser.Y)) + { + World.SpecialTile tile = World.GetSpecialTile(client.LoggedinUser.X, client.LoggedinUser.Y); + + if (tile.Code.StartsWith("MULTIROOM-")) + { + string roomNo = tile.Code.Split('-')[1]; + if (roomNo == "P" + roomId.ToString()) + { + byte[] updatePoetRoomPacket = PacketBuilder.CreateBrickPoetMovePacket(peice); + client.SendPacket(updatePoetRoomPacket); + } + } + } + } + } + + break; + } + else + { + Logger.DebugPrint(" packet dump: " + BitConverter.ToString(packet).Replace("-", " ")); + break; + } + + break; + default: + Logger.DebugPrint("Unknown moduleid : " + module + " packet dump: " + BitConverter.ToString(packet).Replace("-"," ")); + break; + + } + + } + public static void OnWish(GameClient sender, byte[] packet) { if (!sender.LoggedIn) diff --git a/Horse Isle Server/Horse Isle Server/Server/PacketBuilder.cs b/Horse Isle Server/Horse Isle Server/Server/PacketBuilder.cs index c35fe74..6b340dd 100644 --- a/Horse Isle Server/Horse Isle Server/Server/PacketBuilder.cs +++ b/Horse Isle Server/Horse Isle Server/Server/PacketBuilder.cs @@ -2,6 +2,8 @@ using System.IO; using System.Text; using HISP.Game; +using HISP.Game.SwfModules; + namespace HISP.Server { class PacketBuilder @@ -39,6 +41,12 @@ namespace HISP.Server public const byte PACKET_PLAYERINFO = 0x16; public const byte PACKET_INFORMATION = 0x28; public const byte PACKET_WISH = 0x2C; + public const byte PACKET_SWFMODULE = 0x50; + + public const byte SWFMODULE_BRICKPOET = 0x5A; + + public const byte BRICKPOET_LIST_ALL = 0x14; + public const byte BRICKPOET_MOVE = 0x55; public const byte WISH_MONEY = 0x31; public const byte WISH_ITEMS = 0x32; @@ -112,7 +120,50 @@ namespace HISP.Server public const byte DIRECTION_TELEPORT = 4; public const byte DIRECTION_NONE = 10; + public static byte[] CreateBrickPoetMovePacket(Brickpoet.PoetryPeice peice) + { + MemoryStream ms = new MemoryStream(); + ms.WriteByte(PacketBuilder.PACKET_SWFMODULE); + ms.WriteByte(PacketBuilder.BRICKPOET_MOVE); + string packetStr = "|"; + packetStr += peice.Id + "|"; + packetStr += peice.X + "|"; + packetStr += peice.Y + "|"; + packetStr += "^"; + + byte[] infoBytes = Encoding.UTF8.GetBytes(packetStr); + ms.Write(infoBytes, 0x00, infoBytes.Length); + ms.WriteByte(PACKET_TERMINATOR); + ms.Seek(0x00, SeekOrigin.Begin); + return ms.ToArray(); + } + public static byte[] CreateBrickPoetListPacket(Brickpoet.PoetryPeice[] room) + { + MemoryStream ms = new MemoryStream(); + ms.WriteByte(PacketBuilder.PACKET_SWFMODULE); + string packetStr = ""; + foreach(Brickpoet.PoetryPeice peice in room) + { + packetStr += "A"; + packetStr += "|"; + packetStr += peice.Id; + packetStr += "|"; + packetStr += peice.Word.ToUpper(); + packetStr += "|"; + packetStr += peice.X; + packetStr += "|"; + packetStr += peice.Y; + packetStr += "|"; + packetStr += "^"; + } + byte[] packetBytes = Encoding.UTF8.GetBytes(packetStr); + ms.Write(packetBytes, 0x00, packetBytes.Length); + ms.WriteByte(PacketBuilder.PACKET_TERMINATOR); + + ms.Seek(0x00, SeekOrigin.Begin); + return ms.ToArray(); + } public static byte[] CreatePlaysoundPacket(string sound) { MemoryStream ms = new MemoryStream();