mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-22 05:27:19 +00:00
Slash commands: Update compares (#1270)
use case insensitive compare use character name for kill instead of account name Use correct Id for muting when a player is found
This commit is contained in:
parent
8cd5bf7b8d
commit
59303a232e
@ -228,9 +228,9 @@ Player* Player::GetPlayer(const std::string& name) {
|
|||||||
|
|
||||||
for (auto* character : characters) {
|
for (auto* character : characters) {
|
||||||
if (!character->IsPlayer()) continue;
|
if (!character->IsPlayer()) continue;
|
||||||
|
|
||||||
if (character->GetCharacter()->GetName() == name) {
|
if (GeneralUtils::CaseInsensitiveStringCompare(name, character->GetCharacter()->GetName())) {
|
||||||
return static_cast<Player*>(character);
|
return dynamic_cast<Player*>(character);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ User* UserManager::GetUser(const SystemAddress& sysAddr) {
|
|||||||
User* UserManager::GetUser(const std::string& username) {
|
User* UserManager::GetUser(const std::string& username) {
|
||||||
for (auto p : m_Users) {
|
for (auto p : m_Users) {
|
||||||
if (p.second) {
|
if (p.second) {
|
||||||
if (p.second->GetUsername() == username) return p.second;
|
if (GeneralUtils::CaseInsensitiveStringCompare(p.second->GetUsername(), username)) return p.second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -448,9 +448,8 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
if (chatCommand == "kill" && args.size() == 1 && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
|
if (chatCommand == "kill" && args.size() == 1 && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Brutally murdering that player, if online on this server.");
|
ChatPackets::SendSystemMessage(sysAddr, u"Brutally murdering that player, if online on this server.");
|
||||||
|
|
||||||
auto* user = UserManager::Instance()->GetUser(args[0]);
|
auto* player = Player::GetPlayer(args[0]);
|
||||||
if (user) {
|
if (player) {
|
||||||
auto* player = Game::entityManager->GetEntity(user->GetLoggedInChar());
|
|
||||||
player->Smash(entity->GetObjectID());
|
player->Smash(entity->GetObjectID());
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"It has been done, do you feel good about yourself now?");
|
ChatPackets::SendSystemMessage(sysAddr, u"It has been done, do you feel good about yourself now?");
|
||||||
return;
|
return;
|
||||||
@ -1042,7 +1041,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
accountId = player->GetParentUser()->GetAccountID();
|
accountId = player->GetParentUser()->GetAccountID();
|
||||||
characterId = player->GetCharacter()->GetID();
|
characterId = player->GetObjectID();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* userUpdate = Database::CreatePreppedStmt("UPDATE accounts SET mute_expire = ? WHERE id = ?;");
|
auto* userUpdate = Database::CreatePreppedStmt("UPDATE accounts SET mute_expire = ? WHERE id = ?;");
|
||||||
|
Loading…
Reference in New Issue
Block a user