diff options
author | Shauren <shauren.trinity@gmail.com> | 2013-10-03 17:07:25 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2013-10-03 17:07:25 +0200 |
commit | a368fae5885792380c92fd3d47070ad37b53e09c (patch) | |
tree | b1954c06eb5868423546841116a13cd64c8aa93f /src/server/scripts | |
parent | dd4404e6e36fc291a1b98052238d6f9b8b32f237 (diff) |
Core/Players: Fixed issues with incorrect targets being selected for spells
Diffstat (limited to 'src/server/scripts')
-rw-r--r-- | src/server/scripts/Commands/cs_account.cpp | 12 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_debug.cpp | 2 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_misc.cpp | 8 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_npc.cpp | 9 |
4 files changed, 13 insertions, 18 deletions
diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp index 332169ebd00..45ab88e9688 100644 --- a/src/server/scripts/Commands/cs_account.cpp +++ b/src/server/scripts/Commands/cs_account.cpp @@ -450,12 +450,12 @@ public: uint32 pwConfig = sWorld->getIntConfig(CONFIG_ACC_PASSCHANGESEC); // 0 - PW_NONE, 1 - PW_EMAIL, 2 - PW_RBAC // Command is supposed to be: .account password [$oldpassword] [$newpassword] [$newpasswordconfirmation] [$emailconfirmation] - char* oldPassword = strtok((char*)args, " "); // This extracts [$oldpassword] - char* newPassword = strtok(NULL, " "); // This extracts [$newpassword] - char* passwordConfirmation = strtok(NULL, " "); // This extracts [$newpasswordconfirmation] - const char* emailConfirmation; // This defines the emailConfirmation variable, which is optional depending on sec type. - if (!(emailConfirmation = strtok(NULL, " "))) // This extracts [$emailconfirmation]. If it doesn't exist, however... - emailConfirmation = ""; // ... it's simply "" for emailConfirmation. + char* oldPassword = strtok((char*)args, " "); // This extracts [$oldpassword] + char* newPassword = strtok(NULL, " "); // This extracts [$newpassword] + char* passwordConfirmation = strtok(NULL, " "); // This extracts [$newpasswordconfirmation] + char const* emailConfirmation = strtok(NULL, " "); // This defines the emailConfirmation variable, which is optional depending on sec type. + if (!emailConfirmation) // This extracts [$emailconfirmation]. If it doesn't exist, however... + emailConfirmation = ""; // ... it's simply "" for emailConfirmation. //Is any of those variables missing for any reason ? We return false. if (!oldPassword || !newPassword || !passwordConfirmation) diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 6c831520d59..199b1e43f6c 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -179,7 +179,7 @@ public: return false; } - if (handler->GetSession()->GetPlayer()->GetSelection()) + if (handler->GetSession()->GetPlayer()->GetTarget()) unit->PlayDistanceSound(soundId, handler->GetSession()->GetPlayer()); else unit->PlayDirectSound(soundId, handler->GetSession()->GetPlayer()); diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 513d378287b..3d531cee1f5 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -529,7 +529,7 @@ public: { Unit* target = handler->getSelectedUnit(); - if (!target || !handler->GetSession()->GetPlayer()->GetSelection()) + if (!target || !handler->GetSession()->GetPlayer()->GetTarget()) { handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); handler->SetSentErrorMessage(true); @@ -597,7 +597,7 @@ public: static bool HandleGUIDCommand(ChatHandler* handler, char const* /*args*/) { - uint64 guid = handler->GetSession()->GetPlayer()->GetSelection(); + uint64 guid = handler->GetSession()->GetPlayer()->GetTarget(); if (guid == 0) { @@ -1762,7 +1762,7 @@ public: // accept only explicitly selected target (not implicitly self targeting case) Unit* target = handler->getSelectedUnit(); - if (player->GetSelection() && target) + if (player->GetTarget() && target) { if (target->GetTypeId() != TYPEID_UNIT || target->IsPet()) { @@ -2107,7 +2107,7 @@ public: } Unit* target = handler->getSelectedUnit(); - if (!target || !handler->GetSession()->GetPlayer()->GetSelection()) + if (!target || !handler->GetSession()->GetPlayer()->GetTarget()) { handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); handler->SetSentErrorMessage(true); diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index f10a929c675..1cedeb79c22 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -1297,22 +1297,17 @@ public: char* receiver_str = strtok((char*)args, " "); char* text = strtok(NULL, ""); - uint64 guid = handler->GetSession()->GetPlayer()->GetSelection(); - Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(guid); - + Creature* creature = handler->getSelectedCreature(); if (!creature || !receiver_str || !text) - { return false; - } - uint64 receiver_guid= atol(receiver_str); + uint64 receiver_guid = atol(receiver_str); // check online security if (handler->HasLowerSecurity(ObjectAccessor::FindPlayer(receiver_guid), 0)) return false; creature->MonsterWhisper(text, receiver_guid); - return true; } |