blob: 974c86cf039b15b9ad703e203f9d81a3c671fcc1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
// Copyright (c) 2014 Evol developers
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../../../common/HPMi.h"
#include "../../../common/malloc.h"
#include "../../../common/mmo.h"
#include "../../../common/socket.h"
#include "../../../common/strlib.h"
#include "../../../map/battle.h"
#include "../../../map/itemdb.h"
#include "map/data/itemd.h"
#include "map/struct/itemdext.h"
struct ItemdExt *itemd_get_by_item(struct item *item)
{
if (!item)
return NULL;
const int nameid = item->nameid;
struct item_data *item_data = itemdb->exists(nameid);
return itemd_get(item_data);
}
struct ItemdExt *itemd_get(struct item_data *item)
{
if (!item)
return NULL;
struct ItemdExt *data = getFromITEMDATA(item, 0);
if (!data)
{
data = itemd_create();
addToITEMDATA(item, data, 0, true);
}
return data;
}
struct ItemdExt *itemd_create(void)
{
struct ItemdExt *data = NULL;
CREATE(data, struct ItemdExt, 1);
if (!data)
return NULL;
data->floorLifeTime = battle->bc->flooritem_lifetime;
data->allowPickup = true;
data->requiredStr = 0;
data->requiredAgi = 0;
data->requiredVit = 0;
data->requiredInt = 0;
data->requiredDex = 0;
data->requiredLuk = 0;
data->requiredMaxHp = 0;
data->requiredMaxSp = 0;
data->requiredAtk = 0;
data->requiredMAtkMin = 0;
data->requiredMAtkMax = 0;
data->requiredDef = 0;
data->requiredMDef = 0;
return data;
}
|