📄 modmonster.vb.svn-base
字号:
End If
Coords.X = X
Coords.Y = Y
If CanWalk(Coords, Map) = False Then
X = OldX
Y = OldY
Y += -1
Else
Moved = True
GoTo Ok
End If
Coords.X = X
Coords.Y = Y
If CanWalk(Coords, Map) = False Then
UnStuck = True
Else
Moved = True
GoTo Ok
End If
Case Is = TargetY
'nothing
Case Is < TargetY
Y += -1
X += +1
Coords.X = X
Coords.Y = Y
If CanWalk(Coords, Map) = False Then
X = OldX
Y = OldY
X += -1
Y += -1
Else
Moved = True
GoTo Ok
End If
Coords.X = X
Coords.Y = Y
If CanWalk(Coords, Map) = False Then
X = OldX
Y = OldY
X += +1
Else
Moved = True
GoTo Ok
End If
Coords.X = X
Coords.Y = Y
If CanWalk(Coords, Map) = False Then
X = OldX
Y = OldY
X += -1
Else
Moved = True
GoTo Ok
End If
Coords.X = X
Coords.Y = Y
If CanWalk(Coords, Map) = False Then
X = OldX
Y = OldY
Y += +1
Else
Moved = True
GoTo Ok
End If
Coords.X = X
Coords.Y = Y
If CanWalk(Coords, Map) = False Then
UnStuck = True
Else
Moved = True
GoTo Ok
End If
End Select
Loop
Ok:
LastX = OldX
LastY = OldY
Dir = GetNewDir()
Dim j As Integer
Dim OnMap As Boolean = False
Dim tMap As Map = Maps(Map)
'Update the Maps Objectlist
While j < 10 And OnMap = False
If tMap.ObjectList.Contains(LastX & "/" & LastY & "/" & j) = False Then
Dim sKey As String = GetKeyFromValue(tMap.ObjectList, Me.MobId)
tMap.ObjectList.Remove(sKey)
tMap.ObjectList.Add(X & "/" & Y & "/" & j, Me.MobId)
OnMap = True
End If
j += 1
End While
'Tell everyone around the monster that it moved
Dim Locals As Hashtable = GetLocalPlayers(X, Y, Map, 15, 15)
Dim i, pID As Integer
Dim Added As New Hashtable
Dim lPlayer As clsPlayer
For i = 0 To Locals.Count - 1
pID = Locals(i)
If Added.ContainsKey(pID) = False Then
lPlayer = ObjectList(pID)
Packets.SendMove(lPlayer.StateId, Me.MobId, Races.Monster, X, Y, Dir, 1)
Added.Add(pID, "")
End If
Next i
End If
End Sub
#End Region
#Region "IsNextTo"
Private Function IsNextTo(ByVal tX As Integer, ByVal tY As Integer) As Boolean
Select Case True
Case Is = tY = Y - 1 And tX = X - 1
Return True
Case Is = tY = Y And tX = X - 1
Return True
Case Is = tY = Y + 1 And tX = X - 1
Return True
Case Is = tY = Y + 1 And tX = X
Return True
Case Is = tY = Y + 1 And tX = X + 1
Return True
Case Is = tY = Y And tX = X + 1
Return True
Case Is = tY = Y - 1 And tX = X + 1
Return True
Case Is = tY = Y - 1 And tX = X
Return True
Case Else
Return (False)
End Select
End Function
#End Region
#Region "FaceTarget"
Public Function FaceTarget(ByVal aOne As Point, ByVal aTwo As Point) As Byte
If aOne.Y = aTwo.Y - 1 And aOne.X = aTwo.X - 1 Then Return 7
If aOne.Y = aTwo.Y And aOne.X = aTwo.X - 1 Then Return 6
If aOne.Y = aTwo.Y + 1 And aOne.X = aTwo.X - 1 Then Return 5
If aOne.Y = aTwo.Y + 1 And aOne.X = aTwo.X Then Return 4
If aOne.Y = aTwo.Y + 1 And aOne.X = aTwo.X + 1 Then Return 3
If aOne.Y = aTwo.Y And aOne.X = aTwo.X + 1 Then Return 2
If aOne.Y = aTwo.Y - 1 And aOne.X = aTwo.X + 1 Then Return 1
If aOne.Y = aTwo.Y - 1 And aOne.X = aTwo.X Then Return 0
End Function
#End Region
#Region "GetNewDir"
Private Function GetNewDir() As Byte
If Y = LastY - 1 And X = LastX - 1 Then Return 7
If Y = LastY And X = LastX - 1 Then Return 6
If Y = LastY + 1 And X = LastX - 1 Then Return 5
If Y = LastY + 1 And X = LastX Then Return 4
If Y = LastY + 1 And X = LastX + 1 Then Return 3
If Y = LastY And X = LastX + 1 Then Return 2
If Y = LastY - 1 And X = LastX + 1 Then Return 1
If Y = LastY - 1 And X = LastX Then Return 0
End Function
#End Region
#End Region
#Region "DoDrops"
Public Sub DoDrops()
Dim i As Integer
Dim MonsterDrops As clsMonsterDrops = MonsterDropItemList(Me.Name)
If Not MonsterDrops Is Nothing Then
For i = 0 To MonsterDrops.DropItemCount - 1
If MonsterDrops.DropItems(i) Is Nothing Then
GoTo Nexti
End If
Dim rItem As clsItem
rItem = ItemStatList(MonsterDrops.DropItems(i).ItemIndex)
If rItem Is Nothing Then
GoTo Nexti
End If
Dim pItem As New clsPlayerItem
pItem.Type = EquipType.Floor
pItem.ItemIndex = rItem.Index
pItem.Dura = Rand(1000, rItem.DuraMax)
pItem.MaxDura = rItem.DuraMax
Dim Chance1 As Integer = MonsterDrops.DropItems(i).Chance1
Dim Chance2 As Integer = MonsterDrops.DropItems(i).Chance2
If Rand(Chance1, Chance2) = Chance1 Then
Select Case rItem.Type
Case ItemType.Book
Case ItemType.Bracelet Or ItemType.Ring Or ItemType.Weapon Or ItemType.Armour Or ItemType.Necklace Or ItemType.Shoes Or ItemType.Helmet Or ItemType.Belt
If Rand(0, 10) = 0 Then
'AddExtraStats
End If
End Select
pItem.ItemID = GenerateItemID()
DoDropItem(pItem, Me.X, Me.Y, Me.Map)
PlayerItemList.Add(pItem.ItemID, pItem)
End If
Nexti:
Next i
End If
End Sub
#End Region
#Region "Died"
Public Sub Died()
Dim tMap As Map = Maps(Me.Map)
Dim i As Integer
Dim OnMap As Boolean = True
While i < 10 And OnMap
If tMap.ObjectList(Me.X & "/" & Me.Y & "/" & i) = Me.MobId Then
tMap.ObjectList.Remove(Me.X & "/" & Me.Y & "/" & i)
OnMap = False
End If
i += 1
End While
Me.IsDead = True
End Sub
#End Region
End Class
#End Region
#Region "MonsterAttacks"
Public Enum MonAttackType
Physical = 0 'Physical Attacks
Magical = 1 'Magical Attacks
MagicalPhsyical = 2 'Mixture of both Physical and Magical Attacks
End Enum
Public Enum MonAttackStyle
None = 0 'Only attacks when attacked
Attack = 1 'Normal attacking
TwoStepsAttack = 2 'Hit a target from two steps away
ThreeStepsAttack = 3 'Hit a target from three steps away
MassAttack = 4 'Hit all targets around
Poison = 5 'Poisons target
MassPoison = 6 'Poisons all targets around
RangeShoot = 7 'Shoots a target from range
SpawnMobs = 8 'Spawns other monsters
SpawnOnHit = 9 'Spawns when hit
End Enum
Public Enum MonAttackImage
None = 0
End Enum
#End Region
#Region "LoadMonsterStats"
Public Sub LoadMonsterStats()
Dim ReadMob As clsMobStats
Try
Dim DR As System.Data.SqlClient.SqlDataReader
Dim StrSQL As String = "Select * From TBL_Monster"
Dim SqlComm As New System.Data.SqlClient.SqlCommand(StrSQL, SqlConnDB)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -