Advertisement
Guest User

Untitled

a guest
Jul 11th, 2012
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.58 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by deZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 1.1.5.0
  8. * @ Author : DeZender
  9. * @ Release on : 09.06.2012
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. class BattleModel extends ModelBase {
  15. function executeWarResult($taskRow) {
  16. $taskRow['village_id'] = intval( $taskRow['village_id'] );
  17. $fromVillageRow = $this->_getVillageInfo( $taskRow['village_id'] );
  18. $toVillageRow = $this->_getVillageInfo( $taskRow['to_village_id'] );
  19. $paramsArray = explode( '|', $taskRow['proc_params'] );
  20. $troopsArrStr = explode( ',', $paramsArray[0] );
  21. $troopsArray = array( 'troops' => array( ), 'onlyHero' => FALSE, 'heroTroopId' => 0, 'hasHero' => FALSE, 'hasKing' => FALSE, 'hasWallDest' => FALSE, 'cropConsumption' => 0 );
  22. $_onlyHero = TRUE;
  23. foreach ($troopsArrStr as $_t) {
  24. list( $tid, $tnum ) = explode( ' ', $_t );
  25.  
  26. if ($tnum == 0 - 1) {
  27. $troopsArray['hasHero'] = TRUE;
  28. $troopsArray['heroTroopId'] = $tid;
  29. $tnum = 1;
  30. } else {
  31. $troopsArray['troops'][$tid] = $tnum;
  32.  
  33. if (0 < $tnum) {
  34. $_onlyHero = FALSE;
  35. } else {
  36. continue;
  37. }
  38.  
  39.  
  40. if (( ( ( ( $tid == 9 || $tid == 19 ) || $tid == 29 ) || $tid == 108 ) || $tid == 59 )) {
  41. $troopsArray['hasKing'] = TRUE;
  42. }
  43.  
  44.  
  45. if (( ( ( ( $tid == 7 || $tid == 17 ) || $tid == 27 ) || $tid == 106 ) || $tid == 57 )) {
  46. $troopsArray['hasWallDest'] = TRUE;
  47. }
  48. }
  49.  
  50. $troopsArray += 'cropConsumption' = $GLOBALS['GameMetadata']['troops'][$tid]['crop_consumption'] * $tnum;
  51. }
  52.  
  53.  
  54. if (( $_onlyHero && $troopsArray['hasHero'] )) {
  55. $troopsArray['onlyHero'] = TRUE;
  56. }
  57.  
  58. $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 );
  59.  
  60. if ($taskRow['proc_type'] == QS_CREATEVILLAGE) {
  61. if (( $toVillageRow['is_oasis'] || 0 < intval( $toVillageRow['player_id'] ) )) {
  62. $taskRow['proc_type'] = QS_WAR_ATTACK_PLUNDER;
  63. }
  64. }
  65.  
  66. switch ($taskRow['proc_type']) {
  67. case QS_WAR_REINFORCE: {
  68. require_once( MODEL_PATH . DIRECTORY_SEPARATOR . 'battles' . DIRECTORY_SEPARATOR . 'reinforcement.php' );
  69. $reinforceModel = new ReInforcementBattleModel( );
  70. return $reinforceModel->handleReInforcement( $taskRow, $toVillageRow, $fromVillageRow, $procInfo, $paramsArray[0] );
  71. }
  72.  
  73. case QS_WAR_ATTACK: {
  74. }
  75.  
  76. case QS_WAR_ATTACK_PLUNDER: {
  77. require_once( MODEL_PATH . DIRECTORY_SEPARATOR . 'battles' . DIRECTORY_SEPARATOR . 'war.php' );
  78. $warModel = new WarBattleModel( );
  79. return $warModel->handleWarAttack( $taskRow, $toVillageRow, $fromVillageRow, $procInfo );
  80. }
  81.  
  82. case QS_WAR_ATTACK_SPY: {
  83. require_once( MODEL_PATH . DIRECTORY_SEPARATOR . 'battles' . DIRECTORY_SEPARATOR . 'spy.php' );
  84. $spyModel = new SpyBattleModel( );
  85. return $spyModel->handleWarSpy( $taskRow, $toVillageRow, $fromVillageRow, $procInfo );
  86. }
  87.  
  88. case QS_CREATEVILLAGE: {
  89. require_once( MODEL_PATH . DIRECTORY_SEPARATOR . 'battles' . DIRECTORY_SEPARATOR . 'createnewvillage.php' );
  90. $newVillageModel = new NewVillageBattleModel( );
  91. return $newVillageModel->handleCreateNewVillage( $taskRow, $toVillageRow, $fromVillageRow, $troopsArray['cropConsumption'] );
  92. }
  93. }
  94.  
  95. return FALSE;
  96. }
  97. ..................................................
  98. .......................
  99. .......
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement