mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
Project tidy up and sync
This commit is contained in:
parent
49fe617b55
commit
5531a0087d
44 changed files with 484 additions and 427 deletions
|
|
@ -8,8 +8,7 @@ Tab Size
|
||||||
--------
|
--------
|
||||||
First of all, we use spaces. Tabs are four-character width. That is, no 8-space
|
First of all, we use spaces. Tabs are four-character width. That is, no 8-space
|
||||||
tabs, no 2-space tabs. Four. Unfortunately there's no such thing as 'standard
|
tabs, no 2-space tabs. Four. Unfortunately there's no such thing as 'standard
|
||||||
tab width', and 4-space indenting looks best from our point of view, besides MSVC'
|
tab width', and 4-space indenting looks best from our point of view, besides MSVC' editor has this setting by default.
|
||||||
editor has this setting by default.
|
|
||||||
|
|
||||||
Line length
|
Line length
|
||||||
-----------
|
-----------
|
||||||
|
|
|
||||||
|
|
@ -1,42 +1,11 @@
|
||||||
Introduction to Database content for SD2
|
Introduction to Database content for SD3
|
||||||
================================================
|
================================================
|
||||||
|
|
||||||
This guide is intended to help people
|
This guide is intended to help people
|
||||||
|
|
||||||
* to understand which information of the database is used with SD2
|
* to understand which information of the database is used with SD3
|
||||||
* who want to contribute their patches as complete as possible
|
* who want to contribute their patches as complete as possible
|
||||||
|
|
||||||
All SQL-related files are located in the ScriptDev2/SQL and subsequent directories.
|
|
||||||
|
|
||||||
SQL-Files
|
|
||||||
---------
|
|
||||||
|
|
||||||
Files that contain full SD2-Database content
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
For a script we usually have to take care of these files:
|
|
||||||
|
|
||||||
* mangos_scriptname_full.sql
|
|
||||||
+
|
|
||||||
This file is applied to the world database (default: mangos), and contains the script names
|
|
||||||
+
|
|
||||||
* scriptdev2_script_full.sql
|
|
||||||
+
|
|
||||||
This file is applied to the sd2 database (default: scriptdev2), and contains texts, gossip-items and waypoints
|
|
||||||
|
|
||||||
Patchfiles for incremental Updates
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
Patches for the databases are stored in the files:
|
|
||||||
|
|
||||||
* Updates/rXXXX_mangos.sql
|
|
||||||
+
|
|
||||||
This file contains the changes that should be done with the patch to the world-database
|
|
||||||
+
|
|
||||||
* Updates/rXXXX_scriptdev2.sql
|
|
||||||
+
|
|
||||||
This file contains the changes that should be done with the patch to the scriptdev2-database
|
|
||||||
|
|
||||||
World-Database
|
World-Database
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
|
@ -65,7 +34,7 @@ DELETE FROM scripted_areatrigger WHERE entry=XYZ;
|
||||||
INSERT INTO scripted_areatrigger VALUES (XYZ, at_some_place);
|
INSERT INTO scripted_areatrigger VALUES (XYZ, at_some_place);
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
ScriptDev2-Database
|
ScriptDev3-Database
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
entry-Format for texts and for gossip-texts:
|
entry-Format for texts and for gossip-texts:
|
||||||
|
|
@ -177,13 +146,9 @@ Creating the Patch
|
||||||
|
|
||||||
There are different ways to get to a patch, I prefer this workflow:
|
There are different ways to get to a patch, I prefer this workflow:
|
||||||
|
|
||||||
For the scriptdev2 database (patch files):
|
For the scriptdev3 database (patch files):
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Open scriptdev2_script_full.txt +
|
|
||||||
scroll to the right place for the needed SQL-statements, to note the entry. +
|
|
||||||
(for texts depending on mapId, and to the last counter, for waypoints behind the last inserted waypoint)
|
|
||||||
|
|
||||||
Example for normal world text:
|
Example for normal world text:
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# Spells {#spells} #
|
# Spells {#spells} #
|
||||||
|
|
||||||
Spells consist of a whole lot of information, the most usual way to access them is via their ID. A good
|
Spells consist of a whole lot of information, the most usual way to access them is via their ID. A good
|
||||||
tool to use when examining spells and looking into what they will do is [QSW](https://bitbucket.org/sidsukana/qsw) which will show you alot of the information available about a spell.
|
tool to use when examining spells and looking into what they will do is [QSW](https://github.com/sidsukana/QSpellWork) which will show you alot of the information available about a spell.
|
||||||
|
|
||||||
A spell is made up of a lot of parts, on of these are the effects that a spell has, without them spells
|
A spell is made up of a lot of parts, on of these are the effects that a spell has, without them spells
|
||||||
wouldn't do much at all since the effects apply different kinds of `Aura`s that do different things
|
wouldn't do much at all since the effects apply different kinds of `Aura`s that do different things
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,4 @@ We would also like to acknowledge the contributions made by the following
|
||||||
teams, those input and code has from time to time been included in the MaNGOS
|
teams, those input and code has from time to time been included in the MaNGOS
|
||||||
code.
|
code.
|
||||||
|
|
||||||
Each of the commits will have a prefix indicating the source team :
|
Each of the commits will attempt to clearly identify the author.
|
||||||
|
|
||||||
* **t**: TrinityCore
|
|
||||||
* **p**: Project SilverPine
|
|
||||||
* **r**: MangosR2
|
|
||||||
* **s**: ScriptDev
|
|
||||||
* **c**: cMangos
|
|
||||||
* **m**: mangos
|
|
||||||
|
|
@ -789,7 +789,6 @@ void AuctionBotBuyer::PrepareListOfEntry(AHB_Buyer_Config& config)
|
||||||
|
|
||||||
bool AuctionBotBuyer::IsBuyableEntry(uint64 buyoutPrice, double InGame_BuyPrice, double MaxBuyablePrice, uint64 MinBuyPrice, uint32 MaxChance, uint32 ChanceRatio)
|
bool AuctionBotBuyer::IsBuyableEntry(uint64 buyoutPrice, double InGame_BuyPrice, double MaxBuyablePrice, uint64 MinBuyPrice, uint32 MaxChance, uint32 ChanceRatio)
|
||||||
{
|
{
|
||||||
double ratio = 0;
|
|
||||||
uint32 Chance = 0;
|
uint32 Chance = 0;
|
||||||
|
|
||||||
if (buyoutPrice <= MinBuyPrice)
|
if (buyoutPrice <= MinBuyPrice)
|
||||||
|
|
@ -800,7 +799,7 @@ bool AuctionBotBuyer::IsBuyableEntry(uint64 buyoutPrice, double InGame_BuyPrice,
|
||||||
{
|
{
|
||||||
if ((buyoutPrice > 0) && (MaxBuyablePrice > 0))
|
if ((buyoutPrice > 0) && (MaxBuyablePrice > 0))
|
||||||
{
|
{
|
||||||
ratio = buyoutPrice / MaxBuyablePrice;
|
double ratio = buyoutPrice / MaxBuyablePrice;
|
||||||
if (ratio < 10)
|
if (ratio < 10)
|
||||||
{ Chance = MaxChance - (ratio * (MaxChance / 10)); }
|
{ Chance = MaxChance - (ratio * (MaxChance / 10)); }
|
||||||
else { Chance = 1; }
|
else { Chance = 1; }
|
||||||
|
|
@ -815,7 +814,7 @@ bool AuctionBotBuyer::IsBuyableEntry(uint64 buyoutPrice, double InGame_BuyPrice,
|
||||||
{
|
{
|
||||||
if ((buyoutPrice > 0) && (MaxBuyablePrice > 0))
|
if ((buyoutPrice > 0) && (MaxBuyablePrice > 0))
|
||||||
{
|
{
|
||||||
ratio = buyoutPrice / MaxBuyablePrice;
|
double ratio = buyoutPrice / MaxBuyablePrice;
|
||||||
if (ratio < 10)
|
if (ratio < 10)
|
||||||
{ Chance = (MaxChance / 5) - (ratio * (MaxChance / 50)); }
|
{ Chance = (MaxChance / 5) - (ratio * (MaxChance / 50)); }
|
||||||
else { Chance = 1; }
|
else { Chance = 1; }
|
||||||
|
|
@ -828,7 +827,7 @@ bool AuctionBotBuyer::IsBuyableEntry(uint64 buyoutPrice, double InGame_BuyPrice,
|
||||||
{
|
{
|
||||||
if ((buyoutPrice > 0) && (MaxBuyablePrice > 0))
|
if ((buyoutPrice > 0) && (MaxBuyablePrice > 0))
|
||||||
{
|
{
|
||||||
ratio = buyoutPrice / MaxBuyablePrice;
|
double ratio = buyoutPrice / MaxBuyablePrice;
|
||||||
if (ratio < 10)
|
if (ratio < 10)
|
||||||
{ Chance = (MaxChance / 5) - (ratio * (MaxChance / 50)); }
|
{ Chance = (MaxChance / 5) - (ratio * (MaxChance / 50)); }
|
||||||
else { Chance = 0; }
|
else { Chance = 0; }
|
||||||
|
|
@ -841,11 +840,9 @@ bool AuctionBotBuyer::IsBuyableEntry(uint64 buyoutPrice, double InGame_BuyPrice,
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: WIN BUY! Chance = %u, num = %u.", Chance, RandNum);
|
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: WIN BUY! Chance = %u, num = %u.", Chance, RandNum);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot:LOOSE BUY! Chance = %u, num = %u.", Chance, RandNum);
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot:LOOSE BUY! Chance = %u, num = %u.", Chance, RandNum);
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AuctionBotBuyer::IsBidableEntry(uint64 bidPrice, double InGame_BuyPrice, double MaxBidablePrice, uint64 MinBidPrice, uint32 MaxChance, uint32 ChanceRatio)
|
bool AuctionBotBuyer::IsBidableEntry(uint64 bidPrice, double InGame_BuyPrice, double MaxBidablePrice, uint64 MinBidPrice, uint32 MaxChance, uint32 ChanceRatio)
|
||||||
|
|
|
||||||
|
|
@ -384,7 +384,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* target
|
||||||
{ return; }
|
{ return; }
|
||||||
|
|
||||||
source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||||
uint32 sound = 0;
|
uint32 sound;
|
||||||
|
|
||||||
// TODO in the following code we should restructure a bit to avoid
|
// TODO in the following code we should restructure a bit to avoid
|
||||||
// duplication (or maybe write functions?)
|
// duplication (or maybe write functions?)
|
||||||
|
|
|
||||||
|
|
@ -295,7 +295,7 @@ void WorldSession::HandlePVPLogDataOpcode(WorldPacket & /*recv_data*/)
|
||||||
|
|
||||||
BattleGround* bg = _player->GetBattleGround();
|
BattleGround* bg = _player->GetBattleGround();
|
||||||
if (!bg)
|
if (!bg)
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
// arena finish version will send in BattleGround::EndBattleGround directly
|
// arena finish version will send in BattleGround::EndBattleGround directly
|
||||||
if (bg->isArena())
|
if (bg->isArena())
|
||||||
|
|
|
||||||
|
|
@ -2304,9 +2304,8 @@ void BattleGroundMgr::LoadBattleMastersEntry()
|
||||||
{
|
{
|
||||||
BarGoLink bar(1);
|
BarGoLink bar(1);
|
||||||
bar.step();
|
bar.step();
|
||||||
|
|
||||||
sLog.outString();
|
|
||||||
sLog.outString(">> Loaded 0 battlemaster entries - table is empty!");
|
sLog.outString(">> Loaded 0 battlemaster entries - table is empty!");
|
||||||
|
sLog.outString();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2333,8 +2332,8 @@ void BattleGroundMgr::LoadBattleMastersEntry()
|
||||||
|
|
||||||
delete result;
|
delete result;
|
||||||
|
|
||||||
sLog.outString();
|
|
||||||
sLog.outString(">> Loaded %u battlemaster entries", count);
|
sLog.outString(">> Loaded %u battlemaster entries", count);
|
||||||
|
sLog.outString();
|
||||||
}
|
}
|
||||||
|
|
||||||
HolidayIds BattleGroundMgr::BGTypeToWeekendHolidayId(BattleGroundTypeId bgTypeId)
|
HolidayIds BattleGroundMgr::BGTypeToWeekendHolidayId(BattleGroundTypeId bgTypeId)
|
||||||
|
|
@ -2422,9 +2421,8 @@ void BattleGroundMgr::LoadBattleEventIndexes()
|
||||||
{
|
{
|
||||||
BarGoLink bar(1);
|
BarGoLink bar(1);
|
||||||
bar.step();
|
bar.step();
|
||||||
|
|
||||||
sLog.outString();
|
|
||||||
sLog.outErrorDb(">> Loaded 0 battleground eventindexes.");
|
sLog.outErrorDb(">> Loaded 0 battleground eventindexes.");
|
||||||
|
sLog.outString();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2483,7 +2481,7 @@ void BattleGroundMgr::LoadBattleEventIndexes()
|
||||||
}
|
}
|
||||||
while (result->NextRow());
|
while (result->NextRow());
|
||||||
|
|
||||||
sLog.outString();
|
|
||||||
sLog.outString(">> Loaded %u battleground eventindexes", count);
|
sLog.outString(">> Loaded %u battleground eventindexes", count);
|
||||||
|
sLog.outString();
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,15 +54,15 @@
|
||||||
#include "WaypointMovementGenerator.h"
|
#include "WaypointMovementGenerator.h"
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
|
||||||
#include <map>
|
|
||||||
#include <typeinfo>
|
|
||||||
|
|
||||||
#include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand
|
#include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand
|
||||||
#include "MoveMap.h" // for mmap manager
|
#include "MoveMap.h" // for mmap manager
|
||||||
#include "PathFinder.h" // for mmap commands
|
#include "PathFinder.h" // for mmap commands
|
||||||
#include "movement/MoveSplineInit.h"
|
#include "movement/MoveSplineInit.h"
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
#include <map>
|
||||||
|
#include <typeinfo>
|
||||||
|
|
||||||
static uint32 ReputationRankStrIndex[MAX_REPUTATION_RANK] =
|
static uint32 ReputationRankStrIndex[MAX_REPUTATION_RANK] =
|
||||||
{
|
{
|
||||||
LANG_REP_HATED, LANG_REP_HOSTILE, LANG_REP_UNFRIENDLY, LANG_REP_NEUTRAL,
|
LANG_REP_HATED, LANG_REP_HOSTILE, LANG_REP_UNFRIENDLY, LANG_REP_NEUTRAL,
|
||||||
|
|
|
||||||
|
|
@ -439,7 +439,7 @@ bool ChatHandler::HandleReloadCommandCommand(char* /*args*/)
|
||||||
|
|
||||||
bool ChatHandler::HandleReloadCreatureQuestRelationsCommand(char* /*args*/)
|
bool ChatHandler::HandleReloadCreatureQuestRelationsCommand(char* /*args*/)
|
||||||
{
|
{
|
||||||
sLog.outString("Loading Quests Relations... (`creature_questrelation`)");
|
sLog.outString("Loading creature quest givers...");
|
||||||
sObjectMgr.LoadCreatureQuestRelations();
|
sObjectMgr.LoadCreatureQuestRelations();
|
||||||
SendGlobalSysMessage("DB table `creature_questrelation` (creature quest givers) reloaded.");
|
SendGlobalSysMessage("DB table `creature_questrelation` (creature quest givers) reloaded.");
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -447,7 +447,7 @@ bool ChatHandler::HandleReloadCreatureQuestRelationsCommand(char* /*args*/)
|
||||||
|
|
||||||
bool ChatHandler::HandleReloadCreatureQuestInvRelationsCommand(char* /*args*/)
|
bool ChatHandler::HandleReloadCreatureQuestInvRelationsCommand(char* /*args*/)
|
||||||
{
|
{
|
||||||
sLog.outString("Loading Quests Relations... (`creature_involvedrelation`)");
|
sLog.outString("Loading creature quest takers...");
|
||||||
sObjectMgr.LoadCreatureInvolvedRelations();
|
sObjectMgr.LoadCreatureInvolvedRelations();
|
||||||
SendGlobalSysMessage("DB table `creature_involvedrelation` (creature quest takers) reloaded.");
|
SendGlobalSysMessage("DB table `creature_involvedrelation` (creature quest takers) reloaded.");
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -478,7 +478,7 @@ bool ChatHandler::HandleReloadGossipMenuCommand(char* /*args*/)
|
||||||
|
|
||||||
bool ChatHandler::HandleReloadGOQuestRelationsCommand(char* /*args*/)
|
bool ChatHandler::HandleReloadGOQuestRelationsCommand(char* /*args*/)
|
||||||
{
|
{
|
||||||
sLog.outString("Loading Quests Relations... (`gameobject_questrelation`)");
|
sLog.outString("Loading gameobject quest givers...");
|
||||||
sObjectMgr.LoadGameobjectQuestRelations();
|
sObjectMgr.LoadGameobjectQuestRelations();
|
||||||
SendGlobalSysMessage("DB table `gameobject_questrelation` (gameobject quest givers) reloaded.");
|
SendGlobalSysMessage("DB table `gameobject_questrelation` (gameobject quest givers) reloaded.");
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -486,7 +486,7 @@ bool ChatHandler::HandleReloadGOQuestRelationsCommand(char* /*args*/)
|
||||||
|
|
||||||
bool ChatHandler::HandleReloadGOQuestInvRelationsCommand(char* /*args*/)
|
bool ChatHandler::HandleReloadGOQuestInvRelationsCommand(char* /*args*/)
|
||||||
{
|
{
|
||||||
sLog.outString("Loading Quests Relations... (`gameobject_involvedrelation`)");
|
sLog.outString("Loading gameobject quest takers...");
|
||||||
sObjectMgr.LoadGameobjectInvolvedRelations();
|
sObjectMgr.LoadGameobjectInvolvedRelations();
|
||||||
SendGlobalSysMessage("DB table `gameobject_involvedrelation` (gameobject quest takers) reloaded.");
|
SendGlobalSysMessage("DB table `gameobject_involvedrelation` (gameobject quest takers) reloaded.");
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -5381,13 +5381,17 @@ bool ChatHandler::HandleServerShutDownCommand(char* args)
|
||||||
|
|
||||||
uint32 exitcode;
|
uint32 exitcode;
|
||||||
if (!ExtractOptUInt32(&args, exitcode, SHUTDOWN_EXIT_CODE))
|
if (!ExtractOptUInt32(&args, exitcode, SHUTDOWN_EXIT_CODE))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Exit code should be in range of 0-125, 126-255 is used
|
// Exit code should be in range of 0-125, 126-255 is used
|
||||||
// in many shells for their own return codes and code > 255
|
// in many shells for their own return codes and code > 255
|
||||||
// is not supported in many others
|
// is not supported in many others
|
||||||
if (exitcode > 125)
|
if (exitcode > 125)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
sWorld.ShutdownServ(delay, 0, exitcode);
|
sWorld.ShutdownServ(delay, 0, exitcode);
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -5397,17 +5401,23 @@ bool ChatHandler::HandleServerRestartCommand(char* args)
|
||||||
{
|
{
|
||||||
uint32 delay;
|
uint32 delay;
|
||||||
if (!ExtractUInt32(&args, delay))
|
if (!ExtractUInt32(&args, delay))
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 exitcode;
|
uint32 exitcode;
|
||||||
if (!ExtractOptUInt32(&args, exitcode, RESTART_EXIT_CODE))
|
if (!ExtractOptUInt32(&args, exitcode, RESTART_EXIT_CODE))
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Exit code should be in range of 0-125, 126-255 is used
|
// Exit code should be in range of 0-125, 126-255 is used
|
||||||
// in many shells for their own return codes and code > 255
|
// in many shells for their own return codes and code > 255
|
||||||
// is not supported in many others
|
// is not supported in many others
|
||||||
if (exitcode > 125)
|
if (exitcode > 125)
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
sWorld.ShutdownServ(delay, SHUTDOWN_MASK_RESTART, exitcode);
|
sWorld.ShutdownServ(delay, SHUTDOWN_MASK_RESTART, exitcode);
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -5417,17 +5427,23 @@ bool ChatHandler::HandleServerIdleRestartCommand(char* args)
|
||||||
{
|
{
|
||||||
uint32 delay;
|
uint32 delay;
|
||||||
if (!ExtractUInt32(&args, delay))
|
if (!ExtractUInt32(&args, delay))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 exitcode;
|
uint32 exitcode;
|
||||||
if (!ExtractOptUInt32(&args, exitcode, RESTART_EXIT_CODE))
|
if (!ExtractOptUInt32(&args, exitcode, RESTART_EXIT_CODE))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Exit code should be in range of 0-125, 126-255 is used
|
// Exit code should be in range of 0-125, 126-255 is used
|
||||||
// in many shells for their own return codes and code > 255
|
// in many shells for their own return codes and code > 255
|
||||||
// is not supported in many others
|
// is not supported in many others
|
||||||
if (exitcode > 125)
|
if (exitcode > 125)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
sWorld.ShutdownServ(delay, SHUTDOWN_MASK_RESTART | SHUTDOWN_MASK_IDLE, exitcode);
|
sWorld.ShutdownServ(delay, SHUTDOWN_MASK_RESTART | SHUTDOWN_MASK_IDLE, exitcode);
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -5437,17 +5453,23 @@ bool ChatHandler::HandleServerIdleShutDownCommand(char* args)
|
||||||
{
|
{
|
||||||
uint32 delay;
|
uint32 delay;
|
||||||
if (!ExtractUInt32(&args, delay))
|
if (!ExtractUInt32(&args, delay))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 exitcode;
|
uint32 exitcode;
|
||||||
if (!ExtractOptUInt32(&args, exitcode, SHUTDOWN_EXIT_CODE))
|
if (!ExtractOptUInt32(&args, exitcode, SHUTDOWN_EXIT_CODE))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Exit code should be in range of 0-125, 126-255 is used
|
// Exit code should be in range of 0-125, 126-255 is used
|
||||||
// in many shells for their own return codes and code > 255
|
// in many shells for their own return codes and code > 255
|
||||||
// is not supported in many others
|
// is not supported in many others
|
||||||
if (exitcode > 125)
|
if (exitcode > 125)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
sWorld.ShutdownServ(delay, SHUTDOWN_MASK_IDLE, exitcode);
|
sWorld.ShutdownServ(delay, SHUTDOWN_MASK_IDLE, exitcode);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,8 @@ void HomeMovementGenerator<Creature>::_setTargetLocation(Creature& owner)
|
||||||
if (owner.GetMotionMaster()->empty() || !owner.GetMotionMaster()->top()->GetResetPosition(owner, x, y, z, o))
|
if (owner.GetMotionMaster()->empty() || !owner.GetMotionMaster()->top()->GetResetPosition(owner, x, y, z, o))
|
||||||
{
|
{
|
||||||
owner.GetRespawnCoord(x, y, z, &o);
|
owner.GetRespawnCoord(x, y, z, &o);
|
||||||
init.SetFacing(o);
|
|
||||||
}
|
}
|
||||||
|
init.SetFacing(o);
|
||||||
init.MoveTo(x, y, z, true);
|
init.MoveTo(x, y, z, true);
|
||||||
init.SetWalk(false);
|
init.SetWalk(false);
|
||||||
init.Launch();
|
init.Launch();
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ PathFinder::PathFinder(const Unit* owner) :
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_PATHFINDING, "++ PathFinder::PathInfo for %u \n", m_sourceUnit->GetGUIDLow());
|
DEBUG_FILTER_LOG(LOG_FILTER_PATHFINDING, "++ PathFinder::PathInfo for %u \n", m_sourceUnit->GetGUIDLow());
|
||||||
|
|
||||||
uint32 mapId = m_sourceUnit->GetMapId();
|
uint32 mapId = m_sourceUnit->GetMapId();
|
||||||
|
|
||||||
if (MMAP::MMapFactory::IsPathfindingEnabled(mapId, owner))
|
if (MMAP::MMapFactory::IsPathfindingEnabled(mapId, owner))
|
||||||
{
|
{
|
||||||
MMAP::MMapManager* mmap = MMAP::MMapFactory::createOrGetMMapManager();
|
MMAP::MMapManager* mmap = MMAP::MMapFactory::createOrGetMMapManager();
|
||||||
|
|
@ -56,15 +57,14 @@ PathFinder::~PathFinder()
|
||||||
|
|
||||||
bool PathFinder::calculate(float destX, float destY, float destZ, bool forceDest)
|
bool PathFinder::calculate(float destX, float destY, float destZ, bool forceDest)
|
||||||
{
|
{
|
||||||
// Vector3 oldDest = getEndPosition();
|
|
||||||
Vector3 dest(destX, destY, destZ);
|
|
||||||
setEndPosition(dest);
|
|
||||||
|
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
m_sourceUnit->GetPosition(x, y, z);
|
m_sourceUnit->GetPosition(x, y, z);
|
||||||
Vector3 start(x, y, z);
|
Vector3 start(x, y, z);
|
||||||
setStartPosition(start);
|
setStartPosition(start);
|
||||||
|
|
||||||
|
Vector3 dest(destX, destY, destZ);
|
||||||
|
setEndPosition(dest);
|
||||||
|
|
||||||
m_forceDestination = forceDest;
|
m_forceDestination = forceDest;
|
||||||
|
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_PATHFINDING, "++ PathFinder::calculate() for %u \n", m_sourceUnit->GetGUIDLow());
|
DEBUG_FILTER_LOG(LOG_FILTER_PATHFINDING, "++ PathFinder::calculate() for %u \n", m_sourceUnit->GetGUIDLow());
|
||||||
|
|
@ -336,14 +336,14 @@ void PathFinder::BuildPolyPath(const Vector3& startPos, const Vector3& endPos)
|
||||||
// generate suffix
|
// generate suffix
|
||||||
uint32 suffixPolyLength = 0;
|
uint32 suffixPolyLength = 0;
|
||||||
dtResult = m_navMeshQuery->findPath(
|
dtResult = m_navMeshQuery->findPath(
|
||||||
suffixStartPoly, // start polygon
|
suffixStartPoly, // start polygon
|
||||||
endPoly, // end polygon
|
endPoly, // end polygon
|
||||||
suffixEndPoint, // start position
|
suffixEndPoint, // start position
|
||||||
endPoint, // end position
|
endPoint, // end position
|
||||||
&m_filter, // polygon search filter
|
&m_filter, // polygon search filter
|
||||||
m_pathPolyRefs + prefixPolyLength - 1, // [out] path
|
m_pathPolyRefs + prefixPolyLength - 1, // [out] path
|
||||||
(int*)&suffixPolyLength,
|
(int*)&suffixPolyLength,
|
||||||
MAX_PATH_LENGTH - prefixPolyLength); // max number of polygons in output path
|
MAX_PATH_LENGTH - prefixPolyLength); // max number of polygons in output path
|
||||||
|
|
||||||
if (!suffixPolyLength || dtStatusFailed(dtResult))
|
if (!suffixPolyLength || dtStatusFailed(dtResult))
|
||||||
{
|
{
|
||||||
|
|
@ -370,14 +370,14 @@ void PathFinder::BuildPolyPath(const Vector3& startPos, const Vector3& endPos)
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
dtResult = m_navMeshQuery->findPath(
|
dtResult = m_navMeshQuery->findPath(
|
||||||
startPoly, // start polygon
|
startPoly, // start polygon
|
||||||
endPoly, // end polygon
|
endPoly, // end polygon
|
||||||
startPoint, // start position
|
startPoint, // start position
|
||||||
endPoint, // end position
|
endPoint, // end position
|
||||||
&m_filter, // polygon search filter
|
&m_filter, // polygon search filter
|
||||||
m_pathPolyRefs, // [out] path
|
m_pathPolyRefs, // [out] path
|
||||||
(int*)&m_polyLength,
|
(int*)&m_polyLength,
|
||||||
MAX_PATH_LENGTH); // max number of polygons in output path
|
MAX_PATH_LENGTH); // max number of polygons in output path
|
||||||
|
|
||||||
if (!m_polyLength || dtStatusFailed(dtResult))
|
if (!m_polyLength || dtStatusFailed(dtResult))
|
||||||
{
|
{
|
||||||
|
|
@ -783,3 +783,23 @@ float PathFinder::dist3DSqr(const Vector3& p1, const Vector3& p2) const
|
||||||
{
|
{
|
||||||
return (p1 - p2).squaredLength();
|
return (p1 - p2).squaredLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PathFinder::NormalizePath(uint32& size)
|
||||||
|
{
|
||||||
|
for (uint32 i = 0; i < m_pathPoints.size(); ++i)
|
||||||
|
{ m_sourceUnit->UpdateAllowedPositionZ(m_pathPoints[i].x, m_pathPoints[i].y, m_pathPoints[i].z); }
|
||||||
|
|
||||||
|
// check if the Z difference between each point is higher than SMOOTH_PATH_HEIGHT.
|
||||||
|
// add another point if that's the case and keep adding new midpoints till the Z difference is low enough
|
||||||
|
for (uint32 i = 1; i < m_pathPoints.size(); ++i)
|
||||||
|
{
|
||||||
|
if ((m_pathPoints[i - 1].z - m_pathPoints[i].z) > SMOOTH_PATH_HEIGHT)
|
||||||
|
{
|
||||||
|
auto midPoint = m_pathPoints[i - 1] + (m_pathPoints[i] - m_pathPoints[i - 1]) / 2.f;
|
||||||
|
m_sourceUnit->UpdateAllowedPositionZ(midPoint.x, midPoint.y, midPoint.z);
|
||||||
|
m_pathPoints.insert(m_pathPoints.begin() + i, midPoint);
|
||||||
|
--i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
size = m_pathPoints.size();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ class Unit;
|
||||||
|
|
||||||
#define SMOOTH_PATH_STEP_SIZE 4.0f
|
#define SMOOTH_PATH_STEP_SIZE 4.0f
|
||||||
#define SMOOTH_PATH_SLOP 0.3f
|
#define SMOOTH_PATH_SLOP 0.3f
|
||||||
|
#define SMOOTH_PATH_HEIGHT 1.0f
|
||||||
|
|
||||||
#define VERTEX_SIZE 3
|
#define VERTEX_SIZE 3
|
||||||
#define INVALID_POLYREF 0
|
#define INVALID_POLYREF 0
|
||||||
|
|
@ -76,6 +77,7 @@ class PathFinder
|
||||||
Vector3 getStartPosition() const { return m_startPosition; }
|
Vector3 getStartPosition() const { return m_startPosition; }
|
||||||
Vector3 getEndPosition() const { return m_endPosition; }
|
Vector3 getEndPosition() const { return m_endPosition; }
|
||||||
Vector3 getActualEndPosition() const { return m_actualEndPosition; }
|
Vector3 getActualEndPosition() const { return m_actualEndPosition; }
|
||||||
|
void NormalizePath(uint32& size);
|
||||||
|
|
||||||
PointsArray& getPath() { return m_pathPoints; }
|
PointsArray& getPath() { return m_pathPoints; }
|
||||||
PathType getPathType() const { return m_type; }
|
PathType getPathType() const { return m_type; }
|
||||||
|
|
@ -102,9 +104,9 @@ class PathFinder
|
||||||
|
|
||||||
dtQueryFilter m_filter; // use single filter for all movements, update it when needed
|
dtQueryFilter m_filter; // use single filter for all movements, update it when needed
|
||||||
|
|
||||||
void setStartPosition(const Vector3& point) { m_startPosition = point; }
|
void setStartPosition(const Vector3 &point) { m_startPosition = point; }
|
||||||
void setEndPosition(const Vector3& point) { m_actualEndPosition = point; m_endPosition = point; }
|
void setEndPosition(const Vector3 &point) { m_actualEndPosition = point; m_endPosition = point; }
|
||||||
void setActualEndPosition(const Vector3& point) { m_actualEndPosition = point; }
|
void setActualEndPosition(const Vector3 &point) { m_actualEndPosition = point; }
|
||||||
|
|
||||||
void clear()
|
void clear()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -70,34 +70,6 @@ void RandomMovementGenerator<Creature>::_setRandomLocation(Creature& creature)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
void RandomMovementGenerator<Creature>::_setRandomLocation(Creature& creature)
|
|
||||||
{
|
|
||||||
const float angle = rand_norm_f() * (M_PI_F * 2.0f);
|
|
||||||
const float range = rand_norm_f() * i_radius;
|
|
||||||
|
|
||||||
float destX = i_x;
|
|
||||||
float destY = i_y;
|
|
||||||
float destZ = i_z;
|
|
||||||
// float destX = i_x + range * cos(angle);
|
|
||||||
// float destY = i_y + range * sin(angle);
|
|
||||||
// float destZ = i_z + frand(-1, 1) * i_verticalZ;
|
|
||||||
creature.UpdateAllowedPositionZ(destX, destY, destZ);
|
|
||||||
|
|
||||||
creature.addUnitState(UNIT_STAT_ROAMING_MOVE);
|
|
||||||
|
|
||||||
Movement::MoveSplineInit init(creature);
|
|
||||||
init.MoveTo(destX, destY, destZ, true);
|
|
||||||
init.SetWalk(true);
|
|
||||||
init.Launch();
|
|
||||||
|
|
||||||
if (creature.CanFly())
|
|
||||||
i_nextMoveTime.Reset(0);
|
|
||||||
else
|
|
||||||
i_nextMoveTime.Reset(urand(500, 10000));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void RandomMovementGenerator<Creature>::Initialize(Creature& creature)
|
void RandomMovementGenerator<Creature>::Initialize(Creature& creature)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,6 @@ class TargetedMovementGeneratorMedium
|
||||||
float i_angle;
|
float i_angle;
|
||||||
bool m_speedChanged : 1;
|
bool m_speedChanged : 1;
|
||||||
bool i_targetReached : 1;
|
bool i_targetReached : 1;
|
||||||
|
|
||||||
PathFinder* i_path;
|
PathFinder* i_path;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -280,7 +280,9 @@ bool WaypointMovementGenerator<Creature>::CanMove(int32 diff, Creature& u)
|
||||||
{
|
{
|
||||||
i_nextMoveTime.Update(diff);
|
i_nextMoveTime.Update(diff);
|
||||||
if (i_nextMoveTime.Passed() && u.hasUnitState(UNIT_STAT_WAYPOINT_PAUSED))
|
if (i_nextMoveTime.Passed() && u.hasUnitState(UNIT_STAT_WAYPOINT_PAUSED))
|
||||||
|
{
|
||||||
i_nextMoveTime.Reset(1);
|
i_nextMoveTime.Reset(1);
|
||||||
|
}
|
||||||
|
|
||||||
return i_nextMoveTime.Passed() && !u.hasUnitState(UNIT_STAT_WAYPOINT_PAUSED);
|
return i_nextMoveTime.Passed() && !u.hasUnitState(UNIT_STAT_WAYPOINT_PAUSED);
|
||||||
}
|
}
|
||||||
|
|
@ -481,7 +483,6 @@ void FlightPathMovementGenerator::DoEventIfAny(Player& player, TaxiPathNodeEntry
|
||||||
StartEvents_Event(player.GetMap(), eventid, &player, &player, departure);
|
StartEvents_Event(player.GetMap(), eventid, &player, &player, departure);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FlightPathMovementGenerator::GetResetPosition(Player&, float& x, float& y, float& z, float& o) const
|
bool FlightPathMovementGenerator::GetResetPosition(Player&, float& x, float& y, float& z, float& o) const
|
||||||
{
|
{
|
||||||
const TaxiPathNodeEntry& node = (*i_path)[i_currentNode];
|
const TaxiPathNodeEntry& node = (*i_path)[i_currentNode];
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ class WaypointMovementGenerator;
|
||||||
template<>
|
template<>
|
||||||
class WaypointMovementGenerator<Creature>
|
class WaypointMovementGenerator<Creature>
|
||||||
: public MovementGeneratorMedium< Creature, WaypointMovementGenerator<Creature> >,
|
: public MovementGeneratorMedium< Creature, WaypointMovementGenerator<Creature> >,
|
||||||
public PathMovementBase<Creature, WaypointPath const*>
|
public PathMovementBase<Creature, WaypointPath const*>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WaypointMovementGenerator(Creature&) : i_nextMoveTime(0), m_isArrivalDone(false), m_lastReachedWaypoint(0) {}
|
WaypointMovementGenerator(Creature&) : i_nextMoveTime(0), m_isArrivalDone(false), m_lastReachedWaypoint(0) {}
|
||||||
|
|
@ -113,7 +113,7 @@ class WaypointMovementGenerator<Creature>
|
||||||
*/
|
*/
|
||||||
class FlightPathMovementGenerator
|
class FlightPathMovementGenerator
|
||||||
: public MovementGeneratorMedium< Player, FlightPathMovementGenerator >,
|
: public MovementGeneratorMedium< Player, FlightPathMovementGenerator >,
|
||||||
public PathMovementBase<Player, TaxiPathNodeList const*>
|
public PathMovementBase<Player, TaxiPathNodeList const*>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit FlightPathMovementGenerator(TaxiPathNodeList const& pathnodes, uint32 startNode = 0)
|
explicit FlightPathMovementGenerator(TaxiPathNodeList const& pathnodes, uint32 startNode = 0)
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef _AUCTION_HOUSE_MGR_H
|
#ifndef MANGOS_H_AUCTION_HOUSE_MGR
|
||||||
#define _AUCTION_HOUSE_MGR_H
|
#define MANGOS_H_AUCTION_HOUSE_MGR
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "DBCStructure.h"
|
#include "DBCStructure.h"
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,7 @@ void Creature::AddToWorld()
|
||||||
|
|
||||||
// Make active if required
|
// Make active if required
|
||||||
if (sWorld.isForceLoadMap(GetMapId()) || (GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_ACTIVE))
|
if (sWorld.isForceLoadMap(GetMapId()) || (GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_ACTIVE))
|
||||||
SetActiveObjectState(true);
|
{ SetActiveObjectState(true); }
|
||||||
|
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
if (!inWorld)
|
if (!inWorld)
|
||||||
|
|
@ -407,7 +407,7 @@ bool Creature::InitEntry(uint32 Entry, CreatureData const* data /*=NULL*/, GameE
|
||||||
bool Creature::UpdateEntry(uint32 Entry, Team team, const CreatureData* data /*=NULL*/, GameEventCreatureData const* eventData /*=NULL*/, bool preserveHPAndPower /*=true*/)
|
bool Creature::UpdateEntry(uint32 Entry, Team team, const CreatureData* data /*=NULL*/, GameEventCreatureData const* eventData /*=NULL*/, bool preserveHPAndPower /*=true*/)
|
||||||
{
|
{
|
||||||
if (!InitEntry(Entry, data, eventData))
|
if (!InitEntry(Entry, data, eventData))
|
||||||
{ return false; }
|
{ return false; }
|
||||||
|
|
||||||
// creatures always have melee weapon ready if any
|
// creatures always have melee weapon ready if any
|
||||||
SetSheath(SHEATH_STATE_MELEE);
|
SetSheath(SHEATH_STATE_MELEE);
|
||||||
|
|
@ -422,9 +422,13 @@ bool Creature::UpdateEntry(uint32 Entry, Team team, const CreatureData* data /*=
|
||||||
SelectLevel();
|
SelectLevel();
|
||||||
|
|
||||||
if (team == HORDE)
|
if (team == HORDE)
|
||||||
{ setFaction(GetCreatureInfo()->FactionHorde); }
|
{
|
||||||
|
setFaction(GetCreatureInfo()->FactionHorde);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ setFaction(GetCreatureInfo()->FactionAlliance); }
|
{
|
||||||
|
setFaction(GetCreatureInfo()->FactionAlliance);
|
||||||
|
}
|
||||||
|
|
||||||
SetUInt32Value(UNIT_NPC_FLAGS, GetCreatureInfo()->NpcFlags);
|
SetUInt32Value(UNIT_NPC_FLAGS, GetCreatureInfo()->NpcFlags);
|
||||||
|
|
||||||
|
|
@ -439,7 +443,9 @@ bool Creature::UpdateEntry(uint32 Entry, Team team, const CreatureData* data /*=
|
||||||
|
|
||||||
// we may need to append or remove additional flags
|
// we may need to append or remove additional flags
|
||||||
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT))
|
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT))
|
||||||
{ unitFlags |= UNIT_FLAG_IN_COMBAT; }
|
{
|
||||||
|
unitFlags |= UNIT_FLAG_IN_COMBAT;
|
||||||
|
}
|
||||||
|
|
||||||
SetUInt32Value(UNIT_FIELD_FLAGS, unitFlags);
|
SetUInt32Value(UNIT_FIELD_FLAGS, unitFlags);
|
||||||
SetUInt32Value(UNIT_FIELD_FLAGS_2, unitFlags2);
|
SetUInt32Value(UNIT_FIELD_FLAGS_2, unitFlags2);
|
||||||
|
|
@ -463,24 +469,34 @@ bool Creature::UpdateEntry(uint32 Entry, Team team, const CreatureData* data /*=
|
||||||
if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(GetCreatureInfo()->FactionAlliance))
|
if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(GetCreatureInfo()->FactionAlliance))
|
||||||
{
|
{
|
||||||
if (factionTemplate->factionFlags & FACTION_TEMPLATE_FLAG_PVP)
|
if (factionTemplate->factionFlags & FACTION_TEMPLATE_FLAG_PVP)
|
||||||
{ SetPvP(true); }
|
{
|
||||||
|
SetPvP(true);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ SetPvP(false); }
|
{
|
||||||
|
SetPvP(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try difficulty dependend version before falling back to base entry
|
// Try difficulty dependend version before falling back to base entry
|
||||||
CreatureTemplateSpells const* templateSpells = sCreatureTemplateSpellsStorage.LookupEntry<CreatureTemplateSpells>(GetCreatureInfo()->Entry);
|
CreatureTemplateSpells const* templateSpells = sCreatureTemplateSpellsStorage.LookupEntry<CreatureTemplateSpells>(GetCreatureInfo()->Entry);
|
||||||
if (!templateSpells)
|
if (!templateSpells)
|
||||||
{ templateSpells = sCreatureTemplateSpellsStorage.LookupEntry<CreatureTemplateSpells>(GetEntry()); }
|
{
|
||||||
|
templateSpells = sCreatureTemplateSpellsStorage.LookupEntry<CreatureTemplateSpells>(GetEntry());
|
||||||
|
}
|
||||||
if (templateSpells)
|
if (templateSpells)
|
||||||
for (int i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
for (int i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
||||||
{ m_spells[i] = templateSpells->spells[i]; }
|
{
|
||||||
|
m_spells[i] = templateSpells->spells[i];
|
||||||
|
}
|
||||||
|
|
||||||
SetVehicleId(GetCreatureInfo()->VehicleTemplateId, 0);
|
SetVehicleId(GetCreatureInfo()->VehicleTemplateId, 0);
|
||||||
|
|
||||||
// if eventData set then event active and need apply spell_start
|
// if eventData set then event active and need apply spell_start
|
||||||
if (eventData)
|
if (eventData)
|
||||||
{ ApplyGameEventSpells(eventData, true); }
|
{
|
||||||
|
ApplyGameEventSpells(eventData, true);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -489,7 +505,9 @@ uint32 Creature::ChooseDisplayId(const CreatureInfo* cinfo, const CreatureData*
|
||||||
{
|
{
|
||||||
// Use creature event model explicit, override any other static models
|
// Use creature event model explicit, override any other static models
|
||||||
if (eventData && eventData->modelid)
|
if (eventData && eventData->modelid)
|
||||||
{ return eventData->modelid; }
|
{
|
||||||
|
return eventData->modelid;
|
||||||
|
}
|
||||||
|
|
||||||
// Use creature model explicit, override template (creature.modelid)
|
// Use creature model explicit, override template (creature.modelid)
|
||||||
if (data && data->modelid_override)
|
if (data && data->modelid_override)
|
||||||
|
|
@ -759,7 +777,9 @@ void Creature::RegeneratePower()
|
||||||
{
|
{
|
||||||
Modifier const* modifier = (*i)->GetModifier();
|
Modifier const* modifier = (*i)->GetModifier();
|
||||||
if (modifier->m_miscvalue == int32(powerType))
|
if (modifier->m_miscvalue == int32(powerType))
|
||||||
|
{
|
||||||
addValue += modifier->m_amount;
|
addValue += modifier->m_amount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AuraList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
|
AuraList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
|
||||||
|
|
@ -767,7 +787,9 @@ void Creature::RegeneratePower()
|
||||||
{
|
{
|
||||||
Modifier const* modifier = (*i)->GetModifier();
|
Modifier const* modifier = (*i)->GetModifier();
|
||||||
if (modifier->m_miscvalue == int32(powerType))
|
if (modifier->m_miscvalue == int32(powerType))
|
||||||
|
{
|
||||||
addValue *= (modifier->m_amount + 100) / 100.0f;
|
addValue *= (modifier->m_amount + 100) / 100.0f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ModifyPower(powerType, int32(addValue));
|
ModifyPower(powerType, int32(addValue));
|
||||||
|
|
@ -823,7 +845,9 @@ void Creature::DoFleeToGetAssistance()
|
||||||
if (!pCreature)
|
if (!pCreature)
|
||||||
{ SetFeared(true, getVictim()->GetObjectGuid(), 0 , sWorld.getConfig(CONFIG_UINT32_CREATURE_FAMILY_FLEE_DELAY)); }
|
{ SetFeared(true, getVictim()->GetObjectGuid(), 0 , sWorld.getConfig(CONFIG_UINT32_CREATURE_FAMILY_FLEE_DELAY)); }
|
||||||
else
|
else
|
||||||
|
{
|
||||||
GetMotionMaster()->MoveSeekAssistance(pCreature->GetPositionX(), pCreature->GetPositionY(), pCreature->GetPositionZ());
|
GetMotionMaster()->MoveSeekAssistance(pCreature->GetPositionX(), pCreature->GetPositionY(), pCreature->GetPositionZ());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1524,18 +1548,18 @@ float Creature::_GetSpellDamageMod(int32 Rank)
|
||||||
{
|
{
|
||||||
switch (Rank) // define rates for each elite rank
|
switch (Rank) // define rates for each elite rank
|
||||||
{
|
{
|
||||||
case CREATURE_ELITE_NORMAL:
|
case CREATURE_ELITE_NORMAL:
|
||||||
return sWorld.getConfig(CONFIG_FLOAT_RATE_CREATURE_NORMAL_SPELLDAMAGE);
|
return sWorld.getConfig(CONFIG_FLOAT_RATE_CREATURE_NORMAL_SPELLDAMAGE);
|
||||||
case CREATURE_ELITE_ELITE:
|
case CREATURE_ELITE_ELITE:
|
||||||
return sWorld.getConfig(CONFIG_FLOAT_RATE_CREATURE_ELITE_ELITE_SPELLDAMAGE);
|
return sWorld.getConfig(CONFIG_FLOAT_RATE_CREATURE_ELITE_ELITE_SPELLDAMAGE);
|
||||||
case CREATURE_ELITE_RAREELITE:
|
case CREATURE_ELITE_RAREELITE:
|
||||||
return sWorld.getConfig(CONFIG_FLOAT_RATE_CREATURE_ELITE_RAREELITE_SPELLDAMAGE);
|
return sWorld.getConfig(CONFIG_FLOAT_RATE_CREATURE_ELITE_RAREELITE_SPELLDAMAGE);
|
||||||
case CREATURE_ELITE_WORLDBOSS:
|
case CREATURE_ELITE_WORLDBOSS:
|
||||||
return sWorld.getConfig(CONFIG_FLOAT_RATE_CREATURE_ELITE_WORLDBOSS_SPELLDAMAGE);
|
return sWorld.getConfig(CONFIG_FLOAT_RATE_CREATURE_ELITE_WORLDBOSS_SPELLDAMAGE);
|
||||||
case CREATURE_ELITE_RARE:
|
case CREATURE_ELITE_RARE:
|
||||||
return sWorld.getConfig(CONFIG_FLOAT_RATE_CREATURE_ELITE_RARE_SPELLDAMAGE);
|
return sWorld.getConfig(CONFIG_FLOAT_RATE_CREATURE_ELITE_RARE_SPELLDAMAGE);
|
||||||
default:
|
default:
|
||||||
return sWorld.getConfig(CONFIG_FLOAT_RATE_CREATURE_ELITE_ELITE_SPELLDAMAGE);
|
return sWorld.getConfig(CONFIG_FLOAT_RATE_CREATURE_ELITE_ELITE_SPELLDAMAGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2187,19 +2211,29 @@ bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction /
|
||||||
bool Creature::CanInitiateAttack()
|
bool Creature::CanInitiateAttack()
|
||||||
{
|
{
|
||||||
if (hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_DIED))
|
if (hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_DIED))
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE))
|
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE))
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (isPassiveToHostile())
|
if (isPassiveToHostile())
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_aggroDelay != 0)
|
if (m_aggroDelay != 0)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!CanAttackByItself())
|
if (!CanAttackByItself())
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -2502,7 +2536,9 @@ bool Creature::HasCategoryCooldown(uint32 spell_id) const
|
||||||
{
|
{
|
||||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell_id);
|
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell_id);
|
||||||
if (!spellInfo)
|
if (!spellInfo)
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
CreatureSpellCooldowns::const_iterator itr = m_CreatureCategoryCooldowns.find(spellInfo->GetCategory());
|
CreatureSpellCooldowns::const_iterator itr = m_CreatureCategoryCooldowns.find(spellInfo->GetCategory());
|
||||||
return (itr != m_CreatureCategoryCooldowns.end() && time_t(itr->second + (spellInfo->GetCategoryRecoveryTime() / IN_MILLISECONDS)) > time(NULL));
|
return (itr != m_CreatureCategoryCooldowns.end() && time_t(itr->second + (spellInfo->GetCategoryRecoveryTime() / IN_MILLISECONDS)) > time(NULL));
|
||||||
|
|
@ -3036,9 +3072,13 @@ void Creature::SetRoot(bool enable)
|
||||||
void Creature::SetWaterWalk(bool enable)
|
void Creature::SetWaterWalk(bool enable)
|
||||||
{
|
{
|
||||||
if (enable)
|
if (enable)
|
||||||
|
{
|
||||||
m_movementInfo.AddMovementFlag(MOVEFLAG_WATERWALKING);
|
m_movementInfo.AddMovementFlag(MOVEFLAG_WATERWALKING);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_movementInfo.RemoveMovementFlag(MOVEFLAG_WATERWALKING);
|
m_movementInfo.RemoveMovementFlag(MOVEFLAG_WATERWALKING);
|
||||||
|
}
|
||||||
|
|
||||||
if (IsInWorld())
|
if (IsInWorld())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -46,24 +46,24 @@ struct GameEventCreatureData;
|
||||||
|
|
||||||
enum CreatureFlagsExtra
|
enum CreatureFlagsExtra
|
||||||
{
|
{
|
||||||
CREATURE_EXTRA_FLAG_INSTANCE_BIND = 0x00000001, // creature kill bind instance with killer and killer's group
|
CREATURE_EXTRA_FLAG_INSTANCE_BIND = 0x00000001, // creature kill bind instance with killer and killer's group
|
||||||
CREATURE_EXTRA_FLAG_CIVILIAN = 0x00000002, // not aggro (ignore faction/reputation hostility)
|
CREATURE_EXTRA_FLAG_CIVILIAN = 0x00000002, // not aggro (ignore faction/reputation hostility)
|
||||||
CREATURE_EXTRA_FLAG_NO_PARRY = 0x00000004, // creature can't parry
|
CREATURE_EXTRA_FLAG_NO_PARRY = 0x00000004, // creature can't parry
|
||||||
CREATURE_EXTRA_FLAG_NO_PARRY_HASTEN = 0x00000008, // creature can't counter-attack at parry
|
CREATURE_EXTRA_FLAG_NO_PARRY_HASTEN = 0x00000008, // creature can't counter-attack at parry
|
||||||
CREATURE_EXTRA_FLAG_NO_BLOCK = 0x00000010, // creature can't block
|
CREATURE_EXTRA_FLAG_NO_BLOCK = 0x00000010, // creature can't block
|
||||||
CREATURE_EXTRA_FLAG_NO_CRUSH = 0x00000020, // creature can't do crush attacks
|
CREATURE_EXTRA_FLAG_NO_CRUSH = 0x00000020, // creature can't do crush attacks
|
||||||
CREATURE_EXTRA_FLAG_NO_XP_AT_KILL = 0x00000040, // creature kill not provide XP
|
CREATURE_EXTRA_FLAG_NO_XP_AT_KILL = 0x00000040, // creature kill not provide XP
|
||||||
CREATURE_EXTRA_FLAG_INVISIBLE = 0x00000080, // creature is always invisible for player (mostly trigger creatures)
|
CREATURE_EXTRA_FLAG_INVISIBLE = 0x00000080, // creature is always invisible for player (mostly trigger creatures)
|
||||||
CREATURE_EXTRA_FLAG_NOT_TAUNTABLE = 0x00000100, // creature is immune to taunt auras and effect attack me
|
CREATURE_EXTRA_FLAG_NOT_TAUNTABLE = 0x00000100, // creature is immune to taunt auras and effect attack me
|
||||||
CREATURE_EXTRA_FLAG_AGGRO_ZONE = 0x00000200, // creature sets itself in combat with zone on aggro
|
CREATURE_EXTRA_FLAG_AGGRO_ZONE = 0x00000200, // creature sets itself in combat with zone on aggro
|
||||||
CREATURE_EXTRA_FLAG_GUARD = 0x00000400, // creature is a guard
|
CREATURE_EXTRA_FLAG_GUARD = 0x00000400, // creature is a guard
|
||||||
CREATURE_EXTRA_FLAG_NO_CALL_ASSIST = 0x00000800, // creature shouldn't call for assistance on aggro
|
CREATURE_EXTRA_FLAG_NO_CALL_ASSIST = 0x00000800, // creature shouldn't call for assistance on aggro
|
||||||
CREATURE_EXTRA_FLAG_ACTIVE = 0x00001000, // creature is active object. Grid of this creature will be loaded and creature set as active
|
CREATURE_EXTRA_FLAG_ACTIVE = 0x00001000, // creature is active object. Grid of this creature will be loaded and creature set as active
|
||||||
CREATURE_EXTRA_FLAG_MMAP_FORCE_ENABLE = 0x00002000, // creature is forced to use MMaps
|
CREATURE_EXTRA_FLAG_MMAP_FORCE_ENABLE = 0x00002000, // creature is forced to use MMaps
|
||||||
CREATURE_EXTRA_FLAG_MMAP_FORCE_DISABLE = 0x00004000, // creature is forced to NOT use MMaps
|
CREATURE_EXTRA_FLAG_MMAP_FORCE_DISABLE = 0x00004000, // creature is forced to NOT use MMaps
|
||||||
CREATURE_EXTRA_FLAG_WALK_IN_WATER = 0x00008000, // creature is forced to walk in water even it can swim
|
CREATURE_EXTRA_FLAG_WALK_IN_WATER = 0x00008000, // creature is forced to walk in water even it can swim
|
||||||
CREATURE_EXTRA_FLAG_HAVE_NO_SWIM_ANIMATION = 0x00010000, // we have to not set "swim" animation or creature will have "no animation"
|
CREATURE_EXTRA_FLAG_HAVE_NO_SWIM_ANIMATION = 0x00010000, // we have to not set "swim" animation or creature will have "no animation"
|
||||||
CREATURE_EXTRA_FLAG_NO_MELEE = 0x00020000, // creature can't melee
|
CREATURE_EXTRA_FLAG_NO_MELEE = 0x00020000, // creature can't melee
|
||||||
};
|
};
|
||||||
|
|
||||||
// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform
|
// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform
|
||||||
|
|
@ -74,8 +74,8 @@ enum CreatureFlagsExtra
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAX_KILL_CREDIT 2
|
#define MAX_KILL_CREDIT 2
|
||||||
#define MAX_CREATURE_MODEL 4
|
#define MAX_CREATURE_MODEL 4 // only single send to client in static data
|
||||||
#define USE_DEFAULT_DATABASE_LEVEL 0 // just used to show we don't want to force the new creature level and use the level stored in db
|
#define USE_DEFAULT_DATABASE_LEVEL 0 // just used to show we don't want to force the new creature level and use the level stored in db
|
||||||
|
|
||||||
// from `creature_template` table
|
// from `creature_template` table
|
||||||
struct CreatureInfo
|
struct CreatureInfo
|
||||||
|
|
@ -263,7 +263,7 @@ struct CreatureModelInfo
|
||||||
float bounding_radius;
|
float bounding_radius;
|
||||||
float combat_reach;
|
float combat_reach;
|
||||||
uint8 gender;
|
uint8 gender;
|
||||||
uint32 modelid_other_gender; // The oposite gender for this modelid (male/female)
|
uint32 modelid_other_gender; // The opposite gender for this modelid (male/female)
|
||||||
uint32 modelid_alternative; // An alternative model. Generally same gender(2)
|
uint32 modelid_alternative; // An alternative model. Generally same gender(2)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,9 @@ CanCastResult CreatureAI::DoCastSpellIfCan(Unit* pTarget, uint32 uiSpell, uint32
|
||||||
CanCastResult castResult = CanCastSpell(pTarget, pSpell, uiCastFlags & CAST_TRIGGERED);
|
CanCastResult castResult = CanCastSpell(pTarget, pSpell, uiCastFlags & CAST_TRIGGERED);
|
||||||
|
|
||||||
if (castResult != CAST_OK)
|
if (castResult != CAST_OK)
|
||||||
{ return castResult; }
|
{
|
||||||
|
return castResult;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interrupt any previous spell
|
// Interrupt any previous spell
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,9 @@
|
||||||
#ifndef MANGOS_CREATUREAI_H
|
#ifndef MANGOS_CREATUREAI_H
|
||||||
#define MANGOS_CREATUREAI_H
|
#define MANGOS_CREATUREAI_H
|
||||||
|
|
||||||
#include "SharedDefines.h"
|
|
||||||
#include "Dynamic/FactoryHolder.h"
|
#include "Dynamic/FactoryHolder.h"
|
||||||
#include "ObjectGuid.h"
|
#include "ObjectGuid.h"
|
||||||
|
#include "SharedDefines.h"
|
||||||
|
|
||||||
class WorldObject;
|
class WorldObject;
|
||||||
class GameObject;
|
class GameObject;
|
||||||
|
|
@ -352,6 +352,7 @@ class CreatureAI
|
||||||
*/
|
*/
|
||||||
virtual void ReceiveAIEvent(AIEventType /*eventType*/, Creature* /*pSender*/, Unit* /*pInvoker*/, uint32 /*miscValue*/) {}
|
virtual void ReceiveAIEvent(AIEventType /*eventType*/, Creature* /*pSender*/, Unit* /*pInvoker*/, uint32 /*miscValue*/) {}
|
||||||
|
|
||||||
|
// Reset should be defined here, as it is called from out the AI ctor now
|
||||||
virtual void Reset() {}
|
virtual void Reset() {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,9 @@ CreatureEventAI::CreatureEventAI(Creature* c) : CreatureAI(c),
|
||||||
// Debug check
|
// Debug check
|
||||||
#ifndef MANGOS_DEBUG
|
#ifndef MANGOS_DEBUG
|
||||||
if (i->event_flags & EFLAG_DEBUG_ONLY)
|
if (i->event_flags & EFLAG_DEBUG_ONLY)
|
||||||
{ continue; }
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (m_creature->GetMap()->IsDungeon())
|
if (m_creature->GetMap()->IsDungeon())
|
||||||
{
|
{
|
||||||
|
|
@ -120,11 +122,11 @@ CreatureEventAI::CreatureEventAI(Creature* c) : CreatureAI(c),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (IsEventFlagsFitForNormalMap(i->event_flags))
|
else if (IsEventFlagsFitForNormalMap(i->event_flags))
|
||||||
++events_count;
|
{ ++events_count; }
|
||||||
}
|
}
|
||||||
// EventMap had events but they were not added because they must be for instance
|
// EventMap had events but they were not added because they must be for instance
|
||||||
if (events_count == 0)
|
if (events_count == 0)
|
||||||
sLog.outErrorEventAI("Creature %u has events but no events added to list because of instance flags (spawned in map %u, difficulty %u).", m_creature->GetEntry(), m_creature->GetMapId(), m_creature->GetMap()->GetDifficulty());
|
{ sLog.outErrorEventAI("Creature %u has events but no events added to list because of instance flags (spawned in map %u, difficulty %u).", m_creature->GetEntry(), m_creature->GetMapId(), m_creature->GetMap()->GetDifficulty()); }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_CreatureEventAIList.reserve(events_count);
|
m_CreatureEventAIList.reserve(events_count);
|
||||||
|
|
@ -133,29 +135,33 @@ CreatureEventAI::CreatureEventAI(Creature* c) : CreatureAI(c),
|
||||||
// Debug check
|
// Debug check
|
||||||
#ifndef MANGOS_DEBUG
|
#ifndef MANGOS_DEBUG
|
||||||
if (i->event_flags & EFLAG_DEBUG_ONLY)
|
if (i->event_flags & EFLAG_DEBUG_ONLY)
|
||||||
{ continue; }
|
{ continue; }
|
||||||
#endif
|
#endif
|
||||||
bool storeEvent = false;
|
bool storeEvent = false;
|
||||||
if (m_creature->GetMap()->IsDungeon())
|
if (m_creature->GetMap()->IsDungeon())
|
||||||
{
|
{
|
||||||
if ((1 << (m_creature->GetMap()->GetSpawnMode() + 1)) & i->event_flags)
|
if ((1 << (m_creature->GetMap()->GetSpawnMode() + 1)) & i->event_flags)
|
||||||
storeEvent = true;
|
{ storeEvent = true; }
|
||||||
}
|
}
|
||||||
else if (IsEventFlagsFitForNormalMap(i->event_flags))
|
else if (IsEventFlagsFitForNormalMap(i->event_flags))
|
||||||
storeEvent = true;
|
{ storeEvent = true; }
|
||||||
|
|
||||||
if (storeEvent)
|
if (storeEvent)
|
||||||
{
|
{
|
||||||
m_CreatureEventAIList.push_back(CreatureEventAIHolder(*i));
|
m_CreatureEventAIList.push_back(CreatureEventAIHolder(*i));
|
||||||
// Cache for fast use
|
// Cache for fast use
|
||||||
if (i->event_type == EVENT_T_OOC_LOS)
|
if (i->event_type == EVENT_T_OOC_LOS)
|
||||||
|
{
|
||||||
m_HasOOCLoSEvent = true;
|
m_HasOOCLoSEvent = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ sLog.outErrorEventAI("EventMap for Creature %u is empty but creature is using CreatureEventAI.", m_creature->GetEntry()); }
|
{
|
||||||
|
sLog.outErrorEventAI("EventMap for Creature %u is empty but creature is using CreatureEventAI.", m_creature->GetEntry());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define LOG_PROCESS_EVENT \
|
#define LOG_PROCESS_EVENT \
|
||||||
|
|
@ -344,6 +350,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
|
||||||
// We don't really care about the whole list, just return first available
|
// We don't really care about the whole list, just return first available
|
||||||
pActionInvoker = *(pList.begin());
|
pActionInvoker = *(pList.begin());
|
||||||
|
|
||||||
|
LOG_PROCESS_EVENT;
|
||||||
// Repeat Timers
|
// Repeat Timers
|
||||||
pHolder.UpdateRepeatTimer(m_creature, event.friendly_is_cc.repeatMin, event.friendly_is_cc.repeatMax);
|
pHolder.UpdateRepeatTimer(m_creature, event.friendly_is_cc.repeatMin, event.friendly_is_cc.repeatMax);
|
||||||
break;
|
break;
|
||||||
|
|
@ -400,7 +407,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
|
||||||
case EVENT_T_AURA:
|
case EVENT_T_AURA:
|
||||||
{
|
{
|
||||||
if (!m_creature->IsInCombat())
|
if (!m_creature->IsInCombat())
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
SpellAuraHolder* holder = m_creature->GetSpellAuraHolder(event.buffed.spellId);
|
SpellAuraHolder* holder = m_creature->GetSpellAuraHolder(event.buffed.spellId);
|
||||||
if (!holder || holder->GetStackAmount() < event.buffed.amount)
|
if (!holder || holder->GetStackAmount() < event.buffed.amount)
|
||||||
|
|
@ -428,7 +435,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
|
||||||
case EVENT_T_MISSING_AURA:
|
case EVENT_T_MISSING_AURA:
|
||||||
{
|
{
|
||||||
if (!m_creature->IsInCombat())
|
if (!m_creature->IsInCombat())
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
SpellAuraHolder* holder = m_creature->GetSpellAuraHolder(event.buffed.spellId);
|
SpellAuraHolder* holder = m_creature->GetSpellAuraHolder(event.buffed.spellId);
|
||||||
if (holder && holder->GetStackAmount() >= event.buffed.amount)
|
if (holder && holder->GetStackAmount() >= event.buffed.amount)
|
||||||
|
|
@ -526,7 +533,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
|
||||||
|
|
||||||
void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 rnd, uint32 EventId, Unit* pActionInvoker, Creature* pAIEventSender)
|
void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 rnd, uint32 EventId, Unit* pActionInvoker, Creature* pAIEventSender)
|
||||||
{
|
{
|
||||||
if (action.type == ACTION_T_NONE)
|
if (action.type == ACTION_T_NONE) //0
|
||||||
{ return; }
|
{ return; }
|
||||||
|
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_EVENT_AI_DEV, "CreatureEventAI: Process action %u (script %u) triggered for %s (invoked by %s)",
|
DEBUG_FILTER_LOG(LOG_FILTER_EVENT_AI_DEV, "CreatureEventAI: Process action %u (script %u) triggered for %s (invoked by %s)",
|
||||||
|
|
@ -535,8 +542,8 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
bool reportTargetError = false;
|
bool reportTargetError = false;
|
||||||
switch (action.type)
|
switch (action.type)
|
||||||
{
|
{
|
||||||
case ACTION_T_TEXT:
|
case ACTION_T_TEXT: //1
|
||||||
case ACTION_T_CHANCED_TEXT:
|
case ACTION_T_CHANCED_TEXT: //44
|
||||||
{
|
{
|
||||||
if (!action.text.TextId[0])
|
if (!action.text.TextId[0])
|
||||||
{ return; }
|
{ return; }
|
||||||
|
|
@ -546,19 +553,19 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
if (action.type == ACTION_T_TEXT)
|
if (action.type == ACTION_T_TEXT)
|
||||||
{
|
{
|
||||||
if (action.text.TextId[1] && action.text.TextId[2])
|
if (action.text.TextId[1] && action.text.TextId[2])
|
||||||
textId = action.text.TextId[rnd % 3];
|
{ textId = action.text.TextId[rnd % 3]; }
|
||||||
else if (action.text.TextId[1] && (rnd % 2))
|
else if (action.text.TextId[1] && (rnd % 2))
|
||||||
{ textId = action.text.TextId[1]; }
|
{ textId = action.text.TextId[1]; }
|
||||||
else
|
else
|
||||||
{ textId = action.text.TextId[0]; }
|
{ textId = action.text.TextId[0]; }
|
||||||
}
|
}
|
||||||
// ACTION_T_CHANCED_TEXT, chance hits
|
// ACTION_T_CHANCED_TEXT, chance hits
|
||||||
else if ((rnd % 100) < action.chanced_text.chance)
|
else if ((rnd % 100) < action.chanced_text.chance)
|
||||||
{
|
{
|
||||||
if (action.chanced_text.TextId[0] && action.chanced_text.TextId[1])
|
if (action.chanced_text.TextId[0] && action.chanced_text.TextId[1])
|
||||||
textId = action.chanced_text.TextId[rnd % 2];
|
{ textId = action.chanced_text.TextId[rnd % 2]; }
|
||||||
else
|
else
|
||||||
{ textId = action.chanced_text.TextId[0]; }
|
{ textId = action.chanced_text.TextId[0]; }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (textId)
|
if (textId)
|
||||||
|
|
@ -588,7 +595,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_T_SET_FACTION:
|
case ACTION_T_SET_FACTION: //2
|
||||||
{
|
{
|
||||||
if (action.set_faction.factionId)
|
if (action.set_faction.factionId)
|
||||||
{ m_creature->SetFactionTemporary(action.set_faction.factionId, action.set_faction.factionFlags); }
|
{ m_creature->SetFactionTemporary(action.set_faction.factionId, action.set_faction.factionFlags); }
|
||||||
|
|
@ -597,7 +604,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_T_MORPH_TO_ENTRY_OR_MODEL:
|
case ACTION_T_MORPH_TO_ENTRY_OR_MODEL: //3
|
||||||
{
|
{
|
||||||
if (action.morph.creatureId || action.morph.modelId)
|
if (action.morph.creatureId || action.morph.modelId)
|
||||||
{
|
{
|
||||||
|
|
@ -618,30 +625,31 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
{ m_creature->DeMorph(); }
|
{ m_creature->DeMorph(); }
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_T_SOUND:
|
case ACTION_T_SOUND: //4
|
||||||
m_creature->PlayDirectSound(action.sound.soundId);
|
m_creature->PlayDirectSound(action.sound.soundId);
|
||||||
break;
|
break;
|
||||||
case ACTION_T_EMOTE:
|
case ACTION_T_EMOTE: //5
|
||||||
m_creature->HandleEmote(action.emote.emoteId);
|
m_creature->HandleEmote(action.emote.emoteId);
|
||||||
break;
|
break;
|
||||||
case ACTION_T_RANDOM_SOUND:
|
case ACTION_T_RANDOM_SOUND: //9
|
||||||
{
|
{
|
||||||
int32 temp = GetRandActionParam(rnd, action.random_sound.soundId1, action.random_sound.soundId2, action.random_sound.soundId3);
|
int32 temp = GetRandActionParam(rnd, action.random_sound.soundId1, action.random_sound.soundId2, action.random_sound.soundId3);
|
||||||
if (temp >= 0)
|
if (temp >= 0)
|
||||||
{ m_creature->PlayDirectSound(temp); }
|
{ m_creature->PlayDirectSound(temp); }
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_T_RANDOM_EMOTE:
|
case ACTION_T_RANDOM_EMOTE: //10
|
||||||
{
|
{
|
||||||
int32 temp = GetRandActionParam(rnd, action.random_emote.emoteId1, action.random_emote.emoteId2, action.random_emote.emoteId3);
|
int32 temp = GetRandActionParam(rnd, action.random_emote.emoteId1, action.random_emote.emoteId2, action.random_emote.emoteId3);
|
||||||
if (temp >= 0)
|
if (temp >= 0)
|
||||||
{ m_creature->HandleEmote(temp); }
|
{ m_creature->HandleEmote(temp); }
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_T_CAST:
|
case ACTION_T_CAST: //11
|
||||||
{
|
{
|
||||||
uint32 selectFlags = 0;
|
uint32 selectFlags = 0;
|
||||||
uint32 spellId = 0;
|
uint32 spellId = 0;
|
||||||
|
|
||||||
if (!(action.cast.castFlags & (CAST_TRIGGERED | CAST_FORCE_CAST | CAST_FORCE_TARGET_SELF)))
|
if (!(action.cast.castFlags & (CAST_TRIGGERED | CAST_FORCE_CAST | CAST_FORCE_TARGET_SELF)))
|
||||||
{
|
{
|
||||||
spellId = action.cast.spellId;
|
spellId = action.cast.spellId;
|
||||||
|
|
@ -711,7 +719,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_T_SUMMON:
|
case ACTION_T_SUMMON: //12
|
||||||
{
|
{
|
||||||
Unit* target = GetTargetByType(action.summon.target, pActionInvoker, pAIEventSender, reportTargetError);
|
Unit* target = GetTargetByType(action.summon.target, pActionInvoker, pAIEventSender, reportTargetError);
|
||||||
if (!target && reportTargetError)
|
if (!target && reportTargetError)
|
||||||
|
|
@ -730,13 +738,13 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
{ pCreature->AI()->AttackStart(target); }
|
{ pCreature->AI()->AttackStart(target); }
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_T_THREAT_SINGLE_PCT:
|
case ACTION_T_THREAT_SINGLE_PCT: //13
|
||||||
if (Unit* target = GetTargetByType(action.threat_single_pct.target, pActionInvoker, pAIEventSender, reportTargetError))
|
if (Unit* target = GetTargetByType(action.threat_single_pct.target, pActionInvoker, pAIEventSender, reportTargetError))
|
||||||
{ m_creature->GetThreatManager().modifyThreatPercent(target, action.threat_single_pct.percent); }
|
{ m_creature->GetThreatManager().modifyThreatPercent(target, action.threat_single_pct.percent); }
|
||||||
else if (reportTargetError)
|
else if (reportTargetError)
|
||||||
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_THREAT_SINGLE_PCT(%u), target-type %u", EventId, action.type, action.threat_single_pct.target); }
|
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_THREAT_SINGLE_PCT(%u), target-type %u", EventId, action.type, action.threat_single_pct.target); }
|
||||||
break;
|
break;
|
||||||
case ACTION_T_THREAT_ALL_PCT:
|
case ACTION_T_THREAT_ALL_PCT: //14
|
||||||
{
|
{
|
||||||
ThreatList const& threatList = m_creature->GetThreatManager().getThreatList();
|
ThreatList const& threatList = m_creature->GetThreatManager().getThreatList();
|
||||||
for (ThreatList::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
|
for (ThreatList::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
|
||||||
|
|
@ -744,7 +752,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
{ m_creature->GetThreatManager().modifyThreatPercent(Temp, action.threat_all_pct.percent); }
|
{ m_creature->GetThreatManager().modifyThreatPercent(Temp, action.threat_all_pct.percent); }
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_T_QUEST_EVENT:
|
case ACTION_T_QUEST_EVENT: //15
|
||||||
if (Unit* target = GetTargetByType(action.quest_event.target, pActionInvoker, pAIEventSender, reportTargetError))
|
if (Unit* target = GetTargetByType(action.quest_event.target, pActionInvoker, pAIEventSender, reportTargetError))
|
||||||
{
|
{
|
||||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||||
|
|
@ -753,7 +761,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
else if (reportTargetError)
|
else if (reportTargetError)
|
||||||
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_QUEST_EVENT(%u), target-type %u", EventId, action.type, action.quest_event.target); }
|
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_QUEST_EVENT(%u), target-type %u", EventId, action.type, action.quest_event.target); }
|
||||||
break;
|
break;
|
||||||
case ACTION_T_CAST_EVENT:
|
case ACTION_T_CAST_EVENT: //16
|
||||||
if (Unit* target = GetTargetByType(action.cast_event.target, pActionInvoker, pAIEventSender, reportTargetError, 0, SELECT_FLAG_PLAYER))
|
if (Unit* target = GetTargetByType(action.cast_event.target, pActionInvoker, pAIEventSender, reportTargetError, 0, SELECT_FLAG_PLAYER))
|
||||||
{
|
{
|
||||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||||
|
|
@ -762,7 +770,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
else if (reportTargetError)
|
else if (reportTargetError)
|
||||||
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_CST_EVENT(%u), target-type %u", EventId, action.type, action.cast_event.target); }
|
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_CST_EVENT(%u), target-type %u", EventId, action.type, action.cast_event.target); }
|
||||||
break;
|
break;
|
||||||
case ACTION_T_SET_UNIT_FIELD:
|
case ACTION_T_SET_UNIT_FIELD: //17
|
||||||
{
|
{
|
||||||
Unit* target = GetTargetByType(action.set_unit_field.target, pActionInvoker, pAIEventSender, reportTargetError);
|
Unit* target = GetTargetByType(action.set_unit_field.target, pActionInvoker, pAIEventSender, reportTargetError);
|
||||||
|
|
||||||
|
|
@ -775,21 +783,21 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_T_SET_UNIT_FLAG:
|
case ACTION_T_SET_UNIT_FLAG: //18
|
||||||
if (Unit* target = GetTargetByType(action.unit_flag.target, pActionInvoker, pAIEventSender, reportTargetError))
|
if (Unit* target = GetTargetByType(action.unit_flag.target, pActionInvoker, pAIEventSender, reportTargetError))
|
||||||
{ target->SetFlag(UNIT_FIELD_FLAGS, action.unit_flag.value); }
|
{ target->SetFlag(UNIT_FIELD_FLAGS, action.unit_flag.value); }
|
||||||
else if (reportTargetError)
|
else if (reportTargetError)
|
||||||
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_SET_UNIT_FLAG(%u), target-type %u", EventId, action.type, action.unit_flag.target); }
|
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_SET_UNIT_FLAG(%u), target-type %u", EventId, action.type, action.unit_flag.target); }
|
||||||
break;
|
break;
|
||||||
case ACTION_T_REMOVE_UNIT_FLAG:
|
case ACTION_T_REMOVE_UNIT_FLAG: //19
|
||||||
if (Unit* target = GetTargetByType(action.unit_flag.target, pActionInvoker, pAIEventSender, reportTargetError))
|
if (Unit* target = GetTargetByType(action.unit_flag.target, pActionInvoker, pAIEventSender, reportTargetError))
|
||||||
{ target->RemoveFlag(UNIT_FIELD_FLAGS, action.unit_flag.value); }
|
{ target->RemoveFlag(UNIT_FIELD_FLAGS, action.unit_flag.value); }
|
||||||
else if (reportTargetError)
|
else if (reportTargetError)
|
||||||
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_REMOVE_UNIT_FLAG(%u), target-type %u", EventId, action.type, action.unit_flag.target); }
|
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_REMOVE_UNIT_FLAG(%u), target-type %u", EventId, action.type, action.unit_flag.target); }
|
||||||
case ACTION_T_AUTO_ATTACK:
|
case ACTION_T_AUTO_ATTACK: //20
|
||||||
m_MeleeEnabled = action.auto_attack.state != 0;
|
m_MeleeEnabled = action.auto_attack.state != 0;
|
||||||
break;
|
break;
|
||||||
case ACTION_T_COMBAT_MOVEMENT:
|
case ACTION_T_COMBAT_MOVEMENT: //21
|
||||||
// ignore no affect case
|
// ignore no affect case
|
||||||
if (m_isCombatMovement == (action.combat_movement.state != 0) || m_creature->IsNonMeleeSpellCasted(false))
|
if (m_isCombatMovement == (action.combat_movement.state != 0) || m_creature->IsNonMeleeSpellCasted(false))
|
||||||
{ return; }
|
{ return; }
|
||||||
|
|
@ -801,11 +809,11 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
else if (action.combat_movement.melee && m_creature->IsInCombat() && m_creature->getVictim())
|
else if (action.combat_movement.melee && m_creature->IsInCombat() && m_creature->getVictim())
|
||||||
{ m_creature->SendMeleeAttackStop(m_creature->getVictim()); }
|
{ m_creature->SendMeleeAttackStop(m_creature->getVictim()); }
|
||||||
break;
|
break;
|
||||||
case ACTION_T_SET_PHASE:
|
case ACTION_T_SET_PHASE: //22
|
||||||
m_Phase = action.set_phase.phase;
|
m_Phase = action.set_phase.phase;
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_EVENT_AI_DEV, "CreatureEventAI: ACTION_T_SET_PHASE - script %u for %s, phase is now %u", EventId, m_creature->GetGuidStr().c_str(), m_Phase);
|
DEBUG_FILTER_LOG(LOG_FILTER_EVENT_AI_DEV, "CreatureEventAI: ACTION_T_SET_PHASE - script %u for %s, phase is now %u", EventId, m_creature->GetGuidStr().c_str(), m_Phase);
|
||||||
break;
|
break;
|
||||||
case ACTION_T_INC_PHASE:
|
case ACTION_T_INC_PHASE: //23
|
||||||
{
|
{
|
||||||
int32 new_phase = int32(m_Phase) + action.set_inc_phase.step;
|
int32 new_phase = int32(m_Phase) + action.set_inc_phase.step;
|
||||||
if (new_phase < 0)
|
if (new_phase < 0)
|
||||||
|
|
@ -824,13 +832,13 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_EVENT_AI_DEV, "CreatureEventAI: ACTION_T_INC_PHASE - script %u for %s, phase is now %u", EventId, m_creature->GetGuidStr().c_str(), m_Phase);
|
DEBUG_FILTER_LOG(LOG_FILTER_EVENT_AI_DEV, "CreatureEventAI: ACTION_T_INC_PHASE - script %u for %s, phase is now %u", EventId, m_creature->GetGuidStr().c_str(), m_Phase);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_T_EVADE:
|
case ACTION_T_EVADE: //24
|
||||||
EnterEvadeMode();
|
EnterEvadeMode();
|
||||||
break;
|
break;
|
||||||
case ACTION_T_FLEE_FOR_ASSIST:
|
case ACTION_T_FLEE_FOR_ASSIST: //25
|
||||||
m_creature->DoFleeToGetAssistance();
|
m_creature->DoFleeToGetAssistance();
|
||||||
break;
|
break;
|
||||||
case ACTION_T_QUEST_EVENT_ALL:
|
case ACTION_T_QUEST_EVENT_ALL: //26
|
||||||
if (action.quest_event_all.useThreatList)
|
if (action.quest_event_all.useThreatList)
|
||||||
{
|
{
|
||||||
ThreatList const& threatList = m_creature->GetThreatManager().getThreatList();
|
ThreatList const& threatList = m_creature->GetThreatManager().getThreatList();
|
||||||
|
|
@ -841,7 +849,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
else if (pActionInvoker && pActionInvoker->GetTypeId() == TYPEID_PLAYER)
|
else if (pActionInvoker && pActionInvoker->GetTypeId() == TYPEID_PLAYER)
|
||||||
{ ((Player*)pActionInvoker)->GroupEventHappens(action.quest_event_all.questId, m_creature); }
|
{ ((Player*)pActionInvoker)->GroupEventHappens(action.quest_event_all.questId, m_creature); }
|
||||||
break;
|
break;
|
||||||
case ACTION_T_CAST_EVENT_ALL:
|
case ACTION_T_CAST_EVENT_ALL: //27
|
||||||
{
|
{
|
||||||
ThreatList const& threatList = m_creature->GetThreatManager().getThreatList();
|
ThreatList const& threatList = m_creature->GetThreatManager().getThreatList();
|
||||||
for (ThreatList::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
|
for (ThreatList::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
|
||||||
|
|
@ -849,13 +857,13 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
{ temp->CastedCreatureOrGO(action.cast_event_all.creatureId, m_creature->GetObjectGuid(), action.cast_event_all.spellId); }
|
{ temp->CastedCreatureOrGO(action.cast_event_all.creatureId, m_creature->GetObjectGuid(), action.cast_event_all.spellId); }
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_T_REMOVEAURASFROMSPELL:
|
case ACTION_T_REMOVEAURASFROMSPELL: //28
|
||||||
if (Unit* target = GetTargetByType(action.remove_aura.target, pActionInvoker, pAIEventSender, reportTargetError))
|
if (Unit* target = GetTargetByType(action.remove_aura.target, pActionInvoker, pAIEventSender, reportTargetError))
|
||||||
{ target->RemoveAurasDueToSpell(action.remove_aura.spellId); }
|
{ target->RemoveAurasDueToSpell(action.remove_aura.spellId); }
|
||||||
else if (reportTargetError)
|
else if (reportTargetError)
|
||||||
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_REMOVEAURASFROMSPELL(%u), target-type %u", EventId, action.type, action.remove_aura.target); }
|
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_REMOVEAURASFROMSPELL(%u), target-type %u", EventId, action.type, action.remove_aura.target); }
|
||||||
break;
|
break;
|
||||||
case ACTION_T_RANGED_MOVEMENT:
|
case ACTION_T_RANGED_MOVEMENT: //29
|
||||||
m_attackDistance = (float)action.ranged_movement.distance;
|
m_attackDistance = (float)action.ranged_movement.distance;
|
||||||
m_attackAngle = action.ranged_movement.angle / 180.0f * M_PI_F;
|
m_attackAngle = action.ranged_movement.angle / 180.0f * M_PI_F;
|
||||||
|
|
||||||
|
|
@ -869,17 +877,17 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_T_RANDOM_PHASE:
|
case ACTION_T_RANDOM_PHASE: //30
|
||||||
m_Phase = GetRandActionParam(rnd, action.random_phase.phase1, action.random_phase.phase2, action.random_phase.phase3);
|
m_Phase = GetRandActionParam(rnd, action.random_phase.phase1, action.random_phase.phase2, action.random_phase.phase3);
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_EVENT_AI_DEV, "CreatureEventAI: ACTION_T_RANDOM_PHASE - script %u for %s, phase is now %u", EventId, m_creature->GetGuidStr().c_str(), m_Phase);
|
DEBUG_FILTER_LOG(LOG_FILTER_EVENT_AI_DEV, "CreatureEventAI: ACTION_T_RANDOM_PHASE - script %u for %s, phase is now %u", EventId, m_creature->GetGuidStr().c_str(), m_Phase);
|
||||||
break;
|
break;
|
||||||
case ACTION_T_RANDOM_PHASE_RANGE:
|
case ACTION_T_RANDOM_PHASE_RANGE: //31
|
||||||
if (action.random_phase_range.phaseMax > action.random_phase_range.phaseMin)
|
if (action.random_phase_range.phaseMax > action.random_phase_range.phaseMin)
|
||||||
{ m_Phase = action.random_phase_range.phaseMin + (rnd % (action.random_phase_range.phaseMax - action.random_phase_range.phaseMin)); }
|
{ m_Phase = action.random_phase_range.phaseMin + (rnd % (action.random_phase_range.phaseMax - action.random_phase_range.phaseMin)); }
|
||||||
else
|
else
|
||||||
{ sLog.outErrorEventAI("ACTION_T_RANDOM_PHASE_RANGE can not have Param2 <= Param1. Divide by Zero. Event = %d. CreatureEntry = %d", EventId, m_creature->GetEntry()); }
|
{ sLog.outErrorEventAI("ACTION_T_RANDOM_PHASE_RANGE can not have Param2 <= Param1. Divide by Zero. Event = %d. CreatureEntry = %d", EventId, m_creature->GetEntry()); }
|
||||||
break;
|
break;
|
||||||
case ACTION_T_SUMMON_ID:
|
case ACTION_T_SUMMON_ID: //32
|
||||||
{
|
{
|
||||||
Unit* target = GetTargetByType(action.summon_id.target, pActionInvoker, pAIEventSender, reportTargetError);
|
Unit* target = GetTargetByType(action.summon_id.target, pActionInvoker, pAIEventSender, reportTargetError);
|
||||||
if (!target && reportTargetError)
|
if (!target && reportTargetError)
|
||||||
|
|
@ -894,9 +902,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
|
|
||||||
Creature* pCreature = NULL;
|
Creature* pCreature = NULL;
|
||||||
if ((*i).second.SpawnTimeSecs)
|
if ((*i).second.SpawnTimeSecs)
|
||||||
pCreature = m_creature->SummonCreature(action.summon_id.creatureId, i->second.position_x, i->second.position_y, i->second.position_z, i->second.orientation, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, i->second.SpawnTimeSecs);
|
{ pCreature = m_creature->SummonCreature(action.summon_id.creatureId, i->second.position_x, i->second.position_y, i->second.position_z, i->second.orientation, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, i->second.SpawnTimeSecs); }
|
||||||
else
|
else
|
||||||
pCreature = m_creature->SummonCreature(action.summon_id.creatureId, i->second.position_x, i->second.position_y, i->second.position_z, i->second.orientation, TEMPSUMMON_TIMED_OOC_DESPAWN, 0);
|
{ pCreature = m_creature->SummonCreature(action.summon_id.creatureId, i->second.position_x, i->second.position_y, i->second.position_z, i->second.orientation, TEMPSUMMON_TIMED_OOC_DESPAWN, 0); }
|
||||||
|
|
||||||
if (!pCreature)
|
if (!pCreature)
|
||||||
{ sLog.outErrorEventAI("failed to spawn creature %u. EventId %d.Creature %d", action.summon_id.creatureId, EventId, m_creature->GetEntry()); }
|
{ sLog.outErrorEventAI("failed to spawn creature %u. EventId %d.Creature %d", action.summon_id.creatureId, EventId, m_creature->GetEntry()); }
|
||||||
|
|
@ -905,7 +913,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_T_KILLED_MONSTER:
|
case ACTION_T_KILLED_MONSTER: //33
|
||||||
// first attempt player/group who tapped creature
|
// first attempt player/group who tapped creature
|
||||||
if (Player* pPlayer = m_creature->GetLootRecipient())
|
if (Player* pPlayer = m_creature->GetLootRecipient())
|
||||||
{ pPlayer->RewardPlayerAndGroupAtEvent(action.killed_monster.creatureId, m_creature); }
|
{ pPlayer->RewardPlayerAndGroupAtEvent(action.killed_monster.creatureId, m_creature); }
|
||||||
|
|
@ -921,7 +929,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_KILLED_MONSTER(%u), target-type %u", EventId, action.type, action.killed_monster.target); }
|
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_KILLED_MONSTER(%u), target-type %u", EventId, action.type, action.killed_monster.target); }
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_T_SET_INST_DATA:
|
case ACTION_T_SET_INST_DATA: //34
|
||||||
{
|
{
|
||||||
InstanceData* pInst = m_creature->GetInstanceData();
|
InstanceData* pInst = m_creature->GetInstanceData();
|
||||||
if (!pInst)
|
if (!pInst)
|
||||||
|
|
@ -933,7 +941,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
pInst->SetData(action.set_inst_data.field, action.set_inst_data.value);
|
pInst->SetData(action.set_inst_data.field, action.set_inst_data.value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_T_SET_INST_DATA64:
|
case ACTION_T_SET_INST_DATA64: //35
|
||||||
{
|
{
|
||||||
Unit* target = GetTargetByType(action.set_inst_data64.target, pActionInvoker, pAIEventSender, reportTargetError);
|
Unit* target = GetTargetByType(action.set_inst_data64.target, pActionInvoker, pAIEventSender, reportTargetError);
|
||||||
if (!target)
|
if (!target)
|
||||||
|
|
@ -953,7 +961,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
pInst->SetData64(action.set_inst_data64.field, target->GetObjectGuid().GetRawValue());
|
pInst->SetData64(action.set_inst_data64.field, target->GetObjectGuid().GetRawValue());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_T_UPDATE_TEMPLATE:
|
case ACTION_T_UPDATE_TEMPLATE: //36
|
||||||
if (m_creature->GetEntry() == action.update_template.creatureId)
|
if (m_creature->GetEntry() == action.update_template.creatureId)
|
||||||
{
|
{
|
||||||
sLog.outErrorEventAI("Event %d ACTION_T_UPDATE_TEMPLATE call with param1 == current entry. Creature %d", EventId, m_creature->GetEntry());
|
sLog.outErrorEventAI("Event %d ACTION_T_UPDATE_TEMPLATE call with param1 == current entry. Creature %d", EventId, m_creature->GetEntry());
|
||||||
|
|
@ -962,7 +970,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
|
|
||||||
m_creature->UpdateEntry(action.update_template.creatureId, action.update_template.team ? HORDE : ALLIANCE);
|
m_creature->UpdateEntry(action.update_template.creatureId, action.update_template.team ? HORDE : ALLIANCE);
|
||||||
break;
|
break;
|
||||||
case ACTION_T_DIE:
|
case ACTION_T_DIE: //37
|
||||||
if (m_creature->IsDead())
|
if (m_creature->IsDead())
|
||||||
{
|
{
|
||||||
sLog.outErrorEventAI("Event %d ACTION_T_DIE on dead creature. Creature %d", EventId, m_creature->GetEntry());
|
sLog.outErrorEventAI("Event %d ACTION_T_DIE on dead creature. Creature %d", EventId, m_creature->GetEntry());
|
||||||
|
|
@ -970,27 +978,27 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
}
|
}
|
||||||
m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
|
m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
|
||||||
break;
|
break;
|
||||||
case ACTION_T_ZONE_COMBAT_PULSE:
|
case ACTION_T_ZONE_COMBAT_PULSE: //38
|
||||||
{
|
{
|
||||||
m_creature->SetInCombatWithZone();
|
m_creature->SetInCombatWithZone();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_T_CALL_FOR_HELP:
|
case ACTION_T_CALL_FOR_HELP: //39
|
||||||
{
|
{
|
||||||
m_creature->CallForHelp((float)action.call_for_help.radius);
|
m_creature->CallForHelp((float)action.call_for_help.radius);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_T_SET_SHEATH:
|
case ACTION_T_SET_SHEATH: //40
|
||||||
{
|
{
|
||||||
m_creature->SetSheath(SheathState(action.set_sheath.sheath));
|
m_creature->SetSheath(SheathState(action.set_sheath.sheath));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_T_FORCE_DESPAWN:
|
case ACTION_T_FORCE_DESPAWN: //41
|
||||||
{
|
{
|
||||||
m_creature->ForcedDespawn(action.forced_despawn.msDelay);
|
m_creature->ForcedDespawn(action.forced_despawn.msDelay);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_T_SET_INVINCIBILITY_HP_LEVEL:
|
case ACTION_T_SET_INVINCIBILITY_HP_LEVEL: //42
|
||||||
{
|
{
|
||||||
if (action.invincibility_hp_level.is_percent)
|
if (action.invincibility_hp_level.is_percent)
|
||||||
{ m_InvinceabilityHpLevel = m_creature->GetMaxHealth() * action.invincibility_hp_level.hp_level / 100; }
|
{ m_InvinceabilityHpLevel = m_creature->GetMaxHealth() * action.invincibility_hp_level.hp_level / 100; }
|
||||||
|
|
@ -998,7 +1006,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
{ m_InvinceabilityHpLevel = action.invincibility_hp_level.hp_level; }
|
{ m_InvinceabilityHpLevel = action.invincibility_hp_level.hp_level; }
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_T_MOUNT_TO_ENTRY_OR_MODEL:
|
case ACTION_T_MOUNT_TO_ENTRY_OR_MODEL: //43
|
||||||
{
|
{
|
||||||
if (action.mount.creatureId || action.mount.modelId)
|
if (action.mount.creatureId || action.mount.modelId)
|
||||||
{
|
{
|
||||||
|
|
@ -1020,34 +1028,34 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_T_THROW_AI_EVENT:
|
case ACTION_T_THROW_AI_EVENT: //45
|
||||||
{
|
{
|
||||||
SendAIEventAround(AIEventType(action.throwEvent.eventType), pActionInvoker, 0, action.throwEvent.radius);
|
SendAIEventAround(AIEventType(action.throwEvent.eventType), pActionInvoker, 0, action.throwEvent.radius);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_T_SET_THROW_MASK:
|
case ACTION_T_SET_THROW_MASK: //46
|
||||||
{
|
{
|
||||||
m_throwAIEventMask = action.setThrowMask.eventTypeMask;
|
m_throwAIEventMask = action.setThrowMask.eventTypeMask;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_T_SET_STAND_STATE:
|
case ACTION_T_SET_STAND_STATE: //47
|
||||||
{
|
{
|
||||||
m_creature->SetStandState(action.setStandState.standState);
|
m_creature->SetStandState(action.setStandState.standState);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_T_CHANGE_MOVEMENT:
|
case ACTION_T_CHANGE_MOVEMENT: //48
|
||||||
{
|
{
|
||||||
switch (action.changeMovement.movementType)
|
switch (action.changeMovement.movementType)
|
||||||
{
|
{
|
||||||
case IDLE_MOTION_TYPE:
|
case IDLE_MOTION_TYPE:
|
||||||
m_creature->GetMotionMaster()->MoveIdle();
|
m_creature->GetMotionMaster()->MoveIdle();
|
||||||
break;
|
break;
|
||||||
case RANDOM_MOTION_TYPE:
|
case RANDOM_MOTION_TYPE:
|
||||||
m_creature->GetMotionMaster()->MoveRandomAroundPoint(m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), float(action.changeMovement.wanderDistance));
|
m_creature->GetMotionMaster()->MoveRandomAroundPoint(m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), float(action.changeMovement.wanderDistance));
|
||||||
break;
|
break;
|
||||||
case WAYPOINT_MOTION_TYPE:
|
case WAYPOINT_MOTION_TYPE:
|
||||||
m_creature->GetMotionMaster()->MoveWaypoint();
|
m_creature->GetMotionMaster()->MoveWaypoint();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -1104,10 +1112,10 @@ void CreatureEventAI::Reset()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
// TODO: enable below code line / verify this is correct to enable events previously disabled (ex. aggro yell), instead of enable this in void Aggro()
|
// TODO: enable below code line / verify this is correct to enable events previously disabled (ex. aggro yell), instead of enable this in void Aggro()
|
||||||
//i->Enabled = true;
|
//i->Enabled = true;
|
||||||
//i->Time = 0;
|
//i->Time = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1234,7 +1242,7 @@ void CreatureEventAI::EnterCombat(Unit* enemy)
|
||||||
// Reset all in combat timers
|
// Reset all in combat timers
|
||||||
case EVENT_T_TIMER_IN_COMBAT:
|
case EVENT_T_TIMER_IN_COMBAT:
|
||||||
if (i->UpdateRepeatTimer(m_creature, event.timer.initialMin, event.timer.initialMax))
|
if (i->UpdateRepeatTimer(m_creature, event.timer.initialMin, event.timer.initialMax))
|
||||||
i->Enabled = true;
|
{ i->Enabled = true; }
|
||||||
break;
|
break;
|
||||||
// All normal events need to be re-enabled and their time set to 0
|
// All normal events need to be re-enabled and their time set to 0
|
||||||
default:
|
default:
|
||||||
|
|
@ -1280,11 +1288,11 @@ void CreatureEventAI::MoveInLineOfSight(Unit* who)
|
||||||
|
|
||||||
// if friendly event && who is not hostile OR hostile event && who is hostile
|
// if friendly event && who is not hostile OR hostile event && who is hostile
|
||||||
if ((itr->Event.ooc_los.noHostile && !m_creature->IsHostileTo(who)) ||
|
if ((itr->Event.ooc_los.noHostile && !m_creature->IsHostileTo(who)) ||
|
||||||
((!itr->Event.ooc_los.noHostile) && m_creature->IsHostileTo(who)))
|
((!itr->Event.ooc_los.noHostile) && m_creature->IsHostileTo(who)))
|
||||||
{
|
{
|
||||||
// if range is ok and we are actually in LOS
|
// if range is ok and we are actually in LOS
|
||||||
if (m_creature->IsWithinDistInMap(who, fMaxAllowedRange) && m_creature->IsWithinLOSInMap(who))
|
if (m_creature->IsWithinDistInMap(who, fMaxAllowedRange) && m_creature->IsWithinLOSInMap(who))
|
||||||
ProcessEvent(*itr, who);
|
{ ProcessEvent(*itr, who); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1344,7 +1352,7 @@ void CreatureEventAI::UpdateAI(const uint32 diff)
|
||||||
{
|
{
|
||||||
if (i->Time > m_EventDiff)
|
if (i->Time > m_EventDiff)
|
||||||
{
|
{
|
||||||
// Do not decrement timers if event can not trigger in this phase
|
// Do not decrement timers if event cannot trigger in this phase
|
||||||
if (!(i->Event.event_inverse_phase_mask & (1 << m_Phase)))
|
if (!(i->Event.event_inverse_phase_mask & (1 << m_Phase)))
|
||||||
i->Time -= m_EventDiff;
|
i->Time -= m_EventDiff;
|
||||||
}
|
}
|
||||||
|
|
@ -1388,7 +1396,7 @@ void CreatureEventAI::UpdateAI(const uint32 diff)
|
||||||
}
|
}
|
||||||
else if (m_MeleeEnabled && m_creature->CanReachWithMeleeAttack(victim)
|
else if (m_MeleeEnabled && m_creature->CanReachWithMeleeAttack(victim)
|
||||||
&& !(m_creature->GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_NO_MELEE))
|
&& !(m_creature->GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_NO_MELEE))
|
||||||
DoMeleeAttackIfReady();
|
{ DoMeleeAttackIfReady(); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1520,7 +1528,7 @@ void CreatureEventAI::ReceiveEmote(Player* pPlayer, uint32 text_emote)
|
||||||
if (itr->Event.event_type == EVENT_T_RECEIVE_EMOTE)
|
if (itr->Event.event_type == EVENT_T_RECEIVE_EMOTE)
|
||||||
{
|
{
|
||||||
if (itr->Event.receive_emote.emoteId != text_emote)
|
if (itr->Event.receive_emote.emoteId != text_emote)
|
||||||
continue;
|
{ continue; }
|
||||||
|
|
||||||
PlayerCondition pcon(0, itr->Event.receive_emote.condition, itr->Event.receive_emote.conditionValue1, itr->Event.receive_emote.conditionValue2);
|
PlayerCondition pcon(0, itr->Event.receive_emote.condition, itr->Event.receive_emote.conditionValue1, itr->Event.receive_emote.conditionValue2);
|
||||||
if (pcon.Meets(pPlayer, m_creature->GetMap(), m_creature, CONDITION_FROM_EVENTAI))
|
if (pcon.Meets(pPlayer, m_creature->GetMap(), m_creature, CONDITION_FROM_EVENTAI))
|
||||||
|
|
@ -1532,7 +1540,7 @@ void CreatureEventAI::ReceiveEmote(Player* pPlayer, uint32 text_emote)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define HEALTH_STEPS 3
|
#define HEALTH_STEPS 3
|
||||||
|
|
||||||
void CreatureEventAI::DamageTaken(Unit* dealer, uint32& damage)
|
void CreatureEventAI::DamageTaken(Unit* dealer, uint32& damage)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ enum EventAI_ActionType
|
||||||
ACTION_T_CHANGE_MOVEMENT = 48, // MovementType, WanderDistance, unused
|
ACTION_T_CHANGE_MOVEMENT = 48, // MovementType, WanderDistance, unused
|
||||||
ACTION_T_DYNAMIC_MOVEMENT = 49, // EnableDynamicMovement (1 = on; 0 = off)
|
ACTION_T_DYNAMIC_MOVEMENT = 49, // EnableDynamicMovement (1 = on; 0 = off)
|
||||||
|
|
||||||
ACTION_T_END,
|
ACTION_T_END
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Target
|
enum Target
|
||||||
|
|
@ -150,7 +150,9 @@ enum Target
|
||||||
|
|
||||||
// Hostile targets (including pets)
|
// Hostile targets (including pets)
|
||||||
TARGET_T_HOSTILE_RANDOM_PLAYER = 8, // Just any random player on our threat list
|
TARGET_T_HOSTILE_RANDOM_PLAYER = 8, // Just any random player on our threat list
|
||||||
TARGET_T_HOSTILE_RANDOM_NOT_TOP_PLAYER = 9 // Any random player from threat list except top threat
|
TARGET_T_HOSTILE_RANDOM_NOT_TOP_PLAYER = 9, // Any random player from threat list except top threat
|
||||||
|
|
||||||
|
TARGET_T_END
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EventFlags
|
enum EventFlags
|
||||||
|
|
@ -439,8 +441,6 @@ struct CreatureEventAI_Action
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#define AIEVENT_DEFAULT_THROW_RADIUS 30.0f
|
|
||||||
|
|
||||||
struct CreatureEventAI_Event
|
struct CreatureEventAI_Event
|
||||||
{
|
{
|
||||||
uint32 event_id;
|
uint32 event_id;
|
||||||
|
|
@ -597,6 +597,9 @@ struct CreatureEventAI_Event
|
||||||
|
|
||||||
CreatureEventAI_Action action[MAX_ACTIONS];
|
CreatureEventAI_Action action[MAX_ACTIONS];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define AIEVENT_DEFAULT_THROW_RADIUS 30.0f
|
||||||
|
|
||||||
// Event_Map
|
// Event_Map
|
||||||
typedef std::vector<CreatureEventAI_Event> CreatureEventAI_Event_Vec;
|
typedef std::vector<CreatureEventAI_Event> CreatureEventAI_Event_Vec;
|
||||||
typedef UNORDERED_MAP<uint32, CreatureEventAI_Event_Vec > CreatureEventAI_Event_Map;
|
typedef UNORDERED_MAP<uint32, CreatureEventAI_Event_Vec > CreatureEventAI_Event_Map;
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ void DynamicObject::AddToWorld()
|
||||||
{
|
{
|
||||||
///- Register the dynamicObject for guid lookup
|
///- Register the dynamicObject for guid lookup
|
||||||
if (!IsInWorld())
|
if (!IsInWorld())
|
||||||
GetMap()->GetObjectsStore().insert<DynamicObject>(GetObjectGuid(), (DynamicObject*)this);
|
{ GetMap()->GetObjectsStore().insert<DynamicObject>(GetObjectGuid(), (DynamicObject*)this); }
|
||||||
|
|
||||||
Object::AddToWorld();
|
Object::AddToWorld();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ namespace MaNGOS
|
||||||
{
|
{
|
||||||
if (u->GetTypeId() == TYPEID_UNIT && (
|
if (u->GetTypeId() == TYPEID_UNIT && (
|
||||||
((Creature*)u)->IsTotem() || ((Creature*)u)->IsPet() ||
|
((Creature*)u)->IsTotem() || ((Creature*)u)->IsPet() ||
|
||||||
(((Creature*)u)->GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_NO_XP_AT_KILL)))
|
(((Creature*)u)->GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_NO_XP_AT_KILL)))
|
||||||
{ return 0; }
|
{ return 0; }
|
||||||
|
|
||||||
uint32 xp_gain = BaseGain(pl->getLevel(), u->getLevel(), GetContentLevelsForMapAndZone(pl->GetMapId(), pl->GetZoneId()));
|
uint32 xp_gain = BaseGain(pl->getLevel(), u->getLevel(), GetContentLevelsForMapAndZone(pl->GetMapId(), pl->GetZoneId()));
|
||||||
|
|
|
||||||
|
|
@ -39,17 +39,17 @@ void GMTicketMgr::LoadGMTickets()
|
||||||
m_GMTicketMap.clear(); // For reload case
|
m_GMTicketMap.clear(); // For reload case
|
||||||
|
|
||||||
QueryResult* result = CharacterDatabase.Query(
|
QueryResult* result = CharacterDatabase.Query(
|
||||||
// 0 1 2 3 4
|
// 0 1 2 3 4
|
||||||
"SELECT guid, ticket_text, response_text, UNIX_TIMESTAMP(ticket_lastchange), ticket_id FROM character_ticket ORDER BY ticket_id ASC");
|
"SELECT guid, ticket_text, response_text, UNIX_TIMESTAMP(ticket_lastchange), ticket_id "
|
||||||
|
"FROM character_ticket "
|
||||||
|
"ORDER BY ticket_id ASC");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
BarGoLink bar(1);
|
BarGoLink bar(1);
|
||||||
|
|
||||||
bar.step();
|
bar.step();
|
||||||
|
|
||||||
sLog.outString();
|
|
||||||
sLog.outString(">> Loaded `character_ticket`, table is empty.");
|
sLog.outString(">> Loaded `character_ticket`, table is empty.");
|
||||||
|
sLog.outString();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -80,8 +80,8 @@ void GMTicketMgr::LoadGMTickets()
|
||||||
while (result->NextRow());
|
while (result->NextRow());
|
||||||
delete result;
|
delete result;
|
||||||
|
|
||||||
sLog.outString();
|
|
||||||
sLog.outString(">> Loaded " SIZEFMTD " GM tickets", GetTicketCount());
|
sLog.outString(">> Loaded " SIZEFMTD " GM tickets", GetTicketCount());
|
||||||
|
sLog.outString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMTicketMgr::DeleteAll()
|
void GMTicketMgr::DeleteAll()
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@
|
||||||
* and lore are copyrighted by Blizzard Entertainment, Inc.
|
* and lore are copyrighted by Blizzard Entertainment, Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _GMTICKETMGR_H
|
#ifndef MANGOS_H_GMTICKETMGR
|
||||||
#define _GMTICKETMGR_H
|
#define MANGOS_H_GMTICKETMGR
|
||||||
|
|
||||||
#include "Policies/Singleton.h"
|
#include "Policies/Singleton.h"
|
||||||
#include "Database/DatabaseEnv.h"
|
#include "Database/DatabaseEnv.h"
|
||||||
|
|
|
||||||
|
|
@ -837,45 +837,6 @@ bool GameObject::isVisibleForInState(Player const* u, WorldObject const* viewPoi
|
||||||
(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false);
|
(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
bool GameObject::isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const
|
|
||||||
{
|
|
||||||
// Not in world
|
|
||||||
if (!IsInWorld() || !u->IsInWorld())
|
|
||||||
{ return false; }
|
|
||||||
|
|
||||||
// invisible at client always
|
|
||||||
if (!GetGOInfo()->displayId)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Transport always visible at this step implementation
|
|
||||||
if (IsTransport() && IsInMap(u))
|
|
||||||
{ return true; }
|
|
||||||
|
|
||||||
// quick check visibility false cases for non-GM-mode
|
|
||||||
if (!u->isGameMaster())
|
|
||||||
{
|
|
||||||
// despawned and then not visible for non-GM in GM-mode
|
|
||||||
if (!isSpawned())
|
|
||||||
{ return false; }
|
|
||||||
*/
|
|
||||||
|
|
||||||
// special invisibility cases
|
|
||||||
/* TODO: implement trap stealth, take look at spell 2836
|
|
||||||
if(GetGOInfo()->type == GAMEOBJECT_TYPE_TRAP && GetGOInfo()->trap.stealthed && u->IsHostileTo(GetOwner()))
|
|
||||||
{
|
|
||||||
if(check stuff here)
|
|
||||||
return false;
|
|
||||||
}*/
|
|
||||||
/*
|
|
||||||
}
|
|
||||||
// check distance
|
|
||||||
|
|
||||||
return IsWithinDistInMap(viewPoint, GetMap()->GetVisibilityDistance() +
|
|
||||||
(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
void GameObject::Respawn()
|
void GameObject::Respawn()
|
||||||
{
|
{
|
||||||
if (m_spawnedByDefault && m_respawnTime > 0)
|
if (m_spawnedByDefault && m_respawnTime > 0)
|
||||||
|
|
@ -2469,6 +2430,20 @@ void GameObject::ForceGameObjectHealth(int32 diff, Unit* caster)
|
||||||
SetGoAnimProgress(GetMaxHealth() ? m_useTimes * 255 / GetMaxHealth() : 255);
|
SetGoAnimProgress(GetMaxHealth() ? m_useTimes * 255 / GetMaxHealth() : 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameObject::SetInUse(bool use)
|
||||||
|
{
|
||||||
|
m_isInUse = use;
|
||||||
|
if (use)
|
||||||
|
SetGoState(GO_STATE_ACTIVE);
|
||||||
|
else
|
||||||
|
SetGoState(GO_STATE_READY);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 GameObject::GetScriptId()
|
||||||
|
{
|
||||||
|
return sScriptMgr.GetBoundScriptId(SCRIPTED_GAMEOBJECT, -int32(GetGUIDLow())) ? sScriptMgr.GetBoundScriptId(SCRIPTED_GAMEOBJECT, -int32(GetGUIDLow())) : sScriptMgr.GetBoundScriptId(SCRIPTED_GAMEOBJECT, GetEntry());
|
||||||
|
}
|
||||||
|
|
||||||
float GameObject::GetInteractionDistance()
|
float GameObject::GetInteractionDistance()
|
||||||
{
|
{
|
||||||
switch (GetGoType())
|
switch (GetGoType())
|
||||||
|
|
@ -2486,17 +2461,4 @@ float GameObject::GetInteractionDistance()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameObject::SetInUse(bool use)
|
|
||||||
{
|
|
||||||
m_isInUse = use;
|
|
||||||
if (use)
|
|
||||||
SetGoState(GO_STATE_ACTIVE);
|
|
||||||
else
|
|
||||||
SetGoState(GO_STATE_READY);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 GameObject::GetScriptId()
|
|
||||||
{
|
|
||||||
return sScriptMgr.GetBoundScriptId(SCRIPTED_GAMEOBJECT, -int32(GetGUIDLow())) ? sScriptMgr.GetBoundScriptId(SCRIPTED_GAMEOBJECT, -int32(GetGUIDLow())) : sScriptMgr.GetBoundScriptId(SCRIPTED_GAMEOBJECT, GetEntry());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -600,7 +600,7 @@ struct GameObjectDataAddon
|
||||||
};
|
};
|
||||||
|
|
||||||
// For containers: [GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY -> ...
|
// For containers: [GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY -> ...
|
||||||
// For bobber: GO_NOT_READY ->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED-><deleted>
|
// For bobber: [GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED-><deleted>
|
||||||
// For door(closed):[GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY(close) -> ...
|
// For door(closed):[GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY(close) -> ...
|
||||||
// For door(open): [GO_NOT_READY]->GO_READY (open) ->GO_ACTIVATED (close)->GO_JUST_DEACTIVATED->GO_READY(open) -> ...
|
// For door(open): [GO_NOT_READY]->GO_READY (open) ->GO_ACTIVATED (close)->GO_JUST_DEACTIVATED->GO_READY(open) -> ...
|
||||||
enum LootState
|
enum LootState
|
||||||
|
|
@ -624,9 +624,9 @@ enum CapturePointState
|
||||||
|
|
||||||
enum CapturePointSliderValue
|
enum CapturePointSliderValue
|
||||||
{
|
{
|
||||||
CAPTURE_SLIDER_ALLIANCE = 100, // full alliance
|
CAPTURE_SLIDER_ALLIANCE = 100, // full alliance
|
||||||
CAPTURE_SLIDER_HORDE = 0, // full horde
|
CAPTURE_SLIDER_HORDE = 0, // full horde
|
||||||
CAPTURE_SLIDER_MIDDLE = 50 // middle
|
CAPTURE_SLIDER_MIDDLE = 50 // middle
|
||||||
};
|
};
|
||||||
|
|
||||||
class Unit;
|
class Unit;
|
||||||
|
|
@ -638,7 +638,7 @@ struct GameObjectDisplayInfoEntry;
|
||||||
|
|
||||||
#define GO_ANIMPROGRESS_DEFAULT 0xFF
|
#define GO_ANIMPROGRESS_DEFAULT 0xFF
|
||||||
|
|
||||||
class GameObject : public WorldObject
|
class GameObject : public WorldObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit GameObject();
|
explicit GameObject();
|
||||||
|
|
|
||||||
|
|
@ -343,9 +343,9 @@ bool Guild::CheckGuildStructure()
|
||||||
// Allow only 1 guildmaster, set other to officer
|
// Allow only 1 guildmaster, set other to officer
|
||||||
for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
|
for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
|
||||||
{
|
{
|
||||||
MemberSlot& member = itr->second;
|
MemberSlot &member = itr->second;
|
||||||
if (member.RankId == GR_GUILDMASTER && m_LeaderGuid != member.guid)
|
if (member.RankId == GR_GUILDMASTER && m_LeaderGuid != member.guid)
|
||||||
member.ChangeRank(GR_OFFICER);
|
{ member.ChangeRank(GR_OFFICER); }
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -588,7 +588,7 @@ bool Guild::DelMember(ObjectGuid guid, bool isDisbanding)
|
||||||
CharacterDatabase.PExecute("DELETE FROM guild_member WHERE guid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM guild_member WHERE guid = '%u'", lowguid);
|
||||||
|
|
||||||
if (!isDisbanding)
|
if (!isDisbanding)
|
||||||
UpdateAccountsNumber();
|
{ UpdateAccountsNumber(); }
|
||||||
|
|
||||||
// Used by Eluna
|
// Used by Eluna
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
|
|
@ -601,22 +601,22 @@ bool Guild::DelMember(ObjectGuid guid, bool isDisbanding)
|
||||||
bool Guild::ChangeMemberRank(ObjectGuid guid, uint8 newRank)
|
bool Guild::ChangeMemberRank(ObjectGuid guid, uint8 newRank)
|
||||||
{
|
{
|
||||||
if (newRank <= GetLowestRank()) // Validate rank (allow only existing ranks)
|
if (newRank <= GetLowestRank()) // Validate rank (allow only existing ranks)
|
||||||
if (MemberSlot* member = GetMemberSlot(guid))
|
if (MemberSlot* member = GetMemberSlot(guid))
|
||||||
{
|
{
|
||||||
member->ChangeRank(newRank);
|
member->ChangeRank(newRank);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Guild::BroadcastToGuild(WorldSession* session, const std::string& msg, uint32 language)
|
void Guild::BroadcastToGuild(WorldSession* session, const std::string& msg, uint32 language)
|
||||||
{
|
{
|
||||||
if (!session)
|
if (!session)
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
Player* player = session->GetPlayer();
|
Player* player = session->GetPlayer();
|
||||||
if (!player || !HasRankRight(player->GetRank(), GR_RIGHT_GCHATSPEAK))
|
if (!player || !HasRankRight(player->GetRank(), GR_RIGHT_GCHATSPEAK))
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_GUILD, msg.c_str(), Language(language), player->GetChatTag(), player->GetObjectGuid(), player->GetName());
|
ChatHandler::BuildChatPacket(data, CHAT_MSG_GUILD, msg.c_str(), Language(language), player->GetChatTag(), player->GetObjectGuid(), player->GetName());
|
||||||
|
|
@ -626,7 +626,7 @@ void Guild::BroadcastToGuild(WorldSession* session, const std::string& msg, uint
|
||||||
Player* pl = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
Player* pl = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
||||||
|
|
||||||
if (pl && pl->GetSession() && HasRankRight(pl->GetRank(), GR_RIGHT_GCHATLISTEN) && !pl->GetSocial()->HasIgnore(player->GetObjectGuid()))
|
if (pl && pl->GetSession() && HasRankRight(pl->GetRank(), GR_RIGHT_GCHATLISTEN) && !pl->GetSocial()->HasIgnore(player->GetObjectGuid()))
|
||||||
pl->GetSession()->SendPacket(&data);
|
{ pl->GetSession()->SendPacket(&data); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -650,11 +650,11 @@ void Guild::BroadcastAddonToGuild(WorldSession* session, const std::string& msg,
|
||||||
void Guild::BroadcastToOfficers(WorldSession* session, const std::string& msg, uint32 language)
|
void Guild::BroadcastToOfficers(WorldSession* session, const std::string& msg, uint32 language)
|
||||||
{
|
{
|
||||||
if (!session)
|
if (!session)
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
Player* player = session->GetPlayer();
|
Player* player = session->GetPlayer();
|
||||||
if (!player || !HasRankRight(player->GetRank(), GR_RIGHT_OFFCHATSPEAK))
|
if (!player || !HasRankRight(player->GetRank(), GR_RIGHT_OFFCHATSPEAK))
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
for (MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr)
|
for (MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ enum Typecommand
|
||||||
|
|
||||||
enum CommandErrors
|
enum CommandErrors
|
||||||
{
|
{
|
||||||
ERR_PLAYER_NO_MORE_IN_GUILD = 0x00,
|
ERR_PLAYER_NO_MORE_IN_GUILD = 0x00, // no message/error
|
||||||
ERR_GUILD_INTERNAL = 0x01,
|
ERR_GUILD_INTERNAL = 0x01,
|
||||||
ERR_ALREADY_IN_GUILD = 0x02,
|
ERR_ALREADY_IN_GUILD = 0x02,
|
||||||
ERR_ALREADY_IN_GUILD_S = 0x03,
|
ERR_ALREADY_IN_GUILD_S = 0x03,
|
||||||
|
|
@ -96,8 +96,8 @@ enum CommandErrors
|
||||||
ERR_ALREADY_INVITED_TO_GUILD_S = 0x05,
|
ERR_ALREADY_INVITED_TO_GUILD_S = 0x05,
|
||||||
ERR_GUILD_NAME_INVALID = 0x06,
|
ERR_GUILD_NAME_INVALID = 0x06,
|
||||||
ERR_GUILD_NAME_EXISTS_S = 0x07,
|
ERR_GUILD_NAME_EXISTS_S = 0x07,
|
||||||
ERR_GUILD_LEADER_LEAVE = 0x08,
|
ERR_GUILD_LEADER_LEAVE = 0x08, // for Typecommand 0x03
|
||||||
ERR_GUILD_PERMISSIONS = 0x08,
|
ERR_GUILD_PERMISSIONS = 0x08, // for another Typecommand
|
||||||
ERR_GUILD_PLAYER_NOT_IN_GUILD = 0x09,
|
ERR_GUILD_PLAYER_NOT_IN_GUILD = 0x09,
|
||||||
ERR_GUILD_PLAYER_NOT_IN_GUILD_S = 0x0A,
|
ERR_GUILD_PLAYER_NOT_IN_GUILD_S = 0x0A,
|
||||||
ERR_GUILD_PLAYER_NOT_FOUND_S = 0x0B,
|
ERR_GUILD_PLAYER_NOT_FOUND_S = 0x0B,
|
||||||
|
|
|
||||||
|
|
@ -1234,6 +1234,11 @@ bool Item::IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) cons
|
||||||
// time.
|
// time.
|
||||||
void Item::SendTimeUpdate(Player* owner)
|
void Item::SendTimeUpdate(Player* owner)
|
||||||
{
|
{
|
||||||
|
#ifdef ENABLE_PLAYERBOTS
|
||||||
|
if (!owner || !owner->IsInWorld() || owner->GetPlayerbotAI())
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
uint32 duration = GetUInt32Value(ITEM_FIELD_DURATION);
|
uint32 duration = GetUInt32Value(ITEM_FIELD_DURATION);
|
||||||
if (!duration)
|
if (!duration)
|
||||||
{ return; }
|
{ return; }
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,10 @@
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
#include "ProgressBar.h"
|
#include "ProgressBar.h"
|
||||||
|
#include "Util.h"
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "Util.h"
|
|
||||||
|
|
||||||
struct EnchStoreItem
|
struct EnchStoreItem
|
||||||
{
|
{
|
||||||
|
|
@ -92,14 +93,13 @@ void LoadRandomEnchantmentsTable()
|
||||||
|
|
||||||
delete result;
|
delete result;
|
||||||
|
|
||||||
sLog.outString();
|
|
||||||
sLog.outString(">> Loaded %u Item Enchantment definitions", count);
|
sLog.outString(">> Loaded %u Item Enchantment definitions", count);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sLog.outString();
|
|
||||||
sLog.outErrorDb(">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty.");
|
sLog.outErrorDb(">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty.");
|
||||||
}
|
}
|
||||||
|
sLog.outString();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 GetItemEnchantMod(int32 entry)
|
uint32 GetItemEnchantMod(int32 entry)
|
||||||
|
|
@ -129,7 +129,7 @@ uint32 GetItemEnchantMod(int32 entry)
|
||||||
double dRoll = rand_chance();
|
double dRoll = rand_chance();
|
||||||
float fCount = 0;
|
float fCount = 0;
|
||||||
|
|
||||||
const EnchStoreList& enchantList = tab->second;
|
const EnchStoreList &enchantList = tab->second;
|
||||||
for (EnchStoreList::const_iterator ench_iter = enchantList.begin(); ench_iter != enchantList.end(); ++ench_iter)
|
for (EnchStoreList::const_iterator ench_iter = enchantList.begin(); ench_iter != enchantList.end(); ++ench_iter)
|
||||||
{
|
{
|
||||||
fCount += ench_iter->chance;
|
fCount += ench_iter->chance;
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@
|
||||||
* and lore are copyrighted by Blizzard Entertainment, Inc.
|
* and lore are copyrighted by Blizzard Entertainment, Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _ITEM_ENCHANTMENT_MGR_H
|
#ifndef MANGOS_H_ITEM_ENCHANTMENT_MGR
|
||||||
#define _ITEM_ENCHANTMENT_MGR_H
|
#define MANGOS_H_ITEM_ENCHANTMENT_MGR
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@
|
||||||
* and lore are copyrighted by Blizzard Entertainment, Inc.
|
* and lore are copyrighted by Blizzard Entertainment, Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _ITEMPROTOTYPE_H
|
#ifndef MANGOS_H_ITEMPROTOTYPE
|
||||||
#define _ITEMPROTOTYPE_H
|
#define MANGOS_H_ITEMPROTOTYPE
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
|
||||||
|
|
@ -119,17 +119,17 @@ enum ItemBondingType
|
||||||
enum ItemPrototypeFlags
|
enum ItemPrototypeFlags
|
||||||
{
|
{
|
||||||
ITEM_FLAG_UNK0 = 0x00000001, // not used
|
ITEM_FLAG_UNK0 = 0x00000001, // not used
|
||||||
ITEM_FLAG_CONJURED = 0x00000002,
|
ITEM_FLAG_CONJURED = 0x00000002, // items created by spells with SPELL_EFFECT_CREATE_ITEM
|
||||||
ITEM_FLAG_LOOTABLE = 0x00000004, // affect only non container items that can be "open" for loot. It or lockid set enable for client show "Right click to open". See also ITEM_DYNFLAG_UNLOCKED
|
ITEM_FLAG_LOOTABLE = 0x00000004, // affect only non container items that can be "open" for loot. It or lockid set enable for client show "Right click to open". See also ITEM_DYNFLAG_UNLOCKED
|
||||||
ITEM_FLAG_HEROIC = 0x00000008, // heroic item version
|
ITEM_FLAG_HEROIC = 0x00000008, // heroic item version
|
||||||
ITEM_FLAG_UNK4 = 0x00000010, // can't repeat old note: appears red icon (like when item durability==0)
|
ITEM_FLAG_UNK4 = 0x00000010, // can't repeat old note: appears red icon (like when item durability==0)
|
||||||
ITEM_FLAG_INDESTRUCTIBLE = 0x00000020, // used for totem. Item can not be destroyed, except by using spell (item can be reagent for spell and then allowed)
|
ITEM_FLAG_INDESTRUCTIBLE = 0x00000020, // used for totem. Item can not be destroyed, except by using spell (item can be reagent for spell and then allowed)
|
||||||
ITEM_FLAG_UNK6 = 0x00000040, // ? old note: usable
|
ITEM_FLAG_UNK6 = 0x00000040, // ? old note: usable
|
||||||
ITEM_FLAG_NO_EQUIP_COOLDOWN = 0x00000080,
|
ITEM_FLAG_NO_EQUIP_COOLDOWN = 0x00000080, // items without an equip cooldown (and usually a _USABLE flag)
|
||||||
ITEM_FLAG_UNK8 = 0x00000100, // saw this on item 47115, 49295...
|
ITEM_FLAG_UNK8 = 0x00000100, // saw this on item 47115, 49295...
|
||||||
ITEM_FLAG_WRAPPER = 0x00000200, // used or not used wrapper
|
ITEM_FLAG_WRAPPER = 0x00000200, // used or not used wrapper
|
||||||
ITEM_FLAG_IGNORE_BAG_SPACE = 0x00000400, // ignore bag space at new item creation?
|
ITEM_FLAG_IGNORE_BAG_SPACE = 0x00000400, // ignore bag space at new item creation?
|
||||||
ITEM_FLAG_PARTY_LOOT = 0x00000800, // determines if item is party loot or not
|
ITEM_FLAG_PARTY_LOOT = 0x00000800, // items which can be looted by all party members
|
||||||
ITEM_FLAG_REFUNDABLE = 0x00001000, // item cost can be refunded within 2 hours after purchase
|
ITEM_FLAG_REFUNDABLE = 0x00001000, // item cost can be refunded within 2 hours after purchase
|
||||||
ITEM_FLAG_CHARTER = 0x00002000, // arena/guild charter
|
ITEM_FLAG_CHARTER = 0x00002000, // arena/guild charter
|
||||||
ITEM_FLAG_UNK14 = 0x00004000,
|
ITEM_FLAG_UNK14 = 0x00004000,
|
||||||
|
|
|
||||||
|
|
@ -104,8 +104,6 @@ void LootStore::LoadLootTable()
|
||||||
// Clearing store (for reloading case)
|
// Clearing store (for reloading case)
|
||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
sLog.outString("%s :", GetName());
|
|
||||||
|
|
||||||
// 0 1 2 3 4 5 6
|
// 0 1 2 3 4 5 6
|
||||||
QueryResult* result = WorldDatabase.PQuery("SELECT entry, item, ChanceOrQuestChance, groupid, mincountOrRef, maxcount, condition_id FROM %s", GetName());
|
QueryResult* result = WorldDatabase.PQuery("SELECT entry, item, ChanceOrQuestChance, groupid, mincountOrRef, maxcount, condition_id FROM %s", GetName());
|
||||||
|
|
||||||
|
|
@ -179,8 +177,8 @@ void LootStore::LoadLootTable()
|
||||||
|
|
||||||
Verify(); // Checks validity of the loot store
|
Verify(); // Checks validity of the loot store
|
||||||
|
|
||||||
|
sLog.outString(">> Loaded %u loot definitions (" SIZEFMTD " templates) from table %s", count, m_LootTemplates.size(), GetName());
|
||||||
sLog.outString();
|
sLog.outString();
|
||||||
sLog.outString(">> Loaded %u loot definitions (" SIZEFMTD " templates)", count, m_LootTemplates.size());
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -236,8 +234,12 @@ void LootStore::CheckLootRefs(LootIdSet* ref_set) const
|
||||||
void LootStore::ReportUnusedIds(LootIdSet const& ids_set) const
|
void LootStore::ReportUnusedIds(LootIdSet const& ids_set) const
|
||||||
{
|
{
|
||||||
// all still listed ids isn't referenced
|
// all still listed ids isn't referenced
|
||||||
for (LootIdSet::const_iterator itr = ids_set.begin(); itr != ids_set.end(); ++itr)
|
if (!ids_set.empty())
|
||||||
{ sLog.outErrorDb("Table '%s' entry %d isn't %s and not referenced from loot, and then useless.", GetName(), *itr, GetEntryName()); }
|
{
|
||||||
|
for (LootIdSet::const_iterator itr = ids_set.begin(); itr != ids_set.end(); ++itr)
|
||||||
|
sLog.outErrorDb("Table '%s' entry %d isn't %s and not referenced from loot, and then useless.", GetName(), *itr, GetEntryName());
|
||||||
|
sLog.outString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LootStore::ReportNotExistedId(uint32 id) const
|
void LootStore::ReportNotExistedId(uint32 id) const
|
||||||
|
|
@ -428,41 +430,41 @@ bool LootItem::AllowedForPlayer(Player const* player, WorldObject const* lootTar
|
||||||
{
|
{
|
||||||
ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(itemid);
|
ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(itemid);
|
||||||
if (!pProto)
|
if (!pProto)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
// not show loot for not own team
|
// not show loot for not own team
|
||||||
if ((pProto->Flags2 & ITEM_FLAG2_HORDE_ONLY) && player->GetTeam() != HORDE)
|
if ((pProto->Flags2 & ITEM_FLAG2_HORDE_ONLY) && player->GetTeam() != HORDE)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
if ((pProto->Flags2 & ITEM_FLAG2_ALLIANCE_ONLY) && player->GetTeam() != ALLIANCE)
|
if ((pProto->Flags2 & ITEM_FLAG2_ALLIANCE_ONLY) && player->GetTeam() != ALLIANCE)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
if (needs_quest)
|
if (needs_quest)
|
||||||
{
|
{
|
||||||
// Checking quests for quest-only drop (check only quests requirements in this case)
|
// Checking quests for quest-only drop (check only quests requirements in this case)
|
||||||
if (!player->HasQuestForItem(itemid))
|
if (!player->HasQuestForItem(itemid))
|
||||||
return false;
|
{ return false; }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Not quest only drop (check quest starting items for already accepted non-repeatable quests)
|
// Not quest only drop (check quest starting items for already accepted non-repeatable quests)
|
||||||
if (pProto->StartQuest && player->GetQuestStatus(pProto->StartQuest) != QUEST_STATUS_NONE && !player->HasQuestForItem(itemid))
|
if (pProto->StartQuest && player->GetQuestStatus(pProto->StartQuest) != QUEST_STATUS_NONE && !player->HasQuestForItem(itemid))
|
||||||
return false;
|
{ return false; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (type == LOOT_ITEM_TYPE_CURRENCY)
|
else if (type == LOOT_ITEM_TYPE_CURRENCY)
|
||||||
{
|
{
|
||||||
CurrencyTypesEntry const * currency = sCurrencyTypesStore.LookupEntry(itemid);
|
CurrencyTypesEntry const * currency = sCurrencyTypesStore.LookupEntry(itemid);
|
||||||
if (!itemid)
|
if (!itemid)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
if (!player->isGameMaster())
|
if (!player->isGameMaster())
|
||||||
{
|
{
|
||||||
if (currency->Category == CURRENCY_CATEGORY_META)
|
if (currency->Category == CURRENCY_CATEGORY_META)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
if (currency->Category == CURRENCY_CATEGORY_ARCHAEOLOGY && !player->HasSkill(SKILL_ARCHAEOLOGY))
|
if (currency->Category == CURRENCY_CATEGORY_ARCHAEOLOGY && !player->HasSkill(SKILL_ARCHAEOLOGY))
|
||||||
return false;
|
{ return false; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1274,12 +1276,12 @@ void LoadLootTemplates_Creature()
|
||||||
{
|
{
|
||||||
if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
|
if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
|
||||||
{
|
{
|
||||||
if (uint32 Lootid = cInfo->LootId)
|
if (uint32 lootid = cInfo->LootId)
|
||||||
{
|
{
|
||||||
if (ids_set.find(Lootid) == ids_set.end())
|
if (ids_set.find(lootid) == ids_set.end())
|
||||||
LootTemplates_Creature.ReportNotExistedId(Lootid);
|
{ LootTemplates_Creature.ReportNotExistedId(lootid); }
|
||||||
else
|
else
|
||||||
ids_setUsed.insert(Lootid);
|
{ ids_setUsed.insert(lootid); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1304,12 +1306,12 @@ void LoadLootTemplates_Disenchant()
|
||||||
{
|
{
|
||||||
if (ItemPrototype const* proto = sItemStorage.LookupEntry<ItemPrototype>(i))
|
if (ItemPrototype const* proto = sItemStorage.LookupEntry<ItemPrototype>(i))
|
||||||
{
|
{
|
||||||
if (uint32 Lootid = proto->DisenchantID)
|
if (uint32 lootid = proto->DisenchantID)
|
||||||
{
|
{
|
||||||
if (ids_set.find(Lootid) == ids_set.end())
|
if (ids_set.find(lootid) == ids_set.end())
|
||||||
LootTemplates_Disenchant.ReportNotExistedId(Lootid);
|
{ LootTemplates_Disenchant.ReportNotExistedId(lootid); }
|
||||||
else
|
else
|
||||||
ids_setUsed.insert(Lootid);
|
{ ids_setUsed.insert(lootid); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1347,12 +1349,12 @@ void LoadLootTemplates_Gameobject()
|
||||||
// remove real entries and check existence loot
|
// remove real entries and check existence loot
|
||||||
for (SQLStorageBase::SQLSIterator<GameObjectInfo> itr = sGOStorage.getDataBegin<GameObjectInfo>(); itr < sGOStorage.getDataEnd<GameObjectInfo>(); ++itr)
|
for (SQLStorageBase::SQLSIterator<GameObjectInfo> itr = sGOStorage.getDataBegin<GameObjectInfo>(); itr < sGOStorage.getDataEnd<GameObjectInfo>(); ++itr)
|
||||||
{
|
{
|
||||||
if (uint32 Lootid = itr->GetLootId())
|
if (uint32 lootid = itr->GetLootId())
|
||||||
{
|
{
|
||||||
if (ids_set.find(Lootid) == ids_set.end())
|
if (ids_set.find(lootid) == ids_set.end())
|
||||||
LootTemplates_Gameobject.ReportNotExistedId(Lootid);
|
{ LootTemplates_Gameobject.ReportNotExistedId(lootid); }
|
||||||
else
|
else
|
||||||
ids_setUsed.insert(Lootid);
|
{ ids_setUsed.insert(lootid); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
|
for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
|
||||||
|
|
@ -1422,12 +1424,12 @@ void LoadLootTemplates_Pickpocketing()
|
||||||
{
|
{
|
||||||
if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
|
if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
|
||||||
{
|
{
|
||||||
if (uint32 Lootid = cInfo->PickpocketLootId)
|
if (uint32 lootid = cInfo->PickpocketLootId)
|
||||||
{
|
{
|
||||||
if (ids_set.find(Lootid) == ids_set.end())
|
if (ids_set.find(lootid) == ids_set.end())
|
||||||
LootTemplates_Pickpocketing.ReportNotExistedId(Lootid);
|
{ LootTemplates_Pickpocketing.ReportNotExistedId(lootid); }
|
||||||
else
|
else
|
||||||
ids_setUsed.insert(Lootid);
|
{ ids_setUsed.insert(lootid); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1488,12 +1490,12 @@ void LoadLootTemplates_Skinning()
|
||||||
{
|
{
|
||||||
if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
|
if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
|
||||||
{
|
{
|
||||||
if (uint32 Lootid = cInfo->SkinningLootId)
|
if (uint32 lootid = cInfo->SkinningLootId)
|
||||||
{
|
{
|
||||||
if (ids_set.find(Lootid) == ids_set.end())
|
if (ids_set.find(lootid) == ids_set.end())
|
||||||
LootTemplates_Skinning.ReportNotExistedId(Lootid);
|
{ LootTemplates_Skinning.ReportNotExistedId(lootid); }
|
||||||
else
|
else
|
||||||
ids_setUsed.insert(Lootid);
|
{ ids_setUsed.insert(lootid); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -511,9 +511,6 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 updateFlags) const
|
||||||
data->WriteGuidBytes<4, 0, 3, 5, 7, 6, 2, 1>(guid);
|
data->WriteGuidBytes<4, 0, 3, 5, 7, 6, 2, 1>(guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (updateFlags & UPDATEFLAG_ANIM_KITS)
|
|
||||||
// *data << uint16(0) << uint16(0) << uint16(0);
|
|
||||||
|
|
||||||
if (updateFlags & UPDATEFLAG_TRANSPORT)
|
if (updateFlags & UPDATEFLAG_TRANSPORT)
|
||||||
*data << uint32(WorldTimer::getMSTime());
|
*data << uint32(WorldTimer::getMSTime());
|
||||||
}
|
}
|
||||||
|
|
@ -1487,13 +1484,13 @@ void WorldObject::UpdateGroundPositionZ(float x, float y, float& z) const
|
||||||
{
|
{
|
||||||
float new_z = GetMap()->GetHeight(GetPhaseMask(), x, y, z);
|
float new_z = GetMap()->GetHeight(GetPhaseMask(), x, y, z);
|
||||||
if (new_z > INVALID_HEIGHT)
|
if (new_z > INVALID_HEIGHT)
|
||||||
{ z = new_z + 0.05f; } // just to be sure that we are not a few pixel under the surface
|
{ z = new_z + 0.05f; } // just to be sure that we are not a few pixel under the surface
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z, Map* atMap /*=NULL*/) const
|
void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z, Map* atMap /*=NULL*/) const
|
||||||
{
|
{
|
||||||
if (!atMap)
|
if (!atMap)
|
||||||
{ atMap = GetMap(); }
|
{ atMap = GetMap(); }
|
||||||
|
|
||||||
switch (GetTypeId())
|
switch (GetTypeId())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -659,6 +659,7 @@ class WorldObject : public Object
|
||||||
GameObject* SummonGameObject(uint32 id, float x, float y, float z, float angle, uint32 despwtime);
|
GameObject* SummonGameObject(uint32 id, float x, float y, float z, float angle, uint32 despwtime);
|
||||||
|
|
||||||
bool IsActiveObject() const { return m_isActiveObject || m_viewPoint.hasViewers(); }
|
bool IsActiveObject() const { return m_isActiveObject || m_viewPoint.hasViewers(); }
|
||||||
|
bool isActiveObject() const { return IsActiveObject(); } // This is for Eluna to build. Should be removed in the future!
|
||||||
void SetActiveObjectState(bool active);
|
void SetActiveObjectState(bool active);
|
||||||
|
|
||||||
ViewPoint& GetViewPoint() { return m_viewPoint; }
|
ViewPoint& GetViewPoint() { return m_viewPoint; }
|
||||||
|
|
|
||||||
|
|
@ -124,13 +124,36 @@ namespace Movement
|
||||||
|
|
||||||
// Constant interface
|
// Constant interface
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
bool isSmooth() const { return raw() & Catmullrom;}
|
bool isSmooth() const { return raw() & Catmullrom;}
|
||||||
bool isLinear() const { return !isSmooth();}
|
bool isLinear() const { return !isSmooth();}
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
bool isFacing() const { return raw() & Mask_Final_Facing;}
|
bool isFacing() const { return raw() & Mask_Final_Facing;}
|
||||||
|
|
||||||
uint8 getAnimationId() const { return animId;}
|
uint8 getAnimationId() const { return animId;}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param f
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
bool hasAllFlags(uint32 f) const { return (raw() & f) == f;}
|
bool hasAllFlags(uint32 f) const { return (raw() & f) == f;}
|
||||||
bool hasFlag(uint32 f) const { return (raw() & f) != 0;}
|
bool hasFlag(uint32 f) const { return (raw() & f) != 0;}
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param f
|
||||||
|
* @return uint32 operator
|
||||||
|
*/
|
||||||
uint32 operator & (uint32 f) const { return (raw() & f);}
|
uint32 operator & (uint32 f) const { return (raw() & f);}
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
|
|
@ -165,7 +188,11 @@ namespace Movement
|
||||||
void EnableParabolic() { raw() = (raw() & ~(Mask_Animations | Falling | Animation | FallingSlow)) | Trajectory;}
|
void EnableParabolic() { raw() = (raw() & ~(Mask_Animations | Falling | Animation | FallingSlow)) | Trajectory;}
|
||||||
void EnableFalling() { raw() = (raw() & ~(Mask_Animations | Trajectory | Animation))| Falling;}
|
void EnableFalling() { raw() = (raw() & ~(Mask_Animations | Trajectory | Animation))| Falling;}
|
||||||
void EnableCatmullRom() { raw() = (raw() & ~SmoothGroundPath) | Catmullrom | UncompressedPath; }
|
void EnableCatmullRom() { raw() = (raw() & ~SmoothGroundPath) | Catmullrom | UncompressedPath; }
|
||||||
void EnableFacingPoint() { raw() = (raw() & ~Mask_Final_Facing) | Final_Point;}
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void EnableFacingPoint() { raw() = (raw() & ~Mask_Final_Facing) | Final_Point;}
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
*
|
*
|
||||||
|
|
@ -215,6 +242,6 @@ namespace Movement
|
||||||
#else
|
#else
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
#endif // MANGOSSERVER_MOVESPLINEFLAG_H
|
}
|
||||||
|
#endif
|
||||||
|
|
@ -116,6 +116,15 @@ namespace Movement
|
||||||
* @param maxPathRange
|
* @param maxPathRange
|
||||||
*/
|
*/
|
||||||
void MoveTo(const Vector3& destination, bool generatePath = false, bool forceDestination = false);
|
void MoveTo(const Vector3& destination, bool generatePath = false, bool forceDestination = false);
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param x
|
||||||
|
* @param y
|
||||||
|
* @param z
|
||||||
|
* @param generatePath
|
||||||
|
* @param forceDestination
|
||||||
|
*/
|
||||||
void MoveTo(float x, float y, float z, bool generatePath = false, bool forceDestination = false);
|
void MoveTo(float x, float y, float z, bool generatePath = false, bool forceDestination = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -128,11 +137,11 @@ namespace Movement
|
||||||
*/
|
*/
|
||||||
void SetFirstPointId(int32 pointId) { args.path_Idx_offset = pointId; }
|
void SetFirstPointId(int32 pointId) { args.path_Idx_offset = pointId; }
|
||||||
|
|
||||||
/* Enables CatmullRom spline interpolation mode(makes path smooth)
|
|
||||||
* if not enabled linear spline mode will be choosen. Disabled by default
|
|
||||||
*/
|
|
||||||
void SetSmooth();
|
void SetSmooth();
|
||||||
/* Enables CatmullRom spline interpolation mode, enables flying animation. Disabled by default
|
/**
|
||||||
|
* @brief Enables CatmullRom spline interpolation mode, enables flying animation.
|
||||||
|
* Disabled by default
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
void SetFly();
|
void SetFly();
|
||||||
/**
|
/**
|
||||||
|
|
@ -158,7 +167,9 @@ namespace Movement
|
||||||
*/
|
*/
|
||||||
void SetOrientationFixed(bool enable);
|
void SetOrientationFixed(bool enable);
|
||||||
|
|
||||||
/* Sets the velocity (in case you want to have custom movement velocity)
|
/**
|
||||||
|
* @brief Sets the velocity (in case you want to have custom movement velocity)
|
||||||
|
*
|
||||||
* if no set, speed will be selected based on unit's speeds and current movement mode
|
* if no set, speed will be selected based on unit's speeds and current movement mode
|
||||||
* Has no effect if falling mode enabled
|
* Has no effect if falling mode enabled
|
||||||
*
|
*
|
||||||
|
|
@ -174,8 +185,12 @@ namespace Movement
|
||||||
*/
|
*/
|
||||||
void SetExitVehicle();
|
void SetExitVehicle();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @return PointsArray
|
||||||
|
*/
|
||||||
PointsArray& Path() { return args.path; }
|
PointsArray& Path() { return args.path; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
MoveSplineInitArgs args; /**< TODO */
|
MoveSplineInitArgs args; /**< TODO */
|
||||||
|
|
@ -187,8 +202,17 @@ namespace Movement
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
inline void MoveSplineInit::SetFly() { args.flags.flying = true;}
|
inline void MoveSplineInit::SetFly() { args.flags.flying = true;}
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param enable
|
||||||
|
*/
|
||||||
inline void MoveSplineInit::SetWalk(bool enable) { args.flags.walkmode = enable;}
|
inline void MoveSplineInit::SetWalk(bool enable) { args.flags.walkmode = enable;}
|
||||||
inline void MoveSplineInit::SetSmooth() { args.flags.EnableCatmullRom();}
|
inline void MoveSplineInit::SetSmooth() { args.flags.EnableCatmullRom();}
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
inline void MoveSplineInit::SetCyclic() { args.flags.cyclic = true;}
|
inline void MoveSplineInit::SetCyclic() { args.flags.cyclic = true;}
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
|
|
@ -218,12 +242,28 @@ namespace Movement
|
||||||
args.path.assign(controls.begin(), controls.end());
|
args.path.assign(controls.begin(), controls.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param x
|
||||||
|
* @param y
|
||||||
|
* @param z
|
||||||
|
* @param generatePath
|
||||||
|
* @param forceDestination
|
||||||
|
*/
|
||||||
inline void MoveSplineInit::MoveTo(float x, float y, float z, bool generatePath, bool forceDestination)
|
inline void MoveSplineInit::MoveTo(float x, float y, float z, bool generatePath, bool forceDestination)
|
||||||
{
|
{
|
||||||
Vector3 v(x, y, z);
|
Vector3 v(x, y, z);
|
||||||
MoveTo(v, generatePath, forceDestination);
|
MoveTo(v, generatePath, forceDestination);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param dest
|
||||||
|
* @param generatePath
|
||||||
|
* @param forceDestination
|
||||||
|
*/
|
||||||
inline void MoveSplineInit::MoveTo(const Vector3& dest, bool generatePath, bool forceDestination)
|
inline void MoveSplineInit::MoveTo(const Vector3& dest, bool generatePath, bool forceDestination)
|
||||||
{
|
{
|
||||||
if (generatePath)
|
if (generatePath)
|
||||||
|
|
@ -253,6 +293,11 @@ namespace Movement
|
||||||
args.flags.EnableAnimation((uint8)anim);
|
args.flags.EnableAnimation((uint8)anim);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param spot
|
||||||
|
*/
|
||||||
inline void MoveSplineInit::SetFacing(Vector3 const& spot)
|
inline void MoveSplineInit::SetFacing(Vector3 const& spot)
|
||||||
{
|
{
|
||||||
args.facing.f.x = spot.x;
|
args.facing.f.x = spot.x;
|
||||||
|
|
@ -261,4 +306,5 @@ namespace Movement
|
||||||
args.flags.EnableFacingPoint();
|
args.flags.EnableFacingPoint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // MANGOSSERVER_MOVESPLINEINIT_H
|
#endif // MANGOSSERVER_MOVESPLINEINIT_H
|
||||||
|
|
|
||||||
|
|
@ -44,13 +44,6 @@ namespace Movement
|
||||||
{
|
{
|
||||||
MoveSplineFlag splineflags = move_spline.splineflags;
|
MoveSplineFlag splineflags = move_spline.splineflags;
|
||||||
|
|
||||||
/*if (mov.IsBoarded())
|
|
||||||
{
|
|
||||||
data.SetOpcode(SMSG_MONSTER_MOVE_TRANSPORT);
|
|
||||||
data << mov.GetTransport()->Owner.GetPackGUID();
|
|
||||||
data << int8(mov.m_unused.transport_seat);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
data << uint8(0);
|
data << uint8(0);
|
||||||
data << move_spline.spline.getPoint(move_spline.spline.first());
|
data << move_spline.spline.getPoint(move_spline.spline.first());
|
||||||
data << move_spline.GetId();
|
data << move_spline.GetId();
|
||||||
|
|
@ -76,6 +69,7 @@ namespace Movement
|
||||||
|
|
||||||
// add fake Enter_Cycle flag - needed for client-side cyclic movement (client will erase first spline vertex after first cycle done)
|
// add fake Enter_Cycle flag - needed for client-side cyclic movement (client will erase first spline vertex after first cycle done)
|
||||||
splineflags.enter_cycle = move_spline.isCyclic();
|
splineflags.enter_cycle = move_spline.isCyclic();
|
||||||
|
// add fake Runmode flag - client has strange issues without that flag
|
||||||
data << uint32(splineflags & ~MoveSplineFlag::Mask_No_Monster_Move);
|
data << uint32(splineflags & ~MoveSplineFlag::Mask_No_Monster_Move);
|
||||||
|
|
||||||
if (splineflags.animation)
|
if (splineflags.animation)
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,8 @@ namespace ACE_Based
|
||||||
LockType _lock; /**< Lock access to the queue. */
|
LockType _lock; /**< Lock access to the queue. */
|
||||||
StorageType _queue; /**< Storage backing the queue. */
|
StorageType _queue; /**< Storage backing the queue. */
|
||||||
|
|
||||||
|
/*volatile*/ bool _canceled; /**< Cancellation flag. */
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue