Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Extend #parcels Command #4351

Closed
wants to merge 6 commits into from
Closed

Conversation

Kinglykrab
Copy link
Contributor

@Kinglykrab Kinglykrab commented May 27, 2024

Description

  • Add support for item links and augments to existing #parcels add subcommand.
  • Remove references to an unimplemented #parcels details subcommand.

Type of Change

  • New feature

Testing

image
image
image
image
image

Checklist

  • I have tested my changes
  • I have performed a self-review of my code. Ensuring variables, functions and methods are named in a human-readable way, comments are added only where naming of variables, functions and methods can't give enough context.
  • I own the changes of my code and take responsibility for the potential issues that occur

@Kinglykrab Kinglykrab changed the title [Command] Add #send_parcel Command [Feature] Extend #parcels Command May 28, 2024
@Kinglykrab Kinglykrab requested a review from neckkola May 28, 2024 17:29
@neckkola
Copy link
Contributor

neckkola commented Jun 4, 2024

Good evening @Kinglykrab

I ran a few tests and would highlight a few items for your consideration.

Item #1 - As seen below The Ak'Anon Report Vol 9. No 10. shows a quantity of 0. Should be 1.
Item #2 - Should probably add (copper) to the end of money.
Item #3 - The item link for money shows (1c) even though it is 1000c/1p
parcelerror1

Item #4 - #parcels 99990 1000 32 does not produce the note. It appears that the note must contain a non-numeric value. #parcels 99990 1000 32s works for example.

Item #5 - #parcels add Rola ItemLink 1 note returns the #parcel syntax and does not add the parcel. Command is noted below.
parcelerror2

Item #6 - #parcels add Rola 6941 1 85490 85490 Note sends the parcel and shows the Fine Steel Jute with the augment in slot 4, and in slot 20 even though the augment is not for those slots. Likely need to do some checks to ensure we don't end up with erroneous items. The resulting item is unusable until the augment is removed.

I would suggest some more testing.

c->MessageString(Chat::Yellow, CANT_FIND_PLAYER, player_name.c_str());
return;
}
const std::string& to_name = sep->arg[2];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the & required here?

return;
}
if (!sep->IsNumber(3)) {
const std::string& cmd_msg = sep->msg;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing here, though I am not positive. You likely know better than I.

if (item_id == PARCEL_MONEY_ITEM_ID) {
if (quantity > INT32_MAX) {
if (quantity > std::numeric_limits<int>::max()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kingly, is there an advantage of using std::numeric_limit over the define in limits.h of INT32_MAX? Curious if there is an advantage from one over the other. Perhaps the compiler replaces them both anyways?

}

auto item = database.GetItem(PARCEL_MONEY_ITEM_ID);
if (!item) {
c->Message(Chat::Yellow, "Could not find item with id {}", item_id);
c->Message(Chat::White, "Item ID {} does not exist.", item_id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there standards as to which color is for what? Yellow vs white? And the syntax of the messages?

augment_ids[3],
augment_ids[4],
augment_ids[5]
);
Copy link
Contributor

@neckkola neckkola Jun 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the change to CreateItem, instead of GetItem, 'item' will need to be deleted at all the right places or it will cause a leak I believe. I would suggest using a unique_ptr so that you don't need to worry about the deletes.


for (auto const& p: results) {
const auto* item = database.CreateItem(
p.item_id,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same delete/unique_ptr concern


for (auto const& p : parcels) {
const auto* item = database.CreateItem(
p.second.item_id,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete/ptr concern

Copy link
Contributor

@neckkola neckkola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kinglykrab Provided a few comments for your consideration. I did not highlight all the string& items as I am not sure it makes a difference. Perhaps someone else can comment on those. Thanks for the chance to review. I can re-test after you have a chance to consider the comments, just let me know.

@Akkadius
Copy link
Member

Still has pending feedback

@Kinglykrab Kinglykrab closed this Jul 3, 2024
@Kinglykrab Kinglykrab deleted the commands/send_parcel_add branch July 8, 2024 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants