mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
Merge branch 'master' of github.com:ElunaLuaEngine/Eluna into Elmsroth-rename-defines
This commit is contained in:
131
.github/workflows/build.yml
vendored
Normal file
131
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
name: build
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
TC-Eluna:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
eluna: [ON]
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: false
|
||||
repository: ElunaLuaEngine/ElunaTrinityWotlk
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
path: src/server/game/LuaEngine
|
||||
- name: Dependencies
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get install -yq libboost-all-dev
|
||||
- name: Setup
|
||||
env:
|
||||
ELUNA: ${{ matrix.eluna }}
|
||||
run: |
|
||||
mkdir bin
|
||||
cd bin
|
||||
cmake ../ -DELUNA=$ELUNA -DWITH_WARNINGS=1 -DWITH_COREDEBUG=0 -DUSE_COREPCH=1 -DUSE_SCRIPTPCH=1 -DTOOLS=1 -DSCRIPTS=dynamic -DSERVERS=1 -DNOJEM=0 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror" -DCMAKE_C_FLAGS_DEBUG="-DNDEBUG" -DCMAKE_CXX_FLAGS_DEBUG="-DNDEBUG" -DCMAKE_INSTALL_PREFIX=check_install -DBUILD_TESTING=1
|
||||
cd ..
|
||||
- name: Build
|
||||
run: |
|
||||
cd bin
|
||||
make -j 4 -k && make install
|
||||
- name: Unit tests
|
||||
run: |
|
||||
cd bin
|
||||
make test
|
||||
- name: Check executables
|
||||
run: |
|
||||
cd bin/check_install/bin
|
||||
./authserver --version
|
||||
./worldserver --version
|
||||
|
||||
AC-Eluna:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
repository: azerothcore/azerothcore-wotlk
|
||||
ref: 'master'
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: false
|
||||
repository: azerothcore/mod-eluna-lua-engine
|
||||
path: modules/mod-eluna-lua-engine
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
path: modules/mod-eluna-lua-engine/LuaEngine
|
||||
- name: Configure OS
|
||||
run: |
|
||||
# Copy paste of https://github.com/azerothcore/azerothcore-wotlk/blob/master/apps/ci/ci-install.sh
|
||||
|
||||
cat >>conf/config.sh <<CONFIG_SH
|
||||
MTHREADS=4
|
||||
CWARNINGS=ON
|
||||
CDEBUG=OFF
|
||||
CTYPE=Release
|
||||
CSCRIPTS=ON
|
||||
CUNIT_TESTS=ON
|
||||
CSERVERS=ON
|
||||
CTOOLS=ON
|
||||
CSCRIPTPCH=ON
|
||||
CCOREPCH=ON
|
||||
CCUSTOMOPTIONS='-DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror"'
|
||||
DB_CHARACTERS_CONF="MYSQL_USER='root'; MYSQL_PASS='root'; MYSQL_HOST='localhost';"
|
||||
DB_AUTH_CONF="MYSQL_USER='root'; MYSQL_PASS='root'; MYSQL_HOST='localhost';"
|
||||
DB_WORLD_CONF="MYSQL_USER='root'; MYSQL_PASS='root'; MYSQL_HOST='localhost';"
|
||||
CONFIG_SH
|
||||
|
||||
time sudo apt-get update -y
|
||||
# time sudo apt-get upgrade -y
|
||||
time sudo apt-get install -y git lsb-release sudo ccache
|
||||
time ./acore.sh install-deps
|
||||
|
||||
time sudo apt-get install -y clang-10
|
||||
echo "CCOMPILERC=\"clang-10\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"clang++-10\"" >> ./conf/config.sh
|
||||
- name: Import db
|
||||
run: source ./apps/ci/ci-import-db.sh
|
||||
- name: Build
|
||||
run: source ./apps/ci/ci-compile.sh
|
||||
- name: Dry run
|
||||
run: source ./apps/ci/ci-worldserver-dry-run.sh
|
||||
- name: Check startup errors
|
||||
run: source ./apps/ci/ci-error-check.sh
|
||||
|
||||
mangos-Eluna:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
eluna: [ON, OFF]
|
||||
patch: [zero, one, two]
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
repository: mangos${{ matrix.patch }}/server
|
||||
ref: master
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
path: src/modules/Eluna
|
||||
- name: Configure
|
||||
env:
|
||||
ELUNA: ${{ matrix.eluna }}
|
||||
run: |
|
||||
mkdir bin
|
||||
cd bin
|
||||
cmake .. -DELUNA=$ELUNA -DCMAKE_INSTALL_PREFIX=install -DSOAP=1 -DPLAYERBOTS=0 -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl/
|
||||
cd ..
|
||||
- name: Build
|
||||
run: |
|
||||
cd bin
|
||||
make -j4
|
||||
make install
|
||||
@@ -282,7 +282,7 @@ void Eluna::On_Reset(Creature* me) // Not an override, custom
|
||||
}
|
||||
|
||||
// Called when hit by a spell
|
||||
bool Eluna::SpellHit(Creature* me, Unit* caster, SpellInfo const* spell)
|
||||
bool Eluna::SpellHit(Creature* me, WorldObject* caster, SpellInfo const* spell)
|
||||
{
|
||||
START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_HIT_BY_SPELL, me, false);
|
||||
Push(me);
|
||||
@@ -292,7 +292,7 @@ bool Eluna::SpellHit(Creature* me, Unit* caster, SpellInfo const* spell)
|
||||
}
|
||||
|
||||
// Called when spell hits a target
|
||||
bool Eluna::SpellHitTarget(Creature* me, Unit* target, SpellInfo const* spell)
|
||||
bool Eluna::SpellHitTarget(Creature* me, WorldObject* target, SpellInfo const* spell)
|
||||
{
|
||||
START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_SPELL_HIT_TARGET, me, false);
|
||||
Push(me);
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace LuaCreature
|
||||
{
|
||||
uint32 quest_id = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
|
||||
#if defined TRINITY || AZEROTHCORE
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
Eluna::Push(L, creature->hasInvolvedQuest(quest_id));
|
||||
#else
|
||||
Eluna::Push(L, creature->HasInvolvedQuest(quest_id));
|
||||
@@ -105,7 +105,7 @@ namespace LuaCreature
|
||||
{
|
||||
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
|
||||
|
||||
#if defined TRINITY || AZEROTHCORE
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
Eluna::Push(L, creature->isTappedBy(player));
|
||||
#else
|
||||
Eluna::Push(L, creature->IsTappedBy(player));
|
||||
@@ -121,7 +121,7 @@ namespace LuaCreature
|
||||
*/
|
||||
int HasLootRecipient(lua_State* L, Creature* creature)
|
||||
{
|
||||
#if defined TRINITY || AZEROTHCORE
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
Eluna::Push(L, creature->hasLootRecipient());
|
||||
#else
|
||||
Eluna::Push(L, creature->HasLootRecipient());
|
||||
@@ -137,7 +137,7 @@ namespace LuaCreature
|
||||
*/
|
||||
int CanAggro(lua_State* L, Creature* creature)
|
||||
{
|
||||
#if defined TRINITY || AZEROTHCORE
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
Eluna::Push(L, !creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC));
|
||||
#else
|
||||
// Eluna::Push(L, creature->CanInitiateAttack());
|
||||
@@ -190,7 +190,7 @@ namespace LuaCreature
|
||||
*/
|
||||
int IsElite(lua_State* L, Creature* creature)
|
||||
{
|
||||
#if defined TRINITY || AZEROTHCORE
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
Eluna::Push(L, creature->isElite());
|
||||
#else
|
||||
Eluna::Push(L, creature->IsElite());
|
||||
@@ -242,7 +242,7 @@ namespace LuaCreature
|
||||
*/
|
||||
int IsWorldBoss(lua_State* L, Creature* creature)
|
||||
{
|
||||
#if defined TRINITY || AZEROTHCORE
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
Eluna::Push(L, creature->isWorldBoss());
|
||||
#else
|
||||
Eluna::Push(L, creature->IsWorldBoss());
|
||||
@@ -261,12 +261,12 @@ namespace LuaCreature
|
||||
{
|
||||
uint32 spell = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
|
||||
#if defined TRINITY
|
||||
#if defined(TRINITY)
|
||||
if (const SpellInfo* info = sSpellMgr->GetSpellInfo(spell))
|
||||
Eluna::Push(L, info->GetCategory() && creature->GetSpellHistory()->HasCooldown(spell));
|
||||
else
|
||||
Eluna::Push(L, false);
|
||||
#elif AZEROTHCORE
|
||||
#elif defined(AZEROTHCORE)
|
||||
if (const SpellInfo* info = sSpellMgr->GetSpellInfo(spell))
|
||||
Eluna::Push(L, info->GetCategory() && creature->HasSpellCooldown(spell));
|
||||
else
|
||||
@@ -303,7 +303,7 @@ namespace LuaCreature
|
||||
{
|
||||
uint32 questId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
|
||||
#if defined TRINITY || AZEROTHCORE
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
Eluna::Push(L, creature->hasQuest(questId));
|
||||
#else
|
||||
Eluna::Push(L, creature->HasQuest(questId));
|
||||
@@ -322,7 +322,7 @@ namespace LuaCreature
|
||||
{
|
||||
uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
|
||||
#ifdef TRINITY
|
||||
#if defined(TRINITY)
|
||||
Eluna::Push(L, creature->GetSpellHistory()->HasCooldown(spellId));
|
||||
#else
|
||||
Eluna::Push(L, creature->HasSpellCooldown(spellId));
|
||||
@@ -342,7 +342,7 @@ namespace LuaCreature
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined(TRINITY) || AZEROTHCORE
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
/**
|
||||
* Returns `true` if the [Creature] is an invisible trigger,
|
||||
* and returns `false` otherwise.
|
||||
@@ -423,7 +423,7 @@ namespace LuaCreature
|
||||
*/
|
||||
int GetWanderRadius(lua_State* L, Creature* creature)
|
||||
{
|
||||
#if defined TRINITY || AZEROTHCORE
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
Eluna::Push(L, creature->GetWanderDistance());
|
||||
#else
|
||||
Eluna::Push(L, creature->GetRespawnRadius());
|
||||
@@ -431,7 +431,7 @@ namespace LuaCreature
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined(TRINITY) || AZEROTHCORE
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
/**
|
||||
* Returns the current waypoint path ID of the [Creature].
|
||||
*
|
||||
@@ -451,9 +451,9 @@ namespace LuaCreature
|
||||
*/
|
||||
int GetCurrentWaypointId(lua_State* L, Creature* creature)
|
||||
{
|
||||
#ifdef TRINITY
|
||||
#if defined(TRINITY)
|
||||
Eluna::Push(L, creature->GetCurrentWaypointInfo().first);
|
||||
#elif AZEROTHCORE
|
||||
#elif defined(AZEROTHCORE)
|
||||
Eluna::Push(L, creature->GetCurrentWaypointID());
|
||||
#else
|
||||
Eluna::Push(L, creature->GetMotionMaster()->getLastReachedWaypoint());
|
||||
@@ -482,7 +482,7 @@ namespace LuaCreature
|
||||
{
|
||||
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
|
||||
|
||||
#if defined TRINITY || AZEROTHCORE
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
Eluna::Push(L, creature->GetAggroRange(target));
|
||||
#else
|
||||
float AttackDist = creature->GetAttackDistance(target);
|
||||
@@ -518,7 +518,7 @@ namespace LuaCreature
|
||||
*/
|
||||
int GetLootRecipientGroup(lua_State* L, Creature* creature)
|
||||
{
|
||||
#if defined TRINITY || AZEROTHCORE
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
Eluna::Push(L, creature->GetLootRecipientGroup());
|
||||
#else
|
||||
Eluna::Push(L, creature->GetGroupLootRecipient());
|
||||
@@ -591,12 +591,12 @@ namespace LuaCreature
|
||||
{
|
||||
uint32 spell = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
|
||||
#ifdef TRINITY
|
||||
#if defined(TRINITY)
|
||||
if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell))
|
||||
Eluna::Push(L, creature->GetSpellHistory()->GetRemainingCooldown(spellInfo));
|
||||
else
|
||||
Eluna::Push(L, 0);
|
||||
#elif AZEROTHCORE
|
||||
#elif defined(AZEROTHCORE)
|
||||
if (sSpellMgr->GetSpellInfo(spell))
|
||||
Eluna::Push(L, creature->GetSpellCooldown(spell));
|
||||
else
|
||||
@@ -630,7 +630,7 @@ namespace LuaCreature
|
||||
int GetHomePosition(lua_State* L, Creature* creature)
|
||||
{
|
||||
float x, y, z, o;
|
||||
#if defined TRINITY || AZEROTHCORE
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
creature->GetHomePosition(x, y, z, o);
|
||||
#else
|
||||
creature->GetRespawnCoord(x, y, z, &o);
|
||||
@@ -659,7 +659,7 @@ namespace LuaCreature
|
||||
float z = Eluna::CHECKVAL<float>(L, 4);
|
||||
float o = Eluna::CHECKVAL<float>(L, 5);
|
||||
|
||||
#if defined TRINITY || AZEROTHCORE
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
creature->SetHomePosition(x, y, z, o);
|
||||
#else
|
||||
creature->SetRespawnCoord(x, y, z, o);
|
||||
@@ -711,29 +711,30 @@ namespace LuaCreature
|
||||
float dist = Eluna::CHECKVAL<float>(L, 5, 0.0f);
|
||||
int32 aura = Eluna::CHECKVAL<int32>(L, 6, 0);
|
||||
|
||||
#ifdef CMANGOS
|
||||
#if defined(CMANGOS)
|
||||
ThreatList const& threatlist = creature->getThreatManager().getThreatList();
|
||||
#endif
|
||||
#ifdef MANGOS
|
||||
#elif defined(MANGOS)
|
||||
ThreatList const& threatlist = creature->GetThreatManager().getThreatList();
|
||||
#endif
|
||||
#ifdef TRINITY
|
||||
auto const& threatlist = creature->GetThreatManager().GetThreatenedByMeList();
|
||||
#endif
|
||||
#ifdef AZEROTHCORE
|
||||
#elif defined(TRINITY)
|
||||
auto const& threatlist = creature->GetThreatManager().GetSortedThreatList();
|
||||
#elif defined(AZEROTHCORE)
|
||||
auto const& threatlist = creature->getThreatManager().getThreatList();
|
||||
#endif
|
||||
|
||||
#ifndef TRINITY
|
||||
if (threatlist.empty())
|
||||
return 1;
|
||||
if (position >= threatlist.size())
|
||||
return 1;
|
||||
|
||||
#endif
|
||||
std::list<Unit*> targetList;
|
||||
#if defined(TRINITY)
|
||||
for (ThreatReference const* itr : threatlist)
|
||||
#else
|
||||
for (auto itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
||||
{
|
||||
#ifdef TRINITY
|
||||
Unit* target = itr->second->GetOwner();
|
||||
#endif
|
||||
{
|
||||
#if defined(TRINITY)
|
||||
Unit* target = itr->GetVictim();
|
||||
#else
|
||||
Unit* target = (*itr)->getTarget();
|
||||
#endif
|
||||
@@ -805,9 +806,9 @@ namespace LuaCreature
|
||||
*/
|
||||
int GetAITargets(lua_State* L, Creature* creature)
|
||||
{
|
||||
#ifdef TRINITY
|
||||
#if defined(TRINITY)
|
||||
auto const& threatlist = creature->GetThreatManager().GetThreatenedByMeList();
|
||||
#elif defined AZEROTHCORE
|
||||
#elif defined(AZEROTHCORE)
|
||||
auto const& threatlist = creature->getThreatManager().getThreatList();
|
||||
#else
|
||||
ThreatList const& threatlist = creature->GetThreatManager().getThreatList();
|
||||
@@ -817,7 +818,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
||||
uint32 i = 0;
|
||||
for (auto itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
||||
{
|
||||
#ifdef TRINITY
|
||||
#if defined(TRINITY)
|
||||
Unit* target = itr->second->GetOwner();
|
||||
#else
|
||||
Unit* target = (*itr)->getTarget();
|
||||
@@ -839,9 +840,9 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
||||
*/
|
||||
int GetAITargetsCount(lua_State* L, Creature* creature)
|
||||
{
|
||||
#ifdef TRINITY
|
||||
#if defined(TRINITY)
|
||||
Eluna::Push(L, creature->GetThreatManager().GetThreatenedByMeList().size());
|
||||
#elif AZEROTHCORE
|
||||
#elif defined(AZEROTHCORE)
|
||||
Eluna::Push(L, creature->getThreatManager().getThreatList().size());
|
||||
#else
|
||||
Eluna::Push(L, creature->GetThreatManager().getThreatList().size());
|
||||
@@ -876,7 +877,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(TRINITY) || AZEROTHCORE
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
int GetLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features
|
||||
{
|
||||
Eluna::Push(L, creature->GetLootMode());
|
||||
@@ -891,7 +892,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
||||
*/
|
||||
int GetDBTableGUIDLow(lua_State* L, Creature* creature)
|
||||
{
|
||||
#ifdef TRINITY
|
||||
#if defined(TRINITY)
|
||||
Eluna::Push(L, creature->GetSpawnId());
|
||||
#else
|
||||
// on mangos based this is same as lowguid
|
||||
@@ -923,7 +924,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
||||
{
|
||||
bool disable = Eluna::CHECKVAL<bool>(L, 2);
|
||||
|
||||
#if defined TRINITY || AZEROTHCORE
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
creature->SetDisableGravity(disable);
|
||||
#else
|
||||
creature->SetLevitate(disable);
|
||||
@@ -931,7 +932,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined TRINITY || AZEROTHCORE
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
int SetLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features
|
||||
{
|
||||
uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);
|
||||
@@ -950,7 +951,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
||||
{
|
||||
int32 state = Eluna::CHECKVAL<int32>(L, 2);
|
||||
|
||||
#if defined TRINITY || AZEROTHCORE
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
creature->setDeathState((DeathState)state);
|
||||
#else
|
||||
creature->SetDeathState((DeathState)state);
|
||||
@@ -984,7 +985,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
||||
uint32 off_hand = Eluna::CHECKVAL<uint32>(L, 3);
|
||||
uint32 ranged = Eluna::CHECKVAL<uint32>(L, 4);
|
||||
|
||||
#if defined TRINITY || AZEROTHCORE
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, main_hand);
|
||||
creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, off_hand);
|
||||
creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, ranged);
|
||||
@@ -1005,7 +1006,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
||||
{
|
||||
bool allow = Eluna::CHECKVAL<bool>(L, 2, true);
|
||||
|
||||
#if defined TRINITY || AZEROTHCORE
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
if (allow)
|
||||
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
|
||||
else
|
||||
@@ -1041,10 +1042,10 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
||||
*/
|
||||
int SetInCombatWithZone(lua_State* /*L*/, Creature* creature)
|
||||
{
|
||||
#if defined AZEROTHCORE
|
||||
#if defined(AZEROTHCORE)
|
||||
if (creature->IsAIEnabled)
|
||||
creature->AI()->DoZoneInCombat();
|
||||
#elif defined TRINITY
|
||||
#elif defined(TRINITY)
|
||||
if (creature->IsAIEnabled())
|
||||
creature->AI()->DoZoneInCombat();
|
||||
#else
|
||||
@@ -1062,7 +1063,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
||||
{
|
||||
float dist = Eluna::CHECKVAL<float>(L, 2);
|
||||
|
||||
#if defined TRINITY || AZEROTHCORE
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
creature->SetWanderDistance(dist);
|
||||
#else
|
||||
creature->SetRespawnRadius(dist);
|
||||
@@ -1131,7 +1132,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
||||
{
|
||||
bool enable = Eluna::CHECKVAL<bool>(L, 2, true);
|
||||
|
||||
#if defined TRINITY || AZEROTHCORE
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
creature->SetHover(enable);
|
||||
#else
|
||||
// Copy paste from Aura::HandleAuraHover
|
||||
@@ -1143,7 +1144,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
||||
data.Initialize(SMSG_MOVE_UNSET_HOVER, 8 + 4);
|
||||
data << creature->GetPackGUID();
|
||||
data << uint32(0);
|
||||
#ifdef CMANGOS
|
||||
#if defined(CMANGOS)
|
||||
creature->SendMessageToSet(data, true);
|
||||
#else
|
||||
creature->SendMessageToSet(&data, true);
|
||||
@@ -1161,7 +1162,9 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
||||
{
|
||||
uint32 msTimeToDespawn = Eluna::CHECKVAL<uint32>(L, 2, 0);
|
||||
|
||||
#if defined TRINITY || AZEROTHCORE
|
||||
#if defined(TRINITY)
|
||||
creature->DespawnOrUnsummon(Milliseconds(msTimeToDespawn));
|
||||
#elif defined(AZEROTHCORE)
|
||||
creature->DespawnOrUnsummon(msTimeToDespawn);
|
||||
#else
|
||||
creature->ForcedDespawn(msTimeToDespawn);
|
||||
@@ -1192,7 +1195,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
||||
*/
|
||||
int MoveWaypoint(lua_State* /*L*/, Creature* creature)
|
||||
{
|
||||
#if defined TRINITY || AZEROTHCORE
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
creature->GetMotionMaster()->MovePath(creature->GetWaypointPath(), true);
|
||||
#else
|
||||
creature->GetMotionMaster()->MoveWaypoint();
|
||||
@@ -1260,7 +1263,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
||||
*/
|
||||
int SelectVictim(lua_State* L, Creature* creature)
|
||||
{
|
||||
#if defined TRINITY || AZEROTHCORE
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
Eluna::Push(L, creature->SelectVictim());
|
||||
#else
|
||||
Eluna::Push(L, creature->SelectHostileTarget());
|
||||
@@ -1279,7 +1282,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
||||
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
uint32 dataGuidLow = Eluna::CHECKVAL<uint32>(L, 3, 0);
|
||||
|
||||
#if defined TRINITY || AZEROTHCORE
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
creature->UpdateEntry(entry, dataGuidLow ? eObjectMgr->GetCreatureData(dataGuidLow) : NULL);
|
||||
#else
|
||||
creature->UpdateEntry(entry, ALLIANCE, dataGuidLow ? eObjectMgr->GetCreatureData(dataGuidLow) : NULL);
|
||||
@@ -1287,7 +1290,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined TRINITY || AZEROTHCORE
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
/**
|
||||
* Resets [Creature]'s loot mode to default
|
||||
*/
|
||||
@@ -1382,7 +1385,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
||||
{
|
||||
uint32 entry = creature->GetEntry();
|
||||
|
||||
#if defined TRINITY || AZEROTHCORE
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(entry);
|
||||
if (cInfo)
|
||||
Eluna::Push(L, cInfo->family);
|
||||
|
||||
@@ -216,14 +216,22 @@ struct ElunaCreatureAI : ScriptedAI
|
||||
}
|
||||
|
||||
// Called when hit by a spell
|
||||
#if defined TRINITY
|
||||
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
|
||||
#else
|
||||
void SpellHit(Unit* caster, SpellInfo const* spell) override
|
||||
#endif
|
||||
{
|
||||
if (!sEluna->SpellHit(me, caster, spell))
|
||||
ScriptedAI::SpellHit(caster, spell);
|
||||
}
|
||||
|
||||
// Called when spell hits a target
|
||||
#if defined TRINITY
|
||||
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
|
||||
#else
|
||||
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
|
||||
#endif
|
||||
{
|
||||
if (!sEluna->SpellHitTarget(me, target, spell))
|
||||
ScriptedAI::SpellHitTarget(target, spell);
|
||||
|
||||
@@ -42,8 +42,6 @@
|
||||
#if defined TRINITY
|
||||
#include "GitRevision.h"
|
||||
#include "SpellHistory.h"
|
||||
#include <boost/thread/locks.hpp>
|
||||
#include <boost/thread/shared_mutex.hpp>
|
||||
#endif
|
||||
|
||||
#if defined TRINITY || defined AZEROTHCORE
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "lmarshal.h"
|
||||
|
||||
|
||||
#ifndef TRINITY
|
||||
void ElunaInstanceAI::Initialize()
|
||||
{
|
||||
LOCK_ELUNA;
|
||||
@@ -22,6 +23,7 @@ void ElunaInstanceAI::Initialize()
|
||||
|
||||
sEluna->OnInitialize(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
void ElunaInstanceAI::Load(const char* data)
|
||||
{
|
||||
@@ -82,7 +84,9 @@ void ElunaInstanceAI::Load(const char* data)
|
||||
lua_pop(L, 1);
|
||||
// Stack: (empty)
|
||||
|
||||
#ifndef TRINITY
|
||||
Initialize();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -92,7 +96,9 @@ void ElunaInstanceAI::Load(const char* data)
|
||||
lua_pop(L, 1);
|
||||
// Stack: (empty)
|
||||
|
||||
#ifndef TRINITY
|
||||
Initialize();
|
||||
#endif
|
||||
}
|
||||
|
||||
delete[] decodedData;
|
||||
@@ -100,7 +106,10 @@ void ElunaInstanceAI::Load(const char* data)
|
||||
else
|
||||
{
|
||||
ELUNA_LOG_ERROR("Error while decoding instance data: Data is not valid base-64");
|
||||
|
||||
#ifndef TRINITY
|
||||
Initialize();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,9 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
#ifndef TRINITY
|
||||
void Initialize() override;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* These are responsible for serializing/deserializing the instance's
|
||||
|
||||
@@ -51,6 +51,24 @@ namespace LuaGlobalFunctions
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns emulator .conf RealmID
|
||||
*
|
||||
* - for MaNGOS returns the realmID as it is stored in the core.
|
||||
* - for TrinityCore returns the realmID as it is in the conf file.
|
||||
* @return uint32 realm ID
|
||||
*/
|
||||
|
||||
int GetRealmID(lua_State* L)
|
||||
{
|
||||
#ifdef MANGOS
|
||||
Eluna::Push(L, realmID);
|
||||
#else
|
||||
Eluna::Push(L, sConfigMgr->GetIntDefault("RealmID", 1));
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns emulator version
|
||||
*
|
||||
@@ -181,7 +199,7 @@ namespace LuaGlobalFunctions
|
||||
#else
|
||||
{
|
||||
#ifdef TRINITY
|
||||
boost::shared_lock<boost::shared_mutex> lock(*HashMapHolder<Player>::GetLock());
|
||||
std::shared_lock<std::shared_mutex> lock(*HashMapHolder<Player>::GetLock());
|
||||
#elif defined(AZEROTHCORE)
|
||||
ACORE_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock());
|
||||
#else
|
||||
@@ -477,7 +495,11 @@ namespace LuaGlobalFunctions
|
||||
if (!areaEntry)
|
||||
return luaL_argerror(L, 1, "valid Area or Zone ID expected");
|
||||
|
||||
#if defined(TRINITY)
|
||||
Eluna::Push(L, areaEntry->AreaName[locale]);
|
||||
#else
|
||||
Eluna::Push(L, areaEntry->area_name[locale]);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1029,7 +1051,7 @@ namespace LuaGlobalFunctions
|
||||
* CREATURE_EVENT_ON_REACH_WP = 6, // (event, creature, type, id) - Can return true to stop normal action
|
||||
* CREATURE_EVENT_ON_AIUPDATE = 7, // (event, creature, diff) - Can return true to stop normal action
|
||||
* CREATURE_EVENT_ON_RECEIVE_EMOTE = 8, // (event, creature, player, emoteid) - Can return true to stop normal action
|
||||
* CREATURE_EVENT_ON_DAMAGE_TAKEN = 9, // (event, creature, attacker, damage) - Can return new damage
|
||||
* CREATURE_EVENT_ON_DAMAGE_TAKEN = 9, // (event, creature, attacker, damage) - Can return true to stop normal action, can return new damage as second return value.
|
||||
* CREATURE_EVENT_ON_PRE_COMBAT = 10, // (event, creature, target) - Can return true to stop normal action
|
||||
* // UNUSED
|
||||
* CREATURE_EVENT_ON_OWNER_ATTACKED = 12, // (event, creature, target) - Can return true to stop normal action // Not on mangos
|
||||
@@ -1046,7 +1068,7 @@ namespace LuaGlobalFunctions
|
||||
* CREATURE_EVENT_ON_RESET = 23, // (event, creature)
|
||||
* CREATURE_EVENT_ON_REACH_HOME = 24, // (event, creature) - Can return true to stop normal action
|
||||
* // UNUSED = 25, // (event, creature)
|
||||
* CREATURE_EVENT_ON_CORPSE_REMOVED = 26, // (event, creature, respawndelay) - Can return true, newRespawnDelay
|
||||
* CREATURE_EVENT_ON_CORPSE_REMOVED = 26, // (event, creature, respawndelay) - Can return true to stop normal action, can return new respawndelay as second return value
|
||||
* CREATURE_EVENT_ON_MOVE_IN_LOS = 27, // (event, creature, unit) - Can return true to stop normal action. Does not actually check LOS, just uses the sight range
|
||||
* // UNUSED = 28, // (event, creature)
|
||||
* // UNUSED = 29, // (event, creature)
|
||||
@@ -1091,7 +1113,7 @@ namespace LuaGlobalFunctions
|
||||
* CREATURE_EVENT_ON_REACH_WP = 6, // (event, creature, type, id) - Can return true to stop normal action
|
||||
* CREATURE_EVENT_ON_AIUPDATE = 7, // (event, creature, diff) - Can return true to stop normal action
|
||||
* CREATURE_EVENT_ON_RECEIVE_EMOTE = 8, // (event, creature, player, emoteid) - Can return true to stop normal action
|
||||
* CREATURE_EVENT_ON_DAMAGE_TAKEN = 9, // (event, creature, attacker, damage) - Can return new damage
|
||||
* CREATURE_EVENT_ON_DAMAGE_TAKEN = 9, // (event, creature, attacker, damage) - Can return true to stop normal action, can return new damage as second return value.
|
||||
* CREATURE_EVENT_ON_PRE_COMBAT = 10, // (event, creature, target) - Can return true to stop normal action
|
||||
* // UNUSED
|
||||
* CREATURE_EVENT_ON_OWNER_ATTACKED = 12, // (event, creature, target) - Can return true to stop normal action // Not on mangos
|
||||
@@ -1108,7 +1130,7 @@ namespace LuaGlobalFunctions
|
||||
* CREATURE_EVENT_ON_RESET = 23, // (event, creature)
|
||||
* CREATURE_EVENT_ON_REACH_HOME = 24, // (event, creature) - Can return true to stop normal action
|
||||
* // UNUSED = 25, // (event, creature)
|
||||
* CREATURE_EVENT_ON_CORPSE_REMOVED = 26, // (event, creature, respawndelay) - Can return true, newRespawnDelay
|
||||
* CREATURE_EVENT_ON_CORPSE_REMOVED = 26, // (event, creature, respawndelay) - Can return true to stop normal action, can return new respawndelay as second return value
|
||||
* CREATURE_EVENT_ON_MOVE_IN_LOS = 27, // (event, creature, unit) - Can return true to stop normal action. Does not actually check LOS, just uses the sight range
|
||||
* // UNUSED = 28, // (event, creature)
|
||||
* // UNUSED = 29, // (event, creature)
|
||||
@@ -1148,9 +1170,9 @@ namespace LuaGlobalFunctions
|
||||
* {
|
||||
* GAMEOBJECT_EVENT_ON_AIUPDATE = 1, // (event, go, diff)
|
||||
* GAMEOBJECT_EVENT_ON_SPAWN = 2, // (event, go)
|
||||
* GAMEOBJECT_EVENT_ON_DUMMY_EFFECT = 3, // (event, caster, spellid, effindex, go)
|
||||
* GAMEOBJECT_EVENT_ON_QUEST_ACCEPT = 4, // (event, player, go, quest) - Can return true
|
||||
* GAMEOBJECT_EVENT_ON_QUEST_REWARD = 5, // (event, player, go, quest, opt) - Can return true
|
||||
* GAMEOBJECT_EVENT_ON_DUMMY_EFFECT = 3, // (event, caster, spellid, effindex, go) - Can return true to stop normal action
|
||||
* GAMEOBJECT_EVENT_ON_QUEST_ACCEPT = 4, // (event, player, go, quest) - Can return true to stop normal action
|
||||
* GAMEOBJECT_EVENT_ON_QUEST_REWARD = 5, // (event, player, go, quest, opt) - Can return true to stop normal action
|
||||
* GAMEOBJECT_EVENT_ON_DIALOG_STATUS = 6, // (event, player, go)
|
||||
* GAMEOBJECT_EVENT_ON_DESTROYED = 7, // (event, go, attacker)
|
||||
* GAMEOBJECT_EVENT_ON_DAMAGED = 8, // (event, go, attacker)
|
||||
@@ -1159,7 +1181,7 @@ namespace LuaGlobalFunctions
|
||||
* // UNUSED = 11, // (event, gameobject)
|
||||
* GAMEOBJECT_EVENT_ON_ADD = 12, // (event, gameobject)
|
||||
* GAMEOBJECT_EVENT_ON_REMOVE = 13, // (event, gameobject)
|
||||
* GAMEOBJECT_EVENT_ON_USE = 14, // (event, go, player)
|
||||
* GAMEOBJECT_EVENT_ON_USE = 14, // (event, go, player) - Can return true to stop normal action
|
||||
* GAMEOBJECT_EVENT_COUNT
|
||||
* };
|
||||
* </pre>
|
||||
@@ -2302,10 +2324,10 @@ namespace LuaGlobalFunctions
|
||||
TaxiPathNodeEntry entry;
|
||||
#ifdef TRINITY
|
||||
// mandatory
|
||||
entry.MapID = Eluna::CHECKVAL<uint32>(L, start);
|
||||
entry.LocX = Eluna::CHECKVAL<float>(L, start + 1);
|
||||
entry.LocY = Eluna::CHECKVAL<float>(L, start + 2);
|
||||
entry.LocZ = Eluna::CHECKVAL<float>(L, start + 3);
|
||||
entry.ContinentID = Eluna::CHECKVAL<uint32>(L, start);
|
||||
entry.Loc.X = Eluna::CHECKVAL<float>(L, start + 1);
|
||||
entry.Loc.Y = Eluna::CHECKVAL<float>(L, start + 2);
|
||||
entry.Loc.Z = Eluna::CHECKVAL<float>(L, start + 3);
|
||||
// optional
|
||||
entry.Flags = Eluna::CHECKVAL<uint32>(L, start + 4, 0);
|
||||
entry.Delay = Eluna::CHECKVAL<uint32>(L, start + 5, 0);
|
||||
@@ -2353,10 +2375,10 @@ namespace LuaGlobalFunctions
|
||||
entry.PathID = pathId;
|
||||
entry.NodeIndex = nodeId;
|
||||
nodeEntry->ID = index;
|
||||
nodeEntry->map_id = entry.MapID;
|
||||
nodeEntry->x = entry.LocX;
|
||||
nodeEntry->y = entry.LocY;
|
||||
nodeEntry->z = entry.LocZ;
|
||||
nodeEntry->ContinentID = entry.ContinentID;
|
||||
nodeEntry->Pos.X = entry.Loc.X;
|
||||
nodeEntry->Pos.Y = entry.Loc.Y;
|
||||
nodeEntry->Pos.Z = entry.Loc.Z;
|
||||
nodeEntry->MountCreatureID[0] = mountH;
|
||||
nodeEntry->MountCreatureID[1] = mountA;
|
||||
sTaxiNodesStore.SetEntry(nodeId++, nodeEntry);
|
||||
@@ -2383,10 +2405,16 @@ namespace LuaGlobalFunctions
|
||||
return 1;
|
||||
sTaxiPathSetBySource[startNode][nodeId - 1] = TaxiPathBySourceAndDestination(pathId, price);
|
||||
TaxiPathEntry* pathEntry = new TaxiPathEntry();
|
||||
#ifdef TRINITY
|
||||
pathEntry->FromTaxiNode = startNode;
|
||||
pathEntry->ToTaxiNode = nodeId - 1;
|
||||
pathEntry->Cost = price;
|
||||
#else
|
||||
pathEntry->from = startNode;
|
||||
pathEntry->to = nodeId - 1;
|
||||
pathEntry->ID = pathId;
|
||||
pathEntry->price = price;
|
||||
#endif
|
||||
pathEntry->ID = pathId;
|
||||
sTaxiPathStore.SetEntry(pathId, pathEntry);
|
||||
Eluna::Push(L, pathId);
|
||||
return 1;
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace LuaGuild
|
||||
#else
|
||||
{
|
||||
#ifdef TRINITY
|
||||
boost::shared_lock<boost::shared_mutex> lock(*HashMapHolder<Player>::GetLock());
|
||||
std::shared_lock<std::shared_mutex> lock(*HashMapHolder<Player>::GetLock());
|
||||
#elif defined(AZEROTHCORE)
|
||||
ACORE_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock());
|
||||
#else
|
||||
|
||||
12
Hooks.h
12
Hooks.h
@@ -261,7 +261,7 @@ namespace Hooks
|
||||
CREATURE_EVENT_ON_REACH_WP = 6, // (event, creature, type, id) - Can return true to stop normal action
|
||||
CREATURE_EVENT_ON_AIUPDATE = 7, // (event, creature, diff) - Can return true to stop normal action
|
||||
CREATURE_EVENT_ON_RECEIVE_EMOTE = 8, // (event, creature, player, emoteid) - Can return true to stop normal action
|
||||
CREATURE_EVENT_ON_DAMAGE_TAKEN = 9, // (event, creature, attacker, damage) - Can return new damage
|
||||
CREATURE_EVENT_ON_DAMAGE_TAKEN = 9, // (event, creature, attacker, damage) - Can return true to stop normal action, can return new damage as second return value.
|
||||
CREATURE_EVENT_ON_PRE_COMBAT = 10, // (event, creature, target) - Can return true to stop normal action
|
||||
// UNUSED
|
||||
CREATURE_EVENT_ON_OWNER_ATTACKED = 12, // (event, creature, target) - Can return true to stop normal action // Not on mangos
|
||||
@@ -278,7 +278,7 @@ namespace Hooks
|
||||
CREATURE_EVENT_ON_RESET = 23, // (event, creature)
|
||||
CREATURE_EVENT_ON_REACH_HOME = 24, // (event, creature) - Can return true to stop normal action
|
||||
// UNUSED = 25, // (event, creature)
|
||||
CREATURE_EVENT_ON_CORPSE_REMOVED = 26, // (event, creature, respawndelay) - Can return true, newRespawnDelay
|
||||
CREATURE_EVENT_ON_CORPSE_REMOVED = 26, // (event, creature, respawndelay) - Can return true to stop normal action, can return new respawndelay as second return value
|
||||
CREATURE_EVENT_ON_MOVE_IN_LOS = 27, // (event, creature, unit) - Can return true to stop normal action. Does not actually check LOS, just uses the sight range
|
||||
// UNUSED = 28, // (event, creature)
|
||||
// UNUSED = 29, // (event, creature)
|
||||
@@ -297,9 +297,9 @@ namespace Hooks
|
||||
{
|
||||
GAMEOBJECT_EVENT_ON_AIUPDATE = 1, // (event, go, diff)
|
||||
GAMEOBJECT_EVENT_ON_SPAWN = 2, // (event, go)
|
||||
GAMEOBJECT_EVENT_ON_DUMMY_EFFECT = 3, // (event, caster, spellid, effindex, go)
|
||||
GAMEOBJECT_EVENT_ON_QUEST_ACCEPT = 4, // (event, player, go, quest) - Can return true
|
||||
GAMEOBJECT_EVENT_ON_QUEST_REWARD = 5, // (event, player, go, quest, opt) - Can return true
|
||||
GAMEOBJECT_EVENT_ON_DUMMY_EFFECT = 3, // (event, caster, spellid, effindex, go) - Can return true to stop normal action
|
||||
GAMEOBJECT_EVENT_ON_QUEST_ACCEPT = 4, // (event, player, go, quest) - Can return true to stop normal action
|
||||
GAMEOBJECT_EVENT_ON_QUEST_REWARD = 5, // (event, player, go, quest, opt) - Can return true to stop normal action
|
||||
GAMEOBJECT_EVENT_ON_DIALOG_STATUS = 6, // (event, player, go)
|
||||
GAMEOBJECT_EVENT_ON_DESTROYED = 7, // (event, go, attacker)
|
||||
GAMEOBJECT_EVENT_ON_DAMAGED = 8, // (event, go, attacker)
|
||||
@@ -308,7 +308,7 @@ namespace Hooks
|
||||
// UNUSED = 11, // (event, gameobject)
|
||||
GAMEOBJECT_EVENT_ON_ADD = 12, // (event, gameobject)
|
||||
GAMEOBJECT_EVENT_ON_REMOVE = 13, // (event, gameobject)
|
||||
GAMEOBJECT_EVENT_ON_USE = 14, // (event, go, player)
|
||||
GAMEOBJECT_EVENT_ON_USE = 14, // (event, go, player) - Can return true to stop normal action
|
||||
GAMEOBJECT_EVENT_COUNT
|
||||
};
|
||||
|
||||
|
||||
@@ -273,25 +273,41 @@ namespace LuaItem
|
||||
{
|
||||
#if defined(CATA) || defined (MISTS)
|
||||
char* suffix = NULL;
|
||||
#else
|
||||
#ifdef TRINITY
|
||||
std::array<char const*, 16> const* suffix = NULL;
|
||||
#else
|
||||
char* const* suffix = NULL;
|
||||
#endif
|
||||
#endif
|
||||
if (itemRandPropId < 0)
|
||||
{
|
||||
const ItemRandomSuffixEntry* itemRandEntry = sItemRandomSuffixStore.LookupEntry(-item->GetItemRandomPropertyId());
|
||||
if (itemRandEntry)
|
||||
#ifdef TRINITY
|
||||
suffix = &itemRandEntry->Name;
|
||||
#else
|
||||
suffix = itemRandEntry->nameSuffix;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
const ItemRandomPropertiesEntry* itemRandEntry = sItemRandomPropertiesStore.LookupEntry(item->GetItemRandomPropertyId());
|
||||
if (itemRandEntry)
|
||||
#ifdef TRINITY
|
||||
suffix = &itemRandEntry->Name;
|
||||
#else
|
||||
suffix = itemRandEntry->nameSuffix;
|
||||
#endif
|
||||
}
|
||||
if (suffix)
|
||||
{
|
||||
name += ' ';
|
||||
#if defined TRINITY
|
||||
name += (*suffix)[(name != temp->Name1) ? locale : uint8(DEFAULT_LOCALE)];
|
||||
#else
|
||||
name += suffix[(name != temp->Name1) ? locale : uint8(DEFAULT_LOCALE)];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -393,8 +393,8 @@ public:
|
||||
bool ReceiveEmote(Creature* me, Player* player, uint32 emoteId);
|
||||
bool CorpseRemoved(Creature* me, uint32& respawnDelay);
|
||||
bool MoveInLineOfSight(Creature* me, Unit* who);
|
||||
bool SpellHit(Creature* me, Unit* caster, SpellInfo const* spell);
|
||||
bool SpellHitTarget(Creature* me, Unit* target, SpellInfo const* spell);
|
||||
bool SpellHit(Creature* me, WorldObject* caster, SpellInfo const* spell);
|
||||
bool SpellHitTarget(Creature* me, WorldObject* target, SpellInfo const* spell);
|
||||
bool SummonedCreatureDies(Creature* me, Creature* summon, Unit* killer);
|
||||
bool OwnerAttackedBy(Creature* me, Unit* attacker);
|
||||
bool OwnerAttacked(Creature* me, Unit* target);
|
||||
|
||||
@@ -77,6 +77,7 @@ luaL_Reg GlobalMethods[] =
|
||||
// Getters
|
||||
{ "GetLuaEngine", &LuaGlobalFunctions::GetLuaEngine },
|
||||
{ "GetCoreName", &LuaGlobalFunctions::GetCoreName },
|
||||
{ "GetRealmID", &LuaGlobalFunctions::GetRealmID },
|
||||
{ "GetCoreVersion", &LuaGlobalFunctions::GetCoreVersion },
|
||||
{ "GetCoreExpansion", &LuaGlobalFunctions::GetCoreExpansion },
|
||||
{ "GetQuest", &LuaGlobalFunctions::GetQuest },
|
||||
@@ -399,7 +400,7 @@ ElunaRegister<Unit> UnitMethods[] =
|
||||
{ "StopSpellCast", &LuaUnit::StopSpellCast },
|
||||
{ "InterruptSpell", &LuaUnit::InterruptSpell },
|
||||
{ "SendChatMessageToPlayer", &LuaUnit::SendChatMessageToPlayer },
|
||||
{ "Emote", &LuaUnit::Emote },
|
||||
{ "PerformEmote", &LuaUnit::PerformEmote },
|
||||
{ "EmoteState", &LuaUnit::EmoteState },
|
||||
{ "CountPctFromCurHealth", &LuaUnit::CountPctFromCurHealth },
|
||||
{ "CountPctFromMaxHealth", &LuaUnit::CountPctFromMaxHealth },
|
||||
@@ -600,6 +601,9 @@ ElunaRegister<Player> PlayerMethods[] =
|
||||
// {"HasPendingBind", &LuaPlayer::HasPendingBind}, // :HasPendingBind() - UNDOCUMENTED - Returns true if the player has a pending instance bind
|
||||
#if (!defined(TBC) && !defined(CLASSIC))
|
||||
{ "HasAchieved", &LuaPlayer::HasAchieved },
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
{ "SetAchievement", &LuaPlayer::SetAchievement },
|
||||
#endif
|
||||
#endif
|
||||
{ "CanUninviteFromGroup", &LuaPlayer::CanUninviteFromGroup },
|
||||
{ "IsRested", &LuaPlayer::IsRested },
|
||||
|
||||
@@ -182,6 +182,7 @@ namespace LuaMap
|
||||
* @param float x
|
||||
* @param float y
|
||||
* @param float z
|
||||
* @param uint32 phasemask = PHASEMASK_NORMAL
|
||||
* @return uint32 areaId
|
||||
*/
|
||||
int GetAreaId(lua_State* L, Map* map)
|
||||
@@ -189,8 +190,11 @@ namespace LuaMap
|
||||
float x = Eluna::CHECKVAL<float>(L, 2);
|
||||
float y = Eluna::CHECKVAL<float>(L, 3);
|
||||
float z = Eluna::CHECKVAL<float>(L, 4);
|
||||
#if defined TRINITY
|
||||
float phasemask = Eluna::CHECKVAL<uint32>(L, 5, PHASEMASK_NORMAL);
|
||||
|
||||
#if defined TRINITY || AZEROTHCORE
|
||||
Eluna::Push(L, map->GetAreaId(phasemask, x, y, z));
|
||||
#elif defined AZEROTHCORE
|
||||
Eluna::Push(L, map->GetAreaId(x, y, z));
|
||||
#else
|
||||
Eluna::Push(L, map->GetTerrain()->GetAreaId(x, y, z));
|
||||
|
||||
@@ -2057,6 +2057,24 @@ namespace LuaPlayer
|
||||
player->SetTitle(t, false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
/**
|
||||
* Adds the specified achievement to the [Player]s
|
||||
*
|
||||
* @param uint32 achievementid
|
||||
*/
|
||||
int SetAchievement(lua_State* L, Player* player)
|
||||
{
|
||||
uint32 id = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
AchievementEntry const* t = sAchievementStore.LookupEntry(id);
|
||||
if (t)
|
||||
player->CompletedAchievement(t);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined TRINITY && !AZEROTHCORE
|
||||
@@ -2262,10 +2280,11 @@ namespace LuaPlayer
|
||||
WorldPacket data(MSG_AUCTION_HELLO, 12);
|
||||
#ifdef TRINITY
|
||||
data << uint64(unit->GetGUID().GetCounter());
|
||||
data << uint32(ahEntry->ID);
|
||||
#else
|
||||
data << uint64(unit->GetGUIDLow());
|
||||
#endif
|
||||
data << uint32(ahEntry->houseId);
|
||||
#endif
|
||||
data << uint8(1);
|
||||
#ifdef CMANGOS
|
||||
player->GetSession()->SendPacket(data);
|
||||
@@ -3312,11 +3331,19 @@ namespace LuaPlayer
|
||||
{
|
||||
if (SkillLineEntry const* entry = sSkillLineStore.LookupEntry(i))
|
||||
{
|
||||
#ifdef TRINITY
|
||||
if (entry->CategoryID == SKILL_CATEGORY_LANGUAGES || entry->CategoryID == SKILL_CATEGORY_GENERIC)
|
||||
continue;
|
||||
|
||||
if (player->HasSkill(entry->ID))
|
||||
player->UpdateSkill(entry->ID, step);
|
||||
#else
|
||||
if (entry->categoryId == SKILL_CATEGORY_LANGUAGES || entry->categoryId == SKILL_CATEGORY_GENERIC)
|
||||
continue;
|
||||
|
||||
if (player->HasSkill(entry->id))
|
||||
player->UpdateSkill(entry->id, step);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -116,10 +116,13 @@ bool Eluna::OnAreaTrigger(Player* pPlayer, AreaTriggerEntry const* pTrigger)
|
||||
{
|
||||
START_HOOK_WITH_RETVAL(TRIGGER_EVENT_ON_TRIGGER, false);
|
||||
Push(pPlayer);
|
||||
#ifndef AZEROTHCORE
|
||||
Push(pTrigger->id);
|
||||
#else
|
||||
#ifdef TRINITY
|
||||
Push(pTrigger->ID);
|
||||
#elif AZEROTHCORE
|
||||
Push(pTrigger->entry);
|
||||
#else
|
||||
Push(pTrigger->id);
|
||||
|
||||
#endif
|
||||
return CallAllFunctionsBool(ServerEventBindings, key);
|
||||
}
|
||||
|
||||
@@ -1163,7 +1163,11 @@ namespace LuaUnit
|
||||
if (!entry)
|
||||
return 1;
|
||||
|
||||
#ifdef TRINITY
|
||||
Eluna::Push(L, entry->Name[locale]);
|
||||
#else
|
||||
Eluna::Push(L, entry->name[locale]);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1202,7 +1206,11 @@ namespace LuaUnit
|
||||
if (!entry)
|
||||
return 1;
|
||||
|
||||
#ifdef TRINITY
|
||||
Eluna::Push(L, entry->Name[locale]);
|
||||
#else
|
||||
Eluna::Push(L, entry->name[locale]);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1563,10 +1571,7 @@ namespace LuaUnit
|
||||
uint8 newlevel = Eluna::CHECKVAL<uint8>(L, 2);
|
||||
|
||||
if (newlevel < 1)
|
||||
return 0;
|
||||
|
||||
if (newlevel > STRONG_MAX_LEVEL)
|
||||
newlevel = STRONG_MAX_LEVEL;
|
||||
return luaL_argerror(L, 2, "level cannot be below 1");
|
||||
|
||||
if (Player* player = unit->ToPlayer())
|
||||
{
|
||||
@@ -2033,9 +2038,14 @@ namespace LuaUnit
|
||||
*
|
||||
* @param uint32 emoteId
|
||||
*/
|
||||
int Emote(lua_State* L, Unit* unit)
|
||||
int PerformEmote(lua_State* L, Unit* unit)
|
||||
{
|
||||
#ifdef TRINITY
|
||||
Emote emote = static_cast<Emote>(Eluna::CHECKVAL<uint32>(L, 2));
|
||||
unit->HandleEmoteCommand(emote);
|
||||
#else
|
||||
unit->HandleEmoteCommand(Eluna::CHECKVAL<uint32>(L, 2));
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,9 @@ namespace LuaVehicle
|
||||
*/
|
||||
int GetEntry(lua_State* L, Vehicle* vehicle)
|
||||
{
|
||||
#if defined TRINITY || AZEROTHCORE
|
||||
#ifdef TRINITY
|
||||
Eluna::Push(L, vehicle->GetVehicleInfo()->ID);
|
||||
#elif AZEROTHCORE
|
||||
Eluna::Push(L, vehicle->GetVehicleInfo()->m_ID);
|
||||
#else
|
||||
Eluna::Push(L, vehicle->GetVehicleEntry()->m_ID);
|
||||
|
||||
@@ -717,7 +717,7 @@ namespace LuaWorldObject
|
||||
uint32 respawnDelay = Eluna::CHECKVAL<uint32>(L, 7, 30);
|
||||
#ifdef TRINITY
|
||||
QuaternionData rot = QuaternionData::fromEulerAnglesZYX(o, 0.f, 0.f);
|
||||
Eluna::Push(L, obj->SummonGameObject(entry, Position(x, y, z, o), rot, respawnDelay));
|
||||
Eluna::Push(L, obj->SummonGameObject(entry, Position(x, y, z, o), rot, Seconds(respawnDelay)));
|
||||
#elif AZEROTHCORE
|
||||
Eluna::Push(L, obj->SummonGameObject(entry, x, y, z, o, 0, 0, 0, 0, respawnDelay));
|
||||
#else
|
||||
@@ -808,7 +808,11 @@ namespace LuaWorldObject
|
||||
default:
|
||||
return luaL_argerror(L, 7, "valid SpawnType expected");
|
||||
}
|
||||
#ifdef TRINITY
|
||||
Eluna::Push(L, obj->SummonCreature(entry, x, y, z, o, type, Seconds(despawnTimer)));
|
||||
#else
|
||||
Eluna::Push(L, obj->SummonCreature(entry, x, y, z, o, type, despawnTimer));
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user