diff --git a/Deeps/Deeps.h b/Deeps/Deeps.h
index 4d981f7..e120b88 100644
--- a/Deeps/Deeps.h
+++ b/Deeps/Deeps.h
@@ -1,220 +1,222 @@
-/**
-* Copyright (c) 2011-2014 - Ashita Development Team
-*
-* Ashita is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* Ashita is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with Ashita. If not, see .
-*/
-
-#ifndef __ASHITA_Deeps_H_INCLUDED__
-#define __ASHITA_Deeps_H_INCLUDED__
-
-#if defined (_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once
-#endif
-
-enum REACTION
-{
- REACTION_NONE = 0x00,
- REACTION_MISS = 0x01,
- REACTION_PARRY = 0x03,
- REACTION_BLOCK = 0x04,
- REACTION_HIT = 0x08,
- REACTION_EVADE = 0x09,
- REACTION_HIT2 = 0x10,
- REACTION_GUARD = 0x14
-};
-
-enum SPECEFFECT
-{
- SPECEFFECT_NONE = 0x00,
- SPECEFFECT_BLOOD = 0x02,
- SPECEFFECT_HIT = 0x10,
- SPECEFFECT_RAISE = 0x11,
- SPECEFFECT_RECOIL = 0x20,
- SPECEFFECT_CRITICAL_HIT = 0x22
-};
-
-/**
- * @brief Required includes for an extension.
- */
-#include "C:\Ashita 3\plugins\ADK\Ashita.h"
-#include
-#include
-#include
-
-struct damage_t
-{
- uint64_t total;
- uint32_t max;
- uint32_t min;
- uint32_t count;
-
- damage_t()
- {
- total = 0;
- max = 0;
- min = 0;
- count = 0;
- }
- bool operator > (const damage_t& o) const
- {
- return (count > o.count);
- }
- uint32_t avg()
- {
- return count > 0 ? (total / count) : 0;
- }
-};
-
-struct source_t
-{
- std::string name;
- std::map damage;
-
- source_t()
- {
-
- }
-
- uint64_t total() const
- {
- uint64_t tot = 0;
- for (auto d : damage)
- {
- tot += d.second.total;
- }
- return tot;
- }
-
- bool operator > (const source_t& o) const
- {
- return (total() > o.total());
- }
-};
-
-struct entitysources_t
-{
- std::string name;
- uint32_t color;
- std::map sources;
-
- uint64_t total() const
- {
- int64_t total = 0;
- for (auto s : sources)
- {
- total += s.second.total();
- }
- return total;
- }
- bool operator == (const entitysources_t& o) const
- {
- return (total() == o.total());
- }
-
- bool operator > (const entitysources_t& o) const
- {
- return (total() > o.total());
- }
-};
-
-std::map entities;
-std::map clickMap;
-
-static const std::vector hitMessages = { 1, 2, 77, 132, 157, 161, 163, 185, 187, 197, 227, 264, 281, 317, 352, 413, 522, 576, 577 };
-static const std::vector critMessages = { 67, 252, 265, 274, 353, 379 };
-static const std::vector missMessages = { 15, 85, 158, 188, 245, 284, 324, 354 };
-static const std::vector evadeMessages = { 14, 30, 31, 32, 33, 189, 248, 282, 283, 323, 355 };
-static const std::vector parryMessages = { 69, 70 };
-
-static const std::vector Colors = { D3DCOLOR_ARGB(255, 12, 0, 155), D3DCOLOR_ARGB(255, 140, 0, 0), D3DCOLOR_ARGB(255, 255, 177, 32), D3DCOLOR_ARGB(255, 143, 143, 143),
- D3DCOLOR_ARGB(255, 68, 68, 68), D3DCOLOR_ARGB(255, 255, 0, 0), D3DCOLOR_ARGB(255, 0, 164, 49), D3DCOLOR_ARGB(255, 198, 198, 0),
- D3DCOLOR_ARGB(255, 116, 0, 145), D3DCOLOR_ARGB(255, 165, 153, 10), D3DCOLOR_ARGB(255, 184, 128, 10), D3DCOLOR_ARGB(255, 224, 0, 230),
- D3DCOLOR_ARGB(255, 234, 100, 0), D3DCOLOR_ARGB(255, 119, 0, 0), D3DCOLOR_ARGB(255, 130, 17, 255), D3DCOLOR_ARGB(255, 79, 196, 0),
- D3DCOLOR_ARGB(255, 0, 16, 217), D3DCOLOR_ARGB(255, 136, 68, 0), D3DCOLOR_ARGB(255, 244, 98, 0), D3DCOLOR_ARGB(255, 15, 190, 220),
- D3DCOLOR_ARGB(255, 0, 123, 145) };
-
-void g_onClick(int, void*, float, float);
-
-/**
- * @brief Global copy of our plugin data.
- */
-plugininfo_t* g_PluginInfo = NULL;
-
-/**
- * @brief Our Main Plugin Class
- *
- * @note The main class of your plugin MUST use PluginBase as a base class. This is the
- * internal base class that Ashita uses to communicate with your plugin!
- */
-class Deeps : IPlugin
-{
- /**
- * @brief Internal class variables.
- */
- IAshitaCore* m_AshitaCore;
- ILogManager* m_LogManager;
- DWORD m_PluginId;
- IDirect3DDevice8* m_Direct3DDevice;
-
-private:
- source_t* getDamageSource(entitysources_t* entityInfo, uint8_t actionType, uint16_t actionID);
- bool updateDamageSource(source_t* source, uint16_t message, uint32_t damage);
- void repairBars(IFontObject* deepsBase, uint8_t size);
- void report(char mode, int max);
- uint16_t getIndex(std::function);
- uint32_t m_charInfo;
- std::string m_sourceInfo;
- uint8_t m_bars;
- bool m_debug;
-
-public:
- /**
- * @brief Constructor and deconstructor.
- */
- Deeps(void);
- virtual ~Deeps(void);
-
- /**
- * @brief GetPluginData implementation.
- */
- plugininfo_t GetPluginInfo(void);
-
- /**
- * @brief PluginBase virtual overrides.
- */
- bool Initialize(IAshitaCore* core, ILogManager* log, uint32_t id);
- void Release(void);
- bool HandleCommand(const char* command, int32_t type);
- bool HandleIncomingText(int16_t mode, const char* message, int16_t* modifiedMode, char* modifiedMessage, bool blocked);
- bool HandleIncomingPacket(uint16_t id, uint32_t size, void* data, void* modified, bool blocked);
- bool HandleOutgoingPacket(uint16_t id, uint32_t size, void* data, void* modified, bool blocked);
- bool Direct3DInitialize(IDirect3DDevice8* device);
- void Direct3DRelease(void);
- void Direct3DPreRender(void);
- void Direct3DRender(void);
- void onClick(int, IFontObject*, float, float);
-};
-
-// Global pointer to this
-
-Deeps* g_Deeps = NULL;
-
-/**
- * @brief Required Plugin Exports
- */
-__declspec(dllexport) double __stdcall GetInterfaceVersion(void);
-__declspec(dllexport) void __stdcall CreatePluginInfo(plugininfo_t* lpBuffer);
-__declspec(dllexport) IPlugin* __stdcall CreatePlugin(void);
-
-#endif // __ASHITA_Deeps_H_INCLUDED__
+/**
+* Copyright (c) 2011-2014 - Ashita Development Team
+*
+* Ashita is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* Ashita is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with Ashita. If not, see .
+*/
+
+#ifndef __ASHITA_Deeps_H_INCLUDED__
+#define __ASHITA_Deeps_H_INCLUDED__
+
+#if defined (_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once
+#endif
+
+enum REACTION
+{
+ REACTION_NONE = 0x00,
+ REACTION_MISS = 0x01,
+ REACTION_PARRY = 0x03,
+ REACTION_BLOCK = 0x04,
+ REACTION_HIT = 0x08,
+ REACTION_EVADE = 0x09,
+ REACTION_HIT2 = 0x10,
+ REACTION_GUARD = 0x14
+};
+
+enum SPECEFFECT
+{
+ SPECEFFECT_NONE = 0x00,
+ SPECEFFECT_BLOOD = 0x02,
+ SPECEFFECT_HIT = 0x10,
+ SPECEFFECT_RAISE = 0x11,
+ SPECEFFECT_RECOIL = 0x20,
+ SPECEFFECT_CRITICAL_HIT = 0x22
+};
+
+/**
+ * @brief Required includes for an extension.
+ */
+#include "C:\Ashita 3\plugins\ADK\Ashita.h"
+#include
+#include
+#include
+#include
+
+struct damage_t
+{
+ uint64_t total;
+ uint32_t max;
+ uint32_t min;
+ uint32_t count;
+
+ damage_t()
+ {
+ total = 0;
+ max = 0;
+ min = 0;
+ count = 0;
+ }
+ bool operator > (const damage_t& o) const
+ {
+ return (count > o.count);
+ }
+ uint32_t avg()
+ {
+ return count > 0 ? (total / count) : 0;
+ }
+};
+
+struct source_t
+{
+ std::string name;
+ std::map damage;
+
+ source_t()
+ {
+
+ }
+
+ uint64_t total() const
+ {
+ uint64_t tot = 0;
+ for (auto d : damage)
+ {
+ tot += d.second.total;
+ }
+ return tot;
+ }
+
+ bool operator > (const source_t& o) const
+ {
+ return (total() > o.total());
+ }
+};
+
+struct entitysources_t
+{
+ std::string name;
+ uint32_t color;
+ std::map sources;
+
+ uint64_t total() const
+ {
+ int64_t total = 0;
+ for (auto s : sources)
+ {
+ total += s.second.total();
+ }
+ return total;
+ }
+ bool operator == (const entitysources_t& o) const
+ {
+ return (total() == o.total());
+ }
+
+ bool operator > (const entitysources_t& o) const
+ {
+ return (total() > o.total());
+ }
+};
+
+std::map entities;
+std::map clickMap;
+
+static const std::vector hitMessages = { 1, 2, 77, 132, 157, 161, 163, 185, 187, 197, 227, 264, 281, 317, 352, 413, 522, 576, 577 };
+static const std::vector critMessages = { 67, 252, 265, 274, 353, 379 };
+static const std::vector missMessages = { 15, 85, 158, 188, 245, 284, 324, 354 };
+static const std::vector evadeMessages = { 14, 30, 31, 32, 33, 189, 248, 282, 283, 323, 355 };
+static const std::vector parryMessages = { 69, 70 };
+
+static const std::vector Colors = { D3DCOLOR_ARGB(255, 12, 0, 155), D3DCOLOR_ARGB(255, 140, 0, 0), D3DCOLOR_ARGB(255, 255, 177, 32), D3DCOLOR_ARGB(255, 143, 143, 143),
+ D3DCOLOR_ARGB(255, 68, 68, 68), D3DCOLOR_ARGB(255, 255, 0, 0), D3DCOLOR_ARGB(255, 0, 164, 49), D3DCOLOR_ARGB(255, 198, 198, 0),
+ D3DCOLOR_ARGB(255, 116, 0, 145), D3DCOLOR_ARGB(255, 165, 153, 10), D3DCOLOR_ARGB(255, 184, 128, 10), D3DCOLOR_ARGB(255, 224, 0, 230),
+ D3DCOLOR_ARGB(255, 234, 100, 0), D3DCOLOR_ARGB(255, 119, 0, 0), D3DCOLOR_ARGB(255, 130, 17, 255), D3DCOLOR_ARGB(255, 79, 196, 0),
+ D3DCOLOR_ARGB(255, 0, 16, 217), D3DCOLOR_ARGB(255, 136, 68, 0), D3DCOLOR_ARGB(255, 244, 98, 0), D3DCOLOR_ARGB(255, 15, 190, 220),
+ D3DCOLOR_ARGB(255, 0, 123, 145) };
+
+void g_onClick(int, void*, float, float);
+
+/**
+ * @brief Global copy of our plugin data.
+ */
+plugininfo_t* g_PluginInfo = NULL;
+
+/**
+ * @brief Our Main Plugin Class
+ *
+ * @note The main class of your plugin MUST use PluginBase as a base class. This is the
+ * internal base class that Ashita uses to communicate with your plugin!
+ */
+class Deeps : IPlugin
+{
+ /**
+ * @brief Internal class variables.
+ */
+ IAshitaCore* m_AshitaCore;
+ ILogManager* m_LogManager;
+ DWORD m_PluginId;
+ IDirect3DDevice8* m_Direct3DDevice;
+ std::list m_Packets;
+
+private:
+ source_t* getDamageSource(entitysources_t* entityInfo, uint8_t actionType, uint16_t actionID);
+ bool updateDamageSource(source_t* source, uint16_t message, uint32_t damage);
+ void repairBars(IFontObject* deepsBase, uint8_t size);
+ void report(char mode, int max);
+ uint16_t getIndex(std::function);
+ uint32_t m_charInfo;
+ std::string m_sourceInfo;
+ uint8_t m_bars;
+ bool m_debug;
+
+public:
+ /**
+ * @brief Constructor and deconstructor.
+ */
+ Deeps(void);
+ virtual ~Deeps(void);
+
+ /**
+ * @brief GetPluginData implementation.
+ */
+ plugininfo_t GetPluginInfo(void);
+
+ /**
+ * @brief PluginBase virtual overrides.
+ */
+ bool Initialize(IAshitaCore* core, ILogManager* log, uint32_t id);
+ void Release(void);
+ bool HandleCommand(const char* command, int32_t type);
+ bool HandleIncomingText(int16_t mode, const char* message, int16_t* modifiedMode, char* modifiedMessage, bool blocked);
+ bool HandleIncomingPacket(uint16_t id, uint32_t size, void* data, void* modified, bool blocked);
+ bool HandleOutgoingPacket(uint16_t id, uint32_t size, void* data, void* modified, bool blocked);
+ bool Direct3DInitialize(IDirect3DDevice8* device);
+ void Direct3DRelease(void);
+ void Direct3DPreRender(void);
+ void Direct3DRender(void);
+ void onClick(int, IFontObject*, float, float);
+};
+
+// Global pointer to this
+
+Deeps* g_Deeps = NULL;
+
+/**
+ * @brief Required Plugin Exports
+ */
+__declspec(dllexport) double __stdcall GetInterfaceVersion(void);
+__declspec(dllexport) void __stdcall CreatePluginInfo(plugininfo_t* lpBuffer);
+__declspec(dllexport) IPlugin* __stdcall CreatePlugin(void);
+
+#endif // __ASHITA_Deeps_H_INCLUDED__
diff --git a/Deeps/Deeps.vcxproj b/Deeps/Deeps.vcxproj
index 03ecc57..f67dc40 100644
--- a/Deeps/Deeps.vcxproj
+++ b/Deeps/Deeps.vcxproj
@@ -1,169 +1,176 @@
-
-
-
-
- Debug
- Win32
-
-
- Release
- Win32
-
-
- Debug
- x64
-
-
- Release
- x64
-
-
-
- {012F77AE-D2F5-4F5B-A531-DA4FF57494DA}
- Win32Proj
- Deeps
- 8.1
-
-
-
- DynamicLibrary
- true
- v140
- Unicode
-
-
- DynamicLibrary
- false
- v140_xp
- true
- MultiByte
-
-
- DynamicLibrary
- true
- v140
- Unicode
-
-
- DynamicLibrary
- false
- v140
- true
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- true
-
-
- true
-
-
- false
- ..\..\..\..\..\..\..\..\Ashita 3\plugins
-
-
- false
-
-
-
-
-
- Level3
- Disabled
- WIN32;_DEBUG;_WINDOWS;_USRDLL;DEEPS_EXPORTS;%(PreprocessorDefinitions)
- true
-
-
- Windows
- true
- Exports.def
-
-
-
-
-
-
- Level3
- Disabled
- _DEBUG;_WINDOWS;_USRDLL;DEEPS_EXPORTS;%(PreprocessorDefinitions)
- true
-
-
- Windows
- true
- Exports.def
-
-
-
-
- Level3
-
-
- Full
- false
- true
- WIN32;NDEBUG;_WINDOWS;_USRDLL;DEEPS_EXPORTS;%(PreprocessorDefinitions)
- true
- true
- true
- Async
-
-
- Windows
- true
- true
- true
- Exports.def
-
-
-
-
- Level3
-
-
- MaxSpeed
- true
- true
- NDEBUG;_WINDOWS;_USRDLL;DEEPS_EXPORTS;%(PreprocessorDefinitions)
- true
-
-
- Windows
- true
- true
- true
- Exports.def
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ {012F77AE-D2F5-4F5B-A531-DA4FF57494DA}
+ Win32Proj
+ Deeps
+ 8.1
+
+
+
+ DynamicLibrary
+ true
+ v140
+ Unicode
+
+
+ DynamicLibrary
+ false
+ v140_xp
+ true
+ MultiByte
+
+
+ DynamicLibrary
+ true
+ v140
+ Unicode
+
+
+ DynamicLibrary
+ false
+ v140
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+ true
+
+
+ false
+ ..\..\bin\
+
+
+ false
+ ..\..\bin\
+
+
+
+
+
+ Level3
+ Disabled
+ WIN32;_DEBUG;_WINDOWS;_USRDLL;DEEPS_EXPORTS;%(PreprocessorDefinitions)
+ true
+
+
+ Windows
+ true
+ Exports.def
+
+
+
+
+
+
+ Level3
+ Disabled
+ _DEBUG;_WINDOWS;_USRDLL;DEEPS_EXPORTS;%(PreprocessorDefinitions)
+ true
+
+
+ Windows
+ true
+ Exports.def
+
+
+
+
+ Level3
+
+
+ Full
+ false
+ true
+ WIN32;NDEBUG;_WINDOWS;_USRDLL;DEEPS_EXPORTS;%(PreprocessorDefinitions)
+ true
+ true
+ true
+ Async
+
+
+ Windows
+ true
+ true
+ true
+ Exports.def
+
+
+ copy "..\..\bin\Deeps.dll" "C:\Ashita 3\plugins\Deeps.dll"
+
+
+
+
+ Level3
+
+
+ MaxSpeed
+ true
+ true
+ NDEBUG;_WINDOWS;_USRDLL;DEEPS_EXPORTS;%(PreprocessorDefinitions)
+ true
+
+
+ Windows
+ true
+ true
+ true
+ Exports.def
+
+
+ copy "..\..\bin\Deeps.dll" "C:\Ashita 3\plugins\Deeps.dll"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Deeps/Deeps.vcxproj.filters b/Deeps/Deeps.vcxproj.filters
index 6e1c279..96b133a 100644
--- a/Deeps/Deeps.vcxproj.filters
+++ b/Deeps/Deeps.vcxproj.filters
@@ -1,35 +1,35 @@
-
-
-
-
- {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hh;hpp;hxx;hm;inl;inc;xsd
-
-
- {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
- rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
-
-
-
-
- Header Files
-
-
- Header Files
-
-
-
-
- Source Files
-
-
-
-
- Source Files
-
-
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;hm;inl;inc;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+
+
+ Header Files
+
+
+ Header Files
+
+
+
+
+ Source Files
+
+
+
+
+ Source Files
+
+
\ No newline at end of file
diff --git a/Deeps/Exports.def b/Deeps/Exports.def
index 9c60f62..2e0de98 100644
--- a/Deeps/Exports.def
+++ b/Deeps/Exports.def
@@ -1,5 +1,5 @@
-LIBRARY "Deeps"
-EXPORTS
- GetInterfaceVersion
- CreatePluginInfo
+LIBRARY "Deeps"
+EXPORTS
+ GetInterfaceVersion
+ CreatePluginInfo
CreatePlugin
\ No newline at end of file
diff --git a/Deeps/main.cpp b/Deeps/main.cpp
index 5791f0d..d57d993 100644
--- a/Deeps/main.cpp
+++ b/Deeps/main.cpp
@@ -1,824 +1,847 @@
-/**
-* Copyright (c) 2011-2014 - Ashita Development Team
-*
-* Ashita is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* Ashita is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with Ashita. If not, see .
-*/
-
-#include "Deeps.h"
-#include "DSP-Utils.h"
-
-#include
-#include
-
-source_t* Deeps::getDamageSource(entitysources_t* entityInfo, uint8_t actionType, uint16_t actionID)
-{
- uint32_t key = (actionID << 8) + actionType;
- auto sourcesIt = entityInfo->sources.find(key);
-
- source_t* source;
-
- if (sourcesIt != entityInfo->sources.end())
- {
- source = &sourcesIt->second;
- }
- else
- {
- source_t newsource;
-
- sourcesIt = entityInfo->sources.insert(std::make_pair(key, newsource)).first;
-
- source = &sourcesIt->second;
- if (actionType == 1) { source->name.append("Attack"); }
- else if (actionType == 2) { source->name.append("Ranged Attack"); }
- else if (actionType == 3 || actionType == 11){ source->name.append(m_AshitaCore->GetResourceManager()->GetAbilityById(actionID)->Name[2]); }
- else if (actionType == 4) { source->name.append(m_AshitaCore->GetResourceManager()->GetSpellById(actionID)->Name[2]); }
- else if (actionType == 6 || actionType == 14 || actionType == 15) { source->name.append(m_AshitaCore->GetResourceManager()->GetAbilityById(actionID + 512)->Name[2]); }
-
- }
- return source;
-}
-
-bool Deeps::updateDamageSource(source_t* source, uint16_t message, uint32_t damage)
-{
- damage_t* type = NULL;
- bool val = false;
- if (std::find(hitMessages.begin(), hitMessages.end(), message) != hitMessages.end())
- {
- type = &source->damage["Hit"];
- val = true;
- }
- else if (std::find(critMessages.begin(), critMessages.end(), message) != critMessages.end())
- {
- type = &source->damage["Crit"];
- val = true;
- }
- else if (std::find(missMessages.begin(), missMessages.end(), message) != missMessages.end())
- {
- type = &source->damage["Miss"];
- }
- else if (std::find(evadeMessages.begin(), evadeMessages.end(), message) != evadeMessages.end())
- {
- type = &source->damage["Evade"];
- }
- else if (std::find(parryMessages.begin(), parryMessages.end(), message) != parryMessages.end())
- {
- type = &source->damage["Parry"];
- }
- if (type)
- {
- damage = val ? damage : 0;
- type->total += damage;
- type->count++;
- type->min = (damage < type->min ? damage : type->min);
- type->max = (damage > type->max ? damage : type->max);
- return true;
- }
- return false;
-}
-
-uint16_t Deeps::getIndex(std::function func)
-{
- for (int i = 0; i < 2048; i++)
- {
- if (func(m_AshitaCore->GetDataManager()->GetEntity(), i))
- {
- return i;
- }
- }
- return 0;
-}
-
-/**
- * @brief Constructor and Deconstructor
- */
-Deeps::Deeps(void)
-: m_AshitaCore(NULL)
-, m_PluginId(0)
-, m_Direct3DDevice(NULL)
-{ }
-Deeps::~Deeps(void)
-{ }
-
-/**
- * @brief Obtains the plugin data for this plugin.
- *
- * @return The PluginData structure for this plugin.
- */
-plugininfo_t Deeps::GetPluginInfo(void)
-{
- return (*g_PluginInfo);
-}
-
-/**
- * @brief Initializes our plugin. This is the main call that happens when your plugin is loaded.
- *
- * @param ashitaCore The main Ashita Core object interface to interact with Ashita.
- * @param scriptEngine The main script engine object interface to interact with the script engine.
- * @param dwPluginId The base address of your plugin. This is used as the ID.
- *
- * @return True on success, false otherwise.
- *
- * @note If your plugin returns false here, it will be unloaded immediately!
- */
-bool Deeps::Initialize(IAshitaCore* core, ILogManager* log, uint32_t id)
-{
- // Store the variables we are passed..
- this->m_AshitaCore = core;
- this->m_PluginId = id;
- this->m_LogManager = log;
-
- g_Deeps = this;
- srand(time(NULL));
-
- m_charInfo = 0;
- m_bars = 0;
-
- m_AshitaCore->GetConfigurationManager()->Load("Deeps", "Deeps.xml");
-
- return true;
-}
-
-/**
- * @brief Releases this plugin. This is called when your plugin is unloaded.
- *
- * @note Your plugin should cleanup all its data here before it unloads. Anything such as:
- * - Font objects.
- * - Gui objects.
- * - Bindings to the script engine (if you extended it any).
- */
-void Deeps::Release(void)
-{
-}
-
-/**
- * @brief Allows a plugin to attempt to handle a game command.
- *
- * @param pszCommand The command being processed.
- * @param nCommandType The type of command being processed.
- *
- * @return True on handled, false otherwise.
- */
-bool Deeps::HandleCommand(const char* command, int32_t type)
-{
- std::vector args;
- auto count = Ashita::Commands::GetCommandArgs(command, &args);
- if (count <= 0) return false;
- HANDLECOMMAND("/deeps", "/dps")
- {
- if (count >= 2)
- {
- if (args[1] == "reset")
- {
- entities.clear();
- m_sourceInfo.clear();
- m_charInfo = 0;
- return true;
- }
- else if (args[1] == "report")
- {
- char mode = 0x00;
- int max = 3;
- if (count > 2)
- {
- if (std::all_of(args[2].begin(), args[2].end(), ::isdigit))
- {
- max = atoi(args[2].c_str());
- }
- else
- {
- mode = args[2][0];
- if (count > 3)
- {
- if (std::all_of(args[2].begin(), args[2].end(), ::isdigit))
- {
- max = atoi(args[2].c_str());
- }
- }
- }
- }
-
- std::thread(&Deeps::report, this, mode, max).detach();
-
- return true;
- }
- else if (args[1] == "debug")
- {
- m_debug = !m_debug;
- if (m_debug)
- {
- m_AshitaCore->GetChatManager()->AddChatMessage(5, "Deeps: Debug on");
- }
- else
- {
- m_AshitaCore->GetChatManager()->AddChatMessage(5, "Deeps: Debug off");
- }
- return true;
- }
- }
- m_AshitaCore->GetChatManager()->AddChatMessage(5, "Deeps usage: /dps reset, /dps report [s/p/l] [#]");
- return true;
- }
- return false;
-}
-
-void Deeps::report(char mode, int max)
-{
- IFontObject* deepsBase = m_AshitaCore->GetFontManager()->Get("DeepsBackground");
- if (deepsBase)
- {
- std::string line;
- char buff[256];
- if (mode != 0x00)
- {
- sprintf_s(buff, 256, "/%c ", mode);
- line.append(buff);
- }
- line.append(deepsBase->GetText());
- m_AshitaCore->GetChatManager()->QueueCommand(line.c_str(), (int32_t)Ashita::CommandInputType::Typed);
- for (int i = 0; i < m_bars; i++)
- {
- if (i > max)
- break;
- std::this_thread::sleep_for(std::chrono::milliseconds(1100));
- line.clear();
- memset(buff, sizeof buff, 0);
- if (mode != 0x00)
- {
- sprintf_s(buff, 256, "/%c ", mode);
- line.append(buff);
- }
- sprintf_s(buff, 256, "%d -", i + 1);
- line.append(buff);
- char name[32];
- sprintf_s(name, 32, "DeepsBar%d", i);
- IFontObject* bar = m_AshitaCore->GetFontManager()->Get(name);
- line.append(bar->GetText());
- m_AshitaCore->GetChatManager()->QueueCommand(line.c_str(), (int32_t)Ashita::CommandInputType::Typed);
- }
- }
-}
-
-/**
- * @brief Allows a plugin to attempt to handle a new chat line.
- *
- * @param sMode The chat type being added.
- * @param pszChatLine The chat line being added.
- *
- * @return True on handled, false otherwise.
- */
-bool Deeps::HandleIncomingText(int16_t mode, const char* message, int16_t* modifiedMode, char* modifiedMessage, bool blocked)
-{
- return false;
-}
-
-/**
- * @brief Allows a plugin to attempt to handle an incoming packet.
- *
- * @param uiPacketId The id of the packet.
- * @param uiPacketSize The size of the packet.
- * @param lpRawData The raw packet data.
- *
- * @return True on handled, false otherwise.
- *
- * @note Returning true on this will block the packet from being handled! This can
- * have undesired effects! Use with caution as this can get you banned!
- */
-bool Deeps::HandleIncomingPacket(uint16_t id, uint32_t size, void* data, void* modified, bool blocked)
-{
- if (id == 0x28) //action
- {
- uint8_t actionNum = (uint8_t)(unpackBitsBE((unsigned char*)data, 182, 4));
- uint8_t targetNum = RBUFB(data, 0x09);
- uint8_t actionType = (uint8_t)(unpackBitsBE((unsigned char*)data, 82, 4));
- //uint8_t reaction = 0;
- //uint8_t speceffect = 0;
- uint16_t actionID = (uint16_t)(unpackBitsBE((unsigned char*)data, 86, 10));
- uint32_t userID = RBUFL(data, 0x05);
- uint16_t startBit = 150;
- uint16_t damage = 0;
-
- if (userID > 0x1000000)
- return false;
-
- auto it = entities.find(userID);
- entitysources_t* entityInfo = NULL;
-
- if (it != entities.end())
- {
- entityInfo = &it->second;
- }
- else
- {
- uint16_t index = getIndex([&](IEntity* entities, int i){if (entities->GetServerId(i) == userID) return true; return false; });
- if (index != 0)
- {
- entitysources_t newInfo;
- newInfo.name = m_AshitaCore->GetDataManager()->GetEntity()->GetName(index);
- newInfo.color = Colors[rand() % Colors.size()];
- entityInfo = &entities.insert(std::make_pair(userID, newInfo)).first->second;
- }
- }
-
- if (entityInfo)
- {
- if (m_debug)
- {
- m_AshitaCore->GetChatManager()->Writef("Action Type: %d Action ID: %d", actionType, actionID);
- }
-
- if ((actionType >= 1 && actionType <= 4) || (actionType == 6) || (actionType == 11) || (actionType == 14) || (actionType == 15))
- {
- if (actionID == 0)
- return false;
- source_t* source = getDamageSource(entityInfo, actionType, actionID);
- uint16_t messageID = (uint16_t)(unpackBitsBE((unsigned char*)data, startBit + 80, 10));
-
- uint32_t addEffectDamage = 0;
- uint8_t addEffectCount = 0;
- uint16_t addMessageID = 0;
- for (int i = 0; i < targetNum; i++)
- {
- for (int j = 0; j < actionNum; j++)
- {
- uint8_t reaction = (uint8_t)(unpackBitsBE((unsigned char*)data, startBit + 36, 5));
- uint16_t animation = (uint16_t)(unpackBitsBE((unsigned char*)data, startBit + 41, 12));
- uint32_t mainDamage = (uint16_t)(unpackBitsBE((unsigned char*)data, startBit + 63, 17));
- uint8_t speceffect = (uint8_t)(unpackBitsBE((unsigned char*)data, startBit + 53, 9));
-
- if (m_debug)
- {
- m_AshitaCore->GetChatManager()->Writef("Reaction: %d Animation: %d", reaction, animation);
- m_AshitaCore->GetChatManager()->Writef("Speceffect: %d Param: %d", speceffect, mainDamage);
- }
-
- //Daken (ranged attack on attack)
- if (actionType == 1 && animation == 4)
- source = getDamageSource(entityInfo, actionType+1, actionID);
-
- if (!updateDamageSource(source, messageID, mainDamage))
- return false;
-
- if ((unpackBitsBE((unsigned char*)data, startBit + 121, 1) & 0x1) && actionType != 6)
- {
- addMessageID = (uint16_t)(unpackBitsBE((unsigned char*)data, startBit + 149, 10));
- if (addMessageID == 163 || addMessageID == 229 || (addMessageID >= 288 && addMessageID <= 302))
- {
- addEffectDamage = (uint16_t)(unpackBitsBE((unsigned char*)data, startBit + 132, 16));
- uint32_t key = 0;
- if (addMessageID == 163 || addMessageID == 229)
- key = 1 << 8;
- else
- key = 2 << 8;
- auto sourcesIt = entityInfo->sources.find(key);
-
- source_t* source;
-
- if (sourcesIt != entityInfo->sources.end())
- {
- source = &sourcesIt->second;
- }
- else
- {
- source_t newsource;
- if (key == 1 << 8) { newsource.name.append("Additional Effect"); }
- else { newsource.name.append("Skillchain"); }
-
- sourcesIt = entityInfo->sources.insert(std::make_pair(key, newsource)).first;
- source = &sourcesIt->second;
- }
- source->damage["Hit"].count += 1;
- source->damage["Hit"].total += addEffectDamage;
- source->damage["Hit"].min = (addEffectDamage < source->damage["Hit"].min ? addEffectDamage : source->damage["Hit"].min);
- source->damage["Hit"].max = (addEffectDamage > source->damage["Hit"].max ? addEffectDamage : source->damage["Hit"].max);
- }
-
- startBit += 37;
- }
- startBit += 1;
- if (unpackBitsBE((unsigned char*)data, startBit + 121, 1) & 0x1)
- {
- startBit += 34;
- }
- startBit += 86;
- }
- startBit += 36;
- }
- }
- }
- }
- return false;
-}
-
-/**
- * @brief Allows a plugin to attempt to handle an outgoing packet.
- *
- * @param uiPacketId The id of the packet.
- * @param uiPacketSize The size of the packet.
- * @param lpRawData The raw packet data.
- *
- * @return True on handled, false otherwise.
- *
- * @note Returning true on this will block the packet from being handled! This can
- * have undesired effects! Use with caution as this can get you banned!
- */
-bool Deeps::HandleOutgoingPacket(uint16_t id, uint32_t size, void* data, void* modified, bool blocked)
-{
- return false;
-}
-
-/**
- * @brief Direct3D initialize call to prepare this plugin for Direct3D calls.
- *
- * @param lpDevice The Direct3D device currently wrapped by Ashita.
- *
- * @return True on success, false otherwise.
- *
- * @note Plugins that do not return true on this call will not receive any other
- * Direct3D calls listed below!
- */
-bool Deeps::Direct3DInitialize(IDirect3DDevice8* device)
-{
- this->m_Direct3DDevice = device;
-
- float xpos = m_AshitaCore->GetConfigurationManager()->get_float("Deeps", "xpos", 300.0f);
- float ypos = m_AshitaCore->GetConfigurationManager()->get_float("Deeps", "ypos", 300.0f);
-
- IFontObject* font = m_AshitaCore->GetFontManager()->Create("DeepsBackground");
- font->SetFontFamily("Consolas");
- font->SetFontHeight(10);
- font->SetAutoResize(false);
- font->GetBackground()->SetColor(D3DCOLOR_ARGB(0xCC, 0x00, 0x00, 0x00));
- font->GetBackground()->SetVisibility(true);
- font->GetBackground()->SetWidth(158);
- font->GetBackground()->SetHeight(256);
- font->SetColor(D3DCOLOR_ARGB(0xFF, 0xFF, 0xFF, 0xFF));
- font->SetBold(false);
- font->SetText("");
- font->SetPositionX(xpos);
- font->SetPositionY(ypos);
- font->SetVisibility(true);
- font->SetMouseEventFunction(g_onClick);
-
- return true;
-}
-
-/**
- * @brief Direct3D release call to allow this plugin to cleanup any Direct3D objects.
- */
-void Deeps::Direct3DRelease(void)
-{
- IFontObject* deepsBase = m_AshitaCore->GetFontManager()->Get("DeepsBackground");
-
- m_AshitaCore->GetConfigurationManager()->set_value("Deeps", "xpos", std::to_string(deepsBase->GetPositionX()).c_str());
- m_AshitaCore->GetConfigurationManager()->set_value("Deeps", "ypos", std::to_string(deepsBase->GetPositionY()).c_str());
- m_AshitaCore->GetConfigurationManager()->Save("Deeps", "Deeps.xml");
-
- m_AshitaCore->GetFontManager()->Delete("DeepsBackground");
-
- for (int i = 0; i < m_bars; i++)
- {
- char name[32];
- sprintf_s(name, 32, "DeepsBar%d", i);
- m_AshitaCore->GetFontManager()->Delete(name);
- memset(name, 0, sizeof name);
- sprintf_s(name, 32, "DeepsBarClick%d", i);
- m_AshitaCore->GetFontManager()->Delete(name);
- }
-}
-
-/**
- * @brief Direct3D prerender call to allow this plugin to prepare for rendering.
- *
- * @note This will only be called if you returned true in Direct3DInitialize!
- */
-void Deeps::Direct3DPreRender(void)
-{
-}
-
-/**
- * @brief Direct3D render call to allow this plugin to render any custom things.
- *
- * @note This will only be called if you returned true in Direct3DInitialize!
- */
-void Deeps::Direct3DRender(void)
-{
- IFontObject* deepsBase = m_AshitaCore->GetFontManager()->Get("DeepsBackground");
-
- if (m_charInfo == 0)
- {
- deepsBase->SetText(" Deeps - Damage Done");
- deepsBase->GetBackground()->SetWidth(158);
- std::vector temp;
- uint64_t total = 0;
- for (auto e : entities)
- {
- if (e.second.total() != 0 && temp.size() < 15)
- {
- temp.push_back(e.second);
- total += e.second.total();
- }
- }
- std::sort(temp.begin(), temp.end(), [](entitysources_t a, entitysources_t b){return a > b; });
- repairBars(deepsBase, temp.size());
-
- int i = 0;
- uint64_t max = 0;
- clickMap.clear();
- for (auto e : temp)
- {
- char name[32];
- sprintf_s(name, 32, "DeepsBar%d", i);
- IFontObject* bar = m_AshitaCore->GetFontManager()->Get(name);
- if (e.total() > max) max = e.total();
- bar->GetBackground()->SetWidth(150 * (total == 0 ? 1 : ((float)e.total() / (float)max)));
- bar->GetBackground()->SetColor(e.color);
- char string[256];
- sprintf_s(string, 256, " %-10.10s %6llu %03.1f%%\n", e.name.c_str(), e.total(), total == 0 ? 0 : 100 * ((float)e.total() / (float)total));
- bar->SetText(string);
- memset(name, 0, sizeof name);
- sprintf_s(name, 32, "DeepsBarClick%d", i);
- bar = m_AshitaCore->GetFontManager()->Get(name);
- bar->GetBackground()->SetWidth(150);
- clickMap.insert(std::pair(bar, e.name));
- i++;
- }
- }
- else
- {
- auto it = entities.find(m_charInfo);
- if (it != entities.end())
- {
- if (m_sourceInfo == "")
- {
- std::vector temp;
- uint64_t total = 0;
- for (auto s : it->second.sources)
- {
- if (s.second.total() != 0 && temp.size() < 15)
- {
- temp.push_back(s.second);
- total += s.second.total();
- }
- }
- std::sort(temp.begin(), temp.end(), [](source_t a, source_t b){return a > b; });
- char string[256];
- sprintf_s(string, 256, " %s - Sources\n", it->second.name.c_str());
- deepsBase->SetText(string);
- deepsBase->GetBackground()->SetWidth(158);
-
- repairBars(deepsBase, temp.size());
- int i = 0;
- uint64_t max = 0;
- clickMap.clear();
- for (auto s : temp)
- {
- char name[32];
- sprintf_s(name, 32, "DeepsBar%d", i);
- IFontObject* bar = m_AshitaCore->GetFontManager()->Get(name);
- if (s.total() > max) max = s.total();
- bar->GetBackground()->SetWidth(150 * (total == 0 ? 1 : ((float)s.total() / (float)max)));
- bar->GetBackground()->SetColor(it->second.color);
- char string[256];
- sprintf_s(string, 256, " %-10.10s %6llu %03.1f%%\n", s.name.c_str(), s.total(), total == 0 ? 0 : 100 * ((float)s.total() / (float)total));
- bar->SetText(string);
- memset(name, 0, sizeof name);
- sprintf_s(name, 32, "DeepsBarClick%d", i);
- bar = m_AshitaCore->GetFontManager()->Get(name);
- bar->GetBackground()->SetWidth(150);
- clickMap.insert(std::pair(bar, s.name));
- i++;
- }
- }
- else
- {
- for (auto s : it->second.sources)
- {
- if (s.second.name == m_sourceInfo)
- {
- std::vector > temp;
- uint32_t count = 0;
- for (auto d : s.second.damage)
- {
- if (d.second.count != 0 && temp.size() < 15)
- {
- temp.push_back(d);
- count += d.second.count;
- }
- }
- std::sort(temp.begin(), temp.end(), [](std::pair a, std::pair b){return a.second > b.second; });
- char string[256];
- sprintf_s(string, 256, " %s - %s\n", it->second.name.c_str(), s.second.name.c_str());
- deepsBase->SetText(string);
- deepsBase->GetBackground()->SetWidth(262);
- repairBars(deepsBase, temp.size());
- int i = 0;
- uint32_t max = 0;
- for (auto s : temp)
- {
- char name[32];
- sprintf_s(name, 32, "DeepsBar%d", i);
- IFontObject* bar = m_AshitaCore->GetFontManager()->Get(name);
- if (s.second.count > max) max = s.second.count;
- bar->GetBackground()->SetWidth(254 * (count == 0 ? 1 : 1 * ((float)s.second.count / (float)max)));
- bar->GetBackground()->SetColor(it->second.color);
- char string[256];
- sprintf_s(string, 256, " %-5s Cnt:%4d Avg:%5d Max:%5d %3.1f%%\n", s.first, s.second.count, s.second.avg(), s.second.max, count == 0 ? 0 : 100 * ((float)s.second.count / (float)count));
- bar->SetText(string);
- i++;
- }
- break;
- }
- }
- }
- }
- }
- deepsBase->GetBackground()->SetHeight(m_bars * 16 + 17);
-}
-
-void Deeps::repairBars(IFontObject* deepsBase, uint8_t size)
-{
- IFontObject* previous = deepsBase;
- if (m_AshitaCore->GetFontManager()->Get("DeepsBar0") != NULL)
- {
- char name[32] = "DeepsBar0";
- int i = 1;
- while (m_AshitaCore->GetFontManager()->Get(name) != NULL)
- {
- previous = m_AshitaCore->GetFontManager()->Get(name);
- sprintf_s(name, 32, "DeepsBar%d", i);
- i++;
- }
- }
- while (m_bars != size)
- {
- if (m_bars > size)
- {
- char name[32];
- sprintf_s(name, 32, "DeepsBar%d", m_bars - 1);
- m_AshitaCore->GetFontManager()->Delete(name);
- memset(name, 0, sizeof name);
- sprintf_s(name, 32, "DeepsBarClick%d", m_bars - 1);
- m_AshitaCore->GetFontManager()->Delete(name);
- m_bars--;
- }
- else if (m_bars < size)
- {
- char name[32];
- sprintf_s(name, 32, "DeepsBar%d", m_bars);
- IFontObject* bar = m_AshitaCore->GetFontManager()->Create(name);
- bar->SetParent(previous);
- if (previous == deepsBase)
- {
- bar->SetPositionX(4);
- bar->SetPositionY(15);
- }
- else
- {
- bar->SetAnchorParent((uint32_t)Ashita::FrameAnchor::BottomLeft);
- bar->SetPositionX(0);
- bar->SetPositionY(3);
- }
- bar->SetAutoResize(false);
- bar->SetFontFamily("Consolas");
- bar->SetFontHeight(8);
- bar->GetBackground()->SetColor(D3DCOLOR_ARGB(0xFF, 0x00, 0x7C, 0x5C));
- bar->GetBackground()->SetVisibility(true);
- std::string path = m_AshitaCore->GetAshitaInstallPathA();
- path.append("\\Resources\\Deeps\\bar.tga");
- bar->GetBackground()->SetTextureFromFile(path.c_str());
- bar->GetBackground()->SetWidth(254);
- bar->GetBackground()->SetHeight(13);
- bar->SetVisibility(true);
-
- memset(name, 0, sizeof name);
- sprintf_s(name, 32, "DeepsBarClick%d", m_bars);
- IFontObject* clickBar = m_AshitaCore->GetFontManager()->Create(name);
- clickBar->SetParent(bar);
- clickBar->SetPositionX(0);
- clickBar->SetPositionY(0);
- clickBar->SetAutoResize(false);
- clickBar->GetBackground()->SetColor(D3DCOLOR_ARGB(0x00, 0x00, 0x00, 0x00));
- clickBar->GetBackground()->SetVisibility(true);
- clickBar->GetBackground()->SetWidth(254);
- clickBar->GetBackground()->SetHeight(13);
- clickBar->SetVisibility(true);
- clickBar->SetMouseEventFunction(g_onClick);
-
- m_bars++;
- previous = bar;
- }
- }
-}
-
-void Deeps::onClick(int type, IFontObject* font, float xPos, float yPos)
-{
- if (type == 1 && font == m_AshitaCore->GetFontManager()->Get("DeepsBackground"))
- {
- if (m_sourceInfo != "")
- {
- m_sourceInfo = "";
- }
- else
- {
- m_charInfo = 0;
- }
- return;
- }
-
- if (m_charInfo == 0)
- {
- //Char was clicked
- if (type == 0)
- {
- // left click
- try
- {
- auto name = clickMap.at(font);
- for (auto entity : entities)
- {
- if (entity.second.name == name)
- {
- m_charInfo = entity.first;
- break;
- }
- }
- }
- catch (...)
- {
- return;
- }
- }
- }
- else
- {
- if (m_sourceInfo == "")
- {
- //source was clicked
- if (type == 0)
- {
- try
- {
- auto name = clickMap.at(font);
- m_sourceInfo.assign(name);
- }
- catch (...)
- {
- return;
- }
- }
- }
- }
-}
-
-/**
- * @brief Gets the interface version this plugin was compiled with.
- *
- * @note This is a required export, your plugin must implement this!
- */
-__declspec(dllexport) double __stdcall GetInterfaceVersion(void)
-{
- return ASHITA_INTERFACE_VERSION;
-}
-
-/**
- * @brief Gets the plugin data for this plugin.
- *
- * @note This is a required export, your plugin must implement this!
- */
-__declspec(dllexport) void __stdcall CreatePluginInfo(plugininfo_t* lpBuffer)
-{
- g_PluginInfo = lpBuffer;
-
- strcpy_s(g_PluginInfo->Name, sizeof(g_PluginInfo->Name), "Deeps");
- strcpy_s(g_PluginInfo->Author, sizeof(g_PluginInfo->Author), "kjLotus");
-
- g_PluginInfo->InterfaceVersion = ASHITA_INTERFACE_VERSION;
- g_PluginInfo->PluginVersion = 2.03f;
- g_PluginInfo->Priority = 0;
-}
-
-/**
- * @brief Creates an instance of this plugin object.
- *
- * @note This is a required export, your plugin must implement this!
- */
-__declspec(dllexport) IPlugin* __stdcall CreatePlugin(void)
-{
- return (IPlugin*)new Deeps();
-}
-
-void g_onClick(int type, void* font, float xPos, float yPos)
-{
- g_Deeps->onClick(type, (IFontObject*)font, xPos, yPos);
+/**
+* Copyright (c) 2011-2014 - Ashita Development Team
+*
+* Ashita is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* Ashita is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with Ashita. If not, see .
+*/
+
+#include "Deeps.h"
+#include "DSP-Utils.h"
+
+#include
+#include
+
+source_t* Deeps::getDamageSource(entitysources_t* entityInfo, uint8_t actionType, uint16_t actionID)
+{
+ uint32_t key = (actionID << 8) + actionType;
+ auto sourcesIt = entityInfo->sources.find(key);
+
+ source_t* source;
+
+ if (sourcesIt != entityInfo->sources.end())
+ {
+ source = &sourcesIt->second;
+ }
+ else
+ {
+ source_t newsource;
+
+ sourcesIt = entityInfo->sources.insert(std::make_pair(key, newsource)).first;
+
+ source = &sourcesIt->second;
+ if (actionType == 1) { source->name.append("Attack"); }
+ else if (actionType == 2) { source->name.append("Ranged Attack"); }
+ else if (actionType == 3 || actionType == 11){ source->name.append(m_AshitaCore->GetResourceManager()->GetAbilityById(actionID)->Name[2]); }
+ else if (actionType == 4) { source->name.append(m_AshitaCore->GetResourceManager()->GetSpellById(actionID)->Name[2]); }
+ else if (actionType == 6 || actionType == 14 || actionType == 15) { source->name.append(m_AshitaCore->GetResourceManager()->GetAbilityById(actionID + 512)->Name[2]); }
+
+ }
+ return source;
+}
+
+bool Deeps::updateDamageSource(source_t* source, uint16_t message, uint32_t damage)
+{
+ damage_t* type = NULL;
+ bool val = false;
+ if (std::find(hitMessages.begin(), hitMessages.end(), message) != hitMessages.end())
+ {
+ type = &source->damage["Hit"];
+ val = true;
+ }
+ else if (std::find(critMessages.begin(), critMessages.end(), message) != critMessages.end())
+ {
+ type = &source->damage["Crit"];
+ val = true;
+ }
+ else if (std::find(missMessages.begin(), missMessages.end(), message) != missMessages.end())
+ {
+ type = &source->damage["Miss"];
+ }
+ else if (std::find(evadeMessages.begin(), evadeMessages.end(), message) != evadeMessages.end())
+ {
+ type = &source->damage["Evade"];
+ }
+ else if (std::find(parryMessages.begin(), parryMessages.end(), message) != parryMessages.end())
+ {
+ type = &source->damage["Parry"];
+ }
+ if (type)
+ {
+ damage = val ? damage : 0;
+ type->total += damage;
+ type->count++;
+ type->min = (damage < type->min ? damage : type->min);
+ type->max = (damage > type->max ? damage : type->max);
+ return true;
+ }
+ return false;
+}
+
+uint16_t Deeps::getIndex(std::function func)
+{
+ for (int i = 0; i < 2048; i++)
+ {
+ if (func(m_AshitaCore->GetDataManager()->GetEntity(), i))
+ {
+ return i;
+ }
+ }
+ return 0;
+}
+
+/**
+ * @brief Constructor and Deconstructor
+ */
+Deeps::Deeps(void)
+: m_AshitaCore(NULL)
+, m_PluginId(0)
+, m_Direct3DDevice(NULL)
+{ }
+Deeps::~Deeps(void)
+{ }
+
+/**
+ * @brief Obtains the plugin data for this plugin.
+ *
+ * @return The PluginData structure for this plugin.
+ */
+plugininfo_t Deeps::GetPluginInfo(void)
+{
+ return (*g_PluginInfo);
+}
+
+/**
+ * @brief Initializes our plugin. This is the main call that happens when your plugin is loaded.
+ *
+ * @param ashitaCore The main Ashita Core object interface to interact with Ashita.
+ * @param scriptEngine The main script engine object interface to interact with the script engine.
+ * @param dwPluginId The base address of your plugin. This is used as the ID.
+ *
+ * @return True on success, false otherwise.
+ *
+ * @note If your plugin returns false here, it will be unloaded immediately!
+ */
+bool Deeps::Initialize(IAshitaCore* core, ILogManager* log, uint32_t id)
+{
+ // Store the variables we are passed..
+ this->m_AshitaCore = core;
+ this->m_PluginId = id;
+ this->m_LogManager = log;
+
+ g_Deeps = this;
+ srand(time(NULL));
+
+ m_charInfo = 0;
+ m_bars = 0;
+
+ m_AshitaCore->GetConfigurationManager()->Load("Deeps", "Deeps.xml");
+
+ return true;
+}
+
+/**
+ * @brief Releases this plugin. This is called when your plugin is unloaded.
+ *
+ * @note Your plugin should cleanup all its data here before it unloads. Anything such as:
+ * - Font objects.
+ * - Gui objects.
+ * - Bindings to the script engine (if you extended it any).
+ */
+void Deeps::Release(void)
+{
+ while (m_Packets.size() > 0)
+ {
+ free(*m_Packets.begin());
+ m_Packets.pop_front();
+ }
+}
+
+/**
+ * @brief Allows a plugin to attempt to handle a game command.
+ *
+ * @param pszCommand The command being processed.
+ * @param nCommandType The type of command being processed.
+ *
+ * @return True on handled, false otherwise.
+ */
+bool Deeps::HandleCommand(const char* command, int32_t type)
+{
+ std::vector args;
+ auto count = Ashita::Commands::GetCommandArgs(command, &args);
+ if (count <= 0) return false;
+ HANDLECOMMAND("/deeps", "/dps")
+ {
+ if (count >= 2)
+ {
+ if (args[1] == "reset")
+ {
+ entities.clear();
+ m_sourceInfo.clear();
+ m_charInfo = 0;
+ return true;
+ }
+ else if (args[1] == "report")
+ {
+ char mode = 0x00;
+ int max = 3;
+ if (count > 2)
+ {
+ if (std::all_of(args[2].begin(), args[2].end(), ::isdigit))
+ {
+ max = atoi(args[2].c_str());
+ }
+ else
+ {
+ mode = args[2][0];
+ if (count > 3)
+ {
+ if (std::all_of(args[2].begin(), args[2].end(), ::isdigit))
+ {
+ max = atoi(args[2].c_str());
+ }
+ }
+ }
+ }
+
+ std::thread(&Deeps::report, this, mode, max).detach();
+
+ return true;
+ }
+ else if (args[1] == "debug")
+ {
+ m_debug = !m_debug;
+ if (m_debug)
+ {
+ m_AshitaCore->GetChatManager()->AddChatMessage(5, "Deeps: Debug on");
+ }
+ else
+ {
+ m_AshitaCore->GetChatManager()->AddChatMessage(5, "Deeps: Debug off");
+ }
+ return true;
+ }
+ }
+ m_AshitaCore->GetChatManager()->AddChatMessage(5, "Deeps usage: /dps reset, /dps report [s/p/l] [#]");
+ return true;
+ }
+ return false;
+}
+
+void Deeps::report(char mode, int max)
+{
+ IFontObject* deepsBase = m_AshitaCore->GetFontManager()->Get("DeepsBackground");
+ if (deepsBase)
+ {
+ std::string line;
+ char buff[256];
+ if (mode != 0x00)
+ {
+ sprintf_s(buff, 256, "/%c ", mode);
+ line.append(buff);
+ }
+ line.append(deepsBase->GetText());
+ m_AshitaCore->GetChatManager()->QueueCommand(line.c_str(), (int32_t)Ashita::CommandInputType::Typed);
+ for (int i = 0; i < m_bars; i++)
+ {
+ if (i > max)
+ break;
+ std::this_thread::sleep_for(std::chrono::milliseconds(1100));
+ line.clear();
+ memset(buff, sizeof buff, 0);
+ if (mode != 0x00)
+ {
+ sprintf_s(buff, 256, "/%c ", mode);
+ line.append(buff);
+ }
+ sprintf_s(buff, 256, "%d -", i + 1);
+ line.append(buff);
+ char name[32];
+ sprintf_s(name, 32, "DeepsBar%d", i);
+ IFontObject* bar = m_AshitaCore->GetFontManager()->Get(name);
+ line.append(bar->GetText());
+ m_AshitaCore->GetChatManager()->QueueCommand(line.c_str(), (int32_t)Ashita::CommandInputType::Typed);
+ }
+ }
+}
+
+/**
+ * @brief Allows a plugin to attempt to handle a new chat line.
+ *
+ * @param sMode The chat type being added.
+ * @param pszChatLine The chat line being added.
+ *
+ * @return True on handled, false otherwise.
+ */
+bool Deeps::HandleIncomingText(int16_t mode, const char* message, int16_t* modifiedMode, char* modifiedMessage, bool blocked)
+{
+ return false;
+}
+
+/**
+ * @brief Allows a plugin to attempt to handle an incoming packet.
+ *
+ * @param uiPacketId The id of the packet.
+ * @param uiPacketSize The size of the packet.
+ * @param lpRawData The raw packet data.
+ *
+ * @return True on handled, false otherwise.
+ *
+ * @note Returning true on this will block the packet from being handled! This can
+ * have undesired effects! Use with caution as this can get you banned!
+ */
+bool Deeps::HandleIncomingPacket(uint16_t id, uint32_t size, void* data, void* modified, bool blocked)
+{
+ for (std::list::iterator it = m_Packets.begin(); it != m_Packets.end(); it++)
+ {
+ if (memcmp(data, (*it), size) == 0)
+ {
+ return false;
+ }
+ }
+
+ void* packet = malloc(1024);
+ memset(packet, 0, 1024);
+ memcpy(packet, data, size);
+ m_Packets.push_back(packet);
+ while (m_Packets.size() > 200)
+ {
+ free(*m_Packets.begin());
+ m_Packets.pop_front();
+ }
+
+ if (id == 0x28) //action
+ {
+ uint8_t actionNum = (uint8_t)(unpackBitsBE((unsigned char*)data, 182, 4));
+ uint8_t targetNum = RBUFB(data, 0x09);
+ uint8_t actionType = (uint8_t)(unpackBitsBE((unsigned char*)data, 82, 4));
+ //uint8_t reaction = 0;
+ //uint8_t speceffect = 0;
+ uint16_t actionID = (uint16_t)(unpackBitsBE((unsigned char*)data, 86, 10));
+ uint32_t userID = RBUFL(data, 0x05);
+ uint16_t startBit = 150;
+ uint16_t damage = 0;
+
+ if (userID > 0x1000000)
+ return false;
+
+ auto it = entities.find(userID);
+ entitysources_t* entityInfo = NULL;
+
+ if (it != entities.end())
+ {
+ entityInfo = &it->second;
+ }
+ else
+ {
+ uint16_t index = getIndex([&](IEntity* entities, int i){if (entities->GetServerId(i) == userID) return true; return false; });
+ if (index != 0)
+ {
+ entitysources_t newInfo;
+ newInfo.name = m_AshitaCore->GetDataManager()->GetEntity()->GetName(index);
+ newInfo.color = Colors[rand() % Colors.size()];
+ entityInfo = &entities.insert(std::make_pair(userID, newInfo)).first->second;
+ }
+ }
+
+ if (entityInfo)
+ {
+ if (m_debug)
+ {
+ m_AshitaCore->GetChatManager()->Writef("Action Type: %d Action ID: %d", actionType, actionID);
+ }
+
+ if ((actionType >= 1 && actionType <= 4) || (actionType == 6) || (actionType == 11) || (actionType == 14) || (actionType == 15))
+ {
+ if (actionID == 0)
+ return false;
+ source_t* source = getDamageSource(entityInfo, actionType, actionID);
+ uint16_t messageID = (uint16_t)(unpackBitsBE((unsigned char*)data, startBit + 80, 10));
+
+ uint32_t addEffectDamage = 0;
+ uint8_t addEffectCount = 0;
+ uint16_t addMessageID = 0;
+ for (int i = 0; i < targetNum; i++)
+ {
+ for (int j = 0; j < actionNum; j++)
+ {
+ uint8_t reaction = (uint8_t)(unpackBitsBE((unsigned char*)data, startBit + 36, 5));
+ uint16_t animation = (uint16_t)(unpackBitsBE((unsigned char*)data, startBit + 41, 12));
+ uint32_t mainDamage = (uint32_t)(unpackBitsBE((unsigned char*)data, startBit + 63, 17));
+ uint8_t speceffect = (uint8_t)(unpackBitsBE((unsigned char*)data, startBit + 53, 9));
+
+ if (m_debug)
+ {
+ m_AshitaCore->GetChatManager()->Writef("Reaction: %d Animation: %d", reaction, animation);
+ m_AshitaCore->GetChatManager()->Writef("Speceffect: %d Param: %d", speceffect, mainDamage);
+ }
+
+ //Daken (ranged attack on attack)
+ if (actionType == 1 && animation == 4)
+ source = getDamageSource(entityInfo, actionType+1, actionID);
+
+ if (!updateDamageSource(source, messageID, mainDamage))
+ return false;
+
+ if ((unpackBitsBE((unsigned char*)data, startBit + 121, 1) & 0x1) && actionType != 6)
+ {
+ addMessageID = (uint16_t)(unpackBitsBE((unsigned char*)data, startBit + 149, 10));
+ if (addMessageID == 163 || addMessageID == 229 || (addMessageID >= 288 && addMessageID <= 302))
+ {
+ addEffectDamage = (uint16_t)(unpackBitsBE((unsigned char*)data, startBit + 132, 16));
+ uint32_t key = 0;
+ if (addMessageID == 163 || addMessageID == 229)
+ key = 1 << 8;
+ else
+ key = 2 << 8;
+ auto sourcesIt = entityInfo->sources.find(key);
+
+ source_t* source;
+
+ if (sourcesIt != entityInfo->sources.end())
+ {
+ source = &sourcesIt->second;
+ }
+ else
+ {
+ source_t newsource;
+ if (key == 1 << 8) { newsource.name.append("Additional Effect"); }
+ else { newsource.name.append("Skillchain"); }
+
+ sourcesIt = entityInfo->sources.insert(std::make_pair(key, newsource)).first;
+ source = &sourcesIt->second;
+ }
+ source->damage["Hit"].count += 1;
+ source->damage["Hit"].total += addEffectDamage;
+ source->damage["Hit"].min = (addEffectDamage < source->damage["Hit"].min ? addEffectDamage : source->damage["Hit"].min);
+ source->damage["Hit"].max = (addEffectDamage > source->damage["Hit"].max ? addEffectDamage : source->damage["Hit"].max);
+ }
+
+ startBit += 37;
+ }
+ startBit += 1;
+ if (unpackBitsBE((unsigned char*)data, startBit + 121, 1) & 0x1)
+ {
+ startBit += 34;
+ }
+ startBit += 86;
+ }
+ startBit += 36;
+ }
+ }
+ }
+ }
+ return false;
+}
+
+/**
+ * @brief Allows a plugin to attempt to handle an outgoing packet.
+ *
+ * @param uiPacketId The id of the packet.
+ * @param uiPacketSize The size of the packet.
+ * @param lpRawData The raw packet data.
+ *
+ * @return True on handled, false otherwise.
+ *
+ * @note Returning true on this will block the packet from being handled! This can
+ * have undesired effects! Use with caution as this can get you banned!
+ */
+bool Deeps::HandleOutgoingPacket(uint16_t id, uint32_t size, void* data, void* modified, bool blocked)
+{
+ return false;
+}
+
+/**
+ * @brief Direct3D initialize call to prepare this plugin for Direct3D calls.
+ *
+ * @param lpDevice The Direct3D device currently wrapped by Ashita.
+ *
+ * @return True on success, false otherwise.
+ *
+ * @note Plugins that do not return true on this call will not receive any other
+ * Direct3D calls listed below!
+ */
+bool Deeps::Direct3DInitialize(IDirect3DDevice8* device)
+{
+ this->m_Direct3DDevice = device;
+
+ float xpos = m_AshitaCore->GetConfigurationManager()->get_float("Deeps", "xpos", 300.0f);
+ float ypos = m_AshitaCore->GetConfigurationManager()->get_float("Deeps", "ypos", 300.0f);
+
+ IFontObject* font = m_AshitaCore->GetFontManager()->Create("DeepsBackground");
+ font->SetFontFamily("Consolas");
+ font->SetFontHeight(10);
+ font->SetAutoResize(false);
+ font->GetBackground()->SetColor(D3DCOLOR_ARGB(0xCC, 0x00, 0x00, 0x00));
+ font->GetBackground()->SetVisibility(true);
+ font->GetBackground()->SetWidth(158);
+ font->GetBackground()->SetHeight(256);
+ font->SetColor(D3DCOLOR_ARGB(0xFF, 0xFF, 0xFF, 0xFF));
+ font->SetBold(false);
+ font->SetText("");
+ font->SetPositionX(xpos);
+ font->SetPositionY(ypos);
+ font->SetVisibility(true);
+ font->SetMouseEventFunction(g_onClick);
+
+ return true;
+}
+
+/**
+ * @brief Direct3D release call to allow this plugin to cleanup any Direct3D objects.
+ */
+void Deeps::Direct3DRelease(void)
+{
+ IFontObject* deepsBase = m_AshitaCore->GetFontManager()->Get("DeepsBackground");
+
+ m_AshitaCore->GetConfigurationManager()->set_value("Deeps", "xpos", std::to_string(deepsBase->GetPositionX()).c_str());
+ m_AshitaCore->GetConfigurationManager()->set_value("Deeps", "ypos", std::to_string(deepsBase->GetPositionY()).c_str());
+ m_AshitaCore->GetConfigurationManager()->Save("Deeps", "Deeps.xml");
+
+ m_AshitaCore->GetFontManager()->Delete("DeepsBackground");
+
+ for (int i = 0; i < m_bars; i++)
+ {
+ char name[32];
+ sprintf_s(name, 32, "DeepsBar%d", i);
+ m_AshitaCore->GetFontManager()->Delete(name);
+ memset(name, 0, sizeof name);
+ sprintf_s(name, 32, "DeepsBarClick%d", i);
+ m_AshitaCore->GetFontManager()->Delete(name);
+ }
+}
+
+/**
+ * @brief Direct3D prerender call to allow this plugin to prepare for rendering.
+ *
+ * @note This will only be called if you returned true in Direct3DInitialize!
+ */
+void Deeps::Direct3DPreRender(void)
+{
+}
+
+/**
+ * @brief Direct3D render call to allow this plugin to render any custom things.
+ *
+ * @note This will only be called if you returned true in Direct3DInitialize!
+ */
+void Deeps::Direct3DRender(void)
+{
+ IFontObject* deepsBase = m_AshitaCore->GetFontManager()->Get("DeepsBackground");
+
+ if (m_charInfo == 0)
+ {
+ deepsBase->SetText(" Deeps - Damage Done");
+ deepsBase->GetBackground()->SetWidth(158);
+ std::vector temp;
+ uint64_t total = 0;
+ for (auto e : entities)
+ {
+ if (e.second.total() != 0 && temp.size() < 15)
+ {
+ temp.push_back(e.second);
+ total += e.second.total();
+ }
+ }
+ std::sort(temp.begin(), temp.end(), [](entitysources_t a, entitysources_t b){return a > b; });
+ repairBars(deepsBase, temp.size());
+
+ int i = 0;
+ uint64_t max = 0;
+ clickMap.clear();
+ for (auto e : temp)
+ {
+ char name[32];
+ sprintf_s(name, 32, "DeepsBar%d", i);
+ IFontObject* bar = m_AshitaCore->GetFontManager()->Get(name);
+ if (e.total() > max) max = e.total();
+ bar->GetBackground()->SetWidth(150 * (total == 0 ? 1 : ((float)e.total() / (float)max)));
+ bar->GetBackground()->SetColor(e.color);
+ char string[256];
+ sprintf_s(string, 256, " %-10.10s %6llu %03.1f%%\n", e.name.c_str(), e.total(), total == 0 ? 0 : 100 * ((float)e.total() / (float)total));
+ bar->SetText(string);
+ memset(name, 0, sizeof name);
+ sprintf_s(name, 32, "DeepsBarClick%d", i);
+ bar = m_AshitaCore->GetFontManager()->Get(name);
+ bar->GetBackground()->SetWidth(150);
+ clickMap.insert(std::pair(bar, e.name));
+ i++;
+ }
+ }
+ else
+ {
+ auto it = entities.find(m_charInfo);
+ if (it != entities.end())
+ {
+ if (m_sourceInfo == "")
+ {
+ std::vector temp;
+ uint64_t total = 0;
+ for (auto s : it->second.sources)
+ {
+ if (s.second.total() != 0 && temp.size() < 15)
+ {
+ temp.push_back(s.second);
+ total += s.second.total();
+ }
+ }
+ std::sort(temp.begin(), temp.end(), [](source_t a, source_t b){return a > b; });
+ char string[256];
+ sprintf_s(string, 256, " %s - Sources\n", it->second.name.c_str());
+ deepsBase->SetText(string);
+ deepsBase->GetBackground()->SetWidth(158);
+
+ repairBars(deepsBase, temp.size());
+ int i = 0;
+ uint64_t max = 0;
+ clickMap.clear();
+ for (auto s : temp)
+ {
+ char name[32];
+ sprintf_s(name, 32, "DeepsBar%d", i);
+ IFontObject* bar = m_AshitaCore->GetFontManager()->Get(name);
+ if (s.total() > max) max = s.total();
+ bar->GetBackground()->SetWidth(150 * (total == 0 ? 1 : ((float)s.total() / (float)max)));
+ bar->GetBackground()->SetColor(it->second.color);
+ char string[256];
+ sprintf_s(string, 256, " %-10.10s %6llu %03.1f%%\n", s.name.c_str(), s.total(), total == 0 ? 0 : 100 * ((float)s.total() / (float)total));
+ bar->SetText(string);
+ memset(name, 0, sizeof name);
+ sprintf_s(name, 32, "DeepsBarClick%d", i);
+ bar = m_AshitaCore->GetFontManager()->Get(name);
+ bar->GetBackground()->SetWidth(150);
+ clickMap.insert(std::pair(bar, s.name));
+ i++;
+ }
+ }
+ else
+ {
+ for (auto s : it->second.sources)
+ {
+ if (s.second.name == m_sourceInfo)
+ {
+ std::vector > temp;
+ uint32_t count = 0;
+ for (auto d : s.second.damage)
+ {
+ if (d.second.count != 0 && temp.size() < 15)
+ {
+ temp.push_back(d);
+ count += d.second.count;
+ }
+ }
+ std::sort(temp.begin(), temp.end(), [](std::pair a, std::pair b){return a.second > b.second; });
+ char string[256];
+ sprintf_s(string, 256, " %s - %s\n", it->second.name.c_str(), s.second.name.c_str());
+ deepsBase->SetText(string);
+ deepsBase->GetBackground()->SetWidth(262);
+ repairBars(deepsBase, temp.size());
+ int i = 0;
+ uint32_t max = 0;
+ for (auto s : temp)
+ {
+ char name[32];
+ sprintf_s(name, 32, "DeepsBar%d", i);
+ IFontObject* bar = m_AshitaCore->GetFontManager()->Get(name);
+ if (s.second.count > max) max = s.second.count;
+ bar->GetBackground()->SetWidth(254 * (count == 0 ? 1 : 1 * ((float)s.second.count / (float)max)));
+ bar->GetBackground()->SetColor(it->second.color);
+ char string[256];
+ sprintf_s(string, 256, " %-5s Cnt:%4d Avg:%5d Max:%5d %3.1f%%\n", s.first, s.second.count, s.second.avg(), s.second.max, count == 0 ? 0 : 100 * ((float)s.second.count / (float)count));
+ bar->SetText(string);
+ i++;
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+ deepsBase->GetBackground()->SetHeight(m_bars * 16 + 17);
+}
+
+void Deeps::repairBars(IFontObject* deepsBase, uint8_t size)
+{
+ IFontObject* previous = deepsBase;
+ if (m_AshitaCore->GetFontManager()->Get("DeepsBar0") != NULL)
+ {
+ char name[32] = "DeepsBar0";
+ int i = 1;
+ while (m_AshitaCore->GetFontManager()->Get(name) != NULL)
+ {
+ previous = m_AshitaCore->GetFontManager()->Get(name);
+ sprintf_s(name, 32, "DeepsBar%d", i);
+ i++;
+ }
+ }
+ while (m_bars != size)
+ {
+ if (m_bars > size)
+ {
+ char name[32];
+ sprintf_s(name, 32, "DeepsBar%d", m_bars - 1);
+ m_AshitaCore->GetFontManager()->Delete(name);
+ memset(name, 0, sizeof name);
+ sprintf_s(name, 32, "DeepsBarClick%d", m_bars - 1);
+ m_AshitaCore->GetFontManager()->Delete(name);
+ m_bars--;
+ }
+ else if (m_bars < size)
+ {
+ char name[32];
+ sprintf_s(name, 32, "DeepsBar%d", m_bars);
+ IFontObject* bar = m_AshitaCore->GetFontManager()->Create(name);
+ bar->SetParent(previous);
+ if (previous == deepsBase)
+ {
+ bar->SetPositionX(4);
+ bar->SetPositionY(15);
+ }
+ else
+ {
+ bar->SetAnchorParent((uint32_t)Ashita::FrameAnchor::BottomLeft);
+ bar->SetPositionX(0);
+ bar->SetPositionY(3);
+ }
+ bar->SetAutoResize(false);
+ bar->SetFontFamily("Consolas");
+ bar->SetFontHeight(8);
+ bar->GetBackground()->SetColor(D3DCOLOR_ARGB(0xFF, 0x00, 0x7C, 0x5C));
+ bar->GetBackground()->SetVisibility(true);
+ std::string path = m_AshitaCore->GetAshitaInstallPathA();
+ path.append("\\Resources\\Deeps\\bar.tga");
+ bar->GetBackground()->SetTextureFromFile(path.c_str());
+ bar->GetBackground()->SetWidth(254);
+ bar->GetBackground()->SetHeight(13);
+ bar->SetVisibility(true);
+
+ memset(name, 0, sizeof name);
+ sprintf_s(name, 32, "DeepsBarClick%d", m_bars);
+ IFontObject* clickBar = m_AshitaCore->GetFontManager()->Create(name);
+ clickBar->SetParent(bar);
+ clickBar->SetPositionX(0);
+ clickBar->SetPositionY(0);
+ clickBar->SetAutoResize(false);
+ clickBar->GetBackground()->SetColor(D3DCOLOR_ARGB(0x00, 0x00, 0x00, 0x00));
+ clickBar->GetBackground()->SetVisibility(true);
+ clickBar->GetBackground()->SetWidth(254);
+ clickBar->GetBackground()->SetHeight(13);
+ clickBar->SetVisibility(true);
+ clickBar->SetMouseEventFunction(g_onClick);
+
+ m_bars++;
+ previous = bar;
+ }
+ }
+}
+
+void Deeps::onClick(int type, IFontObject* font, float xPos, float yPos)
+{
+ if (type == 1 && font == m_AshitaCore->GetFontManager()->Get("DeepsBackground"))
+ {
+ if (m_sourceInfo != "")
+ {
+ m_sourceInfo = "";
+ }
+ else
+ {
+ m_charInfo = 0;
+ }
+ return;
+ }
+
+ if (m_charInfo == 0)
+ {
+ //Char was clicked
+ if (type == 0)
+ {
+ // left click
+ try
+ {
+ auto name = clickMap.at(font);
+ for (auto entity : entities)
+ {
+ if (entity.second.name == name)
+ {
+ m_charInfo = entity.first;
+ break;
+ }
+ }
+ }
+ catch (...)
+ {
+ return;
+ }
+ }
+ }
+ else
+ {
+ if (m_sourceInfo == "")
+ {
+ //source was clicked
+ if (type == 0)
+ {
+ try
+ {
+ auto name = clickMap.at(font);
+ m_sourceInfo.assign(name);
+ }
+ catch (...)
+ {
+ return;
+ }
+ }
+ }
+ }
+}
+
+/**
+ * @brief Gets the interface version this plugin was compiled with.
+ *
+ * @note This is a required export, your plugin must implement this!
+ */
+__declspec(dllexport) double __stdcall GetInterfaceVersion(void)
+{
+ return ASHITA_INTERFACE_VERSION;
+}
+
+/**
+ * @brief Gets the plugin data for this plugin.
+ *
+ * @note This is a required export, your plugin must implement this!
+ */
+__declspec(dllexport) void __stdcall CreatePluginInfo(plugininfo_t* lpBuffer)
+{
+ g_PluginInfo = lpBuffer;
+
+ strcpy_s(g_PluginInfo->Name, sizeof(g_PluginInfo->Name), "Deeps");
+ strcpy_s(g_PluginInfo->Author, sizeof(g_PluginInfo->Author), "kjLotus");
+
+ g_PluginInfo->InterfaceVersion = ASHITA_INTERFACE_VERSION;
+ g_PluginInfo->PluginVersion = 2.03f;
+ g_PluginInfo->Priority = 0;
+}
+
+/**
+ * @brief Creates an instance of this plugin object.
+ *
+ * @note This is a required export, your plugin must implement this!
+ */
+__declspec(dllexport) IPlugin* __stdcall CreatePlugin(void)
+{
+ return (IPlugin*)new Deeps();
+}
+
+void g_onClick(int type, void* font, float xPos, float yPos)
+{
+ g_Deeps->onClick(type, (IFontObject*)font, xPos, yPos);
}
\ No newline at end of file
diff --git a/release/plugins/Deeps.dll b/release/plugins/Deeps.dll
index 3df6b28..7ab9995 100644
Binary files a/release/plugins/Deeps.dll and b/release/plugins/Deeps.dll differ