Planeshift
servervitals.h
Go to the documentation of this file.
1
/*
2
* servervitals.h
3
*
4
* Copyright (C) 2005 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5
*
6
*
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation (version 2 of the License)
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
*
18
*/
19
20
#ifndef SERVER_VITALS_HEADER
21
#define SERVER_VITALS_HEADER
22
#include "psstdint.h"
23
24
//=============================================================================
25
// Crystal Space Includes
26
//=============================================================================
27
28
//=============================================================================
29
// Project Includes
30
//=============================================================================
31
#include "
util/psconst.h
"
32
#include "
rpgrules/vitals.h
"
33
#include "../playergroup.h"
34
35
//=============================================================================
36
// Local Includes
37
//=============================================================================
38
39
class
MsgEntry
;
40
class
psCharacter
;
41
43
class
VitalBuffable
:
public
Buffable
<float>
44
{
45
public
:
46
virtual
~VitalBuffable
() { }
47
48
void
Initialize
(
unsigned
int
* sDirty,
int
dirtyF)
49
{
50
statsDirty
= sDirty;
51
dirtyFlag
= dirtyF;
52
}
53
54
protected
:
55
virtual
void
OnChange
()
56
{
57
*
statsDirty
|=
dirtyFlag
;
58
}
59
60
int
dirtyFlag
;
61
unsigned
int
*
statsDirty
;
62
};
63
65
struct
Vital
66
{
67
Vital
() : value(0.0) {}
68
69
float
value;
70
VitalBuffable
drRate
;
71
VitalBuffable
max
;
72
};
73
74
//----------------------------------------------------------------------------
75
81
class
psServerVitals
:
public
psVitalManager
<Vital>
82
{
83
public
:
84
psServerVitals
(
psCharacter
* character);
85
88
bool
SendStatDRMessage(uint32_t clientnum, EID eid,
unsigned
int
flags, csRef<PlayerGroup> group = NULL);
89
90
bool
Update(csTicks now);
91
92
void
SetExp(
unsigned
int
exp);
93
void
SetPP(
unsigned
int
pp);
94
95
void
SetVital(
int
vitalName,
int
dirtyFlag
,
float
value);
96
void
AdjustVital(
int
vitalName,
int
dirtyFlag,
float
delta);
97
100
unsigned
int
GetStatsDirtyFlags()
const
;
101
104
void
SetAllStatsDirty();
105
108
void
ClearStatsDirtyFlags(
unsigned
int
dirtyFlags);
109
110
private
:
112
void
ClampVital(
int
vital);
113
121
Vital
&DirtyVital(
int
vitalName,
int
dirtyFlag);
122
124
unsigned
int
statsDirty
;
125
unsigned
char
version;
126
psCharacter
* character;
127
};
128
129
#endif
130
psCharacter
Definition:
pscharacter.h:647
VitalBuffable::~VitalBuffable
virtual ~VitalBuffable()
Definition:
servervitals.h:46
VitalBuffable::OnChange
virtual void OnChange()
Called whenever the value changes; implemented in derived classes.
Definition:
servervitals.h:55
Buffable
Buffables.
Definition:
buffable.h:150
MsgEntry
The structure of 1 queue entry (pointer to a message)
Definition:
message.h:143
psVitalManager
Manages a set of Vitals and does the predictions and updates on them when new data comes from the ser...
Definition:
vitals.h:68
VitalBuffable
Buffables for vitals, which automatically update the dirty flag as necessary.
Definition:
servervitals.h:43
psServerVitals
Server side of the character vitals manager.
Definition:
servervitals.h:81
Vital::max
VitalBuffable max
Definition:
servervitals.h:71
psconst.h
VitalBuffable::dirtyFlag
int dirtyFlag
The bit value we should set when this becomes dirty.
Definition:
servervitals.h:60
VitalBuffable::Initialize
void Initialize(unsigned int *sDirty, int dirtyF)
Definition:
servervitals.h:48
Vital::Vital
Vital()
Definition:
servervitals.h:67
VitalBuffable::statsDirty
unsigned int * statsDirty
Pointer to the psServerVitals dirty bitfield.
Definition:
servervitals.h:61
Vital::drRate
VitalBuffable drRate
Amount added to this vital each second.
Definition:
servervitals.h:70
vitals.h
Vital
A character vital (such as HP or Mana) - client side.
Definition:
clientvitals.h:38
server
bulkobjects
servervitals.h
Generated on Sat Jun 19 2021 05:00:33 for Planeshift by
1.8.11