mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
Eluna: Correct whitespace
This commit is contained in:
@@ -694,37 +694,37 @@ namespace LuaCreature
|
||||
|
||||
switch (targetType)
|
||||
{
|
||||
case SELECT_TARGET_NEAREST:
|
||||
case SELECT_TARGET_TOPAGGRO:
|
||||
{
|
||||
std::list<Unit*>::const_iterator itr = targetList.begin();
|
||||
if (position)
|
||||
std::advance(itr, position);
|
||||
Eluna::Push(L, *itr);
|
||||
}
|
||||
break;
|
||||
case SELECT_TARGET_FARTHEST:
|
||||
case SELECT_TARGET_BOTTOMAGGRO:
|
||||
{
|
||||
std::list<Unit*>::reverse_iterator ritr = targetList.rbegin();
|
||||
if (position)
|
||||
std::advance(ritr, position);
|
||||
Eluna::Push(L, *ritr);
|
||||
}
|
||||
break;
|
||||
case SELECT_TARGET_RANDOM:
|
||||
{
|
||||
std::list<Unit*>::const_iterator itr = targetList.begin();
|
||||
if (position)
|
||||
std::advance(itr, urand(0, position));
|
||||
else
|
||||
std::advance(itr, urand(0, targetList.size()-1));
|
||||
Eluna::Push(L, *itr);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
luaL_argerror(L, 2, "SelectAggroTarget expected");
|
||||
break;
|
||||
case SELECT_TARGET_NEAREST:
|
||||
case SELECT_TARGET_TOPAGGRO:
|
||||
{
|
||||
std::list<Unit*>::const_iterator itr = targetList.begin();
|
||||
if (position)
|
||||
std::advance(itr, position);
|
||||
Eluna::Push(L, *itr);
|
||||
}
|
||||
break;
|
||||
case SELECT_TARGET_FARTHEST:
|
||||
case SELECT_TARGET_BOTTOMAGGRO:
|
||||
{
|
||||
std::list<Unit*>::reverse_iterator ritr = targetList.rbegin();
|
||||
if (position)
|
||||
std::advance(ritr, position);
|
||||
Eluna::Push(L, *ritr);
|
||||
}
|
||||
break;
|
||||
case SELECT_TARGET_RANDOM:
|
||||
{
|
||||
std::list<Unit*>::const_iterator itr = targetList.begin();
|
||||
if (position)
|
||||
std::advance(itr, urand(0, position));
|
||||
else
|
||||
std::advance(itr, urand(0, targetList.size() - 1));
|
||||
Eluna::Push(L, *itr);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
luaL_argerror(L, 2, "SelectAggroTarget expected");
|
||||
break;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
Eluna& E;
|
||||
const char* groupName;
|
||||
|
||||
ElunaBind(const char* bindGroupName, Eluna& _E): E(_E), groupName(bindGroupName)
|
||||
ElunaBind(const char* bindGroupName, Eluna& _E) : E(_E), groupName(bindGroupName)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
}
|
||||
|
||||
// unregisters all registered functions and clears all registered events from the bindings
|
||||
virtual void Clear() {};
|
||||
virtual void Clear() { };
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
typedef std::vector<int> ElunaBindingMap;
|
||||
typedef std::map<int, ElunaBindingMap> ElunaEntryMap;
|
||||
|
||||
EventBind(const char* bindGroupName, Eluna& _E): ElunaBind(bindGroupName, _E)
|
||||
EventBind(const char* bindGroupName, Eluna& _E) : ElunaBind(bindGroupName, _E)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ public:
|
||||
typedef std::map<int, int> ElunaBindingMap;
|
||||
typedef UNORDERED_MAP<uint32, ElunaBindingMap> ElunaEntryMap;
|
||||
|
||||
EntryBind(const char* bindGroupName, Eluna& _E): ElunaBind(bindGroupName, _E)
|
||||
EntryBind(const char* bindGroupName, Eluna& _E) : ElunaBind(bindGroupName, _E)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ uint32 ElunaUtil::GetTimeDiff(uint32 oldMSTime)
|
||||
#endif
|
||||
}
|
||||
|
||||
ElunaUtil::ObjectGUIDCheck::ObjectGUIDCheck(ObjectGuid guid): _guid(guid)
|
||||
ElunaUtil::ObjectGUIDCheck::ObjectGUIDCheck(ObjectGuid guid) : _guid(guid)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ bool ElunaUtil::ObjectGUIDCheck::operator()(WorldObject* object)
|
||||
return object->GET_GUID() == _guid;
|
||||
}
|
||||
|
||||
ElunaUtil::ObjectDistanceOrderPred::ObjectDistanceOrderPred(WorldObject const* pRefObj, bool ascending): m_refObj(pRefObj), m_ascending(ascending)
|
||||
ElunaUtil::ObjectDistanceOrderPred::ObjectDistanceOrderPred(WorldObject const* pRefObj, bool ascending) : m_refObj(pRefObj), m_ascending(ascending)
|
||||
{
|
||||
}
|
||||
bool ElunaUtil::ObjectDistanceOrderPred::operator()(WorldObject const* pLeft, WorldObject const* pRight) const
|
||||
@@ -45,7 +45,7 @@ bool ElunaUtil::ObjectDistanceOrderPred::operator()(WorldObject const* pLeft, Wo
|
||||
}
|
||||
|
||||
ElunaUtil::WorldObjectInRangeCheck::WorldObjectInRangeCheck(bool nearest, WorldObject const* obj, float range,
|
||||
uint16 typeMask, uint32 entry, uint32 hostile): i_nearest(nearest),
|
||||
uint16 typeMask, uint32 entry, uint32 hostile) : i_nearest(nearest),
|
||||
i_obj(obj), i_range(range), i_typeMask(typeMask), i_entry(entry), i_hostile(hostile)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1008,19 +1008,19 @@ namespace LuaGlobalFunctions
|
||||
const char* query = Eluna::CHECKVAL<const char*>(L, 1);
|
||||
|
||||
#ifdef TRINITY
|
||||
ElunaQuery result = WorldDatabase.Query(query);
|
||||
if (result)
|
||||
Eluna::Push(L, new ElunaQuery(result));
|
||||
else
|
||||
Eluna::Push(L);
|
||||
ElunaQuery result = WorldDatabase.Query(query);
|
||||
if (result)
|
||||
Eluna::Push(L, new ElunaQuery(result));
|
||||
else
|
||||
Eluna::Push(L);
|
||||
#else
|
||||
ElunaQuery* result = WorldDatabase.QueryNamed(query);
|
||||
if (result)
|
||||
Eluna::Push(L, result);
|
||||
else
|
||||
Eluna::Push(L);
|
||||
ElunaQuery* result = WorldDatabase.QueryNamed(query);
|
||||
if (result)
|
||||
Eluna::Push(L, result);
|
||||
else
|
||||
Eluna::Push(L);
|
||||
#endif
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1046,19 +1046,19 @@ namespace LuaGlobalFunctions
|
||||
const char* query = Eluna::CHECKVAL<const char*>(L, 1);
|
||||
|
||||
#ifdef TRINITY
|
||||
QueryResult result = CharacterDatabase.Query(query);
|
||||
if (result)
|
||||
Eluna::Push(L, new QueryResult(result));
|
||||
else
|
||||
Eluna::Push(L);
|
||||
QueryResult result = CharacterDatabase.Query(query);
|
||||
if (result)
|
||||
Eluna::Push(L, new QueryResult(result));
|
||||
else
|
||||
Eluna::Push(L);
|
||||
#else
|
||||
QueryNamedResult* result = CharacterDatabase.QueryNamed(query);
|
||||
if (result)
|
||||
Eluna::Push(L, result);
|
||||
else
|
||||
Eluna::Push(L);
|
||||
QueryNamedResult* result = CharacterDatabase.QueryNamed(query);
|
||||
if (result)
|
||||
Eluna::Push(L, result);
|
||||
else
|
||||
Eluna::Push(L);
|
||||
#endif
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1081,20 +1081,20 @@ namespace LuaGlobalFunctions
|
||||
*/
|
||||
int AuthDBQuery(lua_State* L)
|
||||
{
|
||||
const char* query = Eluna::CHECKVAL<const char*>(L, 1);
|
||||
const char* query = Eluna::CHECKVAL<const char*>(L, 1);
|
||||
|
||||
#ifdef TRINITY
|
||||
QueryResult result = LoginDatabase.Query(query);
|
||||
if (result)
|
||||
Eluna::Push(L, new QueryResult(result));
|
||||
else
|
||||
Eluna::Push(L);
|
||||
QueryResult result = LoginDatabase.Query(query);
|
||||
if (result)
|
||||
Eluna::Push(L, new QueryResult(result));
|
||||
else
|
||||
Eluna::Push(L);
|
||||
#else
|
||||
QueryNamedResult* result = LoginDatabase.QueryNamed(query);
|
||||
if (result)
|
||||
Eluna::Push(L, result);
|
||||
else
|
||||
Eluna::Push(L);
|
||||
QueryNamedResult* result = LoginDatabase.QueryNamed(query);
|
||||
if (result)
|
||||
Eluna::Push(L, result);
|
||||
else
|
||||
Eluna::Push(L);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
30
HookMgr.cpp
30
HookMgr.cpp
@@ -28,19 +28,19 @@ struct ScriptedAI;
|
||||
using namespace HookMgr;
|
||||
|
||||
/*
|
||||
Call model for EventBind:
|
||||
|
||||
// Begin the call if should
|
||||
EVENT_BEGIN(bindmap, eventid, return returnvalue);
|
||||
// push arguments
|
||||
Push(L, pPlayer);
|
||||
EVENT_EXECUTE(returnedargs);
|
||||
FOR_RET(iter)
|
||||
{
|
||||
// process returned arguments
|
||||
}
|
||||
ENDCALL();
|
||||
*/
|
||||
* Call model for EventBind:
|
||||
*
|
||||
* // Begin the call if should
|
||||
* EVENT_BEGIN(bindmap, eventid, return returnvalue);
|
||||
* // push arguments
|
||||
* Push(L, pPlayer);
|
||||
* EVENT_EXECUTE(returnedargs);
|
||||
* FOR_RET(iter)
|
||||
* {
|
||||
* // process returned arguments
|
||||
* }
|
||||
* ENDCALL();
|
||||
*/
|
||||
|
||||
// RET is a return statement
|
||||
#define EVENT_BEGIN(BINDMAP, EVENT, RET) \
|
||||
@@ -1456,11 +1456,11 @@ struct ElunaCreatureAI : ScriptedAI
|
||||
#define me m_creature
|
||||
#endif
|
||||
|
||||
ElunaCreatureAI(Creature* creature): ScriptedAI(creature)
|
||||
ElunaCreatureAI(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
JustRespawned();
|
||||
}
|
||||
~ElunaCreatureAI() {}
|
||||
~ElunaCreatureAI() { }
|
||||
|
||||
//Called at World update tick
|
||||
#ifndef TRINITY
|
||||
|
||||
@@ -137,12 +137,12 @@ namespace LuaItem
|
||||
}
|
||||
|
||||
/*
|
||||
int IsRefundExpired(lua_State* L, Item* item)// TODO: Implement core support
|
||||
{
|
||||
Eluna::Push(L, item->IsRefundExpired());
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
* int IsRefundExpired(lua_State* L, Item* item)// TODO: Implement core support
|
||||
* {
|
||||
* Eluna::Push(L, item->IsRefundExpired());
|
||||
* return 1;
|
||||
* }
|
||||
*/
|
||||
|
||||
/* GETTERS */
|
||||
int GetItemLink(lua_State* L, Item* item)
|
||||
|
||||
351
LuaEngine.cpp
351
LuaEngine.cpp
@@ -87,7 +87,7 @@ void Eluna::ReloadEluna()
|
||||
reload = false;
|
||||
}
|
||||
|
||||
Eluna::Eluna():
|
||||
Eluna::Eluna() :
|
||||
L(luaL_newstate()),
|
||||
|
||||
eventMgr(NULL),
|
||||
@@ -406,14 +406,14 @@ void Eluna::Push(lua_State* L, Unit const* unit)
|
||||
}
|
||||
switch (unit->GetTypeId())
|
||||
{
|
||||
case TYPEID_UNIT:
|
||||
Push(L, unit->ToCreature());
|
||||
break;
|
||||
case TYPEID_PLAYER:
|
||||
Push(L, unit->ToPlayer());
|
||||
break;
|
||||
default:
|
||||
ElunaTemplate<Unit>::push(L, unit);
|
||||
case TYPEID_UNIT:
|
||||
Push(L, unit->ToCreature());
|
||||
break;
|
||||
case TYPEID_PLAYER:
|
||||
Push(L, unit->ToPlayer());
|
||||
break;
|
||||
default:
|
||||
ElunaTemplate<Unit>::push(L, unit);
|
||||
}
|
||||
}
|
||||
void Eluna::Push(lua_State* L, WorldObject const* obj)
|
||||
@@ -425,20 +425,20 @@ void Eluna::Push(lua_State* L, WorldObject const* obj)
|
||||
}
|
||||
switch (obj->GetTypeId())
|
||||
{
|
||||
case TYPEID_UNIT:
|
||||
Push(L, obj->ToCreature());
|
||||
break;
|
||||
case TYPEID_PLAYER:
|
||||
Push(L, obj->ToPlayer());
|
||||
break;
|
||||
case TYPEID_GAMEOBJECT:
|
||||
Push(L, obj->ToGameObject());
|
||||
break;
|
||||
case TYPEID_CORPSE:
|
||||
Push(L, obj->ToCorpse());
|
||||
break;
|
||||
default:
|
||||
ElunaTemplate<WorldObject>::push(L, obj);
|
||||
case TYPEID_UNIT:
|
||||
Push(L, obj->ToCreature());
|
||||
break;
|
||||
case TYPEID_PLAYER:
|
||||
Push(L, obj->ToPlayer());
|
||||
break;
|
||||
case TYPEID_GAMEOBJECT:
|
||||
Push(L, obj->ToGameObject());
|
||||
break;
|
||||
case TYPEID_CORPSE:
|
||||
Push(L, obj->ToCorpse());
|
||||
break;
|
||||
default:
|
||||
ElunaTemplate<WorldObject>::push(L, obj);
|
||||
}
|
||||
}
|
||||
void Eluna::Push(lua_State* L, Object const* obj)
|
||||
@@ -450,20 +450,20 @@ void Eluna::Push(lua_State* L, Object const* obj)
|
||||
}
|
||||
switch (obj->GetTypeId())
|
||||
{
|
||||
case TYPEID_UNIT:
|
||||
Push(L, obj->ToCreature());
|
||||
break;
|
||||
case TYPEID_PLAYER:
|
||||
Push(L, obj->ToPlayer());
|
||||
break;
|
||||
case TYPEID_GAMEOBJECT:
|
||||
Push(L, obj->ToGameObject());
|
||||
break;
|
||||
case TYPEID_CORPSE:
|
||||
Push(L, obj->ToCorpse());
|
||||
break;
|
||||
default:
|
||||
ElunaTemplate<Object>::push(L, obj);
|
||||
case TYPEID_UNIT:
|
||||
Push(L, obj->ToCreature());
|
||||
break;
|
||||
case TYPEID_PLAYER:
|
||||
Push(L, obj->ToPlayer());
|
||||
break;
|
||||
case TYPEID_GAMEOBJECT:
|
||||
Push(L, obj->ToGameObject());
|
||||
break;
|
||||
case TYPEID_CORPSE:
|
||||
Push(L, obj->ToCorpse());
|
||||
break;
|
||||
default:
|
||||
ElunaTemplate<Object>::push(L, obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -579,16 +579,17 @@ template<> uint64 Eluna::CHECKVAL<uint64>(lua_State* L, int narg)
|
||||
{\
|
||||
if (!O || !O->F())\
|
||||
{\
|
||||
if (E)\
|
||||
{\
|
||||
std::string errmsg(ElunaTemplate<T>::tname);\
|
||||
errmsg += " expected";\
|
||||
luaL_argerror(L, narg, errmsg.c_str());\
|
||||
}\
|
||||
return NULL;\
|
||||
if (E)\
|
||||
{\
|
||||
std::string errmsg(ElunaTemplate<T>::tname);\
|
||||
errmsg += " expected";\
|
||||
luaL_argerror(L, narg, errmsg.c_str());\
|
||||
}\
|
||||
return NULL;\
|
||||
}\
|
||||
return O->F();\
|
||||
}
|
||||
|
||||
template<> Unit* Eluna::CHECKOBJ<Unit>(lua_State* L, int narg, bool error)
|
||||
{
|
||||
WorldObject* obj = CHECKOBJ<WorldObject>(L, narg, false);
|
||||
@@ -621,166 +622,166 @@ void Eluna::Register(uint8 regtype, uint32 id, uint32 evt, int functionRef)
|
||||
{
|
||||
switch (regtype)
|
||||
{
|
||||
case HookMgr::REGTYPE_SERVER:
|
||||
if (evt < HookMgr::SERVER_EVENT_COUNT)
|
||||
{
|
||||
ServerEventBindings->Insert(evt, functionRef);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case HookMgr::REGTYPE_PLAYER:
|
||||
if (evt < HookMgr::PLAYER_EVENT_COUNT)
|
||||
{
|
||||
PlayerEventBindings->Insert(evt, functionRef);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case HookMgr::REGTYPE_GUILD:
|
||||
if (evt < HookMgr::GUILD_EVENT_COUNT)
|
||||
{
|
||||
GuildEventBindings->Insert(evt, functionRef);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case HookMgr::REGTYPE_GROUP:
|
||||
if (evt < HookMgr::GROUP_EVENT_COUNT)
|
||||
{
|
||||
GroupEventBindings->Insert(evt, functionRef);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case HookMgr::REGTYPE_VEHICLE:
|
||||
if (evt < HookMgr::VEHICLE_EVENT_COUNT)
|
||||
{
|
||||
VehicleEventBindings->Insert(evt, functionRef);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case HookMgr::REGTYPE_BG:
|
||||
if (evt < HookMgr::BG_EVENT_COUNT)
|
||||
{
|
||||
BGEventBindings->Insert(evt, functionRef);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case HookMgr::REGTYPE_PACKET:
|
||||
if (evt < HookMgr::PACKET_EVENT_COUNT)
|
||||
{
|
||||
if (id >= NUM_MSG_TYPES)
|
||||
case HookMgr::REGTYPE_SERVER:
|
||||
if (evt < HookMgr::SERVER_EVENT_COUNT)
|
||||
{
|
||||
luaL_unref(L, LUA_REGISTRYINDEX, functionRef);
|
||||
luaL_error(L, "Couldn't find a creature with (ID: %d)!", id);
|
||||
ServerEventBindings->Insert(evt, functionRef);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
PacketEventBindings->Insert(id, evt, functionRef);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case HookMgr::REGTYPE_CREATURE:
|
||||
if (evt < HookMgr::CREATURE_EVENT_COUNT)
|
||||
{
|
||||
if (!eObjectMgr->GetCreatureTemplate(id))
|
||||
case HookMgr::REGTYPE_PLAYER:
|
||||
if (evt < HookMgr::PLAYER_EVENT_COUNT)
|
||||
{
|
||||
luaL_unref(L, LUA_REGISTRYINDEX, functionRef);
|
||||
luaL_error(L, "Couldn't find a creature with (ID: %d)!", id);
|
||||
PlayerEventBindings->Insert(evt, functionRef);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
CreatureEventBindings->Insert(id, evt, functionRef);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case HookMgr::REGTYPE_CREATURE_GOSSIP:
|
||||
if (evt < HookMgr::GOSSIP_EVENT_COUNT)
|
||||
{
|
||||
if (!eObjectMgr->GetCreatureTemplate(id))
|
||||
case HookMgr::REGTYPE_GUILD:
|
||||
if (evt < HookMgr::GUILD_EVENT_COUNT)
|
||||
{
|
||||
luaL_unref(L, LUA_REGISTRYINDEX, functionRef);
|
||||
luaL_error(L, "Couldn't find a creature with (ID: %d)!", id);
|
||||
GuildEventBindings->Insert(evt, functionRef);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
CreatureGossipBindings->Insert(id, evt, functionRef);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case HookMgr::REGTYPE_GAMEOBJECT:
|
||||
if (evt < HookMgr::GAMEOBJECT_EVENT_COUNT)
|
||||
{
|
||||
if (!eObjectMgr->GetGameObjectTemplate(id))
|
||||
case HookMgr::REGTYPE_GROUP:
|
||||
if (evt < HookMgr::GROUP_EVENT_COUNT)
|
||||
{
|
||||
luaL_unref(L, LUA_REGISTRYINDEX, functionRef);
|
||||
luaL_error(L, "Couldn't find a gameobject with (ID: %d)!", id);
|
||||
GroupEventBindings->Insert(evt, functionRef);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
GameObjectEventBindings->Insert(id, evt, functionRef);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case HookMgr::REGTYPE_GAMEOBJECT_GOSSIP:
|
||||
if (evt < HookMgr::GOSSIP_EVENT_COUNT)
|
||||
{
|
||||
if (!eObjectMgr->GetGameObjectTemplate(id))
|
||||
case HookMgr::REGTYPE_VEHICLE:
|
||||
if (evt < HookMgr::VEHICLE_EVENT_COUNT)
|
||||
{
|
||||
luaL_unref(L, LUA_REGISTRYINDEX, functionRef);
|
||||
luaL_error(L, "Couldn't find a gameobject with (ID: %d)!", id);
|
||||
VehicleEventBindings->Insert(evt, functionRef);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
GameObjectGossipBindings->Insert(id, evt, functionRef);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case HookMgr::REGTYPE_ITEM:
|
||||
if (evt < HookMgr::ITEM_EVENT_COUNT)
|
||||
{
|
||||
if (!eObjectMgr->GetItemTemplate(id))
|
||||
case HookMgr::REGTYPE_BG:
|
||||
if (evt < HookMgr::BG_EVENT_COUNT)
|
||||
{
|
||||
luaL_unref(L, LUA_REGISTRYINDEX, functionRef);
|
||||
luaL_error(L, "Couldn't find a item with (ID: %d)!", id);
|
||||
BGEventBindings->Insert(evt, functionRef);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
ItemEventBindings->Insert(id, evt, functionRef);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case HookMgr::REGTYPE_ITEM_GOSSIP:
|
||||
if (evt < HookMgr::GOSSIP_EVENT_COUNT)
|
||||
{
|
||||
if (!eObjectMgr->GetItemTemplate(id))
|
||||
case HookMgr::REGTYPE_PACKET:
|
||||
if (evt < HookMgr::PACKET_EVENT_COUNT)
|
||||
{
|
||||
luaL_unref(L, LUA_REGISTRYINDEX, functionRef);
|
||||
luaL_error(L, "Couldn't find a item with (ID: %d)!", id);
|
||||
if (id >= NUM_MSG_TYPES)
|
||||
{
|
||||
luaL_unref(L, LUA_REGISTRYINDEX, functionRef);
|
||||
luaL_error(L, "Couldn't find a creature with (ID: %d)!", id);
|
||||
return;
|
||||
}
|
||||
|
||||
PacketEventBindings->Insert(id, evt, functionRef);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
ItemGossipBindings->Insert(id, evt, functionRef);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case HookMgr::REGTYPE_CREATURE:
|
||||
if (evt < HookMgr::CREATURE_EVENT_COUNT)
|
||||
{
|
||||
if (!eObjectMgr->GetCreatureTemplate(id))
|
||||
{
|
||||
luaL_unref(L, LUA_REGISTRYINDEX, functionRef);
|
||||
luaL_error(L, "Couldn't find a creature with (ID: %d)!", id);
|
||||
return;
|
||||
}
|
||||
|
||||
case HookMgr::REGTYPE_PLAYER_GOSSIP:
|
||||
if (evt < HookMgr::GOSSIP_EVENT_COUNT)
|
||||
{
|
||||
playerGossipBindings->Insert(id, evt, functionRef);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
CreatureEventBindings->Insert(id, evt, functionRef);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case HookMgr::REGTYPE_CREATURE_GOSSIP:
|
||||
if (evt < HookMgr::GOSSIP_EVENT_COUNT)
|
||||
{
|
||||
if (!eObjectMgr->GetCreatureTemplate(id))
|
||||
{
|
||||
luaL_unref(L, LUA_REGISTRYINDEX, functionRef);
|
||||
luaL_error(L, "Couldn't find a creature with (ID: %d)!", id);
|
||||
return;
|
||||
}
|
||||
|
||||
CreatureGossipBindings->Insert(id, evt, functionRef);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case HookMgr::REGTYPE_GAMEOBJECT:
|
||||
if (evt < HookMgr::GAMEOBJECT_EVENT_COUNT)
|
||||
{
|
||||
if (!eObjectMgr->GetGameObjectTemplate(id))
|
||||
{
|
||||
luaL_unref(L, LUA_REGISTRYINDEX, functionRef);
|
||||
luaL_error(L, "Couldn't find a gameobject with (ID: %d)!", id);
|
||||
return;
|
||||
}
|
||||
|
||||
GameObjectEventBindings->Insert(id, evt, functionRef);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case HookMgr::REGTYPE_GAMEOBJECT_GOSSIP:
|
||||
if (evt < HookMgr::GOSSIP_EVENT_COUNT)
|
||||
{
|
||||
if (!eObjectMgr->GetGameObjectTemplate(id))
|
||||
{
|
||||
luaL_unref(L, LUA_REGISTRYINDEX, functionRef);
|
||||
luaL_error(L, "Couldn't find a gameobject with (ID: %d)!", id);
|
||||
return;
|
||||
}
|
||||
|
||||
GameObjectGossipBindings->Insert(id, evt, functionRef);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case HookMgr::REGTYPE_ITEM:
|
||||
if (evt < HookMgr::ITEM_EVENT_COUNT)
|
||||
{
|
||||
if (!eObjectMgr->GetItemTemplate(id))
|
||||
{
|
||||
luaL_unref(L, LUA_REGISTRYINDEX, functionRef);
|
||||
luaL_error(L, "Couldn't find a item with (ID: %d)!", id);
|
||||
return;
|
||||
}
|
||||
|
||||
ItemEventBindings->Insert(id, evt, functionRef);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case HookMgr::REGTYPE_ITEM_GOSSIP:
|
||||
if (evt < HookMgr::GOSSIP_EVENT_COUNT)
|
||||
{
|
||||
if (!eObjectMgr->GetItemTemplate(id))
|
||||
{
|
||||
luaL_unref(L, LUA_REGISTRYINDEX, functionRef);
|
||||
luaL_error(L, "Couldn't find a item with (ID: %d)!", id);
|
||||
return;
|
||||
}
|
||||
|
||||
ItemGossipBindings->Insert(id, evt, functionRef);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case HookMgr::REGTYPE_PLAYER_GOSSIP:
|
||||
if (evt < HookMgr::GOSSIP_EVENT_COUNT)
|
||||
{
|
||||
playerGossipBindings->Insert(id, evt, functionRef);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
luaL_unref(L, LUA_REGISTRYINDEX, functionRef);
|
||||
luaL_error(L, "Unknown event type (regtype %d, id %d, event %d)", regtype, id, evt);
|
||||
|
||||
@@ -797,7 +797,7 @@ ElunaRegister<Creature> CreatureMethods[] =
|
||||
{ "Respawn", &LuaCreature::Respawn },
|
||||
{ "AttackStart", &LuaCreature::AttackStart },
|
||||
#ifdef TRINITY
|
||||
{"AddLootMode", &LuaCreature::AddLootMode},
|
||||
{ "AddLootMode", &LuaCreature::AddLootMode },
|
||||
{ "ResetLootMode", &LuaCreature::ResetLootMode },
|
||||
{ "RemoveLootMode", &LuaCreature::RemoveLootMode },
|
||||
#endif
|
||||
|
||||
46
MapMethods.h
46
MapMethods.h
@@ -202,29 +202,29 @@ namespace LuaMap
|
||||
#else
|
||||
switch (GUID_HIPART(guid))
|
||||
{
|
||||
case HIGHGUID_PLAYER:
|
||||
Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (Player*)NULL));
|
||||
break;
|
||||
case HIGHGUID_TRANSPORT:
|
||||
case HIGHGUID_MO_TRANSPORT:
|
||||
case HIGHGUID_GAMEOBJECT:
|
||||
Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (GameObject*)NULL));
|
||||
break;
|
||||
case HIGHGUID_VEHICLE:
|
||||
case HIGHGUID_UNIT:
|
||||
Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (Creature*)NULL));
|
||||
break;
|
||||
case HIGHGUID_PET:
|
||||
Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (Pet*)NULL));
|
||||
break;
|
||||
case HIGHGUID_DYNAMICOBJECT:
|
||||
Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (DynamicObject*)NULL));
|
||||
break;
|
||||
case HIGHGUID_CORPSE:
|
||||
Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (Corpse*)NULL));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case HIGHGUID_PLAYER:
|
||||
Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (Player*)NULL));
|
||||
break;
|
||||
case HIGHGUID_TRANSPORT:
|
||||
case HIGHGUID_MO_TRANSPORT:
|
||||
case HIGHGUID_GAMEOBJECT:
|
||||
Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (GameObject*)NULL));
|
||||
break;
|
||||
case HIGHGUID_VEHICLE:
|
||||
case HIGHGUID_UNIT:
|
||||
Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (Creature*)NULL));
|
||||
break;
|
||||
case HIGHGUID_PET:
|
||||
Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (Pet*)NULL));
|
||||
break;
|
||||
case HIGHGUID_DYNAMICOBJECT:
|
||||
Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (DynamicObject*)NULL));
|
||||
break;
|
||||
case HIGHGUID_CORPSE:
|
||||
Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (Corpse*)NULL));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
return 1;
|
||||
|
||||
@@ -1176,14 +1176,14 @@ namespace LuaPlayer
|
||||
Gender gender;
|
||||
switch (_gender)
|
||||
{
|
||||
case 0:
|
||||
gender = GENDER_MALE;
|
||||
break;
|
||||
case 1:
|
||||
gender = GENDER_FEMALE;
|
||||
break;
|
||||
default:
|
||||
return luaL_argerror(L, 2, "valid Gender expected");
|
||||
case 0:
|
||||
gender = GENDER_MALE;
|
||||
break;
|
||||
case 1:
|
||||
gender = GENDER_FEMALE;
|
||||
break;
|
||||
default:
|
||||
return luaL_argerror(L, 2, "valid Gender expected");
|
||||
}
|
||||
|
||||
player->SetByteValue(UNIT_FIELD_BYTES_0, 2, gender);
|
||||
|
||||
Reference in New Issue
Block a user