summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormomacabu <momacabu@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-11-27 21:53:07 +0000
committermomacabu <momacabu@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-11-27 21:53:07 +0000
commit19a9eb956b628d9e43e98491a2b2ebdc483b243f (patch)
treee3dc6fc9a05d2661c6208300f5c31a5460bb6708
parent390b8d0b8eebfb8274df1244d3e378ccc0ddbfd5 (diff)
downloadhercules-19a9eb956b628d9e43e98491a2b2ebdc483b243f.tar.gz
hercules-19a9eb956b628d9e43e98491a2b2ebdc483b243f.tar.bz2
hercules-19a9eb956b628d9e43e98491a2b2ebdc483b243f.tar.xz
hercules-19a9eb956b628d9e43e98491a2b2ebdc483b243f.zip
Applied suggestion in tid:74775. Added script command cleanmap and cleanarea script commands. Also modified @cleanmap to properly clean the entire map and added @cleanarea to clean an specified area. A documentation will be done in shortly.
Automagically copy files from import-tmpl to import folder on Windows after building the project (only works with rAthena-10 and rAthena-12) (tid:74635). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16971 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--conf/groups.conf1
-rw-r--r--src/map/atcommand.c27
-rw-r--r--src/map/script.c43
-rw-r--r--vcproj-10/map-server_sql.vcxproj11
-rw-r--r--vcproj-12/map-server_sql.vcxproj11
5 files changed, 87 insertions, 6 deletions
diff --git a/conf/groups.conf b/conf/groups.conf
index c1912792d..2d689bf93 100644
--- a/conf/groups.conf
+++ b/conf/groups.conf
@@ -188,6 +188,7 @@ groups: (
monsterbig: true
killmonster2: true
cleanmap: true
+ cleanarea: true
item: [true, true]
zeny: [true, true]
disguise: [true, true]
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 33a389db9..395cb1cba 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -6100,8 +6100,9 @@ ACMD_FUNC(mobsearch)
/*==========================================
* @cleanmap - cleans items on the ground
+ * @cleanarea - cleans items on the ground within an specified area
*------------------------------------------*/
-static int atcommand_cleanmap_sub(struct block_list *bl, va_list ap)
+static int atcommand_cleanfloor_sub(struct block_list *bl, va_list ap)
{
nullpo_ret(bl);
map_clearflooritem(bl);
@@ -6111,10 +6112,25 @@ static int atcommand_cleanmap_sub(struct block_list *bl, va_list ap)
ACMD_FUNC(cleanmap)
{
- map_foreachinarea(atcommand_cleanmap_sub, sd->bl.m,
- sd->bl.x-AREA_SIZE*2, sd->bl.y-AREA_SIZE*2,
- sd->bl.x+AREA_SIZE*2, sd->bl.y+AREA_SIZE*2,
- BL_ITEM);
+ map_foreachinmap(atcommand_cleanfloor_sub, sd->bl.m, BL_ITEM);
+ clif_displaymessage(fd, msg_txt(1221)); // All dropped items have been cleaned up.
+ return 0;
+}
+
+ACMD_FUNC(cleanarea)
+{
+ int x0 = 0, y0 = 0, x1 = 0, y1 = 0;
+
+ if (!message || !*message || sscanf(message, "%d %d %d %d", &x0, &y0, &x1, &y1) < 1) {
+ map_foreachinarea(atcommand_cleanfloor_sub, sd->bl.m, sd->bl.x - (AREA_SIZE * 2), sd->bl.y - (AREA_SIZE * 2), sd->bl.x + (AREA_SIZE * 2), sd->bl.y + (AREA_SIZE * 2), BL_ITEM);
+ }
+ else if (sscanf(message, "%d %d %d %d", &x0, &y0, &x1, &y1) == 1) {
+ map_foreachinarea(atcommand_cleanfloor_sub, sd->bl.m, sd->bl.x - x0, sd->bl.y - x0, sd->bl.x + x0, sd->bl.y + x0, BL_ITEM);
+ }
+ else if (sscanf(message, "%d %d %d %d", &x0, &y0, &x1, &y1) == 4) {
+ map_foreachinarea(atcommand_cleanfloor_sub, sd->bl.m, x0, y0, x1, y1, BL_ITEM);
+ }
+
clif_displaymessage(fd, msg_txt(1221)); // All dropped items have been cleaned up.
return 0;
}
@@ -8931,6 +8947,7 @@ void atcommand_basecommands(void)
ACMD_DEF(misceffect),
ACMD_DEF(mobsearch),
ACMD_DEF(cleanmap),
+ ACMD_DEF(cleanarea),
ACMD_DEF(npctalk),
ACMD_DEF(pettalk),
ACMD_DEF(users),
diff --git a/src/map/script.c b/src/map/script.c
index e1ae149b7..351d5d615 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -14233,7 +14233,7 @@ BUILDIN_FUNC(strpos)
else
i = 0;
- if (strlen(needle) == 0) {
+ if (needle[0] == '\0') {
script_pushint(st, -1);
return 0;
}
@@ -17350,6 +17350,45 @@ BUILDIN_FUNC(getrandgroupitem)
return 0;
}
+/* cleanmap <map_name>;
+ * cleanfloor <map_name, <x0>, <y0>, <x1>, <y1>; */
+static int atcommand_cleanfloor_sub(struct block_list *bl, va_list ap)
+{
+ nullpo_ret(bl);
+ map_clearflooritem(bl);
+
+ return 0;
+}
+
+BUILDIN_FUNC(cleanmap)
+{
+ const char *map;
+ int m, index;
+ short x0, y0, x1, y1;
+
+ map = script_getstr(st, 2);
+ index = mapindex_name2id(map);
+ if (index)
+ m = map_mapindex2mapid(index);
+
+ if ((script_lastdata(st) - 2) < 4) {
+ map_foreachinmap(atcommand_cleanfloor_sub, m, BL_ITEM);
+ } else {
+ x0 = script_getnum(st, 3);
+ y0 = script_getnum(st, 4);
+ x1 = script_getnum(st, 5);
+ y1 = script_getnum(st, 6);
+ if (x0 > 0 && y0 > 0 && x1 > 0 && y1 > 0) {
+ map_foreachinarea(atcommand_cleanfloor_sub, m, x0, y0, x1, y1, BL_ITEM);
+ } else {
+ ShowError("cleanarea: invalid coordinate defined!\n");
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
// declarations that were supposed to be exported from npc_chat.c
#ifdef PCRE_SUPPORT
@@ -17791,6 +17830,8 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(get_revision,""),
BUILDIN_DEF(freeloop,"i"),
BUILDIN_DEF(getrandgroupitem, "ii"),
+ BUILDIN_DEF(cleanmap, "s"),
+ BUILDIN_DEF2(cleanmap, "cleanarea", "siiii"),
/**
* @commands (script based)
**/
diff --git a/vcproj-10/map-server_sql.vcxproj b/vcproj-10/map-server_sql.vcxproj
index f3e8d8d94..23188bd2b 100644
--- a/vcproj-10/map-server_sql.vcxproj
+++ b/vcproj-10/map-server_sql.vcxproj
@@ -269,4 +269,15 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
+ <Target Name="AfterBuild">
+ <Copy SourceFiles="..\conf\import-tmpl\battle_conf.txt" DestinationFolder="..\conf\import\" ContinueOnError="true" />
+ <Copy SourceFiles="..\conf\import-tmpl\char_conf.txt" DestinationFolder="..\conf\import\" ContinueOnError="true" />
+ <Copy SourceFiles="..\conf\import-tmpl\inter_conf.txt" DestinationFolder="..\conf\import\" ContinueOnError="true" />
+ <Copy SourceFiles="..\conf\import-tmpl\log_conf.txt" DestinationFolder="..\conf\import\" ContinueOnError="true" />
+ <Copy SourceFiles="..\conf\import-tmpl\login_conf.txt" DestinationFolder="..\conf\import\" ContinueOnError="true" />
+ <Copy SourceFiles="..\conf\import-tmpl\map_conf.txt" DestinationFolder="..\conf\import\" ContinueOnError="true" />
+ <Copy SourceFiles="..\conf\import-tmpl\msg_conf.txt" DestinationFolder="..\conf\import\" ContinueOnError="true" />
+ <Copy SourceFiles="..\conf\import-tmpl\packet_conf.txt" DestinationFolder="..\conf\import\" ContinueOnError="true" />
+ <Copy SourceFiles="..\conf\import-tmpl\script_conf.txt" DestinationFolder="..\conf\import\" ContinueOnError="true" />
+ </Target>
</Project> \ No newline at end of file
diff --git a/vcproj-12/map-server_sql.vcxproj b/vcproj-12/map-server_sql.vcxproj
index 487a03dac..47db309b9 100644
--- a/vcproj-12/map-server_sql.vcxproj
+++ b/vcproj-12/map-server_sql.vcxproj
@@ -273,4 +273,15 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
+ <Target Name="AfterBuild">
+ <Copy SourceFiles="..\conf\import-tmpl\battle_conf.txt" DestinationFolder="..\conf\import\" ContinueOnError="true" />
+ <Copy SourceFiles="..\conf\import-tmpl\char_conf.txt" DestinationFolder="..\conf\import\" ContinueOnError="true" />
+ <Copy SourceFiles="..\conf\import-tmpl\inter_conf.txt" DestinationFolder="..\conf\import\" ContinueOnError="true" />
+ <Copy SourceFiles="..\conf\import-tmpl\log_conf.txt" DestinationFolder="..\conf\import\" ContinueOnError="true" />
+ <Copy SourceFiles="..\conf\import-tmpl\login_conf.txt" DestinationFolder="..\conf\import\" ContinueOnError="true" />
+ <Copy SourceFiles="..\conf\import-tmpl\map_conf.txt" DestinationFolder="..\conf\import\" ContinueOnError="true" />
+ <Copy SourceFiles="..\conf\import-tmpl\msg_conf.txt" DestinationFolder="..\conf\import\" ContinueOnError="true" />
+ <Copy SourceFiles="..\conf\import-tmpl\packet_conf.txt" DestinationFolder="..\conf\import\" ContinueOnError="true" />
+ <Copy SourceFiles="..\conf\import-tmpl\script_conf.txt" DestinationFolder="..\conf\import\" ContinueOnError="true" />
+ </Target>
</Project> \ No newline at end of file