コード例 #1
0
        private void _miAddDrop_Click(object sender, RoutedEventArgs e)
        {
            if (_tab.List.SelectedItem == null)
            {
                return;
            }

            try {
                Table <int, ReadableTuple <int> > query = _tab.ProjectDatabase.GetMetaTable <int>(ServerDbs.Pet);

                SelectFromDialog select = new SelectFromDialog(query, ServerDbs.Pet, "");
                select.Owner = WpfUtilities.TopWindow;

                if (select.ShowDialog() == true && select.Tuple != null)
                {
                    if (_lv.SelectedItems.Count <= 0 || _tab.List.SelectedItem == null)
                    {
                        return;
                    }

                    TValue item   = (TValue)_tab.List.SelectedItem;
                    var    btable = _tab.Table;

                    _evolution = new Evolution();

                    //if (_lv.Items.OfType<PetEvolutionView>().Any(p => p.ID == select.Id)) {
                    //	ErrorHandler.HandleException("An evolution with this ID already exists.");
                    //	return;
                    //}

                    try {
                        btable.Commands.Begin();

                        var target = new EvolutionTarget();
                        target.Target = select.Id;

                        foreach (var targetEv in _lv.Items.OfType <PetEvolutionView>())
                        {
                            _evolution.Targets.Add(targetEv.EvolutionTarget);
                        }

                        _evolution.Targets.Add(target);
                        btable.Commands.Set(item, ServerPetAttributes.Evolution, _evolution.ToString());
                    }
                    finally {
                        btable.Commands.EndEdit();
                    }

                    _update(item);

                    _lv.SelectedItem = _lv.Items.OfType <PetEvolutionView>().FirstOrDefault(p => p.ID == select.Id) ?? _lv.SelectedItem;
                }
            }
            catch (Exception err) {
                ErrorHandler.HandleException(err);
            }
        }
コード例 #2
0
            public PetEvolutionView(ReadableTuple <int> tuple, EvolutionTarget evolutionTarget, Table <int, ReadableTuple <int> > mobsTable)
            {
                _tuple           = tuple;
                _evolutionTarget = evolutionTarget;
                _mobsTable       = mobsTable;
                //_tuple.TupleModified += _tuple_TupleModified;

                _reload();
            }
コード例 #3
0
        public static void Loader(DbDebugItem <int> debug, AbstractDb <int> db)
        {
            if (debug.FileType == FileType.Yaml)
            {
                var ele   = new YamlParser(debug.FilePath);
                var table = debug.AbsractDb.Table;

                if (ele.Output == null || ((ParserArray)ele.Output).Objects.Count == 0 || (ele.Output["copy_paste"] ?? ele.Output["Body"]) == null)
                {
                    return;
                }

                var mobDb  = SdeEditor.Instance.ProjectDatabase.GetMetaTable <int>(ServerDbs.Mobs);
                var itemDb = SdeEditor.Instance.ProjectDatabase.GetMetaTable <int>(ServerDbs.Items);

                foreach (var pet in ele.Output["copy_paste"] ?? ele.Output["Body"])
                {
                    string mob = pet["Mob"] ?? "";

                    int mobId = (int)DbIOUtils.Name2Id(mobDb, ServerMobAttributes.AegisName, mob, "mob_db", false);

                    table.SetRaw(mobId, ServerPetAttributes.LureId, DbIOUtils.Name2Id(itemDb, ServerItemAttributes.AegisName, pet["TameItem"] ?? "", "item_db", true));
                    table.SetRaw(mobId, ServerPetAttributes.Name, mob);
                    table.SetRaw(mobId, ServerPetAttributes.EggId, DbIOUtils.Name2Id(itemDb, ServerItemAttributes.AegisName, pet["EggItem"] ?? "", "item_db", true));
                    table.SetRaw(mobId, ServerPetAttributes.EquipId, DbIOUtils.Name2Id(itemDb, ServerItemAttributes.AegisName, pet["EquipItem"] ?? "", "item_db", true));
                    table.SetRaw(mobId, ServerPetAttributes.FoodId, DbIOUtils.Name2Id(itemDb, ServerItemAttributes.AegisName, pet["FoodItem"] ?? "", "item_db", true));
                    table.SetRaw(mobId, ServerPetAttributes.Fullness, pet["Fullness"] ?? "");
                    table.SetRaw(mobId, ServerPetAttributes.HungryDelay, pet["HungryDelay"] ?? ServerPetAttributes.HungryDelay.Default.ToString());
                    table.SetRaw(mobId, ServerPetAttributes.HungerIncrease, pet["HungerIncrease"] ?? ServerPetAttributes.HungerIncrease.Default.ToString());

                    table.SetRaw(mobId, ServerPetAttributes.IntimacyStart, pet["IntimacyStart"] ?? ServerPetAttributes.IntimacyStart.Default.ToString());
                    table.SetRaw(mobId, ServerPetAttributes.IntimacyFed, pet["IntimacyFed"] ?? ServerPetAttributes.IntimacyFed.Default.ToString());
                    table.SetRaw(mobId, ServerPetAttributes.IntimacyOverfed, pet["IntimacyOverfed"] ?? ServerPetAttributes.IntimacyOverfed.Default.ToString());
                    table.SetRaw(mobId, ServerPetAttributes.IntimacyHungry, pet["IntimacyHungry"] ?? ServerPetAttributes.IntimacyHungry.Default.ToString());
                    table.SetRaw(mobId, ServerPetAttributes.IntimacyOwnerDie, pet["Intimacy.OwnerDie"] ?? ServerPetAttributes.IntimacyOwnerDie.Default.ToString());
                    table.SetRaw(mobId, ServerPetAttributes.CaptureRate, pet["CaptureRate"] ?? ServerPetAttributes.CaptureRate.Default.ToString());

                    table.SetRaw(mobId, ServerPetAttributes.SpecialPerformance, (pet["SpecialPerformance"] ?? "true") == "true" ? "1" : "0");
                    table.SetRaw(mobId, ServerPetAttributes.AttackRate, pet["AttackRate"] ?? "");
                    table.SetRaw(mobId, ServerPetAttributes.RetaliateRate, pet["RetaliateRate"] ?? "");
                    table.SetRaw(mobId, ServerPetAttributes.ChangeTargetRate, pet["ChangeTargetRate"] ?? "");
                    table.SetRaw(mobId, ServerPetAttributes.AllowAutoFeed, pet["AllowAutoFeed"] ?? "");
                    table.SetRaw(mobId, ServerPetAttributes.LoyalScript, pet["Script"] ?? "");
                    table.SetRaw(mobId, ServerPetAttributes.PetScript, pet["SupportScript"] ?? "");

                    if (pet["Evolution"] != null)
                    {
                        var evolution = pet["Evolution"];

                        Evolution evolutionObj = new Evolution();

                        foreach (var target in evolution)
                        {
                            EvolutionTarget targetObj = new EvolutionTarget();
                            targetObj.Target = target["Target"];

                            foreach (var requirement in target["ItemRequirements"])
                            {
                                targetObj.ItemRequirements.Add(new Utilities.Extension.Tuple <object, int>(requirement["Item"] ?? "501", Int32.Parse(requirement["Amount"])));
                            }

                            evolutionObj.Targets.Add(targetObj);
                        }

                        table.SetRaw(mobId, ServerPetAttributes.Evolution, evolutionObj.ToString());
                    }
                }
            }
            else if (debug.FileType == FileType.Txt)
            {
                //DbIOMethods.DbLoaderComma(debug, db);
                DbIOMethods.DbLoaderAny(debug, db, TextFileHelper.GetElementsByCommas, true, 25);
                //numberOfAttributesToGuess
            }
        }