📄 draw actor, players.vb.svn-base
字号:
End If
End Sub
Public Sub PlayerUseStack(ByVal Index As Integer)
If Player(Index).StackExist(0) = True Then
Player(Index).LastX = Player(Index).X
Player(Index).LastY = Player(Index).Y
'remove tile
If Player(Index).StackActionType(0) = PlayerActionType.Move Then
RemoveTilePlayerCollsion(Player(Index).X, Player(Index).Y)
End If
Player(Index).Dir = Player(Index).StackDirection(0)
Player(Index).MoveType = Player(Index).StackMoveType(0)
Player(Index).X = Player(Index).StackCordX(0)
Player(Index).Y = Player(Index).StackCordY(0)
Player(Index).Animation = 0
Player(Index).StackExist(0) = False
Player(Index).Stance = 0
If Player(Index).StackActionType(0) = PlayerActionType.Move Then
Player(Index).ActionState = 1
ElseIf Player(Index).StackActionType(0) = PlayerActionType.Attack Then
Player(Index).ActionState = 2
If Player(Index).StackUseSound(0) = True Then
'PlayerAttackSound(Index)
End If
ElseIf Player(Index).StackActionType(0) = PlayerActionType.Stun Then
Player(Index).ActionState = 3
If Player(Index).StackUseSound(0) = True Then
'PlayerStunSound(Index)
End If
ElseIf Player(Index).StackActionType(0) = PlayerActionType.Die Then
Player(Index).ActionState = 4
Player(Index).IsDead = True
If Player(Index).StackUseSound(0) = True Then
'PlayerDieSound(Index)
End If
ElseIf Player(Index).StackActionType(0) = PlayerActionType.Cast Then
Player(Index).ActionState = 7
End If
'add tile
If Player(Index).StackActionType(0) = PlayerActionType.Move Then
AddTilePlayerCollsion(Player(Index).X, Player(Index).Y)
End If
Dim I As Short
're-organise stack so we can quickly use it next time
'If Not Player(Index).StackItems = 0 Then
For I = 0 To 14
Player(Index).StackCordX(I) = Player(Index).StackCordX(I + 1)
Player(Index).StackCordY(I) = Player(Index).StackCordY(I + 1)
Player(Index).StackDirection(I) = Player(Index).StackDirection(I + 1)
Player(Index).StackMoveType(I) = Player(Index).StackMoveType(I + 1)
Player(Index).StackExist(I) = Player(Index).StackExist(I + 1)
Player(Index).StackActionType(I) = Player(Index).StackActionType(I + 1)
Player(Index).StackUseSound(I) = Player(Index).StackUseSound(I + 1)
Next I
'End If
Player(Index).StackItems = Player(Index).StackItems - 1
End If
End Sub
Public Sub PlayerStand(ByVal Index As Integer)
Player(Index).Animation = Player(Index).Animation + 1
If Player(Index).MagicShieldEffect = True Then Player(Index).MagicShieldEffectAnimation = Player(Index).MagicShieldEffectAnimation + 1
If Player(Index).Animation >= 4 Then Player(Index).Animation = 0
If Player(Index).MagicShieldEffect = True And Player(Index).MagicShieldEffectAnimation = 3 Then Player(Index).MagicShieldEffectAnimation = 0
End Sub
Public Sub PlayerDie(ByVal Index As Integer)
Player(Index).Animation = Player(Index).Animation + 1
If Player(Index).Animation >= 4 Then
Player(Index).ActionState = 0
Player(Index).Animation = 0
End If
End Sub
Public Sub PlayerStun(ByVal Index As Integer)
Player(Index).Animation = Player(Index).Animation + 1
If Player(Index).Animation >= 3 Then Player(Index).Animation = 0 : Player(Index).ActionState = 0
End Sub
Public Sub PlayerCast(ByVal Index As Integer)
Player(Index).Animation = Player(Index).Animation + 1
If Player(Index).Animation >= 6 Then
Player(Index).Animation = 0 : Player(Index).ActionState = 0
Player(Index).Stance = 1
Player(Index).StanceTick = DateTime.Now.Ticks
End If
End Sub
Public Sub PlayerAttack(ByVal Index As Integer)
Player(Index).Animation = Player(Index).Animation + 1
If Player(Index).Animation >= 6 Then
If Player(Index).StackActionType(0) = PlayerActionType.Attack Then
PlayerUseStack(Index)
Else
Player(Index).ActionState = 0
Player(Index).Animation = 0
End If
Player(Index).Animation = 0
Player(Index).Stance = 1
Player(Index).StanceTick = DateTime.Now.Ticks
End If
End Sub
Public Sub PlayerMove(ByVal Index As Integer)
If Player(Index).Animation >= 5 Then
Player(Index).CurrentX = Player(Index).X
Player(Index).CurrentY = Player(Index).Y
Player(Index).Animation = 0
'check stack for any items
If Not Player(Index).StackItems = 0 Then
Dim I As Integer
'take out first item of stack and use it
If Player(Index).StackActionType(0) = PlayerActionType.Move Then
PlayerUseStack(Index)
Else
Player(Index).ActionState = 0
Player(Index).Animation = 0
Exit Sub
End If
Else
Player(Index).Animation = 0
Player(Index).ActionState = 0
Exit Sub
End If
End If
If Player(Index).ActionState = 1 Then
If Player(Index).Dir = 0 Then
Player(Index).CurrentY = Player(Index).CurrentY - PlayerMoveAmount(Index)
'Player(Index).CordY = SymArith(Player(Index).CordY, 2)
Player(Index).Animation = Player(Index).Animation + 1
'Call PlayerMoveSound(Index)
ElseIf Player(Index).Dir = 1 Then
Player(Index).Animation = Player(Index).Animation + 1
Player(Index).CurrentY = Player(Index).CurrentY - PlayerMoveAmount(Index)
'Player(Index).CordY = SymArith(Player(Index).CordY, 2)
Player(Index).CurrentX = Player(Index).CurrentX + PlayerMoveAmount(Index)
'Player(Index).CordX = SymArith(Player(Index).CordX, 2)
'Call PlayerMoveSound(Index)
ElseIf Player(Index).Dir = 2 Then
Player(Index).CurrentX = Player(Index).CurrentX + PlayerMoveAmount(Index)
'Player(Index).CordX = SymArith(Player(Index).CordX, 2)
Player(Index).Animation = Player(Index).Animation + 1
'Call PlayerMoveSound(Index)
ElseIf Player(Index).Dir = 3 Then
Player(Index).Animation = Player(Index).Animation + 1
Player(Index).CurrentX = Player(Index).CurrentX + PlayerMoveAmount(Index)
'Player(Index).CordX = SymArith(Player(Index).CordX, 2)
Player(Index).CurrentY = Player(Index).CurrentY + PlayerMoveAmount(Index)
'Player(Index).CordY = SymArith(Player(Index).CordY, 2)
'Call PlayerMoveSound(Index)
ElseIf Player(Index).Dir = 4 Then
Player(Index).Animation = Player(Index).Animation + 1
Player(Index).CurrentY = Player(Index).CurrentY + PlayerMoveAmount(Index)
'Player(Index).CordY = SymArith(Player(Index).CordY, 2)
'Call PlayerMoveSound(Index)
ElseIf Player(Index).Dir = 5 Then
Player(Index).Animation = Player(Index).Animation + 1
Player(Index).CurrentX = Player(Index).CurrentX - PlayerMoveAmount(Index)
'Player(Index).CordX = SymArith(Player(Index).CordX, 2)
Player(Index).CurrentY = Player(Index).CurrentY + PlayerMoveAmount(Index)
' Player(Index).CordY = SymArith(Player(Index).CordY, 2)
'Call PlayerMoveSound(Index)
ElseIf Player(Index).Dir = 6 Then
Player(Index).Animation = Player(Index).Animation + 1
Player(Index).CurrentX = Player(Index).CurrentX - PlayerMoveAmount(Index)
'Player(Index).CordX = SymArith(Player(Index).CordX, 2)
'Call PlayerMoveSound(Index)
ElseIf Player(Index).Dir = 7 Then
Player(Index).Animation = Player(Index).Animation + 1
Player(Index).CurrentX = Player(Index).CurrentX - PlayerMoveAmount(Index)
'Player(Index).CordX = SymArith(Player(Index).CordX, 2)
Player(Index).CurrentY = Player(Index).CurrentY - PlayerMoveAmount(Index)
'Player(Index).CordY = SymArith(Player(Index).CordY, 2)
'Call PlayerMoveSound(Index)
End If
End If
End Sub
Function PlayerMoveAmount(ByVal Index As Integer)
Dim Quantity As Double = 1 / 5
If Player(Index).Animation = 0 Then
PlayerMoveAmount = Quantity * Player(Index).MoveType
ElseIf Player(Index).Animation = 1 Then
PlayerMoveAmount = Quantity * Player(Index).MoveType
ElseIf Player(Index).Animation = 2 Then
PlayerMoveAmount = Quantity * Player(Index).MoveType
ElseIf Player(Index).Animation = 3 Then
PlayerMoveAmount = Quantity * Player(Index).MoveType
ElseIf Player(Index).Animation = 4 Then
PlayerMoveAmount = Quantity * Player(Index).MoveType
ElseIf Player(Index).Animation = 5 Then
PlayerMoveAmount = Quantity * Player(Index).MoveType
ElseIf Player(Index).Animation = 6 Then
'PlayerMoveAmount = 0.15 * Player(Index).MoveType
End If
Dim I As Integer
CheckMouseOverPlayer(CursorX, CursorY, Player(I).Name)
End Function
Public Sub AddPlayer(ByVal PlayerID As Long, ByVal Name As String, ByVal NameColour As NameColours, ByVal Guild As String, ByVal CordX As Short, ByVal CordY As Short, ByVal Direction As Byte, ByVal MagicShieldEffect As Boolean, ByVal Hair As Byte, ByVal Sex As Genders, ByVal HP As Integer, ByVal MP As Integer, ByVal MaxHP As Integer, ByVal MaxMP As Integer, ByVal Reved As Boolean, ByVal Light As Byte, ByVal IsDead As Boolean, ByVal Status As Integer, ByVal GuildTitle As String, ByVal GuildRankNumber As Integer)
Dim I As Integer
'add player to playes
For I = 0 To 1000
If Player(I).Exist = False Then
Dim S As Integer
Player(I).Initialize()
For S = 0 To 35
Player(I).StackExist(S) = False
Next S
Player(I).ActionState = 0
Player(I).ServerID = PlayerID
Player(I).Name = Name
Player(I).NameColour = NameColour
Player(I).Guild = Guild
Player(I).GuildRankNumber = GuildRankNumber
Player(I).GuildTitle = GuildTitle
Player(I).CurrentX = CordX
Player(I).CurrentY = CordY
Player(I).X = CordX
Player(I).Y = CordY
Player(I).Dir = Direction
Player(I).MagicShieldEffect = MagicShieldEffect
Player(I).Hair = Hair
Player(I).Gender = Sex
Player(I).HP = HP
Player(I).MP = MP
Player(I).MaxHP = MaxHP
Player(I).MaxMP = MaxMP
Player(I).HealthBarOpen = Reved
Player(I).Light = Light
Player(I).IsDead = IsDead
Player(I).Status = Status
Player(I).Animation = 0
Player(I).Exist = True
TotalPlayer = TotalPlayer + 1
'link index
LinkServerID(I, PlayerID, 1)
'add this players lighting to map if they have a torch or candle
Player(I).LightIndex = AddLight(3, 0, 0, PlayerID)
If DebugMode Then
AddChat("Played Added, " & PlayerID, 3)
End If
AddTilePlayerCollsion(CordX, CordY)
Exit Sub
End If
Next I
End Sub
Public Sub RemovePlayer(ByVal PlayerID As Integer)
TotalPlayer = TotalPlayer - 1
If DebugMode Then
AddChat("Played Removed, " & PlayerID, 3)
End If
'remove player from tile
'remove player light
Player(PlayerGameIndex(PlayerID)).ActionState = 0
Player(PlayerGameIndex(PlayerID)).Animation = 0
RemoveLight(Player(PlayerGameIndex(PlayerID)).LightIndex)
'remove player
Player(PlayerGameIndex(PlayerID)).Exist = False
RemoveTilePlayerCollsion(Player(PlayerGameIndex(PlayerID)).X, Player(PlayerGameIndex(PlayerID)).Y)
End Sub
Public Sub ChangePlayerHPMP(ByVal PlayerServerID As Integer, ByVal Type As Short, ByVal Value As Integer)
If Type = 0 Then 'hp
If PlayerServerID = Actor.ServerID Then 'actor change
Actor.HP = Value
ElseIf Player(PlayerGameIndex(PlayerServerID)).Exist = True Then 'player change
Player(PlayerGameIndex(PlayerServerID)).HP = Value
End If
Else 'mp
If PlayerServerID = Actor.ServerID Then 'actor change
Actor.MP = Value
ElseIf Player(PlayerGameIndex(PlayerServerID)).Exist = True Then 'player change
Player(PlayerGameIndex(PlayerServerID)).MP = Value
End If
End If
End Sub
#End Region
End Module
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -