- The default event script behaviour is to trigger on labels rather than NPCs now.
- Removed several script config options which break NPC compatibility when you mess with them (event_script_type, event_requires_trigger, die_event_name, kill_pc_event_name, kill_mob_event_name, logout_event_name, login_event_name, loadmap_event_name, baselvup_event_name, joblvup_event_name) - LoadMap events no longer set the variable "@maploaded$" to the name of the new map. - Optimized/simplified the code now that the previous config options were removed. git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11859 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
655100c9e2
commit
fc7b4eaef0
@ -3,6 +3,16 @@ Date Added
|
|||||||
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
|
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.
|
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
|
||||||
|
|
||||||
|
2007/12/06
|
||||||
|
* The default event script behaviour is to trigger on labels rather than
|
||||||
|
NPCs now.
|
||||||
|
* Removed several script config options which break NPC compatibility when
|
||||||
|
you mess with them (event_script_type, event_requires_trigger,
|
||||||
|
die_event_name, kill_pc_event_name, kill_mob_event_name, logout_event_name,
|
||||||
|
login_event_name, loadmap_event_name, baselvup_event_name,
|
||||||
|
joblvup_event_name)
|
||||||
|
* LoadMap events no longer set the variable "@maploaded$" to the name of
|
||||||
|
the new map. [Skotlex]
|
||||||
2007/12/03
|
2007/12/03
|
||||||
* Fixed a bug on Mail System. Removed the possibility to lost the attachment on
|
* Fixed a bug on Mail System. Removed the possibility to lost the attachment on
|
||||||
a Map - Char server disconnection. [Zephyrus]
|
a Map - Char server disconnection. [Zephyrus]
|
||||||
|
@ -21,40 +21,4 @@ check_cmdcount: 655360
|
|||||||
|
|
||||||
check_gotocount: 2048
|
check_gotocount: 2048
|
||||||
|
|
||||||
|
|
||||||
//---- Custom script functions ----
|
|
||||||
|
|
||||||
// 0 - Event script is defined as an NPC by itself
|
|
||||||
// 1 - Event script can be called by script label
|
|
||||||
event_script_type: 0
|
|
||||||
|
|
||||||
// For events to be activated do we require
|
|
||||||
// a 'set [EventName],1;' to be called first?
|
|
||||||
event_requires_trigger: no
|
|
||||||
|
|
||||||
// Name of event when a player has died
|
|
||||||
die_event_name: OnPCDieEvent
|
|
||||||
|
|
||||||
// Name of event when a player kills a player
|
|
||||||
kill_pc_event_name: OnPCKillEvent
|
|
||||||
|
|
||||||
// Name of event when a player kills a monster
|
|
||||||
kill_mob_event_name: OnNPCKillEvent
|
|
||||||
|
|
||||||
// Name of event when a player logs out
|
|
||||||
logout_event_name: OnPCLogoutEvent
|
|
||||||
|
|
||||||
// Name of event when a player logs in
|
|
||||||
login_event_name: OnPCLoginEvent
|
|
||||||
|
|
||||||
// Name of event when a player changes map
|
|
||||||
// NOTE: This event will only trigger on maps with the "loadevent" flag active.
|
|
||||||
loadmap_event_name: OnPCLoadMapEvent
|
|
||||||
|
|
||||||
// Name of event when a player levels up (base lv)
|
|
||||||
baselvup_event_name: OnPCBaseLvUpEvent
|
|
||||||
|
|
||||||
// Name of event when a player levels up (job lv)
|
|
||||||
joblvup_event_name: OnPCJobLvUpEvent
|
|
||||||
|
|
||||||
import: conf/import/script_conf.txt
|
import: conf/import/script_conf.txt
|
||||||
|
@ -868,16 +868,28 @@ This label will be executed if a trigger area is defined for the NPC object it's
|
|||||||
in. If it isn't present, the execution will start from the beginning of the NPC
|
in. If it isn't present, the execution will start from the beginning of the NPC
|
||||||
code. The RID of the triggering character object will be attached.
|
code. The RID of the triggering character object will be attached.
|
||||||
|
|
||||||
OnPCDieEvent:
|
|
||||||
OnPCKillEvent:
|
|
||||||
OnPCLogoutEvent:
|
|
||||||
OnPCLoginEvent:
|
OnPCLoginEvent:
|
||||||
|
OnPCLogoutEvent:
|
||||||
|
OnPCBaseLvUpEvent:
|
||||||
|
OnPCJobLvUpEvent:
|
||||||
|
|
||||||
These four special labels will be invoked if you have set 'event_script_type'
|
It's pretty obvious when these four special labels will be invoked. For more
|
||||||
value in your 'script_athena.conf' to 1, and you can change their names by
|
information, see 'npc/sample/PCLoginEvent.txt'
|
||||||
altering the configuration options in 'script_athena.conf'. It's pretty obvious
|
|
||||||
when those will get triggered. For more information, see
|
OnPCDieEvent:
|
||||||
'npc/sample/PCLoginEvent.txt'
|
|
||||||
|
This special label triggers when a player dies. The variable 'killerrid' is
|
||||||
|
set to the ID of the killer.
|
||||||
|
|
||||||
|
OnPCKillEvent:
|
||||||
|
|
||||||
|
This special label triggers when a player kills another player. The variable
|
||||||
|
'killedrid' is set to the ID of the player killed.
|
||||||
|
|
||||||
|
OnNPCKillEvent:
|
||||||
|
|
||||||
|
This special label triggers when a player kills a monster. The variable
|
||||||
|
'killedrid' is set to the Class of the monster killed.
|
||||||
|
|
||||||
OnPCLoadMapEvent:
|
OnPCLoadMapEvent:
|
||||||
|
|
||||||
|
@ -7913,11 +7913,8 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
|
|||||||
npc_event_dequeue(sd);
|
npc_event_dequeue(sd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lance
|
if(map[sd->bl.m].flag.loadevent) // Lance
|
||||||
if(sd->state.event_loadmap && map[sd->bl.m].flag.loadevent){
|
|
||||||
pc_setregstr(sd, add_str("@maploaded$"), map[sd->bl.m].name);
|
|
||||||
npc_script_event(sd, NPCE_LOADMAP);
|
npc_script_event(sd, NPCE_LOADMAP);
|
||||||
}
|
|
||||||
|
|
||||||
if (pc_checkskill(sd, SG_DEVIL) && !pc_nextjobexp(sd))
|
if (pc_checkskill(sd, SG_DEVIL) && !pc_nextjobexp(sd))
|
||||||
clif_status_load(&sd->bl, SI_DEVIL, 1); //blindness [Komurka]
|
clif_status_load(&sd->bl, SI_DEVIL, 1); //blindness [Komurka]
|
||||||
|
@ -1683,9 +1683,8 @@ int map_quit(struct map_session_data *sd)
|
|||||||
if(!sd->state.waitingdisconnect) {
|
if(!sd->state.waitingdisconnect) {
|
||||||
if (sd->npc_timer_id != -1) //Cancel the event timer.
|
if (sd->npc_timer_id != -1) //Cancel the event timer.
|
||||||
npc_timerevent_quit(sd);
|
npc_timerevent_quit(sd);
|
||||||
if (sd->state.event_disconnect)
|
|
||||||
npc_script_event(sd, NPCE_LOGOUT);
|
|
||||||
|
|
||||||
|
npc_script_event(sd, NPCE_LOGOUT);
|
||||||
sd->state.waitingdisconnect = 1;
|
sd->state.waitingdisconnect = 1;
|
||||||
if (sd->pd) unit_free(&sd->pd->bl,0);
|
if (sd->pd) unit_free(&sd->pd->bl,0);
|
||||||
if (sd->hd) unit_free(&sd->hd->bl,0);
|
if (sd->hd) unit_free(&sd->hd->bl,0);
|
||||||
|
@ -531,16 +531,7 @@ struct map_session_data {
|
|||||||
unsigned storage_flag : 2; //0: closed, 1: Normal Storage open, 2: guild storage open [Skotlex]
|
unsigned storage_flag : 2; //0: closed, 1: Normal Storage open, 2: guild storage open [Skotlex]
|
||||||
unsigned snovice_call_flag : 2; //Summon Angel (stage 1~3)
|
unsigned snovice_call_flag : 2; //Summon Angel (stage 1~3)
|
||||||
unsigned snovice_dead_flag : 2; //Explosion spirits on death: 0 off, 1 active, 2 used.
|
unsigned snovice_dead_flag : 2; //Explosion spirits on death: 0 off, 1 active, 2 used.
|
||||||
// originally by Qamera, adapted by celest
|
unsigned abra_flag : 1; // Abracadabra bugfix by Aru
|
||||||
unsigned event_death : 1;
|
|
||||||
unsigned event_kill_pc : 1;
|
|
||||||
unsigned event_disconnect : 1;
|
|
||||||
unsigned event_kill_mob : 1;
|
|
||||||
unsigned event_baselvup : 1;
|
|
||||||
unsigned event_joblvup : 1;
|
|
||||||
unsigned event_loadmap : 1;
|
|
||||||
// Abracadabra bugfix by Aru
|
|
||||||
unsigned abra_flag : 1;
|
|
||||||
unsigned autotrade : 1; //By Fantik
|
unsigned autotrade : 1; //By Fantik
|
||||||
unsigned reg_dirty : 3; //By Skotlex (marks whether registry variables have been saved or not yet)
|
unsigned reg_dirty : 3; //By Skotlex (marks whether registry variables have been saved or not yet)
|
||||||
unsigned showdelay :1;
|
unsigned showdelay :1;
|
||||||
|
@ -2218,7 +2218,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
|
|||||||
npc_event(mvp_sd,md->npc_event,0);
|
npc_event(mvp_sd,md->npc_event,0);
|
||||||
}
|
}
|
||||||
md->status.hp = 1;
|
md->status.hp = 1;
|
||||||
} else if (mvp_sd && mvp_sd->state.event_kill_mob) { //lordalfa
|
} else if (mvp_sd) { //lordalfa
|
||||||
pc_setglobalreg(mvp_sd,"killedrid",md->class_);
|
pc_setglobalreg(mvp_sd,"killedrid",md->class_);
|
||||||
npc_script_event(mvp_sd, NPCE_KILLNPC); // PCKillNPC [Lance]
|
npc_script_event(mvp_sd, NPCE_KILLNPC); // PCKillNPC [Lance]
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,6 @@ static struct view_data npc_viewdb[MAX_NPC_CLASS];
|
|||||||
|
|
||||||
static struct script_event_s
|
static struct script_event_s
|
||||||
{ //Holds pointers to the commonly executed scripts for speedup. [Skotlex]
|
{ //Holds pointers to the commonly executed scripts for speedup. [Skotlex]
|
||||||
struct npc_data *nd;
|
|
||||||
struct event_data *event[UCHAR_MAX];
|
struct event_data *event[UCHAR_MAX];
|
||||||
const char *event_name[UCHAR_MAX];
|
const char *event_name[UCHAR_MAX];
|
||||||
uint8 event_count;
|
uint8 event_count;
|
||||||
@ -2688,26 +2687,18 @@ void npc_parsesrcfile(const char* filepath)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int npc_script_event(struct map_session_data* sd, int type)
|
int npc_script_event(struct map_session_data* sd, enum npce_event type)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
if (type < 0 || type >= NPCE_MAX)
|
if (type == NPCE_MAX)
|
||||||
return 0;
|
return 0;
|
||||||
if (!sd) {
|
if (!sd) {
|
||||||
ShowError("npc_script_event: NULL sd. Event Type %d\n", type);
|
ShowError("npc_script_event: NULL sd. Event Type %d\n", type);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (script_event[type].nd) {
|
for (i = 0; i<script_event[type].event_count; i++)
|
||||||
TBL_NPC *nd = script_event[type].nd;
|
|
||||||
run_script(nd->u.scr.script,0,sd->bl.id,nd->bl.id);
|
|
||||||
return 1;
|
|
||||||
} else if (script_event[type].event_count) {
|
|
||||||
for (i = 0; i<script_event[type].event_count; i++) {
|
|
||||||
npc_event_sub(sd,script_event[type].event[i],script_event[type].event_name[i]);
|
npc_event_sub(sd,script_event[type].event[i],script_event[type].event_name[i]);
|
||||||
}
|
|
||||||
return i;
|
return i;
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int npc_read_event_script_sub(DBKey key, void* data, va_list ap)
|
static int npc_read_event_script_sub(DBKey key, void* data, va_list ap)
|
||||||
@ -2735,7 +2726,7 @@ void npc_read_event_script(void)
|
|||||||
int i;
|
int i;
|
||||||
struct {
|
struct {
|
||||||
char *name;
|
char *name;
|
||||||
char *event_name;
|
const char *event_name;
|
||||||
} config[] = {
|
} config[] = {
|
||||||
{"Login Event",script_config.login_event_name},
|
{"Login Event",script_config.login_event_name},
|
||||||
{"Logout Event",script_config.logout_event_name},
|
{"Logout Event",script_config.logout_event_name},
|
||||||
@ -2748,33 +2739,20 @@ void npc_read_event_script(void)
|
|||||||
};
|
};
|
||||||
|
|
||||||
for (i = 0; i < NPCE_MAX; i++) {
|
for (i = 0; i < NPCE_MAX; i++) {
|
||||||
script_event[i].nd = NULL;
|
|
||||||
script_event[i].event_count = 0;
|
|
||||||
if (!script_config.event_script_type) {
|
|
||||||
//Use a single NPC as event source.
|
|
||||||
script_event[i].nd = npc_name2id(config[i].event_name);
|
|
||||||
} else {
|
|
||||||
//Use an array of Events
|
|
||||||
char buf[64]="::";
|
char buf[64]="::";
|
||||||
|
script_event[i].event_count = 0;
|
||||||
|
//Use an array of Events
|
||||||
strncpy(buf+2,config[i].event_name,62);
|
strncpy(buf+2,config[i].event_name,62);
|
||||||
ev_db->foreach(ev_db,npc_read_event_script_sub,buf,
|
ev_db->foreach(ev_db,npc_read_event_script_sub,buf,
|
||||||
&script_event[i].event,
|
&script_event[i].event,
|
||||||
&script_event[i].event_name,
|
&script_event[i].event_name,
|
||||||
&script_event[i].event_count);
|
&script_event[i].event_count);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (battle_config.etc_log) {
|
if (battle_config.etc_log) {
|
||||||
//Print summary.
|
//Print summary.
|
||||||
for (i = 0; i < NPCE_MAX; i++) {
|
for (i = 0; i < NPCE_MAX; i++)
|
||||||
if(!script_config.event_script_type) {
|
|
||||||
if (script_event[i].nd)
|
|
||||||
ShowInfo("%s: Using NPC named '%s'.\n", config[i].name, config[i].event_name);
|
|
||||||
else
|
|
||||||
ShowInfo("%s: No NPC found with name '%s'.\n", config[i].name, config[i].event_name);
|
|
||||||
} else
|
|
||||||
ShowInfo("%s: %d '%s' events.\n", config[i].name, script_event[i].event_count, config[i].event_name);
|
ShowInfo("%s: %d '%s' events.\n", config[i].name, script_event[i].event_count, config[i].event_name);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int npc_cleanup_dbsub(DBKey key, void* data, va_list ap)
|
static int npc_cleanup_dbsub(DBKey key, void* data, va_list ap)
|
||||||
|
@ -27,7 +27,7 @@ int mob_chat_sub(struct block_list* bl, va_list ap);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Script NPC events.
|
//Script NPC events.
|
||||||
enum {
|
enum npce_event {
|
||||||
NPCE_LOGIN,
|
NPCE_LOGIN,
|
||||||
NPCE_LOGOUT,
|
NPCE_LOGOUT,
|
||||||
NPCE_LOADMAP,
|
NPCE_LOADMAP,
|
||||||
@ -88,7 +88,7 @@ void npc_unload_duplicates (struct npc_data* nd);
|
|||||||
int npc_unload(struct npc_data* nd);
|
int npc_unload(struct npc_data* nd);
|
||||||
int npc_reload(void);
|
int npc_reload(void);
|
||||||
void npc_read_event_script(void);
|
void npc_read_event_script(void);
|
||||||
int npc_script_event(struct map_session_data* sd, int type);
|
int npc_script_event(struct map_session_data* sd, enum npce_event type);
|
||||||
|
|
||||||
extern struct npc_data* fake_nd;
|
extern struct npc_data* fake_nd;
|
||||||
|
|
||||||
|
48
src/map/pc.c
48
src/map/pc.c
@ -727,11 +727,6 @@ int pc_authok(struct map_session_data *sd, int login_id2, time_t connect_until_t
|
|||||||
|
|
||||||
//Prevent S. Novices from getting the no-death bonus just yet. [Skotlex]
|
//Prevent S. Novices from getting the no-death bonus just yet. [Skotlex]
|
||||||
sd->die_counter=-1;
|
sd->die_counter=-1;
|
||||||
//Until the reg values arrive, set them to not require trigger...
|
|
||||||
sd->state.event_death = 1;
|
|
||||||
sd->state.event_kill_pc = 1;
|
|
||||||
sd->state.event_disconnect = 1;
|
|
||||||
sd->state.event_kill_mob = 1;
|
|
||||||
|
|
||||||
{ //Add IP field
|
{ //Add IP field
|
||||||
uint32 ip = session[sd->fd]->client_addr;
|
uint32 ip = session[sd->fd]->client_addr;
|
||||||
@ -867,25 +862,6 @@ int pc_reg_received(struct map_session_data *sd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Automated script events
|
|
||||||
if (script_config.event_requires_trigger) {
|
|
||||||
sd->state.event_death = pc_readglobalreg(sd, script_config.die_event_name);
|
|
||||||
sd->state.event_kill_pc = pc_readglobalreg(sd, script_config.kill_pc_event_name);
|
|
||||||
sd->state.event_kill_mob = pc_readglobalreg(sd, script_config.kill_mob_event_name);
|
|
||||||
sd->state.event_disconnect = pc_readglobalreg(sd, script_config.logout_event_name);
|
|
||||||
sd->state.event_baselvup = pc_readglobalreg(sd, script_config.baselvup_event_name);
|
|
||||||
sd->state.event_joblvup = pc_readglobalreg(sd, script_config.joblvup_event_name);
|
|
||||||
sd->state.event_loadmap = pc_readglobalreg(sd, script_config.loadmap_event_name);
|
|
||||||
// if script triggers are not required
|
|
||||||
} else {
|
|
||||||
sd->state.event_death = 1;
|
|
||||||
sd->state.event_kill_pc = 1;
|
|
||||||
sd->state.event_disconnect = 1;
|
|
||||||
sd->state.event_kill_mob = 1;
|
|
||||||
sd->state.event_baselvup = 1;
|
|
||||||
sd->state.event_joblvup = 1;
|
|
||||||
sd->state.event_loadmap = 1;
|
|
||||||
}
|
|
||||||
//Weird... maybe registries were reloaded?
|
//Weird... maybe registries were reloaded?
|
||||||
if (sd->state.auth)
|
if (sd->state.auth)
|
||||||
return 0;
|
return 0;
|
||||||
@ -4150,9 +4126,7 @@ int pc_checkbaselevelup(struct map_session_data *sd)
|
|||||||
sc_start(&sd->bl,SkillStatusChangeTable(AL_BLESSING),100,10,600000);
|
sc_start(&sd->bl,SkillStatusChangeTable(AL_BLESSING),100,10,600000);
|
||||||
}
|
}
|
||||||
clif_misceffect(&sd->bl,0);
|
clif_misceffect(&sd->bl,0);
|
||||||
//LORDALFA - LVLUPEVENT
|
npc_script_event(sd, NPCE_BASELVUP); //LORDALFA - LVLUPEVENT
|
||||||
if(sd->state.event_baselvup)
|
|
||||||
npc_script_event(sd, NPCE_BASELVUP);
|
|
||||||
|
|
||||||
if(sd->status.party_id)
|
if(sd->status.party_id)
|
||||||
party_send_levelup(sd);
|
party_send_levelup(sd);
|
||||||
@ -4186,7 +4160,6 @@ int pc_checkjoblevelup(struct map_session_data *sd)
|
|||||||
if (pc_checkskill(sd, SG_DEVIL) && !pc_nextjobexp(sd))
|
if (pc_checkskill(sd, SG_DEVIL) && !pc_nextjobexp(sd))
|
||||||
clif_status_change(&sd->bl,SI_DEVIL, 1); //Permanent blind effect from SG_DEVIL.
|
clif_status_change(&sd->bl,SI_DEVIL, 1); //Permanent blind effect from SG_DEVIL.
|
||||||
|
|
||||||
if(sd->state.event_joblvup)
|
|
||||||
npc_script_event(sd, NPCE_JOBLVUP);
|
npc_script_event(sd, NPCE_JOBLVUP);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -4973,14 +4946,8 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
|
|||||||
sd->hp_loss.tick = sd->sp_loss.tick = sd->hp_regen.tick = sd->sp_regen.tick = 0;
|
sd->hp_loss.tick = sd->sp_loss.tick = sd->hp_regen.tick = sd->sp_regen.tick = 0;
|
||||||
|
|
||||||
pc_setglobalreg(sd,"PC_DIE_COUNTER",++sd->die_counter);
|
pc_setglobalreg(sd,"PC_DIE_COUNTER",++sd->die_counter);
|
||||||
|
pc_setglobalreg(sd,"killerrid",src?src->id:0);
|
||||||
if (sd->state.event_death){
|
|
||||||
if(!src)
|
|
||||||
pc_setglobalreg(sd, "killerrid", 0);
|
|
||||||
else
|
|
||||||
pc_setglobalreg(sd,"killerrid",src->id);
|
|
||||||
npc_script_event(sd,NPCE_DIE);
|
npc_script_event(sd,NPCE_DIE);
|
||||||
}
|
|
||||||
|
|
||||||
if ( sd && sd->spiritball && (sd->class_&MAPID_BASEMASK)==MAPID_GUNSLINGER ) // maybe also monks' spiritballs ?
|
if ( sd && sd->spiritball && (sd->class_&MAPID_BASEMASK)==MAPID_GUNSLINGER ) // maybe also monks' spiritballs ?
|
||||||
pc_delspiritball(sd,sd->spiritball,0);
|
pc_delspiritball(sd,sd->spiritball,0);
|
||||||
@ -5008,10 +4975,9 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
|
|||||||
case BL_PC:
|
case BL_PC:
|
||||||
{
|
{
|
||||||
struct map_session_data *ssd = (struct map_session_data *)src;
|
struct map_session_data *ssd = (struct map_session_data *)src;
|
||||||
if (ssd->state.event_kill_pc) {
|
|
||||||
pc_setglobalreg(ssd, "killedrid", sd->bl.id);
|
pc_setglobalreg(ssd, "killedrid", sd->bl.id);
|
||||||
npc_script_event(ssd, NPCE_KILLPC);
|
npc_script_event(ssd, NPCE_KILLPC);
|
||||||
}
|
|
||||||
if (battle_config.pk_mode&2) {
|
if (battle_config.pk_mode&2) {
|
||||||
ssd->status.manner -= 5;
|
ssd->status.manner -= 5;
|
||||||
if(ssd->status.manner < 0)
|
if(ssd->status.manner < 0)
|
||||||
@ -6082,14 +6048,6 @@ int pc_setregistry(struct map_session_data *sd,const char *reg,int val,int type)
|
|||||||
i = (!sd->die_counter && (sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE);
|
i = (!sd->die_counter && (sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE);
|
||||||
sd->die_counter = val;
|
sd->die_counter = val;
|
||||||
if (i) status_calc_pc(sd,0); //Lost the bonus.
|
if (i) status_calc_pc(sd,0); //Lost the bonus.
|
||||||
} else if(strcmp(reg,script_config.die_event_name) == 0){
|
|
||||||
sd->state.event_death = val;
|
|
||||||
} else if(strcmp(reg,script_config.kill_pc_event_name) == 0){
|
|
||||||
sd->state.event_kill_pc = val;
|
|
||||||
} else if(strcmp(reg,script_config.kill_mob_event_name) == 0){
|
|
||||||
sd->state.event_kill_mob = val;
|
|
||||||
} else if(strcmp(reg,script_config.logout_event_name) == 0){
|
|
||||||
sd->state.event_disconnect = val;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -182,7 +182,17 @@ static int parse_options=0;
|
|||||||
DBMap* script_get_label_db(){ return scriptlabel_db; }
|
DBMap* script_get_label_db(){ return scriptlabel_db; }
|
||||||
DBMap* script_get_userfunc_db(){ return userfunc_db; }
|
DBMap* script_get_userfunc_db(){ return userfunc_db; }
|
||||||
|
|
||||||
struct Script_Config script_config;
|
struct Script_Config script_config = {
|
||||||
|
1, 65535, 2048, //warn_func_mismatch_paramnum/check_cmdcount/check_gotocount
|
||||||
|
"OnPCDieEvent", //die_event_name
|
||||||
|
"OnPCKillEvent", //kill_pc_event_name
|
||||||
|
"OnNPCKillEvent", //kill_mob_event_name
|
||||||
|
"OnPCLoginEvent", //login_event_name
|
||||||
|
"OnPCLogoutEvent", //logout_event_name
|
||||||
|
"OnPCLoadMapEvent", //loadmap_event_name
|
||||||
|
"OnPCBaseLvUpEvent", //baselvup_event_name
|
||||||
|
"OnPCJobLvUpEvent" //joblvup_event_name
|
||||||
|
};
|
||||||
|
|
||||||
static jmp_buf error_jump;
|
static jmp_buf error_jump;
|
||||||
static char* error_msg;
|
static char* error_msg;
|
||||||
@ -3449,7 +3459,7 @@ static int script_autosave_mapreg(int tid,unsigned int tick,int id,int data)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int script_config_read_sub(char *cfgName)
|
int script_config_read(char *cfgName)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char line[1024],w1[1024],w2[1024];
|
char line[1024],w1[1024],w2[1024];
|
||||||
@ -3478,54 +3488,8 @@ int script_config_read_sub(char *cfgName)
|
|||||||
else if(strcmpi(w1,"check_gotocount")==0) {
|
else if(strcmpi(w1,"check_gotocount")==0) {
|
||||||
script_config.check_gotocount = config_switch(w2);
|
script_config.check_gotocount = config_switch(w2);
|
||||||
}
|
}
|
||||||
else if(strcmpi(w1,"event_script_type")==0) {
|
|
||||||
script_config.event_script_type = config_switch(w2);
|
|
||||||
}
|
|
||||||
else if(strcmpi(w1,"event_requires_trigger")==0) {
|
|
||||||
script_config.event_requires_trigger = config_switch(w2);
|
|
||||||
}
|
|
||||||
else if(strcmpi(w1,"die_event_name")==0) {
|
|
||||||
strncpy(script_config.die_event_name, w2, NAME_LENGTH-1);
|
|
||||||
if (strlen(script_config.die_event_name) != strlen(w2))
|
|
||||||
ShowWarning("script_config_read: Event label truncated (max length is 23 chars): %d\n", script_config.die_event_name);
|
|
||||||
}
|
|
||||||
else if(strcmpi(w1,"kill_pc_event_name")==0) {
|
|
||||||
strncpy(script_config.kill_pc_event_name, w2, NAME_LENGTH-1);
|
|
||||||
if (strlen(script_config.kill_pc_event_name) != strlen(w2))
|
|
||||||
ShowWarning("script_config_read: Event label truncated (max length is 23 chars): %d\n", script_config.kill_pc_event_name);
|
|
||||||
}
|
|
||||||
else if(strcmpi(w1,"kill_mob_event_name")==0) {
|
|
||||||
strncpy(script_config.kill_mob_event_name, w2, NAME_LENGTH-1);
|
|
||||||
if (strlen(script_config.kill_mob_event_name) != strlen(w2))
|
|
||||||
ShowWarning("script_config_read: Event label truncated (max length is 23 chars): %d\n", script_config.kill_mob_event_name);
|
|
||||||
}
|
|
||||||
else if(strcmpi(w1,"login_event_name")==0) {
|
|
||||||
strncpy(script_config.login_event_name, w2, NAME_LENGTH-1);
|
|
||||||
if (strlen(script_config.login_event_name) != strlen(w2))
|
|
||||||
ShowWarning("script_config_read: Event label truncated (max length is 23 chars): %d\n", script_config.login_event_name);
|
|
||||||
}
|
|
||||||
else if(strcmpi(w1,"logout_event_name")==0) {
|
|
||||||
strncpy(script_config.logout_event_name, w2, NAME_LENGTH-1);
|
|
||||||
if (strlen(script_config.logout_event_name) != strlen(w2))
|
|
||||||
ShowWarning("script_config_read: Event label truncated (max length is 23 chars): %d\n", script_config.logout_event_name);
|
|
||||||
}
|
|
||||||
else if(strcmpi(w1,"loadmap_event_name")==0) {
|
|
||||||
strncpy(script_config.loadmap_event_name, w2, NAME_LENGTH-1);
|
|
||||||
if (strlen(script_config.loadmap_event_name) != strlen(w2))
|
|
||||||
ShowWarning("script_config_read: Event label truncated (max length is 23 chars): %d\n", script_config.loadmap_event_name);
|
|
||||||
}
|
|
||||||
else if(strcmpi(w1,"baselvup_event_name")==0) {
|
|
||||||
strncpy(script_config.baselvup_event_name, w2, NAME_LENGTH-1);
|
|
||||||
if (strlen(script_config.baselvup_event_name) != strlen(w2))
|
|
||||||
ShowWarning("script_config_read: Event label truncated (max length is 23 chars): %d\n", script_config.baselvup_event_name);
|
|
||||||
}
|
|
||||||
else if(strcmpi(w1,"joblvup_event_name")==0) {
|
|
||||||
strncpy(script_config.joblvup_event_name, w2, NAME_LENGTH-1);
|
|
||||||
if (strlen(script_config.joblvup_event_name) != strlen(w2))
|
|
||||||
ShowWarning("script_config_read: Event label truncated (max length is 23 chars): %d\n", script_config.joblvup_event_name);
|
|
||||||
}
|
|
||||||
else if(strcmpi(w1,"import")==0){
|
else if(strcmpi(w1,"import")==0){
|
||||||
script_config_read_sub(w2);
|
script_config_read(w2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@ -3533,21 +3497,6 @@ int script_config_read_sub(char *cfgName)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int script_config_read(char *cfgName)
|
|
||||||
{ //Script related variables should be initialized once! [Skotlex]
|
|
||||||
|
|
||||||
memset (&script_config, 0, sizeof(script_config));
|
|
||||||
script_config.warn_func_mismatch_paramnum = 1;
|
|
||||||
script_config.check_cmdcount = 65535;
|
|
||||||
script_config.check_gotocount = 2048;
|
|
||||||
|
|
||||||
script_config.event_script_type = 0;
|
|
||||||
script_config.event_requires_trigger = 1;
|
|
||||||
|
|
||||||
return script_config_read_sub(cfgName);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int do_final_userfunc_sub (DBKey key,void *data,va_list ap)
|
static int do_final_userfunc_sub (DBKey key,void *data,va_list ap)
|
||||||
{
|
{
|
||||||
struct script_code *code = (struct script_code *)data;
|
struct script_code *code = (struct script_code *)data;
|
||||||
|
@ -13,16 +13,14 @@ extern struct Script_Config {
|
|||||||
int check_cmdcount;
|
int check_cmdcount;
|
||||||
int check_gotocount;
|
int check_gotocount;
|
||||||
|
|
||||||
unsigned event_script_type : 1;
|
const char *die_event_name;
|
||||||
unsigned event_requires_trigger : 1;
|
const char *kill_pc_event_name;
|
||||||
char die_event_name[NAME_LENGTH];
|
const char *kill_mob_event_name;
|
||||||
char kill_pc_event_name[NAME_LENGTH];
|
const char *login_event_name;
|
||||||
char kill_mob_event_name[NAME_LENGTH];
|
const char *logout_event_name;
|
||||||
char login_event_name[NAME_LENGTH];
|
const char *loadmap_event_name;
|
||||||
char logout_event_name[NAME_LENGTH];
|
const char *baselvup_event_name;
|
||||||
char loadmap_event_name[NAME_LENGTH];
|
const char *joblvup_event_name;
|
||||||
char baselvup_event_name[NAME_LENGTH];
|
|
||||||
char joblvup_event_name[NAME_LENGTH];
|
|
||||||
} script_config;
|
} script_config;
|
||||||
|
|
||||||
enum c_op {
|
enum c_op {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user