public BroadcastTextEditor(gossip_menu_option o, bool boxText = false) { InitializeComponent(); Util.AssignDefine(language, LegacyToolBox.Data.Language); Util.AssignDefine(emote0, LegacyToolBox.Data.Emotes); Util.AssignDefine(emote1, LegacyToolBox.Data.Emotes); Util.AssignDefine(emote2, LegacyToolBox.Data.Emotes); if (boxText) { _Text = WorldWorker.GetBroadCastText(o.BoxBroadcastTextID); } else { _Text = WorldWorker.GetBroadCastText(o.OptionBroadcastTextID); } if (_Text == null || _Text.ID == 0) { _Text = WorldWorker.CreateNewBroadCastText(); if (boxText) { o.BoxBroadcastTextID = _Text.ID; } else { o.OptionBroadcastTextID = _Text.ID; } } bctGrid.DataContext = _Text; }
private void menuItemNpcFlagBtn_Click(object sender, RoutedEventArgs e) { gossip_menu_option o = gossipMenuItems.SelectedItem as gossip_menu_option; if (o == null) { return; } new NpcFlagSelector(o).Show(); }
private void menuItemBoxTextBtn_Click(object sender, RoutedEventArgs e) { gossip_menu_option o = gossipMenuItems.SelectedItem as gossip_menu_option; if (o == null) { return; } new BroadcastTextEditor(o, true).Show(); }
private void gossipMenuItems_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (gossipMenuItems == null || gossipMenuItems.SelectedItem == null) { return; } _SelectedMenuItem = gossipMenuItems.SelectedItem as gossip_menu_option; gossipItemGrid.DataContext = _SelectedMenuItem; }
private void menuItemDelete_Click(object sender, RoutedEventArgs e) { if (_SelectedMenuItem == null) { return; } WorldWorker.DeleteGossipOption(_SelectedMenuItem); LoadGossipMenuItems(_SelectedMenuItem.menu_id); _SelectedMenuItem = null; }
public BroadcastTextEditor(gossip_menu_option o, bool boxText = false) { InitializeComponent(); Util.AssignDefine(language, LegacyToolBox.Data.Language); Util.AssignDefine(emote0, LegacyToolBox.Data.Emotes); Util.AssignDefine(emote1, LegacyToolBox.Data.Emotes); Util.AssignDefine(emote2, LegacyToolBox.Data.Emotes); if (boxText) _Text = WorldWorker.GetBroadCastText(o.BoxBroadcastTextID); else _Text = WorldWorker.GetBroadCastText(o.OptionBroadcastTextID); if (_Text == null || _Text.ID == 0) { _Text = WorldWorker.CreateNewBroadCastText(); if (boxText) o.BoxBroadcastTextID = _Text.ID; else o.OptionBroadcastTextID = _Text.ID; } bctGrid.DataContext = _Text; }
public NpcFlagSelector(gossip_menu_option o) { InitializeComponent(); _o = o; CheckFlags(_o.npc_option_npcflag); }
public void LoadGossipMenuItems(int menu) { _SelectedMenuItem = null; _SelectedGossipItems = WorldWorker.GetGossipOptions(menu); gossipMenuItems.ItemsSource = _SelectedGossipItems; }
public static void DeleteGossipOption(gossip_menu_option p) { var o = (from d in DB.LEGACY.gossip_menu_option where d.menu_id == p.menu_id && d.id == p.id select d).SingleOrDefault(); if (o != null) { DB.LEGACY.gossip_menu_option.Remove(o); DB.LSave(); } }
public static gossip_menu_option CreateNewGossipItem(int menu) { int id = 0; var g = from d in DB.LEGACY.gossip_menu_option where d.menu_id == menu select d.id; if (g.Count() != 0) id = g.Max() + 1; broadcast_text t = CreateNewBroadCastText(); gossip_menu_option o = new gossip_menu_option(); o.menu_id = menu; o.id = id; o.npc_option_npcflag = 0; o.option_icon = 0; o.option_id = 0; o.OptionBroadcastTextID = t.ID; o.SingleTimeCheck = 0; o.action_menu_id = 0; o.action_poi_id = 0; o.box_coded = 0; o.box_money = 0; o.BoxBroadcastTextID = 0; SaveGossipOption(o); return o; }
private void menuItemDelete_Click(object sender, RoutedEventArgs e) { if (_SelectedMenuItem == null) return; WorldWorker.DeleteGossipOption(_SelectedMenuItem); LoadGossipMenuItems(_SelectedMenuItem.menu_id); _SelectedMenuItem = null; }
private void gossipMenuItems_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (gossipMenuItems == null || gossipMenuItems.SelectedItem == null) return; _SelectedMenuItem = gossipMenuItems.SelectedItem as gossip_menu_option; gossipItemGrid.DataContext = _SelectedMenuItem; }
public static void SaveGossipOption(gossip_menu_option p) { var o = (from d in DB.LEGACY.gossip_menu_option where d.menu_id == p.menu_id && d.id == p.id select d).SingleOrDefault(); if (o != null) DB.LEGACY.gossip_menu_option.Remove(o); DB.LEGACY.gossip_menu_option.Add(p); DB.LEGACY.SaveChanges(); DB.Refresh(); }