mirror of
https://github.com/araxiaonline/mod-eluna.git
synced 2026-06-13 03:02:27 -04:00
Compare commits
8 Commits
master
...
araxia-mai
| Author | SHA1 | Date | |
|---|---|---|---|
| 27ed296419 | |||
| 2947c06a7b | |||
| fa9b7987d2 | |||
| aedb410aa8 | |||
| 9f1f4c88b5 | |||
| 91f9b34836 | |||
| fc951497db | |||
| a0096036ac |
24
.github/workflows/build-release.yml
vendored
Normal file
24
.github/workflows/build-release.yml
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
name: Build And Release
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'araxia-main'
|
||||
pull_request:
|
||||
branches:
|
||||
- 'araxia-main'
|
||||
- 'master'
|
||||
jobs:
|
||||
build-release:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ghcr.io/araxiaonline/ac-wotlk-worldserver-devcontainer:latest
|
||||
options: --user root
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- name: build
|
||||
uses: araxiaonline/share-gh-workflows/.github/actions/build-tag-release@main
|
||||
with:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
tag_release: true
|
||||
event_name: ${{ github.event_name }}
|
||||
12
.github/workflows/core_build.yml
vendored
12
.github/workflows/core_build.yml
vendored
@@ -1,12 +0,0 @@
|
||||
name: core-build
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
uses: azerothcore/reusable-workflows/.github/workflows/core_build_modules.yml@main
|
||||
with:
|
||||
module_repo: ${{ github.event.repository.name }}
|
||||
20
README.md
20
README.md
@@ -1,9 +1,22 @@
|
||||
### [](https://github.com/ElunaLuaEngine/Eluna)
|
||||
|
||||
#  Azeroth Core Module
|
||||
|
||||
## mod-eluna
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
<p align="left">
|
||||
<img src="https://github.com/araxiaonline/docs/blob/main/docs/media/logo-sm.png?raw=true" alt="Araxia Online" width="70" style="vertical-align: middle;"/>
|
||||
<span style="font-size: 20px; vertical-align: middle;">Player Tested and Modified By Araxia Online</span>
|
||||
</p>
|
||||
|
||||
## About
|
||||
### [](https://github.com/ElunaLuaEngine/Eluna)
|
||||
|
||||
Eluna Lua Engine © is a lua engine embedded to World of Warcraft emulators. Eluna supports MaNGOS, CMaNGOS, TrinityCore and AzerothCore.
|
||||
We are currently working hard to make Eluna better from inside and outside.
|
||||
We are currently working hard to make Eluna better from inside and outside.
|
||||
|
||||
If you are having trouble with installation or scripts, please feel free to open an issue.
|
||||
For documentation and reference see [Eluna API (AC version)](https://www.azerothcore.org/pages/eluna/index.html) and [Lua reference manual](http://www.lua.org/manual/5.2/).
|
||||
@@ -21,7 +34,6 @@ The official Azerothcore Discord server offers a channel dedicated to lua develo
|
||||
<img src="https://img.shields.io/badge/discord-join-7289DA.svg?logo=discord&longCache=true&style=flat" />
|
||||
</a>
|
||||
|
||||
#  mod-eluna for AzerothCore
|
||||
- Latest build status with azerothcore: [](https://github.com/azerothcore/mod-eluna)
|
||||
|
||||
[english](README.md) | [中文说明](README_CN.md) | [Español](README_ES.md)
|
||||
@@ -48,7 +60,7 @@ git clone https://github.com/azerothcore/mod-eluna.git mod-eluna
|
||||
|
||||
You need to run the cmake again and rebuild the project.
|
||||
|
||||
Eluna API for AC:
|
||||
Eluna API for AC:
|
||||
[https://www.azerothcore.org/pages/eluna/index.html](https://www.azerothcore.org/pages/eluna/index.html)
|
||||
|
||||
|
||||
|
||||
17
release.yml
Normal file
17
release.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
name: tag-release
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["core-build"]
|
||||
types:
|
||||
- completed
|
||||
jobs:
|
||||
release-on-push:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- name: Release on Push
|
||||
uses: rymndhng/release-on-push-action@master
|
||||
with:
|
||||
bump_version_scheme: minor
|
||||
@@ -16,8 +16,9 @@
|
||||
*/
|
||||
|
||||
#include "Chat.h"
|
||||
#include "ElunaInstanceAI.h"
|
||||
#include "ElunaEventMgr.h"
|
||||
#include "Log.h"
|
||||
#include "Logging/Log.h"
|
||||
#include "LuaEngine.h"
|
||||
#include "Pet.h"
|
||||
#include "Player.h"
|
||||
@@ -237,10 +238,10 @@ class Eluna_AllMapScript : public AllMapScript
|
||||
public:
|
||||
Eluna_AllMapScript() : AllMapScript("Eluna_AllMapScript") { }
|
||||
|
||||
void OnBeforeCreateInstanceScript(InstanceMap* instanceMap, InstanceScript* instanceData, bool /*load*/, std::string /*data*/, uint32 /*completedEncounterMask*/) override
|
||||
void OnBeforeCreateInstanceScript(InstanceMap* instanceMap, InstanceScript** instanceData, bool /*load*/, std::string /*data*/, uint32 /*completedEncounterMask*/) override
|
||||
{
|
||||
if (instanceData)
|
||||
*instanceData = sEluna->GetInstanceData(instanceMap);
|
||||
*instanceData = static_cast<InstanceScript*>(sEluna->GetInstanceData(instanceMap));
|
||||
}
|
||||
|
||||
void OnDestroyInstance(MapInstanced* /*mapInstanced*/, Map* map) override
|
||||
|
||||
@@ -58,7 +58,7 @@ if( ${CMAKE_PROJECT_NAME} STREQUAL "MaNGOS" )
|
||||
${CMAKE_SOURCE_DIR}/src/game/WorldHandlers
|
||||
${CMAKE_SOURCE_DIR}/src/game/Object
|
||||
)
|
||||
|
||||
|
||||
if( WIN32 )
|
||||
if ( MSVC )
|
||||
add_custom_command(TARGET LuaEngine
|
||||
@@ -74,7 +74,7 @@ if( ${CMAKE_PROJECT_NAME} STREQUAL "MaNGOS" )
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
install(DIRECTORY extensions DESTINATION "${BIN_DIR}/lua_scripts/")
|
||||
|
||||
|
||||
endif()
|
||||
|
||||
@@ -393,262 +393,6 @@ namespace LuaCreature
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** -- NPCBOT Start */
|
||||
// #if defined(AZEROTHCORE)
|
||||
/**
|
||||
* Return `true` if the [Creature] is a NPCBot,
|
||||
* @return bool isNPCBot
|
||||
*/
|
||||
int IsNPCBot(lua_State* L, Creature* creature)
|
||||
{
|
||||
Eluna::Push(L, creature->IsNPCBot());
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the [Creature]'s bot owner.
|
||||
* @return [Player] botOwner
|
||||
*/
|
||||
int GetBotOwner(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
bot_ai* ai = creature->GetBotAI();
|
||||
if (ai) {
|
||||
Eluna::Push(L, ai->GetBotOwner());
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int GetBotOwnerGUID(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
bot_ai* ai = creature->GetBotAI();
|
||||
if (ai) {
|
||||
Eluna::Push(L, ai->GetBotOwnerGuid());
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the [Creature]'s bot class.
|
||||
* @return unint8 botClassID
|
||||
*/
|
||||
int GetBotClass(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
Eluna::Push(L, creature->GetBotClass());
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [Creature]'s bot roles Tank, Healer, Damage that are enabled as a mask.
|
||||
* @return uint32 botRoles
|
||||
*/
|
||||
int GetBotRoles(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
Eluna::Push(L, creature->GetBotRoles());
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns `true` if the [Creature] is has an assigned role as tank.
|
||||
* @return bool isTank
|
||||
*/
|
||||
int IsBotTank(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
bot_ai* ai = creature->GetBotAI();
|
||||
Eluna::Push(L, ai->IsTank());
|
||||
return 1;
|
||||
}
|
||||
/**
|
||||
* Returns `true` if the [Creature] is has an assigned role as off-tank.
|
||||
* @return bool isTank
|
||||
*/
|
||||
int IsBotOffTank(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
bot_ai* ai = creature->GetBotAI();
|
||||
Eluna::Push(L, ai->IsOffTank());
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns `true` if the [Creature] is free and not assigned to a player
|
||||
* @return bool isFree
|
||||
*/
|
||||
int IsFreeBot(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
Eluna::Push(L, creature->IsFreeBot());
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [Creature]'s bot average item level of equipped items.
|
||||
* @return float botAverageItemLevel
|
||||
*/
|
||||
int GetBotAverageItemLevel(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
Eluna::Push(L, creature->GetBotAverageItemLevel());
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetBotEquipment(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
if(creature->IsFreeBot())
|
||||
return 0;
|
||||
|
||||
uint32 slot = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
Eluna::Push(L, creature->GetBotEquips(slot));
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetBotStat(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
uint8 botstat = Eluna::CHECKVAL<uint8>(L, 2);
|
||||
Eluna::Push(L, creature->GetTotalBotStat(BotStatMods(botstat)));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetTalentSpec(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
bot_ai* ai = creature->GetBotAI();
|
||||
Eluna::Push(L, ai->GetSpec());
|
||||
return 1;
|
||||
}
|
||||
|
||||
int BotEquipItem(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
// If this bot is not owned by a player return.
|
||||
if(creature->IsFreeBot())
|
||||
return 0;
|
||||
|
||||
// if the entry passed in was an item object
|
||||
Item* item = Eluna::CHECKOBJ<Item>(L, 2, false);
|
||||
uint32 slot = Eluna::CHECKVAL<uint32>(L, 3);
|
||||
Player* owner = creature->GetBotOwner();
|
||||
|
||||
// If an item entry was passed in instead
|
||||
if(!item)
|
||||
{
|
||||
uint32 itemid = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
item = owner->GetItemByEntry(itemid);
|
||||
}
|
||||
|
||||
if(slot > EQUIPMENT_SLOT_END)
|
||||
return 0;
|
||||
|
||||
bool result = creature->EquipItem(slot, item, owner->GetGUID());
|
||||
Eluna::Push(L, result);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int BotCanEquipItem(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
// If this bot is not owned by a player return.
|
||||
if(creature->IsFreeBot())
|
||||
return 0;
|
||||
|
||||
// if the entry passed in was an item object
|
||||
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
uint32 slot = Eluna::CHECKVAL<uint32>(L, 3);
|
||||
|
||||
// If an item entry was passed in instead
|
||||
if(entry)
|
||||
{
|
||||
const ItemTemplate* proto = eObjectMgr->GetItemTemplate(entry);
|
||||
if(!proto)
|
||||
return luaL_argerror(L, 1, "valid ItemEntry expected in BotCanEquipItem");
|
||||
|
||||
if(slot > EQUIPMENT_SLOT_END)
|
||||
return luaL_argerror(L, 1, "valie slot expected in BotCanEquipItem");
|
||||
|
||||
bot_ai* ai = creature->GetBotAI();
|
||||
bool result = ai->CanEquip(proto, slot, true);
|
||||
Eluna::Push(L, result);
|
||||
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int BotUnequipItem(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
// If this bot is not owned by a player return.
|
||||
if(creature->IsFreeBot())
|
||||
return 0;
|
||||
|
||||
uint32 slot = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
Player* owner = creature->GetBotOwner();
|
||||
|
||||
bot_ai* ai = creature->GetBotAI();
|
||||
bool result = ai->UnequipItem(slot, owner->GetGUID());
|
||||
Eluna::Push(L, result);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetBotDump(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
bot_ai* ai = creature->GetBotAI();
|
||||
Player* owner = creature->GetBotOwner();
|
||||
const char* dump = ai->BotDump(owner, creature);
|
||||
|
||||
if(!dump)
|
||||
return luaL_argerror(L, 1, "BotDump failed for bot.");
|
||||
|
||||
Eluna::Push(L, dump);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// #endif
|
||||
/** -- NPCBot End */
|
||||
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
/**
|
||||
* Returns `true` if the [Creature] is an invisible trigger,
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#endif
|
||||
#else
|
||||
#include "Database/QueryResult.h"
|
||||
#include "Log.h"
|
||||
#include "Logging/Log.h"
|
||||
#endif
|
||||
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
|
||||
@@ -41,6 +41,11 @@ extern "C"
|
||||
#include "ItemTemplateMethods.h"
|
||||
#include "RollMethods.h"
|
||||
|
||||
// If this is runnong on NPCBOTS core fork include methods for NpcBot management in Lua
|
||||
#if defined(MOD_PRESENT_NPCBOTS)
|
||||
#include "NpcBotMethods.h"
|
||||
#endif
|
||||
|
||||
luaL_Reg GlobalMethods[] =
|
||||
{
|
||||
// Hooks
|
||||
@@ -930,28 +935,28 @@ ElunaRegister<Creature> CreatureMethods[] =
|
||||
|
||||
|
||||
/** -- NPCBOT Start */
|
||||
#if defined(AZEROTHCORE)
|
||||
#if defined(AZEROTHCORE) && defined(MOD_PRESENT_NPCBOTS)
|
||||
|
||||
// Getters & Flags
|
||||
{ "IsNPCBot", &LuaCreature::IsNPCBot },
|
||||
{ "GetBotOwner", &LuaCreature::GetBotOwner },
|
||||
{ "GetBotOwnerGUID", &LuaCreature::GetBotOwnerGUID },
|
||||
{ "GetBotClass", &LuaCreature::GetBotClass },
|
||||
{ "GetBotRoles", &LuaCreature::GetBotRoles },
|
||||
{ "GetTalentSpec", &LuaCreature::GetTalentSpec },
|
||||
{ "IsBotTank", &LuaCreature::IsBotTank },
|
||||
{ "IsBotOffTank", &LuaCreature::IsBotOffTank },
|
||||
{ "IsFreeBot", &LuaCreature::IsFreeBot },
|
||||
{ "GetBotAverageItemLevel", &LuaCreature::GetBotAverageItemLevel },
|
||||
{ "GetBotEquipment", &LuaCreature::GetBotEquipment },
|
||||
{ "GetBotStat", &LuaCreature::GetBotStat },
|
||||
{ "GetBotDump", &LuaCreature::GetBotDump },
|
||||
{ "IsNPCBot", &LuaNpcBot::IsNPCBot },
|
||||
{ "GetBotOwner", &LuaNpcBot::GetBotOwner },
|
||||
{ "GetBotOwnerGUID", &LuaNpcBot::GetBotOwnerGUID },
|
||||
{ "GetBotClass", &LuaNpcBot::GetBotClass },
|
||||
{ "GetBotRoles", &LuaNpcBot::GetBotRoles },
|
||||
{ "GetTalentSpec", &LuaNpcBot::GetTalentSpec },
|
||||
{ "IsBotTank", &LuaNpcBot::IsBotTank },
|
||||
{ "IsBotOffTank", &LuaNpcBot::IsBotOffTank },
|
||||
{ "IsFreeBot", &LuaNpcBot::IsFreeBot },
|
||||
{ "GetBotAverageItemLevel", &LuaNpcBot::GetBotAverageItemLevel },
|
||||
{ "GetBotEquipment", &LuaNpcBot::GetBotEquipment },
|
||||
{ "GetBotStat", &LuaNpcBot::GetBotStat },
|
||||
{ "GetBotDump", &LuaNpcBot::GetBotDump },
|
||||
|
||||
|
||||
// Setters
|
||||
{ "BotEquipItem", &LuaCreature::BotEquipItem },
|
||||
{ "BotCanEquipItem", &LuaCreature::BotCanEquipItem },
|
||||
{ "BotUnequipBotItem", &LuaCreature::BotUnequipItem },
|
||||
{ "BotEquipItem", &LuaNpcBot::BotEquipItem },
|
||||
{ "BotCanEquipItem", &LuaNpcBot::BotCanEquipItem },
|
||||
{ "BotUnequipBotItem", &LuaNpcBot::BotUnequipItem },
|
||||
#endif
|
||||
/** -- NPCBOT End */
|
||||
|
||||
|
||||
279
src/LuaEngine/NpcBotMethods.h
Normal file
279
src/LuaEngine/NpcBotMethods.h
Normal file
@@ -0,0 +1,279 @@
|
||||
|
||||
#ifndef NPCBOTMETHODS_H
|
||||
#define NPCBOTMETHODS_H
|
||||
|
||||
#include "bot_ai_eluna.h"
|
||||
|
||||
/***
|
||||
* Player controlled bot party members, relies on latest changes to
|
||||
* NPCBots fork of AzerothCore
|
||||
*
|
||||
* Inherits all methods from: [Object], [WorldObject], [Unit]
|
||||
*/
|
||||
namespace LuaNpcBot
|
||||
{
|
||||
/**
|
||||
* Return `true` if the [Creature] is a NPCBot,
|
||||
* @return bool isNPCBot
|
||||
*/
|
||||
int IsNPCBot(lua_State* L, Creature* creature)
|
||||
{
|
||||
Eluna::Push(L, creature->IsNPCBot());
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the [Creature]'s bot owner.
|
||||
* @return [Player] botOwner
|
||||
*/
|
||||
int GetBotOwner(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
bot_ai* ai = creature->GetBotAI();
|
||||
if (ai) {
|
||||
Eluna::Push(L, ai->GetBotOwner());
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int GetBotOwnerGUID(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
bot_ai* ai = creature->GetBotAI();
|
||||
if (ai) {
|
||||
Eluna::Push(L, ai->GetBotOwnerGuid());
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the [Creature]'s bot class.
|
||||
* @return unint8 botClassID
|
||||
*/
|
||||
int GetBotClass(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
Eluna::Push(L, creature->GetBotClass());
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [Creature]'s bot roles Tank, Healer, Damage that are enabled as a mask.
|
||||
* @return uint32 botRoles
|
||||
*/
|
||||
int GetBotRoles(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
Eluna::Push(L, creature->GetBotRoles());
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns `true` if the [Creature] is has an assigned role as tank.
|
||||
* @return bool isTank
|
||||
*/
|
||||
int IsBotTank(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
bot_ai* ai = creature->GetBotAI();
|
||||
Eluna::Push(L, ai->IsTank());
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns `true` if the [Creature] is has an assigned role as off-tank.
|
||||
* @return bool isTank
|
||||
*/
|
||||
int IsBotOffTank(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
bot_ai* ai = creature->GetBotAI();
|
||||
Eluna::Push(L, ai->IsOffTank());
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns `true` if the [Creature] is free and not assigned to a player
|
||||
* @return bool isFree
|
||||
*/
|
||||
int IsFreeBot(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
Eluna::Push(L, creature->IsFreeBot());
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [Creature]'s bot average item level of equipped items.
|
||||
* @return float botAverageItemLevel
|
||||
*/
|
||||
int GetBotAverageItemLevel(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
Eluna::Push(L, creature->GetBotAverageItemLevel());
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetBotEquipment(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
if(creature->IsFreeBot())
|
||||
return 0;
|
||||
|
||||
uint32 slot = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
Eluna::Push(L, creature->GetBotEquips(slot));
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetBotStat(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
uint8 botstat = Eluna::CHECKVAL<uint8>(L, 2);
|
||||
/**
|
||||
* @fix this to be optional for the bot owner to see the stats
|
||||
*/
|
||||
|
||||
bot_ai* ai = creature->GetBotAI();
|
||||
Eluna::Push(L, ai->GetTotalBotStat(BotStatMods(botstat)));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetTalentSpec(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
bot_ai* ai = creature->GetBotAI();
|
||||
Eluna::Push(L, ai->GetSpec());
|
||||
return 1;
|
||||
}
|
||||
|
||||
int BotEquipItem(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
// If this bot is not owned by a player return.
|
||||
if(creature->IsFreeBot())
|
||||
return 0;
|
||||
|
||||
// if the entry passed in was an item object
|
||||
Item* item = Eluna::CHECKOBJ<Item>(L, 2, false);
|
||||
uint32 slot = Eluna::CHECKVAL<uint32>(L, 3);
|
||||
Player* owner = creature->GetBotOwner();
|
||||
|
||||
// If an item entry was passed in instead
|
||||
if(!item)
|
||||
{
|
||||
uint32 itemid = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
item = owner->GetItemByEntry(itemid);
|
||||
}
|
||||
|
||||
if(slot > EQUIPMENT_SLOT_END)
|
||||
return 0;
|
||||
|
||||
bot_ai* ai = creature->GetBotAI();
|
||||
BotAIEluna elunaAi(ai);
|
||||
bool result = elunaAi.Equip(slot, item, owner->GetGUID());
|
||||
|
||||
Eluna::Push(L, result);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int BotCanEquipItem(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
// If this bot is not owned by a player return.
|
||||
if(creature->IsFreeBot())
|
||||
return 0;
|
||||
|
||||
// if the entry passed in was an item object
|
||||
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
uint32 slot = Eluna::CHECKVAL<uint32>(L, 3);
|
||||
|
||||
// If an item entry was passed in instead
|
||||
if(entry)
|
||||
{
|
||||
const ItemTemplate* proto = eObjectMgr->GetItemTemplate(entry);
|
||||
if(!proto)
|
||||
return luaL_argerror(L, 1, "valid ItemEntry expected in BotCanEquipItem");
|
||||
|
||||
if(slot > EQUIPMENT_SLOT_END)
|
||||
return luaL_argerror(L, 1, "value slot expected in BotCanEquipItem");
|
||||
|
||||
bot_ai* ai = creature->GetBotAI();
|
||||
bool result = BotAIEluna(ai).CanEquip(proto, slot, true);
|
||||
Eluna::Push(L, result);
|
||||
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int BotUnequipItem(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
// If this bot is not owned by a player return.
|
||||
if(creature->IsFreeBot())
|
||||
return 0;
|
||||
|
||||
uint32 slot = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
Player* owner = creature->GetBotOwner();
|
||||
|
||||
bot_ai* ai = creature->GetBotAI();
|
||||
BotAIEluna elunaAi(ai);
|
||||
bool result = elunaAi.Unequip(slot, owner->GetGUID());
|
||||
Eluna::Push(L, result);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetBotDump(lua_State* L, Creature* creature)
|
||||
{
|
||||
if(!creature->IsNPCBot())
|
||||
return 0;
|
||||
|
||||
bot_ai* ai = creature->GetBotAI();
|
||||
Player* owner = creature->GetBotOwner();
|
||||
BotAIEluna elunaAi(ai);
|
||||
std::string dump = elunaAi.BotDump(owner, creature);
|
||||
|
||||
if(dump.empty())
|
||||
return luaL_argerror(L, 1, "BotDump failed for bot.");
|
||||
|
||||
Eluna::Push(L, dump);
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // NPCBOTMETHODS_H
|
||||
@@ -176,7 +176,7 @@ namespace LuaPlayer
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Returns `true` if the [Player] has the given amount of item entry specified, `false` otherwise.
|
||||
*
|
||||
@@ -193,7 +193,7 @@ namespace LuaPlayer
|
||||
Eluna::Push(L, player->HasItemCount(itemId, count, check_bank));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns `true` if the [Player] has a quest for the item entry specified, `false` otherwise.
|
||||
*
|
||||
@@ -207,7 +207,7 @@ namespace LuaPlayer
|
||||
Eluna::Push(L, player->HasQuestForItem(entry));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns `true` if the [Player] can use the item or item entry specified, `false` otherwise.
|
||||
*
|
||||
@@ -417,7 +417,7 @@ namespace LuaPlayer
|
||||
Eluna::Push(L, player->HasTankSpec());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns `true` if the [Player] has a Melee Specialization, `false` otherwise.
|
||||
*
|
||||
@@ -428,7 +428,7 @@ namespace LuaPlayer
|
||||
Eluna::Push(L, player->HasMeleeSpec());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns `true` if the [Player] has a Caster Specialization, `false` otherwise.
|
||||
*
|
||||
@@ -439,7 +439,7 @@ namespace LuaPlayer
|
||||
Eluna::Push(L, player->HasCasterSpec());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns `true` if the [Player] has a Heal Specialization, `false` otherwise.
|
||||
*
|
||||
@@ -942,8 +942,8 @@ namespace LuaPlayer
|
||||
{
|
||||
AchievementEntry const* achievement = sAchievementStore.LookupEntry(pair.first);
|
||||
if (achievement && (achievement->categoryId != 81 || countFeatsOfStrength))
|
||||
{
|
||||
count++;
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1596,7 +1596,7 @@ namespace LuaPlayer
|
||||
Eluna::Push(L, player->GetItemByEntry(entry));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the database textID of the [WorldObject]'s gossip header text for the [Player]
|
||||
*
|
||||
@@ -1668,7 +1668,7 @@ namespace LuaPlayer
|
||||
Eluna::Push(L, player->GetTeamId());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns amount of the specified [Item] the [Player] has.
|
||||
*
|
||||
@@ -1847,7 +1847,7 @@ namespace LuaPlayer
|
||||
Eluna::Push(L, ChatHandler(player->GetSession()).GetNearbyGameObject());
|
||||
return 1;
|
||||
}*/
|
||||
|
||||
|
||||
/**
|
||||
* Locks the player controls and disallows all movement and casting.
|
||||
*
|
||||
@@ -2345,7 +2345,7 @@ namespace LuaPlayer
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Shows the mailbox window to the player from specified guid.
|
||||
*
|
||||
@@ -2475,30 +2475,31 @@ namespace LuaPlayer
|
||||
*
|
||||
* @param [Unit] sender
|
||||
*/
|
||||
int SendAuctionMenu(lua_State* L, Player* player)
|
||||
int SendAuctionMenu(lua_State* L, Player* /*player*/)
|
||||
{
|
||||
Unit* unit = Eluna::CHECKOBJ<Unit>(L, 2);
|
||||
Eluna::CHECKOBJ<Unit>(L, 2);
|
||||
|
||||
#if defined TRINITY || AZEROTHCORE
|
||||
AuctionHouseEntry const* ahEntry = AuctionHouseMgr::GetAuctionHouseEntry(unit->GetFaction());
|
||||
// AuctionHouseEntry const* ahEntry = AuctionHouseMgr::GetAuctionHouseFactionFromHouseId(static_cast<AuctionHouseId>(unit->GetFaction()));
|
||||
// AuctionHouseEntry const* ahEntry = AuctionHouseMgr::GetAuctionHouseEntry(unit->GetFaction());
|
||||
#else
|
||||
AuctionHouseEntry const* ahEntry = AuctionHouseMgr::GetAuctionHouseEntry(unit);
|
||||
// AuctionHouseEntry const* ahEntry = AuctionHouseMgr::GetAuctionHouseEntry(unit);
|
||||
#endif
|
||||
if (!ahEntry)
|
||||
return 0;
|
||||
// if (!ahEntry)
|
||||
// return 0;
|
||||
|
||||
WorldPacket data(MSG_AUCTION_HELLO, 12);
|
||||
data << unit->GET_GUID();
|
||||
// WorldPacket data(MSG_AUCTION_HELLO, 12);
|
||||
// data << unit->GET_GUID();
|
||||
#ifdef TRINITY
|
||||
data << uint32(ahEntry->ID);
|
||||
#else
|
||||
data << uint32(ahEntry->houseId);
|
||||
// data << uint32(ahEntry->houseId);
|
||||
#endif
|
||||
data << uint8(1);
|
||||
// data << uint8(1);
|
||||
#ifdef CMANGOS
|
||||
player->GetSession()->SendPacket(data);
|
||||
// player->GetSession()->SendPacket(data);
|
||||
#else
|
||||
player->GetSession()->SendPacket(&data);
|
||||
// player->GetSession()->SendPacket(&data);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
@@ -2550,7 +2551,7 @@ namespace LuaPlayer
|
||||
player->GetSession()->SendShowBank(obj->GET_GUID());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sends a vendor window to the [Player] from the [WorldObject] specified.
|
||||
*
|
||||
@@ -3458,7 +3459,7 @@ namespace LuaPlayer
|
||||
player->AutoUnequipOffhandIfNeed();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if the player can equip the given [Item] or item entry to the given slot, false otherwise.
|
||||
*
|
||||
@@ -3631,7 +3632,7 @@ namespace LuaPlayer
|
||||
player->SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, currentKills + val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the given amount of the specified item entry to the player.
|
||||
*
|
||||
@@ -3666,7 +3667,7 @@ namespace LuaPlayer
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes the given amount of the specified [Item] from the player.
|
||||
*
|
||||
@@ -3804,7 +3805,9 @@ namespace LuaPlayer
|
||||
{
|
||||
std::string msg = Eluna::CHECKVAL<std::string>(L, 2);
|
||||
if (msg.length() > 0)
|
||||
ChatHandler(player->GetSession()).SendNotification("{}", msg);
|
||||
|
||||
// player->GetSession()->SendNotification("%s", msg.c_str());
|
||||
ChatHandler(player->GetSession()).SendNotification("{}", msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -4015,9 +4018,9 @@ namespace LuaPlayer
|
||||
/**
|
||||
* Adds a new item to the gossip menu shown to the [Player] on next call to [Player:GossipSendMenu].
|
||||
*
|
||||
* sender and intid are numbers which are passed directly to the gossip selection handler. Internally they are partly used for the database gossip handling.
|
||||
* code specifies whether to show a box to insert text to. The player inserted text is passed to the gossip selection handler.
|
||||
* money specifies an amount of money the player needs to have to click the option. An error message is shown if the player doesn't have enough money.
|
||||
* sender and intid are numbers which are passed directly to the gossip selection handler. Internally they are partly used for the database gossip handling.
|
||||
* code specifies whether to show a box to insert text to. The player inserted text is passed to the gossip selection handler.
|
||||
* money specifies an amount of money the player needs to have to click the option. An error message is shown if the player doesn't have enough money.
|
||||
* Note that the money amount is only checked client side and is not removed from the player either. You will need to check again in your code before taking action.
|
||||
*
|
||||
* See also: [Player:GossipSendMenu], [Player:GossipAddQuests], [Player:GossipComplete], [Player:GossipClearMenu]
|
||||
@@ -4105,7 +4108,7 @@ namespace LuaPlayer
|
||||
* Clears the [Player]s current gossip item list.
|
||||
*
|
||||
* See also: [Player:GossipMenuAddItem], [Player:GossipSendMenu], [Player:GossipAddQuests], [Player:GossipComplete]
|
||||
*
|
||||
*
|
||||
* Note: This is needed when you show a gossip menu without using gossip hello or select hooks which do this automatically.
|
||||
* Usually this is needed when using [Player] is the sender of a Gossip Menu.
|
||||
*/
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace LuaUnit
|
||||
unit->ApplySpellImmune(0, 5, immunity, apply);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The [Unit] modifies a specific stat
|
||||
*
|
||||
@@ -139,7 +139,7 @@ namespace LuaUnit
|
||||
*/
|
||||
int IsRooted(lua_State* L, Unit* unit)
|
||||
{
|
||||
Eluna::Push(L, unit->isInRoots() || unit->HasUnitMovementFlag(MOVEMENTFLAG_ROOT));
|
||||
Eluna::Push(L, unit->HasRootAura() || unit->HasUnitMovementFlag(MOVEMENTFLAG_ROOT));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user