# • ▌ ▄ ·. ▄▄▄▄·     ▄▄▄ .·▄▄▄▄  ▪  ▄▄▄▄▄      ▄▄▄       ▄▄▄·▄▄▄        
# ·██ ▐███▪▐█ ▀█▪    ▀▄.▀·██▪ ██ ██ •██  ▪     ▀▄ █·    ▐█ ▄█▀▄ █·▪     
# ▐█ ▌▐▌▐█·▐█▀▀█▄    ▐▀▀▪▄▐█· ▐█▌▐█· ▐█.▪ ▄█▀▄ ▐▀▀▄      ██▀·▐▀▀▄  ▄█▀▄ 
# ██ ██▌▐█▌██▄▪▐█    ▐█▄▄▌██. ██ ▐█▌ ▐█▌·▐█▌.▐▌▐█•█▌    ▐█▪·•▐█•█▌▐█▌.▐▌
# ▀▀  █▪▀▀▀·▀▀▀▀      ▀▀▀ ▀▀▀▀▀• ▀▀▀ ▀▀▀  ▀█▄▀▪.▀  ▀    .▀   .▀  ▀ ▀█▄▀▪
#               Magicbane Emulator Project © 2013 - 2022
#                          www.magicbane.com

SPARSE_VAL_LONG = 0  # dword
SPARSE_VAL_FLOAT = 1  # float
SPARSE_VAL_BOOL = 2  # bool
SPARSE_UID = 3  # dword
SPARSE_REF_VECTOR3 = 4  # float (3)
SPARSE_REF_ANIM_TYPE = 5  # NONE (initialize)
SPARSE_REF_ARC_STRING = 6  # string
SPARSE_REF_PROJECTILE_IMPACT_INFO = 7  # NONE (initialize)
SPARSE_REF_PET_DATA = 8  # NONE (initialize)
SPARSE_REF_MERCHANT_DATA = 9  # dword (3)
SPARSE_REF_ARC_CACHE_ID = 10  # qword
SPARSE_PTR_ANIM_INFO = 11  # NONE (initialize)
SPARSE_PTR_CLIENT_ALLIANCE_MASTER = 12  # NONE (initialize)
SPARSE_PTR_ACTION_RESPONSE = 13  # dword ???
SPARSE_OWNED_PTR_REF_LONG = 14  # NONE (initialize)
SPARSE_LINKED_PTR_ARC_SPELL_EFFECT = 15  # NONE (initialize)
SPARSE_LINKED_PTR_ARC_OBJECT = 16  # NONE (initialize)
SPARSE_LINKED_PTR_ARC_CHARACTER = 17  # NONE (initialize)
SPARSE_ENUM_ITEM_TYPE = 18  # dword

SPARSE_TAG_TO_SPARSE_TYPE = {
    0xd6c9ccff: SPARSE_VAL_BOOL,
    0x974632fc: SPARSE_REF_ARC_CACHE_ID,
    0x33264efb: SPARSE_VAL_BOOL,
    0xb050a1f8: SPARSE_VAL_BOOL,
    0x74ac9ff4: SPARSE_VAL_BOOL,
    0xfa3097f3: SPARSE_VAL_LONG,
    0xfcb7daf0: SPARSE_VAL_BOOL,
    0xd3fcf8ef: SPARSE_VAL_LONG,
    0x68108be9: SPARSE_VAL_BOOL,
    0x0003eee2: SPARSE_VAL_FLOAT,
    0x9bc2dae1: SPARSE_VAL_BOOL,
    0xec0358e0: SPARSE_REF_PET_DATA,
    0x0ebddedc: SPARSE_VAL_BOOL,
    0x4b9bffe9: SPARSE_VAL_BOOL,
    0x632720d3: SPARSE_VAL_BOOL,
    0x4ec9a98b: SPARSE_VAL_LONG,
    0x001215cd: SPARSE_UID,
    0xf0e64dcb: SPARSE_VAL_BOOL,
    0x19fe50c4: SPARSE_VAL_LONG,
    0x79933e68: SPARSE_VAL_BOOL,
    0xce9332c2: SPARSE_VAL_BOOL,
    0x016e5bbc: SPARSE_LINKED_PTR_ARC_CHARACTER,
    0x7c4c10bb: SPARSE_VAL_BOOL,
    0x164018ba: SPARSE_REF_ARC_CACHE_ID,
    0x81b3a0b8: SPARSE_VAL_LONG,
    0xdb45b0b6: SPARSE_VAL_BOOL,
    0xcfbf3912: SPARSE_LINKED_PTR_ARC_SPELL_EFFECT,
    0xb1ebd7af: SPARSE_VAL_BOOL,
    0xfb5a0fae: SPARSE_VAL_BOOL,
    0x86b3f6ac: SPARSE_VAL_BOOL,
    0xec9375a5: SPARSE_REF_ARC_CACHE_ID,
    0xdce49ee0: SPARSE_VAL_BOOL,
    0xef28bc61: SPARSE_VAL_LONG,
    0xed365292: SPARSE_REF_ARC_CACHE_ID,
    0x247a9c91: SPARSE_REF_ARC_STRING,
    0x9c57a38f: SPARSE_REF_ARC_CACHE_ID,
    0xd41c4373: SPARSE_VAL_BOOL,
    0x56c43c4a: SPARSE_VAL_BOOL,
    0x9b816e84: SPARSE_VAL_BOOL,
    0xc973df7b: SPARSE_VAL_BOOL,
    0xe5919779: SPARSE_VAL_LONG,
    0xac494477: SPARSE_VAL_BOOL,
    0x0513cb74: SPARSE_ENUM_ITEM_TYPE,
    0x0f13b873: SPARSE_VAL_FLOAT,
    0xeec1c470: SPARSE_VAL_BOOL,
    0x18edb06b: SPARSE_PTR_ANIM_INFO,
    0x90493768: SPARSE_REF_ARC_STRING,
    0xc231f466: SPARSE_VAL_BOOL,
    0x5dd6d263: SPARSE_VAL_FLOAT,
    0xa074b062: SPARSE_VAL_LONG,
    0xc9033661: SPARSE_REF_ARC_CACHE_ID,
    0x5de60660: SPARSE_REF_ARC_STRING,
    0x2778c65e: SPARSE_REF_MERCHANT_DATA,
    0x7add7b5b: SPARSE_REF_VECTOR3,
    0xa0736056: SPARSE_REF_VECTOR3,
    0x192fbb63: SPARSE_VAL_BOOL,
    0xa2e74b50: SPARSE_VAL_LONG,
    0xf3c4b6b2: SPARSE_VAL_BOOL,
    0x2395a34a: SPARSE_VAL_BOOL,
    0xbb0b3547: SPARSE_VAL_BOOL,
    0xf95e662c: SPARSE_PTR_ACTION_RESPONSE,
    0xf7638542: SPARSE_VAL_BOOL,
    0xb347c33f: SPARSE_VAL_BOOL,
    0x4052ed3a: SPARSE_LINKED_PTR_ARC_OBJECT,
    0x76be8439: SPARSE_VAL_BOOL,
    0x0c684d37: SPARSE_REF_MERCHANT_DATA,
    0xadeb5733: SPARSE_VAL_BOOL,
    0xc8c49031: SPARSE_VAL_BOOL,
    0xa5e4ee2f: SPARSE_VAL_LONG,
    0xe41fc02d: SPARSE_PTR_CLIENT_ALLIANCE_MASTER,
    0xcf26f82c: SPARSE_VAL_BOOL,
    0xee8afac4: SPARSE_VAL_BOOL,
    0xfca1c13f: SPARSE_VAL_BOOL,
    0x5bfed2e0: SPARSE_REF_ANIM_TYPE,
    0x99454720: SPARSE_VAL_BOOL,
    0xdcf35c1b: SPARSE_UID,
    0x8c232316: SPARSE_VAL_BOOL,
    0xd8abfa13: SPARSE_VAL_LONG,
    0x16398a12: SPARSE_VAL_BOOL,
    0xbb7dcd11: SPARSE_VAL_BOOL,
    0x938c185b: SPARSE_VAL_BOOL,
    0xffad4f07: SPARSE_VAL_LONG,
    0xd37af906: SPARSE_OWNED_PTR_REF_LONG,
    0x35b3682c: SPARSE_REF_PROJECTILE_IMPACT_INFO,
    0x866d4200: SPARSE_VAL_BOOL,
}

SPARSE_TAG_TO_STRING = {
    0xd6c9ccff: 'GoalDirection',
    0x974632fc: 'oldGuildID',
    0x33264efb: 'ADMIN_CAN_GUILDWHO',
    0xb050a1f8: 'ADMIN_CAN_SHUTDOWNSERVER',
    0x74ac9ff4: 'ADMIN_CAN_DISCONNECTPLAYERS',
    0xfa3097f3: 'ADMIN_SNOOPLEVEL',
    0xfcb7daf0: 'ADMIN_CAN_DELETEUSER',
    0xd3fcf8ef: 'GEN_TABLE_ID',
    0x68108be9: 'ADMIN_CAN_TELEPORT',
    0x0003eee2: 'buy%',
    0x9bc2dae1: 'ADMIN_CAN_LOCATE',
    0xec0358e0: 'petData',
    0x0ebddedc: 'ADMIN_CAN_SET_DECAY',
    0x4b9bffe9: 'ADMIN_CAN_ZONE',
    0x632720d3: 'PGOV_PLAYER',
    0x4ec9a98b: 'ADMIN_REMOVEEQUIPMENTEFFECTSLEVEL',
    0x001215cd: 'MODE',
    0xf0e64dcb: 'ADMIN_IS_WORLDBUILDER',
    0x19fe50c4: 'trainerSkillCost',
    0x79933e68: 'ADMIN_CAN_MODIFYUSER',
    0xce9332c2: 'shopkeeper',
    0x016e5bbc: 'PeekTarget',
    0x7c4c10bb: 'IS_ANNOUNCED_ITEM',
    0x164018ba: 'DISC_PROMOTION_RUNEID',
    0x81b3a0b8: 'ADMIN_TOKENREADACCESSLEVEL',
    0xdb45b0b6: 'ADMIN_CAN_ACCESSPETITIONSYSTEM',
    0xcfbf3912: 'SpellEffect',
    0xb1ebd7af: 'ADMIN_CAN_UPLOADMOTD',
    0xfb5a0fae: 'ADMIN_IS_INVULNERABLE',
    0x86b3f6ac: 'ADMIN_CAN_PURGE',
    0xec9375a5: 'oldNationID',
    0xdce49ee0: 'ADMIN_CAN_DELETECHARACTER',
    0xef28bc61: 'MAX_POWER_LEVEL',
    0xed365292: 'liveInstanceID',
    0x247a9c91: 'ROOTFSMID',
    0x9c57a38f: 'ITEMTOREPLACE',
    0xd41c4373: 'ADMIN_CAN_TELEPORTOTHER',
    0x56c43c4a: 'isMinion',
    0x9b816e84: 'ADMIN_CAN_POSSESS',
    0xc973df7b: 'ADMIN_CAN_RECEIVE_TELLS',
    0xe5919779: 'ADMIN_ACCESSLEVEL',
    0xac494477: 'wasPet',
    0x0513cb74: 'types',
    0x0f13b873: 'sales%',
    0xeec1c470: 'ADMIN_CAN_GETINFO',
    0x18edb06b: 'altAttackAnims',
    0x90493768: 'shopFile',
    0xc231f466: 'IMMUNE_TO_STEAL',
    0x5dd6d263: 'charOrientation',
    0xa074b062: 'banker',
    0xc9033661: 'CLASS_PROMOTION_RUNEID',
    0x5de60660: 'ACTIONMESSAGE',
    0x2778c65e: 'merchantData',
    0x7add7b5b: 'charLocation',
    0xa0736056: 'WanderDir',
    0x192fbb63: 'CharMarkedForDelete',
    0xa2e74b50: 'expLost',
    0xf3c4b6b2: 'ADMIN_ISWOLFPACKDEV',
    0x2395a34a: 'WaitingInvite',
    0xbb0b3547: 'ADMIN_CAN_GETINVENTORY',
    0xf95e662c: 'ACTIONRESPONSE',
    0xf7638542: 'ADMIN_CAN_SETINVULNERABLE',
    0xb347c33f: 'ADMIN_CAN_TRANSFER',
    0x4052ed3a: 'trackingArrow',
    0x76be8439: 'ADMIN_CAN_SUMMON',
    0x0c684d37: 'GuardData',
    0xadeb5733: 'ADMIN_CAN_OBJECTEDIT',
    0xc8c49031: 'ADMIN_ISADMIN',
    0xa5e4ee2f: 'ADMIN_CHANNELACCESSLEVEL',
    0xe41fc02d: 'ClientAllianceMaster',
    0xcf26f82c: 'ADMIN_CAN_TELL_ADMIN',
    0xee8afac4: 'ADMIN_CAN_SETSTAT',
    0xfca1c13f: 'ADMIN_IS_GUILDGODADMIN',
    0x5bfed2e0: 'BladeTrailAnims',
    0x99454720: 'CAN_ENTER_COMBAT',
    0xdcf35c1b: 'ADMIN_IP_RESTRICTION',
    0x8c232316: 'ADMIN_CAN_USE_ITEM_WIZ',
    0xd8abfa13: 'ADMIN_TOKENWRITEACCESSLEVEL',
    0x16398a12: 'isTrainer',
    0xbb7dcd11: 'ADMIN_CAN_SUMMONCORPSE',
    0x938c185b: 'CAN_PICKUPANDDROPITEMS',
    0xffad4f07: 'ADMIN_REMOVEPOWEREFFECTSLEVEL',
    0xd37af906: 'merchantOptions',
    0x35b3682c: 'projectileImpactInfo',
    0x866d4200: 'ADMIN_CAN_TRANSFORM_RACE',
}

STRING_TO_SPARSE_TAG = {
    'GoalDirection': 0xd6c9ccff,
    'oldGuildID': 0x974632fc,
    'ADMIN_CAN_GUILDWHO': 0x33264efb,
    'ADMIN_CAN_SHUTDOWNSERVER': 0xb050a1f8,
    'ADMIN_CAN_DISCONNECTPLAYERS': 0x74ac9ff4,
    'ADMIN_SNOOPLEVEL': 0xfa3097f3,
    'ADMIN_CAN_DELETEUSER': 0xfcb7daf0,
    'GEN_TABLE_ID': 0xd3fcf8ef,
    'ADMIN_CAN_TELEPORT': 0x68108be9,
    'buy%': 0x0003eee2,
    'ADMIN_CAN_LOCATE': 0x9bc2dae1,
    'petData': 0xec0358e0,
    'ADMIN_CAN_SET_DECAY': 0x0ebddedc,
    'ADMIN_CAN_ZONE': 0x4b9bffe9,
    'PGOV_PLAYER': 0x632720d3,
    'ADMIN_REMOVEEQUIPMENTEFFECTSLEVEL': 0x4ec9a98b,
    'MODE': 0x001215cd,
    'ADMIN_IS_WORLDBUILDER': 0xf0e64dcb,
    'trainerSkillCost': 0x19fe50c4,
    'ADMIN_CAN_MODIFYUSER': 0x79933e68,
    'shopkeeper': 0xce9332c2,
    'PeekTarget': 0x016e5bbc,
    'IS_ANNOUNCED_ITEM': 0x7c4c10bb,
    'DISC_PROMOTION_RUNEID': 0x164018ba,
    'ADMIN_TOKENREADACCESSLEVEL': 0x81b3a0b8,
    'ADMIN_CAN_ACCESSPETITIONSYSTEM': 0xdb45b0b6,
    'SpellEffect': 0xcfbf3912,
    'ADMIN_CAN_UPLOADMOTD': 0xb1ebd7af,
    'ADMIN_IS_INVULNERABLE': 0xfb5a0fae,
    'ADMIN_CAN_PURGE': 0x86b3f6ac,
    'oldNationID': 0xec9375a5,
    'ADMIN_CAN_DELETECHARACTER': 0xdce49ee0,
    'MAX_POWER_LEVEL': 0xef28bc61,
    'liveInstanceID': 0xed365292,
    'ROOTFSMID': 0x247a9c91,
    'ITEMTOREPLACE': 0x9c57a38f,
    'ADMIN_CAN_TELEPORTOTHER': 0xd41c4373,
    'isMinion': 0x56c43c4a,
    'ADMIN_CAN_POSSESS': 0x9b816e84,
    'ADMIN_CAN_RECEIVE_TELLS': 0xc973df7b,
    'ADMIN_ACCESSLEVEL': 0xe5919779,
    'wasPet': 0xac494477,
    'types': 0x0513cb74,
    'sales%': 0x0f13b873,
    'ADMIN_CAN_GETINFO': 0xeec1c470,
    'altAttackAnims': 0x18edb06b,
    'shopFile': 0x90493768,
    'IMMUNE_TO_STEAL': 0xc231f466,
    'charOrientation': 0x5dd6d263,
    'banker': 0xa074b062,
    'CLASS_PROMOTION_RUNEID': 0xc9033661,
    'ACTIONMESSAGE': 0x5de60660,
    'merchantData': 0x2778c65e,
    'charLocation': 0x7add7b5b,
    'WanderDir': 0xa0736056,
    'CharMarkedForDelete': 0x192fbb63,
    'expLost': 0xa2e74b50,
    'ADMIN_ISWOLFPACKDEV': 0xf3c4b6b2,
    'WaitingInvite': 0x2395a34a,
    'ADMIN_CAN_GETINVENTORY': 0xbb0b3547,
    'ACTIONRESPONSE': 0xf95e662c,
    'ADMIN_CAN_SETINVULNERABLE': 0xf7638542,
    'ADMIN_CAN_TRANSFER': 0xb347c33f,
    'trackingArrow': 0x4052ed3a,
    'ADMIN_CAN_SUMMON': 0x76be8439,
    'GuardData': 0x0c684d37,
    'ADMIN_CAN_OBJECTEDIT': 0xadeb5733,
    'ADMIN_ISADMIN': 0xc8c49031,
    'ADMIN_CHANNELACCESSLEVEL': 0xa5e4ee2f,
    'ClientAllianceMaster': 0xe41fc02d,
    'ADMIN_CAN_TELL_ADMIN': 0xcf26f82c,
    'ADMIN_CAN_SETSTAT': 0xee8afac4,
    'ADMIN_IS_GUILDGODADMIN': 0xfca1c13f,
    'BladeTrailAnims': 0x5bfed2e0,
    'CAN_ENTER_COMBAT': 0x99454720,
    'ADMIN_IP_RESTRICTION': 0xdcf35c1b,
    'ADMIN_CAN_USE_ITEM_WIZ': 0x8c232316,
    'ADMIN_TOKENWRITEACCESSLEVEL': 0xd8abfa13,
    'isTrainer': 0x16398a12,
    'ADMIN_CAN_SUMMONCORPSE': 0xbb7dcd11,
    'CAN_PICKUPANDDROPITEMS': 0x938c185b,
    'ADMIN_REMOVEPOWEREFFECTSLEVEL': 0xffad4f07,
    'merchantOptions': 0xd37af906,
    'projectileImpactInfo': 0x35b3682c,
    'ADMIN_CAN_TRANSFORM_RACE': 0x866d4200,
}
