public List<History> GetHistories(Roll roll) { string sql = HistorySql(roll); var reader = Data_Context.RunSelectSQLQuery(sql, 30); var histories = new List<History>(); if (reader.HasRows) { var sReader = new SpecialistsReader(); while (reader.Read()) { string uName = reader["UserName"] as string; var spec = sReader.GetSpecialist(uName); string m = reader["Message"] as string; DateTime date = reader.GetDateTime(3); string step = reader["CurrentQueue"] as string; var note = new History(spec, m, date, step); histories.Add(note); } Data_Context.CloseConnection(); return histories; } else return null; }
public List<Note> GetNotes(Roll roll) { string sql = NotesSql(roll); var reader = Data_Context.RunSelectSQLQuery(sql, 30); var notes = new List<Note>(); if (reader.HasRows) { var sReader = new SpecialistsReader(); while (reader.Read()) { string uName = reader["Author"] as string; var spec = sReader.GetSpecialist(uName); string n = reader["Note"] as string; DateTime date = reader.GetDateTime(4); string step = reader["StepTypeID"] as string; var note = new Note(spec, n, date, step); notes.Add(note); } return notes; } else return null; }
public DetailsContainerControl(Roll roll) { InitializeComponent(); JobSpecControls = new List<JobSpecControl>(); JobSpecControls.Add(NewJobSpecControl(roll)); //rollTabCtrlCC.Content = new JobSpecControl(roll); VisibilityChanged(true); }
public void When_rolling_a_strike_to_start_the_game() { Roll strike = new Roll(10); game = new Game(); game.AddRoll(strike); }
public void TestRollCreation(char rollVal, bool isSpare, bool isStrike, int value) { Roll roll = new Roll(rollVal); Assert.AreEqual(value, roll.Score); Assert.True(roll.IsSpare == isSpare); Assert.True(roll.IsStrike == isStrike); }
public void When_rolling_to_start_the_game() { var roll = new Roll(5); game = new Game(); game.AddRoll(roll); }
public void When_rolling_to_start_the_game() { var miss = new Roll(3); var spare = new Roll(7); game = new Game(); game.AddRoll(miss); game.AddRoll(spare); }
public Roll Create (DateTime time_in_utc) { long unix_time = DbUtils.UnixTimeFromDateTime (time_in_utc); uint id = (uint) Database.Execute (new DbCommand ("INSERT INTO rolls (time) VALUES (:time)", "time", unix_time)); Roll roll = new Roll (id, unix_time); AddToCache (roll); return roll; }
public uint PhotosInRoll (Roll roll) { uint number_of_photos = 0; using (SqliteDataReader reader = Database.Query (new DbCommand ("SELECT count(*) FROM photos WHERE roll_id = :id", "id", roll.Id))) { if (reader.Read ()) number_of_photos = Convert.ToUInt32 (reader [0]); reader.Close (); } return number_of_photos; }
public void ThrowDice(Roll roll, bool bLookAt=true) { //TODO: Many a magic number in this function if(true == bLookAt || null == dice) ClearDice(); for(int d=0; d < roll.count; d++) { GameObject die = CreateDie(roll.dieName); die.transform.parent = diceParent.transform; Vector3 direction = Vector3.one; Vector3 sideways = Vector3.one; Transform sideFromWhichToThrow = Utilities().getDiceBoxSides()[Random.Range(0,Utilities().getDiceBoxSides().Count)]; // Position die.transform.position = new Vector3(sideFromWhichToThrow.position.x, sideFromWhichToThrow.position.y + 50, sideFromWhichToThrow.position.z); if(sideFromWhichToThrow.name.Contains("x_a")) { direction = sideFromWhichToThrow.right; sideways = sideFromWhichToThrow.forward; } else if(sideFromWhichToThrow.name.Contains("x_b")) { direction = sideFromWhichToThrow.right * -1; sideways = sideFromWhichToThrow.forward * -1; } else if(sideFromWhichToThrow.name.Contains("z_a")) { direction = sideFromWhichToThrow.forward; sideways = sideFromWhichToThrow.right * -1; } else if(sideFromWhichToThrow.name.Contains("z_b")) { direction = sideFromWhichToThrow.forward * -1; sideways = sideFromWhichToThrow.right; } die.rigidbody.velocity = sideways * 30 + direction * 60; // Orientation die.transform.rotation = Quaternion.LookRotation(Random.onUnitSphere); die.rigidbody.angularVelocity = Vector3.right * -15; dice.Add(die); } if(true == bLookAt) Utilities().LookAtDice(dice); }
public JobSpecControl NewJobSpecControl(Roll roll) { var tab = new TabItem(); var control = new JobSpecControl(roll); tab.Content = control; tab.Header = roll.RollName; DetailsTabControl.Items.Add(tab); VisibilityChanged(true); DetailsTabControl.SelectedIndex = DetailsTabControl.Items.Count -1; return control; }
public DummyEntities() { choirAID = Guid.NewGuid(); choirBID = Guid.NewGuid(); studentA = new Student() { FirstName = "StudentA", Id = Guid.NewGuid(), ChoirId = choirAID }; studentB = new Student() { FirstName = "StudentB", Id = Guid.NewGuid() }; choirA = new Choir() { Id = choirAID, Name = "ChoirA", Students = (from s in Students where s.ChoirId == choirAID select s).ToList() }; choirB = new Choir() { Id = choirBID, Name = "ChoirB", Students = (from s in Students where s.ChoirId == choirBID select s).ToList() }; studentA.Choir = choirA; rollA = new Roll() { Id = Guid.NewGuid() }; rollB = new Roll() { Id = Guid.NewGuid(), ChoirId = choirA.Id }; }
private string HistorySql(Roll roll) { string sql = @"SELECT WIH.CurrentQueue ,WIH.UserName ,WIH.Message ,WIH.MessageDate FROM WorkItemHistory WIH (NOLOCK) WHERE WIH.WorkItemID = " + roll.Id; sql += @" ORDER BY MessageDate DESC"; return sql; }
public JobSpecUpdates(Roll myRoll, RollPaths myRollPaths) { MyRoll = myRoll; MyRollPaths = myRollPaths; JobSpecDataReturn = MyRollPaths.GetJobSpec(); if (File.Exists(JobSpecDataReturn + @"\" + MyRoll.ProjectId + @"\" + MyRoll.RollName + ".xml")) JobSpecPath = JobSpecDataReturn + @"\" + MyRoll.ProjectId + @"\" + MyRoll.RollName + ".xml"; else if (File.Exists(JobSpecDataReturn + @"\" + MyRoll.RollName.Substring(0, 5) + @"\" + MyRoll.RollName + ".xml")) JobSpecPath = JobSpecDataReturn + @"\" + MyRoll.RollName.Substring(0, 5) + @"\" + MyRoll.RollName + ".xml"; RefreshRootElement(); if (RootElement != null) { if (RootElement.Descendants("Roll") .Where(roll => roll.Elements("ImageProcessing").Any()).Any()) { if (RootElement.Element("Roll").Descendants("ImageProcessing") .Where(roll => roll.Elements("ProcessSequence").Any()).Any()) { if (RootElement.Element("Roll").Element("ImageProcessing").Descendants("ProcessSequence") .Where(roll => roll.Elements("AutoCrop").Any()).Any()) { AutoCropElement = RootElement.Element("Roll").Element("ImageProcessing").Element("ProcessSequence").Element("AutoCrop"); AutoCropExists = true; } else AutoCropExists = false; DeskewElement = RootElement.Element("Roll").Element("ImageProcessing").Element("ProcessSequence").Element("Deskew"); } } if (AutoCropElement != null) { if (AutoCropElement.Attribute("xDirection").Value == "true" && AutoCropElement.Attribute("yDirection").Value == "true") AutoCrop = true; else AutoCrop = false; if (AutoCropElement.Attribute("AggressiveFactor").Value == "true") AggressiveFactor = true; else AggressiveFactor = false; CropPadding = Convert.ToInt32(AutoCropElement.Attribute("CropPadding").Value); } if (DeskewElement != null) DeskewMaxAngle = Convert.ToInt32(DeskewElement.Attribute("MaxAngle").Value); } }
private string NotesSql(Roll roll) { string sql = @"SELECT RN.RollName ,RN.StepTypeID ,RN.Author ,RN.Note ,RN.UpdateTime FROM RollNote RN (NOLOCK) WHERE RN.RollName = '" + roll.RollName + @"' AND RN.NOTE != '' ORDER BY RN.UpdateTime DESC"; return sql; }
private string ImageNotesSql(Roll roll) { string sql = @"SELECT DISTINCT IMN.ImageNumber ,IMN.Author ,IMN.Note ,IMN.UpdateTime FROM ImageNote IMN (NOLOCK) --LEFT JOIN epdb01.Dexter_DeeDee.dbo.Roll R (NOLOCK) ON IMN.RollID = R.RollID LEFT JOIN RollNote RN (NOLOCK) ON RN.RollNoteID = IMN.RollNoteID WHERE RN.RollName = '" + roll.RollName + @"' ORDER BY ImageNumber"; return sql; }
public override DbItem Get (uint id) { Roll roll = LookupInCache (id) as Roll; if (roll != null) return roll; SqliteDataReader reader = Database.Query(new DbCommand ("SELECT time FROM rolls WHERE id = :id", "id", id)); if (reader.Read ()) { roll = new Roll (id, Convert.ToUInt32 (reader [0])); AddToCache (roll); } return roll; }
public static SelectList GetRollidSelectList(IList<Roll> rollid, int selValue) { IList<Roll> listOfRollid = new List<Roll>(); var nullElem = new Roll(); nullElem.ID = 0; nullElem.Nimetus = "-"; listOfRollid.Add(nullElem); if (rollid != null && rollid.Count > 0) { foreach (Roll roll in rollid) { listOfRollid.Add(roll); } } return new SelectList(listOfRollid, "ID", "Nimetus", selValue); }
public RollPaths(Roll roll) { Data_Context = new DataContext("epdb01", "jwf_live"); MyRoll = roll; if (File.Exists(GetJobSpec() + @"\" + MyRoll.ProjectId + @"\" + MyRoll.RollName + ".xml")) { JobSpec = GetJobSpec() + @"\" + MyRoll.ProjectId + @"\" + MyRoll.RollName + ".xml"; RootElement = XElement.Load(JobSpec); } else if (File.Exists(GetJobSpec() + @"\" + MyRoll.RollName.Substring(0, 5) + @"\" + MyRoll.RollName + ".xml")) { JobSpec = GetJobSpec() + @"\" + MyRoll.RollName.Substring(0, 5) + @"\" + MyRoll.RollName + ".xml"; RootElement = XElement.Load(JobSpec); } }
public void Application(Perso perso) { List <EffetAppliquer> cumul = (from effetActif in perso.ListEffets where effetActif.IdEffet == Id select effetActif).ToList(); if (cumul.Count < CumulMax) { int valueResist = ChanceResist + perso.GetStat(StatResist); valueResist = Util.GetValeurOn100(valueResist); int result; Boolean resist; Roll.Jet100(valueResist, out result, out resist); if (!resist) { EffetAppliquer effetAppliquer = new EffetAppliquer(this); if (effetAppliquer.TourRestant > 0) { perso.ListEffets.Add(effetAppliquer); } } } }
public void TestRoll() { Roll roll = Roll.From("1d4"); Assert.AreEqual(1, roll.Count); Assert.AreEqual(0, roll.Offset); Assert.AreEqual(4, roll.Sides); Assert.AreEqual("", roll.Descriptor); roll = Roll.From("3d8+3(cold)"); Assert.AreEqual(3, roll.Count); Assert.AreEqual(3, roll.Offset); Assert.AreEqual(8, roll.Sides); Assert.AreEqual("(cold)", roll.Descriptor); roll = Roll.From("0.166667d6"); Assert.AreEqual(0.166667, roll.Count); Assert.AreEqual(0, roll.Offset); Assert.AreEqual(6, roll.Sides); Assert.AreEqual("", roll.Descriptor); }
static void Main(string[] args) { Roll newPlugin = new Roll(); newPlugin.OnInitialized(new StartupConfig(null, null, new StartupConfig.Metadata())); while (true) { var msg = Console.ReadLine(); CoolQRouteMessage cm = CoolQRouteMessage.Parse(new CoolQGroupMessageApi { GroupId = 123456788, UserId = 2241521134, Message = msg, }); Logger.Raw("回复:" + newPlugin.OnMessageReceived(new Daylily.CoolQ.CoolQScopeEventArgs { RouteMessage = cm }).RawMessage); } }
private void DeleteItemRoll(Item itemRoll) { if (itemRoll != null) { using (Roll roll = itemRoll.ItemRoll) { if (roll.Delete(SessionState.User.Id)) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "UpdatePage", "<script>UpdatePage(" + SessionState.CurrentItem.Id + ");</script>"); } else { lbError.CssClass = "hc_error"; lbError.Text = Roll.LastError; lbError.Visible = true; ShowTabs(); Page.DataBind(); } } } }
public static bool Modificar(Roll roles) { bool paso = false; Contexto contexto = new Contexto(); try { contexto.Entry(roles).State = Microsoft.EntityFrameworkCore.EntityState.Modified; paso = contexto.SaveChanges() > 0; } catch (Exception) { throw; } finally { contexto.Dispose(); } return(paso); }
public async Task RollDice(PlayerModel player, string request) { var regex = new System.Text.RegularExpressions.Regex(@"(?<diceCount>[0-9]+)d(?<diceValue>[0-9]+)(?<diceMod>([\+\-][0-9]+))?"); var match = regex.Match(request); var number = int.Parse(match.Groups["diceCount"].Value); var sides = int.Parse(match.Groups["diceValue"].Value); var mod = match.Groups["diceMod"].Success ? int.Parse(match.Groups["diceMod"].Value) : 0; var results = new List <int>(); for (int i = 0; i < number; i++) { results.Add(ThreadLocalRandom.Instance.Next(1, sides + 1)); } var roll = new Roll { Request = request, Result = results, Modifier = mod }; await Clients.All.SendAsync("DiceRolled", player, roll); }
void RemoveUnreferencedRolls() { HashSet <int> usedRollKeys = new HashSet <int>(); foreach (MasterImage masterImage in albumData.MasterImages.Values) { usedRollKeys.Add((int)masterImage.Roll); } foreach (int rollKey in albumData.Rolls.Keys.ToArray()) { if (!usedRollKeys.Contains(rollKey)) { Roll roll = albumData.Rolls[rollKey]; Console.WriteLine("Removing unreferenced event '" + roll.RollName + "'."); albumData.Rolls.Remove(rollKey); } } }
internal static Frame Create(string singleFrameToParse, Roll[] frameRolls, Roll nextRoll, Roll secondNextRollForStrike) { var frame = new Frame(frameRolls); if (Parser.IsSpare(singleFrameToParse)) { frame = new SpareFrame(nextRoll, frameRolls); } if (Parser.IsStrike(singleFrameToParse)) { frame = new StrikeFrame(nextRoll, secondNextRollForStrike, frameRolls); } return(frame); }
public Frame GetFrame(int numberOfRolls, Roll[] roll) { Roll rollOne = roll[numberOfRolls]; Frame f; if (rollOne.GetNumberOfKnockedPins() == 10) { f = new Frame(rollOne); return(f); } if (numberOfRolls + 1 >= roll.Length) { f = new Frame(rollOne, Roll.Zero()); return(f); } Roll rollTwo = roll[numberOfRolls + 1]; f = new Frame(rollOne, rollTwo); return(f); }
private static bool Insertar(Roll roles) { bool paso = false; Contexto contexto = new Contexto(); try { contexto.Roll.Add(roles); paso = contexto.SaveChanges() > 0; } catch (Exception) { throw; } finally { contexto.Dispose(); } return(paso); }
//Gets the current weather's effect override public String getWeatherEffect() { if (type == "Windy") { effect = "Disadvantage on ranged weapon attack rolls, and Perception checks to hear."; } else if (type == "Snowfall") { effect = "Disadvantage on Perception checks to see."; } else if (type == "Blizzard") { duration = Roll.d4(); effect = "Every hour not spent in warm shelter results in a DC 14 Con saving throw or gain 1 point of exhaustion."; } else { effect = "No negative effects."; } return(effect); }
void Update() { if (justAttacked) //if the player was just attacked by the enemy, start the counter { nextAttackCounter -= Time.deltaTime; } if (nextAttackCounter <= 0f) //if the counter ends, the enemy did not just attack and the counter is reset { justAttacked = false; nextAttackCounter = storeAttackCounter; } if (characterSelector.GetCharacterActive()) //checks if the character is active { charge = characterSelector.GetCharacterObject().GetComponentInChildren <Charge>(); //retrieved from the player's weapon roll = characterSelector.GetCharacterObject().GetComponentInChildren <Roll>(); chargeInvulnerable = charge.GetInvulnerable(); rollInvulnerable = roll.GetInvulnerable(); } }
public override void Write(BinaryWriter file) { flags = 0; if (X.val != 0 || Y.val != 0 || Z.val != 0) { flags |= 1; } if (Pitch.val != 0 || Yaw.val != 0 || Roll.val != 0) { flags |= 2; } if (Scale_x.val != 0 || Scale_y.val != 0 || Scale_z.val != 0) { flags |= 4; } file.Write(flags); if ((flags & 1) == 1) { X.Write(file); Y.Write(file); Z.Write(file); } if ((flags & 2) == 2) { Pitch.Write(file); Yaw.Write(file); Roll.Write(file); } if ((flags & 4) == 4) { Scale_x.Write(file); Scale_y.Write(file); Scale_z.Write(file); } }
private void DoMovePattern() { // FOLLOW PLAYER if (MovePattern == MovementPattern.FollowPlayer) { _moveWait = false; _animator.SetBool("MoveWait", false); if (_hopInAir) { return; } SetDestination(); SetDirection(); } // RANDOM LOCATION else if (MovePattern == MovementPattern.RandomLocation) { if (_moveWait) { return; } CheckArrived(); if (_destArrived | _dest == null | _direction == Vector2.zero) { SetDestination(); if (Roll.Chance(_chanceToMoveWait)) { StartCoroutine("MoveWait", Random.Range(0f, 2f)); } } SetDirection(); } }
public int Score(Roll roll) { var result = 0; result += ScoreSingle(1, roll, 100); result += ScoreSingle(5, roll, 50); result += ScoreMultiple(1, 3, roll, 1000); result += ScoreMultiple(2, 3, roll, 200); result += ScoreMultiple(3, 3, roll, 300); result += ScoreMultiple(4, 3, roll, 400); result += ScoreMultiple(5, 3, roll, 500); result += ScoreMultiple(6, 3, roll, 600); return(result); }
public void SelectEfficient_DiceRolls1_ReturnsMin() { // ARRANGE const int diceEdges = 3; const int diceCount = 1; const int expectedRoll = 1 * diceCount; // потому что один бросок кости. Минимальное значение броска - 1. var roll = new Roll(diceEdges, diceCount); var diceMock = new Mock <IDice>(); diceMock.Setup(x => x.Roll(It.IsAny <int>())).Returns(1); var dice = diceMock.Object; var service = new TacticalActUsageRandomSource(dice); // ACT var factRoll = service.RollEfficient(roll); // ASSERT factRoll.Should().Be(expectedRoll); }
public EffetAppliquer(Effet effet) { IdEffet = effet.Id; ListEffetBonus = effet.ListEffetBonus; Penetration = effet.Penetration; MinHit = effet.MinHit; MaxHit = effet.MaxHit; StatReduc = effet.StatReduc; CoefStatReduc = effet.CoefStatReduc; ValeurBase = effet.ValeurBase; StatAffecter = effet.StatAffecter; Drain = effet.Drain; TailleDee = effet.TailleDee; NbDee = effet.NbDee; TourRestant = Roll.minmax(effet.DureMin, effet.DureMax); Boolean isEffetBonus; int result; Roll.Jet100(effet.ChanceEffetBonus, out result, out isEffetBonus); EffetBonus = isEffetBonus; }
public SmartSpells(Context context) : base(context) { stone = context.Combo.Stone; smash = context.Combo.Smash; roll = context.Combo.Roll; grip = context.Combo.Grip; stoneName = StoneExtensions.StoneName; var smartSpellsMenu = rootMenu.CreateMenu("Smart spells") .SetTooltip("Auto place stone when it is necessary"); smartSmash = smartSpellsMenu.CreateSwitcher("When using smash") .SetAbilityImage(AbilityId.earth_spirit_boulder_smash); smartRoll = smartSpellsMenu.CreateSwitcher("When using roll") .SetAbilityImage(AbilityId.earth_spirit_rolling_boulder); smartGrip = smartSpellsMenu.CreateSwitcher("When using grip") .SetAbilityImage(AbilityId.earth_spirit_geomagnetic_grip); }
public void TextSplit() { if (bSplitted) { return; } Roll cRoll = (Roll)_aAtoms.FirstOrDefault(o => o is Roll); if (null != cRoll) { cRoll.EffectOnScreen += new Container.EventDelegate(cRoll_EffectOnScreen); cRoll.EffectOffScreen += new Container.EventDelegate(cRoll_EffectOffScreen); List <Effect> aEffectsInRoll = cRoll.EffectsGet(); cSourceText = (Text)aEffectsInRoll.FirstOrDefault(o => o is Text); if (null != cSourceText) { cRoll.EffectRemove(cSourceText); TextSplitting cTS = new TextSplitting(cSourceText.sText, Preferences.nMaxTextWidth, cSourceText.cFont); aSplittedText = cTS.Split(); aSplittedEffects = new List <Text>(); foreach (string sLine in aSplittedText) { Text cT = new Text(); cT.sText = sLine; cT.nLayer = cSourceText.nLayer; //cT.bOpacity = cT.bOpacity; cT.cDock = cSourceText.cDock; cT.cFont = cSourceText.cFont; aSplittedEffects.Add(cT); cRoll.EffectAdd(cT); } //aEffectsInRoll.Remove(cSourceText); //aEffectsInRoll.AddRange(aSplittedEffects); bSplitted = true; } } }
private ITacticalAct CreateTacticalAct(ITacticalActScheme scheme, EffectCollection effects, Equipment equipment) { var greaterSurvivalEffect = effects.Items.OfType <SurvivalStatHazardEffect>() .OrderByDescending(x => x.Level).FirstOrDefault(); if (greaterSurvivalEffect == null) { return(new TacticalAct(scheme, scheme.Stats.Efficient, new Roll(6, 1), equipment)); } else { var effecientBuffRule = greaterSurvivalEffect.Rules .FirstOrDefault(x => x.RollType == RollEffectType.Efficient); var toHitBuffRule = greaterSurvivalEffect.Rules .FirstOrDefault(x => x.RollType == RollEffectType.ToHit); var efficientRoll = scheme.Stats.Efficient; if (effecientBuffRule != null) { var modifiers = new RollModifiers(-1); efficientRoll = new Roll(efficientRoll.Dice, efficientRoll.Count, modifiers); } Roll toHitRoll; if (toHitBuffRule == null) { toHitRoll = new Roll(6, 1); } else { var modifiers = new RollModifiers(-1); toHitRoll = new Roll(6, 1, modifiers); } return(new TacticalAct(scheme, efficientRoll, toHitRoll, equipment)); } }
private void Form1_Load(object sender, EventArgs e) { SoundPlayer sp = new SoundPlayer(@"Resources\levelup.wav"); sp.Play(); Roll character = Game.GetGame().Roll; character.RefillHealthAndMana(); lblOldLevel.Text = character.Level.ToString(); lblOldHealth.Text = ((float)Math.Round(character.Health)).ToString(); lblOldMana.Text = ((float)Math.Round(character.Mana)).ToString(); lblOldStr.Text = ((float)Math.Round(character.Str)).ToString(); lblOldDef.Text = ((float)Math.Round(character.Def)).ToString(); character.LevelUp(); lblNewLevel.Text = character.Level.ToString(); lblNewHealth.Text = character.Health.ToString(); lblNewMana.Text = character.Mana.ToString(); lblNewStr.Text = character.Str.ToString(); lblNewDef.Text = character.Def.ToString(); }
public void Create_RollNotExist_ThrowRollNotFoundError() { CreateEntities( out List <User> users, out List <Room> rooms, out List <UserRoom> userRooms, out List <Roll> rolls, out List <RollValue> rollValues); var rollValueService = CreateService(users, rooms, userRooms, rolls, rollValues); var rollValue = new RollValue { RollId = 999, MaxValue = 6, Value = 3 }; Roll roll = new Roll { UserId = 999, RoomId = 101 }; var exception = Assert.Throws <ApplicationException>( () => rollValueService.Create(rollValue)); Assert.Equal(DiceApi.Properties.resultMessages.RollNotFound, exception.Message); }
private int RollWithModifiers(Roll roll) { var sum = 0; for (var i = 0; i < roll.Count; i++) { var currentRoll = _dice.Roll(roll.Dice); if (roll.Modifiers != null) { currentRoll += roll.Modifiers.ResultBuff; } if (currentRoll <= 0) { currentRoll = 1; } sum += currentRoll; } return(sum); }
public void ApplyCalToInReport(byte[] inputReport, int startOffs = 0) { int idx = startOffs + 13; //first byte of gyro is here for (int i = 0; i < 6; i++) { short axisVal = (short)(((ushort)inputReport[idx + 1] << 8) | (ushort)inputReport[idx + 0]); if (i == 0) { axisVal = Pitch.apply(axisVal); } else if (i == 1) { axisVal = Yaw.apply(axisVal); } else if (i == 2) { axisVal = Roll.apply(axisVal); } else if (i == 3) { axisVal = X.apply(axisVal); } else if (i == 4) { axisVal = Y.apply(axisVal); } else if (i == 5) { axisVal = Z.apply(axisVal); } //put it back into the input report (little endian short) inputReport[idx++] = (byte)(((ushort)axisVal >> 0) & 0xFF); inputReport[idx++] = (byte)(((ushort)axisVal >> 8) & 0xFF); } }
public List<ImageNote> GetNotes(Roll roll) { string sql = ImageNotesSql(roll); var reader = Data_Context.RunSelectSQLQuery(sql, 30); var imgNotes = new List<ImageNote>(); if (reader.HasRows) { var sReader = new SpecialistsReader(); while (reader.Read()) { string uName = reader["Author"] as string; var spec = sReader.GetSpecialist(uName); string n = reader["Note"] as string; DateTime date = reader.GetDateTime(3); int imgNum = reader.GetInt32(0); if (n.Count() > 16) { if (n.ToLower().Substring(0, 16) != "edited in imageq") { var imgNote = new ImageNote(spec, n, date, imgNum); imgNotes.Add(imgNote); } } else { var imgNote = new ImageNote(spec, n, date, imgNum); imgNotes.Add(imgNote); } } Data_Context.CloseConnection(); return imgNotes; } else return null; }
public override void ApplyChanges <T>(T model) { if (model is SettingsMemoryFxModel memoryFx) { Filter.ApplyChanges(memoryFx); Phaser.ApplyChanges(memoryFx); Flanger.ApplyChanges(memoryFx); Synth.ApplyChanges(memoryFx); LoFi.ApplyChanges(memoryFx); RingModulator.ApplyChanges(memoryFx); GuitarToBass.ApplyChanges(memoryFx); SlowGear.ApplyChanges(memoryFx); Transpose.ApplyChanges(memoryFx); PitchBend.ApplyChanges(memoryFx); Robot.ApplyChanges(memoryFx); VocalDist.ApplyChanges(memoryFx); Dynamics.ApplyChanges(memoryFx); Eq.ApplyChanges(memoryFx); Isolator.ApplyChanges(memoryFx); Octave.ApplyChanges(memoryFx); Pan.ApplyChanges(memoryFx); Tremolo.ApplyChanges(memoryFx); Slicer.ApplyChanges(memoryFx); Delay.ApplyChanges(memoryFx); PanningDelay.ApplyChanges(memoryFx); TapeEcho.ApplyChanges(memoryFx); GranularDelay.ApplyChanges(memoryFx); Roll.ApplyChanges(memoryFx); Chorus.ApplyChanges(memoryFx); Reverb.ApplyChanges(memoryFx); } else { throw new ArgumentException("Model must be of type SettingsMemoryFxModel."); } }
public CombatAct([NotNull] ITacticalActScheme scheme, [NotNull] Roll efficient, [NotNull] Roll toHit, [MaybeNull] Equipment?equipment) { Scheme = scheme; if (scheme.Stats is null) { throw new InvalidOperationException(); } Stats = scheme.Stats; Efficient = efficient; ToHit = toHit; Equipment = equipment; Constrains = scheme.Constrains; CurrentCooldown = scheme.Constrains?.Cooldown != null ? 0 : null; }
public Game Clone() { var game = new Game { Id = Id, BlackPlayer = BlackPlayer.Clone(), WhitePlayer = WhitePlayer.Clone(), Points = Points.Select(p => p.Clone()).ToList(), BlackStarts = BlackStarts, Created = Created, CurrentPlayer = CurrentPlayer, PlayState = PlayState, Roll = Roll.Select(r => new Dice { Used = r.Used, Value = r.Value }).ToList(), ThinkStart = ThinkStart, }; game.Bars = new Point[2]; game.Bars[(int)Player.Color.Black] = game.Points[0]; game.Bars[(int)Player.Color.White] = game.Points[25]; return(game); }
public void GetRollSequence(Credentials client, Action <GameServerResult, List <Roll> > callback) { List <Roll> result = new List <Roll>(); for (int i = 0; i < 4; ++i) { List <int> final9 = new List <int>(); PotentialWins.Build9(final9, probabilitiesStatic_); //PotentialWins.Build9WithGuarenteedMatch( // PotentialWins.Difficulty.Level2_Diagonal_Nudge, // final9, // probabilitiesStatic_); Roll roll = new Roll() { BatchId = rnd_.Next() << 32 + rnd_.Next(), Icons = final9 }; result.Add(roll); } callback(GameServerResult.Success, result); }
// This method sets the round scores public void setRoll(Roll rllDiceRoll, int iRollNum) { // Store the dice roll iRoll[iRollNum - 1] = rllDiceRoll; // Calculate the score of the dice roll iDiceScore = 0; if (rllDiceRoll.iDie1 == iRoundNumber) { iDiceScore += rllDiceRoll.iDie1; } if (rllDiceRoll.iDie2 == iRoundNumber) { iDiceScore += rllDiceRoll.iDie2; } if (rllDiceRoll.iDie3 == iRoundNumber) { iDiceScore += rllDiceRoll.iDie3; } // Set any sequence and Lurgit bonus iSequenceBonus += rllDiceRoll.iSequenceBonus; iLurgitBonus += rllDiceRoll.iLurgitBonus; }
public void CalcRolls() { // Вычисление разверток помещения using (var pl = IdPolyline.GetObject(OpenMode.ForRead, false, true) as Polyline) { if (pl.Area < 500) { return; } Roll roll = new Roll(this); var segSomes = new List<RollSegment>(); Vector2d direction = Vector2d.XAxis; RollSegment segFirst = null; RollSegment segLast = null; RollSegment seg = null; for (int i = 0; i < pl.NumberOfVertices; i++) { var segType = pl.GetSegmentType(i); if (segType == SegmentType.Line) { var segLine = pl.GetLineSegment2dAt(i); var segLen = segLine.Length; // Создане сегмента и определение вида который в упор смотрит на этот сегмент seg = new RollSegment(this, segLine, i); // Если этот сегмент не сонаправлен предыдущему if (checkNewRoll(segSomes, direction, seg)) { roll.AddSegments(segSomes); AddRoll(roll); roll = new Roll(this); segSomes = new List<RollSegment>(); } if (!seg.IsPartition) { direction = seg.Direction; if (segFirst == null) segFirst = seg; segLast = seg; } if (seg.View != null && !seg.IsPartition) { // определен вид. roll.Num = seg.View.Name; roll.View = seg.View; } segSomes.Add(seg); } else if (segType == SegmentType.Arc) { var segBounds = pl.GetArcSegmentAt(i).BoundBlock; Extents3d segExt = new Extents3d(segBounds.GetMinimumPoint(), segBounds.GetMaximumPoint()); // Пока ошибка Inspector.AddError($"Дуговой сегмент полилинии помещения. Пока не обрабатываеься.", segExt, TransToModel, System.Drawing.SystemIcons.Warning); } else { //Inspector.AddError($"Cегмент полилинии помещения типа {segType}. Пока не обрабатываеься.", // pl.GeometricExtents, TransToModel, System.Drawing.SystemIcons.Warning); } } // Проверка последнего сегмента, если для него еще не определена развертка if (seg.Roll == null && segFirst != null) { // Проверка что последний сегмент входит в первую развертку помещения Roll rollFirst = segFirst.Roll; if (seg.IsPartition) { //rolFirst.AddSegments(new List<RollSegment>() { seg }); seg = segLast; direction = seg.Direction; } // Проверка - может это сегмент первой развертки в помещении var dirFirst = segFirst.Direction; if (checkNewRoll(segSomes, dirFirst, seg)) { // Новая развертка roll.AddSegments(segSomes); AddRoll(roll); } else { // Добавляем в первую развертку segSomes.Reverse(); rollFirst.AddSegments(segSomes); } } } }
public void Stop() { if (null != _cInfoCrawl) { lock (_cInfoCrawl) { if (_cInfoCrawl.eStatus == EffectStatus.Preparing || _cInfoCrawl.eStatus == EffectStatus.Running) _cInfoCrawl.Stop(); _cInfoCrawl = null; } } }
public void Init() { string sString = GetInfoSMSs(); if (1 > sString.Length) { (new Logger()).WriteError("Init:GetInfoSMSs = ''"); return; } lock (_cInfoCrawl = new Roll()) { _cInfoCrawl.eDirection = Roll.Direction.Left; _cInfoCrawl.stArea = new helpers.Area(_cPreferences.stSize); _cCrawlText = new Text(sString, _cPreferences.cFont, _cPreferences.nBorderWidth); _cCrawlText.stColor = _cPreferences.stColor; _cCrawlText.stColorBorder = _cPreferences.stBorderColor; _cCrawlText.bCUDA = false; _cInfoCrawl.nSpeed = _cPreferences.nSpeed; _cInfoCrawl.nLayer = _cPreferences.nLayer; _cInfoCrawl.EffectIsOffScreen += new ContainerVideoAudio.EventDelegate(_cInfoCrawl_EffectIsOffScreen); _cInfoCrawl.EffectAdd(_cCrawlText); _cInfoCrawl.Prepare(); } }
private long GapAppearingFrameGet(Roll.Keyframe[] aCurveFirstLine, int nHeightFirstLine) { // отдаст кадр момента появления зазора при выезде строки в роле for (long ni = aCurveFirstLine[0].nFrame; ni <= aCurveFirstLine[aCurveFirstLine.Length - 1].nFrame; ni++) { if (Roll.Keyframe.CalculateCurvesPoint(aCurveFirstLine, ni) < _cRoll.stArea.nHeight - nHeightFirstLine - 1) return ni; } return 0; }
private void Run() { try { bool bStandby = true; _cRoll.nSpeed = _cPreferences.nSpeed; _cMaskSingle.Start(null); _cMaskMulti.Start(null); _cRoll.Start(); double nStandbyMin = 10000; DateTime dtLastRollShow = DateTime.Now; while (true) { if (_bVisible) { if (!bStandby && 1 > _cRoll.nEffectsQty && 1 > _aqMessages.Count && 1 > _aqMessagesVIP.Count) { //_cRoll.nSpeed = 0; if (null != OnRollStandby) OnRollStandby(); bStandby = true; dtLastRollShow = DateTime.Now; } else if (bStandby && (5 < _aqMessages.Count || 0 < _aqMessagesVIP.Count) && DateTime.Now.Subtract(dtLastRollShow).TotalMilliseconds > nStandbyMin) { if (null != OnRollShow) OnRollShow(); bStandby = false; } if (!bStandby && 7 > _cRoll.nEffectsQty) MessagesAddToRoll(); } Thread.Sleep(1000); } } catch (Exception exx) { try { _cRoll.Stop(); _cRoll.Dispose(); _cRoll = null; } catch (Exception ex) // замена пустого кетча { (new Logger()).WriteError(ex); } if (!(exx is ThreadAbortException)) (new Logger()).WriteWarning("roll worker stopped exx=" + exx.Message + "<br>" + exx.StackTrace); } }
public void Init() { _aqMessages = new Queue<SMS>(); _aqMessagesVIP = new Queue<SMS>(); _aqMessageIDsDisplayed = new Queue<long>(); _aQueuedIDs = new List<long>(); _ahQueuedIDsDates = new Dictionary<long, DateTime>(); _cMaskSingle = new Animation(_cPreferences.sMaskPageSingle, 0, true) { stArea = new Area(_cPreferences.stSize) { nTop = 0, nLeft = 0 }, bCUDA = false }; _cMaskMulti = new Animation(_cPreferences.sMaskPageMulti, 0, true) { stArea = new Area(_cPreferences.stSize) { nTop = 0, nLeft = 0 }, bCUDA = false }; _cRoll = new Roll(); _cRoll.eDirection = Roll.Direction.Up; _cRoll.nSpeed = _cPreferences.nSpeed; _cRoll.stArea = new Area(_cPreferences.stSize); _cRoll.bCUDA = true; _cRoll.nLayer = _cPreferences.nLayer; _cRoll.EffectIsOffScreen += _cRoll_EffectIsOffScreen; _cRoll.EffectIsOnScreen += _cRoll_EffectIsOnScreen; _bVisible = false; }
private static bool Test(string m) { var r = new Roll(m); if (r.ToString() != m.Replace(" ", "")) { Debug.LogErrorFormat("Failed: '{0}' => '{1}'", m, r.ToString()); return false; } return true; }
public QALogReader(Roll roll) { this.Roll = roll; Images = new Dictionary<string, List<string>>(); }
void DoMerge(PhotoQuery query, Roll [] rolls, bool copy) { tag_map = new Dictionary<uint, Tag> (); roll_map = new Dictionary<uint, uint> (); Log.Warning ("Merging tags"); MergeTags (from_db.Tags.RootCategory); Log.Warning ("Creating the rolls"); CreateRolls (rolls); Log.Warning ("Importing photos"); ImportPhotos (query, copy); }
public override void OnDiceRolled() { if (RollNumber == 1) { RollDice(3); Dealer.PrivateOverheadMessage(MessageType.Regular, 0x35, 1153391, string.Format("{0}\t{1}\t{2}", GetRoll(0), GetRoll(1), GetRoll(2)), Player.NetState); // *rolls the dice; they land on ~1_FIRST~ ~2_SECOND~ ~3_THIRD~* } else { Roll.Add(Utility.RandomMinMax(1, 6)); Dealer.PrivateOverheadMessage(MessageType.Regular, 0x35, RollNumber == 2 ? 1153633 : 1153634, RollNumber == 2 ? GetRoll(3).ToString() : GetRoll(4).ToString(), Player.NetState); // *rolls the fourth die: ~1_DIE4~* } if (RollNumber == 3) { int winnings = 0; if (IsFiveOfAKind()) { winnings = TotalBet * 80; } else if (IsFourOfAKind()) { winnings = TotalBet * 3; } else if (IsStraight()) { winnings = TotalBet * 2; } else if (IsFullHouse()) { winnings = (int)(TotalBet * 1.5); } else if (IsThreeOfAKind()) { winnings = TotalBet; } if (winnings > 0) { Winner = true; OnWin(); WinningTotal = winnings; PointsSystem.CasinoData.AwardPoints(Player, winnings); Dealer.PrivateOverheadMessage(MessageType.Regular, 0x35, 1153377, string.Format("{0}\t{1}", Player.Name, winnings.ToString(CultureInfo.GetCultureInfo("en-US"))), Player.NetState); // *pays out ~2_VAL~ chips to ~1_NAME~* } else { Dealer.PrivateOverheadMessage(MessageType.Regular, 0x35, 1153376, string.Format("{0}\t{1}", Player.Name, TotalBet.ToString(CultureInfo.GetCultureInfo("en-US"))), Player.NetState); // *rakes in ~1_NAME~'s ~2_VAL~-chip bet* } } else { _RollTimer = Timer.DelayCall(TimeSpan.FromSeconds(30), () => { Stage = GameStage.Rolling; BeginRollDice(); }); } Stage = GameStage.Results; RollNumber++; }
private void AddRoll(Roll roll) { if (hRolls.Add(roll)) { Rolls.Add(roll); // Проверки развертки roll.Check(); } }