diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/atcommand.c | 2 | ||||
-rw-r--r-- | src/map/clif.c | 5 | ||||
-rw-r--r-- | src/map/map.h | 1 | ||||
-rw-r--r-- | src/map/npc.c | 3 | ||||
-rw-r--r-- | src/map/pc.c | 30 | ||||
-rw-r--r-- | src/map/script.c | 11 | ||||
-rw-r--r-- | src/map/trade.c | 5 |
7 files changed, 41 insertions, 16 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 4bc9d5ec5..dad90776f 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -5689,6 +5689,8 @@ int atcommand_mapinfo( strcat(atcmd_output, "NoBranch | ");
if (map[m_id].flag.notrade)
strcat(atcmd_output, "NoTrade | ");
+ if (map[m_id].flag.nodrop)
+ strcat(atcmd_output, "NoDrop | ");
if (map[m_id].flag.noskill)
strcat(atcmd_output, "NoSkill | ");
if (map[m_id].flag.noicewall)
diff --git a/src/map/clif.c b/src/map/clif.c index ac7c73ef5..802bbea15 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -9617,7 +9617,10 @@ void clif_parse_DropItem(int fd, struct map_session_data *sd) { item_index = RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0])-2;
item_amount = RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[1]);
- pc_dropitem(sd, item_index, item_amount);
+ if (!pc_dropitem(sd, item_index, item_amount))
+ //Because the client does not likes being ignored.
+ clif_delitem(sd, item_index,0);
+
}
/*==========================================
diff --git a/src/map/map.h b/src/map/map.h index cb82be8a8..8f697a33b 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -1037,6 +1037,7 @@ struct map_data { unsigned nightenabled :1; //For night display. [Skotlex]
unsigned restricted : 1; // [Komurka]
unsigned nocommand : 1; //Blocks @/# commands for non-gms. [Skotlex]
+ unsigned nodrop : 1;
} flag;
struct point save;
struct npc_data *npc[MAX_NPC_PER_MAP];
diff --git a/src/map/npc.c b/src/map/npc.c index e3abe5eaa..1fc99de95 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -2546,6 +2546,9 @@ static int npc_parse_mapflag (char *w1, char *w2, char *w3, char *w4) else if (strcmpi(w3,"notrade")==0) {
map[m].flag.notrade=1;
}
+ else if (strcmpi(w3,"nodrop")==0) {
+ map[m].flag.nodrop=1;
+ }
else if (strcmpi(w3,"noskill")==0) {
map[m].flag.noskill=1;
}
diff --git a/src/map/pc.c b/src/map/pc.c index a467f3607..559f18677 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -2502,35 +2502,37 @@ int pc_dropitem(struct map_session_data *sd,int n,int amount) nullpo_retr(1, sd);
if(n < 0 || n >= MAX_INVENTORY)
- return 1;
+ return 0;
if(amount <= 0)
- return 1;
+ return 0;
if (sd->status.inventory[n].nameid <= 0 ||
sd->status.inventory[n].amount < amount ||
sd->trade_partner != 0 || sd->vender_id != 0 ||
sd->status.inventory[n].amount <= 0)
- return 1;
+ return 0;
+
+ if (map[sd->bl.m].flag.nodrop) {
+ clif_displaymessage (sd->fd, msg_txt(271));
+ return 0; //Can't drop items in nodrop mapflag maps.
+ }
- if (!pc_candrop(sd,sd->status.inventory[n].nameid))
- { //The client does not likes being silently ignored, so we send it a del of 0 qty
- clif_delitem(sd,n,0);
+ if (!pc_candrop(sd,sd->status.inventory[n].nameid)) {
clif_displaymessage (sd->fd, msg_txt(263));
- return 1;
+ return 0;
}
-
+
//Logs items, dropped by (P)layers [Lupus]
if(log_config.pick > 0 )
log_pick(sd, "P", 0, sd->status.inventory[n].nameid, -amount, (struct item*)&sd->status.inventory[n]);
//Logs
- if (map_addflooritem(&sd->status.inventory[n], amount, sd->bl.m, sd->bl.x, sd->bl.y, NULL, NULL, NULL, 2) != 0)
- pc_delitem(sd, n, amount, 0);
- else
- clif_delitem(sd,n,0);
-
- return 0;
+ if (!map_addflooritem(&sd->status.inventory[n], amount, sd->bl.m, sd->bl.x, sd->bl.y, NULL, NULL, NULL, 2))
+ return 0;
+
+ pc_delitem(sd, n, amount, 0);
+ return 1;
}
/*==========================================
diff --git a/src/map/script.c b/src/map/script.c index edd9b7550..33d06ddbb 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -6566,7 +6566,7 @@ enum { MF_NOMEMO,MF_NOTELEPORT,MF_NOSAVE,MF_NOBRANCH,MF_NOPENALTY,MF_NOZENYPENA MF_NOWARP,MF_NOPVP,MF_NOICEWALL,MF_SNOW,MF_FOG,MF_SAKURA,MF_LEAVES,MF_RAIN,
MF_INDOORS,MF_NOGO,MF_CLOUDS,MF_CLOUDS2,MF_FIREWORKS,MF_GVG_CASTLE,MF_GVG_DUNGEON,MF_NIGHTENABLED,
MF_NOBASEEXP, MF_NOJOBEXP, MF_NOMOBLOOT, MF_NOMVPLOOT, MF_NORETURN, MF_NOWARPTO, MF_NIGHTMAREDROP,
- MF_RESTRICTED, MF_NOCOMMAND };
+ MF_RESTRICTED, MF_NOCOMMAND, MF_NODROP };
int buildin_setmapflagnosave(struct script_state *st)
{
@@ -6640,6 +6640,9 @@ int buildin_setmapflag(struct script_state *st) case MF_NOTRADE:
map[m].flag.notrade=1;
break;
+ case MF_NODROP:
+ map[m].flag.nodrop=1;
+ break;
case MF_NOSKILL:
map[m].flag.noskill=1;
break;
@@ -6767,6 +6770,12 @@ int buildin_removemapflag(struct script_state *st) case MF_NOZENYPENALTY:
map[m].flag.nozenypenalty=0;
break;
+ case MF_NOTRADE:
+ map[m].flag.notrade=0;
+ break;
+ case MF_NODROP:
+ map[m].flag.nodrop=0;
+ break;
case MF_NOSKILL:
map[m].flag.noskill=0;
break;
diff --git a/src/map/trade.c b/src/map/trade.c index c9b9b21b0..15f99b9c4 100644 --- a/src/map/trade.c +++ b/src/map/trade.c @@ -29,6 +29,11 @@ void trade_traderequest(struct map_session_data *sd, int target_id) { nullpo_retv(sd);
+ if (map[sd->bl.m].flag.notrade) {
+ clif_displaymessage (sd->fd, msg_txt(272));
+ return; //Can't trade in notrade mapflag maps.
+ }
+
if ((target_sd = map_id2sd(target_id)) != NULL) {
if (!battle_config.invite_request_check) {
if (target_sd->guild_invite > 0 || target_sd->party_invite > 0) {
|