コード例 #1
0
ファイル: MyWorldDbAccess.cs プロジェクト: hdneo/mxo-hd
        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;
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 public static World FindWorldExact(string name)
 {
     if (name == null)
     {
         throw new ArgumentNullException("name");
     }
     return(WorldList.FirstOrDefault(w => w.Name.Equals(name, StringComparison.OrdinalIgnoreCase)));
 }
コード例 #4
0
        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);
        }
コード例 #5
0
ファイル: AuthServer.cs プロジェクト: vitalyo7/mxo-hd
        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 };
        }
コード例 #6
0
        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);
        }
コード例 #7
0
    //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);
    }
コード例 #8
0
    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);
    }
コード例 #9
0
    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);
    }
コード例 #10
0
    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));
    }
コード例 #11
0
ファイル: MyAuthDBAccess.cs プロジェクト: hdneo/mxo-hd
        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;
        }
コード例 #12
0
 public DefaultSpawnPointProvider(WorldList worldList, RpConfig config)
 {
     _WorldList = worldList ?? throw new ArgumentNullException(nameof(worldList));
     _Config    = config ?? throw new ArgumentNullException(nameof(config));
 }
コード例 #13
0
 public static int CountLoadedWorlds()
 {
     return(WorldList.Count(world => (world.Map != null)));
 }
コード例 #14
0
ファイル: MyAuthDBAccess.cs プロジェクト: vitalyo7/mxo-hd
        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);
        }
コード例 #15
0
 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));
 }
コード例 #16
0
ファイル: WorldIndex.cs プロジェクト: jwodicka/Mural-legacy
 public WorldIndex(WorldList worldList)
 {
     _localWorldList = worldList;
     _worlds = new Dictionary<string, World>();
 }