Restructure repository to include all source folders
Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,328 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <Item/Item.h>
|
||||
#include <Network/Packet/PacketStruct/ServerInfo.h>
|
||||
|
||||
#include <Utility/Math/Math.h>
|
||||
#include <Utility/Setup/ServerSetup.h>
|
||||
|
||||
#include "CharacterClass.h"
|
||||
#include "CharacterCreate.h"
|
||||
|
||||
|
||||
bool CharCreate::CheckCharCreateName(const char *Name_In, bool HanCheck_In)
|
||||
{
|
||||
const unsigned short MIN_CHAR_NAME = 4;
|
||||
const unsigned short MAX_CHAR_NAME = 20;
|
||||
|
||||
if(Name_In == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
size_t Len = strlen(Name_In);
|
||||
if(Len < MIN_CHAR_NAME || Len > MAX_CHAR_NAME)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
LPBYTE CheckName = (LPBYTE)Name_In;
|
||||
|
||||
if(true == HanCheck_In)
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>˻<EFBFBD>
|
||||
int ACount = 0;
|
||||
for(unsigned short LCount = 0; LCount < Len; LCount++)
|
||||
{
|
||||
if((CheckName[LCount] & 0x80) == 0x80)
|
||||
{
|
||||
// 2Byte <20><><EFBFBD><EFBFBD> üũ
|
||||
if(CheckName[LCount + 1] == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> üũ (<28>ѱ<EFBFBD>)
|
||||
if(CheckName[LCount] < 0xB0 || CheckName[LCount] > 0xC9)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(CheckName[LCount + 1] < 0xA1 || CheckName[LCount + 1] > 0xFE)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// <20>ѱ<EFBFBD> <20>κ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD>
|
||||
for(ACount = 0; ACount < ALLOW_HAN_NUM; ACount++)
|
||||
{
|
||||
if(MAKEWORD(CheckName[LCount + 1], CheckName[LCount]) == AllowHans[ACount])
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(ACount != ALLOW_HAN_NUM)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
LCount += 1;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
if((CheckName[LCount] >= 'A' && CheckName[LCount] <= 'Z') ||
|
||||
(CheckName[LCount] >= 'a' && CheckName[LCount] <= 'z'))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
if(CheckName[LCount] >= '0' && CheckName[LCount] <= '9')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ư<><C6AF> <20><>ȣ <20>κ<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
for(ACount = 0; ACount < ALLOW_LETTER_NUM; ACount++)
|
||||
{
|
||||
if(CheckName[LCount] == AllowLetters[ACount])
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(ACount == ALLOW_LETTER_NUM)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!strcmp(Name_In, ""))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD>, Ư<><C6AF><EFBFBD><EFBFBD>ȣ<EFBFBD><C8A3> <20>Է°<D4B7><C2B0><EFBFBD>.
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>˻<EFBFBD>
|
||||
int ACount = 0;
|
||||
for(unsigned short LCount = 0; LCount < Len; LCount++)
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
if((CheckName[LCount] >= 'A' && CheckName[LCount] <= 'Z') ||
|
||||
(CheckName[LCount] >= 'a' && CheckName[LCount] <= 'z'))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
if(CheckName[LCount] >= '0' && CheckName[LCount] <= '9')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ư<><C6AF> <20><>ȣ <20>κ<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
for(ACount = 0; ACount < ALLOW_LETTER_NUM; ACount++)
|
||||
{
|
||||
if(CheckName[LCount] == AllowLetters[ACount])
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(ACount == ALLOW_LETTER_NUM)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Ư<><C6AF><EFBFBD><EFBFBD>ȣ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
for(int LCount = 0; LCount < DISALLOW_LETTER_NUM; LCount++)
|
||||
{
|
||||
if(_tcschr(Name_In, DisAllowLetters[LCount]) != NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool CharCreate::CheckCharCreateData(CHAR_CREATE &CharCreate_In)
|
||||
{
|
||||
if (CharCreate_In.Race == CClass::HUMAN)
|
||||
{
|
||||
if(CharCreate_In.Equip[Item::EquipmentPos::SHIRT] < 201 ||
|
||||
CharCreate_In.Equip[Item::EquipmentPos::SHIRT] > 209)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(601 != CharCreate_In.Equip[Item::EquipmentPos::BOOTS])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(CClass::Fighter == CharCreate_In.Class)
|
||||
{ // <20><><EFBFBD><EFBFBD>
|
||||
if(701 != CharCreate_In.Equip[Item::EquipmentPos::WEAPON_HAND1])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if(CClass::Rogue == CharCreate_In.Class)
|
||||
{ // <20>α<EFBFBD>
|
||||
if(1601 != CharCreate_In.Equip[Item::EquipmentPos::WEAPON_HAND1])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if(CClass::Mage == CharCreate_In.Class)
|
||||
{ // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if(1501 != CharCreate_In.Equip[Item::EquipmentPos::WEAPON_HAND1])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if(CClass::Acolyte == CharCreate_In.Class)
|
||||
{ // <20><><EFBFBD>ݶ<EFBFBD><DDB6><EFBFBD>Ʈ
|
||||
if(801 != CharCreate_In.Equip[Item::EquipmentPos::WEAPON_HAND1])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(CharCreate_In.STR < 20 || CharCreate_In.CON < 20 ||
|
||||
CharCreate_In.DEX < 20 || CharCreate_In.INT < 20 || CharCreate_In.WIS < 20)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(CharCreate_In.STR + CharCreate_In.CON +
|
||||
CharCreate_In.DEX + CharCreate_In.INT + CharCreate_In.WIS > 105)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (CharCreate_In.Race == CClass::AKHAN)
|
||||
{
|
||||
if(CClass::Combatant == CharCreate_In.Class)
|
||||
{ // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ
|
||||
if(5401 != CharCreate_In.Equip[Item::EquipmentPos::WEAPON])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(5101 != CharCreate_In.Equip[Item::EquipmentPos::BODY])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(5201 != CharCreate_In.Equip[Item::EquipmentPos::PELVIS])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if(CClass::Officiator == CharCreate_In.Class)
|
||||
{ // <20><><EFBFBD>Ǽ<EFBFBD><C7BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
if(5801 != CharCreate_In.Equip[Item::EquipmentPos::WEAPON])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(5110 != CharCreate_In.Equip[Item::EquipmentPos::BODY])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(5210 != CharCreate_In.Equip[Item::EquipmentPos::PELVIS])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(CharCreate_In.STR < 20 || CharCreate_In.CON < 20 ||
|
||||
CharCreate_In.DEX < 20 || CharCreate_In.INT < 20 || CharCreate_In.WIS < 20)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(CharCreate_In.STR + CharCreate_In.CON + CharCreate_In.DEX +
|
||||
CharCreate_In.INT + CharCreate_In.WIS > 105)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned long CharCreate::GetDefaultStartGold(void)
|
||||
{
|
||||
return START_GOLD;
|
||||
}
|
||||
|
||||
POS CharCreate::GetDefaultCharacterPos(unsigned long dwRace, unsigned long dwRacePlayerNum)
|
||||
{
|
||||
if (true == CServerSetup::GetInstance().IsBattleAuthServer() ||
|
||||
true == CServerSetup::GetInstance().IsBattleGameServer())
|
||||
{
|
||||
POS StartPos = BGServerStartPos[dwRace][Math::Random::ComplexRandom(MAX_LOBBY_RESPAWN_POS)];
|
||||
StartPos.fPointX += Math::Random::SimpleRandom(GetTickCount(), 20) - 10;
|
||||
StartPos.fPointZ += Math::Random::SimpleRandom(GetTickCount(), 20) - 10;
|
||||
return StartPos;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ġ<EFBFBD><C4A1> <20>ϳ<EFBFBD><CFB3>̴<EFBFBD>.
|
||||
unsigned long dwIndex = 0;
|
||||
|
||||
if (CClass::MAX_RACE <= dwRace)
|
||||
{
|
||||
dwRace = 0;
|
||||
}
|
||||
|
||||
for (; dwIndex < MAX_START_POS_NUM; ++dwIndex)
|
||||
{
|
||||
if (dwRacePlayerNum < StartPointVariation[dwIndex])
|
||||
{
|
||||
if (0 < dwIndex)
|
||||
{
|
||||
dwIndex = Math::Random::ComplexRandom(dwIndex + 1);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
POS startPos = StartPosNum[dwRace][dwIndex];
|
||||
|
||||
startPos.fPointX += static_cast<float>(Math::Random::ComplexRandom(14)) - 7.0f;
|
||||
startPos.fPointZ += static_cast<float>(Math::Random::ComplexRandom(14)) - 7.0f;
|
||||
|
||||
return startPos;
|
||||
}
|
||||
|
||||
|
||||
inline bool operator == (const POS& lhs, const POS& rhs)
|
||||
{
|
||||
return (lhs.fPointX == rhs.fPointX) && (lhs.fPointY == rhs.fPointY) && (lhs.fPointZ == rhs.fPointZ);
|
||||
}
|
||||
|
||||
inline bool operator != (const POS& lhs, const POS& rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
Reference in New Issue
Block a user