public Package RespawnHandler(McpeRespawn packet, Player player) { SendNameTag(player); player.RemoveAllEffects(); player.SetEffect(new Speed { Level = 1, Duration = Effect.MaxDuration }); // 10s in ticks //player.SetEffect(new Slowness { Level = 20, Duration = 20 * 10 }); //player.SetEffect(new Haste { Level = 20, Duration = 20 * 10 }); //player.SetEffect(new MiningFatigue { Level = 20, Duration = 20 * 10 }); //player.SetEffect(new Strength { Level = 20, Duration = 20 * 10 }); player.SetEffect(new JumpBoost { Level = 1, Duration = Effect.MaxDuration }); //player.SetEffect(new Blindness { Level = 20, Duration = 20 * 10 }); //player.SetAutoJump(true); if (player.Level.LevelId.Equals("Default")) { player.Level.CurrentWorldTime = 6000; player.Level.IsWorldTimeStarted = false; } player.SendSetTime(); return(packet); }
public virtual void Kill() { lock (_killSync) { if (IsDead) return; IsDead = true; Health = 0; } var player = Entity as Player; if (player != null) { player.SendUpdateAttributes(); } Entity.BroadcastEntityEvent(); if (player != null) { //SendWithDelay(2000, () => //{ //}); Entity.BroadcastSetEntityData(); Entity.DespawnEntity(); if (!Entity.Level.KeepInventory) { player.DropInventory(); } var mcpeRespawn = McpeRespawn.CreateObject(); mcpeRespawn.x = player.SpawnPosition.X; mcpeRespawn.y = player.SpawnPosition.Y; mcpeRespawn.z = player.SpawnPosition.Z; player.SendPackage(mcpeRespawn); } else { // This is semi-good, but we need to give the death-animation time to play. SendWithDelay(2000, () => { Entity.BroadcastSetEntityData(); Entity.DespawnEntity(); if (LastDamageSource is Player && Entity.Level.DoMobloot) { var drops = Entity.GetDrops(); foreach (var drop in drops) { Entity.Level.DropItem(Entity.KnownPosition.ToVector3(), drop); } } }); } }
public override void HandleMcpeRespawn(McpeRespawn mcpeRespawn) { PlayerLocation oldSpawnPosition = SpawnPosition.Clone() as PlayerLocation; PlayerRespawnEventArgs respawnEvent = new PlayerRespawnEventArgs(this, null); respawnEvent.OnCallEvent(); SpawnPosition = respawnEvent.GetRespawnLocation() ?? SpawnPosition; base.HandleMcpeRespawn(mcpeRespawn); SpawnPosition = oldSpawnPosition; }
public Package RespawnHandler(McpeRespawn packet, Player player) { //player.SetEffect(new Speed {Level = 1, Duration = Effect.MaxDuration}); ////player.SetEffect(new Slowness {Level = 2, Duration = 20}); //player.SetEffect(new JumpBoost {Level = 1, Duration = Effect.MaxDuration}); player.SetAutoJump(true); if (player.Level.LevelId.Equals("Default")) { player.Level.CurrentWorldTime = 6000; player.Level.IsWorldTimeStarted = false; } player.SendSetTime(); return(packet); }
/// <summary> /// Handles the respawn. /// </summary> /// <param name="msg">The MSG.</param> private void HandleRespawn(McpeRespawn msg) { // reset all health states HealthManager.ResetHealth(); // send teleport to spawn KnownPosition = new PlayerLocation { X = Level.SpawnPoint.X, Y = Level.SpawnPoint.Y, Z = Level.SpawnPoint.Z, Yaw = 91, Pitch = 28, HeadYaw = 91 }; SendSetHealth(); SendPackage(new McpeAdventureSettings { flags = Level.IsSurvival ? 0x20 : 0x80 }); //SendPackage(new McpeAdventureSettings { flags = Level.IsSurvival ? 0x80 : 0x80 }); SendPackage(new McpeContainerSetContent { windowId = 0, slotData = Inventory.Slots, hotbarData = Inventory.ItemHotbar }); SendPackage(new McpeContainerSetContent { windowId = 0x78, // Armor windows ID slotData = Inventory.Armor, hotbarData = null }); BroadcastSetEntityData(); // Broadcast spawn to all Level.AddPlayer(this); SendMovePlayer(); }
public Package RespawnHandler(McpeRespawn packet, Player player) { SendNameTag(player); player.RemoveAllEffects(); player.SetEffect(new Speed { Level = 1, Duration = Effect.MaxDuration }); // 10s in ticks //player.SetEffect(new Slowness { Level = 20, Duration = 20 * 10 }); //player.SetEffect(new Haste { Level = 20, Duration = 20 * 10 }); //player.SetEffect(new MiningFatigue { Level = 20, Duration = 20 * 10 }); //player.SetEffect(new Strength { Level = 20, Duration = 20 * 10 }); player.SetEffect(new JumpBoost { Level = 1, Duration = Effect.MaxDuration }); //player.SetEffect(new Blindness { Level = 20, Duration = 20 * 10 }); //player.SetAutoJump(true); return(packet); }
public virtual void Kill() { if (IsDead) { return; } IsDead = true; Health = 0; var player = Entity as Player; if (player != null) { // HACK if (LastDamageCause == DamageCause.EntityAttack) { Player source = LastDamageSource as Player; if (source != null) { source.Kills++; } player.Deaths++; } player.DropInventory(); player.SendSetHealth(); player.BroadcastEntityEvent(); } Entity.BroadcastSetEntityData(); Entity.DespawnEntity(); if (player != null) { var mcpeRespawn = McpeRespawn.CreateObject(); mcpeRespawn.x = player.SpawnPosition.X; mcpeRespawn.y = player.SpawnPosition.Y; mcpeRespawn.z = player.SpawnPosition.Z; player.SendPackage(mcpeRespawn); } }
public void RespawnHandler(McpeRespawn packet, Player player) { Console.WriteLine("respawn"); string[] PlayerInv = inv[player.Username].Split('|'); Item item; for (var i = 0; i < player.Inventory.Slots.Count; i++) { item = ItemFactory.GetItem(Convert.ToInt16(PlayerInv[i].Split(',')[0]), Convert.ToInt16(PlayerInv[i].Split(',')[1]), Convert.ToByte(PlayerInv[i].Split(',')[2])); if (item.Count != 0 && item.Id != 0) { player.Inventory.Slots[i] = item; } } string[] PlayerArm = arm[player.Username].Split('|'); player.Inventory.Boots = ItemFactory.GetItem(Convert.ToInt16(PlayerArm[0].Split(',')[0]), Convert.ToInt16(PlayerArm[0].Split(',')[1])); player.Inventory.Leggings = ItemFactory.GetItem(Convert.ToInt16(PlayerArm[1].Split(',')[0]), Convert.ToInt16(PlayerArm[1].Split(',')[1])); player.Inventory.Chest = ItemFactory.GetItem(Convert.ToInt16(PlayerArm[2].Split(',')[0]), Convert.ToInt16(PlayerArm[2].Split(',')[1])); player.Inventory.Helmet = ItemFactory.GetItem(Convert.ToInt16(PlayerArm[3].Split(',')[0]), Convert.ToInt16(PlayerArm[3].Split(',')[1])); player.SendPlayerInventory(); }
private void Player_PlayerTakeHit(object sender, HealthEventArgs e) { Player player = (Player)e.TargetEntity;//受けるほう player.BroadcastEntityEvent(); if (0 >= player.HealthManager.Health) { //https://github.com/DarkLexFirst/SkyBlock-test/blob/25483451a6a2333da3b10bdf33ead546552df26f/SkyBlock%20betaRelease/SkyBlock%20betaRelease/Managers/InventoryManager.cs string Inv = player.Inventory.GetSlots()[0].Id + "," + player.Inventory.GetSlots()[0].Metadata + "," + player.Inventory.GetSlots()[0].Count; for (var i = 1; i < player.Inventory.Slots.Count; i++) { Inv = Inv + "|" + player.Inventory.GetSlots()[i].Id + "," + player.Inventory.GetSlots()[i].Metadata + "," + player.Inventory.GetSlots()[i].Count; } string Arm = player.Inventory.Boots.Id + "," + player.Inventory.Boots.Metadata + "|" + player.Inventory.Leggings.Id + "," + player.Inventory.Leggings.Metadata + "|" + player.Inventory.Chest.Id + "," + player.Inventory.Chest.Metadata + "|" + player.Inventory.Helmet.Id + "," + player.Inventory.Helmet.Metadata; for (var i = 1; i < player.Inventory.Slots.Count; i++) { player.Inventory.Slots[i] = new ItemAir(); } inv.Add(player.Username, Inv); arm.Add(player.Username, Arm); player.Inventory.Clear(); player.HealthManager.TakeHit((Player)e.SourceEntity, 100, player.HealthManager.LastDamageCause); player.SendMessage("aaa"); if (player != null) { player.SendUpdateAttributes(); player.BroadcastEntityEvent(); } player.BroadcastSetEntityData(); player.DespawnEntity(); var mcpeRespawn = McpeRespawn.CreateObject(); mcpeRespawn.x = player.SpawnPosition.X; mcpeRespawn.y = player.SpawnPosition.Y; mcpeRespawn.z = player.SpawnPosition.Z; player.SendPackage(mcpeRespawn); player.HealthManager.ResetHealth(); } }
public virtual void Kill() { if (IsDead) { return; } IsDead = true; Health = 0; var player = Entity as Player; if (player != null) { player.SendUpdateAttributes(); player.BroadcastEntityEvent(); } Entity.BroadcastSetEntityData(); Entity.DespawnEntity(); if (player != null) { player.DropInventory(); var mcpeRespawn = McpeRespawn.CreateObject(); mcpeRespawn.x = player.SpawnPosition.X; mcpeRespawn.y = player.SpawnPosition.Y; mcpeRespawn.z = player.SpawnPosition.Z; player.SendPackage(mcpeRespawn); } else { var drops = Entity.GetDrops(); foreach (var drop in drops) { Entity.Level.DropItem(Entity.KnownPosition.ToVector3(), drop); } } }
protected virtual void HandleRespawn(McpeRespawn msg) { ServerInfo serverInfo = Server.ServerInfo; try { Interlocked.Increment(ref serverInfo.ConnectionsInConnectPhase); // reset all health states HealthManager.ResetHealth(); // send teleport to spawn KnownPosition = new PlayerLocation { X = SpawnPosition.X, Y = SpawnPosition.Y, Z = SpawnPosition.Z, Yaw = 91, Pitch = 28, HeadYaw = 91, }; SendSetHealth(); SendAdventureSettings(); SendPlayerInventory(); BroadcastSetEntityData(); ThreadPool.QueueUserWorkItem(delegate(object state) { Level.SpawnToAll(this); SendChunksForKnownPosition(); }); IsSpawned = true; SendMovePlayer(); Log.InfoFormat("Respawn player {0} on level {1}", Username, Level.LevelId); } finally { Interlocked.Decrement(ref serverInfo.ConnectionsInConnectPhase); } }
public Package RespawnHandler(McpeRespawn packet, Player player) { player.RemoveAllEffects(); player.SetEffect(new Speed { Level = 2, Duration = 1000 }); ////player.SetEffect(new Slowness {Level = 2, Duration = 20}); //player.SetEffect(new JumpBoost { Level = 2, Duration = Effect.MaxDuration }); //player.SetAutoJump(true); if (player.Level.LevelId.Equals("Default")) { player.Level.CurrentWorldTime = 6000; player.Level.IsWorldTimeStarted = false; } player.SendSetTime(); return packet; }
public virtual void HandleMcpeRespawn(McpeRespawn message) { Client.CurrentLocation = new PlayerLocation(message.x, message.y, message.z); }
protected virtual void HandleRespawn(McpeRespawn msg) { HealthManager.ResetHealth(); SendSetHealth(); SendSetSpawnPosition(); SendAdventureSettings(); SendPlayerInventory(); CleanCache(); ForcedSendChunk(SpawnPosition); // send teleport to spawn SetPosition(SpawnPosition); Level.SpawnToAll(this); IsSpawned = true; Log.InfoFormat("Respawn player {0} on level {1}", Username, Level.LevelId); SendSetTime(); ThreadPool.QueueUserWorkItem(delegate(object state) { ForcedSendChunks(); }); //SendPlayerStatus(3); //McpeRespawn mcpeRespawn = McpeRespawn.CreateObject(); //mcpeRespawn.x = SpawnPosition.X; //mcpeRespawn.y = SpawnPosition.Y; //mcpeRespawn.z = SpawnPosition.Z; //SendPackage(mcpeRespawn); ////send time again //SendSetTime(); //IsSpawned = true; //LastUpdatedTime = DateTime.UtcNow; //_haveJoined = true; }
public Package RespawnHandler(McpeRespawn packet, Player player) { SendNameTag(player); player.RemoveAllEffects(); player.SetEffect(new Speed {Level = 1, Duration = Effect.MaxDuration}); // 10s in ticks //player.SetEffect(new Slowness { Level = 20, Duration = 20 * 10 }); //player.SetEffect(new Haste { Level = 20, Duration = 20 * 10 }); //player.SetEffect(new MiningFatigue { Level = 20, Duration = 20 * 10 }); //player.SetEffect(new Strength { Level = 20, Duration = 20 * 10 }); player.SetEffect(new JumpBoost {Level = 1, Duration = Effect.MaxDuration}); //player.SetEffect(new Blindness { Level = 20, Duration = 20 * 10 }); //player.SetAutoJump(true); if (player.Level.LevelId.Equals("Default")) { player.Level.CurrentWorldTime = 6000; player.Level.IsWorldTimeStarted = false; } player.SendSetTime(); return packet; }
public override void HandleMcpeRespawn(McpeRespawn message) { }
public Package RespawnHandler(McpeRespawn packet, Player player) { McpeMobEffect speedEffect = McpeMobEffect.CreateObject(); speedEffect.entityId = 0; speedEffect.eventId = 1; speedEffect.effectId = 1; speedEffect.duration = 0x7fffffff; speedEffect.amplifier = 2; speedEffect.particles = 1; player.SendPackage(speedEffect); McpeMobEffect jumpEffect = McpeMobEffect.CreateObject(); jumpEffect.entityId = 0; jumpEffect.eventId = 1; jumpEffect.effectId = 8; jumpEffect.duration = 0x7fffffff; jumpEffect.amplifier = 2; jumpEffect.particles = 1; player.SendPackage(jumpEffect); if (player.Level.LevelId.Equals("Default")) { player.Level.CurrentWorldTime = 10000; player.Level.IsWorldTimeStarted = false; } player.SendSetTime(); return packet; }
private void OnMcpeRespawn(McpeRespawn package) { _nodeClient.SpawnX = package.x; _nodeClient.SpawnY = package.y; _nodeClient.SpawnZ = package.z; }
/// <summary> /// Handles the respawn. /// </summary> /// <param name="msg">The MSG.</param> private void HandleRespawn(McpeRespawn msg) { // reset all health states HealthManager.ResetHealth(); // send teleport to spawn KnownPosition = new PlayerLocation { X = Level.SpawnPoint.X, Y = Level.SpawnPoint.Y, Z = Level.SpawnPoint.Z, Yaw = 91, Pitch = 28, HeadYaw = 91 }; SendSetHealth(); SendPackage(new McpeAdventureSettings {flags = Level.IsSurvival ? 0x20 : 0x80}); //SendPackage(new McpeAdventureSettings { flags = Level.IsSurvival ? 0x80 : 0x80 }); SendPackage(new McpeContainerSetContent { windowId = 0, slotData = Inventory.Slots, hotbarData = Inventory.ItemHotbar }); SendPackage(new McpeContainerSetContent { windowId = 0x78, // Armor windows ID slotData = Inventory.Armor, hotbarData = null }); BroadcastSetEntityData(); // Broadcast spawn to all Level.AddPlayer(this); SendMovePlayer(); }
public void HandleMcpeRespawn(McpeRespawn message) { WritePackage(message); }
public void HandleMcpeRespawn(McpeRespawn message) { }