remove unused code and callbacktimers in testmap (#620)

This commit is contained in:
Aaron Kimbrell 2022-07-08 22:25:44 -05:00 committed by GitHub
parent 3865a186a7
commit dddc33607b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1518,61 +1518,36 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
const auto objid = entity->GetObjectID(); const auto objid = entity->GetObjectID();
if (force || CheckIfAccessibleZone(reqZone)) { // to prevent tomfoolery if (force || CheckIfAccessibleZone(reqZone)) { // to prevent tomfoolery
bool darwin = true; //Putting this on true, as I'm sick of having to wait 3-4 seconds on a transfer while trying to quickly moderate properties
Character* character = entity->GetCharacter(); ZoneInstanceManager::Instance()->RequestZoneTransfer(Game::server, reqZone, cloneId, false, [objid](bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, std::string serverIP, uint16_t serverPort) {
if (character) {
std::string lowerName = character->GetName();
std::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), ::tolower);
// feel free to add your name to the list
if (lowerName.find("max") != std::string::npos || lowerName.find("darwin") != std::string::npos || lowerName.find("gie") != std::string::npos) {
darwin = true;
}
}
if (!darwin) {
GameMessages::SendPlayAnimation(entity, u"lup-teleport");
GameMessages::SendSetStunned(objid, PUSH, user->GetSystemAddress(),
LWOOBJID_EMPTY, true, true, true, true, true, true, true, true
);
}
ZoneInstanceManager::Instance()->RequestZoneTransfer(Game::server, reqZone, cloneId, false, [objid, darwin](bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, std::string serverIP, uint16_t serverPort) {
auto* entity = EntityManager::Instance()->GetEntity(objid); auto* entity = EntityManager::Instance()->GetEntity(objid);
if (!entity) return;
if (entity == nullptr) { const auto sysAddr = entity->GetSystemAddress();
return;
ChatPackets::SendSystemMessage(sysAddr, u"Transfering map...");
Game::logger->Log("UserManager", "Transferring %s to Zone %i (Instance %i | Clone %i | Mythran Shift: %s) with IP %s and Port %i\n", sysAddr.ToString(), zoneID, zoneInstance, zoneClone, mythranShift == true ? "true" : "false", serverIP.c_str(), serverPort);
if (entity->GetCharacter()) {
entity->GetCharacter()->SetZoneID(zoneID);
entity->GetCharacter()->SetZoneInstance(zoneInstance);
entity->GetCharacter()->SetZoneClone(zoneClone);
entity->GetComponent<CharacterComponent>()->SetLastRocketConfig(u"");
} }
float transferTime = 3.32999992370605f; entity->GetCharacter()->SaveXMLToDatabase();
if (darwin) transferTime = 0.0f;
entity->AddCallbackTimer(transferTime, [=] { WorldPackets::SendTransferToWorld(sysAddr, serverIP, serverPort, mythranShift);
const auto sysAddr = entity->GetSystemAddress(); return;
});
ChatPackets::SendSystemMessage(sysAddr, u"Transfering map..."); } else {
std::string msg = "ZoneID not found or allowed: ";
Game::logger->Log("UserManager", "Transferring %s to Zone %i (Instance %i | Clone %i | Mythran Shift: %s) with IP %s and Port %i\n", sysAddr.ToString(), zoneID, zoneInstance, zoneClone, mythranShift == true ? "true" : "false", serverIP.c_str(), serverPort); msg.append(args[0]);
if (entity->GetCharacter()) { ChatPackets::SendSystemMessage(sysAddr, GeneralUtils::ASCIIToUTF16(msg, msg.size()));
entity->GetCharacter()->SetZoneID(zoneID); }
entity->GetCharacter()->SetZoneInstance(zoneInstance); }
entity->GetCharacter()->SetZoneClone(zoneClone);
entity->GetComponent<CharacterComponent>()->SetLastRocketConfig(u"");
}
entity->GetCharacter()->SaveXMLToDatabase();
WorldPackets::SendTransferToWorld(sysAddr, serverIP, serverPort, mythranShift);
});
return;
});
} else {
std::string msg = "ZoneID not found or allowed: ";
msg.append(args[0]);
ChatPackets::SendSystemMessage(sysAddr, GeneralUtils::ASCIIToUTF16(msg, msg.size()));
}
}
if (chatCommand == "createprivate" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER && args.size() >= 3) if (chatCommand == "createprivate" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER && args.size() >= 3)
{ {