ko icon indicating copy to clipboard operation
ko copied to clipboard

Adding MAKE_ITEM_GROUP

Open UTengine opened this issue 1 year ago • 8 comments

Search before asking

  • [X] I searched the issues and found no similar issues.

Description

We need to make an item_group array that gets data from the database (DoFieldExchange(CFieldExchange), then tie it to AIServer npc.cpp. Openko has implemented this, here is a link that serves as an example.

_MAKE_ITEM_GROUP * pGroup = g_pMain->m_MakeItemGroupArray.GetData(pItem->iItem[j]); https://github.com/srmeier/KnightOnline/blob/80268e2fa971389a3e94c430966a7943c2631dbf/Server/AIServer/Npc.cpp#L3389

Use case

Item_groups consist of around 30 columns of drops that ties it to the monster item drop's. Currently we are missing out on a lot of drops. image image

Are you willing to work on and submit a PR to address the issue?

  • [ ] Yes I am willing to submit a PR!

UTengine avatar Aug 06 '24 17:08 UTengine

What do you think about improving the item_group a bit so that in this table we could also set the drop percentage for each of the 30 items? This way, we would have greater control over the drop in the item group. What do you think ?

xGuTeK avatar Nov 15 '24 05:11 xGuTeK

I wouldn't mind but this is typical korean RNG. If we add specific drop rates in there it will require additional work not just code but also DB wise. But if you want to go for it it's not a bad idea tbh.

UTengine avatar Nov 16 '24 00:11 UTengine

@xGuTeK I like the idea, the more control, the better. However we need to think on some scenarios. What would the table layout looks like? that means now instead of 30 columns, we got 60? and what precedent? The ITEM_GROUP percent or the K_MONSTER_ITEM?

stevewgr avatar Nov 17 '24 00:11 stevewgr

@stevewgr

The item_group table will have 61 columns:

groupindex
iItem_01 to iItem_30
sPercent_01 to sPercent_30

In the k_monster_item table, item groups are simply assigned lower IDs. For example, if the items consist of a 9-digit number, the item groups will have IDs with a maximum of 8 digits.

The sPercent will represent the length of the range for each item. Here's how it works:

If iItem_01 has sPercent_01 set to 200, the range for the first item will be from 1 to 200.
If iItem_02 has sPercent_02 set to 100, the range for the second item will be from 201 to 300.
If iItem_03 has sPercent_03 set to 111, the range for the third item will be from 301 to 411.

The server will then generate a random number within the total range and select the item based on where that number falls:

1–200 → iItem_01
201–300 → iItem_02
301–411 → iItem_03

xGuTeK avatar Nov 17 '24 01:11 xGuTeK

Sounds great. We can work and shape this idea further through a PR, something that we can test and try out, because I might not fully get the idea behind this due to the lack of my understanding about item drops, but the way you describe it, it sounds like something simple to implement.

I can see where this idea can really shine, is when we want within the 30 items in the item group to set one very special item to 1%, like GM trophy or something 😆

stevewgr avatar Nov 17 '24 01:11 stevewgr

I almost finished it ;)

xGuTeK avatar Nov 17 '24 02:11 xGuTeK

tbh it should just randomly select one from the row, this requires so much work db wise

UTengine avatar Apr 09 '25 17:04 UTengine

tbh it should just randomly select one from the row, this requires so much work db wise

If I remember correctly, I set the default value for the percentage field to 1 and allowed leaving this field empty. This way, when adding a new row, these fields are automatically set to 1, and the system works by randomly selecting one from the rows

xGuTeK avatar Apr 11 '25 11:04 xGuTeK