Skip to content

Commit

Permalink
all
Browse files Browse the repository at this point in the history
  • Loading branch information
Winfidonarleyan committed Feb 7, 2022
1 parent c9c49d7 commit c2bbef5
Show file tree
Hide file tree
Showing 130 changed files with 3,318 additions and 2,378 deletions.
41 changes: 21 additions & 20 deletions apps/Fmt/FormatReplace.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ def islog(line):
else :
return False

# def isSendSysMessage(line):
# substring = 'SendSysMessage'
# if substring in line:
# return True
# else :
# return False
def isSendSysMessage(line):
substring = 'SendSysMessage'
if substring in line:
return True
else :
return False

# def isPSendSysMessage(line):
# substring = 'PSendSysMessage'
# if substring in line:
# return True
# else :
# return False
def isPSendSysMessage(line):
substring = 'PSendSysMessage'
if substring in line:
return True
else :
return False

def isPQuery(line):
substring = 'PQuery'
Expand Down Expand Up @@ -92,10 +92,10 @@ def checkSoloLine(line):
elif isPAppend(line):
line = line.replace("PAppend", "Append");
return handleCleanup(line), False
# elif isSendSysMessage(line):
# return handleCleanup(line), False
# elif isPSendSysMessage(line):
# return handleCleanup(line), False
elif isSendSysMessage(line):
return handleCleanup(line), False
elif isPSendSysMessage(line):
return handleCleanup(line), False
# elif isStringFormat(line):
# return handleCleanup(line), False
else:
Expand All @@ -109,10 +109,10 @@ def startMultiLine(line):
return handleCleanup(line), True
elif islog(line):
return handleCleanup(line), True
# elif isSendSysMessage(line):
# return handleCleanup(line), True
# elif isPSendSysMessage(line):
# return handleCleanup(line), True
elif isSendSysMessage(line):
return handleCleanup(line), True
elif isPSendSysMessage(line):
return handleCleanup(line), True
elif isPQuery(line):
line = line.replace("PQuery", "Query");
return handleCleanup(line), True
Expand Down Expand Up @@ -144,6 +144,7 @@ def checkTextLine(line, existPrevLine):
def handleCleanup(line):
line = line.replace("%s", "{}");
line = line.replace("%u", "{}");
line = line.replace("%7u", "{:7}");
line = line.replace("%hu", "{}");
line = line.replace("%lu", "{}");
line = line.replace("%llu", "{}");
Expand Down
2 changes: 0 additions & 2 deletions src/common/Define.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@
#define UI64LIT(N) UINT64_C(N)
#define SI64LIT(N) INT64_C(N)

#define STRING_VIEW_FMT_ARG(str) static_cast<int>((str).length()), (str).data()

typedef std::int64_t int64;
typedef std::int32_t int32;
typedef std::int16_t int16;
Expand Down
3 changes: 2 additions & 1 deletion src/server/game/AI/SmartScripts/SmartScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "SmartAI.h"
#include "SpellMgr.h"
#include "Vehicle.h"
#include "GameLocale.h"

SmartScript::SmartScript()
{
Expand Down Expand Up @@ -3092,7 +3093,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
case SMART_ACTION_PLAYER_TALK:
{
ObjectList* targets = GetTargets(e, unit);
char const* text = sObjectMgr->GetAcoreString(e.action.playerTalk.textId, DEFAULT_LOCALE);
char const* text = sGameLocale->GetAcoreString(e.action.playerTalk.textId, DEFAULT_LOCALE);

if (targets)
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
Expand Down
47 changes: 4 additions & 43 deletions src/server/game/Achievements/AchievementMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "DatabaseEnv.h"
#include "DisableMgr.h"
#include "GameEventMgr.h"
#include "GameLocale.h"
#include "GameTime.h"
#include "GridNotifiersImpl.h"
#include "Guild.h"
Expand Down Expand Up @@ -2262,10 +2263,10 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
LocaleConstant localeConstant = GetPlayer()->GetSession()->GetSessionDbLocaleIndex();
if (localeConstant != LOCALE_enUS)
{
if(AchievementRewardLocale const* loc = sAchievementMgr->GetAchievementRewardLocale(achievement))
if (AchievementRewardLocale const* loc = sGameLocale->GetAchievementRewardLocale(achievement->ID))
{
ObjectMgr::GetLocaleString(loc->Subject, localeConstant, subject);
ObjectMgr::GetLocaleString(loc->Text, localeConstant, text);
GameLocale::GetLocaleString(loc->Subject, localeConstant, subject);
GameLocale::GetLocaleString(loc->Text, localeConstant, text);
}
}

Expand Down Expand Up @@ -2928,46 +2929,6 @@ void AchievementGlobalMgr::LoadRewards()
LOG_INFO("server.loading", " ");
}

void AchievementGlobalMgr::LoadRewardLocales()
{
uint32 oldMSTime = getMSTime();

m_achievementRewardLocales.clear(); // need for reload case

// 0 1 2 3
QueryResult result = WorldDatabase.Query("SELECT ID, Locale, Subject, Text FROM achievement_reward_locale");

if (!result)
{
LOG_INFO("server.loading", ">> Loaded 0 achievement reward locale strings. DB table `achievement_reward_locale` is empty");
LOG_INFO("server.loading", " ");
return;
}

do
{
Field* fields = result->Fetch();

uint32 ID = fields[0].Get<uint32>();
if (m_achievementRewards.find(ID) == m_achievementRewards.end())
{
LOG_ERROR("sql.sql", "Table `achievement_reward_locale` (Entry: {}) has locale strings for non-existing achievement reward.", ID);
continue;
}

LocaleConstant locale = GetLocaleByName(fields[1].Get<std::string>());
if (locale == LOCALE_enUS)
continue;

AchievementRewardLocale& data = m_achievementRewardLocales[ID];
ObjectMgr::AddLocaleString(fields[2].Get<std::string>(), locale, data.Subject);
ObjectMgr::AddLocaleString(fields[3].Get<std::string>(), locale, data.Text);
} while (result->NextRow());

LOG_INFO("server.loading", ">> Loaded {} Achievement Reward Locale strings in {} ms", (unsigned long)m_achievementRewardLocales.size(), GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server.loading", " ");
}

AchievementEntry const* AchievementGlobalMgr::GetAchievement(uint32 achievementId) const
{
return sAchievementStore.LookupEntry(achievementId);
Expand Down
15 changes: 0 additions & 15 deletions src/server/game/Achievements/AchievementMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,6 @@ struct AchievementReward

typedef std::map<uint32, AchievementReward> AchievementRewards;

struct AchievementRewardLocale
{
std::vector<std::string> Subject;
std::vector<std::string> Text;
};

typedef std::map<uint32, AchievementRewardLocale> AchievementRewardLocales;

struct CompletedAchievementData
{
Expand Down Expand Up @@ -365,12 +358,6 @@ class AchievementGlobalMgr
return iter != m_achievementRewards.end() ? &iter->second : nullptr;
}

AchievementRewardLocale const* GetAchievementRewardLocale(AchievementEntry const* achievement) const
{
AchievementRewardLocales::const_iterator iter = m_achievementRewardLocales.find(achievement->ID);
return iter != m_achievementRewardLocales.end() ? &iter->second : nullptr;
}

AchievementCriteriaDataSet const* GetCriteriaDataSet(AchievementCriteriaEntry const* achievementCriteria) const
{
AchievementCriteriaDataMap::const_iterator iter = m_criteriaDataMap.find(achievementCriteria->ID);
Expand All @@ -385,7 +372,6 @@ class AchievementGlobalMgr
void LoadAchievementReferenceList();
void LoadCompletedAchievements();
void LoadRewards();
void LoadRewardLocales();

[[nodiscard]] AchievementEntry const* GetAchievement(uint32 achievementId) const;

Expand All @@ -404,7 +390,6 @@ class AchievementGlobalMgr
AllCompletedAchievements m_allCompletedAchievements;

AchievementRewards m_achievementRewards;
AchievementRewardLocales m_achievementRewardLocales;

// pussywizard:
std::map<uint32, AchievementCriteriaEntryList> m_SpecialList[ACHIEVEMENT_CRITERIA_TYPE_TOTAL];
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/ArenaSpectator/ArenaSpectator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ bool ArenaSpectator::HandleSpectatorSpectateCommand(ChatHandler* handler, std::s
{
handler->PSendSysMessage("To spectate, please fix the following:");
for (std::list<std::string>::const_iterator itr = errors.begin(); itr != errors.end(); ++itr)
handler->PSendSysMessage("- %s", (*itr).c_str());
handler->PSendSysMessage("- {}", (*itr));

return true;
}
Expand Down
17 changes: 9 additions & 8 deletions src/server/game/AuctionHouse/AuctionHouseMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,22 @@
#include "DatabaseEnv.h"
#include "GameTime.h"
#include "Item.h"
#include "Logging/Log.h"
#include "Log.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "UpdateTime.h"
#include "World.h"
#include "WorldPacket.h"
#include "GameLocale.h"
#include <vector>

constexpr auto AH_MINIMUM_DEPOSIT = 100;

// Proof of concept, we should shift the info we're obtaining in here into AuctionEntry probably
static bool SortAuction(AuctionEntry* left, AuctionEntry* right, AuctionSortOrderVector& sortOrder, Player* player, bool checkMinBidBuyout)
{
for (auto thisOrder : sortOrder)
for (auto const& thisOrder : sortOrder)
{
switch (thisOrder.sortOrder)
{
Expand Down Expand Up @@ -99,14 +100,14 @@ static bool SortAuction(AuctionEntry* left, AuctionEntry* right, AuctionSortOrde

if (locale > LOCALE_enUS)
{
if (ItemLocale const* leftIl = sObjectMgr->GetItemLocale(protoLeft->ItemId))
if (ItemLocale const* leftIl = sGameLocale->GetItemLocale(protoLeft->ItemId))
{
ObjectMgr::GetLocaleString(leftIl->Name, locale, leftName);
GameLocale::GetLocaleString(leftIl->Name, locale, leftName);
}

if (ItemLocale const* rightIl = sObjectMgr->GetItemLocale(protoRight->ItemId))
if (ItemLocale const* rightIl = sGameLocale->GetItemLocale(protoRight->ItemId))
{
ObjectMgr::GetLocaleString(rightIl->Name, locale, rightName);
GameLocale::GetLocaleString(rightIl->Name, locale, rightName);
}
}

Expand Down Expand Up @@ -831,8 +832,8 @@ bool AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player

// local name
if (loc_idx >= 0)
if (ItemLocale const* il = sObjectMgr->GetItemLocale(proto->ItemId))
ObjectMgr::GetLocaleString(il->Name, loc_idx, name);
if (ItemLocale const* il = sGameLocale->GetItemLocale(proto->ItemId))
GameLocale::GetLocaleString(il->Name, loc_idx, name);

// DO NOT use GetItemEnchantMod(proto->RandomProperty) as it may return a result
// that matches the search but it may not equal item->GetItemRandomPropertyId()
Expand Down
Loading

0 comments on commit c2bbef5

Please sign in to comment.