-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServerUser.cpp
More file actions
30 lines (25 loc) · 902 Bytes
/
ServerUser.cpp
File metadata and controls
30 lines (25 loc) · 902 Bytes
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
/// 包含 ServerUser 依赖的外部定义。
/// 包含 EProperty 和 PropArray。
#include "props.h"
/// 包含 FeatureManager 类定义。
#include "FeatureManager.h"
#include <sstream>
#include "ServerUser.h"
int ServerUser::GetTotalProperty(EProperty prop) const {
if (prop >= PROP_MAX) return 0;
int oldVal = baseProps[prop];
int newVal = featureManager.getNewTotalProps()[prop];
return oldVal + newVal;
}
void ServerUser::userOnline() {
featureManager.DispatchLoadAll();
}
void ServerUser::userOffline() {
featureManager.DispatchSaveAll();
}
void ServerUser::logAllProps() const {
std::cout << " ATTACK: " << GetTotalProperty(EProperty::PROP_ATTACK)
<< ", DEFENSE: " << GetTotalProperty(EProperty::PROP_DEFENSE)
<< ", HP: " << GetTotalProperty(EProperty::PROP_HP)
<< ", STAMINA: " << GetTotalProperty(EProperty::PROP_STAMINA) << "\n";
}