├── .editorconfig ├── .gitattributes ├── .gitignore ├── DalamudPackager.targets ├── LiteralMapLink.cs ├── LiteralMapLink.csproj ├── LiteralMapLink.json ├── LiteralMapLink.sln ├── PreMapLinkPayload.cs └── README.md /.editorconfig: -------------------------------------------------------------------------------- 1 | [*.{cs,vb}] 2 | 3 | # IDE0003: Remove qualification 4 | dotnet_style_qualification_for_event = false:none 5 | 6 | # IDE0003: Remove qualification 7 | dotnet_style_qualification_for_field = false:none 8 | 9 | # IDE0003: Remove qualification 10 | dotnet_style_qualification_for_method = false:none 11 | 12 | # IDE0003: Remove qualification 13 | dotnet_style_qualification_for_property = false:none 14 | 15 | # IDE0060: Remove unused parameter 16 | dotnet_code_quality_unused_parameters = non_public:suggestion 17 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Build results 17 | [Dd]ebug/ 18 | [Dd]ebugPublic/ 19 | [Rr]elease/ 20 | [Rr]eleases/ 21 | x64/ 22 | x86/ 23 | [Aa][Rr][Mm]/ 24 | [Aa][Rr][Mm]64/ 25 | bld/ 26 | [Bb]in/ 27 | [Oo]bj/ 28 | [Ll]og/ 29 | 30 | # Visual Studio 2015/2017 cache/options directory 31 | .vs/ 32 | # Uncomment if you have tasks that create the project's static files in wwwroot 33 | #wwwroot/ 34 | 35 | # Visual Studio 2017 auto generated files 36 | Generated\ Files/ 37 | 38 | # MSTest test Results 39 | [Tt]est[Rr]esult*/ 40 | [Bb]uild[Ll]og.* 41 | 42 | # NUNIT 43 | *.VisualState.xml 44 | TestResult.xml 45 | 46 | # Build Results of an ATL Project 47 | [Dd]ebugPS/ 48 | [Rr]eleasePS/ 49 | dlldata.c 50 | 51 | # Benchmark Results 52 | BenchmarkDotNet.Artifacts/ 53 | 54 | # .NET Core 55 | project.lock.json 56 | project.fragment.lock.json 57 | artifacts/ 58 | 59 | # StyleCop 60 | StyleCopReport.xml 61 | 62 | # Files built by Visual Studio 63 | *_i.c 64 | *_p.c 65 | *_h.h 66 | *.ilk 67 | *.meta 68 | *.obj 69 | *.iobj 70 | *.pch 71 | *.pdb 72 | *.ipdb 73 | *.pgc 74 | *.pgd 75 | *.rsp 76 | *.sbr 77 | *.tlb 78 | *.tli 79 | *.tlh 80 | *.tmp 81 | *.tmp_proj 82 | *_wpftmp.csproj 83 | *.log 84 | *.vspscc 85 | *.vssscc 86 | .builds 87 | *.pidb 88 | *.svclog 89 | *.scc 90 | 91 | # Chutzpah Test files 92 | _Chutzpah* 93 | 94 | # Visual C++ cache files 95 | ipch/ 96 | *.aps 97 | *.ncb 98 | *.opendb 99 | *.opensdf 100 | *.sdf 101 | *.cachefile 102 | *.VC.db 103 | *.VC.VC.opendb 104 | 105 | # Visual Studio profiler 106 | *.psess 107 | *.vsp 108 | *.vspx 109 | *.sap 110 | 111 | # Visual Studio Trace Files 112 | *.e2e 113 | 114 | # TFS 2012 Local Workspace 115 | $tf/ 116 | 117 | # Guidance Automation Toolkit 118 | *.gpState 119 | 120 | # ReSharper is a .NET coding add-in 121 | _ReSharper*/ 122 | *.[Rr]e[Ss]harper 123 | *.DotSettings.user 124 | 125 | # JustCode is a .NET coding add-in 126 | .JustCode 127 | 128 | # TeamCity is a build add-in 129 | _TeamCity* 130 | 131 | # DotCover is a Code Coverage Tool 132 | *.dotCover 133 | 134 | # AxoCover is a Code Coverage Tool 135 | .axoCover/* 136 | !.axoCover/settings.json 137 | 138 | # Visual Studio code coverage results 139 | *.coverage 140 | *.coveragexml 141 | 142 | # NCrunch 143 | _NCrunch_* 144 | .*crunch*.local.xml 145 | nCrunchTemp_* 146 | 147 | # MightyMoose 148 | *.mm.* 149 | AutoTest.Net/ 150 | 151 | # Web workbench (sass) 152 | .sass-cache/ 153 | 154 | # Installshield output folder 155 | [Ee]xpress/ 156 | 157 | # DocProject is a documentation generator add-in 158 | DocProject/buildhelp/ 159 | DocProject/Help/*.HxT 160 | DocProject/Help/*.HxC 161 | DocProject/Help/*.hhc 162 | DocProject/Help/*.hhk 163 | DocProject/Help/*.hhp 164 | DocProject/Help/Html2 165 | DocProject/Help/html 166 | 167 | # Click-Once directory 168 | publish/ 169 | 170 | # Publish Web Output 171 | *.[Pp]ublish.xml 172 | *.azurePubxml 173 | # Note: Comment the next line if you want to checkin your web deploy settings, 174 | # but database connection strings (with potential passwords) will be unencrypted 175 | *.pubxml 176 | *.publishproj 177 | 178 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 179 | # checkin your Azure Web App publish settings, but sensitive information contained 180 | # in these scripts will be unencrypted 181 | PublishScripts/ 182 | 183 | # NuGet Packages 184 | *.nupkg 185 | # The packages folder can be ignored because of Package Restore 186 | **/[Pp]ackages/* 187 | # except build/, which is used as an MSBuild target. 188 | !**/[Pp]ackages/build/ 189 | # Uncomment if necessary however generally it will be regenerated when needed 190 | #!**/[Pp]ackages/repositories.config 191 | # NuGet v3's project.json files produces more ignorable files 192 | *.nuget.props 193 | *.nuget.targets 194 | 195 | # Microsoft Azure Build Output 196 | csx/ 197 | *.build.csdef 198 | 199 | # Microsoft Azure Emulator 200 | ecf/ 201 | rcf/ 202 | 203 | # Windows Store app package directories and files 204 | AppPackages/ 205 | BundleArtifacts/ 206 | Package.StoreAssociation.xml 207 | _pkginfo.txt 208 | *.appx 209 | 210 | # Visual Studio cache files 211 | # files ending in .cache can be ignored 212 | *.[Cc]ache 213 | # but keep track of directories ending in .cache 214 | !?*.[Cc]ache/ 215 | 216 | # Others 217 | ClientBin/ 218 | ~$* 219 | *~ 220 | *.dbmdl 221 | *.dbproj.schemaview 222 | *.jfm 223 | *.pfx 224 | *.publishsettings 225 | orleans.codegen.cs 226 | 227 | # Including strong name files can present a security risk 228 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 229 | #*.snk 230 | 231 | # Since there are multiple workflows, uncomment next line to ignore bower_components 232 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 233 | #bower_components/ 234 | 235 | # RIA/Silverlight projects 236 | Generated_Code/ 237 | 238 | # Backup & report files from converting an old project file 239 | # to a newer Visual Studio version. Backup files are not needed, 240 | # because we have git ;-) 241 | _UpgradeReport_Files/ 242 | Backup*/ 243 | UpgradeLog*.XML 244 | UpgradeLog*.htm 245 | ServiceFabricBackup/ 246 | *.rptproj.bak 247 | 248 | # SQL Server files 249 | *.mdf 250 | *.ldf 251 | *.ndf 252 | 253 | # Business Intelligence projects 254 | *.rdl.data 255 | *.bim.layout 256 | *.bim_*.settings 257 | *.rptproj.rsuser 258 | *- Backup*.rdl 259 | 260 | # Microsoft Fakes 261 | FakesAssemblies/ 262 | 263 | # GhostDoc plugin setting file 264 | *.GhostDoc.xml 265 | 266 | # Node.js Tools for Visual Studio 267 | .ntvs_analysis.dat 268 | node_modules/ 269 | 270 | # Visual Studio 6 build log 271 | *.plg 272 | 273 | # Visual Studio 6 workspace options file 274 | *.opt 275 | 276 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 277 | *.vbw 278 | 279 | # Visual Studio LightSwitch build output 280 | **/*.HTMLClient/GeneratedArtifacts 281 | **/*.DesktopClient/GeneratedArtifacts 282 | **/*.DesktopClient/ModelManifest.xml 283 | **/*.Server/GeneratedArtifacts 284 | **/*.Server/ModelManifest.xml 285 | _Pvt_Extensions 286 | 287 | # Paket dependency manager 288 | .paket/paket.exe 289 | paket-files/ 290 | 291 | # FAKE - F# Make 292 | .fake/ 293 | 294 | # JetBrains Rider 295 | .idea/ 296 | *.sln.iml 297 | 298 | # CodeRush personal settings 299 | .cr/personal 300 | 301 | # Python Tools for Visual Studio (PTVS) 302 | __pycache__/ 303 | *.pyc 304 | 305 | # Cake - Uncomment if you are using it 306 | # tools/** 307 | # !tools/packages.config 308 | 309 | # Tabs Studio 310 | *.tss 311 | 312 | # Telerik's JustMock configuration file 313 | *.jmconfig 314 | 315 | # BizTalk build output 316 | *.btp.cs 317 | *.btm.cs 318 | *.odx.cs 319 | *.xsd.cs 320 | 321 | # OpenCover UI analysis results 322 | OpenCover/ 323 | 324 | # Azure Stream Analytics local run output 325 | ASALocalRun/ 326 | 327 | # MSBuild Binary and Structured Log 328 | *.binlog 329 | 330 | # NVidia Nsight GPU debugger configuration file 331 | *.nvuser 332 | 333 | # MFractors (Xamarin productivity tool) working folder 334 | .mfractor/ 335 | 336 | # Local History for Visual Studio 337 | .localhistory/ 338 | 339 | # BeatPulse healthcheck temp database 340 | healthchecksdb -------------------------------------------------------------------------------- /DalamudPackager.targets: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /LiteralMapLink.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.RegularExpressions; 4 | using System.Runtime.InteropServices; 5 | using System.Reflection; 6 | using System.Globalization; 7 | using Dalamud.Game.Text; 8 | using Dalamud.Game.Text.SeStringHandling; 9 | using Dalamud.Game.Text.SeStringHandling.Payloads; 10 | using Dalamud.Hooking; 11 | using Dalamud.IoC; 12 | using Dalamud.Plugin; 13 | using Dalamud.Plugin.Services; 14 | using Lumina.Excel.Sheets; 15 | 16 | namespace LiteralMapLink 17 | { 18 | public class LiteralMapLink : IDalamudPlugin 19 | { 20 | [PluginService] 21 | private IDalamudPluginInterface PluginInterface { get; init; } 22 | 23 | [PluginService] 24 | private IGameInteropProvider GameInteropProvider { get; init; } 25 | 26 | [PluginService] 27 | private IChatGui Chat { get; init; } 28 | 29 | [PluginService] 30 | private IDataManager Data { get; init; } 31 | 32 | [PluginService] 33 | private IPluginLog PluginLog { get; init; } 34 | 35 | [UnmanagedFunctionPointer(CallingConvention.ThisCall)] 36 | private delegate IntPtr ParseMessageDelegate(IntPtr a, IntPtr b); 37 | private readonly Hook parseMessageHook; 38 | 39 | private readonly Dictionary maps = new(); 40 | private readonly Dictionary unmaskedMapNames = new() 41 | { 42 | { "狼狱演*场", "狼狱演习场" }, 43 | { "魔**阿济兹拉", "魔大陆阿济兹拉" }, 44 | { "玛托雅的洞*", "玛托雅的洞穴" }, 45 | { "魔**中枢", "魔大陆中枢" }, 46 | { "双蛇*军营", "双蛇党军营" }, 47 | { "地衣宫演*场", "地衣宫演习场" }, 48 | { "水晶塔演*场", "水晶塔演习场" }, 49 | { "*泉神社", "醴泉神社" }, 50 | { "*泉神社神道", "醴泉神社神道" }, 51 | { "格**火山", "格鲁格火山" }, 52 | { "**亚马乌罗提", "末日亚马乌罗提" }, 53 | { "游末邦**", "游末邦监狱" }, 54 | }; 55 | 56 | private readonly Regex mapLinkPattern = new( 57 | @"\uE0BB(?.+?)(?[\ue0b1-\ue0b9])? \( (?\d{1,2}\.\d) , (?\d{1,2}\.\d) \)", 58 | RegexOptions.Compiled); 59 | 60 | private readonly FieldInfo territoryTypeIdField = typeof(MapLinkPayload).GetField("territoryTypeId", 61 | BindingFlags.NonPublic | BindingFlags.Instance); 62 | private readonly FieldInfo mapIdField = typeof(MapLinkPayload).GetField("mapId", 63 | BindingFlags.NonPublic | BindingFlags.Instance); 64 | 65 | private readonly Dictionary historyCoordinates = new(); 66 | 67 | public LiteralMapLink() 68 | { 69 | this.parseMessageHook = GameInteropProvider.HookFromSignature( 70 | "E8 ???????? 48 8B D0 48 8D 4C 24 30 E8 ???????? 48 8B 44 24 30 80 38 00 0F 84", HandleParseMessageDetour); 71 | this.parseMessageHook.Enable(); 72 | 73 | this.Chat.ChatMessage += HandleChatMessage; 74 | 75 | foreach (var territoryType in this.Data.GetExcelSheet()) 76 | { 77 | var name = territoryType.PlaceName.Value.Name.ExtractText(); 78 | if (name != "" && !this.maps.ContainsKey(name)) 79 | { 80 | this.maps.Add(name, (territoryType.RowId, territoryType.Map.RowId)); 81 | } 82 | } 83 | } 84 | 85 | private IntPtr HandleParseMessageDetour(IntPtr a, IntPtr b) 86 | { 87 | var ret = this.parseMessageHook.Original(a, b); 88 | try 89 | { 90 | var pMessage = Marshal.ReadIntPtr(ret); 91 | var length = 0; 92 | while (Marshal.ReadByte(pMessage, length) != 0) length++; 93 | var message = new byte[length]; 94 | Marshal.Copy(pMessage, message, 0, length); 95 | 96 | var parsed = SeString.Parse(message); 97 | foreach (var payload in parsed.Payloads) 98 | { 99 | if (payload is AutoTranslatePayload p && p.Encode()[3] == 0xC9 && p.Encode()[4] == 0x04) 100 | { 101 | if (this.PluginInterface.IsDebugging) PluginLog.Info("<- {0}", BitConverter.ToString(message)); 102 | return ret; 103 | } 104 | } 105 | for (var i = 0; i < parsed.Payloads.Count; i++) 106 | { 107 | if (parsed.Payloads[i] is not TextPayload payload) continue; 108 | var match = mapLinkPattern.Match(payload.Text); 109 | if (!match.Success) continue; 110 | 111 | var mapName = match.Groups["map"].Value; 112 | if (unmaskedMapNames.ContainsKey(mapName)) 113 | { 114 | mapName = unmaskedMapNames[mapName]; 115 | } 116 | var historyKey = string.Concat(mapName, match.Value.AsSpan(mapName.Length + 1)); 117 | 118 | uint territoryId, mapId; 119 | int rawX, rawY; 120 | if (this.historyCoordinates.TryGetValue(historyKey, out var history)) 121 | { 122 | (territoryId, mapId, rawX, rawY) = history; 123 | PluginLog.Info("recall {0} => {1}", historyKey, history); 124 | } 125 | else 126 | { 127 | if (!this.maps.TryGetValue(mapName, out var mapInfo)) 128 | { 129 | PluginLog.Warning("Can't find map {0}", mapName); 130 | continue; 131 | } 132 | (territoryId, mapId) = mapInfo; 133 | var map = this.Data.GetExcelSheet().GetRow(mapId); 134 | rawX = this.GenerateRawPosition(float.Parse(match.Groups["x"].Value, CultureInfo.InvariantCulture), map.OffsetX, map.SizeFactor); 135 | rawY = this.GenerateRawPosition(float.Parse(match.Groups["y"].Value, CultureInfo.InvariantCulture), map.OffsetY, map.SizeFactor); 136 | if (match.Groups["instance"].Value != "") 137 | { 138 | mapId |= (match.Groups["instance"].Value[0] - 0xe0b0u) << 16; 139 | } 140 | history = (territoryId, mapId, rawX, rawY); 141 | this.historyCoordinates[historyKey] = history; 142 | PluginLog.Info("generate {0} => {1}", historyKey, history); 143 | } 144 | 145 | var newPayloads = new List(); 146 | if (match.Index > 0) 147 | { 148 | newPayloads.Add(new TextPayload(payload.Text[..match.Index])); 149 | } 150 | newPayloads.Add(new PreMapLinkPayload(territoryId, mapId, rawX, rawY)); 151 | if (match.Index + match.Length < payload.Text.Length) 152 | { 153 | newPayloads.Add(new TextPayload(payload.Text[(match.Index + match.Length)..])); 154 | } 155 | parsed.Payloads.RemoveAt(i); 156 | parsed.Payloads.InsertRange(i, newPayloads); 157 | 158 | var newMessage = parsed.Encode(); 159 | if (this.PluginInterface.IsDebugging) PluginLog.Info("-> {0}", BitConverter.ToString(newMessage)); 160 | var messageCapacity = Marshal.ReadInt64(ret + 8); 161 | if (newMessage.Length + 1 > messageCapacity) 162 | { 163 | // FIXME: should call std::string#resize(or maybe _Reallocate_grow_by) here, but haven't found the signature yet 164 | PluginLog.Error("Sorry, message capacity not enough, abort conversion for {0}", historyKey); 165 | return ret; 166 | } 167 | Marshal.WriteInt64(ret + 16, newMessage.Length + 1); 168 | Marshal.Copy(newMessage, 0, pMessage, newMessage.Length); 169 | Marshal.WriteByte(pMessage, newMessage.Length, 0x00); 170 | 171 | break; 172 | } 173 | } 174 | catch (Exception ex) 175 | { 176 | PluginLog.Error(ex, "Exception on HandleParseMessageDetour."); 177 | } 178 | return ret; 179 | } 180 | 181 | private void HandleChatMessage(XivChatType type, int timestamp, ref SeString sender, ref SeString message, ref bool isHandled) 182 | { 183 | try 184 | { 185 | for (var i = 0; i < message.Payloads.Count; i++) 186 | { 187 | if (message.Payloads[i] is not MapLinkPayload payload) continue; 188 | if (message.Payloads[i + 6] is not TextPayload payloadText) continue; 189 | 190 | var territoryId = (uint)territoryTypeIdField.GetValue(payload); 191 | var mapId = (uint)mapIdField.GetValue(payload); 192 | var historyKey = payloadText.Text[..(payloadText.Text.LastIndexOf(")") + 1)]; 193 | var mapName = historyKey[..(historyKey.LastIndexOf("(") - 1)]; 194 | if ('\ue0b1' <= mapName[^1] && mapName[^1] <= '\ue0b9') 195 | { 196 | this.maps[mapName[0..^1]] = (territoryId, mapId); 197 | mapId |= (mapName[^1] - 0xe0b0u) << 16; 198 | } 199 | else 200 | { 201 | this.maps[mapName] = (territoryId, mapId); 202 | } 203 | var history = (territoryId, mapId, payload.RawX, payload.RawY); 204 | this.historyCoordinates[historyKey] = history; 205 | PluginLog.Info("memorize {0} => {1}", historyKey, history); 206 | //PluginLog.Info(BitConverter.ToString(payload.Encode())); 207 | //PluginLog.Info(BitConverter.ToString(payload.Encode(true))); 208 | } 209 | } 210 | catch (Exception ex) 211 | { 212 | PluginLog.Debug(ex, "Exception on HandleChatMessage."); 213 | } 214 | } 215 | 216 | #region IDisposable Support 217 | protected virtual void Dispose(bool disposing) 218 | { 219 | if (!disposing) return; 220 | this.parseMessageHook.Dispose(); 221 | this.Chat.ChatMessage -= HandleChatMessage; 222 | } 223 | 224 | public void Dispose() 225 | { 226 | Dispose(true); 227 | GC.SuppressFinalize(this); 228 | } 229 | #endregion 230 | 231 | private readonly Random random = new(); 232 | public int GenerateRawPosition(float visibleCoordinate, short offset, ushort factor) 233 | { 234 | visibleCoordinate += (float)random.NextDouble() * 0.07f; 235 | var scale = factor / 100.0f; 236 | var scaledPos = ((((visibleCoordinate - 1.0f) * scale / 41.0f) * 2048.0f) - 1024.0f) / scale; 237 | return (int)Math.Ceiling(scaledPos - offset) * 1000; 238 | } 239 | } 240 | } 241 | -------------------------------------------------------------------------------- /LiteralMapLink.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0-windows 5 | 10.0 6 | 1.1.8.0 7 | 1.1.8.0 8 | 9 | 10 | 11 | none 12 | false 13 | 14 | 15 | 16 | false 17 | x64 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | $(AppData)\XIVLauncher\addon\Hooks\dev\Dalamud.dll 27 | $(DalamudHooks)\Dalamud.dll 28 | ..\Dalamud\bin\Debug\Dalamud.dll 29 | ..\..\Dalamud\bin\Debug\Dalamud.dll 30 | false 31 | 32 | 33 | $(AppData)\XIVLauncher\addon\Hooks\dev\Lumina.dll 34 | $(DalamudHooks)\Lumina.dll 35 | ..\Dalamud\bin\Debug\Lumina.dll 36 | ..\..\Dalamud\bin\Debug\Lumina.dll 37 | false 38 | 39 | 40 | $(AppData)\XIVLauncher\addon\Hooks\dev\Lumina.Excel.dll 41 | $(DalamudHooks)\Lumina.Excel.dll 42 | ..\Dalamud\bin\Debug\Lumina.Excel.dll 43 | ..\..\Dalamud\bin\Debug\Lumina.Excel.dll 44 | false 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /LiteralMapLink.json: -------------------------------------------------------------------------------- 1 | { 2 | "Name": "Literal Map Link", 3 | "Author": "Asvel", 4 | "Punchline": "Turn map coordinates literal into interactable map link.", 5 | "Description": "Turn map coordinates literal into interactable map link when you post in-game chat messages.", 6 | "RepoUrl": "https://github.com/Asvel/ffxiv-literal-map-link", 7 | "Tags": ["Utility", "Social"] 8 | } -------------------------------------------------------------------------------- /LiteralMapLink.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.1.32319.34 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LiteralMapLink", "LiteralMapLink.csproj", "{4E7DBCFF-ECDF-423D-B888-7A23F6C8FCB4}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {4E7DBCFF-ECDF-423D-B888-7A23F6C8FCB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {4E7DBCFF-ECDF-423D-B888-7A23F6C8FCB4}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {4E7DBCFF-ECDF-423D-B888-7A23F6C8FCB4}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {4E7DBCFF-ECDF-423D-B888-7A23F6C8FCB4}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {E86A89D9-EDA2-4F9E-90F6-B856D2E70104} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /PreMapLinkPayload.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using Dalamud.Game.Text.SeStringHandling; 5 | 6 | namespace LiteralMapLink 7 | { 8 | public class PreMapLinkPayload : Payload 9 | { 10 | public override PayloadType Type => PayloadType.AutoTranslateText; 11 | 12 | private readonly uint territoryTypeId; 13 | private readonly uint mapId; 14 | private readonly int rawX; 15 | private readonly int rawY; 16 | private readonly int rawZ; 17 | 18 | public PreMapLinkPayload(uint territoryTypeId, uint mapId, int rawX, int rawY) 19 | { 20 | this.territoryTypeId = territoryTypeId; 21 | this.mapId = mapId; 22 | this.rawX = rawX; 23 | this.rawY = rawY; 24 | this.rawZ = -30000; 25 | } 26 | 27 | protected override byte[] EncodeImpl() 28 | { 29 | var territoryBytes = MakeInteger(this.territoryTypeId); 30 | var mapBytes = MakeInteger(this.mapId); 31 | var xBytes = MakeInteger(unchecked((uint)this.rawX)); 32 | var yBytes = MakeInteger(unchecked((uint)this.rawY)); 33 | var zBytes = MakeInteger(unchecked((uint)this.rawZ)); 34 | 35 | var chunkLen = 4 + territoryBytes.Length + mapBytes.Length + xBytes.Length + yBytes.Length + zBytes.Length; 36 | 37 | var bytes = new List() 38 | { 39 | START_BYTE, 40 | (byte)SeStringChunkType.AutoTranslateKey, (byte)chunkLen, 0xC9, 0x04 41 | }; 42 | bytes.AddRange(territoryBytes); 43 | bytes.AddRange(mapBytes); 44 | bytes.AddRange(xBytes); 45 | bytes.AddRange(yBytes); 46 | bytes.AddRange(zBytes); 47 | bytes.Add(0x01); // FIXME: what is this? 48 | bytes.Add(END_BYTE); 49 | 50 | return bytes.ToArray(); 51 | } 52 | 53 | protected override void DecodeImpl(BinaryReader reader, long endOfStream) 54 | { 55 | throw new NotImplementedException(); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Literal Map Link 2 | 3 | This is a third party plugin of FFXIV plugin framework [Dalamud](https://github.com/goatcorp/Dalamud), it can turn map coordinates literal into interactable map link when you post in-game chat messages. 4 | 5 |
Demo 6 | 7 | ![demo](../gh-pages/demo.gif?raw=true) 8 | 9 |
10 | 11 | ## Installation 12 | 13 | Add `https://asvel.github.io/ffxiv-literal-map-link/` to the Custom Plugin Repositories list in Dalamud Settings, and install "Literal Map Link" from Plugin Installer. 14 | 15 | ## License 16 | 17 | All FINAL FANTASY XIV contents and materials are copyrights of SQUARE ENIX, FINAL FANTASY XIV © 2010 - 2021 SQUARE ENIX CO., LTD. All Rights Reserved. 18 | 19 | FINAL FANTASY is a registered trademark of Square Enix Holdings Co., Ltd. 20 | 21 | Source code of this project is released under [the same license](https://github.com/goatcorp/Dalamud/blob/master/LICENSE) as the Dalamud main project. 22 | --------------------------------------------------------------------------------