Guest User

Untitled

a guest
Aug 31st, 2015
176
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Scriptname CookingScript extends ObjectReference
  2.  
  3. Import FISSFactory
  4.  
  5. int Property isSoup Auto
  6. Function Cleaner()
  7.     Cleaner = 0
  8.     while Cleaner<=128                                                               ;; This WHILE cleans the arrays of crap before we begin putting stuff in them.
  9.         sOptions[Cleaner] = " "
  10.         sSelect[Cleaner] = BlankForm
  11.     Cleaner += 1
  12.     endwhile
  13. EndFunction
  14.  
  15. Int Property Cleaner Auto
  16. Int Property Count Auto
  17. Int Property Index Auto
  18. Int Property Player Auto
  19. Form Property BlankForm Auto
  20. Form Property BlankForm_2 Auto
  21.  
  22. String[] sOptions
  23. Form[] sSelect
  24. String[] sMenu
  25. Form[] rRemoved
  26. String[] sCraft
  27.  
  28. FormList Property FirstTierSoup Auto
  29. FormList Property SecondTierSoup Auto
  30. Int Property SSize Auto
  31. FormList Property ThirdTierSoup Auto
  32. Int Property TSize Auto
  33. Int Property FName Auto
  34. FormList Property FourthTierSoup Auto
  35. Int Property FSize Auto
  36. Int Property SName Auto
  37.  
  38. FormList Property FirstTierMisc Auto
  39. Int Property FMSize Auto
  40. FormList Property SecondTierMisc Auto
  41. Int Property SMSize Auto
  42. FormList Property ThirdTierMisc Auto
  43. Int Property TMSize Auto
  44.  
  45. FormList Property  CookingFurn Auto
  46.  
  47. FormList Property FirstTierMeat Auto
  48. Int Property FMMeat Auto
  49. FormList Property SecondTierMeat Auto
  50. Int Property SMMeat Auto
  51. FormList Property LiquidFormList  Auto  
  52. Int Property LLiquid Auto
  53. FormList Property EmptyBottles Auto
  54.  
  55. Potion Property SoupTemplate Auto
  56. Potion Property StewTemplate Auto
  57. Potion Property MeatTemplate Auto
  58. Potion Property LiquidTemplate Auto
  59. Potion Property LiquidAleTemplate Auto
  60. Potion Property BreadTemplate Auto
  61. Potion Property DumplingTemplate Auto
  62. Potion Property SweetRollTemplate Auto
  63. Potion Property PieTemplate Auto
  64.  
  65.  
  66. Potion Property WaterPot Auto
  67. Potion Property Yeast Auto
  68. Potion Property FoodSalmon Auto
  69. Potion Property FoodLeeksGrilled Auto
  70. Potion Property FoodPotatoesBaked Auto
  71.  
  72. Int Property Water Auto
  73. Int Property FirstTier Auto
  74. Int Property SecondTier Auto
  75. Int Property ThirdTier Auto
  76.  
  77. GlobalVariable Property ActivatedOnce Auto
  78. Actor Property PlayerRef Auto
  79.  
  80. Event OnActivate(ObjectReference akActionRef)
  81.  
  82.  
  83. if ActivatedOnce.GetValueInt()%2 == 0
  84.  
  85. Index = 0
  86.  
  87.     while sCraft[Index] == sCraft[0]
  88. sOptions = new String[128]
  89. sSelect = new Form[128]
  90. sMenu = new String[128]
  91. rRemoved = new Form[128]
  92. sCraft = new String[2]
  93.  
  94. sCraft[0] = "Yes"
  95. sCraft[1] = "No"
  96.  
  97.     sMenu[0] = "Soup/Stew"
  98.     sMenu[1] = "Meats"
  99.     sMenu[2] = "Ale/Juice/Mead"
  100.     sMenu[3] = "Misc/Other"
  101.    
  102.     Player = ((Self as Form) as UILIB_1).ShowList("What food do you want to make?", sMenu, 0, 128)
  103.  
  104.                             if sMenu[2] == sMenu[Index]
  105.  
  106.                             Cleaner()
  107.                             FirstTier = 0
  108.                             SecondTier = 0
  109.                             int AllGood = 0
  110.  
  111.                             if PlayerRef.GetItemCount(Yeast)>=1
  112.                                 sOptions[1] = "Yeast"
  113.                                 sSelect[1] = Yeast
  114.                                 AllGood = 1
  115.                             endif
  116.  
  117.                             if PlayerRef.GetItemCount(WaterPot)>=1
  118.                                 sOptions[0] = "Water"
  119.                                 sSelect[0] = WaterPot
  120.                                 AllGood = 1
  121.                             endif
  122.  
  123.                             if AllGood == 1
  124.                                 Player = ((Self as Form) as UILIB_1).ShowList("First Tier Ingredient", sOptions, 0, 128)
  125.                                 PlayerRef.RemoveItem(sSelect[Index])
  126.                                 rRemoved[0] = sSelect[Index]
  127.                             endif
  128.  
  129.                             while sSelect[Index] == BlankForm && AllGood == 1                           ; This makes sure the user does not select a blank form that was cleaned with the Cleaner() function
  130.                                 Player = ((Self as Form) as UILIB_1).ShowList("First Tier Ingredient", sOptions, 0, 128)
  131.                                 PlayerRef.RemoveItem(sSelect[Index])
  132.                                 rRemoved[0] = sSelect[Index]
  133.                             endWhile
  134.                             Cleaner()
  135.  
  136.                             Potion AleClone = KMXPotionUtil.TempClonePotion(LiquidAleTemplate)
  137.                             Potion Juice = KMXPotionUtil.TempClonePotion(LiquidTemplate)
  138.  
  139.                             Count = 0
  140.                             LLiquid = 0
  141.                             while LLiquid < LiquidFormList.GetSize()
  142.                                 if PlayerRef.GetItemCount(LiquidFormList.GetAt(LLiquid))>=1
  143.                                     sOptions[Count] = LiquidFormList.GetAt(LLiquid).GetName() + " (" + PlayerRef.GetItemCount(LiquidFormList.GetAt(LLiquid)) + ")"
  144.                                     sSelect[Count] = LiquidFormList.GetAt(LLiquid)
  145.                                     Count += 1
  146.                                 endif
  147.                                 LLiquid += 1
  148.                             endWhile
  149.  
  150.                             if Count>=1 && AllGood == 1
  151.                                 Player = ((Self as Form) as UILIB_1).ShowList("Second Tier Ingredient", sOptions, 0, 128)
  152.                                 PlayerRef.RemoveItem(sSelect[Index])
  153.                                 rRemoved[1] = sSelect[Index]
  154.                             endif
  155.  
  156.                             while sSelect[Index] == BlankForm && Count>=1 && AllGood == 1                       ; This makes sure the user does not select a blank form that was cleaned with the Cleaner() function
  157.                                 Player = ((Self as Form) as UILIB_1).ShowList("Second Tier Ingredient", sOptions, 0, 128)
  158.                                 PlayerRef.RemoveItem(sSelect[Index])
  159.                                 rRemoved[1] = sSelect[Index]
  160.                             endWhile
  161.                             Cleaner()
  162.  
  163.  
  164.                             if Count == 0
  165.                                 PlayerRef.AddItem(rRemoved[0])
  166.                                 PlayerRef.AddItem(rRemoved[1])
  167.                                 Debug.Notification("I don't have enough ingredients to make this item.")
  168.                             endif
  169.  
  170.                             if Count >= 1
  171.                                 if rRemoved[0] == WaterPot && (rRemoved[1] != LiquidFormList.GetAt(4) && rRemoved[1] != LiquidFormList.GetAt(3))
  172.                                     Juice.SetName(rRemoved[1].GetName() + " Juice")
  173.                                     PlayerRef.AddItem(Juice)
  174.                                 endif
  175.  
  176.                                 if rRemoved[0] == Yeast && rRemoved[1] == LiquidFormList.GetAt(3)
  177.                                     AleClone.SetName(rRemoved[1].GetName() + " Mead")
  178.                                     PlayerRef.AddItem(AleClone)
  179.                                 endif
  180.  
  181.                                 if rRemoved[0] == Yeast && rRemoved[1] != LiquidFormList.GetAt(3)
  182.                                     AleClone.SetName(rRemoved[1].GetName() + " Ale")
  183.                                     PlayerRef.AddItem(AleClone)
  184.                                 endif
  185.                             endif
  186.  
  187.                             Index = 2
  188.                             rRemoved[0] = BlankForm
  189.                             rRemoved[1] = BlankForm
  190.  
  191.                             endif
  192.                     if sMenu[1] == sMenu[Index]
  193.  
  194.                     Cleaner()
  195.                     FirstTier = 0
  196.                     SecondTier = 0
  197.  
  198.                     Count = 0
  199.                     FMMeat = 0
  200.                     while FMMeat<FirstTierMeat.GetSize()
  201.                         if PlayerRef.GetItemCount(FirstTierMeat.GetAt(FMMeat))>=1
  202.                         sOptions[Count] = FirstTierMeat.GetAt(FMMeat).GetName() + " (" + PlayerRef.GetItemCount(FirstTierMeat.GetAt(FMMeat)) + ")"
  203.                         sSelect[Count] = FirstTierMeat.GetAt(FMMeat)
  204.                         Count += 1
  205.                         endif
  206.                     FMMeat += 1
  207.                     endWhile
  208.  
  209.                     if Count>=1
  210.                         Player = ((Self as Form) as UILIB_1).ShowList("First Tier Ingredient", sOptions, 0, 128)
  211.                         FirstTier = 1
  212.                         rRemoved[0] = sSelect[Index]
  213.                         PlayerRef.RemoveItem(sSelect[Index])
  214.                     endif
  215.            
  216.                     while sSelect[Index] == BlankForm && FirstTier == 1                             ; This makes sure the user does not select a blank form that was cleaned with the Cleaner() function
  217.                         Player = ((Self as Form) as UILIB_1).ShowList("First Tier Ingredient", sOptions, 0, 128)
  218.                         FirstTier = 1
  219.                         PlayerRef.RemoveItem(sSelect[Index])
  220.                         rRemoved[0] = sSelect[Index]
  221.                     endWhile
  222.                     Cleaner()
  223.  
  224.                     Count = 0
  225.                     SMMeat = 0
  226.                     while SMMeat<SecondTierMeat.GetSize()
  227.                         if PlayerRef.GetItemCount(SecondTierMeat.GetAt(SMMeat))>=1
  228.                         sOptions[Count] = SecondTierMeat.GetAt(SMMeat).GetName() + " (" + PlayerRef.GetItemCount(SecondTierMeat.GetAt(SMMeat)) + ")"
  229.                         sSelect[Count] = SecondTierMeat.GetAt(SMMeat)
  230.                         Count+=1
  231.                         endif
  232.                     SMMeat += 1
  233.                     endWhile
  234.  
  235.                     if Count>=1
  236.                         Player = ((Self as Form) as UILIB_1).ShowList("Second Tier Ingredient", sOptions, 0, 128)
  237.                         SecondTier = 1
  238.                         rRemoved[1] = sSelect[Index]
  239.                         PlayerRef.RemoveItem(sSelect[Index])
  240.                     endif
  241.            
  242.                     while sSelect[Index] == BlankForm && SecondTier == 1                                ; This makes sure the user does not select a blank form that was cleaned with the Cleaner() function
  243.                         Player = ((Self as Form) as UILIB_1).ShowList("Second Tier Ingredient", sOptions, 0, 128)
  244.                         SecondTier = 1
  245.                         PlayerRef.RemoveItem(sSelect[Index])
  246.                         rRemoved[1] = sSelect[Index]
  247.                     endWhile
  248.                     Cleaner()
  249.  
  250.                     Potion MeatClone = KMXPotionUtil.TempClonePotion(MeatTemplate)
  251.  
  252.                     if SecondTier == 0
  253.                         PlayerRef.AddItem(rRemoved[0])
  254.                         PlayerRef.AddItem(rRemoved[1])
  255.                         Debug.Notification("I don't have enough ingredients to cook this meat.")
  256.                     endif
  257.  
  258.                         float WeightAdder = 0
  259.                     if rRemoved[1]!=FirstTierMeat.GetAt(6) && SecondTier == 1
  260.                         MeatClone.SetName(rRemoved[1].GetName() + "ed " + rRemoved[0].GetName())
  261.                             while WeightAdder <= rRemoved[0].GetWeight()
  262.                                 PlayerRef.AddItem(MeatClone)
  263.                                 WeightAdder += 0.4
  264.                             endwhile
  265.                     elseif rRemoved[1]==FirstTierMeat.GetAt(6)
  266.                         PlayerRef.AddItem(FoodSalmon)
  267.                     endif
  268.  
  269.                     rRemoved[0] = BlankForm
  270.                     rRemoved[1] = BlankForm
  271.                     Index = 1
  272.  
  273.  
  274.                     endif
  275.  
  276.             if sMenu[3] == sMenu[Index]
  277.  
  278.             Cleaner()
  279.  
  280.             FirstTier = 0
  281.             SecondTier = 0
  282.             ThirdTier = 0
  283.  
  284.             Count = 0
  285.             FMSize = 0
  286.             while FMSize<FirstTierMisc.GetSize()
  287.                 if PlayerRef.GetItemCount(FirstTierMisc.GetAt(FMSize))>=1
  288.                     sOptions[Count] = FirstTierMisc.GetAt(FMSize).GetName() + " (" + PlayerRef.GetItemCount(FirstTierMisc.GetAt(FMSize)) + ")"
  289.                     sSelect[Count] = FirstTierMisc.GetAt(FMSize)
  290.                     Count+=1
  291.                 endif
  292.                 FMSize += 1
  293.             endWhile
  294.  
  295.             if Count>=1
  296.             Player = ((Self as Form) as UILIB_1).ShowList("First Tier Ingredient", sOptions, 0, 128)
  297.             FirstTier = 1
  298.             rRemoved[0] = sSelect[Index]
  299.             PlayerRef.RemoveItem(sSelect[Index])
  300.             endif
  301.            
  302.             while sSelect[Index] == BlankForm && FirstTier == 1                             ; This makes sure the user does not select a blank form that was cleaned with the Cleaner() function
  303.                 Player = ((Self as Form) as UILIB_1).ShowList("First Tier Ingredient", sOptions, 0, 128)
  304.                 FirstTier = 1
  305.                 PlayerRef.RemoveItem(sSelect[Index])
  306.                 rRemoved[0] = sSelect[Index]
  307.             endWhile
  308.             Cleaner()
  309.  
  310.             Count = 0
  311.             SMSize = 0
  312.             while SMSize<SecondTierMisc.GetSize()
  313.                 if PlayerRef.GetItemCount(SecondTierMisc.GetAt(SMSize))>=1
  314.                     sOptions[Count] = SecondTierMisc.GetAt(SMSize).GetName() + " (" + PlayerRef.GetItemCount(SecondTierMisc.GetAt(SMSize)) + ")"
  315.                     sSelect[Count] = SecondTierMisc.GetAt(SMSize)
  316.                     Count+=1
  317.                 endif
  318.                 SMSize += 1
  319.             endWhile
  320.  
  321.             if Count>=1 && FirstTier == 1
  322.             Player = ((Self as Form) as UILIB_1).ShowList("Second Tier Ingredient", sOptions, 0, 128)
  323.             SecondTier = 1
  324.             rRemoved[1] = sSelect[Index]
  325.             PlayerRef.RemoveItem(sSelect[Index])
  326.             endif
  327.  
  328.             while sSelect[Index] == BlankForm && SecondTier == 1                                ; This makes sure the user does not select a blank form that was cleaned with the Cleaner() function
  329.                 Player = ((Self as Form) as UILIB_1).ShowList("Second Tier Ingredient", sOptions, 0, 128)
  330.                 SecondTier = 1
  331.                 PlayerRef.RemoveItem(sSelect[Index])
  332.                 rRemoved[1] = sSelect[Index]
  333.             endWhile
  334.             Cleaner()
  335.  
  336.             Count = 0
  337.             TMSize = 0
  338.             while TMSize<ThirdTierMisc.GetSize()
  339.                 if PlayerRef.GetItemCount(ThirdTierMisc.GetAt(TMSize))>=1
  340.                     sOptions[Count] = ThirdTierMisc.GetAt(TMSize).GetName() + " (" + PlayerRef.GetItemCount(ThirdTierMisc.GetAt(TMSize)) + ")"
  341.                     sSelect[Count] = ThirdTierMisc.GetAt(TMSize)
  342.                     Count+=1
  343.                 endif
  344.                 TMSize += 1
  345.             endWhile
  346.  
  347.             if Count>=1
  348.             Player = ((Self as Form) as UILIB_1).ShowList("Third Tier Ingredient", sOptions, 0, 128)
  349.             ThirdTier = 1
  350.             rRemoved[2] = sSelect[Index]
  351.             PlayerRef.RemoveItem(sSelect[Index])
  352.             endif
  353.  
  354.             while sSelect[Index] == BlankForm && ThirdTier == 1                             ; This makes sure the user does not select a blank form that was cleaned with the Cleaner() function
  355.                 Player = ((Self as Form) as UILIB_1).ShowList("Third Tier Ingredient", sOptions, 0, 128)
  356.                 ThirdTier = 1
  357.                 PlayerRef.RemoveItem(sSelect[Index])
  358.                 rRemoved[2] = sSelect[Index]
  359.             endWhile
  360.             Cleaner()
  361.  
  362.  
  363.             if rRemoved[0] == FirstTierMisc.GetAt(1) && rRemoved[1] == SecondTierMisc.GetAt(44) && rRemoved[2] == ThirdTierMisc.GetAt(4)
  364.                             PlayerRef.AddItem(SweetRollTemplate)
  365.             endif
  366.             if rRemoved[0] == FirstTierMisc.GetAt(1)
  367.                 if rRemoved[1] != SecondTierMisc.GetAt(1) && rRemoved[1] != SecondTierMisc.GetAt(21) && rRemoved[1] != SecondTierMisc.GetAt(44)
  368.                     if rRemoved[2] == ThirdTierMisc.GetAt(0)
  369.                         Potion PieClone = KMXPotionUtil.TempClonePotion(PieTemplate)
  370.                         PieClone.SetName(rRemoved[1].GetName() + " Pie")
  371.                         PlayerRef.AddItem(PieClone)
  372.                     endif
  373.                 endif
  374.             endif
  375.             if rRemoved[0] == FirstTierMisc.GetAt(0) && rRemoved[1] == SecondTierMisc.GetAt(0) && rRemoved[2] == ThirdTierMisc.GetAt(0)
  376.                 PlayerRef.AddItem(Yeast)
  377.             elseif rRemoved[0] == FirstTierMisc.GetAt(1)
  378.                     if rRemoved[1]!=SecondTierMisc.GetAt(1) && rRemoved[1]!=SecondTierMisc.GetAt(21) && rRemoved[1]!=SecondTierMisc.GetAt(44)
  379.                         if rRemoved[2] == ThirdTierMisc.GetAt(3) || rRemoved[2] == ThirdTierMisc.GetAt(4)
  380.                 Potion DumplingClone = KMXPotionUtil.TempClonePotion(DumplingTemplate)
  381.                 DumplingClone.SetName(rRemoved[1].GetName() + " Dumpling")
  382.                 PlayerRef.AddItem(DumplingClone)
  383.                         endif
  384.                     endif
  385.             elseif rRemoved[0] == FirstTierMisc.GetAt(1) && rRemoved[2] == ThirdTierMisc.GetAt(1)
  386.                 Potion BreadClone = KMXPotionUtil.TempClonePotion(BreadTemplate)
  387.                 BreadClone.SetName(rRemoved[1].GetName() + " Bread")
  388.                 PlayerRef.AddItem(BreadClone)
  389.             elseif rRemoved[0] == FirstTierMisc.GetAt(2) && rRemoved[1] == SecondTierMisc.GetAt(1) && rRemoved[2] == ThirdTierMisc.GetAt(2)
  390.                 PlayerRef.AddItem(FoodLeeksGrilled)
  391.             elseif rRemoved[0] == FirstTierMisc.GetAt(3) && rRemoved[1] == SecondTierMisc.GetAt(21) && rRemoved[2] == ThirdTierMisc.GetAt(3)
  392.                 PlayerRef.AddItem(FoodPotatoesBaked)
  393.             endif
  394.  
  395.             if SecondTier == 0                                  ; Checks if you somehow are out of ingredients and resets your ingredients back from where you started
  396.                 PlayerRef.AddItem(rRemoved[0])
  397.                 Debug.Notification("I'm missing some ingredients needed to make a Misc/Other.")
  398.             endif
  399.  
  400.             if ThirdTier == 0                                   ; Checks if you somehow are out of ingredients and resets your ingredients back from where you started
  401.                 PlayerRef.AddItem(rRemoved[1])
  402.                 PlayerRef.AddItem(rRemoved[2])
  403.                 Debug.Notification("I'm missing some ingredients needed to make a Misc/Other.")
  404.             endif
  405.  
  406.                 rRemoved[0] = BlankForm
  407.                 rRemoved[1] = BlankForm
  408.                 rRemoved[2] = BlankForm
  409.                 Index = 3
  410.             endif
  411.  
  412.         if sMenu[0] == sMenu[Index]                 ; This starts the Soup/Stew fragment.
  413. rRemoved[3] = BlankForm
  414. FirstTier = 0
  415. SecondTier = 0
  416. ThirdTier = 0
  417. isSoup = 0
  418.  
  419. Cleaner()                                   ; This function cleans our arrays.
  420.  
  421. if PlayerRef.GetItemCount(FirstTierSoup.GetAt(0))==0                ; Here we check if we have water in our inventory or not, water is needed to cook stew/soup.
  422.     Water = 0
  423. else
  424.     sSelect[0] = FirstTierSoup.GetAt(0)
  425.     PlayerRef.RemoveItem(FirstTierSoup.GetAt(0))
  426.     Water = 1
  427. endif
  428.    
  429. if Water == 0
  430.     Debug.Notification("I don't have any water to cook a Soup or Stew with.")
  431. endif
  432.  
  433. Count = 0
  434. sSize = 0
  435.     while sSize<SecondTierSoup.GetSize()                    ; Looks into the SecondTierSoup FormList and adds them to the list
  436.         if PlayerRef.GetItemCount(SecondTierSoup.GetAt(sSize))>=1
  437.             sOptions[Count] = SecondTierSoup.GetAt(sSize).GetName() + " (" + PlayerRef.GetItemCount(SecondTierSoup.GetAt(sSize)) + ")"
  438.             sSelect[Count] = SecondTierSoup.GetAt(sSize)
  439.             Count += 1
  440.         endif
  441.         sSize += 1
  442.     endwhile
  443.  
  444. if Count>=1 && Water == 1                           ; If we have more than 1 ingredient, and we have water, show list.
  445. Player = ((Self as Form) as UILIB_1).ShowList("First Tier Ingredient", sOptions, 0, 128)
  446.         FirstTier = 1
  447.         PlayerRef.RemoveItem(sSelect[Index])
  448.         rRemoved[0] = sSelect[Index]
  449.     else
  450.         Water = 0
  451. endif
  452.  
  453.     while sSelect[Index] == BlankForm && Count!=0 && Water == 1                                 ; This makes sure the user does not select a blank form that was cleaned with the Cleaner() function
  454.         Player = ((Self as Form) as UILIB_1).ShowList("First Tier Ingredient", sOptions, 0, 128)
  455.         FirstTier = 1
  456.         PlayerRef.RemoveItem(sSelect[Index])
  457.         rRemoved[0] = sSelect[Index]
  458.     endWhile
  459. Cleaner()                                   ; This function cleans our arrays.
  460.  
  461. Count = 0
  462. tSize = 0
  463.     while tSize<ThirdTierSoup.GetSize()                 ; Looks into the ThirdTierSoup FormList and adds them to the list
  464.         if PlayerRef.GetItemCount(ThirdTierSoup.GetAt(tSize))>=1
  465.             sOptions[Count] = ThirdTierSoup.GetAt(tSize).GetName() + " (" + PlayerRef.GetItemCount(ThirdTierSoup.GetAt(tSize)) + ")"
  466.             sSelect[Count] = ThirdTierSoup.GetAt(tSize)
  467.             Count += 1
  468.         endif
  469.         tSize += 1
  470.     endwhile
  471.  
  472. if Count>=1 && FirstTier == 1                           ; If we have more than 1 ingredient, and we have water, show list.
  473. Player = ((Self as Form) as UILIB_1).ShowList("Second Tier Ingredient", sOptions, 0, 128)
  474.         SecondTier = 1
  475.         PlayerRef.RemoveItem(sSelect[Index])
  476.         rRemoved[1] = sSelect[Index]
  477.     else
  478.         FirstTier = 0
  479.     endif
  480.  
  481.     while sSelect[Index] == BlankForm && Count!=0 && FirstTier == 1                             ; This makes sure the user does not select a blank form that was cleaned with the Cleaner() function
  482.         Player = ((Self as Form) as UILIB_1).ShowList("Second Tier Ingredient", sOptions, 0, 128)
  483.         SecondTier = 1
  484.         PlayerRef.RemoveItem(sSelect[Index])
  485.         rRemoved[1] = sSelect[Index]
  486.     endWhile
  487.  
  488.     if sSelect[Index] == ThirdTierSoup.GetAt(35) || sSelect[Index] == ThirdTierSoup.GetAt(36) || sSelect[Index] == ThirdTierSoup.GetAt(37) || sSelect[Index] == ThirdTierSoup.GetAt(38) || sSelect[Index] == ThirdTierSoup.GetAt(39) || sSelect[Index] == ThirdTierSoup.GetAt(40) || sSelect[Index] == ThirdTierSoup.GetAt(41) || sSelect[Index] == ThirdTierSoup.GetAt(42)
  489.         isSoup = 1
  490.     endif
  491.  
  492. Potion Clone = KMXPotionUtil.TempClonePotion(StewTemplate)
  493. Potion Clone2 = KMXPotionUtil.TempClonePotion(SoupTemplate)
  494.  
  495. if SecondTier==1
  496. Clone.SetName(sSelect[Index].GetName())
  497. rRemoved[3] = sSelect[Index]
  498. endif
  499. Cleaner()                                   ; This function cleans our arrays.
  500.  
  501. Count = 0
  502. fSize = 0
  503.     while fSize<FourthTierSoup.GetSize()                    ; Looks into the FourthTier FormList and adds them to the list
  504.         if PlayerRef.GetItemCount(FourthTierSoup.GetAt(fSize))>=1
  505.             sOptions[Count] = FourthTierSoup.GetAt(fSize).GetName() + " (" + PlayerRef.GetItemCount(FourthTierSoup.GetAt(fSize)) + ")"
  506.             sSelect[Count] = FourthTierSoup.GetAt(fSize)
  507.             Count += 1
  508.         endif
  509.         fSize += 1
  510.     endwhile
  511.  
  512. if Count>=1 && SecondTier == 1                          ; If we have more than 1 ingredient, and we have water, show list.
  513. Player = ((Self as Form) as UILIB_1).ShowList("Third Tier Ingredient", sOptions, 0, 128)
  514.         ThirdTier = 1
  515.         PlayerRef.RemoveItem(sSelect[Index])
  516.         rRemoved[2] = sSelect[Index]
  517.     else
  518.         SecondTier = 0
  519.     endif
  520.  
  521.     while sSelect[Index] == BlankForm && Count!=0 && SecondTier == 1                                    ; This makes sure the user does not select a blank form that was cleaned with the Cleaner() function
  522.         Player = ((Self as Form) as UILIB_1).ShowList("Third Tier Ingredient", sOptions, 0, 128)
  523.         ThirdTier = 1
  524.         PlayerRef.RemoveItem(sSelect[Index])
  525.         rRemoved[2] = sSelect[Index]
  526.     endWhile
  527.  
  528. if SecondTier == 0                                  ; Checks if you somehow are out of ingredients and resets your ingredients back from where you started
  529.     PlayerRef.AddItem(rRemoved[0])
  530.     Debug.Notification("I'm missing some ingredients needed to make a Soup or a Stew.")
  531. endif
  532.  
  533. if ThirdTier == 0                                   ; Checks if you somehow are out of ingredients and resets your ingredients back from where you started
  534.     PlayerRef.AddItem(rRemoved[1])
  535.     PlayerRef.AddItem(rRemoved[2])
  536.     Debug.Notification("I'm missing some ingredients needed to make a Soup or a Stew.")
  537. endif
  538.  
  539. if ThirdTier==1                                 ; This is where we name our shit, stay classy.
  540.     if rRemoved[3] == sSelect[Index] && isSoup == 0
  541.         Clone.SetName(sSelect[Index].GetName() + " Stew")
  542.     elseif rRemoved[3] != sSelect[Index] && isSoup == 0
  543.         Clone.SetName(sSelect[Index].GetName() + " " + Clone.GetName() + " Stew")
  544.     endif
  545.  
  546.     if rRemoved[3] == sSelect[Index] && isSoup == 1
  547.         Clone.SetName(sSelect[Index].GetName() + " Soup")
  548.     elseif rRemoved[3] != sSelect[Index] && isSoup == 1
  549.         Clone.SetName(sSelect[Index].GetName() + " " + Clone.GetName() + " Stew")
  550.     endif
  551.  
  552. if IsSoup==0
  553.     PlayerRef.AddItem(Clone,1)
  554. else
  555.     Clone2.SetName(Clone.GetName())
  556.     PlayerRef.AddItem(Clone2,1)
  557. endif
  558.  
  559.     Clone.SetGoldValue(rRemoved[3].GetGoldValue() + sSelect[Index].GetGoldValue())
  560.     Clone2.SetGoldValue(rRemoved[3].GetGoldValue() + sSelect[Index].GetGoldValue())
  561. endif
  562.  
  563. Cleaner()                                   ; This function cleans our arrays.
  564.     rRemoved[0] = BlankForm
  565.     rRemoved[1] = BlankForm
  566.     rRemoved[2] = BlankForm
  567.             endif
  568.  
  569.     Player = ((Self as Form) as UILIB_1).ShowList("Keep cooking?", sCraft, 0, 128)
  570. endWhile
  571. endif
  572.  
  573.  
  574.  
  575. ActivatedOnce.SetValueInt(ActivatedOnce.GetValueInt() + 1)
  576.  
  577. EndEvent
  578.  
  579. Event OnListMenuClose(String asEventName, String asStringArg, Float afIndex, Form akSender)
  580.     UILIB_1.ListMenu_Release(PlayerRef)
  581.     Index = afIndex as int
  582. EndEvent
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×