Fala clã, tudo bom? Então, vi esse tal emote spells em um servidor e decidi fazer, e também, compartilhá-lo com vocês ?
O que é?
É um código simpleszinho que possibilita players escolherem a cor da mensagem das spells por meio de comando, LARANJA ou AMARELO, como nas imagens abaixo:
Vamos aos códigos..
abra game.cpp, na função playerSaySpell, procure por:
if (result == TALKACTION_BREAK) {
if (!g_config.getBoolean(ConfigManager::EMOTE_SPELLS)) {
return internalCreatureSay(player, TALKTYPE_SAY, words, false);
} else {
return internalCreatureSay(player, TALKTYPE_MONSTER_SAY, words, false);
}
} else if (result == TALKACTION_FAILED) {
return true;
}
e substitua por:
if (result == TALKACTION_BREAK) {
int32_t value;
player->getStorageValue(203500, value);
return internalCreatureSay(player, value == 1 ? TALKTYPE_MONSTER_SAY : TALKTYPE_SAY, words, false);
}
else if (result == TALKACTION_FAILED) {
return true;
}
Beleza, agora precisamos de uma talkaction para fazer a alteração de storage, vamos lá..
data/talkactions/scripts/emotespells.lua:
function onSay(player)
local switch = player:getStorageValue(203500) == -1 and 1 or -1
player:sendTextMessage(MESSAGE_INFO_DESCR, 'emote spells: (' .. (switch == 1 and 'monster_say' or 'say') .. ')')
player:setStorageValue(203500, switch)
end
data/talkactions/talkactions.xml:
<talkaction words="!emotespells" script="emotespells.lua"/>
Agora só compilar as sources e pronto?
Versão do TFS: 1.3
Créditos: Lyu (isme)