core/ChatTriggers.h
author David Anderson <dvander@alliedmods.net>
Wed Sep 26 14:38:40 2007 +0000 (2007-09-26)
changeset 1488 5562086c65c8
parent 1469 300cc2432356
child 1519 c325cd4b060a
permissions -rw-r--r--
initial import of UNTESTED, UNFINISHED topmenus extension
dvander@1231
     1
/**
dvander@1231
     2
 * vim: set ts=4 :
ds@1330
     3
 * =============================================================================
dvander@1231
     4
 * SourceMod
dvander@1231
     5
 * Copyright (C) 2004-2007 AlliedModders LLC.  All rights reserved.
ds@1330
     6
 * =============================================================================
dvander@1231
     7
 *
ds@1330
     8
 * This program is free software; you can redistribute it and/or modify it under
ds@1330
     9
 * the terms of the GNU General Public License, version 3.0, as published by the
ds@1330
    10
 * Free Software Foundation.
dvander@1231
    11
 * 
ds@1330
    12
 * This program is distributed in the hope that it will be useful, but WITHOUT
ds@1330
    13
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
ds@1330
    14
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
ds@1330
    15
 * details.
dvander@1231
    16
 *
ds@1330
    17
 * You should have received a copy of the GNU General Public License along with
ds@1330
    18
 * this program.  If not, see <http://www.gnu.org/licenses/>.
dvander@1231
    19
 *
ds@1330
    20
 * As a special exception, AlliedModders LLC gives you permission to link the
ds@1330
    21
 * code of this program (as well as its derivative works) to "Half-Life 2," the
ds@1330
    22
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
ds@1330
    23
 * by the Valve Corporation.  You must obey the GNU General Public License in
ds@1330
    24
 * all respects for all other code used.  Additionally, AlliedModders LLC grants
ds@1330
    25
 * this exception to all derivative works.  AlliedModders LLC defines further
ds@1330
    26
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
ds@1330
    27
 * or <http://www.sourcemod.net/license.php>.
dvander@1231
    28
 *
dvander@1231
    29
 * Version: $Id$
dvander@1231
    30
 */
dvander@1231
    31
dvander@893
    32
#ifndef _INCLUDE_SOURCEMOD_CHAT_TRIGGERS_H_
dvander@893
    33
#define _INCLUDE_SOURCEMOD_CHAT_TRIGGERS_H_
dvander@893
    34
dvander@893
    35
#include "sm_globals.h"
dvander@893
    36
#include "sourcemm_api.h"
dvander@893
    37
dvander@893
    38
#define SM_REPLY_CONSOLE	0
dvander@893
    39
#define SM_REPLY_CHAT		1
dvander@893
    40
dvander@893
    41
class ChatTriggers : public SMGlobalClass
dvander@893
    42
{
dvander@893
    43
public:
dvander@893
    44
	ChatTriggers();
dvander@897
    45
	~ChatTriggers();
dvander@893
    46
public: //SMGlobalClass
dvander@893
    47
	void OnSourceModGameInitialized();
dvander@893
    48
	void OnSourceModShutdown();
dvander@896
    49
	ConfigResult OnSourceModConfigChanged(const char *key, 
dvander@896
    50
		const char *value, 
dvander@896
    51
		ConfigSource source,
dvander@896
    52
		char *error, 
dvander@896
    53
		size_t maxlength);
dvander@893
    54
private: //ConCommand
dvander@893
    55
	void OnSayCommand_Pre();
dvander@893
    56
	void OnSayCommand_Post();
dvander@893
    57
public:
dvander@893
    58
	unsigned int GetReplyTo();
dvander@893
    59
	unsigned int SetReplyTo(unsigned int reply);
dvander@1469
    60
	bool IsChatTrigger();
dvander@893
    61
private:
dvander@1103
    62
	bool PreProcessTrigger(edict_t *pEdict, const char *args, bool is_quoted);
dvander@893
    63
private:
dvander@893
    64
	ConCommand *m_pSayCmd;
dvander@897
    65
	ConCommand *m_pSayTeamCmd;
dvander@893
    66
	char *m_PubTrigger;
dvander@893
    67
	size_t m_PubTriggerSize;
dvander@893
    68
	char *m_PrivTrigger;
dvander@893
    69
	size_t m_PrivTriggerSize;
dvander@893
    70
	bool m_bWillProcessInPost;
dvander@1103
    71
	bool m_bTriggerWasSilent;
dvander@1469
    72
	bool m_bIsChatTrigger;
dvander@893
    73
	unsigned int m_ReplyTo;
dvander@1103
    74
	char m_ToExecute[300];
dvander@893
    75
};
dvander@893
    76
dvander@893
    77
extern ChatTriggers g_ChatTriggers;
dvander@893
    78
dvander@893
    79
#endif //_INCLUDE_SOURCEMOD_CHAT_TRIGGERS_H_