赞 | 23 |
VIP | 0 |
好人卡 | 0 |
积分 | 11 |
经验 | 0 |
最后登录 | 2023-6-5 |
在线时间 | 39 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 1117
- 在线时间
- 39 小时
- 注册时间
- 2023-2-17
- 帖子
- 66
|
class Rlib
attr_reader :WM_COMMAND
attr_reader :WM_SHOWWINDOW
attr_reader :WS_POPUP
attr_reader :WS_BORDER
attr_reader :WS_SYSMENU
attr_reader :WS_CAPTION
attr_reader :WS_CHILD
attr_reader :WS_VISIBLE
attr_reader :DS_MODALFRAME
attr_reader :BS_DEFPUSHBUTTON
attr_reader :IDOK
attr_reader :IDCANCEL
attr_reader :DG_BUTTON
attr_reader :DG_EDIT
attr_reader :DG_STATIC
attr_reader :DG_LIST
attr_reader :DG_SCROLL
attr_reader :DG_COMBO
attr_reader :TCM_GETCURFOCUS
def initialize
# 导入win32 api
@utf8_MessageBox = Win32API.new('washduck', 'utf8_MessageBox', ['l','p','p','l'], 'l')
@GetSubMenu = Win32API.new('user32', 'GetSubMenu', ['l','l'], 'l')
@utf8_AppendMenu = Win32API.new('washduck', 'utf8_AppendMenu', ['l','l','l','p'], 'l')
@utf8_CreateDialog = Win32API.new('washduck', 'utf8_CreateDialog', ['l','l','l','l','l','p'], 'l')
@utf8_AppendDialogItem = Win32API.new('washduck', 'utf8_AppendDialogItem', ['l','l','l','l','l','l','l','l','p'], 'l')
@ShowDialog = Win32API.new('washduck', 'ShowDialog', 'l', 'l')
@DestoryDialog = Win32API.new('washduck', 'DestoryDialog', 'l', 'l')
@GetWindowTitle = Win32API.new('washduck', 'GetWindowTitle', 'l', 'p')
@EndDialog = Win32API.new('user32', 'EndDialog', ['l','l'], 'l')
@GetDlgItem = Win32API.new('user32', 'GetDlgItem', ['l','l'], 'l')
@GetDlgCtrlID = Win32API.new('user32', 'GetDlgCtrlID', 'l', 'l')
@SendMessageA = Win32API.new('user32', 'SendMessageA', ['l','l','l','l'], 'l')
@GetMemVal = Win32API.new('washduck', 'GetMemVal', 'l', 'l')
@SetMemVal = Win32API.new('washduck', 'SetMemVal', ['l','l'], 'l')
# 窗口消息
@WM_COMMAND = 0x0111
@WM_SHOWWINDOW = 0x0018
# 窗口样式
@WS_POPUP = 0x80000000
@WS_BORDER = 0x00800000
@WS_SYSMENU = 0x00080000
@WS_CAPTION = 0x00C00000
@WS_CHILD = 0x40000000
@WS_VISIBLE = 0x10000000
# 对话框样式
@DS_MODALFRAME = 0x80
# 按钮样式
@BS_DEFPUSHBUTTON = 0x00000001
# 控件消息
@IDOK = 1
@IDCANCEL = 2
# 对话框元素
@DG_BUTTON = 0x0080
@DG_EDIT = 0x0081
@DG_STATIC = 0x0082
@DG_LIST = 0x0083
@DG_SCROLL = 0x0084
@DG_COMBO = 0x0085
# 选项卡操作
@TCM_GETCURFOCUS = 0x1300 + 47
end
def MessageBox(hwnd, text, lpCapition, uType)
return @utf8_MessageBox.call(hwnd, text, lpCapition, uType)
end
def GetSubMenu(menu, index)
return @GetSubMenu.call(menu, index)
end
def AppendMenu(menu, flags, mid, name)
return @utf8_AppendMenu.call(menu, flags, mid, name)
end
def CreateDialog(style, x, y, cx, cy, title)
return @utf8_CreateDialog.call(style, x, y, cx, cy, title)
end
def AppendDialogItem(id, style, x, y, cx, cy, classid, mid, name)
return @utf8_AppendDialogItem.call(id, style, x, y, cx, cy, classid, mid, name)
end
def ShowDialog(id)
return @ShowDialog.call(id)
end
def DestoryDialog(id)
return @DestoryDialog.call(id)
end
def GetWindowTitle(hWnd)
return @GetWindowTitle.call(hWnd)
end
def EndDialog(hWnd, wParam)
return @EndDialog.call(hWnd, wParam)
end
def GetDlgItem(hWnd, mid)
return @GetDlgItem.call(hWnd, mid)
end
def SendMessageA(hWnd, message, wParam, lParam)
return @SendMessageA.call(hWnd, message, wParam, lParam)
end
def GetMemVal(addr)
return @GetMemVal.call(addr)
end
def SetMemVal(addr, val)
return @SetMemVal.call(addr, val)
end
def SetWeaponAtk(val)
SetMemVal(0x00435AEC,val)
SetMemVal(0x00436239,val)
end
def SetWeaponPdef(val)
SetMemVal(0x00435AFF,val)
SetMemVal(0x0043625B,val)
end
def SetWeaponMdef(val)
SetMemVal(0x00435B12,val)
SetMemVal(0x0043627D,val)
end
def SetWeaponStr(min,max)
SetMemVal(0x00435B25,max)
SetMemVal(0x0043629F,max)
SetMemVal(0x00435B2A,min)
SetMemVal(0x004362A4,min)
end
def SetWeaponDex(min,max)
SetMemVal(0x00435B3B,max)
SetMemVal(0x004362C4,max)
SetMemVal(0x00435B40,min)
SetMemVal(0x004362C9,min)
end
def SetWeaponAgi(min,max)
SetMemVal(0x00435B51,max)
SetMemVal(0x004362E9,max)
SetMemVal(0x00435B56,min)
SetMemVal(0x004362EE,min)
end
def SetWeaponInt(min,max)
SetMemVal(0x00435B67,max)
SetMemVal(0x0043630E,max)
SetMemVal(0x00435B6C,min)
SetMemVal(0x00436313,min)
end
def SetArmorPdef(val)
SetMemVal(0x00427E2C,val)
SetMemVal(0x0042858E,val)
end
def SetArmorMdef(val)
SetMemVal(0x00427E3F,val)
SetMemVal(0x004285B0,val)
end
def SetArmorStr(min,max)
SetMemVal(0x00427E62,max)
SetMemVal(0x004285F1,max)
SetMemVal(0x00427E67,min)
SetMemVal(0x004285F6,min)
end
def SetArmorDex(min,max)
SetMemVal(0x00427E78,max)
SetMemVal(0x00428616,max)
SetMemVal(0x00427E7D,min)
SetMemVal(0x0042861b,min)
end
def SetArmorAgi(min,max)
SetMemVal(0x00427E8E,max)
SetMemVal(0x0042863B,max)
SetMemVal(0x00427E93,min)
SetMemVal(0x00428640,min)
end
def SetArmorInt(min,max)
SetMemVal(0x00427EA4,max)
SetMemVal(0x00428660,max)
SetMemVal(0x00427EA9,min)
SetMemVal(0x00428665,min)
end
def SetEnemyStr(val)
SetMemVal(0x0042AEEF,val)
SetMemVal(0x0042BBCC,val)
end
def SetEnemyDex(val)
SetMemVal(0x0042AF02,val)
SetMemVal(0x0042BBF2,val)
end
def SetEnemyAgi(val)
SetMemVal(0x0042AF15,val)
SetMemVal(0x0042BC18,val)
end
def SetEnemyInt(val)
SetMemVal(0x0042AF28,val)
SetMemVal(0x0042BC3E,val)
end
def SetEnemyAtk(val)
SetMemVal(0x0042AF3B,val)
SetMemVal(0x0042BC64,val)
end
def SetEnemyPdef(val)
SetMemVal(0x0042AF4E,val)
SetMemVal(0x0042BC8A,val)
end
def SetEnemyMdef(val)
SetMemVal(0x0042AF61,val)
SetMemVal(0x0042BCB0,val)
end
def SetDatabaseMax(val)
SetMemVal(0x00496C9C,val)
end
def SetMapMaxSize(val)
SetMemVal(0x004888E0,val)
SetMemVal(0x00488906,val)
SetMemVal(0x00488A92,val)
SetMemVal(0x00488AA5,val)
end
end
$rlib = Rlib.new
class PluginWindow
def initialize
@Window = $rlib.CreateDialog($rlib.WS_POPUP | $rlib.WS_BORDER | $rlib.WS_SYSMENU | $rlib.DS_MODALFRAME | $rlib.WS_CAPTION, 10, 10, 300, 300, "插件管理")
$rlib.AppendDialogItem(@window, $rlib.WS_CHILD | $rlib.WS_VISIBLE | $rlib.BS_DEFPUSHBUTTON, 10, 70, 80, 20, $rlib.DG_BUTTON, $rlib.IDOK, "确定")
end
def ShowWindow()
$rlib.ShowDialog(@window)
end
def Update(hWnd, message, wParam, lParam)
case message
when $rlib.WM_COMMAND
case wParam
when $rlib.IDOK
$rlib.MessageBox(0, "你好,这里是插件窗口", '打印', 0)
d = load_data("Data/Actors.rxdata")
$rlib.MessageBox(0, d[1].name, '读取第一个角色名字', 0)
when $rlib.IDCANCEL
$rlib.EndDialog(hWnd, wParam)
end
end
return false
end
end
class DatabaseWindow
def initialize(hWnd)
#$rlib.MessageBox(0, '数据库窗口启动', '调试信息', 0)
@hWnd = hWnd
@tab = $rlib.GetDlgItem(hWnd, 3101)
end
def GetTebIndex()
return $rlib.SendMessageA(@tab, $rlib.TCM_GETCURFOCUS, 0, 0)
end
def Update(hWnd, message, wParam, lParam)
#$rlib.MessageBox(0, message.to_s + ' ' + wParam.to_s, '欢迎', 0)
end
end
class MainWindow
def initialize
#$rlib.MessageBox(0, 'rpg maker xp必将迎来新生', '欢迎', 0)
@plugin = PluginWindow.new
#武器攻击力破限
$rlib.SetWeaponAtk(9999)
#武器物理防御破限
$rlib.SetWeaponPdef(9999)
#武器魔法防御破限
$rlib.SetWeaponMdef(9999)
#武器力量破限
$rlib.SetWeaponStr(-9999, 9999)
#武器灵巧破限
$rlib.SetWeaponDex(-9999, 9999)
#武器速度破限
$rlib.SetWeaponAgi(-9999, 9999)
#武器魔力破限
$rlib.SetWeaponInt(-9999, 9999)
#防具物理防御破限
$rlib.SetArmorPdef(9999)
#防具魔法防御破限
$rlib.SetArmorMdef(9999)
#防具力量破限
$rlib.SetArmorStr(-9999, 9999)
#防具灵巧破限
$rlib.SetArmorDex(-9999, 9999)
#防具速度破限
$rlib.SetArmorAgi(-9999, 9999)
#防具魔力破限
$rlib.SetArmorInt(-9999, 9999)
#敌人攻击力破限
$rlib.SetEnemyAtk(9999)
#敌人物理防御破限
$rlib.SetEnemyPdef(9999)
#敌人魔法防御破限
$rlib.SetEnemyMdef(9999)
#敌人力量破限
$rlib.SetEnemyStr(9999)
#敌人灵巧破限
$rlib.SetEnemyDex(9999)
#敌人速度破限
$rlib.SetEnemyAgi(9999)
#敌人魔力破限
$rlib.SetEnemyInt(9999)
#数据库元素上限破限
$rlib.SetDatabaseMax(9999)
#地图大小破限
$rlib.SetMapMaxSize(9999)
end
def ShowMenu(id, menu)
case id
when 801
sub_menu = $rlib.GetSubMenu(menu, 6)
$rlib.AppendMenu(sub_menu, 0, 100000, '插件')
end
end
def UpdateMain(hWnd, message, wParam, lParam)
case message
when $rlib.WM_COMMAND
case wParam
when 100000
@plugin.ShowWindow
end
end
return false
end
def Update(hWnd, message, wParam, lParam)
title = $rlib.GetWindowTitle(hWnd)
case title
when '插件管理'
return @plugin.Update(hWnd, message, wParam, lParam)
when '数据库'
if message == $rlib.WM_SHOWWINDOW && wParam == 1
@db = DatabaseWindow.new(hWnd)
end
when ''
@db.Update(hWnd, message, wParam, lParam)
else
return UpdateMain(hWnd, message, wParam, lParam)
end
return false
end
end
$_washduck = MainWindow.new |
评分
-
查看全部评分
|