chore: simplify conversion of missionReward from PE+ #1018

Merged
Sainan merged 2 commits from reward-cleanup into main 2025-02-25 16:58:07 -08:00
Owner
No description provided.
Sainan added 2 commits 2025-02-25 14:20:19 -08:00
chore: missionReward.countedItems are never StoreItems, simplify this
All checks were successful
Build / build (18) (push) Successful in 37s
Build / build (22) (push) Successful in 33s
Build / build (20) (pull_request) Successful in 1m9s
Build / build (20) (push) Successful in 1m8s
Build / build (18) (pull_request) Successful in 1m4s
Build / build (22) (pull_request) Successful in 33s
33545acc0d
Owner

I would like to keep the current way as a sanity check.
Or at least warn about the case and throw or something.
If for some reason, the data should contain non store items, then the client will bug out receiving them as missionrewards.
So, the additional check doesn't harm and makes sure the items conform with the client's expected format.

I would like to keep the current way as a sanity check. Or at least warn about the case and throw or something. If for some reason, the data should contain non store items, then the client will bug out receiving them as missionrewards. So, the additional check doesn't harm and makes sure the items conform with the client's expected format.
Author
Owner

The additional check does harm because /StoreItems/ may be a substring of a non-StoreItem. Also if we assume the data is inaccurate, then we have a lot of other problems.

The additional check does harm because `/StoreItems/` may be a substring of a non-StoreItem. Also if we assume the data is inaccurate, then we have a lot of other problems.
Owner

The additional check does harm because /StoreItems/ may be a substring of a non-StoreItem. Also if we assume the data is inaccurate, then we have a lot of other problems.

Why would /StoreItems/ which is specifically the identifier of a storeitem be part of a non-store item.

AT LEAST we should throw when a non-store item is found

Sure, drop the additional logic, but make sure the case never happens, data will never be perfect.

> The additional check does harm because `/StoreItems/` may be a substring of a non-StoreItem. Also if we assume the data is inaccurate, then we have a lot of other problems. Why would /StoreItems/ which is specifically the identifier of a storeitem be part of a non-store item. AT LEAST we should throw when a non-store item is found Sure, drop the additional logic, but make sure the case never happens, data will never be perfect.
Author
Owner

Example: /Lotus/Types/StoreItems/AvatarImages/ImageGaussVED :)

I'd say the data is as close to perfect as it gets, it's just a matter of respecting the 'types'.

Example: `/Lotus/Types/StoreItems/AvatarImages/ImageGaussVED` :) I'd say the data is as close to perfect as it gets, it's just a matter of respecting the 'types'.
Owner

Example: /Lotus/Types/StoreItems/AvatarImages/ImageGaussVED :)

I'd say the data is as close to perfect as it gets, it's just a matter of respecting the 'types'.

But that's a store item.
I'm confused.

And in that case just the store item version would be returned, because it contains store item.
What am I missing, am I too tired?

> Example: `/Lotus/Types/StoreItems/AvatarImages/ImageGaussVED` :) > > I'd say the data is as close to perfect as it gets, it's just a matter of respecting the 'types'. But that's a store item. I'm confused. And in that case just the store item version would be returned, because it contains store item. What am I missing, am I too tired?
Author
Owner

That's not a store item. The store item for it is /Lotus/StoreItems/Types/StoreItems/AvatarImages/ImageGaussVED.

That's not a store item. The store item for it is `/Lotus/StoreItems/Types/StoreItems/AvatarImages/ImageGaussVED`.
Owner

well, it contains /storeitems/ so its a store item? :D
Why is it not a store item?

well, it contains /storeitems/ so its a store item? :D Why is it not a store item?
Author
Owner

That's exactly what I'm saying is wrong with the logic.

That's exactly what I'm saying is wrong with the logic.
Owner

Seems like this item does not have a non-store item counterpart. For some reason

Seems like this item does not have a non-store item counterpart. For some reason
Author
Owner

Bro.

  • Normal: /Lotus/Types/StoreItems/AvatarImages/ImageGaussVED
  • Store item: /Lotus/StoreItems/Types/StoreItems/AvatarImages/ImageGaussVED
Bro. - Normal: `/Lotus/Types/StoreItems/AvatarImages/ImageGaussVED` - Store item: `/Lotus/StoreItems/Types/StoreItems/AvatarImages/ImageGaussVED`
Owner

Bro.

  • Normal: /Lotus/Types/StoreItems/AvatarImages/ImageGaussVED
  • Store item: /Lotus/StoreItems/Types/StoreItems/AvatarImages/ImageGaussVED

Ah so im too tired
I think its a mistake in their data. oof

> Bro. > - Normal: `/Lotus/Types/StoreItems/AvatarImages/ImageGaussVED` > - Store item: `/Lotus/StoreItems/Types/StoreItems/AvatarImages/ImageGaussVED` Ah so im too tired I think its a mistake in their data. oof
Author
Owner

Yes, DE is wrong, it's surely not our code that's making stupid assumption.

Yes, DE is wrong, it's surely not our code that's making stupid assumption.
Owner

well, okey. if the data are bad, we are doomed to find more of these annoying bugs anyway.
KK. remove the logic.

well, okey. if the data are bad, we are doomed to find more of these annoying bugs anyway. KK. remove the logic.
Sainan merged commit 3945359e7d into main 2025-02-25 16:58:07 -08:00
Sainan deleted branch reward-cleanup 2025-02-25 16:58:07 -08:00
Owner

Yes, DE is wrong, it's surely not our code that's making stupid assumption.

you can't tell me you don't think that's a typing mistake.
the client's data have shown REPEATEDLY in the past how many syntax errors there are in the package, double properties, spelling mistakes in [Lotus/...] like ,Lotus/

Also, there are barely any cases like this, is it the only one?
I am 100% sure someone made an error there.

> Yes, DE is wrong, it's surely not our code that's making stupid assumption. you can't tell me you don't think that's a typing mistake. the client's data have shown REPEATEDLY in the past how many syntax errors there are in the package, double properties, spelling mistakes in [Lotus/...] like ,Lotus/ Also, there are barely any cases like this, is it the only one? I am 100% sure someone made an error there.
Author
Owner

It's not a mistake on DE's part, and it's not the only instance of this.

It's not a mistake on DE's part, and it's not the only instance of this.
Owner

If anything, this example shows, that we cannot just remove /storeItems/ and think its the normal non-store variant.
It shows we ALWAYS have to look up typeName.

If anything, this example shows, that we cannot just remove /storeItems/ and think its the normal non-store variant. It shows we ALWAYS have to look up typeName.
Author
Owner

It's fine, string.replace in JavaScript only replaces the first occurence so this generally works for us, and we have no correctness problems.

It's fine, string.replace in JavaScript only replaces the first occurence so this generally works for us, and we have no correctness problems.
Sign in to join this conversation.
No description provided.