Fixed potential crash in pc_bonus (#2423)
* Fixes #2420. * If a bonus script command is used in an NPC with a non-existent bonus type, the server crashes. Thanks to @vstumpf and @anacondaqq!
This commit is contained in:
parent
70f1d86404
commit
0e74b5f55b
25
src/map/pc.c
25
src/map/pc.c
@ -3129,9 +3129,12 @@ void pc_bonus(struct map_session_data *sd,int type,int val)
|
|||||||
else if (current_equip_combo_pos > 0) {
|
else if (current_equip_combo_pos > 0) {
|
||||||
ShowWarning("pc_bonus: unknown bonus type %d %d in a combo with item #%d\n", type, val, sd->inventory_data[pc_checkequip( sd, current_equip_combo_pos )]->nameid);
|
ShowWarning("pc_bonus: unknown bonus type %d %d in a combo with item #%d\n", type, val, sd->inventory_data[pc_checkequip( sd, current_equip_combo_pos )]->nameid);
|
||||||
}
|
}
|
||||||
else {
|
else if (current_equip_card_id > 0 || current_equip_item_index > 0) {
|
||||||
ShowWarning("pc_bonus: unknown bonus type %d %d in item #%d\n", type, val, current_equip_card_id ? current_equip_card_id : sd->inventory_data[current_equip_item_index]->nameid);
|
ShowWarning("pc_bonus: unknown bonus type %d %d in item #%d\n", type, val, current_equip_card_id ? current_equip_card_id : sd->inventory_data[current_equip_item_index]->nameid);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
ShowWarning("pc_bonus: unknown bonus type %d %d in unknown usage. Report this!\n", type, val);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3811,9 +3814,12 @@ void pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
|
|||||||
else if (current_equip_combo_pos > 0) {
|
else if (current_equip_combo_pos > 0) {
|
||||||
ShowWarning("pc_bonus2: unknown bonus type %d %d %d in a combo with item #%d\n", type, type2, val, sd->inventory_data[pc_checkequip( sd, current_equip_combo_pos )]->nameid);
|
ShowWarning("pc_bonus2: unknown bonus type %d %d %d in a combo with item #%d\n", type, type2, val, sd->inventory_data[pc_checkequip( sd, current_equip_combo_pos )]->nameid);
|
||||||
}
|
}
|
||||||
else {
|
else if (current_equip_card_id > 0 || current_equip_item_index > 0) {
|
||||||
ShowWarning("pc_bonus2: unknown bonus type %d %d %d in item #%d\n", type, type2, val, current_equip_card_id ? current_equip_card_id : sd->inventory_data[current_equip_item_index]->nameid);
|
ShowWarning("pc_bonus2: unknown bonus type %d %d %d in item #%d\n", type, type2, val, current_equip_card_id ? current_equip_card_id : sd->inventory_data[current_equip_item_index]->nameid);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
ShowWarning("pc_bonus2: unknown bonus type %d %d %d in unknown usage. Report this!\n", type, type2, val);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3934,9 +3940,12 @@ void pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val)
|
|||||||
else if (current_equip_combo_pos > 0) {
|
else if (current_equip_combo_pos > 0) {
|
||||||
ShowWarning("pc_bonus3: unknown bonus type %d %d %d %d in a combo with item #%d\n", type, type2, type3, val, sd->inventory_data[pc_checkequip( sd, current_equip_combo_pos )]->nameid);
|
ShowWarning("pc_bonus3: unknown bonus type %d %d %d %d in a combo with item #%d\n", type, type2, type3, val, sd->inventory_data[pc_checkequip( sd, current_equip_combo_pos )]->nameid);
|
||||||
}
|
}
|
||||||
else {
|
else if (current_equip_card_id > 0 || current_equip_item_index > 0) {
|
||||||
ShowWarning("pc_bonus3: unknown bonus type %d %d %d %d in item #%d\n", type, type2, type3, val, current_equip_card_id ? current_equip_card_id : sd->inventory_data[current_equip_item_index]->nameid);
|
ShowWarning("pc_bonus3: unknown bonus type %d %d %d %d in item #%d\n", type, type2, type3, val, current_equip_card_id ? current_equip_card_id : sd->inventory_data[current_equip_item_index]->nameid);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
ShowWarning("pc_bonus3: unknown bonus type %d %d %d %d in unknown usage. Report this!\n", type, type2, type3, val);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4017,9 +4026,12 @@ void pc_bonus4(struct map_session_data *sd,int type,int type2,int type3,int type
|
|||||||
else if (current_equip_combo_pos > 0) {
|
else if (current_equip_combo_pos > 0) {
|
||||||
ShowWarning("pc_bonus4: unknown bonus type %d %d %d %d %d in a combo with item #%d\n", type, type2, type3, type4, val, sd->inventory_data[pc_checkequip( sd, current_equip_combo_pos )]->nameid);
|
ShowWarning("pc_bonus4: unknown bonus type %d %d %d %d %d in a combo with item #%d\n", type, type2, type3, type4, val, sd->inventory_data[pc_checkequip( sd, current_equip_combo_pos )]->nameid);
|
||||||
}
|
}
|
||||||
else {
|
else if (current_equip_card_id > 0 || current_equip_item_index > 0) {
|
||||||
ShowWarning("pc_bonus4: unknown bonus type %d %d %d %d %d in item #%d\n", type, type2, type3, type4, val, current_equip_card_id ? current_equip_card_id : sd->inventory_data[current_equip_item_index]->nameid);
|
ShowWarning("pc_bonus4: unknown bonus type %d %d %d %d %d in item #%d\n", type, type2, type3, type4, val, current_equip_card_id ? current_equip_card_id : sd->inventory_data[current_equip_item_index]->nameid);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
ShowWarning("pc_bonus4: unknown bonus type %d %d %d %d %d in unknown usage. Report this!\n", type, type2, type3, type4, val);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4066,9 +4078,12 @@ void pc_bonus5(struct map_session_data *sd,int type,int type2,int type3,int type
|
|||||||
else if (current_equip_combo_pos > 0) {
|
else if (current_equip_combo_pos > 0) {
|
||||||
ShowWarning("pc_bonus5: unknown bonus type %d %d %d %d %d %d in a combo with item #%d\n", type, type2, type3, type4, type5, val, sd->inventory_data[pc_checkequip( sd, current_equip_combo_pos )]->nameid);
|
ShowWarning("pc_bonus5: unknown bonus type %d %d %d %d %d %d in a combo with item #%d\n", type, type2, type3, type4, type5, val, sd->inventory_data[pc_checkequip( sd, current_equip_combo_pos )]->nameid);
|
||||||
}
|
}
|
||||||
else {
|
else if (current_equip_card_id > 0 || current_equip_item_index > 0) {
|
||||||
ShowWarning("pc_bonus5: unknown bonus type %d %d %d %d %d %d in item #%d\n", type, type2, type3, type4, type5, val, current_equip_card_id ? current_equip_card_id : sd->inventory_data[current_equip_item_index]->nameid);
|
ShowWarning("pc_bonus5: unknown bonus type %d %d %d %d %d %d in item #%d\n", type, type2, type3, type4, type5, val, current_equip_card_id ? current_equip_card_id : sd->inventory_data[current_equip_item_index]->nameid);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
ShowWarning("pc_bonus5: unknown bonus type %d %d %d %d %d %d in unknown usage. Report this!\n", type, type2, type3, type4, type5, val);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user