add lua flexibility for protocol

* use shared_ptr for InputMessage and OutputMessage and bind them
* allow sending network messages from lua
* implement extended opcode
* use own OS type  for otclient to allow server side detection
* fixes in input event bot protection
* move RSA to input/output network messages
* allow to capture opcodes before GameProtocol parsing with the event GameProtocol.onOpcode
* fixes in lua std::string pop/push to allow byte buffering
This commit is contained in:
Eduardo Bart
2012-05-14 18:36:54 -03:00
parent e7030a4995
commit 2478809945
26 changed files with 969 additions and 938 deletions

View File

@@ -610,7 +610,7 @@ void LuaInterface::createLuaState()
// load lua standard libraries
luaL_openlibs(L);
// load bit32 lib for bitwise operations
luaopen_bit32(L);
@@ -998,6 +998,11 @@ void LuaInterface::pushCString(const char* v)
lua_pushstring(L, v);
}
void LuaInterface::pushString(const std::string& v)
{
lua_pushlstring(L, v.c_str(), v.length());
}
void LuaInterface::pushLightUserdata(void* p)
{
lua_pushlightuserdata(L, p);
@@ -1121,9 +1126,10 @@ std::string LuaInterface::toString(int index)
{
assert(hasIndex(index));
std::string str;
const char *c_str = lua_tostring(L, index);
if(c_str)
str = c_str;
size_t len;
const char *c_str = lua_tolstring(L, index, &len);
if(c_str && len > 0)
str.assign(c_str, len);
return str;
}

View File

@@ -269,7 +269,7 @@ public:
void pushNumber(double v);
void pushBoolean(bool v);
void pushCString(const char* v);
void pushString(const std::string& v) { pushCString(v.c_str()); }
void pushString(const std::string& v);
void pushLightUserdata(void* p);
void pushThread();
void pushValue(int index = -1);