Пример #1
0
        private void SetInfos( )
        {
            int battleId = int.Parse(HttpContext.Current.Request.QueryString["id"]);

            bInfo = Universe.instance.GetBattle(battleId);
            sInfo = _ruler.GetBattle(battleId, bInfo.BattleType);

            if (bInfo == null || sInfo == null)
            {
                Redirect();
            }
        }
Пример #2
0
        private void Accept_Click(object sender, ImageClickEventArgs e)
        {
            int idx = itemsTable.SelectedIndex;
            int id  = int.Parse(itemsTable.getSpecificText(idx, 0));
            SimpleBattleInfo battleInfo = _ruler.GetBattle(id, BattleType.FRIENDLY);

            battleInfo.Accepted = true;

            Universe.instance.AcceptBattle(id, _ruler);

            itemsTable.removeLine(idx);
            HttpContext.Current.Response.Redirect(OrionGlobals.getSectionBaseUrl("Battle"));
        }
Пример #3
0
        private void SetWinner(ItemsTable itemsTable, int i, int span)
        {
            if (itemsTable.SelectedIndex != -1)
            {
                int   battleId = int.Parse(itemsTable.getSpecificText(itemsTable.SelectedIndex, 0));
                Ruler r        = GetRuler();
                if (null == r)
                {
                    Information.AddError(info.getContent("battleAdminUser_norulerid"));
                    return;
                }

                BattleInfo battleInfo = Universe.instance.GetBattle(battleId);

                if (r.GetBattle(battleId, battleInfo.BattleType) == null)
                {
                    Information.AddError(info.getContent("battleAdminUser_invalidBattleOwner"));
                    return;
                }

                string winner = "";
                if (i == 1)
                {
                    Ruler enemy = Universe.instance.getRuler(battleInfo.GetEnemyBattleInfo(r).OwnerId);
                    battleInfo.ForceEndBattle(enemy);
                    winner = itemsTable.getSpecificText(itemsTable.SelectedIndex, 3);
                }
                else
                {
                    battleInfo.ForceEndBattle(r);
                    winner = itemsTable.getSpecificText(itemsTable.SelectedIndex, 4);
                }

                Information.AddInformation(string.Format(info.getContent("battleAdminUser_setWinnerDone"), battleId, winner));

                UpdateTable(itemsTable, battleId, span);
            }
        }