fix(Core): Deserter overrides from BG and Command (#11961)
* fix(Core/Command): Deserter offline add * feat(Core/Command): Deserter online add restriction * fix(Core/Battleground): Deserter overrides longer debuff
This commit is contained in:
@@ -1620,7 +1620,11 @@ void Player::ProcessDelayedOperations()
|
|||||||
SaveToDB(false, false);
|
SaveToDB(false, false);
|
||||||
|
|
||||||
if (m_DelayedOperations & DELAYED_SPELL_CAST_DESERTER)
|
if (m_DelayedOperations & DELAYED_SPELL_CAST_DESERTER)
|
||||||
CastSpell(this, 26013, true); // Deserter
|
{
|
||||||
|
Aura* aura = GetAura(26013);
|
||||||
|
if (!aura || aura->GetDuration() <= 900000)
|
||||||
|
CastSpell(this, 26013, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_DelayedOperations & DELAYED_BG_MOUNT_RESTORE)
|
if (m_DelayedOperations & DELAYED_BG_MOUNT_RESTORE)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -117,8 +117,14 @@ public:
|
|||||||
|
|
||||||
if (target)
|
if (target)
|
||||||
{
|
{
|
||||||
Aura* aura = target->AddAura(isInstance ? LFG_SPELL_DUNGEON_DESERTER : BG_SPELL_DESERTER, target);
|
Aura* aura = target->GetAura(isInstance ? LFG_SPELL_DUNGEON_DESERTER : BG_SPELL_DESERTER);
|
||||||
|
if (aura && aura->GetDuration() >= (int32)time * IN_MILLISECONDS)
|
||||||
|
{
|
||||||
|
handler->PSendSysMessage("Player %s already has a longer %s Deserter active.", handler->playerLink(player->GetName()), isInstance ? "Instance" : "Battleground");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
aura = target->AddAura(isInstance ? LFG_SPELL_DUNGEON_DESERTER : BG_SPELL_DESERTER, target);
|
||||||
if (!aura)
|
if (!aura)
|
||||||
{
|
{
|
||||||
handler->SendSysMessage(LANG_BAD_VALUE);
|
handler->SendSysMessage(LANG_BAD_VALUE);
|
||||||
@@ -130,6 +136,20 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32 duration = 0;
|
||||||
|
if (QueryResult result = CharacterDatabase.Query("SELECT remainTime FROM character_aura WHERE guid = {} AND spell = {}", player->GetGUID().GetCounter(), isInstance ? LFG_SPELL_DUNGEON_DESERTER : BG_SPELL_DESERTER))
|
||||||
|
{
|
||||||
|
Field* fields = result->Fetch();
|
||||||
|
duration = fields[0].Get<int32>();
|
||||||
|
|
||||||
|
if (duration < 0 || duration >= (int32)time * IN_MILLISECONDS)
|
||||||
|
{
|
||||||
|
handler->PSendSysMessage("Player %s already has a longer %s Deserter active.", handler->playerLink(player->GetName()), isInstance ? "Instance" : "Battleground");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
CharacterDatabase.Query("DELETE FROM character_aura WHERE guid = {} AND spell = {}", player->GetGUID().GetCounter(), isInstance ? LFG_SPELL_DUNGEON_DESERTER : BG_SPELL_DESERTER);
|
||||||
|
}
|
||||||
|
|
||||||
uint8 index = 0;
|
uint8 index = 0;
|
||||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_AURA);
|
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_AURA);
|
||||||
stmt->SetData(index++, player->GetGUID().GetCounter());
|
stmt->SetData(index++, player->GetGUID().GetCounter());
|
||||||
|
|||||||
Reference in New Issue
Block a user