Advertisement
Nofew

BuyItem

May 26th, 2016
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.94 KB | None | 0 0
  1. int BuyItem() {
  2.     //ShopSelection
  3.     //ShopQuantity
  4.     //CurrentMonth
  5.     int i;
  6.     int Cost;
  7.     // 0 - 9 for Spring.
  8.     // 10 - 21 for Summer.
  9.     // 22 - 32 for Autumn.
  10.     if(InventorySlotTwelve != 0) {
  11.         if(CurrentMonth == 1) {
  12.             i = 0;
  13.         }
  14.         else if(CurrentMonth == 2) {
  15.             i = 10;
  16.         }
  17.         else if(CurrentMonth == 3) {
  18.             i = 22;
  19.         }
  20.         i = ShopSelection + i;
  21.         // GoldCalculation();
  22.         Cost = AllCrops[i].Seeds * ShopQuantity;
  23.         if(CurrentGold >= Cost) {
  24.             strncpy(InventorySlotTwelve.ItemName, AllCrops[i].InventoryText, 14);
  25.             InventorySlotTwelve.ItemQuantity = ShopQuantity;
  26.             CurrentGold = CurrentGold - Cost;
  27.             StackInventoryItems();
  28.         }
  29.         else {
  30.             // 'You don't have enough money!' here.
  31.         }
  32.     else {
  33.         // 'Full inventory!' here.
  34.     }
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement