mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-26 19:47:16 +00:00
Allow inventory give to specific ID slots
This commit is contained in:
+13
-11
@@ -4142,7 +4142,7 @@ bool Bot::AddBotToGroup(Bot* bot, Group* group) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Completes a trade with a client bot owner
|
// Completes a trade with a client bot owner
|
||||||
void Bot::FinishTrade(Client* client, BotTradeType trade_type)
|
void Bot::FinishTrade(Client* client, BotTradeType trade_type, int16 chosen_slot)
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
!client ||
|
!client ||
|
||||||
@@ -4166,7 +4166,7 @@ void Bot::FinishTrade(Client* client, BotTradeType trade_type)
|
|||||||
else if (trade_type == BotTradeClientNoDropNoTrade) {
|
else if (trade_type == BotTradeClientNoDropNoTrade) {
|
||||||
// Items being traded are found on the Client's cursor slot, slot id 30. This item can be either a single item or it can be a bag.
|
// Items being traded are found on the Client's cursor slot, slot id 30. This item can be either a single item or it can be a bag.
|
||||||
// If it is a bag, then we have to search for items in slots 331 thru 340
|
// If it is a bag, then we have to search for items in slots 331 thru 340
|
||||||
PerformTradeWithClient(EQ::invslot::slotCursor, EQ::invslot::slotCursor, client);
|
PerformTradeWithClient(EQ::invslot::slotCursor, EQ::invslot::slotCursor, client, chosen_slot);
|
||||||
|
|
||||||
// TODO: Add logic here to test if the item in SLOT_CURSOR is a container type, if it is then we need to call the following:
|
// TODO: Add logic here to test if the item in SLOT_CURSOR is a container type, if it is then we need to call the following:
|
||||||
// PerformTradeWithClient(331, 340, client);
|
// PerformTradeWithClient(331, 340, client);
|
||||||
@@ -4174,7 +4174,7 @@ void Bot::FinishTrade(Client* client, BotTradeType trade_type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Perfoms the actual trade action with a client bot owner
|
// Perfoms the actual trade action with a client bot owner
|
||||||
void Bot::PerformTradeWithClient(int16 begin_slot_id, int16 end_slot_id, Client* client)
|
void Bot::PerformTradeWithClient(int16 begin_slot_id, int16 end_slot_id, Client* client, int16 chosen_slot)
|
||||||
{
|
{
|
||||||
using namespace EQ;
|
using namespace EQ;
|
||||||
|
|
||||||
@@ -4194,14 +4194,16 @@ void Bot::PerformTradeWithClient(int16 begin_slot_id, int16 end_slot_id, Client*
|
|||||||
ClientReturn(ItemInstance* item, int16 from) : return_item_instance(item), from_bot_slot(from) { }
|
ClientReturn(ItemInstance* item, int16 from) : return_item_instance(item), from_bot_slot(from) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int16 bot_equip_order[invslot::EQUIPMENT_COUNT] = {
|
std::vector<int16> bot_equip_order;
|
||||||
invslot::slotCharm, invslot::slotEar1, invslot::slotHead, invslot::slotFace,
|
|
||||||
invslot::slotEar2, invslot::slotNeck, invslot::slotShoulders, invslot::slotArms,
|
if (chosen_slot != INVALID_INDEX) {
|
||||||
invslot::slotBack, invslot::slotWrist1, invslot::slotWrist2, invslot::slotRange,
|
bot_equip_order.emplace_back(chosen_slot);
|
||||||
invslot::slotHands, invslot::slotPrimary, invslot::slotSecondary, invslot::slotFinger1,
|
}
|
||||||
invslot::slotFinger2, invslot::slotChest, invslot::slotLegs, invslot::slotFeet,
|
else {
|
||||||
invslot::slotWaist, invslot::slotPowerSource, invslot::slotAmmo
|
for (int16 i = 0; i < invslot::EQUIPMENT_COUNT; ++i) {
|
||||||
};
|
bot_equip_order.push_back(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
enum { stageStackable = 0, stageEmpty, stageReplaceable };
|
enum { stageStackable = 0, stageEmpty, stageReplaceable };
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -281,7 +281,7 @@ public:
|
|||||||
void SetLevel(uint8 in_level, bool command = false) override;
|
void SetLevel(uint8 in_level, bool command = false) override;
|
||||||
void FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) override;
|
void FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) override;
|
||||||
bool Process() override;
|
bool Process() override;
|
||||||
void FinishTrade(Client* client, BotTradeType trade_type);
|
void FinishTrade(Client* client, BotTradeType trade_type, int16 chosen_slot = INVALID_INDEX);
|
||||||
bool Save() override;
|
bool Save() override;
|
||||||
void Depop();
|
void Depop();
|
||||||
void CalcBotStats(bool showtext = true);
|
void CalcBotStats(bool showtext = true);
|
||||||
@@ -1068,7 +1068,7 @@ protected:
|
|||||||
void BotMeditate(bool is_sitting);
|
void BotMeditate(bool is_sitting);
|
||||||
bool CheckBotDoubleAttack(bool triple_attack = false);
|
bool CheckBotDoubleAttack(bool triple_attack = false);
|
||||||
bool CheckTripleAttack();
|
bool CheckTripleAttack();
|
||||||
void PerformTradeWithClient(int16 begin_slot_id, int16 end_slot_id, Client* client);
|
void PerformTradeWithClient(int16 begin_slot_id, int16 end_slot_id, Client* client, int16 chosen_slot = INVALID_INDEX);
|
||||||
bool AIDoSpellCast(int32 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgainBefore = nullptr) override;
|
bool AIDoSpellCast(int32 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgainBefore = nullptr) override;
|
||||||
|
|
||||||
BotCastingRoles& GetCastingRoles() { return m_CastingRoles; }
|
BotCastingRoles& GetCastingRoles() { return m_CastingRoles; }
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ void bot_command_inventory_give(Client* c, const Seperator* sep)
|
|||||||
c->Message(
|
c->Message(
|
||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"Usage: {} ([actionable: target | byname] ([actionable_name]))",
|
"Usage: {} ([actionable: target | byname] ([actionable_name])) [optional: slot ID]",
|
||||||
sep->arg[0]
|
sep->arg[0]
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
@@ -33,19 +33,45 @@ void bot_command_inventory_give(Client* c, const Seperator* sep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ab_mask = (ActionableBots::ABM_Target | ActionableBots::ABM_ByName);
|
int ab_mask = (ActionableBots::ABM_Target | ActionableBots::ABM_ByName);
|
||||||
|
int ab_arg = 1;
|
||||||
|
int slot_arg = 1;
|
||||||
|
int16 chosen_slot = INVALID_INDEX;
|
||||||
|
bool byname = false;
|
||||||
|
|
||||||
|
std::string byname_arg = sep->arg[ab_arg];
|
||||||
|
|
||||||
|
if (!byname_arg.compare("byname")) {
|
||||||
|
byname = true;
|
||||||
|
slot_arg = ab_arg + 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sep->IsNumber(slot_arg)) {
|
||||||
|
chosen_slot = atoi(sep->arg[slot_arg]);
|
||||||
|
|
||||||
|
if (!byname) {
|
||||||
|
++ab_arg;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!EQ::ValueWithin(chosen_slot, EQ::invslot::POSSESSIONS_BEGIN, EQ::invslot::POSSESSIONS_END)) {
|
||||||
|
c->Message(Chat::Yellow, "Please enter a valid inventory slot.");
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<Bot*> sbl;
|
std::vector<Bot*> sbl;
|
||||||
if (ActionableBots::PopulateSBL(c, sep->arg[1], sbl, ab_mask, sep->arg[2]) == ActionableBots::ABT_None) {
|
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, sep->arg[ab_arg + 1]) == ActionableBots::ABT_None) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto my_bot = sbl.front();
|
auto my_bot = sbl.front();
|
||||||
if (!my_bot) {
|
if (!my_bot) {
|
||||||
c->Message(Chat::White, "ActionableBots returned 'nullptr'");
|
c->Message(Chat::Yellow, "ActionableBots returned 'nullptr'");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
my_bot->FinishTrade(c, Bot::BotTradeClientNoDropNoTrade);
|
my_bot->FinishTrade(c, Bot::BotTradeClientNoDropNoTrade, chosen_slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bot_command_inventory_list(Client* c, const Seperator* sep)
|
void bot_command_inventory_list(Client* c, const Seperator* sep)
|
||||||
|
|||||||
Reference in New Issue
Block a user