• Welcome to Valhalla Legends Archive.
 
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - SecretShop

#2
Thanks, yea after posting this I continued to research and found that the version is stored in the exe's resource data which can be accessed by a few simple windows API calls.  I am, however, seeking a cross platform method so I have begun to write a java class to extract the resource data from an EXE file.
#3
I was wondering whats the most common way to aquire the "Version Byte" and "Exe Version" variables?  I assume they are stored in the data section of one of the hash files, however a prelimiary search for the Exe Version turned up nothing.  I suppose I can resort to debugging the actual client in action and seeing how it creates them however I was hoping someone here would know.
#4
Anyone know what characters are or are not allowed in Battle.net usernames?
#5
Web Development / Select statement optimization
April 01, 2006, 02:58 PM
This is not necessarily web development based but I figure this forum is the most applicable.  Im running MySQL 5.0 currently as a backend database on my battle.net community management software.  Im trying to optimize my queries for when a user joins and leaves as these are being called, in peak hours atleast, very often.  Heres what I have currently and im wondering if using MySQL's UNION command is the most efficient way to run this kind of query:

select flags, flags_mask, commands, commands_mask from users where username='blah'
     union select flags, flags_mask, commands, commands_mask from clients where client='WAR3'
     union select flags, flags_mask, commands, commands_mask from wildcards where 'blah' like pattern
     union select flags, flags_mask, commands, commands_mask from groups where groupname in
     (select groupname from users_groups where username='blah');


The username of the user in this example is "blah" and the client the user is using is warcraft III.

my desired result is a table of columns flags, flags_mask, commands, commands_mask that has a variable ammount of rows depending on how these queries match.  In my code I am just using the binary OR operatior to mix these togather into a single result.
#6
C/C++ Programming / Wildcard matching function
April 01, 2006, 02:46 PM
I just had to write this for one of my projects, matches a pattern where * matches 0 to many characters and ? matches exactly 1.


//Matches string against a pattern and returns
//true if the string matches. Returns false if
//the length of the pattern is > 1024.

bool AccessDatabase::wcMatch(const char *pattern, const char *string) {
char *p;
char *pString;
char buffer[1024];
memset(buffer, 0, 1024);

if (!strcmp(pattern, "*"))
return true;

if (strlen(pattern) > 1024)
return false;

//filter out repeat '*' from the pattern
p = buffer + 1;
buffer[0] = *pattern;
for (char *pTmp = (char *)(pattern + 1); *pTmp; ++pTmp) {
if (!(*pTmp == '*' && *(pTmp - 1) == '*'))
(*p++) = *pTmp;
}

p = buffer;
pString = (char *)string;
for (p = buffer; *p; ++p) {
if (*p == '?') {
if (!*pString) return false;
++pString;
}else if (*p == '*') {
char next = *(p + 1);
if (!next) {
return true;
}else if (next == '?') {
next = *(p + 2);
if (!next) return false;
}

while (*pString != next && *pString)
++pString;

if (!pString)
return false;
}else if (*p == *pString) {
++pString;
}else {
return false;
}
}

return true;
}


The whole 1024 thing is because I can safely assume that length due to the source of my patterns for this function.  If you wish to use this elsewhere id probably recommend allocating a properly sized buffer based on strlen() of the pattern.

Tell me if you see any bugs ;)
#7
Web Development / Re: [PHP] Question
March 30, 2006, 07:33 PM
Quote from: J on March 30, 2006, 09:58 AM
I bet the filter has something to do with checking the magic bytes in the torrent file, and thats what causes the file to not download even if it's no longer a .torrent. Try changing the magic bytes and writing a small processing program to change it back to normal on the other end, asuming this isn't working out.

The reason to use compression over some other kind of change to the file would be that its not uncommon for browsers to understand gzip streams.  You could also use https protocol so the filter cannot read whats in the data you are sending, either way would work.
#8
Well going by what UL said above, I seperated up the packet linked as follows:

f7 04 8a 00 73 00 0c

00 ff 02 01 00 00 04 01 64
01 64 02 00 00 01 04 01 64
00 ff 00 00 00 02 04 00 64
00 ff 01 00 00 03 04 00 64
00 ff 01 00 00 04 04 00 64
00 ff 01 00 00 05 04 00 64
00 ff 02 01 01 06 08 01 64
00 ff 01 00 01 07 08 00 64
00 ff 01 00 01 08 08 00 64
00 ff 01 00 01 09 08 00 64
00 ff 01 00 01 0a 08 00 64
00 ff 01 00 01 0b 08 00 64

37 f3 a5 00 03 0c 02 02 00
76 0f 45 a9 12 07 00 00 00
00 00 00 00 00


Its important to note that the player id field there is not a unique identifier which is the logical assumption, atleast in my mind.  I also do not understand the Map download percent beign 0x64 or 0xFF.  Does 0xFF denote that a download did not take place and 0x64(100 in decimal) represent that the user downloaded the map and the download was completed?
#9
Web Development / Re: [PHP] Question
March 29, 2006, 11:34 PM
id recommend, downloading, compressing, and printing all in one swoop instead of trying to save the file.  I beleve gzip format can compress a stream.
#10
Consider the following:
1) A snake has a set length that increases over time
2) Each part of the snake exists until the tail surpasses it
3) The only part that moves are the head and the tail

Just after a first look, it seems like you could use a Queue that stores points on a matrix.  When the length of the Queue reaches the size of the snake just remove the tail item and push the new point of the head onto the Queue.  If you're following the motif of the cellphone game, probably just create a matrix to store the game board, possibly of integers.  0 for empty, 1 for head, 2 for body, 3 for tail.  Seems pretty simple with this design, tell me what you think.

Edit: Also I would use the directional keys only to dictate what vector the snake should move in and have it move automaticly on a timer.
#11
In response to the poster above, the second packet is probably a user join event as the (im guessing here) packet ID matches that of the fourth packet.
#12
Im plan to follow this topic, however I suggest you should have it moved to the BnetDocs research forum.  Its more applicable there and stands a significantly better chance of getting what you're looking for.

Edit: Also look at the starcraft lobby protocol in that same forum.  It is likely that warcraft III atleast uses a simiar system to starcraft so you can know what packets to look for(slot updates, team changes, user leave/join etc..)
#13
You have 2 entities, a Client and an Employee and you want them to be in the same list?  Why not just make a person class and derive Client and Employee from it(making both of them classes instead of structs ofcourse) then just have a Person list?
#14
C/C++ Programming / Re: Timer in a DLL
March 29, 2006, 06:01 PM
Disclaimer: Im not familar with D2 in any way.

With that said, I know this much, D2 is a game with graphics.  Those graphics are rendered, to render them there is a loop that draws each frame.  It may be easier for you just to place a call to your function that checks the current life of the character in the primary rendering loop of the game.
#15
C/C++ Programming / Re: Maps & character array
March 29, 2006, 04:59 PM
Quote from: rabbit on March 29, 2006, 04:42 PM
That's theoretical, though.  A hashtable with O(1) efficiency assumes the hash is perfect (IE: no collisions ever) which doesn't exist.  Depending on the type of hash you use as the key, a hashtable can be extremely inefficient.

Indeed, however with keys like this which are varied length and characters, along with a hash function designed for string use, a hashtable would probably be preferable to a binary tree search.