SEGS  0.4.2
Super Entity Game Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DataHelpers.h
Go to the documentation of this file.
1 /*
2  * SEGS - Super Entity Game Server
3  * http://www.segs.io/
4  * Copyright (c) 2006 - 2018 SEGS Team (see Authors.txt)
5  * This software is licensed! (See License.txt for details)
6  */
7 
8 #pragma once
10 #include "glm/vec3.hpp"
11 #include <stdint.h>
12 #include <QString>
13 class QString;
14 class Entity;
15 class Character;
16 struct PlayerData;
17 
18 struct FriendsList;
19 struct MapClientSession;
20 
21 /*
22  * Entity Methods
23  */
24 // Getters
25 uint32_t getIdx(const Entity &e);
26 uint32_t getDbId(const Entity &e);
27 uint32_t getAccessLevel(const Entity &e);
28 uint32_t getTargetIdx(const Entity &e);
29 uint32_t getAssistTargetIdx(const Entity &e);
30 glm::vec3 getSpeed(const Entity &e);
31 float getBackupSpd(const Entity &e);
32 float getJumpHeight(const Entity &e);
33 uint8_t getUpdateId(const Entity &e);
34 
35 // Setters
36 void setDbId(Entity &e, uint8_t val);
37 void setMapIdx(Entity &e, uint32_t val);
38 void setSpeed(Entity &e, float v1, float v2, float v3);
39 void setBackupSpd(Entity &e, float val);
40 void setJumpHeight(Entity &e, float val);
41 void setUpdateID(Entity &e, uint8_t val);
42 void setTeamID(Entity &e, uint8_t team_id);
43 void setSuperGroup(Entity &e, int sg_id = 0, QString sg_name = "", uint32_t sg_rank = 3);
44 void setAssistTarget(Entity &e);
45 
46 // For live debugging
47 void setu3(Entity &e, int val);
48 
49 // Toggles
50 void toggleFly(Entity &e);
51 void toggleFalling(Entity &e);
52 void toggleJumping(Entity &e);
53 void toggleSliding(Entity &e);
54 void toggleStunned(Entity &e);
55 void toggleJumppack(Entity &e);
57 void toggleFullUpdate(Entity &e);
58 void toggleControlId(Entity &e);
59 
60 // Misc Methods
61 void charUpdateDB(Entity *e);
62 void charUpdateGUI(Entity *e);
63 int getEntityOriginIndex(bool is_player,const QString &origin_name);
64 int getEntityClassIndex(bool is_player, const QString &class_name);
65 Entity * getEntity(MapClientSession *src, const QString &name);
66 Entity * getEntity(MapClientSession *src, uint32_t idx);
67 Entity * getEntityByDBID(MapClientSession *src, uint32_t idx);
69 
70 /*
71  * Character Methods
72  */
73 // Getters
74 uint32_t getLevel(const Character &c);
75 uint32_t getCombatLevel(const Character &c);
76 float getHP(const Character &c);
77 float getEnd(const Character &c);
78 uint64_t getLastCostumeId(const Character &c);
79 const QString & getOrigin(const Character &c);
80 const QString & getClass(const Character &c);
81 const QString & getMapName(const Character &c);
82 uint32_t getXP(const Character &c);
83 uint32_t getDebt(const Character &c);
84 uint32_t getPatrolXP(const Character &c);
85 const QString & getGenericTitle(const Character &c);
86 const QString & getOriginTitle(const Character &c);
87 const QString & getSpecialTitle(const Character &c);
88 
89 uint32_t getInf(const Character &c);
90 const QString & getDescription(const Character &c);
91 const QString & getBattleCry(const Character &c);
92 const QString & getAlignment(const Character &c);
93 
94 // Setters
95 void setLevel(Character &c, uint32_t val);
96 void setCombatLevel(Character &c, uint32_t val);
97 void setHP(Character &c, float val);
98 void setEnd(Character &c, float val);
99 void setLastCostumeId(Character &c, uint64_t val);
100 void setMapName(Character &c, const QString &val);
101 void setXP(Character &c, uint32_t val);
102 void setDebt(Character &c, uint32_t val);
103 void setTitles(Character &c, bool prefix = false, QString generic = "", QString origin = "", QString special = "");
104 void setInf(Character &c, uint32_t val);
105 void setDescription(Character &c, QString val);
106 void setBattleCry(Character &c, QString val);
107 
108 // Toggles
109 void toggleAFK(Character &c, const QString &msg = "");
110 void toggleTeamBuffs(PlayerData &c);
111 
112 
113 /*
114  * Looking for Group
115  */
116 void toggleLFG(Entity &e);
117 
118 
119 /*
120  * sendInfoMessage wrapper to provide access to NetStructures
121  */
122 void messageOutput(MessageChannel ch, QString &msg, Entity &tgt);
123 
124 
125 /*
126  * SendUpdate Wrappers to provide access to NetStructures
127  */
128 void sendFloatingNumbers(Entity *src, uint32_t tgt_idx, int32_t amount);
129 void sendFriendsListUpdate(Entity *src, FriendsList *friends_list);
130 void sendSidekickOffer(Entity *tgt, uint32_t src_db_id);
131 void sendTeamLooking(Entity *tgt);
132 void sendTeamOffer(Entity *src, Entity *tgt);
133 
134 /*
135  * sendEmail Wrappers for providing access to Email Database
136  */
137 void sendEmailHeaders(Entity *e);
138 void readEmailMessage(Entity *e, const int id);
uint32_t getCombatLevel(const Character &c)
Definition: DataHelpers.cpp:289
float getHP(const Character &c)
Definition: DataHelpers.cpp:290
void toggleFly(Entity &e)
Definition: DataHelpers.cpp:108
float getEnd(const Character &c)
Definition: DataHelpers.cpp:291
void toggleControlId(Entity &e)
Definition: DataHelpers.cpp:127
Definition: MapClientSession.h:32
void toggleTeamBuffs(PlayerData &c)
Definition: DataHelpers.cpp:385
Entity * getEntityByDBID(MapClientSession *src, uint32_t db_id)
Definition: DataHelpers.cpp:214
Definition: Character.h:55
void toggleJumping(Entity &e)
Definition: DataHelpers.cpp:110
void setUpdateID(Entity &e, uint8_t val)
Definition: DataHelpers.cpp:50
uint8_t getUpdateId(const Entity &e)
Definition: DataHelpers.cpp:42
int getEntityOriginIndex(bool is_player, const QString &origin_name)
Definition: DataHelpers.cpp:140
void setSuperGroup(Entity &e, int sg_id, QString sg_name, uint32_t sg_rank)
Definition: DataHelpers.cpp:73
void messageOutput(MessageChannel ch, QString &msg, Entity &tgt)
Definition: DataHelpers.cpp:414
uint32_t getPatrolXP(const Character &c)
Definition: DataHelpers.cpp:298
float getBackupSpd(const Entity &e)
Definition: DataHelpers.cpp:40
Definition: playerdata_definitions.h:17
uint32_t getTargetIdx(const Entity &e)
Definition: DataHelpers.cpp:37
void setInf(Character &c, uint32_t val)
Definition: DataHelpers.cpp:373
uint32_t getDebt(const Character &c)
Definition: DataHelpers.cpp:297
uint64_t getLastCostumeId(const Character &c)
Definition: DataHelpers.cpp:292
void sendEmailHeaders(Entity *e)
Definition: DataHelpers.cpp:259
void setu3(Entity &e, int val)
Definition: DataHelpers.cpp:106
void setBattleCry(Character &c, QString val)
Definition: DataHelpers.cpp:375
void setDescription(Character &c, QString val)
Definition: DataHelpers.cpp:374
float getJumpHeight(const Entity &e)
Definition: DataHelpers.cpp:41
void setLevel(Character &c, uint32_t val)
Definition: DataHelpers.cpp:308
glm::vec3 getSpeed(const Entity &e)
Definition: DataHelpers.cpp:39
void setDebt(Character &c, uint32_t val)
Definition: DataHelpers.cpp:351
MessageChannel
Definition: MessageChannels.h:10
void charUpdateDB(Entity *e)
Definition: DataHelpers.cpp:130
const QString & getSpecialTitle(const Character &c)
Definition: DataHelpers.cpp:301
void toggleAFK(Character &c, const QString &msg)
Definition: DataHelpers.cpp:378
void setDbId(Entity &e, uint8_t val)
Definition: DataHelpers.cpp:45
uint32_t getAssistTargetIdx(const Entity &e)
Definition: DataHelpers.cpp:38
void setXP(Character &c, uint32_t val)
Definition: DataHelpers.cpp:338
const QString & getDescription(const Character &c)
Definition: DataHelpers.cpp:303
void setAssistTarget(Entity &e)
Definition: DataHelpers.cpp:103
void sendTeamLooking(Entity *tgt)
Definition: DataHelpers.cpp:440
void setTeamID(Entity &e, uint8_t team_id)
Definition: DataHelpers.cpp:52
Definition: Entity.h:221
uint32_t getXP(const Character &c)
Definition: DataHelpers.cpp:296
void setBackupSpd(Entity &e, float val)
Definition: DataHelpers.cpp:48
uint32_t getAccessLevel(const Entity &e)
Definition: DataHelpers.cpp:36
void setTitles(Character &c, bool prefix, QString generic, QString origin, QString special)
Definition: DataHelpers.cpp:353
void setSpeed(Entity &e, float v1, float v2, float v3)
Definition: DataHelpers.cpp:47
void sendSidekickOffer(Entity *tgt, uint32_t src_db_id)
Definition: DataHelpers.cpp:434
void sendServerMOTD(MapClientSession *tgt)
Definition: DataHelpers.cpp:240
const QString & getOriginTitle(const Character &c)
Definition: DataHelpers.cpp:300
uint32_t getDbId(const Entity &e)
Definition: DataHelpers.cpp:35
void toggleFullUpdate(Entity &e)
Definition: DataHelpers.cpp:126
void toggleFalling(Entity &e)
Definition: DataHelpers.cpp:109
const QString & getGenericTitle(const Character &c)
Definition: DataHelpers.cpp:299
void toggleLFG(Entity &e)
Definition: DataHelpers.cpp:390
uint32_t getInf(const Character &c)
Definition: DataHelpers.cpp:302
void setMapName(Character &c, const QString &val)
Definition: DataHelpers.cpp:336
void readEmailMessage(Entity *e, const int id)
Definition: DataHelpers.cpp:272
void sendFriendsListUpdate(Entity *src, FriendsList *friends_list)
Definition: DataHelpers.cpp:428
const QString & getOrigin(const Character &c)
Definition: DataHelpers.cpp:293
void setHP(Character &c, float val)
Definition: DataHelpers.cpp:325
void setJumpHeight(Entity &e, float val)
Definition: DataHelpers.cpp:49
const QString & getMapName(const Character &c)
Definition: DataHelpers.cpp:295
Definition: Friend.h:25
Entity * getEntity(MapClientSession *src, const QString &name)
Definition: DataHelpers.cpp:174
const QString & getAlignment(const Character &c)
Definition: DataHelpers.cpp:305
int getEntityClassIndex(bool is_player, const QString &class_name)
Definition: DataHelpers.cpp:156
void toggleControlsDisabled(Entity &e)
Definition: DataHelpers.cpp:125
const QString & getBattleCry(const Character &c)
Definition: DataHelpers.cpp:304
uint32_t getIdx(const Entity &e)
Definition: DataHelpers.cpp:34
void setEnd(Character &c, float val)
Definition: DataHelpers.cpp:330
void toggleJumppack(Entity &e)
Definition: DataHelpers.cpp:119
void setLastCostumeId(Character &c, uint64_t val)
Definition: DataHelpers.cpp:335
void toggleStunned(Entity &e)
Definition: DataHelpers.cpp:113
void toggleSliding(Entity &e)
Definition: DataHelpers.cpp:111
void sendTeamOffer(Entity *src, Entity *tgt)
Definition: DataHelpers.cpp:448
void sendFloatingNumbers(Entity *src, uint32_t tgt_idx, int32_t amount)
Definition: DataHelpers.cpp:422
const QString & getClass(const Character &c)
Definition: DataHelpers.cpp:294
void charUpdateGUI(Entity *e)
Definition: DataHelpers.cpp:135
void setCombatLevel(Character &c, uint32_t val)
Definition: DataHelpers.cpp:318
void setMapIdx(Entity &e, uint32_t val)
Definition: DataHelpers.cpp:46
uint32_t getLevel(const Character &c)
Definition: DataHelpers.cpp:288