Quote:
Originally Posted by abdeen
Thanks Pro , there another question please . how do i convert the id to const ulong ?
Like here is
PHP Code:
StatuseEffect.ini
PHP Code:
17 Reflect NULL -1
and in the source its like this
PHP Code:
ReflectMelee = 0x20000,
|
You need to understand how bit flags work.
I've written about it before but I'm so bored at work so here's the basic rundown.
All numbers stored on a computer are in binary. Lets post a quick conversion table for the example you used of reflect.
Decimal (base 10): 131072
Hexidecimal (base 16): 0x20000
Binary ( base 2): 100000000000000000
Now you'll notice that in stateff.ini it refers to Reflect as being 17. This means that the status effect controlling Reflect (on or off) is the same as
1 shifted to the left by 17 bits
1 << 17
This is important because status effects are essentially a 'pool'. They are a chunk of memory dedicated to certain bits being either active or inactive (1 or 0). This notation lets us quickly and efficiently run bit operations to determine or change specific effects within this section of memory. We are ONLY concerned with the status of this single bit. Hexidecimal (or even worse, decimal) values are very misleading to use as constants/enumerators as they mask what's going on behind the scenes and really offer zero benefit.