1
This commit is contained in:
parent
81816d91be
commit
b39a50d3d8
@ -1,80 +0,0 @@
|
||||
#include "precompile.h"
|
||||
#include "global.h"
|
||||
|
||||
#include "attrdefine.h"
|
||||
|
||||
int g_hint_flags = 0;
|
||||
|
||||
int Global::g_nowtime = time(nullptr);
|
||||
ColliderComponent* Global::last_collider = nullptr;
|
||||
|
||||
bool IsValidSlotId(int slot_id)
|
||||
{
|
||||
return slot_id >= 0 && slot_id < IS_END;
|
||||
}
|
||||
|
||||
bool IsValidBuffEffect(int buff_effect)
|
||||
{
|
||||
return buff_effect > kBET_Begin && buff_effect < (kBET_End + 10);
|
||||
}
|
||||
|
||||
bool IsValidHumanAttr(int attr_type)
|
||||
{
|
||||
return attr_type > kHAT_Begin && attr_type < kHAT_End;
|
||||
}
|
||||
|
||||
bool IsValidHumanVirtualAttr(int attr_type)
|
||||
{
|
||||
return attr_type > kHVAT_Begin && attr_type < kHVAT_End;
|
||||
}
|
||||
|
||||
bool IsValidEventBuff(int event)
|
||||
{
|
||||
return event >= 0 && event < kEventBuffEnd;
|
||||
}
|
||||
|
||||
bool IsValidWeaponOpt(int opt)
|
||||
{
|
||||
return opt >= 0 && opt < kWeaponOptEnd;
|
||||
}
|
||||
|
||||
bool IsValidBuffOpt(int opt)
|
||||
{
|
||||
return opt >= 0 && opt < kBuffOptEnd;
|
||||
}
|
||||
|
||||
float GetAttrAbsFromXObject(std::shared_ptr<a8::XObject> obj, int attr_id)
|
||||
{
|
||||
if (obj->IsArray()) {
|
||||
for (int i = 0; i < obj->Size(); ++i) {
|
||||
auto attr = obj->At(i);
|
||||
if (attr->IsObject()){
|
||||
int tmp_attr_id = attr->Get("attr_id", 0);
|
||||
int tmp_type = attr->Get("type", 0);
|
||||
int tmp_val = attr->Get("val", 0);
|
||||
if (tmp_attr_id == attr_id && tmp_type == 1) {
|
||||
return tmp_val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
float GetAttrRateFromXObject(std::shared_ptr<a8::XObject> obj,int attr_id)
|
||||
{
|
||||
if (obj->IsArray()) {
|
||||
for (int i = 0; i < obj->Size(); ++i) {
|
||||
auto attr = obj->At(i);
|
||||
if (attr->IsObject()){
|
||||
int tmp_attr_id = attr->Get("attr_id", 0);
|
||||
int tmp_type = attr->Get("type", 0);
|
||||
int tmp_val = attr->Get("val", 0);
|
||||
if (tmp_attr_id == attr_id && tmp_type == 2) {
|
||||
return tmp_val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <a8/singleton.h>
|
||||
|
||||
extern int g_hint_flags;
|
||||
|
||||
class ColliderComponent;
|
||||
class Global : public a8::Singleton<Global>
|
||||
{
|
||||
private:
|
||||
Global() {};
|
||||
friend class a8::Singleton<Global>;
|
||||
public:
|
||||
|
||||
static int g_nowtime;
|
||||
static ColliderComponent* last_collider;
|
||||
int traversing_cell_creature_count = 0;
|
||||
int verify_set_pos = 0;
|
||||
};
|
||||
|
||||
bool IsValidSlotId(int slot_id);
|
||||
bool IsValidBuffEffect(int buff_effect);
|
||||
bool IsValidHumanAttr(int attr_type);
|
||||
bool IsValidHumanVirtualAttr(int attr_type);
|
||||
bool IsValidEventBuff(int event);
|
||||
bool IsValidWeaponOpt(int opt);
|
||||
bool IsValidBuffOpt(int opt);
|
||||
float GetAttrAbsFromXObject(std::shared_ptr<a8::XObject> obj, int attr_id);
|
||||
float GetAttrRateFromXObject(std::shared_ptr<a8::XObject> obj,int attr_id);
|
Loading…
x
Reference in New Issue
Block a user