-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathClient.h
More file actions
199 lines (173 loc) · 4.63 KB
/
Client.h
File metadata and controls
199 lines (173 loc) · 4.63 KB
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
//
// Client.h
// Project Spitfire
//
// Copyright (c) 2013 Daizee (rensiadz at gmail dot com)
//
// This file is part of Spitfire.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "amf3.h"
#include "City.h"
#include "connection.h"
class Server;
#pragma once
class Client
{
public:
Client(Server * core);
~Client(void);
connection * socket;
amf3object ToObject();
amf3array Items();
amf3array SaleTypeItems();
amf3array SaleItems();
amf3array CastleArray();
amf3array BuffsArray();
amf3object PlayerInfo();
double Prestige()
{
return m_prestige;
}
void Prestige(double pres)
{
m_prestige += pres;
if (m_prestige < 0)
m_prestige = 0;
if (m_prestige > 2100000000)
m_prestige = 2100000000;
}
void ParseBuffs(char * str);
void ParseResearch(char * str);
void ParseItems(char * str);
void ParseMisc(char * str);
void ParseBuffs(string str);
void ParseResearch(string str);
void ParseItems(string str);
void ParseMisc(string str);
void SetBuff(string type, string desc, int64_t endtime, int8_t param = 0);
void RemoveBuff(string type);
void SetItem(string type, int16_t dir);
void SetResearch(uint16_t id, int16_t level, int16_t castleid, double starttime, double endtime);
int16_t GetResearchLevel(int16_t id);
int16_t GetItemCount(string type);
int16_t GetItemCount(int16_t type);
int64_t m_accountid;
int64_t masteraccountid;
bool m_accountexists;
Server * m_main;
int32_t m_playerid;// = 0;
int32_t PACKETSIZE;// = 1024 * 150;
uint64_t m_socknum;
bool m_loggedin;// = false;
uint32_t m_clientnumber;
string m_playername;// = "Testname";
string m_flag;// = "Evony";
string m_faceurl;
string m_alliancename;
int16_t m_alliancerank;
string m_office;
char m_ipaddress[16];
int32_t m_allianceid;
string m_email;
string m_password;
double m_prestige;
double m_honor;
bool m_beginner;
int32_t m_status;
int32_t m_rank;
int32_t m_title;
double m_connected;
double m_lastlogin;
double m_creation;
//char * readytoprocess = new char[PACKETSIZE];
int32_t processoffset;
int32_t m_citycount;
int32_t m_sex;
int32_t m_population;
uint32_t m_prestigerank;
uint32_t m_honorrank;
vector<PlayerCity*> m_city;// = new ArrayList();
int m_bdenyotherplayer;
int m_tempvar;
string m_allianceapply;
bool m_changedface;
uint16_t changeface;//new castle designs
int8_t m_icon;
int32_t m_cents;
uint32_t m_currentcityindex;
uint32_t m_currentcityid;
double m_lag;
vector<stBuff> m_buffs;
stItem m_items[DEF_MAXITEMS];
stResearch m_research[25];
stBuff * GetBuff(string type)
{
for (int32_t i = 0; i < m_buffs.size(); ++i)
{
if (m_buffs[i].id == type)
return &m_buffs[i];
}
return 0;
}
vector<stArmyMovement*> armymovement;
void CalculateResources();
void PlayerUpdate();
void ItemUpdate(char * itemname);
void BuffUpdate(string name, string desc, int64_t endtime, int8_t type = 0);
void HeroUpdate(int heroid, int castleid);
void MailUpdate();
void UpdateSelfArmy();
bool HasAlliance()
{
if (m_allianceid > 0)
return true;
return false;
}
Alliance * GetAlliance();
PlayerCity * GetCity(int32_t castleid);
PlayerCity * GetFocusCity();
bool Beginner() { return m_beginner; }
void Beginner(bool set, bool update = true) {
if (m_beginner != set)
{
m_beginner = set;
if (update)
PlayerUpdate();
}
}
__forceinline void CheckBeginner(bool update = true)
{
if (Beginner())
{
if ((unixtime() - m_creation) > 1000*60*60*24*7)
{
Beginner(false, update);
return;
}
for (int i = 0; i < this->m_city.size(); ++i)
{
if (m_city[i]->GetBuildingLevel(B_TOWNHALL) >= 5)
{
Beginner(false, update);
return;
}
}
}
}
};