[PHP] Decrypt Awake

05/19/2020 11:33 ZeroTwo02#1
1. You will need php 5.6+
2. You need to run on x64 php
3. The script don't take 5 lines awake, only 3.

Code:
<?php
	 define( 'MAX_RANDOM_OPTION', 3 );
	 define( '_AWAKE_SAFE_FLAG', 0x2000000000000000 );

	 class CRandomOptionProperty
	 {       
	     static 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;
	     }
	     static function IsCheckedSafeFlag( $n64RandomeOption )
	     {
	         if( ( $n64RandomeOption & _AWAKE_SAFE_FLAG ) == _AWAKE_SAFE_FLAG )
	             return true;
	         return false;
	     }
	     static function GetParam( $nRandomOptItemId, $i, &$nDst, &$nAdj )
	     {
	         if ( $i > MAX_RANDOM_OPTION )
	             return false;
	                         
	         $nRandomOption = ( $nRandomOptItemId >> ( 8 + $i * 18 ) );
	         $nAdj = $nRandomOption & 0x000001FF;
	         if( $nRandomOption & 0x00000200 )
	             $nAdj = -$nAdj;
	         $nRandomOption = $nRandomOption >> 10;
	     
	         $nDst = $nRandomOption & 0x0000007F;
	                     
	         return ( $nDst > 0 );
	     }
	}
	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;
	}
?>
	<h2>Decrypt Flyff Awake</h2>
	</div>
		<form method="post">
		<strong><p style="color:red">Awake Encrypt :</br></strong>
		<input type="text" name="awake">
		<input type="submit" name="push"  />
		</form>
	</p></br>
<?php

	if(isset($_POST['push'])) 
	{
?>
	<div class="title">
		<h2>Awake Decrypt :</h2>
		<span class="byline">Awake : <?php echo GetAwakes($_POST['awake']); ?></span>
	</div>
<?php
	}
?>
The script was originaly made by Sedrika.
05/19/2020 17:07 cookie69#2
Quote:
Originally Posted by ZeroTwo02 View Post
1. You will need php 5.6+
2. You need to run on x64 php
3. The script don't take 5 lines awake, only 3.

Code:
<?php
	 define( 'MAX_RANDOM_OPTION', 3 );
	 define( '_AWAKE_SAFE_FLAG', 0x2000000000000000 );

	 class CRandomOptionProperty
	 {       
	     static 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;
	     }
	     static function IsCheckedSafeFlag( $n64RandomeOption )
	     {
	         if( ( $n64RandomeOption & _AWAKE_SAFE_FLAG ) == _AWAKE_SAFE_FLAG )
	             return true;
	         return false;
	     }
	     static function GetParam( $nRandomOptItemId, $i, &$nDst, &$nAdj )
	     {
	         if ( $i > MAX_RANDOM_OPTION )
	             return false;
	                         
	         $nRandomOption = ( $nRandomOptItemId >> ( 8 + $i * 18 ) );
	         $nAdj = $nRandomOption & 0x000001FF;
	         if( $nRandomOption & 0x00000200 )
	             $nAdj = -$nAdj;
	         $nRandomOption = $nRandomOption >> 10;
	     
	         $nDst = $nRandomOption & 0x0000007F;
	                     
	         return ( $nDst > 0 );
	     }
	}
	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;
	}
?>
	<h2>Decrypt Flyff Awake</h2>
	</div>
		<form method="post">
		<strong><p style="color:red">Awake Encrypt :</br></strong>
		<input type="text" name="awake">
		<input type="submit" name="push"  />
		</form>
	</p></br>
<?php

	if(isset($_POST['push'])) 
	{
?>
	<div class="title">
		<h2>Awake Decrypt :</h2>
		<span class="byline">Awake : <?php echo GetAwakes($_POST['awake']); ?></span>
	</div>
<?php
	}
?>
The script was originaly made by Sedrika.
For what usage? the awake "decrypt" is already in the c++ source
05/19/2020 17:49 ZeroTwo02#3
Quote:
Originally Posted by cookie69 View Post
For what usage? the awake "decrypt" is already in the c++ source
For any admin panel.
To see the awake of a trade, or a item delete etc...
On database the awake is encrypted.
05/20/2020 06:46 pbben15#4
Quote:
Originally Posted by ZeroTwo02 View Post
1. You will need php 5.6+
2. You need to run on x64 php
3. The script don't take 5 lines awake, only 3.

Code:
<?php
	 define( 'MAX_RANDOM_OPTION', 3 );
	 define( '_AWAKE_SAFE_FLAG', 0x2000000000000000 );

	 class CRandomOptionProperty
	 {       
	     static 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;
	     }
	     static function IsCheckedSafeFlag( $n64RandomeOption )
	     {
	         if( ( $n64RandomeOption & _AWAKE_SAFE_FLAG ) == _AWAKE_SAFE_FLAG )
	             return true;
	         return false;
	     }
	     static function GetParam( $nRandomOptItemId, $i, &$nDst, &$nAdj )
	     {
	         if ( $i > MAX_RANDOM_OPTION )
	             return false;
	                         
	         $nRandomOption = ( $nRandomOptItemId >> ( 8 + $i * 18 ) );
	         $nAdj = $nRandomOption & 0x000001FF;
	         if( $nRandomOption & 0x00000200 )
	             $nAdj = -$nAdj;
	         $nRandomOption = $nRandomOption >> 10;
	     
	         $nDst = $nRandomOption & 0x0000007F;
	                     
	         return ( $nDst > 0 );
	     }
	}
	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;
	}
?>
	<h2>Decrypt Flyff Awake</h2>
	</div>
		<form method="post">
		<strong><p style="color:red">Awake Encrypt :</br></strong>
		<input type="text" name="awake">
		<input type="submit" name="push"  />
		</form>
	</p></br>
<?php

	if(isset($_POST['push'])) 
	{
?>
	<div class="title">
		<h2>Awake Decrypt :</h2>
		<span class="byline">Awake : <?php echo GetAwakes($_POST['awake']); ?></span>
	</div>
<?php
	}
?>
The script was originaly made by Sedrika.
Where do I add these codes? Admin Panel? or do I have to create new file in Admin Panel folder?
05/26/2020 13:30 deleonrenz024#5
Thanks for reuploading this man. May I know where on the database I can get the awake values of an Item is saved?

Edit: Nevermind, found it dbo.INVENTORY_EXT_TBL on column m_extInventory, now all I need is figuring out which index when you explode the string using '/' is for which item.
05/28/2020 19:09 xTwiLightx#6
Quote:
Originally Posted by deleonrenz024 View Post
Thanks for reuploading this man. May I know where on the database I can get the awake values of an Item is saved?

Edit: Nevermind, found it dbo.INVENTORY_EXT_TBL on column m_extInventory, now all I need is figuring out which index when you explode the string using '/' is for which item.
0 = m_bCharged
1 = m_dwKeepTime
2 = Awakening
3 = m_bTranformVisPet

... assuming that you're using a clean v15 or v21 source code.
05/29/2020 13:08 deleonrenz024#7
Quote:
Originally Posted by xTwiLightx View Post
0 = m_bCharged
1 = m_dwKeepTime
2 = Awakening
3 = m_bTranformVisPet

... assuming that you're using a clean v15 or v21 source code.
I don't know what's this for, but thanks.

So for anyone that's maybe wondering on how you can find the correct which database entry is for which item.

This is m_Inventory from INVENTORY_TBL

Red is Item ID from defineItem.h
Blue is Item Index.

So in our case, the Item index 3 has Item ID of 21 which is Wooden Sword.

Now split m_extInventory from INVENTORY_EXT_TBL using the character '/'
then find the 4th one because indexes starts with 0 and the item index we're finding is 3.(the '/' is the delimiter).

Now you can decrypt the 759943664640 using the decrypter above and that will be the awake values of our Wooden Sword
06/05/2020 17:39 xTwiLightx#8
Quote:
Originally Posted by deleonrenz024 View Post
I don't know what's this for, but thanks
Quote:
now all I need is figuring out which index when you explode the string using '/' is for which item.
That's exactly what I did for you. ;)