コード例 #1
0
 public SpawnGroupEditTabViewModel(MySqlConnection connection,QueryConfig config)
 {
     if (connection != null && connection.State == System.Data.ConnectionState.Open)
     {
         _manager = new SpawnGroupAggregatorDatabase(connection, config);
         _npcFinder = new NpcAggregatorDatabase(connection, config);
     }
     else
     {
         _manager = new SpawnGroupAggregatorLocal(config);
         _npcFinder = new NpcAggregatorLocal(config);
     }
     _manager.DataLoaded += new SpawnGroupDataLoadedHandler(_manager_DataLoaded);
     InitCommands();
 }
コード例 #2
0
        public NpcTypeEditViewModel(MySqlConnection connection, EQEmu.Database.QueryConfig config, NpcPropertyTemplateManager templates)
        {
            _connection = connection;
            _config = config;
            _templates = templates;

            _modelMappings = Npc.LoadModelMappings("modelmapping.xml");

            if (connection != null && connection.State == System.Data.ConnectionState.Open)
            {
                _npcs = new NpcAggregatorDatabase(connection, config);
            }
            else
            {
                _npcs = new NpcAggregatorLocal(config);
            }
            _npcs.Created();

            _npcs.NPCs.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(NPCs_CollectionChanged);
            Models.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Models_CollectionChanged);
        }
コード例 #3
0
        public SpawnExtractorTabViewModel(MySqlConnection connection,EQEmu.Database.QueryConfig config,NpcPropertyTemplateManager templates)
        {
            _connection = connection;
            _config = config;
            _templates = templates;
            _startId = 0;
            Zone = "";
            ZoneVersion = 0;

            if (connection != null && connection.State == System.Data.ConnectionState.Open)
            {
                _npcs = new NpcAggregatorDatabase(connection, config);
            }
            else
            {
                _npcs = new NpcAggregatorLocal(config);
            }
            _npcs.Created();

            if (connection != null && connection.State == System.Data.ConnectionState.Open)
            {
                _spawngroups = new SpawnGroupAggregatorDatabase(connection, config);
            }
            else
            {
                _spawngroups = new SpawnGroupAggregatorLocal(config);
            }
            _spawngroups.Created();
        }
コード例 #4
0
        public LootEditTabViewModel(MySqlConnection connection,QueryConfig config)
        {
            if (connection != null && connection.State == System.Data.ConnectionState.Open)
            {
                _manager = new LootTableAggregatorDatabase(connection, config);
                _npcmanager = new NpcAggregatorDatabase(connection, config);
            }
            else
            {
                _manager = new LootTableAggregatorLocal(config);
                _npcmanager = new NpcAggregatorLocal(config);
            }
            _npcmanager.Created();
            _manager.Created();

            _addExistingLootDropCommand = new DelegateCommand(
                x =>
                {
                    var lootdrop = _manager.CreateLootDrop();
                    lootdrop.SetNoInsert();
                    lootdrop.Id = -1;
                    lootdrop.Lookup(Int32.Parse(x.ToString()));
                    lootdrop.Created();
                    if (lootdrop.Id >= 0)
                    {
                        lootdrop.LootTableId = SelectedLootTable.Id;
                        SelectedLootTable.AddLootDrop(lootdrop);
                    }
                },
                x =>
                {
                    return SelectedLootTable != null;
                });

            ClearCacheCommand = new DelegateCommand(
                x =>
                {
                    _manager.ClearCache();
                    _npcmanager.ClearCache();
                },
                x =>
                {
                    return true;
                });

            CreateLootTableCommand = new DelegateCommand(
                x =>
                {
                    var table = _manager.CreateLootTable();
                    if (table != null)
                    {
                        _manager.AddLootTable(table);
                    }
                },
                x =>
                {
                    return true;
                });

            CreateLootDropCommand = new DelegateCommand(
                x =>
                {
                    var drop = _manager.CreateLootDrop();
                    drop.CreateForInsert();
                    drop.Created();
                    if (drop != null)
                    {
                        SelectedLootTable.AddLootDrop(drop);
                    }

                },
                x =>
                {
                    return SelectedLootTable != null;
                });

            RemoveSelectedEntryCommand = new DelegateCommand(
                x =>
                {
                    SelectedLootDrop.RemoveLootDropEntry(SelectedDropEntry);
                },
                x =>
                {
                    return SelectedDropEntry != null && SelectedLootDrop != null;
                });
        }