diff options
-rw-r--r-- | Changelog-Trunk.txt | 1 | ||||
-rw-r--r-- | src/map/clif.c | 44 | ||||
-rw-r--r-- | src/map/clif.h | 1 | ||||
-rw-r--r-- | src/map/guild.c | 93 | ||||
-rw-r--r-- | src/map/map.c | 2 |
5 files changed, 95 insertions, 46 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 1232d6fd5..0d21ded4b 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -5,6 +5,7 @@ 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/21
+ * Fix on not showing guildmembers logins/logouts messages. [LuzZza]
* Fixed SC_SWOO's opt3 value. Small monsters should stay small for skill's
duration now. [Skotlex]
* Fixed allowing multiple recast of Dissonance/Ugly-Dance [Skotlex]
diff --git a/src/map/clif.c b/src/map/clif.c index 07ea1598d..17d6c454c 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -7337,6 +7337,47 @@ int clif_guild_memberlogin_notice(struct guild *g,int idx,int flag) clif_send(buf,packet_len_table[0x16d],&g->member[idx].sd->bl,GUILD_WOS);
return 0;
}
+
+// Function `clif_guild_memberlogin_notice` sends info about
+// logins and logouts of a guild member to the rest members.
+// But at the 1st time (after a player login or map changing)
+// the client won't show the message.
+// So I suggest use this function for sending "first-time-info"
+// to some player on entering the game or changing location.
+// At next time the client would always show the message.
+// The function sends all the statuses in the single packet
+// to economize traffic. [LuzZza]
+int clif_guild_send_onlineinfo(struct map_session_data *sd) {
+
+ struct guild *g;
+ char buf[14*128];
+ int i, count=0, p_len;
+
+ nullpo_retr(0, sd);
+
+ p_len = packet_len_table[0x16d];
+
+ if(!(g = guild_search(sd->status.guild_id)))
+ return 0;
+
+ for(i=0; i<g->max_member; i++) {
+
+ if(g->member[i].account_id > 0 &&
+ g->member[i].account_id != sd->status.account_id) {
+
+ WBUFW(buf,count*p_len) = 0x16d;
+ WBUFL(buf,count*p_len+2) = g->member[i].account_id;
+ WBUFL(buf,count*p_len+6) = g->member[i].char_id;
+ WBUFL(buf,count*p_len+10) = g->member[i].online;
+ count++;
+ }
+ }
+
+ clif_send(buf,p_len*count,&sd->bl,SELF);
+
+ return 0;
+}
+
/*==========================================
* ギルドマスター通知(14dへの応答)
*------------------------------------------
@@ -8766,6 +8807,9 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) //clif_misceffect2(&sd->bl, 159);
}
+ //[LuzZza]
+ clif_guild_send_onlineinfo(sd);
+
// pvp
//if(sd->pvp_timer!=-1 && !battle_config.pk_mode) /PVP Client crash fix* Removed timer deletion
// delete_timer(sd->pvp_timer,pc_calc_pvprank_timer);
diff --git a/src/map/clif.h b/src/map/clif.h index 5f3a5afc8..b1d069a14 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -265,6 +265,7 @@ int clif_guild_basicinfo(struct map_session_data *sd); int clif_guild_allianceinfo(struct map_session_data *sd);
int clif_guild_memberlist(struct map_session_data *sd);
int clif_guild_skillinfo(struct map_session_data *sd);
+int clif_guild_send_onlineinfo(struct map_session_data *sd); //[LuzZza]
int clif_guild_memberlogin_notice(struct guild *g,int idx,int flag);
int clif_guild_invite(struct map_session_data *sd,struct guild *g);
int clif_guild_inviteack(struct map_session_data *sd,int flag);
diff --git a/src/map/guild.c b/src/map/guild.c index 9158c876d..f2be83844 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -865,61 +865,52 @@ int guild_member_leaved(int guild_id,int account_id,int char_id,int flag, return 0;
}
-// ギルドメンバのオンライン状態/Lv更新送信
int guild_send_memberinfoshort(struct map_session_data *sd,int online)
-{
+{ // cleaned up [LuzZza]
+
struct guild *g;
- int i;
nullpo_retr(0, sd);
-
- if(sd->status.guild_id<=0)
+
+ if(!(g = guild_search(sd->status.guild_id)))
return 0;
- g=guild_search(sd->status.guild_id);
- if(g==NULL)
+
+ //Moved to place before intif_guild_memberinfoshort because
+ //If it's not a member, needn't send it's info to intif. [LuzZza]
+ guild_check_member(g);
+
+ if(sd->status.guild_id <= 0)
return 0;
intif_guild_memberinfoshort(g->guild_id,
sd->status.account_id,sd->status.char_id,online,sd->status.base_level,sd->status.class_);
- if( !online ){ // ログアウトするならsdをクリアして終了
- i=guild_getindex(g,sd->status.account_id,sd->status.char_id);
- if(i>=0)
- g->member[i].sd=NULL;
- return 0;
- } else if (sd->fd) {
- //Send XY dot updates. [Skotlex]
- for(i=0; i < MAX_GUILD; i++) {
- if (!g->member[i].sd || g->member[i].sd == sd ||
- g->member[i].sd->bl.m != sd->bl.m)
- continue;
- clif_guild_xy_single(sd->fd, g->member[i].sd);
- }
- }
-
- if( sd->state.guild_sent!=0 ) // ギルド初期送信データは送信済み
+ if(sd->state.guild_sent)
return 0;
- // 競合確認
- guild_check_conflict(sd);
-
- // あるならギルド初期送信データ送信
- guild_check_member(g); // 所属を確認する
- if(sd->status.guild_id==g->guild_id){
+ guild_check_conflict(sd); // mystery check
+
+ if(sd->status.guild_id == g->guild_id){
+
clif_guild_belonginfo(sd,g);
clif_guild_notice(sd,g);
- sd->state.guild_sent=1;
- sd->guild_emblem_id=g->emblem_id;
+
+ sd->state.guild_sent = 1;
+ sd->guild_emblem_id = g->emblem_id;
}
+
return 0;
}
-// ギルドメンバのオンライン状態/Lv更新通知
+
int guild_recv_memberinfoshort(int guild_id,int account_id,int char_id,int online,int lv,int class_)
-{
+{ // cleaned up [LuzZza]
+
int i,alv,c,idx=-1,om=0,oldonline=-1;
- struct guild *g=guild_search(guild_id);
- if(g==NULL)
+ struct guild *g = guild_search(guild_id);
+
+ if(g == NULL)
return 0;
+
for(i=0,alv=0,c=0,om=0;i<g->max_member;i++){
struct guild_member *m=&g->member[i];
if(m->account_id==account_id && m->char_id==char_id ){
@@ -936,6 +927,7 @@ int guild_recv_memberinfoshort(int guild_id,int account_id,int char_id,int onlin if(m->online)
om++;
}
+
if(idx == -1 || c == 0) {
// ギルドのメンバー外なので追放扱いする
struct map_session_data *sd = map_id2sd(account_id);
@@ -948,22 +940,33 @@ int guild_recv_memberinfoshort(int guild_id,int account_id,int char_id,int onlin ShowWarning("guild: not found member %d,%d on %d[%s]\n", account_id,char_id,guild_id,g->name);
return 0;
}
+
g->average_lv=alv/c;
g->connect_member=om;
- if(oldonline!=online) // オンライン状態が変わったので通知
- clif_guild_memberlogin_notice(g,idx,online);
-
- for(i=0;i<g->max_member;i++){ // sd再設定
+ for(i=0;i<g->max_member;i++) {
struct map_session_data *sd= map_id2sd(g->member[i].account_id);
- if (sd && sd->status.char_id == g->member[i].char_id &&
- sd->status.guild_id == g->guild_id &&
- !sd->state.waitingdisconnect)
- g->member[i].sd = sd;
- else sd = NULL;
+ g->member[i].sd = (sd && sd->status.char_id == g->member[i].char_id &&
+ sd->status.guild_id == g->guild_id && !sd->state.waitingdisconnect) ? sd : NULL;
}
+
+ if(oldonline!=online)
+ clif_guild_memberlogin_notice(g, idx, online);
+
+
+ if(!g->member[idx].sd)
+ return 0;
+
+ //Send XY dot updates. [Skotlex]
+ //Moved from guild_send_memberinfoshort [LuzZza]
+ for(i=0; i < MAX_GUILD; i++) {
+
+ if(!g->member[i].sd || i == idx ||
+ g->member[i].sd->bl.m != g->member[idx].sd->bl.m)
+ continue;
- // ここにクライアントに送信処理が必要
+ clif_guild_xy_single(g->member[idx].sd->fd, g->member[i].sd);
+ }
return 0;
}
diff --git a/src/map/map.c b/src/map/map.c index 6e5bff823..173241aca 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1538,7 +1538,7 @@ int map_quit(struct map_session_data *sd) { guild_reply_reqalliance(sd,sd->guild_alliance_account,0);
// Force exiting from duel and rejecting
- // all duel invitations when player quit [LuzZza]
+ // all duel invitations when player quit [LuzZza]
if(sd->duel_group > 0)
duel_leave(sd->duel_group, sd);
|