- Joined
- Sep 16, 2009
- Messages
- 137
- Reaction score
- 103
Here's the script that I wrote in PHP to read the Item Awakes.
Class:
Function call:
You can read the Awake ID from the database.
If the Awake ID is over 2147483647 you have to use the 64-Bit version of PHP to calculate it.
$nDst is the Attribute ID
$nAdj is the Attribute Value
All credits goes to me.
Class:
PHP:
<?php
define( 'MAX_RANDOM_OPTION', 3 );
define( '_AWAKE_SAFE_FLAG', 0x2000000000000000 );
class CRandomOptionProperty
{
public function GetRandomOptionSize( $nRandomOptItemId )
{
$nSize = 0;
$bCheckedSafeFlag = false;
$bCheckedSafeFlag = CRandomOptionProperty::IsCheckedSafeFlag( $nRandomOptItemId );
if( $bCheckedSafeFlag )
return nSize;
$i = 0x3FFFF << 8;
for( $j = 0; $j < MAX_RANDOM_OPTION; $j++ )
{
if( $nRandomOptItemId & $i )
$nSize++;
else
return $nSize;
$i = $i << 18;
}
return $nSize;
}
public function IsCheckedSafeFlag( $n64RandomeOption )
{
if( ( $n64RandomeOption & _AWAKE_SAFE_FLAG ) == _AWAKE_SAFE_FLAG )
return true;
return false;
}
public function GetParam( $nRandomOptItemId, $i, &$pnDst, &$pnAdj )
{
if ( $i > MAX_RANDOM_OPTION )
return false;
$nRandomOption = ( $nRandomOptItemId >> ( 8 + $i * 18 ) );
$pnAdj = $nRandomOption & 0x000001FF;
if( $nRandomOption & 0x00000200 )
$pnAdj = -$pnAdj;
$nRandomOption = $nRandomOption >> 10;
$pnDst = $nRandomOption & 0x0000007F;
return ( $pnDst > 0 );
}
}
?>
Function call:
PHP:
public function GetAwakes( $nRandomOptItemId )
{
$nDst;
$nAdj;
$nStr = '';
$str = '';
if( CRandomOptionProperty::GetRandomOptionSize( $nRandomOptItemId ) > 1 )
$nStr = ', ';
for( $i = 0; $i < CRandomOptionProperty::GetRandomOptionSize( $nRandomOptItemId ); $i++ )
{
if( !CRandomOptionProperty::GetParam( $nRandomOptItemId, $i, &$nDst, &$nAdj ) )
continue;
if( $nAdj >= 0 )
$str .= $nDst.' +'.$nAdj.$nStr;
else
$str .= $nDst.' -'.$nAdj.$nStr;
}
return $str;
}
You can read the Awake ID from the database.
If the Awake ID is over 2147483647 you have to use the 64-Bit version of PHP to calculate it.
$nDst is the Attribute ID
$nAdj is the Attribute Value
All credits goes to me.
Last edited: