diff options
41 files changed, 643 insertions, 731 deletions
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 000000000..c661cbd47 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,54 @@ +[//]: # (**********************************) +[//]: # (** Fill in the following fields **) +[//]: # (**********************************) + +[//]: # (Note: Lines beginning with syntax such as this one, are comments and will not be visible in your report!) + +### Issue Prelude + +[//]: # (Please complete these mandatory steps and check the following boxes by putting an `x` inside the brackets _before_ filing your issue) + +- [ ] I have not modified the source prior to reproducing this issue. +- [ ] I am using the latest version of Hercules. +- [ ] I am aware that this report will be closed or deleted if it becomes obvious that I am stating the false. + +### Description + +[//]: # (Description of the problem or issue at length.) +[//]: # (Please specify any battle configuration related to the components of this issue that have been changed from the default values. This will allow quicker determination of the cause of the problem.) + +### Current Behavior + +[//]: # (Describe at length what you noticed during your analysis.) +[//]: # (If this is a crash, post the core/stack-dump or crash-log to https://gist.github.com/) +[//]: # (If you are referencing from sources such as iROwiki or ratemyserver.net, please quote specific information rather than providing the links alone.) + +### Expected Behavior + +[//]: # (Tell us what should happen instead.) + +### Steps To Reproduce The Issue + +1. Step 1 +2. Step 2 +3. Step 3 + +**Branch(es):** +- [ ] master +- [ ] other + +**Hercules rev. hash/commit:** + +Git revision src: + +[//]: # (Copy the first 3 lines of the login-server, char-server or map-server startup.) +[//]: # ( [Info]: Hercules 64-bit for Mac OS X ) +[//]: # ( [Info]: Git revision src: 'a5918b329ca0826b04dca32ede783586403f58db' ) +[//]: # ( [Info]: Git revision scripts: 'a5918b329ca0826b04dca32ede783586403f58db' ) + +### Operating System + +[//]: # (Mac OS X 10.12.3 16D32 [x86_64]) +[//]: # (Thank you for adhering to this process! It ensures your issue is resolved quickly and that neither your nor our time is needlessly wasted.) +[//]: # (This template is for problem reports. For other types of report, edit it accordingly.) +[//]: # (For fixes please create a Pull Request.) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..c62641f08 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,37 @@ +[//]: # (**********************************) +[//]: # (** Fill in the following fields **) +[//]: # (**********************************) + +[//]: # (Note: Lines beginning with syntax such as this one, are comments and will not be visible in your report!) + +### Pull Request Prelude + +[//]: # (Thank you for working on improving Hercules!) + +[//]: # (Please complete these steps and check the following boxes by putting an `x` inside the brackets _before_ filing your Pull Request.) + +- [ ] I have followed [proper Hercules code styling][code]. +- [ ] I have read and understood the [contribution guidelines][cont] before making this PR. +- [ ] I am aware that this PR will be closed if the above-mentioned criteria are not fulfilled. + +### Changes Proposed + +[//]: # (Describe at length, the changes that this pull request makes.) + +**Affected Branches:** + +[//]: # (Master? Slave?) + +**Issues addressed:** + +[//]: # (Issue Tracker Number if any.) + +### Known Issues and TODO List + +[//]: # (Insert checklist here) +[//]: # (Syntax: - [ ] Checkbox) + +[//]: # (**NOTE** Enable the setting "[√] Allow edits from maintainers." when creating your pull request if you have not already enabled it.) + +[cont]: https://github.com/HerculesWS/Hercules/blob/master/CONTRIBUTING.md +[code]: https://github.com/HerculesWS/Hercules/wiki/Coding-Style diff --git a/db/pre-re/job_db.conf b/db/pre-re/job_db.conf index 5f5131726..74a765fbf 100644 --- a/db/pre-re/job_db.conf +++ b/db/pre-re/job_db.conf @@ -335,6 +335,7 @@ Priest: { Mace: 600 TwoHandMace: 600 Rod: 600 + // Knuckle: 500 /* Note. Official value is 2000 (default). To normalize aspd remove comment to this line. */ Book: 600 TwoHandRod: 600 } diff --git a/db/pre-re/map_zone_db.conf b/db/pre-re/map_zone_db.conf index cab00bbb9..b8797a6d3 100644 --- a/db/pre-re/map_zone_db.conf +++ b/db/pre-re/map_zone_db.conf @@ -66,7 +66,7 @@ zones: ( //heal: 70 } skill_damage_cap: { - //Exemple Below caps firebolt damage in maps within this zone to a maximum 50 damage, + //Example Below caps Cold Bolt damage in maps within this zone to a maximum 50 damage, // (depends on HMAP_ZONE_DAMAGE_CAP_TYPE in src/config/core.h) // when cast vs players and monsters. //MG_COLDBOLT: (50,"PLAYER | MONSTER") @@ -334,6 +334,19 @@ zones: ( SC_FATALMENACE: "PLAYER" SC_DIMENSIONDOOR: "PLAYER" } + + mapflags: ( + "nobranch", + "noicewall", + "nomemo", + "nosave SavePoint", + "noteleport", + "monster_noteleport", + "nowarpto", + "partylock", + "pvp off", + "src4instance", + ) }, { name: "Memorial Dungeon" /* ETower, Orc's Memory, Nidhoggur's Nest, etc */ @@ -347,6 +360,19 @@ zones: ( SC_FATALMENACE: "PLAYER" SC_DIMENSIONDOOR: "PLAYER" } + + mapflags: ( + "nobranch", + "noicewall", + "nomemo", + "nosave SavePoint", + "noteleport", + "monster_noteleport", + "nowarpto", + "partylock", + "pvp off", + "src4instance", + ) }, { name: "Towns" diff --git a/db/pre-re/skill_db.conf b/db/pre-re/skill_db.conf index 95683a9e0..a5c27257f 100644 --- a/db/pre-re/skill_db.conf +++ b/db/pre-re/skill_db.conf @@ -14881,11 +14881,10 @@ skill_db: ( Range: -9 Hit: "BDT_MULTIHIT" SkillType: { - Self: true + Enemy: true } SkillInfo: { Spirit: true - NoCastSelf: true } AttackType: "Weapon" Element: "Ele_Weapon" diff --git a/db/quest_db.conf b/db/quest_db.conf index 015692b07..98a7ee190 100644 --- a/db/quest_db.conf +++ b/db/quest_db.conf @@ -15275,6 +15275,18 @@ quest_db: ( TimeLimit: 14400 }, { + Id: 60211 + Name: "Thor Volcano base camp" +}, +{ + Id: 60212 + Name: "Thor Volcano base camp" +}, +{ + Id: 60213 + Name: "Thor Volcano base camp" +}, +{ Id: 60301 Name: "Dragon Hunting" Targets: ( diff --git a/db/re/map_zone_db.conf b/db/re/map_zone_db.conf index 282a85abb..133cc5337 100644 --- a/db/re/map_zone_db.conf +++ b/db/re/map_zone_db.conf @@ -55,37 +55,6 @@ zones: ( //Both examples below disable apple (id 501) //Apple: true //ID501: true - } - - mapflags: ( - ) - - /* "command:min-group-lv-to-override" e.g. "heal: 70" */ - disabled_commands: { - //Example Below makes @heal be used in maps within this zone only by those group lv 70 and above - //heal: 70 - } - skill_damage_cap: { - //Exemple Below caps firebolt damage in maps within this zone to a maximum 50 damage, - // (depends on HMAP_ZONE_DAMAGE_CAP_TYPE in src/config/core.h) - // when cast vs players and monsters. - //MG_COLDBOLT: (50,"PLAYER | MONSTER") - } -}, -{ - /* Normal zone is applied to all maps that are not pkable (where players cant fight each other) */ - /* However, it wont be applied to maps with its own zones (specified through mapflag) */ - name: "Normal" /* changing this name requires MAP_ZONE_NORMAL_NAME to also be changed in src/map/map.h file */ - - disabled_skills: { - WM_LULLABY_DEEPSLEEP: "PLAYER" - WM_SIRCLEOFNATURE: "PLAYER" - WM_SATURDAY_NIGHT_FEVER: "PLAYER" - SO_ARRULLO: "PLAYER" - CG_HERMODE: "PLAYER" - } - - disabled_items: { Velum_Jamadhar: true Velum_Scare: true Velum_Buster: true @@ -124,6 +93,37 @@ zones: ( mapflags: ( ) + /* "command:min-group-lv-to-override" e.g. "heal: 70" */ + disabled_commands: { + //Example Below makes @heal be used in maps within this zone only by those group lv 70 and above + //heal: 70 + } + skill_damage_cap: { + //Example Below caps Cold Bolt damage in maps within this zone to a maximum 50 damage, + // (depends on HMAP_ZONE_DAMAGE_CAP_TYPE in src/config/core.h) + // when cast vs players and monsters. + //MG_COLDBOLT: (50,"PLAYER | MONSTER") + } +}, +{ + /* Normal zone is applied to all maps that are not pkable (where players cant fight each other) */ + /* However, it wont be applied to maps with its own zones (specified through mapflag) */ + name: "Normal" /* changing this name requires MAP_ZONE_NORMAL_NAME to also be changed in src/map/map.h file */ + + disabled_skills: { + WM_LULLABY_DEEPSLEEP: "PLAYER" + WM_SIRCLEOFNATURE: "PLAYER" + WM_SATURDAY_NIGHT_FEVER: "PLAYER" + SO_ARRULLO: "PLAYER" + CG_HERMODE: "PLAYER" + } + + disabled_items: { + } + + mapflags: ( + ) + }, { /* PvP zone is applied to all maps with a pvp mapflag */ @@ -137,6 +137,38 @@ zones: ( disabled_items: { Greed_Scroll: true C_Beginner_Cap: true + Velum_Jamadhar: false + Velum_Scare: false + Velum_Buster: false + Velum_Guillotine: false + Velum_Spear: false + Velum_Glaive: false + Velum_Bible: false + Velum_Encyclopedia: false + Velum_Claw: false + Velum_Arc_Wand: false + Velum_Damascus: false + Velum_Stunner: false + Velum_Flail: false + Velum_Arbalest: false + Velum_CrossBow: false + Velum_Claymore: false + Velum_Katzbalger: false + Siege_Arrow_A: false + Siege_Arrow_S: false + Siege_Greave: false + Siege_Boots: false + Siege_Shoes: false + Siege_Manteau: false + Siege_Muffler: false + Siege_White_Potion: false + Siege_Blue_Potion: false + Woe_Violet_Potion: false + Woe_White_Potion: false + Woe_Blue_Potion: false + Siege_Plate: false + Siege_Suits: false + Siege_Robe: false } /* cashshop disabled in pvp maps */ @@ -298,40 +330,6 @@ zones: ( disabled_items: { Assumptio_5_Scroll: true Pty_Assumptio_Scroll: true - Velum_Jamadhar: true - Velum_Scare: true - Velum_Buster: true - Velum_Guillotine: true - Velum_Spear: true - Velum_Glaive: true - Velum_Bible: true - Velum_Encyclopedia: true - Velum_Claw: true - Velum_Arc_Wand: true - Velum_Damascus: true - Velum_Stunner: true - Velum_Flail: true - Velum_Arbalest: true - Velum_CrossBow: true - Velum_Claymore: true - Velum_Katzbalger: true - Siege_Arrow_A: true - Siege_Arrow_S: true - Siege_Greave: true - Siege_Boots: true - Siege_Shoes: true - Siege_Manteau: true - Siege_Muffler: true - Siege_White_Potion: true - Siege_Blue_Potion: true - Woe_Violet_Potion: true - Woe_White_Potion: true - Woe_Blue_Potion: true - TE_White_Potion: true - TE_White_Slim_Potion: true - Siege_Plate: true - Siege_Suits: true - Siege_Robe: true C_Beginner_Cap: true } @@ -445,6 +443,19 @@ zones: ( SC_FATALMENACE: "PLAYER" SC_DIMENSIONDOOR: "PLAYER" } + + mapflags: ( + "nobranch", + "noicewall", + "nomemo", + "nosave SavePoint", + "noteleport", + "monster_noteleport", + "nowarpto", + "partylock", + "pvp off", + "src4instance", + ) }, { name: "Memorial Dungeon" /* ETower, Orc's Memory, Nidhoggur's Nest, etc */ @@ -458,6 +469,19 @@ zones: ( SC_FATALMENACE: "PLAYER" SC_DIMENSIONDOOR: "PLAYER" } + + mapflags: ( + "nobranch", + "noicewall", + "nomemo", + "nosave SavePoint", + "noteleport", + "monster_noteleport", + "nowarpto", + "partylock", + "pvp off", + "src4instance", + ) }, { name: "Towns" @@ -474,40 +498,6 @@ zones: ( disabled_items: { Greed_Scroll: true - Velum_Jamadhar: true - Velum_Scare: true - Velum_Buster: true - Velum_Guillotine: true - Velum_Spear: true - Velum_Glaive: true - Velum_Bible: true - Velum_Encyclopedia: true - Velum_Claw: true - Velum_Arc_Wand: true - Velum_Damascus: true - Velum_Stunner: true - Velum_Flail: true - Velum_Arbalest: true - Velum_CrossBow: true - Velum_Claymore: true - Velum_Katzbalger: true - Siege_Arrow_A: true - Siege_Arrow_S: true - Siege_Greave: true - Siege_Boots: true - Siege_Shoes: true - Siege_Manteau: true - Siege_Muffler: true - Siege_White_Potion: true - Siege_Blue_Potion: true - Woe_Violet_Potion: true - Woe_White_Potion: true - Woe_Blue_Potion: true - TE_White_Potion: true - TE_White_Slim_Potion: true - Siege_Plate: true - Siege_Suits: true - Siege_Robe: true } } ) diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 77b361498..b202f1b6b 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -1371,11 +1371,10 @@ Examples: --------------------------------------- -*getd("<variable name>"{, <GID>{, <default value>}}) +*getd("<variable name>") Returns a reference to a variable, the name can be constructed dynamically. -If <GID> is present, it can be used to get a variable from another player or -npc. If the target player or npc is not found, <default value> is returned. +Refer to setd() for usage. This can also be used to set an array dynamically: setarray(getd(".array[0]"), 1, 2, 3, 4, 5); @@ -1410,6 +1409,27 @@ getvariableofnpc() should not be used on them. --------------------------------------- +*getvariableofpc(<variable>, <account id>{, <default value>}) + +Returns a reference to a PC variable from the target player. +If <default value> is passed, it will return this value if the player is +not found. + +Examples: + +//This will return the value of @var, note that this can't be used, since +//the value isn't caught. + getvariableofpc(@var, getcharid(CHAR_ID_ACCOUNT, "player")); + +//This will set the .@v variable to the value of the player's @var +//variable. + .@v = getvariableofpc(@var, getcharid(CHAR_ID_ACCOUNT, "player")); + +//This will set the @var variable of the player to 1. + set(getvariableofpc(@var, getcharid(CHAR_ID_ACCOUNT, "player")), 1); + +--------------------------------------- + *goto(<label>) This command will make the script jump to a label, usually used in @@ -2342,7 +2362,7 @@ deleted. //===================================== --------------------------------------- -*strcharinfo(<type>) +*strcharinfo(<type>{, <default value>{, <GID>}}) This function will return either the name, party name or guild name for the invoking character. Whatever it returns is determined by type. @@ -2350,6 +2370,10 @@ the invoking character. Whatever it returns is determined by type. (1) PC_PARTY - The name of the party they're in if any. (2) PC_GUILD - The name of the guild they're in if any. (3) PC_MAP - The name of the map the character is in. + +If <GID> is passed, it will return the value of the specified player instead +the attached player. If the player is not found, it will return +<default value>, if any, or else return an empty string. If a character is not a member of any party or guild, an empty string will be returned when requesting that information. @@ -2359,7 +2383,7 @@ using only numbers reduces script readability --------------------------------------- -*strnpcinfo(<type>) +*strnpcinfo(<type>{, <default value>{, <GID>}}) This function will return the various parts of the name of the calling NPC. Whatever it returns is determined by type. @@ -2370,6 +2394,10 @@ Whatever it returns is determined by type. (3) NPC_NAME_UNIQUE - The NPC's unique name (::name) (4) NPC_MAP - The name of the map the NPC is in. +If <GID> is passed, it will return the value of the specified NPC instead of +the attached NPC. If the NPC is not found, it will return <default value>, +if any, or else return an empty string. + --------------------------------------- *charid2rid(<char id>) @@ -4293,7 +4321,7 @@ Example: --------------------------------------- -*warpguild("<mapname>", <x>, <y>, <guild_id>) +*warpguild("<mapname>", <x>, <y>, <guild_id>, {"<from_mapname>"}) Warps a guild to specified map and coordinate given the guild id, which you can get with getcharid(CHAR_ID_GUILD). You can also request another guild id given @@ -4307,9 +4335,12 @@ SavePoint: All guild members are warped to the save point of the currently attached player (will fail if there's no player attached). +If you specify a from_mapname, warpguild() will only affect those on that map. + Example: warpguild("prontera", x, y, Guild_ID); + warpguild("prontera", x, y, Guild_ID, "payon"); // warp member from Payon map only. --------------------------------------- @@ -6447,15 +6478,16 @@ Size is 0 = normal 1 = small 2 = big. //===================================== --------------------------------------- -*addtimer(<ticks>, "NPC::OnLabel") -*deltimer("NPC::OnLabel") -*addtimercount("NPC::OnLabel", <ticks>) +*addtimer(<ticks>, "NPC::OnLabel"{, <account id>}) +*deltimer("NPC::OnLabel"{, <account id>}) +*addtimercount("NPC::OnLabel", <ticks>{, <account id>}) These commands will create, destroy, and delay a countdown timer - addtimer() to create, deltimer() to destroy and addtimercount() to delay it by the specified number of ticks. For all three cases, the event label given is the identifier of that timer. The timer runs on the character -object that is attached to the script, and can have multiple instances. +object that is attached to the script, and can have multiple instances. +If <acccount id> is passed, this player will be used instead. When the label is run, it is run as if the player that the timer runs on has clicked the NPC. diff --git a/npc/instances/EndlessTower.txt b/npc/instances/EndlessTower.txt index e6947d2a4..f94bc177a 100644 --- a/npc/instances/EndlessTower.txt +++ b/npc/instances/EndlessTower.txt @@ -36,13 +36,6 @@ //= 2.4 //========================================================================= -1@tower mapflag src4instance -2@tower mapflag src4instance -3@tower mapflag src4instance -4@tower mapflag src4instance -5@tower mapflag src4instance -6@tower mapflag src4instance - alberta,214,77,6 script Captain Janssen 4_M_SEAMAN,{ if (checkweight(Knife,1) == 0) { mes "^008800Wait here!!"; diff --git a/npc/instances/NydhoggsNest.txt b/npc/instances/NydhoggsNest.txt index 16df567e3..2c583d441 100644 --- a/npc/instances/NydhoggsNest.txt +++ b/npc/instances/NydhoggsNest.txt @@ -33,9 +33,6 @@ //= 1.6 //========================================================================= -1@nyd mapflag src4instance -2@nyd mapflag src4instance - nyd_dun02,100,201,3 script Yggdrasil Gatekeeper HIDDEN_NPC,8,8,{ if (ins_nyd == 0) { mes "A great stone gate stands before you. The sculpture of a terrible dragon spreads its powerful looking wings."; @@ -165,6 +162,10 @@ nyd_dun02,100,201,3 script Yggdrasil Gatekeeper HIDDEN_NPC,8,8,{ close; goto L_Enter; } else { + .@instance = has_instance2("1@nyd"); + if (.@instance >= 0) { + instance_attach(.@instance); + } if (.@ins_nyd_check == 1) { if ('ins_nyd2 == 3 || 'ins_nyd2 == 4) { mes "[Yggdrasil Gatekeeper]"; diff --git a/npc/instances/OrcsMemory.txt b/npc/instances/OrcsMemory.txt index 48412a631..28cc9bbd5 100644 --- a/npc/instances/OrcsMemory.txt +++ b/npc/instances/OrcsMemory.txt @@ -33,9 +33,6 @@ //= 1.7 //========================================================================= -1@orcs mapflag src4instance -2@orcs mapflag src4instance - //== Entrance ============================================== gef_fild10,242,202,0 script Dimensional Gorge Piece 2_MONEMUS,{ diff --git a/npc/instances/SealedShrine.txt b/npc/instances/SealedShrine.txt index 90efe6f5c..de59b7599 100644 --- a/npc/instances/SealedShrine.txt +++ b/npc/instances/SealedShrine.txt @@ -35,9 +35,6 @@ //= 2.3 //========================================================================= -1@cata mapflag src4instance -2@cata mapflag src4instance - //== Sealed Catacomb Entrance ============================== monk_test,309,146,3 script Friar Patrick#edq 4_M_OLDFRIAR,{ cutin "ins_cata_pri_n",2; diff --git a/npc/mapflag/nobranch.txt b/npc/mapflag/nobranch.txt index 60db05cf5..4ad59ad67 100644 --- a/npc/mapflag/nobranch.txt +++ b/npc/mapflag/nobranch.txt @@ -306,15 +306,7 @@ que_qaru04 mapflag nobranch que_qaru05 mapflag nobranch // Episode 12 =========== -1@cata mapflag nobranch -2@cata mapflag nobranch e_tower mapflag nobranch -1@tower mapflag nobranch -2@tower mapflag nobranch -3@tower mapflag nobranch -4@tower mapflag nobranch -5@tower mapflag nobranch -6@tower mapflag nobranch // Episode 13.1 =========== mid_camp mapflag nobranch @@ -325,8 +317,6 @@ que_dan01 mapflag nobranch que_dan02 mapflag nobranch schg_que01 mapflag nobranch arug_que01 mapflag nobranch -1@orcs mapflag nobranch -2@orcs mapflag nobranch // Battle Grounds ============== bat_c01 mapflag nobranch @@ -339,8 +329,6 @@ bat_a01 mapflag nobranch bat_a02 mapflag nobranch // Episode 13.2 =========== -1@nyd mapflag nobranch -2@nyd mapflag nobranch manuk mapflag nobranch man_fild02 mapflag nobranch man_in01 mapflag nobranch @@ -377,7 +365,6 @@ s_atelier mapflag nobranch // Episode 14.1 & Dewata =========== mora mapflag nobranch -1@mist mapflag nobranch dewata mapflag nobranch dew_in01 mapflag nobranch @@ -385,16 +372,9 @@ dew_in01 mapflag nobranch malangdo mapflag nobranch mal_in01 mapflag nobranch mal_in02 mapflag nobranch -1@cash mapflag nobranch -1@pump mapflag nobranch -2@pump mapflag nobranch -1@lhz mapflag nobranch malaya mapflag nobranch ma_scene01 mapflag nobranch ma_in01 mapflag nobranch -1@ma_h mapflag nobranch -1@ma_c mapflag nobranch -1@ma_b mapflag nobranch // Episode 14.2 =========== eclage mapflag nobranch @@ -402,7 +382,6 @@ ecl_in01 mapflag nobranch ecl_in02 mapflag nobranch ecl_in03 mapflag nobranch ecl_in04 mapflag nobranch -1@ecl mapflag nobranch ecl_hub01 mapflag nobranch // Episode 14.3 =========== @@ -411,12 +390,6 @@ c_tower3_ mapflag nobranch gl_chyard_ mapflag nobranch gl_cas02_ mapflag nobranch -// Ghost Palace =========== -1@spa mapflag nobranch - -// Sara's Memory Instance =========== -1@sara mapflag nobranch - //evt_zombie mapflag nobranch // Poring War ================== diff --git a/npc/mapflag/noicewall.txt b/npc/mapflag/noicewall.txt index 6c1af1b09..195bec2bb 100644 --- a/npc/mapflag/noicewall.txt +++ b/npc/mapflag/noicewall.txt @@ -159,53 +159,6 @@ nguild_gef mapflag noicewall nguild_pay mapflag noicewall nguild_prt mapflag noicewall -//Endless Tower ================== -1@tower mapflag noicewall -2@tower mapflag noicewall -3@tower mapflag noicewall -4@tower mapflag noicewall -5@tower mapflag noicewall -6@tower mapflag noicewall - -// Orc's Memory =================== -1@orcs mapflag noicewall -2@orcs mapflag noicewall - -// Nidhoggr's Instance =========== -1@nyd mapflag noicewall -2@nyd mapflag noicewall - -// Misty Forest Labyrinth =========== -1@mist mapflag noicewall - -// Octopus Cave =========== -1@cash mapflag noicewall - -// Drain =========== -1@pump mapflag noicewall -2@pump mapflag noicewall - -// Somatology Laboratory =========== -1@lhz mapflag noicewall - -// Bangungot Hospital F2 =========== -1@ma_h mapflag noicewall - -// Buwaya Cave =========== -1@ma_c mapflag noicewall - -// Bakonawa Hideout =========== -1@ma_b mapflag noicewall - -// Inside Eclage =========== -1@ecl mapflag noicewall - -// Ghost Palace =========== -1@spa mapflag noicewall - -// Sara's Memory Instance =========== -1@sara mapflag noicewall - // Poring War ==================== poring_w01 mapflag noicewall poring_w02 mapflag noicewall diff --git a/npc/mapflag/nomemo.txt b/npc/mapflag/nomemo.txt index a0dd66e9d..662bf4c05 100644 --- a/npc/mapflag/nomemo.txt +++ b/npc/mapflag/nomemo.txt @@ -656,18 +656,8 @@ que_qaru03 mapflag nomemo que_qaru04 mapflag nomemo que_qaru05 mapflag nomemo -//Sealed Shrine ================== -1@cata mapflag nomemo -2@cata mapflag nomemo - //Endless Tower ================== e_tower mapflag nomemo -1@tower mapflag nomemo -2@tower mapflag nomemo -3@tower mapflag nomemo -4@tower mapflag nomemo -5@tower mapflag nomemo -6@tower mapflag nomemo // Battle Grounds ================ bat_c01 mapflag nomemo @@ -731,7 +721,6 @@ dic_dun02 mapflag nomemo // Episode 14 ==================== bif_fild01 mapflag nomemo bif_fild02 mapflag nomemo -1@mist mapflag nomemo mora mapflag nomemo dew_dun01 mapflag nomemo dew_dun02 mapflag nomemo @@ -740,13 +729,9 @@ dic_dun03 mapflag nomemo mal_in01 mapflag nomemo mal_in02 mapflag nomemo mal_dun01 mapflag nomemo -1@cash mapflag nomemo -1@pump mapflag nomemo -2@pump mapflag nomemo iz_dun05 mapflag nomemo lhz_dun04 mapflag nomemo que_lhz mapflag nomemo -1@lhz mapflag nomemo gld_dun01_2 mapflag nomemo gld_dun02_2 mapflag nomemo gld_dun03_2 mapflag nomemo @@ -758,9 +743,6 @@ gld2_prt mapflag nomemo ma_scene01 mapflag nomemo ma_in01 mapflag nomemo ma_dun01 mapflag nomemo -1@ma_h mapflag nomemo -1@ma_c mapflag nomemo -1@ma_b mapflag nomemo ma_zif01 mapflag nomemo ma_zif02 mapflag nomemo ma_zif03 mapflag nomemo @@ -776,7 +758,6 @@ ecl_in01 mapflag nomemo ecl_in02 mapflag nomemo ecl_in03 mapflag nomemo ecl_in04 mapflag nomemo -1@ecl mapflag nomemo ecl_tdun01 mapflag nomemo ecl_tdun02 mapflag nomemo ecl_tdun03 mapflag nomemo @@ -791,20 +772,6 @@ c_tower3_ mapflag nomemo gl_chyard_ mapflag nomemo gl_cas02_ mapflag nomemo -//Orc's Memory =================== -1@orcs mapflag nomemo -2@orcs mapflag nomemo - -// Nidhoggr's Instance =========== -1@nyd mapflag nomemo -2@nyd mapflag nomemo - -// Ghost Palace =========== -1@spa mapflag nomemo - -// Sara's Memory Instance =========== -1@sara mapflag nomemo - //evt_zombie mapflag nomemo // Poring War ==================== diff --git a/npc/mapflag/nopvp.txt b/npc/mapflag/nopvp.txt index 8a396bf69..41127332b 100644 --- a/npc/mapflag/nopvp.txt +++ b/npc/mapflag/nopvp.txt @@ -32,30 +32,6 @@ //= Prevents PvP mode on a map. //========================================================================= -1@cata mapflag pvp off -2@cata mapflag pvp off -1@nyd mapflag pvp off -2@nyd mapflag pvp off -1@orcs mapflag pvp off -2@orcs mapflag pvp off -1@tower mapflag pvp off -2@tower mapflag pvp off -3@tower mapflag pvp off -4@tower mapflag pvp off -5@tower mapflag pvp off -6@tower mapflag pvp off -1@mist mapflag pvp off -1@cash mapflag pvp off -1@pump mapflag pvp off -2@pump mapflag pvp off -1@lhz mapflag pvp off -1@ma_h mapflag pvp off -1@ma_c mapflag pvp off -1@ma_b mapflag pvp off -1@ecl mapflag pvp off -1@spa mapflag pvp off -1@sara mapflag pvp off - bat_a01 mapflag pvp off bat_a02 mapflag pvp off bat_b01 mapflag pvp off diff --git a/npc/mapflag/nosave.txt b/npc/mapflag/nosave.txt index 3465cc0c3..8137e500b 100644 --- a/npc/mapflag/nosave.txt +++ b/npc/mapflag/nosave.txt @@ -281,18 +281,8 @@ que_qaru03 mapflag nosave SavePoint que_qaru04 mapflag nosave SavePoint que_qaru05 mapflag nosave SavePoint -// Sealed Shrine ================== -1@cata mapflag nosave SavePoint -2@cata mapflag nosave SavePoint - // Endless Tower ================== e_tower mapflag nosave SavePoint -1@tower mapflag nosave SavePoint -2@tower mapflag nosave SavePoint -3@tower mapflag nosave SavePoint -4@tower mapflag nosave SavePoint -5@tower mapflag nosave SavePoint -6@tower mapflag nosave SavePoint // Battle Grounds ============== bat_c01 mapflag nosave SavePoint @@ -312,45 +302,8 @@ schg_dun01 mapflag nosave SavePoint arug_que01 mapflag nosave SavePoint arug_dun01 mapflag nosave SavePoint -// Orc's Memory =================== -1@orcs mapflag nosave SavePoint -2@orcs mapflag nosave SavePoint - -// Nidhoggr's Instance =========== -1@nyd mapflag nosave SavePoint -2@nyd mapflag nosave SavePoint - -// Misty Forest Labyrinth =========== -1@mist mapflag nosave SavePoint - -// Octopus Cave =========== -1@cash mapflag nosave SavePoint - -// Drain =========== -1@pump mapflag nosave SavePoint -2@pump mapflag nosave SavePoint - // Somatology Laboratory =========== que_lhz mapflag nosave SavePoint -1@lhz mapflag nosave SavePoint - -// Bangungot Hospital F2 =========== -1@ma_h mapflag nosave SavePoint - -// Buwaya Cave =========== -1@ma_c mapflag nosave SavePoint - -// Bakonawa Hideout =========== -1@ma_b mapflag nosave SavePoint - -// Inside Eclage =========== -1@ecl mapflag nosave SavePoint - -// Ghost Palace =========== -1@spa mapflag nosave SavePoint - -// Sara's Memory Instance =========== -1@sara mapflag nosave SavePoint //evt_zombie mapflag nosave SavePoint diff --git a/npc/mapflag/noteleport.txt b/npc/mapflag/noteleport.txt index 8b1109ef1..700964da4 100644 --- a/npc/mapflag/noteleport.txt +++ b/npc/mapflag/noteleport.txt @@ -368,26 +368,8 @@ que_qaru04 mapflag monster_noteleport que_qaru05 mapflag noteleport que_qaru05 mapflag monster_noteleport -//Sealed Shrine ================== -1@cata mapflag noteleport -1@cata mapflag monster_noteleport -2@cata mapflag noteleport -2@cata mapflag monster_noteleport - //Endless Tower ================== e_tower mapflag noteleport -1@tower mapflag noteleport -1@tower mapflag monster_noteleport -2@tower mapflag noteleport -2@tower mapflag monster_noteleport -3@tower mapflag noteleport -3@tower mapflag monster_noteleport -4@tower mapflag noteleport -4@tower mapflag monster_noteleport -5@tower mapflag noteleport -5@tower mapflag monster_noteleport -6@tower mapflag noteleport -6@tower mapflag monster_noteleport // Battle Grounds ============== bat_c01 mapflag noteleport @@ -413,29 +395,13 @@ bra_in01 mapflag noteleport dic_in01 mapflag noteleport // Episode 14 ==================== -1@mist mapflag noteleport -1@mist mapflag monster_noteleport dew_in01 mapflag noteleport mal_in01 mapflag noteleport mal_in02 mapflag noteleport -1@cash mapflag noteleport -1@cash mapflag monster_noteleport -1@pump mapflag noteleport -1@pump mapflag monster_noteleport -2@pump mapflag noteleport -2@pump mapflag monster_noteleport que_lhz mapflag noteleport que_lhz mapflag monster_noteleport -1@lhz mapflag noteleport -1@lhz mapflag monster_noteleport ma_scene01 mapflag noteleport ma_in01 mapflag noteleport -1@ma_h mapflag noteleport -1@ma_h mapflag monster_noteleport -1@ma_c mapflag noteleport -1@ma_c mapflag monster_noteleport -1@ma_b mapflag noteleport -1@ma_b mapflag monster_noteleport ma_zif01 mapflag noteleport ma_zif02 mapflag noteleport ma_zif03 mapflag noteleport @@ -449,35 +415,13 @@ ecl_in01 mapflag noteleport ecl_in02 mapflag noteleport ecl_in03 mapflag noteleport ecl_in04 mapflag noteleport -1@ecl mapflag noteleport -1@ecl mapflag monster_noteleport ecl_hub01 mapflag noteleport dali mapflag noteleport dali02 mapflag noteleport -//Orc's Memory =================== -1@orcs mapflag noteleport -1@orcs mapflag monster_noteleport -2@orcs mapflag noteleport -2@orcs mapflag monster_noteleport - // Yggdrasil Dungeon ============= nyd_dun02 mapflag noteleport -// Nidhoggr's Instance =========== -1@nyd mapflag noteleport -1@nyd mapflag monster_noteleport -2@nyd mapflag noteleport -2@nyd mapflag monster_noteleport - -// Ghost Palace =========== -1@spa mapflag noteleport -1@spa mapflag monster_noteleport - -// Sara's Memory Instance =========== -1@sara mapflag noteleport -1@sara mapflag monster_noteleport - //evt_zombie mapflag noteleport // Poring War ==================== diff --git a/npc/mapflag/nowarpto.txt b/npc/mapflag/nowarpto.txt index 34d093ae2..783dc8cc9 100644 --- a/npc/mapflag/nowarpto.txt +++ b/npc/mapflag/nowarpto.txt @@ -115,18 +115,8 @@ que_qaru03 mapflag nowarpto que_qaru04 mapflag nowarpto que_qaru05 mapflag nowarpto -//Sealed Shrine ================== -1@cata mapflag nowarpto -2@cata mapflag nowarpto - //Endless Tower ================== e_tower mapflag nowarpto -1@tower mapflag nowarpto -2@tower mapflag nowarpto -3@tower mapflag nowarpto -4@tower mapflag nowarpto -5@tower mapflag nowarpto -6@tower mapflag nowarpto // Battle Grounds ============== bat_c01 mapflag nowarpto @@ -160,17 +150,6 @@ splendide mapflag nowarpto spl_fild01 mapflag nowarpto spl_in01 mapflag nowarpto -//Orc's Memory =================== -1@orcs mapflag nowarpto -2@orcs mapflag nowarpto - -// Nidhoggr's Instance =========== -1@nyd mapflag nowarpto -2@nyd mapflag nowarpto - -// Ghost Palace =========== -1@spa mapflag nowarpto - // Poring War ==================== poring_w01 mapflag nowarpto poring_w02 mapflag nowarpto diff --git a/npc/mapflag/partylock.txt b/npc/mapflag/partylock.txt index 9e604fedc..1aa9d4991 100644 --- a/npc/mapflag/partylock.txt +++ b/npc/mapflag/partylock.txt @@ -33,54 +33,3 @@ //= Blocks all party modifications on a map: //= /organize, /leave, /invite, @changeleader //========================================================================= - -// Sealed Shrine ================== -1@cata mapflag partylock -2@cata mapflag partylock - -// Endless Tower ================== -1@tower mapflag partylock -2@tower mapflag partylock -3@tower mapflag partylock -4@tower mapflag partylock -5@tower mapflag partylock -6@tower mapflag partylock - -// Orc's Memory =================== -1@orcs mapflag partylock -2@orcs mapflag partylock - -// Nidhoggr's Instance =========== -1@nyd mapflag partylock -2@nyd mapflag partylock - -// Misty Forest Labyrinth =========== -1@mist mapflag partylock - -// Octopus Cave =========== -1@cash mapflag partylock - -// Drain =========== -1@pump mapflag partylock -2@pump mapflag partylock - -// Somatology Laboratory =========== -1@lhz mapflag partylock - -// Bangungot Hospital F2 =========== -1@ma_h mapflag partylock - -// Buwaya Cave =========== -1@ma_c mapflag partylock - -// Bakonawa Hideout =========== -1@ma_b mapflag partylock - -// Inside Eclage =========== -1@ecl mapflag partylock - -// Ghost Palace =========== -1@spa mapflag partylock - -// Sara's Memory Instance =========== -1@sara mapflag partylock diff --git a/npc/mapflag/zone.txt b/npc/mapflag/zone.txt index cb73a32ec..b90116911 100644 --- a/npc/mapflag/zone.txt +++ b/npc/mapflag/zone.txt @@ -75,37 +75,6 @@ prt_are_in mapflag zone Izlude Battle Arena 1@nyd mapflag zone Memorial Dungeon 2@nyd mapflag zone Memorial Dungeon -// Misty Forest Labyrinth =========== -1@mist mapflag zone Memorial Dungeon - -// Octopus Cave =========== -1@cash mapflag zone Memorial Dungeon - -// Drain =========== -1@pump mapflag zone Memorial Dungeon -2@pump mapflag zone Memorial Dungeon - -// Somatology Laboratory =========== -1@lhz mapflag zone Memorial Dungeon - -// Bangungot Hospital F2 =========== -1@ma_h mapflag zone Memorial Dungeon - -// Buwaya Cave =========== -1@ma_c mapflag zone Memorial Dungeon - -// Bakonawa Hideout =========== -1@ma_b mapflag zone Memorial Dungeon - -// Inside Eclage =========== -1@ecl mapflag zone Memorial Dungeon - -// Ghost Palace =========== -1@spa mapflag zone Memorial Dungeon - -// Sara's Memory Instance =========== -1@sara mapflag zone Memorial Dungeon - //Towns alberta mapflag zone Towns aldebaran mapflag zone Towns diff --git a/npc/other/Global_Functions.txt b/npc/other/Global_Functions.txt index f6068d598..544e3a672 100644 --- a/npc/other/Global_Functions.txt +++ b/npc/other/Global_Functions.txt @@ -156,16 +156,6 @@ function script F_Rand { return getarg(rand(getargcount())); } -//== Function F_Sex ======================================== -// Returns 1st argument if female, 2nd argument otherwise -// Example: mes callfunc("F_Sex","What a beautiful lady!","What a handsome man!"); -function script F_SexMes { - if (Sex == SEX_MALE) - return getarg(0); - else - return getarg(1); -} - //== Function F_Hi ========================================= // Returns random HELLO message function script F_Hi { diff --git a/npc/quests/the_sign_quest.txt b/npc/quests/the_sign_quest.txt index dd3750543..cf593eaae 100644 --- a/npc/quests/the_sign_quest.txt +++ b/npc/quests/the_sign_quest.txt @@ -12249,11 +12249,12 @@ OnInit: end; OnTouch: - geffenia_warp = rand(1,4); - if (geffenia_warp == 1) warp "gefenia01",58,169; - else if (geffenia_warp == 2) warp "gefenia02",116,115; - else if (geffenia_warp == 3) warp "gefenia03",130,206; - else if (geffenia_warp == 4) warp "gefenia04",133,88; + callfunc("F_UpdateSignVars"); + .@geffenia_warp = rand(1,4); + if (.@geffenia_warp == 1) warp "gefenia01",58,169; + else if (.@geffenia_warp == 2) warp "gefenia02",116,115; + else if (.@geffenia_warp == 3) warp "gefenia03",130,206; + else if (.@geffenia_warp == 4) warp "gefenia04",133,88; else warp "geffen",116,115; end; @@ -12644,6 +12645,7 @@ function script F_UpdateSignVars { Sign_Branch2B = 0; serinring = 0; signmetzhour = 0; + geffenia_warp = 0; } return; } diff --git a/npc/re/instances/BakonawaLake.txt b/npc/re/instances/BakonawaLake.txt index 5e2ae7f33..2868cc589 100644 --- a/npc/re/instances/BakonawaLake.txt +++ b/npc/re/instances/BakonawaLake.txt @@ -33,8 +33,6 @@ //= 1.1 //========================================================================= -1@ma_b mapflag src4instance - ma_scene01,174,179,4 script Taho 4_M_DEWZATIMAN,{ disable_items; if (checkweight(Knife,1) == 0) { diff --git a/npc/re/instances/BangungotHospital.txt b/npc/re/instances/BangungotHospital.txt index 1504f892f..3962ee4fa 100644 --- a/npc/re/instances/BangungotHospital.txt +++ b/npc/re/instances/BangungotHospital.txt @@ -33,8 +33,6 @@ //= 1.1 //========================================================================= -1@ma_h mapflag src4instance - //== Instance Creation ===================================== ma_dun01,147,10,5 script Nurse#ma_dun01 4_F_NURSE,{ if (BaseLevel < 100) end; diff --git a/npc/re/instances/BuwayaCave.txt b/npc/re/instances/BuwayaCave.txt index 242d0a8e4..859d6bd85 100644 --- a/npc/re/instances/BuwayaCave.txt +++ b/npc/re/instances/BuwayaCave.txt @@ -33,8 +33,6 @@ //= 1.0 //========================================================================= -1@ma_c mapflag src4instance - ma_fild02,312,317,5 script Guard#buwaya_cave 4_MAL_SOLDIER,{ if (BaseLevel < 130) { mes "[Guard]"; diff --git a/npc/re/instances/HazyForest.txt b/npc/re/instances/HazyForest.txt index 7f85fee50..c649171f8 100644 --- a/npc/re/instances/HazyForest.txt +++ b/npc/re/instances/HazyForest.txt @@ -33,8 +33,6 @@ //= 1.1 //========================================================================= -1@mist mapflag src4instance - //== Instance Creation ===================================== bif_fild01,158,340,5 script Laphine Soldier#mist 4_M_FAIRYSOLDIER,{ diff --git a/npc/re/instances/MalangdoCulvert.txt b/npc/re/instances/MalangdoCulvert.txt index 164caf548..1bd76aedb 100644 --- a/npc/re/instances/MalangdoCulvert.txt +++ b/npc/re/instances/MalangdoCulvert.txt @@ -35,9 +35,6 @@ //= 1.1 //========================================================================= -1@pump mapflag src4instance -2@pump mapflag src4instance - //== Quest NPCs ============================================ mal_in01,172,28,2 script Albo#mal 4_CAT_SAILOR5,{ if (checkweight(Knife,1) == 0) { diff --git a/npc/re/instances/OldGlastHeim.txt b/npc/re/instances/OldGlastHeim.txt index bf099cd2d..9f3f29fdf 100644 --- a/npc/re/instances/OldGlastHeim.txt +++ b/npc/re/instances/OldGlastHeim.txt @@ -36,8 +36,6 @@ //================= Current Version ======================================= //= 1.2 //========================================================================= -1@gl_k mapflag src4instance -2@gl_k mapflag src4instance glast_01,204,273,6 script Hugin#ghinstance 4_M_SAGE_C,{ if (BaseLevel < 130) { // iRO text diff --git a/npc/re/instances/WolfchevLaboratory.txt b/npc/re/instances/WolfchevLaboratory.txt index e88ec4332..51e2f8a06 100644 --- a/npc/re/instances/WolfchevLaboratory.txt +++ b/npc/re/instances/WolfchevLaboratory.txt @@ -33,8 +33,6 @@ //= 1.0.2 //========================================================================= -1@lhz mapflag src4instance - //== Giacomo Girolam ======================================= lighthalzen,303,303,6 script Giacomo Girolamo#kiup2 4_M_KHMAN,3,3,{ if ((MaxWeight - Weight) < 1000 || !checkweight(Knife, 1)) { diff --git a/npc/re/instances/ghost_palace.txt b/npc/re/instances/ghost_palace.txt index b1a8f3c10..6e77db2f8 100644 --- a/npc/re/instances/ghost_palace.txt +++ b/npc/re/instances/ghost_palace.txt @@ -30,7 +30,6 @@ //================= Current Version ======================================= //= 1.1 //========================================================================= -1@spa mapflag src4instance dali02,44,129,5 script Unpleasent Royal Guard 4_M_SAKRAYROYAL,{ if (BaseLevel < 120) { diff --git a/npc/re/instances/octopus_cave.txt b/npc/re/instances/octopus_cave.txt index b09d243ab..b134742c9 100644 --- a/npc/re/instances/octopus_cave.txt +++ b/npc/re/instances/octopus_cave.txt @@ -33,8 +33,6 @@ //= 1.1 //========================================================================= -1@cash mapflag src4instance - //== Instance Creation ===================================== mal_dun01,151,235,5 script Starfish 4_ASTER,{ diff --git a/npc/re/instances/saras_memory.txt b/npc/re/instances/saras_memory.txt index 2b3b4f2c0..38b598d5b 100644 --- a/npc/re/instances/saras_memory.txt +++ b/npc/re/instances/saras_memory.txt @@ -37,7 +37,6 @@ //================= Current Version ======================================= //= 1.1 //========================================================================= -1@sara mapflag src4instance dali,130,107,5 script Leon the Adventurer#Sara 4_M_DST_GRAND,{ // instance CD check only at the Dimensional Device mes("[Leon the Adventurer]"); diff --git a/npc/re/mapflag/zone.txt b/npc/re/mapflag/zone.txt index a6cfd95f1..24ffce665 100644 --- a/npc/re/mapflag/zone.txt +++ b/npc/re/mapflag/zone.txt @@ -32,6 +32,41 @@ //= Flags maps as part of zones defined in map_zone_db.txt //========================================================================= +// Misty Forest Labyrinth =========== +1@mist mapflag zone Memorial Dungeon + +// Octopus Cave =========== +1@cash mapflag zone Memorial Dungeon + +// Drain =========== +1@pump mapflag zone Memorial Dungeon +2@pump mapflag zone Memorial Dungeon + +// Somatology Laboratory =========== +1@lhz mapflag zone Memorial Dungeon + +// Bangungot Hospital F2 =========== +1@ma_h mapflag zone Memorial Dungeon + +// Buwaya Cave =========== +1@ma_c mapflag zone Memorial Dungeon + +// Bakonawa Hideout =========== +1@ma_b mapflag zone Memorial Dungeon + +// Inside Eclage =========== +1@ecl mapflag zone Memorial Dungeon + +// Old Glast Heim =========== +1@gl_k mapflag zone Memorial Dungeon +2@gl_k mapflag zone Memorial Dungeon + +// Ghost Palace =========== +1@spa mapflag zone Memorial Dungeon + +// Sara's Memory Instance =========== +1@sara mapflag zone Memorial Dungeon + // WoE:TE te_prt_gld mapflag zone WoE TE te_prtcas01 mapflag zone WoE TE diff --git a/npc/re/merchants/shadow_refiner.txt b/npc/re/merchants/shadow_refiner.txt index 4e5049e5f..2f8984498 100644 --- a/npc/re/merchants/shadow_refiner.txt +++ b/npc/re/merchants/shadow_refiner.txt @@ -158,7 +158,7 @@ itemmall,31,76,3 script Shadow Blacksmith#nomal 4_F_JOB_BLACKSMITH,{ } delitem .@choose,1; Zeny -= 20000; - if (getequippercentrefinery(.@SelectedPart) > rand(100) || getequippercentrefinery(.@SelectedPart) > rand(100)) { + if (getequippercentrefinery(.@SelectedPart) > rand(100) || ( .@option == 1 && getequippercentrefinery(.@SelectedPart) > rand(100))) { successrefitem .@SelectedPart; mes "[Shadow Blacksmith]"; mes "Refine was successful."; diff --git a/npc/woe-se/agit_main_se.txt b/npc/woe-se/agit_main_se.txt index c9b34f610..5f291e658 100644 --- a/npc/woe-se/agit_main_se.txt +++ b/npc/woe-se/agit_main_se.txt @@ -1681,6 +1681,10 @@ OnEnable: if (.@num == 3) set getd(".MyMobCount_"+.@num+strnpcinfo(NPC_NAME_HIDDEN)),4; else if (.@num) set getd(".MyMobCount_"+.@num+strnpcinfo(NPC_NAME_HIDDEN)),6; setwall strnpcinfo(NPC_NAME_HIDDEN),.@wall[0],.@wall[1],.@wall[2],.@wall[3],.@wall[4],substr(strnpcinfo(NPC_NAME_HIDDEN),0,1)+substr(strnpcinfo(NPC_NAME_HIDDEN),8,9)+"_"+strnpcinfo(NPC_NAME_VISIBLE); + if (.@num == 0) + setcell(strnpcinfo(NPC_NAME_HIDDEN), .@x[0], .@y[0], .@x[getarraysize(.@x)-1], .@y[getarraysize(.@y)-1], cell_basilica, true); + if (.@num == 1 && (strnpcinfo(NPC_NAME_HIDDEN) == "schg_cas01" || strnpcinfo(NPC_NAME_HIDDEN) == "schg_cas04" || strnpcinfo(NPC_NAME_HIDDEN) == "schg_cas05")) + setcell(strnpcinfo(NPC_NAME_HIDDEN), .@x[0], .@y[0], .@x[5], .@y[5], cell_basilica, true); .@j = (getd(".MyMobCount_"+.@num+strnpcinfo(NPC_NAME_HIDDEN)))?getd(".MyMobCount_"+.@num+strnpcinfo(NPC_NAME_HIDDEN)):getarraysize(.@x); for (.@i = 0; .@i<.@j; ++.@i) guardian strnpcinfo(NPC_NAME_HIDDEN),.@x[.@i],.@y[.@i]," ",1905,strnpcinfo(NPC_NAME)+"::OnBarrierDestroyed"; @@ -1700,6 +1704,31 @@ OnBarrierDestroyed: end; OnDisable: + if (compare(strnpcinfo(NPC_NAME_HIDDEN),"arug")) { + if (strnpcinfo(NPC_NAME_HIDDEN) == "arug_cas01") { + setarray(.@x[0], 239, 245); + setarray(.@y[0], 73, 73); + } else if (strnpcinfo(NPC_NAME_HIDDEN) == "arug_cas02") { + setarray(.@x[0], 137, 143); + setarray(.@y[0], 137, 137); + } else { // Castles 3, 4, 5 are identical. + setarray(.@x[0], 139, 145); + setarray(.@y[0], 111, 111); + } + } else { + if (strnpcinfo(NPC_NAME_HIDDEN) == "schg_cas02") { + setarray(.@x[0], 289, 289); + setarray(.@y[0], 98, 104); + } else if (strnpcinfo(NPC_NAME_HIDDEN) == "schg_cas03") { + setarray(.@x[0], 326, 330); + setarray(.@y[0], 300, 300); + } else { // Castles 1, 4, 5 are identical. + setarray(.@x[0], 115, 125); + setarray(.@y[0], 49, 49); + setcell(strnpcinfo(NPC_NAME_HIDDEN), 115, 50, 125, 50, cell_basilica, false); + } + } + setcell(strnpcinfo(NPC_NAME_HIDDEN), .@x[0], .@y[0], .@x[1], .@y[1], cell_basilica, false); delwall substr(strnpcinfo(NPC_NAME_HIDDEN),0,1)+substr(strnpcinfo(NPC_NAME_HIDDEN),8,9)+"_"+strnpcinfo(NPC_NAME_VISIBLE); killmonster strnpcinfo(NPC_NAME_HIDDEN),strnpcinfo(NPC_NAME)+"::OnBarrierDestroyed"; end; diff --git a/src/char/int_party.c b/src/char/int_party.c index 2fc39c328..921bf6d9d 100644 --- a/src/char/int_party.c +++ b/src/char/int_party.c @@ -633,31 +633,21 @@ int mapif_parse_PartyLeave(int fd, int party_id, int account_id, int char_id) return 0; //Member not found? mapif->party_withdraw(party_id, account_id, char_id); - - if (p->party.member[i].leader){ - p->party.member[i].account_id = 0; - for (j = 0; j < MAX_PARTY; j++) { - if (!p->party.member[j].account_id) - continue; - mapif->party_withdraw(party_id, p->party.member[j].account_id, p->party.member[j].char_id); - p->party.member[j].account_id = 0; - } - //Party gets deleted on the check_empty call below. - } else { - inter_party->tosql(&p->party,PS_DELMEMBER,i); - j = p->party.member[i].lv; - if(p->party.member[i].online) p->party.count--; - memset(&p->party.member[i], 0, sizeof(struct party_member)); - p->size--; - if (j == p->min_lv || j == p->max_lv || p->family) - { - if(p->family) p->family = 0; //Family state broken. - inter_party->check_lv(p); - } + + j = p->party.member[i].lv; + if (p->party.member[i].online > 0) + p->party.count--; + memset(&p->party.member[i], 0, sizeof(struct party_member)); + p->size--; + if (j == p->min_lv || j == p->max_lv || p->family) { + if(p->family) p->family = 0; //Family state broken. + inter_party->check_lv(p); } - if (inter_party->check_empty(p) == 0) + if (inter_party->check_empty(p) == 0) { + inter_party->tosql(&p->party, PS_DELMEMBER, i); mapif->party_info(-1, &p->party, 0); + } return 0; } // When member goes to other map or levels up. diff --git a/src/map/party.c b/src/map/party.c index 3bf9542c7..26b4bae8b 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -274,6 +274,7 @@ int party_recv_info(const struct party *sp, int char_id) int added_count = 0; int j; int member_id; + int leader_account_id = 0, leader_char_id = 0; nullpo_ret(sp); @@ -287,8 +288,12 @@ int party_recv_info(const struct party *sp, int char_id) ARR_FIND(0, MAX_PARTY, i, sp->member[i].account_id == member->account_id && sp->member[i].char_id == member->char_id); - if (i == MAX_PARTY) + if (i == MAX_PARTY) { removed[removed_count++] = member_id; + } else if (member->leader != 0) { + leader_account_id = member->account_id; + leader_char_id = member->char_id; + } } for (member_id = 0; member_id < MAX_PARTY; ++member_id) { member = &sp->member[member_id]; @@ -316,6 +321,7 @@ int party_recv_info(const struct party *sp, int char_id) continue;// not online party->member_withdraw(sp->party_id, sd->status.account_id, sd->status.char_id); } + memcpy(&p->party, sp, sizeof(struct party)); memset(&p->state, 0, sizeof(p->state)); memset(&p->data, 0, sizeof(p->data)); @@ -324,6 +330,8 @@ int party_recv_info(const struct party *sp, int char_id) if ( member->char_id == 0 ) continue;// empty p->data[member_id].sd = party->sd_check(sp->party_id, member->account_id, member->char_id); + if (member->account_id == leader_account_id && member->char_id == leader_char_id) + p->party.member[member_id].leader = 1; } party->check_state(p); while( added_count > 0 ) { // new in party @@ -591,11 +599,43 @@ int party_member_withdraw(int party_id, int account_id, int char_id) int i; ARR_FIND( 0, MAX_PARTY, i, p->party.member[i].account_id == account_id && p->party.member[i].char_id == char_id ); if( i < MAX_PARTY ) { + bool was_leader = false; + int prev_leader_accountId = 0; + if (p->party.member[i].leader != 0) { + was_leader = true; + prev_leader_accountId = p->party.member[i].account_id; + } + clif->party_withdraw(p,sd,account_id,p->party.member[i].name,0x0); memset(&p->party.member[i], 0, sizeof(p->party.member[0])); memset(&p->data[i], 0, sizeof(p->data[0])); p->party.count--; party->check_state(p); + + if (was_leader) { + int k; + // Member was party leader, try to pick a new leader from online members + ARR_FIND(0, MAX_PARTY, k, p->party.member[k].account_id != 0 && p->party.member[k].online == 1); + + if (k == MAX_PARTY) { + // No online members, get an offline one + ARR_FIND(0, MAX_PARTY, k, p->party.member[k].account_id != 0); + } + + if (k < MAX_PARTY) { + // Update party's leader + p->party.member[k].leader = 1; + + if (p->data[k].sd != NULL) { + /** update members **/ + clif->PartyLeaderChanged(p->data[k].sd, prev_leader_accountId, p->data[k].sd->status.account_id); + } + + //Update info. + intif->party_leaderchange(p->party.party_id, p->party.member[k].account_id, p->party.member[k].char_id); + clif->party_info(p, NULL); + } + } } } diff --git a/src/map/pc.c b/src/map/pc.c index 2cf5d75b4..9ef7d084f 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -387,7 +387,6 @@ int pc_banding(struct map_session_data *sd, uint16 skill_lv) { return c; } -// Increases a player's fame points and displays a notice to him /** * Increases a player's fame points and displays a notice to them. * diff --git a/src/map/script.c b/src/map/script.c index a1886d043..48c377d24 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -2825,7 +2825,7 @@ struct script_data *get_val(struct script_state* st, struct script_data* data) { char postfix; struct map_session_data *sd = NULL; - if( !data_isreference(data) ) + if (!data_isreference(data)) return data;// not a variable/constant name = reference_getname(data); @@ -2840,10 +2840,10 @@ struct script_data *get_val(struct script_state* st, struct script_data* data) { } //##TODO use reference_tovariable(data) when it's confirmed that it works [FlavioJS] - if( !reference_toconstant(data) && not_server_variable(prefix) ) { + if (!reference_toconstant(data) && not_server_variable(prefix) && reference_getref(data) == NULL) { sd = script->rid2sd(st); - if( sd == NULL ) {// needs player attached - if( postfix == '$' ) {// string variable + if (sd == NULL) {// needs player attached + if (postfix == '$') {// string variable ShowWarning("script_get_val: cannot access player variable '%s', defaulting to \"\"\n", name); data->type = C_CONSTSTR; data->u.str = ""; @@ -2919,7 +2919,7 @@ struct script_data *get_val(struct script_state* st, struct script_data* data) { } else if( reference_toparam(data) ) { data->u.num = pc->readparam(sd, reference_getparamtype(data)); } else { - switch(prefix) { + switch (prefix) { case '@': if (data->ref) { data->u.num = script->get_val_ref_num(st, data->ref, data); @@ -2933,7 +2933,7 @@ struct script_data *get_val(struct script_state* st, struct script_data* data) { case '#': if (data->ref) { data->u.num = script->get_val_ref_num(st, data->ref, data); - } else if(name[1] == '#') { + } else if (name[1] == '#') { data->u.num = pc_readaccountreg2(sd, data->u.num);// global } else { data->u.num = pc_readaccountreg(sd, data->u.num);// local @@ -2960,7 +2960,6 @@ struct script_data *get_val(struct script_state* st, struct script_data* data) { break; } } - } data->ref = NULL; @@ -3133,38 +3132,43 @@ void script_array_add_member(struct script_array *sa, unsigned int idx) { **/ struct reg_db *script_array_src(struct script_state *st, struct map_session_data *sd, const char *name, struct reg_db *ref) { struct reg_db *src = NULL; - nullpo_retr(NULL, name); - switch( name[0] ) { + + switch (name[0]) { /* from player */ - default: /* char reg */ - case '@':/* temp char reg */ - case '#':/* account reg */ + default: /* char reg */ + case '@':/* temp char reg */ + case '#':/* account reg */ + if (ref != NULL) { + src = ref; + } else { nullpo_retr(NULL, sd); src = &sd->regs; - break; - case '$':/* map reg */ - src = &mapreg->regs; - break; - case '.':/* npc/script */ - if (ref != NULL) { - src = ref; - } else { - nullpo_retr(NULL, st); - src = (name[1] == '@') ? &st->stack->scope : &st->script->local; - } - break; - case '\'':/* instance */ + } + break; + case '$':/* map reg */ + src = &mapreg->regs; + break; + case '.':/* npc/script */ + if (ref != NULL) { + src = ref; + } else { nullpo_retr(NULL, st); - if( st->instance_id >= 0 ) { - src = &instance->list[st->instance_id].regs; - } - break; + src = (name[1] == '@') ? &st->stack->scope : &st->script->local; + } + break; + case '\'':/* instance */ + nullpo_retr(NULL, st); + if (st->instance_id >= 0) { + src = &instance->list[st->instance_id].regs; + } + break; } - if( src ) { - if( !src->arrays ) + if (src) { + if (!src->arrays) { src->arrays = idb_alloc(DB_OPT_BASE); + } return src; } return NULL; @@ -3317,7 +3321,7 @@ int set_reg(struct script_state *st, struct map_session_data *sd, int64 num, con return 0; } - if(is_string_variable(name)) {// string variable + if (is_string_variable(name)) {// string variable const char *str = (const char*)value; switch (prefix) { @@ -3329,7 +3333,8 @@ int set_reg(struct script_state *st, struct map_session_data *sd, int64 num, con } return 1; case '$': - return mapreg->setregstr(num, str); + mapreg->setregstr(num, str); + return 1; case '#': if (ref) { script->set_reg_ref_str(st, ref, num, name, str); @@ -3364,16 +3369,17 @@ int set_reg(struct script_state *st, struct map_session_data *sd, int64 num, con // to a 32bit int, this will lead to overflows! [Panikon] int val = (int)h64BPTRSIZE(value); - if(script->str_data[script_getvarid(num)].type == C_PARAM) { - if( pc->setparam(sd, script->str_data[script_getvarid(num)].val, val) == 0 ) { - if( st != NULL ) { + if (script->str_data[script_getvarid(num)].type == C_PARAM) { + if (pc->setparam(sd, script->str_data[script_getvarid(num)].val, val) == 0) { + if (st != NULL) { ShowError("script:set_reg: failed to set param '%s' to %d.\n", name, val); script->reportsrc(st); // Instead of just stop the script execution we let the character close // the window if it was open. st->state = (sd->state.dialog) ? CLOSE : END; - if( st->state == CLOSE ) + if(st->state == CLOSE) { clif->scriptclose(sd, st->oid); + } } return 0; } @@ -3389,7 +3395,8 @@ int set_reg(struct script_state *st, struct map_session_data *sd, int64 num, con } return 1; case '$': - return mapreg->setreg(num, val); + mapreg->setreg(num, val); + return 1; case '#': if (ref) { script->set_reg_ref_num(st, ref, num, name, val); @@ -6665,61 +6672,67 @@ BUILDIN(warpparty) } /*========================================== * Warpguild - [Fredzilla] - * Syntax: warpguild "mapname",x,y,Guild_ID; + * Syntax: warpguild "mapname",x,y,Guild_ID,{"from_mapname"}; *------------------------------------------*/ BUILDIN(warpguild) { struct map_session_data *sd = NULL; - struct map_session_data *pl_sd; struct guild* g; - struct s_mapiterator* iter; int type; + int i; + int16 map_id = -1; - const char* str = script_getstr(st,2); - int x = script_getnum(st,3); - int y = script_getnum(st,4); - int gid = script_getnum(st,5); + const char *str = script_getstr(st, 2); + int x = script_getnum(st, 3); + int y = script_getnum(st, 4); + int gid = script_getnum(st, 5); + + if (script_hasdata(st, 6)) { + map_id = map->mapname2mapid(script_getstr(st, 6)); + } g = guild->search(gid); - if( g == NULL ) + if (g == NULL) return true; - type = ( strcmp(str,"Random")==0 ) ? 0 - : ( strcmp(str,"SavePointAll")==0 ) ? 1 - : ( strcmp(str,"SavePoint")==0 ) ? 2 + type = (strcmp(str, "Random") == 0) ? 0 + : (strcmp(str, "SavePointAll") == 0) ? 1 + : (strcmp(str, "SavePoint") == 0) ? 2 : 3; - if( type == 2 && ( sd = script->rid2sd(st) ) == NULL ) + if (type == 2 && (sd = script->rid2sd(st)) == NULL) {// "SavePoint" uses save point of the currently attached player return true; } - iter = mapit_getallusers(); - for (pl_sd = BL_UCAST(BL_PC, mapit->first(iter)); mapit->exists(iter); pl_sd = BL_UCAST(BL_PC, mapit->next(iter))) { - if( pl_sd->status.guild_id != gid ) - continue; + for (i = 0; i < MAX_GUILD; i++) { + if (g->member[i].online && g->member[i].sd != NULL) { + struct map_session_data *pl_sd = g->member[i].sd; - switch( type ) - { + if (map_id >= 0 && map_id != pl_sd->bl.m) + continue; + + switch (type) + { case 0: // Random - if(!map->list[pl_sd->bl.m].flag.nowarp) - pc->randomwarp(pl_sd,CLR_TELEPORT); + if (!map->list[pl_sd->bl.m].flag.nowarp) + pc->randomwarp(pl_sd, CLR_TELEPORT); break; case 1: // SavePointAll - if(!map->list[pl_sd->bl.m].flag.noreturn) - pc->setpos(pl_sd,pl_sd->status.save_point.map,pl_sd->status.save_point.x,pl_sd->status.save_point.y,CLR_TELEPORT); + if (!map->list[pl_sd->bl.m].flag.noreturn) + pc->setpos(pl_sd, pl_sd->status.save_point.map, pl_sd->status.save_point.x, pl_sd->status.save_point.y, CLR_TELEPORT); break; case 2: // SavePoint - if(!map->list[pl_sd->bl.m].flag.noreturn) - pc->setpos(pl_sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT); + if (!map->list[pl_sd->bl.m].flag.noreturn) + pc->setpos(pl_sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT); break; case 3: // m,x,y - if(!map->list[pl_sd->bl.m].flag.noreturn && !map->list[pl_sd->bl.m].flag.nowarp) - pc->setpos(pl_sd,script->mapindexname2id(st,str),x,y,CLR_TELEPORT); + if (!map->list[pl_sd->bl.m].flag.noreturn && !map->list[pl_sd->bl.m].flag.nowarp) + pc->setpos(pl_sd, script->mapindexname2id(st, str), x, y, CLR_TELEPORT); break; + } } } - mapit->free(iter); return true; } @@ -8740,39 +8753,48 @@ BUILDIN(getguildmember) *------------------------------------------*/ BUILDIN(strcharinfo) { - int num; struct guild* g; struct party_data* p; - struct map_session_data *sd = script->rid2sd(st); - if (sd == NULL) //Avoid crashing.... + struct map_session_data *sd; + + if (script_hasdata(st, 4)) + sd = map->id2sd(script_getnum(st, 4)); + else + sd = script->rid2sd(st); + + if (sd == NULL) { + if(script_hasdata(st, 3)) { + script_pushcopy(st, 3); + } else { + script_pushconststr(st, ""); + } return true; + } - num=script_getnum(st,2); - switch(num) { - case 0: - script_pushstrcopy(st,sd->status.name); - break; - case 1: - if( ( p = party->search(sd->status.party_id) ) != NULL ) { - script_pushstrcopy(st,p->party.name); - } else { - script_pushconststr(st,""); - } - break; - case 2: - if( ( g = sd->guild ) != NULL ) { - script_pushstrcopy(st,g->name); - } else { - script_pushconststr(st,""); - } - break; - case 3: - script_pushconststr(st,map->list[sd->bl.m].name); - break; - default: - ShowWarning("buildin_strcharinfo: unknown parameter.\n"); - script_pushconststr(st,""); - break; + switch (script_getnum(st, 2)) { + case 0: + script_pushstrcopy(st, sd->status.name); + break; + case 1: + if ((p = party->search(sd->status.party_id)) != NULL) { + script_pushstrcopy(st, p->party.name); + } else { + script_pushconststr(st, ""); + } + break; + case 2: + if ((g = sd->guild) != NULL) { + script_pushstrcopy(st, g->name); + } else { + script_pushconststr(st, ""); + } + break; + case 3: + script_pushconststr(st, map->list[sd->bl.m].name); + break; + default: + ShowWarning("script:strcharinfo: unknown parameter.\n"); + script_pushconststr(st, ""); } return true; @@ -8789,41 +8811,51 @@ BUILDIN(strcharinfo) *------------------------------------------*/ BUILDIN(strnpcinfo) { - int num; char *buf,*name=NULL; - struct npc_data *nd = map->id2nd(st->oid); + struct npc_data *nd; + + if (script_hasdata(st, 4)) + nd = map->id2nd(script_getnum(st, 4)); + else + nd = map->id2nd(st->oid); + if (nd == NULL) { - script_pushconststr(st, ""); + if (script_hasdata(st, 3)) { + script_pushcopy(st, 3); + } else { + script_pushconststr(st, ""); + } return true; } - num = script_getnum(st,2); - switch(num) { - case 0: // display name + switch (script_getnum(st,2)) { + case 0: // display name + name = aStrdup(nd->name); + break; + case 1: // visible part of display name + if ((buf = strchr(nd->name,'#')) != NULL) { name = aStrdup(nd->name); - break; - case 1: // visible part of display name - if((buf = strchr(nd->name,'#')) != NULL) - { - name = aStrdup(nd->name); - name[buf - nd->name] = 0; - } else // Return the name, there is no '#' present - name = aStrdup(nd->name); - break; - case 2: // # fragment - if((buf = strchr(nd->name,'#')) != NULL) - name = aStrdup(buf+1); - break; - case 3: // unique name - name = aStrdup(nd->exname); - break; - case 4: // map name - if( nd->bl.m >= 0 ) // Only valid map indexes allowed (issue:8034) - name = aStrdup(map->list[nd->bl.m].name); - break; + name[buf - nd->name] = 0; + } else { // Return the name, there is no '#' present + name = aStrdup(nd->name); + } + break; + case 2: // # fragment + if ((buf = strchr(nd->name,'#')) != NULL) { + name = aStrdup(buf+1); + } + break; + case 3: // unique name + name = aStrdup(nd->exname); + break; + case 4: // map name + if (nd->bl.m >= 0) { // Only valid map indexes allowed (issue:8034) + name = aStrdup(map->list[nd->bl.m].name); + } + break; } - if(name) + if (name) script_pushstr(st, name); else script_pushconststr(st, ""); @@ -10759,19 +10791,29 @@ BUILDIN(donpcevent) *------------------------------------------*/ BUILDIN(addtimer) { - int tick = script_getnum(st,2); + int tick = script_getnum(st, 2); const char* event = script_getstr(st, 3); struct map_session_data *sd; script->check_event(st, event); - sd = script->rid2sd(st); - if( sd == NULL ) - return true; - if (!pc->addeventtimer(sd,tick,event)) { - ShowWarning("buildin_addtimer: Event timer is full, can't add new event timer. (cid:%d timer:%s)\n",sd->status.char_id,event); + if (script_hasdata(st, 4)) + sd = map->id2sd(script_getnum(st, 4)); + else + sd = script->rid2sd(st); + + if (sd == NULL) { + script_pushint(st, 0); + return false; + } + + if (!pc->addeventtimer(sd, tick, event)) { + ShowWarning("script:addtimer: Event timer is full, can't add new event timer. (cid:%d timer:%s)\n", sd->status.char_id, event); + script_pushint(st, 0); return false; } + + script_pushint(st, 1); return true; } /*========================================== @@ -10782,12 +10824,17 @@ BUILDIN(deltimer) struct map_session_data *sd; event=script_getstr(st, 2); - sd = script->rid2sd(st); - if( sd == NULL ) + + if (script_hasdata(st, 3)) + sd = map->id2sd(script_getnum(st, 3)); + else + sd = script->rid2sd(st); + + if (sd == NULL) return true; script->check_event(st, event); - pc->deleventtimer(sd,event); + pc->deleventtimer(sd, event); return true; } /*========================================== @@ -10798,14 +10845,19 @@ BUILDIN(addtimercount) int tick; struct map_session_data *sd; - event=script_getstr(st, 2); - tick=script_getnum(st,3); - sd = script->rid2sd(st); - if( sd == NULL ) + event = script_getstr(st, 2); + tick = script_getnum(st, 3); + + if (script_hasdata(st, 4)) + sd = map->id2sd(script_getnum(st, 4)); + else + sd = script->rid2sd(st); + + if (sd == NULL) return true; script->check_event(st, event); - pc->addeventtimercount(sd,event,tick); + pc->addeventtimercount(sd, event, tick); return true; } @@ -16549,11 +16601,7 @@ BUILDIN(escape_sql) return true; } -BUILDIN(getd) -{ - struct block_list *bl = NULL; - struct map_session_data *sd; - struct npc_data *nd; +BUILDIN(getd) { char varname[100]; const char *buffer; int elem; @@ -16563,63 +16611,8 @@ BUILDIN(getd) if (sscanf(buffer, "%99[^[][%d]", varname, &elem) < 2) elem = 0; - if (strlen(varname) < 1) { - ShowError("script:getd: variable cannot be empty\n"); - script->reportdata(script_getdata(st, 2)); - script_pushnil(st); - st->state = END; - return false; - } - - if (script_hasdata(st, 3)) { - bl = map->id2bl(script_getnum(st, 3)); - - if (bl == NULL) { - // being not found, push default value - if (script_hasdata(st, 4)) { - script_pushcopy(st, 4); - } else if (varname[strlen(varname) - 1] == '$') { - script_pushconststr(st, ""); - } else { - script_pushint(st, 0); - } - return false; - } else if (bl->type == BL_NPC && (varname[0] != '.' || varname[1] == '@')) { - ShowError("script:getd: invalid scope (not npc variable)\n"); - script->reportdata(script_getdata(st, 2)); - script_pushnil(st); - st->state = END; - return false; - } else if (bl->type == BL_PC && (varname[0] == '.' || varname[0] == '$' || varname[0] == '\'')) { - ShowError("script:getd: invalid scope (not pc variable)\n"); - script->reportdata(script_getdata(st, 2)); - script_pushnil(st); - st->state = END; - return false; - } - } - // Push the 'pointer' so it's more flexible [Lance] - - if (bl != NULL) { - switch (bl->type) { - case BL_PC: - sd = map->id2sd(bl->id); - script->push_val(st->stack, C_NAME, reference_uid(script->add_str(varname), elem), &sd->regs); - break; - case BL_NPC: - nd = map->id2nd(bl->id); - script->push_val(st->stack, C_NAME, reference_uid(script->add_str(varname), elem), &nd->u.scr.script->local); - break; - default: - ShowError("script:getd: invalid being type (not npc or pc)\n"); - script_pushnil(st); - st->state = END; - return false; - } - } else { - script->push_val(st->stack, C_NAME, reference_uid(script->add_str(varname), elem), NULL); - } + script->push_val(st->stack, C_NAME, reference_uid(script->add_str(varname), elem),NULL); return true; } @@ -17646,6 +17639,55 @@ BUILDIN(getvariableofnpc) return true; } +BUILDIN(getvariableofpc) +{ + const char* name; + struct script_data* data = script_getdata(st, 2); + struct map_session_data *sd = map->id2sd(script_getnum(st, 3)); + + if (!data_isreference(data)) { + ShowError("script:getvariableofpc: not a variable\n"); + script->reportdata(data); + script_pushnil(st); + st->state = END; + return false; + } + + name = reference_getname(data); + + switch (*name) + { + case '#': + case '$': + case '.': + case '\'': + ShowError("script:getvariableofpc: illegal scope (not pc variable)\n"); + script->reportdata(data); + script_pushnil(st); + st->state = END; + return false; + } + + if (sd == NULL) + { + // player not found, return default value + if (script_hasdata(st, 4)) { + script_pushcopy(st, 4); + } else if (is_string_variable(name)) { + script_pushconststr(st, ""); + } else { + script_pushint(st, 0); + } + return true; + } + + if (!sd->regs.vars) + sd->regs.vars = i64db_alloc(DB_OPT_RELEASE_DATA); + + script->push_val(st->stack, C_NAME, reference_getuid(data), &sd->regs); + return true; +} + /// Opens a warp portal. /// Has no "portal opening" effect/sound, it opens the portal immediately. /// @@ -20965,7 +21007,7 @@ void script_parse_builtin(void) { BUILDIN_DEF(areawarp,"siiiisii??"), BUILDIN_DEF(warpchar,"siii"), // [LuzZza] BUILDIN_DEF(warpparty,"siii?"), // [Fredzilla] [Paradox924X] - BUILDIN_DEF(warpguild,"siii"), // [Fredzilla] + BUILDIN_DEF(warpguild,"siii?"), // [Fredzilla] BUILDIN_DEF(setlook,"ii"), BUILDIN_DEF(changelook,"ii"), // Simulates but don't Store it BUILDIN_DEF2(__setr,"set","rv"), @@ -21006,8 +21048,8 @@ void script_parse_builtin(void) { BUILDIN_DEF(getguildmaster,"i"), BUILDIN_DEF(getguildmasterid,"i"), BUILDIN_DEF(getguildmember,"i?"), - BUILDIN_DEF(strcharinfo,"i"), - BUILDIN_DEF(strnpcinfo,"i"), + BUILDIN_DEF(strcharinfo,"i??"), + BUILDIN_DEF(strnpcinfo,"i??"), BUILDIN_DEF(charid2rid,"i"), BUILDIN_DEF(getequipid,"i"), BUILDIN_DEF(getequipname,"i"), @@ -21070,9 +21112,9 @@ void script_parse_builtin(void) { BUILDIN_DEF(clone,"siisi????"), BUILDIN_DEF(doevent,"s"), BUILDIN_DEF(donpcevent,"s"), - BUILDIN_DEF(addtimer,"is"), - BUILDIN_DEF(deltimer,"s"), - BUILDIN_DEF(addtimercount,"si"), + BUILDIN_DEF(addtimer,"is?"), + BUILDIN_DEF(deltimer,"s?"), + BUILDIN_DEF(addtimercount,"si?"), BUILDIN_DEF(initnpctimer,"??"), BUILDIN_DEF(stopnpctimer,"??"), BUILDIN_DEF(startnpctimer,"??"), @@ -21257,7 +21299,7 @@ void script_parse_builtin(void) { BUILDIN_DEF(md5,"s"), BUILDIN_DEF(swap,"rr"), // [zBuffer] List of dynamic var commands ---> - BUILDIN_DEF(getd,"s??"), + BUILDIN_DEF(getd,"s"), BUILDIN_DEF(setd,"sv"), // <--- [zBuffer] List of dynamic var commands BUILDIN_DEF(petstat,"i"), @@ -21305,6 +21347,7 @@ void script_parse_builtin(void) { BUILDIN_DEF(sleep2,"i"), BUILDIN_DEF(awake,"s"), BUILDIN_DEF(getvariableofnpc,"rs"), + BUILDIN_DEF(getvariableofpc,"ri?"), BUILDIN_DEF(warpportal,"iisii"), BUILDIN_DEF2(homunculus_evolution,"homevolution",""), //[orn] BUILDIN_DEF2(homunculus_mutate,"hommutate","?"), diff --git a/src/map/unit.c b/src/map/unit.c index feb11f89e..7d68bef66 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -668,11 +668,12 @@ void unit_run_hit(struct block_list *bl, struct status_change *sc, struct map_se ud->state.running = 0; status_change_end(bl, type, INVALID_TIMER); - if( type == SC_RUN ) { - skill->blown(bl,bl,skill->get_blewcount(TK_RUN,lv),unit->getdir(bl),0); + if (type == SC_RUN) { + if (lv > 0) + skill->blown(bl, bl, skill->get_blewcount(TK_RUN, lv), unit->getdir(bl), 0); clif->fixpos(bl); //Why is a clif->slide (skill->blown) AND a fixpos needed? Ask Aegis. - clif->sc_end(bl,bl->id,AREA,SI_TING); - } else if( sd ) { + clif->sc_end(bl, bl->id, AREA, SI_TING); + } else if (sd) { clif->fixpos(bl); skill->castend_damage_id(bl, &sd->bl, RA_WUGDASH, lv, timer->gettick(), SD_LEVEL); } |