61 lines
1.4 KiB
C++
Executable File
61 lines
1.4 KiB
C++
Executable File
#include "precompile.h"
|
|
#include "global.h"
|
|
|
|
int g_hint_flags = 0;
|
|
|
|
bool Global::IsVirtualItem(int itemid)
|
|
{
|
|
return (itemid == VID_Item_Exp ||
|
|
itemid == VID_Item_Gold ||
|
|
itemid == VID_Soul_Stone ||
|
|
itemid == VID_Pickaxe);
|
|
}
|
|
|
|
time_t Global::BetweenDays(time_t time1, time_t time2)
|
|
{
|
|
return (time1 + g_time_zone*3600)/3600/24 - (time2 + g_time_zone*3600)/3600/24;
|
|
}
|
|
|
|
time_t Global::GetDaySeconds(time_t time, int incdays)
|
|
{
|
|
return time_t((time + g_time_zone * 3600)/3600/24 + incdays) * 3600 * 24 - 3600 * g_time_zone;
|
|
}
|
|
|
|
bool Global::IsTimeToReset(int time)
|
|
{
|
|
return BetweenDays(g_nowtime - 60 * SYS_RESET_TIME, time - 60 * SYS_RESET_TIME) > 0;
|
|
}
|
|
|
|
|
|
int Global::g_nowtime = time(nullptr);
|
|
int Global::g_time_zone = 8;
|
|
bool Global::g_shutdown = false;
|
|
ColliderComponent* Global::last_collider = nullptr;
|
|
|
|
bool IsValidSlotId(int slot_id)
|
|
{
|
|
return slot_id >= 0 && slot_id < IS_END;
|
|
}
|
|
|
|
SkillFunc_e Str2SkillFunc(const std::string& func_str)
|
|
{
|
|
if (func_str == "jump") {
|
|
return Skill_Jump;
|
|
} else if (func_str == "shot") {
|
|
return Skill_Shot;
|
|
} else if (func_str == "summon_object") {
|
|
return Skill_SummonObject;
|
|
}
|
|
return Skill_FuncNone;
|
|
}
|
|
|
|
bool IsValidBuffEffect(int buff_effect)
|
|
{
|
|
return buff_effect > BET_Begin && buff_effect < BET_End;
|
|
}
|
|
|
|
bool IsValidHumanAttr(int attr_type)
|
|
{
|
|
return attr_type > HAT_Begin && attr_type < HAT_End;
|
|
}
|