internal override void Execute() { var cmdlet = (SendTmxDetailedStatusCommand)Cmdlet; var statusSender = new StatusSender(new RestRequestCreator()); try { statusSender.Send(cmdlet.Status); cmdlet.WriteObject(cmdlet, true); } catch (SendingDetailedStatusException e) { // throw new SendingDetailedStatusException("Failed to send detailed status"); // throw; // cmdlet.WriteError(cmdlet, e.Message, "FailedToSendDetailedStatus", errorc // throw; // TODO: log only! } }
public static void GetData(GetDataEventArgs args) { var plr = Main.player[args.Msg.whoAmI]; var tsp = plr.TSPlayer(); using (MemoryStream reader = new MemoryStream(args.Msg.readBuffer, args.Index, args.Length - 1)) { switch (args.MsgID) { case PacketTypes.ItemOwner: int item = reader.ReadInt16(); int ID = (int)reader.ReadByte(); if (item == 0) { StatusSender.GetPingPakcet(args.Msg.whoAmI); } break; case PacketTypes.PlayerHp: reader.ReadByte(); int life = reader.ReadInt16(); args.Handled = PlayerHeal(plr, life); break; case PacketTypes.PlayerHurtV2: reader.ReadByte(); PlayerDeathReason playerDeathReason = new PlayerDeathReason(); BitsByte bitsByte = (BitsByte)reader.ReadByte(); if (bitsByte[0]) { playerDeathReason._sourcePlayerIndex = (int)reader.ReadInt16(); } if (bitsByte[1]) { playerDeathReason._sourceNPCIndex = (int)reader.ReadInt16(); } if (bitsByte[2]) { playerDeathReason._sourceProjectileIndex = (int)reader.ReadInt16(); } if (bitsByte[3]) { playerDeathReason._sourceOtherIndex = (int)reader.ReadByte(); } if (bitsByte[4]) { playerDeathReason._sourceProjectileType = (int)reader.ReadInt16(); } if (bitsByte[5]) { playerDeathReason._sourceItemType = (int)reader.ReadInt16(); } if (bitsByte[6]) { playerDeathReason._sourceItemPrefix = (int)reader.ReadByte(); } if (bitsByte[7]) { playerDeathReason._sourceCustomReason = reader.ReadString(); } int damage = reader.ReadInt16(); args.Handled = PlayerDamage(plr, damage); break; } } if (args.MsgID == PacketTypes.PlayerUpdate) { if (plr.controlUseItem && (plr.HeldItem.useStyle == 2 || plr.HeldItem.useStyle == 9 || plr.HeldItem.netID == 5) && UserManager.TryGetEPlayeFromName(plr.name, out Account.EPlayer eplr) && eplr.HungrValue < 34200 && eplr.CanEat) { HungrSystem.OnEat(eplr, plr.HeldItem.buffTime); } } }