diff options
author | Lance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-03-19 05:14:59 +0000 |
---|---|---|
committer | Lance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-03-19 05:14:59 +0000 |
commit | 51df2c6e71dcf7b4e5bca9bc10158ac326cfcaf2 (patch) | |
tree | bab44d9cbc52002c5e28457fbbf261858d6ec1c0 | |
parent | 69d0bd132e0d7732b2ecb49b71d94721835f29eb (diff) | |
download | hercules-51df2c6e71dcf7b4e5bca9bc10158ac326cfcaf2.tar.gz hercules-51df2c6e71dcf7b4e5bca9bc10158ac326cfcaf2.tar.bz2 hercules-51df2c6e71dcf7b4e5bca9bc10158ac326cfcaf2.tar.xz hercules-51df2c6e71dcf7b4e5bca9bc10158ac326cfcaf2.zip |
* Fixed event_kill_pc to behave like what it should instead of another replication of event_death. Added script function rid2name to convert bl ids to name.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5663 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | Changelog-Trunk.txt | 2 | ||||
-rw-r--r-- | src/map/pc.c | 7 | ||||
-rw-r--r-- | src/map/script.c | 28 |
3 files changed, 32 insertions, 5 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 25b8d34ef..a0fdb7bbe 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -5,6 +5,8 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. EV GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS
2006/03/18
+ * Fixed event_kill_pc to behave like what it should instead of another replication
+ of event_death. Added script function rid2name to convert bl ids to name. [Lance]
* Recoded setmobdata script function. Fixed mob_damage typo sd -> mvp_sd. [Lance]
* Added 'GetMonsterInfo(MobID,Idx)' script function. [Lupus]
You can get monsters name,level,race, etc by its Id. Check npc\sample\getmonsterinfo.txt
diff --git a/src/map/pc.c b/src/map/pc.c index 2a47ab2ae..970f2b347 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -5332,15 +5332,16 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage) if (sd->state.event_death)
pc_setglobalreg(sd,"killerrid",(ssd->status.account_id));
if (ssd->state.event_kill_pc) {
+ pc_setglobalreg(ssd, "killedrid", sd->bl.id);
if (script_config.event_script_type == 0) {
struct npc_data *npc;
if ((npc = npc_name2id(script_config.kill_pc_event_name))) {
- run_script(npc->u.scr.script,0,sd->bl.id,npc->bl.id); // PCKillPC [Lance]
+ run_script(npc->u.scr.script,0,ssd->bl.id,npc->bl.id); // PCKillPC [Lance]
ShowStatus("Event '"CL_WHITE"%s"CL_RESET"' executed.\n", script_config.kill_pc_event_name);
}
} else {
ShowStatus("%d '"CL_WHITE"%s"CL_RESET"' events executed.\n",
- npc_event_doall_id(script_config.kill_pc_event_name, sd->bl.id), script_config.kill_pc_event_name);
+ npc_event_doall_id(script_config.kill_pc_event_name, ssd->bl.id), script_config.kill_pc_event_name);
}
}
if (battle_config.pk_mode && ssd->status.manner >= 0 && battle_config.manner_system) {
@@ -5367,6 +5368,8 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage) // To-do: Receive exp on certain occasions
}
}
+ } else {
+ pc_setglobalreg(sd, "killerrid", 0);
}
if (sd->state.event_death) {
diff --git a/src/map/script.c b/src/map/script.c index 2e218a29c..0dff1f7fc 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -405,6 +405,7 @@ int buildin_equip(struct script_state *st); int buildin_autoequip(struct script_state *st);
int buildin_setbattleflag(struct script_state *st);
// [zBuffer] List of player cont commands --->
+int buildin_rid2name(struct script_state *st);
int buildin_pcwalkxy(struct script_state *st);
int buildin_pctalk(struct script_state *st);
int buildin_pcemote(struct script_state *st);
@@ -735,6 +736,7 @@ struct { {buildin_undisguise,"undisguise","i"}, //undisguise player. Lupus
{buildin_getmonsterinfo,"getmonsterinfo","ii"}, //Lupus
// [zBuffer] List of player cont commands --->
+ {buildin_rid2name,"rid2name","i"},
{buildin_pcwalkxy,"pcwalkxy","iii"},
{buildin_pctalk,"pctalk","is"},
{buildin_pcemote,"pcemote","ii"},
@@ -9923,6 +9925,28 @@ int buildin_getmonsterinfo(struct script_state *st) }
// [zBuffer] List of player cont commands --->
+int buildin_rid2name(struct script_state *st){
+ struct block_list *bl = NULL;
+ int rid = conv_num(st, & (st->stack->stack_data[st->start + 2]));
+ if((bl = map_id2bl(rid))){
+ switch(bl->type){
+ case BL_MOB:
+ push_str(st->stack,C_STR,((struct mob_data *)bl)->name);
+ break;
+ case BL_PC:
+ push_str(st->stack,C_STR,((struct map_session_data *)bl)->status.name);
+ break;
+ case BL_NPC:
+ push_str(st->stack,C_STR,((struct npc_data *)bl)->exname);
+ break;
+ default:
+ ShowError("buildin_rid2name: BL type unknown.\n");
+ break;
+ }
+ }
+ return 0;
+}
+
int buildin_pcwalkxy(struct script_state *st){
int id, x, y;
struct map_session_data *sd = NULL;
@@ -10138,9 +10162,7 @@ int buildin_getmobdata(struct script_state *st) { }
int buildin_setmobdata(struct script_state *st){
- int num, id, value;
- char *name;
- struct script_data dat;
+ int id, value;
struct mob_data *md = NULL;
id = conv_num(st, & (st->stack->stack_data[st->start+2]));
value = conv_num(st, & (st->stack->stack_data[st->start+3]));
|