Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.65 KB | None | 0 0
  1. Enigma.D3.MapHack/D3/Bootloader/App.cs | 7 +-
  2. Enigma.D3.MapHack/D3/MapHack/CharacterInfo.cs | 282 +++++++++++++++++++++
  3. Enigma.D3.MapHack/D3/MapHack/ControlHelper.cs | 24 +-
  4. .../D3/MapHack/Markers/CharacterMarker.cs | 132 ++++++++++
  5. .../D3/MapHack/Markers/MapMarkerOptions.cs | 5 +-
  6. Enigma.D3.MapHack/D3/MapHack/Shell.xaml | 3 +-
  7. Enigma.D3.MapHack/D3/MapHack/character.xaml | 39 +++
  8. Enigma.D3.MapHack/D3/MapHack/character.xaml.cs | 26 ++
  9. Enigma.D3.MapHack/Enigma.D3.MapHack.csproj | 11 +
  10. 9 files changed, 522 insertions(+), 7 deletions(-)
  11.  
  12. diff --git a/Enigma.D3.MapHack/D3/Bootloader/App.cs b/Enigma.D3.MapHack/D3/Bootloader/App.cs
  13. index 64cfc5a..cf4fba7 100644
  14. --- a/Enigma.D3.MapHack/D3/Bootloader/App.cs
  15. +++ b/Enigma.D3.MapHack/D3/Bootloader/App.cs
  16. @@ -25,12 +25,12 @@ namespace Enigma.D3.Bootloader
  17. {
  18. if (!e.Args.Any(x => x.ToLowerInvariant() == "--no-eula-prompt"))
  19. {
  20. - if (MessageBox.Show("The use of this software breaks Blizzard EULA and may result in your account getting banned. This software may also cause the game client to crash.\r\n\r\n" +
  21. + /*if (MessageBox.Show("The use of this software breaks Blizzard EULA and may result in your account getting banned. This software may also cause the game client to crash.\r\n\r\n" +
  22. "Continue at your own risk.", "Warning", MessageBoxButton.OKCancel, MessageBoxImage.Exclamation) != MessageBoxResult.OK)
  23. {
  24. Shutdown();
  25. return;
  26. - }
  27. + }*/
  28. }
  29.  
  30. MapMarkerOptions.Instance.Load();
  31. @@ -50,6 +50,7 @@ namespace Enigma.D3.Bootloader
  32.  
  33. Shell.Instance.IsAttached = true;
  34. Minimap minimap = null;
  35. + CharacterInfo characterinfo = null;
  36. OverlayWindow overlay = null;
  37. Execute.OnUIThread(() =>
  38. {
  39. @@ -57,8 +58,10 @@ namespace Enigma.D3.Bootloader
  40. overlay = OverlayWindow.Create((ctx.Memory.Reader as ProcessMemoryReader).Process, canvas);
  41. overlay.Show();
  42. minimap = new Minimap(canvas);
  43. + characterinfo = new CharacterInfo(canvas);
  44. });
  45. watcher.AddTask(minimap.Update);
  46. + watcher.AddTask(characterinfo.Update);
  47. watcher.Start();
  48. (ctx.Memory.Reader as ProcessMemoryReader).Process.WaitForExit();
  49. Execute.OnUIThread(() => overlay.Close());
  50. diff --git a/Enigma.D3.MapHack/D3/MapHack/CharacterInfo.cs b/Enigma.D3.MapHack/D3/MapHack/CharacterInfo.cs
  51. new file mode 100644
  52. index 0000000..ef0e9aa
  53. --- /dev/null
  54. +++ b/Enigma.D3.MapHack/D3/MapHack/CharacterInfo.cs
  55. @@ -0,0 +1,282 @@
  56. +using System;
  57. +using System.Collections.Generic;
  58. +using System.Linq;
  59. +using System.Text;
  60. +using System.Windows.Controls;
  61. +using System.Windows.Media;
  62. +using System.Diagnostics;
  63. +using System.Collections.ObjectModel;
  64. +using Enigma.Wpf;
  65. +using System.Windows.Data;
  66. +using System.Windows.Markup;
  67. +using System.Windows;
  68. +using System.Windows.Media.Media3D;
  69. +using Enigma.D3.MapHack.Markers;
  70. +using Enigma.D3.MemoryModel;
  71. +using Enigma.D3.MemoryModel.Core;
  72. +using Enigma.D3.MemoryModel.Caching;
  73. +using Enigma.D3.MemoryModel.Assets;
  74. +using Enigma.D3.Enums;
  75. +using Enigma.D3.AttributeModel;
  76. +namespace Enigma.D3.MapHack
  77. +{
  78. + internal class CharacterInfo : NotifyingObject
  79. + {
  80. + private readonly ObservableCollection<CharacterMarker> _characterInfo;
  81. + private readonly CharacterControl _characterControl;
  82. + private readonly Canvas _window;
  83. + private readonly Canvas _root;
  84. + private int _previousFrame;
  85. + private ACD _playerAcd;
  86. + private ContainerCache<ACD> _acdsObserver;
  87. + private ObjectManager _objectManager;
  88. + private bool _isLocalActorReady;
  89. +
  90. + public static CharacterInfo Instance;
  91. +
  92. + public ObservableCollection<CharacterMarker> CharacterMarkers => _characterInfo;
  93. +
  94. + public MapMarkerOptions Options { get; } = MapMarkerOptions.Instance;
  95. +
  96. + public CharacterInfo(Canvas overlay)
  97. + {
  98. + if (overlay == null)
  99. + throw new ArgumentNullException(nameof(overlay));
  100. +
  101. + _characterInfo = new ObservableCollection<CharacterMarker>();
  102. +
  103. + _root = new Canvas() { Height = (int)(PresentationSource.FromVisual(overlay).CompositionTarget.TransformToDevice.M22 * 1200 + 0.5) };
  104. + _window = overlay;
  105. + _window.Children.Add(_root);
  106. + _window.SizeChanged += (s, e) => UpdateSizeAndPosition();
  107. +
  108. + _root.Children.Add(_characterControl = new CharacterControl { DataContext = this });
  109. + UpdateSizeAndPosition();
  110. + Instance = this;
  111. + CreateMarkers();
  112. + }
  113. + private void UpdateSizeAndPosition()
  114. + {
  115. + var uiScale = _window.ActualHeight / 1200d;
  116. + _root.Width = _window.ActualWidth / uiScale;
  117. + _root.RenderTransform = new ScaleTransform(uiScale, uiScale, 0, 0);
  118. + }
  119. + private void CreateMarkers()
  120. + {
  121. + //add default marker like health and mana here
  122. + //health
  123. + _characterInfo.Add(new CharacterMarker("",
  124. + 40,
  125. + Brushes.White,
  126. + 325,//left
  127. + 1057, //top
  128. + "health"
  129. + ));
  130. + _characterInfo.Add(new CharacterMarker("",
  131. + 20,
  132. + Brushes.White,
  133. + 840,//left
  134. + 70, //top
  135. + "monster%"
  136. + ));
  137. + _characterInfo.Add(new CharacterMarker("",
  138. + 40,
  139. + Brushes.Red,
  140. + 1275,//left
  141. + 1057, //top
  142. + "mana"
  143. + ));
  144. + }
  145. +
  146. +
  147. +
  148. + #region "helpers"
  149. + private ACD GetLocalPlayerACD(MemoryContext ctx)
  150. + {
  151. + return _acdsObserver.Items[(short)ctx.DataSegment.ObjectManager.PlayerDataManager[ctx.DataSegment.ObjectManager.Player.LocalPlayerIndex].ACDID];
  152. + }
  153. +
  154. + private bool IsObjectManagerOnNewFrame(MemoryContext ctx)
  155. + {
  156. + _objectManager = _objectManager ?? ctx.DataSegment.ObjectManager;
  157. +
  158. + // Don't do anything unless game updated frame.
  159. + int currentFrame = _objectManager.RenderTick;
  160. + if (currentFrame == _previousFrame)
  161. + return false;
  162. +
  163. + if (currentFrame < _previousFrame)
  164. + {
  165. + // Lesser frame than before = left game probably.
  166. + Reset();
  167. + return false;
  168. + }
  169. + _previousFrame = currentFrame;
  170. + return true;
  171. + }
  172. +
  173. + private bool IsLocalActorValid(MemoryContext ctx)
  174. + {
  175. + var valid = ctx.DataSegment.ObjectManager.PlayerDataManager[ctx.DataSegment.ObjectManager.Player.LocalPlayerIndex].ActorID != -1;
  176. + if (valid)
  177. + {
  178. + if (!_isLocalActorReady)
  179. + {
  180. + _isLocalActorReady = true;
  181. + }
  182. + return true;
  183. + }
  184. + else
  185. + {
  186. + if (_isLocalActorReady)
  187. + {
  188. + _isLocalActorReady = false;
  189. + }
  190. + return false;
  191. + }
  192. + }
  193. + #endregion
  194. + public void Update(MemoryContext ctx)
  195. + {
  196. + if (ctx == null)
  197. + throw new ArgumentNullException(nameof(ctx));
  198. + ctx.Memory.Reader.ResetCounters();
  199. + try
  200. + {
  201. + if (!IsLocalActorValid(ctx))
  202. + return;
  203. +
  204. + if (!IsObjectManagerOnNewFrame(ctx))
  205. + return;
  206. +
  207. + _acdsObserver = _acdsObserver ?? new ContainerCache<ACD>(ctx.DataSegment.ObjectManager.ACDManager.ActorCommonData);
  208. + _acdsObserver.Update();
  209. +
  210. + // Must have a local ACD to base coords on.
  211. + if (_playerAcd == null || _playerAcd.ActorType != ActorType.Player)
  212. + _playerAcd = GetLocalPlayerACD(ctx);
  213. +
  214. + var ui = _objectManager.UIManager;
  215. + var uimap = ui.PtrControlsMap.Dereference();
  216. +
  217. +
  218. +
  219. + /************Character info ********************/
  220. + /************Character info ********************/
  221. + /************Character info ********************/
  222. + if (Options.ShowManaPool)
  223. + {
  224. +
  225. + var acd = ctx.DataSegment.ObjectManager.ACDManager.ActorCommonData.First(x => x.ActorType == ActorType.Player);
  226. + int mana = 0;
  227. + var attributes = AttributeReader.Instance.GetAttributes(acd.FastAttribGroupID);
  228. + //find a better to search in the dictionnary of attributes
  229. +
  230. +
  231. + foreach (KeyValuePair<AttributeKey, double> attr in attributes)
  232. + {
  233. + if (attr.Key.Id == AttributeId.ResourceCur) mana = (int)System.Math.Floor(attr.Value);
  234. +
  235. + }
  236. +
  237. + //if (_characterInfo.Count() > 0) Execute.OnUIThread(() => _characterInfo.Clear());
  238. +
  239. + //mouse over health %
  240. + var mouseover_acd_id = MemoryContext.Current.DataSegment.ObjectManager.UIManager.TargetACDID;
  241. + if (mouseover_acd_id != -1)
  242. + {
  243. + //var acdm = MemoryContext.Current.DataSegment.ObjectManager.ACDManager.ActorCommonData[(short)mouseover_acd_id];
  244. + var acdm = MemoryContext.Current.DataSegment.ObjectManager.ACDManager.ActorCommonData[(short)mouseover_acd_id];
  245. + double monsterlife = acdm.Hitpoints;
  246. + double fulllife = 0;
  247. + double percent;
  248. + //find a better to search in the dictionnary of attributes
  249. + foreach (KeyValuePair<AttributeKey, double> attr in attributes)
  250. + {
  251. + if (attr.Key.Id == AttributeId.HitpointsMaxTotal)
  252. + fulllife = attr.Value;
  253. + else if (attr.Key.Id == AttributeId.HitpointsCur)
  254. + monsterlife = attr.Value;
  255. +
  256. + }
  257. + if (monsterlife > 0)
  258. + {
  259. + percent = (monsterlife / fulllife) * 100;
  260. + string strpercent = percent.ToString();
  261. + if (strpercent.Contains(".")) strpercent = strpercent.Substring(0, strpercent.IndexOf(".") + 3);
  262. +
  263. + CharacterMarker monstermarker = _characterInfo.FirstOrDefault(a => a.strMarkerName.Equals("monster%"));
  264. + Execute.OnUIThread(() =>
  265. + {
  266. + monstermarker.tblock.Text = strpercent.ToString() + "%";
  267. + monstermarker.SetVisibility(true);
  268. + });
  269. + }
  270. + }
  271. + else
  272. + {
  273. + CharacterMarker monstermarker = _characterInfo.FirstOrDefault(a => a.strMarkerName.Equals("monster%"));
  274. + Execute.OnUIThread(() =>
  275. + {
  276. + monstermarker.SetVisibility(false);
  277. + monstermarker.tblock.Text = "";
  278. + });
  279. + }
  280. +
  281. +
  282. + CharacterMarker mrkhealth = _characterInfo.FirstOrDefault(a => a.strMarkerName.Equals("mana"));
  283. + CharacterMarker mrkmana = _characterInfo.FirstOrDefault(a => a.strMarkerName.Equals("health"));
  284. + Execute.OnUIThread(() =>
  285. + {
  286. +
  287. +
  288. + mrkhealth.tblock.Text = mana.ToString();
  289. +
  290. +
  291. + mrkmana.tblock.Text = ((int)System.Math.Floor(acd.Hitpoints)).ToString();
  292. +
  293. +
  294. + });
  295. + }
  296. + else
  297. + {
  298. + _characterControl.Visibility = System.Windows.Visibility.Hidden;
  299. + }
  300. +
  301. +
  302. +
  303. +
  304. +
  305. + UpdateUI();
  306. + }
  307. + catch (Exception exception)
  308. + {
  309. + OnUpdateException(exception);
  310. + }
  311. +
  312. + //_sw.Stop();
  313. + }
  314. + private void UpdateUI()
  315. + {
  316. + if (_playerAcd != null)
  317. + {
  318. + Execute.OnUIThread(() =>
  319. + {
  320. + foreach (var info in _characterInfo)
  321. + info.Update(_playerAcd.SWorldID, new Point3D(_playerAcd.Position.X, _playerAcd.Position.Y, _playerAcd.Position.Z));
  322. + });
  323. + }
  324. + }
  325. + private void OnUpdateException(Exception exception)
  326. + {
  327. + Trace.WriteLine(exception.Message);
  328. + Reset();
  329. + }
  330. + private void Reset()
  331. + {
  332. + _acdsObserver = null;
  333. + _playerAcd = null;
  334. + _isLocalActorReady = false;
  335. + }
  336. + }
  337. +}
  338. diff --git a/Enigma.D3.MapHack/D3/MapHack/ControlHelper.cs b/Enigma.D3.MapHack/D3/MapHack/ControlHelper.cs
  339. index 9b0d709..7a32ff7 100644
  340. --- a/Enigma.D3.MapHack/D3/MapHack/ControlHelper.cs
  341. +++ b/Enigma.D3.MapHack/D3/MapHack/ControlHelper.cs
  342. @@ -134,11 +134,12 @@ namespace Enigma.D3.MapHack
  343. public static Ellipse CreateCircle(double diameter, Brush fill, Brush stroke = null, double strokeThickness = double.NaN)
  344. {
  345. diameter -= strokeThickness / 2;
  346. -
  347. +
  348. var control = new Ellipse();
  349. control.BeginInit();
  350. -
  351. - control.Width = diameter;
  352. + if (diameter < 0)
  353. + diameter = .5;
  354. + control.Width = diameter;
  355. control.Height = diameter;
  356. control.Stroke = stroke;
  357. control.StrokeThickness = strokeThickness;
  358. @@ -156,6 +157,23 @@ namespace Enigma.D3.MapHack
  359. return control;
  360. }
  361.  
  362. + public static TextBlock CreateTextBlock(string text,int fontsize,Brush color)
  363. + {
  364. + var control = new TextBlock();
  365. + control.BeginInit();
  366. + //control.TextAlignment = TextAlignment.Center;
  367. + control.TextWrapping = TextWrapping.Wrap;
  368. + //control.Width = 200;
  369. + //control.Height = 200;
  370. + control.FontWeight = FontWeights.Bold;
  371. + control.Text = text;
  372. + control.FontSize = fontsize;
  373. + control.Foreground = color;
  374. + control.Opacity = 0.8;
  375. + control.EndInit();
  376. + return control;
  377. + }
  378. +
  379. public static Ellipse CreateEllipse(double width, double height, Brush fill, Brush stroke = null, double strokeThickness = double.NaN)
  380. {
  381. var control = new Ellipse();
  382. diff --git a/Enigma.D3.MapHack/D3/MapHack/Markers/CharacterMarker.cs b/Enigma.D3.MapHack/D3/MapHack/Markers/CharacterMarker.cs
  383. new file mode 100644
  384. index 0000000..797dee4
  385. --- /dev/null
  386. +++ b/Enigma.D3.MapHack/D3/MapHack/Markers/CharacterMarker.cs
  387. @@ -0,0 +1,132 @@
  388. +using Enigma.D3.AttributeModel;
  389. +using Enigma.D3.Enums;
  390. +using Enigma.D3.MemoryModel.Core;
  391. +using Enigma.Memory;
  392. +using System;
  393. +using System.Collections.Generic;
  394. +using System.Linq;
  395. +using System.Text;
  396. +using System.Threading.Tasks;
  397. +using System.Windows;
  398. +using System.Windows.Controls;
  399. +using System.Windows.Media;
  400. +using System.Windows.Media.Imaging;
  401. +using System.Windows.Media.Media3D;
  402. +
  403. +namespace Enigma.D3.MapHack.Markers
  404. +{
  405. + public class CharacterMarker : MapMarkerBase
  406. + {
  407. + private bool _isVisibleInCharacter;
  408. + private string _text;
  409. + private Brush _brush;
  410. + private int _left, _top, _fontsize;
  411. + public TextBlock tblock;
  412. + public string strMarkerName;
  413. +
  414. +
  415. + public CharacterMarker(string text, int fontsize, Brush brush, int left, int top, string info)
  416. + : base(1)
  417. + {
  418. +
  419. + _text = text;
  420. + _brush = brush;
  421. + _left = left;
  422. + _top = top;
  423. + _fontsize = fontsize;
  424. +
  425. + _isVisibleInCharacter = true;
  426. + IsVisible = false;
  427. + strMarkerName = info;
  428. + }
  429. +
  430. + public bool IsVisibleInCharacter
  431. + {
  432. + get
  433. + {
  434. + return _isVisibleInCharacter;
  435. + }
  436. + set
  437. + {
  438. + if (_isVisibleInCharacter != value)
  439. + {
  440. + _isVisibleInCharacter = value;
  441. + Refresh(nameof(IsVisibleInCharacter));
  442. + }
  443. + }
  444. + }
  445. +
  446. + public void SetVisibility(bool visibility)
  447. + {
  448. + if (visibility)
  449. + tblock.Visibility = Visibility.Visible;
  450. + else
  451. + tblock.Visibility = Visibility.Hidden;
  452. + }
  453. +
  454. + public override object CreateControl()
  455. + {
  456. + //var panel = new StackPanel();
  457. + tblock = ControlHelper.CreateTextBlock(_text, _fontsize, _brush);
  458. +
  459. + //tblock.Visibility = Visibility.Visible;
  460. + //panel.Children.Add(tblock);
  461. +
  462. + X = _left;
  463. + Y = _top;
  464. + return tblock;
  465. +
  466. + }
  467. +
  468. + public override void Update(int worldId, Point3D origo)
  469. + {
  470. +
  471. + if (MapMarkerOptions.Instance.ShowManaPool == false)
  472. + {
  473. + IsVisible = false;
  474. + IsVisibleInCharacter = false;
  475. +
  476. + return;
  477. + }
  478. + tblock.Visibility = Visibility.Visible;
  479. +
  480. + //TextBlock tblock = (TextBlock)this.Control;
  481. +
  482. +
  483. +
  484. + //tblock.Text = _text;
  485. + //_isVisibleInCharacter = true;
  486. +
  487. + //elli.Visibility = 0;
  488. + X = _left;// 270;
  489. + Y = _top;// 628;
  490. + IsVisible = true;
  491. +
  492. + }
  493. +
  494. + class CharacterVisual : UIElement
  495. + {
  496. + private readonly Assets.Scene.NavCell[] _cells;
  497. + private readonly double _width;
  498. + private readonly double _height;
  499. +
  500. + public CharacterVisual(double width, double height, Assets.Scene.NavCell[] cells)
  501. + {
  502. + _width = width;
  503. + _height = height;
  504. + _cells = cells;
  505. + }
  506. +
  507. + protected override void OnRender(DrawingContext drawingContext)
  508. + {
  509. + base.OnRender(drawingContext);
  510. +
  511. + var dc = drawingContext;
  512. +
  513. + }
  514. +
  515. +
  516. +
  517. + }
  518. + }
  519. +}
  520. diff --git a/Enigma.D3.MapHack/D3/MapHack/Markers/MapMarkerOptions.cs b/Enigma.D3.MapHack/D3/MapHack/Markers/MapMarkerOptions.cs
  521. index efa9317..598043c 100644
  522. --- a/Enigma.D3.MapHack/D3/MapHack/Markers/MapMarkerOptions.cs
  523. +++ b/Enigma.D3.MapHack/D3/MapHack/Markers/MapMarkerOptions.cs
  524. @@ -32,6 +32,7 @@ namespace Enigma.D3.MapHack.Markers
  525. private bool _showDeathBreaths = true;
  526. private bool _showPoolsOfReflection = true;
  527. private bool _showAncientRank = true;
  528. + private bool _showManaPool = true;
  529. private bool _isInitialized = true;
  530.  
  531. public event PropertyChangedEventHandler PropertyChanged = delegate { };
  532. @@ -62,7 +63,9 @@ namespace Enigma.D3.MapHack.Markers
  533. public bool ShowPoolsOfReflection { get { return _showPoolsOfReflection; } set { if (_showPoolsOfReflection != value) { _showPoolsOfReflection = value; Refresh(nameof(ShowPoolsOfReflection)); } } }
  534. [DataMember]
  535. public bool ShowAncientRank { get { return _showAncientRank; } set { if (_showAncientRank != value) { _showAncientRank = value; Refresh(nameof(ShowAncientRank)); } } }
  536. -
  537. + [DataMember]
  538. + public bool ShowManaPool { get { return _showManaPool; } set { if (_showManaPool != value) { _showManaPool = value; Refresh(nameof(ShowManaPool)); } } }
  539. +
  540. private void Refresh(string propertyName)
  541. {
  542. if (_isInitialized == false) // This variable is false if instance was created through serializer.
  543. diff --git a/Enigma.D3.MapHack/D3/MapHack/Shell.xaml b/Enigma.D3.MapHack/D3/MapHack/Shell.xaml
  544. index 2101ead..c125724 100644
  545. --- a/Enigma.D3.MapHack/D3/MapHack/Shell.xaml
  546. +++ b/Enigma.D3.MapHack/D3/MapHack/Shell.xaml
  547. @@ -1,7 +1,7 @@
  548. <Window x:Class="Enigma.D3.MapHack.Shell"
  549. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  550. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  551. - Title="Enigma.D3.MapHack" Width="300" SizeToContent="WidthAndHeight" SnapsToDevicePixels="True" WindowStartupLocation="CenterScreen" ResizeMode="CanMinimize" Icon="/Enigma.D3.MapHack;component/enigma_icon.ico">
  552. + Title="Enigma.D3.MapHack" Width="300" SizeToContent="WidthAndHeight" SnapsToDevicePixels="True" WindowStartupLocation="CenterScreen" ResizeMode="CanMinimize" Icon="/Enigma.D3.MapHack;component/enigma_icon.ico" Height="475">
  553. <TabControl>
  554. <TabItem Header="App">
  555. <StackPanel Background="WhiteSmoke" Width="300">
  556. @@ -51,6 +51,7 @@
  557. </DockPanel>
  558. <Separator />
  559. <CheckBox Content="Show Ancient Rank" IsChecked="{Binding Options.ShowAncientRank}" Margin="10,5" />
  560. + <CheckBox Content="Show Mana Pool" IsChecked="{Binding Options.ShowManaPool}" Margin="10,5" />
  561. </StackPanel>
  562. </TabItem>
  563. <TabItem Header="Log">
  564. diff --git a/Enigma.D3.MapHack/D3/MapHack/character.xaml b/Enigma.D3.MapHack/D3/MapHack/character.xaml
  565. new file mode 100644
  566. index 0000000..1dd4c97
  567. --- /dev/null
  568. +++ b/Enigma.D3.MapHack/D3/MapHack/character.xaml
  569. @@ -0,0 +1,39 @@
  570. +<UserControl x:Class="Enigma.D3.MapHack.CharacterControl"
  571. + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  572. + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  573. + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  574. + xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  575. + xmlns:local="clr-namespace:Enigma.D3.MapHack"
  576. + mc:Ignorable="d"
  577. + d:DesignHeight="1080" d:DesignWidth="1920" Width="1920" Height="1080" Canvas.Right="0">
  578. + <UserControl.Resources>
  579. + <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
  580. + </UserControl.Resources>
  581. + <Grid Visibility="Visible">
  582. + <ItemsControl ItemsSource="{Binding CharacterMarkers}">
  583. + <ItemsControl.ItemsPanel>
  584. + <ItemsPanelTemplate>
  585. + <Canvas />
  586. + </ItemsPanelTemplate>
  587. + </ItemsControl.ItemsPanel>
  588. + <ItemsControl.ItemContainerStyle>
  589. + <Style TargetType="{x:Type ContentPresenter}">
  590. + <Setter Property="Canvas.Left" Value="{Binding X}" />
  591. + <Setter Property="Canvas.Top" Value="{Binding Y}" />
  592. + <Setter Property="Canvas.ZIndex" Value="{Binding ZIndex, Mode=OneTime}" />
  593. + <Setter Property="Visibility" Value="{Binding IsVisibleInCharacter, Converter={StaticResource BooleanToVisibilityConverter}}" />
  594. + <!--<Setter Property="CacheMode">
  595. + <Setter.Value>
  596. + <BitmapCache RenderOptions.BitmapScalingMode="HighQuality" />
  597. + </Setter.Value>
  598. + </Setter>-->
  599. + </Style>
  600. + </ItemsControl.ItemContainerStyle>
  601. + <ItemsControl.ItemTemplate>
  602. + <DataTemplate>
  603. + <ContentPresenter Content="{Binding Control}" />
  604. + </DataTemplate>
  605. + </ItemsControl.ItemTemplate>
  606. + </ItemsControl>
  607. + </Grid>
  608. +</UserControl>
  609. diff --git a/Enigma.D3.MapHack/D3/MapHack/character.xaml.cs b/Enigma.D3.MapHack/D3/MapHack/character.xaml.cs
  610. new file mode 100644
  611. index 0000000..969c880
  612. --- /dev/null
  613. +++ b/Enigma.D3.MapHack/D3/MapHack/character.xaml.cs
  614. @@ -0,0 +1,26 @@
  615. +using System;
  616. +using System.Collections.Generic;
  617. +using System.Linq;
  618. +using System.Text;
  619. +using System.Threading.Tasks;
  620. +using System.Windows;
  621. +using System.Windows.Controls;
  622. +using System.Windows.Data;
  623. +using System.Windows.Documents;
  624. +using System.Windows.Input;
  625. +using System.Windows.Media;
  626. +using System.Windows.Media.Imaging;
  627. +using System.Windows.Navigation;
  628. +using System.Windows.Shapes;
  629. +
  630. +namespace Enigma.D3.MapHack
  631. +{
  632. + public partial class CharacterControl : UserControl
  633. + {
  634. + public CharacterControl()
  635. + {
  636. + InitializeComponent();
  637. + }
  638. +
  639. + }
  640. +}
  641. diff --git a/Enigma.D3.MapHack/Enigma.D3.MapHack.csproj b/Enigma.D3.MapHack/Enigma.D3.MapHack.csproj
  642. index c50f051..58ccbf9 100644
  643. --- a/Enigma.D3.MapHack/Enigma.D3.MapHack.csproj
  644. +++ b/Enigma.D3.MapHack/Enigma.D3.MapHack.csproj
  645. @@ -63,7 +63,9 @@
  646. <ItemGroup>
  647. <Reference Include="System" />
  648. <Reference Include="System.Data" />
  649. + <Reference Include="System.Drawing" />
  650. <Reference Include="System.Runtime.Serialization" />
  651. + <Reference Include="System.Windows.Forms" />
  652. <Reference Include="System.Xml" />
  653. <Reference Include="Microsoft.CSharp" />
  654. <Reference Include="System.Core" />
  655. @@ -78,6 +80,11 @@
  656. </ItemGroup>
  657. <ItemGroup>
  658. <Compile Include="D3\Bootloader\App.cs" />
  659. + <Compile Include="D3\MapHack\character.xaml.cs">
  660. + <DependentUpon>character.xaml</DependentUpon>
  661. + </Compile>
  662. + <Compile Include="D3\MapHack\CharacterInfo.cs" />
  663. + <Compile Include="D3\MapHack\Markers\CharacterMarker.cs" />
  664. <Compile Include="D3\MapHack\Stash.xaml.cs">
  665. <DependentUpon>Stash.xaml</DependentUpon>
  666. </Compile>
  667. @@ -137,6 +144,10 @@
  668. <AppDesigner Include="Properties\" />
  669. </ItemGroup>
  670. <ItemGroup>
  671. + <Page Include="D3\MapHack\character.xaml">
  672. + <Generator>MSBuild:Compile</Generator>
  673. + <SubType>Designer</SubType>
  674. + </Page>
  675. <Page Include="D3\MapHack\Stash.xaml">
  676. <Generator>MSBuild:Compile</Generator>
  677. <SubType>Designer</SubType>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement