Add the stockall command (#8008)
* The command will transfer all items from the cart to the inventory based on the item type.
This commit is contained in:
parent
53f1c5bb80
commit
a7f0aab600
@ -365,6 +365,10 @@ Body:
|
||||
Help: |
|
||||
Params: [<item type>]
|
||||
Throws all your possession on the ground. No type specified will drop all items.
|
||||
- Command: stockall
|
||||
Help: |
|
||||
Params: [<item type>]
|
||||
Transfer items from cart to your inventory. No type specified will transfer all items.
|
||||
- Command: storeall
|
||||
Help: |
|
||||
Puts all your possessions in storage.
|
||||
|
@ -1815,5 +1815,10 @@
|
||||
1531: Invalid position.
|
||||
1532: Invalid slot number.
|
||||
|
||||
//@stockall
|
||||
1533: You do not have a cart.
|
||||
1534: Usage: @stockall {<type>}
|
||||
1535: %d items are transferred (%d skipped)!
|
||||
|
||||
//Custom translations
|
||||
import: conf/msg_conf/import/map_msg_eng_conf.txt
|
||||
|
@ -780,6 +780,28 @@ To drop all weapons in inventory...
|
||||
|
||||
---------------------------------------
|
||||
|
||||
@stockall {<item type>}
|
||||
|
||||
Transfer all items from cart to inventory based on the item type.
|
||||
|
||||
Valid item types:
|
||||
-1 = All (default)
|
||||
0 = Healing
|
||||
2 = Usable
|
||||
3 = Etc
|
||||
4 = Armors
|
||||
5 = Weapons
|
||||
6 = Cards
|
||||
7 = Pet Eggs
|
||||
8 = Pet Armors
|
||||
10 = Ammunition
|
||||
|
||||
Example:
|
||||
To transfer all weapons from cart to inventory...
|
||||
@stockall 5
|
||||
|
||||
---------------------------------------
|
||||
|
||||
@storeall
|
||||
|
||||
Places all inventory and equipped items directly into your Kafra Storage.
|
||||
|
@ -5960,6 +5960,62 @@ ACMD_FUNC(dropall)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*==========================================
|
||||
* @stockall by [Hanashi]
|
||||
* transfer items from cart to inventory
|
||||
*------------------------------------------*/
|
||||
ACMD_FUNC(stockall)
|
||||
{
|
||||
nullpo_retr(-1, sd);
|
||||
|
||||
if (!pc_iscarton(sd)) {
|
||||
clif_displaymessage(fd, msg_txt(sd,1533)); // You do not have a cart.
|
||||
return -1;
|
||||
}
|
||||
|
||||
int8 type = -1;
|
||||
if ( message[0] ) {
|
||||
type = atoi(message);
|
||||
switch (type) {
|
||||
case -1:
|
||||
case IT_HEALING:
|
||||
case IT_USABLE:
|
||||
case IT_ETC:
|
||||
case IT_WEAPON:
|
||||
case IT_ARMOR:
|
||||
case IT_CARD:
|
||||
case IT_PETEGG:
|
||||
case IT_PETARMOR:
|
||||
case IT_AMMO:
|
||||
break;
|
||||
|
||||
default:
|
||||
clif_displaymessage(fd, msg_txt(sd, 1534)); // Usage: @stockall {<type>}
|
||||
clif_displaymessage(fd, msg_txt(sd, 1493)); // Type List: (default) all = -1, healing = 0, usable = 2, etc = 3, armor = 4, weapon = 5, card = 6, petegg = 7, petarmor = 8, ammo = 10
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
uint16 count = 0, count2 = 0;
|
||||
for ( uint16 i = 0; i < MAX_CART; i++ ) {
|
||||
if ( sd->cart.u.items_cart[i].amount > 0 ) {
|
||||
std::shared_ptr<item_data> id = item_db.find(sd->cart.u.items_cart[i].nameid);
|
||||
if ( id == nullptr ) {
|
||||
ShowDebug("Non-existent item %u on stockall list (account_id: %d, char_id: %d)\n", sd->cart.u.items_cart[i].nameid, sd->status.account_id, sd->status.char_id);
|
||||
continue;
|
||||
}
|
||||
if ( type == -1 || static_cast<item_types>(type) == id->type ) {
|
||||
if (pc_getitemfromcart(sd, i, sd->cart.u.items_cart[i].amount))
|
||||
count += sd->cart.u.items_cart[i].amount;
|
||||
else
|
||||
count2 += sd->cart.u.items_cart[i].amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
sprintf(atcmd_output, msg_txt(sd,1535), count,count2); // %d items are transferred (%d skipped)!
|
||||
clif_displaymessage(fd, atcmd_output);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*==========================================
|
||||
* @storeall by [MouseJstr]
|
||||
* Put everything into storage
|
||||
@ -11078,6 +11134,7 @@ void atcommand_basecommands(void) {
|
||||
ACMD_DEF(npcmove),
|
||||
ACMD_DEF(killable),
|
||||
ACMD_DEF(dropall),
|
||||
ACMD_DEF(stockall),
|
||||
ACMD_DEF(storeall),
|
||||
ACMD_DEF(skillid),
|
||||
ACMD_DEF(useskill),
|
||||
|
@ -6567,17 +6567,17 @@ int pc_cartitem_amount(map_session_data* sd, int idx, int amount)
|
||||
/*==========================================
|
||||
* Retrieve an item at index idx from cart.
|
||||
*------------------------------------------*/
|
||||
void pc_getitemfromcart(map_session_data *sd,int idx,int amount)
|
||||
bool pc_getitemfromcart(map_session_data *sd,int idx,int amount)
|
||||
{
|
||||
nullpo_retv(sd);
|
||||
nullpo_retr(1, sd);
|
||||
|
||||
if (idx < 0 || idx >= MAX_CART) //Invalid index check [Skotlex]
|
||||
return;
|
||||
return false;
|
||||
|
||||
struct item *item_data=&sd->cart.u.items_cart[idx];
|
||||
|
||||
if (item_data->nameid == 0 || amount < 1 || item_data->amount < amount || sd->state.vending || sd->state.prevend)
|
||||
return;
|
||||
return false;
|
||||
|
||||
enum e_additem_result flag = pc_additem(sd, item_data, amount, LOG_TYPE_NONE);
|
||||
|
||||
@ -6588,6 +6588,7 @@ void pc_getitemfromcart(map_session_data *sd,int idx,int amount)
|
||||
clif_additem(sd, idx, amount, flag);
|
||||
clif_cart_additem(sd, idx, amount);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*==========================================
|
||||
|
@ -1438,7 +1438,7 @@ int pc_getcash( map_session_data *sd, int cash, int points, e_log_pick_type type
|
||||
enum e_additem_result pc_cart_additem(map_session_data *sd,struct item *item_data,int amount,e_log_pick_type log_type);
|
||||
void pc_cart_delitem(map_session_data *sd,int n,int amount,int type,e_log_pick_type log_type);
|
||||
void pc_putitemtocart(map_session_data *sd,int idx,int amount);
|
||||
void pc_getitemfromcart(map_session_data *sd,int idx,int amount);
|
||||
bool pc_getitemfromcart(map_session_data *sd,int idx,int amount);
|
||||
int pc_cartitem_amount(map_session_data *sd,int idx,int amount);
|
||||
|
||||
bool pc_takeitem(map_session_data *sd,struct flooritem_data *fitem);
|
||||
|
Loading…
x
Reference in New Issue
Block a user