Kommunauty
Connexion
Inscription

bots pirate


Homer Messages : 1839

Voila, donc on a la flotte d'attaque, on a la planète cible, reste plus qu'à lancer l'attaque ....

J'vais pas tous faire quand même, donc, pour te mettre sur la piste, regarde ce qui se passe quand tu veux lancer une attaque depuis le jeu...

Tu aura tout ce qu'il faut

Je serai pas loin si tu te perd dans les lignes de codes

jeudi 7 février 2013

caroline Messages : 209

je vais essayer j espere pas planter le jeux XD

vendredi 8 février 2013

caroline Messages : 209

oui ok mais sa me dit pas ou je doit mettre tous ca dans quel fichier xd (blonde et fiere)

dimanche 10 février 2013

Homer Messages : 1839

ah, c'est là ou sa se corse, en fait faut savoir quand tu veux qu'il y ai des attaques, un interval régulier, ou complétement au hazare ?

dimanche 10 février 2013

caroline Messages : 209

au hasard style 3 fois pars semaine sur n importe quel joueur

dimanche 10 février 2013

Homer Messages : 1839

oki, alors je peux pas te donner un code sans toucher la base de donner, alors je te propose plutot de mettre le bout de code là ou se passe les mise à jour du classement, et de lui mettre un mt_rand pour lui donner genre 5% de chance d'envoyer une attaque a chaque mise à jour.

Après c'est vraiment aléatoire donc on controle plus si ce n'est baissé le pourcentage si y'a trop d'attaque

dimanche 10 février 2013

Homer Messages : 1839

donc, sa donnerai pour 5% de chance


$Chance = mt_rand(0,100);
if($Chance < 5)
{
le code de l'attaque
}

et ça c'est a mettre dans le fichier class.statbuilder.php dans derniere fonction de la page (final public function MakeStats()) sachant qu'il faut que tu rajoute des variables globales, $db et peut etre d'autre si besoin

dimanche 10 février 2013 (Dernière édition mardi 12 février 2013)

caroline Messages : 209

lol tu veux expliquer depuis le debut puis tous les etapes a faire parce que la je suis perdu xd

dimanche 10 février 2013

Homer Messages : 1839

alors, dans le fichier class.statbuilder.php, derniere fonction (final public function MakeStats())

rajoute en variable Gloabl $db, oublie pas la , avec le $CONF deja existant.

donc, tu met


$Chance = mt_rand(0,100);
if($Chance < 5) // 5 étant le pourcentage de chance, à modifier si tu veux
{
// Génération de la flotte d'attaque
$204 = mr_rand(1,100); // Chasseur leger
$205 = mr_rand(1,80); // chasseur lourd
$206 = mr_rand(1,60); // Croiseur
$207 = mr_rand(1,40); // Vaisseau de bataille
$Fleet = "204,".$204.";205,".$205.";206,".$206.";207".$207.","; // Génération du tableau de flotte

// Selection de la planète - Modifié XX en mettant l'ID du bot créé
$Planetes = $db ->fetchquery("SELECT `id` FROM `".PLANETS."` WHERE `id_owner` != 'XX' && `planet_type` = '1'" );
$PlaneteCible = mt_rand(0,count($Planetes));

// Lancement de l'attaque
.....
}

Reste plus qu'a lancer l'attaque, et ça j'vais te laisser chercher un peu

Regarde l'action qui est fait dans la page classShowFleetPage.php fonction Fleet3, normalement tu as tout pour y arriver

lundi 11 février 2013 (Dernière édition mardi 12 février 2013)

caroline Messages : 209

tu vérifie si c bon kiss

final public function MakeStats()

{

global $db, $CONF;

$this->DeleteSome();

$AllyPoints = array();

$UserPoints = array();

$TotalData = $this->GetUsersInfosFromDB();

$FinalSQL = 'TRUNCATE TABLE '.STATPOINTS.';';

$FinalSQL .= "INSERT INTO ".STATPOINTS." (`id_owner`, `id_ally`, `stat_type`, `universe`, `tech_old_rank`, `tech_points`, `tech_count`, `build_old_rank`, `build_points`, `build_count`, `defs_old_rank`, `defs_points`, `defs_count`, `fleet_old_rank`, `fleet_points`, `fleet_count`, `total_old_rank`, `total_points`, `total_count`) VALUES ";

while($PlanetData = $db->fetch_array($TotalData['Planets']))

{

if((in_array($CONF['stat'], array(1, 2)) && $PlanetData['authlevel'] >= $CONF['stat_level']) || !empty($PlanetData['bana'])) continue;

if(!isset($UserPoints[$PlanetData['id_owner']]))

$UserPoints[$PlanetData['id_owner']]['build']['count'] = $UserPoints[$PlanetData['id_owner']]['build']['points'] = $UserPoints[$PlanetData['id_owner']]['fleet']['count'] = $UserPoints[$PlanetData['id_owner']]['fleet']['points'] = $UserPoints[$PlanetData['id_owner']]['defense']['count'] = $UserPoints[$PlanetData['id_owner']]['defense']['points'] = 0;

$BuildPoints = $this->GetBuildPoints($PlanetData);

$FleetPoints = $this->GetFleetPoints($PlanetData);

$DefensePoints = $this->GetDefensePoints($PlanetData);

$UserPoints[$PlanetData['id_owner']]['build']['count'] += $BuildPoints['count'];

$UserPoints[$PlanetData['id_owner']]['build']['points'] += $BuildPoints['points'];

$UserPoints[$PlanetData['id_owner']]['fleet']['count'] += $FleetPoints['count'];

$UserPoints[$PlanetData['id_owner']]['fleet']['points'] += $FleetPoints['points'];

$UserPoints[$PlanetData['id_owner']]['defense']['count'] += $DefensePoints['count'];

$UserPoints[$PlanetData['id_owner']]['defense']['points'] += $DefensePoints['points'];

}

$db->free_result($TotalData['Planets']);

$UniData = array();

while($UserData = $db->fetch_array($TotalData['Users']))

{

if(!isset($UniData[$UserData['universe']]))

$UniData[$UserData['universe']] = 0;

$UniData[$UserData['universe']]++;

if ((in_array($CONF['stat'], array(1, 2)) && $UserData['authlevel'] >= $CONF['stat_level']) || !empty($UserData['bana']))

{

$FinalSQL .= "(".$UserData['id'].",".$UserData['ally_id'].",1,".$UserData['universe'].",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), ";

continue;

}

$TechnoPoints = $this->GetTechnoPoints($UserData);

$UserPoints[$UserData['id']]['techno']['count'] = $TechnoPoints['count'];

$UserPoints[$UserData['id']]['techno']['points'] = $TechnoPoints['points'];

if(isset($TotalData['Fleets'][$UserData['id']]))

{

foreach($TotalData['Fleets'][$UserData['id']] as $FleetArray)

{

$FlyingFleetPoints = $this->GetFlyingFleetPoints($FleetArray);

$UserPoints[$UserData['id']]['fleet']['count'] += $FlyingFleetPoints['count'];

$UserPoints[$UserData['id']]['fleet']['points'] += $FlyingFleetPoints['points'];

}

}

$UserPoints[$UserData['id']]['total']['count'] = $UserPoints[$UserData['id']]['techno']['count'] + $UserPoints[$UserData['id']]['build']['count'] + $UserPoints[$UserData['id']]['defense']['count'] + $UserPoints[$UserData['id']]['fleet']['count'];

$UserPoints[$UserData['id']]['total']['points'] = $UserPoints[$UserData['id']]['techno']['points'] + $UserPoints[$UserData['id']]['build']['points'] + $UserPoints[$UserData['id']]['defense']['points'] + $UserPoints[$UserData['id']]['fleet']['points'];

if($UserData['ally_id'] != 0)

{

if(!isset($AllyPoints[$UserData['ally_id']]))

$AllyPoints[$UserData['ally_id']]['build']['count'] = $AllyPoints[$UserData['ally_id']]['build']['points'] = $AllyPoints[$UserData['ally_id']]['fleet']['count'] = $AllyPoints[$UserData['ally_id']]['fleet']['points'] = $AllyPoints[$UserData['ally_id']]['defense']['count'] = $AllyPoints[$UserData['ally_id']]['defense']['points'] = $AllyPoints[$UserData['ally_id']]['techno']['count'] = $AllyPoints[$UserData['ally_id']]['techno']['points'] = $AllyPoints[$UserData['ally_id']]['total']['count'] = $AllyPoints[$UserData['ally_id']]['total']['points'] = 0;

$AllyPoints[$UserData['ally_id']]['build']['count'] += $UserPoints[$UserData['id']]['build']['count'];

$AllyPoints[$UserData['ally_id']]['build']['points'] += $UserPoints[$UserData['id']]['build']['points'];

$AllyPoints[$UserData['ally_id']]['fleet']['count'] += $UserPoints[$UserData['id']]['fleet']['count'];

$AllyPoints[$UserData['ally_id']]['fleet']['points'] += $UserPoints[$UserData['id']]['fleet']['points'];

$AllyPoints[$UserData['ally_id']]['defense']['count'] += $UserPoints[$UserData['id']]['defense']['count'];

$AllyPoints[$UserData['ally_id']]['defense']['points'] += $UserPoints[$UserData['id']]['defense']['points'];

$AllyPoints[$UserData['ally_id']]['techno']['count'] += $UserPoints[$UserData['id']]['techno']['count'];

$AllyPoints[$UserData['ally_id']]['techno']['points'] += $UserPoints[$UserData['id']]['techno']['points'];

$AllyPoints[$UserData['ally_id']]['total']['count'] += $UserPoints[$UserData['id']]['total']['count'];

$AllyPoints[$UserData['ally_id']]['total']['points'] += $UserPoints[$UserData['id']]['total']['points'];

}

$FinalSQL .= "('".$UserData['id']."','".$UserData['ally_id']."', 1, ".$UserData['universe'].", '".(int)$UserData['old_tech_rank']."', '".floattostring($UserPoints[$UserData['id']]['techno']['points'])."', '".floattostring($UserPoints[$UserData['id']]['techno']['count'])."', '".(int)$UserData['old_build_rank']."','".floattostring($UserPoints[$UserData['id']]['build']['points'])."', '".floattostring($UserPoints[$UserData['id']]['build']['count'])."', '".(int)$UserData['old_defs_rank']."', '".floattostring($UserPoints[$UserData['id']]['defense']['points'])."', '".floattostring($UserPoints[$UserData['id']]['defense']['count'])."', '".(int)$UserData['old_fleet_rank']."', '".floattostring($UserPoints[$UserData['id']]['fleet']['points'])."', '".floattostring($UserPoints[$UserData['id']]['fleet']['count'])."', '".(int)$UserData['old_total_rank']."', '".floattostring($UserPoints[$UserData['id']]['total']['points'])."', '".floattostring($UserPoints[$UserData['id']]['total']['count'])."'), ";

}

$db->free_result($TotalData['Users']);

$FinalSQL = substr($FinalSQL, 0, -2).';';

$this->SaveDataIntoDB($FinalSQL);

unset($UserPoints);

if(count($AllyPoints) != 0)

{

$AllySQL = "INSERT INTO ".STATPOINTS." (`id_owner`, `id_ally`, `stat_type`, `universe`, `tech_old_rank`, `tech_points`, `tech_count`, `build_old_rank`, `build_points`, `build_count`, `defs_old_rank`, `defs_points`, `defs_count`, `fleet_old_rank`, `fleet_points`, `fleet_count`, `total_old_rank`, `total_points`, `total_count`) VALUES ";

while($AllianceData = $db->fetch_array($TotalData['Alliance']))

{

$AllySQL .= "('".$AllianceData['id']."', 0, 2, ".$AllianceData['ally_universe'].",'".(int)$AllyPoints['old_tech_rank']."', '".floattostring($AllyPoints[$AllianceData['id']]['techno']['points'])."', '".floattostring($AllyPoints[$AllianceData['id']]['techno']['count'])."', '".(int)$AllianceData['old_build_rank']."', '".floattostring($AllyPoints[$AllianceData['id']]['build']['points'])."', '".floattostring($AllyPoints[$AllianceData['id']]['build']['count'])."', '".(int)$AllianceData['old_defs_rank']."', '".floattostring($AllyPoints[$AllianceData['id']]['defense']['points'])."', '".floattostring($AllyPoints[$AllianceData['id']]['defense']['count'])."', '".(int)$AllianceData['old_fleet_rank']."', '".floattostring($AllyPoints[$AllianceData['id']]['fleet']['points'])."', '".floattostring($AllyPoints[$AllianceData['id']]['fleet']['count'])."', '".(int)$AllianceData['old_total_rank']."', '".floattostring($AllyPoints[$AllianceData['id']]['total']['points'])."', '".floattostring($AllyPoints[$AllianceData['id']]['total']['count'])."'), ";

}

unset($AllyPoints);

$AllySQL = substr($AllySQL, 0, -2).';';

$this->SaveDataIntoDB($AllySQL);

}

$db->free_result($TotalData['Alliance']);

$RankSQL = $this->SetNewRanks();

$this->SaveDataIntoDB($RankSQL);

$this->CheckUniverseAccounts($UniData);

$this->BuildRecordCache();

$this->AnotherCronJobs();

return $this->SomeStatsInfos();

}

}

global $db, $CONF;

$Chance = mt_rand(0,100)

if($Chance < 5) // 5 étant le pourcentage de chance, à modifier si tu veux

{

// Génération de la flotte d'attaque

$204 = mr_rand(1,100); // Chasseur leger

$205 = mr_rand(1,80); // chasseur lourd

$206 = mr_rand(1,60); // Croiseur

$207 = mr_rand(1,40); // Vaisseau de bataille

§211 = mr_rand(1,30);

§213 = mr_rand(1,20);

§214 = mr_rand(1,10);

$Fleet = "204,".$204.";205,".$205.";206,".$206.";207,".$207.";211,".§211.";213,".§213.";214,".§214.",";

}

$Planetes = $db ->fetchquery("SELECT `id` FROM `".PLANETS."` WHERE `id_owner` != '101' && `planet_type` = '1'" );

$PlaneteCible = mt_rand(0,count($Planetes));

}

global $USER, $PLANET, $resource, $pricelist, $reslist, $CONF, $db, $LNG, $UNI;

}

include_once(ROOT_PATH . 'includes/functions/IsVacationMode.php');

$template = new template();

$template->loadscript('flotten.js');

$template->gotoside('?page=fleet');

$mission = request_var('mission', 3);

$galaxy = request_var('galaxy', 0);

$system = request_var('system', 0);

$planet = request_var('planet', 0);

$planettype = request_var('planettype', 0);

$fleet_group = request_var('fleet_group', 0);

$GenFleetSpeed = request_var('speed', 0);

$TransportMetal = request_outofint('metal');

$TransportCrystal = request_outofint('crystal');

$TransportDeuterium = request_outofint('deuterium');

$TransportNorio = request_outofint('norio');

$holdingtime = request_var('holdingtime', 0);

$rawfleetarray = request_var('usedfleet', '', true);

if (IsVacationMode($USER))

exit($template->message($LNG['fl_vacation_mode_active'], 'game.php?page=overview', 2));

if ($_SESSION['last']['user_side'] != 'game.php?page=fleet2')

parent::GotoFleetPage();

if (!($planettype >= 1 || $planettype <= 3))

parent::GotoFleetPage();

if ($PLANET['galaxy'] == $galaxy && $PLANET['system'] == $system && $PLANET['planet'] == $planet && $PLANET['planet_type'] == $planettype)

parent::GotoFleetPage();

if ($galaxy > MAX_GALAXY_IN_WORLD || $galaxy < 1 || $system > MAX_SYSTEM_IN_GALAXY || $system < 1 || $planet > (MAX_PLANET_IN_SYSTEM + 1) || $planet < 1)

parent::GotoFleetPage();

if (empty($mission))

parent::GotoFleetPage();

if (!is_numeric($TransportMetal) || !is_numeric($TransportCrystal) || !is_numeric($TransportDeuterium) || !is_numeric($TransportNorio))

parent::GotoFleetPage();

if ($TransportMetal + $TransportCrystal + $TransportDeuterium + $TransportNorio < 1 && $mission == 3)

{

$template->message("<b>".$LNG['fl_empty_transport']."</b>", "game.php?page=fleet", 1);

exit;

}

}

?>

lundi 11 février 2013

Page suivante »