Initial MSVC 2008 projects workspace
This commit is contained in:
59
L2C_Server/world/model/GameObject.cpp
Normal file
59
L2C_Server/world/model/GameObject.cpp
Normal file
@@ -0,0 +1,59 @@
|
||||
#include "pch.h"
|
||||
#include "Log.h"
|
||||
#include "GameObject.h"
|
||||
|
||||
GameObject::GameObject( unsigned int objectId )
|
||||
{
|
||||
m_objectId = objectId;
|
||||
m_x = m_y = m_z = m_reflection = 0;
|
||||
m_toString_buffer = NULL;
|
||||
}
|
||||
|
||||
GameObject::GameObject( int x, int y, int z, int reflection, unsigned int objectId )
|
||||
{
|
||||
m_x = x; m_y = y; m_z = z;
|
||||
m_reflection = reflection;
|
||||
m_objectId = objectId;
|
||||
m_toString_buffer = NULL;
|
||||
}
|
||||
|
||||
GameObject::~GameObject()
|
||||
{
|
||||
if( m_toString_buffer )
|
||||
{
|
||||
free( m_toString_buffer );
|
||||
m_toString_buffer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void GameObject::LockObject()
|
||||
{
|
||||
m_lock.Lock();
|
||||
}
|
||||
|
||||
void GameObject::LockRelease()
|
||||
{
|
||||
m_lock.Unlock();
|
||||
}
|
||||
|
||||
void GameObject::setXYZ( int x, int y, int z )
|
||||
{
|
||||
m_x = x;
|
||||
m_y = y;
|
||||
m_z = z;
|
||||
}
|
||||
|
||||
void GameObject::setReflection( int rId )
|
||||
{
|
||||
m_reflection = rId;
|
||||
}
|
||||
|
||||
wchar_t *GameObject::toString() const
|
||||
{
|
||||
GameObject *non_const_this = const_cast<GameObject *>(this);
|
||||
if( non_const_this->m_toString_buffer == NULL )
|
||||
non_const_this->m_toString_buffer = (wchar_t *)malloc( 512 );
|
||||
if( non_const_this->m_toString_buffer )
|
||||
swprintf( non_const_this->m_toString_buffer, 255, L"ObjectID[%u] (%d,%d,%d,%d)", m_objectId, m_x, m_y, m_z, m_reflection );
|
||||
return non_const_this->m_toString_buffer;
|
||||
}
|
35
L2C_Server/world/model/GameObject.h
Normal file
35
L2C_Server/world/model/GameObject.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
#include "l2c_utils.h"
|
||||
|
||||
class GameObject
|
||||
{
|
||||
public:
|
||||
GameObject( unsigned int objectId );
|
||||
GameObject( int x, int y, int z, int reflection, unsigned int objectId );
|
||||
virtual ~GameObject();
|
||||
|
||||
public:
|
||||
unsigned int getObjectId() const { return m_objectId; }
|
||||
int getX() const { return m_x; }
|
||||
int getY() const { return m_y; }
|
||||
int getZ() const { return m_z; }
|
||||
int getReflection() const { return m_reflection; }
|
||||
|
||||
public:
|
||||
void setXYZ( int x, int y, int z );
|
||||
void setReflection( int rId );
|
||||
|
||||
public:
|
||||
virtual void LockObject();
|
||||
virtual void LockRelease();
|
||||
virtual wchar_t *toString() const;
|
||||
|
||||
protected:
|
||||
unsigned int m_objectId;
|
||||
int m_x;
|
||||
int m_y;
|
||||
int m_z;
|
||||
int m_reflection;
|
||||
wchar_t *m_toString_buffer;
|
||||
CriticalSection m_lock;
|
||||
};
|
43
L2C_Server/world/model/base/ClassId.cpp
Normal file
43
L2C_Server/world/model/base/ClassId.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
#include "pch.h"
|
||||
#include "ClassId.h"
|
||||
#include "ClassIdTree.h"
|
||||
|
||||
ClassId::ClassId( int id, const wchar_t *name, bool isMage, bool isSummoner, Race race, int parentId )
|
||||
{
|
||||
m_id = id; m_isMage = isMage; m_isSummoner = isSummoner;
|
||||
m_race = race; m_parentId = parentId;
|
||||
m_name[0] = 0;
|
||||
if( name )
|
||||
{
|
||||
wcsncpy( m_name, name, sizeof(m_name)/sizeof(m_name[0]) );
|
||||
m_name[sizeof(m_name)/sizeof(m_name[0])-1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int ClassId::getId() const { return m_id; }
|
||||
const wchar_t *ClassId::getName() const { return m_name; }
|
||||
bool ClassId::isMage() const { return m_isMage; }
|
||||
bool ClassId::isSummoner() const { return m_isSummoner; }
|
||||
Race ClassId::getRace() const { return m_race; }
|
||||
int ClassId::getParentId() const { return m_parentId; }
|
||||
|
||||
int ClassId::level() const
|
||||
{
|
||||
if( m_id != 0x87 && m_parentId == -1 ) return 0; // every non-Inspector without a parent is 0th prof
|
||||
if( m_id == 0x87 ) return 2; // Inspector, has no parent, but is 2nd class
|
||||
if( m_id == 0x88 ) return 3; // Judicator
|
||||
return 1 + ClassIdTree::getInstance()->getParentClassId( m_id )->level();
|
||||
}
|
||||
|
||||
bool ClassId::isChildOf( int classId ) const
|
||||
{
|
||||
if( m_parentId == -1 ) return false; // no parents...
|
||||
if( m_parentId == classId ) return true; // direct child of
|
||||
// maybe is parent's child?
|
||||
return ClassIdTree::getInstance()->getClassId( m_parentId )->isChildOf( classId );
|
||||
}
|
||||
|
||||
bool ClassId::isEqualOrChildOf( int classId ) const
|
||||
{
|
||||
return (m_id == classId) || isChildOf( classId );
|
||||
}
|
112
L2C_Server/world/model/base/ClassId.h
Normal file
112
L2C_Server/world/model/base/ClassId.h
Normal file
@@ -0,0 +1,112 @@
|
||||
#pragma once
|
||||
#include "Race.h"
|
||||
|
||||
class ClassId
|
||||
{
|
||||
public:
|
||||
static const int CID_NONE = -1;
|
||||
static const int CID_HUMAN_FIGHTER = 0x00;
|
||||
static const int CID_WARRIOR = 0x01;
|
||||
static const int CID_GLADIATOR = 0x02;
|
||||
static const int CID_WARLORD = 0x03;
|
||||
static const int CID_KNIGHT = 0x04;
|
||||
static const int CID_PALLADIN = 0x05;
|
||||
static const int CID_DARK_AVENGER = 0x06;
|
||||
static const int CID_ROGUE = 0x07;
|
||||
static const int CID_TREASURE_HUNTER = 0x08;
|
||||
static const int CID_HAWKEYE = 0x09;
|
||||
|
||||
static const int CID_HUMAN_MAGE = 0x0A;
|
||||
static const int CID_HUMAN_WIZARD = 0x0B;
|
||||
static const int CID_SORCEROR = 0x0C;
|
||||
static const int CID_NECROMANCER = 0x0D;
|
||||
static const int CID_WARLOCK = 0x0E;
|
||||
static const int CID_CLERIC = 0x0F;
|
||||
static const int CID_BISHOP = 0x10;
|
||||
static const int CID_PROPHET = 0x11;
|
||||
|
||||
static const int CID_ELVEN_FIGHTER = 0x12;
|
||||
static const int CID_ELVEN_KNIGHT = 0x13;
|
||||
static const int CID_TEMPLE_KNIGHT = 0x14;
|
||||
static const int CID_SWORDSINGER = 0x15;
|
||||
static const int CID_ELVEN_SCOUT = 0x16;
|
||||
static const int CID_PLAINSWALKER = 0x17;
|
||||
static const int CID_SILVER_RANGER = 0x18;
|
||||
|
||||
static const int CID_ELVEN_MAGE = 0x19;
|
||||
static const int CID_ELVEN_WIZARD = 0x1A;
|
||||
static const int CID_SPELLSINGER = 0x1B;
|
||||
static const int CID_ELEMENTAL_SUMMONER = 0x1C;
|
||||
static const int CID_ELVEN_ORACLE = 0x1D;
|
||||
static const int CID_ELVEN_ELDER = 0x1E;
|
||||
|
||||
static const int CID_DARK_FIGHTER = 0x1F;
|
||||
static const int CID_PALUS_KNIGHT = 0x20;
|
||||
static const int CID_SHILLEN_KNIGHT = 0x21;
|
||||
static const int CID_BLADEDANCER = 0x22;
|
||||
static const int CID_ASSASIN = 0x23;
|
||||
static const int CID_ABYSS_WALKER = 0x24;
|
||||
static const int CID_PHANTOM_RANGER = 0x25;
|
||||
|
||||
static const int CID_DARK_MAGE = 0x26;
|
||||
static const int CID_DARK_WIZARD = 0x27;
|
||||
static const int CID_SPELLHOWLER = 0x28;
|
||||
static const int CID_PHANTOM_SUMMONER = 0x29;
|
||||
static const int CID_SHILLEN_ORACLE = 0x2A;
|
||||
static const int CID_SHILLEN_ELDER = 0x2B;
|
||||
|
||||
static const int CID_ORC_FIGHTER = 0x2C;
|
||||
static const int CID_ORC_RIDER = 0x2D;
|
||||
static const int CID_DESTROYER = 0x2E;
|
||||
static const int CID_ORC_MONK = 0x2F;
|
||||
static const int CID_TYRANT = 0x30;
|
||||
|
||||
static const int CID_ORC_MAGE = 0x31;
|
||||
static const int CID_ORC_SHAMAN = 0x32;
|
||||
static const int CID_OVERLORD = 0x33;
|
||||
static const int CID_WARCRYER = 0x34;
|
||||
|
||||
static const int CID_DWARVEN_FIGHTER = 0x35;
|
||||
static const int CID_SCAVENGER = 0x36;
|
||||
static const int CID_BOUNTY_HUNTER = 0x37;
|
||||
static const int CID_ARTISAN = 0x38;
|
||||
static const int CID_WARSMITH = 0x39;
|
||||
|
||||
static const int CID_DUELIST = 0x58;
|
||||
|
||||
static const int CID_KAMAEL_MALE_SOLDIER = 0x7B;
|
||||
static const int CID_KAMAEL_FEMALE_SOLDIER = 0x7C;
|
||||
static const int CID_TROOPER = 0x7D;
|
||||
static const int CID_WARDER = 0x7E;
|
||||
static const int CID_BERSERKER = 0x7F;
|
||||
static const int CID_MALE_SOULBREAKER = 0x80;
|
||||
static const int CID_FEMALE_SOULBREAKER = 0x81;
|
||||
static const int CID_ARBALESTER = 0x82;
|
||||
static const int CID_DOOMBRINGER = 0x83;
|
||||
static const int CID_MALE_SOULHOUND = 0x84;
|
||||
static const int CID_FEMALE_SOULHOUND = 0x85;
|
||||
static const int CID_TRICKSTER = 0x86;
|
||||
static const int CID_INSPECTOR = 0x87;
|
||||
static const int CID_JUDICATOR = 0x88;
|
||||
|
||||
public:
|
||||
ClassId( int id, const wchar_t *name, bool isMage, bool isSummoner, Race race, int parentId );
|
||||
int getId() const;
|
||||
const wchar_t *getName() const;
|
||||
bool isMage() const;
|
||||
bool isSummoner() const;
|
||||
Race getRace() const;
|
||||
int getParentId() const;
|
||||
public:
|
||||
// 0 - 0 profession, 1 - 1st profession, 2 - 2nd prof, 3 - 3rd prof
|
||||
int level() const;
|
||||
bool isChildOf( int classId ) const;
|
||||
bool isEqualOrChildOf( int classId ) const;
|
||||
protected:
|
||||
int m_id;
|
||||
wchar_t m_name[32];
|
||||
bool m_isMage;
|
||||
bool m_isSummoner;
|
||||
Race m_race;
|
||||
int m_parentId; // -1 - no parent class
|
||||
};
|
196
L2C_Server/world/model/base/ClassIdTree.cpp
Normal file
196
L2C_Server/world/model/base/ClassIdTree.cpp
Normal file
@@ -0,0 +1,196 @@
|
||||
#include "pch.h"
|
||||
#include "ClassIdTree.h"
|
||||
|
||||
// mem for static vars
|
||||
ClassIdTree *ClassIdTree::_instance = NULL;
|
||||
int ClassIdTree::_refCount = 0;
|
||||
|
||||
ClassIdTree *ClassIdTree::getInstance()
|
||||
{
|
||||
if( !_instance )
|
||||
{
|
||||
_instance = new ClassIdTree();
|
||||
_refCount++;
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
|
||||
void ClassIdTree::freeInstance()
|
||||
{
|
||||
if( _instance )
|
||||
{
|
||||
_refCount--;
|
||||
if( _refCount == 0 )
|
||||
{
|
||||
delete _instance;
|
||||
_instance = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ClassIdTree::ClassIdTree()
|
||||
{
|
||||
int i;
|
||||
for( i=0; i<NUM_CLASS_IDS; i++ ) m_class[i] = NULL;
|
||||
|
||||
// add info about all classes
|
||||
addClassId( 0x00, L"Fighter", false, false, RACE_Human, ClassId::CID_NONE );
|
||||
addClassId( 0x01, L"Warrior", false, false, RACE_Human, ClassId::CID_HUMAN_FIGHTER );
|
||||
addClassId( 0x02, L"Gladiator", false, false, RACE_Human, ClassId::CID_WARRIOR );
|
||||
addClassId( 0x03, L"Warlord", false, false, RACE_Human, ClassId::CID_WARRIOR );
|
||||
addClassId( 0x04, L"Knight", false, false, RACE_Human, ClassId::CID_HUMAN_FIGHTER );
|
||||
addClassId( 0x05, L"Palladin", false, false, RACE_Human, ClassId::CID_KNIGHT );
|
||||
addClassId( 0x06, L"Dark Avenger", false, false, RACE_Human, ClassId::CID_KNIGHT );
|
||||
addClassId( 0x07, L"Rogue", false, false, RACE_Human, ClassId::CID_HUMAN_FIGHTER );
|
||||
addClassId( 0x08, L"Treasure Hunter", false, false, RACE_Human, ClassId::CID_ROGUE );
|
||||
addClassId( 0x09, L"Hawkeye", false, false, RACE_Human, ClassId::CID_ROGUE );
|
||||
|
||||
addClassId( 0x0A, L"Mage", true, false, RACE_Human, ClassId::CID_NONE );
|
||||
addClassId( 0x0B, L"Wizard", true, false, RACE_Human, ClassId::CID_HUMAN_MAGE );
|
||||
addClassId( 0x0C, L"Sorceror", true, false, RACE_Human, ClassId::CID_HUMAN_WIZARD );
|
||||
addClassId( 0x0D, L"Necromancer", true, false, RACE_Human, ClassId::CID_HUMAN_WIZARD );
|
||||
addClassId( 0x0E, L"Warlock", true, true, RACE_Human, ClassId::CID_HUMAN_WIZARD );
|
||||
addClassId( 0x0F, L"Cleric", true, false, RACE_Human, ClassId::CID_HUMAN_MAGE );
|
||||
addClassId( 0x10, L"Bishop", true, false, RACE_Human, ClassId::CID_CLERIC );
|
||||
addClassId( 0x11, L"Prophet", true, false, RACE_Human, ClassId::CID_CLERIC );
|
||||
|
||||
addClassId( 0x12, L"Elven fighter", false, false, RACE_Elf, ClassId::CID_NONE );
|
||||
addClassId( 0x13, L"Elven Knight", false, false, RACE_Elf, ClassId::CID_ELVEN_FIGHTER );
|
||||
addClassId( 0x14, L"Temple Knight", false, false, RACE_Elf, ClassId::CID_ELVEN_KNIGHT );
|
||||
addClassId( 0x15, L"Swordsinger", false, false, RACE_Elf, ClassId::CID_ELVEN_KNIGHT );
|
||||
addClassId( 0x16, L"Elven Scout", false, false, RACE_Elf, ClassId::CID_ELVEN_FIGHTER );
|
||||
addClassId( 0x17, L"Plains Walker", false, false, RACE_Elf, ClassId::CID_ELVEN_SCOUT );
|
||||
addClassId( 0x18, L"Silver Ranger", false, false, RACE_Elf, ClassId::CID_ELVEN_SCOUT );
|
||||
|
||||
addClassId( 0x19, L"Elven Mage", true, false, RACE_Elf, ClassId::CID_NONE );
|
||||
addClassId( 0x1A, L"Elven Wizard", true, false, RACE_Elf, ClassId::CID_ELVEN_MAGE );
|
||||
addClassId( 0x1B, L"Spellsinger", true, false, RACE_Elf, ClassId::CID_ELVEN_WIZARD );
|
||||
addClassId( 0x1C, L"Elemenal Summoner", true, true, RACE_Elf, ClassId::CID_ELVEN_WIZARD );
|
||||
addClassId( 0x1D, L"Elven Oracle", true, false, RACE_Elf, ClassId::CID_ELVEN_MAGE );
|
||||
addClassId( 0x1E, L"Elven Elder", true, false, RACE_Elf, ClassId::CID_ELVEN_ORACLE );
|
||||
|
||||
addClassId( 0x1F, L"Dark Fighter", false, false, RACE_DarkElf, ClassId::CID_NONE );
|
||||
addClassId( 0x20, L"Palus Knight", false, false, RACE_DarkElf, ClassId::CID_DARK_FIGHTER );
|
||||
addClassId( 0x21, L"Shillen Knight", false, false, RACE_DarkElf, ClassId::CID_PALUS_KNIGHT );
|
||||
addClassId( 0x22, L"Bladedancer", false, false, RACE_DarkElf, ClassId::CID_PALUS_KNIGHT );
|
||||
addClassId( 0x23, L"Assasin", false, false, RACE_DarkElf, ClassId::CID_DARK_FIGHTER );
|
||||
addClassId( 0x24, L"Abyss Walker", false, false, RACE_DarkElf, ClassId::CID_ASSASIN );
|
||||
addClassId( 0x25, L"Phantom Ranger", false, false, RACE_DarkElf, ClassId::CID_ASSASIN );
|
||||
|
||||
addClassId( 0x26, L"Dark Mage", true, false, RACE_DarkElf, ClassId::CID_NONE );
|
||||
addClassId( 0x27, L"Dark Wizard", true, false, RACE_DarkElf, ClassId::CID_DARK_MAGE );
|
||||
addClassId( 0x28, L"Spellhowler", true, false, RACE_DarkElf, ClassId::CID_DARK_WIZARD );
|
||||
addClassId( 0x29, L"Phantom Summoner", true, true, RACE_DarkElf, ClassId::CID_DARK_WIZARD );
|
||||
addClassId( 0x2A, L"Shillen Oracle", true, false, RACE_DarkElf, ClassId::CID_DARK_MAGE );
|
||||
addClassId( 0x2B, L"Shillen ELder", true, false, RACE_DarkElf, ClassId::CID_SHILLEN_ORACLE );
|
||||
|
||||
addClassId( 0x2C, L"Orc Fighter", false, false, RACE_Orc, ClassId::CID_NONE );
|
||||
addClassId( 0x2D, L"Orc Rider", false, false, RACE_Orc, ClassId::CID_ORC_FIGHTER );
|
||||
addClassId( 0x2E, L"Destroyer", false, false, RACE_Orc, ClassId::CID_ORC_RIDER );
|
||||
addClassId( 0x2F, L"Orc Monk", false, false, RACE_Orc, ClassId::CID_ORC_FIGHTER );
|
||||
addClassId( 0x30, L"Tyrant", false, false, RACE_Orc, ClassId::CID_ORC_MONK );
|
||||
|
||||
addClassId( 0x31, L"Orc Mage", true, false, RACE_Orc, ClassId::CID_NONE );
|
||||
addClassId( 0x32, L"Orc Shaman", true, false, RACE_Orc, ClassId::CID_ORC_MAGE );
|
||||
addClassId( 0x33, L"Overlord", true, false, RACE_Orc, ClassId::CID_ORC_SHAMAN );
|
||||
addClassId( 0x34, L"Warcryer", true, false, RACE_Orc, ClassId::CID_ORC_SHAMAN );
|
||||
|
||||
addClassId( 0x35, L"Dwarven Fighter", false, false, RACE_Dwarf, ClassId::CID_NONE );
|
||||
addClassId( 0x36, L"Scavenger", false, false, RACE_Dwarf, ClassId::CID_DWARVEN_FIGHTER );
|
||||
addClassId( 0x37, L"Bounty Hunter", false, false, RACE_Dwarf, ClassId::CID_SCAVENGER );
|
||||
addClassId( 0x38, L"Artisan", false, false, RACE_Dwarf, ClassId::CID_DWARVEN_FIGHTER );
|
||||
addClassId( 0x39, L"Warsmith", false, false, RACE_Dwarf, ClassId::CID_ARTISAN );
|
||||
|
||||
// 3rd prof
|
||||
addClassId( 0x58, L"Duelist", false, false, RACE_Human, ClassId::CID_GLADIATOR );
|
||||
addClassId( 0x59, L"Dreadnought", false, false, RACE_Human, ClassId::CID_WARLORD );
|
||||
addClassId( 0x5A, L"Phoenix Knight", false, false, RACE_Human, ClassId::CID_PALLADIN );
|
||||
addClassId( 0x5B, L"Hell Knight", false, false, RACE_Human, ClassId::CID_DARK_AVENGER );
|
||||
addClassId( 0x5C, L"Sagittarius", false, false, RACE_Human, ClassId::CID_HAWKEYE );
|
||||
addClassId( 0x5D, L"Adventurer", false, false, RACE_Human, ClassId::CID_TREASURE_HUNTER );
|
||||
|
||||
addClassId( 0x5E, L"Archmage", true, false, RACE_Human, ClassId::CID_SORCEROR );
|
||||
addClassId( 0x5F, L"Soultaker", true, false, RACE_Human, ClassId::CID_NECROMANCER );
|
||||
addClassId( 0x60, L"Arcana Lord", true, true, RACE_Human, ClassId::CID_WARLOCK );
|
||||
addClassId( 0x61, L"Cardinal", true, false, RACE_Human, ClassId::CID_BISHOP );
|
||||
addClassId( 0x62, L"Hierophant", true, false, RACE_Human, ClassId::CID_PROPHET );
|
||||
|
||||
addClassId( 0x63, L"Eva's Templar", false, false, RACE_Elf, ClassId::CID_TEMPLE_KNIGHT );
|
||||
addClassId( 0x64, L"Sword Muse", false, false, RACE_Elf, ClassId::CID_SWORDSINGER );
|
||||
addClassId( 0x65, L"Wind Rider", false, false, RACE_Elf, ClassId::CID_PLAINSWALKER );
|
||||
addClassId( 0x66, L"Moonlight Sentinel", false, false, RACE_Elf, ClassId::CID_SILVER_RANGER );
|
||||
addClassId( 0x67, L"Mustic Muse", true, false, RACE_Elf, ClassId::CID_SPELLSINGER );
|
||||
addClassId( 0x68, L"Elemental Master", true, true, RACE_Elf, ClassId::CID_ELEMENTAL_SUMMONER );
|
||||
addClassId( 0x69, L"Eva's Saint", true, false, RACE_Elf, ClassId::CID_ELVEN_ELDER );
|
||||
|
||||
addClassId( 0x6A, L"Shillen Templar", false, false, RACE_DarkElf, ClassId::CID_SHILLEN_KNIGHT );
|
||||
addClassId( 0x6B, L"Spectral Dancer", false, false, RACE_DarkElf, ClassId::CID_BLADEDANCER );
|
||||
addClassId( 0x6C, L"Ghost Hunter", false, false, RACE_DarkElf, ClassId::CID_ABYSS_WALKER );
|
||||
addClassId( 0x6D, L"Ghost Sentinel", false, false, RACE_DarkElf, ClassId::CID_PHANTOM_RANGER );
|
||||
|
||||
addClassId( 0x6E, L"Storm Screamer", true, false, RACE_DarkElf, ClassId::CID_SPELLHOWLER );
|
||||
addClassId( 0x6F, L"Spectral Master", true, true, RACE_DarkElf, ClassId::CID_PHANTOM_SUMMONER );
|
||||
addClassId( 0x70, L"Shillen Saint", true, false, RACE_DarkElf, ClassId::CID_SHILLEN_ELDER );
|
||||
|
||||
addClassId( 0x71, L"Titan", false, false, RACE_Orc, ClassId::CID_DESTROYER );
|
||||
addClassId( 0x72, L"Grand Khavatari", false, false, RACE_Orc, ClassId::CID_TYRANT );
|
||||
addClassId( 0x73, L"Dominator", true, false, RACE_Orc, ClassId::CID_OVERLORD );
|
||||
addClassId( 0x74, L"Doomcryer", true, false, RACE_Orc, ClassId::CID_WARCRYER );
|
||||
|
||||
addClassId( 0x75, L"Fortune Seeker", false, false, RACE_Dwarf, ClassId::CID_BOUNTY_HUNTER );
|
||||
addClassId( 0x76, L"Maestro", false, false, RACE_Dwarf, ClassId::CID_WARSMITH );
|
||||
|
||||
addClassId( 0x7B, L"Kamael Male Soldier", false, false, RACE_Kamael, ClassId::CID_NONE );
|
||||
addClassId( 0x7C, L"Kamael Female Soldier", false, false, RACE_Kamael, ClassId::CID_NONE );
|
||||
addClassId( 0x7D, L"Trooper", false, false, RACE_Kamael, ClassId::CID_KAMAEL_MALE_SOLDIER );
|
||||
addClassId( 0x7E, L"Warder", false, false, RACE_Kamael, ClassId::CID_KAMAEL_FEMALE_SOLDIER );
|
||||
|
||||
addClassId( 0x7F, L"Berserker", false, false, RACE_Kamael, ClassId::CID_TROOPER );
|
||||
addClassId( 0x80, L"Male Soulbreaker", false, false, RACE_Kamael, ClassId::CID_TROOPER );
|
||||
addClassId( 0x81, L"Female Soulbreaker", false, false, RACE_Kamael, ClassId::CID_WARDER );
|
||||
addClassId( 0x82, L"Arbalester", false, false, RACE_Kamael, ClassId::CID_WARDER );
|
||||
|
||||
addClassId( 0x83, L"Doombringer", false, false, RACE_Kamael, ClassId::CID_BERSERKER );
|
||||
addClassId( 0x84, L"Male Soulhound", false, false, RACE_Kamael, ClassId::CID_MALE_SOULBREAKER );
|
||||
addClassId( 0x85, L"Female Soulhound", false, false, RACE_Kamael, ClassId::CID_FEMALE_SOULBREAKER );
|
||||
addClassId( 0x86, L"Trickster", false, false, RACE_Kamael, ClassId::CID_ARBALESTER );
|
||||
addClassId( 0x87, L"Inspector", false, false, RACE_Kamael, ClassId::CID_NONE ); // Hidden subclass, no first class which it comes from
|
||||
addClassId( 0x88, L"Judicator", false, false, RACE_Kamael, ClassId::CID_INSPECTOR );
|
||||
}
|
||||
|
||||
ClassIdTree::~ClassIdTree()
|
||||
{
|
||||
int i;
|
||||
for( i=0; i<NUM_CLASS_IDS; i++ )
|
||||
{
|
||||
if( m_class[i] )
|
||||
{
|
||||
delete m_class[i];
|
||||
m_class[i] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ClassIdTree::addClassId( int id, const wchar_t *name, bool isMage, bool isSummoner, Race race, int parentId )
|
||||
{
|
||||
if( (id>=0) && (id<NUM_CLASS_IDS) )
|
||||
{
|
||||
assert( m_class[id] == NULL );
|
||||
if( m_class[id] == NULL )
|
||||
m_class[id] = new ClassId( id, name, isMage, isSummoner, race, parentId );
|
||||
}
|
||||
}
|
||||
|
||||
const ClassId *ClassIdTree::getClassId( int class_id ) const
|
||||
{
|
||||
if( (class_id>=0) && (class_id<NUM_CLASS_IDS) ) return m_class[class_id];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const ClassId *ClassIdTree::getParentClassId( int class_id ) const
|
||||
{
|
||||
const ClassId *c = getClassId( class_id );
|
||||
if( c ) return getClassId( c->getParentId() );
|
||||
return NULL;
|
||||
}
|
||||
|
27
L2C_Server/world/model/base/ClassIdTree.h
Normal file
27
L2C_Server/world/model/base/ClassIdTree.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
#include "Race.h"
|
||||
#include "ClassId.h"
|
||||
|
||||
class ClassIdTree
|
||||
{
|
||||
protected:
|
||||
static ClassIdTree *_instance;
|
||||
static int _refCount;
|
||||
public:
|
||||
static ClassIdTree *getInstance();
|
||||
static void freeInstance();
|
||||
enum NumClassIds { NUM_CLASS_IDS = 137 };
|
||||
|
||||
protected:
|
||||
ClassIdTree();
|
||||
~ClassIdTree();
|
||||
void addClassId( int id, const wchar_t *name, bool isMage, bool isSummoner, Race race, int parentId );
|
||||
|
||||
public:
|
||||
const ClassId *getClassId( int class_id ) const;
|
||||
const ClassId *getParentClassId( int class_id ) const;
|
||||
|
||||
protected:
|
||||
// array to hold class tree info
|
||||
ClassId *m_class[NUM_CLASS_IDS]; // 136 classes
|
||||
};
|
11
L2C_Server/world/model/base/Race.h
Normal file
11
L2C_Server/world/model/base/Race.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
enum Race
|
||||
{
|
||||
RACE_Human,
|
||||
RACE_Elf,
|
||||
RACE_DarkElf,
|
||||
RACE_Orc,
|
||||
RACE_Dwarf,
|
||||
RACE_Kamael
|
||||
};
|
45
L2C_Server/world/model/character/GameCharacter.cpp
Normal file
45
L2C_Server/world/model/character/GameCharacter.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
#include "pch.h"
|
||||
#include "GameCharacter.h"
|
||||
|
||||
GameCharacter::GameCharacter( unsigned int objectId ): GameObject( objectId )
|
||||
{
|
||||
m_name = NULL;
|
||||
}
|
||||
|
||||
GameCharacter::~GameCharacter()
|
||||
{
|
||||
if( m_name )
|
||||
{
|
||||
free( m_name );
|
||||
m_name = NULL;
|
||||
}
|
||||
GameObject::~GameObject();
|
||||
}
|
||||
|
||||
void GameCharacter::setName( const wchar_t *name )
|
||||
{
|
||||
if( m_name ) free( m_name );
|
||||
m_name = NULL;
|
||||
if( name ) m_name = _wcsdup( name );
|
||||
}
|
||||
|
||||
void GameCharacter::setLevel( int level )
|
||||
{
|
||||
m_level = level;
|
||||
if( m_level < 0 ) m_level = 0;
|
||||
}
|
||||
|
||||
const wchar_t *GameCharacter::getName() const
|
||||
{
|
||||
return (const wchar_t *)m_name;
|
||||
}
|
||||
|
||||
wchar_t *GameCharacter::toString() const
|
||||
{
|
||||
GameCharacter *nc_this = const_cast<GameCharacter *>(this);
|
||||
if( !nc_this->m_toString_buffer )
|
||||
nc_this->m_toString_buffer = (wchar_t *)malloc( 512 );
|
||||
if( nc_this->m_toString_buffer )
|
||||
swprintf( nc_this->m_toString_buffer, 255, L"%s lvl %d [oid %u]", m_name, m_level, m_objectId );
|
||||
return m_toString_buffer;
|
||||
}
|
24
L2C_Server/world/model/character/GameCharacter.h
Normal file
24
L2C_Server/world/model/character/GameCharacter.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
#include "../GameObject.h"
|
||||
|
||||
class GameCharacter: public GameObject
|
||||
{
|
||||
public:
|
||||
GameCharacter( unsigned int objectId );
|
||||
virtual ~GameCharacter();
|
||||
|
||||
public:
|
||||
void setName( const wchar_t *name );
|
||||
void setLevel( int level );
|
||||
|
||||
public:
|
||||
const wchar_t *getName() const;
|
||||
int getLevel() const { return m_level; }
|
||||
|
||||
public:
|
||||
virtual wchar_t *toString() const;
|
||||
|
||||
protected:
|
||||
wchar_t *m_name;
|
||||
int m_level;
|
||||
};
|
11
L2C_Server/world/model/character/GameNpc.cpp
Normal file
11
L2C_Server/world/model/character/GameNpc.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#include "pch.h"
|
||||
#include "GameNpc.h"
|
||||
|
||||
GameNpc::GameNpc( unsigned int objectId, int npcTemplateId ): GameCharacter( objectId )
|
||||
{
|
||||
m_npcTemplateId = npcTemplateId;
|
||||
}
|
||||
|
||||
GameNpc::~GameNpc()
|
||||
{
|
||||
}
|
18
L2C_Server/world/model/character/GameNpc.h
Normal file
18
L2C_Server/world/model/character/GameNpc.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
#include "GameCharacter.h"
|
||||
|
||||
class GameNpc: public GameCharacter
|
||||
{
|
||||
public:
|
||||
GameNpc( unsigned int objectId, int npcTemplateId );
|
||||
virtual ~GameNpc();
|
||||
|
||||
public:
|
||||
int getNpcTemplateId() const { return m_npcTemplateId; }
|
||||
|
||||
public:
|
||||
void setNpcTemplateId( int tmplId ) { m_npcTemplateId = tmplId; }
|
||||
|
||||
protected:
|
||||
int m_npcTemplateId;
|
||||
};
|
19
L2C_Server/world/model/character/GamePlayer.cpp
Normal file
19
L2C_Server/world/model/character/GamePlayer.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include "pch.h"
|
||||
#include "Log.h"
|
||||
#include "../../../net/GameClient/GameClient.h"
|
||||
#include "GamePlayer.h"
|
||||
|
||||
GamePlayer::GamePlayer( GameClient *clnt, unsigned int objectId ): GameCharacter( objectId )
|
||||
{
|
||||
m_gameClient = clnt;
|
||||
}
|
||||
|
||||
GamePlayer::~GamePlayer()
|
||||
{
|
||||
m_gameClient = NULL;
|
||||
}
|
||||
|
||||
GameClient *GamePlayer::getGameClient()
|
||||
{
|
||||
return m_gameClient;
|
||||
}
|
16
L2C_Server/world/model/character/GamePlayer.h
Normal file
16
L2C_Server/world/model/character/GamePlayer.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
#include "GameCharacter.h"
|
||||
class GameClient; // forward decl
|
||||
|
||||
class GamePlayer: public GameCharacter
|
||||
{
|
||||
public:
|
||||
GamePlayer( GameClient *clnt, unsigned int objectId );
|
||||
virtual ~GamePlayer();
|
||||
|
||||
public:
|
||||
GameClient *getGameClient();
|
||||
|
||||
protected:
|
||||
GameClient *m_gameClient;
|
||||
};
|
Reference in New Issue
Block a user