diff --git a/DataCollection/gamedata.json b/DataCollection/gamedata.json index eebe6e7..2266aa6 100644 --- a/DataCollection/gamedata.json +++ b/DataCollection/gamedata.json @@ -2,10 +2,18 @@ "login_format":"Welcome to the land of Horse Isle, %USERNAME%!!", "motd_format":"Today's Note: %MOTD%", "mail_received":"A message has been sent to you from another player. It is in your inventory now.", - "area_format":" You are on %AREA%
", - "nothing_message":"^LYou see nothing on the ground of interest.^R1", "login_message":"Player %USERNAME% has logged in", - "logout_message":"Player Tetra has disconnected", + "logout_message":"Player %USERNAME% has disconnected", + "profile_save":"Your profile changes were saved.", + "meta":{ + "isle_format":" on %ISLE%", + "town_format":" in the town %TOWN%", + "area_format":" in %AREA%", + "location_format":" You are%META% ", + "tile_format":"%TILENAME%", + "nothing_message":"^LYou see nothing on the ground of interest.^R1", + "seperator":"
" + }, "chat":{ "for_others":{ "global_format":"%USERNAME%: %MESSAGE%", @@ -35,7 +43,7 @@ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1] + 1,1,1,1,1,1], }, "overlay_tiles":{ "tile_depth":[3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,0,0,0,1,1,3,3,3,1,1,1,1,3,3,3, @@ -56,8 +64,11 @@ 2,2,2,2,2,2,3,2,1,3,3,2,2,3,3,2,2,2,3,0,0,3,2,2,2,2,2,2,3,3,2,1,1,1,1,1,2,3,3, 2,3,3,3,1,2,2,2,1,1,1,1,1,1,1,2,3,3,3,3,3,3,3,3,1,1,1,1,1,3,3,3,3,2,3,3,3,3,3, 3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,0,0,3,0,0,0,1,1,2,2,3,2,2,2,2,2,2, - 3,3,1,1,1,1,3,3,3,3] - + 3,3,1,1,1,1,3,3,3,3], + + "meta_names":[ + "Rock Pile" + ] } }, "new_user":{ @@ -65,124 +76,278 @@ "starting_x":523, "starting_y":138 }, - "isles":[ - {"start_x":613,"end_x":616,"start_y":286,"end_y":288,"tileset":0,"name":"The Neverending Isles"}, - {"start_x":672,"end_x":675,"start_y":260,"end_y":262,"tileset":0,"name":"Solomon Isle"}, - {"start_x":618,"end_x":623,"start_y":218,"end_y":222,"tileset":0,"name":"Palm Isle"}, - {"start_x":687,"end_x":692,"start_y":305,"end_y":311,"tileset":0,"name":"Nonesuch Isle"}, - {"start_x":638,"end_x":644,"start_y":349,"end_y":354,"tileset":6,"name":"Isle of Hardly"}, - {"start_x":623,"end_x":628,"start_y":277,"end_y":284,"tileset":0,"name":"The Neverending Isles"}, - {"start_x":595,"end_x":601,"start_y":195,"end_y":201,"tileset":0,"name":"Talon Isle"}, - {"start_x":619,"end_x":626,"start_y":291,"end_y":298,"tileset":0,"name":"The Neverending Isles"}, - {"start_x":670,"end_x":675,"start_y":323,"end_y":334,"tileset":0,"name":"Rock Isle"}, - {"start_x":638,"end_x":646,"start_y":285,"end_y":292,"tileset":0,"name":"The Neverending Isles"}, - {"start_x":639,"end_x":647,"start_y":271,"end_y":278,"tileset":0,"name":"The Neverending Isles"}, - {"start_x":683,"end_x":692,"start_y":320,"end_y":327,"tileset":0,"name":"Spirit Isle"}, - {"start_x":595,"end_x":606,"start_y":361,"end_y":367,"tileset":5,"name":"Puuhonua Isle"}, - {"start_x":611,"end_x":621,"start_y":357,"end_y":365,"tileset":0,"name":"Patsy Isle"}, - {"start_x":617,"end_x":627,"start_y":262,"end_y":270,"tileset":0,"name":"Spice Isle"}, - {"start_x":669,"end_x":677,"start_y":293,"end_y":303,"tileset":3,"name":"Haven Isle"}, - {"start_x":399,"end_x":407,"start_y":464,"end_y":475,"tileset":2,"name":"The Sand Isles"}, - {"start_x":670,"end_x":678,"start_y":304,"end_y":315,"tileset":3,"name":"Half Haven Isle"}, - {"start_x":674,"end_x":684,"start_y":223,"end_y":232,"tileset":0,"name":"Crazy Eddie's Isle"}, - {"start_x":640,"end_x":649,"start_y":211,"end_y":221,"tileset":0,"name":"Atropos Isle"}, - {"start_x":622,"end_x":632,"start_y":353,"end_y":362,"tileset":0,"name":"Patsy Isle"}, - {"start_x":360,"end_x":372,"start_y":419,"end_y":427,"tileset":2,"name":"The Sand Isles"}, - {"start_x":625,"end_x":636,"start_y":226,"end_y":235,"tileset":0,"name":"Mare Isle"}, - {"start_x":626,"end_x":640,"start_y":299,"end_y":309,"tileset":3,"name":"Tranquility Isle"}, - {"start_x":641,"end_x":650,"start_y":300,"end_y":316,"tileset":0,"name":"Serenity Isle"}, - {"start_x":626,"end_x":635,"start_y":203,"end_y":219,"tileset":0,"name":"Ardent Isle"}, - {"start_x":623,"end_x":637,"start_y":335,"end_y":346,"tileset":0,"name":"Drill Isle"}, - {"start_x":655,"end_x":669,"start_y":294,"end_y":305,"tileset":3,"name":"Haven Isle"}, - {"start_x":645,"end_x":661,"start_y":405,"end_y":415,"tileset":0,"name":"Aesop Isle"}, - {"start_x":693,"end_x":704,"start_y":265,"end_y":280,"tileset":0,"name":"Hotzeplotz Isle"}, - {"start_x":655,"end_x":669,"start_y":306,"end_y":319,"tileset":3,"name":"Haven Isle"}, - {"start_x":517,"end_x":528,"start_y":127,"end_y":145,"tileset":0,"name":"Welcome Isle"}, - {"start_x":602,"end_x":619,"start_y":198,"end_y":210,"tileset":0,"name":"Shimmer Isle"}, - {"start_x":625,"end_x":638,"start_y":313,"end_y":329,"tileset":0,"name":"Lilac Isle"}, - {"start_x":674,"end_x":685,"start_y":269,"end_y":289,"tileset":0,"name":"Loch Isle"}, - {"start_x":352,"end_x":374,"start_y":408,"end_y":418,"tileset":2,"name":"The Sand Isles"}, - {"start_x":433,"end_x":453,"start_y":217,"end_y":228,"tileset":2,"name":"Mane Isle"}, - {"start_x":677,"end_x":694,"start_y":203,"end_y":216,"tileset":0,"name":"Paradise Isle"}, - {"start_x":423,"end_x":439,"start_y":229,"end_y":243,"tileset":2,"name":"Mane Isle"}, - {"start_x":389,"end_x":398,"start_y":449,"end_y":474,"tileset":2,"name":"The Sand Isles"}, - {"start_x":694,"end_x":709,"start_y":286,"end_y":302,"tileset":0,"name":"Theobroma Isle"}, - {"start_x":702,"end_x":726,"start_y":23,"end_y":33,"tileset":1,"name":"Icicle Isle"}, - {"start_x":632,"end_x":647,"start_y":245,"end_y":262,"tileset":0,"name":"Quiet Isle"}, - {"start_x":705,"end_x":714,"start_y":246,"end_y":277,"tileset":0,"name":"Hotzeplotz Isle"}, - {"start_x":669,"end_x":695,"start_y":248,"end_y":260,"tileset":0,"name":"Bone Isle"}, - {"start_x":655,"end_x":674,"start_y":54,"end_y":72,"tileset":1,"name":"Snowball Isle"}, - {"start_x":550,"end_x":565,"start_y":25,"end_y":48,"tileset":1,"name":"Christmas Isle"}, - {"start_x":459,"end_x":482,"start_y":181,"end_y":197,"tileset":2,"name":"Mane Isle"}, - {"start_x":654,"end_x":666,"start_y":252,"end_y":283,"tileset":0,"name":"Crescent Isle"}, - {"start_x":645,"end_x":670,"start_y":323,"end_y":338,"tileset":0,"name":"Rock Isle"}, - {"start_x":626,"end_x":639,"start_y":166,"end_y":197,"tileset":0,"name":"Saddle Isle"}, - {"start_x":62,"end_x":89,"start_y":157,"end_y":173,"tileset":5,"name":"Rain Isle"}, - {"start_x":690,"end_x":715,"start_y":218,"end_y":236,"tileset":0,"name":"Eldorado Isle"}, - {"start_x":912,"end_x":935,"start_y":176,"end_y":196,"tileset":7,"name":"Tephra Isle"}, - {"start_x":384,"end_x":425,"start_y":18,"end_y":30,"tileset":1,"name":"Glacier Isle"}, - {"start_x":956,"end_x":981,"start_y":255,"end_y":276,"tileset":7,"name":"Scoria Isle"}, - {"start_x":552,"end_x":573,"start_y":58,"end_y":83,"tileset":1,"name":"Berg Isle"}, - {"start_x":439,"end_x":470,"start_y":198,"end_y":216,"tileset":2,"name":"Mane Isle"}, - {"start_x":380,"end_x":401,"start_y":295,"end_y":322,"tileset":0,"name":"Tail Isle"}, - {"start_x":968,"end_x":994,"start_y":31,"end_y":54,"tileset":3,"name":"Hat Isle"}, - {"start_x":656,"end_x":686,"start_y":26,"end_y":48,"tileset":1,"name":"Polar Isle"}, - {"start_x":726,"end_x":749,"start_y":263,"end_y":294,"tileset":0,"name":"Cabin Isle"}, - {"start_x":606,"end_x":636,"start_y":409,"end_y":433,"tileset":2,"name":"Dust Isle"}, - {"start_x":651,"end_x":672,"start_y":427,"end_y":463,"tileset":2,"name":"Torrid Isle"}, - {"start_x":652,"end_x":679,"start_y":215,"end_y":247,"tileset":0,"name":"Bone Isle"}, - {"start_x":284,"end_x":325,"start_y":372,"end_y":394,"tileset":0,"name":"Tail Isle"}, - {"start_x":700,"end_x":715,"start_y":145,"end_y":206,"tileset":0,"name":"Saddle Isle"}, - {"start_x":90,"end_x":117,"start_y":150,"end_y":184,"tileset":5,"name":"Vine Isle"}, - {"start_x":948,"end_x":994,"start_y":9,"end_y":30,"tileset":3,"name":"Hat Isle"}, - {"start_x":640,"end_x":661,"start_y":153,"end_y":202,"tileset":0,"name":"Saddle Isle"}, - {"start_x":326,"end_x":356,"start_y":356,"end_y":391,"tileset":0,"name":"Tail Isle"}, - {"start_x":529,"end_x":563,"start_y":344,"end_y":378,"tileset":0,"name":"Hoof Isle"}, - {"start_x":255,"end_x":283,"start_y":350,"end_y":394,"tileset":0,"name":"Tail Isle"}, - {"start_x":730,"end_x":786,"start_y":295,"end_y":317,"tileset":0,"name":"Cabin Isle"}, - {"start_x":360,"end_x":388,"start_y":431,"end_y":475,"tileset":2,"name":"The Sand Isles"}, - {"start_x":589,"end_x":625,"start_y":156,"end_y":191,"tileset":0,"name":"Saddle Isle"}, - {"start_x":15,"end_x":56,"start_y":15,"end_y":47,"tileset":0,"name":"Prison Isle"}, - {"start_x":612,"end_x":672,"start_y":435,"end_y":457,"tileset":2,"name":"Torrid Isle"}, - {"start_x":942,"end_x":981,"start_y":201,"end_y":235,"tileset":7,"name":"Magma Isle"}, - {"start_x":836,"end_x":879,"start_y":19,"end_y":50,"tileset":3,"name":"Treasure Isle"}, - {"start_x":616,"end_x":657,"start_y":115,"end_y":152,"tileset":0,"name":"Rider Isle"}, - {"start_x":48,"end_x":113,"start_y":185,"end_y":210,"tileset":5,"name":"Vine Isle"}, - {"start_x":317,"end_x":359,"start_y":419,"end_y":459,"tileset":2,"name":"The Sand Isles"}, - {"start_x":592,"end_x":656,"start_y":458,"end_y":487,"tileset":2,"name":"Torrid Isle"}, - {"start_x":708,"end_x":754,"start_y":382,"end_y":427,"tileset":7,"name":"Pumice Isle"}, - {"start_x":553,"end_x":585,"start_y":100,"end_y":170,"tileset":0,"name":"Horn Isle"}, - {"start_x":348,"end_x":403,"start_y":67,"end_y":108,"tileset":0,"name":"Art Isle"}, - {"start_x":562,"end_x":615,"start_y":287,"end_y":333,"tileset":0,"name":"Turtle Isle"}, - {"start_x":338,"end_x":389,"start_y":151,"end_y":201,"tileset":0,"name":"Cat Isle"}, - {"start_x":357,"end_x":405,"start_y":323,"end_y":380,"tileset":0,"name":"Tail Isle"}, - {"start_x":743,"end_x":840,"start_y":200,"end_y":230,"tileset":0,"name":"Whorl Isle"}, - {"start_x":750,"end_x":812,"start_y":246,"end_y":295,"tileset":0,"name":"Cabin Isle"}, - {"start_x":31,"end_x":94,"start_y":211,"end_y":261,"tileset":5,"name":"Vine Isle"}, - {"start_x":195,"end_x":254,"start_y":340,"end_y":394,"tileset":0,"name":"Starfish Isle"}, - {"start_x":126,"end_x":164,"start_y":20,"end_y":105,"tileset":5,"name":"Web Isle"}, - {"start_x":938,"end_x":985,"start_y":387,"end_y":457,"tileset":7,"name":"Basalt Isle"}, - {"start_x":662,"end_x":699,"start_y":111,"end_y":200,"tileset":0,"name":"Saddle Isle"}, - {"start_x":573,"end_x":654,"start_y":33,"end_y":74,"tileset":1,"name":"Ice Isle"}, - {"start_x":77,"end_x":125,"start_y":35,"end_y":108,"tileset":5,"name":"Web Isle"}, - {"start_x":450,"end_x":506,"start_y":78,"end_y":143,"tileset":0,"name":"Ring Isle"}, - {"start_x":275,"end_x":340,"start_y":290,"end_y":354,"tileset":4,"name":"Flower Isle"}, - {"start_x":293,"end_x":336,"start_y":170,"end_y":271,"tileset":0,"name":"Hare Isle"}, - {"start_x":391,"end_x":457,"start_y":118,"end_y":185,"tileset":0,"name":"Bird Isle"}, - {"start_x":657,"end_x":763,"start_y":25,"end_y":68,"tileset":1,"name":"Polar Isle"}, - {"start_x":843,"end_x":924,"start_y":218,"end_y":288,"tileset":7,"name":"Igneous Isle"}, - {"start_x":313,"end_x":351,"start_y":335,"end_y":491,"tileset":2,"name":"Yellow Brick Isle"}, - {"start_x":348,"end_x":412,"start_y":211,"end_y":309,"tileset":0,"name":"Dolphin Isle"}, - {"start_x":430,"end_x":551,"start_y":15,"end_y":70,"tileset":1,"name":"Snow Isle"}, - {"start_x":860,"end_x":967,"start_y":35,"end_y":123,"tileset":3,"name":"Pirate Isle"}, - {"start_x":737,"end_x":848,"start_y":94,"end_y":199,"tileset":0,"name":"Whorl Isle"}, - {"start_x":108,"end_x":234,"start_y":267,"end_y":361,"tileset":5,"name":"Jungle Isle"}, - {"start_x":774,"end_x":975,"start_y":287,"end_y":364,"tileset":7,"name":"Lava Isle"}, - {"start_x":382,"end_x":601,"start_y":407,"end_y":494,"tileset":2,"name":"Desert Isle"}, - {"start_x":31,"end_x":107,"start_y":79,"end_y":344,"tileset":5,"name":"Dog Isle"}, - {"start_x":750,"end_x":934,"start_y":364,"end_y":484,"tileset":7,"name":"Lava Isle"}, - {"start_x":11,"end_x":251,"start_y":366,"end_y":474,"tileset":6,"name":"The Cloud Isles"}, - {"start_x":409,"end_x":612,"start_y":155,"end_y":371,"tileset":0,"name":"Horse Isle"}, - {"start_x":108,"end_x":331,"start_y":55,"end_y":266,"tileset":5,"name":"Jungle Isle"} - ] + "places":{ + "towns":[ + {"start_x":219,"end_x":221,"start_y":136,"end_y":138,"name":"Tropicton Village"}, + {"start_x":307,"end_x":310,"start_y":102,"end_y":104,"name":"Rainy Meadows"}, + {"start_x":605,"end_x":609,"start_y":173,"end_y":176,"name":"Cantle Meadows"}, + {"start_x":262,"end_x":267,"start_y":367,"end_y":371,"name":"Tail End"}, + {"start_x":223,"end_x":226,"start_y":153,"end_y":161,"name":"Tropicton"}, + {"start_x":364,"end_x":372,"start_y":178,"end_y":181,"name":"Whiskerton"}, + {"start_x":434,"end_x":441,"start_y":443,"end_y":447,"name":"Sandy Meadows"}, + {"start_x":476,"end_x":481,"start_y":348,"end_y":355,"name":"Sunshine Meadows"}, + {"start_x":566,"end_x":574,"start_y":224,"end_y":229,"name":"Treeton"}, + {"start_x":895,"end_x":903,"start_y":89,"end_y":94,"name":"Crossbones Camp"}, + {"start_x":361,"end_x":373,"start_y":181,"end_y":185,"name":"Whiskerton"}, + {"start_x":439,"end_x":448,"start_y":171,"end_y":177,"name":"Soaring Meadows"}, + {"start_x":423,"end_x":433,"start_y":146,"end_y":152,"name":"Wington"}, + {"start_x":308,"end_x":315,"start_y":186,"end_y":195,"name":"Carrotton"}, + {"start_x":812,"end_x":822,"start_y":335,"end_y":342,"name":"Ashton"}, + {"start_x":618,"end_x":630,"start_y":55,"end_y":61,"name":"Crystalton"}, + {"start_x":631,"end_x":642,"start_y":138,"end_y":145,"name":"Witherton"}, + {"start_x":550,"end_x":563,"start_y":439,"end_y":445,"name":"Santon"}, + {"start_x":431,"end_x":440,"start_y":136,"end_y":145,"name":"Wington"}, + {"start_x":937,"end_x":949,"start_y":331,"end_y":338,"name":"Molten Meadows"}, + {"start_x":456,"end_x":471,"start_y":31,"end_y":37,"name":"Chillton"}, + {"start_x":941,"end_x":955,"start_y":53,"end_y":60,"name":"Skullton"}, + {"start_x":363,"end_x":373,"start_y":87,"end_y":97,"name":"Inkton"}, + {"start_x":221,"end_x":235,"start_y":162,"end_y":170,"name":"Tropicton"}, + {"start_x":375,"end_x":388,"start_y":243,"end_y":252,"name":"Flipperton"}, + {"start_x":536,"end_x":551,"start_y":364,"end_y":372,"name":"Horseshoe Village"}, + {"start_x":584,"end_x":596,"start_y":302,"end_y":313,"name":"Shellton"}, + {"start_x":425,"end_x":438,"start_y":323,"end_y":337,"name":"Appleton"}, + {"start_x":557,"end_x":573,"start_y":230,"end_y":242,"name":"Treeton"}, + {"start_x":464,"end_x":479,"start_y":414,"end_y":427,"name":"Hotton"}, + {"start_x":514,"end_x":535,"start_y":170,"end_y":184,"name":"Earton"} + ], + "areas":[ + {"start_x":472,"end_x":475,"start_y":187,"end_y":188,"name":"Past Its Prime Forest"}, + {"start_x":314,"end_x":316,"start_y":181,"end_y":184,"name":"Velveteen Forest"}, + {"start_x":317,"end_x":319,"start_y":184,"end_y":187,"name":"Velveteen Forest"}, + {"start_x":473,"end_x":477,"start_y":185,"end_y":187,"name":"Past Its Prime Forest"}, + {"start_x":470,"end_x":474,"start_y":189,"end_y":191,"name":"Past Its Prime Forest"}, + {"start_x":679,"end_x":683,"start_y":136,"end_y":138,"name":"Mystic Forest"}, + {"start_x":481,"end_x":484,"start_y":420,"end_y":423,"name":"Toasty Forest"}, + {"start_x":574,"end_x":576,"start_y":245,"end_y":250,"name":"Muzzle Forest"}, + {"start_x":378,"end_x":384,"start_y":236,"end_y":238,"name":"Flipper Forest"}, + {"start_x":457,"end_x":461,"start_y":421,"end_y":424,"name":"Sweltry Forest"}, + {"start_x":938,"end_x":940,"start_y":66,"end_y":73,"name":"Patch Forest"}, + {"start_x":359,"end_x":361,"start_y":285,"end_y":292,"name":"Flipper Forest"}, + {"start_x":372,"end_x":376,"start_y":229,"end_y":233,"name":"Blowhole Forest"}, + {"start_x":299,"end_x":303,"start_y":222,"end_y":226,"name":"Bunny Hop Forest"}, + {"start_x":372,"end_x":380,"start_y":239,"end_y":241,"name":"Flipper Forest"}, + {"start_x":453,"end_x":457,"start_y":204,"end_y":208,"name":"Sea of Sand"}, + {"start_x":593,"end_x":594,"start_y":232,"end_y":249,"name":"Muzzle Forest"}, + {"start_x":372,"end_x":381,"start_y":177,"end_y":179,"name":"Catnip Forest"}, + {"start_x":481,"end_x":487,"start_y":416,"end_y":419,"name":"Toasty Forest"}, + {"start_x":516,"end_x":518,"start_y":342,"end_y":352,"name":"Tail Forest"}, + {"start_x":391,"end_x":395,"start_y":83,"end_y":88,"name":"Flower Forest"}, + {"start_x":325,"end_x":329,"start_y":252,"end_y":257,"name":"Thumper Forest"}, + {"start_x":368,"end_x":373,"start_y":74,"end_y":78,"name":"Snowy Acres"}, + {"start_x":654,"end_x":659,"start_y":164,"end_y":168,"name":"Mystic Forest"}, + {"start_x":419,"end_x":426,"start_y":337,"end_y":340,"name":"Moon Forest"}, + {"start_x":300,"end_x":303,"start_y":238,"end_y":245,"name":"Bunny Hop Forest"}, + {"start_x":367,"end_x":369,"start_y":271,"end_y":282,"name":"Flipper Forest"}, + {"start_x":361,"end_x":372,"start_y":191,"end_y":193,"name":"Catnip Forest"}, + {"start_x":303,"end_x":315,"start_y":333,"end_y":335,"name":"Dew Forest"}, + {"start_x":431,"end_x":443,"start_y":350,"end_y":352,"name":"Moon Forest"}, + {"start_x":378,"end_x":383,"start_y":89,"end_y":94,"name":"Painted Bay"}, + {"start_x":359,"end_x":364,"start_y":80,"end_y":85,"name":"Sandy Palms"}, + {"start_x":580,"end_x":584,"start_y":313,"end_y":320,"name":"Shell Forest"}, + {"start_x":372,"end_x":376,"start_y":254,"end_y":261,"name":"Flipper Forest"}, + {"start_x":599,"end_x":603,"start_y":304,"end_y":311,"name":"Shell Forest"}, + {"start_x":324,"end_x":331,"start_y":303,"end_y":307,"name":"Wildflower Forest"}, + {"start_x":382,"end_x":388,"start_y":342,"end_y":347,"name":"Lost Forest"}, + {"start_x":600,"end_x":603,"start_y":238,"end_y":248,"name":"Muzzle Forest"}, + {"start_x":357,"end_x":362,"start_y":186,"end_y":192,"name":"Catnip Forest"}, + {"start_x":281,"end_x":286,"start_y":300,"end_y":306,"name":"Daisy Forest"}, + {"start_x":564,"end_x":572,"start_y":244,"end_y":248,"name":"Muzzle Forest"}, + {"start_x":304,"end_x":308,"start_y":177,"end_y":185,"name":"Velveteen Forest"}, + {"start_x":301,"end_x":305,"start_y":183,"end_y":191,"name":"Velveteen Forest"}, + {"start_x":368,"end_x":379,"start_y":187,"end_y":190,"name":"Catnip Forest"}, + {"start_x":487,"end_x":489,"start_y":347,"end_y":364,"name":"Tail Forest"}, + {"start_x":355,"end_x":360,"start_y":178,"end_y":185,"name":"Catnip Forest"}, + {"start_x":597,"end_x":604,"start_y":311,"end_y":316,"name":"Shell Forest"}, + {"start_x":503,"end_x":506,"start_y":258,"end_y":270,"name":"Mane Forest"}, + {"start_x":369,"end_x":379,"start_y":172,"end_y":176,"name":"Catnip Forest"}, + {"start_x":541,"end_x":546,"start_y":355,"end_y":363,"name":"Hoof Forest"}, + {"start_x":546,"end_x":560,"start_y":225,"end_y":228,"name":"West Treeton Forest"}, + {"start_x":449,"end_x":460,"start_y":416,"end_y":420,"name":"Sweltry Forest"}, + {"start_x":519,"end_x":528,"start_y":163,"end_y":168,"name":"Eartip Forest"}, + {"start_x":428,"end_x":437,"start_y":288,"end_y":293,"name":"Little Appleton Forest"}, + {"start_x":430,"end_x":438,"start_y":282,"end_y":288,"name":"Little Appleton Forest"}, + {"start_x":425,"end_x":433,"start_y":233,"end_y":239,"name":"Prickly Spit"}, + {"start_x":418,"end_x":422,"start_y":325,"end_y":337,"name":"Moon Forest"}, + {"start_x":553,"end_x":565,"start_y":208,"end_y":212,"name":"West Treeton Forest"}, + {"start_x":374,"end_x":381,"start_y":180,"end_y":187,"name":"Catnip Forest"}, + {"start_x":298,"end_x":303,"start_y":227,"end_y":237,"name":"Bunny Hop Forest"}, + {"start_x":378,"end_x":388,"start_y":348,"end_y":353,"name":"Lost Forest"}, + {"start_x":932,"end_x":937,"start_y":63,"end_y":74,"name":"Patch Forest"}, + {"start_x":361,"end_x":389,"start_y":365,"end_y":367,"name":"Lost Forest"}, + {"start_x":595,"end_x":599,"start_y":235,"end_y":249,"name":"Muzzle Forest"}, + {"start_x":306,"end_x":313,"start_y":176,"end_y":184,"name":"Velveteen Forest"}, + {"start_x":679,"end_x":689,"start_y":139,"end_y":145,"name":"Mystic Forest"}, + {"start_x":431,"end_x":452,"start_y":346,"end_y":349,"name":"Moon Forest"}, + {"start_x":319,"end_x":332,"start_y":296,"end_y":301,"name":"Wildflower Forest"}, + {"start_x":483,"end_x":489,"start_y":352,"end_y":363,"name":"Tail Forest"}, + {"start_x":660,"end_x":670,"start_y":161,"end_y":168,"name":"Mystic Forest"}, + {"start_x":418,"end_x":428,"start_y":316,"end_y":323,"name":"Moon Forest"}, + {"start_x":424,"end_x":433,"start_y":294,"end_y":302,"name":"Little Appleton Forest"}, + {"start_x":747,"end_x":756,"start_y":42,"end_y":50,"name":"Frigid Meadows"}, + {"start_x":469,"end_x":487,"start_y":230,"end_y":234,"name":"Mane Forest"}, + {"start_x":474,"end_x":485,"start_y":280,"end_y":287,"name":"Horse Isle Equestrian Park"}, + {"start_x":421,"end_x":430,"start_y":303,"end_y":312,"name":"Little Appleton Forest"}, + {"start_x":482,"end_x":489,"start_y":332,"end_y":344,"name":"Tail Forest"}, + {"start_x":642,"end_x":663,"start_y":190,"end_y":194,"name":"Mystic Forest"}, + {"start_x":299,"end_x":307,"start_y":192,"end_y":203,"name":"Velveteen Forest"}, + {"start_x":367,"end_x":390,"start_y":360,"end_y":364,"name":"Lost Forest"}, + {"start_x":548,"end_x":567,"start_y":219,"end_y":224,"name":"West Treeton Forest"}, + {"start_x":518,"end_x":534,"start_y":215,"end_y":221,"name":"Big Forest"}, + {"start_x":370,"end_x":390,"start_y":354,"end_y":359,"name":"Lost Forest"}, + {"start_x":923,"end_x":931,"start_y":61,"end_y":74,"name":"Patch Forest"}, + {"start_x":462,"end_x":469,"start_y":237,"end_y":252,"name":"Mane Forest"}, + {"start_x":643,"end_x":696,"start_y":169,"end_y":171,"name":"Mystic Forest"}, + {"start_x":356,"end_x":368,"start_y":168,"end_y":177,"name":"Catnip Forest"}, + {"start_x":512,"end_x":516,"start_y":331,"end_y":359,"name":"Tail Forest"}, + {"start_x":548,"end_x":571,"start_y":213,"end_y":218,"name":"West Treeton Forest"}, + {"start_x":587,"end_x":592,"start_y":228,"end_y":251,"name":"Muzzle Forest"}, + {"start_x":676,"end_x":693,"start_y":146,"end_y":153,"name":"Mystic Forest"}, + {"start_x":545,"end_x":555,"start_y":229,"end_y":241,"name":"West Treeton Forest"}, + {"start_x":374,"end_x":386,"start_y":87,"end_y":97,"name":"The Shores of Painted Bay"}, + {"start_x":584,"end_x":602,"start_y":316,"end_y":323,"name":"Shell Forest"}, + {"start_x":363,"end_x":371,"start_y":228,"end_y":244,"name":"Flipper Forest"}, + {"start_x":361,"end_x":367,"start_y":271,"end_y":293,"name":"Flipper Forest"}, + {"start_x":496,"end_x":502,"start_y":249,"end_y":272,"name":"Mane Forest"}, + {"start_x":516,"end_x":537,"start_y":207,"end_y":214,"name":"Big Forest"}, + {"start_x":508,"end_x":512,"start_y":325,"end_y":362,"name":"Tail Forest"}, + {"start_x":513,"end_x":529,"start_y":222,"end_y":232,"name":"Big Forest"}, + {"start_x":323,"end_x":330,"start_y":228,"end_y":251,"name":"Thumper Forest"}, + {"start_x":511,"end_x":539,"start_y":190,"end_y":196,"name":"Big Forest"}, + {"start_x":631,"end_x":674,"start_y":185,"end_y":189,"name":"Mystic Forest"}, + {"start_x":420,"end_x":455,"start_y":340,"end_y":345,"name":"Moon Forest"}, + {"start_x":640,"end_x":651,"start_y":123,"end_y":139,"name":"Bridle Forest"}, + {"start_x":365,"end_x":372,"start_y":245,"end_y":271,"name":"Flipper Forest"}, + {"start_x":577,"end_x":586,"start_y":223,"end_y":250,"name":"Muzzle Forest"}, + {"start_x":293,"end_x":303,"start_y":305,"end_y":330,"name":"Dew Forest"}, + {"start_x":474,"end_x":495,"start_y":259,"end_y":271,"name":"Mane Forest"}, + {"start_x":440,"end_x":458,"start_y":322,"end_y":339,"name":"Moon Forest"}, + {"start_x":671,"end_x":696,"start_y":154,"end_y":168,"name":"Mystic Forest"}, + {"start_x":304,"end_x":317,"start_y":304,"end_y":332,"name":"Dew Forest"}, + {"start_x":506,"end_x":551,"start_y":197,"end_y":206,"name":"Big Forest"}, + {"start_x":290,"end_x":324,"start_y":311,"end_y":324,"name":"Dew Forest"}, + {"start_x":470,"end_x":495,"start_y":235,"end_y":258,"name":"Mane Forest"}, + {"start_x":489,"end_x":508,"start_y":322,"end_y":365,"name":"Tail Forest"}, + {"start_x":614,"end_x":698,"start_y":172,"end_y":184,"name":"Mystic Forest"} + ], + "isles":[ + {"start_x":613,"end_x":616,"start_y":286,"end_y":288,"tileset":0,"name":"The Neverending Isles"}, + {"start_x":672,"end_x":675,"start_y":260,"end_y":262,"tileset":0,"name":"Solomon Isle"}, + {"start_x":618,"end_x":623,"start_y":218,"end_y":222,"tileset":0,"name":"Palm Isle"}, + {"start_x":687,"end_x":692,"start_y":305,"end_y":311,"tileset":0,"name":"Nonesuch Isle"}, + {"start_x":638,"end_x":644,"start_y":349,"end_y":354,"tileset":6,"name":"Isle of Hardly"}, + {"start_x":623,"end_x":628,"start_y":277,"end_y":284,"tileset":0,"name":"The Neverending Isles"}, + {"start_x":595,"end_x":601,"start_y":195,"end_y":201,"tileset":0,"name":"Talon Isle"}, + {"start_x":619,"end_x":626,"start_y":291,"end_y":298,"tileset":0,"name":"The Neverending Isles"}, + {"start_x":670,"end_x":675,"start_y":323,"end_y":334,"tileset":0,"name":"Rock Isle"}, + {"start_x":638,"end_x":646,"start_y":285,"end_y":292,"tileset":0,"name":"The Neverending Isles"}, + {"start_x":639,"end_x":647,"start_y":271,"end_y":278,"tileset":0,"name":"The Neverending Isles"}, + {"start_x":683,"end_x":692,"start_y":320,"end_y":327,"tileset":0,"name":"Spirit Isle"}, + {"start_x":595,"end_x":606,"start_y":361,"end_y":367,"tileset":5,"name":"Puuhonua Isle"}, + {"start_x":611,"end_x":621,"start_y":357,"end_y":365,"tileset":0,"name":"Patsy Isle"}, + {"start_x":617,"end_x":627,"start_y":262,"end_y":270,"tileset":0,"name":"Spice Isle"}, + {"start_x":669,"end_x":677,"start_y":293,"end_y":303,"tileset":3,"name":"Haven Isle"}, + {"start_x":399,"end_x":407,"start_y":464,"end_y":475,"tileset":2,"name":"The Sand Isles"}, + {"start_x":670,"end_x":678,"start_y":304,"end_y":315,"tileset":3,"name":"Half Haven Isle"}, + {"start_x":674,"end_x":684,"start_y":223,"end_y":232,"tileset":0,"name":"Crazy Eddie's Isle"}, + {"start_x":640,"end_x":649,"start_y":211,"end_y":221,"tileset":0,"name":"Atropos Isle"}, + {"start_x":622,"end_x":632,"start_y":353,"end_y":362,"tileset":0,"name":"Patsy Isle"}, + {"start_x":360,"end_x":372,"start_y":419,"end_y":427,"tileset":2,"name":"The Sand Isles"}, + {"start_x":625,"end_x":636,"start_y":226,"end_y":235,"tileset":0,"name":"Mare Isle"}, + {"start_x":626,"end_x":640,"start_y":299,"end_y":309,"tileset":3,"name":"Tranquility Isle"}, + {"start_x":641,"end_x":650,"start_y":300,"end_y":316,"tileset":0,"name":"Serenity Isle"}, + {"start_x":626,"end_x":635,"start_y":203,"end_y":219,"tileset":0,"name":"Ardent Isle"}, + {"start_x":623,"end_x":637,"start_y":335,"end_y":346,"tileset":0,"name":"Drill Isle"}, + {"start_x":655,"end_x":669,"start_y":294,"end_y":305,"tileset":3,"name":"Haven Isle"}, + {"start_x":645,"end_x":661,"start_y":405,"end_y":415,"tileset":0,"name":"Aesop Isle"}, + {"start_x":693,"end_x":704,"start_y":265,"end_y":280,"tileset":0,"name":"Hotzeplotz Isle"}, + {"start_x":655,"end_x":669,"start_y":306,"end_y":319,"tileset":3,"name":"Haven Isle"}, + {"start_x":517,"end_x":528,"start_y":127,"end_y":145,"tileset":0,"name":"Welcome Isle"}, + {"start_x":602,"end_x":619,"start_y":198,"end_y":210,"tileset":0,"name":"Shimmer Isle"}, + {"start_x":625,"end_x":638,"start_y":313,"end_y":329,"tileset":0,"name":"Lilac Isle"}, + {"start_x":674,"end_x":685,"start_y":269,"end_y":289,"tileset":0,"name":"Loch Isle"}, + {"start_x":352,"end_x":374,"start_y":408,"end_y":418,"tileset":2,"name":"The Sand Isles"}, + {"start_x":433,"end_x":453,"start_y":217,"end_y":228,"tileset":2,"name":"Mane Isle"}, + {"start_x":677,"end_x":694,"start_y":203,"end_y":216,"tileset":0,"name":"Paradise Isle"}, + {"start_x":423,"end_x":439,"start_y":229,"end_y":243,"tileset":2,"name":"Mane Isle"}, + {"start_x":389,"end_x":398,"start_y":449,"end_y":474,"tileset":2,"name":"The Sand Isles"}, + {"start_x":694,"end_x":709,"start_y":286,"end_y":302,"tileset":0,"name":"Theobroma Isle"}, + {"start_x":702,"end_x":726,"start_y":23,"end_y":33,"tileset":1,"name":"Icicle Isle"}, + {"start_x":632,"end_x":647,"start_y":245,"end_y":262,"tileset":0,"name":"Quiet Isle"}, + {"start_x":705,"end_x":714,"start_y":246,"end_y":277,"tileset":0,"name":"Hotzeplotz Isle"}, + {"start_x":669,"end_x":695,"start_y":248,"end_y":260,"tileset":0,"name":"Bone Isle"}, + {"start_x":655,"end_x":674,"start_y":54,"end_y":72,"tileset":1,"name":"Snowball Isle"}, + {"start_x":550,"end_x":565,"start_y":25,"end_y":48,"tileset":1,"name":"Christmas Isle"}, + {"start_x":459,"end_x":482,"start_y":181,"end_y":197,"tileset":2,"name":"Mane Isle"}, + {"start_x":654,"end_x":666,"start_y":252,"end_y":283,"tileset":0,"name":"Crescent Isle"}, + {"start_x":645,"end_x":670,"start_y":323,"end_y":338,"tileset":0,"name":"Rock Isle"}, + {"start_x":626,"end_x":639,"start_y":166,"end_y":197,"tileset":0,"name":"Saddle Isle"}, + {"start_x":62,"end_x":89,"start_y":157,"end_y":173,"tileset":5,"name":"Rain Isle"}, + {"start_x":690,"end_x":715,"start_y":218,"end_y":236,"tileset":0,"name":"Eldorado Isle"}, + {"start_x":912,"end_x":935,"start_y":176,"end_y":196,"tileset":7,"name":"Tephra Isle"}, + {"start_x":384,"end_x":425,"start_y":18,"end_y":30,"tileset":1,"name":"Glacier Isle"}, + {"start_x":956,"end_x":981,"start_y":255,"end_y":276,"tileset":7,"name":"Scoria Isle"}, + {"start_x":552,"end_x":573,"start_y":58,"end_y":83,"tileset":1,"name":"Berg Isle"}, + {"start_x":439,"end_x":470,"start_y":198,"end_y":216,"tileset":2,"name":"Mane Isle"}, + {"start_x":380,"end_x":401,"start_y":295,"end_y":322,"tileset":0,"name":"Tail Isle"}, + {"start_x":968,"end_x":994,"start_y":31,"end_y":54,"tileset":3,"name":"Hat Isle"}, + {"start_x":656,"end_x":686,"start_y":26,"end_y":48,"tileset":1,"name":"Polar Isle"}, + {"start_x":726,"end_x":749,"start_y":263,"end_y":294,"tileset":0,"name":"Cabin Isle"}, + {"start_x":606,"end_x":636,"start_y":409,"end_y":433,"tileset":2,"name":"Dust Isle"}, + {"start_x":651,"end_x":672,"start_y":427,"end_y":463,"tileset":2,"name":"Torrid Isle"}, + {"start_x":652,"end_x":679,"start_y":215,"end_y":247,"tileset":0,"name":"Bone Isle"}, + {"start_x":284,"end_x":325,"start_y":372,"end_y":394,"tileset":0,"name":"Tail Isle"}, + {"start_x":700,"end_x":715,"start_y":145,"end_y":206,"tileset":0,"name":"Saddle Isle"}, + {"start_x":90,"end_x":117,"start_y":150,"end_y":184,"tileset":5,"name":"Vine Isle"}, + {"start_x":948,"end_x":994,"start_y":9,"end_y":30,"tileset":3,"name":"Hat Isle"}, + {"start_x":640,"end_x":661,"start_y":153,"end_y":202,"tileset":0,"name":"Saddle Isle"}, + {"start_x":326,"end_x":356,"start_y":356,"end_y":391,"tileset":0,"name":"Tail Isle"}, + {"start_x":529,"end_x":563,"start_y":344,"end_y":378,"tileset":0,"name":"Hoof Isle"}, + {"start_x":255,"end_x":283,"start_y":350,"end_y":394,"tileset":0,"name":"Tail Isle"}, + {"start_x":730,"end_x":786,"start_y":295,"end_y":317,"tileset":0,"name":"Cabin Isle"}, + {"start_x":360,"end_x":388,"start_y":431,"end_y":475,"tileset":2,"name":"The Sand Isles"}, + {"start_x":589,"end_x":625,"start_y":156,"end_y":191,"tileset":0,"name":"Saddle Isle"}, + {"start_x":15,"end_x":56,"start_y":15,"end_y":47,"tileset":0,"name":"Prison Isle"}, + {"start_x":612,"end_x":672,"start_y":435,"end_y":457,"tileset":2,"name":"Torrid Isle"}, + {"start_x":942,"end_x":981,"start_y":201,"end_y":235,"tileset":7,"name":"Magma Isle"}, + {"start_x":836,"end_x":879,"start_y":19,"end_y":50,"tileset":3,"name":"Treasure Isle"}, + {"start_x":616,"end_x":657,"start_y":115,"end_y":152,"tileset":0,"name":"Rider Isle"}, + {"start_x":48,"end_x":113,"start_y":185,"end_y":210,"tileset":5,"name":"Vine Isle"}, + {"start_x":317,"end_x":359,"start_y":419,"end_y":459,"tileset":2,"name":"The Sand Isles"}, + {"start_x":592,"end_x":656,"start_y":458,"end_y":487,"tileset":2,"name":"Torrid Isle"}, + {"start_x":708,"end_x":754,"start_y":382,"end_y":427,"tileset":7,"name":"Pumice Isle"}, + {"start_x":553,"end_x":585,"start_y":100,"end_y":170,"tileset":0,"name":"Horn Isle"}, + {"start_x":348,"end_x":403,"start_y":67,"end_y":108,"tileset":0,"name":"Art Isle"}, + {"start_x":562,"end_x":615,"start_y":287,"end_y":333,"tileset":0,"name":"Turtle Isle"}, + {"start_x":338,"end_x":389,"start_y":151,"end_y":201,"tileset":0,"name":"Cat Isle"}, + {"start_x":357,"end_x":405,"start_y":323,"end_y":380,"tileset":0,"name":"Tail Isle"}, + {"start_x":743,"end_x":840,"start_y":200,"end_y":230,"tileset":0,"name":"Whorl Isle"}, + {"start_x":750,"end_x":812,"start_y":246,"end_y":295,"tileset":0,"name":"Cabin Isle"}, + {"start_x":31,"end_x":94,"start_y":211,"end_y":261,"tileset":5,"name":"Vine Isle"}, + {"start_x":195,"end_x":254,"start_y":340,"end_y":394,"tileset":0,"name":"Starfish Isle"}, + {"start_x":126,"end_x":164,"start_y":20,"end_y":105,"tileset":5,"name":"Web Isle"}, + {"start_x":938,"end_x":985,"start_y":387,"end_y":457,"tileset":7,"name":"Basalt Isle"}, + {"start_x":662,"end_x":699,"start_y":111,"end_y":200,"tileset":0,"name":"Saddle Isle"}, + {"start_x":573,"end_x":654,"start_y":33,"end_y":74,"tileset":1,"name":"Ice Isle"}, + {"start_x":77,"end_x":125,"start_y":35,"end_y":108,"tileset":5,"name":"Web Isle"}, + {"start_x":450,"end_x":506,"start_y":78,"end_y":143,"tileset":0,"name":"Ring Isle"}, + {"start_x":275,"end_x":340,"start_y":290,"end_y":354,"tileset":4,"name":"Flower Isle"}, + {"start_x":293,"end_x":336,"start_y":170,"end_y":271,"tileset":0,"name":"Hare Isle"}, + {"start_x":391,"end_x":457,"start_y":118,"end_y":185,"tileset":0,"name":"Bird Isle"}, + {"start_x":657,"end_x":763,"start_y":25,"end_y":68,"tileset":1,"name":"Polar Isle"}, + {"start_x":843,"end_x":924,"start_y":218,"end_y":288,"tileset":7,"name":"Igneous Isle"}, + {"start_x":313,"end_x":351,"start_y":335,"end_y":491,"tileset":2,"name":"Yellow Brick Isle"}, + {"start_x":348,"end_x":412,"start_y":211,"end_y":309,"tileset":0,"name":"Dolphin Isle"}, + {"start_x":430,"end_x":551,"start_y":15,"end_y":70,"tileset":1,"name":"Snow Isle"}, + {"start_x":860,"end_x":967,"start_y":35,"end_y":123,"tileset":3,"name":"Pirate Isle"}, + {"start_x":737,"end_x":848,"start_y":94,"end_y":199,"tileset":0,"name":"Whorl Isle"}, + {"start_x":108,"end_x":234,"start_y":267,"end_y":361,"tileset":5,"name":"Jungle Isle"}, + {"start_x":774,"end_x":975,"start_y":287,"end_y":364,"tileset":7,"name":"Lava Isle"}, + {"start_x":382,"end_x":601,"start_y":407,"end_y":494,"tileset":2,"name":"Desert Isle"}, + {"start_x":31,"end_x":107,"start_y":79,"end_y":344,"tileset":5,"name":"Dog Isle"}, + {"start_x":750,"end_x":934,"start_y":364,"end_y":484,"tileset":7,"name":"Lava Isle"}, + {"start_x":11,"end_x":251,"start_y":366,"end_y":474,"tileset":6,"name":"The Cloud Isles"}, + {"start_x":409,"end_x":612,"start_y":155,"end_y":371,"tileset":0,"name":"Horse Isle"}, + {"start_x":108,"end_x":331,"start_y":55,"end_y":266,"tileset":5,"name":"Jungle Isle"} + ] + } } \ No newline at end of file diff --git a/Horse Isle Server/Horse Isle Server/Client.cs b/Horse Isle Server/Horse Isle Server/Client.cs index 3d9fbeb..c1f53d2 100644 --- a/Horse Isle Server/Horse Isle Server/Client.cs +++ b/Horse Isle Server/Horse Isle Server/Client.cs @@ -19,12 +19,20 @@ namespace Horse_Isle_Server public User LoggedinUser; private Thread recvPackets; + private Timer updateTimer; - + private void updateTimerTick(object state) + { + Logger.DebugPrint("Sending update packet to "+ LoggedinUser.Username); + byte[] updatePacket = PacketBuilder.CreateUpdate(); + SendPacket(updatePacket); + } public void Login(int id) { LoggedinUser = new User(id); LoggedIn = true; + + } private void receivePackets() { @@ -99,6 +107,12 @@ namespace Horse_Isle_Server case PacketBuilder.PACKET_MOVE: Server.OnMovementPacket(this, Packet); break; + case PacketBuilder.PACKET_PROFILE: + Server.OnProfilePacket(this, Packet); + break; + case PacketBuilder.PACKET_UPDATE: + Server.OnUpdatePacket(this, Packet); + break; default: Logger.ErrorPrint("Unimplemented Packet: " + BitConverter.ToString(Packet).Replace('-', ' ')); break; @@ -109,15 +123,26 @@ namespace Horse_Isle_Server public void Disconnect() { Logger.DebugPrint(ClientSocket.RemoteEndPoint + " has Disconnected."); + recvPackets.Abort(); + updateTimer.Dispose(); LoggedIn = false; LoggedinUser = null; Server.ConnectedClients.Remove(this); + ClientSocket.Close(); ClientSocket.Dispose(); } public void SendPacket(byte[] PacketData) { - ClientSocket.Send(PacketData); + try + { + ClientSocket.Send(PacketData); + } + catch (SocketException e) + { + Logger.ErrorPrint("Socket exception occured: " + e.Message + " and so it was disconnected."); + Disconnect(); + } } public Client(Socket clientSocket) @@ -126,6 +151,7 @@ namespace Horse_Isle_Server RemoteIp = clientSocket.RemoteEndPoint.ToString(); Logger.DebugPrint("Client connected @ " + RemoteIp); + updateTimer = new Timer(new TimerCallback(updateTimerTick), null, 60 * 1000, 60 * 1000); recvPackets = new Thread(() => { diff --git a/Horse Isle Server/Horse Isle Server/Gamedata.cs b/Horse Isle Server/Horse Isle Server/Gamedata.cs index 03ddb91..3261dc2 100644 --- a/Horse Isle Server/Horse Isle Server/Gamedata.cs +++ b/Horse Isle Server/Horse Isle Server/Gamedata.cs @@ -21,30 +21,73 @@ namespace Horse_Isle_Server string jsonData = File.ReadAllText(ConfigReader.GameDataFile); dynamic gameData = JsonConvert.DeserializeObject(jsonData); - int totalIsles = gameData.isles.Count; + // Register Towns + int totalTowns = gameData.places.towns.Count; + for (int i = 0; i < totalTowns; i++) + { + + World.Town town = new World.Town(); + town.StartX = gameData.places.towns[i].start_x; + town.StartY = gameData.places.towns[i].start_y; + town.EndX = gameData.places.towns[i].end_x; + town.EndY = gameData.places.towns[i].end_y; + town.Name = gameData.places.towns[i].name; + + Logger.DebugPrint("Registered Town: " + town.Name + " X " + town.StartX + "-" + town.EndX + " Y " + town.StartY + "-" + town.EndY); + World.Towns.Add(town); + } + + // Register Areas + int totalAreas = gameData.places.towns.Count; + for (int i = 0; i < totalAreas; i++) + { + + World.Area area = new World.Area(); + area.StartX = gameData.places.areas[i].start_x; + area.StartY = gameData.places.areas[i].start_y; + area.EndX = gameData.places.areas[i].end_x; + area.EndY = gameData.places.areas[i].end_y; + area.Name = gameData.places.areas[i].name; + + Logger.DebugPrint("Registered Area: " + area.Name + " X " + area.StartX + "-" + area.EndX + " Y " + area.StartY + "-" + area.EndY); + World.Areas.Add(area); + } + + // Register Isles + int totalIsles = gameData.places.isles.Count; for(int i = 0; i < totalIsles; i++) { World.Isle isle = new World.Isle(); - isle.StartX = gameData.isles[i].start_x; - isle.StartY = gameData.isles[i].start_y; - isle.EndX = gameData.isles[i].end_x; - isle.EndY = gameData.isles[i].end_y; - isle.Tileset = gameData.isles[i].tileset; - isle.Name = gameData.isles[i].name; + isle.StartX = gameData.places.isles[i].start_x; + isle.StartY = gameData.places.isles[i].start_y; + isle.EndX = gameData.places.isles[i].end_x; + isle.EndY = gameData.places.isles[i].end_y; + isle.Tileset = gameData.places.isles[i].tileset; + isle.Name = gameData.places.isles[i].name; Logger.DebugPrint("Registered Isle: " + isle.Name + " X " + isle.StartX + "-" + isle.EndX + " Y " + isle.StartY + "-" + isle.EndY + " tileset: " + isle.Tileset); World.Isles.Add(isle); } + Messages.NewUserMessage = gameData.new_user.starting_message; Map.NewUserStartX = gameData.new_user.starting_x; Map.NewUserStartY = gameData.new_user.starting_y; Messages.LoginFormat = gameData.messages.login_format; - Messages.AreaMessage = gameData.messages.area_format; - Messages.NothingMessage = gameData.messages.nothing_message; Messages.MotdFormat = gameData.messages.motd_format; + Messages.ProfileSavedMessage = gameData.messages.profile_save; + + Messages.IsleFormat = gameData.messages.meta.isle_format; + Messages.TownFormat = gameData.messages.meta.town_format; + Messages.AreaFormat = gameData.messages.meta.area_format; + Messages.LocationFormat = gameData.messages.meta.location_format; + + Messages.Sepeerator = gameData.messages.meta.seperator; + + Messages.TileFormat = gameData.messages.meta.tile_format; + Messages.NothingMessage = gameData.messages.meta.nothing_message; JArray overlayTileDepth = gameData.tile_paramaters.overlay_tiles.tile_depth; JArray terrainTilePassibility = gameData.tile_paramaters.terrain_tiles.passibility; diff --git a/Horse Isle Server/Horse Isle Server/Messages.cs b/Horse Isle Server/Horse Isle Server/Messages.cs index 77549f5..0d41826 100644 --- a/Horse Isle Server/Horse Isle Server/Messages.cs +++ b/Horse Isle Server/Horse Isle Server/Messages.cs @@ -9,12 +9,20 @@ namespace Horse_Isle_Server class Messages { public static string NewUserMessage; - public static string AreaMessage; - public static string NothingMessage; public static string LoginFormat; - public static string MotdFormat; + public static string ProfileSavedMessage; + + public static string Sepeerator; + + public static string IsleFormat; + public static string TownFormat; + public static string AreaFormat; + public static string LocationFormat; + + public static string TileFormat; + public static string NothingMessage; public static string GetMOTD() { return MotdFormat.Replace("%MOTD%", ConfigReader.Motd); @@ -26,13 +34,17 @@ namespace Horse_Isle_Server public static string LocationData(int x, int y) { + string locationString = ""; string message = ""; - try - { - World.Isle isle = World.GetIsle(x, y); - message = AreaMessage.Replace("%AREA%", isle.Name); - } - catch (Exception) { } + if(World.InArea(x,y)) + locationString += AreaFormat.Replace("%AREA%", World.GetArea(x, y).Name); + if (World.InTown(x, y)) + locationString += TownFormat.Replace("%TOWN%", World.GetTown(x, y).Name); + if (World.InIsle(x, y)) + locationString += IsleFormat.Replace("%ISLE%", World.GetIsle(x, y).Name); + + if(locationString != "") + message += LocationFormat.Replace("%META%", locationString); int[] itemIds = World.GetDroppedItems(x, y); if (itemIds.Length == 0) diff --git a/Horse Isle Server/Horse Isle Server/PacketBuilder.cs b/Horse Isle Server/Horse Isle Server/PacketBuilder.cs index 6e10f91..91efcad 100644 --- a/Horse Isle Server/Horse Isle Server/PacketBuilder.cs +++ b/Horse Isle Server/Horse Isle Server/PacketBuilder.cs @@ -12,7 +12,7 @@ namespace Horse_Isle_Server public const byte PACKET_TERMINATOR = 0x00; public const byte PACKET_A_TERMINATOR = 0x0A; - + public const byte PACKET_LOGIN = 0x7F; public const byte PACKET_CHAT = 0x14; @@ -24,8 +24,16 @@ namespace Horse_Isle_Server public const byte PACKET_AREA_DEFS = 0x79; public const byte PACKET_ANNOUNCEMENT = 0x7E; public const byte PACKET_TILE_FLAGS = 0x75; + public const byte PACKET_UPDATE = 0x7C; + public const byte PACKET_PROFILE = 0x18; + + public const byte VIEW_PROFILE = 0x14; + public const byte SAVE_PROFILE = 0x15; public const byte AREA_SEPERATOR = 0x5E; + public const byte AREA_TOWN = 0x54; + public const byte AREA_AREA = 0x41; + public const byte AREA_ISLE = 0x49; public const byte MOVE_UP = 0x14; public const byte MOVE_DOWN = 0x15; @@ -65,6 +73,23 @@ namespace Horse_Isle_Server return Packet; } + public static byte[] CreateProfilePacket(string userProfile) + { + MemoryStream ms = new MemoryStream(); + + ms.WriteByte(PACKET_PROFILE); + + byte[] strBytes = Encoding.UTF8.GetBytes(userProfile); + ms.Write(strBytes, 0x00, strBytes.Length); + + ms.WriteByte(PACKET_TERMINATOR); + ms.Seek(0x00, SeekOrigin.Begin); + byte[] Packet = ms.ToArray(); + ms.Dispose(); + + return Packet; + } + public static byte[] CreateMovementPacket(int x, int y,int charId,int facing, int direction, bool walk) { // Header information @@ -96,7 +121,6 @@ namespace Horse_Isle_Server int ystart = y - 4; int xstart = x - 6; - if (direction == DIRECTION_UP) { for (int relx = 0; relx <= 12; relx++) @@ -104,13 +128,19 @@ namespace Horse_Isle_Server int tileId = Map.GetTileId(xstart + relx, ystart, false); int otileId = Map.GetTileId(xstart + relx, ystart, true); - + if (tileId >= 190) + { + ms.WriteByte((byte)190); + tileId -= 100; + } ms.WriteByte((byte)tileId); - if (tileId == 190) - ms.WriteByte((byte)0x5B); + + if (otileId >= 190) + { + ms.WriteByte((byte)190); + otileId -= 100; + } ms.WriteByte((byte)otileId); - if (otileId == 190) - ms.WriteByte((byte)0x5A); } } @@ -122,12 +152,20 @@ namespace Horse_Isle_Server int otileId = Map.GetTileId(xstart, ystart + rely, true); + + if (tileId >= 190) + { + ms.WriteByte((byte)190); + tileId -= 100; + } ms.WriteByte((byte)tileId); - if (tileId == 190) - ms.WriteByte((byte)0x5B); + + if (otileId >= 190) + { + ms.WriteByte((byte)190); + otileId -= 100; + } ms.WriteByte((byte)otileId); - if (otileId == 190) - ms.WriteByte((byte)0x5A); } } @@ -140,12 +178,19 @@ namespace Horse_Isle_Server int otileId = Map.GetTileId(xstart + 12, ystart + rely, true); + if (tileId >= 190) + { + ms.WriteByte((byte)190); + tileId -= 100; + } ms.WriteByte((byte)tileId); - if (tileId == 190) - ms.WriteByte((byte)0x5B); + + if (otileId >= 190) + { + ms.WriteByte((byte)190); + otileId -= 100; + } ms.WriteByte((byte)otileId); - if (otileId == 190) - ms.WriteByte((byte)0x5A); } } @@ -157,12 +202,19 @@ namespace Horse_Isle_Server int otileId = Map.GetTileId(xstart + relx, ystart + 9, true); + if (tileId >= 190) + { + ms.WriteByte((byte)190); + tileId -= 100; + } ms.WriteByte((byte)tileId); - if (tileId == 190) - ms.WriteByte((byte)0x5B); + + if (otileId >= 190) + { + ms.WriteByte((byte)190); + otileId -= 100; + } ms.WriteByte((byte)otileId); - if (otileId == 190) - ms.WriteByte((byte)0x5A); } } if (direction == DIRECTION_LOGIN) @@ -174,14 +226,20 @@ namespace Horse_Isle_Server int tileId = Map.GetTileId(xstart + relx, ystart + rely, false); int otileId = Map.GetTileId(xstart + relx, ystart + rely, true); - + if(tileId >= 190) + { + ms.WriteByte((byte)190); + tileId -= 100; + } ms.WriteByte((byte)tileId); - if (tileId == 190) - ms.WriteByte((byte)0x5B); + if (otileId >= 190) + { + ms.WriteByte((byte)190); + otileId -= 100; + } ms.WriteByte((byte)otileId); - if (otileId == 190) - ms.WriteByte((byte)0x5A); + } } @@ -193,8 +251,7 @@ namespace Horse_Isle_Server byte[] Packet = ms.ToArray(); ms.Dispose(); - Logger.DebugPrint(BitConverter.ToString(Packet).Replace('-', ' ')); - + //Logger.DebugPrint(BitConverter.ToString(Packet).Replace("-", " ")); return Packet; } @@ -262,15 +319,82 @@ namespace Horse_Isle_Server return Packet; } - public static byte[] CreateIsleData(World.Isle[] isles) + public static byte[] CreateUpdate() + { + MemoryStream ms = new MemoryStream(); + + ms.WriteByte(PACKET_UPDATE); + ms.WriteByte(PACKET_TERMINATOR); + + ms.Seek(0x00, SeekOrigin.Begin); + byte[] Packet = ms.ToArray(); + ms.Dispose(); + + return Packet; + } + public static byte[] CreatePlaceData(World.Isle[] isles, World.Town[] towns, World.Area[] areas) { MemoryStream ms = new MemoryStream(); ms.WriteByte(PACKET_AREA_DEFS); - foreach(World.Isle isle in isles) + + // Write Towns + + foreach (World.Town town in towns) + { + byte[] strBytes = Encoding.UTF8.GetBytes(town.Name); + + ms.WriteByte(AREA_SEPERATOR); + ms.WriteByte(AREA_TOWN); + + ms.WriteByte((byte)(((town.StartX - 4) / 64) + 20)); + ms.WriteByte((byte)(((town.StartX - 4) % 64) + 20)); + + ms.WriteByte((byte)(((town.EndX - 4) / 64) + 20)); + ms.WriteByte((byte)(((town.EndX - 4) % 64) + 20)); + + ms.WriteByte((byte)(((town.StartY - 1) / 64) + 20)); + ms.WriteByte((byte)(((town.StartY - 1) % 64) + 20)); + + ms.WriteByte((byte)(((town.EndY - 1) / 64) + 20)); + ms.WriteByte((byte)(((town.EndY - 1) % 64) + 20)); + + + ms.Write(strBytes, 0x00, strBytes.Length); + } + + // Write Areas + + foreach (World.Area area in areas) + { + byte[] strBytes = Encoding.UTF8.GetBytes(area.Name); + + ms.WriteByte(AREA_SEPERATOR); + ms.WriteByte(AREA_AREA); + + ms.WriteByte((byte)(((area.StartX - 4) / 64) + 20)); + ms.WriteByte((byte)(((area.StartX - 4) % 64) + 20)); + + ms.WriteByte((byte)(((area.EndX - 4) / 64) + 20)); + ms.WriteByte((byte)(((area.EndX - 4) % 64) + 20)); + + ms.WriteByte((byte)(((area.StartY - 1) / 64) + 20)); + ms.WriteByte((byte)(((area.StartY - 1) % 64) + 20)); + + ms.WriteByte((byte)(((area.EndY - 1) / 64) + 20)); + ms.WriteByte((byte)(((area.EndY - 1) % 64) + 20)); + + + ms.Write(strBytes, 0x00, strBytes.Length); + } + + // Write Isles + + foreach (World.Isle isle in isles) { byte[] strBytes = Encoding.UTF8.GetBytes(isle.Name); ms.WriteByte(AREA_SEPERATOR); + ms.WriteByte(AREA_ISLE); ms.WriteByte((byte)(((isle.StartX - 4) / 64) + 20)); ms.WriteByte((byte)(((isle.StartX - 4) % 64) + 20)); @@ -394,49 +518,5 @@ namespace Horse_Isle_Server return CreateChat(formattedStr, CHAT_BOTTOM_RIGHT); } - public static byte[] CreateUserInfo(Client client) - { - MemoryStream ms = new MemoryStream(); - if(!client.LoggedIn) - throw new Exception("Client is not logged in."); - User user = client.LoggedinUser; - - byte[] MovementPacket = CreateMovementPacket(user.X, user.Y, user.CharacterId, DIRECTION_DOWN, DIRECTION_LOGIN, true); - ms.Write(MovementPacket, 0x00, MovementPacket.Length); - - byte[] LoginMessage = CreateLoginMessage(user.Username); - ms.Write(LoginMessage, 0x00, LoginMessage.Length); - - World.Time time = World.GetGameTime(); - int timestamp = time.hours * 60; - timestamp += time.minutes; - - byte[] WorldData = CreateWorldData(timestamp, time.days, time.year, World.GetWeather()); - ms.Write(WorldData, 0x00, WorldData.Length); - - byte[] SecCodePacket = CreateSecCode(user.SecCodeSeeds, user.SecCodeInc, user.Administrator, user.Moderator); - ms.Write(SecCodePacket, 0x00, SecCodePacket.Length); - - byte[] BaseStatsPacketData = CreateBaseStats(user.Money, Server.GetNumberOfPlayers(), user.MailBox.MailCount); - ms.Write(BaseStatsPacketData, 0x00, BaseStatsPacketData.Length); - - byte[] AreaMessage = CreateAreaMessage(user.X,user.Y); - ms.Write(AreaMessage, 0x00, AreaMessage.Length); - - byte[] IsleData = CreateIsleData(World.Isles.ToArray()); - ms.Write(IsleData, 0x00, IsleData.Length); - - byte[] TileFlags = CreateTileOverlayFlags(Map.OverlayTileDepth); - ms.Write(TileFlags, 0x00, TileFlags.Length); - - byte[] MotdData = CreateMotd(); - ms.Write(MotdData, 0x00, MotdData.Length); - - ms.Seek(0x00, SeekOrigin.Begin); - byte[] Packet = ms.ToArray(); - ms.Dispose(); - - return Packet; - } } } diff --git a/Horse Isle Server/Horse Isle Server/Program.cs b/Horse Isle Server/Horse Isle Server/Program.cs index 923515f..304e12a 100644 --- a/Horse Isle Server/Horse Isle Server/Program.cs +++ b/Horse Isle Server/Horse Isle Server/Program.cs @@ -10,27 +10,6 @@ namespace Horse_Isle_Server { static void Main(string[] args) { - /* - Bitmap mbmp = new Bitmap("MapData.bmp"); - Bitmap bmp = new Bitmap("oMapData.bmp"); - Console.WriteLine(bmp.PixelFormat); - Bitmap bbmp = new Bitmap(bmp.Width, bmp.Height, PixelFormat.Format24bppRgb); - for(int x = 0; x < bmp.Width; x++) - { - for(int y = 0; y < bmp.Height; y++) - { - Color col = mbmp.GetPixel(x, y); - Color col2 = bmp.GetPixel(x, y); - - bbmp.SetPixel(x,y,Color.FromArgb(col2.B, 0, col.B)); - - } - } - bbmp.Save("MapData2.bmp", ImageFormat.Bmp); - Console.WriteLine("image checked"); - */ - - Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)); ConfigReader.OpenConfig(); diff --git a/Horse Isle Server/Horse Isle Server/Server.cs b/Horse Isle Server/Horse Isle Server/Server.cs index 154474c..3be42ab 100644 --- a/Horse Isle Server/Horse Isle Server/Server.cs +++ b/Horse Isle Server/Horse Isle Server/Server.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Net; using System.Net.Sockets; @@ -30,9 +31,112 @@ namespace Horse_Isle_Server Logger.ErrorPrint(sender.RemoteIp + " Requested user information when not logged in."); return; } - Logger.DebugPrint(sender.LoggedinUser.Username + " Requesting user information."); - byte[] userInfoPackets = PacketBuilder.CreateUserInfo(sender); - sender.SendPacket(userInfoPackets); + Logger.DebugPrint(sender.LoggedinUser.Username + " Requested user information."); + MemoryStream ms = new MemoryStream(); + User user = sender.LoggedinUser; + + byte[] MovementPacket = PacketBuilder.CreateMovementPacket(user.X, user.Y, user.CharacterId, PacketBuilder.DIRECTION_DOWN, PacketBuilder.DIRECTION_LOGIN, true); + ms.Write(MovementPacket, 0x00, MovementPacket.Length); + + byte[] LoginMessage = PacketBuilder.CreateLoginMessage(user.Username); + ms.Write(LoginMessage, 0x00, LoginMessage.Length); + + World.Time time = World.GetGameTime(); + int timestamp = time.hours * 60; + timestamp += time.minutes; + + byte[] WorldData = PacketBuilder.CreateWorldData(timestamp, time.days, time.year, World.GetWeather()); + ms.Write(WorldData, 0x00, WorldData.Length); + + byte[] SecCodePacket = PacketBuilder.CreateSecCode(user.SecCodeSeeds, user.SecCodeInc, user.Administrator, user.Moderator); + ms.Write(SecCodePacket, 0x00, SecCodePacket.Length); + + byte[] BaseStatsPacketData = PacketBuilder.CreateBaseStats(user.Money, Server.GetNumberOfPlayers(), user.MailBox.MailCount); + ms.Write(BaseStatsPacketData, 0x00, BaseStatsPacketData.Length); + + byte[] AreaMessage = PacketBuilder.CreateAreaMessage(user.X, user.Y); + ms.Write(AreaMessage, 0x00, AreaMessage.Length); + + byte[] IsleData = PacketBuilder.CreatePlaceData(World.Isles.ToArray(), World.Towns.ToArray(), World.Areas.ToArray()); + ms.Write(IsleData, 0x00, IsleData.Length); + + byte[] TileFlags = PacketBuilder.CreateTileOverlayFlags(Map.OverlayTileDepth); + ms.Write(TileFlags, 0x00, TileFlags.Length); + + byte[] MotdData = PacketBuilder.CreateMotd(); + ms.Write(MotdData, 0x00, MotdData.Length); + + ms.Seek(0x00, SeekOrigin.Begin); + byte[] Packet = ms.ToArray(); + ms.Dispose(); + + sender.SendPacket(Packet); + } + public static void OnUpdatePacket(Client sender, byte[] packet) + { + if (!sender.LoggedIn) + { + Logger.ErrorPrint(sender.RemoteIp + " Requested user information when not logged in."); + return; + } + if (packet.Length < 2) + { + Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid Update Packet"); + return; + } + + if(packet[1] == PacketBuilder.PACKET_A_TERMINATOR) + { + Logger.DebugPrint(sender.LoggedinUser.Username + " Requested latest statistics (Money/Playercount/Mail)"); + byte[] packetResponse = PacketBuilder.CreateBaseStats(sender.LoggedinUser.Money, GetNumberOfPlayers(), sender.LoggedinUser.MailBox.MailCount); + sender.SendPacket(packetResponse); + } + } + public static void OnProfilePacket(Client sender, byte[] packet) + { + if (!sender.LoggedIn) + { + Logger.ErrorPrint(sender.RemoteIp + " Requested to change profile page when not logged in."); + return; + } + if(packet.Length < 2) + { + Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid Profile Packet"); + return; + } + + byte method = packet[1]; + if(method == PacketBuilder.VIEW_PROFILE) + { + byte[] profilePacket = PacketBuilder.CreateProfilePacket(sender.LoggedinUser.ProfilePage); + sender.SendPacket(profilePacket); + } + else if(method == PacketBuilder.SAVE_PROFILE) + { + + string packetStr = Encoding.UTF8.GetString(packet); + if (packet.Length < 3 || !packetStr.Contains('|')) + { + Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid Profile SAVE Packet"); + return; + } + + int characterId = (packet[2] - 20) * 64 + (packet[3] - 20); + + string profilePage = packetStr.Split('|')[1]; + profilePage = profilePage.Substring(0, profilePage.Length - 2); + + sender.LoggedinUser.CharacterId = characterId; + sender.LoggedinUser.ProfilePage = profilePage; + + Logger.DebugPrint(sender.LoggedinUser.Username + " Changed to character id: " + characterId + " and set there Profile Description to '" + profilePage + "'"); + + byte[] chatPacket = PacketBuilder.CreateChat(Messages.ProfileSavedMessage, PacketBuilder.CHAT_BOTTOM_RIGHT); + sender.SendPacket(chatPacket); + + UpdateArea(sender); + } + } public static void OnMovementPacket(Client sender, byte[] packet) @@ -104,10 +208,10 @@ namespace Horse_Isle_Server } + UpdateArea(sender); - byte[] tileData = PacketBuilder.CreateAreaMessage(loggedInUser.X, loggedInUser.Y); - sender.SendPacket(tileData); } + public static void OnLoginRequest(Client sender, byte[] packet) { Logger.DebugPrint("Login request received from: " + sender.RemoteIp); @@ -154,6 +258,14 @@ namespace Horse_Isle_Server } + public static void UpdateArea(Client forClient) + { + + byte[] areaData = PacketBuilder.CreateAreaMessage(forClient.LoggedinUser.X, forClient.LoggedinUser.Y); + forClient.SendPacket(areaData); + + } + public static int GetNumberOfPlayers() { int count = 0; diff --git a/Horse Isle Server/Horse Isle Server/World.cs b/Horse Isle Server/Horse Isle Server/World.cs index 8f57039..2612d63 100644 --- a/Horse Isle Server/Horse Isle Server/World.cs +++ b/Horse Isle Server/Horse Isle Server/World.cs @@ -18,7 +18,24 @@ namespace Horse_Isle_Server public int Tileset; public string Name; } - + public struct Town + { + public int StartX; + public int EndX; + public int StartY; + public int EndY; + public string Name; + } + public struct Area + { + public int StartX; + public int EndX; + public int StartY; + public int EndY; + public string Name; + } + + public struct Time { public int minutes; @@ -29,6 +46,8 @@ namespace Horse_Isle_Server public const int MINUTE = 4320; public static List Isles = new List(); + public static List Towns = new List(); + public static List Areas = new List(); public static Time GetGameTime() { int epoch = Database.GetServerCreationTime(); @@ -54,7 +73,45 @@ namespace Horse_Isle_Server return time; } + public static bool InArea(int x, int y) + { + try + { + GetArea(x, y); + return true; + } + catch (KeyNotFoundException) + { + return false; + } + } + public static bool InTown(int x, int y) + { + try + { + GetTown(x, y); + return true; + } + catch (KeyNotFoundException) + { + return false; + } + } + + + public static bool InIsle(int x, int y) + { + try + { + GetIsle(x, y); + return true; + } + catch(KeyNotFoundException) + { + return false; + } + } public static Isle GetIsle(int x, int y) { foreach(Isle isle in Isles) @@ -67,6 +124,33 @@ namespace Horse_Isle_Server } throw new KeyNotFoundException("x,y not in an isle!"); } + + public static Area GetArea(int x, int y) + { + foreach (Area area in Areas) + { + + if (area.StartX <= x && area.EndX >= x && area.StartY <= y && area.EndY >= y) + { + return area; + } + } + throw new KeyNotFoundException("x,y not in an area!"); + } + + public static Town GetTown(int x, int y) + { + foreach (Town town in Towns) + { + + if (town.StartX <= x && town.EndX >= x && town.StartY <= y && town.EndY >= y) + { + return town; + } + } + throw new KeyNotFoundException("x,y not in a town!"); + } + public static int[] GetDroppedItems(int x, int y) { return new int[] { }; // Not implemented yet.