Thread: Fun with /ooc
View Single Post
  #2  
Old 09-21-2017, 07:59 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,589
Default

Check lines 785-1156 in zone/client.cpp.

Line 785 should look like this:
Code:
void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_skill, const char* orig_message, const char* targetname) {
Check line 873 for this:
Code:
switch(chan_num)
Lines 1054-1126 contain the lines where /say is parsed to Perl.
Code:
case 8: { /* Say */
    if(message[0] == COMMAND_CHAR) {
        if(command_dispatch(this, message) == -2) {
            if(parse->PlayerHasQuestSub(EVENT_COMMAND)) {
                int i = parse->EventPlayer(EVENT_COMMAND, this, message, 0);
                if(i == 0 && !RuleB(Chat, SuppressCommandErrors)) {
                    Message(13, "Command '%s' not recognized.", message);
                }
            } else {
                if(!RuleB(Chat, SuppressCommandErrors))
                    Message(13, "Command '%s' not recognized.", message);
            }
        }
        break;
    }

#ifdef BOTS
    if (message[0] == BOT_COMMAND_CHAR) {
        if (bot_command_dispatch(this, message) == -2) {
            if (parse->PlayerHasQuestSub(EVENT_COMMAND)) {
                int i = parse->EventPlayer(EVENT_COMMAND, this, message, 0);
                if (i == 0 && !RuleB(Chat, SuppressCommandErrors)) {
                    Message(13, "Bot command '%s' not recognized.", message);
                }
            }
            else {
                if (!RuleB(Chat, SuppressCommandErrors))
                    Message(13, "Bot command '%s' not recognized.", message);
            }
        }
        break;
    }
#endif

    Mob* sender = this;
    if (GetPet() && GetTarget() == GetPet() && GetPet()->FindType(SE_VoiceGraft))
        sender = GetPet();

    entity_list.ChannelMessage(sender, chan_num, language, lang_skill, message);
    parse->EventPlayer(EVENT_SAY, this, message, language);

    if (sender != this)
        break;

    if(quest_manager.ProximitySayInUse())
        entity_list.ProcessProximitySay(message, this, language);

    if (GetTarget() != 0 && GetTarget()->IsNPC() &&
        !IsInvisible(GetTarget())) {
        if(!GetTarget()->CastToNPC()->IsEngaged()) {
            CheckLDoNHail(GetTarget());
            CheckEmoteHail(GetTarget(), message);

            if(DistanceSquaredNoZ(m_Position, GetTarget()->GetPosition()) <= RuleI(Range, Say)) {
                NPC *tar = GetTarget()->CastToNPC();
                parse->EventNPC(EVENT_SAY, tar->CastToNPC(), this, message, language);

                if(RuleB(TaskSystem, EnableTaskSystem)) {
                    if(UpdateTasksOnSpeakWith(tar->GetNPCTypeID())) {
                        tar->DoQuestPause(this);
                    }
                }
            }
        }
        else {
            if (DistanceSquaredNoZ(m_Position, GetTarget()->GetPosition()) <= RuleI(Range, Say)) {
                parse->EventNPC(EVENT_AGGRO_SAY, GetTarget()->CastToNPC(), this, message, language);
            }
        }

    }
    break;
}
You can just use that as an example and put it in the OOC part of the switch.
Reply With Quote