private void changeCustomRibbon(LogbookEntry log) { string code = "X" + log.Code.Substring(2); if (Log.IsLogable(Log.LEVEL.TRACE)) { Log.Trace("changing custom ribbon for code " + code); } Ribbon ribbon = RibbonPool.Instance().GetRibbonForCode(code); if (ribbon == null) { Log.Error("invalid custom ribbon code: " + code); return; } // CustomAchievement achievement = ribbon.GetAchievement() as CustomAchievement; if (achievement == null) { Log.Error("invalid custom ribbon achievement"); return; } achievement.SetName(log.Name); achievement.SetDescription(log.Data); if (Log.IsLogable(Log.LEVEL.TRACE)) { Log.Trace("custom ribbonchanged"); } }
public Ribbon CreateCustomRibbon(int index, String filename, String name, String text, Ribbon supersede = null) { Log.Detail("creating custom ribbon " + name + " (#" + index + ")"); CustomAchievement achievement = new CustomAchievement(index, -1000 + index); Ribbon ribbon = new Ribbon(_RP + filename, achievement, supersede); achievement.SetName(name); achievement.SetText(text); AddCustomRibbon(index, ribbon); return(ribbon); }
public override void DoDataChange(object[] parameter) { if (parameter.Count() < 3) { Log.Warning("invalid parameter count for custom ribbon change"); return; } string s0 = parameter[0] as string; string s1 = parameter[1] as string; string s2 = parameter[2] as string; if (s0 == null || s1 == null || s2 == null) { Log.Warning("invalid parameter type for custom ribbon change"); return; } string code = "X" + s0.Substring(2); string name = s1; string text = s2; if (Log.IsLogable(Log.LEVEL.TRACE)) { Log.Trace("changing custom ribbon for code " + code); } Ribbon ribbon = RibbonPool.Instance().GetRibbonForCode(code); if (ribbon == null) { Log.Error("invalid custom ribbon code: " + code); return; } // CustomAchievement achievement = ribbon.GetAchievement() as CustomAchievement; if (achievement == null) { Log.Error("invalid custom ribbon achievement"); return; } achievement.SetName(name); achievement.SetDescription(text); if (Log.IsLogable(Log.LEVEL.TRACE)) { Log.Trace("custom ribbon changed"); } }
private void AwardSelectedCustomRibbon() { if (selected == null) { Log.Warning("no custom ribbon selected"); return; } CustomAchievement achievement = selected.GetAchievement() as CustomAchievement; if (achievement == null) { Log.Warning("invalid custom ribbon"); return; } // changed name or text? if (!achievement.GetDescription().Equals(customRibbonText) || !achievement.GetName().Equals(customRibbonName)) { Log.Detail("name or text change of ribbon " + selected.GetCode()); // change name and text achievement.SetName(customRibbonName); achievement.SetDescription(customRibbonText); // record changed ribbon HallOfFame.Instance().RecordCustomRibbon(selected); } // assign ribbon to kerbal Log.Trace("assigning custom ribbon " + selected + " to kerbal " + entry.GetKerbal().name + " at game time " + Planetarium.GetUniversalTime()); HallOfFame.Instance().BeginArwardOfRibbons(); HallOfFame.Instance().Record(entry.GetKerbal(), selected); HallOfFame.Instance().EndArwardOfRibbons(); // // mark game as updated, if not in flight if (HighLogic.LoadedScene != GameScenes.FLIGHT) { Log.Trace("mark game as updated"); HighLogic.CurrentGame.Updated(); } }
public Ribbon CreateCustomRibbon(int index, String filename, String name, String text, int supersedeNr) { Log.Detail("creating custom ribbon " + name + " (#" + index + ")"); CustomAchievement achievement = new CustomAchievement(index, -1000 + index); Ribbon supersede; try { supersede = customMap[supersedeNr]; } catch (KeyNotFoundException) { supersede = null; } Ribbon ribbon = new Ribbon(_RP + filename, achievement, supersede); achievement.SetName(name); achievement.SetText(text); AddCustomRibbon(index, ribbon); return(ribbon); }
private void ReadLine(string line) { // ignore comments if (!line.StartsWith("#") && line.Length > 0) { string[] fields = line.Split(':'); if (fields.Length > 0) { string what = fields[0]; if (what.Equals("NAME") && fields.Length == 2) { this.name = fields[1]; } else if (what.Equals("FOLDER") && fields.Length == 2) { this.ribbonFolder = baseFolder + "/" + fields[1]; Log.Detail("changing ribbon folder of ribbon pack '" + name + "' to '" + this.ribbonFolder + "'"); } else if (what.Equals("BASE") && fields.Length == 2) { try { this.baseId = int.Parse(fields[1]); Log.Detail("changing base id of ribbon pack '" + name + "' to " + this.baseId); } catch { Log.Error("failed to parse custom ribbon base id"); } } else if (fields.Length == 4 || fields.Length == 5) { int id; try { id = baseId + int.Parse(fields[0]); } catch { Log.Error("failed to parse custom ribbon id"); return; } string fileOfRibbon = ribbonFolder + "/" + fields[1]; string nameOfRibbon = fields[2]; string descOfRibbon = fields[3]; int prestigeOfRibbon = id; if (fields.Length == 5) { try { prestigeOfRibbon = int.Parse(fields[4]); } catch { Log.Error("failed to parse custom ribbon id"); } } try { Log.Detail("adding custom ribbon '" + nameOfRibbon + "' (id " + id + ") to ribbon pack '" + name + "'"); Log.Trace("path of custom ribbon file is '" + fileOfRibbon + "'"); CustomAchievement achievement = new CustomAchievement(id, prestigeOfRibbon); achievement.SetName(nameOfRibbon); achievement.SetDescription(descOfRibbon); Ribbon ribbon = new Ribbon(fileOfRibbon, achievement); ribbons.Add(ribbon); } catch { Log.Warning("failed to add custom ribbon '" + nameOfRibbon + "' to ribbon pack '" + name + "'"); } } else { Log.Warning("invalid ribbon pack file for " + name + " custom ribbon pack. failed to parse line '" + line + "'"); } } } }
private void CreateCustomRibbons() { Log.Info("creating custom ribbons"); // custom ribbons provided by nothke CreateCustomRibbon(0, "Diamond", "Diamond", "The highest honor awarded for exceptional courage, unselfishness and valor"); CreateCustomRibbon(1, "InterSidera", "Inter Sidera", "\"Among the Stars\" - A commemorative ribbon for fallen kerbonauts"); CreateCustomRibbon(2, "Kerbalkind", "Kerbalkind", "Honorary retirement award for service to Kerbalkind"); // --------------- 3: not working CreateCustomRibbon(4, "Station", "Station", "custom station ribbon"); CreateCustomRibbon(5, "Spaceplane", "Spaceplane", "custom spaceplane ribbon"); CreateCustomRibbon(6, "CertifiedBadass", "Certified Badass", "Awarded for ludicrous, near-impossible and brave endeavor"); // custom ribbons provided by SmarterThanMe CreateCustomRibbon(21, "STM01", "Test Pilot", "Awarded for courage in flying in experimental craft"); CreateCustomRibbon(22, "STM02", "Expeditionary Command", "Awarded for being in command of a significant expedition, station or base"); CreateCustomRibbon(23, "STM03", "Mission Command", "Awarded for being in command of a small scale mission"); CreateCustomRibbon(24, "STM04", "Chief Scientist", "Awarded for being a Lead Scientist on a significant expedition, or a mission with a major scientific task", this.ServiceScientist); CreateCustomRibbon(25, "STM05", "Chief Engineering", "Awarded for being the Lead Engineer on a significant expedition or mission with a major engineering task", this.ServiceEngineer); CreateCustomRibbon(26, "STM06", "Space Search & Rescue", "Awarded for being involved in a search and rescue mission in space"); CreateCustomRibbon(27, "STM07", "Wings", "Awarded for piloting a plane in atmosphere"); CreateCustomRibbon(28, "STM08", "Space Wings", "Awarded for piloting a spaceplane in and out of atmosphere"); CreateCustomRibbon(29, "STM09", "Chief Operations", "Awarded for being the lead officer in charge of operations on a significant expedition or mission with a major piloting task or series of tasks", this.ServiceOperations); CreateCustomRibbon(30, "STM10", "Arrow", ""); CreateCustomRibbon(31, "STM11", "Qualified Scientist", "Awarded for having the necessary skills and knowledge, and completing the space mission training program"); CreateCustomRibbon(32, "STM12", "Qualified Operations", "Awarded for having the necessary skills and knowledge, and completing the space mission training program"); CreateCustomRibbon(33, "STM13", "Qualified Engineering", "Awarded for having the necessary skills and knowledge, and completing the space mission training program"); CreateCustomRibbon(34, "STM14", "Specialist Scientist", "Awarded for developing and demonstrating specialist aptitude in field activities for the Kerbal Space Program", 31); CreateCustomRibbon(35, "STM15", "Specialist Operations", "Awarded for developing and demonstrating specialist aptitude in field activities for the Kerbal Space Program", 32); CreateCustomRibbon(36, "STM16", "Specialist Engineering", "Awarded for developing and demonstrating specialist aptitude in field activities for the Kerbal Space Program", 33); CreateCustomRibbon(37, "STM17", "Senior Scientist", "Awarded for leadership, significant experience and outstanding technical aptitude in field activities for the Kerbal Space Program", 34); CreateCustomRibbon(38, "STM18", "Senior Operations", "Awarded for leadership, significant experience and outstanding technical aptitude in field activities for the Kerbal Space Program", 35); CreateCustomRibbon(39, "STM19", "Senior Engineering", "Awarded for leadership, significant experience and outstanding technical aptitude in field activities for the Kerbal Space Program", 36); CreateCustomRibbon(40, "STM20", "STM20", "no description"); CreateCustomRibbon(41, "STM21", "STM21", "no description"); CreateCustomRibbon(42, "STM22", "Repair In Danger", "Awarded for courage demonstrated in engaging in repair activities in dangerous circumstances"); CreateCustomRibbon(43, "STM23", "Rover Specialist", "Awarded for having developed skills and expertise as a driver of a land vehicle"); CreateCustomRibbon(44, "STM24", "EVA Specialist", "Awarded for having developed skills and expertise in conducting and overseeing EVA activities"); CreateCustomRibbon(45, "STM25", "Apprentice Chef", "no description"); CreateCustomRibbon(46, "STM26", "Chef de Partie ", "no description", 45); CreateCustomRibbon(47, "STM27", "Sous Chef", "no description", 46); CreateCustomRibbon(48, "STM28", "Chef de Cuisine", "no description", 47); // custom ribbons provided by helldiver CreateCustomRibbon(70, "Helldiver01", "Bronze Heli Pilot", "no description"); CreateCustomRibbon(71, "Helldiver02", "Silver Heli Pilot", "no description", 70); CreateCustomRibbon(72, "Helldiver03", "Bronze S25 Mission Specialist", "no description", 71); CreateCustomRibbon(73, "Helldiver04", "Silver S25 Mission Specialist", "no description", 72); CreateCustomRibbon(74, "Helldiver05", "Bronze KSO Mission Specialist", "no description"); CreateCustomRibbon(75, "Helldiver06", "Silver KSO Mission Specialist", "no description", 74); CreateCustomRibbon(76, "Helldiver07", "Bronze Shuttle Pilot", "no description"); CreateCustomRibbon(77, "Helldiver08", "Silver Shuttle Pilot", "no description", 76); // custom ribbons provided by Wyrmshadow CreateCustomRibbon(80, "Nation01", "United Kerbdom", ""); CreateCustomRibbon(81, "Nation02", "Kovjet Coprorative", ""); CreateCustomRibbon(82, "Nation03", "Republic of Kinesa", ""); CreateCustomRibbon(83, "Nation04", "The Neutral Nation", ""); CreateCustomRibbon(84, "Nation05", "KSA", ""); CreateCustomRibbon(85, "Nation06", "Kryades", ""); CreateCustomRibbon(86, "Nation07", "KSA United", ""); CreateCustomRibbon(87, "Nation08", "Kerman Empire", ""); CreateCustomRibbon(88, "Nation09", "Kanada", ""); CreateCustomRibbon(89, "Nation10", "Kitaly", ""); CreateCustomRibbon(90, "Nation11", "Mexika", ""); CreateCustomRibbon(91, "Nation12", "Brasilika", ""); CreateCustomRibbon(92, "Nation13", "Kapan", ""); CreateCustomRibbon(93, "Nation14", "Koland", ""); CreateCustomRibbon(94, "Nation15", "United Kerbalkind", ""); // generic custom ribbons int CUSTOM_BASE_INDEX = 100; for (int i = 0; i < 20; i++) { CustomAchievement achievement = new CustomAchievement(CUSTOM_BASE_INDEX + i, -1000 + i); int nr = i + 1; String ss = nr.ToString("00"); achievement.SetName(ss + " Custom"); achievement.SetText(ss + " Custom"); Ribbon ribbon = new Ribbon(_RP + "Custom" + ss, achievement); AddCustomRibbon(CUSTOM_BASE_INDEX + i, ribbon); } Log.Info("custom ribbons created (" + customRibbons.Count + " custom ribbons)"); }