diff options
Diffstat (limited to 'world/map/npc')
29 files changed, 411 insertions, 47 deletions
diff --git a/world/map/npc/001-2/_nodes.txt b/world/map/npc/001-2/_nodes.txt index 9d4b5dab..d8d6ebf2 100644 --- a/world/map/npc/001-2/_nodes.txt +++ b/world/map/npc/001-2/_nodes.txt @@ -6,8 +6,8 @@ end; OnInit: setarray .m$, "_N-Alchemy", "001-2", "001-2", "001-2", "001-2"; - setarray .x1, "_N-Alchemy", 92, 98, 92, 98; - setarray .y1, "_N-Alchemy", 76, 89, 89, 76; + setarray .x1, "_N-Alchemy", 98, 98, 92, 92; + setarray .y1, "_N-Alchemy", 89, 76, 89, 76; setarray .x2, "_N-Alchemy", 0, 0, 0, 0; setarray .y2, "_N-Alchemy", 0, 0, 0, 0; setarray .id, "_N-Alchemy", 0, 0, 0, 0; diff --git a/world/map/npc/013-1/sagatha.txt b/world/map/npc/013-1/sagatha.txt index e113d35a..fe2a4e6f 100644 --- a/world/map/npc/013-1/sagatha.txt +++ b/world/map/npc/013-1/sagatha.txt @@ -319,6 +319,9 @@ L_teach_N11: next; mes "[Sagatha the Witch]"; mes "\"Or call it into someone else's skin, by saying that someone's name right after the '" + get(.invocation$, "protect") + "'.\""; + next; + mes "[Sagatha the Witch]"; + mes "\"You can also remove this spell from yourself if you say '" + get(.invocation$, "antiprotect") + "'.\""; goto L_practice; L_teach_noexp: diff --git a/world/map/npc/014-1/wedding-officiator.txt b/world/map/npc/014-1/wedding-officiator.txt index dfdab00b..bc759cdf 100644 --- a/world/map/npc/014-1/wedding-officiator.txt +++ b/world/map/npc/014-1/wedding-officiator.txt @@ -135,7 +135,7 @@ L_too_poor: L_main_married: mes "[Wedding Officiator]"; - mes "\"I hope that you and "+ strcharinfo(0, get(BL_ID, PARTNER)) +" are doing well?\""; + mes "\"I hope that you and your partner are doing well?\""; next; menu "We are very happy, thanks for asking!", L_farewell, diff --git a/world/map/npc/026-2/_nodes.txt b/world/map/npc/026-2/_nodes.txt index 05780dcc..2d223fd1 100644 --- a/world/map/npc/026-2/_nodes.txt +++ b/world/map/npc/026-2/_nodes.txt @@ -1,4 +1,16 @@ // This file is generated automatically. All manually added changes will be removed when running the Converter. // Swamp Indoors nodes -// (no nodes) +026-2,0,0,0|script|Node026-2|32767 +{ + end; +OnInit: + setarray .m$, "_N-Alchemy", "026-2"; + setarray .x1, "_N-Alchemy", 35; + setarray .y1, "_N-Alchemy", 117; + setarray .x2, "_N-Alchemy", 0; + setarray .y2, "_N-Alchemy", 0; + setarray .id, "_N-Alchemy", 0; + donpcevent "_N-Alchemy::OnMaybeStart"; + destroy; +} diff --git a/world/map/npc/029-1/dock.txt b/world/map/npc/029-1/dock.txt index fcb27b6c..f7e38c2d 100644 --- a/world/map/npc/029-1/dock.txt +++ b/world/map/npc/029-1/dock.txt @@ -7,14 +7,6 @@ if(@npc_check) end; callfunc "BoardCandorFerry"; end; - -OnTouch: - addtimer get(.warp_delay, "#FerryConfig"), strnpcinfo(0)+"::OnBoard"; - end; - -OnBoard: - callfunc "BoardCandorFerry"; - end; } 029-1,51,118,0|script|Candor Koga|395,8,7 @@ -24,6 +16,14 @@ OnBoard: if(@npc_check) end; callfunc "BoardCandorFerry"; end; + +OnTouch: + addtimer get(.warp_delay, "#FerryConfig"), strnpcinfo(0)+"::OnBoard"; + end; + +OnBoard: + callfunc "BoardCandorFerry"; + end; } 029-1,55,110,0|script|#CandorDock|32767 diff --git a/world/map/npc/029-2/alchemy.txt b/world/map/npc/029-2/alchemy.txt index 98ca845b..23f1c321 100644 --- a/world/map/npc/029-2/alchemy.txt +++ b/world/map/npc/029-2/alchemy.txt @@ -74,7 +74,7 @@ S_Spawn: if (.spawned >= .@s) goto S_Return; set .@n$, "#_Al-lab"+chr(3)+.spawned; - if (puppet(.m$[.spawned], .x1[.spawned], .y1[.spawned], .@n$, 400) < 1) mapexit; // TODO: make a npc like npc 400 but with hoverCursor="action" => looks better for things like crafting + if (puppet(.m$[.spawned], .x1[.spawned], .y1[.spawned], .@n$, 399) < 1) mapexit; set .spawned, .spawned + 1; if (.spawned < .@s) goto S_Spawn; diff --git a/world/map/npc/029-2/morgan.txt b/world/map/npc/029-2/morgan.txt index d5604f93..a72bfa1d 100644 --- a/world/map/npc/029-2/morgan.txt +++ b/world/map/npc/029-2/morgan.txt @@ -109,6 +109,7 @@ L_LearningDone: mes "\"" + get(.invocation$, "spell-wand") + " is a basic wand attack.\""; mes "\"A Wand must be equipped to use the spell.\""; mes "\"To cast a spell open the chat window, type the invocation and press enter.\""; + mes "\"You can also discharge any active spell by saying " + get(.invocation$, "discharge spell") + ".\""; mes "\"I've taught you all I can for now. You should visit the Mana Seed north west of Hurnscald.\""; goto L_Close; diff --git a/world/map/npc/055-1/_nodes.txt b/world/map/npc/055-1/_nodes.txt index 4abefb02..68612765 100644 --- a/world/map/npc/055-1/_nodes.txt +++ b/world/map/npc/055-1/_nodes.txt @@ -6,10 +6,10 @@ end; OnInit: setarray .m$, "_N-Pumpkin", "055-1", "055-1", "055-1"; - setarray .x1, "_N-Pumpkin", 129, 41, 133; - setarray .y1, "_N-Pumpkin", 23, 22, 27; - setarray .x2, "_N-Pumpkin", 135, 47, 139; - setarray .y2, "_N-Pumpkin", 26, 30, 33; + setarray .x1, "_N-Pumpkin", 41, 129, 133; + setarray .y1, "_N-Pumpkin", 22, 23, 27; + setarray .x2, "_N-Pumpkin", 47, 135, 139; + setarray .y2, "_N-Pumpkin", 30, 26, 33; setarray .id, "_N-Pumpkin", 0, 0, 0; donpcevent "_N-Pumpkin::OnMaybeStart"; destroy; diff --git a/world/map/npc/commands/_import.txt b/world/map/npc/commands/_import.txt index b2fe92a1..48455487 100644 --- a/world/map/npc/commands/_import.txt +++ b/world/map/npc/commands/_import.txt @@ -9,3 +9,7 @@ npc: npc/commands/numa.txt npc: npc/commands/destroynpc.txt npc: npc/commands/remotecmd.txt npc: npc/commands/hug.txt +npc: npc/commands/warp.txt +npc: npc/commands/mute.txt +npc: npc/commands/npctalk.txt +npc: npc/commands/music.txt diff --git a/world/map/npc/commands/_procedures.txt b/world/map/npc/commands/_procedures.txt index 732b496f..9f26a7cd 100644 --- a/world/map/npc/commands/_procedures.txt +++ b/world/map/npc/commands/_procedures.txt @@ -8,6 +8,8 @@ function|script|argv_splitter set .@e, 0; set .@total, getarraysize(.@fragments$); set .@NULL$, chr(3); // HACK: we use .@NULL$ as a workaround because we can't do "\0" + cleararray @argv$[0], "", 20; // I don't think any atcommand will EVER need more than 20 args, and 20 is already generous + cleararray @argv[0], 0, 20; goto L_Check; L_Check: @@ -51,3 +53,99 @@ L_CheckAfter: L_Done: return; } + +// Map2Anchor +// translates map aliases to actual maps +function|script|map2anchor +{ + if (@map_anchor$[0] == "" && @argv$[0] != "") + set @map_anchor$[0], @argv$[0]; + + if (@map_anchor$[2] == "" && @argv[1] > 1 && @argv[2] > 1) + set @map_anchor$[1], @argv[1], @argv[2]; + + set .@a$, @map_anchor$[0]; // anchor name // FIXME: I really want a str2lower() builtin + + if (.@a$ == "hurnscald" || .@a$ == "hurn" || .@a$ == "hurns") + setarray @map_anchor$[0], "009-1", 55, 37; + + elif (.@a$ == "nivalis" || .@a$ == "niv") + setarray @map_anchor$[0], "020-1", 74, 83; + + elif (.@a$ == "tulimshar" || .@a$ == "tulim" || .@a$ == "tul") + setarray @map_anchor$[0], "001-1", 64, 101; + + elif (.@a$ == "candor" || .@a$ == "newbington" || .@a$ == "noob") + setarray @map_anchor$[0], "029-1", 52, 93; + + elif (.@a$ == "oldwizard" || .@a$ == "wizard" || .@a$ == "oldwiz") + setarray @map_anchor$[0], "013-1", 41, 92; + + elif (.@a$ == "desert" || .@a$ == "pachua") + setarray @map_anchor$[0], "006-1", 34, 99; + + elif (.@a$ == "forest" || .@a$ == "katze") + setarray @map_anchor$[0], "015-1", 58, 35; + + elif (.@a$ == "dimond" || .@a$ == "dimondscove") + setarray @map_anchor$[0], "010-2", 31, 39; + + elif (.@a$ == "asphodel" || .@a$ == "swamp" || .@a$ == "swampvillage" || .@a$ == "undeadtown") + setarray @map_anchor$[0], "026-1", 32, 33; + + elif (.@a$ == "gy" || .@a$ == "graveyard") + setarray @map_anchor$[0], "027-1", 71, 87; + + elif (.@a$ == "krukan" || .@a$ == "generalkrukan") + setarray @map_anchor$[0], "027-6", 39, 47; + + elif (.@a$ == "razha" || .@a$ == "generalrazha") + setarray @map_anchor$[0], "027-7", 39, 35; + + elif (.@a$ == "terogan" || .@a$ == "generalterogan") + setarray @map_anchor$[0], "027-8", 39, 52; + + elif (.@a$ == "gmisland" || .@a$ == "eventisland" || .@a$ == "easterisland" || .@a$ == "island") + setarray @map_anchor$[0], "028-1", 99, 40; + + elif (.@a$ == "auditorium" || .@a$ == "scene") + setarray @map_anchor$[0], "028-1", 119, 69; + + elif (.@a$ == "theater") + setarray @map_anchor$[0], "017-2", 26, 23; + + elif (.@a$ == "lounge" || .@a$ == "gmlounge" || .@a$ == "gm" || .@a$ == "backstage") + setarray @map_anchor$[0], "017-9", 26, 23; + + elif (.@a$ == "cindy" || .@a$ == "cindycave") + setarray @map_anchor$[0], "031-3", 47, 26; + + elif (.@a$ == "terranite" || .@a$ == "terra" || .@a$ == "terracave") + setarray @map_anchor$[0], "012-3", 448, 65; + + elif (.@a$ == "terranitesafe" || .@a$ == "terrasafe" || .@a$ == "safeterra") + setarray @map_anchor$[0], "012-4", 473, 184; + + elif (.@a$ == "bluesage" || .@a$ == "blue") + setarray @map_anchor$[0], "048-2", 40, 46; + + elif (.@a$ == "xmasinn" || .@a$ == "xmas") + setarray @map_anchor$[0], "030-2", 85, 46; + + elif (.@a$ == "barbarians" || .@a$ == "barbarian" || .@a$ == "fluffy") + setarray @map_anchor$[0], "033-1", 71, 33; + + elif (.@a$ == "park" || .@a$ == "porttown" || .@a$ == "farms") + setarray @map_anchor$[0], "057-1", 100, 77; + + elif (.@a$ == "hills" || .@a$ == "orum") + setarray @map_anchor$[0], "017-1", 112, 49; + + elif (.@a$ == "batcave" || .@a$ == "bat") + setarray @map_anchor$[0], "011-3", 30, 26; + + else + set @map_anchor$[3], "no"; // did not use an anchor + + return; +} diff --git a/world/map/npc/commands/music.txt b/world/map/npc/commands/music.txt new file mode 100644 index 00000000..cbd9fed1 --- /dev/null +++ b/world/map/npc/commands/music.txt @@ -0,0 +1,34 @@ +-|script|@music|32767 +{ + callfunc "argv_splitter"; + if (GM < CMD_MUSIC && GM < G_SYSOP) goto L_GM; + if (@argv$[0] == "") goto L_Failed; + + gmlog "@music " + @args$; + set .@find, array_search(@argv$[0], .find$); + if (.@find >= 0) + set @argv$[0], .replace$[max(.@find, 0)]; + set .file$, @argv$[0]; + areatimer 0, getmap(), (POS_X - .range), (POS_Y - .range), (POS_X + .range), (POS_Y + .range), 0, strnpcinfo(0)+"::OnPC"; + message strcharinfo(0), "music : The music has ben temporarily changed."; + end; + +OnPC: + music .file$ + ".ogg"; + end; + +L_Failed: + message strcharinfo(0), "music : You must specify a music file."; + end; + +L_GM: + message strcharinfo(0), "music : GM command is level "+ CMD_MUSIC +", but you are level " + GM; + end; + +OnInit: + setarray .find$, "this", "cave", "chilling", "clouds", "dimond", "explorers", "gy", "reid", "magick", "mystique", "night", "ride", "sail", "snow", "forest", "xmas"; + setarray .replace$, "this", "cavesong", "chilling-environment", "clouds-calling", "dimonds-cove", "explorers-melody", "graveyard", "inquisitive-inn", "magick-real", "mystique-forest", "night-is-calling", "ride-of-the-valkyries", "sail-away", "snow-village", "the-forest", "white-christmas"; + set .range, 14; // FIXME: make this a const + registercmd chr(ATCMD_SYMBOL) + "music", strnpcinfo(0); + end; +} diff --git a/world/map/npc/commands/mute.txt b/world/map/npc/commands/mute.txt new file mode 100644 index 00000000..8216a9c7 --- /dev/null +++ b/world/map/npc/commands/mute.txt @@ -0,0 +1,93 @@ +-|script|@mute|32767 +{ + callfunc "argv_splitter"; + if (GM < CMD_MUTE && GM < G_SYSOP) goto L_GM; + if (@argv$[1] == "") goto L_Failed; + + set .@target_id, getcharid(3, @argv$[1]); + if (.@target_id < 1 || !(isloggedin(.@target_id))) goto L_Failed; + + if (@argv[0] > 120) + set @argv[0], 120; // max 2 hours + + gmlog "@mute " + @args$; + if (@argv[0] == 0) goto L_UnMute; + + message strcharinfo(0, .@target_id), "Server : ##BYou have been muted by a GM for "+@argv[0]+" minutes."; + set MUTE_GLOBAL, 1, .@target_id; + set #MUTE_UNTIL, (gettimetick(2) + (@argv[0] * 60)), .@target_id; + addtimer (@argv[0] * 60000) + 100, strnpcinfo(0) + "::OnCheckMute", .@target_id; + message strcharinfo(0), "mute : Player `"+strcharinfo(0, .@target_id)+"` has been muted for "+@argv[0]+" minutes."; + end; + +OnSTFU: + if (GM < CMD_MUTE && GM < G_SYSOP) goto L_GM; + callfunc "argv_splitter"; + if (@argv[0] < 1) set @argv[0], 1; + if (@argv[0] > 10) set @argv[0], 10; + gmlog "@stfu " + @argv[0]; + set @stfu_nr, 0; + foreach 0, getmap(), (POS_X - .range), (POS_Y - .range), (POS_X + .range), (POS_Y + .range), strnpcinfo(0)+"::OnSTFUPC"; + message strcharinfo(0), "mute : Every player within "+.range+" tiles have been muted for "+@argv[0]+" minutes. ["+@stfu_nr+"]"; + set @stfu_nr, 0; + end; + +OnSTFUPC: + if (@target_id == BL_ID) end; + set .@future, (gettimetick(2) + (@argv[0] * 60)); + if (get(#MUTE_UNTIL, @target_id) > .@future) end; // if player already has a mute, don't reduce it + set MUTE_GLOBAL, 1, @target_id; + set #MUTE_UNTIL, .@future, @target_id; + addtimer (@argv[0] * 60000) + 100, strnpcinfo(0) + "::OnCheckMute", @target_id; + set @stfu_nr, @stfu_nr + 1; + end; + +OnPCLoginEvent: + if (#MUTE_UNTIL < 1) end; + set .@s, (#MUTE_UNTIL - gettimetick(2)); + if (.@s < 5) goto L_ClearMute; + set .@m, .@s / 60; + message strcharinfo(0), "Server : ##BYou have been muted for "+ max(1, .@m) +" minutes."; + set MUTE_GLOBAL, 1; + addtimer (.@s * 1000) + 100, strnpcinfo(0) + "::OnCheckMute"; + end; + +L_ClearMute: + message strcharinfo(0), "Server : ##BYour mute has expired while you were away. You have been automatically unmuted."; + if ((#MUTE_UNTIL - gettimetick(2)) >= (0 - 900)) + wgm "=> Player `"+ strcharinfo(0) +"` has been automatically unmuted."; // only send if unmuted 15 minutes ago or less + set #MUTE_UNTIL, 0; + end; + +OnCheckMute: + if (#MUTE_UNTIL < 1) end; + if (gettimetick(2) - #MUTE_UNTIL < 0) end; + message strcharinfo(0), "Server : ##BYou have been automatically unmuted."; + wgm "=> Player `"+ strcharinfo(0) +"` has been automatically unmuted."; + set MUTE_GLOBAL, 0; + set #MUTE_UNTIL, 0; + end; + +L_UnMute: + if (get(MUTE_GLOBAL, .@target_id)) + message strcharinfo(0, .@target_id), "Server : ##BYou have been unmuted by a GM."; + set MUTE_GLOBAL, 0, .@target_id; + set #MUTE_UNTIL, 0, .@target_id; + message strcharinfo(0), "mute : Player `"+strcharinfo(0, .@target_id)+"` has been unmuted."; + end; + +L_Failed: + message strcharinfo(0), "mute : Impossible to attach to the target player. Did you try putting the name in \"quotation marks\"?"; + end; + +L_GM: + message strcharinfo(0), "mute : GM command is level "+ CMD_MUTE +", but you are level " + GM; + end; + +OnInit: + set .range, 14; // FIXME: this should be a const + registercmd chr(ATCMD_SYMBOL) + "mute", strnpcinfo(0); + registercmd chr(ATCMD_SYMBOL) + "stfu", strnpcinfo(0) + "::OnSTFU"; + registercmd chr(ATCMD_SYMBOL) + "areamute", strnpcinfo(0) + "::OnSTFU"; // alias of STFU + end; +} diff --git a/world/map/npc/commands/npctalk.txt b/world/map/npc/commands/npctalk.txt new file mode 100644 index 00000000..215e91ca --- /dev/null +++ b/world/map/npc/commands/npctalk.txt @@ -0,0 +1,23 @@ +-|script|@npctalk|32767 +{ + callfunc "argv_splitter"; + if (GM < CMD_NPCTALK && GM < G_SYSOP) goto L_GM; + if (@argv$[0] == "" || @argv$[1] == "") goto L_Failed; + if (getnpcid(@argv$[0]) < 1) goto L_Failed; + + gmlog "@npctalk " + @args$; + npctalk @argv$[0], @argv$[1]; + end; + +L_Failed: + message strcharinfo(0), "npctalk : Impossible to attach to the target npc. Did you try putting the name in \"quotation marks\"?"; + end; + +L_GM: + message strcharinfo(0), "npctalk : GM command is level "+ CMD_NPCTALK +", but you are level " + GM; + end; + +OnInit: + registercmd chr(ATCMD_SYMBOL) + "npctalk", strnpcinfo(0); + end; +} diff --git a/world/map/npc/commands/warp.txt b/world/map/npc/commands/warp.txt new file mode 100644 index 00000000..8fee3c16 --- /dev/null +++ b/world/map/npc/commands/warp.txt @@ -0,0 +1,57 @@ +-|script|@warp|32767 +{ + callfunc "argv_splitter"; + if (@argv$[3] == "" && @argv$[2] == "" && @argv$[1] != "" && @argv[1] < 2) + set @argv$[3], @argv$[1]; + + set .@n$, if_then_else(@argv$[3] != "", "char", "") + "warp"; + if (GM < CMD_WARP && GM < G_SYSOP) goto L_GM; // check if you can use it on self + set .@target_id, BL_ID; + if (@argv$[3] != "") set .@target_id, getcharid(3, @argv$[3]); + if (@argv$[3] != "" && !(isloggedin(.@target_id))) goto L_Failed; // do NOT fallback to self + if (@argv$[3] != "" && GM < CMD_CHARWARP && GM < G_SYSOP) goto L_GM; // when target is not self, use charwarp permission + + if (@argv$[0] == "") + set @argv$[0], getmap(); + + setarray @map_anchor$[0], "", "", "", ""; + callfunc "map2anchor"; + + gmlog "@"+.@n$+" " + @args$; + if (.@target_id != BL_ID) + message strcharinfo(0), .@n$+" : The operation succeeded."; + + set @GMWARP_map$, @map_anchor$[0]; + set @GMWARP_x, if_then_else(@argv[1] > 1, @argv[1], @map_anchor$[1]); + set @GMWARP_y, if_then_else(@argv[2] > 1, @argv[2], @map_anchor$[2]); + addtimer 0, strnpcinfo(0) + "::OnWarp", .@target_id; + + if (@map_anchor$[3] == "no" && @knows_anchors < 1) + goto L_SuggestAnchors; + end; + +L_SuggestAnchors: + message strcharinfo(0), .@n$+" : The warp command has been improved. You might want to consider using [@@https://www.themanaworld.org/index.php/Dev:GM_Commands/anchors|map anchors@@]."; + set @knows_anchors, 1; + end; + +OnWarp: + warp @GMWARP_map$, @GMWARP_x, @GMWARP_y; + set @GMWARP_map$, ""; + set @GMWARP_x, 0; + set @GMWARP_y, 0; + end; + +L_Failed: + message strcharinfo(0), .@n$+" : Impossible to attach to the target player. Did you try putting the name in \"quotation marks\"?"; + end; + +L_GM: + message strcharinfo(0), .@n$+" : GM command is level "+ if_then_else(@argv$[1] != "", CMD_CHARWARP, CMD_WARP) +", but you are level " + GM; + end; + +OnInit: + registercmd chr(ATCMD_SYMBOL) + "warp", strnpcinfo(0); + registercmd chr(ATCMD_SYMBOL) + "charwarp", strnpcinfo(0); + end; +} diff --git a/world/map/npc/magic/_procedures.txt b/world/map/npc/magic/_procedures.txt index bdeb6140..5d7e5c8a 100644 --- a/world/map/npc/magic/_procedures.txt +++ b/world/map/npc/magic/_procedures.txt @@ -14,7 +14,7 @@ function|script|magic_register end; OnLogin: - set @_M_BLOCK, 1; + set @_M_BLOCK, 2; addtimer 10000, "Magic Timer::OnClear"; end; @@ -26,14 +26,35 @@ OnClear: // this function is call()-only function|script|magic_checks { - set .@r, 0; - if(HIDDEN) set .@r, 1; // can not cast with @hide - if(@_M_BLOCK) set .@r, 2; // check if last debuff ended - if(Hp < 1) set .@r, 3; // can not cast when dead - if (MATK1 < 1) set .@r, 4; // can not cast with a grey mana bar - if (.@r) - smsg SMSG_FAILURE, "Magic: Impossible to cast right now."; - return .@r; + set .@flags, getarg(0); + set .@nonmagic, .@flags & (1<<0); + + if(HIDDEN) goto L_Hidden; // can not cast with @hide + if(@_M_BLOCK == 2) goto L_Login; // login warmup + if(@_M_BLOCK) goto L_Blocked; // check if last debuff ended + if(Hp < 1) goto L_Dead; // can not cast when dead + if (MATK1 < 1 && .@nonmagic < 1) goto L_Greybar; // can not cast with a grey mana bar + return 0; + +L_Hidden: + smsg SMSG_FAILURE, "Magic: Impossible to cast while hidden!"; + return 1; + +L_Blocked: + smsg SMSG_FAILURE, "Magic: Impossible to cast while a cooldown is in effect. Please wait."; + return 2; + +L_Dead: + smsg SMSG_FAILURE, "Magic: Impossible to cast while dead!"; + return 3; + +L_Greybar: + smsg SMSG_FAILURE, "Magic: Impossible to cast with 0 m.atk. This might happen if your mana bar is grey. Some equipment can reduce your m.atk."; + return 4; + +L_Login: + smsg SMSG_FAILURE, "Magic: Impossible to cast for 10s after logging in."; + return 5; } function|script|elt_damage diff --git a/world/map/npc/magic/level0-antiprotect.txt b/world/map/npc/magic/level0-antiprotect.txt index 8e9b700c..129d3c62 100644 --- a/world/map/npc/magic/level0-antiprotect.txt +++ b/world/map/npc/magic/level0-antiprotect.txt @@ -1,6 +1,6 @@ -|script|antiprotect|32767 { - if(call("magic_checks")) end; + if(call("magic_checks", 1)) end; callfunc "magic_exp"; if (@antiprotect) @@ -17,10 +17,7 @@ L_Disable: end; OnInit: - set .school, SKILL_MAGIC_NATURE; set .invocation$, chr(MAGIC_SYMBOL) + "detsanc"; // used in npcs that refer to this spell - void call("magic_register"); - set .level, 0; - set .exp_gain, 0; + registercmd .invocation$, strnpcinfo(0); end; } diff --git a/world/map/npc/magic/level1-summon-maggots.txt b/world/map/npc/magic/level1-summon-maggots.txt index 49022635..28e99a87 100644 --- a/world/map/npc/magic/level1-summon-maggots.txt +++ b/world/map/npc/magic/level1-summon-maggots.txt @@ -27,6 +27,8 @@ OnCast: end; OnSummon: + if(get(Hp, .master) < 1) destroy; // destroy if master is missing + if(getmap(.master) != strnpcinfo(3)) destroy; // destroy if master left the map specialeffect FX_PENTAGRAM_BURST; set .@i, 0; set .@x, getnpcx(); @@ -42,7 +44,7 @@ S_SummonAll: summon .@map$, rand(.@x-2,.@x+2), rand(.@y-2,.@y+2), .master, 1002, 2, .lifetime; set .@i, .@i + 1; if (.@i < .count) goto S_SummonAll; - return; + destroy; OnInit: set .school, SKILL_MAGIC_ASTRAL; diff --git a/world/map/npc/magic/level2-arrow-hail.txt b/world/map/npc/magic/level2-arrow-hail.txt index 35cd584e..6e317232 100644 --- a/world/map/npc/magic/level2-arrow-hail.txt +++ b/world/map/npc/magic/level2-arrow-hail.txt @@ -66,7 +66,7 @@ OnNearbyNpc: end; OnLaunch: - if(get(BL_ID, .caster) != .caster) destroy; // destroy if caster is missing + if(get(Hp, .caster) < 1) destroy; // destroy if caster is missing if(getmap(.caster) != strnpcinfo(3)) destroy; // destroy if caster left the map set .hit, .hit + 1; if(.hit > .max_hit) destroy; @@ -93,7 +93,7 @@ OnTimer30000: destroy; OnHit: - if(get(BL_ID, .caster) != .caster) destroy; // destroy if caster is missing + if(get(Hp, .caster) < 1) destroy; // destroy if caster is missing if(getmap(.caster) != strnpcinfo(3)) destroy; // destroy if caster left the map if(target(.caster, @target_id, 16) != 16 && .caster != @target_id) end; diff --git a/world/map/npc/magic/level2-barrier.txt b/world/map/npc/magic/level2-barrier.txt index 9526ee5a..3b7ffb77 100644 --- a/world/map/npc/magic/level2-barrier.txt +++ b/world/map/npc/magic/level2-barrier.txt @@ -27,10 +27,12 @@ set @asorm_time, .@time, @target_id; sc_start SC_MBARRIER, .@time, max(30,(@spellpower/8))+20, @target_id; message @args$, "Barrier : You are surrounded by a magical barrier."; - addtimer @asorm_time, strnpcinfo(0)+"::OnEnd", @target_id; + set @asorm_future, gettimetick(0) + @asorm_time - 100, @target_id; + addtimer @asorm_time - 100, strnpcinfo(0)+"::OnEnd", @target_id; end; OnEnd: + if (gettimetick(0) - @asorm_future < 0) end; if (sc_check(SC_MBARRIER) != 1) end; message strcharinfo(0), "Barrier : Your magical barrier dissipates."; misceffect FX_MAGIC_DEFAULT, strcharinfo(0); diff --git a/world/map/npc/magic/level2-flying-backpack.txt b/world/map/npc/magic/level2-flying-backpack.txt index 87c7d644..36e936fd 100644 --- a/world/map/npc/magic/level2-flying-backpack.txt +++ b/world/map/npc/magic/level2-flying-backpack.txt @@ -22,10 +22,12 @@ set @plugh_time, (@spellpower*500)+5000, @target_id; sc_start SC_FLYING_BACKPACK, @plugh_time, 0, @target_id; message @args$, "Backpack : Your backpack is lifted by a mystical force; you no longer feel it pressing on your back."; - addtimer @plugh_time, strnpcinfo(0)+"::OnEnd", @target_id; + set @plugh_future, gettimetick(0) + @plugh_time - 100, @target_id; + addtimer @plugh_time - 100, strnpcinfo(0)+"::OnEnd", @target_id; end; OnEnd: + if (gettimetick(0) - @plugh_future < 0) end; if (sc_check(SC_FLYING_BACKPACK) != 1) end; message strcharinfo(0), "Backpack : Your backpack is no longer levitating."; misceffect FX_MAGIC_GENERIC, strcharinfo(0); diff --git a/world/map/npc/magic/level2-hide.txt b/world/map/npc/magic/level2-hide.txt index 6d9c125d..f720dd43 100644 --- a/world/map/npc/magic/level2-hide.txt +++ b/world/map/npc/magic/level2-hide.txt @@ -26,10 +26,12 @@ sc_start SC_HIDE, .@time, 0, @target_id; message @args$, "Magic : You are hidden!"; if (BL_ID != @target_id) message strcharinfo(0), "Magic : You hid someone!"; + set @anwiltyp_future, gettimetick(0) + @anwiltyp_time - 100, @target_id; addtimer @anwiltyp_time, strnpcinfo(0)+"::OnEnd", @target_id; end; OnEnd: + if (gettimetick(0) - @anwiltyp_future < 0) end; if (sc_check(SC_HIDE) != 1) end; message strcharinfo(0), "Magic : You are no longer hidden."; misceffect FX_MAGIC_GENERIC, strcharinfo(0); diff --git a/world/map/npc/magic/level2-protect.txt b/world/map/npc/magic/level2-protect.txt index 659efdc1..38ea6a7d 100644 --- a/world/map/npc/magic/level2-protect.txt +++ b/world/map/npc/magic/level2-protect.txt @@ -6,7 +6,6 @@ if (.@level < .level) end; if (getskilllv(SKILL_MAGIC) < .level) end; if (.@level <= 3 && countitem("HardSpike") < 1) end; - elif (.@level <= 3) end; set @target_id, getcharid(3, @args$); if (@target_id < 1 || !(isloggedin(@target_id)) || get(INVISIBLE, @target_id)) set @target_id, BL_ID; // fallback to self @@ -15,7 +14,7 @@ if (distance(BL_ID, @target_id) >= (@spellpower/30)+2) set @target_id, BL_ID; if (get(@antiprotect, @target_id) > 0) end; - delitem "HardSpike", 1; + if (.@level <= 3) delitem "HardSpike", 1; set @_M_BLOCK, 1; // block casting, until the timer clears it addtimer 1500, "Magic Timer::OnClear"; // set the new debuff callfunc "adjust_spellpower"; @@ -29,10 +28,12 @@ set @betsanc_time, .@time, @target_id; sc_start SC_PHYS_SHIELD, .@time, max(15,(@spellpower/20))+5, @target_id; message @args$, "Shield : You feel more protected."; - addtimer @betsanc_time, strnpcinfo(0)+"::OnEnd", @target_id; + set @betsanc_future, gettimetick(0) + @betsanc_time - 100, @target_id; + addtimer @betsanc_time - 100, strnpcinfo(0)+"::OnEnd", @target_id; end; OnEnd: + if (gettimetick(0) - @betsanc_future < 0) end; if (sc_check(SC_PHYS_SHIELD) != 1) end; message strcharinfo(0), "Shield : You feel less protected."; misceffect FX_MAGIC_SHIELD_ENDS, strcharinfo(0); diff --git a/world/map/npc/magic/level2-rain.txt b/world/map/npc/magic/level2-rain.txt index 9e62782d..c088acf4 100644 --- a/world/map/npc/magic/level2-rain.txt +++ b/world/map/npc/magic/level2-rain.txt @@ -64,7 +64,7 @@ L_Tree: close; OnLaunch: - if(get(BL_ID, .caster) != .caster) destroy; // destroy if caster is missing + if(get(Hp, .caster) < 1) destroy; // destroy if caster is missing if(getmap(.caster) != strnpcinfo(3)) destroy; // destroy if caster left the map set .count, .count + 1; if(.count > .max) destroy; @@ -82,7 +82,7 @@ S_Launch: return; OnHit: - if(get(BL_ID, .caster) != .caster) destroy; // destroy if caster is missing + if(get(Hp, .caster) < 1) destroy; // destroy if caster is missing if(getmap(.caster) != strnpcinfo(3)) destroy; // destroy if caster left the map if(target(.caster, @target_id, 16) != 16 && .caster != @target_id) end; if((get(BL_TYPE, @target_id) & 1) == 0) end; // either mob or pc diff --git a/world/map/npc/magic/level2-summon-fluffies.txt b/world/map/npc/magic/level2-summon-fluffies.txt index 2ca630ed..f4d60475 100644 --- a/world/map/npc/magic/level2-summon-fluffies.txt +++ b/world/map/npc/magic/level2-summon-fluffies.txt @@ -28,6 +28,8 @@ OnCast: end; OnSummon: + if(get(Hp, .master) < 1) destroy; // destroy if master is missing + if(getmap(.master) != strnpcinfo(3)) destroy; // destroy if master left the map specialeffect FX_PENTAGRAM_BURST; set .@i, 0; set .@x, getnpcx(); @@ -43,7 +45,7 @@ S_SummonAll: summon .@map$, rand(.@x-2,.@x+2), rand(.@y-2,.@y+2), .master, 1020, 2, .lifetime; set .@i, .@i + 1; if (.@i < .count) goto S_SummonAll; - return; + destroy; OnInit: set .school, SKILL_MAGIC_ASTRAL; diff --git a/world/map/npc/magic/level2-summon-mouboo.txt b/world/map/npc/magic/level2-summon-mouboo.txt index f6a68fcf..b098a3dd 100644 --- a/world/map/npc/magic/level2-summon-mouboo.txt +++ b/world/map/npc/magic/level2-summon-mouboo.txt @@ -28,6 +28,8 @@ OnCast: end; OnSummon: + if(get(Hp, .master) < 1) destroy; // destroy if master is missing + if(getmap(.master) != strnpcinfo(3)) destroy; // destroy if master left the map specialeffect FX_PENTAGRAM_BURST; set .@i, 0; set .@x, getnpcx(); @@ -43,7 +45,7 @@ S_SummonAll: summon .@map$, rand(.@x-2,.@x+2), rand(.@y-2,.@y+2), .master, 1028, 2, .lifetime; set .@i, .@i + 1; if (.@i < .count) goto S_SummonAll; - return; + destroy; OnInit: set .school, SKILL_MAGIC_ASTRAL; diff --git a/world/map/npc/magic/level2-summon-pinkie.txt b/world/map/npc/magic/level2-summon-pinkie.txt index 785c8364..059d16f6 100644 --- a/world/map/npc/magic/level2-summon-pinkie.txt +++ b/world/map/npc/magic/level2-summon-pinkie.txt @@ -28,6 +28,8 @@ OnCast: end; OnSummon: + if(get(Hp, .master) < 1) destroy; // destroy if master is missing + if(getmap(.master) != strnpcinfo(3)) destroy; // destroy if master left the map specialeffect FX_PENTAGRAM_BURST; set .@i, 0; set .@x, getnpcx(); @@ -43,7 +45,7 @@ S_SummonAll: summon .@map$, rand(.@x-2,.@x+2), rand(.@y-2,.@y+2), .master, 1018, 2, .lifetime; set .@i, .@i + 1; if (.@i < .count) goto S_SummonAll; - return; + destroy; OnInit: set .school, SKILL_MAGIC_ASTRAL; diff --git a/world/map/npc/magic/level2-summon-snakes.txt b/world/map/npc/magic/level2-summon-snakes.txt index 2c46f28b..a9d0dbfe 100644 --- a/world/map/npc/magic/level2-summon-snakes.txt +++ b/world/map/npc/magic/level2-summon-snakes.txt @@ -29,6 +29,8 @@ OnCast: end; OnSummon: + if(get(Hp, .master) < 1) destroy; // destroy if master is missing + if(getmap(.master) != strnpcinfo(3)) destroy; // destroy if master left the map specialeffect FX_PENTAGRAM_BURST; set .@i, 0; set .@x, getnpcx(); @@ -44,7 +46,7 @@ S_SummonAll: summon .@map$, rand(.@x-2,.@x+2), rand(.@y-2,.@y+2), .master, 1010, 2, .lifetime; set .@i, .@i + 1; if (.@i < .count) goto S_SummonAll; - return; + destroy; OnInit: set .school, SKILL_MAGIC_DARK; diff --git a/world/map/npc/magic/level2-summon-spiky-mushroom.txt b/world/map/npc/magic/level2-summon-spiky-mushroom.txt index 5659fc32..188e9b9f 100644 --- a/world/map/npc/magic/level2-summon-spiky-mushroom.txt +++ b/world/map/npc/magic/level2-summon-spiky-mushroom.txt @@ -28,6 +28,8 @@ OnCast: end; OnSummon: + if(get(Hp, .master) < 1) destroy; // destroy if master is missing + if(getmap(.master) != strnpcinfo(3)) destroy; // destroy if master left the map specialeffect FX_PENTAGRAM_BURST; set .@i, 0; set .@x, getnpcx(); @@ -43,7 +45,7 @@ S_SummonAll: summon .@map$, rand(.@x-2,.@x+2), rand(.@y-2,.@y+2), .master, 1019, 2, .lifetime; set .@i, .@i + 1; if (.@i < .count) goto S_SummonAll; - return; + destroy; OnInit: set .school, SKILL_MAGIC_ASTRAL; diff --git a/world/map/npc/magic/level2-summon-wickedmushroom.txt b/world/map/npc/magic/level2-summon-wickedmushroom.txt index 02442c6b..3b8b9cfc 100644 --- a/world/map/npc/magic/level2-summon-wickedmushroom.txt +++ b/world/map/npc/magic/level2-summon-wickedmushroom.txt @@ -29,6 +29,8 @@ OnCast: end; OnSummon: + if(get(Hp, .master) < 1) destroy; // destroy if master is missing + if(getmap(.master) != strnpcinfo(3)) destroy; // destroy if master left the map specialeffect FX_PENTAGRAM_BURST; set .@i, 0; set .@x, getnpcx(); @@ -44,7 +46,7 @@ S_SummonAll: summon .@map$, rand(.@x-2,.@x+2), rand(.@y-2,.@y+2), .master, 1106, 2, .lifetime; set .@i, .@i + 1; if (.@i < .count) goto S_SummonAll; - return; + destroy; OnInit: set .school, SKILL_MAGIC_DARK; |