Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by http://DeZender.Net
- * @ deZender (PHP7 Decoder for ionCube Encoder)
- *
- * @ Version : 4.1.0.1
- * @ Author : DeZender
- * @ Release on : 29.08.2020
- * @ Official site : http://DeZender.Net
- *
- */
- class Achievements
- {
- public function loadXML($xml)
- {
- $achievements = [];
- if ($xml !== false) {
- $i = 1;
- foreach ($xml->achievements->children() as $tag => $ach) {
- if ($tag == 'achievement') {
- $achievements[$i]['uid'] = trim($ach->uid);
- $achievements[$i]['type'] = trim($ach->type);
- $achievements[$i]['name'] = trim($ach->name);
- $achievements[$i]['img'] = trim($ach->img);
- $achievements[$i]['class'] = trim($ach->class);
- $achievements[$i]['req_lvl'] = trim($ach->req_lvl);
- $achievements[$i]['req_mlvl'] = trim($ach->req_mlvl);
- $achievements[$i]['req_reset'] = trim($ach->req_reset);
- $achievements[$i]['req_greset'] = trim($ach->req_greset);
- if ($achievements[$i]['req_lvl'] == NULL) {
- $achievements[$i]['req_lvl'] = 0;
- }
- if ($achievements[$i]['req_mlvl'] == NULL) {
- $achievements[$i]['req_mlvl'] = 0;
- }
- if ($achievements[$i]['req_reset'] == NULL) {
- $achievements[$i]['req_reset'] = 0;
- }
- if ($achievements[$i]['req_greset'] == NULL) {
- $achievements[$i]['req_greset'] = 0;
- }
- $achievements[$i]['total_stages'] = trim($ach->total_stages);
- $achievements[$i]['stage'] = [];
- for ($x = 1; $x <= $achievements[$i]['total_stages']; $x++) {
- $stage = NULL;
- $monsters = NULL;
- $monsters_count = NULL;
- $items = NULL;
- $items_count = NULL;
- $rew_items = NULL;
- $rew_items_count = NULL;
- $stage = [];
- $curr_stage = 'stage' . $x;
- $stage['desc'] = trim($ach->{$curr_stage}->desc);
- if ($achievements[$i]['type'] == '0') {
- $monsters = [];
- $monsters_count = [];
- $k = 1;
- foreach ($ach->{$curr_stage}->monsters->children() as $tag => $monster) {
- if ($tag == 'monster') {
- $monsters[$k] = trim($monster);
- $monsters_count[$k] = intval($monster['count']);
- }
- $k++;
- }
- }
- else if ($achievements[$i]['type'] == '1') {
- $stage['zen'] = trim($ach->{$curr_stage}->zen);
- }
- else if (($achievements[$i]['type'] == '2') || ($achievements[$i]['type'] == '3') || ($achievements[$i]['type'] == '4') || ($achievements[$i]['type'] == '6') || ($achievements[$i]['type'] == '7') || ($achievements[$i]['type'] == '8') || ($achievements[$i]['type'] == '9') || ($achievements[$i]['type'] == '10') || ($achievements[$i]['type'] == '11') || ($achievements[$i]['type'] == '12') || ($achievements[$i]['type'] == '13')) {
- $stage['exp'] = trim($ach->{$curr_stage}->exp);
- }
- else if ($achievements[$i]['type'] == '5') {
- $items = [];
- $items_count = [];
- $k = 1;
- foreach ($ach->{$curr_stage}->items->children() as $tag => $item) {
- if ($tag == 'item') {
- $items[$k] = trim($item);
- $items_count[$k] = intval($item['count']);
- }
- $k++;
- }
- }
- $stage['reward_type'] = trim($ach->{$curr_stage}->reward_type);
- if ($stage['reward_type'] == '7') {
- $rew_items = [];
- $rew_items_count = [];
- $m = 1;
- foreach ($ach->{$curr_stage}->reward->children() as $tag => $item) {
- if ($tag == 'item') {
- $rew_items[$m] = trim($item);
- $rew_items_count[$m] = intval($item['count']);
- }
- $m++;
- }
- }
- else {
- $stage['reward'] = trim($ach->{$curr_stage}->reward);
- }
- $stage['points'] = trim($ach->{$curr_stage}->points);
- $achievements[$i]['stage'][$x] = $stage;
- $achievements[$i]['stage'][$x]['monsters'] = $monsters;
- $achievements[$i]['stage'][$x]['monsters_count'] = $monsters_count;
- $achievements[$i]['stage'][$x]['items'] = $items;
- $achievements[$i]['stage'][$x]['items_count'] = $items_count;
- $achievements[$i]['stage'][$x]['rew_items'] = $rew_items;
- $achievements[$i]['stage'][$x]['rew_items_count'] = $rew_items_count;
- }
- $i++;
- }
- }
- return $achievements;
- }
- else {
- message('error', lang('achievement_error_1', true));
- }
- }
- public function loadXMLforArray($xml)
- {
- $achievements = [];
- if ($xml !== false) {
- $i = 1;
- foreach ($xml->achievements->children() as $tag => $ach) {
- if ($tag == 'achievement') {
- $achievements[$i]['uid'] = trim($ach->uid);
- $achievements[$i]['type'] = trim($ach->type);
- $achievements[$i]['name'] = trim($ach->name);
- $achievements[$i]['img'] = trim($ach->img);
- $achievements[$i]['class'] = trim($ach->class);
- $achievements[$i]['req_lvl'] = trim($ach->req_lvl);
- $achievements[$i]['req_mlvl'] = trim($ach->req_mlvl);
- $achievements[$i]['req_reset'] = trim($ach->req_reset);
- $achievements[$i]['req_greset'] = trim($ach->req_greset);
- if ($achievements[$i]['req_lvl'] == NULL) {
- $achievements[$i]['req_lvl'] = 0;
- }
- if ($achievements[$i]['req_mlvl'] == NULL) {
- $achievements[$i]['req_mlvl'] = 0;
- }
- if ($achievements[$i]['req_reset'] == NULL) {
- $achievements[$i]['req_reset'] = 0;
- }
- if ($achievements[$i]['req_greset'] == NULL) {
- $achievements[$i]['req_greset'] = 0;
- }
- $achievements[$i]['total_stages'] = trim($ach->total_stages);
- for ($x = 1; $x <= $achievements[$i]['total_stages']; $x++) {
- $stage = NULL;
- $monsters = NULL;
- $monsters_count = NULL;
- $items = NULL;
- $items_count = NULL;
- $rew_items = NULL;
- $rew_items_count = NULL;
- $stage = [];
- $curr_stage = 'stage' . $x;
- $stage['desc'] = trim($ach->{$curr_stage}->desc);
- if ($achievements[$i]['type'] == '0') {
- $monsters = [];
- $monsters_count = [];
- $k = 1;
- foreach ($ach->{$curr_stage}->monsters->children() as $tag => $monster) {
- if ($tag == 'monster') {
- $monsters[$k] = trim($monster);
- $monsters_count[$k] = intval($monster['count']);
- }
- $k++;
- }
- }
- else if ($achievements[$i]['type'] == '1') {
- $stage['zen'] = trim($ach->{$curr_stage}->zen);
- }
- else if (($achievements[$i]['type'] == '2') || ($achievements[$i]['type'] == '3') || ($achievements[$i]['type'] == '4') || ($achievements[$i]['type'] == '6') || ($achievements[$i]['type'] == '7') || ($achievements[$i]['type'] == '8') || ($achievements[$i]['type'] == '9') || ($achievements[$i]['type'] == '10') || ($achievements[$i]['type'] == '11') || ($achievements[$i]['type'] == '12') || ($achievements[$i]['type'] == '13')) {
- $stage['exp'] = trim($ach->{$curr_stage}->exp);
- }
- else if ($achievements[$i]['type'] == '5') {
- $items = [];
- $items_count = [];
- $k = 1;
- foreach ($ach->{$curr_stage}->items->children() as $tag => $item) {
- if ($tag == 'item') {
- $items[$k] = trim($item);
- $items_count[$k] = intval($item['count']);
- }
- $k++;
- }
- }
- $stage['reward_type'] = trim($ach->{$curr_stage}->reward_type);
- if ($stage['reward_type'] == '7') {
- $rew_items = [];
- $rew_items_count = [];
- $m = 1;
- foreach ($ach->{$curr_stage}->reward->children() as $tag => $item) {
- if ($tag == 'item') {
- $rew_items[$m] = trim($item);
- $rew_items_count[$m] = intval($item['count']);
- }
- $m++;
- }
- }
- else {
- $stage['reward'] = trim($ach->{$curr_stage}->reward);
- }
- $stage['points'] = trim($ach->{$curr_stage}->points);
- $achievements[$i]['stage'][$x] = $stage;
- $achievements[$i]['stage'][$x]['monsters'] = $monsters;
- $achievements[$i]['stage'][$x]['monsters_count'] = $monsters_count;
- $achievements[$i]['stage'][$x]['items'] = $items;
- $achievements[$i]['stage'][$x]['items_count'] = $items_count;
- $achievements[$i]['stage'][$x]['rew_items'] = $rew_items;
- $achievements[$i]['stage'][$x]['rew_items_count'] = $rew_items_count;
- }
- $i++;
- }
- }
- return $achievements;
- }
- else {
- message('error', lang('achievement_error_1', true));
- }
- }
- public function arrayToXML($array)
- {
- $sxe = new SimpleXMLElement('<achievement_system/>');
- $achievements = $sxe->addChild('achievements');
- $i = 1;
- foreach ($array as $thisAch) {
- $j = 1;
- $achievement = $achievements->addChild('achievement');
- $achievement->addChild('uid', $thisAch['uid']);
- $achievement->addChild('type', $thisAch['type']);
- $achievement->addChild('name', $thisAch['name']);
- $achievement->addChild('img', $thisAch['img']);
- $achievement->addChild('class', $thisAch['class']);
- $achievement->addChild('total_stages', $thisAch['total_stages']);
- $achievement->addChild('req_lvl', $thisAch['req_lvl']);
- $achievement->addChild('req_mlvl', $thisAch['req_mlvl']);
- $achievement->addChild('req_reset', $thisAch['req_reset']);
- $achievement->addChild('req_greset', $thisAch['req_greset']);
- foreach ($thisAch['stage'] as $thisStage) {
- $k = 1;
- $l = 1;
- $m = 1;
- $stage = $achievement->addChild('stage' . $j);
- $stage->addChild('desc', $thisStage['desc']);
- if ($thisAch['type'] == '0') {
- $monsters = $stage->addChild('monsters');
- foreach ($thisStage['monsters'] as $thisMonster) {
- $monster = $monsters->addChild('monster', $thisMonster);
- $monster->addAttribute('count', $thisStage['monsters_count'][$k]);
- $k++;
- }
- }
- else if ($thisAch['type'] == '1') {
- $stage->addChild('zen', $thisStage['zen']);
- }
- else if ($thisAch['type'] == '5') {
- $items = $stage->addChild('items');
- foreach ($thisStage['items'] as $thisItem) {
- $item = $items->addChild('item', $thisItem);
- .............................................................................
- ...................................
- ................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement