From ac0be532893fd6cb81832eba6b71726126eff0c9 Mon Sep 17 00:00:00 2001 From: inklesspen1scripter Date: Tue, 23 Jun 2020 15:48:24 +0300 Subject: [PATCH] Fixes and changes Fixed upgrades in WeaponSelectWidget Fixed original weapons in CustomTrader Removed dual 9mm and medpistol from trader MedicPistol: replaced GetPerk function just for fun CustomTrader is always active now Custom 9mm and medpistol added to trader for upgrades Removed 9mm and medpistol from PickupFactory (weapons that placed on map) Known bug: custom 9mm and medpistol haven't localization, i dont know how to fix that --- .../Classes/ExtHUD_WeaponSelectWidget.uc | 1 + ServerExt/Classes/ExtPlayerReplicationInfo.uc | 7 +- ServerExt/Classes/ExtWeapDef_9mm.uc | 10 ++ ServerExt/Classes/ExtWeapDef_MedicPistol.uc | 19 ++++ ServerExt/Classes/ExtWeap_Pistol_9mm.uc | 2 +- ServerExt/Classes/ExtWeap_Pistol_MedicS.uc | 11 +- ServerExtMut/Classes/ServerExtMut.uc | 103 ++++++++++++++---- 7 files changed, 128 insertions(+), 25 deletions(-) create mode 100644 ServerExt/Classes/ExtWeapDef_9mm.uc create mode 100644 ServerExt/Classes/ExtWeapDef_MedicPistol.uc diff --git a/ServerExt/Classes/ExtHUD_WeaponSelectWidget.uc b/ServerExt/Classes/ExtHUD_WeaponSelectWidget.uc index 6c3c9bd..d9256b9 100644 --- a/ServerExt/Classes/ExtHUD_WeaponSelectWidget.uc +++ b/ServerExt/Classes/ExtHUD_WeaponSelectWidget.uc @@ -63,6 +63,7 @@ simulated function SetWeaponGroupList(out array WeaponList, byte Group TempObj.SetString( "texturePath", "img://"$PathName(WeaponList[i].WeaponSelectTexture)); } + TempObj.SetInt("weaponTier", WeaponList[i].CurrentWeaponUpgradeIndex); TempObj.SetInt( "ammoCount", WeaponList[i].AmmoCount[0]); TempObj.SetInt( "spareAmmoCount", WeaponList[i].SpareAmmoCount[0]); //secondary ammo shenanigans diff --git a/ServerExt/Classes/ExtPlayerReplicationInfo.uc b/ServerExt/Classes/ExtPlayerReplicationInfo.uc index 4ba3d08..9a3e256 100644 --- a/ServerExt/Classes/ExtPlayerReplicationInfo.uc +++ b/ServerExt/Classes/ExtPlayerReplicationInfo.uc @@ -236,17 +236,16 @@ simulated reliable client function ClientAddTraderItem( int Index, FCustomTrader if( CustomList==None ) { - CustomList = CreateNewList(); + CustomList = CreateNewList(KFGameInfo(WorldInfo.Game).MyKFGRI.TraderItems); RecheckGRI(); } CustomItems.AddItem(Item); SetWeaponInfo(false,Index,Item,CustomList); } -simulated static final function KFGFxObject_TraderItems CreateNewList() +simulated static final function KFGFxObject_TraderItems CreateNewList(KFGFxObject_TraderItems B) { - local KFGFxObject_TraderItems L,B; + local KFGFxObject_TraderItems L; - B = class'KFGameReplicationInfo'.Default.TraderItems; L = new(B) class'KFGFxObject_TraderItems'; // Make clone of list. L.SaleItems = B.SaleItems; L.ArmorPrice = B.ArmorPrice; diff --git a/ServerExt/Classes/ExtWeapDef_9mm.uc b/ServerExt/Classes/ExtWeapDef_9mm.uc new file mode 100644 index 0000000..29dd8dc --- /dev/null +++ b/ServerExt/Classes/ExtWeapDef_9mm.uc @@ -0,0 +1,10 @@ +class ExtWeapDef_9mm extends KFWeapDef_9mm + abstract; + +DefaultProperties +{ + // Set free ammo + AmmoPricePerMag=0 + + WeaponClassPath="ServerExt.ExtWeap_Pistol_9mm" +} \ No newline at end of file diff --git a/ServerExt/Classes/ExtWeapDef_MedicPistol.uc b/ServerExt/Classes/ExtWeapDef_MedicPistol.uc new file mode 100644 index 0000000..612f82c --- /dev/null +++ b/ServerExt/Classes/ExtWeapDef_MedicPistol.uc @@ -0,0 +1,19 @@ +class ExtWeapDef_MedicPistol extends KFWeapDef_MedicPistol + abstract; + +DefaultProperties +{ + // Unsellable weapon + BuyPrice=0 + + // Free ammo + AmmoPricePerMag=0 + + WeaponClassPath="ServerExt.ExtWeap_Pistol_MedicS" + + // Unsellable upgrades + UpgradeSellPrice[0] = 0 + UpgradeSellPrice[1] = 0 + UpgradeSellPrice[2] = 0 + UpgradeSellPrice[3] = 0 +} \ No newline at end of file diff --git a/ServerExt/Classes/ExtWeap_Pistol_9mm.uc b/ServerExt/Classes/ExtWeap_Pistol_9mm.uc index 2662659..772b89e 100644 --- a/ServerExt/Classes/ExtWeap_Pistol_9mm.uc +++ b/ServerExt/Classes/ExtWeap_Pistol_9mm.uc @@ -7,7 +7,7 @@ defaultproperties bInfiniteSpareAmmo=True - DualClass=class'ExtWeap_Pistol_Dual9mm' + // DualClass=class'ServerExt.ExtWeap_Pistol_MedicS' InstantHitDamageTypes(DEFAULT_FIREMODE)=class'ExtDT_Ballistic_9mm' } diff --git a/ServerExt/Classes/ExtWeap_Pistol_MedicS.uc b/ServerExt/Classes/ExtWeap_Pistol_MedicS.uc index a7eb187..758c8f8 100644 --- a/ServerExt/Classes/ExtWeap_Pistol_MedicS.uc +++ b/ServerExt/Classes/ExtWeap_Pistol_MedicS.uc @@ -6,9 +6,11 @@ defaultproperties SpareAmmoCapacity[0]=-1 InitialSpareMags[0]=0 - bInfiniteSpareAmmo=True + // Remove weight bcs of replacing 9mm + InventorySize=0 + InstantHitDamageTypes(DEFAULT_FIREMODE)=class'ExtDT_Ballistic_Pistol_Medic' } @@ -29,4 +31,11 @@ simulated static event class GetWeaponPerkClass( class Instigato return InstigatorPerkClass; return default.AssociatedPerkClasses[0]; +} + +simulated function KFPerk GetPerk() +{ + if(KFPlayer != None) + return KFPlayer.GetPerk(); + return super.GetPerk(); } \ No newline at end of file diff --git a/ServerExtMut/Classes/ServerExtMut.uc b/ServerExtMut/Classes/ServerExtMut.uc index 482fe3f..17ab2ca 100644 --- a/ServerExtMut/Classes/ServerExtMut.uc +++ b/ServerExtMut/Classes/ServerExtMut.uc @@ -61,8 +61,8 @@ function PostBeginPlay() local ObjectReferencer OR; local Object O; local string S; - local FCustomTraderItem CI; local bool bLock; + local KFPickupFactory_Item ItemFactory; Super.PostBeginPlay(); if( WorldInfo.Game.BaseMutator==None ) @@ -91,6 +91,9 @@ 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'); + if( ServerMOTD=="" ) ServerMOTD = "Message of the Day"; if( StatFileDir=="" ) @@ -202,24 +205,6 @@ function PostBeginPlay() BonusGameFXObj = None; } - 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); - - if( CustomTrader==None ) - { - CustomTrader = class'ExtPlayerReplicationInfo'.Static.CreateNewList(); - SetTimer(0.1,false,'InitGRIList'); - } - class'ExtPlayerReplicationInfo'.Static.SetWeaponInfo(WorldInfo.NetMode==NM_DedicatedServer,CustomTrader.SaleItems.Length,CI,CustomTrader); - } if( ForcedMaxPlayers>0 ) { SetMaxPlayers(); @@ -242,7 +227,87 @@ function PostBeginPlay() if( bDumpXMLStats ) FileOutput = Spawn(class'ExtXMLOutput'); + + // Disable 9mm and medpistol in all PickupFactories + foreach AllActors(class'KFPickupFactory_Item', ItemFactory) + { + 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); + } +} + static final function string GetStatFile( const out UniqueNetId UID ) { return Repl(Default.StatFileDir,"%s","U_"$class'OnlineSubsystem'.Static.UniqueNetIdToString(UID));