Skip to content

Commit

Permalink
Merge pull request TrinityCore#30 from TrinityCore/master
Browse files Browse the repository at this point in the history
Update 05.23.23
  • Loading branch information
KamiliaBlow committed May 23, 2023
2 parents e4f0a69 + 01f8d2e commit 74995da
Show file tree
Hide file tree
Showing 17 changed files with 676 additions and 22 deletions.
12 changes: 6 additions & 6 deletions .circleci/config.yml
Expand Up @@ -59,9 +59,9 @@ jobs:
mkdir bin
cd bin
if [ "$DOCKERHUB_PUSH_IMAGES" == "TRUE" ]; then
cmake ../ -DWITH_WARNINGS=1 -DWITH_COREDEBUG=0 -DUSE_COREPCH=1 -DUSE_SCRIPTPCH=1 -DTOOLS=1 -DSCRIPTS=static -DSERVERS=1 -DNOJEM=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror" -DCMAKE_INSTALL_PREFIX=check_install -DBUILD_TESTING=1
cmake ../ -DWITH_WARNINGS=1 -DWITH_COREDEBUG=0 -DUSE_COREPCH=1 -DUSE_SCRIPTPCH=1 -DTOOLS=1 -DSCRIPTS=static -DSERVERS=1 -DNOJEM=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror" -DCMAKE_INSTALL_PREFIX=check_install -DCMAKE_INSTALL_RPATH=\$ORIGIN/../lib -DBUILD_TESTING=1
else
cmake ../ -DWITH_WARNINGS=1 -DWITH_COREDEBUG=0 -DUSE_COREPCH=1 -DUSE_SCRIPTPCH=1 -DTOOLS=1 -DSCRIPTS=static -DSERVERS=1 -DNOJEM=0 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror" -DCMAKE_C_FLAGS_DEBUG="-DNDEBUG" -DCMAKE_CXX_FLAGS_DEBUG="-DNDEBUG" -DCMAKE_INSTALL_PREFIX=check_install -DBUILD_TESTING=1
cmake ../ -DWITH_WARNINGS=1 -DWITH_COREDEBUG=0 -DUSE_COREPCH=1 -DUSE_SCRIPTPCH=1 -DTOOLS=1 -DSCRIPTS=static -DSERVERS=1 -DNOJEM=0 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror" -DCMAKE_C_FLAGS_DEBUG="-DNDEBUG" -DCMAKE_CXX_FLAGS_DEBUG="-DNDEBUG" -DCMAKE_INSTALL_PREFIX=check_install -DCMAKE_INSTALL_RPATH=\$ORIGIN/../lib -DBUILD_TESTING=1
fi
cd ..
- run:
Expand All @@ -85,13 +85,13 @@ jobs:
- run:
name: Create docker images
command: |
cd bin/check_install/bin
cp -r ../../../contrib/Docker/* .
cp -r ../../../sql ./sql
cd bin/check_install
cp -r ../../contrib/Docker/* .
cp -r ../../sql ./sql
image_prefix=$(echo $CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME | tr '[:upper:]' '[:lower:]')
echo $image_prefix
docker build --file Dockerfile --force-rm --tag $image_prefix:$CIRCLE_SHA1 --tag $image_prefix:$(echo $CIRCLE_BRANCH | tr '/' '-' | tr '[:upper:]' '[:lower:]') .
docker save $image_prefix | gzip > ../../../docker.tar.gz
docker save $image_prefix | gzip > ../../docker.tar.gz
if [ "$DOCKERHUB_PUSH_IMAGES" == "TRUE" ]; then
if [ "$CIRCLE_BRANCH" == "3.3.5" ] || [ "$CIRCLE_BRANCH" == "master" ]; then
docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -26,7 +26,7 @@ cmake_policy(SET CMP0074 NEW) # find_package() uses <PackageName>_ROOT variables
# Set RPATH-handing (CMake parameters)
set(CMAKE_SKIP_BUILD_RPATH 0)
set(CMAKE_BUILD_WITH_INSTALL_RPATH 0)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
list(APPEND CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH 1)

# set macro-directory
Expand Down
3 changes: 2 additions & 1 deletion contrib/Docker/Dockerfile
Expand Up @@ -4,5 +4,6 @@ FROM trinitycore/circle-ci:master-base-22.04
WORKDIR /home/circleci
COPY README.md /
COPY --chown=circleci:circleci sql /home/circleci/project/sql
COPY ["bnetserver", "mapextractor", "mmaps_generator", "vmap4assembler", "vmap4extractor", "worldserver", "/usr/local/bin/"]
COPY bin /usr/local/bin/
COPY lib /usr/local/lib/
ENTRYPOINT [ "echo", "Check the README.md file for instructions"]
7 changes: 7 additions & 0 deletions sql/updates/world/master/2023_05_21_00_world.sql
@@ -0,0 +1,7 @@
DELETE FROM `spell_script_names` WHERE `spell_id`= 389306;
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
(389306,'spell_warr_critical_thinking');

DELETE FROM `spell_proc` WHERE `SpellId` IN (389306);
INSERT INTO `spell_proc` (`SpellId`,`SchoolMask`,`SpellFamilyName`,`SpellFamilyMask0`,`SpellFamilyMask1`,`SpellFamilyMask2`,`SpellFamilyMask3`,`ProcFlags`,`ProcFlags2`,`SpellTypeMask`,`SpellPhaseMask`,`HitMask`,`AttributesMask`,`DisableEffectsMask`,`ProcsPerMinute`,`Chance`,`Cooldown`,`Charges`) VALUES
(389306,0x00,4,0x20000000,0x00000000,0x00000000,0x00000000,0x0,0x0,0x4,0x2,0x1,0x4,0x0,0,0,0,0); -- Critical Thinking
454 changes: 454 additions & 0 deletions sql/updates/world/master/2023_05_22_00_world.sql

Large diffs are not rendered by default.

130 changes: 130 additions & 0 deletions sql/updates/world/master/2023_05_22_01_world.sql

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/server/game/Entities/Creature/Creature.cpp
Expand Up @@ -3087,7 +3087,7 @@ uint64 Creature::GetMaxHealthByLevel(uint8 level) const
CreatureTemplate const* cInfo = GetCreatureTemplate();
CreatureLevelScaling const* scaling = cInfo->GetLevelScaling(GetMap()->GetDifficultyID());
float baseHealth = sDB2Manager.EvaluateExpectedStat(ExpectedStatType::CreatureHealth, level, cInfo->GetHealthScalingExpansion(), scaling->ContentTuningID, Classes(cInfo->unit_class));
return baseHealth * cInfo->ModHealth * cInfo->ModHealthExtra;
return std::max(baseHealth * cInfo->ModHealth * cInfo->ModHealthExtra, 1.0f);
}

float Creature::GetHealthMultiplierForTarget(WorldObject const* target) const
Expand Down
3 changes: 3 additions & 0 deletions src/server/game/Entities/Object/Object.cpp
Expand Up @@ -867,6 +867,9 @@ void MovementInfo::OutDebug()
TC_LOG_DEBUG("misc", "standingOnGameObjectGUID: {}", standingOnGameObjectGUID->ToString());
}

FindCreatureOptions::FindCreatureOptions() = default;
FindCreatureOptions::~FindCreatureOptions() = default;

WorldObject::WorldObject(bool isWorldObject) : Object(), WorldLocation(), LastUsedScriptID(0),
m_movementInfo(), m_name(), m_isActive(false), m_isFarVisible(false), m_isWorldObject(isWorldObject), m_zoneScript(nullptr),
ElunaEvents(NULL), m_transport(nullptr), m_zoneId(0), m_areaId(0), m_staticFloorZ(VMAP_INVALID_HEIGHT), m_outdoors(false), m_liquidStatus(LIQUID_MAP_NO_WATER),
Expand Down
9 changes: 5 additions & 4 deletions src/server/game/Entities/Object/Object.h
Expand Up @@ -438,7 +438,8 @@ class FlaggedValuesArray32

struct FindCreatureOptions
{
FindCreatureOptions() = default;
FindCreatureOptions();
~FindCreatureOptions();

FindCreatureOptions& SetCreatureId(uint32 creatureId) { CreatureId = creatureId; return *this; }
FindCreatureOptions& SetStringId(std::string_view stringId) { StringId = stringId; return *this; }
Expand All @@ -465,9 +466,9 @@ struct FindCreatureOptions
Optional<bool> IsInCombat;
Optional<bool> IsSummon;

bool IgnorePhases;
bool IgnoreNotOwnedPrivateObjects;
bool IgnorePrivateObjects;
bool IgnorePhases = false;
bool IgnoreNotOwnedPrivateObjects = true;
bool IgnorePrivateObjects = false;

Optional<uint32> AuraSpellId;
Optional<ObjectGuid> OwnerGuid;
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Entities/Pet/Pet.cpp
Expand Up @@ -919,7 +919,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(petlevel, cinfo->unit_class);
ApplyLevelScaling();

SetCreateHealth(sDB2Manager.EvaluateExpectedStat(ExpectedStatType::CreatureHealth, petlevel, cinfo->GetHealthScalingExpansion(), m_unitData->ContentTuningID, Classes(cinfo->unit_class)) * cinfo->ModHealth * cinfo->ModHealthExtra * _GetHealthMod(cinfo->rank));
SetCreateHealth(std::max(sDB2Manager.EvaluateExpectedStat(ExpectedStatType::CreatureHealth, petlevel, cinfo->GetHealthScalingExpansion(), m_unitData->ContentTuningID, Classes(cinfo->unit_class)) * cinfo->ModHealth * cinfo->ModHealthExtra * _GetHealthMod(cinfo->rank), 1.0f));
SetCreateMana(stats->BaseMana);
SetCreateStat(STAT_STRENGTH, 22);
SetCreateStat(STAT_AGILITY, 22);
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Entities/Player/Player.cpp
Expand Up @@ -4846,7 +4846,7 @@ void Player::RepopAtGraveyard()

bool shouldResurrect = false;
// Such zones are considered unreachable as a ghost and the player must be automatically revived
if ((!IsAlive() && zone && zone->GetFlags().HasFlag(AreaFlags::NoGhostOnRelease)) || GetTransport() || GetPositionZ() < GetMap()->GetMinHeight(GetPhaseShift(), GetPositionX(), GetPositionY()))
if ((!IsAlive() && zone && zone->GetFlags().HasFlag(AreaFlags::NoGhostOnRelease)) || GetMap()->IsNonRaidDungeon() || GetMap()->IsRaid() || GetTransport() || GetPositionZ() < GetMap()->GetMinHeight(GetPhaseShift(), GetPositionX(), GetPositionY()))
{
shouldResurrect = true;
SpawnCorpseBones();
Expand Down
28 changes: 24 additions & 4 deletions src/server/game/Globals/ObjectMgr.cpp
Expand Up @@ -7112,6 +7112,28 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveyard(WorldLocation const& lo
}
}

WorldSafeLocsEntry const* graveyard = GetClosestGraveyardInZone(location, team, conditionObject, zoneId);
AreaTableEntry const* zoneEntry = sAreaTableStore.AssertEntry(zoneId);
AreaTableEntry const* parentEntry = sAreaTableStore.LookupEntry(zoneEntry->ParentAreaID);

while (!graveyard && parentEntry)
{
graveyard = GetClosestGraveyardInZone(location, team, conditionObject, parentEntry->ID);
if (!graveyard && parentEntry->ParentAreaID != 0)
parentEntry = sAreaTableStore.LookupEntry(parentEntry->ParentAreaID);
else // nothing found, cant look further, give up.
parentEntry = nullptr;
}

return graveyard;
}

WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveyardInZone(WorldLocation const& location, uint32 team, WorldObject* conditionObject, uint32 zoneId) const
{
float x, y, z;
location.GetPosition(x, y, z);
uint32 MapId = location.GetMapId();

// Simulate std. algorithm:
// found some graveyard associated to (ghost_zone, ghost_map)
//
Expand All @@ -7120,10 +7142,10 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveyard(WorldLocation const& lo
// if mapId != graveyard.mapId (ghost in instance) and search any graveyard associated
// then check faction
GraveyardMapBounds range = GraveyardStore.equal_range(zoneId);
MapEntry const* map = sMapStore.LookupEntry(MapId);
MapEntry const* mapEntry = sMapStore.LookupEntry(MapId);

// not need to check validity of map object; MapId _MUST_ be valid here
if (range.first == range.second && !map->IsBattlegroundOrArena())
if (range.first == range.second && !mapEntry->IsBattlegroundOrArena())
{
if (zoneId != 0) // zone == 0 can't be fixed, used by bliz for bugged zones
TC_LOG_ERROR("sql.sql", "Table `game_graveyard_zone` incomplete: Zone {} Team {} does not have a linked graveyard.", zoneId, team);
Expand All @@ -7143,8 +7165,6 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveyard(WorldLocation const& lo
// some where other
WorldSafeLocsEntry const* entryFar = nullptr;

MapEntry const* mapEntry = sMapStore.LookupEntry(MapId);

ConditionSourceInfo conditionSource(conditionObject);

for (; range.first != range.second; ++range.first)
Expand Down
1 change: 1 addition & 0 deletions src/server/game/Globals/ObjectMgr.h
Expand Up @@ -1237,6 +1237,7 @@ class TC_GAME_API ObjectMgr

WorldSafeLocsEntry const* GetDefaultGraveyard(uint32 team) const;
WorldSafeLocsEntry const* GetClosestGraveyard(WorldLocation const& location, uint32 team, WorldObject* conditionObject) const;
WorldSafeLocsEntry const* GetClosestGraveyardInZone(WorldLocation const& location, uint32 team, WorldObject* conditionObject, uint32 zoneId) const;
bool AddGraveyardLink(uint32 id, uint32 zoneId, uint32 team, bool persist = true);
void RemoveGraveyardLink(uint32 id, uint32 zoneId, uint32 team, bool persist = false);
void LoadGraveyardZones();
Expand Down
6 changes: 4 additions & 2 deletions src/server/game/Server/Packets/CharacterPackets.cpp
Expand Up @@ -141,9 +141,11 @@ EnumCharactersResult::CharacterInfo::CharacterInfo(Field* fields)

LastLoginVersion = fields[22].GetUInt32();

for (uint8 slot = 0; slot < REAGENT_BAG_SLOT_END; ++slot)
constexpr std::size_t equipmentFieldsPerSlot = 5;

for (std::size_t slot = 0; slot < VisualItems.size() && (slot + 1) * equipmentFieldsPerSlot <= equipment.size(); ++slot)
{
uint32 visualBase = slot * 5;
std::size_t visualBase = slot * equipmentFieldsPerSlot;
VisualItems[slot].InvType = Trinity::StringTo<uint8>(equipment[visualBase + 0]).value_or(0);
VisualItems[slot].DisplayID = Trinity::StringTo<uint32>(equipment[visualBase + 1]).value_or(0);
VisualItems[slot].DisplayEnchantID = Trinity::StringTo<uint32>(equipment[visualBase + 2]).value_or(0);
Expand Down
9 changes: 9 additions & 0 deletions src/server/game/Spells/SpellEffects.cpp
Expand Up @@ -2147,6 +2147,8 @@ void Spell::EffectDispel()
m_caster->SendMessageToSet(spellDispellLog.Write(), true);

CallScriptSuccessfulDispel(SpellEffIndex(effectInfo->EffectIndex));

m_hitMask |= PROC_HIT_DISPEL;
}

void Spell::EffectDualWield()
Expand Down Expand Up @@ -4121,8 +4123,13 @@ void Spell::EffectDispelMechanic()
dispel_list.emplace_back(aura->GetId(), aura->GetCasterGUID());
}

if (dispel_list.empty())
return;

for (auto itr = dispel_list.begin(); itr != dispel_list.end(); ++itr)
unitTarget->RemoveAura(itr->first, itr->second, 0, AURA_REMOVE_BY_ENEMY_SPELL);

m_hitMask |= PROC_HIT_DISPEL;
}

void Spell::EffectResurrectPet()
Expand Down Expand Up @@ -4661,6 +4668,8 @@ void Spell::EffectStealBeneficialBuff()
}

m_caster->SendMessageToSet(spellDispellLog.Write(), true);

m_hitMask |= PROC_HIT_DISPEL;
}

void Spell::EffectKillCreditPersonal()
Expand Down
3 changes: 2 additions & 1 deletion src/server/game/Spells/SpellMgr.h
Expand Up @@ -283,7 +283,8 @@ enum ProcFlagsHit : uint32
PROC_HIT_REFLECT = 0x0000800,
PROC_HIT_INTERRUPT = 0x0001000,
PROC_HIT_FULL_BLOCK = 0x0002000,
PROC_HIT_MASK_ALL = 0x0003FFF
PROC_HIT_DISPEL = 0x0004000,
PROC_HIT_MASK_ALL = 0x0007FFF
};

DEFINE_ENUM_FLAG(ProcFlagsHit);
Expand Down
25 changes: 25 additions & 0 deletions src/server/scripts/Spells/spell_warrior.cpp
Expand Up @@ -26,6 +26,7 @@
#include "MoveSpline.h"
#include "PathGenerator.h"
#include "Player.h"
#include "Spell.h"
#include "SpellMgr.h"
#include "SpellAuraEffects.h"
#include "SpellHistory.h"
Expand Down Expand Up @@ -302,6 +303,29 @@ class spell_warr_colossus_smash : public SpellScript
bool _bonusHaste = false;
};

// 389306 - Critical Thinking
class spell_warr_critical_thinking : public AuraScript
{
PrepareAuraScript(spell_warr_critical_thinking);

bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_WARRIOR_CRITICAL_THINKING_ENERGIZE });
}

void HandleProc(AuraEffect* aurEff, ProcEventInfo& eventInfo)
{
if (Optional<int32> rageCost = eventInfo.GetProcSpell()->GetPowerTypeCostAmount(POWER_RAGE))
GetTarget()->CastSpell(nullptr, SPELL_WARRIOR_CRITICAL_THINKING_ENERGIZE, CastSpellExtraArgs(TRIGGERED_FULL_MASK)
.AddSpellBP0(CalculatePct(*rageCost, aurEff->GetAmount())));
}

void Register() override
{
AfterEffectProc += AuraEffectProcFn(spell_warr_critical_thinking::HandleProc, EFFECT_1, SPELL_AURA_DUMMY);
}
};

// 383103 - Fueled by Violence
class spell_warr_fueled_by_violence : public AuraScript
{
Expand Down Expand Up @@ -1329,6 +1353,7 @@ void AddSC_warrior_spell_scripts()
RegisterSpellScript(spell_warr_charge_drop_fire_periodic);
RegisterSpellScript(spell_warr_charge_effect);
RegisterSpellScript(spell_warr_colossus_smash);
RegisterSpellScript(spell_warr_critical_thinking);
RegisterSpellScript(spell_warr_fueled_by_violence);
RegisterSpellScript(spell_warr_heroic_leap);
RegisterSpellScript(spell_warr_heroic_leap_jump);
Expand Down

0 comments on commit 74995da

Please sign in to comment.