Add files via upload
This commit is contained in:
parent
396a707b93
commit
8f174af37f
|
@ -0,0 +1,150 @@
|
|||
{
|
||||
"EN": {
|
||||
"AppVer": "1.4.1",
|
||||
"Challanges": [
|
||||
{
|
||||
"dsp_type": "0",
|
||||
"end_at": "2100-12-31 23:59:59",
|
||||
"id": "19",
|
||||
"kind": "2",
|
||||
"reward1": "1,tg18_ac15036_1",
|
||||
"reward10": "50,tg18_bg15005",
|
||||
"reward2": "3,tg18_as15019_1",
|
||||
"reward3": "5,tg18_oy15024_1",
|
||||
"reward4": "10,tg18_as15001_1",
|
||||
"reward5": "15,tg18_as15015_1",
|
||||
"reward6": "20,tg18_bg15010",
|
||||
"reward7": "25,tg18_as15021_1",
|
||||
"reward8": "30,tg18_bg15018",
|
||||
"reward9": "40,tg18_as15016_1",
|
||||
"start_at": "2020-03-27 15:00:00",
|
||||
"title": "Play the game in the Park and earn at least 1 point!"
|
||||
},
|
||||
{
|
||||
"dsp_type": "0",
|
||||
"end_at": "2100-12-31 23:59:59",
|
||||
"id": "20",
|
||||
"kind": "2",
|
||||
"reward1": "1,tg18_ac15043_1",
|
||||
"reward10": "50,tg18_as15009_1",
|
||||
"reward2": "3,tg18_gh15007_1",
|
||||
"reward3": "5,tg18_gh15001_1",
|
||||
"reward4": "10,tg18_gh15004_1",
|
||||
"reward5": "15,tg18_gh15013_1",
|
||||
"reward6": "20,tg18_gh15015_1",
|
||||
"reward7": "25,tg18_gh15010_1",
|
||||
"reward8": "30,tg18_gh15002_1",
|
||||
"reward9": "40,tg18_as15013_1",
|
||||
"start_at": "2020-03-27 15:00:00",
|
||||
"title": "Play the Restaurant game and earn at least 1 point!"
|
||||
},
|
||||
{
|
||||
"dsp_type": "0",
|
||||
"end_at": "2100-12-31 23:59:59",
|
||||
"id": "21",
|
||||
"kind": "2",
|
||||
"reward1": "1,tg18_ac15041_1",
|
||||
"reward10": "0",
|
||||
"reward2": "0",
|
||||
"reward3": "0",
|
||||
"reward4": "0",
|
||||
"reward5": "0",
|
||||
"reward6": "0",
|
||||
"reward7": "0",
|
||||
"reward8": "0",
|
||||
"reward9": "0",
|
||||
"start_at": "2020-03-27 15:00:00",
|
||||
"title": "Update your area in My Profile."
|
||||
},
|
||||
{
|
||||
"dsp_type": "0",
|
||||
"end_at": "2100-12-31 23:59:59",
|
||||
"id": "22",
|
||||
"kind": "2",
|
||||
"reward1": "1,tg18_ac15030_1",
|
||||
"reward10": "0",
|
||||
"reward2": "0",
|
||||
"reward3": "0",
|
||||
"reward4": "0",
|
||||
"reward5": "0",
|
||||
"reward6": "0",
|
||||
"reward7": "0",
|
||||
"reward8": "0",
|
||||
"reward9": "0",
|
||||
"start_at": "2020-03-27 15:00:00",
|
||||
"title": "Update your avatar in My Profile."
|
||||
},
|
||||
{
|
||||
"dsp_type": "0",
|
||||
"end_at": "2100-12-31 23:59:59",
|
||||
"id": "23",
|
||||
"kind": "2",
|
||||
"reward1": "1,tg18_oy15021_1",
|
||||
"reward10": "50,tg18_bg15009",
|
||||
"reward2": "5,tg18_oy15032_1",
|
||||
"reward3": "10,tg18_oy15012_1",
|
||||
"reward4": "20,tg18_oy15020_1",
|
||||
"reward5": "25,tg18_oy15011_1",
|
||||
"reward6": "30,tg18_as15007_1",
|
||||
"reward7": "35,tg18_oy15016_1",
|
||||
"reward8": "40,tg18_bg15017",
|
||||
"reward9": "45,tg18_as15010_1",
|
||||
"start_at": "2020-03-27 15:00:00",
|
||||
"title": "Go to the Tama Party!"
|
||||
},
|
||||
{
|
||||
"dsp_type": "0",
|
||||
"end_at": "2100-12-31 23:59:59",
|
||||
"id": "24",
|
||||
"kind": "2",
|
||||
"reward1": "1,tg18_ac15037_1",
|
||||
"reward10": "50,tg18_as15005_1",
|
||||
"reward2": "3,tg18_as15011_1",
|
||||
"reward3": "5,tg18_as15018_1",
|
||||
"reward4": "10,tg18_as15003_1",
|
||||
"reward5": "15,tg18_ac15035_1",
|
||||
"reward6": "20,tg18_as15008_1",
|
||||
"reward7": "25,tg18_ac15042_1",
|
||||
"reward8": "30,tg18_as15004_1",
|
||||
"reward9": "40,tg18_bg15007",
|
||||
"start_at": "2020-03-27 15:00:00",
|
||||
"title": "Bring your My Tama into the APP!"
|
||||
},
|
||||
{
|
||||
"dsp_type": "0",
|
||||
"end_at": "2100-12-31 23:59:59",
|
||||
"id": "25",
|
||||
"kind": "3",
|
||||
"reward1": "2,tg18_oy15035_1",
|
||||
"reward10": "50,tg18_oy15013_1",
|
||||
"reward2": "3,tg18_oy15027_1",
|
||||
"reward3": "4,tg18_oy15019_1",
|
||||
"reward4": "5,tg18_gh15016_1",
|
||||
"reward5": "10,tg18_oy15037_1",
|
||||
"reward6": "15,tg18_oy15029_1",
|
||||
"reward7": "20,tg18_oy15036_1",
|
||||
"reward8": "30,tg18_oy15014_1",
|
||||
"reward9": "40,tg18_oy15006_1",
|
||||
"start_at": "2020-03-27 15:00:00",
|
||||
"title": "Welcome Bonus Login Completed!"
|
||||
}
|
||||
],
|
||||
"EventCollabAsset": 55,
|
||||
"EventGameId": [
|
||||
1,
|
||||
2
|
||||
],
|
||||
"EventInfoHtml": "en_eventinfo_220301",
|
||||
"EventMonthlyId": 0,
|
||||
"GameAsset": 1,
|
||||
"InfoHtml": "en_info_220301",
|
||||
"MenteFlag": 0,
|
||||
"ParkAsset": 1,
|
||||
"PartyAsset": 1,
|
||||
"Tutorials": [
|
||||
1,
|
||||
2
|
||||
]
|
||||
},
|
||||
"JP": {}
|
||||
}
|
|
@ -0,0 +1,809 @@
|
|||
<?php
|
||||
// == COMMANDS ==
|
||||
define("COMMAND_AUTH", 11);
|
||||
define("COMMAND_GET_HOME", 12);
|
||||
define("COMMAND_PARENTAL_CONTROL", 30);
|
||||
define("COMMAND_SAVE_CHAR_DATA", 44);
|
||||
define("COMMAND_GET_PROFILE", 46);
|
||||
define("COMMAND_GET_NOTEBOOK", 51);
|
||||
define("COMMAND_GET_SETTINGS", 58);
|
||||
|
||||
// == STATUS ==
|
||||
define("STATUS_INVALID_JSON", 9);
|
||||
define("STATUS_INVALID_AUTH", 7);
|
||||
define("STATUS_INVALID_LOGINCODE", 8);
|
||||
define("STATUS_OK", 0);
|
||||
|
||||
// == USER TYPES ==
|
||||
|
||||
define("USER_GUEST", 0);
|
||||
define("USER_BNID", 1);
|
||||
define("USER_LINE", 2);
|
||||
define("USER_MIX", 3);
|
||||
define("USER_MIX2", 4);
|
||||
|
||||
|
||||
// == API CONSTANTS ==
|
||||
define("ENGLISH_API", true);
|
||||
define("API_KEY", "695719951020924");
|
||||
|
||||
define("FLAG_ON", "ON");
|
||||
define("FLAG_OFF", "OFF");
|
||||
|
||||
define("DEFAULT_BNID_NAME", "");
|
||||
define("DEFAULT_BNID_FLAG", FLAG_OFF);
|
||||
|
||||
define("MOVING_FLAG", 0);
|
||||
define("TERMS_COUNT", "2");
|
||||
|
||||
|
||||
// == DATABASE CONFIG ==
|
||||
|
||||
$dbname = 'MeetsEn';
|
||||
$dbuser = 'root';
|
||||
$dbpass = 'kingofitall413';
|
||||
$dbhost = '127.0.0.1';
|
||||
|
||||
// == FUNCTIONS ==
|
||||
|
||||
$connect = NULL;
|
||||
$gameData = json_decode(file_get_contents('data.json'));
|
||||
$result = array( "ResultCode" => STATUS_INVALID_JSON );
|
||||
|
||||
|
||||
if(ENGLISH_API)
|
||||
$gameData = $gameData->EN;
|
||||
else
|
||||
$gameData = $gameData->JP;
|
||||
|
||||
function ReadGameSettings(){
|
||||
global $gameData;
|
||||
return $gameData;
|
||||
}
|
||||
|
||||
function DbConnect(){
|
||||
global $connect;
|
||||
global $dbhost;
|
||||
global $dbuser;
|
||||
global $dbpass;
|
||||
global $dbname;
|
||||
if($connect === NULL)
|
||||
$connect = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
|
||||
return $connect;
|
||||
}
|
||||
|
||||
function populate_db()
|
||||
{
|
||||
$connect = DbConnect();
|
||||
mysqli_query($connect, "CREATE TABLE IF NOT EXISTS Users(
|
||||
UserId INT,
|
||||
LoginSecret TEXT,
|
||||
CustomerId BIGINT,
|
||||
LastLoginCode TEXT,
|
||||
BnidName TEXT,
|
||||
BnidFlag TEXT,
|
||||
UserKind INT,
|
||||
UserLang INT,
|
||||
LastLogin INT)");
|
||||
|
||||
mysqli_query($connect, "CREATE TABLE IF NOT EXISTS ParentalControls(
|
||||
UserId INT,
|
||||
DisableSearchTarget INT,
|
||||
DisableViewSearchFriend INT,
|
||||
DisableStampArea INT)");
|
||||
|
||||
mysqli_query($connect, "CREATE TABLE IF NOT EXISTS Profiles(
|
||||
UserId INT,
|
||||
CharaData TEXT,
|
||||
CharaToyKey TEXT,
|
||||
LikeCount INT,
|
||||
LikeTotal INT,
|
||||
AddressCode INT,
|
||||
Sex INT,
|
||||
Body INT,
|
||||
Face INT,
|
||||
Hair INT,
|
||||
Top INT,
|
||||
Bottom INT,
|
||||
UserCode TEXT)");
|
||||
|
||||
mysqli_query($connect, "CREATE TABLE IF NOT EXISTS HomeInfo(
|
||||
UserId INT,
|
||||
Point INT,
|
||||
EventPoint INT,
|
||||
SearchFlag INT)");
|
||||
|
||||
mysqli_query($connect, "CREATE TABLE IF NOT EXISTS TutorialsCompleted(
|
||||
UserId INT,
|
||||
TutorialId INT,
|
||||
TutorialData TEXT,
|
||||
TutorialFlag INT,
|
||||
TutorialGuestFlag INT,
|
||||
TutorialMeetsFlag INT)");
|
||||
|
||||
mysqli_query($connect, "CREATE TABLE IF NOT EXISTS ChallangesCompleted(
|
||||
UserId INT,
|
||||
ChallangeId INT,
|
||||
UserCount INT,
|
||||
UserReward1Flag INT,
|
||||
UserReward2Flag INT,
|
||||
UserReward3Flag INT,
|
||||
UserReward4Flag INT,
|
||||
UserReward5Flag INT,
|
||||
UserReward6Flag INT,
|
||||
UserReward7Flag INT,
|
||||
UserReward8Flag INT,
|
||||
UserReward9Flag INT,
|
||||
UserReward10Flag INT)");
|
||||
|
||||
mysqli_query($connect, "CREATE TABLE IF NOT EXISTS Notebook(
|
||||
UserId INT,
|
||||
NoteId INT,
|
||||
RefUserId INT)");
|
||||
}
|
||||
|
||||
function generate_usercode(){
|
||||
$valid_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
$total_valid = strlen($valid_chars);
|
||||
|
||||
$ascii_part = "";
|
||||
for($i = 0; $i < 3; $i++){
|
||||
$ascii_part .= $valid_chars[random_int(0, $total_valid-1)];
|
||||
}
|
||||
|
||||
$id_part = random_int(100000, 999999);
|
||||
|
||||
return $ascii_part . strval($id_part);
|
||||
}
|
||||
|
||||
function add_user($userId, $loginSecret, $customerId, $lastLoginCode, $bnidName, $bnidFlag, $userKind, $userLang)
|
||||
{
|
||||
$connect = DbConnect();
|
||||
mysqli_begin_transaction($connect);
|
||||
// Create users table entry
|
||||
$loginDate = time();
|
||||
$stmt = $connect->prepare("INSERT INTO Users VALUES(?,?,?,?,?,?,?,?,?)");
|
||||
$stmt->bind_param("isssssiii", $userId,
|
||||
$loginSecret,
|
||||
$customerId,
|
||||
$lastLoginCode,
|
||||
$bnidName,
|
||||
$bnidFlag,
|
||||
$userKind,
|
||||
$userLang,
|
||||
$loginDate);
|
||||
$stmt->execute();
|
||||
|
||||
// Create parental controls table entry
|
||||
$stmt = $connect->prepare("INSERT INTO ParentalControls VALUES(?,0,0,0)");
|
||||
$stmt->bind_param("i", $userId);
|
||||
$stmt->execute();
|
||||
|
||||
// Create profile entry
|
||||
$userCode = generate_usercode();
|
||||
$stmt = $connect->prepare("INSERT INTO Profiles VALUES(?, '', 0, 0, 0, 100, 1, 1101, 1203, 1301, 1401, 1508, ?)");
|
||||
$stmt->bind_param("is", $userId, $userCode);
|
||||
$stmt->execute();
|
||||
|
||||
// Create home entry
|
||||
$userCode = generate_usercode();
|
||||
$stmt = $connect->prepare("INSERT INTO HomeInfo VALUES(?, 0, 0, 0)");
|
||||
$stmt->bind_param("i", $userId);
|
||||
$stmt->execute();
|
||||
|
||||
// Initalize Tutorials
|
||||
foreach(ReadGameSettings()->Tutorials as $tutorial){
|
||||
$stmt = $connect->prepare("INSERT INTO TutorialsCompleted VALUES(?, ?, '', 0, 0, 0)");
|
||||
$stmt->bind_param("ii", $userId, $tutorial);
|
||||
$stmt->execute();
|
||||
}
|
||||
|
||||
// Initalize Challanges
|
||||
foreach(ReadGameSettings()->Challanges as $challange){
|
||||
$chid = intval($challange->id);
|
||||
|
||||
$stmt = $connect->prepare("INSERT INTO ChallangesCompleted VALUES(?, ?, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)");
|
||||
$stmt->bind_param("ii", $userId, $chid);
|
||||
$stmt->execute();
|
||||
}
|
||||
|
||||
mysqli_commit($connect);
|
||||
}
|
||||
|
||||
function set_last_login_date($userId){
|
||||
$connect = DbConnect();
|
||||
$lognDate = time();
|
||||
$stmt = $connect->prepare("UPDATE Users SET LastLogin=? WHERE UserId=?");
|
||||
$stmt->bind_param("ii", $loginDate,
|
||||
$userId);
|
||||
$stmt->execute();
|
||||
}
|
||||
|
||||
function set_last_login_code($userId, $lastLoginCode){
|
||||
$connect = DbConnect();
|
||||
$stmt = $connect->prepare("UPDATE Users SET LastLoginCode=? WHERE UserId=?");
|
||||
$stmt->bind_param("si", $lastLoginCode,
|
||||
$userId);
|
||||
$stmt->execute();
|
||||
|
||||
}
|
||||
|
||||
function validate_login_code($userId, $gotLoginCode){
|
||||
$connect = DbConnect();
|
||||
|
||||
$stmt = $connect->prepare("SELECT LastLoginCode FROM Users WHERE UserId=?");
|
||||
$stmt->bind_param("i", $userId);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
return ($result->fetch_row()[0] === $gotLoginCode);
|
||||
}
|
||||
|
||||
function get_user_parental_control($userId)
|
||||
{
|
||||
$connect = DbConnect();
|
||||
$stmt = $connect->prepare("SELECT * FROM ParentalControls WHERE UserId=?");
|
||||
$stmt->bind_param("i", $userId);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
return $result->fetch_row();
|
||||
}
|
||||
|
||||
function get_profile_data($userId)
|
||||
{
|
||||
$connect = DbConnect();
|
||||
$stmt = $connect->prepare("SELECT * FROM Profiles WHERE UserId=?");
|
||||
$stmt->bind_param("i", $userId);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
return $result->fetch_row();
|
||||
}
|
||||
|
||||
function get_notebook_data($userId)
|
||||
{
|
||||
$connect = DbConnect();
|
||||
$stmt = $connect->prepare("SELECT * FROM Notebook WHERE UserId=?");
|
||||
$stmt->bind_param("i", $userId);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
return $result->fetch_all();
|
||||
}
|
||||
|
||||
|
||||
function get_user_tutorial_info($userId, $tutorialId){
|
||||
$connect = DbConnect();
|
||||
$stmt = $connect->prepare("SELECT * FROM TutorialsCompleted WHERE UserId=? AND TutorialId=?");
|
||||
$stmt->bind_param("ii", $userId, $tutorialId);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
return $result->fetch_row();
|
||||
}
|
||||
|
||||
|
||||
function get_user_home_info($userId){
|
||||
$connect = DbConnect();
|
||||
$stmt = $connect->prepare("SELECT * FROM HomeInfo WHERE UserId=?");
|
||||
$stmt->bind_param("i", $userId);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
return $result->fetch_row();
|
||||
}
|
||||
|
||||
function get_user_challange_info($userId, $challangeId){
|
||||
$connect = DbConnect();
|
||||
$stmt = $connect->prepare("SELECT * FROM ChallangesCompleted WHERE UserId=? AND ChallangeId=?");
|
||||
$stmt->bind_param("i", $userId, $challangeId);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
return $result->fetch_row();
|
||||
}
|
||||
|
||||
|
||||
function get_user_info($userId)
|
||||
{
|
||||
$connect = DbConnect();
|
||||
$stmt = $connect->prepare("SELECT * FROM Users WHERE UserId=?");
|
||||
$stmt->bind_param("i", $userId);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
return $result->fetch_row();
|
||||
}
|
||||
|
||||
function get_latest_userid(){
|
||||
$connect = DbConnect();
|
||||
$result = mysqli_query($connect, "SELECT MAX(UserId)+1 FROM Users");
|
||||
$userId = $result->fetch_row()[0];
|
||||
if($userId == NULL)
|
||||
$userId = 1;
|
||||
|
||||
return $userId;
|
||||
}
|
||||
|
||||
function set_chara_data($userId, $charaData){
|
||||
$connect = DbConnect();
|
||||
|
||||
$stmt = $connect->prepare("UPDATE Profiles SET CharaData=? WHERE UserId=?");
|
||||
$stmt->bind_param("si", $charaData,
|
||||
$userId);
|
||||
$stmt->execute();
|
||||
|
||||
}
|
||||
|
||||
|
||||
function set_user_kind($userId, $userKind){
|
||||
$connect = DbConnect();
|
||||
|
||||
$stmt = $connect->prepare("UPDATE Users SET UserKind=? WHERE UserId=?");
|
||||
$stmt->bind_param("ii", $charaData,
|
||||
$userId);
|
||||
$stmt->execute();
|
||||
|
||||
}
|
||||
|
||||
function set_results_defaults($c){
|
||||
global $result;
|
||||
$result['ServerDate'] = date("Ymdihs");
|
||||
$result['c'] = intval($c);
|
||||
}
|
||||
|
||||
function set_user_challange_count($userId, $challangeId, $userCount){
|
||||
$connect = DbConnect();
|
||||
|
||||
$stmt = $connect->prepare("UPDATE ChallangesCompleted SET UserCount=? WHERE UserId=? AND ChallangeId=?");
|
||||
$stmt->bind_param("iii",$userCount,
|
||||
$userId,
|
||||
$challangeId);
|
||||
$stmt->execute();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function set_user_reward_1($userId, $challangeId){
|
||||
$connect = DbConnect();
|
||||
$stmt = $connect->prepare("UPDATE ChallangesCompleted SET UserReward1Flag=1 WHERE UserId=? AND ChallangeId=?");
|
||||
$stmt->bind_param("ii", $userId,
|
||||
$challangeId);
|
||||
$stmt->execute();
|
||||
|
||||
}
|
||||
function set_user_reward_2($userId, $challangeId){
|
||||
$connect = DbConnect();
|
||||
$stmt = $connect->prepare("UPDATE ChallangesCompleted SET UserReward2Flag=1 WHERE UserId=? AND ChallangeId=?");
|
||||
$stmt->bind_param("ii", $userId,
|
||||
$challangeId);
|
||||
$stmt->execute();
|
||||
|
||||
}
|
||||
function set_user_reward_3($userId, $challangeId){
|
||||
$connect = DbConnect();
|
||||
$stmt = $connect->prepare("UPDATE ChallangesCompleted SET UserReward3Flag=1 WHERE UserId=? AND ChallangeId=?");
|
||||
$stmt->bind_param("ii", $userId,
|
||||
$challangeId);
|
||||
$stmt->execute();
|
||||
|
||||
}
|
||||
function set_user_reward_4($userId, $challangeId){
|
||||
$connect = DbConnect();
|
||||
$stmt = $connect->prepare("UPDATE ChallangesCompleted SET UserReward4Flag=1 WHERE UserId=? AND ChallangeId=?");
|
||||
$stmt->bind_param("ii", $userId,
|
||||
$challangeId);
|
||||
$stmt->execute();
|
||||
|
||||
}
|
||||
function set_user_reward_5($userId, $challangeId){
|
||||
$connect = DbConnect();
|
||||
$stmt = $connect->prepare("UPDATE ChallangesCompleted SET UserReward5Flag=1 WHERE UserId=? AND ChallangeId=?");
|
||||
$stmt->bind_param("ii", $userId,
|
||||
$challangeId);
|
||||
$stmt->execute();
|
||||
|
||||
}
|
||||
function set_user_reward_6($userId, $challangeId){
|
||||
$connect = DbConnect();
|
||||
$stmt = $connect->prepare("UPDATE ChallangesCompleted SET UserReward6Flag=1 WHERE UserId=? AND ChallangeId=?");
|
||||
$stmt->bind_param("ii", $userId,
|
||||
$challangeId);
|
||||
$stmt->execute();
|
||||
|
||||
}
|
||||
function set_user_reward_7($userId, $challangeId){
|
||||
$connect = DbConnect();
|
||||
$stmt = $connect->prepare("UPDATE ChallangesCompleted SET UserReward7Flag=1 WHERE UserId=? AND ChallangeId=?");
|
||||
$stmt->bind_param("ii", $userId,
|
||||
$challangeId);
|
||||
$stmt->execute();
|
||||
|
||||
}
|
||||
function set_user_reward_8($userId, $challangeId){
|
||||
$connect = DbConnect();
|
||||
$stmt = $connect->prepare("UPDATE ChallangesCompleted SET UserReward8Flag=1 WHERE UserId=? AND ChallangeId=?");
|
||||
$stmt->bind_param("ii", $userId,
|
||||
$challangeId);
|
||||
$stmt->execute();
|
||||
|
||||
}
|
||||
function set_user_reward_9($userId, $challangeId){
|
||||
$connect = DbConnect();
|
||||
$stmt = $connect->prepare("UPDATE ChallangesCompleted SET UserReward9Flag=1 WHERE UserId=? AND ChallangeId=?");
|
||||
$stmt->bind_param("ii", $userId,
|
||||
$challangeId);
|
||||
$stmt->execute();
|
||||
|
||||
}
|
||||
function set_user_reward_10($userId, $challangeId){
|
||||
$connect = DbConnect();
|
||||
$stmt = $connect->prepare("UPDATE ChallangesCompleted SET UserReward10Flag=1 WHERE UserId=? AND ChallangeId=?");
|
||||
$stmt->bind_param("ii", $userId,
|
||||
$challangeId);
|
||||
$stmt->execute();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function earn_challange($userId, $challangeId){
|
||||
foreach(ReadGameSettings()->Challanges as $challange){
|
||||
if($challange->id == $challangeId){
|
||||
$cinfo = get_user_challange_info($userId, $challangeId);
|
||||
$cres = array(
|
||||
'id' => strval($challange->id),
|
||||
'title' => $challange->title,
|
||||
'kind' => strval($challange->kind),
|
||||
'last_flag' => 0
|
||||
);
|
||||
|
||||
set_user_challange_count($userId, $challangeId, $cinfo[2] + 1);
|
||||
|
||||
if($cinfo[3] == 0){
|
||||
set_user_reward_1($userId, $challangeId);
|
||||
$cres['reward_no'] = 1;
|
||||
$cres['achiv'] = $challange->reward1;
|
||||
}
|
||||
else if($cinfo[4] == 0){
|
||||
set_user_reward_2($userId, $challangeId);
|
||||
$cres['reward_no'] = 2;
|
||||
$cres['achiv'] = $challange->reward2;
|
||||
}
|
||||
else if($cinfo[5] == 0){
|
||||
set_user_reward_3($userId, $challangeId);
|
||||
$cres['reward_no'] = 3;
|
||||
$cres['achiv'] = $challange->reward3;
|
||||
}
|
||||
else if($cinfo[6] == 0){
|
||||
set_user_reward_4($userId, $challangeId);
|
||||
$cres['reward_no'] = 4;
|
||||
$cres['achiv'] = $challange->reward4;
|
||||
}
|
||||
else if($cinfo[7] == 0){
|
||||
set_user_reward_5($userId, $challangeId);
|
||||
$cres['reward_no'] = 5;
|
||||
$cres['achiv'] = $challange->reward5;
|
||||
}
|
||||
else if($cinfo[8] == 0){
|
||||
set_user_reward_6($userId, $challangeId);
|
||||
$cres['reward_no'] = 6;
|
||||
$cres['achiv'] = $challange->reward6;
|
||||
}
|
||||
else if($cinfo[9] == 0){
|
||||
set_user_reward_7($userId, $challangeId);
|
||||
$cres['reward_no'] = 7;
|
||||
$cres['achiv'] = $challange->reward7;
|
||||
}
|
||||
else if($cinfo[10] == 0){
|
||||
set_user_reward_8($userId, $challangeId);
|
||||
$cres['reward_no'] = 8;
|
||||
$cres['achiv'] = $challange->reward8;
|
||||
}
|
||||
else if($cinfo[11] == 0){
|
||||
set_user_reward_9($userId, $challangeId);
|
||||
$cres['reward_no'] = 9;
|
||||
$cres['achiv'] = $challange->reward9;
|
||||
}
|
||||
else if($cinfo[12] == 0){
|
||||
set_user_reward_10($userId, $challangeId);
|
||||
$cres['reward_no'] = 10;
|
||||
$cres['achiv'] = $challange->reward10;
|
||||
$cres['last_flag'] = 1;
|
||||
}
|
||||
|
||||
$cres['reward'] = explode(",", $cres['achiv'])[1];
|
||||
|
||||
return array( strval($challange->id) => $cres );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function check_acheivements($userData){
|
||||
global $result;
|
||||
$curDate = time();
|
||||
$lastLognDate = $userData[8];
|
||||
$diff = $curDate - $lastLognDate;
|
||||
$result['AchievementRewardList'] = array();
|
||||
// Add login bonus acheivements
|
||||
if( ($diff >= 86400) && ($diff < 172800) ){
|
||||
foreach(ReadGameSettings()->Challanges as $challange){
|
||||
if($challange->kind == 3){
|
||||
$cinfo = earn_challange($userData[0], $challange->id);
|
||||
array_push($result['AchievementRewardList'], $cinfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set_last_login_date($userData[0]);
|
||||
}
|
||||
|
||||
populate_db();
|
||||
|
||||
// == API Logic ==
|
||||
|
||||
if(isset($_SERVER["HTTP_APICODE"])) {
|
||||
$apicode = $_SERVER["HTTP_APICODE"];
|
||||
if(isset($_POST["json"])) {
|
||||
$json = $_POST["json"];
|
||||
$signature = strtoupper(hash_hmac('sha256', $json, API_KEY));
|
||||
if(hash_equals($apicode, $signature)){
|
||||
// Signature validation successful
|
||||
|
||||
$jdata = json_decode($json);
|
||||
|
||||
switch(intval($jdata->c)){
|
||||
case COMMAND_GET_SETTINGS:
|
||||
set_results_defaults($jdata->c);
|
||||
$result['ResultCode'] = STATUS_INVALID_LOGINCODE;
|
||||
$result['MenteFlag'] = ReadGameSettings()->MenteFlag;
|
||||
|
||||
if(validate_login_code($jdata->u, $jdata->z)){
|
||||
$result['EventCollabAsset'] = strval(ReadGameSettings()->EventCollabAsset);
|
||||
$result['EventGameId'] = implode(",",ReadGameSettings()->EventGameId);
|
||||
$result['EventMonthlyId'] = strval(ReadGameSettings()->EventMonthlyId);
|
||||
|
||||
$result['GameAsset'] = strval(ReadGameSettings()->GameAsset);
|
||||
$result['ParkAsset'] = strval(ReadGameSettings()->ParkAsset);
|
||||
$result['PartyAsset'] = strval(ReadGameSettings()->PartyAsset);
|
||||
|
||||
$result['ResultCode'] = STATUS_OK;
|
||||
}
|
||||
case COMMAND_GET_NOTEBOOK:
|
||||
set_results_defaults($jdata->c);
|
||||
$result['ResultCode'] = STATUS_INVALID_LOGINCODE;
|
||||
if(validate_login_code($jdata->u, $jdata->z)){
|
||||
$result['NotebookList'] = array();
|
||||
|
||||
$ndata = get_notebook_data($jdata->u);
|
||||
foreach($ndata as $note){
|
||||
$nres = array(
|
||||
"notebook_id" => strval($ndata[1]),
|
||||
"profile_uid" => strval($ndata[2])
|
||||
);
|
||||
|
||||
$pdata = get_profile_data($ndata[2]);
|
||||
$udata = get_user_info($ndata[2]);
|
||||
|
||||
// Read profile data
|
||||
$nres['chara_data'] = $pdata[1];
|
||||
$nres['chara_toy_key'] = $pdata[2];
|
||||
$nres['address_code'] = strval($pdata[5]);
|
||||
$nres['avatar_data'] = $pdata[6].",".$pdata[7].",".$pdata[8].",".$pdata[9].",".$pdata[10].",".$pdata[11];
|
||||
$nres['profile_user_code'] = $pdata[12];
|
||||
|
||||
// Read user data
|
||||
$nres['profile_user_kind'] = strval($udata[6]);
|
||||
$nres['profile_user_lang'] = strval($udata[7]);
|
||||
|
||||
array_push($result['NotebookList'], array( strval($ndata[1]) => $nres ));
|
||||
}
|
||||
|
||||
$result['ResultCode'] = STATUS_OK;
|
||||
$result['ResultDetail'] = STATUS_OK;
|
||||
|
||||
}
|
||||
break;
|
||||
case COMMAND_GET_HOME:
|
||||
set_results_defaults($jdata->c);
|
||||
$result['ResultCode'] = STATUS_INVALID_LOGINCODE;
|
||||
if(validate_login_code($jdata->u, $jdata->z)){
|
||||
// Check achievements
|
||||
$userData = get_user_info($jdata->u);
|
||||
|
||||
$userId = $userData[0];
|
||||
check_acheivements($userData);
|
||||
|
||||
// Read home info
|
||||
$userHome = get_user_home_info($userId);
|
||||
$result['Point'] = strval($userHome[1]);
|
||||
$result['EventPoint'] = strval($userHome[2]);
|
||||
$result['SearchFlag'] = strval($userHome[3]);
|
||||
|
||||
// Read Tutorials
|
||||
$result['TutorialList'] = array();
|
||||
foreach(ReadGameSettings()->Tutorials as $tutorialId){
|
||||
$userTutorals = get_user_tutorial_info($userId, $tutorialId);
|
||||
$tinfo = array(strval($tutorialId) => array(
|
||||
"tutorial_data" => $userTutorals[2],
|
||||
"tutorial_flag" => $userTutorals[3],
|
||||
"tutorial_guset_flag" => $userTutorals[4],
|
||||
"tutorial_id" => $tutorialId,
|
||||
"tutorial_meets_flag" => $userTutorals[5]
|
||||
));
|
||||
array_push($result['TutorialList'], $tinfo);
|
||||
}
|
||||
|
||||
$result['ResultCode'] = STATUS_OK;
|
||||
|
||||
}
|
||||
break;
|
||||
case COMMAND_GET_PROFILE:
|
||||
set_results_defaults($jdata->c);
|
||||
|
||||
$result['ResultCode'] = STATUS_INVALID_LOGINCODE;
|
||||
|
||||
if(validate_login_code($jdata->u, $jdata->z)){
|
||||
|
||||
$pdata = get_profile_data($jdata->u);
|
||||
|
||||
// Return profile data
|
||||
$result['CharaData'] = $pdata[1];
|
||||
$result['CharaToyKey'] = $pdata[2];
|
||||
|
||||
$result['LikeCount'] = $pdata[3];
|
||||
$result['LikeTotal'] = $pdata[4];
|
||||
|
||||
$result['ProfileAddressCode'] = $pdata[5];
|
||||
$result['ProfileAvatarData'] = $pdata[6].",".$pdata[7].",".$pdata[8].",".$pdata[9].",".$pdata[10].",".$pdata[11];
|
||||
$result['UserCode'] = $pdata[12];
|
||||
|
||||
// Give ResultDetail too.. for some reason
|
||||
$result['ResultDetail'] = STATUS_OK;
|
||||
$result['ResultCode'] = STATUS_OK;
|
||||
}
|
||||
break;
|
||||
case COMMAND_SAVE_CHAR_DATA:
|
||||
set_results_defaults($jdata->c);
|
||||
|
||||
$result['ResultCode'] = STATUS_INVALID_LOGINCODE;
|
||||
|
||||
if(validate_login_code($jdata->u, $jdata->z)){
|
||||
// TODO: add validation
|
||||
set_user_kind($jdata->u, $jdata->k);
|
||||
set_chara_data($jdata->u, $jdata->d);
|
||||
|
||||
// Return profile data
|
||||
$pdata = get_profile_data($jdata->u);
|
||||
|
||||
$result['ProfileAddressCode'] = $pdata[5];
|
||||
$result['ProfileAvatarData'] = $pdata[6].",".$pdata[7].",".$pdata[8].",".$pdata[9].",".$pdata[10].",".$pdata[11];
|
||||
$result['UserCode'] = $pdata[12];
|
||||
|
||||
// Give ResultDetail too..
|
||||
$result['ResultDetail'] = STATUS_OK;
|
||||
$result['ResultCode'] = STATUS_OK;
|
||||
}
|
||||
break;
|
||||
case COMMAND_PARENTAL_CONTROL:
|
||||
set_results_defaults($jdata->c);
|
||||
|
||||
$result['ResultCode'] = STATUS_INVALID_LOGINCODE;
|
||||
|
||||
if(validate_login_code($jdata->u, $jdata->z)){
|
||||
$pinfo = get_user_parental_control($jdata->u);
|
||||
|
||||
// Why are we dealing with overzealus parents?
|
||||
|
||||
$result['ParentExcluded'] = $pinfo[0];
|
||||
$result['ParentSearch'] = $pinfo[1];
|
||||
$result['ParentStamp'] = $pinfo[2];
|
||||
|
||||
$result['ResultCode'] = STATUS_OK;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
// Special Case:
|
||||
// Login to the app
|
||||
case COMMAND_AUTH:
|
||||
set_results_defaults($jdata->c);
|
||||
|
||||
$result['ResultCode'] = STATUS_INVALID_AUTH;
|
||||
|
||||
$result['AppVersion'] = ReadGameSettings()->AppVer;
|
||||
$result['MovingFlag'] = MOVING_FLAG;
|
||||
$result['MenteFlag'] = ReadGameSettings()->MenteFlag;
|
||||
$result['TermsCount'] = TERMS_COUNT;
|
||||
$result['AssetVersion'] = ReadGameSettings()->GameAsset;
|
||||
|
||||
|
||||
if($jdata->u == 0) { // Register
|
||||
|
||||
$result['ResultCode'] = STATUS_OK;
|
||||
|
||||
// Set default language and userkind
|
||||
$result['UserLang'] = intval(ENGLISH_API);
|
||||
$result['UserKind'] = strval(USER_GUEST);
|
||||
|
||||
// Return InfoHtml and EventInfoHtml.
|
||||
$result['InfoHtml'] = ReadGameSettings()->InfoHtml;
|
||||
$result['EventInfoHtml'] = ReadGameSettings()->EventInfoHtml;
|
||||
|
||||
// No Bandai Namco ID used by default.
|
||||
$result['BnidName'] = DEFAULT_BNID_NAME;
|
||||
$result['BnidFlag'] = DEFAULT_BNID_FLAG;
|
||||
|
||||
|
||||
// Generate LoginCode "Token"
|
||||
$result['LoginCode'] = bin2hex(random_bytes(0x14));
|
||||
|
||||
// Generate Customer ID
|
||||
$loginSecret = bin2hex(random_bytes(0x18));
|
||||
$customerId = random_int(1000000000000000,9999999999999999);
|
||||
$result['AppCode'] = $loginSecret.'.'.$customerId;
|
||||
|
||||
// Generate UserID
|
||||
$result['UserId'] = strval(get_latest_userid());
|
||||
|
||||
// Add to database.
|
||||
add_user($result['UserId'],
|
||||
$loginSecret,
|
||||
strval($customerId),
|
||||
$result['LoginCode'],
|
||||
$result['BnidName'],
|
||||
$result['BnidFlag'],
|
||||
$result['UserKind'],
|
||||
$result['UserLang']);
|
||||
}
|
||||
else{
|
||||
|
||||
// Read user info from database,
|
||||
$userInfo = get_user_info($jdata->u);
|
||||
|
||||
// Read user secrets
|
||||
$loginSecret = $userInfo[1];
|
||||
$customerId = $userInfo[2];
|
||||
|
||||
// Generate App Codes
|
||||
$expectedAppCode = $loginSecret.'.'.$customerId;
|
||||
|
||||
// Check if correct secrets were given:
|
||||
if($expectedAppCode === $jdata->q) {
|
||||
$result['ResultCode'] = STATUS_OK;
|
||||
|
||||
// Read User Id
|
||||
$result['UserId'] = $userInfo[0];
|
||||
|
||||
// Set default language and userkind
|
||||
$result['UserLang'] = $userInfo[7];
|
||||
$result['UserKind'] = strval($userInfo[6]);
|
||||
|
||||
// Return InfoHtml and EventInfoHtml.
|
||||
$result['InfoHtml'] = ReadGameSettings()->InfoHtml;
|
||||
$result['EventInfoHtml'] = ReadGameSettings()->EventInfoHtml;
|
||||
|
||||
// Get Bandai Namco Id Information
|
||||
$result['BnidName'] = $userInfo[4];
|
||||
$result['BnidFlag'] = $userInfo[5];
|
||||
|
||||
// Generate LoginCode "Token"
|
||||
$result['LoginCode'] = bin2hex(random_bytes(0x14));
|
||||
|
||||
// Return Expected AppCode
|
||||
$result['AppCode'] = $expectedAppCode;
|
||||
|
||||
set_last_login_code($result['UserId'], $result['LoginCode']);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
header("Content-Type: application/json");
|
||||
echo(json_encode($result));
|
||||
|
||||
?>
|
|
@ -0,0 +1,45 @@
|
|||
import requests
|
||||
import os
|
||||
|
||||
|
||||
def incDate(date):
|
||||
yr = int(date[0:2])
|
||||
mo = int(date[2:4])
|
||||
dy = int(date[4:6])
|
||||
|
||||
dy += 1
|
||||
if dy > 32:
|
||||
dy = 0
|
||||
mo += 1
|
||||
|
||||
if mo > 12:
|
||||
dy = 0
|
||||
mo = 0
|
||||
yr += 1
|
||||
|
||||
if yr > 22:
|
||||
os._exit(0)
|
||||
|
||||
ndate = ""
|
||||
ndate += str(yr).zfill(2)
|
||||
ndate += str(mo).zfill(2)
|
||||
ndate += str(dy).zfill(2)
|
||||
|
||||
return ndate
|
||||
|
||||
|
||||
|
||||
s = requests.Session()
|
||||
date = "180000"
|
||||
log = open("urls.txt", "w")
|
||||
|
||||
while True:
|
||||
url = "https://tmgcmeetsapp.com/page/en_eventinfo_"+date+".html"
|
||||
r = s.head(url)
|
||||
if r.status_code == 200:
|
||||
print("FOUND: "+url)
|
||||
log.write(url + "\n")
|
||||
log.flush()
|
||||
else:
|
||||
print("Nothing on "+date)
|
||||
date = incDate(date)
|
|
@ -0,0 +1,100 @@
|
|||
import requests
|
||||
import hmac
|
||||
import json
|
||||
import hashlib
|
||||
import time
|
||||
import urllib
|
||||
|
||||
data = {}
|
||||
|
||||
s = requests.Session()
|
||||
|
||||
headers = {"APICODE": "-",
|
||||
"Content-Type": "application/x-www-form-urlencoded"}
|
||||
|
||||
defaultApiReq = {"c":0,"u":0,"z":"","v":"","t":0,"k":0,"d":"","a":"","i":"","o":0,"b":0,"n":0,"w":"","m":"","q":"","p":0,"g":0,"x":0.0,"y":0.0,"e":0,"f":0,"s":0}
|
||||
|
||||
|
||||
|
||||
def sendEnApiRequest(jdata):
|
||||
jdata['t'] = int(time.time())
|
||||
jdata = json.dumps(jdata)
|
||||
|
||||
headers["APICODE"] = hmac.new(bytes("695719951020924", "UTF-8"), msg = bytes(jdata , 'UTF-8'), digestmod = hashlib.sha256).hexdigest().upper()
|
||||
|
||||
edata = "json="+urllib.parse.quote_plus(jdata)
|
||||
r = s.post("https://tmgcmeetsapp.com/api_en/meets.php",
|
||||
headers=headers,
|
||||
data=edata)
|
||||
print(jdata)
|
||||
print(r.content)
|
||||
time.sleep(1)
|
||||
return json.loads(r.content)
|
||||
|
||||
|
||||
|
||||
data['EN'] = {}
|
||||
data['JP'] = {}
|
||||
|
||||
|
||||
req = defaultApiReq
|
||||
req['c'] = 11
|
||||
req['v'] = '1.4.3'
|
||||
|
||||
enUser = sendEnApiRequest(req)
|
||||
|
||||
req['u'] = enUser['UserId']
|
||||
req['z'] = enUser['LoginCode']
|
||||
|
||||
data['EN']['InfoHtml'] = enUser['InfoHtml']
|
||||
data['EN']['EventInfoHtml'] = enUser['EventInfoHtml']
|
||||
data['EN']['AppVer'] = enUser['AppVersion']
|
||||
|
||||
# Read Tutorials
|
||||
|
||||
req['c'] = 12
|
||||
req['k'] = 0
|
||||
cmd12 = sendEnApiRequest(req)
|
||||
tutorialList = cmd12['TutorialList']
|
||||
data['EN']['Tutorials'] = []
|
||||
for tutorial in tutorialList.keys():
|
||||
data['EN']['Tutorials'].append(tutorialList[tutorial]['tutorial_id'])
|
||||
|
||||
# Read Game Settngs
|
||||
req['c'] = 58
|
||||
cmd58 = sendEnApiRequest(req)
|
||||
data['EN']['EventCollabAsset'] = int(cmd58['EventCollabAsset'])
|
||||
data['EN']['EventMonthlyId'] = int(cmd58['EventMonthlyId'])
|
||||
data['EN']['EventGameId'] = []
|
||||
|
||||
for i in cmd58['EventGameId'].split(','):
|
||||
data['EN']['EventGameId'].append(int(i))
|
||||
|
||||
data['EN']['GameAsset'] = int(cmd58['GameAsset'])
|
||||
data['EN']['ParkAsset'] = int(cmd58['ParkAsset'])
|
||||
data['EN']['PartyAsset'] = int(cmd58['PartyAsset'])
|
||||
|
||||
data['EN']['MenteFlag'] = int(cmd58['MenteFlag'])
|
||||
|
||||
# Read Challanges
|
||||
req['c'] = 55
|
||||
cmd55 = sendEnApiRequest(req)
|
||||
|
||||
challangeList = cmd55['ChallengeList']
|
||||
data['EN']['Challanges'] = []
|
||||
|
||||
for key in challangeList.keys():
|
||||
del challangeList[key]['user_count']
|
||||
del challangeList[key]['user_reward1_flag']
|
||||
del challangeList[key]['user_reward2_flag']
|
||||
del challangeList[key]['user_reward3_flag']
|
||||
del challangeList[key]['user_reward4_flag']
|
||||
del challangeList[key]['user_reward5_flag']
|
||||
del challangeList[key]['user_reward6_flag']
|
||||
del challangeList[key]['user_reward7_flag']
|
||||
del challangeList[key]['user_reward8_flag']
|
||||
del challangeList[key]['user_reward9_flag']
|
||||
del challangeList[key]['user_reward10_flag']
|
||||
data['EN']['Challanges'].append(challangeList[key])
|
||||
|
||||
open("data.json", "w").write(json.dumps(data, indent=4, sort_keys=True))
|
|
@ -0,0 +1,88 @@
|
|||
import requests
|
||||
import os
|
||||
import hashlib
|
||||
|
||||
s = requests.Session()
|
||||
|
||||
def genUrl(version, platform, file):
|
||||
return "https://tmgcmeetsapp.com/asset/"+version+"/"+platform+"/"+file
|
||||
|
||||
def genFiles(version, platform, file):
|
||||
return version+"/"+platform+"/"+file
|
||||
|
||||
|
||||
def makeDirsFor(filename):
|
||||
dirPath = os.path.dirname(filename)
|
||||
if not os.path.exists(dirPath):
|
||||
os.makedirs(dirPath)
|
||||
|
||||
def md5(fname):
|
||||
hash_md5 = hashlib.md5()
|
||||
hash_md5.update(open(fname, "rb").read())
|
||||
return hash_md5.hexdigest()
|
||||
|
||||
streamingassets = [
|
||||
"common/common.csv",
|
||||
"audio/audio.csv",
|
||||
"accessory/accessory.csv",
|
||||
"avatar/avatar.csv",
|
||||
"chara/chara.csv",
|
||||
"infos/infos.csv",
|
||||
"npc/npc.csv",
|
||||
"pet/pet.csv",
|
||||
"scenes/scenes.csv",
|
||||
|
||||
|
||||
# "chara/settings",
|
||||
# "accessory/settings",
|
||||
# "audio/se",
|
||||
# "avatar/sprites",
|
||||
|
||||
|
||||
"infos_en/infos_en.csv",
|
||||
"scenes_en/scenes_en.csv",
|
||||
|
||||
]
|
||||
|
||||
versions = ["v6", "v7"]
|
||||
platforms = ["Android", "iOS"]
|
||||
|
||||
for version in versions:
|
||||
for platform in platforms:
|
||||
|
||||
for streamingasset in streamingassets:
|
||||
url = genUrl(version, platform, streamingasset)
|
||||
print(url)
|
||||
r = s.get(url)
|
||||
|
||||
if not r.status_code == 200:
|
||||
continue
|
||||
|
||||
f = genFiles(version, platform, streamingasset)
|
||||
makeDirsFor(f)
|
||||
open(f, "wb").write(r.content)
|
||||
|
||||
# Download all assets folder
|
||||
if streamingasset.endswith(".csv"):
|
||||
csvdata = r.content.replace(b"\r", b"").split(b'\n')
|
||||
for csv in csvdata:
|
||||
if csv == b"":
|
||||
continue
|
||||
commas = csv.split(b',')
|
||||
|
||||
relPath = commas[0].decode("UTF-8")
|
||||
|
||||
url = genUrl(version, platform, relPath)
|
||||
print(url)
|
||||
f = genFiles(version, platform, relPath)
|
||||
replace = False
|
||||
|
||||
if not os.path.exists(f):
|
||||
r = s.get(url)
|
||||
|
||||
if not r.status_code == 200:
|
||||
continue
|
||||
|
||||
makeDirsFor(f)
|
||||
open(f, "wb").write(r.content)
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
import requests
|
||||
import urllib
|
||||
import hmac
|
||||
import hashlib
|
||||
import time
|
||||
import json
|
||||
|
||||
headers = {"APICODE": "-",
|
||||
"Content-Type": "application/x-www-form-urlencoded"}
|
||||
|
||||
s = requests.Session()
|
||||
|
||||
while True:
|
||||
jdata = input("Enter str: ");
|
||||
|
||||
jj = json.loads(jdata)
|
||||
jj['t'] = int(time.time())
|
||||
jdata = json.dumps(jj)
|
||||
|
||||
headers["APICODE"] = hmac.new(bytes("695719951020924", "UTF-8"), msg = bytes(jdata , 'UTF-8'), digestmod = hashlib.sha256).hexdigest().upper()
|
||||
|
||||
edata = "json="+urllib.parse.quote_plus(jdata)
|
||||
|
||||
print(s.post("https://tmgcmeetsapp.com/api_en/meets.php",
|
||||
headers=headers,
|
||||
data=edata).text)
|
|
@ -0,0 +1,20 @@
|
|||
import requests
|
||||
import urllib
|
||||
import hmac
|
||||
import hashlib
|
||||
|
||||
headers = {"APICODE": "-",
|
||||
"Content-Type": "application/x-www-form-urlencoded"}
|
||||
|
||||
s = requests.Session()
|
||||
|
||||
while True:
|
||||
jdata = input("Enter str: ");
|
||||
headers["APICODE"] = hmac.new(bytes("695719951020924", "UTF-8"), msg = bytes(jdata , 'UTF-8'), digestmod = hashlib.sha256).hexdigest().upper()
|
||||
print(headers["APICODE"])
|
||||
|
||||
edata = "json="+urllib.parse.quote_plus(jdata)
|
||||
|
||||
print(s.post("http://127.0.0.1/api_en/meets.php",
|
||||
headers=headers,
|
||||
data=edata).text)
|
Loading…
Reference in New Issue