diff options
author | panikon <panikon@zoho.com> | 2014-04-19 21:39:40 -0300 |
---|---|---|
committer | panikon <panikon@zoho.com> | 2014-04-19 21:39:40 -0300 |
commit | 31486a8c3340a8ca8a8b1e5dd9084c2c07ec8614 (patch) | |
tree | 451f55c703d03d06d7035d61e1fded420634580a /src/map | |
parent | 97cd487deb324fb23d9f671d0c1ed739d52d5935 (diff) | |
download | hercules-31486a8c3340a8ca8a8b1e5dd9084c2c07ec8614.tar.gz hercules-31486a8c3340a8ca8a8b1e5dd9084c2c07ec8614.tar.bz2 hercules-31486a8c3340a8ca8a8b1e5dd9084c2c07ec8614.tar.xz hercules-31486a8c3340a8ca8a8b1e5dd9084c2c07ec8614.zip |
Follow up to 6f6a6b3
* Added new method to handle refreshing the storage window when it was closed automatically by the client
* http://hercules.ws/board/tracker/issue-8027-when-the-storage-is-open-you-can-use-self-skills
* http://hercules.ws/board/tracker/issue-7694-guild-notice
Follow up to d57781c
* Fixed minor typo as pointed by @MishimaHaruna
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/clif.c | 57 | ||||
-rw-r--r-- | src/map/clif.h | 1 | ||||
-rw-r--r-- | src/map/guild.c | 4 | ||||
-rw-r--r-- | src/map/intif.c | 2 | ||||
-rw-r--r-- | src/map/skill.c | 5 | ||||
-rw-r--r-- | src/map/unit.c | 13 |
6 files changed, 49 insertions, 33 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index d0fb08486..2fbf64e09 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -8420,6 +8420,34 @@ void clif_message(struct block_list* bl, const char* msg) { clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC); } +/** + * Notifies the client that the storage window is still open + * + * Should only be used in cases where the client closed the + * storage window without server's consent + **/ +void clif_refresh_storagewindow( struct map_session_data *sd ) { + // Notify the client that the storage is open + if( sd->state.storage_flag == 1 ) { + storage->sortitem(sd->status.storage.items, ARRAYLENGTH(sd->status.storage.items)); + clif->storagelist(sd, sd->status.storage.items, ARRAYLENGTH(sd->status.storage.items)); + clif->updatestorageamount(sd, sd->status.storage.storage_amount, MAX_STORAGE); + } + // Notify the client that the gstorage is open otherwise it will + // remain locked forever and nobody will be able to access it + if( sd->state.storage_flag == 2 ) { + struct guild_storage *gstor; + if( (gstor = gstorage->id2storage2(sd->status.guild_id)) == NULL) { + // Shouldn't happen... The information should already be at the map-server + intif->request_guild_storage(sd->status.account_id,sd->status.guild_id); + } else { + storage->sortitem(gstor->items, ARRAYLENGTH(gstor->items)); + clif->storagelist(sd, gstor->items, ARRAYLENGTH(gstor->items)); + clif->updatestorageamount(sd, gstor->storage_amount, MAX_GUILD_STORAGE); + } + } +} + // refresh the client's screen, getting rid of any effects void clif_refresh(struct map_session_data *sd) { @@ -8480,26 +8508,7 @@ void clif_refresh(struct map_session_data *sd) pc->disguise(sd, disguise); } - // Notify the client that the storage is open - if( sd->state.storage_flag == 1 ) { - storage->sortitem(sd->status.storage.items, ARRAYLENGTH(sd->status.storage.items)); - clif->storagelist(sd, sd->status.storage.items, ARRAYLENGTH(sd->status.storage.items)); - clif->updatestorageamount(sd, sd->status.storage.storage_amount, MAX_STORAGE); - } - // Notify the client that the gstorage is open otherwise it will - // remain locked forever and nobody will be able to access it - if( sd->state.storage_flag == 2 ) { - struct guild_storage *gstor; - if( (gstor = gstorage->id2storage2(sd->status.guild_id)) == NULL) { - // Shouldn't happen... The information should already be at the map-server - intif->request_guild_storage(sd->status.account_id,sd->status.guild_id); - } else { - storage->sortitem(gstor->items, ARRAYLENGTH(gstor->items)); - clif->storagelist(sd, gstor->items, ARRAYLENGTH(gstor->items)); - clif->updatestorageamount(sd, gstor->storage_amount, MAX_GUILD_STORAGE); - } - } - + clif->refresh_storagewindow(sd); } @@ -11361,10 +11370,6 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) ) return; - // Some self skills need to close the storage to work properly - if( skill_id == AL_TELEPORT && sd->state.storage_flag ) - storage->close(sd); - if( pc_issit(sd) ) return; @@ -11565,7 +11570,8 @@ void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) if(skill_id != sd->menuskill_id) return; - if( pc_cant_act(sd) ) { + // It is possible to use teleport with the storage window open issue:8027 + if( pc_cant_act(sd) && (!sd->state.storage_flag && skill_id != AL_TELEPORT) ) { clif_menuskill_clear(sd); return; } @@ -18666,6 +18672,7 @@ void clif_defaults(void) { clif->sitting = clif_sitting; clif->standing = clif_standing; clif->arrow_create_list = clif_arrow_create_list; + clif->refresh_storagewindow = clif_refresh_storagewindow; clif->refresh = clif_refresh; clif->fame_blacksmith = clif_fame_blacksmith; clif->fame_alchemist = clif_fame_alchemist; diff --git a/src/map/clif.h b/src/map/clif.h index 36bd42718..bbe07b718 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -650,6 +650,7 @@ struct clif_interface { void (*sitting) (struct block_list* bl); void (*standing) (struct block_list* bl); void (*arrow_create_list) (struct map_session_data *sd); + void (*refresh_storagewindow) (struct map_session_data *sd); void (*refresh) (struct map_session_data *sd); void (*fame_blacksmith) (struct map_session_data *sd, int points); void (*fame_alchemist) (struct map_session_data *sd, int points); diff --git a/src/map/guild.c b/src/map/guild.c index 99c74c217..fa5805c8b 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -568,9 +568,9 @@ int guild_recv_info(struct guild *sg) { if (before.skill_point != g->skill_point) clif->guild_skillinfo(sd); //Submit information skills - if (guild_new) { // Send information and affiliation if unsent + if (guild_new) { // Send information and affiliation if unsent clif->guild_belonginfo(sd, g); - clif->guild_notice(sd, g); + //clif->guild_notice(sd, g); Is already sent in clif_parse_LoadEndAck sd->guild_emblem_id = g->emblem_id; } } diff --git a/src/map/intif.c b/src/map/intif.c index 0f65daa6b..1aa5a46d4 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -1316,7 +1316,7 @@ void intif_parse_GuildMasterChanged(int fd) { // Request pet creation void intif_parse_CreatePet(int fd) { - pet->get_egg(RFIFOL(fd,2), RFIFOL(fd,6), RFIFOB(fd,8)); + pet->get_egg(RFIFOL(fd,2), RFIFOW(fd,6), RFIFOL(fd,8)); } // ACK pet data diff --git a/src/map/skill.c b/src/map/skill.c index 612b205e9..dd2fba5c1 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -9759,10 +9759,15 @@ int skill_castend_map (struct map_session_data *sd, uint16 skill_id, const char switch(skill_id) { case AL_TELEPORT: + // The storage window is closed automatically by the client when there's + // any kind of map change, so we need to restore it automatically + // issue: 8027 if(strcmp(mapname,"Random")==0) pc->randomwarp(sd,CLR_TELEPORT); else if (sd->menuskill_val > 1) //Need lv2 to be able to warp here. pc->setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT); + + clif->refresh_storagewindow(sd); break; case AL_WARP: diff --git a/src/map/unit.c b/src/map/unit.c index 39fff0eab..151d4bad5 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -2138,11 +2138,14 @@ int unit_remove_map(struct block_list *bl, clr_type clrtype, const char* file, i trade->cancel(sd); buyingstore->close(sd); searchstore->close(sd); - if(sd->state.storage_flag == 1) - storage->pc_quit(sd,0); - else if (sd->state.storage_flag == 2) - gstorage->pc_quit(sd,0); - sd->state.storage_flag = 0; //Force close it when being warped. + if( sd->menuskill_id != AL_TELEPORT ) { // issue: 8027 + if(sd->state.storage_flag == 1) + storage->pc_quit(sd,0); + else if (sd->state.storage_flag == 2) + gstorage->pc_quit(sd,0); + + sd->state.storage_flag = 0; //Force close it when being warped. + } if(sd->party_invite>0) party->reply_invite(sd,sd->party_invite,0); if(sd->guild_invite>0) |