Jump to content
  • 0

[Patch] Command Help


Kusarigama

Question

Trying to make a give exp command, but not experienced in C++ enough to piece it together properly...

I was trying

bool ChatHandler::HandleModifyExpCommand(char *args);
{
   if (!*args)
       return false;
   Player *player = getSelecterPlayer();

   If (!player)
   {
       PSendSysMessage(LANG_PLAYER_NOT_FOUND);
       SetSentErrorMessage(true);
       return false;
   }
}

Then from that making it so that the grabbed the current exp from PlayerInfo then did current exp = current exp + chat_str_exp... Not the correct syntax's but the idea should be the same...

Been stopped by a visual studio error, saying i cant redeclare the handle outside its class...

Could someone help me add this player exp add part? >.<

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

Disclaimer: I'm just learning C++, so please forgive my inability to give you complete code. However, I have studied the MaNGOS source and am familiar with some of its structure.

To get an idea of how xp and leveling is handled, have a look inside Player.cpp. I would point you in particular to the void Player: :GiveXP module, starting around line 2420 or thereabouts. Around line 2440, you'll see the functions for finding a player's xp and adding to it under SendLogXPGain.

The rest would consist of implementing the command in Chat.cpp and Level3.cpp, plus an appropriate SQL statement to patch the database in the command table of the world db. The SQL would be saved as mangos_command.sql when providing the update for the database.

I hope this will provide useful clues on how to proceed. Beyond that, I can only hope one of our resident code geniuses will offer more detailed advice.

Link to comment
Share on other sites

He is trying to add a gm command, modify exp, that will allow you to give any amount of experience points to a player's character, LilleCarl.

Honestly, I thought such a command already existed in the core for quite some time. I was very surprised to find there is no such feature.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use