Skip to content
Permalink
Browse files

You may no longer try to log on to an expansion character from D2DV u…

…sing the automatic logon option.
  • Loading branch information...
nmbook committed Apr 5, 2016
1 parent 1b1ff14 commit 66993f4a02cb60a6261c5a7f4bc7d48fa319851c
Showing with 44 additions and 20 deletions.
  1. +30 −13 trunk/clsMCPHandler.cls
  2. +14 −7 trunk/frmRealm.frm
@@ -149,12 +149,12 @@ On Error GoTo ERROR_HANDLER
Call ds.MCPHandler.RealmServerLogon(sTitle)
Else
' shouldn't happen
Call frmChat.AddChat(RTBColors.ErrorMessageText, "[BNCS] Realm logon error: not found.")
Call frmChat.AddChat(RTBColors.ErrorMessageText, "[BNCS] Realm logon error: That character was not found.")
Call SendEnterChatSequence
frmChat.mnuRealmSwitch.Enabled = True
End If
ElseIf LenB(sUserChoice) > 0 Then
Call frmChat.AddChat(RTBColors.ErrorMessageText, StringFormat("[BNCS] The realm {0}{1}{0} s offline or doesn't exist.", Chr$(34), sUserChoice))
Call frmChat.AddChat(RTBColors.ErrorMessageText, StringFormat("[BNCS] The realm {0}{1}{0} is offline or doesn't exist.", Chr$(34), sUserChoice))
Call SendEnterChatSequence
frmChat.mnuRealmSwitch.Enabled = True
Else
@@ -359,7 +359,7 @@ Private Sub RECV_MCP_CHARDELETE(pBuff As clsDataBuffer)

Select Case Result
Case &H0: Call Event_CharDeleteResponse(True, "Character deleted.")
Case &H49: Call Event_CharDeleteResponse(False, "Character not found.")
Case &H49: Call Event_CharDeleteResponse(False, "That character was not found.")
Case Else: Call Event_CharDeleteResponse(False, "Unknown response to RECV_MCP_CHARDELETE: 0x" & Right$("00000000" & Hex(Result), 4))
End Select
End Sub
@@ -394,10 +394,10 @@ Private Sub RECV_MCP_CHARUPDGRADE(pBuff As clsDataBuffer)

Select Case Result
Case &H0: Call Event_CharUpgradeResponse(True, "Character upgrade successful.")
Case &H46: Call Event_CharUpgradeResponse(False, "Character not found.")
Case &H46: Call Event_CharUpgradeResponse(False, "That character was not found.")
Case &H7A: Call Event_CharUpgradeResponse(False, "Upgrade failed.")
Case &H7B: Call Event_CharUpgradeResponse(False, "Character is expired.")
Case &H7C: Call Event_CharUpgradeResponse(False, "Character is already expansion.")
Case &H7B: Call Event_CharUpgradeResponse(False, "That character has expired.")
Case &H7C: Call Event_CharUpgradeResponse(False, "That is already an expansion character.")
Case Else: Call Event_CharUpgradeResponse(False, "Unknown response to RECV_MCP_CHARDELETE: 0x" & Right$("00000000" & Hex(Result), 4))
End Select
End Sub
@@ -787,6 +787,8 @@ Private Sub Event_CharListResponse()
Dim RealmAutoChooseWait As Long
Dim i As Integer
Dim Character() As Variant
Dim CharStats As clsUserStats
Dim CharDate As Date

m_RetrievingCharacterList = False

@@ -841,23 +843,38 @@ Private Sub Event_CharListResponse()
' set focus
On Error Resume Next
frmRealm.SetFocus

ElseIf RealmCharIndex >= 0 Then
' valid entry: choose after X seconds
m_AutoChooseWait = RealmAutoChooseWait
m_AutoChooseTarget = RealmCharIndex
If m_AutoChooseWait = 0 Then
Character() = m_CharacterList.Item(m_AutoChooseTarget + 1)
Set CharStats = Character(1)
CharDate = Character(2)
If LenB(Character(0)) > 0 Then
frmChat.AddChat RTBColors.InformationText, "[REALM] Automatically logging on as " & Character(0) & "..."
Call SEND_MCP_CHARLOGON(Character(0))
If (Sgn(DateDiff("s", UtcNow, CharDate)) >= 0) Then
' must be PX2D if isExpansion, otherwise doesn't matter
If (CharStats.IsExpansionCharacter() Imp (BotVars.Product = "PX2D")) Then
frmChat.AddChat RTBColors.InformationText, "[REALM] Automatically logging on as " & Character(0) & "..."
Call SEND_MCP_CHARLOGON(Character(0))
Exit Sub
Else
frmChat.AddChat RTBColors.ErrorMessageText, "[REALM] Character auto-logon fail: You must use Diablo II: Lord of Destruction to choose that character."
End If
Else
frmChat.AddChat RTBColors.ErrorMessageText, "[REALM] Character auto-logon fail: That character has expired."
End If
Else
frmChat.AddChat RTBColors.ErrorMessageText, "[REALM] Character choose fail."
frmRealm.Show
frmChat.AddChat RTBColors.ErrorMessageText, "[REALM] Character auto-logon fail: Empty character name."
End If
Else
frmChat.AddChat RTBColors.SuccessText, "[REALM] Listed " & m_CharacterList.Count & " characters."
frmRealm.Show
End If

frmChat.AddChat RTBColors.SuccessText, "[REALM] Listed " & m_CharacterList.Count & " characters."

m_AutoChooseWait = -1
frmRealm.Show

Else
If m_CharacterList.Count = 0 Then
frmChat.AddChat RTBColors.ErrorMessageText, "[REALM] There are no characters on this account."
@@ -791,6 +791,8 @@ Private Sub Form_Unload(Cancel As Integer)

SendEnterChatSequence
frmChat.mnuRealmSwitch.Enabled = True
m_Unload_SuccessfulLogin = True
ds.MCPHandler.IsRealmError = False
End If

ds.MCPHandler.FormActive = False
@@ -1076,7 +1078,7 @@ Public Sub CharCreateResponse(ByVal Success As Boolean, ByVal Message As String)
' focus on the textbox since the character create failed
With txtCharName
.selStart = 0
.selLength = Len(.Text)
.SelLength = Len(.Text)
On Error Resume Next
.SetFocus
End With
@@ -1234,7 +1236,7 @@ Private Sub btnChoose_Click()
With lvwChars
If Not (.SelectedItem Is Nothing) Then
If Not CanChooseCharacter(.SelectedItem.Tag) Then
frmChat.AddChat RTBColors.ErrorMessageText, "[REALM] That is an expansion character. Please log on using Diablo II: Lord of Destruction."
frmChat.AddChat RTBColors.ErrorMessageText, "[REALM] You must use Diablo II: Lord of Destruction to choose that character."
Else
Call ds.MCPHandler.SEND_MCP_CHARLOGON(.SelectedItem.Key)
m_Unload_SuccessfulLogin = True
@@ -1313,14 +1315,14 @@ Private Sub tmrLoginTimeout_Timer()
Dim i As Integer

For i = 0 To ds.MCPHandler.CharacterCount - 1
If Not IsDateExpired(ds.MCPHandler.CharacterExpires(i)) Then
If Not IsDateExpired(ds.MCPHandler.CharacterExpires(i)) Or Not CanChooseCharacter(indexValid) Then
indexValid = i
Exit For
End If
Next i
' if choose setting, then select only if not expired
Else
If IsDateExpired(ds.MCPHandler.CharacterExpires(indexValid)) Then
If IsDateExpired(ds.MCPHandler.CharacterExpires(indexValid)) Or Not CanChooseCharacter(indexValid) Then
indexValid = -1
End If
End If
@@ -1336,9 +1338,13 @@ Private Sub tmrLoginTimeout_Timer()

If m_Ticks <= 1 Then
tmrLoginTimeout.Enabled = False
Call ds.MCPHandler.SEND_MCP_CHARLOGON(ds.MCPHandler.CharacterName(indexValid))
m_Unload_SuccessfulLogin = True
ds.MCPHandler.IsRealmError = False
If Not CanChooseCharacter(indexValid) Then
frmChat.AddChat RTBColors.ErrorMessageText, "[REALM] You must use Diablo II: Lord of Destruction to choose that character."
Else
Call ds.MCPHandler.SEND_MCP_CHARLOGON(ds.MCPHandler.CharacterName(indexValid))
m_Unload_SuccessfulLogin = True
ds.MCPHandler.IsRealmError = False
End If
End If
Else
' warning label
@@ -1394,6 +1400,7 @@ Private Function CanChooseCharacter(ByVal CharIndex As Integer) As Boolean

Set Stats = ds.MCPHandler.CharacterStats(CharIndex)

' must be PX2D if isExpansion, otherwise doesn't matter
CanChooseCharacter = (Stats.IsExpansionCharacter Imp m_IsExpansion)
End Function

0 comments on commit 66993f4

Please sign in to comment.
You can’t perform that action at this time.