Eluna fix doc style and prepare merge a PR

This commit is contained in:
Rochet2
2014-08-09 01:26:14 +03:00
parent 57153d6c47
commit 30e5c418ba
6 changed files with 158 additions and 94 deletions

View File

@@ -190,9 +190,10 @@ void Eluna::OnPacketSendAny(Player* player, WorldPacket& packet, bool& result)
{
if (lua_isnoneornil(L, i))
continue;
if (WorldPacket* data = CHECKOBJ<WorldPacket>(L, i, false))
packet = *data;
if (!CHECKVAL<bool>(L, i, true))
if (lua_isuserdata(L, i))
if (WorldPacket* data = CHECKOBJ<WorldPacket>(L, i, false))
packet = *data;
if (lua_isboolean(L, i) && !CHECKVAL<bool>(L, i, true))
{
result = false;
break;
@@ -210,9 +211,10 @@ void Eluna::OnPacketSendOne(Player* player, WorldPacket& packet, bool& result)
{
if (lua_isnoneornil(L, i))
continue;
if (WorldPacket* data = CHECKOBJ<WorldPacket>(L, i, false))
packet = *data;
if (!CHECKVAL<bool>(L, i, true))
if (lua_isuserdata(L, i))
if (WorldPacket* data = CHECKOBJ<WorldPacket>(L, i, false))
packet = *data;
if (lua_isboolean(L, i) && !CHECKVAL<bool>(L, i, true))
{
result = false;
break;
@@ -241,9 +243,10 @@ void Eluna::OnPacketReceiveAny(Player* player, WorldPacket& packet, bool& result
{
if (lua_isnoneornil(L, i))
continue;
if (WorldPacket* data = CHECKOBJ<WorldPacket>(L, i, false))
packet = *data;
if (!CHECKVAL<bool>(L, i, true))
if (lua_isuserdata(L, i))
if (WorldPacket* data = CHECKOBJ<WorldPacket>(L, i, false))
packet = *data;
if (lua_isboolean(L, i) && !CHECKVAL<bool>(L, i, true))
{
result = false;
break;
@@ -261,9 +264,10 @@ void Eluna::OnPacketReceiveOne(Player* player, WorldPacket& packet, bool& result
{
if (lua_isnoneornil(L, i))
continue;
if (WorldPacket* data = CHECKOBJ<WorldPacket>(L, i, false))
packet = *data;
if (!CHECKVAL<bool>(L, i, true))
if (lua_isuserdata(L, i))
if (WorldPacket* data = CHECKOBJ<WorldPacket>(L, i, false))
packet = *data;
if (lua_isboolean(L, i) && !CHECKVAL<bool>(L, i, true))
{
result = false;
break;
@@ -477,9 +481,8 @@ bool Eluna::OnItemUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targ
ENTRY_EXECUTE(1);
FOR_RETS(i)
{
if (lua_isnoneornil(L, i))
continue;
result = CHECKVAL<bool>(L, i, result);
if (lua_isboolean(L, i))
result = CHECKVAL<bool>(L, i, result);
}
ENDCALL();
return result;
@@ -495,9 +498,8 @@ bool Eluna::OnItemGossip(Player* pPlayer, Item* pItem, SpellCastTargets const& /
ENTRY_EXECUTE(1);
FOR_RETS(i)
{
if (lua_isnoneornil(L, i))
continue;
result = CHECKVAL<bool>(L, i, result);
if (lua_isboolean(L, i))
result = CHECKVAL<bool>(L, i, result);
}
ENDCALL();
return result;
@@ -556,9 +558,8 @@ bool Eluna::OnCommand(Player* player, const char* text)
EVENT_EXECUTE(1);
FOR_RETS(i)
{
if (lua_isnoneornil(L, i))
continue;
result = CHECKVAL<bool>(L, i, result);
if (lua_isboolean(L, i))
result = CHECKVAL<bool>(L, i, result);
}
ENDCALL();
return result;
@@ -637,7 +638,7 @@ InventoryResult Eluna::OnCanUseItem(const Player* pPlayer, uint32 itemEntry)
EVENT_EXECUTE(1);
FOR_RETS(i)
{
if (lua_isnoneornil(L, i))
if (!lua_isnumber(L, i))
continue;
uint32 res = CHECKVAL<uint32>(L, i, EQUIP_ERR_OK);
if (res != EQUIP_ERR_OK)
@@ -735,9 +736,8 @@ void Eluna::OnGiveXP(Player* pPlayer, uint32& amount, Unit* pVictim)
EVENT_EXECUTE(1);
FOR_RETS(i)
{
if (lua_isnoneornil(L, i))
continue;
amount = CHECKVAL<uint32>(L, i, amount);
if (lua_isnumber(L, i))
amount = CHECKVAL<uint32>(L, i, amount);
}
ENDCALL();
}
@@ -752,9 +752,8 @@ void Eluna::OnReputationChange(Player* pPlayer, uint32 factionID, int32& standin
EVENT_EXECUTE(1);
FOR_RETS(i)
{
if (lua_isnoneornil(L, i))
continue;
standing = CHECKVAL<uint32>(L, i, standing);
if (lua_isnumber(L, i))
standing = CHECKVAL<uint32>(L, i, standing);
}
ENDCALL();
}
@@ -901,9 +900,10 @@ bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg)
{
if (lua_isnoneornil(L, i))
continue;
if (const char* c_str = CHECKVAL<const char*>(L, i, NULL))
msg = std::string(c_str);
else if (!CHECKVAL<bool>(L, i, true))
if (lua_isstring(L, i))
if (const char* c_str = CHECKVAL<const char*>(L, i, NULL))
msg = std::string(c_str);
else if (lua_isboolean(L, i) && !CHECKVAL<bool>(L, i, true))
{
result = false;
break;
@@ -929,9 +929,10 @@ bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg,
{
if (lua_isnoneornil(L, i))
continue;
if (const char* c_str = CHECKVAL<const char*>(L, i, NULL))
msg = std::string(c_str);
else if (!CHECKVAL<bool>(L, i, true))
if (lua_isstring(L, i))
if (const char* c_str = CHECKVAL<const char*>(L, i, NULL))
msg = std::string(c_str);
else if (lua_isboolean(L, i) && !CHECKVAL<bool>(L, i, true))
{
result = false;
break;
@@ -957,9 +958,10 @@ bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg,
{
if (lua_isnoneornil(L, i))
continue;
if (const char* c_str = CHECKVAL<const char*>(L, i, NULL))
msg = std::string(c_str);
else if (!CHECKVAL<bool>(L, i, true))
if (lua_isstring(L, i))
if (const char* c_str = CHECKVAL<const char*>(L, i, NULL))
msg = std::string(c_str);
else if (lua_isboolean(L, i) && !CHECKVAL<bool>(L, i, true))
{
result = false;
break;
@@ -985,9 +987,10 @@ bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg,
{
if (lua_isnoneornil(L, i))
continue;
if (const char* c_str = CHECKVAL<const char*>(L, i, NULL))
msg = std::string(c_str);
else if (!CHECKVAL<bool>(L, i, true))
if (lua_isstring(L, i))
if (const char* c_str = CHECKVAL<const char*>(L, i, NULL))
msg = std::string(c_str);
else if (lua_isboolean(L, i) && !CHECKVAL<bool>(L, i, true))
{
result = false;
break;
@@ -1013,9 +1016,10 @@ bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg,
{
if (lua_isnoneornil(L, i))
continue;
if (const char* c_str = CHECKVAL<const char*>(L, i, NULL))
msg = std::string(c_str);
else if (!CHECKVAL<bool>(L, i, true))
if (lua_isstring(L, i))
if (const char* c_str = CHECKVAL<const char*>(L, i, NULL))
msg = std::string(c_str);
else if (lua_isboolean(L, i) && !CHECKVAL<bool>(L, i, true))
{
result = false;
break;
@@ -1479,9 +1483,8 @@ struct ElunaCreatureAI : ScriptedAI
ENTRY_EXECUTE(1);
FOR_RETS(i)
{
if (lua_isnoneornil(L, i))
continue;
damage = Eluna::CHECKVAL<uint32>(L, i, damage);
if (lua_isnumber(L, i))
damage = Eluna::CHECKVAL<uint32>(L, i, damage);
}
ENDCALL();
}
@@ -1619,9 +1622,8 @@ struct ElunaCreatureAI : ScriptedAI
ENTRY_EXECUTE(1);
FOR_RETS(i)
{
if (lua_isnoneornil(L, i))
continue;
respawnDelay = Eluna::CHECKVAL<uint32>(L, i, respawnDelay);
if (lua_isnumber(L, i))
respawnDelay = Eluna::CHECKVAL<uint32>(L, i, respawnDelay);
}
ENDCALL();
}