Inheritance: PlayerController
 public WizardPagerAdapter(FragmentManager fragmentManager, WizardFlow wizardFlow, IStateManager stateManager, Wizard wizard)
     : base(fragmentManager)
 {
     WizardFlow = wizardFlow;
     StateManager = stateManager;
     Wizard = wizard;
 }
        public void TestSpells()
        {
            TestSpell test = new TestSpell();
            Entity caster = new Wizard(new int[] { 10, 10, 10, 10, 10, 10 });
            caster.SetArmor(Armors.halfPlate);
            caster.SetOffHand(Armors.towerShield);
            ArcaneSpell testArcane = new ArcaneSpell();
            DivineSpell testDivine = new DivineSpell();
            bool fizzled = false;
            for(int i = 0; i < 100; i++)
            {
                if(testArcane.DidFizzle(caster))
                {
                    fizzled = true;
                    break;
                }
            }
            Assert.IsTrue(fizzled, "Arcane spells should fizzle");

            fizzled = false;
            for (int i = 0; i < 100; i++)
            {
                if (testDivine.DidFizzle(caster))
                {
                    fizzled = true;
                    break;
                }
            }
            Assert.IsFalse(fizzled, "Divine spells should not fizzle");
        }
Exemple #3
0
        public void buttonCancel_Click_ShouldCallCloseOnActiveForm()
        {
            MockRepository mock = new MockRepository();

            Wizard wizard = new Wizard();
            IWizardFormFactory formFactory = mock.StrictMock<IWizardFormFactory>();
            WizardForm mockForm = mock.DynamicMock<WizardForm>();

            DummyPage page = new DummyPage();

            wizard.Pages.AddFirst(page);

            wizard.WizardFormFactory = formFactory;
            SetUpCommonExpectationsOnFormFactory(formFactory, mockForm);
            SetUpCommonExpectationsOnForm(mockForm);

            Expect.Call(mockForm.Close);

            mock.ReplayAll();

            wizard.StartWizard(null);

            Button button = new Button();
            EventArgs e = new EventArgs();
            wizard.buttonCancel_Click(button, e);

            mock.VerifyAll();
        }
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.wizard = new WebsitePanel.Setup.Wizard();
			this.SuspendLayout();
			// 
			// wizard
			// 
			this.wizard.BannerImage = global::WebsitePanel.Setup.Properties.Resources.BannerImage;
			this.wizard.Dock = System.Windows.Forms.DockStyle.Fill;
			this.wizard.Location = new System.Drawing.Point(0, 0);
			this.wizard.MarginImage = global::WebsitePanel.Setup.Properties.Resources.MarginImage;
			this.wizard.Name = "wizard";
			this.wizard.SelectedPage = null;
			this.wizard.Size = new System.Drawing.Size(495, 358);
			this.wizard.TabIndex = 0;
			this.wizard.Finish += new System.EventHandler(this.OnWizardFinish);
			this.wizard.Cancel += new System.EventHandler(this.OnWizardCancel);
			// 
			// InstallerForm
			// 
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.ClientSize = new System.Drawing.Size(495, 358);
			this.Controls.Add(this.wizard);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "InstallerForm";
			this.ShowInTaskbar = false;
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "Setup Wizard";
			this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.OnFormClosed);
			this.ResumeLayout(false);

		}
	override protected void Awake() {
		base.Awake();
		
		wizard = GameObject.Find("Wizard").GetComponent<Wizard>();
		candy = GameObject.Find("Candy").GetComponent<Candy>();
		eraserBrush = GameObject.Find("EraserBrush").GetComponent<Brush>(); 
	}
            public void Chain_of_properties_will_be_guarded()
            {
                _wizard = new Wizard() {First = null};

                Assert.That(_wizard, Is.Not.Null);
                Assert.That(_wizard?.First?.Length, Is.Null);
            }
	void Start() {
		instance = this;
		Level = 1;
		expSlider.value = 0;
		calculateNextLvl ();
		player = GameObject.FindGameObjectWithTag("Player").GetComponent<Wizard>();
	}
    public Spell GenerateRandomSpell(Wizard wizard)
    {
        var descriptor = SpellDescriptors.ElementAt(random.Next(SpellDescriptors.Count()));
        var obj = SpellObjects.ElementAt(random.Next(SpellObjects.Count()));

        return new Spell(nextId++, wizard, descriptor, obj);
    }
 public void Move(Wizard self, World world, Game game, Move move)
 {
     #if DEBUG
     // один раз вызвать Begin*()
     vc.BeginPost();
     #endif
     move.Speed = game.WizardForwardSpeed;
     move.StrafeSpeed = game.WizardStrafeSpeed;
     move.Turn = game.WizardMaxTurnAngle;
     move.Action = ActionType.MagicMissile;
     #if DEBUG
     // вывод отладочной информации
     vc.Text(self.X - 35, self.Y - 37, string.Format("{0:D} | {1:F0} : {2:F0}", self.RemainingCooldownTicksByAction[(int)ActionType.MagicMissile], self.X, self.Y));
     vc.Line(self.X, self.Y, self.X + Math.Cos(self.Angle - game.StaffSector / 2f)*self.CastRange, self.Y + Math.Sin(self.Angle - game.StaffSector / 2f)*self.CastRange, 1f, 0.7f, 0.7f);
     vc.Line(self.X, self.Y, self.X + Math.Cos(self.Angle + game.StaffSector / 2f) * self.CastRange, self.Y + Math.Sin(self.Angle + game.StaffSector / 2f) * self.CastRange, 1f, 0.7f, 0.7f);
     vc.Arc(self.X, self.Y, self.CastRange, self.Angle - game.StaffSector / 2f, game.StaffSector, 1f, 0.7f, 0.7f);
     #endif
     move.Turn = 0.01;
     move.Speed = 3;
     move.Action = ActionType.MagicMissile;
     #if DEBUG
     // в конце вызвать End*()
     vc.EndPost();
     #endif
 }
        public SetSqlStrPage(Wizard wizard)
            : this()
        {
            this.wizard = wizard;
            comboBox.Text = wizard.settings.SqlConString;

            Binding bb;

            bb = new Binding("SqlConString");
            bb.Source = wizard.settings;
            bb.Mode = BindingMode.TwoWay;
            comboBox.SetBinding(ComboBox.TextProperty, bb);

            #if DEBUG
            ComboBoxItem i = new ComboBoxItem();
            string dir = System.IO.Path.Combine(System.Environment.CurrentDirectory, "Database.mdf");
            i.Content = "Server=(localdb)\\v11.0;Integrated Security=true;AttachDbFileName=" + dir + ";";
            comboBox.Items.Add(i);

            i = new ComboBoxItem();
            i.Content = "Server=tcp:ljus-och-miljo-ab-sql-server.database.windows.net,1433;Database=Ljus_och_Miljo_DB;User ID=LaAdmin@ljus-och-miljo-ab-sql-server;Password=1mgtA45m4pkKK34HHIwfAW;Trusted_Connection=False;Encrypt=True;";
            comboBox.Items.Add(i);

            if (comboBox.Text == "")
                comboBox.Text = i.Content.ToString();
            #endif
        }
    public void ResearchNewSpellClicked(bool fromFirstScreen=false)
    {
        if (wizardName != null)
        {
            if (fromFirstScreen) playerWizard = wizardManager.GenerateWizard(wizardName);

            playerWizard.CurrentSpell = spellManager.GenerateRandomSpell(playerWizard);
            
            allSpells.Add(playerWizard.CurrentSpell);

            notificationManager.QueueNotification("You've researched the " + playerWizard.CurrentSpell.Name + " spell!");

            if (wizardIcon.inRegion) currentRegion.IntroduceSpell(playerWizard.CurrentSpell);

            if (fromFirstScreen)
            {
                
                regionManager.AddRandomSpellsToAllRegions();
                menuManager.HideScreen();
                notificationManager.QueueNotification("Promote your spell! You can change which region you're promoting in by clicking the region icon.", 8f);
            }

            gameObject.SendMessage("UpdateUI");
        }
    }
 public void AbleToGetTotalGold()
 {
     //Arrange
     Wizard player = new Wizard();
     //Assert
     double actual = player.Gold;
     Assert.IsTrue(actual >= 30 && actual <= 120);
 }
Exemple #13
0
 public void GivenAWizardLevel_SpellArrayIsReturned(int level, int[] expectedSpells)
 {
     PlayerClass player = new Wizard();
     player.AssignLevel(level);
     player.GetClassSpellsPerDay();
     int[] actual = player.Magic.ClassSpellsPerDay;
     Assert.AreEqual(expectedSpells, actual);
 }
 public void AddWizard(Wizard wizard)
 {
     if (wizard.CurrentSpell != null && !AllSpells.ContainsKey(wizard.CurrentSpell.Id))
     {
         IntroduceSpell(wizard.CurrentSpell);
     }
     VisitingWizards.Add(wizard);
 }
 public Spell(int id, Wizard wizard, SpellDescriptor descriptor, SpellObject obj)
 {
     this.Id = id;
     this.Wizard = wizard;
     this.Descriptor = descriptor;
     this.Object = obj;
     this.RegionalSpells = new Dictionary<Region, RegionalSpell>();
 }
        public override bool Dispatch(Wizard Wizard) {
            this.Wizard = Wizard;

            //WizardCreateProfile.StartTaskPersonalProfile(); // start the profile creation task


            return true;
            }
        protected override void ProcessToPrevious(Wizard.ViewModels.WizardViewModel model)
        {
            // Do here some custom things if you navigate to the next step.

            if (model.GetType() == typeof(CharacterWizardViewModel))
            {
                // Check the type so you could use multiple wizards in one controller.
            }
        }
	public void KillPlayer(Wizard wizard) {
		players.Remove(wizard);
		Destroy(wizard.gameObject);

		if (players.Count == 1) {
			YouWin();
		}
		
	}
Exemple #19
0
        /// <summary>
        /// Simulates a fight between the wizard and the boss.
        /// </summary>
        /// <param name="spellSelector">A delegate to a method to use to select the next spell to conjure.</param>
        /// <param name="difficulty">The difficulty to play with.</param>
        /// <returns>
        /// A <see cref="Tuple{T1, T2}"/> that returns whether the wizard won and the amount of mana spent by the wizard.
        /// </returns>
        internal static Tuple<bool, int> Fight(Func<Wizard, ICollection<string>, string> spellSelector, string difficulty)
        {
            Wizard wizard = new Wizard(spellSelector);
            Boss boss = new Boss();

            Player winner = Fight(wizard, boss, difficulty, (f, a) => { });

            return Tuple.Create(winner == wizard, wizard.ManaSpent);
        }
    public Character CreatePlayer(string name, int loadedLevel, GameObject playerObject)
    {
        Character character = null;

        switch (name)
        {
            case "Wizard":
                character = new Wizard(loadedLevel, playerObject);
                break;
        }

        return character;
    }
        public override void Initialize(Wizard Wizard) {
            base.Initialize(Wizard.Model);

            // Here try to pull a machine name from the environment variables
            DeviceName.Value = Goedel.Platform.Environment.MachineName;

            // Here look to see if we already have a device profile
            if (ProfileManager.RegistrationMachine.Device == null) {
                NewDeviceProfile.Value = true;
                NewDeviceProfile.ReadOnly = true;
                Gotit = "Yep";
                }
            }
 public void BaseAttackIsReturned()
 {
     //Arrange
     Wizard player = new Wizard();
     player.AssignBaseStats(10, 10, 10, 10, 10, 10);
     player.AssignMiscMods(0, 0, 0, 0, 0, 0);
     player.AssignLevel(1);
     //Act
     player.CalculateBaseAttack();
     int actual = player.Attack.BaseAttack;
     int expected = 0;
     Assert.AreEqual(expected, actual);
 }
	public void ResetTo(Wizard sender, Wizard target) {
		this.target = target;
		this.caster = sender;

		castTime = Time.time;
		initialPos = transform.position;

		if (element != ElementType.Earth) {
			transform.LookAt (target.transform.position);
		}

		flyTime *= .8f;
	}
    public List<Wizard> GenerateRandomWizards(int count)
    {
        var wizNames = wizardNames.OrderBy(n => random.Next()).Take(count);

        List<Wizard> newWizards = new List<Wizard>();

        foreach (var name in wizNames)
        {
            var wiz = new Wizard(nextId++, name);
            Wizards.Add(wiz.Id, wiz);
            newWizards.Add(wiz);
        }

        return newWizards;
    }
    void Start()
    {
        //finds the palyer's transform in order to follow him
        Player = GameObject.FindGameObjectWithTag ("Player");
        target = Player.transform;
        fireball = GameObject.Find("Fireball");

        FindEnemyScript = this.GetComponent<Wizard> ();

        enemyWeapon = transform.Find("body/arm_bicecp_right/arm_forearm_right/Hand_Right/WizardStaff").gameObject;

        //Debug.Log (enemyWeapon.name);
        gameObject.GetComponent<Animation>().CrossFade(enemyOtherAnimations[0], .1f);
        FindEnemyScript.enabled = true;
    }
	public Wizard GetNext(Wizard me, Wizard currTarget) {
		Assert.IsTrue(players.Contains(me));
		if (currTarget) Assert.IsTrue(players.Contains(currTarget));
		Assert.IsTrue(players.Count > 1);

		Wizard target = currTarget;

		var idx = players.IndexOf(currTarget);
		if (idx < 0) idx = players.IndexOf(me);

		target = players[(idx + 1) % players.Count];
		if (target == me) target = players[(idx + 2) % players.Count];

		return target;
	}
Exemple #27
0
        private void PageCreate_WizardNext(object sender, Wizard.UI.WizardPageEventArgs e)
        {
            try
            {
                Debug.Assert(m_wiz.CreateOp != null);

                // Make sure the workspace name does not contain leading or trailing spaces.
                m_wiz.CreateOp.Creds.KwsName = txtKwsName.Text.Trim();
                m_wiz.CreateOp.Creds.SecureFlag = rbSecure.Checked;
                m_wiz.CreateOp.WizCreatePageNext();
                e.Cancel = true;
            }
            catch (Exception ex)
            {
                Base.HandleException(ex);
            }
        }
Exemple #28
0
        public Wizard Build()
        {
            var firstPage = new WizardPage {
                Header = "Create project from the simple template",
                InputFields = new WizardInputField[]{
                new WizardFieldDescription{Description = "This template is a very simple example of a wizard, with just one page and one input field."},
                new WizardFieldDescription{Description = "Enter a test message to display."},
                new TextWizardInputField() { TemplateId = "$custommessage$" }
            }
            };

            var wizard = new Wizard {
                Title = "Simple Wizard",
                Pages = new List<WizardPage> { firstPage }
            };

            return wizard;
        }
            private async Task<Wizard> ApparateAsync()
            {
                Wizard wizard = null;

                try
                {
                    wizard = await MoM.ApparateAsync();
                }
                catch (Exception e)
                {
                    await LogAsync(e);
                    wizard = new Wizard();
                }
                finally
                {
                    if (wizard != null) await CleanupAsync();
                }

                return wizard;
            }
        /// <summary>
        ///  Tells the fragment that its activity has completed its own Activity.onCreate().
        /// </summary>
        /// <param name="savedInstanceState"></param>
        public override void OnActivityCreated(Bundle savedInstanceState)
        {
            base.OnActivityCreated(savedInstanceState);

            if (savedInstanceState != null) { //Load pre-saved wizard context.. Coming in from a orientation change perhaps
                WizardFlow.LoadFlow(savedInstanceState);
                
                StateManager.ContextBundle = savedInstanceState.GetBundle(STATE_WIZARD_CONTEXT);
                StateManager.LoadStepContext(this);
            }
            else {
                StateManager.ContextBundle = new Bundle();    //Initialize wizard context
                //Persist hosting activity/fragment fields to wizard context enabling easy data transfer between wizard host and the steps
                StateManager.PersistStepContext(this);
            }
            
            Wizard = new Wizard(WizardFlow, StateManager, ChildFragmentManager);

            Wizard.StepChanged += OnWizardStepChanged;
            Wizard.WizardComplete += OnWizardComplete;
        }
Exemple #31
0
        /// <inheritdoc/>
        protected override void Run()
        {
            Wizard.TryInvoke((Action)(() => Wizard.TaskCount++));
            try
            {
                var propertyUpdater = new DispatcherTimer(
                    new TimeSpan(0, 0, 0, 1),
                    DispatcherPriority.Normal,
                    (object sender, EventArgs e) => _ShowLog?.RaiseCanExecuteChanged(),
                    Wizard.Dispatcher);
                propertyUpdater.Start();
                try
                {
                    // Get a random TCP port for openvpn.exe management interface.
                    var mgmtServer = new TcpListener(IPAddress.Loopback, 0);
                    mgmtServer.Start();
                    try
                    {
                        byte[] ovpn;
                        var    mgmtEndpoint = mgmtServer.LocalEndpoint as IPEndPoint;
                        var    mgmtPassword = Membership.GeneratePassword(16, 6);
                        try
                        {
                            // Prepare OpenVPN configuration.
                            var fs = new MemoryStream();
                            using (fs)
                                using (var sw = new StreamWriter(fs))
                                {
                                    if (Properties.SettingsEx.Default.OpenVPNRemoveOptions is StringCollection openVPNRemoveOptions)
                                    {
                                        // Remove options on the OpenVPNRemoveOptions list on the fly.
                                        using (var sr = new StringReader(ProfileConfig.Value))
                                        {
                                            string inlineTerm   = null;
                                            var    inlineRemove = false;
                                            for (; ;)
                                            {
                                                var line = sr.ReadLine();
                                                if (line == null)
                                                {
                                                    break;
                                                }

                                                var trimmedLine = line.Trim();
                                                if (!string.IsNullOrEmpty(trimmedLine))
                                                {
                                                    // Not an empty line.
                                                    if (inlineTerm == null)
                                                    {
                                                        // Not inside an inline option block = Regular parsing mode.
                                                        if (!trimmedLine.StartsWith("#") &&
                                                            !trimmedLine.StartsWith(";"))
                                                        {
                                                            // Not a comment.
                                                            var option = Configuration.ParseParams(trimmedLine);
                                                            if (option.Count > 0)
                                                            {
                                                                if (option[0].StartsWith("<") && !option[0].StartsWith("</") && option[0].EndsWith(">"))
                                                                {
                                                                    // Start of an inline option.
                                                                    var o = option[0].Substring(1, option[0].Length - 2);
                                                                    inlineTerm   = "</" + o + ">";
                                                                    inlineRemove = openVPNRemoveOptions.Contains(o);
                                                                    if (inlineRemove)
                                                                    {
                                                                        sw.WriteLine("# Commented by OpenVPNRemoveOptions setting:");
                                                                        line = "# " + line;
                                                                    }
                                                                }
                                                                else if (openVPNRemoveOptions.Contains(option[0]))
                                                                {
                                                                    sw.WriteLine("# Commented by OpenVPNRemoveOptions setting:");
                                                                    line = "# " + line;
                                                                }
                                                            }
                                                        }
                                                    }
                                                    else
                                                    {
                                                        // Inside an inline option block.
                                                        if (inlineRemove)
                                                        {
                                                            // Remove the inline option content.
                                                            line = "# " + line;
                                                        }

                                                        if (trimmedLine == inlineTerm)
                                                        {
                                                            // Inline option terminator found. Returning to regular parsing mode.
                                                            inlineTerm = null;
                                                        }
                                                    }
                                                }

                                                sw.WriteLine(line);
                                            }
                                        }
                                    }
                                    else
                                    {
                                        sw.Write(ProfileConfig.Value);
                                    }

                                    // Append eduVPN Client specific configuration directives.
                                    sw.WriteLine();
                                    sw.WriteLine();
                                    sw.WriteLine("# eduVPN Client for Windows");

                                    // Introduce ourself (to OpenVPN server).
                                    var assembly = Assembly.GetExecutingAssembly();
                                    var assemblyTitleAttribute = Attribute.GetCustomAttributes(assembly, typeof(AssemblyTitleAttribute)).SingleOrDefault() as AssemblyTitleAttribute;
                                    var assemblyVersion        = assembly?.GetName()?.Version;
                                    sw.WriteLine("setenv IV_GUI_VER " + Configuration.EscapeParamValue(assemblyTitleAttribute?.Title + " " + assemblyVersion?.ToString()));

                                    // Configure log file (relative to WorkingFolder).
                                    sw.WriteLine("log-append " + Configuration.EscapeParamValue(ConnectionId + ".txt"));

                                    // Configure interaction between us and openvpn.exe.
                                    sw.WriteLine("management " + Configuration.EscapeParamValue(mgmtEndpoint.Address.ToString()) + " " + Configuration.EscapeParamValue(mgmtEndpoint.Port.ToString()));
                                    sw.WriteLine("<management-client-pass>");
                                    sw.WriteLine(mgmtPassword);
                                    sw.WriteLine("</management-client-pass>");
                                    sw.WriteLine("management-hold");    // Wait for our signal to start connecting.
                                    sw.WriteLine("management-signal");  // Raise SIGUSR1 if our client dies/closes management interface.
                                    sw.WriteLine("remap-usr1 SIGTERM"); // SIGUSR1 (reconnect) => SIGTERM (disconnect)
                                    sw.WriteLine("management-query-passwords");

                                    // Ask when username/password is denied.
                                    sw.WriteLine("auth-retry interact");
                                    sw.WriteLine("auth-nocache");

                                    // Set Wintun interface to be used.
                                    sw.Write("windows-driver wintun\n");
                                    var    hash         = new SHA1CryptoServiceProvider();                                                                    // https://datatracker.ietf.org/doc/html/rfc4122#section-4.3
                                    byte[] bufferPrefix = { 0x6b, 0xa7, 0xb8, 0x11, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8 }; // https://datatracker.ietf.org/doc/html/rfc4122#appendix-C in network byte order
                                    hash.TransformBlock(bufferPrefix, 0, bufferPrefix.Length, bufferPrefix, 0);
                                    var bufferUri = Encoding.UTF8.GetBytes(new Uri(ConnectingProfile.Server.Base, ConnectingProfile.Id).AbsoluteUri);
                                    hash.TransformFinalBlock(bufferUri, 0, bufferUri.Length);
                                    var guid = new Guid(
                                        ((uint)hash.Hash[0] << 24) | ((uint)hash.Hash[1] << 16) | ((uint)hash.Hash[2] << 8) | hash.Hash[3], // time_low
                                        (ushort)(((uint)hash.Hash[4] << 8) | hash.Hash[5]),                                                 // time_mid
                                        (ushort)(((((uint)hash.Hash[6] << 8) | hash.Hash[7]) & 0x0fff) | 0x5000),                           // time_hi_and_version
                                        (byte)(((uint)hash.Hash[8] & 0x3f) | 0x80),                                                         // clock_seq_hi_and_reserved
                                        hash.Hash[9],                                                                                       // clock_seq_low
                                        hash.Hash[10], hash.Hash[11], hash.Hash[12], hash.Hash[13], hash.Hash[14], hash.Hash[15]);          // node[0-5]
                                    sw.Write("dev-node {" + guid + "}\n");

#if DEBUG
                                    // Renegotiate data channel every 5 minutes in debug versions.
                                    sw.WriteLine("reneg-sec 300");
#endif

                                    if (Environment.OSVersion.Version < new Version(6, 2))
                                    {
                                        // Windows 7 is using tiny 8kB send/receive socket buffers by default.
                                        // Increase to 64kB which is default from Windows 8 on.
                                        sw.WriteLine("sndbuf 65536");
                                        sw.WriteLine("rcvbuf 65536");
                                    }

                                    var openVPNAddOptions = Properties.SettingsEx.Default.OpenVPNAddOptions;
                                    if (!string.IsNullOrWhiteSpace(openVPNAddOptions))
                                    {
                                        sw.WriteLine();
                                        sw.WriteLine();
                                        sw.WriteLine("# Added by OpenVPNAddOptions setting:");
                                        sw.WriteLine(openVPNAddOptions);
                                    }
                                }
                            ovpn = fs.ToArray();
                        }
                        catch (OperationCanceledException) { throw; }
                        catch (Exception ex) { throw new AggregateException(string.Format(Resources.Strings.ErrorSavingProfileConfiguration, ConfigurationPath), ex); }

retry:
                        // Connect to OpenVPN Interactive Service to launch the openvpn.exe.
                        using (var openvpnInteractiveServiceConnection = new eduOpenVPN.InteractiveService.Session())
                        {
                            // Release TCP port for openvpn.exe management interface.
                            mgmtServer.Stop();

                            try
                            {
                                openvpnInteractiveServiceConnection.Connect(
                                    string.Format("openvpn{0}\\service", Properties.SettingsEx.Default.OpenVPNInteractiveServiceInstance),
                                    WorkingFolder,
                                    new string[] { "--config", "stdin", },
                                    Encoding.UTF8.GetString(ovpn),
                                    3000,
                                    Window.Abort.Token);
                            }
                            catch (OperationCanceledException) { throw; }
                            catch (Exception ex) { throw new AggregateException(Resources.Strings.ErrorInteractiveService, ex); }

                            try
                            {
                                // Connect to the openvpn.exe management interface.
                                var mgmtClient     = new TcpClient();
                                var reconnectCount = 0;
reconnect:
                                var mgmtClientTask = mgmtClient.ConnectAsync(mgmtEndpoint.Address, mgmtEndpoint.Port);
                                try { mgmtClientTask.Wait(30000, Window.Abort.Token); }
                                catch (AggregateException ex)
                                {
                                    if (ex.InnerException is SocketException ex2 && ex2.SocketErrorCode == SocketError.ConnectionRefused &&
                                        ++reconnectCount < 30 && !Window.Abort.Token.WaitHandle.WaitOne(1000))
                                    {
                                        Trace.TraceWarning("Failed to connect to openvpn.exe");
                                        goto reconnect;
                                    }
                                    throw ex.InnerException;
                                }
                                try
                                {
                                    // Create and start the management session.
                                    ManagementSession = new eduOpenVPN.Management.Session();
                                    ManagementSession.ByteCountReported  += ManagementSession_ByteCountReported;
                                    ManagementSession.FatalErrorReported += ManagementSession_FatalErrorReported;
                                    ManagementSession.HoldReported       += ManagementSession_HoldReported;
                                    ManagementSession.StateReported      += ManagementSession_StateReported;
                                    ManagementSession.Start(mgmtClient.GetStream(), mgmtPassword, Window.Abort.Token);

                                    // Initialize session and release openvpn.exe to get started.
                                    ManagementSession.SetVersion(3, Window.Abort.Token);
                                    ManagementSession.ReplayAndEnableState(Window.Abort.Token);
                                    ManagementSession.ReplayAndEnableEcho(Window.Abort.Token);
                                    ManagementSession.SetByteCount(5, Window.Abort.Token);
                                    ManagementSession.ReleaseHold(Window.Abort.Token);

                                    Wizard.TryInvoke((Action)(() =>
                                    {
                                        _Renew?.RaiseCanExecuteChanged();
                                        _Disconnect?.RaiseCanExecuteChanged();
                                        Wizard.TaskCount--;
                                    }));
                                    try
                                    {
                                        // Wait for the session to end gracefully.
                                        ManagementSession.Monitor.Join();
                                        if (!(ManagementSession.Error is OperationCanceledException) && !DisconnectInProgress)
                                        {
                                            goto retry;
                                        }
                                    }
                                    finally { Wizard.TryInvoke((Action)(() => Wizard.TaskCount++)); }
                                }
                                finally { mgmtClient.Close(); }
                            }
                            finally
                            {
                                Wizard.TryInvoke((Action)(() =>
                                {
                                    // Cleanup status properties.
                                    State = SessionStatusType.Disconnecting;
                                    StateDescription = Resources.Strings.OpenVPNStateTypeExiting;
                                    TunnelAddress = null;
                                    IPv6TunnelAddress = null;
                                    ConnectedAt = null;
                                    BytesIn = null;
                                    BytesOut = null;
                                }));

                                // Wait for openvpn.exe to finish. Maximum 30s.
                                try { Process.GetProcessById(openvpnInteractiveServiceConnection.ProcessId)?.WaitForExit(30000); }
                                catch (ArgumentException) { }
                            }
                        }
                    }
                    finally { mgmtServer.Stop(); }
                }
                finally { propertyUpdater.Stop(); }
            }
            finally { Wizard.TryInvoke((Action)(() => Wizard.TaskCount--)); }
        }
Exemple #32
0
 /// <summary>
 /// Sets the data.
 /// </summary>
 private void SetData()
 {
     Wizard.SetUserData(_dataKey, SelectedModel);
 }
Exemple #33
0
        private void ScanInternetHistory()
        {
            var  fileList   = new List <string>();
            long nTotalSize = 0;
            var  filePath   = "";

            try
            {
                filePath           = $@"{ChromeDefaultDir}\Archived History";
                Wizard.CurrentFile = filePath;
                if (File.Exists(filePath))
                {
                    if (MiscFunctions.IsFileValid(filePath))
                    {
                        fileList.Add(filePath);
                        nTotalSize += MiscFunctions.GetFileSize(filePath);
                    }
                }
            }
            catch (Exception)
            {
                // ignored
            }

            try
            {
                filePath           = $@"{ChromeDefaultDir}\Visited Links";
                Wizard.CurrentFile = filePath;
                if (File.Exists(filePath))
                {
                    if (MiscFunctions.IsFileValid(filePath))
                    {
                        fileList.Add(filePath);
                        nTotalSize += MiscFunctions.GetFileSize(filePath);
                    }
                }
            }
            catch (Exception)
            {
                // ignored
            }

            try
            {
                filePath           = $@"{ChromeDefaultDir}\Current Tabs";
                Wizard.CurrentFile = filePath;
                if (File.Exists(filePath))
                {
                    if (MiscFunctions.IsFileValid(filePath))
                    {
                        fileList.Add(filePath);
                        nTotalSize += MiscFunctions.GetFileSize(filePath);
                    }
                }
            }
            catch (Exception)
            {
                // ignored
            }

            try
            {
                filePath           = $@"{ChromeDefaultDir}\Last Tabs";
                Wizard.CurrentFile = filePath;
                if (File.Exists(filePath))
                {
                    if (MiscFunctions.IsFileValid(filePath))
                    {
                        fileList.Add(filePath);
                        nTotalSize += MiscFunctions.GetFileSize(filePath);
                    }
                }
            }
            catch (Exception)
            {
                // ignored
            }

            try
            {
                foreach (var fileHistory in Directory.GetFiles(ChromeDefaultDir, "History Index *"))
                {
                    Wizard.CurrentFile = filePath;

                    if (!File.Exists(fileHistory))
                    {
                        continue;
                    }

                    if (!MiscFunctions.IsFileValid(fileHistory))
                    {
                        continue;
                    }

                    fileList.Add(fileHistory);
                    nTotalSize += MiscFunctions.GetFileSize(fileHistory);
                }
            }
            catch (Exception)
            {
                // ignored
            }

            Wizard.StoreBadFileList("Clear Internet History", fileList.ToArray(), nTotalSize);
        }
Exemple #34
0
        public void ProceedTest()
        {
            var wizard = new Wizard
            {
                Name = "Simple Test"
            };

            InitialWizardPage  initialState = new InitialWizardPage();
            ApprovalWizardPage pageQ1       = new ApprovalWizardPage("Q1");
            ApprovalWizardPage pageQ2       = new ApprovalWizardPage("Q2");
            ApprovalWizardPage pageQ3       = new ApprovalWizardPage("Q3");

            WizardPage finalPage1 = new FinalWizardPage();
            WizardPage finalPage2 = new FinalWizardPage();
            WizardPage finalPage3 = new FinalWizardPage();
            WizardPage finalPage4 = new FinalWizardPage();

            wizard.InitialState = initialState;
            wizard.States.Add(pageQ1);
            wizard.States.Add(pageQ2);
            wizard.States.Add(pageQ3);
            wizard.States.Add(finalPage1);
            wizard.States.Add(finalPage2);
            wizard.States.Add(finalPage3);
            wizard.States.Add(finalPage4);

            Connection fromInitialToApprovalCon = new Connection(initialState, pageQ1);

            initialState.Start = fromInitialToApprovalCon;

            //Q1
            Connection appQ1Q3    = new Connection(pageQ1, pageQ3);
            Connection disAppQ1Q2 = new Connection(pageQ1, pageQ2);

            pageQ1.ApprovedConnection    = appQ1Q3;
            pageQ1.DisapprovedConnection = disAppQ1Q2;

            //Q2
            Connection appQ2F2    = new Connection(pageQ2, finalPage2);
            Connection disAppQ2F1 = new Connection(pageQ2, finalPage1);

            pageQ2.ApprovedConnection    = appQ2F2;
            pageQ2.DisapprovedConnection = disAppQ2F1;

            //Q3
            Connection appQ3F4    = new Connection(pageQ3, finalPage4);
            Connection disAppQ3F3 = new Connection(pageQ3, finalPage3);

            pageQ3.ApprovedConnection    = appQ3F4;
            pageQ3.DisapprovedConnection = disAppQ3F3;

            wizard.Reset();

            Assert.AreEqual(pageQ1, wizard.CurrentState);

            wizard.CurrentState.SetData(true);
            wizard.Proceed();

            Assert.AreEqual(pageQ3, wizard.CurrentState);

            wizard.CurrentState.SetData(false);
            wizard.Proceed();

            Assert.AreEqual(finalPage3, wizard.CurrentState);
        }
Exemple #35
0
        public static void AntiShrooms(Obj_AI_Base sender, GameObjectIssueOrderEventArgs args)
        {
            if (sender != null && sender.IsMe)
            {
                var turret = Turrets.ClosestEnemyTurret;
                if (Map == Utility.Map.MapType.SummonersRift && Heroes.Player.HasBuff("Recall") && Heroes.Player.CountEnemiesInRange(1800) == 0 &&
                    turret.Distance(Heroes.Player) > 950 && !Minions.EnemyMinions.Any(m => m.Distance(Heroes.Player) < 950))
                {
                    args.Process = false;
                    return;
                }

                if (args.Order == GameObjectOrder.MoveTo)
                {
                    if (args.TargetPosition.IsZero)
                    {
                        args.Process = false;
                        return;
                    }
                    if (!args.TargetPosition.IsValid())
                    {
                        args.Process = false;
                        return;
                    }
                    if (Map == Utility.Map.MapType.SummonersRift && Heroes.Player.InFountain() &&
                        Heroes.Player.HealthPercent < 100)
                    {
                        args.Process = false;
                        return;
                    }
                    if (turret != null && turret.Distance(args.TargetPosition) < 950 &&
                        turret.CountNearbyAllyMinions(950) < 3)
                    {
                        args.Process = false;
                        return;
                    }
                }

                #region BlockAttack

                if (args.Target != null && args.Order == GameObjectOrder.AttackUnit || args.Order == GameObjectOrder.AttackTo)
                {
                    if (Config.Item("onlyfarm").GetValue <bool>() && args.Target.IsValid <Obj_AI_Hero>())
                    {
                        args.Process = false;
                        return;
                    }
                    if (args.Target.IsValid <Obj_AI_Hero>())
                    {
                        if (Minions.AllyMinions.Count(m => m.Distance(Heroes.Player) < 900) <
                            Minions.EnemyMinions.Count(m => m.Distance(Heroes.Player) < 900))
                        {
                            args.Process = false;
                            return;
                        }
                        if (((Obj_AI_Hero)args.Target).UnderTurret(true))
                        {
                            args.Process = false;
                            return;
                        }
                    }
                    if (Heroes.Player.UnderTurret(true) && args.Target.IsValid <Obj_AI_Hero>())
                    {
                        args.Process = false;
                        return;
                    }
                    if (turret != null && turret.Distance(ObjectManager.Player) < 950 && turret.CountNearbyAllyMinions(950) < 3)
                    {
                        args.Process = false;
                        return;
                    }
                    if (Heroes.Player.HealthPercent < Config.Item("recallhp").GetValue <Slider>().Value)
                    {
                        args.Process = false;
                        return;
                    }
                }

                #endregion
            }
            if (sender != null && args.Target != null && args.Target.IsMe)
            {
                if (sender is Obj_AI_Turret || sender is Obj_AI_Minion)
                {
                    var minion = Wizard.GetClosestAllyMinion();
                    if (minion != null)
                    {
                        Orbwalker.ForceOrbwalkingPoint(
                            Heroes.Player.Position.Extend(Wizard.GetClosestAllyMinion().Position, Heroes.Player.Distance(minion) + 100));
                    }
                }
            }
        }
Exemple #36
0
        public override void OnActivate()
        {
            base.OnActivate();

            // Setup self-update.
            var self_update = new BackgroundWorker()
            {
                WorkerReportsProgress = true
            };

            self_update.DoWork += (object sender, DoWorkEventArgs e) =>
            {
                self_update.ReportProgress(0);
                var random         = new Random();
                var discovery_uri  = Properties.Settings.Default.SelfUpdateDescr.Uri;
                var temp_folder    = Path.GetTempPath();
                var working_folder = temp_folder + Path.GetRandomFileName() + "\\";
                Directory.CreateDirectory(working_folder);
                try
                {
                    string     installer_filename = null;
                    FileStream installer_file     = null;

                    // Download installer.
                    var repo_hash   = ((string)ObjWeb["hash-sha256"]).FromHexToBin();
                    var binary_uris = (List <object>)ObjWeb["uri"];
                    while (binary_uris.Count > 0)
                    {
                        Window.Abort.Token.ThrowIfCancellationRequested();
                        var uri_idx = random.Next(binary_uris.Count);
                        try
                        {
                            var binary_uri = new Uri(discovery_uri, (string)binary_uris[uri_idx]);
                            Trace.TraceInformation("Downloading installer file from {0}...", binary_uri.AbsoluteUri);
                            var request = WebRequest.Create(binary_uri);
                            request.Proxy = null;
                            using (var response = request.GetResponse())
                            {
                                // 1. Get installer filename from Content-Disposition header.
                                // 2. Get installer filename from the last segment of URI path.
                                // 3. Fallback to a predefined installer filename.
                                try { installer_filename = Path.GetFullPath(working_folder + new ContentDisposition(request.Headers["Content-Disposition"]).FileName); }
                                catch {
                                    try   { installer_filename = Path.GetFullPath(working_folder + binary_uri.Segments[binary_uri.Segments.Length - 1]); }
                                    catch { installer_filename = Path.GetFullPath(working_folder + Properties.Settings.Default.ClientTitle + " Client Setup.exe"); }
                                }

                                // Save response data to file.
                                installer_file = File.Open(installer_filename, FileMode.CreateNew, FileAccess.Write, FileShare.Read | FileShare.Inheritable);
                                try
                                {
                                    using (var stream = response.GetResponseStream())
                                    {
                                        installer_file.Seek(0, SeekOrigin.Begin);
                                        var  hash = new eduEd25519.SHA256();
                                        var  buffer = new byte[1048576];
                                        long offset = 0, total = response.ContentLength;

                                        for (; ;)
                                        {
                                            // Wait for the data to arrive.
                                            Window.Abort.Token.ThrowIfCancellationRequested();
                                            var buffer_length = stream.Read(buffer, 0, buffer.Length);
                                            if (buffer_length == 0)
                                            {
                                                break;
                                            }

                                            // Append it to the file and hash it.
                                            Window.Abort.Token.ThrowIfCancellationRequested();
                                            installer_file.Write(buffer, 0, buffer_length);
                                            hash.TransformBlock(buffer, 0, buffer_length, buffer, 0);

                                            // Report progress.
                                            offset += buffer_length;
                                            self_update.ReportProgress((int)(offset * 100 / total));
                                        }

                                        hash.TransformFinalBlock(buffer, 0, 0);
                                        if (!hash.Hash.SequenceEqual(repo_hash))
                                        {
                                            throw new DownloadedFileCorruptException(String.Format(Resources.Strings.ErrorDownloadedFileCorrupt, binary_uri.AbsoluteUri));
                                        }

                                        installer_file.SetLength(installer_file.Position);
                                        break;
                                    }
                                }
                                catch
                                {
                                    // Close installer file.
                                    installer_file.Close();
                                    installer_file = null;

                                    // Delete installer file. If possible.
                                    Trace.TraceInformation("Deleting file {0}...", installer_filename);
                                    try { File.Delete(installer_filename); }
                                    catch (Exception ex2) { Trace.TraceWarning("Deleting {0} file failed: {1}", installer_filename, ex2.ToString()); }
                                    installer_filename = null;

                                    throw;
                                }
                            }
                        }
                        catch (OperationCanceledException) { throw; }
                        catch (Exception ex)
                        {
                            Trace.TraceWarning("Error: {0}", ex.ToString());
                            binary_uris.RemoveAt(uri_idx);
                        }
                    }

                    if (installer_filename == null || installer_file == null)
                    {
                        // The installer file is not ready.
                        throw new InstallerFileUnavailableException();
                    }

                    try
                    {
                        var updater_filename = Path.GetFullPath(working_folder + Properties.Settings.Default.ClientTitle + " Client Setup and Relaunch.wsf");
                        var updater_file     = File.Open(updater_filename, FileMode.CreateNew, FileAccess.Write, FileShare.Read | FileShare.Inheritable);
                        try
                        {
                            // Prepare WSF file.
                            var writer = new XmlTextWriter(updater_file, null);
                            writer.WriteStartDocument();
                            writer.WriteStartElement("package");
                            writer.WriteStartElement("job");

                            writer.WriteStartElement("reference");
                            writer.WriteAttributeString("object", "WScript.Shell");
                            writer.WriteEndElement(); // reference

                            writer.WriteStartElement("reference");
                            writer.WriteAttributeString("object", "Scripting.FileSystemObject");
                            writer.WriteEndElement(); // reference

                            writer.WriteStartElement("script");
                            writer.WriteAttributeString("language", "JScript");
                            var installer_arguments_esc = eduJSON.Parser.GetValue(ObjWeb, "arguments", out string installer_arguments) ? " " + HttpUtility.JavaScriptStringEncode(installer_arguments) : "";
                            var argv      = Environment.GetCommandLineArgs();
                            var arguments = new StringBuilder();
                            for (long i = 1, n = argv.LongLength; i < n; i++)
                            {
                                if (i > 1)
                                {
                                    arguments.Append(" ");
                                }
                                arguments.Append("\"");
                                arguments.Append(argv[i].Replace("\"", "\"\""));
                                arguments.Append("\"");
                            }
                            var script = new StringBuilder();
                            script.AppendLine("// This script was auto-generated.");
                            script.AppendLine("// Launch installer file and wait for the update to finish.");
                            script.AppendLine("var wsh = WScript.CreateObject(\"WScript.Shell\");");
                            script.AppendLine("if (wsh.Run(\"\\\"" + HttpUtility.JavaScriptStringEncode(installer_filename.Replace("\"", "\"\"")) + "\\\"" + installer_arguments_esc + "\", 0, true) == 0) {");
                            script.AppendLine("  // Installer succeeded. Relaunch the application.");
                            script.AppendLine("  var shl = WScript.CreateObject(\"Shell.Application\");");
                            script.AppendLine("  shl.ShellExecute(\"" + HttpUtility.JavaScriptStringEncode(argv[0]) + "\", \"" + HttpUtility.JavaScriptStringEncode(arguments.ToString()) + "\", \"" + HttpUtility.JavaScriptStringEncode(Environment.CurrentDirectory) + "\");");
                            script.AppendLine("}");
                            script.AppendLine("// Cleanup.");
                            script.AppendLine("var fso = WScript.CreateObject(\"Scripting.FileSystemObject\");");
                            script.AppendLine("try { fso.DeleteFile(\"" + HttpUtility.JavaScriptStringEncode(installer_filename) + "\", true); } catch (err) {}");
                            script.AppendLine("try { fso.DeleteFile(\"" + HttpUtility.JavaScriptStringEncode(updater_filename) + "\", true); } catch (err) {}");
                            script.AppendLine("try { fso.DeleteFolder(\"" + HttpUtility.JavaScriptStringEncode(working_folder.TrimEnd(Path.DirectorySeparatorChar)) + "\", true); } catch (err) {}");
                            writer.WriteCData(script.ToString());
                            writer.WriteEndElement(); // script

                            writer.WriteEndElement(); // job
                            writer.WriteEndElement(); // package
                            writer.WriteEndDocument();
                            writer.Flush();

                            // Prepare WSF launch parameters.
                            Trace.TraceInformation("Launching update script file {0}...", updater_filename);
                            var process = new Process();
                            process.StartInfo.FileName         = "wscript.exe";
                            process.StartInfo.Arguments        = "\"" + updater_filename + "\"";
                            process.StartInfo.WorkingDirectory = working_folder;

                            // Close WSF and installer files as late as possible to narrow the attack window.
                            // If Windows supported executing files that are locked for writing, we could leave those files open.
                            updater_file.Close();
                            installer_file.Close();
                            process.Start();
                        }
                        catch
                        {
                            // Close WSF file.
                            updater_file.Close();

                            // Delete WSF file. If possible.
                            Trace.TraceInformation("Deleting file {0}...", updater_filename);
                            try { File.Delete(updater_filename); }
                            catch (Exception ex2) { Trace.TraceWarning("Deleting {0} file failed: {1}", updater_filename, ex2.ToString()); }

                            throw;
                        }
                    }
                    catch
                    {
                        // Close installer file.
                        installer_file.Close();

                        // Delete installer file. If possible.
                        Trace.TraceInformation("Deleting file {0}...", installer_filename);
                        try { File.Delete(installer_filename); }
                        catch (Exception ex2) { Trace.TraceWarning("Deleting {0} file failed: {1}", installer_filename, ex2.ToString()); }

                        throw;
                    }
                }
                catch
                {
                    // Delete working folder. If possible.
                    try { Directory.Delete(working_folder); }
                    catch (Exception ex2) { Trace.TraceWarning("Deleting {0} folder failed: {1}", working_folder, ex2.ToString()); }

                    throw;
                }
            };

            // Self-update progress.
            self_update.ProgressChanged += (object sender, ProgressChangedEventArgs e) =>
            {
                Progress.Value = e.ProgressPercentage;
            };

            // Self-update completition.
            self_update.RunWorkerCompleted += (object sender, RunWorkerCompletedEventArgs e) =>
            {
                if (e.Error == null)
                {
                    // Self-updating successfuly launched. Quit to release open files.
                    Wizard.OnQuitApplication(this);
                }
                else
                {
                    Wizard.Error = e.Error;
                }

                // Self-dispose.
                (sender as BackgroundWorker)?.Dispose();
            };

            self_update.RunWorkerAsync();
        }
Exemple #37
0
        /**
         * Инциализируем стратегию.
         * <p>
         * Для этих целей обычно можно использовать конструктор, однако в данном случае мы хотим инициализировать генератор
         * случайных чисел значением, полученным от симулятора игры.
         */

        void InitializeStrategy(Wizard self, Game game)
        {
            //if (random == null)
            //{
            //  random = new Random(game.RandomSeed);

            double mapSize = game.MapSize;

            switch ((int)self.Id)
            {
            case 1:
            case 2:
            case 6:
            case 7:
                lane      = LaneType.Top;
                waypoints = new Point2D[]
                {
                    new Point2D(100.0D, mapSize - 100.0D),
                    new Point2D(100.0D, mapSize - 400.0D),
                    new Point2D(200.0D, mapSize - 800.0D),
                    new Point2D(200.0D, mapSize * 0.75D),
                    new Point2D(200.0D, mapSize * 0.5D),
                    new Point2D(200.0D, mapSize * 0.25D),
                    new Point2D(200.0D, 200.0D),
                    new Point2D(mapSize * 0.25D, 200.0D),
                    new Point2D(mapSize * 0.5D, 200.0D),
                    new Point2D(mapSize * 0.75D, 200.0D),
                    new Point2D(mapSize - 200.0D, 200.0D)
                };
                break;

            case 3:
            case 8:
                lane      = LaneType.Middle;
                waypoints = new Point2D[]
                {
                    new Point2D(100.0D, mapSize - 100.0D),
                    self.Faction == Faction.Renegades
                            ? new Point2D(600.0D, mapSize - 200.0D)
                            : new Point2D(200.0D, mapSize - 600.0D),
                    new Point2D(800.0D, mapSize - 800.0D),
                    new Point2D(mapSize - 600.0D, 600.0D)
                };
                break;

            case 4:
            case 5:
            case 9:
            case 10:
                lane      = LaneType.Bottom;
                waypoints = new Point2D[]
                {
                    new Point2D(100.0D, mapSize - 100.0D),
                    new Point2D(400.0D, mapSize - 100.0D),
                    new Point2D(800.0D, mapSize - 200.0D),
                    new Point2D(mapSize * 0.25D, mapSize - 200.0D),
                    new Point2D(mapSize * 0.5D, mapSize - 200.0D),
                    new Point2D(mapSize * 0.75D, mapSize - 200.0D),
                    new Point2D(mapSize - 200.0D, mapSize - 200.0D),
                    new Point2D(mapSize - 200.0D, mapSize * 0.75D),
                    new Point2D(mapSize - 200.0D, mapSize * 0.5D),
                    new Point2D(mapSize - 200.0D, mapSize * 0.25D),
                    new Point2D(mapSize - 200.0D, 200.0D)
                };
                break;
            }

            // Наша стратегия исходит из предположения, что заданные нами ключевые точки упорядочены по убыванию
            // дальности до последней ключевой точки. Сейчас проверка этого факта отключена, однако вы можете
            // написать свою проверку, если решите изменить координаты ключевых точек.

            /*Point2D lastWaypoint = waypoints[waypoints.length - 1];
             *
             * Preconditions.checkState(ArrayUtils.isSorted(waypoints, (waypointA, waypointB) -> Double.compare(
             *      waypointB.getDistanceTo(lastWaypoint), waypointA.getDistanceTo(lastWaypoint)
             * )));*/
            // }
        }
Exemple #38
0
 public HireWizard(CaptainId captainId, Wizard wizard) : base(captainId)
 {
     this.Wizard = wizard;
 }
Exemple #39
0
 public Game(Wizard wizard, Boss boss, bool hardMode = false)
 {
     _wizard          = wizard;
     _boss            = boss;
     _pipelineBuilder = new GamePipelineBuilder(hardMode);
 }
Exemple #40
0
 /* For type integer:
  * 0: Fireball
  * 1: BullshitArrow
  * 2: DeafeningBlast
  * 3: IceBullet*/
 public SpellProjectile(int dmg, float speed, Vector3 direc, Vector3 start, GameObject proj, Wizard player, int type, int mana)
 {
     damage     = dmg;
     projSpeed  = speed;
     direction  = direc;
     startPos   = start;
     spriteType = type;
     manaCost   = mana;
     projectile = proj;
     caster     = player;
     Create();
 }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SynchronizeFeedsWizard));
     this.chkDisplayWelcome       = new System.Windows.Forms.CheckBox();
     this.pageFeedCredentials     = new Divelements.WizardFramework.WizardPage();
     this.lblFeedCredentialsIntro = new System.Windows.Forms.Label();
     this.lblUsername             = new System.Windows.Forms.Label();
     this.textUser            = new System.Windows.Forms.TextBox();
     this.lblPassword         = new System.Windows.Forms.Label();
     this.textPassword        = new System.Windows.Forms.TextBox();
     this.pageSourceName      = new Divelements.WizardFramework.WizardPage();
     this.textFeedSourceName  = new System.Windows.Forms.TextBox();
     this.label2              = new System.Windows.Forms.Label();
     this.pageStartImport     = new Divelements.WizardFramework.WizardPage();
     this.fbrssLinkHelp       = new System.Windows.Forms.LinkLabel();
     this.label1              = new System.Windows.Forms.Label();
     this.radioFeedlyCloud    = new System.Windows.Forms.RadioButton();
     this.radioCommonFeedlist = new System.Windows.Forms.RadioButton();
     this._btnImmediateFinish = new System.Windows.Forms.Button();
     this.wizard              = new Divelements.WizardFramework.Wizard();
     this.errorProvider1      = new System.Windows.Forms.ErrorProvider(this.components);
     this.pageFeedCredentials.SuspendLayout();
     this.pageSourceName.SuspendLayout();
     this.pageStartImport.SuspendLayout();
     this.wizard.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.errorProvider1)).BeginInit();
     this.SuspendLayout();
     //
     // chkDisplayWelcome
     //
     this.chkDisplayWelcome.Checked    = true;
     this.chkDisplayWelcome.CheckState = System.Windows.Forms.CheckState.Checked;
     resources.ApplyResources(this.chkDisplayWelcome, "chkDisplayWelcome");
     this.chkDisplayWelcome.Name = "chkDisplayWelcome";
     //
     // pageFeedCredentials
     //
     this.pageFeedCredentials.Controls.Add(this.lblFeedCredentialsIntro);
     this.pageFeedCredentials.Controls.Add(this.lblUsername);
     this.pageFeedCredentials.Controls.Add(this.textUser);
     this.pageFeedCredentials.Controls.Add(this.lblPassword);
     this.pageFeedCredentials.Controls.Add(this.textPassword);
     resources.ApplyResources(this.pageFeedCredentials, "pageFeedCredentials");
     this.pageFeedCredentials.Name           = "pageFeedCredentials";
     this.pageFeedCredentials.NextPage       = this.pageSourceName;
     this.pageFeedCredentials.PreviousPage   = this.pageStartImport;
     this.pageFeedCredentials.BeforeDisplay += new System.EventHandler(this.OnPageFeedCredentials_BeforeDisplay);
     //
     // lblFeedCredentialsIntro
     //
     resources.ApplyResources(this.lblFeedCredentialsIntro, "lblFeedCredentialsIntro");
     this.lblFeedCredentialsIntro.FlatStyle = System.Windows.Forms.FlatStyle.System;
     this.lblFeedCredentialsIntro.Name      = "lblFeedCredentialsIntro";
     //
     // lblUsername
     //
     resources.ApplyResources(this.lblUsername, "lblUsername");
     this.lblUsername.FlatStyle = System.Windows.Forms.FlatStyle.System;
     this.lblUsername.Name      = "lblUsername";
     //
     // textUser
     //
     resources.ApplyResources(this.textUser, "textUser");
     this.textUser.Name         = "textUser";
     this.textUser.TextChanged += new System.EventHandler(this.textUser_TextChanged);
     //
     // lblPassword
     //
     resources.ApplyResources(this.lblPassword, "lblPassword");
     this.lblPassword.FlatStyle = System.Windows.Forms.FlatStyle.System;
     this.lblPassword.Name      = "lblPassword";
     //
     // textPassword
     //
     resources.ApplyResources(this.textPassword, "textPassword");
     this.textPassword.Name         = "textPassword";
     this.textPassword.TextChanged += new System.EventHandler(this.textPassword_TextChanged);
     //
     // pageSourceName
     //
     this.pageSourceName.Controls.Add(this.textFeedSourceName);
     this.pageSourceName.Controls.Add(this.label2);
     resources.ApplyResources(this.pageSourceName, "pageSourceName");
     this.pageSourceName.Name           = "pageSourceName";
     this.pageSourceName.PreviousPage   = this.pageFeedCredentials;
     this.pageSourceName.BeforeDisplay += new System.EventHandler(this.OnPageSourceName_BeforeDisplay);
     //
     // textFeedSourceName
     //
     resources.ApplyResources(this.textFeedSourceName, "textFeedSourceName");
     this.textFeedSourceName.Name         = "textFeedSourceName";
     this.textFeedSourceName.TextChanged += new System.EventHandler(this.textFeedSourceName_TextChanged);
     this.textFeedSourceName.Validating  += new System.ComponentModel.CancelEventHandler(this.OnControlValidating);
     this.textFeedSourceName.Validated   += new System.EventHandler(this.OnControlValidated);
     //
     // label2
     //
     this.label2.FlatStyle = System.Windows.Forms.FlatStyle.System;
     resources.ApplyResources(this.label2, "label2");
     this.label2.Name = "label2";
     //
     // pageStartImport
     //
     this.pageStartImport.Controls.Add(this.fbrssLinkHelp);
     this.pageStartImport.Controls.Add(this.label1);
     this.pageStartImport.Controls.Add(this.radioFeedlyCloud);
     this.pageStartImport.Controls.Add(this.radioCommonFeedlist);
     resources.ApplyResources(this.pageStartImport, "pageStartImport");
     this.pageStartImport.Name            = "pageStartImport";
     this.pageStartImport.NextPage        = this.pageFeedCredentials;
     this.pageStartImport.BeforeMoveNext += new Divelements.WizardFramework.WizardPageEventHandler(this.OnPageStartImportBeforeMoveNext);
     //
     // fbrssLinkHelp
     //
     resources.ApplyResources(this.fbrssLinkHelp, "fbrssLinkHelp");
     this.fbrssLinkHelp.Name    = "fbrssLinkHelp";
     this.fbrssLinkHelp.TabStop = true;
     this.fbrssLinkHelp.UseCompatibleTextRendering = true;
     this.fbrssLinkHelp.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.OnFbRssLinkClicked);
     //
     // label1
     //
     resources.ApplyResources(this.label1, "label1");
     this.label1.FlatStyle = System.Windows.Forms.FlatStyle.System;
     this.label1.Name      = "label1";
     //
     // radioFeedlyCloud
     //
     resources.ApplyResources(this.radioFeedlyCloud, "radioFeedlyCloud");
     this.radioFeedlyCloud.Name = "radioFeedlyCloud";
     this.radioFeedlyCloud.UseVisualStyleBackColor = true;
     this.radioFeedlyCloud.CheckedChanged         += new System.EventHandler(this.radioFeedlyCloud_CheckedChanged);
     //
     // radioCommonFeedlist
     //
     resources.ApplyResources(this.radioCommonFeedlist, "radioCommonFeedlist");
     this.radioCommonFeedlist.Name = "radioCommonFeedlist";
     this.radioCommonFeedlist.UseVisualStyleBackColor = true;
     this.radioCommonFeedlist.CheckedChanged         += new System.EventHandler(this.radioCommonFeedlist_CheckedChanged);
     //
     // _btnImmediateFinish
     //
     resources.ApplyResources(this._btnImmediateFinish, "_btnImmediateFinish");
     this._btnImmediateFinish.Name   = "_btnImmediateFinish";
     this._btnImmediateFinish.Click += new System.EventHandler(this.OnImmediateFinish_Click);
     //
     // wizard
     //
     this.wizard.BannerImage = ((System.Drawing.Image)(resources.GetObject("wizard.BannerImage")));
     this.wizard.Controls.Add(this.pageStartImport);
     this.wizard.Controls.Add(this.pageSourceName);
     this.wizard.Controls.Add(this.pageFeedCredentials);
     this.wizard.Controls.Add(this._btnImmediateFinish);
     resources.ApplyResources(this.wizard, "wizard");
     this.wizard.MarginImage  = ((System.Drawing.Image)(resources.GetObject("wizard.MarginImage")));
     this.wizard.Name         = "wizard";
     this.wizard.SelectedPage = this.pageStartImport;
     this.wizard.Cancel      += new System.EventHandler(this.OnWizardCancel);
     this.wizard.Finish      += new System.EventHandler(this.OnWizardFinish);
     //
     // errorProvider1
     //
     this.errorProvider1.ContainerControl = this;
     //
     // SynchronizeFeedsWizard
     //
     resources.ApplyResources(this, "$this");
     this.Controls.Add(this.wizard);
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
     this.MaximizeBox     = false;
     this.MinimizeBox     = false;
     this.Name            = "SynchronizeFeedsWizard";
     this.pageFeedCredentials.ResumeLayout(false);
     this.pageFeedCredentials.PerformLayout();
     this.pageSourceName.ResumeLayout(false);
     this.pageSourceName.PerformLayout();
     this.pageStartImport.ResumeLayout(false);
     this.pageStartImport.PerformLayout();
     this.wizard.ResumeLayout(false);
     ((System.ComponentModel.ISupportInitialize)(this.errorProvider1)).EndInit();
     this.ResumeLayout(false);
 }
Exemple #42
0
        /// <summary>
        /// initializes the wiazrd pages based on "systemMustContain" attribute value list for the selected objectclass
        /// Adds the wizard pages to the wizard dialog
        /// </summary>
        /// <param name="nodeText"></param>
        /// <param name="mandatoryAttributes"></param>
        private void AddWizardPages(string nodeText, String[] mandatoryAttributes)
        {
            treeView1.HideSelection    = false;
            _objectAddDlg.choosenClass = nodeText;
            _objectAddDlg.objectInfo.htMandatoryAttrList = new Hashtable();

            List <string> attrlist = new List <string>();

            _objectAddDlg.ClassAttributeList = new List <LdapAttributeType>();

            attrlist.Add("instanceType");
            attrlist.Add("objectCategory");
            attrlist.Add("objectClass");
            if (_objectAddDlg.choosenClass.Trim().Equals("user", StringComparison.InvariantCultureIgnoreCase) ||
                _objectAddDlg.choosenClass.Trim().Equals("group", StringComparison.InvariantCultureIgnoreCase) ||
                _objectAddDlg.choosenClass.Trim().Equals("computer", StringComparison.InvariantCultureIgnoreCase))
            {
                attrlist.Add("objectSid");
                attrlist.Add("sAMAccountName");
                if (!attrlist.Contains("cn"))
                {
                    attrlist.Add("cn");
                }
                if (mandatoryAttributes != null)
                {
                    foreach (string attr in mandatoryAttributes)
                    {
                        if (!attrlist.Contains(attr))
                        {
                            attrlist.Add(attr);
                        }
                    }
                }
            }

            LdapClassType classtype = _objectAddDlg.schemaCache.GetSchemaTypeByObjectClass(_objectAddDlg.choosenClass) as LdapClassType;

            AttributeMap attr_map  = classtype.Tag as AttributeMap;
            LdapEntry    ldapentry = attr_map.Tag as LdapEntry;

            string DN = ldapentry.GetDN();

            string[] attrs = { "name", "allowedAttributes", null };

            List <LdapEntry> innerLdapEntries = null;
            int ret = dirnode.LdapContext.ListChildEntriesSynchronous
                          (dirnode.DistinguishedName,
                          LdapAPI.LDAPSCOPE.BASE,
                          "(objectClass=*)",
                          attrs,
                          false,
                          out innerLdapEntries);

            ldapentry = innerLdapEntries[0];

            LdapValue[] ldapValues = ldapentry.GetAttributeValues("allowedAttributes", dirnode.LdapContext);
            if (ldapValues != null && ldapValues.Length > 0)
            {
                string[] optionalAttrs = new string[ldapValues.Length];
                foreach (LdapValue Oclass in ldapValues)
                {
                    string     attrValue  = Oclass.stringData;
                    SchemaType schematype = _objectAddDlg.schemaCache.GetSchemaTypeByDisplayName(attrValue) as SchemaType;
                    if (schematype != null)
                    {
                        schematype.AttributeType = "Optional";
                        _objectAddDlg.ClassAttributeList.Add(schematype as LdapAttributeType);
                    }
                }

                foreach (string strValue in attrlist)
                {
                    SchemaType schematype = _objectAddDlg.schemaCache.GetSchemaTypeByDisplayName(strValue) as SchemaType;
                    if (schematype != null)
                    {
                        schematype.AttributeType = "Mandatory";
                        _objectAddDlg.ClassAttributeList.Add(schematype as LdapAttributeType);
                    }
                }
            }

            if (_objectAddDlg.ClassAttributeList != null && _objectAddDlg.ClassAttributeList.Count != 0)
            {
                foreach (LdapAttributeType Attribute in _objectAddDlg.ClassAttributeList)
                {
                    AttributeInfo attributeInfo = new AttributeInfo();
                    attributeInfo.sAttributename  = Attribute.AttributeDisplayName;
                    attributeInfo.sAttributeValue = "<not set>";
                    attributeInfo.sAttributeType  = Attribute.AttributeType;
                    attributeInfo.schemaInfo      =
                        _objectAddDlg.schemaCache.GetSchemaTypeByCommonName(Attribute.CName);
                    if (!_objectAddDlg.objectInfo._AttributesList.ContainsKey(Attribute.AttributeDisplayName))
                    {
                        _objectAddDlg.objectInfo._AttributesList.Add(Attribute.AttributeDisplayName, attributeInfo);
                    }
                }
            }
            ObjectAddSinglePage ObjectAddSinglePage = null;

            _objectAddDlg.objectInfo.addedPages = new List <string>();
            ObjectInfo.PageIndex = 0;
            //for all objects we should prompt to ask for their cn
            if (nodeText.Equals("organizationalUnit", StringComparison.InvariantCultureIgnoreCase))
            {
                ObjectAddSinglePage = new ObjectAddSinglePage(_objectAddDlg, "ou");
                _objectAddDlg.AddPage(ObjectAddSinglePage);
                _objectAddDlg.objectInfo.addedPages.Add("ou");
            }
            else
            {
                ObjectAddSinglePage = new ObjectAddSinglePage(_objectAddDlg, "cn");
                _objectAddDlg.AddPage(ObjectAddSinglePage);
                _objectAddDlg.objectInfo.addedPages.Add("cn");
            }

            if (mandatoryAttributes != null && mandatoryAttributes.Length != 0)
            {
                for (int i = 0; i < mandatoryAttributes.Length; i++)
                {
                    if (!((mandatoryAttributes[i].Trim().ToLower().Equals("cn")) || (mandatoryAttributes[i].Trim().ToLower().Equals("ou"))))
                    {
                        ObjectAddSinglePage = new ObjectAddSinglePage(_objectAddDlg, mandatoryAttributes[i].Trim());
                        _objectAddDlg.AddPage(ObjectAddSinglePage);
                        _objectAddDlg.objectInfo.addedPages.Add(mandatoryAttributes[i].Trim());
                    }
                }
            }

            if (_objectAddDlg.choosenClass.Equals("computer", StringComparison.InvariantCultureIgnoreCase)
                ||
                _objectAddDlg.choosenClass.Equals("user", StringComparison.InvariantCultureIgnoreCase)
                ||
                _objectAddDlg.choosenClass.Equals("group", StringComparison.InvariantCultureIgnoreCase))
            {
                ObjectAddSinglePage = new ObjectAddSinglePage(_objectAddDlg, "sAMAccountName");
                _objectAddDlg.AddPage(ObjectAddSinglePage);
                _objectAddDlg.objectInfo.addedPages.Add("sAMAccountName");
            }

            //for all objects they all come to the end of final page
            _objectAddDlg.AddPage(new ObjectAddFinalPage(_objectAddDlg, _container, _parentPage));

            Wizard.enableButton(WizardDialog.WizardButton.Start);
        }
Exemple #43
0
        private void ManagementSession_StateReported(object sender, StateReportedEventArgs e)
        {
            var    state = SessionStatusType.Error;
            string msg   = null;

            switch (e.State)
            {
            case OpenVPNStateType.Connecting:
                state = SessionStatusType.Connecting;
                msg   = Resources.Strings.OpenVPNStateTypeConnecting;
                break;

            case OpenVPNStateType.Resolving:
                state = SessionStatusType.Connecting;
                msg   = Resources.Strings.OpenVPNStateTypeResolving;
                break;

            case OpenVPNStateType.TcpConnecting:
                state = SessionStatusType.Connecting;
                msg   = Resources.Strings.OpenVPNStateTypeTcpConnecting;
                break;

            case OpenVPNStateType.Waiting:
                state = SessionStatusType.Connecting;
                msg   = Resources.Strings.OpenVPNStateTypeWaiting;
                break;

            case OpenVPNStateType.Authenticating:
                state = SessionStatusType.Connecting;
                msg   = Resources.Strings.OpenVPNStateTypeAuthenticating;
                break;

            case OpenVPNStateType.GettingConfiguration:
                state = SessionStatusType.Connecting;
                msg   = Resources.Strings.OpenVPNStateTypeGettingConfiguration;
                break;

            case OpenVPNStateType.AssigningIP:
                state = SessionStatusType.Connecting;
                msg   = Resources.Strings.OpenVPNStateTypeAssigningIP;
                break;

            case OpenVPNStateType.AddingRoutes:
                state = SessionStatusType.Connecting;
                msg   = Resources.Strings.OpenVPNStateTypeAddingRoutes;
                break;

            case OpenVPNStateType.Connected:
                state = SessionStatusType.Connected;
                msg   = Resources.Strings.OpenVPNStateTypeConnected;
                break;

            case OpenVPNStateType.Reconnecting:
                state = SessionStatusType.Connecting;
                msg   = Resources.Strings.OpenVPNStateTypeReconnecting;
                break;

            case OpenVPNStateType.Exiting:
                state = SessionStatusType.Disconnecting;
                msg   = Resources.Strings.OpenVPNStateTypeExiting;
                break;
            }
            if (!string.IsNullOrEmpty(e.Message))
            {
                if (msg != null)
                {
                    msg += "\r\n" + e.Message;
                }
                else
                {
                    msg = e.Message;
                }
            }
            else if (msg == null)
            {
                msg = "";
            }
            Wizard.TryInvoke((Action)(() =>
            {
                StateDescription = msg;
                TunnelAddress = e.Tunnel;
                IPv6TunnelAddress = e.IPv6Tunnel;
                ConnectedAt = e.State == OpenVPNStateType.Connected ? (DateTimeOffset?)e.TimeStamp : null;

                // Set State property last, as the whole world is listening on this property to monitor connectivity changes.
                // It is important that we have IP addresses and other info already set before rising PropertyChanged event for State.
                State = state;
            }));

            if (e.State == OpenVPNStateType.Reconnecting)
            {
                switch (e.Message)
                {
                case "connection-reset":     // Connection was reset.
                    if (ValidTo <= DateTimeOffset.Now)
                    {
                        // Client certificate expired. Try with a new client certificate then.
                        goto case "tls-error";
                    }
                    goto default;

                case "auth-failure":  // Client certificate was deleted/revoked on the server side, or the user is disabled.
                case "tls-error":     // Client certificate is not compliant with this eduVPN server. Was eduVPN server reinstalled?
                                      // Refresh configuration.
                    var config = ConnectingProfile.Connect(
                        Wizard.GetAuthenticatingServer(ConnectingProfile.Server),
                        true,
                        ProfileConfig.ContentType,
                        Window.Abort.Token);
                    Wizard.TryInvoke((Action)(() => ProfileConfig = config));
                    IgnoreHoldHint = true;
                    break;

                default:
                    IgnoreHoldHint = false;
                    break;
                }

                ManagementSession.QueueReleaseHold(Window.Abort.Token);
            }
        }
 internal FirstLaunchWelcomePage(Wizard wizard)
     : base(wizard)
 {
     this.Description             = Shell.LoadString(StringId.IDS_FIRSTRUN_GREETING);
     this.EnableVerticalScrolling = true;
 }
Exemple #45
0
        public override void OnNavigatedTo(bool forward)
        {
            base.OnNavigatedTo(forward);

            SourceAccount = string.Join(", ", Wizard.GetProperty <string[]>(AddColumnDialogViewModel.SourceAccountNamesKey));
        }
        /// <summary>
        /// Overriden function which displays the label text in finish page based on selected values
        /// </summary>
        /// <returns></returns>
        public override bool OnSetActive()
        {
            Wizard.enableButton(WizardDialog.WizardButton.Cancel);
            Wizard.enableButton(WizardDialog.WizardButton.Back);
            Wizard.showButton(WizardDialog.WizardButton.Finish);
            Wizard.showButton(WizardDialog.WizardButton.Finish);
            Wizard.hideButton(WizardDialog.WizardButton.Next);
            Wizard.hideButton(WizardDialog.WizardButton.Start);
            Wizard.enableButton(WizardDialog.WizardButton.Finish);

            this.SummeryrichTextBox.Text = "";

            if (!this._userAddDlg.userInfo.copyfrom.Equals(string.Empty))
            {
                this.SummeryrichTextBox.Text =
                    SummeryrichTextBox.Text +
                    this._userAddDlg.userInfo.copyfrom +
                    "\n\n";
            }

            this.SummeryrichTextBox.Text = SummeryrichTextBox.Text + "Full name: " +
                                           this._userAddDlg.userInfo.fullName + "\n" + "\n" +
                                           "User logon name:" + this._userAddDlg.userInfo.logonName;

            if (this._userAddDlg.userInfo.bMustChangePwd)
            {
                this.SummeryrichTextBox.Text =
                    SummeryrichTextBox.Text +
                    "\n\nThe user must change the password at next logon";
            }

            if (this._userAddDlg.userInfo.bCannotChangePwd)
            {
                this.SummeryrichTextBox.Text =
                    SummeryrichTextBox.Text +
                    "\n\nThe user cannot change the password";
            }

            if (this._userAddDlg.userInfo.bNeverExpiresPwd && this._userAddDlg.userInfo.bCannotChangePwd)
            {
                this.SummeryrichTextBox.Text =
                    SummeryrichTextBox.Text +
                    "\nThe password never expires";
            }

            if (this._userAddDlg.userInfo.bNeverExpiresPwd && !this._userAddDlg.userInfo.bCannotChangePwd)
            {
                this.SummeryrichTextBox.Text =
                    SummeryrichTextBox.Text +
                    "\n\nThe password never expires";
            }

            if (this._userAddDlg.userInfo.bAcountDisable)
            {
                if (this._userAddDlg.userInfo.bNeverExpiresPwd ||
                    this._userAddDlg.userInfo.bCannotChangePwd ||
                    this._userAddDlg.userInfo.bMustChangePwd)
                {
                    this.SummeryrichTextBox.Text =
                        SummeryrichTextBox.Text +
                        "\nThe account is disabled";
                }
                else
                {
                    this.SummeryrichTextBox.Text =
                        SummeryrichTextBox.Text +
                        "\n\nThe account is disabled";
                }
            }

            if (this.SummeryrichTextBox.Text.StartsWith("\n"))
            {
                this.SummeryrichTextBox.Text = this.SummeryrichTextBox.Text.Substring(1);
            }

            return(true);
        }
Exemple #47
0
        public static void Encounter(Ninja ninja, Samurai samurai, Wizard wizard)
        {
            Console.Clear();
            Console.WriteLine("You're attacked by 2 zombies and a giant spider!");
            Zombie zombie1 = new Zombie();
            Zombie zombie2 = new Zombie();
            Spider spider  = new Spider();

            Console.WriteLine("\n***********************************************************************\n");
            Console.WriteLine($"You have the first move...who would you like to use?\n1. {ninja.name} (ninja)\n2. {samurai.name} (samurai)\n3. {wizard.name} (wizard)");
            ConsoleKeyInfo chart   = Console.ReadKey();
            int            charStr = int.Parse(chart.KeyChar.ToString());

            switch (charStr)
            {
            case 1:
                Console.Clear();
                Console.WriteLine($"Sweet, you chose your ninja {ninja.name}!");
                Console.WriteLine("\n***********************************************************************\n");
                Console.WriteLine("What move would you like to use?\n1. Steal\n2. Get Away");
                ConsoleKeyInfo input1 = Console.ReadKey();
                int            inp1   = int.Parse(input1.KeyChar.ToString());
                switch (inp1)
                {
                case 1:
                    ninja.Steal(zombie1);
                    ninja.Steal(zombie2);
                    ninja.Steal(spider);
                    Console.Clear();
                    Console.WriteLine($"Nice!!  Zombie1's health is {zombie1.health}, zombie2's health is {zombie2.health}, and the spider's health is {spider.health}!");
                    Console.WriteLine("\nPress the <enter> key to continue...");
                    Console.ReadKey();
                    break;

                case 2:
                    ninja.GetAway();
                    Console.Clear();
                    Console.WriteLine($"Since you decided to make your ninja run away, his health is now {ninja.health}.");
                    Console.WriteLine("\nPress the <enter> key to continue...");
                    Console.ReadKey();
                    break;
                }
                break;

            case 2:
                Console.Clear();
                Console.WriteLine($"Awesome, you chose your samurai {samurai.name}!");
                Console.WriteLine("\n***********************************************************************\n");
                Console.WriteLine("What move would you like to use?\n1. Death Blow\n2. Meditate");
                ConsoleKeyInfo input2 = Console.ReadKey();
                int            inp2   = int.Parse(input2.KeyChar.ToString());
                switch (inp2)
                {
                case 1:
                    samurai.DeathBlow(zombie1);
                    samurai.DeathBlow(zombie2);
                    samurai.DeathBlow(spider);
                    Console.Clear();
                    Console.WriteLine($"Nice!!  Zombie1's health is {zombie1.health}, zombie2's health is {zombie2.health}, and the spider's health is {spider.health}!");
                    Console.WriteLine("\nPress the <enter> key to continue...");
                    Console.ReadKey();
                    break;

                case 2:
                    samurai.Meditate();
                    Console.Clear();
                    Console.WriteLine($"Your samurai healed himself and his health is now {samurai.health}.");
                    Console.WriteLine("\nPress the <enter> key to continue...");
                    Console.ReadKey();
                    break;
                }
                break;

            case 3:
                Console.Clear();
                Console.WriteLine($"Dude, your wizard {wizard.name} is ready to go!");
                Console.WriteLine("\n***********************************************************************\n");
                Console.WriteLine("What move would you like to use?\n1. Fireball\n2. Heal Yourself");
                ConsoleKeyInfo input3 = Console.ReadKey();
                int            inp3   = int.Parse(input3.KeyChar.ToString());
                switch (inp3)
                {
                case 1:
                    wizard.Fireball(zombie1);
                    wizard.Fireball(zombie2);
                    wizard.Fireball(spider);
                    Console.Clear();
                    Console.WriteLine($"Nice!!  Zombie1's health is {zombie1.health}, zombie2's health is {zombie2.health}, and the spider's health is {spider.health}!");
                    Console.WriteLine("\nPress the <enter> key to continue...");
                    Console.ReadKey();
                    break;

                case 2:
                    wizard.Heal();
                    Console.Clear();
                    Console.WriteLine($"Your wizard healed himself and his health is now {wizard.health}.");
                    Console.WriteLine("\nPress the <enter> key to continue...");
                    Console.ReadKey();
                    break;
                }
                break;
            }
        }
Exemple #48
0
    public float accuracy       = -0.5f; // -1 if will only kick when PRECISELY LINED UP;  1 Will kick whennever in range

    public ASBasicKick(Wizard w, AIStrategyController c, Ability a, int buttonid) : base(w, c, a, buttonid)
    {
    }
Exemple #49
0
    }         // the working of the game

    private void Update()
    {
        if (timeCount != 60)
        {
            timeCount++;
        }
        else
        {
            if (pause)
            {
                int count = 0;

                for (int i = 0; i < 2; i++)
                {
                    if (GameMap.WizardList[i] != null)
                    {
                        Wizard w = GameMap.WizardList[i];
                        CombatEngine(w);
                    }
                }

                foreach (MeleeUnit u in GameMap.MeleeList)
                {
                    if (u != null)
                    {
                        if (u.Alive)
                        {
                            count++;
                        }
                    }
                }

                if (count == 0)
                {
                    meleeAlive = false;
                }

                if (meleeAlive)
                {
                    foreach (MeleeUnit u in GameMap.MeleeList)
                    {
                        if (u != null)
                        {
                            if (u.Alive)
                            {
                                if (count > 0)
                                {
                                    CombatEngine(u);
                                }
                            }
                        }
                    }
                }

                count = 0;

                foreach (RangedUnit u in GameMap.RangedList)
                {
                    if (u != null)
                    {
                        if (u.Alive)
                        {
                            count++;
                        }
                    }
                }

                if (count == 0)
                {
                    rangedAlive = false;
                }

                if (rangedAlive)
                {
                    foreach (RangedUnit u in GameMap.RangedList)
                    {
                        if (u != null)
                        {
                            if (u.Alive)
                            {
                                if (count > 0)
                                {
                                    CombatEngine(u);
                                }
                            }
                        }
                    }
                }
                else
                {
                    //  MessageBox.Show("Ranged units dead");
                }

                int unitcount = 0;
                for (int i = 0; i < 15; i++)
                {
                    if (GameMap.MeleeList[i] != null)
                    {
                        unitcount++;
                    }
                }

                RecourceBuilding b1 = (RecourceBuilding)GameMap.buildingList[0];

                if (b1.Remaining > 0)
                {
                    b1.generate(b1.AmountTick);
                    GameMap.availableBlue = GameMap.availableBlue + b1.AmountTick;
                }


                b1 = (RecourceBuilding)GameMap.buildingList[1];

                if (b1.Remaining > 0)
                {
                    b1.generate(b1.AmountTick);
                    GameMap.availableYellow = GameMap.availableYellow + b1.AmountTick;
                }



                if (unitcount < 14)
                {
                    RecourceBuilding b = (RecourceBuilding)GameMap.buildingList[0];
                    if (b.Remaining > 0)
                    {
                        GameMap.availableBlue = GameMap.availableBlue - 5;
                        Factory factory = (Factory)GameMap.buildingList[2];
                        GameMap.MeleeList[unitcount] = (MeleeUnit)factory.SpawnUnit();
                    }


                    b = (RecourceBuilding)GameMap.buildingList[1];
                    if (b.Remaining > 0)
                    {
                        GameMap.availableYellow = GameMap.availableYellow - 5;
                        Factory factory = (Factory)GameMap.buildingList[3];
                        GameMap.MeleeList[unitcount + 1] = (MeleeUnit)factory.SpawnUnit();
                    }
                }

                timeCount = 0;
                GameCount++;
                updatebuttons();
            }
        }
    }
        public override void Cast(Wizard source, Wizard target)
        {
            int spellsBefore = RockPaperSpell.SpellsBefore(this);

            target.Position -= 1 + 2 * spellsBefore;
        }
Exemple #51
0
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void MenuItemCallback(object sender, EventArgs e)
        {
            var monitorSelection = Package.GetGlobalService(typeof(SVsShellMonitorSelection)) as IVsMonitorSelection;
            var solution         = Package.GetGlobalService(typeof(SVsSolution)) as IVsSolution;

            if (monitorSelection == null || solution == null)
            {
                return;
            }

            IVsMultiItemSelect multiItemSelect       = null;
            IntPtr             hierarchyPtr          = IntPtr.Zero;
            IntPtr             selectionContainerPtr = IntPtr.Zero;
            uint itemid;
            int  hr = VSConstants.S_OK;

            try
            {
                hr = monitorSelection.GetCurrentSelection(out hierarchyPtr, out itemid, out multiItemSelect, out selectionContainerPtr);
                if (ErrorHandler.Failed(hr) || hierarchyPtr == IntPtr.Zero || itemid == VSConstants.VSITEMID_NIL)
                {
                    // there is no selection
                    return;
                }
                IVsHierarchy hierarchy = Marshal.GetObjectForIUnknown(hierarchyPtr) as IVsHierarchy;
                if (hierarchy == null)
                {
                    return;
                }

                string doc;
                ((IVsProject)hierarchy).GetMkDocument(itemid, out doc);

                object pvar;
                hierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_ExtObject, out pvar);
                var project   = (EnvDTE.Project)pvar;
                var vcproject = (VCProject)project.Object;


                string ofRoot = "..\\..\\..";
                foreach (VCConfiguration config in vcproject.Configurations)
                {
                    ofRoot = config.GetEvaluatedPropertyValue("OF_ROOT");
                    if (ofRoot != "")
                    {
                        break;
                    }
                }

                var ofDi = new DirectoryInfo(ofRoot);
                if (new DirectoryInfo(Path.Combine(vcproject.ProjectDirectory, "..\\..\\..")).Equals(ofDi))
                {
                    ofRoot = "..\\..\\..";
                }
                else
                {
                    ofRoot = Path.GetFullPath(ofRoot);
                }

                var inputForm = new FormAddons(Path.GetDirectoryName(doc), ofRoot);
                var result    = inputForm.ShowDialog();
                if (result == DialogResult.Cancel)
                {
                    return;
                }

                var addons        = inputForm.getAddons();
                var currentAddons = inputForm.getProjectCurrentAddons();

                var addonsToRemove  = currentAddons.Except(addons);
                var remainingAddons = currentAddons.Except(addonsToRemove);
                var newAddons       = addons.Except(remainingAddons);

                Wizard.removeAddons(vcproject, ofRoot, addonsToRemove);
                Wizard.addAddons(vcproject, ofRoot, newAddons);
                Wizard.saveAddonsMake(vcproject, addons);

                DTE2        application = project.DTE.Application as DTE2;
                UIHierarchy solExplorer = application.ToolWindows.SolutionExplorer;
                Wizard.CollapseAllFolders(solExplorer, project.Name);
            }
            finally
            {
                if (selectionContainerPtr != IntPtr.Zero)
                {
                    Marshal.Release(selectionContainerPtr);
                }

                if (hierarchyPtr != IntPtr.Zero)
                {
                    Marshal.Release(hierarchyPtr);
                }
            }
        }
 public void Init()
 {
     Wizard = new Wizard();
 }
Exemple #53
0
    }     // displays positions of units and buildings

    public void CombatEngine(Unit u)
    {
        if (u.attackRange == 2)
        {
            MeleeUnit u2 = (MeleeUnit)u;
            if ((u2.ReturnPosition(GameMap.MeleeList, GameMap.RangedList)) != null)
            {
                int distance = u2.FindUnit(u2.ReturnPosition(GameMap.MeleeList, GameMap.RangedList));
                // info.Text = info.Text + "\n" + distance.ToString();
                if (distance <= u2.attackRange)
                {
                    u2.Combat(u2.ReturnPosition(GameMap.MeleeList, GameMap.RangedList));
                } //combat
                else
                {
                    if (u2.Health > 2)
                    {
                        if (u2.ReturnPosition(GameMap.MeleeList, GameMap.RangedList).attackRange < 3)
                        {
                            MeleeUnit Position = (MeleeUnit)u2.ReturnPosition(GameMap.MeleeList, GameMap.RangedList);
                            if (Position.X > u2.X)
                            {
                                u.MoveUnit(1, 0);
                            }
                            else if (Position.X < u2.X)
                            {
                                u.MoveUnit(-1, 0);
                            }
                            if (Position.Y > u2.Y)
                            {
                                u.MoveUnit(0, 1);
                            }
                            else if (Position.Y < u2.Y)
                            {
                                u.MoveUnit(0, -1);
                            }
                        }
                        else
                        {
                            RangedUnit Position = (RangedUnit)u2.ReturnPosition(GameMap.MeleeList, GameMap.RangedList);
                            if (Position.X > u2.X)
                            {
                                u.MoveUnit(1, 0);
                            }
                            else if (Position.X < u2.X)
                            {
                                u.MoveUnit(-1, 0);
                            }
                            if (Position.Y > u2.Y)
                            {
                                u.MoveUnit(0, 1);
                            }
                            else if (Position.Y < u2.Y)
                            {
                                u.MoveUnit(0, -1);
                            }
                        }
                    }// movement
                    else
                    {
                        if (u2.ReturnPosition(GameMap.MeleeList, GameMap.RangedList).attackRange < 3)
                        {
                            MeleeUnit Position = (MeleeUnit)u2.ReturnPosition(GameMap.MeleeList, GameMap.RangedList);

                            if (Position.X < u2.X)
                            {
                                u.MoveUnit(1, 0);
                            }
                            else if (Position.X > u2.X)
                            {
                                u.MoveUnit(-1, 0);
                            }
                            if (Position.Y < u2.Y)
                            {
                                u.MoveUnit(0, 1);
                            }
                            else if (Position.Y > u2.Y)
                            {
                                u.MoveUnit(0, -1);
                            }
                        }
                        else
                        {
                            RangedUnit Position = (RangedUnit)u2.ReturnPosition(GameMap.MeleeList, GameMap.RangedList);

                            if (Position.X < u2.X)
                            {
                                u.MoveUnit(1, 0);
                            }
                            else if (Position.X > u2.X)
                            {
                                u.MoveUnit(-1, 0);
                            }
                            if (Position.Y < u2.Y)
                            {
                                u.MoveUnit(0, 1);
                            }
                            else if (Position.Y > u2.Y)
                            {
                                u.MoveUnit(0, -1);
                            }
                        }
                    }// running away / needs work
                }

                if (u.Death())
                {
                    for (int i = 0; i < 15; i++)
                    {
                        if (GameMap.MeleeList[i] != null)
                        {
                            if (GameMap.MeleeList[i] == u)
                            {
                                for (int k = i; k < 14; k++)
                                {
                                    GameMap.MeleeList[k] = GameMap.MeleeList[k + 1];
                                }

                                GameMap.MeleeList[14] = null;
                            }
                        }
                    }
                } // handels death in the game
            }     // melee
        }

        else if (u.attackRange == 4)
        {
            RangedUnit u2     = (RangedUnit)u;
            int        counti = 0;
            for (int i = 0; i < 5; i++)
            {
                if (GameMap.MeleeList[i] != null && u.ReturnPosition(GameMap.MeleeList, GameMap.RangedList) != null)
                {
                    if (u.ReturnPosition(GameMap.MeleeList, GameMap.RangedList).team != u.team)
                    {
                        counti++;
                    }
                }
            }
            if (counti > 0) // see number of units in array
            {
                int distance = u2.FindUnit(u2.ReturnPosition(GameMap.MeleeList, GameMap.RangedList));

                if (distance <= u2.attackRange)
                {
                    u2.Combat(u2.ReturnPosition(GameMap.MeleeList, GameMap.RangedList));
                } //combat
                else
                {
                    if (u2.Health > 2)
                    {
                        if (u2.ReturnPosition(GameMap.MeleeList, GameMap.RangedList).attackRange > 3)
                        {
                            RangedUnit Position = (RangedUnit)u2.ReturnPosition(GameMap.MeleeList, GameMap.RangedList);
                            if (Position.X > u2.X)
                            {
                                u.MoveUnit(1, 0);
                            }
                            else if (Position.X < u2.X)
                            {
                                u.MoveUnit(-1, 0);
                            }
                            if (Position.Y > u2.Y)
                            {
                                u.MoveUnit(0, 1);
                            }
                            else if (Position.Y < u2.Y)
                            {
                                u.MoveUnit(0, -1);
                            }
                        }
                        else
                        {
                            MeleeUnit Position = (MeleeUnit)u2.ReturnPosition(GameMap.MeleeList, GameMap.RangedList);
                            if (Position.X > u2.X)
                            {
                                u.MoveUnit(1, 0);
                            }
                            else if (Position.X < u2.X)
                            {
                                u.MoveUnit(-1, 0);
                            }
                            if (Position.Y > u2.Y)
                            {
                                u.MoveUnit(0, 1);
                            }
                            else if (Position.Y < u2.Y)
                            {
                                u.MoveUnit(0, -1);
                            }
                        }
                    }// movement
                    else
                    {
                        if (u2.ReturnPosition(GameMap.MeleeList, GameMap.RangedList).attackRange > 3)
                        {
                            RangedUnit Position = (RangedUnit)u2.ReturnPosition(GameMap.MeleeList, GameMap.RangedList);
                            if (Position.X < u2.X)
                            {
                                u.MoveUnit(1, 0);
                            }
                            else if (Position.X > u2.X)
                            {
                                u.MoveUnit(-1, 0);
                            }


                            if (Position.Y < u2.Y)
                            {
                                u.MoveUnit(0, 1);
                            }
                            else if (Position.Y > u2.Y)
                            {
                                u.MoveUnit(0, -1);
                            }
                        }
                        else
                        {
                            MeleeUnit Position = (MeleeUnit)u2.ReturnPosition(GameMap.MeleeList, GameMap.RangedList);
                            if (u2.X + u2.Speed >= 0 && u2.X + u2.Speed <= 19)
                            {
                                if (Position.X < u2.X)
                                {
                                    u.MoveUnit(1, 0);
                                }
                                else if (Position.X > u2.X)
                                {
                                    u.MoveUnit(-1, 0);
                                }
                            }

                            if (u2.Y + u2.Speed >= 0 && u2.Y + u2.Speed <= 19)
                            {
                                if (Position.Y < u2.Y)
                                {
                                    u.MoveUnit(0, 1);
                                }
                                else if (Position.Y > u2.Y)
                                {
                                    u.MoveUnit(0, -1);
                                }
                            }
                        }
                    }// running away / needs work
                }
            }

            if (u.Death())
            {
                for (int i = 0; i < 15; i++)
                {
                    if (GameMap.RangedList[i] != null)
                    {
                        if (GameMap.RangedList[i] == u)
                        {
                            for (int k = i; k < 14; k++)
                            {
                                GameMap.RangedList[k] = GameMap.RangedList[k + 1];
                            }

                            GameMap.RangedList[14] = null;
                        }
                    }
                }
            } // handels death in the game
        }

        else
        {
            Wizard u2     = (Wizard)u;
            int    counti = 0;
            for (int i = 0; i < 5; i++)
            {
                if (GameMap.MeleeList[i] != null && u.ReturnPosition(GameMap.MeleeList, GameMap.RangedList) != null)
                {
                    if (u.ReturnPosition(GameMap.MeleeList, GameMap.RangedList).team != u.team)
                    {
                        counti++;
                    }
                }
            }
            if (counti > 0) // see number of units in array
            {
                int distance = u2.FindUnit(u2.ReturnPosition(GameMap.MeleeList, GameMap.RangedList));

                if (distance <= u2.attackRange)
                {
                    u2.Combat(u2.ReturnPosition(GameMap.MeleeList, GameMap.RangedList));
                } //combat
                else
                {
                    if (u2.Health > 2)
                    {
                        if (u2.ReturnPosition(GameMap.MeleeList, GameMap.RangedList).attackRange > 3)
                        {
                            RangedUnit Position = (RangedUnit)u2.ReturnPosition(GameMap.MeleeList, GameMap.RangedList);
                            if (Position.X > u2.X)
                            {
                                u.MoveUnit(1, 0);
                            }
                            else if (Position.X < u2.X)
                            {
                                u.MoveUnit(-1, 0);
                            }
                            if (Position.Y > u2.Y)
                            {
                                u.MoveUnit(0, 1);
                            }
                            else if (Position.Y < u2.Y)
                            {
                                u.MoveUnit(0, -1);
                            }
                        }
                        else
                        {
                            MeleeUnit Position = (MeleeUnit)u2.ReturnPosition(GameMap.MeleeList, GameMap.RangedList);
                            if (Position.X > u2.X)
                            {
                                u.MoveUnit(1, 0);
                            }
                            else if (Position.X < u2.X)
                            {
                                u.MoveUnit(-1, 0);
                            }
                            if (Position.Y > u2.Y)
                            {
                                u.MoveUnit(0, 1);
                            }
                            else if (Position.Y < u2.Y)
                            {
                                u.MoveUnit(0, -1);
                            }
                        }
                    }// movement
                    else
                    {
                        if (u2.ReturnPosition(GameMap.MeleeList, GameMap.RangedList).attackRange > 3)
                        {
                            RangedUnit Position = (RangedUnit)u2.ReturnPosition(GameMap.MeleeList, GameMap.RangedList);
                            if (Position.X < u2.X)
                            {
                                u.MoveUnit(1, 0);
                            }
                            else if (Position.X > u2.X)
                            {
                                u.MoveUnit(-1, 0);
                            }


                            if (Position.Y < u2.Y)
                            {
                                u.MoveUnit(0, 1);
                            }
                            else if (Position.Y > u2.Y)
                            {
                                u.MoveUnit(0, -1);
                            }
                        }
                        else
                        {
                            MeleeUnit Position = (MeleeUnit)u2.ReturnPosition(GameMap.MeleeList, GameMap.RangedList);
                            if (u2.X + u2.Speed >= 0 && u2.X + u2.Speed <= 19)
                            {
                                if (Position.X < u2.X)
                                {
                                    u.MoveUnit(1, 0);
                                }
                                else if (Position.X > u2.X)
                                {
                                    u.MoveUnit(-1, 0);
                                }
                            }

                            if (u2.Y + u2.Speed >= 0 && u2.Y + u2.Speed <= 19)
                            {
                                if (Position.Y < u2.Y)
                                {
                                    u.MoveUnit(0, 1);
                                }
                                else if (Position.Y > u2.Y)
                                {
                                    u.MoveUnit(0, -1);
                                }
                            }
                        }
                    }// running away / needs work
                }
            }

            if (u.Death())
            {
                for (int i = 0; i < 15; i++)
                {
                    if (GameMap.RangedList[i] != null)
                    {
                        if (GameMap.RangedList[i] == u)
                        {
                            for (int k = i; k < 14; k++)
                            {
                                GameMap.RangedList[k] = GameMap.RangedList[k + 1];
                            }

                            GameMap.RangedList[14] = null;
                        }
                    }
                }
            } // handels death in the game
        }
    }         // the working of the game
Exemple #54
0
        /// <summary>
        /// Handles the MouseDoubleClick event of the lstModels control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
        private void lstModels_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            Control item = lstModels.GetChildAtPoint(new Point(e.X, e.Y));

            Wizard.DoDefault();
        }
        static void Main(string[] args)
        {
            Shield shield = new Shield("Golden Shield", 75, "Escudo Protector");
            Sword  sword  = new Sword("Katana", 125, "Corte Fugaz");

            Orc orc = new Orc("Grom", 25, "Tanque");

            orc.Equip(sword);
            orc.Equip(shield);


            Axe       axe       = new Axe("Verdugo", 70, "Juicio final");
            Warhammer warhammer = new Warhammer("Mjölnir", 90, "Aplastar y machacar");

            Dwarf dwarf = new Dwarf("Thorin", 35, "Luchador");

            dwarf.Equip(axe);
            dwarf.Equip(warhammer);

            Bow   bow   = new Bow("Arco gigante", 75, "Tira fuego");
            Cloak cloak = new Cloak("Capa maxima", 85, "Invisibilidad");

            Elf elf = new Elf("Galardiel", 15, "Escurridizo");

            elf.Equip(bow);
            elf.Equip(cloak);

            SpellBook  spellBook  = new SpellBook("Libro de Hechizos Oscuros", "Hechizos oscuros");
            Spell      spell      = new Spell("Lumos", "La varita enciende luz", 65, 0);
            MagicStaff magicStaff = new MagicStaff("Baculo Oscuro", 150, "Baculo perdido de Toran");

            Wizard wizard = new Wizard("Harry", "Mago De Apoyo", spellBook);

            dwarf.Attack(orc);
            Console.WriteLine("👳 " + dwarf.Name + " cura a 🤢 " + orc.Name);
            dwarf.HealCharacter(orc);
            Console.WriteLine();

            orc.Attack(wizard);
            wizard.Respawn();
            Console.WriteLine(wizard.Name + " ha respawneado");
            Console.WriteLine("La vida actual de 🧙 " + wizard.Name + " ahora es: " + wizard.Health + " ❤");
            Console.WriteLine();

            elf.UnEquip(bow);
            elf.Equip(sword);
            Console.WriteLine("El daño total que causa 🧝‍♀️ " + elf.Name + " es: " + elf.TotalDamage() + " 🗡");
            Console.WriteLine("La protección total de 🧝‍♀️ " + elf.Name + " es: " + elf.TotalProtection() + " 🛡");
            Console.WriteLine();

            orc.UnEquip(sword);
            orc.Equip(axe);
            Console.WriteLine("El daño total que causa 🤢 " + orc.Name + " es: " + orc.TotalDamage() + " 🗡");
            Console.WriteLine("La protección total de 🤢 " + orc.Name + " es: " + orc.TotalProtection() + " 🛡");
            Console.WriteLine();

            dwarf.UnEquip(axe);
            dwarf.Equip(shield);
            Console.WriteLine("El daño total que causa 👳 " + dwarf.Name + " es: " + dwarf.TotalDamage() + " 🗡");
            Console.WriteLine("La protección total de 👳 " + dwarf.Name + " es: " + dwarf.TotalProtection() + " 🛡");
            Console.WriteLine();

            wizard.Equip(magicStaff);
            wizard.Equip(spellBook);
            wizard.LearnSpell(spell);
            Console.WriteLine();

            Console.WriteLine("El daño total que causa 🧙 " + wizard.Name + " es: " + wizard.TotalDamage() + " 🗡");
            Console.WriteLine("La protección total de 🧙 " + wizard.Name + " es: " + wizard.TotalProtection() + " 🛡");
            Console.WriteLine();

            wizard.UnEquip(magicStaff);
            Console.WriteLine();
            wizard.Equip(sword);
            wizard.Equip(shield);
            Console.WriteLine("Se añadieron los items: " + sword.Name + " y " + shield.Name + " al inventario de " + wizard.Name);
            Console.WriteLine("El daño total que causa 🧙 " + wizard.Name + " ahora es: " + wizard.TotalDamage() + " 🗡");
            Console.WriteLine("La protección total de 🧙 " + wizard.Name + " ahora es: " + wizard.TotalProtection() + " 🛡");
        }
 internal FirstConnectDeviceCustomPrivacyPage(Wizard wizard)
     : base(wizard)
     => this.Description = Shell.LoadString(StringId.IDS_SELECT_YOUR_PRIVACY_OPTIONS_HEADER);
Exemple #57
0
        public override void Cast(Wizard source, Wizard target)
        {
            int poorer = RockPaperSpell.PoorerWizardCount(target);

            target.Position -= 2 * poorer;
        }
Exemple #58
0
 internal FirstConnectDeviceNamePage(Wizard wizard)
     : base(wizard)
     => this.Description = Shell.LoadString(StringId.IDS_NAME_ZUNE_HEADER);
Exemple #59
0
        public ActionResult Wizard()
        {
            var viewModel = new Wizard();

            return(View(viewModel));
        }
Exemple #60
0
 /// <summary>
 /// Enables the next button.
 /// </summary>
 protected virtual void EnableNextButton()
 {
     Wizard.EnableButton(ButtonType.Next, (lstModels.SelectedItems.Count > 0) && !Wizard.IsLastPage);
 }