Core/Players: Fixed issues with incorrect targets being selected for spells
This commit is contained in:
1 parent
dd4404e6e3
commit
a368fae588
15 files changed
+93
-102
No files matched your search
@@ -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)
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user