Seifert69 / DikuMUD3

DikuMUD III using HTML and websockets.
GNU Lesser General Public License v2.1
194 stars 49 forks source link

File Improvement: spells.dat #131

Open Goldbishop opened 3 years ago

Goldbishop commented 3 years ago

Stats: code file: src\spell_parser.cpp header file: src\db.h data file: etc\spells.dat

For in-game object data creation, these should be standardized into a delimited file format and imported into a STRUCT. Once imported, save into a Spell Stack for index referencing; effectively SpellInfo[idx] = SPELL_STRUCT

Race values should be bit-masked, so instead of

race human  = 0
race elf  = 0
race dwarf  = 0
race halfling  = 0
race gnome  = 0
race half-orc  = 0
race half-ogre  = 0
race half-elf  = 0
race brownie  = 0
race groll  = 0
race darkelf  = 0

you would end up with:

enum RACE{
  HUMAN     = 0x0001, // 000000000001
  ELF       = 0x0002, // 000000000010
  DWARF     = 0x0004, // 000000000100
  HALFLING  = 0x0008, // 000000001000
  GNOME     = 0x0016, // 000000010000
  HALFORC   = 0x0032, // 000000100000
  HALFOGRE  = 0x0064, // 000001000000
  HALFELF   = 0x0128, // 000010000000
  BROWNIE   = 0x0256, // 000100000000
  GROLL     = 0x0512, // 001000000000
  DARKELF   = 0x1024, // 010000000000
  // ALWAYS KEEP LAST, increment as necessary
  UNKNOWN   = 0x2048  // 100000000000
}

Existing Example:

index  = 3
name  =  detection sphere
realm  = 1
sphere  = 0
auto train  = 0
minpos  = 0
mana  = 0
turns  = 0
targets  = 0
mediums  = 0
check  = 0
offensive  = 0
fumble  = 0
race human  = 0
race elf  = 0
race dwarf  = 0
race halfling  = 0
race gnome  = 0
race half-orc  = 0
race half-ogre  = 0
race half-elf  = 0
race brownie  = 0
race groll  = 0
race darkelf  = 0
attack clothes  =  90  0 50
attack sleather  =  90  0 50
attack hleather  =  90  0 50
attack chain  =  90  0 50
attack plate  =  90  0 50 

Proposed Result

# IDX~Name~Realm~Sphere~Train~MinPos~Mana~Turns~Targets~Mediums~Check~Offensive~Fumble~Race~AtkCloth~AtkSLeather~AtkHLeather~AtkChain~AtkPlate!
3~detection~1~0~0~0~0~0~0~0~0~0~0~00000000000~90*0*50~90*0*50~90*0*50~90*0*50~90*0*50!
chrisspanton commented 3 years ago

Hey @Goldbishop - thanks for submitting the issue! I dont disagree, its a good approach.

If you haven't already, please dont hesitate to fork the repo, build an environment, and make the PR once tested.

Seifert69 commented 3 years ago

Having the numeric value for race is important and is used in many places. There are many humanoid races that are not player races too.

The data file is already read into struct(s). Not sure why you want a third data file format when there is already code that parses the current format?

The preprocessor from def to dat is unavoidable. It's the C preprocessor changing macros to values.

I might not fully understand your suggestion :-))

On Tue, Dec 8, 2020, 17:48 John Wood notifications@github.com wrote:

Stats: code file: src\spell_parser.cpp header file: src\db.h data file: etc\spells.dat

For in-game object data creation, these should be standardized into a delimited file format and imported into a STRUCT. Once imported, save into a Spell Stack for index referencing; effectively SpellInfo[idx] = SPELL_STRUCT

Race values should be bit-masked, so instead of

race human = 0 race elf = 0 race dwarf = 0 race halfling = 0 race gnome = 0 race half-orc = 0 race half-ogre = 0 race half-elf = 0 race brownie = 0 race groll = 0 race darkelf = 0

you would end up with:

enum RACE{ HUMAN = 0x0001, // 000000000001 ELF = 0x0002, // 000000000010 DWARF = 0x0004, // 000000000100 HALFLING = 0x0008, // 000000001000 GNOME = 0x0016, // 000000010000 HALFORC = 0x0032, // 000000100000 HALFOGRE = 0x0064, // 000001000000 HALFELF = 0x0128, // 000010000000 BROWNIE = 0x0256, // 000100000000 GROLL = 0x0512, // 001000000000 DARKELF = 0x1024, // 010000000000 // ALWAYS KEEP LAST, increment as necessary UNKNOWN = 0x2048 // 100000000000 }

Existing Example:

index = 3 name = detection sphere realm = 1 sphere = 0 auto train = 0 minpos = 0 mana = 0 turns = 0 targets = 0 mediums = 0 check = 0 offensive = 0 fumble = 0 race human = 0 race elf = 0 race dwarf = 0 race halfling = 0 race gnome = 0 race half-orc = 0 race half-ogre = 0 race half-elf = 0 race brownie = 0 race groll = 0 race darkelf = 0 attack clothes = 90 0 50 attack sleather = 90 0 50 attack hleather = 90 0 50 attack chain = 90 0 50 attack plate = 90 0 50

Proposed Result

IDX~Name~Realm~Sphere~Train~MinPos~Mana~Turns~Targets~Mediums~Check~Offensive~Fumble~Race~AtkCloth~AtkSLeather~AtkHLeather~AtkChain~AtkPlate!

3~detection~1~0~0~0~0~0~0~0~0~0~0~00000000000~90050~90050~90050~90050~90050!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Seifert69/DikuMUD3/issues/131, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOOOMXRNVNCWQ425ENVP5NDST3JOHANCNFSM4USZLOZQ .