summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-03-24 15:31:28 +0000
committercelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-03-24 15:31:28 +0000
commit85fdcfa5c7831dc87a2b6810b3e2ebd5e3ec49c7 (patch)
tree3954f54f4adce21db6566710b1b02555b4d241a3 /src
parent0e67259ca839671dac06dd804d6867ebe33df74a (diff)
downloadhercules-85fdcfa5c7831dc87a2b6810b3e2ebd5e3ec49c7.tar.gz
hercules-85fdcfa5c7831dc87a2b6810b3e2ebd5e3ec49c7.tar.bz2
hercules-85fdcfa5c7831dc87a2b6810b3e2ebd5e3ec49c7.tar.xz
hercules-85fdcfa5c7831dc87a2b6810b3e2ebd5e3ec49c7.zip
* Added 'map_charid2id'
* Changed monster damage logging to save char ID's * Implemented 'event_script_type' * Set Emsolute Develop as a learnable skill * Updated 'require_glory_guild' * Allow monsters to cast skills near themselves even when monster_nofootset is set to 'yes' * Print number of online users in online.txt/.html even if there's only 1 user git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1282 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-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
11 files changed, 106 insertions, 94 deletions
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);