Пример #1
0
        public static void FriendBattleRequest(RequestContext request)
        {
            int userstate = UserHandler.AuthUser(request);

            if (userstate == 1 || userstate == 2)
            {
                User user   = UserHandler.GetUserDataByToken(request);
                User friend = UserHandler.GetUserDataByUsername(ExtractUsernameFromRessource(request.Ressource));
                if (friend != null && FriendlistHandler.CheckFriends(user, friend))
                {
                    if (user.deck_set && friend.deck_set)
                    {
                        BattleManager battle = new BattleManager(user, friend);
                        battle.PrepareDecks();
                        battle.StartFriendBattle();
                        return;
                    }
                    Output.WriteConsole(Output.FriendMatchDeckNotDefined);
                    return;
                }
                Output.WriteConsole(Output.FriendMatchNotInFl);
                return;
            }
            Output.WriteConsole(Output.AuthError);
        }
Пример #2
0
 static public string HandleByCommand(RequestContext request)
 {
     if (request.Ressource.Contains(RequestCalls.specific_trade))
     {
         return(TradingHandler.DeleteDeal(request));
     }
     if (request.Ressource.Contains(RequestCalls.friends))
     {
         return(FriendlistHandler.DeleteFriend(request));
     }
     return("Kein passender Befehl!");
 }
Пример #3
0
 static public void HandleByCommand(RequestContext request)
 {
     if (String.Compare(request.Ressource, RequestCalls.users) == 0)
     {
         UserHandler.CreateUser(request);
     }
     if (String.Compare(request.Ressource, RequestCalls.sessions) == 0)
     {
         UserHandler.LoginUser(request);
     }
     if (String.Compare(request.Ressource, RequestCalls.packages) == 0)
     {
         PackageHandler.CreatePackage(request);
     }
     if (String.Compare(request.Ressource, RequestCalls.trans_packs) == 0)
     {
         PackageHandler.AcquirePackage(request);
     }
     if (String.Compare(request.Ressource, RequestCalls.battles) == 0)
     {
         Matchmaker.MatchmadeBattleRequest(request);
     }
     if (request.Ressource.Contains(RequestCalls.friend_battles))
     {
         Matchmaker.FriendBattleRequest(request);
     }
     if (String.Compare(request.Ressource, RequestCalls.tradings) == 0)
     {
         TradingHandler.CreateDeal(request);
     }
     if (String.Compare(request.Ressource, RequestCalls.trade_coins) == 0)
     {
         TradingHandler.SellCard(request);
         return;
     }
     if (request.Ressource.Contains(RequestCalls.specific_trade))
     {
         TradingHandler.Trade(request);
     }
     if (request.Ressource.Contains(RequestCalls.friends))
     {
         FriendlistHandler.AddFriend(request);
     }
 }
Пример #4
0
 static public string HandleByCommand(RequestContext request)
 {
     if (String.Compare(request.Ressource, RequestCalls.cards) == 0)
     {
         return(UserCardsHandler.ShowStack(request));
     }
     if (String.Compare(request.Ressource, RequestCalls.deck_plain) == 0)
     {
         return(UserCardsHandler.ShowDeck(request, true));
     }
     if (String.Compare(request.Ressource, RequestCalls.deck) == 0)
     {
         return(UserCardsHandler.ShowDeck(request, false));
     }
     if (request.Ressource.Contains(RequestCalls.specific_user))
     {
         return(UserHandler.ShowPersonalUserData(request));
     }
     if (String.Compare(request.Ressource, RequestCalls.stats) == 0)
     {
         return(UserHandler.ShowPersonalStats(request));
     }
     if (String.Compare(request.Ressource, RequestCalls.score) == 0)
     {
         return(UserHandler.ShowScoreboard(request));
     }
     if (String.Compare(request.Ressource, RequestCalls.tradings) == 0)
     {
         return(TradingHandler.ShowTradeDeals(request));
     }
     if (String.Compare(request.Ressource, RequestCalls.friends) == 0)
     {
         return(FriendlistHandler.ShowFriendlist(request));
     }
     return("Kein passender Befehl!");
 }