Enable makeitem to display DropEffect (#6303)

Enable item to special effect if the item has DropEffect flag.
This commit is contained in:
HAO YAN 2021-10-20 21:45:07 +08:00 committed by GitHub
parent 31327ade6c
commit 2eebafb703
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 18 deletions

View File

@ -4902,8 +4902,8 @@ Example to get Crimson Weapon with Ghost property:
--------------------------------------- ---------------------------------------
*makeitem <item id>,<amount>,"<map name>",<X>,<Y>; *makeitem <item id>,<amount>,"<map name>",<X>,<Y>{,<canShowEffect>};
*makeitem "<item name>",<amount>,"<map name>",<X>,<Y>; *makeitem "<item name>",<amount>,"<map name>",<X>,<Y>{,<canShowEffect>};
This command will create an item on the specified cell of a map. This command will create an item on the specified cell of a map.
@ -4914,13 +4914,14 @@ given amount, not multiple stacks of 1.
Like 'getitem', it also accepts an 'english name' field from the database and creates Like 'getitem', it also accepts an 'english name' field from the database and creates
Apples if the name isn't found. Apples if the name isn't found.
If the map name is given as "this", the map the invoking character is on will be used. If the map name is given as "this", the map the invoking character is on will be used.
If <canShowEffect> flag is set to true, it will show a pillar effect on the ground when dropped, depending on the item database's DropEffect flag.
--------------------------------------- ---------------------------------------
*makeitem2 <item id>,<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>; *makeitem2 <item id>,<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<canShowEffect>};
*makeitem2 "<item name>",<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>; *makeitem2 "<item name>",<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<canShowEffect>};
*makeitem3 <item id>,<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>; *makeitem3 <item id>,<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<canShowEffect>};
*makeitem3 "<item name>",<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>; *makeitem3 "<item name>",<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<canShowEffect>};
This command will create an item on the specified cell of a map. See 'makeitem' for This command will create an item on the specified cell of a map. See 'makeitem' for
further details. further details.

View File

@ -1839,6 +1839,7 @@ bool map_closest_freecell(int16 m, int16 *x, int16 *y, int type, int flag)
* @param third_charid : 3rd player that could loot the item (3rd charid that could loot for third_get_charid duration) * @param third_charid : 3rd player that could loot the item (3rd charid that could loot for third_get_charid duration)
* @param flag: &1 MVP item. &2 do stacking check. &4 bypass droppable check. * @param flag: &1 MVP item. &2 do stacking check. &4 bypass droppable check.
* @param mob_id: Monster ID if dropped by monster * @param mob_id: Monster ID if dropped by monster
* @param canShowEffect: enable pillar effect on the dropped item (if set in the database)
* @return 0:failure, x:item_gid [MIN_FLOORITEM;MAX_FLOORITEM]==[2;START_ACCOUNT_NUM] * @return 0:failure, x:item_gid [MIN_FLOORITEM;MAX_FLOORITEM]==[2;START_ACCOUNT_NUM]
*------------------------------------------*/ *------------------------------------------*/
int map_addflooritem(struct item *item, int amount, int16 m, int16 x, int16 y, int first_charid, int second_charid, int third_charid, int flags, unsigned short mob_id, bool canShowEffect) int map_addflooritem(struct item *item, int amount, int16 m, int16 x, int16 y, int first_charid, int second_charid, int third_charid, int flags, unsigned short mob_id, bool canShowEffect)

View File

@ -7870,8 +7870,8 @@ BUILDIN_FUNC(grouprandomitem) {
} }
/** /**
* makeitem <item id>,<amount>,"<map name>",<X>,<Y>; * makeitem <item id>,<amount>,"<map name>",<X>,<Y>{,<canShowEffect>};
* makeitem "<item name>",<amount>,"<map name>",<X>,<Y>; * makeitem "<item name>",<amount>,"<map name>",<X>,<Y>{,<canShowEffect>};
*/ */
BUILDIN_FUNC(makeitem) { BUILDIN_FUNC(makeitem) {
t_itemid nameid; t_itemid nameid;
@ -7879,6 +7879,7 @@ BUILDIN_FUNC(makeitem) {
const char *mapname; const char *mapname;
int m; int m;
struct item item_tmp; struct item item_tmp;
bool canShowEffect = false;
if( script_isstring(st, 2) ){ if( script_isstring(st, 2) ){
const char *name = script_getstr(st, 2); const char *name = script_getstr(st, 2);
@ -7912,6 +7913,9 @@ BUILDIN_FUNC(makeitem) {
x = script_getnum(st,5); x = script_getnum(st,5);
y = script_getnum(st,6); y = script_getnum(st,6);
if (script_hasdata(st, 7))
canShowEffect = script_getnum(st, 7) != 0;
if (strcmp(mapname, "this")==0) { if (strcmp(mapname, "this")==0) {
TBL_PC *sd; TBL_PC *sd;
if (!script_rid2sd(sd)) if (!script_rid2sd(sd))
@ -7927,16 +7931,16 @@ BUILDIN_FUNC(makeitem) {
else else
item_tmp.identify = itemdb_isidentified(nameid); item_tmp.identify = itemdb_isidentified(nameid);
map_addflooritem(&item_tmp,amount,m,x,y,0,0,0,4,0); map_addflooritem(&item_tmp, amount, m, x, y, 0, 0, 0, 4, 0, canShowEffect);
return SCRIPT_CMD_SUCCESS; return SCRIPT_CMD_SUCCESS;
} }
/** /**
* makeitem2 <item id>,<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>; * makeitem2 <item id>,<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<canShowEffect>};
* makeitem2 "<item name>",<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>; * makeitem2 "<item name>",<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<canShowEffect>};
* *
* makeitem3 <item id>,<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>; * makeitem3 <item id>,<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<canShowEffect>};
* makeitem3 "<item name>",<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>; * makeitem3 "<item name>",<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<canShowEffect>};
*/ */
BUILDIN_FUNC(makeitem2) { BUILDIN_FUNC(makeitem2) {
t_itemid nameid; t_itemid nameid;
@ -7946,6 +7950,7 @@ BUILDIN_FUNC(makeitem2) {
struct item item_tmp; struct item item_tmp;
struct item_data *id; struct item_data *id;
const char *funcname = script_getfuncname(st); const char *funcname = script_getfuncname(st);
bool canShowEffect = false;
if( script_isstring( st, 2 ) ){ if( script_isstring( st, 2 ) ){
const char *name = script_getstr( st, 2 ); const char *name = script_getstr( st, 2 );
@ -8013,9 +8018,20 @@ BUILDIN_FUNC(makeitem2) {
int res = script_getitem_randomoption(st, nullptr, &item_tmp, funcname, 14); int res = script_getitem_randomoption(st, nullptr, &item_tmp, funcname, 14);
if (res != SCRIPT_CMD_SUCCESS) if (res != SCRIPT_CMD_SUCCESS)
return res; return res;
if (script_hasdata(st, 17)) {
if (script_getnum(st, 17) != 0)
canShowEffect = script_getnum(st, 17) != 0;
}
}
else {
if (script_hasdata(st, 14)) {
if (script_getnum(st, 14) != 0)
canShowEffect = script_getnum(st, 14) != 0;
}
} }
map_addflooritem(&item_tmp,amount,m,x,y,0,0,0,4,0); map_addflooritem(&item_tmp, amount, m, x, y, 0, 0, 0, 4, 0, canShowEffect);
} }
else else
return SCRIPT_CMD_FAILURE; return SCRIPT_CMD_FAILURE;
@ -25332,8 +25348,8 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(getitem2,"viiiiiiii?"), BUILDIN_DEF(getitem2,"viiiiiiii?"),
BUILDIN_DEF(getnameditem,"vv"), BUILDIN_DEF(getnameditem,"vv"),
BUILDIN_DEF2(grouprandomitem,"groupranditem","i?"), BUILDIN_DEF2(grouprandomitem,"groupranditem","i?"),
BUILDIN_DEF(makeitem,"visii"), BUILDIN_DEF(makeitem,"visii?"),
BUILDIN_DEF(makeitem2,"visiiiiiiiii"), BUILDIN_DEF(makeitem2,"visiiiiiiiii?"),
BUILDIN_DEF(delitem,"vi?"), BUILDIN_DEF(delitem,"vi?"),
BUILDIN_DEF2(delitem,"storagedelitem","vi?"), BUILDIN_DEF2(delitem,"storagedelitem","vi?"),
BUILDIN_DEF2(delitem,"guildstoragedelitem","vi?"), BUILDIN_DEF2(delitem,"guildstoragedelitem","vi?"),
@ -25897,7 +25913,7 @@ struct script_function buildin_func[] = {
BUILDIN_DEF2(getitem2,"getitem3","viiiiiiiirrr?"), BUILDIN_DEF2(getitem2,"getitem3","viiiiiiiirrr?"),
BUILDIN_DEF2(getitem2,"getitembound3","viiiiiiiiirrr?"), BUILDIN_DEF2(getitem2,"getitembound3","viiiiiiiiirrr?"),
BUILDIN_DEF2(rentitem2,"rentitem3","viiiiiiiirrr?"), BUILDIN_DEF2(rentitem2,"rentitem3","viiiiiiiirrr?"),
BUILDIN_DEF2(makeitem2,"makeitem3","visiiiiiiiiirrr"), BUILDIN_DEF2(makeitem2,"makeitem3","visiiiiiiiiirrr?"),
BUILDIN_DEF2(delitem2,"delitem3","viiiiiiiirrr?"), BUILDIN_DEF2(delitem2,"delitem3","viiiiiiiirrr?"),
BUILDIN_DEF2(countitem,"countitem3","viiiiiiirrr?"), BUILDIN_DEF2(countitem,"countitem3","viiiiiiirrr?"),