Project tidy up and sync

This commit is contained in:
Antz 2020-01-09 12:22:21 +00:00
parent 49fe617b55
commit 5531a0087d
44 changed files with 484 additions and 427 deletions

View file

@ -8,8 +8,7 @@ Tab Size
--------
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
tab width', and 4-space indenting looks best from our point of view, besides MSVC'
editor has this setting by default.
tab width', and 4-space indenting looks best from our point of view, besides MSVC' editor has this setting by default.
Line length
-----------

View file

@ -1,42 +1,11 @@
Introduction to Database content for SD2
Introduction to Database content for SD3
================================================
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
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
--------------
@ -65,7 +34,7 @@ DELETE FROM scripted_areatrigger WHERE entry=XYZ;
INSERT INTO scripted_areatrigger VALUES (XYZ, at_some_place);
-----------
ScriptDev2-Database
ScriptDev3-Database
-------------------
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:
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:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -1,7 +1,7 @@
# Spells {#spells} #
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
wouldn't do much at all since the effects apply different kinds of `Aura`s that do different things

View file

@ -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
code.
Each of the commits will have a prefix indicating the source team :
* **t**: TrinityCore
* **p**: Project SilverPine
* **r**: MangosR2
* **s**: ScriptDev
* **c**: cMangos
* **m**: mangos
Each of the commits will attempt to clearly identify the author.

View file

@ -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)
{
double ratio = 0;
uint32 Chance = 0;
if (buyoutPrice <= MinBuyPrice)
@ -800,7 +799,7 @@ bool AuctionBotBuyer::IsBuyableEntry(uint64 buyoutPrice, double InGame_BuyPrice,
{
if ((buyoutPrice > 0) && (MaxBuyablePrice > 0))
{
ratio = buyoutPrice / MaxBuyablePrice;
double ratio = buyoutPrice / MaxBuyablePrice;
if (ratio < 10)
{ Chance = MaxChance - (ratio * (MaxChance / 10)); }
else { Chance = 1; }
@ -815,7 +814,7 @@ bool AuctionBotBuyer::IsBuyableEntry(uint64 buyoutPrice, double InGame_BuyPrice,
{
if ((buyoutPrice > 0) && (MaxBuyablePrice > 0))
{
ratio = buyoutPrice / MaxBuyablePrice;
double ratio = buyoutPrice / MaxBuyablePrice;
if (ratio < 10)
{ Chance = (MaxChance / 5) - (ratio * (MaxChance / 50)); }
else { Chance = 1; }
@ -828,7 +827,7 @@ bool AuctionBotBuyer::IsBuyableEntry(uint64 buyoutPrice, double InGame_BuyPrice,
{
if ((buyoutPrice > 0) && (MaxBuyablePrice > 0))
{
ratio = buyoutPrice / MaxBuyablePrice;
double ratio = buyoutPrice / MaxBuyablePrice;
if (ratio < 10)
{ Chance = (MaxChance / 5) - (ratio * (MaxChance / 50)); }
else { Chance = 0; }
@ -841,12 +840,10 @@ bool AuctionBotBuyer::IsBuyableEntry(uint64 buyoutPrice, double InGame_BuyPrice,
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: WIN BUY! Chance = %u, num = %u.", Chance, RandNum);
return true;
}
else
{
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot:LOOSE BUY! Chance = %u, num = %u.", Chance, RandNum);
return false;
}
}
bool AuctionBotBuyer::IsBidableEntry(uint64 bidPrice, double InGame_BuyPrice, double MaxBidablePrice, uint64 MinBidPrice, uint32 MaxChance, uint32 ChanceRatio)
{

View file

@ -384,7 +384,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* target
{ return; }
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
// duplication (or maybe write functions?)

View file

@ -295,7 +295,7 @@ void WorldSession::HandlePVPLogDataOpcode(WorldPacket & /*recv_data*/)
BattleGround* bg = _player->GetBattleGround();
if (!bg)
return;
{ return; }
// arena finish version will send in BattleGround::EndBattleGround directly
if (bg->isArena())

View file

@ -2304,9 +2304,8 @@ void BattleGroundMgr::LoadBattleMastersEntry()
{
BarGoLink bar(1);
bar.step();
sLog.outString();
sLog.outString(">> Loaded 0 battlemaster entries - table is empty!");
sLog.outString();
return;
}
@ -2333,8 +2332,8 @@ void BattleGroundMgr::LoadBattleMastersEntry()
delete result;
sLog.outString();
sLog.outString(">> Loaded %u battlemaster entries", count);
sLog.outString();
}
HolidayIds BattleGroundMgr::BGTypeToWeekendHolidayId(BattleGroundTypeId bgTypeId)
@ -2422,9 +2421,8 @@ void BattleGroundMgr::LoadBattleEventIndexes()
{
BarGoLink bar(1);
bar.step();
sLog.outString();
sLog.outErrorDb(">> Loaded 0 battleground eventindexes.");
sLog.outString();
return;
}
@ -2483,7 +2481,7 @@ void BattleGroundMgr::LoadBattleEventIndexes()
}
while (result->NextRow());
sLog.outString();
sLog.outString(">> Loaded %u battleground eventindexes", count);
sLog.outString();
delete result;
}

View file

@ -54,15 +54,15 @@
#include "WaypointMovementGenerator.h"
#include <cctype>
#include <iostream>
#include <fstream>
#include <map>
#include <typeinfo>
#include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand
#include "MoveMap.h" // for mmap manager
#include "PathFinder.h" // for mmap commands
#include "movement/MoveSplineInit.h"
#include <fstream>
#include <map>
#include <typeinfo>
static uint32 ReputationRankStrIndex[MAX_REPUTATION_RANK] =
{
LANG_REP_HATED, LANG_REP_HOSTILE, LANG_REP_UNFRIENDLY, LANG_REP_NEUTRAL,

View file

@ -439,7 +439,7 @@ bool ChatHandler::HandleReloadCommandCommand(char* /*args*/)
bool ChatHandler::HandleReloadCreatureQuestRelationsCommand(char* /*args*/)
{
sLog.outString("Loading Quests Relations... (`creature_questrelation`)");
sLog.outString("Loading creature quest givers...");
sObjectMgr.LoadCreatureQuestRelations();
SendGlobalSysMessage("DB table `creature_questrelation` (creature quest givers) reloaded.");
return true;
@ -447,7 +447,7 @@ bool ChatHandler::HandleReloadCreatureQuestRelationsCommand(char* /*args*/)
bool ChatHandler::HandleReloadCreatureQuestInvRelationsCommand(char* /*args*/)
{
sLog.outString("Loading Quests Relations... (`creature_involvedrelation`)");
sLog.outString("Loading creature quest takers...");
sObjectMgr.LoadCreatureInvolvedRelations();
SendGlobalSysMessage("DB table `creature_involvedrelation` (creature quest takers) reloaded.");
return true;
@ -478,7 +478,7 @@ bool ChatHandler::HandleReloadGossipMenuCommand(char* /*args*/)
bool ChatHandler::HandleReloadGOQuestRelationsCommand(char* /*args*/)
{
sLog.outString("Loading Quests Relations... (`gameobject_questrelation`)");
sLog.outString("Loading gameobject quest givers...");
sObjectMgr.LoadGameobjectQuestRelations();
SendGlobalSysMessage("DB table `gameobject_questrelation` (gameobject quest givers) reloaded.");
return true;
@ -486,7 +486,7 @@ bool ChatHandler::HandleReloadGOQuestRelationsCommand(char* /*args*/)
bool ChatHandler::HandleReloadGOQuestInvRelationsCommand(char* /*args*/)
{
sLog.outString("Loading Quests Relations... (`gameobject_involvedrelation`)");
sLog.outString("Loading gameobject quest takers...");
sObjectMgr.LoadGameobjectInvolvedRelations();
SendGlobalSysMessage("DB table `gameobject_involvedrelation` (gameobject quest takers) reloaded.");
return true;
@ -5381,13 +5381,17 @@ bool ChatHandler::HandleServerShutDownCommand(char* args)
uint32 exitcode;
if (!ExtractOptUInt32(&args, exitcode, SHUTDOWN_EXIT_CODE))
{
return false;
}
// Exit code should be in range of 0-125, 126-255 is used
// in many shells for their own return codes and code > 255
// is not supported in many others
if (exitcode > 125)
{
return false;
}
sWorld.ShutdownServ(delay, 0, exitcode);
return true;
@ -5397,17 +5401,23 @@ bool ChatHandler::HandleServerRestartCommand(char* args)
{
uint32 delay;
if (!ExtractUInt32(&args, delay))
{ return false; }
{
return false;
}
uint32 exitcode;
if (!ExtractOptUInt32(&args, exitcode, RESTART_EXIT_CODE))
{ return false; }
{
return false;
}
// Exit code should be in range of 0-125, 126-255 is used
// in many shells for their own return codes and code > 255
// is not supported in many others
if (exitcode > 125)
{ return false; }
{
return false;
}
sWorld.ShutdownServ(delay, SHUTDOWN_MASK_RESTART, exitcode);
return true;
@ -5417,17 +5427,23 @@ bool ChatHandler::HandleServerIdleRestartCommand(char* args)
{
uint32 delay;
if (!ExtractUInt32(&args, delay))
{
return false;
}
uint32 exitcode;
if (!ExtractOptUInt32(&args, exitcode, RESTART_EXIT_CODE))
{
return false;
}
// Exit code should be in range of 0-125, 126-255 is used
// in many shells for their own return codes and code > 255
// is not supported in many others
if (exitcode > 125)
{
return false;
}
sWorld.ShutdownServ(delay, SHUTDOWN_MASK_RESTART | SHUTDOWN_MASK_IDLE, exitcode);
return true;
@ -5437,17 +5453,23 @@ bool ChatHandler::HandleServerIdleShutDownCommand(char* args)
{
uint32 delay;
if (!ExtractUInt32(&args, delay))
{
return false;
}
uint32 exitcode;
if (!ExtractOptUInt32(&args, exitcode, SHUTDOWN_EXIT_CODE))
{
return false;
}
// Exit code should be in range of 0-125, 126-255 is used
// in many shells for their own return codes and code > 255
// is not supported in many others
if (exitcode > 125)
{
return false;
}
sWorld.ShutdownServ(delay, SHUTDOWN_MASK_IDLE, exitcode);
return true;

View file

@ -50,9 +50,8 @@ void HomeMovementGenerator<Creature>::_setTargetLocation(Creature& owner)
if (owner.GetMotionMaster()->empty() || !owner.GetMotionMaster()->top()->GetResetPosition(owner, x, y, z, o))
{
owner.GetRespawnCoord(x, y, z, &o);
init.SetFacing(o);
}
init.SetFacing(o);
init.MoveTo(x, y, z, true);
init.SetWalk(false);
init.Launch();

View file

@ -39,6 +39,7 @@ PathFinder::PathFinder(const Unit* owner) :
DEBUG_FILTER_LOG(LOG_FILTER_PATHFINDING, "++ PathFinder::PathInfo for %u \n", m_sourceUnit->GetGUIDLow());
uint32 mapId = m_sourceUnit->GetMapId();
if (MMAP::MMapFactory::IsPathfindingEnabled(mapId, owner))
{
MMAP::MMapManager* mmap = MMAP::MMapFactory::createOrGetMMapManager();
@ -56,15 +57,14 @@ PathFinder::~PathFinder()
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;
m_sourceUnit->GetPosition(x, y, z);
Vector3 start(x, y, z);
setStartPosition(start);
Vector3 dest(destX, destY, destZ);
setEndPosition(dest);
m_forceDestination = forceDest;
DEBUG_FILTER_LOG(LOG_FILTER_PATHFINDING, "++ PathFinder::calculate() for %u \n", m_sourceUnit->GetGUIDLow());
@ -783,3 +783,23 @@ float PathFinder::dist3DSqr(const Vector3& p1, const Vector3& p2) const
{
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();
}

View file

@ -44,6 +44,7 @@ class Unit;
#define SMOOTH_PATH_STEP_SIZE 4.0f
#define SMOOTH_PATH_SLOP 0.3f
#define SMOOTH_PATH_HEIGHT 1.0f
#define VERTEX_SIZE 3
#define INVALID_POLYREF 0
@ -76,6 +77,7 @@ class PathFinder
Vector3 getStartPosition() const { return m_startPosition; }
Vector3 getEndPosition() const { return m_endPosition; }
Vector3 getActualEndPosition() const { return m_actualEndPosition; }
void NormalizePath(uint32& size);
PointsArray& getPath() { return m_pathPoints; }
PathType getPathType() const { return m_type; }

View file

@ -70,34 +70,6 @@ void RandomMovementGenerator<Creature>::_setRandomLocation(Creature& creature)
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<>
void RandomMovementGenerator<Creature>::Initialize(Creature& creature)
{

View file

@ -73,7 +73,6 @@ class TargetedMovementGeneratorMedium
float i_angle;
bool m_speedChanged : 1;
bool i_targetReached : 1;
PathFinder* i_path;
};

View file

@ -280,7 +280,9 @@ bool WaypointMovementGenerator<Creature>::CanMove(int32 diff, Creature& u)
{
i_nextMoveTime.Update(diff);
if (i_nextMoveTime.Passed() && u.hasUnitState(UNIT_STAT_WAYPOINT_PAUSED))
{
i_nextMoveTime.Reset(1);
}
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);
}
}
bool FlightPathMovementGenerator::GetResetPosition(Player&, float& x, float& y, float& z, float& o) const
{
const TaxiPathNodeEntry& node = (*i_path)[i_currentNode];

View file

@ -35,8 +35,8 @@
*/
#ifndef _AUCTION_HOUSE_MGR_H
#define _AUCTION_HOUSE_MGR_H
#ifndef MANGOS_H_AUCTION_HOUSE_MGR
#define MANGOS_H_AUCTION_HOUSE_MGR
#include "Common.h"
#include "DBCStructure.h"

View file

@ -207,7 +207,7 @@ void Creature::AddToWorld()
// Make active if required
if (sWorld.isForceLoadMap(GetMapId()) || (GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_ACTIVE))
SetActiveObjectState(true);
{ SetActiveObjectState(true); }
#ifdef ENABLE_ELUNA
if (!inWorld)
@ -422,9 +422,13 @@ bool Creature::UpdateEntry(uint32 Entry, Team team, const CreatureData* data /*=
SelectLevel();
if (team == HORDE)
{ setFaction(GetCreatureInfo()->FactionHorde); }
{
setFaction(GetCreatureInfo()->FactionHorde);
}
else
{ setFaction(GetCreatureInfo()->FactionAlliance); }
{
setFaction(GetCreatureInfo()->FactionAlliance);
}
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
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_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 (factionTemplate->factionFlags & FACTION_TEMPLATE_FLAG_PVP)
{ SetPvP(true); }
{
SetPvP(true);
}
else
{ SetPvP(false); }
{
SetPvP(false);
}
}
// Try difficulty dependend version before falling back to base entry
CreatureTemplateSpells const* templateSpells = sCreatureTemplateSpellsStorage.LookupEntry<CreatureTemplateSpells>(GetCreatureInfo()->Entry);
if (!templateSpells)
{ templateSpells = sCreatureTemplateSpellsStorage.LookupEntry<CreatureTemplateSpells>(GetEntry()); }
{
templateSpells = sCreatureTemplateSpellsStorage.LookupEntry<CreatureTemplateSpells>(GetEntry());
}
if (templateSpells)
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);
// if eventData set then event active and need apply spell_start
if (eventData)
{ ApplyGameEventSpells(eventData, true); }
{
ApplyGameEventSpells(eventData, 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
if (eventData && eventData->modelid)
{ return eventData->modelid; }
{
return eventData->modelid;
}
// Use creature model explicit, override template (creature.modelid)
if (data && data->modelid_override)
@ -759,16 +777,20 @@ void Creature::RegeneratePower()
{
Modifier const* modifier = (*i)->GetModifier();
if (modifier->m_miscvalue == int32(powerType))
{
addValue += modifier->m_amount;
}
}
AuraList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
for(AuraList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
{
Modifier const* modifier = (*i)->GetModifier();
if (modifier->m_miscvalue == int32(powerType))
{
addValue *= (modifier->m_amount + 100) / 100.0f;
}
}
ModifyPower(powerType, int32(addValue));
}
@ -823,9 +845,11 @@ void Creature::DoFleeToGetAssistance()
if (!pCreature)
{ SetFeared(true, getVictim()->GetObjectGuid(), 0 , sWorld.getConfig(CONFIG_UINT32_CREATURE_FAMILY_FLEE_DELAY)); }
else
{
GetMotionMaster()->MoveSeekAssistance(pCreature->GetPositionX(), pCreature->GetPositionY(), pCreature->GetPositionZ());
}
}
}
bool Creature::AIM_Initialize()
{
@ -2187,19 +2211,29 @@ bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction /
bool Creature::CanInitiateAttack()
{
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))
{ return false; }
{
return false;
}
if (isPassiveToHostile())
{ return false; }
{
return false;
}
if (m_aggroDelay != 0)
{
return false;
}
if (!CanAttackByItself())
{
return false;
}
return true;
}
@ -2502,7 +2536,9 @@ bool Creature::HasCategoryCooldown(uint32 spell_id) const
{
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell_id);
if (!spellInfo)
{ return false; }
{
return false;
}
CreatureSpellCooldowns::const_iterator itr = m_CreatureCategoryCooldowns.find(spellInfo->GetCategory());
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)
{
if (enable)
{
m_movementInfo.AddMovementFlag(MOVEFLAG_WATERWALKING);
}
else
{
m_movementInfo.RemoveMovementFlag(MOVEFLAG_WATERWALKING);
}
if (IsInWorld())
{

View file

@ -74,7 +74,7 @@ enum CreatureFlagsExtra
#endif
#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
// from `creature_template` table
@ -263,7 +263,7 @@ struct CreatureModelInfo
float bounding_radius;
float combat_reach;
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)
};

View file

@ -113,7 +113,9 @@ CanCastResult CreatureAI::DoCastSpellIfCan(Unit* pTarget, uint32 uiSpell, uint32
CanCastResult castResult = CanCastSpell(pTarget, pSpell, uiCastFlags & CAST_TRIGGERED);
if (castResult != CAST_OK)
{ return castResult; }
{
return castResult;
}
}
// Interrupt any previous spell

View file

@ -25,9 +25,9 @@
#ifndef MANGOS_CREATUREAI_H
#define MANGOS_CREATUREAI_H
#include "SharedDefines.h"
#include "Dynamic/FactoryHolder.h"
#include "ObjectGuid.h"
#include "SharedDefines.h"
class WorldObject;
class GameObject;
@ -352,6 +352,7 @@ class CreatureAI
*/
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() {}
protected:

View file

@ -110,7 +110,9 @@ CreatureEventAI::CreatureEventAI(Creature* c) : CreatureAI(c),
// Debug check
#ifndef MANGOS_DEBUG
if (i->event_flags & EFLAG_DEBUG_ONLY)
{ continue; }
{
continue;
}
#endif
if (m_creature->GetMap()->IsDungeon())
{
@ -120,11 +122,11 @@ CreatureEventAI::CreatureEventAI(Creature* c) : CreatureAI(c),
}
}
else if (IsEventFlagsFitForNormalMap(i->event_flags))
++events_count;
{ ++events_count; }
}
// EventMap had events but they were not added because they must be for instance
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
{
m_CreatureEventAIList.reserve(events_count);
@ -139,23 +141,27 @@ CreatureEventAI::CreatureEventAI(Creature* c) : CreatureAI(c),
if (m_creature->GetMap()->IsDungeon())
{
if ((1 << (m_creature->GetMap()->GetSpawnMode() + 1)) & i->event_flags)
storeEvent = true;
{ storeEvent = true; }
}
else if (IsEventFlagsFitForNormalMap(i->event_flags))
storeEvent = true;
{ storeEvent = true; }
if (storeEvent)
{
m_CreatureEventAIList.push_back(CreatureEventAIHolder(*i));
// Cache for fast use
if (i->event_type == EVENT_T_OOC_LOS)
{
m_HasOOCLoSEvent = true;
}
}
}
}
}
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 \
@ -344,6 +350,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
// We don't really care about the whole list, just return first available
pActionInvoker = *(pList.begin());
LOG_PROCESS_EVENT;
// Repeat Timers
pHolder.UpdateRepeatTimer(m_creature, event.friendly_is_cc.repeatMin, event.friendly_is_cc.repeatMax);
break;
@ -400,7 +407,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
case EVENT_T_AURA:
{
if (!m_creature->IsInCombat())
return false;
{ return false; }
SpellAuraHolder* holder = m_creature->GetSpellAuraHolder(event.buffed.spellId);
if (!holder || holder->GetStackAmount() < event.buffed.amount)
@ -428,7 +435,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
case EVENT_T_MISSING_AURA:
{
if (!m_creature->IsInCombat())
return false;
{ return false; }
SpellAuraHolder* holder = m_creature->GetSpellAuraHolder(event.buffed.spellId);
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)
{
if (action.type == ACTION_T_NONE)
if (action.type == ACTION_T_NONE) //0
{ return; }
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;
switch (action.type)
{
case ACTION_T_TEXT:
case ACTION_T_CHANCED_TEXT:
case ACTION_T_TEXT: //1
case ACTION_T_CHANCED_TEXT: //44
{
if (!action.text.TextId[0])
{ return; }
@ -546,7 +553,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
if (action.type == ACTION_T_TEXT)
{
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))
{ textId = action.text.TextId[1]; }
else
@ -556,7 +563,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
else if ((rnd % 100) < action.chanced_text.chance)
{
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
{ textId = action.chanced_text.TextId[0]; }
}
@ -588,7 +595,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
}
break;
}
case ACTION_T_SET_FACTION:
case ACTION_T_SET_FACTION: //2
{
if (action.set_faction.factionId)
{ m_creature->SetFactionTemporary(action.set_faction.factionId, action.set_faction.factionFlags); }
@ -597,7 +604,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
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)
{
@ -618,30 +625,31 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
{ m_creature->DeMorph(); }
break;
}
case ACTION_T_SOUND:
case ACTION_T_SOUND: //4
m_creature->PlayDirectSound(action.sound.soundId);
break;
case ACTION_T_EMOTE:
case ACTION_T_EMOTE: //5
m_creature->HandleEmote(action.emote.emoteId);
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);
if (temp >= 0)
{ m_creature->PlayDirectSound(temp); }
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);
if (temp >= 0)
{ m_creature->HandleEmote(temp); }
break;
}
case ACTION_T_CAST:
case ACTION_T_CAST: //11
{
uint32 selectFlags = 0;
uint32 spellId = 0;
if (!(action.cast.castFlags & (CAST_TRIGGERED | CAST_FORCE_CAST | CAST_FORCE_TARGET_SELF)))
{
spellId = action.cast.spellId;
@ -711,7 +719,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
break;
}
case ACTION_T_SUMMON:
case ACTION_T_SUMMON: //12
{
Unit* target = GetTargetByType(action.summon.target, pActionInvoker, pAIEventSender, reportTargetError);
if (!target && reportTargetError)
@ -730,13 +738,13 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
{ pCreature->AI()->AttackStart(target); }
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))
{ m_creature->GetThreatManager().modifyThreatPercent(target, action.threat_single_pct.percent); }
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); }
break;
case ACTION_T_THREAT_ALL_PCT:
case ACTION_T_THREAT_ALL_PCT: //14
{
ThreatList const& threatList = m_creature->GetThreatManager().getThreatList();
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); }
break;
}
case ACTION_T_QUEST_EVENT:
case ACTION_T_QUEST_EVENT: //15
if (Unit* target = GetTargetByType(action.quest_event.target, pActionInvoker, pAIEventSender, reportTargetError))
{
if (target->GetTypeId() == TYPEID_PLAYER)
@ -753,7 +761,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
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); }
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 (target->GetTypeId() == TYPEID_PLAYER)
@ -762,7 +770,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
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); }
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);
@ -775,21 +783,21 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
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))
{ target->SetFlag(UNIT_FIELD_FLAGS, action.unit_flag.value); }
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); }
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))
{ target->RemoveFlag(UNIT_FIELD_FLAGS, action.unit_flag.value); }
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); }
case ACTION_T_AUTO_ATTACK:
case ACTION_T_AUTO_ATTACK: //20
m_MeleeEnabled = action.auto_attack.state != 0;
break;
case ACTION_T_COMBAT_MOVEMENT:
case ACTION_T_COMBAT_MOVEMENT: //21
// ignore no affect case
if (m_isCombatMovement == (action.combat_movement.state != 0) || m_creature->IsNonMeleeSpellCasted(false))
{ 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())
{ m_creature->SendMeleeAttackStop(m_creature->getVictim()); }
break;
case ACTION_T_SET_PHASE:
case ACTION_T_SET_PHASE: //22
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);
break;
case ACTION_T_INC_PHASE:
case ACTION_T_INC_PHASE: //23
{
int32 new_phase = int32(m_Phase) + action.set_inc_phase.step;
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);
break;
}
case ACTION_T_EVADE:
case ACTION_T_EVADE: //24
EnterEvadeMode();
break;
case ACTION_T_FLEE_FOR_ASSIST:
case ACTION_T_FLEE_FOR_ASSIST: //25
m_creature->DoFleeToGetAssistance();
break;
case ACTION_T_QUEST_EVENT_ALL:
case ACTION_T_QUEST_EVENT_ALL: //26
if (action.quest_event_all.useThreatList)
{
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)
{ ((Player*)pActionInvoker)->GroupEventHappens(action.quest_event_all.questId, m_creature); }
break;
case ACTION_T_CAST_EVENT_ALL:
case ACTION_T_CAST_EVENT_ALL: //27
{
ThreatList const& threatList = m_creature->GetThreatManager().getThreatList();
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); }
break;
}
case ACTION_T_REMOVEAURASFROMSPELL:
case ACTION_T_REMOVEAURASFROMSPELL: //28
if (Unit* target = GetTargetByType(action.remove_aura.target, pActionInvoker, pAIEventSender, reportTargetError))
{ target->RemoveAurasDueToSpell(action.remove_aura.spellId); }
else if (reportTargetError)
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_REMOVEAURASFROMSPELL(%u), target-type %u", EventId, action.type, action.remove_aura.target); }
break;
case ACTION_T_RANGED_MOVEMENT:
case ACTION_T_RANGED_MOVEMENT: //29
m_attackDistance = (float)action.ranged_movement.distance;
m_attackAngle = action.ranged_movement.angle / 180.0f * M_PI_F;
@ -869,17 +877,17 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
}
}
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);
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;
case ACTION_T_RANDOM_PHASE_RANGE:
case ACTION_T_RANDOM_PHASE_RANGE: //31
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)); }
else
{ sLog.outErrorEventAI("ACTION_T_RANDOM_PHASE_RANGE can not have Param2 <= Param1. Divide by Zero. Event = %d. CreatureEntry = %d", EventId, m_creature->GetEntry()); }
break;
case ACTION_T_SUMMON_ID:
case ACTION_T_SUMMON_ID: //32
{
Unit* target = GetTargetByType(action.summon_id.target, pActionInvoker, pAIEventSender, reportTargetError);
if (!target && reportTargetError)
@ -894,9 +902,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
Creature* pCreature = NULL;
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
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)
{ 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;
}
case ACTION_T_KILLED_MONSTER:
case ACTION_T_KILLED_MONSTER: //33
// first attempt player/group who tapped creature
if (Player* pPlayer = m_creature->GetLootRecipient())
{ 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); }
}
break;
case ACTION_T_SET_INST_DATA:
case ACTION_T_SET_INST_DATA: //34
{
InstanceData* pInst = m_creature->GetInstanceData();
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);
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);
if (!target)
@ -953,7 +961,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
pInst->SetData64(action.set_inst_data64.field, target->GetObjectGuid().GetRawValue());
break;
}
case ACTION_T_UPDATE_TEMPLATE:
case ACTION_T_UPDATE_TEMPLATE: //36
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());
@ -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);
break;
case ACTION_T_DIE:
case ACTION_T_DIE: //37
if (m_creature->IsDead())
{
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);
break;
case ACTION_T_ZONE_COMBAT_PULSE:
case ACTION_T_ZONE_COMBAT_PULSE: //38
{
m_creature->SetInCombatWithZone();
break;
}
case ACTION_T_CALL_FOR_HELP:
case ACTION_T_CALL_FOR_HELP: //39
{
m_creature->CallForHelp((float)action.call_for_help.radius);
break;
}
case ACTION_T_SET_SHEATH:
case ACTION_T_SET_SHEATH: //40
{
m_creature->SetSheath(SheathState(action.set_sheath.sheath));
break;
}
case ACTION_T_FORCE_DESPAWN:
case ACTION_T_FORCE_DESPAWN: //41
{
m_creature->ForcedDespawn(action.forced_despawn.msDelay);
break;
}
case ACTION_T_SET_INVINCIBILITY_HP_LEVEL:
case ACTION_T_SET_INVINCIBILITY_HP_LEVEL: //42
{
if (action.invincibility_hp_level.is_percent)
{ 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; }
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)
{
@ -1020,22 +1028,22 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
break;
}
case ACTION_T_THROW_AI_EVENT:
case ACTION_T_THROW_AI_EVENT: //45
{
SendAIEventAround(AIEventType(action.throwEvent.eventType), pActionInvoker, 0, action.throwEvent.radius);
break;
}
case ACTION_T_SET_THROW_MASK:
case ACTION_T_SET_THROW_MASK: //46
{
m_throwAIEventMask = action.setThrowMask.eventTypeMask;
break;
}
case ACTION_T_SET_STAND_STATE:
case ACTION_T_SET_STAND_STATE: //47
{
m_creature->SetStandState(action.setStandState.standState);
break;
}
case ACTION_T_CHANGE_MOVEMENT:
case ACTION_T_CHANGE_MOVEMENT: //48
{
switch (action.changeMovement.movementType)
{
@ -1234,7 +1242,7 @@ void CreatureEventAI::EnterCombat(Unit* enemy)
// Reset all in combat timers
case EVENT_T_TIMER_IN_COMBAT:
if (i->UpdateRepeatTimer(m_creature, event.timer.initialMin, event.timer.initialMax))
i->Enabled = true;
{ i->Enabled = true; }
break;
// All normal events need to be re-enabled and their time set to 0
default:
@ -1284,7 +1292,7 @@ void CreatureEventAI::MoveInLineOfSight(Unit* who)
{
// if range is ok and we are actually in LOS
if (m_creature->IsWithinDistInMap(who, fMaxAllowedRange) && m_creature->IsWithinLOSInMap(who))
ProcessEvent(*itr, who);
{ ProcessEvent(*itr, who); }
}
}
}
@ -1388,7 +1396,7 @@ void CreatureEventAI::UpdateAI(const uint32 diff)
}
else if (m_MeleeEnabled && m_creature->CanReachWithMeleeAttack(victim)
&& !(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.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);
if (pcon.Meets(pPlayer, m_creature->GetMap(), m_creature, CONDITION_FROM_EVENTAI))

View file

@ -128,7 +128,7 @@ enum EventAI_ActionType
ACTION_T_CHANGE_MOVEMENT = 48, // MovementType, WanderDistance, unused
ACTION_T_DYNAMIC_MOVEMENT = 49, // EnableDynamicMovement (1 = on; 0 = off)
ACTION_T_END,
ACTION_T_END
};
enum Target
@ -150,7 +150,9 @@ enum Target
// Hostile targets (including pets)
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
@ -439,8 +441,6 @@ struct CreatureEventAI_Action
};
};
#define AIEVENT_DEFAULT_THROW_RADIUS 30.0f
struct CreatureEventAI_Event
{
uint32 event_id;
@ -597,6 +597,9 @@ struct CreatureEventAI_Event
CreatureEventAI_Action action[MAX_ACTIONS];
};
#define AIEVENT_DEFAULT_THROW_RADIUS 30.0f
// Event_Map
typedef std::vector<CreatureEventAI_Event> CreatureEventAI_Event_Vec;
typedef UNORDERED_MAP<uint32, CreatureEventAI_Event_Vec > CreatureEventAI_Event_Map;

View file

@ -48,7 +48,7 @@ void DynamicObject::AddToWorld()
{
///- Register the dynamicObject for guid lookup
if (!IsInWorld())
GetMap()->GetObjectsStore().insert<DynamicObject>(GetObjectGuid(), (DynamicObject*)this);
{ GetMap()->GetObjectsStore().insert<DynamicObject>(GetObjectGuid(), (DynamicObject*)this); }
Object::AddToWorld();
}

View file

@ -40,16 +40,16 @@ void GMTicketMgr::LoadGMTickets()
QueryResult* result = CharacterDatabase.Query(
// 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)
{
BarGoLink bar(1);
bar.step();
sLog.outString();
sLog.outString(">> Loaded `character_ticket`, table is empty.");
sLog.outString();
return;
}
@ -80,8 +80,8 @@ void GMTicketMgr::LoadGMTickets()
while (result->NextRow());
delete result;
sLog.outString();
sLog.outString(">> Loaded " SIZEFMTD " GM tickets", GetTicketCount());
sLog.outString();
}
void GMTicketMgr::DeleteAll()

View file

@ -22,8 +22,8 @@
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#ifndef _GMTICKETMGR_H
#define _GMTICKETMGR_H
#ifndef MANGOS_H_GMTICKETMGR
#define MANGOS_H_GMTICKETMGR
#include "Policies/Singleton.h"
#include "Database/DatabaseEnv.h"

View file

@ -837,45 +837,6 @@ bool GameObject::isVisibleForInState(Player const* u, WorldObject const* viewPoi
(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()
{
if (m_spawnedByDefault && m_respawnTime > 0)
@ -2469,6 +2430,20 @@ void GameObject::ForceGameObjectHealth(int32 diff, Unit* caster)
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()
{
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());
}

View file

@ -600,7 +600,7 @@ struct GameObjectDataAddon
};
// 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(open): [GO_NOT_READY]->GO_READY (open) ->GO_ACTIVATED (close)->GO_JUST_DEACTIVATED->GO_READY(open) -> ...
enum LootState

View file

@ -345,7 +345,7 @@ bool Guild::CheckGuildStructure()
{
MemberSlot &member = itr->second;
if (member.RankId == GR_GUILDMASTER && m_LeaderGuid != member.guid)
member.ChangeRank(GR_OFFICER);
{ member.ChangeRank(GR_OFFICER); }
}
return true;
@ -588,7 +588,7 @@ bool Guild::DelMember(ObjectGuid guid, bool isDisbanding)
CharacterDatabase.PExecute("DELETE FROM guild_member WHERE guid = '%u'", lowguid);
if (!isDisbanding)
UpdateAccountsNumber();
{ UpdateAccountsNumber(); }
// Used by Eluna
#ifdef ENABLE_ELUNA
@ -612,11 +612,11 @@ bool Guild::ChangeMemberRank(ObjectGuid guid, uint8 newRank)
void Guild::BroadcastToGuild(WorldSession* session, const std::string& msg, uint32 language)
{
if (!session)
return;
{ return; }
Player* player = session->GetPlayer();
if (!player || !HasRankRight(player->GetRank(), GR_RIGHT_GCHATSPEAK))
return;
{ return; }
WorldPacket data;
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));
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)
{
if (!session)
return;
{ return; }
Player* player = session->GetPlayer();
if (!player || !HasRankRight(player->GetRank(), GR_RIGHT_OFFCHATSPEAK))
return;
{ return; }
for (MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr)
{

View file

@ -88,7 +88,7 @@ enum Typecommand
enum CommandErrors
{
ERR_PLAYER_NO_MORE_IN_GUILD = 0x00,
ERR_PLAYER_NO_MORE_IN_GUILD = 0x00, // no message/error
ERR_GUILD_INTERNAL = 0x01,
ERR_ALREADY_IN_GUILD = 0x02,
ERR_ALREADY_IN_GUILD_S = 0x03,
@ -96,8 +96,8 @@ enum CommandErrors
ERR_ALREADY_INVITED_TO_GUILD_S = 0x05,
ERR_GUILD_NAME_INVALID = 0x06,
ERR_GUILD_NAME_EXISTS_S = 0x07,
ERR_GUILD_LEADER_LEAVE = 0x08,
ERR_GUILD_PERMISSIONS = 0x08,
ERR_GUILD_LEADER_LEAVE = 0x08, // for Typecommand 0x03
ERR_GUILD_PERMISSIONS = 0x08, // for another Typecommand
ERR_GUILD_PLAYER_NOT_IN_GUILD = 0x09,
ERR_GUILD_PLAYER_NOT_IN_GUILD_S = 0x0A,
ERR_GUILD_PLAYER_NOT_FOUND_S = 0x0B,

View file

@ -1234,6 +1234,11 @@ bool Item::IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) cons
// time.
void Item::SendTimeUpdate(Player* owner)
{
#ifdef ENABLE_PLAYERBOTS
if (!owner || !owner->IsInWorld() || owner->GetPlayerbotAI())
return;
#endif
uint32 duration = GetUInt32Value(ITEM_FIELD_DURATION);
if (!duration)
{ return; }

View file

@ -29,9 +29,10 @@
#include "Log.h"
#include "ObjectMgr.h"
#include "ProgressBar.h"
#include "Util.h"
#include <list>
#include <vector>
#include "Util.h"
struct EnchStoreItem
{
@ -92,14 +93,13 @@ void LoadRandomEnchantmentsTable()
delete result;
sLog.outString();
sLog.outString(">> Loaded %u Item Enchantment definitions", count);
}
else
{
sLog.outString();
sLog.outErrorDb(">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty.");
}
sLog.outString();
}
uint32 GetItemEnchantMod(int32 entry)

View file

@ -22,8 +22,8 @@
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#ifndef _ITEM_ENCHANTMENT_MGR_H
#define _ITEM_ENCHANTMENT_MGR_H
#ifndef MANGOS_H_ITEM_ENCHANTMENT_MGR
#define MANGOS_H_ITEM_ENCHANTMENT_MGR
#include "Common.h"

View file

@ -22,8 +22,8 @@
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#ifndef _ITEMPROTOTYPE_H
#define _ITEMPROTOTYPE_H
#ifndef MANGOS_H_ITEMPROTOTYPE
#define MANGOS_H_ITEMPROTOTYPE
#include "Common.h"
@ -119,17 +119,17 @@ enum ItemBondingType
enum ItemPrototypeFlags
{
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_HEROIC = 0x00000008, // heroic item version
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_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_WRAPPER = 0x00000200, // used or not used wrapper
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_CHARTER = 0x00002000, // arena/guild charter
ITEM_FLAG_UNK14 = 0x00004000,

View file

@ -104,8 +104,6 @@ void LootStore::LoadLootTable()
// Clearing store (for reloading case)
Clear();
sLog.outString("%s :", GetName());
// 0 1 2 3 4 5 6
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
sLog.outString(">> Loaded %u loot definitions (" SIZEFMTD " templates) from table %s", count, m_LootTemplates.size(), GetName());
sLog.outString();
sLog.outString(">> Loaded %u loot definitions (" SIZEFMTD " templates)", count, m_LootTemplates.size());
}
else
{
@ -236,8 +234,12 @@ void LootStore::CheckLootRefs(LootIdSet* ref_set) const
void LootStore::ReportUnusedIds(LootIdSet const& ids_set) const
{
// all still listed ids isn't referenced
if (!ids_set.empty())
{
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.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
@ -428,41 +430,41 @@ bool LootItem::AllowedForPlayer(Player const* player, WorldObject const* lootTar
{
ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(itemid);
if (!pProto)
return false;
{ return false; }
// not show loot for not own team
if ((pProto->Flags2 & ITEM_FLAG2_HORDE_ONLY) && player->GetTeam() != HORDE)
return false;
{ return false; }
if ((pProto->Flags2 & ITEM_FLAG2_ALLIANCE_ONLY) && player->GetTeam() != ALLIANCE)
return false;
{ return false; }
if (needs_quest)
{
// Checking quests for quest-only drop (check only quests requirements in this case)
if (!player->HasQuestForItem(itemid))
return false;
{ return false; }
}
else
{
// 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))
return false;
{ return false; }
}
}
else if (type == LOOT_ITEM_TYPE_CURRENCY)
{
CurrencyTypesEntry const * currency = sCurrencyTypesStore.LookupEntry(itemid);
if (!itemid)
return false;
{ return false; }
if (!player->isGameMaster())
{
if (currency->Category == CURRENCY_CATEGORY_META)
return false;
{ return false; }
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 (uint32 Lootid = cInfo->LootId)
if (uint32 lootid = cInfo->LootId)
{
if (ids_set.find(Lootid) == ids_set.end())
LootTemplates_Creature.ReportNotExistedId(Lootid);
if (ids_set.find(lootid) == ids_set.end())
{ LootTemplates_Creature.ReportNotExistedId(lootid); }
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 (uint32 Lootid = proto->DisenchantID)
if (uint32 lootid = proto->DisenchantID)
{
if (ids_set.find(Lootid) == ids_set.end())
LootTemplates_Disenchant.ReportNotExistedId(Lootid);
if (ids_set.find(lootid) == ids_set.end())
{ LootTemplates_Disenchant.ReportNotExistedId(lootid); }
else
ids_setUsed.insert(Lootid);
{ ids_setUsed.insert(lootid); }
}
}
}
@ -1347,12 +1349,12 @@ void LoadLootTemplates_Gameobject()
// remove real entries and check existence loot
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())
LootTemplates_Gameobject.ReportNotExistedId(Lootid);
if (ids_set.find(lootid) == ids_set.end())
{ LootTemplates_Gameobject.ReportNotExistedId(lootid); }
else
ids_setUsed.insert(Lootid);
{ ids_setUsed.insert(lootid); }
}
}
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 (uint32 Lootid = cInfo->PickpocketLootId)
if (uint32 lootid = cInfo->PickpocketLootId)
{
if (ids_set.find(Lootid) == ids_set.end())
LootTemplates_Pickpocketing.ReportNotExistedId(Lootid);
if (ids_set.find(lootid) == ids_set.end())
{ LootTemplates_Pickpocketing.ReportNotExistedId(lootid); }
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 (uint32 Lootid = cInfo->SkinningLootId)
if (uint32 lootid = cInfo->SkinningLootId)
{
if (ids_set.find(Lootid) == ids_set.end())
LootTemplates_Skinning.ReportNotExistedId(Lootid);
if (ids_set.find(lootid) == ids_set.end())
{ LootTemplates_Skinning.ReportNotExistedId(lootid); }
else
ids_setUsed.insert(Lootid);
{ ids_setUsed.insert(lootid); }
}
}
}

View file

@ -511,9 +511,6 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 updateFlags) const
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)
*data << uint32(WorldTimer::getMSTime());
}

View file

@ -659,6 +659,7 @@ class WorldObject : public Object
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 IsActiveObject(); } // This is for Eluna to build. Should be removed in the future!
void SetActiveObjectState(bool active);
ViewPoint& GetViewPoint() { return m_viewPoint; }

View file

@ -124,13 +124,36 @@ namespace Movement
// Constant interface
/**
* @brief
*
* @return bool
*/
bool isSmooth() const { return raw() & Catmullrom;}
bool isLinear() const { return !isSmooth();}
/**
* @brief
*
* @return bool
*/
bool isFacing() const { return raw() & Mask_Final_Facing;}
uint8 getAnimationId() const { return animId;}
/**
* @brief
*
* @param f
* @return bool
*/
bool hasAllFlags(uint32 f) const { return (raw() & f) == f;}
bool hasFlag(uint32 f) const { return (raw() & f) != 0;}
/**
* @brief
*
* @param f
* @return uint32 operator
*/
uint32 operator & (uint32 f) const { return (raw() & f);}
/**
* @brief
@ -165,6 +188,10 @@ namespace Movement
void EnableParabolic() { raw() = (raw() & ~(Mask_Animations | Falling | Animation | FallingSlow)) | Trajectory;}
void EnableFalling() { raw() = (raw() & ~(Mask_Animations | Trajectory | Animation))| Falling;}
void EnableCatmullRom() { raw() = (raw() & ~SmoothGroundPath) | Catmullrom | UncompressedPath; }
/**
* @brief
*
*/
void EnableFacingPoint() { raw() = (raw() & ~Mask_Final_Facing) | Final_Point;}
/**
* @brief
@ -215,6 +242,6 @@ namespace Movement
#else
#pragma pack(pop)
#endif
}
#endif // MANGOSSERVER_MOVESPLINEFLAG_H
}
#endif

View file

@ -116,6 +116,15 @@ namespace Movement
* @param maxPathRange
*/
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);
/**
@ -128,11 +137,11 @@ namespace Movement
*/
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();
/* 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();
/**
@ -158,7 +167,9 @@ namespace Movement
*/
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
* Has no effect if falling mode enabled
*
@ -174,8 +185,12 @@ namespace Movement
*/
void SetExitVehicle();
/**
* @brief
*
* @return PointsArray
*/
PointsArray& Path() { return args.path; }
protected:
MoveSplineInitArgs args; /**< TODO */
@ -187,8 +202,17 @@ namespace Movement
*
*/
inline void MoveSplineInit::SetFly() { args.flags.flying = true;}
/**
* @brief
*
* @param enable
*/
inline void MoveSplineInit::SetWalk(bool enable) { args.flags.walkmode = enable;}
inline void MoveSplineInit::SetSmooth() { args.flags.EnableCatmullRom();}
/**
* @brief
*
*/
inline void MoveSplineInit::SetCyclic() { args.flags.cyclic = true;}
/**
* @brief
@ -218,12 +242,28 @@ namespace Movement
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)
{
Vector3 v(x, y, z);
MoveTo(v, generatePath, forceDestination);
}
/**
* @brief
*
* @param dest
* @param generatePath
* @param forceDestination
*/
inline void MoveSplineInit::MoveTo(const Vector3& dest, bool generatePath, bool forceDestination)
{
if (generatePath)
@ -253,6 +293,11 @@ namespace Movement
args.flags.EnableAnimation((uint8)anim);
}
/**
* @brief
*
* @param spot
*/
inline void MoveSplineInit::SetFacing(Vector3 const& spot)
{
args.facing.f.x = spot.x;
@ -261,4 +306,5 @@ namespace Movement
args.flags.EnableFacingPoint();
}
}
#endif // MANGOSSERVER_MOVESPLINEINIT_H

View file

@ -44,13 +44,6 @@ namespace Movement
{
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 << move_spline.spline.getPoint(move_spline.spline.first());
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)
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);
if (splineflags.animation)

View file

@ -43,6 +43,8 @@ namespace ACE_Based
LockType _lock; /**< Lock access to the queue. */
StorageType _queue; /**< Storage backing the queue. */
/*volatile*/ bool _canceled; /**< Cancellation flag. */
public:
/**