diff options
27 files changed, 324 insertions, 316 deletions
@@ -1,27 +1,27 @@ Hercules ======== -Build Status: +Build Status: [![Build Status](https://travis-ci.org/HerculesWS/Hercules.svg?branch=master)](https://travis-ci.org/HerculesWS/Hercules) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/cm9xbwurpbltqjop?svg=true)](https://ci.appveyor.com/project/Haru/hercules) -[![Coverity Scan Build Status](https://scan.coverity.com/projects/3892/badge.svg)](https://scan.coverity.com/projects/herculesws-hercules) +[![Coverity Scan Build Status](https://scan.coverity.com/projects/3892/badge.svg)](https://scan.coverity.com/projects/herculesws-hercules) [![GitLab Build Status](https://gitlab.com/HerculesWS/Hercules/badges/master/build.svg)](https://gitlab.com/HerculesWS/Hercules/commits/master) [![Coverage Report](https://gitlab.com/HerculesWS/Hercules/badges/master/coverage.svg)](https://gitlab.com/HerculesWS/Hercules/commits/master) -Issues and pull requests: +Issues and pull requests: [![Open Issues](https://img.shields.io/github/issues-raw/HerculesWS/Hercules.svg?label=Open%20Issues)](https://github.com/HerculesWS/Hercules/issues) [![Open Pull Requests](https://img.shields.io/github/issues-pr-raw/HerculesWS/Hercules.svg?label=Open%20Pull%20Requests)](https://github.com/HerculesWS/Hercules/pulls) -Development and Community: +Development and Community: [![GitHub Repository](https://img.shields.io/badge/github-HerculesWS/Hercules-green.svg?logo=github)](https://github.com/HerculesWS/Hercules) -[![Community Forum](https://img.shields.io/badge/forum-herc.ws-orange.svg)](http://herc.ws) +[![Community Forum](https://img.shields.io/badge/forum-herc.ws-orange.svg)](http://herc.ws) [![IRC](https://img.shields.io/badge/IRC-Rizon/Hercules-yellow.svg)](irc://rizon.net/Hercules) -[![Discord](https://img.shields.io/badge/discord-Hercules%20Emulator-7289da.svg)](https://discord.gg/rqCxS8p) +[![Discord](https://img.shields.io/badge/discord-Hercules%20Emulator-7289da.svg)](https://discord.gg/rqCxS8p) [![Twitter](https://img.shields.io/badge/twitter-@HerculesWS-blue.svg?logo=twitter)](https://twitter.com/HerculesWS) -Project Info: +Project Info: [![Release](https://img.shields.io/github/release/HerculesWS/Hercules.svg)](https://github.com/HerculesWS/Hercules/releases) -![Language](https://img.shields.io/badge/language-C-yellow.svg) +![Language](https://img.shields.io/badge/language-C-yellow.svg) [![License](https://img.shields.io/badge/license-GPLv3-663399.svg)](https://github.com/HerculesWS/Hercules/blob/master/LICENSE) [![GitHub contributors](https://img.shields.io/github/contributors/HerculesWS/Hercules.svg)](https://github.com/HerculesWS/Hercules/graphs/contributors) @@ -68,6 +68,7 @@ Platforms](https://github.com/HerculesWS/Hercules/wiki/Supported-Platforms) wiki - libpcre (`pcre-devel`) - *Optional dependencies for development only* - perl (required to rebuild the HPM Hooks and HPMDataCheck) + - requires the XML::Simple module, which in turn requires libexpat-dev - Doxygen (required to rebuild the HPM Hooks and HPMDataCheck) #### Mac OS X @@ -182,17 +183,17 @@ Helpful Links The following list of links point to various help files within the repository, articles or pages on the Wiki or topics within the Hercules forum. -* Hercules Forums: +* Hercules Forums: http://herc.ws/board/ -* Hercules Wiki: +* Hercules Wiki: http://herc.ws/wiki/Main_Page -* Git Repository URL: +* Git Repository URL: https://github.com/HerculesWS/Hercules -* Hercules IRC Channel: - Network: `irc.rizon.net` +* Hercules IRC Channel: + Network: `irc.rizon.net` Channel: `#Hercules` More Documentation diff --git a/doc/sample/npc_rodex.txt b/doc/sample/npc_rodex.txt index a808a1aa9..0975e609c 100644 --- a/doc/sample/npc_rodex.txt +++ b/doc/sample/npc_rodex.txt @@ -20,12 +20,12 @@ prontera,150,150,4 script Rodex Mail 1_M_01,{ // Sends a messsage to attached player "Account Box" from "Rodex Test", with title "Rodex Test3", // with message "Hello World, How are You?", 1000 Zenies and 5 Red Potions attached rodex_sendmail_acc( - getcharid(CHAR_ID_CHAR), "Rodex Test", "Rodex Test3", "Hello World, How are You?", + getcharid(CHAR_ID_ACCOUNT), "Rodex Test", "Rodex Test3", "Hello World, How are You?", 1000, Red_Potion, 5 ); - // Sends a messsage to attached player "Account Box" from "Rodex Test", with title "Rodex Test6", + // Sends a messsage to attached player from "Rodex Test", with title "Rodex Test6", // with message "Hello World, How are You?", 1000 Zenies, 5 Red Potions and // 1 +10 Knife[3] with 3 Poring Cards (Broken) rodex_sendmail2( diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 36c4da35a..10a0352f4 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -2756,7 +2756,9 @@ save points. Available information types are: --------------------------------------- -*getcharip({"<character name>"|<account id>|<char id>}) +*getcharip({"<character name>"}) +*getcharip({<account id>}) +*getcharip({<character id>}) This function will return the IP address of the invoking character, or, if a player is specified, of that character. A blank string is returned if no @@ -3413,7 +3415,8 @@ behave specially when talked to by GMs. --------------------------------------- -*setgroupid(<new group id>{, "<character name>"|<account id>}) +*setgroupid(<new group id>{, "<character name>"}) +*setgroupid(<new group id>{, <account id>}) This function will temporary adjust the id of player group the account to which the player specified if the new group id is available. @@ -4372,7 +4375,7 @@ offline in the mean time, attachrid() returns false, otherwise true. --------------------------------------- -*rid2name(<rid>) +*rid2name(<account id>) Converts rid to name. Note: The player/monster/NPC must be online/enabled. Good for PCKillEvent where you can convert 'killedrid' to the name of the @@ -4616,13 +4619,12 @@ effects. --------------------------------------- -*recovery() -*recovery(<account id>) +*recovery({<account id>}) *recovery("<map name>"{, <x1>, <y1>, <x2>, <y2>}) -In its first form, this command will revive and restore full HP and SP to all -characters currently connected to the server. In its second form, it will only -affect the target player. In its third form it will affect a whole map or area. +This command will revive and restore full HP and SP to all characters currently +connected to the server. If an account id is supplied, it will instead only +affect this character. If a map is supplied it will affect a whole map or area. --------------------------------------- @@ -5138,8 +5140,10 @@ Example: close(); --------------------------------------- -*getnameditem(<item id>, <character name|character ID>) -*getnameditem("<item name>", <character name|character ID>) +*getnameditem(<item id>, "<character name>") +*getnameditem(<item id>, <character ID>) +*getnameditem("<item name>", "<character name>") +*getnameditem("<item name>", <character ID>) Create an item signed with the given character's name. @@ -5303,7 +5307,7 @@ Check getitem2() to understand the arguments of the function. --------------------------------------- -*groupranditem(<item_id/constant>) +*groupranditem(<item id>) Returns the item_id of a random item picked from the item container specified. There are different item containers and they are specified in 'db/(pre-)re/item_group.conf'. @@ -5313,7 +5317,7 @@ Example: --------------------------------------- -*getrandgroupitem(<item_id/constant>, <quantity>) +*getrandgroupitem(<item id>, <quantity>) Similar to the above example, this command allows players to obtain the specified quantity of a random item from the container. The different containers @@ -6195,7 +6199,7 @@ Examples: @ /!\ This command is deprecated @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -Prevents the player from moving when the option != 0, and 0 enables the +Prevents the player from moving when the option != 0, and 0 enables the player to move again. The player has to be the account ID of a character, and will run for the attached player if zero is supplied. @@ -6823,12 +6827,12 @@ valid <type> for gettimer() are: --------------------------------------- -*initnpctimer({ "<NPC name>" {, <Attach Flag>} } | - { "<NPC name>" | <Attach Flag> }) -*stopnpctimer({ "<NPC name>" {, <Detach Flag>} } | - { "<NPC name>" | <Detach Flag> }) -*startnpctimer({ "<NPC name>" {, <Attach Flag>} } | - { "<NPC name>" | <Attach Flag> }) +*initnpctimer({"<NPC name>"{, <Attach Flag>}}) +*initnpctimer({<Attach Flag>}) +*stopnpctimer({"<NPC name>"{, <Detach Flag>}}) +*stopnpctimer({<Detach Flag>}}) +*startnpctimer({"<NPC name>"{, <Attach Flag>}}) +*startnpctimer({<Attach Flag>}) *setnpctimer(<tick>{, "<NPC name>"}) *getnpctimer(<type of information>{, "<NPC name>"}) *attachnpctimer({"<character name>"}) @@ -9369,19 +9373,19 @@ Add quest of the <ID2> to the the quest log, and the state is "active". --------------------------------------- -*questprogress(<ID>{, PLAYTIME|HUNTING}) +*questprogress(<ID>{, <type>}) If no additional argument supplied, return the state of the quest: 0 = Quest not started (not in quest log) 1 = Quest has been given 2 = Quest completed -If parameter PLAYTIME is supplied: +If <type> PLAYTIME is supplied: 0 = Quest not started (not in quest log) 1 = The time limit has not yet been reached 2 = The time limit has been reached -If parameter HUNTING is supplied: +If <type> HUNTING is supplied: 0 = Quest not started (not in quest log) 1 = Player hasn't killed all of the target monsters 2 = Player has killed all of the target monsters @@ -10023,7 +10027,7 @@ returns 1 on success, 0 on failure. //===================================== --------------------------------------- -*join_clan(<ClanID>{,<RID>}) +*join_clan(<ClanID>{, <account id>}) Joins a player into the given clan. If no RID is given, will run with the current attached player. @@ -10032,7 +10036,7 @@ returns true on success, false on failure. --------------------------------------- -*clan_leave({<RID>}) +*clan_leave({<account id>}) Removes a player from its clan. If no RID is given, will run with the current attached player. @@ -10068,4 +10072,4 @@ the available flags are: Opens the styling shop on client ----------------------------------------
\ No newline at end of file +--------------------------------------- diff --git a/npc/dev/test.txt b/npc/dev/test.txt index a6f89f857..036a94916 100644 --- a/npc/dev/test.txt +++ b/npc/dev/test.txt @@ -150,6 +150,20 @@ function script HerculesSelfTestHelper { callsub(OnCheck, "Prefix decrement --", .@y); callsub(OnCheck, "Prefix decrement --", .@x); + // Increment and decrement operators after a condition + .@x = 0; + if (1) .@x++; + callsub(OnCheck, "Suffix increment ++ after (condition)", .@x); + .@x = 2; + if (1) .@x--; + callsub(OnCheck, "Suffix decrement -- after (condition)", .@x); + .@x = 0; + if (1) ++.@x; + callsub(OnCheck, "Prefix increment ++ after (condition)", .@x); + .@x = 2; + if (1) --.@x; + callsub(OnCheck, "Prefix decrement -- after (condition)", .@x); + // Order of [] and --/++ .@a[1] = 0; .@a[1]++; // .@a[1] = .@a[1] + 1; diff --git a/npc/instances/EndlessTower.txt b/npc/instances/EndlessTower.txt index dc60ce766..2964f7e2a 100644 --- a/npc/instances/EndlessTower.txt +++ b/npc/instances/EndlessTower.txt @@ -220,23 +220,21 @@ e_tower,81,105,0 script Tower Protection Stone 2_MONEMUS,{ switch (select(.@str$, "Enter the Dungeon", "Return to Alberta", "Cancel")) { case 1: .@instance = instance_create(.@md_name$, .@party_id); - if (.@instance < 0) { - mesf("Party Name: %s", .@p_name$); - mesf("Party Leader: %s", strcharinfo(PC_NAME)); - mesf("^0000ff%s ^000000- Reservation Failed!", .@md_name$); - close(); + if (.@instance >= 0) { + for (.@i = 1; .@i <= 6; ++.@i) { + if (instance_attachmap(.@i + "@tower", .@instance) == "") { + mesf("Party Name: %s", .@p_name$); + mesf("Party Leader: %s", strcharinfo(PC_NAME)); + mesf("^0000ff%s ^000000- Reservation Failed!", .@md_name$); + instance_destroy(.@instance); + close(); + } + } + instance_set_timeout(14400, 300, .@instance); + instance_init(.@instance); } mesf("^0000ff%s^000000 - Try to reserve", .@md_name$); mes("After making a reservation, you have to talk to NPC behind and select the menu 'Enter the Dungeon' to enter the dungeon."); - for (.@i = 1; .@i <= 6; ++.@i) { - if (instance_attachmap(.@i + "@tower", .@instance) == "") { - mesf("^0000ff%s ^000000- Reservation Failed!", .@md_name$); - instance_destroy(.@instance); - close(); - } - } - instance_set_timeout(14400, 300, .@instance); - instance_init(.@instance); close(); case 2: callsub(L_Enter, 0, 1, .@md_name$, .@p_name$); diff --git a/npc/instances/NydhoggsNest.txt b/npc/instances/NydhoggsNest.txt index 46ffdaef3..d39d90cd3 100644 --- a/npc/instances/NydhoggsNest.txt +++ b/npc/instances/NydhoggsNest.txt @@ -128,21 +128,18 @@ nyd_dun02,100,201,3 script Yggdrasil Gatekeeper HIDDEN_NPC,8,8,{ switch (select("Please allow me to enter.", "I want to go in.", "I want to leave.")) { case 1: .@instance = instance_create(.@md_name$, .@party_id); - if (.@instance < 0) { - mes("[Yggdrasil Gatekeeper]"); - mes("The Guardian seems to wish to be alone. I will go in and check, please wait out here."); - close(); + if (.@instance >= 0) { + for (.@i = 1; .@i <= 2; ++.@i) { + if (instance_attachmap(.@i + "@nyd", .@instance) == "") { + mes("[Yggdrasil Gatekeeper]"); + mes("The Guardian seems to wish to be alone. I will go in and check, please wait out here."); + instance_destroy(.@instance); + close(); + } + } + instance_set_timeout(144000, 300, .@instance); + instance_init(.@instance); } - for (.@i = 1; .@i <= 2; ++.@i) { - if (instance_attachmap(.@i + "@nyd", .@instance) == "") - break; - } - if (.@i < 2) { - instance_destroy(.@instance); - close(); - } - instance_set_timeout(144000, 300, .@instance); - instance_init(.@instance); mes("[Yggdrasil Gatekeeper]"); mes("I've recorded your request, are you ready to go inside?"); next(); diff --git a/npc/instances/OrcsMemory.txt b/npc/instances/OrcsMemory.txt index 1aaf2fd42..383786696 100644 --- a/npc/instances/OrcsMemory.txt +++ b/npc/instances/OrcsMemory.txt @@ -67,23 +67,20 @@ gef_fild10,242,202,0 script Dimensional Gorge Piece 2_MONEMUS,{ switch (select(.@str$, "Enter the Dungeon", "Cancel")) { case 1: .@instance = instance_create(.@md_name$, .@party_id); - if (.@instance < 0) { - mesf("Party Name: %s", .@p_name$); - mesf("Party Leader: %s", strcharinfo(PC_NAME)); - mesf("^0000ff%s ^000000 - Reservation Failed.", .@md_name$); - close(); + if (.@instance >= 0) { + for (.@i = 1; .@i <= 2; ++.@i) { + if (instance_attachmap(.@i + "@orcs", .@instance) == "") { + mesf("Party Name: %s", .@p_name$); + mesf("Party Leader: %s", strcharinfo(PC_NAME)); + mesf("^0000ff%s ^000000 - Reservation Failed.", .@md_name$); + instance_destroy(.@instance); + close(); + } + } + instance_set_timeout(7200, 300, .@instance); + instance_init(.@instance); } mesf("^0000ff%s^000000- Attempting to book an entrance", .@md_name$); - for (.@i = 1; .@i <= 2; ++.@i) { - if (instance_attachmap(.@i + "@orcs", .@instance) == "") - break; - } - if (.@i < 2) { - instance_destroy(.@instance); - close(); - } - instance_set_timeout(7200, 300, .@instance); - instance_init(.@instance); mesf("After making a reservation, you have to select 'Enter the Dungeon' from the menu if you wish to enter the %s.", .@md_name$); close(); case 2: diff --git a/npc/instances/SealedShrine.txt b/npc/instances/SealedShrine.txt index 3bc3d951a..91771c31c 100644 --- a/npc/instances/SealedShrine.txt +++ b/npc/instances/SealedShrine.txt @@ -118,37 +118,33 @@ monk_test,309,146,3 script Friar Patrick#edq 4_M_OLDFRIAR,{ mesf("Party name is %s...", getpartyname(.@party_id)); mesf("Name of the leader is %s...", strcharinfo(PC_NAME)); .@instance = instance_create(_("Sealed Catacomb"), .@party_id); - if (.@instance < 0) { - mes("Umm... But it seems that there is a problem here... I'll check quickly. Please wait."); - } else { + if (.@instance >= 0) { for (.@i = 1; .@i <= 2; .@i++) { if (instance_attachmap(.@i + "@cata", .@instance) == "") { - mesf("Failed to attach %d@cata as a map!", .@i); + mes("Umm... But it seems that there is a problem here... I'll check quickly. Please wait."); instance_destroy(.@instance); close(); } } - instance_set_timeout(7200, 300, .@instance); instance_init(.@instance); - - mes("Okay... I'll adjust the shrine's seal so that you and your group can enter."); - next(); - mes("[Friar Patrick]"); - mes("You will see a sign when the seal has broken. Please wait until the sign appears..."); - next(); - mes("[Friar Patrick]"); - mes("When you see the sign, put your hands on the gravestone... Then you can move inside."); - next(); - mes("[Friar Patrick]"); - mes("One thing that you should remember is... Anyone who enters this shrine will be cursed by Baphomet and cannot enter or leave while they are cursed."); - next(); - mes("[Friar Patrick]"); - mes("And one more thing... In this cursed area, some skills, which are protected by outer physical power are prohibited by the effect of the seal."); - next(); - mes("[Friar Patrick]"); - mes("For example, the skills like ^0000FFSafety Wall and Assumptio^000000... So you'd better prepare before entering the shrine."); } + mes("Okay... I'll adjust the shrine's seal so that you and your group can enter."); + next(); + mes("[Friar Patrick]"); + mes("You will see a sign when the seal has broken. Please wait until the sign appears..."); + next(); + mes("[Friar Patrick]"); + mes("When you see the sign, put your hands on the gravestone... Then you can move inside."); + next(); + mes("[Friar Patrick]"); + mes("One thing that you should remember is... Anyone who enters this shrine will be cursed by Baphomet and cannot enter or leave while they are cursed."); + next(); + mes("[Friar Patrick]"); + mes("And one more thing... In this cursed area, some skills, which are protected by outer physical power are prohibited by the effect of the seal."); + next(); + mes("[Friar Patrick]"); + mes("For example, the skills like ^0000FFSafety Wall and Assumptio^000000... So you'd better prepare before entering the shrine."); } else { mes("[Friar Patrick]"); mes("Umm... I recognize your courage, but... I can't permit anyone to enter this place. I can only permit the leader of a party to enter first."); diff --git a/npc/re/instances/BakonawaLake.txt b/npc/re/instances/BakonawaLake.txt index 65622171b..5226db6cc 100644 --- a/npc/re/instances/BakonawaLake.txt +++ b/npc/re/instances/BakonawaLake.txt @@ -82,18 +82,16 @@ ma_scene01,174,179,4 script Taho 4_M_DEWZATIMAN,{ switch (.@i) { case 1: .@instance = instance_create(.@md_name$, .@party_id); - if (.@instance < 0) { - mes("[Taho]"); - mes("Oh, the rope got dropped. I have to make a new one."); - close(); - } - if (instance_attachmap("1@ma_b", .@instance) == "") { - mesf("^0000ff%s^000000 - Reservation Failed!", .@md_name$); - instance_destroy(.@instance); - close(); + if (.@instance >= 0) { + if (instance_attachmap("1@ma_b", .@instance) == "") { + mes("[Taho]"); + mes("Oh, the rope got dropped. I have to make a new one."); + instance_destroy(.@instance); + close(); + } + instance_set_timeout(7200, 300, .@instance); + instance_init(.@instance); } - instance_set_timeout(7200, 300, .@instance); - instance_init(.@instance); mes("[Taho]"); mes("Now I'm weaving, so you can go down when I'm done."); close(); diff --git a/npc/re/instances/BangungotHospital.txt b/npc/re/instances/BangungotHospital.txt index 9e8e836c4..6972322e1 100644 --- a/npc/re/instances/BangungotHospital.txt +++ b/npc/re/instances/BangungotHospital.txt @@ -274,21 +274,19 @@ L_Enter: switch(select(((getarg(0))?"Prepare to enter the second floor.":""), "Enter the second floor.", "Do not enter.")) { case 1: .@instance = instance_create(.@md_name$,getcharid(CHAR_ID_PARTY)); - if (.@instance < 0) { - mes "[Nurse Maenne]"; - mes "A critical situation has happened."; - mes "You can't go up to the 2nd floor."; - close2; - cutin "",255; - end; - } - if (instance_attachmap("1@ma_h",.@instance) == "") { - mes "^0000ff"+.@md_name$+"^000000 - Reservation Failed!"; - instance_destroy(.@instance); - close; + if (.@instance >= 0) { + if (instance_attachmap("1@ma_h", .@instance) == "") { + mes("[Nurse Maenne]"); + mes("A critical situation has happened."); + mes("You can't go up to the 2nd floor."); + instance_destroy(.@instance); + close2(); + cutin("", 255); + end; + } + instance_set_timeout(3600, 300, .@instance); + instance_init(.@instance); } - instance_set_timeout 3600,300,.@instance; - instance_init(.@instance); mes "[Nurse Maenne]"; mes "We are preparing to go up"; mes "to the second floor."; diff --git a/npc/re/instances/BuwayaCave.txt b/npc/re/instances/BuwayaCave.txt index 393ac5d9e..1d3eddc6a 100644 --- a/npc/re/instances/BuwayaCave.txt +++ b/npc/re/instances/BuwayaCave.txt @@ -93,22 +93,19 @@ ma_fild02,312,317,5 script Guard#buwaya_cave 4_MAL_SOLDIER,{ // fall through } .@instance = instance_create(.@md_name$, .@party_id); - if (.@instance < 0) { - mes("[Guard]"); - mesf("Party name is... %s.", getpartyname(.@party_id)); - mesf("Party leader is... %s", strcharinfo(PC_NAME)); - mesf("^0000ff%s^000000 cannot be opened now.", .@md_name$); - mes("Please try a moment later."); - close(); + if (.@instance >= 0) { + if (instance_attachmap("1@ma_c", .@instance) == "") { + mes("[Guard]"); + mesf("Party name is... %s.", getpartyname(.@party_id)); + mesf("Party leader is... %s", strcharinfo(PC_NAME)); + mesf("^0000ff%s^000000 cannot be opened now.", .@md_name$); + mes("Please try a moment later."); + instance_destroy(.@instance); + close(); + } + instance_set_timeout(3600, 300, .@instance); + instance_init(.@instance); } - if (instance_attachmap("1@ma_c", .@instance) == "") { - mesf("^0000ff%s^000000 - Reservation Failed!", .@md_name$); - instance_destroy(.@instance); - close(); - } - instance_set_timeout(3600, 300, .@instance); - instance_init(.@instance); - mes("[Guard]"); mesf("I will open up the tunnel to ^0000ff%s^000000.", .@md_name$); mes("I wish you good luck."); diff --git a/npc/re/instances/EclageInterior.txt b/npc/re/instances/EclageInterior.txt index 6b2808e05..2b2117b93 100644 --- a/npc/re/instances/EclageInterior.txt +++ b/npc/re/instances/EclageInterior.txt @@ -55,20 +55,18 @@ ecl_hub01,132,12,3 script Chief of Staff#tl01::EclInstance 4_F_FAIRY,{ switch (select("Enter it.", "Forget it.")) { case 1: .@instance = instance_create(.@md_name$, .@party_id); - if (.@instance < 0) { - mes("[Shenime]"); - mes("There are some soldiers dispatched by Mayor not too long ago."); - mes("I should sure hope that you aren't the disturbance they're looking for, right?"); - close(); - } - if (instance_attachmap("1@ecl", .@instance) == "") { - mesf("^0000ff%s^000000 - Reservation Failed!", .@md_name$); - instance_destroy(.@instance); - close(); + if (.@instance >= 0) { + if (instance_attachmap("1@ecl", .@instance) == "") { + mes("[Shenime]"); + mes("There are some soldiers dispatched by Mayor not too long ago."); + mes("I should sure hope that you aren't the disturbance they're looking for, right?"); + instance_destroy(.@instance); + close(); + } + ecl_interior_time = gettimetick(2) + 20 * 60; + instance_set_timeout(1200, 1200, .@instance); + instance_init(.@instance); } - ecl_interior_time = gettimetick(2) + 20 * 60; - instance_set_timeout(1200, 1200, .@instance); - instance_init(.@instance); mes("[Shenime]"); mes("Given the tight internal security, you should prepare yourself."); mes("Wait here for a minute."); diff --git a/npc/re/instances/HazyForest.txt b/npc/re/instances/HazyForest.txt index 291ce54db..24e03b22e 100644 --- a/npc/re/instances/HazyForest.txt +++ b/npc/re/instances/HazyForest.txt @@ -101,35 +101,34 @@ bif_fild01,158,340,5 script Laphine Soldier#mist 4_M_FAIRYSOLDIER,{ mesf("Party Name %s...", getpartyname(.@party_id)); mesf("Party Leader %s...", strcharinfo(PC_NAME)); .@instance = instance_create(.@md_name$, .@party_id); - if (.@instance < 0) { - mes("Hmm..."); - next(); - mes("[Laphine Soldier]"); - if (!.@playtime) - mes("It's dangerous in the forest."); - else - mes("The atmosphere is somewhat tense in the forest."); - mes("...Why don't you just go back today?"); - close(); - } - if (instance_attachmap("1@mist", .@instance) != "") { + if (.@instance >= 0) { + if (instance_attachmap("1@mist", .@instance) == "") { + mes("Hmm..."); + next(); + mes("[Laphine Soldier]"); + if (!.@playtime) + mes("It's dangerous in the forest."); + else + mes("The atmosphere is somewhat tense in the forest."); + mes("...Why don't you just go back today?"); + instance_destroy(.@instance); + close(); + } instance_set_timeout(7200, 300, .@instance); instance_init(.@instance); - mes("I've got it. I've written them down on the report here."); - next(); - mes("[Laphine Soldier]"); - mes("You'll get permission soon."); - mes("Now go to the log tunnel, the only way to get into the Hazy Forest."); - mes("You understand?"); - next(); - mes("[Laphine Soldier]"); - mes("We can't go against the forest,"); - mes("but maybe you humans can."); - mes("Good luck!"); - close(); - } else { - instance_destroy(.@instance); } + mes("I've got it. I've written them down on the report here."); + next(); + mes("[Laphine Soldier]"); + mes("You'll get permission soon."); + mes("Now go to the log tunnel, the only way to get into the Hazy Forest."); + mes("You understand?"); + next(); + mes("[Laphine Soldier]"); + mes("We can't go against the forest,"); + mes("but maybe you humans can."); + mes("Good luck!"); + close(); case 2: mes("[Laphine Soldier]"); mes("Well, you've made the right decision."); diff --git a/npc/re/instances/MalangdoCulvert.txt b/npc/re/instances/MalangdoCulvert.txt index 2e51f0fd5..d61509511 100644 --- a/npc/re/instances/MalangdoCulvert.txt +++ b/npc/re/instances/MalangdoCulvert.txt @@ -433,20 +433,19 @@ mal_in01,160,34,4 script Missing, the Cleaner 4_CAT_SAILOR2,{ close(); case 2: .@instance = instance_create(.@md_name$, .@party_id); - if (.@instance < 0) { - mesf("Party name: %s", getpartyname(.@party_id)); - mesf("Party leader: %s", strcharinfo(PC_NAME)); - mesf("^0000ff%s^000000 - Reservation Failed!", .@md_name$); - close(); + if (.@instance >= 0) { + for (.@i = 1; .@i <= 2; .@i++) { + if (instance_attachmap(.@i + "@pump", .@instance) == "") { + mesf("Party name: %s", getpartyname(.@party_id)); + mesf("Party leader: %s", strcharinfo(PC_NAME)); + mesf("^0000ff%s^000000 - Reservation Failed!", .@md_name$); + instance_destroy(.@instance); + close(); + } + } + instance_set_timeout(3600, 300, .@instance); + instance_init(.@instance); } - if (instance_attachmap("1@pump", .@instance) == "" || instance_attachmap("2@pump", .@instance) == "") { - mesf("^0000ff%s^000000 - Reservation Failed!", .@md_name$); - instance_destroy(.@instance); - close(); - } - instance_set_timeout(3600, 300, .@instance); - instance_init(.@instance); - mesf("^3333FF%s^000000 - Reserving", .@md_name$); mes("After making the reservation, you"); mes("have to select Enter the Culvert."); diff --git a/npc/re/instances/OldGlastHeim.txt b/npc/re/instances/OldGlastHeim.txt index c317e7495..587de45bf 100644 --- a/npc/re/instances/OldGlastHeim.txt +++ b/npc/re/instances/OldGlastHeim.txt @@ -110,19 +110,19 @@ glast_01,204,273,6 script Hugin#ghinstance 4_M_SAGE_C,{ if (getcharid(CHAR_ID_CHAR) != getpartyleader(.@party_id, 2)) end; .@instance = instance_create(.@md_name$, .@party_id); - if (.@instance < 0) { - mesf("Party Name: %s", .@p_name$); - mesf("Party Leader: %s", strcharinfo(PC_NAME)); - mesf("^0000ff%s^000000 - Reservation Failed!", .@md_name$); - close(); - } - if (instance_attachmap("1@gl_k", .@instance) == "" || instance_attachmap("2@gl_k", .@instance) == "") { - mesf("^0000FF%s^000000 - Reservation Failed!", .@md_name$); - instance_destroy(.@instance); - close(); + if (.@instance >= 0) { + for (.@i = 1; .@i <= 2; .@i++) { + if (instance_attachmap(.@i + "@gl_k", .@instance) == "") { + mesf("Party Name: %s", .@p_name$); + mesf("Party Leader: %s", strcharinfo(PC_NAME)); + mesf("^0000ff%s^000000 - Reservation Failed!", .@md_name$); + instance_destroy(.@instance); + close(); + } + } + instance_set_timeout(3600, 300, .@instance); + instance_init(.@instance); } - instance_set_timeout(3600, 300, .@instance); - instance_init(.@instance); mes("[Hugin]"); mes("The time gap was created. When you're ready, talk to me again."); close(); diff --git a/npc/re/instances/WolfchevLaboratory.txt b/npc/re/instances/WolfchevLaboratory.txt index d6c5516e5..efb32be7e 100644 --- a/npc/re/instances/WolfchevLaboratory.txt +++ b/npc/re/instances/WolfchevLaboratory.txt @@ -1859,30 +1859,29 @@ lhz_dun04,151,276,3 script Researcher#memo 4_LGTSCIENCE,{ } if (getpartyleader(getcharid(CHAR_ID_PARTY),2) == getcharid(CHAR_ID_CHAR)) { .@instance = instance_create("Worsef", getcharid(CHAR_ID_PARTY)); - if (.@instance < 0) { - mes "[Wolfchev]"; - mes "Hmm.. Lab entering system is a bit weird. Would wait for me to check the system?"; - } else { - mes "[Wolfchev]"; - mes "Please hold on.."; - next; - mes "Wolfchev starts to control certain gear."; - next; - progressbar "FF00FF", 2; - if (instance_attachmap("1@lhz", .@instance) != "") { - instance_set_timeout 14400, 300, .@instance; - instance_init(.@instance); - mes "[Wolfchev]"; - mes "Alright! I have marked lan entering system code as"; - mes "^0000ff"+ strcharinfo(PC_PARTY) +"^000000 party leader's name ^0000ff"+ strcharinfo(PC_NAME) +"^000000!!."; - next; - mes "[Wolfchev]"; - mes "Now, your party is free to pass the entrance."; - } else { + if (.@instance >= 0) { + if (instance_attachmap("1@lhz", .@instance) == "") { + mes("[Wolfchev]"); + mes("Hmm.. Lab entering system is a bit weird. Would wait for me to check the system?"); instance_destroy(.@instance); + close(); } + instance_set_timeout 14400, 300, .@instance; + instance_init(.@instance); } - close; + mes("[Wolfchev]"); + mes("Please hold on.."); + next(); + mes("Wolfchev starts to control certain gear."); + next(); + progressbar("FF00FF", 2); + mes("[Wolfchev]"); + mes("Alright! I have marked lan entering system code as"); + mesf("^0000ff%s^000000 party leader's name ^0000ff%s^000000!!.", strcharinfo(PC_PARTY), strcharinfo(PC_NAME)); + next(); + mes("[Wolfchev]"); + mes("Now, your party is free to pass the entrance."); + close(); } else { mes "[Wolfchev]"; mes "You are not the ^0000ffLeader of the party^000000, are you? Please go get the leader."; diff --git a/npc/re/instances/ghost_palace.txt b/npc/re/instances/ghost_palace.txt index e4ca12f99..3e708dc57 100644 --- a/npc/re/instances/ghost_palace.txt +++ b/npc/re/instances/ghost_palace.txt @@ -91,27 +91,24 @@ dali02,44,129,5 script Unpleasent Royal Guard 4_M_SAKRAYROYAL,{ .@instance = instance_create(_("Ghost Palace"), .@party_id); .@p_name$ = getpartyname(.@party_id); .@md_name$ = _("Ghost Palace"); - if (.@instance < 0) { - mesf("Party Name: %s", .@p_name$); - mesf("Party Leader: %s", strcharinfo(PC_NAME)); - mesf("^0000FF%s^000000 - Reservation Failed!", .@md_name$); - close(); - } - if (instance_attachmap("1@spa", .@instance) != "") { + if (.@instance >= 0) { + if (instance_attachmap("1@spa", .@instance) == "") { + mesf("Party Name: %s", .@p_name$); + mesf("Party Leader: %s", strcharinfo(PC_NAME)); + mesf("^0000FF%s^000000 - Reservation Failed!", .@md_name$); + instance_destroy(.@instance); + close(); + } instance_set_timeout(3600, 300, .@instance); instance_init(.@instance); if (!questprogress(1260)) setquest(1260); - mes("[Unpleasent Royal Guard]"); - mes("Thank You..\r" - "I will open the secret passage to ^0000FFGhost Palace.^000000\r" - "Please be ready!"); - close(); - } else { - instance_destroy(.@instance); - mesf("^0000FF%s^000000 - Reservation Failed!", .@md_name$); - close(); } + mes("[Unpleasent Royal Guard]"); + mes("Thank You..\r" + "I will open the secret passage to ^0000FFGhost Palace.^000000\r" + "Please be ready!"); + close(); } dali02,41,134,0 script Interdimensional Device::gpportal PORTAL,{ diff --git a/npc/re/instances/octopus_cave.txt b/npc/re/instances/octopus_cave.txt index e4d8d4357..4c964072a 100644 --- a/npc/re/instances/octopus_cave.txt +++ b/npc/re/instances/octopus_cave.txt @@ -85,22 +85,19 @@ mal_dun01,151,235,5 script Starfish 4_ASTER,{ erasequest(4197); if (countitem(Octopus_Hunt_Stick)) { .@instance = instance_create(.@md_name$, .@party_id); - if (.@instance < 0) { - mes("[Starfish]"); - mesf("Party name is... %s.", getpartyname(.@party_id)); - mesf("Party leader is... %s.", strcharinfo(PC_NAME)); - mesf("^0000FF%s^000000, I cannot open now, hehe.", .@md_name$); - mes("Now is not the time, please wait."); - close(); + if (.@instance >= 0) { + if (instance_attachmap("1@cash", .@instance) == "") { + mes("[Starfish]"); + mesf("Party name is... %s.", getpartyname(.@party_id)); + mesf("Party leader is... %s.", strcharinfo(PC_NAME)); + mesf("^0000FF%s^000000, I cannot open now, hehe.", .@md_name$); + mes("Now is not the time, please wait."); + instance_destroy(.@instance); + close(); + } + instance_set_timeout(3600, 300, .@instance); + instance_init(.@instance); } - if (instance_attachmap("1@cash", .@instance) == "") { - mesf("^0000FF%s^000000 - Reservation Failed!", .@md_name$); - instance_destroy(.@instance); - close(); - } - instance_set_timeout(3600, 300, .@instance); - instance_init(.@instance); - mes("[Starfish]"); mesf("I will open the gate for a while to ^0000FF%s^000000.", .@md_name$); mes("Please catch that pervert octopus, and come back with it sticked to the pick, hehe."); diff --git a/npc/re/instances/saras_memory.txt b/npc/re/instances/saras_memory.txt index c9a47534b..9eac396aa 100644 --- a/npc/re/instances/saras_memory.txt +++ b/npc/re/instances/saras_memory.txt @@ -185,19 +185,17 @@ dali,138,118,0 script Dimensional Device#dimen PORTAL,{ if (getcharid(CHAR_ID_CHAR) != getpartyleader(.@party_id, 2)) end; .@instance = instance_create(.@md_name$, .@party_id); - if (.@instance < 0) { - mesf("Party Name: %s", .@p_name$); - mesf("Party Leader: %s", strcharinfo(PC_NAME)); - mesf("^0000FF%s^000000 - Reservation Failed!", .@md_name$); - close(); - } - if (instance_attachmap("1@sara", .@instance) == "") { - mesf("^0000FF%s^000000 - Reservation Failed!", .@md_name$); - instance_destroy(.@instance); - close(); + if (.@instance >= 0) { + if (instance_attachmap("1@sara", .@instance) == "") { + mesf("Party Name: %s", .@p_name$); + mesf("Party Leader: %s", strcharinfo(PC_NAME)); + mesf("^0000FF%s^000000 - Reservation Failed!", .@md_name$); + instance_destroy(.@instance); + close(); + } + instance_set_timeout(3600, 300, .@instance); + instance_init(.@instance); } - instance_set_timeout(3600, 300, .@instance); - instance_init(.@instance); mes("^FF0000The dimensional boots up cleanly. Use the device to enter the crack in space and time.^000000"); close(); case 2: diff --git a/src/common/HPM.h b/src/common/HPM.h index e55397022..efa5d8370 100644 --- a/src/common/HPM.h +++ b/src/common/HPM.h @@ -42,11 +42,7 @@ #define DLL HINSTANCE #else // ! WIN32 #include <dlfcn.h> - #ifdef RTLD_DEEPBIND // Certain linux distributions require this, but it's not available everywhere - #define plugin_open(x) dlopen((x),RTLD_NOW|RTLD_DEEPBIND) - #else // ! RTLD_DEEPBIND - #define plugin_open(x) dlopen((x),RTLD_NOW) - #endif // RTLD_DEEPBIND + #define plugin_open(x) dlopen((x), RTLD_NOW) #define plugin_import(x,y,z) (z)dlsym((x),(y)) #define plugin_close(x) dlclose(x) #define plugin_geterror(buf) ((void)buf, dlerror()) diff --git a/src/common/console.c b/src/common/console.c index 0b0a900f6..e7edd7e1e 100644 --- a/src/common/console.c +++ b/src/common/console.c @@ -133,7 +133,10 @@ int console_parse_key_pressed(void) **/ CPCMD_C(exit, server) { - core->runflag = 0; + if (core->shutdown_callback != NULL) + core->shutdown_callback(); + else + core->runflag = CORE_ST_STOP; } /** diff --git a/src/common/core.c b/src/common/core.c index 1bd332eec..406bb7629 100644 --- a/src/common/core.c +++ b/src/common/core.c @@ -80,9 +80,6 @@ // And don't complain to us if the XYZ plugin you installed wiped your hard disk, or worse. // Note: This feature is deprecated, and should not be used. -/// Called when a terminate signal is received. -void (*shutdown_callback)(void) = NULL; - struct core_interface core_s; struct core_interface *core = &core_s; @@ -128,8 +125,8 @@ static BOOL WINAPI console_handler(DWORD c_event) case CTRL_CLOSE_EVENT: case CTRL_LOGOFF_EVENT: case CTRL_SHUTDOWN_EVENT: - if( shutdown_callback != NULL ) - shutdown_callback(); + if (core->shutdown_callback != NULL) + core->shutdown_callback(); else core->runflag = CORE_ST_STOP;// auto-shutdown break; @@ -158,8 +155,8 @@ static void sig_proc(int sn) case SIGTERM: if (++is_called > 3) exit(EXIT_SUCCESS); - if( shutdown_callback != NULL ) - shutdown_callback(); + if (core->shutdown_callback != NULL) + core->shutdown_callback(); else core->runflag = CORE_ST_STOP;// auto-shutdown break; diff --git a/src/map/script.c b/src/map/script.c index 410a707f1..ceb97ba54 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -1428,8 +1428,8 @@ const char* script_parse_subexpr(const char* p,int limit) p=script->skip_space(p); while(( (op=C_OP3, opl=0, len=1,*p=='?') // ?: - || (op=C_ADD, opl=9, len=1,*p=='+') // + - || (op=C_SUB, opl=9, len=1,*p=='-') // - + || (op=C_ADD, opl=9, len=1,*p=='+' && p[1]!='+') // + + || (op=C_SUB, opl=9, len=1,*p=='-' && p[1]!='-') // - || (op=C_POW, opl=11,len=2,*p=='*' && p[1]=='*') // ** || (op=C_MUL, opl=10,len=1,*p=='*') // * || (op=C_DIV, opl=10,len=1,*p=='/') // / @@ -21160,6 +21160,7 @@ BUILDIN(instance_create) const char *name; int owner_id, res; int type = IOT_PARTY; + struct map_session_data *sd = map->id2sd(st->rid); name = script_getstr(st, 2); owner_id = script_getnum(st, 3); @@ -21172,22 +21173,43 @@ BUILDIN(instance_create) } res = instance->create(owner_id, name, (enum instance_owner_type) type); - if( res == -4 ) { // Already exists - script_pushint(st, -1); - return true; - } else if( res < 0 ) { + if (sd != NULL) { + switch (res) { + case -4: // Already exists + clif->msgtable_str(sd, MSG_MDUNGEON_SUBSCRIPTION_ERROR_DUPLICATE, name); + break; + case -3: // No free instances + clif->msgtable_str(sd, MSG_MDUNGEON_SUBSCRIPTION_ERROR_EXIST, name); + break; + case -2: // Invalid type + clif->msgtable_str(sd, MSG_MDUNGEON_SUBSCRIPTION_ERROR_RIGHT, name); + break; + case -1: // Unknown + clif->msgtable_str(sd, MSG_MDUNGEON_SUBSCRIPTION_ERROR_UNKNOWN, name); + break; + default: + if (res < 0) + ShowError("buildin_instance_create: failed to unknown reason [%d].\n", res); + } + } else { const char *err; - switch(res) { - case -3: err = "No free instances"; break; - case -2: err = "Invalid party ID"; break; - case -1: err = "Invalid type"; break; - default: err = "Unknown"; break; + switch (res) { + case -3: + err = "No free instances"; + break; + case -2: + err = "Invalid party ID"; + break; + case -1: + err = "Invalid type"; + break; + default: + err = "Unknown"; + break; } - ShowError("buildin_instance_create: %s [%d].\n", err, res); - script_pushint(st, -2); - return true; + if (res < 0) + ShowError("buildin_instance_create: %s [%d].\n", err, res); } - script_pushint(st, res); return true; } @@ -23860,7 +23882,7 @@ bool rodex_sendmail_sub(struct script_state* st, struct rodex_message *msg) { const char *sender_name, *title, *body; - if (!strcmp(script->getfuncname(st), "rodex_sendmail_acc2")) + if (strcmp(script->getfuncname(st), "rodex_sendmail_acc") == 0 || strcmp(script->getfuncname(st), "rodex_sendmail_acc2") == 0) msg->receiver_accountid = script_getnum(st, 2); else msg->receiver_id = script_getnum(st, 2); diff --git a/src/map/skill.c b/src/map/skill.c index 6eacde897..34c36d7f3 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -15027,8 +15027,9 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id, } break; default: - skill->check_condition_castend_unknown(sd, &skill_id, &skill_lv); - break; + if (!skill->check_condition_castend_unknown(sd, &skill_id, &skill_lv)) + break; + return 0; } st = &sd->battle_status; @@ -15115,8 +15116,9 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id, return 1; } -void skill_check_condition_castend_unknown(struct map_session_data* sd, uint16 *skill_id, uint16 *skill_lv) +bool skill_check_condition_castend_unknown(struct map_session_data* sd, uint16 *skill_id, uint16 *skill_lv) { + return false; } // type&2: consume items (after skill was used) diff --git a/src/map/skill.h b/src/map/skill.h index e16094eae..bd1dc3344 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -2172,7 +2172,7 @@ struct skill_interface { int (*check_condition_castbegin_mount_unknown) (struct status_change *sc, uint16 *skill_id); int (*check_condition_castbegin_madogear_unknown) (struct status_change *sc, uint16 *skill_id); int (*check_condition_castbegin_unknown) (struct status_change *sc, uint16 *skill_id); - void (*check_condition_castend_unknown) (struct map_session_data* sd, uint16 *skill_id, uint16 *skill_lv); + bool (*check_condition_castend_unknown) (struct map_session_data* sd, uint16 *skill_id, uint16 *skill_lv); bool (*get_requirement_off_unknown) (struct status_change *sc, uint16 *skill_id); bool (*get_requirement_item_unknown) (struct status_change *sc, struct map_session_data* sd, uint16 *skill_id, uint16 *skill_lv, uint16 *idx, int *i); void (*get_requirement_unknown) (struct status_change *sc, struct map_session_data* sd, uint16 *skill_id, uint16 *skill_lv, struct skill_condition *req); diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 7c609f0bf..9ae123779 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -7102,8 +7102,8 @@ typedef int (*HPMHOOK_pre_skill_check_condition_castbegin_madogear_unknown) (str typedef int (*HPMHOOK_post_skill_check_condition_castbegin_madogear_unknown) (int retVal___, struct status_change *sc, uint16 *skill_id); typedef int (*HPMHOOK_pre_skill_check_condition_castbegin_unknown) (struct status_change **sc, uint16 **skill_id); typedef int (*HPMHOOK_post_skill_check_condition_castbegin_unknown) (int retVal___, struct status_change *sc, uint16 *skill_id); -typedef void (*HPMHOOK_pre_skill_check_condition_castend_unknown) (struct map_session_data **sd, uint16 **skill_id, uint16 **skill_lv); -typedef void (*HPMHOOK_post_skill_check_condition_castend_unknown) (struct map_session_data *sd, uint16 *skill_id, uint16 *skill_lv); +typedef bool (*HPMHOOK_pre_skill_check_condition_castend_unknown) (struct map_session_data **sd, uint16 **skill_id, uint16 **skill_lv); +typedef bool (*HPMHOOK_post_skill_check_condition_castend_unknown) (bool retVal___, struct map_session_data *sd, uint16 *skill_id, uint16 *skill_lv); typedef bool (*HPMHOOK_pre_skill_get_requirement_off_unknown) (struct status_change **sc, uint16 **skill_id); typedef bool (*HPMHOOK_post_skill_get_requirement_off_unknown) (bool retVal___, struct status_change *sc, uint16 *skill_id); typedef bool (*HPMHOOK_pre_skill_get_requirement_item_unknown) (struct status_change **sc, struct map_session_data **sd, uint16 **skill_id, uint16 **skill_lv, uint16 **idx, int **i); diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index bd2ef870f..a74fc4edb 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -76386,31 +76386,32 @@ int HP_skill_check_condition_castbegin_unknown(struct status_change *sc, uint16 } return retVal___; } -void HP_skill_check_condition_castend_unknown(struct map_session_data *sd, uint16 *skill_id, uint16 *skill_lv) { +bool HP_skill_check_condition_castend_unknown(struct map_session_data *sd, uint16 *skill_id, uint16 *skill_lv) { int hIndex = 0; + bool retVal___ = false; if (HPMHooks.count.HP_skill_check_condition_castend_unknown_pre > 0) { - void (*preHookFunc) (struct map_session_data **sd, uint16 **skill_id, uint16 **skill_lv); + bool (*preHookFunc) (struct map_session_data **sd, uint16 **skill_id, uint16 **skill_lv); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_check_condition_castend_unknown_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_check_condition_castend_unknown_pre[hIndex].func; - preHookFunc(&sd, &skill_id, &skill_lv); + retVal___ = preHookFunc(&sd, &skill_id, &skill_lv); } if (*HPMforce_return) { *HPMforce_return = false; - return; + return retVal___; } } { - HPMHooks.source.skill.check_condition_castend_unknown(sd, skill_id, skill_lv); + retVal___ = HPMHooks.source.skill.check_condition_castend_unknown(sd, skill_id, skill_lv); } if (HPMHooks.count.HP_skill_check_condition_castend_unknown_post > 0) { - void (*postHookFunc) (struct map_session_data *sd, uint16 *skill_id, uint16 *skill_lv); + bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, uint16 *skill_id, uint16 *skill_lv); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_check_condition_castend_unknown_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_check_condition_castend_unknown_post[hIndex].func; - postHookFunc(sd, skill_id, skill_lv); + retVal___ = postHookFunc(retVal___, sd, skill_id, skill_lv); } } - return; + return retVal___; } bool HP_skill_get_requirement_off_unknown(struct status_change *sc, uint16 *skill_id) { int hIndex = 0; |