123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- # DungeonHunter_Inventory
- !! Format for variables is Variable[OwnerInv_ItemType]
- if $ARGS[0] = 'Init':
- $dhInv_ArmorSlots[0] = 'Head'
- $dhInv_ArmorSlots[1] = 'Suit'
- $dhInv_ArmorSlots[2] = 'Chest'
- $dhInv_ArmorSlots[3] = 'Legs'
- $dhInv_ArmorSlots[4] = 'Gloves'
- $dhInv_ArmorSlots[5] = 'Feet'
- $dhInv_ArmorSlots[6] = 'ShoulderL'
- $dhInv_ArmorSlots[7] = 'ShoulderR'
- $dhInv_ArmorSlots[8] = 'Cloak'
- $dhInv_ArmorSlots[9] = 'Wings'
- $dhInv_ArmorSlots[9] = 'Shield'
-
- $dhInv_WeaponSlots[0] = 'MainHand'
- $dhInv_WeaponSlots[1] = 'Offhand'
-
- $dhInv_Inventories[0] = 'Shop'
- $dhInv_Inventories[1] = 'Player'
- exit
- if $ARGS[0] = 'NewInventory':
- $.owner = $ARGS[1]
-
- !! If the inventory already exists, just reset it
- if ARRPOS($dh_Inventories, $.owner) = -1:
- gs 'DungeonHunter_Inventory', 'Unequip', $ARGS[1], 'All'
- gs 'DungeonHunter_Inventory', 'Remove', $ARGS[1], 'All'
- end
-
- gs 'KILLVARS', '.owner' &!AUTO-GENERATED KILLVARS
- exit
- if $ARGS[0] = 'DeleteInventory' and ARRPOS($dh_Inventories, $ARGS[1]) != -1:
- !! KILLVAR everything
- $.owner = $ARGS[1]
-
- KILLVAR 'dhInv_Armor', ARRPOS($dhInv_Armor, $.owner + 'Inv_Head')
-
- _count = 0
- :loop
- KILLVAR 'dhInv_Armor', ARRPOS($dhInv_Armor, $.owner + 'Inv_' + dhInv_ArmorSlots[_count])
- if count < ARRSIZE('$dhInv_ArmorSlots')
- count += 1
- jump loop
- end
-
- gs 'KILLVARS', '_count' &!AUTO-GENERATED KILLVARS
- gs 'KILLVARS', '.owner' &!AUTO-GENERATED KILLVARS
- exit
- if $ARGS[0] = 'Equip' and ARRPOS($dh_Inventories, $ARGS[1]) != -1:
- $.owner = $ARGS[1]
- $.slot = $ARGS[2]
- $.name = $ARGS[3]
-
- if $.slot = 'Head' :
- gs 'DungeonHunter_Inventory', 'Unequip', 'Head'
- gs 'DungeonHunter_Armor_' + $.slot, $.owner + 'Inv_' + $.slot, $.name
-
- elseif $.slot = 'Suit' :
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Chest'
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Legs'
- gs 'DungeonHunter_Armor_' + $.slot, $.owner + 'Inv_' + $.slot, $.name
-
- elseif $.slot = 'Chest' :
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Suit'
- gs 'DungeonHunter_Armor_' + $.slot, $.owner + 'Inv_' + $.slot, $.name
-
- elseif $.slot = 'Legs' :
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Suit'
- gs 'DungeonHunter_Armor_' + $.slot, $.owner + 'Inv_' + $.slot, $.name
-
- elseif $.slot = 'Gloves' :
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Gloves'
- gs 'DungeonHunter_Armor_' + $.slot, $.owner + 'Inv_' + $.slot, $.name
-
- elseif $.slot = 'Feet' :
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Feet'
- gs 'DungeonHunter_Armor_' + $.slot, $.owner + 'Inv_' + $.slot, $.name
-
- elseif $.slot = 'ShoulderL' :
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'ShoulderL'
- gs 'DungeonHunter_Armor_' + $.slot, $.owner + 'Inv_' + $.slot, $.name
-
- elseif $.slot = 'ShoulderR' :
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'ShoulderR'
- gs 'DungeonHunter_Armor_' + $.slot, $.owner + 'Inv_' + $.slot, $.name
-
- elseif $.slot = 'Cloak' :
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Cloak'
- gs 'DungeonHunter_Armor_' + $.slot, $.owner + 'Inv_' + $.slot, $.name
-
- elseif $.slot = 'Wings' :
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Wings'
- gs 'DungeonHunter_Armor_' + $.slot, $.owner + 'Inv_' + $.slot, $.name
-
- elseif $.slot = 'Shield' :
- !! If the current main weapon is 2 handed, unequip it first
- if $dh_WeaponHand[$.owner + 'Inv_MainHand'] = 2:
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'MainHand'
- end
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Shield'
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Offhand'
- gs 'DungeonHunter_Armor_' + $.slot, $.owner + 'Inv_' + $.slot, $.name
- elseif $.slot = 'MainHand' :
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'MainHand'
- gs 'DungeonHunter_Weapons', $.owner + 'Inv_' + $.slot, $.name
-
- !! Check if new main weapon is 2 handed, if so then unequip offhand
- if $dh_WeaponHand[$.owner + 'Inv_MainHand'] = 2:
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Offhand'
- end
-
- elseif $.slot = 'Offhand' :
- !! If the current main weapon is 2 handed, unequip it first
- if $dh_WeaponHand[$.owner + 'Inv_MainHand'] = 2:
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'MainHand'
- end
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Shield'
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Offhand'
- gs 'DungeonHunter_Weapons', $.owner + 'Inv_' + $.slot, $.name
- end
-
- gs 'KILLVARS', '.owner', '.slot', '.name' &!AUTO-GENERATED KILLVARS
- exit
- if $ARGS[0] = 'Unequip' and ARRPOS($dh_Inventories, $ARGS[1]) != -1:
- $.owner = $ARGS[1]
- $.slot = $ARGS[2]
-
- if $.slot = 'All':
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Armor'
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Weapons'
-
- elseif $.slot = 'Armor':
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Head'
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Torso'
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Legs'
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Gloves'
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Feet'
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'ShoulderL'
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'ShoulderR'
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Cloak'
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Wings'
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Shield'
-
- elseif $.slot = 'Weapons':
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'MainHand'
- gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Offhand'
-
- elseif ARRPOS($dh_ArmorSlots, $.slot) != -1
- AND $dhInv_Armor[$.owner + 'Inv_' + $.slot] != 'Empty':
- !! If the armor slot is already empty, don't bother re-emptying it
- !! TODO: Take stats away from player stats e.g. resistances
- !! TODO: Make player stats
-
- $dhInv_Armor[$.owner + 'Inv_' + $.slot] = 'Empty'
- dhInv_ArmorGrade[$.owner+ 'Inv_' + $.slot] = 0
- dhInv_ArmorValue[$.owner + 'Inv_' + $.slot] = 0
- dhInv_ArmorDurability[$.owner + 'Inv_' + $.slot] = 0
- dhInv_ArmorDurabilityMax[$.owner + 'Inv_' + $.slot] = 0
- dhInv_ArmorResistFire[$.owner + 'Inv_' + $.slot] = 0
- dhInv_ArmorResistEarth[$.owner + 'Inv_' + $.slot] = 0
- dhInv_ArmorResistMetal[$.owner + 'Inv_' + $.slot] = 0
- dhInv_ArmorResistWater[$.owner + 'Inv_' + $.slot] = 0
- dhInv_ArmorResistWood[$.owner + 'Inv_' + $.slot] = 0
- dhInv_ArmorEnchantExp[$.owner + 'Inv_' + $.slot] = 0
-
- elseif ARRPOS($dh_WeaponSlots, $.owner) != -1
- AND $dh_P_Weapon[$.owner + 'Inv_' + $.slot] != 'Empty'
- !! If the weapon slot is already empty, don't bother re-emptying it
-
- $dhInv_Weapon[$.owner+ 'Inv_' + $.slot] = 'Empty'
- $dhInv_WeaponType[$.owner + 'Inv_' + $.slot] = ''
- dhInv_WeaponHand[$.owner + 'Inv_' + $.slot] = 0
- dhInv_WeaponDurability[$.owner + 'Inv_' + $.slot] = 0
- dhInv_WeaponDurabilityMax[$.owner + 'Inv_' + $.slot] = 0
- dhInv_WeaponDmgMin[$.owner + 'Inv_' + $.slot] = 0
- dhInv_WeaponDmgMax[$.owner + 'Inv_' + $.slot] = 0
- dhInv_WeaponDmgFire[$.owner + 'Inv_' + $.slot] = 0
- dhInv_WeaponDmgEarth[$.owner + 'Inv_' + $.slot] = 0
- dhInv_WeaponDmgMetal[$.owner + 'Inv_' + $.slot] = 0
- dhInv_WeaponDmgWater[$.owner+ 'Inv_' + $.slot] = 0
- dhInv_WeaponDmgWood[$.owner + 'Inv_' + $.slot] = 0
- end
-
- gs 'KILLVARS', '.owner', '.slot' &!AUTO-GENERATED KILLVARS
- exit
- if $ARGS[0] = 'AddItem' and ARRPOS($dh_Inventories, $ARGS[1]) != -1:
- $.owner = $ARGS[1]
- $.itemType = $ARGS[2]
- $.itemName = $ARGS[3]
- $.slotNo = $ARGS[4]
-
- gs 'KILLVARS', '.owner', '.itemType', '.itemName', '.slotNo' &!AUTO-GENERATED KILLVARS
- exit
- if $ARGS[0] = 'RemoveItem' and ARRPOS($dh_Inventories, $ARGS[1]) != -1:
- $.owner = $ARGS[1]
- $.itemType = $ARGS[2]
- $.itemName = $ARGS[3]
- $.slotNo = $ARGS[4]
-
- gs 'KILLVARS', '.owner', '.itemType', '.itemName', '.slotNo' &!AUTO-GENERATED KILLVARS
- exit
-
- if $ARGS[0] = 'AddMoney' and ARRPOS($dh_Inventories, $ARGS[1]) != -1:
- exit
- if $ARGS[0] = 'RemoveMoney' and ARRPOS($dh_Inventories, $ARGS[1]) != -1:
- exit
- !! TODO: Delete an inventory
- !! TODO: An actual inventory for unequipped armor, weapons, and items
- !! TODO: Each inventory should have a currency associated with it
- !! Perhaps a special currency as well
- --- DungeonHunter_Inventory ---------------------------------
|