*******************************
**For this tutorial, you need...
**Visual C++
**C++ Knowledge
**To know how to compile ArcEmu
*******************************
*******************************
**All credits for this tutorial go to:
**DrakeFish
**I figured how to do this my myself
*******************************
First of all, you need to know what you want to do with this. If you don't have any idea of custom configurations, this tutorial may be useless to you.
First Step: The .conf File
I will start by the main thing, the .conf files. For this tutorial, I'm adding options to the arcemu-optional.conf file. To add a new configuration to it, just use this form:
Code:
<Category Option = "Value"
Option = "Value"
Option = "Value">
Category: Your category name(for example: MessagesOptions).
Option: This is your Option name(for example: MessageColor).
Value: This is your option value
Second Step: Making the Configuration a Function
The next step is where it gets harder to understand. You will need to go in the World.cpp file of your ArcEmu source. Search for AnnounceColorChooser using the find option. When you find it, make 2 line under it. this place will contain your new configurations.
Now you have to choose what will be the name of your configuration function(I take Example_One as example).
Now use this form for every Configurations:
Code:
Example_One = Config.OptionalConfig.GetStringDefault("Category", "Option", "Value");
Example_One: The function name(will be used later)
String: If your value is going to be a text, use String. If your value is going to be True/False(1/0), use Bool.
Category:This is the category that you used in your .conf file.
Option: This is the option name that you used in .conf file.
Value: This is your default value(if theres nothing entered in the .conf file.) If you use Bool, this will be True or False(But in the .conf file, use 1 for true and 0 for false.
Third Step: Including The Function
The next step is to include the function to World.h(This is important because if you don't do it your Options won't work). Open World.h, search for "void AnnounceColorChooser" (Without ""), and again, make 2 line under it.
If your Value is going to be True/False(1/0), use this form:
If your Value is going to be a text, use this form:
Code:
std::string Example_One;
Example_One: This is the function name used in the Second Step.
Fourth Step: Using the Function
Now that your done with the making of the configuration, you will see how to use it.
My first example is changing the message whispered to the player when they write to a gm that has ".gm on" activated and allowing or not this message to be sent.
My functions names are: GmOnMessageAllow and GmOnMessage
Search for "This Game Master does not" (without the "") And now you should see this:
Code:
if(!_player->GetSession()->GetPermissionCount() && player->bGMTagOn && player->gmTargets.count(_player) == 0)
{
// Build automated reply
string Reply = "This Game Master does not currently have an open ticket from you and did not receive your whisper. Please submit a new GM Ticket request if you need to speak to a GM. This is an automatic message.";
data = sChatHandler.FillMessageData( CHAT_MSG_WHISPER, LANG_UNIVERSAL, Reply.c_str(), player->GetGUID(), 3);
SendPacket(data);
delete data;
break;
}
And I'm changing it for :
Code:
if(!_player->GetSession()->GetPermissionCount() && player->bGMTagOn && player->gmTargets.count(_player) == 0)
{
// Build automated reply
if ( sWorld.GmOnMessageAllow )
{
string Reply = sWorld.GmOnMessage;
data = sChatHandler.FillMessageData( CHAT_MSG_WHISPER, LANG_UNIVERSAL, Reply.c_str(), player->GetGUID(), 3);
SendPacket(data);
delete data;
break;
}
}
GmOnMessageAllow: This is the function name, the function needs to be a Bool one for this.
GmOnMessage: This is the function name, the function needs to be a String one for this.
More Information About Functions and Values
What's a Bool and what's a String?
A bool is a True or False value that will be shown in the .conf file as 1(for true) and 0(for false). This one is mostly used to allow or disallow something.
A string is a text value that can contain any characters like ABC,123, dots, and such(but can't contain "). The MOTD is a good example of one. This is mostly used to show some text in a script. Using it as .conf file will make it easier to be changed instead of editing and compiling the whole script again.
Some of my related tutorials
Broadcast when a GM logins
------------------------------------------------------
-This tutorial is updated to show you more tips-
------------------------------------------------------