/// <summary> /// This function is called when check needs to decide which list of ExpressionMembers to output. /// After it is called, SetValue will be called, to allow for error correction. /// </summary> /// <example>If input is wrong, decide will choose something, and then the input will be corrected in the SetValue function</example> public override string Decide(ExpressionMemberContainer container) { if (container.Statement.Name == "destroy") { return(Choices[0]); // destroy (named object) } if (container.GetAttribute("type") == "asteroids") { return(Choices[1]); // destroy_near asteroids } if (container.GetAttribute("type") == "mines") { return(Choices[2]); // destroy_near mines } if (container.GetAttribute("type") == "nebulas") { return(Choices[3]); // destroy_near nebulas } if (container.GetAttribute("type") == "whales") { return(Choices[4]); // destroy_near whales } if (container.GetAttribute("type") == "drones") { return(Choices[5]); // destroy_near drones } if (true) { return(Choices[6]); // destroy_near all } }
/// <summary> /// Called after Decide has made its choice, or, as usual for ExpressionMembers, after user edited the value through a Dialog. /// For checks, SetValue must change the attributes/etc of the statement according to the newly chosen value /// <example>If you chose "Use GM ...", SetValue will set "use_gm_..." attribute to ""</example> /// </summary> protected override void SetValueInternal(ExpressionMemberContainer container, string value) { if (value == Choices[(int)Choice.RandomInt]) { container.SetAttributeIfNull("randomIntLow", "0"); container.SetAttributeIfNull("randomIntHigh", "0"); container.SetAttribute("randomFloatLow", null); container.SetAttribute("randomFloatHigh", null); container.SetAttribute("value", null); } if (value == Choices[(int)Choice.RandomFloat]) { container.SetAttribute("randomIntLow", null); container.SetAttribute("randomIntHigh", null); container.SetAttributeIfNull("randomFloatLow", "0.0"); container.SetAttributeIfNull("randomFloatHigh", "0.0"); container.SetAttribute("value", null); } if (value == Choices[(int)Choice.Exact]) { container.SetAttribute("randomIntLow", null); container.SetAttribute("randomIntHigh", null); container.SetAttribute("randomFloatLow", null); container.SetAttribute("randomFloatHigh", null); container.SetAttributeIfNull("value", "0.0"); } base.SetValueInternal(container, value); if (container.GetAttribute("integer") != null && container.GetAttribute("integer") != "yes") { container.SetAttribute("integer", null); } }
/// <summary> /// Called after Decide has made its choice, or, as usual for ExpressionMembers, after user edited the value through a Dialog. /// For checks, SetValue must change the attributes/etc of the statement according to the newly chosen value /// <example>If you chose "Use GM ...", SetValue will set "use_gm_..." attribute to ""</example> /// </summary> protected override void SetValueInternal(ExpressionMemberContainer container, string value) { if (value == "<OBSOLETE_COUNTECM>") { // Convert countECM to countEMP. value = "<DEFAULT>"; container.SetAttribute("property", "countEMP"); } if (value == "<OBSOLETE_MISSILESTORESECM>") { // Convert missileStoresECM to missileStoresEMP. value = "<DEFAULT>"; container.SetAttribute("property", "missileStoresEMP"); } //if (value == "<INVALID_PROPERTY>") //{ // value = "<DEFAULT>"; // container.SetAttribute("property", "positionX"); //} if (Mission.Current.Loading && value == "<READ_ONLY>") { Log.Add("Warning! Attempt to add to read-only property " + container.GetAttribute("property") + " detected in event: " + container.Statement.Parent.Name + "!"); } if (Mission.Current.Loading && value == "<UNKNOWN_PROPERTY>") { Log.Add("Warning! Unknown property " + container.GetAttribute("property") + " detected in event: " + container.Statement.Parent.Name + "!"); } base.SetValueInternal(container, value); }
/// <summary> /// This function is called when check needs to decide which list of ExpressionMembers to output. /// After it is called, SetValue will be called, to allow for error correction. /// </summary> /// <example>If input is wrong, decide will choose something, and then the input will be corrected in the SetValue function</example> public override string Decide(ExpressionMemberContainer container) { string f = container.GetAttribute("fakeShieldsFront"); string r = container.GetAttribute("fakeShieldsRear"); int fi, ri; Helper.IntTryParse(f, out fi); Helper.IntTryParse(r, out ri); if ((f == null || fi == -1) && (r == null || ri == -1)) { return(Choices[0]); // no fake shields } if (r == null || ri == -1) { return(Choices[1]); // fake front shields } if (f == null || fi == -1) { return(Choices[2]); // fake rear shields } if (true) { return(Choices[3]); // fake front/rear shields } }
/// <summary> /// Called after Decide has made its choice, or, as usual for ExpressionMembers, after user edited the value through a Dialog. /// For checks, SetValue must change the attributes/etc of the statement according to the newly chosen value /// <example>If you chose "Use GM ...", SetValue will set "use_gm_..." attribute to ""</example> /// </summary> protected override void SetValueInternal(ExpressionMemberContainer container, string value) { if (value == Choices[1]) //convert { string msg = "Whale statement (name: \"" + (container.GetAttribute("name") ?? "<null>") + "\" "; value = "Monster"; container.Statement.Name = value; if (!String.IsNullOrEmpty(container.GetAttribute("targetName"))) { //ATTACK container.SetAttribute("type", "TARGET_THROTTLE"); container.SetAttribute("value1", container.GetAttribute("scriptThrottle")); msg += "targetName: \"" + container.GetAttribute("targetName") + "\" scriptThrottle \"" + container.GetAttribute("scriptThrottle") + ") was converted to add_ai \"TARGET_THROTTLE\" statement"; } else { //POINT_THROTTLE container.SetAttribute("type", "POINT_THROTTLE"); container.SetAttribute("value1", container.GetAttribute("pointX")); container.SetAttribute("value2", container.GetAttribute("pointY")); container.SetAttribute("value3", container.GetAttribute("pointZ")); container.SetAttribute("value4", container.GetAttribute("scriptThrottle")); msg += "target point: \"" + container.GetAttribute("pointX") + ", " + container.GetAttribute("pointY") + ", " + container.GetAttribute("pointZ") + "\" scriptThrottle: \"" + container.GetAttribute("scriptThrottle") + ") was converted to add_ai \"POINT_THROTTLE\" statement"; } Log.Add(msg); } base.SetValueInternal(container, value); }
/// <summary> /// This function is called when check needs to decide which list of ExpressionMembers to output. /// After it is called, SetValue will be called, to allow for error correction. /// </summary> /// <example>If input is wrong, decide will choose something, and then the input will be corrected in the SetValue function</example> public override string Decide(ExpressionMemberContainer container) { if (container.GetAttribute("sideValue") != null) { return(Choices[1]); // "... side #" } // The attribute on incoming_comms_text was called "side" prior to Artemis 2.6. if (container.GetAttribute("side") != null) { return("<OBSOLETE_SIDE>"); } return(Choices[0]); // "... default side" }
/// <summary> /// This function is called when check needs to decide which list of ExpressionMembers to output. /// After it is called, SetValue will be called, to allow for error correction. /// </summary> /// <example>If input is wrong, decide will choose something, and then the input will be corrected in the SetValue function</example> public override string Decide(ExpressionMemberContainer container) { if (container.GetAttribute("radius") == null || container.GetAttribute("radius") == "0") { return(Choices[0]); // line } if ((container.GetAttribute("startAngle") != null) || (container.GetAttribute("endAngle") != null)) { return(Choices[2]); } else { return(Choices[1]); // circle } }
/// <summary> /// This function is called when check needs to decide which list of ExpressionMembers to output. /// After it is called, SetValue will be called, to allow for error correction. /// </summary> /// <example>If input is wrong, decide will choose something, and then the input will be corrected in the SetValue function</example> public override string Decide(ExpressionMemberContainer container) { if (!String.IsNullOrEmpty(container.GetAttribute("name"))) { return(Choices[2]); // name } if (container.GetAttribute("use_gm_position") != null) { return(Choices[1]); // use_gm_pos } else { return(Choices[0]); // point } }
/// <summary> /// This function is called when check needs to decide which list of ExpressionMembers to output. /// After it is called, SetValue will be called, to allow for error correction. /// </summary> /// <example>If input is wrong, decide will choose something, and then the input will be corrected in the SetValue function</example> public override string Decide(ExpressionMemberContainer container) { if (container.GetAttribute("value") == null && (container.GetAttribute("randomIntLow") != null || container.GetAttribute("randomIntHigh") != null)) { return(Choices[(int)Choice.RandomInt]); } if (container.GetAttribute("value") == null && (container.GetAttribute("randomFloatLow") != null || container.GetAttribute("randomFloatHigh") != null)) { return(Choices[(int)Choice.RandomFloat]); } else { return(Choices[(int)Choice.Exact]); } }
/// <summary> /// This function is called when check needs to decide which list of ExpressionMembers to output. /// After it is called, SetValue will be called, to allow for error correction. /// </summary> /// <example>If input is wrong, decide will choose something, and then the input will be corrected in the SetValue function</example> public override string Decide(ExpressionMemberContainer container) { if (container.GetAttribute("value1") == null && container.GetAttribute("value2") == null) { return(Choices[0]); // anywhere/anywhere } if (container.GetAttribute("value1") == null && container.GetAttribute("value2") != null) { return(Choices[1]); // anywhere/limited } if (true) { return(Choices[2]); //limited/limited } }
/// <summary> /// Called after Decide has made its choice, or, as usual for ExpressionMembers, after user edited the value through a Dialog. /// For checks, SetValue must change the attributes/etc of the statement according to the newly chosen value /// <example>If you chose "Use GM ...", SetValue will set "use_gm_..." attribute to ""</example> /// </summary> protected override void SetValueInternal(ExpressionMemberContainer container, string value) { if (value == "<OBSOLETE_COUNTECM>") { // Convert countECM to countEMP. value = "<INT0...+INF>"; container.SetAttribute("property", "countEMP"); } if (value == "<OBSOLETE_MISSILESTORESECM>") { // Convert missileStoresECM to missileStoresEMP. value = "<INT0...+INF>"; container.SetAttribute("property", "missileStoresEMP"); } if (value == "<BOOLYESNO>") { string flag = container.GetAttribute("value"); if (flag == null || !Helper.IntTryParse(flag)) { container.SetAttribute("value", "0"); } else if (Helper.StringToInt(flag) == 1) { container.SetAttribute("value", "1"); } else { container.SetAttribute("value", "0"); } } //if (value == "<INVALID_PROPERTY>") //{ // value = "<DEFAULT>"; // container.SetAttribute("property", "positionX"); //} if (Mission.Current.Loading && value == "<READ_ONLY>") { Log.Add("Warning! Attempt to set read-only property " + container.GetAttribute("property") + " detected in event: " + container.Statement.Parent.Name + "!"); } if (Mission.Current.Loading && value == "<UNKNOWN_PROPERTY>") { Log.Add("Warning! Unknown property " + container.GetAttribute("property") + " detected in event: " + container.Statement.Parent.Name + "!"); } base.SetValueInternal(container, value); }
/// <summary> /// Called after Decide has made its choice, or, as usual for ExpressionMembers, after user edited the value through a Dialog. /// For checks, SetValue must change the attributes/etc of the statement according to the newly chosen value /// <example>If you chose "Use GM ...", SetValue will set "use_gm_..." attribute to "" if it was null</example> /// </summary> protected override void SetValueInternal(ExpressionMemberContainer container, string value) { if (value == Choices[0]) //name { container.SetAttribute("use_gm_selection", null); container.SetAttribute("player_slot", null); container.SetAttributeIfNull("name", ""); } if (value == Choices[1]) //usegm { if (container.GetAttribute("use_gm_selection") == null) { container.SetAttribute("use_gm_selection", ""); } container.SetAttribute("name", null); container.SetAttribute("player_slot", null); } if (value == Choices[2]) //useslot { container.SetAttribute("use_gm_selection", null); container.SetAttribute("name", null); container.SetAttributeIfNull("player_slot", ""); } base.SetValueInternal(container, value); }
/// <summary> /// Called after Decide has made its choice, or, as usual for ExpressionMembers, after user edited the value through a Dialog. /// For checks, SetValue must change the attributes/etc of the statement according to the newly chosen value /// <example>If you chose "Use GM ...", SetValue will set "use_gm_..." attribute to ""</example> /// </summary> protected override void SetValueInternal(ExpressionMemberContainer container, string value) { if (Mission.Current.Loading && value == "!ok") { Log.Add("Warning! Unknown fleet property " + container.GetAttribute("property_f") + " detected in event: " + container.Statement.Parent.Name + "!"); } base.SetValueInternal(container, value); }
/// <summary> /// This function is called when check needs to decide which list of ExpressionMembers to output. /// After it is called, SetValue will be called, to allow for error correction. /// </summary> /// <example>If input is wrong, decide will choose something, and then the input will be corrected in the SetValue function</example> public override string Decide(ExpressionMemberContainer container) { if (container.GetAttribute("use_gm_selection") == null) { if (container.GetAttribute("name") == null) { return(Choices[2]); // slot } else { return(Choices[0]); // name } } else { return(Choices[1]); // Use_gm } }
/// <summary> /// This function is called when check needs to decide which list of ExpressionMembers to output. /// After it is called, SetValue will be called, to allow for error correction. /// </summary> /// <example>If input is wrong, decide will choose something, and then the input will be corrected in the SetValue function</example> public override string Decide(ExpressionMemberContainer container) { if (string.IsNullOrWhiteSpace(container.GetAttribute("value"))) { return(Choices[0]); // text } else { return(Choices[1]); // id } }
/// <summary> /// This function is called when check needs to decide which list of ExpressionMembers to output. /// After it is called, SetValue will be called, to allow for error correction. /// </summary> /// <example>If input is wrong, decide will choose something, and then the input will be corrected in the SetValue function</example> public override string Decide(ExpressionMemberContainer container) { if (!String.IsNullOrEmpty(container.GetAttribute("targetName"))) { return(Choices[1]); // name } else { return(Choices[0]); // point } }
/// <summary> /// Called after Decide has made its choice, or, as usual for ExpressionMembers, after user edited the value through a Dialog. /// For checks, SetValue must change the attributes/etc of the statement according to the newly chosen value /// <example>If you chose "Use GM ...", SetValue will set "use_gm_..." attribute to ""</example> /// </summary> protected override void SetValueInternal(ExpressionMemberContainer container, string value) { if (value == "<OBSOLETE_SIDE>") { // Convert "side" attribute to "sideValue" attribute. value = Choices[1]; // "... side #" container.SetAttribute("sideValue", container.GetAttribute("side")); } base.SetValueInternal(container, value); }
/// <summary> /// This function is called when check needs to decide which list of ExpressionMembers to output. /// After it is called, SetValue will be called, to allow for error correction. /// </summary> /// <example>If input is wrong, decide will choose something, and then the input will be corrected in the SetValue function</example> public override string Decide(ExpressionMemberContainer container) { if (container.GetAttribute("use_gm_position") == null) { return(Choices[0]); // point } else { return(Choices[1]); // use_gm_pos } }
/// <summary> /// This function is called when check needs to decide which list of ExpressionMembers to output. /// After it is called, SetValue will be called, to allow for error correction. /// </summary> /// <example>If input is wrong, decide will choose something, and then the input will be corrected in the SetValue function</example> public override string Decide(ExpressionMemberContainer container) { if (container.GetAttribute("fleetnumber") == null) { return(Choices[0]); // all ships } else { return(Choices[1]); // fleetnumber } }
/// <summary> /// This function is called when check needs to decide which list of ExpressionMembers to output. /// After it is called, SetValue will be called, to allow for error correction. /// </summary> /// <example>If input is wrong, decide will choose something, and then the input will be corrected in the SetValue function</example> public override string Decide(ExpressionMemberContainer container) { //if ((container.GetAttribute("hullKeys") == null && container.GetAttribute("raceKeys") == null) || !string.IsNullOrEmpty(container.GetAttribute("hullID"))) //|| !string.IsNullOrEmpty(container.GetAttribute("hullID") if (container.GetAttribute("hullID") == null) { return(Choices[HullRaceKey]); // hullKeys / raceKeys } else { return(Choices[HullID]); // hullID } }
/// <summary> /// Called after Decide has made its choice, or, as usual for ExpressionMembers, after user edited the value through a Dialog. /// For checks, SetValue must change the attributes/etc of the statement according to the newly chosen value /// <example>If you chose "Use GM ...", SetValue will set "use_gm_..." attribute to ""</example> /// </summary> protected override void SetValueInternal(ExpressionMemberContainer container, string value) { if (value == Choices[0]) //name { container.SetAttribute("use_gm_selection", null); } else if (container.GetAttribute("use_gm_selection") == null) // use_gm_sel { container.SetAttribute("use_gm_selection", ""); } base.SetValueInternal(container, value); }
/// <summary> /// Called after Decide has made its choice, or, as usual for ExpressionMembers, after user edited the value through a Dialog. /// For checks, SetValue must change the attributes/etc of the statement according to the newly chosen value /// <example>If you chose "Use GM ...", SetValue will set "use_gm_..." attribute to ""</example> /// </summary> protected override void SetValueInternal(ExpressionMemberContainer container, string value) { if (value == "<NULL>") { container.SetAttribute("type", "enemy"); value = "enemy"; } if (value == "<INVALID_TYPE>") { Log.Add("Warning! Unknown create type " + container.GetAttribute("type") + " detected in event: " + container.Statement.Parent.Name + "!"); } base.SetValueInternal(container, value); }
/// <summary> /// This function is called when check needs to decide which list of ExpressionMembers to output. /// After it is called, SetValue will be called, to allow for error correction. /// </summary> /// <example>If input is wrong, Decide will choose something, and then the input will be corrected in the SetValue function</example> public override string Decide(ExpressionMemberContainer container) { string type = container.GetAttribute("type"); if (type != null) { type = type.ToLower(); } switch (type) { case "anomaly": return("Anomaly"); case "blackhole": return("<NAMED_MAP_OBJECT>"); case "player": return("player"); case "whale": return("whale"); case "monster": return("monster"); case "neutral": return("neutral"); case "station": return("station"); case "enemy": return("enemy"); case "genericmesh": return("genericMesh"); case "nebulas": return("nebulas"); case "asteroids": return("<NAMELESS_MAP_OBJECT>"); case "mines": return("<NAMELESS_MAP_OBJECT>"); case "monstertype": return("Classic"); case "anomalytype": return("Energy"); case null: return("<NULL>"); default: return("<INVALID_TYPE>"); //This must be further converted in SetValue to some valid one, and type must be set there as well } }
/// <summary> /// This function is called when check needs to decide which list of ExpressionMembers to output. /// After it is called, SetValue will be called, to allow for error correction. /// </summary> /// <example>If input is wrong, decide will choose something, and then the input will be corrected in the SetValue function</example> public override string Decide(ExpressionMemberContainer container) { string type = container.GetAttribute("property", ExpressionMemberValueDescriptions.Property.DefaultIfNull); switch (type) { case "nonPlayerSpeed": return("<ENMYSP>"); case "nebulaIsOpaque": return("<NEBULAROP>"); case "sensorSetting": return("<SENSOR>"); case "nonPlayerShield": return("<ENMYSP>"); case "nonPlayerWeapon": return("<ENMYSP>"); case "playerWeapon": return("<ENMYSP>"); case "playerShields": return("<ENMYSP>"); case "coopAdjustmentValue": return("<DEFAULT>"); case "musicObjectMasterVolume": return("<DEFAULT>"); case "commsObjectMasterVolume": return("<DEFAULT>"); case "soundFXVolume": return("<DEFAULT>"); case "gameTimeLimit": return("<DEFAULT>"); case "networkTickSpeed": return("<DEFAULT>"); //EVERYTHING case "positionX": return("<FLT0...100K>"); case "positionY": return("<FLT-100K...100K>"); case "positionZ": return("<FLT0...100K>"); case "deltaX": return("<FLT-100K...100K>"); case "deltaY": return("<FLT-100K...100K>"); case "deltaZ": return("<FLT-100K...100K>"); case "angle": return("<DEFAULT>"); case "pitch": return("<DEFAULT>"); case "roll": return("<DEFAULT>"); case "sideValue": return("<DEFAULT>"); //VALUES FOR GENERIC MESHES case "blocksShotFlag": return("<BOOLYESNO>"); case "pushRadius": return("<FLT-+INF>"); case "pitchDelta": return("<DEFAULT>"); case "rollDelta": return("<DEFAULT>"); case "angleDelta": return("<DEFAULT>"); case "artScale": return("<DEFAULT>"); //VALUES FOR STATIONS case "shieldState": return("<FLT-+INF>"); case "canBuild": return("<BOOLYESNO>"); case "missileStoresHoming": return("<INT0...+INF>"); case "missileStoresNuke": return("<INT0...+INF>"); case "missileStoresMine": return("<INT0...+INF>"); case "missileStoresECM": return("<OBSOLETE_MISSILESTORESECM>"); case "missileStoresEMP": return("<INT0...+INF>"); case "missileStoresPShock": return("<INT0...+INF>"); case "missileStoresBeacon": return("<INT0...+INF>"); case "missileStoresProbe": return("<INT0...+INF>"); case "missileStoresTag": return("<INT0...+INF>"); //VALUES FOR SHIELDED SHIPS case "throttle": return("<DEFAULT>"); case "steering": return("<DEFAULT>"); case "topSpeed": return("<DEFAULT>"); case "turnRate": return("<DEFAULT>"); case "shieldStateFront": return("<INT-+INF>"); case "shieldMaxStateFront": return("<INT-+INF>"); case "shieldStateBack": return("<INT-+INF>"); case "shieldMaxStateBack": return("<INT-+INF>"); case "shieldsOn": return("<BOOLYESNO>"); case "triggersMines": return("<BOOLYESNO>"); case "systemDamageBeam": return("<DEFAULT>"); case "systemDamageTorpedo": return("<DEFAULT>"); case "systemDamageTactical": return("<DEFAULT>"); case "systemDamageTurning": return("<DEFAULT>"); case "systemDamageImpulse": return("<DEFAULT>"); case "systemDamageWarp": return("<DEFAULT>"); case "systemDamageFrontShield": return("<DEFAULT>"); case "systemDamageBackShield": return("<DEFAULT>"); case "shieldBandStrength0": return("<DEFAULT>"); case "shieldBandStrength1": return("<DEFAULT>"); case "shieldBandStrength2": return("<DEFAULT>"); case "shieldBandStrength3": return("<DEFAULT>"); case "shieldBandStrength4": return("<DEFAULT>"); //VALUES FOR ENEMIES case "targetPointX": return("<FLT0...100K>"); case "targetPointY": return("<FLT-100K...100K>"); case "targetPointZ": return("<FLT0...100K>"); case "hasSurrendered": return("<BOOLYESNO>"); case "tauntImmunityIndex": return("<tII1_3>"); case "eliteAIType": return("<ELITEAITYPE>"); case "eliteAbilityBits": return("<ELITEABILITYBITS>"); case "eliteAbilityState": return("<DEFAULT>"); case "surrenderChance": return("<INT0...100>"); //VALUES FOR NEUTRALS case "exitPointX": return("<FLT0...100K>"); case "exitPointY": return("<FLT-100K...100K>"); case "exitPointZ": return("<FLT0...100K>"); //VALUES FOR PLAYERS case "countHoming": return("<INT0...+INF>"); case "countNuke": return("<INT0...+INF>"); case "countMine": return("<INT0...+INF>"); case "countECM": return("<OBSOLETE_COUNTECM>"); case "countEMP": return("<INT0...+INF>"); case "countShk": return("<INT0...+INF>"); case "countBea": return("<INT0...+INF>"); case "countPro": return("<INT0...+INF>"); case "countTag": return("<INT0...+INF>"); case "energy": return("<INT0...+INF>"); case "warpState": return("<INT0...4>"); case "currentRealSpeed": return("<READ_ONLY>"); case "totalCoolant": return("<INT0...+INF>"); case "systemCurCoolantBeam": return("<INT0...+INF>"); case "systemCurCoolantTorpedo": return("<INT0...+INF>"); case "systemCurCoolantTactical": return("<INT0...+INF>"); case "systemCurCoolantTurning": return("<INT0...+INF>"); case "systemCurCoolantImpulse": return("<INT0...+INF>"); case "systemCurCoolantWarp": return("<INT0...+INF>"); case "systemCurCoolantFrontShield": return("<INT0...+INF>"); case "systemCurCoolantBackShield": return("<INT0...+INF>"); case "systemCurHeatBeam": return("<DEFAULT>"); case "systemCurHeatTorpedo": return("<DEFAULT>"); case "systemCurHeatTactical": return("<DEFAULT>"); case "systemCurHeatTurning": return("<DEFAULT>"); case "systemCurHeatImpulse": return("<DEFAULT>"); case "systemCurHeatWarp": return("<DEFAULT>"); case "systemCurHeatFrontShield": return("<DEFAULT>"); case "systemCurHeatBackShield": return("<DEFAULT>"); case "systemCurEnergyBeam": return("<DEFAULT>"); case "systemCurEnergyTorpedo": return("<DEFAULT>"); case "systemCurEnergyTactical": return("<DEFAULT>"); case "systemCurEnergyTurning": return("<DEFAULT>"); case "systemCurEnergyImpulse": return("<DEFAULT>"); case "systemCurEnergyWarp": return("<DEFAULT>"); case "systemCurEnergyFrontShield": return("<DEFAULT>"); case "systemCurEnergyBackShield": return("<DEFAULT>"); //DEFAULT CASE default: return("<UNKNOWN_PROPERTY>"); } }
/// <summary> /// This function is called when check needs to decide which list of ExpressionMembers to output. /// After it is called, SetValue will be called, to allow for error correction. /// </summary> /// <example>If input is wrong, decide will choose something, and then the input will be corrected in the SetValue function</example> public override string Decide(ExpressionMemberContainer container) { if (ExpressionMemberValueDescriptions.PropertyF.Editor.XmlValueToDisplay.ContainsKey(container.GetAttribute("property", ExpressionMemberValueDescriptions.PropertyF.DefaultIfNull))) { return(Choices[0]); // ok } else { return(Choices[1]); // not ok } }
/// <summary> /// Get value of current member (internal value, as is in XML) /// </summary> public virtual string GetValue(ExpressionMemberContainer container) { return(container.GetAttribute()); }
/// <summary> /// This function is called when check needs to decide which list of ExpressionMembers to output. /// After it is called, SetValue will be called, to allow for error correction. /// </summary> /// <example>If input is wrong, decide will choose something, and then the input will be corrected in the SetValue function</example> public override string Decide(ExpressionMemberContainer container) { string type = container.GetAttribute("type"); switch (type) { case "ATTACK": return("ATTACK"); case "AVOID_SIGNAL": return("AVOID_SIGNAL"); case "AVOID_BLACK_HOLE": return("<AVOID>"); case "AVOID_WHALE": return("<AVOID>"); case "CHASE_AI_SHIP": return("<CHASE>"); case "CHASE_ANGER": return("<NOTHING>"); case "CHASE_FLEET": return("CHASE_FLEET"); case "CHASE_MONSTER": return("<CHASE_NO_NEBULA>"); case "CHASE_OTHER_MONSTERS": return("<CHASE_NO_NEBULA>"); case "CHASE_PLAYER": return("<CHASE>"); case "CHASE_SIGNAL": return("CHASE_SIGNAL"); case "CHASE_STATION": return("<CHASE_NO_NEBULA>"); case "CHASE_WHALE": return("<CHASE_NO_NEBULA>"); case "DEFEND": return("DEFEND"); case "DIR_THROTTLE": return("DIR_THROTTLE"); case "DRAGON_NEST": return("<NOTHING>"); case "FIGHTER_BINGO": return("<NOTHING>"); case "FOLLOW_COMMS_ORDERS": return("<NOTHING>"); case "FOLLOW_LEADER": return("<NOTHING>"); case "FRENZY_ATTACK": return("<NOTHING>"); case "GO_TO_HOLE": return("GO_TO_HOLE"); case "GUARD_STATION": return("GUARD_STATION"); case "LAUNCH_FIGHTERS": return("LAUNCH_FIGHTERS"); case "LEADER_LEADS": return("<NOTHING>"); case "MOVE_WITH_GROUP": return("MOVE_WITH_GROUP"); case "PLAY_IN_ASTEROIDS": return("<NOTHING>"); case "POINT_THROTTLE": return("POINT_THROTTLE"); case "PROCEED_TO_EXIT": return("<NOTHING>"); case "RANDOM_PATROL": return("RANDOM_PATROL"); case "RELEASE_PIRANHAS": return("RELEASE_PIRANHAS"); case "ELITE_AI": return("<OBSOLETE_ELITE_AI>"); case "SPCL_AI": return("<NOTHING>"); case "STAY_CLOSE": return("STAY_CLOSE"); case "TARGET_THROTTLE": return("TARGET_THROTTLE"); case "TRY_TO_BECOME_LEADER": return("<NOTHING>"); default: return("<INVALID_TYPE>"); // This must be further converted in SetValue to some valid one, and type must be set there as well. } }
/// <summary> /// Shows a GUI form to edit the container's expression member /// </summary> public override void ShowEditingDialog(ExpressionMemberContainer container, ExpressionMemberValueDescription description, string defaultValue) { KeyValuePair <bool, string> result = DialogRHKeys.Show(container.Member.Name, container.GetAttribute("raceKeys"), container.GetAttribute("hullKeys"), DialogRHKeysMode.RaceNamesKeys); if (result.Key) { ValueChosen(container, result.Value); } }