summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-03-17 22:32:49 +0000
committerzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-03-17 22:32:49 +0000
commit0884f746a4c82c31b7d98d2f2f95ad9508d01525 (patch)
tree51c8da822a92a07fd87d83b250c19bea12978b2b /src
parent132b6ddad9dcc9537fd98b08fc928e5568689c05 (diff)
downloadhercules-0884f746a4c82c31b7d98d2f2f95ad9508d01525.tar.gz
hercules-0884f746a4c82c31b7d98d2f2f95ad9508d01525.tar.bz2
hercules-0884f746a4c82c31b7d98d2f2f95ad9508d01525.tar.xz
hercules-0884f746a4c82c31b7d98d2f2f95ad9508d01525.zip
- Implemented official battlechat packets (thanks to Pakpil).
- Implemented the scoreboard packets (thanks to Pakpil). - Updates to Tierra Valley according to official info. * There are no barricades around each base, barricades are in the middle left path. * There is another graveyard used for the owners of the middle base, with faster spawn (each 20 seconds). * I added a flag respawn in the middle, currently I don't know if this if official or not, but it allows each team recapture the middle base. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13593 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/battleground.c2
-rw-r--r--src/map/clif.c116
-rw-r--r--src/map/clif.h8
-rw-r--r--src/map/map.h3
-rw-r--r--src/map/script.c53
5 files changed, 153 insertions, 29 deletions
diff --git a/src/map/battleground.c b/src/map/battleground.c
index b72e28fb2..f26f1efb9 100644
--- a/src/map/battleground.c
+++ b/src/map/battleground.c
@@ -269,7 +269,7 @@ int bg_send_message(struct map_session_data *sd, const char *mes, int len)
nullpo_retr(0, sd);
if( sd->state.bg_id == 0 || (bg = bg_team_search(sd->state.bg_id)) == NULL )
return 0;
- clif_bg_message(bg, sd->status.account_id, mes, len);
+ clif_bg_message(bg, sd->status.name, mes, len);
return 0;
}
diff --git a/src/map/clif.c b/src/map/clif.c
index fe10a41d7..063240899 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -812,8 +812,8 @@ static int clif_set_unit_idle(struct block_list* bl, unsigned char* buffer, bool
if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS )
{ //The hell, why flags work like this?
- WBUFL(buf,22) = clif_bg_emblem_id(bl);
- WBUFL(buf,26) = clif_bg_guild_id(bl);
+ WBUFL(buf,22) = clif_visual_emblem_id(bl);
+ WBUFL(buf,26) = clif_visual_guild_id(bl);
}
WBUFW(buf,28) = vd->hair_color;
@@ -827,8 +827,8 @@ static int clif_set_unit_idle(struct block_list* bl, unsigned char* buffer, bool
WBUFB(buf,40) = 0;
return packet_len(0x7c);
}
- WBUFL(buf,34) = clif_bg_guild_id(bl);
- WBUFW(buf,38) = clif_bg_emblem_id(bl);
+ WBUFL(buf,34) = clif_visual_guild_id(bl);
+ WBUFW(buf,38) = clif_visual_emblem_id(bl);
WBUFW(buf,40) = (sd)? sd->status.manner : 0;
#if PACKETVER >= 7
if (!type) {
@@ -908,8 +908,8 @@ static int clif_set_unit_walking(struct block_list* bl, struct unit_data* ud, un
WBUFW(buf,32) = vd->hair_color;
WBUFW(buf,34) = vd->cloth_color;
WBUFW(buf,36) = (sd)? sd->head_dir : 0;
- WBUFL(buf,38) = clif_bg_guild_id(bl);
- WBUFW(buf,42) = clif_bg_emblem_id(bl);
+ WBUFL(buf,38) = clif_visual_guild_id(bl);
+ WBUFW(buf,42) = clif_visual_emblem_id(bl);
WBUFW(buf,44) = (sd)? sd->status.manner : 0;
#if PACKETVER < 7
WBUFW(buf,46) = (sc)? sc->opt3 : 0;
@@ -4730,9 +4730,8 @@ void clif_set0199(struct map_session_data* sd, int mode)
WFIFOSET(fd,packet_len(0x199));
}
-#if 0
-/// Set the map mode?
-/// Differs from the behaviour of clif_set0199 with unknown consequences.
+/// Set the map mode (special)
+/// 19 = battleground
void clif_set01D6(struct map_session_data* sd, int mode)
{
int fd;
@@ -4745,7 +4744,6 @@ void clif_set01D6(struct map_session_data* sd, int mode)
WFIFOW(fd,2)=mode;
WFIFOSET(fd,packet_len(0x1D6));
}
-#endif
/*==========================================
* PVP実装?(仮)
@@ -6486,8 +6484,8 @@ void clif_guild_emblem_area(struct block_list* bl)
// (emblem in the flag npcs and emblem over the head in agit maps) [FlavioJS]
WBUFW(buf,0) = 0x1B4;
WBUFL(buf,2) = bl->id;
- WBUFL(buf,6) = clif_bg_guild_id(bl);
- WBUFW(buf,10) = clif_bg_emblem_id(bl);
+ WBUFL(buf,6) = clif_visual_guild_id(bl);
+ WBUFW(buf,10) = clif_visual_emblem_id(bl);
clif_send(buf, 12, bl, AREA_WOS);
}
@@ -7964,8 +7962,12 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
clif_party_hp(sd); // Show hp after displacement [LuzZza]
}
- if( sd->state.bg_id )
- clif_bg_hp(sd); // BattleGround System
+ if( sd->state.bg_id ) clif_bg_hp(sd); // BattleGround System
+ if( sd->state.changemap && map[sd->bl.m].flag.battleground == 2 )
+ {
+ clif_set01D6(sd,19); // Battleground Mode
+ clif_bg_updatescore_single(sd);
+ }
if(map[sd->bl.m].flag.pvp) {
if(!battle_config.pk_mode) { // remove pvp stuff for pk_mode [Valaris]
@@ -12885,7 +12887,7 @@ int clif_bg_belonginfo(struct map_session_data *sd)
return 1;
}
-int clif_bg_guild_id(struct block_list *bl)
+int clif_visual_guild_id(struct block_list *bl)
{
struct battleground_data *bg;
int bg_id;
@@ -12897,7 +12899,7 @@ int clif_bg_guild_id(struct block_list *bl)
return status_get_guild_id(bl);
}
-int clif_bg_emblem_id(struct block_list *bl)
+int clif_visual_emblem_id(struct block_list *bl)
{
struct battleground_data *bg;
int bg_id;
@@ -12993,19 +12995,22 @@ int clif_bg_leave_single(struct map_session_data *sd, const char *name, const ch
return 0;
}
-int clif_bg_message(struct battleground_data *bg, int account_id, const char *mes, int len)
+int clif_bg_message(struct battleground_data *bg, const char *name, const char *mes, int len)
{
struct map_session_data *sd;
unsigned char *buf;
+ if( (sd = bg_getavailablesd(bg)) == NULL )
+ return 0;
- buf = (unsigned char*)aMallocA((len + 4)*sizeof(unsigned char));
+ buf = (unsigned char*)aMallocA((len + NAME_LENGTH + 8)*sizeof(unsigned char));
- WBUFW(buf, 0) = 0x17f;
- WBUFW(buf, 2) = len + 4;
- memcpy(WBUFP(buf,4), mes, len);
+ WBUFW(buf,0) = 0x2dc;
+ WBUFW(buf,2) = len + NAME_LENGTH + 8;
+ WBUFL(buf,4) = sd->state.bg_id;
+ memcpy(WBUFP(buf,8), name, NAME_LENGTH);
+ memcpy(WBUFP(buf,32), mes, len);
+ clif_send(buf,WBUFW(buf,2), &sd->bl, BG);
- if( (sd = bg_getavailablesd(bg)) != NULL )
- clif_send(buf, WBUFW(buf,2), &sd->bl, BG);
if( buf ) aFree(buf);
return 0;
}
@@ -13026,6 +13031,68 @@ int clif_bg_expulsion_single(struct map_session_data *sd, const char *name, cons
}
/*==========================================
+ * Validates and processes battlechat messages [pakpil]
+ * S 0x2db <packet len>.w <text>.?B (<name> : <message>) 00
+ *------------------------------------------*/
+void clif_parse_BattleChat(int fd, struct map_session_data* sd)
+{
+ const char* text = (char*)RFIFOP(fd,4);
+ int textlen = RFIFOW(fd,2) - 4;
+
+ char *name, *message;
+ int namelen, messagelen;
+
+ if( !clif_process_message(sd, 0, &name, &namelen, &message, &messagelen) )
+ return;
+
+ if( is_atcommand(fd, sd, message, 1) )
+ return;
+
+ if( sd->sc.data[SC_BERSERK] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) )
+ return;
+
+ if( battle_config.min_chat_delay )
+ {
+ if( DIFF_TICK(sd->cantalk_tick, gettick()) > 0 )
+ return;
+ sd->cantalk_tick = gettick() + battle_config.min_chat_delay;
+ }
+
+ bg_send_message(sd, text, textlen);
+}
+
+int clif_bg_updatescore(int m)
+{
+ struct block_list bl;
+ unsigned char buf[6];
+
+ bl.id = 0;
+ bl.type = BL_NUL;
+ bl.m = m;
+
+ WBUFW(buf,0) = 0x2de;
+ WBUFW(buf,2) = map[m].bgscore_lion;
+ WBUFW(buf,4) = map[m].bgscore_eagle;
+ clif_send(buf,6,&bl,ALL_SAMEMAP);
+
+ return 0;
+}
+
+int clif_bg_updatescore_single(struct map_session_data *sd)
+{
+ int fd;
+ nullpo_retr(0,sd);
+ fd = sd->fd;
+
+ WFIFOHEAD(fd,6);
+ WFIFOW(fd,0) = 0x2de;
+ WFIFOW(fd,2) = map[sd->bl.m].bgscore_lion;
+ WFIFOW(fd,4) = map[sd->bl.m].bgscore_eagle;
+ WFIFOSET(fd,6);
+ return 0;
+}
+
+/*==========================================
* パケットデバッグ
*------------------------------------------*/
void clif_parse_debug(int fd,struct map_session_data *sd)
@@ -13294,7 +13361,7 @@ static int packetdb_readdb(void)
0, 0, 0, 0, 0, 0, 0, 0, 0,191, 0, 0, 0, 0, 0, 0,
//#0x02C0
0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 6, -1, 10, 10, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 6, -1, 10, 10, 0, 0, -1, -1, 6, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
@@ -13470,6 +13537,7 @@ static int packetdb_readdb(void)
{clif_parse_cashshop_buy,"cashshopbuy"},
{clif_parse_ViewPlayerEquip,"viewplayerequip"},
{clif_parse_EquipTick,"equiptickbox"},
+ {clif_parse_BattleChat,"battlechat"},
{clif_parse_mercenary_action,"mermenu"},
{NULL,NULL}
};
diff --git a/src/map/clif.h b/src/map/clif.h
index 87c6a2953..6356a0c89 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -343,14 +343,16 @@ int clif_bg_hp(struct map_session_data *sd);
int clif_bg_xy(struct map_session_data *sd);
int clif_bg_xy_remove(struct map_session_data *sd);
int clif_bg_belonginfo(struct map_session_data *sd);
-int clif_bg_guild_id(struct block_list *bl);
-int clif_bg_emblem_id(struct block_list *bl);
+int clif_visual_guild_id(struct block_list *bl);
+int clif_visual_emblem_id(struct block_list *bl);
int clif_bg_emblem(struct map_session_data *sd, struct guild *g);
int clif_bg_memberlist(struct map_session_data *sd);
int clif_bg_leave(struct map_session_data *sd, const char *name, const char *mes);
int clif_bg_leave_single(struct map_session_data *sd, const char *name, const char *mes);
-int clif_bg_message(struct battleground_data *bg, int account_id, const char *mes, int len);
+int clif_bg_message(struct battleground_data *bg, const char *name, const char *mes, int len);
int clif_bg_expulsion_single(struct map_session_data *sd, const char *name, const char *mes);
+int clif_bg_updatescore(int m);
+int clif_bg_updatescore_single(struct map_session_data *sd);
// atcommand
int clif_displaymessage(const int fd,const char* mes);
diff --git a/src/map/map.h b/src/map/map.h
index 8fcfc6195..f96ae8db9 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -411,6 +411,7 @@ struct map_data {
int m;
short xs,ys; // map dimensions (in cells)
short bxs,bys; // map dimensions (in blocks)
+ short bgscore_lion, bgscore_eagle; // Battleground ScoreBoard
int npc_num;
int users;
int iwall_num; // Total of invisible walls in this map
@@ -434,7 +435,7 @@ struct map_data {
unsigned gvg : 1; // Now it identifies gvg versus maps that are active 24/7
unsigned gvg_dungeon : 1; // Celest
unsigned gvg_noparty : 1;
- unsigned battleground : 1; // [BattleGround System]
+ unsigned battleground : 2; // [BattleGround System]
unsigned nozenypenalty : 1;
unsigned notrade : 1;
unsigned noskill : 1;
diff --git a/src/map/script.c b/src/map/script.c
index d7a3b1e07..5c1836c97 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -13405,6 +13405,20 @@ BUILDIN_FUNC(waitingroom2bg_single)
return 0;
}
+BUILDIN_FUNC(bg_team_setxy)
+{
+ struct battleground_data *bg;
+ int bg_id;
+
+ bg_id = script_getnum(st,2);
+ if( (bg = bg_team_search(bg_id)) == NULL )
+ return 0;
+
+ bg->x = script_getnum(st,3);
+ bg->y = script_getnum(st,4);
+ return 0;
+}
+
BUILDIN_FUNC(bg_warp)
{
int x, y, mapindex, bg_id;
@@ -13437,6 +13451,26 @@ BUILDIN_FUNC(bg_monster)
return 0;
}
+BUILDIN_FUNC(bg_monster_set_team)
+{
+ struct mob_data *md;
+ struct block_list *mbl;
+ int id = script_getnum(st,2),
+ bg_id = script_getnum(st,3);
+
+ if( (mbl = map_id2bl(id)) == NULL || mbl->type != BL_MOB )
+ return 0;
+ md = (TBL_MOB *)mbl;
+ md->state.bg_id = bg_id;
+
+ mob_stop_attack(md);
+ mob_stop_walking(md, 0);
+ md->target_id = md->attacked_id = 0;
+ clif_charnameack(0, &md->bl);
+
+ return 0;
+}
+
BUILDIN_FUNC(bg_leave)
{
struct map_session_data *sd = script_rid2sd(st);
@@ -13489,6 +13523,22 @@ BUILDIN_FUNC(bg_getareausers)
return 0;
}
+BUILDIN_FUNC(bg_updatescore)
+{
+ const char *str;
+ int m;
+
+ str = script_getstr(st,2);
+ if( (m = map_mapname2mapid(str)) < 0 )
+ return 0;
+
+ map[m].bgscore_lion = script_getnum(st,3);
+ map[m].bgscore_eagle = script_getnum(st,4);
+
+ clif_bg_updatescore(m);
+ return 0;
+}
+
BUILDIN_FUNC(bg_get_data)
{
struct battleground_data *bg;
@@ -13874,12 +13924,15 @@ struct script_function buildin_func[] = {
// BattleGround
BUILDIN_DEF(waitingroom2bg,"siiiss?"),
BUILDIN_DEF(waitingroom2bg_single,"isiis"),
+ BUILDIN_DEF(bg_team_setxy,"iii"),
BUILDIN_DEF(bg_warp,"isii"),
BUILDIN_DEF(bg_monster,"isiisi*"),
+ BUILDIN_DEF(bg_monster_set_team,"ii"),
BUILDIN_DEF(bg_leave,""),
BUILDIN_DEF(bg_destroy,"i"),
BUILDIN_DEF(areapercentheal,"siiiiii"),
BUILDIN_DEF(bg_get_data,"ii"),
BUILDIN_DEF(bg_getareausers,"isiiii"),
+ BUILDIN_DEF(bg_updatescore,"sii"),
{NULL,NULL,NULL},
};