init commit

This commit is contained in:
2025-05-12 18:07:43 -07:00
commit b410345c18
1023 changed files with 57521 additions and 0 deletions
+59
View File
@@ -0,0 +1,59 @@
using Godot;
using Newtonsoft.Json;
using System.Net.Http;
using System.Net.Http.Json;
using System.Threading.Tasks;
public partial class MistoxNet : Node{
Options _Options;
Reference _Reference;
public override void _Ready() {
_Options = GetNode<Options>( "/root/Options" );
_Reference = GetNode<Reference>("/root/Reference");
_Reference.MistoxNet = this;
}
public async Task<(bool, Account)> TrySession( string UserName, string Password ) {
using( System.Net.Http.HttpClient client = new System.Net.Http.HttpClient() ) {
HttpResponseMessage response = await client.PostAsJsonAsync( "https://mistox.net/api/account/session", new Account { UserName = UserName, PasswordHash = Password } );
string result = await response.Content.ReadAsStringAsync();
Account User = JsonConvert.DeserializeObject<Account>(result);
if( User != null && string.IsNullOrEmpty( User.Error ) ) {
return (true, User);
}
return (false, User);
}
}
public async Task<(bool, Account)> TryLogin( string UserName, string Password ) {
using( System.Net.Http.HttpClient client = new System.Net.Http.HttpClient() ) {
HttpResponseMessage response = await client.PostAsJsonAsync( "https://mistox.net/api/account/login", new Account { UserName = UserName, PasswordHash = Password } );
string result = await response.Content.ReadAsStringAsync();
Account User = JsonConvert.DeserializeObject<Account>(result);
if( User != null && string.IsNullOrEmpty( User.Error ) ) {
return (true, User);
}
return (false, User);
}
}
}
public class Account {
public int ID { get; set; } // PK
public string UserName { get; set; } = "";
public string Email { get; set; } = "";
public bool EmailVerified { get; set; } = false;
public string PasswordHash { get; set; } = "";
public string Error { get; set; } = "";
}
public class ProjectMistData {
public int AccountID { get; set; } // PK
public int Credits { get; set; }
public int OddballTimer { get; set; }
public string SessionToken { get; set; } = "";
public int SessionID { get; set; }
public int Kills { get; set; }
public int Deaths { get; set; }
}