summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-04-15 23:27:29 -0300
committershennetsind <ind@henn.et>2013-04-15 23:27:29 -0300
commit2967335cb41866162a69732abe4fc3a07b02e27c (patch)
tree08ce3282b6204cfd0491a9aba2811139f046ada8 /src
parent7a853ef214cc4f96574358759489f3769a805e4c (diff)
downloadhercules-2967335cb41866162a69732abe4fc3a07b02e27c.tar.gz
hercules-2967335cb41866162a69732abe4fc3a07b02e27c.tar.bz2
hercules-2967335cb41866162a69732abe4fc3a07b02e27c.tar.xz
hercules-2967335cb41866162a69732abe4fc3a07b02e27c.zip
Fixed Bug #7127
Also Implemented allow party invitations state. Implemented saving of client options (atm show_equip and allow party invitation) http://hercules.ws/board/tracker/issue-7127-view-equipment/ Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src')
-rw-r--r--src/char/char.c30
-rw-r--r--src/common/mmo.h8
-rw-r--r--src/map/clif.c27
-rw-r--r--src/map/clif.h2
-rw-r--r--src/map/packets.h2
5 files changed, 58 insertions, 11 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 99505f632..ce0d067a7 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -436,7 +436,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p)
else
errors++;
}
-
+
if (
(p->base_exp != cp->base_exp) || (p->base_level != cp->base_level) ||
(p->job_level != cp->job_level) || (p->job_exp != cp->job_exp) ||
@@ -453,9 +453,16 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p)
(p->pet_id != cp->pet_id) || (p->weapon != cp->weapon) || (p->hom_id != cp->hom_id) ||
(p->ele_id != cp->ele_id) || (p->shield != cp->shield) || (p->head_top != cp->head_top) ||
(p->head_mid != cp->head_mid) || (p->head_bottom != cp->head_bottom) || (p->delete_date != cp->delete_date) ||
- (p->rename != cp->rename) || (p->slotchange != cp->slotchange) || (p->robe != cp->robe)
- )
- { //Save status
+ (p->rename != cp->rename) || (p->slotchange != cp->slotchange) || (p->robe != cp->robe) ||
+ (p->show_equip != cp->show_equip) || (p->allow_party != cp->allow_party)
+ ) { //Save status
+ unsigned int opt = 0;
+
+ if( p->allow_party )
+ opt |= OPT_ALLOW_PARTY;
+ if( p->show_equip )
+ opt |= OPT_SHOW_EQUIP;
+
if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `base_level`='%d', `job_level`='%d',"
"`base_exp`='%u', `job_exp`='%u', `zeny`='%d',"
"`max_hp`='%d',`hp`='%d',`max_sp`='%d',`sp`='%d',`status_point`='%d',`skill_point`='%d',"
@@ -463,7 +470,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p)
"`option`='%d',`party_id`='%d',`guild_id`='%d',`pet_id`='%d',`homun_id`='%d',`elemental_id`='%d',"
"`weapon`='%d',`shield`='%d',`head_top`='%d',`head_mid`='%d',`head_bottom`='%d',"
"`last_map`='%s',`last_x`='%d',`last_y`='%d',`save_map`='%s',`save_x`='%d',`save_y`='%d', `rename`='%d',"
- "`delete_date`='%lu',`robe`='%d',`slotchange`='%d'"
+ "`delete_date`='%lu',`robe`='%d',`slotchange`='%d', `char_opt`='%u'"
" WHERE `account_id`='%d' AND `char_id` = '%d'",
char_db, p->base_level, p->job_level,
p->base_exp, p->job_exp, p->zeny,
@@ -474,7 +481,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p)
mapindex_id2name(p->last_point.map), p->last_point.x, p->last_point.y,
mapindex_id2name(p->save_point.map), p->save_point.x, p->save_point.y, p->rename,
(unsigned long)p->delete_date, // FIXME: platform-dependent size
- p->robe,p->slotchange,
+ p->robe,p->slotchange,opt,
p->account_id, p->char_id) )
{
Sql_ShowDebug(sql_handle);
@@ -1084,6 +1091,7 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything
struct hotkey tmp_hotkey;
int hotkey_num;
#endif
+ unsigned int opt;
memset(p, 0, sizeof(struct mmo_charstatus));
@@ -1102,7 +1110,8 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything
"`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`,"
"`status_point`,`skill_point`,`option`,`karma`,`manner`,`party_id`,`guild_id`,`pet_id`,`homun_id`,`elemental_id`,`hair`,"
"`hair_color`,`clothes_color`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`last_x`,`last_y`,"
- "`save_map`,`save_x`,`save_y`,`partner_id`,`father`,`mother`,`child`,`fame`,`rename`,`delete_date`,`robe`,`slotchange`"
+ "`save_map`,`save_x`,`save_y`,`partner_id`,`father`,`mother`,`child`,`fame`,`rename`,`delete_date`,`robe`,`slotchange`,"
+ "`char_opt`"
" FROM `%s` WHERE `char_id`=? LIMIT 1", char_db)
|| SQL_ERROR == SqlStmt_BindParam(stmt, 0, SQLDT_INT, &char_id, 0)
|| SQL_ERROR == SqlStmt_Execute(stmt)
@@ -1159,6 +1168,7 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything
|| SQL_ERROR == SqlStmt_BindColumn(stmt, 50, SQLDT_UINT32, &p->delete_date, 0, NULL, NULL)
|| SQL_ERROR == SqlStmt_BindColumn(stmt, 51, SQLDT_SHORT, &p->robe, 0, NULL, NULL)
|| SQL_ERROR == SqlStmt_BindColumn(stmt, 52, SQLDT_USHORT, &p->slotchange, 0, NULL, NULL)
+ || SQL_ERROR == SqlStmt_BindColumn(stmt, 53, SQLDT_UINT, &opt, 0, NULL, NULL)
)
{
SqlStmt_ShowDebug(stmt);
@@ -1330,6 +1340,12 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything
SqlStmt_Free(stmt);
StringBuf_Destroy(&buf);
+ /* load options into proper vars */
+ if( opt & OPT_ALLOW_PARTY )
+ p->allow_party = true;
+ if( opt & OPT_SHOW_EQUIP )
+ p->show_equip = true;
+
cp = idb_ensure(char_db_, char_id, create_charstatus);
memcpy(cp, p, sizeof(struct mmo_charstatus));
return 1;
diff --git a/src/common/mmo.h b/src/common/mmo.h
index bd6b29f76..c0842bac2 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -219,6 +219,12 @@ enum e_skill_flag
//...
};
+enum e_mmo_charstatus_opt {
+ OPT_NONE = 0x0,
+ OPT_SHOW_EQUIP = 0x1,
+ OPT_ALLOW_PARTY = 0x2,
+};
+
struct s_skill {
unsigned short id;
unsigned char lv;
@@ -378,7 +384,7 @@ struct mmo_charstatus {
#ifdef HOTKEY_SAVING
struct hotkey hotkeys[MAX_HOTKEYS];
#endif
- bool show_equip;
+ bool show_equip, allow_party;
unsigned short rename;
unsigned short slotchange;
diff --git a/src/map/clif.c b/src/map/clif.c
index b1998de77..57b14b1de 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -6354,7 +6354,7 @@ void clif_partyinvitationstate(struct map_session_data* sd)
WFIFOHEAD(fd, packet_len(0x2c9));
WFIFOW(fd, 0) = 0x2c9;
- WFIFOB(fd, 2) = 0; // not implemented
+ WFIFOB(fd, 2) = sd->status.allow_party ? 1 : 0;
WFIFOSET(fd, packet_len(0x2c9));
}
@@ -14641,6 +14641,16 @@ void clif_parse_EquipTick(int fd, struct map_session_data* sd)
clif->equiptickack(sd, flag);
}
+/// Request to change party invitation tick.
+/// value:
+/// 0 = disabled
+/// 1 = enabled
+void clif_parse_PartyTick(int fd, struct map_session_data* sd)
+{
+ bool flag = RFIFOB(fd,6)?true:false;
+ sd->status.allow_party = flag;
+ clif->partytickack(sd, flag);
+}
/// Questlog System [Kevin] [Inkfish]
///
@@ -16595,6 +16605,15 @@ void clif_maptypeproperty2(struct block_list *bl,enum send_target t) {
clif->send(&p,sizeof(p),bl,t);
#endif
}
+
+void clif_partytickack(struct map_session_data* sd, bool flag) {
+
+ WFIFOHEAD(sd->fd, packet_len(0x2c9));
+ WFIFOW(sd->fd, 0) = 0x2c9;
+ WFIFOB(sd->fd, 2) = flag;
+ WFIFOSET(sd->fd, packet_len(0x2c9));
+}
+
/*==========================================
* Main client packet processing function
*------------------------------------------*/
@@ -16974,6 +16993,7 @@ void clif_defaults(void) {
clif->hate_info = clif_hate_info;
clif->mission_info = clif_mission_info;
clif->feel_hate_reset = clif_feel_hate_reset;
+ clif->partytickack = clif_partytickack;
clif->equiptickack = clif_equiptickack;
clif->viewequip_ack = clif_viewequip_ack;
clif->viewequip_fail = clif_viewequip_fail;
@@ -17465,10 +17485,13 @@ void clif_defaults(void) {
clif->pDebug = clif_parse_debug;
clif->pSkillSelectMenu = clif_parse_SkillSelectMenu;
clif->pMoveItem = clif_parse_MoveItem;
- clif->pDull = clif_parse_dull;
/* RagExe Cash Shop [Ind/Hercules] */
clif->pCashShopOpen = clif_parse_CashShopOpen;
clif->pCashShopClose = clif_parse_CashShopClose;
clif->pCashShopSchedule = clif_parse_CashShopSchedule;
clif->pCashShopBuy = clif_parse_CashShopBuy;
+ /* */
+ clif->pPartyTick = clif_parse_PartyTick;
+ /* dull */
+ clif->pDull = clif_parse_dull;
}
diff --git a/src/map/clif.h b/src/map/clif.h
index 89a330a90..0e13b29f2 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -575,6 +575,7 @@ struct clif_interface {
void (*hate_info) (struct map_session_data *sd, unsigned char hate_level,int class_, unsigned char type);
void (*mission_info) (struct map_session_data *sd, int mob_id, unsigned char progress);
void (*feel_hate_reset) (struct map_session_data *sd);
+ void (*partytickack) (struct map_session_data* sd, bool flag);
void (*equiptickack) (struct map_session_data* sd, int flag);
void (*viewequip_ack) (struct map_session_data* sd, struct map_session_data* tsd);
void (*viewequip_fail) (struct map_session_data* sd);
@@ -1071,6 +1072,7 @@ struct clif_interface {
void (*pCashShopClose) (int fd, struct map_session_data *sd);
void (*pCashShopSchedule) (int fd, struct map_session_data *sd);
void (*pCashShopBuy) (int fd, struct map_session_data *sd);
+ void (*pPartyTick) (int fd, struct map_session_data *sd);
} clif_s;
struct clif_interface *clif;
diff --git a/src/map/packets.h b/src/map/packets.h
index 09e035413..3c204c978 100644
--- a/src/map/packets.h
+++ b/src/map/packets.h
@@ -1116,7 +1116,7 @@ packet(0x020d,-1);
packet(0x02c5,30);
packet(0x02c6,30);
packet(0x02c7,7,clif->pReplyPartyInvite2,2,6);
- packet(0x02c8,3);
+ packet(0x02c8,3,clif->pPartyTick,2);
packet(0x02c9,3);
packet(0x02ca,3);
packet(0x02cb,20);