SHARE
TWEET

Untitled

a guest Jul 16th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void CPythonSkill::__RegisterPetSkillIcon(TPetSkillData & rData, const char * c_szHeader, const char * c_szImageName)
  2. {
  3.     std::string strFileName = "";
  4.     strFileName += c_szHeader;
  5.     strFileName += c_szImageName;
  6.     strFileName += ".sub";
  7.     rData.pImage = CResourceManager::Instance().LoadResource<CGraphicImage>(strFileName);
  8.  
  9. }
  10.  
  11. bool CPythonSkill::RegisterPetSkill(const char * c_szFileName)
  12. {
  13.     CMappedFile kFile;
  14.     if (!GetPak().OpenFile(c_szFileName, kFile))
  15.         return false;
  16.  
  17.     CMemoryTextFileLoader textFileLoader;
  18.     textFileLoader.Bind(kFile.Size(), kFile.Get());
  19.  
  20.     CTokenVector TokenVector;
  21.     for (DWORD i = 0; i < textFileLoader.GetLineCount(); ++i) {
  22.         if (!textFileLoader.SplitLineByTab(i, &TokenVector))
  23.             continue;
  24.  
  25.  
  26.         if (PET_SKILL_TOKEN_VNUM >= TokenVector.size()) {
  27.             TraceError("PetSkill.line(%d).NO_VNUM_ERROR\n", i + 1);
  28.             continue;
  29.         }
  30.  
  31.         auto skillIndex = std::stoul(TokenVector[PET_SKILL_TOKEN_VNUM]);
  32.         if (skillIndex == 0) {
  33.             TraceError("PetSkill.line(%d).NO_INDEX_ERROR\n", i + 1);
  34.             continue;
  35.         }
  36.  
  37.         m_PetSkillDataMap.emplace(skillIndex, TPetSkillData());
  38.         auto& rSkillData = m_PetSkillDataMap[skillIndex];
  39.  
  40.         rSkillData.skillId = skillIndex;
  41.         rSkillData.name = TokenVector[PET_SKILL_TOKEN_NAME];
  42.         rSkillData.icon = TokenVector[PET_SKILL_TOKEN_ICON];
  43.         auto type = TokenVector[PET_SKILL_TOKEN_SKILL_TYPE];
  44.         if (type == "PASSIVE")
  45.             rSkillData.type = PET_SKILL_TYPE_PASSIVE;
  46.         else if (type == "AUTO")
  47.             rSkillData.type = PET_SKILL_TYPE_AUTO;
  48.         else
  49.             rSkillData.type = PET_SKILL_TYPE_NONE;
  50.  
  51.         rSkillData.description = TokenVector[PET_SKILL_TOKEN_DESC];
  52.         rSkillData.cooltime = std::stoul(TokenVector[PET_SKILL_TOKEN_COOLTIME]);
  53.  
  54.         char szIconFileNameHeader[64 + 1];
  55.         _snprintf(szIconFileNameHeader, sizeof(szIconFileNameHeader), "%sskill/pet/", g_strImagePath.c_str());
  56.  
  57.         __RegisterPetSkillIcon(rSkillData, szIconFileNameHeader, rSkillData.icon.c_str());
  58.  
  59.     }
  60.  
  61.     return true;
  62. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top