PHP Code:
AuthorLucky_Patcher <lucky_patcher@script-devilz.to>  2017-08-09 22:21:06
Committer
Lucky_Patcher <lucky_patcher@script-devilz.to>  2017-08-09 22:21:06
Parent
af86b1cc921fcef2f68dee8bd26c75b826bc9ba3 (Merge branch '3.3.5' of https://github.com/TrinityCore/TrinityCore into 3.3.5)
Branch3.3.5
Follows
TDB335.63
Precedes


    
Add Command Startequipp

----------------------- src/server/game/Accounts/RBAC.-----------------------
index cf2d1f3f40..03909fd414 100644
@@ -774,+774,@@ 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,+115,@@ 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,+2714,68 @@ public:
 
         
handler->GetSession()->SendShowMailBox(player->GetGUID());
         return 
true;
+        
+
     }
+
+    static 
bool HandleStartequippCommand(ChatHandlerhandlerchar const* /*args*/)
+    {
+        
Playerplayer 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(511251);
+                
player->AddItem(511261);
+                
player->AddItem(511271);
+                
player->AddItem(511281);
+                
player->AddItem(511291);
+                
player->AddItem(496231);
+                
player->ModifyMoney(1000000true);
+                
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



PHP Code:
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 :

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

PHP Code:
CREATE TABLE IF NOT EXISTS `player_startequipp` (
  `
guidint(128NOT NULL,
  `
usedint(1) DEFAULT '0',
  `
datatimedatetime 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!


› See More: [Core / Worldserver] Starequipp Custom Command