| 217 | static ChatCommand groupCommandTable[] = |
| 218 | { |
| 219 | { "leader", SEC_ADMINISTRATOR, &ChatHandler::HandleGroupLeaderCommand, "", NULL }, |
| 220 | { "disband", SEC_ADMINISTRATOR, &ChatHandler::HandleGroupDisbandCommand, "", NULL }, |
| 221 | { "remove", SEC_ADMINISTRATOR, &ChatHandler::HandleGroupRemoveCommand, "", NULL }, |
| 222 | { NULL, 0, NULL, "", NULL } |
| 223 | }; |
| 224 | |
| 1097 | |
| 1098 | bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player* &plr, Group* &group, uint64 &guid, bool offline) |
| 1099 | { |
| 1100 | plr = NULL; |
| 1101 | guid = 0; |
| 1102 | |
| 1103 | if(cname) |
| 1104 | { |
| 1105 | std::string name = cname; |
| 1106 | if(!name.empty()) |
| 1107 | { |
| 1108 | if(!normalizePlayerName(name)) |
| 1109 | { |
| 1110 | PSendSysMessage(LANG_PLAYER_NOT_FOUND); |
| 1111 | SetSentErrorMessage(true); |
| 1112 | return false; |
| 1113 | } |
| 1114 | |
| 1115 | plr = objmgr.GetPlayer(name.c_str()); |
| 1116 | if(offline) |
| 1117 | guid = objmgr.GetPlayerGUIDByName(name.c_str()); |
| 1118 | } |
| 1119 | } |
| 1120 | |
| 1121 | if(plr) |
| 1122 | { |
| 1123 | group = plr->GetGroup(); |
| 1124 | if(!guid || !offline) |
| 1125 | guid = plr->GetGUID(); |
| 1126 | } |
| 1127 | else |
| 1128 | { |
| 1129 | if(getSelectedPlayer()) |
| 1130 | plr = getSelectedPlayer(); |
| 1131 | else |
| 1132 | plr = m_session->GetPlayer(); |
| 1133 | |
| 1134 | if(!guid || !offline) |
| 1135 | guid = plr->GetGUID(); |
| 1136 | group = plr->GetGroup(); |
| 1137 | } |
| 1138 | |
| 1139 | return true; |
| 1140 | } |