From 8cd740d2c77f69216f2c7d10f77773d30104ae83 Mon Sep 17 00:00:00 2001 From: Matheus Macabu Date: Thu, 11 Jul 2013 13:20:44 -0300 Subject: Fixed a little type (follow up to 94d75f8), also defaulted to 0 mute system. --- src/map/clif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/map/clif.c') diff --git a/src/map/clif.c b/src/map/clif.c index 18aa476ff..f557271be 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -11861,7 +11861,7 @@ void clif_parse_ResetChar(int fd, struct map_session_data *sd) { if( RFIFOW(fd,2) ) sprintf(cmd,"%cskreset",atcommand->at_symbol); else - sprintf(cmd,"%streset",atcommand->at_symbol); + sprintf(cmd,"%cstreset",atcommand->at_symbol); atcommand->parse(fd, sd, cmd, 1); } -- cgit v1.2.3-70-g09d2 From e3761a81ba4c941ba04a2b6b1f161a6e1402ebe9 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Thu, 11 Jul 2013 14:30:58 -0300 Subject: Fix to Bug #7434 Fixing a ancient bug where placing a item from inventory to cart when cart is full would render such item un-clickable, same for when doing so from storage to cart. Special Thanks to Yommy for all the data, jTynne for bringing this up. http://hercules.ws/board/tracker/issue-7434-weightinability-to-click-item-issue/ Signed-off-by: shennetsind --- src/map/clif.c | 23 +++++++++++++++++++---- src/map/clif.h | 1 + src/map/packets_struct.h | 7 +++++++ src/map/pc.c | 15 ++++++++------- src/map/storage.c | 10 +++++++--- 5 files changed, 42 insertions(+), 14 deletions(-) (limited to 'src/map/clif.c') diff --git a/src/map/clif.c b/src/map/clif.c index f17766f50..0000633bc 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -11133,13 +11133,16 @@ void clif_parse_StopAttack(int fd,struct map_session_data *sd) /// Request to move an item from inventory to cart (CZ_MOVE_ITEM_FROM_BODY_TO_CART). /// 0126 .W .L -void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) -{ +void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) { + int flag = 0; if (pc_istrading(sd)) return; if (!pc_iscarton(sd)) return; - pc->putitemtocart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4)); + if ( (flag = pc->putitemtocart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4))) ) { + clif->dropitem(sd, RFIFOW(fd,2)-2,0); + clif->cart_additem_ack(sd,flag == 1?0x0:0x1); + } } @@ -17580,7 +17583,18 @@ void clif_skill_cooldown_list(int fd, struct skill_cd* cd) { WFIFOSET(fd,4+(offset*count)); } - +/* [Ind/Hercules] - Data Thanks to Yommy + * - ADDITEM_TO_CART_FAIL_WEIGHT = 0x0 + * - ADDITEM_TO_CART_FAIL_COUNT = 0x1 + */ +void clif_cart_additem_ack(struct map_session_data *sd, int flag) { + struct packet_cart_additem_ack p; + + p.PacketType = cart_additem_ackType; + p.result = (char)flag; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} /* */ unsigned short clif_decrypt_cmd( int cmd, struct map_session_data *sd ) { if( sd ) { @@ -17917,6 +17931,7 @@ void clif_defaults(void) { clif->addcards2 = clif_addcards2; clif->item_sub = clif_item_sub; clif->getareachar_item = clif_getareachar_item; + clif->cart_additem_ack = clif_cart_additem_ack; /* unit-related */ clif->clearunit_single = clif_clearunit_single; clif->clearunit_area = clif_clearunit_area; diff --git a/src/map/clif.h b/src/map/clif.h index a0946a48a..e1744b4e8 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -501,6 +501,7 @@ struct clif_interface { void (*addcards2) (unsigned short *cards, struct item* item); void (*item_sub) (unsigned char *buf, int n, struct item *i, struct item_data *id, int equip); void (*getareachar_item) (struct map_session_data* sd,struct flooritem_data* fitem); + void (*cart_additem_ack) (struct map_session_data *sd, int flag); void (*cashshop_load) (void); void (*package_announce) (struct map_session_data *sd, unsigned short nameid, unsigned short containerid); /* unit-related */ diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index f6e6a8a3f..d56e9ce01 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -18,6 +18,7 @@ struct EQUIPSLOTINFO { * **/ enum packet_headers { + cart_additem_ackType = 0x12c, sc_notickType = 0x196, #if PACKETVER < 20061218 additemType = 0xa0, @@ -459,6 +460,7 @@ struct packet_script_clear { short PacketType; unsigned int NpcID; } __attribute__((packed)); + /* made possible thanks to Yommy!! */ struct packet_package_item_announce { short PacketType; @@ -471,6 +473,11 @@ struct packet_package_item_announce { unsigned short BoxItemID; } __attribute__((packed)); +struct packet_cart_additem_ack { + short PacketType; + char result; +} __attribute__((packed)); + #pragma pack(pop) #endif /* _PACKETS_STRUCT_H_ */ diff --git a/src/map/pc.c b/src/map/pc.c index 87e80c264..0bd593930 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -4432,7 +4432,7 @@ int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amoun if( !itemdb_cancartstore(item_data, pc->get_group_level(sd)) ) { // Check item trade restrictions [Skotlex] clif->message (sd->fd, msg_txt(264)); - return 1; + return 1;/* TODO: there is no official response to this? */ } if( (w = data->weight*amount) + sd->cart_weight > sd->cart_weight_max ) @@ -4450,7 +4450,7 @@ int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amoun if( i < MAX_CART ) {// item already in cart, stack it if( amount > MAX_AMOUNT - sd->status.cart[i].amount || ( data->stack.cart && amount > data->stack.amount - sd->status.cart[i].amount ) ) - return 1; // no room + return 2; // no room sd->status.cart[i].amount+=amount; clif->cart_additem(sd,i,amount,0); @@ -4459,7 +4459,7 @@ int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amoun {// item not stackable or not present, add it ARR_FIND( 0, MAX_CART, i, sd->status.cart[i].nameid == 0 ); if( i == MAX_CART ) - return 1; // no room + return 2; // no room memcpy(&sd->status.cart[i],item_data,sizeof(sd->status.cart[0])); sd->status.cart[i].amount=amount; @@ -4513,6 +4513,7 @@ int pc_cart_delitem(struct map_session_data *sd,int n,int amount,int type,e_log_ int pc_putitemtocart(struct map_session_data *sd,int idx,int amount) { struct item *item_data; + int flag; nullpo_ret(sd); @@ -4524,10 +4525,10 @@ int pc_putitemtocart(struct map_session_data *sd,int idx,int amount) if( item_data->nameid == 0 || amount < 1 || item_data->amount < amount || sd->state.vending ) return 1; - if( pc->cart_additem(sd,item_data,amount,LOG_TYPE_NONE) == 0 ) + if( (flag = pc->cart_additem(sd,item_data,amount,LOG_TYPE_NONE)) == 0 ) return pc->delitem(sd,idx,amount,0,5,LOG_TYPE_NONE); - return 1; + return flag; } /*========================================== @@ -4569,11 +4570,11 @@ int pc_getitemfromcart(struct map_session_data *sd,int idx,int amount) if(item_data->nameid==0 || amount < 1 || item_data->amountstate.vending ) return 1; + if((flag = pc->additem(sd,item_data,amount,LOG_TYPE_NONE)) == 0) return pc->cart_delitem(sd,idx,amount,0,LOG_TYPE_NONE); - clif->additem(sd,0,0,flag); - return 1; + return flag; } /*========================================== diff --git a/src/map/storage.c b/src/map/storage.c index 7a4649a98..e0b751863 100644 --- a/src/map/storage.c +++ b/src/map/storage.c @@ -294,8 +294,8 @@ int storage_storageaddfromcart(struct map_session_data* sd, int index, int amoun * 0 : fail * 1 : success *------------------------------------------*/ -int storage_storagegettocart(struct map_session_data* sd, int index, int amount) -{ +int storage_storagegettocart(struct map_session_data* sd, int index, int amount) { + int flag = 0; nullpo_ret(sd); if( index < 0 || index >= MAX_STORAGE ) @@ -307,8 +307,12 @@ int storage_storagegettocart(struct map_session_data* sd, int index, int amount) if( amount < 1 || amount > sd->status.storage.items[index].amount ) return 0; - if( pc->cart_additem(sd,&sd->status.storage.items[index],amount,LOG_TYPE_STORAGE) == 0 ) + if( (flag = pc->cart_additem(sd,&sd->status.storage.items[index],amount,LOG_TYPE_STORAGE)) == 0 ) storage->delitem(sd,index,amount); + else { + clif->dropitem(sd, index,0); + clif->cart_additem_ack(sd,flag == 1?0x0:0x1); + } return 1; } -- cgit v1.2.3-70-g09d2 From e92b006b5175b9f8f059b49d3cb720423b5045e8 Mon Sep 17 00:00:00 2001 From: Haru Date: Mon, 15 Jul 2013 15:01:36 +0200 Subject: Allow higher level GMs to bypass a player's /exall when whispering - Follow-up to 3d0fba0 - Fixes the remaining part of bug #7463: http://hercules.ws/board/tracker/issue-7463-gm-cant-whsiper-wheb-player-do-exall Signed-off-by: Haru --- src/map/clif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/map/clif.c') diff --git a/src/map/clif.c b/src/map/clif.c index 1b96d45fb..2f7360da9 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -10494,9 +10494,9 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd) } // if player ignores everyone - if (dstsd->state.ignoreAll) { + if (dstsd->state.ignoreAll && pc->get_group_level(sd) <= pc->get_group_level(dstsd)) { if (dstsd->sc.option & OPTION_INVISIBLE && pc->get_group_level(sd) < pc->get_group_level(dstsd)) - clif->wis_end(fd, 1); // 1: target character is not loged in + clif->wis_end(fd, 1); // 1: target character is not logged in else clif->wis_end(fd, 3); // 3: everyone ignored by target return; -- cgit v1.2.3-70-g09d2 From 857e4fb58b26ea088c0ad92ec5b1ac9423ec1e65 Mon Sep 17 00:00:00 2001 From: Haru Date: Wed, 17 Jul 2013 05:29:19 +0200 Subject: Added missing initialization of some functions in the homunculus interface - Fixes issue #7536 (thanks to jTynne for the report) http://hercules.ws/board/tracker/issue-7536-map-crash-july-15th/ - Minor corrections to the other interfaces as well (reordered initialization to follow the definitions, removed duplicate entry in the skill interface initialization, commented out some unused entries) Signed-off-by: Haru --- src/map/atcommand.c | 2 +- src/map/battle.c | 16 ++++++++-------- src/map/chrif.h | 2 +- src/map/clif.c | 46 +++++++++++++++++++++++----------------------- src/map/clif.h | 5 +++-- src/map/homunculus.c | 2 ++ src/map/itemdb.c | 2 +- src/map/log.c | 5 +++-- src/map/map.c | 34 +++++++++++++++++----------------- src/map/map.h | 2 +- src/map/pc.h | 2 +- src/map/script.c | 5 ++--- src/map/skill.c | 7 +++---- src/map/storage.c | 2 +- 14 files changed, 67 insertions(+), 65 deletions(-) (limited to 'src/map/clif.c') diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 950961b29..29bd43d16 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -10260,9 +10260,9 @@ void atcommand_defaults(void) { atcommand->final = do_final_atcommand; atcommand->parse = is_atcommand; + atcommand->create = atcommand_hp_add; atcommand->can_use = atcommand_can_use; atcommand->can_use2 = atcommand_can_use2; - atcommand->create = atcommand_hp_add; atcommand->load_groups = atcommand_db_load_groups; atcommand->exists = atcommand_exists; atcommand->msg_read = msg_config_read; diff --git a/src/map/battle.c b/src/map/battle.c index 2016efa3b..bded771e7 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -6784,18 +6784,11 @@ void battle_defaults(void) { battle->calc_damage = battle_calc_damage; battle->calc_gvg_damage = battle_calc_gvg_damage; battle->calc_bg_damage = battle_calc_bg_damage; - battle->calc_base_damage = battle_calc_base_damage; - battle->calc_misc_attack = battle_calc_misc_attack; - battle->calc_magic_attack = battle_calc_magic_attack; battle->weapon_attack = battle_weapon_attack; + battle->calc_weapon_attack = battle_calc_weapon_attack; battle->delay_damage = battle_delay_damage; battle->drain = battle_drain; battle->calc_return_damage = battle_calc_return_damage; - battle->calc_weapon_attack = battle_calc_weapon_attack; -#ifdef RENEWAL - battle->calc_weapon_damage = battle_calc_weapon_damage; -#endif - battle->calc_defense = battle_calc_defense; battle->attr_ratio = battle_attr_ratio; battle->attr_fix = battle_attr_fix; battle->calc_cardfix = battle_calc_cardfix; @@ -6803,6 +6796,10 @@ void battle_defaults(void) { battle->calc_masteryfix = battle_calc_masteryfix; battle->calc_skillratio = battle_calc_skillratio; battle->calc_sizefix = battle_calc_sizefix; +#ifdef RENEWAL + battle->calc_weapon_damage = battle_calc_weapon_damage; +#endif + battle->calc_defense = battle_calc_defense; battle->get_master = battle_get_master; battle->get_targeted = battle_gettargeted; battle->get_enemy = battle_getenemy; @@ -6818,6 +6815,9 @@ void battle_defaults(void) { battle->delay_damage_sub = battle_delay_damage_sub; battle->blewcount_bonus = battle_blewcount_bonus; battle->range_type = battle_range_type; + battle->calc_base_damage = battle_calc_base_damage; + battle->calc_misc_attack = battle_calc_misc_attack; + battle->calc_magic_attack = battle_calc_magic_attack; battle->adjust_skill_damage = battle_adjust_skill_damage; battle->add_mastery = battle_addmastery; battle->calc_drain = battle_calc_drain; diff --git a/src/map/chrif.h b/src/map/chrif.h index a6a5fc6bf..b6883d855 100644 --- a/src/map/chrif.h +++ b/src/map/chrif.h @@ -68,7 +68,7 @@ struct chrif_interface { int (*send_users_tochar) (void); int (*char_online) (struct map_session_data *sd); int (*changesex) (struct map_session_data *sd); - int (*chardisconnect) (struct map_session_data *sd); + //int (*chardisconnect) (struct map_session_data *sd); // FIXME: Commented out in clif.c, function does not exist int (*divorce) (int partner_id1, int partner_id2); int (*removefriend) (int char_id, int friend_id); diff --git a/src/map/clif.c b/src/map/clif.c index 2f7360da9..c19c9f7f6 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -17934,6 +17934,8 @@ void clif_defaults(void) { clif->item_sub = clif_item_sub; clif->getareachar_item = clif_getareachar_item; clif->cart_additem_ack = clif_cart_additem_ack; + clif->cashshop_load = clif_cashshop_db; + clif->package_announce = clif_package_item_announce; /* unit-related */ clif->clearunit_single = clif_clearunit_single; clif->clearunit_area = clif_clearunit_area; @@ -18334,19 +18336,6 @@ void clif_defaults(void) { /* elemental-related */ clif->elemental_info = clif_elemental_info; clif->elemental_updatestatus = clif_elemental_updatestatus; - /* Hercules Channel System */ - clif->chsys_create = clif_hercules_chsys_create; - clif->chsys_msg = clif_hercules_chsys_msg; - clif->chsys_msg2 = clif_hercules_chsys_msg2; - clif->chsys_send = clif_hercules_chsys_send; - clif->chsys_join = clif_hercules_chsys_join; - clif->chsys_left = clif_hercules_chsys_left; - clif->chsys_delete = clif_hercules_chsys_delete; - clif->chsys_mjoin = clif_hercules_chsys_mjoin; - clif->chsys_quit = clif_hercules_chsys_quit; - clif->chsys_quitg = clif_hercules_chsys_quitg; - clif->chsys_gjoin = clif_hercules_chsys_gjoin; - clif->chsys_gleave = clif_hercules_chsys_gleave; /* bgqueue */ clif->bgqueue_ack = clif_bgqueue_ack; clif->bgqueue_notice_delete = clif_bgqueue_notice_delete; @@ -18361,10 +18350,21 @@ void clif_defaults(void) { clif->notify_time = clif_notify_time; clif->user_count = clif_user_count; clif->noask_sub = clif_noask_sub; - clif->cashshop_load = clif_cashshop_db; - clif->package_announce = clif_package_item_announce; clif->bc_ready = clif_bc_ready; clif->undisguise_timer = clif_undisguise_timer; + /* Hercules Channel System */ + clif->chsys_create = clif_hercules_chsys_create; + clif->chsys_msg = clif_hercules_chsys_msg; + clif->chsys_msg2 = clif_hercules_chsys_msg2; + clif->chsys_send = clif_hercules_chsys_send; + clif->chsys_join = clif_hercules_chsys_join; + clif->chsys_left = clif_hercules_chsys_left; + clif->chsys_delete = clif_hercules_chsys_delete; + clif->chsys_mjoin = clif_hercules_chsys_mjoin; + clif->chsys_quit = clif_hercules_chsys_quit; + clif->chsys_quitg = clif_hercules_chsys_quitg; + clif->chsys_gjoin = clif_hercules_chsys_gjoin; + clif->chsys_gleave = clif_hercules_chsys_gleave; /*------------------------ *- Parse Incoming Packet *------------------------*/ @@ -18402,6 +18402,7 @@ void clif_defaults(void) { clif->pKickFromChat = clif_parse_KickFromChat; clif->pChatLeave = clif_parse_ChatLeave; clif->pTradeRequest = clif_parse_TradeRequest; + clif->chann_config_read = read_channels_config; clif->pTradeAck = clif_parse_TradeAck; clif->pTradeAddItem = clif_parse_TradeAddItem; clif->pTradeOk = clif_parse_TradeOk; @@ -18456,7 +18457,6 @@ void clif_defaults(void) { clif->pLeaveParty = clif_parse_LeaveParty; clif->pRemovePartyMember = clif_parse_RemovePartyMember; clif->pPartyChangeOption = clif_parse_PartyChangeOption; - clif->chann_config_read = read_channels_config; clif->pPartyMessage = clif_parse_PartyMessage; clif->pPartyChangeLeader = clif_parse_PartyChangeLeader; clif->pPartyBookingRegisterReq = clif_parse_PartyBookingRegisterReq; @@ -18561,17 +18561,19 @@ void clif_defaults(void) { clif->pDebug = clif_parse_debug; clif->pSkillSelectMenu = clif_parse_SkillSelectMenu; clif->pMoveItem = clif_parse_MoveItem; + /* dull */ + clif->pDull = clif_parse_dull; + /* BGQueue */ + clif->pBGQueueRegister = clif_parse_bgqueue_register; + clif->pBGQueueCheckState = clif_parse_bgqueue_checkstate; + clif->pBGQueueRevokeReq = clif_parse_bgqueue_revoke_req; + clif->pBGQueueBattleBeginAck = clif_parse_bgqueue_battlebegin_ack; /* RagExe Cash Shop [Ind/Hercules] */ clif->pCashShopOpen = clif_parse_CashShopOpen; clif->pCashShopClose = clif_parse_CashShopClose; clif->pCashShopReqTab = clif_parse_CashShopReqTab; clif->pCashShopSchedule = clif_parse_CashShopSchedule; clif->pCashShopBuy = clif_parse_CashShopBuy; - /* BGQueue */ - clif->pBGQueueRegister = clif_parse_bgqueue_register; - clif->pBGQueueCheckState = clif_parse_bgqueue_checkstate; - clif->pBGQueueRevokeReq = clif_parse_bgqueue_revoke_req; - clif->pBGQueueBattleBeginAck = clif_parse_bgqueue_battlebegin_ack; /* */ clif->pPartyTick = clif_parse_PartyTick; clif->pGuildInvite2 = clif_parse_GuildInvite2; @@ -18583,6 +18585,4 @@ void clif_defaults(void) { clif->pPartyBookingRefuseVolunteer = clif_parse_PartyBookingRefuseVolunteer; clif->pPartyBookingCancelVolunteer = clif_parse_PartyBookingCancelVolunteer; #endif - /* dull */ - clif->pDull = clif_parse_dull; } diff --git a/src/map/clif.h b/src/map/clif.h index e1744b4e8..2cf193965 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -918,6 +918,9 @@ struct clif_interface { void (*notify_time) (struct map_session_data* sd, unsigned long time); void (*user_count) (struct map_session_data* sd, int count); void (*noask_sub) (struct map_session_data *src, struct map_session_data *target, int type); + void (*bc_ready) (void); + int (*undisguise_timer) (int tid, unsigned int tick, int id, intptr_t data); + /* Hercules Channel System */ void (*chsys_create) (struct hChSysCh *channel, char *name, char *pass, unsigned char color); void (*chsys_msg) (struct hChSysCh *channel, struct map_session_data *sd, char *msg); void (*chsys_msg2) (struct hChSysCh *channel, char *msg); @@ -930,8 +933,6 @@ struct clif_interface { void (*chsys_quitg) (struct map_session_data *sd); void (*chsys_gjoin) (struct guild *g1,struct guild *g2); void (*chsys_gleave) (struct guild *g1,struct guild *g2); - void (*bc_ready) (void); - int (*undisguise_timer) (int tid, unsigned int tick, int id, intptr_t data); /*------------------------ *- Parse Incoming Packet *------------------------*/ diff --git a/src/map/homunculus.c b/src/map/homunculus.c index 9bf752ef7..5a9d7ac28 100644 --- a/src/map/homunculus.c +++ b/src/map/homunculus.c @@ -1295,4 +1295,6 @@ void homunculus_defaults(void) { homun->read_skill_db_sub = homunculus_read_skill_db_sub; homun->skill_db_read = homunculus_skill_db_read; homun->exp_db_read = homunculus_exp_db_read; + homun->addspiritball = homunculus_addspiritball; + homun->delspiritball = homunculus_delspiritball; } diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 036075e57..3c77c4b14 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -2187,13 +2187,13 @@ void itemdb_defaults(void) { itemdb->write_cached_packages = itemdb_write_cached_packages; itemdb->read_cached_packages = itemdb_read_cached_packages; /* */ + itemdb->name2id = itemdb_name2id; itemdb->search_name = itemdb_searchname; itemdb->search_name_array = itemdb_searchname_array; itemdb->load = itemdb_load; itemdb->search = itemdb_search; itemdb->parse_dbrow = itemdb_parse_dbrow; itemdb->exists = itemdb_exists;//incomplete - itemdb->name2id = itemdb_name2id; itemdb->in_group = itemdb_in_group; itemdb->group_item = itemdb_searchrandomid; itemdb->chain_item = itemdb_chain_item; diff --git a/src/map/log.c b/src/map/log.c index 79e3b87e6..daf96b930 100644 --- a/src/map/log.c +++ b/src/map/log.c @@ -513,8 +513,6 @@ void log_defaults(void) { logs->atcommand = log_atcommand; logs->branch = log_branch; logs->mvpdrop = log_mvpdrop; - logs->config_read = log_config_read; - logs->config_done = log_config_complete; /* will be modified in a few seconds once loading is complete. */ logs->pick_sub = log_pick_sub_txt; @@ -525,4 +523,7 @@ void log_defaults(void) { logs->branch_sub = log_branch_sub_txt; logs->mvpdrop_sub = log_mvpdrop_sub_txt; + logs->config_read = log_config_read; + logs->config_done = log_config_complete; + } diff --git a/src/map/map.c b/src/map/map.c index 05ba2edc2..db3bcf001 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -5583,6 +5583,23 @@ void map_defaults(void) { iMap->charid2nick = map_charid2nick; iMap->charid2sd = map_charid2sd; + iMap->map_foreachpc = map_map_foreachpc; + iMap->map_foreachmob = map_map_foreachmob; + iMap->map_foreachnpc = map_map_foreachnpc; + iMap->map_foreachregen = map_map_foreachregen; + iMap->map_foreachiddb = map_map_foreachiddb; + + iMap->foreachinrange = map_foreachinrange; + iMap->foreachinshootrange = map_foreachinshootrange; + iMap->foreachinarea = map_foreachinarea; + iMap->forcountinrange = map_forcountinrange; + iMap->forcountinarea = map_forcountinarea; + iMap->foreachinmovearea = map_foreachinmovearea; + iMap->foreachincell = map_foreachincell; + iMap->foreachinpath = map_foreachinpath; + iMap->foreachinmap = map_foreachinmap; + iMap->foreachininstance = map_foreachininstance; + iMap->id2sd = map_id2sd; iMap->id2md = map_id2md; iMap->id2nd = map_id2nd; @@ -5628,23 +5645,6 @@ void map_defaults(void) { iMap->do_shutdown = do_shutdown; - iMap->map_foreachpc = map_map_foreachpc; - iMap->map_foreachmob = map_map_foreachmob; - iMap->map_foreachnpc = map_map_foreachnpc; - iMap->map_foreachregen = map_map_foreachregen; - iMap->map_foreachiddb = map_map_foreachiddb; - - iMap->foreachinrange = map_foreachinrange; - iMap->foreachinshootrange = map_foreachinshootrange; - iMap->foreachinarea=map_foreachinarea; - iMap->forcountinrange=map_forcountinrange; - iMap->forcountinarea=map_forcountinarea; - iMap->foreachinmovearea = map_foreachinmovearea; - iMap->foreachincell=map_foreachincell; - iMap->foreachinpath=map_foreachinpath; - iMap->foreachinmap=map_foreachinmap; - iMap->foreachininstance=map_foreachininstance; - /* temporary until the map.c "Hercules Renewal Phase One" design is complete. [Ind] */ mapit = &mapit_s; diff --git a/src/map/map.h b/src/map/map.h index ec5921509..7826e00b3 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -902,7 +902,7 @@ struct map_interface { int (*addmobtolist) (unsigned short m, struct spawn_data *spawn); // [Wizputer] void (*spawnmobs) (int16 m); // [Wizputer] void (*removemobs) (int16 m); // [Wizputer] - void (*do_reconnect_map) (void); //Invoked on map-char reconnection [Skotlex] Note used but still keeping it, just in case + //void (*do_reconnect_map) (void); //Invoked on map-char reconnection [Skotlex] Note used but still keeping it, just in case void (*addmap2db) (struct map_data *m); void (*removemapdb) (struct map_data *m); void (*clean) (int i); diff --git a/src/map/pc.h b/src/map/pc.h index 58dd85083..c21258dd7 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -752,7 +752,7 @@ struct pc_interface { int (*class2idx) (int class_); int (*get_group_level) (struct map_session_data *sd); - int (*getrefinebonus) (int lv,int type); + //int (*getrefinebonus) (int lv,int type); FIXME: This function does not exist, nor it is ever called bool (*can_give_items) (struct map_session_data *sd); bool (*can_use_command) (struct map_session_data *sd, const char *command); diff --git a/src/map/script.c b/src/map/script.c index c48610d3c..4a457bd28 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -18139,8 +18139,8 @@ void script_defaults(void) { script->hqs = script->hqis = 0; memset(&script->hqe, 0, sizeof(script->hqe)); - script->buildin_count = 0; script->buildin = NULL; + script->buildin_count = 0; script->str_data = NULL; script->str_data_size = 0; @@ -18176,6 +18176,7 @@ void script_defaults(void) { script->set_constant = script_set_constant; script->set_constant2 = script_set_constant2; script->get_constant = script_get_constant; + script->label_add = script_label_add; script->queue = script_hqueue_get; script->queue_add = script_hqueue_add; @@ -18183,6 +18184,4 @@ void script_defaults(void) { script->queue_remove = script_hqueue_remove; script->queue_create = script_hqueue_create; script->queue_clear = script_hqueue_clear; - - script->label_add = script_label_add; } diff --git a/src/map/skill.c b/src/map/skill.c index 1b350f74c..0b39ff620 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -18140,6 +18140,7 @@ void skill_defaults(void) { skill->get_mhp = skill_get_mhp; skill->get_sp = skill_get_sp; skill->get_state = skill_get_state; + skill->get_spiritball = skill_get_spiritball; skill->get_zeny = skill_get_zeny; skill->get_num = skill_get_num; skill->get_cast = skill_get_cast; @@ -18162,7 +18163,6 @@ void skill_defaults(void) { skill->get_unit_target = skill_get_unit_target; skill->get_unit_interval = skill_get_unit_interval; skill->get_unit_bl_target = skill_get_unit_bl_target; - skill->get_spiritball = skill_get_spiritball; skill->get_unit_layout_type = skill_get_unit_layout_type; skill->get_unit_range = skill_get_unit_range; skill->get_cooldown = skill_get_cooldown; @@ -18202,14 +18202,13 @@ void skill_defaults(void) { skill->delay_fix = skill_delay_fix; skill->check_condition_castbegin = skill_check_condition_castbegin; skill->check_condition_castend = skill_check_condition_castend; - skill->check_condition_char_sub = skill_check_condition_char_sub; + skill->consume_requirement = skill_consume_requirement; skill->get_requirement = skill_get_requirement; skill->check_pc_partner = skill_check_pc_partner; - skill->consume_requirement = skill_consume_requirement; skill->unit_move = skill_unit_move; - skill->unit_move_unit_group = skill_unit_move_unit_group; skill->unit_onleft = skill_unit_onleft; skill->unit_onout = skill_unit_onout; + skill->unit_move_unit_group = skill_unit_move_unit_group; skill->guildaura_sub = skill_guildaura_sub; skill->sit = skill_sit; skill->brandishspear = skill_brandishspear; diff --git a/src/map/storage.c b/src/map/storage.c index e0b751863..5ebbb0dde 100644 --- a/src/map/storage.c +++ b/src/map/storage.c @@ -745,8 +745,8 @@ void storage_defaults(void) { storage->delitem = storage_delitem; storage->open = storage_storageopen; storage->add = storage_storageadd; - storage->additem = storage_additem; storage->get = storage_storageget; + storage->additem = storage_additem; storage->addfromcart = storage_storageaddfromcart; storage->gettocart = storage_storagegettocart; storage->close = storage_storageclose; -- cgit v1.2.3-70-g09d2 From 586c0f7983f81e97ca70c57712e25d4d51453d6b Mon Sep 17 00:00:00 2001 From: shennetsind Date: Thu, 18 Jul 2013 00:02:34 -0300 Subject: Fixed guild aura not going away on guild-break/expell Also modified sd->state.gmaster_flag from struct to a 'unsigned int : 1;' flag as sd->guild already stores the pointer and was thus a duplicate. Special Thanks to Haru, Xgear Signed-off-by: shennetsind --- src/map/clif.c | 12 ++++++------ src/map/guild.c | 44 ++++++++++++++++++++++++++++++++++++++------ src/map/pc.c | 12 ++++++------ src/map/pc.h | 2 +- src/map/skill.c | 21 +-------------------- src/map/skill.h | 1 - 6 files changed, 52 insertions(+), 40 deletions(-) (limited to 'src/map/clif.c') diff --git a/src/map/clif.c b/src/map/clif.c index c19c9f7f6..951969a0f 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -7379,7 +7379,7 @@ void clif_guild_belonginfo(struct map_session_data *sd, struct guild *g) WFIFOL(fd,2)=g->guild_id; WFIFOL(fd,6)=g->emblem_id; WFIFOL(fd,10)=g->position[ps].mode; - WFIFOB(fd,14)=(bool)(sd->state.gmaster_flag==g); + WFIFOB(fd,14)=(bool)(sd->state.gmaster_flag == 1); WFIFOL(fd,15)=0; // InterSID (unknown purpose) memcpy(WFIFOP(fd,19),g->name,NAME_LENGTH); WFIFOSET(fd,packet_len(0x16c)); @@ -9633,10 +9633,10 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) /* Guild Aura Init */ if( sd->state.gmaster_flag ) { - guild->aura_refresh(sd,GD_LEADERSHIP,guild->checkskill(sd->state.gmaster_flag,GD_LEADERSHIP)); - guild->aura_refresh(sd,GD_GLORYWOUNDS,guild->checkskill(sd->state.gmaster_flag,GD_GLORYWOUNDS)); - guild->aura_refresh(sd,GD_SOULCOLD,guild->checkskill(sd->state.gmaster_flag,GD_SOULCOLD)); - guild->aura_refresh(sd,GD_HAWKEYES,guild->checkskill(sd->state.gmaster_flag,GD_HAWKEYES)); + guild->aura_refresh(sd,GD_LEADERSHIP,guild->checkskill(sd->guild,GD_LEADERSHIP)); + guild->aura_refresh(sd,GD_GLORYWOUNDS,guild->checkskill(sd->guild,GD_GLORYWOUNDS)); + guild->aura_refresh(sd,GD_SOULCOLD,guild->checkskill(sd->guild,GD_SOULCOLD)); + guild->aura_refresh(sd,GD_HAWKEYES,guild->checkskill(sd->guild,GD_HAWKEYES)); } if( sd->state.vending ) { /* show we have a vending */ @@ -11408,7 +11408,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) if( skill_id >= GD_SKILLBASE ) { if( sd->state.gmaster_flag ) - skill_lv = guild->checkskill(sd->state.gmaster_flag, skill_id); + skill_lv = guild->checkskill(sd->guild, skill_id); else skill_lv = 0; } else { diff --git a/src/map/guild.c b/src/map/guild.c index 5ff0254dc..e5ea6809d 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -564,7 +564,7 @@ int guild_recv_info(struct guild *sg) { //Also set the guild master flag. sd->guild = g; - sd->state.gmaster_flag = g; + sd->state.gmaster_flag = 1; clif->charnameupdate(sd); // [LuzZza] clif->guild_masterormember(sd); } @@ -754,7 +754,7 @@ void guild_member_joined(struct map_session_data *sd) return; } if (strcmp(sd->status.name,g->master) == 0) { // set the Guild Master flag - sd->state.gmaster_flag = g; + sd->state.gmaster_flag = 1; // prevent Guild Skills from being used directly after relog if( battle_config.guild_skill_relog_delay ) guild->block_skill(sd, 300000); @@ -933,6 +933,10 @@ int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, c if( g->instances ) instance->check_kick(sd); clif->charnameupdate(sd); //Update display name [Skotlex] + status_change_end(&sd->bl, SC_LEADERSHIP, INVALID_TIMER); + status_change_end(&sd->bl, SC_GLORYWOUNDS, INVALID_TIMER); + status_change_end(&sd->bl, SC_SOULCOLD, INVALID_TIMER); + status_change_end(&sd->bl, SC_HAWKEYES, INVALID_TIMER); //TODO: send emblem update to self and people around } return 0; @@ -1756,8 +1760,13 @@ int guild_broken(int guild_id,int flag) gstorage->pc_quit(sd,1); sd->status.guild_id=0; sd->guild = NULL; + sd->state.gmaster_flag = 0; clif->guild_broken(g->member[i].sd,0); clif->charnameupdate(sd); // [LuzZza] + status_change_end(&sd->bl, SC_LEADERSHIP, INVALID_TIMER); + status_change_end(&sd->bl, SC_GLORYWOUNDS, INVALID_TIMER); + status_change_end(&sd->bl, SC_SOULCOLD, INVALID_TIMER); + status_change_end(&sd->bl, SC_HAWKEYES, INVALID_TIMER); } } @@ -1828,7 +1837,7 @@ int guild_gm_changed(int guild_id, int account_id, int char_id) if (g->member[0].sd && g->member[0].sd->fd) { clif->message(g->member[0].sd->fd, msg_txt(679)); //"You have become the Guild Master!" - g->member[0].sd->state.gmaster_flag = g; + g->member[0].sd->state.gmaster_flag = 1; //Block his skills for 5 minutes to prevent abuse. guild->block_skill(g->member[0].sd, 300000); } @@ -1849,9 +1858,9 @@ int guild_gm_changed(int guild_id, int account_id, int char_id) /*==================================================== * Guild disbanded *---------------------------------------------------*/ -int guild_break(struct map_session_data *sd,char *name) -{ +int guild_break(struct map_session_data *sd,char *name) { struct guild *g; + struct unit_data *ud; int i; nullpo_ret(sd); @@ -1872,7 +1881,30 @@ int guild_break(struct map_session_data *sd,char *name) clif->guild_broken(sd,2); return 0; } - + + /* regardless of char server allowing it, we clear the guild master's auras */ + if( (ud = unit_bl2ud(&sd->bl)) ) { + int count = 0; + struct skill_unit_group *groups[4]; + for (i=0;iskillunit[i];i++) { + switch (ud->skillunit[i]->skill_id) { + case GD_LEADERSHIP: + case GD_GLORYWOUNDS: + case GD_SOULCOLD: + case GD_HAWKEYES: + if( count == 4 ) + ShowWarning("guild_break:'%s' got more than 4 guild aura instances! (%d)\n",sd->status.name,ud->skillunit[i]->skill_id); + else + groups[count++] = ud->skillunit[i]; + break; + } + + } + for(i = 0; i < count; i++) { + skill->del_unitgroup(groups[i],ALC_MARK); + } + } + intif_guild_break(g->guild_id); return 1; } diff --git a/src/map/pc.c b/src/map/pc.c index 84cfe7eb3..5a8b77cd3 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -6987,10 +6987,10 @@ void pc_revive(struct map_session_data *sd,unsigned int hp, unsigned int sp) { pc->setinvincibletimer(sd, battle_config.pc_invincible_time); if( sd->state.gmaster_flag ) { - guild->aura_refresh(sd,GD_LEADERSHIP,guild->checkskill(sd->state.gmaster_flag,GD_LEADERSHIP)); - guild->aura_refresh(sd,GD_GLORYWOUNDS,guild->checkskill(sd->state.gmaster_flag,GD_GLORYWOUNDS)); - guild->aura_refresh(sd,GD_SOULCOLD,guild->checkskill(sd->state.gmaster_flag,GD_SOULCOLD)); - guild->aura_refresh(sd,GD_HAWKEYES,guild->checkskill(sd->state.gmaster_flag,GD_HAWKEYES)); + guild->aura_refresh(sd,GD_LEADERSHIP,guild->checkskill(sd->guild,GD_LEADERSHIP)); + guild->aura_refresh(sd,GD_GLORYWOUNDS,guild->checkskill(sd->guild,GD_GLORYWOUNDS)); + guild->aura_refresh(sd,GD_SOULCOLD,guild->checkskill(sd->guild,GD_SOULCOLD)); + guild->aura_refresh(sd,GD_HAWKEYES,guild->checkskill(sd->guild,GD_HAWKEYES)); } } // script @@ -8933,12 +8933,12 @@ int pc_checkitem(struct map_session_data *sd) } if (sd->state.gmaster_flag) { - struct guild_storage *guild_storage = gstorage->id2storage2(sd->state.gmaster_flag->guild_id); + struct guild_storage *guild_storage = gstorage->id2storage2(sd->guild->guild_id); if (guild_storage) { for( i = 0; i < MAX_GUILD_STORAGE; i++ ) { id = guild_storage->items[i].nameid; if( id && !itemdb_available(id) ) { - ShowWarning("Removed invalid/disabled item id %d from guild storage (amount=%d, char_id=%d, guild_id=%d).\n", id, guild_storage->items[i].amount, sd->status.char_id, sd->state.gmaster_flag->guild_id); + ShowWarning("Removed invalid/disabled item id %d from guild storage (amount=%d, char_id=%d, guild_id=%d).\n", id, guild_storage->items[i].amount, sd->status.char_id, sd->guild->guild_id); gstorage->delitem(sd, guild_storage, i, guild_storage->items[i].amount); gstorage->close(sd); // force closing } diff --git a/src/map/pc.h b/src/map/pc.h index c21258dd7..a69c77efe 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -158,7 +158,7 @@ struct map_session_data { unsigned short autolootid[AUTOLOOTITEM_SIZE]; // [Zephyrus] unsigned int autolooting : 1; //performance-saver, autolooting state for @alootid unsigned short autobonus; //flag to indicate if an autobonus is activated. [Inkfish] - struct guild *gmaster_flag; + unsigned int gmaster_flag : 1; unsigned int prevend : 1;//used to flag wheather you've spent 40sp to open the vending or not. unsigned int warping : 1;//states whether you're in the middle of a warp processing unsigned int permanent_speed : 1; // When 1, speed cannot be changed through status_calc_pc(). diff --git a/src/map/skill.c b/src/map/skill.c index 0b39ff620..f27a42ac9 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -2954,24 +2954,6 @@ int skill_check_unit_range2 (struct block_list *bl, int x, int y, uint16 skill_i type, skill_id); } -int skill_guildaura_sub (struct map_session_data* sd, int id, int strvit, int agidex) -{ - if(id == sd->bl.id && battle_config.guild_aura&16) - return 0; // Do not affect guild leader - - if (sd->sc.data[SC_GUILDAURA]) { - struct status_change_entry *sce = sd->sc.data[SC_GUILDAURA]; - if( sce->val3 != strvit || sce->val4 != agidex ) { - sce->val3 = strvit; - sce->val4 = agidex; - status_calc_bl(&sd->bl, iStatus->sc2scb_flag(SC_GUILDAURA)); - } - return 0; - } - sc_start4(&sd->bl, SC_GUILDAURA,100, 1, id, strvit, agidex, 1000); - return 1; -} - /*========================================== * Checks that you have the requirements for casting a skill for homunculus/mercenary. * Flag: @@ -7521,7 +7503,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui int j = 0; struct guild *g; // i don't know if it actually summons in a circle, but oh well. ;P - g = sd?sd->state.gmaster_flag:guild->search(iStatus->get_guild_id(src)); + g = sd ? sd->guild : guild->search(iStatus->get_guild_id(src)); if (!g) break; clif->skill_nodamage(src,bl,skill_id,skill_lv,1); @@ -18209,7 +18191,6 @@ void skill_defaults(void) { skill->unit_onleft = skill_unit_onleft; skill->unit_onout = skill_unit_onout; skill->unit_move_unit_group = skill_unit_move_unit_group; - skill->guildaura_sub = skill_guildaura_sub; skill->sit = skill_sit; skill->brandishspear = skill_brandishspear; skill->repairweapon = skill_repairweapon; diff --git a/src/map/skill.h b/src/map/skill.h index 1ca5f235a..f9dbd0f1a 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -1842,7 +1842,6 @@ struct skill_interface { int (*unit_onleft) (uint16 skill_id, struct block_list *bl,unsigned int tick); int (*unit_onout) (struct skill_unit *src, struct block_list *bl, unsigned int tick); int (*unit_move_unit_group) ( struct skill_unit_group *group, int16 m,int16 dx,int16 dy); - int (*guildaura_sub) (struct map_session_data* sd, int id, int strvit, int agidex); int (*sit) (struct map_session_data *sd, int type); void (*brandishspear) (struct block_list* src, struct block_list* bl, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag); void (*repairweapon) (struct map_session_data *sd, int idx); -- cgit v1.2.3-70-g09d2