| 6229 | bool ChatHandler::HandlePlayAllCommand(const char* args) |
| 6230 | { |
| 6231 | if(!*args) |
| 6232 | return false; |
| 6233 | |
| 6234 | uint32 soundId = atoi((char*)args); |
| 6235 | |
| 6236 | if(!sSoundEntriesStore.LookupEntry(soundId)) |
| 6237 | { |
| 6238 | PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId); |
| 6239 | SetSentErrorMessage(true); |
| 6240 | return false; |
| 6241 | } |
| 6242 | |
| 6243 | WorldPacket data(SMSG_PLAY_SOUND, 4); |
| 6244 | data << uint32(soundId) << m_session->GetPlayer()->GetGUID(); |
| 6245 | sWorld.SendGlobalMessage(&data); |
| 6246 | |
| 6247 | PSendSysMessage(LANG_COMMAND_PLAYED_TO_ALL, soundId); |
| 6248 | return true; |
| 6249 | } |
| 6250 | |
| 6251 | bool ChatHandler::HandleModifyGenderCommand(const char *args) |
| 6252 | { |
| 6253 | if(!*args) return false; |
| 6254 | Player *player = getSelectedPlayer(); |
| 6255 | |
| 6256 | if(!player) |
| 6257 | { |
| 6258 | PSendSysMessage(LANG_NO_PLAYER); |
| 6259 | SetSentErrorMessage(true); |
| 6260 | return false; |
| 6261 | } |
| 6262 | |
| 6263 | std::string gender = (char*)args; |
| 6264 | uint32 displayId = player->GetNativeDisplayId(); |
| 6265 | |
| 6266 | if(gender == "male") // MALE |
| 6267 | { |
| 6268 | if(player->getGender() == GENDER_MALE) |
| 6269 | { |
| 6270 | PSendSysMessage("%s is already male", player->GetName()); |
| 6271 | SetSentErrorMessage(true); |
| 6272 | return false; |
| 6273 | } |
| 6274 | |
| 6275 | // Set gender |
| 6276 | player->SetByteValue(UNIT_FIELD_BYTES_0, 2, GENDER_MALE); |
| 6277 | // Change display ID |
| 6278 | player->SetDisplayId(player->getRace() == RACE_BLOODELF ? displayId+1 : displayId-1); |
| 6279 | player->SetNativeDisplayId(player->getRace() == RACE_BLOODELF ? displayId+1 : displayId-1); |
| 6280 | |
| 6281 | ChatHandler(player).PSendSysMessage("Gender changed. You are now a man!"); |
| 6282 | PSendSysMessage("Gender changed for %s", player->GetName()); |
| 6283 | return true; |
| 6284 | } |
| 6285 | else if(gender == "female") // FEMALE |
| 6286 | { |
| 6287 | if(player->getGender() == GENDER_FEMALE) |
| 6288 | { |
| 6289 | PSendSysMessage("%s is already female", player->GetName()); |
| 6290 | SetSentErrorMessage(true); |
| 6291 | return false; |
| 6292 | } |
| 6293 | |
| 6294 | // Set gender |
| 6295 | player->SetByteValue(UNIT_FIELD_BYTES_0, 2, GENDER_FEMALE); |
| 6296 | // Change display ID |
| 6297 | player->SetDisplayId(player->getRace() == RACE_BLOODELF ? displayId-1 : displayId+1); |
| 6298 | player->SetNativeDisplayId(player->getRace() == RACE_BLOODELF ? displayId-1 : displayId+1); |
| 6299 | |
| 6300 | ChatHandler(player).PSendSysMessage("Gender changed. You are now a woman!"); |
| 6301 | PSendSysMessage("Gender changed for %s", player->GetName()); |
| 6302 | return true; |
| 6303 | } |
| 6304 | else |
| 6305 | { |
| 6306 | PSendSysMessage("You must use male or female as gender."); |
| 6307 | SetSentErrorMessage(true); |
| 6308 | return false; |
| 6309 | } |
| 6310 | |
| 6311 | return true; |
| 6312 | } |
| 6313 | |