diff options
author | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-02-04 18:23:57 +0000 |
---|---|---|
committer | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-02-04 18:23:57 +0000 |
commit | 8214af442ea63919d69d368221ae2d61456488b9 (patch) | |
tree | 9efad3f11ace58a29ad05c0c3c9e9fa31964def8 /src/map | |
parent | 46ca642c09468dbc52ca390c8f1d368e7ffa2966 (diff) | |
download | hercules-8214af442ea63919d69d368221ae2d61456488b9.tar.gz hercules-8214af442ea63919d69d368221ae2d61456488b9.tar.bz2 hercules-8214af442ea63919d69d368221ae2d61456488b9.tar.xz hercules-8214af442ea63919d69d368221ae2d61456488b9.zip |
- Some code cleanups.
- Added new Cell types (NoChat and NoDamage)
- Added JobChangeLevel and FreeSKPoints to #stats
- Added a Crash protection in clif_send with invalid fd values.
- Merged a missing update in TK Mission.
- Added script command 'getmapflag'
- Merged some new Status Change to Stable.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12175 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/battle.c | 3 | ||||
-rw-r--r-- | src/map/charcommand.c | 4 | ||||
-rw-r--r-- | src/map/chat.c | 6 | ||||
-rw-r--r-- | src/map/clif.c | 40 | ||||
-rw-r--r-- | src/map/map.c | 6 | ||||
-rw-r--r-- | src/map/map.h | 8 | ||||
-rw-r--r-- | src/map/mob.c | 2 | ||||
-rw-r--r-- | src/map/script.c | 62 | ||||
-rw-r--r-- | src/map/skill.c | 4 | ||||
-rw-r--r-- | src/map/status.c | 21 | ||||
-rw-r--r-- | src/map/status.h | 6 |
11 files changed, 128 insertions, 34 deletions
diff --git a/src/map/battle.c b/src/map/battle.c index 437f95253..9e5d05623 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -3020,6 +3020,9 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f return -1; } + if (flag&BCT_ENEMY && map_getcell(m,src->x,src->y,CELL_CHKNODAMAGE) || map_getcell(m,target->x,target->y,CELL_CHKNODAMAGE)) + return -1; // [NoDamage] + //t_bl/s_bl hold the 'master' of the attack, while src/target are the actual //objects involved. if ((t_bl = battle_get_master(target)) == NULL) diff --git a/src/map/charcommand.c b/src/map/charcommand.c index 768251005..a097dcbad 100644 --- a/src/map/charcommand.c +++ b/src/map/charcommand.c @@ -230,6 +230,8 @@ int charcommand_stats(const int fd, struct map_session_data* sd, const char* com { "Dex - %3d", 0 }, { "Luk - %3d", 0 }, { "Zeny - %d", 0 }, + { "Free SK Points - %d", 0 }, + { "JobChangeLvl - %d", 0 }, { NULL, 0 } }; @@ -263,6 +265,8 @@ int charcommand_stats(const int fd, struct map_session_data* sd, const char* com output_table[10].value = pl_sd->status.dex; output_table[11].value = pl_sd->status.luk; output_table[12].value = pl_sd->status.zeny; + output_table[13].value = pl_sd->status.skill_point; + output_table[14].value = pl_sd->change_level; sprintf(job_jobname, "Job - %s %s", job_name(pl_sd->status.class_), "(level %d)"); sprintf(output, msg_txt(53), pl_sd->status.name); // '%s' stats: diff --git a/src/map/chat.c b/src/map/chat.c index 67a4dbaee..a01356205 100644 --- a/src/map/chat.c +++ b/src/map/chat.c @@ -71,6 +71,12 @@ int chat_createpcchat(struct map_session_data* sd, const char* title, const char return 0; //Can't create chatrooms on this map. } + if( map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOCHAT) ) + { + clif_displaymessage (sd->fd, "Can't create chat rooms in this Area."); + return 0; + } + pc_stop_walking(sd,1); cd = chat_createchat(&sd->bl, title, pass, limit, pub, 0, ""); diff --git a/src/map/clif.c b/src/map/clif.c index 9a796b659..3a1afb5cb 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -373,23 +373,26 @@ int clif_send(const uint8* buf, int len, struct block_list* bl, enum send_target if (p) { for(i=0;i<MAX_PARTY;i++){ - if ((sd = p->data[i].sd) == NULL) + if( (sd = p->data[i].sd) == NULL ) continue; - if (!(fd=sd->fd) || session[fd] == NULL || sd->state.auth == 0 - || session[fd]->session_data == NULL || sd->packet_ver > MAX_PACKET_VER) + + if( !(fd=sd->fd) || fd <= 0 || fd >= fd_max ) + continue; + + if( session[fd] == NULL || sd->state.auth == 0 || session[fd]->session_data == NULL || sd->packet_ver > MAX_PACKET_VER ) continue; - if (sd->bl.id == bl->id && (type == PARTY_WOS || type == PARTY_SAMEMAP_WOS || type == PARTY_AREA_WOS)) + if( sd->bl.id == bl->id && (type == PARTY_WOS || type == PARTY_SAMEMAP_WOS || type == PARTY_AREA_WOS) ) continue; - if (type != PARTY && type != PARTY_WOS && bl->m != sd->bl.m) + if( type != PARTY && type != PARTY_WOS && bl->m != sd->bl.m ) continue; - if ((type == PARTY_AREA || type == PARTY_AREA_WOS) && - (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1)) + if( (type == PARTY_AREA || type == PARTY_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) continue; - if (packet_db[sd->packet_ver][RBUFW(buf,0)].len) { // packet must exist for the client version + if( packet_db[sd->packet_ver][RBUFW(buf,0)].len ) + { // packet must exist for the client version WFIFOHEAD(fd,len); memcpy(WFIFOP(fd,0), buf, len); WFIFOSET(fd,len); @@ -455,22 +458,25 @@ int clif_send(const uint8* buf, int len, struct block_list* bl, enum send_target if (g) { for(i = 0; i < g->max_member; i++) { - if ((sd = g->member[i].sd) != NULL) { - if (!(fd=sd->fd) || session[fd] == NULL || sd->state.auth == 0 - || session[fd]->session_data == NULL || sd->packet_ver > MAX_PACKET_VER) + if( (sd = g->member[i].sd) != NULL ) + { + if( !(fd=sd->fd) || fd <= 0 || fd >= fd_max ) continue; - if (sd->bl.id == bl->id && (type == GUILD_WOS || type == GUILD_SAMEMAP_WOS || type == GUILD_AREA_WOS)) + if( session[fd] == NULL || sd->state.auth == 0 || session[fd]->session_data == NULL || sd->packet_ver > MAX_PACKET_VER ) continue; - if (type != GUILD && type != GUILD_WOS && sd->bl.m != bl->m) + if( sd->bl.id == bl->id && (type == GUILD_WOS || type == GUILD_SAMEMAP_WOS || type == GUILD_AREA_WOS) ) continue; - if ((type == GUILD_AREA || type == GUILD_AREA_WOS) && - (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1)) + if( type != GUILD && type != GUILD_WOS && sd->bl.m != bl->m ) continue; - if (packet_db[sd->packet_ver][RBUFW(buf,0)].len) { // packet must exist for the client version + if( (type == GUILD_AREA || type == GUILD_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + + if( packet_db[sd->packet_ver][RBUFW(buf,0)].len ) + { // packet must exist for the client version WFIFOHEAD(fd,len); memcpy(WFIFOP(fd,0), buf, len); WFIFOSET(fd,len); @@ -9598,7 +9604,7 @@ void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) return; if (sd->state.storage_flag == 1) storage_storageaddfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); - else if (sd->state.storage_flag == 2) + else if (sd->state.storage_flag == 2) storage_guild_storageaddfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); } diff --git a/src/map/map.c b/src/map/map.c index cda1fccc9..153206101 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -2321,6 +2321,10 @@ int map_getcellp(struct map_data* m,int x,int y,cell_chk cellchk) return (cell.icewall); case CELL_CHKNOVENDING: return (cell.novending); + case CELL_CHKNODAMAGE: + return (cell.nodamage); + case CELL_CHKNOCHAT: + return (cell.nochat); // special checks case CELL_CHKPASS: @@ -2373,6 +2377,8 @@ void map_setcell(int m, int x, int y, cell_t cell, bool flag) case CELL_BASILICA: map[m].cell[j].basilica = flag; break; case CELL_LANDPROTECTOR: map[m].cell[j].landprotector = flag; break; case CELL_NOVENDING: map[m].cell[j].novending = flag; break; + case CELL_NODAMAGE: map[m].cell[j].nodamage = flag; break; + case CELL_NOCHAT: map[m].cell[j].nochat = flag; break; default: ShowWarning("map_setcell: invalid cell type '%d'\n", (int)cell); break; diff --git a/src/map/map.h b/src/map/map.h index af797b127..457494dab 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -1107,6 +1107,8 @@ typedef enum { CELL_LANDPROTECTOR, CELL_ICEWALL, CELL_NOVENDING, + CELL_NODAMAGE, + CELL_NOCHAT, } cell_t; // used by map_getcell() @@ -1128,6 +1130,8 @@ typedef enum { CELL_CHKLANDPROTECTOR, CELL_CHKICEWALL, CELL_CHKNOVENDING, + CELL_CHKNODAMAGE, + CELL_CHKNOCHAT, } cell_chk; struct mapcell @@ -1144,7 +1148,9 @@ struct mapcell landprotector : 1, basilica : 1, icewall : 1, - novending : 1; + novending : 1, + nodamage : 1, + nochat : 1; #ifdef CELL_NOSTACK unsigned char cell_bl; //Holds amount of bls in this cell. diff --git a/src/map/mob.c b/src/map/mob.c index d642a1e01..f319fc144 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1814,7 +1814,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) if (hp||sp) status_heal(src, hp, sp, battle_config.show_hp_sp_gain?2:0); if (sd->mission_mobid == md->class_) { //TK_MISSION [Skotlex] - if (++sd->mission_count >= 100 && (temp = mob_get_random_id(0,0xC, sd->status.base_level))) + if (++sd->mission_count >= 100 && (temp = mob_get_random_id(0, 0xE, sd->status.base_level))) { pc_addfame(sd, 1); sd->mission_mobid = temp; diff --git a/src/map/script.c b/src/map/script.c index 8e0125cf1..e907da19d 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -8810,6 +8810,67 @@ BUILDIN_FUNC(setmapflagnosave) return 0; } +BUILDIN_FUNC(getmapflag) +{ + int m,i; + const char *str; + + str=script_getstr(st,2); + i=script_getnum(st,3); + + m = map_mapname2mapid(str); + if(m >= 0) { + switch(i) { + case MF_NOMEMO: script_pushint(st,map[m].flag.nomemo); break; + case MF_NOTELEPORT: script_pushint(st,map[m].flag.noteleport); break; + case MF_NOBRANCH: script_pushint(st,map[m].flag.nobranch); break; + case MF_NOPENALTY: script_pushint(st,map[m].flag.noexppenalty); break; + case MF_NOZENYPENALTY: script_pushint(st,map[m].flag.nozenypenalty); break; + case MF_PVP: script_pushint(st,map[m].flag.pvp); break; + case MF_PVP_NOPARTY: script_pushint(st,map[m].flag.pvp_noparty); break; + case MF_PVP_NOGUILD: script_pushint(st,map[m].flag.pvp_noguild); break; + case MF_GVG: script_pushint(st,map[m].flag.gvg); break; + case MF_GVG_NOPARTY: script_pushint(st,map[m].flag.gvg_noparty); break; + case MF_GVG_DUNGEON: script_pushint(st,map[m].flag.gvg_dungeon); break; + case MF_GVG_CASTLE: script_pushint(st,map[m].flag.gvg_castle); break; + case MF_NOTRADE: script_pushint(st,map[m].flag.notrade); break; + case MF_NODROP: script_pushint(st,map[m].flag.nodrop); break; + case MF_NOSKILL: script_pushint(st,map[m].flag.noskill); break; + case MF_NOWARP: script_pushint(st,map[m].flag.nowarp); break; + case MF_NOICEWALL: script_pushint(st,map[m].flag.noicewall); break; + case MF_SNOW: script_pushint(st,map[m].flag.snow); break; + case MF_CLOUDS: script_pushint(st,map[m].flag.clouds); break; + case MF_CLOUDS2: script_pushint(st,map[m].flag.clouds2); break; + case MF_FOG: script_pushint(st,map[m].flag.fog); break; + case MF_FIREWORKS: script_pushint(st,map[m].flag.fireworks); break; + case MF_SAKURA: script_pushint(st,map[m].flag.sakura); break; + case MF_LEAVES: script_pushint(st,map[m].flag.leaves); break; + case MF_RAIN: script_pushint(st,map[m].flag.rain); break; + case MF_INDOORS: script_pushint(st,map[m].flag.indoors); break; + case MF_NIGHTENABLED: script_pushint(st,map[m].flag.nightenabled); break; + case MF_NOGO: script_pushint(st,map[m].flag.nogo); break; + case MF_NOBASEEXP: script_pushint(st,map[m].flag.nobaseexp); break; + case MF_NOJOBEXP: script_pushint(st,map[m].flag.nojobexp); break; + case MF_NOMOBLOOT: script_pushint(st,map[m].flag.nomobloot); break; + case MF_NOMVPLOOT: script_pushint(st,map[m].flag.nomvploot); break; + case MF_NORETURN: script_pushint(st,map[m].flag.noreturn); break; + case MF_NOWARPTO: script_pushint(st,map[m].flag.nowarpto); break; + case MF_NIGHTMAREDROP: script_pushint(st,map[m].flag.pvp_nightmaredrop); break; + case MF_RESTRICTED: script_pushint(st,map[m].flag.restricted); break; + case MF_NOCOMMAND: script_pushint(st,map[m].nocommand); break; + case MF_JEXP: script_pushint(st,map[m].jexp); break; + case MF_BEXP: script_pushint(st,map[m].bexp); break; + case MF_NOVENDING: script_pushint(st,map[m].flag.novending); break; + case MF_LOADEVENT: script_pushint(st,map[m].flag.loadevent); break; + case MF_NOCHAT: script_pushint(st,map[m].flag.nochat); break; + case MF_PARTYLOCK: script_pushint(st,map[m].flag.partylock); break; + case MF_GUILDLOCK: script_pushint(st,map[m].flag.guildlock); break; + } + } + + return 0; +} + BUILDIN_FUNC(setmapflag) { int m,i; @@ -13163,6 +13224,7 @@ struct script_function buildin_func[] = { BUILDIN_DEF(detachrid,""), BUILDIN_DEF(isloggedin,"i?"), BUILDIN_DEF(setmapflagnosave,"ssii"), + BUILDIN_DEF(getmapflag,"si"), BUILDIN_DEF(setmapflag,"si*"), BUILDIN_DEF(removemapflag,"si"), BUILDIN_DEF(pvpon,"s"), diff --git a/src/map/skill.c b/src/map/skill.c index 4115d08d8..064b6d2d5 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -255,7 +255,7 @@ int skill_calc_heal (struct block_list *src, struct block_list *target, int skil heal += heal * skill * 2 / 100; sc = status_get_sc(target); - if (sc && sc->count) + if( sc && sc->count ) { if( sc->data[SC_CRITICALWOUND] ) heal -= heal * sc->data[SC_CRITICALWOUND]->val2/100; @@ -6732,7 +6732,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns int heal = sg->val2; if (tstatus->hp >= tstatus->max_hp) break; - if (tsc) + if( tsc ) { if( tsc->data[SC_INCHEALRATE] ) heal += heal * tsc->data[SC_INCHEALRATE]->val1 / 100; diff --git a/src/map/status.c b/src/map/status.c index 6ea757d2b..4b1144d49 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -6825,6 +6825,17 @@ int status_change_timer(int tid, unsigned int tick, int id, int data) } break; + case SC_KNOWLEDGE: + if (!sd) break; + if(bl->m == sd->feel_map[0].m || + bl->m == sd->feel_map[1].m || + bl->m == sd->feel_map[2].m) + { //Timeout will be handled by pc_setpos + sce->timer = INVALID_TIMER; + return 0; + } + break; + case SC_HPREGEN: if( sd && --(sce->val4) >= 0 ) { @@ -6837,16 +6848,6 @@ int status_change_timer(int tid, unsigned int tick, int id, int data) } break; - case SC_KNOWLEDGE: - if (!sd) break; - if(bl->m == sd->feel_map[0].m || - bl->m == sd->feel_map[1].m || - bl->m == sd->feel_map[2].m) - { //Timeout will be handled by pc_setpos - sce->timer = INVALID_TIMER; - return 0; - } - break; case SC_DANCING: //ダンススキルの時間SP消費 { int s = 0; diff --git a/src/map/status.h b/src/map/status.h index 97aea9d2b..b036dbd09 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -280,9 +280,9 @@ enum sc_type { SC_INCDEF, SC_INCBASEATK, SC_FASTCAST, - SC_INCMDEFRATE, // Mdef Potion - SC_HPREGEN, // Life Potion - SC_INCHEALRATE, // Regeneration Potion + SC_INCMDEFRATE, + SC_HPREGEN, + SC_INCHEALRATE, SC_PNEUMA, SC_MAX, //Automatically updated max, used in for's to check we are within bounds. }; |