Go Back   EQEmulator Home > EQEmulator Forums > Development > Development: Custom Code

Development: Custom Code This is for code thatdoes not emulate live and wont be added to the official code.

Reply
 
Thread Tools Display Modes
  #1  
Old 10-14-2015, 11:12 PM
Cilraaz
Sarnak
 
Join Date: Mar 2010
Posts: 77
Default Disable Exp Gains

For one reason or another, you may wish to disable exp gains on a character by character basis. If so, feel free to use this code to do so. Changes should be added to the beginning of the Client::AddEXP function in zone/exp.cpp:

Code:
std::string query = StringFormat("SELECT value FROM quest_globals WHERE charid='%i' AND name='Halt_Exp_Gains_Toggle'", this->CharacterID());
        auto results = database.QueryDatabase(query);
        if(results.Success()) {
                auto row = results.begin();
		char* ExpOff = row[0];
                int8 ExpFlag = atoi(ExpOff);
                if (ExpFlag == 1)
                        return;
        }
This makes use of a quest global flag named "Halt_Exp_Gains_Toggle", which would need to be set via a quest (or as simply as talking to an NPC). For example, I tested this via adding the below to Seer Mal Nae-Shi's perl script in PoK:

Code:
if($text=~/experience/i) {
                quest::say("Greetings, $name.  This is a test script. Do you want to [check your experience flag] or [toggle your experience flag]?");
                }

if($text=~/check my exp/i) {
        if(defined $qglobals{Halt_Exp_Gains_Toggle}) {
                if($qglobals{Halt_Exp_Gains_Toggle} == 1) {
                        $expflag = "disabled";
                } else {
                        $expflag = "enabled";
                }
        } else {
                $expflag = "enabled";
        }

        quest::say("Well, $name, your ability to gain experience appears to be $expflag");
}

if($text=~/toggle my exp/i) {
        quest::say("Are you sure you [want to toggle] your experience flag?");
}

if($text=~/want to toggle/i) {
        if(defined $qglobals{Halt_Exp_Gains_Toggle}) {
                if($qglobals{Halt_Exp_Gains_Toggle} == 1) {
                        quest::setglobal("Halt_Exp_Gains_Toggle", 0, 5, "F");
                        $expflag = "enabled";
                } else {
                        quest::setglobal("Halt_Exp_Gains_Toggle", 1, 5, "F");
                        $expflag = "disabled";
                }
        } else {
                quest::setglobal("Halt_Exp_Gains_Toggle", 1, 5, "F");
                $expflag = "disabled";
        }

        quest::say("Your ability to gain experience is now $expflag. If you wish to alter this status, please talk to me again.");
}
Of course the quest portion could be modified in any way you'd like. Have fun with it!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 04:29 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3