private void ContractInfo_Load(object sender, EventArgs e) { //any contract if (ContractType == 0 || ContractType == 1) { if (ContractType == 0) { contracts = Globals.whitehatContracts; } else if (ContractType == 1) { contracts = Globals.blackhatContracts; } //fill fields with contract info lblName.Text = contracts[ContractPosition].Name; lblPayment.Text = "$" + contracts[ContractPosition].Payment.ToString(); lblLevel.Text = "Level: " + contracts[ContractPosition].Level.ToString(); picLogo.Image = Image.FromFile("contractLogo\\level" + contracts[ContractPosition].Level.ToString() + "\\" + contracts[ContractPosition].Name + ".png", true); string Skills = ""; if (contracts[ContractPosition].Programming > 0) { Skills += "Programming: " + contracts[ContractPosition].Programming + Environment.NewLine; } if (contracts[ContractPosition].PasswordCracking > 0) { Skills += "Password Cracking: " + contracts[ContractPosition].PasswordCracking + Environment.NewLine; } if (contracts[ContractPosition].DDOS > 0) { Skills += "DDOS: " + contracts[ContractPosition].DDOS + Environment.NewLine; } if (contracts[ContractPosition].IPSpoofing > 0) { Skills += "IP Spoofing: " + contracts[ContractPosition].IPSpoofing; } txtSkills.Text = Skills; } //any freelance else if (ContractType == 2) { //remove unnecessary controls lblLevel.Visible = false; picLogo.Visible = false; lblName.Text = Globals.freelanceList[ContractPosition].Name; lblPayment.Text = "$" + Globals.freelanceList[ContractPosition].Payment.ToString(); string Skills = ""; if (Globals.freelanceList[ContractPosition].Programming > 0) { Skills += "Programming: " + Globals.freelanceList[ContractPosition].Programming + Environment.NewLine; } if (Globals.freelanceList[ContractPosition].PasswordCracking > 0) { Skills += "Password Cracking: " + Globals.freelanceList[ContractPosition].PasswordCracking; } txtSkills.Text += Skills; } //current contract else if (ContractType == 3) { btnAccept.Visible = false; btnHack.Visible = true; contract = Globals.CurrentContract; lblName.Text = contract.Name; lblPayment.Text = "$" + contract.Payment.ToString(); lblLevel.Text = "Level: " + contract.Level.ToString(); picLogo.Image = Image.FromFile("contractLogo\\level" + contract.Level.ToString() + "\\" + contract.Name + ".png", true); string Skills = ""; if (contract.Programming > 0) { Skills += "Programming: " + contract.Programming + Environment.NewLine; } if (contract.PasswordCracking > 0) { Skills += "Password Cracking: " + contract.PasswordCracking + Environment.NewLine; } if (contract.DDOS > 0) { Skills += "DDOS: " + contract.DDOS + Environment.NewLine; } if (contract.IPSpoofing > 0) { Skills += "IP Spoofing: " + contract.IPSpoofing; } txtSkills.Text = Skills; } //current freelance else if (ContractType == 4) { btnAccept.Visible = false; btnHack.Visible = true; lblLevel.Visible = false; picLogo.Visible = false; freelance = Globals.CurrentFreelance; lblName.Text = freelance.Name; lblPayment.Text = "$" + freelance.Payment.ToString(); string Skills = ""; if (freelance.Programming > 0) { Skills += "Programming: " + freelance.Programming + Environment.NewLine; } if (freelance.PasswordCracking > 0) { Skills += "Password Cracking: " + freelance.PasswordCracking; } txtSkills.Text += Skills; } //collective's contract else if (ContractType == 5) { btnAccept.Visible = false; btnHack.Visible = true; contract = Globals.mycollectiveContract; lblName.Text = contract.Name; lblPayment.Text = "$" + contract.Payment.ToString(); lblLevel.Text = "Level: " + contract.Level.ToString(); picLogo.Image = Image.FromFile("contractLogo\\level" + contract.Level.ToString() + "\\" + contract.Name + ".png", true); string Skills = ""; if (contract.Programming > 0) { Skills += "Programming: " + contract.Programming + Environment.NewLine; } if (contract.PasswordCracking > 0) { Skills += "Password Cracking: " + contract.PasswordCracking + Environment.NewLine; } if (contract.DDOS > 0) { Skills += "DDOS: " + contract.DDOS + Environment.NewLine; } if (contract.IPSpoofing > 0) { Skills += "IP Spoofing: " + contract.IPSpoofing; } txtSkills.Text = Skills; } }
private void Game_Load(object sender, EventArgs e) { GameType = r.Next(0, 2); //calculate starting chance of success if (Type == 3) { contract = Globals.CurrentContract; int Programming = 0; int PasswordCracking = 0; int DDOS = 0; int IPSpoofing = 0; foreach (var teammember in Globals.Team) { if (teammember != null) { Programming += teammember.Programming; PasswordCracking += teammember.PasswordCracking; DDOS += teammember.DDOS; IPSpoofing += teammember.IPSpoofing; } } if (contract.Programming > 0) { Programming -= contract.Programming; } if (contract.PasswordCracking > 0) { PasswordCracking -= contract.PasswordCracking; } if (contract.DDOS > 0) { DDOS -= contract.DDOS; } if (contract.IPSpoofing > 0) { IPSpoofing -= contract.IPSpoofing; } successChance = 50 + 2 * (Programming + PasswordCracking + DDOS + IPSpoofing); lblsuccessChance.Text = successChance.ToString() + "%"; } else if (Type == 4) { freelance = Globals.CurrentFreelance; int Programming = 0; int PasswordCracking = 0; foreach (var teammember in Globals.Team) { if (teammember != null) { Programming += teammember.Programming; PasswordCracking += teammember.PasswordCracking; } } if (freelance.Programming > 0) { Programming -= freelance.Programming; } if (freelance.PasswordCracking > 0) { PasswordCracking -= freelance.PasswordCracking; } successChance = 60 + 2 * (Programming + PasswordCracking); lblsuccessChance.Text = successChance.ToString() + "%"; } else if (Type == 5) { contract = Globals.mycollectiveContract; int Programming = 0; int PasswordCracking = 0; int DDOS = 0; int IPSpoofing = 0; foreach (var teammember in Globals.Team) { if (teammember != null) { Programming += teammember.Programming; PasswordCracking += teammember.PasswordCracking; DDOS += teammember.DDOS; IPSpoofing += teammember.IPSpoofing; } } if (contract.Programming > 0) { Programming -= contract.Programming; } if (contract.PasswordCracking > 0) { PasswordCracking -= contract.PasswordCracking; } if (contract.DDOS > 0) { DDOS -= contract.DDOS; } if (contract.IPSpoofing > 0) { IPSpoofing -= contract.IPSpoofing; } successChance = 50 + 2 * (Programming + PasswordCracking + DDOS + IPSpoofing); lblsuccessChance.Text = successChance.ToString() + "%"; } lblClick.Left = r.Next(pnlsquareClick.Left + 50, pnlsquareClick.Right - 50); lblClick.Top = r.Next(pnlsquareClick.Top + 50, pnlsquareClick.Bottom - 50); MessageBox.Show("The game will start in three seconds from when you hit OK.", "Game Starting", MessageBoxButtons.OK, MessageBoxIcon.Information); tmrgameTime.Enabled = true; }