refactor: DLC weapons for free

- unlocks all dlc, including future ones;
- "bDLCWeaponsForFree" deprecated.
This commit is contained in:
GenZmeY 2021-01-10 06:27:50 +03:00
parent 60ba914cef
commit 54a46e2c37
17 changed files with 17 additions and 160 deletions

View File

@ -1,7 +0,0 @@
class DLCWeapDef_Blunderbuss extends KFWeapDef_Blunderbuss
abstract;
DefaultProperties
{
SharedUnlockId=SCU_None
}

View File

@ -1,7 +0,0 @@
class DLCWeapDef_ChainBat extends KFWeapDef_ChainBat
abstract;
DefaultProperties
{
SharedUnlockId=SCU_None
}

View File

@ -1,7 +0,0 @@
class DLCWeapDef_ChiappaRhino extends KFWeapDef_ChiappaRhino
abstract;
DefaultProperties
{
SharedUnlockId=SCU_None
}

View File

@ -1,7 +0,0 @@
class DLCWeapDef_ChiappaRhinoDual extends KFWeapDef_ChiappaRhinoDual
abstract;
DefaultProperties
{
SharedUnlockId=SCU_None
}

View File

@ -1,7 +0,0 @@
class DLCWeapDef_CompoundBow extends KFWeapDef_CompoundBow
abstract;
DefaultProperties
{
SharedUnlockId=SCU_None
}

View File

@ -1,7 +0,0 @@
class DLCWeapDef_FreezeThrower extends KFWeapDef_FreezeThrower
abstract;
DefaultProperties
{
SharedUnlockId=SCU_None
}

View File

@ -1,7 +0,0 @@
class DLCWeapDef_G18 extends KFWeapDef_G18
abstract;
DefaultProperties
{
SharedUnlockId=SCU_None
}

View File

@ -1,7 +0,0 @@
class DLCWeapDef_IonThruster extends KFWeapDef_IonThruster
abstract;
DefaultProperties
{
SharedUnlockId=SCU_None
}

View File

@ -1,7 +0,0 @@
class DLCWeapDef_LazerCutter extends KFWeapDef_LazerCutter
abstract;
DefaultProperties
{
SharedUnlockId=SCU_None
}

View File

@ -1,7 +0,0 @@
class DLCWeapDef_Mine_Reconstructor extends KFWeapDef_Mine_Reconstructor
abstract;
DefaultProperties
{
SharedUnlockId=SCU_None
}

View File

@ -1,7 +0,0 @@
class DLCWeapDef_Minigun extends KFWeapDef_Minigun
abstract;
DefaultProperties
{
SharedUnlockId=SCU_None
}

View File

@ -1,8 +0,0 @@
class DLCWeapDef_MosinNagant extends KFWeapDef_MosinNagant
abstract;
DefaultProperties
{
WeaponClassPath="KFGameContent.KFWeap_Rifle_MosinNagant"
SharedUnlockId=SCU_None
}

View File

@ -1,7 +0,0 @@
class DLCWeapDef_Pistol_DualG18 extends KFWeapDef_Pistol_DualG18
abstract;
DefaultProperties
{
SharedUnlockId=SCU_None
}

View File

@ -1,7 +0,0 @@
class DLCWeapDef_Pistol_G18C extends KFWeapDef_Pistol_G18C
abstract;
DefaultProperties
{
SharedUnlockId=SCU_None
}

View File

@ -1,7 +0,0 @@
class DLCWeapDef_Rifle_FrostShotgunAxe extends KFWeapDef_Rifle_FrostShotgunAxe
abstract;
DefaultProperties
{
SharedUnlockId=SCU_None
}

View File

@ -1,5 +1,20 @@
class ExtTraderContainer_Store extends KFGFxTraderContainer_Store; class ExtTraderContainer_Store extends KFGFxTraderContainer_Store;
/** returns true if this item should not be displayed */
function bool IsItemFiltered(STraderItem Item, optional bool bDebug)
{
if (KFPC.GetPurchaseHelper().IsInOwnedItemList(Item.ClassName))
return true;
if ( KFPC.GetPurchaseHelper().IsInOwnedItemList(Item.DualClassName) )
return true;
if (!KFPC.GetPurchaseHelper().IsSellable(Item))
return true;
if ( Item.WeaponDef.default.PlatformRestriction != PR_All && class'KFUnlockManager'.static.IsPlatformRestricted( Item.WeaponDef.default.PlatformRestriction ) )
return true;
return false;
}
function RefreshWeaponListByPerk(byte FilterIndex, const out array<STraderItem> ItemList) function RefreshWeaponListByPerk(byte FilterIndex, const out array<STraderItem> ItemList)
{ {
local int i, SlotIndex; local int i, SlotIndex;

View File

@ -59,7 +59,6 @@ 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; var config bool bKillMessages,bDamageMessages,bEnableMapVote,bNoAdminCommands,bNoWebAdmin,bNoBoomstickJumping,bDumpXMLStats,bRagdollFromFall,bRagdollFromMomentum,bRagdollFromBackhit,bAddCountryTags;
var config bool bServerPerksMode; var config bool bServerPerksMode;
var config bool bDLCWeaponsForFree;
var config bool bDontUseOriginalWeaponry; var config bool bDontUseOriginalWeaponry;
var config bool bAllowStandartPistolUpgrade; var config bool bAllowStandartPistolUpgrade;
var config bool bDisableCustomTrader; var config bool bDisableCustomTrader;
@ -176,7 +175,6 @@ function PostBeginPlay()
if (SettingsInit < 13) if (SettingsInit < 13)
{ {
bDLCWeaponsForFree = True;
bAllowStandartPistolUpgrade = True; bAllowStandartPistolUpgrade = True;
bDisableCustomTrader = False; bDisableCustomTrader = False;
} }
@ -310,14 +308,11 @@ function EditTraiderItems()
{ {
local int i; local int i;
local KFGFxObject_TraderItems Trad; local KFGFxObject_TraderItems Trad;
// local FCustomTraderItem CI;
// local STraderItem SI;
// var config bool bDLCWeaponsForFree;
// var config bool bDontUseOriginalWeaponry;
if (!bDontUseOriginalWeaponry) if (!bDontUseOriginalWeaponry)
{ {
Trad = KFGameReplicationInfo(WorldInfo.GRI).TraderItems; Trad = KFGameReplicationInfo(WorldInfo.GRI).TraderItems;
// Remove dual 9mm, 9mm, medpistol and DLC weapons // Remove dual 9mm, 9mm, medpistol
for (i=0;i<Trad.SaleItems.Length;i++) for (i=0;i<Trad.SaleItems.Length;i++)
{ {
if (string(Trad.SaleItems[i].ClassName) ~= "KFWeap_Pistol_Dual9mm" if (string(Trad.SaleItems[i].ClassName) ~= "KFWeap_Pistol_Dual9mm"
@ -328,28 +323,6 @@ function EditTraiderItems()
continue; continue;
} }
if (bDLCWeaponsForFree)
{
// DLC Weapons
if (string(Trad.SaleItems[i].ClassName) ~= "KFWeap_Pistol_Blunderbuss"
|| string(Trad.SaleItems[i].ClassName) ~= "KFWeap_Blunt_ChainBat"
|| string(Trad.SaleItems[i].ClassName) ~= "KFWeap_Pistol_ChiappaRhino"
|| string(Trad.SaleItems[i].ClassName) ~= "KFWeap_Pistol_ChiappaRhinoDual"
|| string(Trad.SaleItems[i].ClassName) ~= "KFWeap_Bow_CompoundBow"
|| string(Trad.SaleItems[i].ClassName) ~= "KFWeap_Ice_FreezeThrower"
|| string(Trad.SaleItems[i].ClassName) ~= "KFWeap_Edged_IonThruster"
|| string(Trad.SaleItems[i].ClassName) ~= "KFWeap_Rifle_MosinNagant"
|| string(Trad.SaleItems[i].ClassName) ~= "KFWeap_AssaultRifle_LazerCutter"
|| string(Trad.SaleItems[i].ClassName) ~= "KFWeap_SMG_G18"
|| string(Trad.SaleItems[i].ClassName) ~= "KFWeap_Pistol_DualG18"
|| string(Trad.SaleItems[i].ClassName) ~= "KFWeap_Mine_Reconstructor"
|| string(Trad.SaleItems[i].ClassName) ~= "KFWeap_Minigun"
|| string(Trad.SaleItems[i].ClassName) ~= "KFWeap_Rifle_FrostShotgunAxe")
{
continue;
}
}
// Adding original weapon // Adding original weapon
AddCIToTraderEx(Trad.SaleItems[i].WeaponDef); AddCIToTraderEx(Trad.SaleItems[i].WeaponDef);
} }
@ -368,26 +341,6 @@ function EditTraiderItems()
AddCIToTrader("ServerExt.ExtWeapDef_MedicPistol"); AddCIToTrader("ServerExt.ExtWeapDef_MedicPistol");
} }
//Add DLCs weapons for free
if (bDLCWeaponsForFree)
{
AddCIToTrader("ServerExt.DLCWeapDef_Blunderbuss");
AddCIToTrader("ServerExt.DLCWeapDef_ChainBat");
AddCIToTrader("ServerExt.DLCWeapDef_ChiappaRhino");
AddCIToTrader("ServerExt.DLCWeapDef_ChiappaRhinoDual");
AddCIToTrader("ServerExt.DLCWeapDef_CompoundBow");
AddCIToTrader("ServerExt.DLCWeapDef_FreezeThrower");
AddCIToTrader("ServerExt.DLCWeapDef_IonThruster");
AddCIToTrader("ServerExt.DLCWeapDef_G18");
AddCIToTrader("ServerExt.DLCWeapDef_MosinNagant");
AddCIToTrader("ServerExt.DLCWeapDef_LazerCutter");
AddCIToTrader("ServerExt.DLCWeapDef_Pistol_DualG18");
AddCIToTrader("ServerExt.DLCWeapDef_Pistol_G18C");
AddCIToTrader("ServerExt.DLCWeapDef_Mine_Reconstructor");
AddCIToTrader("ServerExt.DLCWeapDef_Minigun");
AddCIToTrader("ServerExt.DLCWeapDef_Rifle_FrostShotgunAxe");
}
// Add custom items from WebAdmin // Add custom items from WebAdmin
for (i=0; i<CustomItems.Length; ++i) for (i=0; i<CustomItems.Length; ++i)
{ {
@ -1795,8 +1748,6 @@ function string WebAdminGetValue(name PropName, int ElementIndex)
return string(bDisableCustomTrader); return string(bDisableCustomTrader);
case 'bAllowStandartPistolUpgrade': case 'bAllowStandartPistolUpgrade':
return string(bAllowStandartPistolUpgrade); return string(bAllowStandartPistolUpgrade);
case 'bDLCWeaponsForFree':
return string(bDLCWeaponsForFree);
case 'UnloadPerkExpCost': case 'UnloadPerkExpCost':
return string(UnloadPerkExpCost); return string(UnloadPerkExpCost);
case 'PerkClasses': case 'PerkClasses':
@ -1872,8 +1823,6 @@ function WebAdminSetValue(name PropName, int ElementIndex, string Value)
bDisableCustomTrader = bool(Value); break; bDisableCustomTrader = bool(Value); break;
case 'bAllowStandartPistolUpgrade': case 'bAllowStandartPistolUpgrade':
bAllowStandartPistolUpgrade = bool(Value); break; bAllowStandartPistolUpgrade = bool(Value); break;
case 'bDLCWeaponsForFree':
bDLCWeaponsForFree = bool(Value); break;
case 'bAddCountryTags': case 'bAddCountryTags':
bAddCountryTags = bool(Value); break; bAddCountryTags = bool(Value); break;
case 'MaxTopPlayers': case 'MaxTopPlayers':
@ -1937,6 +1886,5 @@ defaultproperties
WebConfigs.Add((PropType=1,PropName="bDisableCustomTrader",UIName="Disable custom trader",UIDesc="Warning! That option will disable all settings below")) 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=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="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")) WebConfigs.Add((PropType=1,PropName="bAllowStandartPistolUpgrade",UIName="Standard pistol upgrades",UIDesc="Allows to upgrade standard pistol"))
} }