Skip to content

Commit 391397e

Browse files
author
Github Actions
committed
Merge 3.3.5 to 3.3.5-nemesis_anticheat
2 parents 892dc02 + 1a5af00 commit 391397e

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
@@ -279,6 +279,8 @@ Player::Player(WorldSession* session): Unit(true)
279279
m_canParry = false;
280280
m_canBlock = false;
281281
m_canTitanGrip = false;
282+
m_titanGripWeaponSubclasses = 0;
283+
m_titanGripArmorSubclasses = 0;
282284
m_titanGripPenaltySpellId = 0;
283285
m_ammoDPS = 0.0f;
284286

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

9383-
uint8 Player::FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) const
9385+
uint8 Player::FindEquipSlot(Item const* item, uint32 slot, bool swap) const
93849386
{
9385-
uint8 playerClass = GetClass();
9386-
9387-
uint8 slots[4];
9388-
slots[0] = NULL_SLOT;
9389-
slots[1] = NULL_SLOT;
9390-
slots[2] = NULL_SLOT;
9391-
slots[3] = NULL_SLOT;
9387+
std::array<uint8, 4> slots = { NULL_SLOT, NULL_SLOT, NULL_SLOT, NULL_SLOT };
9388+
ItemTemplate const* proto = item->GetTemplate();
93929389
switch (proto->InventoryType)
93939390
{
93949391
case INVTYPE_HEAD:
@@ -9453,27 +9450,7 @@ uint8 Player::FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) c
94539450
break;
94549451
case INVTYPE_2HWEAPON:
94559452
slots[0] = EQUIPMENT_SLOT_MAINHAND;
9456-
if (Item* mhWeapon = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
9457-
{
9458-
if (ItemTemplate const* mhWeaponProto = mhWeapon->GetTemplate())
9459-
{
9460-
if (mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM || mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_STAFF)
9461-
{
9462-
const_cast<Player*>(this)->AutoUnequipOffhandIfNeed(true);
9463-
break;
9464-
}
9465-
}
9466-
}
9467-
9468-
if (GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
9469-
{
9470-
if (proto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM || proto->SubClass == ITEM_SUBCLASS_WEAPON_STAFF)
9471-
{
9472-
const_cast<Player*>(this)->AutoUnequipOffhandIfNeed(true);
9473-
break;
9474-
}
9475-
}
9476-
if (CanDualWield() && CanTitanGrip() && proto->SubClass != ITEM_SUBCLASS_WEAPON_POLEARM && proto->SubClass != ITEM_SUBCLASS_WEAPON_STAFF)
9453+
if (CanDualWield() && CanTitanGrip(item))
94779454
slots[1] = EQUIPMENT_SLOT_OFFHAND;
94789455
break;
94799456
case INVTYPE_TABARD:
@@ -9495,13 +9472,11 @@ uint8 Player::FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) c
94959472
slots[0] = EQUIPMENT_SLOT_RANGED;
94969473
break;
94979474
case INVTYPE_BAG:
9498-
slots[0] = INVENTORY_SLOT_BAG_START + 0;
9499-
slots[1] = INVENTORY_SLOT_BAG_START + 1;
9500-
slots[2] = INVENTORY_SLOT_BAG_START + 2;
9501-
slots[3] = INVENTORY_SLOT_BAG_START + 3;
9475+
slots = { INVENTORY_SLOT_BAG_START + 0, INVENTORY_SLOT_BAG_START + 1, INVENTORY_SLOT_BAG_START + 2, INVENTORY_SLOT_BAG_START + 3 };
95029476
break;
95039477
case INVTYPE_RELIC:
95049478
{
9479+
uint8 playerClass = GetClass();
95059480
switch (proto->SubClass)
95069481
{
95079482
case ITEM_SUBCLASS_ARMOR_LIBRAM:
@@ -11214,7 +11189,7 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item* pItem, bool
1121411189
if (ssd && ssd->Maxlevel < DEFAULT_MAX_LEVEL && ssd->Maxlevel < GetLevel())
1121511190
return EQUIP_ERR_NOT_EQUIPPABLE;
1121611191

11217-
uint8 eslot = FindEquipSlot(pProto, slot, swap);
11192+
uint8 eslot = FindEquipSlot(pItem, slot, swap);
1121811193
if (eslot == NULL_SLOT)
1121911194
return EQUIP_ERR_NOT_EQUIPPABLE;
1122011195

@@ -11284,7 +11259,7 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item* pItem, bool
1128411259
}
1128511260
else if (type == INVTYPE_2HWEAPON)
1128611261
{
11287-
if (!CanDualWield() || !CanTitanGrip())
11262+
if (!CanDualWield() || !CanTitanGrip(pItem))
1128811263
return EQUIP_ERR_2HSKILLNOTFOUND;
1128911264
}
1129011265

@@ -11293,17 +11268,9 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item* pItem, bool
1129311268
}
1129411269

1129511270
// equip two-hand weapon case (with possible unequip 2 items)
11296-
if (type == INVTYPE_2HWEAPON)
11271+
if (eslot == EQUIPMENT_SLOT_MAINHAND)
1129711272
{
11298-
if (eslot == EQUIPMENT_SLOT_OFFHAND)
11299-
{
11300-
if (!CanTitanGrip())
11301-
return EQUIP_ERR_NOT_EQUIPPABLE;
11302-
}
11303-
else if (eslot != EQUIPMENT_SLOT_MAINHAND)
11304-
return EQUIP_ERR_NOT_EQUIPPABLE;
11305-
11306-
if (!CanTitanGrip())
11273+
if (!CanTitanGrip(pItem))
1130711274
{
1130811275
// offhand item must can be stored in inventory for offhand item and it also must be unequipped
1130911276
Item* offItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
@@ -13319,18 +13286,58 @@ bool Player::IsUseEquipedWeapon(bool mainhand) const
1331913286
return !IsInFeralForm() && (!mainhand || !HasUnitFlag(UNIT_FLAG_DISARMED));
1332013287
}
1332113288

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

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

1333113338
void Player::CheckTitanGripPenalty()
1333213339
{
13333-
if (!CanTitanGrip())
13340+
if (!m_titanGripPenaltySpellId)
1333413341
return;
1333513342

1333613343
bool apply = IsUsingTwoHandedWeaponInOneHand();
@@ -13346,7 +13353,7 @@ void Player::CheckTitanGripPenalty()
1334613353
bool Player::IsTwoHandUsed() const
1334713354
{
1334813355
Item* mainItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
13349-
return mainItem && mainItem->GetTemplate()->InventoryType == INVTYPE_2HWEAPON && !CanTitanGrip();
13356+
return mainItem && mainItem->GetTemplate()->InventoryType == INVTYPE_2HWEAPON && !CanTitanGrip(mainItem);
1335013357
}
1335113358

1335213359
bool Player::IsUsingTwoHandedWeaponInOneHand() const
@@ -23531,13 +23538,23 @@ void Player::AutoUnequipOffhandIfNeed(bool force /*= false*/)
2353123538
if (!offItem)
2353223539
return;
2353323540

23534-
// unequip offhand weapon if player doesn't have dual wield anymore
23535-
if (!CanDualWield() && (offItem->GetTemplate()->InventoryType == INVTYPE_WEAPONOFFHAND || offItem->GetTemplate()->InventoryType == INVTYPE_WEAPON))
23536-
force = true;
23541+
ItemTemplate const* offhandTemplate = offItem->GetTemplate();
23542+
23543+
// unequip offhand weapon if player doesn't have dual wield anymore
23544+
if (!CanDualWield() && (offhandTemplate->InventoryType == INVTYPE_WEAPONOFFHAND || offhandTemplate->InventoryType == INVTYPE_WEAPON))
23545+
force = true;
2353723546

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

2354223559
ItemPosCountVec off_dest;
2354323560
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
@@ -1090,7 +1090,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
10901090

10911091
void SetVirtualItemSlot(uint8 i, Item* item);
10921092
void SetSheath(SheathState sheathed) override; // overwrite Unit version
1093-
uint8 FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) const;
1093+
uint8 FindEquipSlot(Item const* item, uint32 slot, bool swap) const;
10941094
uint32 GetItemCount(uint32 item, bool inBankAlso = false, Item* skipItem = nullptr) const;
10951095
uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem = nullptr) const;
10961096
Item* GetItemByGuid(ObjectGuid guid) const;
@@ -1877,8 +1877,8 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
18771877
void SetCanParry(bool value);
18781878
bool CanBlock() const { return m_canBlock; }
18791879
void SetCanBlock(bool value);
1880-
bool CanTitanGrip() const { return m_canTitanGrip; }
1881-
void SetCanTitanGrip(bool value, uint32 penaltySpellId = 0);
1880+
bool CanTitanGrip(Item const* item) const;
1881+
void SetCanTitanGrip(bool value, uint32 penaltySpellId = 0, int32 allowedItemClass = 0, int32 allowedItemSubClassMask = 0);
18821882
void CheckTitanGripPenalty();
18831883
bool CanTameExoticPets() const { return IsGameMaster() || HasAuraType(SPELL_AURA_ALLOW_TAME_PET_TYPE); }
18841884

@@ -2448,6 +2448,8 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
24482448
bool m_canParry;
24492449
bool m_canBlock;
24502450
bool m_canTitanGrip;
2451+
uint32 m_titanGripWeaponSubclasses;
2452+
uint32 m_titanGripArmorSubclasses;
24512453
uint32 m_titanGripPenaltySpellId;
24522454
uint8 m_swingErrorMsg;
24532455
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)