*Mangos Implement AURA_STATE_HEALTH_ABOVE_75_PERCENT use. By DiSlord.

*Mangos [7045]. More correct spell select for creatures if spell PreventionType == SPELL_PREVENTION_TYPE_SILENCE. Also add check for PreventionType == SPELL_PREVENTION_TYPE_PACIFY. By DiSlord.
*Mangos [7046] Do more security level checks in commands using HasLowerSecurity. Make use .account set addon safe for players. By Vladimir.
*Mangos [7047] Fix Draenei race spell add at client switch. By DiSlord.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-01-07 11:56:57 -06:00
parent fd07b66887
commit 75cd06b98c
14 changed files with 119 additions and 82 deletions
@@ -0,0 +1,9 @@
DELETE FROM `character_spell` WHERE `spell` IN ('28880', 59542, 59543, 59544, 59545, 59547, 59548);
INSERT INTO character_spell SELECT characters.guid as guid, 28880, -1, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 1;
INSERT INTO character_spell SELECT characters.guid as guid, 59542, -1, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 2;
INSERT INTO character_spell SELECT characters.guid as guid, 59543, -1, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 3;
INSERT INTO character_spell SELECT characters.guid as guid, 59544, -1, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 5;
INSERT INTO character_spell SELECT characters.guid as guid, 59545, -1, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 6;
INSERT INTO character_spell SELECT characters.guid as guid, 59547, -1, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 7;
INSERT INTO character_spell SELECT characters.guid as guid, 59548, -1, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 8;
@@ -0,0 +1,9 @@
DELETE FROM `playercreateinfo_action` WHERE `action` IN ('28880', 59542, 59543, 59544, 59545, 59547, 59548);
INSERT INTO `playercreateinfo_action` VALUES
(11,1,74,28880,0,0),
(11,2,3,59542,0,0),
(11,3,3,59543,0,0),
(11,5,3,59544,0,0),
(11,6,6,59545,0,0),
(11,7,3,59547,0,0),
(11,8,3,59548,0,0);
@@ -0,0 +1,10 @@
DELETE FROM `playercreateinfo_spell` WHERE `Spell` IN ('28880', 59542, 59543, 59544, 59545, 59547, 59548);
INSERT INTO `playercreateinfo_spell` VALUES
(11,1,28880,'Gift of the Naaru',1),
(11,2,59542,'Gift of the Naaru',1),
(11,3,59543,'Gift of the Naaru',1),
(11,5,59544,'Gift of the Naaru',1),
(11,6,59545,'Gift of the Naaru',1),
(11,7,59547,'Gift of the Naaru',1),
(11,8,59548,'Gift of the Naaru',1);
+29
View File
@@ -1,3 +1,32 @@
DELETE FROM `character_spell` WHERE `spell` IN ('28880', 59542, 59543, 59544, 59545, 59547, 59548);
INSERT INTO character_spell SELECT characters.guid as guid, 28880, -1, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 1;
INSERT INTO character_spell SELECT characters.guid as guid, 59542, -1, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 2;
INSERT INTO character_spell SELECT characters.guid as guid, 59543, -1, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 3;
INSERT INTO character_spell SELECT characters.guid as guid, 59544, -1, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 5;
INSERT INTO character_spell SELECT characters.guid as guid, 59545, -1, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 6;
INSERT INTO character_spell SELECT characters.guid as guid, 59547, -1, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 7;
INSERT INTO character_spell SELECT characters.guid as guid, 59548, -1, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 8;
DELETE FROM `playercreateinfo_action` WHERE `action` IN ('28880', 59542, 59543, 59544, 59545, 59547, 59548);
INSERT INTO `playercreateinfo_action` VALUES
(11,1,74,28880,0,0),
(11,2,3,59542,0,0),
(11,3,3,59543,0,0),
(11,5,3,59544,0,0),
(11,6,6,59545,0,0),
(11,7,3,59547,0,0),
(11,8,3,59548,0,0);
DELETE FROM `playercreateinfo_spell` WHERE `Spell` IN ('28880', 59542, 59543, 59544, 59545, 59547, 59548);
INSERT INTO `playercreateinfo_spell` VALUES
(11,1,28880,'Gift of the Naaru',1),
(11,2,59542,'Gift of the Naaru',1),
(11,3,59543,'Gift of the Naaru',1),
(11,5,59544,'Gift of the Naaru',1),
(11,6,59545,'Gift of the Naaru',1),
(11,7,59547,'Gift of the Naaru',1),
(11,8,59548,'Gift of the Naaru',1);
alter table `character_pet`
drop column `trainpoint`,
drop column `loyaltypoints`,
+30 -13
View File
@@ -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)
{
uint32 target_sec;
if (!sWorld.getConfig(CONFIG_GM_LOWER_SECURITY))
return false;
// allow everything from RA console
if (!m_session)
return false;
WorldSession* target_session = NULL;
uint32 target_account = 0;
if (target)
target_sec = target->GetSession()->GetSecurity();
target_session = target->GetSession();
else if (guid)
target_sec = accmgr.GetSecurity(objmgr.GetPlayerAccountIdByGUID(guid));
else
target_account = objmgr.GetPlayerAccountIdByGUID(guid);
if(!target_session && !target_account)
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
return true;
}
if (m_session->GetSecurity() < target_sec)
return HasLowerSecurityAccount(target_session,target_account,strong);
}
bool ChatHandler::HasLowerSecurityAccount(WorldSession* target, uint32 target_account, bool strong)
{
uint32 target_sec;
// 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 console and RA console
if (!m_session)
return false;
if (target)
target_sec = target->GetSecurity();
else if (target_account)
target_sec = accmgr.GetSecurity(target_account);
else
return true; // caller must report error for (target==NULL && target_account==0)
if (m_session->GetSecurity() < target_sec || strong && m_session->GetSecurity() <= target_sec)
{
SendSysMessage(LANG_YOURS_SECURITY_IS_LOW);
SetSentErrorMessage(true);
+2 -1
View File
@@ -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);
+1 -1
View File
@@ -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));
+6 -2
View File
@@ -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;
}
+8 -40
View File
@@ -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)
{
+8 -10
View File
@@ -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;
+1 -1
View File
@@ -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
+1
View File
@@ -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);
}
+4 -13
View File
@@ -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)
+1 -1
View File
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "7044"
#define REVISION_NR "7047"
#endif // __REVISION_NR_H__