public AbstractGameActionFightTargetedAbilityMessage(short actionId, double sourceId, bool silentCast, bool verboseCast, double targetId, short destinationCellId, sbyte critical) : base(actionId, sourceId) { this.silentCast = silentCast; this.verboseCast = verboseCast; this.targetId = targetId; this.destinationCellId = destinationCellId; this.critical = critical; }
public static bool TryFormat(sbyte value, Span <byte> destination, out int bytesWritten, StandardFormat format = default) => TryFormatInt64(value, 0xff, destination, out bytesWritten, format);
public void Write(sbyte value) { buffer[0] = (byte)value; WriteInternal(buffer, 1); }
public static Stats New(ushort level, sbyte breedId) { BreedRecord breed = BreedRecord.GetBreed(breedId); var stats = new Stats() { ActionPoints = ApCharacteristic.New(StartActionPoints), MovementPoints = MpCharacteristic.New((short)StartMovementPoints), Agility = Characteristic.Zero(), AirDamageBonus = Characteristic.Zero(), AirReduction = Characteristic.Zero(), AirResistPercent = ResistanceCharacteristic.Zero(), AllDamagesBonus = Characteristic.Zero(), DamagesBonusPercent = Characteristic.Zero(), Chance = Characteristic.Zero(), CriticalDamageBonus = Characteristic.Zero(), CriticalDamageReduction = Characteristic.Zero(), CriticalHit = Characteristic.Zero(), Initiative = Characteristic.Zero(), CriticalHitWeapon = 0, DodgePAProbability = Characteristic.Zero(), DodgePMProbability = Characteristic.Zero(), EarthDamageBonus = Characteristic.Zero(), EarthReduction = Characteristic.Zero(), EarthResistPercent = ResistanceCharacteristic.Zero(), FireDamageBonus = Characteristic.Zero(), FireReduction = Characteristic.Zero(), FireResistPercent = ResistanceCharacteristic.Zero(), GlobalDamageReduction = 0, GlyphBonusPercent = Characteristic.Zero(), RuneBonusPercent = Characteristic.Zero(), PermanentDamagePercent = Characteristic.Zero(), HealBonus = Characteristic.Zero(), Intelligence = Characteristic.Zero(), LifePoints = breed.StartLifePoints, MaxEnergyPoints = (ushort)(level * 100), NeutralDamageBonus = Characteristic.Zero(), NeutralReduction = Characteristic.Zero(), NeutralResistPercent = ResistanceCharacteristic.Zero(), Prospecting = Characteristic.New(breed.StartProspecting), PushDamageBonus = Characteristic.Zero(), PushDamageReduction = Characteristic.Zero(), PvPAirReduction = Characteristic.Zero(), PvPAirResistPercent = ResistanceCharacteristic.Zero(), PvPEarthReduction = Characteristic.Zero(), PvPEarthResistPercent = ResistanceCharacteristic.Zero(), PvPFireReduction = Characteristic.Zero(), PvPFireResistPercent = ResistanceCharacteristic.Zero(), PvPNeutralReduction = Characteristic.Zero(), PvPNeutralResistPercent = ResistanceCharacteristic.Zero(), PvPWaterReduction = Characteristic.Zero(), PvPWaterResistPercent = ResistanceCharacteristic.Zero(), Range = RangeCharacteristic.Zero(), Reflect = Characteristic.Zero(), Strength = Characteristic.Zero(), SummonableCreaturesBoost = Characteristic.New(1), TrapBonus = Characteristic.Zero(), TrapBonusPercent = Characteristic.Zero(), Vitality = Characteristic.Zero(), WaterDamageBonus = Characteristic.Zero(), WaterReduction = Characteristic.Zero(), WaterResistPercent = ResistanceCharacteristic.Zero(), WeaponDamagesBonusPercent = Characteristic.Zero(), Wisdom = Characteristic.Zero(), TackleBlock = Characteristic.Zero(), TackleEvade = Characteristic.Zero(), PAAttack = Characteristic.Zero(), PMAttack = Characteristic.Zero(), Energy = (ushort)(level * 100), MaxLifePoints = breed.StartLifePoints, WeightBonus = 0, }; return(stats); }
public async Task PushAsync(string baseUrl, string accessToken, string subject, string body, sbyte priority) { var request = new Request("/message", baseUrl, HttpMethod.Post); request.AddQueryString("token", accessToken); request.AddHeader("Access-Token", accessToken); request.ApplicationJsonContentType(); var jsonBody = new { message = body, title = subject, priority = priority }; request.AddJsonBody(jsonBody); await _api.Request(request); }
public static byte[] GetBytes(sbyte value) { return(BitConverter.GetBytes(value)); }
public virtual sbyte Next(sbyte min, sbyte max) { return((sbyte)Next((int)min, (int)max)); }
/// <summary> /// First call in the update loop /// Used to update the firing state of this weapon /// </summary> public virtual void Update() { // stop looping if not shooting if (!IsShooting) { //if (!IsAnimated) //{ // ControlLayer.NeedsUpdate = VRage.ModAPI.MyEntityUpdateEnum.NONE; //} return; } byte notify = 0x0; DateTime currentTime = DateTime.UtcNow; double timeSinceLastShot = (currentTime - LastShootTime).TotalMilliseconds; double timeSinceLastAmmoFeed = (currentTime - LastAmmoFeed).TotalMilliseconds; if (timeSinceLastAmmoFeed > AmmoFeedInterval) { if ((Inventory.CurrentVolume.RawValue / Inventory.MaxVolume.RawValue) < InventoryFillFactorMin) { InventoryComponent.Fill(CubeBlock, gun.GunBase.CurrentAmmoMagazineId); } } //if (!MyAPIGateway.Utilities.IsDedicated && MyAPIGateway.Session != null) //{ // MyAPIGateway.Utilities.ShowNotification($"ShootTime: {timeSinceLastShot.ToString("n0")}ms - {State.Value} - {IsShooting} - {IsReloading} - {(timeSinceLastShot * (AmmoData.RateOfFire * Tools.MinutesToMilliseconds)).ToString("n2")} {CurrentShotInBurst}/{AmmoData.ShotsInBurst}", 1); //} // Stops if weapons are reloading if (IsReloading) { if (timeSinceLastShot < ReloadTime) { return; } Reloading.Value = false; //State.Value &= ~WeaponState.Reloading; } // Stops if weapons are not ready to fire this frame if (timeSinceLastShot * (AmmoData.RateOfFire * Tools.MinutesToMilliseconds) < 1f) { return; } // Stops if weapons are not working/functional if (!Block.IsWorking) { if (!Block.IsFunctional) { notify |= 0x1; } else { notify |= 0x2; } } else { bool enoughAmmo = gun.GunBase.HasEnoughAmmunition(); if (!enoughAmmo) { StartNoAmmoSound(); notify |= 0x4; } else if (MySessionComponentSafeZones.IsActionAllowed(Block.GetPosition(), Tools.CastProhibit(MySessionComponentSafeZones.AllowedActions, 2))) { // Fixed guns do not update unless the mouse is pressed. // This updates the position when terminal fire is active. if (IsFixedGun) { MyEntitySubpart subpart; if (CubeBlock.Subparts.TryGetValue("Barrel", out subpart)) { gun.GunBase.WorldMatrix = subpart.PositionComp.WorldMatrixRef; } } // NOTE: RateOfFire is limited to 3600 rounds per seconds using this method MatrixD muzzleMatrix = gun.GunBase.GetMuzzleWorldMatrix(); Vector3 direction = muzzleMatrix.Forward; Vector3D origin = muzzleMatrix.Translation; string ammoId = gun.GunBase.CurrentAmmoDefinition.Id.SubtypeId.String; AmmoDefinition ammo = Settings.AmmoDefinitionLookup[ammoId]; // calculate deviation sbyte index = DeviationIndex.Value; MatrixD positionMatrix = Matrix.CreateWorld(origin, Tools.ApplyDeviation(direction, DeviateShotAngle, ref index), muzzleMatrix.Up); DeviationIndex.SetValue(index, SyncType.None); // spawn projectile Core.Static.Spawn(positionMatrix.Translation, positionMatrix.Forward, Block.CubeGrid.Physics.LinearVelocity, Block.EntityId, ammo); //Projectile bullet = new Projectile(CubeBlock.EntityId, positionMatrix.Translation, positionMatrix.Forward, Block.CubeGrid.Physics.LinearVelocity, ammoId); //Core.SpawnProjectile(bullet); gun.GunBase.ConsumeAmmo(); //apply recoil if (ammo.BackkickForce > 0) { //CubeBlock.Physics.AddForce(MyPhysicsForceType.APPLY_WORLD_IMPULSE_AND_WORLD_ANGULAR_IMPULSE, -direction * ammo.BackkickForce, CubeBlock.WorldMatrix.Translation, Vector3.Zero); //Core.PhysicsRequests.Enqueue(new PhysicsDefinition { // Target = CubeBlock, // Force = -direction * ammo.BackkickForce, // Position = CubeBlock.WorldMatrix.Translation //}); } // create sound StartShootSound(); //MakeSecondaryShotSound(); // create muzzle flash if (!MyAPIGateway.Utilities.IsDedicated && Settings.Static.DrawMuzzleFlash) { MatrixD matrix = MatrixD.CreateFromDir(direction); matrix.Translation = origin; bool foundParticle = MyParticlesManager.TryCreateParticleEffect(MuzzleFlashSpriteName, ref matrix, ref origin, uint.MaxValue, out muzzleFlash); if (foundParticle) { MuzzleFlashActive = true; MuzzleFlashCurrentTime = 0; muzzleFlash.Play(); } } CurrentShotInBurst++; if (AmmoData.ShotsInBurst == 0) { CurrentShotInBurst = 0; } else if (CurrentShotInBurst == AmmoData.ShotsInBurst) { notify |= 0x8; CurrentShotInBurst = 0; Reloading.Value = true; //State.Value |= WeaponState.Reloading; DeviationIndex.Push(); } if (IsTerminalShootOnce) { State.SetValue(State.Value & ~WeaponState.TerminalShootOnce); } LastShootTime = currentTime; } } if (Notify != notify) { Core.NotifyNextFrame(Block.CubeGrid.EntityId); Notify = notify; } }
public static extern sbyte SByte(sbyte num);
public override void Deserialize(IReader reader) { teleporterType = reader.ReadSByte(); mapId = reader.ReadInt(); }
public static bool GreaterThanOrEqualTo(this sbyte @this, sbyte number) => @this >= number;
public TeleportRequestMessage(sbyte teleporterType, int mapId) { this.teleporterType = teleporterType; this.mapId = mapId; }
public void Write(sbyte value) => debugger.Dispatcher.UI(() => this.CorValue.WriteGenericValue(new byte[] { (byte)value }));
static void Main() { string value = Console.ReadLine(); try { long number = long.Parse(value); Console.WriteLine("{0} can fit in:", number); } catch (Exception) { Console.WriteLine("{0} can't fit in any type", value); } try { sbyte number = sbyte.Parse(value); Console.WriteLine("* sbyte"); } catch (OverflowException) { } try { byte number = byte.Parse(value); Console.WriteLine("* byte"); } catch (OverflowException) { } try { short number = short.Parse(value); Console.WriteLine("* short"); } catch (OverflowException) { } try { ushort number = ushort.Parse(value); Console.WriteLine("* ushort"); } catch (OverflowException) { } try { int number = int.Parse(value); Console.WriteLine("* int"); } catch (OverflowException) { } try { uint number = uint.Parse(value); Console.WriteLine("* uint"); } catch (OverflowException) { } try { long number = long.Parse(value); Console.WriteLine("* long"); } catch (OverflowException) { } }
public static unsafe Vector64 <sbyte> Create(sbyte e0, sbyte e1, sbyte e2, sbyte e3, sbyte e4, sbyte e5, sbyte e6, sbyte e7) { sbyte *pResult = stackalloc sbyte[8] { e0, e1, e2, e3, e4, e5, e6, e7, }; return(Unsafe.AsRef <Vector64 <sbyte> >(pResult)); }
public SingleUnit(Prefix prefix, string symbol, sbyte power) { this.Prefix = prefix; this.Symbol = symbol; this.Power = power; }
/// <summary> /// Creates <see cref="sbyte"/> data /// </summary> /// <param name="value">Value</param> /// <returns></returns> public BuiltInResourceData Create(sbyte value) { return(new BuiltInResourceData(ResourceTypeCode.SByte, value)); }
public nsISupports Connect(string address, WPSMethod wpsMethod, sbyte goIntent) { return this.CallMethod<nsISupports>("connect", address, wpsMethod, goIntent); }
static void Main(string[] args) { //---- Локальная функция ---------- (int max, int min, int sym, char Al) Func(int[] mss, string StRR) { var tuplee = (max : mss[0], min : mss[0], sym : 0, Al : ' '); for (int l = 0; l < mss.Length; l++) { if (mss[l] > tuplee.max) { tuplee.max = mss[l]; } if (mss[l] < tuplee.min) { tuplee.min = mss[l]; } tuplee.sym += mss[l]; } for (int h = 0; h < StRR.Length; h++) { if (StRR[h] != ' ') { tuplee.Al = StRR[h]; break; } } return(tuplee); } //------------------------ sbyte sbyteA = -1; short shortA = -2; int intA = -3; long longA = -4; byte byteA = 1; ushort ushortA = 2; uint uintA = 3; ulong ulongA = 4; char с = 'А'; float f = 6.5f; double d = 3.5; decimal D = 9.1M; bool b = true; //------------------------ int B = 200; // Явное преобразование double BBB = B; // int в double double AAA = f; // float в double float CCC = B; // int в float long DDD = B; // int в long int FFF = shortA; // short в int // Неявное преобразование int AA = (int)d; // double в int byte BB = (byte)B; // int в byte double CC = (double)B; // int в double decimal DD = (decimal)d; // double в decimal decimal FF = (decimal)B; // int в decimal //------------------------- int x1 = 5; Object o = x1; // boxing int x2 = (int)o; // unboxing //------------------------- var R1 = 5; Console.WriteLine(R1.GetType()); var R2 = 10.567; Console.WriteLine(R2.GetType()); //------------------------- int?N1 = null; int?N2 = null; Console.WriteLine(N1 == N2); //------------------------- string s1 = "Auf"; string s2 = "auf"; string s3 = "Auf"; Console.WriteLine(s1 == s2); //------------------------- string S = "Если"; string SS = " бы"; string SSS = " я"; string S_S = S + SS + SSS; // Сцепление (конкатенация) Console.WriteLine("\nСцепление строк: " + S_S); string copy = string.Copy(S_S); // Копирование Console.WriteLine("Копирование строки: " + copy); Console.WriteLine("Выделение подстроки: " + S_S.Substring(5, 2)); // Выделение подстроки string[] words = S_S.Split(' '); //Разделение строки на слова Console.Write("Разделения строки на слова:\n"); for (int j = 0; j < words.Length; j++) { Console.WriteLine(words[j]); } Console.WriteLine("Вставка подстроки: " + S_S.Insert(9, " был тобой")); //вставка подстроки в заданную позицию Console.WriteLine("Удаление подстроки: " + S_S.Remove(5, 3)); //Удаление подстроки //-------------------------- string Str0 = ""; string StrNull = null; Console.WriteLine(Str0.Length); Console.WriteLine(Str0 == StrNull); //-------------------------- StringBuilder st = new StringBuilder("Кто если не я", 50); Console.WriteLine("\n" + st); Console.WriteLine(st.Remove(8, 5)); Console.WriteLine(st.Append(" не он")); Console.WriteLine(st.Insert(0, "Текст: ")); //-------------------------- int[,] matrix = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } }; Console.WriteLine("\nДвумерный массив:\n"); foreach (var x in matrix) { if (x % 3 == 0) { Console.Write("\t" + x + "\n"); } else { Console.Write("\t" + x); } } //------------------------- string[] mas = { "Как много в мире девушек красивых,", "Искренних, верных, да, и простых -", "Такая вот терапия...", "Такая вот взрослая жизнь..." }; Console.WriteLine("\nОдномерный массив:\n"); foreach (var g in mas) { Console.Write("\t" + g + "\n"); } Console.WriteLine("\nРазмер массива: " + mas.Length); mas[2] = "..."; Console.WriteLine("\nИзмененный массив:\n"); foreach (var g in mas) { Console.Write("\t" + g + "\n"); } //------------------------- double[][] JaggedMas = { new double[2], new double[3], new double[4] }; Console.WriteLine(); for (int k = 0; k < JaggedMas.Length; k++) { for (int m = 0; m < JaggedMas[k].Length; m++) { Console.Write("Введите " + (m + 1) + "-e число " + (k + 1) + "-й строки: "); JaggedMas[k][m] = Convert.ToDouble(Console.ReadLine()); } } Console.WriteLine("\nCтупенчатый массив:\n"); foreach (double[] x in JaggedMas) { foreach (double h in x) { Console.Write("\t" + h); } Console.WriteLine(); } //------------------------- var tMas = new object[0]; var tStr = ""; //------------------------- (int, string, char, string, ulong)tuple1 = (5, "dddd", '!', "hhhhh", 111111); (int, string, char, string, ulong)tuple2 = (5, "dddd", '!', "hhhhh", 111111); Console.WriteLine(tuple1); Console.WriteLine(tuple1.Item3); Console.WriteLine(tuple1.Item5); var(t1, t2, t3, t4, t5) = tuple1; //--------------------------------------- int[] ms = { 1, -2, 3, -4, 5, -6, 7 }; string StR = " Ceeeeeeeeb!"; var tuple = Func(ms, StR); Console.WriteLine(tuple); Console.Read(); }
public S0(sbyte p0) : this() { F0 = p0; }
public void SetRoundResult(sbyte endCode4Red, sbyte endCode4Blue, sbyte roundCode) { if (endCode4Red > 0 && endCode4Blue < 0) { endCode = 0; } else if (endCode4Red < 0 && endCode4Blue > 0) { endCode = 1; } else { endCode = -1; } showRoundMessage = true; endCodeDelta = 0f; if (roundCode == 0) { if (bRedTeam) { PlaySoundDelay("allyannihilation_4", 4f); } else { PlaySoundDelay("enemyannihilation_4", 4f); } PlaySoundDelay("BlueWin_2", 3.5f); changedRoundTime = 12.5f; } else if (roundCode == 1) { step = STEP.NOTHING; if (bRedTeam) { PlaySoundDelay("enemyannihilation_4", 4f); } else { PlaySoundDelay("allyannihilation_4", 4f); } PlaySoundDelay("RedWin_4", 3.5f); changedRoundTime = 12.5f; } else if (roundCode == 2) { PlaySoundDelay("BlueWin_2", 3.5f); changedRoundTime = 8.5f; } else if (roundCode == 3) { PlaySoundDelay("RedWin_4", 3.5f); changedRoundTime = 8.5f; } else if (roundCode == 4) { PlaySoundDelay("BlueWin_2", 4.5f); changedRoundTime = 8.5f; } if (MyInfoManager.Instance.Seq == RoomManager.Instance.Master) { OnRoundEnd(MyInfoManager.Instance.Seq); } }
public CityInfo(int index, string city, string building, string description, ushort x, ushort y, sbyte z, uint map, bool isNew) { Index = index; City = city; Building = building; Description = description; X = x; Y = y; Z = z; Map = map; IsNewCity = isNew; }
public void WriteSByte(sbyte @byte) { m_writer.Write(@byte); }
public static void writeByte(MemoryStream data, sbyte tmpvalue) { byte[] tmp = new byte[1]; tmp[0] = (byte)tmpvalue; data.Write(tmp, 0, 1); }
public override void WriteValue(sbyte value) { InternalWriteValue(JsonToken.Integer); WriteIntegerValue(value); }
public IdolsPresetDeleteMessage(sbyte presetId) { this.presetId = presetId; }
public static sbyte parse(string src, out sbyte dst) => dst = sbyte.Parse(src);
public override void Deserialize(IReader reader) { presetId = reader.ReadSByte(); }
public static int test_0_conv_i() { double a = 2.0; int i = (int)a; if (i != 2) { return(1); } uint ui = (uint)a; if (ui != 2) { return(2); } short s = (short)a; if (s != 2) { return(3); } ushort us = (ushort)a; if (us != 2) { return(4); } byte b = (byte)a; if (b != 2) { return(5); } sbyte sb = (sbyte)a; if (sb != 2) { return(6); } /* MS.NET special cases these */ double d = Double.NaN; ui = (uint)d; if (ui != 0) { return(7); } d = Double.PositiveInfinity; ui = (uint)d; if (ui != 0) { return(8); } d = Double.NegativeInfinity; ui = (uint)d; if (ui != 0) { return(9); } /* FIXME: This fails with llvm and with gcc -O2 on osx/linux */ /* * d = Double.MaxValue; * i = (int)d; * if (i != -2147483648) * return 10; */ return(0); }
public static int TestReadSByte(ref sbyte data) { return(Volatile.Read(ref data) + Volatile.Read(ref data)); }