remove custom items

This commit is contained in:
GenZmeY 2022-09-16 05:50:42 +03:00
parent 5fd2af5f59
commit a273c2607d
5 changed files with 3 additions and 272 deletions

View File

@ -2,7 +2,6 @@ class ExtMenu_Gear extends KFGFxObject_Menu;
var ExtPlayerReplicationInfo ExtPRI; var ExtPlayerReplicationInfo ExtPRI;
// var KFGFxObject_TraderItems TraderItems;
var KFGFxGearContainer_PerksSelection PerkSelectionContainer; var KFGFxGearContainer_PerksSelection PerkSelectionContainer;
var KFCharacterInfo_Human CurrentCharInfo; var KFCharacterInfo_Human CurrentCharInfo;
var string CharInfoPath; var string CharInfoPath;
@ -19,7 +18,6 @@ function InitializeMenu(KFGFxMoviePlayer_Manager InManager)
LocalizeText(); LocalizeText();
EmoteList = class'ExtEmoteList'.static.GetEmoteArray(); EmoteList = class'ExtEmoteList'.static.GetEmoteArray();
InitCharacterMenu(); InitCharacterMenu();
// TraderItems = KFGameReplicationInfo(GetPC().WorldInfo.GRI).TraderItems;
} }
function InitCharacterMenu() function InitCharacterMenu()
@ -69,7 +67,6 @@ function OnOpen()
return; return;
CheckForCustomizationPawn(PC); CheckForCustomizationPawn(PC);
//GetGameViewportClient().HandleInputAxis = OnAxisModified;
if (PC.PlayerReplicationInfo.bReadyToPlay && PC.WorldInfo.GRI.bMatchHasBegun) if (PC.PlayerReplicationInfo.bReadyToPlay && PC.WorldInfo.GRI.bMatchHasBegun)
{ {

View File

@ -7,7 +7,6 @@ Class ExtPerkManager extends KFPerk;
enum EReplicateState enum EReplicateState
{ {
REP_CustomCharacters, REP_CustomCharacters,
REP_CustomInventory,
REP_PerkClasses, REP_PerkClasses,
REP_Done REP_Done
}; };
@ -451,14 +450,6 @@ function ReplicateTimer()
++RepIndex; ++RepIndex;
} }
break; break;
case REP_CustomInventory: // Replicate custom trader inventory
if (!PRIOwner.OnRepNextItem(PRIOwner,RepIndex))
{
RepIndex = 0;
++RepState;
}
else ++RepIndex;
break;
case REP_PerkClasses: // Open up all actor channel connections. case REP_PerkClasses: // Open up all actor channel connections.
if (RepIndex>=UserPerks.Length) if (RepIndex>=UserPerks.Length)
{ {

View File

@ -18,13 +18,6 @@ struct FMyCustomChar // Now without constant.
} }
}; };
// For custom trader inventory.
struct FCustomTraderItem
{
var class<KFWeaponDefinition> WeaponDef;
var class<KFWeapon> WeaponClass;
};
var bool bIsMuted,bInitialPT,bIsDev,bHiddenUser,bClientUseCustom,bClientFirstChar,bClientCharListDone,bClientInitChars; var bool bIsMuted,bInitialPT,bIsDev,bHiddenUser,bClientUseCustom,bClientFirstChar,bClientCharListDone,bClientInitChars;
enum E_AdminType enum E_AdminType
@ -58,10 +51,6 @@ var repnotify FMyCustomChar CustomCharacter;
var transient array<ExtCharDataInfo> SaveDataObjects; var transient array<ExtCharDataInfo> SaveDataObjects;
var transient ExtPlayerReplicationInfo LocalOwnerPRI; // Local playercontroller owner PRI var transient ExtPlayerReplicationInfo LocalOwnerPRI; // Local playercontroller owner PRI
// Custom trader inventory
var KFGFxObject_TraderItems CustomList;
var array<FCustomTraderItem> CustomItems;
// Supplier data: // Supplier data:
var transient struct FSupplierData var transient struct FSupplierData
{ {
@ -237,98 +226,6 @@ function UnsetPT()
bInitialPT = false; bInitialPT = false;
} }
Delegate bool OnRepNextItem(ExtPlayerReplicationInfo PRI, int RepIndex)
{
return false;
}
simulated reliable client function ClientAddTraderItem(int Index, FCustomTraderItem Item)
{
// Make sure to not execute on server.
if (WorldInfo.NetMode!=NM_Client && (PlayerController(Owner)==None || LocalPlayer(PlayerController(Owner).Player)==None))
return;
if (CustomList==None)
{
CustomList = CreateNewList();
RecheckGRI();
}
CustomItems.AddItem(Item);
SetWeaponInfo(false,Index,Item,CustomList);
}
simulated static final function KFGFxObject_TraderItems CreateNewList()
{
local KFGFxObject_TraderItems L;
L = new class'KFGFxObject_TraderItems';
L.SaleItems = L.Default.SaleItems;
L.ArmorPrice = L.Default.ArmorPrice;
L.GrenadePrice = L.Default.GrenadePrice;
return L;
}
simulated static final function SetWeaponInfo(bool bDedicated, int Index, FCustomTraderItem Item, KFGFxObject_TraderItems List)
{
local array<STraderItemWeaponStats> S;
local int i;
if (List.SaleItems.Length<=Index)
List.SaleItems.Length = Index+1;
List.SaleItems[Index].WeaponDef = Item.WeaponDef;
List.SaleItems[Index].ClassName = Item.WeaponClass.Name;
if (class<KFWeap_DualBase>(Item.WeaponClass)!=None && class<KFWeap_DualBase>(Item.WeaponClass).Default.SingleClass!=None)
List.SaleItems[Index].SingleClassName = class<KFWeap_DualBase>(Item.WeaponClass).Default.SingleClass.Name;
else List.SaleItems[Index].SingleClassName = '';
List.SaleItems[Index].DualClassName = Item.WeaponClass.Default.DualClass!=None ? Item.WeaponClass.Default.DualClass.Name : '';
List.SaleItems[Index].AssociatedPerkClasses = Item.WeaponClass.Static.GetAssociatedPerkClasses();
List.SaleItems[Index].MaxSpareAmmo = Item.WeaponClass.Default.SpareAmmoCapacity[0];
List.SaleItems[Index].MagazineCapacity = Item.WeaponClass.Default.MagazineCapacity[0];
List.SaleItems[Index].InitialSpareMags = Item.WeaponClass.Default.InitialSpareMags[0];
List.SaleItems[Index].MaxSecondaryAmmo = Item.WeaponClass.Default.MagazineCapacity[1] * Item.WeaponClass.Default.SpareAmmoCapacity[1];
List.SaleItems[Index].BlocksRequired = Item.WeaponClass.Default.InventorySize;
List.SaleItems[Index].ItemID = Index;
List.SaleItems[Index].InitialSecondaryAmmo = Item.WeaponClass.Default.InitialSpareMags[1];
List.SaleItems[Index].WeaponUpgradeDmgMultiplier[0] = 1.0;
for (i = 0;i<Min(Item.WeaponClass.Default.WeaponUpgrades.Length, 5);i++)
{
List.SaleItems[Index].WeaponUpgradeWeight[i+1] = Item.WeaponClass.Static.GetUpgradeStatAdd(EWUS_Weight, i+1);
List.SaleItems[Index].WeaponUpgradeDmgMultiplier[i+1] = Item.WeaponClass.Static.GetUpgradeStatScale(EWUS_Damage0, i+1);
}
if (!bDedicated)
{
List.SaleItems[Index].SecondaryAmmoImagePath = Item.WeaponClass.Default.SecondaryAmmoTexture!=None ? PathName(Item.WeaponClass.Default.SecondaryAmmoTexture) : "UI_SecondaryAmmo_TEX.GasTank";
List.SaleItems[Index].TraderFilter = Item.WeaponClass.Static.GetTraderFilter();
List.SaleItems[Index].InventoryGroup = Item.WeaponClass.Default.InventoryGroup;
List.SaleItems[Index].GroupPriority = Item.WeaponClass.Default.GroupPriority;
Item.WeaponClass.Static.SetTraderWeaponStats(S);
List.SaleItems[Index].WeaponStats = S;
}
}
simulated function RecheckGRI()
{
local ExtPlayerController PC;
if (KFGameReplicationInfo(WorldInfo.GRI)==None)
SetTimer(0.1,false,'RecheckGRI');
else
{
KFGameReplicationInfo(WorldInfo.GRI).TraderItems = CustomList;
foreach LocalPlayerControllers(class'ExtPlayerController',PC)
{
if (PC.PurchaseHelper!=None)
{
PC.PurchaseHelper.TraderItems = CustomList;
}
}
}
}
simulated final function bool ShowAdminName() simulated final function bool ShowAdminName()
{ {
return (bAdmin || AdminType < AT_Player); return (bAdmin || AdminType < AT_Player);

View File

@ -26,7 +26,7 @@ struct FSavedInvEntry
}; };
var array<FSavedInvEntry> PlayerInv; var array<FSavedInvEntry> PlayerInv;
var config array<string> PerkClasses,CustomChars,AdminCommands,CustomItems,BonusGameSongs,BonusGameFX; var config array<string> PerkClasses,CustomChars,AdminCommands,BonusGameSongs,BonusGameFX;
var config array<CFGCustomZedXP> CustomZedXP; var config array<CFGCustomZedXP> CustomZedXP;
var array< class<Ext_PerkBase> > LoadedPerks; var array< class<Ext_PerkBase> > LoadedPerks;
var array<FCustomCharEntry> CustomCharList; var array<FCustomCharEntry> CustomCharList;
@ -44,9 +44,6 @@ var transient class<DamageType> LastKillDamageType;
var SoundCue BonusGameCue; var SoundCue BonusGameCue;
var Object BonusGameFXObj; var Object BonusGameFXObj;
var array<FCustomTraderItem> CustomItemList;
var KFGFxObject_TraderItems CustomTrader;
const SettingsTagVer=14; const SettingsTagVer=14;
var KFGameReplicationInfo KF; var KFGameReplicationInfo KF;
var config int SettingsInit; var config int SettingsInit;
@ -58,9 +55,6 @@ var int LastWaveNum,NumWaveSwitches;
var ExtSpawnPointHelper SpawnPointer; var ExtSpawnPointHelper SpawnPointer;
var bool bRespawnCheck,bSpecialSpawn,bGameHasEnded,bIsPostGame; var bool bRespawnCheck,bSpecialSpawn,bGameHasEnded,bIsPostGame;
var config bool bKillMessages,bDamageMessages,bEnableMapVote,bNoAdminCommands,bNoWebAdmin,bNoBoomstickJumping,bDumpXMLStats,bRagdollFromFall,bRagdollFromMomentum,bRagdollFromBackhit,bAddCountryTags,bThrowAllWeaponsOnDeath; var config bool bKillMessages,bDamageMessages,bEnableMapVote,bNoAdminCommands,bNoWebAdmin,bNoBoomstickJumping,bDumpXMLStats,bRagdollFromFall,bRagdollFromMomentum,bRagdollFromBackhit,bAddCountryTags,bThrowAllWeaponsOnDeath;
var config bool bDontUseOriginalWeaponry;
var config bool bAllowStandartPistolUpgrade;
var config bool bDisableCustomTrader;
var KFGI_Access KFGIA; var KFGI_Access KFGIA;
@ -114,13 +108,6 @@ function PostBeginPlay()
KFGIA = new(KFGameInfo(WorldInfo.Game)) class'KFGI_Access'; KFGIA = new(KFGameInfo(WorldInfo.Game)) class'KFGI_Access';
// trader things
if (!bDisableCustomTrader && CustomTrader==None)
{
CustomTrader = class'ExtPlayerReplicationInfo'.Static.CreateNewList();
SetTimer(0.001, false, 'EditTraiderItems');
}
if (ServerMOTD=="") if (ServerMOTD=="")
ServerMOTD = "Message of the Day"; ServerMOTD = "Message of the Day";
if (StatFileDir=="") if (StatFileDir=="")
@ -177,11 +164,6 @@ function PostBeginPlay()
if (SettingsInit<9) if (SettingsInit<9)
MaxTopPlayers = 50; MaxTopPlayers = 50;
if (SettingsInit < 13)
{
bAllowStandartPistolUpgrade = True;
bDisableCustomTrader = False;
}
if (SettingsInit < 14) if (SettingsInit < 14)
{ {
bThrowAllWeaponsOnDeath = False; bThrowAllWeaponsOnDeath = False;
@ -293,96 +275,6 @@ function UpdateCustomZedXPArray()
} }
} }
// function CheckPickupFactories()
// {
// local KFPickupFactory_Item ItemFactory;
// // Disable 9mm and medpistol in all PickupFactories
// foreach AllActors(class'KFPickupFactory_Item', ItemFactory)
// {
// for (i=0;i<ItemFactory.ItemPickups.Length;i++)
// {
// if (ItemFactory.ItemPickups[i].ItemClass == class'KFGameContent.KFWeap_Pistol_9mm'
// || ItemFactory.ItemPickups[i].ItemClass == class'KFGameContent.KFWeap_Pistol_Medic')
// {
// ItemFactory.ItemPickups.Remove(i, 1);
// break;
// }
// }
// }
// }
function EditTraiderItems()
{
local int i;
local KFGFxObject_TraderItems Trad;
if (!bDontUseOriginalWeaponry)
{
Trad = KFGameReplicationInfo(WorldInfo.GRI).TraderItems;
// Remove dual 9mm, 9mm, medpistol
for (i=0;i<Trad.SaleItems.Length;i++)
{
if (string(Trad.SaleItems[i].ClassName) ~= "KFWeap_Pistol_Dual9mm"
|| string(Trad.SaleItems[i].ClassName) ~= "KFWeap_Pistol_Medic"
|| string(Trad.SaleItems[i].ClassName) ~= "KFWeap_Pistol_9mm")
{
// Remove pistols
continue;
}
// Adding original weapon
AddCIToTraderEx(Trad.SaleItems[i].WeaponDef);
}
}
// Reinfo and resorting items
// MyKFGI.MyKFGRI.TraderItems.SetItemsInfo(MyKFGI.MyKFGRI.TraderItems.SaleItems);
// MyKFGI.MyKFGRI.TraderItems.SortItemsInfo(MyKFGI.MyKFGRI.TraderItems.SaleItems);
if (bAllowStandartPistolUpgrade)
{
// Add custom 9mm for upgrades
AddCIToTrader("ServerExt.ExtWeapDef_9mm");
// Add custom medpistol for upgrades
AddCIToTrader("ServerExt.ExtWeapDef_MedicPistol");
}
// Add custom items from WebAdmin
for (i=0; i<CustomItems.Length; ++i)
{
AddCIToTrader(CustomItems[i]);
}
InitGRIList();
}
function AddCIToTrader(string weapdef)
{
local FCustomTraderItem CI;
CI.WeaponDef = class<KFWeaponDefinition>(DynamicLoadObject(weapdef,class'Class'));
if (CI.WeaponDef == None)
return;
CI.WeaponClass = class<KFWeapon>(DynamicLoadObject(CI.WeaponDef.Default.WeaponClassPath,class'Class'));
if (CI.WeaponClass == None)
return;
CustomItemList.AddItem(CI);
class'ExtPlayerReplicationInfo'.Static.SetWeaponInfo(WorldInfo.NetMode==NM_DedicatedServer,CustomTrader.SaleItems.Length,CI,CustomTrader);
}
function AddCIToTraderEx(class<KFWeaponDefinition> weapdef)
{
local FCustomTraderItem CI;
CI.WeaponDef = weapdef;
if (CI.WeaponDef == None)
return;
CI.WeaponClass = class<KFWeapon>(DynamicLoadObject(CI.WeaponDef.Default.WeaponClassPath,class'Class'));
if (CI.WeaponClass == None)
return;
CustomItemList.AddItem(CI);
class'ExtPlayerReplicationInfo'.Static.SetWeaponInfo(WorldInfo.NetMode==NM_DedicatedServer,CustomTrader.SaleItems.Length,CI,CustomTrader);
}
static final function string GetStatFile(const out UniqueNetId UID) static final function string GetStatFile(const out UniqueNetId UID)
{ {
return Repl(Default.StatFileDir,"%s","U_"$class'OnlineSubsystem'.Static.UniqueNetIdToString(UID)); return Repl(Default.StatFileDir,"%s","U_"$class'OnlineSubsystem'.Static.UniqueNetIdToString(UID));
@ -398,21 +290,6 @@ final function bool IsDev(const out UniqueNetId UID)
return false; return false;
} }
function InitGRIList()
{
local ExtPlayerController PC;
KFGameReplicationInfo(WorldInfo.GRI).TraderItems = CustomTrader;
// Must sync up local client.
if (WorldInfo.NetMode==NM_StandAlone)
{
foreach LocalPlayerControllers(class'ExtPlayerController',PC)
if (PC.PurchaseHelper!=None)
PC.PurchaseHelper.TraderItems = CustomTrader;
}
}
function CheckWave() function CheckWave()
{ {
if (KF==None) if (KF==None)
@ -881,8 +758,6 @@ function NotifyLogin(Controller NewPlayer)
if (bAddCountryTags && NetConnection(PlayerController(NewPlayer).Player)!=None) if (bAddCountryTags && NetConnection(PlayerController(NewPlayer).Player)!=None)
ExtPlayerReplicationInfo(NewPlayer.PlayerReplicationInfo).SetPlayerNameTag(class'CtryDatabase'.Static.GetClientCountryStr(PlayerController(NewPlayer).GetPlayerNetworkAddress())); ExtPlayerReplicationInfo(NewPlayer.PlayerReplicationInfo).SetPlayerNameTag(class'CtryDatabase'.Static.GetClientCountryStr(PlayerController(NewPlayer).GetPlayerNetworkAddress()));
ExtPlayerReplicationInfo(NewPlayer.PlayerReplicationInfo).bIsDev = IsDev(NewPlayer.PlayerReplicationInfo.UniqueId); ExtPlayerReplicationInfo(NewPlayer.PlayerReplicationInfo).bIsDev = IsDev(NewPlayer.PlayerReplicationInfo.UniqueId);
if (WorldInfo.NetMode!=NM_StandAlone)
ExtPlayerReplicationInfo(NewPlayer.PlayerReplicationInfo).OnRepNextItem = GetNextItem;
if (BonusGameCue!=None || BonusGameFXObj!=None) if (BonusGameCue!=None || BonusGameFXObj!=None)
ExtPlayerController(NewPlayer).ClientSetBonus(BonusGameCue,BonusGameFXObj); ExtPlayerController(NewPlayer).ClientSetBonus(BonusGameCue,BonusGameFXObj);
if (bRespawnCheck) if (bRespawnCheck)
@ -1703,14 +1578,6 @@ function PlayerChangeSpec(ExtPlayerController PC, bool bSpectator)
} }
} }
function bool GetNextItem(ExtPlayerReplicationInfo PRI, int RepIndex)
{
if (RepIndex>=CustomItemList.Length)
return false;
PRI.ClientAddTraderItem(RepIndex,CustomItemList[RepIndex]);
return true;
}
function InitWebAdmin(ExtWebAdmin_UI UI) function InitWebAdmin(ExtWebAdmin_UI UI)
{ {
local int i; local int i;
@ -1760,12 +1627,6 @@ function string WebAdminGetValue(name PropName, int ElementIndex)
return string(MaxTopPlayers); return string(MaxTopPlayers);
case 'MinUnloadPerkLevel': case 'MinUnloadPerkLevel':
return string(MinUnloadPerkLevel); return string(MinUnloadPerkLevel);
case 'bDontUseOriginalWeaponry':
return string(bDontUseOriginalWeaponry);
case 'bDisableCustomTrader':
return string(bDisableCustomTrader);
case 'bAllowStandartPistolUpgrade':
return string(bAllowStandartPistolUpgrade);
case 'UnloadPerkExpCost': case 'UnloadPerkExpCost':
return string(UnloadPerkExpCost); return string(UnloadPerkExpCost);
case 'PerkClasses': case 'PerkClasses':
@ -1774,8 +1635,6 @@ function string WebAdminGetValue(name PropName, int ElementIndex)
return (ElementIndex==-1 ? string(CustomChars.Length) : CustomChars[ElementIndex]); return (ElementIndex==-1 ? string(CustomChars.Length) : CustomChars[ElementIndex]);
case 'AdminCommands': case 'AdminCommands':
return (ElementIndex==-1 ? string(AdminCommands.Length) : AdminCommands[ElementIndex]); return (ElementIndex==-1 ? string(AdminCommands.Length) : AdminCommands[ElementIndex]);
case 'CustomItems':
return (ElementIndex==-1 ? string(CustomItems.Length) : CustomItems[ElementIndex]);
case 'ServerMOTD': case 'ServerMOTD':
return Repl(ServerMOTD,"|",Chr(10)); return Repl(ServerMOTD,"|",Chr(10));
case 'BonusGameSongs': case 'BonusGameSongs':
@ -1837,12 +1696,6 @@ function WebAdminSetValue(name PropName, int ElementIndex, string Value)
bRagdollFromMomentum = bool(Value); break; bRagdollFromMomentum = bool(Value); break;
case 'bRagdollFromBackhit': case 'bRagdollFromBackhit':
bRagdollFromBackhit = bool(Value); break; bRagdollFromBackhit = bool(Value); break;
case 'bDontUseOriginalWeaponry':
bDontUseOriginalWeaponry = bool(Value); break;
case 'bDisableCustomTrader':
bDisableCustomTrader = bool(Value); break;
case 'bAllowStandartPistolUpgrade':
bAllowStandartPistolUpgrade = bool(Value); break;
case 'bAddCountryTags': case 'bAddCountryTags':
bAddCountryTags = bool(Value); break; bAddCountryTags = bool(Value); break;
case 'MaxTopPlayers': case 'MaxTopPlayers':
@ -1855,8 +1708,6 @@ function WebAdminSetValue(name PropName, int ElementIndex, string Value)
UpdateArray(CustomChars,ElementIndex,Value); break; UpdateArray(CustomChars,ElementIndex,Value); break;
case 'AdminCommands': case 'AdminCommands':
UpdateArray(AdminCommands,ElementIndex,Value); break; UpdateArray(AdminCommands,ElementIndex,Value); break;
case 'CustomItems':
UpdateArray(CustomItems,ElementIndex,Value); break;
case 'BonusGameSongs': case 'BonusGameSongs':
UpdateArray(BonusGameSongs,ElementIndex,Value); break; UpdateArray(BonusGameSongs,ElementIndex,Value); break;
case 'BonusGameFX': case 'BonusGameFX':
@ -1905,9 +1756,4 @@ defaultproperties
WebConfigs.Add((PropType=3,PropName="ServerMOTD",UIName="MOTD",UIDesc="Message of the Day")) WebConfigs.Add((PropType=3,PropName="ServerMOTD",UIName="MOTD",UIDesc="Message of the Day"))
WebConfigs.Add((PropType=2,PropName="BonusGameSongs",UIName="Bonus Game Songs",UIDesc="List of custom musics to play during level change pong game.",NumElements=-1)) WebConfigs.Add((PropType=2,PropName="BonusGameSongs",UIName="Bonus Game Songs",UIDesc="List of custom musics to play during level change pong game.",NumElements=-1))
WebConfigs.Add((PropType=2,PropName="BonusGameFX",UIName="Bonus Game FX",UIDesc="List of custom FX to play on pong game.",NumElements=-1)) WebConfigs.Add((PropType=2,PropName="BonusGameFX",UIName="Bonus Game FX",UIDesc="List of custom FX to play on pong game.",NumElements=-1))
WebConfigs.Add((PropType=1,PropName="bDisableCustomTrader",UIName="Disable custom trader",UIDesc="Warning! That option will disable all settings below"))
WebConfigs.Add((PropType=2,PropName="CustomItems",UIName="Custom Inventory",UIDesc="List of custom inventory to add to trader (must be KFWeaponDefinition class).",NumElements=-1))
WebConfigs.Add((PropType=1,PropName="bDontUseOriginalWeaponry",UIName="Disable original weapons",UIDesc="Allows to buy default weapons"))
WebConfigs.Add((PropType=1,PropName="bAllowStandartPistolUpgrade",UIName="Standard pistol upgrades",UIDesc="Allows to upgrade standard pistol"))
} }

2
tools

@ -1 +1 @@
Subproject commit cd658d9af958a46be3d46679dde4e3af6109c59e Subproject commit 0e821f3dbbc6b3528f2028b0060d3b6f7f1c4b93