-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapi_load_toons.php
44 lines (37 loc) · 1.37 KB
/
api_load_toons.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?
if(strpos($_SERVER['SERVER_NAME'], "docker")===false) {
require_once("../vars.php");
require_once("../libs.php");
require_once("../api_swgoh_help3.php");
$db = new mymysqli("swgoh");
error_reporting(0);
} else {
require_once("../../vars.php");
require_once("../libs.php");
require_once("../api_swgoh_help3.php");
$db = new mymysqli("swgoh");
error_reporting(E_ALL);
}
?>
<pre>
<?
try {
//https://api.swgoh.help/swgoh
$swgoh = new SwgohHelp($swgohHelpKeys);
$db->query("DELETE FROM swgoh_toons2");
$data = $swgoh->fetchData('unitsList',"eng_us",array("rarity"=>7,"obtainable"=>true,"obtainableTime"=>0),array("id"=>1,"nameKey"=>1,"combatType"=>1,"obtainable"=>1,"maxRarity"=>1,"forceAlignment"=>1,"obtainableTime"=>1));
print_r($data);
foreach($data as $toon) {
$id = explode(":", $toon->id);
if($toon->obtainable && $toon->maxRarity==7 && $toon->obtainableTime==0) {
$db->query("REPLACE INTO swgoh_toons2(id,name,type) VALUES('".$db->str($id[0])."','".$db->str($toon->nameKey)."',".intval($toon->combatType).")");
echo $toon->nameKey."<br />";
}
}
//TODO: Get farming locations
// $data = $swgoh->fetchData('materialList',"eng_us",array("type"=>3),array("id"=>1,"nameKey"=>1,"lookupMissionList"=>1));
// print_r($data);
} catch(Exception $e) {
echo $e;
}
?>