public async ValueTask SetHatAsync(HatType hat) { PlayerInfo.Hat = hat; using var writer = _game.StartRpc(NetId, RpcCalls.SetHat); Rpc09SetHat.Serialize(writer, hat); await _game.FinishRpcAsync(writer); }
private async ValueTask <bool> HandleSetHat(ClientPlayer sender, HatType hat) { if (Game.GameState == GameStates.Started && await sender.Client.ReportCheatAsync(RpcCalls.SetHat, "Client tried to change hat while not in lobby")) { return(false); } PlayerInfo.Hat = hat; return(true); }
private IEnumerator FinishSetHat(HatType hatType, GameObject groundHat, float duration) { yield return(new WaitForSeconds(duration)); groundHat.transform.SetParent(transform); groundHat.SetActive(false); abesHat.SetActive(true); if (hatType == HatType.Bear) { abesHatRenderer.material = abesBearHat; } else if (hatType == HatType.StickyFingers) { abesHatRenderer.material = abesStickFingersHat; } else // if (hatType == HatType.Regular) { abesHatRenderer.material = abesRegularHat; } }
public InventoryResponse getInventory(String id, String page, HatType filter, String cookies) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.roblox.com/Trade/InventoryHandler.ashx?token=%22&filter=" + (int)filter + "&userid=" + id + "&page=" + page + "&itemsPerPage=14&_=0"); request.KeepAlive = true; request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0"); request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"; request.Headers.Add("Upgrade-Insecure-Requests", @"1"); request.UserAgent = RobloxUtils.UserAgent; request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, sdch"); request.Headers.Set(HttpRequestHeader.AcceptLanguage, "en-US,en;q=0.8"); request.Headers.Set(HttpRequestHeader.Cookie, cookies); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); using (Stream receiveStream = RobloxUtils.decodeStream(response)) { using (StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8)) { try { return JsonConvert.DeserializeObject<InventoryResponse>(readStream.ReadToEnd()); } catch { return null; } } } }
public void SetHat(HatType hatType, GameObject groundHat, float duration = 1) { groundHat.transform.SetParent(abesHand.transform); groundHat.transform.localPosition = Vector3.zero; StartCoroutine(FinishSetHat(hatType, groundHat, duration)); }
public static void Serialize(IMessageWriter writer, HatType hat) { writer.WritePacked((uint)hat); }
} // enum public Hat(HatType hatType, ColorType color, int size, int serialNumber, string name, string uriImg, double price, int currentAmout, int starterAmount) : base(color, size, serialNumber, name, uriImg, price, currentAmout, starterAmount) { HatType = hatType; ObjType = AbstractItemId.Hat; }
public static void Deserialize(IMessageReader reader, out HatType hat) { hat = (HatType)reader.ReadPackedUInt32(); }
public void RpcSetHat(HatType hat) { PlayerControl.RpcSetHat((uint)hat); }
public ValueTask SetHatAsync(HatType hatType) { return(SetHatAsync((uint)hatType)); }
public override void Load(System.Xml.XmlNode node) { base.Load(node); Graphic = image = new Spritemap(Library.GetTexture("assets/Chest.png"), 64, 64, onAnimationEnd); contents = (HatType)Enum.Parse(typeof(HatType), node.Attributes["chestContents"].Value); }
IEnumerator ReadDialogueRoutine(DialogueData dialogueData) { List <Player> players = PlayerManager.GetSpawnedPlayers(); for (int i = 0; i < players.Count; i++) { players[i].GetInput().bottomControlLens.AddRequest(new LensHandle <bool>(this, false)); } for (_chunkIndex = 0; _chunkIndex < dialogueData.dialogue.Length; _chunkIndex++) { if (_chunkIndex < 0) { _chunkIndex = 0; } Vector3 faceDirection = Vector3.zero; Transform prevLookTarget = null; bool hasNPC = false; PlayerNPCInput npc = null; List <PlayerNPCInput> spawnedNPCs = PlayerManager.GetNPCs(); for (int j = 0; j < spawnedNPCs.Count; j++) { if (spawnedNPCs[j].gameObject.activeInHierarchy && spawnedNPCs[j].GetPlayer().GetInfo().character == dialogueData.dialogue[_chunkIndex].character) { hasNPC = true; npc = spawnedNPCs[j]; faceDirection = npc.transform.forward.SetY(0f); if (dialogueData.facingMode != FacingMode.Stay) { faceDirection = (PlayerManager.GetLeadPlayer().transform.position - npc.transform.position).SetY(0f); if (dialogueData.facingMode != FacingMode.FaceForward) { npc.TweenLookDirection(faceDirection); } } prevLookTarget = npc.GetPlayer().GetPhysics().GetBody().lookTarget; npc.GetPlayer().GetPhysics().GetBody().lookTarget = dialogueData.lookTarget ?? CameraManager.instance.transform; break; } } string pattern = @"\{(.*?)\}"; string dialogue = LocUtils.Translate(dialogueData.dialogue[_chunkIndex].dialogueTerm); #region Dialogue Commands // LOOK FOR COMMANDS IN DIALOGUE // OH LORD WE BEGIN OUR DESCENT INTO MADNESS MatchCollection matchCollection = Regex.Matches(dialogue, pattern); foreach (Match m in matchCollection) { dialogue = dialogue.Replace(m.Value, ""); string value = m.Value.Remove(0, 1); value = value.Remove(value.Length - 1, 1); string[] sections = value.Split(','); if (sections[0] == "SetHat") { if (hasNPC && sections.Length == 2) { if (Enum.IsDefined(typeof(HatType), sections[1])) { HatType hatType = (HatType)Enum.Parse(typeof(HatType), sections[1]); npc.GetPlayer().SetHat(hatType); if (hatType != HatType.None) { Tweakables.VFX.bubblePop.Spawn(ObjectPool.instance.transform, npc.GetPlayer().GetActiveHats()[0].transform.position); } } } else if (sections.Length == 3) { if (Enum.IsDefined(typeof(CharacterType), sections[1])) { CharacterType character = (CharacterType)Enum.Parse(typeof(CharacterType), sections[1]); for (int j = 0; j < spawnedNPCs.Count; j++) { if (spawnedNPCs[j].GetPlayer().GetInfo().character == character) { if (Enum.IsDefined(typeof(HatType), sections[2])) { HatType hatType = (HatType)Enum.Parse(typeof(HatType), sections[2]); spawnedNPCs[j].GetPlayer().SetHat(hatType); if (hatType != HatType.None) { Tweakables.VFX.bubblePop.Spawn(ObjectPool.instance.transform, spawnedNPCs[j].GetPlayer().GetActiveHats()[0].transform.position); } } break; } } } } } else if (sections[0] == "SetSkin") { if (hasNPC && sections.Length == 2) { if (Enum.IsDefined(typeof(SkinType), sections[1])) { SkinType skinType = (SkinType)Enum.Parse(typeof(SkinType), sections[1]); npc.GetPlayer().SetSkin(skinType); } } else if (sections.Length == 3) { if (Enum.IsDefined(typeof(CharacterType), sections[1])) { CharacterType character = (CharacterType)Enum.Parse(typeof(CharacterType), sections[1]); for (int j = 0; j < spawnedNPCs.Count; j++) { if (spawnedNPCs[j].GetPlayer().GetInfo().character == character) { if (Enum.IsDefined(typeof(SkinType), sections[2])) { SkinType skinType = (SkinType)Enum.Parse(typeof(SkinType), sections[2]); spawnedNPCs[j].GetPlayer().SetSkin(skinType); } break; } } } } } } dialogueData.dialogue[_chunkIndex].dialogue = dialogue; #endregion SetCharacter(dialogueData.dialogue[_chunkIndex].character); // Stem Target Transform stemTarget = dialogueData.target; if (!stemTarget && hasNPC) { stemTarget = npc.GetPlayer().GetPhysics().GetSausage().transform; } SetTarget(stemTarget); // Camera Target Vector3 camOffset = dialogueData.offset; Transform camTarget = dialogueData.target; if (camTarget) { faceDirection = camTarget.forward; } else if (hasNPC) { camTarget = npc.transform.GetBoneTagInChildren(BoneLocation.SpineMiddle).transform; camOffset = Vector3.up * 0.5f; } Quaternion targetLookRot = Quaternion.identity; if (camTarget) { if (dialogueData.facingMode == FacingMode.FaceForward && PlayerManager.GetLeadPlayer()) { faceDirection = (PlayerManager.GetLeadPlayer().transform.position - camTarget.transform.position).SetY(0f); } if (faceDirection != Vector3.zero) { targetLookRot = Quaternion.LookRotation(faceDirection, Vector3.up); } CameraManager.RegisterFollowTarget(camTarget, camOffset, dialogueData.camWeight); } CameraManager.SetOverrideSettings(dialogueData.camSettings, targetLookRot.eulerAngles.y); // Jump camera to end position, calculate where bubble will be and then jump it back Vector3 prevCamPos = CameraManager.instance.transform.position; Quaternion prevCamRot = CameraManager.instance.transform.rotation; _snapBubbleToAlonePoint = true; CameraManager.SimpleSnapToTarget(); UpdateBubblePos(); if (_chunkIndex == 0 && dialogueData.snap) { CameraManager.SnapToTarget(); } if (!dialogueData.snap) { CameraManager.instance.transform.position = prevCamPos; CameraManager.instance.transform.rotation = prevCamRot; } // Do emote stuff if (hasNPC) { if (dialogueData.dialogue[_chunkIndex].emote != EmoteType.None) { EmoteTag emoteTag = npc.GetPayload().GetEmote(dialogueData.dialogue[_chunkIndex].emote); emoteTag.Play(dialogueData.dialogue[_chunkIndex].loopEmote); npc.headSwingScaleLens.AddRequest( new LensHandle <float>(this, npc.GetPayload().GetEmote(dialogueData.dialogue[_chunkIndex].emote).GetShakeForce())); if (emoteTag.GetUseEyeBlend()) { npc.GetPlayer().eyeBlendLens.AddRequest(new LensHandle <float>(this, emoteTag.GetEyeBlend())); } } else { npc.headSwingScaleLens.AddRequest(new LensHandle <float>(this, 0.3f)); } } int prevIndex = _chunkIndex; // Hack to go back to page backwards for debug _readChunkRoutine = StartCoroutine(ReadChunkRoutine(dialogueData.dialogue[_chunkIndex], npc, dialogueData.voiceEvent)); while (_readChunkRoutine != null) { yield return(null); } if (!gameObject.activeSelf || npc == null) { yield break; } _optionLayout.SetActive(false); foreach (var optionButton in _optionButtons) { optionButton.gameObject.SetActive(false); } if (dialogueData.dialogue[prevIndex].chunkType == DialogueChunk.ChunkType.Choice) { dialogueData.dialogue[prevIndex].SaveResponse(); } if (hasNPC) { if (dialogueData.dialogue[prevIndex].emote != EmoteType.None && dialogueData.dialogue[prevIndex].loopEmote) { npc.GetPayload().GetEmote(dialogueData.dialogue[prevIndex].emote).Stop(); } npc.GetPlayer().eyeBlendLens.RemoveRequestsWithContext(this); npc.GetPlayer().GetPhysics().GetBody().lookTarget = prevLookTarget; npc.headSwingScaleLens.RemoveRequestsWithContext(this); } CameraManager.SetOverrideSettings(null, null); if (camTarget) { CameraManager.DeregisterFollowTarget(camTarget); } if ((prevIndex == dialogueData.dialogue.Length - 1) && dialogueData.snapBack) { CameraManager.SnapToTarget(); } } for (int i = 0; i < players.Count; i++) { if (players[i]) { players[i].GetInput().bottomControlLens.RemoveRequestsWithContext(this); } } }