VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clsItem"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

Private Const m_cNAME As String = "clsItem"

Private Const m_cNotAStat As String = "[NotAStat]"

Private m_oTableHelperItems As New clsFOTAADOTableHelper

'Constant used for serializing and deserializing this character
Private Const m_cItemSubSep As String = "[S ¶]"
Private Const m_cWEAPONTYPE As Long = 2
Private Const m_cARMORTYPE As Long = 1
Private Const m_cOTHERTYPE As Long = 0


Public m_bIdentified As Boolean
Public m_sGUID As String
Public m_sIdentifiedName As String
Public m_sUnIdentifiedName As String
Public m_sDescription As String
Public m_nItemID As Long
Public m_nWeight As Long
Public m_nBulk As Long
Public m_sValue As String
Public m_bDetectsAsMagic As Boolean
Public m_sTypeOfMagic As String
Public m_nTHACOBonus As Long
Public m_nInitBonus As Long
Public m_nACBonus As Long
Public m_nSavingThrowBonus As Long
Public m_nCharID As Long
Public m_sPicture As String
Public m_bActive As Boolean
Public m_nType As Long
Public m_nWeapon_NumDice As Long
Public m_nWeapon_DiceSides As Long
Public m_nWeapon_Damage As Long
Public m_sWeapProfType As String
Public m_nCharges As Long
Public m_sMacros As String
'This is where we store the text we will display if we attck with this weapon
Public m_sWeapon_Text As String

Private Sub Class_Initialize()

    On Error GoTo ErrorHandler
    Dim sRoutineName As String
    sRoutineName = "clsItem.Name"
    Call WriteProcStart(sRoutineName)
    
    
   Call m_oTableHelperItems.LoadSchema(g_oDB, "CharacterItems", "ItemID")
   
   Call MakeNewGUID
   m_bIdentified = True
   m_sIdentifiedName = "New Item"
   m_sUnIdentifiedName = "New Item"
   m_sDescription = ""
   m_nWeight = 0
   m_nBulk = 0
   m_sValue = "0 gp"
   m_bDetectsAsMagic = False
   m_sTypeOfMagic = ""
   m_nTHACOBonus = 0
   m_nInitBonus = 0
   m_nACBonus = 0
   m_nSavingThrowBonus = 0
   
   m_bActive = True
   m_nType = 0
   m_nWeapon_NumDice = 1
   m_nWeapon_DiceSides = 6
   m_nWeapon_Damage = 0
   m_sWeapon_Text = ""


    Call WriteProcStop(sRoutineName)
    'Exit the sub... on an error we will jump over this function
    Exit Sub
ErrorHandler:
    Call LogErrorToFile(sRoutineName & "." & Err.Description): Call g_oErrors.HandleErrorWithSource(Err, sRoutineName): Call g_oErrors.DisplayErrorCount

End Sub

Public Sub MakeNewGUID()

    On Error GoTo ErrorHandler
    Dim sRoutineName As String
    sRoutineName = "clsItem.MakeNewGUID"
    Call WriteProcStart(sRoutineName)
    
    
    m_sGUID = GetGUID("Item")


    Call WriteProcStop(sRoutineName)
    'Exit the sub... on an error we will jump over this function
    Exit Sub
ErrorHandler:
    Call LogErrorToFile(sRoutineName & "." & Err.Description): Call g_oErrors.HandleErrorWithSource(Err, sRoutineName): Call g_oErrors.DisplayErrorCount

End Sub
Public Property Let IsWeapon(bVal As Boolean)
  
    On Error GoTo ErrorHandler
    Dim sRoutineName As String
    sRoutineName = "clsItem.IsWeapon"
    Call WriteProcStart(sRoutineName)
    
    
    If bVal = True Then
        m_nType = m_cWEAPONTYPE
    ElseIf m_nType = m_cWEAPONTYPE Then
        m_nType = m_cOTHERTYPE
    End If


    Call WriteProcStop(sRoutineName)
    'Exit the sub... on an error we will jump over this function
    Exit Property
ErrorHandler:
    Call LogErrorToFile(sRoutineName & "." & Err.Description): Call g_oErrors.HandleErrorWithSource(Err, sRoutineName): Call g_oErrors.DisplayErrorCount
    
End Property
Public Property Get IsWeapon() As Boolean
  
    On Error GoTo ErrorHandler
    Dim sRoutineName As String
    sRoutineName = "clsItem.IsWeapon"
    Call WriteProcStart(sRoutineName)
    
    
    IsWeapon = (m_nType = m_cWEAPONTYPE)


    Call WriteProcStop(sRoutineName)
    'Exit the sub... on an error we will jump over this function
    Exit Property
ErrorHandler:
    Call LogErrorToFile(sRoutineName & "." & Err.Description): Call g_oErrors.HandleErrorWithSource(Err, sRoutineName): Call g_oErrors.DisplayErrorCount
    
End Property
Public Property Let IsArmor(bVal As Boolean)
  
    On Error GoTo ErrorHandler
    Dim sRoutineName As String
    sRoutineName = "clsItem.IsArmor"
    Call WriteProcStart(sRoutineName)
    
    
    If bVal = True Then
        m_nType = m_cARMORTYPE
    ElseIf m_nType = m_cARMORTYPE Then
        IsOther() = True
    End If


    Call WriteProcStop(sRoutineName)
    'Exit the sub... on an error we will jump over this function
    Exit Property
ErrorHandler:
    Call LogErrorToFile(sRoutineName & "." & Err.Description): Call g_oErrors.HandleErrorWithSource(Err, sRoutineName): Call g_oErrors.DisplayErrorCount
    
End Property
Public Property Get IsArmor() As Boolean
  
    On Error GoTo ErrorHandler
    Dim sRoutineName As String
    sRoutineName = "clsItem.IsArmor"
    Call WriteProcStart(sRoutineName)
    
    
    IsArmor = (m_nType = m_cARMORTYPE)


    Call WriteProcStop(sRoutineName)
    'Exit the sub... on an error we will jump over this function
    Exit Property
ErrorHandler:
    Call LogErrorToFile(sRoutineName & "." & Err.Description): Call g_oErrors.HandleErrorWithSource(Err, sRoutineName): Call g_oErrors.DisplayErrorCount
    
End Property
Public Property Let IsOther(bVal As Boolean)
  
    On Error GoTo ErrorHandler
    Dim sRoutineName As String
    sRoutineName = "clsItem.IsOther"
    Call WriteProcStart(sRoutineName)
    
    
    If bVal = True Then
        m_nType = m_cOTHERTYPE
    ElseIf m_nType = m_cOTHERTYPE Then
        m_nType = m_cARMORTYPE
    End If


    Call WriteProcStop(sRoutineName)
    'Exit the sub... on an error we will jump over this function
    Exit Property
ErrorHandler:
    Call LogErrorToFile(sRoutineName & "." & Err.Description): Call g_oErrors.HandleErrorWithSource(Err, sRoutineName): Call g_oErrors.DisplayErrorCount
    
End Property
Public Property Get IsOther() As Boolean
  
    On Error GoTo ErrorHandler
    Dim sRoutineName As String
    sRoutineName = "clsItem.IsOther"
    Call WriteProcStart(sRoutineName)
    
    
    IsOther = (m_nType = m_cOTHERTYPE)


    Call WriteProcStop(sRoutineName)
    'Exit the sub... on an error we will jump over this function
    Exit Property
ErrorHandler:
    Call LogErrorToFile(sRoutineName & "." & Err.Description): Call g_oErrors.HandleErrorWithSource(Err, sRoutineName): Call g_oErrors.DisplayErrorCount
    
End Property

Public Function ItemName() As String
  
    On Error GoTo ErrorHandler
    Dim sRoutineName As String
    sRoutineName = "clsItem.Name"
    Call WriteProcStart(sRoutineName)
    
    
    If m_bIdentified = False Then
        ItemName = m_sUnIdentifiedName
    Else
        ItemName = m_sIdentifiedName
    End If
    
    If Len(Trim(ItemName)) = 0 Then
        ItemName = "[No Name]"
    End If


    Call WriteProcStop(sRoutineName)
    'Exit the sub... on an error we will jump over this function
    Exit Function
ErrorHandler:
    Call LogErrorToFile(sRoutineName & "." & Err.Description): Call g_oErrors.HandleErrorWithSource(Err, sRoutineName): Call g_oErrors.DisplayErrorCount
    
End Function
Public Function Name() As String
  
    On Error GoTo ErrorHandler
    Dim sRoutineName As String
    sRoutineName = "clsItem.Name"
    Call WriteProcStart(sRoutineName)
    
    
    Name = "clsItem"


    Call WriteProcStop(sRoutineName)
    'Exit the sub... on an error we will jump over this function
    Exit Function
ErrorHandler:
    Call LogErrorToFile(sRoutineName & "." & Err.Description): Call g_oErrors.HandleErrorWithSource(Err, sRoutineName): Call g_oErrors.DisplayErrorCount
    
End Function
Public Sub Load(dbDND As ADODB.Connection, nItemID As Long)

    On Error GoTo ErrorHandler
    Dim sRoutineName As String
    sRoutineName = m_cNAME & ".Load"
    Call WriteProcStart(sRoutineName)
    
    
    Dim rstItem As ADODB.Recordset
    Dim bFoundIt As Boolean
    
    Call m_oTableHelperItems.LoadRecords("WHERE ItemID = " & nItemID)
    
    m_bIdentified = m_oTableHelperItems.GetValue("bIdentified")
    m_sIdentifiedName = Trim(m_oTableHelperItems.GetValue("IdentifiedName"))
    m_sUnIdentifiedName = Trim(m_oTableHelperItems.GetValue("UnIdentifiedName"))
    m_sDescription = Trim(m_oTableHelperItems.GetValue("Description"))
    m_nItemID = nItemID
    m_nWeight = m_oTableHelperItems.GetValue("Weight")
    m_nBulk = m_oTableHelperItems.GetValue("Bulk")
    m_sValue = Trim(m_oTableHelperItems.GetValue("sNewValue"))
    m_bDetectsAsMagic = m_oTableHelperItems.GetValue("DetectsAsMagic")
    m_sTypeOfMagic = Trim(m_oTableHelperItems.GetValue("TypeOfMagic"))
    m_nTHACOBonus = m_oTableHelperItems.GetValue("ToHitBonus")
    m_nInitBonus = m_oTableHelperItems.GetValue("InitBonus")
    m_nACBonus = m_oTableHelperItems.GetValue("ACBonus")
    m_nSavingThrowBonus = m_oTableHelperItems.GetValue("SavingThrowBonus")
    m_nCharID = m_oTableHelperItems.GetValue("CharacterID")
    m_sPicture = Trim(m_oTableHelperItems.GetValue("sPicture"))
    m_bActive = m_oTableHelperItems.GetValue("bActive")
    m_nType = m_oTableHelperItems.GetValue("nType")
    m_nWeapon_NumDice = m_oTableHelperItems.GetValue("nWeapon_NumDice")
    m_nWeapon_DiceSides = m_oTableHelperItems.GetValue("nWeapon_DiceSides")
    m_nWeapon_Damage = m_oTableHelperItems.GetValue("nWeapon_Damage")
    m_sWeapProfType = Trim(m_oTableHelperItems.GetValue("sWeapProfType"))
    m_nCharges = m_oTableHelperItems.GetValue("nCharges")
    m_sMacros = m_oTableHelperItems.GetValue("sMacros")
    m_sWeapon_Text = m_oTableHelperItems.GetValue("sWeapon_Text")
        
    
    Call WriteProcStop(sRoutineName)
    'Exit the sub... on an error we will jump over this function
    Exit Sub
ErrorHandler:
    Call LogErrorToFile(sRoutineName & "." & Err.Description): Call g_oErrors.HandleErrorWithSource(Err, sRoutineName): Call g_oErrors.DisplayErrorCount

End Sub
Public Sub Save(dbDND As ADODB.Connection)

    On Error GoTo ErrorHandler
    Dim sRoutineName As String
    sRoutineName = m_cNAME & ".Save"
    Call WriteProcStart(sRoutineName)
    
    
    m_oTableHelperItems.SetValue("bIdentified") = m_bIdentified
    m_oTableHelperItems.SetValue("IdentifiedName") = Trim(m_sIdentifiedName) & " "
    m_oTableHelperItems.SetValue("UnIdentifiedName") = Trim(m_sUnIdentifiedName) & " "
    m_oTableHelperItems.SetValue("Description") = Trim(m_sDescription) & " "
    m_oTableHelperItems.SetValue("Weight") = m_nWeight
    m_oTableHelperItems.SetValue("Bulk") = m_nBulk
    m_oTableHelperItems.SetValue("sNewValue") = Trim(m_sValue) & " "
    m_oTableHelperItems.SetValue("DetectsAsMagic") = m_bDetectsAsMagic
    m_oTableHelperItems.SetValue("TypeOfMagic") = Trim(m_sTypeOfMagic) & " "
    m_oTableHelperItems.SetValue("ToHitBonus") = m_nTHACOBonus
    m_oTableHelperItems.SetValue("InitBonus") = m_nInitBonus
    m_oTableHelperItems.SetValue("ACBonus") = m_nACBonus
    m_oTableHelperItems.SetValue("SavingThrowBonus") = m_nSavingThrowBonus
    m_oTableHelperItems.SetValue("CharacterID") = m_nCharID
    m_oTableHelperItems.SetValue("sPicture") = Trim(m_sPicture) & " "
    m_oTableHelperItems.SetValue("bActive") = m_bActive
    m_oTableHelperItems.SetValue("nType") = m_nType
    m_oTableHelperItems.SetValue("nWeapon_NumDice") = m_nWeapon_NumDice
    m_oTableHelperItems.SetValue("nWeapon_DiceSides") = m_nWeapon_DiceSides
    m_oTableHelperItems.SetValue("nWeapon_Damage") = m_nWeapon_Damage
    m_oTableHelperItems.SetValue("sWeapProfType") = Trim(m_sWeapProfType) & " "
    m_oTableHelperItems.SetValue("nCharges") = m_nCharges
    m_oTableHelperItems.SetValue("sMacros") = m_sMacros
    m_oTableHelperItems.SetValue("sWeapon_Text") = m_sWeapon_Text
    
    m_nItemID = m_oTableHelperItems.Save
       
    
    Call WriteProcStop(sRoutineName)
    'Exit the sub... on an error we will jump over this function
    Exit Sub
ErrorHandler:
    Call LogErrorToFile(sRoutineName & "." & Err.Description): Call g_oErrors.HandleErrorWithSource(Err, sRoutineName): Call g_oErrors.DisplayErrorCount

End Sub
Public Sub Delete(dbDND As ADODB.Connection)

    On Error GoTo ErrorHandler
    Dim sRoutineName As String
    sRoutineName = m_cNAME & ".Delete"
    Call WriteProcStart(sRoutineName)
    
    
    If m_oTableHelperItems.IsRecordLoaded() = True Then
        Call m_oTableHelperItems.CreateSQLDelete(True)
    End If
        
    
    Call WriteProcStop(sRoutineName)
    'Exit the sub... on an error we will jump over this function
    Exit Sub
ErrorHandler:
    Call LogErrorToFile(sRoutineName & "." & Err.Description): Call g_oErrors.HandleErrorWithSource(Err, sRoutineName): Call g_oErrors.DisplayErrorCount

End Sub

Public Function Serialize() As String

    On Error GoTo ErrorHandler
    Dim sRoutineName As String
    sRoutineName = m_cNAME & ".Serialize"
    Call WriteProcStart(sRoutineName)
    
    
    Serialize = m_sGUID & m_cItemSubSep
    Serialize = Serialize & m_bIdentified & m_cItemSubSep
    Serialize = Serialize & m_sIdentifiedName & m_cItemSubSep
    Serialize = Serialize & m_sDescription & m_cItemSubSep
    Serialize = Serialize & m_nItemID & m_cItemSubSep
    Serialize = Serialize & m_nWeight & m_cItemSubSep
    Serialize = Serialize & m_nBulk & m_cItemSubSep
    Serialize = Serialize & m_sValue & m_cItemSubSep
    Serialize = Serialize & m_bDetectsAsMagic & m_cItemSubSep
    Serialize = Serialize & m_sTypeOfMagic & m_cItemSubSep
    Serialize = Serialize & m_nTHACOBonus & m_cItemSubSep
    Serialize = Serialize & m_nInitBonus & m_cItemSubSep
    Serialize = Serialize & m_nACBonus & m_cItemSubSep
    Serialize = Serialize & m_nSavingThrowBonus & m_cItemSubSep
    Serialize = Serialize & m_nCharID & m_cItemSubSep
    Serialize = Serialize & m_sPicture & m_cItemSubSep
    Serialize = Serialize & m_sUnIdentifiedName & m_cItemSubSep
    Serialize = Serialize & m_bActive & m_cItemSubSep
    Serialize = Serialize & m_nType & m_cItemSubSep
    Serialize = Serialize & m_nWeapon_NumDice & m_cItemSubSep
    Serialize = Serialize & m_nWeapon_DiceSides & m_cItemSubSep
    Serialize = Serialize & m_nWeapon_Damage & m_cItemSubSep
    Serialize = Serialize & m_sWeapProfType & m_cItemSubSep
    Serialize = Serialize & m_nCharges & m_cItemSubSep
    Serialize = Serialize & m_sMacros & m_cItemSubSep
    Serialize = Serialize & m_sWeapon_Text & m_cItemSubSep
        
    
    Call WriteProcStop(sRoutineName) ' Serialize)
    'Exit the sub... on an error we will jump over this function
    Exit Function
ErrorHandler:
    Call LogErrorToFile(sRoutineName & "." & Err.Description): Call g_oErrors.HandleErrorWithSource(Err, sRoutineName): Call g_oErrors.DisplayErrorCount
    
End Function
Public Function DeSerialize(sItem As String) As String

    On Error GoTo ErrorHandler
    Dim sRoutineName As String
    sRoutineName = m_cNAME & ".DeSerialize"
    Call WriteProcStart(sRoutineName)


    Dim sRemStr As String
    sRemStr = sItem
    
    m_sGUID = Left(sRemStr, InStr(sRemStr, m_cItemSubSep) - 1)
        sRemStr = Right(sRemStr, Len(sRemStr) - InStr(sRemStr, m_cItemSubSep) - Len(m_cItemSubSep) + 1)
    m_bIdentified = Left(sRemStr, InStr(sRemStr, m_cItemSubSep) - 1)
        sRemStr = Right(sRemStr, Len(sRemStr) - InStr(sRemStr, m_cItemSubSep) - Len(m_cItemSubSep) + 1)
    m_sIdentifiedName = Left(sRemStr, InStr(sRemStr, m_cItemSubSep) - 1)
        sRemStr = Right(sRemStr, Len(sRemStr) - InStr(sRemStr, m_cItemSubSep) - Len(m_cItemSubSep) + 1)
    m_sDescription = Left(sRemStr, InStr(sRemStr, m_cItemSubSep) - 1)
        sRemStr = Right(sRemStr, Len(sRemStr) - InStr(sRemStr, m_cItemSubSep) - Len(m_cItemSubSep) + 1)
    m_nItemID = Left(sRemStr, InStr(sRemStr, m_cItemSubSep) - 1)
        sRemStr = Right(sRemStr, Len(sRemStr) - InStr(sRemStr, m_cItemSubSep) - Len(m_cItemSubSep) + 1)
    m_nWeight = Left(sRemStr, InStr(sRemStr, m_cItemSubSep) - 1)
        sRemStr = Right(sRemStr, Len(sRemStr) - InStr(sRemStr, m_cItemSubSep) - Len(m_cItemSubSep) + 1)
    m_nBulk = Left(sRemStr, InStr(sRemStr, m_cItemSubSep) - 1)
        sRemStr = Right(sRemStr, Len(sRemStr) - InStr(sRemStr, m_cItemSubSep) - Len(m_cItemSubSep) + 1)
    m_sValue = Left(sRemStr, InStr(sRemStr, m_cItemSubSep) - 1)
        sRemStr = Right(sRemStr, Len(sRemStr) - InStr(sRemStr, m_cItemSubSep) - Len(m_cItemSubSep) + 1)
    m_bDetectsAsMagic = Left(sRemStr, InStr(sRemStr, m_cItemSubSep) - 1)
        sRemStr = Right(sRemStr, Len(sRemStr) - InStr(sRemStr, m_cItemSubSep) - Len(m_cItemSubSep) + 1)
    m_sTypeOfMagic = Left(sRemStr, InStr(sRemStr, m_cItemSubSep) - 1)
        sRemStr = Right(sRemStr, Len(sRemStr) - InStr(sRemStr, m_cItemSubSep) - Len(m_cItemSubSep) + 1)
    m_nTHACOBonus = Left(sRemStr, InStr(sRemStr, m_cItemSubSep) - 1)
        sRemStr = Right(sRemStr, Len(sRemStr) - InStr(sRemStr, m_cItemSubSep) - Len(m_cItemSubSep) + 1)
    m_nInitBonus = Left(sRemStr, InStr(sRemStr, m_cItemSubSep) - 1)
        sRemStr = Right(sRemStr, Len(sRemStr) - InStr(sRemStr, m_cItemSubSep) - Len(m_cItemSubSep) + 1)
    m_nACBonus = Left(sRemStr, InStr(sRemStr, m_cItemSubSep) - 1)
        sRemStr = Right(sRemStr, Len(sRemStr) - InStr(sRemStr, m_cItemSubSep) - Len(m_cItemSubSep) + 1)
    m_nSavingThrowBonus = Left(sRemStr, InStr(sRemStr, m_cItemSubSep) - 1)
        sRemStr = Right(sRemStr, Len(sRemStr) - InStr(sRemStr, m_cItemSubSep) - Len(m_cItemSubSep) + 1)
    m_nCharID = Left(sRemStr, InStr(sRemStr, m_cItemSubSep) - 1)
        sRemStr = Right(sRemStr, Len(sRemStr) - InStr(sRemStr, m_cItemSubSep) - Len(m_cItemSubSep) + 1)
    m_sPicture = Left(sRemStr, InStr(sRemStr, m_cItemSubSep) - 1)
        sRemStr = Right(sRemStr, Len(sRemStr) - InStr(sRemStr, m_cItemSubSep) - Len(m_cItemSubSep) + 1)
    m_sUnIdentifiedName = Left(sRemStr, InStr(sRemStr, m_cItemSubSep) - 1)
        sRemStr = Right(sRemStr, Len(sRemStr) - InStr(sRemStr, m_cItemSubSep) - Len(m_cItemSubSep) + 1)
    m_bActive = Left(sRemStr, InStr(sRemStr, m_cItemSubSep) - 1)
        sRemStr = Right(sRemStr, Len(sRemStr) - InStr(sRemStr, m_cItemSubSep) - Len(m_cItemSubSep) + 1)
    m_nType = Left(sRemStr, InStr(sRemStr, m_cItemSubSep) - 1)
        sRemStr = Right(sRemStr, Len(sRemStr) - InStr(sRemStr, m_cItemSubSep) - Len(m_cItemSubSep) + 1)
    m_nWeapon_NumDice = Left(sRemStr, InStr(sRemStr, m_cItemSubSep) - 1)
        sRemStr = Right(sRemStr, Len(sRemStr) - InStr(sRemStr, m_cItemSubSep) - Len(m_cItemSubSep) + 1)
    m_nWeapon_DiceSides = Left(sRemStr, InStr(sRemStr, m_cItemSubSep) - 1)
        sRemStr = Right(sRemStr, Len(sRemStr) - InStr(sRemStr, m_cItemSubSep) - Len(m_cItemSubSep) + 1)
    m_nWeapon_Damage = Left(sRemStr, InStr(sRemStr, m_cItemSubSep) - 1)
        sRemStr = Right(sRemStr, Len(sRemStr) - InStr(sRemStr, m_cItemSubSep) - Len(m_cItemSubSep) + 1)
    m_sWeapProfType = Left(sRemStr, InStr(sRemStr, m_cItemSubSep) - 1)
        sRemStr = Right(sRemStr, Len(sRemStr) - InStr(sRemStr, m_cItemSubSep) - Len(m_cItemSubSep) + 1)
    m_nCharges = Left(sRemStr, InStr(sRemStr, m_cItemSubSep) - 1)
        sRemStr = Right(sRemStr, Len(sRemStr) - InStr(sRemStr, m_cItemSubSep) - Len(m_cItemSubSep) + 1)
    m_sMacros = Left(sRemStr, InStr(sRemStr, m_cItemSubSep) - 1)
        sRemStr = Right(sRemStr, Len(sRemStr) - InStr(sRemStr, m_cItemSubSep) - Len(m_cItemSubSep) + 1)
    m_sWeapon_Text = Left(sRemStr, InStr(sRemStr, m_cItemSubSep) - 1)
        sRemStr = Right(sRemStr, Len(sRemStr) - InStr(sRemStr, m_cItemSubSep) - Len(m_cItemSubSep) + 1)
        
    DeSerialize = sRemStr
    
    
    Call WriteProcStop(sRoutineName) ' sRemStr)
    'Exit the sub... on an error we will jump over this function
    Exit Function
ErrorHandler:
    Call LogErrorToFile(sRoutineName & "." & Err.Description): Call g_oErrors.HandleErrorWithSource(Err, sRoutineName): Call g_oErrors.DisplayErrorCount
    
End Function
Public Function Item(sStatName As String, Optional vNewVal As Variant = "<Nothing>") As Variant

    On Error GoTo ErrorHandler
    Dim sRoutineName As String
    sRoutineName = m_cNAME & ".Item"
    Call WriteProcStart(sRoutineName) ' sStatName, vNewVal)


    If sStatName = "Charges" Then
        If Not vNewVal = "<Nothing>" Then m_nCharges = vNewVal
        Item = m_nCharges
    ElseIf sStatName = "WeapProfType" Then
        If Not vNewVal = "<Nothing>" Then m_sWeapProfType = vNewVal
        Item = m_sWeapProfType
    ElseIf sStatName = "Weapon_Damage" Then
        If Not vNewVal = "<Nothing>" Then m_nWeapon_Damage = vNewVal
        Item = m_nWeapon_Damage
    ElseIf sStatName = "Weapon_DiceSides" Then
        If Not vNewVal = "<Nothing>" Then m_nWeapon_DiceSides = vNewVal
        Item = m_nWeapon_DiceSides
    ElseIf sStatName = "Weapon_NumDice" Then
        If Not vNewVal = "<Nothing>" Then m_nWeapon_NumDice = vNewVal
        Item = m_nWeapon_NumDice
    ElseIf sStatName = "Type" Then
        If Not vNewVal = "<Nothing>" Then m_nType = vNewVal
        Item = m_nType
    ElseIf sStatName = "Active" Then
        If Not vNewVal = "<Nothing>" Then m_bActive = vNewVal
        Item = m_bActive
    ElseIf sStatName = "Picture" Then
        If Not vNewVal = "<Nothing>" Then m_sPicture = vNewVal
        Item = m_sPicture
    ElseIf sStatName = "SavingThrowBonus" Then
        If Not vNewVal = "<Nothing>" Then m_nSavingThrowBonus = vNewVal
        Item = m_nSavingThrowBonus
    ElseIf sStatName = "ACBonus" Then
        If Not vNewVal = "<Nothing>" Then m_nACBonus = vNewVal
        Item = m_nACBonus
    ElseIf sStatName = "InitBonus" Then
        If Not vNewVal = "<Nothing>" Then m_nInitBonus = vNewVal
        Item = m_nInitBonus
    ElseIf sStatName = "THACOBonus" Then
        If Not vNewVal = "<Nothing>" Then m_nTHACOBonus = vNewVal
        Item = m_nTHACOBonus
    ElseIf sStatName = "TypeOfMagic" Then
        If Not vNewVal = "<Nothing>" Then m_sTypeOfMagic = vNewVal
        Item = m_sTypeOfMagic
    ElseIf sStatName = "DetectsAsMagic" Then
        If Not vNewVal = "<Nothing>" Then m_bDetectsAsMagic = vNewVal
        Item = m_bDetectsAsMagic
    ElseIf sStatName = "Value" Then
        If Not vNewVal = "<Nothing>" Then m_sValue = vNewVal
        Item = m_sValue
    ElseIf sStatName = "Bulk" Then
        If Not vNewVal = "<Nothing>" Then m_nBulk = vNewVal
        Item = m_nBulk
    ElseIf sStatName = "Weight" Then
        If Not vNewVal = "<Nothing>" Then m_nWeight = vNewVal
        Item = m_nWeight
    ElseIf sStatName = "Description" Then
        If Not vNewVal = "<Nothing>" Then m_sDescription = vNewVal
        Item = m_sDescription
    ElseIf sStatName = "Name" Then
        If Not vNewVal = "<Nothing>" Then m_sIdentifiedName = vNewVal
        Item = ItemName()
    ElseIf sStatName = "Identified" Then
        If Not vNewVal = "<Nothing>" Then m_bIdentified = vNewVal
        Item = m_bIdentified
    ElseIf sStatName = "Weapon_Text" Then
        If Not vNewVal = "<Nothing>" Then m_sWeapon_Text = vNewVal
        Item = m_sWeapon_Text
    Else
        Item = m_cNotAStat
    End If


    Call WriteProcStop(sRoutineName)
    'Exit the sub... on an error we will jump over this function
    Exit Function
ErrorHandler:
    Call LogErrorToFile(sRoutineName & "." & Err.Description): Call g_oErrors.HandleErrorWithSource(Err, sRoutineName): Call g_oErrors.DisplayErrorCount
    
End Function

