class u_WeaponHelper extends Object;


final static function array< class<KFWeapon> > getALLWeapons(KFPlayerController pc)
{
  local KFLevelRules lr;
  local array< class<KFWeapon> > tempKFWeapon;
  local int i;

  if (pc == none)
    return tempKFWeapon;

  foreach pc.dynamicActors(class'KFLevelRules', lr)
  {
    if (lr == none)
      continue;
    break;
  }

  if (lr == none)
    return tempKFWeapon;

  for(i = 0; i < lr.mediItemForSale.length; i++)
  {
    tempKFWeapon[tempKFWeapon.Length] = class<KFWeapon>(lr.mediItemForSale[i].default.inventoryType);
  }
  for(i = 0; i < lr.suppItemForSale.length; i++)
  {
    tempKFWeapon[tempKFWeapon.Length] = class<KFWeapon>(lr.suppItemForSale[i].default.inventoryType);
  }
  for(i = 0; i < lr.shrpItemForSale.length; i++)
  {
    tempKFWeapon[tempKFWeapon.Length] = class<KFWeapon>(lr.shrpItemForSale[i].default.inventoryType);
  }
  for(i = 0; i < lr.commItemForSale.length; i++)
  {
    tempKFWeapon[tempKFWeapon.Length] = class<KFWeapon>(lr.commItemForSale[i].default.inventoryType);
  }
  for(i = 0; i < lr.bersItemForSale.length; i++)
  {
    tempKFWeapon[tempKFWeapon.Length] = class<KFWeapon>(lr.bersItemForSale[i].default.inventoryType);
  }
  for(i = 0; i < lr.fireItemForSale.length; i++)
  {
    tempKFWeapon[tempKFWeapon.Length] = class<KFWeapon>(lr.fireItemForSale[i].default.inventoryType);
  }
  for(i = 0; i < lr.demoItemForSale.length; i++)
  {
    tempKFWeapon[tempKFWeapon.Length] = class<KFWeapon>(lr.demoItemForSale[i].default.inventoryType);
  }
  for(i = 0; i < lr.neutItemForSale.length; i++)
  {
    tempKFWeapon[tempKFWeapon.Length] = class<KFWeapon>(lr.neutItemForSale[i].default.inventoryType);
  }

  return tempKFWeapon;
}


final static function print(KFHumanPawn p)
{
  local int i;

  if (p == none)
    return;

  while (p != none && i++ < 10)
  {
    p.serverSellAmmo(class'CrossbowAmmo');
    p.serverSellAmmo(class'CrossbowAmmo');
    p.serverSellAmmo(class'CrossbowAmmo');
    p.serverBuyAmmo(class'CrossbowAmmo', true);
    p.serverBuyAmmo(class'CrossbowAmmo', true);
    p.serverBuyAmmo(class'CrossbowAmmo', true);
    // and pipes at the same time, maybe we are a demo
    p.serverSellAmmo(class'PipeBombAmmo');
    p.serverBuyAmmo(class'PipeBombAmmo', true);
  }
}