mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
Expose time diff functions
This commit is contained in:
@@ -2254,5 +2254,30 @@ namespace LuaGlobalFunctions
|
|||||||
Eluna::Push(L, Player::IsBagPos((bag << 8) + slot));
|
Eluna::Push(L, Player::IsBagPos((bag << 8) + slot));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns current time in ms
|
||||||
|
*
|
||||||
|
* @return uint32 currTime
|
||||||
|
*/
|
||||||
|
int GetCurrTime(Eluna* E)
|
||||||
|
{
|
||||||
|
Eluna::Push(E->L, ElunaUtil::GetCurrTime());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns difference from a [Global:GetCurrTime] time to now
|
||||||
|
*
|
||||||
|
* @param uint32 oldTime
|
||||||
|
* @return uint32 timeDiff
|
||||||
|
*/
|
||||||
|
int GetTimeDiff(Eluna* E)
|
||||||
|
{
|
||||||
|
uint32 oldtimems = Eluna::CHECKVAL<uint32>(E->L, 1);
|
||||||
|
|
||||||
|
Eluna::Push(E->L, ElunaUtil::GetTimeDiff(oldtimems));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -85,6 +85,8 @@ ElunaGlobal::ElunaRegister GlobalMethods[] =
|
|||||||
{ "bit_and", &LuaGlobalFunctions::bit_and },
|
{ "bit_and", &LuaGlobalFunctions::bit_and },
|
||||||
{ "GetItemLink", &LuaGlobalFunctions::GetItemLink },
|
{ "GetItemLink", &LuaGlobalFunctions::GetItemLink },
|
||||||
{ "GetMapById", &LuaGlobalFunctions::GetMapById },
|
{ "GetMapById", &LuaGlobalFunctions::GetMapById },
|
||||||
|
{ "GetCurrTime", &LuaGlobalFunctions::GetCurrTime },
|
||||||
|
{ "GetTimeDiff", &LuaGlobalFunctions::GetTimeDiff },
|
||||||
|
|
||||||
// Boolean
|
// Boolean
|
||||||
{ "IsInventoryPos", &LuaGlobalFunctions::IsInventoryPos },
|
{ "IsInventoryPos", &LuaGlobalFunctions::IsInventoryPos },
|
||||||
|
|||||||
Reference in New Issue
Block a user