diff options
| author | Nay <dnpd.dd@gmail.com> | 2012-11-23 23:39:03 +0000 |
|---|---|---|
| committer | Nay <dnpd.dd@gmail.com> | 2012-11-23 23:39:03 +0000 |
| commit | 24cd72c8e1d6d1745b58de11ae8a03043dbfa394 (patch) | |
| tree | 6d6a05d15cf0ebb4fc40d065d4b596a4a167b063 /src/server/game/Entities | |
| parent | ef7f6b7c1eb7866c57e5a31a386f5a8d55c8fd22 (diff) | |
| parent | eb10226b02ec3cf0370840ebed00315fed566262 (diff) | |
Merge remote-tracking branch 'origin/master' into mmaps
Conflicts:
src/server/game/Maps/Map.cpp
src/server/game/Movement/MovementGenerator.h
src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp
src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h
src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h
src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp
src/server/game/Movement/MovementGenerators/HomeMovementGenerator.h
src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp
src/server/game/Movement/MovementGenerators/PointMovementGenerator.h
src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp
src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h
src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp
src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h
src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h
src/server/game/Spells/SpellEffects.cpp
Diffstat (limited to 'src/server/game/Entities')
| -rwxr-xr-x | src/server/game/Entities/Creature/Creature.cpp | 78 | ||||
| -rwxr-xr-x | src/server/game/Entities/Creature/Creature.h | 1 | ||||
| -rwxr-xr-x | src/server/game/Entities/Creature/TemporarySummon.cpp | 2 | ||||
| -rwxr-xr-x | src/server/game/Entities/Item/Container/Bag.cpp | 1 | ||||
| -rwxr-xr-x | src/server/game/Entities/Item/Item.cpp | 2 | ||||
| -rwxr-xr-x | src/server/game/Entities/Item/ItemEnchantmentMgr.cpp | 1 | ||||
| -rwxr-xr-x | src/server/game/Entities/Object/Object.cpp | 115 | ||||
| -rwxr-xr-x | src/server/game/Entities/Pet/Pet.cpp | 5 | ||||
| -rwxr-xr-x | src/server/game/Entities/Pet/Pet.h | 95 | ||||
| -rw-r--r-- | src/server/game/Entities/Pet/PetDefines.h | 80 | ||||
| -rwxr-xr-x | src/server/game/Entities/Player/Player.cpp | 294 | ||||
| -rwxr-xr-x | src/server/game/Entities/Player/Player.h | 71 | ||||
| -rwxr-xr-x | src/server/game/Entities/Totem/Totem.cpp | 5 | ||||
| -rwxr-xr-x | src/server/game/Entities/Transport/Transport.cpp | 1 | ||||
| -rwxr-xr-x | src/server/game/Entities/Unit/Unit.cpp | 72 | ||||
| -rwxr-xr-x | src/server/game/Entities/Unit/Unit.h | 21 | ||||
| -rwxr-xr-x | src/server/game/Entities/Vehicle/Vehicle.cpp | 1 |
17 files changed, 406 insertions, 439 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 9bcd4d9c1e2..911ccd25728 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -16,40 +16,42 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "BattlegroundMgr.h" +#include "CellImpl.h" #include "Common.h" -#include "DatabaseEnv.h" -#include "WorldPacket.h" -#include "World.h" -#include "ObjectMgr.h" -#include "GroupMgr.h" -#include "SpellMgr.h" -#include "Creature.h" -#include "QuestDef.h" -#include "GossipDef.h" -#include "Player.h" -#include "PoolMgr.h" -#include "Opcodes.h" -#include "Log.h" -#include "LootMgr.h" -#include "MapManager.h" #include "CreatureAI.h" #include "CreatureAISelector.h" +#include "CreatureGroups.h" +#include "Creature.h" +#include "DatabaseEnv.h" #include "Formulas.h" -#include "WaypointMovementGenerator.h" -#include "InstanceScript.h" -#include "BattlegroundMgr.h" -#include "Util.h" +#include "GameEventMgr.h" +#include "GossipDef.h" #include "GridNotifiers.h" #include "GridNotifiersImpl.h" -#include "CellImpl.h" -#include "OutdoorPvPMgr.h" -#include "GameEventMgr.h" -#include "CreatureGroups.h" -#include "Vehicle.h" -#include "SpellAuraEffects.h" #include "Group.h" -#include "MoveSplineInit.h" +#include "GroupMgr.h" +#include "InstanceScript.h" +#include "Log.h" +#include "LootMgr.h" +#include "MapManager.h" #include "MoveSpline.h" +#include "MoveSplineInit.h" +#include "ObjectMgr.h" +#include "Opcodes.h" +#include "OutdoorPvPMgr.h" +#include "Player.h" +#include "PoolMgr.h" +#include "QuestDef.h" +#include "SpellAuraEffects.h" +#include "SpellMgr.h" +#include "TemporarySummon.h" +#include "Util.h" +#include "Vehicle.h" +#include "WaypointMovementGenerator.h" +#include "World.h" +#include "WorldPacket.h" + // apply implementation of the singletons TrainerSpell const* TrainerSpellData::Find(uint32 spell_id) const @@ -953,30 +955,6 @@ bool Creature::isCanTrainingAndResetTalentsOf(Player* player) const && player->getClass() == GetCreatureTemplate()->trainer_class; } -void Creature::AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint32 /*MovementFlags*/, uint8 /*type*/) -{ - /* uint32 timeElap = getMSTime(); - if ((timeElap - m_startMove) < m_moveTime) - { - oX = (dX - oX) * ((timeElap - m_startMove) / m_moveTime); - oY = (dY - oY) * ((timeElap - m_startMove) / m_moveTime); - } - else - { - oX = dX; - oY = dY; - } - - dX = x; - dY = y; - m_orientation = atan2((oY - dY), (oX - dX)); - - m_startMove = getMSTime(); - m_moveTime = time;*/ - float speed = GetDistance(x, y, z) / ((float)time * 0.001f); - MonsterMoveWithSpeed(x, y, z, speed); -} - Player* Creature::GetLootRecipient() const { if (!m_lootRecipient) diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index c0703196075..228485d001e 100755 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -520,7 +520,6 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature bool AIM_Initialize(CreatureAI* ai = NULL); void Motion_Initialize(); - void AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint32 MovementFlags, uint8 type); CreatureAI* AI() const { return (CreatureAI*)i_AI; } bool SetWalk(bool enable); diff --git a/src/server/game/Entities/Creature/TemporarySummon.cpp b/src/server/game/Entities/Creature/TemporarySummon.cpp index 43b29c600d6..a6b51a4d395 100755 --- a/src/server/game/Entities/Creature/TemporarySummon.cpp +++ b/src/server/game/Entities/Creature/TemporarySummon.cpp @@ -21,6 +21,8 @@ #include "CreatureAI.h" #include "ObjectMgr.h" #include "TemporarySummon.h" +#include "Pet.h" +#include "Player.h" TempSummon::TempSummon(SummonPropertiesEntry const* properties, Unit* owner, bool isWorldObject) : Creature(isWorldObject), m_Properties(properties), m_type(TEMPSUMMON_MANUAL_DESPAWN), diff --git a/src/server/game/Entities/Item/Container/Bag.cpp b/src/server/game/Entities/Item/Container/Bag.cpp index db563c712cd..73b38c1da83 100755 --- a/src/server/game/Entities/Item/Container/Bag.cpp +++ b/src/server/game/Entities/Item/Container/Bag.cpp @@ -23,6 +23,7 @@ #include "Bag.h" #include "Log.h" #include "UpdateData.h" +#include "Player.h" Bag::Bag(): Item() { diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index f1a7d646fe4..a1ff6cf2ce8 100755 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -26,6 +26,8 @@ #include "SpellInfo.h" #include "ScriptMgr.h" #include "ConditionMgr.h" +#include "Player.h" +#include "Opcodes.h" void AddItemsSetItem(Player* player, Item* item) { diff --git a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp index f85bf80e145..cfb8c880479 100755 --- a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp +++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp @@ -25,6 +25,7 @@ #include <list> #include <vector> #include "Util.h" +#include "DBCStores.h" struct EnchStoreItem { diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index d7e87cedbf8..ca32fd377e9 100755 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1844,7 +1844,7 @@ bool WorldObject::CanDetect(WorldObject const* obj, bool ignoreStealth) const if (obj->IsAlwaysDetectableFor(seer)) return true; - if (!seer->CanDetectInvisibilityOf(obj)) + if (!ignoreStealth && !seer->CanDetectInvisibilityOf(obj)) return false; if (!ignoreStealth && !seer->CanDetectStealthOf(obj)) @@ -2360,119 +2360,6 @@ TempSummon* WorldObject::SummonCreature(uint32 entry, const Position &pos, TempS return NULL; } -Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, uint32 duration) -{ - Pet* pet = new Pet(this, petType); - - if (petType == SUMMON_PET && pet->LoadPetFromDB(this, entry)) - { - // Remove Demonic Sacrifice auras (known pet) - Unit::AuraEffectList const& auraClassScripts = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); - for (Unit::AuraEffectList::const_iterator itr = auraClassScripts.begin(); itr != auraClassScripts.end();) - { - if ((*itr)->GetMiscValue() == 2228) - { - RemoveAurasDueToSpell((*itr)->GetId()); - itr = auraClassScripts.begin(); - } - else - ++itr; - } - - if (duration > 0) - pet->SetDuration(duration); - - return NULL; - } - - // petentry == 0 for hunter "call pet" (current pet summoned if any) - if (!entry) - { - delete pet; - return NULL; - } - - pet->Relocate(x, y, z, ang); - if (!pet->IsPositionValid()) - { - sLog->outError(LOG_FILTER_GENERAL, "Pet (guidlow %d, entry %d) not summoned. Suggested coordinates isn't valid (X: %f Y: %f)", pet->GetGUIDLow(), pet->GetEntry(), pet->GetPositionX(), pet->GetPositionY()); - delete pet; - return NULL; - } - - Map* map = GetMap(); - uint32 pet_number = sObjectMgr->GeneratePetNumber(); - if (!pet->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_PET), map, GetPhaseMask(), entry, pet_number)) - { - sLog->outError(LOG_FILTER_GENERAL, "no such creature entry %u", entry); - delete pet; - return NULL; - } - - pet->SetCreatorGUID(GetGUID()); - pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, getFaction()); - - pet->setPowerType(POWER_MANA); - pet->SetUInt32Value(UNIT_NPC_FLAGS, 0); - pet->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - pet->InitStatsForLevel(getLevel()); - - SetMinion(pet, true); - - switch (petType) - { - case SUMMON_PET: - // this enables pet details window (Shift+P) - pet->GetCharmInfo()->SetPetNumber(pet_number, true); - pet->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048); - pet->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0); - pet->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000); - pet->SetFullHealth(); - pet->SetPower(POWER_MANA, pet->GetMaxPower(POWER_MANA)); - pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped in this case - break; - default: - break; - } - - map->AddToMap(pet->ToCreature()); - - switch (petType) - { - case SUMMON_PET: - pet->InitPetCreateSpells(); - pet->InitTalentForLevel(); - pet->SavePetToDB(PET_SAVE_AS_CURRENT); - PetSpellInitialize(); - break; - default: - break; - } - - if (petType == SUMMON_PET) - { - // Remove Demonic Sacrifice auras (known pet) - Unit::AuraEffectList const& auraClassScripts = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); - for (Unit::AuraEffectList::const_iterator itr = auraClassScripts.begin(); itr != auraClassScripts.end();) - { - if ((*itr)->GetMiscValue() == 2228) - { - RemoveAurasDueToSpell((*itr)->GetId()); - itr = auraClassScripts.begin(); - } - else - ++itr; - } - } - - if (duration > 0) - pet->SetDuration(duration); - - //ObjectAccessor::UpdateObjectVisibility(pet); - - return pet; -} - GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime) { if (!IsInWorld()) diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index d2d9bdac4b3..b6417681f4a 100755 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -30,6 +30,7 @@ #include "Unit.h" #include "Util.h" #include "Group.h" +#include "Opcodes.h" #define PET_XP_FACTOR 0.05f @@ -1077,7 +1078,7 @@ bool Pet::HaveInDiet(ItemTemplate const* item) const return diet & FoodMask; } -uint32 Pet::GetCurrentFoodBenefitLevel(uint32 itemlevel) +uint32 Pet::GetCurrentFoodBenefitLevel(uint32 itemlevel) const { // -5 or greater food level if (getLevel() <= itemlevel + 5) //possible to feed level 60 pet with level 55 level food for full effect @@ -1881,7 +1882,7 @@ void Pet::ToggleAutocast(SpellInfo const* spellInfo, bool apply) } } -bool Pet::IsPermanentPetFor(Player* owner) +bool Pet::IsPermanentPetFor(Player* owner) const { switch (getPetType()) { diff --git a/src/server/game/Entities/Pet/Pet.h b/src/server/game/Entities/Pet/Pet.h index f55d03ce081..a1dd57a26cc 100755 --- a/src/server/game/Entities/Pet/Pet.h +++ b/src/server/game/Entities/Pet/Pet.h @@ -19,50 +19,11 @@ #ifndef TRINITYCORE_PET_H #define TRINITYCORE_PET_H -#include "ObjectDefines.h" -#include "Unit.h" +#include "PetDefines.h" #include "TemporarySummon.h" -enum PetType -{ - SUMMON_PET = 0, - HUNTER_PET = 1, - MAX_PET_TYPE = 4 -}; - -#define MAX_PET_STABLES 4 - -// stored in character_pet.slot -enum PetSaveMode -{ - PET_SAVE_AS_DELETED = -1, // not saved in fact - PET_SAVE_AS_CURRENT = 0, // in current slot (with player) - PET_SAVE_FIRST_STABLE_SLOT = 1, - PET_SAVE_LAST_STABLE_SLOT = MAX_PET_STABLES, // last in DB stable slot index (including), all higher have same meaning as PET_SAVE_NOT_IN_SLOT - PET_SAVE_NOT_IN_SLOT = 100 // for avoid conflict with stable size grow will use 100 -}; - -enum HappinessState -{ - UNHAPPY = 1, - CONTENT = 2, - HAPPY = 3 -}; - -enum PetSpellState -{ - PETSPELL_UNCHANGED = 0, - PETSPELL_CHANGED = 1, - PETSPELL_NEW = 2, - PETSPELL_REMOVED = 3 -}; - -enum PetSpellType -{ - PETSPELL_NORMAL = 0, - PETSPELL_FAMILY = 1, - PETSPELL_TALENT = 2 -}; +#define PET_FOCUS_REGEN_INTERVAL 4 * IN_MILLISECONDS +#define HAPPINESS_LEVEL_SIZE 333000 struct PetSpell { @@ -71,51 +32,9 @@ struct PetSpell PetSpellType type; }; -enum ActionFeedback -{ - FEEDBACK_NONE = 0, - FEEDBACK_PET_DEAD = 1, - FEEDBACK_NOTHING_TO_ATT = 2, - FEEDBACK_CANT_ATT_TARGET = 3 -}; - -enum PetTalk -{ - PET_TALK_SPECIAL_SPELL = 0, - PET_TALK_ATTACK = 1 -}; - -enum PetNameInvalidReason -{ - // custom, not send - PET_NAME_SUCCESS = 0, - - PET_NAME_INVALID = 1, - PET_NAME_NO_NAME = 2, - PET_NAME_TOO_SHORT = 3, - PET_NAME_TOO_LONG = 4, - PET_NAME_MIXED_LANGUAGES = 6, - PET_NAME_PROFANE = 7, - PET_NAME_RESERVED = 8, - PET_NAME_THREE_CONSECUTIVE = 11, - PET_NAME_INVALID_SPACE = 12, - PET_NAME_CONSECUTIVE_SPACES = 13, - PET_NAME_RUSSIAN_CONSECUTIVE_SILENT_CHARACTERS = 14, - PET_NAME_RUSSIAN_SILENT_CHARACTER_AT_BEGINNING_OR_END = 15, - PET_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME = 16 -}; - typedef UNORDERED_MAP<uint32, PetSpell> PetSpellMap; typedef std::vector<uint32> AutoSpellList; -#define HAPPINESS_LEVEL_SIZE 333000 - -#define ACTIVE_SPELLS_MAX 4 - -#define PET_FOLLOW_DIST 1.0f -#define PET_FOLLOW_ANGLE (M_PI/2) -#define PET_FOCUS_REGEN_INTERVAL 4 * IN_MILLISECONDS - class Player; class Pet : public Guardian @@ -132,9 +51,9 @@ class Pet : public Guardian bool isControlled() const { return getPetType() == SUMMON_PET || getPetType() == HUNTER_PET; } bool isTemporarySummoned() const { return m_duration > 0; } - bool IsPermanentPetFor(Player* owner); // pet have tab in character windows and set UNIT_FIELD_PETNUMBER + bool IsPermanentPetFor(Player* owner) const; // pet have tab in character windows and set UNIT_FIELD_PETNUMBER - bool Create (uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 pet_number); + bool Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 pet_number); bool CreateBaseAtCreature(Creature* creature); bool CreateBaseAtCreatureInfo(CreatureTemplate const* cinfo, Unit* owner); bool CreateBaseAtTamed(CreatureTemplate const* cinfo, Map* map, uint32 phaseMask); @@ -162,9 +81,9 @@ class Pet : public Guardian void GivePetLevel(uint8 level); void SynchronizeLevelWithOwner(); bool HaveInDiet(ItemTemplate const* item) const; - uint32 GetCurrentFoodBenefitLevel(uint32 itemlevel); + uint32 GetCurrentFoodBenefitLevel(uint32 itemlevel) const; void SetDuration(int32 dur) { m_duration = dur; } - int32 GetDuration() { return m_duration; } + int32 GetDuration() const { return m_duration; } /* bool UpdateStats(Stats stat); diff --git a/src/server/game/Entities/Pet/PetDefines.h b/src/server/game/Entities/Pet/PetDefines.h new file mode 100644 index 00000000000..76de2647c8c --- /dev/null +++ b/src/server/game/Entities/Pet/PetDefines.h @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef TRINITYCORE_PET_DEFINES_H +#define TRINITYCORE_PET_DEFINES_H + +enum PetType +{ + SUMMON_PET = 0, + HUNTER_PET = 1, + MAX_PET_TYPE = 4 +}; + +#define MAX_PET_STABLES 4 + +// stored in character_pet.slot +enum PetSaveMode +{ + PET_SAVE_AS_DELETED = -1, // not saved in fact + PET_SAVE_AS_CURRENT = 0, // in current slot (with player) + PET_SAVE_FIRST_STABLE_SLOT = 1, + PET_SAVE_LAST_STABLE_SLOT = MAX_PET_STABLES, // last in DB stable slot index (including), all higher have same meaning as PET_SAVE_NOT_IN_SLOT + PET_SAVE_NOT_IN_SLOT = 100 // for avoid conflict with stable size grow will use 100 +}; + +enum HappinessState +{ + UNHAPPY = 1, + CONTENT = 2, + HAPPY = 3 +}; + +enum PetSpellState +{ + PETSPELL_UNCHANGED = 0, + PETSPELL_CHANGED = 1, + PETSPELL_NEW = 2, + PETSPELL_REMOVED = 3 +}; + +enum PetSpellType +{ + PETSPELL_NORMAL = 0, + PETSPELL_FAMILY = 1, + PETSPELL_TALENT = 2 +}; + +enum ActionFeedback +{ + FEEDBACK_NONE = 0, + FEEDBACK_PET_DEAD = 1, + FEEDBACK_NOTHING_TO_ATT = 2, + FEEDBACK_CANT_ATT_TARGET = 3 +}; + +enum PetTalk +{ + PET_TALK_SPECIAL_SPELL = 0, + PET_TALK_ATTACK = 1 +}; + +#define PET_FOLLOW_DIST 1.0f +#define PET_FOLLOW_ANGLE (M_PI/2) + +#endif diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 46110a2cc11..dd9907d8c07 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -16,67 +16,68 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "Common.h" -#include "Language.h" -#include "DatabaseEnv.h" -#include "Log.h" -#include "Opcodes.h" -#include "SpellMgr.h" -#include "World.h" -#include "WorldPacket.h" -#include "WorldSession.h" -#include "UpdateMask.h" #include "Player.h" -#include "Vehicle.h" -#include "SkillDiscovery.h" -#include "QuestDef.h" -#include "GossipDef.h" -#include "UpdateData.h" +#include "AccountMgr.h" +#include "AchievementMgr.h" +#include "ArenaTeam.h" +#include "ArenaTeamMgr.h" +#include "Battlefield.h" +#include "BattlefieldMgr.h" +#include "BattlefieldWG.h" +#include "BattlegroundAV.h" +#include "Battleground.h" +#include "BattlegroundMgr.h" +#include "CellImpl.h" #include "Channel.h" #include "ChannelMgr.h" -#include "MapManager.h" -#include "MapInstanced.h" -#include "InstanceSaveMgr.h" -#include "GridNotifiers.h" -#include "GridNotifiersImpl.h" -#include "CellImpl.h" -#include "ObjectMgr.h" -#include "ArenaTeamMgr.h" -#include "GuildMgr.h" -#include "GroupMgr.h" -#include "ObjectAccessor.h" +#include "CharacterDatabaseCleaner.h" +#include "Chat.h" +#include <cmath> +#include "Common.h" +#include "ConditionMgr.h" #include "CreatureAI.h" +#include "DatabaseEnv.h" +#include "DisableMgr.h" #include "Formulas.h" +#include "GameEventMgr.h" +#include "GossipDef.h" +#include "GridNotifiers.h" +#include "GridNotifiersImpl.h" #include "Group.h" +#include "GroupMgr.h" #include "Guild.h" -#include "Pet.h" -#include "Util.h" -#include "Transport.h" -#include "Weather.h" -#include "Battleground.h" -#include "BattlegroundAV.h" -#include "BattlegroundMgr.h" +#include "GuildMgr.h" +#include "InstanceSaveMgr.h" +#include "InstanceScript.h" +#include "Language.h" +#include "LFGMgr.h" +#include "Log.h" +#include "MapInstanced.h" +#include "MapManager.h" +#include "ObjectAccessor.h" +#include "ObjectMgr.h" +#include "Opcodes.h" #include "OutdoorPvP.h" #include "OutdoorPvPMgr.h" -#include "ArenaTeam.h" -#include "Chat.h" -#include "Spell.h" +#include "ReputationMgr.h" +#include "Pet.h" +#include "QuestDef.h" +#include "SkillDiscovery.h" #include "SocialMgr.h" -#include "GameEventMgr.h" -#include "AchievementMgr.h" -#include "SpellAuras.h" #include "SpellAuraEffects.h" -#include "ConditionMgr.h" -#include "DisableMgr.h" +#include "SpellAuras.h" +#include "Spell.h" +#include "SpellMgr.h" +#include "Transport.h" +#include "UpdateData.h" +#include "UpdateMask.h" +#include "Util.h" +#include "Vehicle.h" +#include "Weather.h" #include "WeatherMgr.h" -#include "LFGMgr.h" -#include "CharacterDatabaseCleaner.h" -#include "InstanceScript.h" -#include <cmath> -#include "AccountMgr.h" -#include "Battlefield.h" -#include "BattlefieldMgr.h" -#include "BattlefieldWG.h" +#include "World.h" +#include "WorldPacket.h" +#include "WorldSession.h" #define ZONE_UPDATE_INTERVAL (1*IN_MILLISECONDS) @@ -643,7 +644,7 @@ void KillRewarder::Reward() #ifdef _MSC_VER #pragma warning(disable:4355) #endif -Player::Player(WorldSession* session): Unit(true), m_achievementMgr(this), m_reputationMgr(this) +Player::Player(WorldSession* session): Unit(true) { #ifdef _MSC_VER #pragma warning(default:4355) @@ -869,6 +870,8 @@ Player::Player(WorldSession* session): Unit(true), m_achievementMgr(this), m_rep SetPendingBind(0, 0); _activeCheats = CHEAT_NONE; + m_achievementMgr = new AchievementMgr(this); + m_reputationMgr = new ReputationMgr(this); } Player::~Player() @@ -904,6 +907,8 @@ Player::~Player() delete m_declinedname; delete m_runes; + delete m_achievementMgr; + delete m_reputationMgr; sWorld->DecreasePlayerCount(); } @@ -1609,7 +1614,7 @@ void Player::Update(uint32 p_time) } } - m_achievementMgr.UpdateTimedAchievements(p_time); + m_achievementMgr->UpdateTimedAchievements(p_time); if (HasUnitState(UNIT_STATE_MELEE_ATTACKING) && !HasUnitState(UNIT_STATE_CASTING)) { @@ -5580,11 +5585,11 @@ void Player::CleanupChannels() { Channel* ch = *m_channels.begin(); m_channels.erase(m_channels.begin()); // remove from player's channel list - ch->Leave(GetGUID(), false); // not send to client, not remove from player's channel list + ch->LeaveChannel(this, false); // not send to client, not remove from player's channel list if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetTeam())) cMgr->LeftChannel(ch->GetName()); // deleted channel if empty } - sLog->outDebug(LOG_FILTER_CHATSYS, "Player: channels cleaned up!"); + sLog->outDebug(LOG_FILTER_CHATSYS, "Player %s: channels cleaned up!", GetName().c_str()); } void Player::UpdateLocalChannels(uint32 newZone) @@ -5657,11 +5662,11 @@ void Player::UpdateLocalChannels(uint32 newZone) removeChannel = usedChannel; if (joinChannel) - joinChannel->Join(GetGUID(), ""); // Changed Channel: ... or Joined Channel: ... + joinChannel->JoinChannel(this, ""); // Changed Channel: ... or Joined Channel: ... if (removeChannel) { - removeChannel->Leave(GetGUID(), sendRemove); // Leave old channel + removeChannel->LeaveChannel(this, sendRemove); // Leave old channel std::string name = removeChannel->GetName(); // Store name, (*i)erase in LeftChannel LeftChannel(removeChannel); // Remove from player's channel list cMgr->LeftChannel(name); // Delete if empty @@ -5676,7 +5681,7 @@ void Player::LeaveLFGChannel() { if ((*i)->IsLFG()) { - (*i)->Leave(GetGUID()); + (*i)->LeaveChannel(this); break; } } @@ -5684,13 +5689,8 @@ void Player::LeaveLFGChannel() void Player::UpdateDefense() { - uint32 defense_skill_gain = sWorld->getIntConfig(CONFIG_SKILL_GAIN_DEFENSE); - - if (UpdateSkill(SKILL_DEFENSE, defense_skill_gain)) - { - // update dependent from defense skill part - UpdateDefenseBonusesMod(); - } + if (UpdateSkill(SKILL_DEFENSE, sWorld->getIntConfig(CONFIG_SKILL_GAIN_DEFENSE))) + UpdateDefenseBonusesMod(); // update dependent from defense skill part } void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, float amount, bool apply) @@ -7259,7 +7259,7 @@ bool Player::RewardHonor(Unit* victim, uint32 groupsize, int32 honor, bool pvpto int32 count = sWorld->getIntConfig(CONFIG_PVP_TOKEN_COUNT); if (AddItem(itemId, count)) - ChatHandler(this).PSendSysMessage("You have been awarded a token for slaying another player."); + ChatHandler(GetSession()).PSendSysMessage("You have been awarded a token for slaying another player."); } } @@ -16648,6 +16648,11 @@ float Player::GetFloatValueFromArray(Tokenizer const& data, uint16 index) return result; } +bool Player::isBeingLoaded() const +{ + return GetSession()->PlayerLoading(); +} + bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) { //// 0 1 2 3 4 5 6 7 8 9 10 11 @@ -16732,7 +16737,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 1.0f); // load achievements before anything else to prevent multiple gains for the same achievement/criteria on every loading (as loading does call UpdateAchievementCriteria) - m_achievementMgr.LoadFromDB(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS), holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS)); + m_achievementMgr->LoadFromDB(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS), holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS)); uint32 money = fields[8].GetUInt32(); if (money > MAX_MONEY_AMOUNT) @@ -17176,7 +17181,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) learnDefaultSpells(); // must be before inventory (some items required reputation check) - m_reputationMgr.LoadFromDB(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADREPUTATION)); + m_reputationMgr->LoadFromDB(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADREPUTATION)); _LoadInventory(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADINVENTORY), time_diff); @@ -17284,7 +17289,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) _LoadDeclinedNames(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADDECLINEDNAMES)); - m_achievementMgr.CheckAllAchievementCriteria(); + m_achievementMgr->CheckAllAchievementCriteria(); _LoadEquipmentSets(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS)); @@ -18509,6 +18514,14 @@ bool Player::CheckInstanceLoginValid() return sMapMgr->CanPlayerEnter(GetMap()->GetId(), this, true); } +bool Player::CheckInstanceCount(uint32 instanceId) const +{ + if (_instanceResetTimes.size() < sWorld->getIntConfig(CONFIG_MAX_INSTANCES_PER_HOUR)) + return true; + return _instanceResetTimes.find(instanceId) != _instanceResetTimes.end(); +} + + bool Player::_LoadHomeBind(PreparedQueryResult result) { PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass()); @@ -18828,8 +18841,8 @@ void Player::SaveToDB(bool create /*=false*/) _SaveActions(trans); _SaveAuras(trans); _SaveSkills(trans); - m_achievementMgr.SaveToDB(trans); - m_reputationMgr.SaveToDB(trans); + m_achievementMgr->SaveToDB(trans); + m_reputationMgr->SaveToDB(trans); _SaveEquipmentSets(trans); GetSession()->SaveTutorialsData(trans); // changed only while character in game _SaveGlyphs(trans); @@ -19967,7 +19980,7 @@ void Player::Whisper(const std::string& text, uint32 language, uint64 receiver) } else if (!isAddonMessage) // announce to player that player he is whispering to is dnd and cannot receive his message - ChatHandler(this).PSendSysMessage(LANG_PLAYER_DND, rPlayer->GetName().c_str(), rPlayer->dndMsg.c_str()); + ChatHandler(GetSession()).PSendSysMessage(LANG_PLAYER_DND, rPlayer->GetName().c_str(), rPlayer->dndMsg.c_str()); // rest stuff shouldn't happen in case of addon message if (isAddonMessage) @@ -19976,12 +19989,12 @@ void Player::Whisper(const std::string& text, uint32 language, uint64 receiver) if (!isAcceptWhispers() && !isGameMaster() && !rPlayer->isGameMaster()) { SetAcceptWhispers(true); - ChatHandler(this).SendSysMessage(LANG_COMMAND_WHISPERON); + ChatHandler(GetSession()).SendSysMessage(LANG_COMMAND_WHISPERON); } // announce to player that player he is whispering to is afk if (rPlayer->isAFK()) - ChatHandler(this).PSendSysMessage(LANG_PLAYER_AFK, rPlayer->GetName().c_str(), rPlayer->afkMsg.c_str()); + ChatHandler(GetSession()).PSendSysMessage(LANG_PLAYER_AFK, rPlayer->GetName().c_str(), rPlayer->afkMsg.c_str()); // if player whisper someone, auto turn of dnd to be able to receive an answer if (isDND() && !rPlayer->isGameMaster()) @@ -21702,7 +21715,7 @@ bool Player::IsAlwaysDetectableFor(WorldObject const* seer) const return false; } -bool Player::IsVisibleGloballyFor(Player* u) const +bool Player::IsVisibleGloballyFor(Player const* u) const { if (!u) return false; @@ -22077,8 +22090,8 @@ void Player::SendInitialPacketsBeforeAddToMap() GetSession()->SendPacket(&data); SendInitialActionButtons(); - m_reputationMgr.SendInitialReputations(); - m_achievementMgr.SendAllAchievementData(); + m_reputationMgr->SendInitialReputations(); + m_achievementMgr->SendAllAchievementData(); SendEquipmentSetList(); @@ -24189,42 +24202,42 @@ void Player::HandleFall(MovementInfo const& movementInfo) void Player::ResetAchievements() { - m_achievementMgr.Reset(); + m_achievementMgr->Reset(); } void Player::SendRespondInspectAchievements(Player* player) const { - m_achievementMgr.SendRespondInspectAchievements(player); + m_achievementMgr->SendRespondInspectAchievements(player); } bool Player::HasAchieved(uint32 achievementId) const { - return m_achievementMgr.HasAchieved(achievementId); + return m_achievementMgr->HasAchieved(achievementId); } void Player::StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry, uint32 timeLost/* = 0*/) { - m_achievementMgr.StartTimedAchievement(type, entry, timeLost); + m_achievementMgr->StartTimedAchievement(type, entry, timeLost); } void Player::RemoveTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry) { - m_achievementMgr.RemoveTimedAchievement(type, entry); + m_achievementMgr->RemoveTimedAchievement(type, entry); } void Player::ResetAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1 /*= 0*/, uint32 miscValue2 /*= 0*/, bool evenIfCriteriaComplete /* = false*/) { - m_achievementMgr.ResetAchievementCriteria(type, miscValue1, miscValue2, evenIfCriteriaComplete); + m_achievementMgr->ResetAchievementCriteria(type, miscValue1, miscValue2, evenIfCriteriaComplete); } void Player::UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1 /*= 0*/, uint32 miscValue2 /*= 0*/, Unit* unit /*= NULL*/) { - m_achievementMgr.UpdateAchievementCriteria(type, miscValue1, miscValue2, unit); + m_achievementMgr->UpdateAchievementCriteria(type, miscValue1, miscValue2, unit); } void Player::CompletedAchievement(AchievementEntry const* entry) { - m_achievementMgr.CompletedAchievement(entry); + m_achievementMgr->CompletedAchievement(entry); } void Player::LearnTalent(uint32 talentId, uint32 talentRank) @@ -25330,7 +25343,7 @@ bool Player::AddItem(uint32 itemId, uint32 count) if (count == 0 || dest.empty()) { // -- TODO: Send to mailbox if no space - ChatHandler(this).PSendSysMessage("You don't have any space in your bags."); + ChatHandler(GetSession()).PSendSysMessage("You don't have any space in your bags."); return false; } @@ -25594,3 +25607,116 @@ Guild* Player::GetGuild() uint32 guildId = GetGuildId(); return guildId ? sGuildMgr->GetGuildById(guildId) : NULL; } + +Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, uint32 duration) +{ + Pet* pet = new Pet(this, petType); + + if (petType == SUMMON_PET && pet->LoadPetFromDB(this, entry)) + { + // Remove Demonic Sacrifice auras (known pet) + Unit::AuraEffectList const& auraClassScripts = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); + for (Unit::AuraEffectList::const_iterator itr = auraClassScripts.begin(); itr != auraClassScripts.end();) + { + if ((*itr)->GetMiscValue() == 2228) + { + RemoveAurasDueToSpell((*itr)->GetId()); + itr = auraClassScripts.begin(); + } + else + ++itr; + } + + if (duration > 0) + pet->SetDuration(duration); + + return NULL; + } + + // petentry == 0 for hunter "call pet" (current pet summoned if any) + if (!entry) + { + delete pet; + return NULL; + } + + pet->Relocate(x, y, z, ang); + if (!pet->IsPositionValid()) + { + sLog->outError(LOG_FILTER_GENERAL, "Pet (guidlow %d, entry %d) not summoned. Suggested coordinates isn't valid (X: %f Y: %f)", pet->GetGUIDLow(), pet->GetEntry(), pet->GetPositionX(), pet->GetPositionY()); + delete pet; + return NULL; + } + + Map* map = GetMap(); + uint32 pet_number = sObjectMgr->GeneratePetNumber(); + if (!pet->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_PET), map, GetPhaseMask(), entry, pet_number)) + { + sLog->outError(LOG_FILTER_GENERAL, "no such creature entry %u", entry); + delete pet; + return NULL; + } + + pet->SetCreatorGUID(GetGUID()); + pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, getFaction()); + + pet->setPowerType(POWER_MANA); + pet->SetUInt32Value(UNIT_NPC_FLAGS, 0); + pet->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); + pet->InitStatsForLevel(getLevel()); + + SetMinion(pet, true); + + switch (petType) + { + case SUMMON_PET: + // this enables pet details window (Shift+P) + pet->GetCharmInfo()->SetPetNumber(pet_number, true); + pet->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048); + pet->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0); + pet->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000); + pet->SetFullHealth(); + pet->SetPower(POWER_MANA, pet->GetMaxPower(POWER_MANA)); + pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped in this case + break; + default: + break; + } + + map->AddToMap(pet->ToCreature()); + + switch (petType) + { + case SUMMON_PET: + pet->InitPetCreateSpells(); + pet->InitTalentForLevel(); + pet->SavePetToDB(PET_SAVE_AS_CURRENT); + PetSpellInitialize(); + break; + default: + break; + } + + if (petType == SUMMON_PET) + { + // Remove Demonic Sacrifice auras (known pet) + Unit::AuraEffectList const& auraClassScripts = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); + for (Unit::AuraEffectList::const_iterator itr = auraClassScripts.begin(); itr != auraClassScripts.end();) + { + if ((*itr)->GetMiscValue() == 2228) + { + RemoveAurasDueToSpell((*itr)->GetId()); + itr = auraClassScripts.begin(); + } + else + ++itr; + } + } + + if (duration > 0) + pet->SetDuration(duration); + + //ObjectAccessor::UpdateObjectVisibility(pet); + + return pet; +} diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index fe1d1a5b798..3e4b3e8a971 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -19,30 +19,28 @@ #ifndef _PLAYER_H #define _PLAYER_H -#include "AchievementMgr.h" -#include "Battleground.h" -#include "Bag.h" -#include "Common.h" -#include "DatabaseEnv.h" -#include "DBCEnums.h" +#include "DBCStores.h" #include "GroupReference.h" -#include "ItemPrototype.h" -#include "Item.h" #include "MapReference.h" -#include "NPCHandler.h" -#include "Pet.h" + +#include "Item.h" +#include "PetDefines.h" #include "QuestDef.h" -#include "ReputationMgr.h" -#include "Unit.h" -#include "Util.h" // for Tokens typedef -#include "WorldSession.h" #include "SpellMgr.h" +#include "Unit.h" -#include<string> -#include<vector> +#include <string> +#include <vector> +struct CreatureTemplate; struct Mail; +struct TrainerSpell; +struct VendorItem; + +class AchievementMgr; +class ReputationMgr; class Channel; +class CharacterCreateInfo; class Creature; class DynamicObject; class Group; @@ -242,9 +240,7 @@ typedef std::list<PlayerCreateInfoAction> PlayerCreateInfoActions; struct PlayerInfo { // existence checked by displayId != 0 - PlayerInfo() : displayId_m(0), displayId_f(0), levelInfo(NULL) - { - } + PlayerInfo() : displayId_m(0), displayId_f(0), levelInfo(NULL) { } uint32 mapId; uint32 areaId; @@ -725,13 +721,6 @@ enum RestType REST_TYPE_IN_CITY = 2 }; -enum DuelCompleteType -{ - DUEL_INTERRUPTED = 0, - DUEL_WON = 1, - DUEL_FLED = 2 -}; - enum TeleportToOptions { TELE_TO_GM_MODE = 0x01, @@ -834,17 +823,6 @@ struct InstancePlayerBind InstancePlayerBind() : save(NULL), perm(false) {} }; -enum DungeonStatusFlag -{ - DUNGEON_STATUSFLAG_NORMAL = 0x01, - DUNGEON_STATUSFLAG_HEROIC = 0x02, - - RAID_STATUSFLAG_10MAN_NORMAL = 0x01, - RAID_STATUSFLAG_25MAN_NORMAL = 0x02, - RAID_STATUSFLAG_10MAN_HEROIC = 0x04, - RAID_STATUSFLAG_25MAN_HEROIC = 0x08 -}; - struct AccessRequirement { uint8 levelMin; @@ -1513,7 +1491,7 @@ class Player : public Unit, public GridObject<Player> /*********************************************************/ bool LoadFromDB(uint32 guid, SQLQueryHolder *holder); - bool isBeingLoaded() const { return GetSession()->PlayerLoading();} + bool isBeingLoaded() const; void Initialize(uint32 guid); static uint32 GetUInt32ValueFromArray(Tokenizer const& data, uint16 index); @@ -2037,8 +2015,8 @@ class Player : public Unit, public GridObject<Player> uint8 GetGrantableLevels() { return m_grantableLevels; } void SetGrantableLevels(uint8 val) { m_grantableLevels = val; } - ReputationMgr& GetReputationMgr() { return m_reputationMgr; } - ReputationMgr const& GetReputationMgr() const { return m_reputationMgr; } + ReputationMgr& GetReputationMgr() { return *m_reputationMgr; } + ReputationMgr const& GetReputationMgr() const { return *m_reputationMgr; } ReputationRank GetReputationRank(uint32 faction_id) const; void RewardReputation(Unit* victim, float rate); void RewardReputation(Quest const* quest); @@ -2339,7 +2317,7 @@ class Player : public Unit, public GridObject<Player> bool IsNeverVisible() const; - bool IsVisibleGloballyFor(Player* player) const; + bool IsVisibleGloballyFor(Player const* player) const; void SendInitialVisiblePackets(Unit* target); void UpdateObjectVisibility(bool forced = true); @@ -2398,12 +2376,7 @@ class Player : public Unit, public GridObject<Player> static void ConvertInstancesToGroup(Player* player, Group* group, bool switchLeader); bool Satisfy(AccessRequirement const* ar, uint32 target_map, bool report = false); bool CheckInstanceLoginValid(); - bool CheckInstanceCount(uint32 instanceId) const - { - if (_instanceResetTimes.size() < sWorld->getIntConfig(CONFIG_MAX_INSTANCES_PER_HOUR)) - return true; - return _instanceResetTimes.find(instanceId) != _instanceResetTimes.end(); - } + bool CheckInstanceCount(uint32 instanceId) const; void AddInstanceEnterTime(uint32 instanceId, time_t enterTime) { @@ -2860,8 +2833,8 @@ class Player : public Unit, public GridObject<Player> uint32 m_temporaryUnsummonedPetNumber; uint32 m_oldpetspell; - AchievementMgr m_achievementMgr; - ReputationMgr m_reputationMgr; + AchievementMgr* m_achievementMgr; + ReputationMgr* m_reputationMgr; SpellCooldowns m_spellCooldowns; diff --git a/src/server/game/Entities/Totem/Totem.cpp b/src/server/game/Entities/Totem/Totem.cpp index d5d1bd99277..4d726181c4f 100755 --- a/src/server/game/Entities/Totem/Totem.cpp +++ b/src/server/game/Entities/Totem/Totem.cpp @@ -17,13 +17,14 @@ */ #include "Totem.h" -#include "WorldPacket.h" #include "Log.h" #include "Group.h" -#include "Player.h" #include "ObjectMgr.h" +#include "Opcodes.h" +#include "Player.h" #include "SpellMgr.h" #include "SpellInfo.h" +#include "WorldPacket.h" Totem::Totem(SummonPropertiesEntry const* properties, Unit* owner) : Minion(properties, owner, false) { diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index f52d0059a36..6de359c67dd 100755 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -26,6 +26,7 @@ #include "DBCStores.h" #include "World.h" #include "GameObjectAI.h" +#include "Player.h" void MapManager::LoadTransports() { diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 29afc0c1b36..0b168a1615b 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -16,49 +16,50 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "Unit.h" #include "Common.h" +#include "Battlefield.h" +#include "BattlefieldMgr.h" +#include "Battleground.h" +#include "CellImpl.h" +#include "ConditionMgr.h" +#include "CreatureAI.h" #include "CreatureAIImpl.h" -#include "Log.h" -#include "Opcodes.h" -#include "WorldPacket.h" -#include "WorldSession.h" -#include "World.h" -#include "ObjectMgr.h" -#include "SpellMgr.h" -#include "Unit.h" -#include "QuestDef.h" -#include "Player.h" +#include "CreatureGroups.h" #include "Creature.h" -#include "Spell.h" +#include "Formulas.h" +#include "GridNotifiersImpl.h" #include "Group.h" -#include "SpellAuras.h" -#include "SpellAuraEffects.h" +#include "InstanceSaveMgr.h" +#include "InstanceScript.h" +#include "Log.h" #include "MapManager.h" +#include "MoveSpline.h" +#include "MoveSplineInit.h" #include "ObjectAccessor.h" -#include "CreatureAI.h" -#include "Formulas.h" -#include "Pet.h" -#include "Util.h" -#include "Totem.h" -#include "Battleground.h" +#include "ObjectMgr.h" +#include "Opcodes.h" #include "OutdoorPvP.h" -#include "InstanceSaveMgr.h" -#include "GridNotifiersImpl.h" -#include "CellImpl.h" -#include "CreatureGroups.h" -#include "PetAI.h" #include "PassiveAI.h" +#include "PetAI.h" +#include "Pet.h" +#include "Player.h" +#include "QuestDef.h" +#include "ReputationMgr.h" +#include "SpellAuraEffects.h" +#include "SpellAuras.h" +#include "Spell.h" +#include "SpellInfo.h" +#include "SpellMgr.h" #include "TemporarySummon.h" -#include "Vehicle.h" +#include "Totem.h" #include "Transport.h" -#include "InstanceScript.h" -#include "SpellInfo.h" -#include "MoveSplineInit.h" -#include "MoveSpline.h" -#include "ConditionMgr.h" #include "UpdateFieldFlags.h" -#include "Battlefield.h" -#include "BattlefieldMgr.h" +#include "Util.h" +#include "Vehicle.h" +#include "World.h" +#include "WorldPacket.h" +#include "WorldSession.h" #include <math.h> @@ -1328,7 +1329,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss) // If this is a creature and it attacks from behind it has a probability to daze it's victim if ((damageInfo->hitOutCome == MELEE_HIT_CRIT || damageInfo->hitOutCome == MELEE_HIT_CRUSHING || damageInfo->hitOutCome == MELEE_HIT_NORMAL || damageInfo->hitOutCome == MELEE_HIT_GLANCING) && GetTypeId() != TYPEID_PLAYER && !ToCreature()->IsControlledByPlayer() && !victim->HasInArc(M_PI, this) - && (victim->GetTypeId() == TYPEID_PLAYER || !victim->ToCreature()->isWorldBoss())) + && (victim->GetTypeId() == TYPEID_PLAYER || !victim->ToCreature()->isWorldBoss())&& !victim->IsVehicle()) { // -probability is between 0% and 40% // 20% base chance @@ -1341,7 +1342,10 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss) uint32 VictimDefense=victim->GetDefenseSkillValue(); uint32 AttackerMeleeSkill=GetUnitMeleeSkill(); - Probability *= AttackerMeleeSkill/(float)VictimDefense; + Probability *= AttackerMeleeSkill/(float)VictimDefense*0.16; + + if (Probability < 0) + Probability = 0; if (Probability > 40.0f) Probability = 40.0f; diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index ce329098bc6..08fefe4c420 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -19,24 +19,14 @@ #ifndef __UNIT_H #define __UNIT_H -#include "Common.h" -#include "Object.h" -#include "Opcodes.h" -#include "SpellAuraDefines.h" -#include "UpdateFields.h" -#include "SharedDefines.h" -#include "ThreatManager.h" -#include "HostileRefManager.h" +#include "EventProcessor.h" #include "FollowerReference.h" #include "FollowerRefManager.h" -#include "EventProcessor.h" +#include "HostileRefManager.h" #include "MotionMaster.h" -#include "DBCStructure.h" -#include "SpellInfo.h" -#include "Path.h" -#include "WorldPacket.h" -#include "Timer.h" -#include <list> +#include "Object.h" +#include "SpellAuraDefines.h" +#include "ThreatManager.h" #define WORLD_TRIGGER 12999 @@ -342,6 +332,7 @@ class Totem; class Transport; class Vehicle; class TransportBase; +class SpellCastTargets; typedef std::list<Unit*> UnitList; typedef std::list< std::pair<Aura*, uint8> > DispelChargesList; diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index 84274a9692d..f8f7a1a1b72 100755 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -29,6 +29,7 @@ #include "SpellMgr.h" #include "SpellInfo.h" #include "MoveSplineInit.h" +#include "TemporarySummon.h" Vehicle::Vehicle(Unit* unit, VehicleEntry const* vehInfo, uint32 creatureEntry) : _me(unit), _vehicleInfo(vehInfo), _usableSeatNum(0), _creatureEntry(creatureEntry) { |
