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
- *
- */
- class BattleModel extends ModelBase {
- function executeWarResult($taskRow) {
- $taskRow['village_id'] = intval( $taskRow['village_id'] );
- $fromVillageRow = $this->_getVillageInfo( $taskRow['village_id'] );
- $toVillageRow = $this->_getVillageInfo( $taskRow['to_village_id'] );
- $paramsArray = explode( '|', $taskRow['proc_params'] );
- $troopsArrStr = explode( ',', $paramsArray[0] );
- $troopsArray = array( 'troops' => array( ), 'onlyHero' => FALSE, 'heroTroopId' => 0, 'hasHero' => FALSE, 'hasKing' => FALSE, 'hasWallDest' => FALSE, 'cropConsumption' => 0 );
- $_onlyHero = TRUE;
- foreach ($troopsArrStr as $_t) {
- list( $tid, $tnum ) = explode( ' ', $_t );
- if ($tnum == 0 - 1) {
- $troopsArray['hasHero'] = TRUE;
- $troopsArray['heroTroopId'] = $tid;
- $tnum = 1;
- } else {
- $troopsArray['troops'][$tid] = $tnum;
- if (0 < $tnum) {
- $_onlyHero = FALSE;
- } else {
- continue;
- }
- if (( ( ( ( $tid == 9 || $tid == 19 ) || $tid == 29 ) || $tid == 108 ) || $tid == 59 )) {
- $troopsArray['hasKing'] = TRUE;
- }
- if (( ( ( ( $tid == 7 || $tid == 17 ) || $tid == 27 ) || $tid == 106 ) || $tid == 57 )) {
- $troopsArray['hasWallDest'] = TRUE;
- }
- }
- $troopsArray += 'cropConsumption' = $GLOBALS['GameMetadata']['troops'][$tid]['crop_consumption'] * $tnum;
- }
- if (( $_onlyHero && $troopsArray['hasHero'] )) {
- $troopsArray['onlyHero'] = TRUE;
- }
- $procInfo = array( 'troopsArray' => $troopsArray, 'hasHero' => $paramsArray[1] == 1, 'spyAction' => $paramsArray[2], 'catapultTarget' => $paramsArray[3], 'harvestResources' => $paramsArray[4], 'spyInfo' => $paramsArray[5], 'catapultResult' => $paramsArray[6], 'troopBack' => $paramsArray[7] == 1 );
- if ($taskRow['proc_type'] == QS_CREATEVILLAGE) {
- if (( $toVillageRow['is_oasis'] || 0 < intval( $toVillageRow['player_id'] ) )) {
- $taskRow['proc_type'] = QS_WAR_ATTACK_PLUNDER;
- }
- }
- switch ($taskRow['proc_type']) {
- case QS_WAR_REINFORCE: {
- require_once( MODEL_PATH . DIRECTORY_SEPARATOR . 'battles' . DIRECTORY_SEPARATOR . 'reinforcement.php' );
- $reinforceModel = new ReInforcementBattleModel( );
- return $reinforceModel->handleReInforcement( $taskRow, $toVillageRow, $fromVillageRow, $procInfo, $paramsArray[0] );
- }
- case QS_WAR_ATTACK: {
- }
- case QS_WAR_ATTACK_PLUNDER: {
- require_once( MODEL_PATH . DIRECTORY_SEPARATOR . 'battles' . DIRECTORY_SEPARATOR . 'war.php' );
- $warModel = new WarBattleModel( );
- return $warModel->handleWarAttack( $taskRow, $toVillageRow, $fromVillageRow, $procInfo );
- }
- case QS_WAR_ATTACK_SPY: {
- require_once( MODEL_PATH . DIRECTORY_SEPARATOR . 'battles' . DIRECTORY_SEPARATOR . 'spy.php' );
- $spyModel = new SpyBattleModel( );
- return $spyModel->handleWarSpy( $taskRow, $toVillageRow, $fromVillageRow, $procInfo );
- }
- case QS_CREATEVILLAGE: {
- require_once( MODEL_PATH . DIRECTORY_SEPARATOR . 'battles' . DIRECTORY_SEPARATOR . 'createnewvillage.php' );
- $newVillageModel = new NewVillageBattleModel( );
- return $newVillageModel->handleCreateNewVillage( $taskRow, $toVillageRow, $fromVillageRow, $troopsArray['cropConsumption'] );
- }
- }
- return FALSE;
- }
- ..................................................
- .......................
- .......
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement