diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/server/tf/player_vs_environment/tf_upgrades.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/server/tf/player_vs_environment/tf_upgrades.h')
| -rw-r--r-- | game/server/tf/player_vs_environment/tf_upgrades.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/game/server/tf/player_vs_environment/tf_upgrades.h b/game/server/tf/player_vs_environment/tf_upgrades.h new file mode 100644 index 0000000..3def047 --- /dev/null +++ b/game/server/tf/player_vs_environment/tf_upgrades.h @@ -0,0 +1,67 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: Load item upgrade data from KeyValues +// +// $NoKeywords: $ +//============================================================================= + +#ifndef TF_UPGRADES_H +#define TF_UPGRADES_H + +#include "bot/tf_bot.h" +#include "networkvar.h" +#include "triggers.h" +#include "tf_population_manager.h" + +struct UpgradeAttribBlock_t +{ + char szName[MAX_ATTRIBUTE_DESCRIPTION_LENGTH]; + float flValue; + loadout_positions_t iSlot; +}; + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +class CUpgrades : public CBaseTrigger, public CGameEventListener +{ +public: + DECLARE_CLASS( CUpgrades, CBaseTrigger ); + DECLARE_DATADESC(); + + virtual void Spawn( void ); + + virtual void FireGameEvent( IGameEvent *gameEvent ); + + void UpgradeTouch( CBaseEntity *pOther ); + virtual void EndTouch( CBaseEntity *pEntity ); + + void InputEnable( inputdata_t &inputdata ); + void InputDisable( inputdata_t &inputdata ); + void InputReset( inputdata_t &inputdata ); + + void GrantOrRemoveAllUpgrades( CTFPlayer *pTFPlayer, bool bRemove = false, bool bRefund = true ); + void PlayerPurchasingUpgrade( CTFPlayer *pTFPlayer, int iItemSlot, int iUpgrade, bool bDowngrade, bool bFree = false, bool bRespec = false ); + + attrib_definition_index_t ApplyUpgradeToItem( CTFPlayer *pTFPlayer, CEconItemView *pView, int iUpgrade, int nCost, bool bDowngrade = false, bool bIsFresh = false ); // needed for checkpoint restore + + const char * GetUpgradeAttributeName( int iUpgrade ) const; + +private: + void NotifyItemOnUpgrade( CTFPlayer *pTFPlayer, attrib_definition_index_t nAttrDefIndex, bool bDowngrade = false ); + void ReportUpgrade ( CTFPlayer *pTFPlayer, int nItemDef, int nAttributeDef, int nQuality, int nCost, bool bDowngrade, bool bIsFresh, bool bIsBottle = false ); + void RestoreItemAttributeToBaseValue( CEconItemAttributeDefinition *pAttrib, CEconItemView *pItem ); + void RestorePlayerAttributeToBaseValue( CEconItemAttributeDefinition *pAttrib, CTFPlayer *pTFPlayer ); + + void ApplyUpgradeAttributeBlock( UpgradeAttribBlock_t *upgradeBlock, int upgradeCount, CTFPlayer *pPlayer, bool bDowngrade ); + + int m_nStartDisabled; + + COutputEvent m_onPeriodicSpawn; + + bool m_bIsEnabled; +}; + +extern CHandle<CUpgrades> g_hUpgradeEntity; + +#endif // TF_UPGRADES_H |