Changed: Move dyn channel commands (/0, /1 ..) to commands.xml

--HG--
branch : develop
This commit is contained in:
Nimetu 2017-01-11 15:12:06 +02:00
parent 3e95a8b89f
commit 109725fc9e
3 changed files with 49 additions and 74 deletions

View file

@ -50,6 +50,24 @@
<command name="re" action="talk" params="mode=11|text=+" ctrlchar="false" />
<command name="r" action="talk" params="mode=11|text=+" ctrlchar="false" />
<command name="0" action="enter_talk" params="mode=12|channel=0" />
<command name="1" action="enter_talk" params="mode=12|channel=1" />
<command name="2" action="enter_talk" params="mode=12|channel=2" />
<command name="3" action="enter_talk" params="mode=12|channel=3" />
<command name="4" action="enter_talk" params="mode=12|channel=4" />
<command name="5" action="enter_talk" params="mode=12|channel=5" />
<command name="6" action="enter_talk" params="mode=12|channel=6" />
<command name="7" action="enter_talk" params="mode=12|channel=7" />
<command name="0" action="talk" params="mode=12|channel=0|text=+" ctrlchar="false" />
<command name="1" action="talk" params="mode=12|channel=1|text=+" ctrlchar="false" />
<command name="2" action="talk" params="mode=12|channel=2|text=+" ctrlchar="false" />
<command name="3" action="talk" params="mode=12|channel=3|text=+" ctrlchar="false" />
<command name="4" action="talk" params="mode=12|channel=4|text=+" ctrlchar="false" />
<command name="5" action="talk" params="mode=12|channel=5|text=+" ctrlchar="false" />
<command name="6" action="talk" params="mode=12|channel=6|text=+" ctrlchar="false" />
<command name="7" action="talk" params="mode=12|channel=7|text=+" ctrlchar="false" />
<command name="guild" action="enter_talk" params="mode=3" />
<command name="gu" action="enter_talk" params="mode=3" />
<command name="g" action="enter_talk" params="mode=3" />

View file

@ -1374,12 +1374,28 @@ class CHandlerTalk : public IActionHandler
}
}
else
{
if (mode == CChatGroup::dyn_chat)
{
uint channel;
fromString(getParam (sParams, "channel"), channel);
if (channel < CChatGroup::MaxDynChanPerPlayer)
{
PeopleInterraction.talkInDynamicChannel(channel, text);
}
else
{
nlwarning("/ah talk: invalid dyn_chat channel %d\n", channel);
}
}
else
{
ChatMngr.setChatMode((CChatGroup::TGroupType)mode);
ChatMngr.chat(text, mode == CChatGroup::team);
}
}
}
}
};
REGISTER_ACTION_HANDLER( CHandlerTalk, "talk");
@ -1391,9 +1407,21 @@ class CHandlerEnterTalk : public IActionHandler
{
// Param
uint mode;
uint channel = 0;
fromString(getParam (sParams, "mode"), mode);
ChatMngr.updateChatModeAndButton(mode);
if (mode == CChatGroup::dyn_chat)
{
fromString(getParam(sParams, "channel"), channel);
if (channel >= CChatGroup::MaxDynChanPerPlayer)
{
channel = 0;
}
}
ChatMngr.updateChatModeAndButton(mode, channel);
}
};
REGISTER_ACTION_HANDLER( CHandlerEnterTalk, "enter_talk");

View file

@ -1198,77 +1198,6 @@ NLMISC_COMMAND(db, "Modify Database","<Property> <Value>")
return true;
}
static bool talkInChan(uint32 nb,std::vector<std::string>args)
{
uint32 maxChans = CChatGroup::MaxDynChanPerPlayer;
if (nb>=maxChans)
{
return false;
}
if(!args.empty())
{
std::string tmp;
std::vector<std::string>::const_iterator first(args.begin()),last(args.end());
for(;first!=last;++first)
{
tmp = tmp + (*first);
tmp = tmp+" ";
}
ucstring uctmp;
uctmp.fromUtf8(tmp);
PeopleInterraction.talkInDynamicChannel(nb, uctmp);
return true;
}
else
{
ChatMngr.updateChatModeAndButton(CChatGroup::dyn_chat, nb);
}
return false;
}
NLMISC_COMMAND(0,"talk in 0th dynamic chat channel","<channel_nb> <sentence>")
{
return talkInChan(0,args);
}
NLMISC_COMMAND(1,"talk in first dynamic chat channel","<channel_nb> <sentence>")
{
return talkInChan(1,args);
}
NLMISC_COMMAND(2,"talk in 2nd dynamic chat channel","<channel_nb> <sentence>")
{
return talkInChan(2,args);
}
NLMISC_COMMAND(3,"talk in 3rd dynamic chat channel","<channel_nb> <sentence>")
{
return talkInChan(3,args);
}
NLMISC_COMMAND(4,"talk in 4th dynamic chat channel","<channel_nb> <sentence>")
{
return talkInChan(4,args);
}
NLMISC_COMMAND(5,"talk in 5th dynamic chat channel","<channel_nb> <sentence>")
{
return talkInChan(5,args);
}
NLMISC_COMMAND(6,"talk in 6th dynamic chat channel","<channel_nb> <sentence>")
{
return talkInChan(6,args);
}
NLMISC_COMMAND(7,"talk in 7th dynamic chat channel","<channel_nb> <sentence>")
{
return talkInChan(7,args);
}
NLMISC_COMMAND(setItemName, "set name of items, sbrick, etc..","<sheet_id> <name> <desc> <desc2>")
{
if (args.size() < 2) return false;