mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
Moved some talk code to lua
This commit is contained in:
@@ -170,15 +170,6 @@ void Game::processTextMessage(Otc::MessageMode mode, const std::string& text)
|
||||
|
||||
void Game::processTalk(const std::string& name, int level, Otc::MessageMode mode, const std::string& text, int channelId, const Position& pos)
|
||||
{
|
||||
if(pos.isValid() && (mode == Otc::MessageSay || mode == Otc::MessageWhisper || mode == Otc::MessageYell || mode == Otc::MessageSpell ||
|
||||
mode == Otc::MessageMonsterSay || mode == Otc::MessageMonsterYell || mode == Otc::MessageNpcFrom ||
|
||||
mode == Otc::MessageBarkLow || mode == Otc::MessageBarkLoud))
|
||||
{
|
||||
StaticTextPtr staticText = StaticTextPtr(new StaticText);
|
||||
staticText->addMessage(name, mode, text);
|
||||
g_map.addThing(staticText, pos);
|
||||
}
|
||||
|
||||
g_lua.callGlobalField("g_game", "onTalk", name, level, mode, text, channelId, pos);
|
||||
}
|
||||
|
||||
|
@@ -351,7 +351,11 @@ void OTClient::registerLuaFunctions()
|
||||
|
||||
g_lua.registerClass<Effect, Thing>();
|
||||
g_lua.registerClass<Missile, Thing>();
|
||||
|
||||
g_lua.registerClass<StaticText, Thing>();
|
||||
g_lua.bindClassStaticFunction<StaticText>("create", []{ return StaticTextPtr(new StaticText); });
|
||||
g_lua.bindClassMemberFunction<StaticText>("addMessage", &StaticText::addMessage);
|
||||
|
||||
g_lua.registerClass<AnimatedText, Thing>();
|
||||
|
||||
g_lua.registerClass<Player, Creature>();
|
||||
|
Reference in New Issue
Block a user