Stellarcore.net

Stellarcore.net

Here is a Go version of the script, interesting language, executes nice and fast as you would hope.

package main

import s "strings"
import "strconv"
import "fmt"


func level_th(number int) string {
   //Take an interger in but return a String
   var number_th string
   number_th = strconv.Itoa(number)
   if (number == 11) || (number == 12) || (number == 13) {
      number_th = number_th + "th"
   } else if s.HasSuffix(number_th, "1") {
      number_th = number_th + "st"
   } else if s.HasSuffix(number_th, "2") {
      number_th = number_th + "nd"
   } else if s.HasSuffix(number_th, "3") {
      number_th = number_th + "rd"
   } else {
      number_th = number_th + "th"
   }
   return number_th
}

func main() {
   //Headers
   fmt.Println("Char \t \tClass Skill\tCC Skill\t \tStat\t")
   fmt.Println("Level\tXP\tMax Ranks\tMax Ranks\tFeats\tIncreases\t");

   //Main loop
   var max_lvl int = 40
   var xp int = 0
   var feats int = 0
   var stats int = 0

   for level := 1;  level < max_lvl; level++ {
      xp = xp + (level - 1) * 1000
      maxranks := level + 3
      maxcc := maxranks / 2.0;

      feat_check := level % 3;
      feats_out := "--"
      if (feat_check == 0) || (level == 1) {
         feats = feats + 1
         feats_out = level_th(feats)
      }

      stat_check := level % 4
      stats_out := "--"
      if stat_check == 0 {
         stats = stats + 1
         stats_out = level_th(stats)
      }

      level_out := level_th(level)

      fmt.Printf(" %v\t%v\t\t%v\t\t%v\t%v\t%v\n", level_out, xp, maxranks, maxcc, feats_out, stats_out)

   }
}