summaryrefslogtreecommitdiff
path: root/src/emap/data/skilld.c
blob: d2c355b8a084e23d06dc580c127cc1c7c516e3bf (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
// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
// Copyright (c) 2014 - 2015 Evol developers

#include "common/hercules.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "common/HPMi.h"
#include "common/memmgr.h"
#include "common/mmo.h"
#include "common/nullpo.h"
#include "common/socket.h"
#include "common/strlib.h"
#include "map/skill.h"

#include "emap/data/skilld.h"
#include "emap/struct/skilldext.h"

struct SkilldExt skilld_arr[MAX_SKILL_DB];

void skilld_init(void)
{
    for (int f = 0; f < MAX_SKILL_DB; f ++)
    {
        for (int d = 0; d < SKILLD_MAXMISCEFFECTS; d ++)
        {
            skilld_arr[f].miscEffects[d] = -1;
        }
    }
}

struct SkilldExt *skilld_get(const int idx)
{
    Assert_retr(NULL, idx >= 0 && idx < MAX_SKILL_DB);
    return &skilld_arr[idx];
}

struct SkilldExt *skilld_get_id(const int skill_id)
{
    Assert_retr(NULL, skill_id >= 0 && skill_id < MAX_SKILL_ID);
    return &skilld_arr[skill->get_index(skill_id)];
}

int skilld_get_misceffect(const int skill_id,
                          const int effect_idx)
{
    Assert_retr(-1, skill_id >= 0 && skill_id < MAX_SKILL_ID);
    Assert_retr(-1, effect_idx >= 0 && effect_idx < SKILLD_MAXMISCEFFECTS);
    return skilld_arr[skill->get_index(skill_id)].miscEffects[effect_idx];
}