Advertisement
Guest User

killcount

a guest
Oct 14th, 2015
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.64 KB | None | 0 0
  1. if((!strcmp(myCommand, "killcount")))
  2. {
  3.     char *itemList[4] =
  4.     {  
  5.         "Sealed J-Sword",
  6.         "Lame D'Argent",
  7.         "Limiter",
  8.         "Swordsman Lore"
  9.     };
  10.     char item = -1;
  11.     char found = 0;
  12.     unsigned kills = 0;
  13.     for(ch = 0; ch < client->character.inventoryUse; ch++)
  14.     {
  15.         // require the item to be equipped
  16.         if(client->character.inventory[ch].flags & 0x08)
  17.         {
  18.            
  19.             if(client->character.inventory[ch].item.data[0] == 0x00)
  20.             {
  21.                 // Weapons
  22.                 if(client->character.inventory[ch].item.data[1] == 0x33)
  23.                 {
  24.                     // Sealed J-Sword
  25.                     item = 0;
  26.                     found = 1;
  27.                 }  
  28.                 else if(client->character.inventory[ch].item.data[1] == 0xAB)
  29.                 {
  30.                     // Lame D'Argent
  31.                     item = 1;
  32.                     found = 1;
  33.                 }
  34.             }
  35.             else if(client->character.inventory[ch].item.data[0] == 1 && client->character.inventory[ch].item.data[1] == 0x03)
  36.             {
  37.                 // Armor -> Units
  38.                 if(client->character.inventory[ch].item.data[2] == 0x4D)
  39.                 {
  40.                     // Limiter
  41.                     item = 2;
  42.                     found = 1;
  43.                 }
  44.                 else if(client->character.inventory[ch].item.data[2] == 0x4F)
  45.                 {
  46.                     // Swordsman Lore
  47.                     item = 3;
  48.                     found = 1;
  49.                 }
  50.             }
  51.         }
  52.  
  53.         if(item != -1)
  54.         {
  55.             char buffer[50];
  56.             kills = swapendian(*(unsigned short*)&client->character.inventory[ch].item.data[10]) - 0x8000;
  57.             if(kills < 0 || kills > 0x8000)
  58.             {
  59.                 sprintf(buffer, "%u %s: Error", ch + 1, itemList[item]);
  60.                 SendB0(buffer, client);
  61.             }
  62.             else
  63.             {
  64.                 sprintf(buffer, "%u %s: %u", ch + 1, itemList[item], kills);
  65.                 SendB0(buffer, client);
  66.             }
  67.             item = -1;
  68.             kills = 0;
  69.         }
  70.     }
  71.  
  72.     if(!found)
  73.     {
  74.         Send0(client, "No sealed item equipped");
  75.     }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement