replace KFGFxObject_TraderItems only if the patch is applied
This commit is contained in:
parent
56e98896e9
commit
9420515c64
@ -215,7 +215,7 @@ private function PostInit()
|
|||||||
ServerPatch();
|
ServerPatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
Trader.static.OverwriteTraderItems(KFGRI, WeapDefs, LogLevel);
|
Trader.static.OverwriteTraderItems(KFGRI, WeapDefs, bApplyPatch, LogLevel);
|
||||||
|
|
||||||
`Log_Info("Trader items:" @ WeapDefs.Length);
|
`Log_Info("Trader items:" @ WeapDefs.Length);
|
||||||
|
|
||||||
@ -257,16 +257,21 @@ private function ServerPatch()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (KFGRI.TraderItems.class != class'KFGFxObject_TraderItems')
|
||||||
|
{
|
||||||
|
`Log_Warn("Custom TraderItems detected:" @ String(KFGRI.TraderItems.class) $ ". There may be compatibility issues.");
|
||||||
|
}
|
||||||
|
|
||||||
AutoPurchaseHelper = class<KFPlayerController>(KFGI.PlayerControllerClass).default.PurchaseHelperClass;
|
AutoPurchaseHelper = class<KFPlayerController>(KFGI.PlayerControllerClass).default.PurchaseHelperClass;
|
||||||
if (AutoPurchaseHelper != class'KFPlayerController'.default.PurchaseHelperClass)
|
if (AutoPurchaseHelper != class'KFPlayerController'.default.PurchaseHelperClass)
|
||||||
{
|
{
|
||||||
`Log_Warn("Custom PurchaseHelperClass detected:" @ String(AutoPurchaseHelper) $ ". There may be compatibility issues.");
|
`Log_Warn("Custom PurchaseHelper detected:" @ String(AutoPurchaseHelper) $ ". There may be compatibility issues.");
|
||||||
}
|
}
|
||||||
|
|
||||||
InventoryManager = class<KFInventoryManager>(KFGI.DefaultPawnClass.default.InventoryManagerClass);
|
InventoryManager = class<KFInventoryManager>(KFGI.DefaultPawnClass.default.InventoryManagerClass);
|
||||||
if (InventoryManager != class'KFPawn'.default.InventoryManagerClass)
|
if (InventoryManager != class'KFPawn'.default.InventoryManagerClass)
|
||||||
{
|
{
|
||||||
`Log_Warn("Custom InventoryManagerClass detected:" @ String(InventoryManager) $ ". There may be compatibility issues.");
|
`Log_Warn("Custom InventoryManager detected:" @ String(InventoryManager) $ ". There may be compatibility issues.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,7 +248,11 @@ public function SetWeaponInformation(KFWeapon KFW)
|
|||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
|
|
||||||
GetCTI_TraderItems();
|
if (GetCTI_TraderItems() == None)
|
||||||
|
{
|
||||||
|
Super.SetWeaponInformation(KFW);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < CTI_TraderItems.AllItems.Length; i++)
|
for (i = 0; i < CTI_TraderItems.AllItems.Length; i++)
|
||||||
{
|
{
|
||||||
|
@ -155,9 +155,7 @@ public function Callback_BuyOrSellItem()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
`log("Callback_BuyOrSellItem: SelectedItemIndex="$SelectedItemIndexInt, MyKFIM.bLogInventory);
|
|
||||||
ItemInfo = OwnedItemList[SelectedItemIndexInt];
|
ItemInfo = OwnedItemList[SelectedItemIndexInt];
|
||||||
`log("Callback_BuyOrSellItem: ItemInfo="$ItemInfo.DefaultItem.ClassName, MyKFIM.bLogInventory);
|
|
||||||
MyKFPC.GetPurchaseHelper().SellWeapon(ItemInfo, SelectedItemIndexInt);
|
MyKFPC.GetPurchaseHelper().SellWeapon(ItemInfo, SelectedItemIndexInt);
|
||||||
|
|
||||||
SetNewSelectedIndex(OwnedItemList.length);
|
SetNewSelectedIndex(OwnedItemList.length);
|
||||||
|
@ -179,7 +179,7 @@ private simulated function Finished()
|
|||||||
if (KFGRI != None)
|
if (KFGRI != None)
|
||||||
{
|
{
|
||||||
`Log_Debug("Finished: Trader.static.OverwriteTraderItems");
|
`Log_Debug("Finished: Trader.static.OverwriteTraderItems");
|
||||||
Trader.static.OverwriteTraderItems(KFGRI, RepArray, LogLevel);
|
Trader.static.OverwriteTraderItems(KFGRI, RepArray, PatchRequired, LogLevel);
|
||||||
`Log_Info("Trader items successfully synchronized!");
|
`Log_Info("Trader items successfully synchronized!");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -152,6 +152,7 @@ public static simulated function Array< class<KFWeaponDefinition> > GenerateWeap
|
|||||||
public static simulated function OverwriteTraderItems(
|
public static simulated function OverwriteTraderItems(
|
||||||
KFGameReplicationInfo KFGRI,
|
KFGameReplicationInfo KFGRI,
|
||||||
const out Array<class<KFWeaponDefinition> > WeapDefs,
|
const out Array<class<KFWeaponDefinition> > WeapDefs,
|
||||||
|
bool ApplyPatch,
|
||||||
E_LogLevel LogLevel)
|
E_LogLevel LogLevel)
|
||||||
{
|
{
|
||||||
local CTI_GFxObject_TraderItems TraderItemsCTI;
|
local CTI_GFxObject_TraderItems TraderItemsCTI;
|
||||||
@ -188,7 +189,14 @@ public static simulated function OverwriteTraderItems(
|
|||||||
TraderItemsCTI.SetItemsInfo(TraderItemsCTI.SaleItems);
|
TraderItemsCTI.SetItemsInfo(TraderItemsCTI.SaleItems);
|
||||||
TraderItemsCTI.SetItemsInfo(TraderItemsCTI.AllItems);
|
TraderItemsCTI.SetItemsInfo(TraderItemsCTI.AllItems);
|
||||||
|
|
||||||
|
if (ApplyPatch)
|
||||||
|
{
|
||||||
KFGRI.TraderItems = TraderItemsCTI;
|
KFGRI.TraderItems = TraderItemsCTI;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
KFGRI.TraderItems.SaleItems = TraderItemsCTI.SaleItems;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function bool WeaponClassIsUnique(String WeaponClassPath, const out Array<class<KFWeaponDefinition> > WeapDefs, E_LogLevel LogLevel)
|
private static function bool WeaponClassIsUnique(String WeaponClassPath, const out Array<class<KFWeaponDefinition> > WeapDefs, E_LogLevel LogLevel)
|
||||||
|
Loading…
Reference in New Issue
Block a user