FrmMain.frm
资源名称:vbmcrisrc.rar [点击查看]
上传用户:pcw2004
上传日期:2022-02-02
资源大小:743k
文件大小:89k
源码类别:
DirextX编程
开发平台:
Visual Basic
- VERSION 5.00
- Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
- Begin VB.Form FrmMain
- BorderStyle = 1 'Fixed Single
- Caption = "VB游戏服务器"
- ClientHeight = 4470
- ClientLeft = 6195
- ClientTop = 4035
- ClientWidth = 6090
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MDIChild = -1 'True
- ScaleHeight = 4470
- ScaleWidth = 6090
- Begin VB.CommandButton Command1
- Caption = "生效"
- Height = 375
- Left = 2280
- TabIndex = 4
- Top = 3720
- Width = 1095
- End
- Begin VB.TextBox Text1
- Height = 375
- Left = 1080
- TabIndex = 3
- Text = "1"
- Top = 3720
- Width = 1095
- End
- Begin VB.FileListBox File1
- Height = 810
- Left = 4080
- Pattern = "*.txt"
- TabIndex = 1
- Top = 720
- Visible = 0 'False
- Width = 735
- End
- Begin VB.Timer Timer1
- Enabled = 0 'False
- Interval = 1
- Left = 120
- Top = 2520
- End
- Begin MSWinsockLib.Winsock LoginServer
- Index = 0
- Left = 360
- Top = 240
- _ExtentX = 741
- _ExtentY = 741
- _Version = 393216
- End
- Begin MSWinsockLib.Winsock Server
- Index = 0
- Left = 960
- Top = 240
- _ExtentX = 741
- _ExtentY = 741
- _Version = 393216
- End
- Begin VB.TextBox Text
- Height = 3615
- Left = 0
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 0
- Top = 0
- Width = 6015
- End
- Begin VB.Label Label1
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "经验值倍数"
- Height = 180
- Left = 0
- TabIndex = 2
- Top = 3840
- Width = 900
- End
- End
- Attribute VB_Name = "FrmMain"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Dim LoginCount As Integer
- Sub MonAttackData(MonID As Long)
- Dim i As Integer
- Dim GongVal As Long
- Dim ShangHai As Long
- If Mon(MonID).Pic = 3 And Mon(MonID).PicSpeed = 0 Then
- Select Case Mon(MonID).Face
- Case FaceInfo.UpFace
- If Abs(Player(Mon(MonID).追击目标).X - Mon(MonID).X) = 1 Or Abs(Player(Mon(MonID).追击目标).Y - Mon(MonID).Y) = 1 Then
- GongVal = Abs(Rnd * (Mon(MonID).DBInfo.DC_攻击力 - Mon(MonID).DBInfo.DCMax_最大攻击力) + IIf(Mon(MonID).DBInfo.DCMax_最大攻击力 > Mon(MonID).DBInfo.DC_攻击力, Mon(MonID).DBInfo.DCMax_最大攻击力, Mon(MonID).DBInfo.DC_攻击力))
- ShangHai = GongVal - (Abs(Rnd * (Player(Mon(MonID).追击目标).AC1 - Player(Mon(MonID).追击目标).Ac2) + IIf(Player(Mon(MonID).追击目标).Ac2 - Player(Mon(MonID).追击目标).AC1, Player(Mon(MonID).追击目标).Ac2, Player(Mon(MonID).追击目标).AC1)))
- If ShangHai > 0 And Player(Mon(MonID).追击目标).HP > 0 Then
- Player(Mon(MonID).追击目标).HP = Player(Mon(MonID).追击目标).HP - ShangHai
- If Player(Mon(MonID).追击目标).HP > 0 Then
- Player(Mon(MonID).追击目标).Act = Bruise_受伤
- Player(Mon(MonID).追击目标).Pic = 0
- Player(Mon(MonID).追击目标).PicSpeed = 0
- Else
- Player(Mon(MonID).追击目标).Act = Dead_死亡
- Player(Mon(MonID).追击目标).Pic = 0
- Player(Mon(MonID).追击目标).PicSpeed = 0
- End If
- For i = 1 To playercount
- If Player(i).Connected = True Then
- If Server(i).State = sckConnected Then
- Server(i).SendData PLAYERHP & KONGDATA & Mon(MonID).追击目标 & KONGDATA & Player(Mon(MonID).追击目标).HP & KONGDATA & Player(Mon(MonID).追击目标).MaxHP & NETKONGDATA
- Server(i).SendData PLAYERACTDATA & KONGDATA & Mon(MonID).追击目标 & KONGDATA & Player(Mon(MonID).追击目标).Act & KONGDATA & Player(Mon(MonID).追击目标).Pic & NETKONGDATA
- End If
- End If
- Next
- End If
- End If
- Case FaceInfo.RightUpFace
- If Player(Mon(MonID).追击目标).X = Mon(MonID).X + 1 And Player(Mon(MonID).追击目标).Y = Mon(MonID).Y - 1 Then
- GongVal = Abs(Rnd * (Mon(MonID).DBInfo.DC_攻击力 - Mon(MonID).DBInfo.DCMax_最大攻击力) + IIf(Mon(MonID).DBInfo.DCMax_最大攻击力 > Mon(MonID).DBInfo.DC_攻击力, Mon(MonID).DBInfo.DCMax_最大攻击力, Mon(MonID).DBInfo.DC_攻击力))
- ShangHai = GongVal - (Abs(Rnd * (Player(Mon(MonID).追击目标).AC1 - Player(Mon(MonID).追击目标).Ac2) + IIf(Player(Mon(MonID).追击目标).Ac2 - Player(Mon(MonID).追击目标).AC1, Player(Mon(MonID).追击目标).Ac2, Player(Mon(MonID).追击目标).AC1)))
- If ShangHai > 0 And Player(Mon(MonID).追击目标).HP > 0 Then
- Player(Mon(MonID).追击目标).HP = Player(Mon(MonID).追击目标).HP - ShangHai
- If Player(Mon(MonID).追击目标).HP > 0 Then
- Player(Mon(MonID).追击目标).Act = Bruise_受伤
- Player(Mon(MonID).追击目标).Pic = 0
- Player(Mon(MonID).追击目标).PicSpeed = 0
- Else
- Player(Mon(MonID).追击目标).Act = Dead_死亡
- Player(Mon(MonID).追击目标).Pic = 0
- Player(Mon(MonID).追击目标).PicSpeed = 0
- End If
- For i = 1 To playercount
- If Player(i).Connected = True Then
- If Server(i).State = sckConnected Then
- Server(i).SendData PLAYERHP & KONGDATA & Mon(MonID).追击目标 & KONGDATA & Player(Mon(MonID).追击目标).HP & KONGDATA & Player(Mon(MonID).追击目标).MaxHP & NETKONGDATA
- Server(i).SendData PLAYERACTDATA & KONGDATA & Mon(MonID).追击目标 & KONGDATA & Player(Mon(MonID).追击目标).Act & KONGDATA & Player(Mon(MonID).追击目标).Pic & NETKONGDATA
- End If
- End If
- Next
- End If
- End If
- Case FaceInfo.RightFace
- If Player(Mon(MonID).追击目标).X = Mon(MonID).X + 1 And Player(Mon(MonID).追击目标).Y = Mon(MonID).Y Then
- GongVal = Abs(Rnd * (Mon(MonID).DBInfo.DC_攻击力 - Mon(MonID).DBInfo.DCMax_最大攻击力) + IIf(Mon(MonID).DBInfo.DCMax_最大攻击力 > Mon(MonID).DBInfo.DC_攻击力, Mon(MonID).DBInfo.DCMax_最大攻击力, Mon(MonID).DBInfo.DC_攻击力))
- ShangHai = GongVal - (Abs(Rnd * (Player(Mon(MonID).追击目标).AC1 - Player(Mon(MonID).追击目标).Ac2) + IIf(Player(Mon(MonID).追击目标).Ac2 - Player(Mon(MonID).追击目标).AC1, Player(Mon(MonID).追击目标).Ac2, Player(Mon(MonID).追击目标).AC1)))
- If ShangHai > 0 And Player(Mon(MonID).追击目标).HP > 0 Then
- Player(Mon(MonID).追击目标).HP = Player(Mon(MonID).追击目标).HP - ShangHai
- If Player(Mon(MonID).追击目标).HP > 0 Then
- Player(Mon(MonID).追击目标).Act = Bruise_受伤
- Player(Mon(MonID).追击目标).Pic = 0
- Player(Mon(MonID).追击目标).PicSpeed = 0
- Else
- Player(Mon(MonID).追击目标).Act = Dead_死亡
- Player(Mon(MonID).追击目标).Pic = 0
- Player(Mon(MonID).追击目标).PicSpeed = 0
- End If
- For i = 1 To playercount
- If Player(i).Connected = True Then
- If Server(i).State = sckConnected Then
- Server(i).SendData PLAYERHP & KONGDATA & Mon(MonID).追击目标 & KONGDATA & Player(Mon(MonID).追击目标).HP & KONGDATA & Player(Mon(MonID).追击目标).MaxHP & NETKONGDATA
- Server(i).SendData PLAYERACTDATA & KONGDATA & Mon(MonID).追击目标 & KONGDATA & Player(Mon(MonID).追击目标).Act & KONGDATA & Player(Mon(MonID).追击目标).Pic & NETKONGDATA
- End If
- End If
- Next
- End If
- End If
- Case FaceInfo.RightDownFace
- If Player(Mon(MonID).追击目标).X = Mon(MonID).X + 1 And Player(Mon(MonID).追击目标).Y = Mon(MonID).Y + 1 Then
- GongVal = Abs(Rnd * (Mon(MonID).DBInfo.DC_攻击力 - Mon(MonID).DBInfo.DCMax_最大攻击力) + IIf(Mon(MonID).DBInfo.DCMax_最大攻击力 > Mon(MonID).DBInfo.DC_攻击力, Mon(MonID).DBInfo.DCMax_最大攻击力, Mon(MonID).DBInfo.DC_攻击力))
- ShangHai = GongVal - (Abs(Rnd * (Player(Mon(MonID).追击目标).AC1 - Player(Mon(MonID).追击目标).Ac2) + IIf(Player(Mon(MonID).追击目标).Ac2 - Player(Mon(MonID).追击目标).AC1, Player(Mon(MonID).追击目标).Ac2, Player(Mon(MonID).追击目标).AC1)))
- If ShangHai > 0 And Player(Mon(MonID).追击目标).HP > 0 Then
- Player(Mon(MonID).追击目标).HP = Player(Mon(MonID).追击目标).HP - ShangHai
- If Player(Mon(MonID).追击目标).HP > 0 Then
- Player(Mon(MonID).追击目标).Act = Bruise_受伤
- Player(Mon(MonID).追击目标).Pic = 0
- Player(Mon(MonID).追击目标).PicSpeed = 0
- Else
- Player(Mon(MonID).追击目标).Act = Dead_死亡
- Player(Mon(MonID).追击目标).Pic = 0
- Player(Mon(MonID).追击目标).PicSpeed = 0
- End If
- For i = 1 To playercount
- If Player(i).Connected = True Then
- If Server(i).State = sckConnected Then
- Server(i).SendData PLAYERHP & KONGDATA & Mon(MonID).追击目标 & KONGDATA & Player(Mon(MonID).追击目标).HP & KONGDATA & Player(Mon(MonID).追击目标).MaxHP & NETKONGDATA
- Server(i).SendData PLAYERACTDATA & KONGDATA & Mon(MonID).追击目标 & KONGDATA & Player(Mon(MonID).追击目标).Act & KONGDATA & Player(Mon(MonID).追击目标).Pic & NETKONGDATA
- End If
- End If
- Next
- End If
- End If
- Case FaceInfo.DownFace
- If Player(Mon(MonID).追击目标).X = Mon(MonID).X And Player(Mon(MonID).追击目标).Y = Mon(MonID).Y + 1 Then
- GongVal = Abs(Rnd * (Mon(MonID).DBInfo.DC_攻击力 - Mon(MonID).DBInfo.DCMax_最大攻击力) + IIf(Mon(MonID).DBInfo.DCMax_最大攻击力 > Mon(MonID).DBInfo.DC_攻击力, Mon(MonID).DBInfo.DCMax_最大攻击力, Mon(MonID).DBInfo.DC_攻击力))
- ShangHai = GongVal - (Abs(Rnd * (Player(Mon(MonID).追击目标).AC1 - Player(Mon(MonID).追击目标).Ac2) + IIf(Player(Mon(MonID).追击目标).Ac2 - Player(Mon(MonID).追击目标).AC1, Player(Mon(MonID).追击目标).Ac2, Player(Mon(MonID).追击目标).AC1)))
- If ShangHai > 0 And Player(Mon(MonID).追击目标).HP > 0 Then
- Player(Mon(MonID).追击目标).HP = Player(Mon(MonID).追击目标).HP - ShangHai
- If Player(Mon(MonID).追击目标).HP > 0 Then
- Player(Mon(MonID).追击目标).Act = Bruise_受伤
- Player(Mon(MonID).追击目标).Pic = 0
- Player(Mon(MonID).追击目标).PicSpeed = 0
- Else
- Player(Mon(MonID).追击目标).Act = Dead_死亡
- Player(Mon(MonID).追击目标).Pic = 0
- Player(Mon(MonID).追击目标).PicSpeed = 0
- End If
- For i = 1 To playercount
- If Player(i).Connected = True Then
- If Server(i).State = sckConnected Then
- Server(i).SendData PLAYERHP & KONGDATA & Mon(MonID).追击目标 & KONGDATA & Player(Mon(MonID).追击目标).HP & KONGDATA & Player(Mon(MonID).追击目标).MaxHP & NETKONGDATA
- Server(i).SendData PLAYERACTDATA & KONGDATA & Mon(MonID).追击目标 & KONGDATA & Player(Mon(MonID).追击目标).Act & KONGDATA & Player(Mon(MonID).追击目标).Pic & NETKONGDATA
- End If
- End If
- Next
- End If
- End If
- Case FaceInfo.LeftDownFace
- If Player(Mon(MonID).追击目标).X = Mon(MonID).X - 1 And Player(Mon(MonID).追击目标).Y = Mon(MonID).Y + 1 Then
- GongVal = Abs(Rnd * (Mon(MonID).DBInfo.DC_攻击力 - Mon(MonID).DBInfo.DCMax_最大攻击力) + IIf(Mon(MonID).DBInfo.DCMax_最大攻击力 > Mon(MonID).DBInfo.DC_攻击力, Mon(MonID).DBInfo.DCMax_最大攻击力, Mon(MonID).DBInfo.DC_攻击力))
- ShangHai = GongVal - (Abs(Rnd * (Player(Mon(MonID).追击目标).AC1 - Player(Mon(MonID).追击目标).Ac2) + IIf(Player(Mon(MonID).追击目标).Ac2 - Player(Mon(MonID).追击目标).AC1, Player(Mon(MonID).追击目标).Ac2, Player(Mon(MonID).追击目标).AC1)))
- If ShangHai > 0 And Player(Mon(MonID).追击目标).HP > 0 Then
- Player(Mon(MonID).追击目标).HP = Player(Mon(MonID).追击目标).HP - ShangHai
- If Player(Mon(MonID).追击目标).HP > 0 Then
- Player(Mon(MonID).追击目标).Act = Bruise_受伤
- Player(Mon(MonID).追击目标).Pic = 0
- Player(Mon(MonID).追击目标).PicSpeed = 0
- Else
- Player(Mon(MonID).追击目标).Act = Dead_死亡
- Player(Mon(MonID).追击目标).Pic = 0
- Player(Mon(MonID).追击目标).PicSpeed = 0
- End If
- For i = 1 To playercount
- If Player(i).Connected = True Then
- If Server(i).State = sckConnected Then
- Server(i).SendData PLAYERHP & KONGDATA & Mon(MonID).追击目标 & KONGDATA & Player(Mon(MonID).追击目标).HP & KONGDATA & Player(Mon(MonID).追击目标).MaxHP & NETKONGDATA
- Server(i).SendData PLAYERACTDATA & KONGDATA & Mon(MonID).追击目标 & KONGDATA & Player(Mon(MonID).追击目标).Act & KONGDATA & Player(Mon(MonID).追击目标).Pic & NETKONGDATA
- End If
- End If
- Next
- End If
- End If
- Case FaceInfo.LeftFace
- If Player(Mon(MonID).追击目标).X = Mon(MonID).X - 1 And Player(Mon(MonID).追击目标).Y = Mon(MonID).Y Then
- GongVal = Abs(Rnd * (Mon(MonID).DBInfo.DC_攻击力 - Mon(MonID).DBInfo.DCMax_最大攻击力) + IIf(Mon(MonID).DBInfo.DCMax_最大攻击力 > Mon(MonID).DBInfo.DC_攻击力, Mon(MonID).DBInfo.DCMax_最大攻击力, Mon(MonID).DBInfo.DC_攻击力))
- ShangHai = GongVal - (Abs(Rnd * (Player(Mon(MonID).追击目标).AC1 - Player(Mon(MonID).追击目标).Ac2) + IIf(Player(Mon(MonID).追击目标).Ac2 - Player(Mon(MonID).追击目标).AC1, Player(Mon(MonID).追击目标).Ac2, Player(Mon(MonID).追击目标).AC1)))
- If ShangHai > 0 And Player(Mon(MonID).追击目标).HP > 0 Then
- Player(Mon(MonID).追击目标).HP = Player(Mon(MonID).追击目标).HP - ShangHai
- If Player(Mon(MonID).追击目标).HP > 0 Then
- Player(Mon(MonID).追击目标).Act = Bruise_受伤
- Player(Mon(MonID).追击目标).Pic = 0
- Player(Mon(MonID).追击目标).PicSpeed = 0
- Else
- Player(Mon(MonID).追击目标).Act = Dead_死亡
- Player(Mon(MonID).追击目标).Pic = 0
- Player(Mon(MonID).追击目标).PicSpeed = 0
- End If
- For i = 1 To playercount
- If Player(i).Connected = True Then
- If Server(i).State = sckConnected Then
- Server(i).SendData PLAYERHP & KONGDATA & Mon(MonID).追击目标 & KONGDATA & Player(Mon(MonID).追击目标).HP & KONGDATA & Player(Mon(MonID).追击目标).MaxHP & NETKONGDATA
- Server(i).SendData PLAYERACTDATA & KONGDATA & Mon(MonID).追击目标 & KONGDATA & Player(Mon(MonID).追击目标).Act & KONGDATA & Player(Mon(MonID).追击目标).Pic & NETKONGDATA
- End If
- End If
- Next
- End If
- End If
- Case FaceInfo.LeftUpFace
- If Player(Mon(MonID).追击目标).X = Mon(MonID).X - 1 And Player(Mon(MonID).追击目标).Y = Mon(MonID).Y - 1 Then
- GongVal = Abs(Rnd * (Mon(MonID).DBInfo.DC_攻击力 - Mon(MonID).DBInfo.DCMax_最大攻击力) + IIf(Mon(MonID).DBInfo.DCMax_最大攻击力 > Mon(MonID).DBInfo.DC_攻击力, Mon(MonID).DBInfo.DCMax_最大攻击力, Mon(MonID).DBInfo.DC_攻击力))
- ShangHai = GongVal - (Abs(Rnd * (Player(Mon(MonID).追击目标).AC1 - Player(Mon(MonID).追击目标).Ac2) + IIf(Player(Mon(MonID).追击目标).Ac2 - Player(Mon(MonID).追击目标).AC1, Player(Mon(MonID).追击目标).Ac2, Player(Mon(MonID).追击目标).AC1)))
- If ShangHai > 0 And Player(Mon(MonID).追击目标).HP > 0 Then
- Player(Mon(MonID).追击目标).HP = Player(Mon(MonID).追击目标).HP - ShangHai
- If Player(Mon(MonID).追击目标).HP > 0 Then
- Player(Mon(MonID).追击目标).Act = Bruise_受伤
- Player(Mon(MonID).追击目标).Pic = 0
- Player(Mon(MonID).追击目标).PicSpeed = 0
- Else
- Player(Mon(MonID).追击目标).Act = Dead_死亡
- Player(Mon(MonID).追击目标).Pic = 0
- Player(Mon(MonID).追击目标).PicSpeed = 0
- End If
- For i = 1 To playercount
- If Player(i).Connected = True Then
- If Server(i).State = sckConnected Then
- Server(i).SendData PLAYERHP & KONGDATA & Mon(MonID).追击目标 & KONGDATA & Player(Mon(MonID).追击目标).HP & KONGDATA & Player(Mon(MonID).追击目标).MaxHP & NETKONGDATA
- Server(i).SendData PLAYERACTDATA & KONGDATA & Mon(MonID).追击目标 & KONGDATA & Player(Mon(MonID).追击目标).Act & KONGDATA & Player(Mon(MonID).追击目标).Pic & NETKONGDATA
- End If
- End If
- Next
- End If
- End If
- End Select
- End If
- End Sub
- Sub MonActInfo(MonNum As Long, MonRace As Integer, MonRaceImage As Integer)
- Dim i As Long, j As Long
- Select Case MonRace
- Case Is <> 51, 52
- If Abs(Player(Mon(MonNum).追击目标).X - Mon(MonNum).X) <= 1 And Abs(Player(Mon(MonNum).追击目标).Y - Mon(MonNum).Y) <= 1 And Rnd * 10 < 5 Then
- Mon(MonNum).Act = AttAck_怪攻击
- Mon(MonNum).Pic = 0
- Mon(MonNum).PicSpeed = 0
- Mon(MonNum).Face = GetMonFace(Player(Mon(MonNum).追击目标).X, Player(Mon(MonNum).追击目标).Y, Mon(MonNum).X, Mon(MonNum).Y)
- For j = 1 To playercount
- If Player(j).Connected = True Then
- If Server(j).State = sckConnected Then
- Server(j).SendData MONACTDATA & KONGDATA & Mon(MonNum).Id & KONGDATA & Mon(Mon(MonNum).Id).Act & KONGDATA & Mon(Mon(MonNum).Id).Face & NETKONGDATA
- End If
- End If
- Next
- End If
- Case 101
- End Select
- End Sub
- '///////// 载入怪物物品
- Public Sub LoadMonItems()
- Dim i As Long, j As Integer, mSS As String, MDD As Variant
- MonItemsFile = 0
- ReDim MonItems(MonItemsFile)
- If File1.ListCount = 0 Then Exit Sub
- MonItemsFile = File1.ListCount
- ReDim MonItems(MonItemsFile)
- For i = 0 To File1.ListCount - 1
- File1.Selected(i) = True
- Open App.Path & "MonItems" & File1.FileName For Input As #1
- MonItems(i + 1).MonName = Left(File1.FileName, Len(File1.FileName) - 4)
- Do While Not EOF(1)
- Line Input #1, mSS
- For j = 9 To 2 Step -1
- mSS = Replace(mSS, String(j, " "), " ")
- Next j
- MDD = Split(mSS, " ")
- If UBound(MDD) >= 1 Then
- If MDD(1) = "金币" Then
- If UBound(MDD) >= 2 Then
- MonItems(i + 1).mItemCount = MonItems(i + 1).mItemCount + 1
- ReDim Preserve MonItems(i + 1).mItem(MonItems(i + 1).mItemCount)
- MonItems(i + 1).mItem(MonItems(i + 1).mItemCount).BaoLi = Right(MDD(0), Len(MDD(0)) - 2)
- MonItems(i + 1).mItem(MonItems(i + 1).mItemCount).ItemName = MDD(1)
- MonItems(i + 1).mItem(MonItems(i + 1).mItemCount).mCount = MDD(2)
- End If
- Else
- MonItems(i + 1).mItemCount = MonItems(i + 1).mItemCount + 1
- ReDim Preserve MonItems(i + 1).mItem(MonItems(i + 1).mItemCount)
- MonItems(i + 1).mItem(MonItems(i + 1).mItemCount).BaoLi = Right(MDD(0), Len(MDD(0)) - 2)
- MonItems(i + 1).mItem(MonItems(i + 1).mItemCount).ItemName = MDD(1)
- End If
- End If
- DoEvents
- Loop
- Close #1
- Next
- ' For i = 1 To MonItemsFile
- ' Open App.Path & "www" & MonItems(i).MonName & ".txt" For Output As #1
- ' If MonItems(i).mItemCount > 0 Then
- ' For j = 1 To MonItems(i).mItemCount
- ' If MonItems(i).mItem(j).ItemName = "金币" Then
- ' Print #1, "1/" & MonItems(i).mItem(j).BaoLi & " " & MonItems(i).mItem(j).ItemName & " " & MonItems(i).mItem(j).mCount
- ' Else
- ' Print #1, "1/" & MonItems(i).mItem(j).BaoLi & " " & MonItems(i).mItem(j).ItemName
- ' End If
- ' Next
- ' End If
- ' Close #1
- ' Next
- End Sub
- Private Sub Command1_Click()
- If Text1.Text > 0 Then
- mExp = Text1.Text
- Text.Text = Text.Text & "修改经验值倍数为:" & mExp & vbCrLf
- End If
- End Sub
- Private Sub Form_Load()
- Me.Show
- DoEvents
- File1.Path = App.Path & "MonItems"
- mExp = 1
- Map.Width = 100
- Map.Height = 100
- ReDim Map.Map3(Map.Width, Map.Height)
- ReDim Map.Map4(Map.Width, Map.Height)
- ReDim Map.Map5(Map.Width, Map.Height)
- MapItemCount = 0
- ReDim MapItem(MapItemCount)
- Text.Text = Text.Text & "服务器正在启动......" & vbCrLf
- LoadLevelHP
- Text.Text = Text.Text & "正在加载魔法技能数据......" & vbCrLf
- LoadMagicDBData
- Text.Text = Text.Text & "加载魔法技能数据成功......" & vbCrLf
- Text.Text = Text.Text & "正在加载物品数据......" & vbCrLf
- LoadItemDBData
- Text.Text = Text.Text & "加载物品数据成功......" & vbCrLf
- Text.Text = Text.Text & "正在加载NPC数据......" & vbCrLf
- LoadNPCInfo
- Text.Text = Text.Text & "加载NPC数据成功......" & vbCrLf
- Text.Text = Text.Text & "正在加载等级经验......" & vbCrLf
- LoadLevelExpData
- Text.Text = Text.Text & "加载等级经验成功......" & vbCrLf
- Text.Text = Text.Text & "正在加载注册ID数据......" & vbCrLf
- loadRegPlayerInfo
- Text.Text = Text.Text & "加载注册ID数据成功......" & vbCrLf
- Text.Text = Text.Text & "正在加载怪物数据......" & vbCrLf
- LoadMonDBData
- Text.Text = Text.Text & "加载怪物数据成功......" & vbCrLf
- Text.Text = Text.Text & "正在加载怪物爆率......" & vbCrLf
- LoadMonItems
- Text.Text = Text.Text & "加载怪物爆率成功......" & vbCrLf
- LoadMonGen
- InitMon
- InitMapItem
- ServerIP = ReadINIFile("Main", "ServerIP", App.Path & "Main.ini")
- ServerPort = ReadINIFile("Main", "ServerPort", App.Path & "Main.ini")
- Server(0).Bind 7001, ServerIP
- Server(0).Listen
- LoginServer(0).Bind ServerPort, ServerIP
- LoginServer(0).Listen
- Text.Text = Text.Text & "服务器启动完成......" & vbCrLf
- mSleep 500
- GameLoop
- End Sub
- Sub InitMapItem()
- Dim i As Long
- MapItemCount = 0
- ReDim MapItem(MapItemCount)
- For i = 1 To MapItemCount
- MapItem(i).Id = i
- MapItem(i).State = True
- MapItem(i).mItem = ItemDB(Rnd * (ItemDBCount - 1) + 1)
- MapItem(i).X = Rnd * Map.Width
- MapItem(i).Y = Rnd * Map.Height
- Next
- End Sub
- Private Sub GameLoop()
- mStart = True
- Do While mStart
- If GetTickCount - LTime > 30 Then
- LTime = GetTickCount
- Randomize
- ActMonGen
- MonAct
- End If
- DoEvents
- Loop
- End
- End Sub
- Function GetMonFace(XX1 As Long, YY1 As Long, XX2 As Long, YY2 As Long) As FaceInfo
- If XX1 > XX2 Then
- If YY1 > YY2 Then
- GetMonFace = RightDownFace
- ElseIf YY1 < YY2 Then
- GetMonFace = RightUpFace
- ElseIf YY1 = YY2 Then
- GetMonFace = RightFace
- End If
- ElseIf XX1 < XX2 Then
- If YY1 > YY2 Then
- GetMonFace = LeftDownFace
- ElseIf YY1 < YY2 Then
- GetMonFace = LeftUpFace
- ElseIf YY1 = YY2 Then
- GetMonFace = LeftFace
- End If
- ElseIf XX1 = XX2 Then
- If YY1 > YY2 Then
- GetMonFace = DownFace
- ElseIf YY1 < YY2 Then
- GetMonFace = UpFace
- End If
- End If
- End Function
- Sub MonTexAct(MonID As Long)
- If Mon(MonID).Act = Stone_怪石化 Then
- If Mon(MonID).Pic > 0 Then
- Mon(MonID).PicSpeed = Mon(MonID).PicSpeed + 1
- If Mon(MonID).PicSpeed > 3 Then
- Mon(MonID).PicSpeed = 0
- Mon(MonID).Pic = Mon(MonID).Pic + 1
- End If
- End If
- Else
- Mon(MonID).PicSpeed = Mon(MonID).PicSpeed + 1
- If Mon(MonID).PicSpeed > 2 Then
- Mon(MonID).PicSpeed = 0
- Mon(MonID).Pic = Mon(MonID).Pic + 1
- End If
- End If
- Select Case Mon(MonID).Act
- Case MonActType.Stone_怪石化
- If Mon(MonID).Pic > 5 Then
- Mon(MonID).PicSpeed = 0
- Mon(MonID).Pic = 0
- Mon(MonID).Act = Stand_怪站立
- End If
- Case MonActType.Stand_怪站立
- If Mon(MonID).Pic > 10 Then
- Mon(MonID).PicSpeed = 0
- Mon(MonID).Pic = 0
- Mon(MonID).Act = Stand_怪站立
- End If
- Case MonActType.Move_怪移动
- If Mon(MonID).Pic > 8 Then
- Mon(MonID).Pic = 0
- Mon(MonID).Act = Stand_怪站立
- Mon(MonID).PicSpeed = 0
- End If
- Case MonActType.Bruise_怪受伤
- If Mon(MonID).Pic > 2 Then
- Mon(MonID).Pic = 0
- Mon(MonID).Act = Stand_怪站立
- Mon(MonID).PicSpeed = 0
- End If
- Case MonActType.AttAck_怪攻击
- MonAttackData MonID
- If Mon(MonID).Pic > 5 Then
- Mon(MonID).Pic = 0
- Mon(MonID).PicSpeed = 0
- Mon(MonID).Act = Stand_怪站立
- End If
- Case MonActType.Dead_怪死亡
- If GetTickCount - Mon(MonID).DeadLTime > 5000 Then
- Mon(MonID).Dead = True
- End If
- If Mon(MonID).DBInfo.Appr_形象代码 = 218 Then
- If Mon(MonID).Pic > 19 Then
- Mon(MonID).Pic = 19
- End If
- Else
- If Mon(MonID).Pic > 9 Then
- Mon(MonID).Pic = 9
- End If
- End If
- End Select
- End Sub
- Private Sub MonAct()
- Dim i As Long, j As Integer
- Dim XX As Long, YY As Long
- Dim MM As Integer
- If MonCount <= 0 Then Exit Sub
- For i = 1 To MonCount
- If Mon(i).Dead = False Then
- MonTexAct i ' 怪贴图动作
- If Mon(i).Act = Stand_怪站立 Or Mon(i).Act = Stone_怪石化 Then
- If Mon(i).追击 = False Then
- If GetTickCount - Mon(i).LassWalkTime > Mon(i).DBInfo.WalkWait_行走等待 Then
- Mon(i).LassWalkTime = GetTickCount
- If Rnd * 10 = 10 Then
- XX = Mon(i).X + Rnd * 2 - 1
- YY = Mon(i).Y + Rnd * 2 - 1
- If XX < 0 Then XX = Mon(i).X
- If YY < 0 Then YY = Mon(i).Y
- If XX > Map.Width Then XX = Mon(i).X
- If YY > Map.Height Then YY = Mon(i).Y
- If Mon(i).X <> XX Or Mon(i).Y <> YY Then
- Mon(i).Face = GetMonFace(XX, YY, Mon(i).X, Mon(i).Y)
- For j = 1 To playercount
- If Abs(Mon(i).X - Player(j).X) < 5 And Abs(Mon(i).Y - Player(j).Y) < 5 Then
- If Player(j).Connected = True Then
- If Server(j).State = sckConnected Then
- Server(j).SendData MONFACE & KONGDATA & Mon(i).Id & KONGDATA & Mon(i).Face & NETKONGDATA
- End If
- End If
- End If
- Next
- Map.Map4(Mon(i).X, Mon(i).Y) = Map.Map4(Mon(i).X, Mon(i).Y) - 1
- Mon(i).X = XX
- Mon(i).Y = YY
- Mon(i).Act = Move_怪移动
- Mon(i).Pic = 0
- Mon(i).PicSpeed = 0
- Map.Map4(Mon(i).X, Mon(i).Y) = Map.Map4(Mon(i).X, Mon(i).Y) + 1
- For j = 1 To playercount
- If Abs(Mon(i).X - Player(j).X) < 17 And Abs(Mon(i).Y - Player(j).Y) < 20 Then
- If Player(j).Connected = True Then
- If Server(j).State = sckConnected Then
- Server(j).SendData MONMOVE & KONGDATA & Mon(i).Id & KONGDATA & Mon(i).X & KONGDATA & Mon(i).Y & NETKONGDATA
- ' mSendDataMonInfo j
- End If
- End If
- End If
- Next
- End If
- End If
- End If
- For j = 1 To playercount
- If Abs(Mon(i).X - Player(j).X) < 5 And Abs(Mon(i).Y - Player(j).Y) < 5 Then
- Mon(i).追击 = True
- Mon(i).追击目标 = j
- If Mon(i).Act = Stone_怪石化 And Mon(i).Pic = 0 Then Mon(i).Pic = 1
- Exit For
- End If
- Next
- ElseIf Mon(i).追击 = True Then
- If Abs(Mon(i).X - Player(Mon(i).追击目标).X) > 10 Or Abs(Mon(i).Y - Player(Mon(i).追击目标).Y) > 10 Or Player(Mon(i).追击目标).Connected = False Or Player(Mon(i).追击目标).Act = Dead_死亡 Then
- Mon(i).追击 = False
- Else
- If GetTickCount - Mon(i).LassWalkTime > Mon(i).DBInfo.WalkWait_行走等待 And Rnd * 10 < 1 Then
- Mon(i).LassWalkTime = GetTickCount
- MonActInfo i, Mon(i).DBInfo.Race_种族, Mon(i).DBInfo.RaceImage_种族图像
- If Mon(i).Act = Stand_怪站立 Then
- XX = Player(Mon(i).追击目标).X: YY = Player(Mon(i).追击目标).Y
- FindPath Mon(i).X, Mon(i).Y, XX, YY, Mon(i).WayPath, Mon(i).Way, True
- If XX < 0 Then XX = Mon(i).X
- If YY < 0 Then YY = Mon(i).Y
- If XX > Map.Width Then XX = Mon(i).X
- If YY > Map.Height Then YY = Mon(i).Y
- If Mon(i).X <> Mon(i).Way(Mon(i).WayPath).X Or Mon(i).Y <> Mon(i).Way(Mon(i).WayPath).Y Then
- Mon(i).Face = GetMonFace(Mon(i).Way(Mon(i).WayPath).X, Mon(i).Way(Mon(i).WayPath).Y, Mon(i).X, Mon(i).Y)
- For j = 1 To playercount
- If Abs(Mon(i).X - Player(j).X) < 17 And Abs(Mon(i).Y - Player(j).Y) < 20 Then
- If Player(j).Connected = True Then
- If Server(j).State = sckConnected Then
- Server(j).SendData MONFACE & KONGDATA & Mon(i).Id & KONGDATA & Mon(i).Face & NETKONGDATA
- End If
- End If
- End If
- Next
- Map.Map4(Mon(i).X, Mon(i).Y) = Map.Map4(Mon(i).X, Mon(i).Y) - 1
- Mon(i).X = Mon(i).Way(Mon(i).WayPath).X
- Mon(i).Y = Mon(i).Way(Mon(i).WayPath).Y
- Mon(i).Act = Move_怪移动
- Mon(i).Pic = 0
- Mon(i).PicSpeed = 0
- Map.Map4(Mon(i).X, Mon(i).Y) = Map.Map4(Mon(i).X, Mon(i).Y) + 1
- For j = 1 To playercount
- If Abs(Mon(i).X - Player(j).X) < 17 And Abs(Mon(i).Y - Player(j).Y) < 20 Then
- If Player(j).Connected = True Then
- If Server(j).State = sckConnected Then
- Server(j).SendData MONMOVE & KONGDATA & Mon(i).Id & KONGDATA & Mon(i).X & KONGDATA & Mon(i).Y & NETKONGDATA
- ' mSendDataMonInfo j
- End If
- End If
- End If
- Next
- End If
- End If
- End If
- End If
- End If
- End If
- End If
- Next
- End Sub
- '//////// 发送数据
- Private Sub ServerSendData(mNum As Integer, Str As String)
- If Server(mNum).State = sckConnected Then
- Server(mNum).SendData Str & NETKONGDATA
- End If
- End Sub
- Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
- Cancel = 1
- Me.Hide
- '
- End Sub
- Private Sub LoginServer_ConnectionRequest(Index As Integer, ByVal requestID As Long)
- Dim i As Integer
- Dim Work As Boolean
- If LoginCount > 0 Then
- For i = 1 To LoginCount
- If LoginServer(i).State = 0 Then
- LoginServer(i).Accept requestID
- Work = True
- Exit For
- End If
- Next
- End If
- If Work = False Then
- LoginCount = LoginCount + 1
- Load LoginServer(LoginCount)
- LoginServer(LoginCount).Accept requestID
- Work = True
- End If
- End Sub
- Private Sub LoginServer_DataArrival(Index As Integer, ByVal bytesTotal As Long)
- Dim mData As String
- LoginServer(Index).GetData mData, vbString
- ExecuteNETData mData, Index
- End Sub
- Private Sub LoginServer_Error(Index As Integer, ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
- LoginServer(Index).Close
- End Sub
- Private Sub Server_Close(Index As Integer)
- Unload Server(Index)
- Player(Index).Connected = False
- Map.Map3(Player(Index).X, Player(Index).Y) = Map.Map3(Player(Index).X, Player(Index).Y) - 1
- Text.Text = Text.Text & "玩家[" & Player(Index).Name_名字 & "]下线了!......" & vbCrLf
- SaveHero = Player(Index)
- SavePlayerInfo
- Dim i As Integer
- For i = 1 To playercount
- If Player(i).Connected = True Then
- ' Server(i).SendData PLAYEREND & KONGDATA & Index & NETKONGDATA
- ServerSendData i, PLAYEREND & KONGDATA & Index
- End If
- Next
- Player(Index).Name_名字 = ""
- End Sub
- Private Sub Server_ConnectionRequest(Index As Integer, ByVal requestID As Long)
- Dim i As Integer, Work As Boolean
- Dim mNum As Integer
- If playercount = 0 Then
- playercount = playercount + 1
- ReDim Preserve Player(playercount)
- Load Server(playercount)
- Server(playercount).Accept requestID
- Server(playercount).SendData NOWPLAYERCOUNT & KONGDATA & playercount & NETKONGDATA
- Server(playercount).SendData PlayerNum & KONGDATA & playercount & NETKONGDATA
- Player(playercount).Connected = True
- Work = True
- mNum = playercount
- End If
- If Work = False Then
- For i = 1 To playercount
- If Player(i).Connected = False Then
- Player(i).Connected = True
- Load Server(i)
- Server(i).Accept requestID
- Server(i).SendData NOWPLAYERCOUNT & KONGDATA & playercount & NETKONGDATA
- Server(i).SendData PlayerNum & KONGDATA & i & NETKONGDATA
- Work = True
- mNum = i
- Exit For
- End If
- Next
- End If
- If Work = False Then
- playercount = playercount + 1
- ReDim Preserve Player(playercount)
- Load Server(playercount)
- Server(playercount).Accept requestID
- Server(playercount).SendData NOWPLAYERCOUNT & KONGDATA & playercount & NETKONGDATA
- Server(playercount).SendData PlayerNum & KONGDATA & i & NETKONGDATA
- Player(playercount).Connected = True
- Work = True
- mNum = playercount
- End If
- Text.Text = Text.Text & "当前在线人数:" & playercount & vbCrLf
- For i = 1 To playercount
- If i <> mNum Then
- If Player(i).Connected = True Then
- If Server(i).State = 7 Then Server(i).SendData NOWPLAYERCOUNT & KONGDATA & playercount & NETKONGDATA
- End If
- End If
- Next
- End Sub
- Private Sub ExecuteNETData(NowStr As String, Index As Integer)
- Dim mData As Variant, mWord As Variant, i As Long, j As Integer, l As Integer, M As Integer
- Dim MS As String, MM(3) As String, mInt(2) As Integer
- Dim ShangHaiVal As Long
- Dim NowExp As Long
- On Error GoTo mErr
- mWord = Split(NowStr, NETKONGDATA)
- For i = 0 To UBound(mWord)
- If Len(mWord(i)) > 4 Then
- mData = Split(mWord(i), KONGDATA)
- Select Case mData(0)
- Case PLAYERDUIITEM '玩家丢物品
- Player(Index).Bag(mData(1)).State = False
- Case JIANITEMDATA '玩家捡地图上物品
- If MapItem(mData(1)).X = mData(2) And MapItem(mData(1)).Y = mData(3) Then
- Dim JianItemOK As Boolean
- JianItemOK = False
- For j = 0 To 39
- If Player(Index).Bag(j).State = False Then
- Player(Index).Bag(j).State = True
- Player(Index).Bag(j).Item = MapItem(mData(1)).mItem
- JianItemOK = True
- Exit For
- End If
- Next
- If JianItemOK = True Then
- Server(Index).SendData GIVEITEMDATA & KONGDATA & Index & KONGDATA & Player(Index).Name_名字 & KONGDATA & ItemStr(MapItem(mData(1)).mItem) & NETKONGDATA
- If mData(1) < MapItemCount Then
- MapItem(mData(1)) = MapItem(MapItemCount)
- End If
- MapItemCount = MapItemCount - 1
- ReDim Preserve MapItem(MapItemCount)
- For j = 1 To playercount
- If Player(j).Connected = True Then
- If Server(j).State = sckConnected Then
- mSendDataMapItemInfo j
- End If
- End If
- Next
- End If
- End If
- Case CMDDATA '命令
- Dim MDD As Variant
- MDD = Split(mData(1), " ")
- If UCase(MDD(0)) = "@LEVEL" Then
- If UBound(MDD) = 1 Then
- Player(Index).Level = MDD(1)
- Player(Index).MaxHP = LevelHP(Player(Index).Level)
- Player(Index).HP = Player(Index).MaxHP
- Server(Index).SendData PLAYERHP & KONGDATA & Index & KONGDATA & Player(Index).HP & KONGDATA & Player(Index).MaxHP & NETKONGDATA
- Server(Index).SendData PLAYERLEVEL & KONGDATA & Index & KONGDATA & Player(Index).Name_名字 & KONGDATA & Player(Index).Level & NETKONGDATA
- Server(Index).SendData PLAYEREXPDATA & KONGDATA & Player(Index).Exp_经验值 & KONGDATA & LevelExp(Player(Index).Level) & NETKONGDATA
- End If
- ElseIf UCase(MDD(0)) = "@MOB" Then
- Dim mMonCount As Long
- If UBound(MDD) >= 4 Then
- MM(0) = MDD(1) '怪名字
- mInt(0) = MDD(3) '怪X
- mInt(1) = MDD(4) '怪Y
- mInt(2) = GetMonDBNum(MM(0))
- If mInt(2) > 0 Then
- ' mMonCount = MonCount
- ' MonCount = MonCount + MDD(2)
- ' ReDim Preserve Mon(MonCount)
- ' Dim H As Long
- AddMon MM(0), mInt(0), mInt(1), Int(MDD(2))
- ' For H = mMonCount To MonCount
- ' AddMon H, MM(0), mInt(0), mInt(1)
- ' Next
- For j = 1 To playercount
- If Player(j).Connected = True Then
- If Server(j).State = sckConnected Then
- mSendDataMonInfo j
- End If
- End If
- Next
- End If
- End If
- ElseIf UCase(MDD(0)) = "@MAKE" Then
- If UBound(MDD) >= 1 Then
- Dim mCount As Integer
- If UBound(MDD) >= 2 Then
- mCount = MDD(2)
- Else
- mCount = 1
- End If
- Dim mItemNum As Integer
- MM(1) = MDD(1)
- mItemNum = GetItemNum(MM(1))
- If mItemNum > 0 Then
- Server(Index).SendData GIVEITEMDATA & KONGDATA & Index & KONGDATA & Player(Index).Name_名字 & KONGDATA & ItemStr(ItemDB(mItemNum)) & KONGDATA & mCount & NETKONGDATA
- End If
- End If
- End If
- Case REGPLAYERID '注册ID 和角色名
- Dim IDOK As Boolean
- IDOK = True
- For j = 0 To RegPlayerCount
- If mData(1) = RegPlayer(j).Id Then
- IDOK = False
- Exit For
- End If
- Next
- If IDOK = True Then
- RegPlayerCount = RegPlayerCount + 1
- ReDim Preserve RegPlayer(RegPlayerCount)
- ReDim Preserve RegPlayer(RegPlayerCount).mPlayer(0)
- RegPlayer(RegPlayerCount).Id = mData(1)
- Text.Text = Text.Text & "注册ID [ " & mData(1) & " ] 成功..." & vbCrLf
- End If
- If IDOK = False Then
- LoginServer(Index).SendData REGIDSTATE & KONGDATA & 0 & KONGDATA & "ID号已被注册!" & NETKONGDATA
- Else
- LoginServer(Index).SendData REGIDSTATE & KONGDATA & 1 & KONGDATA & "恭喜你注册成功!" & NETKONGDATA
- End If
- Case SELHERONUM
- For j = 0 To RegPlayerCount
- If RegPlayer(j).Id = mData(1) Then
- RegPlayer(j).SelNum = mData(2)
- If RegPlayer(j).SelNum = 0 Then RegPlayer(j).SelNum = 1
- LoginServer(Index).SendData SELHERONUM & KONGDATA & mData(1) & KONGDATA & RegPlayer(j).SelNum & NETKONGDATA
- Exit For
- End If
- Next
- Case LOGINID '登陆ID
- Dim Work As Boolean
- For j = 1 To RegPlayerCount
- If mData(1) = RegPlayer(j).Id Then
- Work = True
- If RegPlayer(j).SavePlayerCount > 0 Then
- For l = 1 To RegPlayer(j).SavePlayerCount
- LoginServer(Index).SendData SAVEHERODATA & KONGDATA & l & KONGDATA & RegPlayer(j).mPlayer(l).PlayerName & KONGDATA & RegPlayer(j).mPlayer(l).Level & KONGDATA & RegPlayer(j).mPlayer(l).Job & KONGDATA & RegPlayer(j).mPlayer(l).Sex & NETKONGDATA
- Next
- If RegPlayer(j).SelNum = 0 Then RegPlayer(j).SelNum = 1
- LoginServer(Index).SendData SELHERONUM & KONGDATA & RegPlayer(j).Id & KONGDATA & RegPlayer(j).SelNum & NETKONGDATA
- Exit For
- End If
- End If
- Next
- If Work = False Then
- LoginServer(Index).SendData LOGINSTATE & KONGDATA & 0 & NETKONGDATA
- Else
- LoginServer(Index).SendData LOGINSTATE & KONGDATA & 1 & NETKONGDATA
- End If
- Case REGHERONAME '建立角色
- Work = False
- For j = 0 To RegPlayerCount
- If RegPlayer(j).SavePlayerCount > 0 Then
- For l = 1 To RegPlayer(j).SavePlayerCount
- If RegPlayer(j).mPlayer(l).PlayerName = mData(2) Then
- Work = True
- Exit For
- End If
- Next
- End If
- Next
- If Work = False Then
- For j = 0 To RegPlayerCount
- If RegPlayer(j).Id = mData(1) Then
- RegPlayer(j).SavePlayerCount = RegPlayer(j).SavePlayerCount + 1
- ReDim Preserve RegPlayer(j).mPlayer(RegPlayer(j).SavePlayerCount)
- RegPlayer(j).mPlayer(RegPlayer(j).SavePlayerCount).PlayerName = mData(2)
- RegPlayer(j).mPlayer(RegPlayer(j).SavePlayerCount).Job = mData(3)
- RegPlayer(j).mPlayer(RegPlayer(j).SavePlayerCount).Sex = mData(4)
- LoginServer(Index).SendData SAVEHERODATA & KONGDATA & RegPlayer(j).SavePlayerCount & KONGDATA & RegPlayer(j).mPlayer(RegPlayer(j).SavePlayerCount).PlayerName & KONGDATA & RegPlayer(j).mPlayer(RegPlayer(j).SavePlayerCount).Level & KONGDATA & RegPlayer(j).mPlayer(RegPlayer(j).SavePlayerCount).Job & KONGDATA & RegPlayer(j).mPlayer(RegPlayer(j).SavePlayerCount).Sex & NETKONGDATA
- If RegPlayer(j).SelNum = 0 Then RegPlayer(j).SelNum = 1
- LoginServer(Index).SendData SELHERONUM & KONGDATA & RegPlayer(j).Id & KONGDATA & RegPlayer(j).SelNum & NETKONGDATA
- Exit For
- End If
- Next
- ElseIf Work = True Then
- LoginServer(Index).SendData TISHIDATA & KONGDATA & "该角色名已被注册!" & NETKONGDATA
- End If
- Case LOGINNAME '登陆名字
- MM(1) = mData(1)
- MM(2) = mData(2)
- MM(3) = mData(3)
- If Dir(App.Path & "SavePlayerSave" & MM(1) & ".DB") = "" Then
- SaveHero.Name_名字 = MM(1)
- SaveHero.Job_职业 = MM(2)
- SaveHero.Sex_性别 = MM(3)
- SaveHero.X = 50
- SaveHero.Y = 50
- SaveHero.Level = 1
- SaveHero.HP = LevelHP(SaveHero.Level)
- SaveHero.MaxHP = LevelHP(SaveHero.Level)
- SaveHero.Exp_经验值 = 0
- SaveHero.Clothing.State = True
- SaveHero.Clothing.Item = ItemDB(GetItemNum("布衣(男)"))
- SaveHero.Weapon.State = True
- SaveHero.Weapon.Item = ItemDB(GetItemNum("炼狱"))
- SaveHero.FingerRingLeft.State = True
- SaveHero.FingerRingLeft.Item = ItemDB(GetItemNum("圣战戒指"))
- SaveHero.FingerRingRight.State = True
- SaveHero.FingerRingRight.Item = ItemDB(GetItemNum("圣战戒指"))
- SaveHero.BraceletLeft.State = True
- SaveHero.BraceletLeft.Item = ItemDB(GetItemNum("圣战手镯"))
- SaveHero.BraceletRight.State = True
- SaveHero.BraceletRight.Item = ItemDB(GetItemNum("圣战手镯"))
- SaveHero.HeadPiece.State = True
- SaveHero.HeadPiece.Item = ItemDB(GetItemNum("圣战头盔"))
- SaveHero.Necklace.State = True
- SaveHero.Necklace.Item = ItemDB(GetItemNum("圣战项链"))
- SavePlayerInfo
- End If
- '/////////// 检测角色名是否已经登陆
- Dim LoginNameOK As Boolean
- LoginNameOK = True
- For j = 1 To playercount
- If Player(j).Connected = True Then
- If Player(j).Name_名字 = MM(1) Then
- Server(j).Close
- Unload Server(j)
- Player(j).Name_名字 = ""
- LoginNameOK = False
- Exit For
- End If
- End If
- Next
- ' Download by http://www.codefans.net
- '//////////////////////////////////////////////////////////////////////////
- If LoginNameOK = False Then
- Server(Index).SendData TISHIDATA & KONGDATA & "该角色名已登陆" & NETKONGDATA
- mSleep 200
- Server_Close (Index)
- ElseIf LoginNameOK = True Then
- LoadPlayer Index, MM(1)
- Map.Map3(Player(Index).X, Player(Index).Y) = Map.Map3(Player(Index).X, Player(Index).Y) + 1
- Text.Text = Text.Text & "玩家[" & Player(Index).Name_名字 & "]上线了[" & Server(Index).RemoteHostIP & "] ..." & vbCrLf
- Player(Index).LoginTime = Time
- ' //////////////////////// 发送主角信息 ///////////////////////////////////////////////////////////////////////////////
- Server(Index).SendData PlayerName & KONGDATA & Index & KONGDATA & Player(Index).Name_名字 & NETKONGDATA
- mSleep 100
- Server(Index).SendData PLAYERLEVEL & KONGDATA & Index & KONGDATA & Player(Index).Name_名字 & KONGDATA & Player(Index).Level & NETKONGDATA
- mSleep 100
- Server(Index).SendData PLAYERXY & KONGDATA & Index & KONGDATA & Player(Index).X & KONGDATA & Player(Index).Y & NETKONGDATA
- Server(Index).SendData PLAYERFACEDATA & KONGDATA & Index & KONGDATA & Player(Index).Face & NETKONGDATA
- If Player(Index).HP <= 0 Then
- Player(Index).HP = LevelHP(Player(Index).Level)
- Player(Index).X = 50
- Player(Index).Y = 50
- End If
- Server(Index).SendData PLAYERHP & KONGDATA & Index & KONGDATA & Player(Index).HP & KONGDATA & Player(Index).MaxHP & NETKONGDATA
- Server(Index).SendData PLAYERSEX & KONGDATA & Index & KONGDATA & Player(Index).Sex_性别 & NETKONGDATA
- Server(Index).SendData PLAYEREXPDATA & KONGDATA & Player(Index).Exp_经验值 & KONGDATA & LevelExp(Player(Index).Level) & NETKONGDATA
- If Player(Index).Clothing.State = True Then
- Server(Index).SendData CLOTHINGDATA & KONGDATA & Index & KONGDATA & 1 & KONGDATA & ItemStr(Player(Index).Clothing.Item) & NETKONGDATA
- End If
- If Player(Index).Weapon.State = True Then
- Server(Index).SendData WEAPONDATA & KONGDATA & Index & KONGDATA & 1 & KONGDATA & ItemStr(Player(Index).Weapon.Item) & NETKONGDATA
- End If
- If Player(Index).HeadPiece.State = True Then
- Server(Index).SendData HEADPIECEDATA & KONGDATA & Index & KONGDATA & 1 & KONGDATA & ItemStr(Player(Index).HeadPiece.Item) & NETKONGDATA
- End If
- If Player(Index).Necklace.State = True Then
- Server(Index).SendData NECKLACEDATA & KONGDATA & Index & KONGDATA & 1 & KONGDATA & ItemStr(Player(Index).Necklace.Item) & NETKONGDATA
- End If
- If Player(Index).BraceletLeft.State = True Then
- Server(Index).SendData BRACELETLEFTDATA & KONGDATA & Index & KONGDATA & 1 & KONGDATA & ItemStr(Player(Index).BraceletLeft.Item) & NETKONGDATA
- End If
- If Player(Index).BraceletRight.State = True Then
- Server(Index).SendData BRACELETRIGHTDATA & KONGDATA & Index & KONGDATA & 1 & KONGDATA & ItemStr(Player(Index).BraceletRight.Item) & NETKONGDATA
- End If
- If Player(Index).FingerRingLeft.State = True Then
- Server(Index).SendData FINGERRINGLEFTDATA & KONGDATA & Index & KONGDATA & 1 & KONGDATA & ItemStr(Player(Index).FingerRingLeft.Item) & NETKONGDATA
- End If
- If Player(Index).FingerRingRight.State = True Then
- Server(Index).SendData FINGERRINGRIGHTDATA & KONGDATA & Index & KONGDATA & 1 & KONGDATA & ItemStr(Player(Index).FingerRingRight.Item) & NETKONGDATA
- End If
- '/////////////////////////////////// 发送主角信息结束 //////////////////////////////////////////////////////////////////
- mSleep 300
- For j = 1 To playercount
- If j <> Index Then
- If Player(j).Connected = True Then
- Server(Index).SendData PlayerName & KONGDATA & j & KONGDATA & Player(j).Name_名字 & NETKONGDATA
- mSleep 100
- Server(Index).SendData PLAYERXY & KONGDATA & j & KONGDATA & Player(j).X & KONGDATA & Player(j).Y & NETKONGDATA
- Server(Index).SendData PLAYERFACEDATA & KONGDATA & j & KONGDATA & Player(j).Face & NETKONGDATA
- Server(Index).SendData PLAYERSEX & KONGDATA & j & KONGDATA & Player(j).Sex_性别 & NETKONGDATA
- Server(Index).SendData PLAYERHP & KONGDATA & j & KONGDATA & Player(j).HP & KONGDATA & Player(j).MaxHP & NETKONGDATA
- If Player(j).HP = 0 Then
- Server(Index).SendData PLAYERACTDATA & KONGDATA & j & KONGDATA & HeroActType.Dead_死亡 & KONGDATA & 3 & NETKONGDATA
- End If
- If Player(j).Clothing.State = True Then
- Server(Index).SendData CLOTHINGDATA & KONGDATA & j & KONGDATA & 1 & KONGDATA & ItemStr(Player(j).Clothing.Item) & NETKONGDATA
- End If
- If Player(j).Weapon.State = True Then
- Server(Index).SendData WEAPONDATA & KONGDATA & j & KONGDATA & 1 & KONGDATA & ItemStr(Player(j).Weapon.Item) & NETKONGDATA
- End If
- If Player(j).HeadPiece.State = True Then
- Server(Index).SendData HEADPIECEDATA & KONGDATA & j & KONGDATA & 1 & KONGDATA & ItemStr(Player(j).HeadPiece.Item) & NETKONGDATA
- End If
- If Player(j).Necklace.State = True Then
- Server(Index).SendData NECKLACEDATA & KONGDATA & j & KONGDATA & 1 & KONGDATA & ItemStr(Player(j).Necklace.Item) & NETKONGDATA
- End If
- If Player(j).BraceletLeft.State = True Then
- Server(Index).SendData BRACELETLEFTDATA & KONGDATA & j & KONGDATA & 1 & KONGDATA & ItemStr(Player(j).BraceletLeft.Item) & NETKONGDATA
- End If
- If Player(j).BraceletRight.State = True Then
- Server(Index).SendData BRACELETRIGHTDATA & KONGDATA & j & KONGDATA & 1 & KONGDATA & ItemStr(Player(j).BraceletRight.Item) & NETKONGDATA
- End If
- If Player(j).FingerRingLeft.State = True Then
- Server(Index).SendData FINGERRINGLEFTDATA & KONGDATA & j & KONGDATA & 1 & KONGDATA & ItemStr(Player(j).FingerRingLeft.Item) & NETKONGDATA
- End If
- If Player(j).FingerRingRight.State = True Then
- Server(Index).SendData FINGERRINGRIGHTDATA & KONGDATA & j & KONGDATA & 1 & KONGDATA & ItemStr(Player(j).FingerRingRight.Item) & NETKONGDATA
- End If
- End If
- End If
- Next
- Server(Index).SendData MAPNPCCOUNTINFO & KONGDATA & NpcCount & NETKONGDATA
- For j = 1 To UBound(NPCInfo)
- Server(Index).SendData MAPNPCINFO & KONGDATA & j & KONGDATA & NPCInfo(j).X & KONGDATA & NPCInfo(j).Y & KONGDATA & NPCInfo(j).Name_名称 & KONGDATA & NPCInfo(j).Image & NETKONGDATA
- Next
- For j = 1 To playercount
- If Player(j).Connected = True Then
- If Server(j).State = 7 Then
- Server(j).SendData PlayerName & KONGDATA & Index & KONGDATA & Player(Index).Name_名字 & NETKONGDATA
- mSleep 100
- Server(j).SendData PLAYERXY & KONGDATA & Index & KONGDATA & Player(Index).X & KONGDATA & Player(Index).Y & NETKONGDATA
- Server(j).SendData PLAYERFACEDATA & KONGDATA & Index & KONGDATA & Player(Index).Face & NETKONGDATA
- Server(j).SendData PLAYERHP & KONGDATA & Index & KONGDATA & Player(Index).HP & KONGDATA & Player(Index).MaxHP & NETKONGDATA
- If Player(Index).HP = 0 Then
- Server(j).SendData PLAYERACTDATA & KONGDATA & Index & KONGDATA & HeroActType.Dead_死亡 & KONGDATA & 3 & NETKONGDATA
- End If
- If Player(Index).Clothing.State = True Then
- Server(j).SendData CLOTHINGDATA & KONGDATA & Index & KONGDATA & 1 & KONGDATA & ItemStr(Player(Index).Clothing.Item) & NETKONGDATA
- End If
- If Player(Index).Weapon.State = True Then
- Server(j).SendData WEAPONDATA & KONGDATA & Index & KONGDATA & 1 & KONGDATA & ItemStr(Player(Index).Weapon.Item) & NETKONGDATA
- End If
- ' If Player(Index).HeadPiece.State = True Then
- ' Server(j).SendData HEADPIECEDATA & KONGDATA & Index & KONGDATA & 1 & KONGDATA & ItemStr(Player(Index).HeadPiece.Item) & NETKONGDATA
- ' End If
- ' If Player(Index).Necklace.State = True Then
- ' Server(j).SendData NECKLACEDATA & KONGDATA & Index & KONGDATA & 1 & KONGDATA & ItemStr(Player(Index).Necklace.Item) & NETKONGDATA
- ' End If
- ' If Player(Index).BraceletLeft.State = True Then
- ' Server(j).SendData BRACELETLEFTDATA & KONGDATA & Index & KONGDATA & 1 & KONGDATA & ItemStr(Player(Index).BraceletLeft.Item) & NETKONGDATA
- ' End If
- ' If Player(Index).BraceletRight.State = True Then
- ' Server(j).SendData BRACELETRIGHTDATA & KONGDATA & Index & KONGDATA & 1 & KONGDATA & ItemStr(Player(Index).BraceletRight.Item) & NETKONGDATA
- ' End If
- ' If Player(Index).FingerRingLeft.State = True Then
- ' Server(j).SendData FINGERRINGLEFTDATA & KONGDATA & Index & KONGDATA & 1 & KONGDATA & ItemStr(Player(Index).FingerRingLeft.Item) & NETKONGDATA
- ' End If
- ' If Player(Index).FingerRingRight.State = True Then
- ' Server(j).SendData FINGERRINGRIGHTDATA & KONGDATA & Index & KONGDATA & 1 & KONGDATA & ItemStr(Player(Index).FingerRingRight.Item) & NETKONGDATA
- ' End If
- End If
- End If
- Next
- End If
- mSendDataMonInfo Index
- mSendDataMapItemInfo Index
- mSleep 300
- mSendDataBagItemInfo Index
- Case SCRIPTFUNNAMEINFO '脚本函数名
- MM(1) = mData(3)
- mInt(1) = mData(2)
- mInt(2) = GetFunNum(1, "@main")
- MM(0) = ActScript(mData(1), mData(2), NPCInfo(mData(2)).Script(GetFunNum(mInt(1), MM(1))).ScriptStr)
- If Len(MM(0)) > 0 Then
- If Player(mData(1)).Connected = True Then
- Server(mData(1)).SendData SCRIPTDATAINFO & KONGDATA & mData(2) & KONGDATA & MM(0) & NETKONGDATA
- End If
- End If
- Case TALKINFO '聊天信息
- For j = 1 To playercount
- If Player(j).Connected = True Then
- Server(j).SendData mWord(i) & NETKONGDATA
- End If
- Next
- Case SILIAOINFO
- If Player(mData(3)).Name_名字 = mData(4) And Player(mData(3)).Connected = True Then
- Server(mData(1)).SendData TALKINFO & KONGDATA & mData(3) & KONGDATA & mData(4) & KONGDATA & "/" & mData(4) & " " & mData(5) & KONGDATA & D3DColorRGBA(0, 0, 255, 255) & KONGDATA & 1 & NETKONGDATA
- Server(mData(3)).SendData TALKINFO & KONGDATA & mData(3) & KONGDATA & mData(2) & KONGDATA & mData(2) & "→" & mData(5) & KONGDATA & D3DColorRGBA(0, 0, 255, 255) & KONGDATA & 1 & NETKONGDATA
- Else
- Server(mData(1)).SendData TALKINFO & KONGDATA & mData(3) & KONGDATA & mData(4) & KONGDATA & mData(4) & " 不在线" & KONGDATA & D3DColorRGBA(255, 0, 0, 255) & KONGDATA & 1 & NETKONGDATA
- End If
- Case PLAYERFUHUO '复活
- Player(mData(1)).HP = Player(mData(1)).MaxHP
- For j = 1 To playercount
- If Player(j).Connected = True Then
- Server(j).SendData mWord(i) & NETKONGDATA
- End If
- Next
- Case PLAYERATTACKINFO
- Dim AA As Integer, SS As String
- AA = mData(1)
- SS = mData(2)
- GetPlayerInfo AA, SS
- Case MONSHANGHAI '玩家对怪伤害
- If Mon(mData(1)).Act <> Dead_怪死亡 Then
- If mData(3) = 0 Then
- ShangHaiVal = mData(2) - (Rnd * Mon(mData(1)).DBInfo.AC)
- ElseIf mData(3) = 1 Then
- ShangHaiVal = mData(2) - (Rnd * Mon(mData(1)).DBInfo.MAC)
- End If
- If ShangHaiVal > 0 Then
- Mon(mData(1)).HP = Mon(mData(1)).HP - ShangHaiVal
- If Mon(mData(1)).HP < 0 Then Mon(mData(1)).HP = 0
- If Mon(mData(1)).HP > 0 Then
- Mon(mData(1)).追击 = True
- Mon(mData(1)).追击目标 = Index
- If Mon(mData(1)).Act <> AttAck_怪攻击 Or Mon(mData(1)).Act <> Bruise_怪受伤 Then
- Mon(mData(1)).Act = Bruise_怪受伤
- Mon(mData(1)).Pic = 0
- Mon(mData(1)).PicSpeed = 0
- End If
- ElseIf Mon(mData(1)).HP = 0 Then
- Mon(mData(1)).DeadLTime = GetTickCount
- Mon(mData(1)).Act = Dead_怪死亡
- Mon(mData(1)).Pic = 0
- Mon(mData(1)).PicSpeed = 0
- Dim mMonItemName() As String, mMonItemCount As Integer, FDD As Integer
- For j = 1 To MonItemsFile
- If Mon(mData(1)).DBInfo.Name_名称 = MonItems(j).MonName Then
- If MonItems(j).mItemCount > 0 Then
- For l = 1 To MonItems(j).mItemCount
- FDD = Rnd * MonItems(j).mItem(l).BaoLi
- ' 怪暴东东
- If FDD < 1 Then
- mMonItemCount = mMonItemCount + 1
- ReDim Preserve mMonItemName(mMonItemCount)
- mMonItemName(mMonItemCount) = MonItems(j).mItem(l).ItemName
- End If
- Next
- End If
- End If
- Next
- If mMonItemCount > 0 Then
- ItemsXY mMonItemName(), mMonItemCount, Mon(mData(1)).X, Mon(mData(1)).Y
- End If
- NowExp = Mon(mData(1)).DBInfo.Exp_经验值 * mExp
- Player(Index).Exp_经验值 = Player(Index).Exp_经验值 + NowExp
- Server(Index).SendData PLAYERGETEXP & KONGDATA & NowExp & NETKONGDATA
- If Player(Index).Exp_经验值 > LevelExp(Player(Index).Level) Then
- Player(Index).Level = Player(Index).Level + 1
- Player(Index).MaxHP = LevelHP(Player(Index).Level)
- Player(Index).HP = Player(Index).MaxHP
- Server(Index).SendData PLAYERHP & KONGDATA & Index & KONGDATA & Player(Index).HP & KONGDATA & Player(Index).MaxHP & NETKONGDATA
- Server(Index).SendData PLAYERLEVEL & KONGDATA & Index & KONGDATA & Player(Index).Name_名字 & KONGDATA & Player(Index).Level & NETKONGDATA
- Server(Index).SendData PLAYEREXPDATA & KONGDATA & Player(Index).Exp_经验值 & KONGDATA & LevelExp(Player(Index).Level) & NETKONGDATA
- End If
- End If
- For j = 1 To playercount
- If Abs(Mon(mData(1)).X - Player(j).X) < 17 And Abs(Mon(mData(1)).Y - Player(j).Y) < 20 Then
- If Player(j).Connected = True Then
- If Server(j).State = sckConnected Then
- Server(j).SendData MONHP & KONGDATA & mData(1) & KONGDATA & Mon(mData(1)).HP & KONGDATA & Mon(mData(1)).MaxHP & NETKONGDATA
- Server(j).SendData MONACTDATA & KONGDATA & mData(1) & KONGDATA & Mon(mData(1)).Act & KONGDATA & Mon(mData(1)).Face & NETKONGDATA
- If mMonItemCount > 0 Then
- mSendDataMapItemInfo j
- End If
- End If
- End If
- End If
- Next
- End If
- End If
- Case SHANGHAIDATA '玩家伤害
- If mData(3) = 0 Then
- ShangHaiVal = mData(2) - (Rnd * Abs(Player(mData(1)).AC1 - Player(mData(1)).Ac2) + IIf(Player(mData(1)).AC1 < Player(mData(1)).Ac2, Player(mData(1)).AC1, Player(mData(1)).Ac2))
- ElseIf mData(3) = 1 Then
- ShangHaiVal = mData(2) - (Rnd * Abs(Player(mData(1)).MAC1 - Player(mData(1)).Mac2) + IIf(Player(mData(1)).MAC1 < Player(mData(1)).Mac2, Player(mData(1)).MAC1, Player(mData(1)).Mac2))
- End If
- If ShangHaiVal > 0 Then
- Player(mData(1)).HP = Player(mData(1)).HP - ShangHaiVal
- If Player(mData(1)).HP < 0 Then Player(mData(1)).HP = 0
- For j = 1 To playercount
- If Player(j).Connected = True Then
- Server(j).SendData PLAYERHP & KONGDATA & mData(1) & KONGDATA & Player(mData(1)).HP & KONGDATA & Player(mData(1)).MaxHP & NETKONGDATA
- If Player(mData(1)).HP > 0 Then
- Server(j).SendData PLAYERACTDATA & KONGDATA & mData(1) & KONGDATA & HeroActType.Bruise_受伤 & KONGDATA & 0 & NETKONGDATA
- Else
- Server(j).SendData PLAYERACTDATA & KONGDATA & mData(1) & KONGDATA & HeroActType.Dead_死亡 & KONGDATA & 0 & NETKONGDATA
- End If
- End If
- Next
- End If
- Case PLAYERHP '玩家HP
- Player(mData(1)).HP = mData(2)
- Player(mData(1)).MaxHP = mData(3)
- For j = 1 To playercount
- If Player(j).Connected = True Then
- Server(j).SendData mWord(i) & NETKONGDATA
- End If
- Next
- Case PLAYERJIAOYIITEM '交易物品
- Server(mData(1)).SendData mWord(i) & NETKONGDATA
- Case PLAYERJIAOYIEND '交易取消
- Server(mData(2)).SendData mWord(i) & NETKONGDATA
- Case PLAYERJIAOYIOK '交易确认
- Server(mData(2)).SendData PLAYERJIAOYIOK & KONGDATA & mData(1) & NETKONGDATA
- Case PLAYERJIAOYI '交易
- If Player(mData(2)).Connected And Player(mData(2)).HP > 0 Then
- Server(mData(2)).SendData PLAYERJIAOYI & KONGDATA & mData(1) & NETKONGDATA
- Server(mData(1)).SendData PLAYERJIAOYI & KONGDATA & mData(2) & NETKONGDATA
- End If
- Case PLAYERMP '玩家MP
- Player(mData(1)).MP = mData(2)
- Player(mData(1)).MaxMP = mData(3)
- Case PlayerName '玩家名
- Player(mData(1)).Name_名字 = mData(2)
- Text.Text = Text.Text & "玩家[" & Player(mData(1)).Name_名字 & "]上线了!......" & vbCrLf
- For j = 1 To playercount
- If Player(j).Connected = True Then
- Server(j).SendData mWord(i) & NETKONGDATA
- End If
- Next
- Case PLAYERXY '玩家XY
- Player(mData(1)).X = mData(2)
- Player(mData(1)).Y = mData(3)
- Player(mData(1)).Act = Stand_站立
- Player(mData(1)).ActState = Stand_站立
- For j = 1 To playercount
- If Player(j).Connected = True Then
- If j <> mData(1) Then Server(j).SendData mWord(i) & NETKONGDATA
- End If
- Next
- Case PLAYERATTACKDATA
- For j = 1 To playercount
- ' ServerSendData j, Str(mWord(i))
- If Player(j).Connected = True Then
- If Server(j).State = sckConnected Then
- Server(j).SendData mWord(i) & NETKONGDATA
- End If
- End If
- Next
- Case WALKDATA '玩家走
- Map.Map3(Player(mData(1)).X, Player(mData(1)).Y) = Map.Map3(Player(mData(1)).X, Player(mData(1)).Y) - 1
- Player(mData(1)).Act = walk_走
- Player(mData(1)).Pic = 0
- Player(mData(1)).PicSpeed = 0
- Player(mData(1)).X = mData(2)
- Player(mData(1)).Y = mData(3)
- Player(mData(1)).CanAct = False
- For j = 1 To playercount
- If Player(j).Connected = True Then
- Server(j).SendData mWord(i) & NETKONGDATA
- End If
- Next
- Map.Map3(Player(mData(1)).X, Player(mData(1)).Y) = Map.Map3(Player(mData(1)).X, Player(mData(1)).Y) + 1
- mSendDataMonInfo Index
- mSendDataMapItemInfo Index
- Case RUNDATA '玩家跑
- Map.Map3(Player(mData(1)).X, Player(mData(1)).Y) = Map.Map3(Player(mData(1)).X, Player(mData(1)).Y) - 1
- Player(mData(1)).Act = Run_跑
- Player(mData(1)).Pic = 0
- Player(mData(1)).PicSpeed = 0
- Player(mData(1)).X = mData(2)
- Player(mData(1)).Y = mData(3)
- Player(mData(1)).CanAct = False
- For j = 1 To playercount
- If Player(j).Connected = True Then
- Server(j).SendData mWord(i) & NETKONGDATA
- End If
- Next
- Map.Map3(Player(mData(1)).X, Player(mData(1)).Y) = Map.Map3(Player(mData(1)).X, Player(mData(1)).Y) + 1
- mSendDataMonInfo Index
- mSendDataMapItemInfo Index
- Case PLAYERFACEDATA '玩家方向
- Player(Val(mData(1))).Face = mData(2)
- For j = 1 To playercount
- If Player(j).Connected = True Then
- Server(j).SendData mWord(i) & NETKONGDATA
- End If
- Next
- Case PLAYERMAGICDATA '施放魔法
- If mData(4) = "治愈术" Then
- If Player(Index).HP < Player(Index).MaxHP Then
- Player(Index).HP = Player(Index).HP + 10
- If Player(Index).HP > Player(Index).MaxHP Then
- Player(Index).HP = Player(Index).MaxHP
- End If
- Server(Index).SendData PLAYERHP & KONGDATA & Index & KONGDATA & Player(Index).HP & KONGDATA & Player(Index).MaxHP & NETKONGDATA
- End If
- End If
- For j = 1 To playercount
- If Player(j).Connected = True Then
- Server(j).SendData mWord(i) & NETKONGDATA
- End If
- Next
- Case CLOTHINGDATA '衣服
- Player(mData(1)).Clothing.State = mData(2)
- MS = mData(3)
- If mData(2) <> 0 Then Player(mData(1)).Clothing.Item = GetItem(MS)
- For j = 1 To playercount
- If Player(j).Connected = True Then
- Server(j).SendData mWord(i) & NETKONGDATA
- End If
- Next
- Case WEAPONDATA '武器
- Player(mData(1)).Weapon.State = mData(2)
- MS = mData(3)
- If mData(2) <> 0 Then Player(mData(1)).Weapon.Item = GetItem(MS)
- For j = 1 To playercount
- If Player(j).Connected = True Then
- Server(j).SendData mWord(i) & NETKONGDATA
- End If
- Next
- Case HEADPIECEDATA '头盔
- Player(mData(1)).HeadPiece.State = mData(2)
- MS = mData(3)
- If mData(2) <> 0 Then Player(mData(1)).HeadPiece.Item = GetItem(MS)
- For j = 1 To playercount
- If Player(j).Connected = True Then
- Server(j).SendData mWord(i) & NETKONGDATA
- End If
- Next
- Case NECKLACEDATA '项链
- Player(mData(1)).Necklace.State = mData(2)
- MS = mData(3)
- If mData(2) <> 0 Then Player(mData(1)).Necklace.Item = GetItem(MS)
- For j = 1 To playercount
- If Player(j).Connected = True Then
- Server(j).SendData mWord(i) & NETKONGDATA
- End If
- Next
- Case BRACELETLEFTDATA '左手镯
- Player(mData(1)).BraceletLeft.State = mData(2)
- MS = mData(3)
- If mData(2) <> 0 Then Player(mData(1)).BraceletLeft.Item = GetItem(MS)
- For j = 1 To playercount
- If Player(j).Connected = True Then
- Server(j).SendData mWord(i) & NETKONGDATA
- End If
- Next
- Case BRACELETRIGHTDATA '右手镯
- Player(mData(1)).BraceletRight.State = mData(2)
- MS = mData(3)
- If mData(2) <> 0 Then Player(mData(1)).BraceletRight.Item = GetItem(MS)
- For j = 1 To playercount
- If Player(j).Connected = True Then
- Server(j).SendData mWord(i) & NETKONGDATA
- End If
- Next
- Case FINGERRINGLEFTDATA '左戒指
- Player(mData(1)).FingerRingLeft.State = mData(2)
- MS = mData(3)
- If mData(2) <> 0 Then Player(mData(1)).FingerRingLeft.Item = GetItem(MS)
- For j = 1 To playercount
- If Player(j).Connected = True Then
- Server(j).SendData mWord(i) & NETKONGDATA
- End If
- Next
- Case FINGERRINGRIGHTDATA '右戒指
- Player(mData(1)).FingerRingRight.State = mData(2)
- MS = mData(3)
- If mData(2) <> 0 Then Player(mData(1)).FingerRingRight.Item = GetItem(MS)
- For j = 1 To playercount
- If Player(j).Connected = True Then
- Server(j).SendData mWord(i) & NETKONGDATA
- End If
- Next
- End Select
- End If
- mErr:
- Next
- End Sub
- '发送附近怪物信息给玩家
- Private Sub mSendDataMonInfo(Index As Integer)
- Dim i As Integer
- HMonCount = 0
- ReDim HMonInfo(0)
- For i = 1 To MonCount
- If Abs(Mon(i).X - Player(Index).X) < 17 And Abs(Mon(i).Y - Player(Index).Y) < 20 And Mon(i).Dead = False Then
- HMonCount = HMonCount + 1
- ReDim Preserve HMonInfo(HMonCount)
- HMonInfo(HMonCount) = Mon(i)
- End If
- Next
- If HMonCount > 0 Then
- If Player(Index).Connected = True Then
- If Server(Index).State = sckConnected Then
- Server(Index).SendData HEREMONCOUNT & KONGDATA & HMonCount & NETKONGDATA
- For i = 1 To HMonCount
- Server(Index).SendData HEREMONINFO & KONGDATA & i & KONGDATA & HMonInfo(i).Id & KONGDATA & HMonInfo(i).DBInfo.Race_种族 & KONGDATA & HMonInfo(i).DBInfo.RaceImage_种族图像 & KONGDATA & HMonInfo(i).DBInfo.Appr_形象代码 & KONGDATA & HMonInfo(i).DBInfo.Name_名称 & KONGDATA & HMonInfo(i).Face & KONGDATA & HMonInfo(i).X & KONGDATA & HMonInfo(i).Y & KONGDATA & HMonInfo(i).Act & KONGDATA & HMonInfo(i).Pic & NETKONGDATA
- Next
- End If
- End If
- End If
- End Sub
- '//////// 发送玩家包裹物品信息
- Private Sub mSendDataBagItemInfo(Index As Integer)
- Dim i As Integer
- For i = 0 To 39
- If Player(Index).Bag(i).State = True Then
- Server(Index).SendData PLAYERBAGITEMDATA & KONGDATA & i & KONGDATA & ItemStr(Player(Index).Bag(i).Item) & NETKONGDATA
- End If
- Next
- End Sub
- '/// 发送附近地图上物品
- Public Sub mSendDataMapItemInfo(Index As Integer)
- Dim i As Integer
- Dim mMapItemCount As Long
- Dim mMapItem() As MapItemType
- For i = 1 To MapItemCount
- If i > MapItemCount Then Exit For
- If GetTickCount - MapItem(i).mTime > 60000 Then
- MapItem(i) = MapItem(MapItemCount)
- MapItemCount = MapItemCount - 1
- ReDim Preserve MapItem(MapItemCount)
- Else
- If Abs(MapItem(i).X - Player(Index).X) < 17 And Abs(MapItem(i).Y - Player(Index).Y) < 20 Then
- mMapItemCount = mMapItemCount + 1
- ReDim Preserve mMapItem(mMapItemCount)
- mMapItem(mMapItemCount) = MapItem(i)
- mMapItem(mMapItemCount).Id = i
- End If
- End If
- Next
- If mMapItemCount > 0 Then
- If Player(Index).Connected = True Then
- If Server(Index).State = sckConnected Then
- Server(Index).SendData HEREMAPITEMCOUNT & KONGDATA & mMapItemCount & NETKONGDATA
- For i = 1 To mMapItemCount
- Server(Index).SendData HEREMAPITEMINFO & KONGDATA & i & KONGDATA & mMapItem(i).Id & KONGDATA & mMapItem(i).mItem.Name & KONGDATA & mMapItem(i).mItem.Looks & KONGDATA & mMapItem(i).X & KONGDATA & mMapItem(i).Y & NETKONGDATA
- Next
- End If
- End If
- End If
- End Sub
- Private Sub Server_DataArrival(Index As Integer, ByVal bytesTotal As Long)
- Dim mData As String
- Server(Index).GetData mData, vbString
- ExecuteNETData mData, Index
- ' Text.Text = Text.Text & Server(Index).BytesReceived & vbCrLf
- End Sub
- Private Sub Server_Error(Index As Integer, ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
- Player(Index).Connected = False
- Server(Index).Close
- ' Unload Server(Index)
- End Sub
- Private Sub Text_Change()
- Text.SelStart = Len(Text.Text)
- Text.SelLength = 1
- End Sub
- Private Sub Text_KeyPress(KeyAscii As Integer)
- KeyAscii = 0
- End Sub
- Private Sub Timer1_Timer()
- MonAct
- End Sub