476 {
478
479 widget =
m_Root.FindAnyWidget(itemWidget);
480
481 if (enabled)
482 {
483 string wpn_qty = "";
484
485 ProgressBarWidget progressBar;
486 TextWidget textWidget;
487 Class.CastTo(progressBar, widget.FindAnyWidget(quantityPBWidget));
488 Class.CastTo(textWidget, widget.FindAnyWidget(quantityTextWidget));
489
490 Weapon_Base wpn;
491 Magazine maga;
492 int mag_quantity = -1;
493
495 {
497 {
498 mag_quantity = 0;
499 for (int j = 0; j < wpn.GetMuzzleCount(); j++)
500 {
501 if (wpn.IsChamberFull(j)&& !wpn.IsChamberFiredOut(j))
502 mag_quantity++;
503 }
504 wpn_qty = mag_quantity.ToString();
505 }
506 else
507 {
508 for (int i = 0; i < wpn.GetMuzzleCount(); i++)
509 {
510 if (i > 0 && (wpn.GetMuzzleCount() < 3 || i%2 == 0))
511 {
512 wpn_qty = wpn_qty + " ";
513 }
514 if (wpn.IsChamberEmpty(i))
515 {
516 wpn_qty = wpn_qty + "0";
517 }
518 else if (wpn.IsChamberFiredOut(i))
519 {
520 wpn_qty = wpn_qty + "F";
521 }
522 else
523 {
524 wpn_qty = wpn_qty + "1";
525 }
526
527 maga = wpn.GetMagazine(i);
528 if (maga)
529 {
530 mag_quantity = maga.GetAmmoCount();
531 }
532 else if (wpn.GetInternalMagazineMaxCartridgeCount(i) > 0)
533 {
534 mag_quantity = wpn.GetInternalMagazineCartridgeCount(i);
535 }
536
537 }
538
539 if (wpn.IsJammed())
540 {
541 if (mag_quantity != -1)
542 wpn_qty =
string.
Format(
"X (+%1)", mag_quantity);
543 else
544 wpn_qty = "X";
545 }
546 else
547 {
548 if (mag_quantity != -1)
549 {
550 wpn_qty = wpn_qty + " (" + mag_quantity.ToString() + ")";
551 }
552 }
553 }
554 }
555
556 progressBar.Show(false);
557 textWidget.SetText(wpn_qty);
558 textWidget.Show(true);
559 textWidget.GetParent().Show(true);
560 }
561 else
562 widget.Show(false);
563 }
class Magnum extends Magnum_Base Magnum_Base
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.