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

◆ ApplyModificationsResults()

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

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

245 {
246 float all_ingredients_health = 0;//this is used later in results
247 float all_ingredients_health01 = 0;//combined damage % of ingredients
248 int value_delta;
249 for (int i = 0; i < MAX_NUMBER_OF_INGREDIENTS; i++)
250 {
251 ItemBase ingrd = ItemBase.Cast(sorted[i]);
252 all_ingredients_health += ingrd.GetHealth("", "");//accumulate health of all ingredients, used in results
253 all_ingredients_health01 += ingrd.GetHealth01("", "");
254 }
255 //------------------- results ----------------------
256 for (i = 0; i < m_NumberOfResults; i++)
257 {
258 ItemBase res = results.Get(i);
259 if (!res)
260 {
261 continue;
262 }
263
264 if (res.IsItemBase())
265 {
266 value_delta = m_ResultSetQuantity[i];
267
268 ItemBase resIb = ItemBase.Cast(res);
269
270 if (!resIb.IsMagazine())//is not a magazine
271 {
272 if (m_ResultSetFullQuantity[i] == 1)//<------m_ResultSetFullQuantity
273 {
274 resIb.SetQuantityMax();
275 }
276 else if (value_delta != -1)//<------m_ResultSetQuantity
277 {
278 resIb.SetQuantity(value_delta);
279 }
280 }
281 else//is magazine
282 {
283 Magazine mgzn = Magazine.Cast(resIb);
284 if (m_ResultSetFullQuantity[i] == 1)//<------m_ResultSetFullQuantity
285 {
286 mgzn.ServerSetAmmoMax();
287 }
288 else if (value_delta != -1)//<------m_ResultSetQuantity
289 {
290 mgzn.ServerSetAmmoCount(value_delta);
291 }
292 }
293 }
294 if (m_ResultSetHealth[i] != -1)//<------m_ResultSetHealth
295 {
296 value_delta = m_ResultSetHealth[i];
297 res.SetHealth("","",value_delta);
298 }
299 if (m_ResultInheritsHealth[i] != -1)//<------m_ResultInheritsHealth
300 {
301 if (m_ResultInheritsHealth[i] >= 0)
302 {
303 int ing_number = m_ResultInheritsHealth[i];
304 ItemBase ing = sorted[ing_number];
305
306 if (ing)
307 {
308 float ing_health01 = ing.GetHealth01("","");
309 res.SetHealth("", "", ing_health01 * res.GetMaxHealth("",""));
310 Debug.Log("Inheriting health from ingredient:"+m_ResultInheritsHealth[i].ToString(),"recipes");
311 }
312 }
313 else if (m_ResultInheritsHealth[i] == -2)
314 {
315 float average_health01 = all_ingredients_health01 / MAX_NUMBER_OF_INGREDIENTS;
316 res.SetHealth("", "", average_health01 * res.GetMaxHealth("",""));
317 }
318 }
319
320 if (m_ResultReplacesIngredient[i] != -1)//<------ResultReplacesIngredient
321 {
322 if (m_ResultReplacesIngredient[i] > -1)
323 {
324 int ing_num = m_ResultReplacesIngredient[i];
325 ItemBase ingr = sorted[ing_num];
326
327 if (ingr)
328 {
329 MiscGameplayFunctions.TransferItemProperties(ingr, res);
330 MiscGameplayFunctions.TransferInventory(ingr, res, player);
331 }
332 }
333 }
334 }
335 }
proto string ToString()
class GP5GasMask extends MaskBase ItemBase
const int MAX_NUMBER_OF_INGREDIENTS
Определения RecipeBase.c:1
void Debug()
Определения UniversalTemperatureSource.c:349
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
float m_ResultSetHealth[MAXIMUM_RESULTS]
Определения RecipeBase.c:41
float m_ResultSetQuantity[MAXIMUM_RESULTS]
Определения RecipeBase.c:40
bool m_ResultSetFullQuantity[MAXIMUM_RESULTS]
Определения RecipeBase.c:39
int m_ResultReplacesIngredient[MAXIMUM_RESULTS]
Определения RecipeBase.c:46
int m_ResultInheritsHealth[MAXIMUM_RESULTS]
Определения RecipeBase.c:44
int m_NumberOfResults
Определения RecipeBase.c:20

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

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