mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
Added new command: .modify gender male/female - Turns selected player into a male or female
No relog needed Signed-off-by: dythzer <micke223@gmail.com> Add help and mangos strings. Allow accept partly types male/female arg values. Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
7b9e86e3f3
commit
acf6f5d5ce
8 changed files with 89 additions and 2 deletions
|
|
@ -303,6 +303,7 @@ INSERT INTO `command` VALUES
|
||||||
('modify drunk',1,'Syntax: .modify drunk #value\r\n Set drunk level to #value (0..100). Value 0 remove drunk state, 100 is max drunked state.'),
|
('modify drunk',1,'Syntax: .modify drunk #value\r\n Set drunk level to #value (0..100). Value 0 remove drunk state, 100 is max drunked state.'),
|
||||||
('modify energy',1,'Syntax: .modify energy #energy\r\n\r\nModify the energy of the selected player. If no player is selected, modify your energy.'),
|
('modify energy',1,'Syntax: .modify energy #energy\r\n\r\nModify the energy of the selected player. If no player is selected, modify your energy.'),
|
||||||
('modify faction',1,'Syntax: .modify faction #factionid #flagid #npcflagid #dynamicflagid\r\n\r\nModify the faction and flags of the selected creature. Without arguments, display the faction and flags of the selected creature.'),
|
('modify faction',1,'Syntax: .modify faction #factionid #flagid #npcflagid #dynamicflagid\r\n\r\nModify the faction and flags of the selected creature. Without arguments, display the faction and flags of the selected creature.'),
|
||||||
|
('modify gender',2,'Syntax: .modify gender male/female\r\n\r\nChange gender of selected player.'),
|
||||||
('modify honor',1,'Syntax: .modify honor $amount\r\n\r\nAdd $amount honor points to the selected player.'),
|
('modify honor',1,'Syntax: .modify honor $amount\r\n\r\nAdd $amount honor points to the selected player.'),
|
||||||
('modify hp',1,'Syntax: .modify hp #newhp\r\n\r\nModify the hp of the selected player. If no player is selected, modify your hp.'),
|
('modify hp',1,'Syntax: .modify hp #newhp\r\n\r\nModify the hp of the selected player. If no player is selected, modify your hp.'),
|
||||||
('modify mana',1,'Syntax: .modify mana #newmana\r\n\r\nModify the mana of the selected player. If no player is selected, modify your mana.'),
|
('modify mana',1,'Syntax: .modify mana #newmana\r\n\r\nModify the mana of the selected player. If no player is selected, modify your mana.'),
|
||||||
|
|
@ -2707,7 +2708,10 @@ INSERT INTO `mangos_string` VALUES
|
||||||
(1115,'Invalid character name!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(1115,'Invalid character name!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(1116,'Invalid character guid!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(1116,'Invalid character guid!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(1117,'Character guid %u in use!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(1117,'Character guid %u in use!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(1118,'%d - guild: %s (guid: %u) %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
(1118,'%d - guild: %s (guid: %u) %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
|
(1119,'You must use male or female as gender.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
|
(1120,'You change gender of %s to %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
|
(1121,'Your gender changed to %s by %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
||||||
/*!40000 ALTER TABLE `mangos_string` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `mangos_string` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
|
|
|
||||||
8
sql/updates/2008_11_01_01_mangos_mangos_string.sql
Normal file
8
sql/updates/2008_11_01_01_mangos_mangos_string.sql
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
ALTER TABLE db_version CHANGE COLUMN required_2008_10_31_03_mangos_command required_2008_11_01_01_mangos_mangos_string bit;
|
||||||
|
|
||||||
|
DELETE FROM mangos_string WHERE entry IN (1119,1120,1121);
|
||||||
|
|
||||||
|
INSERT INTO mangos_string VALUES
|
||||||
|
(1119,'You must use male or female as gender.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
|
(1120,'You change gender of %s to %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
|
(1121,'Your gender changed to %s by %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
||||||
6
sql/updates/2008_11_01_02_mangos_command.sql
Normal file
6
sql/updates/2008_11_01_02_mangos_command.sql
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
ALTER TABLE db_version CHANGE COLUMN required_2008_11_01_01_mangos_mangos_string required_2008_11_01_02_mangos_command bit;
|
||||||
|
|
||||||
|
DELETE FROM command WHERE name IN ('modify gender');
|
||||||
|
|
||||||
|
INSERT INTO command VALUES
|
||||||
|
('modify gender',2,'Syntax: .modify gender male/female\r\n\r\nChange gender of selected player.');
|
||||||
|
|
@ -121,6 +121,8 @@ pkgdata_DATA = \
|
||||||
2008_10_31_01_mangos_creature_template.sql \
|
2008_10_31_01_mangos_creature_template.sql \
|
||||||
2008_10_31_02_mangos_mangos_string.sql \
|
2008_10_31_02_mangos_mangos_string.sql \
|
||||||
2008_10_31_03_mangos_command.sql \
|
2008_10_31_03_mangos_command.sql \
|
||||||
|
2008_11_01_01_mangos_mangos_string.sql \
|
||||||
|
2008_11_01_02_mangos_command.sql \
|
||||||
README
|
README
|
||||||
|
|
||||||
## Additional files to include when running 'make dist'
|
## Additional files to include when running 'make dist'
|
||||||
|
|
@ -223,4 +225,6 @@ EXTRA_DIST = \
|
||||||
2008_10_31_01_mangos_creature_template.sql \
|
2008_10_31_01_mangos_creature_template.sql \
|
||||||
2008_10_31_02_mangos_mangos_string.sql \
|
2008_10_31_02_mangos_mangos_string.sql \
|
||||||
2008_10_31_03_mangos_command.sql \
|
2008_10_31_03_mangos_command.sql \
|
||||||
|
2008_11_01_01_mangos_mangos_string.sql \
|
||||||
|
2008_11_01_02_mangos_command.sql \
|
||||||
README
|
README
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,7 @@ ChatCommand * ChatHandler::getCommandTable()
|
||||||
{ "drunk", SEC_MODERATOR, false, &ChatHandler::HandleDrunkCommand, "", NULL },
|
{ "drunk", SEC_MODERATOR, false, &ChatHandler::HandleDrunkCommand, "", NULL },
|
||||||
{ "standstate", SEC_GAMEMASTER, false, &ChatHandler::HandleStandStateCommand, "", NULL },
|
{ "standstate", SEC_GAMEMASTER, false, &ChatHandler::HandleStandStateCommand, "", NULL },
|
||||||
{ "morph", SEC_GAMEMASTER, false, &ChatHandler::HandleMorphCommand, "", NULL },
|
{ "morph", SEC_GAMEMASTER, false, &ChatHandler::HandleMorphCommand, "", NULL },
|
||||||
|
{ "gender", SEC_ADMINISTRATOR, false, &ChatHandler::HandleModifyGenderCommand, "", NULL },
|
||||||
{ NULL, 0, false, NULL, "", NULL }
|
{ NULL, 0, false, NULL, "", NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -170,6 +170,7 @@ class ChatHandler
|
||||||
bool HandleModifyHonorCommand (const char* args);
|
bool HandleModifyHonorCommand (const char* args);
|
||||||
bool HandleModifyRepCommand(const char* args);
|
bool HandleModifyRepCommand(const char* args);
|
||||||
bool HandleModifyArenaCommand(const char* args);
|
bool HandleModifyArenaCommand(const char* args);
|
||||||
|
bool HandleModifyGenderCommand(const char* args);
|
||||||
|
|
||||||
bool HandleNpcAddCommand(const char* args);
|
bool HandleNpcAddCommand(const char* args);
|
||||||
bool HandleNpcAddMoveCommand(const char* args);
|
bool HandleNpcAddMoveCommand(const char* args);
|
||||||
|
|
|
||||||
|
|
@ -695,7 +695,10 @@ enum MangosStrings
|
||||||
LANG_INVALID_CHARACTER_GUID = 1116,
|
LANG_INVALID_CHARACTER_GUID = 1116,
|
||||||
LANG_CHARACTER_GUID_IN_USE = 1117,
|
LANG_CHARACTER_GUID_IN_USE = 1117,
|
||||||
LANG_ITEMLIST_GUILD = 1118,
|
LANG_ITEMLIST_GUILD = 1118,
|
||||||
// Room for more level 3 1119-1199 not used
|
LANG_MUST_MALE_OR_FEMALE = 1119,
|
||||||
|
LANG_YOU_CHANGE_GENDER = 1120,
|
||||||
|
LANG_YOUR_GENDER_CHANGED = 1121,
|
||||||
|
// Room for more level 3 1122-1199 not used
|
||||||
|
|
||||||
// FREE IDS 1200-9999
|
// FREE IDS 1200-9999
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6155,3 +6155,63 @@ bool ChatHandler::HandleSendMessageCommand(const char* args)
|
||||||
PSendSysMessage(LANG_SENDMESSAGE,name.c_str(),msg_str);
|
PSendSysMessage(LANG_SENDMESSAGE,name.c_str(),msg_str);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ChatHandler::HandleModifyGenderCommand(const char *args)
|
||||||
|
{
|
||||||
|
if(!*args)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Player *player = getSelectedPlayer();
|
||||||
|
|
||||||
|
if(!player)
|
||||||
|
{
|
||||||
|
PSendSysMessage(LANG_NO_PLAYER);
|
||||||
|
SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
char const* gender_str = (char*)args;
|
||||||
|
int gender_len = strlen(gender_str);
|
||||||
|
|
||||||
|
uint32 displayId = player->GetNativeDisplayId();
|
||||||
|
char const* gender_full = NULL;
|
||||||
|
uint32 new_displayId = displayId;
|
||||||
|
Gender gender;
|
||||||
|
|
||||||
|
if(!strncmp(gender_str,"male",gender_len)) // MALE
|
||||||
|
{
|
||||||
|
if(player->getGender() == GENDER_MALE)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
gender_full = "male";
|
||||||
|
new_displayId = player->getRace() == RACE_BLOODELF ? displayId+1 : displayId-1;
|
||||||
|
gender = GENDER_MALE;
|
||||||
|
}
|
||||||
|
else if (!strncmp(gender_str,"female",gender_len)) // FEMALE
|
||||||
|
{
|
||||||
|
if(player->getGender() == GENDER_FEMALE)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
gender_full = "female";
|
||||||
|
new_displayId = player->getRace() == RACE_BLOODELF ? displayId-1 : displayId+1;
|
||||||
|
gender = GENDER_FEMALE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SendSysMessage(LANG_MUST_MALE_OR_FEMALE);
|
||||||
|
SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set gender
|
||||||
|
player->SetByteValue(UNIT_FIELD_BYTES_0, 2, gender);
|
||||||
|
|
||||||
|
// Change display ID
|
||||||
|
player->SetDisplayId(new_displayId);
|
||||||
|
player->SetNativeDisplayId(new_displayId);
|
||||||
|
|
||||||
|
PSendSysMessage(LANG_YOU_CHANGE_GENDER, player->GetName(),gender_full);
|
||||||
|
if (needReportToTarget(player))
|
||||||
|
ChatHandler(player).PSendSysMessage(LANG_YOUR_GENDER_CHANGED, gender_full,GetName());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue