Acceptable/efficient syntax
I made a small change to remove max lvl 1 starting skills in client.cpp.
It appears to work after logging in but, I want to be certain the syntax is correct and if it could be done better. My comments inside: Code:
void Client::SetClassStartingSkills(PlayerProfile_Struct *pp) EDIT: I notice the client shows skills with values > 0 but the DB does not. I suppose the addition of quite a few more lines of code will be needed to account for the removal of the segment above to make accurate. If this doesn't belong here please move it, thanks. |
The client will often display hard-coded level 1 starting stats no matter what you code into the server and enter into the database. I haven't tested to see if it corrects to what the server tells it at level two.
I'd say the very easiest thing to do in that method would simply be to add a return statement after the very first opening brace. Hehe. Code:
void Client::SetClassStartingSkills(PlayerProfile_Struct *pp) |
Superb! Thank you.
I'll have to add something that states something along the lines of: set 1hb = 5 if class = a,b,c,d... and set 1hs = 5 if class = e,f.. I'll have to look at similar to see what the syntax would look like. Thanks again. |
In the C++ code they have a couple of shortcuts so you don't have to go by individual classes, too.
IsWarriorClass() returns true for WAR, ROG, MNK, PAL, SHD, RNG, BST, BER, BRD. GetArchectype() returns ARCHETYPE_MELEE, _CASTER, or _HYBRID depending on the class. If you aren't clear on who is and isn't a hybrid, you can see the full list in zone/mob.cpp around line 862. |
Grateful for that, thank you Shendare.
|
Likely, this would be easier done in Perl because it would be done as soon as the player logged in, rather than being handled by something that may or may not be hard-coded client-side, such as start skills and stuff like that.
|
Quote:
|
Quote:
|
Or a couple of rules.
Character:MaxSkillsOnCharCreate (true) Character:MaxSkillsOnLevelUp (false) |
Quote:
Note clients would still receive data as that's handled in another thread entirely. The point I was making is it'd be faster to make a method in C++ that you can call from Perl as opposed from looping in Perl. |
Below are the changes I made, it seems to work but, curious if everything looks right.
Also, I couldn't figure out how to do this using <GetArchectype>. If someone could throw me a bone, I'd appreciate it. Code:
void Client::SetClassStartingSkills(PlayerProfile_Struct *pp) Thanks |
Do you anticipate that you'll want to make changes on a per-class level later?
If not, you could group them together to clean it up a tad. Code:
void Client::SetClassStartingSkills(PlayerProfile_Struct *pp) |
Also, you're missing Beastlords. If that wasn't intended, they'd probably be grouped with Monks.
|
BST - oversight, thanks (and clarifying starting skill)
Quote:
I appreciate your help =) EDIT: I understand the implications of the corrections, for the most part. I am most thankful for that. |
Yes, Shendare's method is more efficient!
Switch statements essentially create a jump table entry (per case value) and code paths for each entry listed in the machine code. If no exit clause is specified, the code path will 'fall-through' every line of code until it reaches the default exit clause..meaning that every case between case entry and default exit will be processed as true. The fall-through behavior can be very useful for grouping like singular and progressive-compound methodologies..but, it can also be a trap if that behavior is not desired. |
Thanks Uleat.
I understand the concept but the vocab is still a little beyond me. I figured to add to this thread with a different snippet since the same question applies. It appears to work with 12 > SkillMeditate > 0 in game. Both #showstats and watching ticks are accurate although client mana# jumps around. Not sure when it normalizes but, a level 50 at max meditate (235) shows the ticks perfectly for a titanium client. Does this look right/could it be better? Comments within the code below: Code:
int32 Client::CalcBaseManaRegen() Thanks |
I mean is this new formula another guestimation? Since the client has its own idea of regen we should be able to pull the math from there I would think..
|
I have noticed client mana# jumping around on my titanium client for quite some time. I did not take note of it until a few months ago. This occurred at times on live when I played but, probably for different reasons. I never thought much of it.
Prior to making this change, I had changed rule_values regarding mana regen. I noticed mana regen was +2 standing and this was introduced well after classic and possibly after Titanium was relesed, I don't recall. I wanted to fix this so, I changed the rule_values associated with mana regen. This change was not perfect. I knew I would need to alter the source at some point to actually fix it the way I wanted. As far as guestimating a new formula: This is partially why I posted this. If there is a more accurate formula for mana regen that was in use from classic to OoW or around there, I'd like to hear it. I played the most on live between SoL and DoN and I do not recall standing mana regen giving +2. In addition, I recall mana regen as a linear function of the meditate skill and never dependant on caster level during the time I played the most. I could be mistaken as I had no reason to actually create a formula. PS. Your sarcasm is not lost on me ;) |
Wasn't sarcasm honestly, I just think if you want things to work the client and server have to be matching on the functions. I know in the past we had some concerns that our timing of the regen packets and the frequency were possibly a problem.
|
False assumption.
There seems to be quite a few differences between clients. Titanium and others? having certain things hardcoded making customization more difficult. P99 codes for the same client and I have noticed a little mana# jumping there, as well. Again, I never thought of it much because "on tick" was the real amount, if off by a couple. This is very noticeable when medding for longer periods and watching HP regen. I'm sure many know what I am talking about. I'm curious to know how both of these, hp and mana, if different between client/server, could be detrimental. EDIT: hp and mana regen Thanks |
Using HP for example while sitting down, it seems the client gets its update and then tries to make another jump just a few second after which then the server corrects back downward. Client is also trying to give 6 hp per tick more than the server wants to in this scenario.
http://i.imgur.com/zVexaQ6.png |
Aye, this is what I noticed with mana regen but maybe the other way around. The client says +1 because it's titanium, and the server says, nu-uh +2 and adds 1. I was getting 1+1 mana regen on most ticks (always 2 per full tick).
This was the main reason for my fix. I figured to learn a bit and change manaregen to something I thought was more classic-y. |
yea id like to see it fixed also. Plus the scenario in which people fall unconscious before they lose all their HP... if you get hit serious enough you fall over for a moment until for whatever reason it lets you back up as if nothing happened.
|
That stopped happening to me after I recompiled on 7/29/15 and changed some rules. Unsure what it was exactly.
Before that, I would have very brief "double hits". Check out post #3 - 7 in the thread below. Unsure if it will work for you or if you have done this but, I was very pleased it went away. http://www.eqemulator.org/forums/showthread.php?t=39907 |
FYI, the HP and Mana jumping forward and then back to what it's supposed to be while regenerating? Happened on Live, too. For yeeeeears. Wouldn't be surprised if it still does.
|
Character:SoDClientUseSoDHPManaEnd, perchance?
That doesn't solve the entire issue..but, it may have been a rule you changed. I know that item scaling/stats is also an issue with some clients..but, I think demonstar55 did some work to fix that, or at least alleviate some of the problem. When the client tries to calculate regen bonuses based on item stats, they really need to be inline with what the client expects..not what the server is necessarily using. There's still a lot of tweaking that needs to be done in this area. |
Quote:
Quote:
|
I'm trying to replace the `CheckIncreaseSkill` equation in `zone\client.cpp( ~2268 )`. After a bit of testing, I found something that will only require changing one line. I don't like the coefficients for some skills. The solution I found mitigates a bit of my distaste for them.
To be replaced: Code:
int32 Chance = 10 + chancemodi + ((252 - skillval) / 20); Quote:
Code:
int32 Chance = 22 + (chancemodi * 1.5) + 1.5 * (-root (3, (((abs(15 + chancemodi))^1.1 * 0.4 + 1.75) * skillval))) http://prntscr.com/8kpm36 |
C'mon you programming wizards! With all the traffic today I can't imagine noone can throw me a bone!
Please tell me how to write - (cube root), absolute value and x^n in C++. |
|
Thanks. Knowing how to put them in the lines was my main concern (syntax).
I can reference the functions anytime I forget something, which is often. Regardless, I got it to work and according to the logsys, it's working as intended, just as the graph shows. EDIT: btw Uleat, that's the exact page I used to figure it out =) |
Never said it was pretty:
Code:
double param, result; |
I removed the Spellshield and the "cast on other" messages which appear when attacking an npc with a rune. The Spellshield message seemed correct but, the "cast on other" message displays the damage shield "cast on other" each time the npc hits the client. This only occurs if the client has a DS and the NPC has a rune. The "was pierced by thorns" message also appears, as normal.
My main concern is if the second line I commented out will affect anything else. I tested this by casting a rune on myself and having an npc attack and dispel the rune. It appears to work normal. I left larger spaces between lines to accentuate the lines I commented out. Code:
\zone\attack.cpp(3548 - 3571) Thanks |
It's been about a week since I started making changes to my server code. I'm very green in this aspect but, I learn quickly and understand concepts more than syntax. I also understand the implications of things. Not everything though!
I want to thank those that have given assistance if I haven't already. My question/issue at the bottom. I've added a few lines to <\zone\zonedb.cpp(3177)> and created a couple rules <\common\ruletypes.h(151) - RULE_CATEGORY(Pets)>. It works as I expected. Below is what I added: ruletypes.h Code:
RULE_BOOL(Pets, PetZonePersistence, true) // if true, pets will zone with players Code:
void ZoneDatabase::LoadPetInfo(Client *client) Code:
Added lines to remove pet persistence after 30 minutes when logged off - `ZoneDatabase::LoadPetInfo` - \zone\zonedb.cpp(3177) Code:
- issue remains on logging out and keeping pet for 30 min if `PetZonePersistence` is false I am open to suggestions. Thanks |
Check out where this is being called: https://github.com/EQEmu/Server/blob...ocess.cpp#L757 ..
.. in this function: https://github.com/EQEmu/Server/blob...cket.cpp#L1685 Very similar methodology for norent (temporary) items. |
I pored over NoRentExpired, bool deletenorent and some other areas until I came to zonedb and saw some things I was familiar with. As this is all so foreign to me, knowing what to search for and then processing it consumes much more time than actually changing it to something different.
I was thinking of trying to work it in with the norent code but, my concern was with keeping suspended pets suspended. My intention was to cover as many possibilities as I could think of with that. The difference with no rent items and what I'm trying to do is the additional option of having pets poof when zoning (a la classic) while not having them go away like norent items when logging for under 30 minutes. It really isn't a big deal as far as the game goes. I enjoy trying to solve the problem. Thanks for the response, it got me thinking about it a little different. |
Adding that methodology to LoadPets will cause that to be processed every time that LoadPets is called..as in zone changes.
You may need to split the methodology up to have one portion processed on zone entry, and the other on zone change. You could create handlers for the actions that you want to process in Database(SharedDatabase?) (ref: https://github.com/EQEmu/Server/comm...5353f5ed8d8044) .. and handle the returns appropriately. I know it's a pain to figure out what does what, where and why..but, it comes with exposure. |
Yes! That's exactly what I was thinking (in regards to splitting it up) but didn't understand and still having a hard time understanding. I'll probably get it a little with, like you said, more exposure.
|
I am extremely slow when it comes to picking up new material...
Intellisense has been my friend since day one! |
I have to say that feature is wonderful, really helps in learning it.
Compiling the new code now. Hopefully it works. |
All times are GMT -4. The time now is 09:58 PM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.