Skip to content

Commit

Permalink
Merge pull request #7 from OGSteam/v1.2.0
Browse files Browse the repository at this point in the history
V1.2.0
  • Loading branch information
Roms0406 authored Jan 10, 2020
2 parents 43d2bb0 + 6808415 commit a37bd80
Show file tree
Hide file tree
Showing 8 changed files with 178 additions and 69 deletions.
28 changes: 19 additions & 9 deletions _xtense.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function getCallbacks() {
define("TABLE_EXPEDITION_FLEET", $table_prefix."eXpedition_fleet"); // 2 - Vaisseaux
define("TABLE_EXPEDITION_MERCH", $table_prefix."eXpedition_merch"); // 3 - Marchand
define("TABLE_EXPEDITION_ATTACKS", $table_prefix."eXpedition_attacks"); // 4 - Attaques
define("TABLE_EXPEDITION_ITEMS", $table_prefix."eXpedition_items"); // 5 - Attaques
define("TABLE_EXPEDITION_ITEMS", $table_prefix."eXpedition_items"); // 5 - Items

function logging($msg)
{
Expand Down Expand Up @@ -89,8 +89,7 @@ function eXpedition_analysis($uid, $galaxy, $system, $timestamp, $content)
"/Une espèce inconnue attaque notre expédition/",
"/Des barbares primitifs nous attaquent/"];

$regexItems = ["/L\`objet ([A-z ]+) en ([A-z]+) a été ajouté à l\`inventaire/",
"/L\'objet ([A-z ]+) en ([A-z]+) a été ajouté à l\'inventaire/"];
$regexItems = "/L\`objet ([A-zé ]+) en ([A-z]+) a été ajouté à l\`inventaire/";

// Check if new
$query = "SELECT *
Expand All @@ -108,7 +107,7 @@ function eXpedition_analysis($uid, $galaxy, $system, $timestamp, $content)
logging("Flotte0".$expFleet[0]);
logging("Flotte1".$expFleet[1]);
// Init
$pt = $gt = $cle = $clo = $cr = $vb = $vc = $rec = $se = $bmb = $dst = $tra = 0;
$pt = $gt = $cle = $clo = $cr = $vb = $vc = $rec = $se = $bmb = $dst = $tra = $fau = $ecl = 0;
$units = 0;

// Looking for specifics
Expand Down Expand Up @@ -160,6 +159,14 @@ function eXpedition_analysis($uid, $galaxy, $system, $timestamp, $content)
$tra = $reg[1];
$units += ( 30 + 40 + 15 ) * $tra;
}
if(preg_match("/Faucheur:\s(\d+)/", $expFleet[1], $reg)){
$fau = $reg[1];
$units += ( 85 + 55 + 20 ) * $fau;
}
if(preg_match("/Éclaireur:\s(\d+)/", $expFleet[1], $reg)){
$ecl = $reg[1];
$units += ( 8 + 15 + 8 ) * $ecl;
}

$query =
"INSERT INTO ".TABLE_EXPEDITION."
Expand All @@ -170,8 +177,8 @@ function eXpedition_analysis($uid, $galaxy, $system, $timestamp, $content)

$query =
"Insert into ".TABLE_EXPEDITION_FLEET."
(id_eXpedition, pt, gt, cle, clo, cr, vb, vc, rec, se, bmb, dst, tra, units)
values ($idInsert, $pt, $gt, $cle, $clo, $cr, $vb, $vc, $rec, $se, $bmb, $dst, $tra, $units)";
(id_eXpedition, pt, gt, cle, clo, cr, vb, vc, rec, se, bmb, dst, tra, fau, ecl, units)
values ($idInsert, $pt, $gt, $cle, $clo, $cr, $vb, $vc, $rec, $se, $bmb, $dst, $tra, $fau, $ecl, $units)";
$db->sql_query($query);

return true;
Expand Down Expand Up @@ -385,7 +392,7 @@ function attack_analysis ($user_id, $rapport)
$defender = $json->defenderJSON;
$lastRound = $defender->combatRounds[count($defender->combatRounds)-1];

$ships = array('PT', 'GT', 'CLE', 'CLO', 'CR', 'VB', 'VC', 'REC', 'SE', 'BMD', 'DST', 'EDLM', 'TRA');
$ships = array('PT', 'GT', 'CLE', 'CLO', 'CR', 'VB', 'VC', 'REC', 'SE', 'BMD', 'DST', 'EDLM', 'TRA', 'FAU', 'ECL');
$ships = array_fill_keys($ships, 0);

$correspondance = array('202' => 'PT', '203' => 'GT',
Expand All @@ -394,7 +401,8 @@ function attack_analysis ($user_id, $rapport)
'208' => 'VC','209' => 'REC',
'210' => 'SE', '211' => 'BMD',
'212' => 'SAT', '213' => 'DST',
'214' => 'EDLM', '215' => 'TRA');
'214' => 'EDLM', '215' => 'TRA',
'218' => 'FAU', '219' => 'ECL');

if(isset($lastRound->losses->$defenderId)) {
$losses = $lastRound->losses->$defenderId;
Expand All @@ -408,7 +416,7 @@ function attack_analysis ($user_id, $rapport)
$db->sql_query($query);
$idInsert = $db->sql_insertid();

$query = "INSERT INTO " . TABLE_EXPEDITION_ATTACKS . " (id_eXpedition, pt, gt, cle, clo, cr, vb, vc, rec, se, bmb, dst, edlm, tra)
$query = "INSERT INTO " . TABLE_EXPEDITION_ATTACKS . " (id_eXpedition, pt, gt, cle, clo, cr, vb, vc, rec, se, bmb, dst, edlm, tra, fau, ecl)
VALUES ($idInsert ";
$query .= "," . $ships['PT'];
$query .= "," . $ships['GT'];
Expand All @@ -423,6 +431,8 @@ function attack_analysis ($user_id, $rapport)
$query .= "," . $ships['DST'];
$query .= "," . $ships['EDLM'];
$query .= "," . $ships['TRA'];
$query .= "," . $ships['FAU'];
$query .= "," . $ships['ECL'];
$query .= ")";
$db->sql_query($query);

Expand Down
68 changes: 36 additions & 32 deletions detail.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

if (!defined('IN_SPYOGAME')) die("Hacking attempt"); // Pas daccès direct
if (!defined('IN_SPYOGAME')) die("Hacking attempt"); // Hack Protection

include("expedition_css.php");
include('header.php');
Expand Down Expand Up @@ -163,25 +163,27 @@
<td class="c" style="width: 200px;">Date</td>
<td class="c" style="width: 75px;">Position</td>
<td style="width: 20px;"></td>
<td class="c" style="width: 30px;">PT</td>
<td class="c" style="width: 30px;">GT</td>
<td class="c" style="width: 30px;">CLE</td>
<td class="c" style="width: 30px;">CLO</td>
<td class="c" style="width: 30px;">CR</td>
<td class="c" style="width: 30px;">VB</td>
<td class="c" style="width: 30px;">VC</td>
<td class="c" style="width: 30px;">REC</td>
<td class="c" style="width: 30px;">SE</td>
<td class="c" style="width: 30px;">BMB</td>
<td class="c" style="width: 30px;">DST</td>
<td class="c" style="width: 30px;">TRA</td>
<td class="c" style="width: 30px;">Unités</td>
<td class="c" style="width: 26px;">PT</td>
<td class="c" style="width: 26px;">GT</td>
<td class="c" style="width: 26px;">CLE</td>
<td class="c" style="width: 26px;">CLO</td>
<td class="c" style="width: 26px;">CR</td>
<td class="c" style="width: 26px;">VB</td>
<td class="c" style="width: 26px;">VC</td>
<td class="c" style="width: 26px;">REC</td>
<td class="c" style="width: 26px;">SE</td>
<td class="c" style="width: 26px;">BMB</td>
<td class="c" style="width: 26px;">DST</td>
<td class="c" style="width: 26px;">TRA</td>
<td class="c" style="width: 26px;">FAU</td>
<td class="c" style="width: 26px;">ECL</td>
<td class="c" style="width: 26px;">Unités</td>
</tr>
</thead>
<tbody>
<?php
if (count($data['Fleet']) != 0) {
$keys = array('pt', 'gt', 'cle', 'clo', 'cr', 'vb', 'vc', 'rec', 'se', 'bmb', 'dst', 'tra', 'units');
$keys = array('pt', 'gt', 'cle', 'clo', 'cr', 'vb', 'vc', 'rec', 'se', 'bmb', 'dst', 'tra', 'fau', 'ecl', 'units');
foreach ($data['Fleet'] as $date => $resDate) {
?>
<tr class="total-line">
Expand Down Expand Up @@ -218,7 +220,7 @@
<?php
foreach ($keys as $key) {
?>
<td class='b' align=center style="width: 30px;"><?php echo $detail[$key] ?></td>
<td class='b' align=center style="width: 26px;"><?php echo $detail[$key] ?></td>
<?php
}
?>
Expand Down Expand Up @@ -260,7 +262,7 @@
<tr class="total-line">
<?php if ($typeUser == 0) { ?>
<th style="medium-td"></th>
<th style="width: 20px;"></th>
<th style="width: 20px; font-weight: bold;"></th>
<?php } ?>
<th align=center style="width: 200px;"><?php echo $date ?></th>
<th align=center style="width: 75px;"><?php echo (string)$resDate['Total']['count'] ?></th>
Expand Down Expand Up @@ -368,25 +370,27 @@
<td class="c" style="width: 200px;">Date</td>
<td class="c" style="width: 75px;">Position</td>
<td style="width: 20px;"></td>
<td class="c" style="width: 30px;">PT</td>
<td class="c" style="width: 30px;">GT</td>
<td class="c" style="width: 30px;">CLE</td>
<td class="c" style="width: 30px;">CLO</td>
<td class="c" style="width: 30px;">CR</td>
<td class="c" style="width: 30px;">VB</td>
<td class="c" style="width: 30px;">VC</td>
<td class="c" style="width: 30px;">REC</td>
<td class="c" style="width: 30px;">SE</td>
<td class="c" style="width: 30px;">BMB</td>
<td class="c" style="width: 30px;">DST</td>
<td class="c" style="width: 30px;">EDLM</td>
<td class="c" style="width: 30px;">TRA</td>
<td class="c" style="width: 26px;">PT</td>
<td class="c" style="width: 26px;">GT</td>
<td class="c" style="width: 26px;">CLE</td>
<td class="c" style="width: 26px;">CLO</td>
<td class="c" style="width: 26px;">CR</td>
<td class="c" style="width: 26px;">VB</td>
<td class="c" style="width: 26px;">VC</td>
<td class="c" style="width: 26px;">REC</td>
<td class="c" style="width: 26px;">SE</td>
<td class="c" style="width: 26px;">BMB</td>
<td class="c" style="width: 26px;">DST</td>
<td class="c" style="width: 26px;">EDLM</td>
<td class="c" style="width: 26px;">TRA</td>
<td class="c" style="width: 26px;">FAU</td>
<td class="c" style="width: 26px;">ECL</td>
</tr>
</thead>
<tbody>
<?php
if (count($data['Attacks']) != 0) {
$keys = array('pt', 'gt', 'cle', 'clo', 'cr', 'vb', 'vc', 'rec', 'se', 'bmb', 'dst', 'edlm', 'tra');
$keys = array('pt', 'gt', 'cle', 'clo', 'cr', 'vb', 'vc', 'rec', 'se', 'bmb', 'dst', 'edlm', 'tra', 'fau', 'ecl');
foreach ($data['Attacks'] as $date => $resDate) {
?>
<tr class="total-line">
Expand Down Expand Up @@ -423,7 +427,7 @@
<?php
foreach ($keys as $key) {
?>
<td class='b' align=center style="width: 30px;"><?php echo $detail[$key] ?></td>
<td class='b' align=center style="width: 26px;"><?php echo $detail[$key] ?></td>
<?php
}
?>
Expand Down
Loading

0 comments on commit a37bd80

Please sign in to comment.