private static DiceDto AddDieStr(DiceRoll diceRoll, CardDto cardDto, DndViewer viewer, string dieStr, string dieLabelOverride = null, int targetCharacterId = int.MinValue) { string dieBackColorOverride = viewer.DieBackColor; string dieTextColorOverride = viewer.DieTextColor; int parenIndex = dieStr.IndexOf("("); DamageType damageType = DamageType.None; DieCountsAs dieCountsAs = DieCountsAs.totalScore; string diePlayerName = cardDto.Card.UserName; double modifier = 0; double scaleOverride = viewer.Reputation + 0.30; int dieOwnerOverride = int.MinValue; if (parenIndex >= 0) { ProcessDieDetails(diceRoll, targetCharacterId, ref dieStr, ref dieBackColorOverride, ref dieTextColorOverride, parenIndex, ref damageType, ref dieCountsAs, ref modifier, ref diePlayerName, ref scaleOverride, ref dieOwnerOverride); } string[] dieParts = dieStr.Split('d'); if (dieParts.Length != 2) { return(null); } string dieLabel; if (string.IsNullOrWhiteSpace(dieLabelOverride) || dieLabelOverride.Trim() == "\"\"") { dieLabel = $"{cardDto.Card.UserName}"; } else { dieLabel = dieLabelOverride.Trim().TrimStart('"').TrimEnd('"'); } int quantity; int sides; if (!int.TryParse(dieParts[0], out quantity) || !int.TryParse(dieParts[1], out sides)) { return(null); } DiceDto diceDto = new DiceDto() { PlayerName = diePlayerName, CreatureId = dieOwnerOverride, Sides = sides, Quantity = quantity, Label = dieLabel.Replace("target_name", DndUtils.GetFirstName(diePlayerName)), Scale = scaleOverride, Modifier = modifier, DamageType = damageType, BackColor = dieBackColorOverride, FontColor = dieTextColorOverride, DieCountsAs = dieCountsAs, Data = cardDto.Card.Guid }; diceRoll.DiceDtos.Add(diceDto); return(diceDto); }
void SetName(StatBox statBox, string name) { statBox.Text = DndUtils.GetFirstName(name); statBox.IsEnabled = false; }