Skip to content

Commit 0219c34

Browse files
author
Github Actions
committed
Merge 3.3.5 to 3.3.5-base_patch
2 parents c974d7a + 1a5af00 commit 0219c34

File tree

9 files changed

+108
-89
lines changed

9 files changed

+108
-89
lines changed

src/server/game/Entities/Creature/CreatureData.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ struct TC_GAME_API CreatureBaseStats
403403

404404
uint32 GenerateHealth(CreatureTemplate const* info) const
405405
{
406-
return uint32(ceil(BaseHealth[info->expansion] * info->ModHealth));
406+
return uint32(std::round(std::max(BaseHealth[info->expansion] * info->ModHealth, 1.0f)));
407407
}
408408

409409
uint32 GenerateMana(CreatureTemplate const* info) const

src/server/game/Entities/Player/Player.cpp

Lines changed: 72 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,8 @@ Player::Player(WorldSession* session): Unit(true)
291291
m_canParry = false;
292292
m_canBlock = false;
293293
m_canTitanGrip = false;
294+
m_titanGripWeaponSubclasses = 0;
295+
m_titanGripArmorSubclasses = 0;
294296
m_titanGripPenaltySpellId = 0;
295297
m_ammoDPS = 0.0f;
296298

@@ -9382,15 +9384,10 @@ void Player::SetSheath(SheathState sheathed)
93829384
Unit::SetSheath(sheathed); // this must visualize Sheath changing for other players...
93839385
}
93849386

9385-
uint8 Player::FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) const
9387+
uint8 Player::FindEquipSlot(Item const* item, uint32 slot, bool swap) const
93869388
{
9387-
uint8 playerClass = GetClass();
9388-
9389-
uint8 slots[4];
9390-
slots[0] = NULL_SLOT;
9391-
slots[1] = NULL_SLOT;
9392-
slots[2] = NULL_SLOT;
9393-
slots[3] = NULL_SLOT;
9389+
std::array<uint8, 4> slots = { NULL_SLOT, NULL_SLOT, NULL_SLOT, NULL_SLOT };
9390+
ItemTemplate const* proto = item->GetTemplate();
93949391
switch (proto->InventoryType)
93959392
{
93969393
case INVTYPE_HEAD:
@@ -9455,27 +9452,7 @@ uint8 Player::FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) c
94559452
break;
94569453
case INVTYPE_2HWEAPON:
94579454
slots[0] = EQUIPMENT_SLOT_MAINHAND;
9458-
if (Item* mhWeapon = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
9459-
{
9460-
if (ItemTemplate const* mhWeaponProto = mhWeapon->GetTemplate())
9461-
{
9462-
if (mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM || mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_STAFF)
9463-
{
9464-
const_cast<Player*>(this)->AutoUnequipOffhandIfNeed(true);
9465-
break;
9466-
}
9467-
}
9468-
}
9469-
9470-
if (GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
9471-
{
9472-
if (proto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM || proto->SubClass == ITEM_SUBCLASS_WEAPON_STAFF)
9473-
{
9474-
const_cast<Player*>(this)->AutoUnequipOffhandIfNeed(true);
9475-
break;
9476-
}
9477-
}
9478-
if (CanDualWield() && CanTitanGrip() && proto->SubClass != ITEM_SUBCLASS_WEAPON_POLEARM && proto->SubClass != ITEM_SUBCLASS_WEAPON_STAFF)
9455+
if (CanDualWield() && CanTitanGrip(item))
94799456
slots[1] = EQUIPMENT_SLOT_OFFHAND;
94809457
break;
94819458
case INVTYPE_TABARD:
@@ -9497,13 +9474,11 @@ uint8 Player::FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) c
94979474
slots[0] = EQUIPMENT_SLOT_RANGED;
94989475
break;
94999476
case INVTYPE_BAG:
9500-
slots[0] = INVENTORY_SLOT_BAG_START + 0;
9501-
slots[1] = INVENTORY_SLOT_BAG_START + 1;
9502-
slots[2] = INVENTORY_SLOT_BAG_START + 2;
9503-
slots[3] = INVENTORY_SLOT_BAG_START + 3;
9477+
slots = { INVENTORY_SLOT_BAG_START + 0, INVENTORY_SLOT_BAG_START + 1, INVENTORY_SLOT_BAG_START + 2, INVENTORY_SLOT_BAG_START + 3 };
95049478
break;
95059479
case INVTYPE_RELIC:
95069480
{
9481+
uint8 playerClass = GetClass();
95079482
switch (proto->SubClass)
95089483
{
95099484
case ITEM_SUBCLASS_ARMOR_LIBRAM:
@@ -11216,7 +11191,7 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item* pItem, bool
1121611191
if (ssd && ssd->Maxlevel < DEFAULT_MAX_LEVEL && ssd->Maxlevel < GetLevel())
1121711192
return EQUIP_ERR_NOT_EQUIPPABLE;
1121811193

11219-
uint8 eslot = FindEquipSlot(pProto, slot, swap);
11194+
uint8 eslot = FindEquipSlot(pItem, slot, swap);
1122011195
if (eslot == NULL_SLOT)
1122111196
return EQUIP_ERR_NOT_EQUIPPABLE;
1122211197

@@ -11286,7 +11261,7 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item* pItem, bool
1128611261
}
1128711262
else if (type == INVTYPE_2HWEAPON)
1128811263
{
11289-
if (!CanDualWield() || !CanTitanGrip())
11264+
if (!CanDualWield() || !CanTitanGrip(pItem))
1129011265
return EQUIP_ERR_2HSKILLNOTFOUND;
1129111266
}
1129211267

@@ -11295,17 +11270,9 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item* pItem, bool
1129511270
}
1129611271

1129711272
// equip two-hand weapon case (with possible unequip 2 items)
11298-
if (type == INVTYPE_2HWEAPON)
11273+
if (eslot == EQUIPMENT_SLOT_MAINHAND)
1129911274
{
11300-
if (eslot == EQUIPMENT_SLOT_OFFHAND)
11301-
{
11302-
if (!CanTitanGrip())
11303-
return EQUIP_ERR_NOT_EQUIPPABLE;
11304-
}
11305-
else if (eslot != EQUIPMENT_SLOT_MAINHAND)
11306-
return EQUIP_ERR_NOT_EQUIPPABLE;
11307-
11308-
if (!CanTitanGrip())
11275+
if (!CanTitanGrip(pItem))
1130911276
{
1131011277
// offhand item must can be stored in inventory for offhand item and it also must be unequipped
1131111278
Item* offItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
@@ -13321,18 +13288,58 @@ bool Player::IsUseEquipedWeapon(bool mainhand) const
1332113288
return !IsInFeralForm() && (!mainhand || !HasUnitFlag(UNIT_FLAG_DISARMED));
1332213289
}
1332313290

13324-
void Player::SetCanTitanGrip(bool value, uint32 penaltySpellId /*= 0*/)
13291+
bool Player::CanTitanGrip(Item const* item) const
1332513292
{
13326-
if (value == m_canTitanGrip)
13327-
return;
13293+
if (!m_canTitanGrip)
13294+
return false;
13295+
13296+
ItemTemplate const* itemTemplate = item->GetTemplate();
13297+
13298+
uint32 subClassMask = [&]
13299+
{
13300+
switch (itemTemplate->Class)
13301+
{
13302+
case ITEM_CLASS_WEAPON:
13303+
return m_titanGripWeaponSubclasses;
13304+
case ITEM_CLASS_ARMOR:
13305+
return m_titanGripArmorSubclasses;
13306+
default:
13307+
break;
13308+
}
13309+
return 0u;
13310+
}();
1332813311

13312+
return !subClassMask || subClassMask & (1 << itemTemplate->SubClass);
13313+
}
13314+
13315+
void Player::SetCanTitanGrip(bool value, uint32 penaltySpellId /*= 0*/, int32 allowedItemClass /*= 0*/, int32 allowedItemSubClassMask /*= 0*/)
13316+
{
1332913317
m_canTitanGrip = value;
13318+
if (value)
13319+
{
13320+
switch (allowedItemClass)
13321+
{
13322+
case ITEM_CLASS_WEAPON:
13323+
m_titanGripWeaponSubclasses = allowedItemSubClassMask;
13324+
break;
13325+
case ITEM_CLASS_ARMOR:
13326+
m_titanGripArmorSubclasses = allowedItemSubClassMask;
13327+
break;
13328+
default:
13329+
break;
13330+
}
13331+
}
13332+
else
13333+
{
13334+
m_titanGripWeaponSubclasses = 0;
13335+
m_titanGripArmorSubclasses = 0;
13336+
}
1333013337
m_titanGripPenaltySpellId = penaltySpellId;
1333113338
}
1333213339

1333313340
void Player::CheckTitanGripPenalty()
1333413341
{
13335-
if (!CanTitanGrip())
13342+
if (!m_titanGripPenaltySpellId)
1333613343
return;
1333713344

1333813345
bool apply = IsUsingTwoHandedWeaponInOneHand();
@@ -13348,7 +13355,7 @@ void Player::CheckTitanGripPenalty()
1334813355
bool Player::IsTwoHandUsed() const
1334913356
{
1335013357
Item* mainItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
13351-
return mainItem && mainItem->GetTemplate()->InventoryType == INVTYPE_2HWEAPON && !CanTitanGrip();
13358+
return mainItem && mainItem->GetTemplate()->InventoryType == INVTYPE_2HWEAPON && !CanTitanGrip(mainItem);
1335213359
}
1335313360

1335413361
bool Player::IsUsingTwoHandedWeaponInOneHand() const
@@ -23533,13 +23540,23 @@ void Player::AutoUnequipOffhandIfNeed(bool force /*= false*/)
2353323540
if (!offItem)
2353423541
return;
2353523542

23536-
// unequip offhand weapon if player doesn't have dual wield anymore
23537-
if (!CanDualWield() && (offItem->GetTemplate()->InventoryType == INVTYPE_WEAPONOFFHAND || offItem->GetTemplate()->InventoryType == INVTYPE_WEAPON))
23538-
force = true;
23543+
ItemTemplate const* offhandTemplate = offItem->GetTemplate();
23544+
23545+
// unequip offhand weapon if player doesn't have dual wield anymore
23546+
if (!CanDualWield() && (offhandTemplate->InventoryType == INVTYPE_WEAPONOFFHAND || offhandTemplate->InventoryType == INVTYPE_WEAPON))
23547+
force = true;
2353923548

2354023549
// need unequip offhand for 2h-weapon without TitanGrip (in any from hands)
23541-
if (!force && (CanTitanGrip() || (offItem->GetTemplate()->InventoryType != INVTYPE_2HWEAPON && !IsTwoHandUsed())))
23542-
return;
23550+
if (!force)
23551+
{
23552+
Item* mainItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
23553+
if ((!mainItem || mainItem->GetTemplate()->InventoryType != INVTYPE_2HWEAPON)
23554+
&& offhandTemplate->InventoryType != INVTYPE_2HWEAPON)
23555+
return;
23556+
23557+
if ((!mainItem || CanTitanGrip(mainItem)) && CanTitanGrip(offItem))
23558+
return;
23559+
}
2354323560

2354423561
ItemPosCountVec off_dest;
2354523562
if (CanStoreItem(NULL_BAG, NULL_SLOT, off_dest, offItem, false) == EQUIP_ERR_OK)

src/server/game/Entities/Player/Player.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
10881088

10891089
void SetVirtualItemSlot(uint8 i, Item* item);
10901090
void SetSheath(SheathState sheathed) override; // overwrite Unit version
1091-
uint8 FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) const;
1091+
uint8 FindEquipSlot(Item const* item, uint32 slot, bool swap) const;
10921092
uint32 GetItemCount(uint32 item, bool inBankAlso = false, Item* skipItem = nullptr) const;
10931093
uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem = nullptr) const;
10941094
Item* GetItemByGuid(ObjectGuid guid) const;
@@ -1875,8 +1875,8 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
18751875
void SetCanParry(bool value);
18761876
bool CanBlock() const { return m_canBlock; }
18771877
void SetCanBlock(bool value);
1878-
bool CanTitanGrip() const { return m_canTitanGrip; }
1879-
void SetCanTitanGrip(bool value, uint32 penaltySpellId = 0);
1878+
bool CanTitanGrip(Item const* item) const;
1879+
void SetCanTitanGrip(bool value, uint32 penaltySpellId = 0, int32 allowedItemClass = 0, int32 allowedItemSubClassMask = 0);
18801880
void CheckTitanGripPenalty();
18811881
bool CanTameExoticPets() const { return IsGameMaster() || HasAuraType(SPELL_AURA_ALLOW_TAME_PET_TYPE); }
18821882

@@ -2440,6 +2440,8 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
24402440
bool m_canParry;
24412441
bool m_canBlock;
24422442
bool m_canTitanGrip;
2443+
uint32 m_titanGripWeaponSubclasses;
2444+
uint32 m_titanGripArmorSubclasses;
24432445
uint32 m_titanGripPenaltySpellId;
24442446
uint8 m_swingErrorMsg;
24452447
float m_ammoDPS;

src/server/game/Handlers/PetHandler.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,6 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
174174
break;
175175
case COMMAND_ATTACK: // spellid = 1792 - ATTACK
176176
{
177-
// Can't attack if owner is pacified
178-
if (_player->HasAuraType(SPELL_AURA_MOD_PACIFY))
179-
{
180-
// pet->SendPetCastFail(spellid, SPELL_FAILED_PACIFIED);
181-
/// @todo Send proper error message to client
182-
return;
183-
}
184-
185177
// only place where pet can be player
186178
Unit* TargetUnit = ObjectAccessor::GetUnit(*_player, guid2);
187179
if (!TargetUnit)

src/server/game/Server/WorldSession.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -523,10 +523,6 @@ void WorldSession::LogoutPlayer(bool save)
523523
if (Battleground* bg = _player->GetBattleground())
524524
bg->EventPlayerLoggedOut(_player);
525525

526-
///- Teleport to home if the player is in an invalid instance
527-
if (!_player->m_InstanceValid && !_player->IsGameMaster())
528-
_player->TeleportTo(_player->m_homebindMapId, _player->m_homebindX, _player->m_homebindY, _player->m_homebindZ, _player->GetOrientation());
529-
530526
sOutdoorPvPMgr->HandlePlayerLeaveZone(_player, _player->GetZoneId());
531527

532528
for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)

src/server/game/Spells/SpellEffects.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5162,7 +5162,7 @@ void Spell::EffectTitanGrip()
51625162
return;
51635163

51645164
if (m_caster->GetTypeId() == TYPEID_PLAYER)
5165-
m_caster->ToPlayer()->SetCanTitanGrip(true, effectInfo->MiscValue);
5165+
m_caster->ToPlayer()->SetCanTitanGrip(true, effectInfo->MiscValue, m_spellInfo->EquippedItemClass, m_spellInfo->EquippedItemSubClassMask);
51665166
}
51675167

51685168
void Spell::EffectRedirectThreat()

src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -440,11 +440,10 @@ struct npc_thrall_old_hillsbrad : public EscortAI
440440
DoUnmount();
441441
}
442442

443-
void JustReachedHome() override
443+
void EnterEvadeMode(EvadeReason why) override
444444
{
445-
EscortAI::JustReachedHome();
446-
if (HadMount)
447-
DoMount();
445+
EscortAI::EnterEvadeMode(why);
446+
Reset();
448447
}
449448

450449
void JustSummoned(Creature* summoned) override

src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "SpellInfo.h"
2424
#include "SpellScript.h"
2525

26-
enum Texts
26+
enum MaladaarTexts
2727
{
2828
SAY_ROAR = 0,
2929
SAY_SOUL_CLEAVE = 1,
@@ -33,7 +33,7 @@ enum Texts
3333
SAY_DEATH = 5
3434
};
3535

36-
enum Spells
36+
enum MaladaarSpells
3737
{
3838
SPELL_SOUL_SCREAM = 32421,
3939
SPELL_RIBBON_OF_SOULS = 32422,
@@ -57,15 +57,15 @@ enum Spells
5757
SPELL_PLAGUE_STRIKE = 58839
5858
};
5959

60-
enum Events
60+
enum MaladaarEvents
6161
{
6262
EVENT_SOUL_SCREAM = 1,
6363
EVENT_RIBBON_OF_SOULS,
6464
EVENT_STOLEN_SOUL,
6565
EVENT_SUMMON_AVATAR
6666
};
6767

68-
enum Misc
68+
enum MaladaarMisc
6969
{
7070
NPC_DORE = 19412,
7171

@@ -93,6 +93,7 @@ enum Misc
9393

9494
Position const DoreSpawnPos = { -4.40722f, -387.277f, 40.6294f, 6.26573f };
9595

96+
// 18373 - Exarch Maladaar
9697
struct boss_exarch_maladaar : public BossAI
9798
{
9899
boss_exarch_maladaar(Creature* creature) : BossAI(creature, DATA_EXARCH_MALADAAR), _avatarSummoned(false) { }
@@ -123,9 +124,19 @@ struct boss_exarch_maladaar : public BossAI
123124

124125
void OnSpellCast(SpellInfo const* spell) override
125126
{
126-
if (spell->Id == SPELL_STOLEN_SOUL)
127-
if (roll_chance_i(25))
128-
Talk(SAY_SOUL_CLEAVE);
127+
switch (spell->Id)
128+
{
129+
case SPELL_STOLEN_SOUL:
130+
if (roll_chance_i(25))
131+
Talk(SAY_SOUL_CLEAVE);
132+
break;
133+
case SPELL_SOUL_SCREAM:
134+
if (roll_chance_i(25))
135+
Talk(SAY_ROAR);
136+
break;
137+
default:
138+
break;
139+
}
129140
}
130141

131142
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
@@ -164,8 +175,6 @@ struct boss_exarch_maladaar : public BossAI
164175
switch (eventId)
165176
{
166177
case EVENT_SOUL_SCREAM:
167-
if (roll_chance_i(25))
168-
Talk(SAY_ROAR);
169178
DoCastSelf(SPELL_SOUL_SCREAM);
170179
events.Repeat(RAND(15s, 20s));
171180
break;
@@ -197,6 +206,7 @@ struct boss_exarch_maladaar : public BossAI
197206
bool _avatarSummoned;
198207
};
199208

209+
// 18441 - Stolen Soul
200210
struct npc_stolen_soul : public ScriptedAI
201211
{
202212
npc_stolen_soul(Creature* creature) : ScriptedAI(creature), _summonerClass(CLASS_NONE) { }

0 commit comments

Comments
 (0)