From 00597f9b18e5f4856f1434fb3845a33c80e916e3 Mon Sep 17 00:00:00 2001 From: Ben Saine Date: Tue, 19 Oct 2021 21:10:38 +0000 Subject: [PATCH] self kill command --- code/ryzom/client/src/commands.cpp | 324 ++++++++++++++--------------- 1 file changed, 161 insertions(+), 163 deletions(-) diff --git a/code/ryzom/client/src/commands.cpp b/code/ryzom/client/src/commands.cpp index fad157147..18f2eb779 100644 --- a/code/ryzom/client/src/commands.cpp +++ b/code/ryzom/client/src/commands.cpp @@ -4,7 +4,7 @@ // This source file has been modified by the following contributors: // Copyright (C) 2012 Matt RAYKOWSKI (sfb) // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2013-2019 Jan BOON (Kaetemi) +// Copyright (C) 2013-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as @@ -181,14 +181,14 @@ NLMISC_COMMAND(where, "Ask information on the position", "") // Check parameters. if(args.empty()) { // Create the message and send. - const string msgName = "COMMAND:WHERE"; + const char *msgName = "COMMAND:WHERE"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { NetMngr.push(out); } else - nlwarning("command 'where': unknown message named '%s'", msgName.c_str()); + nlwarning("command 'where': unknown message named '%s'", msgName); return true; } return false; @@ -240,20 +240,18 @@ NLMISC_COMMAND(equipGroup, "equip group ", "name") } if(CItemGroupManager::getInstance()->equipGroup(args[0])) { - ucstring msg = CI18N::get("cmdEquipGroupSuccess"); - //Use ucstring because group name can contain accentued characters (and stuff like that) - ucstring nameUC; - nameUC.fromUtf8(args[0]); + string msg = CI18N::get("cmdEquipGroupSuccess"); + //Use utf-8 string because group name can contain accentued characters (and stuff like that) + string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); pIM->displaySystemInfo(msg); return true; } else { - ucstring msg = CI18N::get("cmdEquipGroupError"); - //Use ucstring because group name can contain accentued characters (and stuff like that) - ucstring nameUC; - nameUC.fromUtf8(args[0]); + string msg = CI18N::get("cmdEquipGroupError"); + //Use utf-8 string because group name can contain accentued characters (and stuff like that) + string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); pIM->displaySystemInfo(msg); return false; @@ -274,10 +272,9 @@ NLMISC_COMMAND(moveGroup, "move group to ", "name dst") if(CItemGroupManager::getInstance()->moveGroup(args[0], INVENTORIES::toInventory(args[1]))) { - ucstring msg = CI18N::get("cmdMoveGroupSuccess"); - //Use ucstring because group name can contain accentued characters (and stuff like that) - ucstring nameUC; - nameUC.fromUtf8(args[0]); + string msg = CI18N::get("cmdMoveGroupSuccess"); + //Use utf-8 string because group name can contain accentued characters (and stuff like that) + string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); strFindReplace(msg, "%inventory", args[1]); pIM->displaySystemInfo(msg); @@ -285,10 +282,9 @@ NLMISC_COMMAND(moveGroup, "move group to ", "name dst") } else { - ucstring msg = CI18N::get("cmdMoveGroupError"); - //Use ucstring because group name can contain accentued characters (and stuff like that) - ucstring nameUC; - nameUC.fromUtf8(args[0]); + string msg = CI18N::get("cmdMoveGroupError"); + //Use utf-8 string because group name can contain accentued characters (and stuff like that) + string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); strFindReplace(msg, "%inventory", args[1]); pIM->displaySystemInfo(msg); @@ -312,24 +308,22 @@ NLMISC_COMMAND(createGroup, "create group [true](create a for ev removeUnequiped = !args[1].empty(); if(CItemGroupManager::getInstance()->createGroup(args[0], removeUnequiped)) { - ucstring msg; + string msg; if(removeUnequiped) msg = CI18N::get("cmdCreateGroupSuccess2"); else msg = CI18N::get("cmdCreateGroupSuccess1"); - //Use ucstring because group name can contain accentued characters (and stuff like that) - ucstring nameUC; - nameUC.fromUtf8(args[0]); + //Use utf-8 string because group name can contain accentued characters (and stuff like that) + string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); pIM->displaySystemInfo(msg); return true; } else { - ucstring msg = CI18N::get("cmdCreateGroupError"); - //Use ucstring because group name can contain accentued characters (and stuff like that) - ucstring nameUC; - nameUC.fromUtf8(args[0]); + string msg = CI18N::get("cmdCreateGroupError"); + //Use utf-8 string because group name can contain accentued characters (and stuff like that) + string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); pIM->displaySystemInfo(msg); return false; @@ -350,20 +344,18 @@ NLMISC_COMMAND(deleteGroup, "delete group ", "name") } if(CItemGroupManager::getInstance()->deleteGroup(args[0])) { - ucstring msg = CI18N::get("cmdDeleteGroupSuccess"); - //Use ucstring because group name can contain accentued characters (and stuff like that) - ucstring nameUC; - nameUC.fromUtf8(args[0]); + string msg = CI18N::get("cmdDeleteGroupSuccess"); + //Use utf-8 string because group name can contain accentued characters (and stuff like that) + string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); pIM->displaySystemInfo(msg); return true; } else { - ucstring msg = CI18N::get("cmdDeleteGroupError"); - //Use ucstring because group name can contain accentued characters (and stuff like that) - ucstring nameUC; - nameUC.fromUtf8(args[0]); + string msg = CI18N::get("cmdDeleteGroupError"); + //Use utf-8 string because group name can contain accentued characters (and stuff like that) + string nameUC = args[0]; strFindReplace(msg, "%name", nameUC); pIM->displaySystemInfo(msg); return false; @@ -416,6 +408,18 @@ NLMISC_COMMAND(afk, "Set the player as 'away from keyboard'","[]") return true; } +NLMISC_COMMAND(selfkill, "Kill the player ","") +{ + CBitMemStream out; + if(!GenericMsgHeaderMngr.pushNameToStream("COMMAND:SELFKILL", out)) + { + nlwarning("Unknown message name COMMAND:SELFKILL"); + return false; + } + NetMngr.push(out); + return true; +} + bool randomCheckCharset(std::string const& str) { std::string::const_iterator it, itEnd = str.end(); @@ -494,7 +498,7 @@ NLMISC_COMMAND(random, "Roll a dice and say the result around","[] [h if (!randomFromString(args[0], max)) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("uiRandomBadParameter"); + string msg = CI18N::get("uiRandomBadParameter"); strFindReplace(msg, "%s", args[0] ); pIM->displaySystemInfo(msg); return false; @@ -504,7 +508,7 @@ NLMISC_COMMAND(random, "Roll a dice and say the result around","[] [h if (!randomFromString(args[1], min)) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("uiRandomBadParameter"); + string msg = CI18N::get("uiRandomBadParameter"); strFindReplace(msg, "%s", args[1] ); pIM->displaySystemInfo(msg); return false; @@ -544,7 +548,7 @@ NLMISC_COMMAND(dumpShapePos, "Dump Last Added Shape Pos.", "") CInterfaceManager *IM = CInterfaceManager::getInstance(); CVector pos = ShapeAddedByCommand.back().getPos(); - IM->displaySystemInfo(ucstring(toString("Shape Pos = %f, %f, %f", pos.x, pos.y, pos.z))); + IM->displaySystemInfo(toString("Shape Pos = %f, %f, %f", pos.x, pos.y, pos.z)); return true; } //----------------------------------------------- @@ -853,7 +857,7 @@ NLMISC_COMMAND(bugReport, "Call the bug report tool with dump", " string sys; - sys = "Language "+CI18N::getCurrentLanguageName().toString() +" "; + sys = "Language "+CI18N::getCurrentLanguageName() +" "; if (!args.empty()) { @@ -932,9 +936,7 @@ NLMISC_COMMAND(a, "Execute an admin command on you"," ") cmd = args[0]; for (uint i = 1; i < args.size(); i++) { - // temporary fix for utf-8 - // servers commands are not decoded so convert them to ansi - std::string tmp = ucstring::makeFromUtf8(args[i]).toString(); + std::string tmp = args[i]; if (!arg.empty()) arg += ' '; @@ -976,9 +978,7 @@ NLMISC_COMMAND(b, "Execute an admin command on your target"," ") cmd = args[0]; for (uint i = 1; i < args.size(); i++) { - // temporary fix for utf-8 - // servers commands are not decoded so convert them to ansi - std::string tmp = ucstring::makeFromUtf8(args[i]).toString(); + std::string tmp = args[i]; if (!arg.empty()) arg += ' '; @@ -1023,9 +1023,7 @@ NLMISC_COMMAND(c, "Execute an admin command on character name"," cmd = args[1]; for (uint i = 2; i < args.size(); i++) { - // temporary fix for utf-8 - // servers commands are not decoded so convert them to ansi - std::string tmp = ucstring::makeFromUtf8(args[i]).toString(); + std::string tmp = args[i]; if (!arg.empty()) arg += ' '; @@ -1096,15 +1094,15 @@ NLMISC_COMMAND(verbose, "Enable/Disable some Debug Information", "none or magic" { // Help CInterfaceManager *IM = CInterfaceManager::getInstance(); - IM->displaySystemInfo(ucstring("This command need 1 parameter :")); - IM->displaySystemInfo(ucstring(" :")); - IM->displaySystemInfo(ucstring("- none(to remove all verboses)")); - IM->displaySystemInfo(ucstring("- magic(to add debug infos about magic)")); - IM->displaySystemInfo(ucstring("- anim (to add debug infos about animation)")); + IM->displaySystemInfo("This command need 1 parameter :"); + IM->displaySystemInfo(" :"); + IM->displaySystemInfo("- none(to remove all verboses)"); + IM->displaySystemInfo("- magic(to add debug infos about magic)"); + IM->displaySystemInfo("- anim (to add debug infos about animation)"); } else { - std::string type = NLMISC::toLower(args[0]); + std::string type = NLMISC::toLowerAscii(args[0]); if (type == "none") Verbose = VerboseNone; else if(type == "magic") @@ -1114,11 +1112,11 @@ NLMISC_COMMAND(verbose, "Enable/Disable some Debug Information", "none or magic" else { CInterfaceManager *IM = CInterfaceManager::getInstance(); - IM->displaySystemInfo(ucstring("This command need 1 parameter :")); - IM->displaySystemInfo(ucstring(" :")); - IM->displaySystemInfo(ucstring("- none(to remove all verboses)")); - IM->displaySystemInfo(ucstring("- magic(to add debug infos about magic)")); - IM->displaySystemInfo(ucstring("- anim (to add debug infos about animation)")); + IM->displaySystemInfo("This command need 1 parameter :"); + IM->displaySystemInfo(" :"); + IM->displaySystemInfo("- none(to remove all verboses)"); + IM->displaySystemInfo("- magic(to add debug infos about magic)"); + IM->displaySystemInfo("- anim (to add debug infos about animation)"); } } return true; @@ -1306,9 +1304,9 @@ NLMISC_COMMAND(execScript, "Execute a script file (.cmd)","") inComment++; if(inComment<=0) { - ucstring ucline(line); + string ucline(line); CInterfaceManager::parseTokens(ucline); - ICommand::execute(ucline.toUtf8(), g_log); + ICommand::execute(ucline, g_log); } if(strncmp(line, "*/", 2)==0) inComment--; @@ -1323,7 +1321,7 @@ NLMISC_COMMAND(execScript, "Execute a script file (.cmd)","") } else { - CInterfaceManager::getInstance()->displaySystemInfo(ucstring("Cannot open file")); + CInterfaceManager::getInstance()->displaySystemInfo("Cannot open file"); } return true; @@ -1358,7 +1356,7 @@ NLMISC_COMMAND(db, "Modify Database"," ") else pIM->displaySystemInfo(toString("DB '%s' does not exist.", args[0].c_str())); #else - pIM->displaySystemInfo(ucstring("Can't write to DB when in Final Version.")); + pIM->displaySystemInfo("Can't write to DB when in Final Version."); #endif } else if (size == 1) @@ -1368,7 +1366,7 @@ NLMISC_COMMAND(db, "Modify Database"," ") { sint64 prop = node->getValue64(); string str = toString(prop); - pIM->displaySystemInfo(ucstring(str)); + pIM->displaySystemInfo(str); nlinfo("%s", str.c_str()); } else @@ -1385,14 +1383,14 @@ NLMISC_COMMAND(setItemName, "set name of items, sbrick, etc.."," 2) - desc.fromUtf8(args[2]); + desc = args[2]; if (args.size() > 3) - desc2.fromUtf8(args[3]); + desc2 = args[3]; STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); if (pSMC) @@ -1406,10 +1404,10 @@ NLMISC_COMMAND(setItemName, "set name of items, sbrick, etc.."," ") { if (args.size() < 2) return false; - ucstring name; - name.fromUtf8(args[0]); - ucstring text; - text.fromUtf8(args[1]); + string name; + name = args[0]; + string text; + text = args[1]; STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); if (pSMC) @@ -1438,7 +1436,7 @@ NLMISC_COMMAND(ah, "Launch an action handler", " ") if (args.empty()) return false; - if (!ClientCfg.AllowDebugLua && toLower(args[0]) == "lua") + if (!ClientCfg.AllowDebugLua && toLowerAscii(args[0]) == "lua") { return false; // not allowed!! } @@ -1459,7 +1457,7 @@ NLMISC_COMMAND(ah, "Launch an action handler", " ") static void setDynString(uint32 strID, const std::string &value) { STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); - pSMC->receiveString(strID, ucstring(value)); + pSMC->receiveString(strID, value); CBitMemStream bm; if (bm.isReading()) bm.invert(); bm.serial(strID); @@ -1686,10 +1684,10 @@ NLMISC_COMMAND(missionProgress, "debug"," ") NLMISC_COMMAND( displayDBModifs, "display server database modification in the chat window"," ") { if ( VerboseDatabase ) - CInterfaceManager::getInstance()->getChatOutput()->addTextChild(ucstring("the database is already in verbose mode"),CRGBA(255,255,255,255)); + CInterfaceManager::getInstance()->getChatOutput()->addTextChild("the database is already in verbose mode",CRGBA(255,255,255,255)); else { - CInterfaceManager::getInstance()->getChatOutput()->addTextChild(ucstring("database is now in verbose mode"),CRGBA(255,255,255,255)); + CInterfaceManager::getInstance()->getChatOutput()->addTextChild("database is now in verbose mode",CRGBA(255,255,255,255)); VerboseDatabase = true; } return true; @@ -1698,10 +1696,10 @@ NLMISC_COMMAND( displayDBModifs, "display server database modification in the ch NLMISC_COMMAND( hideDBModifs, "stop displaying server database modification in the chat window"," ") { if ( !VerboseDatabase ) - CInterfaceManager::getInstance()->getChatOutput()->addTextChild(ucstring("the database is already not in verbose mode"),CRGBA(255,255,255,255)); + CInterfaceManager::getInstance()->getChatOutput()->addTextChild("the database is already not in verbose mode",CRGBA(255,255,255,255)); else { - CInterfaceManager::getInstance()->getChatOutput()->addTextChild(ucstring("database is not in verbose mode anymore"),CRGBA(255,255,255,255)); + CInterfaceManager::getInstance()->getChatOutput()->addTextChild("database is not in verbose mode anymore",CRGBA(255,255,255,255)); VerboseDatabase = false; } return true; @@ -1722,7 +1720,7 @@ NLMISC_COMMAND(getSheetId, "get_sheet_id","") return false; CSheetId id(args[0]); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring(toString(id.asInt()))); + CInterfaceManager::getInstance()->displaySystemInfo(toString(id.asInt())); return true; } @@ -1737,7 +1735,7 @@ NLMISC_COMMAND(getSheetName, "get_sheet_name","") string name = id.toString(); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring(name)); + CInterfaceManager::getInstance()->displaySystemInfo(name); return true; } @@ -1817,14 +1815,14 @@ NLMISC_COMMAND(usePreprogCombat, "use the specified combat preprog sentence", "< NLMISC_COMMAND(engage, "engage target in combat", "") { // Create the message for the server to execute a phrase. - const string msgName = "COMBAT:ENGAGE"; + const char *msgName = "COMBAT:ENGAGE"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { NetMngr.push(out); } else - nlwarning("mainLoop : unknown message name : '%s'", msgName.c_str()); + nlwarning("mainLoop : unknown message name : '%s'", msgName); return true; } @@ -1850,14 +1848,14 @@ NLMISC_COMMAND(disengage, "disengage from combat", "") NLMISC_COMMAND(leaveTeam, "leave team", "") { // Create the message for the server to execute a phrase. - const string msgName = "TEAM:LEAVE"; + const char *msgName = "TEAM:LEAVE"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { NetMngr.push(out); } else - nlwarning("mainLoop : unknown message name : '%s'", msgName.c_str()); + nlwarning("mainLoop : unknown message name : '%s'", msgName); return true; } @@ -1865,14 +1863,14 @@ NLMISC_COMMAND(leaveTeam, "leave team", "") NLMISC_COMMAND(joinTeam, "join the specified team", "") { // Create the message for the server to execute a phrase. - const string msgName = "TEAM:JOIN"; + const char *msgName = "TEAM:JOIN"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { NetMngr.push(out); } else - nlwarning("mainLoop : unknown message name : '%s'", msgName.c_str()); + nlwarning("mainLoop : unknown message name : '%s'", msgName); return true; } @@ -1880,14 +1878,14 @@ NLMISC_COMMAND(joinTeam, "join the specified team", "") NLMISC_COMMAND(joinTeamProposal, "propose to current target to join the team", "") { // Create the message for the server to execute a phrase. - const string msgName = "TEAM:JOIN_PROPOSAL"; + const char *msgName = "TEAM:JOIN_PROPOSAL"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { NetMngr.push(out); } else - nlwarning("mainLoop : unknown message name : '%s'", msgName.c_str()); + nlwarning("mainLoop : unknown message name : '%s'", msgName); return true; } @@ -1895,14 +1893,14 @@ NLMISC_COMMAND(joinTeamProposal, "propose to current target to join the team", " NLMISC_COMMAND(joinTeamDecline, "decline a join team proposal", "") { // Create the message for the server to execute a phrase. - const string msgName = "TEAM:JOIN_PROPOSAL_DECLINE"; + const char *msgName = "TEAM:JOIN_PROPOSAL_DECLINE"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { NetMngr.push(out); } else - nlwarning("mainLoop : unknown message name : '%s'", msgName.c_str()); + nlwarning("mainLoop : unknown message name : '%s'", msgName); return true; } @@ -1910,14 +1908,14 @@ NLMISC_COMMAND(joinTeamDecline, "decline a join team proposal", "") NLMISC_COMMAND(kickTeammate, "kick someone from your team", "") { // Create the message for the server to execute a phrase. - const string msgName = "TEAM:KICK"; + const char *msgName = "TEAM:KICK"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { NetMngr.push(out); } else - nlwarning("mainLoop : unknown message name : '%s'", msgName.c_str()); + nlwarning("mainLoop : unknown message name : '%s'", msgName); return true; } @@ -1927,14 +1925,14 @@ NLMISC_COMMAND(cancelCurrentSentence, "cancel the sentence being executed", "") // no parameter needed // Create the message for the server to cancel the phrase being executed - const string msgName = "SENTENCE:CANCEL_CURRENT"; + const char *msgName = "SENTENCE:CANCEL_CURRENT"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { NetMngr.push(out); } else - nlwarning("command : unknown message name : '%s'", msgName.c_str()); + nlwarning("command : unknown message name : '%s'", msgName); return true; } @@ -1966,7 +1964,7 @@ NLMISC_COMMAND(drop,"drop an item to the ground","") sint32 z = (sint32)UserEntity->pos().z * 1000; CBitMemStream bms; - string msgType = "ITEM:DROP"; + const char *msgType = "ITEM:DROP"; if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) ) { bms.serial( itemId ); @@ -1995,7 +1993,7 @@ NLMISC_COMMAND(pos, "Change the position of the user (in local only)", "") // Warning when already recording. if(NetMngr.isRecording()) { - IM->displaySystemInfo(ucstring("Already Recording. Stop the current Record first")); + IM->displaySystemInfo("Already Recording. Stop the current Record first"); return true; } @@ -2388,7 +2386,7 @@ NLMISC_COMMAND(sheet2idx, "Return the index of a sheet", " displaySystemInfo(ucstring(result)); + IM->displaySystemInfo(result); nlinfo("'sheet2idx': %s", result.c_str()); return true; } @@ -2411,7 +2409,7 @@ NLMISC_COMMAND(dynstr, "display a dyn string value", "") uint dynId; fromString(args[0], dynId); - ucstring result; + string result; STRING_MANAGER::CStringManagerClient::instance()->getDynString(dynId, result); CInterfaceManager::getInstance()->displaySystemInfo(result); @@ -2426,7 +2424,7 @@ NLMISC_COMMAND(serverstr, "display a server string value", "getString(dynId, result); CInterfaceManager::getInstance()->displaySystemInfo(result); @@ -2510,11 +2508,11 @@ NLMISC_COMMAND(mode, "Change the mode for an entity in a slot", " [ if(args.size() < 2) { // Help - CInterfaceManager::getInstance()->displaySystemInfo(ucstring("This command need 2 paramters :")); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring(" : the slot number of the entity to change")); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring(" : the mode wanted for the entity, one of the following number :")); + CInterfaceManager::getInstance()->displaySystemInfo("This command need 2 paramters :"); + CInterfaceManager::getInstance()->displaySystemInfo(" : the slot number of the entity to change"); + CInterfaceManager::getInstance()->displaySystemInfo(" : the mode wanted for the entity, one of the following number :"); for(uint i = 0; idisplaySystemInfo(ucstring(NLMISC::toString(" %d - %s", i, MBEHAV::modeToString((MBEHAV::EMode)i).c_str()))); + CInterfaceManager::getInstance()->displaySystemInfo(NLMISC::toString(" %d - %s", i, MBEHAV::modeToString((MBEHAV::EMode)i).c_str())); } // Right parameters number else @@ -2544,7 +2542,7 @@ NLMISC_COMMAND(mode, "Change the mode for an entity in a slot", " [ } // Invalid slot. else - CInterfaceManager::getInstance()->displaySystemInfo(ucstring("There is no entity in the given slot")); + CInterfaceManager::getInstance()->displaySystemInfo("There is no entity in the given slot"); } // Command well done. @@ -2557,12 +2555,12 @@ NLMISC_COMMAND(behaviour, "Change the behaviour for an entity in a slot", " 6) { // Help - CInterfaceManager::getInstance()->displaySystemInfo(ucstring("This command need 2 to 6 paramters :")); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring(" : the slot number of the entity to change")); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring(" : the behaviour to play for the entity, one of the following number :")); + CInterfaceManager::getInstance()->displaySystemInfo("This command need 2 to 6 paramters :"); + CInterfaceManager::getInstance()->displaySystemInfo(" : the slot number of the entity to change"); + CInterfaceManager::getInstance()->displaySystemInfo(" : the behaviour to play for the entity, one of the following number :"); for(uint i = 0; idisplaySystemInfo(ucstring(NLMISC::toString(" %d - %s", i, MBEHAV::behaviourToString((MBEHAV::EBehaviour)i).c_str()))); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring(NLMISC::toString(" %d-%d - Emotes", MBEHAV::EMOTE_BEGIN, MBEHAV::EMOTE_END))); + CInterfaceManager::getInstance()->displaySystemInfo(NLMISC::toString(" %d - %s", i, MBEHAV::behaviourToString((MBEHAV::EBehaviour)i).c_str())); + CInterfaceManager::getInstance()->displaySystemInfo(NLMISC::toString(" %d-%d - Emotes", MBEHAV::EMOTE_BEGIN, MBEHAV::EMOTE_END)); } else { @@ -2633,7 +2631,7 @@ NLMISC_COMMAND(behaviour, "Change the behaviour for an entity in a slot", "updateVisualProperty(NetMngr.getCurrentServerTick()+dt, CLFECOMMON::PROPERTY_BEHAVIOUR); } else - CInterfaceManager::getInstance()->displaySystemInfo(ucstring("There is no entity in the given slot")); + CInterfaceManager::getInstance()->displaySystemInfo("There is no entity in the given slot"); } // Command well done. @@ -2655,12 +2653,12 @@ NLMISC_COMMAND(magic, "Cast a spell", "\n" if(args.size() != 6) { // Help -// CInterfaceManager::getInstance()->displaySystemInfo(ucstring("This command need 2 or 3 paramters :")); -// CInterfaceManager::getInstance()->displaySystemInfo(ucstring(" : the slot number of the entity to change")); -// CInterfaceManager::getInstance()->displaySystemInfo(ucstring(" : the behaviour to play for the entity, one of the following number :")); +// CInterfaceManager::getInstance()->displaySystemInfo("This command need 2 or 3 paramters :"); +// CInterfaceManager::getInstance()->displaySystemInfo(" : the slot number of the entity to change"); +// CInterfaceManager::getInstance()->displaySystemInfo(" : the behaviour to play for the entity, one of the following number :"); // for(uint i = 0; idisplaySystemInfo(ucstring(NLMISC::toString(" %d - %s", i, MBEHAV::behaviourToString((MBEHAV::EBehaviour)i)))); -// CInterfaceManager::getInstance()->displaySystemInfo(ucstring(NLMISC::toString(" %d-%d - Emotes", MBEHAV::EMOTE_BEGIN, MBEHAV::EMOTE_END))); +// CInterfaceManager::getInstance()->displaySystemInfo(NLMISC::toString(" %d - %s", i, MBEHAV::behaviourToString((MBEHAV::EBehaviour)i))); +// CInterfaceManager::getInstance()->displaySystemInfo(NLMISC::toString(" %d-%d - Emotes", MBEHAV::EMOTE_BEGIN, MBEHAV::EMOTE_END)); } else { @@ -2709,7 +2707,7 @@ NLMISC_COMMAND(magic, "Cast a spell", "\n" entity->updateVisualProperty(NetMngr.getCurrentServerTick()+50, CLFECOMMON::PROPERTY_BEHAVIOUR); } else - CInterfaceManager::getInstance()->displaySystemInfo(ucstring("There is no entity in the given slot")); + CInterfaceManager::getInstance()->displaySystemInfo("There is no entity in the given slot"); } // Command well done. @@ -2728,12 +2726,12 @@ NLMISC_COMMAND(spell, "Cast a spell", "\n" if(args.size() != 6) { // Help - // CInterfaceManager::getInstance()->displaySystemInfo(ucstring("This command need 2 or 3 paramters :")); - // CInterfaceManager::getInstance()->displaySystemInfo(ucstring(" : the slot number of the entity to change")); - // CInterfaceManager::getInstance()->displaySystemInfo(ucstring(" : the behaviour to play for the entity, one of the following number :")); + // CInterfaceManager::getInstance()->displaySystemInfo("This command need 2 or 3 paramters :"); + // CInterfaceManager::getInstance()->displaySystemInfo(" : the slot number of the entity to change"); + // CInterfaceManager::getInstance()->displaySystemInfo(" : the behaviour to play for the entity, one of the following number :"); // for(uint i = 0; idisplaySystemInfo(ucstring(NLMISC::toString(" %d - %s", i, MBEHAV::behaviourToString((MBEHAV::EBehaviour)i)))); - // CInterfaceManager::getInstance()->displaySystemInfo(ucstring(NLMISC::toString(" %d-%d - Emotes", MBEHAV::EMOTE_BEGIN, MBEHAV::EMOTE_END))); + // CInterfaceManager::getInstance()->displaySystemInfo(NLMISC::toString(" %d - %s", i, MBEHAV::behaviourToString((MBEHAV::EBehaviour)i))); + // CInterfaceManager::getInstance()->displaySystemInfo(NLMISC::toString(" %d-%d - Emotes", MBEHAV::EMOTE_BEGIN, MBEHAV::EMOTE_END)); } else { @@ -2782,7 +2780,7 @@ NLMISC_COMMAND(spell, "Cast a spell", "\n" entity->updateVisualProperty(NetMngr.getCurrentServerTick()+50, CLFECOMMON::PROPERTY_BEHAVIOUR); } else - CInterfaceManager::getInstance()->displaySystemInfo(ucstring("There is no entity in the given slot")); + CInterfaceManager::getInstance()->displaySystemInfo("There is no entity in the given slot"); } // Command well done. @@ -3783,7 +3781,7 @@ NLMISC_COMMAND( createPerso, "create a new character", "Parameters:\n-Character fromString(args[4], level); CBitMemStream bms; - string msgType = "CHEAT:CREATE_CHARACTER"; + const char *msgType = "CHEAT:CREATE_CHARACTER"; if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) ) { bms.serial( characterName ); @@ -3814,7 +3812,7 @@ NLMISC_COMMAND( add_role, "add role to character", " fromString(args[0], entityId); CInterfaceManager *pIM = CInterfaceManager::getInstance(); - ucstring text("test\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\n"); + string text("test\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\n"); uint duration = CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionTimeoutBubbles).getValSInt32(); CEntityCL *entity = EntitiesMngr.entity(entityId); @@ -4005,7 +4003,7 @@ NLMISC_COMMAND(displayInventoryCounter, "display the Inventory counter to compar srvVal&= pIM->getLocalSyncActionCounterMask(); locVal&= pIM->getLocalSyncActionCounterMask(); - pIM->displaySystemInfo(ucstring( "ServerCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal)) ); + pIM->displaySystemInfo("ServerCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal)); // Well done. return true; @@ -4023,7 +4021,7 @@ NLMISC_COMMAND(displayActionCounter, "display the action counters", "") srvVal&= PHRASE_EXECUTE_COUNTER_MASK; locVal&= PHRASE_EXECUTE_COUNTER_MASK; - pIM->displaySystemInfo(ucstring( "NextCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal)) ); + pIM->displaySystemInfo("NextCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal)); // cycle srvVal= NLGUI::CDBManager::getInstance()->getDbProp(PHRASE_DB_COUNTER_CYCLE)->getValue32(); @@ -4031,7 +4029,7 @@ NLMISC_COMMAND(displayActionCounter, "display the action counters", "") srvVal&= PHRASE_EXECUTE_COUNTER_MASK; locVal&= PHRASE_EXECUTE_COUNTER_MASK; - pIM->displaySystemInfo(ucstring( "CycleCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal)) ); + pIM->displaySystemInfo("CycleCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal)); return true; } @@ -4114,7 +4112,7 @@ NLMISC_COMMAND(skillToInt, "Convert a skill to an int", "") { if (args.size() != 1) return false; CInterfaceManager *im = CInterfaceManager::getInstance(); - im->displaySystemInfo(ucstring(toString((uint) SKILLS::toSkill(args[0])))); + im->displaySystemInfo(toString((uint) SKILLS::toSkill(args[0]))); return true; } @@ -4144,11 +4142,11 @@ NLMISC_COMMAND(browseRingAdmin, "Browse a HTML document with the ring web browse NLMISC_COMMAND(GUCreate, "create a guild", "") { if (args.size() != 1) return false; - const string msgName = "GUILD:CREATE"; + const char *msgName = "GUILD:CREATE"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { - string buf = args[0]; + ucstring buf = ucstring::makeFromUtf8(args[0]); // FIXME: UTF-8 (serial) out.serial( buf ); NetMngr.push(out); } @@ -4158,7 +4156,7 @@ NLMISC_COMMAND(GUCreate, "create a guild", "") NLMISC_COMMAND(GUQuit, "quit a guild", "") { if (args.size() != 0) return false; - const string msgName = "GUILD:QUIT"; + const char *msgName = "GUILD:QUIT"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { @@ -4170,7 +4168,7 @@ NLMISC_COMMAND(GUQuit, "quit a guild", "") NLMISC_COMMAND(GULeaveLeadership, "abandon leadership of a guild", "") { if (args.size() != 0) return false; - const string msgName = "GUILD:ABANDON_LEADERSHIP"; + const char *msgName = "GUILD:ABANDON_LEADERSHIP"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { @@ -4181,7 +4179,7 @@ NLMISC_COMMAND(GULeaveLeadership, "abandon leadership of a guild", "") NLMISC_COMMAND(GULeaveOfficerTitle, "abandon officer title", "") { if (args.size() != 0) return false; - const string msgName = "GUILD:ABANDON_OFFICER_TITLE"; + const char *msgName = "GUILD:ABANDON_OFFICER_TITLE"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { @@ -4193,7 +4191,7 @@ NLMISC_COMMAND(GULeaveOfficerTitle, "abandon officer title", "") NLMISC_COMMAND(GUNameOfficer, "name an officer", "") { if (args.size() != 1) return false; - const string msgName = "GUILD:NAME_OFFICER"; + const char *msgName = "GUILD:NAME_OFFICER"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { @@ -4207,7 +4205,7 @@ NLMISC_COMMAND(GUNameOfficer, "name an officer", "") NLMISC_COMMAND(GUDismissOfficer, "dismiss an officer", "") { if (args.size() != 1) return false; - const string msgName = "GUILD:DISMISS_OFFICER"; + const char *msgName = "GUILD:DISMISS_OFFICER"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { @@ -4221,7 +4219,7 @@ NLMISC_COMMAND(GUDismissOfficer, "dismiss an officer", "") NLMISC_COMMAND(GUKick, "kick a member", "") { if (args.size() != 1) return false; - const string msgName = "GUILD:KICK_MEMBER"; + const char *msgName = "GUILD:KICK_MEMBER"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { @@ -4248,7 +4246,7 @@ NLMISC_COMMAND(GURefuse, "refuse an invitation", "") NLMISC_COMMAND(GUFriend, "invite a player to become a friend of the guild", "") { if (args.size() != 1) return false; - const string msgName = "GUILD:FRIEND_INVITATION"; + const char *msgName = "GUILD:FRIEND_INVITATION"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { @@ -4262,7 +4260,7 @@ NLMISC_COMMAND(GUFriend, "invite a player to become a friend of the guild", "") { if (args.size() != 1) return false; - const string msgName = "GUILD:SET_SUCCESSOR"; + const char *msgName = "GUILD:SET_SUCCESSOR"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { @@ -4300,7 +4298,7 @@ NLMISC_COMMAND(GUSetSuccessor, "set the successor of the guild leader", "") { if (args.size() != 1) return false; - const string msgName = "GUILD:GET_INFOS"; + const char *msgName = "GUILD:GET_INFOS"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { @@ -4314,7 +4312,7 @@ NLMISC_COMMAND(GUInfos, "get information on a guild", "") NLMISC_COMMAND(GUJournal, "get the guild journal", "") { if (args.size() != 0) return false; - const string msgName = "GUILD:GET_LOG"; + const char *msgName = "GUILD:GET_LOG"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { @@ -4328,7 +4326,7 @@ NLMISC_COMMAND(buildingTeleport, "teleport to a building", "building index") if (args.size() != 1) return false; uint16 index; fromString(args[0], index); - const string msgName = "GUILD:TELEPORT"; + const char *msgName = "GUILD:TELEPORT"; CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) { @@ -4520,7 +4518,7 @@ NLMISC_COMMAND(getSkillValue, "get a skill value by its name", "skill_name") CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:CHARACTER_INFO:SKILLS:%d:SKILL", skillId), false); if(node) { - pIM->displaySystemInfo(ucstring(toString(node->getValue32()))); + pIM->displaySystemInfo(toString(node->getValue32())); } return true; @@ -4550,7 +4548,7 @@ NLMISC_COMMAND(getBaseSkillValue, "get a baseskill value by its name", "skill_na CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:CHARACTER_INFO:SKILLS:%d:BaseSKILL", skillId), false); if(node) { - pIM->displaySystemInfo(ucstring(toString(node->getValue32()))); + pIM->displaySystemInfo(toString(node->getValue32())); } return true; @@ -4812,7 +4810,7 @@ NLMISC_COMMAND(stick_log, "", "") skel->getStickedObjects(sticks); nlinfo("StickedModels: %d", sticks.size()); - pIM->displaySystemInfo(ucstring(toString("StickedModels: %d", sticks.size()))); + pIM->displaySystemInfo(toString("StickedModels: %d", sticks.size())); for(uint i=0;i= args.size()) { // Not enough arguments - pIM->displaySystemInfo (ucstring(CommandName+" : ")+CI18N::get ("uiCommandWrongArgumentCount")); + pIM->displaySystemInfo (CommandName+" : "+CI18N::get ("uiCommandWrongArgumentCount")); return false; } else { if (keywords[i] == "$") - finalArgs += /*ucstring(*/args[index++]/*).toUtf8()*/; + finalArgs += args[index++]; else { while (indexdisplaySystemInfo (ucstring(CommandName+" : ")+CI18N::get ("uiCommandWrongArgumentCount")); + pIM->displaySystemInfo (CommandName+" : "+CI18N::get ("uiCommandWrongArgumentCount")); return false; } return true; @@ -5461,13 +5459,13 @@ void CUserCommand::createCommand (const char *name, const char *action, const ch } // Find action name - ucstring help; + string help; const CBaseAction *ab = Actions.getBaseAction (::CAction::CName (action, ptrParams)); if (ab) help = CI18N::get(ab->LocalizedName); // Build a argument help - ucstring argsHelp; + string argsHelp; if (ab) { @@ -5491,7 +5489,7 @@ void CUserCommand::createCommand (const char *name, const char *action, const ch // Add the string if (!argsHelp.empty()) argsHelp += " "; - argsHelp += ucstring("<") + CI18N::get(ab->Parameters[j].LocalizedName) + ucstring(">"); + argsHelp += "<" + CI18N::get(ab->Parameters[j].LocalizedName) + ">"; bFound = true; } } @@ -5658,7 +5656,7 @@ NLMISC_COMMAND(tickToDate, "convert a tick value into a readable ryzom time", "" CInterfaceManager *im = CInterfaceManager::getInstance(); float ryTime = rt.getRyzomTime(); std::string readableDate = toString("Day = %d, hour = %d:%d", rt.getRyzomDay(), (int) floorf(ryTime), (int) floorf(60.f * fmodf(ryTime, 1.f))); - im->displaySystemInfo(ucstring(readableDate)); + im->displaySystemInfo(readableDate); return true; } @@ -5680,7 +5678,7 @@ NLMISC_COMMAND(dumpShapeMaxDist, "dump max dist for shapes", "") cs->getWholeEquipmentList(equipList); for (uint k = 0; k < equipList.size(); ++k) { - std::string item = toLower(equipList[k]->getItem()); + std::string item = toLowerAscii(equipList[k]->getItem()); if (!item.empty()) { @@ -5930,7 +5928,7 @@ NLMISC_COMMAND(time, "Shows information about the current time", "") tm = gmtime(&date); strftime(cs_utc, size, "%X", tm); - ucstring msg = CI18N::get("uiCurrentLocalAndUtcTime"); + string msg = CI18N::get("uiCurrentLocalAndUtcTime"); strFindReplace(msg, "%local", cs_local); strFindReplace(msg, "%utc", cs_utc); CInterfaceManager::getInstance()->displaySystemInfo(msg, "AROUND"); @@ -5939,7 +5937,7 @@ NLMISC_COMMAND(time, "Shows information about the current time", "") NLMISC_COMMAND(playedTime, "Display character played time", "") { - ucstring msg = CI18N::get("uiPlayedTime"); + string msg = CI18N::get("uiPlayedTime"); strFindReplace(msg, "%time", NLMISC::secondsToHumanReadable(CharPlayedTime)); CInterfaceManager::getInstance()->displaySystemInfo(msg, "AROUND"); return true; @@ -5947,7 +5945,7 @@ NLMISC_COMMAND(playedTime, "Display character played time", "") NLMISC_COMMAND(version, "Display client version", "") { - ucstring msg = getDebugVersion(); + string msg = getDebugVersion(); CInterfaceManager::getInstance()->displaySystemInfo(msg, "AROUND"); return true; }