350 break; |
350 break; |
351 case 'i': |
351 case 'i': |
352 if (self.statsArray == nil) |
352 if (self.statsArray == nil) |
353 self.statsArray = [[NSMutableArray alloc] initWithCapacity:statMaxCapacity]; |
353 self.statsArray = [[NSMutableArray alloc] initWithCapacity:statMaxCapacity]; |
354 NSString *tempStr = [NSString stringWithUTF8String:&buffer[2]]; |
354 NSString *tempStr = [NSString stringWithUTF8String:&buffer[2]]; |
355 NSString *srg = [[tempStr componentsSeparatedByString:@" "] objectAtIndex:0]; |
355 NSString *arg = [[tempStr componentsSeparatedByString:@" "] objectAtIndex:0]; |
356 int index = [srg length] + 3; |
356 int index = [arg length] + 3; |
357 switch (buffer[1]) { |
357 switch (buffer[1]) { |
358 case 'r': // winning team |
358 case 'r': // winning team |
359 [self.statsArray insertObject:[NSString stringWithUTF8String:&buffer[2]] atIndex:0]; |
359 [self.statsArray insertObject:[NSString stringWithUTF8String:&buffer[2]] atIndex:0]; |
360 break; |
360 break; |
361 case 'D': // best shot |
361 case 'D': // best shot |
362 [self.statsArray addObject:[NSString stringWithFormat:@"The best shot award was won by %s with %@ points", &buffer[index], srg]]; |
362 [self.statsArray addObject:[NSString stringWithFormat:@"The best shot award was won by %s with %@ points", &buffer[index], arg]]; |
363 break; |
363 break; |
364 case 'k': // best hedgehog |
364 case 'k': // best hedgehog |
365 [self.statsArray addObject:[NSString stringWithFormat:@"The best killer is %s with %@ kills in a turn", &buffer[index], srg]]; |
365 [self.statsArray addObject:[NSString stringWithFormat:@"The best killer is %s with %@ kills in a turn", &buffer[index], arg]]; |
366 break; |
366 break; |
367 case 'K': // number of hogs killed |
367 case 'K': // number of hogs killed |
368 [self.statsArray addObject:[NSString stringWithFormat:@"A total of %@ hedgehog(s) were killed during this round", srg]]; |
368 [self.statsArray addObject:[NSString stringWithFormat:@"A total of %@ hedgehog(s) were killed during this round", arg]]; |
369 break; |
369 break; |
370 case 'H': //something about team health |
370 case 'H': //something about team health |
371 break; |
371 break; |
372 case 'T': // local team stats |
372 case 'T': // local team stats |
373 break; |
373 break; |
374 case 'P': // player postion |
374 case 'P': // player postion |
375 break; |
375 break; |
376 case 's': // self damage |
376 case 's': // self damage |
377 [self.statsArray addObject:[NSString stringWithFormat:@"%s thought it's good to shoot his own hedgehogs with %@ points", &buffer[index], srg]]; |
377 [self.statsArray addObject:[NSString stringWithFormat:@"%s thought it's good to shoot his own hedgehogs with %@ points", &buffer[index], arg]]; |
378 break; |
378 break; |
379 case 'S': // friendly fire |
379 case 'S': // friendly fire |
380 [self.statsArray addObject:[NSString stringWithFormat:@"%s killed %@ of his own hedgehogs", &buffer[2], srg]]; |
380 [self.statsArray addObject:[NSString stringWithFormat:@"%s killed %@ of his own hedgehogs", &buffer[index], arg]]; |
381 break; |
381 break; |
382 case 'B': // turn skipped |
382 case 'B': // turn skipped |
383 [self.statsArray addObject:[NSString stringWithFormat:@"%s was scared and skipped turn %@ times", &buffer[2], srg]]; |
383 [self.statsArray addObject:[NSString stringWithFormat:@"%s was scared and skipped turn %@ times", &buffer[index], arg]]; |
384 break; |
384 break; |
385 default: |
385 default: |
386 DLog(@"Unhandled stat message, see statsPage.cpp"); |
386 DLog(@"Unhandled stat message, see statsPage.cpp"); |
387 break; |
387 break; |
388 } |
388 } |