const script = {
	ClientPort: 0,
	MachineAddress: "",
	ServerPort: 0,
	PingUrl: "",
	PingInterval: 120,
	UserName: "",
	SeleniumTestMode: false,
	UserId: 0,
	SuperSafeChat: false,
	CharacterAppearance: "http://assetgame.rowblox.cf/Asset/CharacterFetch.ashx?userId=&placeId=1818",
	ClientTicket: "",
	GameId: "00000000-0000-0000-0000-000000000000",
	PlaceId: 0,
	MeasurementUrl: "",
	WaitingForCharacterGuid: "4d8dfc8d-cd68-4ed7-8adc-efebaba40f58",
	BaseUrl: "http://rowblx.xyz/",
	ChatStyle: "ClassicAndBubble",
	VendorId: 0,
	ScreenShotInfo: "",
	VideoInfo:
		'<?xml version="1.0"?><entry xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:yt="http://gdata.youtube.com/schemas/2007"><media:group><media:title type="plain"><![CDATA[ROBLOX Place]]></media:title><media:description type="plain"><![CDATA[ For more games visit http://www.roblox.com]]></media:description><media:category scheme="http://gdata.youtube.com/schemas/2007/categories.cat">Games</media:category><media:keywords>ROBLOX, video, free game, online virtual world</media:keywords></media:group></entry>',
	CreatorId: 0,
	CreatorTypeEnum: "User",
	MembershipType: "",
	AccountAge: 365,
	CookieStoreFirstTimePlayKey: "rbx_evt_ftp",
	CookieStoreFiveMinutePlayKey: "rbx_evt_fmp",
	CookieStoreEnabled: true,
	IsRobloxPlace: true,
	GenerateTeleportJoin: false,
	IsUnknownOrUnder13: false,
	SessionId: "01d86c45-e649-4d4b-8726-2c9026fd7b53|00000000-0000-0000-0000-000000000000|0|204.236.226.210|8|2016-08-18T07:50:15.7522758Z|0|null|null|null|null",
	DataCenterId: 0,
	UniverseId: 0,
	BrowserTrackerId: 0,
	UsePortraitMode: false,
	FollowUserId: 0,
	characterAppearanceId: 0
};

import signer from "./signer";

export default function (id, username, ip, port, membership) {
	let joinscript = script;
	script.UserId = Number(id);
	script.UserName = username;
	script.MachineAddress = ip;
	script.ServerPort = Number(port);
	script.MembershipType = membership;

	let joinscriptText = JSON.stringify(joinscript, null, null);
	let sig = signer(joinscriptText);
	joinscript = `--rbxsig%${sig}%\n${joinscriptText}`;

	return joinscript;
}
