SEGS  0.6.1-develop [d2cac982]
Super Entity Game Server
Contact.h
Go to the documentation of this file.
1 /*
2  * SEGS - Super Entity Game Server
3  * http://www.segs.io/
4  * Copyright (c) 2006 - 2019 SEGS Team (see AUTHORS.md)
5  * This software is licensed under the terms of the 3-clause BSD License. See LICENSE.md for details.
6  */
7 
8 #pragma once
9 
10 #include "CommonNetStructures.h"
11 #include "glm/vec3.hpp"
12 #include "cereal/cereal.hpp"
13 #include "Logging.h"
14 
15 struct CharacterData;
16 
17 static QHash<QString,int> contactLinkHash = {
18  {"CONTACTLINK_HELLO" ,1},
19  {"CONTACTLINK_MAIN" ,2},
20  {"CONTACTLINK_BYE" ,3},
21  {"CONTACTLINK_MISSIONS" ,4},
22  {"CONTACTLINK_LONGMISSION" ,5},
23  {"CONTACTLINK_SHORTMISSION" ,6},
24  {"CONTACTLINK_ACCEPTLONG" ,7},
25  {"CONTACTLINK_ACCEPTSHORT" ,8},
26  {"CONTACTLINK_INTRODUCE" ,9},
27  {"CONTACTLINK_INTRODUCE_CONTACT1" ,0x0A},
28  {"CONTACTLINK_INTRODUCE_CONTACT2" ,0x0B},
29  {"CONTACTLINK_ACCEPT_CONTACT1" ,0x0C},
30  {"CONTACTLINK_ACCEPT_CONTACT2" ,0x0D},
31  {"CONTACTLINK_GOTOSTORE" ,0x0E},
32  {"CONTACTLINK_TRAIN" ,0x0F},
33  {"CONTACTLINK_WRONGMODE" ,0x10},
34  {"CONTACTLINK_DONTKNOW" ,0x11},
35  {"CONTACTLINK_NOTLEADER" ,0x12},
36  {"CONTACTLINK_BADCELLCALL" ,0x13},
37  {"CONTACTLINK_ABOUT" ,0x14},
38  {"CONTACTLINK_IDENTIFYCLUE" ,0x15},
39  {"CONTACTLINK_NEWPLAYERTELEPORT_AP" ,0x16},
40  {"CONTACTLINK_NEWPLAYERTELEPORT_GC" ,0x17},
41  {"CONTACTLINK_FORMTASKFORCE" ,0x18},
42  {"CONTACTLINK_CHOOSE_TITLE" ,0x19},
43  {"CONTACTLINK_GOTOTAILOR" ,0x1A},
44 };
45 
46 struct Destination // aka waypoint
47 {
48  public:
49  enum : uint32_t {class_version = 2};
50 
51  int point_idx = 0;
52  glm::vec3 location;
53  QString m_location_name;
55 
56  // for scripting language access.
57  std::string getLocationName() const { return m_location_name.toStdString();}
58  void setLocationName(const char *n) { m_location_name = n; }
59 
60  std::string getLocationMapName() const { return m_location_map_name.toStdString();}
61  void setLocationMapName(const char *n) { m_location_map_name = n; }
62 
63 
64  template<class Archive>
65  void serialize(Archive &archive, uint32_t const version);
66 
67 };
68 
69 
70 class Contact
71 {
72 public:
73  enum : uint32_t {class_version = 2};
74 
75  // for scripting language access.
76  std::string getName() const { return m_name.toStdString();}
77  void setName(const char *n) { m_name = n; }
78 
79  std::string getLocationDescription() const { return m_location_description.toStdString();}
80  void setLocationDescription(const char *n) { m_location_description = n; }
81 
82  QString m_name;
84  uint32_t m_npc_id;
85  uint32_t m_contact_idx;
90  uint32_t m_task_index = 0;
91  bool m_notify_player = false;
92  bool m_can_use_cell = false;
93  bool m_has_location = false;
95 
96  // Not saved to DB
97  uint32_t m_dlg_screen = 0;
98  bool m_setting_title = false;
99 
100 
101 
102  template<class Archive>
103  void serialize(Archive &archive, uint32_t const version);
104 
105 };
106 using vContactList = std::vector<Contact>;
107 
109 {
110  QString m_response_text; // char[100]
111  uint32_t m_link = 0;
112 
113  template<class Archive>
114  void serialize(Archive &ar)
115  {
116  ar(m_response_text);
117  ar(m_link);
118  }
119 };
120 
122 {
123  QString m_msgbody; // char[20000]
124  QVector<ContactEntry> m_responses; // must be size 11, or cannot exceed 11?
125  // size_t num_active_contacts; // we can use size()
126 };
127 
128 
Definition: Contact.h:121
std::string getLocationMapName() const
Definition: Contact.h:60
uint32_t m_complete_threshold
Definition: Contact.h:89
void serialize(Archive &ar)
Definition: Contact.h:114
QString m_location_name
Definition: Contact.h:53
Definition: Contact.h:49
void setName(const char *n)
Definition: Contact.h:77
QVector< ContactEntry > m_responses
Definition: Contact.h:124
Definition: Contact.h:46
QString m_response_text
Definition: Contact.h:110
QString m_location_map_name
Definition: Contact.h:54
archive(cereal::make_nvp("OriginIdx", ed.m_origin_idx))
void setLocationMapName(const char *n)
Definition: Contact.h:61
std::vector< Contact > vContactList
Definition: Contact.h:106
uint32_t m_confidant_threshold
Definition: Contact.h:87
uint32_t m_contact_idx
Definition: Contact.h:85
Definition: Contact.h:70
std::string getName() const
Definition: Contact.h:76
uint32_t m_friend_threshold
Definition: Contact.h:88
int point_idx
Definition: Contact.h:51
void setLocationDescription(const char *n)
Definition: Contact.h:80
QString m_msgbody
Definition: Contact.h:123
void serialize(Archive &archive, uint32_t const version)
std::string getLocationDescription() const
Definition: Contact.h:79
std::string getLocationName() const
Definition: Contact.h:57
Definition: Contact.h:108
QString m_location_description
Definition: Contact.h:83
QString m_name
Definition: Contact.h:82
Destination m_location
Definition: Contact.h:94
glm::vec3 location
Definition: Contact.h:52
uint32_t m_npc_id
Definition: Contact.h:84
uint32_t m_current_standing
Definition: Contact.h:86
void setLocationName(const char *n)
Definition: Contact.h:58
EntityData uint32_t const version
Definition: entitydata_serializers.cpp:25
Definition: CharacterData.h:18