عالم التتار الجديد سرفر التصفيات العربي تصفيات الخليج العربي
اهلا وسهلا بكم يمكنكم ان تكون من افضل الاعضااء في المنتدى والخول ع العديد من الجوائز القيمه ..

منها الجائزه الكبرى 2000اريال سعوديه
عالم التتار الجديد سرفر التصفيات العربي تصفيات الخليج العربي
اهلا وسهلا بكم يمكنكم ان تكون من افضل الاعضااء في المنتدى والخول ع العديد من الجوائز القيمه ..

منها الجائزه الكبرى 2000اريال سعوديه
عالم التتار الجديد سرفر التصفيات العربي تصفيات الخليج العربي
هل تريد التفاعل مع هذه المساهمة؟ كل ما عليك هو إنشاء حساب جديد ببضع خطوات أو تسجيل الدخول للمتابعة.

عالم التتار الجديد سرفر التصفيات العربي تصفيات الخليج العربي

عالم التتار الجديد سرفر التصفيات العربي تصفيات الخليج العربي
 
الرئيسيةأحدث الصورالتسجيلدخول

 

 شرح سد جميع الثغرات

اذهب الى الأسفل 
3 مشترك
كاتب الموضوعرسالة
عزوزالباذر
عضو صاحب مكان
عضو صاحب مكان



المساهمات : 333
تاريخ التسجيل : 01/01/2013
العمر : 29
الموقع : http://ta6wer-tatarwar2013.roo7.biz/

شرح سد جميع الثغرات Empty
مُساهمةموضوع: شرح سد جميع الثغرات   شرح سد جميع الثغرات Icon_minitimeالإثنين يناير 07, 2013 8:48 am

السلام عليكم ورحمة الله وبركاته

منقول من مدونه ahm للامانه العلميه
-----------------------------------------------------------------------------------------------------------
*سد ثغره البوت = boot.php

ضع هذا الكود في البوت
ــــــــــــــــــــــــــــــــــــــــــــــــــ ــــــــــــــــــــــــــــــــــــــــــــــــــ ــــــــــــــــــــــــــــــــــــــــــــــــــ ــــــــــــــــــــــــــــــــــــــــــــــــــ ـــــــــــــSpoiler:
الــرمــز: تحديد المحتوي
///////////////
/ /
/by mhstr dh7k/
/ /
/ /
///////////////

// By alq0rsan// Fix By Bazaiddefine( "ROOT_PATH", realpath( dirname( dirname( __FILE__ ) ) ).DIRECTORY_SEPARATOR );define( "APP_PATH", ROOT_PATH."app".DIRECTORY_SEPARATOR );define(
"LIB_PATH", ROOT_PATH."lib".DIRECTORY_SEPARATOR );define( "MODEL_PATH", APP_PATH."model".DIRECTORY_SEPARATOR );define( "VIEW_PATH", APP_PATH."view".DIRECTORY_SEPARATOR );if
( isset( $_SERVER['HTTP_ACCEPT_ENCODING'] ) && substr_count( $_SERVER['HTTP_ACCEPT_ENCODING'], "gzip" ) ){ ob_implicit_flush( 0 ); if ( @ob_start( array(
"ob_gzhandler", 9 ) ) ) { header( "Content-Encoding: gzip" ); }}header( "Date: ".gmdate( "D, d M Y H:i:s" )." GMT" );header( "Last-Modified:
".gmdate( "D, d M Y H:i:s" )." GMT" );require( APP_PATH."config.php" );require( LIB_PATH."webservice.php" );require( LIB_PATH."widget.php" );require(
LIB_PATH."webhelper.php" );require( APP_PATH."metadata.php" );require( MODEL_PATH."base.php" );require( APP_PATH."components.php" );require( APP_PATH."mywidgets.php"
);$** = ClientData::getinstance( );$AppConfig['system']['lang'] = $**->uiLang;define( "LANG_PATH",
APP_PATH."lang".DIRECTORY_SEPARATOR.$AppConfig['system']['lang'].DIRECTORY_SEPARATOR );define( "LANG_UI_PATH", LANG_PATH."ui".DIRECTORY_SEPARATOR );require(
LANG_PATH."lang.php" );$tempdata = explode( " ", microtime( ) );$data1 = $tempdata[0];$data2 = $tempdata[1];$__scriptStart = ( double )$data1 + ( double )$data2;if($_POST){ foreach($_POST as
$key=>$value) { if(is_array($_POST[$key])) { array_map('protect',$_POST[$key]); }else { $_POST[$key] = addslashes(strip_tags((trim($value)))); } }}if($_GET){ foreach($_GET
as $key=>$value) { if(is_array($_GET[$key])) { array_map('protect',$_GET[$key]); }else { $_GET[$key] = addslashes(html_entity_decode(trim($value),UTF-); } }}

?>





ترقيع لثغره الثانيه:

الثغره موجوده بـ ملف index.php

أول شي لازم تفكـ الملف فكـ صحيح100%

ثم تبحث عن هذا الكود:الــرمــز: تحديد المحتوي
4a09s7secb9


وتسمحه فقط...!!
ومن ثم تحفظ الملف

لأن هذي كلمه سر مشفره

الثغره الثالثه
حمايه المجلدات برقم سري

وأهم شي:

مجلد:

app


الثغره الرابعه:

دور هذا الشيءSpoiler:
الــرمــز: تحديد المحتوي
'42'=> array (

'support_multiple' => TRUE, 'built_in_capital' => TRUE, 'built_in_non_capital' => TRUE, 'built_in_special_only' => FALSE, 'max_lvl_in_non_capital' => NULL,

'for_tribe_id' => array( '1' => 1, '2' => 1, '3' => 1, '4' => 1, '6' => 1, '7' => 1 ),

'pre_requests' => array( '20' => 5, '15' => 10 ),

'levels'=> array(





هذا هو الكود

الحين
Spoiler:
الــرمــز: تحديد المحتوي
غير هذا pre_requests' => array( '20' => 5, '15' => 10 ),
إلى pre_requests' => array( '20' => 99, '15' => 99 ),
غير الشروط خليه 99 مآحد يقدر يبني السوق





وثغرة الباس اسهل طريققة لها

آحذف ملف password.php وفك عمرك من التعديل علييه

v2v.phpSpoiler:
الــرمــز: تحديد المحتوي
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 AND $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']) OR isset ($_GET['d2'])) OR 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']) AND 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 () AND !$this->isGameOver ());
$vid = intval ($_POST['id']);
$villageRow = $m->getVillageDataById ($vid);
}
else
{
if ((isset ($_POST['dname']) AND trim ($_POST['dname']) != ''))
{
$villageRow = $m->getVillageDataByName (trim ($_POST['dname']));
}
else
{
if ((((isset ($_POST['x']) AND isset ($_POST['y'])) AND trim ($_POST['x']) != '') AND 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 AND $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']) AND $m->getPlayType ($villageRow['player_id']) == PLAYERTYPE_ADMIN))
{
return null;
}
$spyOnly = FALSE;
if ((!$villageRow['is_oasis'] AND 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 OR $troop['troopId'] == 20) OR $troop['troopId'] == 30) OR $troop['troopId'] == 109) OR $troop['troopId'] == 60) OR $troop['troopId'] == 70) OR $troop['troopId'] == 80))
{
$humanTroopId = $troop['troopId'];
$renderTroops[$humanTroopId] = $troop['number'];
if($renderTroops[$humanTroopId] >= 3) {
$renderTroops[$humanTroopId] = 3;
}
continue;
}
}
$canBuildNewVillage = (isset ($renderTroops[$humanTroopId]) AND 3 <= $renderTroops[$humanTroopId]);
if ($canBuildNewVillage)
{
$count = (trim ($this->data['child_villages_id']) == '' ? 0 : sizeof (explode (',', $this->data['child_villages_id'])));
if (1 < $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'] AND intval ($villageRow['player_id']) == 0))
{
$this->errorTable = v2v_p_novillagehere;
return null;
}
if (((!isset ($_POST['c']) OR intval ($_POST['c']) < 1) OR 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'])
{
if ( $this->player->playerId != $villageRow['player_id'] )
{
$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']]) AND 0 < intval ($_POST['t'][$troop['troopId']])))
{
if(preg_match('/^[+-]?[0-9]+$/', $_POST['t'][$troop['troopId']]) == 0) {
exit;
}
$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 OR $troop['troopId'] == 14) OR $troop['troopId'] == 23) OR $troop['troopId'] == 103) OR $troop['troopId'] == 54) OR $troop['troopId'] == 64) OR $troop['troopId'] == 74))
{
$totalSpyTroopsCount += $num;
continue;
}
else
{
if ((((((($troop['troopId'] == 8 OR $troop['troopId'] == 18) OR $troop['troopId'] == 28) OR $troop['troopId'] == 107) OR $troop['troopId'] == 58) OR $troop['troopId'] == 68) OR $troop['troopId'] == 78))
{
$this->totalCatapultTroopsCount = $num;
//+= 'totalCatapultTroopsCount';
//= $num;
continue;
}
continue;
}
}
}
if ((($this->hasHero AND isset ($_POST['_t'])) AND intval ($_POST['_t']) == 1))
{
$hasTroopsSelected = TRUE;
$totalTroopsCount += 1;
}
$spyOnly = (($totalSpyTroopsCount == $totalTroopsCount AND ($this->transferType == 3 OR $this->transferType == 4)) AND 0 < intval ($villageRow['player_id']));
if ($spyOnly)
{
$this->onlyOneSpyAction = $villageRow['is_oasis'];
}
$this->attackWithCatapult = (((0 < $this->totalCatapultTroopsCount AND $this->transferType == 3) AND 0 < intval ($villageRow['player_id'])) AND !$villageRow['is_oasis']);
if ($this->attackWithCatapult)
{
if (10 <= $this->rallyPointLevel)
{
$this->catapultCanAttackLastIndex = sizeof ($this->catapultCanAttack) - 1;
}
else
{
if (5 <= $this->rallyPointLevel)
{
$this->catapultCanAttackLastIndex = 11;
}
else
{
if (3 <= $this->rallyPointLevel)
{
$this->catapultCanAttackLastIndex = 2;
}
else
{
$this->catapultCanAttackLastIndex = 0;
}
}
}
$attackOptions1 = ((isset ($_POST['dtg']) AND $this->_containBuildingTarget ($_POST['dtg'])) ? intval ($_POST['dtg']) : 0);
if (($this->rallyPointLevel == 20 AND 20 <= $this->totalCatapultTroopsCount))
{
$attackOptions1 = '2:' . ($attackOptions1 . ' ' . ((isset ($_POST['dtg1']) AND $this->_containBuildingTarget ($_POST['dtg1'])) ? intval ($_POST['dtg1']) : 0));
}
else
{
$attackOptions1 = '1:' . $attackOptions1;
}
$this->availableCatapultTargetsString = '';
$selectComboTargetOptions = '';
$i = 1;
while ($i <= 9)
{
if ($this->_containBuildingTarget ($i))
{
$selectComboTargetOptions .= sprintf ('', $i, constant ('item_' . $i));
}
++$i;
}
if ($selectComboTargetOptions != '')
{
$this->availableCatapultTargetsString .= '' . $selectComboTargetOptions . '';
}
$selectComboTargetOptions = '';
$i = 10;
while ($i <= 28)
{
if ((((((((((($i == 10 OR $i == 11) OR $i == 15) OR $i == 17) OR $i == 18) OR $i == 24) OR $i == 25) OR $i == 26) OR $i == 28) OR $i == 38) OR $i == 39))
{
if ($this->_containBuildingTarget ($i))
{
$selectComboTargetOptions .= sprintf ('', $i, constant ('item_' . $i));
}
}
++$i;
}
if ($selectComboTargetOptions != '')
{
$this->availableCatapultTargetsString .= '' . $selectComboTargetOptions . '';
}
$selectComboTargetOptions = '';
$i = 12;
while ($i <= 37)
{
if (((((((((($i == 12 OR $i == 13) OR $i == 14) OR $i == 16) OR $i == 19) OR $i == 20) OR $i == 21) OR $i == 22) OR $i == 35) OR $i == 37))
{
if ($this->_containBuildingTarget ($i))
{
$selectComboTargetOptions .= sprintf ('', $i, constant ('item_' . $i));
}
}
++$i;
}
if ($selectComboTargetOptions != '')
{
$this->availableCatapultTargetsString .= '' . $selectComboTargetOptions . '';
}
}
if (!$hasTroopsSelected)
{
$this->errorTable = v2v_p_thereisnoattacktroops;
return null;
}
$this->pageState = 2;
}
}
if ($this->pageState == 2)
{
$this->targetVillage['transferType'] = ($this->transferType == 1 ? v2v_p_attacktyp1 : ($this->transferType == 2 ? v2v_p_attacktyp2 . ' ' : ($this->transferType == 3 ? v2v_p_attacktyp3 : ($this->transferType == 4 ? v2v_p_attacktyp4 : ''))));
if ($villageRow['is_oasis'])
{
$this->targetVillage['villageName'] = ($playerData != NULL ? v2v_p_placetyp1 : v2v_p_placetyp2);
}
else
{
$this->targetVillage['villageName'] = ($playerData != NULL ? $villageRow['village_name'] : v2v_p_placetyp3);
}
$this->targetVillage['villageId'] = $villageRow['id'];
$this->targetVillage['playerName'] = ($playerData != NULL ? $playerData['name'] : ($villageRow['is_oasis'] ? v2v_p_monster : ''));
$this->targetVillage['playerId'] = ($playerData != NULL ? $playerData['id'] : 0);
$this->targetVillage['troops'] = $renderTroops;
$this->targetVillage['hasHero'] = (((1 < $this->transferType AND $this->hasHero) AND isset ($_POST['_t'])) AND intval ($_POST['_t']) == 1);
$distance = WebHelper::getdistance ($this->data['rel_x'], $this->data['rel_y'], $this->targetVillage['x'], $this->targetVillage['y'], $this->setupMetadata['map_size'] / 2);
$this->targetVillage['needed_time'] = intval ($distance / $this->_getTheSlowestTroopSpeed ($renderTroops) * 3600);
$this->targetVillage['spy'] = $spyOnly;
}
if ($sendTroops)
{
$taskType = 0;
switch ($this->transferType)
{
case 1:
{
$taskType = QS_CREATEVILLAGE;
break;
}
case 2:
{
$taskType = QS_WAR_REINFORCE;
break;
}
case 3:
{
$taskType = QS_WAR_ATTACK;
break;
}
case 4:
{
$taskType = QS_WAR_ATTACK_PLUNDER;
break;
}
default:
{
}
}
//return null;
$spyAction = 0;
if ($spyOnly)
{
$taskType = QS_WAR_ATTACK_SPY;
$spyAction = ((isset ($_POST['spy']) AND (intval ($_POST['spy']) == 1 OR intval ($_POST['spy']) == 2)) ? intval ($_POST['spy']) : 1);
if ($this->onlyOneSpyAction)
{
$spyAction = 1;
}
}
$troopsStr = '';
foreach ($this->targetVillage['troops'] as $tid => $tnum)
{
if ($troopsStr != '')
{
$troopsStr .= ',';
}
$troopsStr .= $tid . ' ' . $tnum;
}
if ($this->targetVillage['hasHero'])
{
$troopsStr .= ',' . $this->data['hero_troop_id'] . ' -1';
}
$catapultTargets = $attackOptions1;
$carryResources = ($taskType == QS_CREATEVILLAGE ? implode (' ', $this->newVillageResources) : '');
$procParams = $troopsStr . '|' . ($this->targetVillage['hasHero'] ? 1 : 0) . '|' . $spyAction . '|' . $catapultTargets . '|' . $carryResources . '|||0';
$newTask = new QueueTask ($taskType, $this->player->playerId, $this->targetVillage['needed_time']);
$newTask->villageId = $this->data['selected_village_id'];
$newTask->toPlayerId = intval ($villageRow['player_id']);
$newTask->toVillageId = $villageRow['id'];
$newTask->procParams = $procParams;
$newTask->tag = array ('troops' => $this->targetVillage['troops'], 'hasHero' => $this->targetVillage['hasHero'], 'resources' => ($taskType == QS_CREATEVILLAGE ? $this->newVillageResources : NULL));
$this->queueModel->addTask ($newTask);
$m->dispose ();
$this->redirect ('build.php?id=39');
//return null;
}
$m->dispose ();
}
function handleTroopBack ()
{
$qstr = '';
$fromVillageId = 0;
$toVillageId = 0;
$action = 0;
if (isset ($_GET['d1']))
{
$action = 1;
$qstr = 'd1=' . intval ($_GET['d1']);
if (isset ($_GET['o']))
{
$qstr .= '&o=' . intval ($_GET['o']);
$fromVillageId = intval ($_GET['o']);
}
else
{
$fromVillageId = $this->data['selected_village_id'];
}
$toVillageId = intval ($_GET['d1']);
}
else
{
if (isset ($_GET['d2']))
{
$action = 2;
$qstr = 'd2=' . intval ($_GET['d2']);
$fromVillageId = $this->data['selected_village_id'];
$toVillageId = intval ($_GET['d2']);
}
else
{
if (isset ($_GET['d3']))
{
$action = 3;
$qstr = 'd3=' . intval ($_GET['d3']);
$fromVillageId = intval ($_GET['d3']);
$toVillageId = $this->data['selected_village_id'];
}
else
{
$this->redirect ('build.php?id=39');
//return null;
}
}
}
$this->backTroopsProperty['queryString'] = $qstr;
$m = new WarModel ();
$fromVillageData = $m->getVillageData2ById ($fromVillageId);
$toVillageData = $m->getVillageData2ById ($toVillageId);
if (($fromVillageData == NULL OR $toVillageData == NULL))
{
$m->dispose ();
$this->redirect ('build.php?id=39');
//return null;
}
$vid = $toVillageId;
$_backTroopsStr = '';
$this->backTroopsProperty['headerText'] = v2v_p_backtroops;
$this->backTroopsProperty['action1'] = '' . $fromVillageData['village_name'] . '';
$this->backTroopsProperty['action2'] = '' . v2v_p_troopsinvillagenow . '';
$column1 = '';
$column2 = '';
if ($action == 1)
{
$_backTroopsStr = $fromVillageData['troops_num'];
$column1 = 'troops_num';
$column2 = 'troops_out_num';
}
else
{
if ($action == 2)
{
$this->backTroopsProperty['headerText'] = v2v_p_backcaptivitytroops;
$_backTroopsStr = $fromVillageData['troops_intrap_num'];
$column1 = 'troops_intrap_num';
$column2 = 'troops_out_intrap_num';
}
else
{
if ($action == 3)
{
$_backTroopsStr = $toVillageData['troops_out_num'];
$vid = $fromVillageId;
$column1 = 'troops_num';
$column2 = 'troops_out_num';
}
}
}
$this->backTroopsProperty['backTroops'] = $this->_getTroopsForVillage ($_backTroopsStr, $vid);
if ($this->backTroopsProperty['backTroops'] == NULL)
{
$m->dispose ();
$this->redirect ('build.php?id=39');
//return null;
}
$distance = WebHelper::getdistance ($fromVillageData['rel_x'], $fromVillageData['rel_y'], $toVillageData['rel_x'], $toVillageData['rel_y'], $this->setupMetadata['map_size'] / 2);
if ($this->isPost ())
{
$canSend = FALSE;
$troopsGoBack = array ();
foreach ($this->backTroopsProperty['backTroops']['troops'] as $tid => $tnum)
{
if ((isset ($_POST['t']) AND isset ($_POST['t'][$tid])))
{
$selNum = intval ($_POST['t'][$tid]);
if ($selNum < 0)
{
$selNum = 0;
}
if ($tnum < $selNum)
{
$selNum = $tnum;
}
$troopsGoBack[$tid] = $selNum;
if (0 < $selNum)
{
$canSend = TRUE;
continue;
}
continue;
}
else
{
$troopsGoBack[$tid] = 0;
continue;
}
}
$sendTroopsArray = array ('troops' => $troopsGoBack, 'hasHero' => FALSE, 'heroTroopId' => 0);
$hasHeroTroop = (($this->backTroopsProperty['backTroops']['hasHero'] AND isset ($_POST['_t'])) AND intval ($_POST['_t']) == 1);
if ($hasHeroTroop)
{
$sendTroopsArray['hasHero'] = TRUE;
$sendTroopsArray['heroTroopId'] = $this->backTroopsProperty['backTroops']['heroTroopId'];
$canSend = TRUE;
}
if (!$canSend)
{
$m->dispose ();
$this->redirect ('build.php?id=39');
//return null;
}
if ((!$this->isGameTransientStopped () AND !$this->isGameOver ()))
{
$troops1 = $this->_getTroopsAfterReduction ($fromVillageData[$column1], $toVillageId, $sendTroopsArray);
$troops2 = $this->_getTroopsAfterReduction ($toVillageData[$column2], $fromVillageId, $sendTroopsArray);
$m->backTroopsFrom ($fromVillageId, $column1, $troops1, $toVillageId, $column2, $troops2);
$timeInSeconds = intval ($distance / $this->_getTheSlowestTroopSpeed2 ($sendTroopsArray) * 3600);
$procParams = $this->_getTroopAsString ($sendTroopsArray) . '|0||||||1';
$newTask = new QueueTask (QS_WAR_REINFORCE, intval ($fromVillageData['player_id']), $timeInSeconds);
$newTask->villageId = $fromVillageId;
$newTask->toPlayerId = intval ($toVillageData['player_id']);
$newTask->toVillageId = $toVillageId;
$newTask->procParams = $procParams;
$newTask->tag = array ('troops' => NULL, 'hasHero' => FALSE, 'resources' => NULL, 'troopsCropConsume' => $this->_getTroopCropConsumption ($sendTroopsArray));
$this->queueModel->addTask ($newTask);
$m->dispose ();
$this->redirect ('build.php?id=39');
//return null;
}
}
else
{
$this->backTroopsProperty['time'] = intval ($distance / $this->_getTheSlowestTroopSpeed2 ($this->backTroopsProperty['backTroops']) * 3600);
}
$m->dispose ();
}
function _getTroopCropConsumption ($troopsArray)
{
$GameMetadata = $GLOBALS['GameMetadata'];
$consume = 0;
foreach ($troopsArray['troops'] as $tid => $tnum)
{
$consume += $GameMetadata['troops'][$tid]['crop_consumption'] * $tnum;
}
if ($troopsArray['hasHero'])
{
$consume += $GameMetadata['troops'][$troopsArray['heroTroopId']]['crop_consumption'];
}
return $consume;
}
function _getTroopAsString ($troopsArray)
{
$str = '';
foreach ($troopsArray['troops'] as $tid => $num)
{
if ($str != '')
{
$str .= ',';
}
$str .= $tid . ' ' . $num;
}
if ($troopsArray['hasHero'])
{
if ($str != '')
{
$str .= ',';
}
$str .= $troopsArray['heroTroopId'] . ' -1';
}
return $str;
}
function _getTroopsAfterReduction ($troopString, $targetVillageId, $sendTroopsArray)
{
if (trim ($troopString) == '')
{
return '';
}
$reductionTroopsString = '';
$t_arr = explode ('|', $troopString);
foreach ($t_arr as $t_str)
{
$t2_arr = explode (':', $t_str);
if ($t2_arr[0] == $targetVillageId)
{
$completelyBacked = TRUE;
$newTroopStr = '';
$t2_arr = explode (',', $t2_arr[1]);
foreach ($t2_arr as $t2_str)
{
list ($tid, $tnum) = explode (' ', $t2_str);
if ($tnum == 0 - 1)
{
if (!$sendTroopsArray['hasHero'])
{
if ($newTroopStr != '')
{
$newTroopStr .= ',';
}
$newTroopStr .= $tid . ' ' . $tnum;
$completelyBacked = FALSE;
continue;
}
continue;
}
else
{
if (isset ($sendTroopsArray['troops'][$tid]))
{
$n = $sendTroopsArray['troops'][$tid];
if ($n < 0)
{
$n = 0;
}
if ($tnum < $n)
{
$n = $tnum;
}
$tnum -= $n;
if (0 < $tnum)
{
$completelyBacked = FALSE;
}
}
if ($newTroopStr != '')
{
$newTroopStr .= ',';
}
$newTroopStr .= $tid . ' ' . $tnum;
continue;
}
}
if (!$completelyBacked)
{
if ($reductionTroopsString != '')
{
$reductionTroopsString .= '|';
}
$reductionTroopsString .= $targetVillageId . ':' . $newTroopStr;
continue;
}
continue;
}
else
{
if ($reductionTroopsString != '')
{
$reductionTroopsString .= '|';
}
$reductionTroopsString .= $t_str;
continue;
}
}
return $reductionTroopsString;
}
function _getTroopsForVillage ($troopString, $villageId)
{
if (trim ($troopString) == '')
{
return 0 - 1;
}
$t_arr = explode ('|', $troopString);
foreach ($t_arr as $t_str)
{
$t2_arr = explode (':', $t_str);
if ($t2_arr[0] == $villageId)
{
$troopTable = array ('hasHero' => FALSE, 'heroTroopId' => 0, 'troops' => array ());
$t2_arr = explode (',', $t2_arr[1]);
foreach ($t2_arr as $t2_str)
{
list ($tid, $tnum) = explode (' ', $t2_str);
if ($tid == 99)
{
continue;
}
if ($tnum == 0 - 1)
{
$troopTable['heroTroopId'] = $tid;
$troopTable['hasHero'] = TRUE;
continue;
}
$troopTable['troops'][$tid] = $tnum;
}
return $troopTable;
}
}
//return NULL;
}
function _getMaxBuildingLevel ($itemId)
{
$result = 0;
foreach ($this->buildings as $villageBuild)
{
if (($villageBuild['item_id'] == $itemId AND $result < $villageBuild['level']))
{
$result = $villageBuild['level'];
continue;
}
}
return $result;
}
function _getTheSlowestTroopSpeed2 ($troopsArray)
{
$minSpeed = 0 - 1;
foreach ($troopsArray['troops'] as $tid => $num)
{
if (0 < $num)
{
$speed = $this->gameMetadata['troops'][$tid]['velocity'];
if (($minSpeed == 0 - 1 OR $speed < $minSpeed))
{
$minSpeed = $speed;
continue;
}
continue;
}
}
if ($troopsArray['hasHero'])
{
$htid = $troopsArray['heroTroopId'];
$speed = $this->gameMetadata['troops'][$htid]['velocity'];
if (($minSpeed == 0 - 1 OR $speed < $minSpeed))
{
$minSpeed = $speed;
}
}
$blvl = $this->_getMaxBuildingLevel (14);
$factor = ($blvl == 0 ? 100 : $this->gameMetadata['items'][14]['levels'][$blvl - 1]['value']);
$factor *= $this->gameMetadata['game_speed'];
return $minSpeed * ($factor / 100);
}
function _getTheSlowestTroopSpeed ($troopsArray)
{
$minSpeed = 0 - 1;
foreach ($troopsArray as $tid => $num)
{
if (0 < $num)
{
$speed = $this->gameMetadata['troops'][$tid]['velocity'];
if (($minSpeed == 0 - 1 OR $speed < $minSpeed))
{
$minSpeed = $speed;
continue;
}
continue;
}
}
if ((($this->hasHero AND isset ($_POST['_t'])) AND intval ($_POST['_t']) == 1))
{
$htid = $this->data['hero_troop_id'];
$speed = $this->gameMetadata['troops'][$htid]['velocity'];
if (($minSpeed == 0 - 1 OR $speed < $minSpeed))
{
$minSpeed = $speed;
}
}
$blvl = $this->_getMaxBuildingLevel (14);
$factor = ($blvl == 0 ? 100 : $this->gameMetadata['items'][14]['levels'][$blvl - 1]['value']);
$factor *= $this->gameMetadata['game_speed'];
return $minSpeed * ($factor / 100);
}
function _canBuildNewVillage ()
{
$GameMetadata = $GLOBALS['GameMetadata'];
$neededCpValue = $totalCpRate = $totalCpValue = 0;
$m = new BuildModel ();
$result = $m->getVillagesCp ($this->data['villages_id']);
while ($result->next ())
{
list ($cpValue, $cpRate) = explode (' ', $result->row['cp']);
$cpValue += $result->row['elapsedTimeInSeconds'] * ($cpRate / 86400);
$totalCpRate += $cpRate;
$totalCpValue += $cpValue;
$neededCpValue += intval ($this->gameMetadata['cp_for_new_village'] / $GameMetadata['game_speed']);
}
$totalCpRate = 0;
$totalCpValue = 0;
$m = new BuildModel ();
foreach ( $this->playerVillages as $vid => $pvillage )
{
$result = $m->getVillagesCp ($vid);
while ($result->next ())
{
$tempdata = explode(' ', $result->row['cp']);
$totalCpValue += $tempdata[0];
$totalCpRate += $tempdata[1];
}
}
$totalCpRate = floor($totalCpRate);
$totalCpValue = floor ($totalCpValue);
$m->dispose ();
return $neededCpValue <= $totalCpValue;
}
function __getCoordInRange ($map_size, $x)
{
if ($map_size <= $x)
{
$x -= $map_size;
}
else
{
if ($x < 0)
{
$x = $map_size + $x;
}
}
return $x;
}
function __getVillageId ($map_size, $x, $y)
{
return $x * $map_size + ($y + 1);
}
function _containBuildingTarget ($item_id)
{
$i = 0;
while ($i <= $this->catapultCanAttackLastIndex)
{
if ($this->catapultCanAttack[$i] == $item_id)
{
return TRUE;
}
++$i;
}
return FALSE;
}
}
$p = new GPage ();
$p->run ();
?>
الرجوع الى أعلى الصفحة اذهب الى الأسفل
الـعـز
عضو ذهبي مولع
عضو ذهبي مولع



المساهمات : 169
تاريخ التسجيل : 21/12/2012

شرح سد جميع الثغرات Empty
مُساهمةموضوع: رد: شرح سد جميع الثغرات   شرح سد جميع الثغرات Icon_minitimeالثلاثاء يناير 08, 2013 7:20 pm

جميل
الرجوع الى أعلى الصفحة اذهب الى الأسفل
عزوزالباذر
عضو صاحب مكان
عضو صاحب مكان



المساهمات : 333
تاريخ التسجيل : 01/01/2013
العمر : 29
الموقع : http://ta6wer-tatarwar2013.roo7.biz/

شرح سد جميع الثغرات Empty
مُساهمةموضوع: رد: شرح سد جميع الثغرات   شرح سد جميع الثغرات Icon_minitimeالأربعاء يناير 09, 2013 6:54 am

شكراااااا
الرجوع الى أعلى الصفحة اذهب الى الأسفل
Admin
Admin
Admin
Admin


المساهمات : 737
تاريخ التسجيل : 21/12/2012
العمر : 32
الموقع : http://www.tawr3rab.net

شرح سد جميع الثغرات Empty
مُساهمةموضوع: رد: شرح سد جميع الثغرات   شرح سد جميع الثغرات Icon_minitimeالجمعة يناير 11, 2013 8:40 pm

مشكووووووووووووووووور
الرجوع الى أعلى الصفحة اذهب الى الأسفل
http://www.tawr3rab.net
عزوزالباذر
عضو صاحب مكان
عضو صاحب مكان



المساهمات : 333
تاريخ التسجيل : 01/01/2013
العمر : 29
الموقع : http://ta6wer-tatarwar2013.roo7.biz/

شرح سد جميع الثغرات Empty
مُساهمةموضوع: رد: شرح سد جميع الثغرات   شرح سد جميع الثغرات Icon_minitimeالجمعة يناير 18, 2013 12:43 pm

العفوووووووووووووو
الرجوع الى أعلى الصفحة اذهب الى الأسفل
 
شرح سد جميع الثغرات
الرجوع الى أعلى الصفحة 
صفحة 1 من اصل 1
 مواضيع مماثلة
-
» شرح انواع الثغرات

صلاحيات هذا المنتدى:لاتستطيع الرد على المواضيع في هذا المنتدى
عالم التتار الجديد سرفر التصفيات العربي تصفيات الخليج العربي :: حرب التتار :: ...¦ ¦ تطوير حرب التتار | Tatar war development~...-
انتقل الى: