Beispiel #1
0
        private void OpenNewEventWindow(object sender, EventArgs e)
        {
            //get selected campaign ID
            int        CampaignID            = (int)campaignSelectorList.SelectedValue;
            PartyClass selectedCampaignParty = new PartyClass();

            using (SqlConnection con = new SqlConnection(connectionString))
            {
                using (SqlDataAdapter adaptor = new SqlDataAdapter("SELECT * FRom PlayerBase WHERE CampaignId = '" + CampaignID + "'", con))
                {
                    DataTable playerTable = new DataTable();
                    adaptor.Fill(playerTable);

                    foreach (DataRow PlayerInfo in playerTable.Rows)
                    {
                        PlayerClass toAdd = new PlayerClass(PlayerInfo["PlayerName"].ToString(), (int)PlayerInfo["CharacterLevel"], PlayerInfo["CharacterName"].ToString());
                        selectedCampaignParty.addPartyMember(toAdd);
                    }

                    con.Close();
                }
            }

            RandomOrBuiltEventForm newEventBuilder = new RandomOrBuiltEventForm();

            newEventBuilder.setCampaignParty(selectedCampaignParty);
            newEventBuilder.Visible = true;
        }
Beispiel #2
0
        private void calculatePartyXPDifficultyLevels(PartyClass selectedParty)
        {
            partyEasyThreshold   = 0;
            partyMediumThreshold = 0;
            partyHardThreshold   = 0;
            partyDeadlyThreshold = 0;

            foreach (PlayerClass currentPlayer in selectedParty.getPartyMembers())
            {
                string Query = "SELECT * from ExperienceThresholds WHERE Id_Level = '" + currentPlayer.getPlayerLevel() + "'";

                using (SqlConnection con = new SqlConnection(connectionString))
                {
                    using (SqlDataAdapter adaptor = new SqlDataAdapter(Query, con))
                    {
                        DataTable experienceTable = new DataTable();
                        adaptor.Fill(experienceTable);

                        foreach (DataRow ExperienceRow in experienceTable.Rows)
                        {
                            partyEasyThreshold   += (int)ExperienceRow["Easy"];
                            partyMediumThreshold += (int)ExperienceRow["Medium"];
                            partyHardThreshold   += (int)ExperienceRow["Hard"];
                            partyDeadlyThreshold += (int)ExperienceRow["Deadly"];
                        }

                        con.Close();
                    }
                }
            }
        }
Beispiel #3
0
 public void setCampaignParty(PartyClass toSet)
 {
     campaignParty = toSet;
 }