DayZ 1.24
Loading...
Searching...
No Matches
PPERequesterBank.c File Reference

Go to the source code of this file.

Classes

class  Managed
 TODO doc. More...
 

Functions

class PPERequesterBank extends Managed PPERequesterRegistrations ()
 Mod this, if you wish to register custom requesters.
 
static void Init ()
 
static void Cleanup ()
 
static PPERequesterBase GetRequester (typename type)
 Returns an instance (singleton) of a requester based on typename.
 
static PPERequesterBase GetRequester (int index)
 Returns an instance (singleton) of a requester based on index.
 
static int GetRequesterID (typename type)
 Returns an ID of a requester type.
 
static GetRequesterTypename (int index)
 Returns a typename from a requester ID.
 
static int RegisterRequester (typename type)
 Registers new requester type.
 
static bool VerifyRequester (PPERequesterBase req)
 Verifies the instance.
 

Variables

static ref map< int, ref PPERequesterBasem_Instances
 
static bool m_Initialized = false
 
static int m_lastID = -1
 
static const int INVALID = -1
 
static const int REQ_INVENTORYBLUR = RegisterRequester(PPERequester_InventoryBlur)
 
static const int REQ_CONTROLLERDISCONNECT = RegisterRequester(PPERequester_ControllerDisconnectBlur)
 
static const int REQ_GLASSESSPORTBLACK = RegisterRequester(PPERequester_GlassesSportBlack)
 
static const int REQ_GLASSESSPORTBLUE = RegisterRequester(PPERequester_GlassesSportBlue)
 
static const int REQ_GLASSESSPORTGREEN = RegisterRequester(PPERequester_GlassesSportGreen)
 
static const int REQ_GLASSESSPORTORANGE = RegisterRequester(PPERequester_GlassesSportOrange)
 
static const int REQ_GLASSESAVIATOR = RegisterRequester(PPERequester_GlassesAviator)
 
static const int REQ_GLASSESDESIGNER = RegisterRequester(PPERequester_GlassesDesignerBlack)
 
static const int REQ_GLASSESTACTICAL = RegisterRequester(PPERequester_TacticalGoggles)
 
static const int REQ_MOTOHELMETBLACK = RegisterRequester(PPERequester_MotoHelmetBlack)
 
static const int REQ_GLASSESWELDING = RegisterRequester(PPERequester_WeldingMask)
 
static const int REQ_CAMERANV = RegisterRequester(PPERequester_CameraNV)
 
static const int REQ_CAMERAADS = RegisterRequester(PPERequester_CameraADS)
 
static const int REQ_BLOODLOSS = RegisterRequester(PPERequester_BloodLoss)
 
static const int REQ_DEATHEFFECTS = RegisterRequester(PPERequester_DeathDarkening)
 
static const int REQ_UNCONEFFECTS = RegisterRequester(PPERequester_UnconEffects)
 
static const int REQ_TUNELVISSION = RegisterRequester(PPERequester_TunnelVisionEffects)
 
static const int REQ_BURLAPSACK = RegisterRequester(PPERequester_BurlapSackEffects)
 
static const int REQ_INTROCHROMABB = RegisterRequester(PPERequester_IntroChromAbb)
 
static const int REQ_FEVEREFFECTS = RegisterRequester(PPERequester_FeverEffects)
 
static const int REQ_FLASHBANGEFFECTS = RegisterRequester(PPERequester_FlashbangEffects)
 
static const int REQ_SHOCKHITEFFECTS = RegisterRequester(PPERequester_ShockHitReaction)
 
static const int REQ_HEALTHHITEFFECTS = RegisterRequester(PPERequester_HealthHitReaction)
 
static const int REQ_MENUEFFECTS = RegisterRequester(PPERequester_MenuEffects)
 
static const int REQ_CONTROLLERBLUR = RegisterRequester(PPERequester_ControlsBlur)
 
static const int REQ_SERVERBROWSEREFFECTS = RegisterRequester(PPERequester_ServerBrowserBlur)
 
static const int REQ_TUTORIALEFFECTS = RegisterRequester(PPERequester_TutorialMenu)
 
static const int REQ_CONTAMINATEDAREA = RegisterRequester(PPERequester_ContaminatedAreaTint)
 
static const int REQ_SPOOKYAREA = RegisterRequester(PPERequester_SpookyAreaTint)
 
static const int REQ_PAINBLUR = RegisterRequester(PPERequester_PainBlur)
 
static const int REQ_UNDERGROUND = RegisterRequester(PPERUndergroundAcco)
 
static const int REQ_DROWNING = RegisterRequester(PPERequester_Drowning)
 
static ref PPERequesterRegistrations m_Registrations
 

Function Documentation

◆ Cleanup()

static void PPERequesterRegistrations::Cleanup ( )
staticprivate

Definition at line 263 of file PPERequesterBank.c.

◆ GetRequester() [1/2]

static PPERequesterBase PPERequesterRegistrations::GetRequester ( int index)
staticprivate

Returns an instance (singleton) of a requester based on index.

Parameters
indexint Index of the registered requester.
Returns
PPERequesterBase Requester singleton.
Note
Returns only already registered instances, does not register anything.

Definition at line 309 of file PPERequesterBank.c.

313{
315 private static bool m_Initialized = false;
316
317 static int m_lastID = -1;
318
319 static const int INVALID = -1;
352
353 private static ref PPERequesterRegistrations m_Registrations; //more registrations to be placed here
354
355 static void Init()
356 {
358
359 if (!m_Instances)
361
362 m_Initialized = true;
363 }
364
365 static void Cleanup()
366 {
367 if (m_Initialized)
368 {
369 delete m_Registrations;
370 m_Instances.Clear();
371 }
372 }
373
380 static PPERequesterBase GetRequester(typename type)
381 {
382 if (!type)
383 {
384 Error("Requested type is NULL!");
385 return null;
386 }
387
390 for (int i = 0; i < m_Instances.Count(); i++)
391 {
392 temp = m_Instances.GetElement(i);
393 if (temp.Type() == type)
394 {
396 break;
397 }
398 }
399
400 if (!ret)
401 Debug.Log("'" + type.ToString() + "' not found in bank! Register first in 'RegisterRequester' method.");
402 return ret;
403 }
404
412 {
414
415 if (!ret)
416 Debug.Log("Requester idx '" + index + "' not found in bank! Register first in 'RegisterRequester' method.");
417 return ret;
418 }
419
426 static int GetRequesterID(typename type)
427 {
428 int ret = -1;
430
431 for (int i = 0; i < m_Instances.Count(); i++)
432 {
433 temp = m_Instances.GetElement(i);
434 if (temp.Type() == type)
435 ret = m_Instances.GetKey(i);
436 }
437
438 if (ret == -1)
439 Debug.Log("Requester instance of the '" + type.ToString() + "' type not found in bank! Register first in 'RegisterRequester' method.");
440 return ret;
441 }
442
448 static typename GetRequesterTypename(int index)
449 {
450 typename ret;
452 if (!temp)
453 Debug.Log("No requester exists under idx '" + index + "' in bank! Register first in 'RegisterRequester' method.");
454 else
455 ret = temp.Type();
456
457 return ret;
458 }
459
464 static int RegisterRequester(typename type)
465 {
466 if (!m_Instances)
468
469 if (GetRequester(type) != null)
470 {
471 //Error("Trying to register an already existing requester type: " + type);
472 Debug.Log("Trying to register an already existing requester type: " + type);
473 return -1;
474 }
475
476 m_lastID++;
477
479 req = PPERequesterBase.Cast(type.Spawn());
480 req.SetRequesterIDX(m_lastID);
482
483 return m_lastID;
484 }
485
488 {
489 if (!m_Initialized) //initial registrations are fair game
490 return true;
491
493 for (int i = 0; i < m_Instances.Count(); i++)
494 {
495 temp = m_Instances.GetElement(i);
496 if (temp == req)
497 return true;
498 }
499
500 //Error("Requester instance " + req + " not valid! Please use registered instances from PPERequesterBank.");
501 Debug.Log("Requester instance '" + req + "' not valid! Please use registered instances from PPERequesterBank.");
502 return false;
503 }
504
505 /*static void DumpInstances()
506 {
507 Print("DumpInstances");
508 for (int i = 0; i < m_Instances.Count(); i++)
509 {
510 Print(m_Instances.GetKey(i));
511 Print(m_Instances.GetElement(i));
512 }
513 }*/
514}
515
518{
520 {
521 //PPERequesterBank.RegisterRequester(TestReq);
522 }
523}
524
525/*modded class PPERequesterRegistrations extends Managed
526 {
527 void PPERequesterRegistrations()
528 {
529 PPERequesterBank.RegisterRequester(TestReq2);
530 }
531 }
static const int REQ_HEALTHHITEFFECTS
static ref map< int, ref PPERequesterBase > m_Instances
static const int REQ_GLASSESTACTICAL
static const int REQ_CONTROLLERDISCONNECT
static const int REQ_GLASSESSPORTBLACK
static const int REQ_INTROCHROMABB
static const int REQ_CONTROLLERBLUR
static const int REQ_GLASSESDESIGNER
class PPERequesterBank extends Managed PPERequesterRegistrations()
Mod this, if you wish to register custom requesters.
static const int REQ_BURLAPSACK
static const int REQ_INVENTORYBLUR
static const int REQ_CONTAMINATEDAREA
static const int REQ_GLASSESAVIATOR
static const int REQ_MOTOHELMETBLACK
static bool m_Initialized
static bool VerifyRequester(PPERequesterBase req)
Verifies the instance.
static int m_lastID
static const int REQ_GLASSESSPORTORANGE
static const int REQ_CAMERANV
static const int REQ_SHOCKHITEFFECTS
static const int REQ_FEVEREFFECTS
static int RegisterRequester(typename type)
Registers new requester type.
static void Init()
static const int REQ_DROWNING
static const int INVALID
static int GetRequesterID(typename type)
Returns an ID of a requester type.
static const int REQ_TUTORIALEFFECTS
static ref PPERequesterRegistrations m_Registrations
static const int REQ_DEATHEFFECTS
static GetRequesterTypename(int index)
Returns a typename from a requester ID.
static const int REQ_UNCONEFFECTS
static const int REQ_TUNELVISSION
static const int REQ_BLOODLOSS
static const int REQ_GLASSESWELDING
static const int REQ_PAINBLUR
static void Cleanup()
static const int REQ_FLASHBANGEFFECTS
static const int REQ_CAMERAADS
static const int REQ_MENUEFFECTS
static const int REQ_UNDERGROUND
static const int REQ_GLASSESSPORTBLUE
static const int REQ_SERVERBROWSEREFFECTS
static const int REQ_GLASSESSPORTGREEN
static const int REQ_SPOOKYAREA
PPERUndergroundAcco GetRequester()
Super root of all classes in Enforce script.
Definition EnScript.c:11
Definition Debug.c:14
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.
Definition Debug.c:133
TODO doc.
Definition EnScript.c:118
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

◆ GetRequester() [2/2]

static PPERequesterBase PPERequesterRegistrations::GetRequester ( typename type )
staticprivate

Returns an instance (singleton) of a requester based on typename.

Parameters
typetypename Typename of the requester.
Returns
PPERequesterBase Requester singleton.
Note
Returns only already registered instances, does not register anything.

Definition at line 278 of file PPERequesterBank.c.

282{
284 private static bool m_Initialized = false;
285
286 static int m_lastID = -1;
287
288 static const int INVALID = -1;
321
322 private static ref PPERequesterRegistrations m_Registrations; //more registrations to be placed here
323
324 static void Init()
325 {
327
328 if (!m_Instances)
330
331 m_Initialized = true;
332 }
333
334 static void Cleanup()
335 {
336 if (m_Initialized)
337 {
338 delete m_Registrations;
339 m_Instances.Clear();
340 }
341 }
342
349 static PPERequesterBase GetRequester(typename type)
350 {
351 if (!type)
352 {
353 Error("Requested type is NULL!");
354 return null;
355 }
356
359 for (int i = 0; i < m_Instances.Count(); i++)
360 {
361 temp = m_Instances.GetElement(i);
362 if (temp.Type() == type)
363 {
365 break;
366 }
367 }
368
369 if (!ret)
370 Debug.Log("'" + type.ToString() + "' not found in bank! Register first in 'RegisterRequester' method.");
371 return ret;
372 }
373
381 {
383
384 if (!ret)
385 Debug.Log("Requester idx '" + index + "' not found in bank! Register first in 'RegisterRequester' method.");
386 return ret;
387 }
388
395 static int GetRequesterID(typename type)
396 {
397 int ret = -1;
399
400 for (int i = 0; i < m_Instances.Count(); i++)
401 {
402 temp = m_Instances.GetElement(i);
403 if (temp.Type() == type)
404 ret = m_Instances.GetKey(i);
405 }
406
407 if (ret == -1)
408 Debug.Log("Requester instance of the '" + type.ToString() + "' type not found in bank! Register first in 'RegisterRequester' method.");
409 return ret;
410 }
411
417 static typename GetRequesterTypename(int index)
418 {
419 typename ret;
421 if (!temp)
422 Debug.Log("No requester exists under idx '" + index + "' in bank! Register first in 'RegisterRequester' method.");
423 else
424 ret = temp.Type();
425
426 return ret;
427 }
428
433 static int RegisterRequester(typename type)
434 {
435 if (!m_Instances)
437
438 if (GetRequester(type) != null)
439 {
440 //Error("Trying to register an already existing requester type: " + type);
441 Debug.Log("Trying to register an already existing requester type: " + type);
442 return -1;
443 }
444
445 m_lastID++;
446
448 req = PPERequesterBase.Cast(type.Spawn());
449 req.SetRequesterIDX(m_lastID);
451
452 return m_lastID;
453 }
454
457 {
458 if (!m_Initialized) //initial registrations are fair game
459 return true;
460
462 for (int i = 0; i < m_Instances.Count(); i++)
463 {
464 temp = m_Instances.GetElement(i);
465 if (temp == req)
466 return true;
467 }
468
469 //Error("Requester instance " + req + " not valid! Please use registered instances from PPERequesterBank.");
470 Debug.Log("Requester instance '" + req + "' not valid! Please use registered instances from PPERequesterBank.");
471 return false;
472 }
473
474 /*static void DumpInstances()
475 {
476 Print("DumpInstances");
477 for (int i = 0; i < m_Instances.Count(); i++)
478 {
479 Print(m_Instances.GetKey(i));
480 Print(m_Instances.GetElement(i));
481 }
482 }*/
483}
484
487{
489 {
490 //PPERequesterBank.RegisterRequester(TestReq);
491 }
492}
493
494/*modded class PPERequesterRegistrations extends Managed
495 {
496 void PPERequesterRegistrations()
497 {
498 PPERequesterBank.RegisterRequester(TestReq2);
499 }
500 }

◆ GetRequesterID()

static int PPERequesterRegistrations::GetRequesterID ( typename type )
staticprivate

Returns an ID of a requester type.

Parameters
typetypename Typename of the requester.
Returns
int Requester ID.
Note
Returns '-1' if not found.

Definition at line 324 of file PPERequesterBank.c.

328{
330 private static bool m_Initialized = false;
331
332 static int m_lastID = -1;
333
334 static const int INVALID = -1;
367
368 private static ref PPERequesterRegistrations m_Registrations; //more registrations to be placed here
369
370 static void Init()
371 {
373
374 if (!m_Instances)
376
377 m_Initialized = true;
378 }
379
380 static void Cleanup()
381 {
382 if (m_Initialized)
383 {
384 delete m_Registrations;
385 m_Instances.Clear();
386 }
387 }
388
395 static PPERequesterBase GetRequester(typename type)
396 {
397 if (!type)
398 {
399 Error("Requested type is NULL!");
400 return null;
401 }
402
405 for (int i = 0; i < m_Instances.Count(); i++)
406 {
407 temp = m_Instances.GetElement(i);
408 if (temp.Type() == type)
409 {
411 break;
412 }
413 }
414
415 if (!ret)
416 Debug.Log("'" + type.ToString() + "' not found in bank! Register first in 'RegisterRequester' method.");
417 return ret;
418 }
419
427 {
429
430 if (!ret)
431 Debug.Log("Requester idx '" + index + "' not found in bank! Register first in 'RegisterRequester' method.");
432 return ret;
433 }
434
441 static int GetRequesterID(typename type)
442 {
443 int ret = -1;
445
446 for (int i = 0; i < m_Instances.Count(); i++)
447 {
448 temp = m_Instances.GetElement(i);
449 if (temp.Type() == type)
450 ret = m_Instances.GetKey(i);
451 }
452
453 if (ret == -1)
454 Debug.Log("Requester instance of the '" + type.ToString() + "' type not found in bank! Register first in 'RegisterRequester' method.");
455 return ret;
456 }
457
463 static typename GetRequesterTypename(int index)
464 {
465 typename ret;
467 if (!temp)
468 Debug.Log("No requester exists under idx '" + index + "' in bank! Register first in 'RegisterRequester' method.");
469 else
470 ret = temp.Type();
471
472 return ret;
473 }
474
479 static int RegisterRequester(typename type)
480 {
481 if (!m_Instances)
483
484 if (GetRequester(type) != null)
485 {
486 //Error("Trying to register an already existing requester type: " + type);
487 Debug.Log("Trying to register an already existing requester type: " + type);
488 return -1;
489 }
490
491 m_lastID++;
492
494 req = PPERequesterBase.Cast(type.Spawn());
495 req.SetRequesterIDX(m_lastID);
497
498 return m_lastID;
499 }
500
503 {
504 if (!m_Initialized) //initial registrations are fair game
505 return true;
506
508 for (int i = 0; i < m_Instances.Count(); i++)
509 {
510 temp = m_Instances.GetElement(i);
511 if (temp == req)
512 return true;
513 }
514
515 //Error("Requester instance " + req + " not valid! Please use registered instances from PPERequesterBank.");
516 Debug.Log("Requester instance '" + req + "' not valid! Please use registered instances from PPERequesterBank.");
517 return false;
518 }
519
520 /*static void DumpInstances()
521 {
522 Print("DumpInstances");
523 for (int i = 0; i < m_Instances.Count(); i++)
524 {
525 Print(m_Instances.GetKey(i));
526 Print(m_Instances.GetElement(i));
527 }
528 }*/
529}
530
533{
535 {
536 //PPERequesterBank.RegisterRequester(TestReq);
537 }
538}
539
540/*modded class PPERequesterRegistrations extends Managed
541 {
542 void PPERequesterRegistrations()
543 {
544 PPERequesterBank.RegisterRequester(TestReq2);
545 }
546 }

◆ GetRequesterTypename()

static PPERequesterRegistrations::GetRequesterTypename ( int index)
staticprivate

Returns a typename from a requester ID.

Parameters
indexint ID of the requester.
Returns
typename Requester typename.

Definition at line 346 of file PPERequesterBank.c.

350{
352 private static bool m_Initialized = false;
353
354 static int m_lastID = -1;
355
356 static const int INVALID = -1;
389
390 private static ref PPERequesterRegistrations m_Registrations; //more registrations to be placed here
391
392 static void Init()
393 {
395
396 if (!m_Instances)
398
399 m_Initialized = true;
400 }
401
402 static void Cleanup()
403 {
404 if (m_Initialized)
405 {
406 delete m_Registrations;
407 m_Instances.Clear();
408 }
409 }
410
417 static PPERequesterBase GetRequester(typename type)
418 {
419 if (!type)
420 {
421 Error("Requested type is NULL!");
422 return null;
423 }
424
427 for (int i = 0; i < m_Instances.Count(); i++)
428 {
429 temp = m_Instances.GetElement(i);
430 if (temp.Type() == type)
431 {
433 break;
434 }
435 }
436
437 if (!ret)
438 Debug.Log("'" + type.ToString() + "' not found in bank! Register first in 'RegisterRequester' method.");
439 return ret;
440 }
441
449 {
451
452 if (!ret)
453 Debug.Log("Requester idx '" + index + "' not found in bank! Register first in 'RegisterRequester' method.");
454 return ret;
455 }
456
463 static int GetRequesterID(typename type)
464 {
465 int ret = -1;
467
468 for (int i = 0; i < m_Instances.Count(); i++)
469 {
470 temp = m_Instances.GetElement(i);
471 if (temp.Type() == type)
472 ret = m_Instances.GetKey(i);
473 }
474
475 if (ret == -1)
476 Debug.Log("Requester instance of the '" + type.ToString() + "' type not found in bank! Register first in 'RegisterRequester' method.");
477 return ret;
478 }
479
485 static typename GetRequesterTypename(int index)
486 {
487 typename ret;
489 if (!temp)
490 Debug.Log("No requester exists under idx '" + index + "' in bank! Register first in 'RegisterRequester' method.");
491 else
492 ret = temp.Type();
493
494 return ret;
495 }
496
501 static int RegisterRequester(typename type)
502 {
503 if (!m_Instances)
505
506 if (GetRequester(type) != null)
507 {
508 //Error("Trying to register an already existing requester type: " + type);
509 Debug.Log("Trying to register an already existing requester type: " + type);
510 return -1;
511 }
512
513 m_lastID++;
514
516 req = PPERequesterBase.Cast(type.Spawn());
517 req.SetRequesterIDX(m_lastID);
519
520 return m_lastID;
521 }
522
525 {
526 if (!m_Initialized) //initial registrations are fair game
527 return true;
528
530 for (int i = 0; i < m_Instances.Count(); i++)
531 {
532 temp = m_Instances.GetElement(i);
533 if (temp == req)
534 return true;
535 }
536
537 //Error("Requester instance " + req + " not valid! Please use registered instances from PPERequesterBank.");
538 Debug.Log("Requester instance '" + req + "' not valid! Please use registered instances from PPERequesterBank.");
539 return false;
540 }
541
542 /*static void DumpInstances()
543 {
544 Print("DumpInstances");
545 for (int i = 0; i < m_Instances.Count(); i++)
546 {
547 Print(m_Instances.GetKey(i));
548 Print(m_Instances.GetElement(i));
549 }
550 }*/
551}
552
555{
557 {
558 //PPERequesterBank.RegisterRequester(TestReq);
559 }
560}
561
562/*modded class PPERequesterRegistrations extends Managed
563 {
564 void PPERequesterRegistrations()
565 {
566 PPERequesterBank.RegisterRequester(TestReq2);
567 }
568 }

◆ Init()

static void PPERequesterRegistrations::Init ( )
staticprivate

Definition at line 253 of file PPERequesterBank.c.

257{
259 private static bool m_Initialized = false;
260
261 static int m_lastID = -1;
262
263 static const int INVALID = -1;
296
297 private static ref PPERequesterRegistrations m_Registrations; //more registrations to be placed here
298
299 static void Init()
300 {
302
303 if (!m_Instances)
305
306 m_Initialized = true;
307 }
308
309 static void Cleanup()
310 {
311 if (m_Initialized)
312 {
313 delete m_Registrations;
314 m_Instances.Clear();
315 }
316 }
317
324 static PPERequesterBase GetRequester(typename type)
325 {
326 if (!type)
327 {
328 Error("Requested type is NULL!");
329 return null;
330 }
331
334 for (int i = 0; i < m_Instances.Count(); i++)
335 {
336 temp = m_Instances.GetElement(i);
337 if (temp.Type() == type)
338 {
340 break;
341 }
342 }
343
344 if (!ret)
345 Debug.Log("'" + type.ToString() + "' not found in bank! Register first in 'RegisterRequester' method.");
346 return ret;
347 }
348
356 {
358
359 if (!ret)
360 Debug.Log("Requester idx '" + index + "' not found in bank! Register first in 'RegisterRequester' method.");
361 return ret;
362 }
363
370 static int GetRequesterID(typename type)
371 {
372 int ret = -1;
374
375 for (int i = 0; i < m_Instances.Count(); i++)
376 {
377 temp = m_Instances.GetElement(i);
378 if (temp.Type() == type)
379 ret = m_Instances.GetKey(i);
380 }
381
382 if (ret == -1)
383 Debug.Log("Requester instance of the '" + type.ToString() + "' type not found in bank! Register first in 'RegisterRequester' method.");
384 return ret;
385 }
386
392 static typename GetRequesterTypename(int index)
393 {
394 typename ret;
396 if (!temp)
397 Debug.Log("No requester exists under idx '" + index + "' in bank! Register first in 'RegisterRequester' method.");
398 else
399 ret = temp.Type();
400
401 return ret;
402 }
403
408 static int RegisterRequester(typename type)
409 {
410 if (!m_Instances)
412
413 if (GetRequester(type) != null)
414 {
415 //Error("Trying to register an already existing requester type: " + type);
416 Debug.Log("Trying to register an already existing requester type: " + type);
417 return -1;
418 }
419
420 m_lastID++;
421
423 req = PPERequesterBase.Cast(type.Spawn());
424 req.SetRequesterIDX(m_lastID);
426
427 return m_lastID;
428 }
429
432 {
433 if (!m_Initialized) //initial registrations are fair game
434 return true;
435
437 for (int i = 0; i < m_Instances.Count(); i++)
438 {
439 temp = m_Instances.GetElement(i);
440 if (temp == req)
441 return true;
442 }
443
444 //Error("Requester instance " + req + " not valid! Please use registered instances from PPERequesterBank.");
445 Debug.Log("Requester instance '" + req + "' not valid! Please use registered instances from PPERequesterBank.");
446 return false;
447 }
448
449 /*static void DumpInstances()
450 {
451 Print("DumpInstances");
452 for (int i = 0; i < m_Instances.Count(); i++)
453 {
454 Print(m_Instances.GetKey(i));
455 Print(m_Instances.GetElement(i));
456 }
457 }*/
458}
459
462{
464 {
465 //PPERequesterBank.RegisterRequester(TestReq);
466 }
467}
468
469/*modded class PPERequesterRegistrations extends Managed
470 {
471 void PPERequesterRegistrations()
472 {
473 PPERequesterBank.RegisterRequester(TestReq2);
474 }
475 }

◆ PPERequesterRegistrations()

class PPERequesterBank extends Managed PPERequesterRegistrations ( )

Mod this, if you wish to register custom requesters.

Definition at line 4 of file PPERequesterBank.c.

212 {
213 //PPERequesterBank.RegisterRequester(TestReq);
214 }

Referenced by Managed::Init().

◆ RegisterRequester()

static int PPERequesterRegistrations::RegisterRequester ( typename type )
staticprivate

Registers new requester type.

Note
Performed only on game start. New requesters can be registered in 'PPERequesterRegistrations'

Definition at line 362 of file PPERequesterBank.c.

366{
368 private static bool m_Initialized = false;
369
370 static int m_lastID = -1;
371
372 static const int INVALID = -1;
405
406 private static ref PPERequesterRegistrations m_Registrations; //more registrations to be placed here
407
408 static void Init()
409 {
411
412 if (!m_Instances)
414
415 m_Initialized = true;
416 }
417
418 static void Cleanup()
419 {
420 if (m_Initialized)
421 {
422 delete m_Registrations;
423 m_Instances.Clear();
424 }
425 }
426
433 static PPERequesterBase GetRequester(typename type)
434 {
435 if (!type)
436 {
437 Error("Requested type is NULL!");
438 return null;
439 }
440
443 for (int i = 0; i < m_Instances.Count(); i++)
444 {
445 temp = m_Instances.GetElement(i);
446 if (temp.Type() == type)
447 {
449 break;
450 }
451 }
452
453 if (!ret)
454 Debug.Log("'" + type.ToString() + "' not found in bank! Register first in 'RegisterRequester' method.");
455 return ret;
456 }
457
465 {
467
468 if (!ret)
469 Debug.Log("Requester idx '" + index + "' not found in bank! Register first in 'RegisterRequester' method.");
470 return ret;
471 }
472
479 static int GetRequesterID(typename type)
480 {
481 int ret = -1;
483
484 for (int i = 0; i < m_Instances.Count(); i++)
485 {
486 temp = m_Instances.GetElement(i);
487 if (temp.Type() == type)
488 ret = m_Instances.GetKey(i);
489 }
490
491 if (ret == -1)
492 Debug.Log("Requester instance of the '" + type.ToString() + "' type not found in bank! Register first in 'RegisterRequester' method.");
493 return ret;
494 }
495
501 static typename GetRequesterTypename(int index)
502 {
503 typename ret;
505 if (!temp)
506 Debug.Log("No requester exists under idx '" + index + "' in bank! Register first in 'RegisterRequester' method.");
507 else
508 ret = temp.Type();
509
510 return ret;
511 }
512
517 static int RegisterRequester(typename type)
518 {
519 if (!m_Instances)
521
522 if (GetRequester(type) != null)
523 {
524 //Error("Trying to register an already existing requester type: " + type);
525 Debug.Log("Trying to register an already existing requester type: " + type);
526 return -1;
527 }
528
529 m_lastID++;
530
532 req = PPERequesterBase.Cast(type.Spawn());
533 req.SetRequesterIDX(m_lastID);
535
536 return m_lastID;
537 }
538
541 {
542 if (!m_Initialized) //initial registrations are fair game
543 return true;
544
546 for (int i = 0; i < m_Instances.Count(); i++)
547 {
548 temp = m_Instances.GetElement(i);
549 if (temp == req)
550 return true;
551 }
552
553 //Error("Requester instance " + req + " not valid! Please use registered instances from PPERequesterBank.");
554 Debug.Log("Requester instance '" + req + "' not valid! Please use registered instances from PPERequesterBank.");
555 return false;
556 }
557
558 /*static void DumpInstances()
559 {
560 Print("DumpInstances");
561 for (int i = 0; i < m_Instances.Count(); i++)
562 {
563 Print(m_Instances.GetKey(i));
564 Print(m_Instances.GetElement(i));
565 }
566 }*/
567}
568
571{
573 {
574 //PPERequesterBank.RegisterRequester(TestReq);
575 }
576}
577
578/*modded class PPERequesterRegistrations extends Managed
579 {
580 void PPERequesterRegistrations()
581 {
582 PPERequesterBank.RegisterRequester(TestReq2);
583 }
584 }

◆ VerifyRequester()

static bool PPERequesterRegistrations::VerifyRequester ( PPERequesterBase req)
staticprivate

Verifies the instance.

Definition at line 385 of file PPERequesterBank.c.

389{
391 private static bool m_Initialized = false;
392
393 static int m_lastID = -1;
394
395 static const int INVALID = -1;
428
429 private static ref PPERequesterRegistrations m_Registrations; //more registrations to be placed here
430
431 static void Init()
432 {
434
435 if (!m_Instances)
437
438 m_Initialized = true;
439 }
440
441 static void Cleanup()
442 {
443 if (m_Initialized)
444 {
445 delete m_Registrations;
446 m_Instances.Clear();
447 }
448 }
449
456 static PPERequesterBase GetRequester(typename type)
457 {
458 if (!type)
459 {
460 Error("Requested type is NULL!");
461 return null;
462 }
463
466 for (int i = 0; i < m_Instances.Count(); i++)
467 {
468 temp = m_Instances.GetElement(i);
469 if (temp.Type() == type)
470 {
472 break;
473 }
474 }
475
476 if (!ret)
477 Debug.Log("'" + type.ToString() + "' not found in bank! Register first in 'RegisterRequester' method.");
478 return ret;
479 }
480
488 {
490
491 if (!ret)
492 Debug.Log("Requester idx '" + index + "' not found in bank! Register first in 'RegisterRequester' method.");
493 return ret;
494 }
495
502 static int GetRequesterID(typename type)
503 {
504 int ret = -1;
506
507 for (int i = 0; i < m_Instances.Count(); i++)
508 {
509 temp = m_Instances.GetElement(i);
510 if (temp.Type() == type)
511 ret = m_Instances.GetKey(i);
512 }
513
514 if (ret == -1)
515 Debug.Log("Requester instance of the '" + type.ToString() + "' type not found in bank! Register first in 'RegisterRequester' method.");
516 return ret;
517 }
518
524 static typename GetRequesterTypename(int index)
525 {
526 typename ret;
528 if (!temp)
529 Debug.Log("No requester exists under idx '" + index + "' in bank! Register first in 'RegisterRequester' method.");
530 else
531 ret = temp.Type();
532
533 return ret;
534 }
535
540 static int RegisterRequester(typename type)
541 {
542 if (!m_Instances)
544
545 if (GetRequester(type) != null)
546 {
547 //Error("Trying to register an already existing requester type: " + type);
548 Debug.Log("Trying to register an already existing requester type: " + type);
549 return -1;
550 }
551
552 m_lastID++;
553
555 req = PPERequesterBase.Cast(type.Spawn());
556 req.SetRequesterIDX(m_lastID);
558
559 return m_lastID;
560 }
561
564 {
565 if (!m_Initialized) //initial registrations are fair game
566 return true;
567
569 for (int i = 0; i < m_Instances.Count(); i++)
570 {
571 temp = m_Instances.GetElement(i);
572 if (temp == req)
573 return true;
574 }
575
576 //Error("Requester instance " + req + " not valid! Please use registered instances from PPERequesterBank.");
577 Debug.Log("Requester instance '" + req + "' not valid! Please use registered instances from PPERequesterBank.");
578 return false;
579 }
580
581 /*static void DumpInstances()
582 {
583 Print("DumpInstances");
584 for (int i = 0; i < m_Instances.Count(); i++)
585 {
586 Print(m_Instances.GetKey(i));
587 Print(m_Instances.GetElement(i));
588 }
589 }*/
590}
591
594{
596 {
597 //PPERequesterBank.RegisterRequester(TestReq);
598 }
599}
600
601/*modded class PPERequesterRegistrations extends Managed
602 {
603 void PPERequesterRegistrations()
604 {
605 PPERequesterBank.RegisterRequester(TestReq2);
606 }
607 }

Variable Documentation

◆ INVALID

const int INVALID = -1
staticprivate

Definition at line 217 of file PPERequesterBank.c.

◆ m_Initialized

bool m_Initialized = false
staticprivate

Definition at line 213 of file PPERequesterBank.c.

◆ m_Instances

◆ m_lastID

int m_lastID = -1
staticprivate

Definition at line 215 of file PPERequesterBank.c.

Referenced by Managed::RegisterRequester().

◆ m_Registrations

ref PPERequesterRegistrations m_Registrations
staticprivate

Definition at line 251 of file PPERequesterBank.c.

Referenced by Managed::Cleanup(), and Managed::Init().

◆ REQ_BLOODLOSS

const int REQ_BLOODLOSS = RegisterRequester(PPERequester_BloodLoss)
staticprivate

Definition at line 231 of file PPERequesterBank.c.

◆ REQ_BURLAPSACK

const int REQ_BURLAPSACK = RegisterRequester(PPERequester_BurlapSackEffects)
staticprivate

Definition at line 235 of file PPERequesterBank.c.

◆ REQ_CAMERAADS

const int REQ_CAMERAADS = RegisterRequester(PPERequester_CameraADS)
staticprivate

Definition at line 230 of file PPERequesterBank.c.

◆ REQ_CAMERANV

const int REQ_CAMERANV = RegisterRequester(PPERequester_CameraNV)
staticprivate

Definition at line 229 of file PPERequesterBank.c.

◆ REQ_CONTAMINATEDAREA

const int REQ_CONTAMINATEDAREA = RegisterRequester(PPERequester_ContaminatedAreaTint)
staticprivate

Definition at line 245 of file PPERequesterBank.c.

◆ REQ_CONTROLLERBLUR

const int REQ_CONTROLLERBLUR = RegisterRequester(PPERequester_ControlsBlur)
staticprivate

Definition at line 242 of file PPERequesterBank.c.

◆ REQ_CONTROLLERDISCONNECT

const int REQ_CONTROLLERDISCONNECT = RegisterRequester(PPERequester_ControllerDisconnectBlur)
staticprivate

Definition at line 219 of file PPERequesterBank.c.

◆ REQ_DEATHEFFECTS

const int REQ_DEATHEFFECTS = RegisterRequester(PPERequester_DeathDarkening)
staticprivate

Definition at line 232 of file PPERequesterBank.c.

◆ REQ_DROWNING

const int REQ_DROWNING = RegisterRequester(PPERequester_Drowning)
staticprivate

Definition at line 249 of file PPERequesterBank.c.

◆ REQ_FEVEREFFECTS

const int REQ_FEVEREFFECTS = RegisterRequester(PPERequester_FeverEffects)
staticprivate

Definition at line 237 of file PPERequesterBank.c.

◆ REQ_FLASHBANGEFFECTS

const int REQ_FLASHBANGEFFECTS = RegisterRequester(PPERequester_FlashbangEffects)
staticprivate

Definition at line 238 of file PPERequesterBank.c.

◆ REQ_GLASSESAVIATOR

const int REQ_GLASSESAVIATOR = RegisterRequester(PPERequester_GlassesAviator)
staticprivate

Definition at line 224 of file PPERequesterBank.c.

◆ REQ_GLASSESDESIGNER

const int REQ_GLASSESDESIGNER = RegisterRequester(PPERequester_GlassesDesignerBlack)
staticprivate

Definition at line 225 of file PPERequesterBank.c.

◆ REQ_GLASSESSPORTBLACK

const int REQ_GLASSESSPORTBLACK = RegisterRequester(PPERequester_GlassesSportBlack)
staticprivate

Definition at line 220 of file PPERequesterBank.c.

◆ REQ_GLASSESSPORTBLUE

const int REQ_GLASSESSPORTBLUE = RegisterRequester(PPERequester_GlassesSportBlue)
staticprivate

Definition at line 221 of file PPERequesterBank.c.

◆ REQ_GLASSESSPORTGREEN

const int REQ_GLASSESSPORTGREEN = RegisterRequester(PPERequester_GlassesSportGreen)
staticprivate

Definition at line 222 of file PPERequesterBank.c.

◆ REQ_GLASSESSPORTORANGE

const int REQ_GLASSESSPORTORANGE = RegisterRequester(PPERequester_GlassesSportOrange)
staticprivate

Definition at line 223 of file PPERequesterBank.c.

◆ REQ_GLASSESTACTICAL

const int REQ_GLASSESTACTICAL = RegisterRequester(PPERequester_TacticalGoggles)
staticprivate

Definition at line 226 of file PPERequesterBank.c.

◆ REQ_GLASSESWELDING

const int REQ_GLASSESWELDING = RegisterRequester(PPERequester_WeldingMask)
staticprivate

Definition at line 228 of file PPERequesterBank.c.

◆ REQ_HEALTHHITEFFECTS

const int REQ_HEALTHHITEFFECTS = RegisterRequester(PPERequester_HealthHitReaction)
staticprivate

Definition at line 240 of file PPERequesterBank.c.

◆ REQ_INTROCHROMABB

const int REQ_INTROCHROMABB = RegisterRequester(PPERequester_IntroChromAbb)
staticprivate

Definition at line 236 of file PPERequesterBank.c.

◆ REQ_INVENTORYBLUR

const int REQ_INVENTORYBLUR = RegisterRequester(PPERequester_InventoryBlur)
staticprivate

Definition at line 218 of file PPERequesterBank.c.

◆ REQ_MENUEFFECTS

const int REQ_MENUEFFECTS = RegisterRequester(PPERequester_MenuEffects)
staticprivate

Definition at line 241 of file PPERequesterBank.c.

◆ REQ_MOTOHELMETBLACK

const int REQ_MOTOHELMETBLACK = RegisterRequester(PPERequester_MotoHelmetBlack)
staticprivate

Definition at line 227 of file PPERequesterBank.c.

◆ REQ_PAINBLUR

const int REQ_PAINBLUR = RegisterRequester(PPERequester_PainBlur)
staticprivate

Definition at line 247 of file PPERequesterBank.c.

◆ REQ_SERVERBROWSEREFFECTS

const int REQ_SERVERBROWSEREFFECTS = RegisterRequester(PPERequester_ServerBrowserBlur)
staticprivate

Definition at line 243 of file PPERequesterBank.c.

◆ REQ_SHOCKHITEFFECTS

const int REQ_SHOCKHITEFFECTS = RegisterRequester(PPERequester_ShockHitReaction)
staticprivate

Definition at line 239 of file PPERequesterBank.c.

◆ REQ_SPOOKYAREA

const int REQ_SPOOKYAREA = RegisterRequester(PPERequester_SpookyAreaTint)
staticprivate

Definition at line 246 of file PPERequesterBank.c.

◆ REQ_TUNELVISSION

const int REQ_TUNELVISSION = RegisterRequester(PPERequester_TunnelVisionEffects)
staticprivate

Definition at line 234 of file PPERequesterBank.c.

◆ REQ_TUTORIALEFFECTS

const int REQ_TUTORIALEFFECTS = RegisterRequester(PPERequester_TutorialMenu)
staticprivate

Definition at line 244 of file PPERequesterBank.c.

◆ REQ_UNCONEFFECTS

const int REQ_UNCONEFFECTS = RegisterRequester(PPERequester_UnconEffects)
staticprivate

Definition at line 233 of file PPERequesterBank.c.

◆ REQ_UNDERGROUND

const int REQ_UNDERGROUND = RegisterRequester(PPERUndergroundAcco)
staticprivate

Definition at line 248 of file PPERequesterBank.c.