summaryrefslogtreecommitdiff
path: root/src/map/npc.hpp
blob: 50cfaa541d06a2ff81c04c705ced86a4c06aefe6 (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
65
66
67
68
69
70
#ifndef NPC_HPP
#define NPC_HPP

#include <cstddef>
#include <cstdint>

constexpr int START_NPC_NUM = 110000000;

constexpr int WARP_CLASS = 45;
constexpr int WARP_DEBUG_CLASS = 722;
constexpr int INVISIBLE_CLASS = 32767;

int npc_event_dequeue(struct map_session_data *sd);
int npc_event(struct map_session_data *sd, const char *npcname, int);
int npc_timer_event(const char *eventname);   // Added by RoVeRT
int npc_command(struct map_session_data *sd, const char *npcname, const char *command);
int npc_touch_areanpc(struct map_session_data *, int, int, int);
int npc_click(struct map_session_data *, int);
int npc_scriptcont(struct map_session_data *, int);
int npc_buysellsel(struct map_session_data *, int, int);
int npc_buylist(struct map_session_data *, int, const uint16_t *);
int npc_selllist(struct map_session_data *, int, const uint16_t *);
int npc_parse_warp(const char *w1, const char *w2, const char *w3, const char *w4);

int npc_enable(const char *name, bool flag);
struct npc_data *npc_name2id(const char *name);

int npc_get_new_npc_id(void);

/**
 * Spawns and installs a talk-only NPC
 *
 * \param message The message to speak.  If message is NULL, the NPC will not do anything at all.
 */
struct npc_data *npc_spawn_text(int m, int x, int y, int class_, const char *name, const char *message);    // message is strdup'd within

/**
 * Uninstalls and frees an NPC
 */
void npc_free(struct npc_data *npc);

void npc_addsrcfile(const char *);
void npc_delsrcfile(const char *);
int do_init_npc(void);
int npc_event_do_oninit(void);
int npc_do_ontimer(int, struct map_session_data *, int);

struct argrec;
int npc_event_doall_l(const char *name, int rid,
        int argc, struct argrec *argv);
int npc_event_do_l(const char *name, int rid,
        int argc, struct argrec *argv);
inline
int npc_event_doall(const char *name)
{
    return npc_event_doall_l(name, 0, 0, NULL);
}
inline
int npc_event_do(const char *name)
{
    return npc_event_do_l(name, 0, 0, NULL);
}

int npc_timerevent_start(struct npc_data *nd);
int npc_timerevent_stop(struct npc_data *nd);
int npc_gettimerevent_tick(struct npc_data *nd);
int npc_settimerevent_tick(struct npc_data *nd, int newtimer);
int npc_delete(struct npc_data *nd);

#endif // NPC_HPP