mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 10:31:29 +00:00
[Cleanup] Cleanup magic numbers (#2662)
* [Cleanup] Cleanup magic numbers * renamed RACE_NODE
This commit is contained in:
parent
ed6194ad19
commit
900e1aecf6
@ -1612,6 +1612,7 @@ namespace PlayerAppearance
|
|||||||
#define RACE_LUCLIN_731 731
|
#define RACE_LUCLIN_731 731
|
||||||
#define RACE_PEGASUS_732 732
|
#define RACE_PEGASUS_732 732
|
||||||
#define RACE_INTERACTIVE_OBJECT_2250 2250
|
#define RACE_INTERACTIVE_OBJECT_2250 2250
|
||||||
|
#define RACE_NODE_2254 2254
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -76,6 +76,7 @@
|
|||||||
|
|
||||||
#include "classes.h"
|
#include "classes.h"
|
||||||
#include "spdat.h"
|
#include "spdat.h"
|
||||||
|
#include "../common/rulesys.h"
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -747,8 +748,9 @@ bool IsCombatSkill(uint16 spell_id)
|
|||||||
bool IsResurrectionEffects(uint16 spell_id)
|
bool IsResurrectionEffects(uint16 spell_id)
|
||||||
{
|
{
|
||||||
// spell id 756 is Resurrection Effects spell
|
// spell id 756 is Resurrection Effects spell
|
||||||
if(IsValidSpell(spell_id) && (spell_id == 756 || spell_id == 757))
|
if (IsValidSpell(spell_id) && (spell_id == RuleI(Character, ResurrectionSicknessSpellID) || spell_id == RuleI(Character, OldResurrectionSicknessSpellID))) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
37
zone/bot.cpp
37
zone/bot.cpp
@ -263,15 +263,17 @@ Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double to
|
|||||||
//reapply some buffs
|
//reapply some buffs
|
||||||
uint32 buff_count = GetMaxTotalSlots();
|
uint32 buff_count = GetMaxTotalSlots();
|
||||||
for (uint32 j1 = 0; j1 < buff_count; j1++) {
|
for (uint32 j1 = 0; j1 < buff_count; j1++) {
|
||||||
if (!IsValidSpell(buffs[j1].spellid))
|
if (!IsValidSpell(buffs[j1].spellid)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const SPDat_Spell_Struct& spell = spells[buffs[j1].spellid];
|
const SPDat_Spell_Struct& spell = spells[buffs[j1].spellid];
|
||||||
|
|
||||||
int NimbusEffect = GetNimbusEffect(buffs[j1].spellid);
|
int NimbusEffect = GetNimbusEffect(buffs[j1].spellid);
|
||||||
if (NimbusEffect) {
|
if (NimbusEffect) {
|
||||||
if (!IsNimbusEffectActive(NimbusEffect))
|
if (!IsNimbusEffectActive(NimbusEffect)) {
|
||||||
SendSpellEffect(NimbusEffect, 500, 0, 1, 3000, true);
|
SendSpellEffect(NimbusEffect, 500, 0, 1, 3000, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int x1 = 0; x1 < EFFECT_COUNT; x1++) {
|
for (int x1 = 0; x1 < EFFECT_COUNT; x1++) {
|
||||||
@ -287,8 +289,9 @@ Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double to
|
|||||||
}
|
}
|
||||||
else if (spell.base_value[x1] == -2) // WTF IS THIS
|
else if (spell.base_value[x1] == -2) // WTF IS THIS
|
||||||
{
|
{
|
||||||
if (GetRace() == 128 || GetRace() == 130 || GetRace() <= 12)
|
if (GetRace() == IKSAR || GetRace() == VAHSHIR || GetRace() <= GNOME) {
|
||||||
SendIllusionPacket(GetRace(), GetGender(), spell.limit_value[x1], spell.max_value[x1]);
|
SendIllusionPacket(GetRace(), GetGender(), spell.limit_value[x1], spell.max_value[x1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (spell.max_value[x1] > 0)
|
else if (spell.max_value[x1] > 0)
|
||||||
{
|
{
|
||||||
@ -401,8 +404,6 @@ Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double to
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bot_owner->Message(Chat::White, "&s for '%s'", BotDatabase::fail::LoadBuffs(), GetCleanName());
|
bot_owner->Message(Chat::White, "&s for '%s'", BotDatabase::fail::LoadBuffs(), GetCleanName());
|
||||||
@ -1205,21 +1206,25 @@ void Bot::GenerateBaseStats()
|
|||||||
void Bot::GenerateAppearance() {
|
void Bot::GenerateAppearance() {
|
||||||
// Randomize facial appearance
|
// Randomize facial appearance
|
||||||
int iFace = 0;
|
int iFace = 0;
|
||||||
if(GetRace() == 2) // Barbarian w/Tatoo
|
if (GetRace() == BARBARIAN) // Barbarian w/Tatoo
|
||||||
|
{
|
||||||
iFace = zone->random.Int(0, 79);
|
iFace = zone->random.Int(0, 79);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
iFace = zone->random.Int(0, 7);
|
iFace = zone->random.Int(0, 7);
|
||||||
|
}
|
||||||
|
|
||||||
int iHair = 0;
|
int iHair = 0;
|
||||||
int iBeard = 0;
|
int iBeard = 0;
|
||||||
int iBeardColor = 1;
|
int iBeardColor = 1;
|
||||||
if(GetRace() == 522) {
|
if (GetRace() == DRAKKIN) {
|
||||||
iHair = zone->random.Int(0, 8);
|
iHair = zone->random.Int(0, 8);
|
||||||
iBeard = zone->random.Int(0, 11);
|
iBeard = zone->random.Int(0, 11);
|
||||||
iBeardColor = zone->random.Int(0, 3);
|
iBeardColor = zone->random.Int(0, 3);
|
||||||
} else if(GetGender()) {
|
} else if (GetGender()) {
|
||||||
iHair = zone->random.Int(0, 2);
|
iHair = zone->random.Int(0, 2);
|
||||||
if(GetRace() == 8) { // Dwarven Females can have a beard
|
if (GetRace() == DWARF) { // Dwarven Females can have a beard
|
||||||
if(zone->random.Int(1, 100) < 50)
|
if(zone->random.Int(1, 100) < 50)
|
||||||
iFace += 10;
|
iFace += 10;
|
||||||
}
|
}
|
||||||
@ -1230,24 +1235,26 @@ void Bot::GenerateAppearance() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int iHairColor = 0;
|
int iHairColor = 0;
|
||||||
if(GetRace() == 522)
|
if (GetRace() == DRAKKIN) {
|
||||||
iHairColor = zone->random.Int(0, 3);
|
iHairColor = zone->random.Int(0, 3);
|
||||||
else
|
} else {
|
||||||
iHairColor = zone->random.Int(0, 19);
|
iHairColor = zone->random.Int(0, 19);
|
||||||
|
}
|
||||||
|
|
||||||
uint8 iEyeColor1 = (uint8)zone->random.Int(0, 9);
|
uint8 iEyeColor1 = (uint8)zone->random.Int(0, 9);
|
||||||
uint8 iEyeColor2 = 0;
|
uint8 iEyeColor2 = 0;
|
||||||
if(GetRace() == 522)
|
if (GetRace() == DRAKKIN) {
|
||||||
iEyeColor1 = iEyeColor2 = (uint8)zone->random.Int(0, 11);
|
iEyeColor1 = iEyeColor2 = (uint8)zone->random.Int(0, 11);
|
||||||
else if(zone->random.Int(1, 100) > 96)
|
} else if(zone->random.Int(1, 100) > 96) {
|
||||||
iEyeColor2 = zone->random.Int(0, 9);
|
iEyeColor2 = zone->random.Int(0, 9);
|
||||||
else
|
} else {
|
||||||
iEyeColor2 = iEyeColor1;
|
iEyeColor2 = iEyeColor1;
|
||||||
|
}
|
||||||
|
|
||||||
int iHeritage = 0;
|
int iHeritage = 0;
|
||||||
int iTattoo = 0;
|
int iTattoo = 0;
|
||||||
int iDetails = 0;
|
int iDetails = 0;
|
||||||
if(GetRace() == 522) {
|
if (GetRace() == DRAKKIN) {
|
||||||
iHeritage = zone->random.Int(0, 6);
|
iHeritage = zone->random.Int(0, 6);
|
||||||
iTattoo = zone->random.Int(0, 7);
|
iTattoo = zone->random.Int(0, 7);
|
||||||
iDetails = zone->random.Int(0, 7);
|
iDetails = zone->random.Int(0, 7);
|
||||||
|
|||||||
@ -5833,9 +5833,10 @@ void EntityList::DespawnGridNodes(int32 grid_id) {
|
|||||||
Mob *mob = m.second;
|
Mob *mob = m.second;
|
||||||
if (
|
if (
|
||||||
mob->IsNPC() &&
|
mob->IsNPC() &&
|
||||||
mob->GetRace() == 2254 &&
|
mob->GetRace() == RACE_NODE_2254 &&
|
||||||
mob->EntityVariableExists("grid_id") &&
|
mob->EntityVariableExists("grid_id") &&
|
||||||
std::stoi(mob->GetEntityVariable("grid_id")) == grid_id) {
|
std::stoi(mob->GetEntityVariable("grid_id")) == grid_id)
|
||||||
|
{
|
||||||
mob->Depop();
|
mob->Depop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@ void command_showzonepoints(Client *c, const Seperator *sep)
|
|||||||
auto &mob_list = entity_list.GetMobList();
|
auto &mob_list = entity_list.GetMobList();
|
||||||
for (auto itr : mob_list) {
|
for (auto itr : mob_list) {
|
||||||
Mob *mob = itr.second;
|
Mob *mob = itr.second;
|
||||||
if (mob->IsNPC() && mob->GetRace() == 2254) {
|
if (mob->IsNPC() && mob->GetRace() == RACE_NODE_2254) {
|
||||||
mob->Depop();
|
mob->Depop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4363,19 +4363,23 @@ bool Merc::IsStanding() {
|
|||||||
float Merc::GetMaxMeleeRangeToTarget(Mob* target) {
|
float Merc::GetMaxMeleeRangeToTarget(Mob* target) {
|
||||||
float result = 0;
|
float result = 0;
|
||||||
|
|
||||||
if(target) {
|
if (target) {
|
||||||
float size_mod = GetSize();
|
float size_mod = GetSize();
|
||||||
float other_size_mod = target->GetSize();
|
float other_size_mod = target->GetSize();
|
||||||
|
|
||||||
if(GetRace() == 49 || GetRace() == 158 || GetRace() == 196) //For races with a fixed size
|
if (GetRace() == RACE_LAVA_DRAGON_49 || GetRace() == RACE_WURM_158 || GetRace() == RACE_GHOST_DRAGON_196) //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() == 49 || target->GetRace() == 158 || target->GetRace() == 196) //For races with a fixed size
|
if (target->GetRace() == RACE_LAVA_DRAGON_49 || target->GetRace() == RACE_WURM_158 || target->GetRace() == RACE_GHOST_DRAGON_196) //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) {
|
||||||
other_size_mod = 8.0f;
|
other_size_mod = 8.0f;
|
||||||
|
}
|
||||||
|
|
||||||
if (other_size_mod > size_mod) {
|
if (other_size_mod > size_mod) {
|
||||||
size_mod = other_size_mod;
|
size_mod = other_size_mod;
|
||||||
@ -4383,12 +4387,13 @@ float Merc::GetMaxMeleeRangeToTarget(Mob* target) {
|
|||||||
|
|
||||||
// this could still use some work, but for now it's an improvement....
|
// this could still use some work, but for now it's an improvement....
|
||||||
|
|
||||||
if (size_mod > 29)
|
if (size_mod > 29) {
|
||||||
size_mod *= size_mod;
|
size_mod *= size_mod;
|
||||||
else if (size_mod > 19)
|
} else if (size_mod > 19) {
|
||||||
size_mod *= size_mod * 2;
|
size_mod *= size_mod * 2;
|
||||||
else
|
} else {
|
||||||
size_mod *= size_mod * 4;
|
size_mod *= size_mod * 4;
|
||||||
|
}
|
||||||
|
|
||||||
// prevention of ridiculously sized hit boxes
|
// prevention of ridiculously sized hit boxes
|
||||||
if (size_mod > 10000)
|
if (size_mod > 10000)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user