diff --git a/db/pre-re/item_combo_db.txt b/db/pre-re/item_combo_db.txt index 56b8cbd036..7f8e623ce4 100644 --- a/db/pre-re/item_combo_db.txt +++ b/db/pre-re/item_combo_db.txt @@ -136,7 +136,7 @@ 4127:4166,{ bonus2 bAddEffWhenHit,Eff_Curse,600; } 4153:4247:4273,{ bonus3 bAddMonsterDropItem,544,RC_Fish,3000; bonus2 bAddEle,Ele_Water,30; } 4168:4169,{ bonus bMaxHPrate,20; bonus bMaxSPrate,20; bonus bCastrate,-10; } -4172:4210:4230:4257:4272,{ bonus bAgi,5; bonus bStr,5; bonus bAspdRate,5; bonus bSpeedRate,25; bonus bHPDrainValue,1; if(BaseClass==Job_Thief) bonus bNoGemStone,0; } +4172:4210:4230:4257:4272,{ bonus bAgi,5; bonus bStr,5; bonus bAspdRate,5; bonus bSpeedRate,25; bonus bSPDrainValue,1; if(BaseClass==Job_Thief) bonus bNoGemStone,0; } 4178:4199:4234:4252:4297,{ bonus bAgi,5; bonus bDex,3; bonus bLongAtkRate,20; bonus bPerfectHitAddRate,20; if(BaseClass==Job_Archer) { bonus2 bExpAddRace,RC_Brute,5; bonus2 bComaRace,RC_Brute,100; } } 4178:4234:4252:4297:4381,{ bonus bDex,5; bonus2 bSkillAtk,"CG_ARROWVULCAN",5; bonus2 bSkillAtk,"DC_THROWARROW",10; bonus2 bSkillAtk,"BA_MUSICALSTRIKE",10; if(BaseJob==Job_Bard||BaseJob==Job_Dancer) bonus3 bAutoSpellWhenHit,"CG_TAROTCARD",2,50; } 4185:4217:4280:4293:4312,{ bonus bVit,10; bonus bCastrate,-10; bonus bUseSPRate,-10; if(BaseClass==Job_Acolyte) { bonus2 bExpAddRace,RC_Undead,5; bonus2 bExpAddRace,RC_Demon,5; bonus2 bSubRace,RC_Undead,30; bonus2 bSubRace,RC_Demon,30; } } diff --git a/db/pre-re/skill_db.txt b/db/pre-re/skill_db.txt index 0a10403887..9f47cae951 100644 --- a/db/pre-re/skill_db.txt +++ b/db/pre-re/skill_db.txt @@ -176,7 +176,7 @@ //**** // Wizard 80,9,8,2,3,0x20,1:1:1:1:1:2:2:2:2:2:2,10,-3:-4:-5:-6:-7:-8:-9:-10:-11:-12:-12,yes,0,0x2080,5,magic,0,0x0, WZ_FIREPILLAR,Fire Pillar -81,0,6,4,3,0,7,10,1,yes,0,0x42000,0,magic,5,0x20, WZ_SIGHTRASHER,Sightrasher +81,0,6,4,3,0x2,7,10,1,yes,0,0x42000,0,magic,5,0x20, WZ_SIGHTRASHER,Sightrasher 83,9,8,2,3,0,3:3:3:3:3:3:3:3:3:3:14,10,1:1:2:2:3:3:4:4:5:5:15,yes,0,0x2000,0,magic,0,0x20, WZ_METEOR,Meteor Storm 84,9,8,1,4,0,0,10,3:4:5:6:7:8:9:10:11:12,yes,0,0x2000,0,magic,2:3:3:4:4:5:5:6:6:7,0x20, WZ_JUPITEL,Jupitel Thunder 85,9,8,2,4,0,0,10,-10,yes,0,0x2000,0,magic,0,0x20, WZ_VERMILION,Lord of Vermilion diff --git a/db/re/item_combo_db.txt b/db/re/item_combo_db.txt index a04f406a47..a714e2293d 100644 --- a/db/re/item_combo_db.txt +++ b/db/re/item_combo_db.txt @@ -352,6 +352,7 @@ 19021:2160,{ bonus2 bSubSize,Size_Large,5+(getequiprefinerycnt(EQI_HAND_L)*2); } 19021:1387,{ bonus2 bSkillAtk,"WS_CARTTERMINATION",15+(getequiprefinerycnt(EQI_HAND_R))*5; } 19021:1490,{ bonus2 bSkillAtk,"LK_SPIRALPIERCE",getequiprefinerycnt(EQI_HAND_R)*5; .@lv = getskilllv("LK_SPIRALPIERCE"); bonus4 bAutoSpellOnSkill,"LK_JOINTBEAT","LK_SPIRALPIERCE",(.@lv ? .@lv : 1),50+(getskilllv("LK_JOINTBEAT")*10); /* Confirm: Success rate */ } +19024:5170,{ .@r = getequiprefinerycnt(EQI_HEAD_TOP); if (.@r >= 7) bonus bAspdRate,5; if (.@r >= 9) bonus bMaxHPRate,5; } 19026:15138,{ bonus2 bSubRace,RC_Fish,(10+getequiprefinerycnt(EQI_ARMOR)); bonus bUnbreakableArmor,1; } 19026:20756,{ .@r = getequiprefinerycnt(EQI_GARMENT); bonus2 bSPGainRace,RC_Fish,10; bonus3 bAddMonsterDropItem,551,RC_Fish,(5+.@r); bonus2 bAddItemHealRate,551,5; bonus bHPrecovRate,(5+.@r); } 19026:20756:22059:15138,{ bonus bMaxHP,1000; bonus bMaxSP,100; bonus2 bExpAddRace,RC_Fish,20; bonus2 bMagicAddRace,RC_Fish,50; bonus2 bSubEle,Ele_Water,50; } diff --git a/db/re/item_db.txt b/db/re/item_db.txt index 0eacd3ac95..20324f5b74 100644 --- a/db/re/item_db.txt +++ b/db/re/item_db.txt @@ -8999,6 +8999,7 @@ 17572,Erzulie_Lucky_Egg,Erzulie Lucky Egg,18,0,,10,,,,0,,,,,,,,,{/*TODO*/},{},{} 17584,Venus_Lucky_Egg,Venus Lucky Egg,18,0,,10,,,,0,,,,,,,,,{/*TODO*/},{},{} 17588,Amora_Lucky_Egg,Amora Lucky Egg,18,0,,10,,,,0,,,,,,,,,{/*TODO*/},{},{} +17598,Sograt_Lucky_Scroll,Sograt Lucky Scroll,18,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ getitem callfunc("F_Rand",20099,19024,2899,19910),1; /* and others. */ },{},{} // Mechanic/Genetic Cannonballs 18000,Cannon_Ball,Cannon Ball,10,100,,10,100,,,,0x00040400,56,2,32768,,99,,8,{},{},{} 18001,Holy_Cannon_Ball,Holy Cannon Ball,10,200,,10,120,,,,0x00040400,56,2,32768,,99,,8,{ bonus bAtkEle,Ele_Holy; },{},{} @@ -9109,7 +9110,7 @@ 18572,Korean_Judge_Hat,Korean Judge Hat,4,20,,300,,2,,1,0xFFFFFFFF,63,2,256,,0,1,377,{ bonus bMdef,2; bonus bVariableCastrate,-6; bonus bAspdRate,6; .@r = getrefine(); if(.@r>6){ bonus2 bSubRace,RC_DemiHuman,2;bonus2 bSubRace,RC_Player,2; } if(BaseClass==Job_Swordman || BaseClass==Job_Merchant || BaseClass==Job_Thief || Class==Job_Taekwon || Class==Job_Star_Gladiator || Class==Job_Star_Gladiator2 || Class==Job_Monk || Class==Job_Champion || Class==Job_Sura || Class==Job_Sura_T) bonus2 bAddClass,Class_All,(.@r/2);if(BaseClass==Job_Mage || BaseClass==Job_Acolyte || Class==Job_Ninja || Class==Job_Soul_Linker) bonus bMatkRate,(.@r/2); if(BaseClass==Job_Archer || Class==Job_Gunslinger) bonus bBaseAtk,.@r; },{},{} 18573,White_Feather,White Feather,4,20,,500,,2,,1,0xFFFFFFFF,63,2,256,,30,1,741,{ .@r = getrefine(); if(.@r<5){ bonus bHit,20;bonus bMaxHPrate,-10; } else if(.@r<7){ bonus bHit,10; } else if(.@r<9){ bonus bHit,7;bonus bMaxHPrate,3; } else { bonus bHit,4;bonus bMaxHPrate,4; } },{},{} 18574,Lord_of_Death,Lord of Death,4,20,,1000,,10,,1,0xFFFFFFFF,63,2,256,,70,1,742,{ bonus bMdef,5; .@r = getrefine(); bonus2 bAddClass,Class_Normal,(10+((.@r>4)?.@r-4:0)); bonus2 bSubClass,Class_Normal,-5; },{},{} -18575,YinYang_Earring,Wunderkammer,4,20,,500,,10,,1,0xFFFFFFFF,63,2,769,,20,0,743,{ bonus bMdef,10; bonus2 bSkillAtk,"MO_CHAINCOMBO",10; bonus2 bSkillAtk,"MO_TRIPLEATTACK",5; bonus2 bSkillAtk,"MO_COMBOFINISH",5; bonus2 bSkillUseSP,"MO_CHAINCOMBO",1; bonus2 bSkillUseSP,"MO_COMBOFINISH",1; },{},{} +18575,Wunderkammer,Wunderkammer,4,20,,500,,10,,1,0xFFFFFFFF,63,2,769,,20,0,743,{ bonus bMdef,10; },{},{} 18576,YinYang_Earring,YinYang Earring,4,20,,100,,0,,0,0xFFFFFFFF,63,2,512,,50,0,744,{ bonus2 bSkillAtk,"MO_CHAINCOMBO",10; bonus2 bSkillAtk,"MO_TRIPLEATTACK",5; bonus2 bSkillAtk,"MO_COMBOFINISH",5; bonus2 bSkillUseSP,"MO_CHAINCOMBO",1; bonus2 bSkillUseSP,"MO_COMBOFINISH",1; },{},{} 18577,24_Bolt,24 Bolt,4,20,,200,,0,,0,0xFFFFFFFF,63,2,512,,10,0,696,{},{},{} 18578,Helm_Of_Valor,Helm Of Valor,4,0,,0,,4,,0,0xFFFFFFFF,63,2,256,,0,0,258,{ bonus2 bAddRace,RC_All,3; },{},{} @@ -9403,6 +9404,7 @@ 19019,Elemental_Crown,Elemental Crown,4,0,,500,,10,,1,0xFFFFFFFF,63,2,256,,,1,1219,{ .@r = getrefine(); bonus bDex,(3 + (.@r/2)+ (readparam(bDex) > 130 ? .@r : 0)); bonus bLongAtkRate,4; },{},{} 19020,Survive_Circlet,Survive Circlet,4,0,,500,,10,,1,0xFFFFFFFF,63,2,256,,,1,1220,{ .@r = getrefine(); bonus bInt,(3 + (.@r/2)+ (BaseLevel > 130 ? .@r : 0)); bonus bMatkRate,4; },{},{} 19021,Gigant_Helm,Gigant Helm,4,0,,500,,10,,1,0xFFFFFFFF,63,2,256,,,1,1221,{ bonus bStr,3+((BaseLevel > 130) ? getrefine() : 0); bonus bAtkRate,4; },{},{} +19024,Protect_Feathers,Protect Feathers,4,0,,500,,,,0,0xFFFFFFFF,63,2,512,1,70,1,1232,{ bonus2 bSubRace,RC_DemiHuman,2; bonus2 bSubRace,RC_Player,2; bonus bAspdRate,-5; .@vit = readparam(bVit); if (.@vit >= 108) { bonus2 bSubRace,RC_DemiHuman,3; bonus2 bSubRace,RC_Player,3; bonus bAspdRate,-5; } if (.@vit >= 120) { bonus bMaxHPRate,3; bonus bMdef,3; } },{},{} 19026,Aegir_Helm,Aegir Helm,4,10,,800,,10,,0,0xFFFFFFFF,63,2,256,,40,1,870,{ bonus bVit,3; },{},{} 19030,Pretty_Rabbit_Hood,Pretty Rabbit Hood,4,10,,100,,20,,0,0xFFFFFFFF,63,2,1,,1,1,1085,{ bonus bMaxHP,(15*BaseLevel); },{},{} 19031,Fallen_Angel_Blessing,Fallen Angel Blessing,4,0,,200,,1,,0,0xFFFFFFFF,63,2,512,,,1,1250,{ bonus2 bAddRace,RC_Angel,5; bonus2 bSubRace,RC_Angel,5; },{},{} @@ -9721,7 +9723,8 @@ 20095,C_Red_Ribbon,Costume Red Ribbon,4,0,,0,,,,0,0xFFFFFFFF,63,2,1024,,1,1,440,{},{},{} 20096,C_Blue_Ribbon,Costume Blue Ribbon,4,0,,0,,,,0,0xFFFFFFFF,63,2,1024,,1,1,441,{},{},{} 20097,C_White_Ribbon,Costume White Ribbon,4,0,,0,,,,0,0xFFFFFFFF,63,2,1024,,1,1,442,{},{},{} -20110,C_Coiledup_Snake,Costume Coiledup Snake,4,0,,0,,,,0,0xFFFFFFFF,63,2,1024,,1,1,,{/*TODO: View ID*/},{},{} +20099,C_Flying_Ljosalfar,Flying Ljosalfar,4,0,,0,,,,0,0xFFFFFFFF,63,2,1024,1,1,1,1239,{},{},{} +20110,C_Coiledup_Snake,Costume Coiledup Snake,4,0,,0,,,,0,0xFFFFFFFF,63,2,1024,,1,1,1258,{},{},{} 20118,C_Cake_Hat,Costume Cake Hat,4,0,,0,,,,0,0xFFFFFFFF,63,2,1024,,1,1,109,{},{},{} 20119,C_Beanie,Costume Beanie,4,0,,0,,,,0,0xFFFFFFFF,63,2,1024,,1,1,160,{},{},{} 20120,C_Aerial,Costume Aerial,4,0,,0,,,,0,0xFFFFFFFF,63,2,1024,,1,1,97,{},{},{} @@ -9779,7 +9782,7 @@ // 20500,T_Archangel_Wing,Archangel Wing,4,0,,0,,0,,0,0xFFFFFFFF,63,2,8192,,1,0,1,{ bonus bUnbreakableHelm,0; },{},{} 20600,Fantastic_Aura,Fantastic Aura,4,0,,0,,0,,0,0xFFFFFFFF,63,2,8192,,1,0,0,{ /*View ID*/ bonus bUnbreakableHelm,0; },{},{} -20700,Egir_Manteau,Egir Manteau,4,200000,,300,,10,,1,0xFFFFFFFF,63,2,4,,110,1,0,{ bonus bUnbreakableHelm,0; .@r = getrefine(); if (.@r > 10) .@r = 10; if (BaseClass == Job_Mage || BaseClass == Job_Archer || BaseClass == Job_Acolyte) { bonus bFlee2,50+(.@r*20); } else if (BaseClass == Job_Swordman || BaseClass == Job_Merchant || BaseClass == Job_Thief) { bonus bShortWeaponDamageReturn,5+(.@r*2); } },{},{} +20700,Egir_Manteau,Egir Manteau,4,200000,,300,,10,,1,0xFFFFFFFF,63,2,4,,110,1,0,{ bonus bUnbreakableGarment,0; .@r = getrefine(); if (.@r > 10) .@r = 10; if (BaseClass == Job_Mage || BaseClass == Job_Archer || BaseClass == Job_Acolyte) { bonus bFlee2,5+(.@r*2); } else if (BaseClass == Job_Swordman || BaseClass == Job_Merchant || BaseClass == Job_Thief) { bonus bShortWeaponDamageReturn,5+(.@r*2); } },{},{} 20706,Amistr_Bag,Amistr Bag,4,10,,500,,18,,0,0xFFFFFFFF,63,2,4,,1,,4,{ bonus bAllStats,1; bonus2 bSubEle,Ele_All,5; },{},{} 20707,Kirin_Wing,Kirin Wing,4,20,,0,,18,,0,0xFFFFFFFF,63,2,4,,0,1,6,{ bonus bAllStats,1; bonus2 bSubRace,RC_DemiHuman,5; bonus2 bSubRace,RC_Player,5; },{},{} 20710,Impr_Angel's_Warmth,Advanced Angelic Cardigan,4,10000,,400,,6,,1,0x00000001,63,2,4,,99,1,0,{ bonus bHPrecovRate,50; },{},{} diff --git a/db/re/skill_db.txt b/db/re/skill_db.txt index b557fd6d3d..fd1af94cb8 100644 --- a/db/re/skill_db.txt +++ b/db/re/skill_db.txt @@ -176,7 +176,7 @@ //**** // Wizard 80,9,8,2,3,0x20,1:1:1:1:1:2:2:2:2:2:2,10,-3:-4:-5:-6:-7:-8:-9:-10:-11:-12:-12,yes,0,0x2000,5,magic,0,0x0, WZ_FIREPILLAR,Fire Pillar -81,0,6,4,3,0,7,10,1,yes,0,0x42000,0,magic,5,0x20, WZ_SIGHTRASHER,Sightrasher +81,0,6,4,3,0x2,7,10,1,yes,0,0x42000,0,magic,5,0x20, WZ_SIGHTRASHER,Sightrasher 83,9,8,2,3,0,3:3:3:3:3:3:3:3:3:3:14,10,1:1:2:2:3:3:4:4:5:5:15,yes,0,0x2000,0,magic,0,0x20, WZ_METEOR,Meteor Storm 84,9,8,1,4,0,0,10,3:4:5:6:7:8:9:10:11:12,yes,0,0x2000,0,magic,2:3:3:4:4:5:5:6:6:7,0x20, WZ_JUPITEL,Jupitel Thunder 85,9,8,2,4,0,0,10,-10,yes,0,0x2000,0,magic,0,0x20, WZ_VERMILION,Lord of Vermilion diff --git a/src/map/battle.c b/src/map/battle.c index be7c350369..082540d086 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -4020,11 +4020,11 @@ static int battle_calc_attack_skill_ratio(struct Damage wd, struct block_list *s RE_LVL_DMOD(100); break; case GN_CART_TORNADO: { // ATK [( Skill Level x 50 ) + ( Cart Weight / ( 150 - Caster Base STR ))] + ( Cart Remodeling Skill Level x 50 )] % - short strbonus = status_get_base_status(src)->str; // Only use base STR - skillratio += -100 + 50 * skill_lv; - if(sd && sd->cart_weight) + if(sd && sd->cart_weight) { + int strbonus = status_get_base_status(src)->str; // Only use base STR skillratio += sd->cart_weight / 10 / (150 - min(strbonus,120)) + pc_checkskill(sd,GN_REMODELING_CART) * 50; + } } break; case GN_CARTCANNON: diff --git a/src/map/clif.c b/src/map/clif.c index ac71bc3fa8..14dcdd387e 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -1511,6 +1511,9 @@ int clif_homskillinfoblock(struct map_session_data *sd) struct homun_data *hd; int fd = sd->fd; int i, len=4; + + nullpo_ret(sd); + WFIFOHEAD(fd, 4+37*MAX_HOMUNSKILL); hd = sd->hd; @@ -11525,7 +11528,8 @@ static void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct return; if( DIFF_TICK(tick, md->ud.canact_tick) < 0 ) { - clif_skill_fail(md->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + if (md->master) + clif_skill_fail(md->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); return; } diff --git a/src/map/elemental.c b/src/map/elemental.c index a1c44a9254..b9e4b056a0 100644 --- a/src/map/elemental.c +++ b/src/map/elemental.c @@ -526,6 +526,8 @@ int elemental_change_mode(struct elemental_data *ed, int mode) { } void elemental_heal(struct elemental_data *ed, int hp, int sp) { + if (ed->master == NULL) + return; if( hp ) clif_elemental_updatestatus(ed->master, SP_HP); if( sp ) diff --git a/src/map/homunculus.c b/src/map/homunculus.c index 3b78cc6c44..3bb4608ee1 100644 --- a/src/map/homunculus.c +++ b/src/map/homunculus.c @@ -184,7 +184,8 @@ void hom_delspiritball(TBL_HOM *hd, int count, int type) { * @param hd */ void hom_damage(struct homun_data *hd) { - clif_hominfo(hd->master,hd,0); + if (hd->master) + clif_hominfo(hd->master,hd,0); } /** @@ -513,7 +514,7 @@ int hom_levelup(struct homun_data *hd) APPLY_HOMUN_LEVEL_STATWEIGHT(); - if ( battle_config.homunculus_show_growth ) { + if ( hd->master && battle_config.homunculus_show_growth ) { char output[256] ; sprintf(output, "Growth: hp:%d sp:%d str(%.2f) agi(%.2f) vit(%.2f) int(%.2f) dex(%.2f) luk(%.2f) ", @@ -683,7 +684,7 @@ void hom_gainexp(struct homun_data *hd,int exp) hd->homunculus.exp += exp; - if (hd->homunculus.exp < hd->exp_next) { + if (hd->master && hd->homunculus.exp < hd->exp_next) { clif_hominfo(hd->master,hd,0); return; } @@ -745,7 +746,8 @@ int hom_decrease_intimacy(struct homun_data * hd, unsigned int value) * @param hd */ void hom_heal(struct homun_data *hd) { - clif_hominfo(hd->master,hd,0); + if (hd->master) + clif_hominfo(hd->master,hd,0); } /** diff --git a/src/map/mercenary.c b/src/map/mercenary.c index c69d7ae420..652d9f127a 100644 --- a/src/map/mercenary.c +++ b/src/map/mercenary.c @@ -408,6 +408,8 @@ bool mercenary_recv_data(struct s_mercenary *merc, bool flag) * @param sp SP amount **/ void mercenary_heal(struct mercenary_data *md, int hp, int sp) { + if (md->master == NULL) + return; if( hp ) clif_mercenary_updatestatus(md->master, SP_HP); if( sp ) diff --git a/src/map/pc.c b/src/map/pc.c index 52b2bfb8b7..455ddf62a6 100755 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -7176,7 +7176,7 @@ void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int h clif_progressbar_abort(sd); if( sd->status.pet_id > 0 && sd->pd && battle_config.pet_damage_support ) - pet_target_check(sd,src,1); + pet_target_check(sd->pd,src,1); if( sd->status.ele_id > 0 ) elemental_set_target(sd,src); diff --git a/src/map/pet.c b/src/map/pet.c index 71c332adfc..c1760ddd1a 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -64,7 +64,7 @@ void pet_set_intimate(struct pet_data *pd, int value) pd->pet.intimate = value; - if( (intimate >= battle_config.pet_equip_min_friendly && pd->pet.intimate < battle_config.pet_equip_min_friendly) || (intimate < battle_config.pet_equip_min_friendly && pd->pet.intimate >= battle_config.pet_equip_min_friendly) ) + if( sd && (intimate >= battle_config.pet_equip_min_friendly && pd->pet.intimate < battle_config.pet_equip_min_friendly) || (intimate < battle_config.pet_equip_min_friendly && pd->pet.intimate >= battle_config.pet_equip_min_friendly) ) status_calc_pc(sd,SCO_NONE); } @@ -156,12 +156,11 @@ int pet_attackskill(struct pet_data *pd, int target_id) * @param type : pet's attack rate type * @return 0 */ -int pet_target_check(struct map_session_data *sd,struct block_list *bl,int type) +int pet_target_check(struct pet_data *pd,struct block_list *bl,int type) { - struct pet_data *pd; int rate; - pd = sd->pd; + nullpo_ret(pd); Assert((pd->master == 0) || (pd->master->pd == pd)); diff --git a/src/map/pet.h b/src/map/pet.h index ed60daff67..941b3664a2 100644 --- a/src/map/pet.h +++ b/src/map/pet.h @@ -108,7 +108,7 @@ struct pet_data { int pet_create_egg(struct map_session_data *sd, unsigned short item_id); int pet_hungry_val(struct pet_data *pd); void pet_set_intimate(struct pet_data *pd, int value); -int pet_target_check(struct map_session_data *sd,struct block_list *bl,int type); +int pet_target_check(struct pet_data *pd,struct block_list *bl,int type); int pet_unlocktarget(struct pet_data *pd); int pet_sc_check(struct map_session_data *sd, int type); //Skotlex int search_petDB_index(int key,int type); diff --git a/src/map/script.c b/src/map/script.c index 295934fd2f..bb3a83aad1 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -16490,7 +16490,6 @@ BUILDIN_FUNC(getunitdata) TBL_PET* pd = NULL; TBL_ELEM* ed = NULL; TBL_NPC* nd = NULL; - int num; char* name; struct script_data *data = script_getdata(st, 3); @@ -16515,7 +16514,6 @@ BUILDIN_FUNC(getunitdata) case BL_NPC: nd = map_id2nd(bl->id); break; } - num = reference_getuid(data); name = reference_getname(data); #define getunitdata_sub(idx__,var__) setd_sub(st,sd,name,(idx__),(void *)__64BPRTSIZE((int)(var__)),data->ref) @@ -17826,21 +17824,23 @@ BUILDIN_FUNC(questinfo) int quest_id, icon; struct questinfo qi; - if( nd == NULL || nd->bl.m == -1 ) - return true; + if( nd == NULL || nd->bl.m == -1 ) { + ShowError("buildin_questinfo: No NPC attached.\n"); + return SCRIPT_CMD_FAILURE; + } quest_id = script_getnum(st, 2); icon = script_getnum(st, 3); - #if PACKETVER >= 20120410 - if(icon < 0 || (icon > 8 && icon != 9999) || icon == 7) - icon = 9999; // Default to nothing if icon id is invalid. - #else - if(icon < 0 || icon > 7) - icon = 0; - else - icon = icon + 1; - #endif +#if PACKETVER >= 20120410 + if(icon < 0 || (icon > 8 && icon != 9999) || icon == 7) + icon = 9999; // Default to nothing if icon id is invalid. +#else + if(icon < 0 || icon > 7) + icon = 0; + else + icon = icon + 1; +#endif qi.quest_id = quest_id; qi.icon = (unsigned char)icon; @@ -17871,7 +17871,7 @@ BUILDIN_FUNC(questinfo) map_add_questinfo(nd->bl.m,&qi); - return true; + return SCRIPT_CMD_SUCCESS; } /** @@ -18007,15 +18007,15 @@ BUILDIN_FUNC(showevent) } } - #if PACKETVER >= 20120410 - if(icon < 0 || (icon > 8 && icon != 9999) || icon == 7) - icon = 9999; // Default to nothing if icon id is invalid. - #else - if(icon < 0 || icon > 7) - icon = 0; - else - icon = icon + 1; - #endif +#if PACKETVER >= 20120410 + if(icon < 0 || (icon > 8 && icon != 9999) || icon == 7) + icon = 9999; // Default to nothing if icon id is invalid. +#else + if(icon < 0 || icon > 7) + icon = 0; + else + icon = icon + 1; +#endif clif_quest_show_event(sd, &nd->bl, icon, color); return SCRIPT_CMD_SUCCESS; diff --git a/src/map/skill.c b/src/map/skill.c index 53b327096f..c3079d458c 100755 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -6636,7 +6636,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui clif_skill_nodamage(src,bl,skill_id,skill_lv,1); map_foreachinrange(skill_area_sub,src, skill_get_splash(skill_id, skill_lv),BL_CHAR|BL_SKILL, - src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1, + src,skill_id,skill_lv,tick, flag|BCT_ENEMY|SD_ANIMATION|1, skill_castend_damage_id); break; @@ -7092,7 +7092,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case AL_HOLYWATER: if(sd) { - if (skill_produce_mix(sd, skill_id, 523, 0, 0, 0, 1)) + if (skill_produce_mix(sd, skill_id, ITEMID_HOLY_WATER, 0, 0, 0, 1)) clif_skill_nodamage(src,bl,skill_id,skill_lv,1); else clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); @@ -18651,17 +18651,22 @@ bool skill_produce_mix(struct map_session_data *sd, uint16 skill_id, unsigned sh break; } } + if (skill_id == GN_CHANGEMATERIAL && tmp_item.amount) { //Success - int j, k = 0; + int j, k = 0, l; + bool isStackable = itemdb_isstackable(tmp_item.nameid); for (i = 0; i < MAX_SKILL_CHANGEMATERIAL_DB; i++) { if (skill_changematerial_db[i].nameid == nameid){ for (j = 0; j < MAX_SKILL_CHANGEMATERIAL_SET; j++){ if (rnd()%1000 < skill_changematerial_db[i].qty_rate[j]){ - tmp_item.amount = qty * skill_changematerial_db[i].qty[j]; - if ((flag = pc_additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) { - clif_additem(sd,0,0,flag); - map_addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + uint16 total_qty = qty * skill_changematerial_db[i].qty[j]; + tmp_item.amount = (isStackable ? total_qty : 1); + for (l = 0; l < total_qty; l += tmp_item.amount) { + if ((flag = pc_additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) { + clif_additem(sd,0,0,flag); + map_addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + } } k++; } diff --git a/src/map/status.c b/src/map/status.c index 412c0c3135..83ffde35a3 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -4864,6 +4864,9 @@ void status_calc_bl_(struct block_list* bl, enum scb_flag flag, enum e_status_ca } else if( bl->type == BL_MER ) { TBL_MER* md = BL_CAST(BL_MER, bl); + if (!md->master) + return; + if( b_status.rhw.atk != status->rhw.atk || b_status.rhw.atk2 != status->rhw.atk2 ) clif_mercenary_updatestatus(md->master, SP_ATK1); if( b_status.matk_max != status->matk_max ) @@ -4891,6 +4894,9 @@ void status_calc_bl_(struct block_list* bl, enum scb_flag flag, enum e_status_ca } else if( bl->type == BL_ELEM ) { TBL_ELEM* ed = BL_CAST(BL_ELEM, bl); + if (!ed->master) + return; + if( b_status.max_hp != status->max_hp ) clif_elemental_updatestatus(ed->master, SP_MAXHP); if( b_status.max_sp != status->max_sp ) diff --git a/src/map/unit.c b/src/map/unit.c index 3140df8765..15be55d17c 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -2585,7 +2585,7 @@ static int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int t ud->attacktarget_lv = battle_weapon_attack(src,target,tick,0); if(sd && sd->status.pet_id > 0 && sd->pd && battle_config.pet_attack_support) - pet_target_check(sd,target,0); + pet_target_check(sd->pd,target,0); map_freeblock_unlock(); @@ -3046,7 +3046,7 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file, if( elemental_get_lifetime(ed) <= 0 && !(ed->master && !ed->master->state.active) ) { clif_clearunit_area(bl,clrtype); map_delblock(bl); - unit_free(bl,0); + unit_free(bl,CLR_OUTSIGHT); map_freeblock_unlock(); return 0; @@ -3279,6 +3279,7 @@ int unit_free(struct block_list *bl, clr_type clrtype) if( sd ) sd->pd = NULL; + pd->master = NULL; break; } case BL_MOB: { @@ -3357,6 +3358,7 @@ int unit_free(struct block_list *bl, clr_type clrtype) if( sd ) sd->hd = NULL; + hd->master = NULL; break; } case BL_MER: { @@ -3376,6 +3378,7 @@ int unit_free(struct block_list *bl, clr_type clrtype) sd->md = NULL; mercenary_contract_stop(md); + md->master = NULL; break; } case BL_ELEM: { @@ -3395,6 +3398,7 @@ int unit_free(struct block_list *bl, clr_type clrtype) sd->ed = NULL; elemental_summon_stop(ed); + ed->master = NULL; break; } }