diff options
Diffstat (limited to '')
-rw-r--r-- | source/Bindings.cpp | 68 | ||||
-rw-r--r-- | source/Bindings.h | 2 | ||||
-rw-r--r-- | source/cClientHandle.cpp | 2 | ||||
-rw-r--r-- | source/cPlayer.cpp | 5 | ||||
-rw-r--r-- | source/cPlayer.h | 5 | ||||
-rw-r--r-- | source/lua5.1.dll | bin | 0 -> 167424 bytes |
6 files changed, 79 insertions, 3 deletions
diff --git a/source/Bindings.cpp b/source/Bindings.cpp index a0465e8ea..9040c7070 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/08/11 02:11:35.
+** Generated automatically by tolua++-1.0.92 on 11/09/11 15:37:09.
*/
#ifndef __cplusplus
@@ -5099,6 +5099,70 @@ tolua_lerror: }
#endif //#ifndef TOLUA_DISABLE
+/* method: GetGameMode of class cPlayer */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetGameMode00
+static int tolua_AllToLua_cPlayer_GetGameMode00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,2,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0);
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetGameMode'", NULL);
+#endif
+ {
+ int tolua_ret = (int) self->GetGameMode();
+ tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'GetGameMode'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: GetIP of class cPlayer */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetIP00
+static int tolua_AllToLua_cPlayer_GetIP00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,2,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0);
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetIP'", NULL);
+#endif
+ {
+ std::string tolua_ret = (std::string) self->GetIP();
+ tolua_pushcppstring(tolua_S,(const char*)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'GetIP'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
/* method: MoveTo of class cPlayer */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_MoveTo00
static int tolua_AllToLua_cPlayer_MoveTo00(lua_State* tolua_S)
@@ -15631,6 +15695,8 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_function(tolua_S,"GetInventory",tolua_AllToLua_cPlayer_GetInventory00);
tolua_function(tolua_S,"TeleportTo",tolua_AllToLua_cPlayer_TeleportTo00);
tolua_function(tolua_S,"TeleportTo",tolua_AllToLua_cPlayer_TeleportTo01);
+ tolua_function(tolua_S,"GetGameMode",tolua_AllToLua_cPlayer_GetGameMode00);
+ tolua_function(tolua_S,"GetIP",tolua_AllToLua_cPlayer_GetIP00);
tolua_function(tolua_S,"MoveTo",tolua_AllToLua_cPlayer_MoveTo00);
tolua_function(tolua_S,"GetClientHandle",tolua_AllToLua_cPlayer_GetClientHandle00);
tolua_function(tolua_S,"SendMessage",tolua_AllToLua_cPlayer_SendMessage00);
diff --git a/source/Bindings.h b/source/Bindings.h index 844bc3ff0..917cf80d1 100644 --- a/source/Bindings.h +++ b/source/Bindings.h @@ -1,6 +1,6 @@ /*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 11/08/11 02:11:36.
+** Generated automatically by tolua++-1.0.92 on 11/09/11 15:37:10.
*/
/* Exported function */
diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp index 2632d5ac6..4cc176db6 100644 --- a/source/cClientHandle.cpp +++ b/source/cClientHandle.cpp @@ -1078,6 +1078,8 @@ void cClientHandle::Tick(float a_Dt) World->LockEntities();
m_Player->SetGameMode ( World->GetGameMode() ); //set player's gamemode to server's gamemode at login.
+ m_Player->SetIP ( m_pState->Socket.GetIPString() );
+
cRoot::Get()->GetPluginManager()->CallHook( cPluginManager::E_PLUGIN_PLAYER_SPAWN, 1, m_Player );
// Return a server login packet
diff --git a/source/cPlayer.cpp b/source/cPlayer.cpp index 62098eb0b..8aefd36ba 100644 --- a/source/cPlayer.cpp +++ b/source/cPlayer.cpp @@ -61,6 +61,7 @@ struct cPlayer::sPlayerState cPlayer::cPlayer(cClientHandle* a_Client, const char* a_PlayerName)
: m_bBurnable(true)
, m_GameMode( 0 )
+ , m_IP("")
, m_LastBlockActionTime( 0 )
, e_EPMetaState(NORMAL)
, m_bVisible( true )
@@ -419,6 +420,10 @@ void cPlayer::SetGameMode( int a_GameMode ) m_GameMode = a_GameMode;
}
+void cPlayer::SetIP( std::string a_IP )
+{
+ m_IP = a_IP;
+}
#ifdef SendMessage // Cause stupid windows.h defines SendMessage as SendMessageA
#undef SendMessage
diff --git a/source/cPlayer.h b/source/cPlayer.h index fc546bd8d..08234df88 100644 --- a/source/cPlayer.h +++ b/source/cPlayer.h @@ -31,10 +31,12 @@ public: virtual void TeleportTo( cEntity* a_Entity ); //tolua_export
virtual void TeleportTo( const double & a_PosX, const double & a_PosY, const double & a_PosZ ); //tolua_export
- int GetGameMode() { return m_GameMode; } //return GameMode for player.
+ int GetGameMode() { return m_GameMode; } //tolua_export
+ std::string GetIP() { return m_IP; } //tolua_export
float GetLastBlockActionTime() { return m_LastBlockActionTime; } //return LastBlockActionTime for player.
void SetLastBlockActionTime();
void SetGameMode( int a_GameMode );
+ void SetIP( std::string a_IP );
// Tries to move to a new position, with collision checks and stuff
virtual void MoveTo( const Vector3d & a_NewPos ); //tolua_export
@@ -104,6 +106,7 @@ protected: float m_LastBlockActionTime;
int m_GameMode;
+ std::string m_IP;
cClientHandle* m_ClientHandle;
}; //tolua_export
diff --git a/source/lua5.1.dll b/source/lua5.1.dll Binary files differnew file mode 100644 index 000000000..515cf8b30 --- /dev/null +++ b/source/lua5.1.dll |