Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
c2c6006260
|
|||
6d7f0552db
|
@ -230,6 +230,7 @@ private function PostInit()
|
|||||||
{
|
{
|
||||||
if (RepInfo.PendingSync)
|
if (RepInfo.PendingSync)
|
||||||
{
|
{
|
||||||
|
RepInfo.PrepareSync(Self, LogLevel, KFGI.KFGFxManagerClass, DLCSkinUpdateRequired.Value, bApplyPatch);
|
||||||
RepInfo.Replicate(WeapDefs);
|
RepInfo.Replicate(WeapDefs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -348,12 +349,11 @@ public function bool CreateRepInfo(Controller C)
|
|||||||
|
|
||||||
if (RepInfo == None) return false;
|
if (RepInfo == None) return false;
|
||||||
|
|
||||||
RepInfo.PrepareSync(Self, KFPlayerController(C), LogLevel, DLCSkinUpdateRequired.Value, bApplyPatch);
|
|
||||||
|
|
||||||
RepInfos.AddItem(RepInfo);
|
RepInfos.AddItem(RepInfo);
|
||||||
|
|
||||||
if (ReadyToSync)
|
if (ReadyToSync)
|
||||||
{
|
{
|
||||||
|
RepInfo.PrepareSync(Self, LogLevel, KFGI.KFGFxManagerClass, DLCSkinUpdateRequired.Value, bApplyPatch);
|
||||||
RepInfo.Replicate(WeapDefs);
|
RepInfo.Replicate(WeapDefs);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -23,8 +23,9 @@ private function CTI_GFxObject_TraderItems GetCTI_TraderItems()
|
|||||||
|
|
||||||
private function CTI_InventoryManager GetCTI_IM()
|
private function CTI_InventoryManager GetCTI_IM()
|
||||||
{
|
{
|
||||||
if (CTI_IM == None)
|
if (CTI_IM != Pawn.InvManager)
|
||||||
{
|
{
|
||||||
|
`Log_Base("Update InvManager:" @ String(CTI_IM) @ "<-" @ String(Pawn.InvManager));
|
||||||
CTI_IM = CTI_InventoryManager(Pawn.InvManager);
|
CTI_IM = CTI_InventoryManager(Pawn.InvManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,18 @@
|
|||||||
class CTI_InventoryManager extends KFInventoryManager;
|
class CTI_InventoryManager extends KFInventoryManager;
|
||||||
|
|
||||||
|
var private CTI_RepInfo RepInfo;
|
||||||
|
|
||||||
|
public function Initialize(CTI_RepInfo _RepInfo)
|
||||||
|
{
|
||||||
|
RepInfo = _RepInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function OwnerDied()
|
||||||
|
{
|
||||||
|
RepInfo.SetTimer(1.0f, false, nameof(RepInfo.InitInventoryManager));
|
||||||
|
Super.OwnerDied();
|
||||||
|
}
|
||||||
|
|
||||||
// simulated function final BuyAmmo( float AmountPurchased, EItemType ItemType, optional byte ItemIndex, optional bool bSecondaryAmmo )
|
// simulated function final BuyAmmo( float AmountPurchased, EItemType ItemType, optional byte ItemIndex, optional bool bSecondaryAmmo )
|
||||||
public simulated function CTI_BuyAmmo(float AmountPurchased, EItemType ItemType, optional int ItemIndex, optional bool bSecondaryAmmo)
|
public simulated function CTI_BuyAmmo(float AmountPurchased, EItemType ItemType, optional int ItemIndex, optional bool bSecondaryAmmo)
|
||||||
{
|
{
|
||||||
@ -457,6 +470,35 @@ private reliable server function CTI_ServerBuyGrenade(int AmountPurchased)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public simulated function int GetWeaponBlocks(const out STraderItem ShopItem, optional int OverrideLevelValue = INDEX_NONE)
|
||||||
|
{
|
||||||
|
local int ItemUpgradeLevel;
|
||||||
|
local KFPlayerController KFPC;
|
||||||
|
local Inventory InventoryItem;
|
||||||
|
|
||||||
|
if (ShopItem.SingleClassName != '' && OverrideLevelValue == INDEX_NONE && ClassNameIsInInventory(ShopItem.SingleClassName, InventoryItem))
|
||||||
|
{
|
||||||
|
ItemUpgradeLevel = KFWeapon(InventoryItem).CurrentWeaponUpgradeIndex;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (OverrideLevelValue != INDEX_NONE)
|
||||||
|
{
|
||||||
|
ItemUpgradeLevel = OverrideLevelValue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
KFPC = KFPlayerController(Instigator.Owner);
|
||||||
|
if (KFPC != None)
|
||||||
|
{
|
||||||
|
ItemUpgradeLevel = KFPC.GetPurchaseHelper().GetItemUpgradeLevelByClassName(ShopItem.ClassName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ShopItem.BlocksRequired + (ItemUpgradeLevel > INDEX_NONE ? ShopItem.WeaponUpgradeWeight[ItemUpgradeLevel] : 0);
|
||||||
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -23,6 +23,8 @@ var public bool PendingSync;
|
|||||||
var private CTI CTI;
|
var private CTI CTI;
|
||||||
var private E_LogLevel LogLevel;
|
var private E_LogLevel LogLevel;
|
||||||
|
|
||||||
|
var private class<KFGFxMoviePlayer_Manager> FrontEndClass;
|
||||||
|
|
||||||
var private GameReplicationInfo GRI;
|
var private GameReplicationInfo GRI;
|
||||||
var private KFPlayerController KFPC;
|
var private KFPlayerController KFPC;
|
||||||
var private KFPlayerReplicationInfo KFPRI;
|
var private KFPlayerReplicationInfo KFPRI;
|
||||||
@ -49,7 +51,7 @@ var private bool ClientReady, ServerReady;
|
|||||||
replication
|
replication
|
||||||
{
|
{
|
||||||
if (bNetInitial && Role == ROLE_Authority)
|
if (bNetInitial && Role == ROLE_Authority)
|
||||||
LogLevel, SkinUpdateRequired, PatchRequired;
|
LogLevel, SkinUpdateRequired, PatchRequired, FrontEndClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public simulated function bool SafeDestroy()
|
public simulated function bool SafeDestroy()
|
||||||
@ -60,24 +62,50 @@ public simulated function bool SafeDestroy()
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function PrepareSync(
|
public function PrepareSync(
|
||||||
CTI _CTI, KFPlayerController _KFPC, E_LogLevel _LogLevel,
|
CTI _CTI, E_LogLevel _LogLevel,
|
||||||
|
class<KFGFxMoviePlayer_Manager> _FrontEndClass,
|
||||||
bool _SkinUpdateRequired, bool _PatchRequired)
|
bool _SkinUpdateRequired, bool _PatchRequired)
|
||||||
{
|
{
|
||||||
`Log_Trace();
|
`Log_Trace();
|
||||||
|
|
||||||
CTI = _CTI;
|
CTI = _CTI;
|
||||||
KFPC = _KFPC;
|
|
||||||
LogLevel = _LogLevel;
|
LogLevel = _LogLevel;
|
||||||
|
FrontEndClass = _FrontEndClass;
|
||||||
SkinUpdateRequired = _SkinUpdateRequired;
|
SkinUpdateRequired = _SkinUpdateRequired;
|
||||||
PatchRequired = _PatchRequired;
|
PatchRequired = _PatchRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private reliable client function ClientSetFrontEnd()
|
||||||
|
{
|
||||||
|
if (FrontEndClass == None || GetKFPRI() == None)
|
||||||
|
{
|
||||||
|
`Log_Debug("Wait for frontend");
|
||||||
|
SetTimer(1.0f, false, nameof(ClientSetFrontEnd));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (KFPC.MyGFxManager != None && KFPC.MyGFxManager.class == FrontEndClass)
|
||||||
|
{
|
||||||
|
`Log_Debug("MyGFxManager is ok:" @ String(KFPC.MyGFxManager.class));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
KFPC.MyGFxManager.CloseMenus(true);
|
||||||
|
KFPC.MyGFxManager = None;
|
||||||
|
|
||||||
|
KFPC.ClientSetFrontEnd(FrontEndClass, KFPRI.bOnlySpectator);
|
||||||
|
|
||||||
|
`Log_Debug(String(FrontEndClass) @ "initialized.");
|
||||||
|
}
|
||||||
|
|
||||||
public function Replicate(const out Array<class<KFWeaponDefinition> > WeapDefs)
|
public function Replicate(const out Array<class<KFWeaponDefinition> > WeapDefs)
|
||||||
{
|
{
|
||||||
`Log_Trace();
|
`Log_Trace();
|
||||||
|
|
||||||
ServerReady = !PatchRequired;
|
ServerReady = !PatchRequired;
|
||||||
|
|
||||||
|
ClientSetFrontEnd();
|
||||||
|
|
||||||
if (PatchRequired)
|
if (PatchRequired)
|
||||||
{
|
{
|
||||||
if (GetKFPC() != None)
|
if (GetKFPC() != None)
|
||||||
@ -92,14 +120,15 @@ public function Replicate(const out Array<class<KFWeaponDefinition> > WeapDefs)
|
|||||||
RepArray = WeapDefs;
|
RepArray = WeapDefs;
|
||||||
RepData.Size = RepArray.Length;
|
RepData.Size = RepArray.Length;
|
||||||
|
|
||||||
if (WorldInfo.NetMode == NM_StandAlone)
|
if (WorldInfo.NetMode != NM_StandAlone)
|
||||||
{
|
{
|
||||||
Progress(RepArray.Length, RepArray.Length);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Sync();
|
Sync();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Finished();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private reliable server function Sync()
|
private reliable server function Sync()
|
||||||
{
|
{
|
||||||
@ -179,7 +208,10 @@ private simulated function Finished()
|
|||||||
if (KFGRI != None)
|
if (KFGRI != None)
|
||||||
{
|
{
|
||||||
`Log_Debug("Finished: Trader.static.OverwriteTraderItems");
|
`Log_Debug("Finished: Trader.static.OverwriteTraderItems");
|
||||||
|
if (WorldInfo.NetMode != NM_StandAlone)
|
||||||
|
{
|
||||||
Trader.static.OverwriteTraderItems(KFGRI, RepArray, PatchRequired, LogLevel);
|
Trader.static.OverwriteTraderItems(KFGRI, RepArray, PatchRequired, LogLevel);
|
||||||
|
}
|
||||||
`Log_Info("Trader items successfully synchronized!");
|
`Log_Info("Trader items successfully synchronized!");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -414,6 +446,12 @@ private reliable server function Cleanup()
|
|||||||
{
|
{
|
||||||
`Log_Trace();
|
`Log_Trace();
|
||||||
|
|
||||||
|
if (PatchRequired)
|
||||||
|
{
|
||||||
|
`Log_Debug("Skip cleanup to keep CTI_RepInfo alive");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
`Log_Debug("Cleanup" @ GetKFPC() @ GetKFPRI() == None? "" : GetKFPRI().PlayerName);
|
`Log_Debug("Cleanup" @ GetKFPC() @ GetKFPRI() == None? "" : GetKFPRI().PlayerName);
|
||||||
if (!CTI.DestroyRepInfo(GetKFPC()))
|
if (!CTI.DestroyRepInfo(GetKFPC()))
|
||||||
{
|
{
|
||||||
@ -434,7 +472,7 @@ public function InitInventoryManager()
|
|||||||
|
|
||||||
`Log_Trace();
|
`Log_Trace();
|
||||||
|
|
||||||
if (GetKFPRI() == None || !KFPRI.bHasSpawnedIn)
|
if (GetKFPRI() == None || !KFPRI.bHasSpawnedIn || KFPC.Pawn == None)
|
||||||
{
|
{
|
||||||
`Log_Debug("Wait for spawn (InventoryManager)");
|
`Log_Debug("Wait for spawn (InventoryManager)");
|
||||||
SetTimer(1.0f, false, nameof(InitInventoryManager));
|
SetTimer(1.0f, false, nameof(InitInventoryManager));
|
||||||
@ -445,6 +483,7 @@ public function InitInventoryManager()
|
|||||||
|
|
||||||
KFPC.Pawn.InventoryManagerClass = InventoryManager;
|
KFPC.Pawn.InventoryManagerClass = InventoryManager;
|
||||||
NextInventoryManger = Spawn(KFPC.Pawn.InventoryManagerClass, KFPC.Pawn);
|
NextInventoryManger = Spawn(KFPC.Pawn.InventoryManagerClass, KFPC.Pawn);
|
||||||
|
CTI_InventoryManager(NextInventoryManger).Initialize(Self);
|
||||||
|
|
||||||
if (NextInventoryManger == None)
|
if (NextInventoryManger == None)
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@ class RemoveItems extends Object
|
|||||||
dependson(CTI)
|
dependson(CTI)
|
||||||
config(CTI);
|
config(CTI);
|
||||||
|
|
||||||
var public config bool bAll;
|
var public config bool bALL;
|
||||||
var public config bool bHRG;
|
var public config bool bHRG;
|
||||||
var public config bool bDLC;
|
var public config bool bDLC;
|
||||||
var private config Array<String> Item;
|
var private config Array<String> Item;
|
||||||
@ -29,11 +29,11 @@ public static function InitConfig(int Version, int LatestVersion)
|
|||||||
|
|
||||||
private static function ApplyDefault()
|
private static function ApplyDefault()
|
||||||
{
|
{
|
||||||
default.bAll = false;
|
default.bALL = false;
|
||||||
default.bHRG = false;
|
default.bHRG = false;
|
||||||
default.bDLC = false;
|
default.bDLC = false;
|
||||||
default.Item.Length = 0;
|
default.Item.Length = 0;
|
||||||
default.Item.AddItem("KFGame.KFWeapDef_9mmDual");
|
default.Item.AddItem("KFGame.SomeWeapon");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function Array<class<KFWeaponDefinition> > Load(E_LogLevel LogLevel)
|
public static function Array<class<KFWeaponDefinition> > Load(E_LogLevel LogLevel)
|
||||||
@ -45,7 +45,7 @@ public static function Array<class<KFWeaponDefinition> > Load(E_LogLevel LogLeve
|
|||||||
local int Line;
|
local int Line;
|
||||||
|
|
||||||
`Log_Info("Load items to remove:");
|
`Log_Info("Load items to remove:");
|
||||||
if (default.bAll)
|
if (default.bALL)
|
||||||
{
|
{
|
||||||
`Log_Info("Remove all default items");
|
`Log_Info("Remove all default items");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user