summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-SVN.txt17
-rw-r--r--conf-tmpl/battle_athena.conf16
-rw-r--r--npc/Changelog.txt4
-rw-r--r--npc/guild/gldfunc_manager.txt7
-rw-r--r--npc/jobs/custom/jobchange.txt2
-rw-r--r--npc/sample/PCLoginEvent.txt22
-rw-r--r--src/char/char.c3
-rw-r--r--src/map/battle.c2
-rw-r--r--src/map/clif.c12
-rw-r--r--src/map/map.c26
-rw-r--r--src/map/map.h1
-rw-r--r--src/map/mob.c27
-rw-r--r--src/map/npc.c72
-rw-r--r--src/map/npc.h1
-rw-r--r--src/map/pc.c35
-rw-r--r--src/map/skill.c19
-rw-r--r--src/map/skill.h2
17 files changed, 164 insertions, 104 deletions
diff --git a/Changelog-SVN.txt b/Changelog-SVN.txt
index dcb72a6cf..7f699be37 100644
--- a/Changelog-SVN.txt
+++ b/Changelog-SVN.txt
@@ -1,5 +1,22 @@
Date Added
+03/24
+ * Added 'map_charid2id' [celest]
+ * Changed monster damage logging to save char ID's for the most time -- also
+ fixes an exp bug, thanks to Super Novice / Ezhik [celest]
+ * Implemented 'event_script_type' -- no changes at '0', at '1' script events
+ will work according to Qamera's original mod
+ For more info please refer to his thread:
+ http://www.eathena.deltaanime.net/board/index.php?showtopic=13305&hl=
+ * Set Emsolute Develop as a learnable skill [celest]
+ * Updated 'require_glory_guild' [celest]
+ - the skill is only acquirable if this is set to 'yes', otherwise it will not
+ appear in the guild skill tree. Default is changed to 'no'.
+ * Allow monsters to cast skills near themselves even when monster_nofootset
+ is set to 'yes' -- they're only not allowed to cast near players [celest]
+ * Print number of online users in online.txt/.html even if there's only 1 user
+ online [celest]
+
03/23
* Adjusted my trade fix [1280: MouseJstr]
* Fixed possible memory corruption in storage if number of guilds
diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf
index 9a473704d..5663bc4e6 100644
--- a/conf-tmpl/battle_athena.conf
+++ b/conf-tmpl/battle_athena.conf
@@ -494,12 +494,12 @@ player_skill_reiteration: no
//Whether or not, ground skills of the monsters' will pile up. (Note 1)
monster_skill_reiteration: no
-// Whether or not players can cast ground based skills of a certain type such as traps
-// straight onto other players/monsters. (Note 1)
+// Whether players are not allowed to cast ground based skills of a certain type such
+// as traps straight onto or nearby other players/monsters. (Note 1)
player_skill_nofootset: yes
-// Whether or not monsters can cast ground based skills of a certain type such as traps
-// straight onto players. (Note 1)
+// Whether monsters are not allowed to cast ground based skills of a certain type such
+// as traps straight onto or nearby other players. (Note 1)
monster_skill_nofootset: yes
// When a player is cloaking, Whether the wall is checked or not. (Note 1)
@@ -817,9 +817,11 @@ finding_ore_rate: 100
//2 - eAthena's, using damage given / total damage as damage ratio
exp_calc_type: 1
-// Does changing emblems require the guild skill "Glory of Guild"? (Note 1)
-// Note: This new guild skill only appears for 2004-10-25aSakexe or newer
-require_glory_guild: yes
+// Can the 'Glory of Guild' skill be learnt in the Guild window,
+// and does changing emblems require it? (Note 1)
+// P.S: This new guild skill only appears for 2004-10-25aSakexe or newer
+// P.S 2: This skill is not implemented on official servers, so its only optional
+require_glory_guild: no
import: conf/import/battle_conf.txt
diff --git a/npc/Changelog.txt b/npc/Changelog.txt
index a20f1de19..09b33f62a 100644
--- a/npc/Changelog.txt
+++ b/npc/Changelog.txt
@@ -35,6 +35,10 @@ Other Ppl
Date Added
======
+03/24
+ * Added support for Emsolute Develop in the guild manager script [celest]
+ * Fixed the custom jobchanger allowing Super Novices to change to high novice,
+ thanks to CavaCava
03/23
* WOE 1.3 Now you can't install Guardians during WOE [Lupus]
* Set only Storage/Cancel to Kafra in Niflheim. [Lupus]
diff --git a/npc/guild/gldfunc_manager.txt b/npc/guild/gldfunc_manager.txt
index ec40e5a1e..577cd37e4 100644
--- a/npc/guild/gldfunc_manager.txt
+++ b/npc/guild/gldfunc_manager.txt
@@ -4,7 +4,7 @@
//= jAthena - kalen (1.0)
//= 1.1 by Akaru, ho|yAnge|X, and Valaris
//===== Current Version: =====================================
-//= 1.3
+//= 1.31
//===== Compatible With: =====================================
//= eAthena 0.1+; RO Episode 4+
//===== Description: =========================================
@@ -19,6 +19,7 @@
//= arg(3): y1 coordinate for warp to treasure room
//= arg(4): guild script suffix for kafra, gaurdian scripts etc.
//===== Additional Comments: =================================
+//= v1.31: Added support for Emsolute Develop [celest]
//= v1.2: All Guild manager scripts use this function. Optimized
//= Comerce and Defense investment. [kobra_k88]
//= v1.2a Function now returns to script that called it.
@@ -116,6 +117,8 @@ L_Start:
set Zeny,Zeny-@eco_invest;
SetCastleData getarg(1)+".gat",4,@TriggerE+1;
SetCastleData getarg(1)+".gat",2,@Economy+1;
+ // if we learnt Emsolute Develop there's a chance to get +1 investment again
+ if (getgdskilllv(@GID,10014) > 0) && rand(100)>50) set @Economy, @Economy + 1;
mes "[ "+getarg(0)+" ]";
mes "You have invested successfully.";
return 0;
@@ -172,6 +175,8 @@ L_Start:
SetCastleData getarg(1)+".gat",3,@Defence+1;
// set new hp values for guardians
set @Defence, @Defence + 1;
+ // if we learnt Emsolute Develop there's a chance to get +1 investment again
+ if (getgdskilllv(@GID,10014) > 0) && rand(100)>50) set @Defence, @Defence + 1;
set @AGuardian, 28634 + (@Defence*2000);
set @KGuardian, 30214 + (@Defence*2000);
set @SGuardian, 15670 + (@Defence*2000);
diff --git a/npc/jobs/custom/jobchange.txt b/npc/jobs/custom/jobchange.txt
index e69c42595..11c313772 100644
--- a/npc/jobs/custom/jobchange.txt
+++ b/npc/jobs/custom/jobchange.txt
@@ -22,7 +22,7 @@ mes "Sup? I'm the insanely cool and uber cute jobchanger thingy for eAthena! Fir
next;
menu "First Class",LFirstClass,"Second Class (2-1)",LSecondClass,"Alternate Second Class (2-2)",LSecondClass2,"Novice High",LNovice2,"Advance First Class",Llevelcheck,"Advance Second Class",Llevelcheck,"Super Novice",LSuperNovice;
LNovice2:
- if ((readparam(11) >= 99) && (readparam(55) >= 50) || (readparam(19) > 20)) goto Lchange;
+ if ((readparam(11) >= 99) && (readparam(55) >= 50) || ((readparam(19) > 20) && (readparam(19) != 23)) goto Lchange;
mes "[ ^0065DFJobra^000000 ]";
mes "Ummmm, excuse me... o.O...";
mes "Hey! You don't MEET the class requirements...";
diff --git a/npc/sample/PCLoginEvent.txt b/npc/sample/PCLoginEvent.txt
index d668c0960..707398277 100644
--- a/npc/sample/PCLoginEvent.txt
+++ b/npc/sample/PCLoginEvent.txt
@@ -26,8 +26,28 @@
// 7) Modify this script to your liking and give your players a surprise
// 8) Remember: IT RUNS LIKE A NORMAL NPC. BUT THE ONLY WAY TO 'CLICK' IT IS BY
// LOGGING ON
+// 9) There are 2 ways to use this - check the examples below!
-
+//
+// The 1st type -- with 'event_script_type' set to 0
+//
prontera.gat,0,0,0 script PCLoginEvent -1,{
end;
+}
+
+//
+// The 2nd type -- with 'event_script_type' set to 1
+//
+prontera.gat,155,175,0 script An NPC 46,{
+ close;
+PCLoginEvent:
+ // this part will run
+ close;
+}
+
+prontera.gat,156,176,0 script Another NPC 46,{
+ close;
+PCLoginEvent:
+ // this part runs AS WELL
+ close;
} \ No newline at end of file
diff --git a/src/char/char.c b/src/char/char.c
index 78f4bd3ae..0b8c3c9d9 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -1345,8 +1345,9 @@ void create_online_files(void) {
if (players == 0) {
fprintf(fp2, " <p>No user is online.</p>\n");
fprintf(fp, "No user is online.\n");
- // no display if only 1 player
} else if (players == 1) {
+ fprintf(fp2, " <p>%d user is online.</p>\n", players);
+ fprintf(fp, "%d user is online.\n", players);
} else {
fprintf(fp2, " <p>%d users are online.</p>\n", players);
fprintf(fp, "%d users are online.\n", players);
diff --git a/src/map/battle.c b/src/map/battle.c
index 15f192ec4..1a44dc9a7 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -4415,7 +4415,7 @@ void battle_set_defaults() {
battle_config.area_size = 14;
battle_config.exp_calc_type = 1;
battle_config.min_skill_delay_limit = 100;
- battle_config.require_glory_guild = 1;
+ battle_config.require_glory_guild = 0;
//SQL-only options start
#ifndef TXT_ONLY
diff --git a/src/map/clif.c b/src/map/clif.c
index 2e1a7e1e7..74d26dbac 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -6704,14 +6704,18 @@ int clif_guild_skillinfo(struct map_session_data *sd)
case GD_KAFRACONTACT:
case GD_GUARDIANRESEARCH:
case GD_GUARDUP:
+ case GD_DEVELOPMENT:
up = guild_checkskill(g,GD_APPROVAL) > 0;
break;
case GD_LEADERSHIP:
//Glory skill requirements -- Pretty sure correct [Sara]
- up = guild_checkskill(g,GD_GLORYGUILD) > 0;
+ up = (battle_config.require_glory_guild) ?
+ guild_checkskill(g,GD_GLORYGUILD) > 0 : 1;
+ // what skill does it need now that glory guild was removed? [celest]
break;
case GD_GLORYWOUNDS:
- up = guild_checkskill(g,GD_GLORYGUILD) > 0;
+ up = (battle_config.require_glory_guild) ?
+ guild_checkskill(g,GD_GLORYGUILD) > 0 : 1;
break;
case GD_SOULCOLD:
up = guild_checkskill(g,GD_GLORYWOUNDS) > 0;
@@ -6734,8 +6738,8 @@ int clif_guild_skillinfo(struct map_session_data *sd)
up = guild_checkskill(g,GD_GUARDIANRESEARCH) > 0 &&
guild_checkskill(g,GD_REGENERATION) > 0;
break;
- case GD_DEVELOPMENT:
- up = 0;
+ case GD_GLORYGUILD:
+ up = (battle_config.require_glory_guild) ? 1 : 0;
break;
default:
up = 1;
diff --git a/src/map/map.c b/src/map/map.c
index 9dcf541c1..205c21cd2 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1446,10 +1446,16 @@ int map_quit(struct map_session_data *sd) {
if(!sd->state.waitingdisconnect) {
if (sd->state.event_disconnect) {
- struct npc_data *npc;
- if ((npc = npc_name2id(script_config.logout_event_name))) {
- run_script(npc->u.scr.script,0,sd->bl.id,npc->bl.id); // PCLogoutNPC
- sprintf (tmp_output, "Event '"CL_WHITE"%s"CL_RESET"' executed.\n", script_config.logout_event_name);
+ if (script_config.event_script_type == 0) {
+ struct npc_data *npc;
+ if ((npc = npc_name2id(script_config.logout_event_name))) {
+ run_script(npc->u.scr.script,0,sd->bl.id,npc->bl.id); // PCLogoutNPC
+ sprintf (tmp_output, "Event '"CL_WHITE"%s"CL_RESET"' executed.\n", script_config.logout_event_name);
+ ShowStatus(tmp_output);
+ }
+ } else {
+ sprintf (tmp_output, "%d '"CL_WHITE"%s"CL_RESET"' events executed.\n",
+ npc_event_doall_id(script_config.logout_event_name, sd->bl.id), script_config.logout_event_name);
ShowStatus(tmp_output);
}
}
@@ -1601,6 +1607,18 @@ char * map_charid2nick(int id) {
return p->nick;
}
+struct map_session_data * map_charid2sd(int id) {
+ int i;
+ struct map_session_data *sd;
+
+ if (id <= 0) return 0;
+
+ for(i = 0; i < fd_max; i++)
+ if (session[i] && (sd = (struct map_session_data*)session[i]->session_data) && sd->status.char_id == id)
+ return sd;
+
+ return NULL;
+}
/*==========================================
* Search session data from a nick name
diff --git a/src/map/map.h b/src/map/map.h
index 453d0fbc6..2af4b9b4d 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -765,6 +765,7 @@ void map_addchariddb(int charid,char *name);
void map_delchariddb(int charid);
int map_reqchariddb(struct map_session_data * sd,int charid);
char * map_charid2nick(int);
+struct map_session_data * map_charid2sd(int);
struct map_session_data * map_id2sd(int);
struct block_list * map_id2bl(int);
diff --git a/src/map/mob.c b/src/map/mob.c
index cae0eddf3..002a37fb7 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -2248,7 +2248,8 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
if(!(type&2)) {
if(sd!=NULL){
for(i=0,minpos=0,mindmg=0x7fffffff;i<DAMAGELOG_SIZE;i++){
- if(md->dmglog[i].id==sd->bl.id)
+ //if(md->dmglog[i].id==sd->bl.id)
+ if(md->dmglog[i].id==sd->status.char_id)
break;
if(md->dmglog[i].id==0){
minpos=i;
@@ -2262,7 +2263,8 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
if(i<DAMAGELOG_SIZE)
md->dmglog[i].dmg+=damage;
else {
- md->dmglog[minpos].id=sd->bl.id;
+ //md->dmglog[minpos].id=sd->bl.id;
+ md->dmglog[minpos].id=sd->status.char_id;
md->dmglog[minpos].dmg=damage;
}
@@ -2273,7 +2275,8 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
struct pet_data *pd = (struct pet_data *)src;
nullpo_retr(0, pd);
for(i=0,minpos=0,mindmg=0x7fffffff;i<DAMAGELOG_SIZE;i++){
- if(md->dmglog[i].id==pd->msd->bl.id)
+ //if(md->dmglog[i].id==pd->msd->bl.id)
+ if(md->dmglog[i].id==pd->msd->status.char_id)
break;
if(md->dmglog[i].id==0){
minpos=i;
@@ -2287,7 +2290,8 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
if(i<DAMAGELOG_SIZE)
md->dmglog[i].dmg+=(damage*battle_config.pet_attack_exp_rate)/100;
else {
- md->dmglog[minpos].id=pd->msd->bl.id;
+ //md->dmglog[minpos].id=pd->msd->bl.id;
+ md->dmglog[minpos].id=pd->msd->status.char_id;
md->dmglog[minpos].dmg=(damage*battle_config.pet_attack_exp_rate)/100;
}
}
@@ -2454,7 +2458,12 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
for(i=0,count=0,mvp_damage=0;i<DAMAGELOG_SIZE;i++){
if(md->dmglog[i].id==0)
continue;
- tmpsd[i] = map_id2sd(md->dmglog[i].id);
+ // Will this slow things down too much?
+ tmpsd[i] = map_charid2sd(md->dmglog[i].id);
+ // try finding again
+ if(tmpsd[i] == NULL)
+ tmpsd[i] = map_id2sd(md->dmglog[i].id);
+ // if we still can't find the player
if(tmpsd[i] == NULL)
continue;
count++;
@@ -3289,13 +3298,13 @@ int mobskill_castend_pos( int tid, unsigned int tick, int id,int data )
}
if (!battle_config.monster_skill_reiteration &&
- skill_get_unit_flag(md->skillid)&UF_NOREITERATION &&
- skill_check_unit_range(md->bl.m,md->skillx,md->skilly,md->skillid,md->skilllv))
+ skill_get_unit_flag (md->skillid) & UF_NOREITERATION &&
+ skill_check_unit_range (md->bl.m, md->skillx, md->skilly, md->skillid, md->skilllv))
return 0;
if(battle_config.monster_skill_nofootset &&
- skill_get_unit_flag(md->skillid)&UF_NOFOOTSET &&
- skill_check_unit_range2(md->bl.m,md->skillx,md->skilly,md->skillid,md->skilllv))
+ skill_get_unit_flag (md->skillid) & UF_NOFOOTSET &&
+ skill_check_unit_range2(&md->bl, md->bl.m, md->skillx, md->skilly, md->skillid, md->skilllv))
return 0;
diff --git a/src/map/npc.c b/src/map/npc.c
index 0e158bc77..1c5a0c585 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -311,62 +311,6 @@ int npc_event_export(void *key,void *data,va_list ap)
return 0;
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
/*==========================================
* 全てのNPCのOn*イベント実行
*------------------------------------------
@@ -376,16 +320,17 @@ int npc_event_doall_sub(void *key,void *data,va_list ap)
char *p=(char *)key;
struct event_data *ev;
int *c;
+ int rid;
const char *name;
nullpo_retr(0, ev=(struct event_data *)data);
nullpo_retr(0, ap);
nullpo_retr(0, c=va_arg(ap,int *));
-
name=va_arg(ap,const char *);
+ rid=va_arg(ap, int);
if( (p=strchr(p,':')) && p && strcmpi(name,p)==0 ){
- run_script(ev->nd->u.scr.script,ev->pos,0,ev->nd->bl.id);
+ run_script(ev->nd->u.scr.script,ev->pos,rid,ev->nd->bl.id);
(*c)++;
}
@@ -397,7 +342,16 @@ int npc_event_doall(const char *name)
char buf[64]="::";
strncpy(buf+2,name,62);
- strdb_foreach(ev_db,npc_event_doall_sub,&c,buf);
+ strdb_foreach(ev_db,npc_event_doall_sub,&c,buf,0);
+ return c;
+}
+int npc_event_doall_id(const char *name, int rid)
+{
+ int c=0;
+ char buf[64]="::";
+
+ strncpy(buf+2,name,62);
+ strdb_foreach(ev_db,npc_event_doall_sub,&c,buf,rid);
return c;
}
diff --git a/src/map/npc.h b/src/map/npc.h
index 5a680f22a..054e9559b 100644
--- a/src/map/npc.h
+++ b/src/map/npc.h
@@ -46,6 +46,7 @@ int npc_do_ontimer(int,struct map_session_data *,int);
int npc_event_doall(const char *name);
int npc_event_do(const char *name);
+int npc_event_doall_id(const char *name, int id);
int npc_timerevent_start(struct npc_data *nd, int rid);
int npc_timerevent_stop(struct npc_data *nd);
diff --git a/src/map/pc.c b/src/map/pc.c
index 8c0857d4b..768098afb 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -840,7 +840,7 @@ int pc_authok(int id, int login_id2, time_t connect_until_time, struct mmo_chars
sprintf(tmp_output,"Character '"CL_WHITE"%s"CL_RESET"' logged in. (Account ID: '"CL_WHITE"%d"CL_RESET"').\n", sd->status.name, sd->status.account_id);
ShowInfo(tmp_output);
- {
+ if (script_config.event_script_type == 0) {
struct npc_data *npc;
//printf("pc: OnPCLogin event done. (%d events)\n", npc_event_doall("OnPCLogin") );
if ((npc = npc_name2id(script_config.login_event_name))) {
@@ -848,7 +848,12 @@ int pc_authok(int id, int login_id2, time_t connect_until_time, struct mmo_chars
sprintf (tmp_output, "Event '"CL_WHITE"%s"CL_RESET"' executed.\n", script_config.login_event_name);
ShowStatus(tmp_output);
}
+ } else {
+ sprintf (tmp_output, "%d '"CL_WHITE"%s"CL_RESET"' events executed.\n",
+ npc_event_doall_id(script_config.login_event_name, sd->bl.id), script_config.login_event_name);
+ ShowStatus(tmp_output);
}
+
// Send friends list
clif_friends_list_send(sd);
@@ -4645,10 +4650,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) {
- struct npc_data *npc;
- if ((npc = npc_name2id(script_config.kill_event_name))) {
- run_script(npc->u.scr.script,0,sd->bl.id,npc->bl.id); // PCKillNPC
- sprintf (tmp_output, "Event '"CL_WHITE"%s"CL_RESET"' executed.\n", script_config.kill_event_name);
+ if (script_config.event_script_type == 0) {
+ struct npc_data *npc;
+ if ((npc = npc_name2id(script_config.kill_event_name))) {
+ run_script(npc->u.scr.script,0,sd->bl.id,npc->bl.id); // PCKillNPC
+ sprintf (tmp_output, "Event '"CL_WHITE"%s"CL_RESET"' executed.\n", script_config.kill_event_name);
+ ShowStatus(tmp_output);
+ }
+ } else {
+ sprintf (tmp_output, "%d '"CL_WHITE"%s"CL_RESET"' events executed.\n",
+ npc_event_doall_id(script_config.kill_event_name, sd->bl.id), script_config.kill_event_name);
ShowStatus(tmp_output);
}
}
@@ -4656,10 +4667,16 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage)
}
if (sd->state.event_death) {
- struct npc_data *npc;
- if ((npc = npc_name2id(script_config.die_event_name))) {
- run_script(npc->u.scr.script,0,sd->bl.id,npc->bl.id); // PCDeathNPC
- sprintf (tmp_output, "Event '"CL_WHITE"%s"CL_RESET"' executed.\n", script_config.die_event_name);
+ if (script_config.event_script_type == 0) {
+ struct npc_data *npc;
+ if ((npc = npc_name2id(script_config.die_event_name))) {
+ run_script(npc->u.scr.script,0,sd->bl.id,npc->bl.id); // PCDeathNPC
+ sprintf (tmp_output, "Event '"CL_WHITE"%s"CL_RESET"' executed.\n", script_config.die_event_name);
+ ShowStatus(tmp_output);
+ }
+ } else {
+ sprintf (tmp_output, "%d '"CL_WHITE"%s"CL_RESET"' events executed.\n",
+ npc_event_doall_id(script_config.die_event_name, sd->bl.id), script_config.die_event_name);
ShowStatus(tmp_output);
}
}
diff --git a/src/map/skill.c b/src/map/skill.c
index d5bd61a4c..688f84c99 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -1693,9 +1693,9 @@ static int skill_check_unit_range2_sub( struct block_list *bl,va_list ap )
return 0;
}
-int skill_check_unit_range2(int m,int x,int y,int skillid, int skilllv)
+int skill_check_unit_range2(struct block_list *bl, int m,int x,int y,int skillid, int skilllv)
{
- int c = 0, range;
+ int c = 0, range, type;
switch (skillid) { // to be expanded later
case WZ_ICEWALL:
@@ -1714,8 +1714,15 @@ int skill_check_unit_range2(int m,int x,int y,int skillid, int skilllv)
break;
}
- map_foreachinarea(skill_check_unit_range2_sub,m,
- x-range,y-range,x+range,y+range,0,&c,skillid);
+ // if the caster is a monster/NPC, only check for players
+ // otherwise just check everything
+ if (bl->type == BL_PC)
+ type = 0;
+ else type = BL_PC;
+
+ map_foreachinarea(skill_check_unit_range2_sub, m,
+ x - range, y - range, x + range, y + range,
+ type, &c, skillid);
return c;
}
@@ -6000,7 +6007,7 @@ int skill_castend_pos( int tid, unsigned int tick, int id,int data )
break;*/
if (battle_config.pc_skill_nofootset &&
skill_get_unit_flag(sd->skillid)&UF_NOFOOTSET &&
- skill_check_unit_range2(sd->bl.m,sd->skillx,sd->skilly,sd->skillid,sd->skilllv)) {
+ skill_check_unit_range2(&sd->bl,sd->bl.m,sd->skillx,sd->skilly,sd->skillid,sd->skilllv)) {
clif_skill_fail(sd,sd->skillid,0,0);
sd->canact_tick = tick;
sd->canmove_tick = tick;
@@ -7022,7 +7029,7 @@ int skill_use_id( struct map_session_data *sd, int target_id,
clif_skill_fail(sd,sd->skillid,0,0);
return 0;
}
- if (skill_check_unit_range2(sd->bl.m,sd->bl.x,sd->bl.y,sd->skillid,sd->skilllv)) {
+ if (skill_check_unit_range2(&sd->bl,sd->bl.m,sd->bl.x,sd->bl.y,sd->skillid,sd->skilllv)) {
clif_skill_fail(sd,sd->skillid,0,0);
return 0;
}
diff --git a/src/map/skill.h b/src/map/skill.h
index a14aa95fd..4c0d0a8f7 100644
--- a/src/map/skill.h
+++ b/src/map/skill.h
@@ -143,7 +143,7 @@ int skill_unit_ondamaged(struct skill_unit *src,struct block_list *bl,
int skill_castfix( struct block_list *bl, int time );
int skill_delayfix( struct block_list *bl, int time );
int skill_check_unit_range(int m,int x,int y,int skillid, int skilllv);
-int skill_check_unit_range2(int m,int x,int y,int skillid, int skilllv);
+int skill_check_unit_range2(struct block_list *bl,int m,int x,int y,int skillid, int skilllv);
// -- moonsoul (added skill_check_unit_cell)
int skill_check_unit_cell(int skillid,int m,int x,int y,int unit_id);
int skill_unit_out_all( struct block_list *bl,unsigned int tick,int range);