Esempio n. 1
0
 private void CreateNewCharacter(object sender, RoutedEventArgs e)
 {
     Models.Character chr = new Models.Character("<< New Character >>");
     chr.Value = "NEW";
     Session.Characters.Add(chr);
     Session.SelectedCharacter = chr;
 }
Esempio n. 2
0
        private void NextRound(object sender, RoutedEventArgs e)
        {
            if (COMBATMAP.FocusedCharacter == null)
            {
                return;
            }
            Models.Character c = COMBATMAP.FocusedCharacter;

            foreach (State cs in c.States.Properties)
            {
                if (cs.Duration.IntegerValue < 0)
                {
                    continue;
                }
                cs.Duration.IntegerValue = cs.Duration.IntegerValue - 1;
                if (cs.Duration.IntegerValue == 0)
                {
                    c.States.Remove(cs);
                }
            }

            Die              = string.Empty;
            DieResult        = string.Empty;
            DieResultVerbose = string.Empty;
        }
Esempio n. 3
0
        private void CloneSelectedCharacter(object sender, RoutedEventArgs e)
        {
            if (Session.SelectedCharacter == null)
            {
                return;
            }

            XmlDocument xdoc = Session.SelectedCharacter.Export();

            CombatTable.Models.Character newChar = CombatTable.Models.Character.ReadCharacterFromElement(xdoc.DocumentElement);
            int count = Session.Characters.Count((f) => f.BaseInfo.Value == newChar.BaseInfo.Value);

            newChar.BaseInfo.Value = newChar.BaseInfo.Value + "_" + (count + 1).ToString();
            newChar.BaseInfo.Name  = newChar.BaseInfo.Name + "_" + (count + 1).ToString();
            Session.Characters.Add(newChar);
        }
Esempio n. 4
0
 private void ImportCharacter(object sender, RoutedEventArgs e)
 {
     try
     {
         XmlDocument xdoc = new XmlDocument();
         xdoc.Load(ImportCharacterFile.Text);
         CombatTable.Models.Character newChar = CombatTable.Models.Character.ReadCharacterFromElement(xdoc.DocumentElement);
         if (!string.IsNullOrEmpty(ImportCharacterNewName.Text))
         {
             newChar.Name = ImportCharacterNewName.Text;
         }
         Session.Characters.Add(newChar);
         MessageBox.Show("Success!");
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error: " + ex.Message);
     }
 }
Esempio n. 5
0
 private void SetCurrentCharacter(object sender, MouseButtonEventArgs e)
 {
     CombatTable.Models.Character chr = COMBATMAP.FocusedCharacter;
     if (chr == null)
     {
         return;
     }
     else if (chr.Session.CurrentPlayer.BooleanValue)
     {
         return;
     }
     else
     {
         foreach (CombatTable.Models.Character m in Session.SelectedMap.Characters)
         {
             m.Session.CurrentPlayer.BooleanValue = false;
         }
         chr.Session.CurrentPlayer.BooleanValue = true;
     }
 }
Esempio n. 6
0
        private void PasteCharacter(object sender, RoutedEventArgs e)
        {
            try
            {
                string text = Clipboard.GetText();
                if (string.IsNullOrEmpty(text))
                {
                    return;
                }

                XmlDocument xdoc = new XmlDocument();
                xdoc.LoadXml(text);
                CombatTable.Models.Character newChar = CombatTable.Models.Character.ReadCharacterFromElement(xdoc.DocumentElement);

                int count = Session.Characters.Count((f) => f.BaseInfo.Value == newChar.BaseInfo.Value);
                newChar.BaseInfo.Value = newChar.BaseInfo.Value + "_" + (count + 1).ToString();
                newChar.BaseInfo.Name  = newChar.BaseInfo.Name + "_" + (count + 1).ToString();

                Session.Characters.Add(newChar);
                Session.SelectedCharacter = newChar;
            }
            catch { }
        }