From de30e54109a3ec981b4a50e406466fe2686ae307 Mon Sep 17 00:00:00 2001 From: Peijun Ma Date: Tue, 13 Jun 2023 23:42:37 -0400 Subject: [PATCH] Add modifier tier to display_curse output --- display_curse/blessing.csv | 371 ++++++++++++++++++++++++++++++ display_curse/curse.csv | 406 +++++++++++++++++++++++++++++++++ display_curse/display_curse.go | 109 +++++++-- display_curse/tweak.csv | 14 ++ 4 files changed, 886 insertions(+), 14 deletions(-) create mode 100644 display_curse/blessing.csv create mode 100644 display_curse/curse.csv create mode 100644 display_curse/tweak.csv diff --git a/display_curse/blessing.csv b/display_curse/blessing.csv new file mode 100644 index 0000000..ebf194e --- /dev/null +++ b/display_curse/blessing.csv @@ -0,0 +1,371 @@ +i-Pentagram,5, +i-Clay,4, +i-Prism,4, +i-Spell: Slice,1, +i-Flickering Blade,1, +Mana per boss,3, +i-Tourmaline Paraiba,3, +i-Blue Skink,5, +i-Twisted Flax,3, +i-Hourglass,3, +i-Leaden Handle,3, +i-Poodle,3, +i-Candle,3, +i-Karma,3, +i-Thimble,3, +i-Ink Bottle,3, +i-Twisted Bar,3, +i-Wand Grips,3, +i-Tie,3, +i-Nunchaku,3, +i-Spell: Beam,2, +i-Shuriken,2, +i-Alembic,2, +i-Shining Bow,2, +i-Chakram,2, +i-Sling,2, +i-Wand of Wand,2, +i-Eucalyptus,2, +i-Blindfold,2, +i-Ladder,2, +i-Treasure Chest,2, +i-Polished Emerald,2, +i-Whiskey,2, +i-Ruby,2, +i-Door,2, +i-Tankard,2, +i-Chocolate Bar,2, +i-Spell: Heat,2, +i-Simplicity,2, +i-Monocle,2, +i-Ordinary Triangle,2, +i-Fearless,2, +i-Red flag,2, +i-Heart of Light,2, +i-Ambrosia,2, +i-Enchanted Harp,2, +i-Ornate Hilt,2, +Turn 3 Heal,4, +Crackling,8, +Vitamin E,4, +Hero invigorate,8, +i-Mithril Shields,5, +i-Ruby Shards,5, +i-Spell: Charge,3, +i-Duck,2, +i-Broomstick,6, +Bone Math,7, +Barrel Time,25, +Threee,3, +Challenge Each Level,2, +Favour of Horus,16, +Middle-shield,4, +Growth Fan,3, +Stun Specialist,6, +Deep Pockets,2, +Rebalance,3, +Cleave Burst,7, +Cruel Burst,4, +Cataclysm,4, +Golden Cache,8, +Cache,4, +Hamstring,6, +Underworld Deal,3, +Youth,4, +Fumes,4, +Potential,4, +Leyline,4, +Infinite Chalice,8, +Hero rite,1, +i-Top Duplicate,5, +i-Conduit,3, +i-Spell: Clink,2, +i-Faint Halo,1, +i-Demon Horn,2, ++3 max mana,1, +Weak Monsters,5, +Hero cantrip,30, +i-Shimmering Halo,3, +i-Buckler,1, +i-Idol of Aiiu,1, +i-Greatsword,4, +i-Updog,2, +i-Demonic Deal,3, +Hero pristine,20, +i-Dragonhide Gloves,2, +i-Lucky,1, +Treasure-seeker,4, +Hero enduring,4, +Hero regen,13, +Save Spell,4, +i-Wand of Stun,3, +i-Charge Link,3, +i-Flute,3, +i-Stasis,3, +i-Mushroom,3, +i-Sickle,3, +i-Boots of Speed,3, +i-Pocket Mirror,3, +i-Demon Claw,3, +i-Second Chance,3, +i-Metal Studs,3, +i-Poison Dip,3, +i-Dragon Pipe,3, +i-Iron Helm,3, +i-Troll's Blood,3, +i-Wooden Bracelet,3, +i-Spell: Invest,3, +i-Study,3, +i-Ogre Blood,3, +i-Sharp Wit,3, +i-Two Reeds,3, +i-Ichor Chalice,3, +i-Pair of Kings,3, +i-Cauldron,3, +i-Spell: Spark,3, +i-Early Grave,3, +i-Scales,3, +i-Spell: Mark,3, +i-Poem,3, +i-Glyph of Purity,3, +i-Blinding Bolt,3, +i-Spinning Scythe,3, +i-Lens,3, +i-Duvet,3, +i-Water,3, +i-Garnet,1, +Greased Dice,4, +Hero dispel,6, +i-Whirlwind,5, +i-Erythrocyte,3, +i-Eyepatch,2, +i-Enhance Wand,4, +i-Wrench,3, +i-Blood Amulet,3, +i-Blood Chalice,1, +i-Mirror Mask,4, +Essence Thief,3, +i-Statuette,1, +Hero cruel,9, +Hero self-heal,8, +i-Bowl,1, +i-Gambler's Ace,1, +i-Faerie Dust,4, +i-Ocular Amulet,3, +i-Glowing Egg,3, +Hero growth,8, +Lucky Start,4, +Hero vulnerable,11, +Hero copycat,12, +i-Broadsword,3, +i-Huge Sword,5, +i-Golden D6,6, +i-Bonesaw,2, +i-PowerStone,2, +i-Duelling Pistol,2, +i-Flawed Diamond,2, +i-Viscera,2, +i-Syringe,2, +i-Pillow,2, +i-Quicksilver,2, +i-Mana Bomb,2, +i-Cracked Wheel,2, +i-Natural,2, +i-Siphon,2, +i-Diving Suit,2, +i-Jester's Cap,2, +i-Longsword,2, +i-Mana Jelly,2, +i-Apple,2, +i-Charged Skull,2, +i-Tiara,2, +i-Life Bolt,2, +i-Smelly Manure,2, +i-Terrarium,2, +i-Spell: Hex,2, +i-Troll's Nose,2, +i-Empty Chalice,2, +i-Chainmail,2, +i-Mini Crossbow,2, +i-Antivenom,2, +i-Spell: Hack,2, +i-Demon Eye,2, +i-Charon's Obol,2, +i-Magic Staff,2, +i-Harpoon,2, +i-Hissing Ring,2, +i-Splitting Arrows,2, +i-Ritual Dagger,2, +i-Lich Finger,2, +Hero mana-gain,30, +Hero bloodlust,22, +Hero ego,4, +Jewelled Chalice,4, +Boss Smash+,8, +Boss Smash,4, +Survival Specialist+,8, +Survival Specialist,4, +Heal 5th,3, +Shield 3rd,5, +i-Bag of Holding,10, +i-Banned,7, +i-Illegal,6, +i-Ethereal Cloak,6, +i-Diamond Ring,6, +i-placeholder,6, +i-Fertiliser,6, +i-Cursed Bolt,1, +i-Tower Shield,1, +i-Wandcraft,4, +i-Clumsy Hammer,1, +i-Sapphire,1, +i-Dynamo,3, +Hero ranged,3, +i-Sapphire Ring,4, +i-Sack of Mana,2, +i-InfiniHeal,3, +Monster Blank,6, +i-Spell: Light,4, +Great Start,7, +Shiny,4, +Shrink,4, +Hero terminal,4, +BLERGHING,14, +i-Wax Seal,3, +i-Ghost Shield,3, +i-Faerie Pact,2, +i-Spell: Restore,1, +i-Catnip,3, +i-Unholy Strength,1, +i-Scorpion Tail,4, +i-Face of Horus,6, +Heal+,5, +i-Tooth Necklace,3, +i-Determination,2, +Hero focus,12, +i-Burning Halo,4, +i-Shortsword,1, +i-Rejuvenation Wand,1, +Hero self-shield,12, +i-Tentacle,3, +i-Idol of Chrzktx,2, +i-Gauntlet,4, +i-Lich's Tome,1, +Fizzing,4, +Hero duel,8, +Hero patient,4, +i-Fangs,5, +i-Spell: Infinity,5, +i-Egg Basket,5, +i-Diamond Skull,5, +i-Poseidon's Charm,5, +i-Dolphin,4, +i-Helm of Power,4, +i-Goblet of Life,4, +i-Iron Crown,4, +i-Timestone,4, +i-Bullseye,4, +i-Charged Hammer,4, +i-Eye of Horus,4, +i-Chaos Wand,4, +i-Dumbbell,4, +i-Boarhide Bracers,4, +i-Angel Feather,4, +i-Horned Viper,4, +i-Emerald Mirror,4, +i-Silk Cape,4, +i-Collar,4, +i-Triple Shuriken,4, +i-Sushi,4, +i-Cocoon,4, +i-Brimstone,4, +i-Olympian Trident,4, +i-Standard,4, +i-Ironblood Pendant,4, +i-Serration,4, +i-Singularity,4, +Hero steel,12, +Essence Capture+,6, +Bolt Spell,4, +Hero overdog,8, +i-Anvil,3, +i-Pocket Phylactery,1, ++2 hero hp,7, +Peace,200, +i-Archmage Orb,6, +Hero cleanse,6, +i-Overflowing Chalice,3, +i-Origami,1, +Hero engage,13, +i-Deadly Bolt,4, +i-Three-of-a-Kind,1, +i-Crescent Shield,3, +i-Pauldron,2, +Shield+,6, +i-Spell: Sprout,1, +Hero deathwish,13, +Poison Immunity,5, +Hero poison,15, +Essence Capture,3, +Hero inspired,10, +Hero pair,8, +i-Silver Pendant,3, +i-Whetstone,1, +i-Enchanted Shield,1, +i-Autumn Leaf,1, +i-Droopy Hat,1, +i-Iron Pendant,1, +i-Lightning Rod,1, +i-Abacus,1, +i-Lead Boots,1, +i-Rain of Arrows,1, +i-Scalpel,1, +i-Pure Heart Pendant,1, +i-Urn,1, +i-Glass Blade,1, +i-Golden Thread,1, +i-Spell: Remedy,1, +i-Incense,1, +i-Iron Heart,1, +i-Regen Potion,1, +i-Leather Gloves,1, +i-Wandify,1, +i-Whey,1, +i-Cheater's Sleeves,1, +i-Fletching,1, +i-Silver Imp,1, +i-Square Wheel,1, +i-Titanbane Potion,1, +i-Friendship Bracelet,1, +i-First-aid Kit,1, +i-2 of Hearts,1, +i-Mana Potion,1, +i-Sapphire Skull,1, +i-Liqueur,1, +i-Twin Daggers,1, +i-Blessed Ring,1, +i-Longbow,1, +i-Blessed Water,1, +i-Relic,1, +i-Big Hammer,1, +i-Citrine Ring,1, +i-Burning Blade,1, +i-Powdered Mana,1, +Hero repel,18, +Preparation,4, +Hero underdog,8, +Absorb bosses,10, ++1 max mana per boss,1, +Reroll per boss,6, +Level-up every other,21, +Level-up top three,21, +Level-up top and bottom,14, +Level-up bottom,7, +Level-up middle,7, +Level-up top,7, ++2 Rerolls,7, ++1 Reroll,4, +[b]Echo[b] ECHO echo...,6, +Left Dog,5, +Monster decay,2, +Monster single-use,9, diff --git a/display_curse/curse.csv b/display_curse/curse.csv new file mode 100644 index 0000000..24cbfb9 --- /dev/null +++ b/display_curse/curse.csv @@ -0,0 +1,406 @@ +Slow Spells,-1, +Mortal++++++++++,-100, +Mortal+++++++++,-40, +Mortal++++++++,-25, +Mortal+++++++,-15, +Mortal++++++,-10, +Mortal+++++,-7, +Mortal++++,-5, +Mortal+++,-4, +Mortal++,-3, +Mortal+,-2, +Mortal,-1, +De-level bottom,-4, +De-level middle,-4, +De-level top,-4, +Permadeath,-4, +Monster self-heal,-8, +Monster era,-9, +Summon Graves,-19, +Summon Spiders,-11, +Summon Imps,-15, +Hero death,-25, +Hero heavy,-8, +Hero pain,-10, +Hero exert,-10, +Hero eliminate,-3, +Hero single-use,-9, +Hero decay,-4, +Add [purple]Slate[cu] (11-20),-6, +Add [purple]Hydra[cu] (11-20),-12, +Add [purple]Sniper[cu],-5, +Add [purple]Archer[cu],-2, +Monster HP+++++++++,-20, +Monster HP++++++++,-9, +Monster HP+++++++,-8, +Monster HP++++++,-7, +Monster HP+++++,-6, +Monster HP++++,-5, +Monster HP+++,-4, +Monster HP++,-3, +Monster HP+,-2, +Monster HP,-1, +Monster Rights +3,-9, +Add [purple]Spiker[cu] (11-20),-9, +Add [purple]Caw[cu] (11-20),-5, +Monster inflict-death,-10, +Frailty,-9, +Add [purple]Rat[cu],-2, +Add [purple]Cyclops[cu] (11-20),-7, +Revive 1 hp,-3, +Revive 2 hp,-2, +Revive 3 hp,-1, +BUG,-6, +Add [purple]Boar[cu] (11-20),-3, +Add [purple]Ghost[cu] (11-20),-4, +Add [purple]Demon[cu] (11-20),-7, +Add [purple]Ogre[cu] (11-20),-6, +Add [purple]Alpha[cu] (11-20),-6, +Add [purple]Slimer[cu] (11-20),-4, +Add [purple]Wizz[cu] (11-20),-4, +Add [purple]Warchief[cu] (11-20),-5, +Add [purple]Bandit[cu] (11-20),-3, +Add [purple]Saber[cu] (11-20),-5, +Add [purple]Fanatic[cu] (11-20),-4, +Add [purple]Sudul[cu] (11-20),-3, +Add [purple]Quartz[cu] (11-20),-3, +Add [purple]Snake[cu] (11-20),-3, +Add [purple]Wolf[cu] (11-20),-2, +Add [purple]Z0mbie[cu] (11-20),-7, +Add [purple]Zombie[cu] (11-20),-4, +Add [purple]Gnoll[cu] (11-20),-3, +Add [purple]Goblin[cu] (11-20),-2, +Add [purple]Thorn[cu] (11-20),-3, +Add [purple]Illusion[cu] (11-20),-1, +Add [purple]Grave[cu] (11-20),-3, +Add [purple]Spider[cu] (11-20),-1, +Add [purple]Imp[cu] (11-20),-3, +Add [purple]Slimelet[cu] (11-20),-1, +Add [purple]Wisp[cu] (11-20),-2, +Add [purple]Rat[cu] (11-20),-1, +Add [purple]Sniper[cu] (11-20),-3, +Add [purple]Archer[cu] (11-20),-1, +Consistency+,-8, +Monster charged,-3, +Monster growth,-2, +Frail middle,-1, +Summon Illusions,-6, +Heavy Dice,-1, +-1 Reroll,-4, +Creaky Joints,-5, +Pain Edges,-4, +Wanded,-4, +All Poisoned,-7, +Top 3 Poisoned,-4, +Undying Monsters,-4, +Migraine,-6, +Left -1,-3, +Left Blank,-7, +Right Blank+,-3, +Right Blank,-1, +Middle Blank,-4, +Expensive Spells,-4, +Depleted Spells,-3, +Archery Training,-1, +Barricade,-4, +Stony Grasp,-3, +Osteoporosis,-2, +Arthritis,-1, +Add Bones,-3, +Non-boss Bones,-2, +Boss Bones,-1, +Curse of Vowels,-3, +AE,-2, +Consistency,-6, +Add [purple]Basilisk[cu] (11-20),-7, +Frail edges,-3, +Fear,-1, +Add [purple]Wisp[cu],-4, +Nostalgia,-1, +Fear+++,-4, +Summon Thorns,-17, +3rd turn Quartz,-5, +Summon Gnolls,-16, +Undying Monsters+,-10, +Swarm+,-2, +Slippery Dice++,-6, +Summon Wolves,-14, +Add [purple]Illusion[cu],-2, +3rd turn Wizz,-7, +Horde,-1, +Caltrops+++,-15, +Caltrops++,-13, +Caltrops+,-10, +Caltrops,-5, +Shield Response++,-5, +Shield Response+,-3, +Shield Response,-1, +Small Bonus++++,-5, +Small Bonus+++,-4, +Small Bonus++,-3, +Small Bonus+,-2, +Small Bonus,-1, +Sandstorm++++++++,-9, +Sandstorm+++++++,-8, +Sandstorm++++++,-7, +Sandstorm+++++,-6, +Sandstorm++++,-5, +Sandstorm+++,-4, +Sandstorm++,-3, +Sandstorm+,-2, +Summon Slates,-30, +3rd turn Basilisks,-10, +Tower,-1, +Tower+,-2, +Tower+++,-4, +Add [purple]Slimelet[cu],-2, +Fear++,-3, +3rd turn Snakes,-4, +Damage -1,-6, +Heavy Dice+,-3, +Summon Goblins,-13, +Add [purple]Spider[cu],-3, +Heavy Dice++,-5, +Cooldown Burst,-1, +Heavy Weapons,-4, +3rd turn Sabers,-8, +3rd turn Warchiefs,-8, +Add [purple]Thorn[cu],-6, +Heal -1,-3, +Summon Fanatics,-23, +Add [purple]Gnoll[cu],-5, +Third death,-6, +Add [purple]Z0mbie[cu],-12, +-2 Max Mana,-1, +Summon Alphas,-27, +Bottom Poison+,-2, +Summon Demons,-33, +3rd turn Ogres,-8, +3rd turn Ghosts,-7, +Skulk+,-2, +Add [purple]Troll[cu] (11-20),-9, +Monster pristine,-4, +Add [purple]Crone[cu] (11-20),-3, +3rd turn Wolves,-4, +3rd turn Z0mbies,-10, +3rd turn Zombies,-7, +3rd turn Gnolls,-5, +3rd turn Goblins,-4, +3rd turn Thorns,-5, +3rd turn Illusions,-2, +3rd turn Graves,-6, +3rd turn Spiders,-3, +3rd turn Imps,-5, +3rd turn Slimelets,-2, +3rd turn Wisps,-4, +3rd turn Rats,-2, +3rd turn Snipers,-4, +3rd turn Archers,-2, +3rd turn Bones,-3, +Summon Dragon Eggs,-21, +Summon Caw Eggs,-15, +Summon Lichs,-56, +Summon Banshees,-40, +Summon Brambles,-35, +Tower++,-3, +Poisoned Finale,-2, +Fear+,-2, +Mana -1,-5, +Swarm,-1, +Add [purple]Imp[cu],-5, +Summon Zombies,-24, +3rd turn Fanatics,-7, +Summon Z0mbies,-31, +Fourth single-use,-1, +Second single-use,-2, +Summon Quartz,-18, +Sticky Blanks,-5, +Summon Bandits,-19, +Swarm++,-3, +Selfless Heroes,-1, +Summon Slimers,-24, +Bottom Poison,-1, +Middle 1 hp,-3, +3rd turn Boars,-6, +3rd turn Crones,-6, +Summon Hydras,-51, +Monster +2 (11-20),-10, +Monster +1 (11-20),-5, +Add [purple]Dragon Egg[cu] (11-20),-4, +Add [purple]Caw Egg[cu] (11-20),-3, +Add [purple]Dragon[cu] (11-20),-25, +Add [purple]Lich[cu] (11-20),-14, +Add [purple]Banshee[cu] (11-20),-9, +Add [purple]Bramble[cu] (11-20),-7, +Slippery Dice,-2, +Slippery Dice+,-4, +-2 Rerolls,-10, +Shield -1,-3, +3rd turn Suduls,-4, +Add [purple]Grave[cu],-6, +Death Shield,-1, +3rd turn Bandits,-6, +Death Shield+,-2, +Summon Snakes,-15, +Fifth death,-2, +Add [purple]Goblin[cu],-4, +Summon Sabers,-24, +Add [purple]Zombie[cu],-8, +No Burst,-3, +Swarm+++,-4, +Second death,-8, +Double Monsters,-20, +Shimmering Monsters,-5, +Top 1 hp,-3, +3rd turn Demons,-10, +Summon Trolls,-38, +3rd turn Caws,-8, +Summon Slimelets,-6, +Summon Wisps,-13, +Summon Rats,-8, +Summon Snipers,-15, +Summon Archers,-7, +Summon Bones,-11, +Add [purple]Dragon Egg[cu],-7, +Add [purple]Caw Egg[cu],-5, +Add [purple]Dragon[cu],-43, +Add [purple]Lich[cu],-24, +Add [purple]Banshee[cu],-16, +Add [purple]Bramble[cu],-13, +Add [purple]Cyclops[cu],-13, +Add [purple]Hydra[cu],-21, +Add [purple]Basilisk[cu],-12, +Add [purple]Crone[cu],-6, +Add [purple]Caw[cu],-9, +Add [purple]Troll[cu],-15, +Add [purple]Slate[cu],-11, +Add [purple]Spiker[cu],-16, +Add [purple]Boar[cu],-6, +Add [purple]Ghost[cu],-8, +Add [purple]Demon[cu],-13, +Add [purple]Ogre[cu],-10, +Add [purple]Alpha[cu],-10, +Add [purple]Slimer[cu],-8, +Add [purple]Wizz[cu],-8, +Add [purple]Warchief[cu],-9, +Add [purple]Bandit[cu],-6, +Add [purple]Saber[cu],-9, +Add [purple]Fanatic[cu],-8, +Add [purple]Sudul[cu],-5, +Add [purple]Quartz[cu],-6, +Add [purple]Snake[cu],-5, +Add [purple]Wolf[cu],-4, +Slimedemic,-4, +Sandstorm,-1, +Summon Spikers,-40, +3rd turn Slates,-10, +Worse Items++,-7, +Worse Items+,-3, +Worse Items,-1, +Armour++++,-5, +Armour+++,-4, +Armour++,-3, +Armour+,-2, +Armour,-1, +Stitch+,-4, +Stitch,-2, +Edge Death,-15, +Bottom Death,-7, +Middle Death,-7, +Top Death,-7, +Mana Debt+++,-4, +Mana Debt++,-3, +Mana Debt+,-2, +Mana Debt,-1, +i-Exhaustion,-2, +i-Weariness,-1, +i-Broken Spirit,-2, +i-Broken Heart,-1, +i-Wretched Crown,-2, +i-Soul Link,-2, +i-Slimed,-2, +i-Pharoah's Curse,-2, +i-D4,-1, +i-Mould,-1, +i-Handcuffs,-1, +i-Lead Weight,-1, +i-Affliction,-1, +i-Martyr,-1, +i-Coiled Snake,-1, +Ouroboros,-4, +Rise,-7, +Back to Basics,-5, +Summon Caws,-25, +Summon Cyclops,-34, +Monster Rights +2,-6, +Monster Rights +1,-3, +Monster Right +2,-4, +Monster Right +1,-2, +Monster Left +5,-5, +Monster Left +4,-4, +Monster Left +3,-3, +Monster Left +2,-2, +Monster Left +1,-1, +Start Damaged++++,-5, +Start Damaged+++,-4, +Start Damaged++,-3, +Start Damaged+,-2, +Start Damaged,-1, +Doom+++++++,-25, +Doom++++++,-13, +Doom+++++,-8, +Doom++++,-6, +Doom+++,-4, +Doom++,-3, +Doom+,-2, +Doom,-1, +Summon Boars,-18, +Skulk,-1, +Summon Basilisks,-32, +Growing HP,-6, +Monster +2,-17, +Monster +1,-9, +Monster Row +2,-13, +Monster Row +1,-7, +Monster Column +2,-9, +Monster Column +1,-5, +Final Boss Curse,-2, +1-10 curses,-7, +15-16 curses,-2, +De-level every other,-12, +De-level top three,-12, +De-level top and bottom,-8, +Skip rewards 11-19,-15, +Skip rewards 18-19,-3, +Skip rewards 5,-3, +Boss Spirits,-15, +Reanimated Bosses,-7, +Growing HP++,-18, +Growing HP+,-12, +Curse of Horus,-13, +Summon Suduls,-14, +Single Burst,-2, +Summon Warchiefs,-25, +Fourth death,-4, +Summon Wizz,-23, +3rd turn Slimers,-7, +-3 Max Mana,-2, +Stone Monsters,-4, +3rd turn Alphas,-8, +Mundane,-3, +Summon Ghosts,-23, +Skulk++,-3, +3rd turn Caw Eggs,-4, +A,-1, +XYZ,-1, +Boss Armour,-1, +Spiky,-1, +Single Spells,-5, +Slow Spells+++,-4, +Slow Spells++,-3, +Slow Spells+,-2, +Bottom 1 hp,-3, +Summon Ogres,-27, +Bottom Poison++,-3, +Summon Crones,-19, +3rd turn Dragon Eggs,-6, diff --git a/display_curse/display_curse.go b/display_curse/display_curse.go index 03eb003..a6095e5 100644 --- a/display_curse/display_curse.go +++ b/display_curse/display_curse.go @@ -1,18 +1,79 @@ package main import ( + _ "embed" + "encoding/csv" "encoding/json" "encoding/xml" "flag" "fmt" - "io/ioutil" + "io" + "log" "os" "path/filepath" "regexp" + "strconv" "strings" "time" ) +//go:embed curse.csv +var curseCSV string + +//go:embed tweak.csv +var tweakCSV string + +//go:embed blessing.csv +var blessingCSV string + +type Modifier struct { + Name string + Tier int +} + +func loadModifier(reader io.Reader) ([]Modifier, error) { + var mods []Modifier + r := csv.NewReader(reader) + for { + record, err := r.Read() + if err == io.EOF { + break + } + if err != nil { + return nil, err + } + tier, err := strconv.Atoi(record[1]) + if err != nil { + return nil, err + } + mods = append(mods, Modifier{Name: normalizeName(record[0]), Tier: tier}) + } + return mods, nil +} + +func LoadModifiers() ([]Modifier, error) { + var modifiers []Modifier + curses, err := loadModifier(strings.NewReader(curseCSV)) + if err != nil { + return nil, err + } + modifiers = append(modifiers, curses...) + + tweaks, err := loadModifier(strings.NewReader(tweakCSV)) + if err != nil { + return nil, err + } + modifiers = append(modifiers, tweaks...) + + blessings, err := loadModifier(strings.NewReader(blessingCSV)) + if err != nil { + return nil, err + } + modifiers = append(modifiers, blessings...) + + return modifiers, nil +} + type FileWatcher struct { ts int64 path string @@ -25,6 +86,10 @@ func NewFileWatcher(path string) *FileWatcher { } } +func normalizeName(name string) string { + return regexp.MustCompile(`\[\w+]`).ReplaceAllString(name, "") +} + func (fw *FileWatcher) updated() bool { stat, err := os.Stat(fw.path) if err != nil { @@ -58,15 +123,15 @@ type Entry struct { Value string `xml:",innerxml"` } -type CursesData struct { - D Curses `json:"d"` +type Data struct { + D Modifiers `json:"d"` } -type Curses struct { +type Modifiers struct { M []string `json:"m"` } -func writeCurses(file string, out_file string, gamemode string) { +func writeCurses(file string, out_file string, gamemode string, modifierTiers map[string]int) { xmlFile, err := os.Open(file) if err != nil { fmt.Println(err) @@ -74,7 +139,7 @@ func writeCurses(file string, out_file string, gamemode string) { } defer xmlFile.Close() - byteValue, err := ioutil.ReadAll(xmlFile) + byteValue, err := io.ReadAll(xmlFile) if err != nil { fmt.Println(err) return @@ -87,20 +152,26 @@ func writeCurses(file string, out_file string, gamemode string) { return } - var curses []string + var modifiers []string for _, entry := range prefs.Entries { if entry.Key == gamemode { - var data CursesData + var data Data json.Unmarshal([]byte(entry.Value), &data) - for _, curse := range data.D.M { - curses = append(curses, regexp.MustCompile(`\[\w+\]`).ReplaceAllString(curse, "")) + for _, modifier := range data.D.M { + modifier = normalizeName(modifier) + tier, ok := modifierTiers[modifier] + if ok { + modifiers = append(modifiers, fmt.Sprintf("[%d] %s", tier, modifier)) + } else { + modifiers = append(modifiers, modifier) + } } break } } - out := strings.Join(curses, "\n") - err = ioutil.WriteFile(out_file, []byte(out), os.ModePerm) + out := strings.Join(modifiers, "\n") + err = os.WriteFile(out_file, []byte(out), os.ModePerm) if err != nil { fmt.Println(err) return @@ -115,9 +186,19 @@ func main() { if *output == "" { fmt.Println("Output path must be specified") - return + os.Exit(1) + } + + modifiers, err := LoadModifiers() + if err != nil { + log.Fatal(err) + } + + modifierTiers := make(map[string]int) + for _, mod := range modifiers { + modifierTiers[mod.Name] = mod.Tier } watcher := NewFileWatcher(*input) - watcher.watch(func() { writeCurses(*input, *output, *gamemode) }) + watcher.watch(func() { writeCurses(*input, *output, *gamemode, modifierTiers) }) } diff --git a/display_curse/tweak.csv b/display_curse/tweak.csv new file mode 100644 index 0000000..2fa1644 --- /dev/null +++ b/display_curse/tweak.csv @@ -0,0 +1,14 @@ +Topsy Turvy,0, +Monster +1 Wands,0, +Small Sacrifice,0, +Huge Plague,0, +Loan,0, +Specialist,0, +Tweaked Monsters,0, +Toxic Fog,0, +Mana Flux,0, +Keep Rolling,0, +-2 hp to [b]all[b],0, ++2 hp to [b]all[b],0, +Power up,0, +Good Trade,0,