Hello, Im using The forgotten server 1.2
Current in my server spells exani hur "up and exiva needs use " " to work
how can i modific these spells to work without " " too?
Current Example:
exani hur "up ( work normally)
exani hur "down ( work normally)
exiva "name" (work normally)
exani hur up (no work)
exani hur down (no work)
exiva name (no work)
Expected Example:
exani hur "up (work)
exani hur "down (work)
exiva "name" (work)
exani hur up (work)
exani hur down (work)
exiva name (work)
I found this function inside spells.cpp
how could it be modified to work?
Current in my server spells exani hur "up and exiva needs use " " to work
how can i modific these spells to work without " " too?
Current Example:
exani hur "up ( work normally)
exani hur "down ( work normally)
exiva "name" (work normally)
exani hur up (no work)
exani hur down (no work)
exiva name (no work)
Expected Example:
exani hur "up (work)
exani hur "down (work)
exiva "name" (work)
exani hur up (work)
exani hur down (work)
exiva name (work)
I found this function inside spells.cpp
C++:
TalkActionResult_t Spells::playerSaySpell(Player* player, std::string& words)
{
std::string str_words = words;
//strip trailing spaces
trimString(str_words);
std::ostringstream str_instantSpell;
for (size_t i = 0; i < str_words.length(); i++) {
if (!isspace(str_words[i]) || (i < str_words.length() - 1 && !isspace(str_words[i + 1]))) {
str_instantSpell << str_words[i];
}
}
str_words = str_instantSpell.str();
InstantSpell* instantSpell = getInstantSpell(str_words);
if (!instantSpell) {
return TALKACTION_CONTINUE;
}
std::string param;
if (instantSpell->getHasParam()) {
size_t spellLen = instantSpell->getWords().length();
size_t paramLen = str_words.length() - spellLen;
std::string paramText = str_words.substr(spellLen, paramLen);
if (!paramText.empty() && paramText.front() == ' ') {
size_t loc1 = paramText.find('"', 1);
if (loc1 != std::string::npos) {
size_t loc2 = paramText.find('"', loc1 + 1);
if (loc2 == std::string::npos) {
loc2 = paramText.length();
} else if (paramText.find_last_not_of(' ') != loc2) {
return TALKACTION_CONTINUE;
}
param = paramText.substr(loc1 + 1, loc2 - loc1 - 1);
} else {
trimString(paramText);
loc1 = paramText.find(' ', 0);
if (loc1 == std::string::npos) {
param = paramText;
} else {
return TALKACTION_CONTINUE;
}
}
}
}
if (instantSpell->playerCastInstant(player, param)) {
return TALKACTION_BREAK;
}
return TALKACTION_FAILED;
}
how could it be modified to work?