aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp10
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.h1
-rwxr-xr-xsrc/server/game/Chat/Chat.cpp40
-rwxr-xr-xsrc/server/game/Chat/Chat.h24
-rwxr-xr-xsrc/server/game/Chat/Commands/Level1.cpp134
-rwxr-xr-xsrc/server/game/Chat/Commands/Level2.cpp260
-rwxr-xr-xsrc/server/game/Chat/Commands/Level3.cpp1054
-rwxr-xr-xsrc/server/game/Entities/Item/ItemPrototype.h5
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp59
-rwxr-xr-xsrc/server/game/Entities/Player/Player.h3
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp8
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.cpp177
-rwxr-xr-xsrc/server/game/Groups/Group.cpp124
-rw-r--r--src/server/game/Handlers/CharacterHandler.cpp12
-rwxr-xr-xsrc/server/game/Handlers/ItemHandler.cpp4
-rwxr-xr-xsrc/server/game/Handlers/LootHandler.cpp6
-rwxr-xr-xsrc/server/game/Loot/LootMgr.cpp71
-rwxr-xr-xsrc/server/game/Loot/LootMgr.h3
-rwxr-xr-xsrc/server/game/Scripting/ScriptLoader.cpp4
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuraEffects.cpp5
-rw-r--r--src/server/game/Warden/WardenCheckMgr.cpp8
-rw-r--r--src/server/scripts/Commands/CMakeLists.txt4
-rw-r--r--src/server/scripts/Commands/cs_guild.cpp199
-rw-r--r--src/server/scripts/Commands/cs_list.cpp6
-rw-r--r--src/server/scripts/Commands/cs_lookup.cpp1263
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp6
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp9
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp48
-rw-r--r--src/server/scripts/Spells/spell_dk.cpp4
-rw-r--r--src/server/scripts/Spells/spell_druid.cpp32
-rw-r--r--src/server/scripts/Spells/spell_quest.cpp23
-rwxr-xr-xsrc/server/shared/Cryptography/ARC4.cpp4
-rwxr-xr-xsrc/server/shared/Database/Implementation/CharacterDatabase.cpp6
33 files changed, 1908 insertions, 1708 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
index 2243734f642..c7751fc7383 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
@@ -32,7 +32,8 @@ npc_escortAI::npc_escortAI(Creature* creature) : ScriptedAI(creature),
m_bCanReturnToStart(false),
DespawnAtEnd(true),
DespawnAtFar(true),
- ScriptWP(false)
+ ScriptWP(false),
+ HasImmuneToNPCFlags(false)
{}
void npc_escortAI::AttackStart(Unit* who)
@@ -179,6 +180,8 @@ void npc_escortAI::EnterEvadeMode()
else
{
me->GetMotionMaster()->MoveTargetedHome();
+ if (HasImmuneToNPCFlags)
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
Reset();
}
}
@@ -462,6 +465,11 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false
//disable npcflags
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
+ if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC))
+ {
+ HasImmuneToNPCFlags = true;
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
+ }
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI started with " UI64FMTD " waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = " UI64FMTD "", uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID);
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
index 24d15f9079b..7a7fab014dc 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
@@ -120,6 +120,7 @@ struct npc_escortAI : public ScriptedAI
bool DespawnAtEnd;
bool DespawnAtFar;
bool ScriptWP;
+ bool HasImmuneToNPCFlags;
};
#endif
diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp
index 7a146e89505..562965145bf 100755
--- a/src/server/game/Chat/Chat.cpp
+++ b/src/server/game/Chat/Chat.cpp
@@ -112,44 +112,6 @@ ChatCommand* ChatHandler::getCommandTable()
{ NULL, 0, false, NULL, "", NULL }
};
- static ChatCommand guildCommandTable[] =
- {
- { "create", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleGuildCreateCommand>, "", NULL },
- { "delete", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleGuildDeleteCommand>, "", NULL },
- { "invite", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleGuildInviteCommand>, "", NULL },
- { "uninvite", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleGuildUninviteCommand>, "", NULL },
- { "rank", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleGuildRankCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand lookupPlayerCommandTable[] =
- {
- { "ip", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleLookupPlayerIpCommand>, "", NULL },
- { "account", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleLookupPlayerAccountCommand>, "", NULL },
- { "email", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleLookupPlayerEmailCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand lookupCommandTable[] =
- {
- { "area", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleLookupAreaCommand>, "", NULL },
- { "creature", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupCreatureCommand>, "", NULL },
- { "event", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleLookupEventCommand>, "", NULL },
- { "faction", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupFactionCommand>, "", NULL },
- { "item", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupItemCommand>, "", NULL },
- { "itemset", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupItemSetCommand>, "", NULL },
- { "object", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupObjectCommand>, "", NULL },
- { "quest", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupQuestCommand>, "", NULL },
- { "player", SEC_GAMEMASTER, true, NULL, "", lookupPlayerCommandTable },
- { "skill", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupSkillCommand>, "", NULL },
- { "spell", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupSpellCommand>, "", NULL },
- { "taxinode", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupTaxiNodeCommand>, "", NULL },
- { "tele", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleLookupTeleCommand>, "", NULL },
- { "title", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleLookupTitleCommand>, "", NULL },
- { "map", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupMapCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
static ChatCommand petCommandTable[] =
{
{ "create", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandleCreatePetCommand>, "", NULL },
@@ -213,9 +175,7 @@ ChatCommand* ChatHandler::getCommandTable()
static ChatCommand commandTable[] =
{
- { "lookup", SEC_ADMINISTRATOR, true, NULL, "", lookupCommandTable },
{ "pdump", SEC_ADMINISTRATOR, true, NULL, "", pdumpCommandTable },
- { "guild", SEC_ADMINISTRATOR, true, NULL, "", guildCommandTable },
{ "group", SEC_ADMINISTRATOR, false, NULL, "", groupCommandTable },
{ "channel", SEC_ADMINISTRATOR, true, NULL, "", channelCommandTable },
diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h
index bbe138b923d..77280e7ddef 100755
--- a/src/server/game/Chat/Chat.h
+++ b/src/server/game/Chat/Chat.h
@@ -157,30 +157,6 @@ class ChatHandler
bool HandleBindSightCommand(const char* args);
bool HandleUnbindSightCommand(const char* args);
- bool HandleGuildCreateCommand(const char* args);
- bool HandleGuildInviteCommand(const char* args);
- bool HandleGuildUninviteCommand(const char* args);
- bool HandleGuildRankCommand(const char* args);
- bool HandleGuildDeleteCommand(const char* args);
-
- bool HandleLookupAreaCommand(const char* args);
- bool HandleLookupCreatureCommand(const char* args);
- bool HandleLookupEventCommand(const char* args);
- bool HandleLookupFactionCommand(const char * args);
- bool HandleLookupItemCommand(const char * args);
- bool HandleLookupItemSetCommand(const char * args);
- bool HandleLookupObjectCommand(const char* args);
- bool HandleLookupPlayerIpCommand(const char* args);
- bool HandleLookupPlayerAccountCommand(const char* args);
- bool HandleLookupPlayerEmailCommand(const char* args);
- bool HandleLookupQuestCommand(const char* args);
- bool HandleLookupSkillCommand(const char* args);
- bool HandleLookupSpellCommand(const char* args);
- bool HandleLookupTaxiNodeCommand(const char * args);
- bool HandleLookupTeleCommand(const char * args);
- bool HandleLookupMapCommand(const char* args);
- bool HandleLookupTitleCommand(const char * args);
-
bool HandlePDumpLoadCommand(const char *args);
bool HandlePDumpWriteCommand(const char *args);
diff --git a/src/server/game/Chat/Commands/Level1.cpp b/src/server/game/Chat/Commands/Level1.cpp
index abbc59d0114..1cf3d5c9b4e 100755
--- a/src/server/game/Chat/Commands/Level1.cpp
+++ b/src/server/game/Chat/Commands/Level1.cpp
@@ -450,140 +450,6 @@ bool ChatHandler::HandleTaxiCheatCommand(const char* args)
return false;
}
-bool ChatHandler::HandleLookupAreaCommand(const char* args)
-{
- if (!*args)
- return false;
-
- std::string namepart = args;
- std::wstring wnamepart;
-
- if (!Utf8toWStr (namepart, wnamepart))
- return false;
-
- bool found = false;
- uint32 count = 0;
- uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
-
- // converting string that we try to find to lower case
- wstrToLower (wnamepart);
-
- // Search in AreaTable.dbc
- for (uint32 areaflag = 0; areaflag < sAreaStore.GetNumRows(); ++areaflag)
- {
- AreaTableEntry const* areaEntry = sAreaStore.LookupEntry(areaflag);
- if (areaEntry)
- {
- int loc = GetSessionDbcLocale();
- std::string name = areaEntry->area_name;
- if (name.empty())
- continue;
-
- if (!Utf8FitTo (name, wnamepart))
- {
- loc = 0;
- for (; loc < TOTAL_LOCALES; ++loc)
- {
- if (loc == GetSessionDbcLocale())
- continue;
-
- name = areaEntry->area_name;
- if (name.empty())
- continue;
-
- if (Utf8FitTo (name, wnamepart))
- break;
- }
- }
-
- if (loc < TOTAL_LOCALES)
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- // send area in "id - [name]" format
- std::ostringstream ss;
- if (m_session)
- ss << areaEntry->ID << " - |cffffffff|Harea:" << areaEntry->ID << "|h[" << name << ' ' << localeNames[loc]<< "]|h|r";
- else
- ss << areaEntry->ID << " - " << name << ' ' << localeNames[loc];
-
- SendSysMessage(ss.str().c_str());
-
- if (!found)
- found = true;
- }
- }
- }
-
- if (!found)
- SendSysMessage(LANG_COMMAND_NOAREAFOUND);
-
- return true;
-}
-
-//Find tele in game_tele order by name
-bool ChatHandler::HandleLookupTeleCommand(const char * args)
-{
- if (!*args)
- {
- SendSysMessage(LANG_COMMAND_TELE_PARAMETER);
- SetSentErrorMessage(true);
- return false;
- }
-
- char const* str = strtok((char*)args, " ");
- if (!str)
- return false;
-
- std::string namepart = str;
- std::wstring wnamepart;
-
- if (!Utf8toWStr(namepart, wnamepart))
- return false;
-
- // converting string that we try to find to lower case
- wstrToLower(wnamepart);
-
- std::ostringstream reply;
- uint32 count = 0;
- uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
- bool limitReached = false;
-
- GameTeleContainer const & teleMap = sObjectMgr->GetGameTeleMap();
- for (GameTeleContainer::const_iterator itr = teleMap.begin(); itr != teleMap.end(); ++itr)
- {
- GameTele const* tele = &itr->second;
-
- if (tele->wnameLow.find(wnamepart) == std::wstring::npos)
- continue;
-
- if (maxResults && count++ == maxResults)
- {
- limitReached = true;
- break;
- }
-
- if (m_session)
- reply << " |cffffffff|Htele:" << itr->first << "|h[" << tele->name << "]|h|r\n";
- else
- reply << " " << itr->first << ' ' << tele->name << "\n";
- }
-
- if (reply.str().empty())
- SendSysMessage(LANG_COMMAND_TELE_NOLOCATION);
- else
- PSendSysMessage(LANG_COMMAND_TELE_LOCATION, reply.str().c_str());
-
- if (limitReached)
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
-
- return true;
-}
-
//Enable\Dissable accept whispers (for GM)
bool ChatHandler::HandleWhispersCommand(const char* args)
{
diff --git a/src/server/game/Chat/Commands/Level2.cpp b/src/server/game/Chat/Commands/Level2.cpp
index b1e13b7d92d..49c40e09538 100755
--- a/src/server/game/Chat/Commands/Level2.cpp
+++ b/src/server/game/Chat/Commands/Level2.cpp
@@ -458,61 +458,6 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
return true;
}
-bool ChatHandler::HandleLookupEventCommand(const char* args)
-{
- if (!*args)
- return false;
-
- std::string namepart = args;
- std::wstring wnamepart;
-
- // converting string that we try to find to lower case
- if (!Utf8toWStr(namepart, wnamepart))
- return false;
-
- wstrToLower(wnamepart);
-
- bool found = false;
- uint32 count = 0;
- uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
-
- GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
- GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr->GetActiveEventList();
-
- for (uint32 id = 0; id < events.size(); ++id)
- {
- GameEventData const& eventData = events[id];
-
- std::string descr = eventData.description;
- if (descr.empty())
- continue;
-
- if (Utf8FitTo(descr, wnamepart))
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- char const* active = activeEvents.find(id) != activeEvents.end() ? GetTrinityString(LANG_ACTIVE) : "";
-
- if (m_session)
- PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT, id, id, eventData.description.c_str(), active);
- else
- PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, id, eventData.description.c_str(), active);
-
- if (!found)
- found = true;
- }
- }
-
- if (!found)
- SendSysMessage(LANG_NOEVENTFOUND);
-
- return true;
-}
-
bool ChatHandler::HandleCombatStopCommand(const char* args)
{
Player* target = NULL;
@@ -541,128 +486,6 @@ bool ChatHandler::HandleCombatStopCommand(const char* args)
return true;
}
-bool ChatHandler::HandleLookupPlayerIpCommand(const char* args)
-{
- std::string ip;
- int32 limit;
- char* limit_str;
-
- Player *chr = getSelectedPlayer();
- if (!*args)
- {
- // NULL only if used from console
- if (!chr || chr == GetSession()->GetPlayer())
- return false;
-
- ip = chr->GetSession()->GetRemoteAddress();
- limit = -1;
- }
- else
- {
- ip = strtok ((char*)args, " ");
- limit_str = strtok (NULL, " ");
- limit = limit_str ? atoi (limit_str) : -1;
- }
-
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BY_IP);
- stmt->setString(0, ip);
- PreparedQueryResult result = LoginDatabase.Query(stmt);
-
- return LookupPlayerSearchCommand(result, limit);
-}
-
-bool ChatHandler::HandleLookupPlayerAccountCommand(const char* args)
-{
- if (!*args)
- return false;
-
- std::string account = strtok ((char*)args, " ");
- char* limit_str = strtok (NULL, " ");
- int32 limit = limit_str ? atoi (limit_str) : -1;
-
- if (!AccountMgr::normalizeString (account))
- return false;
-
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_LIST_BY_NAME);
- stmt->setString(0, account);
- PreparedQueryResult result = LoginDatabase.Query(stmt);
-
- return LookupPlayerSearchCommand (result, limit);
-}
-
-bool ChatHandler::HandleLookupPlayerEmailCommand(const char* args)
-{
- if (!*args)
- return false;
-
- std::string email = strtok ((char*)args, " ");
- char* limit_str = strtok (NULL, " ");
- int32 limit = limit_str ? atoi (limit_str) : -1;
-
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_LIST_BY_EMAIL);
- stmt->setString(0, email);
- PreparedQueryResult result = LoginDatabase.Query(stmt);
-
- return LookupPlayerSearchCommand(result, limit);
-}
-
-bool ChatHandler::LookupPlayerSearchCommand(PreparedQueryResult result, int32 limit)
-{
- if (!result)
- {
- PSendSysMessage(LANG_NO_PLAYERS_FOUND);
- SetSentErrorMessage(true);
- return false;
- }
-
- int i = 0;
- uint32 count = 0;
- uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
- do
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- Field* fields = result->Fetch();
- uint32 acc_id = fields[0].GetUInt32();
- std::string acc_name = fields[1].GetString();
-
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_GUID_NAME_BY_ACC);
- stmt->setUInt32(0, acc_id);
- PreparedQueryResult result2 = CharacterDatabase.Query(stmt);
-
- if (result2)
- {
- PSendSysMessage(LANG_LOOKUP_PLAYER_ACCOUNT, acc_name.c_str(), acc_id);
-
- uint64 guid = 0;
- std::string name;
-
- do
- {
- Field* charfields = result2->Fetch();
- guid = charfields[0].GetUInt64();
- name = charfields[1].GetString();
-
- PSendSysMessage(LANG_LOOKUP_PLAYER_CHARACTER, name.c_str(), guid);
- ++i;
-
- } while (result2->NextRow() && (limit == -1 || i < limit));
- }
- } while (result->NextRow());
-
- if (i == 0) // empty accounts only
- {
- PSendSysMessage(LANG_NO_PLAYERS_FOUND);
- SetSentErrorMessage(true);
- return false;
- }
-
- return true;
-}
bool ChatHandler::HandleRepairitemsCommand(const char* args)
{
@@ -856,86 +679,3 @@ bool ChatHandler::HandlePetUnlearnCommand(const char *args)
return true;
}
-
-bool ChatHandler::HandleLookupTitleCommand(const char* args)
-{
- if (!*args)
- return false;
-
- // can be NULL in console call
- Player* target = getSelectedPlayer();
-
- // title name have single string arg for player name
- char const* targetName = target ? target->GetName() : "NAME";
-
- std::string namepart = args;
- std::wstring wnamepart;
-
- if (!Utf8toWStr(namepart, wnamepart))
- return false;
-
- // converting string that we try to find to lower case
- wstrToLower(wnamepart);
-
- uint32 counter = 0; // Counter for figure out that we found smth.
- uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
-
- // Search in CharTitles.dbc
- for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++)
- {
- CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
- if (titleInfo)
- {
- int loc = GetSessionDbcLocale();
- std::string name = titleInfo->name;
- if (name.empty())
- continue;
-
- if (!Utf8FitTo(name, wnamepart))
- {
- loc = 0;
- for (; loc < TOTAL_LOCALES; ++loc)
- {
- if (loc == GetSessionDbcLocale())
- continue;
-
- name = titleInfo->name[loc];
- if (name.empty())
- continue;
-
- if (Utf8FitTo(name, wnamepart))
- break;
- }
- }
-
- if (loc < TOTAL_LOCALES)
- {
- if (maxResults && counter == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- char const* knownStr = target && target->HasTitle(titleInfo) ? GetTrinityString(LANG_KNOWN) : "";
-
- char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index
- ? GetTrinityString(LANG_ACTIVE)
- : "";
-
- char titleNameStr[80];
- snprintf(titleNameStr, 80, name.c_str(), targetName);
-
- // send title in "id (idx:idx) - [namedlink locale]" format
- if (m_session)
- PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->bit_index, id, titleNameStr, localeNames[loc], knownStr, activeStr);
- else
- PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->bit_index, titleNameStr, localeNames[loc], knownStr, activeStr);
-
- ++counter;
- }
- }
- }
- if (counter == 0) // if counter == 0 then we found nth
- SendSysMessage(LANG_COMMAND_NOTITLEFOUND);
- return true;
-}
diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp
index 0386b8786b6..7f02c7a1815 100755
--- a/src/server/game/Chat/Commands/Level3.cpp
+++ b/src/server/game/Chat/Commands/Level3.cpp
@@ -385,1060 +385,6 @@ bool ChatHandler::HandleAddItemSetCommand(const char *args)
return true;
}
-bool ChatHandler::HandleLookupItemCommand(const char *args)
-{
- if (!*args)
- return false;
-
- std::string namepart = args;
- std::wstring wnamepart;
-
- // converting string that we try to find to lower case
- if (!Utf8toWStr(namepart, wnamepart))
- return false;
-
- wstrToLower(wnamepart);
-
- bool found = false;
- uint32 count = 0;
- uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
-
- // Search in `item_template`
- ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore();
- for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr)
- {
- int loc_idx = GetSessionDbLocaleIndex();
- if (loc_idx >= 0)
- {
- uint8 uloc_idx = uint8(loc_idx);
- if (ItemLocale const* il = sObjectMgr->GetItemLocale(itr->second.ItemId))
- {
- if (il->Name.size() > uloc_idx && !il->Name[uloc_idx].empty())
- {
- std::string name = il->Name[uloc_idx];
-
- if (Utf8FitTo(name, wnamepart))
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- if (m_session)
- PSendSysMessage(LANG_ITEM_LIST_CHAT, itr->second.ItemId, itr->second.ItemId, name.c_str());
- else
- PSendSysMessage(LANG_ITEM_LIST_CONSOLE, itr->second.ItemId, name.c_str());
-
- if (!found)
- found = true;
-
- continue;
- }
- }
- }
- }
-
- std::string name = itr->second.Name1;
- if (name.empty())
- continue;
-
- if (Utf8FitTo(name, wnamepart))
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- if (m_session)
- PSendSysMessage(LANG_ITEM_LIST_CHAT, itr->second.ItemId, itr->second.ItemId, name.c_str());
- else
- PSendSysMessage(LANG_ITEM_LIST_CONSOLE, itr->second.ItemId, name.c_str());
-
- if (!found)
- found = true;
- }
- }
-
- if (!found)
- SendSysMessage(LANG_COMMAND_NOITEMFOUND);
-
- return true;
-}
-
-bool ChatHandler::HandleLookupItemSetCommand(const char *args)
-{
- if (!*args)
- return false;
-
- std::string namepart = args;
- std::wstring wnamepart;
-
- if (!Utf8toWStr(namepart, wnamepart))
- return false;
-
- // converting string that we try to find to lower case
- wstrToLower(wnamepart);
-
- bool found = false;
- uint32 count = 0;
- uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
-
- // Search in ItemSet.dbc
- for (uint32 id = 0; id < sItemSetStore.GetNumRows(); id++)
- {
- ItemSetEntry const* set = sItemSetStore.LookupEntry(id);
- if (set)
- {
- int loc = GetSessionDbcLocale();
- std::string name = set->name;
- if (name.empty())
- continue;
-
- if (!Utf8FitTo(name, wnamepart))
- {
- loc = 0;
- for (; loc < TOTAL_LOCALES; ++loc)
- {
- if (loc == GetSessionDbcLocale())
- continue;
-
- name = set->name[loc];
- if (name.empty())
- continue;
-
- if (Utf8FitTo(name, wnamepart))
- break;
- }
- }
-
- if (loc < TOTAL_LOCALES)
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- // send item set in "id - [namedlink locale]" format
- if (m_session)
- PSendSysMessage(LANG_ITEMSET_LIST_CHAT, id, id, name.c_str(), localeNames[loc]);
- else
- PSendSysMessage(LANG_ITEMSET_LIST_CONSOLE, id, name.c_str(), localeNames[loc]);
-
- if (!found)
- found = true;
- }
- }
- }
- if (!found)
- SendSysMessage(LANG_COMMAND_NOITEMSETFOUND);
- return true;
-}
-
-bool ChatHandler::HandleLookupSkillCommand(const char *args)
-{
- if (!*args)
- return false;
-
- // can be NULL in console call
- Player* target = getSelectedPlayer();
-
- std::string namepart = args;
- std::wstring wnamepart;
-
- if (!Utf8toWStr(namepart, wnamepart))
- return false;
-
- // converting string that we try to find to lower case
- wstrToLower(wnamepart);
-
- bool found = false;
- uint32 count = 0;
- uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
-
- // Search in SkillLine.dbc
- for (uint32 id = 0; id < sSkillLineStore.GetNumRows(); id++)
- {
- SkillLineEntry const* skillInfo = sSkillLineStore.LookupEntry(id);
- if (skillInfo)
- {
- int loc = GetSessionDbcLocale();
- std::string name = skillInfo->name;
- if (name.empty())
- continue;
-
- if (!Utf8FitTo(name, wnamepart))
- {
- loc = 0;
- for (; loc < TOTAL_LOCALES; ++loc)
- {
- if (loc == GetSessionDbcLocale())
- continue;
-
- name = skillInfo->name[loc];
- if (name.empty())
- continue;
-
- if (Utf8FitTo(name, wnamepart))
- break;
- }
- }
-
- if (loc < TOTAL_LOCALES)
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- char valStr[50] = "";
- char const* knownStr = "";
- if (target && target->HasSkill(id))
- {
- knownStr = GetTrinityString(LANG_KNOWN);
- uint32 curValue = target->GetPureSkillValue(id);
- uint32 maxValue = target->GetPureMaxSkillValue(id);
- uint32 permValue = target->GetSkillPermBonusValue(id);
- uint32 tempValue = target->GetSkillTempBonusValue(id);
-
- char const* valFormat = GetTrinityString(LANG_SKILL_VALUES);
- snprintf(valStr, 50, valFormat, curValue, maxValue, permValue, tempValue);
- }
-
- // send skill in "id - [namedlink locale]" format
- if (m_session)
- PSendSysMessage(LANG_SKILL_LIST_CHAT, id, id, name.c_str(), localeNames[loc], knownStr, valStr);
- else
- PSendSysMessage(LANG_SKILL_LIST_CONSOLE, id, name.c_str(), localeNames[loc], knownStr, valStr);
-
- if (!found)
- found = true;
- }
- }
- }
- if (!found)
- SendSysMessage(LANG_COMMAND_NOSKILLFOUND);
- return true;
-}
-
-bool ChatHandler::HandleLookupSpellCommand(const char *args)
-{
- if (!*args)
- return false;
-
- // can be NULL at console call
- Player* target = getSelectedPlayer();
-
- std::string namepart = args;
- std::wstring wnamepart;
-
- if (!Utf8toWStr(namepart, wnamepart))
- return false;
-
- // converting string that we try to find to lower case
- wstrToLower(wnamepart);
-
- bool found = false;
- uint32 count = 0;
- uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
-
- // Search in Spell.dbc
- for (uint32 id = 0; id < sSpellMgr->GetSpellInfoStoreSize(); id++)
- {
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id);
- if (spellInfo)
- {
- int loc = GetSessionDbcLocale();
- std::string name = spellInfo->SpellName;
- if (name.empty())
- continue;
-
- if (!Utf8FitTo(name, wnamepart))
- {
- loc = 0;
- for (; loc < TOTAL_LOCALES; ++loc)
- {
- if (loc == GetSessionDbcLocale())
- continue;
-
- name = spellInfo->SpellName[loc];
- if (name.empty())
- continue;
-
- if (Utf8FitTo(name, wnamepart))
- break;
- }
- }
-
- if (loc < TOTAL_LOCALES)
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- bool known = target && target->HasSpell(id);
- bool learn = (spellInfo->Effects[0].Effect == SPELL_EFFECT_LEARN_SPELL);
-
- SpellInfo const* learnSpellInfo = sSpellMgr->GetSpellInfo(spellInfo->Effects[0].TriggerSpell);
-
- uint32 talentCost = GetTalentSpellCost(id);
-
- bool talent = (talentCost > 0);
- bool passive = spellInfo->IsPassive();
- bool active = target && target->HasAura(id);
-
- // unit32 used to prevent interpreting uint8 as char at output
- // find rank of learned spell for learning spell, or talent rank
- uint32 rank = talentCost ? talentCost : learn && learnSpellInfo ? learnSpellInfo->GetRank() : spellInfo->GetRank();
-
- // send spell in "id - [name, rank N] [talent] [passive] [learn] [known]" format
- std::ostringstream ss;
- if (m_session)
- ss << id << " - |cffffffff|Hspell:" << id << "|h[" << name;
- else
- ss << id << " - " << name;
-
- // include rank in link name
- if (rank)
- ss << GetTrinityString(LANG_SPELL_RANK) << rank;
-
- if (m_session)
- ss << ' ' << localeNames[loc] << "]|h|r";
- else
- ss << ' ' << localeNames[loc];
-
- if (talent)
- ss << GetTrinityString(LANG_TALENT);
- if (passive)
- ss << GetTrinityString(LANG_PASSIVE);
- if (learn)
- ss << GetTrinityString(LANG_LEARN);
- if (known)
- ss << GetTrinityString(LANG_KNOWN);
- if (active)
- ss << GetTrinityString(LANG_ACTIVE);
-
- SendSysMessage(ss.str().c_str());
-
- if (!found)
- found = true;
- }
- }
- }
- if (!found)
- SendSysMessage(LANG_COMMAND_NOSPELLFOUND);
- return true;
-}
-
-bool ChatHandler::HandleLookupQuestCommand(const char *args)
-{
- if (!*args)
- return false;
-
- // can be NULL at console call
- Player* target = getSelectedPlayer();
-
- std::string namepart = args;
- std::wstring wnamepart;
-
- // converting string that we try to find to lower case
- if (!Utf8toWStr(namepart, wnamepart))
- return false;
-
- wstrToLower(wnamepart);
-
- bool found = false;
- uint32 count = 0;
- uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
-
- ObjectMgr::QuestMap const& qTemplates = sObjectMgr->GetQuestTemplates();
- for (ObjectMgr::QuestMap::const_iterator iter = qTemplates.begin(); iter != qTemplates.end(); ++iter)
- {
- Quest * qinfo = iter->second;
-
- int loc_idx = GetSessionDbLocaleIndex();
- if (loc_idx >= 0)
- {
- uint8 uloc_idx = uint8(loc_idx);
- if (QuestLocale const* il = sObjectMgr->GetQuestLocale(qinfo->GetQuestId()))
- {
- if (il->Title.size() > uloc_idx && !il->Title[uloc_idx].empty())
- {
- std::string title = il->Title[uloc_idx];
-
- if (Utf8FitTo(title, wnamepart))
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- char const* statusStr = "";
-
- if (target)
- {
- QuestStatus status = target->GetQuestStatus(qinfo->GetQuestId());
-
- switch (status)
- {
- case QUEST_STATUS_COMPLETE:
- statusStr = GetTrinityString(LANG_COMMAND_QUEST_COMPLETE);
- break;
- case QUEST_STATUS_INCOMPLETE:
- statusStr = GetTrinityString(LANG_COMMAND_QUEST_ACTIVE);
- break;
- case QUEST_STATUS_REWARDED:
- statusStr = GetTrinityString(LANG_COMMAND_QUEST_REWARDED);
- break;
- default:
- break;
- }
- }
-
- if (m_session)
- PSendSysMessage(LANG_QUEST_LIST_CHAT, qinfo->GetQuestId(), qinfo->GetQuestId(), qinfo->GetQuestLevel(), title.c_str(), statusStr);
- else
- PSendSysMessage(LANG_QUEST_LIST_CONSOLE, qinfo->GetQuestId(), title.c_str(), statusStr);
-
- if (!found)
- found = true;
-
- continue;
- }
- }
- }
- }
-
- std::string title = qinfo->GetTitle();
- if (title.empty())
- continue;
-
- if (Utf8FitTo(title, wnamepart))
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- char const* statusStr = "";
-
- if (target)
- {
- QuestStatus status = target->GetQuestStatus(qinfo->GetQuestId());
-
- switch (status)
- {
- case QUEST_STATUS_COMPLETE:
- statusStr = GetTrinityString(LANG_COMMAND_QUEST_COMPLETE);
- break;
- case QUEST_STATUS_INCOMPLETE:
- statusStr = GetTrinityString(LANG_COMMAND_QUEST_ACTIVE);
- break;
- case QUEST_STATUS_REWARDED:
- statusStr = GetTrinityString(LANG_COMMAND_QUEST_REWARDED);
- break;
- default:
- break;
- }
- }
-
- if (m_session)
- PSendSysMessage(LANG_QUEST_LIST_CHAT, qinfo->GetQuestId(), qinfo->GetQuestId(), qinfo->GetQuestLevel(), title.c_str(), statusStr);
- else
- PSendSysMessage(LANG_QUEST_LIST_CONSOLE, qinfo->GetQuestId(), title.c_str(), statusStr);
-
- if (!found)
- found = true;
- }
- }
-
- if (!found)
- SendSysMessage(LANG_COMMAND_NOQUESTFOUND);
-
- return true;
-}
-
-bool ChatHandler::HandleLookupCreatureCommand(const char *args)
-{
- if (!*args)
- return false;
-
- std::string namepart = args;
- std::wstring wnamepart;
-
- // converting string that we try to find to lower case
- if (!Utf8toWStr (namepart, wnamepart))
- return false;
-
- wstrToLower (wnamepart);
-
- bool found = false;
- uint32 count = 0;
- uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
-
- CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates();
- for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr)
- {
- uint32 id = itr->second.Entry;
- uint8 localeIndex = GetSessionDbLocaleIndex();
- if (CreatureLocale const* cl = sObjectMgr->GetCreatureLocale(id))
- {
- if (cl->Name.size() > localeIndex && !cl->Name[localeIndex].empty())
- {
- std::string name = cl->Name[localeIndex];
-
- if (Utf8FitTo (name, wnamepart))
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- if (m_session)
- PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str());
- else
- PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str());
-
- if (!found)
- found = true;
-
- continue;
- }
- }
- }
-
- std::string name = itr->second.Name;
- if (name.empty())
- continue;
-
- if (Utf8FitTo(name, wnamepart))
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- if (m_session)
- PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str());
- else
- PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str());
-
- if (!found)
- found = true;
- }
- }
-
- if (!found)
- SendSysMessage(LANG_COMMAND_NOCREATUREFOUND);
-
- return true;
-}
-
-bool ChatHandler::HandleLookupObjectCommand(const char *args)
-{
- if (!*args)
- return false;
-
- std::string namepart = args;
- std::wstring wnamepart;
-
- // converting string that we try to find to lower case
- if (!Utf8toWStr(namepart, wnamepart))
- return false;
-
- wstrToLower(wnamepart);
-
- bool found = false;
- uint32 count = 0;
- uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
-
- GameObjectTemplateContainer const* gotc = sObjectMgr->GetGameObjectTemplates();
- for (GameObjectTemplateContainer::const_iterator itr = gotc->begin(); itr != gotc->end(); ++itr)
- {
- uint8 localeIndex = GetSessionDbLocaleIndex();
- if (GameObjectLocale const* gl = sObjectMgr->GetGameObjectLocale(itr->second.entry))
- {
- if (gl->Name.size() > localeIndex && !gl->Name[localeIndex].empty())
- {
- std::string name = gl->Name[localeIndex];
-
- if (Utf8FitTo(name, wnamepart))
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- if (m_session)
- PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, itr->second.entry, itr->second.entry, name.c_str());
- else
- PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, itr->second.entry, name.c_str());
-
- if (!found)
- found = true;
-
- continue;
- }
- }
- }
-
- std::string name = itr->second.name;
- if (name.empty())
- continue;
-
- if (Utf8FitTo(name, wnamepart))
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- if (m_session)
- PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, itr->second.entry, itr->second.entry, name.c_str());
- else
- PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, itr->second.entry, name.c_str());
-
- if (!found)
- found = true;
- }
- }
-
- if (!found)
- SendSysMessage(LANG_COMMAND_NOGAMEOBJECTFOUND);
-
- return true;
-}
-
-bool ChatHandler::HandleLookupFactionCommand(const char *args)
-{
- if (!*args)
- return false;
-
- // Can be NULL at console call
- Player* target = getSelectedPlayer();
-
- std::string namepart = args;
- std::wstring wnamepart;
-
- if (!Utf8toWStr (namepart, wnamepart))
- return false;
-
- // converting string that we try to find to lower case
- wstrToLower (wnamepart);
-
- bool found = false;
- uint32 count = 0;
- uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
-
- for (uint32 id = 0; id < sFactionStore.GetNumRows(); ++id)
- {
- FactionEntry const* factionEntry = sFactionStore.LookupEntry (id);
- if (factionEntry)
- {
- FactionState const* repState = target ? target->GetReputationMgr().GetState(factionEntry) : NULL;
-
- int loc = GetSessionDbcLocale();
- std::string name = factionEntry->name;
- if (name.empty())
- continue;
-
- if (!Utf8FitTo(name, wnamepart))
- {
- loc = 0;
- for (; loc < TOTAL_LOCALES; ++loc)
- {
- if (loc == GetSessionDbcLocale())
- continue;
-
- name = factionEntry->name[loc];
- if (name.empty())
- continue;
-
- if (Utf8FitTo(name, wnamepart))
- break;
- }
- }
-
- if (loc < TOTAL_LOCALES)
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- // send faction in "id - [faction] rank reputation [visible] [at war] [own team] [unknown] [invisible] [inactive]" format
- // or "id - [faction] [no reputation]" format
- std::ostringstream ss;
- if (m_session)
- ss << id << " - |cffffffff|Hfaction:" << id << "|h[" << name << ' ' << localeNames[loc] << "]|h|r";
- else
- ss << id << " - " << name << ' ' << localeNames[loc];
-
- if (repState) // and then target != NULL also
- {
- uint32 index = target->GetReputationMgr().GetReputationRankStrIndex(factionEntry);
- std::string rankName = GetTrinityString(index);
-
- ss << ' ' << rankName << "|h|r (" << target->GetReputationMgr().GetReputation(factionEntry) << ')';
-
- if (repState->Flags & FACTION_FLAG_VISIBLE)
- ss << GetTrinityString(LANG_FACTION_VISIBLE);
- if (repState->Flags & FACTION_FLAG_AT_WAR)
- ss << GetTrinityString(LANG_FACTION_ATWAR);
- if (repState->Flags & FACTION_FLAG_PEACE_FORCED)
- ss << GetTrinityString(LANG_FACTION_PEACE_FORCED);
- if (repState->Flags & FACTION_FLAG_HIDDEN)
- ss << GetTrinityString(LANG_FACTION_HIDDEN);
- if (repState->Flags & FACTION_FLAG_INVISIBLE_FORCED)
- ss << GetTrinityString(LANG_FACTION_INVISIBLE_FORCED);
- if (repState->Flags & FACTION_FLAG_INACTIVE)
- ss << GetTrinityString(LANG_FACTION_INACTIVE);
- }
- else
- ss << GetTrinityString(LANG_FACTION_NOREPUTATION);
-
- SendSysMessage(ss.str().c_str());
-
- if (!found)
- found = true;
- }
- }
- }
-
- if (!found)
- SendSysMessage(LANG_COMMAND_FACTION_NOTFOUND);
- return true;
-}
-
-bool ChatHandler::HandleLookupTaxiNodeCommand(const char * args)
-{
- if (!*args)
- return false;
-
- std::string namepart = args;
- std::wstring wnamepart;
-
- if (!Utf8toWStr(namepart, wnamepart))
- return false;
-
- // converting string that we try to find to lower case
- wstrToLower(wnamepart);
-
- bool found = false;
- uint32 count = 0;
- uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
-
- // Search in TaxiNodes.dbc
- for (uint32 id = 0; id < sTaxiNodesStore.GetNumRows(); id++)
- {
- TaxiNodesEntry const* nodeEntry = sTaxiNodesStore.LookupEntry(id);
- if (nodeEntry)
- {
- int loc = GetSessionDbcLocale();
- std::string name = nodeEntry->name;
- if (name.empty())
- continue;
-
- if (!Utf8FitTo(name, wnamepart))
- {
- loc = 0;
- for (; loc < TOTAL_LOCALES; ++loc)
- {
- if (loc == GetSessionDbcLocale())
- continue;
-
- name = nodeEntry->name[loc];
- if (name.empty())
- continue;
-
- if (Utf8FitTo(name, wnamepart))
- break;
- }
- }
-
- if (loc < TOTAL_LOCALES)
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- // send taxinode in "id - [name] (Map:m X:x Y:y Z:z)" format
- if (m_session)
- PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CHAT, id, id, name.c_str(), localeNames[loc],
- nodeEntry->map_id, nodeEntry->x, nodeEntry->y, nodeEntry->z);
- else
- PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CONSOLE, id, name.c_str(), localeNames[loc],
- nodeEntry->map_id, nodeEntry->x, nodeEntry->y, nodeEntry->z);
-
- if (!found)
- found = true;
- }
- }
- }
- if (!found)
- SendSysMessage(LANG_COMMAND_NOTAXINODEFOUND);
- return true;
-}
-
-bool ChatHandler::HandleLookupMapCommand(const char *args)
-{
- if (!*args)
- return false;
-
- /*std::string namepart = args;
- std::wstring wnamepart;
-
- // converting string that we try to find to lower case
- if (!Utf8toWStr(namepart, wnamepart))
- return false;
-
- wstrToLower(wnamepart);
-
- bool found = false;
-
- // search in Map.dbc
- for (uint32 id = 0; id < sMapStore.GetNumRows(); id++)
- {
- MapEntry const* MapInfo = sMapStore.LookupEntry(id);
- if (MapInfo)
- {
- uint8 loc = m_session ? m_session->GetSessionDbcLocale() : sWorld->GetDefaultDbcLocale();
-
- std::string name = MapInfo->name[loc];
- if (name.empty())
- continue;
-
- if (!Utf8FitTo(name, wnamepart))
- {
- loc = LOCALE_enUS;
- for (; loc < TOTAL_LOCALES; loc++)
- {
- if (m_session && loc == m_session->GetSessionDbcLocale())
- continue;
-
- name = MapInfo->name[loc];
- if (name.empty())
- continue;
-
- if (Utf8FitTo(name, wnamepart))
- break;
- }
- }
-
- if (loc < TOTAL_LOCALES)
- {
- // send map in "id - [name][Continent][Instance/Battleground/Arena][Raid reset time:][Heroic reset time:][Mountable]" format
- std::ostringstream ss;
-
- if (m_session)
- ss << id << " - |cffffffff|Hmap:" << id << "|h[" << name << ']';
- else // console
- ss << id << " - [" << name << ']';
-
- if (MapInfo->IsContinent())
- ss << GetTrinityString(LANG_CONTINENT);
-
- switch (MapInfo->map_type)
- {
- case MAP_INSTANCE: ss << GetTrinityString(LANG_INSTANCE); break;
- case MAP_BATTLEGROUND: ss << GetTrinityString(LANG_BATTLEGROUND); break;
- case MAP_ARENA: ss << GetTrinityString(LANG_ARENA); break;
- }
-
- if (MapInfo->IsRaid())
- ss << GetTrinityString(LANG_RAID);
-
- if (MapInfo->SupportsHeroicMode())
- ss << GetTrinityString(LANG_HEROIC);
-
- uint32 ResetTimeRaid = MapInfo->resetTimeRaid;
-
- std::string ResetTimeRaidStr;
- if (ResetTimeRaid)
- ResetTimeRaidStr = secsToTimeString(ResetTimeRaid, true, false);
-
- uint32 ResetTimeHeroic = MapInfo->resetTimeHeroic;
- std::string ResetTimeHeroicStr;
- if (ResetTimeHeroic)
- ResetTimeHeroicStr = secsToTimeString(ResetTimeHeroic, true, false);
-
- if (MapInfo->IsMountAllowed())
- ss << GetTrinityString(LANG_MOUNTABLE);
-
- if (ResetTimeRaid && !ResetTimeHeroic)
- PSendSysMessage(ss.str().c_str(), ResetTimeRaidStr.c_str());
- else if (!ResetTimeRaid && ResetTimeHeroic)
- PSendSysMessage(ss.str().c_str(), ResetTimeHeroicStr.c_str());
- else if (ResetTimeRaid && ResetTimeHeroic)
- PSendSysMessage(ss.str().c_str(), ResetTimeRaidStr.c_str(), ResetTimeHeroicStr.c_str());
- else
- SendSysMessage(ss.str().c_str());
-
- if (!found)
- found = true;
- }
- }
- }
-
- if (!found)
- SendSysMessage(LANG_COMMAND_NOMAPFOUND);
- */
- return true;
-}
-
-/** \brief GM command level 3 - Create a guild.
- *
- * This command allows a GM (level 3) to create a guild.
- *
- * The "args" parameter contains the name of the guild leader
- * and then the name of the guild.
- *
- */
-bool ChatHandler::HandleGuildCreateCommand(const char *args)
-{
- if (!*args)
- return false;
-
- // if not guild name only (in "") then player name
- Player* target;
- if (!extractPlayerTarget(*args != '"' ? (char*)args : NULL, &target))
- return false;
-
- char* tailStr = *args != '"' ? strtok(NULL, "") : (char*)args;
- if (!tailStr)
- return false;
-
- char* guildStr = extractQuotedArg(tailStr);
- if (!guildStr)
- return false;
-
- std::string guildname = guildStr;
-
- if (target->GetGuildId())
- {
- SendSysMessage(LANG_PLAYER_IN_GUILD);
- return true;
- }
-
- Guild* guild = new Guild;
- if (!guild->Create(target, guildname))
- {
- delete guild;
- SendSysMessage(LANG_GUILD_NOT_CREATED);
- SetSentErrorMessage(true);
- return false;
- }
-
- sGuildMgr->AddGuild(guild);
- return true;
-}
-
-bool ChatHandler::HandleGuildInviteCommand(const char *args)
-{
- if (!*args)
- return false;
-
- // if not guild name only (in "") then player name
- uint64 target_guid;
- if (!extractPlayerTarget(*args != '"' ? (char*)args : NULL, NULL, &target_guid))
- return false;
-
- char* tailStr = *args != '"' ? strtok(NULL, "") : (char*)args;
- if (!tailStr)
- return false;
-
- char* guildStr = extractQuotedArg(tailStr);
- if (!guildStr)
- return false;
-
- std::string glName = guildStr;
- Guild* targetGuild = sGuildMgr->GetGuildByName(glName);
- if (!targetGuild)
- return false;
-
- // player's guild membership checked in AddMember before add
- return targetGuild->AddMember(target_guid);
-}
-
-bool ChatHandler::HandleGuildUninviteCommand(const char *args)
-{
- Player* target;
- uint64 target_guid;
- if (!extractPlayerTarget((char*)args, &target, &target_guid))
- return false;
-
- uint32 glId = target ? target->GetGuildId() : Player::GetGuildIdFromDB(target_guid);
- if (!glId)
- return false;
-
- Guild* targetGuild = sGuildMgr->GetGuildById(glId);
- if (!targetGuild)
- return false;
-
- targetGuild->DeleteMember(target_guid, false, true);
- return true;
-}
-
-bool ChatHandler::HandleGuildRankCommand(const char *args)
-{
- char* nameStr;
- char* rankStr;
- extractOptFirstArg((char*)args, &nameStr, &rankStr);
- if (!rankStr)
- return false;
-
- Player* target;
- uint64 target_guid;
- std::string target_name;
- if (!extractPlayerTarget(nameStr, &target, &target_guid, &target_name))
- return false;
-
- uint32 glId = target ? target->GetGuildId() : Player::GetGuildIdFromDB(target_guid);
- if (!glId)
- return false;
-
- Guild* targetGuild = sGuildMgr->GetGuildById(glId);
- if (!targetGuild)
- return false;
-
- uint32 newrank = uint32 (atoi (rankStr));
- return targetGuild->ChangeMemberRank(target_guid, newrank);
-}
-
-bool ChatHandler::HandleGuildDeleteCommand(const char *args)
-{
- if (!*args)
- return false;
-
- char* guildStr = extractQuotedArg((char*)args);
- if (!guildStr)
- return false;
-
- std::string gld = guildStr;
-
- Guild* targetGuild = sGuildMgr->GetGuildByName(gld);
- if (!targetGuild)
- return false;
-
- targetGuild->Disband();
-
- return true;
-}
-
bool ChatHandler::HandleGetDistanceCommand(const char *args)
{
WorldObject* obj = NULL;
diff --git a/src/server/game/Entities/Item/ItemPrototype.h b/src/server/game/Entities/Item/ItemPrototype.h
index 0b7e361213a..49695659868 100755
--- a/src/server/game/Entities/Item/ItemPrototype.h
+++ b/src/server/game/Entities/Item/ItemPrototype.h
@@ -203,6 +203,7 @@ enum ItemFlagsCustom
{
ITEM_FLAGS_CU_DURATION_REAL_TIME = 0x0001, // Item duration will tick even if player is offline
ITEM_FLAGS_CU_IGNORE_QUEST_STATUS = 0x0002, // No quest status will be checked when this item drops
+ ITEM_FLAGS_CU_FOLLOW_LOOT_RULES = 0x0004, // Item will always follow group/master/need before greed looting rules
};
enum BAG_FAMILY_MASK
@@ -600,6 +601,9 @@ struct ItemTemplate
uint32 Quality;
uint32 Flags;
uint32 Flags2;
+ float Unk430_1;
+ float Unk430_2;
+ uint32 BuyCount;
int32 BuyPrice;
uint32 SellPrice;
uint32 InventoryType;
@@ -652,7 +656,6 @@ struct ItemTemplate
int32 Field131;
// extra fields, not part of db2 files
- uint32 BuyCount;
float DamageMin;
float DamageMax;
float DPS;
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 0e36bdf21c1..e5df31734a4 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -16715,10 +16715,11 @@ void Player::_LoadEquipmentSets(PreparedQueryResult result)
uint8 index = fields[1].GetUInt8();
eqSet.Name = fields[2].GetString();
eqSet.IconName = fields[3].GetString();
+ eqSet.IgnoreMask = fields[4].GetUInt32();
eqSet.state = EQUIPMENT_SET_UNCHANGED;
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
- eqSet.Items[i] = fields[4+i].GetUInt32();
+ eqSet.Items[i] = fields[5+i].GetUInt32();
m_EquipmentSets[index] = eqSet;
@@ -17374,12 +17375,22 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
// restore remembered power/health values (but not more max values)
uint32 savedHealth = fields[48].GetUInt32();
SetHealth(savedHealth > GetMaxHealth() ? GetMaxHealth() : savedHealth);
- for (uint8 i = 0; i < MAX_STORED_POWERS; ++i)
+ uint32 loadedPowers = 0;
+ for (uint32 i = 0; i < MAX_POWERS; ++i)
{
- uint32 savedPower = fields[49+i].GetUInt32();
- SetPower(Powers(i), savedPower > GetMaxPower(Powers(i)) ? GetMaxPower(Powers(i)) : savedPower);
+ if (GetPowerIndexByClass(Powers(i), getClass()) != MAX_POWERS)
+ {
+ uint32 savedPower = fields[49+loadedPowers].GetUInt32();
+ uint32 maxPower = GetUInt32Value(UNIT_FIELD_MAXPOWER1 + loadedPowers);
+ SetPower(Powers(i), (savedPower > maxPower) ? maxPower : savedPower);
+ if (++loadedPowers >= MAX_STORED_POWERS)
+ break;
+ }
}
+ for (; loadedPowers < MAX_STORED_POWERS; ++loadedPowers)
+ SetUInt32Value(UNIT_FIELD_POWER1 + loadedPowers, 0);
+
// must be after loading spells and talents
Tokens talentTrees(fields[26].GetString(), ' ', MAX_TALENT_SPECS);
for (uint8 i = 0; i < MAX_TALENT_SPECS; ++i)
@@ -18830,8 +18841,19 @@ void Player::SaveToDB(bool create /*=false*/)
stmt->setUInt16(index++, (uint16)(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE));
stmt->setUInt32(index++, GetHealth());
- for (uint32 i = 0; i < MAX_STORED_POWERS; ++i)
- stmt->setUInt32(index++, GetPower(Powers(i)));
+ uint32 storedPowers = 0;
+ for (uint32 i = 0; i < MAX_POWERS; ++i)
+ {
+ if (GetPowerIndexByClass(Powers(i), getClass()) != MAX_POWERS)
+ {
+ stmt->setUInt32(index++, GetUInt32Value(UNIT_FIELD_POWER1 + storedPowers));
+ if (++storedPowers >= MAX_STORED_POWERS)
+ break;
+ }
+ }
+
+ for (; storedPowers < MAX_STORED_POWERS; ++storedPowers)
+ stmt->setUInt32(index++, 0);
stmt->setUInt32(index++, GetSession()->GetLatency());
@@ -18941,8 +18963,19 @@ void Player::SaveToDB(bool create /*=false*/)
stmt->setUInt16(index++, (uint16)(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE));
stmt->setUInt32(index++, GetHealth());
- for (uint32 i = 0; i < MAX_STORED_POWERS; ++i)
- stmt->setUInt32(index++, GetPower(Powers(i)));
+ uint32 storedPowers = 0;
+ for (uint32 i = 0; i < MAX_POWERS; ++i)
+ {
+ if (GetPowerIndexByClass(Powers(i), getClass()) != MAX_POWERS)
+ {
+ stmt->setUInt32(index++, GetUInt32Value(UNIT_FIELD_POWER1 + storedPowers));
+ if (++storedPowers >= MAX_STORED_POWERS)
+ break;
+ }
+ }
+
+ for (; storedPowers < MAX_STORED_POWERS; ++storedPowers)
+ stmt->setUInt32(index++, 0);
stmt->setUInt32(index++, GetSession()->GetLatency());
@@ -24903,7 +24936,13 @@ void Player::SendEquipmentSetList()
data << itr->second.Name;
data << itr->second.IconName;
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
- data.appendPackGUID(MAKE_NEW_GUID(itr->second.Items[i], 0, HIGHGUID_ITEM));
+ {
+ // ignored slots stored in IgnoreMask, client wants "1" as raw GUID, so no HIGHGUID_ITEM
+ if (itr->second.IgnoreMask & (1 << i))
+ data.appendPackGUID(uint64(1));
+ else
+ data.appendPackGUID(MAKE_NEW_GUID(itr->second.Items[i], 0, HIGHGUID_ITEM));
+ }
++count; // client have limit but it checked at loading and set
}
@@ -24969,6 +25008,7 @@ void Player::_SaveEquipmentSets(SQLTransaction& trans)
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_EQUIP_SET);
stmt->setString(j++, eqset.Name.c_str());
stmt->setString(j++, eqset.IconName.c_str());
+ stmt->setUInt32(j++, eqset.IgnoreMask);
for (uint8 i=0; i<EQUIPMENT_SLOT_END; ++i)
stmt->setUInt32(j++, eqset.Items[i]);
stmt->setUInt32(j++, GetGUIDLow());
@@ -24985,6 +25025,7 @@ void Player::_SaveEquipmentSets(SQLTransaction& trans)
stmt->setUInt32(j++, index);
stmt->setString(j++, eqset.Name.c_str());
stmt->setString(j++, eqset.IconName.c_str());
+ stmt->setUInt32(j++, eqset.IgnoreMask);
for (uint8 i=0; i<EQUIPMENT_SLOT_END; ++i)
stmt->setUInt32(j++, eqset.Items[i]);
trans->Append(stmt);
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 1f912902b0e..d6941406145 100755
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -655,7 +655,7 @@ enum EquipmentSetUpdateState
struct EquipmentSet
{
- EquipmentSet() : Guid(0), state(EQUIPMENT_SET_NEW)
+ EquipmentSet() : Guid(0), IgnoreMask(0), state(EQUIPMENT_SET_NEW)
{
for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
Items[i] = 0;
@@ -664,6 +664,7 @@ struct EquipmentSet
uint64 Guid;
std::string Name;
std::string IconName;
+ uint32 IgnoreMask;
uint32 Items[EQUIPMENT_SLOT_END];
EquipmentSetUpdateState state;
};
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 743431849ab..2435a403408 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -6432,7 +6432,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Effect 0 - mod damage while having Enrage
if (effIndex == 0)
{
- if (!(procSpell->SpellFamilyFlags[0] & 0x00080000))
+ if (!(procSpell->SpellFamilyFlags[0] & 0x00080000) || procSpell->SpellIconID != 916)
return false;
triggered_spell_id = 51185;
basepoints0 = triggerAmount;
@@ -6442,7 +6442,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Effect 1 - Tiger's Fury restore energy
else if (effIndex == 1)
{
- if (!(procSpell->SpellFamilyFlags[2] & 0x00000800))
+ if (!(procSpell->SpellFamilyFlags[2] & 0x00000800) || procSpell->SpellIconID != 1181)
return false;
triggered_spell_id = 51178;
basepoints0 = triggerAmount;
@@ -10691,7 +10691,7 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui
for (AuraEffectList::const_iterator i = IgnoreResistAuras.begin(); i != IgnoreResistAuras.end(); ++i)
{
if ((*i)->GetMiscValue() & spellProto->GetSchoolMask())
- TakenTotalCasterMod += (float((*i)->GetAmount())/100);
+ TakenTotalCasterMod += (float((*i)->GetAmount()));
}
// from positive and negative SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN
@@ -11737,7 +11737,7 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackT
for (AuraEffectList::const_iterator i = IgnoreResistAuras.begin(); i != IgnoreResistAuras.end(); ++i)
{
if ((*i)->GetMiscValue() & attackSchoolMask)
- TakenTotalCasterMod += (float((*i)->GetAmount())/100);
+ TakenTotalCasterMod += (float((*i)->GetAmount()));
}
// ..taken
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 71ce341185e..44be40401fd 100755
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -2196,7 +2196,7 @@ uint32 FillMaxDurability(uint32 itemClass, uint32 itemSubClass, uint32 inventory
float levelPenalty = 1.0f;
if (itemLevel <= 28)
- levelPenalty = 0.966f - float(28u - itemLevel) * 1.0f / 54.0f;
+ levelPenalty = 0.966f - float(28u - itemLevel) / 54.0f;
if (itemClass == ITEM_CLASS_ARMOR)
{
@@ -2273,6 +2273,8 @@ void ObjectMgr::LoadItemTemplates()
itemTemplate.Quality = sparse->Quality;
itemTemplate.Flags = sparse->Flags;
itemTemplate.Flags2 = sparse->Flags2;
+ itemTemplate.Unk430_1 = sparse->Unk430_1;
+ itemTemplate.Unk430_2 = sparse->Unk430_2;
itemTemplate.BuyCount = std::max(sparse->BuyCount, 1u);
itemTemplate.BuyPrice = sparse->BuyPrice;
itemTemplate.SellPrice = sparse->SellPrice;
@@ -2333,7 +2335,7 @@ void ObjectMgr::LoadItemTemplates()
itemTemplate.RandomProperty = sparse->RandomProperty;
itemTemplate.RandomSuffix = sparse->RandomSuffix;
itemTemplate.ItemSet = sparse->ItemSet;
- itemTemplate.MaxDurability = FillMaxDurability(db2Data->Class, db2Data->SubClass, sparse->Quality, sparse->InventoryType, sparse->ItemLevel);
+ itemTemplate.MaxDurability = FillMaxDurability(db2Data->Class, db2Data->SubClass, sparse->InventoryType, sparse->Quality, sparse->ItemLevel);
itemTemplate.Area = sparse->Area;
itemTemplate.Map = sparse->Map;
itemTemplate.BagFamily = sparse->BagFamily;
@@ -2363,41 +2365,41 @@ void ObjectMgr::LoadItemTemplates()
}
// Load missing items from item_template AND overwrite data from Item-sparse.db2 (item_template is supposed to contain Item-sparse.adb data)
- // 0 1 2 3 4 5 6 7 8 9 10 11
- QueryResult result = WorldDatabase.Query("SELECT entry, Class, SubClass, Unk0, Name, DisplayId, Quality, Flags, FlagsExtra, BuyPrice, SellPrice, InventoryType, "
- // 12 13 14 15 16 17 18 19
- "AllowableClass, AllowableRace, ItemLevel, RequiredLevel, RequiredSkill, RequiredSkillRank, RequiredSpell, RequiredHonorRank, "
- // 20 21 22 23 24 25
- "RequiredCityRank, RequiredReputationFaction, RequiredReputationRank, MaxCount, Stackable, ContainerSlots, "
- // 26 27 28 29 30 31 32 33
+ // 0 1 2 3 4 5 6 7 8 9 10 11 12 13
+ QueryResult result = WorldDatabase.Query("SELECT entry, Class, SubClass, Unk0, Name, DisplayId, Quality, Flags, FlagsExtra, Unk430_1, Unk430_2, BuyCount, BuyPrice, SellPrice, "
+ // 14 15 16 17 18 19 20 21
+ "InventoryType, AllowableClass, AllowableRace, ItemLevel, RequiredLevel, RequiredSkill, RequiredSkillRank, RequiredSpell, "
+ // 22 23 24 25 26 27 28
+ "RequiredHonorRank, RequiredCityRank, RequiredReputationFaction, RequiredReputationRank, MaxCount, Stackable, ContainerSlots, "
+ // 29 30 31 32 33 34 35 36
"stat_type1, stat_value1, stat_unk1_1, stat_unk2_1, stat_type2, stat_value2, stat_unk1_2, stat_unk2_2, "
- // 34 35 36 37 38 39 40 41
+ // 37 38 39 40 41 42 43 44
"stat_type3, stat_value3, stat_unk1_3, stat_unk2_3, stat_type4, stat_value4, stat_unk1_4, stat_unk2_4, "
- // 42 43 44 45 46 47 48 49
+ // 45 46 47 48 49 50 51 52
"stat_type5, stat_value5, stat_unk1_5, stat_unk2_5, stat_type6, stat_value6, stat_unk1_6, stat_unk2_6, "
- // 50 51 52 53 54 55 56 57
+ // 53 54 55 56 57 58 59 60
"stat_type7, stat_value7, stat_unk1_7, stat_unk2_7, stat_type8, stat_value8, stat_unk1_8, stat_unk2_8, "
- // 58 59 60 61 62 63 64 65
+ // 61 62 63 64 65 66 67 68
"stat_type9, stat_value9, stat_unk1_9, stat_unk2_9, stat_type10, stat_value10, stat_unk1_10, stat_unk2_10, "
- // 66 67 68 69
+ // 69 70 71 72
"ScalingStatDistribution, DamageType, Delay, RangedModRange, "
- // 70 71 72 73 74 75
+ // 73 74 75 76 77 78
"spellid_1, spelltrigger_1, spellcharges_1, spellcooldown_1, spellcategory_1, spellcategorycooldown_1, "
- // 76 77 78 79 80 81
+ // 79 80 81 82 83 84
"spellid_2, spelltrigger_2, spellcharges_2, spellcooldown_2, spellcategory_2, spellcategorycooldown_2, "
- // 82 83 84 85 86 87
+ // 85 86 87 88 89 90
"spellid_3, spelltrigger_3, spellcharges_3, spellcooldown_3, spellcategory_3, spellcategorycooldown_3, "
- // 88 89 90 91 92 93
+ // 91 92 93 94 95 96
"spellid_4, spelltrigger_4, spellcharges_4, spellcooldown_4, spellcategory_4, spellcategorycooldown_4, "
- // 94 95 96 97 98 99
+ // 97 98 99 100 101 102
"spellid_5, spelltrigger_5, spellcharges_5, spellcooldown_5, spellcategory_5, spellcategorycooldown_5, "
- // 100 101 102 103 104 105 106 107
+ // 103 104 105 106 107 108 109 110
"Bonding, Description, PageText, LanguageID, PageMaterial, StartQuest, LockID, Material, "
- // 108 109 110 111 112 113 114 115 116
- "Sheath, RandomProperty, RandomSuffix, ItemSet, MaxDurability, Area, Map, BagFamily, TotemCategory, "
- // 117 118 119 120 121 122 123
+ // 111 112 113 114 115 116 117 118
+ "Sheath, RandomProperty, RandomSuffix, ItemSet, Area, Map, BagFamily, TotemCategory, "
+ // 119 120 121 122 123 124 125
"SocketColor_1, SocketContent_1, SocketColor_2, SocketContent_2, SocketColor_3, SocketContent_3, SocketBonus, "
- // 124 125 126 127 128 129 130 131
+ // 126 127 128 129 130 131 132 133
"GemProperties, ArmorDamageModifier, Duration, ItemLimitCategory, HolidayId, StatScalingFactor, Field130, Field131 "
"FROM item_template");
@@ -2421,93 +2423,96 @@ void ObjectMgr::LoadItemTemplates()
itemTemplate.Quality = uint32(fields[6].GetUInt8());
itemTemplate.Flags = uint32(fields[7].GetInt64());
itemTemplate.Flags2 = fields[8].GetUInt32();
- itemTemplate.BuyCount = 1;
- itemTemplate.BuyPrice = fields[9].GetInt64();
- itemTemplate.SellPrice = fields[10].GetUInt32();
- itemTemplate.InventoryType = fields[11].GetUInt32();
- itemTemplate.AllowableClass = fields[12].GetUInt32();
- itemTemplate.AllowableRace = fields[13].GetUInt32();
- itemTemplate.ItemLevel = fields[14].GetUInt32();
- itemTemplate.RequiredLevel = fields[15].GetUInt32();
- itemTemplate.RequiredSkill = fields[16].GetUInt32();
- itemTemplate.RequiredSkillRank = fields[17].GetUInt32();
- itemTemplate.RequiredSpell = fields[18].GetUInt32();
- itemTemplate.RequiredHonorRank = fields[19].GetUInt32();
- itemTemplate.RequiredCityRank = fields[20].GetUInt32();
- itemTemplate.RequiredReputationFaction = fields[21].GetUInt32();
- itemTemplate.RequiredReputationRank = fields[22].GetUInt32();
- itemTemplate.MaxCount = fields[23].GetInt32();
- itemTemplate.Stackable = fields[24].GetInt32();
- itemTemplate.ContainerSlots = fields[25].GetUInt32();
+ itemTemplate.Unk430_1 = fields[9].GetFloat();
+ itemTemplate.Unk430_2 = fields[10].GetFloat();
+ itemTemplate.BuyCount = uint32(fields[11].GetUInt8());
+ itemTemplate.BuyPrice = int32(fields[12].GetInt64());
+ itemTemplate.SellPrice = fields[13].GetUInt32();
+
+ itemTemplate.InventoryType = uint32(fields[14].GetUInt8());
+ itemTemplate.AllowableClass = fields[15].GetInt32();
+ itemTemplate.AllowableRace = fields[16].GetInt32();
+ itemTemplate.ItemLevel = uint32(fields[17].GetUInt16());
+ itemTemplate.RequiredLevel = uint32(fields[18].GetUInt8());
+ itemTemplate.RequiredSkill = uint32(fields[19].GetUInt16());
+ itemTemplate.RequiredSkillRank = uint32(fields[20].GetUInt16());
+ itemTemplate.RequiredSpell = fields[21].GetUInt32();
+ itemTemplate.RequiredHonorRank = fields[22].GetUInt32();
+ itemTemplate.RequiredCityRank = fields[23].GetUInt32();
+ itemTemplate.RequiredReputationFaction = uint32(fields[24].GetUInt16());
+ itemTemplate.RequiredReputationRank = uint32(fields[25].GetUInt16());
+ itemTemplate.MaxCount = fields[26].GetInt32();
+ itemTemplate.Stackable = fields[27].GetInt32();
+ itemTemplate.ContainerSlots = uint32(fields[28].GetUInt8());
for (uint32 i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
{
- itemTemplate.ItemStat[i].ItemStatType = fields[26 + i * 4].GetUInt8();
- itemTemplate.ItemStat[i].ItemStatValue = fields[26 + i * 4 + 1].GetInt16();
- itemTemplate.ItemStat[i].ItemStatUnk1 = fields[26 + i * 4 + 2].GetInt32();
- itemTemplate.ItemStat[i].ItemStatUnk2 = fields[26 + i * 4 + 3].GetInt32();
+ itemTemplate.ItemStat[i].ItemStatType = uint32(fields[28 + i * 4 + 0].GetUInt8());
+ itemTemplate.ItemStat[i].ItemStatValue = int32(fields[28 + i * 4 + 1].GetInt16());
+ itemTemplate.ItemStat[i].ItemStatUnk1 = fields[28 + i * 4 + 2].GetInt32();
+ itemTemplate.ItemStat[i].ItemStatUnk2 = fields[28 + i * 4 + 3].GetInt32();
}
- itemTemplate.ScalingStatDistribution = fields[66].GetUInt32();
+ itemTemplate.ScalingStatDistribution = uint32(fields[69].GetUInt16());
// cache item damage
FillItemDamageFields(&itemTemplate.DamageMin, &itemTemplate.DamageMax, &itemTemplate.DPS, itemTemplate.ItemLevel,
- itemTemplate.Class, itemTemplate.SubClass, itemTemplate.Quality, fields[68].GetUInt32(),
- fields[129].GetFloat(), itemTemplate.InventoryType, itemTemplate.Flags2);
+ itemTemplate.Class, itemTemplate.SubClass, itemTemplate.Quality, fields[71].GetUInt32(),
+ fields[131].GetFloat(), itemTemplate.InventoryType, itemTemplate.Flags2);
- itemTemplate.DamageType = fields[67].GetUInt32();
+ itemTemplate.DamageType = fields[70].GetUInt32();
itemTemplate.Armor = FillItemArmor(itemTemplate.ItemLevel, itemTemplate.Class,
itemTemplate.SubClass, itemTemplate.Quality,
itemTemplate.InventoryType);
- itemTemplate.Delay = fields[68].GetUInt32();
- itemTemplate.RangedModRange = fields[69].GetFloat();
+ itemTemplate.Delay = fields[71].GetUInt32();
+ itemTemplate.RangedModRange = fields[72].GetFloat();
for (uint32 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
{
- itemTemplate.Spells[i].SpellId = fields[70 + 6 * i].GetInt32();
- itemTemplate.Spells[i].SpellTrigger = fields[70 + 6 * i + 1].GetUInt32();
- itemTemplate.Spells[i].SpellCharges = fields[70 + 6 * i + 2].GetInt32();
- itemTemplate.Spells[i].SpellCooldown = fields[70 + 6 * i + 3].GetInt32();
- itemTemplate.Spells[i].SpellCategory = fields[70 + 6 * i + 4].GetUInt32();
- itemTemplate.Spells[i].SpellCategoryCooldown = fields[70 + 6 * i + 5].GetInt32();
+ itemTemplate.Spells[i].SpellId = fields[73 + 6 * i + 0].GetInt32();
+ itemTemplate.Spells[i].SpellTrigger = uint32(fields[73 + 6 * i + 1].GetUInt8());
+ itemTemplate.Spells[i].SpellCharges = int32(fields[73 + 6 * i + 2].GetInt16());
+ itemTemplate.Spells[i].SpellCooldown = fields[73 + 6 * i + 3].GetInt32();
+ itemTemplate.Spells[i].SpellCategory = uint32(fields[73 + 6 * i + 4].GetUInt16());
+ itemTemplate.Spells[i].SpellCategoryCooldown = fields[73 + 6 * i + 5].GetInt32();
}
itemTemplate.SpellPPMRate = 0.0f;
- itemTemplate.Bonding = fields[100].GetUInt32();
- itemTemplate.Description = fields[101].GetString();
- itemTemplate.PageText = fields[102].GetUInt32();
- itemTemplate.LanguageID = fields[103].GetUInt32();
- itemTemplate.PageMaterial = fields[104].GetUInt32();
- itemTemplate.StartQuest = fields[105].GetUInt32();
- itemTemplate.LockID = fields[106].GetUInt32();
- itemTemplate.Material = fields[107].GetInt32();
- itemTemplate.Sheath = fields[108].GetUInt32();
- itemTemplate.RandomProperty = fields[109].GetInt32();
- itemTemplate.RandomSuffix = fields[110].GetInt32();
- itemTemplate.ItemSet = fields[111].GetUInt32();
+ itemTemplate.Bonding = uint32(fields[103].GetUInt8());
+ itemTemplate.Description = fields[104].GetString();
+ itemTemplate.PageText = fields[105].GetUInt32();
+ itemTemplate.LanguageID = uint32(fields[106].GetUInt8());
+ itemTemplate.PageMaterial = uint32(fields[107].GetUInt8());
+ itemTemplate.StartQuest = fields[108].GetUInt32();
+ itemTemplate.LockID = fields[109].GetUInt32();
+ itemTemplate.Material = int32(fields[110].GetInt8());
+ itemTemplate.Sheath = uint32(fields[111].GetUInt8());
+ itemTemplate.RandomProperty = fields[112].GetUInt32();
+ itemTemplate.RandomSuffix = fields[113].GetInt32();
+ itemTemplate.ItemSet = fields[114].GetUInt32();
itemTemplate.MaxDurability = FillMaxDurability(itemTemplate.Class, itemTemplate.SubClass,
- itemTemplate.Quality, itemTemplate.InventoryType, itemTemplate.ItemLevel);
+ itemTemplate.InventoryType, itemTemplate.Quality, itemTemplate.ItemLevel);
- itemTemplate.Area = fields[113].GetUInt32();
- itemTemplate.Map = fields[114].GetUInt32();
- itemTemplate.BagFamily = fields[115].GetUInt32();
- itemTemplate.TotemCategory = fields[116].GetUInt32();
+ itemTemplate.Area = fields[115].GetUInt32();
+ itemTemplate.Map = uint32(fields[116].GetUInt16());
+ itemTemplate.BagFamily = fields[117].GetUInt32();
+ itemTemplate.TotemCategory = fields[118].GetUInt32();
for (uint32 i = 0; i < MAX_ITEM_PROTO_SOCKETS; ++i)
{
- itemTemplate.Socket[i].Color = fields[117 + i * 2].GetUInt32();
- itemTemplate.Socket[i].Content = fields[117 + i * 2 + 1].GetUInt32();
+ itemTemplate.Socket[i].Color = uint32(fields[119 + i*2].GetUInt8());
+ itemTemplate.Socket[i].Content = fields[119 + i * 2 + 1].GetUInt32();
}
- itemTemplate.socketBonus = fields[123].GetUInt32();
- itemTemplate.GemProperties = fields[124].GetUInt32();
+ itemTemplate.socketBonus = fields[125].GetUInt32();
+ itemTemplate.GemProperties = fields[126].GetUInt32();
FillDisenchantFields(&itemTemplate.DisenchantID, &itemTemplate.RequiredDisenchantSkill, itemTemplate);
- itemTemplate.ArmorDamageModifier = fields[125].GetFloat();
- itemTemplate.Duration = fields[126].GetUInt32();
- itemTemplate.ItemLimitCategory = fields[127].GetUInt32();
- itemTemplate.HolidayId = fields[128].GetUInt32();
- itemTemplate.StatScalingFactor = fields[129].GetFloat();
- itemTemplate.Field130 = fields[130].GetInt32();
- itemTemplate.Field131 = fields[131].GetInt32();
+ itemTemplate.ArmorDamageModifier = fields[127].GetFloat();
+ itemTemplate.Duration = fields[128].GetUInt32();
+ itemTemplate.ItemLimitCategory = uint32(fields[129].GetInt16());
+ itemTemplate.HolidayId = fields[130].GetUInt32();
+ itemTemplate.StatScalingFactor = fields[131].GetFloat();
+ itemTemplate.Field130 = fields[132].GetInt32();
+ itemTemplate.Field131 = fields[133].GetInt32();
itemTemplate.ScriptId = 0;
itemTemplate.FoodType = 0;
itemTemplate.MinMoneyLoot = 0;
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index da363fbbb15..1060500bda1 100755
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -981,6 +981,64 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject)
else
i->is_underthreshold = true;
}
+
+ for (i = loot->quest_items.begin(); i != loot->quest_items.end(); ++i, ++itemSlot)
+ {
+ if (!i->follow_loot_rules)
+ continue;
+
+ item = sObjectMgr->GetItemTemplate(i->itemid);
+ if (!item)
+ {
+ //sLog->outDebug("Group::GroupLoot: missing item prototype for item with id: %d", i->itemid);
+ continue;
+ }
+
+ uint64 newitemGUID = MAKE_NEW_GUID(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM);
+ Roll* r = new Roll(newitemGUID, *i);
+
+ //a vector is filled with only near party members
+ for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
+ {
+ Player* member = itr->getSource();
+ if (!member || !member->GetSession())
+ continue;
+
+ if (i->AllowedForPlayer(member))
+ {
+ if (member->IsWithinDistInMap(pLootedObject, sWorld->getFloatConfig(CONFIG_GROUP_XP_DISTANCE), false))
+ {
+ r->totalPlayersRolling++;
+ r->playerVote[member->GetGUID()] = NOT_EMITED_YET;
+ }
+ }
+ }
+
+ if (r->totalPlayersRolling > 0)
+ {
+ r->setLoot(loot);
+ r->itemSlot = itemSlot;
+
+ loot->quest_items[itemSlot - loot->items.size()].is_blocked = true;
+
+ SendLootStartRoll(60000, pLootedObject->GetMapId(), *r);
+
+ RollId.push_back(r);
+
+ if (Creature* creature = pLootedObject->ToCreature())
+ {
+ creature->m_groupLootTimer = 60000;
+ creature->lootingGroupLowGUID = GetLowGUID();
+ }
+ else if (GameObject* go = pLootedObject->ToGameObject())
+ {
+ go->m_groupLootTimer = 60000;
+ go->lootingGroupLowGUID = GetLowGUID();
+ }
+ }
+ else
+ delete r;
+ }
}
void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject)
@@ -1065,6 +1123,66 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject)
else
i->is_underthreshold = true;
}
+
+ for (std::vector<LootItem>::iterator i = loot->quest_items.begin(); i != loot->quest_items.end(); ++i, ++itemSlot)
+ {
+ if (!i->follow_loot_rules)
+ continue;
+
+ item = sObjectMgr->GetItemTemplate(i->itemid);
+ uint64 newitemGUID = MAKE_NEW_GUID(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM);
+ Roll* r = new Roll(newitemGUID, *i);
+
+ for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
+ {
+ Player* playerToRoll = itr->getSource();
+ if (!playerToRoll || !playerToRoll->GetSession())
+ continue;
+
+ bool allowedForPlayer = i->AllowedForPlayer(playerToRoll);
+ if (allowedForPlayer && playerToRoll->IsWithinDistInMap(lootedObject, sWorld->getFloatConfig(CONFIG_GROUP_XP_DISTANCE), false))
+ {
+ r->totalPlayersRolling++;
+ r->playerVote[playerToRoll->GetGUID()] = NOT_EMITED_YET;
+ }
+ }
+
+ if (r->totalPlayersRolling > 0)
+ {
+ r->setLoot(loot);
+ r->itemSlot = itemSlot;
+
+ loot->quest_items[itemSlot - loot->items.size()].is_blocked = true;
+
+ //Broadcast Pass and Send Rollstart
+ for (Roll::PlayerVote::const_iterator itr = r->playerVote.begin(); itr != r->playerVote.end(); ++itr)
+ {
+ Player* p = ObjectAccessor::FindPlayer(itr->first);
+ if (!p || !p->GetSession())
+ continue;
+
+ if (itr->second == PASS)
+ SendLootRoll(newitemGUID, p->GetGUID(), 128, ROLL_PASS, *r);
+ else
+ SendLootStartRollToPlayer(60000, lootedObject->GetMapId(), p, p->CanRollForItemInLFG(item, lootedObject) == EQUIP_ERR_OK, *r);
+ }
+
+ RollId.push_back(r);
+
+ if (Creature* creature = lootedObject->ToCreature())
+ {
+ creature->m_groupLootTimer = 60000;
+ creature->lootingGroupLowGUID = GetLowGUID();
+ }
+ else if (GameObject* go = lootedObject->ToGameObject())
+ {
+ go->m_groupLootTimer = 60000;
+ go->lootingGroupLowGUID = GetLowGUID();
+ }
+ }
+ else
+ delete r;
+ }
}
void Group::MasterLoot(Loot* /*loot*/, WorldObject* pLootedObject)
@@ -1197,7 +1315,7 @@ void Group::CountTheRoll(Rolls::iterator rollI)
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT, roll->itemid, maxresul);
ItemPosCountVec dest;
- LootItem* item = &(roll->getLoot()->items[roll->itemSlot]);
+ LootItem* item = &(roll->itemSlot >= roll->getLoot()->items.size() ? roll->getLoot()->quest_items[roll->itemSlot - roll->getLoot()->items.size()] : roll->getLoot()->items[roll->itemSlot]);
InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, roll->itemid, item->count);
if (msg == EQUIP_ERR_OK)
{
@@ -1246,7 +1364,7 @@ void Group::CountTheRoll(Rolls::iterator rollI)
{
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT, roll->itemid, maxresul);
- LootItem* item = &(roll->getLoot()->items[roll->itemSlot]);
+ LootItem* item = &(roll->itemSlot >= roll->getLoot()->items.size() ? roll->getLoot()->quest_items[roll->itemSlot - roll->getLoot()->items.size()] : roll->getLoot()->items[roll->itemSlot]);
if (rollvote == GREED)
{
@@ -1283,7 +1401,7 @@ void Group::CountTheRoll(Rolls::iterator rollI)
SendLootAllPassed(*roll);
// remove is_blocked so that the item is lootable by all players
- LootItem* item = &(roll->getLoot()->items[roll->itemSlot]);
+ LootItem* item = &(roll->itemSlot >= roll->getLoot()->items.size() ? roll->getLoot()->quest_items[roll->itemSlot - roll->getLoot()->items.size()] : roll->getLoot()->items[roll->itemSlot]);
if (item)
item->is_blocked = false;
}
diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp
index f1e33aa708b..7fc1660bc7d 100644
--- a/src/server/game/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Handlers/CharacterHandler.cpp
@@ -1584,6 +1584,14 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket &recv_data)
uint64 itemGuid;
recv_data.readPackGUID(itemGuid);
+ // equipment manager sends "1" (as raw GUID) for slots set to "ignore" (don't touch slot at equip set)
+ if (itemGuid == 1)
+ {
+ // ignored slots saved as bit mask because we have no free special values for Items[i]
+ eqSet.IgnoreMask |= 1 << i;
+ continue;
+ }
+
Item* item = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
if (!item && itemGuid) // cheating check 1
@@ -1625,6 +1633,10 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data)
sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "Item " UI64FMTD ": srcbag %u, srcslot %u", itemGuid, srcbag, srcslot);
+ // check if item slot is set to "ignored" (raw value == 1), must not be unequipped then
+ if (itemGuid == 1)
+ continue;
+
Item* item = _player->GetItemByGuid(itemGuid);
uint16 dstpos = i | (INVENTORY_SLOT_BAG_0 << 8);
diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp
index 88d2d6afc53..8128cf72e4a 100755
--- a/src/server/game/Handlers/ItemHandler.cpp
+++ b/src/server/game/Handlers/ItemHandler.cpp
@@ -332,8 +332,8 @@ void WorldSession::SendItemSparseDb2Reply(uint32 entry)
buff << uint32(proto->Quality);
buff << uint32(proto->Flags);
buff << uint32(proto->Flags2);
- buff << float(1.0f);
- buff << float(1.0f);
+ buff << float(proto->Unk430_1);
+ buff << float(proto->Unk430_2);
buff << uint32(proto->BuyCount);
buff << int32(proto->BuyPrice);
buff << uint32(proto->SellPrice);
diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp
index 53e589e31fd..73c8457eb66 100755
--- a/src/server/game/Handlers/LootHandler.cpp
+++ b/src/server/game/Handlers/LootHandler.cpp
@@ -472,16 +472,18 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data)
if (!loot)
return;
- if (slotid > loot->items.size())
+ if (slotid >= loot->items.size() + loot->quest_items.size())
{
sLog->outDebug(LOG_FILTER_LOOT, "MasterLootItem: Player %s might be using a hack! (slot %d, size %lu)", GetPlayer()->GetName(), slotid, (unsigned long)loot->items.size());
return;
}
- LootItem& item = loot->items[slotid];
+ LootItem& item = slotid >= loot->items.size() ? loot->quest_items[slotid - loot->items.size()] : loot->items[slotid];
ItemPosCountVec dest;
InventoryResult msg = target->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item.itemid, item.count);
+ if (item.follow_loot_rules && !item.AllowedForPlayer(target))
+ msg = EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
if (msg != EQUIP_ERR_OK)
{
target->SendEquipError(msg, NULL, NULL, item.itemid);
diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp
index 24338d5f0ad..62ce976f1a8 100755
--- a/src/server/game/Loot/LootMgr.cpp
+++ b/src/server/game/Loot/LootMgr.cpp
@@ -322,6 +322,7 @@ LootItem::LootItem(LootStoreItem const& li)
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemid);
freeforall = proto && (proto->Flags & ITEM_PROTO_FLAG_PARTY_LOOT);
+ follow_loot_rules = proto && (proto->FlagsCu & ITEM_FLAGS_CU_FOLLOW_LOOT_RULES);
needs_quest = li.needs_quest;
@@ -358,12 +359,7 @@ bool LootItem::AllowedForPlayer(Player const* player) const
// check quest requirements
if (!(pProto->FlagsCu & ITEM_FLAGS_CU_IGNORE_QUEST_STATUS) && ((needs_quest || (pProto->StartQuest && player->GetQuestStatus(pProto->StartQuest) != QUEST_STATUS_NONE)) && !player->HasQuestForItem(itemid)))
- if (Group const* group = player->GetGroup())
- {
- if (pProto->Flags & ITEM_PROTO_FLAG_PARTY_LOOT || ((pProto->Flags & ITEM_PROTO_FLAG_PARTY_LOOT) == 0 && (group->GetLootMethod() != MASTER_LOOT || group->GetLooterGuid() != player->GetGUID())))
- return false;
- }
- else return false;
+ return false;
return true;
}
@@ -517,18 +513,19 @@ QuestItemList* Loot::FillQuestLoot(Player* player)
for (uint8 i = 0; i < quest_items.size(); ++i)
{
LootItem &item = quest_items[i];
- if (!item.is_looted && item.AllowedForPlayer(player))
+
+ if (!item.is_looted && (item.AllowedForPlayer(player) || (item.follow_loot_rules && player->GetGroup() && ((player->GetGroup()->GetLootMethod() == MASTER_LOOT && player->GetGroup()->GetLooterGuid() == player->GetGUID()) || player->GetGroup()->GetLootMethod() != MASTER_LOOT ))))
{
ql->push_back(QuestItem(i));
- // questitems get blocked when they first appear in a
+ // quest items get blocked when they first appear in a
// player's quest vector
//
// increase once if one looter only, looter-times if free for all
if (item.freeforall || !item.is_blocked)
++unlootedCount;
-
- item.is_blocked = true;
+ if (!player->GetGroup() || (player->GetGroup()->GetLootMethod() != GROUP_LOOT || player->GetGroup()->GetLootMethod() != ROUND_ROBIN))
+ item.is_blocked = true;
if (items.size() + ql->size() == MAX_NR_LOOT_ITEMS)
break;
@@ -551,7 +548,7 @@ QuestItemList* Loot::FillNonQuestNonFFAConditionalLoot(Player* player, bool pres
for (uint8 i = 0; i < items.size(); ++i)
{
LootItem &item = items[i];
- if (!item.is_looted && !item.freeforall && item.AllowedForPlayer(player))
+ if (!item.is_looted && !item.freeforall && (item.AllowedForPlayer(player) || (item.follow_loot_rules && player->GetGroup() && ((player->GetGroup()->GetLootMethod() == MASTER_LOOT && player->GetGroup()->GetLooterGuid() == player->GetGUID()) || player->GetGroup()->GetLootMethod() != MASTER_LOOT ))))
{
if (presentAtLooting)
item.AddAllowedLooter(player);
@@ -895,7 +892,6 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
}
LootSlotType slotType = lv.permission == OWNER_PERMISSION ? LOOT_SLOT_TYPE_OWNER : LOOT_SLOT_TYPE_ALLOW_LOOT;
- LootSlotType partySlotType = lv.permission == MASTER_PERMISSION ? LOOT_SLOT_TYPE_MASTER : (lv.permission == GROUP_PERMISSION ? LOOT_SLOT_TYPE_ROLL_ONGOING : slotType);
QuestItemMap const& lootPlayerQuestItems = l.GetPlayerQuestItems();
QuestItemMap::const_iterator q_itr = lootPlayerQuestItems.find(lv.viewer->GetGUIDLow());
if (q_itr != lootPlayerQuestItems.end())
@@ -908,8 +904,25 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
{
b << uint8(l.items.size() + (qi - q_list->begin()));
b << item;
- if (!item.freeforall)
- b << uint8(partySlotType);
+ if (item.follow_loot_rules)
+ {
+ switch (lv.permission)
+ {
+ case MASTER_PERMISSION:
+ b << uint8(LOOT_SLOT_TYPE_MASTER);
+ break;
+ case GROUP_PERMISSION:
+ case ROUND_ROBIN_PERMISSION:
+ if (!item.is_blocked)
+ b << uint8(LOOT_SLOT_TYPE_ALLOW_LOOT);
+ else
+ b << uint8(LOOT_SLOT_TYPE_ROLL_ONGOING);
+ break;
+ default:
+ b << uint8(slotType);
+ break;
+ }
+ }
else
b << uint8(slotType);
++itemsShown;
@@ -929,10 +942,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
{
b << uint8(fi->index);
b << item;
- if (!item.freeforall)
- b << uint8(partySlotType);
- else
- b << uint8(slotType);
+ b << uint8(slotType);
++itemsShown;
}
}
@@ -950,8 +960,25 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
{
b << uint8(ci->index);
b << item;
- if (!item.freeforall)
- b << uint8(partySlotType);
+ if (item.follow_loot_rules)
+ {
+ switch (lv.permission)
+ {
+ case MASTER_PERMISSION:
+ b << uint8(LOOT_SLOT_TYPE_MASTER);
+ break;
+ case GROUP_PERMISSION:
+ case ROUND_ROBIN_PERMISSION:
+ if (!item.is_blocked)
+ b << uint8(LOOT_SLOT_TYPE_ALLOW_LOOT);
+ else
+ b << uint8(LOOT_SLOT_TYPE_ROLL_ONGOING);
+ break;
+ default:
+ b << uint8(slotType);
+ break;
+ }
+ }
else
b << uint8(slotType);
++itemsShown;
@@ -1574,9 +1601,9 @@ void LoadLootTemplates_Item()
LootTemplates_Item.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outString(">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outString(">> Loaded %u item loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outErrorDb(">> Loaded 0 prospecting loot templates. DB table `item_loot_template` is empty");
+ sLog->outErrorDb(">> Loaded 0 item loot templates. DB table `item_loot_template` is empty");
sLog->outString();
}
diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h
index 4a6becc7eff..1af5bd1ea62 100755
--- a/src/server/game/Loot/LootMgr.h
+++ b/src/server/game/Loot/LootMgr.h
@@ -140,6 +140,7 @@ struct LootItem
bool is_underthreshold : 1;
bool is_counted : 1;
bool needs_quest : 1; // quest drop
+ bool follow_loot_rules : 1;
// Constructor, copies most fields from LootStoreItem, generates random count and random suffixes/properties
// Should be called for non-reference LootStoreItem entries only (mincountOrRef > 0)
@@ -280,6 +281,7 @@ struct Loot
QuestItemMap const& GetPlayerNonQuestNonFFAConditionalItems() const { return PlayerNonQuestNonFFAConditionalItems; }
std::vector<LootItem> items;
+ std::vector<LootItem> quest_items;
uint32 gold;
uint8 unlootedCount;
uint64 roundRobinPlayer; // GUID of the player having the Round-Robin ownership for the loot. If 0, round robin owner has released.
@@ -344,7 +346,6 @@ struct Loot
QuestItemList* FillQuestLoot(Player* player);
QuestItemList* FillNonQuestNonFFAConditionalLoot(Player* player, bool presentAtLooting);
- std::vector<LootItem> quest_items;
std::set<uint64> PlayersLooting;
QuestItemMap PlayerQuestItems;
QuestItemMap PlayerFFAItems;
diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp
index 58b9c55cdd1..2b99de9d0a2 100755
--- a/src/server/game/Scripting/ScriptLoader.cpp
+++ b/src/server/game/Scripting/ScriptLoader.cpp
@@ -52,10 +52,12 @@ void AddSC_event_commandscript();
void AddSC_gm_commandscript();
void AddSC_go_commandscript();
void AddSC_gobject_commandscript();
+void AddSC_guild_commandscript();
void AddSC_honor_commandscript();
void AddSC_instance_commandscript();
void AddSC_learn_commandscript();
void AddSC_list_commandscript();
+void AddSC_lookup_commandscript();
void AddSC_misc_commandscript();
void AddSC_modify_commandscript();
void AddSC_npc_commandscript();
@@ -660,9 +662,11 @@ void AddCommandScripts()
AddSC_gm_commandscript();
AddSC_go_commandscript();
AddSC_gobject_commandscript();
+ AddSC_guild_commandscript();
AddSC_honor_commandscript();
AddSC_instance_commandscript();
AddSC_learn_commandscript();
+ AddSC_lookup_commandscript();
AddSC_list_commandscript();
AddSC_misc_commandscript();
AddSC_modify_commandscript();
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 9746cac2bbf..4ca9738cfcb 100755
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -673,7 +673,10 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
uint8 cp = caster->ToPlayer()->GetComboPoints();
// Idol of Feral Shadows. Cant be handled as SpellMod in SpellAura:Dummy due its dependency from CPs
- if (AuraEffect const* aurEff = caster->GetAuraEffect(34241, 0))
+ if (AuraEffect const* aurEff = caster->GetAuraEffect(34241, EFFECT_0))
+ amount += cp * aurEff->GetAmount();
+ // Idol of Worship. Cant be handled as SpellMod in SpellAura:Dummy due its dependency from CPs
+ else if (AuraEffect const* aurEff = caster->GetAuraEffect(60774, EFFECT_0))
amount += cp * aurEff->GetAmount();
amount += uint32(CalculatePctU(caster->GetTotalAttackPowerValue(BASE_ATTACK), cp));
diff --git a/src/server/game/Warden/WardenCheckMgr.cpp b/src/server/game/Warden/WardenCheckMgr.cpp
index abd7ff8f87d..0677758439f 100644
--- a/src/server/game/Warden/WardenCheckMgr.cpp
+++ b/src/server/game/Warden/WardenCheckMgr.cpp
@@ -151,6 +151,14 @@ void WardenCheckMgr::LoadWardenChecks()
void WardenCheckMgr::LoadWardenOverrides()
{
+ // Check if Warden is enabled by config before loading anything
+ if (!sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED))
+ {
+ sLog->outString(">> Warden disabled, loading check overrides skipped.");
+ sLog->outString();
+ return;
+ }
+
// 0 1
QueryResult result = CharacterDatabase.Query("SELECT wardenId, action FROM warden_action");
diff --git a/src/server/scripts/Commands/CMakeLists.txt b/src/server/scripts/Commands/CMakeLists.txt
index c27b51a1ca2..2d408e76cd6 100644
--- a/src/server/scripts/Commands/CMakeLists.txt
+++ b/src/server/scripts/Commands/CMakeLists.txt
@@ -19,10 +19,12 @@ set(scripts_STAT_SRCS
Commands/cs_gm.cpp
Commands/cs_go.cpp
Commands/cs_gobject.cpp
+ Commands/cs_guild.cpp
Commands/cs_honor.cpp
Commands/cs_instance.cpp
Commands/cs_learn.cpp
Commands/cs_list.cpp
+ Commands/cs_lookup.cpp
Commands/cs_misc.cpp
Commands/cs_modify.cpp
Commands/cs_npc.cpp
@@ -33,9 +35,7 @@ set(scripts_STAT_SRCS
Commands/cs_server.cpp
Commands/cs_titles.cpp
Commands/cs_wp.cpp
-# Commands/cs_lookup.cpp
# Commands/cs_pdump.cpp
-# Commands/cs_guild.cpp
# Commands/cs_channel.cpp
# Commands/cs_pet.cpp
# Commands/cs_ticket.cpp
diff --git a/src/server/scripts/Commands/cs_guild.cpp b/src/server/scripts/Commands/cs_guild.cpp
new file mode 100644
index 00000000000..65e3daaaebc
--- /dev/null
+++ b/src/server/scripts/Commands/cs_guild.cpp
@@ -0,0 +1,199 @@
+/*
+ * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* ScriptData
+Name: guild_commandscript
+%Complete: 100
+Comment: All guild related commands
+Category: commandscripts
+EndScriptData */
+
+#include "ScriptMgr.h"
+#include "Chat.h"
+#include "Guild.h"
+#include "GuildMgr.h"
+#include "ObjectAccessor.h"
+
+class guild_commandscript : public CommandScript
+{
+public:
+ guild_commandscript() : CommandScript("guild_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand guildCommandTable[] =
+ {
+ { "create", SEC_GAMEMASTER, true, &HandleGuildCreateCommand, "", NULL },
+ { "delete", SEC_GAMEMASTER, true, &HandleGuildDeleteCommand, "", NULL },
+ { "invite", SEC_GAMEMASTER, true, &HandleGuildInviteCommand, "", NULL },
+ { "uninvite", SEC_GAMEMASTER, true, &HandleGuildUninviteCommand, "", NULL },
+ { "rank", SEC_GAMEMASTER, true, &HandleGuildRankCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand commandTable[] =
+ {
+ { "guild", SEC_ADMINISTRATOR, true, NULL, "", guildCommandTable },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ return commandTable;
+ }
+
+ /** \brief GM command level 3 - Create a guild.
+ *
+ * This command allows a GM (level 3) to create a guild.
+ *
+ * The "args" parameter contains the name of the guild leader
+ * and then the name of the guild.
+ *
+ */
+ static bool HandleGuildCreateCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ // if not guild name only (in "") then player name
+ Player* target;
+ if (!handler->extractPlayerTarget(*args != '"' ? (char*)args : NULL, &target))
+ return false;
+
+ char* tailStr = *args != '"' ? strtok(NULL, "") : (char*)args;
+ if (!tailStr)
+ return false;
+
+ char* guildStr = handler->extractQuotedArg(tailStr);
+ if (!guildStr)
+ return false;
+
+ std::string guildName = guildStr;
+
+ if (target->GetGuildId())
+ {
+ handler->SendSysMessage(LANG_PLAYER_IN_GUILD);
+ return true;
+ }
+
+ Guild* guild = new Guild;
+ if (!guild->Create(target, guildName))
+ {
+ delete guild;
+ handler->SendSysMessage(LANG_GUILD_NOT_CREATED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ sGuildMgr->AddGuild(guild);
+
+ return true;
+ }
+
+ static bool HandleGuildDeleteCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char* guildStr = handler->extractQuotedArg((char*)args);
+ if (!guildStr)
+ return false;
+
+ std::string guildName = guildStr;
+
+ Guild* targetGuild = sGuildMgr->GetGuildByName(guildName);
+ if (!targetGuild)
+ return false;
+
+ targetGuild->Disband();
+
+ return true;
+ }
+
+ static bool HandleGuildInviteCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ // if not guild name only (in "") then player name
+ uint64 targetGuid;
+ if (!handler->extractPlayerTarget(*args != '"' ? (char*)args : NULL, NULL, &targetGuid))
+ return false;
+
+ char* tailStr = *args != '"' ? strtok(NULL, "") : (char*)args;
+ if (!tailStr)
+ return false;
+
+ char* guildStr = handler->extractQuotedArg(tailStr);
+ if (!guildStr)
+ return false;
+
+ std::string guildName = guildStr;
+ Guild* targetGuild = sGuildMgr->GetGuildByName(guildName);
+ if (!targetGuild)
+ return false;
+
+ // player's guild membership checked in AddMember before add
+ return targetGuild->AddMember(targetGuid);
+ }
+
+ static bool HandleGuildUninviteCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ uint64 targetGuid;
+ if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid))
+ return false;
+
+ uint32 guildId = target ? target->GetGuildId() : Player::GetGuildIdFromDB(targetGuid);
+ if (!guildId)
+ return false;
+
+ Guild* targetGuild = sGuildMgr->GetGuildById(guildId);
+ if (!targetGuild)
+ return false;
+
+ targetGuild->DeleteMember(targetGuid, false, true);
+ return true;
+ }
+
+ static bool HandleGuildRankCommand(ChatHandler* handler, char const* args)
+ {
+ char* nameStr;
+ char* rankStr;
+ handler->extractOptFirstArg((char*)args, &nameStr, &rankStr);
+ if (!rankStr)
+ return false;
+
+ Player* target;
+ uint64 targetGuid;
+ std::string target_name;
+ if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &target_name))
+ return false;
+
+ uint32 guildId = target ? target->GetGuildId() : Player::GetGuildIdFromDB(targetGuid);
+ if (!guildId)
+ return false;
+
+ Guild* targetGuild = sGuildMgr->GetGuildById(guildId);
+ if (!targetGuild)
+ return false;
+
+ uint8 newRank = uint8(atoi(rankStr));
+ return targetGuild->ChangeMemberRank(targetGuid, newRank);
+ }
+};
+
+void AddSC_guild_commandscript()
+{
+ new guild_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp
index 8dd7f8e2cde..5a0fd28e81a 100644
--- a/src/server/scripts/Commands/cs_list.cpp
+++ b/src/server/scripts/Commands/cs_list.cpp
@@ -80,7 +80,7 @@ public:
char* countStr = strtok(NULL, " ");
uint32 count = countStr ? atol(countStr) : 10;
- if (count < 0)
+ if (count == 0)
return false;
QueryResult result;
@@ -152,7 +152,7 @@ public:
char* countStr = strtok(NULL, " ");
uint32 count = countStr ? atol(countStr) : 10;
- if (count < 0)
+ if (count == 0)
return false;
PreparedQueryResult result;
@@ -369,7 +369,7 @@ public:
char* countStr = strtok(NULL, " ");
uint32 count = countStr ? atol(countStr) : 10;
- if (count < 0)
+ if (count == 0)
return false;
QueryResult result;
diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp
new file mode 100644
index 00000000000..6d42f9b7d21
--- /dev/null
+++ b/src/server/scripts/Commands/cs_lookup.cpp
@@ -0,0 +1,1263 @@
+/*
+ * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* ScriptData
+Name: lookup_commandscript
+%Complete: 100
+Comment: All lookup related commands
+Category: commandscripts
+EndScriptData */
+
+#include "ScriptMgr.h"
+#include "Chat.h"
+#include "AccountMgr.h"
+#include "GameEventMgr.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
+
+class lookup_commandscript : public CommandScript
+{
+public:
+ lookup_commandscript() : CommandScript("lookup_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand lookupPlayerCommandTable[] =
+ {
+ { "ip", SEC_GAMEMASTER, true, &HandleLookupPlayerIpCommand, "", NULL },
+ { "account", SEC_GAMEMASTER, true, &HandleLookupPlayerAccountCommand, "", NULL },
+ { "email", SEC_GAMEMASTER, true, &HandleLookupPlayerEmailCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand lookupCommandTable[] =
+ {
+ { "area", SEC_MODERATOR, true, &HandleLookupAreaCommand, "", NULL },
+ { "creature", SEC_ADMINISTRATOR, true, &HandleLookupCreatureCommand, "", NULL },
+ { "event", SEC_GAMEMASTER, true, &HandleLookupEventCommand, "", NULL },
+ { "faction", SEC_ADMINISTRATOR, true, &HandleLookupFactionCommand, "", NULL },
+ { "item", SEC_ADMINISTRATOR, true, &HandleLookupItemCommand, "", NULL },
+ { "itemset", SEC_ADMINISTRATOR, true, &HandleLookupItemSetCommand, "", NULL },
+ { "object", SEC_ADMINISTRATOR, true, &HandleLookupObjectCommand, "", NULL },
+ { "quest", SEC_ADMINISTRATOR, true, &HandleLookupQuestCommand, "", NULL },
+ { "player", SEC_GAMEMASTER, true, NULL, "", lookupPlayerCommandTable },
+ { "skill", SEC_ADMINISTRATOR, true, &HandleLookupSkillCommand, "", NULL },
+ { "spell", SEC_ADMINISTRATOR, true, &HandleLookupSpellCommand, "", NULL },
+ { "taxinode", SEC_ADMINISTRATOR, true, &HandleLookupTaxiNodeCommand, "", NULL },
+ { "tele", SEC_MODERATOR, true, &HandleLookupTeleCommand, "", NULL },
+ { "title", SEC_GAMEMASTER, true, &HandleLookupTitleCommand, "", NULL },
+ { "map", SEC_ADMINISTRATOR, true, &HandleLookupMapCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand commandTable[] =
+ {
+ { "lookup", SEC_ADMINISTRATOR, true, NULL, "", lookupCommandTable },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ return commandTable;
+ }
+
+ static bool HandleLookupAreaCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string namePart = args;
+ std::wstring wNamePart;
+
+ if (!Utf8toWStr(namePart, wNamePart))
+ return false;
+
+ bool found = false;
+ uint32 count = 0;
+ uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
+
+ // converting string that we try to find to lower case
+ wstrToLower(wNamePart);
+
+ // Search in AreaTable.dbc
+ for (uint32 areaflag = 0; areaflag < sAreaStore.GetNumRows(); ++areaflag)
+ {
+ AreaTableEntry const* areaEntry = sAreaStore.LookupEntry(areaflag);
+ if (areaEntry)
+ {
+ std::string name = areaEntry->area_name;
+ if (name.empty())
+ continue;
+
+ if (!Utf8FitTo(name, wNamePart))
+ continue;
+
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ // send area in "id - [name]" format
+ std::ostringstream ss;
+ if (handler->GetSession())
+ ss << areaEntry->ID << " - |cffffffff|Harea:" << areaEntry->ID << "|h[" << name<< "]|h|r";
+ else
+ ss << areaEntry->ID << " - " << name;
+
+ handler->SendSysMessage(ss.str().c_str());
+
+ if (!found)
+ found = true;
+ }
+ }
+
+ if (!found)
+ handler->SendSysMessage(LANG_COMMAND_NOAREAFOUND);
+
+ return true;
+ }
+
+ static bool HandleLookupCreatureCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string namePart = args;
+ std::wstring wNamePart;
+
+ // converting string that we try to find to lower case
+ if (!Utf8toWStr(namePart, wNamePart))
+ return false;
+
+ wstrToLower(wNamePart);
+
+ bool found = false;
+ uint32 count = 0;
+ uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
+
+ CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates();
+ for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr)
+ {
+ uint32 id = itr->second.Entry;
+ uint8 localeIndex = handler->GetSessionDbLocaleIndex();
+ if (CreatureLocale const* creatureLocale = sObjectMgr->GetCreatureLocale(id))
+ {
+ if (creatureLocale->Name.size() > localeIndex && !creatureLocale->Name[localeIndex].empty())
+ {
+ std::string name = creatureLocale->Name[localeIndex];
+
+ if (Utf8FitTo(name, wNamePart))
+ {
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str());
+ else
+ handler->PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str());
+
+ if (!found)
+ found = true;
+
+ continue;
+ }
+ }
+ }
+
+ std::string name = itr->second.Name;
+ if (name.empty())
+ continue;
+
+ if (Utf8FitTo(name, wNamePart))
+ {
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str());
+ else
+ handler->PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str());
+
+ if (!found)
+ found = true;
+ }
+ }
+
+ if (!found)
+ handler->SendSysMessage(LANG_COMMAND_NOCREATUREFOUND);
+
+ return true;
+ }
+
+ static bool HandleLookupEventCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string namePart = args;
+ std::wstring wNamePart;
+
+ // converting string that we try to find to lower case
+ if (!Utf8toWStr(namePart, wNamePart))
+ return false;
+
+ wstrToLower(wNamePart);
+
+ bool found = false;
+ uint32 count = 0;
+ uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
+
+ GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
+ GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr->GetActiveEventList();
+
+ for (uint32 id = 0; id < events.size(); ++id)
+ {
+ GameEventData const& eventData = events[id];
+
+ std::string descr = eventData.description;
+ if (descr.empty())
+ continue;
+
+ if (Utf8FitTo(descr, wNamePart))
+ {
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ char const* active = activeEvents.find(id) != activeEvents.end() ? handler->GetTrinityString(LANG_ACTIVE) : "";
+
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT, id, id, eventData.description.c_str(), active);
+ else
+ handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, id, eventData.description.c_str(), active);
+
+ if (!found)
+ found = true;
+ }
+ }
+
+ if (!found)
+ handler->SendSysMessage(LANG_NOEVENTFOUND);
+
+ return true;
+ }
+
+ static bool HandleLookupFactionCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ // Can be NULL at console call
+ Player* target = handler->getSelectedPlayer();
+
+ std::string namePart = args;
+ std::wstring wNamePart;
+
+ if (!Utf8toWStr(namePart, wNamePart))
+ return false;
+
+ // converting string that we try to find to lower case
+ wstrToLower (wNamePart);
+
+ bool found = false;
+ uint32 count = 0;
+ uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
+
+ for (uint32 id = 0; id < sFactionStore.GetNumRows(); ++id)
+ {
+ if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(id))
+ {
+ FactionState const* factionState = target ? target->GetReputationMgr().GetState(factionEntry) : NULL;
+
+ std::string name = factionEntry->name;
+ if (name.empty())
+ continue;
+
+ if (!Utf8FitTo(name, wNamePart))
+ continue;
+
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ // send faction in "id - [faction] rank reputation [visible] [at war] [own team] [unknown] [invisible] [inactive]" format
+ // or "id - [faction] [no reputation]" format
+ std::ostringstream ss;
+ if (handler->GetSession())
+ ss << id << " - |cffffffff|Hfaction:" << id << "|h[" << name << "]|h|r";
+ else
+ ss << id << " - " << name;
+
+ if (factionState) // and then target != NULL also
+ {
+ uint32 index = target->GetReputationMgr().GetReputationRankStrIndex(factionEntry);
+ std::string rankName = handler->GetTrinityString(index);
+
+ ss << ' ' << rankName << "|h|r (" << target->GetReputationMgr().GetReputation(factionEntry) << ')';
+
+ if (factionState->Flags & FACTION_FLAG_VISIBLE)
+ ss << handler->GetTrinityString(LANG_FACTION_VISIBLE);
+ if (factionState->Flags & FACTION_FLAG_AT_WAR)
+ ss << handler->GetTrinityString(LANG_FACTION_ATWAR);
+ if (factionState->Flags & FACTION_FLAG_PEACE_FORCED)
+ ss << handler->GetTrinityString(LANG_FACTION_PEACE_FORCED);
+ if (factionState->Flags & FACTION_FLAG_HIDDEN)
+ ss << handler->GetTrinityString(LANG_FACTION_HIDDEN);
+ if (factionState->Flags & FACTION_FLAG_INVISIBLE_FORCED)
+ ss << handler->GetTrinityString(LANG_FACTION_INVISIBLE_FORCED);
+ if (factionState->Flags & FACTION_FLAG_INACTIVE)
+ ss << handler->GetTrinityString(LANG_FACTION_INACTIVE);
+ }
+ else
+ ss << handler->GetTrinityString(LANG_FACTION_NOREPUTATION);
+
+ handler->SendSysMessage(ss.str().c_str());
+
+ if (!found)
+ found = true;
+ }
+ }
+
+ if (!found)
+ handler->SendSysMessage(LANG_COMMAND_FACTION_NOTFOUND);
+ return true;
+ }
+
+ static bool HandleLookupItemCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string namePart = args;
+ std::wstring wNamePart;
+
+ // converting string that we try to find to lower case
+ if (!Utf8toWStr(namePart, wNamePart))
+ return false;
+
+ wstrToLower(wNamePart);
+
+ bool found = false;
+ uint32 count = 0;
+ uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
+
+ // Search in `item_template`
+ ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore();
+ for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr)
+ {
+ int localeIndex = handler->GetSessionDbLocaleIndex();
+ if (localeIndex >= 0)
+ {
+ uint8 ulocaleIndex = uint8(localeIndex);
+ if (ItemLocale const* il = sObjectMgr->GetItemLocale(itr->second.ItemId))
+ {
+ if (il->Name.size() > ulocaleIndex && !il->Name[ulocaleIndex].empty())
+ {
+ std::string name = il->Name[ulocaleIndex];
+
+ if (Utf8FitTo(name, wNamePart))
+ {
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_ITEM_LIST_CHAT, itr->second.ItemId, itr->second.ItemId, name.c_str());
+ else
+ handler->PSendSysMessage(LANG_ITEM_LIST_CONSOLE, itr->second.ItemId, name.c_str());
+
+ if (!found)
+ found = true;
+
+ continue;
+ }
+ }
+ }
+ }
+
+ std::string name = itr->second.Name1;
+ if (name.empty())
+ continue;
+
+ if (Utf8FitTo(name, wNamePart))
+ {
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_ITEM_LIST_CHAT, itr->second.ItemId, itr->second.ItemId, name.c_str());
+ else
+ handler->PSendSysMessage(LANG_ITEM_LIST_CONSOLE, itr->second.ItemId, name.c_str());
+
+ if (!found)
+ found = true;
+ }
+ }
+
+ if (!found)
+ handler->SendSysMessage(LANG_COMMAND_NOITEMFOUND);
+
+ return true;
+ }
+
+ static bool HandleLookupItemSetCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string namePart = args;
+ std::wstring wNamePart;
+
+ if (!Utf8toWStr(namePart, wNamePart))
+ return false;
+
+ // converting string that we try to find to lower case
+ wstrToLower(wNamePart);
+
+ bool found = false;
+ uint32 count = 0;
+ uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
+
+ // Search in ItemSet.dbc
+ for (uint32 id = 0; id < sItemSetStore.GetNumRows(); id++)
+ {
+ ItemSetEntry const* set = sItemSetStore.LookupEntry(id);
+ if (set)
+ {
+ std::string name = set->name;
+ if (name.empty())
+ continue;
+
+ if (!Utf8FitTo(name, wNamePart))
+ continue;
+
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ // send item set in "id - [namedlink locale]" format
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_ITEMSET_LIST_CHAT, id, id, name.c_str(), "");
+ else
+ handler->PSendSysMessage(LANG_ITEMSET_LIST_CONSOLE, id, name.c_str(), "");
+
+ if (!found)
+ found = true;
+ }
+ }
+ if (!found)
+ handler->SendSysMessage(LANG_COMMAND_NOITEMSETFOUND);
+
+ return true;
+ }
+
+ static bool HandleLookupObjectCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string namePart = args;
+ std::wstring wNamePart;
+
+ // converting string that we try to find to lower case
+ if (!Utf8toWStr(namePart, wNamePart))
+ return false;
+
+ wstrToLower(wNamePart);
+
+ bool found = false;
+ uint32 count = 0;
+ uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
+
+ GameObjectTemplateContainer const* gotc = sObjectMgr->GetGameObjectTemplates();
+ for (GameObjectTemplateContainer::const_iterator itr = gotc->begin(); itr != gotc->end(); ++itr)
+ {
+ uint8 localeIndex = handler->GetSessionDbLocaleIndex();
+ if (GameObjectLocale const* objectLocalte = sObjectMgr->GetGameObjectLocale(itr->second.entry))
+ {
+ if (objectLocalte->Name.size() > localeIndex && !objectLocalte->Name[localeIndex].empty())
+ {
+ std::string name = objectLocalte->Name[localeIndex];
+
+ if (Utf8FitTo(name, wNamePart))
+ {
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, itr->second.entry, itr->second.entry, name.c_str());
+ else
+ handler->PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, itr->second.entry, name.c_str());
+
+ if (!found)
+ found = true;
+
+ continue;
+ }
+ }
+ }
+
+ std::string name = itr->second.name;
+ if (name.empty())
+ continue;
+
+ if (Utf8FitTo(name, wNamePart))
+ {
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, itr->second.entry, itr->second.entry, name.c_str());
+ else
+ handler->PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, itr->second.entry, name.c_str());
+
+ if (!found)
+ found = true;
+ }
+ }
+
+ if (!found)
+ handler->SendSysMessage(LANG_COMMAND_NOGAMEOBJECTFOUND);
+
+ return true;
+ }
+
+ static bool HandleLookupQuestCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ // can be NULL at console call
+ Player* target = handler->getSelectedPlayer();
+
+ std::string namePart = args;
+ std::wstring wNamePart;
+
+ // converting string that we try to find to lower case
+ if (!Utf8toWStr(namePart, wNamePart))
+ return false;
+
+ wstrToLower(wNamePart);
+
+ bool found = false;
+ uint32 count = 0;
+ uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
+
+ ObjectMgr::QuestMap const& qTemplates = sObjectMgr->GetQuestTemplates();
+ for (ObjectMgr::QuestMap::const_iterator iter = qTemplates.begin(); iter != qTemplates.end(); ++iter)
+ {
+ Quest* qInfo = iter->second;
+
+ int localeIndex = handler->GetSessionDbLocaleIndex();
+ if (localeIndex >= 0)
+ {
+ uint8 ulocaleIndex = uint8(localeIndex);
+ if (QuestLocale const* questLocale = sObjectMgr->GetQuestLocale(qInfo->GetQuestId()))
+ {
+ if (questLocale->Title.size() > ulocaleIndex && !questLocale->Title[ulocaleIndex].empty())
+ {
+ std::string title = questLocale->Title[ulocaleIndex];
+
+ if (Utf8FitTo(title, wNamePart))
+ {
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ char const* statusStr = "";
+
+ if (target)
+ {
+ QuestStatus status = target->GetQuestStatus(qInfo->GetQuestId());
+
+ switch (status)
+ {
+ case QUEST_STATUS_COMPLETE:
+ statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_COMPLETE);
+ break;
+ case QUEST_STATUS_INCOMPLETE:
+ statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_ACTIVE);
+ break;
+ case QUEST_STATUS_REWARDED:
+ statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_REWARDED);
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_QUEST_LIST_CHAT, qInfo->GetQuestId(), qInfo->GetQuestId(), qInfo->GetQuestLevel(), title.c_str(), statusStr);
+ else
+ handler->PSendSysMessage(LANG_QUEST_LIST_CONSOLE, qInfo->GetQuestId(), title.c_str(), statusStr);
+
+ if (!found)
+ found = true;
+
+ continue;
+ }
+ }
+ }
+ }
+
+ std::string title = qInfo->GetTitle();
+ if (title.empty())
+ continue;
+
+ if (Utf8FitTo(title, wNamePart))
+ {
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ char const* statusStr = "";
+
+ if (target)
+ {
+ QuestStatus status = target->GetQuestStatus(qInfo->GetQuestId());
+
+ switch (status)
+ {
+ case QUEST_STATUS_COMPLETE:
+ statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_COMPLETE);
+ break;
+ case QUEST_STATUS_INCOMPLETE:
+ statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_ACTIVE);
+ break;
+ case QUEST_STATUS_REWARDED:
+ statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_REWARDED);
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_QUEST_LIST_CHAT, qInfo->GetQuestId(), qInfo->GetQuestId(), qInfo->GetQuestLevel(), title.c_str(), statusStr);
+ else
+ handler->PSendSysMessage(LANG_QUEST_LIST_CONSOLE, qInfo->GetQuestId(), title.c_str(), statusStr);
+
+ if (!found)
+ found = true;
+ }
+ }
+
+ if (!found)
+ handler->SendSysMessage(LANG_COMMAND_NOQUESTFOUND);
+
+ return true;
+ }
+
+ static bool HandleLookupSkillCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ // can be NULL in console call
+ Player* target = handler->getSelectedPlayer();
+
+ std::string namePart = args;
+ std::wstring wNamePart;
+
+ if (!Utf8toWStr(namePart, wNamePart))
+ return false;
+
+ // converting string that we try to find to lower case
+ wstrToLower(wNamePart);
+
+ bool found = false;
+ uint32 count = 0;
+ uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
+
+ // Search in SkillLine.dbc
+ for (uint32 id = 0; id < sSkillLineStore.GetNumRows(); id++)
+ {
+ SkillLineEntry const* skillInfo = sSkillLineStore.LookupEntry(id);
+ if (skillInfo)
+ {
+ std::string name = skillInfo->name;
+ if (name.empty())
+ continue;
+
+ if (!Utf8FitTo(name, wNamePart))
+ continue;
+
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ char valStr[50] = "";
+ char const* knownStr = "";
+ if (target && target->HasSkill(id))
+ {
+ knownStr = handler->GetTrinityString(LANG_KNOWN);
+ uint32 curValue = target->GetPureSkillValue(id);
+ uint32 maxValue = target->GetPureMaxSkillValue(id);
+ uint32 permValue = target->GetSkillPermBonusValue(id);
+ uint32 tempValue = target->GetSkillTempBonusValue(id);
+
+ char const* valFormat = handler->GetTrinityString(LANG_SKILL_VALUES);
+ snprintf(valStr, 50, valFormat, curValue, maxValue, permValue, tempValue);
+ }
+
+ // send skill in "id - [namedlink locale]" format
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_SKILL_LIST_CHAT, id, id, name.c_str(), "", knownStr, valStr);
+ else
+ handler->PSendSysMessage(LANG_SKILL_LIST_CONSOLE, id, name.c_str(), "", knownStr, valStr);
+
+ if (!found)
+ found = true;
+ }
+ }
+ if (!found)
+ handler->SendSysMessage(LANG_COMMAND_NOSKILLFOUND);
+
+ return true;
+ }
+
+ static bool HandleLookupSpellCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ // can be NULL at console call
+ Player* target = handler->getSelectedPlayer();
+
+ std::string namePart = args;
+ std::wstring wNamePart;
+
+ if (!Utf8toWStr(namePart, wNamePart))
+ return false;
+
+ // converting string that we try to find to lower case
+ wstrToLower(wNamePart);
+
+ bool found = false;
+ uint32 count = 0;
+ uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
+
+ // Search in Spell.dbc
+ for (uint32 id = 0; id < sSpellMgr->GetSpellInfoStoreSize(); id++)
+ {
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id);
+ if (spellInfo)
+ {
+ std::string name = spellInfo->SpellName;
+ if (name.empty())
+ continue;
+
+ if (!Utf8FitTo(name, wNamePart))
+ continue;
+
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ bool known = target && target->HasSpell(id);
+ bool learn = (spellInfo->Effects[0].Effect == SPELL_EFFECT_LEARN_SPELL);
+
+ SpellInfo const* learnSpellInfo = sSpellMgr->GetSpellInfo(spellInfo->Effects[0].TriggerSpell);
+
+ uint32 talentCost = GetTalentSpellCost(id);
+
+ bool talent = (talentCost > 0);
+ bool passive = spellInfo->IsPassive();
+ bool active = target && target->HasAura(id);
+
+ // unit32 used to prevent interpreting uint8 as char at output
+ // find rank of learned spell for learning spell, or talent rank
+ uint32 rank = talentCost ? talentCost : learn && learnSpellInfo ? learnSpellInfo->GetRank() : spellInfo->GetRank();
+
+ // send spell in "id - [name, rank N] [talent] [passive] [learn] [known]" format
+ std::ostringstream ss;
+ if (handler->GetSession())
+ ss << id << " - |cffffffff|Hspell:" << id << "|h[" << name;
+ else
+ ss << id << " - " << name;
+
+ // include rank in link name
+ if (rank)
+ ss << handler->GetTrinityString(LANG_SPELL_RANK) << rank;
+
+ if (handler->GetSession())
+ ss << "]|h|r";
+
+ if (talent)
+ ss << handler->GetTrinityString(LANG_TALENT);
+ if (passive)
+ ss << handler->GetTrinityString(LANG_PASSIVE);
+ if (learn)
+ ss << handler->GetTrinityString(LANG_LEARN);
+ if (known)
+ ss << handler->GetTrinityString(LANG_KNOWN);
+ if (active)
+ ss << handler->GetTrinityString(LANG_ACTIVE);
+
+ handler->SendSysMessage(ss.str().c_str());
+
+ if (!found)
+ found = true;
+ }
+ }
+ if (!found)
+ handler->SendSysMessage(LANG_COMMAND_NOSPELLFOUND);
+
+ return true;
+ }
+
+ static bool HandleLookupTaxiNodeCommand(ChatHandler* handler, const char * args)
+ {
+ if (!*args)
+ return false;
+
+ std::string namePart = args;
+ std::wstring wNamePart;
+
+ if (!Utf8toWStr(namePart, wNamePart))
+ return false;
+
+ // converting string that we try to find to lower case
+ wstrToLower(wNamePart);
+
+ bool found = false;
+ uint32 count = 0;
+ uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
+
+ // Search in TaxiNodes.dbc
+ for (uint32 id = 0; id < sTaxiNodesStore.GetNumRows(); id++)
+ {
+ TaxiNodesEntry const* nodeEntry = sTaxiNodesStore.LookupEntry(id);
+ if (nodeEntry)
+ {
+ std::string name = nodeEntry->name;
+ if (name.empty())
+ continue;
+
+ if (!Utf8FitTo(name, wNamePart))
+ continue;
+
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ // send taxinode in "id - [name] (Map:m X:x Y:y Z:z)" format
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CHAT, id, id, name.c_str(), "",
+ nodeEntry->map_id, nodeEntry->x, nodeEntry->y, nodeEntry->z);
+ else
+ handler->PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CONSOLE, id, name.c_str(), "",
+ nodeEntry->map_id, nodeEntry->x, nodeEntry->y, nodeEntry->z);
+
+ if (!found)
+ found = true;
+ }
+ }
+ if (!found)
+ handler->SendSysMessage(LANG_COMMAND_NOTAXINODEFOUND);
+
+ return true;
+ }
+
+ // Find tele in game_tele order by name
+ static bool HandleLookupTeleCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ {
+ handler->SendSysMessage(LANG_COMMAND_TELE_PARAMETER);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ char const* str = strtok((char*)args, " ");
+ if (!str)
+ return false;
+
+ std::string namePart = str;
+ std::wstring wNamePart;
+
+ if (!Utf8toWStr(namePart, wNamePart))
+ return false;
+
+ // converting string that we try to find to lower case
+ wstrToLower(wNamePart);
+
+ std::ostringstream reply;
+ uint32 count = 0;
+ uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
+ bool limitReached = false;
+
+ GameTeleContainer const & teleMap = sObjectMgr->GetGameTeleMap();
+ for (GameTeleContainer::const_iterator itr = teleMap.begin(); itr != teleMap.end(); ++itr)
+ {
+ GameTele const* tele = &itr->second;
+
+ if (tele->wnameLow.find(wNamePart) == std::wstring::npos)
+ continue;
+
+ if (maxResults && count++ == maxResults)
+ {
+ limitReached = true;
+ break;
+ }
+
+ if (handler->GetSession())
+ reply << " |cffffffff|Htele:" << itr->first << "|h[" << tele->name << "]|h|r\n";
+ else
+ reply << " " << itr->first << ' ' << tele->name << "\n";
+ }
+
+ if (reply.str().empty())
+ handler->SendSysMessage(LANG_COMMAND_TELE_NOLOCATION);
+ else
+ handler->PSendSysMessage(LANG_COMMAND_TELE_LOCATION, reply.str().c_str());
+
+ if (limitReached)
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+
+ return true;
+ }
+
+ static bool HandleLookupTitleCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ // can be NULL in console call
+ Player* target = handler->getSelectedPlayer();
+
+ // title name have single string arg for player name
+ char const* targetName = target ? target->GetName() : "NAME";
+
+ std::string namePart = args;
+ std::wstring wNamePart;
+
+ if (!Utf8toWStr(namePart, wNamePart))
+ return false;
+
+ // converting string that we try to find to lower case
+ wstrToLower(wNamePart);
+
+ uint32 counter = 0; // Counter for figure out that we found smth.
+ uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
+
+ // Search in CharTitles.dbc
+ for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++)
+ {
+ CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
+ if (titleInfo)
+ {
+ std::string name = titleInfo->name;
+ if (name.empty())
+ continue;
+
+ if (!Utf8FitTo(name, wNamePart))
+ continue;
+
+ if (maxResults && counter == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ char const* knownStr = target && target->HasTitle(titleInfo) ? handler->GetTrinityString(LANG_KNOWN) : "";
+
+ char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index
+ ? handler->GetTrinityString(LANG_ACTIVE)
+ : "";
+
+ char titleNameStr[80];
+ snprintf(titleNameStr, 80, name.c_str(), targetName);
+
+ // send title in "id (idx:idx) - [namedlink locale]" format
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->bit_index, id, titleNameStr, "", knownStr, activeStr);
+ else
+ handler->PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->bit_index, titleNameStr, "", knownStr, activeStr);
+
+ ++counter;
+ }
+ }
+ if (counter == 0) // if counter == 0 then we found nth
+ handler->SendSysMessage(LANG_COMMAND_NOTITLEFOUND);
+
+ return true;
+ }
+
+ static bool HandleLookupMapCommand(ChatHandler* /*handler*/, char const* args)
+ {
+ if (!*args)
+ return false;
+ /*
+ std::string namePart = args;
+ std::wstring wNamePart;
+
+ // converting string that we try to find to lower case
+ if (!Utf8toWStr(namePart, wNamePart))
+ return false;
+
+ wstrToLower(wNamePart);
+
+ bool found = false;
+
+ // search in Map.dbc
+ for (uint32 id = 0; id < sMapStore.GetNumRows(); id++)
+ {
+ MapEntry const* MapInfo = sMapStore.LookupEntry(id);
+ if (MapInfo)
+ {
+ uint8 locale = handler->GetSession() ? handler->GetSession()->GetSessionDbcLocale() : sWorld->GetDefaultDbcLocale();
+
+ std::string name = MapInfo->name[locale];
+ if (name.empty())
+ continue;
+
+ if (!Utf8FitTo(name, wNamePart))
+ {
+ locale = LOCALE_enUS;
+ for (; locale < TOTAL_LOCALES; locale++)
+ {
+ if (handler->GetSession() && locale == handler->GetSession()->GetSessionDbcLocale())
+ continue;
+
+ name = MapInfo->name[locale];
+ if (name.empty())
+ continue;
+
+ if (Utf8FitTo(name, wNamePart))
+ break;
+ }
+ }
+
+ if (locale < TOTAL_LOCALES)
+ {
+ // send map in "id - [name][Continent][Instance/Battleground/Arena][Raid reset time:][Heroic reset time:][Mountable]" format
+ std::ostringstream ss;
+
+ if (handler->GetSession())
+ ss << id << " - |cffffffff|Hmap:" << id << "|h[" << name << ']';
+ else // console
+ ss << id << " - [" << name << ']';
+
+ if (MapInfo->IsContinent())
+ ss << handler->GetTrinityString(LANG_CONTINENT);
+
+ switch (MapInfo->map_type)
+ {
+ case MAP_INSTANCE: ss << handler->GetTrinityString(LANG_INSTANCE); break;
+ case MAP_BATTLEGROUND: ss << handler->GetTrinityString(LANG_BATTLEGROUND); break;
+ case MAP_ARENA: ss << handler->GetTrinityString(LANG_ARENA); break;
+ }
+
+ if (MapInfo->IsRaid())
+ ss << handler->GetTrinityString(LANG_RAID);
+
+ if (MapInfo->SupportsHeroicMode())
+ ss << handler->GetTrinityString(LANG_HEROIC);
+
+ uint32 ResetTimeRaid = MapInfo->resetTimeRaid;
+
+ std::string ResetTimeRaidStr;
+ if (ResetTimeRaid)
+ ResetTimeRaidStr = secsToTimeString(ResetTimeRaid, true, false);
+
+ uint32 ResetTimeHeroic = MapInfo->resetTimeHeroic;
+ std::string ResetTimeHeroicStr;
+ if (ResetTimeHeroic)
+ ResetTimeHeroicStr = secsToTimeString(ResetTimeHeroic, true, false);
+
+ if (MapInfo->IsMountAllowed())
+ ss << handler->GetTrinityString(LANG_MOUNTABLE);
+
+ if (ResetTimeRaid && !ResetTimeHeroic)
+ handler->PSendSysMessage(ss.str().c_str(), ResetTimeRaidStr.c_str());
+ else if (!ResetTimeRaid && ResetTimeHeroic)
+ handler->PSendSysMessage(ss.str().c_str(), ResetTimeHeroicStr.c_str());
+ else if (ResetTimeRaid && ResetTimeHeroic)
+ handler->PSendSysMessage(ss.str().c_str(), ResetTimeRaidStr.c_str(), ResetTimeHeroicStr.c_str());
+ else
+ handler->SendSysMessage(ss.str().c_str());
+
+ if (!found)
+ found = true;
+ }
+ }
+ }
+
+ if (!found)
+ handler->SendSysMessage(LANG_COMMAND_NOMAPFOUND);
+ */
+ return true;
+ }
+
+ static bool HandleLookupPlayerIpCommand(ChatHandler* handler, char const* args)
+ {
+ std::string ip;
+ int32 limit;
+ char* limitStr;
+
+ Player* target = handler->getSelectedPlayer();
+ if (!*args)
+ {
+ // NULL only if used from console
+ if (!target || target == handler->GetSession()->GetPlayer())
+ return false;
+
+ ip = target->GetSession()->GetRemoteAddress();
+ limit = -1;
+ }
+ else
+ {
+ ip = strtok((char*)args, " ");
+ limitStr = strtok(NULL, " ");
+ limit = limitStr ? atoi(limitStr) : -1;
+ }
+
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BY_IP);
+ stmt->setString(0, ip);
+ PreparedQueryResult result = LoginDatabase.Query(stmt);
+
+ return LookupPlayerSearchCommand(result, limit, handler);
+ }
+
+ static bool HandleLookupPlayerAccountCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string account = strtok((char*)args, " ");
+ char* limitStr = strtok(NULL, " ");
+ int32 limit = limitStr ? atoi(limitStr) : -1;
+
+ if (!AccountMgr::normalizeString
+ (account))
+ return false;
+
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_LIST_BY_NAME);
+ stmt->setString(0, account);
+ PreparedQueryResult result = LoginDatabase.Query(stmt);
+
+ return LookupPlayerSearchCommand(result, limit, handler);
+ }
+
+ static bool HandleLookupPlayerEmailCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string email = strtok((char*)args, " ");
+ char* limitStr = strtok(NULL, " ");
+ int32 limit = limitStr ? atoi(limitStr) : -1;
+
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_LIST_BY_EMAIL);
+ stmt->setString(0, email);
+ PreparedQueryResult result = LoginDatabase.Query(stmt);
+
+ return LookupPlayerSearchCommand(result, limit, handler);
+ }
+
+ static bool LookupPlayerSearchCommand(PreparedQueryResult result, int32 limit, ChatHandler* handler)
+ {
+ if (!result)
+ {
+ handler->PSendSysMessage(LANG_NO_PLAYERS_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ int32 counter = 0;
+ uint32 count = 0;
+ uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
+
+ do
+ {
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ Field* fields = result->Fetch();
+ uint32 accountId = fields[0].GetUInt32();
+ std::string accountName = fields[1].GetString();
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_GUID_NAME_BY_ACC);
+ stmt->setUInt32(0, accountId);
+ PreparedQueryResult result2 = CharacterDatabase.Query(stmt);
+
+ if (result2)
+ {
+ handler->PSendSysMessage(LANG_LOOKUP_PLAYER_ACCOUNT, accountName.c_str(), accountId);
+
+ do
+ {
+ Field* characterFields = result2->Fetch();
+ uint64 guid = characterFields[0].GetUInt64();
+ std::string name = characterFields[1].GetString();
+
+ handler->PSendSysMessage(LANG_LOOKUP_PLAYER_CHARACTER, name.c_str(), guid);
+ ++counter;
+ }
+ while (result2->NextRow() && (limit == -1 || counter < limit));
+ }
+ }
+ while (result->NextRow());
+
+ if (counter == 0) // empty accounts only
+ {
+ handler->PSendSysMessage(LANG_NO_PLAYERS_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ return true;
+ }
+};
+
+void AddSC_lookup_commandscript()
+{
+ new lookup_commandscript();
+}
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
index 2bba875ad1f..d8be6ffc0ca 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
@@ -79,6 +79,12 @@ public:
void Reset()
{
+ ResetTimer = 0;
+ }
+
+ void EnterEvadeMode()
+ {
+ ScriptedAI::EnterEvadeMode();
ResetTimer = 2000;
}
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
index d091a87dbfe..367240cd2df 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
@@ -1296,7 +1296,7 @@ class npc_dark_nucleus : public CreatureScript
void Reset()
{
- me->SetReactState(REACT_PASSIVE);
+ me->SetReactState(REACT_DEFENSIVE);
me->CastSpell(me, SPELL_SHADOW_RESONANCE_AURA, true);
}
@@ -1315,15 +1315,12 @@ class npc_dark_nucleus : public CreatureScript
void MoveInLineOfSight(Unit* who)
{
- if (me->GetDistance(who) >= 15.0f)
- return;
-
ScriptedAI::MoveInLineOfSight(who);
}
void DamageTaken(Unit* attacker, uint32& /*damage*/)
{
- if (attacker == me || attacker == me->getVictim())
+ if (attacker == me)
return;
me->DeleteThreatList();
@@ -1345,6 +1342,8 @@ class npc_dark_nucleus : public CreatureScript
DoCast(victim, SPELL_SHADOW_RESONANCE_RESIST);
me->ClearUnitState(UNIT_STATE_CASTING);
}
+ else
+ MoveInLineOfSight(me->getVictim());
}
else
_targetAuraCheck -= diff;
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
index 0454274401c..5b5c3ff2326 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
@@ -26,6 +26,7 @@ EndScriptData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "the_eye.h"
@@ -501,9 +502,9 @@ class spell_astromancer_wrath_of_the_astromancer : public SpellScriptLoader
public:
spell_astromancer_wrath_of_the_astromancer() : SpellScriptLoader("spell_astromancer_wrath_of_the_astromancer") { }
- class spell_astromancer_wrath_of_the_astromancer_SpellScript : public SpellScript
+ class spell_astromancer_wrath_of_the_astromancer_AuraScript : public AuraScript
{
- PrepareSpellScript(spell_astromancer_wrath_of_the_astromancer_SpellScript);
+ PrepareAuraScript(spell_astromancer_wrath_of_the_astromancer_AuraScript);
bool Validate(SpellInfo const* /*SpellEntry*/)
{
@@ -512,50 +513,25 @@ class spell_astromancer_wrath_of_the_astromancer : public SpellScriptLoader
return true;
}
- bool Load()
+ void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
- _targetCount = 0;
- return true;
- }
-
- void CountTargets(std::list<WorldObject*>& targetList)
- {
- _targetCount = targetList.size();
- }
-
- void HandleDummy(SpellEffIndex /* effIndex */)
- {
- if (Unit* caster = GetOriginalCaster())
- if (Unit* target = GetHitUnit())
- {
- if (!target->isAlive() || !_targetCount)
- return;
-
- int32 damage = 10000 / _targetCount;
-
- SpellNonMeleeDamage damageInfo(caster, target, GetSpellInfo()->Id, GetSpellInfo()->SchoolMask);
- damageInfo.damage = damage;
+ // Final heal only on duration end
+ if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
+ return;
- caster->CalcAbsorbResist(target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &damageInfo.absorb, &damageInfo.resist, GetSpellInfo());
- caster->DealDamageMods(target, damageInfo.damage, &damageInfo.absorb);
- caster->SendSpellNonMeleeDamageLog(&damageInfo);
- caster->DealSpellDamage(&damageInfo, false);
- }
+ Unit* target = GetUnitOwner();
+ target->CastSpell(target, GetSpellInfo()->Effects[EFFECT_1].CalcValue(),false);
}
- private:
- int32 _targetCount;
-
void Register()
{
- OnEffectHitTarget += SpellEffectFn(spell_astromancer_wrath_of_the_astromancer_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
- OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_astromancer_wrath_of_the_astromancer_SpellScript::CountTargets, EFFECT_0, TARGET_DEST_CASTER_RADIUS);
+ AfterEffectRemove += AuraEffectRemoveFn(spell_astromancer_wrath_of_the_astromancer_AuraScript::AfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
}
};
- SpellScript* GetSpellScript() const
+ AuraScript* GetAuraScript() const
{
- return new spell_astromancer_wrath_of_the_astromancer_SpellScript();
+ return new spell_astromancer_wrath_of_the_astromancer_AuraScript();
}
};
diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp
index 5095092927e..a1c48878507 100644
--- a/src/server/scripts/Spells/spell_dk.cpp
+++ b/src/server/scripts/Spells/spell_dk.cpp
@@ -40,7 +40,7 @@ enum DeathKnightSpells
DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED = 63611,
DK_SPELL_UNHOLY_PRESENCE = 48265,
DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED = 63622,
- SPELL_DK_ITEM_T8_MALEE_4P_BONUS = 64736,
+ SPELL_DK_ITEM_T8_MELEE_4P_BONUS = 64736,
DK_SPELL_BLACK_ICE_R1 = 49140,
};
@@ -412,7 +412,7 @@ class spell_dk_scourge_strike : public SpellScriptLoader
{
multiplier = (GetEffectValue() * unitTarget->GetDiseasesByCaster(caster->GetGUID()) / 100.f);
// Death Knight T8 Melee 4P Bonus
- if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_DK_ITEM_T8_MALEE_4P_BONUS, EFFECT_0))
+ if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_DK_ITEM_T8_MELEE_4P_BONUS, EFFECT_0))
AddPctF(multiplier, aurEff->GetAmount());
}
}
diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp
index f34e9e772f3..672e4ee96d5 100644
--- a/src/server/scripts/Spells/spell_druid.cpp
+++ b/src/server/scripts/Spells/spell_druid.cpp
@@ -32,7 +32,8 @@ enum DruidSpells
DRUID_LIFEBLOOM_FINAL_HEAL = 33778,
DRUID_LIFEBLOOM_ENERGIZE = 64372,
DRUID_SURVIVAL_INSTINCTS = 50322,
- DRUID_SAVAGE_ROAR = 62071
+ DRUID_SAVAGE_ROAR = 62071,
+ SPELL_DRUID_ITEM_T8_BALANCE_RELIC = 64950,
};
// 54846 Glyph of Starfire
@@ -615,6 +616,34 @@ class spell_dru_survival_instincts : public SpellScriptLoader
}
};
+class spell_dru_insect_swarm : public SpellScriptLoader
+{
+ public:
+ spell_dru_insect_swarm() : SpellScriptLoader("spell_dru_insect_swarm") { }
+
+ class spell_dru_insect_swarm_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_dru_insect_swarm_AuraScript);
+
+ void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
+ {
+ if (Unit* caster = GetCaster())
+ if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_DRUID_ITEM_T8_BALANCE_RELIC, EFFECT_0))
+ amount += aurEff->GetAmount();
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_insect_swarm_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_dru_insect_swarm_AuraScript();
+ }
+};
+
void AddSC_druid_spell_scripts()
{
new spell_dru_glyph_of_starfire();
@@ -629,4 +658,5 @@ void AddSC_druid_spell_scripts()
new spell_dru_predatory_strikes();
new spell_dru_savage_roar();
new spell_dru_survival_instincts();
+ new spell_dru_insect_swarm();
}
diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp
index e3714a22304..5648c510413 100644
--- a/src/server/scripts/Spells/spell_quest.cpp
+++ b/src/server/scripts/Spells/spell_quest.cpp
@@ -1217,15 +1217,20 @@ class spell_q12735_song_of_cleansing : public SpellScriptLoader
void HandleScript(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
-
- if (caster && caster->GetAreaId() == AREA_BITTERTIDELAKE)
- caster->CastSpell(caster, SPELL_SUMMON_SPIRIT_ATAH);
-
- else if (caster && caster->GetAreaId() == AREA_RIVERSHEART)
- caster->CastSpell(caster, SPELL_SUMMON_SPIRIT_HAKHALAN);
-
- else if (caster && caster->GetAreaId() == AREA_WINTERGRASPRIVER)
- caster->CastSpell(caster, SPELL_SUMMON_SPIRIT_KOOSU);
+ switch (caster->GetAreaId())
+ {
+ case AREA_BITTERTIDELAKE:
+ caster->CastSpell(caster, SPELL_SUMMON_SPIRIT_ATAH);
+ break;
+ case AREA_RIVERSHEART:
+ caster->CastSpell(caster, SPELL_SUMMON_SPIRIT_HAKHALAN);
+ break;
+ case AREA_WINTERGRASPRIVER:
+ caster->CastSpell(caster, SPELL_SUMMON_SPIRIT_KOOSU);
+ break;
+ default:
+ break;
+ }
}
void Register()
diff --git a/src/server/shared/Cryptography/ARC4.cpp b/src/server/shared/Cryptography/ARC4.cpp
index 52a60573eca..5b2cf7a0a93 100755
--- a/src/server/shared/Cryptography/ARC4.cpp
+++ b/src/server/shared/Cryptography/ARC4.cpp
@@ -19,14 +19,14 @@
#include "ARC4.h"
#include <openssl/sha.h>
-ARC4::ARC4(uint8 len)
+ARC4::ARC4(uint8 len) : m_ctx()
{
EVP_CIPHER_CTX_init(&m_ctx);
EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULL, NULL, NULL);
EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
}
-ARC4::ARC4(uint8 *seed, uint8 len)
+ARC4::ARC4(uint8 *seed, uint8 len) : m_ctx()
{
EVP_CIPHER_CTX_init(&m_ctx);
EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULL, NULL, NULL);
diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
index b5c42f560ae..880794d14d5 100755
--- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp
+++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
@@ -94,7 +94,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(CHAR_SEL_GUILD_MEMBER, "SELECT guildid, rank FROM guild_member WHERE guid = ?", CONNECTION_BOTH)
PREPARE_STATEMENT(CHAR_SEL_CHARACTER_ACHIEVEMENTS, "SELECT achievement, date FROM character_achievement WHERE guid = ?", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_SEL_CHARACTER_CRITERIAPROGRESS, "SELECT criteria, counter, date FROM character_achievement_progress WHERE guid = ?", CONNECTION_ASYNC)
- PREPARE_STATEMENT(CHAR_SEL_CHARACTER_EQUIPMENTSETS, "SELECT setguid, setindex, name, iconname, item0, item1, item2, item3, item4, item5, item6, item7, item8, "
+ PREPARE_STATEMENT(CHAR_SEL_CHARACTER_EQUIPMENTSETS, "SELECT setguid, setindex, name, iconname, ignore_mask, item0, item1, item2, item3, item4, item5, item6, item7, item8, "
"item9, item10, item11, item12, item13, item14, item15, item16, item17, item18 FROM character_equipmentsets WHERE guid = ? ORDER BY setindex", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_SEL_CHARACTER_BGDATA, "SELECT instanceId, team, joinX, joinY, joinZ, joinO, joinMapId, taxiStart, taxiEnd, mountSpell FROM character_battleground_data WHERE guid = ?", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_SEL_CHARACTER_GLYPHS, "SELECT spec, glyph1, glyph2, glyph3, glyph4, glyph5, glyph6 FROM character_glyphs WHERE guid = ?", CONNECTION_ASYNC)
@@ -246,8 +246,8 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(CHAR_DEL_OLD_CHANNELS, "DELETE FROM channels WHERE ownership = 1 AND lastUsed + ? < UNIX_TIMESTAMP()", CONNECTION_ASYNC)
// Equipmentsets
- PREPARE_STATEMENT(CHAR_UPD_EQUIP_SET, "UPDATE character_equipmentsets SET name=?, iconname=?, item0=?, item1=?, item2=?, item3=?, item4=?, item5=?, item6=?, item7=?, item8=?, item9=?, item10=?, item11=?, item12=?, item13=?, item14=?, item15=?, item16=?, item17=?, item18=? WHERE guid=? AND setguid=? AND setindex=?", CONNECTION_ASYNC)
- PREPARE_STATEMENT(CHAR_INS_EQUIP_SET, "INSERT INTO character_equipmentsets (guid, setguid, setindex, name, iconname, item0, item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16, item17, item18) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC)
+ PREPARE_STATEMENT(CHAR_UPD_EQUIP_SET, "UPDATE character_equipmentsets SET name=?, iconname=?, ignore_mask=?, item0=?, item1=?, item2=?, item3=?, item4=?, item5=?, item6=?, item7=?, item8=?, item9=?, item10=?, item11=?, item12=?, item13=?, item14=?, item15=?, item16=?, item17=?, item18=? WHERE guid=? AND setguid=? AND setindex=?", CONNECTION_ASYNC)
+ PREPARE_STATEMENT(CHAR_INS_EQUIP_SET, "INSERT INTO character_equipmentsets (guid, setguid, setindex, name, iconname, ignore_mask, item0, item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16, item17, item18) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_DEL_EQUIP_SET, "DELETE FROM character_equipmentsets WHERE setguid=?", CONNECTION_ASYNC)
// Auras