Server Help

Bot Questions - Banner Data Format??

Anonymous - Thu Aug 12, 2004 4:00 am
Post subject: Banner Data Format??
Ive been playing with this for an hour or so and I cant figure it out.

When the server sends a player banner (packet 0x1F), it gives you 96 bytes of data. It seems to be the bitmap data (and upside down).

What I dont understand, is where youre expected to get the pallet from. I tried reconstructing the bitmap using a number of common 256 color pallets (including the one Continuum uses in its banner editor), and none of them come out exactly right. (Although, the continuum pallet was the closest).

Can someone fill me in on the part I missed? Also, if anyone has a quick method of flipping the image, include that too... Im about to go to bed and I'm feeling especially lazy =)

-C
CypherJF - Thu Aug 12, 2004 4:38 am
Post subject:
Yes, this is correct it is the 96 BYTEs that give you the pixel data. BMP's are stored backwards (right?); what ou need to do is take groups of 12 BYTES, and reconstruct it going backwards.

This is what is sent:
ABCDEFGHIJKL123456789012

This is how it's rebuilt:
123456789012ABCDEFGHIJKL


Thats if I'm thinking right off the top of my head..
Anonymous - Thu Aug 12, 2004 5:36 am
Post subject:
Figured out my problem... was botching the data as I was writing it to the file(s)...my bad =(

Thanks anyway.
Cyan~Fire - Thu Aug 12, 2004 8:10 pm
Post subject:
Win32 API automatically flips the bitmap.
CypherJF - Thu Aug 12, 2004 8:42 pm
Post subject:
HM well I did it manually w/ PHP; since PHP doesn't support BMP's in it's graphics library.
Mine GO BOOM - Thu Aug 12, 2004 11:02 pm
Post subject:
Cyan~Fire wrote:
Win32 API automatically flips the bitmap.

Its not flipped, its stored bottom-up. This seems weird to some people, because English is a left-to-right, top-to-bottom language. I remember reading an article a while ago as to why they originally choose this way, and it made sense at the time (just like the chopped '84 dates in timestamps a long time ago).
Mr Ekted - Thu Aug 12, 2004 11:43 pm
Post subject:
Doesn't have to be stored bottom up.
2dragons - Fri Aug 13, 2004 1:34 am
Post subject:
The 96 bytes you received are not in the typical BMP format. You are getting them top to bottom. Here's the colortable you wanted (PHP switch):

Code: Show/Hide
         case "00": return ImageColorAllocate( $im, 0, 0, 0 );
         case "01": return ImageColorAllocate( $im, 57, 57, 57 );
         case "02": return ImageColorAllocate( $im, 66, 66, 66 );
         case "03": return ImageColorAllocate( $im, 82, 82, 82 );
         case "04": return ImageColorAllocate( $im, 90, 90, 90 );
         case "05": return ImageColorAllocate( $im, 115, 115, 115 );
         case "06": return ImageColorAllocate( $im, 123, 123, 123 );
         case "07": return ImageColorAllocate( $im, 132, 132, 132 );
         case "08": return ImageColorAllocate( $im, 140, 140, 140 );
         case "09": return ImageColorAllocate( $im, 148, 148, 148 );
         case "0a": return ImageColorAllocate( $im, 156, 156, 156 );
         case "0b": return ImageColorAllocate( $im, 165, 165, 165 );
         case "0c": return ImageColorAllocate( $im, 173, 173, 173 );
         case "0d": return ImageColorAllocate( $im, 198, 198, 198 );
         case "0e": return ImageColorAllocate( $im, 206, 206, 206 );
         case "0f": return ImageColorAllocate( $im, 189, 181, 181 );
         case "10": return ImageColorAllocate( $im, 181, 173, 173 );
         case "11": return ImageColorAllocate( $im, 156, 148, 148 );
         case "12": return ImageColorAllocate( $im, 123, 115, 115 );
         case "13": return ImageColorAllocate( $im, 107, 99, 99 );
         case "14": return ImageColorAllocate( $im, 255, 222, 222 );
         case "15": return ImageColorAllocate( $im, 239, 198, 198 );
         case "16": return ImageColorAllocate( $im, 140, 115, 115 );
         case "17": return ImageColorAllocate( $im, 255, 206, 206 );
         case "18": return ImageColorAllocate( $im, 239, 181, 181 );
         case "19": return ImageColorAllocate( $im, 99, 74, 74 );
         case "1a": return ImageColorAllocate( $im, 181, 132, 132 );
         case "1b": return ImageColorAllocate( $im, 255, 181, 181 );
         case "1c": return ImageColorAllocate( $im, 231, 132, 132 );
         case "1d": return ImageColorAllocate( $im, 123, 66, 66 );
         case "1e": return ImageColorAllocate( $im, 33, 16, 16 );
         case "1f": return ImageColorAllocate( $im, 255, 123, 123 );
         case "20": return ImageColorAllocate( $im, 132, 41, 41 );
         case "21": return ImageColorAllocate( $im, 82, 24, 24 );
         case "22": return ImageColorAllocate( $im, 206, 8, 8 );
         case "23": return ImageColorAllocate( $im, 206, 41, 33 );
         case "24": return ImageColorAllocate( $im, 247, 99, 82 );
         case "25": return ImageColorAllocate( $im, 206, 90, 74 );
         case "26": return ImageColorAllocate( $im, 148, 99, 90 );
         case "27": return ImageColorAllocate( $im, 165, 66, 49 );
         case "28": return ImageColorAllocate( $im, 222, 49, 8 );
         case "29": return ImageColorAllocate( $im, 255, 57, 8 );
         case "2a": return ImageColorAllocate( $im, 115, 24, 0 );
         case "2b": return ImageColorAllocate( $im, 77, 45, 4 );
         case "2c": return ImageColorAllocate( $im, 165, 41, 0 );
         case "2d": return ImageColorAllocate( $im, 123, 99, 90 );
         case "2e": return ImageColorAllocate( $im, 255, 132, 82 );
         case "2f": return ImageColorAllocate( $im, 206, 99, 57 );
         case "30": return ImageColorAllocate( $im, 189, 66, 8 );
         case "31": return ImageColorAllocate( $im, 99, 33, 0 );
         case "32": return ImageColorAllocate( $im, 255, 181, 132 );
         case "33": return ImageColorAllocate( $im, 239, 107, 24 );
         case "34": return ImageColorAllocate( $im, 115, 57, 16 );
         case "35": return ImageColorAllocate( $im, 222, 132, 57 );
         case "36": return ImageColorAllocate( $im, 99, 90, 82 );
         case "37": return ImageColorAllocate( $im, 148, 140, 132 );
         case "38": return ImageColorAllocate( $im, 206, 140, 74 );
         case "39": return ImageColorAllocate( $im, 132, 90, 41 );
         case "3a": return ImageColorAllocate( $im, 255, 165, 66 );
         case "3b": return ImageColorAllocate( $im, 247, 140, 24 );
         case "3c": return ImageColorAllocate( $im, 255, 214, 165 );
         case "3d": return ImageColorAllocate( $im, 173, 140, 99 );
         case "3e": return ImageColorAllocate( $im, 132, 82, 8 );
         case "3f": return ImageColorAllocate( $im, 173, 115, 16 );
         case "40": return ImageColorAllocate( $im, 165, 107, 8 );
         case "41": return ImageColorAllocate( $im, 255, 231, 189 );
         case "42": return ImageColorAllocate( $im, 181, 123, 16 );
         case "43": return ImageColorAllocate( $im, 148, 99, 8 );
         case "44": return ImageColorAllocate( $im, 247, 222, 173 );
         case "45": return ImageColorAllocate( $im, 156, 140, 107 );
         case "46": return ImageColorAllocate( $im, 214, 181, 115 );
         case "47": return ImageColorAllocate( $im, 165, 132, 66 );
         case "48": return ImageColorAllocate( $im, 247, 181, 41 );
         case "49": return ImageColorAllocate( $im, 239, 173, 33 );
         case "4a": return ImageColorAllocate( $im, 115, 107, 90 );
         case "4b": return ImageColorAllocate( $im, 74, 66, 49 );
         case "4c": return ImageColorAllocate( $im, 239, 206, 132 );
         case "4d": return ImageColorAllocate( $im, 255, 206, 99 );
         case "4e": return ImageColorAllocate( $im, 222, 173, 66 );
         case "4f": return ImageColorAllocate( $im, 255, 189, 41 );
         case "50": return ImageColorAllocate( $im, 181, 148, 66 );
         case "51": return ImageColorAllocate( $im, 239, 189, 66 );
         case "52": return ImageColorAllocate( $im, 255, 198, 49 );
         case "53": return ImageColorAllocate( $im, 90, 66, 8 );
         case "54": return ImageColorAllocate( $im, 206, 148, 8 );
         case "55": return ImageColorAllocate( $im, 255, 222, 132 );
         case "56": return ImageColorAllocate( $im, 231, 181, 33 );
         case "57": return ImageColorAllocate( $im, 255, 247, 222 );
         case "58": return ImageColorAllocate( $im, 239, 231, 206 );
         case "59": return ImageColorAllocate( $im, 181, 173, 148 );
         case "5a": return ImageColorAllocate( $im, 181, 165, 115 );
         case "5b": return ImageColorAllocate( $im, 255, 231, 156 );
         case "5c": return ImageColorAllocate( $im, 255, 214, 90 );
         case "5d": return ImageColorAllocate( $im, 165, 156, 123 );
         case "5e": return ImageColorAllocate( $im, 132, 123, 90 );
         case "5f": return ImageColorAllocate( $im, 255, 247, 214 );
         case "60": return ImageColorAllocate( $im, 255, 239, 173 );
         case "61": return ImageColorAllocate( $im, 156, 132, 24 );
         case "62": return ImageColorAllocate( $im, 231, 198, 41 );
         case "63": return ImageColorAllocate( $im, 173, 156, 33 );
         case "64": return ImageColorAllocate( $im, 255, 231, 33 );
         case "65": return ImageColorAllocate( $im, 173, 173, 165 );
         case "66": return ImageColorAllocate( $im, 156, 156, 140 );
         case "67": return ImageColorAllocate( $im, 74, 74, 66 );
         case "68": return ImageColorAllocate( $im, 173, 173, 148 );
         case "69": return ImageColorAllocate( $im, 49, 49, 41 );
         case "6a": return ImageColorAllocate( $im, 165, 165, 132 );
         case "6b": return ImageColorAllocate( $im, 90, 90, 24 );
         case "6c": return ImageColorAllocate( $im, 206, 206, 49 );
         case "6d": return ImageColorAllocate( $im, 255, 255, 57 );
         case "6e": return ImageColorAllocate( $im, 123, 132, 33 );
         case "6f": return ImageColorAllocate( $im, 214, 231, 57 );
         case "70": return ImageColorAllocate( $im, 165, 181, 49 );
         case "71": return ImageColorAllocate( $im, 173, 198, 57 );
         case "72": return ImageColorAllocate( $im, 115, 132, 57 );
         case "73": return ImageColorAllocate( $im, 148, 181, 66 );
         case "74": return ImageColorAllocate( $im, 181, 206, 123 );
         case "75": return ImageColorAllocate( $im, 115, 148, 49 );
         case "76": return ImageColorAllocate( $im, 82, 107, 41 );
         case "77": return ImageColorAllocate( $im, 189, 247, 99 );
         case "78": return ImageColorAllocate( $im, 123, 165, 66 );
         case "79": return ImageColorAllocate( $im, 165, 222, 82 );
         case "7a": return ImageColorAllocate( $im, 123, 181, 66 );
         case "7b": return ImageColorAllocate( $im, 231, 247, 222 );
         case "7c": return ImageColorAllocate( $im, 123, 140, 115 );
         case "7d": return ImageColorAllocate( $im, 165, 189, 156 );
         case "7e": return ImageColorAllocate( $im, 156, 247, 123 );
         case "7f": return ImageColorAllocate( $im, 198, 231, 189 );
         case "80": return ImageColorAllocate( $im, 123, 181, 107 );
         case "81": return ImageColorAllocate( $im, 82, 148, 66 );
         case "82": return ImageColorAllocate( $im, 57, 132, 41 );
         case "83": return ImageColorAllocate( $im, 24, 57, 16 );
         case "84": return ImageColorAllocate( $im, 107, 222, 90 );
         case "85": return ImageColorAllocate( $im, 41, 90, 33 );
         case "86": return ImageColorAllocate( $im, 115, 255, 99 );
         case "87": return ImageColorAllocate( $im, 90, 206, 74 );
         case "88": return ImageColorAllocate( $im, 66, 148, 57 );
         case "89": return ImageColorAllocate( $im, 107, 206, 99 );
         case "8a": return ImageColorAllocate( $im, 74, 173, 66 );
         case "8b": return ImageColorAllocate( $im, 173, 181, 173 );
         case "8c": return ImageColorAllocate( $im, 181, 206, 181 );
         case "8d": return ImageColorAllocate( $im, 57, 66, 57 );
         case "8e": return ImageColorAllocate( $im, 33, 49, 33 );
         case "8f": return ImageColorAllocate( $im, 165, 247, 165 );
         case "90": return ImageColorAllocate( $im, 57, 115, 57 );
         case "91": return ImageColorAllocate( $im, 33, 82, 33 );
         case "92": return ImageColorAllocate( $im, 41, 107, 41 );
         case "93": return ImageColorAllocate( $im, 57, 148, 57 );
         case "94": return ImageColorAllocate( $im, 24, 82, 24 );
         case "95": return ImageColorAllocate( $im, 8, 74, 49 );
         case "96": return ImageColorAllocate( $im, 16, 66, 57 );
         case "97": return ImageColorAllocate( $im, 49, 57, 82 );
         case "98": return ImageColorAllocate( $im, 49, 57, 140 );
         case "99": return ImageColorAllocate( $im, 107, 115, 206 );
         case "9a": return ImageColorAllocate( $im, 74, 82, 181 );
         case "9b": return ImageColorAllocate( $im, 239, 239, 255 );
         case "9c": return ImageColorAllocate( $im, 231, 231, 255 );
         case "9d": return ImageColorAllocate( $im, 189, 189, 214 );
         case "9e": return ImageColorAllocate( $im, 107, 107, 123 );
         case "9f": return ImageColorAllocate( $im, 206, 206, 247 );
         case "a0": return ImageColorAllocate( $im, 198, 198, 247 );
         case "a1": return ImageColorAllocate( $im, 66, 66, 90 );
         case "a2": return ImageColorAllocate( $im, 165, 165, 231 );
         case "a3": return ImageColorAllocate( $im, 181, 181, 255 );
         case "a4": return ImageColorAllocate( $im, 74, 74, 107 );
         case "a5": return ImageColorAllocate( $im, 148, 148, 214 );
         case "a6": return ImageColorAllocate( $im, 156, 156, 231 );
         case "a7": return ImageColorAllocate( $im, 115, 115, 173 );
         case "a8": return ImageColorAllocate( $im, 107, 107, 165 );
         case "a9": return ImageColorAllocate( $im, 165, 165, 255 );
         case "aa": return ImageColorAllocate( $im, 132, 132, 206 );
         case "ab": return ImageColorAllocate( $im, 99, 99, 156 );
         case "ac": return ImageColorAllocate( $im, 115, 115, 181 );
         case "ad": return ImageColorAllocate( $im, 82, 82, 132 );
         case "ae": return ImageColorAllocate( $im, 123, 123, 198 );
         case "af": return ImageColorAllocate( $im, 66, 66, 107 );
         case "b0": return ImageColorAllocate( $im, 90, 90, 148 );
         case "b1": return ImageColorAllocate( $im, 74, 74, 123 );
         case "b2": return ImageColorAllocate( $im, 99, 99, 165 );
         case "b3": return ImageColorAllocate( $im, 57, 57, 99 );
         case "b4": return ImageColorAllocate( $im, 41, 41, 74 );
         case "b5": return ImageColorAllocate( $im, 66, 66, 123 );
         case "b6": return ImageColorAllocate( $im, 49, 49, 99 );
         case "b7": return ImageColorAllocate( $im, 57, 57, 115 );
         case "b8": return ImageColorAllocate( $im, 99, 99, 206 );
         case "b9": return ImageColorAllocate( $im, 99, 99, 255 );
         case "ba": return ImageColorAllocate( $im, 82, 82, 214 );
         case "bb": return ImageColorAllocate( $im, 66, 66, 189 );
         case "bc": return ImageColorAllocate( $im, 33, 33, 99 );
         case "bd": return ImageColorAllocate( $im, 82, 82, 255 );
         case "be": return ImageColorAllocate( $im, 57, 57, 181 );
         case "bf": return ImageColorAllocate( $im, 66, 66, 222 );
         case "c0": return ImageColorAllocate( $im, 33, 33, 115 );
         case "c1": return ImageColorAllocate( $im, 49, 41, 123 );
         case "c2": return ImageColorAllocate( $im, 99, 90, 148 );
         case "c3": return ImageColorAllocate( $im, 140, 132, 173 );
         case "c4": return ImageColorAllocate( $im, 99, 90, 140 );
         case "c5": return ImageColorAllocate( $im, 74, 41, 165 );
         case "c6": return ImageColorAllocate( $im, 66, 16, 198 );
         case "c7": return ImageColorAllocate( $im, 41, 0, 148 );
         case "c8": return ImageColorAllocate( $im, 74, 41, 148 );
         case "c9": return ImageColorAllocate( $im, 181, 156, 231 );
         case "ca": return ImageColorAllocate( $im, 33, 24, 49 );
         case "cb": return ImageColorAllocate( $im, 99, 66, 156 );
         case "cc": return ImageColorAllocate( $im, 63, 45, 14 );
         case "cd": return ImageColorAllocate( $im, 33, 0, 82 );
         case "ce": return ImageColorAllocate( $im, 49, 0, 123 );
         case "cf": return ImageColorAllocate( $im, 132, 99, 173 );
         case "d0": return ImageColorAllocate( $im, 132, 66, 214 );
         case "d1": return ImageColorAllocate( $im, 99, 33, 181 );
         case "d2": return ImageColorAllocate( $im, 57, 0, 132 );
         case "d3": return ImageColorAllocate( $im, 181, 132, 239 );
         case "d4": return ImageColorAllocate( $im, 173, 107, 247 );
         case "d5": return ImageColorAllocate( $im, 115, 66, 173 );
         case "d6": return ImageColorAllocate( $im, 132, 74, 198 );
         case "d7": return ImageColorAllocate( $im, 82, 41, 123 );
         case "d8": return ImageColorAllocate( $im, 74, 33, 115 );
         case "d9": return ImageColorAllocate( $im, 49, 0, 99 );
         case "da": return ImageColorAllocate( $im, 74, 0, 148 );
         case "db": return ImageColorAllocate( $im, 82, 0, 165 );
         case "dc": return ImageColorAllocate( $im, 74, 57, 90 );
         case "dd": return ImageColorAllocate( $im, 99, 74, 123 );
         case "de": return ImageColorAllocate( $im, 206, 148, 255 );
         case "df": return ImageColorAllocate( $im, 156, 107, 198 );
         case "e0": return ImageColorAllocate( $im, 123, 66, 173 );
         case "e1": return ImageColorAllocate( $im, 156, 82, 222 );
         case "e2": return ImageColorAllocate( $im, 74, 8, 132 );
         case "e3": return ImageColorAllocate( $im, 33, 0, 57 );
         case "e4": return ImageColorAllocate( $im, 173, 99, 198 );
         case "e5": return ImageColorAllocate( $im, 74, 0, 99 );
         case "e6": return ImageColorAllocate( $im, 156, 99, 165 );
         case "e7": return ImageColorAllocate( $im, 99, 0, 115 );
         case "e8": return ImageColorAllocate( $im, 123, 115, 123 );
         case "e9": return ImageColorAllocate( $im, 10, 25, 10 );
         case "ea": return ImageColorAllocate( $im, 74, 0, 74 );
         case "eb": return ImageColorAllocate( $im, 82, 0, 82 );
         case "ec": return ImageColorAllocate( $im, 123, 0, 115 );
         case "ed": return ImageColorAllocate( $im, 123, 74, 115 );
         case "ee": return ImageColorAllocate( $im, 74, 49, 66 );
         case "ef": return ImageColorAllocate( $im, 99, 41, 66 );
         case "f0": return ImageColorAllocate( $im, 132, 107, 115 );
         case "f1": return ImageColorAllocate( $im, 148, 115, 123 );
         case "f2": return ImageColorAllocate( $im, 255, 115, 148 );
         case "f3": return ImageColorAllocate( $im, 99, 57, 66 );
         case "f4": return ImageColorAllocate( $im, 148, 107, 115 );
         case "f5": return ImageColorAllocate( $im, 156, 57, 74 );
         case "f6": return ImageColorAllocate( $im, 255, 140, 156 );
         case "f7": return ImageColorAllocate( $im, 189, 107, 115 );
         case "f8": return ImageColorAllocate( $im, 239, 99, 115 );
         case "f9": return ImageColorAllocate( $im, 206, 41, 57 );
         case "fa": return ImageColorAllocate( $im, 255, 57, 74 );
         case "fb": return ImageColorAllocate( $im, 123, 24, 33 );
         case "fc": return ImageColorAllocate( $im, 247, 115, 123 );
         case "fd": return ImageColorAllocate( $im, 214, 57, 66 );
         case "fe": return ImageColorAllocate( $im, 165, 33, 41 );
         case "ff": return ImageColorAllocate( $im, 255, 255, 255 );

CypherJF - Fri Aug 13, 2004 1:37 am
Post subject:
O.O

I didn't do any of that icon_wink.gif I just merely copied and pasted the last 96 bytes onto a pre-made BMP banner minus it's last 96; and badda bing icon_wink.gif

Oh, but I guess having that PHP switch would help towards creating the PNG format, etc... icon_smile.gif
2dragons - Fri Aug 13, 2004 1:44 am
Post subject:
Aye, I've created a nice 'Banner Emporium'.

It saves (unique) banners it sees, records who it tooks them from, who it has seen wear it to a DB. Then a crontask creates pngs in PHP from the data, then i use convert in linux to get them into BMP format and badda bing!

The site should be ready soon enough...
ExplodyThingy - Fri Aug 13, 2004 2:22 pm
Post subject:
Youre freaky nerdy, yo know that? I hope you didnt type all that out by hand.
Solo Ace - Fri Aug 13, 2004 3:21 pm
Post subject:
Haha Explody calling someone else "nerdy", good one. sa_tongue.gif
2dragons - Fri Aug 13, 2004 11:14 pm
Post subject:
Lol, no way I typed that out by hand. I had written a Bitmap class for java to interpret bitmap files. All I did was have it write the color table to a file when I read in a SS graphic!
Cyan~Fire - Sat Aug 14, 2004 10:25 am
Post subject:
MGB wrote:
Its not flipped, its stored bottom-up.

Bottom-up = flipped?
2dragons - Sat Aug 14, 2004 12:57 pm
Post subject:
I suppose it depends on your definition of flipped, flipped horizontally

instead of

012
345
678

it would be

678
345
012
Mr Ekted - Sat Aug 14, 2004 1:46 pm
Post subject:
My god stop all being newbs. The file format for a BMP is a known thing and is well documented.
Cyan~Fire - Sat Aug 14, 2004 5:10 pm
Post subject:
Newbs...? I know the format, I was just saying that you don't have to worry about flipping/un-upsidedown-ing it yourself.
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group