diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/Conditions/ConditionMgr.cpp | 24 | ||||
-rwxr-xr-x | src/server/game/Conditions/ConditionMgr.h | 2 | ||||
-rwxr-xr-x | src/server/game/Miscellaneous/Language.h | 3 | ||||
-rwxr-xr-x | src/server/game/Spells/Spell.cpp | 15 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_misc.cpp | 22 |
5 files changed, 36 insertions, 30 deletions
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 2f3cb0fbaaf..a27ddeda8ed 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -720,12 +720,11 @@ void ConditionMgr::LoadConditions(bool isReload) } QueryResult result = WorldDatabase.Query("SELECT SourceTypeOrReferenceId, SourceGroup, SourceEntry, SourceId, ElseGroup, ConditionTypeOrReference, ConditionTarget, " - " ConditionValue1, ConditionValue2, ConditionValue3, NegativeCondition, ErrorTextId, ScriptName FROM conditions"); + " ConditionValue1, ConditionValue2, ConditionValue3, NegativeCondition, ErrorType, ErrorTextId, ScriptName FROM conditions"); if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 conditions. DB table `conditions` is empty!"); - return; } @@ -736,19 +735,20 @@ void ConditionMgr::LoadConditions(bool isReload) Field* fields = result->Fetch(); Condition* cond = new Condition(); - int32 iSourceTypeOrReferenceId = fields[0].GetInt32(); + int32 iSourceTypeOrReferenceId = fields[0].GetInt32(); cond->SourceGroup = fields[1].GetUInt32(); cond->SourceEntry = fields[2].GetInt32(); cond->SourceId = fields[3].GetInt32(); cond->ElseGroup = fields[4].GetUInt32(); - int32 iConditionTypeOrReference = fields[5].GetInt32(); + int32 iConditionTypeOrReference = fields[5].GetInt32(); cond->ConditionTarget = fields[6].GetUInt8(); cond->ConditionValue1 = fields[7].GetUInt32(); cond->ConditionValue2 = fields[8].GetUInt32(); cond->ConditionValue3 = fields[9].GetUInt32(); cond->NegativeCondition = fields[10].GetUInt8(); - cond->ErrorTextId = fields[11].GetUInt32(); - cond->ScriptId = sObjectMgr->GetScriptId(fields[12].GetCString()); + cond->ErrorType = fields[11].GetUInt32(); + cond->ErrorTextId = fields[12].GetUInt32(); + cond->ScriptId = sObjectMgr->GetScriptId(fields[13].GetCString()); if (iConditionTypeOrReference >= 0) cond->ConditionType = ConditionTypes(iConditionTypeOrReference); @@ -825,6 +825,18 @@ void ConditionMgr::LoadConditions(bool isReload) continue; } + if (cond->ErrorType && cond->SourceType != CONDITION_SOURCE_TYPE_SPELL) + { + sLog->outError(LOG_FILTER_SQL, "Condition type %u entry %i can't have ErrorType (%u), set to 0!", uint32(cond->SourceType), cond->SourceEntry, cond->ErrorType); + cond->ErrorType = 0; + } + + if (cond->ErrorTextId && !cond->ErrorType) + { + sLog->outError(LOG_FILTER_SQL, "Condition type %u entry %i has any ErrorType, ErrorTextId (%u) is set, set to 0!", uint32(cond->SourceType), cond->SourceEntry, cond->ErrorTextId); + cond->ErrorTextId = 0; + } + if (cond->SourceGroup) { bool valid = false; diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index 7b0dc1f20bf..7ffb6ff584c 100755 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -180,6 +180,7 @@ struct Condition uint32 ConditionValue1; uint32 ConditionValue2; uint32 ConditionValue3; + uint32 ErrorType; uint32 ErrorTextId; uint32 ReferenceId; uint32 ScriptId; @@ -198,6 +199,7 @@ struct Condition ConditionValue2 = 0; ConditionValue3 = 0; ReferenceId = 0; + ErrorType = 0; ErrorTextId = 0; ScriptId = 0; NegativeCondition = false; diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index 5321202b256..df5f45622f8 100755 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -86,8 +86,7 @@ enum TrinityStrings LANG_CONNECTED_PLAYERS = 60, LANG_ACCOUNT_ADDON = 61, LANG_IMPROPER_VALUE = 62, - LANG_CANT_DO_NOW = 63, - // Room for more level 0 64-99 not used + // Room for more level 0 63-99 not used // level 1 chat LANG_GLOBAL_NOTIFY = 100, diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index cd1197dca86..867fa47977a 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -4866,17 +4866,12 @@ SpellCastResult Spell::CheckCast(bool strict) ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_SPELL, m_spellInfo->Id); if (!conditions.empty() && !sConditionMgr->IsObjectMeetToConditions(condInfo, conditions)) { - // send error msg to player if condition failed and text message available - // TODO: using WorldSession::SendNotification is not blizzlike - if (Player* playerCaster = m_caster->ToPlayer()) + // mLastFailedCondition can be NULL if there was an error processing the condition in Condition::Meets (i.e. wrong data for ConditionTarget or others) + if (condInfo.mLastFailedCondition && condInfo.mLastFailedCondition->ErrorType) { - // mLastFailedCondition can be NULL if there was an error processing the condition in Condition::Meets (i.e. wrong data for ConditionTarget or others) - if (playerCaster->GetSession() && condInfo.mLastFailedCondition - && condInfo.mLastFailedCondition->ErrorTextId) - { - playerCaster->GetSession()->SendNotification(condInfo.mLastFailedCondition->ErrorTextId); - return SPELL_FAILED_DONT_REPORT; - } + if (condInfo.mLastFailedCondition->ErrorType == SPELL_FAILED_CUSTOM_ERROR) + m_customError = SpellCustomErrors(condInfo.mLastFailedCondition->ErrorTextId); + return SpellCastResult(condInfo.mLastFailedCondition->ErrorType); } if (!condInfo.mLastFailedCondition || !condInfo.mLastFailedCondition->ConditionTarget) return SPELL_FAILED_CASTER_AURASTATE; diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 5e54778b14a..c701c4f350c 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -937,16 +937,9 @@ public: //No args required for players if (handler->GetSession() && AccountMgr::IsPlayerAccount(handler->GetSession()->GetSecurity())) { - Player* player = handler->GetSession()->GetPlayer(); - if (player->isInFlight() || player->isInCombat()) - { - handler->SendSysMessage(LANG_CANT_DO_NOW); - handler->SetSentErrorMessage(true); - return false; - } - - //7355: "Stuck" - player->CastSpell(player, 7355, false); + // 7355: "Stuck" + if (Player* player = handler->GetSession()->GetPlayer()) + player->CastSpell(player, 7355, false); return true; } @@ -967,8 +960,13 @@ public: if (player->isInFlight() || player->isInCombat()) { - handler->SendSysMessage(LANG_CANT_DO_NOW); - handler->SetSentErrorMessage(true); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(7355); + if (!spellInfo) + return false; + + if (Player* caster = handler->GetSession()->GetPlayer()) + Spell::SendCastResult(caster, spellInfo, 0, SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW); + return false; } |