Skip to content

Commit

Permalink
Merge 3.3.5-base_patch to 3.3.5-paymaster
Browse files Browse the repository at this point in the history
  • Loading branch information
Github Actions committed Feb 3, 2025
2 parents 29d529b + 0b55c6b commit c79bcf3
Show file tree
Hide file tree
Showing 25 changed files with 355 additions and 292 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ALTER TABLE `creature_classlevelstats` CHANGE `basehp0` `basehp0` int unsigned NOT NULL DEFAULT '1';
ALTER TABLE `creature_classlevelstats` CHANGE `basehp1` `basehp1` int unsigned NOT NULL DEFAULT '1';
ALTER TABLE `creature_classlevelstats` CHANGE `basehp2` `basehp2` int unsigned NOT NULL DEFAULT '1';
ALTER TABLE `creature_classlevelstats` CHANGE `basemana` `basemana` int unsigned NOT NULL DEFAULT '1';
ALTER TABLE `creature_classlevelstats` CHANGE `basearmor` `basearmor` int unsigned NOT NULL DEFAULT '1';
215 changes: 215 additions & 0 deletions sql/updates/world/3.3.5/2025_02_02_00_world.sql

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
// 0: uint32, 1: uint8, 3: string, 4: uint32, 5: uint32
PrepareStatement(CHAR_INS_GUILD_RANK, "INSERT INTO guild_rank (guildid, rid, rname, rights, BankMoneyPerDay) VALUES (?, ?, ?, ?, ?)", CONNECTION_ASYNC);
PrepareStatement(CHAR_DEL_GUILD_RANKS, "DELETE FROM guild_rank WHERE guildid = ?", CONNECTION_ASYNC); // 0: uint32
PrepareStatement(CHAR_DEL_GUILD_LOWEST_RANK, "DELETE FROM guild_rank WHERE guildid = ? AND rid >= ?", CONNECTION_ASYNC); // 0: uint32, 1: uint8
PrepareStatement(CHAR_DEL_GUILD_RANK, "DELETE FROM guild_rank WHERE guildid = ? AND rid = ?", CONNECTION_ASYNC); // 0: uint32, 1: uint8
PrepareStatement(CHAR_INS_GUILD_BANK_TAB, "INSERT INTO guild_bank_tab (guildid, TabId) VALUES (?, ?)", CONNECTION_ASYNC); // 0: uint32, 1: uint8
PrepareStatement(CHAR_DEL_GUILD_BANK_TAB, "DELETE FROM guild_bank_tab WHERE guildid = ? AND TabId = ?", CONNECTION_ASYNC); // 0: uint32, 1: uint8
PrepareStatement(CHAR_DEL_GUILD_BANK_TABS, "DELETE FROM guild_bank_tab WHERE guildid = ?", CONNECTION_ASYNC); // 0: uint32
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ enum CharacterDatabaseStatements : uint32
CHAR_DEL_GUILD_MEMBERS,
CHAR_INS_GUILD_RANK,
CHAR_DEL_GUILD_RANKS,
CHAR_DEL_GUILD_LOWEST_RANK,
CHAR_DEL_GUILD_RANK,
CHAR_INS_GUILD_BANK_TAB,
CHAR_DEL_GUILD_BANK_TAB,
CHAR_DEL_GUILD_BANK_TABS,
Expand Down
4 changes: 4 additions & 0 deletions src/server/game/Battlegrounds/Battleground.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,10 @@ void Battleground::EndBattleground(uint32 winner)
CharacterDatabase.Execute(stmt);
}

// remove temporary currency bonus auras before rewarding player
player->RemoveAura(SPELL_HONORABLE_DEFENDER_25Y);
player->RemoveAura(SPELL_HONORABLE_DEFENDER_60Y);

// Reward winner team
if (team == winner)
{
Expand Down
83 changes: 50 additions & 33 deletions src/server/game/Entities/Player/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ Player::Player(WorldSession* session): Unit(true)
SetLastRuneGraceTimer(i, 0);
}

for (uint8 i=0; i < MAX_TIMERS; i++)
for (uint8 i = 0; i < MAX_TIMERS; i++)
m_MirrorTimer[i] = DISABLED_MIRROR_TIMER;

m_MirrorTimerFlags = UNDERWATER_NONE;
Expand Down Expand Up @@ -524,7 +524,7 @@ bool Player::Create(ObjectGuid::LowType guidlow, CharacterCreateInfo* createInfo
SetArenaFaction(0);

SetUInt32Value(PLAYER_GUILDID, 0);
SetRank(0);
SetGuildRank(0);
SetUInt32Value(PLAYER_GUILD_TIMESTAMP, 0);

for (int i = 0; i < KNOWN_TITLES_SIZE; ++i)
Expand Down Expand Up @@ -16686,14 +16686,17 @@ void Player::SendQuestReward(Quest const* quest, uint32 XP) const
{
uint32 questId = quest->GetQuestId();
sGameEventMgr->HandleQuestComplete(questId);
WorldPacket data(SMSG_QUESTGIVER_QUEST_COMPLETE, (4+4+4+4+4));
data << uint32(questId);

uint32 xp;

if (!IsMaxLevel())
data << uint32(XP);
xp = XP;
else
data << uint32(0);
xp = 0;

WorldPacket data(SMSG_QUESTGIVER_QUEST_COMPLETE, (4+4+4+4+4));
data << uint32(questId);
data << uint32(xp);
data << uint32(quest->GetRewOrReqMoney(this));
data << uint32(10 * quest->CalculateHonorGain(GetQuestLevel(quest)));
data << uint32(quest->GetBonusTalents()); // bonus talents
Expand Down Expand Up @@ -18930,8 +18933,8 @@ void Player::SendSavedInstances()
}
}

//Send opcode 811. true or false means, whether you have current raid/heroic instances
data.Initialize(SMSG_UPDATE_INSTANCE_OWNERSHIP);
//Send opcode SMSG_UPDATE_INSTANCE_OWNERSHIP. true or false means, whether you have current raid/heroic instances
data.Initialize(SMSG_UPDATE_INSTANCE_OWNERSHIP, 4);
data << uint32(hasBeenSaved);
SendDirectMessage(&data);

Expand All @@ -18944,7 +18947,7 @@ void Player::SendSavedInstances()
{
if (itr->second.perm)
{
data.Initialize(SMSG_UPDATE_LAST_INSTANCE);
data.Initialize(SMSG_UPDATE_LAST_INSTANCE, 4);
data << uint32(itr->second.save->GetMapId());
SendDirectMessage(&data);
}
Expand Down Expand Up @@ -19711,7 +19714,7 @@ void Player::_SaveInventory(CharacterDatabaseTransaction trans)
// save all changes to the item...
if (item->GetState() != ITEM_NEW) // only for existing items, no duplicates
item->SaveToDB(trans);
// ...but do not save position in invntory
// ...but do not save position in inventory
continue;
}
}
Expand Down Expand Up @@ -20377,7 +20380,7 @@ void Player::SendResetInstanceFailed(uint32 reason, uint32 MapId) const
// 1: There are players offline in your party.
// 2>: There are players in your party attempting to zone into an instance.
*/
WorldPacket data(SMSG_INSTANCE_RESET_FAILED, 4);
WorldPacket data(SMSG_INSTANCE_RESET_FAILED, 8);
data << uint32(reason);
data << uint32(MapId);
SendDirectMessage(&data);
Expand Down Expand Up @@ -20687,6 +20690,16 @@ void Player::TextEmote(std::string_view text, WorldObject const* /*= nullptr*/,
SendMessageToSetInRange(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), true, !GetSession()->HasPermission(rbac::RBAC_PERM_TWO_SIDE_INTERACTION_CHAT), true);
}

void Player::WhisperAddon(std::string const& text, Player* receiver)
{
std::string _text(text);
sScriptMgr->OnPlayerChat(this, CHAT_MSG_WHISPER, uint32(LANG_ADDON), _text, receiver);

WorldPacket data;
ChatHandler::BuildChatPacket(data, CHAT_MSG_WHISPER, LANG_ADDON, this, this, _text);
receiver->SendDirectMessage(&data);
}

void Player::TextEmote(uint32 textId, WorldObject const* target /*= nullptr*/, bool /*isBossEmote = false*/)
{
Talk(textId, CHAT_MSG_EMOTE, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), target);
Expand Down Expand Up @@ -26116,14 +26129,15 @@ void Player::SetReputation(uint32 factionentry, uint32 value)
{
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(factionentry), value);
}

uint32 Player::GetReputation(uint32 factionentry) const
{
return GetReputationMgr().GetReputation(sFactionStore.LookupEntry(factionentry));
}

std::string const& Player::GetGuildName() const
std::string Player::GetGuildName() const
{
return sGuildMgr->GetGuildById(GetGuildId())->GetName();
return GetGuildId() ? sGuildMgr->GetGuildById(GetGuildId())->GetName() : "";
}

void Player::SendDuelCountdown(uint32 counter)
Expand Down Expand Up @@ -26216,6 +26230,26 @@ PetStable& Player::GetOrInitPetStable()
return *m_petStable;
}

void Player::SendItemRefundResult(Item* item, ItemExtendedCostEntry const* iece, uint8 error) const
{
WorldPacket data(SMSG_ITEM_REFUND_RESULT, 8 + 4 + 4 + 4 + 4 + 4 * 4 + 4 * 4);
data << uint64(item->GetGUID()); // item guid
data << uint32(error); // 0, or error code
if (!error)
{
data << uint32(item->GetPaidMoney()); // money cost
data << uint32(iece->HonorPoints); // honor point cost
data << uint32(iece->ArenaPoints); // arena point cost
for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i) // item cost data
{
data << uint32(iece->ItemID[i]);
data << uint32(iece->ItemCount[i]);
}
}

SendDirectMessage(&data);
}

void Player::RefundItem(Item* item)
{
if (!item->IsRefundable())
Expand All @@ -26227,10 +26261,7 @@ void Player::RefundItem(Item* item)
if (item->IsRefundExpired()) // item refund has expired
{
item->SetNotRefundable(this);
WorldPacket data(SMSG_ITEM_REFUND_RESULT, 8+4);
data << uint64(item->GetGUID()); // Guid
data << uint32(10); // Error!
SendDirectMessage(&data);
SendItemRefundResult(item, nullptr, 10);
return;
}

Expand Down Expand Up @@ -26268,25 +26299,11 @@ void Player::RefundItem(Item* item)

if (store_error)
{
WorldPacket data(SMSG_ITEM_REFUND_RESULT, 8+4);
data << uint64(item->GetGUID()); // Guid
data << uint32(10); // Error!
SendDirectMessage(&data);
SendItemRefundResult(item, iece, 10);
return;
}

WorldPacket data(SMSG_ITEM_REFUND_RESULT, 8+4+4+4+4+4*4+4*4);
data << uint64(item->GetGUID()); // item guid
data << uint32(0); // 0, or error code
data << uint32(item->GetPaidMoney()); // money cost
data << uint32(iece->HonorPoints); // honor point cost
data << uint32(iece->ArenaPoints); // arena point cost
for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i) // item cost data
{
data << uint32(iece->ItemID[i]);
data << uint32(iece->ItemCount[i]);
}
SendDirectMessage(&data);
SendItemRefundResult(item, iece, 0);

uint32 moneyRefund = item->GetPaidMoney(); // item-> will be invalidated in DestroyItem

Expand Down
9 changes: 6 additions & 3 deletions src/server/game/Entities/Player/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ struct CharTitlesEntry;
struct ChatChannelsEntry;
struct CreatureTemplate;
struct FactionEntry;
struct ItemExtendedCostEntry;
struct ItemSetEffect;
struct ItemTemplate;
struct Loot;
Expand Down Expand Up @@ -1079,6 +1080,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
/// Handles whispers from Addons and players based on sender, receiver's guid and language.
void Whisper(std::string_view text, Language language, Player* receiver, bool = false) override;
void Whisper(uint32 textId, Player* target, bool isBossWhisper = false) override;
void WhisperAddon(std::string const& text, Player* receiver);

/*********************************************************/
/*** STORAGE SYSTEM ***/
Expand Down Expand Up @@ -1471,7 +1473,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
void RemoveTemporarySpell(uint32 spellId);
void SetReputation(uint32 factionentry, uint32 value);
uint32 GetReputation(uint32 factionentry) const;
std::string const& GetGuildName() const;
std::string GetGuildName() const;

// Talents
uint32 GetFreeTalentPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS1); }
Expand Down Expand Up @@ -1605,8 +1607,8 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
void SendUpdateToOutOfRangeGroupMembers();

void SetInGuild(uint32 guildId);
void SetRank(uint8 rankId) { SetUInt32Value(PLAYER_GUILDRANK, rankId); }
uint8 GetRank() const { return uint8(GetUInt32Value(PLAYER_GUILDRANK)); }
void SetGuildRank(uint8 rankId) { SetUInt32Value(PLAYER_GUILDRANK, rankId); }
uint8 GetGuildRank() const { return uint8(GetUInt32Value(PLAYER_GUILDRANK)); }
void SetGuildIdInvited(uint32 GuildId) { m_GuildIdInvited = GuildId; }
uint32 GetGuildId() const { return GetUInt32Value(PLAYER_GUILDID); }
Guild* GetGuild();
Expand Down Expand Up @@ -2495,6 +2497,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
GuidSet m_refundableItems;
void SendRefundInfo(Item* item);
void RefundItem(Item* item);
void SendItemRefundResult(Item* item, ItemExtendedCostEntry const* iece, uint8 error) const;

// know currencies are not removed at any point (0 displayed)
void AddKnownCurrency(uint32 itemId);
Expand Down
36 changes: 16 additions & 20 deletions src/server/game/Entities/Unit/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11100,8 +11100,9 @@ bool Unit::InitTamedPet(Pet* pet, uint8 level, uint32 spell_id)
// only if not player and not controlled by player pet. And not at BG
if ((durabilityLoss && !player && !victim->ToPlayer()->InBattleground()) || (player && sWorld->getBoolConfig(CONFIG_DURABILITY_LOSS_IN_PVP)))
{
TC_LOG_DEBUG("entities.unit", "We are dead, losing {} percent durability", sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH));
plrVictim->DurabilityLossAll(sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH), false);
double baseLoss = sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH);
TC_LOG_DEBUG("entities.unit", "We are dead, losing {} percent durability", baseLoss);
plrVictim->DurabilityLossAll(baseLoss, false);
// durability lost message
plrVictim->SendDurabilityLoss();
}
Expand Down Expand Up @@ -12210,6 +12211,17 @@ void Unit::UpdateObjectVisibility(bool forced)
}
}

void Unit::SendMoveKnockBack(Player* player, float speedXY, float speedZ, float vcos, float vsin)
{
WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8 + 4 + 4 + 4 + 4 + 4));
data << GetPackGUID();
data << uint32(0); // counter
data << TaggedPosition<Position::XY>(vcos, vsin);
data << float(speedXY); // Horizontal speed
data << float(speedZ); // Z Movement speed (vertical)
player->SendDirectMessage(&data);
}

void Unit::KnockbackFrom(float x, float y, float speedXY, float speedZ)
{
if (IsMovedByServer())
Expand All @@ -12220,15 +12232,7 @@ void Unit::KnockbackFrom(float x, float y, float speedXY, float speedZ)
{
float vcos, vsin;
GetSinCos(x, y, vsin, vcos);

WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8 + 4 + 4 + 4 + 4 + 4));
data << GetPackGUID();
data << uint32(0); // counter
data << TaggedPosition<Position::XY>(vcos, vsin);
data << float(speedXY); // Horizontal speed
data << float(-speedZ); // Z Movement speed (vertical)

GetGameClientMovingMe()->SendDirectMessage(&data);
SendMoveKnockBack(GetGameClientMovingMe()->GetBasePlayer(), speedXY, -speedZ, vcos, vsin);

if (HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) || HasAuraType(SPELL_AURA_FLY))
SetCanFly(true, true);
Expand Down Expand Up @@ -12474,15 +12478,7 @@ void Unit::JumpTo(float speedXY, float speedZ, bool forward, Optional<Position>
{
float vcos = std::cos(angle+GetOrientation());
float vsin = std::sin(angle+GetOrientation());

WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8+4+4+4+4+4));
data << GetPackGUID();
data << uint32(0); // Sequence
data << TaggedPosition<Position::XY>(vcos, vsin);
data << float(speedXY); // Horizontal speed
data << float(-speedZ); // Z Movement speed (vertical)

ToPlayer()->SendDirectMessage(&data);
SendMoveKnockBack(ToPlayer(), speedXY, -speedZ, vcos, vsin);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/server/game/Entities/Unit/Unit.h
Original file line number Diff line number Diff line change
Expand Up @@ -1204,6 +1204,7 @@ class TC_GAME_API Unit : public WorldObject
void UpdateOrientation(float orientation);
void UpdateHeight(float newZ);

void SendMoveKnockBack(Player* player, float speedXY, float speedZ, float vcos, float vsin);
void KnockbackFrom(float x, float y, float speedXY, float speedZ);
void JumpTo(float speedXY, float speedZ, bool forward = true, Optional<Position> dest = {});
void JumpTo(WorldObject* obj, float speedZ, bool withOrientation = false);
Expand Down
6 changes: 3 additions & 3 deletions src/server/game/Globals/ObjectMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10041,7 +10041,7 @@ void ObjectMgr::LoadCreatureClassLevelStats()

for (uint8 i = 0; i < MAX_EXPANSIONS; ++i)
{
stats.BaseHealth[i] = fields[2 + i].GetUInt16();
stats.BaseHealth[i] = fields[2 + i].GetUInt32();

if (stats.BaseHealth[i] == 0)
{
Expand All @@ -10057,8 +10057,8 @@ void ObjectMgr::LoadCreatureClassLevelStats()
}
}

stats.BaseMana = fields[5].GetUInt16();
stats.BaseArmor = fields[6].GetUInt16();
stats.BaseMana = fields[5].GetUInt32();
stats.BaseArmor = fields[6].GetUInt32();

stats.AttackPower = fields[7].GetUInt16();
stats.RangedAttackPower = fields[8].GetUInt16();
Expand Down
Loading

0 comments on commit c79bcf3

Please sign in to comment.