blob: 06f78a19a0f7d17924b2e2dfacfe9c88269cf748 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================
#ifndef TF_POWERUP_BOTTLE_H
#define TF_POWERUP_BOTTLE_H
#ifdef _WIN32
#pragma once
#endif
#include "tf_shareddefs.h"
#include "tf_item_wearable.h"
#if defined( CLIENT_DLL )
#define CTFPowerupBottle C_TFPowerupBottle
#include "econ_notifications.h"
#endif
class CTFPowerupBottle : public CTFWearable
{
DECLARE_CLASS( CTFPowerupBottle, CTFWearable );
public:
DECLARE_NETWORKCLASS();
DECLARE_DATADESC();
CTFPowerupBottle();
virtual ~CTFPowerupBottle() { }
PowerupBottleType_t GetPowerupType( void ) const;
virtual void Precache( void );
// reset the bottle to its initial state
void Reset( void );
// Unequips the item as usual, but also removes any effect it may have been granting
virtual void UnEquip( CBasePlayer* pOwner );
// Overridden so that this item can apply the effect only when it is active
virtual void ReapplyProvision();
// @return true if the effect was applied and a charge was consumed, false otherwise
bool Use();
// Remove the effect applied by the item
void RemoveEffect();
// set the number of charges availabe on this item
// @param usNumCharges
void SetNumCharges( uint8 usNumCharges );
// @return the number of charges the item has
uint8 GetNumCharges() const;
// @return the maximum number of charges this item can hold
uint8 GetMaxNumCharges() const;
bool AllowedToUse();
const char* GetEffectLabelText( void );
const char* GetEffectIconName( void );
float GetProgress( void ) { return 0.0f; }
virtual int GetSkin();
bool IsBasePowerUpBottle( void ) const { int iMode = 0; CALL_ATTRIB_HOOK_INT( iMode, set_weapon_mode ); return (iMode == 1); };
protected:
// Used internally to remove the effect after a tunable amount of time
void StatusThink();
CNetworkVar( bool, m_bActive );
CNetworkVar( uint8, m_usNumCharges );
private:
#ifdef TF_CLIENT_DLL
virtual void FireGameEvent( IGameEvent *event );
virtual int GetWorldModelIndex( void );
#endif
float m_flLastSpawnTime;
};
#ifdef CLIENT_DLL
// ******************************************************************************************
// CEquipMvMCanteenNotification - Client notification to equip a canteen
// ******************************************************************************************
class CEquipMvMCanteenNotification : public CEconNotification
{
public:
CEquipMvMCanteenNotification() : CEconNotification()
{
m_bHasTriggered = false;
}
~CEquipMvMCanteenNotification()
{
if ( !m_bHasTriggered )
{
m_bHasTriggered = true;
}
}
virtual void MarkForDeletion()
{
m_bHasTriggered = true;
CEconNotification::MarkForDeletion();
}
virtual EType NotificationType() { return eType_AcceptDecline; }
virtual bool BShowInGameElements() const { return true; }
virtual void Accept();
virtual void Trigger() { Accept(); }
virtual void Decline() { MarkForDeletion(); }
virtual void UpdateTick();
static bool IsNotificationType( CEconNotification *pNotification ) { return dynamic_cast<CEquipMvMCanteenNotification *>( pNotification ) != NULL; }
private:
bool m_bHasTriggered;
};
#endif // client
#endif // TF_POWERUP_BOTTLE_H
|