Jump to content

GetFloatValue


Recommended Posts

Posted

Can someone explain the steps GetFloatValue is taking, e.g.:

2[/color][/size]22[/color][/size]22[/color][/size]22[/color][/size]22[/color][/size]22[/color][/size]22[/color][/size]22[/color][/size]22[/color][/size]22[/color][/size]22[/color][/size]22[/color][/size]22[/color][/size]22[/color][/size]22[/color][/size]22[/color][/size]22[/color][/size]2[/color][/size][/size]

Posted
       const float& GetFloatValue( uint16 index ) const
       {
           ASSERT( index < m_valuesCount || PrintIndexError( index , false ) );
           return m_floatValues[ index ];
       }

from what I can understand, it just does the return of a member of some m_floatValues array.

Posted

Okay, how does it decode the values...I suppose that is what I'm getting after. How does it take the value I have provided above and convert that into a float? Obviously we can't just float that value.

Posted

Hmm... I don't know what you want to know...

freghar and my answer should have already answered your question or?

We interpret the data field as an array of int, uints and floats (32 bits each so no problem here).

Posted
if you need do convert in php:

   
$float = unpack("f", pack("L",$char_data[$i]));

I would add array_pop for extracting from characters.data (f.e. crit chances) .. so it would be

 $float = array_pop(unpack("f", pack("L",$char_data[$i])));

becose unpack returns array

Posted

No, not PHP, .NET (C# or VB.NET). Unfortunately I can't find any real documentation of pack/unpack from php.net as to what it is actually doing (sure, convert to binary string, but what type, etc. -- .NET has many types of binary strings), so I wanted to find out how Mangos was doing it instead.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use