Skip to content

Commit 61819f2

Browse files
committed
Core/Misc: Reduce differences between branches and fix data sent in SMSG_AUCTION_COMMAND_RESULT, SMSG_PARTY_MEMBER_STATS, SMSG_BATTLEFIELD_STATUS and implemented missing SMSG_AUCTION_REMOVED_NOTIFICATION
1 parent 8b1d6f9 commit 61819f2

File tree

16 files changed

+235
-194
lines changed

16 files changed

+235
-194
lines changed

src/server/game/Achievements/AchievementMgr.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
294294
}
295295
}
296296

297-
bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, WorldObject const* target, uint32 miscvalue1 /*= 0*/, uint32 miscvalue2 /* = 0*/) const
297+
bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, WorldObject const* target, uint32 miscValue1 /*= 0*/, uint32 miscValue2 /* = 0*/) const
298298
{
299299
switch (dataType)
300300
{
@@ -350,7 +350,7 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Wo
350350
return unitTarget->HasAuraEffect(aura.spell_id, aura.effect_idx);
351351
}
352352
case ACHIEVEMENT_CRITERIA_DATA_TYPE_VALUE:
353-
return CompareValues(ComparisionType(value.compType), miscvalue1, value.value);
353+
return CompareValues(ComparisionType(value.compType), miscValue1, value.value);
354354
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL:
355355
{
356356
if (!target)
@@ -422,13 +422,13 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Wo
422422
Unit const* unitTarget = nullptr;
423423
if (target)
424424
unitTarget = target->ToUnit();
425-
return instance->CheckAchievementCriteriaMeet(criteria_id, source, unitTarget, miscvalue1);
425+
return instance->CheckAchievementCriteriaMeet(criteria_id, source, unitTarget, miscValue1);
426426
}
427427
case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_EQUIPPED_ITEM:
428428
{
429429
AchievementCriteriaEntry const* entry = ASSERT_NOTNULL(sAchievementMgr->GetAchievementCriteria(criteria_id));
430430

431-
uint32 itemId = (entry->Type == ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM ? miscvalue2 : miscvalue1);
431+
uint32 itemId = (entry->Type == ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM ? miscValue2 : miscValue1);
432432
ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
433433
if (!itemTemplate)
434434
return false;
@@ -457,7 +457,7 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Wo
457457
}
458458
case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_ITEM_QUALITY:
459459
{
460-
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(miscvalue1);
460+
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(miscValue1);
461461
if (!pProto)
462462
return false;
463463
return pProto->Quality == item.item_quality;
@@ -468,10 +468,10 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Wo
468468
return false;
469469
}
470470

471-
bool AchievementCriteriaDataSet::Meets(Player const* source, WorldObject const* target, uint32 miscvalue1 /*= 0*/, uint32 miscvalue2 /* = 0*/) const
471+
bool AchievementCriteriaDataSet::Meets(Player const* source, WorldObject const* target, uint32 miscValue1 /*= 0*/, uint32 miscValue2 /* = 0*/) const
472472
{
473473
for (AchievementCriteriaData const& criteriadata : storage)
474-
if (!criteriadata.Meets(criteria_id, source, target, miscvalue1, miscvalue2))
474+
if (!criteriadata.Meets(criteria_id, source, target, miscValue1, miscValue2))
475475
return false;
476476

477477
return true;
@@ -845,7 +845,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
845845
case ACHIEVEMENT_CRITERIA_TYPE_ACCEPTED_SUMMONINGS:
846846
SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE);
847847
break;
848-
// std case: increment at miscvalue1
848+
// std case: increment at miscValue1
849849
case ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE:
850850
case ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE:
851851
case ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_VENDORS:
@@ -861,15 +861,15 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
861861
case ACHIEVEMENT_CRITERIA_TYPE_USE_LFD_TO_GROUP_WITH_PLAYERS:
862862
SetCriteriaProgress(achievementCriteria, miscValue1, PROGRESS_ACCUMULATE);
863863
break;
864-
// std case: increment at miscvalue2
864+
// std case: increment at miscValue2
865865
case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE:
866866
case ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM:
867867
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM:
868868
case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE_TYPE:
869869
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE:
870870
SetCriteriaProgress(achievementCriteria, miscValue2, PROGRESS_ACCUMULATE);
871871
break;
872-
// std case: high value at miscvalue1
872+
// std case: high value at miscValue1
873873
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID:
874874
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_SOLD: /* FIXME: for online player only currently */
875875
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_DEALT:
@@ -949,7 +949,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
949949
break;
950950
}
951951
case ACHIEVEMENT_CRITERIA_TYPE_FALL_WITHOUT_DYING:
952-
// miscvalue1 is the ingame fallheight*100 as stored in dbc
952+
// miscValue1 is the ingame fallheight*100 as stored in dbc
953953
SetCriteriaProgress(achievementCriteria, miscValue1);
954954
break;
955955
case ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA:
@@ -1871,8 +1871,8 @@ bool AchievementMgr::RequirementsSatisfied(AchievementCriteriaEntry const* achie
18711871
return false;
18721872
break;
18731873
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE:
1874-
// miscvalue1=loot_type (note: 0 = LOOT_CORPSE and then it ignored)
1875-
// miscvalue2=count of item loot
1874+
// miscValue1=loot_type (note: 0 = LOOT_CORPSE and then it ignored)
1875+
// miscValue2=count of item loot
18761876
if (!miscValue1 || !miscValue2)
18771877
return false;
18781878
if (miscValue1 != achievementCriteria->Asset.LootType)
@@ -1924,24 +1924,24 @@ bool AchievementMgr::RequirementsSatisfied(AchievementCriteriaEntry const* achie
19241924
return false;
19251925
break;
19261926
case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM:
1927-
// miscvalue1 = itemSlot
1928-
// miscvalue2 = itemid
1927+
// miscValue1 = itemSlot
1928+
// miscValue2 = itemid
19291929
if (!miscValue2)
19301930
return false;
19311931
if (miscValue1 != achievementCriteria->Asset.ItemSlot)
19321932
return false;
19331933
break;
19341934
case ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT:
19351935
case ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT:
1936-
// miscvalue1 = itemid
1937-
// miscvalue2 = diced value
1936+
// miscValue1 = itemid
1937+
// miscValue2 = diced value
19381938
if (!miscValue1)
19391939
return false;
19401940
if (miscValue2 != achievementCriteria->Asset.RollValue)
19411941
return false;
19421942
break;
19431943
case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE:
1944-
// miscvalue1 = emote
1944+
// miscValue1 = emote
19451945
if (!miscValue1)
19461946
return false;
19471947
if (miscValue1 != achievementCriteria->Asset.EmoteID)

src/server/game/AuctionHouse/AuctionHouseMgr.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 new
283283
}
284284

285285
//this function sends mail, when auction is cancelled to old bidder
286-
void AuctionHouseMgr::SendAuctionCancelledToBidderMail(AuctionEntry* auction, CharacterDatabaseTransaction trans)
286+
void AuctionHouseMgr::SendAuctionCancelledToBidderMail(AuctionEntry* auction, CharacterDatabaseTransaction trans, Item* item)
287287
{
288288
ObjectGuid bidder_guid = ObjectGuid(HighGuid::Player, auction->bidder);
289289
Player* bidder = ObjectAccessor::FindConnectedPlayer(bidder_guid);
@@ -292,6 +292,9 @@ void AuctionHouseMgr::SendAuctionCancelledToBidderMail(AuctionEntry* auction, Ch
292292
if (!bidder)
293293
bidder_accId = sCharacterCache->GetCharacterAccountIdByGuid(bidder_guid);
294294

295+
if (bidder)
296+
bidder->GetSession()->SendAuctionRemovedNotification(auction->Id, auction->itemEntry, item->GetItemRandomPropertyId());
297+
295298
// bidder exist
296299
if ((bidder || bidder_accId) && !sAuctionBotConfig->IsBotChar(auction->bidder))
297300
MailDraft(auction->BuildAuctionMailSubject(AUCTION_CANCELLED_TO_BIDDER), "")

src/server/game/AuctionHouse/AuctionHouseMgr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ class TC_GAME_API AuctionHouseMgr
188188
void SendAuctionSuccessfulMail(AuctionEntry* auction, CharacterDatabaseTransaction trans);
189189
void SendAuctionExpiredMail(AuctionEntry* auction, CharacterDatabaseTransaction trans);
190190
void SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 newPrice, Player* newBidder, CharacterDatabaseTransaction trans);
191-
void SendAuctionCancelledToBidderMail(AuctionEntry* auction, CharacterDatabaseTransaction trans);
191+
void SendAuctionCancelledToBidderMail(AuctionEntry* auction, CharacterDatabaseTransaction trans, Item* item);
192192

193193
static uint32 GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item* pItem, uint32 count);
194194
static AuctionHouseEntry const* GetAuctionHouseEntry(uint32 factionTemplateId);

src/server/game/Battlegrounds/BattlegroundMgr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket* data, Battlegro
189189
// The following segment is read as uint64 in client but can be appended as their original type.
190190
*data << uint8(arenatype);
191191
TC_LOG_DEBUG("network", "BattlegroundMgr::BuildBattlegroundStatusPacket: arenatype = {} for bg instanceID {}, TypeID {}.", arenatype, bg->GetClientInstanceID(), bg->GetTypeID());
192-
*data << uint8(bg->isArena() ? 0xE : 0x0);
192+
*data << uint8(bg->GetBracketId());
193193
*data << uint32(bg->GetTypeID());
194194
*data << uint16(0x1F90);
195195
// End of uint64 segment, decomposed this way for simplicity

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

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6093,8 +6093,8 @@ void Player::SendActionButtons(uint32 state) const
60936093
data << uint8(state);
60946094
/*
60956095
state can be 0, 1, 2
6096-
0 - Looks to be sent when initial action buttons get sent, however on Trinity we use 1 since 0 had some difficulties
6097-
1 - Used in any SMSG_ACTION_BUTTONS packet with button data on Trinity. Only used after spec swaps on retail.
6096+
0 - Sends initial action buttons, client does not validate if we have the spell or not
6097+
1 - Used used after spec swaps, client validates if a spell is known.
60986098
2 - Clears the action bars client sided. This is sent during spec swap before unlearning and before sending the new buttons
60996099
*/
61006100
if (state != 2)
@@ -21515,10 +21515,12 @@ void Player::InitDisplayIds()
2151521515

2151621516
inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot, int32 price, ItemTemplate const* pProto, Creature* pVendor, VendorItem const* crItem, bool bStore)
2151721517
{
21518+
uint32 stacks = count;
21519+
count = stacks * pProto->BuyCount;
2151821520
ItemPosCountVec vDest;
2151921521
uint16 uiDest = 0;
2152021522
InventoryResult msg = bStore ?
21521-
CanStoreNewItem(bag, slot, vDest, item, pProto->BuyCount * count) :
21523+
CanStoreNewItem(bag, slot, vDest, item, count) :
2152221524
CanEquipNewItem(slot, uiDest, item, false);
2152321525
if (msg != EQUIP_ERR_OK)
2152421526
{
@@ -21533,15 +21535,15 @@ inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 c
2153321535
ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(crItem->ExtendedCost);
2153421536
ASSERT(iece);
2153521537
if (iece->HonorPoints)
21536-
ModifyHonorPoints(-int32(iece->HonorPoints * count));
21538+
ModifyHonorPoints(-int32(iece->HonorPoints * stacks));
2153721539

2153821540
if (iece->ArenaPoints)
21539-
ModifyArenaPoints(-int32(iece->ArenaPoints * count));
21541+
ModifyArenaPoints(-int32(iece->ArenaPoints * stacks));
2154021542

2154121543
for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i)
2154221544
{
2154321545
if (iece->ItemID[i])
21544-
DestroyItemCount(iece->ItemID[i], (iece->ItemCount[i] * count), true);
21546+
DestroyItemCount(iece->ItemID[i], iece->ItemCount[i] * stacks, true);
2154521547
}
2154621548
}
2154721549

@@ -21550,15 +21552,16 @@ inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 c
2155021552
EquipNewItem(uiDest, item, true);
2155121553
if (it)
2155221554
{
21553-
uint32 new_count = pVendor->UpdateVendorItemCurrentCount(crItem, pProto->BuyCount * count);
21555+
uint32 new_count = pVendor->UpdateVendorItemCurrentCount(crItem, count);
2155421556

2155521557
WorldPacket data(SMSG_BUY_ITEM, (8+4+4+4));
2155621558
data << uint64(pVendor->GetGUID());
2155721559
data << uint32(vendorslot + 1); // numbered from 1 at client
2155821560
data << int32(crItem->maxcount > 0 ? new_count : 0xFFFFFFFF);
21559-
data << uint32(count);
21561+
data << uint32(stacks);
2156021562
SendDirectMessage(&data);
21561-
SendNewItem(it, pProto->BuyCount * count, true, false, false);
21563+
21564+
SendNewItem(it, count, true, false, false);
2156221565

2156321566
if (!bStore)
2156421567
AutoUnequipOffhandIfNeed();
@@ -21577,7 +21580,7 @@ inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 c
2157721580
}
2157821581

2157921582
// Return true is the bought item has a max count to force refresh of window by caller
21580-
bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot)
21583+
bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uint32 item, uint32 count, uint8 bag, uint8 slot)
2158121584
{
2158221585
// cheating attempt
2158321586
if (count < 1) count = 1;
@@ -21662,6 +21665,7 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uin
2166221665

2166321666
if (crItem->ExtendedCost)
2166421667
{
21668+
uint32 stacks = count;
2166521669
ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(crItem->ExtendedCost);
2166621670
if (!iece)
2166721671
{
@@ -21670,14 +21674,14 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uin
2167021674
}
2167121675

2167221676
// honor points price
21673-
if (GetHonorPoints() < (iece->HonorPoints * count))
21677+
if (GetHonorPoints() < (iece->HonorPoints * stacks))
2167421678
{
2167521679
SendEquipError(EQUIP_ERR_NOT_ENOUGH_HONOR_POINTS, nullptr, nullptr);
2167621680
return false;
2167721681
}
2167821682

2167921683
// arena points price
21680-
if (GetArenaPoints() < (iece->ArenaPoints * count))
21684+
if (GetArenaPoints() < (iece->ArenaPoints * stacks))
2168121685
{
2168221686
SendEquipError(EQUIP_ERR_NOT_ENOUGH_ARENA_POINTS, nullptr, nullptr);
2168321687
return false;
@@ -21686,7 +21690,7 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uin
2168621690
// item base price
2168721691
for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i)
2168821692
{
21689-
if (iece->ItemID[i] && !HasItemCount(iece->ItemID[i], (iece->ItemCount[i] * count)))
21693+
if (iece->ItemID[i] && !HasItemCount(iece->ItemID[i], (iece->ItemCount[i] * stacks)))
2169021694
{
2169121695
SendEquipError(EQUIP_ERR_VENDOR_MISSING_TURNINS, nullptr, nullptr);
2169221696
return false;
@@ -21706,11 +21710,11 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uin
2170621710
if (crItem->IsGoldRequired(pProto) && pProto->BuyPrice > 0) //Assume price cannot be negative (do not know why it is int32)
2170721711
{
2170821712
uint32 maxCount = MAX_MONEY_AMOUNT / pProto->BuyPrice;
21709-
if ((uint32)count > maxCount)
21713+
if (uint32(count) > maxCount)
2171021714
{
2171121715
TC_LOG_ERROR("entities.player.cheat", "Player::BuyItemFromVendorSlot: Player '{}' ({}) tried to buy item (ItemID: {}, Count: {}), causing overflow",
21712-
GetName(), GetGUID().ToString(), pProto->ItemId, (uint32)count);
21713-
count = (uint8)maxCount;
21716+
GetName(), GetGUID().ToString(), pProto->ItemId, uint32(count));
21717+
count = uint32(maxCount);
2171421718
}
2171521719
price = pProto->BuyPrice * count; //it should not exceed MAX_MONEY_AMOUNT
2171621720

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
11901190
bool IsTwoHandUsed() const;
11911191
bool IsUsingTwoHandedWeaponInOneHand() const;
11921192
void SendNewItem(Item* item, uint32 count, bool received, bool created, bool broadcast = false, bool sendChatMessage = true);
1193-
bool BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot);
1193+
bool BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uint32 item, uint32 count, uint8 bag, uint8 slot);
11941194
bool _StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot, int32 price, ItemTemplate const* pProto, Creature* pVendor, VendorItem const* crItem, bool bStore);
11951195

11961196
float GetReputationPriceDiscount(Creature const* creature) const;

0 commit comments

Comments
 (0)