Esempio n. 1
0
        public bool Stack_Purchase_Points(string incUser, string incUID)
        {
            Data_Server dServ    = new Data_Server();
            Stack       incStack = dServ.Stack_Get(incUID);
            int         i;

            if ((i = dServ.Player_Points_Get(incUser)) < incStack.Price_Points ||
                !Stack_Purchase(incUser, incUID))
            {
                return(false);
            }
            else
            {
                Player incPlayer = Player_Get(incUser);
                // Update the player's bank locally
                incPlayer.Points   -= incStack.Price_Points;
                incPlayer.Timestamp = DateTime.Now;
                SQLiteConnection db = new SQLiteConnection(dbPath);
                db.InsertOrReplace(incPlayer);
                db.Close();
                // And update the player's bank on the server
                dServ.Player_Purchase_Points(incUser, incStack.Price_Points, incStack.UID);

                return(true);
            }
        }
Esempio n. 2
0
        public bool Stack_Purchase(string incUsername, string incUID)
        {
            if (Stack_Exists(incUID))
            {
                return(false);   // Purchase failed, stack already exists locally
            }
            SQLiteConnection db    = new SQLiteConnection(dbPath);
            Data_Server      dServ = new Data_Server();

            Stack incStack = dServ.Stack_Get(incUID);

            db.CreateTable <Stack>();
            db.Insert(incStack);
            db.Close();
            return(true);
        }