aboutsummaryrefslogtreecommitdiff
path: root/src/scripts/custom/on_events.cpp
blob: eca1c266bf6f6aa3cd47e3196de490a0dd066105 (plain)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#include "ScriptedPch.h"
#include <cstring>

//This function is called when the player logs in (every login)
void OnLogin(Player *pPlayer)
{

}

//This function is called when the player logs out
void OnLogout(Player *pPlayer)
{

}

//This function is called when the player kills another player
void OnPVPKill(Player *killer, Player *killed)
{

}

//This function is called when a players AreaID changes
void OnAreaChange(Player *pPlayer, AreaTableEntry const *pArea)
{

}

//This is called when a player kills a creature (non pvp)
void OnCreatureKill(Player *pPlayer, Creature *pCreature)
{

}

//This function is called when a player has a money exchange
int32 OnGetMoney(Player *pPlayer, int32 amount)
{
    return amount;
}

//This function is called whenever a player gets XP
uint32 OnGetXP(Player *pPlayer, uint32 amount)
{
    return amount;
}

//This function is called when a player clicks a GO Object
bool OnGoClick(Player *pPlayer, GameObject *pGameObject)
{
    return true;
}

//This function is called when a player clicks and item
bool OnItemClick(Player *pPlayer, Item *pItem)
{
    return true;
}

//This function is called when a player opens an item (like a clam)
bool OnItemOpen(Player *pPlayer, Item *pItem)
{
    return true;
}

//This function is called when a player sends a chat message
bool OnPlayerChat(Player *pPlayer, const char *text)
{
    return true;
}

//this function is called when the server starts
void OnServerStartup()
{

}
//this function is called when the server shuts down
void OnServerShutdown()
{

}

//this function is called when a player casts a spell
bool OnSpellCast(Unit *pUnitTarget, Item *pItemTarget, GameObject *pGoTarget, uint32 i, SpellEntry const *spell)
{
    return true;
}

 void AddSC_onevents()
{
    Script *newscript;
    newscript = new Script;
    newscript->Name = "scripted_on_events";
    newscript->pOnLogin = &OnLogin;
    newscript->pOnLogout = &OnLogout;
    newscript->pOnPVPKill = &OnPVPKill;
    newscript->pOnAreaChange = &OnAreaChange;
    newscript->pOnCreatureKill = &OnCreatureKill;
    newscript->pOnGetMoney = &OnGetMoney;
    newscript->pOnGetXP = &OnGetXP;
    newscript->pOnGoClick = &OnGoClick;
    newscript->pOnItemClick = &OnItemClick;
    newscript->pOnItemOpen = &OnItemOpen;
    newscript->pOnPlayerChat = &OnPlayerChat;
    newscript->pOnServerShutdown = &OnServerShutdown;
    newscript->pOnServerStartup = &OnServerStartup;
    newscript->pOnSpellCast = &OnSpellCast;

    newscript->RegisterSelf();
}