SHOW:
|
|
- or go back to the newest paste.
1 | /* | |
2 | * Made By ??? | |
3 | * Error Fixed By Rochet2 | |
4 | * Released By Ghostcrawler | |
5 | * Edit by Yvoms | |
6 | */ | |
7 | ||
8 | ||
9 | #include "ScriptMgr.h" | |
10 | #include "ObjectMgr.h" | |
11 | #include "MapManager.h" | |
12 | #include "Chat.h" | |
13 | #include "Common.h" | |
14 | #include "Language.h" | |
15 | #include "CellImpl.h" | |
16 | #include "GridNotifiers.h" | |
17 | ||
18 | class vipcommands : public CommandScript | |
19 | { | |
20 | public: | |
21 | vipcommands() : CommandScript("vipcommands") { } | |
22 | ||
23 | ChatCommand* GetCommands() const | |
24 | { | |
25 | static ChatCommand vipCommandTable[] = | |
26 | ||
27 | { | |
28 | { "island", SEC_PLAYER, true, &HandleVipMallCommand, "", NULL }, | |
29 | { "changerace", SEC_PLAYER, false, &HandleChangeRaceCommand, "", NULL }, | |
30 | { "changefaction", SEC_PLAYER, false, &HandleChangeFactionCommand, "", NULL }, | |
31 | { "maxskills", SEC_PLAYER, false, &HandleMaxSkillsCommand, "", NULL }, | |
32 | { "customize", SEC_PLAYER, false, &HandleCustomizeCommand, "", NULL }, | |
33 | { "tele", SEC_PLAYER, false, &HandleTeleCommand, "", NULL }, | |
34 | { "morph", SEC_PLAYER, false, &HandleMorphCommand, "", NULL }, | |
35 | { "buffs", SEC_PLAYER, false, &HandleBuffCommand, "", NULL }, | |
36 | { "activate", SEC_PLAYER, false, &HandleActivateCommand, "", NULL }, | |
37 | { "getdrunk", SEC_PLAYER, false, &HandleGetDrunkCommand, "", NULL }, | |
38 | { "soberup", SEC_PLAYER, false, &HandleSoberUpCommand, "", NULL }, | |
39 | { "respawn", SEC_PLAYER, false, &HandleRespawnCommand, "", NULL }, | |
40 | ||
41 | { NULL, 0, false, NULL, "", NULL } | |
42 | }; | |
43 | static ChatCommand commandTable[] = | |
44 | { | |
45 | { "vip", SEC_PLAYER, true, NULL, "", vipCommandTable}, | |
46 | { NULL, 0, false, NULL, "", NULL } | |
47 | }; | |
48 | return commandTable; | |
49 | } | |
50 | ||
51 | static bool HandleActivateCommand(ChatHandler * handler, const char * args) | |
52 | { | |
53 | Player* player = handler->GetSession()->GetPlayer(); | |
54 | ||
55 | if(player->GetSession()->GetSecurity() >= 1) | |
56 | { | |
57 | handler->PSendSysMessage("You already got VIP rank."); | |
58 | handler->SetSentErrorMessage(true); | |
59 | return false; | |
60 | } | |
61 | ||
62 | if(player->HasItemCount(313370, 1, false)) // Token ID, Count. | |
63 | { | |
64 | PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT_ACCESS); | |
65 | stmt->setUInt32(0, player->GetSession()->GetAccountId()); | |
66 | stmt->setUInt8(1, 1); | |
67 | stmt->setInt32(2, 1); | |
68 | LoginDatabase.Execute(stmt); | |
69 | player->DestroyItemCount(313370, 1, true, false); // Token ID, Count. | |
70 | handler->PSendSysMessage("Your VIP rank has been updated.Login to get it active"); | |
71 | return true; | |
72 | } | |
73 | return true; | |
74 | } | |
75 | ||
76 | static bool HandleTeleCommand(ChatHandler* handler, const char* args) | |
77 | { | |
78 | if (!*args) | |
79 | return false; | |
80 | ||
81 | Player* me = handler->GetSession()->GetPlayer(); | |
82 | ||
83 | // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r | |
84 | GameTele const* tele = handler->extractGameTeleFromLink((char*)args); | |
85 | ||
86 | if (!tele) | |
87 | { | |
88 | handler->SendSysMessage(LANG_COMMAND_TELE_NOTFOUND); | |
89 | handler->SetSentErrorMessage(true); | |
90 | return false; | |
91 | } | |
92 | ||
93 | if (me->isInCombat()) | |
94 | { | |
95 | handler->SendSysMessage(LANG_YOU_IN_COMBAT); | |
96 | handler->SetSentErrorMessage(true); | |
97 | return false; | |
98 | } | |
99 | ||
100 | MapEntry const* map = sMapStore.LookupEntry(tele->mapId); | |
101 | if (!map || map->IsBattlegroundOrArena()) | |
102 | { | |
103 | handler->SendSysMessage(LANG_CANNOT_TELE_TO_BG); | |
104 | handler->SetSentErrorMessage(true); | |
105 | return false; | |
106 | } | |
107 | ||
108 | // stop flight if need | |
109 | if (me->isInFlight()) | |
110 | { | |
111 | me->GetMotionMaster()->MovementExpired(); | |
112 | me->CleanupAfterTaxiFlight(); | |
113 | } | |
114 | // save only in non-flight case | |
115 | else | |
116 | me->SaveRecallPosition(); | |
117 | ||
118 | me->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation); | |
119 | return true; | |
120 | } | |
121 | ||
122 | ||
123 | static bool HandleBuffCommand(ChatHandler * handler, const char * args) | |
124 | { | |
125 | Player * pl = handler->GetSession()->GetPlayer(); | |
126 | if(pl->isInCombat()) | |
127 | { | |
128 | pl->GetSession()->SendNotification("You can't use this in combat!"); | |
129 | return false; | |
130 | } | |
131 | if(pl->InArena()) | |
132 | { | |
133 | pl->GetSession()->SendNotification("You can't use that item in an arena match!"); | |
134 | return false; | |
135 | } | |
136 | else | |
137 | pl->AddAura(48162, pl); | |
138 | pl->AddAura(48074, pl); | |
139 | pl->AddAura(48170, pl); | |
140 | pl->AddAura(43223, pl); | |
141 | pl->AddAura(36880, pl); | |
142 | pl->AddAura(467, pl); | |
143 | pl->AddAura(69994, pl); | |
144 | pl->AddAura(48469, pl); | |
145 | handler->PSendSysMessage("You have been buffed, enjoy!"); | |
146 | return true; | |
147 | ||
148 | } | |
149 | ||
150 | ||
151 | static bool HandlevipCommand(ChatHandler* handler, const char* args) | |
152 | { | |
153 | ||
154 | Player* me = handler->GetSession()->GetPlayer(); | |
155 | ||
156 | me->Say("vip command?", LANG_UNIVERSAL); | |
157 | return true; | |
158 | } | |
159 | ||
160 | static bool HandleMorphCommand(ChatHandler* handler, const char* args) | |
161 | { | |
162 | handler->GetSession()->GetPlayer()->SetDisplayId((uint32)atol((char*)args)); | |
163 | return true; | |
164 | } | |
165 | ||
166 | static bool HandleChangeRaceCommand(ChatHandler* handler, const char* args) | |
167 | { | |
168 | ||
169 | Player* me = handler->GetSession()->GetPlayer(); | |
170 | me->SetAtLoginFlag(AT_LOGIN_CHANGE_RACE); | |
171 | handler->PSendSysMessage("Relog to change race of your character."); | |
172 | return true; | |
173 | } | |
174 | ||
175 | static bool HandleChangeFactionCommand(ChatHandler* handler, const char* args) | |
176 | { | |
177 | ||
178 | Player* me = handler->GetSession()->GetPlayer(); | |
179 | me->SetAtLoginFlag(AT_LOGIN_CHANGE_FACTION); | |
180 | handler->PSendSysMessage("Relog to change faction of your character."); | |
181 | return true; | |
182 | } | |
183 | ||
184 | static bool HandleMaxSkillsCommand(ChatHandler* handler, const char* args) | |
185 | { | |
186 | ||
187 | Player* me = handler->GetSession()->GetPlayer(); | |
188 | me->UpdateSkillsForLevel(); | |
189 | handler->PSendSysMessage("Your weapon skills are now maximized."); | |
190 | return true; | |
191 | } | |
192 | ||
193 | static bool HandleCustomizeCommand(ChatHandler* handler, const char* args) | |
194 | { | |
195 | ||
196 | Player* me = handler->GetSession()->GetPlayer(); | |
197 | me->SetAtLoginFlag(AT_LOGIN_CUSTOMIZE); | |
198 | handler->PSendSysMessage("Relog to customize your character."); | |
199 | return true; | |
200 | } | |
201 | ||
202 | static bool HandleVipMallCommand(ChatHandler* handler, const char* args) | |
203 | { | |
204 | ||
205 | Player* me = handler->GetSession()->GetPlayer(); | |
206 | ||
207 | if (me->isInCombat()) | |
208 | { | |
209 | handler->SendSysMessage(LANG_YOU_IN_COMBAT); | |
210 | handler->SetSentErrorMessage(true); | |
211 | return false; | |
212 | } | |
213 | ||
214 | // stop flight if need | |
215 | if (me->isInFlight()) | |
216 | { | |
217 | me->GetMotionMaster()->MovementExpired(); | |
218 | me->CleanupAfterTaxiFlight(); | |
219 | } | |
220 | // save only in non-flight case | |
221 | else | |
222 | me->SaveRecallPosition(); | |
223 | ||
224 | me->TeleportTo(1, -11851.820313f, -4769.585449f, 22.753876f, 6.053061f); // MapId, X, Y, Z, O | |
225 | return true; | |
226 | } | |
227 | ||
228 | static bool HandleRespawnCommand(ChatHandler* handler, char const* /*args*/) | |
229 | { | |
230 | Player* player = handler->GetSession()->GetPlayer(); | |
231 | ||
232 | Unit* target = handler->getSelectedUnit(); | |
233 | if (player->GetSelection() && target) | |
234 | { | |
235 | if (target->GetTypeId() != TYPEID_UNIT || target->isPet()) | |
236 | { | |
237 | handler->SendSysMessage(LANG_SELECT_CREATURE); | |
238 | handler->SetSentErrorMessage(true); | |
239 | return false; | |
240 | } | |
241 | if(player->GetAreaId() == 4722) | |
242 | return false; | |
243 | ||
244 | if (target->isDead()) | |
245 | target->ToCreature()->Respawn(); | |
246 | return true; | |
247 | } | |
248 | ||
249 | CellCoord p(Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY())); | |
250 | Cell cell(p); | |
251 | cell.SetNoCreate(); | |
252 | ||
253 | Trinity::RespawnDo u_do; | |
254 | Trinity::WorldObjectWorker<Trinity::RespawnDo> worker(player, u_do); | |
255 | ||
256 | TypeContainerVisitor<Trinity::WorldObjectWorker<Trinity::RespawnDo>, GridTypeMapContainer > obj_worker(worker); | |
257 | cell.Visit(p, obj_worker, *player->GetMap(), *player, player->GetGridActivationRange()); | |
258 | ||
259 | return true; | |
260 | } | |
261 | ||
262 | static bool HandleGetDrunkCommand(ChatHandler* handler, const char* args) | |
263 | { | |
264 | ||
265 | Player* me = handler->GetSession()->GetPlayer(); | |
266 | me->SetDrunkValue(100); | |
267 | handler->PSendSysMessage("You're now drunk!"); | |
268 | return true; | |
269 | } | |
270 | ||
271 | static bool HandleSoberUpCommand(ChatHandler* handler, const char* args) | |
272 | { | |
273 | ||
274 | Player* me = handler->GetSession()->GetPlayer(); | |
275 | me->SetDrunkValue(1); | |
276 | handler->PSendSysMessage("It's about time you sober up."); | |
277 | return true; | |
278 | } | |
279 | ||
280 | }; | |
281 | ||
282 | void AddSC_vipcommands() | |
283 | { | |
284 | new vipcommands(); | |
285 | } |