summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml4
-rw-r--r--3rdparty/libconfig/extra/gen/scanner.l10
-rw-r--r--3rdparty/libconfig/scanner.c375
-rw-r--r--3rdparty/libconfig/scanner.h5
-rw-r--r--conf/atcommand.conf1
-rw-r--r--conf/battle/player.conf2
-rw-r--r--conf/groups.conf1
-rw-r--r--conf/help.txt5
-rw-r--r--conf/messages.conf14
-rwxr-xr-xconfigure110
-rw-r--r--configure.in96
-rw-r--r--db/const.txt8
-rw-r--r--db/re/refine_db.txt11
-rw-r--r--db/sc_config.txt18
-rw-r--r--doc/atcommands.txt10
-rw-r--r--doc/script_commands.txt11
-rw-r--r--npc/custom/bgqueue/flavius.txt100
-rw-r--r--npc/instances/EndlessTower.txt8
-rw-r--r--npc/other/hugel_bingo.txt2
-rw-r--r--npc/other/turbo_track.txt2
-rw-r--r--npc/quests/first_class/tu_acolyte.txt2
-rw-r--r--npc/quests/quests_ein.txt4
-rw-r--r--npc/quests/quests_juperos.txt2
-rw-r--r--npc/quests/quests_moscovia.txt2
-rw-r--r--npc/quests/thana_quest.txt4
-rw-r--r--npc/re/merchants/refine.txt14
-rw-r--r--npc/re/quests/eden/86-90.txt2
-rw-r--r--npc/re/quests/eden/91-99.txt2
-rw-r--r--npc/re/quests/quests_dicastes.txt2
-rw-r--r--npc/re/quests/quests_malangdo.txt2
-rwxr-xr-xscript-checker25
-rw-r--r--script-checker.bat29
-rw-r--r--src/common/cbasetypes.h12
-rw-r--r--src/common/core.c14
-rw-r--r--src/common/mapindex.c17
-rw-r--r--src/common/mapindex.h3
-rw-r--r--src/common/mmo.h16
-rw-r--r--src/map/HPMmap.c5
-rw-r--r--src/map/atcommand.c225
-rw-r--r--src/map/atcommand.h4
-rw-r--r--src/map/battle.c9
-rw-r--r--src/map/battle.h2
-rw-r--r--src/map/battleground.c44
-rw-r--r--src/map/battleground.h11
-rw-r--r--src/map/chrif.c6
-rw-r--r--src/map/chrif.h2
-rw-r--r--src/map/clif.c13
-rw-r--r--src/map/clif.h2
-rw-r--r--src/map/duel.c5
-rw-r--r--src/map/duel.h2
-rw-r--r--src/map/elemental.c7
-rw-r--r--src/map/elemental.h2
-rw-r--r--src/map/guild.c17
-rw-r--r--src/map/guild.h2
-rw-r--r--src/map/homunculus.c18
-rw-r--r--src/map/homunculus.h2
-rw-r--r--src/map/instance.c5
-rw-r--r--src/map/instance.h2
-rw-r--r--src/map/irc-bot.c5
-rw-r--r--src/map/irc-bot.h2
-rw-r--r--src/map/itemdb.c24
-rw-r--r--src/map/itemdb.h4
-rw-r--r--src/map/map.c172
-rw-r--r--src/map/map.h2
-rw-r--r--src/map/mercenary.c7
-rw-r--r--src/map/mercenary.h2
-rw-r--r--src/map/mob.c26
-rw-r--r--src/map/mob.h4
-rw-r--r--src/map/npc.c149
-rw-r--r--src/map/npc.h4
-rw-r--r--src/map/packets.h4
-rw-r--r--src/map/party.c7
-rw-r--r--src/map/party.h2
-rw-r--r--src/map/pc.c388
-rw-r--r--src/map/pc.h7
-rw-r--r--src/map/pc_groups.c201
-rw-r--r--src/map/pc_groups.h66
-rw-r--r--src/map/pet.c22
-rw-r--r--src/map/pet.h2
-rw-r--r--src/map/quest.c5
-rw-r--r--src/map/quest.h2
-rw-r--r--src/map/script.c105
-rw-r--r--src/map/script.h4
-rw-r--r--src/map/skill.c15
-rw-r--r--src/map/skill.h4
-rw-r--r--src/map/status.c141
-rw-r--r--src/map/status.h55
-rw-r--r--src/map/storage.c4
-rw-r--r--src/map/storage.h2
-rw-r--r--src/map/unit.c7
-rw-r--r--src/map/unit.h2
-rw-r--r--src/map/vending.c2
-rw-r--r--src/map/vending.h2
-rw-r--r--src/plugins/HPMHooking/HPMHooking.GetSymbol.inc1
-rw-r--r--src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc57
-rw-r--r--src/plugins/HPMHooking/HPMHooking.HookingPoints.inc15
-rw-r--r--src/plugins/HPMHooking/HPMHooking.Hooks.inc835
-rw-r--r--src/plugins/HPMHooking/HPMHooking.sources.inc1
-rwxr-xr-xtools/HPMHookGen/HPMHookGen.pl3
-rw-r--r--tools/Script-Checker.applescript151
100 files changed, 2600 insertions, 1243 deletions
diff --git a/.travis.yml b/.travis.yml
index fc209376b..2c09eeca6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,9 +7,9 @@ before_script:
- uname -a
script:
- - ./configure --enable-debug && make -j3
+ - ./configure --enable-debug && make sql -j3
- make clean
- - ./configure --disable-renewal --enable-debug && make -j3
+ - ./configure --disable-renewal --enable-debug && make sql -j3
notifications:
email: false
diff --git a/3rdparty/libconfig/extra/gen/scanner.l b/3rdparty/libconfig/extra/gen/scanner.l
index bdc57a8d4..4b3048fab 100644
--- a/3rdparty/libconfig/extra/gen/scanner.l
+++ b/3rdparty/libconfig/extra/gen/scanner.l
@@ -100,7 +100,7 @@ float ([-+]?([0-9]*)?\.[0-9]*([eE][-+]?[0-9]+)?)|([-+]?([0-9]+)(\.[0
comment (#|\/\/).*$
include_open ^[ \t]*@include[ \t]+\"
-%x COMMENT STRING INCLUDE
+%x COMMENT STRING INCLUDE SCRIPTBLOCK
%%
@@ -129,6 +129,14 @@ include_open ^[ \t]*@include[ \t]+\"
return(TOK_STRING);
}
+\<\" { BEGIN SCRIPTBLOCK; }
+<SCRIPTBLOCK>([^\"]|\"[^\>])+ { scanctx_append_string(yyextra, yytext); }
+<SCRIPTBLOCK>\"\> {
+ yylval->sval = scanctx_take_string(yyextra);
+ BEGIN INITIAL;
+ return(TOK_STRING);
+ }
+
{include_open} { BEGIN INCLUDE; }
<INCLUDE>[^\"\\]+ { scanctx_append_string(yyextra, yytext); }
<INCLUDE>\\\\ { scanctx_append_string(yyextra, "\\"); }
diff --git a/3rdparty/libconfig/scanner.c b/3rdparty/libconfig/scanner.c
index 55e029f9f..6de72c2fd 100644
--- a/3rdparty/libconfig/scanner.c
+++ b/3rdparty/libconfig/scanner.c
@@ -365,8 +365,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
*yy_cp = '\0'; \
yyg->yy_c_buf_p = yy_cp;
-#define YY_NUM_RULES 42
-#define YY_END_OF_BUFFER 43
+#define YY_NUM_RULES 45
+#define YY_END_OF_BUFFER 46
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -374,20 +374,21 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[103] =
+static yyconst flex_int16_t yy_accept[112] =
{ 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 43, 41,
- 22, 21, 21, 5, 41, 37, 38, 29, 41, 24,
- 30, 41, 31, 31, 23, 39, 29, 29, 35, 36,
- 25, 26, 22, 41, 3, 4, 3, 6, 15, 14,
- 17, 20, 42, 22, 0, 40, 29, 30, 31, 30,
- 0, 1, 0, 30, 0, 32, 0, 29, 29, 22,
- 0, 0, 2, 6, 12, 0, 11, 10, 7, 8,
- 9, 17, 19, 18, 0, 30, 30, 0, 0, 30,
- 32, 33, 29, 29, 0, 0, 0, 30, 34, 29,
- 27, 0, 13, 34, 28, 0, 0, 0, 0, 0,
-
- 16, 0
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 46, 44, 25, 24, 24, 5, 44, 40, 41, 32,
+ 44, 27, 33, 44, 34, 34, 26, 42, 44, 32,
+ 32, 38, 39, 28, 29, 25, 44, 3, 4, 3,
+ 6, 15, 14, 20, 23, 45, 17, 45, 25, 0,
+ 43, 32, 33, 34, 33, 0, 1, 0, 33, 0,
+ 35, 0, 16, 32, 32, 25, 0, 0, 2, 6,
+ 12, 0, 11, 10, 7, 8, 9, 20, 22, 21,
+ 17, 0, 18, 0, 33, 33, 0, 0, 33, 35,
+ 36, 32, 32, 0, 0, 0, 33, 37, 32, 30,
+
+ 0, 13, 37, 31, 0, 0, 0, 0, 0, 19,
+ 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -397,15 +398,15 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 2, 1, 6, 7, 1, 1, 1, 8, 9,
10, 11, 12, 13, 14, 15, 16, 17, 18, 18,
- 18, 18, 18, 18, 18, 18, 18, 19, 20, 1,
- 21, 1, 1, 22, 23, 24, 24, 24, 25, 26,
- 27, 27, 27, 27, 27, 28, 27, 27, 27, 27,
- 27, 29, 30, 31, 32, 27, 27, 33, 27, 27,
- 34, 35, 36, 1, 8, 1, 23, 24, 37, 38,
-
- 39, 40, 27, 27, 41, 27, 27, 42, 27, 43,
- 27, 27, 27, 44, 30, 45, 46, 27, 27, 33,
- 27, 27, 47, 1, 48, 1, 1, 1, 1, 1,
+ 18, 18, 18, 18, 18, 18, 18, 19, 20, 21,
+ 22, 23, 1, 24, 25, 26, 26, 26, 27, 28,
+ 29, 29, 29, 29, 29, 30, 29, 29, 29, 29,
+ 29, 31, 32, 33, 34, 29, 29, 35, 29, 29,
+ 36, 37, 38, 1, 8, 1, 25, 26, 39, 40,
+
+ 41, 42, 29, 29, 43, 29, 29, 44, 29, 45,
+ 29, 29, 29, 46, 32, 47, 48, 29, 29, 35,
+ 29, 29, 49, 1, 50, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -422,119 +423,125 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static yyconst flex_int32_t yy_meta[49] =
+static yyconst flex_int32_t yy_meta[51] =
{ 0,
1, 1, 1, 1, 1, 2, 1, 3, 1, 1,
3, 1, 1, 3, 1, 1, 4, 4, 1, 1,
- 1, 1, 4, 4, 4, 4, 3, 3, 3, 3,
- 3, 3, 3, 1, 2, 1, 4, 4, 4, 4,
- 3, 3, 3, 3, 3, 3, 1, 1
+ 1, 1, 1, 1, 4, 4, 4, 4, 3, 3,
+ 3, 3, 3, 3, 3, 1, 2, 1, 4, 4,
+ 4, 4, 3, 3, 3, 3, 3, 3, 1, 1
} ;
-static yyconst flex_int16_t yy_base[113] =
+static yyconst flex_int16_t yy_base[124] =
{ 0,
- 0, 47, 47, 48, 46, 47, 48, 49, 203, 204,
- 200, 204, 204, 204, 198, 204, 204, 0, 45, 204,
- 39, 50, 62, 71, 204, 204, 177, 41, 204, 204,
- 204, 204, 69, 158, 204, 204, 182, 0, 204, 69,
- 0, 204, 59, 195, 193, 204, 0, 80, 100, 104,
- 118, 204, 192, 106, 130, 166, 0, 64, 61, 98,
- 152, 149, 204, 0, 204, 0, 204, 204, 204, 204,
- 204, 0, 204, 204, 50, 55, 116, 139, 109, 120,
- 204, 161, 155, 115, 127, 0, 132, 141, 135, 121,
- 0, 120, 204, 204, 0, 106, 78, 72, 106, 159,
-
- 204, 204, 165, 169, 173, 177, 179, 183, 187, 99,
- 72, 70
+ 0, 49, 49, 50, 48, 49, 50, 51, 214, 213,
+ 218, 221, 215, 221, 221, 221, 213, 221, 221, 0,
+ 47, 221, 41, 55, 62, 66, 221, 221, 209, 189,
+ 32, 221, 221, 221, 221, 67, 170, 221, 221, 196,
+ 0, 221, 64, 0, 221, 61, 205, 187, 207, 205,
+ 221, 0, 77, 97, 99, 111, 221, 204, 103, 119,
+ 170, 0, 221, 46, 71, 98, 153, 126, 221, 0,
+ 221, 0, 221, 221, 221, 221, 221, 0, 221, 221,
+ 164, 146, 221, 57, 117, 124, 131, 129, 135, 221,
+ 138, 135, 123, 127, 0, 137, 139, 132, 131, 0,
+
+ 117, 221, 221, 0, 112, 99, 91, 111, 157, 221,
+ 221, 172, 176, 180, 184, 188, 190, 194, 198, 202,
+ 104, 98, 68
} ;
-static yyconst flex_int16_t yy_def[113] =
+static yyconst flex_int16_t yy_def[124] =
{ 0,
- 102, 1, 103, 103, 104, 104, 105, 105, 102, 102,
- 102, 102, 102, 102, 106, 102, 102, 107, 102, 102,
- 102, 102, 102, 102, 102, 102, 107, 107, 102, 102,
- 102, 102, 102, 102, 102, 102, 102, 108, 102, 102,
- 109, 102, 102, 102, 106, 102, 107, 102, 102, 102,
- 102, 102, 106, 102, 102, 102, 110, 107, 107, 102,
- 102, 102, 102, 108, 102, 111, 102, 102, 102, 102,
- 102, 109, 102, 102, 102, 102, 102, 102, 102, 102,
- 102, 110, 107, 107, 102, 112, 102, 102, 102, 107,
- 107, 102, 102, 102, 107, 102, 102, 102, 102, 102,
-
- 102, 0, 102, 102, 102, 102, 102, 102, 102, 102,
- 102, 102
+ 111, 1, 112, 112, 113, 113, 114, 114, 115, 115,
+ 111, 111, 111, 111, 111, 111, 116, 111, 111, 117,
+ 111, 111, 111, 111, 111, 111, 111, 111, 111, 117,
+ 117, 111, 111, 111, 111, 111, 111, 111, 111, 111,
+ 118, 111, 111, 119, 111, 111, 120, 120, 111, 116,
+ 111, 117, 111, 111, 111, 111, 111, 116, 111, 111,
+ 111, 121, 111, 117, 117, 111, 111, 111, 111, 118,
+ 111, 122, 111, 111, 111, 111, 111, 119, 111, 111,
+ 120, 120, 111, 111, 111, 111, 111, 111, 111, 111,
+ 121, 117, 117, 111, 123, 111, 111, 111, 117, 117,
+
+ 111, 111, 111, 117, 111, 111, 111, 111, 111, 111,
+ 0, 111, 111, 111, 111, 111, 111, 111, 111, 111,
+ 111, 111, 111
} ;
-static yyconst flex_int16_t yy_nxt[253] =
+static yyconst flex_int16_t yy_nxt[272] =
{ 0,
- 10, 11, 12, 13, 13, 14, 15, 10, 16, 17,
- 18, 19, 20, 19, 21, 22, 23, 24, 25, 26,
- 25, 10, 18, 18, 18, 27, 18, 18, 18, 18,
- 28, 18, 18, 29, 10, 30, 18, 18, 18, 27,
- 18, 18, 18, 18, 28, 18, 31, 32, 33, 36,
- 36, 39, 39, 42, 42, 50, 50, 37, 37, 48,
- 52, 49, 49, 51, 73, 53, 76, 76, 34, 59,
- 60, 76, 76, 93, 65, 86, 54, 51, 49, 49,
- 40, 40, 43, 43, 59, 54, 55, 49, 49, 56,
- 61, 83, 84, 74, 57, 55, 50, 50, 56, 60,
-
- 55, 66, 82, 67, 51, 83, 84, 100, 68, 55,
- 99, 69, 70, 71, 54, 98, 49, 49, 51, 61,
- 50, 50, 77, 77, 55, 80, 80, 56, 51, 75,
- 78, 75, 77, 77, 76, 76, 80, 80, 55, 91,
- 78, 79, 51, 79, 78, 95, 80, 80, 88, 88,
- 87, 97, 87, 91, 78, 88, 88, 88, 88, 95,
- 100, 96, 94, 92, 101, 35, 35, 35, 35, 38,
- 38, 38, 38, 41, 41, 41, 41, 45, 45, 45,
- 45, 47, 47, 64, 90, 64, 64, 72, 89, 72,
- 72, 85, 62, 81, 46, 46, 44, 63, 62, 58,
-
- 46, 44, 102, 9, 102, 102, 102, 102, 102, 102,
- 102, 102, 102, 102, 102, 102, 102, 102, 102, 102,
- 102, 102, 102, 102, 102, 102, 102, 102, 102, 102,
- 102, 102, 102, 102, 102, 102, 102, 102, 102, 102,
- 102, 102, 102, 102, 102, 102, 102, 102, 102, 102,
- 102, 102
+ 12, 13, 14, 15, 15, 16, 17, 12, 18, 19,
+ 20, 21, 22, 21, 23, 24, 25, 26, 27, 28,
+ 29, 27, 12, 12, 20, 20, 20, 30, 20, 20,
+ 20, 20, 31, 20, 20, 32, 12, 33, 20, 20,
+ 20, 30, 20, 20, 20, 20, 31, 20, 34, 35,
+ 36, 39, 39, 42, 42, 45, 45, 55, 55, 40,
+ 40, 53, 65, 54, 54, 57, 79, 56, 66, 71,
+ 58, 102, 37, 85, 85, 92, 59, 65, 54, 54,
+ 59, 56, 54, 54, 43, 43, 46, 46, 60, 92,
+ 67, 61, 60, 55, 55, 61, 62, 80, 72, 66,
+
+ 73, 95, 60, 56, 93, 74, 60, 91, 75, 76,
+ 77, 59, 109, 54, 54, 55, 55, 56, 93, 86,
+ 86, 67, 84, 60, 84, 56, 61, 85, 85, 87,
+ 88, 108, 88, 85, 85, 89, 89, 60, 107, 56,
+ 86, 86, 96, 87, 96, 89, 89, 97, 97, 100,
+ 87, 89, 89, 97, 97, 97, 97, 104, 109, 106,
+ 105, 103, 110, 100, 87, 101, 99, 98, 111, 82,
+ 94, 104, 38, 38, 38, 38, 41, 41, 41, 41,
+ 44, 44, 44, 44, 47, 47, 47, 47, 50, 50,
+ 50, 50, 52, 52, 70, 68, 70, 70, 78, 90,
+
+ 78, 78, 81, 81, 81, 81, 51, 51, 49, 83,
+ 82, 69, 68, 64, 63, 51, 49, 111, 48, 48,
+ 11, 111, 111, 111, 111, 111, 111, 111, 111, 111,
+ 111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
+ 111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
+ 111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
+ 111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
+ 111
} ;
-static yyconst flex_int16_t yy_chk[253] =
+static yyconst flex_int16_t yy_chk[272] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
- 4, 5, 6, 7, 8, 21, 21, 3, 4, 19,
- 22, 19, 19, 21, 43, 22, 75, 75, 2, 28,
- 33, 76, 76, 112, 40, 111, 23, 21, 23, 23,
- 5, 6, 7, 8, 28, 24, 23, 24, 24, 23,
- 33, 58, 59, 43, 23, 24, 48, 48, 24, 60,
-
- 23, 40, 110, 40, 48, 58, 59, 99, 40, 24,
- 98, 40, 40, 40, 49, 97, 49, 49, 48, 60,
- 50, 50, 54, 54, 49, 79, 79, 49, 50, 51,
- 54, 51, 77, 77, 51, 51, 80, 80, 49, 84,
- 77, 55, 50, 55, 54, 90, 55, 55, 87, 87,
- 78, 96, 78, 84, 77, 78, 78, 88, 88, 90,
- 100, 92, 89, 85, 100, 103, 103, 103, 103, 104,
- 104, 104, 104, 105, 105, 105, 105, 106, 106, 106,
- 106, 107, 107, 108, 83, 108, 108, 109, 82, 109,
- 109, 62, 61, 56, 53, 45, 44, 37, 34, 27,
-
- 15, 11, 9, 102, 102, 102, 102, 102, 102, 102,
- 102, 102, 102, 102, 102, 102, 102, 102, 102, 102,
- 102, 102, 102, 102, 102, 102, 102, 102, 102, 102,
- 102, 102, 102, 102, 102, 102, 102, 102, 102, 102,
- 102, 102, 102, 102, 102, 102, 102, 102, 102, 102,
- 102, 102
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 2, 3, 4, 5, 6, 7, 8, 23, 23, 3,
+ 4, 21, 31, 21, 21, 24, 46, 23, 36, 43,
+ 24, 123, 2, 84, 84, 64, 25, 31, 25, 25,
+ 26, 23, 26, 26, 5, 6, 7, 8, 25, 64,
+ 36, 25, 26, 53, 53, 26, 25, 46, 43, 66,
+
+ 43, 122, 25, 53, 65, 43, 26, 121, 43, 43,
+ 43, 54, 108, 54, 54, 55, 55, 53, 65, 59,
+ 59, 66, 56, 54, 56, 55, 54, 56, 56, 59,
+ 60, 107, 60, 85, 85, 60, 60, 54, 106, 55,
+ 86, 86, 87, 59, 87, 88, 88, 87, 87, 93,
+ 86, 89, 89, 96, 96, 97, 97, 99, 109, 105,
+ 101, 98, 109, 93, 86, 94, 92, 91, 82, 81,
+ 68, 99, 112, 112, 112, 112, 113, 113, 113, 113,
+ 114, 114, 114, 114, 115, 115, 115, 115, 116, 116,
+ 116, 116, 117, 117, 118, 67, 118, 118, 119, 61,
+
+ 119, 119, 120, 120, 120, 120, 58, 50, 49, 48,
+ 47, 40, 37, 30, 29, 17, 13, 11, 10, 9,
+ 111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
+ 111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
+ 111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
+ 111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
+ 111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
+ 111
} ;
/* Table of booleans, true if rule could match eol. */
-static yyconst flex_int32_t yy_rule_can_match_eol[43] =
+static yyconst flex_int32_t yy_rule_can_match_eol[46] =
{ 0,
0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, };
+ 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, };
/* The intent behind this definition is that it'll catch
* any uses of REJECT which flex missed.
@@ -619,12 +626,13 @@ static unsigned long long fromhex(const char *s)
}
-#line 623 "scanner.c"
+#line 630 "scanner.c"
#define INITIAL 0
#define COMMENT 1
#define STRING 2
#define INCLUDE 3
+#define SCRIPTBLOCK 4
#define YY_EXTRA_TYPE struct scan_context *
@@ -853,7 +861,7 @@ YY_DECL
#line 105 "scanner.l"
-#line 857 "scanner.c"
+#line 865 "scanner.c"
yylval = yylval_param;
@@ -909,13 +917,13 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 103 )
+ if ( yy_current_state >= 112 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
- while ( yy_current_state != 102 );
+ while ( yy_current_state != 111 );
yy_cp = yyg->yy_last_accepting_cpos;
yy_current_state = yyg->yy_last_accepting_state;
@@ -1035,7 +1043,7 @@ YY_RULE_SETUP
case 16:
YY_RULE_SETUP
#line 132 "scanner.l"
-{ BEGIN INCLUDE; }
+{ BEGIN SCRIPTBLOCK; }
YY_BREAK
case 17:
/* rule 17 can match eol */
@@ -1046,16 +1054,36 @@ YY_RULE_SETUP
case 18:
YY_RULE_SETUP
#line 134 "scanner.l"
-{ scanctx_append_string(yyextra, "\\"); }
+{
+ yylval->sval = scanctx_take_string(yyextra);
+ BEGIN INITIAL;
+ return(TOK_STRING);
+ }
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 135 "scanner.l"
-{ scanctx_append_string(yyextra, "\""); }
+#line 140 "scanner.l"
+{ BEGIN INCLUDE; }
YY_BREAK
case 20:
+/* rule 20 can match eol */
+YY_RULE_SETUP
+#line 141 "scanner.l"
+{ scanctx_append_string(yyextra, yytext); }
+ YY_BREAK
+case 21:
YY_RULE_SETUP
-#line 136 "scanner.l"
+#line 142 "scanner.l"
+{ scanctx_append_string(yyextra, "\\"); }
+ YY_BREAK
+case 22:
+YY_RULE_SETUP
+#line 143 "scanner.l"
+{ scanctx_append_string(yyextra, "\""); }
+ YY_BREAK
+case 23:
+YY_RULE_SETUP
+#line 144 "scanner.l"
{
const char *error;
FILE *fp = scanctx_push_include(yyextra,
@@ -1078,123 +1106,124 @@ YY_RULE_SETUP
BEGIN INITIAL;
}
YY_BREAK
-case 21:
-/* rule 21 can match eol */
+case 24:
+/* rule 24 can match eol */
YY_RULE_SETUP
-#line 160 "scanner.l"
+#line 168 "scanner.l"
{ /* ignore */ }
YY_BREAK
-case 22:
+case 25:
YY_RULE_SETUP
-#line 161 "scanner.l"
+#line 169 "scanner.l"
{ /* ignore */ }
YY_BREAK
-case 23:
+case 26:
YY_RULE_SETUP
-#line 163 "scanner.l"
+#line 171 "scanner.l"
{ return(TOK_EQUALS); }
YY_BREAK
-case 24:
+case 27:
YY_RULE_SETUP
-#line 164 "scanner.l"
+#line 172 "scanner.l"
{ return(TOK_COMMA); }
YY_BREAK
-case 25:
+case 28:
YY_RULE_SETUP
-#line 165 "scanner.l"
+#line 173 "scanner.l"
{ return(TOK_GROUP_START); }
YY_BREAK
-case 26:
+case 29:
YY_RULE_SETUP
-#line 166 "scanner.l"
+#line 174 "scanner.l"
{ return(TOK_GROUP_END); }
YY_BREAK
-case 27:
+case 30:
YY_RULE_SETUP
-#line 167 "scanner.l"
+#line 175 "scanner.l"
{ yylval->ival = 1; return(TOK_BOOLEAN); }
YY_BREAK
-case 28:
+case 31:
YY_RULE_SETUP
-#line 168 "scanner.l"
+#line 176 "scanner.l"
{ yylval->ival = 0; return(TOK_BOOLEAN); }
YY_BREAK
-case 29:
+case 32:
YY_RULE_SETUP
-#line 169 "scanner.l"
+#line 177 "scanner.l"
{ yylval->sval = yytext; return(TOK_NAME); }
YY_BREAK
-case 30:
+case 33:
YY_RULE_SETUP
-#line 170 "scanner.l"
+#line 178 "scanner.l"
{ yylval->fval = atof(yytext); return(TOK_FLOAT); }
YY_BREAK
-case 31:
+case 34:
YY_RULE_SETUP
-#line 171 "scanner.l"
+#line 179 "scanner.l"
{ yylval->ival = atoi(yytext); return(TOK_INTEGER); }
YY_BREAK
-case 32:
+case 35:
YY_RULE_SETUP
-#line 172 "scanner.l"
+#line 180 "scanner.l"
{ yylval->llval = atoll(yytext); return(TOK_INTEGER64); }
YY_BREAK
-case 33:
+case 36:
YY_RULE_SETUP
-#line 173 "scanner.l"
+#line 181 "scanner.l"
{
yylval->ival = strtoul(yytext, NULL, 16);
return(TOK_HEX);
}
YY_BREAK
-case 34:
+case 37:
YY_RULE_SETUP
-#line 177 "scanner.l"
+#line 185 "scanner.l"
{ yylval->llval = fromhex(yytext); return(TOK_HEX64); }
YY_BREAK
-case 35:
+case 38:
YY_RULE_SETUP
-#line 178 "scanner.l"
+#line 186 "scanner.l"
{ return(TOK_ARRAY_START); }
YY_BREAK
-case 36:
+case 39:
YY_RULE_SETUP
-#line 179 "scanner.l"
+#line 187 "scanner.l"
{ return(TOK_ARRAY_END); }
YY_BREAK
-case 37:
+case 40:
YY_RULE_SETUP
-#line 180 "scanner.l"
+#line 188 "scanner.l"
{ return(TOK_LIST_START); }
YY_BREAK
-case 38:
+case 41:
YY_RULE_SETUP
-#line 181 "scanner.l"
+#line 189 "scanner.l"
{ return(TOK_LIST_END); }
YY_BREAK
-case 39:
+case 42:
YY_RULE_SETUP
-#line 182 "scanner.l"
+#line 190 "scanner.l"
{ return(TOK_SEMICOLON); }
YY_BREAK
-case 40:
+case 43:
*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
yyg->yy_c_buf_p = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
-#line 183 "scanner.l"
+#line 191 "scanner.l"
{ /* ignore */ }
YY_BREAK
-case 41:
+case 44:
YY_RULE_SETUP
-#line 184 "scanner.l"
+#line 192 "scanner.l"
{ return(TOK_GARBAGE); }
YY_BREAK
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(COMMENT):
case YY_STATE_EOF(STRING):
case YY_STATE_EOF(INCLUDE):
-#line 186 "scanner.l"
+case YY_STATE_EOF(SCRIPTBLOCK):
+#line 194 "scanner.l"
{
YY_BUFFER_STATE buf = (YY_BUFFER_STATE)scanctx_pop_include(
yyextra);
@@ -1207,12 +1236,12 @@ case YY_STATE_EOF(INCLUDE):
yyterminate();
}
YY_BREAK
-case 42:
+case 45:
YY_RULE_SETUP
-#line 197 "scanner.l"
+#line 205 "scanner.l"
ECHO;
YY_BREAK
-#line 1216 "scanner.c"
+#line 1245 "scanner.c"
case YY_END_OF_BUFFER:
{
@@ -1506,7 +1535,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 103 )
+ if ( yy_current_state >= 112 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1535,11 +1564,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 103 )
+ if ( yy_current_state >= 112 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 102);
+ yy_is_jam = (yy_current_state == 111);
(void)yyg;
return yy_is_jam ? 0 : yy_current_state;
@@ -2346,4 +2375,4 @@ void libconfig_yyfree (void * ptr , yyscan_t yyscanner)
#define YYTABLES_NAME "yytables"
-#line 197 "scanner.l"
+#line 205 "scanner.l"
diff --git a/3rdparty/libconfig/scanner.h b/3rdparty/libconfig/scanner.h
index da1134498..181bc5c94 100644
--- a/3rdparty/libconfig/scanner.h
+++ b/3rdparty/libconfig/scanner.h
@@ -226,6 +226,7 @@ void libconfig_yyfree (void * ,yyscan_t yyscanner );
#define COMMENT 1
#define STRING 2
#define INCLUDE 3
+#define SCRIPTBLOCK 4
#endif
@@ -333,8 +334,8 @@ extern int libconfig_yylex \
#undef YY_DECL
#endif
-#line 197 "scanner.l"
+#line 205 "scanner.l"
-#line 339 "scanner.h"
+#line 340 "scanner.h"
#undef libconfig_yyIN_HEADER
#endif /* libconfig_yyHEADER_H */
diff --git a/conf/atcommand.conf b/conf/atcommand.conf
index fc2a1af73..df4972067 100644
--- a/conf/atcommand.conf
+++ b/conf/atcommand.conf
@@ -56,6 +56,7 @@ aliases: {
accinfo: ["accountinfo"]
itemreset: ["clearinventory"]
channel: ["main"]
+ autoloottype: ["aloottype"]
}
/* List of commands that should not be logged at all */
diff --git a/conf/battle/player.conf b/conf/battle/player.conf
index 03d51bbaf..c11015937 100644
--- a/conf/battle/player.conf
+++ b/conf/battle/player.conf
@@ -163,5 +163,5 @@ snovice_call_type: 0
// 0x200 - @/#Command Request
// Please note that at least 1 option has to be enabled.
// Be mindful that the more options used, the easier it becomes to cheat features that rely on idletime (e.g. checkidle()).
-// Default: walk ( 0x1 ) + useskilltoid ( 0x2 ) + useskilltopos ( 0x4 ) + useitem ( 0x8 ) + attack ( 0x10 ) = 0x25
+// Default: walk ( 0x1 ) + useskilltoid ( 0x2 ) + useskilltopos ( 0x4 ) + useitem ( 0x8 ) + attack ( 0x10 ) = 0x1F
idletime_criteria: 0x1F
diff --git a/conf/groups.conf b/conf/groups.conf
index 7c97352dc..9403e34f6 100644
--- a/conf/groups.conf
+++ b/conf/groups.conf
@@ -120,6 +120,7 @@ groups: (
noks: true
autoloot: true
alootid: true
+ autoloottype: true
autotrade: true
request: true
go: true
diff --git a/conf/help.txt b/conf/help.txt
index 211ed5b19..a65c7de70 100644
--- a/conf/help.txt
+++ b/conf/help.txt
@@ -300,3 +300,8 @@ reloadscript: "Reload all scripts."
gat: "For debugging (you inspect around gat)"
send: "For debugging (packet variety)"
nuke: "Params: <char name>\n" "Blow somebody up, including those surrounding them."
+autoloottype: "Manage a list of autolooting item types.\n"
+" To add an item type to the list, use \"@autoloottype +<type name>\".\n"
+" To remove an item type, use \"@autoloottype -<type name>\".\n"
+" Type List: healing, usable, etc, weapon, armor, card, petegg, petarmor, ammo.\n"
+" \"@autoloottype reset\" will clear your autoloottype list."
diff --git a/conf/messages.conf b/conf/messages.conf
index 7b7a99301..a9f0a5984 100644
--- a/conf/messages.conf
+++ b/conf/messages.conf
@@ -192,7 +192,7 @@
169: The item (%d: '%s') is not equipable.
170: The item is not equipable.
171: %d - void
-//172: You replace previous memo position %d - %s (%d,%d).
+172: Speed returned to normal.
//173: Note: you don't have the 'Warp' skill level to use it.
174: Number of status points changed.
175: Number of skill points changed.
@@ -1534,5 +1534,17 @@
//CashShop mapflag
1489: Cash Shop is disabled in this map
+
+// @autoloottype
+1490: You're already autolooting this item type.
+1491: Item type not found.
+1492: Autolooting item type: '%s'
+1493: You're currently not autolooting this item type.
+1494: Removed item type: '%s' from your autoloottype list.
+1495: Your autoloottype list is empty.
+1496: Item types on your autoloottype list:
+1497: Your autoloottype list has been reset.
+
+
//Custom translations
import: conf/import/msg_conf.txt
diff --git a/configure b/configure
index 919d6f883..bf0a4d8ea 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.in c4af60e.
+# From configure.in 0219c4d.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69.
#
@@ -691,6 +691,10 @@ ac_user_opts='
enable_option_checking
enable_manager
enable_packetver
+enable_packetver_re
+with_key1
+with_key2
+with_key3
enable_debug
enable_buildbot
enable_rdtsc
@@ -1323,8 +1327,9 @@ Optional Features:
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-manager=ARG memory managers: no, builtin, memwatch, dmalloc,
gcollect, bcheck (defaults to builtin)
- --enable-packetver=ARG Sets the PACKETVER define of the map-server. (see
- src/map/clif.h)
+ --enable-packetver=ARG Sets the PACKETVER define. (see src/common/mmo.h)
+ --disable-packetver-re Sets or unsets the PACKETVER_RE define - see
+ src/common/mmo.h (currently enabled by default)
--enable-debug[=ARG] Compiles extra debug code. (disabled by default)
(available options: yes, no, gdb)
--enable-buildbot[=ARG] (available options: yes, no)
@@ -1352,6 +1357,12 @@ Optional Features:
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-key1[=ARG] Set the first obfuscation key (ignored unless the
+ other two are also specified)
+ --with-key2[=ARG] Set the second obfuscation key (ignored unless the
+ other two are also specified)
+ --with-key3[=ARG] Set the third obfuscation key (ignored unless the
+ other two are also specified)
--with-maxconn[=ARG] optionally set the maximum connections the core can
handle (default: 16384) NOT USED YET - EXPERIMENTAL
--with-mysql[=ARG] optionally specify the path to the mysql_config
@@ -3461,6 +3472,79 @@ fi
#
+# packetver-RE
+#
+# Check whether --enable-packetver-re was given.
+if test "${enable_packetver_re+set}" = set; then :
+ enableval=$enable_packetver_re;
+ enable_packetver_re="$enableval"
+ case $enableval in
+ "no");;
+ "yes");;
+ *) as_fn_error $? "invalid argument --enable-packetver-re=$enableval... stopping" "$LINENO" 5;;
+ esac
+
+else
+ enable_packetver_re="yes"
+
+fi
+
+
+
+#
+# Obfuscation keys
+#
+
+# Check whether --with-key1 was given.
+if test "${with_key1+set}" = set; then :
+ withval=$with_key1;
+ obfuscationkey1="$( expr "0x$withval" : '0*x*\(0x[A-Fa-f0-9]\{8\}\)' )"
+ if ! expr "x$obfuscationkey1" : 'x0x[A-Fa-f0-9]\{8\}' >/dev/null 2>&1; then
+ obfuscationkey1=""
+ fi
+
+else
+
+ obfuscationkey1=""
+
+
+fi
+
+
+# Check whether --with-key2 was given.
+if test "${with_key2+set}" = set; then :
+ withval=$with_key2;
+ obfuscationkey2="$( expr "0x$withval" : '0*x*\(0x[A-Fa-f0-9]\{8\}\)' )"
+ if ! expr "x$obfuscationkey2" : 'x0x[A-Fa-f0-9]\{8\}' >/dev/null 2>&1; then
+ obfuscationkey2=""
+ fi
+
+else
+
+ obfuscationkey2=""
+
+
+fi
+
+
+# Check whether --with-key3 was given.
+if test "${with_key3+set}" = set; then :
+ withval=$with_key3;
+ obfuscationkey3="$( expr "0x$withval" : '0*x*\(0x[A-Fa-f0-9]\{8\}\)' )"
+ if ! expr "x$obfuscationkey3" : 'x0x[A-Fa-f0-9]\{8\}' >/dev/null 2>&1; then
+ obfuscationkey3=""
+ fi
+
+else
+
+ obfuscationkey3=""
+
+
+fi
+
+
+
+#
# debug
#
# Check whether --enable-debug was given.
@@ -5361,6 +5445,24 @@ if test -n "$enable_packetver" ; then
CFLAGS="$CFLAGS -DPACKETVER=$enable_packetver"
fi
+#
+# Packetver-RE
+#
+case $enable_packetver_re in
+ "yes")
+ # default value
+ CFLAGS="$CFLAGS -DDISABLE_PACKETVER_RE"
+ ;;
+ "no")
+ ;;
+esac
+
+#
+# Obfuscation keys
+#
+if test -n "$obfuscationkey1" -a -n "$obfuscationkey2" -a -n "$obfuscationkey3"; then
+ CFLAGS="$CFLAGS -DOBFUSCATIONKEY1=$obfuscationkey1 -DOBFUSCATIONKEY2=$obfuscationkey2 -DOBFUSCATIONKEY3=$obfuscationkey3"
+fi
#
# Debug
@@ -6376,7 +6478,7 @@ esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MinGW" >&5
$as_echo_n "checking for MinGW... " >&6; }
-if test -n "`$CC --version | grep -i mingw`" ; then
+if test -n "`$CC --version 2>/dev/null | grep -i mingw`" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
CPPFLAGS="$CPPFLAGS -DMINGW"
diff --git a/configure.in b/configure.in
index b79e51f6d..98c493a03 100644
--- a/configure.in
+++ b/configure.in
@@ -46,7 +46,7 @@ AC_ARG_ENABLE(
[packetver],
AC_HELP_STRING(
[--enable-packetver=ARG],
- [Sets the PACKETVER define of the map-server. (see src/map/clif.h)]
+ [Sets the PACKETVER define. (see src/common/mmo.h)]
),
[enable_packetver="$enableval"],
[enable_packetver=""]
@@ -54,6 +54,80 @@ AC_ARG_ENABLE(
#
+# packetver-RE
+#
+AC_ARG_ENABLE(
+ [packetver-re],
+ AC_HELP_STRING(
+ [--disable-packetver-re],
+ [Sets or unsets the PACKETVER_RE define - see src/common/mmo.h (currently enabled by default)]
+ ),
+ [
+ enable_packetver_re="$enableval"
+ case $enableval in
+ "no");;
+ "yes");;
+ *) AC_MSG_ERROR([[invalid argument --enable-packetver-re=$enableval... stopping]]);;
+ esac
+ ],
+ [enable_packetver_re="yes"]
+)
+
+
+#
+# Obfuscation keys
+#
+AC_ARG_WITH(
+ [key1],
+ AC_HELP_STRING(
+ [--with-key1@<:@=ARG@:>@],
+ [Set the first obfuscation key (ignored unless the other two are also specified)]
+ ),
+ [
+ obfuscationkey1="$( expr "0x$withval" : '0*x*\(0x@<:@A-Fa-f0-9@:>@\{8\}\)' )"
+ if ! expr "x$obfuscationkey1" : 'x0x@<:@A-Fa-f0-9@:>@\{8\}' >/dev/null 2>&1; then
+ obfuscationkey1=""
+ fi
+ ],
+ [
+ obfuscationkey1=""
+ ]
+)
+AC_ARG_WITH(
+ [key2],
+ AC_HELP_STRING(
+ [--with-key2@<:@=ARG@:>@],
+ [Set the second obfuscation key (ignored unless the other two are also specified)]
+ ),
+ [
+ obfuscationkey2="$( expr "0x$withval" : '0*x*\(0x@<:@A-Fa-f0-9@:>@\{8\}\)' )"
+ if ! expr "x$obfuscationkey2" : 'x0x@<:@A-Fa-f0-9@:>@\{8\}' >/dev/null 2>&1; then
+ obfuscationkey2=""
+ fi
+ ],
+ [
+ obfuscationkey2=""
+ ]
+)
+AC_ARG_WITH(
+ [key3],
+ AC_HELP_STRING(
+ [--with-key3@<:@=ARG@:>@],
+ [Set the third obfuscation key (ignored unless the other two are also specified)]
+ ),
+ [
+ obfuscationkey3="$( expr "0x$withval" : '0*x*\(0x@<:@A-Fa-f0-9@:>@\{8\}\)' )"
+ if ! expr "x$obfuscationkey3" : 'x0x@<:@A-Fa-f0-9@:>@\{8\}' >/dev/null 2>&1; then
+ obfuscationkey3=""
+ fi
+ ],
+ [
+ obfuscationkey3=""
+ ]
+)
+
+
+#
# debug
#
AC_ARG_ENABLE(
@@ -771,6 +845,24 @@ if test -n "$enable_packetver" ; then
CFLAGS="$CFLAGS -DPACKETVER=$enable_packetver"
fi
+#
+# Packetver-RE
+#
+case $enable_packetver_re in
+ "yes")
+ # default value
+ CFLAGS="$CFLAGS -DDISABLE_PACKETVER_RE"
+ ;;
+ "no")
+ ;;
+esac
+
+#
+# Obfuscation keys
+#
+if test -n "$obfuscationkey1" -a -n "$obfuscationkey2" -a -n "$obfuscationkey3"; then
+ CFLAGS="$CFLAGS -DOBFUSCATIONKEY1=$obfuscationkey1 -DOBFUSCATIONKEY2=$obfuscationkey2 -DOBFUSCATIONKEY3=$obfuscationkey3"
+fi
#
# Debug
@@ -1035,7 +1127,7 @@ esac
AC_SUBST([DLLEXT])
AC_MSG_CHECKING([for MinGW])
-if test -n "`$CC --version | grep -i mingw`" ; then
+if test -n "`$CC --version 2>/dev/null | grep -i mingw`" ; then
AC_MSG_RESULT([yes])
CPPFLAGS="$CPPFLAGS -DMINGW"
if test -z "$fd_setsize" ; then
diff --git a/db/const.txt b/db/const.txt
index 423757090..a90b87356 100644
--- a/db/const.txt
+++ b/db/const.txt
@@ -613,6 +613,12 @@ EQI_COSTUME_HEAD_LOW 11
EQI_COSTUME_HEAD_MID 12
EQI_COSTUME_HEAD_TOP 13
EQI_COSTUME_GARMENT 14
+EQI_SHADOW_ARMOR 15
+EQI_SHADOW_WEAPON 16
+EQI_SHADOW_SHIELD 17
+EQI_SHADOW_SHOES 18
+EQI_SHADOW_ACC_R 19
+EQI_SHADOW_ACC_L 20
LOOK_BASE 0
LOOK_HAIR 1
@@ -1239,6 +1245,8 @@ SC_KINGS_GRACE 557
SC_TELEKINESIS_INTENSE 558
SC_OFFERTORIUM 559
SC_FRIGG_SONG 560
+SC_ALL_RIDING 561
+SC_HANBOK 562
SC_MONSTER_TRANSFORM 563
SC_ANGEL_PROTECT 564
SC_ILLUSIONDOPING 565
diff --git a/db/re/refine_db.txt b/db/re/refine_db.txt
index a9b7fedd1..2b78a9d44 100644
--- a/db/re/refine_db.txt
+++ b/db/re/refine_db.txt
@@ -27,15 +27,14 @@
// Chance:
// 100 = 100%
//
-// Note: Chances for +11 and higher are not verified - 10% is a rumor from iRO wiki.
// A note about renewal Armors, there may or may not be another bonus, according to iRO wiki: Every upgrade gives floor[( 3 + current upgrade ) / 4] equipment DEF)
-0,0,0,0,100:100,100:100,100:100,100:100,60:200,40:200,40:200,20:200,20:300,10:300,100:300,100:300,100:400,100:400,90:400,60:400,60:500,30:500,30:500,10:500
+0,0,0,0,100:100,100:100,100:100,100:100,60:200,40:200,40:200,20:200,20:300,10:300,8:300,8:300,8:400,8:400,7:400,7:400,7:500,7:500,5:500,5:500
// Level 1 weapons
-1,200,8,300,100:0,100:0,100:0,100:0,100:0,100:0,100:0,60:0,40:0,20:0,100:0,100:0,100:0,100:0,100:0,100:300,100:300,90:300,60:300,20:300
+1,200,8,300,100:0,100:0,100:0,100:0,100:0,100:0,100:0,60:0,40:0,20:0,18:0,18:0,18:0,18:0,18:0,17:300,17:300,17:300,15:300,15:300
// Level 2 weapons
-2,300,7,500,100:0,100:0,100:0,100:0,100:0,100:0,60:0,40:0,20:0,20:0,100:0,100:0,100:0,100:0,100:0,100:600,90:600,60:600,30:600,20:600
+2,300,7,500,100:0,100:0,100:0,100:0,100:0,100:0,60:0,40:0,20:0,20:0,18:0,18:0,18:0,18:0,18:0,17:600,17:600,17:600,15:600,15:600
// Level 3 weapons
-3,500,6,800,100:0,100:0,100:0,100:0,100:0,60:0,50:0,20:0,20:0,20:0,100:0,100:0,100:0,100:0,100:0,90:900,75:900,30:900,30:900,20:900
+3,500,6,800,100:0,100:0,100:0,100:0,100:0,60:0,50:0,20:0,20:0,20:0,18:0,18:0,18:0,18:0,18:0,17:900,17:900,17:900,15:900,15:900
// Level 4 weapons
-4,700,5,1400,100:0,100:0,100:0,100:0,60:0,40:0,40:0,20:0,20:0,10:0,100:0,100:0,100:0,100:0,90:0,60:1200,60:1200,30:1200,30:1200,10:1200
+4,700,5,1400,100:0,100:0,100:0,100:0,60:0,40:0,40:0,20:0,20:0,10:0,8:0,8:0,8:0,8:0,8:0,7:1200,7:1200,7:1200,5:1200,5:1200
diff --git a/db/sc_config.txt b/db/sc_config.txt
index 9e0b8b268..38e10e4c2 100644
--- a/db/sc_config.txt
+++ b/db/sc_config.txt
@@ -10,6 +10,7 @@
// 16 - SC considered as buff and be removed by Hermode and etc.
// 32 - SC considered as debuff and be removed by Gospel and etc.
// 64 - SC cannot be reset when MADO Gear is taken off.
+// 128 - SC cannot be reset by sc_end and change clear.
//Example:
//SC_ENDURE, 21 //SC_ENDURE: cannot be removed by death and dispell and cosidered as buff. (16 + 4 + 1 = 21)
@@ -395,12 +396,12 @@ SC_SOULCOLD,78
SC_HAWKEYES,78
// Unremovable
-SC_WEIGHTOVER50, 79
-SC_WEIGHTOVER90, 79
+SC_WEIGHTOVER50, 207
+SC_WEIGHTOVER90, 207
SC_WEDDING, 77
SC_XMAS, 77
SC_SUMMER, 77
-SC_NOCHAT, 77
+SC_NOCHAT, 205
SC_FUSION, 77
SC_EARTHSCROLL, 77
SC_STORMKICK_READY, 77
@@ -408,7 +409,7 @@ SC_DOWNKICK_READY, 77
SC_COUNTERKICK_READY, 77
SC_TURNKICK_READY, 77
SC_DODGE_READY, 77
-SC_JAILED, 77
+SC_JAILED, 205
SC_AUTOTRADE, 77
SC_WHISTLE, 79
SC_ASSNCROS, 79
@@ -419,6 +420,9 @@ SC_DONTFORGETME, 79
SC_FORTUNE, 79
SC_SERVICEFORYOU, 79
SC_INCHIT, 77
-SC_PUSH_CART, 0x4D
-SC_MOONSTAR, 79
-SC_SUPER_STAR, 79
+SC_PUSH_CART, 205
+SC_MOONSTAR, 207
+SC_SUPER_STAR, 207
+
+//Cant Clear
+SC_ALL_RIDING, 128 \ No newline at end of file
diff --git a/doc/atcommands.txt b/doc/atcommands.txt
index 42b085cd6..b2c765d6a 100644
--- a/doc/atcommands.txt
+++ b/doc/atcommands.txt
@@ -337,6 +337,16 @@ By default, 10 items can be autolooted at one time.
---------------------------------------
+@autoloottype <+/-><type name>
+@autoloottype reset
+
+Starts or stops autolooting a specified item type.
+Type List: healing, usable, etc, weapon, armor, card, petegg, petarmor, ammo.
+Typing "reset" will clear the autoloot item list.
+
+---------------------------------------
+
+
@mobsearch <monster name>
Locates and displays the position of a certain mob on the current map.
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index bd0b032f1..f0016b104 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -207,7 +207,7 @@ Ex: if your NPC is named 'Hunter#hunter1', it will be displayed as 'Hunter'
** Define a warp point
-<from map name>,<fromX>,<fromY>,<facing>%TAB%warp%TAB%<warp name>%TAB%<spanx>,<spany>,<to map name>,<toX>,<toY>
+<from map name>,<fromX>,<fromY>{,<facing>}%TAB%warp%TAB%<warp name>%TAB%<spanx>,<spany>,<to map name>,<toX>,<toY>
This will define a warp NPC that will warp a player between maps, and
while most arguments of that are obvious, some deserve special mention.
@@ -299,7 +299,7 @@ items here. The layout used to define sale items still count, and
** Define an warp/shop/cashshop/NPC duplicate.
-warp: <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<spanx>,<spany>
+warp: <map name>,<x>,<y>{,<facing>}%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<spanx>,<spany>
shop/cashshop/npc: -%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>
shop/cashshop/npc: <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>
npc: -%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>
@@ -2550,6 +2550,13 @@ EQI_HEAD_LOW (10) - Lower Headgear (beards, some masks)
EQI_COSTUME_HEAD_LOW (11) - Lower Costume Headgear
EQI_COSTUME_HEAD_MID (12) - Middle Costume Headgear
EQI_COSTUME_HEAD_TOP (13) - Upper Costume Headgear
+EQI_COSTUME_GARMENT (14) - Costume Garment
+EQI_SHADOW_ARMOR (15) - Shadow Armor
+EQI_SHADOW_WEAPON (16) - Shadow Weapon
+EQI_SHADOW_SHIELD (17) - Shadow Shield
+EQI_SHADOW_SHOES (18) - Shadow Shoes
+EQI_SHADOW_ACC_R (19) - Shadow Accessory 2
+EQI_SHADOW_ACC_L (20) - Shadow Accessory 1
Notice that a few items occupy several equipment slots, and if the
character is wearing such an item, 'getequipid' will return it's ID number
diff --git a/npc/custom/bgqueue/flavius.txt b/npc/custom/bgqueue/flavius.txt
index b3db9f81d..778feb55d 100644
--- a/npc/custom/bgqueue/flavius.txt
+++ b/npc/custom/bgqueue/flavius.txt
@@ -3,18 +3,20 @@
//===== By: ==================================================
//= L0ne_W0lf
//===== Current Version: =====================================
-//= 1.4
+//= 1.5b
//===== Description: =========================================
//= [AEGIS Conversion]
//= Flavius Battleground.
//= - Winning Team: 9 badges
//= - Losing Team: 3 badge
//===== Additional Comments: =================================
-//= 1.0 First Version.
-//= 1.1 Fixed pink crystal spawning as blue. [L0ne_W0lf]
-//= 1.2 Updated 'waitingroom' to support required zeny/lvl. [Kisuka]
-//= 1.3 Removed MaxLvl check in waitingrooms. Replaced setwall with setcell.
-//= 1.4 Attempt at implementing BG Queue [Ind/Hercules]
+//= 1.0 First Version.
+//= 1.1 Fixed pink crystal spawning as blue. [L0ne_W0lf]
+//= 1.2 Updated 'waitingroom' to support required zeny/lvl. [Kisuka]
+//= 1.3 Removed MaxLvl check in waitingrooms. Replaced setwall with setcell.
+//= 1.4 Attempt at implementing BG Queue [Ind/Hercules]
+//= 1.5 Attempt at implementing BG Queue team-algorithm [jaBote]
+//= 1.5b Adjustments to the team-splitting algorithm [Haruna]
//============================================================
@@ -36,20 +38,86 @@ OnPlayerListReady:
queueopt($@Guill_QueueBG1,HQO_OnLogout,"start#bat_b01::OnGuillaumeQuit");
queueopt($@Croix_QueueBG1,HQO_OnLogout,"start#bat_b01::OnCroixQuit");
- set .@it,queueiterator($@bg_queue_id);
set .@i, 0;
- for( set .@member, qiget(.@it); qicheck(.@it); set .@member,qiget(.@it) ) {
- if( .@i % 2 == 0 ) {
- bg_join_team($@FlaviusBG1_id1,.@member);
- queueadd($@Guill_QueueBG1,.@member);
- } else {
- bg_join_team($@FlaviusBG1_id2,.@member);
- queueadd($@Croix_QueueBG1,.@member);
+ copyarray .@bg_member[0],$@bg_member[0],$@bg_member_size;
+ copyarray .@bg_member_group[0],$@bg_member_group[0],$@bg_member_size;
+ copyarray .@bg_member_type[0],$@bg_member_type[0],$@bg_member_size;
+
+ freeloop(1);
+ // Counting all participants and determining sizes, condensing .@bg_member_group
+ set .@nogroupcount, 0;
+ for (set .@i, 0; .@i < getarraysize(.@bg_member); set .@i, .@i + 1) {
+ if (.@bg_member_group[.@i] == 0) { // Just count them
+ set .@nogroupcount, .@nogroupcount + 1;
+ continue;
+ }
+ // check if .@bg_member_group and .@bg_member_type already exists on these groups.
+ for (set .@j, 0; .@j < getarraysize(.@bg_groups); set .@j, .@j + 1) { // <= since it has to start working even if the array is still blank
+ if ( (.@bg_member_group[.@i] == .@bg_groups[.@j]) && (.@bg_member_type[.@i] == .@bg_types[.@j]) ) {
+ set .@bg_count[.@j], .@bg_count[.@j] + 1;
+ break;
+ }
+ // Else keep running the loop until we find there's a group already made or make a new one
+ }
+ if (.@j == (getarraysize(.@bg_groups)) ) { // It isn't there, insert a new entry at j
+ set .@bg_groups[.@j], .@bg_member_group[.@i];
+ set .@bg_types[.@j], .@bg_member_type[.@i];
+ set .@bg_count[.@j], 1;
+ }
+ }
+
+ // Now, sorting the group arrays from amount of population descending! Bubble sort powers, I call upon thee!
+ // Type doesn't matter here for precedence checks, but also needs to be sorted the same way along with groups
+ for (set .@i, 0; .@i < getarraysize(.@bg_groups); set .@i, .@i + 1) {
+ for (set .@j, 0; .@j < (getarraysize(.@bg_groups) - .@i); set .@j, .@j + 1) {
+ if (.@bg_count[.@j] < .@bg_count[.@j+1]){
+ set .@temp1, .@bg_groups[.@j];
+ set .@temp2, .@bg_types[.@j];
+ set .@temp3, .@bg_count[.@j];
+ set .@bg_groups[.@j], .@bg_groups[.@j+1];
+ set .@bg_types[.@j], .@bg_types[.@j+1];
+ set .@bg_count[.@j], .@bg_count[.@j+1];
+ set .@bg_groups[.@j+1], .@temp1;
+ set .@bg_types[.@j+1], .@temp2;
+ set .@bg_count[.@j+1], .@temp3;
+ }
+ }
+ }
+
+ // Add the groups to the queues! :D
+ for (set .@i, 0; .@i < getarraysize(.@bg_groups); set .@i, .@i + 1){
+ if (queuesize($@Croix_QueueBG1) <= queuesize($@Guill_QueueBG1)){ // Catch'em all and add to the queue!
+ for (set .@j, 0; .@j < getarraysize(.@bg_member); set .@j, .@j + 1) {
+ if ( (.@bg_groups[.@i] == .@bg_member_group[.@j]) && (.@bg_types[.@i] == .@bg_member_type[.@j]) ) {
+ bg_join_team($@FlaviusBG1_id1,.@bg_member[.@j]);
+ queueadd($@Croix_QueueBG1, .@bg_member[.@j]);
+ }
+ }
+ }
+ else {
+ for (set .@j, 0; .@j < getarraysize(.@bg_member); set .@j, .@j + 1) {
+ if ( (.@bg_groups[.@i] == .@bg_member_group[.@j]) && (.@bg_types[.@i] == .@bg_member_type[.@j]) ) {
+ bg_join_team($@FlaviusBG1_id2,.@bg_member[.@j]);
+ queueadd($@Guill_QueueBG1, .@bg_member[.@j]);
+ }
+ }
+ }
+ }
+ // Don't forget the people that go on their own!
+ for (set .@i, 0; .@i <= getarraysize(.@bg_member); set .@i, .@i+1) {
+ if (.@bg_member_group[.@i] == 0) { // Get alone people only
+ if (queuesize($@Croix_QueueBG1) <= queuesize($@Guill_QueueBG1)) {
+ bg_join_team($@FlaviusBG1_id1,.@bg_member[.@i]);
+ queueadd($@Croix_QueueBG1, .@bg_member[.@i]);
+ }
+ else {
+ bg_join_team($@FlaviusBG1_id2,.@bg_member[.@i]);
+ queueadd($@Guill_QueueBG1, .@bg_member[.@i]);
+ }
}
- set .@i,.@i + 1;
}
- qiclear(.@it);
+ freeloop(0);
set $@FlaviusBG1, 1;
set $@FlaviusBG1_Victory, 0;
diff --git a/npc/instances/EndlessTower.txt b/npc/instances/EndlessTower.txt
index 7d1bee6aa..e39cfbbff 100644
--- a/npc/instances/EndlessTower.txt
+++ b/npc/instances/EndlessTower.txt
@@ -1252,7 +1252,7 @@ OnTimer5000:
end;
}
-1@tower,12,393,0 script 1FGate102tower 45,2,2,{
+1@tower,12,393,0 script 1FGate102tower WARPNPC,2,2,{
end;
OnInstanceInit:
@@ -1323,7 +1323,7 @@ L_Display:
1@tower,184,51,0 duplicate(1FGate102tower) 23FGate102tower WARPNPC,2,2
1@tower,270,51,0 duplicate(1FGate102tower) 24FGate102tower WARPNPC,2,2
-1@tower,355,51,0 script 25FGate102tower 45,2,2,{
+1@tower,355,51,0 script 25FGate102tower WARPNPC,2,2,{
end;
OnInstanceInit:
@@ -1347,7 +1347,7 @@ OnTimer120000:
end;
}
-1@tower,355,51,0 script 25FGate102tower-2 45,2,2,{
+1@tower,355,51,0 script 25FGate102tower-2 WARPNPC,2,2,{
end;
OnInstanceInit:
@@ -2244,4 +2244,4 @@ OnTimer1000:
stopnpctimer;
donpcevent instance_npcname("#Effect30")+"::OnEnable";
end;
-} \ No newline at end of file
+}
diff --git a/npc/other/hugel_bingo.txt b/npc/other/hugel_bingo.txt
index 2bd8f1d55..0a47b4f00 100644
--- a/npc/other/hugel_bingo.txt
+++ b/npc/other/hugel_bingo.txt
@@ -276,7 +276,7 @@ OnTimer460000:
end;
}
-que_bingo,49,125,0 script 1a#bingo 139,1,1,{
+que_bingo,49,125,0 script 1a#bingo HIDDEN_WARP_NPC,1,1,{
end;
OnInit:
diff --git a/npc/other/turbo_track.txt b/npc/other/turbo_track.txt
index b135cd093..dea910aa3 100644
--- a/npc/other/turbo_track.txt
+++ b/npc/other/turbo_track.txt
@@ -1918,7 +1918,7 @@ turbo_n_1,222,45,0 duplicate(TurboHint_4#tt_main) #n1NoWayOut5 -1,1,1
turbo_n_1,222,61,0 duplicate(TurboHint_4#tt_main) #n1NoWayOut6 -1,1,1
turbo_n_1,222,65,0 duplicate(TurboHint_4#tt_main) #n1NoWayOut7 -1,1,1
-- script cos_end#tt_main 01,{
+- script cos_end#tt_main -1,{
function GetNumber;
OnTouch:
set .@w$,callfunc("F_tt");
diff --git a/npc/quests/first_class/tu_acolyte.txt b/npc/quests/first_class/tu_acolyte.txt
index fde13dbae..c788462bd 100644
--- a/npc/quests/first_class/tu_acolyte.txt
+++ b/npc/quests/first_class/tu_acolyte.txt
@@ -1778,7 +1778,7 @@ prt_monk,223,123,3 script Eavesdrop#tu HIDDEN_NPC,{
}
}
-sec_in02,17,156,3 script 1st Job Quest Reset 726,{
+sec_in02,17,156,3 script 1st Job Quest Reset 4_F_JOB_BLACKSMITH,{
callfunc "F_GM_NPC";
mes "[1st Job Quest]";
mes "Which would you like to reset?";
diff --git a/npc/quests/quests_ein.txt b/npc/quests/quests_ein.txt
index 243c47fc7..51d7e5869 100644
--- a/npc/quests/quests_ein.txt
+++ b/npc/quests/quests_ein.txt
@@ -4073,7 +4073,7 @@ ein_in01,67,242,3 script Zelmeto 4_M_REPAIR,{
}
}
-ein_in01,49,232,3 script 2nd Control Panel#ins 111,{
+ein_in01,49,232,3 script 2nd Control Panel#ins HIDDEN_NPC,{
if ((EinFactory == 1) || (EinFactory == 2)) {
changequest 8017,8018;
set EinFactory,2;
@@ -4088,7 +4088,7 @@ ein_in01,49,232,3 script 2nd Control Panel#ins 111,{
end;
}
-ein_in01,108,217,3 script 3rd Pressure Governor#1 111,{
+ein_in01,108,217,3 script 3rd Pressure Governor#1 HIDDEN_NPC,{
if ((EinFactory == 3) || (EinFactory == 4)) {
changequest 8019,8020;
set EinFactory,4;
diff --git a/npc/quests/quests_juperos.txt b/npc/quests/quests_juperos.txt
index b46c8a82c..3c51ead24 100644
--- a/npc/quests/quests_juperos.txt
+++ b/npc/quests/quests_juperos.txt
@@ -4904,7 +4904,7 @@ OnTimer26000:
donpcevent "GuardEnd#ufe::OnDisable";
}
-jupe_ele,41,33,0 script 4F Enter#ufe 45,4,4,{
+jupe_ele,41,33,0 script 4F Enter#ufe WARPNPC,4,4,{
OnInit:
disablenpc "4F Enter#ufe";
end;
diff --git a/npc/quests/quests_moscovia.txt b/npc/quests/quests_moscovia.txt
index 6f00c6e7c..d868926b6 100644
--- a/npc/quests/quests_moscovia.txt
+++ b/npc/quests/quests_moscovia.txt
@@ -9298,7 +9298,7 @@ moc_pryd04,126,120,0 script Soldier#rus26 4_M_RUSMAN1,{
//----------------------------------------------------------------------------
// Marozka's Dungeon (Golden Thread)
//----------------------------------------------------------------------------
-mosk_dun01,45,250,3 script 1#rus27 45,3,3,{
+mosk_dun01,45,250,3 script 1#rus27 WARPNPC,3,3,{
end;
OnTouch:
warp "mosk_que",49,22;
diff --git a/npc/quests/thana_quest.txt b/npc/quests/thana_quest.txt
index bb70a4166..8aebaae31 100644
--- a/npc/quests/thana_quest.txt
+++ b/npc/quests/thana_quest.txt
@@ -868,7 +868,7 @@ L_Request:
return;
}
-tha_t02,227,163,0 script 3rdf_warp#tt 45,1,1,{
+tha_t02,227,163,0 script 3rdf_warp#tt WARPNPC,1,1,{
end;
OnInit:
disablenpc "3rdf_warp#tt";
@@ -2310,4 +2310,4 @@ OnTouch:
}
mes "A mysterious power is blocking my path.";
close;
-} \ No newline at end of file
+}
diff --git a/npc/re/merchants/refine.txt b/npc/re/merchants/refine.txt
index fa1853520..fa5bab042 100644
--- a/npc/re/merchants/refine.txt
+++ b/npc/re/merchants/refine.txt
@@ -102,10 +102,10 @@ function script refinenew {
set .@material,6224; //Bradium
set .@price,100000;
switch(getequipweaponlv(.@part)) {
- case 1: set .@safe,17; break;
- case 2: set .@safe,16; break;
- case 3: set .@safe,15; break;
- case 4: set .@safe,14; break;
+ case 1: set .@safe,10; break;
+ case 2: set .@safe,10; break;
+ case 3: set .@safe,10; break;
+ case 4: set .@safe,10; break;
}
mes "["+ getarg(0) +"]";
mes "Hmm a weapon, is that ok?";
@@ -115,7 +115,7 @@ function script refinenew {
set .@type$,"armor";
set .@material,6223; //Carnium
set .@price,100000;
- set .@safe,14;
+ set .@safe,10;
mes "["+ getarg(0) +"]";
mes "Hmm an armor, is that ok?";
mes "If you want to refine this armor,";
@@ -187,7 +187,7 @@ function script refinenew {
if (rand(100) < 80) {
mes "["+ getarg(0) +"]";
mes "Clang! Clang! Clang! Clang!";
- downrefitem .@part;
+ downrefitem .@part, 3; // Failed refine attempts decrease the item's refine level by 3
next;
emotion (!rand(5))?e_cash:e_omg;
mes "["+ getarg(0) +"]";
@@ -296,7 +296,7 @@ function script refinenew {
if (rand(100) < 80) {
mes "["+ getarg(0) +"]";
mes "Clang! Clang! Clang! Clang!";
- downrefitem .@part;
+ downrefitem .@part, 3; // Failed refine attempts decrease the item's refine level by 3
next;
emotion (!rand(5))?e_cash:e_omg;
mes "["+ getarg(0) +"]";
diff --git a/npc/re/quests/eden/86-90.txt b/npc/re/quests/eden/86-90.txt
index 60bbac0e2..1fced3a16 100644
--- a/npc/re/quests/eden/86-90.txt
+++ b/npc/re/quests/eden/86-90.txt
@@ -13,7 +13,7 @@
//= 1.3 Updated to match the official script. [Euphy]
//============================================================
-moc_para01,48,175,3 script 4_M_04-90 Mission Board 857,{
+moc_para01,48,175,3 script 4_M_04-90 Mission Board 4_BOARD3,{
if (countitem(6219) < 1) {
mes "Wait a minute!";
mes "-You need to have an-";
diff --git a/npc/re/quests/eden/91-99.txt b/npc/re/quests/eden/91-99.txt
index 0c3c6b12f..62a6512f6 100644
--- a/npc/re/quests/eden/91-99.txt
+++ b/npc/re/quests/eden/91-99.txt
@@ -13,7 +13,7 @@
//= 1.3 Updated to match the official script. [Euphy]
//============================================================
-moc_para01,48,177,3 script 4_F_02-99 Mission Board 857,{
+moc_para01,48,177,3 script 4_F_02-99 Mission Board 4_BOARD3,{
if (countitem(6219) < 1) {
mes "Wait a minute!";
mes "-You need to have an-";
diff --git a/npc/re/quests/quests_dicastes.txt b/npc/re/quests/quests_dicastes.txt
index 020aff699..9375cf27b 100644
--- a/npc/re/quests/quests_dicastes.txt
+++ b/npc/re/quests/quests_dicastes.txt
@@ -436,7 +436,7 @@ dic_in01,254,119,0 script Item Storage#01 CLEAR_NPC,{
end;
}
-sec_in02,10,42,1 script 13.3 Related Reset 449,{
+sec_in02,10,42,1 script 13.3 Related Reset 4_MAN_BENKUNI,{
callfunc "F_GM_NPC";
mes "[Reset]";
mes "Resets all quest windows including daily and map quests for 13.3.";
diff --git a/npc/re/quests/quests_malangdo.txt b/npc/re/quests/quests_malangdo.txt
index ea03d66bb..62b356c23 100644
--- a/npc/re/quests/quests_malangdo.txt
+++ b/npc/re/quests/quests_malangdo.txt
@@ -2468,7 +2468,7 @@ OnTouch:
close;
}
-malangdo,246,184,0 script 1st Rate Point 111,{
+malangdo,246,184,0 script 1st Rate Point HIDDEN_NPC,{
if (checkweight(1201,1) == 0) {
mes " - Notice !! -";
mes " - Since you have too many items - ";
diff --git a/script-checker b/script-checker
new file mode 100755
index 000000000..521cf9025
--- /dev/null
+++ b/script-checker
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+# Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+# See the LICENSE file
+# Base Author: Haru @ http://hercules.ws
+
+ORIG_CWD="$(pwd)"
+BASEDIR="$(dirname "$0")"
+EXECUTABLE="./map-server"
+
+cd "${BASEDIR}"
+if [ -z "$1" ]; then
+ echo "No file specified."
+ echo "Usage: $0 <path to the script>"
+ echo " (you may use a relative or absolute path)"
+ exit -1
+elif [[ "$1" =~ ^\/ ]]; then
+ FILE="$1"
+else
+ FILE="${ORIG_CWD}/$1"
+fi
+if [ ! -x "$EXECUTABLE" ]; then
+ exit -1
+fi
+"$EXECUTABLE" --script-check "${FILE}" 2>&1
diff --git a/script-checker.bat b/script-checker.bat
new file mode 100644
index 000000000..e05eda64e
--- /dev/null
+++ b/script-checker.bat
@@ -0,0 +1,29 @@
+@ECHO OFF
+
+REM Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+REM See the LICENSE file
+REM Base Author: Mumbles @ http://hercules.ws
+
+COLOR 0F
+
+ECHO.
+ECHO Hercules Development Team presents
+ECHO _ _ _
+ECHO ^| ^| ^| ^| ^| ^|
+ECHO ^| ^|_^| ^| ___ _ __ ___ _ _^| ^| ___ ___
+ECHO ^| _ ^|/ _ \ '__/ __^| ^| ^| ^| ^|/ _ \/ __^|
+ECHO ^| ^| ^| ^| __/ ^| ^| (__^| ^|_^| ^| ^| __/\__ \
+ECHO \_^| ^|_/\___^|_^| \___^|\__,_^|_^|\___^|^|___/
+ECHO.
+ECHO Script Syntax Checker
+ECHO http://hercules.ws/board/
+ECHO.
+ECHO Drag and drop or input manually
+ECHO.
+ECHO.
+
+:LOOP
+ SET /P SCRIPT="Enter path/to/your/script.txt: " %=%
+ map-server.exe --script-check %SCRIPT%
+ ECHO.
+GOTO LOOP
diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h
index 1e4fc04c7..d2a0a5dd9 100644
--- a/src/common/cbasetypes.h
+++ b/src/common/cbasetypes.h
@@ -37,7 +37,7 @@
#define CYGWIN
#endif
-// __APPLE__ is the only predefined macro on MacOS X
+// __APPLE__ is the only predefined macro on MacOS
#if defined(__APPLE__)
#define __DARWIN__
#endif
@@ -92,9 +92,9 @@
// (-20 >= USHRT_MAX) returns true
#if defined(__FreeBSD__) && defined(__x86_64)
#undef UCHAR_MAX
-#define UCHAR_MAX (unsigned char)0xff
+#define UCHAR_MAX ((unsigned char)0xff)
#undef USHRT_MAX
-#define USHRT_MAX (unsigned short)0xffff
+#define USHRT_MAX ((unsigned short)0xffff)
#endif
// ILP64 isn't supported, so always 32 bits?
@@ -180,7 +180,7 @@ typedef unsigned long int ppuint32;
#if defined(WIN32) && !defined(MINGW) // does not have a signed size_t
//////////////////////////////
-#if defined(_WIN64) // naive 64bit windows platform
+#if defined(_WIN64) // native 64bit windows platform
typedef __int64 ssize_t;
#else
typedef int ssize_t;
@@ -341,8 +341,8 @@ typedef char bool;
#if defined(WIN32)
#define PATHSEP '\\'
#define PATHSEP_STR "\\"
-#elif defined(__APPLE__)
-// FIXME Mac OS X is unix based, is this still correct?
+#elif defined(__APPLE__) && !defined(__MACH__)
+// __MACH__ indicates OS X ( http://sourceforge.net/p/predef/wiki/OperatingSystems/ )
#define PATHSEP ':'
#define PATHSEP_STR ":"
#else
diff --git a/src/common/core.c b/src/common/core.c
index 6a73d2d39..f57cc4c79 100644
--- a/src/common/core.c
+++ b/src/common/core.c
@@ -302,10 +302,20 @@ int main (int argc, char **argv) {
arg_v = argv;
}
core_defaults();
+
+ {
+ int i;
+ for(i = 0; i < argc; i++) {
+ if( strcmp(argv[i], "--script-check") == 0 ) {
+ msg_silent = 0x7; // silence information and status messages
+ }
+ }
+ }
iMalloc->init();// needed for Show* in display_title() [FlavioJS]
-
- console->display_title();
+
+ if (!(msg_silent&0x1))
+ console->display_title();
#ifdef MINICORE // minimalist Core
usercheck();
diff --git a/src/common/mapindex.c b/src/common/mapindex.c
index 83de21b2b..a95e143c3 100644
--- a/src/common/mapindex.c
+++ b/src/common/mapindex.c
@@ -21,7 +21,12 @@ int max_index = 0;
char mapindex_cfgfile[80] = "db/map_index.txt";
-#define mapindex_exists(id) (indexes[id].name[0] != '\0')
+#define mapindex_exists_sub(id) (indexes[id].name[0] != '\0')
+
+bool mapindex_exists(int id) {
+ return mapindex_exists_sub(id);
+}
+
/// Retrieves the map name from 'string' (removing .gat extension if present).
/// Result gets placed either into 'buf' or in a static local buffer.
const char* mapindex_getmapname(const char* string, char* output) {
@@ -102,7 +107,7 @@ int mapindex_addmap(int index, const char* name) {
return 0;
}
- if (mapindex_exists(index)) {
+ if (mapindex_exists_sub(index)) {
ShowWarning("(mapindex_add) Overriding index %d: map \"%s\" -> \"%s\"\n", index, indexes[index].name, map_name);
strdb_remove(mapindex_db, indexes[index].name);
}
@@ -129,18 +134,18 @@ unsigned short mapindex_name2id(const char* name) {
}
const char* mapindex_id2name_sub(unsigned short id,const char *file, int line, const char *func) {
- if (id > MAX_MAPINDEX || !mapindex_exists(id)) {
+ if (id > MAX_MAPINDEX || !mapindex_exists_sub(id)) {
ShowDebug("mapindex_id2name: Requested name for non-existant map index [%d] in cache. %s:%s:%d\n", id,file,func,line);
return indexes[0].name; // dummy empty string so that the callee doesn't crash
}
return indexes[id].name;
}
-void mapindex_init(void) {
+int mapindex_init(void) {
FILE *fp;
char line[1024];
int last_index = -1;
- int index;
+ int index, total = 0;
char map_name[12];
if( ( fp = fopen(mapindex_cfgfile,"r") ) == NULL ){
@@ -158,6 +163,7 @@ void mapindex_init(void) {
index = last_index+1;
case 2: //Map with ID given
mapindex_addmap(index,map_name);
+ total++;
break;
default:
continue;
@@ -169,6 +175,7 @@ void mapindex_init(void) {
if( !strdb_iget(mapindex_db, MAP_DEFAULT) ) {
ShowError("mapindex_init: MAP_DEFAULT '%s' not found in cache! update mapindex.h MAP_DEFAULT var!!!\n",MAP_DEFAULT);
}
+ return total;
}
int mapindex_removemap(int index){
diff --git a/src/common/mapindex.h b/src/common/mapindex.h
index 43953a8e0..646f73f18 100644
--- a/src/common/mapindex.h
+++ b/src/common/mapindex.h
@@ -56,12 +56,13 @@ extern char mapindex_cfgfile[80];
#define MAP_MALAYA "malaya"
#define MAP_ECLAGE "eclage"
+bool mapindex_exists(int id);
const char* mapindex_getmapname(const char* string, char* output);
const char* mapindex_getmapname_ext(const char* string, char* output);
unsigned short mapindex_name2id(const char*);
#define mapindex_id2name(n) mapindex_id2name_sub(n,__FILE__, __LINE__, __func__)
const char* mapindex_id2name_sub(unsigned short,const char *file, int line, const char *func);
-void mapindex_init(void);
+int mapindex_init(void);
void mapindex_final(void);
int mapindex_addmap(int index, const char* name);
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 603ec7573..b1a1caf24 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -48,18 +48,18 @@
// 20120307 - 2012-03-07aRagexeRE+ - 0x970
#ifndef PACKETVER
- #define PACKETVER 20120418
-#endif
+#define PACKETVER 20120418
+#endif // PACKETVER
+#ifndef DISABLE_PACKETVER_RE
// Comment the following line if your client is NOT ragexeRE (required because of conflicting packets in ragexe vs ragexeRE).
#define PACKETVER_RE
+#endif // DISABLE_PACKETVER_RE
// Client support for experimental RagexeRE UI present in 2012-04-10 and 2012-04-18
-#ifdef PACKETVER_RE
-#if (PACKETVER == 20120410) || (PACKETVER == 20120418)
- #define PARTY_RECRUIT
-#endif
-#endif
+#if defined(PACKETVER_RE) && ( PACKETVER == 20120410 || PACKETVER == 20120418 )
+#define PARTY_RECRUIT
+#endif // PACKETVER_RE && (PACKETVER == 20120410 || PACKETVER == 10120418)
// Comment the following line to disable sc_data saving. [Skotlex]
#define ENABLE_SC_SAVING
@@ -107,7 +107,7 @@
//Should hold the max of GLOBAL/ACCOUNT/ACCOUNT2 (needed for some arrays that hold all three)
#define MAX_REG_NUM 256
#define DEFAULT_WALK_SPEED 150
-#define MIN_WALK_SPEED 0
+#define MIN_WALK_SPEED 20 /* below 20 clips animation */
#define MAX_WALK_SPEED 1000
#define MAX_STORAGE 600
#define MAX_GUILD_STORAGE 600
diff --git a/src/map/HPMmap.c b/src/map/HPMmap.c
index ca4a7a2e8..8a69cba97 100644
--- a/src/map/HPMmap.c
+++ b/src/map/HPMmap.c
@@ -142,10 +142,7 @@ void HPM_map_atcommands(void) {
unsigned int i;
for(i = 0; i < atcommand_list_items; i++) {
- if( !atcommand->add(atcommand_list[i].name,atcommand_list[i].func) ) {
- ShowDebug("HPM_map_atcommands: duplicate command '%s', skipping...\n", atcommand_list[i].name);
- continue;
- }
+ atcommand->add(atcommand_list[i].name,atcommand_list[i].func,true);
}
}
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 146159c63..20fcdd79c 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -574,7 +574,7 @@ ACMD(who) {
case 2: {
StrBuf->Printf(&buf, msg_txt(343), pl_sd->status.name); // "Name: %s "
if (pc_get_group_id(pl_sd) > 0) // Player title, if exists
- StrBuf->Printf(&buf, msg_txt(344), pc_group_get_name(pl_sd->group)); // "(%s) "
+ StrBuf->Printf(&buf, msg_txt(344), pcg->get_name(pl_sd->group)); // "(%s) "
StrBuf->Printf(&buf, msg_txt(347), pl_sd->status.base_level, pl_sd->status.job_level,
pc->job_name(pl_sd->status.class_)); // "| Lv:%d/%d | Job: %s"
break;
@@ -584,7 +584,7 @@ ACMD(who) {
StrBuf->Printf(&buf, msg_txt(912), pl_sd->status.char_id, pl_sd->status.account_id); // "(CID:%d/AID:%d) "
StrBuf->Printf(&buf, msg_txt(343), pl_sd->status.name); // "Name: %s "
if (pc_get_group_id(pl_sd) > 0) // Player title, if exists
- StrBuf->Printf(&buf, msg_txt(344), pc_group_get_name(pl_sd->group)); // "(%s) "
+ StrBuf->Printf(&buf, msg_txt(344), pcg->get_name(pl_sd->group)); // "(%s) "
StrBuf->Printf(&buf, msg_txt(348), mapindex_id2name(pl_sd->mapindex), pl_sd->bl.x, pl_sd->bl.y); // "| Location: %s %d %d"
break;
}
@@ -594,7 +594,7 @@ ACMD(who) {
StrBuf->Printf(&buf, msg_txt(343), pl_sd->status.name); // "Name: %s "
if (pc_get_group_id(pl_sd) > 0) // Player title, if exists
- StrBuf->Printf(&buf, msg_txt(344), pc_group_get_name(pl_sd->group)); // "(%s) "
+ StrBuf->Printf(&buf, msg_txt(344), pcg->get_name(pl_sd->group)); // "(%s) "
if (p != NULL)
StrBuf->Printf(&buf, msg_txt(345), p->party.name); // " | Party: '%s'"
if (g != NULL)
@@ -766,15 +766,21 @@ ACMD(speed)
return false;
}
- if (speed < 0) {
+ sd->state.permanent_speed = 0;
+
+ if (speed < 0)
sd->base_status.speed = DEFAULT_WALK_SPEED;
- sd->state.permanent_speed = 0; // Remove lock when set back to default speed.
- } else {
+ else
sd->base_status.speed = cap_value(speed, MIN_WALK_SPEED, MAX_WALK_SPEED);
- sd->state.permanent_speed = 1; // Set lock when set to non-default speed.
- }
+
status_calc_bl(&sd->bl, SCB_SPEED);
- clif->message(fd, msg_txt(8)); // Speed changed.
+
+ if( sd->base_status.speed != DEFAULT_WALK_SPEED ) {
+ sd->state.permanent_speed = 1; // Set lock when set to non-default speed.
+ clif->message(fd, msg_txt(8)); // Speed changed.
+ } else
+ clif->message(fd, msg_txt(172)); //Speed returned to normal.
+
return true;
}
@@ -1252,6 +1258,7 @@ ACMD(baselevelup)
sd->status.status_point += status_point;
sd->status.base_level += (unsigned int)level;
+ status_calc_pc(sd, SCO_FORCE);
status_percent_heal(&sd->bl, 100, 100);
clif->misceffect(&sd->bl, 0);
clif->message(fd, msg_txt(21)); // Base level raised.
@@ -1273,13 +1280,13 @@ ACMD(baselevelup)
sd->status.status_point -= status_point;
sd->status.base_level -= (unsigned int)level;
clif->message(fd, msg_txt(22)); // Base level lowered.
+ status_calc_pc(sd, SCO_FORCE);
}
sd->status.base_exp = 0;
clif->updatestatus(sd, SP_STATUSPOINT);
clif->updatestatus(sd, SP_BASELEVEL);
clif->updatestatus(sd, SP_BASEEXP);
clif->updatestatus(sd, SP_NEXTBASEEXP);
- status_calc_pc(sd, 0);
pc->baselevelchanged(sd);
if(sd->status.party_id)
party->send_levelup(sd);
@@ -1332,7 +1339,7 @@ ACMD(joblevelup)
clif->updatestatus(sd, SP_JOBEXP);
clif->updatestatus(sd, SP_NEXTJOBEXP);
clif->updatestatus(sd, SP_SKILLPOINT);
- status_calc_pc(sd, 0);
+ status_calc_pc(sd, SCO_FORCE);
return true;
}
@@ -2346,7 +2353,7 @@ ACMD(param) {
*stats[i] = new_value;
clif->updatestatus(sd, SP_STR + i);
clif->updatestatus(sd, SP_USTR + i);
- status_calc_pc(sd, 0);
+ status_calc_pc(sd, SCO_FORCE);
clif->message(fd, msg_txt(42)); // Stat changed.
} else {
if (value < 0)
@@ -2403,7 +2410,7 @@ ACMD(stat_all) {
}
if (count > 0) { // if at least 1 stat modified
- status_calc_pc(sd, 0);
+ status_calc_pc(sd, SCO_FORCE);
clif->message(fd, msg_txt(84)); // All stats changed!
} else {
if (value < 0)
@@ -3506,7 +3513,7 @@ ACMD(reloadatcommand) {
config_destroy(&run_test);
atcommand->doload();
- pc_groups_reload();
+ pcg->reload();
clif->message(fd, msg_txt(254));
return true;
}
@@ -5597,16 +5604,16 @@ ACMD(autolootitem)
}
else if (!strcmp(message,"reset"))
action = 4;
- }
-
- if (action < 3) // add or remove
- {
- if ((item_data = itemdb->exists(atoi(message))) == NULL)
- item_data = itemdb->search_name(message);
- if (!item_data) {
- // No items founds in the DB with Id or Name
- clif->message(fd, msg_txt(1189)); // Item not found.
- return false;
+
+ if (action < 3) // add or remove
+ {
+ if ((item_data = itemdb->exists(atoi(message))) == NULL)
+ item_data = itemdb->search_name(message);
+ if (!item_data) {
+ // No items founds in the DB with Id or Name
+ clif->message(fd, msg_txt(1189)); // Item not found.
+ return false;
+ }
}
}
@@ -5674,6 +5681,103 @@ ACMD(autolootitem)
}
/*==========================================
+ * @autoloottype
+ * Credits:
+ * chriser,Aleos
+ *------------------------------------------*/
+ACMD(autoloottype) {
+ int i;
+ uint8 action = 3; // 1=add, 2=remove, 3=help+list (default), 4=reset
+ enum item_types type = -1;
+ int ITEM_NONE = 0;
+
+ if (message && *message) {
+ if (message[0] == '+') {
+ message++;
+ action = 1;
+ } else if (message[0] == '-') {
+ message++;
+ action = 2;
+ } else if (strcmp(message,"reset") == 0) {
+ action = 4;
+ }
+
+ if (action < 3) {
+ // add or remove
+ if (strncmp(message, "healing", 3) == 0)
+ type = IT_HEALING;
+ else if (strncmp(message, "usable", 3) == 0)
+ type = IT_USABLE;
+ else if (strncmp(message, "etc", 3) == 0)
+ type = IT_ETC;
+ else if (strncmp(message, "weapon", 3) == 0)
+ type = IT_WEAPON;
+ else if (strncmp(message, "armor", 3) == 0)
+ type = IT_ARMOR;
+ else if (strncmp(message, "card", 3) == 0)
+ type = IT_CARD;
+ else if (strncmp(message, "petegg", 4) == 0)
+ type = IT_PETEGG;
+ else if (strncmp(message, "petarmor", 4) == 0)
+ type = IT_PETARMOR;
+ else if (strncmp(message, "ammo", 3) == 0)
+ type = IT_AMMO;
+ else {
+ clif->message(fd, msg_txt(1491)); // Item type not found.
+ return false;
+ }
+ }
+ }
+
+ switch (action) {
+ case 1:
+ if (sd->state.autoloottype&(1<<type)) {
+ clif->message(fd, msg_txt(1490)); // You're already autolooting this item type.
+ return false;
+ }
+ sd->state.autoloottype |= (1<<type); // Stores the type
+ sprintf(atcmd_output, msg_txt(1492), itemdb->typename(type)); // Autolooting item type: '%s'
+ clif->message(fd, atcmd_output);
+ break;
+ case 2:
+ if (!(sd->state.autoloottype&(1<<type))) {
+ clif->message(fd, msg_txt(1493)); // You're currently not autolooting this item type.
+ return false;
+ }
+ sd->state.autoloottype &= ~(1<<type);
+ sprintf(atcmd_output, msg_txt(1494), itemdb->typename(type)); // Removed item type: '%s' from your autoloottype list.
+ clif->message(fd, atcmd_output);
+ break;
+ case 3:
+ clif->message(fd, msg_txt(38)); // Invalid location number, or name.
+
+ {
+ // attempt to find the text help string
+ const char *text = atcommand_help_string(info);
+ if (text) clif->messageln(fd, text); // send the text to the client
+ }
+
+ if (sd->state.autoloottype == ITEM_NONE) {
+ clif->message(fd, msg_txt(1495)); // Your autoloottype list is empty.
+ } else {
+ clif->message(fd, msg_txt(1496)); // Item types on your autoloottype list:
+ for(i=0; i < IT_MAX; i++) {
+ if (sd->state.autoloottype&(1<<i)) {
+ sprintf(atcmd_output, " '%s'", itemdb->typename(i));
+ clif->message(fd, atcmd_output);
+ }
+ }
+ }
+ break;
+ case 4:
+ sd->state.autoloottype = ITEM_NONE;
+ clif->message(fd, msg_txt(1497)); // Your autoloottype list has been reset.
+ break;
+ }
+ return true;
+}
+
+/*==========================================
* It is made to snow.
*------------------------------------------*/
ACMD(snow) {
@@ -6622,7 +6726,7 @@ ACMD(homlevel) {
hd->homunculus.exp += hd->exp_next;
} while( hd->homunculus.level < level && homun->levelup(hd) );
- status_calc_homunculus(hd,0);
+ status_calc_homunculus(hd,SCO_NONE);
status_percent_heal(&hd->bl, 100, 100);
clif->specialeffect(&hd->bl,568,AREA);
return true;
@@ -8158,11 +8262,11 @@ void atcommand_commands_sub(struct map_session_data* sd, const int fd, AtCommand
switch( type ) {
case COMMAND_CHARCOMMAND:
- if( cmd->char_groups[pc_group_get_idx(sd->group)] == 0 )
+ if( cmd->char_groups[pcg->get_idx(sd->group)] == 0 )
continue;
break;
case COMMAND_ATCOMMAND:
- if( cmd->at_groups[pc_group_get_idx(sd->group)] == 0 )
+ if( cmd->at_groups[pcg->get_idx(sd->group)] == 0 )
continue;
break;
default:
@@ -8371,7 +8475,7 @@ ACMD(reloadquestdb) {
return true;
}
ACMD(addperm) {
- int perm_size = ARRAYLENGTH(pc_g_permission_name);
+ int perm_size = pcg->permission_count;
bool add = (strcmpi(command+1, "addperm") == 0) ? true : false;
int i;
@@ -8380,37 +8484,37 @@ ACMD(addperm) {
clif->message(fd, atcmd_output);
clif->message(fd, msg_txt(1379)); // -- Permission List
for( i = 0; i < perm_size; i++ ) {
- sprintf(atcmd_output,"- %s",pc_g_permission_name[i].name);
+ sprintf(atcmd_output,"- %s",pcg->permissions[i].name);
clif->message(fd, atcmd_output);
}
return false;
}
- ARR_FIND(0, perm_size, i, strcmpi(pc_g_permission_name[i].name, message) == 0);
+ ARR_FIND(0, perm_size, i, strcmpi(pcg->permissions[i].name, message) == 0);
if( i == perm_size ) {
sprintf(atcmd_output,msg_txt(1380),message); // '%s' is not a known permission.
clif->message(fd, atcmd_output);
clif->message(fd, msg_txt(1379)); // -- Permission List
for( i = 0; i < perm_size; i++ ) {
- sprintf(atcmd_output,"- %s",pc_g_permission_name[i].name);
+ sprintf(atcmd_output,"- %s",pcg->permissions[i].name);
clif->message(fd, atcmd_output);
}
return false;
}
- if( add && (sd->extra_temp_permissions&pc_g_permission_name[i].permission) ) {
- sprintf(atcmd_output, msg_txt(1381),sd->status.name,pc_g_permission_name[i].name); // User '%s' already possesses the '%s' permission.
+ if( add && (sd->extra_temp_permissions&pcg->permissions[i].permission) ) {
+ sprintf(atcmd_output, msg_txt(1381),sd->status.name,pcg->permissions[i].name); // User '%s' already possesses the '%s' permission.
clif->message(fd, atcmd_output);
return false;
- } else if ( !add && !(sd->extra_temp_permissions&pc_g_permission_name[i].permission) ) {
- sprintf(atcmd_output, msg_txt(1382),sd->status.name,pc_g_permission_name[i].name); // User '%s' doesn't possess the '%s' permission.
+ } else if ( !add && !(sd->extra_temp_permissions&pcg->permissions[i].permission) ) {
+ sprintf(atcmd_output, msg_txt(1382),sd->status.name,pcg->permissions[i].name); // User '%s' doesn't possess the '%s' permission.
clif->message(fd, atcmd_output);
sprintf(atcmd_output,msg_txt(1383),sd->status.name); // -- User '%s' Permissions
clif->message(fd, atcmd_output);
for( i = 0; i < perm_size; i++ ) {
- if( sd->extra_temp_permissions&pc_g_permission_name[i].permission ) {
- sprintf(atcmd_output,"- %s",pc_g_permission_name[i].name);
+ if( sd->extra_temp_permissions&pcg->permissions[i].permission ) {
+ sprintf(atcmd_output,"- %s",pcg->permissions[i].name);
clif->message(fd, atcmd_output);
}
}
@@ -8419,9 +8523,9 @@ ACMD(addperm) {
}
if( add )
- sd->extra_temp_permissions |= pc_g_permission_name[i].permission;
+ sd->extra_temp_permissions |= pcg->permissions[i].permission;
else
- sd->extra_temp_permissions &=~ pc_g_permission_name[i].permission;
+ sd->extra_temp_permissions &=~ pcg->permissions[i].permission;
sprintf(atcmd_output, msg_txt(1384),sd->status.name); // User '%s' permissions updated successfully. The changes are temporary.
@@ -9377,6 +9481,7 @@ void atcommand_basecommands(void) {
ACMD_DEF(changelook),
ACMD_DEF(autoloot),
ACMD_DEF2("alootid", autolootitem),
+ ACMD_DEF(autoloottype),
ACMD_DEF(mobinfo),
ACMD_DEF(exp),
ACMD_DEF(version),
@@ -9460,7 +9565,7 @@ void atcommand_basecommands(void) {
int i;
for( i = 0; i < ARRAYLENGTH(atcommand_base); i++ ) {
- if(!atcommand->add(atcommand_base[i].command,atcommand_base[i].func)) { // Should not happen if atcommand_base[] array is OK
+ if(!atcommand->add(atcommand_base[i].command,atcommand_base[i].func,false)) { // Should not happen if atcommand_base[] array is OK
ShowDebug("atcommand_basecommands: duplicate ACMD_DEF for '%s'.\n", atcommand_base[i].command);
continue;
}
@@ -9472,21 +9577,22 @@ void atcommand_basecommands(void) {
return;
}
-bool atcommand_add(char *name,AtCommandFunc func) {
+bool atcommand_add(char *name,AtCommandFunc func, bool replace) {
AtCommandInfo* cmd;
- if(atcommand->exists(name)) //caller will handle/display on false
- return false;
-
- CREATE(cmd, AtCommandInfo, 1);
+ if( (cmd = atcommand->exists(name)) ) { //caller will handle/display on false
+ if( !replace )
+ return false;
+ } else {
+ CREATE(cmd, AtCommandInfo, 1);
+ strdb_put(atcommand->db, name, cmd);
+ }
safestrncpy(cmd->command, name, sizeof(cmd->command));
cmd->func = func;
cmd->help = NULL;
cmd->log = true;
-
- strdb_put(atcommand->db, cmd->command, cmd);
-
+
return true;
}
@@ -9657,7 +9763,7 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message
if( !pc->get_group_level(sd) ) {
if( x >= 1 || y >= 1 ) { /* we have command */
info = atcommand->get_info_byname(atcommand->check_alias(command + 1));
- if( !info || info->char_groups[pc_group_get_idx(sd->group)] == 0 ) /* if we can't use or doesn't exist: don't even display the command failed message */
+ if( !info || info->char_groups[pcg->get_idx(sd->group)] == 0 ) /* if we can't use or doesn't exist: don't even display the command failed message */
return false;
} else
return false;/* display as normal message */
@@ -9737,8 +9843,8 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message
// type == 1 : player invoked
if (type == 1) {
int i;
- if ((*command == atcommand->at_symbol && info->at_groups[pc_group_get_idx(sd->group)] == 0) ||
- (*command == atcommand->char_symbol && info->char_groups[pc_group_get_idx(sd->group)] == 0) ) {
+ if ((*command == atcommand->at_symbol && info->at_groups[pcg->get_idx(sd->group)] == 0) ||
+ (*command == atcommand->char_symbol && info->char_groups[pcg->get_idx(sd->group)] == 0) ) {
return false;
}
if( pc_isdead(sd) && pc->has_permission(sd,PC_PERM_DISABLE_CMD_DEAD) ) {
@@ -9936,13 +10042,13 @@ void atcommand_db_load_groups(GroupSettings **groups, config_setting_t **command
continue;
}
- idx = pc_group_get_idx(group);
+ idx = pcg->get_idx(group);
if (idx < 0 || idx >= sz) {
ShowError("atcommand_db_load_groups: index (%d) out of bounds [0,%d]\n", idx, sz - 1);
continue;
}
- if (pc_group_has_permission(group, PC_PERM_USE_ALL_COMMANDS)) {
+ if (pcg->has_permission(group, PC_PERM_USE_ALL_COMMANDS)) {
atcmd->at_groups[idx] = atcmd->char_groups[idx] = 1;
continue;
}
@@ -9980,8 +10086,8 @@ bool atcommand_can_use(struct map_session_data *sd, const char *command) {
if (info == NULL)
return false;
- if ((*command == atcommand->at_symbol && info->at_groups[pc_group_get_idx(sd->group)] != 0) ||
- (*command == atcommand->char_symbol && info->char_groups[pc_group_get_idx(sd->group)] != 0) ) {
+ if ((*command == atcommand->at_symbol && info->at_groups[pcg->get_idx(sd->group)] != 0) ||
+ (*command == atcommand->char_symbol && info->char_groups[pcg->get_idx(sd->group)] != 0) ) {
return true;
}
@@ -9993,8 +10099,8 @@ bool atcommand_can_use2(struct map_session_data *sd, const char *command, AtComm
if (info == NULL)
return false;
- if ((type == COMMAND_ATCOMMAND && info->at_groups[pc_group_get_idx(sd->group)] != 0) ||
- (type == COMMAND_CHARCOMMAND && info->char_groups[pc_group_get_idx(sd->group)] != 0) ) {
+ if ((type == COMMAND_ATCOMMAND && info->at_groups[pcg->get_idx(sd->group)] != 0) ||
+ (type == COMMAND_CHARCOMMAND && info->char_groups[pcg->get_idx(sd->group)] != 0) ) {
return true;
}
@@ -10045,7 +10151,10 @@ void atcommand_doload(void) {
atcommand->config_read(map->ATCOMMAND_CONF_FILENAME);
}
-void do_init_atcommand(void) {
+void do_init_atcommand(bool minimal) {
+ if (minimal)
+ return;
+
atcommand->at_symbol = '@';
atcommand->char_symbol = '#';
atcommand->binding_count = 0;
diff --git a/src/map/atcommand.h b/src/map/atcommand.h
index 63c38e4d1..6b5a52fcb 100644
--- a/src/map/atcommand.h
+++ b/src/map/atcommand.h
@@ -77,7 +77,7 @@ struct atcommand_interface {
/* */
char* msg_table[MAX_MSG]; // Server messages (0-499 reserved for GM commands, 500-999 reserved for others)
/* */
- void (*init) (void);
+ void (*init) (bool minimal);
void (*final) (void);
/* */
bool (*parse) (const int fd, struct map_session_data* sd, const char* message, int type);
@@ -110,7 +110,7 @@ struct atcommand_interface {
int (*cmd_db_clear_sub) (DBKey key, DBData *data, va_list args);
void (*doload) (void);
void (*base_commands) (void);
- bool (*add) (char *name, AtCommandFunc func);
+ bool (*add) (char *name, AtCommandFunc func, bool replace);
};
struct atcommand_interface *atcommand;
diff --git a/src/map/battle.c b/src/map/battle.c
index 94222f663..9a70acaca 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -206,7 +206,7 @@ int battle_delay_damage_sub(int tid, int64 tick, int id, intptr_t data) {
if( !target || status->isdead(target) ) {/* nothing we can do */
if( dat->src_type == BL_PC && ( src = map->id2bl(dat->src_id) ) && --((TBL_PC*)src)->delayed_damage == 0 && ((TBL_PC*)src)->state.hold_recalc ) {
((TBL_PC*)src)->state.hold_recalc = 0;
- status_calc_pc(((TBL_PC*)src),0);
+ status_calc_pc(((TBL_PC*)src),SCO_FORCE);
}
ers_free(battle->delay_damage_ers, dat);
return 0;
@@ -237,7 +237,7 @@ int battle_delay_damage_sub(int tid, int64 tick, int id, intptr_t data) {
if( src && src->type == BL_PC && --((TBL_PC*)src)->delayed_damage == 0 && ((TBL_PC*)src)->state.hold_recalc ) {
((TBL_PC*)src)->state.hold_recalc = 0;
- status_calc_pc(((TBL_PC*)src),0);
+ status_calc_pc(((TBL_PC*)src),SCO_FORCE);
}
}
ers_free(battle->delay_damage_ers, dat);
@@ -6759,7 +6759,10 @@ int battle_config_read(const char* cfgName)
return 0;
}
-void do_init_battle(void) {
+void do_init_battle(bool minimal) {
+ if (minimal)
+ return;
+
battle->delay_damage_ers = ers_new(sizeof(struct delay_damage),"battle.c::delay_damage_ers",ERS_OPT_CLEAR);
timer->add_func_list(battle->delay_damage_sub, "battle_delay_damage_sub");
diff --git a/src/map/battle.h b/src/map/battle.h
index bf08ab8d6..0f3a22c4b 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -506,7 +506,7 @@ struct battle_interface {
int attr_fix_table[4][ELE_MAX][ELE_MAX];
struct eri *delay_damage_ers; //For battle delay damage structures.
/* init */
- void (*init) (void);
+ void (*init) (bool minimal);
/* final */
void (*final) (void);
/* damage calculation */
diff --git a/src/map/battleground.c b/src/map/battleground.c
index 62688659e..6b9695849 100644
--- a/src/map/battleground.c
+++ b/src/map/battleground.c
@@ -520,13 +520,43 @@ void bg_begin(struct bg_arena *arena) {
bg->queue_pc_cleanup(sd);
}
}
+ /* TODO/FIXME? I *think* it should check what kind of queue the player used, then check if his party/guild
+ * (his team) still meet the join criteria (sort of what bg->can_queue does)
+ */
if( count < arena->min_players ) {
bg->match_over(arena,true);
} else {
arena->ongoing = true;
- mapreg->setreg(script->add_str("$@bg_queue_id"),arena->queue_id);/* TODO: make this a arena-independant var? or just .@? */
+ /* TODO: make this a arena-independant var? or just .@? */
+ mapreg->setreg(script->add_str("$@bg_queue_id"),arena->queue_id);
mapreg->setregstr(script->add_str("$@bg_delay_var$"),bg->gdelay_var);
+
+ count = 0;
+ for( i = 0; i < queue->size; i++ ) {
+ struct map_session_data * sd = NULL;
+
+ if( queue->item[i] > 0 && ( sd = map->id2sd(queue->item[i]) ) ) {
+ if( sd->bg_queue.ready == 1 ) {
+
+ mapreg->setreg(reference_uid(script->add_str("$@bg_member"), count), sd->status.account_id);
+
+ mapreg->setreg(reference_uid(script->add_str("$@bg_member_group"), count),
+ sd->bg_queue.type == BGQT_GUILD ? sd->status.guild_id :
+ sd->bg_queue.type == BGQT_PARTY ? sd->status.party_id :
+ 0
+ );
+ mapreg->setreg(reference_uid(script->add_str("$@bg_member_type"), count),
+ sd->bg_queue.type == BGQT_GUILD ? 1 :
+ sd->bg_queue.type == BGQT_PARTY ? 2 :
+ 0
+ );
+ count++;
+ }
+ }
+ }
+ mapreg->setreg(script->add_str("$@bg_member_size"),count);
+
npc->event_do(arena->npc_event);
/* we split evenly? */
/* but if a party of say 10 joins, it cant be split evenly unless by luck there are 10 soloers in the queue besides them */
@@ -685,12 +715,7 @@ enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, struct bg_
if( sd->bg_queue.arena != NULL )
return BGQA_DUPLICATE_REQUEST;
-
- if( type != BGQT_INDIVIDUAL ) {/* until we get the damn balancing correct */
- clif->colormes(sd->fd,COLOR_RED,"Queueing is only currently enabled only for Solo Mode");
- return BGQA_FAIL_TEAM_COUNT;
- }
-
+
switch(type) {
case BGQT_GUILD:
if( !sd->guild || !sd->state.gmaster_flag )
@@ -757,7 +782,10 @@ enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, struct bg_
return BGQA_SUCCESS;
}
-void do_init_battleground(void) {
+void do_init_battleground(bool minimal) {
+ if (minimal)
+ return;
+
bg->team_db = idb_alloc(DB_OPT_RELEASE_DATA);
timer->add_func_list(bg->send_xy_timer, "bg_send_xy_timer");
timer->add_interval(timer->gettick() + battle_config.bg_update_interval, bg->send_xy_timer, 0, 0, battle_config.bg_update_interval);
diff --git a/src/map/battleground.h b/src/map/battleground.h
index a5e540924..7f15a4bbc 100644
--- a/src/map/battleground.h
+++ b/src/map/battleground.h
@@ -19,10 +19,11 @@
* Enumerations
**/
enum bg_queue_types {
- BGQT_INVALID,
- BGQT_INDIVIDUAL,
- BGQT_PARTY,
- BGQT_GUILD
+ BGQT_INVALID = 0x0,
+ BGQT_INDIVIDUAL = 0x1,
+ BGQT_PARTY = 0x2,
+ /* yup no 0x3 */
+ BGQT_GUILD = 0x4,
};
struct battleground_member_data {
@@ -75,7 +76,7 @@ struct battleground_interface {
DBMap *team_db; // int bg_id -> struct battleground_data*
unsigned int team_counter; // Next bg_id
/* */
- void (*init) (void);
+ void (*init) (bool minimal);
void (*final) (void);
/* */
struct bg_arena *(*name2arena) (char *name);
diff --git a/src/map/chrif.c b/src/map/chrif.c
index a13217060..87ec71ec5 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -1611,8 +1611,10 @@ int do_final_chrif(void) {
/*==========================================
*
*------------------------------------------*/
-int do_init_chrif(void) {
-
+int do_init_chrif(bool minimal) {
+ if (minimal)
+ return 0;
+
chrif->auth_db = idb_alloc(DB_OPT_BASE);
chrif->auth_db_ers = ers_new(sizeof(struct auth_node),"chrif.c::auth_db_ers",ERS_OPT_NONE);
diff --git a/src/map/chrif.h b/src/map/chrif.h
index 9df4b9931..56aa569a3 100644
--- a/src/map/chrif.h
+++ b/src/map/chrif.h
@@ -63,7 +63,7 @@ struct chrif_interface {
int state;
/* */
int (*final) (void);
- int (*init) (void);
+ int (*init) (bool minimal);
/* funcs */
void (*setuserid) (char* id);
void (*setpasswd) (char* pwd);
diff --git a/src/map/clif.c b/src/map/clif.c
index c752f822d..c099d5a1b 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -9213,7 +9213,9 @@ void clif_hercules_chsys_mjoin(struct map_session_data *sd) {
/// Notification from the client, that it has finished map loading and is about to display player's character (CZ_NOTIFY_ACTORINIT).
/// 007d
void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
+#if PACKETVER >= 20090218
int i;
+#endif
if(sd->bl.prev != NULL)
return;
@@ -9473,7 +9475,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
}
map->iwall_get(sd); // Updates Walls Info on this Map to Client
- status_calc_pc(sd, false);/* some conditions are map-dependent so we must recalculate */
+ status_calc_pc(sd, SCO_NONE);/* some conditions are map-dependent so we must recalculate */
sd->state.changemap = false;
if( hChSys.local && hChSys.local_autojoin && !map->list[sd->bl.m].flag.chsysnolocalaj ) {
@@ -17572,9 +17574,7 @@ void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) {
clif->bgqueue_ack(sd,BGQA_FAIL_BGNAME_INVALID,0);
return;
}
- //debug
- safestrncpy(arena->name, p->bg_name, sizeof(arena->name));
-
+
switch( (enum bg_queue_types)p->type ) {
case BGQT_INDIVIDUAL:
case BGQT_PARTY:
@@ -18059,10 +18059,13 @@ void clif_bc_ready(void) {
/*==========================================
*
*------------------------------------------*/
-int do_init_clif(void) {
+int do_init_clif(bool minimal) {
const char* colors[COLOR_MAX] = { "0xFF0000", "0x00ff00", "0xffffff" };
int i;
+ if (minimal)
+ return 0;
+
/**
* Setup Color Table (saves unnecessary load of strtoul on every call)
**/
diff --git a/src/map/clif.h b/src/map/clif.h
index d2ac9213a..710cb6590 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -526,7 +526,7 @@ struct clif_interface {
/* */
bool ally_only;
/* core */
- int (*init) (void);
+ int (*init) (bool minimal);
void (*final) (void);
int (*setip) (const char* ip);
void (*setbindip) (const char* ip);
diff --git a/src/map/duel.c b/src/map/duel.c
index 4e41865d4..5e305244a 100644
--- a/src/map/duel.c
+++ b/src/map/duel.c
@@ -166,7 +166,10 @@ void duel_reject(const unsigned int did, struct map_session_data* sd) {
void do_final_duel(void) {
}
-void do_init_duel(void) {
+void do_init_duel(bool minimal) {
+ if (minimal)
+ return;
+
memset(&duel->list[0], 0, sizeof(duel->list));
}
diff --git a/src/map/duel.h b/src/map/duel.h
index d1ec58415..d60c9531a 100644
--- a/src/map/duel.h
+++ b/src/map/duel.h
@@ -34,7 +34,7 @@ struct duel_interface {
void (*showinfo) (const unsigned int did, struct map_session_data* sd);
int (*checktime) (struct map_session_data* sd);
- void (*init) (void);
+ void (*init) (bool minimal);
void (*final) (void);
} duel_s;
diff --git a/src/map/elemental.c b/src/map/elemental.c
index f15b735b2..f335600d6 100644
--- a/src/map/elemental.c
+++ b/src/map/elemental.c
@@ -258,7 +258,7 @@ int elemental_data_received(struct s_elemental *ele, bool flag) {
ed->bl.y = ed->ud.to_y;
map->addiddb(&ed->bl);
- status_calc_elemental(ed,1);
+ status_calc_elemental(ed,SCO_FIRST);
ed->last_spdrain_time = ed->last_thinktime = timer->gettick();
ed->summon_timer = INVALID_TIMER;
elemental->summon_init(ed);
@@ -931,7 +931,10 @@ void reload_elemental_skilldb(void) {
elemental->read_skilldb();
}
-int do_init_elemental(void) {
+int do_init_elemental(bool minimal) {
+ if (minimal)
+ return 0;
+
elemental->read_db();
elemental->read_skilldb();
diff --git a/src/map/elemental.h b/src/map/elemental.h
index 3cd819d53..8ffffa5e3 100644
--- a/src/map/elemental.h
+++ b/src/map/elemental.h
@@ -73,7 +73,7 @@ struct elemental_interface {
struct s_elemental_db db[MAX_ELEMENTAL_CLASS]; // Elemental Database
/* */
- int (*init) (void);
+ int (*init) (bool minimal);
void (*final) (void);
/* funcs */
bool (*class) (int class_);
diff --git a/src/map/guild.c b/src/map/guild.c
index 0ae45bede..fcdcddab2 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -1923,7 +1923,7 @@ int guild_castledatasave(int castle_id, int index, int value)
gc->defense = value;
for (i = 0; i < MAX_GUARDIANS; i++)
if (gc->guardian[i].visible && (gd = map->id2md(gc->guardian[i].id)) != NULL)
- status_calc_mob(gd, 0);
+ status_calc_mob(gd, SCO_NONE);
break;
}
case 4:
@@ -2172,12 +2172,15 @@ void guild_flags_clear(void) {
guild->flags_count = 0;
}
-void do_init_guild(void) {
- guild->db = idb_alloc(DB_OPT_RELEASE_DATA);
- guild->castle_db = idb_alloc(DB_OPT_BASE);
- guild->expcache_db = idb_alloc(DB_OPT_BASE);
- guild->infoevent_db = idb_alloc(DB_OPT_BASE);
- guild->expcache_ers = ers_new(sizeof(struct guild_expcache),"guild.c::expcache_ers",ERS_OPT_NONE);
+void do_init_guild(bool minimal) {
+ if (minimal)
+ return;
+
+ guild->db = idb_alloc(DB_OPT_RELEASE_DATA);
+ guild->castle_db = idb_alloc(DB_OPT_BASE);
+ guild->expcache_db = idb_alloc(DB_OPT_BASE);
+ guild->infoevent_db = idb_alloc(DB_OPT_BASE);
+ guild->expcache_ers = ers_new(sizeof(struct guild_expcache),"guild.c::expcache_ers",ERS_OPT_NONE);
sv->readdb(map->db_path, "castle_db.txt", ',', 4, 5, -1, guild->read_castledb);
diff --git a/src/map/guild.h b/src/map/guild.h
index 348a6c7e4..8da9036e6 100644
--- a/src/map/guild.h
+++ b/src/map/guild.h
@@ -56,7 +56,7 @@ struct s_guild_skill_tree {
struct guild_interface {
- void (*init) (void);
+ void (*init) (bool minimal);
void (*final) (void);
/* */
DBMap* db; // int guild_id -> struct guild*
diff --git a/src/map/homunculus.c b/src/map/homunculus.c
index 52f0572c0..0a162958a 100644
--- a/src/map/homunculus.c
+++ b/src/map/homunculus.c
@@ -272,7 +272,7 @@ void homunculus_skillup(struct homun_data *hd,uint16 skill_id) {
{
hd->homunculus.hskill[i].lv++;
hd->homunculus.skillpts-- ;
- status_calc_homunculus(hd,0);
+ status_calc_homunculus(hd,SCO_NONE);
if (hd->master) {
clif->homskillup(hd->master, skill_id);
clif->hominfo(hd->master,hd,0);
@@ -413,7 +413,7 @@ bool homunculus_evolve(struct homun_data *hd) {
//status_Calc flag&1 will make current HP/SP be reloaded from hom structure
hom->hp = hd->battle_status.hp;
hom->sp = hd->battle_status.sp;
- status_calc_homunculus(hd,1);
+ status_calc_homunculus(hd,SCO_FIRST);
if (!(battle_config.hom_setting&0x2))
skill->unit_move(&sd->hd->bl,timer->gettick(),1); // apply land skills immediately
@@ -460,7 +460,7 @@ bool homunculus_mutate(struct homun_data *hd, int homun_id) {
hom->hp = hd->battle_status.hp;
hom->sp = hd->battle_status.sp;
hom->prev_class = prev_class;
- status_calc_homunculus(hd,1);
+ status_calc_homunculus(hd,SCO_FIRST);
if (!(battle_config.hom_setting&0x2))
skill->unit_move(&sd->hd->bl,timer->gettick(),1); // apply land skills immediately
@@ -505,7 +505,7 @@ int homunculus_gainexp(struct homun_data *hd,unsigned int exp) {
hd->homunculus.exp = 0;
clif->specialeffect(&hd->bl,568,AREA);
- status_calc_homunculus(hd,0);
+ status_calc_homunculus(hd,SCO_NONE);
status_percent_heal(&hd->bl, 100, 100);
return 0;
}
@@ -757,7 +757,7 @@ bool homunculus_create(struct map_session_data *sd, struct s_homunculus *hom) {
hd->bl.y = hd->ud.to_y;
map->addiddb(&hd->bl);
- status_calc_homunculus(hd,1);
+ status_calc_homunculus(hd,SCO_FIRST);
hd->hungry_timer = INVALID_TIMER;
return true;
@@ -1003,7 +1003,7 @@ bool homunculus_shuffle(struct homun_data *hd) {
memcpy(&hd->homunculus.hskill, &b_skill, sizeof(b_skill));
hd->homunculus.skillpts = skillpts;
clif->homskillinfoblock(sd);
- status_calc_homunculus(hd,0);
+ status_calc_homunculus(hd,SCO_NONE);
status_percent_heal(&hd->bl, 100, 100);
clif->specialeffect(&hd->bl,568,AREA);
@@ -1229,8 +1229,12 @@ void homunculus_skill_reload(void) {
homun->skill_db_read();
}
-void do_init_homunculus(void) {
+void do_init_homunculus(bool minimal) {
int class_;
+
+ if (minimal)
+ return;
+
homun->read_db();
homun->exp_db_read();
homun->skill_db_read();
diff --git a/src/map/homunculus.h b/src/map/homunculus.h
index e3ec38f7b..bf1de6171 100644
--- a/src/map/homunculus.h
+++ b/src/map/homunculus.h
@@ -91,7 +91,7 @@ struct homunculus_interface {
struct s_homunculus_db db[MAX_HOMUNCULUS_CLASS];
struct homun_skill_tree_entry skill_tree[MAX_HOMUNCULUS_CLASS][MAX_SKILL_TREE];
/* */
- void (*init) (void);
+ void (*init) (bool minimal);
void (*final) (void);
void (*reload) (void);
void (*reload_skill) (void);
diff --git a/src/map/instance.c b/src/map/instance.c
index 6b96c3112..ab68c9e22 100644
--- a/src/map/instance.c
+++ b/src/map/instance.c
@@ -691,7 +691,10 @@ void do_final_instance(void) {
instance->instances = 0;
}
-void do_init_instance(void) {
+void do_init_instance(bool minimal) {
+ if (minimal)
+ return;
+
timer->add_func_list(instance->destroy_timer, "instance_destroy_timer");
}
diff --git a/src/map/instance.h b/src/map/instance.h
index 27a9401b4..4f65d7db0 100644
--- a/src/map/instance.h
+++ b/src/map/instance.h
@@ -47,7 +47,7 @@ struct instance_data {
};
struct instance_interface {
- void (*init) (void);
+ void (*init) (bool minimal);
void (*final) (void);
void (*reload) (void);
/* start point */
diff --git a/src/map/irc-bot.c b/src/map/irc-bot.c
index f67446629..0f487d8f7 100644
--- a/src/map/irc-bot.c
+++ b/src/map/irc-bot.c
@@ -386,7 +386,7 @@ void irc_relay(char *name, const char *msg) {
/**
* IRC bot initializer
*/
-void irc_bot_init(void) {
+void irc_bot_init(bool minimal) {
/// Command handlers
const struct irc_func irc_func_base[] = {
{ "PING" , ircbot->pong },
@@ -399,6 +399,9 @@ void irc_bot_init(void) {
struct irc_func* function;
int i;
+ if (minimal)
+ return;
+
if( !hChSys.irc )
return;
diff --git a/src/map/irc-bot.h b/src/map/irc-bot.h
index 52ff0c9be..305cdfd91 100644
--- a/src/map/irc-bot.h
+++ b/src/map/irc-bot.h
@@ -34,7 +34,7 @@ struct irc_bot_interface {
unsigned int size;
} funcs;
/* */
- void (*init) (void);
+ void (*init) (bool minimal);
void (*final) (void);
/* */
int (*parse) (int fd);
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index feb17ddc8..d7d117574 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -1027,7 +1027,10 @@ void itemdb_read_packages(void) {
if( itemdb->packages[count].random_qty ) {
CREATE(itemdb->packages[count].random_groups, struct item_package_rand_group, itemdb->packages[count].random_qty);
for( c = 0; c < itemdb->packages[count].random_qty; c++ ) {
- CREATE(itemdb->packages[count].random_groups[c].random_list, struct item_package_rand_entry, rgroups[ i - 1 ][c]);
+ if( !rgroups[ i - 1 ][c] )
+ ShowError("itemdb_read_packages: package '%s' missing 'Random' field %d! there must not be gaps!\n",config_setting_name(itg),c+1);
+ else
+ CREATE(itemdb->packages[count].random_groups[c].random_list, struct item_package_rand_entry, rgroups[ i - 1 ][c]);
itemdb->packages[count].random_groups[c].random_qty = 0;
}
}
@@ -1090,7 +1093,7 @@ void itemdb_read_packages(void) {
itemdb->packages[count].random_groups[gidx].random_list[r].id = data ? data->nameid : 0;
itemdb->packages[count].random_groups[gidx].random_list[r].qty = icount;
if( (itemdb->packages[count].random_groups[gidx].random_list[r].rate = rate) == 10000 ) {
- ShowWarning("itemdb_read_packages: item '%s' in '%s' has 100% drop rate!! set this item as 'Random: 0' or other items won't drop!!!\n",itname,config_setting_name(itg));
+ ShowWarning("itemdb_read_packages: item '%s' in '%s' has 100%% drop rate!! set this item as 'Random: 0' or other items won't drop!!!\n",itname,config_setting_name(itg));
}
itemdb->packages[count].random_groups[gidx].random_list[r].hours = expire;
itemdb->packages[count].random_groups[gidx].random_list[r].announce = announce == true ? 1 : 0;
@@ -1924,7 +1927,7 @@ int itemdb_uid_load() {
/*====================================
* read all item-related databases
*------------------------------------*/
-void itemdb_read(void) {
+void itemdb_read(bool minimal) {
int i;
DBData prev;
@@ -1942,6 +1945,9 @@ void itemdb_read(void) {
}
}
+ if (minimal)
+ return;
+
itemdb->read_combos();
itemdb->read_groups();
itemdb->read_chains();
@@ -2062,7 +2068,7 @@ void itemdb_reload(void) {
db_clear(itemdb->names);
// read new data
- itemdb->read();
+ itemdb->read(false);
//Epoque's awesome @reloaditemdb fix - thanks! [Ind]
//- Fixes the need of a @reloadmobdb after a @reloaditemdb to re-link monster drop data
@@ -2105,7 +2111,7 @@ void itemdb_reload(void) {
sd->combos.id = NULL;
sd->combos.count = 0;
if( pc->load_combo(sd) > 0 )
- status_calc_pc(sd,0);
+ status_calc_pc(sd,SCO_FORCE);
}
}
@@ -2171,12 +2177,16 @@ void do_final_itemdb(void) {
db_destroy(itemdb->names);
}
-void do_init_itemdb(void) {
+void do_init_itemdb(bool minimal) {
memset(itemdb->array, 0, sizeof(itemdb->array));
itemdb->other = idb_alloc(DB_OPT_BASE);
itemdb->names = strdb_alloc(DB_OPT_BASE,ITEM_NAME_LENGTH);
itemdb->create_dummy_data(); //Dummy data item.
- itemdb->read();
+ itemdb->read(minimal);
+
+ if (minimal)
+ return;
+
clif->cashshop_load();
}
void itemdb_defaults(void) {
diff --git a/src/map/itemdb.h b/src/map/itemdb.h
index 2579d84ca..80d2fd0ce 100644
--- a/src/map/itemdb.h
+++ b/src/map/itemdb.h
@@ -266,7 +266,7 @@ struct item_package {
#define itemdb_canauction(item, gmlv) itemdb->isrestricted(item , gmlv, 0, itemdb->canauction_sub)
struct itemdb_interface {
- void (*init) (void);
+ void (*init) (bool minimal);
void (*final) (void);
void (*reload) (void);
void (*name_constants) (void);
@@ -343,7 +343,7 @@ struct itemdb_interface {
int (*read_sqldb) (void);
uint64 (*unique_id) (int8 flag, int64 value);
int (*uid_load) ();
- void (*read) (void);
+ void (*read) (bool minimal);
void (*destroy_item_data) (struct item_data *self, int free_self);
int (*final_sub) (DBKey key, DBData *data, va_list ap);
};
diff --git a/src/map/map.c b/src/map/map.c
index b50297ca6..cd192b7d4 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1722,8 +1722,6 @@ int map_quit(struct map_session_data *sd) {
if( sd->state.storage_flag == 1 ) sd->state.storage_flag = 0; // No need to Double Save Storage on Quit.
- if (sd->state.permanent_speed == 1) sd->state.permanent_speed = 0; // Remove lock so speed is set back to normal at login.
-
if( sd->ed ) {
elemental->clean_effect(sd->ed);
unit->remove_map(&sd->ed->bl,CLR_TELEPORT,ALC_MARK);
@@ -2907,7 +2905,7 @@ int map_readfromcache(struct map_data *m, char *buffer) {
}
-int map_addmap(char* mapname) {
+int map_addmap(const char* mapname) {
map->list[map->count].instance_id = -1;
mapindex_getmapname(mapname, map->list[map->count++].name);
return 0;
@@ -5344,6 +5342,7 @@ void map_hp_symbols(void) {
HPM->share(skill,"skill");
HPM->share(vending,"vending");
HPM->share(pc,"pc");
+ HPM->share(pcg,"pc_groups");
HPM->share(party,"party");
HPM->share(storage,"storage");
HPM->share(trade,"trade");
@@ -5398,6 +5397,7 @@ void map_load_defaults(void) {
skill_defaults();
vending_defaults();
pc_defaults();
+ pc_groups_defaults();
party_defaults();
storage_defaults();
trade_defaults();
@@ -5419,6 +5419,8 @@ void map_load_defaults(void) {
}
int do_init(int argc, char *argv[])
{
+ bool minimal = false;
+ char *scriptcheck = NULL;
int i;
#ifdef GCOLLECT
@@ -5468,6 +5470,11 @@ int do_init(int argc, char *argv[])
map->LOG_CONF_NAME = argv[++i];
} else if( strcmp(arg, "run-once") == 0 ) { // close the map-server as soon as its done.. for testing [Celest]
runflag = CORE_ST_STOP;
+ } else if( strcmp(arg, "script-check") == 0 ) {
+ minimal = true;
+ runflag = CORE_ST_STOP;
+ if( map->arg_next_value(arg, i, argc) )
+ scriptcheck = argv[++i];
} else {
ShowError("Unknown option '%s'.\n", argv[i]);
exit(EXIT_FAILURE);
@@ -5489,39 +5496,42 @@ int do_init(int argc, char *argv[])
}
map_load_defaults();
- map->config_read(map->MAP_CONF_NAME);
- CREATE(map->list,struct map_data,map->count);
- map->count = 0;
- map->config_read_sub(map->MAP_CONF_NAME);
- // loads npcs
- map->reloadnpc(false);
+ if (!minimal) {
+ map->config_read(map->MAP_CONF_NAME);
+ CREATE(map->list,struct map_data,map->count);
+ map->count = 0;
+ map->config_read_sub(map->MAP_CONF_NAME);
- chrif->checkdefaultlogin();
+ // loads npcs
+ map->reloadnpc(false);
- if (!map->ip_set || !map->char_ip_set) {
- char ip_str[16];
- ip2str(addr_[0], ip_str);
+ chrif->checkdefaultlogin();
- ShowWarning("Not all IP addresses in /conf/map-server.conf configured, autodetecting...\n");
+ if (!map->ip_set || !map->char_ip_set) {
+ char ip_str[16];
+ ip2str(addr_[0], ip_str);
- if (naddr_ == 0)
- ShowError("Unable to determine your IP address...\n");
- else if (naddr_ > 1)
- ShowNotice("Multiple interfaces detected...\n");
+ ShowWarning("Not all IP addresses in /conf/map-server.conf configured, autodetecting...\n");
- ShowInfo("Defaulting to %s as our IP address\n", ip_str);
+ if (naddr_ == 0)
+ ShowError("Unable to determine your IP address...\n");
+ else if (naddr_ > 1)
+ ShowNotice("Multiple interfaces detected...\n");
- if (!map->ip_set)
- clif->setip(ip_str);
- if (!map->char_ip_set)
- chrif->setip(ip_str);
- }
+ ShowInfo("Defaulting to %s as our IP address\n", ip_str);
- battle->config_read(map->BATTLE_CONF_FILENAME);
- atcommand->msg_read(map->MSG_CONF_NAME);
+ if (!map->ip_set)
+ clif->setip(ip_str);
+ if (!map->char_ip_set)
+ chrif->setip(ip_str);
+ }
+
+ battle->config_read(map->BATTLE_CONF_FILENAME);
+ atcommand->msg_read(map->MSG_CONF_NAME);
+ map->inter_config_read(map->INTER_CONF_NAME);
+ logs->config_read(map->LOG_CONF_NAME);
+ }
script->config_read(map->SCRIPT_CONF_NAME);
- map->inter_config_read(map->INTER_CONF_NAME);
- logs->config_read(map->LOG_CONF_NAME);
map->id_db = idb_alloc(DB_OPT_BASE);
map->pc_db = idb_alloc(DB_OPT_BASE); //Added for reliable map->id2sd() use. [Skotlex]
@@ -5538,53 +5548,77 @@ int do_init(int argc, char *argv[])
map->flooritem_ers = ers_new(sizeof(struct flooritem_data),"map.c::map_flooritem_ers",ERS_OPT_NONE);
ers_chunk_size(map->flooritem_ers, 100);
-
- map->sql_init();
- if (logs->config.sql_logs)
- logs->sql_init();
- mapindex_init();
+ if (!minimal) {
+ map->sql_init();
+ if (logs->config.sql_logs)
+ logs->sql_init();
+ }
+
+ i = mapindex_init();
+
+ if (minimal) {
+ // Pretend all maps from the mapindex are on this mapserver
+ CREATE(map->list,struct map_data,i);
+
+ for( i = 0; i < MAX_MAPINDEX; i++ ) {
+ if (mapindex_exists(i)) {
+ map->addmap(mapindex_id2name(i));
+ }
+ }
+ }
+
if(map->enable_grf)
grfio_init(map->GRF_PATH_FILENAME);
map->readallmaps();
- timer->add_func_list(map->freeblock_timer, "map_freeblock_timer");
- timer->add_func_list(map->clearflooritem_timer, "map_clearflooritem_timer");
- timer->add_func_list(map->removemobs_timer, "map_removemobs_timer");
- timer->add_interval(timer->gettick()+1000, map->freeblock_timer, 0, 0, 60*1000);
-
- HPM->load_sub = HPM_map_plugin_load_sub;
- HPM->symbol_defaults_sub = map_hp_symbols;
- HPM->config_read();
- HPM->event(HPET_INIT);
-
- atcommand->init();
- battle->init();
- instance->init();
- chrif->init();
- clif->init();
- ircbot->init();
- script->init();
- itemdb->init();
- skill->init();
- map->read_zone_db();/* read after item and skill initalization */
- mob->init();
- pc->init();
- status->init();
- party->init();
- guild->init();
- gstorage->init();
- pet->init();
- homun->init();
- mercenary->init();
- elemental->init();
- quest->init();
- npc->init();
- unit->init();
- bg->init();
- duel->init();
- vending->init();
+
+ if (!minimal) {
+ timer->add_func_list(map->freeblock_timer, "map_freeblock_timer");
+ timer->add_func_list(map->clearflooritem_timer, "map_clearflooritem_timer");
+ timer->add_func_list(map->removemobs_timer, "map_removemobs_timer");
+ timer->add_interval(timer->gettick()+1000, map->freeblock_timer, 0, 0, 60*1000);
+
+ HPM->load_sub = HPM_map_plugin_load_sub;
+ HPM->symbol_defaults_sub = map_hp_symbols;
+ HPM->config_read();
+ HPM->event(HPET_INIT);
+ }
+
+ atcommand->init(minimal);
+ battle->init(minimal);
+ instance->init(minimal);
+ chrif->init(minimal);
+ clif->init(minimal);
+ ircbot->init(minimal);
+ script->init(minimal);
+ itemdb->init(minimal);
+ skill->init(minimal);
+ if (!minimal)
+ map->read_zone_db();/* read after item and skill initalization */
+ mob->init(minimal);
+ pc->init(minimal);
+ status->init(minimal);
+ party->init(minimal);
+ guild->init(minimal);
+ gstorage->init(minimal);
+ pet->init(minimal);
+ homun->init(minimal);
+ mercenary->init(minimal);
+ elemental->init(minimal);
+ quest->init(minimal);
+ npc->init(minimal);
+ unit->init(minimal);
+ bg->init(minimal);
+ duel->init(minimal);
+ vending->init(minimal);
+
+ if (minimal) {
+ if (npc->parsesrcfile(scriptcheck, false) == 0)
+ exit(EXIT_SUCCESS);
+ exit(EXIT_FAILURE);
+ }
npc->event_do_oninit(); // Init npcs (OnInit)
diff --git a/src/map/map.h b/src/map/map.h
index 06c3829b1..20e328c88 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -1023,7 +1023,7 @@ struct map_interface {
int (*eraseallipport_sub) (DBKey key, DBData *data, va_list va);
char* (*init_mapcache) (FILE *fp);
int (*readfromcache) (struct map_data *m, char *buffer);
- int (*addmap) (char *mapname);
+ int (*addmap) (const char *mapname);
void (*delmapid) (int id);
void (*zone_db_clear) (void);
void (*list_final) (void);
diff --git a/src/map/mercenary.c b/src/map/mercenary.c
index 8c74a5e1e..87e7d2f3c 100644
--- a/src/map/mercenary.c
+++ b/src/map/mercenary.c
@@ -317,7 +317,7 @@ int merc_data_received(struct s_mercenary *merc, bool flag) {
md->bl.y = md->ud.to_y;
map->addiddb(&md->bl);
- status_calc_mercenary(md,1);
+ status_calc_mercenary(md,SCO_FIRST);
md->contract_timer = INVALID_TIMER;
merc_contract_init(md);
}
@@ -490,7 +490,10 @@ int read_mercenary_skilldb(void) {
return 0;
}
-void do_init_mercenary(void) {
+void do_init_mercenary(bool minimal) {
+ if (minimal)
+ return;
+
mercenary->read_db();
mercenary->read_skilldb();
diff --git a/src/map/mercenary.h b/src/map/mercenary.h
index 3245606cf..3f2214b65 100644
--- a/src/map/mercenary.h
+++ b/src/map/mercenary.h
@@ -59,7 +59,7 @@ struct mercenary_interface {
/* funcs */
- void (*init) (void);
+ void (*init) (bool minimal);
bool (*class) (int class_);
struct view_data * (*get_viewdata) (int class_);
diff --git a/src/map/mob.c b/src/map/mob.c
index 778fc1dfa..b8a8ed6c5 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -601,7 +601,7 @@ int mob_spawn_guardian_sub(int tid, int64 tick, int id, intptr_t data) {
memcpy(md->guardian_data->guild_name, g->name, NAME_LENGTH);
md->guardian_data->guardup_lv = guardup_lv;
if( guardup_lv )
- status_calc_mob(md, 0); //Give bonuses.
+ status_calc_mob(md, SCO_NONE); //Give bonuses.
return 0;
}
@@ -919,7 +919,7 @@ int mob_spawn (struct mob_data *md)
}
memset(&md->state, 0, sizeof(md->state));
- status_calc_mob(md, 1);
+ status_calc_mob(md, SCO_FIRST);
md->attacked_id = 0;
md->target_id = 0;
md->move_fail_count = 0;
@@ -2731,7 +2731,7 @@ int mob_class_change (struct mob_data *md, int class_)
unit->skillcastcancel(&md->bl, 0);
status->set_viewdata(&md->bl, class_);
clif->class_change(&md->bl, md->vd->class_, 1);
- status_calc_mob(md, 1);
+ status_calc_mob(md, SCO_FIRST);
md->ud.state.speed_changed = 1; //Speed change update.
if (battle_config.monster_class_change_recover) {
@@ -4540,7 +4540,12 @@ bool mob_readdb_itemratio(char* str[], int columns, int current)
/**
* read all mob-related databases
*/
-void mob_load(void) {
+void mob_load(bool minimal) {
+ if (minimal) {
+ // Only read the mob db in minimal mode
+ mob->readdb();
+ return;
+ }
sv->readdb(map->db_path, "mob_item_ratio.txt", ',', 2, 2+MAX_ITEMRATIO_MOBS, -1, mob->readdb_itemratio); // must be read before mobdb
mob->readchatdb();
if (map->db_use_sql_mob_db) {
@@ -4575,7 +4580,7 @@ void mob_reload(void) {
}
}
- mob->load();
+ mob->load(false);
}
void mob_clear_spawninfo()
@@ -4589,15 +4594,18 @@ void mob_clear_spawninfo()
/*==========================================
* Circumference initialization of mob
*------------------------------------------*/
-int do_init_mob(void)
-{ //Initialize the mob database
+int do_init_mob(bool minimal) {
+ // Initialize the mob database
memset(mob->db_data,0,sizeof(mob->db_data)); //Clear the array
- mob->db_data[0] = (struct mob_db*)aCalloc(1, sizeof (struct mob_db)); //This mob is used for random spawns
+ mob->db_data[0] = (struct mob_db*)aCalloc(1, sizeof (struct mob_db)); //This mob is used for random spawns
mob->makedummymobdb(0); //The first time this is invoked, it creates the dummy mob
item_drop_ers = ers_new(sizeof(struct item_drop),"mob.c::item_drop_ers",ERS_OPT_NONE);
item_drop_list_ers = ers_new(sizeof(struct item_drop_list),"mob.c::item_drop_list_ers",ERS_OPT_NONE);
- mob->load();
+ mob->load(minimal);
+
+ if (minimal)
+ return 0;
timer->add_func_list(mob->delayspawn,"mob_delayspawn");
timer->add_func_list(mob->delay_item_drop,"mob_delay_item_drop");
diff --git a/src/map/mob.h b/src/map/mob.h
index 2f425e285..31a8666a2 100644
--- a/src/map/mob.h
+++ b/src/map/mob.h
@@ -259,7 +259,7 @@ struct mob_interface {
int manuk[8];
int splendide[5];
/* */
- int (*init) (void);
+ int (*init) (bool mimimal);
int (*final) (void);
void (*reload) (void);
/* */
@@ -354,7 +354,7 @@ struct mob_interface {
int (*read_sqlskilldb) (void);
bool (*readdb_race2) (char *fields[], int columns, int current);
bool (*readdb_itemratio) (char *str[], int columns, int current);
- void (*load) (void);
+ void (*load) (bool minimal);
void (*clear_spawninfo) ();
};
diff --git a/src/map/npc.c b/src/map/npc.c
index f0bdd7bd0..9330d59d3 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -1253,6 +1253,7 @@ int npc_buysellsel(struct map_session_data* sd, int id, int type) {
}
return 0;
}
+
/*==========================================
* Cash Shop Buy List
*------------------------------------------*/
@@ -1944,7 +1945,7 @@ void npc_parsename(struct npc_data* nd, const char* name, const char* start, con
if( p ) { // <Display name>::<Unique name>
size_t len = p-name;
if( len > NAME_LENGTH ) {
- ShowWarning("npc_parsename: Display name of '%s' is too long (len=%u) in file '%s', line'%d'. Truncating to %u characters.\n", name, (unsigned int)len, filepath, strline(buffer,start-buffer), NAME_LENGTH);
+ ShowWarning("npc_parsename: Display name of '%s' is too long (len=%u) in file '%s', line '%d'. Truncating to %u characters.\n", name, (unsigned int)len, filepath, strline(buffer,start-buffer), NAME_LENGTH);
safestrncpy(nd->name, name, sizeof(nd->name));
} else {
memcpy(nd->name, name, len);
@@ -1952,19 +1953,19 @@ void npc_parsename(struct npc_data* nd, const char* name, const char* start, con
}
len = strlen(p+2);
if( len > NAME_LENGTH )
- ShowWarning("npc_parsename: Unique name of '%s' is too long (len=%u) in file '%s', line'%d'. Truncating to %u characters.\n", name, (unsigned int)len, filepath, strline(buffer,start-buffer), NAME_LENGTH);
+ ShowWarning("npc_parsename: Unique name of '%s' is too long (len=%u) in file '%s', line '%d'. Truncating to %u characters.\n", name, (unsigned int)len, filepath, strline(buffer,start-buffer), NAME_LENGTH);
safestrncpy(nd->exname, p+2, sizeof(nd->exname));
} else {// <Display name>
size_t len = strlen(name);
if( len > NAME_LENGTH )
- ShowWarning("npc_parsename: Name '%s' is too long (len=%u) in file '%s', line'%d'. Truncating to %u characters.\n", name, (unsigned int)len, filepath, strline(buffer,start-buffer), NAME_LENGTH);
+ ShowWarning("npc_parsename: Name '%s' is too long (len=%u) in file '%s', line '%d'. Truncating to %u characters.\n", name, (unsigned int)len, filepath, strline(buffer,start-buffer), NAME_LENGTH);
safestrncpy(nd->name, name, sizeof(nd->name));
safestrncpy(nd->exname, name, sizeof(nd->exname));
}
if( *nd->exname == '\0' || strstr(nd->exname,"::") != NULL ) {// invalid
snprintf(newname, ARRAYLENGTH(newname), "0_%d_%d_%d", nd->bl.m, nd->bl.x, nd->bl.y);
- ShowWarning("npc_parsename: Invalid unique name in file '%s', line'%d'. Renaming '%s' to '%s'.\n", filepath, strline(buffer,start-buffer), nd->exname, newname);
+ ShowWarning("npc_parsename: Invalid unique name in file '%s', line '%d'. Renaming '%s' to '%s'.\n", filepath, strline(buffer,start-buffer), nd->exname, newname);
safestrncpy(nd->exname, newname, sizeof(nd->exname));
}
@@ -1981,7 +1982,7 @@ void npc_parsename(struct npc_data* nd, const char* name, const char* start, con
strcpy(this_mapname, (nd->bl.m == -1 ? "(not on a map)" : mapindex_id2name(map_id2index(nd->bl.m))));
strcpy(other_mapname, (dnd->bl.m == -1 ? "(not on a map)" : mapindex_id2name(map_id2index(dnd->bl.m))));
- ShowWarning("npc_parsename: Duplicate unique name in file '%s', line'%d'. Renaming '%s' to '%s'.\n", filepath, strline(buffer,start-buffer), nd->exname, newname);
+ ShowWarning("npc_parsename: Duplicate unique name in file '%s', line '%d'. Renaming '%s' to '%s'.\n", filepath, strline(buffer,start-buffer), nd->exname, newname);
ShowDebug("this npc:\n display name '%s'\n unique name '%s'\n map=%s, x=%d, y=%d\n", nd->name, nd->exname, this_mapname, nd->bl.x, nd->bl.y);
ShowDebug("other npc in '%s' :\n display name '%s'\n unique name '%s'\n map=%s, x=%d, y=%d\n",dnd->path, dnd->name, dnd->exname, other_mapname, dnd->bl.x, dnd->bl.y);
safestrncpy(nd->exname, newname, sizeof(nd->exname));
@@ -2240,7 +2241,7 @@ const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const char* s
}
if( type == SHOP && value*0.75 < id->value_sell*1.24 )
{// Exploit possible: you can buy and sell back with profit
- ShowWarning("npc_parse_shop: Item %s [%d] discounted buying price (%d->%d) is less than overcharged selling price (%d->%d) at file '%s', line '%d'.\n",
+ ShowWarning("npc_parse_shop: Item %s [%d] discounted buying price (%d->%d) is less than overcharged selling price (%d->%d) in file '%s', line '%d'.\n",
id->name, nameid, value, (int)(value*0.75), id->value_sell, (int)(id->value_sell*1.24), filepath, strline(buffer,start-buffer));
}
//for logs filters, atcommands and iteminfo script command
@@ -2308,7 +2309,7 @@ void npc_convertlabel_db(struct npc_label_list* label_list, const char *filepath
// here we check if the label fit into the buffer
if( len > 23 ) {
- ShowError("npc_parse_script: label name longer than 23 chars! '%s'\n (%s)", lname, filepath);
+ ShowError("npc_parse_script: label name longer than 23 chars! (%s) in file '%s'.\n", lname, filepath);
return;
}
@@ -2332,7 +2333,7 @@ const char* npc_skip_script(const char* start, const char* buffer, const char* f
p = strchr(start,'{');
if( p == NULL )
{
- ShowError("npc_skip_script: Missing left curly in file '%s', line'%d'.", filepath, strline(buffer,start-buffer));
+ ShowError("npc_skip_script: Missing left curly in file '%s', line '%d'.\n", filepath, strline(buffer,start-buffer));
return NULL;// can't continue
}
@@ -2368,7 +2369,7 @@ const char* npc_skip_script(const char* start, const char* buffer, const char* f
}
else if( *p == '\0' )
{// end of buffer
- ShowError("Missing %d right curlys at file '%s', line '%d'.\n", curly_count, filepath, strline(buffer,p-buffer));
+ ShowError("Missing %d right curlys in file '%s', line '%d'.\n", curly_count, filepath, strline(buffer,p-buffer));
return NULL;// can't continue
}
}
@@ -2478,7 +2479,7 @@ const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, const char*
// Loop through labels to export them as necessary
for (i = 0; i < nd->u.scr.label_list_num; i++) {
if (npc->event_export(nd, i)) {
- ShowWarning("npc_parse_script : duplicate event %s::%s (%s)\n",
+ ShowWarning("npc_parse_script: duplicate event %s::%s in file '%s'.\n",
nd->exname, nd->u.scr.label_list[i].name, filepath);
}
npc->timerevent_export(nd, i);
@@ -2529,14 +2530,14 @@ const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const ch
// get the npc being duplicated
if( w2[length-1] != ')' || length <= 11 || length-11 >= sizeof(srcname) )
{// does not match 'duplicate(%127s)', name is empty or too long
- ShowError("npc_parse_script: bad duplicate name in file '%s', line '%d' : %s\n", filepath, strline(buffer,start-buffer), w2);
+ ShowError("npc_parse_script: bad duplicate name in file '%s', line '%d': %s\n", filepath, strline(buffer,start-buffer), w2);
return end;// next line, try to continue
}
safestrncpy(srcname, w2+10, length-10);
dnd = npc->name2id(srcname);
if( dnd == NULL) {
- ShowError("npc_parse_script: original npc not found for duplicate in file '%s', line '%d' : %s\n", filepath, strline(buffer,start-buffer), srcname);
+ ShowError("npc_parse_script: original npc not found for duplicate in file '%s', line '%d': %s\n", filepath, strline(buffer,start-buffer), srcname);
return end;// next line, try to continue
}
src_id = dnd->bl.id;
@@ -2547,8 +2548,10 @@ const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const ch
x = y = dir = 0;
m = -1;
} else {
- if( sscanf(w1, "%31[^,],%d,%d,%d", mapname, &x, &y, &dir) != 4 )// <map name>,<x>,<y>,<facing>
- {
+ int fields = sscanf(w1, "%31[^,],%d,%d,%d", mapname, &x, &y, &dir);
+ if( type == WARP && fields == 3 ) { // <map name>,<x>,<y>
+ dir = 0;
+ } else if( fields != 4 ) {// <map name>,<x>,<y>,<facing>
ShowError("npc_parse_duplicate: Invalid placement format for duplicate in file '%s', line '%d'. Skipping line...\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,start-buffer), w1, w2, w3, w4);
return end;// next line, try to continue
}
@@ -2636,7 +2639,7 @@ const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const ch
// Loop through labels to export them as necessary
for (i = 0; i < nd->u.scr.label_list_num; i++) {
if (npc->event_export(nd, i)) {
- ShowWarning("npc_parse_duplicate : duplicate event %s::%s (%s)\n",
+ ShowWarning("npc_parse_duplicate: duplicate event %s::%s in file '%s'.\n",
nd->exname, nd->u.scr.label_list[i].name, filepath);
}
npc->timerevent_export(nd, i);
@@ -2919,7 +2922,7 @@ const char* npc_parse_function(char* w1, char* w2, char* w3, char* w4, const cha
if (func_db->put(func_db, DB->str2key(w3), DB->ptr2data(scriptroot), &old_data))
{
struct script_code *oldscript = (struct script_code*)DB->data2ptr(&old_data);
- ShowInfo("npc_parse_function: Overwriting user function [%s] (%s:%d)\n", w3, filepath, strline(buffer,start-buffer));
+ ShowWarning("npc_parse_function: Overwriting user function [%s] in file '%s', line '%d'.\n", w3, filepath, strline(buffer,start-buffer));
script->free_vars(oldscript->script_vars);
aFree(oldscript->script_buf);
aFree(oldscript);
@@ -2977,33 +2980,33 @@ const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const char* st
mobspawn.m = (unsigned short)m;
if( x < 0 || x >= map->list[mobspawn.m].xs || y < 0 || y >= map->list[mobspawn.m].ys ) {
- ShowError("npc_parse_mob: Spawn coordinates out of range: %s (%d,%d), map size is (%d,%d) - %s %s (file '%s', line '%d').\n", map->list[mobspawn.m].name, x, y, (map->list[mobspawn.m].xs-1), (map->list[mobspawn.m].ys-1), w1, w3, filepath, strline(buffer,start-buffer));
+ ShowError("npc_parse_mob: Spawn coordinates out of range: %s (%d,%d), map size is (%d,%d) - %s %s in file '%s', line '%d'.\n", map->list[mobspawn.m].name, x, y, (map->list[mobspawn.m].xs-1), (map->list[mobspawn.m].ys-1), w1, w3, filepath, strline(buffer,start-buffer));
return strchr(start,'\n');// skip and continue
}
// check monster ID if exists!
if( mob->db_checkid(class_) == 0 ) {
- ShowError("npc_parse_mob: Unknown mob ID %d (file '%s', line '%d').\n", class_, filepath, strline(buffer,start-buffer));
+ ShowError("npc_parse_mob: Unknown mob ID %d in file '%s', line '%d'.\n", class_, filepath, strline(buffer,start-buffer));
return strchr(start,'\n');// skip and continue
}
if( num < 1 || num > 1000 ) {
- ShowError("npc_parse_mob: Invalid number of monsters %d, must be inside the range [1,1000] (file '%s', line '%d').\n", num, filepath, strline(buffer,start-buffer));
+ ShowError("npc_parse_mob: Invalid number of monsters %d, must be inside the range [1,1000] in file '%s', line '%d'.\n", num, filepath, strline(buffer,start-buffer));
return strchr(start,'\n');// skip and continue
}
if( (mobspawn.state.size < 0 || mobspawn.state.size > 2) && size != -1 ) {
- ShowError("npc_parse_mob: Invalid size number %d for mob ID %d (file '%s', line '%d').\n", mobspawn.state.size, class_, filepath, strline(buffer, start - buffer));
+ ShowError("npc_parse_mob: Invalid size number %d for mob ID %d in file '%s', line '%d'.\n", mobspawn.state.size, class_, filepath, strline(buffer, start - buffer));
return strchr(start, '\n');
}
if( (mobspawn.state.ai < 0 || mobspawn.state.ai > 4) && ai != -1 ) {
- ShowError("npc_parse_mob: Invalid ai %d for mob ID %d (file '%s', line '%d').\n", mobspawn.state.ai, class_, filepath, strline(buffer, start - buffer));
+ ShowError("npc_parse_mob: Invalid ai %d for mob ID %d in file '%s', line '%d'.\n", mobspawn.state.ai, class_, filepath, strline(buffer, start - buffer));
return strchr(start, '\n');
}
if( (mob_lv == 0 || mob_lv > MAX_LEVEL) && mob_lv != -1 ) {
- ShowError("npc_parse_mob: Invalid level %d for mob ID %d (file '%s', line '%d').\n", mob_lv, class_, filepath, strline(buffer, start - buffer));
+ ShowError("npc_parse_mob: Invalid level %d for mob ID %d in file '%s', line '%d'.\n", mob_lv, class_, filepath, strline(buffer, start - buffer));
return strchr(start, '\n');
}
@@ -3033,7 +3036,7 @@ const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const char* st
}
if(mobspawn.delay1>0xfffffff || mobspawn.delay2>0xfffffff) {
- ShowError("npc_parse_mob: Invalid spawn delays %u %u (file '%s', line '%d').\n", mobspawn.delay1, mobspawn.delay2, filepath, strline(buffer,start-buffer));
+ ShowError("npc_parse_mob: Invalid spawn delays %u %u in file '%s', line '%d'.\n", mobspawn.delay1, mobspawn.delay2, filepath, strline(buffer,start-buffer));
return strchr(start,'\n');// skip and continue
}
@@ -3047,7 +3050,7 @@ const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const char* st
//Verify dataset.
if( !mob->parse_dataset(&mobspawn) ) {
- ShowError("npc_parse_mob: Invalid dataset for monster ID %d (file '%s', line '%d').\n", class_, filepath, strline(buffer,start-buffer));
+ ShowError("npc_parse_mob: Invalid dataset for monster ID %d in file '%s', line '%d'.\n", class_, filepath, strline(buffer,start-buffer));
return strchr(start,'\n');// skip and continue
}
@@ -3141,7 +3144,7 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char
map->list[m].save.x = savex;
map->list[m].save.y = savey;
if (!map->list[m].save.map) {
- ShowWarning("npc_parse_mapflag: Specified save point map '%s' for mapflag 'nosave' not found (file '%s', line '%d'), using 'SavePoint'.\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", savemap, filepath, strline(buffer,start-buffer), w1, w2, w3, w4);
+ ShowWarning("npc_parse_mapflag: Specified save point map '%s' for mapflag 'nosave' not found in file '%s', line '%d', using 'SavePoint'.\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", savemap, filepath, strline(buffer,start-buffer), w1, w2, w3, w4);
map->list[m].save.x = -1;
map->list[m].save.y = -1;
}
@@ -3179,11 +3182,11 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char
map->list[m].flag.gvg = 0;
map->list[m].flag.gvg_dungeon = 0;
map->list[m].flag.gvg_castle = 0;
- ShowWarning("npc_parse_mapflag: You can't set PvP and GvG flags for the same map! Removing GvG flags from %s (file '%s', line '%d').\n", map->list[m].name, filepath, strline(buffer,start-buffer));
+ ShowWarning("npc_parse_mapflag: You can't set PvP and GvG flags for the same map! Removing GvG flags from %s in file '%s', line '%d'.\n", map->list[m].name, filepath, strline(buffer,start-buffer));
}
if( state && map->list[m].flag.battleground ) {
map->list[m].flag.battleground = 0;
- ShowWarning("npc_parse_mapflag: You can't set PvP and BattleGround flags for the same map! Removing BattleGround flag from %s (file '%s', line '%d').\n", map->list[m].name, filepath, strline(buffer,start-buffer));
+ ShowWarning("npc_parse_mapflag: You can't set PvP and BattleGround flags for the same map! Removing BattleGround flag from %s in file '%s', line '%d'.\n", map->list[m].name, filepath, strline(buffer,start-buffer));
}
if( state && (zone = strdb_get(map->zone_db, MAP_ZONE_PVP_NAME)) && map->list[m].zone != zone ) {
map->zone_change(m,zone,start,buffer,filepath);
@@ -3229,11 +3232,11 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char
map->list[m].flag.gvg = state;
if( state && map->list[m].flag.pvp ) {
map->list[m].flag.pvp = 0;
- ShowWarning("npc_parse_mapflag: You can't set PvP and GvG flags for the same map! Removing PvP flag from %s (file '%s', line '%d').\n", map->list[m].name, filepath, strline(buffer,start-buffer));
+ ShowWarning("npc_parse_mapflag: You can't set PvP and GvG flags for the same map! Removing PvP flag from %s in file '%s', line '%d'.\n", map->list[m].name, filepath, strline(buffer,start-buffer));
}
if( state && map->list[m].flag.battleground ) {
map->list[m].flag.battleground = 0;
- ShowWarning("npc_parse_mapflag: You can't set GvG and BattleGround flags for the same map! Removing BattleGround flag from %s (file '%s', line '%d').\n", map->list[m].name, filepath, strline(buffer,start-buffer));
+ ShowWarning("npc_parse_mapflag: You can't set GvG and BattleGround flags for the same map! Removing BattleGround flag from %s in file '%s', line '%d'.\n", map->list[m].name, filepath, strline(buffer,start-buffer));
}
if( state && (zone = strdb_get(map->zone_db, MAP_ZONE_GVG_NAME)) && map->list[m].zone != zone ) {
map->zone_change(m,zone,start,buffer,filepath);
@@ -3261,13 +3264,13 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char
if( map->list[m].flag.battleground && map->list[m].flag.pvp ) {
map->list[m].flag.pvp = 0;
- ShowWarning("npc_parse_mapflag: You can't set PvP and BattleGround flags for the same map! Removing PvP flag from %s (file '%s', line '%d').\n", map->list[m].name, filepath, strline(buffer,start-buffer));
+ ShowWarning("npc_parse_mapflag: You can't set PvP and BattleGround flags for the same map! Removing PvP flag from %s in file '%s', line '%d'.\n", map->list[m].name, filepath, strline(buffer,start-buffer));
}
if( map->list[m].flag.battleground && (map->list[m].flag.gvg || map->list[m].flag.gvg_dungeon || map->list[m].flag.gvg_castle) ) {
map->list[m].flag.gvg = 0;
map->list[m].flag.gvg_dungeon = 0;
map->list[m].flag.gvg_castle = 0;
- ShowWarning("npc_parse_mapflag: You can't set GvG and BattleGround flags for the same map! Removing GvG flag from %s (file '%s', line '%d').\n", map->list[m].name, filepath, strline(buffer,start-buffer));
+ ShowWarning("npc_parse_mapflag: You can't set GvG and BattleGround flags for the same map! Removing GvG flag from %s in file '%s', line '%d'.\n", map->list[m].name, filepath, strline(buffer,start-buffer));
}
if( state && (zone = strdb_get(map->zone_db, MAP_ZONE_BG_NAME)) && map->list[m].zone != zone ) {
@@ -3368,11 +3371,11 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char
}
if( modifier[0] == '\0' ) {
- ShowWarning("npc_parse_mapflag: Missing 5th param for 'adjust_unit_duration' flag! removing flag from %s (file '%s', line '%d').\n", map->list[m].name, filepath, strline(buffer,start-buffer));
+ ShowWarning("npc_parse_mapflag: Missing 5th param for 'adjust_unit_duration' flag! removing flag from %s in file '%s', line '%d'.\n", map->list[m].name, filepath, strline(buffer,start-buffer));
} else if( !( skill_id = skill->name2id(skill_name) ) || !skill->get_unit_id( skill->name2id(skill_name), 0) ) {
- ShowWarning("npc_parse_mapflag: Unknown skill (%s) for 'adjust_unit_duration' flag! removing flag from %s (file '%s', line '%d').\n",skill_name, map->list[m].name, filepath, strline(buffer,start-buffer));
+ ShowWarning("npc_parse_mapflag: Unknown skill (%s) for 'adjust_unit_duration' flag! removing flag from %s in file '%s', line '%d'.\n",skill_name, map->list[m].name, filepath, strline(buffer,start-buffer));
} else if ( atoi(modifier) < 1 || atoi(modifier) > USHRT_MAX ) {
- ShowWarning("npc_parse_mapflag: Invalid modifier '%d' for skill '%s' for 'adjust_unit_duration' flag! removing flag from %s (file '%s', line '%d').\n", atoi(modifier), skill_name, map->list[m].name, filepath, strline(buffer,start-buffer));
+ ShowWarning("npc_parse_mapflag: Invalid modifier '%d' for skill '%s' for 'adjust_unit_duration' flag! removing flag from %s in file '%s', line '%d'.\n", atoi(modifier), skill_name, map->list[m].name, filepath, strline(buffer,start-buffer));
} else {
int idx = map->list[m].unit_count;
@@ -3422,11 +3425,11 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char
}
if( modifier[0] == '\0' ) {
- ShowWarning("npc_parse_mapflag: Missing 5th param for 'adjust_skill_damage' flag! removing flag from %s (file '%s', line '%d').\n", map->list[m].name, filepath, strline(buffer,start-buffer));
+ ShowWarning("npc_parse_mapflag: Missing 5th param for 'adjust_skill_damage' flag! removing flag from %s in file '%s', line '%d'.\n", map->list[m].name, filepath, strline(buffer,start-buffer));
} else if( !( skill_id = skill->name2id(skill_name) ) ) {
- ShowWarning("npc_parse_mapflag: Unknown skill (%s) for 'adjust_skill_damage' flag! removing flag from %s (file '%s', line '%d').\n", skill_name, map->list[m].name, filepath, strline(buffer,start-buffer));
+ ShowWarning("npc_parse_mapflag: Unknown skill (%s) for 'adjust_skill_damage' flag! removing flag from %s in file '%s', line '%d'.\n", skill_name, map->list[m].name, filepath, strline(buffer,start-buffer));
} else if ( atoi(modifier) < 1 || atoi(modifier) > USHRT_MAX ) {
- ShowWarning("npc_parse_mapflag: Invalid modifier '%d' for skill '%s' for 'adjust_skill_damage' flag! removing flag from %s (file '%s', line '%d').\n", atoi(modifier), skill_name, map->list[m].name, filepath, strline(buffer,start-buffer));
+ ShowWarning("npc_parse_mapflag: Invalid modifier '%d' for skill '%s' for 'adjust_skill_damage' flag! removing flag from %s in file '%s', line '%d'.\n", atoi(modifier), skill_name, map->list[m].name, filepath, strline(buffer,start-buffer));
} else {
int idx = map->list[m].skill_count;
@@ -3464,7 +3467,7 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char
struct map_zone_data *zone;
if( !(zone = strdb_get(map->zone_db, w4)) ) {
- ShowWarning("npc_parse_mapflag: Invalid zone '%s'! removing flag from %s (file '%s', line '%d').\n", w4, map->list[m].name, filepath, strline(buffer,start-buffer));
+ ShowWarning("npc_parse_mapflag: Invalid zone '%s'! removing flag from %s in file '%s', line '%d'.\n", w4, map->list[m].name, filepath, strline(buffer,start-buffer));
} else if( map->list[m].zone != zone ) {
map->zone_change(m,zone,start,buffer,filepath);
}
@@ -3489,15 +3492,14 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char
} else if ( !strcmpi(w3,"nocashshop") ) {
map->list[m].flag.nocashshop = (state) ? 1 : 0;
} else
- ShowError("npc_parse_mapflag: unrecognized mapflag '%s' (file '%s', line '%d').\n", w3, filepath, strline(buffer,start-buffer));
+ ShowError("npc_parse_mapflag: unrecognized mapflag '%s' in file '%s', line '%d'.\n", w3, filepath, strline(buffer,start-buffer));
return strchr(start,'\n');// continue
}
//Read file and create npc/func/mapflag/monster... accordingly.
//@runOnInit should we exec OnInit when it's done ?
-void npc_parsesrcfile(const char* filepath, bool runOnInit)
-{
+int npc_parsesrcfile(const char* filepath, bool runOnInit) {
int16 m, x, y;
int lines = 0;
FILE* fp;
@@ -3510,7 +3512,7 @@ void npc_parsesrcfile(const char* filepath, bool runOnInit)
if( fp == NULL )
{
ShowError("npc_parsesrcfile: File not found '%s'.\n", filepath);
- return;
+ return -1;
}
fseek(fp, 0, SEEK_END);
len = ftell(fp);
@@ -3523,7 +3525,7 @@ void npc_parsesrcfile(const char* filepath, bool runOnInit)
ShowError("npc_parsesrcfile: Failed to read file '%s' - %s\n", filepath, strerror(errno));
aFree(buffer);
fclose(fp);
- return;
+ return -1;
}
fclose(fp);
@@ -3658,7 +3660,7 @@ void npc_parsesrcfile(const char* filepath, bool runOnInit)
}
aFree(buffer);
- return;
+ return 0;
}
int npc_script_event(struct map_session_data* sd, enum npce_event type)
@@ -3935,8 +3937,7 @@ static void npc_debug_warps(void) {
/*==========================================
* npc initialization
*------------------------------------------*/
-int do_init_npc(void)
-{
+int do_init_npc(bool minimal) {
struct npc_src_list *file;
int i;
@@ -3963,43 +3964,47 @@ int do_init_npc(void)
npc->name_db = strdb_alloc(DB_OPT_BASE, NAME_LENGTH);
npc->path_db = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, 0);
- npc->timer_event_ers = ers_new(sizeof(struct timer_event_data),"clif.c::timer_event_ers",ERS_OPT_NONE);
-
npc_last_npd = NULL;
npc_last_path = NULL;
npc_last_ref = NULL;
- // process all npc files
- ShowStatus("Loading NPCs...\r");
- for( file = npc->src_files; file != NULL; file = file->next ) {
- ShowStatus("Loading NPC file: %s"CL_CLL"\r", file->name);
- npc->parsesrcfile(file->name,false);
+ if (!minimal) {
+ npc->timer_event_ers = ers_new(sizeof(struct timer_event_data),"clif.c::timer_event_ers",ERS_OPT_NONE);
+
+ // process all npc files
+ ShowStatus("Loading NPCs...\r");
+ for( file = npc->src_files; file != NULL; file = file->next ) {
+ ShowStatus("Loading NPC file: %s"CL_CLL"\r", file->name);
+ npc->parsesrcfile(file->name,false);
+ }
+ ShowInfo ("Done loading '"CL_WHITE"%d"CL_RESET"' NPCs:"CL_CLL"\n"
+ "\t-'"CL_WHITE"%d"CL_RESET"' Warps\n"
+ "\t-'"CL_WHITE"%d"CL_RESET"' Shops\n"
+ "\t-'"CL_WHITE"%d"CL_RESET"' Scripts\n"
+ "\t-'"CL_WHITE"%d"CL_RESET"' Spawn sets\n"
+ "\t-'"CL_WHITE"%d"CL_RESET"' Mobs Cached\n"
+ "\t-'"CL_WHITE"%d"CL_RESET"' Mobs Not Cached\n",
+ npc_id - START_NPC_NUM, npc_warp, npc_shop, npc_script, npc_mob, npc_cache_mob, npc_delay_mob);
}
- ShowInfo ("Done loading '"CL_WHITE"%d"CL_RESET"' NPCs:"CL_CLL"\n"
- "\t-'"CL_WHITE"%d"CL_RESET"' Warps\n"
- "\t-'"CL_WHITE"%d"CL_RESET"' Shops\n"
- "\t-'"CL_WHITE"%d"CL_RESET"' Scripts\n"
- "\t-'"CL_WHITE"%d"CL_RESET"' Spawn sets\n"
- "\t-'"CL_WHITE"%d"CL_RESET"' Mobs Cached\n"
- "\t-'"CL_WHITE"%d"CL_RESET"' Mobs Not Cached\n",
- npc_id - START_NPC_NUM, npc_warp, npc_shop, npc_script, npc_mob, npc_cache_mob, npc_delay_mob);
itemdb->name_constants();
+
+ if (!minimal) {
+ map->zone_init();
- map->zone_init();
-
- npc->motd = npc->name2id("HerculesMOTD"); /* [Ind/Hercules] */
+ npc->motd = npc->name2id("HerculesMOTD"); /* [Ind/Hercules] */
- // set up the events cache
- memset(script_event, 0, sizeof(script_event));
- npc->read_event_script();
+ // set up the events cache
+ memset(script_event, 0, sizeof(script_event));
+ npc->read_event_script();
- //Debug function to locate all endless loop warps.
- if (battle_config.warp_point_debug)
- npc->debug_warps();
+ //Debug function to locate all endless loop warps.
+ if (battle_config.warp_point_debug)
+ npc->debug_warps();
- timer->add_func_list(npc->event_do_clock,"npc_event_do_clock");
- timer->add_func_list(npc->timerevent,"npc_timerevent");
+ timer->add_func_list(npc->event_do_clock,"npc_event_do_clock");
+ timer->add_func_list(npc->timerevent,"npc_timerevent");
+ }
// Init dummy NPC
npc->fake_nd = (struct npc_data *)aCalloc(1,sizeof(struct npc_data));
diff --git a/src/map/npc.h b/src/map/npc.h
index 5ec201e55..10f3406b4 100644
--- a/src/map/npc.h
+++ b/src/map/npc.h
@@ -140,7 +140,7 @@ struct npc_interface {
struct npc_src_list *src_files;
struct unit_data base_ud;
/* */
- int (*init) (void);
+ int (*init) (bool minimal);
int (*final) (void);
/* */
int (*get_new_npc_id) (void);
@@ -218,7 +218,7 @@ struct npc_interface {
void (*parse_mob2) (struct spawn_data *mobspawn);
const char* (*parse_mob) (char *w1, char *w2, char *w3, char *w4, const char *start, const char *buffer, const char *filepath);
const char* (*parse_mapflag) (char *w1, char *w2, char *w3, char *w4, const char *start, const char *buffer, const char *filepath);
- void (*parsesrcfile) (const char *filepath, bool runOnInit);
+ int (*parsesrcfile) (const char *filepath, bool runOnInit);
int (*script_event) (struct map_session_data *sd, enum npce_event type);
void (*read_event_script) (void);
int (*path_db_clear_sub) (DBKey key, DBData *data, va_list args);
diff --git a/src/map/packets.h b/src/map/packets.h
index 918f0a10f..55a85e182 100644
--- a/src/map/packets.h
+++ b/src/map/packets.h
@@ -2646,4 +2646,8 @@ packet(0x020d,-1);
packetKeys(0x7E241DE0,0x5E805580,0x3D807D80); /* Thanks to Shakto */
#endif
+#if defined(OBFUSCATIONKEY1) && defined(OBFUSCATIONKEY2) && defined(OBFUSCATIONKEY3)
+ packetKeys(OBFUSCATIONKEY1,OBFUSCATIONKEY2,OBFUSCATIONKEY3);
+#endif
+
#endif /* _PACKETS_H_ */
diff --git a/src/map/party.c b/src/map/party.c
index ab05c23f7..6caf3db23 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -849,7 +849,7 @@ int party_send_xy_timer(int tid, int64 tick, int id, intptr_t data) {
for( i = 0; i < MAX_PARTY; i++ )
{
struct map_session_data* sd = p->data[i].sd;
- if( !sd ) continue;
+ if( !sd || sd->bg_id ) continue;
if( p->data[i].x != sd->bl.x || p->data[i].y != sd->bl.y )
{// perform position update
@@ -1306,7 +1306,10 @@ void do_final_party(void) {
db_destroy(party->booking_db); // Party Booking [Spiria]
}
// Constructor, init vars
-void do_init_party(void) {
+void do_init_party(bool minimal) {
+ if (minimal)
+ return;
+
party->db = idb_alloc(DB_OPT_RELEASE_DATA);
party->booking_db = idb_alloc(DB_OPT_RELEASE_DATA); // Party Booking [Spiria]
timer->add_func_list(party->send_xy_timer, "party_send_xy_timer");
diff --git a/src/map/party.h b/src/map/party.h
index ab14d1a31..91f4c1b7d 100644
--- a/src/map/party.h
+++ b/src/map/party.h
@@ -73,7 +73,7 @@ struct party_interface {
DBMap* booking_db; // int char_id -> struct party_booking_ad_info* (releases data) // Party Booking [Spiria]
unsigned long booking_nextid;
/* funcs */
- void (*init) (void);
+ void (*init) (bool minimal);
void (*final) (void);
/* */
struct party_data* (*search) (int party_id);
diff --git a/src/map/pc.c b/src/map/pc.c
index 2f4682413..4747cf498 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -72,7 +72,7 @@ struct map_session_data* pc_get_dummy_sd(void)
{
struct map_session_data *dummy_sd;
CREATE(dummy_sd, struct map_session_data, 1);
- dummy_sd->group = pc_group_get_dummy_group(); // map_session_data.group is expected to be non-NULL at all times
+ dummy_sd->group = pcg->get_dummy_group(); // map_session_data.group is expected to be non-NULL at all times
return dummy_sd;
}
@@ -82,7 +82,7 @@ struct map_session_data* pc_get_dummy_sd(void)
*/
int pc_get_group_level(struct map_session_data *sd)
{
- return pc_group_get_level(sd->group);
+ return pcg->get_level(sd->group);
}
/**
@@ -93,7 +93,7 @@ int pc_get_group_level(struct map_session_data *sd)
*/
int pc_set_group(struct map_session_data *sd, int group_id)
{
- GroupSettings *group = pc_group_id2group(group_id);
+ GroupSettings *group = pcg->id2group(group_id);
if (group == NULL)
return 1;
sd->group_id = group_id;
@@ -104,9 +104,9 @@ int pc_set_group(struct map_session_data *sd, int group_id)
/**
* Checks if player has permission to perform action.
*/
-bool pc_has_permission(struct map_session_data *sd, enum e_pc_permission permission)
+bool pc_has_permission(struct map_session_data *sd, unsigned int permission)
{
- return ((sd->extra_temp_permissions&permission) != 0 || pc_group_has_permission(sd->group, permission));
+ return ((sd->extra_temp_permissions&permission) != 0 || pcg->has_permission(sd->group, permission));
}
/**
@@ -114,7 +114,7 @@ bool pc_has_permission(struct map_session_data *sd, enum e_pc_permission permiss
*/
bool pc_should_log_commands(struct map_session_data *sd)
{
- return pc_group_should_log_commands(sd->group);
+ return pcg->should_log_commands(sd->group);
}
int pc_invincible_timer(int tid, int64 tick, int id, intptr_t data) {
@@ -1320,7 +1320,7 @@ int pc_reg_received(struct map_session_data *sd)
pc->load_combo(sd);
- status_calc_pc(sd,1);
+ status_calc_pc(sd,SCO_FIRST|SCO_FORCE);
chrif->scdata_request(sd->status.account_id, sd->status.char_id);
intif->Mail_requestinbox(sd->status.char_id, 0); // MAIL SYSTEM - Request Mail Inbox
@@ -2028,7 +2028,7 @@ int pc_exeautobonus(struct map_session_data *sd,struct s_autobonus *autobonus)
autobonus->active = timer->add(timer->gettick()+autobonus->duration, pc->endautobonus, sd->bl.id, (intptr_t)autobonus);
sd->state.autobonus |= autobonus->pos;
- status_calc_pc(sd,0);
+ status_calc_pc(sd,SCO_NONE);
return 0;
}
@@ -2042,7 +2042,7 @@ int pc_endautobonus(int tid, int64 tick, int id, intptr_t data) {
autobonus->active = INVALID_TIMER;
sd->state.autobonus &= ~autobonus->pos;
- status_calc_pc(sd,0);
+ status_calc_pc(sd,SCO_NONE);
return 0;
}
@@ -3549,7 +3549,7 @@ int pc_skill(TBL_PC* sd, int id, int level, int flag) {
} else
clif->addskill(sd,id);
if( !skill->db[index].inf ) //Only recalculate for passive skills.
- status_calc_pc(sd, 0);
+ status_calc_pc(sd, SCO_NONE);
break;
case 1: //Item bonus skill.
if( sd->status.skill[index].id == id ) {
@@ -3583,7 +3583,7 @@ int pc_skill(TBL_PC* sd, int id, int level, int flag) {
} else
clif->addskill(sd,id);
if( !skill->db[index].inf ) //Only recalculate for passive skills.
- status_calc_pc(sd, 0);
+ status_calc_pc(sd, SCO_NONE);
break;
default: //Unknown flag?
return 0;
@@ -5789,13 +5789,13 @@ int pc_checkbaselevelup(struct map_session_data *sd) {
} while ((next=pc->nextbaseexp(sd)) > 0 && sd->status.base_exp >= next);
if (battle_config.pet_lv_rate && sd->pd) //<Skotlex> update pet's level
- status_calc_pet(sd->pd,0);
+ status_calc_pet(sd->pd,SCO_NONE);
clif->updatestatus(sd,SP_STATUSPOINT);
clif->updatestatus(sd,SP_BASELEVEL);
clif->updatestatus(sd,SP_BASEEXP);
clif->updatestatus(sd,SP_NEXTBASEEXP);
- status_calc_pc(sd,0);
+ status_calc_pc(sd,SCO_FORCE);
status_percent_heal(&sd->bl,100,100);
if((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE) {
@@ -5855,7 +5855,7 @@ int pc_checkjoblevelup(struct map_session_data *sd)
clif->updatestatus(sd,SP_JOBEXP);
clif->updatestatus(sd,SP_NEXTJOBEXP);
clif->updatestatus(sd,SP_SKILLPOINT);
- status_calc_pc(sd,0);
+ status_calc_pc(sd,SCO_FORCE);
clif->misceffect(&sd->bl,1);
if (pc->checkskill(sd, SG_DEVIL) && !pc->nextjobexp(sd))
clif->status_change(&sd->bl,SI_DEVIL1, 1, 0, 0, 0, 1); //Permanent blind effect from SG_DEVIL.
@@ -5881,9 +5881,6 @@ void pc_calcexp(struct map_session_data *sd, unsigned int *base_exp, unsigned in
if (sd->sc.data[SC_CASH_PLUSEXP])
bonus += sd->sc.data[SC_CASH_PLUSEXP]->val1;
-
- if( sd->status.mod_exp != 100 )
- bonus += sd->status.mod_exp - 100;
*base_exp = (unsigned int) cap_value(*base_exp + (double)*base_exp * bonus/100., 1, UINT_MAX);
@@ -6146,7 +6143,7 @@ int pc_statusup(struct map_session_data* sd, int type)
val = pc->setstat(sd, type, pc->getstat(sd,type) + 1);
sd->status.status_point -= need;
- status_calc_pc(sd,0);
+ status_calc_pc(sd,SCO_NONE);
// update increase cost indicator
if( need != pc->need_status_point(sd,type,1) )
@@ -6186,7 +6183,7 @@ int pc_statusup2(struct map_session_data* sd, int type, int val)
max = pc_maxparameter(sd);
val = pc->setstat(sd, type, cap_value(pc->getstat(sd,type) + val, 1, max));
- status_calc_pc(sd,0);
+ status_calc_pc(sd,SCO_NONE);
// update increase cost indicator
if( need != pc->need_status_point(sd,type,1) )
@@ -6229,7 +6226,7 @@ int pc_skillup(struct map_session_data *sd,uint16 skill_id) {
sd->status.skill[index].lv++;
sd->status.skill_point--;
if( !skill->db[index].inf )
- status_calc_pc(sd,0); // Only recalculate for passive skills.
+ status_calc_pc(sd,SCO_NONE); // Only recalculate for passive skills.
else if( sd->status.skill_point == 0 && (sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc->famerank(sd->status.char_id, MAPID_TAEKWON) )
pc->calc_skilltree(sd); // Required to grant all TK Ranger skills.
else
@@ -6302,7 +6299,7 @@ int pc_allskillup(struct map_session_data *sd)
sd->status.skill[idx].lv = skill->tree_get_max(id, sd->status.class_); // celest
}
}
- status_calc_pc(sd,0);
+ status_calc_pc(sd,SCO_NONE);
//Required because if you could level up all skills previously,
//the update will not be sent as only the lv variable changes.
clif->skillinfoblock(sd);
@@ -6392,7 +6389,7 @@ int pc_resetlvl(struct map_session_data* sd,int type)
if ((type == 1 || type == 2 || type == 3) && sd->status.party_id)
party->send_levelup(sd);
- status_calc_pc(sd,0);
+ status_calc_pc(sd,SCO_FORCE);
clif->skillinfoblock(sd);
return 0;
@@ -6457,7 +6454,7 @@ int pc_resetstate(struct map_session_data* sd)
pc_setglobalreg(sd,"TK_MISSION_ID", 0);
}
- status_calc_pc(sd,0);
+ status_calc_pc(sd,SCO_NONE);
return 1;
}
@@ -6568,7 +6565,7 @@ int pc_resetskill(struct map_session_data* sd, int flag)
if( flag&1 ) {
clif->updatestatus(sd,SP_SKILLPOINT);
clif->skillinfoblock(sd);
- status_calc_pc(sd,0);
+ status_calc_pc(sd,SCO_FORCE);
}
return skill_point;
@@ -6822,7 +6819,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
) { // monster level up [Valaris]
clif->misceffect(&md->bl,0);
md->level++;
- status_calc_mob(md, 0);
+ status_calc_mob(md, SCO_NONE);
status_percent_heal(src,10,0);
if( battle_config.show_mob_info&4 )
@@ -6918,9 +6915,8 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
&& !map->list[sd->bl.m].flag.noexppenalty && !map_flag_gvg2(sd->bl.m)
&& !sd->sc.data[SC_BABY] && !sd->sc.data[SC_CASH_DEATHPENALTY]
) {
- unsigned int base_penalty = 0;
+ unsigned int base_penalty =0;
if (battle_config.death_penalty_base > 0) {
-
switch (battle_config.death_penalty_type) {
case 1:
base_penalty = (unsigned int) ((double)pc->nextbaseexp(sd) * (double)battle_config.death_penalty_base/10000);
@@ -6929,20 +6925,16 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
base_penalty = (unsigned int) ((double)sd->status.base_exp * (double)battle_config.death_penalty_base/10000);
break;
}
-
if(base_penalty) {
if (battle_config.pk_mode && src && src->type==BL_PC)
base_penalty*=2;
- if( sd->status.mod_death != 100 )
- base_penalty = base_penalty * sd->status.mod_death / 100;
sd->status.base_exp -= min(sd->status.base_exp, base_penalty);
clif->updatestatus(sd,SP_BASEEXP);
}
}
-
- if(battle_config.death_penalty_job > 0) {
+ if(battle_config.death_penalty_job > 0)
+ {
base_penalty = 0;
-
switch (battle_config.death_penalty_type) {
case 1:
base_penalty = (unsigned int) ((double)pc->nextjobexp(sd) * (double)battle_config.death_penalty_job/10000);
@@ -6951,18 +6943,15 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
base_penalty = (unsigned int) ((double)sd->status.job_exp * (double)battle_config.death_penalty_job/10000);
break;
}
-
if(base_penalty) {
if (battle_config.pk_mode && src && src->type==BL_PC)
base_penalty*=2;
- if( sd->status.mod_death != 100 )
- base_penalty = base_penalty * sd->status.mod_death / 100;
sd->status.job_exp -= min(sd->status.job_exp, base_penalty);
clif->updatestatus(sd,SP_JOBEXP);
}
}
-
- if(battle_config.zeny_penalty > 0 && !map->list[sd->bl.m].flag.nozenypenalty) {
+ if(battle_config.zeny_penalty > 0 && !map->list[sd->bl.m].flag.nozenypenalty)
+ {
base_penalty = (unsigned int)((double)sd->status.zeny * (double)battle_config.zeny_penalty / 10000.);
if(base_penalty)
pc->payzeny(sd, base_penalty, LOG_TYPE_PICKDROP_PLAYER, NULL);
@@ -7114,9 +7103,6 @@ int pc_readparam(struct map_session_data* sd,int type)
case SP_KILLEDRID: val = sd->killedrid; break;
case SP_SLOTCHANGE: val = sd->status.slotchange; break;
case SP_CHARRENAME: val = sd->status.rename; break;
- case SP_MOD_EXP: val = sd->status.mod_exp; break;
- case SP_MOD_DROP: val = sd->status.mod_drop; break;
- case SP_MOD_DEATH: val = sd->status.mod_death; break;
case SP_CRITICAL: val = sd->battle_status.cri/10; break;
case SP_ASPD: val = (2000-sd->battle_status.amotion)/10; break;
case SP_BASE_ATK: val = sd->battle_status.batk; break;
@@ -7234,148 +7220,139 @@ int pc_setparam(struct map_session_data *sd,int type,int val)
nullpo_ret(sd);
switch(type){
- case SP_BASELEVEL:
- if ((unsigned int)val > pc->maxbaselv(sd)) //Capping to max
- val = pc->maxbaselv(sd);
- if ((unsigned int)val > sd->status.base_level) {
- int stat=0;
- for (i = 0; i < (int)((unsigned int)val - sd->status.base_level); i++)
- stat += pc->gets_status_point(sd->status.base_level + i);
- sd->status.status_point += stat;
- }
- sd->status.base_level = (unsigned int)val;
- sd->status.base_exp = 0;
- // clif->updatestatus(sd, SP_BASELEVEL); // Gets updated at the bottom
- clif->updatestatus(sd, SP_NEXTBASEEXP);
- clif->updatestatus(sd, SP_STATUSPOINT);
- clif->updatestatus(sd, SP_BASEEXP);
- status_calc_pc(sd, 0);
- if(sd->status.party_id)
- {
- party->send_levelup(sd);
- }
- break;
- case SP_JOBLEVEL:
- if ((unsigned int)val >= sd->status.job_level) {
- if ((unsigned int)val > pc->maxjoblv(sd)) val = pc->maxjoblv(sd);
- sd->status.skill_point += val - sd->status.job_level;
- clif->updatestatus(sd, SP_SKILLPOINT);
- }
- sd->status.job_level = (unsigned int)val;
- sd->status.job_exp = 0;
- // clif->updatestatus(sd, SP_JOBLEVEL); // Gets updated at the bottom
- clif->updatestatus(sd, SP_NEXTJOBEXP);
- clif->updatestatus(sd, SP_JOBEXP);
- status_calc_pc(sd, 0);
- break;
- case SP_SKILLPOINT:
- sd->status.skill_point = val;
- break;
- case SP_STATUSPOINT:
- sd->status.status_point = val;
- break;
- case SP_ZENY:
- if( val < 0 )
- return 0;// can't set negative zeny
- logs->zeny(sd, LOG_TYPE_SCRIPT, sd, -(sd->status.zeny - cap_value(val, 0, MAX_ZENY)));
- sd->status.zeny = cap_value(val, 0, MAX_ZENY);
- break;
- case SP_BASEEXP:
- if(pc->nextbaseexp(sd) > 0) {
- sd->status.base_exp = val;
- pc->checkbaselevelup(sd);
- }
- break;
- case SP_JOBEXP:
- if(pc->nextjobexp(sd) > 0) {
- sd->status.job_exp = val;
- pc->checkjoblevelup(sd);
- }
- break;
- case SP_SEX:
- sd->status.sex = val ? SEX_MALE : SEX_FEMALE;
- break;
- case SP_WEIGHT:
- sd->weight = val;
- break;
- case SP_MAXWEIGHT:
- sd->max_weight = val;
- break;
- case SP_HP:
- sd->battle_status.hp = cap_value(val, 1, (int)sd->battle_status.max_hp);
- break;
- case SP_MAXHP:
- sd->battle_status.max_hp = cap_value(val, 1, battle_config.max_hp);
+ case SP_BASELEVEL:
+ if ((unsigned int)val > pc->maxbaselv(sd)) //Capping to max
+ val = pc->maxbaselv(sd);
+ if ((unsigned int)val > sd->status.base_level) {
+ int stat=0;
+ for (i = 0; i < (int)((unsigned int)val - sd->status.base_level); i++)
+ stat += pc->gets_status_point(sd->status.base_level + i);
+ sd->status.status_point += stat;
+ }
+ sd->status.base_level = (unsigned int)val;
+ sd->status.base_exp = 0;
+ // clif->updatestatus(sd, SP_BASELEVEL); // Gets updated at the bottom
+ clif->updatestatus(sd, SP_NEXTBASEEXP);
+ clif->updatestatus(sd, SP_STATUSPOINT);
+ clif->updatestatus(sd, SP_BASEEXP);
+ status_calc_pc(sd, SCO_FORCE);
+ if(sd->status.party_id)
+ {
+ party->send_levelup(sd);
+ }
+ break;
+ case SP_JOBLEVEL:
+ if ((unsigned int)val >= sd->status.job_level) {
+ if ((unsigned int)val > pc->maxjoblv(sd)) val = pc->maxjoblv(sd);
+ sd->status.skill_point += val - sd->status.job_level;
+ clif->updatestatus(sd, SP_SKILLPOINT);
+ }
+ sd->status.job_level = (unsigned int)val;
+ sd->status.job_exp = 0;
+ // clif->updatestatus(sd, SP_JOBLEVEL); // Gets updated at the bottom
+ clif->updatestatus(sd, SP_NEXTJOBEXP);
+ clif->updatestatus(sd, SP_JOBEXP);
+ status_calc_pc(sd, SCO_FORCE);
+ break;
+ case SP_SKILLPOINT:
+ sd->status.skill_point = val;
+ break;
+ case SP_STATUSPOINT:
+ sd->status.status_point = val;
+ break;
+ case SP_ZENY:
+ if( val < 0 )
+ return 0;// can't set negative zeny
+ logs->zeny(sd, LOG_TYPE_SCRIPT, sd, -(sd->status.zeny - cap_value(val, 0, MAX_ZENY)));
+ sd->status.zeny = cap_value(val, 0, MAX_ZENY);
+ break;
+ case SP_BASEEXP:
+ if(pc->nextbaseexp(sd) > 0) {
+ sd->status.base_exp = val;
+ pc->checkbaselevelup(sd);
+ }
+ break;
+ case SP_JOBEXP:
+ if(pc->nextjobexp(sd) > 0) {
+ sd->status.job_exp = val;
+ pc->checkjoblevelup(sd);
+ }
+ break;
+ case SP_SEX:
+ sd->status.sex = val ? SEX_MALE : SEX_FEMALE;
+ break;
+ case SP_WEIGHT:
+ sd->weight = val;
+ break;
+ case SP_MAXWEIGHT:
+ sd->max_weight = val;
+ break;
+ case SP_HP:
+ sd->battle_status.hp = cap_value(val, 1, (int)sd->battle_status.max_hp);
+ break;
+ case SP_MAXHP:
+ sd->battle_status.max_hp = cap_value(val, 1, battle_config.max_hp);
- if( sd->battle_status.max_hp < sd->battle_status.hp )
- {
- sd->battle_status.hp = sd->battle_status.max_hp;
- clif->updatestatus(sd, SP_HP);
- }
- break;
- case SP_SP:
- sd->battle_status.sp = cap_value(val, 0, (int)sd->battle_status.max_sp);
- break;
- case SP_MAXSP:
- sd->battle_status.max_sp = cap_value(val, 1, battle_config.max_sp);
+ if( sd->battle_status.max_hp < sd->battle_status.hp )
+ {
+ sd->battle_status.hp = sd->battle_status.max_hp;
+ clif->updatestatus(sd, SP_HP);
+ }
+ break;
+ case SP_SP:
+ sd->battle_status.sp = cap_value(val, 0, (int)sd->battle_status.max_sp);
+ break;
+ case SP_MAXSP:
+ sd->battle_status.max_sp = cap_value(val, 1, battle_config.max_sp);
- if( sd->battle_status.max_sp < sd->battle_status.sp )
- {
- sd->battle_status.sp = sd->battle_status.max_sp;
- clif->updatestatus(sd, SP_SP);
- }
- break;
- case SP_STR:
- sd->status.str = cap_value(val, 1, pc_maxparameter(sd));
- break;
- case SP_AGI:
- sd->status.agi = cap_value(val, 1, pc_maxparameter(sd));
- break;
- case SP_VIT:
- sd->status.vit = cap_value(val, 1, pc_maxparameter(sd));
- break;
- case SP_INT:
- sd->status.int_ = cap_value(val, 1, pc_maxparameter(sd));
- break;
- case SP_DEX:
- sd->status.dex = cap_value(val, 1, pc_maxparameter(sd));
- break;
- case SP_LUK:
- sd->status.luk = cap_value(val, 1, pc_maxparameter(sd));
- break;
- case SP_KARMA:
- sd->status.karma = val;
- break;
- case SP_MANNER:
- sd->status.manner = val;
- break;
- case SP_FAME:
- sd->status.fame = val;
- break;
- case SP_KILLERRID:
- sd->killerrid = val;
- return 1;
- case SP_KILLEDRID:
- sd->killedrid = val;
- return 1;
- case SP_SLOTCHANGE:
- sd->status.slotchange = val;
- return 1;
- case SP_CHARRENAME:
- sd->status.rename = val;
- return 1;
- case SP_MOD_EXP:
- sd->status.mod_exp = val;
- return 1;
- case SP_MOD_DROP:
- sd->status.mod_drop = val;
- return 1;
- case SP_MOD_DEATH:
- sd->status.mod_death = val;
- return 1;
- default:
- ShowError("pc_setparam: Attempted to set unknown parameter '%d'.\n", type);
- return 0;
+ if( sd->battle_status.max_sp < sd->battle_status.sp )
+ {
+ sd->battle_status.sp = sd->battle_status.max_sp;
+ clif->updatestatus(sd, SP_SP);
+ }
+ break;
+ case SP_STR:
+ sd->status.str = cap_value(val, 1, pc_maxparameter(sd));
+ break;
+ case SP_AGI:
+ sd->status.agi = cap_value(val, 1, pc_maxparameter(sd));
+ break;
+ case SP_VIT:
+ sd->status.vit = cap_value(val, 1, pc_maxparameter(sd));
+ break;
+ case SP_INT:
+ sd->status.int_ = cap_value(val, 1, pc_maxparameter(sd));
+ break;
+ case SP_DEX:
+ sd->status.dex = cap_value(val, 1, pc_maxparameter(sd));
+ break;
+ case SP_LUK:
+ sd->status.luk = cap_value(val, 1, pc_maxparameter(sd));
+ break;
+ case SP_KARMA:
+ sd->status.karma = val;
+ break;
+ case SP_MANNER:
+ sd->status.manner = val;
+ break;
+ case SP_FAME:
+ sd->status.fame = val;
+ break;
+ case SP_KILLERRID:
+ sd->killerrid = val;
+ return 1;
+ case SP_KILLEDRID:
+ sd->killedrid = val;
+ return 1;
+ case SP_SLOTCHANGE:
+ sd->status.slotchange = val;
+ return 1;
+ case SP_CHARRENAME:
+ sd->status.rename = val;
+ return 1;
+ default:
+ ShowError("pc_setparam: Attempted to set unknown parameter '%d'.\n", type);
+ return 0;
}
clif->updatestatus(sd,type);
@@ -7685,7 +7662,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
if(sd->status.manner < 0)
clif->changestatus(sd,SP_MANNER,sd->status.manner);
- status_calc_pc(sd,0);
+ status_calc_pc(sd,SCO_FORCE);
pc->checkallowskill(sd);
pc->equiplookall(sd);
@@ -7808,11 +7785,11 @@ int pc_setoption(struct map_session_data *sd,int type)
if( (type&OPTION_RIDING && !(p_type&OPTION_RIDING)) || (type&OPTION_DRAGON && !(p_type&OPTION_DRAGON) && pc->checkskill(sd,RK_DRAGONTRAINING) > 0) ) {
// Mounting
clif->sc_load(&sd->bl,sd->bl.id,AREA,SI_RIDING, 0, 0, 0);
- status_calc_pc(sd,0);
+ status_calc_pc(sd,SCO_NONE);
} else if( (!(type&OPTION_RIDING) && p_type&OPTION_RIDING) || (!(type&OPTION_DRAGON) && p_type&OPTION_DRAGON) ) {
// Dismount
clif->sc_end(&sd->bl,sd->bl.id,AREA,SI_RIDING);
- status_calc_pc(sd,0);
+ status_calc_pc(sd,SCO_NONE);
}
#ifndef NEW_CARTS
@@ -7820,11 +7797,11 @@ int pc_setoption(struct map_session_data *sd,int type)
clif->cartlist(sd);
clif->updatestatus(sd, SP_CARTINFO);
if(pc->checkskill(sd, MC_PUSHCART) < 10)
- status_calc_pc(sd,0); //Apply speed penalty.
+ status_calc_pc(sd,SCO_NONE); //Apply speed penalty.
} else if( !( type&OPTION_CART ) && p_type&OPTION_CART ){ //Cart Off
clif->clearcart(sd->fd);
if(pc->checkskill(sd, MC_PUSHCART) < 10)
- status_calc_pc(sd,0); //Remove speed penalty.
+ status_calc_pc(sd,SCO_NONE); //Remove speed penalty.
}
#endif
@@ -7836,18 +7813,18 @@ int pc_setoption(struct map_session_data *sd,int type)
if( (sd->class_&MAPID_THIRDMASK) == MAPID_RANGER ) {
if( type&OPTION_WUGRIDER && !(p_type&OPTION_WUGRIDER) ) { // Mounting
clif->sc_load(&sd->bl,sd->bl.id,AREA,SI_WUGRIDER, 0, 0, 0);
- status_calc_pc(sd,0);
+ status_calc_pc(sd,SCO_NONE);
} else if( !(type&OPTION_WUGRIDER) && p_type&OPTION_WUGRIDER ) { // Dismount
clif->sc_end(&sd->bl,sd->bl.id,AREA,SI_WUGRIDER);
- status_calc_pc(sd,0);
+ status_calc_pc(sd,SCO_NONE);
}
}
if( (sd->class_&MAPID_THIRDMASK) == MAPID_MECHANIC ) {
int i;
if( type&OPTION_MADOGEAR && !(p_type&OPTION_MADOGEAR) )
- status_calc_pc(sd, 0);
+ status_calc_pc(sd, SCO_NONE);
else if( !(type&OPTION_MADOGEAR) && p_type&OPTION_MADOGEAR )
- status_calc_pc(sd, 0);
+ status_calc_pc(sd, SCO_NONE);
for( i = 0; i < SC_MAX; i++ ){
if ( !sd->sc.data[i] || !status->get_sc_type(i) )
continue;
@@ -7926,7 +7903,7 @@ int pc_setcart(struct map_session_data *sd,int type) {
}
if(pc->checkskill(sd, MC_PUSHCART) < 10)
- status_calc_pc(sd,0); //Recalc speed penalty.
+ status_calc_pc(sd,SCO_NONE); //Recalc speed penalty.
#else
// Update option
option = sd->sc.option;
@@ -8178,7 +8155,7 @@ int pc_setregistry(struct map_session_data *sd,const char *reg,int val,int type)
i = (!sd->die_counter && (sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE);
sd->die_counter = val;
if( i )
- status_calc_pc(sd,0); // Lost the bonus.
+ status_calc_pc(sd,SCO_NONE); // Lost the bonus.
}
else if( !strcmp(reg,"COOK_MASTERY") && sd->cook_mastery != val )
{
@@ -8782,7 +8759,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos)
}
}
- status_calc_pc(sd,0);
+ status_calc_pc(sd,SCO_NONE);
if (flag) //Update skill data
clif->skillinfoblock(sd);
@@ -8947,7 +8924,7 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) {
if(flag&1 || status_cacl) {
pc->checkallowskill(sd);
- status_calc_pc(sd,0);
+ status_calc_pc(sd,SCO_NONE);
}
if(sd->sc.data[SC_CRUCIS] && !battle->check_undead(sd->battle_status.race,sd->battle_status.def_ele))
@@ -9052,7 +9029,7 @@ int pc_checkitem(struct map_session_data *sd)
if( calc_flag && sd->state.active ) {
pc->checkallowskill(sd);
- status_calc_pc(sd,0);
+ status_calc_pc(sd,SCO_NONE);
}
return 0;
@@ -9437,10 +9414,16 @@ void pc_overheat(struct map_session_data *sd, int val) {
*/
bool pc_isautolooting(struct map_session_data *sd, int nameid)
{
- int i;
- if( !sd->state.autolooting )
+ int i = 0;
+
+ if (sd->state.autoloottype && sd->state.autoloottype&(1<<itemdb_type(nameid)))
+ return true;
+
+ if (!sd->state.autolooting)
return false;
+
ARR_FIND(0, AUTOLOOTITEM_SIZE, i, sd->state.autolootid[i] == nameid);
+
return (i != AUTOLOOTITEM_SIZE);
}
@@ -10217,7 +10200,6 @@ void pc_bank_withdraw(struct map_session_data *sd, int money) {
/* status change data arrived from char-server */
void pc_scdata_received(struct map_session_data *sd) {
pc->inventory_rentals(sd);
- clif->show_modifiers(sd);
}
/*==========================================
@@ -10227,13 +10209,15 @@ void do_final_pc(void) {
db_destroy(pc->itemcd_db);
- do_final_pc_groups();
+ pcg->final();
ers_destroy(pc->sc_display_ers);
return;
}
-void do_init_pc(void) {
+void do_init_pc(bool minimal) {
+ if (minimal)
+ return;
pc->itemcd_db = idb_alloc(DB_OPT_RELEASE_DATA);
@@ -10265,7 +10249,7 @@ void do_init_pc(void) {
pc->night_timer_tid = timer->add_interval(timer->gettick() + day_duration + (map->night_flag ? night_duration : 0), pc->map_night_timer, 0, 0, day_duration + night_duration);
}
- do_init_pc_groups();
+ pcg->init();
pc->sc_display_ers = ers_new(sizeof(struct sc_display_entry), "pc.c:sc_display_ers", ERS_OPT_NONE);
}
@@ -10281,7 +10265,7 @@ void pc_defaults(void) {
{ SG_MOON_ANGER, SG_MOON_BLESS, SG_MOON_COMFORT, "PC_FEEL_MOON", "PC_HATE_MOB_MOON", is_day_of_moon },
{ SG_STAR_ANGER, SG_STAR_BLESS, SG_STAR_COMFORT, "PC_FEEL_STAR", "PC_HATE_MOB_STAR", is_day_of_star }
};
- unsigned short equip_pos[EQI_MAX]={EQP_ACC_L,EQP_ACC_R,EQP_SHOES,EQP_GARMENT,EQP_HEAD_LOW,EQP_HEAD_MID,EQP_HEAD_TOP,EQP_ARMOR,EQP_HAND_L,EQP_HAND_R,EQP_COSTUME_HEAD_TOP,EQP_COSTUME_HEAD_MID,EQP_COSTUME_HEAD_LOW,EQP_COSTUME_GARMENT,EQP_AMMO};
+ unsigned int equip_pos[EQI_MAX]={EQP_ACC_L,EQP_ACC_R,EQP_SHOES,EQP_GARMENT,EQP_HEAD_LOW,EQP_HEAD_MID,EQP_HEAD_TOP,EQP_ARMOR,EQP_HAND_L,EQP_HAND_R,EQP_COSTUME_HEAD_TOP,EQP_COSTUME_HEAD_MID,EQP_COSTUME_HEAD_LOW,EQP_COSTUME_GARMENT,EQP_AMMO, EQP_SHADOW_ARMOR, EQP_SHADOW_WEAPON, EQP_SHADOW_SHIELD, EQP_SHADOW_SHOES, EQP_SHADOW_ACC_R, EQP_SHADOW_ACC_L };
pc = &pc_s;
diff --git a/src/map/pc.h b/src/map/pc.h
index fc37d0ef2..af03aa2f3 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -166,6 +166,7 @@ struct map_session_data {
short pmap; // Previous map on Map Change
unsigned short autoloot;
unsigned short autolootid[AUTOLOOTITEM_SIZE]; // [Zephyrus]
+ unsigned short autoloottype;
unsigned int autolooting : 1; //performance-saver, autolooting state for @alootid
unsigned short autobonus; //flag to indicate if an autobonus is activated. [Inkfish]
unsigned int gmaster_flag : 1;
@@ -731,7 +732,7 @@ struct pc_interface {
#if defined(RENEWAL_DROP) || defined(RENEWAL_EXP)
unsigned int level_penalty[3][RC_MAX][MAX_LEVEL*2+1];
#endif
- unsigned short equip_pos[EQI_MAX];
+ unsigned int equip_pos[EQI_MAX];
/* */
struct skill_tree_entry skill_tree[CLASS_COUNT][MAX_SKILL_TREE];
struct fame_list smith_fame_list[MAX_FAME_LIST];
@@ -741,7 +742,7 @@ struct pc_interface {
/* */
struct eri *sc_display_ers;
/* funcs */
- void (*init) (void);
+ void (*init) (bool minimal);
void (*final) (void);
struct map_session_data* (*get_dummy_sd) (void);
@@ -751,7 +752,7 @@ struct pc_interface {
bool (*can_give_items) (struct map_session_data *sd);
bool (*can_use_command) (struct map_session_data *sd, const char *command);
- bool (*has_permission) (struct map_session_data *sd, enum e_pc_permission permission);
+ bool (*has_permission) (struct map_session_data *sd, unsigned int permission);
int (*set_group) (struct map_session_data *sd, int group_id);
bool (*should_log_commands) (struct map_session_data *sd);
diff --git a/src/map/pc_groups.c b/src/map/pc_groups.c
index be02b5f15..78d111b1c 100644
--- a/src/map/pc_groups.c
+++ b/src/map/pc_groups.c
@@ -16,52 +16,10 @@
#include "map.h" // mapiterator
#include "pc.h" // pc->set_group()
-// Cached config settings for quick lookup
-struct GroupSettings {
- unsigned int id; // groups.[].id
- int level; // groups.[].level
- char *name; // copy of groups.[].name
- unsigned int e_permissions; // packed groups.[].permissions
- bool log_commands; // groups.[].log_commands
- int index; // internal index of the group (contiguous range starting at 0) [Ind]
- /// Following are used/available only during config reading
- config_setting_t *commands; // groups.[].commands
- config_setting_t *permissions; // groups.[].permissions
- config_setting_t *inherit; // groups.[].inherit
- bool inheritance_done; // have all inheritance rules been evaluated?
- config_setting_t *root; // groups.[]
-};
-
-const struct pc_permission_name_table pc_g_permission_name[NUM_PC_PERM] = {
- { "can_trade", PC_PERM_TRADE },
- { "can_party", PC_PERM_PARTY },
- { "all_skill", PC_PERM_ALL_SKILL },
- { "all_equipment", PC_PERM_USE_ALL_EQUIPMENT },
- { "skill_unconditional", PC_PERM_SKILL_UNCONDITIONAL },
- { "join_chat", PC_PERM_JOIN_ALL_CHAT },
- { "kick_chat", PC_PERM_NO_CHAT_KICK },
- { "hide_session", PC_PERM_HIDE_SESSION },
- { "who_display_aid", PC_PERM_WHO_DISPLAY_AID },
- { "hack_info", PC_PERM_RECEIVE_HACK_INFO },
- { "any_warp", PC_PERM_WARP_ANYWHERE },
- { "view_hpmeter", PC_PERM_VIEW_HPMETER },
- { "view_equipment", PC_PERM_VIEW_EQUIPMENT },
- { "use_check", PC_PERM_USE_CHECK },
- { "use_changemaptype", PC_PERM_USE_CHANGEMAPTYPE },
- { "all_commands", PC_PERM_USE_ALL_COMMANDS },
- { "receive_requests", PC_PERM_RECEIVE_REQUESTS },
- { "show_bossmobs", PC_PERM_SHOW_BOSS },
- { "disable_pvm", PC_PERM_DISABLE_PVM },
- { "disable_pvp", PC_PERM_DISABLE_PVP },
- { "disable_commands_when_dead", PC_PERM_DISABLE_CMD_DEAD },
- { "hchsys_admin", PC_PERM_HCHSYS_ADMIN },
-};
-
-static DBMap* pc_group_db; // id -> GroupSettings
-static DBMap* pc_groupname_db; // name -> GroupSettings
-
static GroupSettings dummy_group; ///< dummy group used in dummy map sessions @see pc_get_dummy_sd()
+struct pc_groups_interface pcg_s;
+
/**
* Returns dummy group.
* Used in dummy map sessions.
@@ -78,7 +36,7 @@ GroupSettings* pc_group_get_dummy_group(void)
*/
static inline GroupSettings* name2group(const char* group_name)
{
- return strdb_get(pc_groupname_db, group_name);
+ return strdb_get(pcg->name_db, group_name);
}
/**
@@ -116,7 +74,7 @@ static void read_config(void) {
continue;
}
- if (pc_group_exists(id)) {
+ if (pcg->exists(id)) {
ShowConfigWarning(group, "pc_groups:read_config: duplicate group id %d, removing...", i);
config_setting_remove_elem(groups, i);
--i;
@@ -162,15 +120,15 @@ static void read_config(void) {
group_settings->root = group;
group_settings->index = i;
- strdb_put(pc_groupname_db, groupname, group_settings);
- idb_put(pc_group_db, id, group_settings);
+ strdb_put(pcg->name_db, groupname, group_settings);
+ idb_put(pcg->db, id, group_settings);
}
group_count = config_setting_length(groups); // Save number of groups
- assert(group_count == db_size(pc_group_db));
+ assert(group_count == db_size(pcg->db));
// Check if all commands and permissions exist
- iter = db_iterator(pc_group_db);
+ iter = db_iterator(pcg->db);
for (group_settings = dbi_first(iter); dbi_exists(iter); group_settings = dbi_next(iter)) {
config_setting_t *commands = group_settings->commands, *permissions = group_settings->permissions;
int count = 0, i;
@@ -201,8 +159,8 @@ static void read_config(void) {
const char *name = config_setting_name(permission);
int j;
- ARR_FIND(0, ARRAYLENGTH(pc_g_permission_name), j, strcmp(pc_g_permission_name[j].name, name) == 0);
- if (j == ARRAYLENGTH(pc_g_permission_name)) {
+ ARR_FIND(0, pcg->permission_count, j, strcmp(pcg->permissions[j].name, name) == 0);
+ if (j == pcg->permission_count) {
ShowConfigWarning(permission, "pc_groups:read_config: non-existent permission name '%s', removing...", name);
config_setting_remove(permissions, name);
--i;
@@ -215,7 +173,7 @@ static void read_config(void) {
// Apply inheritance
i = 0; // counter for processed groups
while (i < group_count) {
- iter = db_iterator(pc_group_db);
+ iter = db_iterator(pcg->db);
for (group_settings = dbi_first(iter); dbi_exists(iter); group_settings = dbi_next(iter)) {
config_setting_t *inherit = NULL,
*commands = group_settings->commands,
@@ -280,7 +238,7 @@ static void read_config(void) {
} // while(i < group_count)
// Pack permissions into GroupSettings.e_permissions for faster checking
- iter = db_iterator(pc_group_db);
+ iter = db_iterator(pcg->db);
for (group_settings = dbi_first(iter); dbi_exists(iter); group_settings = dbi_next(iter)) {
config_setting_t *permissions = group_settings->permissions;
int i, count = config_setting_length(permissions);
@@ -293,8 +251,8 @@ static void read_config(void) {
if (val == 0) // does not have this permission
continue;
- ARR_FIND(0, ARRAYLENGTH(pc_g_permission_name), j, strcmp(pc_g_permission_name[j].name, name) == 0);
- group_settings->e_permissions |= pc_g_permission_name[j].permission;
+ ARR_FIND(0, pcg->permission_count, j, strcmp(pcg->permissions[j].name, name) == 0);
+ group_settings->e_permissions |= pcg->permissions[j].permission;
}
}
dbi_destroy(iter);
@@ -308,7 +266,7 @@ static void read_config(void) {
config_setting_t **commands = NULL;
CREATE(groups, GroupSettings*, group_count);
CREATE(commands, config_setting_t*, group_count);
- iter = db_iterator(pc_group_db);
+ iter = db_iterator(pcg->db);
for (group_settings = dbi_first(iter); dbi_exists(iter); group_settings = dbi_next(iter)) {
groups[i] = group_settings;
commands[i] = group_settings->commands;
@@ -332,7 +290,7 @@ static void read_config(void) {
* @param group group
* @param permission permission to check
*/
-bool pc_group_has_permission(GroupSettings *group, enum e_pc_permission permission)
+bool pc_group_has_permission(GroupSettings *group, unsigned int permission)
{
return ((group->e_permissions&permission) != 0);
}
@@ -353,7 +311,7 @@ bool pc_group_should_log_commands(GroupSettings *group)
*/
bool pc_group_exists(int group_id)
{
- return idb_exists(pc_group_db, group_id);
+ return idb_exists(pcg->db, group_id);
}
/**
@@ -361,7 +319,7 @@ bool pc_group_exists(int group_id)
*/
GroupSettings* pc_group_id2group(int group_id)
{
- return idb_get(pc_group_db, group_id);
+ return idb_get(pcg->db, group_id);
}
/**
@@ -398,13 +356,79 @@ int pc_group_get_idx(GroupSettings *group)
}
/**
+ * Insert a new permission
+ * @return inserted key or 0 upon failure.
+ **/
+unsigned int pc_groups_add_permission(const char *name) {
+ uint64 key = 0x1;
+ unsigned char i;
+
+ for(i = 0; i < pcg->permission_count; i++) {
+ if( strcmpi(name,pcg->permissions[i].name) == 0 ) {
+ ShowError("pc_groups_add_permission(%s): failed! duplicate permission name!\n",name);
+ return 0;
+ }
+ }
+
+ if( i != 0 )
+ key = (uint64)pcg->permissions[i - 1].permission << 1;
+
+ if( key >= UINT_MAX ) {
+ ShowError("pc_groups_add_permission(%s): failed! not enough room, too many permissions!\n",name);
+ return 0;
+ }
+
+ i = pcg->permission_count;
+ RECREATE(pcg->permissions, struct pc_groups_permission_table, ++pcg->permission_count);
+
+ pcg->permissions[i].name = aStrdup(name);
+ pcg->permissions[i].permission = (unsigned int)key;
+
+ return (unsigned int)key;
+}
+/**
* Initialize PC Groups: allocate DBMaps and read config.
* @public
*/
-void do_init_pc_groups(void)
-{
- pc_group_db = idb_alloc(DB_OPT_RELEASE_DATA);
- pc_groupname_db = stridb_alloc(DB_OPT_DUP_KEY, 0);
+void do_init_pc_groups(void) {
+ const struct {
+ const char *name;
+ unsigned int permission;
+ } pc_g_defaults[] = {
+ { "can_trade", PC_PERM_TRADE },
+ { "can_party", PC_PERM_PARTY },
+ { "all_skill", PC_PERM_ALL_SKILL },
+ { "all_equipment", PC_PERM_USE_ALL_EQUIPMENT },
+ { "skill_unconditional", PC_PERM_SKILL_UNCONDITIONAL },
+ { "join_chat", PC_PERM_JOIN_ALL_CHAT },
+ { "kick_chat", PC_PERM_NO_CHAT_KICK },
+ { "hide_session", PC_PERM_HIDE_SESSION },
+ { "who_display_aid", PC_PERM_WHO_DISPLAY_AID },
+ { "hack_info", PC_PERM_RECEIVE_HACK_INFO },
+ { "any_warp", PC_PERM_WARP_ANYWHERE },
+ { "view_hpmeter", PC_PERM_VIEW_HPMETER },
+ { "view_equipment", PC_PERM_VIEW_EQUIPMENT },
+ { "use_check", PC_PERM_USE_CHECK },
+ { "use_changemaptype", PC_PERM_USE_CHANGEMAPTYPE },
+ { "all_commands", PC_PERM_USE_ALL_COMMANDS },
+ { "receive_requests", PC_PERM_RECEIVE_REQUESTS },
+ { "show_bossmobs", PC_PERM_SHOW_BOSS },
+ { "disable_pvm", PC_PERM_DISABLE_PVM },
+ { "disable_pvp", PC_PERM_DISABLE_PVP },
+ { "disable_commands_when_dead", PC_PERM_DISABLE_CMD_DEAD },
+ { "hchsys_admin", PC_PERM_HCHSYS_ADMIN },
+ };
+ unsigned char i, len = ARRAYLENGTH(pc_g_defaults);
+
+ for(i = 0; i < len; i++) {
+ unsigned int p;
+ if( ( p = pcg->add_permission(pc_g_defaults[i].name) ) != pc_g_defaults[i].permission )
+ ShowError("do_init_pc_groups: %s error : %d != %d\n",pc_g_defaults[i].name,p,pc_g_defaults[i].permission);
+ }
+
+ pcg->db = idb_alloc(DB_OPT_RELEASE_DATA);
+ pcg->name_db = stridb_alloc(DB_OPT_DUP_KEY, 0);
+
read_config();
}
@@ -425,10 +449,19 @@ static int group_db_clear_sub(DBKey key, DBData *data, va_list args)
*/
void do_final_pc_groups(void)
{
- if (pc_group_db != NULL)
- pc_group_db->destroy(pc_group_db, group_db_clear_sub);
- if (pc_groupname_db != NULL)
- db_destroy(pc_groupname_db);
+ if (pcg->db != NULL)
+ pcg->db->destroy(pcg->db, group_db_clear_sub);
+ if (pcg->name_db != NULL)
+ db_destroy(pcg->name_db);
+
+ if(pcg->permissions != NULL) {
+ unsigned char i;
+ for(i = 0; i < pcg->permission_count; i++)
+ aFree(pcg->permissions[i].name);
+ aFree(pcg->permissions);
+ pcg->permissions = NULL;
+ }
+ pcg->permission_count = 0;
}
/**
@@ -440,8 +473,8 @@ void pc_groups_reload(void) {
struct map_session_data *sd = NULL;
struct s_mapiterator *iter;
- do_final_pc_groups();
- do_init_pc_groups();
+ pcg->final();
+ pcg->init();
/* refresh online users permissions */
iter = mapit_getallusers();
@@ -454,3 +487,31 @@ void pc_groups_reload(void) {
}
mapit->free(iter);
}
+
+/**
+ * Connect Interface
+ **/
+void pc_groups_defaults(void) {
+ pcg = &pcg_s;
+
+ /* */
+ pcg->db = NULL;
+ pcg->name_db = NULL;
+ /* */
+ pcg->permissions = NULL;
+ pcg->permission_count = 0;
+ /* */
+ pcg->init = do_init_pc_groups;
+ pcg->final = do_final_pc_groups;
+ pcg->reload = pc_groups_reload;
+ /* */
+ pcg->get_dummy_group = pc_group_get_dummy_group;
+ pcg->exists = pc_group_exists;
+ pcg->id2group = pc_group_id2group;
+ pcg->has_permission = pc_group_has_permission;
+ pcg->should_log_commands = pc_group_should_log_commands;
+ pcg->get_name = pc_group_get_name;
+ pcg->get_level = pc_group_get_level;
+ pcg->get_idx = pc_group_get_idx;
+ pcg->add_permission = pc_groups_add_permission;
+}
diff --git a/src/map/pc_groups.h b/src/map/pc_groups.h
index 8f350c2b6..28c82d619 100644
--- a/src/map/pc_groups.h
+++ b/src/map/pc_groups.h
@@ -32,34 +32,54 @@ enum e_pc_permission {
PC_PERM_HCHSYS_ADMIN = 0x200000,
};
-/// Total number of PC permissions (without PC_PERM_NONE).
-/// This is manifest constant for the size of pc_g_permission_name array,
-/// so it's possible to apply sizeof to it [C-FAQ 1.24]
-/// Whenever adding new permission: 1. add enum entry above, 2. add entry into
-/// pc_g_permission_name (in pc.c), 3. increase NUM_PC_PERM below by 1.
-#define NUM_PC_PERM 22
-
-struct pc_permission_name_table {
- const char *name;
- enum e_pc_permission permission;
+// Cached config settings for quick lookup
+struct GroupSettings {
+ unsigned int id; // groups.[].id
+ int level; // groups.[].level
+ char *name; // copy of groups.[].name
+ unsigned int e_permissions; // packed groups.[].permissions
+ bool log_commands; // groups.[].log_commands
+ int index; // internal index of the group (contiguous range starting at 0) [Ind]
+ /// Following are used/available only during config reading
+ config_setting_t *commands; // groups.[].commands
+ config_setting_t *permissions; // groups.[].permissions
+ config_setting_t *inherit; // groups.[].inherit
+ bool inheritance_done; // have all inheritance rules been evaluated?
+ config_setting_t *root; // groups.[]
};
-/// Name <-> enum table for PC permissions
-extern const struct pc_permission_name_table pc_g_permission_name[NUM_PC_PERM];
+struct pc_groups_permission_table {
+ char *name;
+ unsigned int permission;
+};
typedef struct GroupSettings GroupSettings;
-GroupSettings* pc_group_get_dummy_group(void);
-bool pc_group_exists(int group_id);
-GroupSettings* pc_group_id2group(int group_id);
-bool pc_group_has_permission(GroupSettings *group, enum e_pc_permission permission);
-bool pc_group_should_log_commands(GroupSettings *group);
-const char* pc_group_get_name(GroupSettings *group);
-int pc_group_get_level(GroupSettings *group);
-int pc_group_get_idx(GroupSettings *group);
+struct pc_groups_interface {
+ /* */
+ DBMap* db; // id -> GroupSettings
+ DBMap* name_db; // name -> GroupSettings
+ /* */
+ struct pc_groups_permission_table *permissions;
+ unsigned char permission_count;
+ /* */
+ void (*init) (void);
+ void (*final) (void);
+ void (*reload) (void);
+ /* */
+ GroupSettings* (*get_dummy_group) (void);
+ bool (*exists) (int group_id);
+ GroupSettings* (*id2group) (int group_id);
+ bool (*has_permission) (GroupSettings *group, unsigned int permission);
+ bool (*should_log_commands) (GroupSettings *group);
+ const char* (*get_name) (GroupSettings *group);
+ int (*get_level) (GroupSettings *group);
+ int (*get_idx) (GroupSettings *group);
+ unsigned int (*add_permission) (const char *name);
+};
+
+struct pc_groups_interface *pcg;
-void do_init_pc_groups(void);
-void do_final_pc_groups(void);
-void pc_groups_reload(void);
+void pc_groups_defaults(void);
#endif // _PC_GROUPS_H_
diff --git a/src/map/pet.c b/src/map/pet.c
index 7dcf06c02..a2695d3b0 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -65,7 +65,7 @@ void pet_set_intimate(struct pet_data *pd, int value)
pd->pet.intimate = value;
if( (intimate >= battle_config.pet_equip_min_friendly && pd->pet.intimate < battle_config.pet_equip_min_friendly) || (intimate < battle_config.pet_equip_min_friendly && pd->pet.intimate >= battle_config.pet_equip_min_friendly) )
- status_calc_pc(sd,0);
+ status_calc_pc(sd,SCO_NONE);
}
int pet_create_egg(struct map_session_data *sd, int item_id)
@@ -219,7 +219,7 @@ int pet_hungry(int tid, int64 tick, int id, intptr_t data) {
pd->pet.intimate = 0;
pd->status.speed = pd->db->status.speed;
}
- status_calc_pet(pd, 0);
+ status_calc_pet(pd, SCO_NONE);
clif->send_petdata(sd,pd,1,pd->pet.intimate);
}
clif->send_petdata(sd,pd,2,pd->pet.hungry);
@@ -304,7 +304,7 @@ int pet_return_egg(struct map_session_data *sd, struct pet_data *pd)
pd->pet.incuvate = 1;
unit->free(&pd->bl,CLR_OUTSIGHT);
- status_calc_pc(sd,0);
+ status_calc_pc(sd,SCO_NONE);
sd->status.pet_id = 0;
return 1;
@@ -360,14 +360,14 @@ int pet_data_init(struct map_session_data *sd, struct s_pet *petinfo)
pd->bl.y = pd->ud.to_y;
map->addiddb(&pd->bl);
- status_calc_pet(pd,1);
+ status_calc_pet(pd,SCO_FIRST);
pd->last_thinktime = timer->gettick();
pd->state.skillbonus = 0;
if( battle_config.pet_status_support )
script->run(pet->db[i].pet_script,0,sd->bl.id,0);
if( pd->petDB && pd->petDB->equip_script )
- status_calc_pc(sd,0);
+ status_calc_pc(sd,SCO_NONE);
if( battle_config.pet_hungry_delay_rate != 100 )
interval = (pd->petDB->hungry_delay*battle_config.pet_hungry_delay_rate)/100;
@@ -703,7 +703,7 @@ int pet_unequipitem(struct map_session_data *sd, struct pet_data *pd) {
if( pd->state.skillbonus )
{
pd->state.skillbonus = 0;
- status_calc_pc(sd,0);
+ status_calc_pc(sd,SCO_NONE);
}
if( pd->s_skill && pd->s_skill->timer != INVALID_TIMER )
{
@@ -759,7 +759,7 @@ int pet_food(struct map_session_data *sd, struct pet_data *pd)
}
else if( pd->pet.intimate > 1000 )
pd->pet.intimate = 1000;
- status_calc_pet(pd, 0);
+ status_calc_pet(pd, SCO_NONE);
pd->pet.hungry += pd->petDB->fullness;
if( pd->pet.hungry > 100 )
pd->pet.hungry = 100;
@@ -1062,7 +1062,7 @@ int pet_skill_bonus_timer(int tid, int64 tick, int id, intptr_t data) {
if (pd->state.skillbonus != bonus) {
pd->state.skillbonus = bonus;
- status_calc_pc(sd, 0);
+ status_calc_pc(sd, SCO_NONE);
}
// wait for the next timer
pd->bonus->timer=timer->add(tick+duration,pet->skill_bonus_timer,sd->bl.id,0);
@@ -1328,8 +1328,10 @@ int read_petdb()
/*==========================================
* Initialization process relationship skills
*------------------------------------------*/
-int do_init_pet(void)
-{
+int do_init_pet(bool minimal) {
+ if (minimal)
+ return 0;
+
pet->read_db();
pet->item_drop_ers = ers_new(sizeof(struct item_drop),"pet.c::item_drop_ers",ERS_OPT_NONE);
diff --git a/src/map/pet.h b/src/map/pet.h
index f95e860a2..f9a756de2 100644
--- a/src/map/pet.h
+++ b/src/map/pet.h
@@ -106,7 +106,7 @@ struct pet_interface {
struct eri *item_drop_ers; //For loot drops delay structures.
struct eri *item_drop_list_ers;
/* */
- int (*init) (void);
+ int (*init) (bool minimal);
int (*final) (void);
/* */
int (*hungry_val) (struct pet_data *pd);
diff --git a/src/map/quest.c b/src/map/quest.c
index f40b60c3d..0719b8dbb 100644
--- a/src/map/quest.c
+++ b/src/map/quest.c
@@ -351,7 +351,10 @@ int quest_read_db(void) {
return 0;
}
-void do_init_quest(void) {
+void do_init_quest(bool minimal) {
+ if (minimal)
+ return;
+
quest->read_db();
}
diff --git a/src/map/quest.h b/src/map/quest.h
index 340bc8608..0725a8c46 100644
--- a/src/map/quest.h
+++ b/src/map/quest.h
@@ -19,7 +19,7 @@ typedef enum quest_check_type { HAVEQUEST, PLAYTIME, HUNTING } quest_check_type;
struct quest_interface {
struct s_quest_db db[MAX_QUEST_DB];
/* */
- void (*init) (void);
+ void (*init) (bool minimal);
void (*reload) (void);
/* */
int (*search_db) (int quest_id);
diff --git a/src/map/script.c b/src/map/script.c
index d51f27ce9..5f7dd777a 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -1863,66 +1863,98 @@ void read_constdb(void) {
fclose(fp);
}
+// Standard UNIX tab size is 8
+#define TAB_SIZE 8
+#define update_tabstop(tabstop,chars) \
+ do { \
+ (tabstop) -= (chars); \
+ while ((tabstop) <= 0) (tabstop) += TAB_SIZE; \
+ } while (false)
+
/*==========================================
* Display emplacement line of script
*------------------------------------------*/
const char* script_print_line(StringBuf* buf, const char* p, const char* mark, int line)
{
- int i;
+ int i, mark_pos = 0, tabstop = TAB_SIZE;
if( p == NULL || !p[0] ) return NULL;
if( line < 0 )
- StrBuf->Printf(buf, "*% 5d : ", -line);
+ StrBuf->Printf(buf, "*%5d: ", -line); // len = 8
else
- StrBuf->Printf(buf, " % 5d : ", line);
- for(i=0;p[i] && p[i] != '\n';i++){
- if(p + i != mark)
- StrBuf->Printf(buf, "%c", p[i]);
+ StrBuf->Printf(buf, " %5d: ", line); // len = 8
+ update_tabstop(tabstop,8); // len = 8
+ for( i=0; p[i] && p[i] != '\n'; i++ ) {
+ char c = p[i];
+ int w = 1;
+ // Like Clang does, let's print the code with tabs expanded to spaces to ensure that the marker will be under the right character
+ if( c == '\t' ) {
+ c = ' ';
+ w = tabstop;
+ }
+ update_tabstop(tabstop, w);
+ if( p + i < mark)
+ mark_pos += w;
+ if( p + i != mark)
+ StrBuf->Printf(buf, "%*c", w, c);
else
- StrBuf->Printf(buf, "\'%c\'", p[i]);
+ StrBuf->Printf(buf, CL_BT_RED"%*c"CL_RESET, w, c);
}
StrBuf->AppendStr(buf, "\n");
+ if( mark ) {
+ StrBuf->AppendStr(buf, " "CL_BT_CYAN); // len = 8
+ for( ; mark_pos > 0; mark_pos-- ) {
+ StrBuf->AppendStr(buf, "~");
+ }
+ StrBuf->AppendStr(buf, CL_RESET CL_BT_GREEN"^"CL_RESET"\n");
+ }
return p+i+(p[i] == '\n' ? 1 : 0);
}
+#undef TAB_SIZE
+#undef update_tabstop
+#define CONTEXTLINES 3
void script_errorwarning_sub(StringBuf *buf, const char* src, const char* file, int start_line, const char* error_msg, const char* error_pos) {
// Find the line where the error occurred
int j;
int line = start_line;
- const char *p;
- const char *linestart[5] = { NULL, NULL, NULL, NULL, NULL };
+ const char *p, *error_linepos;
+ const char *linestart[CONTEXTLINES];
+ memset(linestart, '\0', sizeof(linestart));
for(p=src;p && *p;line++){
const char *lineend=strchr(p,'\n');
if(lineend==NULL || error_pos<lineend){
break;
}
- for( j = 0; j < 4; j++ ) {
+ for( j = 0; j < CONTEXTLINES-1; j++ ) {
linestart[j] = linestart[j+1];
}
- linestart[4] = p;
- p=lineend+1;
+ linestart[CONTEXTLINES-1] = p;
+ p = lineend+1;
}
+ error_linepos = p;
if( line >= 0 )
- StrBuf->Printf(buf, "script error on %s line %d\n", file, line);
+ StrBuf->Printf(buf, "script error in file '%s' line %d column %d\n", file, line, error_pos-error_linepos+1);
else
- StrBuf->Printf(buf, "script error on %s item ID %d\n", file, -line);
+ StrBuf->Printf(buf, "script error in file '%s' item ID %d\n", file, -line);
StrBuf->Printf(buf, " %s\n", error_msg);
- for(j = 0; j < 5; j++ ) {
- script->print_line(buf, linestart[j], NULL, line + j - 5);
+ for(j = 0; j < CONTEXTLINES; j++ ) {
+ script->print_line(buf, linestart[j], NULL, line + j - CONTEXTLINES);
}
p = script->print_line(buf, p, error_pos, -line);
- for(j = 0; j < 5; j++) {
+ for(j = 0; j < CONTEXTLINES; j++) {
p = script->print_line(buf, p, NULL, line + j + 1 );
}
}
+#undef CONTEXTLINES
void script_error(const char* src, const char* file, int start_line, const char* error_msg, const char* error_pos) {
StringBuf buf;
StrBuf->Init(&buf);
- StrBuf->AppendStr(&buf, "\a\n");
+ StrBuf->AppendStr(&buf, "\a");
script->errorwarning_sub(&buf, src, file, start_line, error_msg, error_pos);
@@ -3694,7 +3726,7 @@ void do_final_script(void) {
/*==========================================
* Initialization
*------------------------------------------*/
-void do_init_script(void) {
+void do_init_script(bool minimal) {
script->st_db = idb_alloc(DB_OPT_BASE);
script->userfunc_db = strdb_alloc(DB_OPT_DUP_KEY,0);
script->autobonus_db = strdb_alloc(DB_OPT_DUP_KEY,0);
@@ -3707,6 +3739,10 @@ void do_init_script(void) {
script->parse_builtin();
script->read_constdb();
+
+ if (minimal)
+ return;
+
mapreg->init();
}
@@ -9425,15 +9461,8 @@ BUILDIN(sc_end) {
if (!sce)
return true;
- switch (type) {
- case SC_WEIGHTOVER50:
- case SC_WEIGHTOVER90:
- case SC_NOCHAT:
- case SC_PUSH_CART:
- return true;
- default:
- break;
- }
+ if( status->get_sc_type(type)&SC_NO_CLEAR )
+ return true;
//This should help status_change_end force disabling the SC in case it has no limit.
sce->val1 = sce->val2 = sce->val3 = sce->val4 = 0;
@@ -12099,7 +12128,7 @@ BUILDIN(nude)
}
if( calcflag )
- status_calc_pc(sd,0);
+ status_calc_pc(sd,SCO_NONE);
return true;
}
@@ -12425,9 +12454,9 @@ BUILDIN(npcwalkto) {
if( nd ) {
unit->bl2ud2(&nd->bl); // ensure nd->ud is safe to edit
if (!nd->status.hp) {
- status_calc_npc(nd, true);
+ status_calc_npc(nd, SCO_FIRST);
} else {
- status_calc_npc(nd, false);
+ status_calc_npc(nd, SCO_NONE);
}
unit->walktoxy(&nd->bl,x,y,0);
}
@@ -14967,9 +14996,9 @@ BUILDIN(unitskilluseid) {
if( bl != NULL ) {
if( bl->type == BL_NPC ) {
if (!((TBL_NPC*)bl)->status.hp) {
- status_calc_npc(((TBL_NPC*)bl), true);
+ status_calc_npc(((TBL_NPC*)bl), SCO_FIRST);
} else {
- status_calc_npc(((TBL_NPC*)bl), false);
+ status_calc_npc(((TBL_NPC*)bl), SCO_NONE);
}
}
unit->skilluse_id(bl, target_id, skill_id, skill_lv);
@@ -15001,9 +15030,9 @@ BUILDIN(unitskillusepos) {
if( bl != NULL ) {
if( bl->type == BL_NPC ) {
if (!((TBL_NPC*)bl)->status.hp) {
- status_calc_npc(((TBL_NPC*)bl), true);
+ status_calc_npc(((TBL_NPC*)bl), SCO_FIRST);
} else {
- status_calc_npc(((TBL_NPC*)bl), false);
+ status_calc_npc(((TBL_NPC*)bl), SCO_NONE);
}
}
unit->skilluse_pos(bl, skill_x, skill_y, skill_id, skill_lv);
@@ -17013,9 +17042,9 @@ BUILDIN(npcskill) {
nd->stat_point = stat_point;
if (!nd->status.hp) {
- status_calc_npc(nd, true);
+ status_calc_npc(nd, SCO_FIRST);
} else {
- status_calc_npc(nd, false);
+ status_calc_npc(nd, SCO_NONE);
}
if (skill->get_inf(skill_id)&INF_GROUND_SKILL) {
@@ -18210,7 +18239,7 @@ void script_label_add(int key, int pos) {
void script_defaults(void) {
// aegis->athena slot position conversion table
- unsigned int equip[SCRIPT_EQUIP_TABLE_SIZE] = {EQP_HEAD_TOP,EQP_ARMOR,EQP_HAND_L,EQP_HAND_R,EQP_GARMENT,EQP_SHOES,EQP_ACC_L,EQP_ACC_R,EQP_HEAD_MID,EQP_HEAD_LOW,EQP_COSTUME_HEAD_LOW,EQP_COSTUME_HEAD_MID,EQP_COSTUME_HEAD_TOP,EQP_COSTUME_GARMENT};
+ unsigned int equip[SCRIPT_EQUIP_TABLE_SIZE] = {EQP_HEAD_TOP,EQP_ARMOR,EQP_HAND_L,EQP_HAND_R,EQP_GARMENT,EQP_SHOES,EQP_ACC_L,EQP_ACC_R,EQP_HEAD_MID,EQP_HEAD_LOW,EQP_COSTUME_HEAD_LOW,EQP_COSTUME_HEAD_MID,EQP_COSTUME_HEAD_TOP,EQP_COSTUME_GARMENT,EQP_SHADOW_ARMOR, EQP_SHADOW_WEAPON, EQP_SHADOW_SHIELD, EQP_SHADOW_SHOES, EQP_SHADOW_ACC_R, EQP_SHADOW_ACC_L};
script = &script_s;
diff --git a/src/map/script.h b/src/map/script.h
index c6cb6070b..6aebc8a30 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -35,7 +35,7 @@ struct eri;
//#define SCRIPT_HASH_SDBM
#define SCRIPT_HASH_ELF
-#define SCRIPT_EQUIP_TABLE_SIZE 14
+#define SCRIPT_EQUIP_TABLE_SIZE 20
//#define SCRIPT_DEBUG_DISP
//#define SCRIPT_DEBUG_DISASM
@@ -507,7 +507,7 @@ struct script_interface {
int potion_hp, potion_per_hp, potion_sp, potion_per_sp;
int potion_target;
/* */
- void (*init) (void);
+ void (*init) (bool minimal);
void (*final) (void);
int (*reload) (void);
/* parse */
diff --git a/src/map/skill.c b/src/map/skill.c
index b70e58c46..c16ab832c 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -18027,7 +18027,7 @@ bool skill_parse_row_changematerialdb(char* split[], int columns, int current) {
* create_arrow_db.txt
* abra_db.txt
*------------------------------*/
-void skill_readdb(void) {
+void skill_readdb(bool minimal) {
// init skill db structures
db_clear(skill->name2id_db);
@@ -18050,6 +18050,10 @@ void skill_readdb(void) {
safestrncpy(skill->db[0].desc, "Unknown Skill", sizeof(skill->db[0].desc));
sv->readdb(map->db_path, DBPATH"skill_db.txt", ',', 17, 17, MAX_SKILL_DB, skill->parse_row_skilldb);
+
+ if (minimal)
+ return;
+
sv->readdb(map->db_path, DBPATH"skill_require_db.txt", ',', 32, 32, MAX_SKILL_DB, skill->parse_row_requiredb);
#ifdef RENEWAL_CAST
sv->readdb(map->db_path, "re/skill_cast_db.txt", ',', 8, 8, MAX_SKILL_DB, skill->parse_row_castdb);
@@ -18077,7 +18081,7 @@ void skill_reload (void) {
struct map_session_data *sd;
int i,c,k;
- skill->read_db();
+ skill->read_db(false);
//[Ind/Hercules] refresh index cache
for(c = 0; c < CLASS_COUNT; c++) {
@@ -18103,9 +18107,12 @@ void skill_reload (void) {
/*==========================================
*
*------------------------------------------*/
-int do_init_skill (void) {
+int do_init_skill(bool minimal) {
skill->name2id_db = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, MAX_SKILL_NAME_LENGTH);
- skill->read_db();
+ skill->read_db(minimal);
+
+ if (minimal)
+ return 0;
skill->group_db = idb_alloc(DB_OPT_BASE);
skill->unit_db = idb_alloc(DB_OPT_BASE);
diff --git a/src/map/skill.h b/src/map/skill.h
index fca4952ef..918216e8a 100644
--- a/src/map/skill.h
+++ b/src/map/skill.h
@@ -1797,10 +1797,10 @@ typedef int (*SkillFunc)(struct block_list *src, struct block_list *target, uint
* Skill.c Interface
**/
struct skill_interface {
- int (*init) (void);
+ int (*init) (bool minimal);
int (*final) (void);
void (*reload) (void);
- void (*read_db) (void);
+ void (*read_db) (bool minimal);
/* */
DBMap* cd_db; // char_id -> struct skill_cd
DBMap* name2id_db;
diff --git a/src/map/status.c b/src/map/status.c
index 9e98b2801..ef211e97e 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -1999,13 +1999,12 @@ void status_calc_misc(struct block_list *bl, struct status_data *st, int level)
//Skotlex: Calculates the initial status for the given mob
//first will only be false when the mob leveled up or got a GuardUp level.
-int status_calc_mob_(struct mob_data* md, bool first) {
+int status_calc_mob_(struct mob_data* md, enum e_status_calc_opt opt) {
struct status_data *mstatus;
struct block_list *mbl = NULL;
int flag=0;
- if(first)
- { //Set basic level on respawn.
+ if(opt&SCO_FIRST) { //Set basic level on respawn.
if (md->level > 0 && md->level <= MAX_LEVEL && md->level != md->db->lv)
;
else
@@ -2036,7 +2035,7 @@ int status_calc_mob_(struct mob_data* md, bool first) {
aFree(md->base_status);
md->base_status = NULL;
}
- if(first)
+ if(opt&SCO_FIRST)
memcpy(&md->status, &md->db->status, sizeof(struct status_data));
return 0;
}
@@ -2160,18 +2159,18 @@ int status_calc_mob_(struct mob_data* md, bool first) {
}
}
- if( first ) //Initial battle status
+ if( opt&SCO_FIRST ) //Initial battle status
memcpy(&md->status, mstatus, sizeof(struct status_data));
return 1;
}
//Skotlex: Calculates the stats of the given pet.
-int status_calc_pet_(struct pet_data *pd, bool first)
+int status_calc_pet_(struct pet_data *pd, enum e_status_calc_opt opt)
{
nullpo_ret(pd);
- if (first) {
+ if (opt&SCO_FIRST) {
memcpy(&pd->status, &pd->db->status, sizeof(struct status_data));
pd->status.mode = MD_CANMOVE; // pets discard all modes, except walking
pd->status.speed = pd->petDB->speed;
@@ -2189,10 +2188,10 @@ int status_calc_pet_(struct pet_data *pd, bool first)
lv =sd->status.base_level*battle_config.pet_lv_rate/100;
if (lv < 0)
lv = 1;
- if (lv != pd->pet.level || first) {
+ if (lv != pd->pet.level || opt&SCO_FIRST) {
struct status_data *bstat = &pd->db->status, *pstatus = &pd->status;
pd->pet.level = lv;
- if (!first) //Lv Up animation
+ if (! (opt&SCO_FIRST) ) //Lv Up animation
clif->misceffect(&pd->bl, 0);
pstatus->rhw.atk = (bstat->rhw.atk*lv)/pd->db->lv;
pstatus->rhw.atk2 = (bstat->rhw.atk2*lv)/pd->db->lv;
@@ -2214,10 +2213,10 @@ int status_calc_pet_(struct pet_data *pd, bool first)
status->calc_misc(&pd->bl, &pd->status, lv);
- if (!first) //Not done the first time because the pet is not visible yet
+ if (! (opt&SCO_FIRST) ) //Not done the first time because the pet is not visible yet
clif->send_petstatus(sd);
}
- } else if (first) {
+ } else if ( opt&SCO_FIRST ) {
status->calc_misc(&pd->bl, &pd->status, pd->db->lv);
if (!battle_config.pet_lv_rate && pd->pet.level != pd->db->lv)
pd->pet.level = pd->db->lv;
@@ -2295,7 +2294,7 @@ unsigned int status_base_pc_maxsp(struct map_session_data* sd, struct status_dat
//Calculates player data from scratch without counting SC adjustments.
//Should be invoked whenever players raise stats, learn passive skills or change equipment.
-int status_calc_pc_(struct map_session_data* sd, bool first) {
+int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) {
static int calculating = 0; //Check for recursive call preemption. [Skotlex]
struct status_data *bstatus; // pointer to the player's base status
const struct status_change *sc = &sd->sc;
@@ -2317,7 +2316,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first) {
sd->max_weight = status->max_weight_base[pc->class2idx(sd->status.class_)]+sd->status.str*300;
- if(first) {
+ if(opt&SCO_FIRST) {
//Load Hp/SP from char-received data.
sd->battle_status.hp = sd->status.hp;
sd->battle_status.sp = sd->status.sp;
@@ -2389,11 +2388,17 @@ int status_calc_pc_(struct map_session_data* sd, bool first) {
clif->sc_end(&sd->bl,sd->bl.id,SELF,SI_CLAIRVOYANCE);
memset(&sd->special_state,0,sizeof(sd->special_state));
- memset(&bstatus->max_hp, 0, sizeof(struct status_data)-(sizeof(bstatus->hp)+sizeof(bstatus->sp)));
-
- //FIXME: Most of these stuff should be calculated once, but how do I fix the memset above to do that? [Skotlex]
- if (!sd->state.permanent_speed)
+
+ if (!sd->state.permanent_speed) {
+ memset(&bstatus->max_hp, 0, sizeof(struct status_data)-(sizeof(bstatus->hp)+sizeof(bstatus->sp)));
bstatus->speed = DEFAULT_WALK_SPEED;
+ } else {
+ int pSpeed = bstatus->speed;
+ memset(&bstatus->max_hp, 0, sizeof(struct status_data)-(sizeof(bstatus->hp)+sizeof(bstatus->sp)));
+ bstatus->speed = pSpeed;
+ }
+
+ //FIXME: Most of these stuff should be calculated once, but how do I fix the memset above to do that? [Skotlex]
//Give them all modes except these (useful for clones)
bstatus->mode = MD_MASK&~(MD_BOSS|MD_PLANT|MD_DETECTOR|MD_ANGRY|MD_TARGETWEAK);
@@ -2476,7 +2481,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first) {
bstatus->def += sd->inventory_data[index]->def;
- if(first && sd->inventory_data[index]->equip_script)
+ if(opt&SCO_FIRST && sd->inventory_data[index]->equip_script)
{ //Execute equip-script on login
script->run(sd->inventory_data[index]->equip_script,0,sd->bl.id,0);
if (!calculating)
@@ -2619,7 +2624,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first) {
if( k < map->list[sd->bl.m].zone->disabled_items_count )
continue;
- if(first && data->equip_script) {//Execute equip-script on login
+ if(opt&SCO_FIRST && data->equip_script) {//Execute equip-script on login
script->run(data->equip_script,0,sd->bl.id,0);
if (!calculating)
return 1;
@@ -3129,11 +3134,11 @@ int status_calc_pc_(struct map_session_data* sd, bool first) {
return 0;
}
-int status_calc_mercenary_(struct mercenary_data *md, bool first) {
+int status_calc_mercenary_(struct mercenary_data *md, enum e_status_calc_opt opt) {
struct status_data *mstatus = &md->base_status;
struct s_mercenary *merc = &md->mercenary;
- if( first ) {
+ if( opt&SCO_FIRST ) {
memcpy(mstatus, &md->db->status, sizeof(struct status_data));
mstatus->mode = MD_CANMOVE|MD_CANATTACK;
mstatus->hp = mstatus->max_hp;
@@ -3148,7 +3153,7 @@ int status_calc_mercenary_(struct mercenary_data *md, bool first) {
return 0;
}
-int status_calc_homunculus_(struct homun_data *hd, bool first) {
+int status_calc_homunculus_(struct homun_data *hd, enum e_status_calc_opt opt) {
struct status_data *hstatus = &hd->base_status;
struct s_homunculus *hom = &hd->homunculus;
int skill_lv;
@@ -3161,7 +3166,7 @@ int status_calc_homunculus_(struct homun_data *hd, bool first) {
hstatus->int_ = hom->int_ / 10;
hstatus->luk = hom->luk / 10;
- if (first) { //[orn]
+ if ( opt&SCO_FIRST ) { //[orn]
const struct s_homunculus_db *db = hd->homunculusDB;
hstatus->def_ele = db->element;
hstatus->ele_lv = 1;
@@ -3201,7 +3206,7 @@ int status_calc_homunculus_(struct homun_data *hd, bool first) {
if((skill_lv = homun->checkskill(hd,HLIF_BRAIN)) > 0)
hstatus->max_sp += (1 +skill_lv/2 -skill_lv/4 +skill_lv/5) * hstatus->max_sp / 100;
- if (first) {
+ if ( opt&SCO_FIRST ) {
hd->battle_status.hp = hom->hp;
hd->battle_status.sp = hom->sp;
}
@@ -3225,7 +3230,7 @@ int status_calc_homunculus_(struct homun_data *hd, bool first) {
return 1;
}
-int status_calc_elemental_(struct elemental_data *ed, bool first) {
+int status_calc_elemental_(struct elemental_data *ed, enum e_status_calc_opt opt) {
struct status_data *estatus = &ed->base_status;
struct s_elemental *ele = &ed->elemental;
struct map_session_data *sd = ed->master;
@@ -3233,7 +3238,7 @@ int status_calc_elemental_(struct elemental_data *ed, bool first) {
if( !sd )
return 0;
- if( first ) {
+ if( opt&SCO_FIRST ) {
memcpy(estatus, &ed->db->status, sizeof(struct status_data));
if( !ele->mode )
estatus->mode = EL_MODE_PASSIVE;
@@ -3264,13 +3269,13 @@ int status_calc_elemental_(struct elemental_data *ed, bool first) {
return 0;
}
-int status_calc_npc_(struct npc_data *nd, bool first) {
+int status_calc_npc_(struct npc_data *nd, enum e_status_calc_opt opt) {
struct status_data *nstatus = &nd->status;
if (!nd)
return 0;
- if (first) {
+ if ( opt&SCO_FIRST ) {
nstatus->hp = 1;
nstatus->sp = 1;
nstatus->max_hp = 1;
@@ -3670,6 +3675,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) {
if(flag&SCB_SPEED) {
struct unit_data *ud = unit->bl2ud(bl);
+
st->speed = status->calc_speed(bl, sc, bst->speed);
//Re-walk to adjust speed (we do not check if walktimer != INVALID_TIMER
@@ -3678,13 +3684,11 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) {
if (ud)
ud->state.change_walk_target = ud->state.speed_changed = 1;
- if( bl->type&BL_PC && st->speed < battle_config.max_walk_speed )
+ if( bl->type&BL_PC && !(sd && sd->state.permanent_speed) && st->speed < battle_config.max_walk_speed )
st->speed = battle_config.max_walk_speed;
if( bl->type&BL_HOM && battle_config.hom_setting&0x8 && ((TBL_HOM*)bl)->master)
st->speed = status->get_speed(&((TBL_HOM*)bl)->master->bl);
-
-
}
if(flag&SCB_CRI && bst->cri) {
@@ -3858,13 +3862,17 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) {
/// Also sends updates to the client wherever applicable.
/// @param flag bitfield of values from enum scb_flag
/// @param first if true, will cause status_calc_* functions to run their base status initialization code
-void status_calc_bl_(struct block_list *bl, enum scb_flag flag, bool first) {
+void status_calc_bl_(struct block_list *bl, enum scb_flag flag, enum e_status_calc_opt opt) {
struct status_data bst; // previous battle status
struct status_data *st; // pointer to current battle status
if( bl->type == BL_PC && ((TBL_PC*)bl)->delayed_damage != 0 ) {
- ((TBL_PC*)bl)->state.hold_recalc = 1;
- return;
+ if( opt&SCO_FORCE )
+ ((TBL_PC*)bl)->state.hold_recalc = 0;/* clear and move on */
+ else {
+ ((TBL_PC*)bl)->state.hold_recalc = 1;/* flag and stop */
+ return;
+ }
}
// remember previous values
@@ -3873,25 +3881,25 @@ void status_calc_bl_(struct block_list *bl, enum scb_flag flag, bool first) {
if( flag&SCB_BASE ) {// calculate the object's base status too
switch( bl->type ) {
- case BL_PC: status->calc_pc_(BL_CAST(BL_PC,bl), first); break;
- case BL_MOB: status->calc_mob_(BL_CAST(BL_MOB,bl), first); break;
- case BL_PET: status->calc_pet_(BL_CAST(BL_PET,bl), first); break;
- case BL_HOM: status->calc_homunculus_(BL_CAST(BL_HOM,bl), first); break;
- case BL_MER: status->calc_mercenary_(BL_CAST(BL_MER,bl), first); break;
- case BL_ELEM: status->calc_elemental_(BL_CAST(BL_ELEM,bl), first); break;
- case BL_NPC: status->calc_npc_(BL_CAST(BL_NPC,bl), first); break;
+ case BL_PC: status->calc_pc_(BL_CAST(BL_PC,bl), opt); break;
+ case BL_MOB: status->calc_mob_(BL_CAST(BL_MOB,bl), opt); break;
+ case BL_PET: status->calc_pet_(BL_CAST(BL_PET,bl), opt); break;
+ case BL_HOM: status->calc_homunculus_(BL_CAST(BL_HOM,bl), opt); break;
+ case BL_MER: status->calc_mercenary_(BL_CAST(BL_MER,bl), opt); break;
+ case BL_ELEM: status->calc_elemental_(BL_CAST(BL_ELEM,bl), opt); break;
+ case BL_NPC: status->calc_npc_(BL_CAST(BL_NPC,bl), opt); break;
}
}
if( bl->type == BL_PET )
return; // pets are not affected by statuses
- if( first && bl->type == BL_MOB )
+ if( opt&SCO_FIRST && bl->type == BL_MOB )
return; // assume there will be no statuses active
status->calc_bl_main(bl, flag);
- if( first && bl->type == BL_HOM )
+ if( opt&SCO_FIRST && bl->type == BL_HOM )
return; // client update handled by caller
// compare against new values and send client updates
@@ -5045,11 +5053,8 @@ unsigned short status_calc_speed(struct block_list *bl, struct status_change *sc
TBL_PC* sd = BL_CAST(BL_PC, bl);
int speed_rate;
- if( sc == NULL )
- return cap_value(speed,10,USHRT_MAX);
-
- if (sd && sd->state.permanent_speed)
- return (short)cap_value(speed,10,USHRT_MAX);
+ if( sc == NULL || ( sd && sd->state.permanent_speed ) )
+ return (unsigned short)cap_value(speed,MIN_WALK_SPEED,MAX_WALK_SPEED);
if( sd && sd->ud.skilltimer != INVALID_TIMER && (pc->checkskill(sd,SA_FREECAST) > 0 || sd->ud.skill_id == LG_EXEEDBREAK) )
{
@@ -5222,7 +5227,7 @@ unsigned short status_calc_speed(struct block_list *bl, struct status_change *sc
}
- return (short)cap_value(speed,10,USHRT_MAX);
+ return (unsigned short)cap_value(speed,MIN_WALK_SPEED,MAX_WALK_SPEED);
}
// flag&1 - fixed value [malufett]
@@ -9218,17 +9223,8 @@ int status_change_clear(struct block_list* bl, int type) {
}
}
}
- if( type == 3 ) {
- switch (i) {// TODO: This list may be incomplete
- case SC_WEIGHTOVER50:
- case SC_WEIGHTOVER90:
- case SC_NOCHAT:
- case SC_PUSH_CART:
- case SC_JAILED:
- case SC_ALL_RIDING:
- continue;
- }
- }
+ if( type == 3 && status->get_sc_type(i)&SC_NO_CLEAR )
+ continue;
status_change_end(bl, (sc_type)i, INVALID_TIMER);
@@ -10377,7 +10373,7 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) {
if (sd && !pc_issit(sd)) { //can't cast if sit
int mushroom_skill_id = 0, i;
unit->stop_attack(bl);
- unit->skillcastcancel(bl,1);
+ unit->skillcastcancel(bl,0);
do {
i = rnd() % MAX_SKILL_MAGICMUSHROOM_DB;
mushroom_skill_id = skill->magicmushroom_db[i].skill_id;
@@ -10385,15 +10381,15 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) {
while( mushroom_skill_id == 0 );
switch( skill->get_casttype(mushroom_skill_id) ) { // Magic Mushroom skills are buffs or area damage
- case CAST_GROUND:
- skill->castend_pos2(bl,bl->x,bl->y,mushroom_skill_id,1,tick,0);
- break;
- case CAST_NODAMAGE:
- skill->castend_nodamage_id(bl,bl,mushroom_skill_id,1,tick,0);
- break;
- case CAST_DAMAGE:
- skill->castend_damage_id(bl,bl,mushroom_skill_id,1,tick,0);
- break;
+ case CAST_GROUND:
+ skill->castend_pos2(bl,bl->x,bl->y,mushroom_skill_id,1,tick,0);
+ break;
+ case CAST_NODAMAGE:
+ skill->castend_nodamage_id(bl,bl,mushroom_skill_id,1,tick,0);
+ break;
+ case CAST_DAMAGE:
+ skill->castend_damage_id(bl,bl,mushroom_skill_id,1,tick,0);
+ break;
}
}
@@ -11534,7 +11530,10 @@ int status_readdb(void)
/*==========================================
* Status db init and destroy.
*------------------------------------------*/
-int do_init_status(void) {
+int do_init_status(bool minimal) {
+ if (minimal)
+ return 0;
+
timer->add_func_list(status->change_timer,"status_change_timer");
timer->add_func_list(status->kaahi_heal_timer,"status_kaahi_heal_timer");
timer->add_func_list(status->natural_heal_timer,"status_natural_heal_timer");
diff --git a/src/map/status.h b/src/map/status.h
index 254f3bfab..cdd5fa481 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -34,13 +34,14 @@ enum refine_type {
};
typedef enum sc_conf_type {
- SC_NO_REM_DEATH = 0x1,
- SC_NO_SAVE = 0x2,
- SC_NO_DISPELL = 0x4,
- SC_NO_CLEARANCE = 0x8,
- SC_BUFF = 0x10,
- SC_DEBUFF = 0x20,
- SC_MADO_NO_RESET = 0x40
+ SC_NO_REM_DEATH = 0x01,
+ SC_NO_SAVE = 0x02,
+ SC_NO_DISPELL = 0x04,
+ SC_NO_CLEARANCE = 0x08,
+ SC_BUFF = 0x10,
+ SC_DEBUFF = 0x20,
+ SC_MADO_NO_RESET = 0x40,
+ SC_NO_CLEAR = 0x80,
} sc_conf_type;
// Status changes listing. These code are for use by the server.
@@ -1627,6 +1628,12 @@ enum e_regen {
RGN_SSP = 0x08,
};
+enum e_status_calc_opt {
+ SCO_NONE = 0x0,
+ SCO_FIRST = 0x1, /* trigger the calculations that should take place only onspawn/once */
+ SCO_FORCE = 0x2, /* only relevant to BL_PC types, ensures call bypasses the queue caused by delayed damage */
+};
+
//Define to determine who gets HP/SP consumed on doing skills/etc. [Skotlex]
#define BL_CONSUME (BL_PC|BL_HOM|BL_MER|BL_ELEM)
//Define to determine who has regen
@@ -1810,14 +1817,14 @@ struct status_change {
#define status_change_end(bl,type,tid) status->change_end_(bl,type,tid,__FILE__,__LINE__)
-#define status_calc_bl(bl, flag) status->calc_bl_(bl, (enum scb_flag)(flag), false)
-#define status_calc_mob(md, first) status->calc_bl_(&(md)->bl, SCB_ALL, first)
-#define status_calc_pet(pd, first) status->calc_bl_(&(pd)->bl, SCB_ALL, first)
-#define status_calc_pc(sd, first) status->calc_bl_(&(sd)->bl, SCB_ALL, first)
-#define status_calc_homunculus(hd, first) status->calc_bl_(&(hd)->bl, SCB_ALL, first)
-#define status_calc_mercenary(md, first) status->calc_bl_(&(md)->bl, SCB_ALL, first)
-#define status_calc_elemental(ed, first) status->calc_bl_(&(ed)->bl, SCB_ALL, first)
-#define status_calc_npc(nd, first) status->calc_bl_(&(nd)->bl, SCB_ALL, first)
+#define status_calc_bl(bl, flag) status->calc_bl_(bl, (enum scb_flag)(flag), SCO_NONE)
+#define status_calc_mob(md, opt) status->calc_bl_(&(md)->bl, SCB_ALL, opt)
+#define status_calc_pet(pd, opt) status->calc_bl_(&(pd)->bl, SCB_ALL, opt)
+#define status_calc_pc(sd, opt) status->calc_bl_(&(sd)->bl, SCB_ALL, opt)
+#define status_calc_homunculus(hd, opt) status->calc_bl_(&(hd)->bl, SCB_ALL, opt)
+#define status_calc_mercenary(md, opt) status->calc_bl_(&(md)->bl, SCB_ALL, opt)
+#define status_calc_elemental(ed, opt) status->calc_bl_(&(ed)->bl, SCB_ALL, opt)
+#define status_calc_npc(nd, opt) status->calc_bl_(&(nd)->bl, SCB_ALL, opt)
// bonus values and upgrade chances for refining equipment
struct s_refine_info {
@@ -1864,7 +1871,7 @@ struct status_interface {
int64 natural_heal_prev_tick;
unsigned int natural_heal_diff_tick;
/* */
- int (*init) (void);
+ int (*init) (bool minimal);
void (*final) (void);
/* funcs */
int (*get_refine_chance) (enum refine_type wlv, int refine);
@@ -1911,13 +1918,13 @@ struct status_interface {
int (*change_timer_sub) (struct block_list* bl, va_list ap);
int (*change_clear) (struct block_list* bl, int type);
int (*change_clear_buffs) (struct block_list* bl, int type);
- void (*calc_bl_) (struct block_list *bl, enum scb_flag flag, bool first);
- int (*calc_mob_) (struct mob_data* md, bool first);
- int (*calc_pet_) (struct pet_data* pd, bool first);
- int (*calc_pc_) (struct map_session_data* sd, bool first);
- int (*calc_homunculus_) (struct homun_data *hd, bool first);
- int (*calc_mercenary_) (struct mercenary_data *md, bool first);
- int (*calc_elemental_) (struct elemental_data *ed, bool first);
+ void (*calc_bl_) (struct block_list *bl, enum scb_flag flag, enum e_status_calc_opt opt);
+ int (*calc_mob_) (struct mob_data* md, enum e_status_calc_opt opt);
+ int (*calc_pet_) (struct pet_data* pd, enum e_status_calc_opt opt);
+ int (*calc_pc_) (struct map_session_data* sd, enum e_status_calc_opt opt);
+ int (*calc_homunculus_) (struct homun_data *hd, enum e_status_calc_opt opt);
+ int (*calc_mercenary_) (struct mercenary_data *md, enum e_status_calc_opt opt);
+ int (*calc_elemental_) (struct elemental_data *ed, enum e_status_calc_opt opt);
void (*calc_misc) (struct block_list *bl, struct status_data *status, int level);
void (*calc_regen) (struct block_list *bl, struct status_data *st, struct regen_data *regen);
void (*calc_regen_rate) (struct block_list *bl, struct regen_data *regen, struct status_change *sc);
@@ -1943,7 +1950,7 @@ struct status_interface {
void (*calc_sigma) (void);
unsigned int (*base_pc_maxhp) (struct map_session_data *sd, struct status_data *st);
unsigned int (*base_pc_maxsp) (struct map_session_data *sd, struct status_data *st);
- int (*calc_npc_) (struct npc_data *nd, bool first);
+ int (*calc_npc_) (struct npc_data *nd, enum e_status_calc_opt opt);
unsigned short (*calc_str) (struct block_list *bl, struct status_change *sc, int str);
unsigned short (*calc_agi) (struct block_list *bl, struct status_change *sc, int agi);
unsigned short (*calc_vit) (struct block_list *bl, struct status_change *sc, int vit);
diff --git a/src/map/storage.c b/src/map/storage.c
index cc1100d28..45a80867d 100644
--- a/src/map/storage.c
+++ b/src/map/storage.c
@@ -717,7 +717,9 @@ int storage_guild_storage_quit(struct map_session_data* sd, int flag) {
return 0;
}
-void do_init_gstorage(void) {
+void do_init_gstorage(bool minimal) {
+ if (minimal)
+ return;
gstorage->db = idb_alloc(DB_OPT_RELEASE_DATA);
}
void do_final_gstorage(void) {
diff --git a/src/map/storage.h b/src/map/storage.h
index 9258e0265..8a10c9f3b 100644
--- a/src/map/storage.h
+++ b/src/map/storage.h
@@ -36,7 +36,7 @@ struct guild_storage_interface {
struct guild_storage *(*id2storage) (int guild_id);
struct guild_storage *(*id2storage2) (int guild_id);
/* */
- void (*init) (void);
+ void (*init) (bool minimal);
void (*final) (void);
/* */
int (*delete) (int guild_id);
diff --git a/src/map/unit.c b/src/map/unit.c
index 08e97cfee..b1240def2 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -1966,7 +1966,7 @@ int unit_skillcastcancel(struct block_list *bl,int type)
else
ret = timer->delete( ud->skilltimer, skill->castend_id );
if( ret < 0 )
- ShowError("delete timer error : skill_id : %d\n",ret);
+ ShowError("delete timer error %d : skill %d (%s)\n",ret,skill_id,skill->get_name(skill_id));
ud->skilltimer = INVALID_TIMER;
@@ -2573,7 +2573,10 @@ int unit_free(struct block_list *bl, clr_type clrtype) {
return 0;
}
-int do_init_unit(void) {
+int do_init_unit(bool minimal) {
+ if (minimal)
+ return 0;
+
timer->add_func_list(unit->attack_timer, "unit_attack_timer");
timer->add_func_list(unit->walktoxy_timer,"unit_walktoxy_timer");
timer->add_func_list(unit->walktobl_sub, "unit_walktobl_sub");
diff --git a/src/map/unit.h b/src/map/unit.h
index 0567688a1..8220b7e8f 100644
--- a/src/map/unit.h
+++ b/src/map/unit.h
@@ -72,7 +72,7 @@ extern const short dirx[8];
extern const short diry[8];
struct unit_interface {
- int (*init) (void);
+ int (*init) (bool minimal);
int (*final) (void);
/* */
struct unit_data* (*bl2ud) (struct block_list *bl);
diff --git a/src/map/vending.c b/src/map/vending.c
index 7d6d02cfb..c7a2dfa68 100644
--- a/src/map/vending.c
+++ b/src/map/vending.c
@@ -360,7 +360,7 @@ void final(void) {
db_destroy(vending->db);
}
-void init(void) {
+void init(bool minimal) {
vending->db = idb_alloc(DB_OPT_BASE);
vending->next_id = 0;
}
diff --git a/src/map/vending.h b/src/map/vending.h
index 968811ecd..b760bf064 100644
--- a/src/map/vending.h
+++ b/src/map/vending.h
@@ -20,7 +20,7 @@ struct vending_interface {
unsigned int next_id;/* next vender id */
DBMap *db;
/* */
- void (*init) (void);
+ void (*init) (bool minimal);
void (*final) (void);
/* */
void (*close) (struct map_session_data* sd);
diff --git a/src/plugins/HPMHooking/HPMHooking.GetSymbol.inc b/src/plugins/HPMHooking/HPMHooking.GetSymbol.inc
index c3845675c..8482b9f80 100644
--- a/src/plugins/HPMHooking/HPMHooking.GetSymbol.inc
+++ b/src/plugins/HPMHooking/HPMHooking.GetSymbol.inc
@@ -30,6 +30,7 @@ if( !(mob = GET_SYMBOL("mob") ) ) return false;
if( !(npc = GET_SYMBOL("npc") ) ) return false;
if( !(party = GET_SYMBOL("party") ) ) return false;
if( !(path = GET_SYMBOL("path") ) ) return false;
+if( !(pcg = GET_SYMBOL("pc_groups") ) ) return false;
if( !(pc = GET_SYMBOL("pc") ) ) return false;
if( !(pet = GET_SYMBOL("pet") ) ) return false;
if( !(quest = GET_SYMBOL("quest") ) ) return false;
diff --git a/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc
index 87d169e1c..a4609ceed 100644
--- a/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc
@@ -3251,6 +3251,10 @@ struct {
struct HPMHookPoint *HP_npc_delsrcfile_post;
struct HPMHookPoint *HP_npc_parsename_pre;
struct HPMHookPoint *HP_npc_parsename_post;
+ struct HPMHookPoint *HP_npc_parseview_pre;
+ struct HPMHookPoint *HP_npc_parseview_post;
+ struct HPMHookPoint *HP_npc_viewisid_pre;
+ struct HPMHookPoint *HP_npc_viewisid_post;
struct HPMHookPoint *HP_npc_add_warp_pre;
struct HPMHookPoint *HP_npc_add_warp_post;
struct HPMHookPoint *HP_npc_parse_warp_pre;
@@ -3417,6 +3421,30 @@ struct {
struct HPMHookPoint *HP_path_check_distance_post;
struct HPMHookPoint *HP_path_distance_pre;
struct HPMHookPoint *HP_path_distance_post;
+ struct HPMHookPoint *HP_pcg_init_pre;
+ struct HPMHookPoint *HP_pcg_init_post;
+ struct HPMHookPoint *HP_pcg_final_pre;
+ struct HPMHookPoint *HP_pcg_final_post;
+ struct HPMHookPoint *HP_pcg_reload_pre;
+ struct HPMHookPoint *HP_pcg_reload_post;
+ struct HPMHookPoint *HP_pcg_get_dummy_group_pre;
+ struct HPMHookPoint *HP_pcg_get_dummy_group_post;
+ struct HPMHookPoint *HP_pcg_exists_pre;
+ struct HPMHookPoint *HP_pcg_exists_post;
+ struct HPMHookPoint *HP_pcg_id2group_pre;
+ struct HPMHookPoint *HP_pcg_id2group_post;
+ struct HPMHookPoint *HP_pcg_has_permission_pre;
+ struct HPMHookPoint *HP_pcg_has_permission_post;
+ struct HPMHookPoint *HP_pcg_should_log_commands_pre;
+ struct HPMHookPoint *HP_pcg_should_log_commands_post;
+ struct HPMHookPoint *HP_pcg_get_name_pre;
+ struct HPMHookPoint *HP_pcg_get_name_post;
+ struct HPMHookPoint *HP_pcg_get_level_pre;
+ struct HPMHookPoint *HP_pcg_get_level_post;
+ struct HPMHookPoint *HP_pcg_get_idx_pre;
+ struct HPMHookPoint *HP_pcg_get_idx_post;
+ struct HPMHookPoint *HP_pcg_add_permission_pre;
+ struct HPMHookPoint *HP_pcg_add_permission_post;
struct HPMHookPoint *HP_pc_init_pre;
struct HPMHookPoint *HP_pc_init_post;
struct HPMHookPoint *HP_pc_final_pre;
@@ -8150,6 +8178,10 @@ struct {
int HP_npc_delsrcfile_post;
int HP_npc_parsename_pre;
int HP_npc_parsename_post;
+ int HP_npc_parseview_pre;
+ int HP_npc_parseview_post;
+ int HP_npc_viewisid_pre;
+ int HP_npc_viewisid_post;
int HP_npc_add_warp_pre;
int HP_npc_add_warp_post;
int HP_npc_parse_warp_pre;
@@ -8316,6 +8348,30 @@ struct {
int HP_path_check_distance_post;
int HP_path_distance_pre;
int HP_path_distance_post;
+ int HP_pcg_init_pre;
+ int HP_pcg_init_post;
+ int HP_pcg_final_pre;
+ int HP_pcg_final_post;
+ int HP_pcg_reload_pre;
+ int HP_pcg_reload_post;
+ int HP_pcg_get_dummy_group_pre;
+ int HP_pcg_get_dummy_group_post;
+ int HP_pcg_exists_pre;
+ int HP_pcg_exists_post;
+ int HP_pcg_id2group_pre;
+ int HP_pcg_id2group_post;
+ int HP_pcg_has_permission_pre;
+ int HP_pcg_has_permission_post;
+ int HP_pcg_should_log_commands_pre;
+ int HP_pcg_should_log_commands_post;
+ int HP_pcg_get_name_pre;
+ int HP_pcg_get_name_post;
+ int HP_pcg_get_level_pre;
+ int HP_pcg_get_level_post;
+ int HP_pcg_get_idx_pre;
+ int HP_pcg_get_idx_post;
+ int HP_pcg_add_permission_pre;
+ int HP_pcg_add_permission_post;
int HP_pc_init_pre;
int HP_pc_init_post;
int HP_pc_final_pre;
@@ -9829,6 +9885,7 @@ struct {
struct npc_interface npc;
struct party_interface party;
struct path_interface path;
+ struct pc_groups_interface pcg;
struct pc_interface pc;
struct pet_interface pet;
struct quest_interface quest;
diff --git a/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc
index 97761842e..7e357b142 100644
--- a/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc
@@ -1652,6 +1652,8 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(npc->addsrcfile, HP_npc_addsrcfile) },
{ HP_POP(npc->delsrcfile, HP_npc_delsrcfile) },
{ HP_POP(npc->parsename, HP_npc_parsename) },
+ { HP_POP(npc->parseview, HP_npc_parseview) },
+ { HP_POP(npc->viewisid, HP_npc_viewisid) },
{ HP_POP(npc->add_warp, HP_npc_add_warp) },
{ HP_POP(npc->parse_warp, HP_npc_parse_warp) },
{ HP_POP(npc->parse_shop, HP_npc_parse_shop) },
@@ -1737,6 +1739,19 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(path->search_long, HP_path_search_long) },
{ HP_POP(path->check_distance, HP_path_check_distance) },
{ HP_POP(path->distance, HP_path_distance) },
+/* pcg */
+ { HP_POP(pcg->init, HP_pcg_init) },
+ { HP_POP(pcg->final, HP_pcg_final) },
+ { HP_POP(pcg->reload, HP_pcg_reload) },
+ { HP_POP(pcg->get_dummy_group, HP_pcg_get_dummy_group) },
+ { HP_POP(pcg->exists, HP_pcg_exists) },
+ { HP_POP(pcg->id2group, HP_pcg_id2group) },
+ { HP_POP(pcg->has_permission, HP_pcg_has_permission) },
+ { HP_POP(pcg->should_log_commands, HP_pcg_should_log_commands) },
+ { HP_POP(pcg->get_name, HP_pcg_get_name) },
+ { HP_POP(pcg->get_level, HP_pcg_get_level) },
+ { HP_POP(pcg->get_idx, HP_pcg_get_idx) },
+ { HP_POP(pcg->add_permission, HP_pcg_add_permission) },
/* pc */
{ HP_POP(pc->init, HP_pc_init) },
{ HP_POP(pc->final, HP_pc_final) },
diff --git a/src/plugins/HPMHooking/HPMHooking.Hooks.inc b/src/plugins/HPMHooking/HPMHooking.Hooks.inc
index 7ba95face..6ad4d4199 100644
--- a/src/plugins/HPMHooking/HPMHooking.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking.Hooks.inc
@@ -5,13 +5,13 @@
// as it will get overwritten.
/* atcommand */
-void HP_atcommand_init(void) {
+void HP_atcommand_init(bool minimal) {
int hIndex = 0;
if( HPMHooks.count.HP_atcommand_init_pre ) {
- void (*preHookFunc) (void);
+ void (*preHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_atcommand_init_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_atcommand_init_pre[hIndex].func;
- preHookFunc();
+ preHookFunc(&minimal);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -19,13 +19,13 @@ void HP_atcommand_init(void) {
}
}
{
- HPMHooks.source.atcommand.init();
+ HPMHooks.source.atcommand.init(minimal);
}
if( HPMHooks.count.HP_atcommand_init_post ) {
- void (*postHookFunc) (void);
+ void (*postHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_atcommand_init_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_atcommand_init_post[hIndex].func;
- postHookFunc();
+ postHookFunc(&minimal);
}
}
return;
@@ -763,14 +763,14 @@ void HP_atcommand_base_commands(void) {
}
return;
}
-bool HP_atcommand_add(char *name, AtCommandFunc func) {
+bool HP_atcommand_add(char *name, AtCommandFunc func, bool replace) {
int hIndex = 0;
bool retVal___ = false;
if( HPMHooks.count.HP_atcommand_add_pre ) {
- bool (*preHookFunc) (char *name, AtCommandFunc *func);
+ bool (*preHookFunc) (char *name, AtCommandFunc *func, bool *replace);
for(hIndex = 0; hIndex < HPMHooks.count.HP_atcommand_add_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_atcommand_add_pre[hIndex].func;
- retVal___ = preHookFunc(name, &func);
+ retVal___ = preHookFunc(name, &func, &replace);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -778,25 +778,25 @@ bool HP_atcommand_add(char *name, AtCommandFunc func) {
}
}
{
- retVal___ = HPMHooks.source.atcommand.add(name, func);
+ retVal___ = HPMHooks.source.atcommand.add(name, func, replace);
}
if( HPMHooks.count.HP_atcommand_add_post ) {
- bool (*postHookFunc) (bool retVal___, char *name, AtCommandFunc *func);
+ bool (*postHookFunc) (bool retVal___, char *name, AtCommandFunc *func, bool *replace);
for(hIndex = 0; hIndex < HPMHooks.count.HP_atcommand_add_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_atcommand_add_post[hIndex].func;
- retVal___ = postHookFunc(retVal___, name, &func);
+ retVal___ = postHookFunc(retVal___, name, &func, &replace);
}
}
return retVal___;
}
/* battle */
-void HP_battle_init(void) {
+void HP_battle_init(bool minimal) {
int hIndex = 0;
if( HPMHooks.count.HP_battle_init_pre ) {
- void (*preHookFunc) (void);
+ void (*preHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_battle_init_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_battle_init_pre[hIndex].func;
- preHookFunc();
+ preHookFunc(&minimal);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -804,13 +804,13 @@ void HP_battle_init(void) {
}
}
{
- HPMHooks.source.battle.init();
+ HPMHooks.source.battle.init(minimal);
}
if( HPMHooks.count.HP_battle_init_post ) {
- void (*postHookFunc) (void);
+ void (*postHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_battle_init_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_battle_init_post[hIndex].func;
- postHookFunc();
+ postHookFunc(&minimal);
}
}
return;
@@ -2087,13 +2087,13 @@ int HP_battle_damage_area(struct block_list *bl, va_list ap) {
return retVal___;
}
/* bg */
-void HP_bg_init(void) {
+void HP_bg_init(bool minimal) {
int hIndex = 0;
if( HPMHooks.count.HP_bg_init_pre ) {
- void (*preHookFunc) (void);
+ void (*preHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_bg_init_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_bg_init_pre[hIndex].func;
- preHookFunc();
+ preHookFunc(&minimal);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -2101,13 +2101,13 @@ void HP_bg_init(void) {
}
}
{
- HPMHooks.source.bg.init();
+ HPMHooks.source.bg.init(minimal);
}
if( HPMHooks.count.HP_bg_init_post ) {
- void (*postHookFunc) (void);
+ void (*postHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_bg_init_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_bg_init_post[hIndex].func;
- postHookFunc();
+ postHookFunc(&minimal);
}
}
return;
@@ -3382,14 +3382,14 @@ int HP_chrif_final(void) {
}
return retVal___;
}
-int HP_chrif_init(void) {
+int HP_chrif_init(bool minimal) {
int hIndex = 0;
int retVal___ = 0;
if( HPMHooks.count.HP_chrif_init_pre ) {
- int (*preHookFunc) (void);
+ int (*preHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_chrif_init_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_chrif_init_pre[hIndex].func;
- retVal___ = preHookFunc();
+ retVal___ = preHookFunc(&minimal);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -3397,13 +3397,13 @@ int HP_chrif_init(void) {
}
}
{
- retVal___ = HPMHooks.source.chrif.init();
+ retVal___ = HPMHooks.source.chrif.init(minimal);
}
if( HPMHooks.count.HP_chrif_init_post ) {
- int (*postHookFunc) (int retVal___);
+ int (*postHookFunc) (int retVal___, bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_chrif_init_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_chrif_init_post[hIndex].func;
- retVal___ = postHookFunc(retVal___);
+ retVal___ = postHookFunc(retVal___, &minimal);
}
}
return retVal___;
@@ -5152,14 +5152,14 @@ int HP_chrif_parse(int fd) {
return retVal___;
}
/* clif */
-int HP_clif_init(void) {
+int HP_clif_init(bool minimal) {
int hIndex = 0;
int retVal___ = 0;
if( HPMHooks.count.HP_clif_init_pre ) {
- int (*preHookFunc) (void);
+ int (*preHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_init_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_clif_init_pre[hIndex].func;
- retVal___ = preHookFunc();
+ retVal___ = preHookFunc(&minimal);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -5167,13 +5167,13 @@ int HP_clif_init(void) {
}
}
{
- retVal___ = HPMHooks.source.clif.init();
+ retVal___ = HPMHooks.source.clif.init(minimal);
}
if( HPMHooks.count.HP_clif_init_post ) {
- int (*postHookFunc) (int retVal___);
+ int (*postHookFunc) (int retVal___, bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_init_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_clif_init_post[hIndex].func;
- retVal___ = postHookFunc(retVal___);
+ retVal___ = postHookFunc(retVal___, &minimal);
}
}
return retVal___;
@@ -21901,13 +21901,13 @@ int HP_duel_checktime(struct map_session_data *sd) {
}
return retVal___;
}
-void HP_duel_init(void) {
+void HP_duel_init(bool minimal) {
int hIndex = 0;
if( HPMHooks.count.HP_duel_init_pre ) {
- void (*preHookFunc) (void);
+ void (*preHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_duel_init_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_duel_init_pre[hIndex].func;
- preHookFunc();
+ preHookFunc(&minimal);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -21915,13 +21915,13 @@ void HP_duel_init(void) {
}
}
{
- HPMHooks.source.duel.init();
+ HPMHooks.source.duel.init(minimal);
}
if( HPMHooks.count.HP_duel_init_post ) {
- void (*postHookFunc) (void);
+ void (*postHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_duel_init_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_duel_init_post[hIndex].func;
- postHookFunc();
+ postHookFunc(&minimal);
}
}
return;
@@ -21952,14 +21952,14 @@ void HP_duel_final(void) {
return;
}
/* elemental */
-int HP_elemental_init(void) {
+int HP_elemental_init(bool minimal) {
int hIndex = 0;
int retVal___ = 0;
if( HPMHooks.count.HP_elemental_init_pre ) {
- int (*preHookFunc) (void);
+ int (*preHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_elemental_init_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_elemental_init_pre[hIndex].func;
- retVal___ = preHookFunc();
+ retVal___ = preHookFunc(&minimal);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -21967,13 +21967,13 @@ int HP_elemental_init(void) {
}
}
{
- retVal___ = HPMHooks.source.elemental.init();
+ retVal___ = HPMHooks.source.elemental.init(minimal);
}
if( HPMHooks.count.HP_elemental_init_post ) {
- int (*postHookFunc) (int retVal___);
+ int (*postHookFunc) (int retVal___, bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_elemental_init_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_elemental_init_post[hIndex].func;
- retVal___ = postHookFunc(retVal___);
+ retVal___ = postHookFunc(retVal___, &minimal);
}
}
return retVal___;
@@ -22792,13 +22792,13 @@ int HP_elemental_read_db(void) {
return retVal___;
}
/* guild */
-void HP_guild_init(void) {
+void HP_guild_init(bool minimal) {
int hIndex = 0;
if( HPMHooks.count.HP_guild_init_pre ) {
- void (*preHookFunc) (void);
+ void (*preHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_guild_init_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_guild_init_pre[hIndex].func;
- preHookFunc();
+ preHookFunc(&minimal);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -22806,13 +22806,13 @@ void HP_guild_init(void) {
}
}
{
- HPMHooks.source.guild.init();
+ HPMHooks.source.guild.init(minimal);
}
if( HPMHooks.count.HP_guild_init_post ) {
- void (*postHookFunc) (void);
+ void (*postHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_guild_init_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_guild_init_post[hIndex].func;
- postHookFunc();
+ postHookFunc(&minimal);
}
}
return;
@@ -25094,13 +25094,13 @@ struct guild_storage* HP_gstorage_id2storage2(int guild_id) {
}
return retVal___;
}
-void HP_gstorage_init(void) {
+void HP_gstorage_init(bool minimal) {
int hIndex = 0;
if( HPMHooks.count.HP_gstorage_init_pre ) {
- void (*preHookFunc) (void);
+ void (*preHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_gstorage_init_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_gstorage_init_pre[hIndex].func;
- preHookFunc();
+ preHookFunc(&minimal);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -25108,13 +25108,13 @@ void HP_gstorage_init(void) {
}
}
{
- HPMHooks.source.gstorage.init();
+ HPMHooks.source.gstorage.init(minimal);
}
if( HPMHooks.count.HP_gstorage_init_post ) {
- void (*postHookFunc) (void);
+ void (*postHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_gstorage_init_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_gstorage_init_post[hIndex].func;
- postHookFunc();
+ postHookFunc(&minimal);
}
}
return;
@@ -25490,13 +25490,13 @@ DBData HP_gstorage_create(DBKey key, va_list args) {
return retVal___;
}
/* homun */
-void HP_homun_init(void) {
+void HP_homun_init(bool minimal) {
int hIndex = 0;
if( HPMHooks.count.HP_homun_init_pre ) {
- void (*preHookFunc) (void);
+ void (*preHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_homun_init_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_homun_init_pre[hIndex].func;
- preHookFunc();
+ preHookFunc(&minimal);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -25504,13 +25504,13 @@ void HP_homun_init(void) {
}
}
{
- HPMHooks.source.homun.init();
+ HPMHooks.source.homun.init(minimal);
}
if( HPMHooks.count.HP_homun_init_post ) {
- void (*postHookFunc) (void);
+ void (*postHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_homun_init_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_homun_init_post[hIndex].func;
- postHookFunc();
+ postHookFunc(&minimal);
}
}
return;
@@ -26670,13 +26670,13 @@ void HP_homun_delspiritball(struct homun_data *hd, int count, int type) {
return;
}
/* instance */
-void HP_instance_init(void) {
+void HP_instance_init(bool minimal) {
int hIndex = 0;
if( HPMHooks.count.HP_instance_init_pre ) {
- void (*preHookFunc) (void);
+ void (*preHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_instance_init_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_instance_init_pre[hIndex].func;
- preHookFunc();
+ preHookFunc(&minimal);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -26684,13 +26684,13 @@ void HP_instance_init(void) {
}
}
{
- HPMHooks.source.instance.init();
+ HPMHooks.source.instance.init(minimal);
}
if( HPMHooks.count.HP_instance_init_post ) {
- void (*postHookFunc) (void);
+ void (*postHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_instance_init_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_instance_init_post[hIndex].func;
- postHookFunc();
+ postHookFunc(&minimal);
}
}
return;
@@ -30442,13 +30442,13 @@ void HP_intif_pDeleteHomunculusOk(int fd) {
return;
}
/* ircbot */
-void HP_ircbot_init(void) {
+void HP_ircbot_init(bool minimal) {
int hIndex = 0;
if( HPMHooks.count.HP_ircbot_init_pre ) {
- void (*preHookFunc) (void);
+ void (*preHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_ircbot_init_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_ircbot_init_pre[hIndex].func;
- preHookFunc();
+ preHookFunc(&minimal);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -30456,13 +30456,13 @@ void HP_ircbot_init(void) {
}
}
{
- HPMHooks.source.ircbot.init();
+ HPMHooks.source.ircbot.init(minimal);
}
if( HPMHooks.count.HP_ircbot_init_post ) {
- void (*postHookFunc) (void);
+ void (*postHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_ircbot_init_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_ircbot_init_post[hIndex].func;
- postHookFunc();
+ postHookFunc(&minimal);
}
}
return;
@@ -30848,13 +30848,13 @@ void HP_ircbot_usernick(int fd, char *cmd, char *source, char *target, char *msg
return;
}
/* itemdb */
-void HP_itemdb_init(void) {
+void HP_itemdb_init(bool minimal) {
int hIndex = 0;
if( HPMHooks.count.HP_itemdb_init_pre ) {
- void (*preHookFunc) (void);
+ void (*preHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_init_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_itemdb_init_pre[hIndex].func;
- preHookFunc();
+ preHookFunc(&minimal);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -30862,13 +30862,13 @@ void HP_itemdb_init(void) {
}
}
{
- HPMHooks.source.itemdb.init();
+ HPMHooks.source.itemdb.init(minimal);
}
if( HPMHooks.count.HP_itemdb_init_post ) {
- void (*postHookFunc) (void);
+ void (*postHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_init_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_itemdb_init_post[hIndex].func;
- postHookFunc();
+ postHookFunc(&minimal);
}
}
return;
@@ -32354,13 +32354,13 @@ int HP_itemdb_uid_load(void) {
}
return retVal___;
}
-void HP_itemdb_read(void) {
+void HP_itemdb_read(bool minimal) {
int hIndex = 0;
if( HPMHooks.count.HP_itemdb_read_pre ) {
- void (*preHookFunc) (void);
+ void (*preHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_read_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_itemdb_read_pre[hIndex].func;
- preHookFunc();
+ preHookFunc(&minimal);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -32368,13 +32368,13 @@ void HP_itemdb_read(void) {
}
}
{
- HPMHooks.source.itemdb.read();
+ HPMHooks.source.itemdb.read(minimal);
}
if( HPMHooks.count.HP_itemdb_read_post ) {
- void (*postHookFunc) (void);
+ void (*postHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_read_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_itemdb_read_post[hIndex].func;
- postHookFunc();
+ postHookFunc(&minimal);
}
}
return;
@@ -35895,11 +35895,11 @@ int HP_map_readfromcache(struct map_data *m, char *buffer) {
}
return retVal___;
}
-int HP_map_addmap(char *mapname) {
+int HP_map_addmap(const char *mapname) {
int hIndex = 0;
int retVal___ = 0;
if( HPMHooks.count.HP_map_addmap_pre ) {
- int (*preHookFunc) (char *mapname);
+ int (*preHookFunc) (const char *mapname);
for(hIndex = 0; hIndex < HPMHooks.count.HP_map_addmap_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_map_addmap_pre[hIndex].func;
retVal___ = preHookFunc(mapname);
@@ -35913,7 +35913,7 @@ int HP_map_addmap(char *mapname) {
retVal___ = HPMHooks.source.map.addmap(mapname);
}
if( HPMHooks.count.HP_map_addmap_post ) {
- int (*postHookFunc) (int retVal___, char *mapname);
+ int (*postHookFunc) (int retVal___, const char *mapname);
for(hIndex = 0; hIndex < HPMHooks.count.HP_map_addmap_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_map_addmap_post[hIndex].func;
retVal___ = postHookFunc(retVal___, mapname);
@@ -37154,13 +37154,13 @@ bool HP_mapreg_config_read(const char *w1, const char *w2) {
return retVal___;
}
/* mercenary */
-void HP_mercenary_init(void) {
+void HP_mercenary_init(bool minimal) {
int hIndex = 0;
if( HPMHooks.count.HP_mercenary_init_pre ) {
- void (*preHookFunc) (void);
+ void (*preHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_mercenary_init_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_mercenary_init_pre[hIndex].func;
- preHookFunc();
+ preHookFunc(&minimal);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -37168,13 +37168,13 @@ void HP_mercenary_init(void) {
}
}
{
- HPMHooks.source.mercenary.init();
+ HPMHooks.source.mercenary.init(minimal);
}
if( HPMHooks.count.HP_mercenary_init_post ) {
- void (*postHookFunc) (void);
+ void (*postHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_mercenary_init_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_mercenary_init_post[hIndex].func;
- postHookFunc();
+ postHookFunc(&minimal);
}
}
return;
@@ -37802,14 +37802,14 @@ bool HP_mercenary_read_skill_db_sub(char *str[], int columns, int current) {
return retVal___;
}
/* mob */
-int HP_mob_init(void) {
+int HP_mob_init(bool mimimal) {
int hIndex = 0;
int retVal___ = 0;
if( HPMHooks.count.HP_mob_init_pre ) {
- int (*preHookFunc) (void);
+ int (*preHookFunc) (bool *mimimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_init_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_mob_init_pre[hIndex].func;
- retVal___ = preHookFunc();
+ retVal___ = preHookFunc(&mimimal);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -37817,13 +37817,13 @@ int HP_mob_init(void) {
}
}
{
- retVal___ = HPMHooks.source.mob.init();
+ retVal___ = HPMHooks.source.mob.init(mimimal);
}
if( HPMHooks.count.HP_mob_init_post ) {
- int (*postHookFunc) (int retVal___);
+ int (*postHookFunc) (int retVal___, bool *mimimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_init_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_mob_init_post[hIndex].func;
- retVal___ = postHookFunc(retVal___);
+ retVal___ = postHookFunc(retVal___, &mimimal);
}
}
return retVal___;
@@ -40298,13 +40298,13 @@ bool HP_mob_readdb_itemratio(char *str[], int columns, int current) {
}
return retVal___;
}
-void HP_mob_load(void) {
+void HP_mob_load(bool minimal) {
int hIndex = 0;
if( HPMHooks.count.HP_mob_load_pre ) {
- void (*preHookFunc) (void);
+ void (*preHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_load_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_mob_load_pre[hIndex].func;
- preHookFunc();
+ preHookFunc(&minimal);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -40312,13 +40312,13 @@ void HP_mob_load(void) {
}
}
{
- HPMHooks.source.mob.load();
+ HPMHooks.source.mob.load(minimal);
}
if( HPMHooks.count.HP_mob_load_post ) {
- void (*postHookFunc) (void);
+ void (*postHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_load_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_mob_load_post[hIndex].func;
- postHookFunc();
+ postHookFunc(&minimal);
}
}
return;
@@ -40349,14 +40349,14 @@ void HP_mob_clear_spawninfo(void) {
return;
}
/* npc */
-int HP_npc_init(void) {
+int HP_npc_init(bool minimal) {
int hIndex = 0;
int retVal___ = 0;
if( HPMHooks.count.HP_npc_init_pre ) {
- int (*preHookFunc) (void);
+ int (*preHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_npc_init_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_npc_init_pre[hIndex].func;
- retVal___ = preHookFunc();
+ retVal___ = preHookFunc(&minimal);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -40364,13 +40364,13 @@ int HP_npc_init(void) {
}
}
{
- retVal___ = HPMHooks.source.npc.init();
+ retVal___ = HPMHooks.source.npc.init(minimal);
}
if( HPMHooks.count.HP_npc_init_post ) {
- int (*postHookFunc) (int retVal___);
+ int (*postHookFunc) (int retVal___, bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_npc_init_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_npc_init_post[hIndex].func;
- retVal___ = postHookFunc(retVal___);
+ retVal___ = postHookFunc(retVal___, &minimal);
}
}
return retVal___;
@@ -41845,6 +41845,58 @@ void HP_npc_parsename(struct npc_data *nd, const char *name, const char *start,
}
return;
}
+int HP_npc_parseview(const char *w4, const char *start, const char *buffer, const char *filepath) {
+ int hIndex = 0;
+ int retVal___ = 0;
+ if( HPMHooks.count.HP_npc_parseview_pre ) {
+ int (*preHookFunc) (const char *w4, const char *start, const char *buffer, const char *filepath);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_npc_parseview_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_npc_parseview_pre[hIndex].func;
+ retVal___ = preHookFunc(w4, start, buffer, filepath);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.npc.parseview(w4, start, buffer, filepath);
+ }
+ if( HPMHooks.count.HP_npc_parseview_post ) {
+ int (*postHookFunc) (int retVal___, const char *w4, const char *start, const char *buffer, const char *filepath);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_npc_parseview_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_npc_parseview_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, w4, start, buffer, filepath);
+ }
+ }
+ return retVal___;
+}
+bool HP_npc_viewisid(const char *viewid) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if( HPMHooks.count.HP_npc_viewisid_pre ) {
+ bool (*preHookFunc) (const char *viewid);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_npc_viewisid_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_npc_viewisid_pre[hIndex].func;
+ retVal___ = preHookFunc(viewid);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.npc.viewisid(viewid);
+ }
+ if( HPMHooks.count.HP_npc_viewisid_post ) {
+ bool (*postHookFunc) (bool retVal___, const char *viewid);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_npc_viewisid_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_npc_viewisid_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, viewid);
+ }
+ }
+ return retVal___;
+}
struct npc_data* HP_npc_add_warp(char *name, short from_mapid, short from_x, short from_y, short xs, short ys, unsigned short to_mapindex, short to_x, short to_y) {
int hIndex = 0;
struct npc_data* retVal___ = NULL;
@@ -42338,30 +42390,31 @@ const char* HP_npc_parse_mapflag(char *w1, char *w2, char *w3, char *w4, const c
}
return retVal___;
}
-void HP_npc_parsesrcfile(const char *filepath, bool runOnInit) {
+int HP_npc_parsesrcfile(const char *filepath, bool runOnInit) {
int hIndex = 0;
+ int retVal___ = 0;
if( HPMHooks.count.HP_npc_parsesrcfile_pre ) {
- void (*preHookFunc) (const char *filepath, bool *runOnInit);
+ int (*preHookFunc) (const char *filepath, bool *runOnInit);
for(hIndex = 0; hIndex < HPMHooks.count.HP_npc_parsesrcfile_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_npc_parsesrcfile_pre[hIndex].func;
- preHookFunc(filepath, &runOnInit);
+ retVal___ = preHookFunc(filepath, &runOnInit);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
- return;
+ return retVal___;
}
}
{
- HPMHooks.source.npc.parsesrcfile(filepath, runOnInit);
+ retVal___ = HPMHooks.source.npc.parsesrcfile(filepath, runOnInit);
}
if( HPMHooks.count.HP_npc_parsesrcfile_post ) {
- void (*postHookFunc) (const char *filepath, bool *runOnInit);
+ int (*postHookFunc) (int retVal___, const char *filepath, bool *runOnInit);
for(hIndex = 0; hIndex < HPMHooks.count.HP_npc_parsesrcfile_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_npc_parsesrcfile_post[hIndex].func;
- postHookFunc(filepath, &runOnInit);
+ retVal___ = postHookFunc(retVal___, filepath, &runOnInit);
}
}
- return;
+ return retVal___;
}
int HP_npc_script_event(struct map_session_data *sd, enum npce_event type) {
int hIndex = 0;
@@ -42632,13 +42685,13 @@ int HP_npc_secure_timeout_timer(int tid, int64 tick, int id, intptr_t data) {
return retVal___;
}
/* party */
-void HP_party_init(void) {
+void HP_party_init(bool minimal) {
int hIndex = 0;
if( HPMHooks.count.HP_party_init_pre ) {
- void (*preHookFunc) (void);
+ void (*preHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_party_init_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_party_init_pre[hIndex].func;
- preHookFunc();
+ preHookFunc(&minimal);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -42646,13 +42699,13 @@ void HP_party_init(void) {
}
}
{
- HPMHooks.source.party.init();
+ HPMHooks.source.party.init(minimal);
}
if( HPMHooks.count.HP_party_init_post ) {
- void (*postHookFunc) (void);
+ void (*postHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_party_init_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_party_init_post[hIndex].func;
- postHookFunc();
+ postHookFunc(&minimal);
}
}
return;
@@ -44014,14 +44067,324 @@ unsigned int HP_path_distance(int dx, int dy) {
}
return retVal___;
}
+/* pcg */
+void HP_pcg_init(void) {
+ int hIndex = 0;
+ if( HPMHooks.count.HP_pcg_init_pre ) {
+ void (*preHookFunc) (void);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_pcg_init_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_pcg_init_pre[hIndex].func;
+ preHookFunc();
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.pcg.init();
+ }
+ if( HPMHooks.count.HP_pcg_init_post ) {
+ void (*postHookFunc) (void);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_pcg_init_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_pcg_init_post[hIndex].func;
+ postHookFunc();
+ }
+ }
+ return;
+}
+void HP_pcg_final(void) {
+ int hIndex = 0;
+ if( HPMHooks.count.HP_pcg_final_pre ) {
+ void (*preHookFunc) (void);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_pcg_final_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_pcg_final_pre[hIndex].func;
+ preHookFunc();
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.pcg.final();
+ }
+ if( HPMHooks.count.HP_pcg_final_post ) {
+ void (*postHookFunc) (void);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_pcg_final_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_pcg_final_post[hIndex].func;
+ postHookFunc();
+ }
+ }
+ return;
+}
+void HP_pcg_reload(void) {
+ int hIndex = 0;
+ if( HPMHooks.count.HP_pcg_reload_pre ) {
+ void (*preHookFunc) (void);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_pcg_reload_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_pcg_reload_pre[hIndex].func;
+ preHookFunc();
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.pcg.reload();
+ }
+ if( HPMHooks.count.HP_pcg_reload_post ) {
+ void (*postHookFunc) (void);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_pcg_reload_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_pcg_reload_post[hIndex].func;
+ postHookFunc();
+ }
+ }
+ return;
+}
+GroupSettings* HP_pcg_get_dummy_group(void) {
+ int hIndex = 0;
+ GroupSettings* retVal___ = NULL;
+ if( HPMHooks.count.HP_pcg_get_dummy_group_pre ) {
+ GroupSettings* (*preHookFunc) (void);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_pcg_get_dummy_group_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_pcg_get_dummy_group_pre[hIndex].func;
+ retVal___ = preHookFunc();
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.pcg.get_dummy_group();
+ }
+ if( HPMHooks.count.HP_pcg_get_dummy_group_post ) {
+ GroupSettings* (*postHookFunc) (GroupSettings* retVal___);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_pcg_get_dummy_group_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_pcg_get_dummy_group_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___);
+ }
+ }
+ return retVal___;
+}
+bool HP_pcg_exists(int group_id) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if( HPMHooks.count.HP_pcg_exists_pre ) {
+ bool (*preHookFunc) (int *group_id);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_pcg_exists_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_pcg_exists_pre[hIndex].func;
+ retVal___ = preHookFunc(&group_id);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.pcg.exists(group_id);
+ }
+ if( HPMHooks.count.HP_pcg_exists_post ) {
+ bool (*postHookFunc) (bool retVal___, int *group_id);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_pcg_exists_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_pcg_exists_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, &group_id);
+ }
+ }
+ return retVal___;
+}
+GroupSettings* HP_pcg_id2group(int group_id) {
+ int hIndex = 0;
+ GroupSettings* retVal___ = NULL;
+ if( HPMHooks.count.HP_pcg_id2group_pre ) {
+ GroupSettings* (*preHookFunc) (int *group_id);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_pcg_id2group_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_pcg_id2group_pre[hIndex].func;
+ retVal___ = preHookFunc(&group_id);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.pcg.id2group(group_id);
+ }
+ if( HPMHooks.count.HP_pcg_id2group_post ) {
+ GroupSettings* (*postHookFunc) (GroupSettings* retVal___, int *group_id);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_pcg_id2group_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_pcg_id2group_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, &group_id);
+ }
+ }
+ return retVal___;
+}
+bool HP_pcg_has_permission(GroupSettings *group, unsigned int permission) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if( HPMHooks.count.HP_pcg_has_permission_pre ) {
+ bool (*preHookFunc) (GroupSettings *group, unsigned int *permission);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_pcg_has_permission_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_pcg_has_permission_pre[hIndex].func;
+ retVal___ = preHookFunc(group, &permission);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.pcg.has_permission(group, permission);
+ }
+ if( HPMHooks.count.HP_pcg_has_permission_post ) {
+ bool (*postHookFunc) (bool retVal___, GroupSettings *group, unsigned int *permission);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_pcg_has_permission_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_pcg_has_permission_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, group, &permission);
+ }
+ }
+ return retVal___;
+}
+bool HP_pcg_should_log_commands(GroupSettings *group) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if( HPMHooks.count.HP_pcg_should_log_commands_pre ) {
+ bool (*preHookFunc) (GroupSettings *group);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_pcg_should_log_commands_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_pcg_should_log_commands_pre[hIndex].func;
+ retVal___ = preHookFunc(group);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.pcg.should_log_commands(group);
+ }
+ if( HPMHooks.count.HP_pcg_should_log_commands_post ) {
+ bool (*postHookFunc) (bool retVal___, GroupSettings *group);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_pcg_should_log_commands_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_pcg_should_log_commands_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, group);
+ }
+ }
+ return retVal___;
+}
+const char* HP_pcg_get_name(GroupSettings *group) {
+ int hIndex = 0;
+ const char* retVal___ = NULL;
+ if( HPMHooks.count.HP_pcg_get_name_pre ) {
+ const char* (*preHookFunc) (GroupSettings *group);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_pcg_get_name_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_pcg_get_name_pre[hIndex].func;
+ retVal___ = preHookFunc(group);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.pcg.get_name(group);
+ }
+ if( HPMHooks.count.HP_pcg_get_name_post ) {
+ const char* (*postHookFunc) (const char* retVal___, GroupSettings *group);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_pcg_get_name_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_pcg_get_name_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, group);
+ }
+ }
+ return retVal___;
+}
+int HP_pcg_get_level(GroupSettings *group) {
+ int hIndex = 0;
+ int retVal___ = 0;
+ if( HPMHooks.count.HP_pcg_get_level_pre ) {
+ int (*preHookFunc) (GroupSettings *group);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_pcg_get_level_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_pcg_get_level_pre[hIndex].func;
+ retVal___ = preHookFunc(group);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.pcg.get_level(group);
+ }
+ if( HPMHooks.count.HP_pcg_get_level_post ) {
+ int (*postHookFunc) (int retVal___, GroupSettings *group);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_pcg_get_level_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_pcg_get_level_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, group);
+ }
+ }
+ return retVal___;
+}
+int HP_pcg_get_idx(GroupSettings *group) {
+ int hIndex = 0;
+ int retVal___ = 0;
+ if( HPMHooks.count.HP_pcg_get_idx_pre ) {
+ int (*preHookFunc) (GroupSettings *group);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_pcg_get_idx_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_pcg_get_idx_pre[hIndex].func;
+ retVal___ = preHookFunc(group);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.pcg.get_idx(group);
+ }
+ if( HPMHooks.count.HP_pcg_get_idx_post ) {
+ int (*postHookFunc) (int retVal___, GroupSettings *group);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_pcg_get_idx_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_pcg_get_idx_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, group);
+ }
+ }
+ return retVal___;
+}
+unsigned int HP_pcg_add_permission(const char *name) {
+ int hIndex = 0;
+ unsigned int retVal___ = 0;
+ if( HPMHooks.count.HP_pcg_add_permission_pre ) {
+ unsigned int (*preHookFunc) (const char *name);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_pcg_add_permission_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_pcg_add_permission_pre[hIndex].func;
+ retVal___ = preHookFunc(name);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.pcg.add_permission(name);
+ }
+ if( HPMHooks.count.HP_pcg_add_permission_post ) {
+ unsigned int (*postHookFunc) (unsigned int retVal___, const char *name);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_pcg_add_permission_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_pcg_add_permission_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, name);
+ }
+ }
+ return retVal___;
+}
/* pc */
-void HP_pc_init(void) {
+void HP_pc_init(bool minimal) {
int hIndex = 0;
if( HPMHooks.count.HP_pc_init_pre ) {
- void (*preHookFunc) (void);
+ void (*preHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_init_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_pc_init_pre[hIndex].func;
- preHookFunc();
+ preHookFunc(&minimal);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -44029,13 +44392,13 @@ void HP_pc_init(void) {
}
}
{
- HPMHooks.source.pc.init();
+ HPMHooks.source.pc.init(minimal);
}
if( HPMHooks.count.HP_pc_init_post ) {
- void (*postHookFunc) (void);
+ void (*postHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_init_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_pc_init_post[hIndex].func;
- postHookFunc();
+ postHookFunc(&minimal);
}
}
return;
@@ -44195,11 +44558,11 @@ bool HP_pc_can_use_command(struct map_session_data *sd, const char *command) {
}
return retVal___;
}
-bool HP_pc_has_permission(struct map_session_data *sd, enum e_pc_permission permission) {
+bool HP_pc_has_permission(struct map_session_data *sd, unsigned int permission) {
int hIndex = 0;
bool retVal___ = false;
if( HPMHooks.count.HP_pc_has_permission_pre ) {
- bool (*preHookFunc) (struct map_session_data *sd, enum e_pc_permission *permission);
+ bool (*preHookFunc) (struct map_session_data *sd, unsigned int *permission);
for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_has_permission_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_pc_has_permission_pre[hIndex].func;
retVal___ = preHookFunc(sd, &permission);
@@ -44213,7 +44576,7 @@ bool HP_pc_has_permission(struct map_session_data *sd, enum e_pc_permission perm
retVal___ = HPMHooks.source.pc.has_permission(sd, permission);
}
if( HPMHooks.count.HP_pc_has_permission_post ) {
- bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, enum e_pc_permission *permission);
+ bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, unsigned int *permission);
for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_has_permission_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_pc_has_permission_post[hIndex].func;
retVal___ = postHookFunc(retVal___, sd, &permission);
@@ -49059,14 +49422,14 @@ void HP_pc_scdata_received(struct map_session_data *sd) {
return;
}
/* pet */
-int HP_pet_init(void) {
+int HP_pet_init(bool minimal) {
int hIndex = 0;
int retVal___ = 0;
if( HPMHooks.count.HP_pet_init_pre ) {
- int (*preHookFunc) (void);
+ int (*preHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_pet_init_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_pet_init_pre[hIndex].func;
- retVal___ = preHookFunc();
+ retVal___ = preHookFunc(&minimal);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -49074,13 +49437,13 @@ int HP_pet_init(void) {
}
}
{
- retVal___ = HPMHooks.source.pet.init();
+ retVal___ = HPMHooks.source.pet.init(minimal);
}
if( HPMHooks.count.HP_pet_init_post ) {
- int (*postHookFunc) (int retVal___);
+ int (*postHookFunc) (int retVal___, bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_pet_init_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_pet_init_post[hIndex].func;
- retVal___ = postHookFunc(retVal___);
+ retVal___ = postHookFunc(retVal___, &minimal);
}
}
return retVal___;
@@ -50085,13 +50448,13 @@ int HP_pet_read_db(void) {
return retVal___;
}
/* quest */
-void HP_quest_init(void) {
+void HP_quest_init(bool minimal) {
int hIndex = 0;
if( HPMHooks.count.HP_quest_init_pre ) {
- void (*preHookFunc) (void);
+ void (*preHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_quest_init_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_quest_init_pre[hIndex].func;
- preHookFunc();
+ preHookFunc(&minimal);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -50099,13 +50462,13 @@ void HP_quest_init(void) {
}
}
{
- HPMHooks.source.quest.init();
+ HPMHooks.source.quest.init(minimal);
}
if( HPMHooks.count.HP_quest_init_post ) {
- void (*postHookFunc) (void);
+ void (*postHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_quest_init_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_quest_init_post[hIndex].func;
- postHookFunc();
+ postHookFunc(&minimal);
}
}
return;
@@ -50401,13 +50764,13 @@ int HP_quest_read_db(void) {
return retVal___;
}
/* script */
-void HP_script_init(void) {
+void HP_script_init(bool minimal) {
int hIndex = 0;
if( HPMHooks.count.HP_script_init_pre ) {
- void (*preHookFunc) (void);
+ void (*preHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_script_init_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_script_init_pre[hIndex].func;
- preHookFunc();
+ preHookFunc(&minimal);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -50415,13 +50778,13 @@ void HP_script_init(void) {
}
}
{
- HPMHooks.source.script.init();
+ HPMHooks.source.script.init(minimal);
}
if( HPMHooks.count.HP_script_init_post ) {
- void (*postHookFunc) (void);
+ void (*postHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_script_init_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_script_init_post[hIndex].func;
- postHookFunc();
+ postHookFunc(&minimal);
}
}
return;
@@ -53829,14 +54192,14 @@ bool HP_searchstore_result(struct map_session_data *sd, unsigned int store_id, i
return retVal___;
}
/* skill */
-int HP_skill_init(void) {
+int HP_skill_init(bool minimal) {
int hIndex = 0;
int retVal___ = 0;
if( HPMHooks.count.HP_skill_init_pre ) {
- int (*preHookFunc) (void);
+ int (*preHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_skill_init_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_skill_init_pre[hIndex].func;
- retVal___ = preHookFunc();
+ retVal___ = preHookFunc(&minimal);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -53844,13 +54207,13 @@ int HP_skill_init(void) {
}
}
{
- retVal___ = HPMHooks.source.skill.init();
+ retVal___ = HPMHooks.source.skill.init(minimal);
}
if( HPMHooks.count.HP_skill_init_post ) {
- int (*postHookFunc) (int retVal___);
+ int (*postHookFunc) (int retVal___, bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_skill_init_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_skill_init_post[hIndex].func;
- retVal___ = postHookFunc(retVal___);
+ retVal___ = postHookFunc(retVal___, &minimal);
}
}
return retVal___;
@@ -53906,13 +54269,13 @@ void HP_skill_reload(void) {
}
return;
}
-void HP_skill_read_db(void) {
+void HP_skill_read_db(bool minimal) {
int hIndex = 0;
if( HPMHooks.count.HP_skill_read_db_pre ) {
- void (*preHookFunc) (void);
+ void (*preHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_skill_read_db_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_skill_read_db_pre[hIndex].func;
- preHookFunc();
+ preHookFunc(&minimal);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -53920,13 +54283,13 @@ void HP_skill_read_db(void) {
}
}
{
- HPMHooks.source.skill.read_db();
+ HPMHooks.source.skill.read_db(minimal);
}
if( HPMHooks.count.HP_skill_read_db_post ) {
- void (*postHookFunc) (void);
+ void (*postHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_skill_read_db_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_skill_read_db_post[hIndex].func;
- postHookFunc();
+ postHookFunc(&minimal);
}
}
return;
@@ -58749,14 +59112,14 @@ bool HP_skill_check_shadowform(struct block_list *bl, int64 damage, int hit) {
return retVal___;
}
/* status */
-int HP_status_init(void) {
+int HP_status_init(bool minimal) {
int hIndex = 0;
int retVal___ = 0;
if( HPMHooks.count.HP_status_init_pre ) {
- int (*preHookFunc) (void);
+ int (*preHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_status_init_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_status_init_pre[hIndex].func;
- retVal___ = preHookFunc();
+ retVal___ = preHookFunc(&minimal);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -58764,13 +59127,13 @@ int HP_status_init(void) {
}
}
{
- retVal___ = HPMHooks.source.status.init();
+ retVal___ = HPMHooks.source.status.init(minimal);
}
if( HPMHooks.count.HP_status_init_post ) {
- int (*postHookFunc) (int retVal___);
+ int (*postHookFunc) (int retVal___, bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_status_init_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_status_init_post[hIndex].func;
- retVal___ = postHookFunc(retVal___);
+ retVal___ = postHookFunc(retVal___, &minimal);
}
}
return retVal___;
@@ -59870,13 +60233,13 @@ int HP_status_change_clear_buffs(struct block_list *bl, int type) {
}
return retVal___;
}
-void HP_status_calc_bl_(struct block_list *bl, enum scb_flag flag, bool first) {
+void HP_status_calc_bl_(struct block_list *bl, enum scb_flag flag, enum e_status_calc_opt opt) {
int hIndex = 0;
if( HPMHooks.count.HP_status_calc_bl__pre ) {
- void (*preHookFunc) (struct block_list *bl, enum scb_flag *flag, bool *first);
+ void (*preHookFunc) (struct block_list *bl, enum scb_flag *flag, enum e_status_calc_opt *opt);
for(hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_bl__pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_status_calc_bl__pre[hIndex].func;
- preHookFunc(bl, &flag, &first);
+ preHookFunc(bl, &flag, &opt);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -59884,25 +60247,25 @@ void HP_status_calc_bl_(struct block_list *bl, enum scb_flag flag, bool first) {
}
}
{
- HPMHooks.source.status.calc_bl_(bl, flag, first);
+ HPMHooks.source.status.calc_bl_(bl, flag, opt);
}
if( HPMHooks.count.HP_status_calc_bl__post ) {
- void (*postHookFunc) (struct block_list *bl, enum scb_flag *flag, bool *first);
+ void (*postHookFunc) (struct block_list *bl, enum scb_flag *flag, enum e_status_calc_opt *opt);
for(hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_bl__post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_status_calc_bl__post[hIndex].func;
- postHookFunc(bl, &flag, &first);
+ postHookFunc(bl, &flag, &opt);
}
}
return;
}
-int HP_status_calc_mob_(struct mob_data *md, bool first) {
+int HP_status_calc_mob_(struct mob_data *md, enum e_status_calc_opt opt) {
int hIndex = 0;
int retVal___ = 0;
if( HPMHooks.count.HP_status_calc_mob__pre ) {
- int (*preHookFunc) (struct mob_data *md, bool *first);
+ int (*preHookFunc) (struct mob_data *md, enum e_status_calc_opt *opt);
for(hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_mob__pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_status_calc_mob__pre[hIndex].func;
- retVal___ = preHookFunc(md, &first);
+ retVal___ = preHookFunc(md, &opt);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -59910,25 +60273,25 @@ int HP_status_calc_mob_(struct mob_data *md, bool first) {
}
}
{
- retVal___ = HPMHooks.source.status.calc_mob_(md, first);
+ retVal___ = HPMHooks.source.status.calc_mob_(md, opt);
}
if( HPMHooks.count.HP_status_calc_mob__post ) {
- int (*postHookFunc) (int retVal___, struct mob_data *md, bool *first);
+ int (*postHookFunc) (int retVal___, struct mob_data *md, enum e_status_calc_opt *opt);
for(hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_mob__post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_status_calc_mob__post[hIndex].func;
- retVal___ = postHookFunc(retVal___, md, &first);
+ retVal___ = postHookFunc(retVal___, md, &opt);
}
}
return retVal___;
}
-int HP_status_calc_pet_(struct pet_data *pd, bool first) {
+int HP_status_calc_pet_(struct pet_data *pd, enum e_status_calc_opt opt) {
int hIndex = 0;
int retVal___ = 0;
if( HPMHooks.count.HP_status_calc_pet__pre ) {
- int (*preHookFunc) (struct pet_data *pd, bool *first);
+ int (*preHookFunc) (struct pet_data *pd, enum e_status_calc_opt *opt);
for(hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_pet__pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_status_calc_pet__pre[hIndex].func;
- retVal___ = preHookFunc(pd, &first);
+ retVal___ = preHookFunc(pd, &opt);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -59936,25 +60299,25 @@ int HP_status_calc_pet_(struct pet_data *pd, bool first) {
}
}
{
- retVal___ = HPMHooks.source.status.calc_pet_(pd, first);
+ retVal___ = HPMHooks.source.status.calc_pet_(pd, opt);
}
if( HPMHooks.count.HP_status_calc_pet__post ) {
- int (*postHookFunc) (int retVal___, struct pet_data *pd, bool *first);
+ int (*postHookFunc) (int retVal___, struct pet_data *pd, enum e_status_calc_opt *opt);
for(hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_pet__post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_status_calc_pet__post[hIndex].func;
- retVal___ = postHookFunc(retVal___, pd, &first);
+ retVal___ = postHookFunc(retVal___, pd, &opt);
}
}
return retVal___;
}
-int HP_status_calc_pc_(struct map_session_data *sd, bool first) {
+int HP_status_calc_pc_(struct map_session_data *sd, enum e_status_calc_opt opt) {
int hIndex = 0;
int retVal___ = 0;
if( HPMHooks.count.HP_status_calc_pc__pre ) {
- int (*preHookFunc) (struct map_session_data *sd, bool *first);
+ int (*preHookFunc) (struct map_session_data *sd, enum e_status_calc_opt *opt);
for(hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_pc__pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_status_calc_pc__pre[hIndex].func;
- retVal___ = preHookFunc(sd, &first);
+ retVal___ = preHookFunc(sd, &opt);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -59962,25 +60325,25 @@ int HP_status_calc_pc_(struct map_session_data *sd, bool first) {
}
}
{
- retVal___ = HPMHooks.source.status.calc_pc_(sd, first);
+ retVal___ = HPMHooks.source.status.calc_pc_(sd, opt);
}
if( HPMHooks.count.HP_status_calc_pc__post ) {
- int (*postHookFunc) (int retVal___, struct map_session_data *sd, bool *first);
+ int (*postHookFunc) (int retVal___, struct map_session_data *sd, enum e_status_calc_opt *opt);
for(hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_pc__post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_status_calc_pc__post[hIndex].func;
- retVal___ = postHookFunc(retVal___, sd, &first);
+ retVal___ = postHookFunc(retVal___, sd, &opt);
}
}
return retVal___;
}
-int HP_status_calc_homunculus_(struct homun_data *hd, bool first) {
+int HP_status_calc_homunculus_(struct homun_data *hd, enum e_status_calc_opt opt) {
int hIndex = 0;
int retVal___ = 0;
if( HPMHooks.count.HP_status_calc_homunculus__pre ) {
- int (*preHookFunc) (struct homun_data *hd, bool *first);
+ int (*preHookFunc) (struct homun_data *hd, enum e_status_calc_opt *opt);
for(hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_homunculus__pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_status_calc_homunculus__pre[hIndex].func;
- retVal___ = preHookFunc(hd, &first);
+ retVal___ = preHookFunc(hd, &opt);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -59988,25 +60351,25 @@ int HP_status_calc_homunculus_(struct homun_data *hd, bool first) {
}
}
{
- retVal___ = HPMHooks.source.status.calc_homunculus_(hd, first);
+ retVal___ = HPMHooks.source.status.calc_homunculus_(hd, opt);
}
if( HPMHooks.count.HP_status_calc_homunculus__post ) {
- int (*postHookFunc) (int retVal___, struct homun_data *hd, bool *first);
+ int (*postHookFunc) (int retVal___, struct homun_data *hd, enum e_status_calc_opt *opt);
for(hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_homunculus__post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_status_calc_homunculus__post[hIndex].func;
- retVal___ = postHookFunc(retVal___, hd, &first);
+ retVal___ = postHookFunc(retVal___, hd, &opt);
}
}
return retVal___;
}
-int HP_status_calc_mercenary_(struct mercenary_data *md, bool first) {
+int HP_status_calc_mercenary_(struct mercenary_data *md, enum e_status_calc_opt opt) {
int hIndex = 0;
int retVal___ = 0;
if( HPMHooks.count.HP_status_calc_mercenary__pre ) {
- int (*preHookFunc) (struct mercenary_data *md, bool *first);
+ int (*preHookFunc) (struct mercenary_data *md, enum e_status_calc_opt *opt);
for(hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_mercenary__pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_status_calc_mercenary__pre[hIndex].func;
- retVal___ = preHookFunc(md, &first);
+ retVal___ = preHookFunc(md, &opt);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -60014,25 +60377,25 @@ int HP_status_calc_mercenary_(struct mercenary_data *md, bool first) {
}
}
{
- retVal___ = HPMHooks.source.status.calc_mercenary_(md, first);
+ retVal___ = HPMHooks.source.status.calc_mercenary_(md, opt);
}
if( HPMHooks.count.HP_status_calc_mercenary__post ) {
- int (*postHookFunc) (int retVal___, struct mercenary_data *md, bool *first);
+ int (*postHookFunc) (int retVal___, struct mercenary_data *md, enum e_status_calc_opt *opt);
for(hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_mercenary__post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_status_calc_mercenary__post[hIndex].func;
- retVal___ = postHookFunc(retVal___, md, &first);
+ retVal___ = postHookFunc(retVal___, md, &opt);
}
}
return retVal___;
}
-int HP_status_calc_elemental_(struct elemental_data *ed, bool first) {
+int HP_status_calc_elemental_(struct elemental_data *ed, enum e_status_calc_opt opt) {
int hIndex = 0;
int retVal___ = 0;
if( HPMHooks.count.HP_status_calc_elemental__pre ) {
- int (*preHookFunc) (struct elemental_data *ed, bool *first);
+ int (*preHookFunc) (struct elemental_data *ed, enum e_status_calc_opt *opt);
for(hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_elemental__pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_status_calc_elemental__pre[hIndex].func;
- retVal___ = preHookFunc(ed, &first);
+ retVal___ = preHookFunc(ed, &opt);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -60040,13 +60403,13 @@ int HP_status_calc_elemental_(struct elemental_data *ed, bool first) {
}
}
{
- retVal___ = HPMHooks.source.status.calc_elemental_(ed, first);
+ retVal___ = HPMHooks.source.status.calc_elemental_(ed, opt);
}
if( HPMHooks.count.HP_status_calc_elemental__post ) {
- int (*postHookFunc) (int retVal___, struct elemental_data *ed, bool *first);
+ int (*postHookFunc) (int retVal___, struct elemental_data *ed, enum e_status_calc_opt *opt);
for(hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_elemental__post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_status_calc_elemental__post[hIndex].func;
- retVal___ = postHookFunc(retVal___, ed, &first);
+ retVal___ = postHookFunc(retVal___, ed, &opt);
}
}
return retVal___;
@@ -60669,14 +61032,14 @@ unsigned int HP_status_base_pc_maxsp(struct map_session_data *sd, struct status_
}
return retVal___;
}
-int HP_status_calc_npc_(struct npc_data *nd, bool first) {
+int HP_status_calc_npc_(struct npc_data *nd, enum e_status_calc_opt opt) {
int hIndex = 0;
int retVal___ = 0;
if( HPMHooks.count.HP_status_calc_npc__pre ) {
- int (*preHookFunc) (struct npc_data *nd, bool *first);
+ int (*preHookFunc) (struct npc_data *nd, enum e_status_calc_opt *opt);
for(hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_npc__pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_status_calc_npc__pre[hIndex].func;
- retVal___ = preHookFunc(nd, &first);
+ retVal___ = preHookFunc(nd, &opt);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -60684,13 +61047,13 @@ int HP_status_calc_npc_(struct npc_data *nd, bool first) {
}
}
{
- retVal___ = HPMHooks.source.status.calc_npc_(nd, first);
+ retVal___ = HPMHooks.source.status.calc_npc_(nd, opt);
}
if( HPMHooks.count.HP_status_calc_npc__post ) {
- int (*postHookFunc) (int retVal___, struct npc_data *nd, bool *first);
+ int (*postHookFunc) (int retVal___, struct npc_data *nd, enum e_status_calc_opt *opt);
for(hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_npc__post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_status_calc_npc__post[hIndex].func;
- retVal___ = postHookFunc(retVal___, nd, &first);
+ retVal___ = postHookFunc(retVal___, nd, &opt);
}
}
return retVal___;
@@ -62126,14 +62489,14 @@ void HP_trade_commit(struct map_session_data *sd) {
return;
}
/* unit */
-int HP_unit_init(void) {
+int HP_unit_init(bool minimal) {
int hIndex = 0;
int retVal___ = 0;
if( HPMHooks.count.HP_unit_init_pre ) {
- int (*preHookFunc) (void);
+ int (*preHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_unit_init_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_unit_init_pre[hIndex].func;
- retVal___ = preHookFunc();
+ retVal___ = preHookFunc(&minimal);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -62141,13 +62504,13 @@ int HP_unit_init(void) {
}
}
{
- retVal___ = HPMHooks.source.unit.init();
+ retVal___ = HPMHooks.source.unit.init(minimal);
}
if( HPMHooks.count.HP_unit_init_post ) {
- int (*postHookFunc) (int retVal___);
+ int (*postHookFunc) (int retVal___, bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_unit_init_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_unit_init_post[hIndex].func;
- retVal___ = postHookFunc(retVal___);
+ retVal___ = postHookFunc(retVal___, &minimal);
}
}
return retVal___;
@@ -63320,13 +63683,13 @@ int HP_unit_free(struct block_list *bl, clr_type clrtype) {
return retVal___;
}
/* vending */
-void HP_vending_init(void) {
+void HP_vending_init(bool minimal) {
int hIndex = 0;
if( HPMHooks.count.HP_vending_init_pre ) {
- void (*preHookFunc) (void);
+ void (*preHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_vending_init_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_vending_init_pre[hIndex].func;
- preHookFunc();
+ preHookFunc(&minimal);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -63334,13 +63697,13 @@ void HP_vending_init(void) {
}
}
{
- HPMHooks.source.vending.init();
+ HPMHooks.source.vending.init(minimal);
}
if( HPMHooks.count.HP_vending_init_post ) {
- void (*postHookFunc) (void);
+ void (*postHookFunc) (bool *minimal);
for(hIndex = 0; hIndex < HPMHooks.count.HP_vending_init_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_vending_init_post[hIndex].func;
- postHookFunc();
+ postHookFunc(&minimal);
}
}
return;
diff --git a/src/plugins/HPMHooking/HPMHooking.sources.inc b/src/plugins/HPMHooking/HPMHooking.sources.inc
index e6dd89814..53bb6bcad 100644
--- a/src/plugins/HPMHooking/HPMHooking.sources.inc
+++ b/src/plugins/HPMHooking/HPMHooking.sources.inc
@@ -30,6 +30,7 @@ memcpy(&HPMHooks.source.mob, mob, sizeof(struct mob_interface));
memcpy(&HPMHooks.source.npc, npc, sizeof(struct npc_interface));
memcpy(&HPMHooks.source.party, party, sizeof(struct party_interface));
memcpy(&HPMHooks.source.path, path, sizeof(struct path_interface));
+memcpy(&HPMHooks.source.pcg, pcg, sizeof(struct pc_groups_interface));
memcpy(&HPMHooks.source.pc, pc, sizeof(struct pc_interface));
memcpy(&HPMHooks.source.pet, pet, sizeof(struct pet_interface));
memcpy(&HPMHooks.source.quest, quest, sizeof(struct quest_interface));
diff --git a/tools/HPMHookGen/HPMHookGen.pl b/tools/HPMHookGen/HPMHookGen.pl
index cf50a9e77..eef490e29 100755
--- a/tools/HPMHookGen/HPMHookGen.pl
+++ b/tools/HPMHookGen/HPMHookGen.pl
@@ -265,6 +265,8 @@ foreach my $file (@files) { # Loop through the xml files
$key = "ircbot";
} elsif ($key =~ /log_interface/) {
$key = "logs";
+ } elsif ($key =~ /pc_groups_interface/) {
+ $key = "pcg";
} else {
$key =~ s/_interface//;
}
@@ -367,6 +369,7 @@ foreach my $file (@files) { # Loop through the xml files
my %exportsymbols = map {
$_ => &{ sub ($) {
return 'battlegrounds' if $_ =~ /^bg$/;
+ return 'pc_groups' if $_ =~ /^pcg$/;
return $_;
}}($_);
} @keys;
diff --git a/tools/Script-Checker.applescript b/tools/Script-Checker.applescript
new file mode 100644
index 000000000..db1983f4b
--- /dev/null
+++ b/tools/Script-Checker.applescript
@@ -0,0 +1,151 @@
+(*
+ Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+ See the LICENSE file
+ Base Author: Haru @ http://hercules.ws
+*)
+
+(*
+ *************************************************************
+ *************************************************************
+ ******** **************
+ ******** NOTE: This script must be saved as app!!! **************
+ ******** **************
+ *************************************************************
+ *************************************************************
+*)
+
+property allowed_extensions : {"txt", "c", "ath", "herc"}
+property allowed_types : {"TEXT"}
+
+on run
+ try
+ set the resource_path to path to resource "Scripts"
+ tell application "Finder" to set the resource_path to the container of the resource_path
+ on error
+ display alert "Error" message "You need to save this script as an app bundle." buttons {"Cancel"} cancel button 1 as warning
+ end try
+ set the dialog_result to display dialog "You can drag files to this app to have them checked." with title "Hercules Script Checker" buttons {"Cancel", "(Re)build Hercules", "Check Script"} default button 3 cancel button 1
+ if the button returned of the dialog_result is "(Re)build Hercules" then
+ rebuild()
+ else
+ set these_items to choose file of type allowed_extensions with prompt "Choose the script(s) you want to check:" with multiple selections allowed
+ process_items(these_items)
+ end if
+end run
+
+on open these_items
+ process_items(these_items)
+end open
+
+on build_hercules(hercules_repo)
+ try
+ set the resource_path to path to resource "Scripts"
+ tell application "Finder" to set the resource_path to the container of the resource_path
+ on error
+ display alert "Error" message "You need to save this script as an app bundle." buttons {"Cancel"} cancel button 1 as warning
+ end try
+ set the configuration_flags to display dialog "Do you want to use any configuration flags? (i.e. --disable-renewal)" with title "Configuration" default answer "" buttons {"Cancel", "Ok"} default button 2 cancel button 1
+ try
+ set the command_output to do shell script "cd " & (the quoted form of the POSIX path of the hercules_repo) & " && echo './configure " & the text returned of the configuration_flags & " 2>&1' | bash -i"
+ on error
+ display dialog "Configuration failed" with title "Configuration result" buttons {"Abort"} cancel button 1
+ end try
+ tell application "TextEdit"
+ activate
+ set the new_document to make new document
+ set the text of new_document to the command_output
+ end tell
+ display dialog "Configuration successfully completed. Please check the log file for details." with title "Configuration result" buttons {"Abort", "Continue"} default button 2 cancel button 1
+ try
+ set the command_output to do shell script "cd " & (the quoted form of the POSIX path of the hercules_repo) & " && echo 'make clean 2>&1 && make sql -j8 2>&1' | bash -i"
+ on error
+ display dialog "Build failed." with title "Build result" buttons {"Abort"} cancel button 1
+ end try
+ tell application "TextEdit"
+ activate
+ set the new_document to make new document
+ set the text of new_document to the command_output
+ end tell
+ display dialog "Build successfully completed. Please check the log file for details." with title "Build result" buttons {"Abort", "Continue"} default button 2 cancel button 1
+ set the files_to_copy to {"map-server", "script-checker"}
+ set the conf_files_to_copy to {"inter-server.conf", "import", "packet.conf", "script.conf"}
+ set the db_files_to_copy to {"map_index.txt", "item_db2.txt", "const.txt", "mob_db2.txt"}
+ set the db2_files_to_copy to {"map_cache.dat", "item_db.txt", "skill_db.txt", "mob_db.txt"}
+ try
+ set the hercules_path to path to resource "Hercules"
+ do shell script "rm -r " & the quoted form of ((the POSIX path of hercules_path) & "/")
+ end try
+ set the hercules_path to the resource_path
+ tell application "Finder" to make new folder at hercules_path with properties {name:"Hercules"}
+ delay 3
+ set the hercules_path to path to resource "Hercules"
+ repeat with each_file in files_to_copy
+ copy_file(each_file, hercules_repo, hercules_path, ".")
+ end repeat
+ do shell script "mkdir " & the quoted form of ((POSIX path of the hercules_path) & "/conf")
+ repeat with each_file in conf_files_to_copy
+ copy_file(each_file, hercules_repo, hercules_path, "conf")
+ end repeat
+ do shell script "mkdir " & the quoted form of ((POSIX path of the hercules_path) & "/db")
+ repeat with each_file in db_files_to_copy
+ copy_file(each_file, hercules_repo, hercules_path, "db")
+ end repeat
+ do shell script "mkdir " & the quoted form of ((POSIX path of the hercules_path) & "/db/pre-re")
+ repeat with each_file in db2_files_to_copy
+ copy_file(each_file, hercules_repo, hercules_path, "db/pre-re")
+ end repeat
+ do shell script "mkdir " & the quoted form of ((POSIX path of the hercules_path) & "/db/re")
+ repeat with each_file in db2_files_to_copy
+ copy_file(each_file, hercules_repo, hercules_path, "db/re")
+ end repeat
+ display dialog "Build complete" with title "Done" buttons {"Ok"} default button "Ok"
+end build_hercules
+
+on rebuild()
+ set the repo_path to choose folder with prompt "Choose the folder where your Hercules repository is located:"
+ build_hercules(repo_path)
+end rebuild
+
+on copy_file(filename, source, destination, subpath)
+ do shell script "cp -rp " & the quoted form of ((the POSIX path of source) & "/" & subpath & "/" & filename) & " " & the quoted form of ((the POSIX path of destination) & "/" & subpath & "/")
+end copy_file
+
+on process_items(these_items)
+ repeat
+ try
+ set the scriptchecker to the path to resource "script-checker" in directory "Hercules"
+ set the mapserver to the path to resource "map-server" in directory "Hercules"
+ on error
+ display alert "Missing Hercules binaries" message "You need to build Hercules and place it within this app bundle before running the script checker." & linefeed & linefeed & "I can try to build it for you, but only if you have the Xcode command line tools installed." & linefeed & "Do you want to continue?" buttons {"Cancel", "Build"} default button "Build" cancel button "Cancel" as warning
+ rebuild()
+ return false
+ end try
+ exit repeat
+ end repeat
+ repeat with i from 1 to the count of these_items
+ set this_item to item i of these_items
+ set the item_info to info for this_item
+ set this_name to the name of the item_info
+ try
+ set this_extension to the name extension of item_info
+ on error
+ set this_extension to ""
+ end try
+ try
+ set this_filetype to the file type of item_info
+ on error
+ set this_filetype to ""
+ end try
+ if (folder of the item_info is false) and (alias of the item_info is false) and ((this_filetype is in the allowed_types) or (this_extension is in the allowed_extensions)) then
+ process_item(scriptchecker, this_item)
+ end if
+ end repeat
+end process_items
+
+on process_item(checkerpath, this_item)
+ set the_result to do shell script (the quoted form of the POSIX path of checkerpath & " " & the quoted form of the POSIX path of this_item) & " 2>&1"
+ if the_result is "" then
+ set the_result to "Check passed."
+ end if
+ display dialog ("File: " & POSIX path of this_item) & linefeed & "Result: " & linefeed & the_result with title "Output" buttons {"Abort", "Next"} default button "Next" cancel button "Abort"
+end process_item