/*========================================== * 取引要請 *------------------------------------------ */ void trade_tradeack(dumb_ptr<map_session_data> sd, int type) { dumb_ptr<map_session_data> target_sd; nullpo_retv(sd); if ((target_sd = map_id2sd(account_to_block(sd->trade_partner))) != nullptr) { clif_tradestart(target_sd, type); clif_tradestart(sd, type); if (type == 4) { // Cancel sd->deal_locked = 0; sd->trade_partner = AccountId(); target_sd->deal_locked = 0; target_sd->trade_partner = AccountId(); } if (sd->npc_id) npc_event_dequeue(sd); if (target_sd->npc_id) npc_event_dequeue(target_sd); //close STORAGE window if it's open. It protects from spooffing packets [Lupus] if (sd->state.storage_open) storage_storageclose(sd); } }
/*========================================== * ギルド倉庫を開く *------------------------------------------ */ int storage_guild_storageopen(struct map_session_data *sd) { struct guild_storage *gstor; int gmlvl = 0; nullpo_retr(0, sd); if(sd->status.guild_id <= 0) return 2; if(sd->state.storage_flag == 2) return 3; // 既にギルド倉庫を開いている gmlvl = pc_isGM(sd); if(gmlvl > 0 && battle_config.gm_can_drop_lv > gmlvl) return 2; // 設定しているGMレベルより低い if(sd->state.storage_flag == 1) storage_storageclose(sd); // カプラ倉庫をすでに開いている場合閉じる if((gstor = (struct guild_storage *)numdb_search(guild_storage_db,sd->status.guild_id)) != NULL) { gstor->storage_status = 1; sd->state.storage_flag = 2; clif_guildstorageitemlist(sd,gstor); clif_guildstorageequiplist(sd,gstor); clif_updateguildstorageamount(sd,gstor); } else { intif_request_guild_storage(sd->status.account_id,sd->status.guild_id); } return 0; }
/*========================================== * 取引要請 *------------------------------------------ */ void trade_tradeack(struct map_session_data *sd, int type) { struct map_session_data *target_sd; nullpo_retv(sd); if ((target_sd = map_id2sd(sd->trade_partner)) != NULL) { clif_tradestart(target_sd, type); clif_tradestart(sd, type); if (type == 4) { // Cancel sd->state.deal_locked = 0; sd->trade_partner = 0; target_sd->state.deal_locked = 0; target_sd->trade_partner = 0; } if (type == 3) { //Initiate trade sd->state.trading = 1; target_sd->state.trading = 1; memset(&sd->deal, 0, sizeof(sd->deal)); memset(&target_sd->deal, 0, sizeof(target_sd->deal)); } if (sd->npc_id != 0) npc_event_dequeue(sd); if (target_sd->npc_id != 0) npc_event_dequeue(target_sd); //close STORAGE window if it's open. It protects from spooffing packets [Lupus] if (sd->state.storage_flag == 1) storage_storageclose(sd); else if (sd->state.storage_flag == 2) storage_guild_storageclose(sd); } }
/*========================================== * ギルド倉庫データの受信 *------------------------------------------ */ int storage_guild_storageload(int account_id, int guild_id, struct guild_storage *s) { struct map_session_data *sd; struct guild_storage *gstor; nullpo_retr(1, s); if(guild_id <= 0) return 0; sd = map_id2sd(account_id); if(sd == NULL || sd->state.waitingdisconnect) { if(battle_config.error_log && sd == NULL) printf("storage_guild_storageload: user not found %d\n", account_id); intif_unlock_guild_storage(guild_id); return 1; } // 既に倉庫を開いてないかチェック if(sd->state.storage_flag == 2) return 0; if(sd->state.storage_flag == 1) storage_storageclose(sd); gstor = guild2storage(guild_id); if(!gstor) { if(battle_config.error_log) printf("storage_guild_storageload: error guild_id %d not exist\n", guild_id); return 1; } if(battle_config.save_log) printf("guild_storageload: %d\n", account_id); memcpy(gstor, s, sizeof(struct guild_storage)); storage_sortitem(gstor->store_item, MAX_GUILD_STORAGE, &gstor->sortkey, battle_config.guild_storage_sort); gstor->storage_status = 1; sd->state.storage_flag = 2; clif_guildstorageitemlist(sd,gstor); clif_guildstorageequiplist(sd,gstor); clif_updateguildstorageamount(sd,gstor); return 0; }