diff options
author | megamage <none@none> | 2009-01-07 11:56:57 -0600 |
---|---|---|
committer | megamage <none@none> | 2009-01-07 11:56:57 -0600 |
commit | 75cd06b98c7dc489ee4554cf3af6a8f6403decee (patch) | |
tree | 4d9c2810ef818bc6a8a7f4f94a2375cc8dd41d71 | |
parent | fd07b66887e3a99ab7eeca9d00df12e57750558b (diff) |
*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
-rw-r--r-- | sql/updates/01_characters_character_spell.sql | 9 | ||||
-rw-r--r-- | sql/updates/02_mangos_playercreateinfo_action.sql | 9 | ||||
-rw-r--r-- | sql/updates/03_mangos_playercreateinfo_spell.sql | 10 | ||||
-rw-r--r-- | sql/updates/TBC-WLK_characters.sql | 29 | ||||
-rw-r--r-- | src/game/Chat.cpp | 41 | ||||
-rw-r--r-- | src/game/Chat.h | 3 | ||||
-rw-r--r-- | src/game/ChatHandler.cpp | 2 | ||||
-rw-r--r-- | src/game/Creature.cpp | 8 | ||||
-rw-r--r-- | src/game/Level2.cpp | 48 | ||||
-rw-r--r-- | src/game/Level3.cpp | 18 | ||||
-rw-r--r-- | src/game/SharedDefines.h | 2 | ||||
-rw-r--r-- | src/game/Unit.cpp | 1 | ||||
-rw-r--r-- | src/mangosd/CliRunnable.cpp | 17 | ||||
-rw-r--r-- | src/shared/revision_nr.h | 2 |
14 files changed, 118 insertions, 81 deletions
diff --git a/sql/updates/01_characters_character_spell.sql b/sql/updates/01_characters_character_spell.sql new file mode 100644 index 00000000000..fa17e0c4c33 --- /dev/null +++ b/sql/updates/01_characters_character_spell.sql @@ -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; diff --git a/sql/updates/02_mangos_playercreateinfo_action.sql b/sql/updates/02_mangos_playercreateinfo_action.sql new file mode 100644 index 00000000000..834753dcd71 --- /dev/null +++ b/sql/updates/02_mangos_playercreateinfo_action.sql @@ -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);
\ No newline at end of file diff --git a/sql/updates/03_mangos_playercreateinfo_spell.sql b/sql/updates/03_mangos_playercreateinfo_spell.sql new file mode 100644 index 00000000000..cd55d875aec --- /dev/null +++ b/sql/updates/03_mangos_playercreateinfo_spell.sql @@ -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);
\ No newline at end of file diff --git a/sql/updates/TBC-WLK_characters.sql b/sql/updates/TBC-WLK_characters.sql index d7a90514207..cf7819d96e3 100644 --- a/sql/updates/TBC-WLK_characters.sql +++ b/sql/updates/TBC-WLK_characters.sql @@ -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`, 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__ |