Skip to content

Commit 0ef8ca1

Browse files
committed
VMaNGOS: Changes to allow VMaNGOS to build
1 parent 8d22683 commit 0ef8ca1

8 files changed

Lines changed: 76 additions & 13 deletions

File tree

ElunaEventMgr.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include "Random.h"
1414
#elif defined ELUNA_CMANGOS
1515
#include "Util/Util.h"
16+
#elif defined ELUNA_VMANGOS
17+
#include "Utilities/Random.h"
1618
#else
1719
#include "Util.h"
1820
#endif

ElunaIncludes.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@
4040
#include "ScriptMgr.h"
4141
#include "Spell.h"
4242
#include "SpellAuras.h"
43+
#if !defined ELUNA_VMANGOS
4344
#include "SpellAuraEffects.h"
45+
#endif
4446
#include "SpellMgr.h"
4547
#include "TemporarySummon.h"
4648
#include "WorldPacket.h"

LuaEngine.h

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ typedef AreaTrigger AreaTriggerEntry;
8282
#else
8383
class InstanceData;
8484
struct ItemPrototype;
85+
#if !defined ELUNA_VMANGOS
8586
struct SpellEntry;
87+
#endif
8688
typedef ItemPrototype ItemTemplate;
8789
typedef SpellEffectIndex SpellEffIndex;
8890
typedef SpellEntry SpellInfo;
@@ -639,7 +641,7 @@ class ELUNA_GAME_API Eluna
639641
void OnBGDestroy(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId);
640642

641643
/* Spell */
642-
#ifdef ELUNA_TRINITY
644+
#ifdef ELUNA_TRINITY
643645
void OnSpellCast(Spell* pSpell, bool skipCheck);
644646
bool OnAuraApplication(Aura* aura, AuraEffect const* auraEff, Unit* target, uint8 mode, bool apply);
645647
void OnAuraDispel(Aura* aura, DispelInfo* dispelInfo);
@@ -663,7 +665,7 @@ class ELUNA_GAME_API Eluna
663665
void OnSpellHit(Spell* pSpell);
664666
void OnAfterSpellHit(Spell* pSpell);
665667
void OnEffectCalcAbsorb(Spell* pSpell, DamageInfo const& damageInfo, uint32& resistAmount, int32& absorbAmount);
666-
#else
668+
#elif defined ELUNA_CMANGOS
667669
void OnSpellCast(Spell* pSpell, bool skipCheck);
668670
bool OnAuraApplication(Aura* aura, Unit* target, uint8 mode, bool apply);
669671
void OnAuraDispel(Aura* aura, Unit* dispeller, uint32 dispellingSpellId, uint32 originalStacks);
@@ -687,7 +689,31 @@ class ELUNA_GAME_API Eluna
687689
void OnSpellHit(Spell* pSpell);
688690
void OnAfterSpellHit(Spell* pSpell);
689691
void OnEffectCalcAbsorb(Spell* pSpell, SpellNonMeleeDamage const& damageInfo, uint32& resistAmount, int32& absorbAmount);
690-
#endif
692+
#elif defined ELUNA_VMANGOS
693+
void OnSpellCast(Spell* pSpell, bool skipCheck);
694+
bool OnAuraApplication(Aura* aura, Unit* target, uint8 mode, bool apply);
695+
void OnAuraDispel(Aura* aura, Unit* dispeller, uint32 dispellingSpellId, uint32 originalStacks);
696+
bool OnPeriodicTick(Aura* aura, Unit* target);
697+
void OnPeriodicUpdate(Aura* aura);
698+
void OnAuraCalcAmount(Aura* aura, int32& amount, bool& canBeRecalculated);
699+
void OnCalcPeriodic(Aura* aura, bool& isPeriodic, int32& amplitude);
700+
// bool OnAuraCanProc(Aura* aura, ProcExecutionData& procInfo);
701+
// bool OnAuraProc(Aura* aura, ProcExecutionData& procInfo);
702+
uint32 OnCheckCast(Spell* pSpell);
703+
void OnBeforeCast(Spell* pSpell);
704+
void OnAfterCast(Spell* pSpell);
705+
void OnObjectAreaTargetSelect(Spell* pSpell, uint8 effIndex, std::list<WorldObject*>& targets);
706+
void OnObjectTargetSelect(Spell* pSpell, uint8 effIndex, WorldObject*& target);
707+
//void OnDestinationTargetSelect(Spell* pSpell, uint8 effIndex, SpellCastTargets& target);
708+
bool OnEffectLaunch(Spell* pSpell, uint8 effIndex, uint8 mode, bool preventDefault);
709+
bool OnEffectLaunchTarget(Spell* pSpell, uint8 effIndex, uint8 mode, bool preventDefault);
710+
bool OnEffectHit(Spell* pSpell, uint8 effIndex, uint8 mode, bool preventDefault);
711+
bool OnEffectHitTarget(Spell* pSpell, uint8 effIndex, uint8 mode, bool preventDefault);
712+
void OnBeforeSpellHit(Spell* pSpell, uint8 missInfo);
713+
void OnSpellHit(Spell* pSpell);
714+
void OnAfterSpellHit(Spell* pSpell);
715+
//void OnEffectCalcAbsorb(Spell* pSpell, SpellNonMeleeDamage const& damageInfo, uint32& resistAmount, int32& absorbAmount);
716+
#endif
691717
};
692718
template<> Unit* Eluna::CHECKOBJ<Unit>(int narg, bool error);
693719
template<> Object* Eluna::CHECKOBJ<Object>(int narg, bool error);

hooks/Hooks.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ namespace Hooks
360360
};
361361

362362
// SPELL EVENTS
363+
#if !defined ELUNA_VMANGOS
363364
#define SPELL_EVENTS_LIST(X) \
364365
X(SPELL_EVENT_ON_CAST, 1, "on_cast") \
365366
X(SPELL_EVENT_ON_AURA_APPLICATION, 2, "on_aura_application") \
@@ -384,6 +385,31 @@ namespace Hooks
384385
X(SPELL_EVENT_ON_EFFECT_HIT_TARGET, 21, "on_effect_hit_target") \
385386
X(SPELL_EVENT_ON_HIT, 22, "on_hit") \
386387
X(SPELL_EVENT_ON_AFTER_HIT, 23, "on_after_hit")
388+
#else
389+
#define SPELL_EVENTS_LIST(X) \
390+
X(SPELL_EVENT_ON_CAST, 1, "on_cast") \
391+
X(SPELL_EVENT_ON_AURA_APPLICATION, 2, "on_aura_application") \
392+
X(SPELL_EVENT_ON_DISPEL, 3, "on_dispel") \
393+
X(SPELL_EVENT_ON_PERIODIC_TICK, 4, "on_periodic_tick") \
394+
X(SPELL_EVENT_ON_PERIODIC_UPDATE, 5, "on_periodic_update") \
395+
X(SPELL_EVENT_ON_AURA_CALC_AMOUNT, 6, "on_aura_calc_amount") \
396+
X(SPELL_EVENT_ON_CALC_PERIODIC, 7, "on_calc_periodic") \
397+
/* 8,9 not valid for VMaNGOS */ \
398+
X(SPELL_EVENT_ON_CHECK_CAST, 10, "on_check_cast") \
399+
X(SPELL_EVENT_ON_BEFORE_CAST, 11, "on_before_cast") \
400+
X(SPELL_EVENT_ON_AFTER_CAST, 12, "on_after_cast") \
401+
X(SPELL_EVENT_ON_OBJECT_AREA_TARGET, 13, "on_object_area_target") \
402+
X(SPELL_EVENT_ON_OBJECT_TARGET, 14, "on_object_target") \
403+
/* 15 not valid for VMaNGOS */ \
404+
X(SPELL_EVENT_ON_EFFECT_LAUNCH, 16, "on_effect_launch") \
405+
X(SPELL_EVENT_ON_EFFECT_LAUNCH_TARGET, 17, "on_effect_launch_target") \
406+
/* 18 not valid for VMaNGOS */ \
407+
X(SPELL_EVENT_ON_EFFECT_HIT, 19, "on_effect_hit") \
408+
X(SPELL_EVENT_ON_BEFORE_HIT, 20, "on_before_hit") \
409+
X(SPELL_EVENT_ON_EFFECT_HIT_TARGET, 21, "on_effect_hit_target") \
410+
X(SPELL_EVENT_ON_HIT, 22, "on_hit") \
411+
X(SPELL_EVENT_ON_AFTER_HIT, 23, "on_after_hit")
412+
#endif
387413

388414
enum SpellEvents
389415
{

hooks/SpellHooks.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ void Eluna::OnCalcPeriodic(Aura* aura, bool& isPeriodic, int32& amplitude)
201201
}
202202
#endif
203203

204+
#if !defined ELUNA_VMANGOS
204205
#if defined ELUNA_TRINITY
205206
bool Eluna::OnAuraCanProc(Aura* aura, ProcEventInfo& procInfo)
206207
#elif defined ELUNA_CMANGOS
@@ -230,6 +231,7 @@ bool Eluna::OnAuraProc(Aura* aura, ProcExecutionData& procInfo)
230231
luaProcInfo.ApplyToProcEventInfo(procInfo);
231232
return defaultPrevented;
232233
}
234+
#endif
233235

234236
uint32 Eluna::OnCheckCast(Spell* pSpell)
235237
{
@@ -304,7 +306,7 @@ void Eluna::OnDestinationTargetSelect(Spell* pSpell, uint8 effIndex, SpellDestin
304306
target._position.m_positionZ = posZ;
305307
target._position.SetOrientation(orientation);
306308
}
307-
#else
309+
#elif defiend ELUNA_CMANGOS
308310
void Eluna::OnDestinationTargetSelect(Spell* pSpell, uint8 effIndex, SpellCastTargets& target)
309311
{
310312
START_HOOK(SPELL_EVENT_ON_DEST_TARGET, pSpell);

methods/VMangos/CreatureMethods.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@ namespace LuaCreature
293293
{
294294
uint32 spellId = E->CHECKVAL<uint32>(2);
295295

296-
E->Push(creature->IsSpellReady(spellId));
296+
SpellEntry const* spellEntry = sSpellMgr.GetSpellEntry(spellId);
297+
E->Push(creature->IsSpellReady(spellEntry));
297298
return 1;
298299
}
299300

methods/VMangos/GuildMethods.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,14 @@ namespace LuaGuild
141141
*
142142
* @param [WorldPacket] packet : the [WorldPacket] to be sent to the [Player]s
143143
*/
144+
/*
144145
int SendPacket(Eluna* E, Guild* guild)
145146
{
146147
WorldPacket* data = E->CHECKOBJ<WorldPacket>(2);
147148
148149
guild->BroadcastPacket(data);
149150
return 0;
150-
}
151+
}*/
151152

152153
// SendPacketToRankedInGuild(packet, rankId)
153154
/**
@@ -156,14 +157,15 @@ namespace LuaGuild
156157
* @param [WorldPacket] packet : the [WorldPacket] to be sent to the [Player]s
157158
* @param uint8 rankId : the rank ID
158159
*/
160+
/*
159161
int SendPacketToRanked(Eluna* E, Guild* guild)
160162
{
161163
WorldPacket* data = E->CHECKOBJ<WorldPacket>(2);
162164
uint8 ranked = E->CHECKVAL<uint8>(3);
163165
164166
guild->BroadcastPacketToRank(data, ranked);
165167
return 0;
166-
}
168+
}*/
167169

168170
/**
169171
* Disbands the [Guild]
@@ -238,8 +240,8 @@ namespace LuaGuild
238240
{ "SetLeader", &LuaGuild::SetLeader, METHOD_REG_WORLD }, // World state method only in multistate
239241

240242
// Other
241-
{ "SendPacket", &LuaGuild::SendPacket },
242-
{ "SendPacketToRanked", &LuaGuild::SendPacketToRanked },
243+
//{ "SendPacket", &LuaGuild::SendPacket },
244+
//{ "SendPacketToRanked", &LuaGuild::SendPacketToRanked },
243245
{ "Disband", &LuaGuild::Disband, METHOD_REG_WORLD }, // World state method only in multistate
244246
{ "AddMember", &LuaGuild::AddMember, METHOD_REG_WORLD }, // World state method only in multistate
245247
{ "DeleteMember", &LuaGuild::DeleteMember, METHOD_REG_WORLD }, // World state method only in multistate

methods/VMangos/PlayerMethods.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ namespace LuaPlayer
135135
{
136136
uint32 spellId = E->CHECKVAL<uint32>(2);
137137

138-
E->Push(player->IsSpellReady(spellId));
138+
SpellEntry const* spellEntry = sSpellMgr.GetSpellEntry(spellId);
139+
E->Push(player->IsSpellReady(spellEntry));
139140
return 1;
140141
}
141142

@@ -1764,6 +1765,7 @@ namespace LuaPlayer
17641765
*
17651766
* @param ObjectGuid guid = playerguid : guid of the mailbox window sender
17661767
*/
1768+
/*
17671769
int SendShowMailBox(Eluna* E, Player* player)
17681770
{
17691771
ObjectGuid guid = E->CHECKVAL<ObjectGuid>(2, player->GET_GUID());
@@ -1772,7 +1774,7 @@ namespace LuaPlayer
17721774
data << guid;
17731775
player->GetSession()->HandleGetMailList(data);
17741776
return 0;
1775-
}
1777+
}*/
17761778

17771779
/**
17781780
* Saves the [Player] to the database
@@ -2819,7 +2821,7 @@ namespace LuaPlayer
28192821
bool update = E->CHECKVAL<bool>(3, true);
28202822

28212823
SpellEntry const* spellEntry = sSpellMgr.GetSpellEntry(spellId);
2822-
player->RemoveSpellCooldown(*spellEntry, update);
2824+
player->RemoveSpellCooldown(spellEntry, update);
28232825
return 0;
28242826
}
28252827

@@ -3575,7 +3577,7 @@ namespace LuaPlayer
35753577
{ "SendUpdateWorldState", &LuaPlayer::SendUpdateWorldState },
35763578
{ "RewardQuest", &LuaPlayer::RewardQuest },
35773579
{ "SendAuctionMenu", &LuaPlayer::SendAuctionMenu },
3578-
{ "SendShowMailBox", &LuaPlayer::SendShowMailBox },
3580+
//{ "SendShowMailBox", &LuaPlayer::SendShowMailBox },
35793581
{ "StartTaxi", &LuaPlayer::StartTaxi },
35803582
{ "GossipSendPOI", &LuaPlayer::GossipSendPOI },
35813583
{ "GossipAddQuests", &LuaPlayer::GossipAddQuests },

0 commit comments

Comments
 (0)