예제 #1
0
        public void SetWinners(DataTable ladder, OdbcConnection dbConnection, SelectWinnerGump swg)
        {
            if (m_First[0] != null)
            {
                AddWinnerToLadder(ladder, dbConnection, swg, m_First[0]);
            }
            if (m_Second[0] != null)
            {
                AddWinnerToLadder(ladder, dbConnection, swg, m_Second[0]);
            }
            if (m_Third[0] != null)
            {
                AddWinnerToLadder(ladder, dbConnection, swg, m_Third[0]);
            }

            if (current_SWG.eventType.Contains("2vs2"))
            {
                if (m_First[1] != null)
                {
                    AddWinnerToLadder(ladder, dbConnection, swg, m_First[1]);
                }
                if (m_Second[1] != null)
                {
                    AddWinnerToLadder(ladder, dbConnection, swg, m_Second[1]);
                }
                if (m_Third[1] != null)
                {
                    AddWinnerToLadder(ladder, dbConnection, swg, m_Third[1]);
                }
            }
        }
예제 #2
0
        public InitiateEventGump(Mobile from, ArrayList playersJoined, string EventType, SelectWinnerGump swg)
            : base(50, 50)
        {
            #region InitiateVars
            m_From = from;

            current_IEG = this;
            if (from is PlayerMobile)
            {
                (from as PlayerMobile).LadderGump = current_IEG;
            }

            if (swg != null)
            {
                current_SWG = swg;
            }

            if (playersJoined != null)
            {
                mobilesJoined = playersJoined;
            }
            else
            {
                mobilesJoined = new ArrayList();
            }

            if (EventType != null)
            {
                eventType = EventType;
            }

            AddBackground(50, 50, 400, 250, 9200);

            #endregion

            //Event Type
            AddLabel(160, 100, 0x22, "Event Type:");
            AddButton(330, 90, 250, 250, 1, GumpButtonType.Reply, 0);  //Up
            AddButton(330, 110, 253, 253, 2, GumpButtonType.Reply, 0); //Down
            AddLabel(235, 100, 0, eventType);
            //Event Type end

            //Participents
            AddLabel(170, 170, 0x22, "Participants:");
            AddLabel(250, 170, 0, mobilesJoined.Count.ToString());
            AddButton(270, 160, 4016, 4016, 3, GumpButtonType.Reply, 0); //Set
            AddLabel(300, 160, 0x22, "Set");
            AddButton(270, 180, 4016, 4016, 4, GumpButtonType.Reply, 0); //Reset
            AddLabel(300, 180, 0x22, "Reset");
            //Participants end


            AddButton(370, 260, 2471, 2471, 10, GumpButtonType.Reply, 0);//NextPage
        }
예제 #3
0
        public InitiateEventGump(Mobile from, ArrayList playersJoined, string EventType, SelectWinnerGump swg)
            : base(50, 50)
        {
            #region InitiateVars
            m_From = from;

            current_IEG = this;
            if (from is PlayerMobile)
                (from as PlayerMobile).LadderGump = current_IEG;

            if (swg != null)
                current_SWG = swg;

            if (playersJoined != null)
                mobilesJoined = playersJoined;
            else
                mobilesJoined = new ArrayList();

            if (EventType != null)
                eventType = EventType;

            AddBackground(50, 50, 400, 250, 9200);

            #endregion

            //Event Type
            AddLabel(160, 100, 0x22, "Event Type:");
            AddButton(330, 90, 250, 250, 1, GumpButtonType.Reply, 0);//Up
            AddButton(330, 110, 253, 253, 2, GumpButtonType.Reply, 0);//Down
            AddLabel(235, 100, 0, eventType);
            //Event Type end

            //Participents
            AddLabel(170, 170, 0x22, "Participants:");
            AddLabel(250, 170, 0, mobilesJoined.Count.ToString());
            AddButton(270, 160, 4016, 4016, 3, GumpButtonType.Reply, 0);//Set
            AddLabel(300, 160, 0x22, "Set");
            AddButton(270, 180, 4016, 4016, 4, GumpButtonType.Reply, 0);//Reset
            AddLabel(300, 180, 0x22, "Reset");
            //Participants end


            AddButton(370, 260, 2471, 2471, 10, GumpButtonType.Reply, 0);//NextPage

        }
예제 #4
0
        public void AddWinnerToLadder(DataTable ladder, OdbcConnection dbConnection, SelectWinnerGump swg, Mobile winnerToAdd)
        {
            if (ladder.Rows.Contains(((int)winnerToAdd.Serial).ToString()) == false && mobilesAdded.Contains((winnerToAdd as PlayerMobile)) == false)
            {
                AddPlayerToLadder(dbConnection, winnerToAdd);
            }

            DataRow existingRow = ladder.Rows.Find((int)winnerToAdd.Serial);

            if (existingRow != null && winnerToAdd != null)
            {
                UpdateWinnerStats(dbConnection, existingRow, winnerToAdd, swg);
            }
            else
            {
                AddWinnerToLadder(ladder, dbConnection, swg, winnerToAdd);
            }
        }
예제 #5
0
        public void SetPlayersJoined(DataTable ladder, OdbcConnection dbConnection, SelectWinnerGump swg)
        {
            mobilesAdded = new ArrayList();
            DataTable tempTable = new DataTable();

            tempTable = ladder.Copy();

            //Set Primary key
            DataColumn[] primaryKey = new DataColumn[1];
            primaryKey[0]     = ladder.Columns[0];
            ladder.PrimaryKey = primaryKey;

            foreach (DataRow dr in tempTable.Rows)
            {
                Mobile  player      = null;
                DataRow existingRow = null;

                foreach (PlayerMobile pm in swg.mobilesJoined)
                {
                    player = pm;
                    if (ladder.Rows.Count < 0)
                    {
                        AddPlayerToLadder(dbConnection, player);
                    }
                    else
                    {
                        if (ladder.Rows.Contains(((int)player.Serial).ToString()))
                        {
                            existingRow = ladder.Rows.Find((int)pm.Serial);
                            UpdatePlayerStats(dbConnection, existingRow, player);
                        }
                        else if (mobilesAdded.Contains(pm) == false)
                        {
                            AddPlayerToLadder(dbConnection, player);
                        }
                    }
                }
            }
        }
예제 #6
0
        public void UpdateWinnerStats(OdbcConnection connection, DataRow oldRow, Mobile player, SelectWinnerGump swg)
        {
            string addWinnerString = string.Empty;
            int    fpoints = 0, spoints = 0, tpoints = 0;

            if (swg.eventType == "1vs1 No Loot" || swg.eventType == "1vs1 Loot")
            {
                if (swg.mobilesJoined.Count >= 45)
                {
                    fpoints = 5;
                    spoints = 3;
                    tpoints = 2;
                }
                else if (swg.mobilesJoined.Count >= 34)
                {
                    fpoints = 4;
                    spoints = 2;
                    tpoints = 1;
                }
                else if (swg.mobilesJoined.Count >= 20)
                {
                    fpoints = 3;
                    spoints = 1;
                    tpoints = 0;
                }
                else if (swg.mobilesJoined.Count >= 14)
                {
                    fpoints = 2;
                    spoints = 1;
                    tpoints = 0;
                }
                else
                {
                    fpoints = 1;
                    spoints = 0;
                    tpoints = 0;
                }
            }
            else if (swg.eventType == "2vs2 No Loot" || swg.eventType == "2vs2 Loot")
            {
                if (swg.mobilesJoined.Count >= 34)
                {
                    fpoints = 3;
                    spoints = 2;
                    tpoints = 1;
                }
                else if (swg.mobilesJoined.Count >= 24)
                {
                    fpoints = 2;
                    spoints = 1;
                    tpoints = 0;
                }
                else
                {
                    fpoints = 1;
                    spoints = 0;
                    tpoints = 0;
                }
            }
            else
            {
                if (swg.mobilesJoined.Count >= 30)
                {
                    fpoints = 2;
                    spoints = 0;
                    tpoints = 0;
                }
                else
                {
                    fpoints = 1;
                    spoints = 0;
                    tpoints = 0;
                }
            }

            if (swg.eventType == "1vs1 No Loot" || swg.eventType == "1vs1 Loot")
            {
                if (player == m_First[0])
                {
                    addWinnerString = "UPDATE participant SET " +
                                      "Name = '" + player.Name + "', " +
                                      "Won = " + (int.Parse(oldRow.ItemArray[2].ToString()) + 1) + ", " +
                                      "TotalPoints = " + (int.Parse(oldRow.ItemArray[6].ToString()) + fpoints) + ", " +
                                      "1v1Points = " + (int.Parse(oldRow.ItemArray[7].ToString()) + fpoints) +
                                      " WHERE Mobile = " + ((int)player.Serial);
                    //Misc.Guilds.GuildLadderUpdate.UpdateTourPoints(player, swg.mobilesJoined.Count);
                }
                else if (player == m_Second[0])
                {
                    addWinnerString = "UPDATE participant SET " +
                                      "Name = '" + player.Name + "', " +
                                      "Second = " + (int.Parse(oldRow.ItemArray[3].ToString()) + 1) + ", " +
                                      "TotalPoints = " + (int.Parse(oldRow.ItemArray[6].ToString()) + spoints) + ", " +
                                      "1v1Points = " + (int.Parse(oldRow.ItemArray[7].ToString()) + spoints) +
                                      " WHERE Mobile = " + ((int)player.Serial);

                    //Misc.Guilds.GuildLadderUpdate.UpdateTourPoints(player, (int)(swg.mobilesJoined.Count/2));
                }
                else if (player == m_Third[0])
                {
                    addWinnerString = "UPDATE participant SET " +
                                      "Name = '" + player.Name + "', " +
                                      "Third = " + (int.Parse(oldRow.ItemArray[4].ToString()) + 1) + ", " +
                                      "TotalPoints = " + (int.Parse(oldRow.ItemArray[6].ToString()) + tpoints) + ", " +
                                      "1v1Points = " + (int.Parse(oldRow.ItemArray[7].ToString()) + tpoints) +
                                      " WHERE Mobile = " + ((int)player.Serial);

                    //Misc.Guilds.GuildLadderUpdate.UpdateTourPoints(player, (int)(swg.mobilesJoined.Count / 3));
                }
            }
            else if (swg.eventType == "2vs2 No Loot" || swg.eventType == "2vs2 Loot")
            {
                if (player == m_First[0] || player == m_First[1])
                {
                    addWinnerString = "UPDATE participant SET " +
                                      "Name = '" + player.Name + "', " +
                                      "Won = " + (int.Parse(oldRow.ItemArray[2].ToString()) + 1) + ", " +
                                      "TotalPoints = " + (int.Parse(oldRow.ItemArray[6].ToString()) + fpoints) + ", " +
                                      "2v2Points = " + (int.Parse(oldRow.ItemArray[8].ToString()) + fpoints) +
                                      " WHERE Mobile = " + ((int)player.Serial);

                    //Misc.Guilds.GuildLadderUpdate.UpdateTourPoints(player, (int)(swg.mobilesJoined.Count/2));
                }
                else if (player == m_Second[0] || player == m_Second[1])
                {
                    addWinnerString = "UPDATE participant SET " +
                                      "Name = '" + player.Name + "', " +
                                      "Second = " + (int.Parse(oldRow.ItemArray[3].ToString()) + 1) + ", " +
                                      "TotalPoints = " + (int.Parse(oldRow.ItemArray[6].ToString()) + spoints) + ", " +
                                      "2v2Points = " + (int.Parse(oldRow.ItemArray[8].ToString()) + spoints) +
                                      " WHERE Mobile = " + ((int)player.Serial);
                    //Misc.Guilds.GuildLadderUpdate.UpdateTourPoints(player, (int)(swg.mobilesJoined.Count / 4));
                }
                else if (player == m_Third[0] || player == m_Third[1])
                {
                    addWinnerString = "UPDATE participant SET " +
                                      "Name = '" + player.Name + "', " +
                                      "Third = " + (int.Parse(oldRow.ItemArray[4].ToString()) + 1) + ", " +
                                      "TotalPoints = " + (int.Parse(oldRow.ItemArray[6].ToString()) + tpoints) + ", " +
                                      "2v2Points = " + (int.Parse(oldRow.ItemArray[9].ToString()) + tpoints) +
                                      " WHERE Mobile = " + ((int)player.Serial);

                    //Misc.Guilds.GuildLadderUpdate.UpdateTourPoints(player, (int)(swg.mobilesJoined.Count / 6));
                }
            }
            else
            {
                if (player == m_First[0])
                {
                    addWinnerString = "UPDATE participant SET " +
                                      "Name = '" + player.Name + "', " +
                                      "Won = " + (int.Parse(oldRow.ItemArray[2].ToString()) + 1) + ", " +
                                      "TotalPoints = " + (int.Parse(oldRow.ItemArray[6].ToString()) + fpoints) + ", " +
                                      "OtherPoints = " + (int.Parse(oldRow.ItemArray[9].ToString()) + fpoints) +
                                      " WHERE Mobile = " + ((int)player.Serial);
                }
                else if (player == m_Second[0])
                {
                    addWinnerString = "UPDATE participant SET " +
                                      "Name = '" + player.Name + "', " +
                                      "Second = " + (int.Parse(oldRow.ItemArray[3].ToString()) + 1) + ", " +
                                      "TotalPoints = " + (int.Parse(oldRow.ItemArray[6].ToString()) + spoints) + ", " +
                                      "OtherPoints = " + (int.Parse(oldRow.ItemArray[9].ToString()) + spoints) +
                                      " WHERE Mobile = " + ((int)player.Serial);
                }
                else if (player == m_Third[0])
                {
                    addWinnerString = "UPDATE participant SET " +
                                      "Name = '" + player.Name + "', " +
                                      "Third = " + (int.Parse(oldRow.ItemArray[4].ToString()) + 1) + ", " +
                                      "TotalPoints = " + (int.Parse(oldRow.ItemArray[6].ToString()) + tpoints) + ", " +
                                      "OtherPoints = " + (int.Parse(oldRow.ItemArray[9].ToString()) + tpoints) +
                                      " WHERE Mobile = " + ((int)player.Serial);
                }
            }

            OdbcCommand addWinnerCommand = connection.CreateCommand();

            addWinnerCommand.CommandText = addWinnerString;

            addWinnerCommand.ExecuteNonQuery();
        }
예제 #7
0
        public ComfirmGump(Mobile from, SelectWinnerGump swg)
            : base(50, 50)
        {
            if (swg != null)
            {
                current_SWG = swg;
            }

            m_First[0] = current_SWG.m_First[0];
            m_First[1] = current_SWG.m_First[1];

            m_Second[0] = current_SWG.m_Second[0];
            m_Second[1] = current_SWG.m_Second[1];

            m_Third[0] = current_SWG.m_Third[0];
            m_Third[1] = current_SWG.m_Third[1];

            AddBackground(50, 50, 400, 250, 9200);

            mobilesJoined = current_SWG.mobilesJoined;

            m_From = from;

            #region InitiateTextAndButtons
            //Event Type
            AddLabel(105, 80, 0x22, "Event Type:");
            AddLabel(180, 80, 0, current_SWG.eventType);
            //Event Type end

            //Participents
            AddLabel(290, 80, 0x22, "Participants:");
            AddLabel(375, 80, 0, current_SWG.mobilesJoined.Count.ToString());
            //Participants end

            AddButton(370, 260, 2462, 2462, 1, GumpButtonType.Reply, 0); //NextPage
            AddButton(80, 260, 2468, 2468, 2, GumpButtonType.Reply, 0);  //PreviousPage
            #endregion

            #region AddWinners
            AddLabel(120, 140, 0, "First:");
            if (current_SWG != null && current_SWG.m_First[0] != null)
            {
                AddLabel(170, 140, 0x22, current_SWG.m_First[0].Name);
            }
            else
            {
                AddLabel(170, 140, 0x22, "Select Player!");
            }

            if (current_SWG.eventType.Contains("2vs2"))
            {
                AddLabel(250, 140, 0, "&");
                if (current_SWG != null && current_SWG.m_First[1] != null)
                {
                    AddLabel(170, 140, 0x22, current_SWG.m_First[1].Name);
                }
                else
                {
                    AddLabel(170, 140, 0x22, "Select Player!");
                }
            }


            AddLabel(120, 170, 0, "Second:");
            if (current_SWG != null && current_SWG.m_Second[0] != null)
            {
                AddLabel(170, 170, 0x22, current_SWG.m_Second[0].Name);
            }
            else
            {
                AddLabel(170, 170, 0x22, "Select Player!");
            }



            if (current_SWG != null && current_SWG.mobilesJoined != null && current_SWG.mobilesJoined.Count >= 34)
            {
                AddLabel(120, 190, 0, "Third:");
                if (current_SWG != null && current_SWG.m_Third[0] != null)
                {
                    AddLabel(170, 190, 0x22, current_SWG.m_Third[0].Name);
                }
                else
                {
                    AddLabel(170, 190, 0x22, "Select Player!");
                }
            }

            #endregion
        }
예제 #8
0
 public SelectMobile(SelectWinnerGump SWG, int place)
     : base(12, false, TargetFlags.None)
 {
     current_SWG = SWG;
     m_Place     = place;
 }
예제 #9
0
        public SelectWinnerGump(Mobile from, InitiateEventGump ieg, SelectWinnerGump swg)
            : base(50, 50)
        {
            #region InitiateVars
            if (swg == null)
            {
                current_SWG = this;
                IEG         = ieg;
            }
            else
            {
                current_SWG = swg;
                IEG         = current_SWG.IEG;
            }

            m_From = from;

            AddBackground(50, 50, 400, 250, 9200);

            if (IEG.mobilesJoined != null)
            {
                mobilesJoined = IEG.mobilesJoined;
            }
            else
            {
                mobilesJoined = new ArrayList();
            }

            if (IEG.eventType != null)
            {
                eventType = IEG.eventType;
            }

            if (from is PlayerMobile)
            {
                (from as PlayerMobile).LadderGump = current_SWG;
            }

            #endregion


            #region InitiateTextAndButtons
            //Event Type
            AddLabel(105, 80, 0x22, "Event Type:");
            AddLabel(180, 80, 0, eventType);
            //Event Type end

            //Participents
            AddLabel(290, 80, 0x22, "Participants:");
            AddLabel(375, 80, 0, mobilesJoined.Count.ToString());
            //Participants end

            AddButton(370, 260, 2471, 2471, 9, GumpButtonType.Reply, 0); //NextPage
            AddButton(80, 260, 2468, 2468, 10, GumpButtonType.Reply, 0); //PreviousPage
            #endregion


            #region AddWinners
            AddLabel(120, 140, 0, "First:");
            AddButton(90, 140, 4005, 4005, 1, GumpButtonType.Reply, 0);
            if (current_SWG != null && current_SWG.m_First[0] != null)
            {
                AddLabel(170, 140, 0x22, current_SWG.m_First[0].Name);
            }
            else
            {
                AddLabel(170, 140, 0x22, "Select Player!");
            }


            AddLabel(120, 170, 0, "Second:");
            AddButton(90, 170, 4005, 4005, 2, GumpButtonType.Reply, 0);
            if (current_SWG != null && current_SWG.m_Second[0] != null)
            {
                AddLabel(170, 170, 0x22, current_SWG.m_Second[0].Name);
            }
            else
            {
                AddLabel(170, 170, 0x22, "Select Player!");
            }



            if (current_SWG != null && current_SWG.mobilesJoined != null && current_SWG.mobilesJoined.Count >= 34)
            {
                AddButton(90, 190, 4005, 4005, 3, GumpButtonType.Reply, 0);
                AddLabel(120, 190, 0, "Third:");
                if (current_SWG != null && current_SWG.m_Third[0] != null)
                {
                    AddLabel(170, 190, 0x22, current_SWG.m_Third[0].Name);
                }
                else
                {
                    AddLabel(170, 190, 0x22, "Select Player!");
                }
            }

            //Add 2v2 partner
            if (current_SWG.eventType.Contains("2vs2"))
            {
                AddLabel(270, 140, 0, "&");
                if (current_SWG != null && current_SWG.m_First[1] != null)
                {
                    AddLabel(290, 140, 0x22, current_SWG.m_First[1].Name);
                }
                else
                {
                    AddLabel(290, 140, 0x22, "Select Player!");
                }

                AddLabel(270, 170, 0, "&");
                if (current_SWG != null && current_SWG.m_Second[1] != null)
                {
                    AddLabel(290, 170, 0x22, current_SWG.m_Second[1].Name);
                }
                else
                {
                    AddLabel(290, 170, 0x22, "Select Player!");
                }

                if (current_SWG != null && current_SWG.mobilesJoined != null && current_SWG.mobilesJoined.Count >= 34)
                {
                    AddLabel(270, 190, 0, "&");
                    if (current_SWG != null && current_SWG.m_Third[1] != null)
                    {
                        AddLabel(290, 190, 0x22, current_SWG.m_Third[1].Name);
                    }
                    else
                    {
                        AddLabel(290, 190, 0x22, "Select Player!");
                    }
                }
            }

            #endregion
        }
예제 #10
0
        public void UpdateWinnerStats(OdbcConnection connection, DataRow oldRow, Mobile player, SelectWinnerGump swg)
        {
            string addWinnerString = string.Empty;
            int fpoints = 0, spoints = 0, tpoints = 0;

            if (swg.eventType == "1vs1 No Loot" || swg.eventType == "1vs1 Loot")
            {
                if (swg.mobilesJoined.Count >= 45)
                {
                    fpoints = 5;
                    spoints = 3;
                    tpoints = 2;
                }
                else if (swg.mobilesJoined.Count >= 34)
                {
                    fpoints = 4;
                    spoints = 2;
                    tpoints = 1;
                }
                else if (swg.mobilesJoined.Count >= 20)
                {
                    fpoints = 3;
                    spoints = 1;
                    tpoints = 0;
                }
                else if (swg.mobilesJoined.Count >= 14)
                {
                    fpoints = 2;
                    spoints = 1;
                    tpoints = 0;
                }
                else
                {
                    fpoints = 1;
                    spoints = 0;
                    tpoints = 0;
                }
            }
            else if (swg.eventType == "2vs2 No Loot" || swg.eventType == "2vs2 Loot")
            {
                if (swg.mobilesJoined.Count >= 34)
                {
                    fpoints = 3;
                    spoints = 2;
                    tpoints = 1;
                }
                else if (swg.mobilesJoined.Count >= 24)
                {
                    fpoints = 2;
                    spoints = 1;
                    tpoints = 0;
                }
                else
                {
                    fpoints = 1;
                    spoints = 0;
                    tpoints = 0;
                }
            }
            else
            {
                if (swg.mobilesJoined.Count >= 30)
                {
                    fpoints = 2;
                    spoints = 0;
                    tpoints = 0;
                }
                else
                {
                    fpoints = 1;
                    spoints = 0;
                    tpoints = 0;
                }
            }

            if (swg.eventType == "1vs1 No Loot" || swg.eventType == "1vs1 Loot")
            {
                if (player == m_First[0])
                {
                    addWinnerString = "UPDATE participant SET " +
                    "Name = '" + player.Name + "', " +
                    "Won = " + (int.Parse(oldRow.ItemArray[2].ToString()) + 1) + ", " +
                    "TotalPoints = " + (int.Parse(oldRow.ItemArray[6].ToString()) + fpoints) + ", " +
                    "1v1Points = " + (int.Parse(oldRow.ItemArray[7].ToString()) + fpoints) +
                    " WHERE Mobile = " + ((int)player.Serial);
                    //Misc.Guilds.GuildLadderUpdate.UpdateTourPoints(player, swg.mobilesJoined.Count);
                }
                else if (player == m_Second[0])
                {
                    addWinnerString = "UPDATE participant SET " +
                    "Name = '" + player.Name + "', " +
                    "Second = " + (int.Parse(oldRow.ItemArray[3].ToString()) + 1) + ", " +
                    "TotalPoints = " + (int.Parse(oldRow.ItemArray[6].ToString()) + spoints) + ", " +
                    "1v1Points = " + (int.Parse(oldRow.ItemArray[7].ToString()) + spoints) +
                    " WHERE Mobile = " + ((int)player.Serial);

                    //Misc.Guilds.GuildLadderUpdate.UpdateTourPoints(player, (int)(swg.mobilesJoined.Count/2));
                }
                else if (player == m_Third[0])
                {
                    addWinnerString = "UPDATE participant SET " +
                    "Name = '" + player.Name + "', " +
                    "Third = " + (int.Parse(oldRow.ItemArray[4].ToString()) + 1) + ", " +
                    "TotalPoints = " + (int.Parse(oldRow.ItemArray[6].ToString()) + tpoints) + ", " +
                    "1v1Points = " + (int.Parse(oldRow.ItemArray[7].ToString()) + tpoints) +
                    " WHERE Mobile = " + ((int)player.Serial);

                    //Misc.Guilds.GuildLadderUpdate.UpdateTourPoints(player, (int)(swg.mobilesJoined.Count / 3));

                }
            }
            else if (swg.eventType == "2vs2 No Loot" || swg.eventType == "2vs2 Loot")
            {
                if (player == m_First[0] || player == m_First[1])
                {
                    addWinnerString = "UPDATE participant SET " +
                    "Name = '" + player.Name + "', " +
                    "Won = " + (int.Parse(oldRow.ItemArray[2].ToString()) + 1) + ", " +
                    "TotalPoints = " + (int.Parse(oldRow.ItemArray[6].ToString()) + fpoints) + ", " +
                    "2v2Points = " + (int.Parse(oldRow.ItemArray[8].ToString()) + fpoints) +
                    " WHERE Mobile = " + ((int)player.Serial);

                    //Misc.Guilds.GuildLadderUpdate.UpdateTourPoints(player, (int)(swg.mobilesJoined.Count/2));

                }
                else if (player == m_Second[0] || player == m_Second[1])
                {
                    addWinnerString = "UPDATE participant SET " +
                    "Name = '" + player.Name + "', " +
                    "Second = " + (int.Parse(oldRow.ItemArray[3].ToString()) + 1) + ", " +
                    "TotalPoints = " + (int.Parse(oldRow.ItemArray[6].ToString()) + spoints) + ", " +
                    "2v2Points = " + (int.Parse(oldRow.ItemArray[8].ToString()) + spoints) +
                    " WHERE Mobile = " + ((int)player.Serial);
                    //Misc.Guilds.GuildLadderUpdate.UpdateTourPoints(player, (int)(swg.mobilesJoined.Count / 4));

                }
                else if (player == m_Third[0] || player == m_Third[1])
                {
                    addWinnerString = "UPDATE participant SET " +
                    "Name = '" + player.Name + "', " +
                    "Third = " + (int.Parse(oldRow.ItemArray[4].ToString()) + 1) + ", " +
                    "TotalPoints = " + (int.Parse(oldRow.ItemArray[6].ToString()) + tpoints) + ", " +
                    "2v2Points = " + (int.Parse(oldRow.ItemArray[9].ToString()) + tpoints) +
                    " WHERE Mobile = " + ((int)player.Serial);

                    //Misc.Guilds.GuildLadderUpdate.UpdateTourPoints(player, (int)(swg.mobilesJoined.Count / 6));

                }
            }
            else
            {
                if (player == m_First[0])
                {
                    addWinnerString = "UPDATE participant SET " +
                    "Name = '" + player.Name + "', " +
                    "Won = " + (int.Parse(oldRow.ItemArray[2].ToString()) + 1) + ", " +
                    "TotalPoints = " + (int.Parse(oldRow.ItemArray[6].ToString()) + fpoints) + ", " +
                    "OtherPoints = " + (int.Parse(oldRow.ItemArray[9].ToString()) + fpoints) +
                    " WHERE Mobile = " + ((int)player.Serial);
                }
                else if (player == m_Second[0])
                {
                    addWinnerString = "UPDATE participant SET " +
                    "Name = '" + player.Name + "', " +
                    "Second = " + (int.Parse(oldRow.ItemArray[3].ToString()) + 1) + ", " +
                    "TotalPoints = " + (int.Parse(oldRow.ItemArray[6].ToString()) + spoints) + ", " +
                    "OtherPoints = " + (int.Parse(oldRow.ItemArray[9].ToString()) + spoints) +
                    " WHERE Mobile = " + ((int)player.Serial);
                }
                else if (player == m_Third[0])
                {
                    addWinnerString = "UPDATE participant SET " +
                    "Name = '" + player.Name + "', " +
                    "Third = " + (int.Parse(oldRow.ItemArray[4].ToString()) + 1) + ", " +
                    "TotalPoints = " + (int.Parse(oldRow.ItemArray[6].ToString()) + tpoints) + ", " +
                    "OtherPoints = " + (int.Parse(oldRow.ItemArray[9].ToString()) + tpoints) +
                    " WHERE Mobile = " + ((int)player.Serial);
                }
            }

            OdbcCommand addWinnerCommand = connection.CreateCommand();
            addWinnerCommand.CommandText = addWinnerString;

            addWinnerCommand.ExecuteNonQuery();
        }
예제 #11
0
        public void AddWinnerToLadder(DataTable ladder, OdbcConnection dbConnection, SelectWinnerGump swg, Mobile winnerToAdd)
        {
            if (ladder.Rows.Contains(((int)winnerToAdd.Serial).ToString()) == false && mobilesAdded.Contains((winnerToAdd as PlayerMobile)) == false)
                AddPlayerToLadder(dbConnection, winnerToAdd);

            DataRow existingRow = ladder.Rows.Find((int)winnerToAdd.Serial);

            if (existingRow != null && winnerToAdd != null)
                UpdateWinnerStats(dbConnection, existingRow, winnerToAdd, swg);
            else
                AddWinnerToLadder(ladder, dbConnection, swg, winnerToAdd);
        }
예제 #12
0
        public void SetWinners(DataTable ladder, OdbcConnection dbConnection, SelectWinnerGump swg)
        {
            if (m_First[0] != null)
                AddWinnerToLadder(ladder, dbConnection, swg, m_First[0]);
            if (m_Second[0] != null)
                AddWinnerToLadder(ladder, dbConnection, swg, m_Second[0]);
            if (m_Third[0] != null)
                AddWinnerToLadder(ladder, dbConnection, swg, m_Third[0]);

            if (current_SWG.eventType.Contains("2vs2"))
            {
                if (m_First[1] != null)
                    AddWinnerToLadder(ladder, dbConnection, swg, m_First[1]);
                if (m_Second[1] != null)
                    AddWinnerToLadder(ladder, dbConnection, swg, m_Second[1]);
                if (m_Third[1] != null)
                    AddWinnerToLadder(ladder, dbConnection, swg, m_Third[1]);
            }
        }
예제 #13
0
        public void SetPlayersJoined(DataTable ladder, OdbcConnection dbConnection, SelectWinnerGump swg)
        {
            mobilesAdded = new ArrayList();
            DataTable tempTable = new DataTable();
            tempTable = ladder.Copy();

            //Set Primary key
            DataColumn[] primaryKey = new DataColumn[1];
            primaryKey[0] = ladder.Columns[0];
            ladder.PrimaryKey = primaryKey;

            foreach (DataRow dr in tempTable.Rows)
            {
                Mobile player = null;
                DataRow existingRow = null;

                foreach (PlayerMobile pm in swg.mobilesJoined)
                {
                    player = pm;
                    if (ladder.Rows.Count < 0)
                        AddPlayerToLadder(dbConnection, player);
                    else
                    {
                        if (ladder.Rows.Contains(((int)player.Serial).ToString()))
                        {
                            existingRow = ladder.Rows.Find((int)pm.Serial);
                            UpdatePlayerStats(dbConnection, existingRow, player);
                        }
                        else if (mobilesAdded.Contains(pm) == false)
                        {
                            AddPlayerToLadder(dbConnection, player);
                        }
                    }
                }
            }
        }
예제 #14
0
        public ComfirmGump(Mobile from, SelectWinnerGump swg)
            : base(50, 50)
        {
            if (swg != null)
                current_SWG = swg;

            m_First[0] = current_SWG.m_First[0];
            m_First[1] = current_SWG.m_First[1];

            m_Second[0] = current_SWG.m_Second[0];
            m_Second[1] = current_SWG.m_Second[1];

            m_Third[0] = current_SWG.m_Third[0];
            m_Third[1] = current_SWG.m_Third[1];

            AddBackground(50, 50, 400, 250, 9200);

            mobilesJoined = current_SWG.mobilesJoined;

            m_From = from;

            #region InitiateTextAndButtons
            //Event Type
            AddLabel(105, 80, 0x22, "Event Type:");
            AddLabel(180, 80, 0, current_SWG.eventType);
            //Event Type end

            //Participents
            AddLabel(290, 80, 0x22, "Participants:");
            AddLabel(375, 80, 0, current_SWG.mobilesJoined.Count.ToString());
            //Participants end

            AddButton(370, 260, 2462, 2462, 1, GumpButtonType.Reply, 0);//NextPage
            AddButton(80, 260, 2468, 2468, 2, GumpButtonType.Reply, 0);//PreviousPage
            #endregion

            #region AddWinners
            AddLabel(120, 140, 0, "First:");
            if (current_SWG != null && current_SWG.m_First[0] != null)
                AddLabel(170, 140, 0x22, current_SWG.m_First[0].Name);
            else
                AddLabel(170, 140, 0x22, "Select Player!");

            if (current_SWG.eventType.Contains("2vs2"))
            {
                AddLabel(250, 140, 0, "&");
                if (current_SWG != null && current_SWG.m_First[1] != null)
                    AddLabel(170, 140, 0x22, current_SWG.m_First[1].Name);
                else
                    AddLabel(170, 140, 0x22, "Select Player!");
            }


            AddLabel(120, 170, 0, "Second:");
            if (current_SWG != null && current_SWG.m_Second[0] != null)
                AddLabel(170, 170, 0x22, current_SWG.m_Second[0].Name);
            else
                AddLabel(170, 170, 0x22, "Select Player!");



            if (current_SWG != null && current_SWG.mobilesJoined != null && current_SWG.mobilesJoined.Count >= 34)
            {
                AddLabel(120, 190, 0, "Third:");
                if (current_SWG != null && current_SWG.m_Third[0] != null)
                    AddLabel(170, 190, 0x22, current_SWG.m_Third[0].Name);
                else
                    AddLabel(170, 190, 0x22, "Select Player!");
            }

            #endregion


        }
예제 #15
0
 public SelectMobile(SelectWinnerGump SWG, int place)
     : base(12, false, TargetFlags.None)
 {
     current_SWG = SWG;
     m_Place = place;
 }
예제 #16
0
        public SelectWinnerGump(Mobile from, InitiateEventGump ieg, SelectWinnerGump swg)
            : base(50, 50)
        {
            #region InitiateVars
            if (swg == null)
            {
                current_SWG = this;
                IEG = ieg;
            }
            else
            {
                current_SWG = swg;
                IEG = current_SWG.IEG;
            }

            m_From = from;

            AddBackground(50, 50, 400, 250, 9200);

            if (IEG.mobilesJoined != null)
                mobilesJoined = IEG.mobilesJoined;
            else
                mobilesJoined = new ArrayList();

            if (IEG.eventType != null)
                eventType = IEG.eventType;

            if (from is PlayerMobile)
                (from as PlayerMobile).LadderGump = current_SWG;

            #endregion


            #region InitiateTextAndButtons
            //Event Type
            AddLabel(105, 80, 0x22, "Event Type:");
            AddLabel(180, 80, 0, eventType);
            //Event Type end

            //Participents
            AddLabel(290, 80, 0x22, "Participants:");
            AddLabel(375, 80, 0, mobilesJoined.Count.ToString());
            //Participants end

            AddButton(370, 260, 2471, 2471, 9, GumpButtonType.Reply, 0);//NextPage
            AddButton(80, 260, 2468, 2468, 10, GumpButtonType.Reply, 0);//PreviousPage
            #endregion


            #region AddWinners
            AddLabel(120, 140, 0, "First:");
            AddButton(90, 140, 4005, 4005, 1, GumpButtonType.Reply, 0);
            if (current_SWG != null && current_SWG.m_First[0] != null)
                AddLabel(170, 140, 0x22, current_SWG.m_First[0].Name);
            else
                AddLabel(170, 140, 0x22, "Select Player!");


            AddLabel(120, 170, 0, "Second:");
            AddButton(90, 170, 4005, 4005, 2, GumpButtonType.Reply, 0);
            if (current_SWG != null && current_SWG.m_Second[0] != null)
                AddLabel(170, 170, 0x22, current_SWG.m_Second[0].Name);
            else
                AddLabel(170, 170, 0x22, "Select Player!");



            if (current_SWG != null && current_SWG.mobilesJoined != null && current_SWG.mobilesJoined.Count >= 34)
            {
                AddButton(90, 190, 4005, 4005, 3, GumpButtonType.Reply, 0);
                AddLabel(120, 190, 0, "Third:");
                if (current_SWG != null && current_SWG.m_Third[0] != null)
                    AddLabel(170, 190, 0x22, current_SWG.m_Third[0].Name);
                else
                    AddLabel(170, 190, 0x22, "Select Player!");
            }

            //Add 2v2 partner
            if (current_SWG.eventType.Contains("2vs2"))
            {
                AddLabel(270, 140, 0, "&");
                if (current_SWG != null && current_SWG.m_First[1] != null)
                    AddLabel(290, 140, 0x22, current_SWG.m_First[1].Name);
                else
                    AddLabel(290, 140, 0x22, "Select Player!");

                AddLabel(270, 170, 0, "&");
                if (current_SWG != null && current_SWG.m_Second[1] != null)
                    AddLabel(290, 170, 0x22, current_SWG.m_Second[1].Name);
                else
                    AddLabel(290, 170, 0x22, "Select Player!");

                if (current_SWG != null && current_SWG.mobilesJoined != null && current_SWG.mobilesJoined.Count >= 34)
                {
                    AddLabel(270, 190, 0, "&");
                    if (current_SWG != null && current_SWG.m_Third[1] != null)
                        AddLabel(290, 190, 0x22, current_SWG.m_Third[1].Name);
                    else
                        AddLabel(290, 190, 0x22, "Select Player!");
                }
            }

            #endregion

        }