TrinityCore
cs_modify.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18/* ScriptData
19Name: modify_commandscript
20%Complete: 100
21Comment: All modify related commands
22Category: commandscripts
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "CharacterCache.h"
27#include "Chat.h"
28#include "ChatCommand.h"
29#include "Creature.h"
30#include "DB2Stores.h"
31#include "Log.h"
32#include "ObjectMgr.h"
33#include "PhasingHandler.h"
34#include "Player.h"
35#include "RBAC.h"
36#include "ReputationMgr.h"
37#include "SpellPackets.h"
38#include "UpdateFields.h"
39#include "Util.h"
40#include "WorldSession.h"
41
42#if TRINITY_COMPILER == TRINITY_COMPILER_GNU
43#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
44#endif
45
47{
48public:
49 modify_commandscript() : CommandScript("modify_commandscript") { }
50
51 std::vector<ChatCommand> GetCommands() const override
52 {
53 static std::vector<ChatCommand> modifyspeedCommandTable =
54 {
61 };
62 static std::vector<ChatCommand> modifyCommandTable =
63 {
79 { "speed", rbac::RBAC_PERM_COMMAND_MODIFY_SPEED, false, nullptr, "", modifyspeedCommandTable },
85 };
86 static std::vector<ChatCommand> commandTable =
87 {
89 { "demorph", rbac::RBAC_PERM_COMMAND_DEMORPH, false, &HandleDeMorphCommand, "" },
90 { "modify", rbac::RBAC_PERM_COMMAND_MODIFY, false, nullptr, "", modifyCommandTable },
91 };
92 return commandTable;
93 }
94
95 template<typename... Args>
96 static void NotifyModification(ChatHandler* handler, Unit* target, TrinityStrings resourceMessage, TrinityStrings resourceReportMessage, Args&&... args)
97 {
98 if (Player* player = target->ToPlayer())
99 {
100 handler->PSendSysMessage(resourceMessage, handler->GetNameLink(player).c_str(), args...);
101 if (handler->needReportToTarget(player))
102 ChatHandler(player->GetSession()).PSendSysMessage(resourceReportMessage, handler->GetNameLink().c_str(), std::forward<Args>(args)...);
103 }
104 }
105
106 static bool CheckModifyResources(ChatHandler* handler, char const* args, Player* target, int32& res, int32& resmax, int8 const multiplier = 1)
107 {
108 if (!*args)
109 return false;
110
111 res = atoi((char*)args) * multiplier;
112 resmax = atoi((char*)args) * multiplier;
113
114 if (res < 1 || resmax < 1 || resmax < res)
115 {
117 handler->SetSentErrorMessage(true);
118 return false;
119 }
120
121 if (!target)
122 {
124 handler->SetSentErrorMessage(true);
125 return false;
126 }
127
128 if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
129 return false;
130
131 return true;
132 }
133
134 //Edit Player HP
135 static bool HandleModifyHPCommand(ChatHandler* handler, char const* args)
136 {
137 int32 hp, hpmax;
138 Player* target = handler->getSelectedPlayerOrSelf();
139 if (CheckModifyResources(handler, args, target, hp, hpmax))
140 {
141 NotifyModification(handler, target, LANG_YOU_CHANGE_HP, LANG_YOURS_HP_CHANGED, hp, hpmax);
142 target->SetMaxHealth(hpmax);
143 target->SetHealth(hp);
144 return true;
145 }
146 return false;
147 }
148
149 //Edit Player Mana
150 static bool HandleModifyManaCommand(ChatHandler* handler, char const* args)
151 {
152 int32 mana, manamax;
153 Player* target = handler->getSelectedPlayerOrSelf();
154
155 if (CheckModifyResources(handler, args, target, mana, manamax))
156 {
157 NotifyModification(handler, target, LANG_YOU_CHANGE_MANA, LANG_YOURS_MANA_CHANGED, mana, manamax);
158 target->SetMaxPower(POWER_MANA, manamax);
159 target->SetPower(POWER_MANA, mana);
160 return true;
161 }
162 return false;
163 }
164
165 //Edit Player Energy
166 static bool HandleModifyEnergyCommand(ChatHandler* handler, char const* args)
167 {
168 int32 energy, energymax;
169 Player* target = handler->getSelectedPlayerOrSelf();
170 int8 const energyMultiplier = 10;
171 if (CheckModifyResources(handler, args, target, energy, energymax, energyMultiplier))
172 {
173 NotifyModification(handler, target, LANG_YOU_CHANGE_ENERGY, LANG_YOURS_ENERGY_CHANGED, energy / energyMultiplier, energymax / energyMultiplier);
174 target->SetMaxPower(POWER_ENERGY, energymax);
175 target->SetPower(POWER_ENERGY, energy);
176 return true;
177 }
178 return false;
179 }
180
181 //Edit Player Rage
182 static bool HandleModifyRageCommand(ChatHandler* handler, char const* args)
183 {
184 int32 rage, ragemax;
185 Player* target = handler->getSelectedPlayerOrSelf();
186 int8 const rageMultiplier = 10;
187 if (CheckModifyResources(handler, args, target, rage, ragemax, rageMultiplier))
188 {
189 NotifyModification(handler, target, LANG_YOU_CHANGE_RAGE, LANG_YOURS_RAGE_CHANGED, rage / rageMultiplier, ragemax / rageMultiplier);
190 target->SetMaxPower(POWER_RAGE, ragemax);
191 target->SetPower(POWER_RAGE, rage);
192 return true;
193 }
194 return false;
195 }
196
197 // Edit Player Runic Power
198 static bool HandleModifyRunicPowerCommand(ChatHandler* handler, char const* args)
199 {
200 int32 rune, runemax;
201 Player* target = handler->getSelectedPlayerOrSelf();
202 int8 const runeMultiplier = 10;
203 if (CheckModifyResources(handler, args, target, rune, runemax, runeMultiplier))
204 {
205 NotifyModification(handler, target, LANG_YOU_CHANGE_RUNIC_POWER, LANG_YOURS_RUNIC_POWER_CHANGED, rune / runeMultiplier, runemax / runeMultiplier);
206 target->SetMaxPower(POWER_RUNIC_POWER, runemax);
207 target->SetPower(POWER_RUNIC_POWER, rune);
208 return true;
209 }
210 return false;
211 }
212
213 //Edit Player Faction
215 {
216 Creature* target = handler->getSelectedCreature();
217 if (!target)
218 {
220 handler->SetSentErrorMessage(true);
221 return false;
222 }
223
224 if (!flag)
225 flag = target->m_unitData->Flags;
226
227 if (!npcflag)
228 memcpy(&npcflag.emplace(), target->m_unitData->NpcFlags.begin(), sizeof(uint64));
229
230 if (!dyflag)
231 dyflag = target->m_objectData->DynamicFlags;
232
233 if (!factionid)
234 {
235 handler->PSendSysMessage(LANG_CURRENT_FACTION, target->GetGUID().ToString().c_str(), target->GetFaction(), *flag, std::to_string(*npcflag).c_str(), *dyflag);
236 return true;
237 }
238
239 if (!sFactionTemplateStore.LookupEntry(*factionid))
240 {
241 handler->PSendSysMessage(LANG_WRONG_FACTION, *factionid);
242 handler->SetSentErrorMessage(true);
243 return false;
244 }
245
246 handler->PSendSysMessage(LANG_YOU_CHANGE_FACTION, target->GetGUID().ToString().c_str(), *factionid, *flag, std::to_string(*npcflag).c_str(), *dyflag);
247
248 target->SetFaction(*factionid);
249 target->ReplaceAllUnitFlags(UnitFlags(*flag));
250 target->ReplaceAllNpcFlags(NPCFlags(*npcflag & 0xFFFFFFFF));
251 target->ReplaceAllNpcFlags2(NPCFlags2(*npcflag >> 32));
252 target->ReplaceAllDynamicFlags(*dyflag);
253
254 return true;
255 }
256
257 //Edit Player Spell
258 static bool HandleModifySpellCommand(ChatHandler* handler, char const* args)
259 {
260 if (!*args)
261 return false;
262
263 char* pspellflatid = strtok((char*)args, " ");
264 if (!pspellflatid)
265 return false;
266
267 char* pop = strtok(nullptr, " ");
268 if (!pop)
269 return false;
270
271 char* pval = strtok(nullptr, " ");
272 if (!pval)
273 return false;
274
275 uint16 mark;
276
277 char* pmark = strtok(nullptr, " ");
278
279 uint8 spellflatid = atoi(pspellflatid);
280 uint8 op = atoi(pop);
281 uint16 val = atoi(pval);
282 if (!pmark)
283 mark = 65535;
284 else
285 mark = atoi(pmark);
286
287 Player* target = handler->getSelectedPlayerOrSelf();
288 if (target == nullptr)
289 {
291 handler->SetSentErrorMessage(true);
292 return false;
293 }
294
295 // check online security
296 if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
297 return false;
298
299 handler->PSendSysMessage(LANG_YOU_CHANGE_SPELLFLATID, spellflatid, val, mark, handler->GetNameLink(target).c_str());
300 if (handler->needReportToTarget(target))
301 ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_SPELLFLATID_CHANGED, handler->GetNameLink().c_str(), spellflatid, val, mark);
302
305 spellMod.ModIndex = op;
307 modData.ClassIndex = spellflatid;
308 modData.ModifierValue = float(val);
309 spellMod.ModifierData.push_back(modData);
310 packet.Modifiers.push_back(spellMod);
311 target->SendDirectMessage(packet.Write());
312
313 return true;
314 }
315
316 //Edit Player TP
317 static bool HandleModifyTalentCommand(ChatHandler* /*handler*/, char const* /*args*/)
318 {
319 /* TODO: 6.x remove this
320 if (!*args)
321 return false;
322
323 int tp = atoi((char*)args);
324 if (tp < 0)
325 return false;
326
327 Unit* target = handler->getSelectedUnit();
328 if (!target)
329 {
330 handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
331 handler->SetSentErrorMessage(true);
332 return false;
333 }
334
335 if (target->GetTypeId() == TYPEID_PLAYER)
336 {
337 // check online security
338 if (handler->HasLowerSecurity(target->ToPlayer(), ObjectGuid::Empty))
339 return false;
340 target->ToPlayer()->SetFreeTalentPoints(tp);
341 target->ToPlayer()->SendTalentsInfoData(false);
342 return true;
343 }
344 else if (target->IsPet())
345 {
346 Unit* owner = target->GetOwner();
347 if (owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet*)target)->IsPermanentPetFor(owner->ToPlayer()))
348 {
349 // check online security
350 if (handler->HasLowerSecurity(owner->ToPlayer(), ObjectGuid::Empty))
351 return false;
352 ((Pet*)target)->SetFreeTalentPoints(tp);
353 owner->ToPlayer()->SendTalentsInfoData(true);
354 return true;
355 }
356 }
357
358 handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
359 handler->SetSentErrorMessage(true);*/
360 return false;
361 }
362
363 static bool CheckModifySpeed(ChatHandler* handler, Unit* target, float speed, float minimumBound, float maximumBound, bool checkInFlight = true)
364 {
365 if (speed > maximumBound || speed < minimumBound)
366 {
368 handler->SetSentErrorMessage(true);
369 return false;
370 }
371
372 if (!target)
373 {
375 handler->SetSentErrorMessage(true);
376 return false;
377 }
378
379 if (Player* player = target->ToPlayer())
380 {
381 // check online security
382 if (handler->HasLowerSecurity(player, ObjectGuid::Empty))
383 return false;
384
385 if (player->IsInFlight() && checkInFlight)
386 {
387 handler->PSendSysMessage(LANG_CHAR_IN_FLIGHT, handler->GetNameLink(player).c_str());
388 handler->SetSentErrorMessage(true);
389 return false;
390 }
391 }
392 return true;
393 }
394
395 static bool CheckModifySpeed(ChatHandler* handler, char const* args, Unit* target, float& speed, float minimumBound, float maximumBound, bool checkInFlight = true)
396 {
397 if (!*args)
398 return false;
399
400 speed = (float)atof((char*)args);
401 return CheckModifySpeed(handler, target, speed, minimumBound, maximumBound, checkInFlight);
402 }
403
404 //Edit Player Aspeed
405 static bool HandleModifyASpeedCommand(ChatHandler* handler, char const* args)
406 {
407 float allSpeed;
408 Player* target = handler->getSelectedPlayerOrSelf();
409 if (CheckModifySpeed(handler, args, target, allSpeed, 0.1f, 50.0f))
410 {
412 target->SetSpeedRate(MOVE_WALK, allSpeed);
413 target->SetSpeedRate(MOVE_RUN, allSpeed);
414 target->SetSpeedRate(MOVE_SWIM, allSpeed);
415 target->SetSpeedRate(MOVE_FLIGHT, allSpeed);
416 return true;
417 }
418 return false;
419 }
420
421 //Edit Player Speed
422 static bool HandleModifySpeedCommand(ChatHandler* handler, char const* args)
423 {
424 float Speed;
425 Player* target = handler->getSelectedPlayerOrSelf();
426 if (CheckModifySpeed(handler, args, target, Speed, 0.1f, 50.0f))
427 {
429 target->SetSpeedRate(MOVE_RUN, Speed);
430 return true;
431 }
432 return false;
433 }
434
435 //Edit Player Swim Speed
436 static bool HandleModifySwimCommand(ChatHandler* handler, char const* args)
437 {
438 float swimSpeed;
439 Player* target = handler->getSelectedPlayerOrSelf();
440 if (CheckModifySpeed(handler, args, target, swimSpeed, 0.1f, 50.0f))
441 {
443 target->SetSpeedRate(MOVE_SWIM, swimSpeed);
444 return true;
445 }
446 return false;
447 }
448
449 //Edit Player Backwards Walk Speed
450 static bool HandleModifyBWalkCommand(ChatHandler* handler, char const* args)
451 {
452 float backSpeed;
453 Player* target = handler->getSelectedPlayerOrSelf();
454 if (CheckModifySpeed(handler, args, target, backSpeed, 0.1f, 50.0f))
455 {
457 target->SetSpeedRate(MOVE_RUN_BACK, backSpeed);
458 return true;
459 }
460 return false;
461 }
462
463 //Edit Player Fly
464 static bool HandleModifyFlyCommand(ChatHandler* handler, char const* args)
465 {
466 float flySpeed;
467 Player* target = handler->getSelectedPlayerOrSelf();
468 if (CheckModifySpeed(handler, args, target, flySpeed, 0.1f, 50.0f, false))
469 {
471 target->SetSpeedRate(MOVE_FLIGHT, flySpeed);
472 return true;
473 }
474 return false;
475 }
476
477 //Edit Player or Creature Scale
478 static bool HandleModifyScaleCommand(ChatHandler* handler, char const* args)
479 {
480 float scale;
481 Unit* target = handler->getSelectedUnit();
482 if (CheckModifySpeed(handler, args, target, scale, 0.1f, 10.0f, false))
483 {
485 target->SetObjectScale(scale);
486 return true;
487 }
488 return false;
489 }
490
491 //Enable Player mount
492 static bool HandleModifyMountCommand(ChatHandler* handler, uint32 mount, float speed)
493 {
494 if (!sCreatureDisplayInfoStore.HasRecord(mount))
495 {
497 handler->SetSentErrorMessage(true);
498 return false;
499 }
500
501 Player* target = handler->getSelectedPlayerOrSelf();
502 if (!target)
503 {
505 handler->SetSentErrorMessage(true);
506 return false;
507 }
508
509 // check online security
510 if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
511 return false;
512
513 if (!CheckModifySpeed(handler, target, speed, 0.1f, 50.0f))
514 return false;
515
517 target->Mount(mount);
518 target->SetSpeedRate(MOVE_RUN, speed);
519 target->SetSpeedRate(MOVE_FLIGHT, speed);
520 return true;
521 }
522
523 //Edit Player money
524 static bool HandleModifyMoneyCommand(ChatHandler* handler, char const* args)
525 {
526 if (!*args)
527 return false;
528
529 Player* target = handler->getSelectedPlayerOrSelf();
530 if (!target)
531 {
533 handler->SetSentErrorMessage(true);
534 return false;
535 }
536
537 // check online security
538 if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
539 return false;
540
541 Optional<int64> moneyToAddO = 0;
542 if (strchr(args, 'g') || strchr(args, 's') || strchr(args, 'c'))
543 moneyToAddO = MoneyStringToMoney(std::string(args));
544 else
545 moneyToAddO = Trinity::StringTo<int64>(args);
546
547 if (!moneyToAddO)
548 return false;
549
550 int64 moneyToAdd = *moneyToAddO;
551
552 uint64 targetMoney = target->GetMoney();
553
554 if (moneyToAdd < 0)
555 {
556 int64 newmoney = int64(targetMoney) + moneyToAdd;
557
558 TC_LOG_DEBUG("misc", "{}", handler->PGetParseString(LANG_CURRENT_MONEY, std::to_string(targetMoney), std::to_string(moneyToAdd), std::to_string(newmoney)));
559 if (newmoney <= 0)
560 {
562 target->SetMoney(0);
563 }
564 else
565 {
566 uint64 moneyToAddMsg = moneyToAdd * -1;
567 if (newmoney > static_cast<int64>(MAX_MONEY_AMOUNT))
568 newmoney = MAX_MONEY_AMOUNT;
569
570 handler->PSendSysMessage(LANG_YOU_TAKE_MONEY, std::to_string(moneyToAddMsg).c_str(), handler->GetNameLink(target).c_str());
571 if (handler->needReportToTarget(target))
572 ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_MONEY_TAKEN, handler->GetNameLink().c_str(), std::to_string(moneyToAddMsg).c_str());
573 target->SetMoney(newmoney);
574 }
575 }
576 else
577 {
578 handler->PSendSysMessage(LANG_YOU_GIVE_MONEY, std::to_string(moneyToAdd).c_str(), handler->GetNameLink(target).c_str());
579 if (handler->needReportToTarget(target))
580 ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_MONEY_GIVEN, handler->GetNameLink().c_str(), std::to_string(moneyToAdd).c_str());
581
582 if (moneyToAdd >= int64(MAX_MONEY_AMOUNT))
583 moneyToAdd = MAX_MONEY_AMOUNT;
584
585 moneyToAdd = std::min(moneyToAdd, int64(MAX_MONEY_AMOUNT - targetMoney));
586
587 target->ModifyMoney(moneyToAdd);
588 }
589
590 TC_LOG_DEBUG("misc", "{}", handler->PGetParseString(LANG_NEW_MONEY, std::to_string(targetMoney), std::to_string(moneyToAdd), std::to_string(target->GetMoney())));
591
592 return true;
593 }
594
595 static bool HandleModifyHonorCommand(ChatHandler* handler, char const* args)
596 {
597 if (!*args)
598 return false;
599
600 Player* target = handler->getSelectedPlayerOrSelf();
601 if (!target)
602 {
604 handler->SetSentErrorMessage(true);
605 return false;
606 }
607
608 // check online security
609 if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
610 return false;
611
612 int32 amount = atoi(args);
613
614 handler->PSendSysMessage("NOT IMPLEMENTED: %d honor NOT added.", amount);
615
616 //handler->PSendSysMessage(LANG_COMMAND_MODIFY_HONOR, handler->GetNameLink(target).c_str(), target->GetCurrency(CURRENCY_TYPE_HONOR_POINTS));
617
618 return true;
619 }
620
621 static bool HandleModifyDrunkCommand(ChatHandler* handler, char const* args)
622 {
623 if (!*args)
624 return false;
625
626 uint8 drunklevel = (uint8)atoi(args);
627 if (drunklevel > 100)
628 drunklevel = 100;
629
630 if (Player* target = handler->getSelectedPlayerOrSelf())
631 target->SetDrunkValue(drunklevel);
632
633 return true;
634 }
635
636 static bool HandleModifyRepCommand(ChatHandler* handler, char const* args)
637 {
638 if (!*args)
639 return false;
640
641 Player* target = handler->getSelectedPlayerOrSelf();
642 if (!target)
643 {
645 handler->SetSentErrorMessage(true);
646 return false;
647 }
648
649 // check online security
650 if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
651 return false;
652
653 char* factionTxt = handler->extractKeyFromLink((char*)args, "Hfaction");
654 if (!factionTxt)
655 return false;
656
657 uint32 factionId = atoi(factionTxt);
658
659 int32 amount = 0;
660 char *rankTxt = strtok(nullptr, " ");
661 if (!factionId || !rankTxt)
662 return false;
663
664 FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId);
665
666 if (!factionEntry)
667 {
669 handler->SetSentErrorMessage(true);
670 return false;
671 }
672
673 if (factionEntry->ReputationIndex < 0)
674 {
675 handler->PSendSysMessage(LANG_COMMAND_FACTION_NOREP_ERROR, factionEntry->Name[handler->GetSessionDbcLocale()], factionId);
676 handler->SetSentErrorMessage(true);
677 return false;
678 }
679
680 amount = atoi(rankTxt);
681 // try to find rank by name
682 if ((amount == 0) && (rankTxt[0] != '-') && !isdigit((unsigned char)rankTxt[0]))
683 {
684 std::string rankStr = rankTxt;
685 std::wstring wrankStr;
686 if (!Utf8toWStr(rankStr, wrankStr))
687 return false;
688
689 wstrToLower(wrankStr);
690
691 auto rankThresholdItr = ReputationMgr::ReputationRankThresholds.begin();
693
694 int32 r = 0;
695
696 for (; rankThresholdItr != end; ++rankThresholdItr, ++r)
697 {
698 std::string rank = handler->GetTrinityString(ReputationRankStrIndex[r]);
699 if (rank.empty())
700 continue;
701
702 std::wstring wrank;
703 if (!Utf8toWStr(rank, wrank))
704 continue;
705
706 wstrToLower(wrank);
707
708 if (wrank.substr(0, wrankStr.size()) == wrankStr)
709 break;
710 }
711
712 if (rankThresholdItr == end)
713 {
715 handler->SetSentErrorMessage(true);
716 return false;
717 }
718
719 amount = *rankThresholdItr;
720
721 char *deltaTxt = strtok(nullptr, " ");
722 if (deltaTxt)
723 {
724 int32 toNextRank = 0;
725 auto nextThresholdItr = rankThresholdItr;
726 ++nextThresholdItr;
727 if (nextThresholdItr != end)
728 toNextRank = *nextThresholdItr - *rankThresholdItr;
729
730 int32 delta = atoi(deltaTxt);
731 if (delta < 0 || delta >= toNextRank)
732 {
733 handler->PSendSysMessage(LANG_COMMAND_FACTION_DELTA, std::max(0, toNextRank - 1));
734 handler->SetSentErrorMessage(true);
735 return false;
736 }
737 amount += delta;
738 }
739 }
740
741 target->GetReputationMgr().SetOneFactionReputation(factionEntry, amount, false);
742 target->GetReputationMgr().SendState(target->GetReputationMgr().GetState(factionEntry));
743 handler->PSendSysMessage(LANG_COMMAND_MODIFY_REP, factionEntry->Name[handler->GetSessionDbcLocale()], factionId,
744 handler->GetNameLink(target).c_str(), target->GetReputationMgr().GetReputation(factionEntry));
745 return true;
746 }
747
748 //morph creature or player
749 static bool HandleModifyMorphCommand(ChatHandler* handler, uint32 display_id)
750 {
751 Unit* target = handler->getSelectedUnit();
752 if (!target)
753 target = handler->GetSession()->GetPlayer();
754
755 // check online security
756 else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), ObjectGuid::Empty))
757 return false;
758
759 target->SetDisplayId(display_id);
760
761 return true;
762 }
763
764 // Toggles a phaseid on a player
765 static bool HandleModifyPhaseCommand(ChatHandler* handler, uint32 phaseId, Optional<uint32> visibleMapId)
766 {
767 if (phaseId && !sPhaseStore.LookupEntry(phaseId))
768 {
770 handler->SetSentErrorMessage(true);
771 return false;
772 }
773
774 Unit* target = handler->getSelectedUnit();
775
776 if (visibleMapId)
777 {
778 MapEntry const* visibleMap = sMapStore.LookupEntry(*visibleMapId);
779 if (!visibleMap || visibleMap->ParentMapID != int32(target->GetMapId()))
780 {
782 handler->SetSentErrorMessage(true);
783 return false;
784 }
785
786 if (!target->GetPhaseShift().HasVisibleMapId(*visibleMapId))
787 PhasingHandler::AddVisibleMapId(target, *visibleMapId);
788 else
789 PhasingHandler::RemoveVisibleMapId(target, *visibleMapId);
790 }
791
792 if (phaseId)
793 {
794 if (!target->GetPhaseShift().HasPhase(phaseId))
795 PhasingHandler::AddPhase(target, phaseId, true);
796 else
797 PhasingHandler::RemovePhase(target, phaseId, true);
798 }
799
800 return true;
801 }
802
803 //change standstate
804 static bool HandleModifyStandStateCommand(ChatHandler* handler, char const* args)
805 {
806 if (!*args)
807 return false;
808
809 uint32 anim_id = atoi((char*)args);
810 handler->GetSession()->GetPlayer()->SetEmoteState(Emote(anim_id));
811
812 return true;
813 }
814
815 static bool HandleModifyGenderCommand(ChatHandler* handler, char const* args)
816 {
817 if (!*args)
818 return false;
819
820 Player* target = handler->getSelectedPlayerOrSelf();
821
822 if (!target)
823 {
825 handler->SetSentErrorMessage(true);
826 return false;
827 }
828
829 PlayerInfo const* info = sObjectMgr->GetPlayerInfo(target->GetRace(), target->GetClass());
830 if (!info)
831 return false;
832
833 char const* gender_str = (char*)args;
834 int gender_len = strlen(gender_str);
835
836 Gender gender;
837
838 if (!strncmp(gender_str, "male", gender_len)) // MALE
839 {
840 if (target->GetGender() == GENDER_MALE)
841 return true;
842
843 gender = GENDER_MALE;
844 }
845 else if (!strncmp(gender_str, "female", gender_len)) // FEMALE
846 {
847 if (target->GetGender() == GENDER_FEMALE)
848 return true;
849
850 gender = GENDER_FEMALE;
851 }
852 else
853 {
855 handler->SetSentErrorMessage(true);
856 return false;
857 }
858
859 // Set gender
860 target->SetGender(gender);
861 target->SetNativeGender(gender);
862
863 // Change display ID
864 target->InitDisplayIds();
865
866 target->RestoreDisplayId(false);
867 sCharacterCache->UpdateCharacterGender(target->GetGUID(), gender);
868
869 // Generate random customizations
870 std::vector<UF::ChrCustomizationChoice> customizations;
871
872 Races race = Races(target->GetRace());
873 Classes playerClass = Classes(target->GetClass());
874 std::vector<ChrCustomizationOptionEntry const*> const* options = sDB2Manager.GetCustomiztionOptions(target->GetRace(), gender);
875 WorldSession const* worldSession = target->GetSession();
876 for (ChrCustomizationOptionEntry const* option : *options)
877 {
878 ChrCustomizationReqEntry const* optionReq = sChrCustomizationReqStore.LookupEntry(option->ChrCustomizationReqID);
879 if (optionReq && !worldSession->MeetsChrCustomizationReq(optionReq, race, playerClass, false, MakeChrCustomizationChoiceRange(customizations)))
880 continue;
881
882 // Loop over the options until the first one fits
883 std::vector<ChrCustomizationChoiceEntry const*> const* choicesForOption = sDB2Manager.GetCustomiztionChoices(option->ID);
884 for (ChrCustomizationChoiceEntry const* choiceForOption : *choicesForOption)
885 {
886 ChrCustomizationReqEntry const* choiceReq = sChrCustomizationReqStore.LookupEntry(choiceForOption->ChrCustomizationReqID);
887 if (choiceReq && !worldSession->MeetsChrCustomizationReq(choiceReq, race, playerClass, false, MakeChrCustomizationChoiceRange(customizations)))
888 continue;
889
890 ChrCustomizationChoiceEntry const* choiceEntry = choicesForOption->at(0);
892 choice.ChrCustomizationOptionID = option->ID;
893 choice.ChrCustomizationChoiceID = choiceEntry->ID;
894 customizations.push_back(choice);
895 break;
896 }
897 }
898
899 target->SetCustomizations(Trinity::Containers::MakeIteratorPair(customizations.begin(), customizations.end()));
900
901 char const* gender_full = gender ? "female" : "male";
902
903 handler->PSendSysMessage(LANG_YOU_CHANGE_GENDER, handler->GetNameLink(target).c_str(), gender_full);
904
905 if (handler->needReportToTarget(target))
906 ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOUR_GENDER_CHANGED, gender_full, handler->GetNameLink().c_str());
907
908 return true;
909 }
910//demorph player or unit
911 static bool HandleDeMorphCommand(ChatHandler* handler, char const* /*args*/)
912 {
913 Unit* target = handler->getSelectedUnit();
914 if (!target)
915 target = handler->GetSession()->GetPlayer();
916
917 // check online security
918 else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), ObjectGuid::Empty))
919 return false;
920
921 target->DeMorph();
922
923 return true;
924 }
925
926 static bool HandleModifyCurrencyCommand(ChatHandler* handler, const char* args)
927 {
928 if (!*args)
929 return false;
930
931 Player* target = handler->getSelectedPlayer();
932 if (!target)
933 {
935 handler->SetSentErrorMessage(true);
936 return false;
937 }
938
939 uint32 currencyId = atoi(strtok((char*)args, " "));
940 const CurrencyTypesEntry* currencyType = sCurrencyTypesStore.LookupEntry(currencyId);
941 if (!currencyType)
942 return false;
943
944 uint32 amount = atoi(strtok(nullptr, " "));
945 if (!amount)
946 return false;
947
949
950 return true;
951 }
952
953 // mod xp command
954 static bool HandleModifyXPCommand(ChatHandler *handler, char const* args)
955 {
956 if (!*args)
957 return false;
958
959 int32 xp = atoi((char*)args);
960
961 if (xp < 1)
962 {
964 handler->SetSentErrorMessage(true);
965 return false;
966 }
967
968 Player* target = handler->getSelectedPlayerOrSelf();
969 if (!target)
970 {
972 handler->SetSentErrorMessage(true);
973 return false;
974 }
975
976 if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
977 return false;
978
979 // we can run the command
980 target->GiveXP(xp, nullptr);
981 return true;
982 }
983
984 // Edit Player Power
985 static bool HandleModifyPowerCommand(ChatHandler* handler, const char* args)
986 {
987 if (!*args)
988 return false;
989
990 Player* target = handler->getSelectedPlayerOrSelf();
991 if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
992 return false;
993
994 char* powerTypeToken = strtok((char*)args, " ");
995 if (!powerTypeToken)
996 return false;
997
998 PowerTypeEntry const* powerType = sDB2Manager.GetPowerTypeByName(powerTypeToken);
999 if (!powerType)
1000 {
1002 handler->SetSentErrorMessage(true);
1003 return false;
1004 }
1005
1006 if (target->GetPowerIndex(Powers(powerType->PowerTypeEnum)) == MAX_POWERS)
1007 {
1009 handler->SetSentErrorMessage(true);
1010 return false;
1011 }
1012
1013 char* amount = strtok(nullptr, " ");
1014 if (!amount)
1015 return false;
1016
1017 int32 powerAmount = atoi(amount);
1018
1019 if (powerAmount < 1)
1020 {
1022 handler->SetSentErrorMessage(true);
1023 return false;
1024 }
1025
1026 std::string formattedPowerName = powerType->NameGlobalStringTag;
1027 bool upperCase = true;
1028 for (char& c : formattedPowerName)
1029 {
1030 if (upperCase)
1031 {
1032 c = charToUpper(c);
1033 upperCase = false;
1034 }
1035 else
1036 c = charToLower(c);
1037
1038 if (c == '_')
1039 {
1040 c = ' ';
1041 upperCase = true;
1042 }
1043 }
1044
1045 NotifyModification(handler, target, LANG_YOU_CHANGE_POWER, LANG_YOUR_POWER_CHANGED, formattedPowerName.c_str(), powerAmount, powerAmount);
1046 powerAmount *= powerType->DisplayModifier;
1047 target->SetMaxPower(Powers(powerType->PowerTypeEnum), powerAmount);
1048 target->SetPower(Powers(powerType->PowerTypeEnum), powerAmount);
1049 return true;
1050 }
1051};
1052
1054{
1056}
#define sCharacterCache
DB2Storage< PhaseEntry > sPhaseStore("Phase.db2", &PhaseLoadInfo::Instance)
DB2Storage< MapEntry > sMapStore("Map.db2", &MapLoadInfo::Instance)
DB2Storage< CurrencyTypesEntry > sCurrencyTypesStore("CurrencyTypes.db2", &CurrencyTypesLoadInfo::Instance)
DB2Storage< ChrCustomizationReqEntry > sChrCustomizationReqStore("ChrCustomizationReq.db2", &ChrCustomizationReqLoadInfo::Instance)
DB2Storage< CreatureDisplayInfoEntry > sCreatureDisplayInfoStore("CreatureDisplayInfo.db2", &CreatureDisplayInfoLoadInfo::Instance)
DB2Storage< FactionTemplateEntry > sFactionTemplateStore("FactionTemplate.db2", &FactionTemplateLoadInfo::Instance)
DB2Storage< FactionEntry > sFactionStore("Faction.db2", &FactionLoadInfo::Instance)
#define sDB2Manager
Definition: DB2Stores.h:538
uint8_t uint8
Definition: Define.h:144
int64_t int64
Definition: Define.h:137
int8_t int8
Definition: Define.h:140
int32_t int32
Definition: Define.h:138
uint64_t uint64
Definition: Define.h:141
uint16_t uint16
Definition: Define.h:143
uint32_t uint32
Definition: Define.h:142
TrinityStrings
Definition: Language.h:29
@ LANG_CURRENT_MONEY
Definition: Language.h:191
@ LANG_MUST_MALE_OR_FEMALE
Definition: Language.h:892
@ LANG_NO_MOUNT
Definition: Language.h:187
@ LANG_YOURS_ASPEED_CHANGED
Definition: Language.h:175
@ LANG_YOU_CHANGE_SIZE
Definition: Language.h:185
@ LANG_SELECT_CREATURE
Definition: Language.h:32
@ LANG_YOURS_MANA_CHANGED
Definition: Language.h:156
@ LANG_COMMAND_FACTION_UNKNOWN
Definition: Language.h:364
@ LANG_YOURS_FLY_SPEED_CHANGED
Definition: Language.h:183
@ LANG_COMMAND_FACTION_DELTA
Definition: Language.h:366
@ LANG_YOURS_SWIM_SPEED_CHANGED
Definition: Language.h:179
@ LANG_YOU_TAKE_ALL_MONEY
Definition: Language.h:192
@ LANG_YOU_GIVE_MOUNT
Definition: Language.h:188
@ LANG_YOURS_MONEY_TAKEN
Definition: Language.h:195
@ LANG_YOUR_POWER_CHANGED
Definition: Language.h:1242
@ LANG_YOU_CHANGE_RAGE
Definition: Language.h:161
@ LANG_YOURS_ALL_MONEY_GONE
Definition: Language.h:193
@ LANG_YOU_CHANGE_SPEED
Definition: Language.h:176
@ LANG_YOU_TAKE_MONEY
Definition: Language.h:194
@ LANG_YOU_CHANGE_POWER
Definition: Language.h:1241
@ LANG_YOURS_SPEED_CHANGED
Definition: Language.h:177
@ LANG_WRONG_FACTION
Definition: Language.h:165
@ LANG_YOURS_MONEY_GIVEN
Definition: Language.h:197
@ LANG_YOURS_HP_CHANGED
Definition: Language.h:154
@ LANG_YOURS_SIZE_CHANGED
Definition: Language.h:186
@ LANG_YOU_CHANGE_ENERGY
Definition: Language.h:157
@ LANG_CURRENT_FACTION
Definition: Language.h:164
@ LANG_YOU_CHANGE_HP
Definition: Language.h:153
@ LANG_YOU_CHANGE_RUNIC_POWER
Definition: Language.h:215
@ LANG_NEW_MONEY
Definition: Language.h:200
@ LANG_YOURS_SPELLFLATID_CHANGED
Definition: Language.h:168
@ LANG_YOU_CHANGE_FLY_SPEED
Definition: Language.h:182
@ LANG_YOU_CHANGE_FACTION
Definition: Language.h:166
@ LANG_YOU_CHANGE_ASPEED
Definition: Language.h:174
@ LANG_YOURS_RAGE_CHANGED
Definition: Language.h:162
@ LANG_NO_CHAR_SELECTED
Definition: Language.h:150
@ LANG_COMMAND_FACTION_NOREP_ERROR
Definition: Language.h:382
@ LANG_YOU_CHANGE_BACK_SPEED
Definition: Language.h:180
@ LANG_PLAYER_NOT_FOUND
Definition: Language.h:567
@ LANG_COMMAND_INVALID_PARAM
Definition: Language.h:365
@ LANG_YOU_CHANGE_GENDER
Definition: Language.h:893
@ LANG_BAD_VALUE
Definition: Language.h:149
@ LANG_YOU_CHANGE_SPELLFLATID
Definition: Language.h:167
@ LANG_YOURS_ENERGY_CHANGED
Definition: Language.h:158
@ LANG_COMMAND_MODIFY_REP
Definition: Language.h:361
@ LANG_YOURS_BACK_SPEED_CHANGED
Definition: Language.h:181
@ LANG_YOURS_RUNIC_POWER_CHANGED
Definition: Language.h:216
@ LANG_CHAR_IN_FLIGHT
Definition: Language.h:53
@ LANG_MOUNT_GIVED
Definition: Language.h:189
@ LANG_INVALID_POWER_NAME
Definition: Language.h:1243
@ LANG_YOU_CHANGE_SWIM_SPEED
Definition: Language.h:178
@ LANG_YOUR_GENDER_CHANGED
Definition: Language.h:894
@ LANG_YOU_GIVE_MONEY
Definition: Language.h:196
@ LANG_YOU_CHANGE_MANA
Definition: Language.h:155
@ LANG_PHASE_NOTFOUND
Definition: Language.h:1062
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:156
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
#define sObjectMgr
Definition: ObjectMgr.h:1946
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
uint64 const MAX_MONEY_AMOUNT
Definition: Player.cpp:158
Trinity::IteratorPair< UF::ChrCustomizationChoice const * > MakeChrCustomizationChoiceRange(Container const &container)
Definition: Player.h:3247
Role Based Access Control related classes definition.
Races
Definition: RaceMask.h:26
uint32 const ReputationRankStrIndex[MAX_REPUTATION_RANK]
Classes
Gender
@ GENDER_MALE
@ GENDER_FEMALE
Emote
Powers
@ MAX_POWERS
@ POWER_RAGE
@ POWER_RUNIC_POWER
@ POWER_ENERGY
@ POWER_MANA
@ MOVE_FLIGHT
Definition: UnitDefines.h:123
@ MOVE_SWIM
Definition: UnitDefines.h:120
@ MOVE_RUN
Definition: UnitDefines.h:118
@ MOVE_RUN_BACK
Definition: UnitDefines.h:119
@ MOVE_WALK
Definition: UnitDefines.h:117
NPCFlags
Non Player Character flags.
Definition: UnitDefines.h:295
NPCFlags2
Definition: UnitDefines.h:335
UnitFlags
Definition: UnitDefines.h:143
void wstrToLower(std::wstring &str)
Definition: Util.cpp:480
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
Definition: Util.cpp:383
Optional< int64 > MoneyStringToMoney(std::string const &moneyString)
Definition: Util.cpp:216
char charToLower(char c)
Definition: Util.h:331
char charToUpper(char c)
Definition: Util.h:330
char * extractKeyFromLink(char *text, char const *linkType, char **something1=nullptr)
Definition: Chat.cpp:262
Player * getSelectedPlayerOrSelf()
Definition: Chat.cpp:244
Unit * getSelectedUnit()
Definition: Chat.cpp:212
Player * getSelectedPlayer()
Definition: Chat.cpp:200
WorldSession * GetSession()
Definition: Chat.h:42
virtual LocaleConstant GetSessionDbcLocale() const
Definition: Chat.cpp:592
virtual std::string GetNameLink() const
Definition: Chat.cpp:58
std::string PGetParseString(uint32 entry, Args &&... args) const
Definition: Chat.h:69
void PSendSysMessage(const char *fmt, Args &&... args)
Definition: Chat.h:57
bool HasLowerSecurity(Player *target, ObjectGuid guid, bool strong=false)
Definition: Chat.cpp:63
Creature * getSelectedCreature()
Definition: Chat.cpp:236
void SetSentErrorMessage(bool val)
Definition: Chat.h:114
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition: Chat.cpp:113
virtual bool needReportToTarget(Player *chr) const
Definition: Chat.cpp:586
virtual char const * GetTrinityString(uint32 entry) const
Definition: Chat.cpp:48
static ObjectGuid const Empty
Definition: ObjectGuid.h:274
std::string ToString() const
Definition: ObjectGuid.cpp:554
UF::UpdateField< UF::ObjectData, 0, TYPEID_OBJECT > m_objectData
Definition: Object.h:267
TypeID GetTypeId() const
Definition: Object.h:173
void ReplaceAllDynamicFlags(uint32 flag)
Definition: Object.h:171
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
virtual void SetObjectScale(float scale)
Definition: Object.h:165
static Player * ToPlayer(Object *o)
Definition: Object.h:213
bool HasPhase(uint32 phaseId) const
Definition: PhaseShift.h:100
bool HasVisibleMapId(uint32 visibleMapId) const
Definition: PhaseShift.h:105
static void AddVisibleMapId(WorldObject *object, uint32 visibleMapId)
static void AddPhase(WorldObject *object, uint32 phaseId, bool updateVisibility)
static void RemoveVisibleMapId(WorldObject *object, uint32 visibleMapId)
static void RemovePhase(WorldObject *object, uint32 phaseId, bool updateVisibility)
bool ModifyMoney(int64 amount, bool sendError=true)
Definition: Player.cpp:24098
void SetNativeGender(Gender gender) override
Definition: Player.h:1218
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:6324
uint32 GetPowerIndex(Powers power) const override
Definition: StatSystem.cpp:322
void GiveXP(uint32 xp, Unit *victim, float group_rate=1.0f)
Definition: Player.cpp:2210
void InitDisplayIds()
Definition: Player.cpp:22796
WorldSession * GetSession() const
Definition: Player.h:2101
uint64 GetMoney() const
Definition: Player.h:1738
void SetMoney(uint64 value)
Definition: Player.cpp:24124
void ModifyCurrency(uint32 id, int32 amount, CurrencyGainSource gainSource=CurrencyGainSource::Cheat, CurrencyDestroyReason destroyReason=CurrencyDestroyReason::Cheat)
Modify currency amount.
Definition: Player.cpp:7110
ReputationMgr & GetReputationMgr()
Definition: Player.h:2251
void SetCustomizations(Trinity::IteratorPair< Iter > customizations, bool markChanged=true)
Definition: Player.h:2764
void SendState(FactionState const *faction)
int32 GetReputation(uint32 faction_id) const
FactionState const * GetState(FactionEntry const *factionEntry) const
bool SetOneFactionReputation(FactionEntry const *factionEntry, int32 standing, bool incremental)
Public for chat command needs.
static std::set< int32 > const ReputationRankThresholds
Definition: ReputationMgr.h:78
Definition: Unit.h:627
void SetHealth(uint64 val)
Definition: Unit.cpp:9346
void SetGender(Gender gender)
Definition: Unit.h:756
void RestoreDisplayId(bool ignorePositiveAurasPreventingMounting=false)
Definition: Unit.cpp:10172
void ReplaceAllNpcFlags2(NPCFlags2 flags)
Definition: Unit.h:990
UF::UpdateField< UF::UnitData, 0, TYPEID_UNIT > m_unitData
Definition: Unit.h:1814
uint8 GetClass() const
Definition: Unit.h:752
void SetFaction(uint32 faction) override
Definition: Unit.h:859
void SetPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition: Unit.cpp:9419
void ReplaceAllUnitFlags(UnitFlags flags)
Definition: Unit.h:835
void Mount(uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
Definition: Unit.cpp:7887
Gender GetGender() const
Definition: Unit.h:755
void SetEmoteState(Emote emote)
Definition: Unit.h:852
uint32 GetFaction() const override
Definition: Unit.h:858
void SetMaxHealth(uint64 val)
Definition: Unit.cpp:9377
void SetSpeedRate(UnitMoveType mtype, float rate)
Definition: Unit.cpp:8525
void SetMaxPower(Powers power, int32 val)
Definition: Unit.cpp:9456
void ReplaceAllNpcFlags(NPCFlags flags)
Definition: Unit.h:984
void DeMorph()
Definition: Unit.cpp:3241
uint8 GetRace() const
Definition: Unit.h:749
virtual void SetDisplayId(uint32 displayId, bool setNative=false)
Definition: Unit.cpp:10148
constexpr uint32 GetMapId() const
Definition: Position.h:201
PhaseShift & GetPhaseShift()
Definition: Object.h:523
std::vector< SpellModifier > Modifiers
Definition: SpellPackets.h:505
WorldPacket const * Write() override
Player session in the World.
Definition: WorldSession.h:963
Player * GetPlayer() const
bool MeetsChrCustomizationReq(ChrCustomizationReqEntry const *req, Races race, Classes playerClass, bool checkRequiredDependentChoices, Trinity::IteratorPair< UF::ChrCustomizationChoice const * > selectedChoices) const
static bool CheckModifySpeed(ChatHandler *handler, Unit *target, float speed, float minimumBound, float maximumBound, bool checkInFlight=true)
Definition: cs_modify.cpp:363
static bool HandleModifyPowerCommand(ChatHandler *handler, const char *args)
Definition: cs_modify.cpp:985
static bool HandleModifyFactionCommand(ChatHandler *handler, Optional< uint32 > factionid, Optional< uint32 > flag, Optional< uint64 > npcflag, Optional< uint32 > dyflag)
Definition: cs_modify.cpp:214
static bool HandleModifyMorphCommand(ChatHandler *handler, uint32 display_id)
Definition: cs_modify.cpp:749
static bool HandleModifyCurrencyCommand(ChatHandler *handler, const char *args)
Definition: cs_modify.cpp:926
std::vector< ChatCommand > GetCommands() const override
Definition: cs_modify.cpp:51
static bool HandleModifyMountCommand(ChatHandler *handler, uint32 mount, float speed)
Definition: cs_modify.cpp:492
static bool HandleModifyRepCommand(ChatHandler *handler, char const *args)
Definition: cs_modify.cpp:636
static bool HandleModifyXPCommand(ChatHandler *handler, char const *args)
Definition: cs_modify.cpp:954
static bool HandleDeMorphCommand(ChatHandler *handler, char const *)
Definition: cs_modify.cpp:911
static void NotifyModification(ChatHandler *handler, Unit *target, TrinityStrings resourceMessage, TrinityStrings resourceReportMessage, Args &&... args)
Definition: cs_modify.cpp:96
static bool HandleModifyStandStateCommand(ChatHandler *handler, char const *args)
Definition: cs_modify.cpp:804
static bool HandleModifyRageCommand(ChatHandler *handler, char const *args)
Definition: cs_modify.cpp:182
static bool HandleModifyTalentCommand(ChatHandler *, char const *)
Definition: cs_modify.cpp:317
static bool HandleModifySpellCommand(ChatHandler *handler, char const *args)
Definition: cs_modify.cpp:258
static bool HandleModifyHPCommand(ChatHandler *handler, char const *args)
Definition: cs_modify.cpp:135
static bool HandleModifyGenderCommand(ChatHandler *handler, char const *args)
Definition: cs_modify.cpp:815
static bool HandleModifyEnergyCommand(ChatHandler *handler, char const *args)
Definition: cs_modify.cpp:166
static bool HandleModifyDrunkCommand(ChatHandler *handler, char const *args)
Definition: cs_modify.cpp:621
static bool HandleModifyFlyCommand(ChatHandler *handler, char const *args)
Definition: cs_modify.cpp:464
static bool CheckModifyResources(ChatHandler *handler, char const *args, Player *target, int32 &res, int32 &resmax, int8 const multiplier=1)
Definition: cs_modify.cpp:106
static bool HandleModifyBWalkCommand(ChatHandler *handler, char const *args)
Definition: cs_modify.cpp:450
static bool CheckModifySpeed(ChatHandler *handler, char const *args, Unit *target, float &speed, float minimumBound, float maximumBound, bool checkInFlight=true)
Definition: cs_modify.cpp:395
static bool HandleModifySwimCommand(ChatHandler *handler, char const *args)
Definition: cs_modify.cpp:436
static bool HandleModifyMoneyCommand(ChatHandler *handler, char const *args)
Definition: cs_modify.cpp:524
static bool HandleModifyScaleCommand(ChatHandler *handler, char const *args)
Definition: cs_modify.cpp:478
static bool HandleModifyRunicPowerCommand(ChatHandler *handler, char const *args)
Definition: cs_modify.cpp:198
static bool HandleModifySpeedCommand(ChatHandler *handler, char const *args)
Definition: cs_modify.cpp:422
static bool HandleModifyPhaseCommand(ChatHandler *handler, uint32 phaseId, Optional< uint32 > visibleMapId)
Definition: cs_modify.cpp:765
static bool HandleModifyManaCommand(ChatHandler *handler, char const *args)
Definition: cs_modify.cpp:150
static bool HandleModifyASpeedCommand(ChatHandler *handler, char const *args)
Definition: cs_modify.cpp:405
static bool HandleModifyHonorCommand(ChatHandler *handler, char const *args)
Definition: cs_modify.cpp:595
void AddSC_modify_commandscript()
Definition: cs_modify.cpp:1053
@ SMSG_SET_FLAT_SPELL_MODIFIER
Definition: Opcodes.h:1913
constexpr IteratorPair< iterator, end_iterator > MakeIteratorPair(iterator first, end_iterator second)
Definition: IteratorPair.h:48
@ RBAC_PERM_COMMAND_MODIFY_MONEY
Definition: RBAC.h:426
@ RBAC_PERM_COMMAND_MODIFY_RUNICPOWER
Definition: RBAC.h:431
@ RBAC_PERM_COMMAND_MODIFY_MOUNT
Definition: RBAC.h:427
@ RBAC_PERM_COMMAND_MODIFY_SPEED_SWIM
Definition: RBAC.h:438
@ RBAC_PERM_COMMAND_MODIFY_PHASE
Definition: RBAC.h:428
@ RBAC_PERM_COMMAND_MODIFY_SPEED_BACKWALK
Definition: RBAC.h:435
@ RBAC_PERM_COMMAND_MODIFY_SPEED_FLY
Definition: RBAC.h:436
@ RBAC_PERM_COMMAND_MODIFY_POWER
Definition: RBAC.h:738
@ RBAC_PERM_COMMAND_MODIFY_SPEED
Definition: RBAC.h:433
@ RBAC_PERM_COMMAND_MODIFY_TALENTPOINTS
Definition: RBAC.h:441
@ RBAC_PERM_COMMAND_MODIFY
Definition: RBAC.h:416
@ RBAC_PERM_COMMAND_MODIFY_CURRENCY
Definition: RBAC.h:647
@ RBAC_PERM_COMMAND_MODIFY_SCALE
Definition: RBAC.h:432
@ RBAC_PERM_COMMAND_MODIFY_SPEED_WALK
Definition: RBAC.h:437
@ RBAC_PERM_COMMAND_MODIFY_HONOR
Definition: RBAC.h:423
@ RBAC_PERM_COMMAND_MODIFY_FACTION
Definition: RBAC.h:421
@ RBAC_PERM_COMMAND_DEMORPH
Definition: RBAC.h:415
@ RBAC_PERM_COMMAND_MODIFY_SPELL
Definition: RBAC.h:439
@ RBAC_PERM_COMMAND_MORPH
Definition: RBAC.h:414
@ RBAC_PERM_COMMAND_MODIFY_RAGE
Definition: RBAC.h:429
@ RBAC_PERM_COMMAND_MODIFY_GENDER
Definition: RBAC.h:422
@ RBAC_PERM_COMMAND_MODIFY_MANA
Definition: RBAC.h:425
@ RBAC_PERM_COMMAND_MODIFY_XP
Definition: RBAC.h:670
@ RBAC_PERM_COMMAND_MODIFY_STANDSTATE
Definition: RBAC.h:440
@ RBAC_PERM_COMMAND_MODIFY_REPUTATION
Definition: RBAC.h:430
@ RBAC_PERM_COMMAND_MODIFY_ENERGY
Definition: RBAC.h:420
@ RBAC_PERM_COMMAND_MODIFY_SPEED_ALL
Definition: RBAC.h:434
@ RBAC_PERM_COMMAND_MODIFY_HP
Definition: RBAC.h:424
@ RBAC_PERM_COMMAND_MODIFY_DRUNK
Definition: RBAC.h:419
LocalizedString Name
int16 ReputationIndex
int16 ParentMapID
char const * NameGlobalStringTag
std::vector< SpellModifierData > ModifierData
Definition: SpellPackets.h:495