Must be a Nexon-made function file....
I don't think I've seen this function in C++, or is it?
Must be a Nexon-made function file....
I don't think I've seen this function in C++, or is it?
I'm wondering, can you get potential info out of there?
Specifically how cubes work?
As in: chance to change the grade from rare to epic or unique, and if it can change from 2 to 3 bonuses?
Wow...really?! Switch statements?! That many conditions as well?! I really wonder what kind of beginner programmers they hire to code these things. These developers should know better. -_-!
The computer isn't going to like this in terms of performance. And there isn't much that the assembler will be able to do either...way too many potential branch prediction misses (on the architecture level). >.>
I sure hope this function isn't invoked each time we attack...and that it's only calculated once. -_-
Kinda explains why MS runs so slow and requires so much resources...if they really have these bad programming habits. >.>
It definitely doesn't look like a function in the STL library, so it must be a user-defined function - which shouldn't be a surprise to you - since that's what programming is essentially about. STL is mainly only used for the containers/ADTs.
Uhhh, switch statements run VERY FAST. Even faster than if statements. Switch is better here because there are a limited number of options that exist in easily ascending order. When it's like this, the assembly XORs a single digit and knows exactly where to JMP. An if-then structure would require, worst case, 20 CMPs. On top of that, switches are easier to maintain (though Nexon clearly doesn't take advantage of it).
In short, Switch statements when using a branch table run in O(1) time. If statements run in O(n) time.
Precisely, their attack calculations and such are worst. They should simply pre-calculate it and cache on a location for future attack, and update when the user cast a buff/debuff.
You'll see hundreds of if and else such as :
THIS repeats for every single job! lolCode:if (skillid / 1000 == 100) { if (skillid == 1311111) { } else if .. and so on }
AND their randomizer does this 7~15 times per attack to an array :
even without using it fully.Code:CRand32_Rand() // Generate an unsigned int32
What do you expect them to use? If statements?
As Fiel said, switch statements run faster than if.
If you try to optimise this in code it'll be premature optimisation. What ZakumSlaYers said above can be optimised further. Optimising this further would become premature optimisation.
Last edited by AngelSL; 2010-07-25 at 12:54 AM.
It's only premature optimization if you optimize before writing the code - this is just poor optimization. Regardless, I think we're getting a bit off topic.
Just wondering: Is there a list of drops in that file somewhere?
No matter how unlikely, I'm still hopeful. >.>
No. All that does is deobfuscate the clients code.
Drops are server side.
uuum, off topic: I'm sure there's a pros and cons when using 'if' and 'switch' statement right?
Python-simplification of the code, if you consider CalcDamage__CalcDamageByWT, _ZtlSecureFuse and _calc_base_damage as blackboxes:
Spoiler
If vs. Switch: Switch can only be used with constant values in all languages I know of (unless you use JIT and some hocus-pocus), so it has a rather big limitation that way. The difference between them speed-wise is premature optimization: It'll not be your bottleneck.
Always begin writing code in a style that has the best readability first, optimization comes last.
In terms of performance, switch statements has the advantage of comparing multiple values to the same value over and over again. This task is trivial in machine code and the compiler will take advantage of that. "If / else if" statements do not restrict comparison to a single value against multiple values. When turned into machine code, each comparison would require loading a different value into the registers before comparing the registers, whereas the switch statement only loads the value to be checked into the register once at the beginning and reuses it to compare to other values.
Then again, if you're using "if / else if" blocks in a way that always compare the same variable to other values, modern compilers are smart enough to optimize it into the same code that you would have gotten with a switch statement anyway. So, go with whichever one that gives the best readability according to situation.
Is it possible to derive all cast times and delays from the client paul?
All delays are in the WZ files, so it's not really necessary to gather them from the client. The useful thing will be the calculation which determines how booster affects delays.
This'll just be my "post random stuff I find" thread.
Determining Item Level and the EXP:
Item EXP to level is determined by the Item's level which is sent to the "get level exp" function. So if an item is level 60, the game figures out what the exp tnl is from 60 to 61. The game then multiplies this value by the exp value given in the WZ files, then divides by 100.
As a formula...
itemEXPTNL = get_exp_tnl(ItemLevel) * get_item_exp_multiplier(itemClass) / 100.0
So it's much harder to get a level 120 reverse weapon to level up than, say, a level 50 item.
Found firing delays in the EXE. It's hard coded.
That one Hermit Skill where you throw money = 120
Bowman Strafe = 60
Sniper Strafe = 60
Wind Archer Strafe = 60
Wild Hunter Five Shot = 60
Wild Hunter Hurricane = 60
Bowmaster Hurricane = 120
Lucky 7 = 240
Triple Throw = 240
These speeds are not affected by booster.
Speaking of booster, I also found the formula where booster is calculated. The max speed is still 2, and the slowest speed is still 10. It looks like booster does not affect Bloody Storm or Flying Assaulter.
The booster formula looks something like this --> (var * (10 - boosterLevel) * 0.01)
|
Bookmarks