#include "gamesrv.h" #include "StdAfx.h" #include "SkillScript.h" #include "FileLoader.h" #include "Tokenizer.h" #include "StatusScript.h" #include "Parser.h" #include "Monster_common.h" #include "Monsterscript.h" #ifdef _CLIENT #include "DramaturgyManager.h" #include "GameResourceManager.h" #endif cSkillScript* cSkillScript::mpSkillScript = NULL; cSkillTreeLexer::cSkillTreeLexer( const char* buffer, unsigned int size ) : cLexer( buffer, size ) { BindKeyword( "skillTree", eTOKEN_SKILLTREE ); BindKeyword( "imageFile", eTOKEN_IMAGEFILE ); BindKeyword( "jobIdx", eTOKEN_JOBIDX ); BindKeyword( "skillpos", eTOKEN_SKILLPOS ); } cSkillScript::cSkillScript(void) { /// ½Ì±ÛÅæ if( mpSkillScript ) { #ifndef _CLIENT Verbose->WriteLog( "cSkillScript new error"); #endif } else { mpSkillScript = this; } } bool cSkillScript::Init() { Release(); /// ½ºÅ³ ½ºÅ©¸³Æ® ·Îµå if( !PlayerSkillScriptLoad() ) { assert(NULL); return false; } /// ½ºÅ³ ½ºÅ©¸³Æ® ·Îµå if( !MonsterSkillScriptLoad() ) { assert(NULL); return false; } if( !PlayerSkillStepLoad() ) { assert(NULL); return false; } if( !InfluenceLoad() ) { assert(NULL); return false; } if( !ActInfluenctLoad() ) { assert(NULL); return false; } /// ½ºÅ³ ½ºÅ©¸³Æ® ·Îµå if( !PlayerSkillJobScriptLoad() ) { assert(NULL); return false; } PlayerFreeSkillList(); if( LoadSkillTree("./Script/Resource/Path_SkillTree.txt") == false ) { assert(0); return false; } /// ½ºÅ³È¿°ú ÁßøºÒ°¡ Á¤º¸ ·Îµå if( !InfOverlapLoad() ) { assert(NULL); return false; } return true; } void cSkillScript::Release() { cSkillHashMap::cIterator iter; cPHashMap::cIterator ob = mOverLapMap.Begin(); cPHashMap::cIterator oe = mOverLapMap.End(); for( ; ob != oe; ++ob ) { delete (cHashSet*)(ob->mSecond); } mOverLapMap.Clear(); cSkillTreeMap::cIterator k = mSkillTreeMap.Begin(); cSkillTreeMap::cIterator kend = mSkillTreeMap.End(); for( ; k != kend; ++k ) { delete (cSkillTree*)(k->mSecond); } mSkillTreeMap.Clear(); for(iter = mPlayerSkillInfoMap.Begin() ; iter != mPlayerSkillInfoMap.End() ; ++iter) { delete (sPlayerSkillBaseInfo*)(*iter).mSecond; } mPlayerSkillInfoMap.Clear(); /// ¸ó½ºÅÍ ±âº»½ºÅ³ Á¤º¸ »èÁ¦ for( iter = mMonsterBaseSkillMap.Begin(); iter != mMonsterBaseSkillMap.End(); ++iter ) { delete (cArray*)iter->mSecond; } mMonsterBaseSkillMap.Clear(); cPHashMap::cIterator bb = mBridgeSkillMap.Begin(); cPHashMap::cIterator be = mBridgeSkillMap.End(); for( ; bb != be; ++bb ) { delete (cHashMap*)(bb->mSecond); } mBridgeSkillMap.Clear(); /// Àüü½ºÅ³ Á¤º¸ »èÁ¦ for( iter = mMonsterSkillTotalMap.Begin(); iter != mMonsterSkillTotalMap.End(); ++iter ) { delete (sMonsterSkillScript*)iter->mSecond; } mMonsterSkillTotalMap.Clear(); for( iter = mInfluenceMap.Begin() ; iter != mInfluenceMap.End() ; ++iter ) { delete (sInfluenceScript*)(*iter).mSecond; } mInfluenceMap.Clear(); for( iter = mActInfluenceMap.Begin() ; iter != mActInfluenceMap.End() ; ++iter ) { delete (sActInfluenceScript*)(*iter).mSecond; } mActInfluenceMap.Clear(); for( iter = mSkillJobMap.Begin() ; iter != mSkillJobMap.End() ; ++iter ) { delete (tArray*)(*iter).mSecond; } mSkillJobMap.Clear(); for( iter = mFreeSkillMap.Begin() ; iter != mFreeSkillMap.End() ; ++iter ) { delete (tArray*)(*iter).mSecond; } mFreeSkillMap.Clear(); } void cSkillScript::PlayerFreeSkillList() { cSkillHashMap::cIterator i = mPlayerSkillInfoMap.Begin(); cSkillHashMap::cIterator iend = mPlayerSkillInfoMap.End(); /// Áö±Þ¿ë ½ºÅ³ for( ; i!=iend; i++ ) { sPlayerSkillBaseInfo* info = (sPlayerSkillBaseInfo*)(*i).mSecond; unsigned long idx = (unsigned long)(*i).mFirst; if( idx <= 100 ) continue; if( info ) { if( info->mStepCount == 0 ) { assert(0); continue; } if( info->mpSetpInfoArray[0].mRequireSP == 0 ) { tArray* p = (tArray*)mFreeSkillMap.GetAt(info->mJobStep); if( p == 0 ) { p = new tArray; mFreeSkillMap.Insert( info->mJobStep, p ); } p->PushBack( idx ); } } } /// } bool cSkillScript::PlayerSkillScriptLoad() { cFileLoader loader; cString pathName = "./Script/resource/SkillList_PC.txt"; if( loader.Open( pathName, true ) == false ) { assert( 0 && "failed to load SkillList_PC.txt" ); return false; } cTokenizer tokenizer( loader.GetBufferPtr(), loader.GetSize(), " \t\r\n", pathName.Cstr() ); cString str; sPlayerSkillBaseInfo* pSkillInfo = 0; while( tokenizer.IsEnd() == false ) { pSkillInfo = new sPlayerSkillBaseInfo; /// ½ºÅ³ Á¾·ùIdx if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mSkillIdx = str.ToInt(); /// ½ºÅ³ À̸§Idx if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mNameIdx = str.ToInt(); /// ½ºÅ³ ¾ÆÀÌÄÜIdx if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mIconIdx = str.ToInt(); /// ½Àµæ,»ç¿ë Á¾Á· if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mRace = static_cast(str.ToInt()); /// Á÷¾÷ ´Ü°è if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mJobStep = static_cast(str.ToInt()); /// ½ºÅ³½ÀµæÁ¶°Ç - ÃÑ»ç¿ë SP¾ç if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mBeforeReqSP = str.ToInt(); /// ½ºÅ³»ç¿ëÁ¶°Ç - ÇÊ¿äÀåºñ if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mUseEquipment = static_cast(str.ToInt()); /// ½ºÅ³»ç¿ëÁ¶°Ç - ij¸¯ÅÍ»óÅ if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mUseState = static_cast(str.ToInt()); /// ½ºÅ³»ç¿ëÁ¶°Ç - ij¸¯ÅÍ»óÅ if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mUseItem = str.ToInt(); /// ºÐ·ù - ½ºÅ³ »ç¿ë ÇüÅ if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mType = static_cast(str.ToInt()); /// ½ºÅ³À¯Çü - ¼Ó¼º if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mAttributeType = static_cast(str.ToInt()); /// ½ÃÀüÀ¯Çü if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mShotType = static_cast(str.ToInt()); /// ¹üÀ§¹æ½Ä - ½ºÅ³ »ç¿ë½Ã ±âÁØÀÇ ¹üÀ§ if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mBoundType = static_cast(str.ToInt()); /// È¿°úÀû¿ëŸ°Ù - ¹üÀ§¾È¿¡¼­ È¿°ú¸¦ Àû¿ë¹Þ´Â ´ë»ó if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mApplyType = static_cast(str.ToInt()); /// Ÿ°ÙÀÌ °É¸° È¿°ú( skilllist_effect¿¡¼­ »ç¿ëÇÏ´Â È¿°ú ¹øÈ£ ±âÀÔ : 0 »ç¿ë¾ÈÇÔ ) if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mApplyValueType = static_cast(str.ToInt()); /// ½ºÅ³À¯Çü - »çÁ¤°Å¸® if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mRangeType = static_cast(str.ToInt()); /// ±Û·Î¹úÄðŸÀÓ if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mIsGlobalCoolTime = str.ToInt() == 0 ? false : true; /// ±×·ìÄðŸÀÓ if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mGroupCoolTimeIdx = str.ToInt(); /// º¸°ü¼Ò ÀúÀå if( mPlayerSkillInfoMap.Insert( pSkillInfo->mSkillIdx, pSkillInfo ) == false ) { assert(0); goto ERR; } } return true; ERR: delete pSkillInfo; return false; } bool cSkillScript::PlayerSkillStepLoad() { cFileLoader loader; cString pathName = "./Script/resource/SkillList_Sub.txt"; if( loader.Open( pathName, true ) == false ) { assert( 0 && "failed to load SkillList_Sub.txt" ); return false; } cTokenizer tokenizer( loader.GetBufferPtr(), loader.GetSize(), " \t\r\n", pathName.Cstr() ); cString str; unsigned long skillIdx = ULONG_MAX; unsigned char step; sPlayerSkillStepInfo stepArray[50] = {0,}; unsigned char stepCount = 0; unsigned long currentSkillIdx = ULONG_MAX; while( tokenizer.IsEnd() == false ) { /// ½ºÅ³ Á¾·ùIdx if( tokenizer.GetNext( &str ) == false ) { return false; } skillIdx = str.ToInt(); if( currentSkillIdx != ULONG_MAX && (currentSkillIdx != skillIdx) ) { /// Áö±Ý±îÁö ½×ÀÎ Á¤º¸¸¦ ¼ÂÆÃÇÑ´Ù. assert(stepCount); assert(stepCount<50); sPlayerSkillBaseInfo* pSkillInfo = GetPlayerSkillInfo( currentSkillIdx ); if( pSkillInfo == 0 ) { assert(0); return false; } /// ÀоîµéÀÎ Á¤º¸¸¦ ¼ÂÆÃÇÑ´Ù. pSkillInfo->mpSetpInfoArray = new sPlayerSkillStepInfo[stepCount]; ::memcpy( pSkillInfo->mpSetpInfoArray, stepArray, sizeof(sPlayerSkillStepInfo)*stepCount); pSkillInfo->mStepCount = stepCount; /// Á¤º¸ ÃʱâÈ­ stepCount = 0; } currentSkillIdx = skillIdx; stepCount++; /// ½ºÅ³ ´Ü°è if( tokenizer.GetNext( &str ) == false ) { return false; } step = static_cast(str.ToInt()); /// ÅøÆÁIndex if( tokenizer.GetNext( &str ) == false ) { return false; } stepArray[step].mToolTipIdx = str.ToInt(); /// SPÇʿ䰪 if( tokenizer.GetNext( &str ) == false ) { return false; } stepArray[step].mRequireSP = static_cast(str.ToInt()); /// Á÷¾÷ Index if( tokenizer.GetNext( &str ) == false ) { return false; } stepArray[step].mJobType = static_cast(str.ToInt()); /// ij¸¯ÅÍ ÇÊ¿äLv if( tokenizer.GetNext( &str ) == false ) { return false; } stepArray[step].mPlayerLevel = static_cast(str.ToInt()); /// ½ºÅ³½ÀµæÁ¶°Ç1 - Çʿ佺ųidx if( tokenizer.GetNext( &str ) == false ) { return false; } stepArray[step].mLearnSkillIdx1 = str.ToInt(); /// ½ºÅ³½ÀµæÁ¶°Ç1 - ½ºÅ³ÇÊ¿ä´Ü°è if( tokenizer.GetNext( &str ) == false ) { return false; } stepArray[step].mLearnSkillStep1 = static_cast(str.ToInt()); /// ½ºÅ³½ÀµæÁ¶°Ç2 - Çʿ佺ųidx if( tokenizer.GetNext( &str ) == false ) { return false; } stepArray[step].mLearnSkillIdx2 = str.ToInt(); /// ½ºÅ³½ÀµæÁ¶°Ç2 - ½ºÅ³ÇÊ¿ä´Ü°è if( tokenizer.GetNext( &str ) == false ) { return false; } stepArray[step].mLearnSkillStep2 = static_cast(str.ToInt()); /// ¼Ò¸ð±Ý¾× if( tokenizer.GetNext( &str ) == false ) { return false; } stepArray[step].mUseMoney = str.ToInt(); /// »óżöÄ¡°ª if( tokenizer.GetNext( &str ) == false ) { return false; } stepArray[step].mUseStateValue = static_cast(str.ToInt()); /// ¼Ò¸ðMP°ª if( tokenizer.GetNext( &str ) == false ) { return false; } stepArray[step].mUseMP = str.ToInt(); /// ¼Ò¸ðMP°ª if( tokenizer.GetNext( &str ) == false ) { return false; } stepArray[step].mUseMPPer = str.ToInt(); /// ¼Ò¸ðHP°ª if( tokenizer.GetNext( &str ) == false ) { return false; } stepArray[step].mUseHP = str.ToInt(); /// ¼Ò¸ð¾ÆÀÌÅÛ°³¼ö if( tokenizer.GetNext( &str ) == false ) { return false; } stepArray[step].mUseItemCount = static_cast(str.ToInt()); /// »ç°Å¸® if( tokenizer.GetNext( &str ) == false ) { return false; } stepArray[step].mTargetDist = static_cast(str.ToInt()); /// ij½ºÆÃ½Ã°£ if( tokenizer.GetNext( &str ) == false ) { return false; } stepArray[step].mCastingTime = str.ToInt(); /// ÄðŸÀÓ if( tokenizer.GetNext( &str ) == false ) { return false; } stepArray[step].mCoolTime = str.ToInt(); /// ¹üÀ§°Å¸®1 if( tokenizer.GetNext( &str ) == false ) { return false; } stepArray[step].mBoundDist1 = static_cast(str.ToInt()); /// ¹üÀ§°Å¸®2 if( tokenizer.GetNext( &str ) == false ) { return false; } stepArray[step].mBoundDist2 = static_cast(str.ToInt()); /// Àû¿ëÀοø if( tokenizer.GetNext( &str ) == false ) { return false; } stepArray[step].mApplyCnt = static_cast(str.ToInt()); /// °íÀ¯¸íÁß·ü if( tokenizer.GetNext( &str ) == false ) { return false; } stepArray[step].mAccuracyValue = static_cast(str.ToInt()); /// °íÀ¯Å©¸®Æ¼Äà if( tokenizer.GetNext( &str ) == false ) { return false; } stepArray[step].mCriticalValue = static_cast(str.ToInt()); /// °íÀ¯ ¾î±×·Î ¼öÄ¡ if( tokenizer.GetNext( &str ) == false ) { return false; } stepArray[step].mDistressValue = str.ToInt(); /// Àû¿ë°ª type1 if( tokenizer.GetNext( &str ) == false ) { return false; } stepArray[step].mApplyValueType1 = static_cast(str.ToInt()); /// Àû¿ë°ª1 if( tokenizer.GetNext( &str ) == false ) { return false; } stepArray[step].mApplyValue1 = str.ToInt(); /// Àû¿ë°ª type2 if( tokenizer.GetNext( &str ) == false ) { return false; } stepArray[step].mApplyValueType2 = static_cast(str.ToInt()); /// Àû¿ë°ª2 if( tokenizer.GetNext( &str ) == false ) { return false; } stepArray[step].mApplyValue2 = str.ToInt(); /// È¿°ú Index if( tokenizer.GetNext( &str ) == false ) { return false; } stepArray[step].mInfulenceIdx = str.ToInt(); if( tokenizer.GetNext( &str ) == false ) { return false; } stepArray[step].mActiveIdx = str.ToInt(); if( stepArray[step].mApplyValueType1 == eSTATUSPLUS_AROUND_PUSH && stepArray[step].mApplyValueType2 == eSTATUSPLUS_AROUND_PULL ) return false; if( stepArray[step].mApplyValueType1 == eSTATUSPLUS_AROUND_PULL && stepArray[step].mApplyValueType2 == eSTATUSPLUS_AROUND_PUSH ) return false; /// ¹üÀ§ ½ºÅ³ Àû¿ë Àοø Áõ°¡ È¿°ú°¡ ÀÖÀ¸¸é¼­ ¹üÀ§ ½ºÅ³ÀÌ ¾Æ´Ñ°æ¿ì ¿¡·¯ sPlayerSkillBaseInfo* pSkillInfo = GetPlayerSkillInfo( currentSkillIdx ); if( pSkillInfo == 0 ) { assert(0); return false; } if( stepArray[step].mApplyValueType1 == eSTATUSPLUS_ADD_APPLYCNT && pSkillInfo->mBoundType == eBOUNDTYPE_NONE ) return false; if( stepArray[step].mApplyValueType2 == eSTATUSPLUS_ADD_APPLYCNT && pSkillInfo->mBoundType == eBOUNDTYPE_NONE ) return false; if( pSkillInfo->mType == eSKILLTYPE_NONSTOP ) { if( pSkillInfo->mShotType == eSHOTTYPE_RUSHRUN || pSkillInfo->mShotType == eSHOTTYPE_RUSHBLINK ) { cHashMap* pStepMap = (cHashMap*)mBridgeSkillMap.GetAt( skillIdx ); if( pStepMap == NULL ) { pStepMap = new cHashMap; if( mBridgeSkillMap.Insert( skillIdx, pStepMap ) == false ) return false; } pStepMap->Insert( step, stepArray[step].mInfulenceIdx ); } } if( tokenizer.IsEnd() ) { /// Áö±Ý±îÁö ½×ÀÎ Á¤º¸¸¦ ¼ÂÆÃÇÑ´Ù. assert(stepCount); assert(stepCount<50); sPlayerSkillBaseInfo* pSkillInfo = GetPlayerSkillInfo( currentSkillIdx ); if( pSkillInfo == 0 ) { assert(0); return false; } /// ÀоîµéÀÎ Á¤º¸¸¦ ¼ÂÆÃÇÑ´Ù. pSkillInfo->mpSetpInfoArray = new sPlayerSkillStepInfo[stepCount]; ::memcpy( pSkillInfo->mpSetpInfoArray, stepArray, sizeof(sPlayerSkillStepInfo)*stepCount); pSkillInfo->mStepCount = stepCount; /// Á¤º¸ ÃʱâÈ­ stepCount = 0; } } return true; } bool cSkillScript::InfluenceLoad() { /// ±âÁ¸ µ¥ÀÌÅÍ Á¦°Å cSkillHashMap::cIterator iter; for( iter = mInfluenceMap.Begin() ; iter != mInfluenceMap.End() ; ++iter ) { delete (sInfluenceScript*)(*iter).mSecond; } mInfluenceMap.Clear(); /// ·Îµå.. cFileLoader loader; cString pathName = "./Script/resource/SkillList_Effect.txt"; if( loader.Open( pathName, true ) == false ) { assert( 0 && "failed to load SkillList_Effect.txt" ); return false; } cTokenizer tokenizer( loader.GetBufferPtr(), loader.GetSize(), " \t\r\n", pathName.Cstr() ); cString str; while( tokenizer.IsEnd() == false ) { /// È¿°úIdx if( tokenizer.GetNext( &str ) == false ) { return false; } unsigned long influenceIdx = str.ToInt(); ///¿¬ÃâÆÄÀϸí if( tokenizer.GetNext( &str ) == false ) { return false; } cString dramaturgyFile = str; /// À̸§Idx if( tokenizer.GetNext( &str ) == false ) { return false; } unsigned long nameidx = str.ToInt(); /// È¿°ú¾ÆÀÌÄÜIdx if( tokenizer.GetNext( &str ) == false ) { return false; } unsigned long iconIdx = str.ToInt(); /// ÅøÆÁÈ¿°úIdx if( tokenizer.GetNext( &str ) == false ) { return false; } unsigned long toolTipIdx = str.ToInt(); /// ¼Ó¼º if( tokenizer.GetNext( &str ) == false ) { return false; } unsigned char type = static_cast(str.ToInt()); /// µµÆ® ¼Ó¼º if( tokenizer.GetNext( &str ) == false ) { return false; } unsigned char dotType = (unsigned char)str.ToInt(); /// Áö¼ÓµµÆ®·® if( tokenizer.GetNext( &str ) == false ) { return false; } long dotValue = (long)str.ToInt(); /// ºÐ·ù if( tokenizer.GetNext( &str ) == false ) { return false; } unsigned long typeDetail = str.ToInt(); /// Á״°æ¿ì È¿°ú Á¦°Å if( tokenizer.GetNext( &str ) == false ) { return false; } unsigned char deleteType = (unsigned char)str.ToInt(); /// È¿·Â ±×·ì if( tokenizer.GetNext( &str ) == false ) { return false; } unsigned long groupIdx = str.ToInt(); /// È¿·Â if( tokenizer.GetNext( &str ) == false ) { return false; } unsigned long groupOrder = str.ToInt(); /// Áߺ¹ºÒ°¡±×·ì if( tokenizer.GetNext( &str ) == false ) { return false; } unsigned long notOverlapGroupIdx = str.ToInt(); /// Áߺ¹ºÒ°¡±×·ì ½ºÅ©¸³Æ®idx if( tokenizer.GetNext( &str ) == false ) { return false; } unsigned long overlapScriptIdx = str.ToInt(); /// ½Ã°£ ¼Ó¼º if( tokenizer.GetNext( &str ) == false ) { return false; } unsigned char timeType = (unsigned char)str.ToInt(); /// Áö¼Ó(ä³Î¸µ)½Ã°£ if( tokenizer.GetNext( &str ) == false ) { return false; } unsigned long continuanceTime = str.ToInt(); /// ¹ßµ¿È®·ü if( tokenizer.GetNext( &str ) == false ) { return false; } unsigned char activityPer = static_cast(str.ToInt()); /// Áö¼ÓÈ¿°ú¹øÈ£1 if( tokenizer.GetNext( &str ) == false ) { return false; } unsigned short statusPlusIdx1 = static_cast(str.ToInt()); /// ½Ã°£1 if( tokenizer.GetNext( &str ) == false ) { return false; } unsigned long time1 = str.ToInt(); /// È¿°ú°ª1 if( tokenizer.GetNext( &str ) == false ) { return false; } long value1 = str.ToInt(); /// Áö¼ÓÈ¿°ú¹øÈ£2 if( tokenizer.GetNext( &str ) == false ) { return false; } unsigned short statusPlusIdx2 = static_cast(str.ToInt()); /// ½Ã°£2 if( tokenizer.GetNext( &str ) == false ) { return false; } unsigned long time2 = str.ToInt(); /// È¿°ú°ª2 if( tokenizer.GetNext( &str ) == false ) { return false; } long value2 = str.ToInt(); /// Áö¼ÓÈ¿°ú¹øÈ£3 if( tokenizer.GetNext( &str ) == false ) { return false; } unsigned short statusPlusIdx3 = static_cast(str.ToInt()); /// È¿°ú°ª3 if( tokenizer.GetNext( &str ) == false ) { return false; } long value3 = str.ToInt(); sInfluenceScript* pInfluence = new sInfluenceScript; pInfluence->mInfluenceIdx = influenceIdx; pInfluence->mDramaturgyFile = dramaturgyFile; pInfluence->mNameidx = nameidx; pInfluence->mIconIdx = iconIdx; pInfluence->mToolTipIdx = toolTipIdx; pInfluence->mType = type; pInfluence->mDotType = dotType; pInfluence->mDotValue = dotValue; pInfluence->mTypeDetail = typeDetail; pInfluence->mDeleteType = deleteType; /// »èÁ¦ Á¶°Ç pInfluence->mGroupIdx = groupIdx; pInfluence->mGroupOrder = groupOrder; pInfluence->mNotOverlapGroupIdx = notOverlapGroupIdx; pInfluence->mOverlapScriptIdx = overlapScriptIdx; pInfluence->mTimeType = timeType; pInfluence->mContinuanceTime = continuanceTime; pInfluence->mActivityPer = activityPer; pInfluence->mStatusPlusIdx1 = statusPlusIdx1; pInfluence->mTime1 = time1; pInfluence->mValue1 = value1; pInfluence->mStatusPlusIdx2 = statusPlusIdx2; pInfluence->mTime2 = time2; pInfluence->mValue2 = value2; pInfluence->mStatusPlusIdx3 = statusPlusIdx3; pInfluence->mValue3 = value3; if( dotType == eDOTTYPE_NONE ) { switch( statusPlusIdx1 ) { case eSTATUSPLUS_DOT_HPCHANGE_CALC_PLUS: case eSTATUSPLUS_DOT_MPCHANGE_CALC_PLUS: case eSTATUSPLUS_DOT_HPCHANGE_CALC_PER: case eSTATUSPLUS_DOT_MPCHANGE_CALC_PER: { if( value1 < 0 ) { assert(NULL); return false; } } } switch( statusPlusIdx2 ) { case eSTATUSPLUS_DOT_HPCHANGE_CALC_PLUS: case eSTATUSPLUS_DOT_MPCHANGE_CALC_PLUS: case eSTATUSPLUS_DOT_HPCHANGE_CALC_PER: case eSTATUSPLUS_DOT_MPCHANGE_CALC_PER: { if( value2 < 0 ) { assert(NULL); return false; } } } } if( groupOrder == 0 && notOverlapGroupIdx == 0 && continuanceTime > 0 ) { assert(NULL); return false; } if( !mInfluenceMap.Insert( influenceIdx, pInfluence ) ) { assert(0); return false; } if( continuanceTime > 0 && groupIdx == 0 && notOverlapGroupIdx == 0 ) { assert(0); } if( type == eINFLUENCETYPE_PC ) mPcBangIdxAry.PushBack( influenceIdx ); if( type == eINFLUENCETYPE_GMEVENT ) mGMEventIdxAry.PushBack( influenceIdx ); // ÀÌ·± ÄÚµå ¸¸µéÁö ¾Êµµ·Ï °øÀ¯ °¡´ÉÇÑ ºÎºÐ¸¸ Common¿¡ ³ÖÀ¸¼¼¿ä #ifdef _CLIENT /// ¿¬Ãâ ÆÄÀÏ¿¡ ´ëÇÑ ·Îµå DRAMATURGYMAN->LoadInfluenceDrama( pInfluence->mInfluenceIdx, pInfluence->mDramaturgyFile, false ); #endif } cSkillHashMap::cIterator i = mInfluenceMap.Begin(); cSkillHashMap::cIterator e = mInfluenceMap.End(); for( ; i != e ; ++i ) { sInfluenceScript* pScript = (sInfluenceScript*)(*i).mSecond; if( pScript == NULL ) return false; if( pScript->mType != eINFLUENCETYPE_PC && pScript->mType != eINFLUENCETYPE_GMEVENT ) continue; /// pc¹æ¿ë ¹öÇÁ & GMÀ̺¥Æ® ¹öÇÁ¸¦ ½ºÅ³»ç¿ëºÎ¿¡ Ãß°¡ÇѰÍÀÌ ÀÖ´ÂÁö üũ cSkillHashMap::cIterator i3 = mPlayerSkillInfoMap.Begin(); cSkillHashMap::cIterator e3 = mPlayerSkillInfoMap.End(); for( ; i3 != e3 ; ++i3 ) { sPlayerSkillBaseInfo* pSkill = (sPlayerSkillBaseInfo*)(*i3).mSecond; if( pSkill == NULL ) return false; for( unsigned char j = 0 ; j < pSkill->mStepCount ; ++j ) { sPlayerSkillStepInfo* pStep = &pSkill->mpSetpInfoArray[j]; if( pStep == NULL ) return false; if( pStep->mInfulenceIdx == (*i).mFirst ) return false; } } /// pc¹æ ¹öÇÁ³¢¸®ÁßøµÇ´Â°ÍÀÌ ÀÖ´ÂÁö È®ÀÎ cSkillHashMap::cIterator i2 = mInfluenceMap.Begin(); cSkillHashMap::cIterator e2 = mInfluenceMap.End(); for( ; i2 != e2 ; ++i2 ) { sInfluenceScript* pScript2 = (sInfluenceScript*)(*i2).mSecond; if( pScript2 == NULL ) return false; if( pScript2->mType != eINFLUENCETYPE_PC ) continue; if( pScript->mInfluenceIdx == pScript2->mInfluenceIdx ) continue; if( pScript->mNotOverlapGroupIdx == pScript2->mNotOverlapGroupIdx ) return false; } } return true; } bool cSkillScript::ActInfluenctLoad() { /// ±âÁ¸ µ¥ÀÌÅÍ Á¦°Å cSkillHashMap::cIterator iter; for( iter = mActInfluenceMap.Begin() ; iter != mActInfluenceMap.End() ; ++iter ) { delete (sActInfluenceScript*)(*iter).mSecond; } mActInfluenceMap.Clear(); /// ·Îµå.. cFileLoader loader; cString pathName = "./script/resource/skilllist_active.txt"; if( loader.Open( pathName, true ) == false ) { assert( 0 && "failed to load skilllist_acteffect.txt" ); return false; } cTokenizer tokenizer( loader.GetBufferPtr(), loader.GetSize(), " \t\r\n", pathName.Cstr() ); cString str; while( tokenizer.IsEnd() == false ) { /// ¹ßµ¿Idx if( tokenizer.GetNext( &str ) == false ) { return false; } unsigned long Idx = str.ToInt(); /// ¹ßµ¿ ÅøÆÁ if( tokenizer.GetNext( &str ) == false ) { return false; } unsigned long tipIdx = str.ToInt(); ///¿¬ÃâÆÄÀϸí if( tokenizer.GetNext( &str ) == false ) { return false; } cString dramaturgyFile = str; /// ¹ßµ¿ »óȲ if( tokenizer.GetNext( &str ) == false ) { return false; } eACTSTATUS activityState = (eACTSTATUS)str.ToInt(); /// ¹ßµ¿ È®·ü if( tokenizer.GetNext( &str ) == false ) { return false; } unsigned long activityPer = str.ToInt(); /// Àç»ç¿ë ´ë±â ½Ã°£ if( tokenizer.GetNext( &str ) == false ) { return false; } unsigned long coolTime = str.ToInt(); /// ¹üÀ§ ¹æ½Ä if( tokenizer.GetNext( &str ) == false ) { return false; } eBOUNDTYPE boundType = (eBOUNDTYPE)str.ToInt(); if( boundType != eBOUNDTYPE_NONE && boundType != eBOUNDTYPE_SELF_TARGET && boundType != eBOUNDTYPE_TARGET ) { assert(0); } /// Àû¿ë ´ë»ó if( tokenizer.GetNext( &str ) == false ) { return false; } eAPPLYTYPE applyType = (eAPPLYTYPE)str.ToInt(); if( applyType != eAPPLYTYPE_SELF && applyType != eAPPLYTYPE_ENEMY && applyType != eAPPLYTYPE_PARTY ) { assert(0); } /// ¹üÀ§ °ª if( tokenizer.GetNext( &str ) == false ) { return false; } float boundDist = str.ToFloat(); /// ÂüÁ¶Idx if( tokenizer.GetNext( &str ) == false ) { return false; } unsigned long infIdx = str.ToInt(); sActInfluenceScript* pInfo = new sActInfluenceScript; pInfo->mActivityIdx = Idx; pInfo->mTooltipIdx = tipIdx; pInfo->mDramaturgyFile = dramaturgyFile; pInfo->mActivityState = activityState; pInfo->mActivityPer = activityPer; pInfo->mCooltime = coolTime; pInfo->mApplyType = applyType; pInfo->mBoundType = boundType; pInfo->mBoundDist = boundDist; pInfo->mInfIdx = infIdx; if( !mActInfluenceMap.Insert( Idx, pInfo ) ) { assert(0); return false; } // ÀÌ·± ÄÚµå ¸¸µéÁö ¾Êµµ·Ï °øÀ¯ °¡´ÉÇÑ ºÎºÐ¸¸ Common¿¡ ³ÖÀ¸¼¼¿ä #ifdef _CLIENT /// ¿¬Ãâ ÆÄÀÏ¿¡ ´ëÇÑ ·Îµå DRAMATURGYMAN->LoadActInfluenceDrama( pInfo->mActivityIdx, pInfo->mDramaturgyFile, false ); #endif } return true; } bool cSkillScript::PlayerSkillJobScriptLoad() { cFileLoader loader; cString pathName = "./Script/resource/SkillList_Class.txt"; if( loader.Open( pathName, true ) == false ) { assert( 0 && "failed to load SkillList_Class.txt" ); return false; } cTokenizer tokenizer( loader.GetBufferPtr(), loader.GetSize(), " \t\r\n", pathName.Cstr() ); cString str; tArray *pJobArry; while( tokenizer.IsEnd() == false ) { /// Á÷¾÷Idx if( tokenizer.GetNext( &str ) == false ) { return false; } unsigned long jobIdx = str.ToInt(); /// Á÷¾÷ÄÚµå1 if( tokenizer.GetNext( &str ) == false ) { return false; } ePLAYER_JOB jobCode1 = static_cast(str.ToInt()); /// Á÷¾÷ÄÚµå2 if( tokenizer.GetNext( &str ) == false ) { return false; } ePLAYER_JOB jobCode2 = static_cast(str.ToInt()); /// Á÷¾÷ÄÚµå3 if( tokenizer.GetNext( &str ) == false ) { return false; } ePLAYER_JOB jobCode3 = static_cast(str.ToInt()); pJobArry = new tArray; /// ¹è¿­¿¡ °ªÀ» ³ÖÀ½ if( jobCode1 != 0 ) pJobArry->PushBack( static_cast(jobCode1) ); if( jobCode2 != 0 ) pJobArry->PushBack( static_cast(jobCode2) ); if( jobCode3 != 0 ) pJobArry->PushBack( static_cast(jobCode3) ); if( !mSkillJobMap.Insert( jobIdx, pJobArry ) ) { return false; } } return true; } bool cSkillScript::MonsterSkillScriptLoad() { cFileLoader loader; cString pathName = "./Script/resource/SkillList_Mon.txt"; if( loader.Open( pathName, true ) == false ) { assert( 0 && "failed to load SkillList_Mon.txt" ); return false; } cTokenizer tokenizer( loader.GetBufferPtr(), loader.GetSize(), " \t\r\n", pathName.Cstr() ); cString str; sMonsterSkillScript* pSkillInfo; while( tokenizer.IsEnd() == false ) { pSkillInfo = new sMonsterSkillScript; /// ¸ó½ºÅÍIdx if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mMonsterIdx = str.ToInt(); /// °ø°Ý¹æ½Ä if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mAttackType = (eMONSTERATTACK_TYPE)str.ToInt(); /// Drama file if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mDramaFile = str; /// ÅøÆÁIdx if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mToolTipIdx = str.ToInt(); /// ½ºÅ³ ºÐ·ù if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mType = (eMONSTERSKILLTYPE)str.ToInt(); /// ¼Ó¼ºÀ¯Çü if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mAttributeType = (eATTRIBUTETYPE)str.ToInt(); /// °Å¸®À¯Çü if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mRangeType = (eRANGETYPE)str.ToInt(); /// °ø°Ý·Â(¼Ò) if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mMinAttackValue = str.ToInt(); /// °ø°Ý·Â(´ë) if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mMaxAttackValue = str.ToInt(); /// °íÀ¯¸íÁß·ü if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mAccuracyValue = (short)str.ToInt(); /// °íÀ¯Å©¸®Æ¼Äà if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mCriticalValue = (unsigned short)str.ToInt(); /// »ç¿ëÁ¶°Ç(HP) if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mUseHPCheck = (eMONSTERHPCHECK)str.ToInt(); /// »ç¿ëÁ¶°Ç(¼Ò¸ðMP) if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mUseMP = str.ToInt(); /// »ç°Å¸® if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mTargetDist = (float)str.ToInt(); /// °ø°Ý¼Óµµ if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mAttackSpd = str.ToInt(); /// ÄðŸÀÓ if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mCoolTime = str.ToInt(); /// »ç¿ëÈ®·ü if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mSkillUsePer = (unsigned char)str.ToInt(); /// ½ÃÀüÀ¯Çü if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mShotType = (eMONSTERSHOTTYPE)str.ToInt(); /// ¹üÀ§¹æ½Ä if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mBoundType = (eBOUNDTYPE)str.ToInt(); /// ¹üÀ§°Å¸®1 if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mBoundDist1 = (unsigned short)str.ToInt(); /// ¹üÀ§°Å¸®2 if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mBoundDist2 = (unsigned short)str.ToInt(); /// Àû¿ëÀοø if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mApplyCnt = (unsigned char)str.ToInt(); /// È¿°úÀû¿ëŸ°Ù if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mApplyType = (eAPPLYTYPE)str.ToInt(); if( pSkillInfo->mApplyType != eAPPLYTYPE_SELF && pSkillInfo->mApplyType != eAPPLYTYPE_ENEMY && pSkillInfo->mApplyType != eAPPLYTYPE_BUDDY && pSkillInfo->mApplyType != eAPPLYTYPE_FAR && pSkillInfo->mApplyType != eAPPLYTYPE_RANDOM && pSkillInfo->mApplyType != eAPPLYTYPE_DISTRESS2 && pSkillInfo->mApplyType != eAPPLYTYPE_DISTRESS3 && pSkillInfo->mApplyType != eAPPLYTYPE_DISTRESSMIN && pSkillInfo->mApplyType != eAPPLYTYPE_HPMAX && pSkillInfo->mApplyType != eAPPLYTYPE_HPMIN ) goto ERR; /// ij½ºÆÃ½Ã°£ if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mCastingTime = str.ToInt(); /// È¿°ú¹øÈ£1 if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mApplyValueType1 = (unsigned short)str.ToInt(); if( pSkillInfo->mApplyValueType1 != 0 && ( pSkillInfo->mApplyValueType1 < eSTATUSPLUS_INSTANTPERHIT || pSkillInfo->mApplyValueType1 > eSTATUSPLUS_DAMAGECALC_MAX ) ) goto ERR; /// È¿°ú°ª1 if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mApplyValue1 = str.ToInt(); /// È¿°ú¹øÈ£2 if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mApplyValueType2 = (unsigned short)str.ToInt(); if( pSkillInfo->mApplyValueType2 != 0 && ( pSkillInfo->mApplyValueType2 < eSTATUSPLUS_INSTANTPERHIT || pSkillInfo->mApplyValueType2 >= eSTATUSPLUS_DAMAGECALC_MAX )) goto ERR; /// È¿°ú°ª2 if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mApplyValue2 = str.ToInt(); if( pSkillInfo->mApplyValueType1 == eSTATUSPLUS_AROUND_PUSH && pSkillInfo->mApplyValueType2 == eSTATUSPLUS_AROUND_PULL ) goto ERR; if( pSkillInfo->mApplyValueType1 == eSTATUSPLUS_AROUND_PULL && pSkillInfo->mApplyValueType2 == eSTATUSPLUS_AROUND_PUSH ) goto ERR; /// ¹üÀ§ ½ºÅ³ Àû¿ë Àοø Áõ°¡ È¿°ú°¡ ÀÖÀ¸¸é¼­ ¹üÀ§ ½ºÅ³ÀÌ ¾Æ´Ñ°æ¿ì ¿¡·¯ if( pSkillInfo->mApplyValueType1 == eSTATUSPLUS_ADD_APPLYCNT && pSkillInfo->mBoundType == eBOUNDTYPE_NONE ) goto ERR; if( pSkillInfo->mApplyValueType2 == eSTATUSPLUS_ADD_APPLYCNT && pSkillInfo->mBoundType == eBOUNDTYPE_NONE ) goto ERR; /// È¿°úIdx if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mInfulenceIdx = str.ToInt(); if( tokenizer.GetNext( &str ) == false ) { goto ERR; } pSkillInfo->mActiveIdx = str.ToInt(); /// ¸ó½ºÅÍ ½ºÅ³ À妽º »ý¼º - ¸ó½ºÅÍŬ·¡½ºÀ妽º * 100 + °ø°ÝŸÀÔ unsigned long monSkillIdx = pSkillInfo->mMonsterIdx * 100 + pSkillInfo->mAttackType; /// Àüü ½ºÅ³ ¸®½ºÆ®¿¡ ´ã´Â´Ù. if( mMonsterSkillTotalMap.Insert( monSkillIdx, pSkillInfo ) == false ) { assert(0); return false; } if( pSkillInfo->mAttackType < eMONSTERATTACK_MAX ) { /// ±âº» ½ºÅ³ 5°³¿¡´ëÇÑ Á¤º¸¸¦ ´ã´Â´Ù. cArray* pMonsterSkillAry = (cArray*)mMonsterBaseSkillMap.GetAt( pSkillInfo->mMonsterIdx ); if( pMonsterSkillAry == NULL ) { pMonsterSkillAry = new cArray; if( mMonsterBaseSkillMap.Insert( pSkillInfo->mMonsterIdx, pMonsterSkillAry ) == false) { assert(NULL); return false; } } pMonsterSkillAry->PushBack( pSkillInfo ); } /// drama Á¤º¸ »ý¼ººÎ #ifndef _CLIENT if( MONSTERSCRIPT != NULL ) { sMonsterScript* pMon = MONSTERSCRIPT->GetMonsterListInfo( pSkillInfo->mMonsterIdx ); if( pMon != NULL ) { if( FloatToInt( pMon->mSkillMinRange ) == 0 ) { pMon->mSkillMinRange = pSkillInfo->mTargetDist; pMon->mSkillMinRangeType = (unsigned char)pSkillInfo->mRangeType; } else { if( pMon->mSkillMinRange > pSkillInfo->mTargetDist ) { pMon->mSkillMinRange = pSkillInfo->mTargetDist; pMon->mSkillMinRangeType = (unsigned char)pSkillInfo->mRangeType; } } } else assert(NULL); } #endif } return true; ERR: delete pSkillInfo; return false; } sPlayerSkillBaseInfo* cSkillScript::GetPlayerSkillInfo( unsigned long skillNumber ) { sPlayerSkillBaseInfo* pSkillInfo = NULL; cSkillHashMap::cIterator start = mPlayerSkillInfoMap.Find( skillNumber ); cSkillHashMap::cIterator end = mPlayerSkillInfoMap.End(); if( start == end ) { return NULL; } pSkillInfo = (sPlayerSkillBaseInfo*)((*start).mSecond); if( pSkillInfo == NULL ) { assert(NULL); return NULL; } return pSkillInfo; } sMonsterSkillScript* cSkillScript::GetMonsterSkillInfo( unsigned long monsterClassIdx, eMONSTERATTACK_TYPE attackType ) { unsigned long skillIdx = monsterClassIdx*100 + attackType; return (sMonsterSkillScript*)mMonsterSkillTotalMap.GetAt( skillIdx ); } cSkillHashMap* cSkillScript::GetMonsterSkillTotalMap() { return &mMonsterSkillTotalMap; } void* cSkillScript::GetMonsterBaseSkillArr( unsigned long monsterClassIdx ) { return mMonsterBaseSkillMap.GetAt( monsterClassIdx ); } tArray* cSkillScript::GetPlayerSkillJob( unsigned long jobIdx ) { return (tArray*)mSkillJobMap.GetAt( jobIdx ); } sInfluenceScript* cSkillScript::GetInfluenceInfo( unsigned long influenceClassIdx ) { return (sInfluenceScript*)mInfluenceMap.GetAt( influenceClassIdx ); } sActInfluenceScript* cSkillScript::GetActInfluenceInfo( unsigned long actIdx ) { return (sActInfluenceScript*)mActInfluenceMap.GetAt( actIdx ); } bool cSkillScript::IsPlayerSkillJob( unsigned long skillJobIdx, unsigned long playerJob ) { tArray* pSkillJobArray = GetPlayerSkillJob( skillJobIdx ); if( pSkillJobArray == 0 ) return false; for( unsigned int i = 0 ; i < pSkillJobArray->GetSize() ; ++i ) { if( (*pSkillJobArray)[i] == playerJob ) return true; } #ifdef _CLIENT tArray* playerJobParent = GAMERESOURCEMAN->GetParentJob( playerJob ); #else tArray* playerJobParent = STATUSSCRIPT->GetParentJob( playerJob ); #endif if( playerJobParent ) { /// ¸ðµç »óÀ§ Á÷¾÷ °Ë»ç for( unsigned int j = 0 ; j < playerJobParent->GetSize() ; ++j ) { for( unsigned int i = 0 ; i < pSkillJobArray->GetSize() ; ++i ) { if( (*pSkillJobArray)[i] == (*playerJobParent)[j] ) { return true; } } } } return false; } bool cSkillScript::IsCastSkill( unsigned long skillIdx, unsigned char /*skillStep*/ ) { sPlayerSkillBaseInfo* pInfo = GetPlayerSkillInfo( skillIdx ); assert(pInfo); if( pInfo ) { if( pInfo->mShotType == eSHOTTYPE_CASTING ) return true; } return false; } bool cSkillScript::LoadSkillTree( const cString& pathName ) { cFileLoader loader; if( loader.Open( pathName, true ) == false ) return false; /// ·º¼­¿¡ ¹äÁÖ°í ÆÄ½Ì cToken token; cSkillTreeLexer lexer( loader.GetBufferPtr(), loader.GetSize() ); cParser parser( &lexer, pathName ); while( lexer.IsEnd() == false ) { lexer.GetNextToken( &token ); switch( token.mType ) { case eTOKEN_ERROR: return false; case eTOKEN_NULL: continue; case cSkillTreeLexer::eTOKEN_SKILLTREE: { unsigned long jobIdx = (unsigned long)parser.ParseInt(); cSkillTree* s = new cSkillTree; if( LoadTree( parser, s) == false ) { delete s; return false; } if( mSkillTreeMap.Insert(jobIdx, s) == false ) { assert(0); return false; } } break; default: assert( 0 && "invalid token" ); return false; } } return true; } bool cSkillScript::LoadTree( cParser& parser, cSkillTree* pTree ) { if( pTree == 0 ) return false; if( parser.ExpectTokenString( "{" ) == false ) { assert( 0 && "wrong script" ); return false; } cToken token; cLexer* lexer = parser.GetLexer(); cSkillTree::sTreeIcon buffer[100] = {0,}; unsigned int iconCount = 0; while( lexer->GetNextToken( &token ) ) { if( token == "}" ) { break; } switch( token.mType ) { case eTOKEN_ERROR: return false; case eTOKEN_NULL: continue; case cSkillTreeLexer::eTOKEN_IMAGEFILE: { pTree->mImageName = parser.ParseString(); } break; case cSkillTreeLexer::eTOKEN_SKILLPOS: { buffer[iconCount].skillIdx = parser.ParseInt(); buffer[iconCount].uiPosX = parser.ParseInt(); buffer[iconCount].uiPosY = parser.ParseInt(); iconCount++; } break; default: assert( 0 && "invalid token" ); return false; } } /// Àӽ÷Π´ã¾Æ³õÀº iconµéÀ» ´ã´Â´Ù. if( iconCount ) { pTree->mIconCount = iconCount; pTree->mIconList = new cSkillTree::sTreeIcon[iconCount]; ::memcpy( pTree->mIconList, buffer, sizeof(cSkillTree::sTreeIcon)*iconCount ); } return true; } bool cSkillScript::InfOverlapLoad() { cFileLoader loader; cString pathName = "./Script/resource/skilllist_overlap.txt"; if( loader.Open( pathName, true ) == false ) { assert( 0 && "failed to load skilllist_overlap.txt" ); return false; } cTokenizer tokenizer( loader.GetBufferPtr(), loader.GetSize(), " \t\r\n", pathName.Cstr() ); cString str; sPlayerSkillBaseInfo* pSkillInfo = 0; while( tokenizer.IsEnd() == false ) { /// Áߺ¹ºÒ°¡°íÀ¯idx if( tokenizer.GetNext( &str ) == false ) { goto ERR; } unsigned long overlapScriptIdx = str.ToInt(); cHashSet* pSet = (cHashSet*)mOverLapMap.GetAt( overlapScriptIdx ); if( pSet == NULL ) { pSet = new cHashSet; if( mOverLapMap.Insert( overlapScriptIdx, pSet ) == false ) return false; } /// ½ºÅ³ À̸§Idx if( tokenizer.GetNext( &str ) == false ) { goto ERR; } unsigned long notOverlapGroupIdx = str.ToInt(); pSet->Insert( notOverlapGroupIdx ); } return true; ERR: delete pSkillInfo; return false; } bool cSkillScript::IsInfOverLap( unsigned long overlapScriptIdx, unsigned long notOverLapIdx ) { cHashSet* pSet = (cHashSet*)mOverLapMap.GetAt( overlapScriptIdx ); if( pSet == NULL ) return false; cHashSet::cIterator f = pSet->Find( notOverLapIdx ); cHashSet::cIterator e = pSet->End(); if( f == e ) return false; return true; } unsigned long cSkillScript::GetBridgeSkillMap( unsigned long skillIdx, unsigned long skillStep ) { cHashMap* pStepMap = (cHashMap*)mBridgeSkillMap.GetAt( skillIdx ); if( pStepMap == NULL ) return 0; unsigned long nextBridge = 0; pStepMap->GetAt( &nextBridge, skillStep ); return nextBridge; }