Terotrificy
Veteran OT User
Hi, i'm trying to modify the sources in an attempt to make it work like it works in tibia rl:
If i try to add extra spaces between a word and another when casting a spell, it won't work.
Example:
I guess i should modify this part, but i'm not certain about what to do at all:
Anyone?
If i try to add extra spaces between a word and another when casting a spell, it won't work.
Example:
I guess i should modify this part, but i'm not certain about what to do at all:
C++:
TalkActionResult_t Spells::playerSaySpell(Player* player, SpeakClasses type, std::string& words)
{
std::string str_words = words;
//strip trailing spaces
trim_left(str_words, " ");
trim_right(str_words, " ");
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[0] == ' '){
size_t quote = paramText.find('"', 1);
if(quote != std::string::npos) {
size_t tmp = paramText.find('"', quote + 1);
if(tmp == std::string::npos)
tmp = paramText.length();
param = paramText.substr(quote + 1, tmp - quote - 1);
}
else if(paramText.find(' ', 1) == std::string::npos) {
param = paramText.substr(1, paramText.length());
}
trim_left(param, " ");
trim_right(param, " ");
}
}
if (instantSpell->playerCastInstant(player, param)){
return TALKACTION_BREAK;
}
else{
return TALKACTION_FAILED;
}
}
Anyone?