Inheritance: System.Windows.Forms.UserControl
Esempio n. 1
0
 private void creatureInfoInputTester_Add2Library_Clicked(CreatureInfoInput sender)
 {
     AddCreatureToCollection(false);
 }
Esempio n. 2
0
        private void creatureInfoInputTester_Save2Library_Clicked(CreatureInfoInput sender)
        {
            if (_creatureTesterEdit == null)
            {
                return;
            }
            // check if wild levels are changed, if yes warn that the creature can become invalid
            bool wildChanged = Math.Abs(_creatureTesterEdit.tamingEff - (double)NumericUpDownTestingTE.Value / 100) > .0005;

            if (!wildChanged)
            {
                int[] wildLevels = GetCurrentWildLevels(false);
                for (int s = 0; s < Values.STATS_COUNT; s++)
                {
                    if (wildLevels[s] != _creatureTesterEdit.levelsWild[s])
                    {
                        wildChanged = true;
                        break;
                    }
                }
            }
            if (wildChanged && MessageBox.Show("The wild levels or the taming-effectiveness were changed. Save values anyway?\n" +
                                               "Only save if the wild levels or taming-effectiveness were extracted wrongly!\nIf you are not sure, don't save. " +
                                               "The breeding-values could become invalid.",
                                               "Wild levels have been changed",
                                               MessageBoxButtons.OKCancel,
                                               MessageBoxIcon.Exclamation) != DialogResult.OK)
            {
                return;
            }

            // Ids: ArkId and Guid
            //if (!IsArkIdUniqueOrOnlyPlaceHolder(creatureTesterEdit)) { return; }

            bool statusChanged = _creatureTesterEdit.Status != creatureInfoInputTester.CreatureStatus ||
                                 _creatureTesterEdit.owner != creatureInfoInputTester.CreatureOwner ||
                                 _creatureTesterEdit.mutationsMaternal != creatureInfoInputTester.MutationCounterMother ||
                                 _creatureTesterEdit.mutationsPaternal != creatureInfoInputTester.MutationCounterFather;
            bool parentsChanged = _creatureTesterEdit.Mother != creatureInfoInputTester.Mother || _creatureTesterEdit.Father != creatureInfoInputTester.Father;

            _creatureTesterEdit.levelsWild      = GetCurrentWildLevels(false);
            _creatureTesterEdit.levelsDom       = GetCurrentDomLevels(false);
            _creatureTesterEdit.tamingEff       = TamingEffectivenessTester;
            _creatureTesterEdit.isBred          = rbBredTester.Checked;
            _creatureTesterEdit.imprintingBonus = (double)numericUpDownImprintingBonusTester.Value / 100;

            creatureInfoInputTester.SetCreatureData(_creatureTesterEdit);

            if (wildChanged)
            {
                CalculateTopStats(_creatureCollection.creatures.Where(c => c.Species == _creatureTesterEdit.Species).ToList());
            }
            UpdateDisplayedCreatureValues(_creatureTesterEdit, statusChanged, true);

            if (parentsChanged)
            {
                _creatureTesterEdit.RecalculateAncestorGenerations();
            }

            _creatureTesterEdit.RecalculateNewMutations();

            // if maturation was changed, update raising-timers
            if (_creatureTesterEdit.growingUntil != creatureInfoInputTester.GrowingUntil)
            {
                raisingControl1.RecreateList();
                _creatureTesterEdit.StartStopMatureTimer(true);
            }

            SetTesterInfoInputCreature();
            _libraryNeedsUpdate        = true;
            tabControlMain.SelectedTab = tabPageLibrary;
        }
Esempio n. 3
0
 private void creatureInfoInput_ParentListRequested(CreatureInfoInput sender)
 {
     updateParentListInput(sender);
 }
Esempio n. 4
0
        private void creatureInfoInputTester_Save2Library_Clicked(CreatureInfoInput sender)
        {
            if (creatureTesterEdit != null)
            {
                bool wildChanged = (Math.Abs(creatureTesterEdit.tamingEff - (double)NumericUpDownTestingTE.Value / 100) > .0005);
                if (!wildChanged)
                {
                    int[] wildLevels = getCurrentWildLevels(false);
                    for (int s = 0; s < 8; s++)
                    {
                        if (wildLevels[s] != creatureTesterEdit.levelsWild[s])
                        {
                            wildChanged = true;
                            break;
                        }
                    }
                }
                if (!wildChanged || MessageBox.Show("The wild levels or the taming-effectiveness were changed. Save values anyway?\nOnly save if the wild levels or taming-effectiveness were extracted wrongly!\nIf you are not sure, don't save. The breeding-values could become invalid.", "Wild levels have been changed", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK)
                {
                    bool statusChanged = creatureTesterEdit.status != creatureInfoInputTester.CreatureStatus;
                    bool parentsChanged = (creatureTesterEdit.Mother != creatureInfoInputTester.mother || creatureTesterEdit.Father != creatureInfoInputTester.father);
                    creatureTesterEdit.levelsWild = getCurrentWildLevels(false);
                    creatureTesterEdit.levelsDom = getCurrentDomLevels(false);
                    creatureTesterEdit.tamingEff = (double)NumericUpDownTestingTE.Value / 100;
                    creatureTesterEdit.isBred = checkBoxStatTestingBred.Checked;
                    creatureTesterEdit.imprintingBonus = (double)numericUpDownImprintingBonusTester.Value / 100;

                    creatureTesterEdit.name = creatureInfoInputTester.CreatureName;
                    creatureTesterEdit.gender = creatureInfoInputTester.CreatureGender;
                    creatureTesterEdit.owner = creatureInfoInputTester.CreatureOwner;
                    creatureTesterEdit.Mother = creatureInfoInputTester.mother;
                    creatureTesterEdit.Father = creatureInfoInputTester.father;
                    creatureTesterEdit.note = creatureInfoInputTester.CreatureNote;
                    creatureTesterEdit.status = creatureInfoInputTester.CreatureStatus;
                    creatureTesterEdit.cooldownUntil = creatureInfoInputTester.Cooldown;
                    creatureTesterEdit.growingUntil = creatureInfoInputTester.Grown;
                    creatureTesterEdit.domesticatedAt = creatureInfoInputTester.domesticatedAt;
                    creatureTesterEdit.neutered = creatureInfoInputTester.Neutered;

                    if (wildChanged)
                        calculateTopStats(creatureCollection.creatures.Where(c => c.species == creatureTesterEdit.species).ToList());
                    updateCreatureValues(creatureTesterEdit, statusChanged);

                    if (parentsChanged)
                        creatureTesterEdit.recalculateAncestorGenerations();

                    setTesterEditCreature();
                    tabControlMain.SelectedTab = tabPageLibrary;
                }
            }
        }
Esempio n. 5
0
 private void creatureInfoInputTester_Add2Library_Clicked(CreatureInfoInput sender)
 {
     add2Lib(false);
 }
Esempio n. 6
0
 private void creatureInfoInput1_Add2Library_Clicked(CreatureInfoInput sender)
 {
     add2Lib(true);
 }
Esempio n. 7
0
 private void updateParentListInput(CreatureInfoInput input)
 {
     // set possible parents
     bool fromExtractor = input == creatureInfoInputExtractor;
     string species = (fromExtractor ? Values.V.speciesNames[sE] : cbbStatTestingSpecies.SelectedItem.ToString());
     Creature creature = new Creature(species, "", "", 0, getCurrentWildLevels(fromExtractor));
     List<Creature>[] parents = findParents(creature);
     input.ParentsSimilarities = findParentSimilarities(parents, creature);
     input.Parents = parents;
     input.parentListValid = true;
 }