diff --git a/server/robotserver/global.cc b/server/robotserver/global.cc deleted file mode 100644 index fa8914d4..00000000 --- a/server/robotserver/global.cc +++ /dev/null @@ -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 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 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; -} diff --git a/server/robotserver/global.h b/server/robotserver/global.h deleted file mode 100644 index 3fe1cdfd..00000000 --- a/server/robotserver/global.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#include - -extern int g_hint_flags; - -class ColliderComponent; -class Global : public a8::Singleton -{ - private: - Global() {}; - friend class a8::Singleton; - 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 obj, int attr_id); -float GetAttrRateFromXObject(std::shared_ptr obj,int attr_id);