summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/script_commands.txt67
-rw-r--r--src/map/script.c59
2 files changed, 121 insertions, 5 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index 826ce0568..54573dad9 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -4360,7 +4360,7 @@ character and put appropriate messages into their chat window. It will also give
the character fame points if a weapon reached +10 this way, even though these
will only take effect for blacksmith who will later forge a weapon.
-The official scripts seem to use the 'successrefitem' command as a function
+The official scripts seems to use the 'successrefitem' command as a function
instead: 'successrefitem(<number>)' but it returns nothing on the stack.
This is since jAthena, so probably nobody knows for sure why is it so.
@@ -4373,7 +4373,7 @@ invoking character. The item will be destroyed. This will also display a 'refine
failure' effect on the character and put appropriate messages into their chat
window.
-The official scripts seem to use the 'failedrefitem' command as a function
+The official scripts seems to use the 'failedrefitem' command as a function
instead: 'failedrefitem(<number>)' but it returns nothing on the stack. This is
since jAthena, so probably nobody knows for sure why is it so.
@@ -4381,12 +4381,12 @@ since jAthena, so probably nobody knows for sure why is it so.
*downrefitem <equipment slot>;
-This command will downgrade an item by -1 in the specified equipment slot of the
-invoking character. So the item will not be destroyed unlikely in failedrefitem.
+This command will downgrade an item by - 1 in the specified equipment slot of the
+invoking character. So the item will not be destroyed unlike in the failedrefitem script command.
This will also display a 'refine failure' effect on the character and put appropriate
messages into their chat window.
-The official scripts seem to use the 'downrefitem' command as a function
+The official scripts seems to use the 'downrefitem' command as a function
instead: 'downrefitem(<number>)' but it returns nothing on the stack. This is
since jAthena, so probably nobody knows for sure why is it so.
@@ -7138,6 +7138,63 @@ Both timeout values are in seconds.
---------------------------------------
+*instance_check_party <Party ID>{,<amount>{,<min>{,<max>}}};
+
+Checks the Players Party if it meets the above set requirements.
+
+While the Party ID of the invoking character has to be set, the Values amount, min
+and max are optional parameters and doesn't need to be set. You will find below an
+little List for an explenation of what those values are for.
+
+Values:
+Party ID : Party ID of the invoking character. [Required Parameter]
+amount : Amount of needed Partymembers for the Instance. [Optional Parameter]
+min : Minimum Level needed to join the Instance. [Optional Parameter]
+max : Maxium Level allowed to join the Instance. [Optional Parameter]
+
+If no Party ID is given the party of the currently attached player will be used.
+If no amount is given the Memorial Dungeon will of course at least need 1 Player to enter.
+If no min Level requirement is given, the Player has at least to be Level 1 to enter the Memorial Dungeon.
+If no max Level requirement is given, every Player can enter which is not above your Max. Level setting in the configuration files of your Server.
+
+This Command will also check if every Player inside the Party of the invoking Character is online. So if 2 Players are inside a Party
+but one of them is offline, the other Player won't be able to join the Memorial Dungeon.
+
+Also, here are some examples of how this Command will work inside a script:
+
+if(instance_check_party(getcharid(1),2,2,149)){
+ mes "Ok, your party is complete and meets the Memorial Dungeons requirement.",
+ mes "Members have a Baselevel between 1 and 150 and there are at least 2 Players inside the Party.";
+ close;
+}else{
+ mes "Sorry, but it seems like your Party does not meet the Memorial Dungeon requirements.";
+ close;
+}
+
+You also can use set .@party_id,getcharid(1); for example to save the Players Party ID.
+
+if(instance_check_party(.@party_id,2,2,149)){
+ mes "Ok, your party is complete and meets the Memorial Dungeons requirement.",
+ mes "Members have a Baselevel between 1 and 150 and there are at least 2 Players inside the Party.";
+ close;
+}else{
+ mes "Sorry, but it seems like your Party does not meet the Memorial Dungeon requirements.";
+ close;
+}
+
+And another way of checking could also be:
+
+if(!instance_check_party(getcharid(1),2,2,149)){
+ mes "Sorry, but it seems like your Party does not meet the Memorial Dungeon requirements.";
+ close;
+}else{
+ mes "Ok, your party is complete and meets the Memorial Dungeons requirement.",
+ mes "Members have a Baselevel between 1 and 150 and there are at least 2 Players inside the Party.";
+ close;
+}
+
+---------------------------------------
+
=========================
|8.- Quest Log commands.|
=========================
diff --git a/src/map/script.c b/src/map/script.c
index 84b9b3140..41507e5c4 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -15823,6 +15823,64 @@ BUILDIN_FUNC(instance_warpall)
}
/*==========================================
+ * instance_check_party [malufett]
+ * Values:
+ * party_id : Party ID of the invoking character. [Required Parameter]
+ * amount : Amount of needed Partymembers for the Instance. [Optional Parameter]
+ * min : Minimum Level needed to join the Instance. [Optional Parameter]
+ * max : Maxium Level allowed to join the Instance. [Optional Parameter]
+ * Example: instance_check_party (getcharid(1){,amount}{,min}{,max});
+ * Example 2: instance_check_party (getcharid(1),1,1,99);
+ *------------------------------------------*/
+BUILDIN_FUNC(instance_check_party)
+{
+ struct map_session_data *pl_sd;
+ int amount, min, max, i, party_id, c = 0;
+ struct party_data *p = NULL;
+
+ amount = script_hasdata(st,3) ? script_getnum(st,3) : 1; // Amount of needed Partymembers for the Instance.
+ min = script_hasdata(st,4) ? script_getnum(st,4) : 1; // Minimum Level needed to join the Instance.
+ max = script_hasdata(st,5) ? script_getnum(st,5) : MAX_LEVEL; // Maxium Level allowed to join the Instance.
+
+ if( min < 1 || min > MAX_LEVEL){
+ ShowError("instance_check_party: Invalid min level, %d\n", min);
+ return 0;
+ }else if( max < 1 || max > MAX_LEVEL){
+ ShowError("instance_check_party: Invalid max level, %d\n", max);
+ return 0;
+ }
+
+ if( script_hasdata(st,2) )
+ party_id = script_getnum(st,2);
+ else return 0;
+
+ if( !(p = party_search(party_id)) ){
+ script_pushint(st, 0); // Returns false if party does not exist.
+ return 0;
+ }
+
+ for( i = 0; i < MAX_PARTY; i++ )
+ if( (pl_sd = p->data[i].sd) )
+ if(map_id2bl(pl_sd->bl.id)){
+ if(pl_sd->status.base_level < min){
+ script_pushint(st, 0);
+ return 0;
+ }else if(pl_sd->status.base_level > max){
+ script_pushint(st, 0);
+ return 0;
+ }
+ c++;
+ }
+
+ if(c < amount){
+ script_pushint(st, 0); // Not enough Members in the Party to join Instance.
+ }else
+ script_pushint(st, 1);
+
+ return 0;
+}
+
+/*==========================================
* Custom Fonts
*------------------------------------------*/
BUILDIN_FUNC(setfont)
@@ -16626,6 +16684,7 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(instance_npcname,"s?"),
BUILDIN_DEF(has_instance,"s?"),
BUILDIN_DEF(instance_warpall,"sii?"),
+ BUILDIN_DEF(instance_check_party,"i???"),
/**
* 3rd-related
**/