예제 #1
0
        internal static void SelectNation(ref Packet result, byte nation, string strUserID)
        {
            KODatabase db = new KODatabase();

            ACCOUNT_CHAR aChar  = db.ACCOUNT_CHAR.Where(acc => acc.strAccountID == strUserID).FirstOrDefault();
            WAREHOUSE    wHouse = db.WAREHOUSE.Where(wh => wh.strAccountID == strUserID).FirstOrDefault();

            if (wHouse == null)
            {
                wHouse = new WAREHOUSE();
                wHouse.strAccountID      = strUserID;
                wHouse.nMoney            = 0;
                wHouse.dwTime            = 0;
                wHouse.WarehouseData     = new byte[1536];
                wHouse.strSerial         = new byte[1536];
                wHouse.WarehouseDataTime = new byte[1536];

                db.WAREHOUSE.Add(wHouse);

                Debug.WriteLine("WAREHOUSE hesabı bulunamadığından yeni WAREHOUSE eklendi.");
            }

            if (aChar == null)
            {
                aChar = new ACCOUNT_CHAR();
                aChar.strAccountID = strUserID;
                aChar.bNation      = nation;
                aChar.strCharID1   = null;
                aChar.strCharID2   = null;
                aChar.strCharID3   = null;
                db.ACCOUNT_CHAR.Add(aChar);
                Debug.WriteLine("Hesap bulunamadığından yeni account eklendi.");
            }
            else
            {
                nation = aChar.bNation;
                Debug.WriteLine("Hesap bilgileri alındı. Seçilen ırk {0}", nation);
            }

            db.SaveChanges();

            if (nation != KARUS && nation != ELMORAD)
            {
                result.SetByte(0);
                return;
            }

            result.SetByte(nation);
        }
예제 #2
0
        public static sbyte LoginUser(string AccountID, string Password)
        {
            var Account = m_AccountDb.TB_USER.Where(i => i.AccountID == AccountID).FirstOrDefault();

            if (Account == null)
            {
                return(-1);
            }
            else if (Account.Password != Password)
            {
                return(-1);
            }

            var AccountChar = m_GameDb.ACCOUNT_CHAR.Where(i => i.strAccountID == AccountID).FirstOrDefault();

            if (AccountChar == null)
            {
                AccountChar = new ACCOUNT_CHAR
                {
                    strAccountID = AccountID,
                    bCharNum     = 0,
                    bNation      = 0,
                    strCharID1   = null,
                    strCharID2   = null,
                    strCharID3   = null,
                    strCharID4   = null
                };

                m_GameDb.ACCOUNT_CHAR.Add(AccountChar);
                m_GameDb.SaveChanges();
                return(0);
            }
            else if (string.IsNullOrEmpty(AccountChar.strCharID1) &&
                     string.IsNullOrEmpty(AccountChar.strCharID2) &&
                     string.IsNullOrEmpty(AccountChar.strCharID3))
            {
                return(0);
            }
            else
            {
                return((sbyte)AccountChar.bNation);
            }
        }
예제 #3
0
        internal static byte GameLogin(string accountID, string strPassword, ref Packet result)
        {
            KODatabase db = new KODatabase();

            int nRet = db.TB_USER.Where(usr => usr.strAccountID == accountID && usr.strPasswd == strPassword).Count();

            if (nRet < 1)
            {
                return(0);
            }

            ACCOUNT_CHAR Account = db.ACCOUNT_CHAR.Where(acc => acc.strAccountID == accountID).FirstOrDefault();

            if (Account == null)
            {
                return(0);
            }

            return(Account.bNation);
        }