Skip to content

Commit 5e60968

Browse files
author
Github Actions
committed
Merge 3.3.5 to 3.3.5-base_patch
2 parents 5c59086 + a3aecbd commit 5e60968

19 files changed

Lines changed: 392 additions & 122 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
-- Add missing furbolg camp area triggers for quest "How Big a Threat?"
2+
SET @QUEST := 984;
3+
DELETE FROM `areatrigger_involvedrelation` WHERE `quest` = @QUEST;
4+
INSERT INTO `areatrigger_involvedrelation` (`id`, `quest`) VALUES
5+
(231, @QUEST),
6+
(232, @QUEST),
7+
(233, @QUEST),
8+
(234, @QUEST),
9+
(235, @QUEST),
10+
(236, @QUEST),
11+
(237, @QUEST),
12+
(238, @QUEST);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
--
2+
UPDATE `creature_template_locale` SET `Name`="Balai Lok'Wein", `Title`="Tränke, Schriftrollen & Reagenzien", `VerifiedBuild`=0 WHERE `entry`=13476 AND `locale`='deDE';
3+
UPDATE `creature_template_locale` SET `Name`="Balai Lok'Wein", `Title`="Pociones, pergaminos y componentes", `VerifiedBuild`=0 WHERE `entry`=13476 AND `locale`='esES';
4+
UPDATE `creature_template_locale` SET `Name`="Balai Lok'Wein", `Title`="Pociones, pergaminos y componentes", `VerifiedBuild`=0 WHERE `entry`=13476 AND `locale`='esMX';
5+
UPDATE `creature_template_locale` SET `Name`="Balai Lok'Wein", `Title`="Potions, Parchemins & Composants", `VerifiedBuild`=0 WHERE `entry`=13476 AND `locale`='frFR';
6+
UPDATE `creature_template_locale` SET `Name`="발라이 로크웨인", `Title`="물약 및 마법용품 상인", `VerifiedBuild`=0 WHERE `entry`=13476 AND `locale`='koKR';
7+
UPDATE `creature_template_locale` SET `Name`="Бала Лок'Вен", `Title`="Зелья, cвитки и pеагенты", `VerifiedBuild`=0 WHERE `entry`=13476 AND `locale`='ruRU';
8+
UPDATE `creature_template_locale` SET `Name`="巴莱·洛克维", `Title`="药剂、卷轴和材料", `VerifiedBuild`=0 WHERE `entry`=13476 AND `locale`='zhCN';
9+
UPDATE `creature_template_locale` SET `Name`="巴萊·洛克維", `Title`="药剂、卷轴和材料", `VerifiedBuild`=0 WHERE `entry`=13476 AND `locale`='zhTW';

src/common/Utilities/Util.h

Lines changed: 58 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -229,59 +229,75 @@ inline bool isEastAsianString(std::wstring_view wstr, bool numericOrSpace)
229229
return true;
230230
}
231231

232-
inline wchar_t wcharToUpper(wchar_t wchar)
232+
struct WcharToUpper
233233
{
234-
if (wchar >= L'a' && wchar <= L'z') // LATIN SMALL LETTER A - LATIN SMALL LETTER Z
235-
return wchar_t(uint16(wchar)-0x0020);
236-
if (wchar == 0x00DF) // LATIN SMALL LETTER SHARP S
237-
return wchar_t(0x1E9E);
238-
if (wchar >= 0x00E0 && wchar <= 0x00F6) // LATIN SMALL LETTER A WITH GRAVE - LATIN SMALL LETTER O WITH DIAERESIS
239-
return wchar_t(uint16(wchar)-0x0020);
240-
if (wchar >= 0x00F8 && wchar <= 0x00FE) // LATIN SMALL LETTER O WITH STROKE - LATIN SMALL LETTER THORN
241-
return wchar_t(uint16(wchar)-0x0020);
242-
if (wchar >= 0x0101 && wchar <= 0x012F) // LATIN SMALL LETTER A WITH MACRON - LATIN SMALL LETTER I WITH OGONEK (only %2=1)
234+
wchar_t operator()(wchar_t wchar) const
243235
{
244-
if (wchar % 2 == 1)
245-
return wchar_t(uint16(wchar)-0x0001);
246-
}
247-
if (wchar >= 0x0430 && wchar <= 0x044F) // CYRILLIC SMALL LETTER A - CYRILLIC SMALL LETTER YA
248-
return wchar_t(uint16(wchar)-0x0020);
249-
if (wchar == 0x0451) // CYRILLIC SMALL LETTER IO
250-
return wchar_t(0x0401);
236+
if (wchar >= L'a' && wchar <= L'z') // LATIN SMALL LETTER A - LATIN SMALL LETTER Z
237+
return wchar_t(uint16(wchar) - 0x0020);
238+
if (wchar == 0x00DF) // LATIN SMALL LETTER SHARP S
239+
return wchar_t(0x1E9E);
240+
if (wchar >= 0x00E0 && wchar <= 0x00F6) // LATIN SMALL LETTER A WITH GRAVE - LATIN SMALL LETTER O WITH DIAERESIS
241+
return wchar_t(uint16(wchar) - 0x0020);
242+
if (wchar >= 0x00F8 && wchar <= 0x00FE) // LATIN SMALL LETTER O WITH STROKE - LATIN SMALL LETTER THORN
243+
return wchar_t(uint16(wchar) - 0x0020);
244+
if (wchar >= 0x0101 && wchar <= 0x012F) // LATIN SMALL LETTER A WITH MACRON - LATIN SMALL LETTER I WITH OGONEK (only %2=1)
245+
{
246+
if (wchar % 2 == 1)
247+
return wchar_t(uint16(wchar) - 0x0001);
248+
}
249+
if (wchar >= 0x0430 && wchar <= 0x044F) // CYRILLIC SMALL LETTER A - CYRILLIC SMALL LETTER YA
250+
return wchar_t(uint16(wchar) - 0x0020);
251+
if (wchar == 0x0451) // CYRILLIC SMALL LETTER IO
252+
return wchar_t(0x0401);
251253

252-
return wchar;
253-
}
254+
return wchar;
255+
}
256+
} inline constexpr wcharToUpper;
254257

255-
inline wchar_t wcharToUpperOnlyLatin(wchar_t wchar)
258+
struct WcharToUpperOnlyLatin
256259
{
257-
return isBasicLatinCharacter(wchar) ? wcharToUpper(wchar) : wchar;
258-
}
260+
wchar_t operator()(wchar_t wchar) const
261+
{
262+
return isBasicLatinCharacter(wchar) ? wcharToUpper(wchar) : wchar;
263+
}
264+
} inline constexpr wcharToUpperOnlyLatin;
259265

260-
inline wchar_t wcharToLower(wchar_t wchar)
266+
struct WcharToLower
261267
{
262-
if (wchar >= L'A' && wchar <= L'Z') // LATIN CAPITAL LETTER A - LATIN CAPITAL LETTER Z
263-
return wchar_t(uint16(wchar)+0x0020);
264-
if (wchar >= 0x00C0 && wchar <= 0x00D6) // LATIN CAPITAL LETTER A WITH GRAVE - LATIN CAPITAL LETTER O WITH DIAERESIS
265-
return wchar_t(uint16(wchar)+0x0020);
266-
if (wchar >= 0x00D8 && wchar <= 0x00DE) // LATIN CAPITAL LETTER O WITH STROKE - LATIN CAPITAL LETTER THORN
267-
return wchar_t(uint16(wchar)+0x0020);
268-
if (wchar >= 0x0100 && wchar <= 0x012E) // LATIN CAPITAL LETTER A WITH MACRON - LATIN CAPITAL LETTER I WITH OGONEK (only %2=0)
268+
wchar_t operator()(wchar_t wchar) const
269269
{
270-
if (wchar % 2 == 0)
271-
return wchar_t(uint16(wchar)+0x0001);
270+
if (wchar >= L'A' && wchar <= L'Z') // LATIN CAPITAL LETTER A - LATIN CAPITAL LETTER Z
271+
return wchar_t(uint16(wchar)+0x0020);
272+
if (wchar >= 0x00C0 && wchar <= 0x00D6) // LATIN CAPITAL LETTER A WITH GRAVE - LATIN CAPITAL LETTER O WITH DIAERESIS
273+
return wchar_t(uint16(wchar)+0x0020);
274+
if (wchar >= 0x00D8 && wchar <= 0x00DE) // LATIN CAPITAL LETTER O WITH STROKE - LATIN CAPITAL LETTER THORN
275+
return wchar_t(uint16(wchar)+0x0020);
276+
if (wchar >= 0x0100 && wchar <= 0x012E) // LATIN CAPITAL LETTER A WITH MACRON - LATIN CAPITAL LETTER I WITH OGONEK (only %2=0)
277+
{
278+
if (wchar % 2 == 0)
279+
return wchar_t(uint16(wchar)+0x0001);
280+
}
281+
if (wchar == 0x1E9E) // LATIN CAPITAL LETTER SHARP S
282+
return wchar_t(0x00DF);
283+
if (wchar == 0x0401) // CYRILLIC CAPITAL LETTER IO
284+
return wchar_t(0x0451);
285+
if (wchar >= 0x0410 && wchar <= 0x042F) // CYRILLIC CAPITAL LETTER A - CYRILLIC CAPITAL LETTER YA
286+
return wchar_t(uint16(wchar)+0x0020);
287+
288+
return wchar;
272289
}
273-
if (wchar == 0x1E9E) // LATIN CAPITAL LETTER SHARP S
274-
return wchar_t(0x00DF);
275-
if (wchar == 0x0401) // CYRILLIC CAPITAL LETTER IO
276-
return wchar_t(0x0451);
277-
if (wchar >= 0x0410 && wchar <= 0x042F) // CYRILLIC CAPITAL LETTER A - CYRILLIC CAPITAL LETTER YA
278-
return wchar_t(uint16(wchar)+0x0020);
290+
} inline constexpr wcharToLower;
279291

280-
return wchar;
281-
}
292+
struct CharToUpper
293+
{
294+
char operator()(char c) const { return std::toupper(static_cast<unsigned char>(c)); }
295+
} inline constexpr charToUpper;
282296

283-
inline char charToUpper(char c) { return std::toupper(c); }
284-
inline char charToLower(char c) { return std::tolower(c); }
297+
struct CharToLower
298+
{
299+
char operator()(char c) const { return std::tolower(static_cast<unsigned char>(c)); }
300+
} inline constexpr charToLower;
285301

286302
TC_COMMON_API void wstrToUpper(std::wstring& str);
287303
TC_COMMON_API void wstrToLower(std::wstring& str);

src/server/database/Database/QueryResult.cpp

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -486,12 +486,12 @@ m_metadataResult(result)
486486
return;
487487
}
488488

489-
m_rows.resize(uint32(m_rowCount) * m_fieldCount);
489+
m_rows.resize(std::size_t(m_rowCount) * m_fieldCount);
490490
while (_NextRow())
491491
{
492492
for (uint32 fIndex = 0; fIndex < m_fieldCount; ++fIndex)
493493
{
494-
m_rows[uint32(m_rowPosition) * m_fieldCount + fIndex].SetMetadata(&m_fieldMetadata[fIndex]);
494+
m_rows[std::size_t(m_rowPosition) * m_fieldCount + fIndex].SetMetadata(&m_fieldMetadata[fIndex]);
495495

496496
unsigned long buffer_length = m_rBind[fIndex].buffer_length;
497497
unsigned long fetched_length = *m_rBind[fIndex].length;
@@ -518,7 +518,7 @@ m_metadataResult(result)
518518
break;
519519
}
520520

521-
m_rows[uint32(m_rowPosition) * m_fieldCount + fIndex].SetValue(
521+
m_rows[std::size_t(m_rowPosition) * m_fieldCount + fIndex].SetValue(
522522
(char const*)buffer,
523523
fetched_length);
524524

@@ -527,7 +527,7 @@ m_metadataResult(result)
527527
}
528528
else
529529
{
530-
m_rows[uint32(m_rowPosition) * m_fieldCount + fIndex].SetValue(
530+
m_rows[std::size_t(m_rowPosition) * m_fieldCount + fIndex].SetValue(
531531
nullptr,
532532
*m_rBind[fIndex].length);
533533
}
@@ -552,12 +552,10 @@ PreparedResultSet::~PreparedResultSet()
552552

553553
bool ResultSet::NextRow()
554554
{
555-
MYSQL_ROW row;
556-
557555
if (!_result)
558556
return false;
559557

560-
row = mysql_fetch_row(_result);
558+
MYSQL_ROW row = mysql_fetch_row(_result);
561559
if (!row)
562560
{
563561
CleanUp();
@@ -616,21 +614,33 @@ void ResultSet::CleanUp()
616614

617615
Field const& ResultSet::operator[](std::size_t index) const
618616
{
619-
ASSERT(index < _fieldCount);
617+
ASSERT(index < std::size_t(_fieldCount));
620618
return _currentRow[index];
621619
}
622620

621+
QueryResultFieldMetadata const& ResultSet::GetFieldMetadata(std::size_t index) const
622+
{
623+
ASSERT(index < std::size_t(_fieldCount));
624+
return _fieldMetadata[index];
625+
}
626+
623627
Field* PreparedResultSet::Fetch() const
624628
{
625629
ASSERT(m_rowPosition < m_rowCount);
626-
return const_cast<Field*>(&m_rows[uint32(m_rowPosition) * m_fieldCount]);
630+
return const_cast<Field*>(&m_rows[std::size_t(m_rowPosition) * m_fieldCount]);
627631
}
628632

629633
Field const& PreparedResultSet::operator[](std::size_t index) const
630634
{
631635
ASSERT(m_rowPosition < m_rowCount);
632-
ASSERT(index < m_fieldCount);
633-
return m_rows[uint32(m_rowPosition) * m_fieldCount + index];
636+
ASSERT(index < std::size_t(m_fieldCount));
637+
return m_rows[std::size_t(m_rowPosition) * m_fieldCount + index];
638+
}
639+
640+
QueryResultFieldMetadata const& PreparedResultSet::GetFieldMetadata(std::size_t index) const
641+
{
642+
ASSERT(index < std::size_t(m_fieldCount));
643+
return m_fieldMetadata[index];
634644
}
635645

636646
void PreparedResultSet::CleanUp()

src/server/database/Database/QueryResult.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class TC_DATABASE_API ResultSet
3535
Field* Fetch() const { return _currentRow; }
3636
Field const& operator[](std::size_t index) const;
3737

38+
QueryResultFieldMetadata const& GetFieldMetadata(std::size_t index) const;
39+
3840
protected:
3941
std::vector<QueryResultFieldMetadata> _fieldMetadata;
4042
uint64 _rowCount;
@@ -63,6 +65,8 @@ class TC_DATABASE_API PreparedResultSet
6365
Field* Fetch() const;
6466
Field const& operator[](std::size_t index) const;
6567

68+
QueryResultFieldMetadata const& GetFieldMetadata(std::size_t index) const;
69+
6670
protected:
6771
std::vector<QueryResultFieldMetadata> m_fieldMetadata;
6872
std::vector<Field> m_rows;

src/server/game/Entities/Creature/GossipDef.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#include "GossipDef.h"
1919
#include "Log.h"
20+
#include "NPCPackets.h"
2021
#include "ObjectMgr.h"
2122
#include "Player.h"
2223
#include "QuestDef.h"
@@ -259,28 +260,27 @@ void PlayerMenu::SendCloseGossip()
259260

260261
void PlayerMenu::SendPointOfInterest(uint32 id) const
261262
{
262-
PointOfInterest const* poi = sObjectMgr->GetPointOfInterest(id);
263-
if (!poi)
263+
PointOfInterest const* pointOfInterest = sObjectMgr->GetPointOfInterest(id);
264+
if (!pointOfInterest)
264265
{
265266
TC_LOG_ERROR("sql.sql", "Request to send non-existing POI (Id: {}), ignored.", id);
266267
return;
267268
}
268269

269-
std::string name = poi->Name;
270+
WorldPackets::NPC::GossipPOI packet;
271+
packet.Name = pointOfInterest->Name;
272+
270273
LocaleConstant localeConstant = _session->GetSessionDbLocaleIndex();
271274
if (localeConstant != LOCALE_enUS)
272275
if (PointOfInterestLocale const* localeData = sObjectMgr->GetPointOfInterestLocale(id))
273-
ObjectMgr::GetLocaleString(localeData->Name, localeConstant, name);
276+
ObjectMgr::GetLocaleString(localeData->Name, localeConstant, packet.Name);
274277

275-
WorldPacket data(SMSG_GOSSIP_POI, 4 + 4 + 4 + 4 + 4 + 10); // guess size
276-
data << uint32(poi->Flags);
277-
data << float(poi->PositionX);
278-
data << float(poi->PositionY);
279-
data << uint32(poi->Icon);
280-
data << uint32(poi->Importance);
281-
data << name;
278+
packet.Flags = pointOfInterest->Flags;
279+
packet.Pos.Pos.Relocate(pointOfInterest->PositionX, pointOfInterest->PositionY);
280+
packet.Icon = pointOfInterest->Icon;
281+
packet.Importance = pointOfInterest->Importance;
282282

283-
_session->SendPacket(&data);
283+
_session->SendPacket(packet.Write());
284284
}
285285

286286
/*********************************************************/

src/server/game/Entities/Object/ObjectGuid.cpp

Lines changed: 70 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,76 @@
1717

1818
#include "ObjectGuid.h"
1919
#include "ByteBuffer.h"
20+
#include "Errors.h"
2021
#include "Log.h"
22+
#include "Util.h"
2123
#include "World.h"
22-
#include <sstream>
23-
#include <iomanip>
24+
#include <charconv>
2425

2526
ObjectGuid const ObjectGuid::Empty = ObjectGuid();
2627

27-
char const* ObjectGuid::GetTypeName(HighGuid high)
28+
namespace
29+
{
30+
struct ObjectGuidInfo
31+
{
32+
struct FormatPadding { std::ptrdiff_t Value; constexpr operator std::ptrdiff_t() const { return Value; } };
33+
34+
template <std::ptrdiff_t Width>
35+
static constexpr inline FormatPadding padding{ .Value = Width };
36+
static constexpr inline FormatPadding no_padding{ .Value = 0 };
37+
38+
struct FormatBase { int32 Value; constexpr operator int32() const { return Value; } };
39+
40+
static constexpr inline FormatBase dec{ 10 };
41+
static constexpr inline FormatBase hex{ 16 };
42+
43+
static fmt::appender AppendTypeName(fmt::format_context& ctx, std::string_view type)
44+
{
45+
return std::copy(type.begin(), type.end(), ctx.out());
46+
}
47+
48+
template <FormatPadding Width, FormatBase Base>
49+
static fmt::appender AppendComponent(fmt::format_context& ctx, uint64 component)
50+
{
51+
std::array<char, 20> buf;
52+
auto [end, err] = std::to_chars(buf.data(), buf.data() + buf.size(), component, Base);
53+
54+
ASSERT(err == std::errc(), "Failed to convert guid part to string");
55+
56+
if constexpr (Width != 0)
57+
{
58+
if (std::distance(buf.data(), end) < Width)
59+
std::fill_n(ctx.out(), Width - std::distance(buf.data(), end), '0');
60+
}
61+
62+
if constexpr (Base > 10)
63+
return std::transform(buf.data(), end, ctx.out(), charToUpper);
64+
else
65+
return std::copy(buf.data(), end, ctx.out());
66+
}
67+
};
68+
}
69+
70+
template <typename FormatContext>
71+
auto fmt::formatter<ObjectGuid>::format(ObjectGuid const& guid, FormatContext& ctx) const -> decltype(ctx.out())
72+
{
73+
ctx.advance_to(ObjectGuidInfo::AppendTypeName(ctx, "GUID Full: 0x"));
74+
ctx.advance_to(ObjectGuidInfo::AppendComponent<ObjectGuidInfo::padding<16>, ObjectGuidInfo::hex>(ctx, guid.GetRawValue()));
75+
ctx.advance_to(ObjectGuidInfo::AppendTypeName(ctx, " Type: "));
76+
ctx.advance_to(ObjectGuidInfo::AppendTypeName(ctx, guid.GetTypeName()));
77+
if (uint32 entry = guid.GetEntry())
78+
{
79+
ctx.advance_to(ObjectGuidInfo::AppendTypeName(ctx, guid.IsPet() ? " Pet number: " : " Entry: "));
80+
ctx.advance_to(ObjectGuidInfo::AppendComponent<ObjectGuidInfo::no_padding, ObjectGuidInfo::dec>(ctx, entry));
81+
}
82+
ctx.advance_to(ObjectGuidInfo::AppendTypeName(ctx, " Low: "));
83+
ctx.advance_to(ObjectGuidInfo::AppendComponent<ObjectGuidInfo::no_padding, ObjectGuidInfo::dec>(ctx, guid.GetCounter()));
84+
return ctx.out();
85+
}
86+
87+
template TC_GAME_API fmt::appender fmt::formatter<ObjectGuid>::format<fmt::format_context>(ObjectGuid const&, format_context&) const;
88+
89+
std::string_view ObjectGuid::GetTypeName(HighGuid high)
2890
{
2991
switch (high)
3092
{
@@ -47,14 +109,12 @@ char const* ObjectGuid::GetTypeName(HighGuid high)
47109

48110
std::string ObjectGuid::ToString() const
49111
{
50-
std::ostringstream str;
51-
str << "GUID Full: 0x" << std::hex << std::setw(16) << std::setfill('0') << _guid << std::dec;
52-
str << " Type: " << GetTypeName();
53-
if (HasEntry())
54-
str << (IsPet() ? " Pet number: " : " Entry: ") << GetEntry() << " ";
112+
return Trinity::StringFormat("{}", *this);
113+
}
55114

56-
str << " Low: " << GetCounter();
57-
return str.str();
115+
std::string ObjectGuid::ToHexString() const
116+
{
117+
return Trinity::StringFormat("0x{:016X}", _guid);
58118
}
59119

60120
ObjectGuid ObjectGuid::Global(HighGuid type, LowType counter)

0 commit comments

Comments
 (0)