diff options
| author | Vincent_Michael <Vincent_Michael@gmx.de> | 2013-02-25 17:11:36 +0100 |
|---|---|---|
| committer | Vincent_Michael <Vincent_Michael@gmx.de> | 2013-02-25 17:11:36 +0100 |
| commit | 529c4b7592b7e9b2f15436e98566bbe5da463534 (patch) | |
| tree | 87d5f56472fbd366a7c06050dd93e9fe435690cd /src/server/scripts/Commands | |
| parent | 1fba352a88472f31b2d0cb36214dc655373e9e84 (diff) | |
| parent | c6d6cb7e745f8d320cfc9745dafc2d67fd87ba8c (diff) | |
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts:
src/server/game/Entities/Player/Player.cpp
src/server/game/Handlers/MailHandler.cpp
Diffstat (limited to 'src/server/scripts/Commands')
| -rw-r--r-- | src/server/scripts/Commands/cs_gm.cpp | 46 | ||||
| -rw-r--r-- | src/server/scripts/Commands/cs_misc.cpp | 8 | ||||
| -rw-r--r-- | src/server/scripts/Commands/cs_rbac.cpp | 4 | ||||
| -rw-r--r-- | src/server/scripts/Commands/cs_ticket.cpp | 12 |
4 files changed, 36 insertions, 34 deletions
diff --git a/src/server/scripts/Commands/cs_gm.cpp b/src/server/scripts/Commands/cs_gm.cpp index c2939666452..a99957a07c0 100644 --- a/src/server/scripts/Commands/cs_gm.cpp +++ b/src/server/scripts/Commands/cs_gm.cpp @@ -59,30 +59,32 @@ public: // Enables or disables hiding of the staff badge static bool HandleGMChatCommand(ChatHandler* handler, char const* args) { - if (!*args) + if (WorldSession* session = handler->GetSession()) { - WorldSession* session = handler->GetSession(); - if (!AccountMgr::IsPlayerAccount(session->GetSecurity()) && session->GetPlayer()->isGMChat()) - session->SendNotification(LANG_GM_CHAT_ON); - else - session->SendNotification(LANG_GM_CHAT_OFF); - return true; - } + if (!*args) + { + if (session->HasPermission(RBAC_PERM_CHAT_USE_STAFF_BADGE) && session->GetPlayer()->isGMChat()) + session->SendNotification(LANG_GM_CHAT_ON); + else + session->SendNotification(LANG_GM_CHAT_OFF); + return true; + } - std::string param = (char*)args; + std::string param = (char*)args; - if (param == "on") - { - handler->GetSession()->GetPlayer()->SetGMChat(true); - handler->GetSession()->SendNotification(LANG_GM_CHAT_ON); - return true; - } + if (param == "on") + { + session->GetPlayer()->SetGMChat(true); + session->SendNotification(LANG_GM_CHAT_ON); + return true; + } - if (param == "off") - { - handler->GetSession()->GetPlayer()->SetGMChat(false); - handler->GetSession()->SendNotification(LANG_GM_CHAT_OFF); - return true; + if (param == "off") + { + session->GetPlayer()->SetGMChat(false); + session->SendNotification(LANG_GM_CHAT_OFF); + return true; + } } handler->SendSysMessage(LANG_USE_BOL); @@ -123,7 +125,9 @@ public: for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) { AccountTypes itrSec = itr->second->GetSession()->GetSecurity(); - if ((itr->second->isGameMaster() || (!AccountMgr::IsPlayerAccount(itrSec) && itrSec <= AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_GM_LIST)))) && + if ((itr->second->isGameMaster() || + (itr->second->GetSession()->HasPermission(RBAC_PERM_COMMANDS_APPEAR_IN_GM_LIST) && + itrSec <= AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_GM_LIST)))) && (!handler->GetSession() || itr->second->IsVisibleGloballyFor(handler->GetSession()->GetPlayer()))) { if (first) diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 3acfe9c14ba..e695a171255 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -677,7 +677,7 @@ public: if (target) { - target->ResurrectPlayer(!AccountMgr::IsPlayerAccount(target->GetSession()->GetSecurity()) ? 1.0f : 0.5f); + target->ResurrectPlayer(target->GetSession()->HasPermission(RBAC_PERM_RESURRECT_WITH_FULL_HPS) ? 1.0f : 0.5f); target->SpawnCorpseBones(); target->SaveToDB(); } @@ -880,7 +880,7 @@ public: Player* player = handler->GetSession()->GetPlayer(); // save GM account without delay and output message - if (!AccountMgr::IsPlayerAccount(handler->GetSession()->GetSecurity())) + if (handler->GetSession()->HasPermission(RBAC_PERM_COMMANDS_SAVE_WITHOUT_DELAY)) { if (Player* target = handler->getSelectedPlayer()) target->SaveToDB(); @@ -937,8 +937,8 @@ public: static bool HandleUnstuckCommand(ChatHandler* handler, char const* args) { - //No args required for players - if (handler->GetSession() && AccountMgr::IsPlayerAccount(handler->GetSession()->GetSecurity())) + // No args required for players + if (handler->GetSession() && !handler->GetSession()->HasPermission(RBAC_PERM_COMMANDS_USE_UNSTUCK_WITH_ARGS)) { // 7355: "Stuck" if (Player* player = handler->GetSession()->GetPlayer()) diff --git a/src/server/scripts/Commands/cs_rbac.cpp b/src/server/scripts/Commands/cs_rbac.cpp index 092aabb0045..604218c2e68 100644 --- a/src/server/scripts/Commands/cs_rbac.cpp +++ b/src/server/scripts/Commands/cs_rbac.cpp @@ -22,7 +22,7 @@ Comment: All role based access control related commands (including account relat Category: commandscripts
EndScriptData */
-#include "RBAC.h"
+#include "AccountMgr.h"
#include "Config.h"
#include "Chat.h"
#include "Language.h"
@@ -188,7 +188,7 @@ public: if (!rdata)
{
- data->rbac = new RBACData(accountId, accountName, ConfigMgr::GetIntDefault("RealmID", 0));
+ data->rbac = new RBACData(accountId, accountName, realmID);
data->rbac->LoadFromDB();
data->needDelete = true;
}
diff --git a/src/server/scripts/Commands/cs_ticket.cpp b/src/server/scripts/Commands/cs_ticket.cpp index aee01f47581..958eb1709d5 100644 --- a/src/server/scripts/Commands/cs_ticket.cpp +++ b/src/server/scripts/Commands/cs_ticket.cpp @@ -95,18 +95,16 @@ public: return true; } - // Get target information - uint64 targetGuid = sObjectMgr->GetPlayerGUIDByName(target.c_str()); - uint64 targetAccountId = sObjectMgr->GetPlayerAccountIdByGUID(targetGuid); - uint32 targetGmLevel = AccountMgr::GetSecurity(targetAccountId, realmID); - + uint32 accountId = AccountMgr::GetId(target); // Target must exist and have administrative rights - if (!targetGuid || AccountMgr::IsPlayerAccount(targetGmLevel)) + if (!AccountMgr::HasPermission(accountId, RBAC_PERM_COMMANDS_BE_ASSIGNED_TICKET, realmID)) { handler->SendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_A); return true; } + uint64 targetGuid = sObjectMgr->GetPlayerGUIDByName(target); + // If already assigned, leave if (ticket->IsAssignedTo(targetGuid)) { @@ -125,7 +123,7 @@ public: // Assign ticket SQLTransaction trans = SQLTransaction(NULL); - ticket->SetAssignedTo(targetGuid, AccountMgr::IsAdminAccount(targetGmLevel)); + ticket->SetAssignedTo(targetGuid, AccountMgr::IsAdminAccount(AccountMgr::GetSecurity(accountId, realmID))); ticket->SaveToDB(trans); sTicketMgr->UpdateLastChange(); |
