Index: /trunk/src/game/Chat.h
===================================================================
--- /trunk/src/game/Chat.h (revision 149)
+++ /trunk/src/game/Chat.h (revision 163)
@@ -350,4 +350,5 @@
         bool HandleLinkGraveCommand(const char* args);
         bool HandleNearGraveCommand(const char* args);
+        bool HandleActivateObjectCommand(const char* args);
         bool HandleSpawnTransportCommand(const char* args);
         bool HandleExploreCheatCommand(const char* args);
@@ -361,4 +362,9 @@
         bool HandleAddItemCommand(const char* args);
         bool HandleAddItemSetCommand(const char* args);
+        bool HandleModifyGenderCommand(const char* args);
+        bool HandlePetTpCommand(const char* args);
+        bool HandlePetUnlearnCommand(const char* args);
+        bool HandlePetLearnCommand(const char* args);
+        bool HandleCreatePetCommand(const char* args);
 
         bool HandleGroupLeaderCommand(const char* args);
@@ -425,4 +431,5 @@
         bool HandleCharDeleteCommand(const char *args);
 		bool HandleSendMessageCommand(const char * args);
+        bool HandlePlayAllCommand(const char* args);
         bool HandleRepairitemsCommand(const char* args);
         bool HandleFlushArenaPointsCommand(const char *args);
Index: /trunk/src/game/Level3.cpp
===================================================================
--- /trunk/src/game/Level3.cpp (revision 149)
+++ /trunk/src/game/Level3.cpp (revision 163)
@@ -6227,4 +6227,89 @@
 }
 
+bool ChatHandler::HandlePlayAllCommand(const char* args)
+{
+	if(!*args)
+		return false;
+
+	uint32 soundId = atoi((char*)args);
+
+	if(!sSoundEntriesStore.LookupEntry(soundId))
+	{
+		PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId);
+		SetSentErrorMessage(true);
+		return false;
+	}
+
+	WorldPacket data(SMSG_PLAY_SOUND, 4);
+	data << uint32(soundId) << m_session->GetPlayer()->GetGUID();
+	sWorld.SendGlobalMessage(&data);
+
+	PSendSysMessage(LANG_COMMAND_PLAYED_TO_ALL, soundId);
+	return true;
+}
+
+bool ChatHandler::HandleModifyGenderCommand(const char *args)
+{
+	if(!*args)	return false;
+	Player *player = getSelectedPlayer();
+
+	if(!player)
+	{
+		PSendSysMessage(LANG_NO_PLAYER);
+		SetSentErrorMessage(true);
+		return false;
+	}
+
+	std::string gender = (char*)args;
+	uint32 displayId = player->GetNativeDisplayId();
+
+	if(gender == "male") // MALE
+	{
+		if(player->getGender() == GENDER_MALE)
+		{
+			PSendSysMessage("%s is already male", player->GetName());
+			SetSentErrorMessage(true);
+			return false;
+		}
+
+		// Set gender
+		player->SetByteValue(UNIT_FIELD_BYTES_0, 2, GENDER_MALE);
+		// Change display ID
+		player->SetDisplayId(player->getRace() == RACE_BLOODELF ? displayId+1 : displayId-1);
+		player->SetNativeDisplayId(player->getRace() == RACE_BLOODELF ? displayId+1 : displayId-1);
+
+		ChatHandler(player).PSendSysMessage("Gender changed. You are now a man!");
+		PSendSysMessage("Gender changed for %s", player->GetName());
+		return true;
+	}
+	else if(gender == "female") // FEMALE
+	{
+		if(player->getGender() == GENDER_FEMALE)
+		{
+			PSendSysMessage("%s is already female", player->GetName());
+			SetSentErrorMessage(true);
+			return false;
+		}
+
+		// Set gender
+		player->SetByteValue(UNIT_FIELD_BYTES_0, 2, GENDER_FEMALE);
+		// Change display ID
+		player->SetDisplayId(player->getRace() == RACE_BLOODELF ? displayId-1 : displayId+1);
+		player->SetNativeDisplayId(player->getRace() == RACE_BLOODELF ? displayId-1 : displayId+1);
+
+		ChatHandler(player).PSendSysMessage("Gender changed. You are now a woman!");
+		PSendSysMessage("Gender changed for %s", player->GetName());
+		return true;
+	}
+	else
+	{
+		PSendSysMessage("You must use male or female as gender.");
+		SetSentErrorMessage(true);
+		return false;
+	}
+
+	return true;
+}
+
 bool ChatHandler::HandleFreezeCommand(const char *args)
 {
Index: /trunk/src/game/Chat.cpp
===================================================================
--- /trunk/src/game/Chat.cpp (revision 149)
+++ /trunk/src/game/Chat.cpp (revision 163)
@@ -103,4 +103,5 @@
 		{ "standstate",     SEC_GAMEMASTER,     false, &ChatHandler::HandleStandStateCommand,          "", NULL },
 		{ "morph",          SEC_GAMEMASTER,     false, &ChatHandler::HandleMorphCommand,               "", NULL },
+        { "gender",         SEC_ADMINISTRATOR,  false, &ChatHandler::HandleModifyGenderCommand,        "", NULL },
 		{ NULL,             0,                  false, NULL,                                           "", NULL }
     };
@@ -284,4 +285,14 @@
 		{ NULL,             0,                  false, NULL,                                           "", NULL }
     };
+    
+    static ChatCommand petCommandTable[] =
+	{
+		{ "create",         SEC_GAMEMASTER,     false, &ChatHandler::HandleCreatePetCommand,           "", NULL },
+		{ "learn",          SEC_GAMEMASTER,     false, &ChatHandler::HandlePetLearnCommand,            "", NULL },
+		{ "unlearn",        SEC_GAMEMASTER,     false, &ChatHandler::HandlePetUnlearnCommand,          "", NULL },
+		{ "tp",             SEC_GAMEMASTER,     false, &ChatHandler::HandlePetTpCommand,               "", NULL },
+		{ NULL,             0,                  false, NULL,                                           "", NULL }
+	};
+
 
     static ChatCommand groupCommandTable[] =
@@ -421,4 +432,5 @@
 		{ "move",           SEC_GAMEMASTER,     false, &ChatHandler::HandleMoveObjectCommand,          "", NULL },
 		{ "near",           SEC_ADMINISTRATOR,  false, &ChatHandler::HandleNearObjectCommand,          "", NULL },
+        { "activate",       SEC_GAMEMASTER,     false, &ChatHandler::HandleActivateObjectCommand,      "", NULL },
 		{ NULL,             0,                  false, NULL,                                           "", NULL }
     };
@@ -476,4 +488,5 @@
 		{ "instance",       SEC_ADMINISTRATOR,  true,  NULL,                                           "", instanceCommandTable },
 		{ "server",         SEC_ADMINISTRATOR,  true,  NULL,                                           "", serverCommandTable },
+        { "pet",            SEC_GAMEMASTER,     false, NULL,                                           "", petCommandTable },
 
 		{ "aura",           SEC_ADMINISTRATOR,  false, &ChatHandler::HandleAuraCommand,                "", NULL },
@@ -541,4 +554,5 @@
 		{ "chardelete",     SEC_CONSOLE,        true,  &ChatHandler::HandleCharacterDeleteCommand,     "", NULL },
 		{ "sendmessage",    SEC_ADMINISTRATOR,  true,  &ChatHandler::HandleSendMessageCommand,         "", NULL },
+        { "playall",        SEC_ADMINISTRATOR,  false, &ChatHandler::HandlePlayAllCommand,             "", NULL },
         { "repairitems",    SEC_GAMEMASTER,     false, &ChatHandler::HandleRepairitemsCommand,         "", NULL },
 		{ "freeze",         SEC_ADMINISTRATOR,  false, &ChatHandler::HandleFreezeCommand,              "", NULL }, 
Index: /trunk/src/game/Level2.cpp
===================================================================
--- /trunk/src/game/Level2.cpp (revision 149)
+++ /trunk/src/game/Level2.cpp (revision 163)
@@ -4128,2 +4128,202 @@
     return true;
 }
+
+bool ChatHandler::HandleCreatePetCommand(const char* args)
+{
+	Player *player = m_session->GetPlayer();
+	Creature *creatureTarget = getSelectedCreature();
+
+	CreatureInfo const* cInfo = objmgr.GetCreatureTemplate(creatureTarget->GetEntry());
+	// Creatures with family 0 crashes the server
+	if(cInfo->family == 0)
+	{
+		PSendSysMessage("This creature cannot be tamed. (family id: 0).");
+		SetSentErrorMessage(true);
+		return false;
+	}
+
+	if(player->GetPetGUID())
+	{
+		PSendSysMessage("You already have a pet");
+		SetSentErrorMessage(true);
+		return false;
+	}
+	
+	if(!creatureTarget || creatureTarget->isPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER)
+	{
+		PSendSysMessage(LANG_SELECT_CREATURE);
+		SetSentErrorMessage(true);
+		return false;
+	}
+
+	// Everything looks OK, create new pet
+	Pet* pet = new Pet(HUNTER_PET);
+
+	if(!pet->CreateBaseAtCreature(creatureTarget))
+	{
+		delete pet;
+		PSendSysMessage("Error 1");
+		return false;
+	}
+
+	creatureTarget->setDeathState(JUST_DIED);
+	creatureTarget->RemoveCorpse();
+	creatureTarget->SetHealth(0); // just for nice GM-mode view
+
+	pet->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, player->GetGUID());
+	pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, player->GetGUID());
+	pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->getFaction());
+
+	if(!pet->InitStatsForLevel(creatureTarget->getLevel()))
+	{
+		sLog.outError("ERROR: InitStatsForLevel() in EffectTameCreature failed! Pet deleted.");
+		PSendSysMessage("Error 2");
+		return false;
+	}
+
+	// prepare visual effect for levelup
+	pet->SetUInt32Value(UNIT_FIELD_LEVEL,creatureTarget->getLevel()-1);
+
+	 pet->GetCharmInfo()->SetPetNumber(objmgr.GeneratePetNumber(), true);
+	 // this enables pet details window (Shift+P)
+	 pet->AIM_Initialize();
+	 pet->InitPetCreateSpells();
+	 pet->SetHealth(pet->GetMaxHealth());
+
+	 MapManager::Instance().GetMap(pet->GetMapId(), pet)->Add((Creature*)pet);
+
+	 // visual effect for levelup
+	 pet->SetUInt32Value(UNIT_FIELD_LEVEL,creatureTarget->getLevel());
+
+	 player->SetPet(pet);
+	 pet->SavePetToDB(PET_SAVE_AS_CURRENT);
+	 player->PetSpellInitialize();
+
+	return true;
+}
+
+bool ChatHandler::HandlePetLearnCommand(const char* args)
+{
+	if(!*args)
+		return false;
+
+	Player *plr = m_session->GetPlayer();
+	Pet *pet = plr->GetPet();
+
+	if(!pet)
+	{
+		PSendSysMessage("You have no pet");
+		SetSentErrorMessage(true);
+		return false;
+	}
+
+	uint32 spellId = extractSpellIdFromLink((char*)args);
+
+	if(!spellId || !sSpellStore.LookupEntry(spellId))
+        return false;
+
+	// Check if pet already has it
+	if(pet->HasSpell(spellId))
+	{
+		PSendSysMessage("Pet already has spell: %u", spellId);
+		SetSentErrorMessage(true);
+        return false;
+	}
+
+	// Check if spell is valid
+	SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
+	if(!spellInfo || !SpellMgr::IsSpellValid(spellInfo))
+    {
+        PSendSysMessage(LANG_COMMAND_SPELL_BROKEN,spellId);
+        SetSentErrorMessage(true);
+        return false;
+    }
+
+	pet->learnSpell(spellId);
+
+	PSendSysMessage("Pet has learned spell %u", spellId);
+	return true;
+}
+
+bool ChatHandler::HandlePetUnlearnCommand(const char *args)
+{
+	if(!*args)
+		return false;
+
+	Player *plr = m_session->GetPlayer();
+	Pet *pet = plr->GetPet();
+
+	if(!pet)
+	{
+		PSendSysMessage("You have no pet");
+		SetSentErrorMessage(true);
+		return false;
+	}
+
+	uint32 spellId = extractSpellIdFromLink((char*)args);
+
+	if(pet->HasSpell(spellId))
+		pet->removeSpell(spellId);
+	else
+		PSendSysMessage("Pet doesn't have that spell");
+
+	return true;
+}
+
+bool ChatHandler::HandlePetTpCommand(const char *args)
+{
+	if(!*args)
+		return false;
+
+	Player *plr = m_session->GetPlayer();
+	Pet *pet = plr->GetPet();
+
+	if(!pet)
+	{
+		PSendSysMessage("You have no pet");
+		SetSentErrorMessage(true);
+		return false;
+	}
+
+	uint32 tp = atol(args);
+
+	pet->SetTP(tp);
+
+	PSendSysMessage("Pet's tp changed to %u", tp);
+	return true;
+}
+
+bool ChatHandler::HandleActivateObjectCommand(const char *args)
+{
+	if(!*args)
+		return false;
+
+	char* cId = extractKeyFromLink((char*)args,"Hgameobject");
+    if(!cId)
+        return false;
+
+    uint32 lowguid = atoi(cId);
+    if(!lowguid)
+        return false;
+
+    GameObject* obj = NULL;
+
+    // by DB guid
+    if (GameObjectData const* go_data = objmgr.GetGOData(lowguid))
+        obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id);
+
+    if(!obj)
+    {
+        PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid);
+        SetSentErrorMessage(true);
+        return false;
+    }
+
+	// Activate
+	obj->SetLootState(GO_READY);
+	obj->UseDoorOrButton(10000);
+
+	PSendSysMessage("Object activated!");
+
+	return true;
+}
Index: /trunk/src/game/Language.h
===================================================================
--- /trunk/src/game/Language.h (revision 149)
+++ /trunk/src/game/Language.h (revision 163)
@@ -729,4 +729,5 @@
     LANG_INSTANCE_MUST_RAID_GRP         = 5007,
     LANG_INSTANCE_NOT_AS_GHOST          = 5008,
+    LANG_COMMAND_PLAYED_TO_ALL          = 5009,
 	// Room for more Trinity strings 5009-9999
 
Index: /trunk/sql/updates/171_world.sql
===================================================================
--- /trunk/sql/updates/171_world.sql (revision 163)
+++ /trunk/sql/updates/171_world.sql (revision 163)
@@ -0,0 +1,17 @@
+DELETE FROM trinity_string WHERE entry IN (57,58,5009);
+
+INSERT INTO trinity_string VALUES
+(57,'Using World DB: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
+(58,'Using script library: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+(5009,'Sound %u Played to server',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+
+
+DELETE FROM `command` WHERE name IN ('pet create','pet learn','pet unlearn','pet tp','gobject activate','playall');
+INSERT INTO `command` (name,security,help) VALUES
+('pet create',2,'Syntax: .pet create\r\n\r\nCreates a pet of the selected creature.'),
+('pet learn',2,'Syntax: .pet learn\r\n\r\nLearn #spellid to pet.'),
+('pet unlearn',2,'Syntax: .pet unlean\r\n\r\nunLearn #spellid to pet.'),
+('pet tp',2,'Syntax: .pet tp #\r\n\r\nChange pet\'s amount of training points.'),
+('modify gender',2,'Syntax: .modify gender\r\n\r\n.modify gender #male/female - Turns selected player into a male or female'),
+('gobject activate',2,'Syntax: .gobject activate #guid\r\n\r\nActivates an object like a door or a button.'),
+('playall',2,'Syntax: .playall #soundid\r\n\r\nPlayer a sound to whole server.');
