Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Equip Bonus System
#1
So I have been working on this equipment bonus thing for a couple hours and have it all figured out so it's working nicely however I think it is sort of messy. I am not sure. I was hoping to get somebodys advice on if there would be a faster way to do any of the things I am or not.

As it is I have 6 Functions that are each like this:
Code:
Function GetPlayerWeaponBonus(ByVal Index As Long)
Dim WeaponSlot As Long
    
    StrengthBonus = 0
    EnduranceBonus = 0
    DexterityBonus = 0
    WisdomBonus = 0
    AgilityBonus = 0
    
    If GetPlayerWeaponSlot(Index) > 0 Then
    
    WeaponSlot = GetPlayerWeaponSlot(Index)
    
        If Item(GetPlayerInvItemNum(Index, WeaponSlot)).BonusType = 0 Then
            StrengthBonus = Item(GetPlayerInvItemNum(Index, WeaponSlot)).Bonus
        End If
        If Item(GetPlayerInvItemNum(Index, WeaponSlot)).BonusType = 1 Then
            EnduranceBonus = Item(GetPlayerInvItemNum(Index, WeaponSlot)).Bonus
        End If
        If Item(GetPlayerInvItemNum(Index, WeaponSlot)).BonusType = 2 Then
            DexterityBonus = Item(GetPlayerInvItemNum(Index, WeaponSlot)).Bonus
        End If
        If Item(GetPlayerInvItemNum(Index, WeaponSlot)).BonusType = 3 Then
            WisdomBonus = Item(GetPlayerInvItemNum(Index, WeaponSlot)).Bonus
        End If
        If Item(GetPlayerInvItemNum(Index, WeaponSlot)).BonusType = 4 Then
            AgilityBonus = Item(GetPlayerInvItemNum(Index, WeaponSlot)).Bonus
        End If
    End If
End Function
6 of those, one for each item type.

Then I have this:
Code:
Function GetPlayerBonus(Index)
    Call GetPlayerWeaponBonus(Index)
    Call GetPlayerArmorBonus(Index)
    Call GetPlayerSheildBonus(Index)
    Call GetPlayerHelmBonus(Index)
    Call GetPlayerNecklaceBonus(Index)
    Call GetPlayerRingBonus(Index)
    Call SendStats(Index)
End Function

So thats called whenever an item is equipped or unequipped and when you first join the game.

Then obviously I have 5 declares like StrengthBonus, EnduranceBonus, etc. Those are sent in the SendStats sub so I can have my visual stats update like 8 + (1).

So this seems slow, any faster ways? xD thanks!
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)