ChatBlade How To Documentation
How To Add a new Chat Channel to ChatBlade

Related ChatBlade Classes and functions:  
    CBConstants.h
    CBTextWindowData
    CBChatMessage
    CBSlashCommands

 
Summary:  
  Jump to section   Add a new #define representing the Chat Channel ID to CBConstants.h.  
  Jump to section Add the Chat Channel to the appropriate AddChannelXXX() functions of CBTextWindowData.  
  Jump to section Add the Chat Channel as an entry in the switch statement of CBChatMessage::GetChannelSourceStringBeginning().  
  Jump to section If Chat Messages on the new Chat Channel should have quotes displayed add the Chat Channel to CBChatMessage::BoundMessageText().  
  Jump to section If the new Chat Channel needs a Slash Command to invoke it, implement the Slash Command.  
  Jump to section Modify any Developer components such as GUI Dialogs or the back end Chat Server to handle the new Chat Channel type.  
 

 
Details:  
 
Add a new #define representing the Chat Channel ID to CBConstants.h.  
     Find the Chat Channel ID section of CBConstants.h.  
Add in the new #define for the desired Chat Channel.  
Sample Code:  
 
Add the Chat Channel to the appropriate AddChannelXXX() functions of CBTextWindowData.  
     Examine the various AddChannelXXX() functions of CBTextWindowData.  
Determine which functions the new Chat Channel should be added to.  
Add the new Chat Channel ID to the appropriate function such as CBTextWindowData::AddBaseChannelIDs() or CBTextWindowData::AddCombatMeleeChannelIDs().  
Sample Code:  
 
Add the Chat Channel as an entry in the switch statement of CBChatMessage::GetChannelSourceStringBeginning().  
     Determine how Chat Messages on the new Chat Channel should be displayed, both for Verbose and Concise Chat Formatting.  
Examine the code in CBChatMessage::GetChannelSourceStringBeginning().  
Add the new Chat Channel ID as a case in the Switch statement and implement the appropriate Chat Formatting desired.  
Sample Code:  
 
Bound spoken style Chat Channels with displayed quotes.   
     If messages on the new Chat Channel are of a spoken variety they might look better if the messages were surrounded by Quotations ("").  
If so add the new Chat Channel ID to the code of the CBChatMessage::BoundMessageText() function.  
Sample Code:  
 
If the new Chat Channel needs a Slash Command to invoke it, implement the Slash Command.   
     If the new Chat Channel allows the Player to send messages on it, it may need a Slash Command to invoke it and the appropriate Slash Command Functionality.  
Create the Slash Command function in CBSlashCommands, and add a Command Map that shall invoke that function in CBClientImplementation::LoadSlashCommands().  
See How To Add a New Slash Command for details.  
See How To Add a New Slash Command for Sample Code:  
 
Modify Developer components to handle the new Chat Channel.  
     If the Game shall allow the Player to assign the new Chat Channel to various Text Windows any GUI Mechanism to do so shall need to be modified to accommodate the new Chat Channel.  
The Chat Server on the back end may need to modified to handle the new Chat Channel if its messages go over the wire.  
No Sample Code provided:  
 

 

Code Samples:  

Adding Defines for 2 new Chat Channels representing Town Chat and stored Mail to be delivered when the Character Logs on.  
Add the following entries to CBConstants.h.  
     //  Chat Channel representing Chatter limited to the local Town the Character is in
#define CB_CHANNEL_TOWN                  301
//  Chat Mail delivered whenever the target Character logs on
#define CB_CHANNEL_MAIL                  302
 
Adding our 2 new Chat Channels to the appropriate entries in CBTextWindowData members.  
Add the 2 channels to the code in CBTextWindowData::AddBaseChannelIDs().  
     AddChannelID(CB_CHANNEL_TOWN);
AddChannelID(CB_CHANNEL_MAIL);
 
Adding the 2 new Chat Channels to CBChatMessage::GetChannelSourceStringBeginning().  
//  Town Chat
//  The name of the Town is stored in the Chat Message Destination
case CB_CHANNEL_TOWN:
     switch(m_nVerbosityLevel)
{
case CB_VERBOSITY_VERBOSE:
case CB_VERBOSITY_CONCISE:
default:
     sChatBeginning.append(CB_STRING_LEFT_BRACKET).append(sDestination).append(CB_STRING_RIGHT_BRACKET).append(CB_STRING_SPACE);
sChatBeginning.append(sSourceString).append(CB_STRING_CHAT_PREFIX);
break;
}
break;
 
//  Chat Mail
//  The name of the Sender is stored as the Chat Message Source
case CB_CHANNEL_MAIL:
     switch(m_nVerbosityLevel)
{
case CB_VERBOSITY_VERBOSE:
case CB_VERBOSITY_CONCISE:
default:
     sChatBeginning += sSourceString;
if(nMoodID != CB_MOOD_NONE)
     {
sChatBeginning.append(sMoodAdverbString).append(CB_STRING_SPACE);
}
sChatBeginning += CB_STRING_MAIL;  //  Where CB_STRING_MAIL = "Mail"
// Add an s at the end
if(bIsSourceYou != CB_TRUE)
     {
sChatBeginning += CB_STRING_S;
}
sChatBeginning += CB_STRING_SPACE;
sChatBeginning += sDestinationString;
if(nLanguageID != CB_LANGUAGE_NONE)
     {
sChatBeginning.append(CB_STRING_IN_SPACE).append(sLanguageString).append(CB_STRING_SPACE);
}
sChatBeginning += CB_STRING_CHAT_PREFIX;
break;
}
break;
 
Adding CB_CHANNEL_MAIL to the Chat Channels which should be surrounded in Quotes.  
Add the case to CBChatMessage::BoundMessageText();
     case CB_CHANNEL_MAIL:
 
    

 

 

 

 

 

 
 
 
 
ChatBlade Copyright Flex Dolphynn