- 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://svn.code.sf.net/p/rathena/svn/trunk@12175 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
zephyrus 2008-02-04 18:23:57 +00:00
parent 127d1feaab
commit c4fb4f4361
13 changed files with 137 additions and 34 deletions

View File

@ -3,6 +3,13 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2008/02/04
* Some code cleanups. [Zephyrus]
- 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'
2008/02/03
* Fixes to Devotion (see topic:153345) [ultramage]
- removed totally fake Devotion packet from Marionette Control code

View File

@ -232,6 +232,8 @@ cell_basilica 4
cell_landprotector 5
cell_icewall 6
cell_novending 7
cell_nodamage 8
cell_nochat 9
StatusPoint 9 1
BaseLevel 11 1

View File

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

View File

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

View File

@ -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, "");

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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