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

ITEM_FLAG_NONE = 1 << 0
ITEM_FLAG_INDESTRUCTIBLE = 1 << 1
ITEM_FLAG_IDENTIFIED = 1 << 2
ITEM_FLAG_NOBOND = 1 << 3
ITEM_FLAG_NOQUIT = 1 << 4
ITEM_FLAG_MAGIC = 1 << 5
ITEM_FLAG_NODROP = 1 << 6
ITEM_FLAG_RARE = 1 << 7
ITEM_FLAG_NUM = 7

ITEM_FLAG_TO_STRING = {
    ITEM_FLAG_NONE: 'None',
    ITEM_FLAG_INDESTRUCTIBLE: 'Indestructible',
    ITEM_FLAG_IDENTIFIED: 'Identified',
    ITEM_FLAG_NOBOND: 'NoBond',
    ITEM_FLAG_NOQUIT: 'NoQuit',
    ITEM_FLAG_MAGIC: 'Magic',
    ITEM_FLAG_NODROP: 'NoDrop',
    ITEM_FLAG_RARE: 'Rare',
}

STRING_TO_ITEM_FLAG = {
    'None': ITEM_FLAG_NONE,
    'Indestructible': ITEM_FLAG_INDESTRUCTIBLE,
    'Identified': ITEM_FLAG_IDENTIFIED,
    'NoBond': ITEM_FLAG_NOBOND,
    'NoQuit': ITEM_FLAG_NOQUIT,
    'Magic': ITEM_FLAG_MAGIC,
    'NoDrop': ITEM_FLAG_NODROP,
    'Rare': ITEM_FLAG_RARE,
}

ITEM_EQUIP_SLOT_NONE = 0
ITEM_EQUIP_SLOT_RHELD = 1 << 0
ITEM_EQUIP_SLOT_LHELD = 1 << 1
ITEM_EQUIP_SLOT_HELM = 1 << 2
ITEM_EQUIP_SLOT_CHEST = 1 << 3
ITEM_EQUIP_SLOT_SLEEVES = 1 << 4
ITEM_EQUIP_SLOT_HANDS = 1 << 5
ITEM_EQUIP_SLOT_RRING = 1 << 6
ITEM_EQUIP_SLOT_LRING = 1 << 7
ITEM_EQUIP_SLOT_AMULET = 1 << 8
ITEM_EQUIP_SLOT_LEGS = 1 << 9
ITEM_EQUIP_SLOT_FEET = 1 << 10
ITEM_EQUIP_SLOT_CLOAK = 1 << 11
ITEM_EQUIP_SLOT_SHIN = 1 << 12
ITEM_EQUIP_SLOT_UPLEGS = 1 << 13
ITEM_EQUIP_SLOT_UPARM = 1 << 14
ITEM_EQUIP_SLOT_WINGS = 1 << 15
ITEM_EQUIP_SLOT_BEARD = 1 << 16
ITEM_EQUIP_SLOT_HAIR = 1 << 17
ITEM_EQUIP_SLOT_NUM = 18

ITEM_EQIP_SLOT_TO_STRING = {
    ITEM_EQUIP_SLOT_NONE: 'NONE',
    ITEM_EQUIP_SLOT_RHELD: 'RHELD',
    ITEM_EQUIP_SLOT_LHELD: 'LHELD',
    ITEM_EQUIP_SLOT_HELM: 'HELM',
    ITEM_EQUIP_SLOT_CHEST: 'CHEST',
    ITEM_EQUIP_SLOT_SLEEVES: 'SLEEVES',
    ITEM_EQUIP_SLOT_HANDS: 'HANDS',
    ITEM_EQUIP_SLOT_RRING: 'RRING',
    ITEM_EQUIP_SLOT_LRING: 'LRING',
    ITEM_EQUIP_SLOT_AMULET: 'AMULET',
    ITEM_EQUIP_SLOT_LEGS: 'LEGS',
    ITEM_EQUIP_SLOT_FEET: 'FEET',
    ITEM_EQUIP_SLOT_CLOAK: 'CLOAK',
    ITEM_EQUIP_SLOT_SHIN: 'SHIN',
    ITEM_EQUIP_SLOT_UPLEGS: 'UPLEGS',
    ITEM_EQUIP_SLOT_UPARM: 'UPARM',
    ITEM_EQUIP_SLOT_WINGS: 'WINGS',
    ITEM_EQUIP_SLOT_BEARD: 'BEARD',
    ITEM_EQUIP_SLOT_HAIR: 'HAIR',
}

STRING_TO_ITEM_EQIP_SLOT = {
    'NONE': ITEM_EQUIP_SLOT_NONE,
    'RHELD': ITEM_EQUIP_SLOT_RHELD,
    'LHELD': ITEM_EQUIP_SLOT_LHELD,
    'HELM': ITEM_EQUIP_SLOT_HELM,
    'CHEST': ITEM_EQUIP_SLOT_CHEST,
    'SLEEVES': ITEM_EQUIP_SLOT_SLEEVES,
    'HANDS': ITEM_EQUIP_SLOT_HANDS,
    'RRING': ITEM_EQUIP_SLOT_RRING,
    'LRING': ITEM_EQUIP_SLOT_LRING,
    'AMULET': ITEM_EQUIP_SLOT_AMULET,
    'LEGS': ITEM_EQUIP_SLOT_LEGS,
    'FEET': ITEM_EQUIP_SLOT_FEET,
    'CLOAK': ITEM_EQUIP_SLOT_CLOAK,
    'SHIN': ITEM_EQUIP_SLOT_SHIN,
    'UPLEGS': ITEM_EQUIP_SLOT_UPLEGS,
    'UPARM': ITEM_EQUIP_SLOT_UPARM,
    'WINGS': ITEM_EQUIP_SLOT_WINGS,
    'BEARD': ITEM_EQUIP_SLOT_BEARD,
    'HAIR': ITEM_EQUIP_SLOT_HAIR,
}

ITEM_TYPE_UNKNOWN = 0
ITEM_TYPE_WEAPON = 1
ITEM_TYPE_ARMOR = 2
ITEM_TYPE_BASE = 3
ITEM_TYPE_GOLD = 4
ITEM_TYPE_SCROLL = 5
ITEM_TYPE_BOOK = 6
ITEM_TYPE_WAND = 7
ITEM_TYPE_POTION = 8
ITEM_TYPE_KEY = 9
ITEM_TYPE_CHARTER = 10
ITEM_TYPE_GUILDTREE = 11
ITEM_TYPE_SOUNDSOURCE = 12
ITEM_TYPE_JEWELRY = 13
ITEM_TYPE_CONTAINER = 14
ITEM_TYPE_FOUNTAIN = 15
ITEM_TYPE_FOOD = 16
ITEM_TYPE_DRINKCONTAINER = 17
ITEM_TYPE_MAPMARKER = 18
ITEM_TYPE_DEED = 19
ITEM_TYPE_EMPLOYMENTCONTRACT = 20
ITEM_TYPE_PETTOTEM = 21
ITEM_TYPE_SLAVECOLLAR = 22
ITEM_TYPE_BLANKKEY = 23
ITEM_TYPE_WARRANT = 24
ITEM_TYPE_FURNITUREDEED = 25
ITEM_TYPE_TENT = 26
ITEM_TYPE_REAGENT = 27
ITEM_TYPE_DEVICE = 28
ITEM_TYPE_FORMULA = 29
ITEM_TYPE_BUCKET = 30
ITEM_TYPE_TREASURE = 31
ITEM_TYPE_RUNE = 32
ITEM_TYPE_OFFERING = 33
ITEM_TYPE_RESOURCE = 34
ITEM_TYPE_REALMCHARTER = 35

ITEM_TYPE_TO_STRING = {
    ITEM_TYPE_UNKNOWN: 'UNKNOWN',
    ITEM_TYPE_WEAPON: 'WEAPON',
    ITEM_TYPE_ARMOR: 'ARMOR',
    ITEM_TYPE_BASE: 'BASE',
    ITEM_TYPE_GOLD: 'GOLD',
    ITEM_TYPE_SCROLL: 'SCROLL',
    ITEM_TYPE_BOOK: 'BOOK',
    ITEM_TYPE_WAND: 'WAND',
    ITEM_TYPE_POTION: 'POTION',
    ITEM_TYPE_KEY: 'KEY',
    ITEM_TYPE_CHARTER: 'CHARTER',
    ITEM_TYPE_GUILDTREE: 'GUILDTREE',
    ITEM_TYPE_SOUNDSOURCE: 'SOUNDSOURCE',
    ITEM_TYPE_JEWELRY: 'JEWELRY',
    ITEM_TYPE_CONTAINER: 'CONTAINER',
    ITEM_TYPE_FOUNTAIN: 'FOUNTAIN',
    ITEM_TYPE_FOOD: 'FOOD',
    ITEM_TYPE_DRINKCONTAINER: 'DRINKCONTAINER',
    ITEM_TYPE_MAPMARKER: 'MAPMARKER',
    ITEM_TYPE_DEED: 'DEED',
    ITEM_TYPE_EMPLOYMENTCONTRACT: 'EMPLOYMENTCONTRACT',
    ITEM_TYPE_PETTOTEM: 'PETTOTEM',
    ITEM_TYPE_SLAVECOLLAR: 'SLAVECOLLAR',
    ITEM_TYPE_BLANKKEY: 'BLANKKEY',
    ITEM_TYPE_WARRANT: 'WARRANT',
    ITEM_TYPE_FURNITUREDEED: 'FURNITUREDEED',
    ITEM_TYPE_TENT: 'TENT',
    ITEM_TYPE_REAGENT: 'REAGENT',
    ITEM_TYPE_DEVICE: 'DEVICE',
    ITEM_TYPE_FORMULA: 'FORMULA',
    ITEM_TYPE_BUCKET: 'BUCKET',
    ITEM_TYPE_TREASURE: 'TREASURE',
    ITEM_TYPE_RUNE: 'RUNE',
    ITEM_TYPE_OFFERING: 'OFFERING',
    ITEM_TYPE_RESOURCE: 'RESOURCE',
    ITEM_TYPE_REALMCHARTER: 'REALMCHARTER',
}

STRING_TO_ITEM_TYPE = {
    'UNKNOWN': ITEM_TYPE_UNKNOWN,
    'WEAPON': ITEM_TYPE_WEAPON,
    'ARMOR': ITEM_TYPE_ARMOR,
    'BASE': ITEM_TYPE_BASE,
    'GOLD': ITEM_TYPE_GOLD,
    'SCROLL': ITEM_TYPE_SCROLL,
    'BOOK': ITEM_TYPE_BOOK,
    'WAND': ITEM_TYPE_WAND,
    'POTION': ITEM_TYPE_POTION,
    'KEY': ITEM_TYPE_KEY,
    'CHARTER': ITEM_TYPE_CHARTER,
    'GUILDTREE': ITEM_TYPE_GUILDTREE,
    'SOUNDSOURCE': ITEM_TYPE_SOUNDSOURCE,
    'JEWELRY': ITEM_TYPE_JEWELRY,
    'CONTAINER': ITEM_TYPE_CONTAINER,
    'FOUNTAIN': ITEM_TYPE_FOUNTAIN,
    'FOOD': ITEM_TYPE_FOOD,
    'DRINKCONTAINER': ITEM_TYPE_DRINKCONTAINER,
    'MAPMARKER': ITEM_TYPE_MAPMARKER,
    'DEED': ITEM_TYPE_DEED,
    'EMPLOYMENTCONTRACT': ITEM_TYPE_EMPLOYMENTCONTRACT,
    'PETTOTEM': ITEM_TYPE_PETTOTEM,
    'SLAVECOLLAR': ITEM_TYPE_SLAVECOLLAR,
    'BLANKKEY': ITEM_TYPE_BLANKKEY,
    'WARRANT': ITEM_TYPE_WARRANT,
    'FURNITUREDEED': ITEM_TYPE_FURNITUREDEED,
    'TENT': ITEM_TYPE_TENT,
    'REAGENT': ITEM_TYPE_REAGENT,
    'DEVICE': ITEM_TYPE_DEVICE,
    'FORMULA': ITEM_TYPE_FORMULA,
    'BUCKET': ITEM_TYPE_BUCKET,
    'TREASURE': ITEM_TYPE_TREASURE,
    'RUNE': ITEM_TYPE_RUNE,
    'OFFERING': ITEM_TYPE_OFFERING,
    'RESOURCE': ITEM_TYPE_RESOURCE,
    'REALMCHARTER': ITEM_TYPE_REALMCHARTER,
}

ITEM_USE_FLAGS_NONE = 0
ITEM_USE_FLAGS_USE_SELF = 1 << 0
ITEM_USE_FLAGS_USE_TARGET = 1 << 1
ITEM_USE_FLAGS_EMPTY_DESTROY = 1 << 2
ITEM_USE_FLAGS_EMPTY_NEWITEM = 1 << 3
ITEM_USE_FLAGS_NUM = 4

ITEM_USE_FLAGS_TO_STRING = {
    ITEM_USE_FLAGS_NONE: 'NONE',
    ITEM_USE_FLAGS_USE_SELF: 'USE_SELF',
    ITEM_USE_FLAGS_USE_TARGET: 'USE_TARGET',
    ITEM_USE_FLAGS_EMPTY_DESTROY: 'EMPTY_DESTROY',
    ITEM_USE_FLAGS_EMPTY_NEWITEM: 'EMPTY_NEWITEM',
}

STRING_TO_ITEM_USE_FLAGS = {
    'NONE': ITEM_USE_FLAGS_NONE,
    'USE_SELF': ITEM_USE_FLAGS_USE_SELF,
    'USE_TARGET': ITEM_USE_FLAGS_USE_TARGET,
    'EMPTY_DESTROY': ITEM_USE_FLAGS_EMPTY_DESTROY,
    'EMPTY_NEWITEM': ITEM_USE_FLAGS_EMPTY_NEWITEM,
}

ITEM_SHEATHSLOT_UNKOWN = 0
ITEM_SHEATHSLOT_BACK = 1
ITEM_SHEATHSLOT_WAIST = 2
ITEM_SHEATHSLOT_NONE = 4

ITEM_SHEATHSLOT_TO_STRING = {
    ITEM_SHEATHSLOT_NONE: 'NONE',
    ITEM_SHEATHSLOT_UNKOWN: 'UNKOWN',
    ITEM_SHEATHSLOT_BACK: 'BACK',
    ITEM_SHEATHSLOT_WAIST: 'WAIST',
}

STRING_TO_ITEM_SHEATHSLOT = {
    'NONE': ITEM_SHEATHSLOT_NONE,
    'UNKOWN': ITEM_SHEATHSLOT_UNKOWN,
    'BACK': ITEM_SHEATHSLOT_BACK,
    'WAIST': ITEM_SHEATHSLOT_WAIST,
}

DAMAGE_UNKOWN = 0
DAMAGE_SLASHING = 1
DAMAGE_CRUSHING = 2
DAMAGE_PIERCING = 3
DAMAGE_POISON = 4
DAMAGE_LIGHTNING = 5
DAMAGE_MAGIC = 6
DAMAGE_FIRE = 7
DAMAGE_COLD = 8
DAMAGE_MENTAL = 9
DAMAGE_HOLY = 10
DAMAGE_SIEGE = 11
DAMAGE_HEALING = 12
DAMAGE_BLEEDING = 13
DAMAGE_UNHOLY = 14
DAMAGE_ANTISIEGE = 15

DAMAGE_TO_STRING = {
    DAMAGE_UNKOWN: 'UNKOWN',
    DAMAGE_SLASHING: 'SLASHING',
    DAMAGE_CRUSHING: 'CRUSHING',
    DAMAGE_PIERCING: 'PIERCING',
    DAMAGE_POISON: 'POISON',
    DAMAGE_LIGHTNING: 'LIGHTNING',
    DAMAGE_MAGIC: 'MAGIC',
    DAMAGE_FIRE: 'FIRE',
    DAMAGE_COLD: 'COLD',
    DAMAGE_MENTAL: 'MENTAL',
    DAMAGE_HOLY: 'HOLY',
    DAMAGE_SIEGE: 'SIEGE',
    DAMAGE_HEALING: 'HEALING',
    DAMAGE_BLEEDING: 'BLEEDING',
    DAMAGE_UNHOLY: 'UNHOLY',
    DAMAGE_ANTISIEGE: 'ANTISIEGE',
}

STRING_TO_DAMAGE = {
    'UNKOWN': DAMAGE_UNKOWN,
    'SLASHING': DAMAGE_SLASHING,
    'CRUSHING': DAMAGE_CRUSHING,
    'PIERCING': DAMAGE_PIERCING,
    'POISON': DAMAGE_POISON,
    'LIGHTNING': DAMAGE_LIGHTNING,
    'MAGIC': DAMAGE_MAGIC,
    'FIRE': DAMAGE_FIRE,
    'COLD': DAMAGE_COLD,
    'MENTAL': DAMAGE_MENTAL,
    'HOLY': DAMAGE_HOLY,
    'SIEGE': DAMAGE_SIEGE,
    'HEALING': DAMAGE_HEALING,
    'BLEEDING': DAMAGE_BLEEDING,
    'UNHOLY': DAMAGE_UNHOLY,
    'ANTISIEGE': DAMAGE_ANTISIEGE,
}

ITEM_SEX_REQ_NONE = 0
ITEM_SEX_REQ_MALE = 1
ITEM_SEX_REQ_FEMALE = 2

ITEM_SEX_REQ_TO_STRING = {
    ITEM_SEX_REQ_NONE: 'NONE',
    ITEM_SEX_REQ_MALE: 'MALE',
    ITEM_SEX_REQ_FEMALE: 'FEMALE',
}

STRING_TO_ITEM_SEX_REQ = {
    'NONE': ITEM_SEX_REQ_NONE,
    'MALE': ITEM_SEX_REQ_MALE,
    'FEMALE': ITEM_SEX_REQ_FEMALE,
}
