Beispiel #1
0
        void SpendCoins_Handler(BinaryReader br)
        {
            SpendCoinsArgs args = new SpendCoinsArgs();

            args.AuthToken = br.ReadString();
            args.Coins     = br.ReadInt32();
            args.SpendOn   = br.ReadInt32();

            HardCurrency -= args.Coins;

            OnSpendCoins(this, args);
        }
Beispiel #2
0
        void SpendCoins_Handler(BinaryReader br)
        {
            SpendCoinsArgs args = new SpendCoinsArgs();
            args.Coins = br.ReadInt32();
            args.SpendOn = br.ReadInt32();

            HardCurrency -= args.Coins;

            OnSpendCoins(this, args);
        }
Beispiel #3
0
 private void Client_OnSpendCoins(object sender, SpendCoinsArgs e)
 {
     TaskProcessor.AddTask(new HTask(HTask.HTaskType.SpendCoins, (HClient)sender, e));
 }
Beispiel #4
0
        void GameData_Fetched_Handler(Task t)
        {
            HTask task = (HTask)t;
            if (task.Query.Rows.Count <= 0)
            {
                // game data doesnt exist for this user yet
                string sql = string.Format("INSERT INTO game_data SET account_id={0},tower_floor_0=1;", task.Client.AccountId);
                t.Type = (int)HTask.HTaskType.GameData_Fetch;
                AddDBQuery(sql, t);

                // Also give this user 100 coins
                SpendCoinsArgs args = new SpendCoinsArgs();
                args.Coins = -100;
                args.SpendOn = 0;
                AddTask(new HTask(HTask.HTaskType.SpendCoins, task.Client, args));
            }
            else
            {
                GameDataArgs gameData = ReadGameData(task.Query);
                task.Client.SendGameData(gameData);
            }
        }