[Code Cleanup] Race constants refactor (#3782)

* [Code Cleanup] Race constants refactor

* Update races.h
This commit is contained in:
Chris Miles 2023-12-22 21:34:55 -06:00 committed by GitHub
parent 556af8c5e9
commit 4fa9e1d66f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 2084 additions and 2491 deletions

View File

@ -96,12 +96,12 @@ bool IsOfEqualRace(int r1, int r2)
// TODO: add more values // TODO: add more values
switch (r1) { switch (r1) {
case DARK_ELF: case DARK_ELF:
if (r2 == RACE_NERIAK_CITIZEN_77) { if (r2 == Race::NeriakCitizen) {
return true; return true;
} }
break; break;
case BARBARIAN: case BARBARIAN:
if (r2 == RACE_HALAS_CITIZEN_90) { if (r2 == Race::HalasCitizen) {
return true; return true;
} }
} }

View File

@ -132,7 +132,7 @@ namespace EQ
// Swap items in inventory // Swap items in inventory
enum SwapItemFailState : int8 { swapInvalid = -1, swapPass = 0, swapNotAllowed, swapNullData, swapRaceClass, swapDeity, swapLevel }; enum SwapItemFailState : int8 { swapInvalid = -1, swapPass = 0, swapNotAllowed, swapNullData, swapRaceClass, swapDeity, swapLevel };
bool SwapItem(int16 source_slot, int16 destination_slot, SwapItemFailState& fail_state, uint16 race_id = RACE_DOUG_0, uint8 class_id = Class::None, uint16 deity_id = deity::DeityType::DeityUnknown, uint8 level = 0); bool SwapItem(int16 source_slot, int16 destination_slot, SwapItemFailState& fail_state, uint16 race_id = Race::Doug, uint8 class_id = Class::None, uint16 deity_id = deity::DeityType::DeityUnknown, uint8 level = 0);
// Remove item from inventory // Remove item from inventory
bool DeleteItem(int16 slot_id, int16 quantity = 0); bool DeleteItem(int16 slot_id, int16 quantity = 0);

View File

@ -1273,7 +1273,7 @@ int EQ::ItemInstance::GetItemBaneDamageBody(bool augments) const
int EQ::ItemInstance::GetItemBaneDamageRace(bool augments) const int EQ::ItemInstance::GetItemBaneDamageRace(bool augments) const
{ {
int race = RACE_DOUG_0; int race = Race::Doug;
const auto item = GetItem(); const auto item = GetItem();
if (item) { if (item) {
race = item->BaneDmgRace; race = item->BaneDmgRace;

View File

@ -3868,8 +3868,8 @@ namespace RoF
} }
float SpawnSize = emu->size; float SpawnSize = emu->size;
if (!((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) || if (!((emu->NPC == 0) || (emu->race <= Race::Gnome) || (emu->race == Race::Iksar) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522)) (emu->race == Race::VahShir) || (emu->race == Race::Froglok2) || (emu->race == Race::Drakkin))
) )
{ {
PacketSize += 60; PacketSize += 60;
@ -4002,8 +4002,8 @@ namespace RoF
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); // unknown18 VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); // unknown18
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); // unknown19 VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); // unknown19
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) || if ((emu->NPC == 0) || (emu->race <= Race::Gnome) || (emu->race == Race::Iksar) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522) (emu->race == Race::VahShir) || (emu->race == Race::Froglok2) || (emu->race == Race::Drakkin)
) )
{ {
for (k = EQ::textures::textureBegin; k < EQ::textures::materialCount; ++k) for (k = EQ::textures::textureBegin; k < EQ::textures::materialCount; ++k)

View File

@ -4007,8 +4007,8 @@ namespace RoF2
} }
float SpawnSize = emu->size; float SpawnSize = emu->size;
if (!((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) || if (!((emu->NPC == 0) || (emu->race <= Race::Gnome) || (emu->race == Race::Iksar) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522)) (emu->race == Race::VahShir) || (emu->race == Race::Froglok2) || (emu->race == Race::Drakkin))
) )
{ {
PacketSize += 60; PacketSize += 60;
@ -4212,8 +4212,8 @@ namespace RoF2
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); // These do something with OP_WeaponEquip1 VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); // These do something with OP_WeaponEquip1
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); // ^ VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); // ^
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) || if ((emu->NPC == 0) || (emu->race <= Race::Gnome) || (emu->race == Race::Iksar) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522) (emu->race == Race::VahShir) || (emu->race == Race::Froglok2) || (emu->race == Race::Drakkin)
) )
{ {
for (k = EQ::textures::textureBegin; k < EQ::textures::materialCount; ++k) for (k = EQ::textures::textureBegin; k < EQ::textures::materialCount; ++k)

View File

@ -2507,8 +2507,8 @@ namespace SoD
} }
float SpawnSize = emu->size; float SpawnSize = emu->size;
if (!((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) || if (!((emu->NPC == 0) || (emu->race <= Race::Gnome) || (emu->race == Race::Iksar) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522)) (emu->race == Race::VahShir) || (emu->race == Race::Froglok2) || (emu->race == Race::Drakkin))
) )
{ {
PacketSize -= (sizeof(structs::Texture_Struct) * EQ::textures::materialCount); PacketSize -= (sizeof(structs::Texture_Struct) * EQ::textures::materialCount);
@ -2706,8 +2706,8 @@ namespace SoD
Buffer += sizeof(structs::Spawn_Struct_Position); Buffer += sizeof(structs::Spawn_Struct_Position);
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) || if ((emu->NPC == 0) || (emu->race <= Race::Gnome) || (emu->race == Race::Iksar) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522) (emu->race == Race::VahShir) || (emu->race == Race::Froglok2) || (emu->race == Race::Drakkin)
) )
{ {
for (k = EQ::textures::textureBegin; k < EQ::textures::materialCount; ++k) for (k = EQ::textures::textureBegin; k < EQ::textures::materialCount; ++k)
@ -2733,8 +2733,8 @@ namespace SoD
} }
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) || if ((emu->NPC == 0) || (emu->race <= Race::Gnome) || (emu->race == Race::Iksar) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522) (emu->race == Race::VahShir) || (emu->race == Race::Froglok2) || (emu->race == Race::Drakkin)
) )
{ {
structs::Texture_Struct *Equipment = (structs::Texture_Struct *)Buffer; structs::Texture_Struct *Equipment = (structs::Texture_Struct *)Buffer;

View File

@ -2779,8 +2779,8 @@ namespace UF
} }
float SpawnSize = emu->size; float SpawnSize = emu->size;
if (!((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) || if (!((emu->NPC == 0) || (emu->race <= Race::Gnome) || (emu->race == Race::Iksar) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522)) (emu->race == Race::VahShir) || (emu->race == Race::Froglok2) || (emu->race == Race::Drakkin))
) )
{ {
PacketSize -= (sizeof(structs::Texture_Struct) * EQ::textures::materialCount); PacketSize -= (sizeof(structs::Texture_Struct) * EQ::textures::materialCount);
@ -2982,8 +2982,8 @@ namespace UF
Buffer += sizeof(structs::Spawn_Struct_Position); Buffer += sizeof(structs::Spawn_Struct_Position);
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) || if ((emu->NPC == 0) || (emu->race <= Race::Gnome) || (emu->race == Race::Iksar) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522) (emu->race == Race::VahShir) || (emu->race == Race::Froglok2) || (emu->race == Race::Drakkin)
) )
{ {
for (k = EQ::textures::textureBegin; k < EQ::textures::materialCount; ++k) for (k = EQ::textures::textureBegin; k < EQ::textures::materialCount; ++k)
@ -3018,8 +3018,8 @@ namespace UF
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
} }
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) || if ((emu->NPC == 0) || (emu->race <= Race::Gnome) || (emu->race == Race::Iksar) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522) (emu->race == Race::VahShir) || (emu->race == Race::Froglok2) || (emu->race == Race::Drakkin)
) )
{ {
structs::Texture_Struct *Equipment = (structs::Texture_Struct *)Buffer; structs::Texture_Struct *Equipment = (structs::Texture_Struct *)Buffer;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
module constantconvert
go 1.18
require (
github.com/gammazero/deque v0.2.0 // indirect
github.com/gammazero/workerpool v1.1.3 // indirect
)

View File

@ -0,0 +1,4 @@
github.com/gammazero/deque v0.2.0 h1:SkieyNB4bg2/uZZLxvya0Pq6diUlwx7m2TeT7GAIWaA=
github.com/gammazero/deque v0.2.0/go.mod h1:LFroj8x4cMYCukHJDbxFCkT+r9AndaJnFMuZDV34tuU=
github.com/gammazero/workerpool v1.1.3 h1:WixN4xzukFoN0XSeXF6puqEqFTl2mECI9S6W44HWy9Q=
github.com/gammazero/workerpool v1.1.3/go.mod h1:wPjyBLDbyKnUn2XwwyD3EEwo9dHutia9/fwNmSHWACc=

View File

@ -0,0 +1,313 @@
package main
import (
"fmt"
"github.com/gammazero/workerpool"
"io/fs"
"log"
"os"
"os/exec"
"path/filepath"
"runtime"
"strconv"
"strings"
)
func main() {
loadDefinitions()
// get processor count
wp := workerpool.New(runtime.NumCPU())
// loop through all files in current dir that are cpp files or h files
err := filepath.WalkDir("../../", func(path string, d fs.DirEntry, err error) error {
if d.IsDir() {
return nil
}
if !strings.Contains(path, ".cpp") && !strings.Contains(path, ".h") {
return nil
}
// if file ends with ".o" skip it
if strings.HasSuffix(path, ".o") {
return nil
}
var ignoreFiles = []string{
"submodules", "/libs", "utils/", "races.h", "backward", "database_update_manifest.cpp", "zonedb.h",
}
ignore := false
for _, ignoreString := range ignoreFiles {
if strings.Contains(path, ignoreString) {
ignore = true
break
}
}
if ignore {
return nil
}
wp.Submit(func() {
// open file for reading
// get file contents
contents, err := os.ReadFile(path)
if err != nil {
log.Fatalf("impossible to read file: %s", err)
}
content := string(contents)
wroteChanges := false
var newLines []string
for _, line := range strings.Split(content, "\n") {
newLine := line
// loop through oldDefs and see if any of them are in contents
for key, value := range oldDefs {
// combine all of the above contains into a slice
// loop through slice and if any of them are in line, continue
var ignoreMatches = []string{
"#define ", "MALE", "FEMALE", "_BIT", "LANG_",
}
ignore := false
for _, ignoreString := range ignoreMatches {
if strings.Contains(newLine, ignoreString) && !strings.Contains(newLine, "NPC_") {
ignore = true
break
}
}
if ignore {
continue
}
// below we hackishly use a series of specific string contains to avoid
// making blind and wrong replacements
// but hey - at least its 100% accurate :)
if strings.Contains(line, "case "+key+":") {
for key2, value2 := range newDefs {
if value == value2 {
newLine = strings.ReplaceAll(newLine, " "+key+":", " "+key2+":")
wroteChanges = true
break
}
}
}
if strings.Contains(line, "\t"+key) {
for key2, value2 := range newDefs {
if value == value2 {
newLine = strings.ReplaceAll(newLine, "\t"+key, "\t"+key2)
wroteChanges = true
break
}
}
}
if strings.Contains(line, key+",") {
for key2, value2 := range newDefs {
if value == value2 {
newLine = strings.ReplaceAll(newLine, key+",", key2+",")
wroteChanges = true
break
}
}
}
if strings.Contains(line, ", "+key) {
for key2, value2 := range newDefs {
if value == value2 {
newLine = strings.ReplaceAll(newLine, ", "+key, ", "+key2)
wroteChanges = true
break
}
}
}
if strings.Contains(line, "= "+key+" ") {
for key2, value2 := range newDefs {
if value == value2 {
newLine = strings.ReplaceAll(newLine, "= "+key+" ", "= "+key2+" ")
wroteChanges = true
break
}
}
}
if strings.Contains(line, "= "+key+")") {
for key2, value2 := range newDefs {
if value == value2 {
newLine = strings.ReplaceAll(newLine, "= "+key+")", "= "+key2+")")
wroteChanges = true
break
}
}
}
if strings.Contains(line, "= "+key+";") {
for key2, value2 := range newDefs {
if value == value2 {
newLine = strings.ReplaceAll(newLine, "= "+key+";", "= "+key2+";")
wroteChanges = true
break
}
}
}
if strings.Contains(line, "= "+key+" ||") {
for key2, value2 := range newDefs {
if value == value2 {
newLine = strings.ReplaceAll(newLine, "= "+key+" ||", "= "+key2+" ||")
wroteChanges = true
break
}
}
}
// match cases where our match is on the last line and last column
// we need to be exact in the last column and not do a partial because we can
// accidentally rename say OGRE to OGRE2 mistakenly
if strings.Contains(line, key) {
columns := strings.Split(line, " ")
// get the last column
lastColumn := strings.TrimSpace(columns[len(columns)-1])
if lastColumn == key {
for key2, value2 := range newDefs {
if value == value2 {
newLine = strings.ReplaceAll(newLine, lastColumn, key2)
wroteChanges = true
break
}
}
}
}
//if strings.Contains(line, "race == "+key) {
// for key2, value2 := range newDefs {
// if value == value2 {
// newLine = strings.ReplaceAll(newLine, "race == "+key, "race == "+key2)
// wroteChanges = true
// break
// }
// }
//}
}
newLines = append(newLines, newLine)
}
// write contents back to file
if wroteChanges {
fmt.Printf("wrote changes to file [%v]\n", path)
err = os.WriteFile(path, []byte(strings.Join(newLines, "\n")), 0644)
if err != nil {
log.Fatalf("impossible to write file: %s", err)
}
}
return
})
return nil
})
if err != nil {
log.Fatalf("impossible to walk directories: %s", err)
}
wp.StopWait()
}
var newDefs = make(map[string]int)
var oldDefs = make(map[string]int)
func loadDefinitions() {
// git show master:common/races.h
cmd := exec.Command("git", "show", "master:common/races.h")
out, err := cmd.Output()
if err != nil {
println(err.Error())
return
}
// load into a string -> int map
for _, line := range strings.Split(string(out), "\n") {
if strings.Contains(line, "#define ") {
if len(strings.Split(line, " ")) <= 2 {
continue
}
// ignore
// #define MALE 0
// #define FEMALE 1
// #define NEUTER 2
if strings.Contains(line, "#define MALE") {
continue
}
if strings.Contains(line, "#define FEMALE") {
continue
}
if strings.Contains(line, "#define NEUTER") {
continue
}
// load "#define RACE_FLYING_CARPET_720 720" into map
key := strings.Split(line, " ")[1]
value := strings.Split(line, " ")[2]
value = strings.ReplaceAll(value, "//", "")
value = strings.TrimSpace(value)
//fmt.Printf("key [%v] value [%v]\n", key, value)
if !strings.HasPrefix(key, "RACE_") && !strings.HasPrefix(key, "RT_") {
continue
}
// convert value to int
intValue, err := strconv.Atoi(value)
if err != nil {
println(err.Error())
return
}
oldDefs[key] = intValue
fmt.Printf("oldDefs key [%v] value [%v]\n", key, intValue)
}
}
// cleanup/races_cpp_h
cmd = exec.Command("git", "show", "cleanup/races_cpp_h:common/races.h")
out, err = cmd.Output()
if err != nil {
println(err.Error())
return
}
// load into a string -> int map
for _, line := range strings.Split(string(out), "\n") {
if strings.Contains(line, "constexpr uint16") {
if len(strings.Split(line, " ")) <= 2 {
continue
}
// remove all extra spaces in between characters in line
line = strings.Join(strings.Fields(line), " ")
// load " constexpr uint16 Doug = 0;" into map
key := strings.Split(line, " ")[2]
value := strings.Split(line, " ")[4]
value = strings.ReplaceAll(value, "//", "")
value = strings.ReplaceAll(value, ";", "")
value = strings.TrimSpace(value)
// convert value to int
intValue, err := strconv.Atoi(value)
if err != nil {
println(err.Error())
return
}
mapKey := "Race::" + key
newDefs[mapKey] = intValue
fmt.Printf("newDefs key [%v] value [%v]\n", mapKey, value)
}
}
}

View File

@ -983,14 +983,14 @@ bool Mob::CombatRange(Mob* other, float fixed_size_mod, bool aeRampage, ExtraAtt
float size_mod = GetSize(); float size_mod = GetSize();
float other_size_mod = other->GetSize(); float other_size_mod = other->GetSize();
if (GetRace() == RACE_LAVA_DRAGON_49 || GetRace() == RACE_WURM_158 || GetRace() == RACE_GHOST_DRAGON_196) { //For races with a fixed size if (GetRace() == Race::LavaDragon || GetRace() == Race::Wurm || GetRace() == Race::GhostDragon) { //For races with a fixed size
size_mod = 60.0f; size_mod = 60.0f;
} }
else if (size_mod < 6.0) { else if (size_mod < 6.0) {
size_mod = 8.0f; size_mod = 8.0f;
} }
if (other->GetRace() == RACE_LAVA_DRAGON_49 || other->GetRace() == RACE_WURM_158 || other->GetRace() == RACE_GHOST_DRAGON_196) { //For races with a fixed size if (other->GetRace() == Race::LavaDragon || other->GetRace() == Race::Wurm || other->GetRace() == Race::GhostDragon) { //For races with a fixed size
other_size_mod = 60.0f; other_size_mod = 60.0f;
} }
else if (other_size_mod < 6.0) { else if (other_size_mod < 6.0) {
@ -1011,11 +1011,11 @@ bool Mob::CombatRange(Mob* other, float fixed_size_mod, bool aeRampage, ExtraAtt
size_mod *= size_mod * 4; size_mod *= size_mod * 4;
} }
if (other->GetRace() == RACE_VELIOUS_DRAGON_184) // Lord Vyemm and other velious dragons if (other->GetRace() == Race::VeliousDragon) // Lord Vyemm and other velious dragons
{ {
size_mod *= 1.75; size_mod *= 1.75;
} }
if (other->GetRace() == RACE_DRAGON_SKELETON_122) // Dracoliche in Fear. Skeletal Dragon if (other->GetRace() == Race::DragonSkeleton) // Dracoliche in Fear. Skeletal Dragon
{ {
size_mod *= 2.25; size_mod *= 2.25;
} }

View File

@ -4087,7 +4087,7 @@ void Mob::CommonDamage(Mob* attacker, int64 &damage, const uint16 spell_id, cons
IsPlayerRace(GetBaseRace()) && IsPlayerRace(GetBaseRace()) &&
RuleI(Combat, FrontalStunImmunityRaces) & GetPlayerRaceBit(GetBaseRace()) RuleI(Combat, FrontalStunImmunityRaces) & GetPlayerRaceBit(GetBaseRace())
) || ) ||
GetBaseRace() == RACE_OGGOK_CITIZEN_93 GetBaseRace() == Race::OggokCitizen
) { ) {
is_immune_to_frontal_stun = true; is_immune_to_frontal_stun = true;
} }
@ -4107,7 +4107,7 @@ void Mob::CommonDamage(Mob* attacker, int64 &damage, const uint16 spell_id, cons
IsPlayerRace(GetBaseRace()) && IsPlayerRace(GetBaseRace()) &&
RuleI(Combat, FrontalStunImmunityRaces) & GetPlayerRaceBit(GetBaseRace()) RuleI(Combat, FrontalStunImmunityRaces) & GetPlayerRaceBit(GetBaseRace())
) || ) ||
GetBaseRace() == RACE_OGGOK_CITIZEN_93 GetBaseRace() == Race::OggokCitizen
) )
) { ) {
is_immune_to_frontal_stun = true; is_immune_to_frontal_stun = true;

View File

@ -2681,7 +2681,7 @@ void Bot::CalcMeleeDistances(const Mob* tar, const EQ::ItemInstance* const& p_it
float other_size_mod = tar->GetSize(); float other_size_mod = tar->GetSize();
// For races with a fixed size // For races with a fixed size
if (GetRace() == RT_DRAGON || GetRace() == RT_WURM || GetRace() == RT_DRAGON_7) { if (GetRace() == Race::LavaDragon || GetRace() == Race::Wurm || GetRace() == Race::GhostDragon) {
// size_mod = 60.0f; // size_mod = 60.0f;
} }
@ -2690,7 +2690,7 @@ void Bot::CalcMeleeDistances(const Mob* tar, const EQ::ItemInstance* const& p_it
} }
// For races with a fixed size // For races with a fixed size
if (tar->GetRace() == RT_DRAGON || tar->GetRace() == RT_WURM || tar->GetRace() == RT_DRAGON_7) { if (tar->GetRace() == Race::LavaDragon || tar->GetRace() == Race::Wurm || tar->GetRace() == Race::GhostDragon) {
other_size_mod = 60.0f; other_size_mod = 60.0f;
} }

View File

@ -5913,11 +5913,11 @@ void bot_command_view_combos(Client *c, const Seperator *sep)
}; };
const uint16 race_values[17] = { const uint16 race_values[17] = {
RACE_DOUG_0, Race::Doug,
RACE_HUMAN_1, RACE_BARBARIAN_2, RACE_ERUDITE_3, RACE_WOOD_ELF_4, Race::Human, Race::Barbarian, Race::Erudite, Race::WoodElf,
RACE_HIGH_ELF_5, RACE_DARK_ELF_6, RACE_HALF_ELF_7, RACE_DWARF_8, Race::HighElf, Race::DarkElf, Race::HalfElf, Race::Dwarf,
RACE_TROLL_9, RACE_OGRE_10, RACE_HALFLING_11, RACE_GNOME_12, Race::Troll, Race::Ogre, Race::Halfling, Race::Gnome,
RACE_IKSAR_128, RACE_VAH_SHIR_130, RACE_FROGLOK_330, RACE_DRAKKIN_522 Race::Iksar, Race::VahShir, Race::Froglok2, Race::Drakkin
}; };
if (helper_command_alias_fail(c, "bot_command_view_combos", sep->arg[0], "viewcombos")) { if (helper_command_alias_fail(c, "bot_command_view_combos", sep->arg[0], "viewcombos")) {
@ -6028,11 +6028,11 @@ void bot_subcommand_bot_create(Client *c, const Seperator *sep)
}; };
const uint16 race_values[17] = { const uint16 race_values[17] = {
RACE_DOUG_0, Race::Doug,
RACE_HUMAN_1, RACE_BARBARIAN_2, RACE_ERUDITE_3, RACE_WOOD_ELF_4, Race::Human, Race::Barbarian, Race::Erudite, Race::WoodElf,
RACE_HIGH_ELF_5, RACE_DARK_ELF_6, RACE_HALF_ELF_7, RACE_DWARF_8, Race::HighElf, Race::DarkElf, Race::HalfElf, Race::Dwarf,
RACE_TROLL_9, RACE_OGRE_10, RACE_HALFLING_11, RACE_GNOME_12, Race::Troll, Race::Ogre, Race::Halfling, Race::Gnome,
RACE_IKSAR_128, RACE_VAH_SHIR_130, RACE_FROGLOK_330, RACE_DRAKKIN_522 Race::Iksar, Race::VahShir, Race::Froglok2, Race::Drakkin
}; };
const std::string gender_substrs[2] = { const std::string gender_substrs[2] = {

View File

@ -8632,8 +8632,8 @@ void Client::InitInnates()
m_pp.InnateSkills[InnateInspect] = InnateEnabled; m_pp.InnateSkills[InnateInspect] = InnateEnabled;
m_pp.InnateSkills[InnateOpen] = InnateEnabled; m_pp.InnateSkills[InnateOpen] = InnateEnabled;
if (race >= RT_FROGLOK_3) { if (race >= Race::Froglok2) {
if (race == RT_SKELETON_2 || race == RT_FROGLOK_3) { if (race == Race::Skeleton2 || race == Race::Froglok2) {
m_pp.InnateSkills[InnateUltraVision] = InnateEnabled; m_pp.InnateSkills[InnateUltraVision] = InnateEnabled;
} else { } else {
m_pp.InnateSkills[InnateInfravision] = InnateEnabled; m_pp.InnateSkills[InnateInfravision] = InnateEnabled;
@ -8641,75 +8641,75 @@ void Client::InitInnates()
} }
switch (race) { switch (race) {
case RT_BARBARIAN: case Race::Barbarian:
case RT_BARBARIAN_2: case Race::HalasCitizen:
m_pp.InnateSkills[InnateSlam] = InnateEnabled; m_pp.InnateSkills[InnateSlam] = InnateEnabled;
break; break;
case RT_ERUDITE: case Race::Erudite:
case RT_ERUDITE_2: case Race::EruditeCitizen:
m_pp.InnateSkills[InnateLore] = InnateEnabled; m_pp.InnateSkills[InnateLore] = InnateEnabled;
break; break;
case RT_WOOD_ELF: case Race::WoodElf:
case RT_GUARD_3: case Race::Fayguard:
m_pp.InnateSkills[InnateInfravision] = InnateEnabled; m_pp.InnateSkills[InnateInfravision] = InnateEnabled;
break; break;
case RT_GNOME: case Race::Gnome:
case RT_HIGH_ELF: case Race::HighElf:
case RT_GUARD_2: case Race::Felguard:
m_pp.InnateSkills[InnateInfravision] = InnateEnabled; m_pp.InnateSkills[InnateInfravision] = InnateEnabled;
m_pp.InnateSkills[InnateLore] = InnateEnabled; m_pp.InnateSkills[InnateLore] = InnateEnabled;
break; break;
case RT_TROLL: case Race::Troll:
case RT_TROLL_2: case Race::GrobbCitizen:
m_pp.InnateSkills[InnateRegen] = InnateEnabled; m_pp.InnateSkills[InnateRegen] = InnateEnabled;
m_pp.InnateSkills[InnateSlam] = InnateEnabled; m_pp.InnateSkills[InnateSlam] = InnateEnabled;
m_pp.InnateSkills[InnateInfravision] = InnateEnabled; m_pp.InnateSkills[InnateInfravision] = InnateEnabled;
break; break;
case RT_DWARF: case Race::Dwarf:
case RT_DWARF_2: case Race::KaladimCitizen:
m_pp.InnateSkills[InnateInfravision] = InnateEnabled; m_pp.InnateSkills[InnateInfravision] = InnateEnabled;
break; break;
case RT_OGRE: case Race::Ogre:
case RT_OGRE_2: case Race::OggokCitizen:
m_pp.InnateSkills[InnateInfravision] = InnateEnabled; m_pp.InnateSkills[InnateInfravision] = InnateEnabled;
m_pp.InnateSkills[InnateSlam] = InnateEnabled; m_pp.InnateSkills[InnateSlam] = InnateEnabled;
m_pp.InnateSkills[InnateNoBash] = InnateEnabled; m_pp.InnateSkills[InnateNoBash] = InnateEnabled;
m_pp.InnateSkills[InnateBashDoor] = InnateEnabled; m_pp.InnateSkills[InnateBashDoor] = InnateEnabled;
break; break;
case RT_HALFLING: case Race::Halfling:
case RT_HALFLING_2: case Race::RivervaleCitizen:
m_pp.InnateSkills[InnateInfravision] = InnateEnabled; m_pp.InnateSkills[InnateInfravision] = InnateEnabled;
break; break;
case RT_IKSAR: case Race::Iksar:
m_pp.InnateSkills[InnateRegen] = InnateEnabled; m_pp.InnateSkills[InnateRegen] = InnateEnabled;
m_pp.InnateSkills[InnateInfravision] = InnateEnabled; m_pp.InnateSkills[InnateInfravision] = InnateEnabled;
break; break;
case RT_VAH_SHIR: case Race::VahShir:
m_pp.InnateSkills[InnateInfravision] = InnateEnabled; m_pp.InnateSkills[InnateInfravision] = InnateEnabled;
break; break;
case RT_DARK_ELF: case Race::DarkElf:
case RT_DARK_ELF_2: case Race::NeriakCitizen:
case RT_VAMPIRE_2: case Race::ElfVampire:
case RT_FROGLOK_2: case Race::FroglokGhoul:
case RT_GHOST: case Race::Ghost:
case RT_GHOUL: case Race::Ghoul:
case RT_SKELETON: case Race::Skeleton:
case RT_VAMPIRE: case Race::Vampire:
case RT_WILL_O_WISP: case Race::Wisp:
case RT_ZOMBIE: case Race::Zombie:
case RT_SPECTRE: case Race::Spectre:
case RT_GHOST_2: case Race::DwarfGhost:
case RT_GHOST_3: case Race::EruditeGhost:
case RT_DRAGON_2: case Race::DragonSkeleton:
case RT_INNORUUK: case Race::Innoruuk:
m_pp.InnateSkills[InnateUltraVision] = InnateEnabled; m_pp.InnateSkills[InnateUltraVision] = InnateEnabled;
break; break;
case RT_HUMAN: case Race::Human:
case RT_GUARD: case Race::FreeportGuard:
case RT_BEGGAR: case Race::HumanBeggar:
case RT_HUMAN_2: case Race::HighpassCitizen:
case RT_HUMAN_3: case Race::QeynosCitizen:
case RT_FROGLOK_3: // client does froglok weird, but this should work out fine case Race::Froglok2: // client does froglok weird, but this should work out fine
break; break;
default: default:
m_pp.InnateSkills[InnateInfravision] = InnateEnabled; m_pp.InnateSkills[InnateInfravision] = InnateEnabled;

View File

@ -4920,7 +4920,7 @@ void EntityList::ZoneWho(Client *c, Who_All_Struct *Who)
FormatMSGID = 5023; // 5023 %T1[ANONYMOUS] %2 %3 %4 FormatMSGID = 5023; // 5023 %T1[ANONYMOUS] %2 %3 %4
uint32 PlayerClass = Class::None; uint32 PlayerClass = Class::None;
uint32 PlayerLevel = 0; uint32 PlayerLevel = 0;
uint32 PlayerRace = RACE_DOUG_0; uint32 PlayerRace = Race::Doug;
uint32 ZoneMSGID = 0xFFFFFFFF; uint32 ZoneMSGID = 0xFFFFFFFF;
if (ClientEntry->GetAnon()==0) { if (ClientEntry->GetAnon()==0) {
@ -5750,7 +5750,7 @@ void EntityList::DespawnGridNodes(int32 grid_id) {
Mob *mob = m.second; Mob *mob = m.second;
if ( if (
mob->IsNPC() && mob->IsNPC() &&
mob->GetRace() == RACE_NODE_2254 && mob->GetRace() == Race::Node &&
mob->EntityVariableExists("grid_id") && mob->EntityVariableExists("grid_id") &&
Strings::ToInt(mob->GetEntityVariable("grid_id")) == grid_id) Strings::ToInt(mob->GetEntityVariable("grid_id")) == grid_id)
{ {

View File

@ -5,7 +5,7 @@ void FindRace(Client *c, const Seperator *sep)
if (sep->IsNumber(2)) { if (sep->IsNumber(2)) {
const auto race_id = static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[2])); const auto race_id = static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[2]));
const std::string& race_name = GetRaceIDName(race_id); const std::string& race_name = GetRaceIDName(race_id);
if (EQ::ValueWithin(race_id, RACE_HUMAN_1, RACE_PEGASUS_732)) { if (EQ::ValueWithin(race_id, Race::Human, Race::Pegasus3)) {
c->Message( c->Message(
Chat::White, Chat::White,
fmt::format( fmt::format(
@ -41,7 +41,7 @@ void FindRace(Client *c, const Seperator *sep)
auto found_count = 0; auto found_count = 0;
for (uint16 race_id = RACE_HUMAN_1; race_id <= RACE_PEGASUS_732; race_id++) { for (uint16 race_id = Race::Human; race_id <= Race::Pegasus3; race_id++) {
std::string race_name = GetRaceIDName(race_id); std::string race_name = GetRaceIDName(race_id);
auto race_name_lower = Strings::ToLower(race_name); auto race_name_lower = Strings::ToLower(race_name);
if (!Strings::Contains(race_name_lower, search_criteria)) { if (!Strings::Contains(race_name_lower, search_criteria)) {

View File

@ -23,7 +23,7 @@ void SetRace(Client *c, const Seperator *sep)
const uint16 race_id = Strings::ToUnsignedInt(sep->arg[2]); const uint16 race_id = Strings::ToUnsignedInt(sep->arg[2]);
if ( if (
!EQ::ValueWithin(race_id, RACE_DOUG_0, RuleI(NPC, MaxRaceID)) && !EQ::ValueWithin(race_id, Race::Doug, RuleI(NPC, MaxRaceID)) &&
!EQ::ValueWithin(race_id, 2253, 2259) !EQ::ValueWithin(race_id, 2253, 2259)
) { ) {
c->Message( c->Message(

View File

@ -4,7 +4,7 @@ void ShowZonePoints(Client *c, const Seperator *sep)
{ {
for (const auto& m : entity_list.GetMobList()) { for (const auto& m : entity_list.GetMobList()) {
Mob* mob = m.second; Mob* mob = m.second;
if (mob->IsNPC() && mob->GetRace() == RACE_NODE_2254) { if (mob->IsNPC() && mob->GetRace() == Race::Node) {
mob->Depop(); mob->Depop();
} }
} }

View File

@ -3933,14 +3933,14 @@ float Merc::GetMaxMeleeRangeToTarget(Mob* target) {
float size_mod = GetSize(); float size_mod = GetSize();
float other_size_mod = target->GetSize(); float other_size_mod = target->GetSize();
if (GetRace() == RACE_LAVA_DRAGON_49 || GetRace() == RACE_WURM_158 || GetRace() == RACE_GHOST_DRAGON_196) //For races with a fixed size if (GetRace() == Race::LavaDragon || GetRace() == Race::Wurm || GetRace() == Race::GhostDragon) //For races with a fixed size
{ {
size_mod = 60.0f; size_mod = 60.0f;
} else if (size_mod < 6.0) { } else if (size_mod < 6.0) {
size_mod = 8.0f; size_mod = 8.0f;
} }
if (target->GetRace() == RACE_LAVA_DRAGON_49 || target->GetRace() == RACE_WURM_158 || target->GetRace() == RACE_GHOST_DRAGON_196) //For races with a fixed size if (target->GetRace() == Race::LavaDragon || target->GetRace() == Race::Wurm || target->GetRace() == Race::GhostDragon) //For races with a fixed size
{ {
other_size_mod = 60.0f; other_size_mod = 60.0f;
} else if (other_size_mod < 6.0) { } else if (other_size_mod < 6.0) {

View File

@ -2867,7 +2867,7 @@ void Mob::ShowStats(Client* c)
); );
// Drakkin Features // Drakkin Features
if (t->GetRace() == RACE_DRAKKIN_522) { if (t->GetRace() == Race::Drakkin) {
c->Message( c->Message(
Chat::White, Chat::White,
fmt::format( fmt::format(
@ -3526,7 +3526,7 @@ void Mob::GMMove(const glm::vec4 &position, bool save_guard_spot) {
void Mob::SendIllusionPacket(const AppearanceStruct& a) void Mob::SendIllusionPacket(const AppearanceStruct& a)
{ {
uint16 new_race = ( uint16 new_race = (
a.race_id != RACE_DOUG_0 ? a.race_id != Race::Doug ?
a.race_id : a.race_id :
(use_model ? use_model : GetBaseRace()) (use_model ? use_model : GetBaseRace())
); );
@ -3558,7 +3558,7 @@ void Mob::SendIllusionPacket(const AppearanceStruct& a)
uint32 new_drakkin_tattoo = a.drakkin_tattoo == UINT32_MAX ? GetDrakkinTattoo() : a.drakkin_tattoo; uint32 new_drakkin_tattoo = a.drakkin_tattoo == UINT32_MAX ? GetDrakkinTattoo() : a.drakkin_tattoo;
// Reset features to Base from the Player Profile // Reset features to Base from the Player Profile
if (IsClient() && a.race_id == RACE_DOUG_0) { if (IsClient() && a.race_id == Race::Doug) {
new_beard = CastToClient()->GetBaseBeard(); new_beard = CastToClient()->GetBaseBeard();
new_beard_color = CastToClient()->GetBaseBeardColor(); new_beard_color = CastToClient()->GetBaseBeardColor();
new_drakkin_details = CastToClient()->GetBaseDetails(); new_drakkin_details = CastToClient()->GetBaseDetails();
@ -3918,48 +3918,48 @@ uint16 Mob::GetFactionRace() {
uint8 Mob::GetDefaultGender(uint16 in_race, uint8 in_gender) { uint8 Mob::GetDefaultGender(uint16 in_race, uint8 in_gender) {
if ( if (
IsPlayerRace(in_race) || IsPlayerRace(in_race) ||
in_race == RACE_BROWNIE_15 || in_race == Race::Brownie ||
in_race == RACE_KERRAN_23 || in_race == Race::Kerran ||
in_race == RACE_LION_50 || in_race == Race::Lion ||
in_race == RACE_DRACNID_57 || in_race == Race::Drachnid ||
in_race == RACE_ZOMBIE_70 || in_race == Race::Zombie ||
in_race == RACE_QEYNOS_CITIZEN_71 || in_race == Race::QeynosCitizen ||
in_race == RACE_RIVERVALE_CITIZEN_81 || in_race == Race::RivervaleCitizen ||
in_race == RACE_HALAS_CITIZEN_90 || in_race == Race::HalasCitizen ||
in_race == RACE_GROBB_CITIZEN_92 || in_race == Race::GrobbCitizen ||
in_race == RACE_OGGOK_CITIZEN_93 || in_race == Race::OggokCitizen ||
in_race == RACE_KALADIM_CITIZEN_94 || in_race == Race::KaladimCitizen ||
in_race == RACE_ELF_VAMPIRE_98 || in_race == Race::ElfVampire ||
in_race == RACE_FELGUARD_106 || in_race == Race::Felguard ||
in_race == RACE_FAYGUARD_112 || in_race == Race::Fayguard ||
in_race == RACE_ERUDITE_GHOST_118 || in_race == Race::EruditeGhost ||
in_race == RACE_IKSAR_CITIZEN_139 || in_race == Race::IksarCitizen ||
in_race == RACE_SHADE_224 || in_race == Race::Shade ||
in_race == RACE_TROLL_CREW_MEMBER_331 || in_race == Race::TrollCrewMember ||
in_race == RACE_PIRATE_DECKHAND_332 || in_race == Race::PirateDeckhand ||
in_race == RACE_GNOME_PIRATE_338 || in_race == Race::GnomePirate ||
in_race == RACE_DARK_ELF_PIRATE_339 || in_race == Race::DarkElfPirate ||
in_race == RACE_OGRE_PIRATE_340 || in_race == Race::OgrePirate ||
in_race == RACE_HUMAN_PIRATE_341 || in_race == Race::HumanPirate ||
in_race == RACE_ERUDITE_PIRATE_342 || in_race == Race::EruditePirate ||
in_race == RACE_UNDEAD_PIRATE_344 || in_race == Race::TrollZombie ||
in_race == RACE_KNIGHT_OF_HATE_351 || in_race == Race::KnightOfHate ||
in_race == RACE_WARLOCK_OF_HATE_352 || in_race == Race::ArcanistOfHate ||
in_race == RACE_UNDEAD_VAMPIRE_359 || in_race == Race::UndeadVampire ||
in_race == RACE_VAMPIRE_360 || in_race == Race::Vampire3 ||
in_race == RACE_SAND_ELF_364 || in_race == Race::SandElf ||
in_race == RACE_TAELOSIAN_NATIVE_385 || in_race == Race::Nihil ||
in_race == RACE_TAELOSIAN_EVOKER_386 || in_race == Race::Trusik ||
in_race == RACE_DRACHNID_461 || in_race == Race::Drachnid2 ||
in_race == RACE_ZOMBIE_471 || in_race == Race::Zombie2 ||
in_race == RACE_ELDDAR_489 || in_race == Race::Elddar ||
in_race == RACE_VAMPIRE_497 || in_race == Race::Vampire4 ||
in_race == RACE_KERRAN_562 || in_race == Race::Kerran2 ||
in_race == RACE_BROWNIE_568 || in_race == Race::Brownie2 ||
in_race == RACE_HUMAN_566 || in_race == Race::Human2 ||
in_race == RACE_ELVEN_GHOST_587 || in_race == Race::ElvenGhost ||
in_race == RACE_HUMAN_GHOST_588 || in_race == Race::HumanGhost ||
in_race == RACE_COLDAIN_645 in_race == Race::Coldain2
) { ) {
if (in_gender >= 2) { // Male default for PC Races if (in_gender >= 2) { // Male default for PC Races
return 0; return 0;
@ -3967,33 +3967,33 @@ uint8 Mob::GetDefaultGender(uint16 in_race, uint8 in_gender) {
return in_gender; return in_gender;
} }
} else if ( } else if (
in_race == RACE_FREEPORT_GUARD_44 || in_race == Race::FreeportGuard ||
in_race == RACE_MIMIC_52 || in_race == Race::Mimic ||
in_race == RACE_HUMAN_BEGGAR_55 || in_race == Race::HumanBeggar ||
in_race == RACE_VAMPIRE_65 || in_race == Race::Vampire ||
in_race == RACE_HIGHPASS_CITIZEN_67 || in_race == Race::HighpassCitizen ||
in_race == RACE_NERIAK_CITIZEN_77 || in_race == Race::NeriakCitizen ||
in_race == RACE_ERUDITE_CITIZEN_78 || in_race == Race::EruditeCitizen ||
in_race == RACE_CLOCKWORK_GNOME_88 || in_race == Race::ClockworkGnome ||
in_race == RACE_DWARF_GHOST_117 || in_race == Race::DwarfGhost ||
in_race == RACE_SPECTRAL_IKSAR_147 || in_race == Race::IksarSpirit ||
in_race == RACE_INVISIBLE_MAN_127 || in_race == Race::InvisibleMan ||
in_race == RACE_VAMPYRE_208 || in_race == Race::Vampire2 ||
in_race == RACE_RECUSO_237 || in_race == Race::Recuso ||
in_race == RACE_BROKEN_SKULL_PIRATE_333 || in_race == Race::BrokenSkullPirate ||
in_race == RACE_INVISIBLE_MAN_OF_ZOMM_600 || in_race == Race::InvisibleManOfZomm ||
in_race == RACE_OGRE_NPC_MALE_624 || in_race == Race::Ogre2 ||
in_race == RACE_BEEFEATER_667 || in_race == Race::RoyalGuard ||
in_race == RACE_ERUDITE_678 in_race == Race::Erudite2
) { // Male only races ) { // Male only races
return 0; return 0;
} else if ( } else if (
in_race == RACE_FAIRY_25 || in_race == Race::Fairy ||
in_race == RACE_PIXIE_56 || in_race == Race::Pixie ||
in_race == RACE_BANSHEE_487 || in_race == Race::Banshee2 ||
in_race == RACE_BANSHEE_488 || in_race == Race::Banshee3 ||
in_race == RACE_AYONAE_RO_498 || in_race == Race::AyonaeRo ||
in_race == RACE_SULLON_ZEK_499 in_race == Race::SullonZek
) { // Female only races ) { // Female only races
return 1; return 1;
} else { // Neutral default for NPC Races } else { // Neutral default for NPC Races
@ -6867,22 +6867,22 @@ void Mob::RemoveAllNimbusEffects()
bool Mob::IsBoat() const { bool Mob::IsBoat() const {
return ( return (
race == RACE_SHIP_72 || race == Race::Ship ||
race == RACE_LAUNCH_73 || race == Race::Launch ||
race == RACE_GHOST_SHIP_114 || race == Race::GhostShip ||
race == RACE_SHIP_404 || race == Race::DiscordShip ||
race == RACE_MERCHANT_SHIP_550 || race == Race::MerchantShip ||
race == RACE_PIRATE_SHIP_551 || race == Race::PirateShip ||
race == RACE_GHOST_SHIP_552 || race == Race::GhostShip2 ||
race == RACE_BOAT_533 race == Race::Boat2
); );
} }
bool Mob::IsControllableBoat() const { bool Mob::IsControllableBoat() const {
return ( return (
race == RACE_BOAT_141 || race == Race::Boat ||
race == RACE_ROWBOAT_502 race == Race::Rowboat
); );
} }
@ -8218,37 +8218,37 @@ int Mob::DispatchZoneControllerEvent(
std::string Mob::GetRacePlural() std::string Mob::GetRacePlural()
{ {
switch (GetBaseRace()) { switch (GetBaseRace()) {
case RACE_HUMAN_1: case Race::Human:
return "Humans"; return "Humans";
case RACE_BARBARIAN_2: case Race::Barbarian:
return "Barbarians"; return "Barbarians";
case RACE_ERUDITE_3: case Race::Erudite:
return "Erudites"; return "Erudites";
case RACE_WOOD_ELF_4: case Race::WoodElf:
return "Wood Elves"; return "Wood Elves";
case RACE_HIGH_ELF_5: case Race::HighElf:
return "High Elves"; return "High Elves";
case RACE_DARK_ELF_6: case Race::DarkElf:
return "Dark Elves"; return "Dark Elves";
case RACE_HALF_ELF_7: case Race::HalfElf:
return "Half Elves"; return "Half Elves";
case RACE_DWARF_8: case Race::Dwarf:
return "Dwarves"; return "Dwarves";
case RACE_TROLL_9: case Race::Troll:
return "Trolls"; return "Trolls";
case RACE_OGRE_10: case Race::Ogre:
return "Ogres"; return "Ogres";
case RACE_HALFLING_11: case Race::Halfling:
return "Halflings"; return "Halflings";
case RACE_GNOME_12: case Race::Gnome:
return "Gnomes"; return "Gnomes";
case RACE_IKSAR_128: case Race::Iksar:
return "Iksar"; return "Iksar";
case RACE_VAH_SHIR_130: case Race::VahShir:
return "Vah Shir"; return "Vah Shir";
case RACE_FROGLOK_330: case Race::Froglok2:
return "Frogloks"; return "Frogloks";
case RACE_DRAKKIN_522: case Race::Drakkin:
return "Drakkin"; return "Drakkin";
default: default:
return "Races"; return "Races";

View File

@ -83,7 +83,7 @@ struct AppearanceStruct {
uint8 hair = UINT8_MAX; uint8 hair = UINT8_MAX;
uint8 hair_color = UINT8_MAX; uint8 hair_color = UINT8_MAX;
uint8 helmet_texture = UINT8_MAX; uint8 helmet_texture = UINT8_MAX;
uint16 race_id = RACE_DOUG_0; uint16 race_id = Race::Doug;
bool send_effects = true; bool send_effects = true;
float size = -1.0f; float size = -1.0f;
Client *target = nullptr; Client *target = nullptr;

View File

@ -155,10 +155,10 @@ NPC::NPC(const NPCType *npc_type_data, Spawn2 *in_respawn, const glm::vec4 &posi
// lava dragon is a fixed size model and should always use its default // lava dragon is a fixed size model and should always use its default
// otherwise pathing issues // otherwise pathing issues
if (race == RACE_LAVA_DRAGON_49) { if (race == Race::LavaDragon) {
size = 5; size = 5;
} }
if (race == RACE_WURM_158) { if (race == Race::Wurm) {
size = 15; size = 15;
} }
@ -3691,25 +3691,25 @@ void NPC::ScaleNPC(uint8 npc_level, bool always_scale, bool override_special_abi
bool NPC::IsGuard() bool NPC::IsGuard()
{ {
switch (GetRace()) { switch (GetRace()) {
case RT_GUARD: case Race::FreeportGuard:
if (GetTexture() == 1 || GetTexture() == 2) if (GetTexture() == 1 || GetTexture() == 2)
return true; return true;
break; break;
case RT_IKSAR_2: case Race::IksarCitizen:
if (GetTexture() == 1) if (GetTexture() == 1)
return true; return true;
break; break;
case RT_GUARD_2: case Race::Felguard:
case RT_GUARD_3: case Race::Fayguard:
case RT_GUARD_4: case Race::VahShirGuard:
case RT_HUMAN_3: case Race::QeynosCitizen:
case RT_HALFLING_2: case Race::RivervaleCitizen:
case RT_ERUDITE_2: case Race::EruditeCitizen:
case RT_BARBARIAN_2: case Race::HalasCitizen:
case RT_DARK_ELF_2: case Race::NeriakCitizen:
case RT_TROLL_2: case Race::GrobbCitizen:
case OGGOK_CITIZEN: case OGGOK_CITIZEN:
case RT_DWARF_2: case Race::KaladimCitizen:
return true; return true;
default: default:
break; break;

View File

@ -71,7 +71,7 @@ Petition::Petition(uint32 id)
{ {
petid = id; petid = id;
charclass = Class::None; charclass = Class::None;
charrace = RACE_DOUG_0; charrace = Race::Doug;
charlevel = 0; charlevel = 0;
checkouts = 0; checkouts = 0;
unavailables = 0; unavailables = 0;

View File

@ -7430,42 +7430,42 @@ bool Mob::PassCastRestriction(int value)
case IS_BIXIE: case IS_BIXIE:
case IS_BIXIE2: case IS_BIXIE2:
if ((GetRace() == RT_BIXIE) ||(GetRace() == RT_BIXIE_2)) if ((GetRace() == Race::Bixie) ||(GetRace() == Race::Bixie2))
return true; return true;
break; break;
case IS_HARPY: case IS_HARPY:
if ((GetRace() == RT_HARPY) ||(GetRace() == RT_HARPY_2)) if ((GetRace() == Race::Harpy) ||(GetRace() == Race::Harpy2))
return true; return true;
break; break;
case IS_GNOLL: case IS_GNOLL:
if ((GetRace() == RT_GNOLL) || (GetRace() == RT_GNOLL_2) || (GetRace() == RT_GNOLL_3)) if ((GetRace() == Race::Gnoll) || (GetRace() == Race::Gnoll2) || (GetRace() == Race::Gnoll3))
return true; return true;
break; break;
case IS_SPORALI: case IS_SPORALI:
if ((GetRace() == RT_SPORALI) ||(GetRace() == RT_FUNGUSMAN)) if ((GetRace() == Race::Sporali) ||(GetRace() == Race::Fungusman))
return true; return true;
break; break;
case IS_KOBOLD: case IS_KOBOLD:
if ((GetRace() == RT_KOBOLD) ||(GetRace() == RT_KOBOLD_2)) if ((GetRace() == Race::Kobold) ||(GetRace() == Race::Kobold2))
return true; return true;
break; break;
case IS_FROSTCRYPT_SHADE: case IS_FROSTCRYPT_SHADE:
if (GetRace() == RT_GIANT_SHADE) if (GetRace() == Race::GiantShade)
return true; return true;
break; break;
case IS_DRAKKIN: case IS_DRAKKIN:
if (GetRace() == RT_DRAKKIN) if (GetRace() == Race::Drakkin)
return true; return true;
break; break;
case IS_UNDEAD_OR_VALDEHOLM_GIANT: case IS_UNDEAD_OR_VALDEHOLM_GIANT:
if (GetBodyType() == BT_Undead || GetRace() == RT_GIANT_12 || GetRace() == RT_GIANT_13) if (GetBodyType() == BT_Undead || GetRace() == Race::Giant2 || GetRace() == Race::Giant3)
return true; return true;
break; break;
@ -7496,7 +7496,7 @@ bool Mob::PassCastRestriction(int value)
break; break;
case IS_FAE_OR_PIXIE: case IS_FAE_OR_PIXIE:
if ((GetRace() == RT_PIXIE) || (GetRace() == RT_FAY_DRAKE)) if ((GetRace() == Race::Pixie) || (GetRace() == Race::FayDrake))
return true; return true;
break; break;
@ -7511,12 +7511,12 @@ bool Mob::PassCastRestriction(int value)
break; break;
case IS_CLOCKWORK_AND_HP_LESS_THAN_45_PCT: case IS_CLOCKWORK_AND_HP_LESS_THAN_45_PCT:
if ((GetRace() == RT_GNOMEWORK || GetRace() == RACE_CLOCKWORK_GNOME_88) && (GetHPRatio() < 45)) if ((GetRace() == Race::Gnomework || GetRace() == Race::ClockworkGnome) && (GetHPRatio() < 45))
return true; return true;
break; break;
case IS_WISP_AND_HP_LESS_THAN_10_PCT: case IS_WISP_AND_HP_LESS_THAN_10_PCT:
if ((GetRace() == RT_WILL_O_WISP) && (GetHPRatio() < 10)) if ((GetRace() == Race::Wisp) && (GetHPRatio() < 10))
return true; return true;
break; break;
@ -7889,12 +7889,12 @@ bool Mob::PassCastRestriction(int value)
break; break;
case IS_TREANT: case IS_TREANT:
if (GetRace() == RT_TREANT || GetRace() == RT_TREANT_2 || GetRace() == RT_TREANT_3) if (GetRace() == Race::Treant || GetRace() == Race::Treant2 || GetRace() == Race::Treant3)
return true; return true;
break; break;
case IS_SCARECROW: case IS_SCARECROW:
if (GetRace() == RT_SCARECROW || GetRace() == RT_SCARECROW_2) if (GetRace() == Race::Scarecrow || GetRace() == Race::Scarecrow2)
return true; return true;
break; break;
@ -10263,7 +10263,7 @@ void Mob::ApplySpellEffectIllusion(int32 spell_id, Mob *caster, int buffslot, in
gender_id gender_id
); );
if (base != RACE_ELEMENTAL_75 && base != RACE_DRAKKIN_522) { if (base != Race::Elemental && base != Race::Drakkin) {
if (max > 0) { if (max > 0) {
if (limit == 0) { if (limit == 0) {
SendIllusionPacket( SendIllusionPacket(
@ -10303,7 +10303,7 @@ void Mob::ApplySpellEffectIllusion(int32 spell_id, Mob *caster, int buffslot, in
} }
); );
} }
} else if (base == RACE_ELEMENTAL_75){ } else if (base == Race::Elemental){
SendIllusionPacket( SendIllusionPacket(
AppearanceStruct{ AppearanceStruct{
.gender_id = static_cast<uint8>(gender_id), .gender_id = static_cast<uint8>(gender_id),
@ -10311,7 +10311,7 @@ void Mob::ApplySpellEffectIllusion(int32 spell_id, Mob *caster, int buffslot, in
.texture = static_cast<uint8>(limit), .texture = static_cast<uint8>(limit),
} }
); );
} else if (base == RACE_DRAKKIN_522) { } else if (base == Race::Drakkin) {
FaceChange_Struct f{ FaceChange_Struct f{
.haircolor = GetHairColor(), .haircolor = GetHairColor(),
.beardcolor = GetBeardColor(), .beardcolor = GetBeardColor(),

View File

@ -880,118 +880,118 @@ float Mob::GetZOffset() const {
float offset = 3.125f; float offset = 3.125f;
switch (GetModel()) { switch (GetModel()) {
case RACE_BASILISK_436: case Race::Basilisk:
offset = 0.577f; offset = 0.577f;
break; break;
case RACE_DRAKE_430: case Race::Drake2:
offset = 0.5f; offset = 0.5f;
break; break;
case RACE_DRAKE_432: case Race::Drake3:
offset = 1.9f; offset = 1.9f;
break; break;
case RACE_DRAGON_435: case Race::Dragon:
offset = 0.93f; offset = 0.93f;
break; break;
case RACE_LAVA_SPIDER_450: case Race::LavaSpider:
offset = 0.938f; offset = 0.938f;
break; break;
case RACE_ALLIGATOR_479: case Race::Alligator2:
offset = 0.8f; offset = 0.8f;
break; break;
case RACE_LAVA_SPIDER_QUEEN_451: case Race::LavaSpiderQueen:
offset = 0.816f; offset = 0.816f;
break; break;
case RACE_DRAGON_437: case Race::Dragon2:
offset = 0.527f; offset = 0.527f;
break; break;
case RACE_PUMA_439: case Race::Puma2:
offset = 1.536f; offset = 1.536f;
break; break;
case RACE_RAT_415: case Race::Rat:
offset = 1.0f; offset = 1.0f;
break; break;
case RACE_DRAGON_438: case Race::Dragon3:
case RACE_DRAGON_452: case Race::Dragon4:
offset = 0.776f; offset = 0.776f;
break; break;
case RACE_SPIDER_QUEEN_441: case Race::SpiderQueen:
offset = 0.816f; offset = 0.816f;
break; break;
case RACE_SPIDER_440: case Race::Spider:
offset = 0.938f; offset = 0.938f;
break; break;
case RACE_IMP_46: case Race::Imp:
case RACE_SNAKE_468: case Race::Snake:
case RACE_CORATHUS_459: case Race::Corathus:
offset = 1.0f; offset = 1.0f;
break; break;
case RACE_DRACHNID_COCOON_462: case Race::DrachnidCocoon:
offset = 1.5f; offset = 1.5f;
break; break;
case RACE_DRAGON_530: case Race::Dragon5:
offset = 1.2f; offset = 1.2f;
break; break;
case RACE_GOO_549: case Race::Goo4:
case RACE_GOO_548: case Race::Goo3:
offset = 0.5f; offset = 0.5f;
break; break;
case RACE_GOO_547: case Race::Goo2:
offset = 0.5f; offset = 0.5f;
break; break;
case RACE_DRACOLICH_604: case Race::Dracolich:
offset = 1.2f; offset = 1.2f;
break; break;
case RACE_TELMIRA_653: case Race::Telmira:
offset = 5.9f; offset = 5.9f;
break; break;
case RACE_MORELL_THULE_658: case Race::MorellThule:
offset = 4.0f; offset = 4.0f;
break; break;
case RACE_ARMOR_OF_MARR_323: case Race::AnimatedArmor:
case RACE_AMYGDALAN_663: case Race::Amygdalan:
offset = 5.0f; offset = 5.0f;
break; break;
case RACE_SPECTRAL_IKSAR_147: case Race::IksarSpirit:
case RACE_SANDMAN_664: case Race::Sandman:
offset = 4.0f; offset = 4.0f;
break; break;
case RACE_LAVA_DRAGON_49: case Race::LavaDragon:
case RACE_ALARAN_SENTRY_STONE_703: case Race::AlaranSentryStone:
offset = 9.0f; offset = 9.0f;
break; break;
case RACE_RABBIT_668: case Race::Rabbit:
offset = 5.0f; offset = 5.0f;
break; break;
case RACE_WURM_158: case Race::Wurm:
case RACE_BLIND_DREAMER_669: case Race::BlindDreamer:
offset = 7.0f; offset = 7.0f;
break; break;
case RACE_SIREN_187: case Race::Siren:
case RACE_HALAS_CITIZEN_90: case Race::HalasCitizen:
case RACE_OTTERMAN_190: case Race::Othmir:
offset = .5f; offset = .5f;
break; break;
case RACE_COLDAIN_183: case Race::Coldain:
offset = .6f; offset = .6f;
break; break;
case RACE_WEREWOLF_14: case Race::Werewolf:
offset = 1.2f; offset = 1.2f;
break; break;
case RACE_DWARF_8: case Race::Dwarf:
offset = .7f; offset = .7f;
break; break;
case RACE_HORSE_216: case Race::Horse:
offset = 1.4f; offset = 1.4f;
break; break;
case RACE_ENCHANTED_ARMOR_175: case Race::EnchantedArmor:
case RACE_TIGER_63: case Race::Tiger:
offset = 1.75f; offset = 1.75f;
break; break;
case RACE_STATUE_OF_RALLOS_ZEK_66: case Race::StatueOfRallosZek:
offset = 1.0f; offset = 1.0f;
break; break;
case RACE_GORAL_687: case Race::Goral:
case RACE_SELYRAH_686: case Race::Selyrah:
offset = 2.0f; offset = 2.0f;
break; break;
default: default: