summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c83
-rw-r--r--src/map/battle.c2
-rw-r--r--src/map/battle.h2
-rw-r--r--src/map/map.c2
-rw-r--r--src/map/map.h1
-rw-r--r--src/map/npc.c2
-rw-r--r--src/map/skill.c2
-rw-r--r--src/map/status.c10
8 files changed, 65 insertions, 39 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 727ab8bf0..5c3fb80a3 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -2583,7 +2583,7 @@ static int atkillmonster_sub(struct block_list *bl, va_list ap)
if (flag)
status_zap(bl,md->status.hp, 0);
else
- status_kill(bl);
+ status_kill(bl);
return 1;
}
@@ -2971,7 +2971,7 @@ int atcommand_param(const int fd, struct map_session_data* sd, const char* comma
for (i = 0; param[i] != NULL; i++)
if (strcmpi(command, param[i]) == 0)
- break;
+ break;
if (param[i] == NULL || i > MAX_STATUS_TYPE) { // normally impossible...
sprintf(atcmd_output, "Please, enter a valid value (usage: @str,@agi,@vit,@int,@dex,@luk <+/-adjustment>).");
@@ -3886,7 +3886,7 @@ int atcommand_idsearch(const int fd, struct map_session_data* sd, const char* co
sprintf(atcmd_output, msg_txt(269), MAX_SEARCH, match);
clif_displaymessage(fd, atcmd_output);
match = MAX_SEARCH;
- }
+ }
for(i = 0; i < match; i++) {
sprintf(atcmd_output, msg_txt(78), item_array[i]->jname, item_array[i]->nameid); // %s: %d
clif_displaymessage(fd, atcmd_output);
@@ -4940,7 +4940,7 @@ int atcommand_jail(const int fd, struct map_session_data* sd, const char* comman
x = 24;
y = 75;
break;
- default:
+ default:
m_index = mapindex_name2id(MAP_JAIL);
x = 49;
y = 75;
@@ -4948,7 +4948,7 @@ int atcommand_jail(const int fd, struct map_session_data* sd, const char* comman
}
//Duration of INT_MAX to specify infinity.
- sc_start4(&pl_sd->bl,SC_JAILED,100,INT_MAX,m_index,x,y,1000);
+ sc_start4(&pl_sd->bl,SC_JAILED,100,INT_MAX,m_index,x,y,1000);
clif_displaymessage(pl_sd->fd, msg_txt(117)); // GM has send you in jails.
clif_displaymessage(fd, msg_txt(118)); // Player warped in jails.
return 0;
@@ -5075,9 +5075,9 @@ int atcommand_jailfor(const int fd, struct map_session_data* sd, const char* com
} else {
get_jail_time(jailtime,&year,&month,&day,&hour,&minute);
sprintf(atcmd_output,msg_txt(402),"You are now",year,month,day,hour,minute); //%s in jail for %d years, %d months, %d days, %d hours and %d minutes
- clif_displaymessage(pl_sd->fd, atcmd_output);
+ clif_displaymessage(pl_sd->fd, atcmd_output);
sprintf(atcmd_output,msg_txt(402),"This player is now",year,month,day,hour,minute); //This player is now in jail for %d years, %d months, %d days, %d hours and %d minutes
- clif_displaymessage(fd, atcmd_output);
+ clif_displaymessage(fd, atcmd_output);
}
} else if (jailtime < 0) {
clif_displaymessage(fd, "Invalid time for jail command.");
@@ -5508,14 +5508,14 @@ int atcommand_follow(const int fd, struct map_session_data* sd, const char* comm
struct map_session_data *pl_sd = NULL;
nullpo_retr(-1, sd);
- if (!message || !*message) {
- if (sd->followtarget == -1)
- return -1;
-
- pc_stop_following (sd);
- clif_displaymessage(fd, "Follow mode OFF.");
- return 0;
- }
+ if (!message || !*message) {
+ if (sd->followtarget == -1)
+ return -1;
+
+ pc_stop_following (sd);
+ clif_displaymessage(fd, "Follow mode OFF.");
+ return 0;
+ }
if ( (pl_sd = map_nick2sd((char *)message)) == NULL )
{
@@ -5816,7 +5816,7 @@ int atcommand_marry(const int fd, struct map_session_data* sd, const char* comma
/*==========================================
* @divorce by [MouseJstr], fixed by [Lupus]
- * divorce two players
+ * divorce two players
*------------------------------------------*/
int atcommand_divorce(const int fd, struct map_session_data* sd, const char* command, const char* message)
{
@@ -5879,19 +5879,26 @@ int atcommand_changelook(const int fd, struct map_session_data* sd, const char*
int atcommand_autotrade(const int fd, struct map_session_data* sd, const char* command, const char* message)
{
nullpo_retr(-1, sd);
- if (sd->vender_id) //check if player's vending
- {
- sd->state.autotrade = 1;
- clif_authfail_fd(fd, 15);
- }
- else
+ if( sd->vender_id ) //check if player's vending
{
- //"You should be vending to use @Autotrade."
- clif_displaymessage(fd, msg_txt(549));
+ if( map[sd->bl.m].flag.autotrade == battle_config.autotrade_mapflag )
+ {
+ sd->state.autotrade = 1;
+ if( battle_config.at_timeout )
+ {
+ int timeout = atoi(message);
+ status_change_start(&sd->bl, SC_AUTOTRADE, 10000, 0, 0, 0, 0, ((timeout > 0) ? min(timeout,battle_config.at_timeout) : battle_config.at_timeout) * 60000, 0);
+ }
+
+ clif_authfail_fd(fd, 15);
+ } else
+ clif_displaymessage(fd, "Autotrade is not allowed on this map.");
}
- return 0;
-}
+ else
+ clif_displaymessage(fd, msg_txt(549)); // You should be vending to use @Autotrade.
+ return 0;
+}
/*==========================================
* @changegm by durf (changed by Lupus)
@@ -5920,8 +5927,8 @@ int atcommand_changegm(const int fd, struct map_session_data* sd, const char* co
}
guild_gm_change(sd->status.guild_id, pl_sd);
- return 0;
-}
+ return 0;
+}
/*==========================================
* @changeleader by Skotlex
@@ -5978,9 +5985,9 @@ int atcommand_changeleader(const int fd, struct map_session_data* sd, const char
intif_party_leaderchange(p->party.party_id,p->party.member[pl_mi].account_id,p->party.member[pl_mi].char_id);
//Update info.
clif_party_info(p,NULL);
-
- return 0;
-}
+
+ return 0;
+}
/*==========================================
* @partyoption by Skotlex
@@ -6023,8 +6030,8 @@ int atcommand_partyoption(const int fd, struct map_session_data* sd, const char*
else
clif_displaymessage(fd, msg_txt(286));
- return 0;
-}
+ return 0;
+}
/*==========================================
* @autoloot by Upa-Kun
@@ -6048,12 +6055,12 @@ int atcommand_autoloot(const int fd, struct map_session_data* sd, const char* co
}
if (rate < 0) rate = 0;
if (rate > 10000) rate = 10000;
-
+
sd->state.autoloot = rate;
- if (sd->state.autoloot) {
+ if (sd->state.autoloot) {
snprintf(atcmd_output, sizeof atcmd_output, "Autolooting items with drop rates of %0.02f%% and below.",((double)sd->state.autoloot)/100.);
clif_displaymessage(fd, atcmd_output);
- }else
+ }else
clif_displaymessage(fd, "Autoloot is now off.");
if (sd->state.autoloot && sd->state.autolootid) {
@@ -7134,7 +7141,7 @@ int atcommand_makehomun(const int fd, struct map_session_data* sd, const char* c
return -1;
}
- homunid = atoi(message);
+ homunid = atoi(message);
if( homunid < HM_CLASS_BASE || homunid > HM_CLASS_BASE + MAX_HOMUNCULUS_CLASS - 1 )
{
clif_displaymessage(fd, "Invalid Homunculus id.");
@@ -7718,7 +7725,7 @@ int atcommand_monsterignore(const int fd, struct map_session_data* sd, const cha
* => Gives your character a fake name. [Valaris]
*------------------------------------------*/
int atcommand_fakename(const int fd, struct map_session_data* sd, const char* command, const char* message)
-{
+{
char name[NAME_LENGTH];
nullpo_retr(-1, sd);
diff --git a/src/map/battle.c b/src/map/battle.c
index 21c2c751d..a6dad0538 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -3652,6 +3652,8 @@ static const struct _battle_data {
{ "sg_miracle_skill_duration", &battle_config.sg_miracle_skill_duration, 3600000, 0, INT_MAX, },
{ "hvan_explosion_intimate", &battle_config.hvan_explosion_intimate, 45000, 0, 100000, },
{ "quest_exp_rate", &battle_config.quest_exp_rate, 100, 0, INT_MAX, },
+ { "at_mapflag", &battle_config.autotrade_mapflag, 0, 0, 1, },
+ { "at_timeout", &battle_config.at_timeout, 0, 0, INT_MAX, },
{ "homunculus_autoloot", &battle_config.homunculus_autoloot, 0, 0, 1, },
{ "idle_no_autoloot", &battle_config.idle_no_autoloot, 0, 0, INT_MAX, },
{ "max_guild_alliance", &battle_config.max_guild_alliance, 3, 1, 3, },
diff --git a/src/map/battle.h b/src/map/battle.h
index 1483d8915..738f1c388 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -438,6 +438,8 @@ extern struct Battle_Config
int homunculus_show_growth ; //[orn]
int homunculus_friendly_rate;
int quest_exp_rate;
+ int autotrade_mapflag;
+ int at_timeout;
int homunculus_autoloot;
int idle_no_autoloot;
int max_guild_alliance;
diff --git a/src/map/map.c b/src/map/map.c
index 78e67d3d4..32838dfa9 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1564,6 +1564,8 @@ int map_quit(struct map_session_data *sd)
//(changing map-servers invokes unit_free but bypasses map_quit)
if(sd->sc.count) {
//Status that are not saved...
+ if(sd->sc.data[SC_AUTOTRADE])
+ status_change_end(&sd->bl,SC_AUTOTRADE,-1);
if(sd->sc.data[SC_SPURT])
status_change_end(&sd->bl,SC_SPURT,-1);
if(sd->sc.data[SC_BERSERK])
diff --git a/src/map/map.h b/src/map/map.h
index 6dcdb9ba2..f04ae9340 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -1168,6 +1168,7 @@ struct map_data {
int npc_num;
int users;
struct map_flag {
+ unsigned autotrade : 1;
unsigned allowks : 1; // [Kill Steal Protection]
unsigned nomemo : 1;
unsigned noteleport : 1;
diff --git a/src/map/npc.c b/src/map/npc.c
index 7a1cca0f3..b7b62898f 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -2318,6 +2318,8 @@ static const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, con
}
map[m].flag.nosave = state;
}
+ else if (!strcmpi(w3,"autotrade"))
+ map[m].flag.autotrade=state;
else if (!strcmpi(w3,"allowks"))
map[m].flag.allowks=state; // [Kill Steal Protection]
else if (!strcmpi(w3,"nomemo"))
diff --git a/src/map/skill.c b/src/map/skill.c
index 706fd5bd1..39c048bad 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -4206,7 +4206,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case SC_INCHITRATE: case SC_INCATKRATE: case SC_NEN:
case SC_READYSTORM: case SC_READYDOWN: case SC_READYTURN:
case SC_READYCOUNTER:case SC_DODGE: case SC_WARM:
- case SC_SPEEDUP1:
+ case SC_SPEEDUP1: case SC_AUTOTRADE:
continue;
}
if(i==SC_BERSERK) tsc->data[i]->val2=0; //Mark a dispelled berserk to avoid setting hp to 100 by setting hp penalty to 0.
diff --git a/src/map/status.c b/src/map/status.c
index f7e3157bf..3c13404e2 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -25,6 +25,7 @@
#include "script.h"
#include "unit.h"
#include "mercenary.h"
+#include "vending.h"
#include <time.h>
#include <stdio.h>
@@ -6489,6 +6490,15 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid)
status_set_hp(bl, 10, 0);
status_set_sp(bl, 10, 0);
break;
+ case SC_AUTOTRADE:
+ if (tid == -1)
+ break;
+ vending_closevending(sd);
+ map_quit(sd);
+ // Because map_quit calls status_change_end with tid -1
+ // from here it's not neccesary to continue
+ return 1;
+ break;
}
opt_flag = 1;