summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorglighta <glighta@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-11-24 08:50:59 +0000
committerglighta <glighta@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-11-24 08:50:59 +0000
commit913fd65ef9a5fa55ebbd5ac4502f72895879fc84 (patch)
tree0241f5c639284276a216f86a964c8ff64bb0532b /src
parenteef34512a2f465f7b2b5453fadfcc0e61c097e01 (diff)
downloadhercules-913fd65ef9a5fa55ebbd5ac4502f72895879fc84.tar.gz
hercules-913fd65ef9a5fa55ebbd5ac4502f72895879fc84.tar.bz2
hercules-913fd65ef9a5fa55ebbd5ac4502f72895879fc84.tar.xz
hercules-913fd65ef9a5fa55ebbd5ac4502f72895879fc84.zip
-Fix bugreport:6751 allow noseige to be casted while under status.
-Upd athena-start, save pid to not kill all other process with same name (annoying when multiple server) -Harmonize setmapflag and @mapflag, flag value is always an int, and could be superior to 1 for some mapflag -Fix bugreport:6923 for Windows -Upd @zeny to remove rest of zeny if not enough money as requested git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16959 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/atcommand.c12
-rw-r--r--src/map/clif.c5
-rw-r--r--src/map/pc.c36
-rw-r--r--src/map/script.c24
4 files changed, 48 insertions, 29 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index ebdd7353b..394f4fb11 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -2538,8 +2538,10 @@ ACMD_FUNC(zeny)
if((ret=pc_getzeny(sd,zeny,LOG_TYPE_COMMAND,NULL)) == 1)
clif_displaymessage(fd, msg_txt(149)); // Unable to increase the number/value.
}
- else if((ret=pc_payzeny(sd,-zeny,LOG_TYPE_COMMAND,NULL)) == 1){
- clif_displaymessage(fd, msg_txt(41)); // Unable to decrease the number/value.
+ else {
+ if( sd->status.zeny < -zeny ) zeny = -sd->status.zeny;
+ if((ret=pc_payzeny(sd,-zeny,LOG_TYPE_COMMAND,NULL)) == 1)
+ clif_displaymessage(fd, msg_txt(41)); // Unable to decrease the number/value.
}
if(!ret) clif_displaymessage(fd, msg_txt(176)); //ret=0 mean cmd success
return 0;
@@ -7585,14 +7587,14 @@ ACMD_FUNC(fakename)
ACMD_FUNC(mapflag) {
#define checkflag( cmd ) if ( map[ sd->bl.m ].flag.cmd ) clif_displaymessage(sd->fd,#cmd)
#define setflag( cmd ) \
- if ( strcmp( flag_name , #cmd ) == 0 && ( flag == 0 || flag == 1 ) ){\
+ if ( strcmp( flag_name , #cmd ) == 0 ){\
map[ sd->bl.m ].flag.cmd = flag;\
sprintf(atcmd_output,"[ @mapflag ] %s flag has been set to %s",#cmd,flag?"On":"Off");\
clif_displaymessage(sd->fd,atcmd_output);\
return 0;\
}
unsigned char flag_name[100];
- int flag=9,i;
+ int flag=0,i;
nullpo_retr(-1, sd);
memset(flag_name, '\0', sizeof(flag_name));
@@ -7935,7 +7937,7 @@ ACMD_FUNC(clone)
if(pc_isdead(sd)){
clif_displaymessage(fd, msg_txt(129+flag*2));
return 0;
- }
+ }
master = sd->bl.id;
if (battle_config.atc_slave_clone_limit
&& mob_countslave(&sd->bl) >= battle_config.atc_slave_clone_limit) {
diff --git a/src/map/clif.c b/src/map/clif.c
index 5ed1dc694..5e7c7f9bf 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -1478,7 +1478,7 @@ void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag)
void clif_send_homdata(struct map_session_data *sd, int state, int param)
{ //[orn]
int fd = sd->fd;
-
+
if ( (state == SP_INTIMATE) && (param >= 910) && (sd->hd->homunculus.class_ == sd->hd->homunculusDB->evo_class) )
merc_hom_calc_skilltree(sd->hd, 0);
@@ -10175,9 +10175,6 @@ void clif_parse_UseItem(int fd, struct map_session_data *sd)
return;
}
- if (sd->sc.opt1 > 0 && sd->sc.opt1 != OPT1_STONEWAIT && sd->sc.opt1 != OPT1_BURNING)
- return;
-
//This flag enables you to use items while in an NPC. [Skotlex]
if (sd->npc_id) {
if (sd->npc_id != sd->npc_item_flag)
diff --git a/src/map/pc.c b/src/map/pc.c
index 6f85aa532..59709cdf1 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -4181,13 +4181,29 @@ int pc_useitem(struct map_session_data *sd,int n)
if( !pc_isUseitem(sd,n) )
return 0;
- //Prevent mass item usage. [Skotlex]
- if( DIFF_TICK(sd->canuseitem_tick, tick) > 0 ||
- (itemdb_iscashfood(sd->status.inventory[n].nameid) && DIFF_TICK(sd->canusecashfood_tick, tick) > 0)
- )
+ // Store information for later use before it is lost (via pc_delitem) [Paradox924X]
+ nameid = sd->inventory_data[n]->nameid;
+
+ if (nameid != ITEMID_NAUTHIZ && sd->sc.opt1 > 0 && sd->sc.opt1 != OPT1_STONEWAIT && sd->sc.opt1 != OPT1_BURNING)
return 0;
- if( sd->sc.count && (
+ if( sd->sc.count){
+ if((nameid == ITEMID_NAUTHIZ) && ( //bugreport 6751
+ sd->sc.data[SC_FREEZE] ||
+ sd->sc.data[SC_STUN] ||
+ sd->sc.data[SC_DEEPSLEEP] ||
+ sd->sc.data[SC_STONE] ||
+ sd->sc.data[SC_CRYSTALIZE]
+ )
+ ){
+ sd->sc.opt1 = 0; //remove option and status to allow skill
+ status_change_end(&sd->bl,SC_FREEZE,INVALID_TIMER);
+ status_change_end(&sd->bl,SC_STUN,INVALID_TIMER);
+ status_change_end(&sd->bl,SC_DEEPSLEEP,INVALID_TIMER);
+ status_change_end(&sd->bl,SC_STONE,INVALID_TIMER);
+ status_change_end(&sd->bl,SC_CRYSTALIZE,INVALID_TIMER);
+ } //let us continue
+ else if(
sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] ||
(sd->sc.data[SC_GRAVITATION] && sd->sc.data[SC_GRAVITATION]->val3 == BCT_SELF) ||
sd->sc.data[SC_TRICKDEAD] ||
@@ -4196,11 +4212,15 @@ int pc_useitem(struct map_session_data *sd,int n)
sd->sc.data[SC__MANHOLE] ||
sd->sc.data[SC_KAGEHUMI] ||
(sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOITEM)
- ))
+ )
return 0;
+ }
- // Store information for later use before it is lost (via pc_delitem) [Paradox924X]
- nameid = sd->inventory_data[n]->nameid;
+ //Prevent mass item usage. [Skotlex]
+ if( DIFF_TICK(sd->canuseitem_tick, tick) > 0 ||
+ (itemdb_iscashfood(nameid) && DIFF_TICK(sd->canusecashfood_tick, tick) > 0)
+ )
+ return 0;
/* Items with delayed consume are not meant to work while in mounts except reins of mount(12622) */
if( sd->inventory_data[n]->flag.delay_consume ) {
diff --git a/src/map/script.c b/src/map/script.c
index 0ae150f72..f1a422b7e 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -9648,7 +9648,7 @@ BUILDIN_FUNC(getusers)
BUILDIN_FUNC(getusersname)
{
TBL_PC *sd, *pl_sd;
- int disp_num=1, group_level = 0;
+ int /*disp_num=1,*/ group_level = 0;
struct s_mapiterator* iter;
sd = script_rid2sd(st);
@@ -10727,12 +10727,12 @@ BUILDIN_FUNC(setmapflag)
{
int m,i;
const char *str;
- const char *val=NULL;
+ int val=0;
str=script_getstr(st,2);
i=script_getnum(st,3);
if(script_hasdata(st,4)){
- val=script_getstr(st,4);
+ val=script_getnum(st,4);
}
m = map_mapname2mapid(str);
if(m >= 0) {
@@ -10784,13 +10784,13 @@ BUILDIN_FUNC(setmapflag)
case MF_NOWARPTO: map[m].flag.nowarpto = 1; break;
case MF_NIGHTMAREDROP: map[m].flag.pvp_nightmaredrop = 1; break;
case MF_RESTRICTED:
- map[m].zone |= 1<<((int)atoi(val)+1);
+ map[m].zone |= 1<<(val+1);
map[m].flag.restricted=1;
break;
- case MF_NOCOMMAND: map[m].nocommand = (!val || atoi(val) <= 0) ? 100 : atoi(val); break;
+ case MF_NOCOMMAND: map[m].nocommand = (val <= 0) ? 100 : val; break;
case MF_NODROP: map[m].flag.nodrop = 1; break;
- case MF_JEXP: map[m].jexp = (!val || atoi(val) < 0) ? 100 : atoi(val); break;
- case MF_BEXP: map[m].bexp = (!val || atoi(val) < 0) ? 100 : atoi(val); break;
+ case MF_JEXP: map[m].jexp = (val <= 0) ? 100 : val; break;
+ case MF_BEXP: map[m].bexp = (val <= 0) ? 100 : val; break;
case MF_NOVENDING: map[m].flag.novending = 1; break;
case MF_LOADEVENT: map[m].flag.loadevent = 1; break;
case MF_NOCHAT: map[m].flag.nochat = 1; break;
@@ -10801,7 +10801,7 @@ BUILDIN_FUNC(setmapflag)
case MF_ALLOWKS: map[m].flag.allowks = 1; break;
case MF_MONSTER_NOTELEPORT: map[m].flag.monster_noteleport = 1; break;
case MF_PVP_NOCALCRANK: map[m].flag.pvp_nocalcrank = 1; break;
- case MF_BATTLEGROUND: map[m].flag.battleground = (!val || atoi(val) < 0 || atoi(val) > 2) ? 1 : atoi(val); break;
+ case MF_BATTLEGROUND: map[m].flag.battleground = (val <= 0 || val > 2) ? 1 : val; break;
case MF_RESET: map[m].flag.reset = 1; break;
}
}
@@ -10813,12 +10813,12 @@ BUILDIN_FUNC(removemapflag)
{
int m,i;
const char *str;
- const char *val=NULL;
+ int val=0;
str=script_getstr(st,2);
i=script_getnum(st,3);
if(script_hasdata(st,4)){
- val=script_getstr(st,4);
+ val=script_getnum(st,4);
}
m = map_mapname2mapid(str);
if(m >= 0) {
@@ -10868,7 +10868,7 @@ BUILDIN_FUNC(removemapflag)
case MF_NOWARPTO: map[m].flag.nowarpto = 0; break;
case MF_NIGHTMAREDROP: map[m].flag.pvp_nightmaredrop = 0; break;
case MF_RESTRICTED:
- map[m].zone ^= 1<<((int)atoi(val)+1);
+ map[m].zone ^= 1<<(val+1);
if (map[m].zone == 0){
map[m].flag.restricted=0;
}
@@ -16942,7 +16942,7 @@ BUILDIN_FUNC(getcharip)
/* initiliaze */
const char *ip_addr = NULL;
uint32 ip;
-
+
/* set ip, ip_addr and convert to ip and push str */
ip = session[sd->fd]->client_addr;
ip_addr = ip2str(ip, NULL);