2020-12-13 15:01:13 +00:00
//=============================================================================
// KFUnlockManager
//=============================================================================
//
//=============================================================================
// Killing Floor 2
// Copyright (C) 2015 Tripwire Interactive LLC
//=============================================================================
class KFUnlockManager extends Object
abstract
native
dependson ( KFCharacterInfo _Human ) ;
enum ESharedContentUnlock
{
SCU _None ,
SCU _Zweihander ,
SCU _ChainBat ,
SCU _ChiappaRhino ,
SCU _IonThruster ,
SCU _MosinNagant ,
SCU _G18RiotShield ,
SCU _CompoundBow ,
SCU _G18C ,
SCU _Blunderbuss ,
SCU _Minigun ,
SCU _MineReconstructor ,
2020-12-13 15:09:05 +00:00
SCU _FrostFang ,
2021-03-02 11:56:51 +00:00
SCU _GravityImploder ,
2021-06-02 20:06:18 +00:00
SCU _FAMAS ,
2021-10-05 17:50:32 +00:00
SCU _Thermite ,
SCU _BladedPistol ,
2021-12-09 16:33:06 +00:00
SCU _ParasiteImplanter ,
SCU _Doshinegun
2020-12-13 15:01:13 +00:00
} ;
enum EPlatformRestriction
{
PR _All ,
PR _XboxOne ,
PR _PC ,
PR _PS4 ,
PR _Console ,
} ;
struct native SharedContent
{
var name Name ;
var string IconPath ;
var int ID ;
} ;
/** contains ids (app or microtrans) to unlock this content */
var array < SharedContent > SharedContentList ;
/** contains owned title information (will be empty on PC) */
var array < OnlineCrossTitleContent > CrossTitleContent ;
/** Cache a copy of the online subsystem (save to class default)*/
var OnlineSubsystem MyOnlineSubsystem ;
/** Unlock cosmetics in dev build */
var const bool bDebugUnlocks ;
cpptext
{
/** Checks if a Steam AppID is owned by the logged-in player */
UBOOL GetAppIDAvailable ( INT ID ) ;
/** Check if a Steam inventory item is owned by the logged-in player */
UBOOL GetInventoryIDAvailable ( INT ID ) ;
/** TRUE if this PRI is valid for shared content unlock */
UBOOL CanShareContent ( APlayerReplicationInfo * PRI ) ;
/** return TRUE if the UnlockId bit is set for a given set of flags */
UBOOL CheckSharedUnlock ( int UnlockFlags , int UnlockId ) ;
/** Steam Id of the Killing Floor 2 group */
static const FUniqueNetId KF2Group ;
}
/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Shared Weapon Unlocks
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/ * *
* Called once per PRI to set up shared weapon content
* Network : Local Player
* /
static native function InitSharedUnlocksFor ( KFPlayerReplicationInfo PRI , optional const out array < OnlineCrossTitleContent > InCrossTitleContent ) ;
/ * *
* returns TRUE if any player on this server has this unlock
* Network : All
* /
static native function bool IsSharedContentUnlocked ( int UnlockId ) ;
/ * *
* Returns TRUE if a player has event weapon skin
* /
static native function bool GetObjectiveItemGranted ( int UnlockId ) ;
/ * *
* returns a list of all available ( aka connected ) players with a given unlock
* Network : All
* /
static native function GetSharedContentPlayerList ( int UnlockId , out array < PlayerReplicationInfo > out _PRIArray ) ;
/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Platform Restrictions
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/ * *
* returns TRUE if the content is restricted for the current platform
* Network : All
* /
static native function bool IsPlatformRestricted ( EPlatformRestriction PlatformRestrictionType ) ;
/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Character Unlocks
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/** Returns whether a unique numeric ID is unlocked. Zero is always unlocked. */
static native private function bool GetIDAvailable ( INT ID ) ;
static function bool GetWeaponSkinAvailable ( INT ID )
{
return GetIDAvailable ( ID ) ;
}
static event bool GetEmoteAvailable ( INT ID )
{
return GetIDAvailable ( ID ) ;
}
static final event bool GetHeadShotEffectAvailable ( INT ID )
{
return GetIDAvailable ( ID ) ;
}
//@HSL_BEGIN - JRO - 5/12/2016 - Need a native accessor method. Can't make GetAvailable an event due to the KFUnlockableAsset being a non-native interface
static event bool GetAvailableCharacterArchetype ( KFCharacterInfo _Human archetype )
{
return GetAvailable ( archetype ) ;
}
//@HSL_END
/** Returns whether a UObject asset is unlocked and available for use */
static function bool GetAvailable ( KFUnlockableAsset Asset )
{
//@HSL_BEGIN - JRO - 5/12/2016 - Disable non-starter characters while installing
if ( ! class 'GameEngine' . static . IsGameFullyInstalled ( ) &&
String ( Asset . Name ) != "CHR_MrFoster_archetype" )
{
return false ;
}
//@HSL_END
return GetIDAvailable ( Asset . GetAssetId ( ) ) ;
}
/** Returns whether a character skin variant is unlocked and available for use */
static function bool GetAvailableSkin ( const out SkinVariant Asset )
{
return GetIDAvailable ( Asset . UnlockAssetID ) ;
}
/** Returns whether a character outfit variant is unlocked and available for use */
static function bool GetAvailableOutfit ( const out OutfitVariants Asset )
{
local int i ;
for ( i = 0 ; i < Asset . SkinVariations . Length ; ++ i )
{
// unlock if it has at least one available skin
if ( GetIDAvailable ( Asset . SkinVariations [ i ] . UnlockAssetId ) )
{
return TRUE ;
}
}
return false ;
}
/** Returns whether a character accessory or head variant is unlocked and available for use */
static function bool GetAvailableAttachment ( const out AttachmentVariants Asset )
{
local int i ;
for ( i = 0 ; i < Asset . AttachmentItem . SkinVariations . Length ; ++ i )
{
// unlock if it has at least one available skin
if ( GetIDAvailable ( Asset . AttachmentItem . SkinVariations [ i ] . UnlockAssetId ) )
{
return TRUE ;
}
}
return false ;
}
/** Checks to see that all cosmetic items for this character are owned */
static private event bool CheckCustomizationOwnership ( KFPlayerReplicationInfo PRI )
{
local KFCharacterInfo _Human CharArch ;
local OutfitVariants Outfit ;
local SkinVariant Skin ;
local AttachmentVariants Attachment ;
local int i ;
CharArch = PRI . CharacterArchetypes [ PRI . RepCustomizationInfo . CharacterIndex ] ;
if ( CharArch != None )
{
// body
Outfit = CharArch . BodyVariants [ PRI . RepCustomizationInfo . BodyMeshIndex ] ;
Skin = Outfit . SkinVariations [ PRI . RepCustomizationInfo . BodySkinIndex ] ;
/ * i f ( ! G e t I D A v a i l a b l e ( O u t f i t . U n l o c k A s s e t I D ) )
{
ClearCharacterCustomization ( PRI ) ;
return FALSE ;
}
else * / i f ( ! G e t I D A v a i l a b l e ( S k i n . U n l o c k A s s e t I D ) )
{
ClearCharacterCustomization ( PRI ) ;
return FALSE ;
}
// head
Outfit = CharArch . HeadVariants [ PRI . RepCustomizationInfo . HeadMeshIndex ] ;
Skin = Outfit . SkinVariations [ PRI . RepCustomizationInfo . HeadSkinIndex ] ;
/ * i f ( ! G e t I D A v a i l a b l e ( O u t f i t . U n l o c k A s s e t I D ) )
{
ClearCharacterCustomization ( PRI ) ;
return FALSE ;
}
else * / i f ( ! G e t I D A v a i l a b l e ( S k i n . U n l o c k A s s e t I D ) )
{
ClearCharacterCustomization ( PRI ) ;
return FALSE ;
}
// accessory
for ( i = 0 ; i < ` MAX_COSMETIC_ATTACHMENTS; i++ )
{
2021-09-02 21:46:08 +00:00
if ( i == 2 && PRI . WorldInfo . GRI . IsA ( 'KFGameReplicationInfo_WeeklySurvival' ) && ( class 'KFGameEngine' . static . GetWeeklyEventIndexMod ( ) == 12 ) )
{
continue ;
}
2020-12-13 15:01:13 +00:00
if ( PRI . RepCustomizationInfo . AttachmentSkinIndices [ i ] == INDEX _NONE )
{
continue ;
}
Attachment = CharArch . CosmeticVariants [ PRI . RepCustomizationInfo . AttachmentMeshIndices [ i ] ] ;
if ( Attachment . AttachmentItem == None )
{
return FALSE ;
}
Skin = Attachment . AttachmentItem . SkinVariations [ PRI . RepCustomizationInfo . AttachmentSkinIndices [ i ] ] ;
if ( ! GetIDAvailable ( Skin . UnlockAssetID ) )
{
ClearCharacterCustomization ( PRI ) ;
return FALSE ;
}
}
}
return TRUE ;
}
static native private function ClearCharacterCustomization ( KFPlayerReplicationInfo PRI ) ;
/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Debugging
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
static native function TestSteamAPI ( PlayerReplicationInfo PRI , byte CallFlags ) ;
defaultproperties
{
SharedContentList ( SCU _Zweihander ) = { (
Name = KFWeap _Edged _Zweihander ,
IconPath = "WEP_UI_Zweihander_TEX.UI_WeaponSelect_Zweihander" ,
ID = 219640 ) }
SharedContentList ( SCU _ChainBat ) = { (
Name = KFWeap _Blunt _ChainBat ,
IconPath = "Wep_UI_ChainBat_TEX.UI_WeaponSelect_RRChainbat" ,
ID = 300380 ) }
SharedContentList ( SCU _ChiappaRhino ) = { (
Name = KFWeap _Pistol _ChiappaRhino ,
IconPath = "Wep_UI_ChiappaRhino_TEX.UI_WeaponSelect_ChiappaRhinos" ,
ID = 7704 ) }
SharedContentList ( SCU _IonThruster ) = { (
Name = KFWeap _Edged _IonThruster ,
IconPath = "WEP_UI_Ion_Sword_TEX.UI_WeaponSelect_IonSword" ,
ID = 7715 ) }
SharedContentList ( SCU _MosinNagant ) = { (
Name = KFWeap _Rifle _MosinNagant ,
IconPath = "wep_ui_mosin_tex.UI_WeaponSelect_MosinNagant" ,
ID = 7856 ) }
SharedContentList ( SCU _G18RiotShield ) = { (
Name = KFWeap _SMG _G18 ,
IconPath = "WEP_UI_RiotShield_TEX.UI_WeaponSelect_RiotShield" ,
ID = 7850 ) }
SharedContentList ( SCU _CompoundBow ) = { (
Name = KFWeap _Bow _CompoundBow ,
IconPath = "WEP_UI_CompoundBow_TEX.UI_WeaponSelect_Compound_Bow" ,
ID = 8169 ) }
SharedContentList ( SCU _G18C ) = { (
Name = KFWeap _Pistol _G18C ,
IconPath = "wep_ui_g18c_tex.UI_WeaponSelect_G18C" ,
ID = 8293 ) }
SharedContentList ( SCU _Blunderbuss ) = { (
Name = KFWeap _Pistol _Blunderbuss ,
IconPath = "WEP_UI_Blunderbuss_TEX.UI_WeaponSelect_BlunderBluss" ,
ID = 8299 ) }
SharedContentList ( SCU _Minigun ) = { (
Name = KFWeap _Minigun ,
IconPath = "WEP_UI_Minigun_TEX.UI_WeaponSelect_Minigun" ,
ID = 8478 ) }
SharedContentList ( SCU _MineReconstructor ) = { (
Name = KFWeap _Mine _Reconstructor ,
IconPath = "WEP_UI_Mine_Reconstructor_TEX.UI_WeaponSelect_HMTechMineReconstructor" ,
ID = 8472 ) }
2020-12-13 15:09:05 +00:00
SharedContentList ( SCU _FrostFang ) = { (
Name = KFWeap _Rifle _FrostShotgunAxe ,
IconPath = "WEP_UI_Frost_Shotgun_Axe_TEX.UI_WeaponSelect_FrostGun" ,
ID = 8609 ) }
2021-03-02 11:56:51 +00:00
SharedContentList ( SCU _GravityImploder ) = { (
Name = KFWeap _GravityImploder ,
IconPath = "WEP_UI_Gravity_Imploder_TEX.UI_WeaponSelect_Gravity_Imploder" ,
ID = 8778 ) }
2021-06-02 20:06:18 +00:00
SharedContentList ( SCU _FAMAS ) = { (
Name = KFWeap _AssaultRifle _FAMAS ,
IconPath = "WEP_UI_Famas_TEX.UI_WeaponSelect_Famas" ,
ID = 8934 ) }
SharedContentList ( SCU _Thermite ) = { (
Name = KFWeap _RocketLauncher _ThermiteBore ,
IconPath = "WEP_UI_Thermite_TEX.UI_WeaponSelect_Thermite" ,
ID = 8940 ) }
2021-10-05 17:50:32 +00:00
SharedContentList ( SCU _BladedPistol ) = { (
Name = KFWeap _Pistol _Bladed ,
IconPath = "WEP_UI_BladedPistol_TEX.UI_WeaponSelect_BladedPistol" ,
ID = 9126 ) }
SharedContentList ( SCU _ParasiteImplanter ) = { (
Name = KFWeap _Rifle _ParasiteImplanter ,
IconPath = "WEP_UI_ParasiteImplanter_TEX.UI_WeaponSelect_ParasiteImplanter" ,
ID = 9132 ) }
2021-12-09 16:33:06 +00:00
SharedContentList ( SCU _Doshinegun ) = { (
Name = KFWeap _AssaultRifle _Doshinegun ,
IconPath = "WEP_UI_Doshinegun_TEX.UI_Weapon_Select_Doshinegun" ,
ID = 9275 ) }
2020-12-13 15:01:13 +00:00
}