private void btnDetails_Click(object sender, EventArgs e) { campAdventure nwa = bs_nwAdventure.Current as campAdventure; if (nwa == null) { SetMessage("No Current Adventure Selected"); return; } else { if (nwa.LongName == "" || nwa.LongName == null || bs_hostCampaign.Current == null) { SetMessage("Cannot Save Adventure - No Adventure Name"); } else { //Save and load this.Repository.Save(nwa); frmAdventureDetail frmAdventure = new frmAdventureDetail(); frmAdventure.Adventure = nwa; frmAdventure.Database = this.Database; frmAdventure.Repository = this.Repository; frmAdventure.initData(); frmAdventure.ShowDialog(this); frmAdventure.Dispose(); } } }
private void btnSave_Click(object sender, EventArgs e) { if (bs_nwAdventure.Current == null) { return; } campAdventure nwa = bs_nwAdventure.Current as campAdventure; Repository.Save(nwa); SetMessage("Saved Adventure:" + nwa.LongName); }
private void btnNewAdventure_Click(object sender, EventArgs e) { campCampaign camp = bs_hostCampaign.Current as campCampaign; if (camp == null) { SetMessage("Cannot Add Adventure - No Current campaign"); } else { campAdventure nwa = bs_nwAdventure.AddNew() as campAdventure; camp.Adventures.Add(nwa); nwa.Campaign = camp; tboxAdventureName.Focus(); } }
private void bs_nwAdventure_CurrentChanged(object sender, EventArgs e) { if (bs_nwAdventure.Current == null) { return; } campAdventure nwa = bs_nwAdventure.Current as campAdventure; bs_nwXPGained.DataSource = nwa.Rewards; bs_nwMilestone.DataSource = nwa.Milestones; bs_nwChar.DataSource = nwa.GetPlayers(); chklboxPlayers.Items.Clear(); foreach (hostChar p in nwa.GetPlayers()) { chklboxPlayers.Items.Add(p); } }
private void btnPlayerSelect_Click(object sender, EventArgs e) { bool bExists; //health check campAdventure nw = bs_nwAdventure.Current as campAdventure; if (nw == null) { SetMessage("No Current Adventure"); return; } campCampaign camp = nw.Campaign; if (camp == null) { SetMessage("No Campaign for Adventure:" + nw.LongName); return; } //create Campaign Characters List IList <hostChar> plist = new List <hostChar>(); foreach (campCharCampaign c in camp.Characters) { if (c.Character.isNPC == false && c.Approved) { // Remove if already rewarded / in Adventure bExists = false; foreach (campXPGained xp in nw.Rewards) { if (xp.Character == c.Character) { bExists = true; SetMessage("Skipping " + c.Character.LongName + " exists already"); } } //doesnt exist, isnt NPC, is approved if (!bExists) { plist.Add(c.Character); } } } SetMessage("Loaded" + plist.Count().ToString() + " Campaign Characters"); frmSelectPlayers frmPlayers = new frmSelectPlayers(); frmPlayers.Players = plist; frmPlayers.ShowDialog(this); plist = frmPlayers.Players; frmPlayers.Dispose(); SetMessage("Select returned" + plist.Count().ToString() + " Campaign Characters"); //Create new records for new players foreach (hostChar c in plist) { campXPGained xp = new campXPGained("", "", nw, c, 0, 0, false); nw.Rewards.Add(xp); } //refresh charlist binding bs_nwAdventure_CurrentChanged(null, null); }