Skip to content

Commit

Permalink
Merge 3.3.5 to npcbots_3.3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Github Actions committed Jul 19, 2024
2 parents abb1be7 + 4e38582 commit 7ba462b
Show file tree
Hide file tree
Showing 26 changed files with 455 additions and 148 deletions.
12 changes: 12 additions & 0 deletions sql/updates/world/3.3.5/2024_07_13_00_world.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- Add missing furbolg camp area triggers for quest "How Big a Threat?"
SET @QUEST := 984;
DELETE FROM `areatrigger_involvedrelation` WHERE `quest` = @QUEST;
INSERT INTO `areatrigger_involvedrelation` (`id`, `quest`) VALUES
(231, @QUEST),
(232, @QUEST),
(233, @QUEST),
(234, @QUEST),
(235, @QUEST),
(236, @QUEST),
(237, @QUEST),
(238, @QUEST);
9 changes: 9 additions & 0 deletions sql/updates/world/3.3.5/2024_07_13_01_world.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--
UPDATE `creature_template_locale` SET `Name`="Balai Lok'Wein", `Title`="Tränke, Schriftrollen & Reagenzien", `VerifiedBuild`=0 WHERE `entry`=13476 AND `locale`='deDE';
UPDATE `creature_template_locale` SET `Name`="Balai Lok'Wein", `Title`="Pociones, pergaminos y componentes", `VerifiedBuild`=0 WHERE `entry`=13476 AND `locale`='esES';
UPDATE `creature_template_locale` SET `Name`="Balai Lok'Wein", `Title`="Pociones, pergaminos y componentes", `VerifiedBuild`=0 WHERE `entry`=13476 AND `locale`='esMX';
UPDATE `creature_template_locale` SET `Name`="Balai Lok'Wein", `Title`="Potions, Parchemins & Composants", `VerifiedBuild`=0 WHERE `entry`=13476 AND `locale`='frFR';
UPDATE `creature_template_locale` SET `Name`="발라이 로크웨인", `Title`="물약 및 마법용품 상인", `VerifiedBuild`=0 WHERE `entry`=13476 AND `locale`='koKR';
UPDATE `creature_template_locale` SET `Name`="Бала Лок'Вен", `Title`="Зелья, cвитки и pеагенты", `VerifiedBuild`=0 WHERE `entry`=13476 AND `locale`='ruRU';
UPDATE `creature_template_locale` SET `Name`="巴莱·洛克维", `Title`="药剂、卷轴和材料", `VerifiedBuild`=0 WHERE `entry`=13476 AND `locale`='zhCN';
UPDATE `creature_template_locale` SET `Name`="巴萊·洛克維", `Title`="药剂、卷轴和材料", `VerifiedBuild`=0 WHERE `entry`=13476 AND `locale`='zhTW';
14 changes: 14 additions & 0 deletions sql/updates/world/3.3.5/2024_07_15_00_world.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- Forgotten Depths Ambusher
SET @ENTRY := 30204;
-- Update auras
UPDATE `creature_template_addon` SET `auras`='42459 56422' WHERE `entry`=@ENTRY; -- Dual Wield, Nerubian Submerge
-- Update unit flags
UPDATE `creature_template` SET `unit_flags`=512 WHERE `entry`=@ENTRY;
-- Forgotten Depths Ambusher smart ai
UPDATE `creature_template` SET `AIName` = 'SmartAI', `ScriptName` = '' WHERE `entry` = @ENTRY;
DELETE FROM `smart_scripts` WHERE `source_type` = 0 AND `entryOrGuid` = @ENTRY;
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(@ENTRY, 0, 0, 1, 54, 0, 100, 1, 0, 0, 0, 0, 28, 56422, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "Forgotten Depths Ambusher - On just summoned - Remove 'Nerubian Submerge' aura (No Repeat)"),
(@ENTRY, 0, 1, 2, 61, 0, 100, 1, 0, 0, 0, 0, 11, 56418, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "Forgotten Depths Ambusher - On link - Cast spell 'Emerge From Snow' on Self (No Repeat)"),
(@ENTRY, 0, 2, 0, 61, 0, 100, 1, 0, 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, 21, 40, 0, 0, 0, 0, 0, 0, "Forgotten Depths Ambusher - On link - Attack start on closest player (No Repeat)"),
(@ENTRY, 0, 3, 0, 7, 0, 100, 1, 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "Forgotten Depths Ambusher - On evade - Despawn instantly (No Repeat)");
2 changes: 2 additions & 0 deletions sql/updates/world/3.3.5/2024_07_15_01_world.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Add Franklin the Friendly charm immunnity
UPDATE `creature_template` SET `mechanic_immune_mask`=`mechanic_immune_mask`|1 WHERE `entry`=14529;
100 changes: 58 additions & 42 deletions src/common/Utilities/Util.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,59 +229,75 @@ inline bool isEastAsianString(std::wstring_view wstr, bool numericOrSpace)
return true;
}

inline wchar_t wcharToUpper(wchar_t wchar)
struct WcharToUpper
{
if (wchar >= L'a' && wchar <= L'z') // LATIN SMALL LETTER A - LATIN SMALL LETTER Z
return wchar_t(uint16(wchar)-0x0020);
if (wchar == 0x00DF) // LATIN SMALL LETTER SHARP S
return wchar_t(0x1E9E);
if (wchar >= 0x00E0 && wchar <= 0x00F6) // LATIN SMALL LETTER A WITH GRAVE - LATIN SMALL LETTER O WITH DIAERESIS
return wchar_t(uint16(wchar)-0x0020);
if (wchar >= 0x00F8 && wchar <= 0x00FE) // LATIN SMALL LETTER O WITH STROKE - LATIN SMALL LETTER THORN
return wchar_t(uint16(wchar)-0x0020);
if (wchar >= 0x0101 && wchar <= 0x012F) // LATIN SMALL LETTER A WITH MACRON - LATIN SMALL LETTER I WITH OGONEK (only %2=1)
wchar_t operator()(wchar_t wchar) const
{
if (wchar % 2 == 1)
return wchar_t(uint16(wchar)-0x0001);
}
if (wchar >= 0x0430 && wchar <= 0x044F) // CYRILLIC SMALL LETTER A - CYRILLIC SMALL LETTER YA
return wchar_t(uint16(wchar)-0x0020);
if (wchar == 0x0451) // CYRILLIC SMALL LETTER IO
return wchar_t(0x0401);
if (wchar >= L'a' && wchar <= L'z') // LATIN SMALL LETTER A - LATIN SMALL LETTER Z
return wchar_t(uint16(wchar) - 0x0020);
if (wchar == 0x00DF) // LATIN SMALL LETTER SHARP S
return wchar_t(0x1E9E);
if (wchar >= 0x00E0 && wchar <= 0x00F6) // LATIN SMALL LETTER A WITH GRAVE - LATIN SMALL LETTER O WITH DIAERESIS
return wchar_t(uint16(wchar) - 0x0020);
if (wchar >= 0x00F8 && wchar <= 0x00FE) // LATIN SMALL LETTER O WITH STROKE - LATIN SMALL LETTER THORN
return wchar_t(uint16(wchar) - 0x0020);
if (wchar >= 0x0101 && wchar <= 0x012F) // LATIN SMALL LETTER A WITH MACRON - LATIN SMALL LETTER I WITH OGONEK (only %2=1)
{
if (wchar % 2 == 1)
return wchar_t(uint16(wchar) - 0x0001);
}
if (wchar >= 0x0430 && wchar <= 0x044F) // CYRILLIC SMALL LETTER A - CYRILLIC SMALL LETTER YA
return wchar_t(uint16(wchar) - 0x0020);
if (wchar == 0x0451) // CYRILLIC SMALL LETTER IO
return wchar_t(0x0401);

return wchar;
}
return wchar;
}
} inline constexpr wcharToUpper;

inline wchar_t wcharToUpperOnlyLatin(wchar_t wchar)
struct WcharToUpperOnlyLatin
{
return isBasicLatinCharacter(wchar) ? wcharToUpper(wchar) : wchar;
}
wchar_t operator()(wchar_t wchar) const
{
return isBasicLatinCharacter(wchar) ? wcharToUpper(wchar) : wchar;
}
} inline constexpr wcharToUpperOnlyLatin;

inline wchar_t wcharToLower(wchar_t wchar)
struct WcharToLower
{
if (wchar >= L'A' && wchar <= L'Z') // LATIN CAPITAL LETTER A - LATIN CAPITAL LETTER Z
return wchar_t(uint16(wchar)+0x0020);
if (wchar >= 0x00C0 && wchar <= 0x00D6) // LATIN CAPITAL LETTER A WITH GRAVE - LATIN CAPITAL LETTER O WITH DIAERESIS
return wchar_t(uint16(wchar)+0x0020);
if (wchar >= 0x00D8 && wchar <= 0x00DE) // LATIN CAPITAL LETTER O WITH STROKE - LATIN CAPITAL LETTER THORN
return wchar_t(uint16(wchar)+0x0020);
if (wchar >= 0x0100 && wchar <= 0x012E) // LATIN CAPITAL LETTER A WITH MACRON - LATIN CAPITAL LETTER I WITH OGONEK (only %2=0)
wchar_t operator()(wchar_t wchar) const
{
if (wchar % 2 == 0)
return wchar_t(uint16(wchar)+0x0001);
if (wchar >= L'A' && wchar <= L'Z') // LATIN CAPITAL LETTER A - LATIN CAPITAL LETTER Z
return wchar_t(uint16(wchar)+0x0020);
if (wchar >= 0x00C0 && wchar <= 0x00D6) // LATIN CAPITAL LETTER A WITH GRAVE - LATIN CAPITAL LETTER O WITH DIAERESIS
return wchar_t(uint16(wchar)+0x0020);
if (wchar >= 0x00D8 && wchar <= 0x00DE) // LATIN CAPITAL LETTER O WITH STROKE - LATIN CAPITAL LETTER THORN
return wchar_t(uint16(wchar)+0x0020);
if (wchar >= 0x0100 && wchar <= 0x012E) // LATIN CAPITAL LETTER A WITH MACRON - LATIN CAPITAL LETTER I WITH OGONEK (only %2=0)
{
if (wchar % 2 == 0)
return wchar_t(uint16(wchar)+0x0001);
}
if (wchar == 0x1E9E) // LATIN CAPITAL LETTER SHARP S
return wchar_t(0x00DF);
if (wchar == 0x0401) // CYRILLIC CAPITAL LETTER IO
return wchar_t(0x0451);
if (wchar >= 0x0410 && wchar <= 0x042F) // CYRILLIC CAPITAL LETTER A - CYRILLIC CAPITAL LETTER YA
return wchar_t(uint16(wchar)+0x0020);

return wchar;
}
if (wchar == 0x1E9E) // LATIN CAPITAL LETTER SHARP S
return wchar_t(0x00DF);
if (wchar == 0x0401) // CYRILLIC CAPITAL LETTER IO
return wchar_t(0x0451);
if (wchar >= 0x0410 && wchar <= 0x042F) // CYRILLIC CAPITAL LETTER A - CYRILLIC CAPITAL LETTER YA
return wchar_t(uint16(wchar)+0x0020);
} inline constexpr wcharToLower;

return wchar;
}
struct CharToUpper
{
char operator()(char c) const { return std::toupper(static_cast<unsigned char>(c)); }
} inline constexpr charToUpper;

inline char charToUpper(char c) { return std::toupper(c); }
inline char charToLower(char c) { return std::tolower(c); }
struct CharToLower
{
char operator()(char c) const { return std::tolower(static_cast<unsigned char>(c)); }
} inline constexpr charToLower;

TC_COMMON_API void wstrToUpper(std::wstring& str);
TC_COMMON_API void wstrToLower(std::wstring& str);
Expand Down
32 changes: 21 additions & 11 deletions src/server/database/Database/QueryResult.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,12 +486,12 @@ m_metadataResult(result)
return;
}

m_rows.resize(uint32(m_rowCount) * m_fieldCount);
m_rows.resize(std::size_t(m_rowCount) * m_fieldCount);
while (_NextRow())
{
for (uint32 fIndex = 0; fIndex < m_fieldCount; ++fIndex)
{
m_rows[uint32(m_rowPosition) * m_fieldCount + fIndex].SetMetadata(&m_fieldMetadata[fIndex]);
m_rows[std::size_t(m_rowPosition) * m_fieldCount + fIndex].SetMetadata(&m_fieldMetadata[fIndex]);

unsigned long buffer_length = m_rBind[fIndex].buffer_length;
unsigned long fetched_length = *m_rBind[fIndex].length;
Expand All @@ -518,7 +518,7 @@ m_metadataResult(result)
break;
}

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

Expand All @@ -527,7 +527,7 @@ m_metadataResult(result)
}
else
{
m_rows[uint32(m_rowPosition) * m_fieldCount + fIndex].SetValue(
m_rows[std::size_t(m_rowPosition) * m_fieldCount + fIndex].SetValue(
nullptr,
*m_rBind[fIndex].length);
}
Expand All @@ -552,12 +552,10 @@ PreparedResultSet::~PreparedResultSet()

bool ResultSet::NextRow()
{
MYSQL_ROW row;

if (!_result)
return false;

row = mysql_fetch_row(_result);
MYSQL_ROW row = mysql_fetch_row(_result);
if (!row)
{
CleanUp();
Expand Down Expand Up @@ -616,21 +614,33 @@ void ResultSet::CleanUp()

Field const& ResultSet::operator[](std::size_t index) const
{
ASSERT(index < _fieldCount);
ASSERT(index < std::size_t(_fieldCount));
return _currentRow[index];
}

QueryResultFieldMetadata const& ResultSet::GetFieldMetadata(std::size_t index) const
{
ASSERT(index < std::size_t(_fieldCount));
return _fieldMetadata[index];
}

Field* PreparedResultSet::Fetch() const
{
ASSERT(m_rowPosition < m_rowCount);
return const_cast<Field*>(&m_rows[uint32(m_rowPosition) * m_fieldCount]);
return const_cast<Field*>(&m_rows[std::size_t(m_rowPosition) * m_fieldCount]);
}

Field const& PreparedResultSet::operator[](std::size_t index) const
{
ASSERT(m_rowPosition < m_rowCount);
ASSERT(index < m_fieldCount);
return m_rows[uint32(m_rowPosition) * m_fieldCount + index];
ASSERT(index < std::size_t(m_fieldCount));
return m_rows[std::size_t(m_rowPosition) * m_fieldCount + index];
}

QueryResultFieldMetadata const& PreparedResultSet::GetFieldMetadata(std::size_t index) const
{
ASSERT(index < std::size_t(m_fieldCount));
return m_fieldMetadata[index];
}

void PreparedResultSet::CleanUp()
Expand Down
4 changes: 4 additions & 0 deletions src/server/database/Database/QueryResult.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class TC_DATABASE_API ResultSet
Field* Fetch() const { return _currentRow; }
Field const& operator[](std::size_t index) const;

QueryResultFieldMetadata const& GetFieldMetadata(std::size_t index) const;

protected:
std::vector<QueryResultFieldMetadata> _fieldMetadata;
uint64 _rowCount;
Expand Down Expand Up @@ -63,6 +65,8 @@ class TC_DATABASE_API PreparedResultSet
Field* Fetch() const;
Field const& operator[](std::size_t index) const;

QueryResultFieldMetadata const& GetFieldMetadata(std::size_t index) const;

protected:
std::vector<QueryResultFieldMetadata> m_fieldMetadata;
std::vector<Field> m_rows;
Expand Down
20 changes: 15 additions & 5 deletions src/server/game/DataStores/DBCStores.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -589,11 +589,12 @@ void LoadDBCStores(const std::string& dataPath)
if (sInfo->Effect[j] == SPELL_EFFECT_SEND_TAXI)
spellPaths.insert(sInfo->EffectMiscValue[j]);

sTaxiNodesMask.fill(0);
sOldContinentsNodesMask.fill(0);
sHordeTaxiNodesMask.fill(0);
sAllianceTaxiNodesMask.fill(0);
sDeathKnightTaxiNodesMask.fill(0);
// reinitialize internal storage for globals after loading TaxiNodes.db2
sTaxiNodesMask = {};
sOldContinentsNodesMask = {};
sHordeTaxiNodesMask = {};
sAllianceTaxiNodesMask = {};
sDeathKnightTaxiNodesMask = {};
for (TaxiNodesEntry const* node : sTaxiNodesStore)
{
TaxiPathSetBySource::const_iterator src_i = sTaxiPathSetBySource.find(node->ID);
Expand Down Expand Up @@ -985,3 +986,12 @@ EmotesTextSoundEntry const* FindTextSoundEmoteFor(uint32 emote, uint32 race, uin
auto itr = sEmotesTextSoundMap.find(EmotesTextSoundKey(emote, race, gender));
return itr != sEmotesTextSoundMap.end() ? itr->second : nullptr;
}

TaxiMask::TaxiMask()
{
if (sTaxiNodesStore.GetNumRows())
{
_data.resize((sTaxiNodesStore.GetNumRows() + (8 * sizeof(uint64) - 1)) / (8 * sizeof(uint64)) * (sizeof(uint64) / sizeof(value_type)), 0);
ASSERT((_data.size() % (8 / sizeof(value_type))) == 0, "TaxiMask byte size must be aligned to a multiple of uint64");
}
}
24 changes: 12 additions & 12 deletions src/server/game/Entities/Creature/GossipDef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "GossipDef.h"
#include "Log.h"
#include "NPCPackets.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "QuestDef.h"
Expand Down Expand Up @@ -259,28 +260,27 @@ void PlayerMenu::SendCloseGossip()

void PlayerMenu::SendPointOfInterest(uint32 id) const
{
PointOfInterest const* poi = sObjectMgr->GetPointOfInterest(id);
if (!poi)
PointOfInterest const* pointOfInterest = sObjectMgr->GetPointOfInterest(id);
if (!pointOfInterest)
{
TC_LOG_ERROR("sql.sql", "Request to send non-existing POI (Id: {}), ignored.", id);
return;
}

std::string name = poi->Name;
WorldPackets::NPC::GossipPOI packet;
packet.Name = pointOfInterest->Name;

LocaleConstant localeConstant = _session->GetSessionDbLocaleIndex();
if (localeConstant != LOCALE_enUS)
if (PointOfInterestLocale const* localeData = sObjectMgr->GetPointOfInterestLocale(id))
ObjectMgr::GetLocaleString(localeData->Name, localeConstant, name);
ObjectMgr::GetLocaleString(localeData->Name, localeConstant, packet.Name);

WorldPacket data(SMSG_GOSSIP_POI, 4 + 4 + 4 + 4 + 4 + 10); // guess size
data << uint32(poi->Flags);
data << float(poi->PositionX);
data << float(poi->PositionY);
data << uint32(poi->Icon);
data << uint32(poi->Importance);
data << name;
packet.Flags = pointOfInterest->Flags;
packet.Pos.Pos.Relocate(pointOfInterest->PositionX, pointOfInterest->PositionY);
packet.Icon = pointOfInterest->Icon;
packet.Importance = pointOfInterest->Importance;

_session->SendPacket(&data);
_session->SendPacket(packet.Write());
}

/*********************************************************/
Expand Down
Loading

0 comments on commit 7ba462b

Please sign in to comment.