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