core/ChatTriggers.h
author David Anderson <dvander@alliedmods.net>
Sun Oct 14 17:55:02 2007 +0000 (2007-10-14)
changeset 1545 4ceff5fa5fdd
parent 1541 e46ad208b9b4
child 1547 78abc407c8a3
permissions -rw-r--r--
fixed compat wrappers including core stuff
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@1519
    37
#include <IGameHelpers.h>
dvander@893
    38
dvander@893
    39
class ChatTriggers : public SMGlobalClass
dvander@893
    40
{
dvander@893
    41
public:
dvander@893
    42
	ChatTriggers();
dvander@897
    43
	~ChatTriggers();
dvander@893
    44
public: //SMGlobalClass
dvander@893
    45
	void OnSourceModGameInitialized();
dvander@893
    46
	void OnSourceModShutdown();
dvander@896
    47
	ConfigResult OnSourceModConfigChanged(const char *key, 
dvander@896
    48
		const char *value, 
dvander@896
    49
		ConfigSource source,
dvander@896
    50
		char *error, 
dvander@896
    51
		size_t maxlength);
dvander@893
    52
private: //ConCommand
faluco@1541
    53
#if defined ORANGEBOX_BUILD
faluco@1541
    54
	void OnSayCommand_Pre(const CCommand &command);
faluco@1541
    55
	void OnSayCommand_Post(const CCommand &command);
faluco@1541
    56
#else
dvander@893
    57
	void OnSayCommand_Pre();
dvander@893
    58
	void OnSayCommand_Post();
faluco@1541
    59
#endif
dvander@893
    60
public:
dvander@893
    61
	unsigned int GetReplyTo();
dvander@893
    62
	unsigned int SetReplyTo(unsigned int reply);
dvander@1469
    63
	bool IsChatTrigger();
dvander@893
    64
private:
dvander@1103
    65
	bool PreProcessTrigger(edict_t *pEdict, const char *args, bool is_quoted);
dvander@893
    66
private:
dvander@893
    67
	ConCommand *m_pSayCmd;
dvander@897
    68
	ConCommand *m_pSayTeamCmd;
dvander@893
    69
	char *m_PubTrigger;
dvander@893
    70
	size_t m_PubTriggerSize;
dvander@893
    71
	char *m_PrivTrigger;
dvander@893
    72
	size_t m_PrivTriggerSize;
dvander@893
    73
	bool m_bWillProcessInPost;
dvander@1103
    74
	bool m_bTriggerWasSilent;
dvander@1469
    75
	bool m_bIsChatTrigger;
dvander@893
    76
	unsigned int m_ReplyTo;
dvander@1103
    77
	char m_ToExecute[300];
dvander@893
    78
};
dvander@893
    79
dvander@893
    80
extern ChatTriggers g_ChatTriggers;
dvander@893
    81
dvander@893
    82
#endif //_INCLUDE_SOURCEMOD_CHAT_TRIGGERS_H_