umm i am trying to get the wins out from the starcraft accounts when the person enters and when i do strSS = cleanslatebot1.ParseSS(Message)
in the join sub strSS ends up equaling "a Starcraft: Brood War bot." ? so is there something i am doing wrong or another way of going about it/doing?
Public Function ParseStatString(ByVal StatString As String) As String
Dim Values() As String
Dim cType As String
Select Case Left(StatString, 4)
Case "RHSS": ParseStatString = "SSHR"
Case "PX2D", "VD2D": ParseStatString = ParseD2Stats(StatString)
Case "RATS", "PXES", "RTSJ", "RHSJ"
Values() = Split(StatString, " ")
ParseStatString = Values(0) & _
IIf(Values(4) = 1, " (spawn)", "") & ": " & _
Values(3) & " wins" & _
IIf(Values(1), ", with a rating of " & Values(1) & " (high " & Values(6) & ")", "")
can i have d2xp also pleasse
thx
Certainly:
void ParseD2Stats(char *stats, int *imgIndex, char *statbuf) {
char *d2classes[] = { "amazon", "sorceress", "necromancer", "paladin", "barbarian", "druid",
"assassin", "unknown class" };
char *p = 0;
char server[32];
char name[32];
if( !strncmp( stats, "VD2D", 4 )) {
strcpy( statbuf, "Diablo II ");
*imgIndex = 9;
}
else {
strcpy( statbuf, "Diablo II: Lord of Destruction ");
*imgIndex = 3;
}
if( strlen( stats ) > 4 ) {
char c = '\0';
int i = 4;
while ( c != ',' ) {
c = stats[i];
i++;
}
c = '\0';
strncpy( server, (stats + 4), ( i - 5 ));
server[i-5] = c;
int len = strlen( server );
while ( c != ',' ) {
c = stats[i];
i++;
}
strncpy( name, (stats + len + 5), (i - len - 6));
name[i - len - 6] = '\0';
len += strlen( name );
p = stats + len + 6;
}
if ( !p || strlen(p) != 33) {
strcat( statbuf, "(Open character)");
}
else {
char version = p[0] - 0x80;
char charclass = p[13] - 1;
if(charclass < 0 || charclass > 6)
charclass = 7;
bool female = false;
if(charclass == 0 || charclass == 1 || charclass == 6)
female = true;
int charlevel = p[25];
char hardcore = p[26] & 4;
bool expansion = false;
strcat( statbuf, "(" );
if( !strncmp( stats, "PX2D", 4)) {
if ( p[26] & 0x20 ) {
switch( (p[27] & 0x18) >> 3 ) {
case 1:
if(hardcore)
strcat( statbuf, "Destroyer ");
else
strcat( statbuf, "Slayer ");
break;
case 2:
if(hardcore)
strcat(statbuf, "Conquerer ");
else
strcat(statbuf, "Champion ");
break;
case 3:
if(hardcore)
strcat(statbuf, "Guardian ");
else {
if ( !female )
strcat(statbuf, "Patriarch ");
else strcat(statbuf, "Matriarch ");
}
break;
}
expansion = true;
}
}
if( !expansion ) {
switch ( (p[27] & 0x18) >> 3 ) {
case 1:
if ( female == false ) {
if ( hardcore )
strcat ( statbuf, "Count ");
else
strcat( statbuf, "Sir ");
}
else {
if(hardcore)
strcat( statbuf, "Countess ");
else
strcat(statbuf, "Dame ");
}
break;
case 2:
if ( female == false ) {
if ( hardcore )
strcat ( statbuf, "Duke ");
else
strcat( statbuf, "Lord ");
}
else {
if( hardcore )
strcat( statbuf, "Duchess ");
else
strcat( statbuf, "Lady ");
}
break;
case 3:
if( female == false ) {
if ( hardcore )
strcat ( statbuf, "King ");
else
strcat( statbuf, "Baron ");
}
else {
if ( hardcore )
strcat( statbuf, "Queen ");
else
strcat( statbuf, "Baroness ");
}
break;
}
}
strcat( statbuf, name );
strcat( statbuf, ", a " );
char temp[128];
if ( hardcore ) {
if ( p[26] & 0x08 )
strcat( statbuf, "dead ");
strcpy( temp, statbuf );
sprintf( statbuf, "%shardcore level %d ", temp, charlevel );
}
else {
strcpy( temp, statbuf );
sprintf( statbuf, "%slevel %d ", temp, charlevel);
}
strcpy( temp, statbuf );
sprintf( statbuf, "%s%s on realm %s)", temp, d2classes[charclass], server);
}
}
Note - The original basis for this function is DarkMinion's work
QuoteCertainly:
void ParseD2Stats(char *stats, int *imgIndex, char *statbuf) {
char *d2classes[] = { "amazon", "sorceress", "necromancer", "paladin", "barbarian", "druid",
"assassin", "unknown class" };
char *p = 0;
char server[32];
char name[32];
if( !strncmp( stats, "VD2D", 4 )) {
strcpy( statbuf, "Diablo II ");
*imgIndex = 9;
}
else {
strcpy( statbuf, "Diablo II: Lord of Destruction ");
*imgIndex = 3;
}
if( strlen( stats ) > 4 ) {
char c = '\0';
int i = 4;
while ( c != ',' ) {
c = stats[i];
i++;
}
c = '\0';
strncpy( server, (stats + 4), ( i - 5 ));
server[i-5] = c;
int len = strlen( server );
while ( c != ',' ) {
c = stats[i];
i++;
}
strncpy( name, (stats + len + 5), (i - len - 6));
name[i - len - 6] = '\0';
len += strlen( name );
p = stats + len + 6;
}
if ( !p || strlen(p) != 33) {
strcat( statbuf, "(Open character)");
}
else {
char version = p[0] - 0x80;
char charclass = p[13] - 1;
if(charclass < 0 || charclass > 6)
charclass = 7;
bool female = false;
if(charclass == 0 || charclass == 1 || charclass == 6)
female = true;
int charlevel = p[25];
char hardcore = p[26] & 4;
bool expansion = false;
strcat( statbuf, "(" );
if( !strncmp( stats, "PX2D", 4)) {
if ( p[26] & 0x20 ) {
switch( (p[27] & 0x18) >> 3 ) {
case 1:
if(hardcore)
strcat( statbuf, "Destroyer ");
else
strcat( statbuf, "Slayer ");
break;
case 2:
if(hardcore)
strcat(statbuf, "Conquerer ");
else
strcat(statbuf, "Champion ");
break;
case 3:
if(hardcore)
strcat(statbuf, "Guardian ");
else {
if ( !female )
strcat(statbuf, "Patriarch ");
else strcat(statbuf, "Matriarch ");
}
break;
}
expansion = true;
}
}
if( !expansion ) {
switch ( (p[27] & 0x18) >> 3 ) {
case 1:
if ( female == false ) {
if ( hardcore )
strcat ( statbuf, "Count ");
else
strcat( statbuf, "Sir ");
}
else {
if(hardcore)
strcat( statbuf, "Countess ");
else
strcat(statbuf, "Dame ");
}
break;
case 2:
if ( female == false ) {
if ( hardcore )
strcat ( statbuf, "Duke ");
else
strcat( statbuf, "Lord ");
}
else {
if( hardcore )
strcat( statbuf, "Duchess ");
else
strcat( statbuf, "Lady ");
}
break;
case 3:
if( female == false ) {
if ( hardcore )
strcat ( statbuf, "King ");
else
strcat( statbuf, "Baron ");
}
else {
if ( hardcore )
strcat( statbuf, "Queen ");
else
strcat( statbuf, "Baroness ");
}
break;
}
}
strcat( statbuf, name );
strcat( statbuf, ", a " );
char temp[128];
if ( hardcore ) {
if ( p[26] & 0x08 )
strcat( statbuf, "dead ");
strcpy( temp, statbuf );
sprintf( statbuf, "%shardcore level %d ", temp, charlevel );
}
else {
strcpy( temp, statbuf );
sprintf( statbuf, "%slevel %d ", temp, charlevel);
}
strcpy( temp, statbuf );
sprintf( statbuf, "%s%s on realm %s)", temp, d2classes[charclass], server);
}
}
Note - The original basis for this function is DarkMinion's work
FYI, your Lord of Destruction title parsing code is incorrect.
Eww, it is?
That's wierd...It's seemed to be correct in practice...
QuoteEww, it is?
That's wierd...It's seemed to be correct in practice...
Sometimes it will incorrectly identify titles as being lower than they should be.