forked from mirror/openmw-tes3mp
Use lowerCamelCase in tes3mp server script function names, part 2
This commit is contained in:
parent
0e2b589cdb
commit
80d16fe1fd
14 changed files with 137 additions and 139 deletions
|
@ -36,12 +36,12 @@ Networking::Networking(RakNet::RakPeerInterface *peer)
|
|||
running = true;
|
||||
exitCode = 0;
|
||||
|
||||
Script::Call<Script::CallbackIdentity("OnServerInit")>();
|
||||
Script::Call<Script::CallbackIdentity("onServerInit")>();
|
||||
}
|
||||
|
||||
Networking::~Networking()
|
||||
{
|
||||
Script::Call<Script::CallbackIdentity("OnServerExit")>(false);
|
||||
Script::Call<Script::CallbackIdentity("onServerExit")>(false);
|
||||
|
||||
sThis = 0;
|
||||
delete playerController;
|
||||
|
@ -86,7 +86,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Have not completed handshake with player %d",
|
||||
player->getId());
|
||||
//KickPlayer(player->guid);
|
||||
//kickPlayer(player->guid);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
{
|
||||
player->setLoadState(Player::LOADED);
|
||||
|
||||
static constexpr unsigned int ident = Script::CallbackIdentity("OnPlayerConnect");
|
||||
static constexpr unsigned int ident = Script::CallbackIdentity("onPlayerConnect");
|
||||
Script::CallBackReturn<ident> result = true;
|
||||
Script::Call<ident>(result, Players::getPlayer(packet->guid)->getId());
|
||||
|
||||
|
@ -160,7 +160,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
player->GetCell()->getDescription().c_str());
|
||||
|
||||
myPacket->Send(player, true); //send to other clients
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerChangeCell")>(player->getId());
|
||||
Script::Call<Script::CallbackIdentity("onPlayerChangeCell")>(player->getId());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -178,7 +178,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
myPacket->Read(player);
|
||||
myPacket->Send(player, true);
|
||||
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerChangeAttributes")>(player->getId());
|
||||
Script::Call<Script::CallbackIdentity("onPlayerChangeAttributes")>(player->getId());
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -191,7 +191,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
myPacket->Read(player);
|
||||
myPacket->Send(player, true);
|
||||
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerChangeSkills")>(player->getId());
|
||||
Script::Call<Script::CallbackIdentity("onPlayerChangeSkills")>(player->getId());
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -204,7 +204,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
myPacket->Read(player);
|
||||
myPacket->Send(player, true);
|
||||
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerChangeLevel")>(player->getId());
|
||||
Script::Call<Script::CallbackIdentity("onPlayerChangeLevel")>(player->getId());
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -216,7 +216,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
myPacket->Read(player);
|
||||
myPacket->Send(player, true);
|
||||
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerChangeEquipment")>(player->getId());
|
||||
Script::Call<Script::CallbackIdentity("onPlayerChangeEquipment")>(player->getId());
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
DEBUG_PRINTF("ID_GAME_INVENTORY\n");
|
||||
myPacket->Read(player);
|
||||
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerChangeInventory")>(player->getId());
|
||||
Script::Call<Script::CallbackIdentity("onPlayerChangeInventory")>(player->getId());
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -295,7 +295,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
player->CreatureStats()->mDead = true;
|
||||
myPacket->Send(player, true);
|
||||
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerDeath")>(player->getId(), reason, killer->getId());
|
||||
Script::Call<Script::CallbackIdentity("onPlayerDeath")>(player->getId(), reason, killer->getId());
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -303,13 +303,12 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
case ID_GAME_RESURRECT:
|
||||
{
|
||||
DEBUG_PRINTF("ID_GAME_RESURRECT\n");
|
||||
//packetResurrect.Read(player);
|
||||
player->CreatureStats()->mDead = false;
|
||||
myPacket->Send(player, true);
|
||||
playerController->GetPacket(ID_GAME_POS)->RequestData(player->guid);
|
||||
playerController->GetPacket(ID_GAME_CELL)->RequestData(player->guid);
|
||||
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerResurrect")>(player->getId());
|
||||
Script::Call<Script::CallbackIdentity("onPlayerResurrect")>(player->getId());
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -326,8 +325,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
{
|
||||
DEBUG_PRINTF("ID_CHAT_MESSAGE\n");
|
||||
myPacket->Read(player);
|
||||
Script::CallBackReturn<Script::CallbackIdentity("OnPlayerSendMessage")> result = true;
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerSendMessage")>(result, player->getId(), player->ChatMessage()->c_str());
|
||||
Script::CallBackReturn<Script::CallbackIdentity("onPlayerSendMessage")> result = true;
|
||||
Script::Call<Script::CallbackIdentity("onPlayerSendMessage")>(result, player->getId(), player->ChatMessage()->c_str());
|
||||
|
||||
if (result)
|
||||
{
|
||||
|
@ -345,7 +344,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
|
||||
if (player->CharGenStage()->current == player->CharGenStage()->end && player->CharGenStage()->current != 0)
|
||||
{
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerEndCharGen")>(player->getId());
|
||||
Script::Call<Script::CallbackIdentity("onPlayerEndCharGen")>(player->getId());
|
||||
cout << "RACE: " << player->Npc()->mRace << endl;
|
||||
}
|
||||
break;
|
||||
|
@ -356,7 +355,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
DEBUG_PRINTF("ID_GUI_MESSAGEBOX\n");
|
||||
myPacket->Read(player);
|
||||
|
||||
Script::Call<Script::CallbackIdentity("OnGUIAction")>(player->getId(), (int)player->guiMessageBox.id,
|
||||
Script::Call<Script::CallbackIdentity("onGuiAction")>(player->getId(), (int)player->guiMessageBox.id,
|
||||
player->guiMessageBox.data.c_str());
|
||||
break;
|
||||
}
|
||||
|
@ -741,7 +740,7 @@ void Networking::disconnectPlayer(RakNet::RakNetGUID guid)
|
|||
Player *player = Players::getPlayer(guid);
|
||||
if (!player)
|
||||
return;
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerDisconnect")>(player->getId());
|
||||
Script::Call<Script::CallbackIdentity("onPlayerDisconnect")>(player->getId());
|
||||
playerController->GetPacket(ID_USER_DISCONNECTED)->Send(player, true);
|
||||
Players::deletePlayer(guid);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ private:
|
|||
|
||||
public:
|
||||
template<typename... Args>
|
||||
static void MakePublic(Args &&... args)
|
||||
static void makePublic(Args &&... args)
|
||||
{ new Public(std::forward<Args>(args)...); }
|
||||
|
||||
static boost::any Call(const std::string &name, const std::vector<boost::any> &args);
|
||||
|
|
|
@ -78,7 +78,7 @@ int TimerAPI::pointer = 0;
|
|||
std::unordered_map<int, Timer* > TimerAPI::timers;
|
||||
|
||||
#if defined(ENABLE_PAWN)
|
||||
int TimerAPI::CreateTimerPAWN(AMX *amx, ScriptFuncPAWN callback, long msec, const string& def, std::vector<boost::any> args)
|
||||
int TimerAPI::createTimerPAWN(AMX *amx, ScriptFuncPAWN callback, long msec, const string& def, std::vector<boost::any> args)
|
||||
{
|
||||
int id = -1;
|
||||
|
||||
|
@ -102,7 +102,7 @@ int TimerAPI::CreateTimerPAWN(AMX *amx, ScriptFuncPAWN callback, long msec, cons
|
|||
#endif
|
||||
|
||||
#if defined(ENABLE_LUA)
|
||||
int TimerAPI::CreateTimerLua(lua_State *lua, ScriptFuncLua callback, long msec, const std::string& def, std::vector<boost::any> args)
|
||||
int TimerAPI::createTimerLua(lua_State *lua, ScriptFuncLua callback, long msec, const std::string& def, std::vector<boost::any> args)
|
||||
{
|
||||
int id = -1;
|
||||
|
||||
|
@ -126,7 +126,7 @@ int TimerAPI::CreateTimerLua(lua_State *lua, ScriptFuncLua callback, long msec,
|
|||
#endif
|
||||
|
||||
|
||||
int TimerAPI::CreateTimer(ScriptFunc callback, long msec, const std::string &def, std::vector<boost::any> args)
|
||||
int TimerAPI::createTimer(ScriptFunc callback, long msec, const std::string &def, std::vector<boost::any> args)
|
||||
{
|
||||
int id = -1;
|
||||
|
||||
|
@ -148,7 +148,7 @@ int TimerAPI::CreateTimer(ScriptFunc callback, long msec, const std::string &def
|
|||
return id;
|
||||
}
|
||||
|
||||
void TimerAPI::FreeTimer(int timerid)
|
||||
void TimerAPI::freeTimer(int timerid)
|
||||
{
|
||||
|
||||
try
|
||||
|
@ -165,7 +165,7 @@ void TimerAPI::FreeTimer(int timerid)
|
|||
}
|
||||
}
|
||||
|
||||
void TimerAPI::ResetTimer(int timerid, long msec)
|
||||
void TimerAPI::resetTimer(int timerid, long msec)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -177,7 +177,7 @@ void TimerAPI::ResetTimer(int timerid, long msec)
|
|||
}
|
||||
}
|
||||
|
||||
void TimerAPI::StartTimer(int timerid)
|
||||
void TimerAPI::startTimer(int timerid)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -192,7 +192,7 @@ void TimerAPI::StartTimer(int timerid)
|
|||
}
|
||||
}
|
||||
|
||||
void TimerAPI::StopTimer(int timerid)
|
||||
void TimerAPI::stopTimer(int timerid)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -204,7 +204,7 @@ void TimerAPI::StopTimer(int timerid)
|
|||
}
|
||||
}
|
||||
|
||||
bool TimerAPI::IsEndTimer(int timerid)
|
||||
bool TimerAPI::isEndTimer(int timerid)
|
||||
{
|
||||
bool ret = false;
|
||||
try
|
||||
|
|
|
@ -46,17 +46,17 @@ namespace mwmp
|
|||
{
|
||||
public:
|
||||
#if defined(ENABLE_PAWN)
|
||||
static int CreateTimerPAWN(AMX *amx, ScriptFuncPAWN callback, long msec, const std::string& def, std::vector<boost::any> args);
|
||||
static int createTimerPAWN(AMX *amx, ScriptFuncPAWN callback, long msec, const std::string& def, std::vector<boost::any> args);
|
||||
#endif
|
||||
#if defined(ENABLE_LUA)
|
||||
static int CreateTimerLua(lua_State *lua, ScriptFuncLua callback, long msec, const std::string& def, std::vector<boost::any> args);
|
||||
static int createTimerLua(lua_State *lua, ScriptFuncLua callback, long msec, const std::string& def, std::vector<boost::any> args);
|
||||
#endif
|
||||
static int CreateTimer(ScriptFunc callback, long msec, const std::string& def, std::vector<boost::any> args);
|
||||
static void FreeTimer(int timerid);
|
||||
static void ResetTimer(int timerid, long msec);
|
||||
static void StartTimer(int timerid);
|
||||
static void StopTimer(int timerid);
|
||||
static bool IsEndTimer(int timerid);
|
||||
static int createTimer(ScriptFunc callback, long msec, const std::string& def, std::vector<boost::any> args);
|
||||
static void freeTimer(int timerid);
|
||||
static void resetTimer(int timerid, long msec);
|
||||
static void startTimer(int timerid);
|
||||
static void stopTimer(int timerid);
|
||||
static bool isEndTimer(int timerid);
|
||||
|
||||
static void Terminate();
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include <apps/openmw-mp/Networking.hpp>
|
||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||
|
||||
void ScriptFunctions::SendMessage(unsigned short pid, const char *message, bool broadcast) noexcept
|
||||
void ScriptFunctions::sendMessage(unsigned short pid, const char *message, bool broadcast) noexcept
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
|
@ -20,12 +20,12 @@ void ScriptFunctions::SendMessage(unsigned short pid, const char *message, bool
|
|||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_CHAT_MESSAGE)->Send(player, true);
|
||||
}
|
||||
|
||||
void ScriptFunctions::CleanChat(unsigned short pid)
|
||||
void ScriptFunctions::cleanChat(unsigned short pid)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ScriptFunctions::CleanChat()
|
||||
void ScriptFunctions::cleanChat()
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -11,39 +11,39 @@
|
|||
using namespace std;
|
||||
using namespace mwmp;
|
||||
|
||||
int ScriptFunctions::CreateTimer(ScriptFunc callback, int msec) noexcept
|
||||
int ScriptFunctions::createTimer(ScriptFunc callback, int msec) noexcept
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ScriptFunctions::CreateTimerEx(ScriptFunc callback, int msec, const char *types, ...) noexcept
|
||||
int ScriptFunctions::createTimerEx(ScriptFunc callback, int msec, const char *types, ...) noexcept
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
void ScriptFunctions::StartTimer(int timerId) noexcept
|
||||
void ScriptFunctions::startTimer(int timerId) noexcept
|
||||
{
|
||||
TimerAPI::StartTimer(timerId);
|
||||
TimerAPI::startTimer(timerId);
|
||||
}
|
||||
|
||||
void ScriptFunctions::StopTimer(int timerId) noexcept
|
||||
void ScriptFunctions::stopTimer(int timerId) noexcept
|
||||
{
|
||||
TimerAPI::StopTimer(timerId);
|
||||
TimerAPI::stopTimer(timerId);
|
||||
}
|
||||
|
||||
void ScriptFunctions::RestartTimer(int timerId, int msec) noexcept
|
||||
void ScriptFunctions::restartTimer(int timerId, int msec) noexcept
|
||||
{
|
||||
TimerAPI::ResetTimer(timerId, msec);
|
||||
TimerAPI::resetTimer(timerId, msec);
|
||||
}
|
||||
|
||||
void ScriptFunctions::FreeTimer(int timerId) noexcept
|
||||
void ScriptFunctions::freeTimer(int timerId) noexcept
|
||||
{
|
||||
TimerAPI::FreeTimer(timerId);
|
||||
TimerAPI::freeTimer(timerId);
|
||||
}
|
||||
|
||||
bool ScriptFunctions::IsTimerElapsed(int timerId) noexcept
|
||||
bool ScriptFunctions::isTimerElapsed(int timerId) noexcept
|
||||
{
|
||||
return TimerAPI::IsEndTimer(timerId);
|
||||
return TimerAPI::isEndTimer(timerId);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -73,10 +73,10 @@ struct F_
|
|||
};
|
||||
|
||||
|
||||
template<> struct F_<0> { static constexpr LuaFuctionData F{"CreateTimer", LangLua::CreateTimer}; };
|
||||
template<> struct F_<1> { static constexpr LuaFuctionData F{"CreateTimerEx", LangLua::CreateTimerEx}; };
|
||||
template<> struct F_<2> { static constexpr LuaFuctionData F{"MakePublic", LangLua::MakePublic}; };
|
||||
template<> struct F_<3> { static constexpr LuaFuctionData F{"CallPublic", LangLua::CallPublic}; };
|
||||
template<> struct F_<0> { static constexpr LuaFuctionData F{"createTimer", LangLua::createTimer}; };
|
||||
template<> struct F_<1> { static constexpr LuaFuctionData F{"createTimerEx", LangLua::createTimerEx}; };
|
||||
template<> struct F_<2> { static constexpr LuaFuctionData F{"makePublic", LangLua::makePublic}; };
|
||||
template<> struct F_<3> { static constexpr LuaFuctionData F{"callPublic", LangLua::callPublic}; };
|
||||
|
||||
template<size_t... Indices>
|
||||
inline LuaFuctionData *LangLua::functions(indices<Indices...>)
|
||||
|
@ -135,7 +135,7 @@ boost::any LangLua::Call(const char *name, const char *argl, int buf, ...)
|
|||
va_start(vargs, buf);
|
||||
std::vector<boost::any> args;
|
||||
|
||||
ScriptFunctions::GetArguments(args, vargs, argl);
|
||||
ScriptFunctions::getArguments(args, vargs, argl);
|
||||
|
||||
return Call(name, argl, args);
|
||||
}
|
||||
|
|
|
@ -39,11 +39,11 @@ public:
|
|||
LangLua();
|
||||
LangLua(lua_State *lua);
|
||||
~LangLua();
|
||||
static int MakePublic(lua_State *lua) noexcept;
|
||||
static int CallPublic(lua_State *lua);
|
||||
static int makePublic(lua_State *lua) noexcept;
|
||||
static int callPublic(lua_State *lua);
|
||||
|
||||
static int CreateTimer(lua_State *lua) noexcept;
|
||||
static int CreateTimerEx(lua_State *lua);
|
||||
static int createTimer(lua_State *lua) noexcept;
|
||||
static int createTimerEx(lua_State *lua);
|
||||
|
||||
virtual void LoadProgram(const char *filename) override;
|
||||
virtual int FreeProgram() override;
|
||||
|
|
|
@ -64,19 +64,19 @@ inline vector<boost::any> DefToVec(lua_State *lua, string types, int args_begin,
|
|||
return args;
|
||||
}
|
||||
|
||||
int LangLua::MakePublic(lua_State *lua) noexcept
|
||||
int LangLua::makePublic(lua_State *lua) noexcept
|
||||
{
|
||||
const char * callback = luabridge::Stack<const char*>::get(lua, 1);
|
||||
const char * name = luabridge::Stack<const char*>::get(lua, 2);
|
||||
char ret_type = luabridge::Stack<char>::get(lua, 3);
|
||||
const char * def = luabridge::Stack<const char*>::get(lua, 4);
|
||||
|
||||
Public::MakePublic(callback, lua, name, ret_type, def);
|
||||
Public::makePublic(callback, lua, name, ret_type, def);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int LangLua::CallPublic(lua_State *lua)
|
||||
int LangLua::callPublic(lua_State *lua)
|
||||
{
|
||||
const char * name = luabridge::Stack<const char*>::get(lua, 1);
|
||||
|
||||
|
@ -104,18 +104,18 @@ int LangLua::CallPublic(lua_State *lua)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int LangLua::CreateTimer(lua_State *lua) noexcept
|
||||
int LangLua::createTimer(lua_State *lua) noexcept
|
||||
{
|
||||
|
||||
const char * callback= luabridge::Stack<const char*>::get(lua, 1);
|
||||
int msec = luabridge::Stack<int>::get(lua, 2);
|
||||
|
||||
int id = mwmp::TimerAPI::CreateTimerLua(lua, callback, msec, "", vector<boost::any>());
|
||||
int id = mwmp::TimerAPI::createTimerLua(lua, callback, msec, "", vector<boost::any>());
|
||||
luabridge::push(lua, id);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int LangLua::CreateTimerEx(lua_State *lua)
|
||||
int LangLua::createTimerEx(lua_State *lua)
|
||||
{
|
||||
const char * callback = luabridge::Stack<const char*>::get(lua, 1);
|
||||
int msec = luabridge::Stack<int>::get(lua, 2);
|
||||
|
@ -176,7 +176,7 @@ int LangLua::CreateTimerEx(lua_State *lua)
|
|||
}
|
||||
|
||||
|
||||
int id = mwmp::TimerAPI::CreateTimerLua(lua, callback, msec, types, args);
|
||||
int id = mwmp::TimerAPI::createTimerLua(lua, callback, msec, types, args);
|
||||
luabridge::push(lua, id);
|
||||
return 1;
|
||||
}
|
|
@ -172,10 +172,10 @@ static typename enable_if<ScriptFunctions::functions[I].func.ret != 'v' && Scrip
|
|||
}
|
||||
|
||||
template<unsigned int I> struct F_ { static constexpr AMX_NATIVE_INFO F{ScriptFunctions::functions[I].name, wrapper<I>}; };
|
||||
template<> struct F_<0> { static constexpr AMX_NATIVE_INFO F{"CreateTimer", LangPAWN::CreateTimer}; };
|
||||
template<> struct F_<1> { static constexpr AMX_NATIVE_INFO F{"CreateTimerEx", LangPAWN::CreateTimerEx}; };
|
||||
template<> struct F_<2> { static constexpr AMX_NATIVE_INFO F{"MakePublic", LangPAWN::MakePublic}; };
|
||||
template<> struct F_<3> { static constexpr AMX_NATIVE_INFO F{"CallPublic", LangPAWN::CallPublic}; };
|
||||
template<> struct F_<0> { static constexpr AMX_NATIVE_INFO F{"createTimer", LangPAWN::createTimer}; };
|
||||
template<> struct F_<1> { static constexpr AMX_NATIVE_INFO F{"createTimerEx", LangPAWN::createTimerEx}; };
|
||||
template<> struct F_<2> { static constexpr AMX_NATIVE_INFO F{"makePublic", LangPAWN::makePublic}; };
|
||||
template<> struct F_<3> { static constexpr AMX_NATIVE_INFO F{"callPublic", LangPAWN::callPublic}; };
|
||||
|
||||
void LangPAWN::LoadProgram(const char *filename)
|
||||
{
|
||||
|
|
|
@ -30,10 +30,10 @@ public:
|
|||
LangPAWN();
|
||||
LangPAWN(AMX *amx);
|
||||
~LangPAWN();
|
||||
static cell MakePublic(AMX *amx, const cell *params) noexcept;
|
||||
static cell CallPublic(AMX *amx, const cell *params) noexcept;
|
||||
static cell CreateTimer(AMX *amx, const cell *params) noexcept;
|
||||
static cell CreateTimerEx(AMX *amx, const cell *params) noexcept;
|
||||
static cell makePublic(AMX *amx, const cell *params) noexcept;
|
||||
static cell callPublic(AMX *amx, const cell *params) noexcept;
|
||||
static cell createTimer(AMX *amx, const cell *params) noexcept;
|
||||
static cell createTimerEx(AMX *amx, const cell *params) noexcept;
|
||||
|
||||
virtual void LoadProgram(const char *filename) override;
|
||||
virtual int FreeProgram() override;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
cell LangPAWN::MakePublic(AMX *amx, const cell *params) noexcept
|
||||
cell LangPAWN::makePublic(AMX *amx, const cell *params) noexcept
|
||||
{
|
||||
int len;
|
||||
cell* source;
|
||||
|
@ -39,12 +39,12 @@ cell LangPAWN::MakePublic(AMX *amx, const cell *params) noexcept
|
|||
|
||||
|
||||
|
||||
Public::MakePublic(&real[0], amx, &name[0], ret_type, &def[0]);
|
||||
Public::makePublic(&real[0], amx, &name[0], ret_type, &def[0]);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
cell LangPAWN::CallPublic(AMX *amx, const cell *params) noexcept
|
||||
cell LangPAWN::callPublic(AMX *amx, const cell *params) noexcept
|
||||
{
|
||||
int len;
|
||||
cell* source;
|
||||
|
@ -143,12 +143,12 @@ cell LangPAWN::CallPublic(AMX *amx, const cell *params) noexcept
|
|||
return ret;
|
||||
}
|
||||
|
||||
cell LangPAWN::CreateTimer(AMX *amx, const cell *params) noexcept
|
||||
cell LangPAWN::createTimer(AMX *amx, const cell *params) noexcept
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
cell LangPAWN::CreateTimerEx(AMX *amx, const cell *params) noexcept
|
||||
cell LangPAWN::createTimerEx(AMX *amx, const cell *params) noexcept
|
||||
{
|
||||
|
||||
}
|
|
@ -18,7 +18,7 @@ constexpr ScriptCallbackData ScriptFunctions::callbacks[];
|
|||
|
||||
using namespace std;
|
||||
|
||||
void ScriptFunctions::GetArguments(std::vector<boost::any> ¶ms, va_list args, const std::string &def)
|
||||
void ScriptFunctions::getArguments(std::vector<boost::any> ¶ms, va_list args, const std::string &def)
|
||||
{
|
||||
params.reserve(def.length());
|
||||
|
||||
|
@ -84,12 +84,12 @@ void ScriptFunctions::GetArguments(std::vector<boost::any> ¶ms, va_list args
|
|||
va_end(args);
|
||||
}
|
||||
|
||||
void ScriptFunctions::MakePublic(ScriptFunc _public, const char *name, char ret_type, const char *def) noexcept
|
||||
void ScriptFunctions::makePublic(ScriptFunc _public, const char *name, char ret_type, const char *def) noexcept
|
||||
{
|
||||
Public::MakePublic(_public, name, ret_type, def);
|
||||
Public::makePublic(_public, name, ret_type, def);
|
||||
}
|
||||
|
||||
boost::any ScriptFunctions::CallPublic(const char *name, ...) noexcept
|
||||
boost::any ScriptFunctions::callPublic(const char *name, ...) noexcept
|
||||
{
|
||||
vector<boost::any> params;
|
||||
|
||||
|
@ -99,7 +99,7 @@ boost::any ScriptFunctions::CallPublic(const char *name, ...) noexcept
|
|||
|
||||
va_list args;
|
||||
va_start(args, name);
|
||||
GetArguments(params, args, def);
|
||||
getArguments(params, args, def);
|
||||
va_end(args);
|
||||
|
||||
return Public::Call(name, params);
|
||||
|
@ -109,30 +109,30 @@ boost::any ScriptFunctions::CallPublic(const char *name, ...) noexcept
|
|||
return 0;
|
||||
}
|
||||
|
||||
void ScriptFunctions::StopServer(int code) noexcept
|
||||
void ScriptFunctions::stopServer(int code) noexcept
|
||||
{
|
||||
mwmp::Networking::getPtr()->stopServer(code);
|
||||
}
|
||||
|
||||
void ScriptFunctions::Kick(unsigned short pid) noexcept
|
||||
void ScriptFunctions::kick(unsigned short pid) noexcept
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
mwmp::Networking::getPtr()->kickPlayer(player->guid);
|
||||
}
|
||||
|
||||
const char *ScriptFunctions::GetServerVersion() noexcept
|
||||
const char *ScriptFunctions::getServerVersion() noexcept
|
||||
{
|
||||
return TES3MP_VERSION;
|
||||
}
|
||||
|
||||
const char *ScriptFunctions::GetProtocolVersion() noexcept
|
||||
const char *ScriptFunctions::getProtocolVersion() noexcept
|
||||
{
|
||||
static string version = to_string(TES3MP_PROTO_VERSION);
|
||||
return version.c_str();
|
||||
}
|
||||
|
||||
int ScriptFunctions::GetAvgPing(unsigned short pid) noexcept
|
||||
int ScriptFunctions::getAvgPing(unsigned short pid) noexcept
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player,-1);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
pl = Players::getPlayer(pid); \
|
||||
if (player == 0) {\
|
||||
fprintf(stderr, "%s: Player with pid \'%d\' not found\n", __PRETTY_FUNCTION__, pid);\
|
||||
/*ScriptFunctions::StopServer(1);*/ \
|
||||
/*ScriptFunctions::stopServer(1);*/ \
|
||||
return retvalue;\
|
||||
}
|
||||
|
||||
|
@ -31,16 +31,16 @@ class ScriptFunctions
|
|||
{
|
||||
public:
|
||||
|
||||
static void GetArguments(std::vector<boost::any> ¶ms, va_list args, const std::string &def);
|
||||
static void getArguments(std::vector<boost::any> ¶ms, va_list args, const std::string &def);
|
||||
|
||||
static void StopServer(int code) noexcept;
|
||||
static void stopServer(int code) noexcept;
|
||||
|
||||
static void MakePublic(ScriptFunc _public, const char *name, char ret_type, const char *def) noexcept;
|
||||
static boost::any CallPublic(const char *name, ...) noexcept;
|
||||
static void makePublic(ScriptFunc _public, const char *name, char ret_type, const char *def) noexcept;
|
||||
static boost::any callPublic(const char *name, ...) noexcept;
|
||||
|
||||
static void SendMessage(unsigned short pid, const char *message, bool broadcast) noexcept;
|
||||
static void CleanChat(unsigned short pid);
|
||||
static void CleanChat();
|
||||
static void sendMessage(unsigned short pid, const char *message, bool broadcast) noexcept;
|
||||
static void cleanChat(unsigned short pid);
|
||||
static void cleanChat();
|
||||
|
||||
/**
|
||||
* \brief Create timer
|
||||
|
@ -48,41 +48,40 @@ public:
|
|||
* \param msec
|
||||
* \return return timer id
|
||||
*/
|
||||
static int CreateTimer(ScriptFunc callback, int msec) noexcept;
|
||||
static int CreateTimerEx(ScriptFunc callback, int msec, const char *types, ...) noexcept;
|
||||
static int createTimer(ScriptFunc callback, int msec) noexcept;
|
||||
static int createTimerEx(ScriptFunc callback, int msec, const char *types, ...) noexcept;
|
||||
|
||||
static void StartTimer(int timerId) noexcept;
|
||||
static void StopTimer(int timerId) noexcept;
|
||||
static void RestartTimer(int timerId, int msec) noexcept;
|
||||
static void FreeTimer(int timerId) noexcept;
|
||||
static bool IsTimerElapsed(int timerId) noexcept;
|
||||
static void startTimer(int timerId) noexcept;
|
||||
static void stopTimer(int timerId) noexcept;
|
||||
static void restartTimer(int timerId, int msec) noexcept;
|
||||
static void freeTimer(int timerId) noexcept;
|
||||
static bool isTimerElapsed(int timerId) noexcept;
|
||||
|
||||
static void Kick(unsigned short pid) noexcept;
|
||||
static const char *GetServerVersion() noexcept;
|
||||
static const char *GetProtocolVersion() noexcept;
|
||||
static int GetAvgPing(unsigned short pid) noexcept;
|
||||
static void kick(unsigned short pid) noexcept;
|
||||
static const char *getServerVersion() noexcept;
|
||||
static const char *getProtocolVersion() noexcept;
|
||||
static int getAvgPing(unsigned short pid) noexcept;
|
||||
|
||||
static constexpr ScriptFunctionData functions[]{
|
||||
{"CreateTimer", ScriptFunctions::CreateTimer},
|
||||
{"CreateTimerEx", reinterpret_cast<Function<void>>(ScriptFunctions::CreateTimerEx)},
|
||||
{"MakePublic", ScriptFunctions::MakePublic},
|
||||
{"CallPublic", reinterpret_cast<Function<void>>(ScriptFunctions::CallPublic)},
|
||||
{"createTimer", ScriptFunctions::createTimer},
|
||||
{"createTimerEx", reinterpret_cast<Function<void>>(ScriptFunctions::createTimerEx)},
|
||||
{"makePublic", ScriptFunctions::makePublic},
|
||||
{"callPublic", reinterpret_cast<Function<void>>(ScriptFunctions::callPublic)},
|
||||
|
||||
|
||||
{"StartTimer", ScriptFunctions::StartTimer},
|
||||
{"StopTimer", ScriptFunctions::StopTimer},
|
||||
{"RestartTimer", ScriptFunctions::RestartTimer},
|
||||
{"FreeTimer", ScriptFunctions::FreeTimer},
|
||||
{"IsTimerElapsed", ScriptFunctions::IsTimerElapsed},
|
||||
{"startTimer", ScriptFunctions::startTimer},
|
||||
{"stopTimer", ScriptFunctions::stopTimer},
|
||||
{"restartTimer", ScriptFunctions::restartTimer},
|
||||
{"freeTimer", ScriptFunctions::freeTimer},
|
||||
{"isTimerElapsed", ScriptFunctions::isTimerElapsed},
|
||||
|
||||
{"StopServer", ScriptFunctions::StopServer},
|
||||
{"stopServer", ScriptFunctions::stopServer},
|
||||
|
||||
// {"Cast", ScriptFunctions::Cast},
|
||||
{"SendMessage", ScriptFunctions::SendMessage},
|
||||
{"Kick", ScriptFunctions::Kick},
|
||||
{"GetServerVersion", ScriptFunctions::GetServerVersion},
|
||||
{"GetProtocolVersion", ScriptFunctions::GetProtocolVersion},
|
||||
{"GetAvgPing", ScriptFunctions::GetAvgPing},
|
||||
{"sendMessage", ScriptFunctions::sendMessage},
|
||||
{"kick", ScriptFunctions::kick},
|
||||
{"getServerVersion", ScriptFunctions::getServerVersion},
|
||||
{"getProtocolVersion", ScriptFunctions::getProtocolVersion},
|
||||
{"getAvgPing", ScriptFunctions::getAvgPing},
|
||||
|
||||
TRANSLOCATIONFUNCTIONS,
|
||||
STATSFUNCTIONS,
|
||||
|
@ -96,21 +95,21 @@ public:
|
|||
|
||||
static constexpr ScriptCallbackData callbacks[]{
|
||||
{"Main", Function<int, int, int>()},
|
||||
{"OnServerInit", Function<void>()},
|
||||
{"OnServerExit", Function<void, bool>()},
|
||||
{"OnPlayerConnect", Function<bool, unsigned short>()},
|
||||
{"OnPlayerDisconnect", Function<void, unsigned short>()},
|
||||
{"OnPlayerDeath", Function<void, unsigned short, short, unsigned short>()},
|
||||
{"OnPlayerResurrect", Function<void, unsigned short>()},
|
||||
{"OnPlayerChangeCell", Function<void, unsigned short>()},
|
||||
{"OnPlayerChangeAttributes", Function<void, unsigned short>()},
|
||||
{"OnPlayerChangeSkills", Function<void, unsigned short>()},
|
||||
{"OnPlayerChangeLevel", Function<void, unsigned short>()},
|
||||
{"OnPlayerChangeEquipment", Function<void, unsigned short>()},
|
||||
{"OnPlayerChangeInventory", Function<void, unsigned short>()},
|
||||
{"OnPlayerSendMessage", Function<bool, unsigned short, const char*>()},
|
||||
{"OnPlayerEndCharGen", Function<void, unsigned short>()},
|
||||
{"OnGUIAction", Function<void, unsigned short, int, const char*>()}
|
||||
{"onServerInit", Function<void>()},
|
||||
{"onServerExit", Function<void, bool>()},
|
||||
{"onPlayerConnect", Function<bool, unsigned short>()},
|
||||
{"onPlayerDisconnect", Function<void, unsigned short>()},
|
||||
{"onPlayerDeath", Function<void, unsigned short, short, unsigned short>()},
|
||||
{"onPlayerResurrect", Function<void, unsigned short>()},
|
||||
{"onPlayerChangeCell", Function<void, unsigned short>()},
|
||||
{"onPlayerChangeAttributes", Function<void, unsigned short>()},
|
||||
{"onPlayerChangeSkills", Function<void, unsigned short>()},
|
||||
{"onPlayerChangeLevel", Function<void, unsigned short>()},
|
||||
{"onPlayerChangeEquipment", Function<void, unsigned short>()},
|
||||
{"onPlayerChangeInventory", Function<void, unsigned short>()},
|
||||
{"onPlayerSendMessage", Function<bool, unsigned short, const char*>()},
|
||||
{"onPlayerEndCharGen", Function<void, unsigned short>()},
|
||||
{"onGuiAction", Function<void, unsigned short, int, const char*>()}
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue