Fixed bugreport:2657 castend now also checks if the required weapon matches, fixing any possible exploits where a character manages to change weapon during cast/animation e.g., as the report claims, sonic blow. (also applied my curly brace love on the way)
Special Thanks to esu1214! git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@16817 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
e0b316216f
commit
b313d24eb2
@ -12889,8 +12889,8 @@ int skill_check_condition_castend(struct map_session_data* sd, short skill, shor
|
|||||||
if( lv <= 0 || sd->chatID )
|
if( lv <= 0 || sd->chatID )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if( pc_has_permission(sd, PC_PERM_SKILL_UNCONDITIONAL) && sd->skillitem != skill )
|
if( pc_has_permission(sd, PC_PERM_SKILL_UNCONDITIONAL) && sd->skillitem != skill ) {
|
||||||
{ //GMs don't override the skillItem check, otherwise they can use items without them being consumed! [Skotlex]
|
//GMs don't override the skillItem check, otherwise they can use items without them being consumed! [Skotlex]
|
||||||
sd->state.arrow_atk = skill_get_ammotype(skill)?1:0; //Need to do arrow state check.
|
sd->state.arrow_atk = skill_get_ammotype(skill)?1:0; //Need to do arrow state check.
|
||||||
sd->spiritball_old = sd->spiritball; //Need to do Spiritball check.
|
sd->spiritball_old = sd->spiritball; //Need to do Spiritball check.
|
||||||
return 1;
|
return 1;
|
||||||
@ -12920,21 +12920,18 @@ int skill_check_condition_castend(struct map_session_data* sd, short skill, shor
|
|||||||
if( sd->skillitem == skill ) // Casting finished (Item skill or Hocus-Pocus)
|
if( sd->skillitem == skill ) // Casting finished (Item skill or Hocus-Pocus)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if( pc_is90overweight(sd) )
|
if( pc_is90overweight(sd) ) {
|
||||||
{
|
|
||||||
clif_skill_fail(sd,skill,USESKILL_FAIL_WEIGHTOVER,0);
|
clif_skill_fail(sd,skill,USESKILL_FAIL_WEIGHTOVER,0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// perform skill-specific checks (and actions)
|
// perform skill-specific checks (and actions)
|
||||||
switch( skill )
|
switch( skill ) {
|
||||||
{
|
|
||||||
case PR_BENEDICTIO:
|
case PR_BENEDICTIO:
|
||||||
skill_check_pc_partner(sd, skill, &lv, 1, 1);
|
skill_check_pc_partner(sd, skill, &lv, 1, 1);
|
||||||
break;
|
break;
|
||||||
case AM_CANNIBALIZE:
|
case AM_CANNIBALIZE:
|
||||||
case AM_SPHEREMINE:
|
case AM_SPHEREMINE: {
|
||||||
{
|
|
||||||
int c=0;
|
int c=0;
|
||||||
int summons[5] = { 1589, 1579, 1575, 1555, 1590 };
|
int summons[5] = { 1589, 1579, 1575, 1555, 1590 };
|
||||||
//int summons[5] = { 1020, 1068, 1118, 1500, 1368 };
|
//int summons[5] = { 1020, 1068, 1118, 1500, 1368 };
|
||||||
@ -12952,8 +12949,7 @@ int skill_check_condition_castend(struct map_session_data* sd, short skill, shor
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NC_SILVERSNIPER:
|
case NC_SILVERSNIPER:
|
||||||
case NC_MAGICDECOY:
|
case NC_MAGICDECOY: {
|
||||||
{
|
|
||||||
int c = 0, j;
|
int c = 0, j;
|
||||||
int maxcount = skill_get_maxcount(skill,lv);
|
int maxcount = skill_get_maxcount(skill,lv);
|
||||||
int mob_class = 2042;
|
int mob_class = 2042;
|
||||||
@ -12973,8 +12969,7 @@ int skill_check_condition_castend(struct map_session_data* sd, short skill, shor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case KO_ZANZOU:
|
case KO_ZANZOU: {
|
||||||
{
|
|
||||||
int c = 0;
|
int c = 0;
|
||||||
i = map_foreachinmap(skill_check_condition_mob_master_sub, sd->bl.m, BL_MOB, sd->bl.id, 2308, skill, &c);
|
i = map_foreachinmap(skill_check_condition_mob_master_sub, sd->bl.m, BL_MOB, sd->bl.id, 2308, skill, &c);
|
||||||
if( c >= skill_get_maxcount(skill,lv) || c != i)
|
if( c >= skill_get_maxcount(skill,lv) || c != i)
|
||||||
@ -12995,6 +12990,11 @@ int skill_check_condition_castend(struct map_session_data* sd, short skill, shor
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( require.weapon && !pc_check_weapontype(sd,require.weapon) ) {
|
||||||
|
clif_skill_fail(sd,skill,USESKILL_FAIL_THIS_WEAPON,0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if( require.ammo ) { //Skill requires stuff equipped in the arrow slot.
|
if( require.ammo ) { //Skill requires stuff equipped in the arrow slot.
|
||||||
if((i=sd->equip_index[EQI_AMMO]) < 0 || !sd->inventory_data[i] ) {
|
if((i=sd->equip_index[EQI_AMMO]) < 0 || !sd->inventory_data[i] ) {
|
||||||
clif_arrow_fail(sd,0);
|
clif_arrow_fail(sd,0);
|
||||||
@ -13008,8 +13008,7 @@ int skill_check_condition_castend(struct map_session_data* sd, short skill, shor
|
|||||||
clif_colormes(sd,COLOR_RED,e_msg);
|
clif_colormes(sd,COLOR_RED,e_msg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!(require.ammo&1<<sd->inventory_data[i]->look))
|
if (!(require.ammo&1<<sd->inventory_data[i]->look)) { //Ammo type check. Send the "wrong weapon type" message
|
||||||
{ //Ammo type check. Send the "wrong weapon type" message
|
|
||||||
//which is the closest we have to wrong ammo type. [Skotlex]
|
//which is the closest we have to wrong ammo type. [Skotlex]
|
||||||
clif_arrow_fail(sd,0); //Haplo suggested we just send the equip-arrows message instead. [Skotlex]
|
clif_arrow_fail(sd,0); //Haplo suggested we just send the equip-arrows message instead. [Skotlex]
|
||||||
//clif_skill_fail(sd,skill,USESKILL_FAIL_THIS_WEAPON,0);
|
//clif_skill_fail(sd,skill,USESKILL_FAIL_THIS_WEAPON,0);
|
||||||
@ -13017,8 +13016,7 @@ int skill_check_condition_castend(struct map_session_data* sd, short skill, shor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for( i = 0; i < MAX_SKILL_ITEM_REQUIRE; ++i )
|
for( i = 0; i < MAX_SKILL_ITEM_REQUIRE; ++i ) {
|
||||||
{
|
|
||||||
if( !require.itemid[i] )
|
if( !require.itemid[i] )
|
||||||
continue;
|
continue;
|
||||||
index[i] = pc_search_inventory(sd,require.itemid[i]);
|
index[i] = pc_search_inventory(sd,require.itemid[i]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user