public void Setup(Context ctx, IHasResource r) { Context = ctx; PC = r as PC; Globals.Populate(PortraitBox, Context.Djn.Portraits); AttitudeBox.Value = PC.Attitude; BackRowBox.Checked = PC.Flags.HasFlag(PCFlags.BackRow); JobBox.SelectedIndex = (int)PC.Job; NameBox.Text = ctx.GetString(PC.NameId); PartyBox.Checked = PC.Flags.HasFlag(PCFlags.InParty); PortraitBox.SelectedItem = Globals.Resolve(ctx, PC.PortraitId); PronounsBox.SelectedIndex = (int)PC.Pronouns; XPBox.Value = PC.Experience; for (int i = 0; i < Globals.NumJobs; i++) { jobLevels[i].Value = PC.JobLevels[i]; } for (int i = 0; i < Globals.InventorySize; i++) { items[i].Context = ctx; items[i].Item = PC.Items[i]; } SkillsList.Values = PC.Skills; StatsBoxes.Stats = PC.Stats; StatsBoxes.UpdateFields(); }
public void Setup(Context ctx, IHasResource r) { Context = ctx; Item = r as Item; NameBox.Text = ctx.GetString(Item.NameId); Globals.Populate(ImageBox, Context.Djn.Things); ImageBox.SelectedItem = Globals.Resolve(Context, Item.ImageId); TypeBox.SelectedIndex = (int)Item.Type; ValueBox.Value = Item.Value; SpecialBox.SelectedIndex = (int)Item.Special; SArg1Box.Value = Item.SpecialArg1; SArg2Box.Value = Item.SpecialArg2; StatsBoxes.Stats = Item.Stats; StatsBoxes.UpdateFields(); LightFlag.Checked = Item.Flags.HasFlag(ItemFlags.Light); HeavyFlag.Checked = Item.Flags.HasFlag(ItemFlags.Heavy); StackedFlag.Checked = Item.Flags.HasFlag(ItemFlags.Stacked); MediumFlag.Checked = Item.Flags.HasFlag(ItemFlags.MediumRange); LongFlag.Checked = Item.Flags.HasFlag(ItemFlags.LongRange); DexterityFlag.Checked = Item.Flags.HasFlag(ItemFlags.DexterityWeapon); }
public void Apply() { Monster.NameId = Context.GetStringId(NameBox.Text, Monster.NameId); Monster.ImageId = (ImageBox.SelectedItem as Resource).ID; Monster.Row = (Row)RowBox.SelectedIndex; Monster.AiId = (AIBox.SelectedItem as Resource).ID; Monster.Experience = (uint)XPBox.Value; Monster.DropsId = (DropsBox.SelectedItem as Resource).ID; StatsBoxes.Apply(); Monster.Skills = SkillsList.Values.ToList(); Saved?.Invoke(this, null); }
public void Apply() { Item.NameId = Context.GetStringId(NameBox.Text, Item.NameId); Item.ImageId = (ImageBox.SelectedItem as Resource).ID; Item.Type = (ItemType)TypeBox.SelectedIndex; Item.Value = (uint)ValueBox.Value; Item.Special = (ItemSpecial)SpecialBox.SelectedIndex; Item.SpecialArg1 = (short)SArg1Box.Value; Item.SpecialArg2 = (short)SArg2Box.Value; StatsBoxes.Apply(); ItemFlags fl = ItemFlags.None; if (LightFlag.Checked) { fl |= ItemFlags.Light; } if (HeavyFlag.Checked) { fl |= ItemFlags.Heavy; } if (StackedFlag.Checked) { fl |= ItemFlags.Stacked; } if (MediumFlag.Checked) { fl |= ItemFlags.MediumRange; } if (LongFlag.Checked) { fl |= ItemFlags.LongRange; } if (DexterityFlag.Checked) { fl |= ItemFlags.DexterityWeapon; } Item.Flags = fl; Saved?.Invoke(this, null); }
public void Setup(Context ctx, IHasResource r) { Context = ctx; Monster = r as Monster; Globals.Populate(AIBox, Context.Djn.AIProfiles); Globals.Populate(ImageBox, Context.Djn.GrfSubtype(ResourceSubtype.Monster)); Globals.Populate(DropsBox, Context.Djn.Type <DropTable>()); NameBox.Text = Context.GetString(Monster.NameId); ImageBox.SelectedItem = Globals.Resolve(Context, Monster.ImageId); RowBox.SelectedIndex = (int)Monster.Row; AIBox.SelectedIndex = (int)Monster.AiId; XPBox.Value = Monster.Experience; DropsBox.SelectedItem = Globals.Resolve(Context, Monster.DropsId); StatsBoxes.Stats = Monster.Stats; SkillsList.Values = Monster.Skills; StatsBoxes.UpdateFields(); }
private void OKBtn_Click(object sender, EventArgs e) { PCFlags flags = PCFlags.None; if (BackRowBox.Checked) { flags |= PCFlags.BackRow; } if (PartyBox.Checked) { flags |= PCFlags.InParty; } PC.Attitude = (short)AttitudeBox.Value; PC.Experience = (uint)XPBox.Value; PC.Flags = flags; PC.Job = (Job)JobBox.SelectedIndex; PC.NameId = Context.GetStringId(NameBox.Text, PC.NameId); PC.PortraitId = (PortraitBox.SelectedItem as Resource).ID; PC.Pronouns = (Pronouns)PronounsBox.SelectedIndex; StatsBoxes.Apply(); for (int i = 0; i < Globals.NumJobs; i++) { PC.JobLevels[i] = (ushort)jobLevels[i].Value; } for (int i = 0; i < Globals.InventorySize; i++) { items[i].Apply(); } PC.Skills = SkillsList.Values.ToList(); Saved?.Invoke(this, null); Context.UnsavedChanges = true; Close(); }