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;
|
||||
};
|
||||
385
L2C_Server/world/templates/StatsSet.cpp
Normal file
385
L2C_Server/world/templates/StatsSet.cpp
Normal file
@@ -0,0 +1,385 @@
|
||||
#include "pch.h"
|
||||
#include "StatsSet.h"
|
||||
#include "utils/Debugging.h"
|
||||
#include "utils/Exception.h"
|
||||
#include "l2c_utils.h"
|
||||
|
||||
StatsSet::StatsSet()
|
||||
{
|
||||
m_map.clear();
|
||||
}
|
||||
|
||||
StatsSet::~StatsSet()
|
||||
{
|
||||
m_map.clear();
|
||||
}
|
||||
|
||||
StatsSet::StatsSet( const StatsSet& other )
|
||||
{
|
||||
this->operator=( other );
|
||||
}
|
||||
|
||||
const StatsSet& StatsSet::operator=( const StatsSet& other )
|
||||
{
|
||||
if( this == &other ) return (*this);
|
||||
m_map = other.m_map;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
bool StatsSet::getInt( const char *name, int *val )
|
||||
{
|
||||
std::wstring value;
|
||||
std::string sname( name );
|
||||
std::map<std::string, std::wstring>::const_iterator iter = m_map.find( sname );
|
||||
if( iter == m_map.end() )
|
||||
{
|
||||
throw Exception( "StatsSet: trying to get non-existent Int var [%s] with no default value!", name );
|
||||
//return false; // warning C4702: unreachable code
|
||||
}
|
||||
value = iter->second;
|
||||
int i = 0;
|
||||
int r = swscanf( value.c_str(), L"%d", &i );
|
||||
if( r == 1 )
|
||||
{
|
||||
(*val) = i;
|
||||
return true;
|
||||
}
|
||||
throw Exception( "StatsSet.getInt: failed to scanf %%d from [%s]=[%S]", name, value.c_str() );
|
||||
}
|
||||
|
||||
bool StatsSet::getInt( const char *name, int *val, int defVal )
|
||||
{
|
||||
std::wstring ws;
|
||||
std::wstring ws_def(L"0");
|
||||
getWString( name, ws, ws_def );
|
||||
int v = 0;
|
||||
int r = swscanf( ws.c_str(), L"%d", &v );
|
||||
if( r <= 0 ) (*val) = defVal; // 0 tokens were read by swscanf or EOL reached unexpectedly
|
||||
else (*val) = v;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StatsSet::getUInt( const char *name, unsigned int *val )
|
||||
{
|
||||
std::wstring value;
|
||||
std::string sname( name );
|
||||
std::map<std::string, std::wstring>::const_iterator iter = m_map.find( sname );
|
||||
if( iter == m_map.end() )
|
||||
{
|
||||
throw Exception( "StatsSet: trying to get non-existent UInt var [%s] with no default value!", name );
|
||||
//return false; // warning C4702: unreachable code
|
||||
}
|
||||
value = iter->second;
|
||||
unsigned int ui = 0;
|
||||
int r = swscanf( value.c_str(), L"%u", &ui );
|
||||
if( r == 1 )
|
||||
{
|
||||
(*val) = ui;
|
||||
return true;
|
||||
}
|
||||
throw Exception( "StatsSet.getInt: failed to scanf %%u from [%s]=[%S]", name, value.c_str() );
|
||||
}
|
||||
|
||||
bool StatsSet::getUInt( const char *name, unsigned int *val, unsigned int defVal )
|
||||
{
|
||||
std::wstring ws;
|
||||
std::wstring ws_def(L"0");
|
||||
getWString( name, ws, ws_def );
|
||||
unsigned int v = 0;
|
||||
int r = swscanf( ws.c_str(), L"%u", &v );
|
||||
if( r <= 0 ) (*val) = defVal; // 0 tokens were read by swscanf or EOL reached unexpectedly
|
||||
else (*val) = v;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StatsSet::getInt64( const char *name, long long int *val )
|
||||
{
|
||||
std::wstring value;
|
||||
std::string sname( name );
|
||||
std::map<std::string, std::wstring>::const_iterator iter = m_map.find( sname );
|
||||
if( iter == m_map.end() )
|
||||
{
|
||||
throw Exception( "StatsSet: trying to get non-existent Int64 var [%s] with no default value!", name );
|
||||
//return false; // warning C4702: unreachable code
|
||||
}
|
||||
value = iter->second;
|
||||
long long int i64 = 0;
|
||||
int r = swscanf( value.c_str(), L"%I64d", &i64 );
|
||||
if( r == 1 )
|
||||
{
|
||||
(*val) = i64;
|
||||
return true;
|
||||
}
|
||||
throw Exception( "StatsSet.getInt: failed to scanf %%I64d from [%s]=[%S]", name, value.c_str() );
|
||||
}
|
||||
|
||||
bool StatsSet::getInt64( const char *name, long long int *val, long long int defVal )
|
||||
{
|
||||
std::wstring ws;
|
||||
std::wstring ws_def(L"0");
|
||||
getWString( name, ws, ws_def );
|
||||
long long int v = 0;
|
||||
int r = swscanf( ws.c_str(), L"%I64d", &v );
|
||||
if( r <= 0 ) (*val) = defVal; // 0 tokens were read by swscanf or EOL reached unexpectedly
|
||||
else (*val) = v;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StatsSet::getUInt64( const char *name, unsigned long long int *val )
|
||||
{
|
||||
std::wstring value;
|
||||
std::string sname( name );
|
||||
std::map<std::string, std::wstring>::const_iterator iter = m_map.find( sname );
|
||||
if( iter == m_map.end() )
|
||||
{
|
||||
throw Exception( "StatsSet: trying to get non-existent UInt64 var [%s] with no default value!", name );
|
||||
//return false; // warning C4702: unreachable code
|
||||
}
|
||||
value = iter->second;
|
||||
unsigned long long int ui64 = 0;
|
||||
int r = swscanf( value.c_str(), L"%I64u", &ui64 );
|
||||
if( r == 1 )
|
||||
{
|
||||
(*val) = ui64;
|
||||
return true;
|
||||
}
|
||||
throw Exception( "StatsSet.getInt: failed to scanf %%I64u from [%s]=[%S]", name, value.c_str() );
|
||||
}
|
||||
|
||||
bool StatsSet::getUInt64( const char *name, unsigned long long int *val, unsigned long long int defVal )
|
||||
{
|
||||
std::wstring ws;
|
||||
std::wstring ws_def(L"0");
|
||||
getWString( name, ws, ws_def );
|
||||
unsigned long long int v = 0;
|
||||
int r = swscanf( ws.c_str(), L"%I64u", &v );
|
||||
if( r <= 0 ) (*val) = defVal; // 0 tokens were read by swscanf or EOL reached unexpectedly
|
||||
else (*val) = v;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StatsSet::getDouble( const char *name, double *val )
|
||||
{
|
||||
std::wstring value;
|
||||
std::string sname( name );
|
||||
std::map<std::string, std::wstring>::const_iterator iter = m_map.find( sname );
|
||||
if( iter == m_map.end() )
|
||||
{
|
||||
throw Exception( "StatsSet: trying to get non-existent Double var [%s] with no default value!", name );
|
||||
//return false; // warning C4702: unreachable code
|
||||
}
|
||||
value = iter->second;
|
||||
double lf = 0;
|
||||
int r = swscanf( value.c_str(), L"%lf", &lf );
|
||||
if( r == 1 )
|
||||
{
|
||||
(*val) = lf;
|
||||
return true;
|
||||
}
|
||||
throw Exception( "StatsSet.getInt: failed to scanf %%lf from [%s]=[%S]", name, value.c_str() );
|
||||
}
|
||||
|
||||
bool StatsSet::getDouble( const char *name, double *val, double defVal )
|
||||
{
|
||||
std::wstring ws;
|
||||
std::wstring ws_def(L"0.0");
|
||||
getWString( name, ws, ws_def );
|
||||
double v = 0.0;
|
||||
int r = swscanf( ws.c_str(), L"%lf", &v );
|
||||
if( r <= 0 ) (*val) = defVal; // 0 tokens were read by swscanf or EOL reached unexpectedly
|
||||
else (*val) = v;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StatsSet::getString( const char *name, std::string& val )
|
||||
{
|
||||
std::wstring ws;
|
||||
std::string sname( name );
|
||||
std::map<std::string, std::wstring>::const_iterator iter = m_map.find( sname );
|
||||
if( iter == m_map.end() )
|
||||
{
|
||||
throw Exception( "StatsSet: trying to get non-existent String var [%s] with no default value!", name );
|
||||
//return false; // warning C4702: unreachable code
|
||||
}
|
||||
ws = iter->second;
|
||||
const wchar_t *cws = ws.c_str(); // get wchar_t *
|
||||
char *c_tmp = (char *)malloc( ws.size() + 16 ); // allocate space for Unicode -> ANSI convert
|
||||
if( c_tmp )
|
||||
{
|
||||
l2c_unicode_to_ansi( cws, c_tmp, ws.size()+1 );
|
||||
c_tmp[ws.size()] = 0;
|
||||
val.assign( c_tmp, ws.size() );
|
||||
free( c_tmp );
|
||||
}
|
||||
else val.assign( "malloc() failed" );
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StatsSet::getString( const char *name, std::string& val, std::string& defVal )
|
||||
{
|
||||
std::wstring ws;
|
||||
std::wstring ws_def( L"" );
|
||||
getWString( name, ws, ws_def ); // always returns true
|
||||
const wchar_t *cws = ws.c_str();
|
||||
char *c_tmp = (char *)malloc( ws.size() + 16 );
|
||||
if( c_tmp )
|
||||
{
|
||||
l2c_unicode_to_ansi( cws, c_tmp, ws.size()+1 );
|
||||
c_tmp[ws.size()] = 0;
|
||||
val.assign( c_tmp, ws.size() );
|
||||
free( c_tmp );
|
||||
}
|
||||
else val = defVal;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StatsSet::getWString( const char *name, std::wstring& val )
|
||||
{
|
||||
std::string sname( name );
|
||||
std::map<std::string, std::wstring>::const_iterator iter = m_map.find( sname );
|
||||
if( iter == m_map.end() )
|
||||
{
|
||||
throw Exception( "StatsSet: trying to get non-existent WString var [%s] with no default value!", name );
|
||||
//return false; // warning C4702: unreachable code
|
||||
}
|
||||
val = iter->second;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StatsSet::getWString( const char *name, std::wstring& val, std::wstring& defVal )
|
||||
{
|
||||
std::string sname( name );
|
||||
std::map<std::string, std::wstring>::const_iterator iter = m_map.find( sname );
|
||||
if( iter == m_map.end() )
|
||||
{
|
||||
val = defVal;
|
||||
return true;
|
||||
}
|
||||
val = iter->second;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StatsSet::getBool( const char *name, bool *val )
|
||||
{
|
||||
std::wstring value;
|
||||
std::string sname( name );
|
||||
std::map<std::string, std::wstring>::const_iterator iter = m_map.find( sname );
|
||||
if( iter == m_map.end() )
|
||||
{
|
||||
throw Exception( "StatsSet: trying to get non-existent Bool var [%s] with no default value!", name );
|
||||
//return false; // warning C4702: unreachable code
|
||||
}
|
||||
value = iter->second;
|
||||
int i = 0;
|
||||
swscanf( value.c_str(), L"%d", &i );
|
||||
(*val) = (bool)(i != 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StatsSet::getBool( const char *name, bool *val, bool defVal )
|
||||
{
|
||||
std::wstring value;
|
||||
std::string sname( name );
|
||||
std::map<std::string, std::wstring>::const_iterator iter = m_map.find( sname );
|
||||
if( iter == m_map.end() )
|
||||
{
|
||||
(*val) = defVal;
|
||||
return true;
|
||||
}
|
||||
value = iter->second;
|
||||
int i = 0;
|
||||
swscanf( value.c_str(), L"%d", &i );
|
||||
(*val) = (bool)(i != 0);
|
||||
return true; // defVal funcs never return false and never throw exceptions
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool StatsSet::setInt( const char *name, int val )
|
||||
{
|
||||
std::string sname( name );
|
||||
wchar_t wval[32];
|
||||
swprintf( wval, 31, L"%d", val );
|
||||
std::wstring v( wval );
|
||||
m_map[name] = v;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StatsSet::setUInt( const char *name, unsigned int val )
|
||||
{
|
||||
std::string sname( name );
|
||||
wchar_t wval[32];
|
||||
swprintf( wval, 31, L"%u", val );
|
||||
std::wstring v( wval );
|
||||
m_map[name] = v;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StatsSet::setInt64( const char *name, long long int val )
|
||||
{
|
||||
std::string sname( name );
|
||||
wchar_t wval[32];
|
||||
swprintf( wval, 31, L"%I64d", val );
|
||||
std::wstring v( wval );
|
||||
m_map[name] = v;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StatsSet::setUInt64( const char *name, unsigned long long int val )
|
||||
{
|
||||
std::string sname( name );
|
||||
wchar_t wval[32];
|
||||
swprintf( wval, 31, L"%I64u", val );
|
||||
std::wstring v( wval );
|
||||
m_map[name] = v;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StatsSet::setDouble( const char *name, double val )
|
||||
{
|
||||
std::string sname( name );
|
||||
wchar_t wval[32];
|
||||
swprintf( wval, 31, L"%0.20f", val );
|
||||
std::wstring v( wval );
|
||||
m_map[name] = v;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StatsSet::setString( const char *name, std::string& val )
|
||||
{
|
||||
std::string sname( name );
|
||||
wchar_t *wval = (wchar_t *)malloc( (val.size()+16) * sizeof(wchar_t) );
|
||||
if( wval )
|
||||
{
|
||||
swprintf( wval, val.size()+1, L"%S", val.c_str() );
|
||||
std::wstring v( wval );
|
||||
m_map[sname] = v;
|
||||
free( wval );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool StatsSet::setString( const char *name, const char *val )
|
||||
{
|
||||
std::string sval( val );
|
||||
return setString( name, sval );
|
||||
}
|
||||
|
||||
bool StatsSet::setWString( const char *name, const wchar_t *val )
|
||||
{
|
||||
std::wstring sval( val );
|
||||
return setWString( name, sval );
|
||||
}
|
||||
|
||||
bool StatsSet::setWString( const char *name, std::wstring& val )
|
||||
{
|
||||
std::string sname( name );
|
||||
m_map[sname] = val;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StatsSet::setBool( const char *name, bool val )
|
||||
{
|
||||
return setInt( name, (int)val );
|
||||
}
|
||||
44
L2C_Server/world/templates/StatsSet.h
Normal file
44
L2C_Server/world/templates/StatsSet.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
class StatsSet
|
||||
{
|
||||
public:
|
||||
StatsSet();
|
||||
~StatsSet();
|
||||
StatsSet( const StatsSet& other );
|
||||
const StatsSet& operator=( const StatsSet& other );
|
||||
|
||||
public:
|
||||
bool getInt( const char *name, int *val );
|
||||
bool getInt( const char *name, int *val, int defVal );
|
||||
bool getUInt( const char *name, unsigned int *val );
|
||||
bool getUInt( const char *name, unsigned int *val, unsigned int defVal );
|
||||
bool getInt64( const char *name, long long int *val );
|
||||
bool getInt64( const char *name, long long int *val, long long int defVal );
|
||||
bool getUInt64( const char *name, unsigned long long int *val );
|
||||
bool getUInt64( const char *name, unsigned long long int *val, unsigned long long int defVal );
|
||||
bool getDouble( const char *name, double *val );
|
||||
bool getDouble( const char *name, double *val, double defVal );
|
||||
bool getString( const char *name, std::string& val );
|
||||
bool getString( const char *name, std::string& val, std::string& defVal );
|
||||
bool getWString( const char *name, std::wstring& val );
|
||||
bool getWString( const char *name, std::wstring& val, std::wstring& defVal );
|
||||
bool getBool( const char *name, bool *val );
|
||||
bool getBool( const char *name, bool *val, bool defVal );
|
||||
|
||||
public:
|
||||
bool setInt( const char *name, int val );
|
||||
bool setUInt( const char *name, unsigned int val );
|
||||
bool setInt64( const char *name, long long int val );
|
||||
bool setUInt64( const char *name, unsigned long long int val );
|
||||
bool setDouble( const char *name, double val );
|
||||
bool setString( const char *name, std::string& val );
|
||||
bool setString( const char *name, const char *val );
|
||||
bool setWString( const char *name, std::wstring& val );
|
||||
bool setWString( const char *name, const wchar_t *val );
|
||||
bool setBool( const char *name, bool val );
|
||||
|
||||
protected:
|
||||
// map of pair: <"name", L"value">
|
||||
std::map<std::string, std::wstring> m_map;
|
||||
};
|
||||
79
L2C_Server/world/templates/chars/L2CharTemplate.cpp
Normal file
79
L2C_Server/world/templates/chars/L2CharTemplate.cpp
Normal file
@@ -0,0 +1,79 @@
|
||||
#include "pch.h"
|
||||
#include "L2CharTemplate.h"
|
||||
|
||||
L2CharTemplate::L2CharTemplate( StatsSet& set )
|
||||
{
|
||||
// Base stats
|
||||
set.getInt( "baseSTR", &baseSTR );
|
||||
set.getInt( "baseCON", &baseCON );
|
||||
set.getInt( "baseDEX", &baseDEX );
|
||||
set.getInt( "baseINT", &baseINT );
|
||||
set.getInt( "baseWIT", &baseWIT );
|
||||
set.getInt( "baseMEN", &baseMEN );
|
||||
set.getDouble( "baseHpMax", &baseHpMax );
|
||||
set.getDouble( "baseCpMax", &baseCpMax );
|
||||
set.getDouble( "baseMpMax", &baseMpMax );
|
||||
set.getDouble( "baseHpReg", &baseHpReg );
|
||||
set.getDouble( "baseMpReg", &baseMpReg );
|
||||
set.getInt( "basePAtk", &basePAtk );
|
||||
set.getInt( "baseMAtk", &baseMAtk );
|
||||
set.getInt( "basePDef", &basePDef );
|
||||
set.getInt( "baseMDef", &baseMDef );
|
||||
set.getInt( "basePAtkSpd", &basePAtkSpd );
|
||||
set.getInt( "baseMAtkSpd", &baseMAtkSpd );
|
||||
set.getDouble( "baseMReuseDelay", &baseMReuseRate, 1.0 );
|
||||
set.getInt( "baseShldDef", &baseShldDef );
|
||||
set.getInt( "baseAtkRange", &baseAtkRange );
|
||||
set.getInt( "baseShldRate", &baseShldRate );
|
||||
set.getInt( "baseCritRate", &baseCritRate );
|
||||
set.getInt( "baseMCritRate", &baseMCritRate, 80 ); // CT2: The magic critical rate has been increased to 10 times.
|
||||
set.getInt( "baseWalkSpd", &baseWalkSpd );
|
||||
set.getInt( "baseRunSpd", &baseRunSpd );
|
||||
|
||||
// missed base stats
|
||||
set.getInt( "baseAccuracy", &baseAccuracy );
|
||||
set.getInt( "baseEvasion", &baseEvasion );
|
||||
|
||||
// SpecialStats
|
||||
set.getInt( "baseBreath", &baseBreath, 100 );
|
||||
set.getInt( "baseAggression", &baseAggression, 0 );
|
||||
set.getInt( "baseBleed", &baseBleed, 0 );
|
||||
set.getInt( "basePoison", &basePoison, 0 );
|
||||
set.getInt( "baseStun", &baseStun, 0 );
|
||||
set.getInt( "baseRoot", &baseRoot, 0 );
|
||||
set.getInt( "baseMovement", &baseMovement, 0 );
|
||||
set.getInt( "baseConfusion", &baseConfusion, 0 );
|
||||
set.getInt( "baseSleep", &baseSleep, 0 );
|
||||
set.getInt( "baseFire", &baseFire, 0 );
|
||||
set.getInt( "baseWind", &baseWind, 0 );
|
||||
set.getInt( "baseWater", &baseWater, 0 );
|
||||
set.getInt( "baseEarth", &baseEarth, 0 );
|
||||
set.getInt( "baseHoly", &baseHoly, 0 );
|
||||
set.getInt( "baseDark", &baseDark, 0 );
|
||||
set.getDouble( "baseAaggressionVuln", &baseAggressionVuln, 1.0 );
|
||||
set.getDouble( "baseBleedVuln", &baseBleedVuln, 1.0 );
|
||||
set.getDouble( "basePoisonVuln", &basePoisonVuln, 1.0 );
|
||||
set.getDouble( "baseStunVuln", &baseStunVuln, 1.0 );
|
||||
set.getDouble( "baseRootVuln", &baseRootVuln, 1.0 );
|
||||
set.getDouble( "baseMovementVuln", &baseMovementVuln, 1.0 );
|
||||
set.getDouble( "baseConfusionVuln", &baseConfusionVuln, 1.0 );
|
||||
set.getDouble( "baseSleepVuln", &baseSleepVuln, 1.0 );
|
||||
set.getDouble( "baseFireRes", &baseFireRes, 0.0 );
|
||||
set.getDouble( "baseWindRes", &baseWindRes, 0.0 );
|
||||
set.getDouble( "baseWaterRes", &baseWaterRes, 0.0 );
|
||||
set.getDouble( "baseEarthRes", &baseEarthRes, 0.0 );
|
||||
set.getDouble( "baseHolyRes", &baseHolyRes, 0.0 );
|
||||
set.getDouble( "baseDarkRes", &baseDarkRes, 0.0 );
|
||||
set.getDouble( "baseCritVuln", &baseCritVuln, 1.0 );
|
||||
|
||||
// undead? default NO
|
||||
set.getBool( "isUndead", &isUndead, false );
|
||||
|
||||
//C4 Stats
|
||||
set.getInt( "baseMpConsumeRate", &baseMpConsumeRate, 0 );
|
||||
set.getInt( "baseHpConsumeRate", &baseHpConsumeRate, 0 );
|
||||
|
||||
// Geometry
|
||||
set.getInt( "collision_radius", &collisionRadius, 10 );
|
||||
set.getInt( "collision_height", &collisionHeight, 10 );
|
||||
}
|
||||
81
L2C_Server/world/templates/chars/L2CharTemplate.h
Normal file
81
L2C_Server/world/templates/chars/L2CharTemplate.h
Normal file
@@ -0,0 +1,81 @@
|
||||
#pragma once
|
||||
#include "world/templates/StatsSet.h"
|
||||
|
||||
class L2CharTemplate
|
||||
{
|
||||
public:
|
||||
L2CharTemplate( StatsSet& set );
|
||||
|
||||
public:
|
||||
// BaseStats
|
||||
int baseSTR;
|
||||
int baseCON;
|
||||
int baseDEX;
|
||||
int baseINT;
|
||||
int baseWIT;
|
||||
int baseMEN;
|
||||
double baseHpMax;
|
||||
double baseCpMax;
|
||||
double baseMpMax;
|
||||
double baseHpReg;
|
||||
double baseMpReg;
|
||||
|
||||
int basePAtk;
|
||||
int baseMAtk;
|
||||
int basePDef;
|
||||
int baseMDef;
|
||||
int basePAtkSpd;
|
||||
int baseMAtkSpd;
|
||||
double baseMReuseRate;
|
||||
int baseShldDef;
|
||||
int baseAtkRange;
|
||||
int baseShldRate;
|
||||
int baseCritRate;
|
||||
int baseMCritRate;
|
||||
int baseWalkSpd;
|
||||
int baseRunSpd;
|
||||
// missed base stats
|
||||
int baseAccuracy;
|
||||
int baseEvasion;
|
||||
|
||||
// SpecialStats
|
||||
int baseBreath;
|
||||
int baseAggression;
|
||||
int baseBleed;
|
||||
int basePoison;
|
||||
int baseStun;
|
||||
int baseRoot;
|
||||
int baseMovement;
|
||||
int baseConfusion;
|
||||
int baseSleep;
|
||||
int baseFire;
|
||||
int baseWind;
|
||||
int baseWater;
|
||||
int baseEarth;
|
||||
int baseHoly;
|
||||
int baseDark;
|
||||
double baseAggressionVuln;
|
||||
double baseBleedVuln;
|
||||
double basePoisonVuln;
|
||||
double baseStunVuln;
|
||||
double baseRootVuln;
|
||||
double baseMovementVuln;
|
||||
double baseConfusionVuln;
|
||||
double baseSleepVuln;
|
||||
double baseFireRes;
|
||||
double baseWindRes;
|
||||
double baseWaterRes;
|
||||
double baseEarthRes;
|
||||
double baseHolyRes;
|
||||
double baseDarkRes;
|
||||
double baseCritVuln;
|
||||
|
||||
bool isUndead;
|
||||
|
||||
//C4 Stats
|
||||
int baseMpConsumeRate;
|
||||
int baseHpConsumeRate;
|
||||
|
||||
int collisionRadius;
|
||||
int collisionHeight;
|
||||
};
|
||||
83
L2C_Server/world/templates/chars/L2PlayerTemplate.cpp
Normal file
83
L2C_Server/world/templates/chars/L2PlayerTemplate.cpp
Normal file
@@ -0,0 +1,83 @@
|
||||
#include "pch.h"
|
||||
#include "L2PlayerTemplate.h"
|
||||
|
||||
L2PlayerTemplate::L2PlayerTemplate( StatsSet& set ): L2CharTemplate( set )
|
||||
{
|
||||
set.getInt( "classId", &iClassId );
|
||||
classId = ClassIdTree::getInstance()->getClassId( iClassId );
|
||||
set.getInt( "raceId", (int *)&race );
|
||||
|
||||
set.getInt( "spawnX", &spawnX );
|
||||
set.getInt( "spawnY", &spawnY );
|
||||
set.getInt( "spawnZ", &spawnZ );
|
||||
|
||||
set.getInt( "classBaseLevel", &classBaseLevel );
|
||||
|
||||
set.getDouble( "lvlHpAdd", &lvlHpAdd );
|
||||
set.getDouble( "lvlHpMod", &lvlHpMod );
|
||||
set.getDouble( "lvlCpAdd", &lvlCpAdd );
|
||||
set.getDouble( "lvlCpMod", &lvlCpMod );
|
||||
set.getDouble( "lvlMpAdd", &lvlMpAdd );
|
||||
set.getDouble( "lvlMpMod", &lvlMpMod );
|
||||
|
||||
// missed loaded vars
|
||||
set.getInt( "baseLoad", &baseLoad, 62500 );
|
||||
set.getBool( "canCraft", &canCraft, false );
|
||||
}
|
||||
|
||||
void L2PlayerTemplate::addItem( int itemId, int amount, bool equipped )
|
||||
{
|
||||
PcTemplateItem it( itemId, amount, equipped );
|
||||
m_items.push_back( it );
|
||||
}
|
||||
|
||||
const std::list<L2PlayerTemplate::PcTemplateItem>& L2PlayerTemplate::getItems() const
|
||||
{
|
||||
return m_items;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
L2PlayerTemplate::PcTemplateItem::PcTemplateItem()
|
||||
{
|
||||
m_itemId = 0;
|
||||
m_amount = 0;
|
||||
m_equipped = false;
|
||||
}
|
||||
|
||||
L2PlayerTemplate::PcTemplateItem::PcTemplateItem( int itemId, int amount, bool equipped )
|
||||
{
|
||||
m_itemId = itemId;
|
||||
m_amount = amount;
|
||||
m_equipped = equipped;
|
||||
}
|
||||
|
||||
L2PlayerTemplate::PcTemplateItem::PcTemplateItem( const L2PlayerTemplate::PcTemplateItem& other )
|
||||
{
|
||||
this->operator=( other );
|
||||
}
|
||||
|
||||
const L2PlayerTemplate::PcTemplateItem& L2PlayerTemplate::PcTemplateItem::operator=( const L2PlayerTemplate::PcTemplateItem& other )
|
||||
{
|
||||
if( this == &other ) return (*this);
|
||||
m_itemId = other.m_itemId;
|
||||
m_amount = other.m_amount;
|
||||
m_equipped = other.m_equipped;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
int L2PlayerTemplate::PcTemplateItem::getItemId() const
|
||||
{
|
||||
return m_itemId;
|
||||
}
|
||||
|
||||
int L2PlayerTemplate::PcTemplateItem::getAmount() const
|
||||
{
|
||||
return m_amount;
|
||||
}
|
||||
|
||||
bool L2PlayerTemplate::PcTemplateItem::isEquipped() const
|
||||
{
|
||||
return m_equipped;
|
||||
}
|
||||
53
L2C_Server/world/templates/chars/L2PlayerTemplate.h
Normal file
53
L2C_Server/world/templates/chars/L2PlayerTemplate.h
Normal file
@@ -0,0 +1,53 @@
|
||||
#pragma once
|
||||
#include "L2CharTemplate.h"
|
||||
#include "world/model/base/ClassId.h"
|
||||
#include "world/model/base/ClassIdTree.h"
|
||||
#include "world/model/base/Race.h"
|
||||
|
||||
class L2PlayerTemplate: public L2CharTemplate
|
||||
{
|
||||
public: // class for template item
|
||||
class PcTemplateItem
|
||||
{
|
||||
public:
|
||||
PcTemplateItem();
|
||||
PcTemplateItem( int itemId, int amount, bool equipped );
|
||||
PcTemplateItem( const PcTemplateItem& other );
|
||||
const PcTemplateItem& operator=( const PcTemplateItem& other );
|
||||
int getItemId() const;
|
||||
int getAmount() const;
|
||||
bool isEquipped() const;
|
||||
protected:
|
||||
int m_itemId;
|
||||
int m_amount;
|
||||
bool m_equipped;
|
||||
};
|
||||
|
||||
public:
|
||||
L2PlayerTemplate( StatsSet& set );
|
||||
void addItem( int itemId, int amount, bool equipped );
|
||||
const std::list<L2PlayerTemplate::PcTemplateItem>& getItems() const;
|
||||
|
||||
public:
|
||||
int iClassId;
|
||||
const ClassId *classId;
|
||||
Race race;
|
||||
|
||||
int spawnX;
|
||||
int spawnY;
|
||||
int spawnZ;
|
||||
|
||||
int classBaseLevel;
|
||||
double lvlHpAdd;
|
||||
double lvlHpMod;
|
||||
double lvlCpAdd;
|
||||
double lvlCpMod;
|
||||
double lvlMpAdd;
|
||||
double lvlMpMod;
|
||||
|
||||
int baseLoad;
|
||||
bool canCraft;
|
||||
|
||||
protected:
|
||||
std::list<L2PlayerTemplate::PcTemplateItem> m_items;
|
||||
};
|
||||
23
L2C_Server/world/templates/item/L2ArmorTemplate.cpp
Normal file
23
L2C_Server/world/templates/item/L2ArmorTemplate.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#include "pch.h"
|
||||
#include "L2ArmorTemplate.h"
|
||||
#include "l2c_utils.h"
|
||||
|
||||
L2ArmorTemplate::L2ArmorTemplate( L2ItemSubType subType, StatsSet& set ):
|
||||
L2ItemTemplate( TYPE_ARMOR, subType, set )
|
||||
{
|
||||
set.getInt( "avoid_modify", &m_avoidModifier );
|
||||
set.getInt( "p_def", &m_pDef, 0 );
|
||||
set.getInt( "m_def", &m_mDef, 0 );
|
||||
set.getInt( "mp_bonus", &m_mpBonus, 0 );
|
||||
set.getInt( "hp_bonus", &m_hpBonus, 0 );
|
||||
m_enchant4Skill = 0;
|
||||
std::string stds;
|
||||
set.getString( "enchant4_skill", stds );
|
||||
//String[] skill = set.getString("enchant4_skill").split("-");
|
||||
//_skill = set.getString("skill").split(";");
|
||||
set.getString( "skill", stds );
|
||||
}
|
||||
|
||||
L2ArmorTemplate::~L2ArmorTemplate()
|
||||
{
|
||||
}
|
||||
25
L2C_Server/world/templates/item/L2ArmorTemplate.h
Normal file
25
L2C_Server/world/templates/item/L2ArmorTemplate.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
#include "L2ItemTemplate.h"
|
||||
|
||||
class L2ArmorTemplate: public L2ItemTemplate
|
||||
{
|
||||
public:
|
||||
L2ArmorTemplate( L2ItemSubType subType, StatsSet& set );
|
||||
virtual ~L2ArmorTemplate();
|
||||
|
||||
public:
|
||||
int getAvoidModifier() const { return m_avoidModifier; }
|
||||
int getPDef() const { return m_pDef; }
|
||||
int getMDef() const { return m_mDef; }
|
||||
int getMPBonus() const { return m_mpBonus; }
|
||||
int getHPBonus() const { return m_hpBonus; }
|
||||
int getEnchant4Skill() const { return m_enchant4Skill; }
|
||||
|
||||
protected:
|
||||
int m_avoidModifier;
|
||||
int m_pDef;
|
||||
int m_mDef;
|
||||
int m_mpBonus;
|
||||
int m_hpBonus;
|
||||
unsigned int m_enchant4Skill; // skill that activates when armor is enchanted +4
|
||||
};
|
||||
13
L2C_Server/world/templates/item/L2EtcItemTemplate.cpp
Normal file
13
L2C_Server/world/templates/item/L2EtcItemTemplate.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#include "pch.h"
|
||||
#include "L2EtcItemTemplate.h"
|
||||
#include "l2c_utils.h"
|
||||
|
||||
L2EtcItemTemplate::L2EtcItemTemplate( L2ItemSubType subType, StatsSet& set ):
|
||||
L2ItemTemplate( TYPE_ETCITEM, subType, set )
|
||||
{
|
||||
set.getString( "handler", m_handler );
|
||||
}
|
||||
|
||||
L2EtcItemTemplate::~L2EtcItemTemplate()
|
||||
{
|
||||
}
|
||||
16
L2C_Server/world/templates/item/L2EtcItemTemplate.h
Normal file
16
L2C_Server/world/templates/item/L2EtcItemTemplate.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
#include "L2ItemTemplate.h"
|
||||
|
||||
class L2EtcItemTemplate: public L2ItemTemplate
|
||||
{
|
||||
public:
|
||||
L2EtcItemTemplate( L2ItemSubType subType, StatsSet& set );
|
||||
virtual ~L2EtcItemTemplate();
|
||||
|
||||
public:
|
||||
const char *getHandler() const { return m_handler.c_str(); }
|
||||
|
||||
protected:
|
||||
std::string m_handler;
|
||||
// TODO: skills?
|
||||
};
|
||||
191
L2C_Server/world/templates/item/L2ItemTemplate.cpp
Normal file
191
L2C_Server/world/templates/item/L2ItemTemplate.cpp
Normal file
@@ -0,0 +1,191 @@
|
||||
#include "pch.h"
|
||||
#include "L2ItemTemplate.h"
|
||||
#include "l2c_utils.h"
|
||||
#include "Log.h"
|
||||
|
||||
L2ItemTemplate::L2ItemTemplate( L2ItemType itemType, L2ItemSubType subType, StatsSet& set )
|
||||
{
|
||||
m_type = itemType;
|
||||
m_subType = subType;
|
||||
int temp_i;
|
||||
// id
|
||||
set.getInt( "item_id", &m_itemId );
|
||||
// name
|
||||
std::wstring wstr_name;
|
||||
set.getWString( "name", wstr_name );
|
||||
m_name = NULL;
|
||||
if( wstr_name.length() > 0 )
|
||||
m_name = _wcsdup( wstr_name.c_str() );
|
||||
set.getInt( "type1", &m_type1, 0 );
|
||||
set.getInt( "type2", &m_type2, 0 );
|
||||
set.getInt( "weight", &m_weight, 0 );
|
||||
set.getBool( "crystallizable", &m_crystallizable, false );
|
||||
set.getBool( "stackable", &m_stackable, false );
|
||||
set.getInt( "material", (int *)&m_materialType );
|
||||
set.getInt( "crystal_type", (int *)&m_crystalType, (int)CRYSTAL_NONE ); // default to none-grade
|
||||
set.getInt( "duration", &m_duration ); // default 0 or -1?
|
||||
set.getInt( "time", &m_time ); // default seems to be -1
|
||||
set.getInt( "bodypart", &temp_i );
|
||||
m_bodyPart = (L2ItemSlot)temp_i;
|
||||
set.getInt( "price", &m_referencePrice );
|
||||
set.getInt( "crystal_count", &m_crystalCount, 0 );
|
||||
set.getBool( "sellable", &m_sellable, true );
|
||||
set.getBool( "dropable", &m_dropable, true );
|
||||
set.getBool( "destroyable", &m_destroyable, true );
|
||||
set.getBool( "tradeable", &m_tradeable, true );
|
||||
// checks by item id
|
||||
m_common = (m_itemId >= 12006 && m_itemId <= 12361) || (m_itemId >= 11605 && m_itemId <= 12308);
|
||||
m_heroItem = (m_itemId >= 6611 && m_itemId <= 6621) || (m_itemId >= 9388 && m_itemId <= 9390) || m_itemId == 6842;
|
||||
m_pvpItem = (m_itemId >= 10667 && m_itemId <= 10792) || (m_itemId >= 10793 && m_itemId <= 10835) || (m_itemId >= 12852 && m_itemId <= 12977) || (m_itemId >= 14363 && m_itemId <= 14519) || (m_itemId >= 14520 && m_itemId <= 14525) || m_itemId == 14528 || m_itemId == 14529 || m_itemId == 14558;
|
||||
}
|
||||
|
||||
L2ItemTemplate::~L2ItemTemplate()
|
||||
{
|
||||
if( m_name )
|
||||
{
|
||||
free( m_name );
|
||||
m_name = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
L2ItemSubType L2ItemTemplate::getArmorTypeByName( const char *name )
|
||||
{
|
||||
L2ItemSubType ret = SYBTYPE_INCORRECT;
|
||||
if( !name ) return ret;
|
||||
if( _stricmp( name, "none" ) == 0 ) ret = ARMOR_NONE;
|
||||
else if( _stricmp( name, "light" ) == 0 ) ret = ARMOR_LIGHT;
|
||||
else if( _stricmp( name, "heavy" ) == 0 ) ret = ARMOR_HEAVY;
|
||||
else if( _stricmp( name, "magic" ) == 0 ) ret = ARMOR_MAGIC;
|
||||
else if( _stricmp( name, "pet" ) == 0 ) ret = ARMOR_PET;
|
||||
else if( _stricmp( name, "sigil" ) == 0 ) ret = ARMOR_SIGIL;
|
||||
if( ret == SYBTYPE_INCORRECT )
|
||||
LogWarning( L"L2ItemTemplate::getArmorTypeByName(): unknown name [%S]", name );
|
||||
return ret;
|
||||
}
|
||||
|
||||
L2ItemSubType L2ItemTemplate::getWeaponTypeByName( const char *name )
|
||||
{
|
||||
L2ItemSubType ret = SYBTYPE_INCORRECT;
|
||||
if( !name ) return ret;
|
||||
if( _stricmp( name, "none" ) == 0 ) ret = WEAPON_NONE; // shield
|
||||
else if( _stricmp( name, "sword" ) == 0 ) ret = WEAPON_SWORD;
|
||||
else if( _stricmp( name, "blunt" ) == 0 ) ret = WEAPON_BLUNT;
|
||||
else if( _stricmp( name, "dagger" ) == 0 ) ret = WEAPON_DAGGER;
|
||||
else if( _stricmp( name, "bow" ) == 0 ) ret = WEAPON_BOW;
|
||||
else if( _stricmp( name, "pole" ) == 0 ) ret = WEAPON_POLE;
|
||||
else if( _stricmp( name, "etc" ) == 0 ) ret = WEAPON_ETC;
|
||||
else if( _stricmp( name, "fist" ) == 0 ) ret = WEAPON_FIST;
|
||||
else if( _stricmp( name, "dual" ) == 0 ) ret = WEAPON_DUAL;
|
||||
else if( _stricmp( name, "dualfist" ) == 0 ) ret = WEAPON_DUALFIST;
|
||||
else if( _stricmp( name, "bigsword" ) == 0 ) ret = WEAPON_BIGSWORD;
|
||||
else if( _stricmp( name, "pet" ) == 0 ) ret = WEAPON_PET;
|
||||
else if( _stricmp( name, "rod" ) == 0 ) ret = WEAPON_ROD;
|
||||
else if( _stricmp( name, "bigblunt" ) == 0 ) ret = WEAPON_BIGBLUNT;
|
||||
else if( _stricmp( name, "ancient" ) == 0 ) ret = WEAPON_ANCIENT_SWORD;
|
||||
else if( _stricmp( name, "crossbow" ) == 0 ) ret = WEAPON_CROSSBOW;
|
||||
else if( _stricmp( name, "rapier" ) == 0 ) ret = WEAPON_RAPIER;
|
||||
else if( _stricmp( name, "dualdagger" ) == 0 ) ret = WEAPON_DUAL_DAGGER;
|
||||
if( ret == SYBTYPE_INCORRECT )
|
||||
LogWarning( L"L2ItemTemplate::getWeaponTypeByName(): unknown name [%S]", name );
|
||||
return ret;
|
||||
}
|
||||
|
||||
L2ItemSlot L2ItemTemplate::getSlotByName( const char *name )
|
||||
{
|
||||
if( !name ) return SLOT_NONE;
|
||||
L2ItemSlot ret = SLOT_NONE;
|
||||
//
|
||||
if( _stricmp( name, "shirt" ) == 0 ) ret = SLOT_UNDERWEAR;
|
||||
else if( _stricmp( name, "lbracelet" ) == 0 ) ret = SLOT_L_BRACELET;
|
||||
else if( _stricmp( name, "rbracelet" ) == 0 ) ret = SLOT_R_BRACELET;
|
||||
else if( _stricmp( name, "talisman" ) == 0 ) ret = SLOT_DECO;
|
||||
else if( _stricmp( name, "chest" ) == 0 ) ret = SLOT_CHEST;
|
||||
else if( _stricmp( name, "fullarmor" ) == 0 ) ret = SLOT_FULL_ARMOR;
|
||||
else if( _stricmp( name, "head" ) == 0 ) ret = SLOT_HEAD;
|
||||
else if( _stricmp( name, "hair" ) == 0 ) ret = SLOT_HAIR;
|
||||
else if( _stricmp( name, "face" ) == 0 ) ret = SLOT_HAIR2;
|
||||
else if( _stricmp( name, "hair2" ) == 0 ) ret = SLOT_HAIR2;
|
||||
else if( _stricmp( name, "dhair" ) == 0 ) ret = SLOT_HAIRALL;
|
||||
else if( _stricmp( name, "hairall" ) == 0 ) ret = SLOT_HAIRALL;
|
||||
else if( _stricmp( name, "underwear" ) == 0 ) ret = SLOT_UNDERWEAR;
|
||||
else if( _stricmp( name, "back" ) == 0 ) ret = SLOT_BACK;
|
||||
else if( _stricmp( name, "neck" ) == 0 ) ret = SLOT_NECK;
|
||||
else if( _stricmp( name, "legs" ) == 0 ) ret = SLOT_LEGS;
|
||||
else if( _stricmp( name, "feet" ) == 0 ) ret = SLOT_FEET;
|
||||
else if( _stricmp( name, "gloves" ) == 0 ) ret = SLOT_GLOVES;
|
||||
//else if( _stricmp( name, "chest,legs" ) == 0 ) ret = SLOT_CHEST | SLOT_LEGS;
|
||||
else if( _stricmp( name, "belt" ) == 0 ) ret = SLOT_BELT;
|
||||
else if( _stricmp( name, "rhand" ) == 0 ) ret = SLOT_R_HAND;
|
||||
else if( _stricmp( name, "lhand" ) == 0 ) ret = SLOT_L_HAND;
|
||||
else if( _stricmp( name, "lrhand" ) == 0 ) ret = SLOT_LR_HAND;
|
||||
//else if( _stricmp( name, "rear,lear" ) == 0 ) ret = SLOT_R_EAR | SLOT_L_EAR;
|
||||
//else if( _stricmp( name, "rfinger,lfinger" ) == 0 ) ret = SLOT_R_FINGER | SLOT_L_FINGER;
|
||||
else if( _stricmp( name, "wolf" ) == 0 ) ret = SLOT_WOLF;
|
||||
else if( _stricmp( name, "greatwolf" ) == 0 ) ret = SLOT_GREATWOLF;
|
||||
else if( _stricmp( name, "hatchling" ) == 0 ) ret = SLOT_HATCHLING;
|
||||
else if( _stricmp( name, "strider" ) == 0 ) ret = SLOT_STRIDER;
|
||||
else if( _stricmp( name, "babypet" ) == 0 ) ret = SLOT_BABYPET;
|
||||
else if( _stricmp( name, "none" ) == 0 ) ret = SLOT_NONE;
|
||||
//
|
||||
if( ret == -1 )
|
||||
{
|
||||
LogError( L"L2ItemTemplate::getSlotIdByName(): unknown bodypart slot name [%S]", name );
|
||||
return SLOT_NONE;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
L2ItemMaterial L2ItemTemplate::getMaterialByName( const char *name )
|
||||
{
|
||||
if( !name ) return MATERIAL_NONE;
|
||||
L2ItemMaterial ret = MATERIAL_NONE;
|
||||
if( _stricmp( name, "steel" ) == 0 ) ret = MATERIAL_STEEL;
|
||||
else if( _stricmp( name, "fine_steel" ) == 0 ) ret = MATERIAL_FINE_STEEL;
|
||||
else if( _stricmp( name, "blood_steel" ) == 0 ) ret = MATERIAL_BLOOD_STEEL;
|
||||
else if( _stricmp( name, "bronze" ) == 0 ) ret = MATERIAL_BRONZE;
|
||||
else if( _stricmp( name, "silver" ) == 0 ) ret = MATERIAL_SILVER;
|
||||
else if( _stricmp( name, "gold" ) == 0 ) ret = MATERIAL_GOLD;
|
||||
else if( _stricmp( name, "mithril" ) == 0 ) ret = MATERIAL_MITHRIL;
|
||||
else if( _stricmp( name, "oriharukon" ) == 0 ) ret = MATERIAL_ORIHARUKON;
|
||||
else if( _stricmp( name, "paper" ) == 0 ) ret = MATERIAL_PAPER;
|
||||
else if( _stricmp( name, "wood" ) == 0 ) ret = MATERIAL_WOOD;
|
||||
else if( _stricmp( name, "cloth" ) == 0 ) ret = MATERIAL_CLOTH;
|
||||
else if( _stricmp( name, "leather" ) == 0 ) ret = MATERIAL_LEATHER;
|
||||
else if( _stricmp( name, "bone" ) == 0 ) ret = MATERIAL_BONE;
|
||||
else if( _stricmp( name, "horn" ) == 0 ) ret = MATERIAL_HORN;
|
||||
else if( _stricmp( name, "damascus" ) == 0 ) ret = MATERIAL_DAMASCUS;
|
||||
else if( _stricmp( name, "adamantaite" ) == 0 ) ret = MATERIAL_ADAMANTAITE;
|
||||
else if( _stricmp( name, "chrysolite" ) == 0 ) ret = MATERIAL_CHRYSOLITE;
|
||||
else if( _stricmp( name, "crystal" ) == 0 ) ret = MATERIAL_CRYSTAL;
|
||||
else if( _stricmp( name, "liquid" ) == 0 ) ret = MATERIAL_LIQUID;
|
||||
else if( _stricmp( name, "scale_of_dragon" ) == 0 ) ret = MATERIAL_SCALE_OF_DRAGON;
|
||||
else if( _stricmp( name, "dyestuff" ) == 0 ) ret = MATERIAL_DYESTUFF;
|
||||
else if( _stricmp( name, "cobweb" ) == 0 ) ret = MATERIAL_COBWEB;
|
||||
else if( _stricmp( name, "seed" ) == 0 ) ret = MATERIAL_SEED;
|
||||
else if( _stricmp( name, "cotton" ) == 0 ) ret = MATERIAL_COTTON;
|
||||
else
|
||||
{
|
||||
LogError( L"L2ItemTemplate::getMaterialIdByName(): unknown material name [%S]", name );
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
L2ItemCrystal L2ItemTemplate::getCrystalTypeByName( const char *name )
|
||||
{
|
||||
if( !name ) return CRYSTAL_NONE;
|
||||
L2ItemCrystal ret = CRYSTAL_NONE;
|
||||
if( _stricmp( name, "none" ) == 0 ) ret = CRYSTAL_NONE;
|
||||
else if( _stricmp( name, "a" ) == 0 ) ret = CRYSTAL_A;
|
||||
else if( _stricmp( name, "b" ) == 0 ) ret = CRYSTAL_B;
|
||||
else if( _stricmp( name, "c" ) == 0 ) ret = CRYSTAL_C;
|
||||
else if( _stricmp( name, "d" ) == 0 ) ret = CRYSTAL_D;
|
||||
else if( _stricmp( name, "s" ) == 0 ) ret = CRYSTAL_S;
|
||||
else if( _stricmp( name, "s80" ) == 0 ) ret = CRYSTAL_S80;
|
||||
else if( _stricmp( name, "s84" ) == 0 ) ret = CRYSTAL_S84;
|
||||
else
|
||||
{
|
||||
LogError( L"L2ItemTemplate::getCrystalTypeByName(): unknown crystal name [%S]", name );
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
98
L2C_Server/world/templates/item/L2ItemTemplate.h
Normal file
98
L2C_Server/world/templates/item/L2ItemTemplate.h
Normal file
@@ -0,0 +1,98 @@
|
||||
#pragma once
|
||||
#include "L2ItemType.h"
|
||||
#include "../StatsSet.h"
|
||||
|
||||
class L2ItemTemplate
|
||||
{
|
||||
public:
|
||||
static const int TYPE1_WEAPON_RING_EARRING_NECKLACE = 0;
|
||||
static const int TYPE1_SHIELD_ARMOR = 1;
|
||||
static const int TYPE1_ITEM_QUESTITEM_ADENA = 4;
|
||||
|
||||
static const int TYPE2_WEAPON = 0;
|
||||
static const int TYPE2_SHIELD_ARMOR = 1;
|
||||
static const int TYPE2_ACCESSORY = 2;
|
||||
static const int TYPE2_QUEST = 3;
|
||||
static const int TYPE2_MONEY = 4;
|
||||
static const int TYPE2_OTHER = 5;
|
||||
static const int TYPE2_PET_WOLF = 6;
|
||||
static const int TYPE2_PET_HATCHLING = 7;
|
||||
static const int TYPE2_PET_STRIDER = 8;
|
||||
static const int TYPE2_PET_BABY = 9;
|
||||
static const int TYPE2_PET_EVOLVEDWOLF = 10;
|
||||
|
||||
protected:
|
||||
//static const int crystalItemId[] = { 0, 1458, 1459, 1460, 1461, 1462, 1462, 1462 };
|
||||
//static const int crystalEnchantBonusArmor[] = { 0, 11, 6, 11, 19, 25, 25, 25 };
|
||||
//static const int crystalEnchantBonusWeapon[] = { 0, 90, 45, 67, 144, 250, 250, 250 };
|
||||
|
||||
public:
|
||||
L2ItemTemplate( L2ItemType itemType, L2ItemSubType subType, StatsSet& set );
|
||||
virtual ~L2ItemTemplate();
|
||||
|
||||
public:
|
||||
static L2ItemSubType getArmorTypeByName( const char *name );
|
||||
static L2ItemSubType getWeaponTypeByName( const char *name );
|
||||
static L2ItemSlot getSlotByName( const char *name );
|
||||
static L2ItemMaterial getMaterialByName( const char *name );
|
||||
static L2ItemCrystal getCrystalTypeByName( const char *name );
|
||||
|
||||
public:
|
||||
L2ItemType getType() const { return m_type; }
|
||||
L2ItemSubType getSubType() const { return m_subType; }
|
||||
bool isArmor() const { return (m_subType>=ARMOR_NONE) && (m_subType<=ARMOR_SIGIL); }
|
||||
bool isWeapon() const { return (m_subType>=WEAPON_NONE) && (m_subType<=WEAPON_DUAL_DAGGER); }
|
||||
bool isEtcItem() const { return (m_subType>=ETCITEM_ARROW) && (m_subType<=ETCITEM_HERB); }
|
||||
int getId() const { return m_itemId; }
|
||||
const wchar_t *getName() const { return (const wchar_t *)m_name; }
|
||||
int getType1() const { return m_type1; }
|
||||
int getType2() const { return m_type2; }
|
||||
int getWeight() const { return m_weight; }
|
||||
L2ItemMaterial getMaterialType() const { return m_materialType; }
|
||||
L2ItemCrystal getCrystalType() const { return m_crystalType; }
|
||||
int getDuration() const { return m_duration; }
|
||||
int getTime() const { return m_time; }
|
||||
L2ItemSlot getBodyPart() const { return m_bodyPart; }
|
||||
int getPrice() const { return m_referencePrice; }
|
||||
int getCrystalCount() const { return m_crystalCount; }
|
||||
bool isStackable() const { return m_stackable; }
|
||||
bool isCrystallizable() const { return m_crystallizable; }
|
||||
bool isSellable() const { return m_sellable; }
|
||||
bool isDropable() const { return m_dropable; }
|
||||
bool isDestroyable() const { return m_destroyable; }
|
||||
bool isTradeable() const { return m_tradeable; }
|
||||
bool isCommon() const { return m_common; }
|
||||
bool isHeroItem() const { return m_heroItem; }
|
||||
bool isPvpItem() const { return m_pvpItem; }
|
||||
|
||||
protected:
|
||||
L2ItemType m_type; // weapon/armor/etcitem
|
||||
L2ItemSubType m_subType; // type of weapon/type of armor/type of etcitem
|
||||
int m_itemId;
|
||||
wchar_t *m_name;
|
||||
int m_type1;
|
||||
int m_type2;
|
||||
int m_weight;
|
||||
L2ItemMaterial m_materialType;
|
||||
L2ItemCrystal m_crystalType; // default to none-grade
|
||||
int m_duration;
|
||||
int m_time;
|
||||
L2ItemSlot m_bodyPart;
|
||||
int m_referencePrice;
|
||||
int m_crystalCount;
|
||||
bool m_crystallizable;
|
||||
bool m_stackable;
|
||||
bool m_sellable;
|
||||
bool m_dropable;
|
||||
bool m_destroyable;
|
||||
bool m_tradeable;
|
||||
bool m_common;
|
||||
bool m_heroItem;
|
||||
bool m_pvpItem;
|
||||
//protected FuncTemplate[] _funcTemplates;
|
||||
//protected EffectTemplate[] _effectTemplates;
|
||||
//protected L2Skill[] _skills;
|
||||
//protected List <Condition> _preConditions = new FastList<Condition>();
|
||||
//private static final Func[] _emptyFunctionSet = new Func[0];
|
||||
//protected static final L2Effect[] _emptyEffectSet = new L2Effect[0];
|
||||
};
|
||||
132
L2C_Server/world/templates/item/L2ItemType.h
Normal file
132
L2C_Server/world/templates/item/L2ItemType.h
Normal file
@@ -0,0 +1,132 @@
|
||||
#pragma once
|
||||
|
||||
enum L2ItemType
|
||||
{
|
||||
TYPE_WEAPON,
|
||||
TYPE_ARMOR,
|
||||
TYPE_ETCITEM
|
||||
};
|
||||
|
||||
enum L2ItemSubType
|
||||
{
|
||||
SYBTYPE_INCORRECT = 0,
|
||||
// weapons
|
||||
WEAPON_NONE = 1, // "Shield" // mask 2 (2^1)
|
||||
WEAPON_SWORD = 2, // "Sword" // mask 4 (2^2)
|
||||
WEAPON_BLUNT = 3, // "Blunt" // mask 8 (2^3)
|
||||
WEAPON_DAGGER = 4, // "Dagger" // mask 16 (2^4)
|
||||
WEAPON_BOW = 5, // "Bow" // mask 32 (2^5)
|
||||
WEAPON_POLE = 6, // "Pole" // mask 64 (2^6)
|
||||
WEAPON_ETC = 7, // "Etc" // mask 128 (2^7)
|
||||
WEAPON_FIST = 8, // "Fist" // mask 256 (2^8)
|
||||
WEAPON_DUAL = 9, // "Dual Sword" // mask 512 (2^9)
|
||||
WEAPON_DUALFIST = 10, // "Dual Fist" // mask 1024 (2^10)
|
||||
WEAPON_BIGSWORD = 11, // "Big Sword" // Two Handed Swords // mask 2048 (2^11)
|
||||
WEAPON_PET = 12, // "Pet" // mask 4096 (2^12)
|
||||
WEAPON_ROD = 13, // "Rod" // mask 8192 (2^13)
|
||||
WEAPON_BIGBLUNT = 14, // "Big Blunt" // mask 16384 (2^14)
|
||||
WEAPON_ANCIENT_SWORD = 15, // "Ancient Sword" // mask 32768 (2^15)
|
||||
WEAPON_CROSSBOW = 16, // "Crossbow" // mask 65536 (2^16)
|
||||
WEAPON_RAPIER = 17, // "Rapier" // mask 131072 (2^17)
|
||||
WEAPON_DUAL_DAGGER = 18, // "Dual Dagger" // mask 262144 (2^18)
|
||||
// armors
|
||||
ARMOR_NONE = 19, // "None"
|
||||
ARMOR_LIGHT = 20, // "Light"
|
||||
ARMOR_HEAVY = 21, // "Heavy"
|
||||
ARMOR_MAGIC = 22, // "Magic"
|
||||
ARMOR_PET = 23, // "Pet"
|
||||
ARMOR_SIGIL = 24, // "Sigil"
|
||||
// etc items
|
||||
ETCITEM_ARROW = 25, // "Arrow"
|
||||
ETCITEM_BOLT = 26, // "Bolt"
|
||||
ETCITEM_MATERIAL = 27, // "Material"
|
||||
ETCITEM_PET_COLLAR = 28, // "PetCollar"
|
||||
ETCITEM_POTION = 29, // "Potion"
|
||||
ETCITEM_RECEIPE = 30, // "Receipe"
|
||||
ETCITEM_SCROLL = 31, // "Scroll"
|
||||
ETCITEM_QUEST = 32, // "Quest"
|
||||
ETCITEM_MONEY = 33, // "Money"
|
||||
ETCITEM_OTHER = 34, // "Other"
|
||||
ETCITEM_SPELLBOOK = 35, // "Spellbook"
|
||||
ETCITEM_SEED = 36, // "Seed"
|
||||
ETCITEM_SHOT = 37, // "Shot"
|
||||
ETCITEM_HERB = 38, // "Herb"
|
||||
ETCITEM_DYE = 39 // "dye"
|
||||
};
|
||||
|
||||
enum L2ItemSlot
|
||||
{
|
||||
SLOT_NONE = 0x00000000,
|
||||
SLOT_UNDERWEAR = 0x00000001,
|
||||
SLOT_R_EAR = 0x00000002,
|
||||
SLOT_L_EAR = 0x00000004,
|
||||
SLOT_LR_EAR = 0x00000006,
|
||||
SLOT_NECK = 0x00000008,
|
||||
SLOT_R_FINGER = 0x00000010,
|
||||
SLOT_L_FINGER = 0x00000020,
|
||||
SLOT_LR_FINGER = 0x00000030,
|
||||
SLOT_HEAD = 0x00000040,
|
||||
SLOT_R_HAND = 0x00000080,
|
||||
SLOT_L_HAND = 0x00000100,
|
||||
SLOT_GLOVES = 0x00000200,
|
||||
SLOT_CHEST = 0x00000400,
|
||||
SLOT_LEGS = 0x00000800,
|
||||
SLOT_FEET = 0x00001000,
|
||||
SLOT_BACK = 0x00002000,
|
||||
SLOT_LR_HAND = 0x00004000,
|
||||
SLOT_FULL_ARMOR = 0x00008000,
|
||||
SLOT_HAIR = 0x00010000,
|
||||
SLOT_ALLDRESS = 0x00020000,
|
||||
SLOT_HAIR2 = 0x00040000,
|
||||
SLOT_HAIRALL = 0x00080000,
|
||||
SLOT_R_BRACELET = 0x00100000,
|
||||
SLOT_L_BRACELET = 0x00200000,
|
||||
SLOT_DECO = 0x00400000,
|
||||
SLOT_BELT = 0x00800000, //0x10000000,
|
||||
SLOT_WOLF = 0x01000000, //-100,
|
||||
SLOT_HATCHLING = 0x02000000, //-101,
|
||||
SLOT_STRIDER = 0x04000000, //-102,
|
||||
SLOT_BABYPET = 0x08000000, //-103,
|
||||
SLOT_GREATWOLF = 0x10000000 //-104
|
||||
};
|
||||
|
||||
enum L2ItemMaterial
|
||||
{
|
||||
MATERIAL_NONE = -1,
|
||||
MATERIAL_STEEL = 0x00,
|
||||
MATERIAL_FINE_STEEL = 0x01,
|
||||
MATERIAL_BLOOD_STEEL = 0x02,
|
||||
MATERIAL_BRONZE = 0x03,
|
||||
MATERIAL_SILVER = 0x04,
|
||||
MATERIAL_GOLD = 0x05,
|
||||
MATERIAL_MITHRIL = 0x06,
|
||||
MATERIAL_ORIHARUKON = 0x07,
|
||||
MATERIAL_PAPER = 0x08,
|
||||
MATERIAL_WOOD = 0x09,
|
||||
MATERIAL_CLOTH = 0x0a,
|
||||
MATERIAL_LEATHER = 0x0b,
|
||||
MATERIAL_BONE = 0x0c,
|
||||
MATERIAL_HORN = 0x0d,
|
||||
MATERIAL_DAMASCUS = 0x0e,
|
||||
MATERIAL_ADAMANTAITE = 0x0f,
|
||||
MATERIAL_CHRYSOLITE = 0x10,
|
||||
MATERIAL_CRYSTAL = 0x11,
|
||||
MATERIAL_LIQUID = 0x12,
|
||||
MATERIAL_SCALE_OF_DRAGON = 0x13,
|
||||
MATERIAL_DYESTUFF = 0x14,
|
||||
MATERIAL_COBWEB = 0x15,
|
||||
MATERIAL_SEED = 0x16,
|
||||
MATERIAL_COTTON = 0x17
|
||||
};
|
||||
|
||||
enum L2ItemCrystal
|
||||
{
|
||||
CRYSTAL_NONE = 0x00,
|
||||
CRYSTAL_D = 0x01,
|
||||
CRYSTAL_C = 0x02,
|
||||
CRYSTAL_B = 0x03,
|
||||
CRYSTAL_A = 0x04,
|
||||
CRYSTAL_S = 0x05,
|
||||
CRYSTAL_S80 = 0x06,
|
||||
CRYSTAL_S84 = 0x07
|
||||
};
|
||||
30
L2C_Server/world/templates/item/L2WeaponTemplate.cpp
Normal file
30
L2C_Server/world/templates/item/L2WeaponTemplate.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "pch.h"
|
||||
#include "L2WeaponTemplate.h"
|
||||
#include "l2c_utils.h"
|
||||
|
||||
L2WeaponTemplate::L2WeaponTemplate( L2ItemSubType subType, StatsSet& set ):
|
||||
L2ItemTemplate( TYPE_WEAPON, subType, set )
|
||||
{
|
||||
set.getInt( "soulshots", &m_soulShotCount );
|
||||
set.getInt( "soulshots", &m_soulShotCount );
|
||||
set.getInt( "spiritshots", &m_spiritShotCount );
|
||||
set.getInt( "p_dam", &m_pDam );
|
||||
set.getInt( "rnd_dam", &m_rndDam );
|
||||
set.getInt( "critical", &m_critical );
|
||||
set.getDouble( "hit_modify", &m_hitModifier );
|
||||
set.getInt( "avoid_modify", &m_avoidModifier );
|
||||
set.getInt( "shield_def", &m_shieldDef );
|
||||
set.getDouble( "shield_def_rate", &m_shieldDefRate );
|
||||
set.getInt( "atk_speed", &m_atkSpeed );
|
||||
int default_atkReuse = 0;
|
||||
if( m_subType == WEAPON_BOW ) default_atkReuse = 1500;
|
||||
else if( m_subType == WEAPON_CROSSBOW ) default_atkReuse = 1200;
|
||||
set.getInt( "atk_reuse", &m_atkReuse, default_atkReuse );
|
||||
set.getInt( "mp_consume", &m_mpConsume );
|
||||
set.getInt( "m_dam", &m_mDam );
|
||||
set.getInt( "change_weaponId", &m_changeWeaponId );
|
||||
}
|
||||
|
||||
L2WeaponTemplate::~L2WeaponTemplate()
|
||||
{
|
||||
}
|
||||
50
L2C_Server/world/templates/item/L2WeaponTemplate.h
Normal file
50
L2C_Server/world/templates/item/L2WeaponTemplate.h
Normal file
@@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
#include "L2ItemTemplate.h"
|
||||
|
||||
class L2WeaponTemplate: public L2ItemTemplate
|
||||
{
|
||||
public:
|
||||
L2WeaponTemplate( L2ItemSubType subType, StatsSet& set );
|
||||
virtual ~L2WeaponTemplate();
|
||||
|
||||
public:
|
||||
int getSoulShotCount() const { return m_soulShotCount; }
|
||||
int getSpiritShotCount() const { return m_spiritShotCount; }
|
||||
int getPDam() const { return m_pDam; }
|
||||
int getRndDam() const { return m_rndDam; }
|
||||
int getCritical() const { return m_critical; }
|
||||
double getHitModifier() const { return m_hitModifier; }
|
||||
int getAvoidModifier() const { return m_avoidModifier; }
|
||||
int getShieldDef() const { return m_shieldDef; }
|
||||
double getShieldDefRate() const { return m_shieldDefRate; }
|
||||
int getAtkSpeed() const { return m_atkSpeed; }
|
||||
int getAtkReuse() const { return m_atkReuse; }
|
||||
int getMpConsume() const { return m_mpConsume; }
|
||||
int getMDam() const { return m_mDam; }
|
||||
int getChangeWeaponId() const { return m_changeWeaponId; }
|
||||
|
||||
protected:
|
||||
int m_soulShotCount;
|
||||
int m_spiritShotCount;
|
||||
int m_pDam;
|
||||
int m_rndDam;
|
||||
int m_critical;
|
||||
double m_hitModifier;
|
||||
int m_avoidModifier;
|
||||
int m_shieldDef;
|
||||
double m_shieldDefRate;
|
||||
int m_atkSpeed;
|
||||
int m_atkReuse;
|
||||
int m_mpConsume;
|
||||
int m_mDam;
|
||||
int m_changeWeaponId;
|
||||
|
||||
// TODO: skills
|
||||
//private L2Skill _enchant4Skill = null; // skill that activates when item is enchanted +4 (for duals)
|
||||
//String[] _skill;
|
||||
// Attached skills for Special Abilities
|
||||
//protected L2Skill _skillsOnCast;
|
||||
//protected Condition _skillsOnCastCondition;
|
||||
//protected L2Skill _skillsOnCrit;
|
||||
//protected Condition _skillsOnCritCondition;
|
||||
};
|
||||
Reference in New Issue
Block a user