Rest State HP and MP Bonus
I don't have a chance today to check and see if this works in game, but if someone could look over the following code and see if it looks okay. There are two parts to this. One is for mobs, and the other is for players.
Main thing I am worried about is that I put things under the wrong classes/functions, as I don't know the code that well yet. CLIENT CODE Under Class Client in client.h, Code:
ADD Under Class Client Constructor in client.cpp Code:
ADD Under Class Client in client_process.cpp Code:
ADD END CLIENT STUFF STARTING NPC/MOB STUFF ------------------------------------- Under Class Mob : Public Entity in mob.h, Code:
ADD Under Mob::Mob Constructor in mob.cpp, Code:
ADD Under NPC::Process in npc.cpp, Code:
REPLACE |
Ok, I got the code working for clients, and it is tested and working.
I decided to add it to the rules set so that the regen % amount and time it takes before the rest counter starts is editable. I will upload it to the SVN here shortly. |
If you are going to put that on the SVN, you might want to set a rule to allow/disable it or adjust rates if needed. Just a suggestion anyway.
|
Quote:
RestRegenPercent <--- Sets a percent for extra recovery RestRegenTimeToActivate <---- Sets the wait timer before the recovery period begins I've already hard coded them into the rules file. I'm just fixing one last bug before I upload |
So, to disable it, I am guessing you can just set those rules to -1 or something?
Code:
RestRegenPercent <--- Sets a percent for extra recovery |
Quote:
|
Also, just a question; Are you removing the current Out of Combat Regen functionality? Currently, there is already a rule for NPCs to regen when they are out of combat.
If you are removing the current rule for it, you might want to make separate rules for players and NPCs. Also, if you are removing the current rule for NPC OOC Regen, please submit the SQL to remove the rule from the rule_values table and add in the new ones you are making. Sorry, to be bugging you about this. I don't know who you are, and I know the number of people with direct access to update the SVN is very limited, so I am just not sure how familiar you are with the process. I am familiar with all of the people who have access to make commits to the SVN, so maybe you are one of them using another forum account? If you aren't one of them, then you won't be able to commit the code yourself. |
Quote:
And as for the SVN, cavedude gave me access earlier today. This is my only forum account, but I've been on/off since 2002. Don't worry, I won't break the code, :]; |
Ok, so maybe he didn't give me access, :D, so here is a diff file I guess.
Code:
Index: common/ruletypes.h |
For those of you that actually need it, here is the sql query for the database if you aren't using the default values. Change as needed. Sorry I didn't get it up last night, was dead tired.
Code:
INSERT INTO rule_values VALUES(1,'Character:RestRegenPercent',20); |
Thanks for the SQL makes me job a tiny bit easier. Quick question, does this effect the regen players already have when meditating if the RestRegenPercent rule is set to 0? I just want to make sure this can be disabled without reducing regen to 0 :)
|
Perhaps I should read the code and test it out before asking questions. This works perfectly, and doesn't effect natural regen if set to 0. I am going to make that the default, however so this system is optional and Server Ops don't complain that regen is way too high ;) I'll get this into SVN with my next batch. Thank you!
|
Thanks cavedude, :D
On my own server, I wrote extra code in that checks for guild pvp targets in range. I'm trying to think of a good way to do that for an entire pvp server though. I'm not sure if the PVP on flag in the database means that anyone can attack anyone period or not. |
I've made a few changes to this (I hope you don't mind), primarily because I wanted to tie it in with the SoF rest state indicator that I found the opcode for, because I wanted it to work a bit more like live currently does, and to make it a bit more efficient.
Functionally, the changes are: * Default RestRegenPercent to 0 * RestRegenTimeToActivate now specified in seconds rather than milliseconds. (This is because I needed to convert it to seconds for the SoF packet). * Client must be sitting and not have a detrimental spell on them for rest state regen to kick-in. * SoF clients get the combat/rest symbol and timer. Still works in Titanium, but with no indicators. Codewise, rather than checking in every call to Client::Process whether the client has aggro, I added a 'HaveAggro' member to the client class which is set true whenever the client gets added to a mob's hate list. When a mob's hate list is wiped (dies or is memblurred), then any client on that mob's hate checks to see if it has aggro from any other mob, and if not, starts the rest state timer. I'll commit it later on today. Thanks for the contribution. |
Thanks Derision, I don't mind the changes, just as long as you didn't have to go a long way out of your way to fix anything.
|
All times are GMT -4. The time now is 03:35 AM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.