DungeonHunter_test.qsrc 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. # DungeonHunter_Inventory
  2. !! Format for variables is Variable[OwnerInv_ItemType]
  3. if $ARGS[0] = 'Init':
  4. $dhInv_ArmorSlots[0] = 'Head'
  5. $dhInv_ArmorSlots[1] = 'Suit'
  6. $dhInv_ArmorSlots[2] = 'Chest'
  7. $dhInv_ArmorSlots[3] = 'Legs'
  8. $dhInv_ArmorSlots[4] = 'Gloves'
  9. $dhInv_ArmorSlots[5] = 'Feet'
  10. $dhInv_ArmorSlots[6] = 'ShoulderL'
  11. $dhInv_ArmorSlots[7] = 'ShoulderR'
  12. $dhInv_ArmorSlots[8] = 'Cloak'
  13. $dhInv_ArmorSlots[9] = 'Wings'
  14. $dhInv_ArmorSlots[9] = 'Shield'
  15. $dhInv_WeaponSlots[0] = 'MainHand'
  16. $dhInv_WeaponSlots[1] = 'Offhand'
  17. $dhInv_Inventories[0] = 'Shop'
  18. $dhInv_Inventories[1] = 'Player'
  19. exit
  20. if $ARGS[0] = 'NewInventory':
  21. $.owner = $ARGS[1]
  22. !! If the inventory already exists, just reset it
  23. if ARRPOS($dh_Inventories, $.owner) = -1:
  24. gs 'DungeonHunter_Inventory', 'Unequip', $ARGS[1], 'All'
  25. gs 'DungeonHunter_Inventory', 'Remove', $ARGS[1], 'All'
  26. end
  27. gs 'KILLVARS', '.owner' &!AUTO-GENERATED KILLVARS
  28. exit
  29. if $ARGS[0] = 'DeleteInventory' and ARRPOS($dh_Inventories, $ARGS[1]) != -1:
  30. !! KILLVAR everything
  31. $.owner = $ARGS[1]
  32. KILLVAR 'dhInv_Armor', ARRPOS($dhInv_Armor, $.owner + 'Inv_Head')
  33. _count = 0
  34. :loop
  35. KILLVAR 'dhInv_Armor', ARRPOS($dhInv_Armor, $.owner + 'Inv_' + dhInv_ArmorSlots[_count])
  36. if count < ARRSIZE('$dhInv_ArmorSlots')
  37. count += 1
  38. jump loop
  39. end
  40. gs 'KILLVARS', '_count' &!AUTO-GENERATED KILLVARS
  41. gs 'KILLVARS', '.owner' &!AUTO-GENERATED KILLVARS
  42. exit
  43. if $ARGS[0] = 'Equip' and ARRPOS($dh_Inventories, $ARGS[1]) != -1:
  44. $.owner = $ARGS[1]
  45. $.slot = $ARGS[2]
  46. $.name = $ARGS[3]
  47. if $.slot = 'Head' :
  48. gs 'DungeonHunter_Inventory', 'Unequip', 'Head'
  49. gs 'DungeonHunter_Armor_' + $.slot, $.owner + 'Inv_' + $.slot, $.name
  50. elseif $.slot = 'Suit' :
  51. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Chest'
  52. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Legs'
  53. gs 'DungeonHunter_Armor_' + $.slot, $.owner + 'Inv_' + $.slot, $.name
  54. elseif $.slot = 'Chest' :
  55. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Suit'
  56. gs 'DungeonHunter_Armor_' + $.slot, $.owner + 'Inv_' + $.slot, $.name
  57. elseif $.slot = 'Legs' :
  58. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Suit'
  59. gs 'DungeonHunter_Armor_' + $.slot, $.owner + 'Inv_' + $.slot, $.name
  60. elseif $.slot = 'Gloves' :
  61. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Gloves'
  62. gs 'DungeonHunter_Armor_' + $.slot, $.owner + 'Inv_' + $.slot, $.name
  63. elseif $.slot = 'Feet' :
  64. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Feet'
  65. gs 'DungeonHunter_Armor_' + $.slot, $.owner + 'Inv_' + $.slot, $.name
  66. elseif $.slot = 'ShoulderL' :
  67. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'ShoulderL'
  68. gs 'DungeonHunter_Armor_' + $.slot, $.owner + 'Inv_' + $.slot, $.name
  69. elseif $.slot = 'ShoulderR' :
  70. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'ShoulderR'
  71. gs 'DungeonHunter_Armor_' + $.slot, $.owner + 'Inv_' + $.slot, $.name
  72. elseif $.slot = 'Cloak' :
  73. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Cloak'
  74. gs 'DungeonHunter_Armor_' + $.slot, $.owner + 'Inv_' + $.slot, $.name
  75. elseif $.slot = 'Wings' :
  76. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Wings'
  77. gs 'DungeonHunter_Armor_' + $.slot, $.owner + 'Inv_' + $.slot, $.name
  78. elseif $.slot = 'Shield' :
  79. !! If the current main weapon is 2 handed, unequip it first
  80. if $dh_WeaponHand[$.owner + 'Inv_MainHand'] = 2:
  81. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'MainHand'
  82. end
  83. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Shield'
  84. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Offhand'
  85. gs 'DungeonHunter_Armor_' + $.slot, $.owner + 'Inv_' + $.slot, $.name
  86. elseif $.slot = 'MainHand' :
  87. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'MainHand'
  88. gs 'DungeonHunter_Weapons', $.owner + 'Inv_' + $.slot, $.name
  89. !! Check if new main weapon is 2 handed, if so then unequip offhand
  90. if $dh_WeaponHand[$.owner + 'Inv_MainHand'] = 2:
  91. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Offhand'
  92. end
  93. elseif $.slot = 'Offhand' :
  94. !! If the current main weapon is 2 handed, unequip it first
  95. if $dh_WeaponHand[$.owner + 'Inv_MainHand'] = 2:
  96. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'MainHand'
  97. end
  98. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Shield'
  99. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Offhand'
  100. gs 'DungeonHunter_Weapons', $.owner + 'Inv_' + $.slot, $.name
  101. end
  102. gs 'KILLVARS', '.owner', '.slot', '.name' &!AUTO-GENERATED KILLVARS
  103. exit
  104. if $ARGS[0] = 'Unequip' and ARRPOS($dh_Inventories, $ARGS[1]) != -1:
  105. $.owner = $ARGS[1]
  106. $.slot = $ARGS[2]
  107. if $.slot = 'All':
  108. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Armor'
  109. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Weapons'
  110. elseif $.slot = 'Armor':
  111. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Head'
  112. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Torso'
  113. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Legs'
  114. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Gloves'
  115. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Feet'
  116. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'ShoulderL'
  117. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'ShoulderR'
  118. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Cloak'
  119. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Wings'
  120. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Shield'
  121. elseif $.slot = 'Weapons':
  122. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'MainHand'
  123. gs 'DungeonHunter_Inventory', 'Unequip', $.owner, 'Offhand'
  124. elseif ARRPOS($dh_ArmorSlots, $.slot) != -1
  125. AND $dhInv_Armor[$.owner + 'Inv_' + $.slot] != 'Empty':
  126. !! If the armor slot is already empty, don't bother re-emptying it
  127. !! TODO: Take stats away from player stats e.g. resistances
  128. !! TODO: Make player stats
  129. $dhInv_Armor[$.owner + 'Inv_' + $.slot] = 'Empty'
  130. dhInv_ArmorGrade[$.owner+ 'Inv_' + $.slot] = 0
  131. dhInv_ArmorValue[$.owner + 'Inv_' + $.slot] = 0
  132. dhInv_ArmorDurability[$.owner + 'Inv_' + $.slot] = 0
  133. dhInv_ArmorDurabilityMax[$.owner + 'Inv_' + $.slot] = 0
  134. dhInv_ArmorResistFire[$.owner + 'Inv_' + $.slot] = 0
  135. dhInv_ArmorResistEarth[$.owner + 'Inv_' + $.slot] = 0
  136. dhInv_ArmorResistMetal[$.owner + 'Inv_' + $.slot] = 0
  137. dhInv_ArmorResistWater[$.owner + 'Inv_' + $.slot] = 0
  138. dhInv_ArmorResistWood[$.owner + 'Inv_' + $.slot] = 0
  139. dhInv_ArmorEnchantExp[$.owner + 'Inv_' + $.slot] = 0
  140. elseif ARRPOS($dh_WeaponSlots, $.owner) != -1
  141. AND $dh_P_Weapon[$.owner + 'Inv_' + $.slot] != 'Empty'
  142. !! If the weapon slot is already empty, don't bother re-emptying it
  143. $dhInv_Weapon[$.owner+ 'Inv_' + $.slot] = 'Empty'
  144. $dhInv_WeaponType[$.owner + 'Inv_' + $.slot] = ''
  145. dhInv_WeaponHand[$.owner + 'Inv_' + $.slot] = 0
  146. dhInv_WeaponDurability[$.owner + 'Inv_' + $.slot] = 0
  147. dhInv_WeaponDurabilityMax[$.owner + 'Inv_' + $.slot] = 0
  148. dhInv_WeaponDmgMin[$.owner + 'Inv_' + $.slot] = 0
  149. dhInv_WeaponDmgMax[$.owner + 'Inv_' + $.slot] = 0
  150. dhInv_WeaponDmgFire[$.owner + 'Inv_' + $.slot] = 0
  151. dhInv_WeaponDmgEarth[$.owner + 'Inv_' + $.slot] = 0
  152. dhInv_WeaponDmgMetal[$.owner + 'Inv_' + $.slot] = 0
  153. dhInv_WeaponDmgWater[$.owner+ 'Inv_' + $.slot] = 0
  154. dhInv_WeaponDmgWood[$.owner + 'Inv_' + $.slot] = 0
  155. end
  156. gs 'KILLVARS', '.owner', '.slot' &!AUTO-GENERATED KILLVARS
  157. exit
  158. if $ARGS[0] = 'AddItem' and ARRPOS($dh_Inventories, $ARGS[1]) != -1:
  159. $.owner = $ARGS[1]
  160. $.itemType = $ARGS[2]
  161. $.itemName = $ARGS[3]
  162. $.slotNo = $ARGS[4]
  163. gs 'KILLVARS', '.owner', '.itemType', '.itemName', '.slotNo' &!AUTO-GENERATED KILLVARS
  164. exit
  165. if $ARGS[0] = 'RemoveItem' and ARRPOS($dh_Inventories, $ARGS[1]) != -1:
  166. $.owner = $ARGS[1]
  167. $.itemType = $ARGS[2]
  168. $.itemName = $ARGS[3]
  169. $.slotNo = $ARGS[4]
  170. gs 'KILLVARS', '.owner', '.itemType', '.itemName', '.slotNo' &!AUTO-GENERATED KILLVARS
  171. exit
  172. if $ARGS[0] = 'AddMoney' and ARRPOS($dh_Inventories, $ARGS[1]) != -1:
  173. exit
  174. if $ARGS[0] = 'RemoveMoney' and ARRPOS($dh_Inventories, $ARGS[1]) != -1:
  175. exit
  176. !! TODO: Delete an inventory
  177. !! TODO: An actual inventory for unequipped armor, weapons, and items
  178. !! TODO: Each inventory should have a currency associated with it
  179. !! Perhaps a special currency as well
  180. --- DungeonHunter_Inventory ---------------------------------