Okay, From the start here i want to say for all of you who have no idea what i mean when i list these words: C++, uint32, Chat.cpp, Visual Studio 2008. Please leave if you are a total C++ n00b. Adding commands is basic, making them do anything is harder.
#####Table of Contents#####
- Intro
- Step 1: Making sure you have the source and opening the proper files
- Step 2: Adding Directives to Chat.h
- Step 3: Adding Directives to Chat.cpp
- Step 4: Adding Directives to Levelx.cpp
- Step 5: Testing it out and seeing it work.
##### INTRO #####
In this guide, i will show you how to add custom GM commands. When i say custom i mean it will be .<yourcommand> etc. etc. THIS GUIDE IS FOR ASPIRE HS, OTHER EMUS USE A DIFFERENT C++ MODE, THIS WILL NOT WORK FOR ARCEMU!!!!!!! Adding the command to the core is simple. For the this tutorial we will add a command called .uber. This command will level you to 80, make you a cool looking etheral and forst blast the whole area as sort of a SUPER-NORTHREND-LEVEL EFFECT!
##### STEP 1: Making sure you have the source and opening the proper files #####
1. Open to your source folder and navigate to /win/
2. open hearthstone2008 or whatever.
3. Once in there expand the project hearthstone-world, and then expand the folder "Chat" it should be the third one down.
4. Open chat.h, chat.cpp, and Level3.cpp.
If you havent downloaded the source yet go search "Compiling Hearthstone" on MMOwned and find a good guide. YOU CANT DO THIS W/ A REPACK!.
Now you can move on to step 2!!!
##### STEP 2: ADDING DIRECTIVES TO CHAT.H #####
1. Press Ctrl+F and tell it to look for this:
Code:
bool HandlePlayerInfo(const char* args, WorldSession * m_session);
2. Once you have found it copy it and then paste it on the next blank line.
3. once you have pasted it, Change PlayerInfo to UberCommand.
4. You are all done here! If it lloks like this:
Move on to step 3!
##### STEP 3: ADDING DIRECTIVES TO CHAT.CPP #####
1. Find this
Code:
{ "clearbones", 'm', &ChatHandler::HandleClearBonesCommand, "", NULL, 0, 0, 0 },
add another extra line after that and paste in this:
Code:
{ "uber", 'm', &ChatHandler::HandleUberCommand, ".uber A Custom GM command unique to this server!", NULL, 0, 0, 0 },
2. If it looks like this then you are good.
3. continue to step 4
##### STEP 4: ADDING DIRECTIVES TO LEVEL3.CPP ####
Just a quick not, it doesnt have to be level3.cpp it can be any level, i just made this code to only work on level3.cpp.
1. go to the bottom of the file, and then add 1 extra line.
2. copy and paste this:
Code:
bool ChatHandler::HandleUberCommand(const char* args, WorldSession * m_session)
{
PlayerPointer plr = m_session->GetPlayer();
SpellEntry * info = dbcSpell.LookupEntry(28524);
SpellPointer Frosty(new Spell(plr, info, true, NULLAURA));
LevelInfo* Info = objmgr.GetLevelInfo(plr->getRace(), plr->getClass(), 80);
plr->CastSpell(Frosty);
plr->ApplyLevelInfo( Info, 80 );
plr->ModUnsigned32Value( UNIT_FIELD_DISPLAYID, 21078);
BlueSystemMessageToPlr( plr, "I leveled you to 80 and morphed you with a custom GM command!");
return true;
}
3. It should look like this:
4. NOw move on to step 5.
##### STEP 5: TESTING IT OUT! #####
1. Compile the core, you shouldn't get any errors.
2. take your new .exe files and put them in your server folder.
3. Login to wow, type in .uber when targeting yourself or someone else and it should work!
Well, for now im all done, but post any problems / concerns in this thread and i will try to answer them !
Cheers,
Insignia96
Arcemu Addition (credit mager1794!):
In Step 3
Instead of finding
Code:
{ "clearbones", 'm', &ChatHandler::HandleClearBonesCommand, "", NULL, 0, 0, 0 },
put this
Code:
{ "triggerpass", 'm', &ChatHandler::HandleTriggerpassCheatCommand, "Ignores area trigger prerequisites.", NULL, 0, 0, 0 },
And then
In step 4
Instead of
Code:
bool ChatHandler::HandleUberCommand(const char* args, WorldSession * m_session)
{
PlayerPointer plr = m_session->GetPlayer();
SpellEntry * info = dbcSpell.LookupEntry(28524);
SpellPointer Frosty(new Spell(plr, info, true, NULLAURA));
LevelInfo* Info = objmgr.GetLevelInfo(plr->getRace(), plr->getClass(), 80);
plr->CastSpell(Frosty);
plr->ApplyLevelInfo( Info, 80 );
plr->ModUnsigned32Value( UNIT_FIELD_DISPLAYID, 21078);
BlueSystemMessageToPlr( plr, "I leveled you to 80 and morphed you with a custom GM command!");
return true;
}
Place this
Code:
bool ChatHandler::HandleUberCommand(const char* args, WorldSession * m_session)
{
Player * plr = m_session->GetPlayer();
SpellEntry * info = dbcSpell.LookupEntry(28524);
LevelInfo* Info = objmgr.GetLevelInfo(plr->getRace(), plr->getClass(), 80);
plr->CastSpell(plr,info,true);
plr->ApplyLevelInfo( Info, 80 );
plr->ModUnsigned32Value(UNIT_FIELD_DISPLAYID, 21078);
sChatHandler.BlueSystemMessageToPlr(plr, "I leveled you to 80 and morphed you with a custom GM command!");
return true;
}
Remeber i didn't make this mager1794 did for all u arcemu users out there!