Пример #1
0
        /// <summary>
        /// Befriends the leader.
        /// </summary>
        /// <param name="cost">How much will it cost to hire him?</param>
        public void Befriend(int cost)
        {
            var c = new Character(Name, FriendDesc, FriendSpeed, FriendSkill, cost);

            Hacking.AddCharacter(c);
            Hacking.SaveCharacters();
        }
 public void SetupBuyable()
 {
     if (!IsTutorial)
     {
         BuyableModules = Hacking.GetFutureModules();
     }
     cmbbuyable.Items.Clear();
     foreach (var m in BuyableModules)
     {
         cmbbuyable.Items.Add(m.Name);
     }
     lbmoduleinfo.Text = "";
     txtgrade.Text     = "1";
 }
        private void btnupgrade_Click(object sender, EventArgs e)
        {
            int price = 20 * SelectedComputer.Grade;

            if (API.Codepoints >= price)
            {
                foreach (var m in GetMyNet())
                {
                    if (m.Hostname == SelectedComputer.Hostname)
                    {
                        SelectedComputer.Grade += 1;
                        m.Grade += 1;
                        Hacking.SaveCharacters();
                        API.CreateInfoboxSession("Upgrade successful.", "Your module has been upgraded.", infobox.InfoboxMode.Info);
                    }
                }
            }
            else
            {
                API.CreateInfoboxSession("Insufficient funds", $"You need at least {price} CP to upgrade this module.", infobox.InfoboxMode.Info);
            }
            ShowPCInfo(SelectedComputer.Hostname);
        }
 private void btncloseinfo_Click(object sender, EventArgs e)
 {
     SelectedComputer = null;
     pnlpcinfo.Hide();
     Hacking.SaveCharacters();
 }