Permalink
Cannot retrieve contributors at this time
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
978 lines (905 sloc)
38.3 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //===== rAthena Script ======================================= | |
| //= Fame Quest and Shop System | |
| //===== By =================================================== | |
| //= llchrisll | |
| //===== Version ============================================== | |
| //= 1.0 - Initial Version | |
| //= 1.1 - Added missing reset part after completing an quest | |
| // - Added Reset Quest Delay Option to GM Panel, | |
| // Quest Overview and Quest Counter Reset Option | |
| // to Quest Management menu | |
| // - Moved Class Selection at Quest Management after Quest Quantity List | |
| // - Modified the checks at OnNPCKillEvent: | |
| // - Fixed an typo at Fame Gaining in the function, I | |
| // forgot to add the new fame, instead it was setting it | |
| // - Fixed an Shop problem | |
| // - Changed the "mes" at Progress Displaying by whispering at the NPC | |
| // into "dispbottom", no need to open a window for that :P | |
| //= 1.2 - Compatible with rAthena now | |
| // - Fixxed some bugs and made some small edits | |
| // - Fixxed the GM check in the first lines | |
| // - Added OnAtCommand for Quest Progress Display via request | |
| // - Added an info for the players of the existence of the custom command | |
| // - Added an Repeat Limit per quest and per Class via request | |
| // - Added an SQL Ranking via request (See OnInit: for more) | |
| // - Added the "feature" to benefit from joining an party | |
| // - Modified Level Requirement Setting (See 'OnInit:') | |
| // 0 = Off / MAX_LEVEL - Server Max Level (src/map/map.h) | |
| // - Added an setting to define the Array Limit, to make it compatible with | |
| // older revisions, which doesn't have the Script Engine Upgrade (See 'set .array') | |
| //= 1.3 - Added the feature to add more classes by adding an the "BaseJob" value to .classes array | |
| // - Added an GM option to see their Class Values | |
| // - Exchanged the first menu "if(set(.@m,select(" with an switch | |
| // - Exchanged FamePoints_<Class> with FamePoints | |
| //===== Tested With ========================================= | |
| //= rAthena SQL 07/16-2017 Revision | |
| //===== Description ========================================== | |
| //= Gain Fame by doing "Fame Quests" and use the gained points | |
| // in the Fame Shop, where the GM's above lvl ".gm" can add/remove | |
| // items from. | |
| //= Fame Quests: | |
| // Fame Quests are listed via the Class Row you are in. | |
| //= See "OnInit:" for the Config. | |
| //===== Comments ============================================= | |
| //= Note: I will NOT!!!! add an FULL SQL Support for this. | |
| //===== Modification Requests ============================================= | |
| //= Custom @famequest to display your Quest Progress by Azeroth | |
| //= Quest Repeat Limit with an Timer (when the Repeat Limit will be reseted) by Azeroth | |
| //= SQL Ranking by Azeroth | |
| //===== ToDo List ============================================= | |
| //= ... | |
| //============================================================ | |
| /* | |
| CREATE TABLE IF NOT EXISTS `fame_rank` ( | |
| `char_id` int(10) unsigned NOT NULL default '1', | |
| `char_name` varchar(255) default 'Unknown', | |
| `class` int(10) unsigned default '0', | |
| `fame` tinyint(3) unsigned default '0', | |
| PRIMARY KEY (`char_id`) | |
| ) ENGINE=MyISAM; | |
| */ | |
| prontera,161,182,4 script Fame Manager 110,{ | |
| function FAME_FUNC; | |
| mes .n$; | |
| mes "Hello, "+strcharinfo(0)+"!"; | |
| if(getgmlevel() >= .gm) | |
| if(select("- GM Panel:- Player Menu") == 1) goto GM_Panel; | |
| mes "By completeing so called \"Fame Quests\" you can gain fame points,"; | |
| mes "which can be spent in the Shop."; | |
| mes "You can have up to "+.m_fame+" Fame Points each class."; | |
| mes "The quests depends on the class row in which you are,"; | |
| mes "like Knight belongs to the Class Row Swordsman"; | |
| next; | |
| mes .n$; | |
| mes "Please choose what you want to do now:"; | |
| next; | |
| switch(select("- Fame Quests:- Open Shop:- Ranking:- Nothing")) { | |
| case 1: | |
| mes .n$; | |
| set @t,0; | |
| for ( set .@l,0; .@l < getarraysize(.classes); set .@l,.@l + 1) | |
| if(BaseClass == .classes[.@l]) | |
| set @t,BaseClass; | |
| if(!@t) { | |
| mes "I'm sorry, but you can't gain any fame."; | |
| close; | |
| } | |
| mes "Hint: To check your quest progresses anytime and anywhere, there is an custom @command, which is \"@famequest\"."; | |
| mes " "; | |
| if(FameDelay < gettimetick(2)) { | |
| if(getarraysize(getd("$f_quest_id_"+@t)) < 1) { | |
| mes "I'm sorry, but there are no \"Fame Quests\" yet."; | |
| mes "Please try again later."; | |
| break; | |
| } | |
| if(FamePoints >= .m_fame) { | |
| mes "You have reached the maximum Fame for your Class."; | |
| mes "Please visit the Shop to use them."; | |
| break; | |
| } | |
| if(FameQuest) { // Player has an Quest active | |
| mes "I will list your progress in the Chat Room."; | |
| close2; | |
| dispbottom FAME_FUNC(0,@t,FameQuest); | |
| end; | |
| } else { // No quest accepted yet | |
| // Saving Quest ID's in a list | |
| // also displaying info about the quest | |
| for ( set .@m,0; .@m < getarraysize(getd("$f_quest_id_"+@t)); set .@m,.@m + 1) { | |
| mes "Quest ID: "+getd("$f_quest_id_"+@t+"["+.@m+"]"); | |
| set .@q_id,getd("$f_quest_id_"+@t+"["+.@m+"]"); | |
| mes "----------------"; | |
| set .@t,getd("$f_quest_"+.@q_id+"_"+@t+"_type"); | |
| mes "Type: "+ ( (.@t == 1)?"Monster Hunting":"Item Collecting"); | |
| if(.@t == 1) mes "Required Level: "+getd("$f_quest_"+.@q_id+"_"+@t+"_level"); | |
| mes "Target: "+ ( (.@t == 1)?getd("$f_quest_"+.@q_id+"_"+@t+"_mam[0]")+"x "+strmobinfo(1,getd("$f_quest_"+.@q_id+"_"+@t+"_mid[0]")):getd("$f_quest_"+.@q_id+"_"+@t+"_iam[0]")+"x "+getitemname(getd("$f_quest_"+.@q_id+"_"+@t+"_iid[0]")) ); | |
| for ( set .@l,1; .@l < getarraysize( getd("$f_quest_"+.@q_id+"_"+@t+"_"+( (.@t == 1)?"m":"i")+"id") ); set .@l,.@l + 1) | |
| mes " "+ ( (.@t == 1)?getd("$f_quest_"+.@q_id+"_"+@t+"_mam["+.@l+"]")+"x "+strmobinfo(1,getd("$f_quest_"+.@q_id+"_"+@t+"_mid["+.@l+"]")):getd("$f_quest_"+.@q_id+"_"+@t+"_iam["+.@l+"]")+"x "+getitemname(getd("$f_quest_"+.@q_id+"_"+@t+"_iid["+.@l+"]")) ); | |
| mes "Repeat Limit: "+getd("$f_quest_"+.@q_id+"_"+@t+"_rlimit"); | |
| mes "================="; | |
| set .@fm_menu$,.@fm_menu$ + "- Quest ID#"+getd("$f_quest_id_"+@t+"["+.@m+"]") + ( (getd("$f_quest_id_"+@t+"["+(.@m+1)+"]") == 0)?"":":"); | |
| } | |
| next; | |
| set .@g,select(.@fm_menu$) - 1; | |
| mes .n$; | |
| mes "You have chosen ID#"+set(.@id,getd("$f_quest_id_"+@t+"["+.@g+"]"))+":"; | |
| set .@t,getd("$f_quest_"+.@id+"_"+@t+"_type"); | |
| mes "Quest Info:"; | |
| mes "Type: "+( (.@t == 1)?"Monster Hunting":"Item Collecting"); | |
| if(.@t == 1) mes "Required Level: "+getd("$f_quest_"+.@id+"_"+@t+"_level"); | |
| mes "Target: "+ ( (.@t == 1)?getd("$f_quest_"+.@id+"_"+@t+"_mam[0]")+"x "+strmobinfo(1,getd("$f_quest_"+.@id+"_"+@t+"_mid[0]")):getd("$f_quest_"+.@id+"_"+@t+"_iam[0]")+"x "+getitemname(getd("$f_quest_"+.@id+"_"+@t+"_iid[0]")) ); | |
| for ( set .@l,1; .@l < getarraysize( getd("$f_quest_"+.@id+"_"+@t+"_"+( (.@t == 1)?"m":"i")+"id") ); set .@l,.@l + 1) | |
| mes " "+ ( (.@t == 1)?getd("$f_quest_"+.@id+"_"+@t+"_mam["+.@l+"]")+"x "+strmobinfo(1,getd("$f_quest_"+.@id+"_"+@t+"_mid["+.@l+"]")):getd("$f_quest_"+.@id+"_"+@t+"_iam["+.@l+"]")+"x "+getitemname(getd("$f_quest_"+.@id+"_"+@t+"_iid["+.@l+"]")) ); | |
| mes "Repeat Limit: "+( (getd("$f_quest_"+.@id+"_"+@t+"_rlimit") == 0)?"Unlimited":getd("$f_quest_"+.@id+"_"+@t+"_rlimit")+" times"); | |
| mes " "; | |
| mes "Is that correct?"; | |
| if(select("- Yes:- No") - 1) break; | |
| next; | |
| mes .n$; | |
| /* | |
| debugmes "Repeat Counter: "+getd("FameRepeat_"+.@id+"_"+@t); | |
| debugmes "Repeat Limit: "+getd("$f_quest_"+.@id+"_"+@t+"_rlimit"); | |
| debugmes "Repeat Timer: "+getd("FameRepeat_"+.@id+"_"+@t+"_Timer"); | |
| debugmes "Current Tick: "+ gettimetick(2); | |
| */ | |
| if(getd("FameRepeat_"+.@id+"_"+@t) >= getd("$f_quest_"+.@id+"_"+@t+"_rlimit")) { | |
| if(getd("FameRepeat_"+.@id+"_"+@t+"_Timer") <= gettimetick(2)) { | |
| setd("FameRepeat_"+.@id+"_"+@t+"_Timer"),0; | |
| setd("FameRepeat_"+.@id+"_"+@t),0; | |
| } else { | |
| mes "I'm sorry, but you can't do this quest for while."; | |
| break; | |
| } | |
| } | |
| if(.level && (BaseLevel < getd("$f_quest_"+.@id+"_"+@t+"_level")) ) { | |
| mes "I'm sorry, but you don't meet the level requirement."; | |
| break; | |
| } | |
| set FameQuest,.@id; | |
| mes "Good Luck."; | |
| break; | |
| } | |
| } else { | |
| mes "I'm sorry, but you can't do any Fame Quest for the time being."; | |
| set .@sec,FameDelay-gettimetick(2); // Base Delay in seconds | |
| mes "Please come back in "+.@sec+" seconds"+ ( (.@sec/60 > 0)?", which are "+.@sec/60+" Minutes":"") + ( (.@sec/3600 > 0)?", which are "+.@sec/3600+" Hour(s)":"") + ( (.@sec/86400 > 0)?", which are "+.@sec/86400+" Day(s)":""); | |
| break; | |
| } | |
| break; | |
| case 2: | |
| mes .n$; | |
| set @t,0; | |
| for ( set .@l,0; .@l < getarraysize(.classes); set .@l,.@l + 1) | |
| if(BaseClass == .classes[.@l]) | |
| set @t,BaseClass; | |
| if(getarraysize(getd("$f_shop_"+@t+"_id")) < 1) { | |
| mes "I'm sorry, but there are no items yet."; | |
| mes "Please come back later."; | |
| close; | |
| } | |
| mes "You have "+ FamePoints+" Fame Points"; | |
| mes "Notice: Discount Skill won't work at me, you'll have to pay the full price."; | |
| close2; | |
| npcshopitem "Fame Shop",512,10; | |
| npcshopdelitem "Fame Shop",512; | |
| for ( set .@s,0; .@s < getarraysize(getd("$f_shop_"+@t+"_id")); set .@s,.@s + 1) | |
| npcshopadditem "Fame Shop",getd("$f_shop_"+@t+"_id["+.@s+"]"),getd("$f_shop_"+@t+"_cost["+.@s+"]"); | |
| npcshopattach "Fame Shop"; | |
| callshop "Fame Shop",1; | |
| end; | |
| case 3: | |
| mes .n$; | |
| if(!.fame_sql) { | |
| mes "I'm sorry, but the Ranking Feature isn't enabled."; | |
| close; | |
| } | |
| for ( set .@c,0; .@c < getarraysize(.classes); set .@c,.@c + 1) { | |
| mes "[ Ranks - Class Row: "+jobname(.classes[.@c])+" ]"; | |
| query_sql "SELECT `char_name` , `fame` FROM `fame_rank` WHERE `class` = '"+.classes[.@c]+"' ORDER BY `fame` DESC LIMIT "+.rank_limit,.@c_name$,.@fame; | |
| if(.@c_name$[0] == "") { | |
| mes "There is no player ranked yet."; | |
| if(.@c != getarraysize(.classes)) | |
| mes "==================="; | |
| continue; | |
| } | |
| for ( set .@r,0; .@r < getarraysize(.@c_name$); set .@r,.@r + 1) | |
| mes (.@r+1)+". "+.@c_name$[.@r]+" - "+.@fame[.@r]; | |
| deletearray .@c_name$[0],.array; | |
| deletearray .@fame[0],.array; | |
| if(.@c != getarraysize(.classes)) | |
| mes "==================="; | |
| } | |
| break; | |
| } | |
| end; | |
| OnBuyItem: | |
| for ( set .@b,0; .@b < getarraysize(@bought_nameid); set .@b,.@b + 1) { | |
| for ( set .@l,0; .@l < getarraysize(getd("$f_shop_"+@t+"_id")); set .@l,.@l + 1) { | |
| if(@bought_nameid[.@b] == getd("$f_shop_"+@t+"_id["+.@l+"]")) { | |
| if(checkweight(getd("$f_shop_"+@t+"_id["+.@l+"]"),@bought_quantity[.@b]) == 1) { | |
| set @cost,getd("$f_shop_"+@t+"_cost["+.@l+"]")*@bought_quantity[.@b]; | |
| set @total,@total+@cost; | |
| } else { | |
| dispbottom "Fame Shop: You would be overweight, please remove some items or buy less."; | |
| set @cost,0; | |
| set @total,0; | |
| deletearray @bought_nameid[0],.array; | |
| deletearray @bought_quantity[0],.array; | |
| end; | |
| } | |
| } | |
| } | |
| } | |
| if(@total > FamePoints) { | |
| dispbottom strnpcinfo(1)+": You don't have the required Fame Points"; | |
| dispbottom strnpcinfo(1)+": You need "+@total+" Fame Points."; | |
| set @cost,0; | |
| set @total,0; | |
| deletearray @bought_nameid[0],.array; | |
| deletearray @bought_quantity[0],.array; | |
| end; | |
| } | |
| set FamePoints,FamePoints - @total; | |
| for ( set .@s,0; .@s < getarraysize(@bought_nameid); set .@s,.@s + 1) | |
| getitem @bought_nameid[.@s],@bought_quantity[.@s]; | |
| set @cost,0; | |
| set @total,0; | |
| deletearray @bought_nameid[0],.array; | |
| deletearray @bought_quantity[0],.array; | |
| end; | |
| OnAtcommand: | |
| set @t,0; | |
| for ( set .@l,0; .@l < getarraysize(.classes); set .@l,.@l + 1) | |
| if(BaseClass == .classes[.@l]) | |
| set @t,BaseClass; | |
| if(!FameQuest || !@t) end; | |
| dispbottom FAME_FUNC(0,@t,FameQuest); | |
| end; | |
| OnNPCKillEvent: | |
| if(!FameQuest) end; | |
| // Player is in a party | |
| if(getcharid(1) != 0) { | |
| getpartymember(getcharid(1),1); | |
| getpartymember(getcharid(1),2); | |
| for ( set .@p,0; .@p < $@partymembercount; set .@p,.@p + 1) { | |
| if(isloggedin($@partymemberaid[.@p],$@partymembercid[.@p]) == 0) continue; | |
| attachrid($@partymemberaid[.@p]); | |
| callsub OnFameMobKill; | |
| } | |
| end; | |
| } | |
| OnFameMobKill: | |
| if(!FameQuest || getd("$f_quest_"+FameQuest+"_"+BaseClass+"_type") != 1) | |
| if(getcharid(1) != 0) return; else end; | |
| for ( set .@m,0; .@m < getarraysize(getd("$f_quest_"+FameQuest+"_"+BaseClass+"_mid")); set .@m,.@m + 1) | |
| if( killedrid == getd("$f_quest_"+FameQuest+"_"+BaseClass+"_mid["+.@m+"]") ) { | |
| if(getd(killedrid+"_Kill") < getd("$f_quest_"+FameQuest+"_"+BaseClass+"_mam["+.@m+"]")) | |
| setd(killedrid+"_Kill"),getd(killedrid+"_Kill") + 1; | |
| else | |
| set .@i,.@i + 1; | |
| if(.@i == getarraysize(getd("$f_quest_"+FameQuest+"_"+BaseClass+"_mid"))) | |
| end; | |
| break; | |
| } | |
| dispbottom FAME_FUNC(0,BaseClass,FameQuest); | |
| if(getcharid(1) != 0) return; else end; | |
| OnWhisperGlobal: | |
| if(getgmlevel() >= .gm && @whispervar0$ == "OnInit") goto OnInit; | |
| if(FameQuest == 0) { | |
| dispbottom .n$+": I'm sorry, but you haven't accepted an quest yet, therefore you can't see your progress."; | |
| end; | |
| } | |
| dispbottom .n$+": Here is your Progress:"; | |
| for ( set .@q,0; .@q < getarraysize(getd("$f_quest_"+FameQuest+"_"+@t+"_mid")); set .@q,.@q + 1) | |
| dispbottom strmobinfo(1,getd("$f_quest_"+FameQuest+"_"+@t+"_mid["+.@q+"]"))+": "+getd(getd("$f_quest_"+FameQuest+"_"+@t+"_mid["+.@q+"]")+"_Kill")+"/"+getd("$f_quest_"+FameQuest+"_"+@t+"_mam["+.@q+"]"); | |
| end; | |
| GM_Panel: | |
| mes "What do you like to do?"; | |
| next; | |
| switch(select("- Quest Management:- Shop Management:- Get BaseClass Value:- Reset Fame Quest Delay:- Nothing")) { | |
| case 1: | |
| mes .n$; | |
| mes "This is the current quest quantity in each Job Row:"; | |
| for( set .@j,0; .@j < getarraysize(.classes); set .@j,.@j + 1) { | |
| mes jobname(.classes[.@j])+": "+getarraysize(getd("$f_quest_id_"+.classes[.@j])); | |
| set .@tot,.@tot + getarraysize(getd("$f_quest_id_"+.classes[.@j])); | |
| } | |
| mes " "; | |
| mes "Total: " + .@tot; | |
| mes "What do you want to do?"; | |
| mes "But first choose in the Job Row:"; | |
| for ( set .@j,0; .@j < getarraysize(.classes); set .@j,.@j + 1) | |
| set .@j_menu$,.@j_menu$ + "- "+jobname(.classes[.@j]) + ( (.classes[.@j+1] != 0)?":":""); | |
| set @t,select(.@j_menu$) - 1; | |
| next; | |
| switch(select("- Quest Overview:- Add Quests:- Delete Quests:- Reset Quest Counter:- Reset Repeat Limit&Timer")) { | |
| case 1: | |
| mes .n$; | |
| if(getarraysize(getd("$f_quest_id_"+.classes[@t])) < 1) { | |
| mes "There are no quests yet."; | |
| mes "Please add one first."; | |
| close; | |
| } | |
| for ( set .@m,0; .@m < getarraysize(getd("$f_quest_id_"+.classes[@t])); set .@m,.@m + 1) { | |
| mes "Quest ID: "+getd("$f_quest_id_"+.classes[@t]+"["+.@m+"]"); | |
| set .@q_id,getd("$f_quest_id_"+.classes[@t]+"["+.@m+"]"); | |
| mes "----------------"; | |
| set .@t,getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_type"); | |
| mes "Type: "+ ( (.@t == 1)?"Monster Hunting":"Item Collecting"); | |
| if(.@t == 1) mes "Required Level: "+getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_level"); | |
| mes "Target: "+ ( (.@t == 1)?getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_mam[0]")+"x "+strmobinfo(1,getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_mid[0]")):getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_iam[0]")+"x "+getitemname(getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_iid[0]")) ); | |
| for ( set .@l,1; .@l < getarraysize( getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_"+( (.@t == 1)?"m":"i")+"id") ); set .@l,.@l + 1) | |
| mes " "+ ( (.@t == 1)?getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_mam["+.@l+"]")+"x "+strmobinfo(1,getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_mid["+.@l+"]")):getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_iam["+.@l+"]")+"x "+getitemname(getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_iid["+.@l+"]")) ); | |
| mes "Repeat Limit: "+getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_rlimit"); | |
| mes "================="; | |
| } | |
| break; | |
| case 2: | |
| mes .n$; | |
| if(getarraysize(getd("$f_quest_id_"+.classes[@t])) >= .array) { | |
| mes "I'm sorry, but you can't add any more quests thus the limit is "+.array+"."; | |
| close; | |
| } | |
| set .@que_id,getd("$f_quest_id_"+.classes[@t]+"_last") + 1; | |
| mes "Please choose what type of quest it will be:"; | |
| next; | |
| set .@type,select("- Monster Hunting:- Item Collecting"); | |
| set .@count,0; | |
| mes .n$; | |
| mes "Now decide the limit how often the quest can be done per day:"; | |
| mes "0 - Unlimited, Maximum: "+.f_repeat; | |
| input .@f_rep; | |
| if(.@f_rep > .f_repeat) { | |
| next; | |
| mes .n$; | |
| mes "Invalid Amount, please try again."; | |
| close; | |
| } | |
| next; | |
| mes .n$; | |
| mes "Repeat Limit: "+( (.@f_rep == 0)?"Unlimited":.@f_rep+" times"); | |
| mes "Is that correct?"; | |
| if(select("- Yes:- No") - 1) close; | |
| next; | |
| mes .n$; | |
| // Monster Hunting | |
| if(.@type == 1) { | |
| mes "How many mobs should be hunted?"; | |
| mes "^FF0000Note: Maximum "+.mob_ct+"^000000"; | |
| if(input(.@ct,1,.mob_ct) != 0) { | |
| next; | |
| mes .n$; | |
| mes "Invalid Amount, please try again."; | |
| close; | |
| } | |
| if(.level) { | |
| next; | |
| mes .n$; | |
| mes "Now please choose the level requirement:"; | |
| mes "^FF0000Note: '0' is invalid!^000000"; | |
| mes "^FF0000Note: You can't go over the maximum level of "+.level+"!^000000"; | |
| if(input(.@lvl,1,.level) != 0) { | |
| next; | |
| mes .n$; | |
| mes "Invalid Level, please try again."; | |
| close; | |
| } | |
| } | |
| while(.@count != .@ct) { | |
| next; | |
| mes .n$; | |
| mes "Please type the Mob ID for #"+(.@count+1)+",which should be hunted:"; | |
| next; | |
| input .@mobid; | |
| mes .n$; | |
| if(strmobinfo(1,.@mobid) == "null" || strmobinfo(1,.@mobid) == "") { | |
| mes "Mob not found, please be sure that you have typed the ID correctly and try again."; | |
| continue; | |
| } | |
| mes "Monster: "+strmobinfo(1,.@mobid); | |
| mes "Now type the amount to hunt:"; | |
| mes "Minimum: "+.mob_min+", Maximum: "+.mob_max; | |
| next; | |
| if(input(.@mobam,.mob_min,.mob_max) != 0) { | |
| mes .n$; | |
| mes "Invalid Amount, please try again."; | |
| continue; | |
| } | |
| setarray getd("$f_quest_"+.@que_id+"_"+.classes[@t]+"_mid["+getarraysize(getd("$f_quest_"+.@que_id+"_"+.classes[@t]+"_mid"))+"]"),.@mobid; | |
| setarray getd("$f_quest_"+.@que_id+"_"+.classes[@t]+"_mam["+getarraysize(getd("$f_quest_"+.@que_id+"_"+.classes[@t]+"_mam"))+"]"),.@mobam; | |
| set .@count,.@count + 1; | |
| } | |
| if(.level) setd("$f_quest_"+.@que_id+"_"+.classes[@t]+"_level"),.@lvl; | |
| // Item Collecting | |
| } else if(.@type == 2) { | |
| mes "How many items do you want to add?"; | |
| mes "^FF0000Note: Maximum "+.item_ct+"^000000"; | |
| if(input(.@ct,1,.item_ct) != 0) { | |
| next; | |
| mes .n$; | |
| mes "Invalid Amount, please try again."; | |
| close; | |
| } | |
| while(.@count != .@ct) { | |
| next; | |
| mes .n$; | |
| mes "Type the Item ID for #"+(.@count+1)+":"; | |
| next; | |
| input .@itemid; | |
| mes .n$; | |
| if(getitemname(.@itemid) == "null" || getitemname(.@itemid) == "") { | |
| mes "The ID "+.@itemid+" doesn't exist. Please try again."; | |
| continue; | |
| } | |
| mes "Type the amount to collect next:"; | |
| mes "^FF0000Note: Minimum: "+.item_min+", Maximum: "+.item_max+"^000000"; | |
| next; | |
| if(input(.@itemam,.item_min,.item_max) != 0) { | |
| mes .n$; | |
| mes "Invalid Amount, please try again."; | |
| continue; | |
| } | |
| setarray getd("$f_quest_"+.@que_id+"_"+.classes[@t]+"_iid["+getarraysize(getd("$f_quest_"+.@que_id+"_"+.classes[@t]+"_iid"))+"]"),.@itemid; | |
| setarray getd("$f_quest_"+.@que_id+"_"+.classes[@t]+"_iam["+getarraysize(getd("$f_quest_"+.@que_id+"_"+.classes[@t]+"_iam"))+"]"),.@itemam; | |
| set .@count,.@count + 1; | |
| } | |
| } | |
| next; | |
| mes .n$; | |
| mes "The Quest ID#"+.@que_id+" has been added successfully."; | |
| setd("$f_quest_"+.@que_id+"_"+.classes[@t]+"_type"),.@type; | |
| setd("$f_quest_"+.@que_id+"_"+.classes[@t]+"_ct"),.@ct; | |
| setd("$f_quest_"+.@que_id+"_"+.classes[@t]+"_rlimit"),.@f_rep; | |
| setarray getd("$f_quest_id_"+.classes[@t]+"["+getarraysize(getd("$f_quest_id_"+.classes[@t]))+"]"),.@que_id; | |
| setd("$f_quest_id_"+.classes[@t]+"_last"),getd("$f_quest_id_"+.classes[@t]+"_last") + 1; | |
| break; | |
| case 3: | |
| mes .n$; | |
| if(getarraysize(getd("$f_quest_id_"+.classes[@t])) < 1) { | |
| mes "I'm sorry, but this class row doesn't have any quests, which can be deleted."; | |
| mes "Please create one first."; | |
| close; | |
| } | |
| mes "Now choose which quest you want to delete:"; | |
| mes " "; | |
| for ( set .@m,0; .@m < getarraysize(getd("$f_quest_id_"+.classes[@t])); set .@m,.@m + 1) { | |
| mes "Quest ID: "+getd("$f_quest_id_"+.classes[@t]+"["+.@m+"]"); | |
| set .@q_id,getd("$f_quest_id_"+.classes[@t]+"["+.@m+"]"); | |
| mes "----------------"; | |
| set .@t,getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_type"); | |
| mes "Type: "+ ( (.@t == 1)?"Monster Hunting":"Item Collecting"); | |
| if(.@t == 1) mes "Required Level: "+getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_level"); | |
| mes "Target: "+ ( (.@t == 1)?getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_mam[0]")+"x "+strmobinfo(1,getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_mid[0]")):getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_iam[0]")+"x "+getitemname(getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_iid[0]")) ); | |
| for ( set .@l,1; .@l < getarraysize( getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_"+( (.@t == 1)?"m":"i")+"id") ); set .@l,.@l + 1) | |
| mes " "+ ( (.@t == 1)?getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_mam["+.@l+"]")+"x "+strmobinfo(1,getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_mid["+.@l+"]")):getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_iam["+.@l+"]")+"x "+getitemname(getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_iid["+.@l+"]")) ); | |
| mes "Repeat Limit: "+getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_rlimit"); | |
| mes "================="; | |
| set .@fm_del$,.@fm_del$ + "- Quest ID#"+getd("$f_quest_id_"+.classes[@t]+"["+.@m+"]")+ ( (getd("$f_quest_id_"+.classes[@t]+"["+(.@m+1)+"]") == 0)?"":":"); | |
| } | |
| next; | |
| set .@del,select(.@fm_del$) - 1; | |
| mes .n$; | |
| mes "You have chosen Quest ID #"+set(.@q_del,getd("$f_quest_id_"+.classes[@t]+"["+.@del+"]") ); | |
| mes "Is that correct?"; | |
| next; | |
| if(select("- Yes:- No") - 1) close; | |
| mes .n$; | |
| mes "The Quest ID#"+.@q_del+" has been deleted successfully."; | |
| if(getd("$f_quest_"+.@q_del+"_"+.classes[@t]+"_type") == 1) { | |
| deletearray getd("$f_quest_"+.@q_del+"_"+.classes[@t]+"_mid[0]"),.array; | |
| deletearray getd("$f_quest_"+.@q_del+"_"+.classes[@t]+"_mam[0]"),.array; | |
| } else { | |
| deletearray getd("$f_quest_"+.@q_del+"_"+.classes[@t]+"_iid[0]"),.array; | |
| deletearray getd("$f_quest_"+.@q_del+"_"+.classes[@t]+"_iam[0]"),.array; | |
| } | |
| deletearray getd("$f_quest_id_"+.classes[@t]+"["+.@del+"]"),1; | |
| setd("$f_quest_"+.@q_del+"_"+.classes[@t]+"_type"),0; | |
| setd("$f_quest_"+.@q_del+"_"+.classes[@t]+"_rlimit"),0; | |
| break; | |
| case 4: | |
| mes .n$; | |
| mes "Are you sure?"; | |
| if(select("- Yes:- No") - 1) close; | |
| next; | |
| mes .n$; | |
| mes "Quest Counter Reseted."; | |
| setd("$f_quest_id_"+.classes[@t]+"_last"),0; | |
| break; | |
| case 5: | |
| mes .n$; | |
| if(getarraysize(getd("$f_quest_id_"+.classes[@t])) < 1) { | |
| mes "I'm sorry, but this class row doesn't have any quests, where the Repeat Limit and Repeat Timer can be reseted."; | |
| mes "Please create one first."; | |
| close; | |
| } | |
| mes "Now choose which quest you want to reset the Repeat Limit and Repeat Timer:"; | |
| mes "Note: This only resets your own Limit and Timer, NOT of other players!"; | |
| mes " "; | |
| for ( set .@m,0; .@m < getarraysize(getd("$f_quest_id_"+.classes[@t])); set .@m,.@m + 1) { | |
| mes "Quest ID: "+getd("$f_quest_id_"+.classes[@t]+"["+.@m+"]"); | |
| set .@q_id,getd("$f_quest_id_"+.classes[@t]+"["+.@m+"]"); | |
| mes "----------------"; | |
| set .@t,getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_type"); | |
| mes "Type: "+ ( (.@t == 1)?"Monster Hunting":"Item Collecting"); | |
| if(.@t == 1) mes "Required Level: "+getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_level"); | |
| mes "Target: "+ ( (.@t == 1)?getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_mam[0]")+"x "+strmobinfo(1,getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_mid[0]")):getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_iam[0]")+"x "+getitemname(getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_iid[0]")) ); | |
| for ( set .@l,1; .@l < getarraysize( getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_"+( (.@t == 1)?"m":"i")+"id") ); set .@l,.@l + 1) | |
| mes " "+ ( (.@t == 1)?getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_mam["+.@l+"]")+"x "+strmobinfo(1,getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_mid["+.@l+"]")):getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_iam["+.@l+"]")+"x "+getitemname(getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_iid["+.@l+"]")) ); | |
| mes "Repeat Limit: "+getd("$f_quest_"+.@q_id+"_"+.classes[@t]+"_rlimit"); | |
| mes "================="; | |
| set .@fm_rreset$,.@fm_rreset$ + "- Quest ID#"+getd("$f_quest_id_"+.classes[@t]+"["+.@m+"]")+ ( (getd("$f_quest_id_"+.classes[@t]+"["+(.@m+1)+"]") == 0)?"":":"); | |
| } | |
| next; | |
| set .@del,select(.@fm_rreset$) - 1; | |
| mes .n$; | |
| mes "You have chosen Quest ID #"+set(.@qr_reset,getd("$f_quest_id_"+.classes[@t]+"["+.@del+"]") ); | |
| mes "Is that correct?"; | |
| next; | |
| if(select("- Yes:- No") - 1) close; | |
| mes .n$; | |
| mes "The Repeat Limit and Repeat Timer of Quest ID#"+.@qr_reset+" has been reseted successfully."; | |
| setd("FameRepeat_"+.@qr_reset+"_"+.classes[@t]),0; | |
| setd("FameRepeat_"+.@qr_reset+"_"+.classes[@t]+"_Timer"),0; | |
| break; | |
| } | |
| break; | |
| // Shop Management | |
| case 2: | |
| mes .n$; | |
| mes "Which Fame Shop you want to manage?"; | |
| next; | |
| for ( set .@j,0; .@j < getarraysize(.classes); set .@j,.@j + 1) | |
| set .@j_menu$,.@j_menu$ + "- "+jobname(.classes[.@j]) + ( (.classes[.@j+1] != 0)?":":""); | |
| set .@t,select(.@j_menu$) - 1; | |
| mes .n$; | |
| mes "What do you like to do?"; | |
| while(1) { | |
| next; | |
| switch(select("- Shop Overview:- Add Items:- Edit Items:- Delete Items:- Nothing")) { | |
| case 1: | |
| mes .n$; | |
| if(getarraysize(getd("$f_shop_"+.classes[.@t]+"_id")) < 1) | |
| mes "There is no item in the Shop yet."; | |
| else { | |
| mes "There are currently the following "+getarraysize(getd("$f_shop_"+.classes[.@t]+"_id"))+" Items in the Shop:"; | |
| mes "============================"; | |
| for ( set .@i,0; .@i < getarraysize(getd("$f_shop_"+.classes[.@t]+"_id")); set .@i,.@i + 1) { | |
| mes getitemname(getd("$f_shop_"+.classes[.@t]+"_id["+.@i+"]"))+" (ID: "+getd("$f_shop_"+.classes[.@t]+"_id["+.@i+"]")+")"; | |
| mes "Price: "+getd("$f_shop_"+.classes[.@t]+"_cost["+.@i+"]")+" Fame Points"; | |
| mes ( (getd("$f_shop_"+.classes[.@t]+"_id["+(.@i+1)+"]") != 0)?"---------------------------------":"============================"); | |
| } | |
| } | |
| continue; | |
| case 2: | |
| mes .n$; | |
| if(getarraysize(getd("$f_shop_"+.classes[.@t]+"_id")) >= .array) { | |
| mes "The Shop is full, please remove an item first."; | |
| continue; | |
| } | |
| mes "Please type the Item ID you want to add:"; | |
| mes "Maximum is "+.array+" Items."; | |
| next; | |
| if(input(@item,501,.last_id) != 0) { | |
| mes .n$; | |
| mes "The id you have put is either too low or too high."; | |
| continue; | |
| } | |
| if(getitemname(@item) == "null" || getitemname(@item) == "") { | |
| mes .n$; | |
| mes "The item you requested doesn't exist."; | |
| continue; | |
| } | |
| mes .n$; | |
| mes "Chosen Item: "+getitemname(@item); | |
| mes " "; | |
| mes "Now input the price it should have."; | |
| mes "Maximum is "+.m_price; | |
| next; | |
| if(input(@price,1,.m_price) != 0) { | |
| mes .n$; | |
| mes "You have put an invalid price."; | |
| mes "Maximum is "+.m_price; | |
| continue; | |
| } | |
| mes .n$; | |
| mes "Price: "+@price+" Fame Points"; | |
| mes "Is that correct?"; | |
| if(select("- Yes:- No") - 1) continue; | |
| FAME_FUNC(1,.classes[.@t],1,0,@item,@price); | |
| continue; | |
| break; | |
| case 3: | |
| mes .n$; | |
| if(getarraysize(getd("$f_shop_"+.classes[.@t]+"_id")) < 1) { | |
| mes "There is no Item to edit."; | |
| mes "Please add one first :D."; | |
| continue; | |
| } | |
| mes "Please choose the item you want to edit:"; | |
| mes "Format: Name (Current Price)"; | |
| next; | |
| set @ed_list$,""; | |
| for ( set .@e,0; .@e < getarraysize(getd("$f_shop_"+.classes[.@t]+"_id")); set .@e,.@e + 1) | |
| set @ed_list$,@ed_list$ + "- "+getitemname(getd("$f_shop_"+.classes[.@t]+"_id["+.@e+"]"))+" ("+getd("$f_shop_"+.classes[.@t]+"_cost["+.@e+"]")+")" + ( ( getd("$f_shop_"+.classes[.@t]+"_id["+(.@e+1)+"]") )?":":""); | |
| set @ed,select(@ed_list$) - 1; | |
| mes .n$; | |
| mes "Chosen Item: "+ getitemname(getd("$f_shop_"+.classes[.@t]+"_id["+@ed+"]")); | |
| mes "Item ID: "+getd("$f_shop_"+.classes[.@t]+"_id["+@ed+"]"); | |
| mes "Price: "+ getd("$f_shop_"+.classes[.@t]+"_cost["+@ed+"]")+" Fame Points"; | |
| mes "Correct?"; | |
| if(select("- Yes:- No") - 1) continue; | |
| next; | |
| mes .n$; | |
| mes "What do you want to edit?"; | |
| next; | |
| if(select("- Item ID:- Price") - 1) { | |
| mes .n$; | |
| mes "Input the new price:"; | |
| next; | |
| if(input(@price,1,.m_price) != 0) { | |
| mes .n$; | |
| mes "You have put an invalid price."; | |
| mes "Maximum is "+.m_price; | |
| continue; | |
| } | |
| mes .n$; | |
| mes "Chosen Price: "+@price+" Fame Points"; | |
| mes "Correct?"; | |
| if(select("- Yes:- No") - 1) continue; | |
| FAME_FUNC(1,.classes[.@t],3,@ed,getd("$f_shop_"+.classes[.@t]+"_id["+@ed+"]"),@price); | |
| } else { | |
| mes .n$; | |
| mes "Input the new item id:"; | |
| next; | |
| if(input(@item,501,.last_id) != 0) { | |
| mes .n$; | |
| mes "The id you have put is either too low or too high."; | |
| continue; | |
| } | |
| if(getitemname(@item) == "null" || getitemname(@item) == "") { | |
| mes .n$; | |
| mes "The item you requested doesn't exist."; | |
| continue; | |
| } | |
| mes .n$; | |
| mes "Chosen Item: "+getitemname(@item); | |
| mes "Correct?"; | |
| if(select("- Yes:- No") - 1) continue; | |
| FAME_FUNC(1,.classes[.@t],3,@ed,@item,getd("$f_shop_"+.classes[.@t]+"_cost["+@ed+"]")); | |
| } | |
| continue; | |
| break; | |
| case 4: | |
| mes .n$; | |
| if(getarraysize(getd("$f_shop_"+.classes[.@t]+"_id")) < 1) { | |
| mes "There is no Item to remove."; | |
| mes "Please add one first :D."; | |
| continue; | |
| } | |
| mes "Please choose the item you want to remove:"; | |
| mes "Format: Name (Current Price)"; | |
| next; | |
| set @r_list$,""; | |
| for ( set .@e,0; .@e < getarraysize(getd("$f_shop_"+.classes[.@t]+"_id")); set .@e,.@e + 1) | |
| set @r_list$,@r_list$ + "- "+getitemname(getd("$f_shop_"+.classes[.@t]+"_id["+.@e+"]"))+" ("+getd("$f_shop_"+.classes[.@t]+"_cost["+.@e+"]")+")" + ( (getd("$f_shop_"+.classes[.@t]+"_id["+(.@e+1)+"]"))?":":""); | |
| set @re,select(@r_list$) - 1; | |
| mes .n$; | |
| mes "Chosen Item: "+ getitemname(getd("$f_shop_"+.classes[.@t]+"_id["+@re+"]")); | |
| mes "Price: "+ getd("$f_shop_"+.classes[.@t]+"_cost["+@re+"]")+" Fame Points"; | |
| mes "Correct?"; | |
| if(select("- Yes:- No") - 1) continue; | |
| FAME_FUNC(1,.classes[.@t],2,@ed); | |
| continue; | |
| break; | |
| case 5: | |
| break; | |
| } | |
| break; | |
| } | |
| break; | |
| case 3: | |
| mes .n$; | |
| mes "Class Value: "+Class+", Job Name: "+jobname(Class)+", BaseJob: "+BaseJob+", BaseClass: "+BaseClass; | |
| break; | |
| case 4: | |
| mes .n$; | |
| mes "Fame Quest Delay reseted."; | |
| set FameDelay,0; | |
| break; | |
| case 5: | |
| break; | |
| } | |
| close; | |
| OnInit: | |
| // NPC Name, recieved automatically from the NPC Header | |
| set .n$,"["+strnpcinfo(1)+"]"; | |
| // GM Access Level for GM Panel | |
| set .gm,80; | |
| // Server Array Limit | |
| // > rAthena since commit 6295c77 (Script Engine Upgrade): | |
| // = 2000000000000 (2 Billion) | |
| // > Others/Default: 128 | |
| set .array,128; | |
| // SQL Ranking: | |
| // Want SQL Ranking? Then install the "fame_rank" table, | |
| // it will be activated automatically | |
| if(query_sql("SHOW TABLES LIKE 'fame_rank'",.@fame_tb$) != 0) { | |
| set .fame_sql,1; | |
| set .rank_limit,10; // Top x Questers | |
| } | |
| // Allowed Classed | |
| // Put in the array your BaseJob Values | |
| // BaseJob: ex.: Lord Knight = Job_Swordsman > 1 | |
| setarray .classes[0],1,2,3,4,5,6,24,25; | |
| // Minimum and Maximum Mob Amount | |
| set .mob_min,1; | |
| set .mob_max,100; | |
| // Maximum Mobs you can hunt at the same time | |
| set .mob_ct,3; | |
| // Level Restriction | |
| set .level,MAX_LEVEL; // 0 = Off / MAX_LEVEL - Server Max Level (src/map/map.h) | |
| // Minimum and Maximum Item Amount | |
| set .item_min,1; | |
| set .item_max,200; | |
| // Maximum Items you can collect at the same time | |
| set .item_ct,5; | |
| // Maximum Repeat Limit per .f_repeat_timer | |
| set .f_repeat,100; | |
| // Repeat Timer in seconds | |
| // = The player can't do the same quest again, | |
| // until the Limit has been reseted, which happens only when the Timer reaches 0. | |
| set .f_repeat_timer,86400; // Default: 86400 = 1 Day | |
| // Maximum Fame | |
| set .m_fame,10000; | |
| // Random Fame Values | |
| set .min_f,10; | |
| set .max_f,100; | |
| // Global Quest Delay (Duration in seconds) | |
| // = While this is active, the player can't do any quests | |
| set .time,300; // Default: 300 = 5 Minutes | |
| // Shop Settings | |
| // Last Item ID in the Database | |
| set .last_id,25000; | |
| // Maximum Price, should be not more than .m_fame, else an Item would be unbuyable. | |
| set .m_price,.m_fame; | |
| // Custom atcommand: @famequest | |
| bindatcmd "famequest",strnpcinfo(0)+"::OnAtcommand"; | |
| end; | |
| function FAME_FUNC { | |
| // getarg(0) - Identifier | |
| // 0 = Quest | |
| // 1 = Shop | |
| // | |
| // getarg(1) - Class Type | |
| // | |
| // ======= Quest ========= | |
| // getarg(2) - Quest ID (FameQuest variable) | |
| // -------------------------------- | |
| if(getarg(0) == 0) { | |
| if(getarg(2) != 0) { // The player has accepted an quest | |
| for ( set .@i,0; .@i < getarraysize(getd("$f_quest_id_"+getarg(1))); set .@i,.@i + 1) | |
| if(getd("$f_quest_id_"+getarg(1)+"["+.@i+"]") == getarg(2)) break; | |
| // Getting Type of Quest | |
| set .@c_que_t,getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_type"); | |
| // Getting Amount per Mob/Item | |
| set .@c_q_ct,getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_ct"); | |
| // Monster Hunting | |
| if(.@c_que_t == 1) { | |
| // Monster Quanity = 1? | |
| if(.@c_q_ct == 1) { | |
| // Killed enough Mobs? | |
| if(getd(getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_mid[0]")+"_Kill") < getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_mam[0]")) | |
| // Displaying progress | |
| return strmobinfo(1,getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_mid[0]"))+"(ID: "+getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_mid[0]")+": "+getd(getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_mid[0]")+"_Kill")+"/"+getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_mam[0]"); | |
| // If Monster to kill is over 1 | |
| } else { | |
| // Looping through the monster array | |
| for ( set .@m,0; .@m < .@c_q_ct; set .@m,.@m + 1) { | |
| // Checking if the required amount of the mob chosen is enough | |
| if(getd(getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_mid["+.@m+"]")+"_Kill") >= getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_mam["+.@m+"]")) | |
| // Increasing counter | |
| set .@c,.@c + 1; | |
| // Displaying detailed Progress | |
| dispbottom strmobinfo(1,getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_mid["+.@m+"]"))+"(ID: "+getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_mid["+.@m+"]")+"): "+getd(getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_mid["+.@m+"]")+"_Kill")+"/"+getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_mam["+.@m+"]"); | |
| } | |
| // After looping, checking if the counter value is the same as the arraysize of the monster quantity array, if not: | |
| if(.@c != .@c_q_ct) | |
| return "You didn't defeat all required mobs yet."; | |
| else | |
| // Displaying Quest completed. | |
| dispbottom "You have defeated all required Mobs, thanks for your hard work."; | |
| } | |
| // Item Collecting | |
| } else { | |
| // Item Quanity = 1? | |
| if(.@c_q_ct == 1) { | |
| // Collected enough Items? | |
| if(countitem(getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_iid[0]")) < getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_iam[0]")) | |
| // Displaying progress | |
| return getitemname(getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_iid[0]"))+" (ID:"+getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_iid[0]")+": "+countitem(getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_iid[0]"))+"/"+getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_iam[0]"); | |
| // If Items to collect is over 1 | |
| } else if(.@c_q_ct > 1) { | |
| // Looping through the item array | |
| for ( set .@m,0; .@m < .@c_q_ct; set .@m,.@m + 1) { | |
| // Checking if the required amount of the items chosen is enough | |
| if(countitem(getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_iid["+.@m+"]")) >= getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_iam["+.@m+"]")) | |
| // Increasing counter | |
| set .@c,.@c + 1; | |
| // Displaying detailed Progress | |
| dispbottom getitemname(getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_iid["+.@m+"]"))+" (ID:"+getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_iid["+.@m+"]")+"): "+countitem(getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_iid["+.@m+"]"))+"/"+getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_iam["+.@m+"]"); | |
| } | |
| // After looping, checking if the counter value is the same as the counter variable of the item arrays, if not: | |
| if(.@c != .@c_q_ct) | |
| return "You didn't collect all required items."; | |
| else | |
| // Displaying Quest completed. | |
| dispbottom "You have collected all required Items, thanks for your hard work."; | |
| } | |
| } | |
| // Bug preventing | |
| if(.@c_que_t < 1) | |
| set .@c_que_t,getd("$f_quest_"+getarg(3)+"_"+getarg(2)+"_type"); | |
| // Monster Hunting | |
| if(.@c_que_t == 1) { | |
| // Looping through the monster array | |
| for ( set .@m,0; .@m < getarraysize(getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_mid")); set .@m,.@m + 1) | |
| // Reseting Monster Variables | |
| setd(getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_mid["+.@m+"]")+"_Kill"),0; | |
| // Item Collecting | |
| } else if(.@c_que_t == 2) { | |
| // Looping through the item array | |
| for ( set .@m,0; .@m < .@c_q_ct; set .@m,.@m + 1) | |
| // Deleting the Items | |
| delitem getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_iid["+.@m+"]"),getd("$f_quest_"+getarg(2)+"_"+getarg(1)+"_iam["+.@m+"]"); | |
| } else | |
| return "Bug appeared: .@c_que_t == 0, at Quest completing by removing items from the inventory/reseting mob variables."; | |
| // Reseting Quest Variables; Setting Delay, Repeat Limit and giving Fame Points | |
| set .@f_id,getarg(2); | |
| set FameQuest,0; | |
| set FameDelay,gettimetick(2)+.time; | |
| setd("FameRepeat_"+.@f_id+"_"+getarg(1)),getd("FameRepeat_"+.@f_id+"_"+getarg(1)) + 1; | |
| if(getd("FameRepeat_"+.@f_id+"_"+getarg(1)+"_Timer") == 0) | |
| setd("FameRepeat_"+.@f_id+"_"+getarg(1)+"_Timer"),gettimetick(2) + .f_repeat_timer; | |
| set .@f_gain,rand(.min_f,.max_f); | |
| set FamePoints,FamePoints + .@f_gain; | |
| if(.fame_sql) { | |
| if(query_sql("SELECT `class` FROM `fame_rank` WHERE `char_id` = '"+getcharid(0)+"'",.@class) == 0) | |
| query_sql "INSERT INTO `fame_rank` ( `char_id` , `char_name` , `class` , `fame` ) VALUES ( '"+getcharid(0)+"' , '"+escape_sql(strcharinfo(0))+"' , '"+BaseClass+"' , '"+.@f_gain+"')"; | |
| else | |
| query_sql "UPDATE `fame_rank` SET `fame` = `fame` + '"+.@f_gain+"' WHERE `char_id` = '"+getcharid(0)+"'"; | |
| } | |
| dispbottom .n$+": You have gained "+.@f_gain+" Fame Points."; | |
| return .n$+": Quest ID#"+.@f_id+" completed"; | |
| } | |
| // ======================= Shop ======================= // | |
| } else if(getarg(0) == 1) { | |
| // getarg(2): | |
| // * 1 - Add | |
| // * 2 - Remove | |
| // * 3 - Edit | |
| // getarg(3): Array Position for Edit & Remove | |
| // getarg(4): Item ID | |
| // getarg(5): Price | |
| // ==================================================== // | |
| // =========== Item Adding ============ // | |
| if(getarg(2) == 1) { | |
| npcshopadditem "Fame Shop",getarg(4),getarg(5); | |
| setarray getd("$f_shop_"+getarg(1)+"_id["+getarraysize(getd("$f_shop_"+getarg(1)+"_id"))+"]"),getarg(4); | |
| setarray getd("$f_shop_"+getarg(1)+"_cost["+getarraysize(getd("$f_shop_"+getarg(1)+"_cost"))+"]"),getarg(5); | |
| // =========== Item Removal ============ // | |
| } else if(getarg(2) == 2) { | |
| npcshopdelitem "Fame Shop",getd("$f_shop_"+getarg(1)+"_id["+getarg(3)+"]"); | |
| deletearray getd("$f_shop_"+getarg(1)+"_id["+getarg(3)+"]"),1; | |
| deletearray getd("$f_shop_"+getarg(1)+"_cost["+getarg(3)+"]"),1; | |
| // =========== Item Edit ============ // | |
| } else if(getarg(2) == 3) { | |
| setarray getd("$f_shop_"+getarg(1)+"_id["+getarg(3)+"]"),getarg(4); | |
| setarray getd("$f_shop_"+getarg(1)+"_cost["+getarg(3)+"]"),getarg(5); | |
| } | |
| return; | |
| } | |
| // End of Function | |
| } | |
| // End of Script | |
| } | |
| - pointshop Fame Shop -1,FamePoints,512:-1 |