Emistry icon

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

Emistry | PRO | 10/16/16 06:17:44 AM UTC | 0 ⭐ | 1972 👁️ | Never ⏰ | []
text |

8.02 KB

|

None

|

0 👍

/

0 👎

// https://rathena.org/board/topic/107660-r-sql-mall/
 -	script	all_in_one_shop_main	-1,{
 	OnInit:
		callsub(OnLoad,IT_HEALING);
		callsub(OnLoad,IT_USABLE);
		callsub(OnLoad,IT_ETC);
		callsub(OnLoad,IT_WEAPON);
		callsub(OnLoad,IT_ARMOR);
		callsub(OnLoad,IT_CARD);
		callsub(OnLoad,IT_PETEGG);
		callsub(OnLoad,IT_PETARMOR);
		callsub(OnLoad,IT_AMMO);
		callsub(OnLoad,IT_DELAYCONSUME);
		callsub(OnLoad,IT_CASH);
		end;
 	OnLoad:
		.@type = getarg( 0,-1 );
 		.@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$ );
 		if ( .@size ) {
			.@npc_count = ( .@size / 100 );
 			freeloop(1);
			do {
				.@x = 0;
				do {
					.@index = ( .@npc * 100 + .@x );
 					.@total_cost = 0;
 					// cost calculations
					.@total_cost += (( .@weight[.@index] / 10 ) * 1000 );
					.@total_cost += (( .@atk[.@index] / 100 ) * 5000 );
					.@total_cost += ( .@slots[.@index] * 3000 );
					.@total_cost += ( .@weapon_level[.@index] * 2000 );
					.@total_cost += (( .@defence[.@index] / 10 ) * 1000 );
					.@total_cost += (( .@equip_level_min[.@index] / 10 ) * 10000 );
 					// effect count.
					.@total_cost += ( countstr( .@script$,"bonus" ) * 1000 );
					.@total_cost += ( countstr( .@equip_script$,"bonus" ) * 1000 );
					.@total_cost += ( countstr( .@unequip_script$,"bonus" ) * 1000 );
  					.@npc_shop_name$ = "Shop#type_"+.@type+"_"+.@npc;
					npcshopdelitem .@npc_shop_name$,909;
					npcshopadditem .@npc_shop_name$,.@id[.@index],.@total_cost;
					.@x++;
				} while ( .@x < 100 && .@index < .@size );
				.@npc++;
			} while ( .@npc <= .@npc_count );
			debugmes "Loaded NPC Shop for Item Type "+.@type+" - "+( ( .@npc * 100 + .@x ) - 1 )+" Item(s)";
			freeloop(0);
		}
		return;
 }
 prt_fild08,203,72,5	shop	Shop#type_0_1	4_F_KAFRA1,909:-1
prt_fild08,205,72,5	shop	Shop#type_0_2	4_F_KAFRA1,909:-1
prt_fild08,207,72,5	shop	Shop#type_0_3	4_F_KAFRA1,909:-1
prt_fild08,209,72,5	shop	Shop#type_0_4	4_F_KAFRA1,909:-1
 prt_fild08,203,72,5	shop	Shop#type_2_1	4_F_KAFRA1,909:-1
prt_fild08,205,72,5	shop	Shop#type_2_2	4_F_KAFRA1,909:-1
prt_fild08,207,72,5	shop	Shop#type_2_3	4_F_KAFRA1,909:-1
prt_fild08,209,72,5	shop	Shop#type_2_4	4_F_KAFRA1,909:-1
prt_fild08,211,72,5	shop	Shop#type_2_5	4_F_KAFRA1,909:-1
prt_fild08,213,72,5	shop	Shop#type_2_6	4_F_KAFRA1,909:-1
prt_fild08,215,72,5	shop	Shop#type_2_7	4_F_KAFRA1,909:-1
prt_fild08,217,72,5	shop	Shop#type_2_8	4_F_KAFRA1,909:-1
prt_fild08,219,72,5	shop	Shop#type_2_9	4_F_KAFRA1,909:-1
prt_fild08,221,72,5	shop	Shop#type_2_10	4_F_KAFRA1,909:-1
 prt_fild08,203,59,5	shop	Shop#type_3_1	4_F_KAFRA1,909:-1
prt_fild08,205,59,5	shop	Shop#type_3_2	4_F_KAFRA1,909:-1
prt_fild08,207,59,5	shop	Shop#type_3_3	4_F_KAFRA1,909:-1
prt_fild08,209,59,5	shop	Shop#type_3_4	4_F_KAFRA1,909:-1
prt_fild08,211,59,5	shop	Shop#type_3_5	4_F_KAFRA1,909:-1
prt_fild08,213,59,5	shop	Shop#type_3_6	4_F_KAFRA1,909:-1
prt_fild08,215,59,5	shop	Shop#type_3_7	4_F_KAFRA1,909:-1
prt_fild08,217,59,5	shop	Shop#type_3_8	4_F_KAFRA1,909:-1
prt_fild08,219,59,5	shop	Shop#type_3_9	4_F_KAFRA1,909:-1
prt_fild08,203,57,5	shop	Shop#type_3_10	4_F_KAFRA1,909:-1
prt_fild08,205,57,5	shop	Shop#type_3_11	4_F_KAFRA1,909:-1
prt_fild08,207,57,5	shop	Shop#type_3_12	4_F_KAFRA1,909:-1
prt_fild08,209,57,5	shop	Shop#type_3_13	4_F_KAFRA1,909:-1
prt_fild08,211,57,5	shop	Shop#type_3_14	4_F_KAFRA1,909:-1
prt_fild08,213,57,5	shop	Shop#type_3_15	4_F_KAFRA1,909:-1
prt_fild08,215,57,5	shop	Shop#type_3_16	4_F_KAFRA1,909:-1
prt_fild08,217,57,5	shop	Shop#type_3_17	4_F_KAFRA1,909:-1
prt_fild08,219,57,5	shop	Shop#type_3_18	4_F_KAFRA1,909:-1
prt_fild08,221,57,5	shop	Shop#type_3_19	4_F_KAFRA1,909:-1
 prt_fild08,203,72,5	shop	Shop#type_4_1	4_F_KAFRA1,909:-1
prt_fild08,205,72,5	shop	Shop#type_4_2	4_F_KAFRA1,909:-1
prt_fild08,207,72,5	shop	Shop#type_4_3	4_F_KAFRA1,909:-1
prt_fild08,209,72,5	shop	Shop#type_4_4	4_F_KAFRA1,909:-1
prt_fild08,211,72,5	shop	Shop#type_4_5	4_F_KAFRA1,909:-1
prt_fild08,213,72,5	shop	Shop#type_4_6	4_F_KAFRA1,909:-1
prt_fild08,215,72,5	shop	Shop#type_4_7	4_F_KAFRA1,909:-1
prt_fild08,217,72,5	shop	Shop#type_4_8	4_F_KAFRA1,909:-1
prt_fild08,219,72,5	shop	Shop#type_4_9	4_F_KAFRA1,909:-1
prt_fild08,221,72,5	shop	Shop#type_4_10	4_F_KAFRA1,909:-1
prt_fild08,223,72,5	shop	Shop#type_4_11	4_F_KAFRA1,909:-1
 prt_fild08,203,59,5	shop	Shop#type_5_1	4_F_KAFRA1,909:-1
prt_fild08,205,59,5	shop	Shop#type_5_2	4_F_KAFRA1,909:-1
prt_fild08,207,59,5	shop	Shop#type_5_3	4_F_KAFRA1,909:-1
prt_fild08,209,59,5	shop	Shop#type_5_4	4_F_KAFRA1,909:-1
prt_fild08,211,59,5	shop	Shop#type_5_5	4_F_KAFRA1,909:-1
prt_fild08,213,59,5	shop	Shop#type_5_6	4_F_KAFRA1,909:-1
prt_fild08,215,59,5	shop	Shop#type_5_7	4_F_KAFRA1,909:-1
prt_fild08,217,59,5	shop	Shop#type_5_8	4_F_KAFRA1,909:-1
prt_fild08,219,59,5	shop	Shop#type_5_9	4_F_KAFRA1,909:-1
prt_fild08,203,57,5	shop	Shop#type_5_10	4_F_KAFRA1,909:-1
prt_fild08,205,57,5	shop	Shop#type_5_11	4_F_KAFRA1,909:-1
prt_fild08,207,57,5	shop	Shop#type_5_12	4_F_KAFRA1,909:-1
prt_fild08,209,57,5	shop	Shop#type_5_13	4_F_KAFRA1,909:-1
prt_fild08,211,57,5	shop	Shop#type_5_14	4_F_KAFRA1,909:-1
prt_fild08,213,57,5	shop	Shop#type_5_15	4_F_KAFRA1,909:-1
prt_fild08,215,57,5	shop	Shop#type_5_16	4_F_KAFRA1,909:-1
prt_fild08,217,57,5	shop	Shop#type_5_17	4_F_KAFRA1,909:-1
prt_fild08,219,57,5	shop	Shop#type_5_18	4_F_KAFRA1,909:-1
prt_fild08,221,57,5	shop	Shop#type_5_19	4_F_KAFRA1,909:-1
prt_fild08,203,55,5	shop	Shop#type_5_20	4_F_KAFRA1,909:-1
prt_fild08,205,55,5	shop	Shop#type_5_21	4_F_KAFRA1,909:-1
prt_fild08,207,55,5	shop	Shop#type_5_22	4_F_KAFRA1,909:-1
prt_fild08,209,55,5	shop	Shop#type_5_23	4_F_KAFRA1,909:-1
prt_fild08,211,55,5	shop	Shop#type_5_24	4_F_KAFRA1,909:-1
prt_fild08,213,55,5	shop	Shop#type_5_25	4_F_KAFRA1,909:-1
prt_fild08,215,55,5	shop	Shop#type_5_26	4_F_KAFRA1,909:-1
prt_fild08,217,55,5	shop	Shop#type_5_27	4_F_KAFRA1,909:-1
prt_fild08,219,55,5	shop	Shop#type_5_28	4_F_KAFRA1,909:-1
prt_fild08,221,55,5	shop	Shop#type_5_29	4_F_KAFRA1,909:-1
prt_fild08,203,53,5	shop	Shop#type_5_30	4_F_KAFRA1,909:-1
prt_fild08,205,53,5	shop	Shop#type_5_31	4_F_KAFRA1,909:-1
prt_fild08,207,53,5	shop	Shop#type_5_32	4_F_KAFRA1,909:-1
prt_fild08,209,53,5	shop	Shop#type_5_33	4_F_KAFRA1,909:-1
 prt_fild08,203,59,5	shop	Shop#type_6_1	4_F_KAFRA1,909:-1
prt_fild08,205,59,5	shop	Shop#type_6_2	4_F_KAFRA1,909:-1
prt_fild08,207,59,5	shop	Shop#type_6_3	4_F_KAFRA1,909:-1
prt_fild08,209,59,5	shop	Shop#type_6_4	4_F_KAFRA1,909:-1
prt_fild08,211,59,5	shop	Shop#type_6_5	4_F_KAFRA1,909:-1
prt_fild08,213,59,5	shop	Shop#type_6_6	4_F_KAFRA1,909:-1
prt_fild08,215,59,5	shop	Shop#type_6_7	4_F_KAFRA1,909:-1
prt_fild08,217,59,5	shop	Shop#type_6_8	4_F_KAFRA1,909:-1
prt_fild08,219,59,5	shop	Shop#type_6_9	4_F_KAFRA1,909:-1
prt_fild08,203,57,5	shop	Shop#type_6_10	4_F_KAFRA1,909:-1
prt_fild08,205,57,5	shop	Shop#type_6_11	4_F_KAFRA1,909:-1
 prt_fild08,203,59,5	shop	Shop#type_7_1	4_F_KAFRA1,909:-1
 prt_fild08,203,59,5	shop	Shop#type_8_1	4_F_KAFRA1,909:-1
 prt_fild08,203,59,5	shop	Shop#type_10_1	4_F_KAFRA1,909:-1
prt_fild08,203,59,5	shop	Shop#type_10_2	4_F_KAFRA1,909:-1
 prt_fild08,203,59,5	shop	Shop#type_11_1	4_F_KAFRA1,909:-1
prt_fild08,203,59,5	shop	Shop#type_11_2	4_F_KAFRA1,909:-1
 prt_fild08,203,59,5	shop	Shop#type_18_1	4_F_KAFRA1,909:-1
prt_fild08,205,59,5	shop	Shop#type_18_2	4_F_KAFRA1,909:-1
prt_fild08,207,59,5	shop	Shop#type_18_3	4_F_KAFRA1,909:-1
prt_fild08,209,59,5	shop	Shop#type_18_4	4_F_KAFRA1,909:-1
prt_fild08,211,59,5	shop	Shop#type_18_5	4_F_KAFRA1,909:-1
prt_fild08,213,59,5	shop	Shop#type_18_6	4_F_KAFRA1,909:-1
prt_fild08,215,59,5	shop	Shop#type_18_7	4_F_KAFRA1,909:-1
prt_fild08,217,59,5	shop	Shop#type_18_8	4_F_KAFRA1,909:-1
prt_fild08,219,59,5	shop	Shop#type_18_9	4_F_KAFRA1,909:-1
prt_fild08,203,57,5	shop	Shop#type_18_10	4_F_KAFRA1,909:-1
prt_fild08,205,57,5	shop	Shop#type_18_11	4_F_KAFRA1,909:-1

Comments