SEGS  0.6.1-develop [39915b3b]
Super Entity Game Server
Costume.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 "serialization_common.h"
12 #include "BitStream.h"
13 
14 #include <QtCore/QString>
15 #include <vector>
16 
17 extern int g_max_num_costume_slots;
18 
20 {
21  enum : uint32_t {class_version = 1};
22  enum class Type {
23  Pants=0,
24  Chest,
25  Head,
26  Gloves,
27  Boots,
28  Belt,
29  Hair,
30  Face,
31  EyeDetail,
33  Shoulders,
34  Back,
35  WepR,
36  Neck,
37  UarmR,
38  };
39  QString m_geometry;
40  QString m_texture_1;
41  QString m_texture_2;
42  QString name_3;
43  QString name_4;
44  QString name_5;
45  uint32_t m_colors[2] = {0};
46  uint8_t m_type = 0; // arms/legs etc..
48 };
49 
50 void serializeto(const CostumePart &part, BitStream &bs, const ColorAndPartPacker *packingContext);
51 void serializefrom(CostumePart &part, BitStream &bs, const ColorAndPartPacker *packingContext);
52 
53 class Costume
54 {
55 public:
56  enum : uint32_t {class_version = 1};
57  size_t m_index = 0;
58  uint32_t m_character_id = 0; // who does this costume belong to?
59  float m_height = 0;
60  float m_physique = 0;
61  uint32_t m_body_type = 0;
62  uint32_t m_skin_color = 0;
64  int m_num_parts = 0;
65  std::vector<CostumePart> m_parts;
66 
68 
69  void storeCharselParts(BitStream &bs) const;
70  void storeCharsel(BitStream &bs) const;
71  void serializeToDb(QString &tgt) const;
72  void serializeFromDb(const QString &src);
73  void dump() const;
74 
75  template<class Archive>
76  void serialize(Archive &archive, uint32_t const version);
77 };
78 
79 using vCostumes = std::vector<Costume>;
80 
81 void serializefrom(Costume &tgt, BitStream &bs, const ColorAndPartPacker *packer);
82 void serializeto(const Costume &tgt, BitStream &bs, const ColorAndPartPacker *packer);
83 void dumpCostumes(vCostumes &costumes);
The ColorAndPartPacker class is responsible for packing/unpacking colors and part names from BitStrea...
Definition: CommonNetStructures.h:40
QString name_5
Definition: Costume.h:44
uint32_t m_colors[2]
Definition: Costume.h:45
void serialize(Archive &archive, glm::vec3 &m)
Definition: serialization_types.h:110
Definition: BitStream.h:34
archive(cereal::make_nvp("OriginIdx", ed.m_origin_idx))
int g_max_num_costume_slots
Definition: Costume.cpp:21
void serializeFromDb(Parse_CharAttrib &data, const QString &src)
Definition: attrib_serializers.cpp:197
static Costume NullCostume
Definition: Costume.h:67
std::vector< Costume > vCostumes
Definition: Costume.h:79
std::vector< CostumePart > m_parts
Definition: Costume.h:65
QString m_texture_2
Definition: Costume.h:41
bool m_full_part
Definition: Costume.h:47
bool m_send_full_costume
Definition: Costume.h:63
QString name_3
Definition: Costume.h:42
QString m_geometry
Definition: Costume.h:39
uint8_t m_type
Definition: Costume.h:46
void serializeToDb(const Parse_CharAttrib &data, QString &tgt)
Definition: attrib_serializers.cpp:187
QString name_4
Definition: Costume.h:43
Definition: Costume.h:53
QString m_texture_1
Definition: Costume.h:40
Definition: Costume.h:19
void serializefrom(CostumePart &part, BitStream &bs, const ColorAndPartPacker *packingContext)
Definition: Costume.cpp:68
Definition: Costume.h:21
Type
Definition: Costume.h:22
EntityData uint32_t const version
Definition: entitydata_serializers.cpp:25
void serializeto(const CostumePart &part, BitStream &bs, const ColorAndPartPacker *packingContext)
Definition: Costume.cpp:42
void dumpCostumes(vCostumes &costumes)
Definition: Costume.cpp:207