MHWDB-API icon indicating copy to clipboard operation
MHWDB-API copied to clipboard

Add Item Rewards to Events

Open DeveloperPaul123 opened this issue 4 years ago • 4 comments

I think it would be interesting to add a way to include item drops to events in the API. I'm not sure about the implementation details since the information is scraped, but special rewards could certainly be added via the contribution site.

This would make it easier to filter which events give special rewards which can then be linked to what those special items are used to craft.

DeveloperPaul123 avatar Feb 04 '20 02:02 DeveloperPaul123

It would probably require a refactoring of how event data is stored. Since it's scraped, there's no persistent data between events. Each time range is its own object in the database, and none of the information is shared. Which means that even if it was possible to add extra information via the contrib site, it would be thrown away when the event cycle ends and would need to be re-added the next time the event came around.

What I could do is separate it into two parts: the event data and an event schedule. Each item in the schedule could relate to an event object, meaning that any manually added event data could be re-used next time the event rolls around.

So basically:

Endpoints: /events, /events/<id> Persistent event information, such as rewards, rank, success conditions, etc.

{
	"id": 1,
	"name": "50 Shades of White",
	"location": 10,
	"zennyReward": 25200,
	"rewards": [
		{
			"id": 1196,
			"name": "Fest Ticket",
			"...": "..."
		}
	],
	"monsters": [
		{
			"id": 59,
			"name": "Barioth",
			"...": "..."
		}
	],
	"exclusive": null,
	"questRank": 3,
	"masterRank": true,
	"timeLimit": 50,
        "...": "..."
}

Endpoints: /events/schedule, /events/schedule/<id> Current event schedule, as scraped from the official event pages. These endpoints would essentially be what's currently at /events, but relates to the persistent event objects, instead of storing their own data.

[
	{
		"id": 174,
		"event": {
			"id": 1,
			"name": "50 Shades of White",
			"location": 10,
			"zennyReward": 25200,
			"rewards": [
				{
					"id": 1196,
					"name": "Fest Ticket",
					"...": "..."
				}
			],
			"...": "..."
		},
		"platform": "pc",
		"startTimestamp": "2020-01-17T00:00:00+0000",
		"endTimestamp": "2020-02-20T23:59:00+0000"
	}
]

LartTyler avatar Feb 04 '20 22:02 LartTyler

That seems like a good approach to me!

DeveloperPaul123 avatar Feb 05 '20 02:02 DeveloperPaul123

Actually, thinking through it a bit more, it might be better to add a quests endpoint and add the event quests there and give then an event type of quest.

Here is a starter data set for MHW quests. This can also serve as a way to address other issues that have be filed regarding "item data fluff".

DeveloperPaul123 avatar Feb 05 '20 02:02 DeveloperPaul123

I think I like that idea a lot more. I had planned on adding quests in the future anyway, and merging the two together would prevent a bunch of duplicate code.

LartTyler avatar Feb 05 '20 21:02 LartTyler