recipebase.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  1. const int MAX_NUMBER_OF_INGREDIENTS = 2;
  2. const int MAXIMUM_RESULTS = 10;
  3. const float DEFAULT_SPAWN_DISTANCE = 0.5;
  4. class RecipeBase
  5. {
  6. string m_ItemsToCreate[MAXIMUM_RESULTS];
  7. ref array<string> m_Ingredients[MAX_NUMBER_OF_INGREDIENTS];
  8. ref array<string> m_SoundCategories[MAX_NUMBER_OF_INGREDIENTS];
  9. ItemBase m_Items[MAX_NUMBER_OF_INGREDIENTS];
  10. ItemBase m_IngredientsSorted[MAX_NUMBER_OF_INGREDIENTS]; //if the recipe is valid, this array will contain all ingredients sorted against the recipe ingredients
  11. //ref array<string> m_ItemsToCreate;
  12. //string m_Result;
  13. ref array<ItemBase> m_IngredientsToBeDeleted = new array<ItemBase>;
  14. string m_Name;
  15. int m_ID;
  16. int m_NumberOfResults;
  17. int m_RecipeUID;
  18. float m_AnimationLength = 1;//animation length in relative time units
  19. float m_Specialty = 0;// value > 0 for roughness, value < 0 for precision
  20. bool m_IsInstaRecipe;//should this recipe be performed instantly without animation
  21. //bool m_IsActionType;//will this recipe be also a user action(only set true if you know what you are doing)
  22. bool m_AnywhereInInventory;//is this recipe valid even when neither of the items is in hands
  23. //array<string> ptr;
  24. float m_MinQuantityIngredient[MAX_NUMBER_OF_INGREDIENTS];
  25. float m_MaxQuantityIngredient[MAX_NUMBER_OF_INGREDIENTS];
  26. float m_MinDamageIngredient[MAX_NUMBER_OF_INGREDIENTS];
  27. float m_MaxDamageIngredient[MAX_NUMBER_OF_INGREDIENTS];
  28. bool m_IngredientUseSoftSkills[MAX_NUMBER_OF_INGREDIENTS];
  29. float m_IngredientAddHealth[MAX_NUMBER_OF_INGREDIENTS];
  30. float m_IngredientAddQuantity[MAX_NUMBER_OF_INGREDIENTS];
  31. float m_IngredientSetHealth[MAX_NUMBER_OF_INGREDIENTS];
  32. bool m_IngredientDestroy[MAX_NUMBER_OF_INGREDIENTS];
  33. bool m_ResultSetFullQuantity[MAXIMUM_RESULTS];
  34. float m_ResultSetQuantity[MAXIMUM_RESULTS];
  35. float m_ResultSetHealth[MAXIMUM_RESULTS];
  36. float m_ResultSpawnDistance[MAXIMUM_RESULTS];
  37. int m_ResultToInventory[MAXIMUM_RESULTS];
  38. int m_ResultInheritsHealth[MAXIMUM_RESULTS];
  39. int m_ResultInheritsColor[MAXIMUM_RESULTS];
  40. int m_ResultReplacesIngredient[MAXIMUM_RESULTS];
  41. bool m_ResultUseSoftSkills[MAXIMUM_RESULTS];
  42. void RecipeBase()
  43. {
  44. for(int i = 0; i < MAX_NUMBER_OF_INGREDIENTS; i++)
  45. {
  46. m_Ingredients[i] = new array<string>;
  47. m_SoundCategories[i] = new array<string>;
  48. m_IngredientsSorted[i] = NULL;
  49. }
  50. for(i = 0; i < MAXIMUM_RESULTS; i++)
  51. {
  52. m_ResultSpawnDistance[i] = DEFAULT_SPAWN_DISTANCE;
  53. }
  54. m_NumberOfResults = 0;
  55. //m_IsActionType = false;
  56. m_Name = "RecipeBase default name";
  57. m_RecipeUID = DayZPlayerConstants.CMD_ACTIONFB_CRAFTING;
  58. Init();
  59. }
  60. void Init();
  61. float GetLengthInSecs()
  62. {
  63. return m_AnimationLength * CRAFTING_TIME_UNIT_SIZE;
  64. }
  65. float GetSpecialty()
  66. {
  67. return m_Specialty;
  68. }
  69. bool IsRecipeAnywhere()
  70. {
  71. return m_AnywhereInInventory;
  72. }
  73. bool CheckIngredientMatch(ItemBase item1, ItemBase item2)
  74. {
  75. if( item1 == NULL || item2 == NULL ) return false;
  76. m_Items[0] = item1;
  77. m_Items[1] = item2;
  78. bool found = false;
  79. for(int i = 0; i < MAX_NUMBER_OF_INGREDIENTS; i++)//all ingredients
  80. {
  81. found = false;
  82. array<string> tempArray = m_Ingredients[i];
  83. for(int x = 0; x < tempArray.Count(); x++)//particular ingredient array
  84. {
  85. for(int z = 0; z < MAX_NUMBER_OF_INGREDIENTS; z++)
  86. {
  87. if( m_Items[z] != NULL )
  88. {
  89. ItemBase item = m_Items[z];
  90. if( tempArray.Get(x) == item.GetType() || GetGame().IsKindOf(item.GetType(),tempArray.Get(x)))
  91. {
  92. found = true;//we found a match
  93. //m_IngredientsSorted.Insert(item);
  94. m_IngredientsSorted[i] = item;
  95. m_Items[z] = NULL;
  96. }
  97. }
  98. if(found) break;//we found a match, no need to check the remaining ingredients
  99. }
  100. if(found) break;//we found a match, no need to check this m_Ingredient array
  101. }
  102. if(!found) return false;// no match within an m_Ingredient array, no reason to continue the search, recipe is invalid
  103. }
  104. if(found)
  105. {
  106. return true;
  107. }
  108. else
  109. {
  110. return false;
  111. }
  112. }
  113. void InsertIngredient(int index, string ingredient)
  114. {
  115. InsertIngredientEx(index, ingredient, "");
  116. }
  117. void InsertIngredientEx(int index, string ingredient, string soundCategory)
  118. {
  119. array<string> ptr = m_Ingredients[index];
  120. ptr.Insert(ingredient);
  121. m_SoundCategories[index].Insert(soundCategory);
  122. }
  123. void RemoveIngredient(int index, string ingredient)
  124. {
  125. array<string> ptr = m_Ingredients[index];
  126. for(int i = 0; i < ptr.Count(); i++)
  127. {
  128. if(ptr[i] == ingredient)
  129. {
  130. ptr.Remove(i);
  131. m_SoundCategories[index].Remove(i);
  132. return;
  133. }
  134. }
  135. }
  136. void AddResult(string item)
  137. {
  138. m_ItemsToCreate[m_NumberOfResults] = item;
  139. m_NumberOfResults++;
  140. }
  141. string GetName()
  142. {
  143. return m_Name;
  144. }
  145. bool IsInstaRecipe()
  146. {
  147. return m_IsInstaRecipe;
  148. }
  149. //spawns results in the world
  150. void SpawnItems(ItemBase ingredients[], PlayerBase player, array<ItemBase> spawned_objects/*out*/)
  151. {
  152. //vector item_position = player.GetPosition() + ( player.GetDirection() * 1 );
  153. //Debug.Log("SpawnItems called","recipes");
  154. spawned_objects.Clear();//just to make sure
  155. EntityAI object = NULL;
  156. for(int i = 0; i < m_NumberOfResults; i++)
  157. {
  158. string item_to_spawn = m_ItemsToCreate[i];
  159. if( m_ResultInheritsColor[i] != -1 )
  160. {
  161. ItemBase item = ingredients[m_ResultInheritsColor[i]];
  162. //string class_name = item.GetType();
  163. string color = item.ConfigGetString("color");
  164. string new_class_name = m_ItemsToCreate[i] + color;
  165. item_to_spawn = new_class_name;
  166. }
  167. if( m_ResultToInventory[i] == -1 )
  168. {
  169. Debug.Log(" = "+m_ResultToInventory[i].ToString(),"recipes");
  170. /*
  171. InventoryLocation inv_loc = new InventoryLocation;
  172. if (player.GetInventory().FindFirstFreeLocationForNewEntity(item_to_spawn, FindInventoryLocationType.ANY, inv_loc))
  173. {
  174. object = SpawnItemOnLocation(item_to_spawn, inv_loc, false);
  175. }
  176. */
  177. object = player.GetInventory().CreateInInventory(item_to_spawn);
  178. }
  179. else if (m_ResultToInventory[i] >= 0)
  180. {
  181. /*
  182. object = player.SpawnEntityOnGroundOnCursorDir(item_to_spawn, 0.5);
  183. ItemBase item_swap_with = ingredients[m_ResultToInventory[i]];
  184. player.SwapEntities(true, item_swap_with, EntityAI.Cast(object));
  185. */
  186. }
  187. else if ( m_ResultToInventory[i] == -2 )
  188. {
  189. object = player.GetInventory().CreateEntityInCargo(item_to_spawn);
  190. }
  191. if( !object )
  192. {
  193. //spawning in inventory failed, spawning on the ground instead.....
  194. object = player.SpawnEntityOnGroundOnCursorDir(item_to_spawn, m_ResultSpawnDistance[i]);
  195. if( !object)
  196. {
  197. Error("failed to spawn entity "+item_to_spawn+" , make sure the classname exists and item can be spawned");
  198. }
  199. }
  200. spawned_objects.Insert(ItemBase.Cast(object));
  201. //Debug.Log("spawning item "+item_to_spawn,"recipes");
  202. object = null;
  203. }
  204. }
  205. //applies final modifications to results
  206. void ApplyModificationsResults(ItemBase sorted[], array<ItemBase> results, ItemBase result, PlayerBase player)
  207. {
  208. float all_ingredients_health = 0;//this is used later in results
  209. float all_ingredients_health01 = 0;//combined damage % of ingredients
  210. int value_delta;
  211. for(int i = 0; i < MAX_NUMBER_OF_INGREDIENTS; i++)
  212. {
  213. ItemBase ingrd = ItemBase.Cast(sorted[i]);
  214. all_ingredients_health += ingrd.GetHealth("", "");//accumulate health of all ingredients, used in results
  215. all_ingredients_health01 += ingrd.GetHealth01("", "");
  216. }
  217. //------------------- results ----------------------
  218. for(i = 0; i < m_NumberOfResults; i++)
  219. {
  220. ItemBase res = results.Get(i);
  221. if(!res)
  222. {
  223. continue;
  224. }
  225. if( res.IsItemBase() )
  226. {
  227. value_delta = m_ResultSetQuantity[i];
  228. ItemBase resIb = ItemBase.Cast(res);
  229. if( !resIb.IsMagazine() )//is not a magazine
  230. {
  231. if( m_ResultSetFullQuantity[i] == 1 )//<------m_ResultSetFullQuantity
  232. {
  233. resIb.SetQuantityMax();
  234. }
  235. else if( value_delta != -1 )//<------m_ResultSetQuantity
  236. {
  237. resIb.SetQuantity( value_delta );
  238. }
  239. }
  240. else//is magazine
  241. {
  242. Magazine mgzn = Magazine.Cast(resIb);
  243. if( m_ResultSetFullQuantity[i] == 1 )//<------m_ResultSetFullQuantity
  244. {
  245. mgzn.ServerSetAmmoMax();
  246. }
  247. else if( value_delta != -1 )//<------m_ResultSetQuantity
  248. {
  249. mgzn.ServerSetAmmoCount( value_delta );
  250. }
  251. }
  252. }
  253. if( m_ResultSetHealth[i] != -1 )//<------m_ResultSetHealth
  254. {
  255. value_delta = m_ResultSetHealth[i];
  256. res.SetHealth("","",value_delta);
  257. }
  258. if( m_ResultInheritsHealth[i] != -1 )//<------m_ResultInheritsHealth
  259. {
  260. if( m_ResultInheritsHealth[i] >= 0 )
  261. {
  262. int ing_number = m_ResultInheritsHealth[i];
  263. ItemBase ing = sorted[ing_number];
  264. if( ing )
  265. {
  266. //float ing_health = ing.GetHealth("","");
  267. float ing_health01 = ing.GetHealth01("","");
  268. res.SetHealth("", "", ing_health01 * res.GetMaxHealth("",""));
  269. Debug.Log("Inheriting health from ingredient:"+m_ResultInheritsHealth[i].ToString(),"recipes");
  270. }
  271. }
  272. else if( m_ResultInheritsHealth[i] == -2 )
  273. {
  274. //float average_health = all_ingredients_health / MAX_NUMBER_OF_INGREDIENTS;
  275. float average_health01 = all_ingredients_health01 / MAX_NUMBER_OF_INGREDIENTS;
  276. res.SetHealth("", "", average_health01 * res.GetMaxHealth("",""));
  277. }
  278. }
  279. if( m_ResultReplacesIngredient[i] != -1 )//<------ResultReplacesIngredient
  280. {
  281. if( m_ResultReplacesIngredient[i] > -1 )
  282. {
  283. int ing_num = m_ResultReplacesIngredient[i];
  284. ItemBase ingr = sorted[ing_num];
  285. if( ingr )
  286. {
  287. MiscGameplayFunctions.TransferItemProperties(ingr, res);
  288. MiscGameplayFunctions.TransferInventory(ingr, res, player);
  289. }
  290. }
  291. }
  292. }
  293. }
  294. void DeleleIngredientsPass()
  295. {
  296. for(int i = 0; i < m_IngredientsToBeDeleted.Count(); i++)
  297. {
  298. ItemBase ingredient = m_IngredientsToBeDeleted.Get(i);
  299. ingredient.Delete();
  300. }
  301. m_IngredientsToBeDeleted.Clear();
  302. }
  303. //applies final modifications to ingredients
  304. void ApplyModificationsIngredients(ItemBase sorted[], PlayerBase player)
  305. {
  306. //---------------------- ingredients ----------------------
  307. for(int i = 0; i < MAX_NUMBER_OF_INGREDIENTS; i++)
  308. {
  309. ItemBase ingredient = sorted[i];
  310. if( m_IngredientDestroy[i] == 1 )//<------m_IngredientDestroy
  311. {
  312. if( ingredient ) m_IngredientsToBeDeleted.Insert(ingredient);
  313. //ingredient.Delete();
  314. //sorted[i] = NULL;
  315. }
  316. else
  317. {
  318. if( m_IngredientAddHealth[i] != 0 )//<------m_IngredientAddHealth
  319. {
  320. float health_delta = m_IngredientAddHealth[i];
  321. ingredient.AddHealth("","",health_delta);
  322. }
  323. else if(m_IngredientSetHealth[i] != -1)//<------m_IngredientSetHealth
  324. {
  325. float new_health = m_IngredientSetHealth[i];
  326. ingredient.SetHealth("","",new_health);
  327. }
  328. if( m_IngredientAddQuantity[i] != 0 )//<------m_IngredientAddQuantity
  329. {
  330. float quantity_delta = m_IngredientAddQuantity[i];
  331. if( !ingredient.IsMagazine() )
  332. {
  333. ItemBase obj = ingredient;
  334. bool isDestroyed = obj.AddQuantity(quantity_delta, true);
  335. if( isDestroyed )
  336. {
  337. //if (obj) m_IngredientsToBeDeleted.Insert(obj);
  338. continue;
  339. }
  340. }
  341. else
  342. {
  343. Magazine mag = Magazine.Cast(ingredient);
  344. int newQuantity = mag.GetAmmoCount() + quantity_delta;
  345. if( newQuantity <= 0 )
  346. {
  347. if(mag) m_IngredientsToBeDeleted.Insert(mag);
  348. continue;
  349. }
  350. else
  351. {
  352. mag.ServerSetAmmoCount( newQuantity );
  353. }
  354. }
  355. }
  356. }
  357. }
  358. }
  359. //checks the recipe conditions
  360. bool CheckConditions(ItemBase sorted[])
  361. {
  362. for(int i = 0; i < MAX_NUMBER_OF_INGREDIENTS; i++)
  363. {
  364. ItemBase ingredient = sorted[i];
  365. if( !ingredient.IsMagazine() )
  366. {
  367. if( ingredient.GetQuantityMax() !=0 && m_MinQuantityIngredient[i] >= 0 && ingredient.GetQuantity() < m_MinQuantityIngredient[i] )
  368. {
  369. //Debug.Log("Recipe condition check failing1: m_MinQuantityIngredient","recipes");
  370. return false;
  371. }
  372. if( m_MaxQuantityIngredient[i] >= 0 && ingredient.GetQuantity() > m_MaxQuantityIngredient[i] )
  373. {
  374. //Debug.Log("Recipe condition check failing1: m_MaxQuantityIngredient","recipes");
  375. return false;
  376. }
  377. }
  378. else
  379. {
  380. Magazine mag1 = Magazine.Cast(ingredient);
  381. if( m_MinQuantityIngredient[i] >= 0 && mag1.GetAmmoCount() < m_MinQuantityIngredient[i] )
  382. {
  383. //Debug.Log("Recipe condition check failing1: m_MinQuantityIngredient[0]","recipes");
  384. return false;
  385. }
  386. if( m_MaxQuantityIngredient[i] >= 0 && mag1.GetAmmoCount() > m_MaxQuantityIngredient[i] )
  387. {
  388. //Debug.Log("Recipe condition check failing1: m_MaxQuantityIngredient[0]","recipes");
  389. return false;
  390. }
  391. }
  392. int dmg3 = ingredient.GetHealthLevel();
  393. if( m_MinDamageIngredient[i] >= 0 && ingredient.GetHealthLevel() < m_MinDamageIngredient[i] )
  394. {
  395. int dmg = ingredient.GetHealthLevel();
  396. //Debug.Log("Recipe condition check failing1: m_MinDamageIngredient[0]","recipes");
  397. return false;
  398. }
  399. if( m_MaxDamageIngredient[i] >= 0 && ingredient.GetHealthLevel() > m_MaxDamageIngredient[i] )
  400. {
  401. int dmg2 = ingredient.GetHealthLevel();
  402. //Debug.Log("Recipe condition check failing1: m_MaxDamageIngredient[0]","recipes");
  403. return false;
  404. }
  405. }
  406. return true;
  407. }
  408. //checks overall validity of this recipe
  409. bool CheckRecipe(ItemBase item1, ItemBase item2, PlayerBase player)
  410. {
  411. if( item1 == NULL || item2 == NULL )
  412. {
  413. Error("recipe invalid, at least one of the ingredients is NULL");
  414. return false;
  415. }
  416. ItemBase item_in_hand = player.GetItemInHands();
  417. if( !IsRecipeAnywhere() && (item1 != item_in_hand && item2 != item_in_hand) )
  418. {
  419. return false;
  420. }
  421. m_IngredientsSorted[0] = item1;
  422. m_IngredientsSorted[1] = item2;
  423. if( CanDo( m_IngredientsSorted, player ) && CheckConditions( m_IngredientsSorted ) )
  424. {
  425. return true;
  426. }
  427. return false;
  428. }
  429. void OnSelectedRecipe(ItemBase item1, ItemBase item2, PlayerBase player)
  430. {
  431. if( item1 == NULL || item2 == NULL )
  432. {
  433. Error("CheckRecipe: recipe invalid, at least one of the ingredients is NULL");
  434. //Debug.Log("recipe invalid, at least one of the ingredients is NULL","recipes");
  435. return;
  436. }
  437. OnSelected(item1,item2,player);
  438. }
  439. void OnSelected(ItemBase item1, ItemBase item2, PlayerBase player)
  440. {
  441. }
  442. //performs this recipe
  443. void PerformRecipe(ItemBase item1, ItemBase item2, PlayerBase player)
  444. {
  445. if( item1 == NULL || item2 == NULL )
  446. {
  447. Error("PerformRecipe: recipe invalid, at least one of the ingredients is NULL");
  448. Debug.Log("PerformRecipe: at least one of the ingredients is NULL","recipes");
  449. }
  450. /*
  451. m_IngredientsSorted[0] = item1;
  452. m_IngredientsSorted[1] = item2;
  453. */
  454. /*
  455. Debug.Log("PerformRecipe Ingredient 1: "+ToString(item1.Ptr().GetType()),"recipes");
  456. Debug.Log("PerformRecipe Ingredient 2: "+ToString(item2.Ptr().GetType()),"recipes");
  457. */
  458. if( CheckRecipe(item1,item2,player) )
  459. {
  460. array<ItemBase> spawned_objects = new array<ItemBase>;
  461. SpawnItems(m_IngredientsSorted, player,spawned_objects );
  462. ApplyModificationsResults(m_IngredientsSorted, spawned_objects, NULL, player);
  463. ApplyModificationsIngredients(m_IngredientsSorted, player);
  464. Do( m_IngredientsSorted, player, spawned_objects, m_Specialty );
  465. DeleleIngredientsPass();
  466. }
  467. else
  468. {
  469. Debug.Log("CheckRecipe failed on server","recipes");
  470. }
  471. }
  472. void ApplySoftSkillsSpecialty(PlayerBase player)
  473. {
  474. }
  475. bool CanDo(ItemBase ingredients[], PlayerBase player)
  476. {
  477. //Debug.Log("Called Can Do on a recipe id:" + m_ID.ToString(),"recipes");
  478. for ( int i = 0; i < MAX_NUMBER_OF_INGREDIENTS; i++)
  479. {
  480. if (ingredients[i].GetInventory() && ingredients[i].GetInventory().AttachmentCount() > 0)
  481. return false;
  482. }
  483. return true;
  484. }
  485. void Do(ItemBase ingredients[], PlayerBase player, array<ItemBase> results, float specialty_weight)
  486. {
  487. //Debug.Log("Called Do on a recipe id:" + m_ID.ToString(),"recipes");
  488. }
  489. int GetID()
  490. {
  491. return m_ID;
  492. }
  493. void SetID(int id)
  494. {
  495. m_ID = id;
  496. }
  497. void GetAllItems(array<string> items)
  498. {
  499. for(int i = 0; i < MAX_NUMBER_OF_INGREDIENTS; i++)
  500. {
  501. array<string> ptr = m_Ingredients[i];
  502. for(int x = 0; x < ptr.Count(); x++)
  503. {
  504. items.Insert( ptr.Get(x) );
  505. }
  506. }
  507. }
  508. string GetSoundCategory(int ingredientIndex, ItemBase item)
  509. {
  510. string itemType = item.GetType();
  511. array<string> ptr = m_Ingredients[ingredientIndex];
  512. for (int x = 0; x < ptr.Count(); x++)
  513. {
  514. if (GetGame().IsKindOf(itemType, ptr.Get(x)))
  515. {
  516. return m_SoundCategories[ingredientIndex].Get(x);
  517. }
  518. }
  519. return "";
  520. }
  521. bool IsItemInRecipe(string item)
  522. {
  523. for(int i = 0; i < MAX_NUMBER_OF_INGREDIENTS; i++)
  524. {
  525. array<string> ptr = m_Ingredients[i];
  526. for(int x = 0; x < ptr.Count(); x++)
  527. {
  528. if( ptr.Get(x) == item ) return true;
  529. }
  530. }
  531. return false;
  532. }
  533. //! returns a mask which marks ingredient positions for a given item in this recipe(for example mask of value 3 [....000011] means this item is both ingredient 1 and 2 in this recipe[from right to left])
  534. int GetIngredientMaskForItem(string item)
  535. {
  536. int mask = 0;
  537. for(int i = 0; i < MAX_NUMBER_OF_INGREDIENTS; i++)
  538. {
  539. array<string> ptr = m_Ingredients[i];
  540. for(int x = 0; x < ptr.Count(); x++)
  541. {
  542. if( ptr.Get(x) == item )
  543. {
  544. mask = ((int)Math.Pow(2, i)) | mask;
  545. }
  546. }
  547. }
  548. return mask;
  549. }
  550. int GetAnimationCommandUID()
  551. {
  552. return m_RecipeUID;
  553. }
  554. }