📄 clsplayer.vb.svn-base
字号:
End If
DR.Close()
SqlComm.Dispose()
DR = Nothing
SqlComm = Nothing
Catch ex As Exception
End Try
End Sub
#End Region
#Region "GetNameColour"
Public Sub GetNameColour()
If Me.PKPoint >= 200 Then
Me.NameColour = NameColours.Red
ElseIf Me.PKPoint >= 100 Then
Me.NameColour = NameColours.Yellow
Else
Me.NameColour = NameColours.White
End If
End Sub
#End Region
#Region "UpdatePlayerStats"
Public Sub UpdatePlayerStats()
CalcBasicStats()
CalcItemStats()
CalcMagicStats()
End Sub
#Region "CalcBasicStats"
Private Sub CalcBasicStats()
Dim n As Integer
Select Case Me.Job
Case Classes.Warrior
Me.Agility = 15
Me.MaxHP = 14 + Math.Round((Level / 4 + 4) * Level)
Me.MaxMP = 11 + Level * 2
Me.MaxWeight = 50 + Math.Round((Level / 3) * Level)
Me.MaxWearWeight = 15 + Math.Round((Level / 20) * Level)
Me.MaxHandWeight = 12 + Math.Round((Level / 13) * Level)
Me.DC = Math.Max((Level \ 7 - 1), 1)
Me.MaxDC = Math.Max((Level \ 5), 1)
Me.AC = 0
Me.MaxAC = Level \ 7
Me.AMC = 0
Me.MaxAMC = 0
Me.MC = 0
Me.MaxMC = 0
Me.SC = 0
Me.MaxSC = 0
Case Classes.Wizard
Me.Agility = 15
Me.MaxHP = 14 + Math.Round((Level / 15 + 1.8) * Level)
Me.MaxMP = 13 + Math.Round((Level / 5 + 2) * 2.2 * Level)
Me.MaxWeight = 50 + Math.Round((Level / 5) * Level)
Me.MaxWearWeight = 15 + Math.Round((Level / 100) * Level)
Me.MaxHandWeight = 12 + Math.Round((Level / 90) * Level)
Me.DC = Math.Max((Level \ 7 - 1), 0)
Me.MaxDC = Math.Max((Level \ 7), 1)
Me.MC = Math.Max((Level \ 7 - 1), 0)
Me.MaxMC = Math.Max((Level \ 7), 1)
Me.SC = 0
Me.MaxSC = 0
Me.AC = 0
Me.MaxAC = 0
Me.AMC = 0
Me.MaxAMC = 0
Case Classes.Taoist
Me.Agility = 18
Me.MaxHP = 14 + Math.Round((Level / 6 + 2.5) * Level)
Me.MaxMP = 13 + Math.Round((Level / 8 + 2) * 2.2 * Level)
Me.MaxWeight = 50 + Math.Round((Level / 4) * Level)
Me.MaxWearWeight = 15 + Math.Round((Level / 50) * Level)
Me.MaxHandWeight = 12 + Math.Round((Level / 42) * Level)
Me.DC = Math.Max((Level \ 7 - 1), 0)
Me.MaxDC = Math.Max((Level \ 7), 1)
Me.MC = 0
Me.MaxMC = 0
Me.SC = Math.Max((Level \ 7 - 1), 0)
Me.MaxSC = Math.Max((Level \ 7), 1)
Me.AC = 0
Me.MaxAC = 0
n = Math.Round(Level / 6)
Me.AMC = n / 2
Me.MaxAMC = n + 1 '= MAKEWORD(n / 2, n + 1);
End Select
Me.Accuracy = 5
If Me.HP > Me.MaxHP Then
Me.HP = Me.MaxHP 'I think its that, or maybe maxhp = hp :\
End If
If Me.MP > Me.MaxMP Then
Me.MP = Me.MaxMP 'Same as above
End If
If Me.HP < Me.MaxHP Then
Me.HP = Me.MaxHP
End If
If Me.MP < Me.MaxMP Then
Me.MP = Me.MaxMP
End If
End Sub
#End Region
#Region "CalcItemStats"
Private Sub CalcItemStats()
Dim i As Integer
For i = 0 To 13
If Not Equipment(i) Is Nothing Then
AddItemStats(Equipment(i))
End If
Next i
End Sub
#End Region
#Region "CalcMagicStats"
Private Sub CalcMagicStats()
Dim PlayerMagic As clsPlayerMagic
Dim Magic As clsMagic
Dim tMagics As New Hashtable
Dim en As IDictionaryEnumerator = PlayerMagics.GetEnumerator
While en.MoveNext
PlayerMagic = PlayerMagics(en.Value)
Magic = MagicList(MagicKeyList(PlayerMagic.MagicId))
If Magic.EffectType = MagEffectTypes.Accuracy1 Or Magic.EffectType = MagEffectTypes.Accuracy2 Or Magic.EffectType = MagEffectTypes.HitBoost Then
tMagics.Add(Magic.EffectType, PlayerMagic.MagicId)
End If
End While
'Fencing
If tMagics.Contains(MagEffectTypes.Accuracy2) Then
PlayerMagic = tMagics(MagEffectTypes.Accuracy2)
If PlayerMagic.Level > 0 Then
Accuracy += Math.Round(9 / 3 * PlayerMagic.Level)
End If
End If
'SpiritSword
If tMagics.Contains(MagEffectTypes.Accuracy1) Then
PlayerMagic = tMagics(MagEffectTypes.Accuracy1)
If PlayerMagic.Level > 0 Then
Accuracy += Math.Round(8 / 3 * PlayerMagic.Level)
End If
End If
'Slaying
If tMagics.Contains(MagEffectTypes.HitBoost) Then
PlayerMagic = tMagics(MagEffectTypes.HitBoost)
If PlayerMagic.Level > 0 Then
Accuracy += Math.Round(3 / 3 * PlayerMagic.Level)
End If
End If
End Sub
#End Region
#End Region
#Region "GetEmptyBagSlot"
Private Function GetEmptyBagSlot() As Integer
Dim i As Integer
For i = 0 To 55
If BagItems(i) Is Nothing Then
Return i
Else
If BagItems(i).ItemIndex = 0 Then
Return i
End If
End If
Next i
End Function
#End Region
#Region "FindItemInBag"
Private Function FindItemInBag(ByVal ItemID As Long) As Integer
Dim i As Integer
For i = 0 To Me.BagItems.Length - 1
If Not Me.BagItems(i) Is Nothing Then
If Me.BagItems(i).ItemID = ItemID Then
Return i
Exit For
End If
End If
Next i
Return -1
End Function
Private Function FindItemInBag(ByVal ItemName As String) As Integer
Dim i As Integer
Dim tItem As clsItem
For i = 0 To Me.BagItems.Length - 1
If Not Me.BagItems(i) Is Nothing Then
tItem = ItemStatList(Me.BagItems(i).ItemIndex)
If tItem.Name = ItemName Then
Return i
Exit For
End If
End If
Next i
Return -1
End Function
#End Region
#Region "FindItemInEquipment"
Private Function FindItemInEquipment(ByVal ItemID As Long) As EquipType
Dim i As Integer
For i = 0 To 13
If Not Equipment(i) Is Nothing Then
If Equipment(i).ItemID = ItemID Then
Return i
Exit For
End If
End If
Next i
Return -1
End Function
#End Region
#Region "CanItemCanBeWorn"
Private Function CanItemBeWorn(ByVal rItem As clsItem, ByVal Slot As EquipType) As Byte
Select Case rItem.NeedType
Case NeedTypes.Level
If Level < rItem.NeedAmount Then
Return 1
End If
Case NeedTypes.DC
If MaxDC < rItem.NeedAmount Then
Return 1
End If
Case NeedTypes.MC
If MaxMC < rItem.NeedAmount Then
Return 1
End If
Case NeedTypes.SC
If MaxSC < rItem.NeedAmount Then
Return 1
End If
Case NeedTypes.Class_
If Job <> rItem.NeedAmount Then
Return 1
End If
End Select
Select Case Slot
Case EquipType.Amulet
If Not rItem.Type = ItemType.Amulet Then
Return 3
End If
Case EquipType.Belt
If Not rItem.Type = ItemType.Belt Then
Return 3
End If
Case EquipType.Boots
If Not rItem.Type = ItemType.Shoes Then
Return 3
End If
Case EquipType.Candle
If Not rItem.Type = ItemType.Candle Then
Return 3
End If
Case EquipType.Clothing
If Not rItem.Type = ItemType.Armour Then
Return 3
End If
Case EquipType.Helmet
If Not rItem.Type = ItemType.Helmet Then
Return 3
End If
Case EquipType.LeftBrace
If Not rItem.Type = ItemType.Bracelet Then
Return 3
End If
Case EquipType.LeftRing
If Not rItem.Type = ItemType.Ring Then
Return 3
End If
Case EquipType.Necklace
If Not rItem.Type = ItemType.Necklace Then
Return 3
End If
Case EquipType.Poison
If Not rItem.Type = ItemType.Poison Then
Return 3
End If
Case EquipType.RightBracelet
If Not rItem.Type = ItemType.Bracelet Then
Return 3
End If
Case EquipType.RightRing
If Not rItem.Type = ItemType.Ring Then
Return 3
End If
Case EquipType.Stone
If Not rItem.Type = ItemType.Stone Then
Return 3
End If
Case EquipType.Weapon
If Not rItem.Type = ItemType.Weapon Then
Return 3
End If
End Select
Select Case rItem.Type
Case ItemType.Armour
Select Case rItem.Type2
Case 1
'Male
If Me.Gender <> Genders.Male Then Return 3
Case 2
'Female
If Me.Gender <> Genders.Female Then Return 3
End Select
End Select
If Not Equipment(Slot) Is Nothing Then
Return 4
End If
Return 0
End Function
#End Region
#Region "AddItemStats"
Private Sub AddItemStats(ByVal Item As clsPlayerItem)
Dim rItem As clsItem = ItemStatList(Item.ItemIndex)
AC += rItem.AC
MaxAC += rItem.MaxAC + Item.PlusAC
AMC += rItem.AMC
MaxAMC += rItem.MaxAMC + Item.PlusAMC
DC += rItem.DC
MaxDC += rItem.MaxDC + Item.PlusDC
MC += rItem.MC
MaxMC += rItem.MaxMC + Item.PlusMC
SC += rItem.SC
MaxSC += rItem.MaxSC + Item.PlusSC
Accuracy += rItem.Accuracy + Item.PlusAccuracy
Agility += rItem.Agility + Item.PlusAgility
Holy += rItem.Holy + Item.PlusHoly
Inten += rItem.Inten + Item.PlusInten
Luck += rItem.Luck + Item.PlusLuck
ASpeed += rItem.ASpeed + Item.PlusASpeed
HPRecov += rItem.HPRecovery + Item.PlusHPRecov
MPRecov += rItem.MPRecovery + Item.PlusMPRecov
HPLeech += rItem.HPLeech + Item.PlusHPLeech
MPLeech += rItem.MPLeech + Item.PlusMPLeech
PoisonEvasion += rItem.PoisonEvasion + Item.PlusPoisonEvasion
PoisonRecov += rItem.PoisonRecovery + Item.PlusPoisonRecov
MagicEvasion += rItem.MagicEvasion + Item.PlusMagicEvasion
MaxWeight += rItem.BWeight + Item.PlusBWeight
MaxHandWeight += rItem.HWeight + Item.PlusHWeight
MaxHP += rItem.MaxHP + Item.PlusMaxHP
MaxMP += rItem.MaxMP + Item.PlusMaxMP
WearWeight += rItem.Weight
End Sub
#End Region
#Region "RemoveItemStats"
Private Sub RemoveItemStats(ByVal Item As clsPlayerItem)
Dim rItem As clsItem = ItemStatList(Item.ItemIndex)
AC -= rItem.AC
MaxAC -= rItem.MaxAC + Item.PlusAC
AMC -= rItem.AMC
MaxAMC -= rItem.MaxAMC + Item.PlusAMC
DC -= rItem.DC
MaxDC -= rItem.MaxDC + Item.PlusDC
MC -= rItem.MC
MaxMC -= rItem.MaxMC + Item.PlusMC
SC -= rItem.SC
MaxSC -= rItem.MaxSC + Item.PlusSC
Accuracy -= rItem.Accuracy + Item.PlusAccuracy
Agility -= rItem.Agility + Item.PlusAgility
Holy -= rItem.Holy + Item.PlusHoly
Inten -= rItem.Inten + Item.PlusInten
Luck -= rItem.Luck + Item.PlusLuck
ASpeed -= rItem.ASpeed + Item.PlusASpeed
HPRecov -= rItem.HPRecovery + Item.PlusHPRecov
MPRecov -= rItem.MPRecovery + Item.PlusMPRecov
HPLeech -= rItem.HPLeech + Item.PlusHPLeech
MPLeech -= rItem.MPLeech + Item.PlusMPLeech
PoisonEvasion -= rItem.PoisonEvasion + Item.PlusPoisonEvasion
PoisonRecov -= rItem.PoisonRecovery + Item.PlusPoisonRecov
MagicEvasion -= rItem.MagicEvasion + Item.PlusMagicEvasion
MaxWeight -= rItem.BWeight + Item.PlusBWeight
MaxHandWeight -= rItem.HWeight + Item.PlusHWeight
MaxHP -= rItem.MaxHP + Item.PlusMaxHP
MaxMP -= rItem.MaxMP + Item.PlusMaxMP
WearWeight -= rItem.Weight
End Sub
#End Region
End Class
#Region "PlayerMagic"
Public Class clsPlayerMagic
Public MagicId As Integer
Public Level As Byte
Public Key As Byte
Public CurrentExp As Short
End Class
#End Region
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -