PHP code example of softcreatr / weakauras-decoder

1. Go to this page and download the library: Download softcreatr/weakauras-decoder library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

softcreatr / weakauras-decoder example snippets



SoftCreatR\WeakAuras\Decoder;

// Encoded WeakAuras string
$encoded = 'd0JPcaGAjrTlPQETKQoTspMsnxvmBsomvDtPITPG(Mc8xPq7KuyVODtL9lj5NsLgMqzCsbxwvdvurdwsLHtQ6GcXPev4ykY5i' .
           'LwOKqxxWIfvLLlYdfvXtjwgPYZLyIIQ0uHAYumDWIKsnkjbptH8ojr2Ou0xfQ2SIA7IsFwLMLOsnnPkFxkzKsknwrLmArX4LK' .
           '6KskUfPORjKoVc1Hevv3Ms(nK5eXu8etGsHIU(r7prXIIHIHykMTOx5hJ)Qbk1(kfQQ6IJskt(P4THn7Jt79(PoiZtn0CkgfV' .
           'nSixHykfWNaIPuqbNHsno4tZE7)eXy66kN4VV(iHKVC68M1FeuWzkN8GA1bHw3Tp6EPyqnwqbNH5JaL1TaXumOgTdfazXksXo' .
           'uaKfLCQ8JfuWzAUQVcTRXbFA2B)NteJPRRCoXFF9rcjF5C68M1Fock4mLZjUh(uEti99r3B7C3wAMR25OseiqXSLkhC2WM9P4' .
           'vkkRHsTVsHQQU4OKYqP1AGmSzdJInkAmTt6AyymTd0QJZA2BafiT37NiMsjdQvxhLsguRUUi2WM9jqXfSWP9E)uHAmrjZV3ma' .
           'BoCq0OJ02BymT6MgeD0qoRzpTuuiVHykGx9oqhXuSckyjMabkGx9oGykwbfSetGafZopV2bfmMykwbfSetGaLK3(jMIvqblXe' .
           'iqjHupXuSckyjMabk6ZQh8Q3betXkOGLyceOSUBcf0tmfRGcwIjqGYS3gwKJykwbfSetGabkP)UihES(Nc8vdeOKLAm1t3ebs' ;

// Perform decode
$decoded = Decoder::decodeAura($encoded);

// Print the result
var_dump($decoded[0]);


SoftCreatR\WeakAuras\Decoder;

// Encoded WeakAuras string
$encoded = 'd0JPcaGAjrTlPQETKQoTspMsnxvmBsomvDtPITPG(Mc8xPq7KuyVODtL9lj5NsLgMqzCsbxwvdvurdwsLHtQ6GcXPev4ykY5i' .
           'LwOKqxxWIfvLLlYdfvXtjwgPYZLyIIQ0uHAYumDWIKsnkjbptH8ojr2Ou0xfQ2SIA7IsFwLMLOsnnPkFxkzKsknwrLmArX4LK' .
           '6KskUfPORjKoVc1Hevv3Ms(nK5eXu8etGsHIU(r7prXIIHIHykMTOx5hJ)Qbk1(kfQQ6IJskt(P4THn7Jt79(PoiZtn0CkgfV' .
           'nSixHykfWNaIPuqbNHsno4tZE7)eXy66kN4VV(iHKVC68M1FeuWzkN8GA1bHw3Tp6EPyqnwqbNH5JaL1TaXumOgTdfazXksXo' .
           'uaKfLCQ8JfuWzAUQVcTRXbFA2B)NteJPRRCoXFF9rcjF5C68M1Fock4mLZjUh(uEti99r3B7C3wAMR25OseiqXSLkhC2WM9P4' .
           'vkkRHsTVsHQQU4OKYqP1AGmSzdJInkAmTt6AyymTd0QJZA2BafiT37NiMsjdQvxhLsguRUUi2WM9jqXfSWP9E)uHAmrjZV3ma' .
           'BoCq0OJ02BymT6MgeD0qoRzpTuuiVHykGx9oqhXuSckyjMabkGx9oGykwbfSetGafZopV2bfmMykwbfSetGaLK3(jMIvqblXe' .
           'iqjHupXuSckyjMabk6ZQh8Q3betXkOGLyceOSUBcf0tmfRGcwIjqGYS3gwKJykwbfSetGabkP)UihES(Nc8vdeOKLAm1t3ebs' ;

// Perform decode
$decoded = Decoder::decodeAura($encoded);
$decoded = $decoded[0];

// "Danger keys" are used to identify custom code
$dangerKeys = [
    'custom', 'customDuration', 'customName',
    'customIcon', 'customTexture', 'customStacks',
    'translateFunc', 'alphaFunc', 'scaleFunc',
    'rotateFunc', 'colorFunc', 'customText'
];

// Perform some magic
$luaCodes = [];

foreach ($dangerKeys as $k) {
    $customizations = Decoder::dumpLuaCode($decoded, $k);

    foreach ($customizations as $customization) {
        $customization['value'] = trim($customization['value']);

        if (!empty($customization['value'])) {
            $luaCodes[] = $customization;
        }
    }
}

// Print the result
echo "Decoded string:\n\n";
var_dump($decoded);

echo "\n\nCustom code (if there is any):\n\n";
var_dump($luaCodes);