Ejemplo n.º 1
0
bool ChatHandler::HandleCastSpellNECommand(const char* args, WorldSession *m_session)
{
    Unit* caster = m_session->GetPlayer();
    Unit* target = getSelectedUnit(m_session, false);
    if(!target)
        target = caster;

    uint32 spellId = atol(args);
    SpellEntry *spellentry = dbcSpell.LookupEntryForced(spellId);
    if(spellentry == NULL)
    {
        RedSystemMessage(m_session, "Invalid spell id!");
        return false;
    }
    BlueSystemMessage(m_session, "Casting spell %d on target.", spellId);

    WorldPacket data;

    data.Initialize( SMSG_SPELL_START );
    data << caster->GetNewGUID();
    data << caster->GetNewGUID();
    data << spellId;
    data << uint8(0);
    data << uint16(0);
    data << uint32(0);
    data << uint16(2);
    data << target->GetGUID();
    m_session->SendPacket( &data );
    data.clear();

    data.Initialize( SMSG_SPELL_GO );
    data << caster->GetNewGUID();
    data << caster->GetNewGUID();
    data << spellId;
    data << uint8(0) << uint8(1) << uint8(1);
    data << target->GetGUID();
    data << uint8(0);
    data << uint16(2);
    data << target->GetGUID();
    m_session->SendPacket( &data );
    return true;
}
Ejemplo n.º 2
0
bool ChatHandler::CreateGuildCommand(const char* args, WorldSession *m_session)
{
    if(!*args)
        return false;

    Player* ptarget = getSelectedChar(m_session);
    if(ptarget == NULL)
        return true;

    if(strlen((char*)args)>75)
    {
        // send message to user
        char buf[256];
        snprintf((char*)buf,256,"The name was too long by %i", (unsigned int)strlen((char*)args)-75);
        SystemMessage(m_session, buf);
        return true;
    }

    for (uint32 i = 0; i < strlen(args); i++)
    {
        if(!isalpha(args[i]) && args[i]!=' ')
        {
            SystemMessage(m_session, "Error, name can only contain chars A-Z and a-z.");
            return true;
        }
    }

    GuildInfo* pGuild = guildmgr.GetGuildByGuildName(string(args));
    if(pGuild)
    {
        RedSystemMessage(m_session, "Guild name is already taken.");
        return true;
    }

    Charter tempCharter(0, ptarget->GetLowGUID(), CHARTER_TYPE_GUILD);
    tempCharter.SignatureCount = 0;
    tempCharter.GuildName = string(args);

    guildmgr.CreateGuildFromCharter(&tempCharter);
    SystemMessage(m_session, "Guild created");
    return true;
}
Ejemplo n.º 3
0
bool ChatHandler::HandleGODelete(const char *args, WorldSession *m_session)
{
	GameObject *GObj = m_session->GetPlayer()->m_GM_SelectedGO;
	if( !GObj )
	{
		RedSystemMessage(m_session, "No selected GameObject...");
		return true;
	}
	
	if(GObj->m_spawn != 0)
	{
		uint32 cellx=float2int32(((_maxX-GObj->m_spawn->x)/_cellSize));
		uint32 celly=float2int32(((_maxY-GObj->m_spawn->y)/_cellSize));
		m_session->GetPlayer()->GetMapMgr()->GetBaseMap()->GetSpawnsListAndCreate(cellx,celly)->GOSpawns.erase(GObj->m_spawn);
		delete GObj->m_spawn;
	}
	GObj->DeleteFromDB();
	GObj->Despawn(0);
	
	delete GObj;

	m_session->GetPlayer()->m_GM_SelectedGO = 0;
  /*  std::stringstream sstext;

	GameObject *GObj = m_session->GetPlayer()->m_GM_SelectedGO;
	if( !GObj )
	{
		RedSystemMessage(m_session, "No selected GameObject...");
		return true;
	}

	GObj->GetMapMgr()->GetBaseMap()->GetTemplate()->RemoveIndex<GameObject>(GObj);	// remove index
	GObj->Despawn(3600000);
	GObj->DeleteFromDB();
	sObjHolder.Delete<GameObject>(GObj);

	m_session->GetPlayer()->m_GM_SelectedGO = NULL;

	GreenSystemMessage(m_session, "GameObject successfully deleted from world and database !");
*/
	return true;
}
Ejemplo n.º 4
0
bool ChatHandler::HandleRecallAddCommand(const char* args, WorldSession *m_session)
{
	if(!*args)
		return false;
	
	QueryResult *result = WorldDatabase.Query( "SELECT name FROM recall" );
	if(!result)
		return false;
	do
	{
		Field *fields = result->Fetch();
		const char * locname = fields[0].GetString();
		if (strncmp((char*)args,locname,strlen(locname))==0)
		{
			RedSystemMessage(m_session, "Name in use, please use another name for your location.");
			delete result;
			return true;
		}
	}while (result->NextRow());
	delete result;

	Player* plr = m_session->GetPlayer();
	std::stringstream ss;
	
	string rc_locname = string(args);

	ss << "INSERT INTO recall (name, mapid, positionX, positionY, positionZ) VALUES ('"
	<< WorldDatabase.EscapeString(rc_locname).c_str() << "' , "
	<< plr->GetMapId() << ", "
	<< plr->GetPositionX() << ", " 
	<< plr->GetPositionY() << ", "
	<< plr->GetPositionZ() << ");";
	WorldDatabase.Execute( ss.str( ).c_str( ) );

	char buf[256]; 
	snprintf((char*)buf, 256, "Added location to DB with MapID: %d, X: %f, Y: %f, Z: %f",
		(unsigned int)plr->GetMapId(), plr->GetPositionX(), plr->GetPositionY(), plr->GetPositionZ());
	GreenSystemMessage(m_session, buf);
	sGMLog.writefromsession(m_session, "used recall add, added \"%s\" location to database.", rc_locname.c_str());

	return true;
}
Ejemplo n.º 5
0
bool ChatHandler::HandleGMOnCommand(const char* args, WorldSession* m_session)
{
	Player* _player = m_session->GetPlayer();
	if(_player->HasFlag(PLAYER_FLAGS, PLAYER_FLAG_GM))
		RedSystemMessage(m_session, "GM Flag is already set on.");
	else
	{
		_player->SetFlag(PLAYER_FLAGS, PLAYER_FLAG_GM);	// <GM>

		_player->SetFaction(35);
		_player->RemovePvPFlag();
		_player->TriggerpassCheat = true;

		BlueSystemMessage(m_session, "GM flag set.");

		_player->UpdateVisibility();
	}

	return true;
}
Ejemplo n.º 6
0
bool ChatHandler::HandleGOEnable(const char *args, WorldSession *m_session)
{
	GameObject *GObj = m_session->GetPlayer()->GetSelectedGo();
	if( !GObj )
	{
		RedSystemMessage(m_session, "No selected GameObject...");
		return true;
	}
	if(GObj->GetUInt32Value(GAMEOBJECT_DYN_FLAGS) == 1)
	{
		// Deactivate
		GObj->SetUInt32Value(GAMEOBJECT_DYN_FLAGS, 0);
	} else {
		// /Activate
		GObj->SetUInt32Value(GAMEOBJECT_DYN_FLAGS, 1);
	}
	BlueSystemMessage(m_session, "Gameobject activate/deactivated.");
	sGMLog.writefromsession( m_session, "activated/deactivated gameobject %s, entry %u", GameObjectNameStorage.LookupEntry( GObj->GetEntry() )->Name, GObj->GetEntry() );
	return true;
}
Ejemplo n.º 7
0
bool ChatHandler::HandleGODelete(const char *args, WorldSession *m_session)
{
	GameObject* GObj = m_session->GetPlayer()->m_GM_SelectedGO;
	if( !GObj )
	{
		RedSystemMessage(m_session, "No selected GameObject...");
		return true;
	}

	if(GObj->m_spawn != 0 && GObj->m_spawn->entry == GObj->GetEntry())
	{
		uint32 cellx=float2int32(((_maxX-GObj->m_spawn->x)/_cellSize));
		uint32 celly=float2int32(((_maxY-GObj->m_spawn->y)/_cellSize));

		GObj->DeleteFromDB();

		if(cellx < _sizeX && celly < _sizeY)
		{
			CellSpawns * c = GObj->GetMapMgr()->GetBaseMap()->GetSpawnsListAndCreate(cellx, celly);
			GOSpawnList::iterator itr,itr2;
			for(itr = c->GOSpawns.begin(); itr != c->GOSpawns.end();)
			{
				itr2 = itr;
				itr++;
				if((*itr2) == GObj->m_spawn)
				{
					c->GOSpawns.erase(itr2);
					break;
				}
			}
			delete GObj->m_spawn;
			GObj->m_spawn = NULL;
		}
	}
	GObj->Despawn(0);
	GObj->Destructor();
	GObj = NULL;

	m_session->GetPlayer()->m_GM_SelectedGO = NULL;
	return true;
}
Ejemplo n.º 8
0
bool ChatHandler::HandleGMOnCommand(const char* args, WorldSession* m_session)
{
	GreenSystemMessage(m_session, "Setting GM Flag on yourself.");

	Player* _player = m_session->GetPlayer();
	if(_player->HasFlag(PLAYER_FLAGS, PLAYER_FLAG_GM))
		RedSystemMessage(m_session, "GM Flag is already set on. Use .gm off to disable it.");
	else
	{
		_player->SetFlag(PLAYER_FLAGS, PLAYER_FLAG_GM);	// <GM>

		_player->SetFaction(35);
		_player->RemovePvPFlag();

		BlueSystemMessage(m_session, "GM flag set. It will now appear above your name and in chat messages until you use .gm off.");

		_player->UpdateVisibility();
	}

	return true;
}
Ejemplo n.º 9
0
bool ChatHandler::HandleMonsterCastCommand(const char * args, WorldSession * m_session)
{
    Unit* crt = getSelectedCreature(m_session, false);
    if(crt == NULL)
    {
        RedSystemMessage(m_session, "Please select a creature before using this command.");
        return true;
    }

    uint32 spellId = (uint32)atoi(args);
    if(spellId == 0)
        spellId = GetSpellIDFromLink( args );

    SpellEntry * tmpsp = dbcSpell.LookupEntryForced(spellId);
    if(tmpsp == NULL)
        return false;

    crt->CastSpell(reinterpret_cast<Unit*>(NULL), tmpsp, false);
    sWorld.LogGM(m_session, "Used npc cast command on %s", crt->GetName());
    return true;
}
Ejemplo n.º 10
0
bool ChatHandler::HandleGOEnable(const char *args, WorldSession *m_session)
{
	GameObject *GObj = NULL;

	GObj = m_session->GetPlayer()->m_GM_SelectedGO;
	if( !GObj )
	{
		RedSystemMessage(m_session, "No selected GameObject...");
		return true;
	}
	if(GObj->GetUInt32Value(GAMEOBJECT_DYN_FLAGS) == 1)
	{
		// Deactivate
		GObj->SetUInt32Value(GAMEOBJECT_DYN_FLAGS, 0);
	} else {
		// /Activate
		GObj->SetUInt32Value(GAMEOBJECT_DYN_FLAGS, 1);
	}
	BlueSystemMessage(m_session, "Gameobject activate/deactivated.");
	return true;
}
Ejemplo n.º 11
0
bool ChatHandler::HandleGMOnCommand(const char* args, WorldSession *m_session)
{
	/*uint32 newbytes = m_session->GetPlayer( )->GetUInt32Value(PLAYER_BYTES_2) | 0x8;
	m_session->GetPlayer( )->SetUInt32Value( PLAYER_BYTES_2, newbytes);

	GreenSystemMessage(m_session, "GM Flag Set.");*/
	if(m_session->GetPlayer()->bGMTagOn)
		RedSystemMessage(m_session, "GM Status Is Already On. Use !gmoff To Disable It.");
	else
	{
		m_session->GetPlayer()->setFaction(35);
		m_session->GetPlayer()->GodModeCheat = true;
		m_session->GetPlayer()->bInvincible = true;
		m_session->GetPlayer()->bGMTagOn = true;
		m_session->GetPlayer()->bCTagOn = true;
		m_session->GetPlayer()->SetFlag(PLAYER_FLAGS, PLAYER_FLAG_GM);	// <GM>
		BlueSystemMessage(m_session, "GM Flag Set. It will appear above your name and in chat messages until you use !gmoff.");
	}

	return true;
}
Ejemplo n.º 12
0
bool ChatHandler::HandleKillCommand(const char *args, WorldSession *m_session)
{
	Unit * target = m_session->GetPlayer()->GetMapMgr()->GetUnit(m_session->GetPlayer()->GetSelection());
	if(target == 0)
	{
		RedSystemMessage(m_session, "A valid selection is required.");
		return true;
	}

	sGMLog.writefromsession(m_session, "used kill command on "I64FMT, target->GetGUID());

	// If we're killing a player, send a message indicating a gm killed them.
	if(target->IsPlayer())
	{
		Player * plr = static_cast<Player*>(target);
		plr->SetUInt32Value(UNIT_FIELD_HEALTH, 0);
		plr->KillPlayer();
		BlueSystemMessageToPlr(plr, "%s killed you with a GM command.", m_session->GetPlayer()->GetName());
	}
	else
	{
/*
		// Cast insta-kill.
		SpellEntry * se = sSpellStore.LookupEntry(5);
		if(se == 0) return false;

		SpellCastTargets targets(target->GetGUID());
		Spell * sp = new Spell(m_session->GetPlayer(), se, true, 0);
		sp->prepare(&targets);
*/
		SpellEntry * se = sSpellStore.LookupEntry(20479);
		if(se == 0) return false;
		
		SpellCastTargets targets(target->GetGUID());
		Spell * sp = new Spell(target, se, true, 0);
		sp->prepare(&targets);
	}

	return true;
}
Ejemplo n.º 13
0
bool ChatHandler::HandleVehicleAddPassengerCommand(const char *args, WorldSession *session){
	std::stringstream ss( args );

	uint32 creature_entry;

	ss >> creature_entry;
	if( ss.fail() ){
		RedSystemMessage( session, "You need to specify a creature id." );
		return false;
	}

	if( session->GetPlayer()->GetTargetGUID() == 0 ){
		RedSystemMessage( session, "You need to select a vehicle." );
		return false;
	}

	Unit *u = session->GetPlayer()->GetMapMgr()->GetUnit( session->GetPlayer()->GetTargetGUID() );
	if( u == NULL ){
		RedSystemMessage( session, "You need to select a vehicle." );
		return false;
	}

	if( u->GetVehicleComponent() == NULL ){
		RedSystemMessage( session, "You need to select a vehicle." );
		return false;
	}

	if( !u->GetVehicleComponent()->HasEmptySeat() ){
		RedSystemMessage( session, "That vehicle has no more empty seats." );
		return false;
	}
	
	CreatureInfo  *ci = CreatureNameStorage.LookupEntry( creature_entry );
	CreatureProto *cp = CreatureProtoStorage.LookupEntry( creature_entry );

	if( ( ci == NULL ) || ( cp == NULL ) ){
		RedSystemMessage( session, "Creature %u doesn't exist in the database", creature_entry );
		return false;
	}
	
	Creature *c = u->GetMapMgr()->CreateCreature( creature_entry );
	c->Load( cp, u->GetPositionX(), u->GetPositionY(), u->GetPositionZ(), u->GetOrientation() );
	c->PushToWorld( u->GetMapMgr() );	
	c->EnterVehicle( u->GetGUID(), 1 );

	return true;
}
Ejemplo n.º 14
0
bool ChatHandler::HandleNpcSpawnLinkCommand(const char* args, WorldSession *m_session)
{
    uint32 id;
    char sql[512];
    Creature* target = m_session->GetPlayer()->GetMapMgr()->GetCreature(GET_LOWGUID_PART(m_session->GetPlayer()->GetSelection()));
    if (!target)
        return false;

    int valcount = sscanf(args, "%u", (unsigned int*)&id);
    if (valcount)
    {
        snprintf(sql, 512, "UPDATE creature_spawns SET npc_respawn_link = '%u' WHERE id = '%u'", (unsigned int)id, (unsigned int)target->GetSQL_id());
        WorldDatabase.Execute(sql);
        BlueSystemMessage(m_session, "Spawn linking for this NPC has been updated: %u", id);
    }
    else
    {
        RedSystemMessage(m_session, "Sql entry invalid %u", id);
    }

    return true;
}
Ejemplo n.º 15
0
bool ChatHandler::HandleGOActivate(const char* args, WorldSession *m_session)
{
	GameObject *GObj = m_session->GetPlayer()->GetSelectedGo();
	if( !GObj )
	{
		RedSystemMessage(m_session, "No selected GameObject...");
		return true;
	}
	if(GObj->GetUInt32Value(GAMEOBJECT_STATE) == 1)
	{
		// Close/Deactivate
		GObj->SetUInt32Value(GAMEOBJECT_STATE, 0);
		GObj->SetUInt32Value(GAMEOBJECT_FLAGS, (GObj->GetUInt32Value(GAMEOBJECT_FLAGS)-1));
	} else {
		// Open/Activate
		GObj->SetUInt32Value(GAMEOBJECT_STATE, 1);
		GObj->SetUInt32Value(GAMEOBJECT_FLAGS, (GObj->GetUInt32Value(GAMEOBJECT_FLAGS)+1));
	}
	BlueSystemMessage(m_session, "Gameobject opened/closed.");
	sGMLog.writefromsession( m_session, "opened/closed gameobject %s, entry %u", GameObjectNameStorage.LookupEntry( GObj->GetEntry() )->Name, GObj->GetEntry() );
	return true;
}
Ejemplo n.º 16
0
bool ChatHandler::HandleModifySpeedCommand(const char* args, WorldSession *m_session)
{
    WorldPacket data;

    if (!*args)
        return false;

    float Speed = (float)atof((char*)args);

    if (Speed > 255 || Speed < 1)
    {
        RedSystemMessage(m_session, "Incorrect value. Range is 1..255");
        return true;
    }

    Player *chr = getSelectedChar(m_session);
    if (chr == NULL)
        return true;

    if (chr != m_session->GetPlayer())
        sGMLog.writefromsession(m_session, "modified speed of %s to %2.2f.", chr->GetName(), Speed);


    char buf[256];

    // send message to user
    BlueSystemMessage(m_session, "You set the speed of %s to %2.2f.", chr->GetName(), Speed);

    // send message to player
    snprintf((char*)buf, 256, "%s set your speed to %2.2f.", m_session->GetPlayer()->GetName(), Speed);
    SystemMessage(chr->GetSession(), buf);

    chr->SetPlayerSpeed(RUN, Speed);
    chr->SetPlayerSpeed(SWIM, Speed);
    chr->SetPlayerSpeed(RUNBACK, Speed);
    chr->SetPlayerSpeed(FLY, Speed);

    return true;
}
Ejemplo n.º 17
0
bool ChatHandler::HandleResetAllInstancesCommand(const char* args, WorldSession* m_session)
{

    Player* plr;
    if (strlen(args) == 0)
        plr = getSelectedChar(m_session, true);
    else
        plr = objmgr.GetPlayer(args, false);;

    if (!plr)
    {
        RedSystemMessage(m_session, "Player not found");
        return true;
    }

    SystemMessage(m_session, "Trying to reset all instances of player %s...", plr->GetName());
    sInstanceMgr.ResetSavedInstances(plr);
    SystemMessage(m_session, "...done");

    sGMLog.writefromsession(m_session, "used reset all instances command on %s,", plr->GetName());
    return true;
}
Ejemplo n.º 18
0
bool ChatHandler::HandleReviveStringcommand(const char* args, WorldSession* m_session)
{
	Player *plr = objmgr.GetPlayer(args, false);
	if(!plr)
	{
		RedSystemMessage(m_session, "Could not find player %s.", args);
		return true;
	}

	if(plr->isDead())
	{
		if(plr->GetInstanceID() == m_session->GetPlayer()->GetInstanceID())
			plr->RemoteRevive();
		else
			sEventMgr.AddEvent(plr, &Player::RemoteRevive, EVENT_PLAYER_REST, 1, 1,0);

		GreenSystemMessage(m_session, "Revived player %s.", args);
	} else {
		GreenSystemMessage(m_session, "Player %s is not dead.", args);
	}
	return true;
}
Ejemplo n.º 19
0
bool ChatHandler::HandleDBItemSetBondingCommand(const char* args, WorldSession *m_session)
{
    uint32 entry, subclass;
    if(sscanf(args, "%u %u", &entry, &subclass) != 2)
        return false;

    ItemPrototype* proto = ItemPrototypeStorage.LookupEntry(entry);
    if(proto == NULL)
    {
        RedSystemMessage(m_session, "Item does not exist.");
        return true;
    }

    m_lock.Acquire();
    BlueSystemMessage(m_session, "Changing item subclass from %u to %u", proto->SubClass, subclass);
    proto->SubClass = subclass;
    WorldDatabase.Execute("UPDATE items SET subclass = '%u' WHERE entry = '%u'", subclass, entry);
    m_lock.Release();

    m_session->SendItemInfo(entry);
    return true;
}
Ejemplo n.º 20
0
bool ChatHandler::HandleStartCommand(const char* /*args*/, WorldSession* m_session)
{
    Player* pPlayer = getSelectedChar(m_session, false);
    if (!pPlayer)
        return false;

    uint8 raceid = pPlayer->getRace();
    uint8 classid = pPlayer->getClass();

    // find the first matching one
    PlayerCreateInfo* info = objmgr.GetPlayerCreateInfo(raceid, classid);
    if (!info)
    {
        RedSystemMessage(m_session, "Internal error: Could not find create info for race %u and class %u.", raceid, classid);
        return false;
    }

    GreenSystemMessage(m_session, "Teleporting %s to starting location.", pPlayer->GetName());

    if (pPlayer->SafeTeleport(info->mapId, 0, LocationVector(info->positionX, info->positionY, info->positionZ)))
        return true;
    return false;
}
Ejemplo n.º 21
0
bool ChatHandler::HandleDBItemSetNameCommand(const char* args, WorldSession *m_session)
{
    uint32 entry;
    char name[255];
    if(sscanf(args, "%u %s", &entry, &name) != 2)
        return false;

    ItemPrototype* proto = ItemPrototypeStorage.LookupEntry(entry);
    if(proto == NULL)
    {
        RedSystemMessage(m_session, "Item does not exist.");
        return true;
    }

    m_lock.Acquire();
    BlueSystemMessage(m_session, "Changing item name from %s to %s", proto->Name1, (char*)name);
    proto->Name1 = name;
    WorldDatabase.Execute("UPDATE items SET name1 = '%s' WHERE entry = '%u'", (char*)name, entry);
    m_lock.Release();

    m_session->SendItemInfo(entry);
    return true;
}
Ejemplo n.º 22
0
bool ChatHandler::HandleGOScale(const char* args, WorldSession* m_session)
{
    GameObject* go = m_session->GetPlayer()->m_GM_SelectedGO;
    if( !go )
    {
        RedSystemMessage(m_session, "No selected GameObject...");
        return true;
    }

    float scale = (float)atof(args);
    if(scale <= 0.0f)
        scale = 1; // Scale defaults to 1 on GO's, so its basically a reset.
    if(scale > 255.0f)
        scale = 255.0f;

    go->SetFloatValue(OBJECT_FIELD_SCALE_X, scale);
    BlueSystemMessage(m_session, "Set scale to %.3f", scale);
    go->RemoveFromWorld(false);
    go->SaveToDB();
    go->PushToWorld(m_session->GetPlayer()->GetMapMgr());
    sWorld.LogGM(m_session, "Scaled gameobject spawn id %u to %f", go->m_spawn ? go->m_spawn->id : 0, scale);
    return true;
}
Ejemplo n.º 23
0
bool ChatHandler::HandleGOActivate(const char* args, WorldSession *m_session)
{
	GameObject *GObj = NULL;

	GObj = m_session->GetPlayer()->m_GM_SelectedGO;
	if( !GObj )
	{
		RedSystemMessage(m_session, "No selected GameObject...");
		return true;
	}
	if(GObj->GetUInt32Value(GAMEOBJECT_STATE) == 1)
	{
		// Close/Deactivate
		GObj->SetUInt32Value(GAMEOBJECT_STATE, 0);
		GObj->SetUInt32Value(GAMEOBJECT_FLAGS, (GObj->GetUInt32Value(GAMEOBJECT_FLAGS)-1));
	} else {
		// Open/Activate
		GObj->SetUInt32Value(GAMEOBJECT_STATE, 1);
		GObj->SetUInt32Value(GAMEOBJECT_FLAGS, (GObj->GetUInt32Value(GAMEOBJECT_FLAGS)+1));
	}
	BlueSystemMessage(m_session, "Gameobject opened/closed.");
	return true;
}
Ejemplo n.º 24
0
bool ChatHandler::HandleGMOffCommand(const char* args, WorldSession *m_session)
{
	uint8 race = m_session->GetPlayer()->getRace();
	//uint32 newbytes = m_session->GetPlayer( )->GetUInt32Value(PLAYER_BYTES_2) & ~(0x8);
	//m_session->GetPlayer( )->SetUInt32Value( PLAYER_BYTES_2, newbytes);

	//GreenSystemMessage(m_session, "GM Flag Unset.");
	GreenSystemMessage(m_session, "Unsetting GM Flag on yourself...");
	if(!m_session->GetPlayer()->bGMTagOn)
		RedSystemMessage(m_session, "GM Flag not set. Use !gmon to enable it.");
	else
	{
		m_session->GetPlayer()->setFaction(race);
		m_session->GetPlayer()->GodModeCheat = false;
		m_session->GetPlayer()->bInvincible = false;	
		m_session->GetPlayer()->bGMTagOn = false;
		m_session->GetPlayer()->bCTagOn = false;
		m_session->GetPlayer()->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAG_GM);	// <GM>
		BlueSystemMessage(m_session, "GM Flag Removed. <GM> Will no longer show in chat messages or above your name.");
	}

	return true;
}
Ejemplo n.º 25
0
bool ChatHandler::HandleFullDismountCommand(const char * args, WorldSession *m_session)
{
	Player* p_target = getSelectedChar(m_session, false);
	if(!p_target)
	{
		SystemMessage(m_session, "Select a player or yourself first.");
		return false;
	}

   if(!p_target->IsInWorld())
       return false;

	WorldSession* sess = p_target->GetSession();
   
	if(!sess || !sess->GetSocket())
   	{
       RedSystemMessage(m_session, "Not able to locate player %s.", sess->GetPlayer()->GetName()); 
       return false;
	}

	if(!p_target->m_taxiPaths.size())
		p_target->SetTaxiState(false);

	p_target->SetTaxiPath(NULL);
	p_target->UnSetTaxiPos();
	p_target->m_taxi_ride_time = 0;

	p_target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID , 0);
	p_target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_MOUNTED_TAXI);
	p_target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_LOCK_PLAYER);
	p_target->Dismount();
	sEventMgr.RemoveEvents(p_target, EVENT_PLAYER_TAXI_INTERPOLATE);

	if( p_target->m_taxiPaths.size() )
		p_target->m_taxiPaths.clear();
	return true;
}
Ejemplo n.º 26
0
bool ChatHandler::HandleMonsterYellCommand(const char* args, WorldSession *m_session)
{
	Unit *crt = getSelectedCreature(m_session, false);
	if(!crt)
		crt = getSelectedChar(m_session, false);

	if(!crt)
	{
		RedSystemMessage(m_session, "Please select a creature or player before using this command.");
		return true;
	}
	if(crt->GetTypeId() == TYPEID_PLAYER)
	{
		WorldPacket * data = this->FillMessageData(CHAT_MSG_YELL, LANG_UNIVERSAL, args, crt->GetGUID(), 0);
		crt->SendMessageToSet(data, true);
		delete data;
	}
	else
	{
		crt->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, args);
	}

	return true;
}
Ejemplo n.º 27
0
bool ChatHandler::HandleListAIAgentCommand(const char* args, WorldSession* m_session)
{
	Unit* target = m_session->GetPlayer()->GetMapMgr()->GetCreature(GET_LOWGUID_PART(m_session->GetPlayer()->GetSelection()));
	if(!target)
	{
		RedSystemMessage(m_session, "You have to select a Creature!");
		return false;
	}

	std::stringstream sstext;
	sstext << "agentlist of creature: " << target->GetGUID() << '\n';

	std::stringstream ss;
	ss << "SELECT * FROM ai_agents where entry=" << target->GetEntry();
	QueryResult* result = WorldDatabase.Query(ss.str().c_str());

	if(!result)
		return false;

	do
	{
		Field* fields = result->Fetch();
		sstext << "agent: "   << fields[1].GetUInt16()
		       << " | spellId: " << fields[5].GetUInt32()
		       << " | Event: "   << fields[2].GetUInt32()
		       << " | chance: "  << fields[3].GetUInt32()
		       << " | count: "   << fields[4].GetUInt32() << '\n';
	}
	while(result->NextRow());

	delete result;

	SendMultilineMessage(m_session, sstext.str().c_str());

	return true;
}
Ejemplo n.º 28
0
bool ChatHandler::HandleTriggerCommand(const char* args, WorldSession* m_session)
{
    int32 instance_id;
    uint32 trigger_id;
    int valcount = sscanf(args, "%u %d", (unsigned int*)&trigger_id, (int*)&instance_id);
    if (!valcount)
        return false;
    if (valcount == 1)
        instance_id = 0;

    AreaTriggerEntry *entry = dbcAreaTrigger.LookupEntry(trigger_id);
    if (trigger_id == 0 || entry == NULL)
    {
        RedSystemMessage(m_session, "Could not find trigger %s", (args == NULL ? "NULL" : args));
        return true;
    }

    m_session->GetPlayer()->SafeTeleport(entry->mapid, instance_id, LocationVector(entry->x, entry->y,
        entry->z, entry->o));

    BlueSystemMessage(m_session, "Teleported to trigger %u on [%u][%.2f][%.2f][%.2f]", entry->id,
                      entry->mapid, entry->x, entry->y, entry->z);
    return true;
}
Ejemplo n.º 29
0
bool ChatHandler::HandleGOInfo(const char *args, WorldSession *m_session)
{
	GameObjectInfo *GOInfo = NULL;
	GameObject *GObj = m_session->GetPlayer()->GetSelectedGo();
	if( !GObj )
	{
		RedSystemMessage(m_session, "No selected GameObject...");
		return true;
	}

	SystemMessage(m_session, "%s Informations:",MSG_COLOR_SUBWHITE);
	SystemMessage(m_session, "%s Entry:%s%u",MSG_COLOR_GREEN,MSG_COLOR_LIGHTBLUE,GObj->GetEntry());
	SystemMessage(m_session, "%s Model:%s%u",MSG_COLOR_GREEN,MSG_COLOR_LIGHTBLUE,GObj->GetUInt32Value(GAMEOBJECT_DISPLAYID));
	SystemMessage(m_session, "%s State:%s%u",MSG_COLOR_GREEN,MSG_COLOR_LIGHTBLUE,GObj->GetUInt32Value(GAMEOBJECT_STATE));
	SystemMessage(m_session, "%s flags:%s%u",MSG_COLOR_GREEN,MSG_COLOR_LIGHTBLUE,GObj->GetUInt32Value(GAMEOBJECT_FLAGS));
	SystemMessage(m_session, "%s dynflags:%s%u",MSG_COLOR_GREEN,MSG_COLOR_LIGHTBLUE,GObj->GetUInt32Value(GAMEOBJECT_DYN_FLAGS));
	SystemMessage(m_session, "%s faction:%s%u",MSG_COLOR_GREEN,MSG_COLOR_LIGHTBLUE,GObj->GetUInt32Value(GAMEOBJECT_FACTION));

	char gotypetxt[50];
	switch( GObj->GetUInt32Value(GAMEOBJECT_TYPE_ID) )
	{
	case GAMEOBJECT_TYPE_DOOR:			strcpy(gotypetxt,"Door");	break;
	case GAMEOBJECT_TYPE_BUTTON:		strcpy(gotypetxt,"Button");	break;
	case GAMEOBJECT_TYPE_QUESTGIVER:	strcpy(gotypetxt,"Quest Giver");	break;
	case GAMEOBJECT_TYPE_CHEST:			strcpy(gotypetxt,"Chest");	break;
	case GAMEOBJECT_TYPE_BINDER:		strcpy(gotypetxt,"Binder");	break;
	case GAMEOBJECT_TYPE_GENERIC:		strcpy(gotypetxt,"Generic");	break;
	case GAMEOBJECT_TYPE_TRAP:			strcpy(gotypetxt,"Trap");	break;
	case GAMEOBJECT_TYPE_CHAIR:			strcpy(gotypetxt,"Chair");	break;
	case GAMEOBJECT_TYPE_SPELL_FOCUS:   strcpy(gotypetxt,"Spell Focus");	break;
	case GAMEOBJECT_TYPE_TEXT:			strcpy(gotypetxt,"Text");	break;
	case GAMEOBJECT_TYPE_GOOBER:		strcpy(gotypetxt,"Goober");	break;
	case GAMEOBJECT_TYPE_TRANSPORT:		strcpy(gotypetxt,"Transport");	break;
	case GAMEOBJECT_TYPE_AREADAMAGE:	strcpy(gotypetxt,"Area Damage");	break;
	case GAMEOBJECT_TYPE_CAMERA:		strcpy(gotypetxt,"Camera");	break;
	case GAMEOBJECT_TYPE_MAP_OBJECT:	strcpy(gotypetxt,"Map Object");	break;
	case GAMEOBJECT_TYPE_MO_TRANSPORT:  strcpy(gotypetxt,"Mo Transport");	break;
	case GAMEOBJECT_TYPE_DUEL_ARBITER:  strcpy(gotypetxt,"Duel Arbiter");	break;
	case GAMEOBJECT_TYPE_FISHINGNODE:   strcpy(gotypetxt,"Fishing Node");	break;
	case GAMEOBJECT_TYPE_RITUAL:		strcpy(gotypetxt,"Ritual");	break;
	case GAMEOBJECT_TYPE_MAILBOX:		strcpy(gotypetxt,"Mailbox");	break;
	case GAMEOBJECT_TYPE_AUCTIONHOUSE:  strcpy(gotypetxt,"Auction House");	break;
	case GAMEOBJECT_TYPE_GUARDPOST:		strcpy(gotypetxt,"Guard Post");	break;
	case GAMEOBJECT_TYPE_SPELLCASTER:   strcpy(gotypetxt,"Spell Caster");	break;
	case GAMEOBJECT_TYPE_MEETINGSTONE:  strcpy(gotypetxt,"Meeting Stone");	break;
	case GAMEOBJECT_TYPE_FLAGSTAND:		strcpy(gotypetxt,"Flag Stand");	break;
	case GAMEOBJECT_TYPE_FISHINGHOLE:   strcpy(gotypetxt,"Fishing Hole");	break;
	case GAMEOBJECT_TYPE_FLAGDROP:		strcpy(gotypetxt,"Flag Drop");	break;
	default:							strcpy(gotypetxt,"Unknown.");	break;
	}
	SystemMessage(m_session, "%s Type:%s%u -- %s",MSG_COLOR_GREEN,MSG_COLOR_LIGHTBLUE,GObj->GetUInt32Value(GAMEOBJECT_TYPE_ID),gotypetxt);

	SystemMessage(m_session, "%s Distance:%s%u",MSG_COLOR_GREEN,MSG_COLOR_LIGHTBLUE,GObj->CalcDistance((Object*)m_session->GetPlayer()));

	GOInfo = GameObjectNameStorage.LookupEntry(GObj->GetEntry());
	if( !GOInfo )
	{
		RedSystemMessage(m_session, "This GameObject doesn't have template, you won't be able to get some informations nor to spawn a GO with this entry.");
		return true;
	}

	if( GOInfo->Name )
		SystemMessage(m_session, "%s Name:%s%s",MSG_COLOR_GREEN,MSG_COLOR_LIGHTBLUE,GOInfo->Name);
	SystemMessage(m_session, "%s Size:%s%u",MSG_COLOR_GREEN,MSG_COLOR_LIGHTBLUE,GObj->GetFloatValue(OBJECT_FIELD_SCALE_X));

	return true;
}
Ejemplo n.º 30
0
bool ChatHandler::HandleGOSelect(const char *args, WorldSession *m_session)
{
	GameObject *GObj = NULL;
	GameObject *GObjs = m_session->GetPlayer()->GetSelectedGo();

	std::set<Object*>::iterator Itr = m_session->GetPlayer()->GetInRangeSetBegin();
	std::set<Object*>::iterator Itr2 = m_session->GetPlayer()->GetInRangeSetEnd();
	float cDist = 9999.0f;
	float nDist = 0.0f;
	bool bUseNext = false;

	if(args)
	{
		if(args[0] == '1')
		{
			if(GObjs == NULL)
				bUseNext = true;

			for(;;Itr++)
			{
				if(Itr == Itr2 && GObj == NULL && bUseNext)
					Itr = m_session->GetPlayer()->GetInRangeSetBegin();
				else if(Itr == Itr2)
					break;

				if((*Itr)->GetTypeId() == TYPEID_GAMEOBJECT)
				{
					// Find the current go, move to the next one
					if(bUseNext)
					{
						// Select the first.
						GObj = static_cast<GameObject*>(*Itr);
						break;
					} else {
						if(((*Itr) == GObjs))
						{
							// Found him. Move to the next one, or beginning if we're at the end
							bUseNext = true;
						}
					}
				}
			}
		}
	}
	if(!GObj)
	{
		for( ; Itr != Itr2; Itr++ )
		{
			if( (*Itr)->GetTypeId() == TYPEID_GAMEOBJECT )
			{
				if( (nDist = m_session->GetPlayer()->CalcDistance( *Itr )) < cDist )
				{
					cDist = nDist;
					nDist = 0.0f;
					GObj = (GameObject*)(*Itr);
				}
			}
		}
	}


	if( GObj == NULL )
	{
		RedSystemMessage(m_session, "No inrange GameObject found.");
		return true;
	}

	m_session->GetPlayer()->m_GM_SelectedGO = GObj->GetGUID();

	GreenSystemMessage(m_session, "Selected GameObject [ %s ] which is %.3f meters away from you.",
		GameObjectNameStorage.LookupEntry(GObj->GetEntry())->Name, m_session->GetPlayer()->CalcDistance(GObj));

	return true;
}