- Added function status_change_init to initialize all the sc timers. Added sc_data initialization to the npc structures who were missing them.
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5953 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
38bd5b5675
commit
8f20e263b2
@ -439,7 +439,7 @@ int get_access(char *nick) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int irc_rmnames() {
|
int irc_rmnames(void) {
|
||||||
int i=0;
|
int i=0;
|
||||||
|
|
||||||
for(i=0;i<=MAX_CHANNEL_USERS;i++) {
|
for(i=0;i<=MAX_CHANNEL_USERS;i++) {
|
||||||
|
@ -48,4 +48,4 @@ int parse_names_packet(char *str);
|
|||||||
int parse_names(char *str);
|
int parse_names(char *str);
|
||||||
int set_access(char *nick,int level);
|
int set_access(char *nick,int level);
|
||||||
int get_access(char *nick);
|
int get_access(char *nick);
|
||||||
int irc_rmnames();
|
int irc_rmnames(void);
|
||||||
|
@ -186,7 +186,6 @@ int mob_parse_dataset(struct spawn_data *data) {
|
|||||||
struct mob_data* mob_spawn_dataset(struct spawn_data *data)
|
struct mob_data* mob_spawn_dataset(struct spawn_data *data)
|
||||||
{
|
{
|
||||||
struct mob_data *md = aCalloc(1, sizeof(struct mob_data));
|
struct mob_data *md = aCalloc(1, sizeof(struct mob_data));
|
||||||
int i;
|
|
||||||
md->bl.id= npc_get_new_npc_id();
|
md->bl.id= npc_get_new_npc_id();
|
||||||
md->bl.type = BL_MOB;
|
md->bl.type = BL_MOB;
|
||||||
md->bl.subtype = MONS;
|
md->bl.subtype = MONS;
|
||||||
@ -210,9 +209,10 @@ struct mob_data* mob_spawn_dataset(struct spawn_data *data)
|
|||||||
md->spawn_n = -1;
|
md->spawn_n = -1;
|
||||||
md->deletetimer = -1;
|
md->deletetimer = -1;
|
||||||
md->skillidx = -1;
|
md->skillidx = -1;
|
||||||
for (i = 0; i < MAX_STATUSCHANGE; i++)
|
|
||||||
md->sc.data[i].timer = -1;
|
|
||||||
status_set_viewdata(&md->bl, md->class_);
|
status_set_viewdata(&md->bl, md->class_);
|
||||||
|
status_change_init(&md->bl);
|
||||||
|
unit_dataset(&md->bl);
|
||||||
|
|
||||||
map_addiddb(&md->bl);
|
map_addiddb(&md->bl);
|
||||||
return md;
|
return md;
|
||||||
}
|
}
|
||||||
@ -708,7 +708,6 @@ int mob_spawn (struct mob_data *md)
|
|||||||
md->state.skillstate = MSS_IDLE;
|
md->state.skillstate = MSS_IDLE;
|
||||||
md->next_walktime = tick+rand()%5000+1000;
|
md->next_walktime = tick+rand()%5000+1000;
|
||||||
md->last_linktime = tick;
|
md->last_linktime = tick;
|
||||||
unit_dataset(&md->bl);
|
|
||||||
|
|
||||||
/* Guardians should be spawned using mob_spawn_guardian! [Skotlex]
|
/* Guardians should be spawned using mob_spawn_guardian! [Skotlex]
|
||||||
* and the Emperium is spawned using mob_once_spawn.
|
* and the Emperium is spawned using mob_once_spawn.
|
||||||
|
@ -1494,8 +1494,9 @@ int npc_parse_warp (char *w1,char *w2,char *w3,char *w4)
|
|||||||
nd->bl.type = BL_NPC;
|
nd->bl.type = BL_NPC;
|
||||||
nd->bl.subtype = WARP;
|
nd->bl.subtype = WARP;
|
||||||
map_addblock(&nd->bl);
|
map_addblock(&nd->bl);
|
||||||
unit_dataset(&nd->bl);
|
|
||||||
status_set_viewdata(&nd->bl, nd->class_);
|
status_set_viewdata(&nd->bl, nd->class_);
|
||||||
|
status_change_init(&nd->bl);
|
||||||
|
unit_dataset(&nd->bl);
|
||||||
clif_spawn(&nd->bl);
|
clif_spawn(&nd->bl);
|
||||||
strdb_put(npcname_db, nd->name, nd);
|
strdb_put(npcname_db, nd->name, nd);
|
||||||
|
|
||||||
@ -1580,12 +1581,13 @@ static int npc_parse_shop (char *w1, char *w2, char *w3, char *w4)
|
|||||||
npc_shop++;
|
npc_shop++;
|
||||||
nd->bl.type = BL_NPC;
|
nd->bl.type = BL_NPC;
|
||||||
nd->bl.subtype = SHOP;
|
nd->bl.subtype = SHOP;
|
||||||
unit_dataset(&nd->bl);
|
|
||||||
nd->ud.dir = dir;
|
|
||||||
if (m >= 0) {
|
if (m >= 0) {
|
||||||
nd->n = map_addnpc(m,nd);
|
nd->n = map_addnpc(m,nd);
|
||||||
map_addblock(&nd->bl);
|
map_addblock(&nd->bl);
|
||||||
status_set_viewdata(&nd->bl, nd->class_);
|
status_set_viewdata(&nd->bl, nd->class_);
|
||||||
|
status_change_init(&nd->bl);
|
||||||
|
unit_dataset(&nd->bl);
|
||||||
|
nd->ud.dir = dir;
|
||||||
clif_spawn(&nd->bl);
|
clif_spawn(&nd->bl);
|
||||||
} else
|
} else
|
||||||
// we skip map_addnpc, but still add it to the list of ID's
|
// we skip map_addnpc, but still add it to the list of ID's
|
||||||
@ -1880,13 +1882,15 @@ static int npc_parse_script (char *w1,char *w2,char *w3,char *w4,char *first_lin
|
|||||||
npc_script++;
|
npc_script++;
|
||||||
nd->bl.type = BL_NPC;
|
nd->bl.type = BL_NPC;
|
||||||
nd->bl.subtype = SCRIPT;
|
nd->bl.subtype = SCRIPT;
|
||||||
unit_dataset(&nd->bl);
|
|
||||||
nd->ud.dir = dir;
|
|
||||||
|
|
||||||
for (i = 0; i < MAX_EVENTTIMER; i++)
|
for (i = 0; i < MAX_EVENTTIMER; i++)
|
||||||
nd->eventtimer[i] = -1;
|
nd->eventtimer[i] = -1;
|
||||||
if (m >= 0) {
|
if (m >= 0) {
|
||||||
nd->n = map_addnpc(m, nd);
|
nd->n = map_addnpc(m, nd);
|
||||||
|
status_set_viewdata(&nd->bl, nd->class_);
|
||||||
|
status_change_init(&nd->bl);
|
||||||
|
unit_dataset(&nd->bl);
|
||||||
|
nd->ud.dir = dir;
|
||||||
map_addblock(&nd->bl);
|
map_addblock(&nd->bl);
|
||||||
if (evflag) { // ƒCƒxƒ“ƒgŒ^
|
if (evflag) { // ƒCƒxƒ“ƒgŒ^
|
||||||
struct event_data *ev = (struct event_data *)aCalloc(1, sizeof(struct event_data));
|
struct event_data *ev = (struct event_data *)aCalloc(1, sizeof(struct event_data));
|
||||||
@ -1894,7 +1898,6 @@ static int npc_parse_script (char *w1,char *w2,char *w3,char *w4,char *first_lin
|
|||||||
ev->pos = 0;
|
ev->pos = 0;
|
||||||
strdb_put(ev_db, nd->exname, ev);
|
strdb_put(ev_db, nd->exname, ev);
|
||||||
} else {
|
} else {
|
||||||
status_set_viewdata(&nd->bl, nd->class_);
|
|
||||||
clif_spawn(&nd->bl);
|
clif_spawn(&nd->bl);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -415,7 +415,6 @@ int pc_setnewpc(struct map_session_data *sd, int account_id, int char_id, int lo
|
|||||||
sd->state.auth = 0;
|
sd->state.auth = 0;
|
||||||
sd->bl.type = BL_PC;
|
sd->bl.type = BL_PC;
|
||||||
sd->canlog_tick = gettick();
|
sd->canlog_tick = gettick();
|
||||||
unit_dataset(&sd->bl);
|
|
||||||
sd->state.waitingdisconnect = 0;
|
sd->state.waitingdisconnect = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -677,14 +676,12 @@ int pc_authok(struct map_session_data *sd, int login_id2, time_t connect_until_t
|
|||||||
|
|
||||||
//Set here because we need the inventory data for weapon sprite parsing.
|
//Set here because we need the inventory data for weapon sprite parsing.
|
||||||
status_set_viewdata(&sd->bl, sd->status.class_);
|
status_set_viewdata(&sd->bl, sd->status.class_);
|
||||||
|
status_change_init(&sd->bl);
|
||||||
|
unit_dataset(&sd->bl);
|
||||||
|
|
||||||
// pet
|
// pet
|
||||||
sd->pet_hungry_timer = -1;
|
sd->pet_hungry_timer = -1;
|
||||||
|
|
||||||
// ステ?タス異常の初期化
|
|
||||||
for(i = 0; i < MAX_STATUSCHANGE; i++) {
|
|
||||||
sd->sc.data[i].timer=-1;
|
|
||||||
}
|
|
||||||
sd->sc.count=0;
|
|
||||||
if ((battle_config.atc_gmonly == 0 || pc_isGM(sd)) &&
|
if ((battle_config.atc_gmonly == 0 || pc_isGM(sd)) &&
|
||||||
(pc_isGM(sd) >= get_atcommand_level(AtCommand_Hide)))
|
(pc_isGM(sd) >= get_atcommand_level(AtCommand_Hide)))
|
||||||
sd->status.option &= (OPTION_MASK | OPTION_INVISIBLE);
|
sd->status.option &= (OPTION_MASK | OPTION_INVISIBLE);
|
||||||
|
@ -3401,6 +3401,16 @@ struct status_change *status_get_sc(struct block_list *bl)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void status_change_init(struct block_list *bl)
|
||||||
|
{
|
||||||
|
struct status_change *sc = status_get_sc(bl);
|
||||||
|
int i;
|
||||||
|
nullpo_retv(sc);
|
||||||
|
memset(sc, 0, sizeof (struct status_change));
|
||||||
|
for (i=0; i< SC_MAX; i++)
|
||||||
|
sc->data[i].timer = -1;
|
||||||
|
}
|
||||||
|
|
||||||
//Returns defense against the specified status change.
|
//Returns defense against the specified status change.
|
||||||
//Return range is 0 (no resist) to 10000 (inmunity)
|
//Return range is 0 (no resist) to 10000 (inmunity)
|
||||||
int status_get_sc_def(struct block_list *bl, int type)
|
int status_get_sc_def(struct block_list *bl, int type)
|
||||||
|
@ -483,6 +483,7 @@ int status_get_race2(struct block_list *bl);
|
|||||||
|
|
||||||
struct view_data *status_get_viewdata(struct block_list *bl);
|
struct view_data *status_get_viewdata(struct block_list *bl);
|
||||||
void status_set_viewdata(struct block_list *bl, int class_);
|
void status_set_viewdata(struct block_list *bl, int class_);
|
||||||
|
void status_change_init(struct block_list *bl);
|
||||||
struct status_change *status_get_sc(struct block_list *bl);
|
struct status_change *status_get_sc(struct block_list *bl);
|
||||||
|
|
||||||
int status_get_matk1(struct block_list *bl);
|
int status_get_matk1(struct block_list *bl);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user