aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Commands
diff options
context:
space:
mode:
authorForesterDev <11771800+ForesterDev@users.noreply.github.com>2019-07-02 12:17:03 +0400
committerGiacomo Pozzoni <giacomopoz@gmail.com>2019-07-02 10:17:02 +0200
commitb47bb59e2a3e42aff3793517ef94f51678b54905 (patch)
treee7c665f0ead33bd705e39bc64d637e378e7f56f8 /src/server/scripts/Commands
parent401777d024785c58f90947cfdadd9b1b7d8fbd3b (diff)
Core/Player: add helper methods GetNativeGender/SetNativeGender/SetGender (#23520)
* Core/Player: add helper methods GetNativeGender/SetNativeGender/SetGender and fix some cases, where we should get player gender, instead of modified by display gender * fix merge * Add virtual methods for Unit class
Diffstat (limited to 'src/server/scripts/Commands')
-rw-r--r--src/server/scripts/Commands/cs_character.cpp2
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp2
-rw-r--r--src/server/scripts/Commands/cs_modify.cpp4
-rw-r--r--src/server/scripts/Commands/cs_titles.cpp6
4 files changed, 7 insertions, 7 deletions
diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp
index 02fe8b3e549..ac9145f89d7 100644
--- a/src/server/scripts/Commands/cs_character.cpp
+++ b/src/server/scripts/Commands/cs_character.cpp
@@ -281,7 +281,7 @@ public:
if (titleInfo && target->HasTitle(titleInfo))
{
- std::string name = target->GetGender() == GENDER_MALE ? titleInfo->nameMale[loc] : titleInfo->nameFemale[loc];
+ std::string name = target->GetNativeGender() == GENDER_MALE ? titleInfo->nameMale[loc] : titleInfo->nameFemale[loc];
if (name.empty())
continue;
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index a6083fd53e6..37ea8a512a0 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -1631,7 +1631,7 @@ public:
mapId = target->GetMapId();
areaId = target->GetAreaId();
alive = target->IsAlive() ? handler->GetTrinityString(LANG_YES) : handler->GetTrinityString(LANG_NO);
- gender = target->GetGender();
+ gender = target->GetNativeGender();
phase = target->GetPhaseMask();
}
// get additional information from DB
diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp
index 0fa11461509..26cf36f3fb0 100644
--- a/src/server/scripts/Commands/cs_modify.cpp
+++ b/src/server/scripts/Commands/cs_modify.cpp
@@ -920,8 +920,8 @@ public:
}
// Set gender
- target->SetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_GENDER, gender);
- target->SetByteValue(PLAYER_BYTES_3, PLAYER_BYTES_3_OFFSET_GENDER, gender);
+ target->SetGender(gender);
+ target->SetNativeGender(gender);
// Change display ID
target->InitDisplayIds();
diff --git a/src/server/scripts/Commands/cs_titles.cpp b/src/server/scripts/Commands/cs_titles.cpp
index 7a389b66f36..fc0302007ff 100644
--- a/src/server/scripts/Commands/cs_titles.cpp
+++ b/src/server/scripts/Commands/cs_titles.cpp
@@ -94,7 +94,7 @@ public:
target->SetTitle(titleInfo); // to be sure that title now known
target->SetUInt32Value(PLAYER_CHOSEN_TITLE, titleInfo->bit_index);
- handler->PSendSysMessage(LANG_TITLE_CURRENT_RES, id, target->GetGender() == GENDER_MALE ? titleInfo->nameMale[handler->GetSessionDbcLocale()] : titleInfo->nameFemale[handler->GetSessionDbcLocale()], tNameLink.c_str());
+ handler->PSendSysMessage(LANG_TITLE_CURRENT_RES, id, target->GetNativeGender() == GENDER_MALE ? titleInfo->nameMale[handler->GetSessionDbcLocale()] : titleInfo->nameFemale[handler->GetSessionDbcLocale()], tNameLink.c_str());
return true;
}
@@ -137,7 +137,7 @@ public:
std::string tNameLink = handler->GetNameLink(target);
char titleNameStr[80];
- snprintf(titleNameStr, 80, target->GetGender() == GENDER_MALE ? titleInfo->nameMale[handler->GetSessionDbcLocale()] : titleInfo->nameFemale[handler->GetSessionDbcLocale()], target->GetName().c_str());
+ snprintf(titleNameStr, 80, target->GetNativeGender() == GENDER_MALE ? titleInfo->nameMale[handler->GetSessionDbcLocale()] : titleInfo->nameFemale[handler->GetSessionDbcLocale()], target->GetName().c_str());
target->SetTitle(titleInfo);
handler->PSendSysMessage(LANG_TITLE_ADD_RES, id, titleNameStr, tNameLink.c_str());
@@ -185,7 +185,7 @@ public:
std::string tNameLink = handler->GetNameLink(target);
char titleNameStr[80];
- snprintf(titleNameStr, 80, target->GetGender() == GENDER_MALE ? titleInfo->nameMale[handler->GetSessionDbcLocale()] : titleInfo->nameFemale[handler->GetSessionDbcLocale()], target->GetName().c_str());
+ snprintf(titleNameStr, 80, target->GetNativeGender() == GENDER_MALE ? titleInfo->nameMale[handler->GetSessionDbcLocale()] : titleInfo->nameFemale[handler->GetSessionDbcLocale()], target->GetName().c_str());
handler->PSendSysMessage(LANG_TITLE_REMOVE_RES, id, titleNameStr, tNameLink.c_str());