-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMonsterAttackForm.cs
161 lines (154 loc) · 5.62 KB
/
MonsterAttackForm.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace cdda_item_creator
{
public partial class MonsterAttackForm : Form
{
Dictionary<string, string> hardcoded_attacks;
MonsterAttack mattack;
private void LoadHardcodedAttacks()
{
string flag_path = System.Windows.Forms.Application.StartupPath + "\\json\\hardcoded_mattack.json";
string flag_file_text = File.ReadAllText(flag_path);
JObject jobj = JObject.Parse(flag_file_text);
hardcoded_attacks = jobj.ToObject<Dictionary<string, string>>();
}
private void BuildMonsterAttack()
{
switch(mattackTypeCombobox.Text)
{
default:
mattack = null;
break;
}
}
private void LoadBodyParts()
{
string flag_path = System.Windows.Forms.Application.StartupPath + "\\json\\body_parts.json";
string flag_file_text = File.ReadAllText(flag_path);
string[] array = JArray.Parse(flag_file_text).ToObject<string[]>();
bodyPartComboBox.Items.AddRange(array);
monEffectDataBodyPartComboBox.Items.AddRange(array);
}
public MonsterAttackForm()
{
InitializeComponent();
LoadHardcodedAttacks();
LoadBodyParts();
monEffectDataIdComboBox.Items.AddRange(Program.LoadedObjectDictionary.GetList("effect_type").ToArray());
gunTypeComboBox.Items.AddRange(Program.LoadedObjectDictionary.GetList("GUN").ToArray());
ammoTypeComboBox.Items.AddRange(Program.LoadedObjectDictionary.GetList("AMMO").ToArray());
mattackTypeCombobox.SelectedIndex = 0;
idComboBox.SelectedIndex = 0;
foreach (string spell_id in Program.LoadedObjectDictionary.GetList("SPELL"))
{
spellIdComboBox.Items.Add(spell_id);
}
spellIdComboBox.SelectedIndex = 0;
}
private void mattackTypeCombobox_SelectedIndexChanged(object sender, EventArgs e)
{
idComboBox.Enabled = true;
idComboBox.SelectedIndex = -1;
idComboBox.Items.Clear();
idComboBox.Show();
idComboBox.DropDownStyle = ComboBoxStyle.DropDown;
idLabel.Show();
spellPanel.Hide();
leapPanel.Hide();
meleePanel.Hide();
gunPanel.Hide();
switch(mattackTypeCombobox.Text)
{
case "gun":
{
gunPanel.Show();
break;
}
case "melee":
{
biteNoInfectionChanceLabel.Hide();
biteNoInfectionChanceUpDown.Hide();
meleePanel.Show();
break;
}
case "bite":
{
biteNoInfectionChanceLabel.Show();
biteNoInfectionChanceUpDown.Show();
meleePanel.Show();
break;
}
case "hardcoded":
{
foreach(string key in hardcoded_attacks.Keys)
{
idComboBox.Items.Add(key);
idComboBox.SelectedIndex = 0;
idComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
}
break;
}
case "leap":
{
leapPanel.Show();
break;
}
case "spell":
{
idComboBox.Enabled = false;
idComboBox.Hide();
idLabel.Hide();
spellPanel.Show();
break;
}
default: break;
}
}
private void cancelButton_Click(object sender, EventArgs e)
{
mattack = null;
}
private void saveButton_Click(object sender, EventArgs e)
{
BuildMonsterAttack();
}
private void damageInstanceAddButton_Click(object sender, EventArgs e)
{
damageInstanceDataGrid.Rows.Add(
damageInstanceTypeComboBox.Text,
damageInstanceAmountUpDown.Value,
damageInstanceArmorPenetrationUpDown.Value,
damageInstanceArmorMultiplierUpDown.Value,
damageInstanceDamageMultiplierUpDown.Value
);
}
private void meleeBodyPartAddButton_Click(object sender, EventArgs e)
{
bodyPartsDataGrid.Rows.Add(
bodyPartComboBox.Text,
bodyPartHitRateUpDown.Value
);
}
private void moneEffectDataAddButton_Click(object sender, EventArgs e)
{
meleeMonEffectDataGrid.Rows.Add(
monEffectDataIdComboBox.Text,
monEffectDataDurationUpDown.Value,
monEffectDataAffectHitBpCheckBox.Checked,
monEffectDataBodyPartComboBox.Text,
monEffectDataPermanentCheckbox.Checked,
monEffectDataChanceUpDown.Value
);
}
}
}