Advertisement
s4000

DAV_MapPlugin

Aug 22nd, 2019
1,355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.93 KB | None | 0 0
  1. using System.Globalization;
  2. using Turbo.Plugins.Default;
  3. using System.Linq;
  4. using SharpDX.DirectInput;
  5. using System;
  6. using System.Text;
  7. using System.Collections.Generic;
  8.  
  9. namespace Turbo.Plugins.DavUtil
  10. {
  11.     public class DAV_MapPlugin : BasePlugin, IInGameTopPainter {
  12.         public bool showEnglish { get; set; } = true;
  13.         public bool showLocalized { get; set; } = true;
  14.         public IFont WhiteFont { get; set; }
  15.         public List<DAV_Map> MapList { get; set; } = new List<DAV_Map>();
  16.  
  17.         public DAV_MapPlugin() {
  18.             Enabled = true;
  19.         }
  20.  
  21.         public override void Load(IController hud) {
  22.             base.Load(hud);
  23.  
  24.             WhiteFont = Hud.Render.CreateFont("tahoma", 8, 255, 255, 255, 51, true, false, false);
  25.             MapList.Add(new DAV_Map("Halls of Agony", "苦痛刑牢", "a1dun_leor"));
  26.             MapList.Add(new DAV_Map("Ancient Waterway", "遠古水道", "a2dun_aqd"));
  27.             MapList.Add(new DAV_Map("Flooded Cave", "積水的洞穴", "a2dun_cave_flooded"));
  28.             MapList.Add(new DAV_Map("Cave of the Betrayer", "背叛者的洞穴", "a2dun_cave"));
  29.             MapList.Add(new DAV_Map("Tidal Cave", "湧潮洞穴", "px_cave_a"));
  30.             MapList.Add(new DAV_Map("Cave", "洞穴", "trdun_cave")); // Act 1
  31.             MapList.Add(new DAV_Map("Winding Cave", "曲折洞穴", "x1_bogcave"));
  32.             MapList.Add(new DAV_Map("Caverns of Araneae", "艾瑞妮洞窟 (蜘蛛洞)", "a2dun_spider"));
  33.             MapList.Add(new DAV_Map("Sewers of Caldeum", "卡爾蒂姆下水道", "a2dun_swr"));
  34.             MapList.Add(new DAV_Map("Vault of the Assassin", "刺客地庫 (沒有光幕)", "a2dun_zolt_random"));
  35.             MapList.Add(new DAV_Map("Archives of Zultun Kulle", "佐敦庫勒秘庫 (有光幕)", "a2dun_zolt"));
  36.             MapList.Add(new DAV_Map("Hell Rift", "地獄之門 (小地核)", "a4dun_hellportal"));
  37.             MapList.Add(new DAV_Map("Hell Rift", "地獄之門 (小地核)", "a3dun_crater_e_dead_end"));
  38.             MapList.Add(new DAV_Map("Hell Rift", "地獄之門 (小地核)", "a3dun_crater_s_dead_end"));
  39.             MapList.Add(new DAV_Map("Arreat Crater", "亞瑞特巨坑 (大地核)", "a3dun_crater"));
  40.             MapList.Add(new DAV_Map("Caverns of Frost", "寒霜洞窟", "a3dun_icecaves"));
  41.             MapList.Add(new DAV_Map("The Keep Depths", "要塞 (兵營)", "a3dun_keep"));
  42.             MapList.Add(new DAV_Map("The Silver Spire", "銀光尖塔", "a4dun_spire_corrupt"));
  43.             MapList.Add(new DAV_Map("Greyhollow Island", "灰荒島", "p4_forest_coast_border"));
  44.             MapList.Add(new DAV_Map("Eternal Woods", "永恆之林", "p4_forest_snow_border"));
  45.             MapList.Add(new DAV_Map("Temple of the Firstborn", "初民神殿", "p6_church"));
  46.             MapList.Add(new DAV_Map("Shrouded Moors", "迷霧荒原", "p6_moor"));
  47.             MapList.Add(new DAV_Map("Desert", "沙漠", "px_desert_120_border"));
  48.             MapList.Add(new DAV_Map("The Festering Woods", "腐潰之林", "px_festeringwoods"));
  49.             MapList.Add(new DAV_Map("Cathedral", "大教堂", "trdun_cath"));
  50.             MapList.Add(new DAV_Map("Crypt", "墓穴", "trdun_crypt"));
  51.             MapList.Add(new DAV_Map("Plague Tunnels", "瘟疫地道 (老鼠洞)", "x1_abattoir"));
  52.             MapList.Add(new DAV_Map("Ruins of Corvus", "寇佛斯遺跡 (愛德莉亞)", "x1_catacombs"));
  53.             MapList.Add(new DAV_Map("Pandemonium Fortress", "混沌界要塞", "x1_fortress"));
  54.             MapList.Add(new DAV_Map("Battlefields of Eternity", "永恆戰場", "x1_pand_ext_120_edge"));
  55.             MapList.Add(new DAV_Map("Realm of the Banished", "遺逐之境 (懸崖)", "x1_pand_hexmaze"));
  56.             MapList.Add(new DAV_Map("Westmarch Heights", "衛斯馬屈山城區", "x1_westm", "fire"));
  57.             MapList.Add(new DAV_Map("Westmarch Commons", "衛斯馬屈城中區", "x1_westm"));
  58.         }
  59.  
  60.         public void PaintTopInGame(ClipState clipState) {
  61.             if (clipState != ClipState.BeforeClip) return;
  62.             if (Hud.Game.SpecialArea != SpecialArea.GreaterRift) return;
  63.             if (Hud.Game.Me.Scene == null) return;
  64.  
  65.             var curScene = Hud.Game.Me.Scene.SnoScene.Code;
  66.             var curMapName = "Unknown";
  67.             foreach (var map in MapList)
  68.                 if (map.Match(curScene)) {
  69.                     curMapName = map.Name(showLocalized, showEnglish);
  70.                     break;
  71.                 }
  72.  
  73.             var uiMinimapRect = Hud.Render.MinimapUiElement.Rectangle;
  74.             var layout = WhiteFont.GetTextLayout(curMapName);
  75.             WhiteFont.DrawText(layout, uiMinimapRect.Left, uiMinimapRect.Top);
  76.         }
  77.     }
  78.  
  79.     public class DAV_Map {
  80.         public string NameEnglish { get; set; }
  81.         public string NameLocalized { get; set; }
  82.         public string MapAffix { get; set; }
  83.         public string MapAffix2 { get; set; }
  84.  
  85.         public DAV_Map(string name1, string name2, string start, string end = "") {
  86.             NameEnglish = name1;
  87.             NameLocalized = name2;
  88.             MapAffix = start;
  89.             MapAffix2 = end;
  90.         }
  91.  
  92.         public string Name(bool nameLoc, bool nameEng) {
  93.             var name = "";
  94.             if (nameLoc)
  95.                 name += NameLocalized;
  96.             if (nameEng) {
  97.                 if (nameLoc) name += "\n";
  98.                 name += NameEnglish;
  99.             }
  100.  
  101.             return name;
  102.         }
  103.  
  104.         public bool Match(string sceneName) {
  105.             if (!sceneName.StartsWith(MapAffix)) return false;
  106.  
  107.             if (MapAffix2 == "" || sceneName.EndsWith(MapAffix2))
  108.                 return true;
  109.             return false;
  110.         }
  111.     }
  112. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement