From: melchior Date: Mon, 3 Oct 2022 23:42:50 +0000 (-0400) Subject: Bug fix & merch name fixup X-Git-Url: http://git.osdn.net/view?p=automap%2Fautomap.git;a=commitdiff_plain;h=09ed3af718021555ef4c762b4651565621b5cdde Bug fix & merch name fixup --- diff --git a/Automap/AutomapMod.cs b/Automap/AutomapMod.cs index 8538f0b..b2d0caa 100644 --- a/Automap/AutomapMod.cs +++ b/Automap/AutomapMod.cs @@ -88,7 +88,7 @@ namespace Automap { //TAKE OUT THE TRASH! //_localAutomap = null; - _automapDialog.Dispose( ); + _automapDialog?.Dispose( ); _automapDialog = null; base.Dispose( ); diff --git a/Automap/Designators/DefaultDesignators.cs b/Automap/Designators/DefaultDesignators.cs index c8e25c1..80c58ff 100644 --- a/Automap/Designators/DefaultDesignators.cs +++ b/Automap/Designators/DefaultDesignators.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Drawing; +using System.Linq; using System.Text; using System.Text.RegularExpressions; @@ -187,51 +188,23 @@ namespace Automap { #if DEBUG clientAPI.Logger.VerboseDebug("TRADER Designator Invoked!"); - #endif - //clientAPI.Logger.VerboseDebug("Trader: {0} @ {1}", entity.GetName(), posn); - - var traderJoe = entity as EntityTrader; - if (traderJoe == null) return; + #endif - var traderName = entity.GetBehavior( )?.DisplayName ?? @"?"; - string code; - // this makes me ill - switch (entity.Code.Path) { - case "humanoid-trader-artisan": - code = "{0} the artisan"; - break; - case "humanoid-trader-treasurehunter": - code = "{0} the treasure hunter"; - break; - case "humanoid-trader-buildmaterials": - code = "{0} the building materials trader"; - break; - case "humanoid-trader-clothing": - code = "{0} the clothing merchant"; - break; - case "humanoid-trader-commodities": - code = "{0} the commodities merchant"; - break; - case "humanoid-trader-foods": - code = "{0} the foods supplier"; - break; - case "humanoid-trader-furniture": - code = "{0} the furniture trader"; - break; - case "humanoid-trader-luxuries": - code = "{0} the luxuries merchant"; - break; - case "humanoid-trader-survivalgoods": - code = "{0} the survival goods supplier"; - break; - default: - code = ""; - break; - } - var message = string.Format(code, traderName); - if (traderJoe.TradeProps != null) { - message += $" - Gears: {traderJoe.TradeProps.Money}, "; + if (entity == null) return; + + var traderName = entity.GetBehavior( )?.DisplayName ?? @"?"; + + //"game:tradingwindow-humanoid-trader-survivalgoods" + var langCodeKey = entity.Code.Domain + ":tradingwindow-" + entity.Code.Path; + var message = "?"; + #if DEBUG + clientAPI.Logger.VerboseDebug("Using Lang Key Code: \"{0}\"",langCodeKey); + #endif + if (Lang.AvailableLanguages[@"en"].HasTranslation(langCodeKey)) { + var rawLangResponse = Lang.GetL(@"en", langCodeKey, traderName); + message = rawLangResponse.Split("-".ToCharArray( ), 2).Last( ).TrimStart( ); } + poi.AddReplace(new EntityOfInterest { Name = "Trader", PrettyLocation = posn.PrettyCoords(clientAPI), diff --git a/Automap/modinfo.json b/Automap/modinfo.json index bcc745e..5e186d9 100644 --- a/Automap/modinfo.json +++ b/Automap/modinfo.json @@ -4,7 +4,7 @@ "description" : "Automap; Generates a static HTML5 map dynamically, with P.O.I. Tracking & more.", "authors": ["Melchior","VeryGoodDog"], "contributors":["VeryGoodDog", "Drakker"], - "version": "0.1.8-pre.2", + "version": "0.1.8-pre.3", "side":"Client", "dependencies": { "game": "1.17.0"