1
This commit is contained in:
parent
89e72625c9
commit
5b17e9bb9b
0
server/gameserver/mt/BattleUnit.cc
Normal file
0
server/gameserver/mt/BattleUnit.cc
Normal file
15
server/gameserver/mt/BattleUnit.h
Normal file
15
server/gameserver/mt/BattleUnit.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "mt/macro.h"
|
||||||
|
#include "mtb/BattleUnit.h"
|
||||||
|
|
||||||
|
namespace mt
|
||||||
|
{
|
||||||
|
|
||||||
|
DECLARE_ID_TABLE(BattleUnit, mtb::BattleUnit,
|
||||||
|
"battleUnit@battleUnit.json",
|
||||||
|
"id")
|
||||||
|
public:
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
37
server/gameserver/mtb/BattleUnit.h
Normal file
37
server/gameserver/mtb/BattleUnit.h
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <bitset>
|
||||||
|
|
||||||
|
namespace mtb
|
||||||
|
{
|
||||||
|
|
||||||
|
class BattleUnit
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
std::shared_ptr<a8::reflect::Class> GetClass() const;
|
||||||
|
int id() const { return id_; };
|
||||||
|
int weapon() const { return weapon_; };
|
||||||
|
int level() const { return level_; };
|
||||||
|
const std::string levelAttribute() const { return levelAttribute_; };
|
||||||
|
const std::string cost() const { return cost_; };
|
||||||
|
|
||||||
|
bool has_id() const { return __flags__.test(0);};
|
||||||
|
bool has_weapon() const { return __flags__.test(1);};
|
||||||
|
bool has_level() const { return __flags__.test(2);};
|
||||||
|
bool has_levelAttribute() const { return __flags__.test(3);};
|
||||||
|
bool has_cost() const { return __flags__.test(4);};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
int id_ = 0;
|
||||||
|
int weapon_ = 0;
|
||||||
|
int level_ = 0;
|
||||||
|
std::string levelAttribute_;
|
||||||
|
std::string cost_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
std::bitset<5> __flags__;
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
@ -45,6 +45,7 @@
|
|||||||
#include "mtb/BattleLevelAttribute.h"
|
#include "mtb/BattleLevelAttribute.h"
|
||||||
#include "mtb/BattleRandAttribute.h"
|
#include "mtb/BattleRandAttribute.h"
|
||||||
#include "mtb/BattleWeaponAttribute.h"
|
#include "mtb/BattleWeaponAttribute.h"
|
||||||
|
#include "mtb/BattleUnit.h"
|
||||||
#include "mtb/Condition.h"
|
#include "mtb/Condition.h"
|
||||||
#include "mtb/Distribution.h"
|
#include "mtb/Distribution.h"
|
||||||
#include "mtb/LootConfig.h"
|
#include "mtb/LootConfig.h"
|
||||||
@ -976,6 +977,20 @@ namespace mtb
|
|||||||
return meta_class;
|
return meta_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<a8::reflect::Class> BattleUnit::GetClass() const
|
||||||
|
{
|
||||||
|
std::shared_ptr<a8::reflect::Class> meta_class = nullptr;
|
||||||
|
if (!meta_class) {
|
||||||
|
meta_class = std::make_shared<a8::reflect::Class>("BattleUnit", 5, 0);
|
||||||
|
meta_class->SetSimpleField(0, "id", a8::reflect::ET_INT32, my_offsetof2(BattleUnit, id_));
|
||||||
|
meta_class->SetSimpleField(1, "weapon", a8::reflect::ET_INT32, my_offsetof2(BattleUnit, weapon_));
|
||||||
|
meta_class->SetSimpleField(2, "level", a8::reflect::ET_INT32, my_offsetof2(BattleUnit, level_));
|
||||||
|
meta_class->SetSimpleField(3, "levelAttribute", a8::reflect::ET_STRING, my_offsetof2(BattleUnit, levelAttribute_));
|
||||||
|
meta_class->SetSimpleField(4, "cost", a8::reflect::ET_STRING, my_offsetof2(BattleUnit, cost_));
|
||||||
|
}
|
||||||
|
return meta_class;
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<a8::reflect::Class> Condition::GetClass() const
|
std::shared_ptr<a8::reflect::Class> Condition::GetClass() const
|
||||||
{
|
{
|
||||||
std::shared_ptr<a8::reflect::Class> meta_class = nullptr;
|
std::shared_ptr<a8::reflect::Class> meta_class = nullptr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user