PDA

View Full Version : [TrinityCore] [Core / Worldserver] Starequipp Custom Command



Dr.Core
09-08-17, 04:05 PM
https://www.youtube.com/watch?v=q0UlGnxQruQ


Author: Lucky_Patcher <[email protected]> 2017-08-09 22:21:06
Committer: Lucky_Patcher <[email protected]> 2017-08-09 22:21:06
Parent: af86b1cc921fcef2f68dee8bd26c75b826bc9ba3 (Merge branch '3.3.5' of https://github.com/TrinityCore/TrinityCore into 3.3.5)
Branch: 3.3.5
Follows: TDB335.63
Precedes:

Add Command Startequipp

----------------------- src/server/game/Accounts/RBAC.h -----------------------
index cf2d1f3f40..03909fd414 100644
@@ -774,6 +774,7 @@ enum RBACPermissions
RBAC_PERM_COMMAND_LIST_SPAWNPOINTS = 866,

// custom permissions 1000+
+ RBAC_PERM_COMMAND_STARTEQUIPP = 1000,
RBAC_PERM_MAX
};


------------------- src/server/scripts/Commands/cs_misc.cpp -------------------
index dbf50d6564..e42054e251 100644
@@ -115,6 +115,7 @@ public:
{ "unstuck", rbac::RBAC_PERM_COMMAND_UNSTUCK, true, &HandleUnstuckCommand, "" },
{ "wchange", rbac::RBAC_PERM_COMMAND_WCHANGE, false, &HandleChangeWeather, "" },
{ "mailbox", rbac::RBAC_PERM_COMMAND_MAILBOX, false, &HandleMailBoxCommand, "" },
+ { "startequipp", rbac::RBAC_PERM_COMMAND_STARTEQUIPP, true, &HandleStartequippCommand, "" },
};
return commandTable;
}
@@ -2713,7 +2714,68 @@ public:

handler->GetSession()->SendShowMailBox(player->GetGUID());
return true;
+
+
}
+
+ static bool HandleStartequippCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+ uint32 pClass = player->getClass();
+
+ if (CharacterDatabase.PQuery("SELECT used FROM player_startequipp WHERE guid=%u and used = 1;", player->GetGUID().GetCounter()))
+ {
+ handler->PSendSysMessage("You already used this command for this character!");
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ CharacterDatabase.PExecute("INSERT INTO player_startequipp (`guid`, `used`, `datatime`) VALUES (%u, 1, NOW())", player->GetGUID().GetCounter());
+
+ switch (pClass)
+ {
+ case CLASS_DEATH_KNIGHT:
+ player->AddItem(51125, 1);
+ player->AddItem(51126, 1);
+ player->AddItem(51127, 1);
+ player->AddItem(51128, 1);
+ player->AddItem(51129, 1);
+ player->AddItem(49623, 1);
+ player->ModifyMoney(1000000, true);
+ player->ModifyArenaPoints(2200);
+ player->ModifyHonorPoints(80000);
+ handler->PSendSysMessage("[SYSTEM]: You have reached your items successfull!");
+ break;
+ case CLASS_DRUID:
+ handler->PSendSysMessage("The items for your class are not avaible at the moment!");
+ break;
+ case CLASS_HUNTER:
+ handler->PSendSysMessage("The items for your class are not avaible at the moment!");
+ break;
+ case CLASS_MAGE:
+ handler->PSendSysMessage("The items for your class are not avaible at the moment!");
+ break;
+ case CLASS_PALADIN:
+ handler->PSendSysMessage("The items for your class are not avaible at the moment!");
+ break;
+ case CLASS_PRIEST:
+ handler->PSendSysMessage("The items for your class are not avaible at the moment!");
+ break;
+ case CLASS_ROGUE:
+ handler->PSendSysMessage("The items for your class are not avaible at the moment!");
+ break;
+ case CLASS_SHAMAN:
+ handler->PSendSysMessage("The items for your class are not avaible at the moment!");
+ break;
+ case CLASS_WARLOCK:
+ handler->PSendSysMessage("The items for your class are not avaible at the moment!");
+ break;
+ case CLASS_WARRIOR:
+ handler->PSendSysMessage("The items for your class are not avaible at the moment!");
+ break;
+ }
+ return true;
+ }
};

void AddSC_misc_commandscript()


SQL Part :

World Database : Table command


INSERT INTO `command` (`name`, `permission`, `help`) VALUES ('startequipp', '1000', 'Syntax: .startequipp will give you a one time start equipp for your new character.');


Auth Database :


INSERT INTO `rbac_permissions` (`id`, `name`) VALUES ('1000', 'Command : startequipp');
INSERT INTO `rbac_linked_permissions` (`id`, `linkedId`) VALUES ('195', '1000');


Characters Database :


CREATE TABLE IF NOT EXISTS `player_startequipp` (
`guid` int(128) NOT NULL,
`used` int(1) DEFAULT '0',
`datatime` datetime DEFAULT NULL,
PRIMARY KEY (`guid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


Credits goes to :

winter_the_mute, Treeston, rochet2, Riztazz, Aokromes from TrinityCore. Thanks for helping me and thanks that you teach me some stuff i will learn forward!