mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-19 16:31:29 +00:00
Minor clean ups to CheckCharCreateInfo
This commit is contained in:
parent
69336d1e53
commit
b6294a28cb
@ -1507,8 +1507,10 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// returns true if the request is ok, false if there's an error
|
// returns true if the request is ok, false if there's an error
|
||||||
bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) {
|
bool CheckCharCreateInfoSoF(CharCreate_Struct *cc)
|
||||||
if(!cc) return false;
|
{
|
||||||
|
if (!cc)
|
||||||
|
return false;
|
||||||
|
|
||||||
_log(WORLD__CLIENT, "Validating char creation info...");
|
_log(WORLD__CLIENT, "Validating char creation info...");
|
||||||
|
|
||||||
@ -1518,18 +1520,11 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) {
|
|||||||
for (int i = 0; i < combos; ++i) {
|
for (int i = 0; i < combos; ++i) {
|
||||||
if (character_create_race_class_combos[i].Class == cc->class_ &&
|
if (character_create_race_class_combos[i].Class == cc->class_ &&
|
||||||
character_create_race_class_combos[i].Race == cc->race &&
|
character_create_race_class_combos[i].Race == cc->race &&
|
||||||
character_create_race_class_combos[i].Deity == cc->deity) {
|
character_create_race_class_combos[i].Deity == cc->deity &&
|
||||||
if(RuleB(World, EnableTutorialButton) &&
|
character_create_race_class_combos[i].Zone == cc->start_zone) {
|
||||||
(RuleI(World, TutorialZoneID) == cc->start_zone ||
|
|
||||||
(character_create_race_class_combos[i].Zone == cc->start_zone))) {
|
|
||||||
class_combo = character_create_race_class_combos[i];
|
class_combo = character_create_race_class_combos[i];
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
} else if(character_create_race_class_combos[i].Zone == cc->start_zone) {
|
|
||||||
class_combo = character_create_race_class_combos[i];
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1542,7 +1537,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) {
|
|||||||
uint32 allocs = character_create_allocations.size();
|
uint32 allocs = character_create_allocations.size();
|
||||||
RaceClassAllocation allocation = {0};
|
RaceClassAllocation allocation = {0};
|
||||||
found = false;
|
found = false;
|
||||||
for(int i = 0; i < combos; ++i) {
|
for (int i = 0; i < allocs; ++i) {
|
||||||
if (character_create_allocations[i].Index == class_combo.AllocationIndex) {
|
if (character_create_allocations[i].Index == class_combo.AllocationIndex) {
|
||||||
allocation = character_create_allocations[i];
|
allocation = character_create_allocations[i];
|
||||||
found = true;
|
found = true;
|
||||||
@ -1685,7 +1680,8 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc)
|
|||||||
{ /*Berserker*/ false, true, false, false, false, false, false, true, true, true, false, false, false, true, false, false}
|
{ /*Berserker*/ false, true, false, false, false, false, false, true, true, true, false, false, false, true, false, false}
|
||||||
};//Initial table by kathgar, editted by Wiz for accuracy, solar too
|
};//Initial table by kathgar, editted by Wiz for accuracy, solar too
|
||||||
|
|
||||||
if(!cc) return false;
|
if (!cc)
|
||||||
|
return false;
|
||||||
|
|
||||||
_log(WORLD__CLIENT,"Validating char creation info...");
|
_log(WORLD__CLIENT,"Validating char creation info...");
|
||||||
|
|
||||||
@ -1699,19 +1695,16 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc)
|
|||||||
|
|
||||||
// if out of range looking it up in the table would crash stuff
|
// if out of range looking it up in the table would crash stuff
|
||||||
// so we return from these
|
// so we return from these
|
||||||
if(classtemp >= PLAYER_CLASS_COUNT)
|
if (classtemp >= PLAYER_CLASS_COUNT) {
|
||||||
{
|
|
||||||
_log(WORLD__CLIENT_ERR," class is out of range");
|
_log(WORLD__CLIENT_ERR," class is out of range");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(racetemp >= _TABLE_RACES)
|
if (racetemp >= _TABLE_RACES) {
|
||||||
{
|
|
||||||
_log(WORLD__CLIENT_ERR," race is out of range");
|
_log(WORLD__CLIENT_ERR," race is out of range");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!ClassRaceLookupTable[classtemp][racetemp]) //Lookup table better than a bunch of ifs?
|
if (!ClassRaceLookupTable[classtemp][racetemp]) { //Lookup table better than a bunch of ifs?
|
||||||
{
|
|
||||||
_log(WORLD__CLIENT_ERR," invalid race/class combination");
|
_log(WORLD__CLIENT_ERR," invalid race/class combination");
|
||||||
// we return from this one, since if it's an invalid combination our table
|
// we return from this one, since if it's an invalid combination our table
|
||||||
// doesn't have meaningful values for the stats
|
// doesn't have meaningful values for the stats
|
||||||
@ -1739,44 +1732,36 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc)
|
|||||||
// NOTE: these could just be else if, but i want to see all the stats
|
// NOTE: these could just be else if, but i want to see all the stats
|
||||||
// that are messed up not just the first hit
|
// that are messed up not just the first hit
|
||||||
|
|
||||||
if(bTOTAL + stat_points != cTOTAL)
|
if (bTOTAL + stat_points != cTOTAL) {
|
||||||
{
|
|
||||||
_log(WORLD__CLIENT_ERR," stat points total doesn't match expected value: expecting %d got %d", bTOTAL + stat_points, cTOTAL);
|
_log(WORLD__CLIENT_ERR," stat points total doesn't match expected value: expecting %d got %d", bTOTAL + stat_points, cTOTAL);
|
||||||
Charerrors++;
|
Charerrors++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cc->STR > bSTR + stat_points || cc->STR < bSTR)
|
if (cc->STR > bSTR + stat_points || cc->STR < bSTR) {
|
||||||
{
|
|
||||||
_log(WORLD__CLIENT_ERR," stat STR is out of range");
|
_log(WORLD__CLIENT_ERR," stat STR is out of range");
|
||||||
Charerrors++;
|
Charerrors++;
|
||||||
}
|
}
|
||||||
if(cc->STA > bSTA + stat_points || cc->STA < bSTA)
|
if (cc->STA > bSTA + stat_points || cc->STA < bSTA) {
|
||||||
{
|
|
||||||
_log(WORLD__CLIENT_ERR," stat STA is out of range");
|
_log(WORLD__CLIENT_ERR," stat STA is out of range");
|
||||||
Charerrors++;
|
Charerrors++;
|
||||||
}
|
}
|
||||||
if(cc->AGI > bAGI + stat_points || cc->AGI < bAGI)
|
if (cc->AGI > bAGI + stat_points || cc->AGI < bAGI) {
|
||||||
{
|
|
||||||
_log(WORLD__CLIENT_ERR," stat AGI is out of range");
|
_log(WORLD__CLIENT_ERR," stat AGI is out of range");
|
||||||
Charerrors++;
|
Charerrors++;
|
||||||
}
|
}
|
||||||
if(cc->DEX > bDEX + stat_points || cc->DEX < bDEX)
|
if (cc->DEX > bDEX + stat_points || cc->DEX < bDEX) {
|
||||||
{
|
|
||||||
_log(WORLD__CLIENT_ERR," stat DEX is out of range");
|
_log(WORLD__CLIENT_ERR," stat DEX is out of range");
|
||||||
Charerrors++;
|
Charerrors++;
|
||||||
}
|
}
|
||||||
if(cc->WIS > bWIS + stat_points || cc->WIS < bWIS)
|
if (cc->WIS > bWIS + stat_points || cc->WIS < bWIS) {
|
||||||
{
|
|
||||||
_log(WORLD__CLIENT_ERR," stat WIS is out of range");
|
_log(WORLD__CLIENT_ERR," stat WIS is out of range");
|
||||||
Charerrors++;
|
Charerrors++;
|
||||||
}
|
}
|
||||||
if(cc->INT > bINT + stat_points || cc->INT < bINT)
|
if (cc->INT > bINT + stat_points || cc->INT < bINT) {
|
||||||
{
|
|
||||||
_log(WORLD__CLIENT_ERR," stat INT is out of range");
|
_log(WORLD__CLIENT_ERR," stat INT is out of range");
|
||||||
Charerrors++;
|
Charerrors++;
|
||||||
}
|
}
|
||||||
if(cc->CHA > bCHA + stat_points || cc->CHA < bCHA)
|
if (cc->CHA > bCHA + stat_points || cc->CHA < bCHA) {
|
||||||
{
|
|
||||||
_log(WORLD__CLIENT_ERR," stat CHA is out of range");
|
_log(WORLD__CLIENT_ERR," stat CHA is out of range");
|
||||||
Charerrors++;
|
Charerrors++;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user