SHARE
TWEET

Another RPG Engine inventory code

a guest Sep 16th, 2019 99 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. :: Menu: Inventory[menu battle noreturn]
  2. <span id="content"><<nobr>>
  3. <<set _filter = "all">>
  4. <div id="itemdisplay">
  5. <<include "inventory item display">>
  6. </div>
  7. <div id="itemlist">
  8. <<include "inventory item list">>
  9. </div>
  10. <</nobr>>
  11. </span>
  12.  
  13. :: inventory item list[nobr]
  14. <div style="display:flex; justify-content:space-evenly;">
  15. <<if _filter == "all">>
  16.     <b>All</b>
  17. <<else>>
  18.     <<link "All">>
  19.         <<set _filter = "all">>
  20.         <<replace "#itemlist">><<include "inventory item list">><</replace>>
  21.     <</link>>
  22. <</if>>
  23. <<if _filter == "usable">>
  24.     <b>Usable</b>
  25. <<else>>
  26.     <<link "Usable">>
  27.         <<set _filter = "usable">>
  28.         <<replace "#itemlist">><<include "inventory item list">><</replace>>
  29.     <</link>>
  30. <</if>>
  31. <<if _filter == "equipment">>
  32.     <b>Equipment</b>
  33. <<else>>
  34.     <<link "Equipment">>
  35.         <<set _filter = "equipment">>
  36.         <<replace "#itemlist">><<include "inventory item list">><</replace>>
  37.     <</link>>
  38. <</if>>
  39. </div>
  40. <br/>
  41. <div class="itemcontainer">
  42. <<set _p = 2>>
  43. <<for _name, _item range $inv>>
  44. <<if _p == 1>>
  45.     <<set _p = 2>>
  46. <<elseif _p == 2>>
  47.     <<set _p = 1>>
  48. <</if>>
  49.     <<if _filter == "all" || (_filter == "usable" && _item.usable.includes("inmenu")) || (_filter == "equipment" && _item.equippable)>>
  50.     <div @class="'item'+_p">
  51.     <b>
  52.     <<capture _item>>
  53.     <<link "_name">>
  54.         <<set _display = _item>>
  55.         <<replace "#itemdisplay">><<include "inventory item display">><</replace>>
  56.     <</link>>
  57.     <</capture>>
  58.     </b> <span class="itemstock">(_item.stock)</span>
  59.     </div>
  60.     <</if>>
  61. <</for>>
  62. </div>
  63.  
  64. :: inventory item display[nobr]
  65. <<if ndef _display || _display === null>>
  66.     <div style="text-align: center; line-height: 70px; color: gray">Click on an item to see info</div>
  67. <<else>>
  68. <b>_display.name</b><br/>
  69. _display.info<br/>
  70. <div class="actdesc">_display.desc</div>
  71. <<if _display.usable.includes('inmenu') || _display.equippable>>
  72. <div style="display: flex; justify-content: space-evenly">
  73.     <<set _b = 0>>
  74.     <<if _display.usable.includes('inmenu') && _display.stock > 0>>
  75.         <<set _b++>>
  76.         <span @id="'button'+_b">
  77.             <span id="usebutton">
  78.             <<include "inventory use button">>
  79.             </span>
  80.         </span>
  81.     <</if>>
  82.     <<if _display.equippable && _display.stock > 0>>
  83.         <<set _b++>>
  84.         <span @id="'button'+_b">
  85.             <span id="equipbutton">
  86.             <<include "equip button">>
  87.             </span>
  88.         </span>
  89.     <</if>>
  90. </div>
  91. <</if>>
  92. <</if>>
  93.  
  94. :: equip button[nobr]
  95. <<link "[EQUIP]">>
  96.     <<set _itemcancel = true; _target = _b; _event = "equip">>
  97.     <<replace "#usebutton">><<include "inventory use button">><</replace>>
  98.     <<replace "#equipbutton">><<include "inventory cancel button">><</replace>>
  99.     <<replace "#itemlist">><<include "inventory puppets">><</replace>>
  100. <</link>>
  101. <<if _b == 1>>
  102. <span style="font-family:monospace; font-size:10pt">[Q]</span>
  103. <<elseif _b == 2>>
  104. <span style="font-family:monospace; font-size:10pt">[W]</span>
  105. <</if>>
  106.  
  107. :: inventory use button[nobr]
  108. <<link "[USE]">>
  109.     <<set _itemcancel = true; _target = 1; _event = "use">>
  110.     <<replace "#usebutton">><<include "inventory cancel button">><</replace>>
  111.     <<replace "#equipbutton">><<include "equip button">><</replace>>
  112.     <<replace "#itemlist">><<include "inventory puppets">><</replace>>
  113. <</link>>
  114. <span style="font-family:monospace; font-size:10pt">[Q]</span>
  115.  
  116. :: inventory cancel button[nobr]
  117. <<link "[CANCEL]">>
  118.     <<set _itemcancel = false>>
  119.     <<replace "#usebutton">><<include "inventory use button">><</replace>>
  120.     <<replace "#equipbutton">><<include "equip button">><</replace>>
  121.     <<replace "#itemlist">><<include "inventory item list">><</replace>>
  122. <</link>>
  123. <span style="font-family:monospace; font-size:10pt">[E]</span>
  124.  
  125. :: inventory puppets[nobr]
  126. <<for _i, _puppet range $puppets>>
  127.     <div class="menuactor" @id="_i" style="display:grid; grid-template-columns: 33% 1fr">
  128.         <div class="menuactor-nameblock" style="position:static; padding-left:14px; padding-top:5px; padding-bottom:0.5em; grid-row:1; grid-column:1; border-right:1px solid">
  129.             <div class="menuactor-name">
  130.             <<capture _i, _puppet>>
  131.             <<if _event == "equip">>
  132.                 <<link _puppet.name>>
  133.                     <<run _puppet.equip(_display)>>
  134.                     <<unset _display>>
  135.                     <<replace "#itemdisplay">><<include "inventory item display">><</replace>>
  136.                     <<replace "#itemlist">><<include "inventory item list">><</replace>>
  137.                 <</link>>
  138.             <<elseif _event == "use">>
  139.                 <<link _puppet.name>>
  140.                     <<run _display.onUse(_puppet); console.log("item used"); console.log(_puppet.maxhp); console.log($puppets.indexOf(_puppet).maxhp)>>
  141.                     <<unset _display>>
  142.                     <<replace "#itemdisplay">><<include "inventory item display">><</replace>>
  143.                     <<replace "#itemlist">><<include "inventory item list">><</replace>>
  144.                 <</link>>
  145.             <</if>>
  146.             <</capture>>
  147.             </div>
  148.             <div class="menuactor-stats" style="grid-row:unset; grid-column:unset; grid-template-columns:40% 3em 4em; border-right:none; top-padding:0">
  149.             <<for _k, _v range _puppet.stats>>
  150.                 <div class="menuactor-statname" style="margin-left:0">_k</div>
  151.                 <div class="menuactor-statvalue">_v.Base</div>
  152.                 <<if _v.Bonus != 0>>
  153.                     <div class="menuactor-statmod">
  154.                     <<if _v.Bonus > 0>>
  155.                         @@.green;<<print "\+"+_v.Bonus>>@@
  156.                     <<elseif _v.Bonus < 0>>
  157.                         @@.stat-lowered;<<print "-"+_v.Bonus>>@@
  158.                     <</if>>
  159.                     </div>
  160.                 <</if>>
  161.             <</for>>
  162.             </div>
  163.         </div>
  164.         <div style="grid-row:1; grid-column:2; margin-left:1em; margin-top:0.5em; margin-bottom:0.5em; margin-right:1em">
  165.         <<for _k, _v range _puppet.equipment>>
  166.             <div class="menuactor-equipment-slot">_k</div>
  167.             <<if _v === null>><span class="menuactor-equipment-name">&nbsp;</span>
  168.             <<else>>
  169.                 <div class="menuactor-equipment-name">_v.name<br/>
  170.                 <span class="actdesc">_v.info</span>
  171.                 </div>
  172.             <</if>>
  173.         <</for>>
  174.         </div>
  175.     </div>
  176. <</for>>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top