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
This commit is contained in:
inklesspen1scripter 2020-06-23 15:48:24 +03:00
parent 2c78db14c2
commit ac0be53289
7 changed files with 128 additions and 25 deletions

View File

@ -63,6 +63,7 @@ simulated function SetWeaponGroupList(out array<KFWeapon> 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

View File

@ -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;

View File

@ -0,0 +1,10 @@
class ExtWeapDef_9mm extends KFWeapDef_9mm
abstract;
DefaultProperties
{
// Set free ammo
AmmoPricePerMag=0
WeaponClassPath="ServerExt.ExtWeap_Pistol_9mm"
}

View File

@ -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
}

View File

@ -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'
}

View File

@ -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'
}
@ -30,3 +32,10 @@ simulated static event class<KFPerk> GetWeaponPerkClass( class<KFPerk> Instigato
return default.AssociatedPerkClasses[0];
}
simulated function KFPerk GetPerk()
{
if(KFPlayer != None)
return KFPlayer.GetPerk();
return super.GetPerk();
}

View File

@ -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<CustomItems.Length; ++i )
{
CI.WeaponDef = class<KFWeaponDefinition>(DynamicLoadObject(CustomItems[i],class'Class'));
if( CI.WeaponDef==None )
continue;
CI.WeaponClass = class<KFWeapon>(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<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 FCustomTraderItem CI;
// local STraderItem SI;
// Remove dual 9mm, 9mm and medpistol
for(i=0;i<MyKFGI.MyKFGRI.TraderItems.SaleItems.Length;i++)
{
if(string(MyKFGI.MyKFGRI.TraderItems.SaleItems[i].ClassName) ~= "KFWeap_Pistol_Dual9mm")
{
MyKFGI.MyKFGRI.TraderItems.SaleItems.Remove(i,1);
i--;
}
else if(string(MyKFGI.MyKFGRI.TraderItems.SaleItems[i].ClassName) ~= "KFWeap_Pistol_Medic")
{
MyKFGI.MyKFGRI.TraderItems.SaleItems.Remove(i,1);
i--;
}
else if(string(MyKFGI.MyKFGRI.TraderItems.SaleItems[i].ClassName) ~= "KFWeap_Pistol_9mm")
{
MyKFGI.MyKFGRI.TraderItems.SaleItems.Remove(i,1);
i--;
}
}
// Reinfo and resorting items
MyKFGI.MyKFGRI.TraderItems.SetItemsInfo(MyKFGI.MyKFGRI.TraderItems.SaleItems);
MyKFGI.MyKFGRI.TraderItems.SortItemsInfo(MyKFGI.MyKFGRI.TraderItems.SaleItems);
// Creating custom trader
if( CustomTrader==None )
{
CustomTrader = class'ExtPlayerReplicationInfo'.Static.CreateNewList(MyKFGI.MyKFGRI.TraderItems);
SetTimer(0.1,false,'InitGRIList');
}
// Add custom 9mm for upgrades
CI.WeaponDef = class'ServerExt.ExtWeapDef_9mm';
CI.WeaponClass = class'ServerExt.ExtWeap_Pistol_9mm';
CustomItemList.AddItem(CI);
class'ExtPlayerReplicationInfo'.Static.SetWeaponInfo(WorldInfo.NetMode==NM_DedicatedServer,CustomTrader.SaleItems.Length,CI,CustomTrader);
// Add custom medpistol for upgrades
CI.WeaponDef = class'ServerExt.ExtWeapDef_MedicPistol';
CI.WeaponClass = class'ServerExt.ExtWeap_Pistol_MedicS';
CustomItemList.AddItem(CI);
class'ExtPlayerReplicationInfo'.Static.SetWeaponInfo(WorldInfo.NetMode==NM_DedicatedServer,CustomTrader.SaleItems.Length,CI,CustomTrader);
// Add custom items from WebAdmin
for( i=0; i<CustomItems.Length; ++i )
{
CI.WeaponDef = class<KFWeaponDefinition>(DynamicLoadObject(CustomItems[i],class'Class'));
if( CI.WeaponDef==None )
continue;
CI.WeaponClass = class<KFWeapon>(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));