//===== Hercules Script ====================================== //= Treasure Hunter Quests //===== By: ================================================== //= Fredzilla //===== Current Version: ===================================== //= 1.3 //===== Description: ========================================= //= Start for Treasure hunter quests //===== Additional Comments: ================================= //= Event_THQS - Used to check if you have already registered //= #Treasure_Token - used to keep track of tokens //= 1.0 - Straight conversion of Aegis NPC file //= 1.1 - balanced some prices, fixed 1 missing label //= removed Executioner&Mysteltain swords [Lupus] //= 1.2 - Optmized and fixed small error [Panikon] //= 1.2a - Fixed zeny formula [Panikon] //= 1.3 - Added npc name config //= Added and changed the menu //= Removed ths_menu_weapons function to accommodate //= the new menu [Legend] //============================================================ prt_in,159,172,0 warp thqwrp 3,3,yuno_in01,123,155 // Main configuration object - script THQS#Configuration FAKE_NPC,{ OnInit: // NPC NAME CONFIG $npc_name_thq$ = "[Ash]"; // New added menu 2 (special items) setarray $THQS_menu_SpIt[0],Dragon_Slayer,Bow_Of_Roguemaster,Longinus's_Spear,Robe_Of_Casting; setarray $THQS_menu_SpIt_price[0],200,200,200,300; // Cards setarray $THQS_menu_card[0],Garm_Card,Knight_Windstorm_Card,Golden_Bug_Card,Ghostring_Card; setarray $THQS_menu_prices[0],150,200,200,200; // New added menu 4 (castle drops) setarray $THQS_menu_CD[0],Jewel_Of_Prayer,Iron_Glove,Iron_Maiden,Mystery_Wheel; setarray $THQS_menu_CD_price[0],200,200,200,200; end; } // Trades tokens // getarg(0) - number of tokens to be traded function script thqs_trade_token { @type = getarg(0); if( @type == 4 ) close; // 10^0, 10^1, 10^2 @type -= 1; @price = pow(10, @type); // 10^6 * 5 = 5m, 10^7 * 5 = 50m, 10^8 * 5 = 500m @type += 6; // So we can use pow later to determine the qt of Zeny @prize = pow(10, @type); @fnlprize = @prize * 5; if( #Treasure_Token < @price ) { mes "You don't have enough tokens!"; close; } if( Zeny == MAX_ZENY ) { mes "You can't add more zeny to your character"; close; } Zeny += @fnlprize; #Treasure_Token -= @price; close; } // Creates a buying menu // getarg(0) - .@mw$ -> ID // getarg(1) - .@mp$ -> PRICE function script thqs_menu_buy { if( getargcount() != 2 ) { debugmes "thqs_menu_buy: Wrong number of arguments!!"; close; } .@mw$ = getarg(0); .@mp$ = getarg(1); if( getarraysize( getd(.@mw$) ) != getarraysize( getd(.@mp$) ) ) { debugmes "thqs_menu_buy: Missing entries in data!"; close; } // Dynamic menu // Uses a dynamic string and then applies it to a *select .@select_menu$ = ""; for( .@i = 0; .@i < getarraysize( getd(.@mw$) ); .@i++ ) { .@price = getd(.@mp$+"["+.@i+"]"); if( .@select_menu$ != "") .@select_menu$ = .@select_menu$+":"+getitemname( getd(.@mw$+"["+.@i+"]") )+" - "+.@price+"T"; else .@select_menu$ = getitemname( getd(.@mw$+"["+.@i+"]") )+" - "+.@price+"T"; } .@select_menu$ = .@select_menu$ + ":Nevermind"; select(.@select_menu$); if( @menu == (.@i+1) ) close; @index = @menu - 1; // Arrays are 0 indexed while our menu is not @item_id = getd(.@mw$+"["+@index+"]"); @price = getd(.@mp$+"["+@index+"]"); if( #Treasure_Token < @price ) { mes $npc_name_thq$; mes "You don't have enough tokens!"; close; } #Treasure_Token -= @price; logmes "Treasure Token: Bought a "+getitemname(@item_id); getitem @item_id,1; close; } // Main script prt_in,164,174,1 script Treasure Hunter's Shop 1_M_YOUNGKNIGHT,{ mes $npc_name_thq$; mes "Ahh, "+strcharinfo(0)+"! Welcome to the Offical Treasure Hunter's Guild Shop."; mes "You currently have ^FF0000"+#Treasure_Token+"^000000 treasure tokens!!!"; next; switch( select("How does this place work?","What do you have in stock?","Nevermind") ) { case 1: mes $npc_name_thq$; mes "Well you see here you can exchange your treasure hunter tokens for zeny or rare weapons forged by our blacksmiths."; mes " "; mes "Everything has its own price value and the only way you can get the tokens is by completing quests assigned to you,the system normally works like this."; mes " "; mes "The harder the mission the more Tokens you will earn. All red quests are worth 4-8 Tokens, and the rest are worth 1-5."; mes " "; mes "Hope that solves your problem and questions."; close; case 2: break; case 3: close; } mes $npc_name_thq$; mes "Ok here is our Big list of goods."; mes " "; mes "(Note T stands for a Treasure Token.)"; next; mes $npc_name_thq$; mes "This is what we have to offer."; next; switch( select("Trade for Zeny", "Trade for Special Items", "Trade for Cards","Trade for Castle Drops", "Nevermind") ) { case 1: select("5,000,000z - 1T","50,000,000z - 10T","500,000,000z - 100T","Nevermind"); thqs_trade_token(@menu); case 2: mes $npc_name_thq$; mes "This is what we have to offer."; next; thqs_menu_buy("$THQS_menu_SpIt","$THQS_menu_SpIt_price"); case 3: mes $npc_name_thq$; mes "This is what we have to offer."; next; thqs_menu_buy("$THQS_menu_card","$THQS_menu_prices"); case 4: mes $npc_name_thq$; mes "This is what we have to offer."; next; thqs_menu_buy("$THQS_menu_CD","$THQS_menu_CD_price"); case 5: close; } end; }