From 4fdf699da7e0f80e4d66fb54a9aa5783fba9b6ff Mon Sep 17 00:00:00 2001 From: skotlex Date: Mon, 30 Jan 2006 16:19:31 +0000 Subject: - Autoloot now uses the item's base drop chance rather than final drop rate to determine if it should autoloot the item or not. - Fixed super novices getting +10 to all stats temporarily whentheir death count isn't zero. - Fixed Kahai displaying HP-SP as the total healed instead of HP - Cleaned up skill_repairweapon to prevent crashes when the target vanishes/changes/whatever before the weapon to repair has been selected. - Parsing the Storage/Guild Storage from the char server will now fail if the storage has been modified and not saved yet. - Being hit now cancels confuse. - Added back the bleeding icon. - Fixed Combo Finish Soul Linked Effect being a 11x11 area o.O git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5121 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 14 +++++++++ src/map/clif.c | 2 +- src/map/intif.c | 89 +++++++++++++++++++++++++++++++---------------------- src/map/map.h | 2 +- src/map/mob.c | 14 ++++----- src/map/pc.c | 8 +++-- src/map/skill.c | 52 ++++++++++++++++--------------- src/map/status.c | 1 + 8 files changed, 109 insertions(+), 73 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 653517770..67bc71080 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -5,6 +5,20 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. EV GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS 2006/01/30 + * Autoloot now uses the item's base drop chance rather than final drop rate + to determine if it should autoloot the item or not. [Skotlex] + * Fixed super novices getting +10 to all stats temporarily when their death + count isn't zero. [Skotlex] + * Fixed Kahai displaying HP-SP as the total healed instead of HP [Skotlex] + * Cleaned up skill_repairweapon to prevent crashes when the target + vanishes/changes/whatever before the weapon to repair has been selected. + [Skotlex] + * Parsing the Storage/Guild Storage from the char server will now fail if the + storage has been modified and not saved yet. [Skotlex] + * Being hit now cancels confuse. [Skotlex] + * Added back the bleeding icon. [Skotlex] + * Fixed Combo Finish Soul Linked Effect being a 11x11 area rather than 5x5 + [Skotlex] * Added 'restricted' mapflag, based on lordalfa patch [Komurka] - you can set restriction zone on map (see mapflag/restricted.txt) - you can turn off item usage on certain restricted map in item_noequip.txt diff --git a/src/map/clif.c b/src/map/clif.c index 77e50d0d6..d8195fb0a 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -5946,7 +5946,7 @@ int clif_item_repair_list(struct map_session_data *sd,struct map_session_data *d WFIFOW(fd,2)=c*13+4; WFIFOSET(fd,WFIFOW(fd,2)); sd->state.produce_flag = 1; - sd->repair_target=dstsd; + sd->repair_target=dstsd->bl.id; }else clif_skill_fail(sd,sd->skillid,0,0); diff --git a/src/map/intif.c b/src/map/intif.c index 6b53d5c0d..0046d0c0c 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -902,24 +902,29 @@ int intif_parse_LoadStorage(int fd) { struct storage *stor; struct map_session_data *sd; RFIFOHEAD(fd); - + + sd=map_id2sd( RFIFOL(fd,4) ); + if(sd==NULL){ + if(battle_config.error_log) + ShowError("intif_parse_LoadStorage: user not found %d\n",RFIFOL(fd,4)); + return 1; + } + stor = account2storage( RFIFOL(fd,4)); if (stor->storage_status == 1) { // Already open.. lets ignore this update if (battle_config.error_log) - ShowWarning("intif_parse_LoadStorage: storage received for a client already open\n"); - return 0; + ShowWarning("intif_parse_LoadStorage: storage received for a client already open (User %d:%d)\n", sd->status.account_id, sd->status.char_id); + return 1; } - - if (RFIFOW(fd,2)-8 != sizeof(struct storage)) { + if (stor->dirty) { // Already have storage, and it has been modified and not saved yet! Exploit! [Skotlex] if (battle_config.error_log) - ShowError("intif_parse_LoadStorage: data size error %d %d\n", RFIFOW(fd,2)-8, sizeof(struct storage)); + ShowWarning("intif_parse_LoadStorage: received storage for an already modified non-saved storage! (User %d:%d)\n", sd->status.account_id, sd->status.char_id); return 1; } - sd=map_id2sd( RFIFOL(fd,4) ); - if(sd==NULL){ - if(battle_config.error_log) - ShowError("intif_parse_LoadStorage: user not found %d\n",RFIFOL(fd,4)); + if (RFIFOW(fd,2)-8 != sizeof(struct storage)) { + if (battle_config.error_log) + ShowError("intif_parse_LoadStorage: data size error %d %d\n", RFIFOW(fd,2)-8, sizeof(struct storage)); return 1; } if(battle_config.save_log) @@ -952,34 +957,44 @@ int intif_parse_LoadGuildStorage(int fd) int guild_id; RFIFOHEAD(fd); guild_id = RFIFOL(fd,8); - if(guild_id > 0) { - gstor=guild2storage(guild_id); - if(!gstor) { - if(battle_config.error_log) - ShowWarning("intif_parse_LoadGuildStorage: error guild_id %d not exist\n",guild_id); - return 1; - } - if( RFIFOW(fd,2)-12 != sizeof(struct guild_storage) ){ - gstor->storage_status = 0; - if(battle_config.error_log) - ShowError("intif_parse_LoadGuildStorage: data size error %d %d\n",RFIFOW(fd,2)-12 , sizeof(struct guild_storage)); - return 1; - } - sd=map_id2sd( RFIFOL(fd,4) ); - if(sd==NULL){ - if(battle_config.error_log) - ShowError("intif_parse_LoadGuildStorage: user not found %d\n",RFIFOL(fd,4)); - return 1; - } - if(battle_config.save_log) - ShowInfo("intif_open_guild_storage: %d\n",RFIFOL(fd,4) ); - memcpy(gstor,RFIFOP(fd,12),sizeof(struct guild_storage)); - gstor->storage_status = 1; - sd->state.storage_flag = 2; - clif_guildstorageitemlist(sd,gstor); - clif_guildstorageequiplist(sd,gstor); - clif_updateguildstorageamount(sd,gstor); + if(guild_id <= 0) + return 1; + sd=map_id2sd( RFIFOL(fd,4) ); + if(sd==NULL){ + if(battle_config.error_log) + ShowError("intif_parse_LoadGuildStorage: user not found %d\n",RFIFOL(fd,4)); + return 1; + } + gstor=guild2storage(guild_id); + if(!gstor) { + if(battle_config.error_log) + ShowWarning("intif_parse_LoadGuildStorage: error guild_id %d not exist\n",guild_id); + return 1; } + if (gstor->storage_status == 1) { // Already open.. lets ignore this update + if (battle_config.error_log) + ShowWarning("intif_parse_LoadGuildStorage: storage received for a client already open (User %d:%d)\n", sd->status.account_id, sd->status.char_id); + return 1; + } + if (gstor->dirty) { // Already have storage, and it has been modified and not saved yet! Exploit! [Skotlex] + if (battle_config.error_log) + ShowWarning("intif_parse_LoadGuildStorage: received storage for an already modified non-saved storage! (User %d:%d)\n", sd->status.account_id, sd->status.char_id); + return 1; + } + if( RFIFOW(fd,2)-12 != sizeof(struct guild_storage) ){ + gstor->storage_status = 0; + if(battle_config.error_log) + ShowError("intif_parse_LoadGuildStorage: data size error %d %d\n",RFIFOW(fd,2)-12 , sizeof(struct guild_storage)); + return 1; + } + if(battle_config.save_log) + ShowInfo("intif_open_guild_storage: %d\n",RFIFOL(fd,4) ); + memcpy(gstor,RFIFOP(fd,12),sizeof(struct guild_storage)); + gstor->storage_status = 1; + sd->state.storage_flag = 2; + clif_guildstorageitemlist(sd,gstor); + clif_guildstorageequiplist(sd,gstor); + clif_updateguildstorageamount(sd,gstor); return 0; } int intif_parse_SaveGuildStorage(int fd) diff --git a/src/map/map.h b/src/map/map.h index 3f7226eba..28a1748d6 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -516,7 +516,7 @@ struct map_session_data { //unsigned int skillstatictimer[MAX_SKILL]; unsigned short timerskill_count; // [celest] int cloneskill_id; - struct map_session_data *repair_target; + int repair_target; int invincible_timer; unsigned int canact_tick; diff --git a/src/map/mob.c b/src/map/mob.c index 3fc896391..cf7791127 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -2209,12 +2209,11 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) return 0; } -/* The stop walking code is triggered in battle_walkdelay which is invoked from clif_damage after a timer. - * So the mob should stop walking in sync with the time the "attack" hits the mob. If this is bugged then the - * fault must be looked at in battle_walkdelay, not here. [Skotlex] - if(md->sc_data[SC_ENDURE].timer == -1) // Stop the walking [Lance] - mob_stop_walking(md,1); -*/ + if(md->sc_count) { + if(md->sc_data[SC_CONFUSION].timer != -1) + status_change_end(&md->bl, SC_CONFUSION, -1); + } + if(damage > max_hp>>2) skill_stop_dancing(&md->bl); @@ -2590,7 +2589,8 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) intif_GMmessage(message,strlen(message)+1,0); } // Announce first, or else ditem will be freed. [Lance] - mob_item_drop(md, tick+base_drop_delay+i, ditem, 0, drop_rate); + // By popular demand, use base drop rate for autoloot code. [Skotlex] + mob_item_drop(md, tick+base_drop_delay+i, ditem, 0, md->db->dropitem[i].p); } // Ore Discovery [Celest] diff --git a/src/map/pc.c b/src/map/pc.c index adc090e87..afafbe4c8 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -818,6 +818,8 @@ int pc_authok(struct map_session_data *sd, int login_id2, time_t connect_until_t // Notify everyone that this char logged in [Skotlex]. clif_foreachclient(clif_friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 1); + //Prevent S. Novices from getting the no-death bonus just yet. [Skotlex] + sd->die_counter=-1; sd->feel_level=-1; //Until the reg values arrive, set them to not require trigger... sd->state.event_death = 1; @@ -906,7 +908,8 @@ int pc_reg_received(struct map_session_data *sd) sd->change_level = pc_readglobalreg(sd,"jobchange_level"); sd->die_counter = pc_readglobalreg(sd,"PC_DIE_COUNTER"); - + if (!sd->die_counter && (sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE) + status_calc_pc(sd, 0); //Check +10 to all stats bonus. if (pc_checkskill(sd, TK_MISSION)) { sd->mission_mobid = pc_readglobalreg(sd,"TK_MISSION_ID"); sd->mission_count = pc_readglobalreg(sd,"TK_MISSION_COUNT"); @@ -5328,7 +5331,8 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage) status_change_end(&sd->bl, SC_GRAVITATION, -1); } } - + if (sd->sc_data[SC_CONFUSION].timer != -1) + status_change_end(&sd->bl, SC_CONFUSION, -1); } // 演奏/ダンスの中? diff --git a/src/map/skill.c b/src/map/skill.c index b7426beff..c6d627582 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -902,9 +902,9 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int if (dstsd && dstsd->status.sp < 5*tsc_data[SC_KAAHI].val1) ; //Not enough SP to cast else { - rate = battle_heal(bl, bl, 200*tsc_data[SC_KAAHI].val1, -5*tsc_data[SC_KAAHI].val1, 1); + battle_heal(bl, bl, 200*tsc_data[SC_KAAHI].val1, -5*tsc_data[SC_KAAHI].val1, 1); if(dstsd && dstsd->fd) - clif_heal(dstsd->fd,SP_HP,rate); + clif_heal(dstsd->fd,SP_HP,200*tsc_data[SC_KAAHI].val1); } } } @@ -2732,7 +2732,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl,int s if (!(flag&1) && sc_data && sc_data[SC_SPIRIT].timer != -1 && sc_data[SC_SPIRIT].val2 == SL_MONK) { //Becomes a splash attack when Soul Linked. map_foreachinarea(skill_area_sub, - bl->m,bl->x-5,bl->y-5,bl->x+5,bl->y+5,BL_CHAR, + bl->m,bl->x-2,bl->y-2,bl->x+2,bl->y+2,BL_CHAR, src,skillid,skilllv,tick, flag|BCT_ENEMY|1, skill_castend_damage_id); } else @@ -9365,39 +9365,41 @@ void skill_repairweapon(struct map_session_data *sd, int idx) int material; int materials[4] = { 1002, 998, 999, 756 }; struct item *item; + struct map_session_data *target_sd; nullpo_retv(sd); - nullpo_retv(sd->repair_target); - + target_sd = map_id2sd(sd->repair_target); + sd->repair_target = 0; + if (!target_sd) //Failed.... + return; if(idx==0xFFFF) // No item selected ('Cancel' clicked) return; + if(idx < 0 || idx >= MAX_INVENTORY) + return; //Invalid index?? - item = &sd->repair_target->status.inventory[idx]; + item = &target_sd->status.inventory[idx]; + if(item->nameid <= 0 || item->attribute == 0) + return; //Again invalid item.... - if(sd!=sd->repair_target && !battle_check_range(&sd->bl,&sd->repair_target->bl,skill_get_range2(&sd->bl, sd->skillid,sd->skilllv))){ + if(sd!=target_sd && !battle_check_range(&sd->bl,&target_sd->bl,skill_get_range2(&sd->bl, sd->skillid,sd->skilllv))){ clif_item_repaireffect(sd,item->nameid,1); return; } - if(idx >= 0 && idx < MAX_INVENTORY) { - if(item->nameid > 0 && item->attribute == 1 ) { - if (itemdb_type(item->nameid)==4) - material = materials [itemdb_wlv(item->nameid)-1]; // Lv1/2/3/4 weapons consume 1 Iron Ore/Iron/Steel/Rough Oridecon - else - material = materials [2]; // Armors consume 1 Steel - if (pc_search_inventory(sd,material) < 0 ) { - clif_skill_fail(sd,sd->skillid,0,0); - return; - } - item->attribute=0; - clif_equiplist(sd->repair_target); - pc_delitem(sd,pc_search_inventory(sd,material),1,0); - clif_item_repaireffect(sd,item->nameid,0); - if(sd!=sd->repair_target) - clif_item_repaireffect(sd->repair_target,item->nameid,0); - sd->repair_target=NULL; - } + if (itemdb_type(item->nameid)==4) + material = materials [itemdb_wlv(item->nameid)-1]; // Lv1/2/3/4 weapons consume 1 Iron Ore/Iron/Steel/Rough Oridecon + else + material = materials [2]; // Armors consume 1 Steel + if (pc_search_inventory(sd,material) < 0 ) { + clif_skill_fail(sd,sd->skillid,0,0); + return; } + item->attribute=0; + clif_equiplist(target_sd); + pc_delitem(sd,pc_search_inventory(sd,material),1,0); + clif_item_repaireffect(sd,item->nameid,0); + if(sd!=target_sd) + clif_item_repaireffect(target_sd,item->nameid,0); } /*========================================== diff --git a/src/map/status.c b/src/map/status.c index 28896aceb..53e6009e9 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -570,6 +570,7 @@ void initStatusIconChangeTable(void) { StatusIconChangeTable[SC_REJECTSWORD] = SI_REJECTSWORD; StatusIconChangeTable[SC_MARIONETTE] = SI_MARIONETTE; StatusIconChangeTable[SC_MARIONETTE2] = SI_MARIONETTE2; + StatusIconChangeTable[SC_BLEEDING] = SI_BLEEDING; StatusIconChangeTable[SC_MOONLIT] = SI_MOONLIT; StatusIconChangeTable[SC_DEVOTION] = SI_DEVOTION; StatusIconChangeTable[SC_STEELBODY] = SI_STEELBODY; -- cgit v1.2.3-70-g09d2