muonline助手helper
MuHelper.h
#pragma once
#include "ProtocolDefines.h"
//#define PICK_TIMER 1002
struct CUSTOM_PICK_INFO
{
BYTE IsPickingEnable;
BYTE IsPickingExcItem;
BYTE IsPickingZen;
BYTE IsPickingJewels;
BYTE IsPickingFeather;
BYTE IsPickingBox;
BYTE IsPickingMixs;
BYTE ItemCoordX;
BYTE ItemCoordY;
BYTE ItemPicked;
};
struct PSWMSG_CUSTOM_PICK_RECV
{
PSWMSG_HEAD header; // C2:F3:E7
CUSTOM_PICK_INFO info;
};
struct PSBMSG_CUSTOM_PICK_SEND
{
PSBMSG_HEAD header;
CUSTOM_PICK_INFO info;
};
struct PickOption
{
const char* text;
float posYOffset;
bool& state;
bool enabled = true;
};
class CMuHelper
{
public:
CMuHelper();
~CMuHelper();
bool GetMuHelperState();
void Toggle();
void Render();
void UpdateMouse();
void UpdatePickTimer();
void CGCustomPickSend();
void GCCustomPickRecv(PSWMSG_CUSTOM_PICK_RECV* lpMsg);
private:
enum ButtonState {
BUTTON_NORMAL = 0,
BUTTON_HOVER = 1,
BUTTON_CLICK = 2
};
// Interface
float MainWidth;
float MainHeight;
float MainPosX;
float MainPosY;
float OptionsBasePosY;
float OptionSpacing;
bool MuHelperSwitch;
bool IsPickingEnable;
bool IsPickingExcItem;
bool IsPickingZen;
bool IsPickingJewels;
bool IsPickingFeather;
bool IsPickingBox;
bool IsPickingMixs;
bool ItemPicked;
bool m_isEditingTime;
int OriginPosInTime;
int ItemCoordX;
int ItemCoordY;
int OriginalPosX;
int OriginalPosY;
int lastPickedX;
int lastPickedY;
int lastWorld;
char m_timeInputBuffer[4];
DWORD m_LastItemGetTime;
const DWORD ITEM_GET_DELAY = 500;
std::vector<PickOption> m_HelperOptions;
private:
ButtonState GetSettingsButtonState(int x, int y, float width, float height);
bool CheckClickOnSave();
bool CheckClickOnClose();
void AddHelperOption(const char* text, float posYOffset, bool& state);
void RenderFrame();
void RenderCheckBox(int x, int y, bool checked);
void RenderOptions();
void RenderActionsButtons();
void UpdateMouseOptions();
void RenderBox(float PosX, float PosY, float Width, float Height, const char* Text, bool Hoverable);
};
extern CMuHelper gMuHelper;
MuHelper.cpp
#include "stdafx.h"
#include "MuHelper.h"
#include "MiniMap.h"
#include "MoveList.h"
#include "EventTimer.h"
#include "LoadModels.h"
#include "Controller.h"
#include "Protocol.h"
#include "MyTextures.h"
#include "MyUtils.h"
CMuHelper gMuHelper;
CMuHelper::CMuHelper()
{
this->IsPickingEnable = false;
this->MuHelperSwitch = false;
this->MainWidth = 190.0f;
this->MainPosX = 5.0f;
this->MainPosY = 5.0f;
this->MainHeight = WindowHeight - 350;
this->OptionsBasePosY = this->MainPosY + 70.0f;
this->OptionSpacing = 15.0f;
this->lastPickedX = 0;
this->lastPickedY = 0;
this->m_LastItemGetTime = 0;
this->OriginPosInTime = 5;
this->m_isEditingTime = false;
memset(this->m_timeInputBuffer, 0, sizeof(this->m_timeInputBuffer));
// Pick system
AddHelperOption("Pick All Jewels", 0.0f, this->IsPickingJewels);
AddHelperOption("Pick Feather", OptionSpacing * 1, this->IsPickingFeather);
AddHelperOption("Pick Item Excellent", OptionSpacing * 2, this->IsPickingExcItem);
AddHelperOption("Pick Box", OptionSpacing * 3, this->IsPickingBox);
AddHelperOption("Pick Mixs", OptionSpacing * 4, this->IsPickingMixs);
AddHelperOption("Pick Zen", OptionSpacing * 5, this->IsPickingZen);
AddHelperOption("Original Position", OptionSpacing * 6, this->IsPickingZen);
// Attack system
AddHelperOption("Auto Attack", OptionSpacing * 10, this->IsPickingZen);
AddHelperOption("Buff Your Self", OptionSpacing * 11, this->IsPickingZen);
AddHelperOption("Buff Party", OptionSpacing * 12, this->IsPickingZen);
AddHelperOption("Auto Potion", OptionSpacing * 13, this->IsPickingZen);
AddHelperOption("Auto Mana", OptionSpacing * 14, this->IsPickingZen);
}
CMuHelper::~CMuHelper()
{
}
bool CMuHelper::GetMuHelperState()
{
return this->MuHelperSwitch;
}
void CMuHelper::Toggle()
{
if (CheckInputInterfaces())
{
return;
}
if (CheckRightInterfaces())
{
/*this->MuHelperSwitch = false;
return;*/
InventoryOpened = false;
CharacterOpened = false;
}
if (gMoveList.GetMoveListState())
{
gMoveList.Toggle();
}
if (gMiniMap.GetMiniMapState())
{
gMiniMap.Toggle();
}
if (gEventTimer.GetEventTimerState())
{
gEventTimer.Toggle();
}
// Adicione aqui quaisquer outras interfaces que devam ser fechadas ao abrir o Mu Helper
this->MuHelperSwitch ^= 1;
PlayBuffer(25, 0, 0);
}
void CMuHelper::Render()
{
RenderActionsButtons();
if (!this->MuHelperSwitch)
{
return;
}
// Use para desabilitar o auto click ao abrir a interface
if (gController.AutoClickState && gController.AutoClick == 1)
{
KillTimer(g_hWnd, WM_AUTOCLICKTIMER);
MouseRButtonPush = false;
MouseRButton = false;
gController.AutoClickState = false;
gController.AutoClick ^= 1;
}
this->RenderFrame();
this->RenderOptions();
}
void CMuHelper::UpdateMouse()
{
if (!this->MuHelperSwitch)
{
return;
}
if (CheckRightInterfaces())
{
this->MuHelperSwitch = false;
return;
}
if (IsWorkZone((int)this->MainPosX, (int)this->MainPosY, (int)this->MainWidth, (int)this->MainHeight))
{
MouseOnWindow = true;
}
UpdateMouseOptions();
}
void CMuHelper::AddHelperOption(const char* text, float posYOffset, bool& state)
{
m_HelperOptions.push_back({ text, posYOffset, state });
}
CMuHelper::ButtonState CMuHelper::GetSettingsButtonState(int x, int y, float width, float height)
{
if (IsWorkZone(x, y, (int)width, (int)height)) {
if (MouseLButton) return BUTTON_CLICK;
return BUTTON_HOVER;
}
return BUTTON_NORMAL;
}
void CMuHelper::CGCustomPickSend()
{
static PSBMSG_CUSTOM_PICK_SEND pMsg;
pMsg.header.set(0xF3, 0x98, sizeof(pMsg));
pMsg.info.IsPickingEnable = this->IsPickingEnable;
pMsg.info.IsPickingExcItem = this->IsPickingExcItem;
pMsg.info.IsPickingZen = this->IsPickingZen;
pMsg.info.IsPickingJewels = this->IsPickingJewels;
pMsg.info.IsPickingFeather = this->IsPickingFeather;
pMsg.info.IsPickingBox = this->IsPickingBox;
pMsg.info.IsPickingMixs = this->IsPickingMixs;
gProtocol.DataSend((BYTE*)&pMsg, pMsg.header.size);
}
void CMuHelper::GCCustomPickRecv(PSWMSG_CUSTOM_PICK_RECV* lpMsg)
{
if (lpMsg == nullptr)
return;
this->ItemCoordX = lpMsg->info.ItemCoordX;
this->ItemCoordY = lpMsg->info.ItemCoordY;
this->ItemPicked = lpMsg->info.ItemPicked != 0;
this->IsPickingEnable = lpMsg->info.IsPickingEnable != 0;
}
void CMuHelper::UpdatePickTimer()
{
//DWORD CurrentTime = GetTickCount();
//if (CurrentTime < this->m_LastItemGetTime)
//{
// return;
//}
if (lastWorld != World && this->IsPickingEnable)
{
this->IsPickingEnable = false;
this->lastPickedX, this->ItemCoordX = 0;
this->lastPickedY, this->ItemCoordX = 0;
this->CGCustomPickSend();
return;
}
if (this->ItemCoordX != 0 && this->ItemCoordY != 0)
{
// Verifica se estas coordenadas já foram processadas
if (this->ItemCoordX == this->lastPickedX && this->ItemCoordY == this->lastPickedY)
{
if (HeroCoordX != this->OriginalPosX && HeroCoordY != this->OriginalPosY)
{
gMyUtils.MoveCoordSend(this->OriginalPosX, this->OriginalPosY);
return;
}
}
if (!this->ItemPicked)
{
gConsole.Write("Try Pick Item on coord (%d, %d)", this->ItemCoordX, this->ItemCoordY);
gMyUtils.MoveCoordSend(this->ItemCoordX, this->ItemCoordY);
// Atualiza as últimas coordenadas processadas
this->lastPickedX = this->ItemCoordX;
this->lastPickedY = this->ItemCoordY;
}
else
{
gConsole.Write("Item Picked on coord (%d, %d)", this->ItemCoordX, this->ItemCoordY);
gMyUtils.MoveCoordSend(this->OriginalPosX, this->OriginalPosY);
// Reseta as coordenadas processadas
this->lastPickedX, this->ItemCoordX = 0;
this->lastPickedY, this->ItemCoordX = 0;
// Atualiza o delay
//this->m_LastItemGetTime = CurrentTime + ITEM_GET_DELAY;
}
}
}
bool CMuHelper::CheckClickOnSave()
{
int x = (float)MainPosX + 15;
int y = (MainPosY + (int)this->MainHeight - 40.0f);
int width = 75.0f;
int height = 21.0f;
if (IsWorkZone(x, y, width, height))
{
if (MouseLButton && MouseLButtonPush)
{
MouseLButtonPush = false;
MouseUpdateTime = 0;
MouseUpdateTimeMax = 6;
this->Toggle();
this->OriginalPosX = HeroCoordX;
this->OriginalPosY = HeroCoordY;
this->CGCustomPickSend();
}
return true;
}
return false;
}
bool CMuHelper::CheckClickOnClose()
{
int x = (this->MainPosX + (this->MainWidth / 2));
int y = (MainPosY + (int)this->MainHeight - 40.0f);
int width = 75.0f;
int height = 21.0f;
if (IsWorkZone(x, y, width, height))
{
if (MouseLButton && MouseLButtonPush)
{
MouseLButtonPush = false;
MouseUpdateTime = 0;
MouseUpdateTimeMax = 6;
this->Toggle();
}
return true;
}
return false;
}
void CMuHelper::RenderFrame()
{
DWORD backupBgTextColor = SetBackgroundTextColor;
DWORD backupTextColor = SetTextColor;
//glColor4f(0.0f, 0.0f, 0.0f, 0.8f);
RenderBitmap(260, this->MainPosX, this->MainPosY, this->MainWidth, 245.0f, (0.0f / 245.0f), (0.0f / 245.0f), (190.0f / 256.0f), (256.0f / 256.0f), true, true);
RenderBitmap(261, this->MainPosX, this->MainPosY + 245.0f, this->MainWidth, 177.0f, (0.0f / 245.0f), (0.0f / 245.0f), (190.0f / 256.0f), (177.0f / 256.0f), true, true);
//RenderColor(this->MainPosX, this->MainPosY, this->MainWidth, this->MainHeight);
glColor3f(1.0f, 1.0f, 1.0f); // Define a cor para branco
EnableAlphaTest(true);
SetBackgroundTextColor = Color4b(255, 255, 255, 0); // <--- Cor de fundo transparente (alpha = 0)
// Title
SetTextColor = Color4b(255, 204, 26, 255);
SelectObject(m_hFontDC, g_hFontBold);
RenderText((int)this->MainPosX + 5, (int)this->MainPosY + 11, "Mu Helper", REAL_WIDTH((int)(this->MainWidth - 10.0f)), RT3_SORT_CENTER, NULL);
// Description
SetTextColor = Color4b(255, 255, 255, 255);
SelectObject(m_hFontDC, g_hFont);
RenderText((int)this->MainPosX + 5, (int)this->MainPosY + 21, "An in-game help system", REAL_WIDTH((int)(this->MainWidth - 10.0f)), RT3_SORT_CENTER, NULL);
// Save
this->RenderBox((float)MainPosX + 20, (float)MainPosY + (int)this->MainHeight - 40.0f, 70.0f, 21.0f, "Save", true);
// Close
this->RenderBox((float)MainPosX + (this->MainWidth / 2) + 4, (float)MainPosY + (int)this->MainHeight - 40.0f, 70.0f, 21.0f, "Close", true);
SetBackgroundTextColor = backupBgTextColor;
SetTextColor = backupTextColor;
}
void CMuHelper::RenderCheckBox(int x, int y, bool checked)
{
DWORD backupBgTextColor = SetBackgroundTextColor;
// Fundo preto
glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
RenderColor(x + 1, y + 1, 8.0f, 8.0f);
// Borda branca
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
RenderColor(x, y, 10.0f, 0.5f); // Topo
RenderColor(x, y, 0.5f, 10.0f); // Esquerda
RenderColor(x + 9.5f, y, 0.5f, 10.0f); // Direita
RenderColor(x, y + 9.5f, 10.0f, 0.5f); // Base
if (checked)
{
glColor3f(1.0f, 0.8f, 0.102f);
RenderColor(x + 2, y + 2, 6.0f, 6.0f);
}
SetBackgroundTextColor = Color4b(255, 255, 255, 0); // <--- Cor de fundo transparente (alpha = 0)
EnableAlphaTest(true);
glColor3f(1.0f, 1.0f, 1.0f);
SetBackgroundTextColor = backupBgTextColor;
}
void CMuHelper::RenderOptions()
{
DWORD backupBgTextColor = SetBackgroundTextColor;
DWORD backupTextColor = SetTextColor;
int posX = (int)this->MainPosX + 10;
SetTextColor = Color4b(255, 255, 255, 255);
SetBackgroundTextColor = Color4b(255, 255, 255, 0);
SelectObject(m_hFontDC, g_hFont);
// Custom pick Title
SetTextColor = Color4b(255, 204, 26, 255);
RenderText((int)this->MainPosX + 5, (int)((OptionSpacing * 3) + 10), "Custom Pick Options", REAL_WIDTH((int)(this->MainWidth - 10.0f)), RT3_SORT_CENTER, NULL);
// Generate Checkboxes
for (const auto& option : m_HelperOptions)
{
if (option.enabled)
{
int posY = (int)(OptionsBasePosY + option.posYOffset);
RenderCheckBox(posX + 5, posY, option.state);
if (option.state)
{
SetTextColor = Color4b(255, 204, 26, 255); // Verde
SelectObject(m_hFontDC, g_hFontBold);
}
else
{
SetTextColor = Color4b(255, 255, 255, 255); // Branco (ou sua cor padrão)
SelectObject(m_hFontDC, g_hFont);
}
RenderText(posX + 20, posY, option.text, 0, RT3_SORT_LEFT, NULL);
}
}
int DivisionPick = (int)(OptionsBasePosY + (OptionSpacing * 7));
// Custom Attack Title
SelectObject(m_hFontDC, g_hFont);
SetTextColor = Color4b(255, 204, 26, 255);
RenderText((int)this->MainPosX + 5, (int)((DivisionPick + 10) + 15), "Custom Attack Options", REAL_WIDTH((int)(this->MainWidth - 10.0f)), RT3_SORT_CENTER, NULL);
// Division
RenderBitmap(279, this->MainPosX, DivisionPick + 6, 190.0f, 10.0f, (0.0f / 256.0f), (0.0f / 16.0f), (190.0f / 256.0f), (10.0f / 16.0f), true, true);
SetBackgroundTextColor = backupBgTextColor;
SetTextColor = backupTextColor;
}
void CMuHelper::RenderActionsButtons()
{
DWORD backupBgTextColor = SetBackgroundTextColor;
DWORD backupTextColor = SetTextColor;
float Width = 20.0f;
float Height = 20.0f;
float u = 0.0f;
float uWidth = 0.85f;
float vHeight = 0.21f;
// Config Button
int ConfigButtonPosX = 5.0f;
int ConfigButtonPosY = (int)((WindowHeight / 2) + 51);
ButtonState ConfigButtonState = GetSettingsButtonState(ConfigButtonPosX, ConfigButtonPosY, Width, Height);
if (ConfigButtonState == BUTTON_CLICK && MouseLButtonPush)
{
MouseLButtonPush = false;
MouseUpdateTime = 0;
MouseUpdateTimeMax = 6;
this->Toggle();
}
if (ConfigButtonState == BUTTON_HOVER)
{
SelectObject(m_hFontDC, g_hFont);
SetBackgroundTextColor = Color4b(255, 255, 255, 0);
SetTextColor = Color4b(255, 255, 255, 255);
RenderTipText(ConfigButtonPosX + 2, ConfigButtonPosY + (int)Height + 5, "Mu Helper");
}
if (this->MuHelperSwitch == 1)
{
ConfigButtonState = BUTTON_CLICK;
}
float ConfigButtonV = vHeight * ConfigButtonState;
// Play
int PlayPauseButtonPosX = 30.0f;
int PlayPauseButtonPosY = (int)((WindowHeight / 2) + 51);
ButtonState PlayPauseButtonState = GetSettingsButtonState(PlayPauseButtonPosX, PlayPauseButtonPosY, Width, Height);
if (PlayPauseButtonState == BUTTON_CLICK && MouseLButtonPush)
{
this->IsPickingEnable = !this->IsPickingEnable;
this->OriginalPosX = HeroCoordX;
this->OriginalPosY = HeroCoordY;
this->lastWorld = World;
//if (this->IsPickingEnable)
// SetTimer(g_hWnd, PICK_TIMER, 2000, 0);
//else
// KillTimer(g_hWnd, PICK_TIMER);
MouseLButtonPush = false;
MouseUpdateTime = 0;
MouseUpdateTimeMax = 6;
this->CGCustomPickSend();
}
if (PlayPauseButtonState == BUTTON_HOVER)
{
SelectObject(m_hFontDC, g_hFont);
SetBackgroundTextColor = Color4b(255, 255, 255, 0);
SetTextColor = Color4b(255, 255, 255, 255);
RenderTipText(PlayPauseButtonPosX + 2, PlayPauseButtonPosY + (int)Height + 5, this->IsPickingEnable ? "Stop Mu Helper" : "Start Mu Helper");
}
if (this->IsPickingEnable)
{
PlayPauseButtonState = BUTTON_CLICK;
//teste
EnableAlphaTest(true);
glColor4f(0.0f, 0.0f, 0.0f, 0.6f);
RenderColor(0, 69, 640.f, 25.f);
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glEnable(GL_TEXTURE_2D);
EnableAlphaTest(false);
EnableAlphaTest(true);
SelectObject(m_hFontDC, g_hFontBold);
SetBackgroundTextColor = 0;
SetTextColor = Color4b(255, 210, 40, 255);
RenderCenteredText(320, 77.f, "Auto Attack Running...");
DisableAlphaBlend();
//teste
SetTextColor = backupTextColor;
SetBackgroundTextColor = backupBgTextColor;
}
float PlayPauseButtonV = vHeight * PlayPauseButtonState;
glColor3f(1.0f, 1.0f, 1.0f);
RenderBitmap(TextureID::BUTTON_SETTINGS, ConfigButtonPosX, ConfigButtonPosY, Width, Height, u, ConfigButtonV, uWidth, vHeight, true, true);
RenderBitmap(this->IsPickingEnable ? TextureID::BUTTON_PAUSE : TextureID::BUTTON_PLAY, PlayPauseButtonPosX, PlayPauseButtonPosY, Width, Height, u, PlayPauseButtonV, uWidth, vHeight, true, true);
}
void CMuHelper::UpdateMouseOptions()
{
int posX = (int)this->MainPosX + 10;
float optionHeight = 10.0f;
if (this->CheckClickOnSave())
{
return;
}
if (this->CheckClickOnClose())
{
return;
}
for (const auto& option : m_HelperOptions)
{
if (option.enabled)
{
int posY = (int)(OptionsBasePosY + option.posYOffset);
if (IsWorkZone(posX, posY, (int)(this->MainWidth - 20), (int)optionHeight))
{
if (MouseLButton && MouseLButtonPush)
{
MouseLButtonPush = false;
MouseUpdateTime = 0;
MouseUpdateTimeMax = 6;
option.state ^= 1;
}
}
}
}
}
void CMuHelper::RenderBox(float PosX, float PosY, float Width, float Height, const char* Text, bool Hoverable)
{
if (!Hoverable)
{
DisableAlphaBlend();
glColor3f(0.4f, 0.4f, 0.4f);
RenderBitmap(240, PosX, PosY, Width, Height, (0.0f / 256.0f), (0.0f / 64.0f), (213.0f / 256.0f), (64.0f / 64.0f), true, true);
}
else
{
DisableAlphaBlend();
glColor3f(1.0f, 1.0f, 1.0f);
RenderBitmap(240, PosX, PosY, Width, Height, (0.0f / 256.0f), (0.0f / 64.0f), (213.0f / 256.0f), (64.0f / 64.0f), true, true);
if (IsWorkZone((int)PosX, (int)PosY, (int)Width, (int)Height))
{
glColor3f(0.8f, 0.6f, 0.4f);
EnableAlphaBlend();
RenderBitmap(240, PosX, PosY, Width, Height, (0.0f / 256.0f), (0.0f / 64.0f), (213.0f / 256.0f), (64.0f / 64.0f), true, true);
glColor3f(1.0f, 1.0f, 1.0f);
DisableAlphaBlend();
}
}
EnableAlphaTest(true);
RenderText((int)PosX, CenterTextPosY(Text, (int)(PosY + (Height / 2))), Text, REAL_WIDTH((int)Width), RT3_SORT_CENTER, NULL);
glColor3f(1.0f, 1.0f, 1.0f);
}
最后更新于 2025-07-11 23:57:38 并被添加「」标签,已有 172 位童鞋阅读过。
本站使用「署名 4.0 国际」创作共享协议,可自由转载、引用,但需署名作者且注明文章出处