Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by deZender.Net
- * @ deZender (PHP5 Decoder for ionCube Encoder)
- *
- * @ Version : 1.1.5.0
- * @ Author : DeZender
- * @ Release on : 09.06.2012
- * @ Official site : http://DeZender.Net
- *
- */
- require( '.' . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'boot.php' );
- require_once( MODEL_PATH . 'v2v.php' );
- require_once( MODEL_PATH . 'build.php' );
- class GPage extends VillagePage {
- var $pageState = null;
- var $targetVillage = array( 'x' => NULL, 'y' => NULL );
- var $troops = null;
- var $disableFirstTwoAttack = FALSE;
- var $attackWithCatapult = FALSE;
- var $transferType = 2;
- var $errorTable = array( );
- var $newVillageResources = array( 1 => 750, 2 => 750, 3 => 750, 4 => 750 );
- var $rallyPointLevel = 0;
- var $totalCatapultTroopsCount = 0;
- var $catapultCanAttackLastIndex = 0;
- var $availableCatapultTargetsString = '';
- var $catapultCanAttack = array( 0 => 0, 1 => 10, 2 => 11, 3 => 9, 4 => 6, 5 => 2, 6 => 4, 7 => 8, 8 => 7, 9 => 3, 10 => 5, 11 => 1, 12 => 22, 13 => 13, 14 => 19, 15 => 12, 16 => 35, 17 => 18, 18 => 29, 19 => 30, 20 => 37, 21 => 41, 22 => 15, 23 => 17, 24 => 26, 25 => 16, 26 => 25, 27 => 20, 28 => 14, 29 => 24, 30 => 28, 31 => 40, 32 => 21 );
- var $onlyOneSpyAction = FALSE;
- var $backTroopsProperty = array( );
- function GPage() {
- parent::villagepage( );
- $this->viewFile = 'v2v.phtml';
- $this->contentCssClass = 'a2b';
- }
- function onLoadBuildings($building) {
- if (( $building['item_id'] == 16 && $this->rallyPointLevel < $building['level'] )) {
- $this->rallyPointLevel = $building['level'];
- }
- }
- function load() {
- parent::load( );
- if ($this->rallyPointLevel <= 0) {
- $this->redirect( 'build.php?id=39' );
- return null;
- }
- if (( ( isset( $_GET['d1'] ) || isset( $_GET['d2'] ) ) || isset( $_GET['d3'] ) )) {
- $this->pageState = 3;
- $this->handleTroopBack( );
- return null;
- }
- $m = new WarModel( );
- $this->pageState = 1;
- $map_size = $this->setupMetadata['map_size'];
- $half_map_size = floor( $map_size / 2 );
- $this->hasHero = $this->data['hero_in_village_id'] == $this->data['selected_village_id'];
- $t_arr = explode( '|', $this->data['troops_num'] );
- foreach ($t_arr as $t_str) {
- $t2_arr = explode( ':', $t_str );
- if ($t2_arr[0] == 0 - 1) {
- $t2_arr = explode( ',', $t2_arr[1] );
- foreach ($t2_arr as $t2_str) {
- $t = explode( ' ', $t2_str );
- if ($t[0] == 99) {
- continue;
- }
- $this->troops[] = array( 'troopId' => $t[0], 'number' => $t[1] );
- }
- continue;
- }
- }
- $attackOptions1 = '';
- $sendTroops = FALSE;
- $playerData = NULL;
- $villageRow = NULL;
- if (!$this->isPost( )) {
- if (( isset( $_GET['id'] ) && is_numeric( $_GET['id'] ) )) {
- $vid = intval( $_GET['id'] );
- if ($vid < 1) {
- $vid = 1;
- }
- $villageRow = $m->getVillageDataById( $vid );
- }
- } else {
- if (isset( $_POST['id'] )) {
- $sendTroops = ( !$this->isGameTransientStopped( ) && !$this->isGameOver( ) );
- $vid = intval( $_POST['id'] );
- $villageRow = $m->getVillageDataById( $vid );
- } else {
- if (( isset( $_POST['dname'] ) && trim( $_POST['dname'] ) != '' )) {
- $villageRow = $m->getVillageDataByName( trim( $_POST['dname'] ) );
- } else {
- if (( ( ( isset( $_POST['x'] ) && isset( $_POST['y'] ) ) && trim( $_POST['x'] ) != '' ) && trim( $_POST['y'] ) != '' )) {
- $vid = $this->__getVillageId( $map_size, $this->__getCoordInRange( $map_size, intval( $_POST['x'] ) ), $this->__getCoordInRange( $map_size, intval( $_POST['y'] ) ) );
- $villageRow = $m->getVillageDataById( $vid );
- }
- }
- }
- }
- if ($villageRow == NULL) {
- if ($this->isPost( )) {
- $this->errorTable = v2v_p_entervillagedata;
- }
- return null;
- }
- $this->disableFirstTwoAttack = ( intval( $villageRow['player_id'] ) == 0 && $villageRow['is_oasis'] );
- $this->targetVillage['x'] = floor( ( $villageRow['id'] - 1 ) / $map_size );
- $this->targetVillage['y'] = $villageRow['id'] - ( $this->targetVillage['x'] * $map_size + 1 );
- if ($half_map_size < $this->targetVillage['x']) {
- $this->targetVillage -= 'x' = $map_size;
- }
- if ($half_map_size < $this->targetVillage['y']) {
- $this->targetVillage -= 'y' = $map_size;
- }
- if ($villageRow['id'] == $this->data['selected_village_id']) {
- return null;
- }
- if (( 0 < intval( $villageRow['player_id'] ) && $m->getPlayType( $villageRow['player_id'] ) == PLAYERTYPE_ADMIN )) {
- return null;
- }
- $spyOnly = FALSE;
- if (( !$villageRow['is_oasis'] && intval( $villageRow['player_id'] ) == 0 )) {
- $this->transferType = 1;
- $humanTroopId = 0;
- $renderTroops = array( );
- foreach ($this->troops as $troop) {
- $renderTroops[$troop['troopId']] = 0;
- if (( ( ( ( $troop['troopId'] == 10 || $troop['troopId'] == 20 ) || $troop['troopId'] == 30 ) || $troop['troopId'] == 109 ) || $troop['troopId'] == 60 )) {
- $humanTroopId = $troop['troopId'];
- $renderTroops[$humanTroopId] = $troop['number'];
- continue;
- }
- }
- $canBuildNewVillage = ( isset( $renderTroops[$humanTroopId] ) && 3 <= $renderTroops[$humanTroopId] );
- if ($canBuildNewVillage) {
- $count = (trim( $this->data['child_villages_id'] ) == '' ? 0 : sizeof( explode( ',', $this->data['child_villages_id'] ) ));
- if (2 < $count) {
- $this->errorTable = v2v_p_cannotbuildnewvill;
- return null;
- }
- if (!$this->_canBuildNewVillage( )) {
- $this->errorTable = v2v_p_cannotbuildnewvill1;
- return null;
- }
- if (!$this->isResourcesAvailable( $this->newVillageResources )) {
- $this->errorTable = sprintf( v2v_p_cannotbuildnewvill2, $this->newVillageResources['1'] );
- return null;
- }
- if ($m->hasNewVillageTask( $this->player->playerId )) {
- $this->errorTable = v2v_p_cannotbuildnewvill3;
- return null;
- }
- } else {
- $this->errorTable = v2v_p_cannotbuildnewvill4;
- return null;
- }
- $this->pageState = 2;
- } else {
- if ($this->isPost( )) {
- if (( !$villageRow['is_oasis'] && intval( $villageRow['player_id'] ) == 0 )) {
- $this->errorTable = v2v_p_novillagehere;
- return null;
- }
- if (( ( !isset( $_POST['c'] ) || intval( $_POST['c'] ) < 1 ) || 4 < intval( $_POST['c'] ) )) {
- return null;
- }
- $this->transferType = ($this->disableFirstTwoAttack ? 4 : intval( $_POST['c'] ));
- if (0 < intval( $villageRow['player_id'] )) {
- $playerData = $m->getPlayerDataById( intval( $villageRow['player_id'] ) );
- if ($playerData['is_blocked']) {
- $this->errorTable = v2v_p_playerwas_blocked;
- return null;
- }
- if (0 < $playerData['protection_remain_sec']) {
- $this->errorTable = v2v_p_playerwas_inprotectedperiod;
- return null;
- }
- }
- $totalTroopsCount = 0;
- $totalSpyTroopsCount = 0;
- $this->totalCatapultTroopsCount = 0;
- $hasTroopsSelected = FALSE;
- $renderTroops = array( );
- if (isset( $_POST['t'] )) {
- foreach ($this->troops as $troop) {
- $num = 0;
- if (( isset( $_POST['t'][$troop['troopId']] ) && 0 < intval( $_POST['t'][$troop['troopId']] ) )) {
- $num = ($troop['number'] < $_POST['t'][$troop['troopId']] ? $troop['number'] : intval( $_POST['t'][$troop['troopId']] ));
- }
- $renderTroops[$troop['troopId']] = $num;
- $totalTroopsCount += $num;
- if (0 < $num) {
- $hasTroopsSelected = TRUE;
- }
- if (( ( ( ( $troop['troopId'] == 4 || $troop['troopId'] == 14 ) || $troop['troopId'] == 23 ) || $troop['troopId'] == 103 ) || $troop['troopId'] == 54 )) {
- $totalSpyTroopsCount += $num;
- continue;
- }
- if (( ( ( ( $troop['troopId'] == 8 || $troop['troopId'] == 18 ) || $troop['troopId'] == 28 ) || $troop['troopId'] == 107 ) || $troop['troopId'] == 58 )) {
- += 'totalCatapultTroopsCount';
- = $num;
- continue;
- }
- }
- }
- ..................................
- .....................
- ...........
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement