Exemplo n.º 1
0
void UPhilipsHueBridge::AquireUserID(bool FromFile)
{

	if (FromFile&&GetUserIDFromLocalFile())
	{
		// Test if the User ID stored local is authorized
		auto HttpRequest1 = FHttpModule::Get().CreateRequest();
		{
			HttpRequest1->OnProcessRequestComplete().BindUObject(this, &UPhilipsHueBridge::HandleUserIDTestRequestComplete);
			HttpRequest1->SetURL(FString(TEXT("http://")) + Configuration.IpAddress + TEXT("/api/") + ConnectedUser);
			HttpRequest1->SetVerb(TEXT("GET"));
			HttpRequest1->ProcessRequest();
		}
		return;
	}

	auto HttpRequest = FHttpModule::Get().CreateRequest();
	{
		HttpRequest->OnProcessRequestComplete().BindUObject(this, &UPhilipsHueBridge::HandleUserIDRequestComplete);
		HttpRequest->SetURL(FString(TEXT("http://")) + Configuration.IpAddress + TEXT("/api"));
		HttpRequest->SetHeader("Content-Type", "application/json");
		HttpRequest->SetVerb(TEXT("POST"));
		HttpRequest->SetContentAsString(UserRequestJson());
		HttpRequest->ProcessRequest();
	}
}
Exemplo n.º 2
0
bool FCrashUpload::SendCheckReportRequest()
{
	FString XMLString;

	UE_LOG(CrashReportClientLog, Log, TEXT("Sending HTTP request (checking report)"));
	auto Request = CreateHttpRequest();
	if (State == EUploadState::CheckingReport)
	{
		AssignReportIdToPostDataBuffer();
		Request->SetURL(UrlPrefix / TEXT("CheckReport"));
		Request->SetHeader(TEXT("Content-Type"), TEXT("text/plain; charset=us-ascii"));
	}
	else
	{
		// This part is Windows-specific on the server
		ErrorReport.LoadWindowsReportXmlFile( XMLString );

		// Convert the XMLString into the UTF-8.
		FTCHARToUTF8 Converter( (const TCHAR*)*XMLString, XMLString.Len() );
		const int32 Length = Converter.Length();
		PostData.Reset( Length );
		PostData.AddUninitialized( Length );
		CopyAssignItems( (ANSICHAR*)PostData.GetData(), Converter.Get(), Length );

		Request->SetURL(UrlPrefix / TEXT("CheckReportDetail"));
		Request->SetHeader(TEXT("Content-Type"), TEXT("text/plain; charset=utf-8"));
	}

	UE_LOG( CrashReportClientLog, Log, TEXT( "PostData Num: %i" ), PostData.Num() );
	Request->SetVerb(TEXT("POST"));
	Request->SetContent(PostData);

	return Request->ProcessRequest();
}
Exemplo n.º 3
0
void FCrashUpload::PostReportComplete()
{
	if (PauseState == EUploadState::PostingReportComplete)
	{
		// Wait for confirmation
		SetCurrentState(EUploadState::WaitingToPostReportComplete);
		return;
	}

	AssignReportIdToPostDataBuffer();

	
	auto Request = CreateHttpRequest();
	Request->SetVerb( TEXT( "POST" ) );
	Request->SetURL(UrlPrefix / TEXT("UploadComplete"));
	Request->SetHeader( TEXT( "Content-Type" ), TEXT( "text/plain; charset=us-ascii" ) );
	Request->SetContent(PostData);
	UE_LOG( CrashReportClientLog, Log, TEXT( "Sending HTTP request: %s" ), *Request->GetURL() );

	if (Request->ProcessRequest())
	{
		SetCurrentState(EUploadState::PostingReportComplete);
	}
	else
	{
		CheckPendingReportsForFilesToUpload();
	}
}
Exemplo n.º 4
0
static void create() {
    verb::create();
    SetVerb("reload");
    SetRules("OBJ", "STR OBJ", "STR here", "here", "every STR");
    SetErrorMessage("reload what?");
    SetHelp("Syntax: reload [every] <OBJ>\n\n"
            "This command loads into memory the file of the object "
            "you specify, and replaces the current copy with a new "
            "copy. If you change something about a sword you are "
            "holding, for example, \"reload sword\" will update the "
            "changes and you will be holding a sword with the updates.\n"
            "  When used with the -r flag it recursively loads all the objects "
            "inherited by the target object. If any of those objects "
            "or the target object's file fail to load, the object "
            "is not updated.\n"
            "    If you \"reload every npc\", then any loaded object that "
            "inherits LIB_NPC gets reloaded. Other valid lib objects "
            "that can be used this way are: room, sentient, armor, item.\n"
            "Please note that if there are too many items to reload, "
            "the command will fail with \"Too long evaluation\" errors.\n"
            "    Books, due to their processing-intensive load time, "
            "are excluded from the \"every\" keyword.\n"
            "Please note that reloading a door also reloads the "
            "door's adjoining rooms.\n"
            "\nSee also: copy, create, delete, modify, initfix, add");
}
Exemplo n.º 5
0
Arquivo: empty.c Projeto: Elohim/FGmud
static void create() {
    verb::create();
    SetVerb("empty");
    SetRules("OBJ");
    SetErrorMessage("Empty what?");
    SetHelp("Syntax: empty <vessel>\n\n"
            "Removes the fluid from a vessel.");
}
Exemplo n.º 6
0
static void create() {
    verb::create();
    SetVerb("pour");
    SetRules("from OBJ into OBJ","from OBJ in OBJ", "OBJ in OBJ","OBJ into OBJ","OBJ on OBJ","OBJ onto OBJ","OBJ out","out OBJ");
    SetErrorMessage("Pour what into what?");
    SetHelp("Syntax: pour <substance> into <vessel>\n\n"
      "Allows you to pour into a vessel designed for containing a substance.");
}
Exemplo n.º 7
0
static void create() {
    verb::create();
    SetVerb("sink");
    SetRules("", "down");
    SetErrorMessage("Sink down?");
    SetHelp("Syntax: <sink down>\n"
      "Allows you to stop swimming, or otherwise attempt to sink in your current medium.\n"
      "See also: sit, lie, stand, swim, fly");
}
Exemplo n.º 8
0
Arquivo: teach.c Projeto: Elohim/FGmud
static void create(){
    verb::create();
    SetVerb("teach");
    SetRules("","STR to LIV","LIV to STR");
    SetErrorMessage("Syntax: teach <ability> to <person>");
    SetHelp("Syntax: teach <ability> to <person>\n\n"
            "This command allows you to teach another person "
            "an ability, spell, or skill.\nSee also: learn");
}
Exemplo n.º 9
0
Arquivo: weigh.c Projeto: Elohim/FGmud
static void create() {
    verb::create();
    SetVerb("weigh");
    SetRules("OBJ");
    SetErrorMessage("What would you like to weigh?");
    SetHelp("Syntax: weigh OBJ\n\n"
            "A general estimate of how much a thing weighs."
            "");
}
Exemplo n.º 10
0
static void create() {
    verb::create();
    SetVerb("dest");
    SetRules("OBS","STR");
    SetErrorMessage("dest what?");
    SetHelp("Syntax: <dest OBJ>\n\n"
      "Destroy an object.\n"
      "\nSee also: zap");
}
Exemplo n.º 11
0
static void create() {
    verb::create();
    SetVerb("backstab");
    SetRules("LIV");
    SetErrorMessage("Who do you want to backstab?");
    SetHelp("Syntax: backstab LIVING\n\n"
      "This sneaky attack allows more devious players to "
      "backstab a specified target.");
}
Exemplo n.º 12
0
Arquivo: bump.c Projeto: Elohim/FGmud
static void create() {
    verb::create();
    SetVerb("bump");
    SetRules("LIV");
    SetErrorMessage("Whom would you like to bump?");
    SetHelp( "Syntax: bump <LIVING>\n\n"        
            "This command allows you bump the living object named "
            "into an adjacent room.  It is quite possible that "
            "bumping may cause you bodily injury.");
}
Exemplo n.º 13
0
void FCrashUpload::UploadNextFile()
{
	UE_LOG(CrashReportClientLog, Log, TEXT("UploadNextFile: have %d pending files"), PendingFiles.Num());

	// Loop to keep trying files until a send succeeds or we run out of files
	while (PendingFiles.Num() != 0)
	{
		FString PathOfFileToUpload = PendingFiles.Pop();
		// Remember if there was already a diagnostics file in the report, so we don't send it twice
		if (PathOfFileToUpload.EndsWith(GDiagnosticsFilename))
		{
			bDiagnosticsFileSent = true;
		}
		
		if (FPlatformFileManager::Get().GetPlatformFile().FileSize(*PathOfFileToUpload) > MaxFileSizeToUpload)
		{
			UE_LOG(CrashReportClientLog, Warning, TEXT("Skipping large crash report file"));
			continue;
		}

		if (!FFileHelper::LoadFileToArray(PostData, *PathOfFileToUpload))
		{
			UE_LOG(CrashReportClientLog, Warning, TEXT("Failed to load crash report file"));
			continue;
		}

		UE_LOG(CrashReportClientLog, Log, TEXT("UploadNextFile: uploading %d bytes ('%s')"), PostData.Num(), *PathOfFileToUpload);
		FString Filename = FPaths::GetCleanFilename(PathOfFileToUpload);
		if (Filename == "diagnostics.txt")
		{
			// Ensure diagnostics file is capitalized for server
			Filename[0] = 'D';
		}

		// Set up request for upload
		UE_LOG(CrashReportClientLog, Log, TEXT("Sending HTTP request (posting file)"));
		auto Request = CreateHttpRequest();
		Request->SetVerb(TEXT("POST"));
		Request->SetHeader(TEXT("Content-Type"), TEXT("application/octet-stream"));
		Request->SetURL(UrlPrefix / TEXT("UploadReportFile"));
		Request->SetContent(PostData);
		Request->SetHeader(TEXT("DirectoryName"), *ErrorReport.GetReportDirectoryLeafName());
		Request->SetHeader(TEXT("FileName"), Filename);
		Request->SetHeader(TEXT("FileLength"), FString::FromInt(PostData.Num()));

		if (Request->ProcessRequest())
		{
			return;
		}

		UE_LOG(CrashReportClientLog, Warning, TEXT("Failed to send file upload request"));
	}
	PostReportComplete();
}
Exemplo n.º 14
0
static void create() {
    verb::create();
    SetVerb("marry");
    SetRules("LIV to LIV");
    SetErrorMessage("Marry whom to whom?");
    SetHelp("Syntax: <marry PLAYER to PLAYER>\n\n"
      "Allows people of great faith to join to souls in marriage.  "
      "In order to marry to people, you must however be in a place "
      "which you find holy.\n\n"
      "See also: divorce");
}
Exemplo n.º 15
0
static void create() {
    verb::create();
    SetVerb("kneel");
    SetRules("down","");
    //SetRules("down", "in OBJ", "down in OBJ", "on OBJ", "down on OBJ");
    SetErrorMessage("Kneel down?");
    SetSynonyms("genuflect");
    SetHelp("Syntax: <kneel down>\n"
      "Allows you to kneel down on the ground.  "
      "See also: sit, stand, lie");
}
Exemplo n.º 16
0
static void create() {
    verb::create();
    SetVerb("resurrect");
    SetRules("OBJ", "here");
    SetErrorMessage("resurrect what?");
    SetHelp("Syntax: resurrect <OBJ>\n\n"
            "Bring back to life something that died. When used on the corpse\n"
            "of a player, it brings them back from death without skill or\n"
            "experience penalties.\n"
            "See also: zap, dest");
}
Exemplo n.º 17
0
Arquivo: marry.c Projeto: Elohim/FGmud
static void create() {
    verb::create();
    SetVerb("marry");
    SetRules("LIV to LIV");
    SetErrorMessage("Marry whom to whom?");
    SetHelp("Syntax: marry <PLAYER> to <PLAYER>\n\n"
            "Allows people of proper divine or legal authority to join two "
            "souls in marriage. In order to marry people, you must be in an "
            "appropriate location for it.\n"
            "See also: divorce");
}
Exemplo n.º 18
0
static void create() {
    verb::create();
    SetVerb("unlock");
    SetRules("OBJ with OBJ");
    SetErrorMessage("Unlock what with what?");
    SetHelp("Syntax: <unlock OBJ with OBJ>\n\n"
      "The first object is something you wish to unlock, like a "
      "door or a chest.  The second is the key you wish to use to "
      "unlock it with.  If your key is the right key, then "
      "unlock allows you to unlock it.\n\n"
      "See also: close, lock, open, pick");
}
Exemplo n.º 19
0
static void create() {
    verb::create();
    SetVerb("steal");
    SetRules("OBJ from LIV", "WRD from LIV", "OBS from LIV");
    SetErrorMessage("Steal what from whom?");
    SetHelp("Syntax: <steal money from LIVING>\n"
      "        <steal ITEM from LIVING>\n"
      "        <steal all [of ITEMS] from LIVING>\n\n"
      "Uses your stealing abilities to rob another of items or money.  "
      "Items are much harder to steal than money, and trying to steal "
      "multiple items in one shot is dangerous.");
}
Exemplo n.º 20
0
Arquivo: skin.c Projeto: Elohim/FGmud
static void create() {
    verb::create();
    SetVerb("skin");
    SetRules("STR with OBJ", "OBJ with OBJ");
    SetErrorMessage("Skin with what?  Is there anything in particular to skin?");
    SetHelp("Syntax:  <skin THING with TOOL>\n\n"
            "Allows you to skin with skinning tools.  Sometimes you may "
            "be required to specify what it is you wish to skin.  In "
            "that case, you can use the thing field to specify what it is "
            "you wish to skin.\n\n"
            "See also: fillet");
}
Exemplo n.º 21
0
Arquivo: sleep.c Projeto: Elohim/FGmud
static void create() {
    verb::create();
    SetVerb("sleep");
    SetRules("");
    SetErrorMessage("Sleep?");
    SetSynonyms("go to sleep");
    SetHelp("Syntax: sleep\n"
            "If lying down, you fall asleep. If not, you collapse "
            "asleep. Being attacked will usually wake you up, "
            "otherwise you will awaken after a few minutes, stronger "
            "and more refreshed.");
}
Exemplo n.º 22
0
Arquivo: turn.c Projeto: Elohim/FGmud
static void create() {
    verb::create();
    SetVerb("turn");
    SetRules("", "OBJ", "on OBJ", "off OBJ", "OBJ on", "OBJ off");
    SetErrorMessage("Turn on or turn off something?");
    SetHelp("Syntax: <turn>\n"
            "        <turn on ITEM>\n"
            "        <turn off ITEM>\n"
            "        <turn on THING on ITEM>\n"
            "        <turn off THING on ITEM>\n\n"
            "");  
}
Exemplo n.º 23
0
static void create() {
    verb::create();
    SetVerb("drive");
    SetRules("STR", "into STR" );
    SetErrorMessage("Drive in which direction?");
    SetHelp("Syntax: <drive DIRECTION>\n"
      "        <drive into PLACE>\n\n"
      "Moves your vehicle towards the direction you specify, or into the place "
      "you specify.  The command \"drive into\" is synonymous with the "
      "\"enter\" command.\n\n"
      "See also: mount, dismount");
}
Exemplo n.º 24
0
Arquivo: move.c Projeto: Elohim/FGmud
static void create() {
    verb::create();
    SetVerb("move");
    SetRules("OBJ", "STR on OBJ");
    SetSynonyms("shove");
    SetErrorMessage("Move what? Or move what on what?");
    SetHelp("Syntax: <move OBJECT>\n"
            "        <move THING on OBJECT>\n\n"
            "Allows you to move an object, or perhaps a thing on the "
            "object.  For example, you might want to "
            "\"move the painting on the wall\", or simply \"move carpet\".\n\n"
            "Synonyms: shove");
}
Exemplo n.º 25
0
bool UPhilipsHueBridge::HandleTicker(float DeltaTime)
{
	
	auto HttpRequest = FHttpModule::Get().CreateRequest();
	{
		HttpRequest->OnProcessRequestComplete().BindUObject(this, &UPhilipsHueBridge::HandleHttpRequestComplete);
		HttpRequest->SetURL(FString(TEXT("http://")) + Configuration.IpAddress + TEXT("/api/") + ConnectedUser + TEXT("/lights"));
		HttpRequest->SetVerb(TEXT("GET"));
		HttpRequest->ProcessRequest();
	}

	return !ConnectedUser.IsEmpty();
}
Exemplo n.º 26
0
Arquivo: go.c Projeto: Elohim/FGmud
static void create(){
    verb::create();
    SetVerb("go");
    SetRules("STR", "into STR");
    SetErrorMessage("Go in which direction?");
    SetHelp("Syntax: go <DIRECTION>\n"
            "        go into <PLACE>\n\n"
            "Moves you towards the direction you specify, or into the place "
            "you specify.  The command \"go into\" is synonymous with the "
            "\"enter\" command.  Note that most directions are pre-aliased "
            "for you to the proper \"go\" commands.  For example, "
            "\"go south\" has been pre-aliased to \"s\".\n"
            "See also: climb, enter, jump, fly, swim");
}
Exemplo n.º 27
0
static void create() {
    spell::create();
    SetSpell("healing");
    SetRules("for LIV");
    SetSpellType(SPELL_HEALING);
    SetRequiredMagic(300);
    SetSkills(([ "healing" : 1 ]));
    SetMagicCost( 20, 10);
    SetDifficulty(1);
    SetVerb("pray");
    SetHelp("Syntax: <pray for healing for LIV>\n\n"
            "This minor healing spell provides some minimal "
            "aid to the wounded.");
}
Exemplo n.º 28
0
Arquivo: ask.c Projeto: Elohim/FGmud
static void create() {
    verb::create();
    SetVerb("ask");
    SetRules("LIV STR", "STR", "LIV to STR", "LIV for STR", "LIV about STR");
    SetErrorMessage("Ask what?  Or ask whom to do what?");
    SetHelp("Syntax: ask <LIVING> <SOMETHING>\n"
            "        ask <SOMETHING>\n"
            "        ask <LIVING> about <SOMETHING>\n"
            "        ask <LIVING> to <DO SOMETHING>\n"
            "        ask <LIVING> for <SOMETHING>\n\n"
            "Some npcs and perhaps some inanimate objects will respond "
            "when you query the target with a specific question.\n"
            "See also: reply, say, shout, speak, tell, whisper, yell");
}
Exemplo n.º 29
0
static void create() {
    ::create();
    SetVerb("befriend");
    SetRules("LIV");
    SetErrorMessage("Whom would you like to befriend?");
    SetHelp("Syntax: befriend <LIVING>\n\n"
            "If a living object is specified, this command allows "
            "you to try to make friends. This is a prerequisite to " 
            "successfully mounting an animal. Note that if your "
            "charisma is low "
            "enough, you may fail. Also beware that someone with higher "
            "charisma may steal your mount.\n"
            "See also: mount, dismount, abandon");
}
Exemplo n.º 30
0
void UPhilipsHueBridge::SetLightStateByLightIDRaw(const int32 LightID, const FString StateJson)
{
	if (!Connected)return;
	auto HttpRequest = FHttpModule::Get().CreateRequest();
	{
		FString LightIDStr = FString::FromInt(LightID);
		HttpRequest->OnProcessRequestComplete().BindUObject(this, &UPhilipsHueBridge::HandleLightStateRequestComplete);
		HttpRequest->SetURL(FString(TEXT("http://")) + Configuration.IpAddress + TEXT("/api/") + ConnectedUser + TEXT("/lights/") + LightIDStr + TEXT("/state"));
		HttpRequest->SetHeader("Content-Type", "application/json");
		HttpRequest->SetVerb(TEXT("PUT"));
		HttpRequest->SetContentAsString(StateJson);
		HttpRequest->ProcessRequest();
	}
}