DragonDice

Check-in [20c845ae6a]
Login

Check-in [20c845ae6a]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Commands to edit language proficiencies
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 20c845ae6adabc8dd62fae0b0ab07a112f0e6d5d0a1dd568b7d85982bde822a5
User & Date: murphy 2020-04-28 21:03:10.000
Context
2020-04-28
22:25
Commands to edit numeric character stats check-in: 1d65c572e3 user: murphy tags: trunk
21:03
Commands to edit language proficiencies check-in: 20c845ae6a user: murphy tags: trunk
20:51
Commands to edit skill proficiencies check-in: 68653e1421 user: murphy tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to DragonDice.Bot/Session.fs.
739
740
741
742
743
744
745

746
747
748
749
750
751
752
              let s = Skill.toString skill
              (s, s)
            )
            >> Seq.toList
          )
          |> Seq.toList
        )

      | ["/addproficiency"; skill] ->
        let chr = selectedCharacter user
        let skill = Skill.ofString skill
        chr.Proficiencies <- chr.Proficiencies.With[skill, 1]
        let buffer = Text.StringBuilder("<i>").Append(HttpUtility.HtmlEncode chr.Name).Append("</i> : ")
        let pos = buffer.Append("Skills = ").Length
        for KeyValue (skill, v) in chr.Skills do







>







739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
              let s = Skill.toString skill
              (s, s)
            )
            >> Seq.toList
          )
          |> Seq.toList
        )

      | ["/addproficiency"; skill] ->
        let chr = selectedCharacter user
        let skill = Skill.ofString skill
        chr.Proficiencies <- chr.Proficiencies.With[skill, 1]
        let buffer = Text.StringBuilder("<i>").Append(HttpUtility.HtmlEncode chr.Name).Append("</i> : ")
        let pos = buffer.Append("Skills = ").Length
        for KeyValue (skill, v) in chr.Skills do
787
788
789
790
791
792
793












































794
795
796
797
798
799
800
            let v = v + Ability.modifier chr.Abilities.[Skill.ability skill]
            if buffer.Length > pos then buffer.Append(", ") |> ignore
            buffer.Append(Skill.toString skill)
              .AppendFormat(CultureInfo.InvariantCulture, " {0:+0;-#}", v)
            |> ignore
        if buffer.Length = pos then buffer.Append("None") |> ignore
        return Markup (buffer.ToString(), List.empty)












































      
      | ["/save"] ->
        let chr = selectedCharacter user
        chr.Save()
        return Markup (
          sprintf "<i>%s</i> : Saved for %s" (HttpUtility.HtmlEncode chr.Name) (userMarkup user),
          List.empty







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
            let v = v + Ability.modifier chr.Abilities.[Skill.ability skill]
            if buffer.Length > pos then buffer.Append(", ") |> ignore
            buffer.Append(Skill.toString skill)
              .AppendFormat(CultureInfo.InvariantCulture, " {0:+0;-#}", v)
            |> ignore
        if buffer.Length = pos then buffer.Append("None") |> ignore
        return Markup (buffer.ToString(), List.empty)

      | ["/addlanguage" | "/removelanguage"] ->
        let dup s = s, s
        return Markup (
          "<b>Note:</b> Select a language proficiency",
          [
            yield!
              Language.Standard
              |> Seq.chunkBySize 4
              |> Seq.map (Array.map dup >> List.ofArray)
            yield!
              Language.Exotic
              |> Seq.chunkBySize 4
              |> Seq.map (Array.map dup >> List.ofArray)
            yield
              Language.Secret
              |> Seq.map dup
              |> Seq.toList
          ]
        )
        
      | ["/addlanguage"; lang] ->
        let chr = selectedCharacter user
        let layer = chr.GetOrAddStatLayer<CustomStatLayer>()
        layer.Languages <- Set.add lang layer.Languages
        let buffer = Text.StringBuilder("<i>").Append(HttpUtility.HtmlEncode chr.Name).Append("</i> : ")
        let pos = buffer.Append("Languages = ").Length
        for lang in chr.Languages do
          if buffer.Length > pos then buffer.Append(", ") |> ignore
          buffer.Append(HttpUtility.HtmlEncode lang) |> ignore
        if buffer.Length = pos then buffer.Append("None") |> ignore
        return Markup (buffer.ToString(), List.empty)
        
      | ["/removelanguage"; lang] ->
        let chr = selectedCharacter user
        let layer = chr.GetOrAddStatLayer<CustomStatLayer>()
        layer.Languages <- Set.remove lang layer.Languages
        let buffer = Text.StringBuilder("<i>").Append(HttpUtility.HtmlEncode chr.Name).Append("</i> : ")
        let pos = buffer.Append("Languages = ").Length
        for lang in chr.Languages do
          if buffer.Length > pos then buffer.Append(", ") |> ignore
          buffer.Append(HttpUtility.HtmlEncode lang) |> ignore
        if buffer.Length = pos then buffer.Append("None") |> ignore
        return Markup (buffer.ToString(), List.empty)
      
      | ["/save"] ->
        let chr = selectedCharacter user
        chr.Save()
        return Markup (
          sprintf "<i>%s</i> : Saved for %s" (HttpUtility.HtmlEncode chr.Name) (userMarkup user),
          List.empty