summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-18 16:01:26 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-18 16:01:26 +0000
commit2449d2a6e7ddd1648d2e1fe446c97fe94378af28 (patch)
treece6f82d036029d2954764b2fc7119f538e0347fa /src/map
parentbb0bd9d290f6dd1f3a455da7d4cd4ae58e8e49a2 (diff)
downloadhercules-2449d2a6e7ddd1648d2e1fe446c97fe94378af28.tar.gz
hercules-2449d2a6e7ddd1648d2e1fe446c97fe94378af28.tar.bz2
hercules-2449d2a6e7ddd1648d2e1fe446c97fe94378af28.tar.xz
hercules-2449d2a6e7ddd1648d2e1fe446c97fe94378af28.zip
- Removed message 592 from trade.c
- Removed mapflag nopvp - Added support for disabling mapflags on a mapflag line: comodo.gat mapflag nomemo <- turns on nomemo mapflag comodo.gat mapflag nomemo off <- turns off nomemo mapflag - Cleaned up and optimized the restricted/zones mapflag. Restricted cards will just not work in disallowed maps rather than blocking the compounded equipement from being used. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6159 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c4
-rw-r--r--src/map/clif.c6
-rw-r--r--src/map/map.h1
-rw-r--r--src/map/npc.c112
-rw-r--r--src/map/pc.c51
-rw-r--r--src/map/script.c12
-rw-r--r--src/map/skill.c4
-rw-r--r--src/map/status.c33
-rw-r--r--src/map/trade.c20
9 files changed, 122 insertions, 121 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index d6a7e12ef..d6389639f 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -2971,7 +2971,7 @@ int atcommand_pvpon(
return -1;
}
- if (!map[sd->bl.m].flag.pvp && !map[sd->bl.m].flag.nopvp) {
+ if (!map[sd->bl.m].flag.pvp) {
map[sd->bl.m].flag.pvp = 1;
clif_send0199(sd->bl.m, 1);
pl_allsd = map_getallusers(&users);
@@ -5626,8 +5626,6 @@ int atcommand_mapinfo(
strcpy(atcmd_output,"PvP Flags: ");
if (map[m_id].flag.pvp)
strcat(atcmd_output, "Pvp ON | ");
- if (map[m_id].flag.nopvp)
- strcat(atcmd_output, "NoPvp | ");
if (map[m_id].flag.pvp_noguild)
strcat(atcmd_output, "NoGuild | ");
if (map[m_id].flag.pvp_noparty)
diff --git a/src/map/clif.c b/src/map/clif.c
index c0f79c8e6..432329745 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -4901,9 +4901,6 @@ int clif_pvpset(struct map_session_data *sd,int pvprank,int pvpnum,int type)
{
nullpo_retr(0, sd);
- if(map[sd->bl.m].flag.nopvp)
- return 0;
-
if(type == 2) {
WFIFOHEAD(sd->fd,packet_len_table[0x19a]);
WFIFOW(sd->fd,0) = 0x19a;
@@ -9662,7 +9659,8 @@ void clif_parse_NpcStringInput(int fd,struct map_session_data *sd)
void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd)
{
RFIFOHEAD(fd);
- npc_scriptcont(sd,RFIFOL(fd,2));
+ if (sd->npc_id) //Avoid parsing anything when the script was done with. [Skotlex]
+ npc_scriptcont(sd,RFIFOL(fd,2));
}
/*==========================================
diff --git a/src/map/map.h b/src/map/map.h
index c26d45d8b..4a558f9cb 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -1018,7 +1018,6 @@ struct map_data {
unsigned noskill : 1;
unsigned nowarp : 1;
unsigned nowarpto : 1;
- unsigned nopvp : 1; // [Valaris]
unsigned noicewall : 1; // [Valaris]
unsigned snow : 1; // [Valaris]
unsigned clouds : 1;
diff --git a/src/map/npc.c b/src/map/npc.c
index 092dda2ad..87d6a9b17 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -2218,6 +2218,7 @@ static int npc_parse_mapflag (char *w1, char *w2, char *w3, char *w4)
{
int m;
char mapname[MAP_NAME_LENGTH];
+ int state = 1;
// 引数の個数チェック
if (sscanf(w1, "%15[^,]",mapname) != 1)
@@ -2226,12 +2227,16 @@ static int npc_parse_mapflag (char *w1, char *w2, char *w3, char *w4)
m = map_mapname2mapid(mapname);
if (m < 0)
return 1;
-
+ if (w4 && strcmpi(w4, "off") == 0)
+ state = 0; //Disable mapflag rather than enable it. [Skotlex]
+
//マップフラグ
if (strcmpi(w3, "nosave") == 0) {
char savemap[MAP_NAME_LENGTH];
int savex, savey;
- if (strcmp(w4, "SavePoint") == 0) {
+ if (state == 0)
+ ; //Map flag disabled.
+ else if (strcmp(w4, "SavePoint") == 0) {
map[m].save.map = 0;
map[m].save.x = -1;
map[m].save.y = -1;
@@ -2245,40 +2250,40 @@ static int npc_parse_mapflag (char *w1, char *w2, char *w3, char *w4)
map[m].save.y = -1;
}
}
- map[m].flag.nosave = 1;
+ map[m].flag.nosave = state;
}
else if (strcmpi(w3,"nomemo")==0) {
- map[m].flag.nomemo=1;
+ map[m].flag.nomemo=state;
}
else if (strcmpi(w3,"noteleport")==0) {
- map[m].flag.noteleport=1;
+ map[m].flag.noteleport=state;
}
else if (strcmpi(w3,"nowarp")==0) {
- map[m].flag.nowarp=1;
+ map[m].flag.nowarp=state;
}
else if (strcmpi(w3,"nowarpto")==0) {
- map[m].flag.nowarpto=1;
+ map[m].flag.nowarpto=state;
}
else if (strcmpi(w3,"noreturn")==0) {
- map[m].flag.noreturn=1;
+ map[m].flag.noreturn=state;
}
else if (strcmpi(w3,"monster_noteleport")==0) {
- map[m].flag.monster_noteleport=1;
+ map[m].flag.monster_noteleport=state;
}
else if (strcmpi(w3,"nobranch")==0) {
- map[m].flag.nobranch=1;
+ map[m].flag.nobranch=state;
}
else if (strcmpi(w3,"nopenalty")==0) {
- map[m].flag.nopenalty=1;
+ map[m].flag.nopenalty=state;
}
else if (strcmpi(w3,"pvp")==0) {
- map[m].flag.pvp=1;
+ map[m].flag.pvp=state;
}
else if (strcmpi(w3,"pvp_noparty")==0) {
- map[m].flag.pvp_noparty=1;
+ map[m].flag.pvp_noparty=state;
}
else if (strcmpi(w3,"pvp_noguild")==0) {
- map[m].flag.pvp_noguild=1;
+ map[m].flag.pvp_noguild=state;
}
else if (strcmpi(w3, "pvp_nightmaredrop") == 0) {
char drop_arg1[16], drop_arg2[16];
@@ -2307,103 +2312,104 @@ static int npc_parse_mapflag (char *w1, char *w2, char *w3, char *w4)
}
map[m].flag.pvp_nightmaredrop = 1;
}
- }
+ } else if (!state) //Disable
+ map[m].flag.pvp_nightmaredrop = 0;
}
else if (strcmpi(w3,"pvp_nocalcrank")==0) {
- map[m].flag.pvp_nocalcrank=1;
+ map[m].flag.pvp_nocalcrank=state;
}
else if (strcmpi(w3,"gvg")==0) {
- map[m].flag.gvg=1;
+ map[m].flag.gvg=state;
}
else if (strcmpi(w3,"gvg_noparty")==0) {
- map[m].flag.gvg_noparty=1;
+ map[m].flag.gvg_noparty=state;
}
else if (strcmpi(w3,"gvg_dungeon")==0) {
- map[m].flag.gvg_dungeon=1;
+ map[m].flag.gvg_dungeon=state;
}
else if (strcmpi(w3,"gvg_castle")==0) {
- map[m].flag.gvg_castle=1;
+ map[m].flag.gvg_castle=state;
}
else if (strcmpi(w3,"nozenypenalty")==0) {
- map[m].flag.nozenypenalty=1;
+ map[m].flag.nozenypenalty=state;
}
else if (strcmpi(w3,"notrade")==0) {
- map[m].flag.notrade=1;
+ map[m].flag.notrade=state;
}
else if (strcmpi(w3,"nodrop")==0) {
- map[m].flag.nodrop=1;
+ map[m].flag.nodrop=state;
}
else if (strcmpi(w3,"noskill")==0) {
- map[m].flag.noskill=1;
- }
- else if (battle_config.pk_mode && strcmpi(w3,"nopvp")==0) { // nopvp for pk mode [Valaris]
- map[m].flag.nopvp=1;
- map[m].flag.pvp=0;
+ map[m].flag.noskill=state;
}
else if (strcmpi(w3,"noicewall")==0) { // noicewall [Valaris]
- map[m].flag.noicewall=1;
+ map[m].flag.noicewall=state;
}
else if (strcmpi(w3,"snow")==0) { // snow [Valaris]
- map[m].flag.snow=1;
+ map[m].flag.snow=state;
}
else if (strcmpi(w3,"clouds")==0) {
- map[m].flag.clouds=1;
+ map[m].flag.clouds=state;
}
else if (strcmpi(w3,"clouds2")==0) { // clouds2 [Valaris]
- map[m].flag.clouds2=1;
+ map[m].flag.clouds2=state;
}
else if (strcmpi(w3,"fog")==0) { // fog [Valaris]
- map[m].flag.fog=1;
+ map[m].flag.fog=state;
}
else if (strcmpi(w3,"fireworks")==0) {
- map[m].flag.fireworks=1;
+ map[m].flag.fireworks=state;
}
else if (strcmpi(w3,"sakura")==0) { // sakura [Valaris]
- map[m].flag.sakura=1;
+ map[m].flag.sakura=state;
}
else if (strcmpi(w3,"leaves")==0) { // leaves [Valaris]
- map[m].flag.leaves=1;
+ map[m].flag.leaves=state;
}
else if (strcmpi(w3,"rain")==0) { // rain [Valaris]
- map[m].flag.rain=1;
+ map[m].flag.rain=state;
}
else if (strcmpi(w3,"indoors")==0) { // celest
- map[m].flag.indoors=1;
+ map[m].flag.indoors=state;
}
else if (strcmpi(w3,"nightenabled")==0) { // Skotlex
- map[m].flag.nightenabled=1;
+ map[m].flag.nightenabled=state;
}
else if (strcmpi(w3,"nogo")==0) { // celest
- map[m].flag.nogo=1;
+ map[m].flag.nogo=state;
}
else if (strcmpi(w3,"noexp")==0) { // Lorky
- map[m].flag.nobaseexp=1;
- map[m].flag.nojobexp=1;
+ map[m].flag.nobaseexp=state;
+ map[m].flag.nojobexp=state;
}
else if (strcmpi(w3,"nobaseexp")==0) { // Lorky
- map[m].flag.nobaseexp=1;
+ map[m].flag.nobaseexp=state;
}
else if (strcmpi(w3,"nojobexp")==0) { // Lorky
- map[m].flag.nojobexp=1;
+ map[m].flag.nojobexp=state;
}
else if (strcmpi(w3,"noloot")==0) { // Lorky
- map[m].flag.nomobloot=1;
- map[m].flag.nomvploot=1;
+ map[m].flag.nomobloot=state;
+ map[m].flag.nomvploot=state;
}
else if (strcmpi(w3,"nomobloot")==0) { // Lorky
- map[m].flag.nomobloot=1;
+ map[m].flag.nomobloot=state;
}
else if (strcmpi(w3,"nomvploot")==0) { // Lorky
- map[m].flag.nomvploot=1;
+ map[m].flag.nomvploot=state;
}
else if (strcmpi(w3,"nocommand")==0) { // Skotlex
- map[m].flag.nocommand=1;
+ map[m].flag.nocommand=state;
}
else if (strcmpi(w3,"restricted")==0) { // Komurka
- map[m].flag.restricted=1;
- sscanf(w4, "%d", &map[m].zone);
- //map[m].zone = pow(2,map[m].zone+1);
- map[m].zone = 1<<(map[m].zone+1);
+ if (state) {
+ map[m].flag.restricted=1;
+ sscanf(w4, "%d", &state);
+ map[m].zone |= 1<<(state+1);
+ } else {
+ map[m].flag.restricted=0;
+ map[m].zone = 0;
+ }
}
return 0;
diff --git a/src/map/pc.c b/src/map/pc.c
index 03db5bd9c..b9b532ea1 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -519,7 +519,7 @@ int pc_setequipindex(struct map_session_data *sd)
return 0;
}
-int pc_isAllowedCardOn(struct map_session_data *sd,int s,int eqindex,int flag) {
+static int pc_isAllowedCardOn(struct map_session_data *sd,int s,int eqindex,int flag) {
int i;
struct item *item = &sd->status.inventory[eqindex];
struct item_data *data;
@@ -558,11 +558,11 @@ int pc_isequip(struct map_session_data *sd,int n)
return 0;
if(item->sex != 2 && sd->status.sex != item->sex)
return 0;
- if(map[sd->bl.m].flag.pvp && (item->flag.no_equip&1 || !pc_isAllowedCardOn(sd,item->slot,n,1))) //optimized by Lupus
+ if(map[sd->bl.m].flag.pvp && item->flag.no_equip&1)
return 0;
- if(map_flag_gvg(sd->bl.m) && (item->flag.no_equip&2 || !pc_isAllowedCardOn(sd,item->slot,n,2))) //optimized by Lupus
+ if(map_flag_gvg(sd->bl.m) && item->flag.no_equip&2)
return 0;
- if(map[sd->bl.m].zone && map[sd->bl.m].flag.restricted && (item->flag.no_equip&map[sd->bl.m].zone || !pc_isAllowedCardOn(sd,item->slot,n,map[sd->bl.m].zone)))
+ if(map[sd->bl.m].flag.restricted && item->flag.no_equip&map[sd->bl.m].zone)
return 0;
if (sd->sc.count) {
@@ -2592,8 +2592,7 @@ int pc_isUseitem(struct map_session_data *sd,int n)
if (
(map[sd->bl.m].flag.pvp && item->flag.no_equip&1) || // PVP
(map_flag_gvg(sd->bl.m) && item->flag.no_equip&2) || // GVG
- (map[sd->bl.m].zone && map[sd->bl.m].flag.restricted &&
- item->flag.no_equip&map[sd->bl.m].zone) // Zone restriction
+ (map[sd->bl.m].flag.restricted && item->flag.no_equip&map[sd->bl.m].zone) // Zone restriction
)
return 0;
@@ -6400,23 +6399,31 @@ int pc_checkitem(struct map_session_data *sd)
calc_flag = 1;
}
//?備制限チェック
- if(sd->status.inventory[i].equip && (map[sd->bl.m].flag.pvp||map[sd->bl.m].flag.gvg) &&
- (it->flag.no_equip&1 || !pc_isAllowedCardOn(sd,it->slot,i,1)))
- { //PVP check for forbiden items. optimized by [Lupus]
- sd->status.inventory[i].equip=0;
- calc_flag = 1;
- } else if(sd->status.inventory[i].equip && map_flag_gvg(sd->bl.m) &&
- (it->flag.no_equip&2 || !pc_isAllowedCardOn(sd,it->slot,i,2)))
- { //GvG optimized by [Lupus]
- sd->status.inventory[i].equip=0;
- calc_flag = 1;
- } else if(sd->status.inventory[i].equip && (map[sd->bl.m].zone) && (map[sd->bl.m].flag.restricted) &&
- (it->flag.no_equip&map[sd->bl.m].zone))
- { // Restricted zone by [Komurka]
- sd->status.inventory[i].equip=0;
- calc_flag = 1;
+ if(sd->status.inventory[i].equip && it) {
+ if (map[sd->bl.m].flag.pvp && it->flag.no_equip&1)
+ { //PVP check for forbiden items. optimized by [Lupus]
+ sd->status.inventory[i].equip=0;
+ calc_flag = 1;
+ } else
+ if (map_flag_gvg(sd->bl.m) && it->flag.no_equip&2)
+ { //GvG optimized by [Lupus]
+ sd->status.inventory[i].equip=0;
+ calc_flag = 1;
+ } else
+ if(map[sd->bl.m].flag.restricted && it->flag.no_equip&map[sd->bl.m].zone)
+ { // Restricted zone by [Komurka]
+ sd->status.inventory[i].equip=0;
+ calc_flag = 1;
+ }
+ if (!calc_flag) { //Check cards
+ int flag;
+ flag = (map[sd->bl.m].flag.restricted?map[sd->bl.m].zone:0)
+ | (map[sd->bl.m].flag.pvp?1:0)
+ | (map_flag_gvg(sd->bl.m)?2:0);
+ if (flag && !pc_isAllowedCardOn(sd,it->slot,i,flag))
+ calc_flag = 1;
+ }
}
-
}
pc_setequipindex(sd);
diff --git a/src/map/script.c b/src/map/script.c
index cc0483c5c..d0af3b8c0 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -6617,7 +6617,7 @@ int buildin_isloggedin(struct script_state *st)
*/
enum { MF_NOMEMO,MF_NOTELEPORT,MF_NOSAVE,MF_NOBRANCH,MF_NOPENALTY,MF_NOZENYPENALTY,
MF_PVP,MF_PVP_NOPARTY,MF_PVP_NOGUILD,MF_GVG,MF_GVG_NOPARTY,MF_NOTRADE,MF_NOSKILL,
- MF_NOWARP,MF_NOPVP,MF_NOICEWALL,MF_SNOW,MF_FOG,MF_SAKURA,MF_LEAVES,MF_RAIN,
+ MF_NOWARP,MF_FREE,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_NODROP };
@@ -6703,9 +6703,6 @@ int buildin_setmapflag(struct script_state *st)
case MF_NOWARP:
map[m].flag.nowarp=1;
break;
- case MF_NOPVP:
- map[m].flag.nopvp=1;
- break;
case MF_NOICEWALL: // [Valaris]
map[m].flag.noicewall=1;
break;
@@ -6836,9 +6833,6 @@ int buildin_removemapflag(struct script_state *st)
case MF_NOWARP:
map[m].flag.nowarp=0;
break;
- case MF_NOPVP:
- map[m].flag.nopvp=0;
- break;
case MF_NOICEWALL: // [Valaris]
map[m].flag.noicewall=0;
break;
@@ -6916,7 +6910,7 @@ int buildin_pvpon(struct script_state *st)
str=conv_str(st,& (st->stack->stack_data[st->start+2]));
m = map_mapname2mapid(str);
- if(m >= 0 && !map[m].flag.pvp && !map[m].flag.nopvp) {
+ if(m >= 0 && !map[m].flag.pvp) {
map[m].flag.pvp = 1;
clif_send0199(m,1);
@@ -6949,7 +6943,7 @@ int buildin_pvpoff(struct script_state *st)
str=conv_str(st,& (st->stack->stack_data[st->start+2]));
m = map_mapname2mapid(str);
- if(m >= 0 && map[m].flag.pvp && !map[m].flag.nopvp) { //fixed Lupus
+ if(m >= 0 && map[m].flag.pvp) { //fixed Lupus
map[m].flag.pvp = 0;
clif_send0199(m,0);
diff --git a/src/map/skill.c b/src/map/skill.c
index a3c1b8813..34980758b 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -828,10 +828,8 @@ int skillnotok(int skillid, struct map_session_data *sd)
return 1;
if (agit_flag && skill_get_nocast (skillid) & 8)
return 1;
- if (battle_config.pk_mode && !map[sd->bl.m].flag.nopvp && skill_get_nocast (skillid) & 16)
+ if (battle_config.pk_mode && map[sd->bl.m].flag.pvp && skill_get_nocast (skillid) & 16)
return 1;
-//printf("skill %d, flag restricted=%d, zone=%d, zone*8=%d, skill_get_nocast (skillid)=%d, skill_get_nocast (skillid)&8*zone=%d\n",
-// skillid,map[sd->bl.m].flag.restricted,map[sd->bl.m].zone,map[sd->bl.m].zone*8, skill_get_nocast (skillid),skill_get_nocast (skillid) & (8*map[sd->bl.m].zone));
if(map[sd->bl.m].flag.restricted && map[sd->bl.m].zone && skill_get_nocast (skillid) & (8*map[sd->bl.m].zone))
return 1;
diff --git a/src/map/status.c b/src/map/status.c
index 2cfbbaf89..d40830465 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -814,6 +814,8 @@ int status_calc_pc(struct map_session_data* sd,int first)
if(sd->inventory_data[index]) {
int j,c;
+ struct item_data *data;
+
//Card script execution.
if(sd->status.inventory[index].card[0]==0x00ff ||
sd->status.inventory[index].card[0]==0x00fe ||
@@ -821,17 +823,28 @@ int status_calc_pc(struct map_session_data* sd,int first)
continue;
for(j=0;j<sd->inventory_data[index]->slot;j++){ // カ?ド
current_equip_card_id= c= sd->status.inventory[index].card[j];
- if(c>0){
- if(i == 8 && sd->status.inventory[index].equip == 0x20)
- { //Left hand status.
- sd->state.lr_flag = 1;
- run_script(itemdb_equipscript(c),0,sd->bl.id,0);
- sd->state.lr_flag = 0;
- } else
- run_script(itemdb_equipscript(c),0,sd->bl.id,0);
- if (!calculating) //Abort, run_script retriggered status_calc_pc. [Skotlex]
- return 1;
+ if(!c)
+ continue;
+ data = itemdb_exists(c);
+ if (!data || !data->script)
+ continue;
+ if(data->flag.no_equip) { //Card restriction checks.
+ if(map[sd->bl.m].flag.restricted && data->flag.no_equip&map[sd->bl.m].zone)
+ continue;
+ if(map[sd->bl.m].flag.pvp && data->flag.no_equip&1)
+ continue;
+ if(map_flag_gvg(sd->bl.m) && data->flag.no_equip&2)
+ continue;
}
+ if(i == 8 && sd->status.inventory[index].equip == 0x20)
+ { //Left hand status.
+ sd->state.lr_flag = 1;
+ run_script(data->script,0,sd->bl.id,0);
+ sd->state.lr_flag = 0;
+ } else
+ run_script(data->script,0,sd->bl.id,0);
+ if (!calculating) //Abort, run_script retriggered status_calc_pc. [Skotlex]
+ return 1;
}
}
}
diff --git a/src/map/trade.c b/src/map/trade.c
index 15f99b9c4..eb870418d 100644
--- a/src/map/trade.c
+++ b/src/map/trade.c
@@ -204,11 +204,8 @@ int trade_check(struct map_session_data *sd) {
if (inventory2[i].nameid == inventory[n].nameid &&
inventory2[i].card[0] == inventory[n].card[0] && inventory2[i].card[1] == inventory[n].card[1] &&
inventory2[i].card[2] == inventory[n].card[2] && inventory2[i].card[3] == inventory[n].card[3]) {
- if (inventory2[i].amount + amount > MAX_AMOUNT) {
- clif_displaymessage(sd->fd, msg_txt(592)); // Trade can not be done, because one of your doesn't have enough free slots in its inventory.
- clif_displaymessage(target_sd->fd, msg_txt(592)); // Trade can not be done, because one of your doesn't have enough free slots in its inventory.
+ if (inventory2[i].amount + amount > MAX_AMOUNT)
return 0;
- }
inventory2[i].amount += amount;
inventory[n].amount -= amount;
if (inventory[n].amount <= 0)
@@ -228,11 +225,8 @@ int trade_check(struct map_session_data *sd) {
break;
}
}
- if (i == MAX_INVENTORY) {
- clif_displaymessage(sd->fd, msg_txt(592)); // Trade can not be done, because one of your doesn't have enough free slots in its inventory.
- clif_displaymessage(target_sd->fd, msg_txt(592)); // Trade can not be done, because one of your doesn't have enough free slots in its inventory.
+ if (i == MAX_INVENTORY)
return 0;
- }
}
}
}
@@ -251,11 +245,8 @@ int trade_check(struct map_session_data *sd) {
if (inventory[i].nameid == inventory2[n].nameid &&
inventory[i].card[0] == inventory2[n].card[0] && inventory[i].card[1] == inventory2[n].card[1] &&
inventory[i].card[2] == inventory2[n].card[2] && inventory[i].card[3] == inventory2[n].card[3]) {
- if (inventory[i].amount + amount > MAX_AMOUNT) {
- clif_displaymessage(sd->fd, msg_txt(592)); // Trade can not be done, because one of your doesn't have enough free slots in its inventory.
- clif_displaymessage(target_sd->fd, msg_txt(592)); // Trade can not be done, because one of your doesn't have enough free slots in its inventory.
+ if (inventory[i].amount + amount > MAX_AMOUNT)
return 0;
- }
inventory[i].amount += amount;
inventory2[n].amount -= amount;
if (inventory2[n].amount <= 0)
@@ -274,11 +265,8 @@ int trade_check(struct map_session_data *sd) {
break;
}
}
- if (i == MAX_INVENTORY) {
- clif_displaymessage(sd->fd, msg_txt(592)); // Trade can not be done, because one of your doesn't have enough free slots in its inventory.
- clif_displaymessage(target_sd->fd, msg_txt(592)); // Trade can not be done, because one of your doesn't have enough free slots in its inventory.
+ if (i == MAX_INVENTORY)
return 0;
- }
}
}
}