Changed pc_can_give_items() to use standard boolean logic instead of the inverted 1/0 one (bugreport:396)
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@12220 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
b03a01ee95
commit
76c27942f6
12
src/map/pc.c
12
src/map/pc.c
@ -318,16 +318,12 @@ int pc_setrestartvalue(struct map_session_data *sd,int type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*==========================================
|
/*==========================================
|
||||||
Determines if the GM can give / drop / trade / vend items [Lupus]
|
Determines if the GM can give / drop / trade / vend items
|
||||||
Args: GM Level (current player GM level)
|
Args: GM Level (current player GM level)
|
||||||
* Returns
|
|
||||||
1 = this GM can't do it
|
|
||||||
0 = this one can do it
|
|
||||||
*------------------------------------------*/
|
*------------------------------------------*/
|
||||||
int pc_can_give_items(int level)
|
bool pc_can_give_items(int level)
|
||||||
{
|
{
|
||||||
return ( level >= battle_config.gm_cant_drop_min_lv
|
return( level < battle_config.gm_cant_drop_min_lv || level > battle_config.gm_cant_drop_max_lv );
|
||||||
&& level <= battle_config.gm_cant_drop_max_lv);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*==========================================
|
/*==========================================
|
||||||
@ -5817,7 +5813,7 @@ int pc_setriding(TBL_PC* sd, int flag)
|
|||||||
int pc_candrop(struct map_session_data *sd,struct item *item)
|
int pc_candrop(struct map_session_data *sd,struct item *item)
|
||||||
{
|
{
|
||||||
int level = pc_isGM(sd);
|
int level = pc_isGM(sd);
|
||||||
if ( pc_can_give_items(level) ) //check if this GM level can drop items
|
if ( !pc_can_give_items(level) ) //check if this GM level can drop items
|
||||||
return 0;
|
return 0;
|
||||||
return (itemdb_isdropable(item, level));
|
return (itemdb_isdropable(item, level));
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ extern int duel_count;
|
|||||||
int pc_class2idx(int class_);
|
int pc_class2idx(int class_);
|
||||||
int pc_isGM(struct map_session_data *sd);
|
int pc_isGM(struct map_session_data *sd);
|
||||||
int pc_getrefinebonus(int lv,int type);
|
int pc_getrefinebonus(int lv,int type);
|
||||||
int pc_can_give_items(int level); //[Lupus]
|
bool pc_can_give_items(int level);
|
||||||
|
|
||||||
int pc_setrestartvalue(struct map_session_data *sd,int type);
|
int pc_setrestartvalue(struct map_session_data *sd,int type);
|
||||||
int pc_makesavestatus(struct map_session_data *);
|
int pc_makesavestatus(struct map_session_data *);
|
||||||
|
@ -3933,7 +3933,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
|
|||||||
case MC_VENDING:
|
case MC_VENDING:
|
||||||
if(sd)
|
if(sd)
|
||||||
{ //Prevent vending of GMs with unnecessary Level to trade/drop. [Skotlex]
|
{ //Prevent vending of GMs with unnecessary Level to trade/drop. [Skotlex]
|
||||||
if ( pc_can_give_items(pc_isGM(sd)) )
|
if ( !pc_can_give_items(pc_isGM(sd)) )
|
||||||
clif_skill_fail(sd,skillid,0,0);
|
clif_skill_fail(sd,skillid,0,0);
|
||||||
else
|
else
|
||||||
clif_openvendingreq(sd,2+skilllv);
|
clif_openvendingreq(sd,2+skilllv);
|
||||||
|
@ -138,7 +138,7 @@ int storage_storageopen(struct map_session_data *sd)
|
|||||||
if(sd->state.storage_flag)
|
if(sd->state.storage_flag)
|
||||||
return 1; //Already open?
|
return 1; //Already open?
|
||||||
|
|
||||||
if(pc_can_give_items(pc_isGM(sd)))
|
if( !pc_can_give_items(pc_isGM(sd)) )
|
||||||
{ //check is this GM level is allowed to put items to storage
|
{ //check is this GM level is allowed to put items to storage
|
||||||
clif_displaymessage(sd->fd, msg_txt(246));
|
clif_displaymessage(sd->fd, msg_txt(246));
|
||||||
return 1;
|
return 1;
|
||||||
@ -508,7 +508,7 @@ int storage_guild_storageopen(struct map_session_data *sd)
|
|||||||
if(sd->state.storage_flag)
|
if(sd->state.storage_flag)
|
||||||
return 1; //Can't open both storages at a time.
|
return 1; //Can't open both storages at a time.
|
||||||
|
|
||||||
if( pc_can_give_items(pc_isGM(sd)) ) { //check is this GM level can open guild storage and store items [Lupus]
|
if( !pc_can_give_items(pc_isGM(sd)) ) { //check is this GM level can open guild storage and store items [Lupus]
|
||||||
clif_displaymessage(sd->fd, msg_txt(246));
|
clif_displaymessage(sd->fd, msg_txt(246));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta
|
|||||||
}
|
}
|
||||||
|
|
||||||
level = pc_isGM(sd);
|
level = pc_isGM(sd);
|
||||||
if ( pc_can_give_items(level) || pc_can_give_items(pc_isGM(target_sd)) ) //check if both GMs are allowed to trade
|
if ( !pc_can_give_items(level) || !pc_can_give_items(pc_isGM(target_sd)) ) //check if both GMs are allowed to trade
|
||||||
{
|
{
|
||||||
clif_displaymessage(sd->fd, msg_txt(246));
|
clif_displaymessage(sd->fd, msg_txt(246));
|
||||||
clif_tradestart(sd, 2); // GM is not allowed to trade
|
clif_tradestart(sd, 2); // GM is not allowed to trade
|
||||||
|
Loading…
x
Reference in New Issue
Block a user