aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/Chat.cpp41
-rw-r--r--src/game/Chat.h3
-rw-r--r--src/game/ChatHandler.cpp2
-rw-r--r--src/game/Creature.cpp8
-rw-r--r--src/game/Level2.cpp48
-rw-r--r--src/game/Level3.cpp18
-rw-r--r--src/game/SharedDefines.h2
-rw-r--r--src/game/Unit.cpp1
-rw-r--r--src/mangosd/CliRunnable.cpp17
-rw-r--r--src/shared/revision_nr.h2
10 files changed, 61 insertions, 81 deletions
diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp
index 03993fbfac1..3ee8a3255a9 100644
--- a/src/game/Chat.cpp
+++ b/src/game/Chat.cpp
@@ -688,29 +688,46 @@ bool ChatHandler::isAvailable(ChatCommand const& cmd) const
return m_session->GetSecurity() >= cmd.SecurityLevel;
}
-bool ChatHandler::HasLowerSecurity(Player* target, uint64 guid)
+bool ChatHandler::HasLowerSecurity(Player* target, uint64 guid, bool strong)
+{
+ WorldSession* target_session = NULL;
+ uint32 target_account = 0;
+
+ if (target)
+ target_session = target->GetSession();
+ else if (guid)
+ target_account = objmgr.GetPlayerAccountIdByGUID(guid);
+
+ if(!target_session && !target_account)
+ {
+ SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ SetSentErrorMessage(true);
+ return true;
+ }
+
+ return HasLowerSecurityAccount(target_session,target_account,strong);
+}
+
+bool ChatHandler::HasLowerSecurityAccount(WorldSession* target, uint32 target_account, bool strong)
{
uint32 target_sec;
- if (!sWorld.getConfig(CONFIG_GM_LOWER_SECURITY))
+ // ignore only for non-players for non strong checks (when allow apply command at least to same sec level)
+ if (m_session->GetSecurity() > SEC_PLAYER && !strong && !sWorld.getConfig(CONFIG_GM_LOWER_SECURITY))
return false;
- // allow everything from RA console
+ // allow everything from console and RA console
if (!m_session)
return false;
if (target)
- target_sec = target->GetSession()->GetSecurity();
- else if (guid)
- target_sec = accmgr.GetSecurity(objmgr.GetPlayerAccountIdByGUID(guid));
+ target_sec = target->GetSecurity();
+ else if (target_account)
+ target_sec = accmgr.GetSecurity(target_account);
else
- {
- SendSysMessage(LANG_PLAYER_NOT_FOUND);
- SetSentErrorMessage(true);
- return true;
- }
+ return true; // caller must report error for (target==NULL && target_account==0)
- if (m_session->GetSecurity() < target_sec)
+ if (m_session->GetSecurity() < target_sec || strong && m_session->GetSecurity() <= target_sec)
{
SendSysMessage(LANG_YOURS_SECURITY_IS_LOW);
SetSentErrorMessage(true);
diff --git a/src/game/Chat.h b/src/game/Chat.h
index 5b364d8cb06..2626ebeb3ae 100644
--- a/src/game/Chat.h
+++ b/src/game/Chat.h
@@ -80,7 +80,8 @@ class ChatHandler
virtual bool isAvailable(ChatCommand const& cmd) const;
virtual bool needReportToTarget(Player* chr) const;
- bool HasLowerSecurity(Player* target, uint64 guid);
+ bool HasLowerSecurity(Player* target, uint64 guid, bool strong = false);
+ bool HasLowerSecurityAccount(WorldSession* target, uint32 account, bool strong = false);
void SendGlobalSysMessage(const char *str);
void SendGlobalGMSysMessage(const char *str);
diff --git a/src/game/ChatHandler.cpp b/src/game/ChatHandler.cpp
index 3752d7db6cc..bcaa2c80768 100644
--- a/src/game/ChatHandler.cpp
+++ b/src/game/ChatHandler.cpp
@@ -192,7 +192,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
Player *player = objmgr.GetPlayer(to.c_str());
uint32 tSecurity = GetSecurity();
- uint32 pSecurity = player ? player->GetSession()->GetSecurity() : 0;
+ uint32 pSecurity = player ? player->GetSession()->GetSecurity() : SEC_PLAYER;
if(!player || tSecurity == SEC_PLAYER && pSecurity > SEC_PLAYER && !player->isAcceptWhispers())
{
WorldPacket data(SMSG_CHAT_PLAYER_NOT_FOUND, (to.size()+1));
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
index 649f9385081..e2124feff53 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -1763,7 +1763,9 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim)
// continue;
if( dist > range || dist < minrange )
continue;
- if(HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
+ if(spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
+ continue;
+ if(spellInfo->PreventionType == SPELL_PREVENTION_TYPE_PACIFY && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED))
continue;
return spellInfo;
}
@@ -1807,7 +1809,9 @@ SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim)
// continue;
if( dist > range || dist < minrange )
continue;
- if(HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
+ if(spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
+ continue;
+ if(spellInfo->PreventionType == SPELL_PREVENTION_TYPE_PACIFY && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED))
continue;
return spellInfo;
}
diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp
index 61e66ca251e..a54a66300be 100644
--- a/src/game/Level2.cpp
+++ b/src/game/Level2.cpp
@@ -88,27 +88,11 @@ bool ChatHandler::HandleMuteCommand(const char* args)
Player *chr = objmgr.GetPlayer(guid);
- // check security
- uint32 account_id = 0;
- uint32 security = 0;
-
- if (chr)
- {
- account_id = chr->GetSession()->GetAccountId();
- security = chr->GetSession()->GetSecurity();
- }
- else
- {
- account_id = objmgr.GetPlayerAccountIdByGUID(guid);
- security = accmgr.GetSecurity(account_id);
- }
-
- if(m_session && security >= m_session->GetSecurity())
- {
- SendSysMessage(LANG_YOURS_SECURITY_IS_LOW);
- SetSentErrorMessage(true);
+ // must have strong lesser security level
+ if(HasLowerSecurity (chr,guid,true))
return false;
- }
+
+ uint32 account_id = chr ? chr->GetSession()->GetAccountId() : objmgr.GetPlayerAccountIdByGUID(guid);
time_t mutetime = time(NULL) + notspeaktime*60;
@@ -154,27 +138,11 @@ bool ChatHandler::HandleUnmuteCommand(const char* args)
Player *chr = objmgr.GetPlayer(guid);
- // check security
- uint32 account_id = 0;
- uint32 security = 0;
-
- if (chr)
- {
- account_id = chr->GetSession()->GetAccountId();
- security = chr->GetSession()->GetSecurity();
- }
- else
- {
- account_id = objmgr.GetPlayerAccountIdByGUID(guid);
- security = accmgr.GetSecurity(account_id);
- }
-
- if(m_session && security >= m_session->GetSecurity())
- {
- SendSysMessage(LANG_YOURS_SECURITY_IS_LOW);
- SetSentErrorMessage(true);
+ // must have strong lesser security level
+ if(HasLowerSecurity (chr,guid,true))
return false;
- }
+
+ uint32 account_id = chr ? chr->GetSession()->GetAccountId() : objmgr.GetPlayerAccountIdByGUID(guid);
if (chr)
{
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index 9c8c234c91c..3ac749531fb 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -840,19 +840,10 @@ bool ChatHandler::HandleAccountSetPasswordCommand(const char* args)
return false;
}
- uint32 targetSecurity = accmgr.GetSecurity(targetAccountId);
-
- /// m_session==NULL only for console
- uint32 plSecurity = m_session ? m_session->GetSecurity() : SEC_CONSOLE;
-
/// can set password only for target with less security
/// This is also reject self apply in fact
- if (targetSecurity >= plSecurity)
- {
- SendSysMessage (LANG_YOURS_SECURITY_IS_LOW);
- SetSentErrorMessage (true);
+ if(HasLowerSecurityAccount (NULL,targetAccountId,true))
return false;
- }
if (strcmp(szPassword1,szPassword2))
{
@@ -6277,8 +6268,15 @@ bool ChatHandler::HandleAccountSetAddonCommand(const char* args)
SetSentErrorMessage(true);
return false;
}
+
}
+ // Let set addon state only for lesser (strong) security level
+ // or to self account
+ if (m_session && m_session->GetAccountId () != account_id &&
+ HasLowerSecurityAccount (NULL,account_id,true))
+ return false;
+
int lev=atoi(szExp); //get int anyway (0 if error)
if(lev < 0)
return false;
diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h
index bb3a7d1b8f8..d9b88829531 100644
--- a/src/game/SharedDefines.h
+++ b/src/game/SharedDefines.h
@@ -715,7 +715,7 @@ enum AuraState
//AURA_STATE_UNKNOWN20 = 20, // c | only (45317 Suicide)
//AURA_STATE_UNKNOWN21 = 21, // | not used
//AURA_STATE_UNKNOWN22 = 22, // C | not implemented yet (Requires Evasive Charges to use)
- AURA_STATE_HEALTH_ABOVE_75_PERCENT = 23, // C | not implemented yet
+ AURA_STATE_HEALTH_ABOVE_75_PERCENT = 23, // C |
};
// Spell mechanics
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index b8b17bf5b9e..6f64a3ee57a 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -232,6 +232,7 @@ void Unit::Update( uint32 p_time )
ModifyAuraState(AURA_STATE_HEALTHLESS_20_PERCENT, GetHealth() < GetMaxHealth()*0.20f);
ModifyAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, GetHealth() < GetMaxHealth()*0.35f);
+ ModifyAuraState(AURA_STATE_HEALTH_ABOVE_75_PERCENT, GetHealth() > GetMaxHealth()*0.75f);
i_motionMaster.UpdateMotion(p_time);
}
diff --git a/src/mangosd/CliRunnable.cpp b/src/mangosd/CliRunnable.cpp
index 267a8d41a27..7193fa705a0 100644
--- a/src/mangosd/CliRunnable.cpp
+++ b/src/mangosd/CliRunnable.cpp
@@ -82,19 +82,10 @@ bool ChatHandler::HandleAccountDeleteCommand(const char* args)
}
/// Commands not recommended call from chat, but support anyway
- if(m_session)
- {
- uint32 targetSecurity = accmgr.GetSecurity(account_id);
-
- /// can delete only for account with less security
- /// This is also reject self apply in fact
- if (targetSecurity >= m_session->GetSecurity())
- {
- SendSysMessage (LANG_YOURS_SECURITY_IS_LOW);
- SetSentErrorMessage (true);
- return false;
- }
- }
+ /// can delete only for account with less security
+ /// This is also reject self apply in fact
+ if(HasLowerSecurityAccount (NULL,account_id,true))
+ return false;
AccountOpResult result = accmgr.DeleteAccount(account_id);
switch(result)
diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h
index 91a4faed956..eb0a9466642 100644
--- a/src/shared/revision_nr.h
+++ b/src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
- #define REVISION_NR "7044"
+ #define REVISION_NR "7047"
#endif // __REVISION_NR_H__