From d848e56692f5198ef86a5fd4860da9ccbe07b531 Mon Sep 17 00:00:00 2001 From: inklesspen1scripter Date: Tue, 23 Jun 2020 23:38:04 +0300 Subject: [PATCH] Trader's things Trader: Custom trader can be disabled DLCs weapons added to trader (also can be disabled) Finally fixed trader Pistol upgrades can be disabled. Also. --- ServerExt/Classes/DLCWeapDef_Blunderbuss.uc | 7 + ServerExt/Classes/DLCWeapDef_ChainBat.uc | 7 + ServerExt/Classes/DLCWeapDef_ChiappaRhino.uc | 7 + .../Classes/DLCWeapDef_ChiappaRhinoDual.uc | 7 + ServerExt/Classes/DLCWeapDef_CompoundBow.uc | 7 + ServerExt/Classes/DLCWeapDef_FreezeThrower.uc | 7 + ServerExt/Classes/DLCWeapDef_G18.uc | 7 + ServerExt/Classes/DLCWeapDef_IonThruster.uc | 7 + ServerExt/Classes/DLCWeapDef_LazerCutter.uc | 7 + ServerExt/Classes/DLCWeapDef_MosinNagant.uc | 8 + .../Classes/DLCWeapDef_Pistol_DualG18.uc | 7 + ServerExt/Classes/DLCWeapDef_Pistol_G18C.uc | 7 + ServerExt/Classes/ExtHumanPawn.uc | 5 + ServerExt/Classes/ExtMenu_Gear.uc | 4 +- ServerExt/Classes/ExtPlayerReplicationInfo.uc | 13 +- ServerExtMut/Classes/ServerExtMut.uc | 179 +++++++++++++----- 16 files changed, 230 insertions(+), 56 deletions(-) create mode 100644 ServerExt/Classes/DLCWeapDef_Blunderbuss.uc create mode 100644 ServerExt/Classes/DLCWeapDef_ChainBat.uc create mode 100644 ServerExt/Classes/DLCWeapDef_ChiappaRhino.uc create mode 100644 ServerExt/Classes/DLCWeapDef_ChiappaRhinoDual.uc create mode 100644 ServerExt/Classes/DLCWeapDef_CompoundBow.uc create mode 100644 ServerExt/Classes/DLCWeapDef_FreezeThrower.uc create mode 100644 ServerExt/Classes/DLCWeapDef_G18.uc create mode 100644 ServerExt/Classes/DLCWeapDef_IonThruster.uc create mode 100644 ServerExt/Classes/DLCWeapDef_LazerCutter.uc create mode 100644 ServerExt/Classes/DLCWeapDef_MosinNagant.uc create mode 100644 ServerExt/Classes/DLCWeapDef_Pistol_DualG18.uc create mode 100644 ServerExt/Classes/DLCWeapDef_Pistol_G18C.uc diff --git a/ServerExt/Classes/DLCWeapDef_Blunderbuss.uc b/ServerExt/Classes/DLCWeapDef_Blunderbuss.uc new file mode 100644 index 0000000..7535a56 --- /dev/null +++ b/ServerExt/Classes/DLCWeapDef_Blunderbuss.uc @@ -0,0 +1,7 @@ +class DLCWeapDef_Blunderbuss extends KFWeapDef_Blunderbuss + abstract; + +DefaultProperties +{ + SharedUnlockId=SCU_None +} \ No newline at end of file diff --git a/ServerExt/Classes/DLCWeapDef_ChainBat.uc b/ServerExt/Classes/DLCWeapDef_ChainBat.uc new file mode 100644 index 0000000..120f7e2 --- /dev/null +++ b/ServerExt/Classes/DLCWeapDef_ChainBat.uc @@ -0,0 +1,7 @@ +class DLCWeapDef_ChainBat extends KFWeapDef_ChainBat + abstract; + +DefaultProperties +{ + SharedUnlockId=SCU_None +} \ No newline at end of file diff --git a/ServerExt/Classes/DLCWeapDef_ChiappaRhino.uc b/ServerExt/Classes/DLCWeapDef_ChiappaRhino.uc new file mode 100644 index 0000000..4d92566 --- /dev/null +++ b/ServerExt/Classes/DLCWeapDef_ChiappaRhino.uc @@ -0,0 +1,7 @@ +class DLCWeapDef_ChiappaRhino extends KFWeapDef_ChiappaRhino + abstract; + +DefaultProperties +{ + SharedUnlockId=SCU_None +} \ No newline at end of file diff --git a/ServerExt/Classes/DLCWeapDef_ChiappaRhinoDual.uc b/ServerExt/Classes/DLCWeapDef_ChiappaRhinoDual.uc new file mode 100644 index 0000000..447217c --- /dev/null +++ b/ServerExt/Classes/DLCWeapDef_ChiappaRhinoDual.uc @@ -0,0 +1,7 @@ +class DLCWeapDef_ChiappaRhinoDual extends KFWeapDef_ChiappaRhinoDual + abstract; + +DefaultProperties +{ + SharedUnlockId=SCU_None +} \ No newline at end of file diff --git a/ServerExt/Classes/DLCWeapDef_CompoundBow.uc b/ServerExt/Classes/DLCWeapDef_CompoundBow.uc new file mode 100644 index 0000000..77619fc --- /dev/null +++ b/ServerExt/Classes/DLCWeapDef_CompoundBow.uc @@ -0,0 +1,7 @@ +class DLCWeapDef_CompoundBow extends KFWeapDef_CompoundBow + abstract; + +DefaultProperties +{ + SharedUnlockId=SCU_None +} \ No newline at end of file diff --git a/ServerExt/Classes/DLCWeapDef_FreezeThrower.uc b/ServerExt/Classes/DLCWeapDef_FreezeThrower.uc new file mode 100644 index 0000000..648569b --- /dev/null +++ b/ServerExt/Classes/DLCWeapDef_FreezeThrower.uc @@ -0,0 +1,7 @@ +class DLCWeapDef_FreezeThrower extends KFWeapDef_FreezeThrower + abstract; + +DefaultProperties +{ + SharedUnlockId=SCU_None +} \ No newline at end of file diff --git a/ServerExt/Classes/DLCWeapDef_G18.uc b/ServerExt/Classes/DLCWeapDef_G18.uc new file mode 100644 index 0000000..404edc2 --- /dev/null +++ b/ServerExt/Classes/DLCWeapDef_G18.uc @@ -0,0 +1,7 @@ +class DLCWeapDef_G18 extends KFWeapDef_G18 + abstract; + +DefaultProperties +{ + SharedUnlockId=SCU_None +} \ No newline at end of file diff --git a/ServerExt/Classes/DLCWeapDef_IonThruster.uc b/ServerExt/Classes/DLCWeapDef_IonThruster.uc new file mode 100644 index 0000000..9b8321d --- /dev/null +++ b/ServerExt/Classes/DLCWeapDef_IonThruster.uc @@ -0,0 +1,7 @@ +class DLCWeapDef_IonThruster extends KFWeapDef_IonThruster + abstract; + +DefaultProperties +{ + SharedUnlockId=SCU_None +} \ No newline at end of file diff --git a/ServerExt/Classes/DLCWeapDef_LazerCutter.uc b/ServerExt/Classes/DLCWeapDef_LazerCutter.uc new file mode 100644 index 0000000..d3ca435 --- /dev/null +++ b/ServerExt/Classes/DLCWeapDef_LazerCutter.uc @@ -0,0 +1,7 @@ +class DLCWeapDef_LazerCutter extends KFWeapDef_LazerCutter + abstract; + +DefaultProperties +{ + SharedUnlockId=SCU_None +} \ No newline at end of file diff --git a/ServerExt/Classes/DLCWeapDef_MosinNagant.uc b/ServerExt/Classes/DLCWeapDef_MosinNagant.uc new file mode 100644 index 0000000..fe00c54 --- /dev/null +++ b/ServerExt/Classes/DLCWeapDef_MosinNagant.uc @@ -0,0 +1,8 @@ +class DLCWeapDef_MosinNagant extends KFWeapDef_MosinNagant + abstract; + +DefaultProperties +{ + WeaponClassPath="KFGameContent.KFWeap_Rifle_MosinNagant" + SharedUnlockId=SCU_None +} \ No newline at end of file diff --git a/ServerExt/Classes/DLCWeapDef_Pistol_DualG18.uc b/ServerExt/Classes/DLCWeapDef_Pistol_DualG18.uc new file mode 100644 index 0000000..ca641ae --- /dev/null +++ b/ServerExt/Classes/DLCWeapDef_Pistol_DualG18.uc @@ -0,0 +1,7 @@ +class DLCWeapDef_Pistol_DualG18 extends KFWeapDef_Pistol_DualG18 + abstract; + +DefaultProperties +{ + SharedUnlockId=SCU_None +} \ No newline at end of file diff --git a/ServerExt/Classes/DLCWeapDef_Pistol_G18C.uc b/ServerExt/Classes/DLCWeapDef_Pistol_G18C.uc new file mode 100644 index 0000000..89abd62 --- /dev/null +++ b/ServerExt/Classes/DLCWeapDef_Pistol_G18C.uc @@ -0,0 +1,7 @@ +class DLCWeapDef_Pistol_G18C extends KFWeapDef_Pistol_G18C + abstract; + +DefaultProperties +{ + SharedUnlockId=SCU_None +} \ No newline at end of file diff --git a/ServerExt/Classes/ExtHumanPawn.uc b/ServerExt/Classes/ExtHumanPawn.uc index 1b58271..ecd1c67 100644 --- a/ServerExt/Classes/ExtHumanPawn.uc +++ b/ServerExt/Classes/ExtHumanPawn.uc @@ -1336,4 +1336,9 @@ defaultproperties bAllowPerObjectShadowBatching=True End Object FPBodyMesh=FP_BodyComp +} + +simulated function bool CanBeHealed() +{ + return true; } \ No newline at end of file diff --git a/ServerExt/Classes/ExtMenu_Gear.uc b/ServerExt/Classes/ExtMenu_Gear.uc index c948271..6438123 100644 --- a/ServerExt/Classes/ExtMenu_Gear.uc +++ b/ServerExt/Classes/ExtMenu_Gear.uc @@ -2,7 +2,7 @@ class ExtMenu_Gear extends KFGFxObject_Menu; var ExtPlayerReplicationInfo ExtPRI; -var KFGFxObject_TraderItems TraderItems; +// var KFGFxObject_TraderItems TraderItems; var KFGFxGearContainer_PerksSelection PerkSelectionContainer; var KFCharacterInfo_Human CurrentCharInfo; var string CharInfoPath; @@ -19,7 +19,7 @@ function InitializeMenu( KFGFxMoviePlayer_Manager InManager ) LocalizeText(); EmoteList = class'ExtEmoteList'.static.GetEmoteArray(); InitCharacterMenu(); - TraderItems = KFGameReplicationInfo( GetPC().WorldInfo.GRI ).TraderItems; + // TraderItems = KFGameReplicationInfo( GetPC().WorldInfo.GRI ).TraderItems; } function InitCharacterMenu() { diff --git a/ServerExt/Classes/ExtPlayerReplicationInfo.uc b/ServerExt/Classes/ExtPlayerReplicationInfo.uc index 9a3e256..8a7c6a4 100644 --- a/ServerExt/Classes/ExtPlayerReplicationInfo.uc +++ b/ServerExt/Classes/ExtPlayerReplicationInfo.uc @@ -236,20 +236,21 @@ simulated reliable client function ClientAddTraderItem( int Index, FCustomTrader if( CustomList==None ) { - CustomList = CreateNewList(KFGameInfo(WorldInfo.Game).MyKFGRI.TraderItems); + CustomList = CreateNewList(); RecheckGRI(); } CustomItems.AddItem(Item); SetWeaponInfo(false,Index,Item,CustomList); } -simulated static final function KFGFxObject_TraderItems CreateNewList(KFGFxObject_TraderItems B) + +simulated static final function KFGFxObject_TraderItems CreateNewList() { local KFGFxObject_TraderItems L; - L = new(B) class'KFGFxObject_TraderItems'; // Make clone of list. - L.SaleItems = B.SaleItems; - L.ArmorPrice = B.ArmorPrice; - L.GrenadePrice = B.GrenadePrice; + L = new class'KFGFxObject_TraderItems'; + L.SaleItems = L.Default.SaleItems; + L.ArmorPrice = L.Default.ArmorPrice; + L.GrenadePrice = L.Default.GrenadePrice; return L; } diff --git a/ServerExtMut/Classes/ServerExtMut.uc b/ServerExtMut/Classes/ServerExtMut.uc index 17ab2ca..63ad157 100644 --- a/ServerExtMut/Classes/ServerExtMut.uc +++ b/ServerExtMut/Classes/ServerExtMut.uc @@ -38,7 +38,7 @@ var Object BonusGameFXObj; var array CustomItemList; var KFGFxObject_TraderItems CustomTrader; -const SettingsTagVer=12; +const SettingsTagVer=13; var KFGameReplicationInfo KF; var config int SettingsInit; var config int ForcedMaxPlayers,PlayerRespawnTime,LargeMonsterHP,StatAutoSaveWaves,MinUnloadPerkLevel,PostGameRespawnCost,MaxTopPlayers; @@ -50,6 +50,10 @@ var ExtSpawnPointHelper SpawnPointer; var bool bRespawnCheck,bSpecialSpawn,bGameHasEnded,bIsPostGame; var config bool bKillMessages,bDamageMessages,bEnableMapVote,bNoAdminCommands,bNoWebAdmin,bNoBoomstickJumping,bDumpXMLStats,bRagdollFromFall,bRagdollFromMomentum,bRagdollFromBackhit,bAddCountryTags; var config bool bServerPerksMode; +var config bool bDLCWeaponsForFree; +var config bool bDontUseOriginalWeaponry; +var config bool bAllowStandartPistolUpgrade; +var config bool bDisableCustomTrader; function PostBeginPlay() { @@ -91,8 +95,12 @@ function PostBeginPlay() KFGameInfo(WorldInfo.Game).CustomizationPawnClass = class'ExtPawn_Customization'; KFGameInfo(WorldInfo.Game).KFGFxManagerClass = class'ExtMoviePlayer_Manager'; - // Replace standart 9mm and medpistol from trader + additional custom items from WebAdmin - SetTimer(0.001, false, 'EditTraiderItems'); + // trader things + if(!bDisableCustomTrader && CustomTrader==None ) + { + CustomTrader = class'ExtPlayerReplicationInfo'.Static.CreateNewList(); + SetTimer(0.001, false, 'EditTraiderItems'); + } if( ServerMOTD=="" ) ServerMOTD = "Message of the Day"; @@ -149,6 +157,13 @@ function PostBeginPlay() } if( SettingsInit<9 ) MaxTopPlayers = 50; + + if(SettingsInit < 13) + { + bDLCWeaponsForFree = True; + bAllowStandartPistolUpgrade = True; + bDisableCustomTrader = False; + } SettingsInit = SettingsTagVer; SaveConfig(); } @@ -246,66 +261,112 @@ function PostBeginPlay() function EditTraiderItems() { local int i; - local FCustomTraderItem CI; + local KFGFxObject_TraderItems Trad; + // local FCustomTraderItem CI; // local STraderItem SI; + // var config bool bDLCWeaponsForFree; + // var config bool bDontUseOriginalWeaponry; - // Remove dual 9mm, 9mm and medpistol - for(i=0;i(DynamicLoadObject(CustomItems[i],class'Class')); - if( CI.WeaponDef==None ) - continue; - CI.WeaponClass = class(DynamicLoadObject(CI.WeaponDef.Default.WeaponClassPath,class'Class')); - if( CI.WeaponClass==None ) - continue; - - CustomItemList.AddItem(CI); - - class'ExtPlayerReplicationInfo'.Static.SetWeaponInfo(WorldInfo.NetMode==NM_DedicatedServer,CustomTrader.SaleItems.Length,CI,CustomTrader); + AddCIToTrader(CustomItems[i]); } + InitGRIList(); +} + +function AddCIToTrader(string weapdef) +{ + local FCustomTraderItem CI; + CI.WeaponDef = class(DynamicLoadObject(weapdef,class'Class')); + if(CI.WeaponDef == None) + return; + CI.WeaponClass = class(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 weapdef) +{ + local FCustomTraderItem CI; + CI.WeaponDef = weapdef; + if(CI.WeaponDef == None) + return; + CI.WeaponClass = class(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 ) @@ -1567,7 +1628,7 @@ function bool GetNextItem( ExtPlayerReplicationInfo PRI, int RepIndex ) { if( RepIndex>=CustomItemList.Length ) return false; - PRI.ClientAddTraderItem(class'KFGameReplicationInfo'.Default.TraderItems.SaleItems.Length+RepIndex,CustomItemList[RepIndex]); + PRI.ClientAddTraderItem(RepIndex,CustomItemList[RepIndex]); return true; } @@ -1619,6 +1680,14 @@ function string WebAdminGetValue( name PropName, int ElementIndex ) return string(MaxTopPlayers); case 'MinUnloadPerkLevel': return string(MinUnloadPerkLevel); + case 'bDontUseOriginalWeaponry': + return string(bDontUseOriginalWeaponry); + case 'bDisableCustomTrader': + return string(bDisableCustomTrader); + case 'bAllowStandartPistolUpgrade': + return string(bAllowStandartPistolUpgrade); + case 'bDLCWeaponsForFree': + return string(bDLCWeaponsForFree); case 'UnloadPerkExpCost': return string(UnloadPerkExpCost); case 'PerkClasses': @@ -1686,6 +1755,14 @@ function WebAdminSetValue( name PropName, int ElementIndex, string Value ) bRagdollFromMomentum = bool(Value); break; case 'bRagdollFromBackhit': bRagdollFromBackhit = bool(Value); break; + case 'bDontUseOriginalWeaponry': + bDontUseOriginalWeaponry = bool(Value); break; + case 'bDisableCustomTrader': + bDisableCustomTrader = bool(Value); break; + case 'bAllowStandartPistolUpgrade': + bAllowStandartPistolUpgrade = bool(Value); break; + case 'bDLCWeaponsForFree': + bDLCWeaponsForFree = bool(Value); break; case 'bAddCountryTags': bAddCountryTags = bool(Value); break; case 'MaxTopPlayers': @@ -1714,6 +1791,7 @@ defaultproperties { DevList.Add("0x0110000100E8984E") DevList.Add("0x01100001023DF8A8") + WebConfigs.Add((PropType=0,PropName="StatFileDir",UIName="Stat File Dir",UIDesc="Location of the stat files on the HDD (%s = unique player ID)")) WebConfigs.Add((PropType=0,PropName="ForcedMaxPlayers",UIName="Server Max Players",UIDesc="A forced max players value of the server (0 = use standard KF2 setting)")) WebConfigs.Add((PropType=0,PropName="PlayerRespawnTime",UIName="Respawn Time",UIDesc="Players respawn time in seconds after they die (0 = no respawning)")) @@ -1736,8 +1814,13 @@ defaultproperties WebConfigs.Add((PropType=2,PropName="PerkClasses",UIName="Perk Classes",UIDesc="List of RPG perks players can play as (careful with removing them, because any perks removed will permanently delete the gained XP for every player for that perk)!",NumElements=-1)) WebConfigs.Add((PropType=2,PropName="CustomChars",UIName="Custom Chars",UIDesc="List of custom characters for this server (prefix with * to mark as admin character).",NumElements=-1)) WebConfigs.Add((PropType=2,PropName="AdminCommands",UIName="Admin Commands",UIDesc="List of Admin commands to show on scoreboard UI for admins (use : to split actual command with display name for the command)",NumElements=-1)) - 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=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="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="bDLCWeaponsForFree",UIName="Free DLC weapons",UIDesc="Allows to buy DLC weapons")) + WebConfigs.Add((PropType=1,PropName="bAllowStandartPistolUpgrade",UIName="Standard pistol upgrades",UIDesc="Allows to upgrade standard pistol")) }