diff options
| author | Shauren <shauren.trinity@gmail.com> | 2016-07-19 19:31:54 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2016-07-19 19:31:54 +0200 |
| commit | 836221aaf5420afe8ff4719780426251c222b87d (patch) | |
| tree | 12a66ff491e38f75bb922c21616b93fd24b85ddf /src/server/scripts | |
| parent | cc07a491f64fa958c8a27079bd2def84c577f816 (diff) | |
| parent | d463273ab1c8efb9dd6000ee5cb8f780574cdd1e (diff) | |
Merge branch 'legion' into 6.x
Diffstat (limited to 'src/server/scripts')
26 files changed, 442 insertions, 294 deletions
diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp index 6f59e6e40da..b482716e059 100644 --- a/src/server/scripts/Commands/cs_character.cpp +++ b/src/server/scripts/Commands/cs_character.cpp @@ -270,7 +270,7 @@ public: if (titleInfo && target->HasTitle(titleInfo)) { - std::string name = target->getGender() == GENDER_MALE ? titleInfo->NameMale_lang : titleInfo->NameFemale_lang; + std::string name = (target->getGender() == GENDER_MALE ? titleInfo->NameMale : titleInfo->NameFemale)->Str[handler->GetSessionDbcLocale()]; if (name.empty()) continue; @@ -559,7 +559,7 @@ public: { FactionState const& faction = itr->second; FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction.ID); - char const* factionName = factionEntry ? factionEntry->Name_lang : "#Not found#"; + char const* factionName = factionEntry ? factionEntry->Name->Str[loc] : "#Not found#"; ReputationRank rank = target->GetReputationMgr().GetRank(factionEntry); std::string rankName = handler->GetTrinityString(ReputationRankStrIndex[rank]); std::ostringstream ss; diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index b2094df08ef..0956b25dcdc 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -171,7 +171,7 @@ public: uint32 soundId = atoi((char*)args); - if (!sSoundEntriesStore.LookupEntry(soundId)) + if (!sSoundKitStore.LookupEntry(soundId)) { handler->PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId); handler->SetSentErrorMessage(true); @@ -214,8 +214,8 @@ public: char* fail2 = strtok(NULL, " "); uint8 failArg2 = fail2 ? (uint8)atoi(fail2) : 0; - WorldPackets::Spells::CastFailed castFailed(SMSG_CAST_FAILED); - castFailed.CastID = 0; + WorldPackets::Spells::CastFailed castFailed; + castFailed.CastID = ObjectGuid::Empty; castFailed.SpellID = 133; castFailed.Reason = failNum; castFailed.FailedArg1 = failArg1; @@ -1540,11 +1540,11 @@ public: if (difficulty == -1) for (uint8 diff = 0; diff < MAX_DIFFICULTY; ++diff) { - if (GetMapDifficultyData(mEntry->ID, Difficulty(diff))) - sInstanceSaveMgr->ForceGlobalReset(mEntry->ID, Difficulty(diff)); + if (sDB2Manager.GetMapDifficultyData(map, Difficulty(diff))) + sInstanceSaveMgr->ForceGlobalReset(map, Difficulty(diff)); } else - sInstanceSaveMgr->ForceGlobalReset(mEntry->ID, Difficulty(difficulty)); + sInstanceSaveMgr->ForceGlobalReset(map, Difficulty(difficulty)); return true; } }; diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp index 081280532fb..05b6a5c9713 100644 --- a/src/server/scripts/Commands/cs_go.cpp +++ b/src/server/scripts/Commands/cs_go.cpp @@ -504,12 +504,12 @@ public: if (map->Instanceable()) { - handler->PSendSysMessage(LANG_INVALID_ZONE_MAP, areaEntry->ID, areaEntry->AreaName_lang, map->GetId(), map->GetMapName()); + handler->PSendSysMessage(LANG_INVALID_ZONE_MAP, areaId, areaEntry->AreaName->Str[handler->GetSessionDbcLocale()], map->GetId(), map->GetMapName()); handler->SetSentErrorMessage(true); return false; } - Zone2MapCoordinates(x, y, zoneEntry->ID); + sDB2Manager.Zone2MapCoordinates(areaEntry->ParentAreaID ? uint32(areaEntry->ParentAreaID) : areaId, x, y); if (!MapManager::IsValidMapCoord(zoneEntry->MapID, x, y)) { diff --git a/src/server/scripts/Commands/cs_group.cpp b/src/server/scripts/Commands/cs_group.cpp index 33356409f17..47588000173 100644 --- a/src/server/scripts/Commands/cs_group.cpp +++ b/src/server/scripts/Commands/cs_group.cpp @@ -352,7 +352,7 @@ public: { AreaTableEntry const* zone = sAreaTableStore.LookupEntry(area->ParentAreaID); if (zone) - zoneName = zone->AreaName_lang; + zoneName = zone->AreaName->Str[handler->GetSessionDbcLocale()]; } } else diff --git a/src/server/scripts/Commands/cs_learn.cpp b/src/server/scripts/Commands/cs_learn.cpp index 16e94242021..5f31d7f806f 100644 --- a/src/server/scripts/Commands/cs_learn.cpp +++ b/src/server/scripts/Commands/cs_learn.cpp @@ -325,7 +325,7 @@ public: if ((skillInfo->CategoryID == SKILL_CATEGORY_PROFESSION || skillInfo->CategoryID == SKILL_CATEGORY_SECONDARY) && skillInfo->CanLink) // only prof. with recipes have { - HandleLearnSkillRecipesHelper(target, skillInfo->ID); + HandleLearnSkillRecipesHelper(target, i); } } @@ -358,7 +358,7 @@ public: std::string name; - SkillLineEntry const* targetSkillInfo = NULL; + uint32 skillId = 0; for (uint32 i = 1; i < sSkillLineStore.GetNumRows(); ++i) { SkillLineEntry const* skillInfo = sSkillLineStore.LookupEntry(i); @@ -370,23 +370,42 @@ public: !skillInfo->CanLink) // only prof with recipes have set continue; - name = skillInfo->DisplayName_lang; + int locale = handler->GetSessionDbcLocale(); + name = skillInfo->DisplayName->Str[locale]; if (name.empty()) continue; if (!Utf8FitTo(name, namePart)) - continue; + { + locale = 0; + for (; locale < TOTAL_LOCALES; ++locale) + { + if (locale == handler->GetSessionDbcLocale()) + continue; - targetSkillInfo = skillInfo; + name = skillInfo->DisplayName->Str[locale]; + if (name.empty()) + continue; + + if (Utf8FitTo(name, namePart)) + break; + } + } + + if (locale < TOTAL_LOCALES) + { + skillId = i; + break; + } } - if (!targetSkillInfo) + if (!skillId) return false; - HandleLearnSkillRecipesHelper(target, targetSkillInfo->ID); + HandleLearnSkillRecipesHelper(target, skillId); - uint16 maxLevel = target->GetPureMaxSkillValue(targetSkillInfo->ID); - target->SetSkill(targetSkillInfo->ID, target->GetSkillStep(targetSkillInfo->ID), maxLevel, maxLevel); + uint16 maxLevel = target->GetPureMaxSkillValue(skillId); + target->SetSkill(skillId, target->GetSkillStep(skillId), maxLevel, maxLevel); handler->PSendSysMessage(LANG_COMMAND_LEARN_ALL_RECIPES, name.c_str()); return true; } diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp index 67c89a2f10c..b66fc95c407 100644 --- a/src/server/scripts/Commands/cs_list.cpp +++ b/src/server/scripts/Commands/cs_list.cpp @@ -436,7 +436,7 @@ public: AuraApplication const* aurApp = itr->second; Aura const* aura = aurApp->GetBase(); - char const* name = aura->GetSpellInfo()->SpellName; + char const* name = aura->GetSpellInfo()->SpellName->Str[handler->GetSessionDbcLocale()]; bool talent = aura->GetSpellInfo()->HasAttribute(SPELL_ATTR0_CU_IS_TALENT); std::ostringstream ss_name; diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp index 57bf557771b..01844aa937e 100644 --- a/src/server/scripts/Commands/cs_lookup.cpp +++ b/src/server/scripts/Commands/cs_lookup.cpp @@ -102,30 +102,48 @@ public: AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(i); if (areaEntry) { - std::string name = areaEntry->AreaName_lang; + int32 locale = handler->GetSessionDbcLocale(); + std::string name = areaEntry->AreaName->Str[locale]; if (name.empty()) continue; if (!Utf8FitTo(name, wNamePart)) - continue; - - if (maxResults && count++ == maxResults) { - handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; + locale = 0; + for (; locale < TOTAL_LOCALES; ++locale) + { + if (locale == handler->GetSessionDbcLocale()) + continue; + + name = areaEntry->AreaName->Str[locale]; + if (name.empty()) + continue; + + if (Utf8FitTo(name, wNamePart)) + break; + } } - // send area in "id - [name]" format - std::ostringstream ss; - if (handler->GetSession()) - ss << i << " - |cffffffff|Harea:" << i << "|h[" << name<< "]|h|r"; - else - ss << i << " - " << name; + if (locale < TOTAL_LOCALES) + { + if (maxResults && count++ == maxResults) + { + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } - handler->SendSysMessage(ss.str().c_str()); + // send area in "id - [name]" format + std::ostringstream ss; + if (handler->GetSession()) + ss << i << " - |cffffffff|Harea:" << i << "|h[" << name << "]|h|r"; + else + ss << i << " - " << name; - if (!found) - found = true; + handler->SendSysMessage(ss.str().c_str()); + + if (!found) + found = true; + } } } @@ -291,58 +309,77 @@ public: for (uint32 id = 0; id < sFactionStore.GetNumRows(); ++id) { - if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(id)) + FactionEntry const* factionEntry = sFactionStore.LookupEntry(id); + if (factionEntry) { FactionState const* factionState = target ? target->GetReputationMgr().GetState(factionEntry) : NULL; - std::string name = factionEntry->Name_lang; + int locale = handler->GetSessionDbcLocale(); + std::string name = factionEntry->Name->Str[locale]; if (name.empty()) continue; if (!Utf8FitTo(name, wNamePart)) - continue; - - if (maxResults && count++ == maxResults) { - handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } + locale = 0; + for (; locale < TOTAL_LOCALES; ++locale) + { + if (locale == handler->GetSessionDbcLocale()) + continue; - // 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; + name = factionEntry->Name->Str[locale]; + if (name.empty()) + continue; - 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); + if (Utf8FitTo(name, wNamePart)) + break; + } } - else - ss << handler->GetTrinityString(LANG_FACTION_NOREPUTATION); - handler->SendSysMessage(ss.str().c_str()); + if (locale < TOTAL_LOCALES) + { + 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 << ' ' << localeNames[locale] << "]|h|r"; + else + ss << id << " - " << name << ' ' << localeNames[locale]; + + 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); - if (!found) - found = true; + handler->SendSysMessage(ss.str().c_str()); + + if (!found) + found = true; + } } } @@ -425,27 +462,45 @@ public: ItemSetEntry const* set = sItemSetStore.LookupEntry(id); if (set) { - std::string name = set->Name_lang; + int32 locale = handler->GetSessionDbcLocale(); + std::string name = set->Name->Str[locale]; if (name.empty()) continue; if (!Utf8FitTo(name, wNamePart)) - continue; - - if (maxResults && count++ == maxResults) { - handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; + locale = 0; + for (; locale < TOTAL_LOCALES; ++locale) + { + if (locale == handler->GetSessionDbcLocale()) + continue; + + name = set->Name->Str[locale]; + if (name.empty()) + continue; + + if (Utf8FitTo(name, wNamePart)) + break; + } } - // 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 (locale < TOTAL_LOCALES) + { + if (maxResults && count++ == maxResults) + { + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } - if (!found) - found = 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) @@ -688,41 +743,59 @@ public: SkillLineEntry const* skillInfo = sSkillLineStore.LookupEntry(id); if (skillInfo) { - std::string name = skillInfo->DisplayName_lang; + int locale = handler->GetSessionDbcLocale(); + std::string name = skillInfo->DisplayName->Str[locale]; if (name.empty()) continue; if (!Utf8FitTo(name, wNamePart)) - continue; - - if (maxResults && count++ == maxResults) { - handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; + locale = 0; + for (; locale < TOTAL_LOCALES; ++locale) + { + if (locale == handler->GetSessionDbcLocale()) + continue; + + name = skillInfo->DisplayName->Str[locale]; + if (name.empty()) + continue; + + if (Utf8FitTo(name, wNamePart)) + break; + } } - char valStr[50] = ""; - char const* knownStr = ""; - if (target && target->HasSkill(id)) + if (locale < TOTAL_LOCALES) { - 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); - } + if (maxResults && count++ == maxResults) + { + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } - // 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); + 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); + } - if (!found) - found = true; + // 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) @@ -758,63 +831,81 @@ public: SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id); if (spellInfo) { - std::string name = spellInfo->SpellName; + int locale = handler->GetSessionDbcLocale(); + std::string name = spellInfo->SpellName->Str[locale]; if (name.empty()) continue; if (!Utf8FitTo(name, wNamePart)) - continue; - - if (maxResults && count++ == maxResults) { - handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; + locale = 0; + for (; locale < TOTAL_LOCALES; ++locale) + { + if (locale == handler->GetSessionDbcLocale()) + continue; + + name = spellInfo->SpellName->Str[locale]; + if (name.empty()) + continue; + + if (Utf8FitTo(name, wNamePart)) + break; + } } - bool known = target && target->HasSpell(id); + if (locale < TOTAL_LOCALES) + { + if (maxResults && count++ == maxResults) + { + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } - SpellEffectInfo const* effect = spellInfo->GetEffect(EFFECT_0); - bool learn = effect ? (effect->Effect == SPELL_EFFECT_LEARN_SPELL) : false; + bool known = target && target->HasSpell(id); - SpellInfo const* learnSpellInfo = effect ? sSpellMgr->GetSpellInfo(effect->TriggerSpell) : NULL; + SpellEffectInfo const* effect = spellInfo->GetEffect(EFFECT_0); + bool learn = effect ? (effect->Effect == SPELL_EFFECT_LEARN_SPELL) : false; - bool talent = spellInfo->HasAttribute(SPELL_ATTR0_CU_IS_TALENT); - bool passive = spellInfo->IsPassive(); - bool active = target && target->HasAura(id); + SpellInfo const* learnSpellInfo = effect ? sSpellMgr->GetSpellInfo(effect->TriggerSpell) : NULL; - // unit32 used to prevent interpreting uint8 as char at output - // find rank of learned spell for learning spell, or talent rank - uint32 rank = learn && learnSpellInfo ? learnSpellInfo->GetRank() : spellInfo->GetRank(); + bool talent = spellInfo->HasAttribute(SPELL_ATTR0_CU_IS_TALENT); + bool passive = spellInfo->IsPassive(); + bool active = target && target->HasAura(id); - // 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; + // unit32 used to prevent interpreting uint8 as char at output + // find rank of learned spell for learning spell, or talent rank + uint32 rank = learn && learnSpellInfo ? learnSpellInfo->GetRank() : spellInfo->GetRank(); - // include rank in link name - if (rank) - ss << handler->GetTrinityString(LANG_SPELL_RANK) << rank; + // 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; - if (handler->GetSession()) - ss << "]|h|r"; + // include rank in link name + if (rank) + ss << handler->GetTrinityString(LANG_SPELL_RANK) << rank; - 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); + 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()); + handler->SendSysMessage(ss.str().c_str()); - if (!found) - found = true; + if (!found) + found = true; + } } } if (!found) @@ -836,56 +927,56 @@ public: if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id)) { int locale = handler->GetSessionDbcLocale(); - std::string name = spellInfo->SpellName; + std::string name = spellInfo->SpellName->Str[locale]; if (name.empty()) { handler->SendSysMessage(LANG_COMMAND_NOSPELLFOUND); return true; } - bool known = target && target->HasSpell(id); + bool known = target && target->HasSpell(id); - SpellEffectInfo const* effect = spellInfo->GetEffect(EFFECT_0); - bool learn = effect? (effect->Effect == SPELL_EFFECT_LEARN_SPELL) : false; + SpellEffectInfo const* effect = spellInfo->GetEffect(EFFECT_0); + bool learn = effect? (effect->Effect == SPELL_EFFECT_LEARN_SPELL) : false; - SpellInfo const* learnSpellInfo = effect ? sSpellMgr->GetSpellInfo(effect->TriggerSpell) : NULL; + SpellInfo const* learnSpellInfo = effect ? sSpellMgr->GetSpellInfo(effect->TriggerSpell) : NULL; - bool talent = spellInfo->HasAttribute(SPELL_ATTR0_CU_IS_TALENT); - bool passive = spellInfo->IsPassive(); - bool active = target && target->HasAura(id); + bool talent = spellInfo->HasAttribute(SPELL_ATTR0_CU_IS_TALENT); + 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 = learn && learnSpellInfo ? learnSpellInfo->GetRank() : spellInfo->GetRank(); + // unit32 used to prevent interpreting uint8 as char at output + // find rank of learned spell for learning spell, or talent rank + uint32 rank = 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; + // 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; + // include rank in link name + if (rank) + ss << handler->GetTrinityString(LANG_SPELL_RANK) << rank; - if (handler->GetSession()) - ss << ' ' << localeNames[locale] << "]|h|r"; - else - ss << ' ' << localeNames[locale]; - - 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 (handler->GetSession()) + ss << ' ' << localeNames[locale] << "]|h|r"; + else + ss << ' ' << localeNames[locale]; + + 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()); } else handler->SendSysMessage(LANG_COMMAND_NOSPELLFOUND); @@ -1037,36 +1128,54 @@ public: if (target && target->getGender() != gender) continue; - std::string name = gender == GENDER_MALE ? titleInfo->NameMale_lang : titleInfo->NameFemale_lang; + int32 locale = handler->GetSessionDbcLocale(); + std::string name = (gender == GENDER_MALE ? titleInfo->NameMale : titleInfo->NameFemale)->Str[locale]; if (name.empty()) continue; if (!Utf8FitTo(name, wNamePart)) - continue; - - if (maxResults && counter == maxResults) { - handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; + locale = 0; + for (; locale < TOTAL_LOCALES; ++locale) + { + if (locale == handler->GetSessionDbcLocale()) + continue; + + name = (gender == GENDER_MALE ? titleInfo->NameMale : titleInfo->NameFemale)->Str[locale]; + if (name.empty()) + continue; + + if (Utf8FitTo(name, wNamePart)) + break; + } } - char const* knownStr = target && target->HasTitle(titleInfo) ? handler->GetTrinityString(LANG_KNOWN) : ""; + if (locale < TOTAL_LOCALES) + { + if (maxResults && counter == maxResults) + { + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } - char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->MaskID - ? handler->GetTrinityString(LANG_ACTIVE) - : ""; + char const* knownStr = target && target->HasTitle(titleInfo) ? handler->GetTrinityString(LANG_KNOWN) : ""; - char titleNameStr[80]; - snprintf(titleNameStr, 80, name.c_str(), targetName); + char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->MaskID + ? handler->GetTrinityString(LANG_ACTIVE) + : ""; - // send title in "id (idx:idx) - [namedlink locale]" format - if (handler->GetSession()) - handler->PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->MaskID, id, titleNameStr, "", knownStr, activeStr); - else - handler->PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->MaskID, titleNameStr, "", knownStr, activeStr); + char titleNameStr[80]; + snprintf(titleNameStr, 80, name.c_str(), targetName); - ++counter; + // send title in "id (idx:idx) - [namedlink locale]" format + if (handler->GetSession()) + handler->PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->MaskID, id, titleNameStr, "", knownStr, activeStr); + else + handler->PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->MaskID, titleNameStr, "", knownStr, activeStr); + + ++counter; + } } } } @@ -1091,18 +1200,35 @@ public: uint32 counter = 0; uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); - uint8 locale = handler->GetSession() ? handler->GetSession()->GetSessionDbcLocale() : sWorld->GetDefaultDbcLocale(); // search in Map.dbc for (uint32 id = 0; id < sMapStore.GetNumRows(); id++) { if (MapEntry const* mapInfo = sMapStore.LookupEntry(id)) { - std::string name = mapInfo->MapName_lang; + int32 locale = handler->GetSessionDbcLocale(); + std::string name = mapInfo->MapName->Str[locale]; if (name.empty()) continue; - if (Utf8FitTo(name, wNamePart) && locale < TOTAL_LOCALES) + if (!Utf8FitTo(name, wNamePart) && handler->GetSession()) + { + locale = 0; + for (; locale < TOTAL_LOCALES; ++locale) + { + if (locale == handler->GetSessionDbcLocale()) + continue; + + name = mapInfo->MapName->Str[locale]; + if (name.empty()) + continue; + + if (Utf8FitTo(name, wNamePart)) + break; + } + } + + if (locale < TOTAL_LOCALES) { if (maxResults && counter == maxResults) { diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 5ce891a0105..26385221d65 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -207,7 +207,7 @@ public: float zoneX = object->GetPositionX(); float zoneY = object->GetPositionY(); - Map2ZoneCoordinates(zoneX, zoneY, zoneId); + sDB2Manager.Map2ZoneCoordinates(zoneId, zoneX, zoneY); Map const* map = object->GetMap(); float groundZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT); @@ -235,14 +235,14 @@ public: char const* unknown = handler->GetTrinityString(LANG_UNKNOWN); handler->PSendSysMessage(LANG_MAP_POSITION, - mapId, (mapEntry ? mapEntry->MapName_lang : unknown), - zoneId, (zoneEntry ? zoneEntry->AreaName_lang : unknown), - areaId, (areaEntry ? areaEntry->AreaName_lang : unknown), + mapId, (mapEntry ? mapEntry->MapName->Str[handler->GetSessionDbcLocale()] : unknown), + zoneId, (zoneEntry ? zoneEntry->AreaName->Str[handler->GetSessionDbcLocale()] : unknown), + areaId, (areaEntry ? areaEntry->AreaName->Str[handler->GetSessionDbcLocale()] : unknown), object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation()); if (Transport* transport = object->GetTransport()) handler->PSendSysMessage(LANG_TRANSPORT_POSITION, - transport->GetGOInfo()->moTransport.mapID, object->GetTransOffsetX(), object->GetTransOffsetY(), object->GetTransOffsetZ(), object->GetTransOffsetO(), + transport->GetGOInfo()->moTransport.SpawnMap, object->GetTransOffsetX(), object->GetTransOffsetY(), object->GetTransOffsetZ(), object->GetTransOffsetO(), transport->GetEntry(), transport->GetName().c_str()); handler->PSendSysMessage(LANG_GRID_POSITION, cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(), @@ -286,7 +286,10 @@ public: uint32 spellId = handler->extractSpellIdFromLink((char*)args); if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId)) - Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, target, target); + { + ObjectGuid castId = ObjectGuid::Create<HighGuid::Cast>(SPELL_CAST_SOURCE_NORMAL, target->GetMapId(), spellId, target->GetMap()->GenerateLowGuid<HighGuid::Cast>()); + Aura::TryRefreshStackOrCreate(spellInfo, castId, MAX_EFFECT_MASK, target, target); + } return true; } @@ -762,7 +765,7 @@ public: } target->GetSpellHistory()->ResetCooldown(spellIid, true); - target->GetSpellHistory()->ResetCharges(spellInfo->ChargeCategoryEntry); + target->GetSpellHistory()->ResetCharges(spellInfo->ChargeCategoryId); handler->PSendSysMessage(LANG_REMOVE_COOLDOWN, spellIid, owner == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str()); } return true; @@ -899,12 +902,15 @@ public: static bool HandleUnstuckCommand(ChatHandler* handler, char const* args) { +#define SPELL_UNSTUCK_ID 7355 +#define SPELL_UNSTUCK_VISUAL 2683 + // No args required for players if (handler->GetSession() && !handler->GetSession()->HasPermission(rbac::RBAC_PERM_COMMANDS_USE_UNSTUCK_WITH_ARGS)) { // 7355: "Stuck" if (Player* player = handler->GetSession()->GetPlayer()) - player->CastSpell(player, 7355, false); + player->CastSpell(player, SPELL_UNSTUCK_ID, false); return true; } @@ -925,12 +931,15 @@ public: if (player->IsInFlight() || player->IsInCombat()) { - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(7355); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_UNSTUCK_ID); if (!spellInfo) return false; if (Player* caster = handler->GetSession()->GetPlayer()) - Spell::SendCastResult(caster, spellInfo, 0, SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW); + { + ObjectGuid castId = ObjectGuid::Create<HighGuid::Cast>(SPELL_CAST_SOURCE_NORMAL, player->GetMapId(), SPELL_UNSTUCK_ID, player->GetMap()->GenerateLowGuid<HighGuid::Cast>()); + Spell::SendCastResult(caster, spellInfo, SPELL_UNSTUCK_VISUAL, castId, SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW); + } return false; } @@ -1175,10 +1184,10 @@ public: if (itemNameStr && itemNameStr[0]) { std::string itemName = itemNameStr+1; - auto itr = std::find_if(sItemSparseStore.begin(), sItemSparseStore.end(), [&itemName](ItemSparseEntry const* itemSparse) + auto itr = std::find_if(sItemSparseStore.begin(), sItemSparseStore.end(), [&itemName](ItemSparseEntry const* sparse) { for (uint32 i = 0; i < MAX_LOCALES; ++i) - if (itemName == itemSparse->Name->Str[i]) + if (itemName == sparse->Name->Str[i]) return true; return false; }); @@ -1476,7 +1485,7 @@ public: // add the skill to the player's book with step 1 (which is the first rank, in most cases something // like 'Apprentice <skill>'. target->SetSkill(skill, targetHasSkill ? target->GetSkillStep(skill) : 1, level, max); - handler->PSendSysMessage(LANG_SET_SKILL, skill, skillLine->DisplayName_lang, handler->GetNameLink(target).c_str(), level, max); + handler->PSendSysMessage(LANG_SET_SKILL, skill, skillLine->DisplayName->Str[handler->GetSessionDbcLocale()], handler->GetNameLink(target).c_str(), level, max); return true; } @@ -1580,7 +1589,7 @@ public: uint8 raceid, classid = 0; //RACE_NONE, CLASS_NONE std::string raceStr, classStr = handler->GetTrinityString(LANG_UNKNOWN); uint8 gender = 0; - int8 locale = handler->GetSessionDbcLocale(); + LocaleConstant locale = handler->GetSessionDbcLocale(); uint32 totalPlayerTime = 0; uint8 level = 0; std::string alive = handler->GetTrinityString(LANG_ERROR); @@ -1801,8 +1810,8 @@ public: handler->PSendSysMessage(LANG_PINFO_CHR_LEVEL_HIGH, level); // Output XI. LANG_PINFO_CHR_RACE - raceStr = GetRaceName(raceid, locale); - classStr = GetClassName(classid, locale); + raceStr = DB2Manager::GetChrRaceName(raceid, locale); + classStr = DB2Manager::GetClassName(classid, locale); handler->PSendSysMessage(LANG_PINFO_CHR_RACE, (gender == 0 ? handler->GetTrinityString(LANG_CHARACTER_GENDER_MALE) : handler->GetTrinityString(LANG_CHARACTER_GENDER_FEMALE)), raceStr.c_str(), classStr.c_str()); // Output XII. LANG_PINFO_CHR_ALIVE @@ -1823,15 +1832,15 @@ public: AreaTableEntry const* area = sAreaTableStore.LookupEntry(areaId); if (area) { - areaName = area->AreaName_lang; + areaName = area->AreaName->Str[handler->GetSessionDbcLocale()]; AreaTableEntry const* zone = sAreaTableStore.LookupEntry(area->ParentAreaID); if (zone) - zoneName = zone->AreaName_lang; + zoneName = zone->AreaName->Str[handler->GetSessionDbcLocale()]; } if (target) - handler->PSendSysMessage(LANG_PINFO_CHR_MAP, map->MapName_lang, + handler->PSendSysMessage(LANG_PINFO_CHR_MAP, map->MapName->Str[handler->GetSessionDbcLocale()], (!zoneName.empty() ? zoneName.c_str() : handler->GetTrinityString(LANG_UNKNOWN)), (!areaName.empty() ? areaName.c_str() : handler->GetTrinityString(LANG_UNKNOWN))); @@ -2607,7 +2616,7 @@ public: uint32 soundId = atoi((char*)args); - if (!sSoundEntriesStore.LookupEntry(soundId)) + if (!sSoundKitStore.LookupEntry(soundId)) { handler->PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId); handler->SetSentErrorMessage(true); @@ -2687,7 +2696,7 @@ public: { AuraApplication const* aurApp = itr->second; Aura const* aura = aurApp->GetBase(); - char const* name = aura->GetSpellInfo()->SpellName; + char const* name = aura->GetSpellInfo()->SpellName->Str[handler->GetSessionDbcLocale()]; bool self = target->GetGUID() == aura->GetCasterGUID(); if (self) diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index 47f1212f80a..435c3c74231 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -1008,14 +1008,14 @@ public: if (factionEntry->ReputationIndex < 0) { - handler->PSendSysMessage(LANG_COMMAND_FACTION_NOREP_ERROR, factionEntry->Name_lang, factionId); + handler->PSendSysMessage(LANG_COMMAND_FACTION_NOREP_ERROR, factionEntry->Name->Str[handler->GetSessionDbcLocale()], factionId); handler->SetSentErrorMessage(true); return false; } target->GetReputationMgr().SetOneFactionReputation(factionEntry, amount, false); target->GetReputationMgr().SendState(target->GetReputationMgr().GetState(factionEntry)); - handler->PSendSysMessage(LANG_COMMAND_MODIFY_REP, factionEntry->Name_lang, factionId, + handler->PSendSysMessage(LANG_COMMAND_MODIFY_REP, factionEntry->Name->Str[handler->GetSessionDbcLocale()], factionId, handler->GetNameLink(target).c_str(), target->GetReputationMgr().GetReputation(factionEntry)); return true; } diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index c71e0f01940..96acb89f1cb 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -268,7 +268,7 @@ public: Creature* creature = trans->CreateNPCPassenger(guid, &data); - creature->SaveToDB(trans->GetGOInfo()->moTransport.mapID, 1 << map->GetSpawnMode(), chr->GetPhaseMask()); + creature->SaveToDB(trans->GetGOInfo()->moTransport.SpawnMap, 1 << map->GetSpawnMode(), chr->GetPhaseMask()); sObjectMgr->AddCreatureToGrid(guid, &data); return true; diff --git a/src/server/scripts/Commands/cs_reset.cpp b/src/server/scripts/Commands/cs_reset.cpp index e77893e9de6..f72d7c614cc 100644 --- a/src/server/scripts/Commands/cs_reset.cpp +++ b/src/server/scripts/Commands/cs_reset.cpp @@ -134,7 +134,6 @@ public: target->InitRunes(); target->InitStatsForLevel(true); target->InitTaxiNodesForLevel(); - target->InitGlyphsForLevel(); target->InitTalentForLevel(); target->SetUInt32Value(PLAYER_XP, 0); @@ -190,7 +189,6 @@ public: target->InitRunes(); target->InitStatsForLevel(true); target->InitTaxiNodesForLevel(); - target->InitGlyphsForLevel(); target->InitTalentForLevel(); return true; diff --git a/src/server/scripts/Commands/cs_titles.cpp b/src/server/scripts/Commands/cs_titles.cpp index 85f4a43b3e4..11c9921a90c 100644 --- a/src/server/scripts/Commands/cs_titles.cpp +++ b/src/server/scripts/Commands/cs_titles.cpp @@ -93,7 +93,9 @@ public: target->SetTitle(titleInfo); // to be sure that title now known target->SetUInt32Value(PLAYER_CHOSEN_TITLE, titleInfo->MaskID); - handler->PSendSysMessage(LANG_TITLE_CURRENT_RES, id, target->getGender() == GENDER_MALE ? titleInfo->NameMale_lang : titleInfo->NameFemale_lang, tNameLink.c_str()); + handler->PSendSysMessage(LANG_TITLE_CURRENT_RES, id, + (target->getGender() == GENDER_MALE ? titleInfo->NameMale : titleInfo->NameFemale)->Str[handler->GetSessionDbcLocale()], + tNameLink.c_str()); return true; } @@ -135,7 +137,9 @@ public: std::string tNameLink = handler->GetNameLink(target); char titleNameStr[80]; - snprintf(titleNameStr, 80, target->getGender() == GENDER_MALE ? titleInfo->NameMale_lang : titleInfo->NameFemale_lang, target->GetName().c_str()); + snprintf(titleNameStr, 80, + (target->getGender() == GENDER_MALE ? titleInfo->NameMale : titleInfo->NameFemale)->Str[handler->GetSessionDbcLocale()], + target->GetName().c_str()); target->SetTitle(titleInfo); handler->PSendSysMessage(LANG_TITLE_ADD_RES, id, titleNameStr, tNameLink.c_str()); @@ -183,7 +187,9 @@ public: std::string tNameLink = handler->GetNameLink(target); char titleNameStr[80]; - snprintf(titleNameStr, 80, target->getGender() == GENDER_MALE ? titleInfo->NameMale_lang : titleInfo->NameFemale_lang, target->GetName().c_str()); + snprintf(titleNameStr, 80, + (target->getGender() == GENDER_MALE ? titleInfo->NameMale : titleInfo->NameFemale)->Str[handler->GetSessionDbcLocale()], + target->GetName().c_str()); handler->PSendSysMessage(LANG_TITLE_REMOVE_RES, id, titleNameStr, tNameLink.c_str()); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index df66d6b32b8..2772402f83f 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -1338,7 +1338,7 @@ class spell_putricide_mutation_init : public SpellScriptLoader SpellCastResult result = CheckRequirementInternal(extension); if (result != SPELL_CAST_OK) { - Spell::SendCastResult(GetExplTargetUnit()->ToPlayer(), GetSpellInfo(), 0, result, extension); + Spell::SendCastResult(GetExplTargetUnit()->ToPlayer(), GetSpellInfo(), GetSpell()->m_SpellVisual, GetSpell()->m_castId, result, extension); return result; } @@ -1435,7 +1435,7 @@ class spell_putricide_mutated_transformation : public SpellScriptLoader if (putricide->AI()->GetData(DATA_ABOMINATION)) { if (Player* player = caster->ToPlayer()) - Spell::SendCastResult(player, GetSpellInfo(), 0, SPELL_FAILED_CUSTOM_ERROR, SPELL_CUSTOM_ERROR_TOO_MANY_ABOMINATIONS); + Spell::SendCastResult(player, GetSpellInfo(), GetSpell()->m_SpellVisual, GetSpell()->m_castId, SPELL_FAILED_CUSTOM_ERROR, SPELL_CUSTOM_ERROR_TOO_MANY_ABOMINATIONS); return; } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp index 7e5661e5dbc..3fec4db8803 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp @@ -60,7 +60,8 @@ class icecrown_citadel_teleport : public GameObjectScript if (player->IsInCombat()) { - Spell::SendCastResult(player, spell, 0, SPELL_FAILED_AFFECTING_COMBAT); + ObjectGuid castId = ObjectGuid::Create<HighGuid::Cast>(SPELL_CAST_SOURCE_NORMAL, player->GetMapId(), spell->Id, player->GetMap()->GenerateLowGuid<HighGuid::Cast>()); + Spell::SendCastResult(player, spell, 0, castId, SPELL_FAILED_AFFECTING_COMBAT); return true; } @@ -85,7 +86,10 @@ class at_frozen_throne_teleport : public AreaTriggerScript if (player->IsInCombat()) { if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(FROZEN_THRONE_TELEPORT)) - Spell::SendCastResult(player, spell, 0, SPELL_FAILED_AFFECTING_COMBAT); + { + ObjectGuid castId = ObjectGuid::Create<HighGuid::Cast>(SPELL_CAST_SOURCE_NORMAL, player->GetMapId(), spell->Id, player->GetMap()->GenerateLowGuid<HighGuid::Cast>()); + Spell::SendCastResult(player, spell, 0, castId, SPELL_FAILED_AFFECTING_COMBAT); + } return true; } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp index 7e8ddeda484..1a165780224 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp @@ -384,8 +384,8 @@ class instance_icecrown_citadel : public InstanceMapScript break; case NPC_ZAFOD_BOOMBOX: if (GameObjectTemplate const* go = sObjectMgr->GetGameObjectTemplate(GO_THE_SKYBREAKER_A)) - if ((TeamInInstance == ALLIANCE && data->mapid == go->moTransport.mapID) || - (TeamInInstance == HORDE && data->mapid != go->moTransport.mapID)) + if ((TeamInInstance == ALLIANCE && data->mapid == go->moTransport.SpawnMap) || + (TeamInInstance == HORDE && data->mapid != go->moTransport.SpawnMap)) return entry; return 0; case NPC_IGB_MURADIN_BRONZEBEARD: diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp index 0897c7e35e8..b006ee2341a 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp @@ -1265,7 +1265,7 @@ class spell_ulduar_teleporter : public SpellScriptLoader if (GetExplTargetUnit()->IsInCombat()) { - Spell::SendCastResult(GetExplTargetUnit()->ToPlayer(), GetSpellInfo(), 0, SPELL_FAILED_AFFECTING_COMBAT); + Spell::SendCastResult(GetExplTargetUnit()->ToPlayer(), GetSpellInfo(), GetSpell()->m_SpellVisual, GetSpell()->m_castId, SPELL_FAILED_AFFECTING_COMBAT); return SPELL_FAILED_AFFECTING_COMBAT; } diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp index 8c371c6a244..057f0727526 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp @@ -885,7 +885,7 @@ class item_tainted_core : public ItemScript public: item_tainted_core() : ItemScript("item_tainted_core") { } - bool OnUse(Player* player, Item* /*item*/, SpellCastTargets const& targets) override + bool OnUse(Player* player, Item* /*item*/, SpellCastTargets const& targets, ObjectGuid /*castId*/) override { InstanceScript* instance = player->GetInstanceScript(); if (!instance) diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp index f191a0c3ad7..f4cb9d3aab0 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp @@ -232,10 +232,8 @@ class boss_kelidan_the_breaker : public CreatureScript Talk(SAY_NOVA); if (SpellInfo const* nova = sSpellMgr->GetSpellInfo(SPELL_BURNING_NOVA)) - { - if (Aura* aura = Aura::TryRefreshStackOrCreate(nova, MAX_EFFECT_MASK, me, me)) + if (Aura* aura = Aura::TryRefreshStackOrCreate(nova, ObjectGuid::Create<HighGuid::Cast>(SPELL_CAST_SOURCE_NORMAL, me->GetMapId(), nova->Id, me->GetMap()->GenerateLowGuid<HighGuid::Cast>()), MAX_EFFECT_MASK, me, me)) aura->ApplyForTargets(); - } if (IsHeroic()) DoTeleportAll(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); diff --git a/src/server/scripts/ScriptPCH.h b/src/server/scripts/ScriptPCH.h index 1cd25309055..cf31742f830 100644 --- a/src/server/scripts/ScriptPCH.h +++ b/src/server/scripts/ScriptPCH.h @@ -19,8 +19,7 @@ #include "CombatAI.h" #include "PassiveAI.h" #include "Chat.h" -#include "DBCStructure.h" -#include "DBCStores.h" +#include "DB2Stores.h" #include "ObjectMgr.h" #include "SpellScript.h" #include "SpellAuraEffects.h" diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index d82e9920df2..bb7ad7a84c0 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -162,7 +162,7 @@ class spell_dru_eclipse_energize : public SpellScriptLoader Player* caster = GetCaster()->ToPlayer(); // No boomy, no deal. - if (caster->GetSpecId(caster->GetActiveTalentGroup()) != TALENT_SPEC_DRUID_BALANCE) + if (caster->GetUInt32Value(PLAYER_FIELD_CURRENT_SPEC_ID) != TALENT_SPEC_DRUID_BALANCE) return; switch (GetSpellInfo()->Id) @@ -172,7 +172,7 @@ class spell_dru_eclipse_energize : public SpellScriptLoader int32 energizeAmount = -GetEffectValue(); // -13 // If we are set to fill the lunar side or we've just logged in with 0 power.. if ((!caster->HasAura(SPELL_DRUID_SOLAR_ECLIPSE_MARKER) && caster->HasAura(SPELL_DRUID_LUNAR_ECLIPSE_MARKER)) - || caster->GetPower(POWER_ECLIPSE) == 0) + || caster->GetPower(POWER_LUNAR_POWER) == 0) { caster->CastCustomSpell(caster, SPELL_DRUID_ECLIPSE_GENERAL_ENERGIZE, &energizeAmount, 0, 0, true); // If the energize was due to 0 power, cast the eclipse marker aura @@ -180,7 +180,7 @@ class spell_dru_eclipse_energize : public SpellScriptLoader caster->CastSpell(caster, SPELL_DRUID_LUNAR_ECLIPSE_MARKER, true); } // The energizing effect brought us out of the solar eclipse, remove the aura - if (caster->HasAura(SPELL_DRUID_SOLAR_ECLIPSE) && caster->GetPower(POWER_ECLIPSE) <= 0) + if (caster->HasAura(SPELL_DRUID_SOLAR_ECLIPSE) && caster->GetPower(POWER_LUNAR_POWER) <= 0) caster->RemoveAurasDueToSpell(SPELL_DRUID_SOLAR_ECLIPSE); break; } @@ -189,7 +189,7 @@ class spell_dru_eclipse_energize : public SpellScriptLoader int32 energizeAmount = GetEffectValue(); // 20 // If we are set to fill the solar side or we've just logged in with 0 power.. if ((!caster->HasAura(SPELL_DRUID_LUNAR_ECLIPSE_MARKER) && caster->HasAura(SPELL_DRUID_SOLAR_ECLIPSE_MARKER)) - || caster->GetPower(POWER_ECLIPSE) == 0) + || caster->GetPower(POWER_LUNAR_POWER) == 0) { caster->CastCustomSpell(caster, SPELL_DRUID_ECLIPSE_GENERAL_ENERGIZE, &energizeAmount, 0, 0, true); // If the energize was due to 0 power, cast the eclipse marker aura @@ -197,7 +197,7 @@ class spell_dru_eclipse_energize : public SpellScriptLoader caster->CastSpell(caster, SPELL_DRUID_SOLAR_ECLIPSE_MARKER, true); } // The energizing effect brought us out of the lunar eclipse, remove the aura - if (caster->HasAura(SPELL_DRUID_LUNAR_ECLIPSE) && caster->GetPower(POWER_ECLIPSE) >= 0) + if (caster->HasAura(SPELL_DRUID_LUNAR_ECLIPSE) && caster->GetPower(POWER_LUNAR_POWER) >= 0) caster->RemoveAura(SPELL_DRUID_LUNAR_ECLIPSE); break; } @@ -205,7 +205,7 @@ class spell_dru_eclipse_energize : public SpellScriptLoader { // If we are set to fill the solar side or we've just logged in with 0 power (confirmed with sniffs) if ((!caster->HasAura(SPELL_DRUID_LUNAR_ECLIPSE_MARKER) && caster->HasAura(SPELL_DRUID_SOLAR_ECLIPSE_MARKER)) - || caster->GetPower(POWER_ECLIPSE) == 0) + || caster->GetPower(POWER_LUNAR_POWER) == 0) { int32 energizeAmount = GetEffectValue(); // 15 caster->CastCustomSpell(caster, SPELL_DRUID_STARSURGE_ENERGIZE, &energizeAmount, 0, 0, true); @@ -220,10 +220,10 @@ class spell_dru_eclipse_energize : public SpellScriptLoader caster->CastCustomSpell(caster, SPELL_DRUID_STARSURGE_ENERGIZE, &energizeAmount, 0, 0, true); } // The energizing effect brought us out of the lunar eclipse, remove the aura - if (caster->HasAura(SPELL_DRUID_LUNAR_ECLIPSE) && caster->GetPower(POWER_ECLIPSE) >= 0) + if (caster->HasAura(SPELL_DRUID_LUNAR_ECLIPSE) && caster->GetPower(POWER_LUNAR_POWER) >= 0) caster->RemoveAura(SPELL_DRUID_LUNAR_ECLIPSE); // The energizing effect brought us out of the solar eclipse, remove the aura - else if (caster->HasAura(SPELL_DRUID_SOLAR_ECLIPSE) && caster->GetPower(POWER_ECLIPSE) <= 0) + else if (caster->HasAura(SPELL_DRUID_SOLAR_ECLIPSE) && caster->GetPower(POWER_LUNAR_POWER) <= 0) caster->RemoveAura(SPELL_DRUID_SOLAR_ECLIPSE); break; } diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index b0853c71b2c..6619a108009 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -29,7 +29,6 @@ #include "SpellHistory.h" #include "SkillDiscovery.h" #include "Battleground.h" -#include "DBCStores.h" // Generic script for handling item dummy effects which trigger another spell. class spell_item_trigger_spell : public SpellScriptLoader @@ -2706,7 +2705,7 @@ public: if (Player* target = GetHitUnit()->ToPlayer()) { target->HandleEmoteCommand(EMOTE_ONESHOT_TRAIN); - if (EmotesTextSoundEntry const* soundEntry = FindTextSoundEmoteFor(TEXT_EMOTE_TRAIN, target->getRace(), target->getGender())) + if (EmotesTextSoundEntry const* soundEntry = sDB2Manager.GetTextSoundEmoteFor(TEXT_EMOTE_TRAIN, target->getRace(), target->getGender(), target->getClass())) target->PlayDistanceSound(soundEntry->SoundId); } } diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index a13d6da8fae..31c20ccece9 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -745,6 +745,8 @@ class spell_mage_living_bomb : public SpellScriptLoader bool Validate(SpellInfo const* spellInfo) override { + if (!spellInfo->GetEffect(EFFECT_1)) + return false; if (!sSpellMgr->GetSpellInfo(uint32(spellInfo->GetEffect(EFFECT_1)->CalcValue()))) return false; return true; diff --git a/src/server/scripts/Spells/spell_pet.cpp b/src/server/scripts/Spells/spell_pet.cpp index 7852043a796..a56001cfe6a 100644 --- a/src/server/scripts/Spells/spell_pet.cpp +++ b/src/server/scripts/Spells/spell_pet.cpp @@ -107,9 +107,7 @@ class spell_gen_pet_calculate : public SpellScriptLoader if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { // For others recalculate it from: - float CritSpell = 0.0f; - // Crit from Intellect - CritSpell += owner->GetSpellCritFromIntellect(); + float CritSpell = 5.0f; // Increase crit from SPELL_AURA_MOD_SPELL_CRIT_CHANCE CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_CRIT_CHANCE); // Increase crit from SPELL_AURA_MOD_CRIT_PCT @@ -126,9 +124,7 @@ class spell_gen_pet_calculate : public SpellScriptLoader if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { // For others recalculate it from: - float CritMelee = 0.0f; - // Crit from Agility - CritMelee += owner->GetMeleeCritFromAgility(); + float CritMelee = 5.0f; // Increase crit from SPELL_AURA_MOD_WEAPON_CRIT_PERCENT CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_WEAPON_CRIT_PERCENT); // Increase crit from SPELL_AURA_MOD_CRIT_PCT @@ -676,9 +672,7 @@ public: if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { // For others recalculate it from: - float CritSpell = 0.0f; - // Crit from Intellect - CritSpell += owner->GetSpellCritFromIntellect(); + float CritSpell = 5.0f; // Increase crit from SPELL_AURA_MOD_SPELL_CRIT_CHANCE CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_CRIT_CHANCE); // Increase crit from SPELL_AURA_MOD_CRIT_PCT @@ -698,9 +692,7 @@ public: if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { // For others recalculate it from: - float CritMelee = 0.0f; - // Crit from Agility - CritMelee += owner->GetMeleeCritFromAgility(); + float CritMelee = 5.0f; // Increase crit from SPELL_AURA_MOD_WEAPON_CRIT_PERCENT CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_WEAPON_CRIT_PERCENT); // Increase crit from SPELL_AURA_MOD_CRIT_PCT @@ -1266,9 +1258,7 @@ public: if (GetCaster()->GetOwner()->ToPlayer()) { // For others recalculate it from: - float CritSpell = 0.0f; - // Crit from Intellect - // CritSpell += owner->GetSpellCritFromIntellect(); + float CritSpell = 5.0f; // Increase crit from SPELL_AURA_MOD_SPELL_CRIT_CHANCE // CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_CRIT_CHANCE); // Increase crit from SPELL_AURA_MOD_CRIT_PCT @@ -1287,9 +1277,7 @@ public: if (GetCaster()->GetOwner()->ToPlayer()) { // For others recalculate it from: - float CritMelee = 0.0f; - // Crit from Agility - // CritMelee += owner->GetMeleeCritFromAgility(); + float CritMelee = 5.0f; // Increase crit from SPELL_AURA_MOD_WEAPON_CRIT_PERCENT // CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_WEAPON_CRIT_PERCENT); // Increase crit from SPELL_AURA_MOD_CRIT_PCT diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index 7ad37ba5bc2..ad43ed92d3e 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -1008,7 +1008,7 @@ class spell_sha_lava_surge_proc : public SpellScriptLoader void ResetCooldown() { - GetCaster()->GetSpellHistory()->RestoreCharge(sSpellMgr->AssertSpellInfo(SPELL_SHAMAN_LAVA_BURST)->ChargeCategoryEntry); + GetCaster()->GetSpellHistory()->RestoreCharge(sSpellMgr->AssertSpellInfo(SPELL_SHAMAN_LAVA_BURST)->ChargeCategoryId); } void Register() override diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 5cc25d87f99..6c6eec993ab 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -793,7 +793,7 @@ class spell_warl_health_funnel : public SpellScriptLoader if (Player* modOwner = caster->GetSpellModOwner()) modOwner->ApplySpellMod(GetId(), SPELLMOD_COST, damage); - SpellNonMeleeDamage damageInfo(caster, caster, GetSpellInfo()->Id, GetSpellInfo()->SchoolMask); + SpellNonMeleeDamage damageInfo(caster, caster, GetSpellInfo()->Id, GetSpellInfo()->SchoolMask, GetAura()->GetCastGUID()); damageInfo.periodicLog = true; damageInfo.damage = damage; caster->DealSpellDamage(&damageInfo, false); diff --git a/src/server/scripts/World/item_scripts.cpp b/src/server/scripts/World/item_scripts.cpp index 69376b62048..c86d56a31b2 100644 --- a/src/server/scripts/World/item_scripts.cpp +++ b/src/server/scripts/World/item_scripts.cpp @@ -49,7 +49,7 @@ class item_only_for_flight : public ItemScript public: item_only_for_flight() : ItemScript("item_only_for_flight") { } - bool OnUse(Player* player, Item* item, SpellCastTargets const& /*targets*/) override + bool OnUse(Player* player, Item* item, SpellCastTargets const& /*targets*/, ObjectGuid castId) override { uint32 itemId = item->GetEntry(); bool disabled = false; @@ -67,7 +67,7 @@ public: break; case 34475: if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_ARCANE_CHARGES)) - Spell::SendCastResult(player, spellInfo, 1, SPELL_FAILED_NOT_ON_GROUND); + Spell::SendCastResult(player, spellInfo, 0, castId, SPELL_FAILED_NOT_ON_GROUND); break; } @@ -90,7 +90,7 @@ class item_nether_wraith_beacon : public ItemScript public: item_nether_wraith_beacon() : ItemScript("item_nether_wraith_beacon") { } - bool OnUse(Player* player, Item* /*item*/, SpellCastTargets const& /*targets*/) override + bool OnUse(Player* player, Item* /*item*/, SpellCastTargets const& /*targets*/, ObjectGuid /*castId*/) override { if (player->GetQuestStatus(10832) == QUEST_STATUS_INCOMPLETE) { @@ -113,7 +113,7 @@ class item_gor_dreks_ointment : public ItemScript public: item_gor_dreks_ointment() : ItemScript("item_gor_dreks_ointment") { } - bool OnUse(Player* player, Item* item, SpellCastTargets const& targets) override + bool OnUse(Player* player, Item* item, SpellCastTargets const& targets, ObjectGuid /*castId*/) override { if (targets.GetUnitTarget() && targets.GetUnitTarget()->GetTypeId() == TYPEID_UNIT && targets.GetUnitTarget()->GetEntry() == 20748 && !targets.GetUnitTarget()->HasAura(32578)) @@ -133,7 +133,7 @@ class item_incendiary_explosives : public ItemScript public: item_incendiary_explosives() : ItemScript("item_incendiary_explosives") { } - bool OnUse(Player* player, Item* item, SpellCastTargets const & /*targets*/) override + bool OnUse(Player* player, Item* item, SpellCastTargets const& /*targets*/, ObjectGuid /*castId*/) override { if (player->FindNearestCreature(26248, 15) || player->FindNearestCreature(26249, 15)) return false; @@ -223,7 +223,7 @@ class item_pile_fake_furs : public ItemScript public: item_pile_fake_furs() : ItemScript("item_pile_fake_furs") { } - bool OnUse(Player* player, Item* /*item*/, SpellCastTargets const & /*targets*/) override + bool OnUse(Player* player, Item* /*item*/, SpellCastTargets const& /*targets*/, ObjectGuid /*castId*/) override { GameObject* go = NULL; for (uint8 i = 0; i < CaribouTrapsNum; ++i) @@ -268,7 +268,7 @@ class item_petrov_cluster_bombs : public ItemScript public: item_petrov_cluster_bombs() : ItemScript("item_petrov_cluster_bombs") { } - bool OnUse(Player* player, Item* /*item*/, const SpellCastTargets & /*targets*/) override + bool OnUse(Player* player, Item* /*item*/, SpellCastTargets const& /*targets*/, ObjectGuid castId) override { if (player->GetZoneId() != ZONE_ID_HOWLING) return false; @@ -276,7 +276,7 @@ public: if (!player->GetTransport() || player->GetAreaId() != AREA_ID_SHATTERED_STRAITS) { if (const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(SPELL_PETROV_BOMB)) - Spell::SendCastResult(player, spellInfo, 1, SPELL_FAILED_NOT_HERE); + Spell::SendCastResult(player, spellInfo, 0, castId, SPELL_FAILED_NOT_HERE); return true; } @@ -332,7 +332,7 @@ class item_dehta_trap_smasher : public ItemScript public: item_dehta_trap_smasher() : ItemScript("item_dehta_trap_smasher") { } - bool OnUse(Player* player, Item* /*item*/, const SpellCastTargets & /*targets*/) override + bool OnUse(Player* player, Item* /*item*/, SpellCastTargets const& /*targets*/, ObjectGuid /*castId*/) override { if (player->GetQuestStatus(QUEST_CANNOT_HELP_THEMSELVES) != QUEST_STATUS_INCOMPLETE) return false; @@ -368,7 +368,7 @@ class item_trident_of_nazjan : public ItemScript public: item_trident_of_nazjan() : ItemScript("item_Trident_of_Nazjan") { } - bool OnUse(Player* player, Item* item, const SpellCastTargets & /*targets*/) override + bool OnUse(Player* player, Item* item, SpellCastTargets const& /*targets*/, ObjectGuid /*castId*/) override { if (player->GetQuestStatus(QUEST_THE_EMISSARY) == QUEST_STATUS_INCOMPLETE) { @@ -395,7 +395,7 @@ class item_captured_frog : public ItemScript public: item_captured_frog() : ItemScript("item_captured_frog") { } - bool OnUse(Player* player, Item* item, SpellCastTargets const& /*targets*/) override + bool OnUse(Player* player, Item* item, SpellCastTargets const& /*targets*/, ObjectGuid /*castId*/) override { if (player->GetQuestStatus(QUEST_THE_PERFECT_SPIES) == QUEST_STATUS_INCOMPLETE) { |
