mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-14 04:08:20 +00:00
renaming to compile
This commit is contained in:
parent
b11a41fd30
commit
1b84d3d514
@ -646,12 +646,6 @@ namespace DEVGMCommands {
|
|||||||
ChatPackets::SendSystemMessage(sysAddr, u"Switched control scheme.");
|
ChatPackets::SendSystemMessage(sysAddr, u"Switched control scheme.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApproveProperty(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
|
||||||
if (PropertyManagementComponent::Instance() != nullptr) {
|
|
||||||
PropertyManagementComponent::Instance()->UpdateApprovedStatus(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetUiState(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
void SetUiState(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
||||||
const auto splitArgs = GeneralUtils::SplitString(args, ' ');
|
const auto splitArgs = GeneralUtils::SplitString(args, ' ');
|
||||||
if (splitArgs.empty()) return;
|
if (splitArgs.empty()) return;
|
||||||
@ -910,55 +904,6 @@ namespace DEVGMCommands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MailItem(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
|
||||||
const auto splitArgs = GeneralUtils::SplitString(args, ' ');
|
|
||||||
if (splitArgs.size() < 2) return;
|
|
||||||
|
|
||||||
const auto& playerName = splitArgs[0];
|
|
||||||
|
|
||||||
auto playerInfo = Database::Get()->GetCharacterInfo(playerName);
|
|
||||||
|
|
||||||
uint32_t receiverID = 0;
|
|
||||||
if (!playerInfo) {
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Failed to find that player");
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
receiverID = playerInfo->id;
|
|
||||||
|
|
||||||
const auto lot = GeneralUtils::TryParse<LOT>(splitArgs.at(1));
|
|
||||||
|
|
||||||
if (!lot) {
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Invalid item lot.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
IMail::MailInfo mailInsert;
|
|
||||||
mailInsert.senderId = entity->GetObjectID();
|
|
||||||
mailInsert.senderUsername = "Darkflame Universe";
|
|
||||||
mailInsert.receiverId = receiverID;
|
|
||||||
mailInsert.recipient = playerName;
|
|
||||||
mailInsert.subject = "Lost item";
|
|
||||||
mailInsert.body = "This is a replacement item for one you lost.";
|
|
||||||
mailInsert.itemID = LWOOBJID_EMPTY;
|
|
||||||
mailInsert.itemLOT = lot.value();
|
|
||||||
mailInsert.itemSubkey = LWOOBJID_EMPTY;
|
|
||||||
mailInsert.itemCount = 1;
|
|
||||||
Database::Get()->InsertNewMail(mailInsert);
|
|
||||||
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Mail sent");
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetName(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
|
||||||
GameMessages::SendSetName(entity->GetObjectID(), GeneralUtils::UTF8ToUTF16(args), UNASSIGNED_SYSTEM_ADDRESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Title(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
|
||||||
std::string name = entity->GetCharacter()->GetName() + " - " + args;
|
|
||||||
GameMessages::SendSetName(entity->GetObjectID(), GeneralUtils::UTF8ToUTF16(name), UNASSIGNED_SYSTEM_ADDRESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Teleport(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
void Teleport(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
||||||
const auto splitArgs = GeneralUtils::SplitString(args, ' ');
|
const auto splitArgs = GeneralUtils::SplitString(args, ' ');
|
||||||
|
|
||||||
@ -1048,182 +993,6 @@ namespace DEVGMCommands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fly(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
|
||||||
const auto splitArgs = GeneralUtils::SplitString(args, ' ');
|
|
||||||
auto* character = entity->GetCharacter();
|
|
||||||
|
|
||||||
if (character) {
|
|
||||||
bool isFlying = character->GetIsFlying();
|
|
||||||
|
|
||||||
if (isFlying) {
|
|
||||||
GameMessages::SendSetJetPackMode(entity, false);
|
|
||||||
|
|
||||||
character->SetIsFlying(false);
|
|
||||||
} else {
|
|
||||||
float speedScale = 1.0f;
|
|
||||||
|
|
||||||
if (splitArgs.size() >= 1) {
|
|
||||||
const auto tempScaleStore = GeneralUtils::TryParse<float>(splitArgs.at(0));
|
|
||||||
|
|
||||||
if (tempScaleStore) {
|
|
||||||
speedScale = tempScaleStore.value();
|
|
||||||
} else {
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Failed to parse speed scale argument.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
float airSpeed = 20 * speedScale;
|
|
||||||
float maxAirSpeed = 30 * speedScale;
|
|
||||||
float verticalVelocity = 1.5 * speedScale;
|
|
||||||
|
|
||||||
GameMessages::SendSetJetPackMode(entity, true, true, false, 167, airSpeed, maxAirSpeed, verticalVelocity);
|
|
||||||
|
|
||||||
character->SetIsFlying(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Mute(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
|
||||||
const auto splitArgs = GeneralUtils::SplitString(args, ' ');
|
|
||||||
|
|
||||||
if (splitArgs.size() >= 1) {
|
|
||||||
auto* player = PlayerManager::GetPlayer(splitArgs[0]);
|
|
||||||
|
|
||||||
uint32_t accountId = 0;
|
|
||||||
LWOOBJID characterId = 0;
|
|
||||||
|
|
||||||
if (player == nullptr) {
|
|
||||||
auto characterInfo = Database::Get()->GetCharacterInfo(splitArgs[0]);
|
|
||||||
|
|
||||||
if (characterInfo) {
|
|
||||||
accountId = characterInfo->accountId;
|
|
||||||
characterId = characterInfo->id;
|
|
||||||
|
|
||||||
GeneralUtils::SetBit(characterId, eObjectBits::CHARACTER);
|
|
||||||
GeneralUtils::SetBit(characterId, eObjectBits::PERSISTENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (accountId == 0) {
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Count not find player of name: " + GeneralUtils::UTF8ToUTF16(splitArgs[0]));
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
auto* character = player->GetCharacter();
|
|
||||||
auto* user = character != nullptr ? character->GetParentUser() : nullptr;
|
|
||||||
if (user) accountId = user->GetAccountID();
|
|
||||||
characterId = player->GetObjectID();
|
|
||||||
}
|
|
||||||
|
|
||||||
time_t expire = 1; // Default to indefinate mute
|
|
||||||
|
|
||||||
if (splitArgs.size() >= 2) {
|
|
||||||
const auto days = GeneralUtils::TryParse<uint32_t>(splitArgs[1]);
|
|
||||||
if (!days) {
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Invalid days.");
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint32_t> hours;
|
|
||||||
if (splitArgs.size() >= 3) {
|
|
||||||
hours = GeneralUtils::TryParse<uint32_t>(splitArgs[2]);
|
|
||||||
if (!hours) {
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Invalid hours.");
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
expire = time(NULL);
|
|
||||||
expire += 24 * 60 * 60 * days.value();
|
|
||||||
expire += 60 * 60 * hours.value_or(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (accountId != 0) Database::Get()->UpdateAccountUnmuteTime(accountId, expire);
|
|
||||||
|
|
||||||
char buffer[32] = "brought up for review.\0";
|
|
||||||
|
|
||||||
if (expire != 1) {
|
|
||||||
std::tm* ptm = std::localtime(&expire);
|
|
||||||
// Format: Mo, 15.06.2009 20:20:00
|
|
||||||
std::strftime(buffer, 32, "%a, %d.%m.%Y %H:%M:%S", ptm);
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto timeStr = GeneralUtils::ASCIIToUTF16(std::string(buffer));
|
|
||||||
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Muted: " + GeneralUtils::UTF8ToUTF16(splitArgs[0]) + u" until " + timeStr);
|
|
||||||
|
|
||||||
//Notify chat about it
|
|
||||||
CBITSTREAM;
|
|
||||||
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT_INTERNAL, eChatInternalMessageType::MUTE_UPDATE);
|
|
||||||
|
|
||||||
bitStream.Write(characterId);
|
|
||||||
bitStream.Write(expire);
|
|
||||||
|
|
||||||
Game::chatServer->Send(&bitStream, SYSTEM_PRIORITY, RELIABLE, 0, Game::chatSysAddr, false);
|
|
||||||
} else {
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Correct usage: /mute <username> <days (optional)> <hours (optional)>");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Kick(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
|
||||||
const auto splitArgs = GeneralUtils::SplitString(args, ' ');
|
|
||||||
if (splitArgs.size() == 1) {
|
|
||||||
auto* player = PlayerManager::GetPlayer(splitArgs[0]);
|
|
||||||
|
|
||||||
std::u16string username = GeneralUtils::UTF8ToUTF16(splitArgs[0]);
|
|
||||||
if (player == nullptr) {
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Count not find player of name: " + username);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Game::server->Disconnect(player->GetSystemAddress(), eServerDisconnectIdentifiers::KICK);
|
|
||||||
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Kicked: " + username);
|
|
||||||
} else {
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Correct usage: /kick <username>");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Ban(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
|
||||||
const auto splitArgs = GeneralUtils::SplitString(args, ' ');
|
|
||||||
|
|
||||||
if (splitArgs.size() == 1) {
|
|
||||||
auto* player = PlayerManager::GetPlayer(splitArgs[0]);
|
|
||||||
|
|
||||||
uint32_t accountId = 0;
|
|
||||||
|
|
||||||
if (player == nullptr) {
|
|
||||||
auto characterInfo = Database::Get()->GetCharacterInfo(splitArgs[0]);
|
|
||||||
|
|
||||||
if (characterInfo) {
|
|
||||||
accountId = characterInfo->accountId;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (accountId == 0) {
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Count not find player of name: " + GeneralUtils::UTF8ToUTF16(splitArgs[0]));
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
auto* character = player->GetCharacter();
|
|
||||||
auto* user = character != nullptr ? character->GetParentUser() : nullptr;
|
|
||||||
if (user) accountId = user->GetAccountID();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (accountId != 0) Database::Get()->UpdateAccountBan(accountId, true);
|
|
||||||
|
|
||||||
if (player != nullptr) {
|
|
||||||
Game::server->Disconnect(player->GetSystemAddress(), eServerDisconnectIdentifiers::FREE_TRIAL_EXPIRED);
|
|
||||||
}
|
|
||||||
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Banned: " + GeneralUtils::ASCIIToUTF16(splitArgs[0]));
|
|
||||||
} else {
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Correct usage: /ban <username>");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void BuffMe(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
void BuffMe(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
||||||
auto dest = static_cast<DestroyableComponent*>(entity->GetComponent(eReplicaComponentType::DESTROYABLE));
|
auto dest = static_cast<DestroyableComponent*>(entity->GetComponent(eReplicaComponentType::DESTROYABLE));
|
||||||
if (dest) {
|
if (dest) {
|
||||||
@ -1527,42 +1296,6 @@ namespace DEVGMCommands {
|
|||||||
ch->SetCoins(money.value(), eLootSourceType::MODERATION);
|
ch->SetCoins(money.value(), eLootSourceType::MODERATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GmInvis(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
|
||||||
GameMessages::SendToggleGMInvis(entity->GetObjectID(), true, UNASSIGNED_SYSTEM_ADDRESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GmImmune(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
|
||||||
const auto splitArgs = GeneralUtils::SplitString(args, ' ');
|
|
||||||
if (splitArgs.empty()) return;
|
|
||||||
|
|
||||||
auto* destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
|
||||||
|
|
||||||
const auto state = GeneralUtils::TryParse<int32_t>(splitArgs[0]);
|
|
||||||
|
|
||||||
if (!state) {
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Invalid state.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (destroyableComponent) destroyableComponent->SetIsGMImmune(state.value());
|
|
||||||
}
|
|
||||||
|
|
||||||
void AttackImmune(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
|
||||||
const auto splitArgs = GeneralUtils::SplitString(args, ' ');
|
|
||||||
if (splitArgs.empty()) return;
|
|
||||||
|
|
||||||
auto* destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
|
||||||
|
|
||||||
const auto state = GeneralUtils::TryParse<int32_t>(splitArgs[0]);
|
|
||||||
|
|
||||||
if (!state) {
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Invalid state.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (destroyableComponent) destroyableComponent->SetIsImmune(state.value());
|
|
||||||
}
|
|
||||||
|
|
||||||
void Buff(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
void Buff(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
||||||
const auto splitArgs = GeneralUtils::SplitString(args, ' ');
|
const auto splitArgs = GeneralUtils::SplitString(args, ' ');
|
||||||
if (splitArgs.size() < 2) return;
|
if (splitArgs.size() < 2) return;
|
||||||
@ -1933,6 +1666,24 @@ namespace DEVGMCommands {
|
|||||||
ChatPackets::SendSystemMessage(sysAddr, u"Deleted inventory " + GeneralUtils::UTF8ToUTF16(splitArgs[0]));
|
ChatPackets::SendSystemMessage(sysAddr, u"Deleted inventory " + GeneralUtils::UTF8ToUTF16(splitArgs[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CastSkill(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
||||||
|
const auto splitArgs = GeneralUtils::SplitString(args, ' ');
|
||||||
|
if (splitArgs.empty()) return;
|
||||||
|
|
||||||
|
auto* skillComponent = entity->GetComponent<SkillComponent>();
|
||||||
|
if (skillComponent) {
|
||||||
|
const auto skillId = GeneralUtils::TryParse<uint32_t>(splitArgs[0]);
|
||||||
|
|
||||||
|
if (!skillId) {
|
||||||
|
ChatPackets::SendSystemMessage(sysAddr, u"Error getting skill ID.");
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
skillComponent->CastSkill(skillId.value(), entity->GetObjectID(), entity->GetObjectID());
|
||||||
|
ChatPackets::SendSystemMessage(sysAddr, u"Cast skill");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SetSkillSlot(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
void SetSkillSlot(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
||||||
const auto splitArgs = GeneralUtils::SplitString(args, ' ');
|
const auto splitArgs = GeneralUtils::SplitString(args, ' ');
|
||||||
if (splitArgs.size() < 2) return;
|
if (splitArgs.size() < 2) return;
|
||||||
@ -2185,6 +1936,277 @@ namespace DEVGMCommands {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace GreaterThanZeroCommands {
|
||||||
|
|
||||||
|
|
||||||
|
void Kick(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
||||||
|
const auto splitArgs = GeneralUtils::SplitString(args, ' ');
|
||||||
|
if (splitArgs.size() == 1) {
|
||||||
|
auto* player = PlayerManager::GetPlayer(splitArgs[0]);
|
||||||
|
|
||||||
|
std::u16string username = GeneralUtils::UTF8ToUTF16(splitArgs[0]);
|
||||||
|
if (player == nullptr) {
|
||||||
|
ChatPackets::SendSystemMessage(sysAddr, u"Count not find player of name: " + username);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Game::server->Disconnect(player->GetSystemAddress(), eServerDisconnectIdentifiers::KICK);
|
||||||
|
|
||||||
|
ChatPackets::SendSystemMessage(sysAddr, u"Kicked: " + username);
|
||||||
|
} else {
|
||||||
|
ChatPackets::SendSystemMessage(sysAddr, u"Correct usage: /kick <username>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Ban(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
||||||
|
const auto splitArgs = GeneralUtils::SplitString(args, ' ');
|
||||||
|
|
||||||
|
if (splitArgs.size() == 1) {
|
||||||
|
auto* player = PlayerManager::GetPlayer(splitArgs[0]);
|
||||||
|
|
||||||
|
uint32_t accountId = 0;
|
||||||
|
|
||||||
|
if (player == nullptr) {
|
||||||
|
auto characterInfo = Database::Get()->GetCharacterInfo(splitArgs[0]);
|
||||||
|
|
||||||
|
if (characterInfo) {
|
||||||
|
accountId = characterInfo->accountId;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (accountId == 0) {
|
||||||
|
ChatPackets::SendSystemMessage(sysAddr, u"Count not find player of name: " + GeneralUtils::UTF8ToUTF16(splitArgs[0]));
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
auto* character = player->GetCharacter();
|
||||||
|
auto* user = character != nullptr ? character->GetParentUser() : nullptr;
|
||||||
|
if (user) accountId = user->GetAccountID();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (accountId != 0) Database::Get()->UpdateAccountBan(accountId, true);
|
||||||
|
|
||||||
|
if (player != nullptr) {
|
||||||
|
Game::server->Disconnect(player->GetSystemAddress(), eServerDisconnectIdentifiers::FREE_TRIAL_EXPIRED);
|
||||||
|
}
|
||||||
|
|
||||||
|
ChatPackets::SendSystemMessage(sysAddr, u"Banned: " + GeneralUtils::ASCIIToUTF16(splitArgs[0]));
|
||||||
|
} else {
|
||||||
|
ChatPackets::SendSystemMessage(sysAddr, u"Correct usage: /ban <username>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MailItem(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
||||||
|
const auto splitArgs = GeneralUtils::SplitString(args, ' ');
|
||||||
|
if (splitArgs.size() < 2) return;
|
||||||
|
|
||||||
|
const auto& playerName = splitArgs[0];
|
||||||
|
|
||||||
|
auto playerInfo = Database::Get()->GetCharacterInfo(playerName);
|
||||||
|
|
||||||
|
uint32_t receiverID = 0;
|
||||||
|
if (!playerInfo) {
|
||||||
|
ChatPackets::SendSystemMessage(sysAddr, u"Failed to find that player");
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
receiverID = playerInfo->id;
|
||||||
|
|
||||||
|
const auto lot = GeneralUtils::TryParse<LOT>(splitArgs.at(1));
|
||||||
|
|
||||||
|
if (!lot) {
|
||||||
|
ChatPackets::SendSystemMessage(sysAddr, u"Invalid item lot.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IMail::MailInfo mailInsert;
|
||||||
|
mailInsert.senderId = entity->GetObjectID();
|
||||||
|
mailInsert.senderUsername = "Darkflame Universe";
|
||||||
|
mailInsert.receiverId = receiverID;
|
||||||
|
mailInsert.recipient = playerName;
|
||||||
|
mailInsert.subject = "Lost item";
|
||||||
|
mailInsert.body = "This is a replacement item for one you lost.";
|
||||||
|
mailInsert.itemID = LWOOBJID_EMPTY;
|
||||||
|
mailInsert.itemLOT = lot.value();
|
||||||
|
mailInsert.itemSubkey = LWOOBJID_EMPTY;
|
||||||
|
mailInsert.itemCount = 1;
|
||||||
|
Database::Get()->InsertNewMail(mailInsert);
|
||||||
|
|
||||||
|
ChatPackets::SendSystemMessage(sysAddr, u"Mail sent");
|
||||||
|
}
|
||||||
|
|
||||||
|
void ApproveProperty(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
||||||
|
if (PropertyManagementComponent::Instance() != nullptr) {
|
||||||
|
PropertyManagementComponent::Instance()->UpdateApprovedStatus(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mute(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
||||||
|
const auto splitArgs = GeneralUtils::SplitString(args, ' ');
|
||||||
|
|
||||||
|
if (splitArgs.size() >= 1) {
|
||||||
|
auto* player = PlayerManager::GetPlayer(splitArgs[0]);
|
||||||
|
|
||||||
|
uint32_t accountId = 0;
|
||||||
|
LWOOBJID characterId = 0;
|
||||||
|
|
||||||
|
if (player == nullptr) {
|
||||||
|
auto characterInfo = Database::Get()->GetCharacterInfo(splitArgs[0]);
|
||||||
|
|
||||||
|
if (characterInfo) {
|
||||||
|
accountId = characterInfo->accountId;
|
||||||
|
characterId = characterInfo->id;
|
||||||
|
|
||||||
|
GeneralUtils::SetBit(characterId, eObjectBits::CHARACTER);
|
||||||
|
GeneralUtils::SetBit(characterId, eObjectBits::PERSISTENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (accountId == 0) {
|
||||||
|
ChatPackets::SendSystemMessage(sysAddr, u"Count not find player of name: " + GeneralUtils::UTF8ToUTF16(splitArgs[0]));
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
auto* character = player->GetCharacter();
|
||||||
|
auto* user = character != nullptr ? character->GetParentUser() : nullptr;
|
||||||
|
if (user) accountId = user->GetAccountID();
|
||||||
|
characterId = player->GetObjectID();
|
||||||
|
}
|
||||||
|
|
||||||
|
time_t expire = 1; // Default to indefinate mute
|
||||||
|
|
||||||
|
if (splitArgs.size() >= 2) {
|
||||||
|
const auto days = GeneralUtils::TryParse<uint32_t>(splitArgs[1]);
|
||||||
|
if (!days) {
|
||||||
|
ChatPackets::SendSystemMessage(sysAddr, u"Invalid days.");
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<uint32_t> hours;
|
||||||
|
if (splitArgs.size() >= 3) {
|
||||||
|
hours = GeneralUtils::TryParse<uint32_t>(splitArgs[2]);
|
||||||
|
if (!hours) {
|
||||||
|
ChatPackets::SendSystemMessage(sysAddr, u"Invalid hours.");
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
expire = time(NULL);
|
||||||
|
expire += 24 * 60 * 60 * days.value();
|
||||||
|
expire += 60 * 60 * hours.value_or(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (accountId != 0) Database::Get()->UpdateAccountUnmuteTime(accountId, expire);
|
||||||
|
|
||||||
|
char buffer[32] = "brought up for review.\0";
|
||||||
|
|
||||||
|
if (expire != 1) {
|
||||||
|
std::tm* ptm = std::localtime(&expire);
|
||||||
|
// Format: Mo, 15.06.2009 20:20:00
|
||||||
|
std::strftime(buffer, 32, "%a, %d.%m.%Y %H:%M:%S", ptm);
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto timeStr = GeneralUtils::ASCIIToUTF16(std::string(buffer));
|
||||||
|
|
||||||
|
ChatPackets::SendSystemMessage(sysAddr, u"Muted: " + GeneralUtils::UTF8ToUTF16(splitArgs[0]) + u" until " + timeStr);
|
||||||
|
|
||||||
|
//Notify chat about it
|
||||||
|
CBITSTREAM;
|
||||||
|
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT_INTERNAL, eChatInternalMessageType::MUTE_UPDATE);
|
||||||
|
|
||||||
|
bitStream.Write(characterId);
|
||||||
|
bitStream.Write(expire);
|
||||||
|
|
||||||
|
Game::chatServer->Send(&bitStream, SYSTEM_PRIORITY, RELIABLE, 0, Game::chatSysAddr, false);
|
||||||
|
} else {
|
||||||
|
ChatPackets::SendSystemMessage(sysAddr, u"Correct usage: /mute <username> <days (optional)> <hours (optional)>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Fly(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
||||||
|
const auto splitArgs = GeneralUtils::SplitString(args, ' ');
|
||||||
|
auto* character = entity->GetCharacter();
|
||||||
|
|
||||||
|
if (character) {
|
||||||
|
bool isFlying = character->GetIsFlying();
|
||||||
|
|
||||||
|
if (isFlying) {
|
||||||
|
GameMessages::SendSetJetPackMode(entity, false);
|
||||||
|
|
||||||
|
character->SetIsFlying(false);
|
||||||
|
} else {
|
||||||
|
float speedScale = 1.0f;
|
||||||
|
|
||||||
|
if (splitArgs.size() >= 1) {
|
||||||
|
const auto tempScaleStore = GeneralUtils::TryParse<float>(splitArgs.at(0));
|
||||||
|
|
||||||
|
if (tempScaleStore) {
|
||||||
|
speedScale = tempScaleStore.value();
|
||||||
|
} else {
|
||||||
|
ChatPackets::SendSystemMessage(sysAddr, u"Failed to parse speed scale argument.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float airSpeed = 20 * speedScale;
|
||||||
|
float maxAirSpeed = 30 * speedScale;
|
||||||
|
float verticalVelocity = 1.5 * speedScale;
|
||||||
|
|
||||||
|
GameMessages::SendSetJetPackMode(entity, true, true, false, 167, airSpeed, maxAirSpeed, verticalVelocity);
|
||||||
|
|
||||||
|
character->SetIsFlying(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AttackImmune(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
||||||
|
const auto splitArgs = GeneralUtils::SplitString(args, ' ');
|
||||||
|
if (splitArgs.empty()) return;
|
||||||
|
|
||||||
|
auto* destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
||||||
|
|
||||||
|
const auto state = GeneralUtils::TryParse<int32_t>(splitArgs[0]);
|
||||||
|
|
||||||
|
if (!state) {
|
||||||
|
ChatPackets::SendSystemMessage(sysAddr, u"Invalid state.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (destroyableComponent) destroyableComponent->SetIsImmune(state.value());
|
||||||
|
}
|
||||||
|
|
||||||
|
void GmImmune(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
||||||
|
const auto splitArgs = GeneralUtils::SplitString(args, ' ');
|
||||||
|
if (splitArgs.empty()) return;
|
||||||
|
|
||||||
|
auto* destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
||||||
|
|
||||||
|
const auto state = GeneralUtils::TryParse<int32_t>(splitArgs[0]);
|
||||||
|
|
||||||
|
if (!state) {
|
||||||
|
ChatPackets::SendSystemMessage(sysAddr, u"Invalid state.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (destroyableComponent) destroyableComponent->SetIsGMImmune(state.value());
|
||||||
|
}
|
||||||
|
|
||||||
|
void GmInvis(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
||||||
|
GameMessages::SendToggleGMInvis(entity->GetObjectID(), true, UNASSIGNED_SYSTEM_ADDRESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetName(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
||||||
|
GameMessages::SendSetName(entity->GetObjectID(), GeneralUtils::UTF8ToUTF16(args), UNASSIGNED_SYSTEM_ADDRESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Title(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
||||||
|
std::string name = entity->GetCharacter()->GetName() + " - " + args;
|
||||||
|
GameMessages::SendSetName(entity->GetObjectID(), GeneralUtils::UTF8ToUTF16(name), UNASSIGNED_SYSTEM_ADDRESS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SlashCommandHandler::SendAnnouncement(const std::string& title, const std::string& message) {
|
void SlashCommandHandler::SendAnnouncement(const std::string& title, const std::string& message) {
|
||||||
AMFArrayValue args;
|
AMFArrayValue args;
|
||||||
|
|
||||||
|
@ -34,12 +34,12 @@ namespace DEVGMCommands {
|
|||||||
void Kill(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void Kill(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void Metrics(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void Metrics(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void Announce(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void Announce(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void SetAnnouncementTitle(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void SetAnnTitle(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void SetAnnouncementMessage(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void SetAnnMsg(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void ShutdownUniverse(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void ShutdownUniverse(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void SetMinifig(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void SetMinifig(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void TestMap(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void TestMap(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void ReportProximityPhysics(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void ReportProxPhys(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void SpawnPhysicsVerts(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void SpawnPhysicsVerts(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void Teleport(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void Teleport(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void ActivateSpawner(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void ActivateSpawner(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
@ -48,11 +48,11 @@ namespace DEVGMCommands {
|
|||||||
void Unboost(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void Unboost(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void Buff(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void Buff(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void BuffMe(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void BuffMe(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void BuffMedium(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void BuffMed(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void ClearFlag(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void ClearFlag(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void CompleteMission(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void CompleteMission(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void CreatePrivateInstance(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void CreatePrivate(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void DebugUI(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void DebugUi(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void Dismount(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void Dismount(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void ReloadConfig(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void ReloadConfig(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void ForceSave(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void ForceSave(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
@ -60,33 +60,33 @@ namespace DEVGMCommands {
|
|||||||
void FreeMoney(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void FreeMoney(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void GetNavmeshHeight(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void GetNavmeshHeight(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void GiveUScore(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void GiveUScore(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void GMAddItem(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void GmAddItem(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void Inspect(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void Inspect(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void ListSpawns(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void ListSpawns(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void LocationRotation(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void LocRow(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void Lookup(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void Lookup(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void PlayAnimation(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void PlayAnimation(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void PlayEffect(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void PlayEffect(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void PlayLevelFX(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void PlayLvlFx(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void PlayRebuildFX(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void PlayRebuildFx(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void Position(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void Pos(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void RefilStats(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void RefillStats(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void Reforge(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void Reforge(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void ResetMission(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void ResetMission(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void Rotation(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void Rot(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void RunMacro(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void RunMacro(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void SetControlScheme(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void SetControlScheme(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void SetCurrency(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void SetCurrency(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void SetFlag(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void SetFlag(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void SetInventorySize(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void SetInventorySize(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void SetUIState(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void SetUiState(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void Spawn(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void Spawn(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void SpawnGroup(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void SpawnGroup(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void SpeedBoost(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void SpeedBoost(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void StartCelebration(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void StartCelebration(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void StopEffect(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void StopEffect(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void Toggle(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void Toggle(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void TeleportAll(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void TpAll(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void TriggerSpawner(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void TriggerSpawner(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void UnlockEmote(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void UnlockEmote(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void SetLevel(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void SetLevel(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
@ -107,11 +107,11 @@ namespace GMZeroCommands {
|
|||||||
void Info(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void Info(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void Die(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void Die(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void Ping(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void Ping(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void PVP(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void Pvp(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void RequestMailCount(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void RequestMailCount(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void Who(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void Who(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void FixStats(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void FixStats(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void JoinPrivateInstance(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void Join(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void LeaveZone(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void LeaveZone(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,8 +123,8 @@ namespace GreaterThanZeroCommands {
|
|||||||
void Mute(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void Mute(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void Fly(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void Fly(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void AttackImmune(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void AttackImmune(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void GMImmune(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void GmImmune(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void GMInvis(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void GmInvis(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void SetName(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void SetName(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void Title(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void Title(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user