Prechádzať zdrojové kódy

[Enhancement] Show parents in list

Foppe Hemminga 5 rokov pred
rodič
commit
32aae2e6f3
3 zmenil súbory, kde vykonal 106 pridanie a 47 odobranie
  1. 1 1
      cron.py
  2. 96 42
      properties.php
  3. 9 4
      snippets.php

+ 1 - 1
cron.py

@@ -91,7 +91,7 @@ def cron():
         for player in players:
             # Rows for this maintainer
             print(f"{player['maintainer']} - {player['api']} - {player['player']} - {player['property']}")
-            url = f"https://api.torn.com/user/{player['player']}?selections=personalstats,basic,crimes&key={player['api']}"
+            url = f"https://api.torn.com/user/{player['player']}?selections=personalstats,basic,crimes,profile&key={player['api']}"
             print(url)
             response = requests.get(url)
             player_json = None

+ 96 - 42
properties.php

@@ -6,45 +6,57 @@ $properties = json_decode( '{
 	"level": 95,
 	"gender": "Female",
 	"player_id": 123123123,
-	"name": "onetwothree",
+	"name": "onttwothree",
+	"rank": "Elite Trader",
+	"property": "Private Island",
+	"signup": "2015-02-17 17:31:35",
+	"awards": 464,
+	"friends": 576,
+	"enemies": 109,
+	"forum_posts": 1610,
+	"karma": 709,
+	"age": 1903,
+	"role": "Civilian",
+	"donator": 1,
+	"property_id": 2008619,
 	"personalstats": {
-		"useractivity": 26835837,
+		"useractivity": 26842211,
 		"logins": 4361,
 		"weaponsbought": 11148,
-		"attackmisses": 23164,
-		"attackdamage": 59351490,
-		"attackhits": 52858,
+		"attackmisses": 23172,
+		"attackdamage": 59366907,
+		"attackhits": 52882,
 		"axehits": 1067,
-		"attackswon": 14060,
+		"attackswon": 14064,
 		"highestbeaten": 100,
 		"bestkillstreak": 504,
 		"jailed": 306,
 		"mailssent": 1725,
-		"attackcriticalhits": 10820,
-		"slahits": 426,
+		"attackcriticalhits": 10825,
+		"slahits": 427,
 		"moneymugged": 19552822850,
 		"largestmug": 1000026663,
 		"friendmailssent": 375,
-		"roundsfired": 271197,
-		"pishits": 347,
+		"roundsfired": 271310,
+		"pishits": 349,
 		"defendswon": 2765,
 		"hospital": 8416,
 		"defendslost": 3737,
 		"rifhits": 6620,
 		"attackslost": 797,
 		"attacksassisted": 336,
-		"attacksstealthed": 8336,
-		"onehitkills": 6547,
+		"attacksstealthed": 8338,
+		"onehitkills": 6548,
 		"dumpsearches": 1026,
 		"dumpfinds": 1026,
 		"itemsdumped": 5050,
-		"itemssent": 3568,
-		"drugsused": 5358,
+		"itemssent": 3569,
+		"drugsused": 5361,
 		"cantaken": 77,
 		"auctionswon": 16,
-		"daysbeendonator": 1883,
+		"daysbeendonator": 1884,
 		"spousemailssent": 104,
-		"medicalitemsused": 21768,
+		"medicalitemsused": 21791,
 		"companymailssent": 185,
 		"trainsreceived": 1071,
 		"cityfinds": 522,
@@ -53,12 +65,12 @@ $properties = json_decode( '{
 		"peoplebusted": 3002,
 		"pointsbought": 44095,
 		"itemsbought": 3426,
-		"xantaken": 4818,
-		"traveltimes": 3488,
+		"xantaken": 4821,
+		"traveltimes": 3490,
 		"mextravel": 483,
-		"itemsboughtabroad": 93119,
-		"cantravel": 462,
-		"lontravel": 390,
+		"itemsboughtabroad": 93148,
+		"cantravel": 463,
+		"lontravel": 391,
 		"caytravel": 418,
 		"argtravel": 350,
 		"hawtravel": 165,
@@ -75,14 +87,14 @@ $properties = json_decode( '{
 		"medstolen": 8,
 		"attacksdraw": 218,
 		"virusescoded": 125,
-		"yourunaway": 157,
+		"yourunaway": 158,
 		"victaken": 84,
 		"overdosed": 109,
 		"revivesreceived": 806,
 		"auctionsells": 15,
 		"exttaken": 246,
 		"kettaken": 50,
-		"respectforfaction": 76343,
+		"respectforfaction": 76352,
 		"smghits": 1663,
 		"bountiesreceived": 206,
 		"factionmailssent": 173,
@@ -91,11 +103,11 @@ $properties = json_decode( '{
 		"chahits": 234,
 		"machits": 119,
 		"heahits": 697,
-		"networth": 30999395805,
+		"networth": 30913812683,
 		"grehits": 276,
-		"missioncreditsearned": 40991,
-		"contractscompleted": 1024,
-		"dukecontractscompleted": 1024,
+		"missioncreditsearned": 41062,
+		"contractscompleted": 1026,
+		"dukecontractscompleted": 1026,
 		"revives": 663,
 		"missionscompleted": 1,
 		"bountiesplaced": 487,
@@ -105,29 +117,29 @@ $properties = json_decode( '{
 		"defendsstalemated": 28,
 		"meritsbought": 45,
 		"opitaken": 14,
-		"nerverefills": 1412,
-		"consumablesused": 24815,
+		"nerverefills": 1413,
+		"consumablesused": 24821,
 		"candyused": 1838,
 		"alcoholused": 13924,
-		"energydrinkused": 9053,
+		"energydrinkused": 9059,
 		"tokenrefills": 202,
 		"organisedcrimes": 158,
 		"booksread": 10,
-		"h2hhits": 147,
+		"h2hhits": 148,
 		"classifiedadsplaced": 6,
-		"traveltime": 38079060,
+		"traveltime": 38094300,
 		"unarmoredwon": 261,
 		"stockpayouts": 489,
-		"boostersused": 1189,
+		"boostersused": 1190,
 		"territorytime": 2655360,
 		"rehabs": 6695,
 		"rehabcost": 1410430000,
-		"awards": 462,
+		"awards": 464,
 		"statenhancersused": 5,
 		"bestdamage": 11472,
-		"racingpointsearned": 2139,
+		"racingpointsearned": 2146,
 		"raceswon": 701,
-		"racesentered": 2402,
+		"racesentered": 2410,
 		"receivedbountyvalue": 88109384,
 		"pcptaken": 1,
 		"cityitemsbought": 85276,
@@ -137,13 +149,13 @@ $properties = json_decode( '{
 		"tracerammoused": 2498,
 		"incendiaryammoused": 2493,
 		"piercingammoused": 1986,
-		"refills": 1614
+		"refills": 1615
 	},
 	"status": {
-		"description": "Okay",
+		"description": "Traveling to Canada",
 		"details": "",
-		"state": "Okay",
-		"color": "green",
+		"state": "Traveling",
+		"color": "blue",
 		"until": 0
 	},
 	"criminalrecord": {
@@ -151,11 +163,53 @@ $properties = json_decode( '{
 		"theft": 25055,
 		"auto_theft": 3003,
 		"drug_deals": 697,
-		"computer_crimes": 7172,
+		"computer_crimes": 7206,
 		"murder": 10019,
 		"fraud_crimes": 10340,
 		"other": 5007,
-		"total": 66296
+		"total": 66330
+	},
+	"life": {
+		"current": 6937,
+		"maximum": 6937,
+		"increment": 416,
+		"interval": 300,
+		"ticktime": 8,
+		"fulltime": 0
+	},
+	"job": {
+		"position": "Director",
+		"company_id": 68490,
+		"company_name": "Farmers Market 🐄"
+	},
+	"faction": {
+		"position": "Member",
+		"faction_id": 8336,
+		"days_in_faction": 1612,
+		"faction_name": "Relentless"
+	},
+	"married": {
+		"spouse_id": 1926474,
+		"spouse_name": "adlowe07",
+		"duration": 1667
+	},
+	"basicicons": {
+		"icon7": "Female",
+		"icon3": "Donator",
+		"icon8": "Married - To adlowe07",
+		"icon73": "Company - Director of Farmers Market 🐄 (Farm)",
+		"icon9": "Faction - Member of Relentless",
+		"icon35": "Bazaar - This person has items in their bazaar for sale",
+		"icon71": "Traveling"
+	},
+	"states": {
+		"hospital_timestamp": 0,
+		"jail_timestamp": 0
+	},
+	"last_action": {
+		"status": "Offline",
+		"timestamp": 1588623674,
+		"relative": "28 minutes ago"
 	}
 }');
 

+ 9 - 4
snippets.php

@@ -161,12 +161,12 @@ QUERY;
 		}
 	}
 	$query = <<<QUERY
-	SELECT property, parent FROM properties;
+	SELECT property, parent FROM properties ORDER BY parent DESC;
 QUERY;
 	$stmt = $pdo->query( $query );
 	$properties = [];
 	foreach ($stmt as $row) {
-		$properties[] = $row['property'];
+		$properties[] = [$row['property'], $row['parent']];
 	}
 	$snippets[3] = '';
 	/*
@@ -198,12 +198,17 @@ HTML;
 	print_r( $player_properties );
 	print( "</pre>" );
 	*/
+	$parent = '';
 	foreach ( $properties as $property ) {
+		if ( $property[1] != $parent ) {
+			$parent = $property[1];
+			$snippets[3] .= "\t\t\t\t<option disabled>${parent}</option>";
+		}
 		$selected = '';
-		if ( in_array( $property, $player_properties[0] ) ) {
+		if ( in_array( $property[0], $player_properties[0] ) ) {
 			$selected = ' selected';
 		}
-		$snippets[3] .= "\t\t\t\t<option${selected}>${property}</option>\n";
+		$snippets[3] .= "\t\t\t\t<option${selected}>${property[0]}</option>\n";
 	}
 	$snippets[3] .= <<<HTML
 			</select>