決まり文句
この記事で紹介しているのはネットゲームのウルティマオンラインのツール開発に関する内容ですが、ウィンドウメッセージを送ったり受け取ったりしたことの無い方には、VBでアプリケーション間通信の手助けとなるコードが書かれてるかもしれません。
途中からこの記事を見た方は、こちらから全て見ることができます。
スキル情報取得
取得するにあたって、スキル番号が必要だったのですが、初めは分からなかったので0~100の間を取得してみた所、練成・神秘・スローイングまで含めた0~57のIDでした。
スキル関係で取得できたのは、表示値、ベース値、ロック状態、スキル名の4種類。
尚、スキル名はUOAの設定で英語表記を使用していれば英語の名称、日本語表記を設定していれば日本語の名称が帰って来るようです。
スキルキャップも欲しかったのですが、色々試した所見当たりませんでした・・・
Form(抜粋)
<System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
Protected Overrides Sub WndProc(ByRef WMSG As Message)
Select Case (WMSG.Msg)
Case WM_UOA_SKILL_LEVEL
txtLog.AppendText(String.Format("スキル値変動 No:{1} Value:{2}{0}", vbCrLf, WMSG.WParam, WMSG.LParam))
End Select
MyBase.WndProc(WMSG)
End Sub
Private Sub btnGetSkillDisplay_Click(sender As System.Object, e As System.EventArgs) Handles btnGetSkillDisplay.Click
Dim Result As Integer
For i As Integer = 0 To 100
Result = UOALink_GetSkillDisplay(i)
If (Result = -1) Then Exit For
txtLog.AppendText(String.Format("SkillDisplay No:{1} Value:{2}{0}", vbCrLf, i, Result))
Next
End Sub
Private Sub btnGetSkillBased_Click(sender As System.Object, e As System.EventArgs) Handles btnGetSkillBased.Click
Dim Result As Integer
For i As Integer = 0 To 100
Result = UOALink_GetSkillBased(i)
If (Result = -1) Then Exit For
txtLog.AppendText(String.Format("SkillBased No:{1} Value:{2}{0}", vbCrLf, i, Result))
Next
End Sub
Private Sub btnGetSkillLock_Click(sender As System.Object, e As System.EventArgs) Handles btnGetSkillLock.Click
Dim Result As Integer
For i As Integer = 0 To 100
Result = UOALink_GetSkillLock(i)
If (Result = -1) Then Exit For
txtLog.AppendText(String.Format("SkillLock No:{1} Value:{2}{0}", vbCrLf, i, Result))
Next
End Sub
Private Sub btnGetSkillName_Click(sender As System.Object, e As System.EventArgs) Handles btnGetSkillName.Click
Dim Result As Integer
Dim Buf As String
For i As Integer = 0 To 100
Result = UOALink_GetSkillName(i)
If (Result = -1) Then Exit For
Buf = fncGetAtomString(Result)
txtLog.AppendText(String.Format("SkillName No:{1} Value:{2}{0}", vbCrLf, i, Buf))
Next
End Sub
Private Sub btnMessageCheck_Click(sender As System.Object, e As System.EventArgs) Handles btnMessageCheck.Click
Dim Result As Integer
Dim WM As Integer = CInt(Me.txtWM.Text)
Dim WPARAM As Integer = CInt(Me.txtWPARAM.Text)
Dim LPARAM As Integer = CInt(Me.txtLPARAM.Text)
Result = UOALink_SendMessage(WM_USER + WM, WPARAM, LPARAM)
txtLog.AppendText(String.Format("WM Check WM:{1} WPARAM:{2} LPARAM:{3} RESULT:{4}{0}", vbCrLf, WM, WPARAM, LPARAM, Result))
End Sub
Module(抜粋)
Public Const WM_UOA_GET_SKILL As Integer = WM_USER + 203
Public Const WM_UOA_SKILL_LEVEL As Integer = WM_USER + 306
Public Const UOA_GET_SKILL_DISPLAY As Integer = 0
Public Const UOA_GET_SKILL_BASED As Integer = 1
Public Const UOA_GET_SKILL_LOCK As Integer = 2
Public Const UOA_GET_SKILL_NAME As Integer = 3
Public Const UOA_SKILL_STATUS_UP As Integer = 0
Public Const UOA_SKILL_STATUS_DOWN As Integer = 1
Public Const UOA_SKILL_STATUS_LOCK As Integer = 2
Public Function UOALink_GetSkillDisplay(ByVal SkillNo As Integer) As Integer
Dim Result As Integer
Result = UOALink_SendMessage(WM_UOA_GET_SKILL, SkillNo, UOA_GET_SKILL_DISPLAY)
Return Result
End Function
Public Function UOALink_GetSkillBased(ByVal SkillNo As Integer) As Integer
Dim Result As Integer
Result = UOALink_SendMessage(WM_UOA_GET_SKILL, SkillNo, UOA_GET_SKILL_BASED)
Return Result
End Function
Public Function UOALink_GetSkillLock(ByVal SkillNo As Integer) As Integer
Dim Result As Integer
Result = UOALink_SendMessage(WM_UOA_GET_SKILL, SkillNo, UOA_GET_SKILL_LOCK)
Return Result
End Function
Public Function UOALink_GetSkillName(ByVal SkillNo As Integer) As Integer
Dim Result As Integer
Result = UOALink_SendMessage(WM_UOA_GET_SKILL, SkillNo, UOA_GET_SKILL_NAME)
Return Result
End Function
ダウンロード
開いたら File→Download で保存することができます。
0 件のコメント:
コメントを投稿