Eluna add uint64 methods

This commit is contained in:
Rochet2
2014-04-06 14:05:53 +03:00
committed by Foereaper
parent e0f2bea853
commit 46a5f4d033
2 changed files with 56 additions and 11 deletions

View File

@@ -115,6 +115,7 @@ ElunaRegister<Object> ObjectMethods[] =
{ "GetFloatValue", &LuaObject::GetFloatValue }, // :GetFloatValue(index) - returns a float value from object fields
{ "GetByteValue", &LuaObject::GetByteValue }, // :GetByteValue(index, offset) - returns a byte value from object fields
{ "GetUInt16Value", &LuaObject::GetUInt16Value }, // :GetUInt16Value(index, offset) - returns a uint16 value from object fields
{ "GetUInt64Value", &LuaObject::GetUInt64Value }, // :GetUInt64Value(index) - returns a uint64 value from object fields
{ "GetScale", &LuaObject::GetScale }, // :GetScale()
{ "GetTypeId", &LuaObject::GetTypeId }, // :GetTypeId() - Returns the object's typeId
@@ -126,6 +127,7 @@ ElunaRegister<Object> ObjectMethods[] =
{ "SetByteValue", &LuaObject::SetByteValue }, // :SetByteValue(index, offset, value) - Sets a byte value for the object
{ "SetUInt16Value", &LuaObject::SetUInt16Value }, // :SetUInt16Value(index, offset, value) - Sets an uint16 value for the object
{ "SetInt16Value", &LuaObject::SetInt16Value }, // :SetInt16Value(index, offset, value) - Sets an int16 value for the object
{ "SetUInt64Value", &LuaObject::SetUInt64Value }, // :SetUInt64Value(index, value) - Sets an uint64 value for the object
{ "SetScale", &LuaObject::SetScale }, // :SetScale(scale)
{ "SetFlag", &LuaObject::SetFlag }, // :SetFlag(index, flag)
@@ -140,6 +142,9 @@ ElunaRegister<Object> ObjectMethods[] =
{ "ToPlayer", &LuaObject::ToPlayer }, // :ToPlayer()
{ "ToCorpse", &LuaObject::ToCorpse }, // :ToCorpse()
{ "RemoveFlag", &LuaObject::RemoveFlag }, // :RemoveFlag(index, flag)
{ "RemoveUInt64Value", &LuaObject::RemoveUInt64Value }, // :RemoveUInt64Value(index, value)
{ "AddUInt64Value", &LuaObject::AddUInt64Value }, // :AddUInt64Value(index, value)
{ "ApplyModUInt64Value", &LuaObject::ApplyModUInt64Value }, // :ApplyModUInt64Value(index, value, apply)
{ NULL, NULL },
};

View File

@@ -19,7 +19,7 @@ namespace LuaObject
return 1;
}
static int IsInWorld(lua_State* L, Object* obj)
int IsInWorld(lua_State* L, Object* obj)
{
sEluna->Push(L, obj->IsInWorld());
return 1;
@@ -63,36 +63,43 @@ namespace LuaObject
return 1;
}
static int GetScale(lua_State* L, Object* obj)
int GetScale(lua_State* L, Object* obj)
{
sEluna->Push(L, obj->GetObjectScale());
return 1;
}
static int GetEntry(lua_State* L, Object* obj)
int GetEntry(lua_State* L, Object* obj)
{
sEluna->Push(L, obj->GetEntry());
return 1;
}
static int GetGUID(lua_State* L, Object* obj)
int GetGUID(lua_State* L, Object* obj)
{
sEluna->Push(L, obj->GET_GUID());
return 1;
}
static int GetGUIDLow(lua_State* L, Object* obj)
int GetGUIDLow(lua_State* L, Object* obj)
{
sEluna->Push(L, obj->GetGUIDLow());
return 1;
}
static int GetTypeId(lua_State* L, Object* obj)
int GetTypeId(lua_State* L, Object* obj)
{
sEluna->Push(L, obj->GetTypeId());
return 1;
}
int GetUInt64Value(lua_State* L, Object* obj)
{
uint16 index = sEluna->CHECKVAL<uint16>(L, 2);
obj->GetUInt64Value(index);
return 0;
}
/* SETTERS */
int SetFlag(lua_State* L, Object* obj)
{
@@ -163,6 +170,14 @@ namespace LuaObject
return 0;
}
int SetUInt64Value(lua_State* L, Object* obj)
{
uint16 index = sEluna->CHECKVAL<uint16>(L, 2);
uint64 value = sEluna->CHECKVAL<uint64>(L, 3);
obj->SetUInt64Value(index, value);
return 0;
}
/* OTHER */
int RemoveFlag(lua_State* L, Object* obj)
{
@@ -181,34 +196,59 @@ namespace LuaObject
return 0;
}
static int ToCorpse(lua_State* L, Object* obj)
int ToCorpse(lua_State* L, Object* obj)
{
sEluna->Push(L, obj->ToCorpse());
return 1;
}
static int ToGameObject(lua_State* L, Object* obj)
int ToGameObject(lua_State* L, Object* obj)
{
sEluna->Push(L, obj->ToGameObject());
return 1;
}
static int ToUnit(lua_State* L, Object* obj)
int ToUnit(lua_State* L, Object* obj)
{
sEluna->Push(L, obj->ToUnit());
return 1;
}
static int ToCreature(lua_State* L, Object* obj)
int ToCreature(lua_State* L, Object* obj)
{
sEluna->Push(L, obj->ToCreature());
return 1;
}
static int ToPlayer(lua_State* L, Object* obj)
int ToPlayer(lua_State* L, Object* obj)
{
sEluna->Push(L, obj->ToPlayer());
return 1;
}
int RemoveUInt64Value(lua_State* L, Object* obj)
{
uint16 index = sEluna->CHECKVAL<uint16>(L, 2);
uint64 value = sEluna->CHECKVAL<uint64>(L, 3);
obj->RemoveUInt64Value(index, value);
return 0;
}
int AddUInt64Value(lua_State* L, Object* obj)
{
uint16 index = sEluna->CHECKVAL<uint16>(L, 2);
uint64 value = sEluna->CHECKVAL<uint64>(L, 3);
obj->AddUInt64Value(index, value);
return 0;
}
int ApplyModUInt64Value(lua_State* L, Object* obj)
{
uint16 index = sEluna->CHECKVAL<uint16>(L, 2);
int32 value = sEluna->CHECKVAL<int32>(L, 3);
bool apply = sEluna->CHECKVAL<bool>(L, 4);
obj->ApplyModUInt64Value(index, value, apply);
return 0;
}
};
#endif