//==================================================================================================
// handles the admin permission list
// it will be read in for the list to display when the player displays it to make changes
// please note that the list is purely db based and *not* kept in memory
// it will be cleared once the changes are made
//
void StructureManager::_HandleQueryAdminPermissionData(StructureManagerAsyncContainer* asynContainer,DatabaseResult* result)
{
	PlayerStructure* structure = dynamic_cast<PlayerStructure*>(gWorldManager->getObjectById(asynContainer->mStructureId));

	string playerName;
	DataBinding* binding = mDatabase->CreateDataBinding(1);
	binding->addField(DFT_bstring,0,64);

	uint64 count;
	count = result->getRowCount();

	for(uint64 i = 0;i < count;i++)
	{
		result->GetNextRow(binding,&playerName);

		structure->addStructureAdminListEntry(playerName);

	}

	structure->sendStructureAdminList(asynContainer->mPlayerId);

	mDatabase->DestroyDataBinding(binding);
}
Example #2
0
void HarvesterObject::handleObjectMenuSelect(uint8 messageType,Object* srcObject)
{
    PlayerObject* player = dynamic_cast<PlayerObject*>(srcObject);
    if(!player)
    {
        return;
    }

    switch(messageType)
    {
    case radId_StructureStatus:
    {
        StructureAsyncCommand command;
        command.Command = Structure_Command_ViewStatus;
        command.PlayerId = player->getId();
        command.StructureId = this->getId();

        gStructureManager->checkNameOnPermissionList(this->getId(),player->GetCreature()->getId(),player->GetCreature()->getFirstName(),"ADMIN",command);

    }
    break;

    case radId_depositPower:
    {
        StructureAsyncCommand command;
        command.Command = Structure_Command_DepositPower;
        command.PlayerId = player->getId();
        command.StructureId = this->getId();

        gStructureManager->checkNameOnPermissionList(this->getId(),player->GetCreature()->getId(),player->GetCreature()->getFirstName(),"ADMIN",command);

    }
    break;

    case radId_payMaintenance:
    {
        StructureAsyncCommand command;
        command.Command = Structure_Command_PayMaintenance;
        command.PlayerId = player->getId();
        command.StructureId = this->getId();

        gStructureManager->checkNameOnPermissionList(this->getId(),player->GetCreature()->getId(),player->GetCreature()->getFirstName(),"ADMIN",command);

    }
    break;

    case radId_serverTerminalManagementDestroy:
    {
        StructureAsyncCommand command;
        command.Command = Structure_Command_Destroy;
        command.PlayerId = player->getId();
        command.StructureId = this->getId();

        gStructureManager->checkNameOnPermissionList(this->getId(),player->GetCreature()->getId(),player->GetCreature()->getFirstName(),"ADMIN",command);

    }
    break;
    case radId_serverTerminalPermissionsAdmin:
    {
        PlayerStructure* structure = dynamic_cast<PlayerStructure*>(gWorldManager->getObjectById(this->getId()));
		
		if(structure->getAdminData().check_admin(player->getId()))	{
			structure->sendStructureAdminList(player->getId());
		}

    }
    break;

    case radId_serverTerminalPermissionsHopper:
    {
		PlayerStructure* structure = dynamic_cast<PlayerStructure*>(gWorldManager->getObjectById(this->getId()));
		
		if(structure->getAdminData().check_admin(player->getId()))	{
			structure->sendStructureHopperList(player->getId());
		}

    }
    break;

    case radId_setName:
    {

        StructureAsyncCommand command;
        command.Command = Structure_Command_RenameStructure;
        command.PlayerId = player->getId();
        command.StructureId = this->getId();

        gStructureManager->checkNameOnPermissionList(this->getId(),player->GetCreature()->getId(),player->GetCreature()->getFirstName(),"ADMIN",command);


    }
    break;

    case radId_operateHarvester:
    {
        StructureAsyncCommand command;
        command.Command = Structure_Command_OperateHarvester;
        command.PlayerId = player->getId();
        command.StructureId = this->getId();

        gStructureManager->checkNameOnPermissionList(this->getId(),player->GetCreature()->getId(),player->GetCreature()->getFirstName(),"HOPPER",command);

    }
    break;

    }
}