diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-01-24 20:25:04 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-01-24 20:25:04 +0300 |
commit | 0537167c95056c57e926d4207c3f614b8382a797 (patch) | |
tree | 67c16d791d390aea9ac6eeba50dc915ae512dab6 /src/emap/craft.c | |
parent | ce563a50ff4997f4a3f1ccd8bd1fdec5708b3bff (diff) | |
download | plugin-0537167c95056c57e926d4207c3f614b8382a797.tar.gz plugin-0537167c95056c57e926d4207c3f614b8382a797.tar.bz2 plugin-0537167c95056c57e926d4207c3f614b8382a797.tar.xz plugin-0537167c95056c57e926d4207c3f614b8382a797.zip |
In craft.conf add support for multyply "CreteItems" groups. Will be used random group.
Diffstat (limited to 'src/emap/craft.c')
-rw-r--r-- | src/emap/craft.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/emap/craft.c b/src/emap/craft.c index 7081911..e8e2cdd 100644 --- a/src/emap/craft.c +++ b/src/emap/craft.c @@ -730,8 +730,13 @@ static bool craft_delete_items(TBL_PC *sd, } static bool craft_create_items(TBL_PC *sd, - struct craft_items_collection *vector) + struct craft_db_entry *entry) { + // +++ for now used 0 index, but need select random + const int vars = VECTOR_LENGTH(entry->create_items); + struct craft_items_collection *vector = &VECTOR_INDEX(entry->create_items, + (rand() % (vars * 10)) / 10); + int len = VECTOR_LENGTH(*vector); int i; if (len > 0) @@ -828,7 +833,7 @@ bool craft_use(TBL_PC *sd, } sd->status.zeny -= entry->price; - craft_create_items(sd, &entry->create_items); + craft_create_items(sd, entry); clif->updatestatus(sd, SP_ZENY); clif->updatestatus(sd, SP_WEIGHT); |