- Added mapflag nodrop, fixed mapflag notrade.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5619 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
skotlex 2006-03-15 21:07:00 +00:00
parent 1619899ed2
commit 8955a37a9b
10 changed files with 48 additions and 18 deletions

View File

@ -5,6 +5,8 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. EV
GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS
2006/03/15
* Added mapflag nodrop (prevents droping items to the ground). [Skotlex]
* Fixed mapflag notrade doing nothing. [Skotlex]
* Likely fixed Gravitation not hitting except for the last hit. [Skotlex]
* Removed the hardcoded duration of 30 seconds for sleep. [Skotlex]
* Fixed rangecheck for pet skill usage of INF_SELF_SKILL type of skills

View File

@ -280,6 +280,8 @@
269: Displaying first %d out of %d matches
//@me output format
270: *%s %s*
271: You can't drop items on this map
272: You can't trade on this map
// Guild Castles Number
// --------------------
299: ?? Castles

View File

@ -124,6 +124,7 @@ mf_nowarpto 33
mf_nonightmaredrop 34
mf_restricted 35
mf_nocommand 36
mf_nodrop 37
cell_wall 1
cell_water 3

View File

@ -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)

View File

@ -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);
}
/*==========================================

View File

@ -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];

View File

@ -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;
}

View File

@ -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;
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);
clif_displaymessage (sd->fd, msg_txt(263));
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)) {
clif_displaymessage (sd->fd, msg_txt(263));
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;
}
/*==========================================

View File

@ -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;

View File

@ -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) {