Eluna update

This commit is contained in:
Rochet2
2014-03-26 21:49:38 +02:00
committed by Foereaper
parent 58e121bf5c
commit 4dd716015b
8 changed files with 136 additions and 201 deletions

View File

@@ -41,7 +41,7 @@ namespace LuaGlobalFunctions
int GetPlayerByGUID(lua_State* L)
{
uint64 guid = sEluna->CHECKVAL<uint64>(L, 1);
sEluna->Push(L, sObjectAccessor->FindPlayer(GUID_TYPE(guid)));
sEluna->Push(L, sObjectAccessor->FindPlayer(ObjectGuid(guid)));
return 1;
}
@@ -151,7 +151,7 @@ namespace LuaGlobalFunctions
{
uint64 guid = sEluna->CHECKVAL<uint64>(L, 1);
sEluna->Push(L, sGuildMgr->GetGuildByLeader(GUID_TYPE(guid)));
sEluna->Push(L, sGuildMgr->GetGuildByLeader(ObjectGuid(guid)));
return 1;
}
@@ -597,7 +597,7 @@ namespace LuaGlobalFunctions
if (!cinfo)
return 0;
TemporarySummon* pCreature = new TemporarySummon(GUID_TYPE(uint64(0)));
TemporarySummon* pCreature = new TemporarySummon(ObjectGuid(uint64(0)));
#if (defined(TBC) || defined(CLASSIC))
CreatureCreatePos pos(map, x, y, z, o);
#else
@@ -1118,7 +1118,7 @@ namespace LuaGlobalFunctions
uint64 guid = sEluna->CHECKVAL<uint64>(L, 1);
bool insignia = sEluna->CHECKVAL<bool>(L, 2, false);
sEluna->Push(L, sObjectAccessor->ConvertCorpseForPlayer(GUID_TYPE(guid), insignia));
sEluna->Push(L, sObjectAccessor->ConvertCorpseForPlayer(ObjectGuid(guid), insignia));
return 0;
}

View File

@@ -13,7 +13,7 @@ namespace LuaGroup
int IsLeader(lua_State* L, Group* group)
{
uint64 guid = sEluna->CHECKVAL<uint64>(L, 2);
sEluna->Push(L, group->IsLeader(GUID_TYPE(guid)));
sEluna->Push(L, group->IsLeader(ObjectGuid(guid)));
return 1;
}
@@ -184,7 +184,7 @@ namespace LuaGroup
bool ignorePlayersInBg = sEluna->CHECKVAL<bool>(L, 3);
uint64 ignore = sEluna->CHECKVAL<uint64>(L, 4);
group->BroadcastPacket(data, ignorePlayersInBg, -1, (GUID_TYPE)ignore);
group->BroadcastPacket(data, ignorePlayersInBg, -1, ObjectGuid(ignore));
return 0;
}

View File

@@ -774,6 +774,12 @@ void HookMgr::OnGiveXP(Player* pPlayer, uint32& amount, Unit* pVictim)
sEluna->Push(sEluna->L, amount);
sEluna->Push(sEluna->L, pVictim);
sEluna->PlayerEventBindings.ExecuteCall();
for (int i = 1; i <= lua_gettop(sEluna->L); ++i)
{
if (lua_isnoneornil(sEluna->L, i))
continue;
amount = sEluna->CHECKVAL<uint32>(sEluna->L, i, 0);
}
sEluna->PlayerEventBindings.EndCall();
}
@@ -787,6 +793,12 @@ void HookMgr::OnReputationChange(Player* pPlayer, uint32 factionID, int32& stand
sEluna->Push(sEluna->L, standing);
sEluna->Push(sEluna->L, incremental);
sEluna->PlayerEventBindings.ExecuteCall();
for (int i = 1; i <= lua_gettop(sEluna->L); ++i)
{
if (lua_isnoneornil(sEluna->L, i))
continue;
standing = sEluna->CHECKVAL<uint32>(sEluna->L, i, 0);
}
sEluna->PlayerEventBindings.EndCall();
}
@@ -824,20 +836,6 @@ void HookMgr::OnDuelEnd(Player* pWinner, Player* pLoser, DuelCompleteType type)
sEluna->PlayerEventBindings.EndCall();
}
void HookMgr::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, Player* pReceiver)
{
ELUNA_GUARD();
if (!sEluna->PlayerEventBindings.BeginCall(PLAYER_EVENT_ON_WHISPER))
return;
sEluna->Push(sEluna->L, pPlayer);
sEluna->Push(sEluna->L, msg);
sEluna->Push(sEluna->L, type);
sEluna->Push(sEluna->L, lang);
sEluna->Push(sEluna->L, pReceiver);
sEluna->PlayerEventBindings.ExecuteCall();
sEluna->PlayerEventBindings.EndCall();
}
void HookMgr::OnEmote(Player* pPlayer, uint32 emote)
{
ELUNA_GUARD();
@@ -974,8 +972,13 @@ bool HookMgr::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg
{
if (lua_isnoneornil(sEluna->L, i))
continue;
if (!lua_toboolean(sEluna->L, i))
if (const char* c_str = sEluna->CHECKVAL<const char*>(sEluna->L, i, NULL))
msg = std::string(c_str);
else if (!sEluna->CHECKVAL<bool>(sEluna->L, i, true))
{
result = false;
break;
}
}
sEluna->PlayerEventBindings.EndCall();
}
@@ -998,8 +1001,13 @@ bool HookMgr::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg
{
if (lua_isnoneornil(sEluna->L, i))
continue;
if (!lua_toboolean(sEluna->L, i))
if (const char* c_str = sEluna->CHECKVAL<const char*>(sEluna->L, i, NULL))
msg = std::string(c_str);
else if (!sEluna->CHECKVAL<bool>(sEluna->L, i, true))
{
result = false;
break;
}
}
sEluna->PlayerEventBindings.EndCall();
}
@@ -1022,8 +1030,13 @@ bool HookMgr::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg
{
if (lua_isnoneornil(sEluna->L, i))
continue;
if (!lua_toboolean(sEluna->L, i))
if (const char* c_str = sEluna->CHECKVAL<const char*>(sEluna->L, i, NULL))
msg = std::string(c_str);
else if (!sEluna->CHECKVAL<bool>(sEluna->L, i, true))
{
result = false;
break;
}
}
sEluna->PlayerEventBindings.EndCall();
}
@@ -1046,8 +1059,42 @@ bool HookMgr::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg
{
if (lua_isnoneornil(sEluna->L, i))
continue;
if (!lua_toboolean(sEluna->L, i))
if (const char* c_str = sEluna->CHECKVAL<const char*>(sEluna->L, i, NULL))
msg = std::string(c_str);
else if (!sEluna->CHECKVAL<bool>(sEluna->L, i, true))
{
result = false;
break;
}
}
sEluna->PlayerEventBindings.EndCall();
}
return result;
}
bool HookMgr::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, Player* pReceiver)
{
ELUNA_GUARD();
bool result = true;
if (sEluna->PlayerEventBindings.BeginCall(PLAYER_EVENT_ON_WHISPER))
{
sEluna->Push(sEluna->L, pPlayer);
sEluna->Push(sEluna->L, msg);
sEluna->Push(sEluna->L, type);
sEluna->Push(sEluna->L, lang);
sEluna->Push(sEluna->L, pReceiver);
sEluna->PlayerEventBindings.ExecuteCall();
for (int i = 1; i <= lua_gettop(sEluna->L); ++i)
{
if (lua_isnoneornil(sEluna->L, i))
continue;
if (const char* c_str = sEluna->CHECKVAL<const char*>(sEluna->L, i, NULL))
msg = std::string(c_str);
else if (!sEluna->CHECKVAL<bool>(sEluna->L, i, true))
{
result = false;
break;
}
}
sEluna->PlayerEventBindings.EndCall();
}
@@ -1220,11 +1267,13 @@ bool HookMgr::OnPacketSend(WorldSession* session, WorldPacket& packet)
{
if (lua_isnoneornil(sEluna->L, i))
continue;
WorldPacket* data = sEluna->CHECKOBJ<WorldPacket>(sEluna->L, i, false);
if (data)
if (WorldPacket* data = sEluna->CHECKOBJ<WorldPacket>(sEluna->L, i, false))
packet = *data;
if (!sEluna->CHECKVAL<bool>(sEluna->L, i, true))
{
result = false;
break;
}
}
sEluna->ServerEventBindings.EndCall();
}
@@ -1237,11 +1286,13 @@ bool HookMgr::OnPacketSend(WorldSession* session, WorldPacket& packet)
{
if (lua_isnoneornil(sEluna->L, i))
continue;
WorldPacket* data = sEluna->CHECKOBJ<WorldPacket>(sEluna->L, i, false);
if (data)
if (WorldPacket* data = sEluna->CHECKOBJ<WorldPacket>(sEluna->L, i, false))
packet = *data;
if (!sEluna->CHECKVAL<bool>(sEluna->L, i, true))
{
result = false;
break;
}
}
sEluna->PacketEventBindings.EndCall();
}
@@ -1263,11 +1314,13 @@ bool HookMgr::OnPacketReceive(WorldSession* session, WorldPacket& packet)
{
if (lua_isnoneornil(sEluna->L, i))
continue;
WorldPacket* data = sEluna->CHECKOBJ<WorldPacket>(sEluna->L, i, false);
if (data)
if (WorldPacket* data = sEluna->CHECKOBJ<WorldPacket>(sEluna->L, i, false))
packet = *data;
if (!sEluna->CHECKVAL<bool>(sEluna->L, i, true))
{
result = false;
break;
}
}
sEluna->ServerEventBindings.EndCall();
}
@@ -1280,11 +1333,13 @@ bool HookMgr::OnPacketReceive(WorldSession* session, WorldPacket& packet)
{
if (lua_isnoneornil(sEluna->L, i))
continue;
WorldPacket* data = sEluna->CHECKOBJ<WorldPacket>(sEluna->L, i, false);
if (data)
if (WorldPacket* data = sEluna->CHECKOBJ<WorldPacket>(sEluna->L, i, false))
packet = *data;
if (!sEluna->CHECKVAL<bool>(sEluna->L, i, true))
{
result = false;
break;
}
}
sEluna->PacketEventBindings.EndCall();
}

View File

@@ -23,18 +23,18 @@
#include "Weather.h"
#ifdef MANGOS
#define ScriptedAI ReactorAI
#define SpellEffIndex SpellEffectIndex
#define ItemTemplate ItemPrototype
typedef SpellEffectIndex SpellEffIndex;
typedef ItemPrototype ItemTemplate;
#define GetTemplate GetProto
#ifdef CLASSIC
#define Difficulty int
typedef int Difficulty;
#endif
#endif
struct AreaTriggerEntry;
#ifdef MANGOS
class ScriptedAI;
class ReactorAI;
typedef ReactorAI ScriptedAI;
#else
struct ScriptedAI;
#endif
@@ -141,17 +141,17 @@ enum PlayerEvents
PLAYER_EVENT_ON_DUEL_REQUEST = 9, // (event, target, challenger)
PLAYER_EVENT_ON_DUEL_START = 10, // (event, player1, player2)
PLAYER_EVENT_ON_DUEL_END = 11, // (event, winner, loser, type)
PLAYER_EVENT_ON_GIVE_XP = 12, // (event, player, amount, victim)
PLAYER_EVENT_ON_GIVE_XP = 12, // (event, player, amount, victim) - Can return new XP amount
PLAYER_EVENT_ON_LEVEL_CHANGE = 13, // (event, player, oldLevel)
PLAYER_EVENT_ON_MONEY_CHANGE = 14, // (event, player, amount)
PLAYER_EVENT_ON_REPUTATION_CHANGE = 15, // (event, player, factionId, standing, incremental)
PLAYER_EVENT_ON_REPUTATION_CHANGE = 15, // (event, player, factionId, standing, incremental) - Can return new standing
PLAYER_EVENT_ON_TALENTS_CHANGE = 16, // (event, player, points)
PLAYER_EVENT_ON_TALENTS_RESET = 17, // (event, player, noCost)
PLAYER_EVENT_ON_CHAT = 18, // (event, player, msg, Type, lang) - Can return false
PLAYER_EVENT_ON_WHISPER = 19, // (event, player, msg, Type, lang, receiver)
PLAYER_EVENT_ON_GROUP_CHAT = 20, // (event, player, msg, Type, lang, group) - Can return false
PLAYER_EVENT_ON_GUILD_CHAT = 21, // (event, player, msg, Type, lang, guild) - Can return false
PLAYER_EVENT_ON_CHANNEL_CHAT = 22, // (event, player, msg, Type, lang, channel) - Can return false
PLAYER_EVENT_ON_CHAT = 18, // (event, player, msg, Type, lang) - Can return false or new msg
PLAYER_EVENT_ON_WHISPER = 19, // (event, player, msg, Type, lang, receiver) - Can return false or new msg
PLAYER_EVENT_ON_GROUP_CHAT = 20, // (event, player, msg, Type, lang, group) - Can return false or new msg
PLAYER_EVENT_ON_GUILD_CHAT = 21, // (event, player, msg, Type, lang, guild) - Can return false or new msg
PLAYER_EVENT_ON_CHANNEL_CHAT = 22, // (event, player, msg, Type, lang, channel) - Can return false or new msg
PLAYER_EVENT_ON_EMOTE = 23, // (event, player, emote) - Not triggered on any known emote
PLAYER_EVENT_ON_TEXT_EMOTE = 24, // (event, player, textEmote, emoteNum, guid)
PLAYER_EVENT_ON_SAVE = 25, // (event, player)
@@ -306,6 +306,8 @@ enum GossipEvents
class HookMgr
{
public:
friend class ACE_Singleton<HookMgr, ACE_Thread_Mutex>;
CreatureAI* GetAI(Creature* creature);
#ifndef MANGOS
@@ -382,11 +384,11 @@ public:
void OnDuelRequest(Player* pTarget, Player* pChallenger);
void OnDuelStart(Player* pStarter, Player* pChallenger);
void OnDuelEnd(Player* pWinner, Player* pLoser, DuelCompleteType type);
void OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, Player* pReceiver);
bool OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg);
bool OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, Group* pGroup);
bool OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, Guild* pGuild);
bool OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, Channel* pChannel);
bool OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, Player* pReceiver);
void OnEmote(Player* pPlayer, uint32 emote);
void OnTextEmote(Player* pPlayer, uint32 textEmote, uint32 emoteNum, uint64 guid);
void OnSpellCast(Player* pPlayer, Spell* pSpell, bool skipCheck);
@@ -454,7 +456,7 @@ public:
#ifdef MANGOS
#define sHookMgr (&MaNGOS::Singleton<HookMgr>::Instance())
#else
#define sHookMgr ACE_Singleton<HookMgr, ACE_Null_Mutex>::instance()
#define sHookMgr ACE_Singleton<HookMgr, ACE_Thread_Mutex>::instance()
#endif
#endif

View File

@@ -65,8 +65,8 @@ extern "C"
typedef std::set<std::string> LoadedScripts;
#define ELUNA_GUARD() \
ACE_Guard< ACE_Thread_Mutex > ELUNA_GUARD_OBJECT (sEluna->lock);
#define ELUNA_GUARD() { }
// ACE_Guard< ACE_Thread_Mutex > ELUNA_GUARD_OBJECT (sEluna->lock);
#ifdef MANGOS
#undef sWorld
@@ -82,7 +82,6 @@ typedef std::set<std::string> LoadedScripts;
#define sAccountMgr (&MaNGOS::Singleton<AccountMgr>::Instance())
#define sObjectAccessor (&ObjectAccessor::Instance())
#define MAKE_NEW_GUID(l, e, h) ObjectGuid(h, e, l)
#define GUID_TYPE ObjectGuid
#define GET_GUID GetObjectGuid
#define GetGameObjectTemplate GetGameObjectInfo
#define GetItemTemplate GetItemPrototype
@@ -95,12 +94,12 @@ typedef std::set<std::string> LoadedScripts;
#define MAX_LOCALES MAX_LOCALE
#define OVERRIDE override
#define DIALOG_STATUS_SCRIPTED_NO_STATUS DIALOG_STATUS_UNDEFINED
#define TempSummon TemporarySummon
typedef TemporarySummon TempSummon;
#ifndef CLASSIC
#define PLAYER_FIELD_LIFETIME_HONORABLE_KILLS PLAYER_FIELD_LIFETIME_HONORBALE_KILLS
#endif
#define MAX_TALENT_SPECS MAX_TALENT_SPEC_COUNT
#define Vehicle VehicleInfo
typedef VehicleInfo Vehicle;
#define GUID_ENPART(guid) ObjectGuid(guid).GetEntry()
#define GUID_LOPART(guid) ObjectGuid(guid).GetCounter()
#define GUID_HIPART(guid) ObjectGuid(guid).GetHigh()
@@ -120,12 +119,12 @@ enum SelectAggroTarget
#define Opcodes OpcodesList
#endif
#else
#define GUID_TYPE uint64
typedef uint64 ObjectGuid;
#define GET_GUID GetGUID
#define CORE_VERSION _DATE
#define CORE_NAME "TrinityCore"
#define REGEN_TIME_FULL
#define ThreatList ThreatContainer::StorageType
typedef ThreatContainer::StorageType ThreatList;
#ifdef CATA
#define NUM_MSG_TYPES NUM_OPCODE_HANDLERS
#endif
@@ -448,9 +447,11 @@ class Eluna
{
public:
friend class ScriptMgr;
friend class ACE_Singleton<Eluna, ACE_Thread_Mutex>;
lua_State* L;
EventMgr m_EventMgr;
ACE_Thread_Mutex lock;
// ACE_Thread_Mutex lock;
Eluna()
{
@@ -601,13 +602,13 @@ public:
struct ObjectGUIDCheck
{
ObjectGUIDCheck(GUID_TYPE guid) : _guid(guid) { }
ObjectGUIDCheck(ObjectGuid guid) : _guid(guid) { }
bool operator()(WorldObject* object)
{
return object->GET_GUID() == _guid;
}
GUID_TYPE _guid;
ObjectGuid _guid;
};
// Binary predicate to sort WorldObjects based on the distance to a reference WorldObject
@@ -682,7 +683,7 @@ template<> Corpse* Eluna::CHECKOBJ<Corpse>(lua_State* L, int narg, bool error);
#ifdef MANGOS
#define sEluna (&MaNGOS::Singleton<Eluna>::Instance())
#else
#define sEluna ACE_Singleton<Eluna, ACE_Null_Mutex>::instance()
#define sEluna ACE_Singleton<Eluna, ACE_Thread_Mutex>::instance()
#endif
class LuaTaxiMgr

View File

@@ -1742,7 +1742,7 @@ namespace LuaPlayer
uint32 lang = sEluna->CHECKVAL<uint32>(L, 3);
uint64 guid = sEluna->CHECKVAL<uint64>(L, 4);
player->Whisper(text, lang, GUID_TYPE(guid));
player->Whisper(text, lang, ObjectGuid(guid));
return 0;
}
@@ -1776,131 +1776,8 @@ namespace LuaPlayer
{
uint32 xp = sEluna->CHECKVAL<uint32>(L, 2);
Unit* victim = sEluna->CHECKOBJ<Unit>(L, 3, false);
bool pureXP = sEluna->CHECKVAL<bool>(L, 4, true);
bool triggerHook = sEluna->CHECKVAL<bool>(L, 5, true);
#ifdef MANGOS
if (xp < 1)
return 0;
if (!player->isAlive())
return 0;
#if (!defined(TBC) && !defined(CLASSIC))
if (player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_XP_USER_DISABLED))
return 0;
#endif
uint32 level = player->getLevel();
if (triggerHook)
sHookMgr->OnGiveXP(player, xp, victim);
// XP to money conversion processed in Player::RewardQuest
if (level >= sWorld->getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL))
return 0;
#ifndef CLASSIC
if (!pureXP)
{
if (victim)
{
// handle SPELL_AURA_MOD_KILL_XP_PCT auras
Unit::AuraList const& ModXPPctAuras = player->GetAurasByType(SPELL_AURA_MOD_KILL_XP_PCT);
for (Unit::AuraList::const_iterator i = ModXPPctAuras.begin(); i != ModXPPctAuras.end(); ++i)
xp = uint32(xp * (1.0f + (*i)->GetModifier()->m_amount / 100.0f));
}
#ifndef TBC
else
{
// handle SPELL_AURA_MOD_QUEST_XP_PCT auras
Unit::AuraList const& ModXPPctAuras = player->GetAurasByType(SPELL_AURA_MOD_QUEST_XP_PCT);
for (Unit::AuraList::const_iterator i = ModXPPctAuras.begin(); i != ModXPPctAuras.end(); ++i)
xp = uint32(xp * (1.0f + (*i)->GetModifier()->m_amount / 100.0f));
}
#endif
}
#endif
// XP resting bonus for kill
uint32 rested_bonus_xp = victim ? player->GetXPRestBonus(xp) : 0;
player->SendLogXPGain(xp, victim, rested_bonus_xp);
uint32 curXP = player->GetUInt32Value(PLAYER_XP);
uint32 nextLvlXP = player->GetUInt32Value(PLAYER_NEXT_LEVEL_XP);
uint32 newXP = curXP + xp + rested_bonus_xp;
while (newXP >= nextLvlXP && level < sWorld->getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL))
{
newXP -= nextLvlXP;
if (level < sWorld->getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL))
player->GiveLevel(level + 1);
level = player->getLevel();
nextLvlXP = player->GetUInt32Value(PLAYER_NEXT_LEVEL_XP);
}
player->SetUInt32Value(PLAYER_XP, newXP);
#else
if (xp < 1)
return 0;
if (player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN))
return 0;
if (victim && victim->GetTypeId() == TYPEID_UNIT && !victim->ToCreature()->hasLootRecipient())
return 0;
uint8 level = player->getLevel();
if (triggerHook)
sScriptMgr->OnGivePlayerXP(player, xp, victim);
if (!pureXP)
{
// Favored experience increase START
uint32 zone = player->GetZoneId();
float favored_exp_mult = 0;
if ((player->HasAura(32096) || player->HasAura(32098)) && (zone == 3483 || zone == 3562 || zone == 3836 || zone == 3713 || zone == 3714))
favored_exp_mult = 0.05f; // Thrallmar's Favor and Honor Hold's Favor
xp = uint32(xp * (1 + favored_exp_mult));
// Favored experience increase END
}
// XP to money conversion processed in Player::RewardQuest
if (level >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
return 0;
uint32 bonus_xp = 0;
bool recruitAFriend = pureXP ? false : player->GetsRecruitAFriendBonus(true);
if (!pureXP)
{
// RaF does NOT stack with rested experience
if (recruitAFriend)
bonus_xp = 2 * xp; // xp + bonus_xp must add up to 3 * xp for RaF; calculation for quests done client-side
else
bonus_xp = victim ? player->GetXPRestBonus(xp) : 0; // XP resting bonus
}
player->SendLogXPGain(xp, victim, bonus_xp, recruitAFriend, 1.0f);
uint32 curXP = player->GetUInt32Value(PLAYER_XP);
uint32 nextLvlXP = player->GetUInt32Value(PLAYER_NEXT_LEVEL_XP);
uint32 newXP = curXP + xp + bonus_xp;
while (newXP >= nextLvlXP && level < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
{
newXP -= nextLvlXP;
if (level < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
player->GiveLevel(level + 1);
level = player->getLevel();
nextLvlXP = player->GetUInt32Value(PLAYER_NEXT_LEVEL_XP);
}
player->SetUInt32Value(PLAYER_XP, newXP);
#endif
player->GiveXP(xp, victim);
return 0;
}

View File

@@ -865,9 +865,9 @@ namespace LuaUnit
uint64 guid = sEluna->CHECKVAL<uint64>(L, 2);
#ifdef MANGOS
unit->SetOwnerGuid(GUID_TYPE(guid));
unit->SetOwnerGuid(ObjectGuid(guid));
#else
unit->SetOwnerGUID(GUID_TYPE(guid));
unit->SetOwnerGUID(ObjectGuid(guid));
#endif
return 0;
}
@@ -1029,9 +1029,9 @@ namespace LuaUnit
{
uint64 guid = sEluna->CHECKVAL<uint64>(L, 2);
#ifdef MANGOS
unit->SetOwnerGuid(GUID_TYPE(guid));
unit->SetOwnerGuid(ObjectGuid(guid));
#else
unit->SetOwnerGUID(GUID_TYPE(guid));
unit->SetOwnerGUID(ObjectGuid(guid));
#endif
return 0;
}
@@ -1040,9 +1040,9 @@ namespace LuaUnit
{
uint64 guid = sEluna->CHECKVAL<uint64>(L, 2);
#ifdef MANGOS
unit->SetPetGuid(GUID_TYPE(guid));
unit->SetPetGuid(ObjectGuid(guid));
#else
unit->SetMinionGUID(GUID_TYPE(guid));
unit->SetMinionGUID(ObjectGuid(guid));
#endif
return 0;
}
@@ -1051,9 +1051,9 @@ namespace LuaUnit
{
uint64 guid = sEluna->CHECKVAL<uint64>(L, 2);
#ifdef MANGOS
unit->SetCharmerGuid(GUID_TYPE(guid));
unit->SetCharmerGuid(ObjectGuid(guid));
#else
unit->SetCharmerGUID(GUID_TYPE(guid));
unit->SetCharmerGUID(ObjectGuid(guid));
#endif
return 0;
}
@@ -1062,9 +1062,9 @@ namespace LuaUnit
{
uint64 guid = sEluna->CHECKVAL<uint64>(L, 2);
#ifdef MANGOS
unit->SetPetGuid(GUID_TYPE(guid));
unit->SetPetGuid(ObjectGuid(guid));
#else
unit->SetPetGUID(GUID_TYPE(guid));
unit->SetPetGUID(ObjectGuid(guid));
#endif
return 0;
}
@@ -1139,9 +1139,9 @@ namespace LuaUnit
{
uint64 guid = sEluna->CHECKVAL<uint64>(L, 2);
#ifdef MANGOS
unit->SetCritterGuid(GUID_TYPE(guid));
unit->SetCritterGuid(ObjectGuid(guid));
#else
unit->SetCritterGUID(GUID_TYPE(guid));
unit->SetCritterGUID(ObjectGuid(guid));
#endif
return 0;
}

View File

@@ -293,27 +293,27 @@ namespace LuaWorldObject
#ifdef MANGOS
switch (GUID_HIPART(guid))
{
case HIGHGUID_PLAYER: sEluna->Push(L, obj->GetMap()->GetPlayer(GUID_TYPE(guid))); break;
case HIGHGUID_PLAYER: sEluna->Push(L, obj->GetMap()->GetPlayer(ObjectGuid(guid))); break;
case HIGHGUID_TRANSPORT:
case HIGHGUID_MO_TRANSPORT:
case HIGHGUID_GAMEOBJECT: sEluna->Push(L, obj->GetMap()->GetGameObject(GUID_TYPE(guid))); break;
case HIGHGUID_GAMEOBJECT: sEluna->Push(L, obj->GetMap()->GetGameObject(ObjectGuid(guid))); break;
#if (!defined(TBC) && !defined(CLASSIC))
case HIGHGUID_VEHICLE:
#endif
case HIGHGUID_UNIT:
case HIGHGUID_PET: sEluna->Push(L, obj->GetMap()->GetAnyTypeCreature(GUID_TYPE(guid))); break;
case HIGHGUID_PET: sEluna->Push(L, obj->GetMap()->GetAnyTypeCreature(ObjectGuid(guid))); break;
default: return 0;
}
#else
switch (GUID_HIPART(guid))
{
case HIGHGUID_PLAYER: sEluna->Push(L, sObjectAccessor->GetPlayer(*obj, GUID_TYPE(guid))); break;
case HIGHGUID_PLAYER: sEluna->Push(L, sObjectAccessor->GetPlayer(*obj, ObjectGuid(guid))); break;
case HIGHGUID_TRANSPORT:
case HIGHGUID_MO_TRANSPORT:
case HIGHGUID_GAMEOBJECT: sEluna->Push(L, sObjectAccessor->GetGameObject(*obj, GUID_TYPE(guid))); break;
case HIGHGUID_GAMEOBJECT: sEluna->Push(L, sObjectAccessor->GetGameObject(*obj, ObjectGuid(guid))); break;
case HIGHGUID_VEHICLE:
case HIGHGUID_UNIT: sEluna->Push(L, sObjectAccessor->GetCreature(*obj, GUID_TYPE(guid))); break;
case HIGHGUID_PET: sEluna->Push(L, sObjectAccessor->GetPet(*obj, GUID_TYPE(guid))); break;
case HIGHGUID_UNIT: sEluna->Push(L, sObjectAccessor->GetCreature(*obj, ObjectGuid(guid))); break;
case HIGHGUID_PET: sEluna->Push(L, sObjectAccessor->GetPet(*obj, ObjectGuid(guid))); break;
default: return 0;
}
#endif