2017-10-20 02:00:49 +00:00
|
|
|
class ExtTraderContainer_Store extends KFGFxTraderContainer_Store;
|
|
|
|
|
2021-01-10 03:27:50 +00:00
|
|
|
/** returns true if this item should not be displayed */
|
|
|
|
function bool IsItemFiltered(STraderItem Item, optional bool bDebug)
|
|
|
|
{
|
|
|
|
if (KFPC.GetPurchaseHelper().IsInOwnedItemList(Item.ClassName))
|
|
|
|
return true;
|
|
|
|
if ( KFPC.GetPurchaseHelper().IsInOwnedItemList(Item.DualClassName) )
|
|
|
|
return true;
|
|
|
|
if (!KFPC.GetPurchaseHelper().IsSellable(Item))
|
|
|
|
return true;
|
|
|
|
if ( Item.WeaponDef.default.PlatformRestriction != PR_All && class'KFUnlockManager'.static.IsPlatformRestricted( Item.WeaponDef.default.PlatformRestriction ) )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
function RefreshWeaponListByPerk(byte FilterIndex, const out array<STraderItem> ItemList)
|
|
|
|
{
|
|
|
|
local int i, SlotIndex;
|
|
|
|
local GFxObject ItemDataArray; // This array of information is sent to ActionScript to update the Item data
|
|
|
|
local array<STraderItem> OnPerkWeapons, SecondaryWeapons, OffPerkWeapons;
|
|
|
|
local class<KFPerk> TargetPerkClass;
|
|
|
|
local ExtPlayerController EKFPC;
|
|
|
|
|
|
|
|
EKFPC = ExtPlayerController(KFPC);
|
2020-11-28 20:04:55 +00:00
|
|
|
if (EKFPC!=none && EKFPC.ActivePerkManager!=None)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
if (FilterIndex<EKFPC.ActivePerkManager.UserPerks.Length)
|
2017-10-20 02:00:49 +00:00
|
|
|
TargetPerkClass = EKFPC.ActivePerkManager.UserPerks[FilterIndex].BasePerk;
|
|
|
|
|
|
|
|
SlotIndex = 0;
|
2020-11-28 19:53:57 +00:00
|
|
|
ItemDataArray = CreateArray();
|
2017-10-20 02:00:49 +00:00
|
|
|
|
|
|
|
for (i = 0; i < ItemList.Length; i++)
|
|
|
|
{
|
2020-11-28 20:04:55 +00:00
|
|
|
if (IsItemFiltered(ItemList[i]))
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
continue; // Skip this item if it's in our inventory
|
|
|
|
}
|
2020-11-28 20:04:55 +00:00
|
|
|
else if (ItemList[i].AssociatedPerkClasses.length > 0 && ItemList[i].AssociatedPerkClasses[0] != none && TargetPerkClass != class'KFPerk_Survivalist'
|
|
|
|
&& (TargetPerkClass==None || ItemList[i].AssociatedPerkClasses.Find(TargetPerkClass) == INDEX_NONE))
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
continue; // filtered by perk
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
if (ItemList[i].AssociatedPerkClasses.length > 0)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
switch (ItemList[i].AssociatedPerkClasses.Find(TargetPerkClass))
|
|
|
|
{
|
|
|
|
case 0: //primary perk
|
|
|
|
OnPerkWeapons.AddItem(ItemList[i]);
|
|
|
|
break;
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
case 1: //secondary perk
|
|
|
|
SecondaryWeapons.AddItem(ItemList[i]);
|
|
|
|
break;
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
default: //off perk
|
|
|
|
OffPerkWeapons.AddItem(ItemList[i]);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < OnPerkWeapons.length; i++)
|
|
|
|
{
|
|
|
|
SetItemInfo(ItemDataArray, OnPerkWeapons[i], SlotIndex);
|
2023-05-14 02:49:12 +00:00
|
|
|
SlotIndex++;
|
2017-10-20 02:00:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < SecondaryWeapons.length; i++)
|
|
|
|
{
|
|
|
|
SetItemInfo(ItemDataArray, SecondaryWeapons[i], SlotIndex);
|
|
|
|
SlotIndex++;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < OffPerkWeapons.length; i++)
|
|
|
|
{
|
|
|
|
SetItemInfo(ItemDataArray, OffPerkWeapons[i], SlotIndex);
|
|
|
|
SlotIndex++;
|
2023-05-14 02:49:12 +00:00
|
|
|
}
|
2017-10-20 02:00:49 +00:00
|
|
|
|
|
|
|
SetObject("shopData", ItemDataArray);
|
|
|
|
}
|
|
|
|
}
|