public override string GetDisplayName(bool isAddingNew)
        {
            string displayName = "Nearby Monsters";

            if (!isAddingNew)
            {
                displayName += " [";
                displayName += ("Types=");
                if (CountWhiteMonsters)
                {
                    displayName += ("White,");
                }
                if (CountRareMonsters)
                {
                    displayName += ("Rare,");
                }
                if (CountMagicMonsters)
                {
                    displayName += ("Magic,");
                }
                if (CountUniqueMonsters)
                {
                    displayName += ("Unique");
                }

                displayName += ("MaxDistance=" + MaxDistance.ToString());
                if (ColdResistanceThreshold > 0 || FireResistanceThreshold > 0 || LightningResistanceThreshold > 0 || ChaosResistanceThreshold > 0)
                {
                    displayName += ("Resist restrictions");
                }
                displayName += "]";
            }

            return(displayName);
        }
Beispiel #2
0
            public Dictionary <string, object> GetCustomFilterList()
            {
                filterList = GetFilterList();
                if (AddressLat != null)
                {
                    filterList.Add("@AddressLat", AddressLat.ToString());
                }
                if (AddressLong != null)
                {
                    filterList.Add("@AddressLong", AddressLong.ToString());
                }
                if (MinDistance != null)
                {
                    filterList.Add("@MinDistance", MinDistance.ToString());
                }
                if (MaxDistance != null)
                {
                    filterList.Add("@MaxDistance", MaxDistance.ToString());
                }
                if (OpenHouse != null)
                {
                    filterList.Add("@OpenHouse", OpenHouse.ToString());
                }
                if (!String.IsNullOrWhiteSpace(SearchText))
                {
                    filterList.Add("@SearchText", SearchText);
                }

                if (!String.IsNullOrWhiteSpace(FilterPropertyType))
                {
                    filterList.Add("@FilterPropertyType", FilterPropertyType);
                }
                if (FilterListPriceMin.HasValue)
                {
                    filterList.Add("@FilterListPriceMin", FilterListPriceMin);
                }
                if (FilterListPriceMax.HasValue)
                {
                    filterList.Add("@FilterListPriceMax", FilterListPriceMax);
                }
                if (FilterBeginDate.HasValue)
                {
                    filterList.Add("@FilterBeginDate", FilterBeginDate);
                }
                if (FilterEndDate.HasValue)
                {
                    filterList.Add("@FilterEndDate", FilterEndDate);
                }
                if (NewHomesOnly.HasValue)
                {
                    filterList.Add("@NewHomesOnly", NewHomesOnly);
                }
                if (ShowLotsLand.HasValue)
                {
                    filterList.Add("@ShowLotsLand", ShowLotsLand);
                }
                return(filterList);
            }
        public override bool CreateConfigurationMenu(ExtensionParameter extensionParameter, ref Dictionary <String, Object> Parameters)
        {
            ImGui.TextDisabled("Condition Info");
            ImGuiExtension.ToolTipWithText("(?)", "This condition will return true if any of the selected player's resistances\nare reduced by more than or equal to the specified amount.\nReduced max resistance modifiers are taken into effect automatically (e.g. -res map mods).");


            base.CreateConfigurationMenu(extensionParameter, ref Parameters);

            MinimumMonsterCount = ImGuiExtension.IntSlider("Minimum Monster Count", MinimumMonsterCount, 1, 50);
            Parameters[MinimumMonsterCountString] = MinimumMonsterCount.ToString();

            MaxDistance = ImGuiExtension.FloatSlider("Maximum Distance", MaxDistance, 1.0f, 5000.0f);
            Parameters[MaxDistanceString] = MaxDistance.ToString();

            PreviewDistance = ImGuiExtension.Checkbox("Preview distance", PreviewDistance);

            if (PreviewDistance)
            {
                //extensionParameter.Plugin.PlayerHelper.DrawSquareToWorld(extensionParameter.Plugin.GameController.Player.Pos, MaxDistance);
            }

            ImGui.Spacing();
            ImGui.Separator();
            ImGui.Spacing();

            ColdResistanceThreshold = ImGuiExtension.IntSlider("Cold Resist Above", ColdResistanceThreshold, 0, 75);
            Parameters[ColdResistanceThresholdString] = ColdResistanceThreshold.ToString();

            FireResistanceThreshold = ImGuiExtension.IntSlider("Fire Resist Above", FireResistanceThreshold, 0, 75);
            Parameters[FireResistanceThresholdString] = FireResistanceThreshold.ToString();

            LightningResistanceThreshold = ImGuiExtension.IntSlider("Lightning Resist Above", LightningResistanceThreshold, 0, 75);
            Parameters[LightningResistanceThresholdString] = LightningResistanceThreshold.ToString();

            ChaosResistanceThreshold = ImGuiExtension.IntSlider("Chaos Resist Above", ChaosResistanceThreshold, 0, 75);
            Parameters[ChaosResistanceThresholdString] = ChaosResistanceThreshold.ToString();

            ImGui.Spacing();
            ImGui.Separator();
            ImGui.Spacing();

            CountWhiteMonsters = ImGuiExtension.Checkbox("White Monsters", CountWhiteMonsters);
            Parameters[CountWhiteMonstersString] = CountWhiteMonsters.ToString();

            CountRareMonsters = ImGuiExtension.Checkbox("Rare Monsters", CountRareMonsters);
            Parameters[CountRareMonstersString] = CountRareMonsters.ToString();

            CountMagicMonsters = ImGuiExtension.Checkbox("Magic Monsters", CountMagicMonsters);
            Parameters[CountMagicMonstersString] = CountMagicMonsters.ToString();

            CountUniqueMonsters = ImGuiExtension.Checkbox("Unique Monsters", CountUniqueMonsters);
            Parameters[CountUniqueMonstersString] = CountUniqueMonsters.ToString();

            ImGui.Spacing();
            ImGui.Separator();
            ImGui.Spacing();

            MonsterHealthPercentThreshold = ImGuiExtension.IntSlider("Monster Health Percent", MonsterHealthPercentThreshold, 0, 100);
            Parameters[MonsterHealthPercentThresholdString] = MonsterHealthPercentThreshold.ToString();

            MonsterAboveHealthThreshold = ImGuiExtension.Checkbox("Above Health Threshold", MonsterAboveHealthThreshold);
            Parameters[MonsterAboveHealthThresholdString] = MonsterAboveHealthThreshold.ToString();

            return(true);
        }
Beispiel #4
0
        /// <summary>
        /// Creates a JSON string that represents the motor's serialized state. We
        /// do this since Unity can't handle putting lists of derived objects into
        /// prefabs.
        /// </summary>
        /// <returns>JSON string representing the object</returns>
        public virtual string SerializeMotor()
        {
            if (_Type.Length == 0)
            {
                _Type = this.GetType().AssemblyQualifiedName;
            }

            StringBuilder lStringBuilder = new StringBuilder();

            lStringBuilder.Append("{");

            // These four properties are important from the base MotionControllerMotion
            lStringBuilder.Append(", \"Type\" : \"" + _Type + "\"");
            lStringBuilder.Append(", \"Name\" : \"" + _Name + "\"");
            lStringBuilder.Append(", \"IsEnabled\" : \"" + _IsEnabled.ToString() + "\"");
            lStringBuilder.Append(", \"ActionAlias\" : \"" + _ActionAlias.ToString() + "\"");
            lStringBuilder.Append(", \"UseRigAnchor\" : \"" + _UseRigAnchor.ToString() + "\"");
            lStringBuilder.Append(", \"AnchorIndex\" : \"" + _AnchorIndex.ToString() + "\"");
            lStringBuilder.Append(", \"AnchorOffset\" : \"" + _AnchorOffset.Serialize() + "\"");
            lStringBuilder.Append(", \"Offset\" : \"" + _Offset.Serialize() + "\"");
            lStringBuilder.Append(", \"Distance\" : \"" + Distance.ToString("f5", CultureInfo.InvariantCulture) + "\"");
            lStringBuilder.Append(", \"MaxDistance\" : \"" + MaxDistance.ToString("f5", CultureInfo.InvariantCulture) + "\"");
            lStringBuilder.Append(", \"IsCollisionEnabled\" : \"" + _IsCollisionEnabled.ToString() + "\"");
            lStringBuilder.Append(", \"IsFadingEnabled\" : \"" + _IsFadingEnabled.ToString() + "\"");
            lStringBuilder.Append(", \"SpecifyFadeRenderers\" : \"" + _SpecifyFadeRenderers.ToString() + "\"");
            lStringBuilder.Append(", \"FadeTransformIndexes\" : \"" + string.Join(",", _FadeTransformIndexes.Select(n => n.ToString()).ToArray()) + "\"");

            // Cycle through all the properties.
            // Unfortunately Binding flags don't seem to be working. So,
            // we need to ensure we don't include base properties
            PropertyInfo[] lBaseProperties = typeof(CameraMotor).GetProperties();
            PropertyInfo[] lProperties     = this.GetType().GetProperties();
            foreach (PropertyInfo lProperty in lProperties)
            {
                if (!lProperty.CanWrite)
                {
                    continue;
                }

                bool lAdd = true;
                for (int i = 0; i < lBaseProperties.Length; i++)
                {
                    if (lProperty.Name == lBaseProperties[i].Name)
                    {
                        lAdd = false;
                        break;
                    }
                }

                if (!lAdd || lProperty.GetValue(this, null) == null)
                {
                    continue;
                }

                object lValue = lProperty.GetValue(this, null);
                if (lProperty.PropertyType == typeof(Vector2))
                {
                    lStringBuilder.Append(", \"" + lProperty.Name + "\" : \"" + ((Vector2)lValue).Serialize() + "\"");
                }
                else if (lProperty.PropertyType == typeof(Vector3))
                {
                    lStringBuilder.Append(", \"" + lProperty.Name + "\" : \"" + ((Vector3)lValue).Serialize() + "\"");
                }
                else if (lProperty.PropertyType == typeof(Vector4))
                {
                    lStringBuilder.Append(", \"" + lProperty.Name + "\" : \"" + ((Vector4)lValue).Serialize() + "\"");
                }
                else if (lProperty.PropertyType == typeof(Quaternion))
                {
                    lStringBuilder.Append(", \"" + lProperty.Name + "\" : \"" + ((Quaternion)lValue).Serialize() + "\"");
                }
                else if (lProperty.PropertyType == typeof(Transform))
                {
                    // We use the _StoredTransformIndex for serialization
                }
                else if (lProperty.PropertyType == typeof(List <int>))
                {
                    List <int> lList = lValue as List <int>;
                    lStringBuilder.Append(", \"" + lProperty.Name + "\" : \"" + string.Join(",", lList.Select(n => n.ToString(CultureInfo.InvariantCulture)).ToArray()) + "\"");
                }
                else if (lProperty.PropertyType == typeof(AnimationCurve))
                {
                    lStringBuilder.Append(", \"" + lProperty.Name + "\" : \"");

                    AnimationCurve lCurve = lValue as AnimationCurve;
                    lStringBuilder.Append(lCurve.Serialize());

                    lStringBuilder.Append("\"");
                }
                else
                {
                    lStringBuilder.Append(", \"" + lProperty.Name + "\" : \"" + lValue.ToString() + "\"");
                }
            }

            lStringBuilder.Append("}");

            return(lStringBuilder.ToString());
        }