summaryrefslogtreecommitdiff
path: root/src/emap/craft.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-01-24 20:25:04 +0300
committerAndrei Karas <akaras@inbox.ru>2016-01-24 20:25:04 +0300
commit0537167c95056c57e926d4207c3f614b8382a797 (patch)
tree67c16d791d390aea9ac6eeba50dc915ae512dab6 /src/emap/craft.c
parentce563a50ff4997f4a3f1ccd8bd1fdec5708b3bff (diff)
downloadevol-hercules-0537167c95056c57e926d4207c3f614b8382a797.tar.gz
evol-hercules-0537167c95056c57e926d4207c3f614b8382a797.tar.bz2
evol-hercules-0537167c95056c57e926d4207c3f614b8382a797.tar.xz
evol-hercules-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.c9
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);