Rebase resync

This commit is contained in:
Antz 2020-02-17 09:19:44 +00:00
parent a0797532e8
commit 1997c1e903
3106 changed files with 11118 additions and 627576 deletions

View file

@ -1,4 +1,4 @@
/*
/**
* This code is part of MaNGOS. Contributor & Copyright details are in AUTHORS/THANKS.
*
* This program is free software; you can redistribute it and/or modify
@ -305,12 +305,13 @@ bool ChatHandler::HandleReloadAllScriptsCommand(char* /*args*/)
}
sLog.outString("Re-Loading Scripts...");
HandleReloadGameObjectScriptsCommand((char*)"a");
HandleReloadGossipScriptsCommand((char*)"a");
HandleReloadEventScriptsCommand((char*)"a");
HandleReloadQuestEndScriptsCommand((char*)"a");
HandleReloadQuestStartScriptsCommand((char*)"a");
HandleReloadSpellScriptsCommand((char*)"a");
HandleReloadDBScriptsOnCreatureDeathCommand((char*)"a");
HandleReloadDBScriptsOnGoUseCommand((char*)"a");
HandleReloadDBScriptsOnGossipCommand((char*)"a");
HandleReloadDBScriptsOnEventCommand((char*)"a");
HandleReloadDBScriptsOnQuestEndCommand((char*)"a");
HandleReloadDBScriptsOnQuestStartCommand((char*)"a");
HandleReloadDBScriptsOnSpellCommand((char*)"a");
SendGlobalSysMessage("DB tables `*_scripts` reloaded.");
HandleReloadDbScriptStringCommand((char*)"a");
return true;
@ -345,7 +346,7 @@ bool ChatHandler::HandleReloadAllSpellCommand(char* /*args*/)
bool ChatHandler::HandleReloadAllGossipsCommand(char* args)
{
if (*args != 'a') // already reload from all_scripts
HandleReloadGossipScriptsCommand((char*)"a");
HandleReloadDBScriptsOnGossipCommand((char*)"a");
HandleReloadGossipMenuCommand((char*)"a");
HandleReloadNpcGossipCommand((char*)"a");
HandleReloadPointsOfInterestCommand((char*)"a");
@ -454,26 +455,6 @@ bool ChatHandler::HandleReloadGossipMenuCommand(char* /*args*/)
return true;
}
bool ChatHandler::HandleReloadGossipScriptsCommand(char* args)
{
if (sScriptMgr.IsScriptScheduled())
{
SendSysMessage("DB scripts used currently, please attempt reload later.");
SetSentErrorMessage(true);
return false;
}
if (*args != 'a')
sLog.outString("Re-Loading Scripts from `gossip_scripts`...");
sScriptMgr.LoadGossipScripts();
if (*args != 'a')
SendGlobalSysMessage("DB table `gossip_scripts` reloaded.");
return true;
}
bool ChatHandler::HandleReloadGOQuestRelationsCommand(char* /*args*/)
{
sLog.outString("Loading Quests Relations... (`gameobject_questrelation`)");
@ -867,50 +848,8 @@ bool ChatHandler::HandleReloadBattleEventCommand(char* /*args*/)
return true;
}
bool ChatHandler::HandleReloadGameObjectScriptsCommand(char* args)
{
if (sScriptMgr.IsScriptScheduled())
{
SendSysMessage("DB scripts used currently, please attempt reload later.");
SetSentErrorMessage(true);
return false;
}
if (*args != 'a')
sLog.outString("Re-Loading Scripts from `gameobject_[template]_scripts`...");
sScriptMgr.LoadGameObjectScripts();
sScriptMgr.LoadGameObjectTemplateScripts();
if (*args != 'a')
SendGlobalSysMessage("DB table `gameobject_[template]_scripts` reloaded.");
return true;
}
bool ChatHandler::HandleReloadEventScriptsCommand(char* args)
{
if (sScriptMgr.IsScriptScheduled())
{
SendSysMessage("DB scripts used currently, please attempt reload later.");
SetSentErrorMessage(true);
return false;
}
if (*args != 'a')
sLog.outString("Re-Loading Scripts from `event_scripts`...");
sScriptMgr.LoadEventScripts();
if (*args != 'a')
SendGlobalSysMessage("DB table `event_scripts` reloaded.");
return true;
}
bool ChatHandler::HandleReloadEventAITextsCommand(char* /*args*/)
{
sLog.outString("Re-Loading Texts from `creature_ai_texts`...");
sEventAIMgr.LoadCreatureEventAI_Texts(true);
SendGlobalSysMessage("DB table `creature_ai_texts` reloaded.");
@ -933,66 +872,6 @@ bool ChatHandler::HandleReloadEventAIScriptsCommand(char* /*args*/)
return true;
}
bool ChatHandler::HandleReloadQuestEndScriptsCommand(char* args)
{
if (sScriptMgr.IsScriptScheduled())
{
SendSysMessage("DB scripts used currently, please attempt reload later.");
SetSentErrorMessage(true);
return false;
}
if (*args != 'a')
sLog.outString("Re-Loading Scripts from `quest_end_scripts`...");
sScriptMgr.LoadQuestEndScripts();
if (*args != 'a')
SendGlobalSysMessage("DB table `quest_end_scripts` reloaded.");
return true;
}
bool ChatHandler::HandleReloadQuestStartScriptsCommand(char* args)
{
if (sScriptMgr.IsScriptScheduled())
{
SendSysMessage("DB scripts used currently, please attempt reload later.");
SetSentErrorMessage(true);
return false;
}
if (*args != 'a')
sLog.outString("Re-Loading Scripts from `quest_start_scripts`...");
sScriptMgr.LoadQuestStartScripts();
if (*args != 'a')
SendGlobalSysMessage("DB table `quest_start_scripts` reloaded.");
return true;
}
bool ChatHandler::HandleReloadSpellScriptsCommand(char* args)
{
if (sScriptMgr.IsScriptScheduled())
{
SendSysMessage("DB scripts used currently, please attempt reload later.");
SetSentErrorMessage(true);
return false;
}
if (*args != 'a')
sLog.outString("Re-Loading Scripts from `spell_scripts`...");
sScriptMgr.LoadSpellScripts();
if (*args != 'a')
SendGlobalSysMessage("DB table `spell_scripts` reloaded.");
return true;
}
bool ChatHandler::HandleReloadDbScriptStringCommand(char* /*args*/)
{
sLog.outString("Re-Loading Script strings from `db_script_string`...");
@ -1001,6 +880,147 @@ bool ChatHandler::HandleReloadDbScriptStringCommand(char* /*args*/)
return true;
}
bool ChatHandler::HandleReloadDBScriptsOnGossipCommand(char* args)
{
if (sScriptMgr.IsScriptScheduled())
{
SendSysMessage("DB scripts used currently, please attempt reload later.");
SetSentErrorMessage(true);
return false;
}
if (*args != 'a')
sLog.outString("Re-Loading Scripts from `dbscripts_on_gossip`...");
sScriptMgr.LoadGossipScripts();
if (*args != 'a')
SendGlobalSysMessage("DB table `dbscripts_on_gossip` reloaded.");
return true;
}
bool ChatHandler::HandleReloadDBScriptsOnSpellCommand(char* args)
{
if (sScriptMgr.IsScriptScheduled())
{
SendSysMessage("DB scripts used currently, please attempt reload later.");
SetSentErrorMessage(true);
return false;
}
if (*args != 'a')
sLog.outString("Re-Loading Scripts from `dbscripts_on_spell`...");
sScriptMgr.LoadSpellScripts();
if (*args != 'a')
SendGlobalSysMessage("DB table `dbscripts_on_spell` reloaded.");
return true;
}
bool ChatHandler::HandleReloadDBScriptsOnQuestStartCommand(char* args)
{
if (sScriptMgr.IsScriptScheduled())
{
SendSysMessage("DB scripts used currently, please attempt reload later.");
SetSentErrorMessage(true);
return false;
}
if (*args != 'a')
sLog.outString("Re-Loading Scripts from `dbscripts_on_quest_start`...");
sScriptMgr.LoadQuestStartScripts();
if (*args != 'a')
SendGlobalSysMessage("DB table `dbscripts_on_quest_start` reloaded.");
return true;
}
bool ChatHandler::HandleReloadDBScriptsOnQuestEndCommand(char* args)
{
if (sScriptMgr.IsScriptScheduled())
{
SendSysMessage("DB scripts used currently, please attempt reload later.");
SetSentErrorMessage(true);
return false;
}
if (*args != 'a')
sLog.outString("Re-Loading Scripts from `dbscripts_on_quest_end`...");
sScriptMgr.LoadQuestEndScripts();
if (*args != 'a')
SendGlobalSysMessage("DB table `dbscripts_on_quest_end` reloaded.");
return true;
}
bool ChatHandler::HandleReloadDBScriptsOnEventCommand(char* args)
{
if (sScriptMgr.IsScriptScheduled())
{
SendSysMessage("DB scripts used currently, please attempt reload later.");
SetSentErrorMessage(true);
return false;
}
if (*args != 'a')
sLog.outString("Re-Loading Scripts from `dbscripts_on_event`...");
sScriptMgr.LoadEventScripts();
if (*args != 'a')
SendGlobalSysMessage("DB table `dbscripts_on_event` reloaded.");
return true;
}
bool ChatHandler::HandleReloadDBScriptsOnGoUseCommand(char* args)
{
if (sScriptMgr.IsScriptScheduled())
{
SendSysMessage("DB scripts used currently, please attempt reload later.");
SetSentErrorMessage(true);
return false;
}
if (*args != 'a')
sLog.outString("Re-Loading Scripts from `dbscripts_on_go[_template]_use`...");
sScriptMgr.LoadGameObjectScripts();
sScriptMgr.LoadGameObjectTemplateScripts();
if (*args != 'a')
SendGlobalSysMessage("DB table `dbscripts_on_go[_template]_use` reloaded.");
return true;
}
bool ChatHandler::HandleReloadDBScriptsOnCreatureDeathCommand(char* args)
{
if (sScriptMgr.IsScriptScheduled())
{
SendSysMessage("DB scripts used currently, please attempt reload later.");
SetSentErrorMessage(true);
return false;
}
if (*args != 'a')
sLog.outString("Re-Loading Scripts from `dbscripts_on_creature_death`...");
sScriptMgr.LoadCreatureDeathScripts();
if (*args != 'a')
SendGlobalSysMessage("DB table `dbscripts_on_creature_death` reloaded.");
return true;
}
bool ChatHandler::HandleReloadGameGraveyardZoneCommand(char* /*args*/)
{
sLog.outString("Re-Loading Graveyard-zone links...");
@ -1143,7 +1163,6 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(char* args)
return false;
int32 gm;
uint32 gmRealmID = realmID;
if (!ExtractInt32(&args, gm))
return false;
@ -1161,19 +1180,12 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(char* args)
/// account can't set security to same or grater level, need more power GM or console
AccountTypes plSecurity = GetAccessLevel();
if (AccountTypes(gm) >= plSecurity || (gmRealmID != realmID && plSecurity < SEC_CONSOLE))
if (AccountTypes(gm) >= plSecurity)
{
SendSysMessage(LANG_YOURS_SECURITY_IS_LOW);
SetSentErrorMessage(true);
return false;
}
/// check if provided realmID is not current realmID, or isn't -1
if (gmRealmID != realmID && gmRealmID != -1)
{
SendSysMessage(LANG_INVALID_REALMID);
SetSentErrorMessage(true);
return false;
}
if (targetPlayer)
{
@ -1182,19 +1194,7 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(char* args)
}
PSendSysMessage(LANG_YOU_CHANGE_SECURITY, targetAccountName.c_str(), gm);
//LoginDatabase.PExecute("UPDATE account_access SET gmlevel = '%i' WHERE id = '%u'", gm, targetAccountId);
/// If gmRealmID is -1, delete all values for the account id, else, insert values for the specific realmID
if (gmRealmID == -1)
{
LoginDatabase.PExecute("DELETE FROM account_access WHERE id = '%u'", targetAccountId);
LoginDatabase.PExecute("INSERT INTO account_access VALUES ('%u', '%d', -1)", targetAccountId, gm);
}
else
{
LoginDatabase.PExecute("DELETE FROM account_access WHERE id = '%u' AND RealmID = '%d'", targetAccountId, realmID);
LoginDatabase.PExecute("INSERT INTO account_access VALUES ('%u','%d','%d')", targetAccountId, gm, realmID);
}
LoginDatabase.PExecute("UPDATE account SET gmlevel = '%i' WHERE id = '%u'", gm, targetAccountId);
return true;
}
@ -1255,7 +1255,6 @@ bool ChatHandler::HandleAccountSetPasswordCommand(char* args)
return false;
}
void ChatHandler::ShowAchievementCriteriaListHelper(AchievementCriteriaEntry const* criEntry, AchievementEntry const* achEntry, LocaleConstant loc, Player* target /*= NULL*/)
{
std::ostringstream ss;
@ -2698,7 +2697,7 @@ bool ChatHandler::HandleAddItemSetCommand(char* args)
DETAIL_LOG(GetMangosString(LANG_ADDITEMSET), itemsetId);
bool found = false;
for (uint32 id = 0; id < sItemStorage.MaxEntry; ++id)
for (uint32 id = 0; id < sItemStorage.GetMaxEntry(); ++id)
{
ItemPrototype const* pProto = sItemStorage.LookupEntry<ItemPrototype>(id);
if (!pProto)
@ -3147,7 +3146,7 @@ bool ChatHandler::HandleLookupItemCommand(char* args)
uint32 counter = 0;
// Search in `item_template`
for (uint32 id = 0; id < sItemStorage.MaxEntry; ++id)
for (uint32 id = 0; id < sItemStorage.GetMaxEntry(); ++id)
{
ItemPrototype const* pProto = sItemStorage.LookupEntry<ItemPrototype >(id);
if (!pProto)
@ -3467,6 +3466,7 @@ bool ChatHandler::HandleLookupSpellCommand(char* args)
if (spellInfo)
{
int loc = GetSessionDbcLocale();
DEBUG_LOG("Spellid %u locale %u", id, loc);
std::string name = spellInfo->SpellName[loc];
if (name.empty())
continue;
@ -3500,7 +3500,6 @@ bool ChatHandler::HandleLookupSpellCommand(char* args)
return true;
}
void ChatHandler::ShowQuestListHelper(uint32 questId, int32 loc_idx, Player* target /*= NULL*/)
{
Quest const* qinfo = sObjectMgr.GetQuestTemplate(questId);
@ -3591,7 +3590,7 @@ bool ChatHandler::HandleLookupCreatureCommand(char* args)
uint32 counter = 0;
for (uint32 id = 0; id < sCreatureStorage.MaxEntry; ++id)
for (uint32 id = 0; id < sCreatureStorage.GetMaxEntry(); ++id)
{
CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo> (id);
if (!cInfo)
@ -3638,16 +3637,12 @@ bool ChatHandler::HandleLookupObjectCommand(char* args)
uint32 counter = 0;
for (uint32 id = 0; id < sGOStorage.MaxEntry; ++id)
for (SQLStorageBase::SQLSIterator<GameObjectInfo> itr = sGOStorage.getDataBegin<GameObjectInfo>(); itr < sGOStorage.getDataEnd<GameObjectInfo>(); ++itr)
{
GameObjectInfo const* gInfo = sGOStorage.LookupEntry<GameObjectInfo>(id);
if (!gInfo)
continue;
int loc_idx = GetSessionDbLocaleIndex();
if (loc_idx >= 0)
{
GameObjectLocale const* gl = sObjectMgr.GetGameObjectLocale(id);
GameObjectLocale const* gl = sObjectMgr.GetGameObjectLocale(itr->id);
if (gl)
{
if ((int32)gl->Name.size() > loc_idx && !gl->Name[loc_idx].empty())
@ -3657,9 +3652,9 @@ bool ChatHandler::HandleLookupObjectCommand(char* args)
if (Utf8FitTo(name, wnamepart))
{
if (m_session)
PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, id, id, name.c_str());
PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, itr->id, itr->id, name.c_str());
else
PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, id, name.c_str());
PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, itr->id, name.c_str());
++counter;
continue;
}
@ -3667,16 +3662,16 @@ bool ChatHandler::HandleLookupObjectCommand(char* args)
}
}
std::string name = gInfo->name;
std::string name = itr->name;
if (name.empty())
continue;
if (Utf8FitTo(name, wnamepart))
{
if (m_session)
PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, id, id, name.c_str());
PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, itr->id, itr->id, name.c_str());
else
PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, id, name.c_str());
PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, itr->id, name.c_str());
++counter;
}
}
@ -4122,9 +4117,8 @@ bool ChatHandler::HandleAuraCommand(char* args)
continue;
uint8 eff = spellEffect->Effect;
if (eff>=TOTAL_SPELL_EFFECTS)
if (eff >= TOTAL_SPELL_EFFECTS)
continue;
if (IsAreaAuraEffect(eff) ||
eff == SPELL_EFFECT_APPLY_AURA ||
eff == SPELL_EFFECT_PERSISTENT_AREA_AURA)
@ -4799,7 +4793,6 @@ bool ChatHandler::HandleAuctionItemCommand(char* args)
MANGOS_ASSERT(newItem);
auctionHouse->AddAuction(auctionHouseEntry, newItem, etime, price, buyout);
}
while (item_count);
@ -4840,7 +4833,7 @@ bool ChatHandler::HandleChangeWeatherCommand(char* args)
if (!ExtractUInt32(&args, type))
return false;
//0 to 3, 0: fine, 1: rain, 2: snow, 3: sand
// 0 to 3, 0: fine, 1: rain, 2: snow, 3: sand
if (type > 3)
return false;
@ -4848,7 +4841,7 @@ bool ChatHandler::HandleChangeWeatherCommand(char* args)
if (!ExtractFloat(&args, grade))
return false;
//0 to 1, sending -1 is instand good weather
// 0 to 1, sending -1 is instand good weather
if (grade < 0.0f || grade > 1.0f)
return false;
@ -5423,7 +5416,7 @@ bool ChatHandler::HandleQuestAddCommand(char* args)
}
// check item starting quest (it can work incorrectly if added without item in inventory)
for (uint32 id = 0; id < sItemStorage.MaxEntry; ++id)
for (uint32 id = 0; id < sItemStorage.GetMaxEntry(); ++id)
{
ItemPrototype const* pProto = sItemStorage.LookupEntry<ItemPrototype>(id);
if (!pProto)
@ -5581,6 +5574,15 @@ bool ChatHandler::HandleQuestCompleteCommand(char* args)
if (ReqOrRewMoney < 0)
player->ModifyMoney(-ReqOrRewMoney);
for (int i = 0; i < QUEST_REQUIRED_CURRENCY_COUNT; ++i)
{
if (pQuest->ReqCurrencyId[i])
player->ModifyCurrencyCount(pQuest->ReqCurrencyId[i], int32(pQuest->ReqCurrencyCount[i] * GetCurrencyPrecision(pQuest->ReqCurrencyId[i])));
}
if (uint32 spell = pQuest->GetReqSpellLearned())
player->learnSpell(spell, false);
player->CompleteQuest(entry);
return true;
}
@ -6700,7 +6702,7 @@ bool ChatHandler::HandleInstanceSaveDataCommand(char* /*args*/)
bool ChatHandler::HandleGMListFullCommand(char* /*args*/)
{
///- Get the accounts with GM Level >0
QueryResult* result = LoginDatabase.Query("SELECT a.username,aa.gmlevel FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE aa.gmlevel > 0");
QueryResult* result = LoginDatabase.Query("SELECT username,gmlevel FROM account WHERE gmlevel > 0");
if (result)
{
SendSysMessage(LANG_GMLIST);
@ -6781,7 +6783,6 @@ bool ChatHandler::ShowPlayerListHelper(QueryResult* result, uint32* limit, bool
PSendSysMessage(LANG_CHARACTERS_LIST_LINE_CONSOLE, guid, name.c_str(), race_name, class_name, level);
else
PSendSysMessage(LANG_CHARACTERS_LIST_LINE_CHAT, guid, name.c_str(), name.c_str(), race_name, class_name, level);
}
while (result->NextRow());