public bool fetchWordList(ref WorldList wl) { // Doesnt exist by default wl.setExistance(false); string sqlQuery = "select * from users where username='******' and passwordmd5='"+wl.getPassword()+"';"; queryExecuter= conn.CreateCommand(); queryExecuter.CommandText = sqlQuery; dr= queryExecuter.ExecuteReader(); while(dr.Read()){ // Player is on the DB wl.setExistance(true); wl.setUserID((int) dr.GetDecimal(0)); dr.GetBytes(6,0,wl.getPrivateExponent(),0,96); dr.GetBytes(5,0,wl.getPublicModulus(),0,96); wl.setTimeCreated((int)dr.GetDecimal(7)); } dr.Close(); // If doesnt exist... should not do more things if (!wl.getExistance()){ Output.writeToLogForConsole("[WORLD DB ACCESS] fetchWordList : Player not found on DB with #" + wl.getUsername() + "# and #" + wl.getPassword() + "#"); conn.Close(); return false; } return true; }
public bool fetchWordList(ref WorldList wl) { conn.Open(); // Doesnt exist by default wl.setExistance(false); string sqlQuery = "select * from users where username='******' and passwordmd5='" + wl.getPassword() + "';"; queryExecuter = conn.CreateCommand(); queryExecuter.CommandText = sqlQuery; dr = queryExecuter.ExecuteReader(); while (dr.Read()) { // Player is on the DB wl.setExistance(true); wl.setUserID((int)dr.GetDecimal(0)); dr.GetBytes(6, 0, wl.getPrivateExponent(), 0, 96); dr.GetBytes(5, 0, wl.getPublicModulus(), 0, 96); wl.setTimeCreated((int)dr.GetDecimal(7)); } dr.Close(); conn.Close(); // If doesnt exist... should not do more things if (!wl.getExistance()) { Output.writeToLogForConsole("[WORLD DB ACCESS] fetchWordList : Player not found on DB with #" + wl.getUsername() + "# and #" + wl.getPassword() + "#"); return(false); } return(true); }
public static World FindWorldExact(string name) { if (name == null) { throw new ArgumentNullException("name"); } return(WorldList.FirstOrDefault(w => w.Name.Equals(name, StringComparison.OrdinalIgnoreCase))); }
public World MakeWorld(Seed seed, string name = null) { var world = new World( seed: seed, name: name ?? $"New World {(WorldList.Count + 1).ToString()}" ); WorldList.Add(world.Id.Value, world); return(world); }
public AuthServer() { status = 0; rsa = new MxoRSA(); tf = new MxoTwofish(); md5 = new Md5(); wl = new WorldList(); blankIV = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; }
private static WorldList ToProtoList(Task <Models.World[]> row) { var worldList = new WorldList(); foreach (var world in row.Result) { worldList.World.Add(new World { Id = world.Id, RandomNumber = world.RandomNumber }); } return(worldList); }
//pra contablização do menu de fases public static List <bool> GetWorldCollectionStateAt(int id) { WorldList worldList = GetWorldList(id); List <bool> worldCollectionStates = new List <bool>(); foreach (StageList stageList in worldList.stageLists) { foreach (bool b in stageList.collectableStates) { worldCollectionStates.Add(b); } } return(worldCollectionStates); }
public static WorldList GetWorldList(int id) { foreach (WorldList list in worldLists) { if (list.id == id) { return(list); } } Debug.Log("World " + id + " not found. Creating a new one."); WorldList worldList = new WorldList(id); worldLists.Add(worldList); return(worldList); }
public static StageList GetCurrentStageList(WorldList worldList) { string path = SceneManager.GetActiveScene().path; foreach (StageList stageList in worldList.stageLists) { if (stageList.path == path) { return(stageList); } } Debug.Log("Current stage not found. Creating a new one."); StageList newList = new StageList(path); worldList.stageLists.Add(newList); return(newList); }
IEnumerator GetServer(string url) { UnityWebRequest Request = UnityWebRequest.Get(url); Request.timeout = NetWrokTimeOut; yield return(Request.SendWebRequest()); if (Request.isHttpError || Request.isNetworkError) { print("Time out, check the network."); } else { m_WorldMapData = JsonMapper.ToObject <GetJsonData>(Request.downloadHandler.text); m_get_WorldPoint = JsonMapper.ToObject <WorldList>(m_WorldMapData.data); if (m_PlayerType == PlayerType.client) { ObjPool(); } } yield return(new WaitForSeconds(rate)); StartCoroutine(GetServer(m_get_url)); }
public bool fetchWordList(ref WorldList wl) { // Doesnt exist by default wl.setExistance(false); conn.Open(); string sqlQuery = "SELECT * FROM users WHERE username='******' AND passwordmd5='"+wl.getPassword()+"' LIMIT 1;"; queryExecuter= conn.CreateCommand(); queryExecuter.CommandText = sqlQuery; dr= queryExecuter.ExecuteReader(); while(dr.Read()){ // Player is on the DB wl.setExistance(true); wl.setUserID((int) dr.GetDecimal(0)); dr.GetBytes(5,0,wl.getPublicModulus(),0,96); dr.GetBytes(6,0,wl.getPrivateExponent(),0,96); wl.setTimeCreated((int)dr.GetDecimal(7)); } dr.Close(); // If doesnt exist... should not do more things if (!wl.getExistance()){ String msg = "Player not found on DB with #"+wl.getUsername()+"# and #"+wl.getPassword()+"#"; Output.WriteLine(msg); conn.Close(); return false; } // If exist, get the player values // Count the values first int totalChars = 0; string sqlCount = "SELECT charId FROM characters WHERE userId='" + wl.getUserID() + "' AND is_deleted='0' "; queryExecuter= conn.CreateCommand(); queryExecuter.CommandText = sqlCount; dr= queryExecuter.ExecuteReader(); while (dr.Read()){ totalChars++; } dr.Close(); wl.getCharPack().setTotalChars(totalChars); // Prepare to read characters string sqlQueryForChars = "SELECT * FROM characters WHERE userId='" + wl.getUserID() + "' AND is_deleted='0' "; queryExecuter= conn.CreateCommand(); queryExecuter.CommandText = sqlQueryForChars; dr= queryExecuter.ExecuteReader(); // Read characters while(dr.Read()){ //totalChars = (int) dr.GetDecimal(8); string charName = dr.GetString(4); int charId = (int)dr.GetDecimal(0); int status = (int)dr.GetDecimal(3); int worldId = (int)dr.GetDecimal(2); wl.getCharPack().addCharacter(charName,charId,status,worldId); } dr.Close(); // Read worlds string sqlQueryForWorlds = "SELECT * FROM worlds ORDER BY worldId ASC"; queryExecuter.CommandText = sqlQueryForWorlds; dr= queryExecuter.ExecuteReader(); while (dr.Read()){ string worldName = dr.GetString(1); int worldId = (int) dr.GetDecimal(0); int worldType = (int) dr.GetDecimal(2); int worldStatus = (int) dr.GetDecimal(3); int worldPopulation = (int) dr.GetDecimal(4); wl.getWorldPack().addWorld(worldName,worldId,worldStatus,worldType,worldPopulation); } dr.Close(); conn.Close(); return true; }
public DefaultSpawnPointProvider(WorldList worldList, RpConfig config) { _WorldList = worldList ?? throw new ArgumentNullException(nameof(worldList)); _Config = config ?? throw new ArgumentNullException(nameof(config)); }
public static int CountLoadedWorlds() { return(WorldList.Count(world => (world.Map != null))); }
public bool fetchWordList(ref WorldList wl) { // Doesnt exist by default wl.setExistance(false); conn.Open(); string sqlQuery = "SELECT * FROM users WHERE username='******' AND passwordmd5='" + wl.getPassword() + "' LIMIT 1;"; queryExecuter = conn.CreateCommand(); queryExecuter.CommandText = sqlQuery; dr = queryExecuter.ExecuteReader(); while (dr.Read()) { // Player is on the DB wl.setExistance(true); wl.setUserID((int)dr.GetDecimal(0)); dr.GetBytes(5, 0, wl.getPublicModulus(), 0, 96); dr.GetBytes(6, 0, wl.getPrivateExponent(), 0, 96); wl.setTimeCreated((int)dr.GetDecimal(7)); } dr.Close(); // If doesnt exist... should not do more things if (!wl.getExistance()) { String msg = "Player not found on DB with #" + wl.getUsername() + "# and #" + wl.getPassword() + "#"; Output.WriteLine(msg); conn.Close(); return(false); } // If exist, get the player values // Count the values first int totalChars = 0; string sqlCount = "SELECT charId FROM characters WHERE userId='" + wl.getUserID() + "' AND is_deleted='0' "; queryExecuter = conn.CreateCommand(); queryExecuter.CommandText = sqlCount; dr = queryExecuter.ExecuteReader(); while (dr.Read()) { totalChars++; } dr.Close(); wl.getCharPack().setTotalChars(totalChars); // Prepare to read characters string sqlQueryForChars = "SELECT * FROM characters WHERE userId='" + wl.getUserID() + "' AND is_deleted='0' "; queryExecuter = conn.CreateCommand(); queryExecuter.CommandText = sqlQueryForChars; dr = queryExecuter.ExecuteReader(); // Read characters while (dr.Read()) { //totalChars = (int) dr.GetDecimal(8); string charName = dr.GetString(4); int charId = (int)dr.GetDecimal(0); int status = (int)dr.GetDecimal(3); int worldId = (int)dr.GetDecimal(2); wl.getCharPack().addCharacter(charName, charId, status, worldId); } dr.Close(); // Read worlds string sqlQueryForWorlds = "SELECT * FROM worlds ORDER BY worldId ASC"; queryExecuter.CommandText = sqlQueryForWorlds; dr = queryExecuter.ExecuteReader(); while (dr.Read()) { string worldName = dr.GetString(1); int worldId = (int)dr.GetDecimal(0); int worldType = (int)dr.GetDecimal(2); int worldStatus = (int)dr.GetDecimal(3); int worldPopulation = (int)dr.GetDecimal(4); wl.getWorldPack().addWorld(worldName, worldId, worldStatus, worldType, worldPopulation); } dr.Close(); conn.Close(); return(true); }
public CharacterBuilder(INpcDefList npcDefList, WorldList worldList, CharacterService characterService) { _NpcDefList = npcDefList ?? throw new ArgumentNullException(nameof(npcDefList)); _WorldList = worldList ?? throw new ArgumentNullException(nameof(worldList)); _CharacterService = characterService ?? throw new ArgumentNullException(nameof(characterService)); }
public WorldIndex(WorldList worldList) { _localWorldList = worldList; _worlds = new Dictionary<string, World>(); }