Advertisement
Emistry

[RO] SQL All-in-One Shop - auto generate price 1.1

Oct 16th, 2016
1,362
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.02 KB | None | 0 0
  1. // https://rathena.org/board/topic/107660-r-sql-mall/
  2.  
  3. - script all_in_one_shop_main -1,{
  4.  
  5. OnInit:
  6. callsub(OnLoad,IT_HEALING);
  7. callsub(OnLoad,IT_USABLE);
  8. callsub(OnLoad,IT_ETC);
  9. callsub(OnLoad,IT_WEAPON);
  10. callsub(OnLoad,IT_ARMOR);
  11. callsub(OnLoad,IT_CARD);
  12. callsub(OnLoad,IT_PETEGG);
  13. callsub(OnLoad,IT_PETARMOR);
  14. callsub(OnLoad,IT_AMMO);
  15. callsub(OnLoad,IT_DELAYCONSUME);
  16. callsub(OnLoad,IT_CASH);
  17. end;
  18.  
  19. OnLoad:
  20. .@type = getarg( 0,-1 );
  21.  
  22. .@size = query_sql( "SELECT `id`,`weight`,`atk`,`matk`,`slots`,`weapon_level`,`defence`,`equip_level_min`,`script`,`equip_script`,`unequip_script` FROM `item_db` WHERE `type` = "+.@type, .@id,.@weight,.@atk,.@math,.@slot,.@weapon_level,.@defence,.@equip_level_min,.@script$,.@equip_script$,.@unequip_script$ );
  23.  
  24. if ( .@size ) {
  25. .@npc_count = ( .@size / 100 );
  26.  
  27. freeloop(1);
  28. do {
  29. .@x = 0;
  30. do {
  31. .@index = ( .@npc * 100 + .@x );
  32.  
  33. .@total_cost = 0;
  34.  
  35. // cost calculations
  36. .@total_cost += (( .@weight[.@index] / 10 ) * 1000 );
  37. .@total_cost += (( .@atk[.@index] / 100 ) * 5000 );
  38. .@total_cost += ( .@slots[.@index] * 3000 );
  39. .@total_cost += ( .@weapon_level[.@index] * 2000 );
  40. .@total_cost += (( .@defence[.@index] / 10 ) * 1000 );
  41. .@total_cost += (( .@equip_level_min[.@index] / 10 ) * 10000 );
  42.  
  43. // effect count.
  44. .@total_cost += ( countstr( .@script$,"bonus" ) * 1000 );
  45. .@total_cost += ( countstr( .@equip_script$,"bonus" ) * 1000 );
  46. .@total_cost += ( countstr( .@unequip_script$,"bonus" ) * 1000 );
  47.  
  48.  
  49. .@npc_shop_name$ = "Shop#type_"+.@type+"_"+.@npc;
  50. npcshopdelitem .@npc_shop_name$,909;
  51. npcshopadditem .@npc_shop_name$,.@id[.@index],.@total_cost;
  52. .@x++;
  53. } while ( .@x < 100 && .@index < .@size );
  54. .@npc++;
  55. } while ( .@npc <= .@npc_count );
  56. debugmes "Loaded NPC Shop for Item Type "+.@type+" - "+( ( .@npc * 100 + .@x ) - 1 )+" Item(s)";
  57. freeloop(0);
  58. }
  59. return;
  60.  
  61. }
  62.  
  63. prt_fild08,203,72,5 shop Shop#type_0_1 4_F_KAFRA1,909:-1
  64. prt_fild08,205,72,5 shop Shop#type_0_2 4_F_KAFRA1,909:-1
  65. prt_fild08,207,72,5 shop Shop#type_0_3 4_F_KAFRA1,909:-1
  66. prt_fild08,209,72,5 shop Shop#type_0_4 4_F_KAFRA1,909:-1
  67.  
  68. prt_fild08,203,72,5 shop Shop#type_2_1 4_F_KAFRA1,909:-1
  69. prt_fild08,205,72,5 shop Shop#type_2_2 4_F_KAFRA1,909:-1
  70. prt_fild08,207,72,5 shop Shop#type_2_3 4_F_KAFRA1,909:-1
  71. prt_fild08,209,72,5 shop Shop#type_2_4 4_F_KAFRA1,909:-1
  72. prt_fild08,211,72,5 shop Shop#type_2_5 4_F_KAFRA1,909:-1
  73. prt_fild08,213,72,5 shop Shop#type_2_6 4_F_KAFRA1,909:-1
  74. prt_fild08,215,72,5 shop Shop#type_2_7 4_F_KAFRA1,909:-1
  75. prt_fild08,217,72,5 shop Shop#type_2_8 4_F_KAFRA1,909:-1
  76. prt_fild08,219,72,5 shop Shop#type_2_9 4_F_KAFRA1,909:-1
  77. prt_fild08,221,72,5 shop Shop#type_2_10 4_F_KAFRA1,909:-1
  78.  
  79. prt_fild08,203,59,5 shop Shop#type_3_1 4_F_KAFRA1,909:-1
  80. prt_fild08,205,59,5 shop Shop#type_3_2 4_F_KAFRA1,909:-1
  81. prt_fild08,207,59,5 shop Shop#type_3_3 4_F_KAFRA1,909:-1
  82. prt_fild08,209,59,5 shop Shop#type_3_4 4_F_KAFRA1,909:-1
  83. prt_fild08,211,59,5 shop Shop#type_3_5 4_F_KAFRA1,909:-1
  84. prt_fild08,213,59,5 shop Shop#type_3_6 4_F_KAFRA1,909:-1
  85. prt_fild08,215,59,5 shop Shop#type_3_7 4_F_KAFRA1,909:-1
  86. prt_fild08,217,59,5 shop Shop#type_3_8 4_F_KAFRA1,909:-1
  87. prt_fild08,219,59,5 shop Shop#type_3_9 4_F_KAFRA1,909:-1
  88. prt_fild08,203,57,5 shop Shop#type_3_10 4_F_KAFRA1,909:-1
  89. prt_fild08,205,57,5 shop Shop#type_3_11 4_F_KAFRA1,909:-1
  90. prt_fild08,207,57,5 shop Shop#type_3_12 4_F_KAFRA1,909:-1
  91. prt_fild08,209,57,5 shop Shop#type_3_13 4_F_KAFRA1,909:-1
  92. prt_fild08,211,57,5 shop Shop#type_3_14 4_F_KAFRA1,909:-1
  93. prt_fild08,213,57,5 shop Shop#type_3_15 4_F_KAFRA1,909:-1
  94. prt_fild08,215,57,5 shop Shop#type_3_16 4_F_KAFRA1,909:-1
  95. prt_fild08,217,57,5 shop Shop#type_3_17 4_F_KAFRA1,909:-1
  96. prt_fild08,219,57,5 shop Shop#type_3_18 4_F_KAFRA1,909:-1
  97. prt_fild08,221,57,5 shop Shop#type_3_19 4_F_KAFRA1,909:-1
  98.  
  99. prt_fild08,203,72,5 shop Shop#type_4_1 4_F_KAFRA1,909:-1
  100. prt_fild08,205,72,5 shop Shop#type_4_2 4_F_KAFRA1,909:-1
  101. prt_fild08,207,72,5 shop Shop#type_4_3 4_F_KAFRA1,909:-1
  102. prt_fild08,209,72,5 shop Shop#type_4_4 4_F_KAFRA1,909:-1
  103. prt_fild08,211,72,5 shop Shop#type_4_5 4_F_KAFRA1,909:-1
  104. prt_fild08,213,72,5 shop Shop#type_4_6 4_F_KAFRA1,909:-1
  105. prt_fild08,215,72,5 shop Shop#type_4_7 4_F_KAFRA1,909:-1
  106. prt_fild08,217,72,5 shop Shop#type_4_8 4_F_KAFRA1,909:-1
  107. prt_fild08,219,72,5 shop Shop#type_4_9 4_F_KAFRA1,909:-1
  108. prt_fild08,221,72,5 shop Shop#type_4_10 4_F_KAFRA1,909:-1
  109. prt_fild08,223,72,5 shop Shop#type_4_11 4_F_KAFRA1,909:-1
  110.  
  111. prt_fild08,203,59,5 shop Shop#type_5_1 4_F_KAFRA1,909:-1
  112. prt_fild08,205,59,5 shop Shop#type_5_2 4_F_KAFRA1,909:-1
  113. prt_fild08,207,59,5 shop Shop#type_5_3 4_F_KAFRA1,909:-1
  114. prt_fild08,209,59,5 shop Shop#type_5_4 4_F_KAFRA1,909:-1
  115. prt_fild08,211,59,5 shop Shop#type_5_5 4_F_KAFRA1,909:-1
  116. prt_fild08,213,59,5 shop Shop#type_5_6 4_F_KAFRA1,909:-1
  117. prt_fild08,215,59,5 shop Shop#type_5_7 4_F_KAFRA1,909:-1
  118. prt_fild08,217,59,5 shop Shop#type_5_8 4_F_KAFRA1,909:-1
  119. prt_fild08,219,59,5 shop Shop#type_5_9 4_F_KAFRA1,909:-1
  120. prt_fild08,203,57,5 shop Shop#type_5_10 4_F_KAFRA1,909:-1
  121. prt_fild08,205,57,5 shop Shop#type_5_11 4_F_KAFRA1,909:-1
  122. prt_fild08,207,57,5 shop Shop#type_5_12 4_F_KAFRA1,909:-1
  123. prt_fild08,209,57,5 shop Shop#type_5_13 4_F_KAFRA1,909:-1
  124. prt_fild08,211,57,5 shop Shop#type_5_14 4_F_KAFRA1,909:-1
  125. prt_fild08,213,57,5 shop Shop#type_5_15 4_F_KAFRA1,909:-1
  126. prt_fild08,215,57,5 shop Shop#type_5_16 4_F_KAFRA1,909:-1
  127. prt_fild08,217,57,5 shop Shop#type_5_17 4_F_KAFRA1,909:-1
  128. prt_fild08,219,57,5 shop Shop#type_5_18 4_F_KAFRA1,909:-1
  129. prt_fild08,221,57,5 shop Shop#type_5_19 4_F_KAFRA1,909:-1
  130. prt_fild08,203,55,5 shop Shop#type_5_20 4_F_KAFRA1,909:-1
  131. prt_fild08,205,55,5 shop Shop#type_5_21 4_F_KAFRA1,909:-1
  132. prt_fild08,207,55,5 shop Shop#type_5_22 4_F_KAFRA1,909:-1
  133. prt_fild08,209,55,5 shop Shop#type_5_23 4_F_KAFRA1,909:-1
  134. prt_fild08,211,55,5 shop Shop#type_5_24 4_F_KAFRA1,909:-1
  135. prt_fild08,213,55,5 shop Shop#type_5_25 4_F_KAFRA1,909:-1
  136. prt_fild08,215,55,5 shop Shop#type_5_26 4_F_KAFRA1,909:-1
  137. prt_fild08,217,55,5 shop Shop#type_5_27 4_F_KAFRA1,909:-1
  138. prt_fild08,219,55,5 shop Shop#type_5_28 4_F_KAFRA1,909:-1
  139. prt_fild08,221,55,5 shop Shop#type_5_29 4_F_KAFRA1,909:-1
  140. prt_fild08,203,53,5 shop Shop#type_5_30 4_F_KAFRA1,909:-1
  141. prt_fild08,205,53,5 shop Shop#type_5_31 4_F_KAFRA1,909:-1
  142. prt_fild08,207,53,5 shop Shop#type_5_32 4_F_KAFRA1,909:-1
  143. prt_fild08,209,53,5 shop Shop#type_5_33 4_F_KAFRA1,909:-1
  144.  
  145. prt_fild08,203,59,5 shop Shop#type_6_1 4_F_KAFRA1,909:-1
  146. prt_fild08,205,59,5 shop Shop#type_6_2 4_F_KAFRA1,909:-1
  147. prt_fild08,207,59,5 shop Shop#type_6_3 4_F_KAFRA1,909:-1
  148. prt_fild08,209,59,5 shop Shop#type_6_4 4_F_KAFRA1,909:-1
  149. prt_fild08,211,59,5 shop Shop#type_6_5 4_F_KAFRA1,909:-1
  150. prt_fild08,213,59,5 shop Shop#type_6_6 4_F_KAFRA1,909:-1
  151. prt_fild08,215,59,5 shop Shop#type_6_7 4_F_KAFRA1,909:-1
  152. prt_fild08,217,59,5 shop Shop#type_6_8 4_F_KAFRA1,909:-1
  153. prt_fild08,219,59,5 shop Shop#type_6_9 4_F_KAFRA1,909:-1
  154. prt_fild08,203,57,5 shop Shop#type_6_10 4_F_KAFRA1,909:-1
  155. prt_fild08,205,57,5 shop Shop#type_6_11 4_F_KAFRA1,909:-1
  156.  
  157. prt_fild08,203,59,5 shop Shop#type_7_1 4_F_KAFRA1,909:-1
  158.  
  159. prt_fild08,203,59,5 shop Shop#type_8_1 4_F_KAFRA1,909:-1
  160.  
  161. prt_fild08,203,59,5 shop Shop#type_10_1 4_F_KAFRA1,909:-1
  162. prt_fild08,203,59,5 shop Shop#type_10_2 4_F_KAFRA1,909:-1
  163.  
  164. prt_fild08,203,59,5 shop Shop#type_11_1 4_F_KAFRA1,909:-1
  165. prt_fild08,203,59,5 shop Shop#type_11_2 4_F_KAFRA1,909:-1
  166.  
  167. prt_fild08,203,59,5 shop Shop#type_18_1 4_F_KAFRA1,909:-1
  168. prt_fild08,205,59,5 shop Shop#type_18_2 4_F_KAFRA1,909:-1
  169. prt_fild08,207,59,5 shop Shop#type_18_3 4_F_KAFRA1,909:-1
  170. prt_fild08,209,59,5 shop Shop#type_18_4 4_F_KAFRA1,909:-1
  171. prt_fild08,211,59,5 shop Shop#type_18_5 4_F_KAFRA1,909:-1
  172. prt_fild08,213,59,5 shop Shop#type_18_6 4_F_KAFRA1,909:-1
  173. prt_fild08,215,59,5 shop Shop#type_18_7 4_F_KAFRA1,909:-1
  174. prt_fild08,217,59,5 shop Shop#type_18_8 4_F_KAFRA1,909:-1
  175. prt_fild08,219,59,5 shop Shop#type_18_9 4_F_KAFRA1,909:-1
  176. prt_fild08,203,57,5 shop Shop#type_18_10 4_F_KAFRA1,909:-1
  177. prt_fild08,205,57,5 shop Shop#type_18_11 4_F_KAFRA1,909:-1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement