Initial MSVC 2008 projects workspace
This commit is contained in:
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