ChatBlade SDK Documentation

Class   CBChatHandler
Header   CBChatHandler.h

Data    Member Summary    Member Details


Information 

CBChatHandler is the primary class of ChatBlade.  
Most Chat interactions shall flow through it or through one of its member classes.  
 
When a player enters a line of Chat, CBChatHandler gets that line and routes it to the appropriate OnSlashCommand() function.  
 
When a Chat Message arrives over the Network, CBChatHandler sends it to the appropriate CBTextWindowData instances.  
 
CBChatHandler contains the Initialization functions to start up ChatBlade.  
In addition, CBChatHandler contains some useful functions to enable Game Developers to easily add Chat Messages into the game.  
 
CBChatHandler contains an instance of ChatBlades CBChatFilter, CBNicknameList, CBIgnoreList, CBAliasList, CBSpamFilter, CBReplacementFilter, and a map of the CBLanguageTables.  

Game Developer Implementation:  

Only one instance of CBChatHandler should be instantiated.  Once instantiated and InitializeChat() is called, ChatBlade shall place a pointer to the CBChatHandler instance into CBData::pChatHandler, to enable other ChatBlade classes access to the CBChatHandler functions.  
After instantiation of the CBChatHandler instance, Game Developers should call InitializeChat() to load up the information ChatBlade needs to operate (such as the Chat Filter and Language Tables).  
When a Player enters a line of Chat Text, Developers should call OnLineEntered() with that line of text and the ID of the Edit Field that produced the text.                                             
When a Chat Message is received over the Network, the Developers should call OnIncomingChatMessage() after the message has been assembled.  
To add messages to the Chat System, Developers can call the AddMessageXXX() functions, such as AddGenericMessage(), AddMessageCombat(), or AddMessageDebug().  
If a Player logs a Character out to a Character Select screen, Developers should call OnCharacterLogout() so that ChatBlade internal information for the previous Character can be reset before a new Character is logged in.  

Source File Comments:  

// Contains the entry point for when a user types in a line of text and the flow of logic for processing that line
// Contains the function to initialize the ChatBlade system
// Contains the entry point for when a Chat Message is received from the Wire
 
// Typically only one instance of CBChatHandler should be instantiated
// A globally accessible pointer to that instance can be accessed via CBData::pChatHandler

Data:  

CBChatFilter m_ChatFilter
        Used by ChatBlade to Filter out offensive text.  
CBIgnoreList m_IgnoreList
        Used by ChatBlade to ignore posts from other players.  
CBSpamFilter m_SpamFilter
        Used by ChatBlade to discard Chat Messages containing Spam.  
CBReplacementFilter m_ReplacementFilter
        Used by ChatBlade to enable Players to Replace phrases in Chat Messages with alternate values.   
        Primarily designed to support Role-Players.  
CBAliasList m_AliasList
        Used by ChatBlade to support the /alias command.  
CBNicknameList m_NicknameList
        Used by ChatBlade to support other Players Nicknames.  
std::map<int, CBLanguageTable> m_LanguageTableMap
        A Map of all of our in-game Language tables (1 for each Language such as Elvish or Klingon).  
        Keyed via the LANGUAGEID.  
CBClientImplementation m_ClientImplementation
        An instance of the CBClientImplementation class to hold functions that the Game Developers should implement.  
CBSampleImplementation m_SampleImplementation
        An instance of the CBSampleImplementation class that holds some sample implementations.  
        Should be removed once Developers have implemented the duplicate functions in CBClientImplementation.  
 

Member Function Summary:  

          CBChatHandler()
        Constructor.  
int       InitializeChat()
        Should be called at game startup to initialize the ChatBlade system.  
int       DeInitializeChat()
        Should be called when the game client is shut down to do cleanup.  
int       InitializeChatFilter()
        Loads up and populates our Chat Filter.  
int       InitializeLanguageTables()
        Loads up and populates our in game Languages such as Elvish.
int       InitializeSlashCommands()
        Populates our CBCommandMap classes with their Slash Command strings and functions.
int       InitializeAliasList()
        Loads up our Alias List.
int       InitializeNicknameList()
        Loads up our Nickname List.
int       InitializeIgnoreList()
        Loads up our Ignore List.
int       InitializeSpamFilter()
        Loads up and populates our Spam Filter.
int       InitializeReplacementFilter()
        Loads up and populates our Replacement Filter.
int       LoadMandatoryCommands()
        Populates certain CBCommandMap classes with the mandatory Slash Commands such as CB_DEFAULT_SLASH_COMMAND.
int       OnCharacterLogout()
        Function which resets various ChatBlade internals when the Player logs their Character out to a Character Select screen.  
int       OnIncomingChatMessage(CBChatMessage cbChatMessage)
       Should be called from the Network code once we have received a Chat Message.
       Routes the Chat Message to the appropriate Chat windows.
int       OnIncomingTell(CBChatMessage cbChatMessage)
        Handles processing when a /tell is received.  Auto-Replies if AFK and stores name of sender to assist in replying.
int       OnLineEntered(CBSTRING sLine, int nEditFieldID = 0)
        Called when a user types in a line of chat text into the GUI.  Parses the line and sends it off for processing.  
int       ExpandQuickCommandCharacter(CBSTRING & sLine /*IN OUT*/)
        Converts the first Quick Command character of an entered in line to its associated Slash Command, if any.  
int       AddDefaultSlashCommand(CBSTRING & sLine /*IN OUT*/, int nEditFieldID)
        Adds in the default Slash Command for the edit field if no Slash Command is entered.  
int       ExpandMacros(CBSTRING & sLine /*IN OUT*/)
        Function that takes a line of text and expands any % macros in that line.  
int       SanitizeString(CBSTRING & sLine /*IN OUT*/)
        Stub to Remove any Game specific text that a user may have entered such as HardCoded String Delimiters.
int       ProcessSlashCommand(CBSTRING sCommmandString, CBSTRING sRestOfLine)
        Finds the associated CBSlashCommands::OnCommandXXX() function and invokes it.  
int       AddMessageToTextWindowDatas(CBChatMessage cbChatMessage)
        Adds a message to all the CBTextWindowData instances that are Monitoring Chatter on the messages channel.
int       EchoMessage(CBChatMessage cbChatMessage)
        Displays a ChatMessage to the user.
int         AddGenericMessage(CBSTRING sText, int nIDChannel, CBSTRING sSourceName = CB_NONE, CBSTRING sDestinationString = CB_NONE, int nIDLanguage = CB_LANGUAGE_NONE, int nIDMood = CB_MOOD_NONE, int nIDFaction = CB_FACTION_NONE)
        Creates a CBChatMessage instance and sends it along to the Text Windows which are monitoring that channel.  
int       AddMessageCommandFeedback(CBSTRING sText, int nChannelID = CB_CHANNEL_COMMAND_FEEDBACK)
        Function which generates a feedback Message in response to a user Slash Command.
int       AddMessageCombat(CBSTRING sText, int nChannelID = CB_CHANNEL_COMBAT)
        Function which generates a local Combat message to display.  
int       AddMessageHeal(CBSTRING sText, int nChannelID = CB_CHANNEL_COMBAT_HEAL)
        Function which generates a local Healing message to display.
int       AddMessageSpecialPower(CBSTRING sText, int nChannelID = CB_CHANNEL_COMBAT_POWER)
        Function which generates a local Power (Spell, Nano, Ability) message to display.
int       AddMessagePopUp(CBSTRING sText, int nChannelID = CB_CHANNEL_POPUP)
        Function which generates a local Pop-Up message to display.  
int       AddMessageDebug(CBSTRING sText, CBSTRING sContext = CB_EMPTY_STRING, int nChannelID = CB_CHANNEL_DEBUG)
        Function which generates a local Debug message to display.
int       SendChatMessage(CBChatMessage cbChatMessage)
        Entry point to start the process of sending a Chat Message over the wire.  
int       SetVerbosityLevel(int nVerbosityLevel)
        Function which sets the Verbosity level of the displayed Chat Messages.  
int       SetMood(int nMoodID)
        Function which sets the Mood of  new Chat Messages.  
int       SetLanguage(int nLanguageID)
        Function which sets the Language (Elvish, Klingon) of new Chat Messages.  
int       SetChatFilterEnabled(int bEnableFilterFlag = CB_TRUE)
        Function which Enables or Disables the Chat Filter.    
int       SetSpamFilterEnabled(int bEnableFilterFlag = CB_TRUE)
        Function which Enables or Disables the Spam Filter.    
int       SetReplacementFilterEnabled(int bEnableFilterFlag = CB_TRUE)
        Function which Enables or Disables the Replacement Filter.    
int       IsDisplayableChatMessage(CBChatMessage cbChatMessage)
        Function which determines if the Chat Message should be Displayed.  
 

Member Function Detail:  

    CBChatHandler::CBChatHandler()
Comments:
Empty Constructor
Parameters:
None
Returns:
None
 
int  CBChatHandler::InitializeChat()
Comments:
Should be called on Game Startup to Initialize the ChatBlade system.  
Loads the Slash Commands, Chat Filter, Language Tables, Ignore list, Alias list, Nickname list, and other things.  
Copies a pointer to this instance into CBData::pChatHandler for use by other ChatBlade classes.  
Should be invoked before doing most other ChatBlade actions.  
Parameters:
None
Returns:
CBClientImplementation.LoadSlashCommands() return value.  
 
int  CBChatHandler::DeInitializeChat()
Comments:
Should be called when the game client is shut down to do cleanup.  
ChatBlade itself needs no cleanup if the samples are removed, so this function may just be a stub.  
Parameters:
None
Returns:
CB_SUCCESS
 
int  CBChatHandler::InitializeSlashCommands()
Comments:
Sets up all of the Slash Commands.  
Upon function exit, CBData::vCommandMapArray should contain an array of CBCommandMap instances that match typed in Slash Commands with their CBSlashCommands::OnCommandXXX() function pointers.  
Called from InitializeChat().  
Calls CBSlashCommands::InitializeCommandPointerMap(), then CBClientImplementation.LoadSlashCommands(), then LoadMandatoryCommands().  
Parameters:
None
Returns:
CBClientImplementation.LoadSlashCommands() return value. 
 
int  CBChatHandler::InitializeChatFilter()
Comments:
Loads up our Chat Filter.  
Words found in Chat Messages that are members of the Chat Filter are removed from Chat Messages and replaced with #@!$ style text when the Chat Filter is Enabled.  
ChatBlade uses the Chat Filter stored in m_ChatFilter.  
Called from InitializeChat().  
Calls  CBClientImplementation::LoadChatFilter().  
Parameters:
None
Returns:
CBClientImplementation::LoadChatFilter() return value.  
 
int  CBChatHandler::InitializeLanguageTables()
Comments:
Loads up and populates our in game languages such as Elvish.  
A Map of all the Language Tables is stored in m_LanguageTableMap.  
Called from InitializeChat().  
Calls  CBClientImplementation::LoadLanguageTables(). 
Parameters:
None
Returns:
CBClientImplementation::LoadLanguageTables() return value.  
 
int  CBChatHandler::InitializeAliasList()
Comments:
Loads up our Alias List.  
An Alias is a Player created single word Slash Command that expands into an existing Game defined Slash Command and its parameters.  
ChatBlade uses the Alias List stored in m_AliasList to expand Aliases into their full Slash Commands.  
Called from InitializeChat().  
Calls  CBClientImplementation::LoadAliasList(). 
Parameters:
None
Returns:
CBClientImplementation::LoadAliasList() return value.  
 
int  CBChatHandler::InitializeNicknameList()
Comments:
Loads up our Nickname List.  
A Nickname is a Player created short name for another Character.  It is used to facilitate /tells.  
ChatBlade expands any Nickname encountered into its full Character Name when the User sends a /tell.  
ChatBlade uses the Nickname List stored in m_NicknameList.  
Called from InitializeChat().  
Calls  CBClientImplementation::LoadNicknameList(). 
Parameters:
None
Returns:
CBClientImplementation::LoadNicknameList() return value.  
 
int  CBChatHandler::InitializeIgnoreList()
Comments:
Loads up our Ignore List.  
Chat Messages received from Characters in the Ignore List are discarded and not displayed by ChatBlade.  
ChatBlade uses the Ignore List stored in m_IgnoreList.  
Called from InitializeChat().  
Calls  CBClientImplementation::LoadIgnoreList(). 
Parameters:
None
Returns:
CBClientImplementation::LoadIgnoreList() return value.  
 
int  CBChatHandler::InitializeSpamFilter()
Comments:
Loads up our Spam Filter.  
Chat Messages containing strings which are found in the Spam Filter are discarded and the Chat Message is not displayed.   
ChatBlade uses the Spam Filter stored in m_SpamFilter.  
Called from InitializeChat().  
Calls  CBClientImplementation::LoadSpamFilter().  
Parameters:
None
Returns:
CBClientImplementation::LoadSpamFilter() return value.  
 
int  CBChatHandler::InitializeReplacementFilter()
Comments:
Loads up our Replacement Filter.  
Chat Messages containing strings which are found in the Replacement Filter are modified to have those phrases Replaced with their specified replacement values.   
The Replacement Filter is also known as the RolePlay (RP) Filter and is designed to be conducive to Role-Playing.   
ChatBlade uses the Replacement Filter stored in m_ReplacementFilter.  
Called from InitializeChat().  
Calls  CBClientImplementation::LoadReplacementFilter().  
Parameters:
None
Returns:
CBClientImplementation::LoadReplacementFilter() return value.  
 
int  CBChatHandler::LoadMandatoryCommands()
Comments:
Populates our CBCommandMap classes with a few mandatory Slash Commands such as CB_DEFAULT_SLASH_COMMAND.  
Mandatory Commands are needed by ChatBlade in order to support Quick Commands (:, !, @, etc.  ).  
ChatBlade allows Players to customize the Slash Command Interface.  To support Quick Commands ChatBlade needs a few Slash Commands that are not Player modifiable.  These Mandatory Commands are guaranteed to exist.  
Adds a few Slash Command strings that the Quick Commands shall expand into.  
Called from InitializeSlashCommands().  
Parameters:
None
Returns:
CB_SUCCESS
 
int  CBChatHandler::OnCharacterLogout()  
Comments:
Resets various ChatBlade internal elements when a Character logs out.   
Should be invoked by the Developer when the Player logs a Character out to the Character Select screen, but does not fully Exit the game.   
Resets ChatBlade settings for AFK, DND (Do not Disturb), Chat Mood, and Chat Language to their defaults and removes all internal instances of CBTextWindowData and CBEditFieldData.  
This function does not reset the Reply or Retell information.  This allows a Player to log in their alternate Mule Character and still /reply to another Player they were talking to previously.  
Does not reset /Alias, /Nickname, or /Ignore information.  
After invoking this function Developers should make sure to call CBData::AddEditFieldData() and CBData::AddTextWindowData() as needed, if the Player logs in with an alternate Characters UI.  
Not invoked by ChatBlade.   
Parameters:
None
    
Returns:
CB_SUCCESS
 
int  CBChatHandler::OnIncomingChatMessage( CBChatMessage cbChatMessage)
Comments:
This function should be called from the Network Code once we have received a chat message.  
Does a little bit of processing then passes the message on to AddMessageToTextWindowDatas() to send the message to the appropriate Text Windows.  
If cbChatMessage is from a Source on the Ignore List, is from an opposing FactionID, or contains Spam, the message is discarded.  
If the message is a /tell this function calls OnIncomingTell().  
Parameters:
cbChatMessage
    A CBChatMessage instance we have received over the network, such as some Group Chat or maybe an /auction message.  
Returns:
CB_SUCCESS
CB_ERROR_MESSAGE_IGNORED if the message is from someone on our Ignore List, an opposing faction, or contains Spam.    
CB_ERROR_CHANNEL_SIZE_ZERO if the last CBTextWindowData instance monitoring this channel has a Channel Size of 0.  
CB_ERROR_INCORRECT_CHANNEL if the last CBTextWindowData instance monitoring this channel should not have received the message.  (Likely a ChatBlade internal error).  
 
int  CBChatHandler::OnIncomingTell( CBChatMessage cbChatMessage)
Comments:
Stores the Source of the /tell to facilitate /replying.  
ChatBlade stores the Character Name of the last Player to give the user a /tell in CBData::sNameOfLastTeller.  
If the Player is AFK or in DND mode, this function auto-replies back to the sender stating they are AFK or Do Not Disturb.  
Called by OnIncomingChatMessage().  
Parameters:
cbChatMessage
    A Tell message having a Channel ID of CB_CHANNEL_TELL or CB_CHANNEL_CUSTOMER_SERVICE_TELL.  
Returns:
CB_SUCCESS
 
int  CBChatHandler::OnLineEntered( CBSTRING sLine,
int nEditFieldID = 0)
Comments:
This function is the primary entry point for handling Player typed Chat.  
Developers should call this function when a Player enters a line of Text.  They should pass in the line of text and the ID of the Edit Field that produced that text.  
ChatBlade parses and massages the line and adds it to the Chat History of that Edit Field.  It then sends the line off to be processed by one of the OnCommandXXX() Slash Command functions of CBSlashCommands.  
If sLine does not start with a Slash Command the Default Slash Command for that Edit Field shall be Pre-pended.  
If sLine starts with a Quick Command Character, that Quick Command shall be expanded into its Slash Command equivalent.  
If sLine starts with an Alias, the Alias shall be replaced with its equivalent Slash Command.  
If sLine contains any Macros (such as %t) these Macros shall be expanded into their equivalent text.  
After parsing and massaging the line, every sLine should start with an appropriate Slash Command.  
This function then breaks the line into its Slash Command and Parameters portions and calls ProcessSlashCommand().  
ChatBlade keeps track internally of a counter to determine the position in the Chat History of the Edit Field.  When this function is called that counter is reset to the Beginning of the Chat History.  
Parameters:
sLine
    A line of text typed by the Player.  Typically a Slash Command or Chat.  
nEditFieldID 
    The ID of the Edit Field that produced the text.  May default to 0 if the game only allows 1 GUI Edit Field.  
Returns:
CB_ERROR_EMPTY_STRING if sLine is empty.  
Otherwise returns what the call to ProcessSlashCommand() returns, which is quite diverse.  
 
int  CBChatHandler::ExpandQuickCommandCharacter( CBSTRING & sLine /*IN OUT*/)
Comments:
If sLine starts with a Quick Command Character, this function expands that Quick Command into its Slash Command equivalent.  
Quick Commands are single characters that allow for speedy group or guild chat or /emotes or other chat.  
Typical Quick Commands include:  
  : and ; for /Emote
  ! for /Say
  @ for /Guild
  # for /Group
  $ for /Auction
  ^ for /Raid
By default, ChatBlade supports these Quick Commands.  Game Developers may alter them to suit the Games design.  
LoadMandatoryCommands() typically loads the HardCoded Slash Commands the Quick Commands expand into.  These Commands are guaranteed to exist in order to support Quick Commands.  
ExpandQuickCommandCharacter() is called from OnLineEntered().  
Parameters:
sLine 
    A Reference to a CBSTRING line that the Player has typed in.  Upon entry this parameter may or may not start with a Quick Command Character.  If it does, the Quick Command is replaced with its Slash Command equivalent upon function return.  If sLine does not start with a Quick Command it remains unchanged.  
Returns:
CB_ERROR_EMPTY_STRING if sLine is shorter than 2 characters long.  
CB_SUCCESS regardless of if sLine was modified with an expanded Quick Command.  
If sLine starts with a Quick Command it is altered to start with the equivalent Slash Command.  
 
int  CBChatHandler::AddDefaultSlashCommand( CBSTRING & sLine /*IN OUT*/,
int nEditFieldID)
Comments:
Adds in the default Slash Command for the edit field if no Slash Command is entered.  
If sLine does not start with a Slash Command, ChatBlade shall find the default Slash Command for the Edit Field and add that on to the beginning of the line.  
Each Edit Field can have a different default Slash Command.  One may be set to be /say while another is /group, and a third is /tell Irridia,.  
Called from OnLineEntered().  
Parameters:
sLine 
    A reference to a Line of Chat that the Player has typed in.  If it does not start with a Slash Command, this function shall add one to it.  If it does start with a Slash Command sLine remains unchanged.  
nEditFieldID
    The ID of the Edit Field that produced the Line.  
Returns:
CB_SUCCESS
If sLine does not start with a Slash Command one is pre-pended onto it.  
 
int  CBChatHandler::ExpandMacros( CBSTRING & sLine /*IN OUT*/)
Comments:
This function is designed to replace any % Macros the Player may have typed with their Text Equivalents.  
For Example:  %T might expand to the name of the Current Target and %L might expand to the Players current Location.  
This function calls CBClientImplementation.ExpandMacros() to do the Macro expansion.  Developers need to implement this function to utilize any Macros their game supports.  
Called from OnLineEntered().  
Parameters:
sLine 
    A reference to a Line of text the Player has typed in.  If this line contains any % Macros, those Macros are replaced with their equivalent Text.  If this line does not contain any % Macros it remains unchanged.  
Returns:
sLine is potentially altered if it contains any %Macros.  
Whatever CBClientImplementation.ExpandMacros() returns.  
 
int  CBChatHandler::SanitizeString( CBSTRING & sLine /*IN OUT*/)
Comments:
SanitizeString is an Empty stub designed to allow Game Developers to remove any special text, such as a packet Delimiter, that the Player may have typed in.  
For Example:  If the games network packets are text based and use special strings to delimit message parts, Players may inadvertently type in those Delimiters.  This function allows anything important the Player may have inadvertently typed in to be removed from the Chat before processing.  
Called from OnLineEntered().  
Parameters:
sLine 
    A reference to a line of Chat Text the Player has typed in.  If sLine contains no proprietary character strings then it remains unchanged.  If sLine does contain proprietary character strings these strings should be removed from sLine upon function return.  
Returns:
CB_ERROR_NOT_IMPLEMENTED unless the Game developer modifies this function.  
sLine is designed to potentially be modified if needed.  
 
int  CBChatHandler::ProcessSlashCommand( CBSTRING sCommmandString,
CBSTRING sRestOfLine)
Comments:
Invokes the OnCommandXXX() function related to the sCommmandString Slash Command.  
This function cycles through all our CBCommandMaps and locates the first one that is matched to sCommmandString.  It then invokes the OnCommandXXX() function in that CBCommandMap via  CBCommandMap::CallCommand().  
If the Slash Command is not found, this function informs the Player that the Slash Command is invalid.  
If the OnCommandXXX() function returns CB_ERROR_NOT_IMPLEMENTED, this function informs the Player that that Slash Command is not yet fully implemented.  
Called from OnLineEntered().  
Parameters:
sCommmandString
    The Slash Command entered by the Player, or added by default by ChatBlade.  Typically this parameter shall always start with a '/' character.  
sRestOfLine
    The parameters the player entered after the Slash Command.  May be empty for Slash Commands with no parameters.  For Chatting, this parameter is usually the text message the Player wishes to send.  
Returns:
CB_ERROR_UNKNOWN_COMMAND if the Slash Command is invalid.  
Various return values depending on which CBSlashCommands OnCommandXXX() function gets invoked.  
 
int  CBChatHandler::AddMessageToTextWindowDatas( CBChatMessage cbChatMessage)
Comments:
This function distributes a Chat Message to each CBTextWindowData instance that is monitoring the Chat Channel of the Message.  It effectively sends the Chat Message to the appropriate Chat Windows.  
Each GUI Text window should have a related CBTextWindowData instance that keeps track of its messages and what channels that Text Window wants to display.  
AddMessageToTextWindowDatas() cycles through each CBTextWindowData instance and adds cbChatMessage to each one that is monitoring cbChatMessage's Chat Channel.  
This function also calls CBClientImplementation::ChatBubble() to allow the Game to display single Chat Bubbles over Characters Heads.  
When a message should be added to a Text Window ChatBlade calls CBClientImplementation::OnMessageAddedToTextWindow() to enable the GUI Text Windows to know when they should be refreshed.  
Called from OnIncomingChatMessage() when a message is received over the wire and from the various AddMessageXXX() functions for locally displayed messages such as Combat spam.  
Parameters:
cbChatMessage
    A Chat Message to distribute to the various Chat Windows.  
Returns:
CB_ERROR_CHANNEL_SIZE_ZERO if the last CBTextWindowData instance that cares about this message has a maximum storage size of 0.  
CB_ERROR_INCORRECT_CHANNEL if the Chat Message was attempted to be placed in an incorrect CBTextWindowData.  (Likely an internal ChatBlade error).  
CB_ERROR_MESSAGE_IGNORED if the Chat Message is Spam, from an opposing Faction, or from a Character on the Ignore List.  
CB_SUCCESS
 
int  CBChatHandler::EchoMessage( CBChatMessage cbChatMessage)
Comments:
EchoMessage() is designed to be called when one wants to display a CBChatMessage.  
This function takes the Chat Message and calls AddMessageToTextWindowDatas() to distribute the Chat Message to the appropriate Text Windows.  
Developers may call this function if they have a CBChatMessage already created.  
Parameters:
cbChatMessage
    A Chat Message that should be displayed.  
Returns:
CB_ERROR_MESSAGE_IGNORED if the message is from a Player on the Ignore List.  
CB_ERROR_CHANNEL_SIZE_ZERO if the last CBTextWindowData instance that cares about this message has a maximum storage size of 0.  
CB_ERROR_INCORRECT_CHANNEL if the Chat Message was attempted to be placed in an incorrect CBTextWindowData.  (Likely an internal ChatBlade error).  
CB_SUCCESS
 
int  CBChatHandler::AddGenericMessage( CBSTRING sText,
int nIDChannel,
CBSTRING sSourceName = CB_NONE,
CBSTRING sDestinationString = CB_NONE,
int nIDLanguage = CB_LANGUAGE_NONE,
int nIDMood = CB_MOOD_NONE,
int nIDFaction = CB_FACTION_NONE)
Comments:
AddGenericMessage generates a CBChatMessage when supplied the parts and adds that message to each Chat Window that is monitoring chatter on the messages Chat Channel.  
All parameters beside the Text and ChannelID of the message are defaulted to None and may be left off if not needed.  
Game Developers can call this function to add a Chat Message to the game.  
For Example, if the Player gains a Level or explores a new area the Game Developer can call this function to inform the Player.  
This function shall not send the Chat Message over the Network and is for Local display only.  
Parameters:
sText
    The Text of the Chat Message to Display.  
nIDChannel
    The ChannelID of the Chat Message.  The Chat Message created shall get delivered to any Text Windows monitoring Chat on this ChannelID.   
sSourceName = CB_NONE
    The Source of the Chat Message.  Defaults to None ("CBNONE").  
sDestinationString = CB_NONE
    The Destination of the Chat Message.  Defaults to None ("CBNONE"). 
nIDLanguage = CB_LANGUAGE_NONE
    The LanguageID of the Language the Chat Message should be displayed in.  For Example:  CB_LANGUAGE_ELVISH.  
nIDMood = CB_MOOD_NONE
    The Mood of the Chat Message.  For Example:  CB_MOOD_HAPPY, or CB_MOOD_BUBBLY.  
nIDFaction = CB_FACTION_NONE
    The FactionID of the Chat Message for Games which use Factions.  For Example:  CB_FACTION_ORCS.  
Returns:
CB_ERROR_MESSAGE_IGNORED if the message is from a Source on the Ignore List.  
CB_ERROR_CHANNEL_SIZE_ZERO if the last CBTextWindowData instance that cares about this message has a maximum storage size of 0.  
CB_ERROR_INCORRECT_CHANNEL if the Chat Message was attempted to be placed in an incorrect CBTextWindowData.  (Likely an internal ChatBlade error).  
CB_SUCCESS
 
int  CBChatHandler::AddMessageCommandFeedback( CBSTRING sText,
int nChannelID = CB_CHANNEL_COMMAND_FEEDBACK)
Comments:
This function adds a Feedback Message to the game in response to a Slash Command().  
Used to display Slash Command Feedback to the Player.  
For Example:  If the player makes a new /alias, ChatBlade calls this function to tell the Player whether or not the /alias command was Successful.  
Game Developers can call this function to display Slash Command feedback to the Player.  Can be used to display /who information, or /loc info, or in response to an "/ignore list" command, etc..  
Parameters:
sText
    The Text to Display.  
nChannelID = CB_CHANNEL_COMMAND_FEEDBACK
    The ChannelID to display the Chat Message on.  Defaults to CB_CHANNEL_COMMAND_FEEDBACK.  
Returns:
CB_ERROR_MESSAGE_IGNORED if "CBNONE" on the Ignore List.  
CB_ERROR_CHANNEL_SIZE_ZERO if the last CBTextWindowData instance that cares about this message has a maximum storage size of 0.  
CB_ERROR_INCORRECT_CHANNEL if the Chat Message was attempted to be placed in an incorrect CBTextWindowData.  (Likely an internal ChatBlade error).  
CB_SUCCESS
 
int  CBChatHandler::AddMessageCombat( CBSTRING sText,
int nChannelID = CB_CHANNEL_COMBAT)
Comments:
This function adds a Combat Message to the game.  
It is a convenience function used to display Combat Feedback to the Player.  
For Example:  May be used to display "Thoria hits the Magnapard for 42 Damage", or "The Visperre misses You with its Tail Strike".  
Game Developers can call this function to display Combat Spam.  nChannelID defaults to CB_CHANNEL_COMBAT but is designed to be changed to any Combat related Channel.  
See CBConstants.h for a listing of the pre-defined Combat Chat Channels that ChatBlade initially provides.  
The Chat Message is Local only and does not go out over the Network.  
Parameters:
sText
    The Text to Display.  
nChannelID = CB_CHANNEL_COMBAT
    The ChannelID to display the Chat Message on.  Defaults to CB_CHANNEL_COMBAT.  
Returns:
CB_ERROR_MESSAGE_IGNORED if "CBNONE" on the Ignore List.  
CB_ERROR_CHANNEL_SIZE_ZERO if the last CBTextWindowData instance that cares about this message has a maximum storage size of 0.  
CB_ERROR_INCORRECT_CHANNEL if the Chat Message was attempted to be placed in an incorrect CBTextWindowData.  (Likely an internal ChatBlade error).  
CB_SUCCESS
 
int  CBChatHandler::AddMessageHeal( CBSTRING sText,
int nChannelID = CB_CHANNEL_COMBAT_HEAL)
Comments:
Helper function designed to Display Healing Chat Spam.  
Game Developers can use this function to Display text such as "Palladia heals You for 150".  
Does not send the message over the Wire and is for Local display only.  
ChatBlade comes predefined with a variety of Healing channels, such as:  CB_CHANNEL_COMBAT_HEAL_ENEMY, CB_CHANNEL_COMBAT_HEAL_GROUP, and CB_CHANNEL_COMBAT_HEAL_PET.  
Parameters:
sText
    The Text to Display.  
nChannelID = CB_CHANNEL_COMBAT_HEAL
    The ChannelID to display the Chat Message on.  Defaults to CB_CHANNEL_COMBAT_HEAL.  
Returns:
CB_ERROR_MESSAGE_IGNORED if "CBNONE" on the Ignore List.  
CB_ERROR_CHANNEL_SIZE_ZERO if the last CBTextWindowData instance that cares about this message has a maximum storage size of 0.  
CB_ERROR_INCORRECT_CHANNEL if the Chat Message was attempted to be placed in an incorrect CBTextWindowData.  (Likely an internal ChatBlade error).  
CB_SUCCESS
 
int  CBChatHandler::AddMessageSpecialPower( CBSTRING sText,
int nChannelID = CB_CHANNEL_COMBAT_POWER)
Comments:
Helper Function used to display Text related to using special Powers such as Casting Spells, using Nano, or performing Special Abilities of a Characters Class.  
Game Developers can call this function to display Special Power related spam, such as "Xynelle begins to cast Rescron 1", or "You Shield Bash the Yagami, Temporarily stunning it".  
The Message is local to the Client only and does not go out over the Network.  
Parameters:
sText
    The Text to Display.  
nChannelID = CB_CHANNEL_COMBAT_POWER
    The ChannelID to display the Chat Message on.  Defaults to CB_CHANNEL_COMBAT_POWER.  
Returns:
CB_ERROR_MESSAGE_IGNORED if "CBNONE" on the Ignore List.  
CB_ERROR_CHANNEL_SIZE_ZERO if the last CBTextWindowData instance that cares about this message has a maximum storage size of 0.  
CB_ERROR_INCORRECT_CHANNEL if the Chat Message was attempted to be placed in an incorrect CBTextWindowData.  (Likely an internal ChatBlade error).  
CB_SUCCESS
 
int  CBChatHandler::AddMessagePopUp( CBSTRING sText,
int nChannelID = CB_CHANNEL_POPUP)
Comments:
This function is designed to display a Pop-Up Chat Message that would temporarily display in the middle of the Players Screen.  
Game Developers can call this function to display Chat Messages which should be shown for a short duration.  
For Example:  If a Player Levels up the Game Developer may want to make that information big and bold and display "You have Gained a Level" in the middle of the screen for a few seconds.  DM type Text is also a good candidate for display in a Pop-Up area.  
The Pop-Up Channel (CB_CHANNEL_POPUP) is designed to support this.  
Game Developers would need to make a special, typically invisible, Text Area to display these messages and make sure that that Text Area is Monitoring Chat Messages on the CB_CHANNEL_POPUP ChannelID.  Other Channels could also be Monitored by this special window.  
It is up to the Game Developer whether or not to implement Pop-Up Message Display.  This function supplies ChatBlade support if they decide to do so.  
Parameters:
sText
    The Text to Display.  
nChannelID = CB_CHANNEL_POPUP
    The ChannelID to display the Chat Message on.  Defaults to CB_CHANNEL_POPUP.  
Returns:
CB_ERROR_MESSAGE_IGNORED if "CBNONE" on the Ignore List.  
CB_ERROR_CHANNEL_SIZE_ZERO if the last CBTextWindowData instance that cares about this message has a maximum storage size of 0.  
CB_ERROR_INCORRECT_CHANNEL if the Chat Message was attempted to be placed in an incorrect CBTextWindowData.  (Likely an internal ChatBlade error).  
CB_SUCCESS
 
int  CBChatHandler::AddMessageDebug( CBSTRING sText,
CBSTRING sContext = CB_EMPTY_STRING,
int nChannelID = CB_CHANNEL_DEBUG)
Comments:
This is a Developer Helper Function designed to display Debugging text via the Chat system.  
It is envisioned that Game Developers could use this function to Display Debug information as desired.  
A Context string can optionally be added on at the end of the Message.  
For Local display only.  Messages doe not go out over the wire.  
Parameters:
sText
    The Text to Display.  
sContext = CB_EMPTY_STRING ("")
    The optional Context to add to the Chat Debug Message.  
nChannelID = CB_CHANNEL_DEBUG
    The ChannelID to display the Chat Message on.  Defaults to CB_CHANNEL_DEBUG.  
Returns:
CB_ERROR_MESSAGE_IGNORED if "CBNONE" on the Ignore List.  
CB_ERROR_CHANNEL_SIZE_ZERO if the last CBTextWindowData instance that cares about this message has a maximum storage size of 0.  
CB_ERROR_INCORRECT_CHANNEL if the Chat Message was attempted to be placed in an incorrect CBTextWindowData.  (Likely an internal ChatBlade error).  
CB_SUCCESS
 
int  CBChatHandler::SendChatMessage( CBChatMessage cbChatMessage)
Comments:
Entry point to send a Chat Message over the wire to the Chat Server for Message dispersal.  
If the game needs to send a Chat Message (such as in response to the Player typing "/group Ready") this is the entry point to start sending that message to other Players.  
This function calls CBClientImplementation::SendChatMessage() so the message can be placed on the wire and sent to the Chat Server.  
Depending on the Games Network code, it is up to the Game Developers to implement CBClientImplementation::SendChatMessage().  ChatBlade ships with sample network code, but it is expected that Each game may utilize a different back end.  
Parameters:
cbChatMessage
    The Message to be sent to other players.  For Example:  a Group, Guild, or Auction Chat Message.  
Returns:
Whatever CBClientImplementation::SendChatMessage() returns.  
 
int  CBChatHandler::SetVerbosityLevel( int nVerbosityLevel)
Comments:
Function which can be called to Change the formatting of Chat Messages.  
ChatBlade currently supports two types of Chat Formatting, Concise and Verbose.  
Players can change how their Chat is displayed with the /verbose command.  
For Example:  
  Concise:  
    [Group] You: Lets hunt in Vortopolis.  
    [Say] Happy, Elvish, You, "Anyone want some Lambas?"  
  Verbose:  
    You Tell the Group: Lets hunt in Vortopolis.  
    You Say Happily in Elvish, "Anyone want some Lambas?"  
This function provides an easily accessible entry point to change the Verbosity of Chat Messages.  
If there is a UI toggle to allow the Players to choose Message format, Developers should call this function based on what the Player chose in such a UI.  
The Verbosity setting is a Global setting and not on a per-message basis.  
Parameters:
nVerbosityLevel
    Should be either CB_VERBOSITY_CONCISE or CB_VERBOSITY_VERBOSE.  
Returns:
CB_SUCCESS
 
int  CBChatHandler::SetMood( int nMoodID)
Comments:
Function which can be called to Change the Mood of new Chat Messages generated by the Player.
New Chat Messages typed in by the user shall have the specified mood.  
This function is designed as a helper function in order to facilitate changing the Mood via a game supplied GUI dialog.  After the user chooses a new Mood this function can be called to set that mood.  
The supplied nMoodID should be one of the MoodIDs supported by ChatBlade such as CB_MOOD_HAPPY.  
ChatBlade stores the current Mood in CBData::nCurrentMoodID.  
Players can also change the mood with the /mood Slash Command.  
Parameters:
nMoodID
    The MoodID of the Characters new Mood.  Examples include  CB_MOOD_FRIENDLY and CB_MOOD_POLITE.
Returns:
CB_SUCCESS
 
int  CBChatHandler::SetLanguage( int nLanguageID)
Comments:
Function which can be called to Change the in game fantasy Language of new Chat Messages generated by the Player.
New Chat Messages typed in by the user shall have the specified Language.  
Acceptable Language IDs might include CB_LANGUAGE_ELVISH, or CB_LANGUAGE_HUMAN.  This function does not set a Players real world Language use (no Mandarin or Swedish).  
This function is designed as a helper function in order to facilitate changing the current Language via a game supplied GUI dialog.  After the user chooses a new Language this function can be called to set that Language.  
No verification check is performed by this function to ensure that the Character is Fluent in the specified Language.  The game should make sure the Character can speak the Language before invoking this function.  
ChatBlade stores the current Language in CBData::nCurrentLanguageID.  
Players can also change the Language with the /language Slash Command.  
Parameters:
nLanguageID
    The LanguageID of the Characters new Language.  Examples include  CB_LANGUAGE_ELVISH and CB_LANGUAGE_ORCISH.
Returns:
CB_SUCCESS
 
int  CBChatHandler::SetChatFilterEnabled( int bEnableFilterFlag = CB_TRUE)
Comments:
Function which can be called to Enable or Disable the Chat Filter.  
When the Chat Filter is Enabled, offensive Chat text shall be replaced with #@$!% style text.   
Pass in CB_TRUE to Enable the Chat Filter and CB_FALSE to disable the Chat Filtering.   
This function is designed as a helper function in order to facilitate setting the Chat Filter state in response to a User specifying the Chat Filtering in a GUI Dialog.    
Players may also Enable or Disable the Chat Filter by using the /filter Slash Command.   
Parameters:
bEnableFilterFlag 
    Flag which determines whether to Enable or Disable the Chat Filter.  CB_TRUE indicates the Chat Filter should be Enabled, and CB_FALSE indicates it should be Disabled.  Defaults to CB_TRUE.  
Returns:
CB_SUCCESS
 
int  CBChatHandler::SetSpamFilterEnabled( int bEnableFilterFlag = CB_TRUE)
Comments:
Function which can be called to Enable or Disable the Spam Filter.  
When the Spam Filter is Enabled, Chat Messages containing strings found in the Spam Filter are discarded.    
Pass in CB_TRUE to Enable the Spam Filter and CB_FALSE to disable Spam Filtering.   
This function is designed as a helper function in order to facilitate setting the Spam Filter state in response to a User specifying the Spam Filtering in a GUI Dialog.    
Players may also Enable or Disable the Spam Filter by using the /blockspam and /unblockspam Slash Commands.   
Parameters:
bEnableFilterFlag 
    Flag which determines whether to Enable or Disable the Spam Filter.  CB_TRUE indicates the Spam Filter should be Enabled, and CB_FALSE indicates it should be Disabled.  Defaults to CB_TRUE.  
Returns:
CB_SUCCESS
 
int  CBChatHandler::SetReplacementFilterEnabled( int bEnableFilterFlag = CB_TRUE)
Comments:
Function which can be called to Enable or Disable the Replacement Filter.  
When the Replacement Filter is Enabled, Chat Messages containing strings found in the Replacement Filter have those phrases Replaced with their replacement values.    
Pass in CB_TRUE to Enable the Replacement Filter and CB_FALSE to disable Replacement Filtering.   
This function is designed as a helper function in order to facilitate setting the Replacement Filter state in response to a User toggling the Replacement Filtering in a GUI Dialog.    
Players may also Enable or Disable the Replacement Filter by using the /EnableRPFilter and /DisableRPFilter Slash Commands.   
Parameters:
bEnableFilterFlag 
    Flag which determines whether to Enable or Disable the Replacement Filter.  CB_TRUE indicates the Replacement Filter should be Enabled, and CB_FALSE indicates it should be Disabled.  Defaults to CB_TRUE.  
Returns:
CB_SUCCESS
 
int  CBChatHandler::IsDisplayableChatMessage( CBChatMessage cbChatMessage)
Comments:
Function which determines if the Chat Message should be displayed.  
This function returns CB_TRUE if the Chat Message should be displayed and CB_FALSE if it should not.  
Chat Messages from a Sender on the Ignore List should not be displayed.  
For Games which support Player Factions, Chat Messages from Players on an opposing Faction typically should not be displayed.  
Chat Messages containing text found in the Spam Filter should not be displayed.  
Chat Messages on official Chat Channels should always be displayed, regardless of if the Chat is Spam, the Sender is Ignored, or the sender is from an opposing Faction.  Players should not be able to Ignore messages from Customer Service Representatives.  
This function does not guarantee that the Player has a Text Window that is set up to accept the Chat Message.  It is designed to allow ChatBlade to filter out Ignored Players and Chat from opposing Factions, while always allowing messages on Official Chat Channels to get through.  
Called by AddMessageToTextWindowDatas()
Parameters:
cbChatMessage
    A Chat Message for which we want to determine the displayability.    
Returns:
CB_FALSE if the Chat Message is from an Ignored Sender or an Opposing FactionID.  
CB_TRUE if the Chat Message may be displayed.  
 
 

 

 

 

ChatBlade Copyright © Flex Dolphynn