// Constants usable in scripts

// This constant is used to define whether unreleased items are equippable. This defaults to on, but should be disabled on the official server.
debug		1

mf_nomemo	0
mf_noteleport	1
mf_nosave	2
mf_nobranch	3
mf_nopenalty	4
mf_pvp		5
mf_pvp_noparty	6
mf_pvp_noguild	7
mf_gvg		8
mf_gvg_noparty	9
mf_nozenypenalty	10

StatusPoint	9	1
BaseLevel	11	1
SkillPoint	12	1
Class		19	1
Upper		56	1
Zeny		20	1
Sex		21	1
Weight		24	1
MaxWeight	25	1
JobLevel	55	1
BaseExp		1	1
JobExp		2	1
NextBaseExp	22	1
NextJobExp	23	1
Hp		5	1
MaxHp		6	1
Sp		7	1
MaxSp		8	1

bMaxHP		6
bMaxSP		8
bStr		13
bAgi		14
bVit		15
bInt		16
bDex		17
bLuk		18
bAtk		41
bAtk2		42
bMatk1		43
bMatk2		44
bDef		45
bMdef		47
bMdef2		48
bHit		49
bFlee		50
bFlee2		51
bCritical	52
bAspd		53
bDeaf		70

bAtkRange	1000
bAtkEle		1001
bDefEle		1002
bCastrate	1003
bMaxHPrate	1004
bMaxSPrate	1005
bUseSPrate	1006
bAddEle		1007
bAddRace	1008
bAddSize	1009
bSubEle		1010
bSubRace	1011
bAddEff		1012
bResEff		1013
bBaseAtk	1014
bAspdRate	1015
bHPrecovRate	1016
bSPrecovRate	1017
bSpeedRate	1018
bCriticalDef	1019
bNearAtkDef	1020
bLongAtkDef	1021
bDoubleRate	1022
bDoubleAddRate	1023
bMatk		1024
bMatkRate	1025
bIgnoreDefEle	1026
bIgnoreDefRace	1027
bAtkRate	1028
bSpeedAddRate	1029
bAspdAddRate	1030
bMagicAtkDef	1031
bMiscAtkDef	1032
bIgnoreMdefEle	1033
bIgnoreMdefRace	1034
bMagicAddEle	1035
bMagicAddRace	1036
bMagicSubRace	1037
bPerfectHitRate	1038
bPerfectHitAddRate	1039
bCriticalRate	1040
bGetZenyNum	1041
bAddGetZenyNum	1042
bAddDamageClass	1043
bAddMagicDamageClass	1044
bAddDefClass	1045
bAddMdefClass	1046
bAddMonsterDropItem	1047
bDefRatioAtkEle	1048
bDefRatioAtkRace	1049
bAddSpeed	1050
bHitRate	1051
bFleeRate	1052
bFlee2Rate	1053
bDefRate	1054
bDef2Rate	1055
bMdefRate	1056
bMdef2Rate	1057
bSplashRange	1058
bSplashAddRange	1059
bAutoSpell	1060
bHPDrainRate	1061
bSPDrainRate	1062
bShortWeaponDamageReturn	1063
bLongWeaponDamageReturn	1064
bWeaponComaEle	1065
bWeaponComaRace	1066
bAddEff2	1067
bMagicDamageReturn	1068
bRandomAttackIncrease	1069
bAllStats		1070
bAgiVit			1071
bAgiDexStr		1072
bPerfectHide		1073

equip_head 1
equip_shield 2
equip_hand2 3
equip_hand1 4
equip_gloves 5
equip_shoes 6
equip_misc1 7
equip_misc2 8
equip_torso 9
equip_legs 10

// Appearance slots
// Using this for anything but hair is probably a mistake
LOOK_BASE       0
LOOK_HAIR_STYLE 1
LOOK_WEAPON     2
LOOK_LEGS       3
LOOK_HELMET     4
LOOK_CHEST      5
LOOK_HAIR_COLOR 6
LOOK_SHIELD     8
LOOK_SHOES      9
LOOK_GLOVES     10
LOOK_CAPE       11
LOOK_MISC1      12
LOOK_MISC2      13

// Hair styles
HS_Bald                 0
HS_FlatPonytail         1
HS_BowlCut              2
HS_CombedBack           3
HS_Emo                  4
HS_Mohawk               5
HS_Pompadour            6
HS_CenterParting        7
HS_LongAndSlick         8
HS_ShortAndCurly        9
HS_Pigtails             10
HS_LongAndCurly         11
HS_Parted               12
HS_PerkyPonytail        13
HS_Wave                 14
HS_Mane                 15
HS_Bun                  16
HS_ShoulderLengthFlick  17
HS_Fizzy                18
HS_LongAndClipped       19

// Hair colors
HC_LIGHT_BROWN  0
HC_GREEN        1
HC_RED          2
HC_PURPLE       3
HC_GRAY         4
HC_YELLOW       5
HC_BLUE         6
HC_BROWN        7
HC_LIGHT_BLUE   8
HC_DARK_PURPLE  9
HC_BLACK        10
HC_PINK         11
HC_BROWN        12
HC_WHITE        127

// Colors for dyed items
// see npc/functions/process_equip.txt
cNone  11
cWhite 10
cRed    0
cGreen  1
cDarkBlue  2
cYellow 3
cLightBlue  4
cPink   5
cBlack  6
cOrange 7
cPurple 8
cDarkGreen 9

sc_poison		132
sc_slowpoison		14
sc_raiseattackspeed0	37
sc_raiseattackstrength	185

// emotions
// note, client-data/emote.xml uses the wrong numbers
EMOTE_DISGUST   1
EMOTE_SURPRISE  2
EMOTE_HAPPY     3
EMOTE_SAD       4
EMOTE_EVIL      5
EMOTE_WINK      6
EMOTE_ANGEL     7
EMOTE_BLUSH     8
EMOTE_TONGUE    9
EMOTE_GRIN      10
EMOTE_UPSET     11
EMOTE_PERTURBED 12
EMOTE_SPEECH    13
EMOTE_BLAH      14

// Marriage-related
WEDDING_FEE		100
DIVORCE_FEE_PER_LEVEL	500
WEDDING_MIN_LEVEL	32

sfx_skillup			1
sfx_magic_generic		2
sfx_magic_life			3
sfx_magic_war			4
sfx_magic_transmute		5
sfx_magic_nature		6
sfx_magic_astral		7

// Special Effects, interactive objects and emotion effects from client-data/effects.xml
FX_LEVELUP           0
FX_SKILLUP           1
FX_MAGIC_GENERIC     2
FX_MAGIC_WHITE       3
FX_MAGIC_BLACK       4
FX_MAGIC_RED         5
FX_MAGIC_GREEN       6
FX_MAGIC_BLUE        7
FX_MAGIC_DEFAULT     10
FX_MAGIC_SHIELD      11
FX_MAGIC_HIT         13
FX_MAGIC_HIT_EVIL    14
FX_FIRE_BURST        15
FX_FIRE_EXPLOSION    16
FX_LIGHTNING1        17
FX_LIGHTNING2        18
FX_LIGHTNING3        19
FX_MAGIC_TELEPORT    20
FX_PENTAGRAM_BUILDUP 21
FX_PENTAGRAM_BURST   22
FX_MAGIC_TELEPORT2   24
FX_RAIN              25
FX_HIT               26
FX_ARROW_HAIL        27
FX_CRITICAL          28
FX_LARGE_EXPLOSION   30
FX_MEDIUM_EXPLOSION  31
FX_MEDIUM_SMOKE      32
FX_MAGIC_SHIELD_ENDS 111
FX_ELECTRICITY_RED   114
FX_ELECTRICITY_BLUE  115
FX_GATE_OPENING      300
FX_CASKET_LID        301
FX_CASKET_MONSTER    302
FX_EMOTE_DISGUST     10000
FX_EMOTE_SURPRISE    10001
FX_EMOTE_HAPPY       10002
FX_EMOTE_SAD         10003
FX_EMOTE_EVIL        10004
FX_EMOTE_WINK        10005
FX_EMOTE_ANGEL       10006
FX_EMOTE_BLUSH       10007
FX_EMOTE_TONGUE      10008
FX_EMOTE_GRIN        10009
FX_EMOTE_UPSET       10010
FX_EMOTE_PERTURBED   10011
FX_EMOTE_SPEECH      10012
FX_EMOTE_BLAH        10013

NIBBLE_0_SHIFT 0
NIBBLE_0_MASK 15

NIBBLE_1_SHIFT 4
NIBBLE_1_MASK 240

NIBBLE_2_SHIFT 8
NIBBLE_2_MASK 3840

NIBBLE_3_SHIFT 12
NIBBLE_3_MASK 61440

NIBBLE_4_SHIFT 16
NIBBLE_4_MASK 983040

NIBBLE_5_SHIFT 20
NIBBLE_5_MASK 15728640

NIBBLE_6_SHIFT 24
NIBBLE_6_MASK 251658240

NIBBLE_7_SHIFT 28        // Only three bits available in this one
NIBBLE_7_MASK 1879048192 // should be 4026531840

BYTE_0_MASK		255
BYTE_0_SHIFT		0

BYTE_1_MASK		65280
BYTE_1_SHIFT		8

BYTE_2_MASK		16711680
BYTE_2_SHIFT		16

BYTE_3_MASK		4278190080
BYTE_3_SHIFT		24

// Skill pools
SKILL_POOL		339
SKILL_MALLARDS_EYE	45
SKILL_BRAWLING		350
SKILL_LUCKY_COUNTER	351
SKILL_SPEED		352
SKILL_RESIST_POISON	353
SKILL_ASTRAL_SOUL	354
SKILL_WARRIOR_RAGING	355

// Magic skills
SKILL_MAGIC		340
SKILL_MAGIC_LIFE	341
SKILL_MAGIC_WAR		342
SKILL_MAGIC_TRANSMUTE	343
SKILL_MAGIC_NATURE	344
SKILL_MAGIC_ASTRAL	345

// Flags for the magic quests
MFLAG_DRANK_POTION	1	// Character drank at least one magic potion as prerequisite for the mana seed quest
MFLAG_KNOWS_MANASEED	2	// Character has found the Mana Seed
MFLAG_TOUCHED_MANASEED	4	// Character has touched the Mana Seed
MFLAG_MANASEED_MAXEDOUT	8	// Character has touched the Mana Seed while maxed out on magic

MFLAG_KNOWS_AULDSBEL	16	// Character has met Auldsbel
MFLAG_KNOWS_WYARA	32	// Character has met Wyara
MFLAG_KNOWS_SAGATHA	64	// Character has met Sagatha
MFLAG_KNOWS_MANAPOTION	128	// Has heard about the mana potion

MFLAG_MANASEED_RUMOUR	256	// Has heard rumour about mana seed
MFLAG_KNOWS_CUTTREE	512	// Knows about the `cut the tree' quest
MFLAG_DID_CUTTREE	1024	// Did cut off a branch from the druid tree
MFLAG_KNOWS_DRUIDTREE	2048	// Knows about the druid tree quest

MFLAG_KNOWS_IMP		4096	// Knows about the imprisoned forest spirit
MFLAG_KNOWS_OLD_WIZARD	8192	// Knows Bjorn's old wizard
MFLAG_MADE_CONC_POTION	16384	// Made a concentration potion with T15 and/or T16
MFLAG_ELANORE_OMAR	32768	// Told Omar about Elanore's involvement

MFLAG_KNOWS_UNFOCUS_RECIPE	65536 // Luca told me about how to unfocus

// Flags set in the FLAGS variable:
FLAG_HAS_BOWLER_BURNSDAY	1	// every year's poem at burns day, shannon gives you a bowler hat
FLAG_OPENED_UNDERGROUND	2	// this flag is a replacement for variable Open_Underground_Palace_Barrier, which was used only as bool
FLAG_GOT_NAEM_GLOVES	4	// this replaces Naem_Quest_Done, which was used as a bool variable
FLAG_GOT_GRADUATIONCAP	8	// this is a bit which was to be found in Tut_var second bit
FLAG_TOWEL_HELPED	16	// gave the towel npc the stuff he wants
FLAG_TOWEL_COMPLETED	32	// got the towel from the towel npc
FLAG_ANDRA_HELPED	64	// Knows Andra and agreed to help her
FLAG_ROSSI_COMPLETED	128	// Completed the Rossi Quest
FLAG_TUTORIAL_DONE	256	// player completed tutorial (or entered the tutorial area from outside after it was added)
FLAG_SNOWMAN	512	// player gave candy to the snowman
FLAG_SANTAS_HELPER	1024	// player gave presents to Santa's helper

DOCK_tulimshar	1
DOCK_hurnscald	2
DOCK_candor	3

// -----------------
// -- Easter 2010 --
// -----------------

// Dealing with the Old Woman's token quest
E10_STATE_EGG_MASK 3
E10_STATE_EGGS_COLLECTED_MASK 31
E10_STATE_EGGS_COLLECTED_SHIFT 2
E10_STATE_EGG_COLLECTING 1
E10_STATE_EGG_COLLECTED 2
E10_STATE_EGG_REWARDED 3
E10_STATE_ROSE_MASK 3
E10_STATE_ROSE_SHIFT 7
E10_STATE_ROSE_ROSE_USED 1
E10_STATE_ROSE_ROSE_COMPLETE 2
E10_STATE_ROSE_RETURNED 3


// Dealing with $Easter_2010_Npc_State1
E10_TIMER_STATE_EGGS_MASK 31
E10_TIMER_STATE_TREES_MASK 31
E10_TIMER_STATE_TREES_SHIFT 5
E10_TIMER_STATE_DOCTOR_MASK 31
E10_TIMER_STATE_DOCTOR_SHIFT 10
E10_EGGS_TIMER_OVERTICK_MASK 31
E10_EGGS_TIMER_OVERTICK_SHIFT 15
E10_TREES_OVERTICK_MASK 31
E10_TREES_OVERTICK_SHIFT 20
E10_DOCTOR_TIMER_OVERTICK_MASK 31
E10_DOCTOR_TIMER_OVERTICK_SHIFT 25


// Dealing with $Easter_2010_Npc_State2
E10_DOCTOR_POSITION_MASK 7
E10_DOCTOR_POSITION_SHIFT 0
E10_DOCTOR_POSITION_NULL 0
E10_DOCTOR_POSITION_BIGTREE 1
E10_DOCTOR_POSITION_ISLAND 2
E10_DOCTOR_POSITION_STONES 3
E10_DOCTOR_POSITION_FRUIT 4
E10_DOCTOR_POSITION_CAVE 5
E10_BARRIER_MASK 1
E10_BARRIER_SHIFT 4
E10_BARRIER_OPEN 0
E10_BARRIER_ACTIVE 1
E10_PRE_WARP_SHIFT 5
E10_NEEDLE_SHIFT 6
E10_NEEDLE_MASK 31

// Dealing with the doctor
E10_DOCTOR_HELP_STATES_MASK 15
E10_DOCTOR_HELP_STATES_SHIFT 11
E10_FLAG_KNOWS_DOCTOR_MASK 1
E10_FLAG_KNOWS_DOCTOR_SHIFT 10
E10_FLAG_KNOWS_DOCTOR 1
E10_FLAG_HELPED_DOCTOR_TREE_MASK 1
E10_FLAG_HELPED_DOCTOR_TREE_SHIFT 11
E10_FLAG_HELPED_DOCTOR_TREE 1
E10_FLAG_HELPED_DOCTOR_ISLAND_MASK 1
E10_FLAG_HELPED_DOCTOR_ISLAND_SHIFT 12
E10_FLAG_HELPED_DOCTOR_ISLAND 1
E10_FLAG_HELPED_DOCTOR_STONES_MASK 1
E10_FLAG_HELPED_DOCTOR_STONES_SHIFT 13
E10_FLAG_HELPED_DOCTOR_STONES 1
E10_FLAG_HELPED_DOCTOR_FRUIT_MASK 1
E10_FLAG_HELPED_DOCTOR_FRUIT_SHIFT 14
E10_FLAG_HELPED_DOCTOR_FRUIT 1
E10_HELPED_DOCTOR_SHIFT 11
E10_HELPED_DOCTOR_MASK 15
E10_FLAG_MID_REWARD 1
E10_FLAG_MID_REWARD_SHIFT 15
E10_FLAG_MID_REWARD_MASK 1
E10_FLAG_RETURN_READY 1
E10_FLAG_RETURN_READY_SHIFT 16
E10_FLAG_RETURN_READY_MASK 1
E10_FLAG_USED_FREE_WARP_SHIFT 17
E10_STATE_REWARDS_SHIFT 18
E10_STATE_REWARDS_MASK 3
E10_STATE_REWARD_RABBIT_EARS 1
E10_STATE_REWARD_EGGSHELL 2
E10_LOC_NEEDLE_SHIFT 20
E10_LOC_NEEDLE_MASK 31

// Menus
E10_STONES_WISP 0
E10_STONES_SPECTRE 1
E10_STONES_POLTERGEIST 2
E10_STONES_SOUL 3
E10_STONES_HEART 4
E10_STONES_EAR 5
E10_STONES_EYE 6
E10_STONES_BONE 7
E10_STONES_SKULL 8
E10_STONES_CRYSTAL 9
E10_STONES_RAGS 10
E10_STONES_PETAL 11
E10_STONES_NEVERMIND 12
E10_ISLAND_MENU_DEATH_AWE 12
E10_ISLAND_MENU_SCARED 13
E10_ISLAND_MENU_WISPS 14
E10_ISLAND_MENU_OFFER_LIFESTONE 15

// Flags for Battle Caves
BATTLE_CAVE1, 1
BATTLE_CAVE2, 2
BATTLE_CAVE3, 4
BATTLE_CAVE4, 8
BATTLE_CAVE5, 16
BATTLE_CAVE6, 32
BATTLE_CAVE7, 64
BATTLE_CAVE8, 128
BATTLE_CAVE9, 256


// Miscellaneous
E10_COLLECT_EGGS_ID 1246
E10_TOKEN_ID 666
E10_MIDREWARD_ID 1247 // Valentine's Glasses (as described)

// Storage Options
OPT_STORAGE_CLOSE 1
OPT_BANK_CLOSE 2

// currently used by the fluffy hunt (033-1)
MAX_HIGH_SCORES 10