core/ChatTriggers.h
author Asher Baker <asherkin@gmail.com>
Fri Feb 17 03:28:02 2012 +0000 (2012-02-17)
changeset 3458 62ad320dd01a
parent 2617 253d6b4f15ab
child 3899 fd4ec50a0d6c
permissions -rw-r--r--
Generate and upload breakpad symbols if BREAKPAD_SYMBOL_SERVER variable is set. (bug 5229, r=dvander)
dvander@1231
     1
/**
dvander@1231
     2
 * vim: set ts=4 :
ds@1330
     3
 * =============================================================================
dvander@1231
     4
 * SourceMod
ds@1947
     5
 * Copyright (C) 2004-2008 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@1925
    39
#include <IForwardSys.h>
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@1925
    47
	void OnSourceModAllInitialized();
dvander@1925
    48
	void OnSourceModAllInitialized_Post();
dvander@893
    49
	void OnSourceModGameInitialized();
dvander@893
    50
	void OnSourceModShutdown();
dvander@896
    51
	ConfigResult OnSourceModConfigChanged(const char *key, 
dvander@896
    52
		const char *value, 
dvander@896
    53
		ConfigSource source,
dvander@896
    54
		char *error, 
dvander@896
    55
		size_t maxlength);
dvander@893
    56
private: //ConCommand
ds@2400
    57
#if SOURCE_ENGINE >= SE_ORANGEBOX
faluco@1541
    58
	void OnSayCommand_Pre(const CCommand &command);
faluco@1541
    59
	void OnSayCommand_Post(const CCommand &command);
faluco@1541
    60
#else
dvander@893
    61
	void OnSayCommand_Pre();
dvander@893
    62
	void OnSayCommand_Post();
faluco@1541
    63
#endif
dvander@893
    64
public:
dvander@893
    65
	unsigned int GetReplyTo();
dvander@893
    66
	unsigned int SetReplyTo(unsigned int reply);
dvander@1469
    67
	bool IsChatTrigger();
dvander@1925
    68
	bool WasFloodedMessage();
dvander@893
    69
private:
dvander@1103
    70
	bool PreProcessTrigger(edict_t *pEdict, const char *args, bool is_quoted);
dvander@1925
    71
	bool ClientIsFlooding(int client);
dvander@893
    72
private:
dvander@893
    73
	ConCommand *m_pSayCmd;
dvander@897
    74
	ConCommand *m_pSayTeamCmd;
dvander@893
    75
	char *m_PubTrigger;
dvander@893
    76
	size_t m_PubTriggerSize;
dvander@893
    77
	char *m_PrivTrigger;
dvander@893
    78
	size_t m_PrivTriggerSize;
dvander@893
    79
	bool m_bWillProcessInPost;
dvander@1103
    80
	bool m_bTriggerWasSilent;
dvander@1469
    81
	bool m_bIsChatTrigger;
dvander@1925
    82
	bool m_bWasFloodedMessage;
dvander@893
    83
	unsigned int m_ReplyTo;
dvander@1103
    84
	char m_ToExecute[300];
dvander@1925
    85
	IForward *m_pShouldFloodBlock;
dvander@1925
    86
	IForward *m_pDidFloodBlock;
dvander@893
    87
};
dvander@893
    88
dvander@893
    89
extern ChatTriggers g_ChatTriggers;
dvander@893
    90
dvander@893
    91
#endif //_INCLUDE_SOURCEMOD_CHAT_TRIGGERS_H_