dvander@1231: /**
dvander@1231: * vim: set ts=4 :
ds@1330: * =============================================================================
dvander@1231: * SourceMod
ds@1947: * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
ds@1330: * =============================================================================
dvander@1231: *
ds@1330: * This program is free software; you can redistribute it and/or modify it under
ds@1330: * the terms of the GNU General Public License, version 3.0, as published by the
ds@1330: * Free Software Foundation.
dvander@1231: *
ds@1330: * This program is distributed in the hope that it will be useful, but WITHOUT
ds@1330: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
ds@1330: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
ds@1330: * details.
dvander@1231: *
ds@1330: * You should have received a copy of the GNU General Public License along with
ds@1330: * this program. If not, see .
dvander@1231: *
ds@1330: * As a special exception, AlliedModders LLC gives you permission to link the
ds@1330: * code of this program (as well as its derivative works) to "Half-Life 2," the
ds@1330: * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
ds@1330: * by the Valve Corporation. You must obey the GNU General Public License in
ds@1330: * all respects for all other code used. Additionally, AlliedModders LLC grants
ds@1330: * this exception to all derivative works. AlliedModders LLC defines further
ds@1330: * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
ds@1330: * or .
dvander@1231: *
dvander@1231: * Version: $Id$
dvander@1231: */
dvander@1231:
dvander@893: #ifndef _INCLUDE_SOURCEMOD_CHAT_TRIGGERS_H_
dvander@893: #define _INCLUDE_SOURCEMOD_CHAT_TRIGGERS_H_
dvander@893:
dvander@893: #include "sm_globals.h"
dvander@893: #include "sourcemm_api.h"
dvander@1519: #include
dvander@1547: #include
dvander@1925: #include
dvander@893:
dvander@893: class ChatTriggers : public SMGlobalClass
dvander@893: {
dvander@893: public:
dvander@893: ChatTriggers();
dvander@897: ~ChatTriggers();
dvander@893: public: //SMGlobalClass
dvander@1925: void OnSourceModAllInitialized();
dvander@1925: void OnSourceModAllInitialized_Post();
dvander@893: void OnSourceModGameInitialized();
dvander@893: void OnSourceModShutdown();
dvander@896: ConfigResult OnSourceModConfigChanged(const char *key,
dvander@896: const char *value,
dvander@896: ConfigSource source,
dvander@896: char *error,
dvander@896: size_t maxlength);
dvander@893: private: //ConCommand
skamonkey@3899: #if SOURCE_ENGINE == SE_DOTA
skamonkey@3942: void OnSayCommand_Pre(const CCommandContext &, const CCommand &command);
skamonkey@3942: void OnSayCommand_Post(const CCommandContext &, const CCommand &command);
skamonkey@3899: #elif SOURCE_ENGINE >= SE_ORANGEBOX
faluco@1541: void OnSayCommand_Pre(const CCommand &command);
faluco@1541: void OnSayCommand_Post(const CCommand &command);
faluco@1541: #else
dvander@893: void OnSayCommand_Pre();
dvander@893: void OnSayCommand_Post();
faluco@1541: #endif
dvander@893: public:
dvander@893: unsigned int GetReplyTo();
dvander@893: unsigned int SetReplyTo(unsigned int reply);
dvander@1469: bool IsChatTrigger();
dvander@1925: bool WasFloodedMessage();
dvander@893: private:
dvander@1103: bool PreProcessTrigger(edict_t *pEdict, const char *args, bool is_quoted);
dvander@1925: bool ClientIsFlooding(int client);
dvander@893: private:
dvander@893: ConCommand *m_pSayCmd;
dvander@897: ConCommand *m_pSayTeamCmd;
kyle@3974: #if SOURCE_ENGINE == SE_EPISODEONE
kyle@3974: ConCommand *m_pSay2Cmd;
kyle@3974: #elif SOURCE_ENGINE == SE_NUCLEARDAWN
kyle@3974: ConCommand *m_pSaySquadCmd;
kyle@3974: #endif
dvander@893: char *m_PubTrigger;
dvander@893: size_t m_PubTriggerSize;
dvander@893: char *m_PrivTrigger;
dvander@893: size_t m_PrivTriggerSize;
dvander@893: bool m_bWillProcessInPost;
dvander@1103: bool m_bTriggerWasSilent;
dvander@1469: bool m_bIsChatTrigger;
dvander@1925: bool m_bWasFloodedMessage;
kyle@3974: bool m_bPluginIgnored;
dvander@893: unsigned int m_ReplyTo;
dvander@1103: char m_ToExecute[300];
dvander@1925: IForward *m_pShouldFloodBlock;
dvander@1925: IForward *m_pDidFloodBlock;
kyle@3974: IForward *m_pOnClientSayCmd;
kyle@3974: IForward *m_pOnClientSayCmd_Post;
kyle@3974: #if SOURCE_ENGINE == SE_EPISODEONE
kyle@3974: bool m_bIsINS;
kyle@3974: #endif
dvander@893: };
dvander@893:
dvander@893: extern ChatTriggers g_ChatTriggers;
dvander@893:
dvander@893: #endif //_INCLUDE_SOURCEMOD_CHAT_TRIGGERS_H_