83 m_Name =
"RecipeBase default name";
117 if (item1 == NULL || item2 == NULL)
return false;
127 for (
int x = 0;
x < tempArray.Count();
x++)
134 if (tempArray.Get(
x) == item.GetType() ||
g_Game.IsKindOf(item.GetType(),tempArray.Get(
x)))
146 if (!found)
return false;
167 ptr.Insert(ingredient);
174 for(animationIndex = 0; animationIndex <
m_AnimationInfos.Count(); animationIndex++)
186 for (
int i = 0; i < ptr.Count(); i++)
188 if (ptr[i] == ingredient)
217 spawned_objects.Clear();
227 string color = item.ConfigGetString(
"color");
229 item_to_spawn = new_class_name;
242 object = player.GetInventory().CreateInInventory(item_to_spawn);
260 Error(
"failed to spawn entity "+item_to_spawn+
" , make sure the classname exists and item can be spawned");
262 spawned_objects.Insert(
ItemBase.Cast(
object));
270 float all_ingredients_health = 0;
271 float all_ingredients_health01 = 0;
276 all_ingredients_health += ingrd.GetHealth(
"",
"");
277 all_ingredients_health01 += ingrd.GetHealth01(
"",
"");
288 if (res.IsItemBase())
294 if (!resIb.IsMagazine())
298 resIb.SetQuantityMax();
300 else if (value_delta != -1)
307 Magazine mgzn = Magazine.Cast(resIb);
310 mgzn.ServerSetAmmoMax();
312 else if (value_delta != -1)
314 mgzn.ServerSetAmmoCount(value_delta);
321 res.SetHealth(
"",
"",value_delta);
332 float ing_health01 = ing.GetHealth01(
"",
"");
333 res.SetHealth(
"",
"", ing_health01 * res.GetMaxHealth(
"",
""));
340 res.SetHealth(
"",
"", average_health01 * res.GetMaxHealth(
"",
""));
353 MiscGameplayFunctions.TransferItemProperties(ingr, res,
true,
true,
false,
false);
354 MiscGameplayFunctions.TransferInventory(ingr, res, player);
389 ingredient.AddHealth(
"",
"",health_delta);
394 ingredient.SetHealth(
"",
"",new_health);
400 if (!ingredient.IsMagazine())
403 bool isDestroyed = obj.AddQuantity(quantity_delta,
true);
411 Magazine mag = Magazine.Cast(ingredient);
412 int newQuantity = mag.GetAmmoCount() + quantity_delta;
413 if (newQuantity <= 0)
420 mag.ServerSetAmmoCount(newQuantity);
434 if (!ingredient.IsMagazine())
449 Magazine mag1 = Magazine.Cast(ingredient);
461 int dmg3 = ingredient.GetHealthLevel();
464 int dmg = ingredient.GetHealthLevel();
470 int dmg2 = ingredient.GetHealthLevel();
481 if (item1 == NULL || item2 == NULL)
483 Error(
"recipe invalid, at least one of the ingredients is NULL");
487 ItemBase item_in_hand = player.GetItemInHands();
489 if (!
IsRecipeAnywhere() && (item1 != item_in_hand && item2 != item_in_hand))
506 if (item1 == NULL || item2 == NULL)
508 Error(
"CheckRecipe: recipe invalid, at least one of the ingredients is NULL");
523 if (item1 == NULL || item2 == NULL)
525 Error(
"PerformRecipe: recipe invalid, at least one of the ingredients is NULL");
526 Debug.
Log(
"PerformRecipe: at least one of the ingredients is NULL",
"recipes");
543 Debug.
Log(
"CheckRecipe failed on server",
"recipes");
556 if (ingredients[i].GetInventory() && ingredients[i].GetInventory().AttachmentCount() > 0)
585 for (
int x = 0;
x < ptr.Count();
x++)
587 items.Insert(ptr.Get(
x));
594 string itemType = item.GetType();
597 for (
int x = 0;
x < ptr.Count();
x++)
599 if (
g_Game.IsKindOf(itemType, ptr.Get(
x)))
613 for (
int x = 0;
x < ptr.Count();
x++)
615 if (ptr.Get(
x) == item)
return true;
630 for (
int x = 0;
x < ptr.Count();
x++)
632 if (ptr.Get(
x) == item)
667 return recipeAnimationInfo;
int GetID()
Get the ID registered in SEffectManager.
void SetID(int id)
Set the ID registered in SEffectManager.
bool CheckRecipe(ItemBase item1, ItemBase item2, PlayerBase player)
int m_ResultReplacesIngredient[MAXIMUM_RESULTS]
int m_ResultToInventory[MAXIMUM_RESULTS]
void RemoveIngredient(int index, string ingredient)
void DeleleIngredientsPass()
bool m_IngredientUseSoftSkills[MAX_NUMBER_OF_INGREDIENTS]
int GetIngredientMaskForItem(string item)
returns a mask which marks ingredient positions for a given item in this recipe(for example mask of v...
RecipeAnimationInfo GetRecipeAnimationInfo(PlayerBase player, ItemBase mainItem, ItemBase target)
string GetSoundCategory(int ingredientIndex, ItemBase item)
float m_IngredientAddHealth[MAX_NUMBER_OF_INGREDIENTS]
class RecipeAnimationInfo BASE_CRAFT_ANIMATION_ID
float m_IngredientSetHealth[MAX_NUMBER_OF_INGREDIENTS]
const float DEFAULT_SPAWN_DISTANCE
bool CheckIngredientMatch(ItemBase item1, ItemBase item2)
void OnSelectedRecipe(ItemBase item1, ItemBase item2, PlayerBase player)
ref array< string > m_SoundCategories[MAX_NUMBER_OF_INGREDIENTS]
int m_ResultInheritsHealth[MAXIMUM_RESULTS]
string m_ItemsToCreate[MAXIMUM_RESULTS]
void AddResult(string item)
void InsertIngredientEx(int index, string ingredient, string soundCategory, DayZPlayerConstants uid=BASE_CRAFT_ANIMATION_ID, bool showItem=false)
int m_ResultInheritsColor[MAXIMUM_RESULTS]
void ApplySoftSkillsSpecialty(PlayerBase player)
bool CheckConditions(ItemBase sorted[])
float m_MinDamageIngredient[MAX_NUMBER_OF_INGREDIENTS]
float m_MaxQuantityIngredient[MAX_NUMBER_OF_INGREDIENTS]
void ApplyModificationsResults(ItemBase sorted[], array< ItemBase > results, ItemBase result, PlayerBase player)
bool m_AnywhereInInventory
float m_ResultSetQuantity[MAXIMUM_RESULTS]
ItemBase m_Items[MAX_NUMBER_OF_INGREDIENTS]
void ApplyModificationsIngredients(ItemBase sorted[], PlayerBase player)
bool m_ResultSetFullQuantity[MAXIMUM_RESULTS]
bool IsItemInRecipe(string item)
void InsertIngredient(int index, string ingredient, DayZPlayerConstants uid=BASE_CRAFT_ANIMATION_ID, bool showItem=false)
float m_ResultSetHealth[MAXIMUM_RESULTS]
ref array< string > m_Ingredients[MAX_NUMBER_OF_INGREDIENTS]
void GetAllItems(array< string > items)
int GetAnimationCommandUID()
void PerformRecipe(ItemBase item1, ItemBase item2, PlayerBase player)
float m_MaxDamageIngredient[MAX_NUMBER_OF_INGREDIENTS]
float m_ResultSpawnDistance[MAXIMUM_RESULTS]
ref array< ItemBase > m_IngredientsToBeDeleted
ItemBase m_IngredientsSorted[MAX_NUMBER_OF_INGREDIENTS]
const int MAXIMUM_RESULTS
float m_IngredientAddQuantity[MAX_NUMBER_OF_INGREDIENTS]
float m_MinQuantityIngredient[MAX_NUMBER_OF_INGREDIENTS]
bool m_IngredientDestroy[MAX_NUMBER_OF_INGREDIENTS]
bool m_ResultUseSoftSkills[MAXIMUM_RESULTS]
const int MAX_NUMBER_OF_INGREDIENTS
ref array< ref RecipeAnimationInfo > m_AnimationInfos
ScriptConsoleEnfScriptTab ScriptConsoleTabBase OnSelected()
void SetAnimation(ParamsReadContext ctx)
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
void RecipeAnimationInfo(string ingredient, int animationID, bool itemVisible)
override bool CanDo(ItemBase ingredients[], PlayerBase player)
override void Do(ItemBase ingredients[], PlayerBase player, array< ItemBase > results, float specialty_weight)
override bool IsRepeatable()
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DayZPlayerConstants
defined in C++
void Error(string err)
Messagebox with error message.
const float CRAFTING_TIME_UNIT_SIZE
static proto float Pow(float v, float power)
Return power of v ^ power.