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