Custom GM command /xpboost

PEKEDEY

Member
I'm working in the source (if this is posted in the wrong place please direct me where to go), and I've designed my own custom GM Commands. I've made one called /xpBoost multiplier which multiplies the exp earned by multiplier (default is 1).

The command works by modifying line 8694 in the ship_server to
"XP = l->mapData[mid].exp * EXPERIENCE_RATE * BOOST"
and BOOST is set by the /xpBoost command.

The command works, BUT I'd like to update the floating xp text that occurs when the monster dies. I can't seem to find this to affect the change. Any help would be hot.

I know that I can change the EXPERIENCE_RATE modifier in the ini file, but I'd like to be able to modify this on the fly.
 

Sodaboy

Administrator
Staff member
You should see this twice in the code:

Code:
                    client->encryptbuf[0x08] = 0xDD;
                    client->encryptbuf[0x09] = 0x03;
                    client->encryptbuf[0x0A] = (unsigned char) EXPERIENCE_RATE;

Change the 3rd line to:

Code:
client->encryptbuf[0x0A] = (unsigned char) EXPERIENCE_RATE * BOOST;

Remember to change it both places in the code.
 

Soly

Member
The exp rate is sent to the clients when they create or join a room.
You have to send the multiplier in that packet.
Because of this you might want to not change the awarded exp unless they have received the multiplier (you could use the multiplier per room or even per client).

Edit:
The fastest finger of the west... something is not right with that...
Gave you direct guidance, I was about to open visual studio.
Also you can not send *0 as exp, the client will still see at least *1.
 

PEKEDEY

Member
Wow that was quick, guys! Thanks!

Sodaboy's solution worked; now I just need to build a test for the packet --not a difficult task.
 

Soly

Member
Test?
Just log in kill stuff, if the numbers are multiplied by the rate you set, good to go xD
 

PEKEDEY

Member
Haha! I meant test for whether the client had received the encryptbuf[0x0A] packet so as to only actually multiply the exp if the packet has been received.
 

Soly

Member
You don't need to test that. I think you can't anyway.
This is what I did.
As a note, all the uses of BANANA is like this
Code:
BANANA* client;
...
client->var
Have a new variable in BANANA, I'll call it expboost, have it initialize to the ship's exp boost (I'd do this if you intend to use the variable per client, as I did).
When the player makes or joins a room, you send the exp multiplier and adjust BANANA->expboost to the same value.

Then to award exp you use
Code:
XP = l->mapData[mid].exp * BANANA->expboost
Since you adjust the client exp on making or joining a room, the awarding of exp will be in sync always.

Also, with your original snippet
Code:
XP = l->mapData[mid].exp * EXPERIENCE_RATE * BOOST
If EXPERIENCE_RATE is > 1, and you apply a boost by the command, you will be doing quite some boost. at least 2 * 2 which would be x4 instead of the x2 you intended with the command.
 

PEKEDEY

Member
Yeah, I get that it could have MASS EFFECT on the rate if the base rate is already boosted. Fortunately I'm currently the only GM (and player, for that matter) on my server while I develop it, the base rate is 1, and I've added logic to stop the boost from being more than 5x.

Thanks for the help. This command is working fabulously now.

Right now I'm creating a library of custom GM commands that I'll distribute to the forums once I have more than 1 or 2. Would you recommend putting this in the tools section? It's kind of like a tool... kind of.
 

Soly

Member
Well... idk how that library would work... you can always make a topic and see how it goes.
I'd rather distribute the code and/or instructions for each specific command tho.

I have coded quite a few, for example:
-Check material count (gm can check other players')
-Add materials (based on other code, gm)
-Add techs (based on other code, gm)
-Change section ID (gm)
-Find a player based on Guildcard
-See Section ID, Guildcard and Name of people in the room
-Select your own XP rate between 1 and the maximum allowed by the server (some people asked me they wanted to play with rate 1 instead of whatever the server had boosted so might as well do it this way).
And it goes on.

From the list, pretty much only the exp one requires changes outside of the Function-Packet for the "commands" and because of that some it might not fit your library.
 
Top