DayZ 1.28
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ ApplyModificationsResults()

void ApplyModificationsResults ( ItemBase sorted[],
array< ItemBase > results,
ItemBase result,
PlayerBase player )
protected

См. определение в файле RecipeBase.c строка 268

269 {
270 float all_ingredients_health = 0;//this is used later in results
271 float all_ingredients_health01 = 0;//combined damage % of ingredients
272 int value_delta;
273 for (int i = 0; i < MAX_NUMBER_OF_INGREDIENTS; i++)
274 {
275 ItemBase ingrd = ItemBase.Cast(sorted[i]);
276 all_ingredients_health += ingrd.GetHealth("", "");//accumulate health of all ingredients, used in results
277 all_ingredients_health01 += ingrd.GetHealth01("", "");
278 }
279 //------------------- results ----------------------
280 for (i = 0; i < m_NumberOfResults; i++)
281 {
282 ItemBase res = results.Get(i);
283 if (!res)
284 {
285 continue;
286 }
287
288 if (res.IsItemBase())
289 {
290 value_delta = m_ResultSetQuantity[i];
291
292 ItemBase resIb = ItemBase.Cast(res);
293
294 if (!resIb.IsMagazine())//is not a magazine
295 {
296 if (m_ResultSetFullQuantity[i] == 1)//<------m_ResultSetFullQuantity
297 {
298 resIb.SetQuantityMax();
299 }
300 else if (value_delta != -1)//<------m_ResultSetQuantity
301 {
302 resIb.SetQuantity(value_delta);
303 }
304 }
305 else//is magazine
306 {
307 Magazine mgzn = Magazine.Cast(resIb);
308 if (m_ResultSetFullQuantity[i] == 1)//<------m_ResultSetFullQuantity
309 {
310 mgzn.ServerSetAmmoMax();
311 }
312 else if (value_delta != -1)//<------m_ResultSetQuantity
313 {
314 mgzn.ServerSetAmmoCount(value_delta);
315 }
316 }
317 }
318 if (m_ResultSetHealth[i] != -1)//<------m_ResultSetHealth
319 {
320 value_delta = m_ResultSetHealth[i];
321 res.SetHealth("","",value_delta);
322 }
323 if (m_ResultInheritsHealth[i] != -1)//<------m_ResultInheritsHealth
324 {
325 if (m_ResultInheritsHealth[i] >= 0)
326 {
327 int ing_number = m_ResultInheritsHealth[i];
328 ItemBase ing = sorted[ing_number];
329
330 if (ing)
331 {
332 float ing_health01 = ing.GetHealth01("","");
333 res.SetHealth("", "", ing_health01 * res.GetMaxHealth("",""));
334 Debug.Log("Inheriting health from ingredient:"+m_ResultInheritsHealth[i].ToString(),"recipes");
335 }
336 }
337 else if (m_ResultInheritsHealth[i] == -2)
338 {
339 float average_health01 = all_ingredients_health01 / MAX_NUMBER_OF_INGREDIENTS;
340 res.SetHealth("", "", average_health01 * res.GetMaxHealth("",""));
341 }
342 }
343
344 if (m_ResultReplacesIngredient[i] != -1)//<------ResultReplacesIngredient
345 {
346 if (m_ResultReplacesIngredient[i] > -1)
347 {
348 int ing_num = m_ResultReplacesIngredient[i];
349 ItemBase ingr = sorted[ing_num];
350
351 if (ingr)
352 {
353 MiscGameplayFunctions.TransferItemProperties(ingr, res);
354 MiscGameplayFunctions.TransferInventory(ingr, res, player);
355 }
356 }
357 }
358 }
359 }
proto string ToString()
int m_ResultReplacesIngredient[MAXIMUM_RESULTS]
Определения RecipeBase.c:62
int m_ResultInheritsHealth[MAXIMUM_RESULTS]
Определения RecipeBase.c:60
float m_ResultSetQuantity[MAXIMUM_RESULTS]
Определения RecipeBase.c:56
bool m_ResultSetFullQuantity[MAXIMUM_RESULTS]
Определения RecipeBase.c:55
float m_ResultSetHealth[MAXIMUM_RESULTS]
Определения RecipeBase.c:57
int m_NumberOfResults
Определения RecipeBase.c:36
const int MAX_NUMBER_OF_INGREDIENTS
Определения RecipeBase.c:1
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.
Определения 3_Game/tools/Debug.c:122
Определения 3_Game/tools/Debug.c:2
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Определения PileOfWoodenPlanks.c:88

Перекрестные ссылки Debug::Log(), m_NumberOfResults, m_ResultInheritsHealth, m_ResultReplacesIngredient, m_ResultSetFullQuantity, m_ResultSetHealth, m_ResultSetQuantity, MAX_NUMBER_OF_INGREDIENTS, ItemBase::SetQuantity() и ToString().

Используется в PerformRecipe().