forked from Watcher187/UWoWScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviptitle.cpp
144 lines (122 loc) · 4.48 KB
/
viptitle.cpp
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
//uw
#include "ScriptPCH.h"
#include <cstring>
#include "CharacterDatabaseCleaner.h"
#include "DatabaseEnv.h"
#include "ObjectMgr.h"
class npc_gmvendor : public CreatureScript
{
public:
npc_gmvendor() : CreatureScript("npc_gmvendor")
{
}
bool OnGossipHello(Player* pPlayer, Creature* pCreature)
{
if (pPlayer->GetSession()->GetSecurity() > SEC_PLAYER)
{
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Buy the Token.", GOSSIP_SENDER_MAIN, 3000);
pPlayer->PlayerTalkClass->SendGossipMenu(907, pCreature->GetGUID());
} else {
char str[200];
sprintf(str,"Your not a VIP, I cant sell to you!");
pPlayer->PlayerTalkClass->SendCloseGossip();
pCreature->MonsterWhisper("Your not a VIP, i cant sell to you $N!", pPlayer->GetGUID());
}
return true;
}
bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
{
pPlayer->PlayerTalkClass->ClearMenus();
char str[200];
switch (uiAction)
{
case 3000:
pPlayer->GetSession()->SendListInventory(pCreature->GetGUID());
break;
case 9999:
pPlayer->PlayerTalkClass->ClearMenus();
OnGossipHello(pPlayer, pCreature);
break;
}
return true;
}
};
class viptitle : public CreatureScript
{
public:
viptitle() : CreatureScript("viptitle")
{
}
void GiveTitle(Player* pPlayer, Creature* pCreature)
{
char str[200];
if (pPlayer->HasItemCount(82, 1))
{
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(1000);
pPlayer->DestroyItemCount(82, 1, true);
pPlayer->SetTitle(titleInfo);
sprintf(str,"You have been given the title <VIP>!");
pPlayer->MonsterWhisper(str,pPlayer->GetGUID(),true);
}
else
{
sprintf(str,"You need the VIP Title Token!");
pPlayer->MonsterWhisper(str,pPlayer->GetGUID(),true);
}
pPlayer->PlayerTalkClass->ClearMenus();
OnGossipHello(pPlayer, pCreature);
}
bool OnGossipHello(Player* pPlayer, Creature* pCreature)
{
if (pPlayer->GetSession()->GetSecurity() > SEC_PLAYER)
{
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Information about this system:", GOSSIP_SENDER_MAIN, 2000);
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Give me the title", GOSSIP_SENDER_MAIN, 1000);
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Buy the Token.", GOSSIP_SENDER_MAIN, 3000);
pPlayer->PlayerTalkClass->SendGossipMenu(907, pCreature->GetGUID());
} else {
char str[200];
sprintf(str,"Your not a VIP, I cant sell to you!");
pPlayer->PlayerTalkClass->SendCloseGossip();
pCreature->MonsterWhisper("Your not a VIP, i cant sell to you $N!", pPlayer->GetGUID());
}
return true;
}
bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
{
pPlayer->PlayerTalkClass->ClearMenus();
char str[200];
switch (uiAction)
{
case 1000:
pPlayer->PlayerTalkClass->ClearMenus();
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Convert 1 Title Token", GOSSIP_SENDER_MAIN, 1001);
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Return.", GOSSIP_SENDER_MAIN, 9999);
pPlayer->PlayerTalkClass->SendGossipMenu(907, pCreature->GetGUID());
return true;
break;
case 1001:
GiveTitle(pPlayer, pCreature);
break;
case 2000:
sprintf(str,"Buy the: <VIP> Token - And I will grant you a new title only for VIPs!");
pPlayer->MonsterWhisper(str,pPlayer->GetGUID(),true);
pPlayer->PlayerTalkClass->ClearMenus();
OnGossipHello(pPlayer, pCreature);
break;
case 3000:
pPlayer->GetSession()->SendListInventory(pCreature->GetGUID());
break;
case 9999:
pPlayer->PlayerTalkClass->ClearMenus();
OnGossipHello(pPlayer, pCreature);
break;
}
return true;
}
};
void AddSC_viptitle()
{
new viptitle();
new npc_gmvendor();
}