private void AddNPC_Click(object sender, EventArgs e)
        {
            if (class_templates_exist())
            {
                NPC npc = new NPC();
                npc.Name = "New NPC";

                foreach (CreatureTemplate ct in Session.Templates)
                {
                    if (ct.Type == CreatureTemplateType.Class)
                    {
                        npc.TemplateID = ct.ID;
                        break;
                    }
                }

                CreatureBuilderForm dlg = new CreatureBuilderForm(npc);
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    Session.Project.NPCs.Add(dlg.Creature as NPC);
                    Session.Modified = true;

                    update_creatures();
                }
            }
            else
            {
                // Show message
                string msg = "NPCs require class templates; you have no class templates defined.";
                msg += Environment.NewLine;
                msg += "You can define templates in the Libraries screen.";
                MessageBox.Show(msg, "Masterplan", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        private void EditBtn_Click(object sender, EventArgs e)
        {
            if (SelectedCreature != null)
            {
                int index = Session.Project.CustomCreatures.IndexOf(SelectedCreature);

                CreatureBuilderForm dlg = new CreatureBuilderForm(SelectedCreature);
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    Session.Project.CustomCreatures[index] = dlg.Creature as CustomCreature;
                    Session.Modified = true;

                    update_creatures();
                }
            }

            if (SelectedNPC != null)
            {
                int index = Session.Project.NPCs.IndexOf(SelectedNPC);

                CreatureBuilderForm dlg = new CreatureBuilderForm(SelectedNPC);
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    Session.Project.NPCs[index] = dlg.Creature as NPC;
                    Session.Modified            = true;

                    update_creatures();
                }
            }
        }
Beispiel #3
0
 private void AddNPC_Click(object sender, EventArgs e)
 {
     if (!this.class_templates_exist())
     {
         string str = string.Concat("NPCs require class templates; you have no class templates defined.", Environment.NewLine);
         str = string.Concat(str, "You can define templates in the Libraries screen.");
         MessageBox.Show(str, "Masterplan", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
     }
     else
     {
         NPC nPC = new NPC()
         {
             Name = "New NPC"
         };
         foreach (CreatureTemplate template in Session.Templates)
         {
             if (template.Type != CreatureTemplateType.Class)
             {
                 continue;
             }
             nPC.TemplateID = template.ID;
             break;
         }
         CreatureBuilderForm creatureBuilderForm = new CreatureBuilderForm(nPC);
         if (creatureBuilderForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             Session.Project.NPCs.Add(creatureBuilderForm.Creature as NPC);
             Session.Modified = true;
             this.update_creatures();
             return;
         }
     }
 }
Beispiel #4
0
 private void EditBtn_Click(object sender, EventArgs e)
 {
     if (this.SelectedCreature != null)
     {
         int creature = Session.Project.CustomCreatures.IndexOf(this.SelectedCreature);
         CreatureBuilderForm creatureBuilderForm = new CreatureBuilderForm(this.SelectedCreature);
         if (creatureBuilderForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             Session.Project.CustomCreatures[creature] = creatureBuilderForm.Creature as CustomCreature;
             Session.Modified = true;
             this.update_creatures();
         }
     }
     if (this.SelectedNPC != null)
     {
         int num = Session.Project.NPCs.IndexOf(this.SelectedNPC);
         CreatureBuilderForm creatureBuilderForm1 = new CreatureBuilderForm(this.SelectedNPC);
         if (creatureBuilderForm1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             Session.Project.NPCs[num] = creatureBuilderForm1.Creature as NPC;
             Session.Modified          = true;
             this.update_creatures();
         }
     }
 }
Beispiel #5
0
        private void AddCreature_Click(object sender, EventArgs e)
        {
            CreatureBuilderForm creatureBuilderForm = new CreatureBuilderForm(new CustomCreature()
            {
                Name = "New Creature"
            });

            if (creatureBuilderForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Session.Project.CustomCreatures.Add(creatureBuilderForm.Creature as CustomCreature);
                Session.Modified = true;
                this.update_creatures();
            }
        }
        private void AddCreature_Click(object sender, EventArgs e)
        {
            CustomCreature cc = new CustomCreature();

            cc.Name = "New Creature";

            CreatureBuilderForm dlg = new CreatureBuilderForm(cc);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                Session.Project.CustomCreatures.Add(dlg.Creature as CustomCreature);
                Session.Modified = true;

                update_creatures();
            }
        }