Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
561545de2b
|
|||
6dfbcbb0b7
|
|||
18fc55ce42
|
|||
6cc67da26b
|
|||
dc2108e482 | |||
37944a25c4
|
|||
ce070b66cd
|
|||
7e0151bf09
|
|||
f4cfa4948b
|
@ -187,18 +187,7 @@ private function PostInit()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Unlocker.static.UnlockDLC(KFGI, KFGRI, UnlockDLC, RemoveItems, AddItems, DLCSkinUpdateRequired, LogLevel))
|
WeapDefs = Trader.static.GenerateWeapDefList(
|
||||||
{
|
|
||||||
`Log_Info("DLC unlocked");
|
|
||||||
}
|
|
||||||
`Log_Debug("DLCSkinUpdateRequired:" @ String(DLCSkinUpdateRequired.Value));
|
|
||||||
|
|
||||||
if (bPreloadContent)
|
|
||||||
{
|
|
||||||
Preload(AddItems);
|
|
||||||
}
|
|
||||||
|
|
||||||
Trader.static.ModifyTrader(
|
|
||||||
KFGRI,
|
KFGRI,
|
||||||
RemoveItems,
|
RemoveItems,
|
||||||
AddItems,
|
AddItems,
|
||||||
@ -208,7 +197,23 @@ private function PostInit()
|
|||||||
bDisableItemLimitCheck,
|
bDisableItemLimitCheck,
|
||||||
LogLevel);
|
LogLevel);
|
||||||
|
|
||||||
WeapDefs = Trader.static.GetTraderWeapDefs(KFGRI, LogLevel);
|
RemoveItems.Length = 0;
|
||||||
|
AddItems.Length = 0;
|
||||||
|
|
||||||
|
if (Unlocker.static.UnlockDLC(KFGI, KFGRI, UnlockDLC, WeapDefs, DLCSkinUpdateRequired, LogLevel))
|
||||||
|
{
|
||||||
|
`Log_Info("DLC unlocked");
|
||||||
|
}
|
||||||
|
`Log_Debug("DLCSkinUpdateRequired:" @ String(DLCSkinUpdateRequired.Value));
|
||||||
|
|
||||||
|
Trader.static.OverwriteTraderItems(KFGRI, WeapDefs, LogLevel);
|
||||||
|
|
||||||
|
`Log_Info("Trader items:" @ WeapDefs.Length);
|
||||||
|
|
||||||
|
if (bPreloadContent)
|
||||||
|
{
|
||||||
|
Preload(WeapDefs);
|
||||||
|
}
|
||||||
|
|
||||||
ReadyToSync = true;
|
ReadyToSync = true;
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ var public bool PendingSync;
|
|||||||
var private CTI CTI;
|
var private CTI CTI;
|
||||||
var private E_LogLevel LogLevel;
|
var private E_LogLevel LogLevel;
|
||||||
|
|
||||||
|
var private GameReplicationInfo GRI;
|
||||||
var private KFPlayerController KFPC;
|
var private KFPlayerController KFPC;
|
||||||
var private KFPlayerReplicationInfo KFPRI;
|
var private KFPlayerReplicationInfo KFPRI;
|
||||||
var private KFGFxWidget_PartyInGame PartyInGameWidget;
|
var private KFGFxWidget_PartyInGame PartyInGameWidget;
|
||||||
@ -32,6 +33,7 @@ var private String NotificationRightText;
|
|||||||
var private int NotificationPercent;
|
var private int NotificationPercent;
|
||||||
|
|
||||||
var private int WaitingGRI;
|
var private int WaitingGRI;
|
||||||
|
var private int WaitingGRIThreshold;
|
||||||
var private int WaitingGRILimit;
|
var private int WaitingGRILimit;
|
||||||
|
|
||||||
var private ReplicationStruct RepData;
|
var private ReplicationStruct RepData;
|
||||||
@ -138,7 +140,7 @@ private simulated function Finished()
|
|||||||
|
|
||||||
`Log_Trace();
|
`Log_Trace();
|
||||||
|
|
||||||
if (WorldInfo.GRI == None && WaitingGRI++ < WaitingGRILimit)
|
if (GetGRI(WaitingGRI > WaitingGRIThreshold) == None && WaitingGRI++ < WaitingGRILimit)
|
||||||
{
|
{
|
||||||
`Log_Debug("Finished: Waiting GRI" @ WaitingGRI);
|
`Log_Debug("Finished: Waiting GRI" @ WaitingGRI);
|
||||||
NotifyWaitingGRI();
|
NotifyWaitingGRI();
|
||||||
@ -146,7 +148,7 @@ private simulated function Finished()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
KFGRI = KFGameReplicationInfo(WorldInfo.GRI);
|
KFGRI = KFGameReplicationInfo(GRI);
|
||||||
if (KFGRI != None)
|
if (KFGRI != None)
|
||||||
{
|
{
|
||||||
`Log_Debug("Finished: Trader.static.OverwriteTraderItems");
|
`Log_Debug("Finished: Trader.static.OverwriteTraderItems");
|
||||||
@ -155,7 +157,7 @@ private simulated function Finished()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
`Log_Error("Incompatible Replication info:" @ String(WorldInfo.GRI));
|
`Log_Error("Incompatible Replication info:" @ String(GRI));
|
||||||
NotifyIncompatibleGRI();
|
NotifyIncompatibleGRI();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,7 +182,13 @@ private simulated function UpdateSkinsDLC()
|
|||||||
{
|
{
|
||||||
foreach Replacements.default.DLC(WeapReplace)
|
foreach Replacements.default.DLC(WeapReplace)
|
||||||
{
|
{
|
||||||
if (WeapReplace.WeapParent.default.SkinItemId > 0 && WeapReplace.Weap.default.SkinItemId != WeapReplace.WeapParent.default.SkinItemId)
|
// sometimes "WeapReplace.Weap.default.SkinItemId" can give values greater than zero while actually being zero
|
||||||
|
// this is the same bug that prevents creating the correct default config
|
||||||
|
// so for now let’s shorten the check a little so that the skinId of the WeapReplace is guaranteed to be correct
|
||||||
|
// but if this bug is ever fixed, then it’s worth replacing the check with this one:
|
||||||
|
// if (WeapReplace.WeapParent.default.SkinItemId > 0 && WeapReplace.Weap.default.SkinItemId != WeapReplace.WeapParent.default.SkinItemId)
|
||||||
|
// to reduce the number of meaningless disk writes
|
||||||
|
if (WeapReplace.WeapParent.default.SkinItemId > 0)
|
||||||
{
|
{
|
||||||
`Log_Debug("Update skin for:" @ String(WeapReplace.WeapDef) @ "SkinId:" @ WeapReplace.WeapParent.default.SkinItemId);
|
`Log_Debug("Update skin for:" @ String(WeapReplace.WeapDef) @ "SkinId:" @ WeapReplace.WeapParent.default.SkinItemId);
|
||||||
class'KFWeaponSkinList'.static.SaveWeaponSkin(WeapReplace.WeapDef, WeapReplace.WeapParent.default.SkinItemId);
|
class'KFWeaponSkinList'.static.SaveWeaponSkin(WeapReplace.WeapDef, WeapReplace.WeapParent.default.SkinItemId);
|
||||||
@ -192,6 +200,29 @@ private simulated function UpdateSkinsDLC()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private simulated function GameReplicationInfo GetGRI(optional bool ForcedSearch = false)
|
||||||
|
{
|
||||||
|
`Log_Trace();
|
||||||
|
|
||||||
|
if (GRI == None)
|
||||||
|
{
|
||||||
|
GRI = WorldInfo.GRI;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GRI == None && ForcedSearch)
|
||||||
|
{
|
||||||
|
foreach WorldInfo.DynamicActors(class'GameReplicationInfo', GRI) break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (WorldInfo.GRI == None && GRI != None)
|
||||||
|
{
|
||||||
|
`Log_Warn("Force initialization of WorldInfo.GRI" @ String(GRI));
|
||||||
|
WorldInfo.GRI = GRI;
|
||||||
|
}
|
||||||
|
|
||||||
|
return GRI;
|
||||||
|
}
|
||||||
|
|
||||||
private simulated function KFPlayerController GetKFPC()
|
private simulated function KFPlayerController GetKFPC()
|
||||||
{
|
{
|
||||||
`Log_Trace();
|
`Log_Trace();
|
||||||
@ -332,6 +363,7 @@ private simulated function KeepNotification()
|
|||||||
|
|
||||||
private simulated function ClientCleanup()
|
private simulated function ClientCleanup()
|
||||||
{
|
{
|
||||||
|
`Log_Debug("Cleanup");
|
||||||
ServerCleanup();
|
ServerCleanup();
|
||||||
SafeDestroy();
|
SafeDestroy();
|
||||||
}
|
}
|
||||||
@ -340,7 +372,7 @@ private reliable server function ServerCleanup()
|
|||||||
{
|
{
|
||||||
`Log_Trace();
|
`Log_Trace();
|
||||||
|
|
||||||
`Log_Debug("Cleanup");
|
`Log_Debug("Cleanup" @ GetKFPC() @ GetKFPRI() == None? "" : GetKFPRI().PlayerName);
|
||||||
if (!CTI.DestroyRepInfo(GetKFPC()))
|
if (!CTI.DestroyRepInfo(GetKFPC()))
|
||||||
{
|
{
|
||||||
`Log_Debug("Cleanup (forced)");
|
`Log_Debug("Cleanup (forced)");
|
||||||
@ -381,7 +413,7 @@ private simulated function NotifyIncompatibleGRI()
|
|||||||
WriteToChatLocalized(
|
WriteToChatLocalized(
|
||||||
CTI_IncompatibleGRI,
|
CTI_IncompatibleGRI,
|
||||||
class'KFLocalMessage'.default.InteractionColor,
|
class'KFLocalMessage'.default.InteractionColor,
|
||||||
String(WorldInfo.GRI.class));
|
String(GRI.class));
|
||||||
WriteToChatLocalized(
|
WriteToChatLocalized(
|
||||||
CTI_IncompatibleGRIWarning,
|
CTI_IncompatibleGRIWarning,
|
||||||
class'KFLocalMessage'.default.InteractionColor);
|
class'KFLocalMessage'.default.InteractionColor);
|
||||||
@ -397,5 +429,6 @@ defaultproperties
|
|||||||
|
|
||||||
NotificationPercent = 0
|
NotificationPercent = 0
|
||||||
WaitingGRI = 0
|
WaitingGRI = 0
|
||||||
|
WaitingGRIThreshold = 15
|
||||||
WaitingGRILimit = 30
|
WaitingGRILimit = 30
|
||||||
}
|
}
|
||||||
|
13
CTI/Classes/CTI_WeapDef_MG3.uc
Normal file
13
CTI/Classes/CTI_WeapDef_MG3.uc
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
class CTI_WeapDef_MG3 extends KFWeapDef_MG3
|
||||||
|
abstract;
|
||||||
|
|
||||||
|
static function String GetItemLocalization(String KeyName)
|
||||||
|
{
|
||||||
|
return class'KFGame.KFWeapDef_MG3'.static.GetItemLocalization(KeyName);
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultproperties
|
||||||
|
{
|
||||||
|
SharedUnlockId = SCU_None
|
||||||
|
WeaponClassPath = "CTI.CTI_Weap_LMG_MG3"
|
||||||
|
}
|
6
CTI/Classes/CTI_Weap_LMG_MG3.uc
Normal file
6
CTI/Classes/CTI_Weap_LMG_MG3.uc
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
class CTI_Weap_LMG_MG3 extends KFWeap_LMG_MG3;
|
||||||
|
|
||||||
|
defaultproperties
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
@ -91,11 +91,11 @@ public static function Array<class<KFWeaponDefinition> > GetTraderWeapDefsDLC(KF
|
|||||||
return WeapDefs;
|
return WeapDefs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static simulated function ModifyTrader(
|
public static simulated function Array< class<KFWeaponDefinition> > GenerateWeapDefList(
|
||||||
KFGameReplicationInfo KFGRI,
|
KFGameReplicationInfo KFGRI,
|
||||||
const out Array<class<KFWeaponDefinition> > RemoveItems,
|
const out Array<class<KFWeaponDefinition> > RemoveItems,
|
||||||
const out Array<class<KFWeaponDefinition> > AddItems,
|
const out Array<class<KFWeaponDefinition> > AddItems,
|
||||||
bool ReplaceMode,
|
bool RemoveAll,
|
||||||
bool RemoveHRG,
|
bool RemoveHRG,
|
||||||
bool RemoveDLC,
|
bool RemoveDLC,
|
||||||
bool bDisableItemLimitCheck,
|
bool bDisableItemLimitCheck,
|
||||||
@ -103,14 +103,14 @@ public static simulated function ModifyTrader(
|
|||||||
{
|
{
|
||||||
local KFGFxObject_TraderItems TraderItems;
|
local KFGFxObject_TraderItems TraderItems;
|
||||||
local STraderItem Item;
|
local STraderItem Item;
|
||||||
local Array<class<KFWeaponDefinition> > WeapDefs;
|
local Array< class<KFWeaponDefinition> > WeapDefs;
|
||||||
local int Index;
|
local int Index;
|
||||||
|
|
||||||
`Log_TraceStatic();
|
`Log_TraceStatic();
|
||||||
|
|
||||||
TraderItems = GetTraderItems(KFGRI, LogLevel);
|
TraderItems = GetTraderItems(KFGRI, LogLevel);
|
||||||
|
|
||||||
if (!ReplaceMode)
|
if (!RemoveAll)
|
||||||
{
|
{
|
||||||
foreach TraderItems.SaleItems(Item)
|
foreach TraderItems.SaleItems(Item)
|
||||||
{
|
{
|
||||||
@ -127,7 +127,10 @@ public static simulated function ModifyTrader(
|
|||||||
|
|
||||||
for (Index = 0; Index < AddItems.Length; ++Index)
|
for (Index = 0; Index < AddItems.Length; ++Index)
|
||||||
{
|
{
|
||||||
WeapDefs.AddItem(AddItems[Index]);
|
if (WeaponClassIsUnique(AddItems[Index].default.WeaponClassPath, WeapDefs, LogLevel))
|
||||||
|
{
|
||||||
|
WeapDefs.AddItem(AddItems[Index]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WeapDefs.Sort(ByPrice);
|
WeapDefs.Sort(ByPrice);
|
||||||
@ -143,7 +146,7 @@ public static simulated function ModifyTrader(
|
|||||||
WeapDefs.Length = ITEMS_LIMIT;
|
WeapDefs.Length = ITEMS_LIMIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
OverwriteTraderItems(KFGRI, WeapDefs, LogLevel);
|
return WeapDefs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static simulated function OverwriteTraderItems(
|
public static simulated function OverwriteTraderItems(
|
||||||
|
@ -31,8 +31,7 @@ public static function bool UnlockDLC(
|
|||||||
KFGameInfo KFGI,
|
KFGameInfo KFGI,
|
||||||
KFGameReplicationInfo KFGRI,
|
KFGameReplicationInfo KFGRI,
|
||||||
String UnlockType,
|
String UnlockType,
|
||||||
out Array<class<KFWeaponDefinition> > RemoveItems,
|
out Array<class<KFWeaponDefinition> > WeapDefs,
|
||||||
out Array<class<KFWeaponDefinition> > AddItems,
|
|
||||||
out BoolWrapper DLCSkinUpdateRequired,
|
out BoolWrapper DLCSkinUpdateRequired,
|
||||||
E_LogLevel LogLevel)
|
E_LogLevel LogLevel)
|
||||||
{
|
{
|
||||||
@ -42,11 +41,10 @@ public static function bool UnlockDLC(
|
|||||||
{
|
{
|
||||||
case "true":
|
case "true":
|
||||||
case "auto":
|
case "auto":
|
||||||
return Auto(KFGI, KFGRI, RemoveItems, AddItems, DLCSkinUpdateRequired, LogLevel);
|
return Auto(KFGI, KFGRI, WeapDefs, DLCSkinUpdateRequired, LogLevel);
|
||||||
|
|
||||||
case "replaceweapons":
|
case "replaceweapons":
|
||||||
DLCSkinUpdateRequired.Value = true;
|
return ReplaceWeapons(KFGRI, WeapDefs, DLCSkinUpdateRequired, LogLevel);
|
||||||
return ReplaceWeapons(KFGRI, RemoveItems, AddItems, LogLevel);
|
|
||||||
|
|
||||||
case "replacefilter":
|
case "replacefilter":
|
||||||
DLCSkinUpdateRequired.Value = false;
|
DLCSkinUpdateRequired.Value = false;
|
||||||
@ -61,8 +59,7 @@ public static function bool UnlockDLC(
|
|||||||
private static function bool Auto(
|
private static function bool Auto(
|
||||||
KFGameInfo KFGI,
|
KFGameInfo KFGI,
|
||||||
KFGameReplicationInfo KFGRI,
|
KFGameReplicationInfo KFGRI,
|
||||||
out Array<class<KFWeaponDefinition> > RemoveItems,
|
out Array<class<KFWeaponDefinition> > WeapDefs,
|
||||||
out Array<class<KFWeaponDefinition> > AddItems,
|
|
||||||
out BoolWrapper DLCSkinUpdateRequired,
|
out BoolWrapper DLCSkinUpdateRequired,
|
||||||
E_LogLevel LogLevel)
|
E_LogLevel LogLevel)
|
||||||
{
|
{
|
||||||
@ -83,8 +80,7 @@ private static function bool Auto(
|
|||||||
|
|
||||||
if (CustomGFxManager)
|
if (CustomGFxManager)
|
||||||
{
|
{
|
||||||
DLCSkinUpdateRequired.Value = true;
|
return ReplaceWeapons(KFGRI, WeapDefs, DLCSkinUpdateRequired, LogLevel);
|
||||||
return ReplaceWeapons(KFGRI, RemoveItems, AddItems, LogLevel);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -95,14 +91,14 @@ private static function bool Auto(
|
|||||||
|
|
||||||
private static function bool ReplaceWeapons(
|
private static function bool ReplaceWeapons(
|
||||||
KFGameReplicationInfo KFGRI,
|
KFGameReplicationInfo KFGRI,
|
||||||
out Array<class<KFWeaponDefinition> > RemoveItems,
|
out Array<class<KFWeaponDefinition> > WeapDefs,
|
||||||
out Array<class<KFWeaponDefinition> > AddItems,
|
out BoolWrapper DLCSkinUpdateRequired,
|
||||||
E_LogLevel LogLevel)
|
E_LogLevel LogLevel)
|
||||||
{
|
{
|
||||||
local Array<class<KFWeaponDefinition> > WeapDefsDLCs;
|
local class<KFWeaponDefinition> WeapDef;
|
||||||
local class<KFWeaponDefinition> WeapDefDLC;
|
|
||||||
local class<KFWeaponDefinition> WeapDefReplacement;
|
local class<KFWeaponDefinition> WeapDefReplacement;
|
||||||
local bool Unlock, PartialUnlock;
|
local bool Unlock, PartialUnlock;
|
||||||
|
local int Index;
|
||||||
|
|
||||||
`Log_TraceStatic();
|
`Log_TraceStatic();
|
||||||
|
|
||||||
@ -110,30 +106,34 @@ private static function bool ReplaceWeapons(
|
|||||||
|
|
||||||
Unlock = false;
|
Unlock = false;
|
||||||
PartialUnlock = false;
|
PartialUnlock = false;
|
||||||
|
DLCSkinUpdateRequired.Value = false;
|
||||||
|
|
||||||
WeapDefsDLCs = Trader.static.GetTraderWeapDefsDLC(KFGRI, LogLevel);
|
for (Index = 0; Index < WeapDefs.Length; Index++)
|
||||||
|
|
||||||
foreach WeapDefsDLCs(WeapDefDLC)
|
|
||||||
{
|
{
|
||||||
WeapDefReplacement = PickReplacementWeapDefDLC(WeapDefDLC, LogLevel);
|
WeapDef = WeapDefs[Index];
|
||||||
|
|
||||||
|
if (WeapDef.default.SharedUnlockId == SCU_None) continue;
|
||||||
|
|
||||||
|
WeapDefReplacement = PickReplacementWeapDefDLC(WeapDef, LogLevel);
|
||||||
if (WeapDefReplacement != None)
|
if (WeapDefReplacement != None)
|
||||||
{
|
{
|
||||||
Unlock = true;
|
Unlock = true;
|
||||||
if (AddItems.Find(WeapDefReplacement) == INDEX_NONE)
|
DLCSkinUpdateRequired.Value = true;
|
||||||
|
if (WeapDefs.Find(WeapDefReplacement) == INDEX_NONE)
|
||||||
{
|
{
|
||||||
AddItems.AddItem(WeapDefReplacement);
|
WeapDefs[Index] = WeapDefReplacement;
|
||||||
|
`Log_Debug(WeapDef @ "replaced by" @ WeapDefReplacement);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WeapDefs.Remove(Index--, 1);
|
||||||
|
`Log_Debug("Skip already unlocked weapon:" @ WeapDef);
|
||||||
}
|
}
|
||||||
`Log_Debug(WeapDefDLC @ "replaced by" @ WeapDefReplacement);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PartialUnlock = true;
|
PartialUnlock = true;
|
||||||
`Log_Warn("Can't unlock item:" @ WeapDefDLC @ "SharedUnlockId:" @ WeapDefDLC.default.SharedUnlockId);
|
`Log_Warn("Can't unlock item:" @ WeapDef @ "SharedUnlockId:" @ WeapDef.default.SharedUnlockId);
|
||||||
}
|
|
||||||
|
|
||||||
if (RemoveItems.Find(WeapDefDLC) == INDEX_NONE)
|
|
||||||
{
|
|
||||||
RemoveItems.AddItem(WeapDefDLC);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,6 +102,12 @@ defaultproperties
|
|||||||
Weap=class'CTI_Weap_Edged_IonThruster',
|
Weap=class'CTI_Weap_Edged_IonThruster',
|
||||||
WeapParent=class'KFWeap_Edged_IonThruster'
|
WeapParent=class'KFWeap_Edged_IonThruster'
|
||||||
)})
|
)})
|
||||||
|
DLC.Add({(
|
||||||
|
WeapDef=class'CTI_WeapDef_MG3',
|
||||||
|
WeapDefParent=class'KFWeapDef_MG3',
|
||||||
|
Weap=class'CTI_Weap_LMG_MG3',
|
||||||
|
WeapParent=class'KFWeap_LMG_MG3'
|
||||||
|
)})
|
||||||
DLC.Add({(
|
DLC.Add({(
|
||||||
WeapDef=class'CTI_WeapDef_Mine_Reconstructor',
|
WeapDef=class'CTI_WeapDef_Mine_Reconstructor',
|
||||||
WeapDefParent=class'KFWeapDef_Mine_Reconstructor',
|
WeapDefParent=class'KFWeapDef_Mine_Reconstructor',
|
||||||
|
Reference in New Issue
Block a user