From f92512ebdf9b163a8e830055d7887b7afe554699 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 21 Nov 2013 22:09:11 +0100 Subject: Exported static XP calculation to Lua API. --- source/Bindings.cpp | 108 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 89 insertions(+), 19 deletions(-) (limited to 'source/Bindings.cpp') diff --git a/source/Bindings.cpp b/source/Bindings.cpp index 9fdd28383..3e261b121 100644 --- a/source/Bindings.cpp +++ b/source/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 11/16/13 21:58:48. +** Generated automatically by tolua++-1.0.92 on 11/21/13 22:02:55. */ #ifndef __cplusplus @@ -190,7 +190,7 @@ static void tolua_reg_types (lua_State* tolua_S) tolua_usertype(tolua_S,"cThrownEnderPearlEntity"); tolua_usertype(tolua_S,"cFurnaceEntity"); tolua_usertype(tolua_S,"cEntity"); - tolua_usertype(tolua_S,"cCuboid"); + tolua_usertype(tolua_S,"cExpBottleEntity"); tolua_usertype(tolua_S,"cEnchantments"); tolua_usertype(tolua_S,"cMonster"); tolua_usertype(tolua_S,"cPluginLua"); @@ -212,49 +212,51 @@ static void tolua_reg_types (lua_State* tolua_S) tolua_usertype(tolua_S,"cLineBlockTracer"); tolua_usertype(tolua_S,"cListeners"); tolua_usertype(tolua_S,"cThrownSnowballEntity"); - tolua_usertype(tolua_S,"Vector3d"); + tolua_usertype(tolua_S,"cFireworkEntity"); tolua_usertype(tolua_S,"TakeDamageInfo"); tolua_usertype(tolua_S,"cCraftingRecipe"); tolua_usertype(tolua_S,"cPlugin"); tolua_usertype(tolua_S,"cItemGrid"); tolua_usertype(tolua_S,"cHTTPServer::cCallbacks"); tolua_usertype(tolua_S,"cLuaWindow"); - tolua_usertype(tolua_S,"cInventory"); + tolua_usertype(tolua_S,"cServer"); tolua_usertype(tolua_S,"cHopperEntity"); tolua_usertype(tolua_S,"std::vector"); tolua_usertype(tolua_S,"cBlockEntityWithItems"); tolua_usertype(tolua_S,"cWindow"); tolua_usertype(tolua_S,"cCraftingGrid"); - tolua_usertype(tolua_S,"cItem"); tolua_usertype(tolua_S,"cBlockArea"); - tolua_usertype(tolua_S,"cArrowEntity"); - tolua_usertype(tolua_S,"cDropSpenserEntity"); tolua_usertype(tolua_S,"cGroup"); + tolua_usertype(tolua_S,"cItem"); tolua_usertype(tolua_S,"cTracer"); + tolua_usertype(tolua_S,"cArrowEntity"); + tolua_usertype(tolua_S,"cDropSpenserEntity"); tolua_usertype(tolua_S,"cBoundingBox"); - tolua_usertype(tolua_S,"cNoteEntity"); + tolua_usertype(tolua_S,"cCuboid"); tolua_usertype(tolua_S,"Vector3i"); + tolua_usertype(tolua_S,"cNoteEntity"); + tolua_usertype(tolua_S,"Vector3d"); tolua_usertype(tolua_S,"cBlockEntity"); tolua_usertype(tolua_S,"cCriticalSection"); tolua_usertype(tolua_S,"HTTPTemplateRequest"); - tolua_usertype(tolua_S,"cPlayer"); - tolua_usertype(tolua_S,"cServer"); - tolua_usertype(tolua_S,"cSignEntity"); + tolua_usertype(tolua_S,"cWebPlugin"); tolua_usertype(tolua_S,"cFile"); tolua_usertype(tolua_S,"cItems"); tolua_usertype(tolua_S,"cClientHandle"); - tolua_usertype(tolua_S,"cIniFile"); - tolua_usertype(tolua_S,"cWebPlugin"); - tolua_usertype(tolua_S,"cChatColor"); - tolua_usertype(tolua_S,"cPawn"); - tolua_usertype(tolua_S,"cThrownEggEntity"); - tolua_usertype(tolua_S,"cGroupManager"); tolua_usertype(tolua_S,"cWebAdmin"); + tolua_usertype(tolua_S,"cChatColor"); + tolua_usertype(tolua_S,"cIniFile"); tolua_usertype(tolua_S,"HTTPRequest"); - tolua_usertype(tolua_S,"cProjectileEntity"); tolua_usertype(tolua_S,"HTTPFormData"); + tolua_usertype(tolua_S,"cPawn"); + tolua_usertype(tolua_S,"cPlayer"); + tolua_usertype(tolua_S,"cGroupManager"); + tolua_usertype(tolua_S,"cSignEntity"); tolua_usertype(tolua_S,"cItemGrid::cListener"); + tolua_usertype(tolua_S,"cProjectileEntity"); tolua_usertype(tolua_S,"cDropperEntity"); + tolua_usertype(tolua_S,"cInventory"); + tolua_usertype(tolua_S,"cThrownEggEntity"); } /* method: new of class cIniFile */ @@ -7846,6 +7848,66 @@ static int tolua_AllToLua_cPlayer_GetXpPercentage00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE +/* method: XpForLevel of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_XpForLevel00 +static int tolua_AllToLua_cPlayer_XpForLevel00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + short int a_Level = ((short int) tolua_tonumber(tolua_S,2,0)); + { + short tolua_ret = (short) cPlayer::XpForLevel(a_Level); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'XpForLevel'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: CalcLevelFromXp of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_CalcLevelFromXp00 +static int tolua_AllToLua_cPlayer_CalcLevelFromXp00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + short int a_CurrentXp = ((short int) tolua_tonumber(tolua_S,2,0)); + { + short tolua_ret = (short) cPlayer::CalcLevelFromXp(a_CurrentXp); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'CalcLevelFromXp'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + /* method: GetEyeHeight of class cPlayer */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetEyeHeight00 static int tolua_AllToLua_cPlayer_GetEyeHeight00(lua_State* tolua_S) @@ -30449,13 +30511,14 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_constant(tolua_S,"EATING_TICKS",cPlayer::EATING_TICKS); tolua_constant(tolua_S,"MAX_AIR_LEVEL",cPlayer::MAX_AIR_LEVEL); tolua_constant(tolua_S,"DROWNING_TICKS",cPlayer::DROWNING_TICKS); - tolua_constant(tolua_S,"MIN_EXPERIENCE",cPlayer::MIN_EXPERIENCE); tolua_function(tolua_S,"SetCurrentExperience",tolua_AllToLua_cPlayer_SetCurrentExperience00); tolua_function(tolua_S,"DeltaExperience",tolua_AllToLua_cPlayer_DeltaExperience00); tolua_function(tolua_S,"GetXpLifetimeTotal",tolua_AllToLua_cPlayer_GetXpLifetimeTotal00); tolua_function(tolua_S,"GetCurrentXp",tolua_AllToLua_cPlayer_GetCurrentXp00); tolua_function(tolua_S,"GetXpLevel",tolua_AllToLua_cPlayer_GetXpLevel00); tolua_function(tolua_S,"GetXpPercentage",tolua_AllToLua_cPlayer_GetXpPercentage00); + tolua_function(tolua_S,"XpForLevel",tolua_AllToLua_cPlayer_XpForLevel00); + tolua_function(tolua_S,"CalcLevelFromXp",tolua_AllToLua_cPlayer_CalcLevelFromXp00); tolua_function(tolua_S,"GetEyeHeight",tolua_AllToLua_cPlayer_GetEyeHeight00); tolua_function(tolua_S,"GetEyePosition",tolua_AllToLua_cPlayer_GetEyePosition00); tolua_function(tolua_S,"IsOnGround",tolua_AllToLua_cPlayer_IsOnGround00); @@ -30543,6 +30606,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_constant(tolua_S,"pkEnderPearl",cProjectileEntity::pkEnderPearl); tolua_constant(tolua_S,"pkExpBottle",cProjectileEntity::pkExpBottle); tolua_constant(tolua_S,"pkSplashPotion",cProjectileEntity::pkSplashPotion); + tolua_constant(tolua_S,"pkFirework",cProjectileEntity::pkFirework); tolua_constant(tolua_S,"pkWitherSkull",cProjectileEntity::pkWitherSkull); tolua_constant(tolua_S,"pkFishingFloat",cProjectileEntity::pkFishingFloat); tolua_function(tolua_S,"GetProjectileKind",tolua_AllToLua_cProjectileEntity_GetProjectileKind00); @@ -30572,6 +30636,12 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_cclass(tolua_S,"cThrownSnowballEntity","cThrownSnowballEntity","cProjectileEntity",NULL); tolua_beginmodule(tolua_S,"cThrownSnowballEntity"); tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cExpBottleEntity","cExpBottleEntity","cProjectileEntity",NULL); + tolua_beginmodule(tolua_S,"cExpBottleEntity"); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cFireworkEntity","cFireworkEntity","cProjectileEntity",NULL); + tolua_beginmodule(tolua_S,"cFireworkEntity"); + tolua_endmodule(tolua_S); tolua_cclass(tolua_S,"cGhastFireballEntity","cGhastFireballEntity","cProjectileEntity",NULL); tolua_beginmodule(tolua_S,"cGhastFireballEntity"); tolua_endmodule(tolua_S); -- cgit v1.2.3 From 3de6f6357f3e4c2b0b696e2a0b6cdbdaecdf4136 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 22 Nov 2013 12:26:06 +0100 Subject: Changed cRoot:GetFurnaceRecipe() Lua binding signature. Fix #364. --- source/Bindings.cpp | 50 ++++++++------------------------------------------ 1 file changed, 8 insertions(+), 42 deletions(-) (limited to 'source/Bindings.cpp') diff --git a/source/Bindings.cpp b/source/Bindings.cpp index 3e261b121..da9c86b6b 100644 --- a/source/Bindings.cpp +++ b/source/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 11/21/13 22:02:55. +** Generated automatically by tolua++-1.0.92 on 11/22/13 11:58:39. */ #ifndef __cplusplus @@ -199,9 +199,8 @@ static void tolua_reg_types (lua_State* tolua_S) tolua_usertype(tolua_S,"cPickup"); tolua_usertype(tolua_S,"sWebAdminPage"); tolua_usertype(tolua_S,"cFireChargeEntity"); - tolua_usertype(tolua_S,"cWorld"); + tolua_usertype(tolua_S,"cClientHandle"); tolua_usertype(tolua_S,"cChunkDesc"); - tolua_usertype(tolua_S,"cFurnaceRecipe"); tolua_usertype(tolua_S,"cPluginManager"); tolua_usertype(tolua_S,"Vector3f"); tolua_usertype(tolua_S,"cCraftingRecipes"); @@ -225,24 +224,24 @@ static void tolua_reg_types (lua_State* tolua_S) tolua_usertype(tolua_S,"cBlockEntityWithItems"); tolua_usertype(tolua_S,"cWindow"); tolua_usertype(tolua_S,"cCraftingGrid"); + tolua_usertype(tolua_S,"cWorld"); tolua_usertype(tolua_S,"cBlockArea"); - tolua_usertype(tolua_S,"cGroup"); tolua_usertype(tolua_S,"cItem"); - tolua_usertype(tolua_S,"cTracer"); + tolua_usertype(tolua_S,"cGroup"); tolua_usertype(tolua_S,"cArrowEntity"); tolua_usertype(tolua_S,"cDropSpenserEntity"); + tolua_usertype(tolua_S,"cTracer"); tolua_usertype(tolua_S,"cBoundingBox"); tolua_usertype(tolua_S,"cCuboid"); - tolua_usertype(tolua_S,"Vector3i"); tolua_usertype(tolua_S,"cNoteEntity"); - tolua_usertype(tolua_S,"Vector3d"); + tolua_usertype(tolua_S,"Vector3i"); tolua_usertype(tolua_S,"cBlockEntity"); tolua_usertype(tolua_S,"cCriticalSection"); tolua_usertype(tolua_S,"HTTPTemplateRequest"); - tolua_usertype(tolua_S,"cWebPlugin"); + tolua_usertype(tolua_S,"Vector3d"); tolua_usertype(tolua_S,"cFile"); tolua_usertype(tolua_S,"cItems"); - tolua_usertype(tolua_S,"cClientHandle"); + tolua_usertype(tolua_S,"cWebPlugin"); tolua_usertype(tolua_S,"cWebAdmin"); tolua_usertype(tolua_S,"cChatColor"); tolua_usertype(tolua_S,"cIniFile"); @@ -19715,38 +19714,6 @@ static int tolua_AllToLua_cRoot_GetCraftingRecipes00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE -/* method: GetFurnaceRecipe of class cRoot */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetFurnaceRecipe00 -static int tolua_AllToLua_cRoot_GetFurnaceRecipe00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cRoot",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cRoot* self = (cRoot*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetFurnaceRecipe'", NULL); -#endif - { - cFurnaceRecipe* tolua_ret = (cFurnaceRecipe*) self->GetFurnaceRecipe(); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cFurnaceRecipe"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetFurnaceRecipe'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - /* method: GetWebAdmin of class cRoot */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetWebAdmin00 static int tolua_AllToLua_cRoot_GetWebAdmin00(lua_State* tolua_S) @@ -31126,7 +31093,6 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_function(tolua_S,"SetPrimaryServerVersion",tolua_AllToLua_cRoot_SetPrimaryServerVersion00); tolua_function(tolua_S,"GetGroupManager",tolua_AllToLua_cRoot_GetGroupManager00); tolua_function(tolua_S,"GetCraftingRecipes",tolua_AllToLua_cRoot_GetCraftingRecipes00); - tolua_function(tolua_S,"GetFurnaceRecipe",tolua_AllToLua_cRoot_GetFurnaceRecipe00); tolua_function(tolua_S,"GetWebAdmin",tolua_AllToLua_cRoot_GetWebAdmin00); tolua_function(tolua_S,"GetPluginManager",tolua_AllToLua_cRoot_GetPluginManager00); tolua_function(tolua_S,"QueueExecuteConsoleCommand",tolua_AllToLua_cRoot_QueueExecuteConsoleCommand00); -- cgit v1.2.3 From 281bf8f90bbd295bb81ec09889bcaeefa689e6b2 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 22 Nov 2013 16:50:03 +0100 Subject: Added cRoot:GetFurnaceFuelBurnTime() to Lua API. --- source/Bindings.cpp | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'source/Bindings.cpp') diff --git a/source/Bindings.cpp b/source/Bindings.cpp index da9c86b6b..65c154b78 100644 --- a/source/Bindings.cpp +++ b/source/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 11/22/13 11:58:39. +** Generated automatically by tolua++-1.0.92 on 11/22/13 16:24:50. */ #ifndef __cplusplus @@ -19714,6 +19714,36 @@ static int tolua_AllToLua_cRoot_GetCraftingRecipes00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE +/* method: GetFurnaceFuelBurnTime of class cRoot */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetFurnaceFuelBurnTime00 +static int tolua_AllToLua_cRoot_GetFurnaceFuelBurnTime00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cRoot",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cItem* a_Fuel = ((const cItem*) tolua_tousertype(tolua_S,2,0)); + { + int tolua_ret = (int) cRoot::GetFurnaceFuelBurnTime(*a_Fuel); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetFurnaceFuelBurnTime'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + /* method: GetWebAdmin of class cRoot */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetWebAdmin00 static int tolua_AllToLua_cRoot_GetWebAdmin00(lua_State* tolua_S) @@ -31093,6 +31123,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_function(tolua_S,"SetPrimaryServerVersion",tolua_AllToLua_cRoot_SetPrimaryServerVersion00); tolua_function(tolua_S,"GetGroupManager",tolua_AllToLua_cRoot_GetGroupManager00); tolua_function(tolua_S,"GetCraftingRecipes",tolua_AllToLua_cRoot_GetCraftingRecipes00); + tolua_function(tolua_S,"GetFurnaceFuelBurnTime",tolua_AllToLua_cRoot_GetFurnaceFuelBurnTime00); tolua_function(tolua_S,"GetWebAdmin",tolua_AllToLua_cRoot_GetWebAdmin00); tolua_function(tolua_S,"GetPluginManager",tolua_AllToLua_cRoot_GetPluginManager00); tolua_function(tolua_S,"QueueExecuteConsoleCommand",tolua_AllToLua_cRoot_QueueExecuteConsoleCommand00); -- cgit v1.2.3 From 94e14e1ace16a265b8e58a186c308609c504d288 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sat, 23 Nov 2013 20:26:00 +0100 Subject: Added cFile:ReadWholeFile() to Lua API. --- source/Bindings.cpp | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'source/Bindings.cpp') diff --git a/source/Bindings.cpp b/source/Bindings.cpp index 65c154b78..ad3ad8423 100644 --- a/source/Bindings.cpp +++ b/source/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 11/22/13 16:24:50. +** Generated automatically by tolua++-1.0.92 on 11/23/13 19:57:30. */ #ifndef __cplusplus @@ -2303,6 +2303,37 @@ static int tolua_AllToLua_cFile_CreateFolder00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE +/* method: ReadWholeFile of class cFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cFile_ReadWholeFile00 +static int tolua_AllToLua_cFile_ReadWholeFile00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const AString a_FileName = ((const AString) tolua_tocppstring(tolua_S,2,0)); + { + AString tolua_ret = (AString) cFile::ReadWholeFile(a_FileName); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_FileName); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'ReadWholeFile'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + /* function: BlockStringToType */ #ifndef TOLUA_DISABLE_tolua_AllToLua_BlockStringToType00 static int tolua_AllToLua_BlockStringToType00(lua_State* tolua_S) @@ -29538,6 +29569,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_function(tolua_S,"IsFile",tolua_AllToLua_cFile_IsFile00); tolua_function(tolua_S,"GetSize",tolua_AllToLua_cFile_GetSize00); tolua_function(tolua_S,"CreateFolder",tolua_AllToLua_cFile_CreateFolder00); + tolua_function(tolua_S,"ReadWholeFile",tolua_AllToLua_cFile_ReadWholeFile00); tolua_endmodule(tolua_S); tolua_constant(tolua_S,"E_BLOCK_AIR",E_BLOCK_AIR); tolua_constant(tolua_S,"E_BLOCK_STONE",E_BLOCK_STONE); -- cgit v1.2.3