diff --git a/server/game/src/DragonSoul.cpp b/server/game/src/DragonSoul.cpp deleted file mode 100755 index 03c703b..0000000 --- a/server/game/src/DragonSoul.cpp +++ /dev/null @@ -1,1158 +0,0 @@ -#include "stdafx.h" -#include "constants.h" -#include "item.h" -#include "item_manager.h" -#include "unique_item.h" -#include "packet.h" -#include "desc.h" -#include "char.h" -#include "dragon_soul_table.h" -#include "log.h" -#include "DragonSoul.h" -#include - -typedef std::vector TTokenVector; -template T MINMAX(T min, T value, T max) -{ - T tv; - - tv = (min > value ? min : value); - return (max < tv) ? max : tv; -} -int Gamble(std::vector& vec_probs) -{ - float range = 0.f; - for (int i = 0; i < vec_probs.size(); i++) - { - range += vec_probs[i]; - } - float fProb = fnumber(0.f, range); - float sum = 0.f; - for (int idx = 0; idx < vec_probs.size(); idx++) - { - sum += vec_probs[idx]; - if (sum >= fProb) - return idx; - } - return -1; -} - -// °¡ÁßÄ¡ Å×À̺í(prob_lst)À» ¹Þ¾Æ random_set.size()°³ÀÇ index¸¦ ¼±ÅÃÇÏ¿© random_setÀ» return -bool MakeDistinctRandomNumberSet(std::list prob_lst, OUT std::vector& random_set) -{ - int size = prob_lst.size(); - int n = random_set.size(); - if (size < n) - return false; - - std::vector select_bit(size, 0); - for (int i = 0; i < n; i++) - { - float range = 0.f; - for (std::list ::iterator it = prob_lst.begin(); it != prob_lst.end(); it++) - { - range += *it; - } - float r = fnumber (0.f, range); - float sum = 0.f; - int idx = 0; - for (std::list ::iterator it = prob_lst.begin(); it != prob_lst.end(); it++) - { - while (select_bit[idx++]); - - sum += *it; - if (sum >= r) - { - select_bit[idx - 1] = 1; - random_set[i] = idx - 1; - prob_lst.erase(it); - break; - } - } - } - return true; -} - -/* ¿ëÈ¥¼® Vnum¿¡ ´ëÇÑ comment - * ITEM VNUMÀ» 10¸¸ ÀÚ¸®ºÎÅÍ, FEDCBA¶ó°í ÇÑ´Ù¸é - * FE : ¿ëÈ¥¼® Á¾·ù. D : µî±Þ - * C : ´Ü°è B : °­È­ - * A : ¿©¹úÀÇ ¹øÈ£µé... - */ - -BYTE GetType(DWORD dwVnum) -{ - return (dwVnum / 10000); -} - -BYTE GetGradeIdx(DWORD dwVnum) -{ - return (dwVnum / 1000) % 10; -} - -BYTE GetStepIdx(DWORD dwVnum) -{ - return (dwVnum / 100) % 10; -} - -BYTE GetStrengthIdx(DWORD dwVnum) -{ - return (dwVnum / 10) % 10; -} - -bool DSManager::ReadDragonSoulTableFile(const char * c_pszFileName) -{ - m_pTable = new DragonSoulTable(); - return m_pTable->ReadDragonSoulTableFile(c_pszFileName); -} - -void DSManager::GetDragonSoulInfo(DWORD dwVnum, BYTE& bType, BYTE& bGrade, BYTE& bStep, BYTE& bStrength) const -{ - bType = GetType(dwVnum); - bGrade = GetGradeIdx(dwVnum); - bStep = GetStepIdx(dwVnum); - bStrength = GetStrengthIdx(dwVnum); -} - -bool DSManager::IsValidCellForThisItem(const LPITEM pItem, const TItemPos& Cell) const -{ - if (NULL == pItem) - return false; - - WORD wBaseCell = GetBasePosition(pItem); - if (WORD_MAX == wBaseCell) - return false; - - if (Cell.window_type != DRAGON_SOUL_INVENTORY - || (Cell.cell < wBaseCell || Cell.cell >= wBaseCell + DRAGON_SOUL_BOX_SIZE)) - { - return false; - } - else - return true; - -} - -WORD DSManager::GetBasePosition(const LPITEM pItem) const -{ - if (NULL == pItem) - return WORD_MAX; - - BYTE type, grade_idx, step_idx, strength_idx; - GetDragonSoulInfo(pItem->GetVnum(), type, grade_idx, step_idx, strength_idx); - - BYTE col_type = pItem->GetSubType(); - BYTE row_type = grade_idx; - if (row_type > DRAGON_SOUL_GRADE_MAX) - return WORD_MAX; - - return col_type * DRAGON_SOUL_STEP_MAX * DRAGON_SOUL_BOX_SIZE + row_type * DRAGON_SOUL_BOX_SIZE; -} - -bool DSManager::RefreshItemAttributes(LPITEM pDS) -{ - if (!pDS->IsDragonSoul()) - { - sys_err ("This item(ID : %d) is not DragonSoul.", pDS->GetID()); - return false; - } - - BYTE ds_type, grade_idx, step_idx, strength_idx; - GetDragonSoulInfo(pDS->GetVnum(), ds_type, grade_idx, step_idx, strength_idx); - - DragonSoulTable::TVecApplys vec_basic_applys; - DragonSoulTable::TVecApplys vec_addtional_applys; - - if (!m_pTable->GetBasicApplys(ds_type, vec_basic_applys)) - { - sys_err ("There is no BasicApply about %d type dragon soul.", ds_type); - return false; - } - - if (!m_pTable->GetAdditionalApplys(ds_type, vec_addtional_applys)) - { - sys_err ("There is no AdditionalApply about %d type dragon soul.", ds_type); - return false; - } - - // add_min°ú add_max´Â ´õ¹Ì·Î ÀÐÀ½. - int basic_apply_num, add_min, add_max; - if (!m_pTable->GetApplyNumSettings(ds_type, grade_idx, basic_apply_num, add_min, add_max)) - { - sys_err ("In ApplyNumSettings, INVALID VALUES Group type(%d), GRADE idx(%d)", ds_type, grade_idx); - return false; - } - - float fWeight = 0.f; - if (!m_pTable->GetWeight(ds_type, grade_idx, step_idx, strength_idx, fWeight)) - { - return false; - } - fWeight /= 100.f; - - int n = MIN(basic_apply_num, vec_basic_applys.size()); - for (int i = 0; i < n; i++) - { - const SApply& basic_apply = vec_basic_applys[i]; - BYTE bType = basic_apply.apply_type; - short sValue = (short)(ceil((float)basic_apply.apply_value * fWeight - 0.01f)); - - pDS->SetForceAttribute(i, bType, sValue); - } - - for (int i = DRAGON_SOUL_ADDITIONAL_ATTR_START_IDX; i < ITEM_ATTRIBUTE_MAX_NUM; i++) - { - BYTE bType = pDS->GetAttributeType(i); - short sValue = 0; - if (APPLY_NONE == bType) - continue; - for (int j = 0; j < vec_addtional_applys.size(); j++) - { - if (vec_addtional_applys[j].apply_type == bType) - { - sValue = vec_addtional_applys[j].apply_value; - break; - } - } - pDS->SetForceAttribute(i, bType, (short)(ceil((float)sValue * fWeight - 0.01f))); - } - return true; -} - -bool DSManager::PutAttributes(LPITEM pDS) -{ - if (!pDS->IsDragonSoul()) - { - sys_err ("This item(ID : %d) is not DragonSoul.", pDS->GetID()); - return false; - } - - BYTE ds_type, grade_idx, step_idx, strength_idx; - GetDragonSoulInfo(pDS->GetVnum(), ds_type, grade_idx, step_idx, strength_idx); - - DragonSoulTable::TVecApplys vec_basic_applys; - DragonSoulTable::TVecApplys vec_addtional_applys; - - if (!m_pTable->GetBasicApplys(ds_type, vec_basic_applys)) - { - sys_err ("There is no BasicApply about %d type dragon soul.", ds_type); - return false; - } - if (!m_pTable->GetAdditionalApplys(ds_type, vec_addtional_applys)) - { - sys_err ("There is no AdditionalApply about %d type dragon soul.", ds_type); - return false; - } - - - int basic_apply_num, add_min, add_max; - if (!m_pTable->GetApplyNumSettings(ds_type, grade_idx, basic_apply_num, add_min, add_max)) - { - sys_err ("In ApplyNumSettings, INVALID VALUES Group type(%d), GRADE idx(%d)", ds_type, grade_idx); - return false; - } - - float fWeight = 0.f; - if (!m_pTable->GetWeight(ds_type, grade_idx, step_idx, strength_idx, fWeight)) - { - return false; - } - fWeight /= 100.f; - - int n = MIN(basic_apply_num, vec_basic_applys.size()); - for (int i = 0; i < n; i++) - { - const SApply& basic_apply = vec_basic_applys[i]; - BYTE bType = basic_apply.apply_type; - short sValue = (short)(ceil((float)basic_apply.apply_value * fWeight - 0.01f)); - - pDS->SetForceAttribute(i, bType, sValue); - } - - BYTE additional_attr_num = MIN(number (add_min, add_max), 3); - - std::vector random_set; - if (additional_attr_num > 0) - { - random_set.resize(additional_attr_num); - std::list list_probs; - for (int i = 0; i < vec_addtional_applys.size(); i++) - { - list_probs.push_back(vec_addtional_applys[i].prob); - } - if (!MakeDistinctRandomNumberSet(list_probs, random_set)) - { - sys_err ("MakeDistinctRandomNumberSet error."); - return false; - } - - for (int i = 0; i < additional_attr_num; i++) - { - int r = random_set[i]; - const SApply& additional_attr = vec_addtional_applys[r]; - BYTE bType = additional_attr.apply_type; - short sValue = (short)(ceil((float)additional_attr.apply_value * fWeight - 0.01f)); - - pDS->SetForceAttribute(DRAGON_SOUL_ADDITIONAL_ATTR_START_IDX + i, bType, sValue); - } - } - - return true; -} - -bool DSManager::DragonSoulItemInitialize(LPITEM pItem) -{ - if (NULL == pItem || !pItem->IsDragonSoul()) - return false; - PutAttributes(pItem); - int time = DSManager::instance().GetDuration(pItem); - if (time > 0) - pItem->SetSocket(ITEM_SOCKET_REMAIN_SEC, time); - return true; -} - -DWORD DSManager::MakeDragonSoulVnum(BYTE bType, BYTE grade, BYTE step, BYTE refine) -{ - return bType * 10000 + grade * 1000 + step * 100 + refine * 10; -} - -int DSManager::GetDuration(const LPITEM pItem) const -{ - return pItem->GetDuration(); -} - -// ¿ëÈ¥¼®À» ¹Þ¾Æ¼­ ¿ë½ÉÀ» ÃßÃâÇÏ´Â ÇÔ¼ö -bool DSManager::ExtractDragonHeart(LPCHARACTER ch, LPITEM pItem, LPITEM pExtractor) -{ - if (NULL == ch || NULL == pItem) - return false; - if (pItem->IsEquipped()) - { - ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Âø¿ë ÁßÀÎ ¿ëÈ¥¼®Àº ÃßÃâÇÒ ¼ö ¾ø½À´Ï´Ù.")); - return false; - } - - DWORD dwVnum = pItem->GetVnum(); - BYTE ds_type, grade_idx, step_idx, strength_idx; - GetDragonSoulInfo(dwVnum, ds_type, grade_idx, step_idx, strength_idx); - - int iBonus = 0; - - if (NULL != pExtractor) - { - iBonus = pExtractor->GetValue(0); - } - - std::vector vec_chargings; - std::vector vec_probs; - - if (!m_pTable->GetDragonHeartExtValues(ds_type, grade_idx, vec_chargings, vec_probs)) - { - return false; - } - - int idx = Gamble(vec_probs); - - float sum = 0.f; - if (-1 == idx) - { - sys_err ("Gamble is failed. ds_type(%d), grade_idx(%d)", ds_type, grade_idx); - return false; - } - - float fCharge = vec_chargings[idx] * (100 + iBonus) / 100.f; - fCharge = MINMAX (0.f, fCharge, 100.f); - - if (fCharge < FLT_EPSILON) - { - pItem->SetCount(pItem->GetCount() - 1); - if (NULL != pExtractor) - { - pExtractor->SetCount(pExtractor->GetCount() - 1); - } - LogManager::instance().ItemLog(ch, pItem, "DS_HEART_EXTRACT_FAIL", ""); - - ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¿ë½É ÃßÃâ¿¡ ½ÇÆÐÇÏ¿´½À´Ï´Ù.")); - return false; - } - else - { - LPITEM pDH = ITEM_MANAGER::instance().CreateItem(DRAGON_HEART_VNUM); - - if (NULL == pDH) - { - sys_err ("Cannot create DRAGON_HEART(%d).", DRAGON_HEART_VNUM); - // return NULL; - return false; - } - - pItem->SetCount(pItem->GetCount() - 1); - if (NULL != pExtractor) - { - pExtractor->SetCount(pExtractor->GetCount() - 1); - } - - int iCharge = (int)(fCharge + 0.5f); - pDH->SetSocket(ITEM_SOCKET_CHARGING_AMOUNT_IDX, iCharge); - ch->AutoGiveItem(pDH, true); - - std::string s = boost::lexical_cast (iCharge); - s += "%s"; - LogManager::instance().ItemLog(ch, pItem, "DS_HEART_EXTRACT_SUCCESS", s.c_str()); - ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¿ë½É ÃßÃâ¿¡ ¼º°øÇÏ¿´½À´Ï´Ù.")); - return true; - } -} - -// ƯÁ¤ ¿ëÈ¥¼®À» Àåºñâ¿¡¼­ Á¦°ÅÇÒ ¶§¿¡ ¼º°ø ¿©ºÎ¸¦ °áÁ¤Çϰí, ½ÇÆÐ½Ã ºÎ»ê¹°À» ÁÖ´Â ÇÔ¼ö. -bool DSManager::PullOut(LPCHARACTER ch, TItemPos DestCell, LPITEM& pItem, LPITEM pExtractor) -{ - if (NULL == ch || NULL == pItem) - { - sys_err ("NULL POINTER. ch(%p) or pItem(%p)", ch, pItem); - return false; - } - - // ¸ñÇ¥ À§Ä¡°¡ validÇÑÁö °Ë»ç ÈÄ, validÇÏÁö ¾Ê´Ù¸é ÀÓÀÇÀÇ ºó °ø°£À» ã´Â´Ù. - if (!IsValidCellForThisItem(pItem, DestCell)) - { - int iEmptyCell = ch->GetEmptyDragonSoulInventory(pItem); - if (iEmptyCell < 0) - { - ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼ÒÁöǰ¿¡ ºó °ø°£ÀÌ ¾ø½À´Ï´Ù.")); - return false; - } - else - { - DestCell.window_type = DRAGON_SOUL_INVENTORY; - DestCell.cell = iEmptyCell; - } - } - - if (!pItem->IsEquipped() || !pItem->RemoveFromCharacter()) - return false; - - bool bSuccess; - DWORD dwByProduct = 0; - int iBonus = 0; - float fProb; - float fDice; - // ¿ëÈ¥¼® ÃßÃâ ¼º°ø ¿©ºÎ °áÁ¤. - { - DWORD dwVnum = pItem->GetVnum(); - - BYTE ds_type, grade_idx, step_idx, strength_idx; - GetDragonSoulInfo(pItem->GetVnum(), ds_type, grade_idx, step_idx, strength_idx); - - // ÃßÃâ Á¤º¸°¡ ¾ø´Ù¸é ÀÏ´Ü ¹«Á¶°Ç ¼º°øÇÏ´Â °ÍÀ̶ó »ý°¢ÇÏÀÚ. - if (!m_pTable->GetDragonSoulExtValues(ds_type, grade_idx, fProb, dwByProduct)) - { - pItem->AddToCharacter(ch, DestCell); - return true; - } - - - if (NULL != pExtractor) - { - iBonus = pExtractor->GetValue(ITEM_VALUE_DRAGON_SOUL_POLL_OUT_BONUS_IDX); - pExtractor->SetCount(pExtractor->GetCount() - 1); - } - fDice = fnumber(0.f, 100.f); - bSuccess = fDice <= (fProb * (100 + iBonus) / 100.f); - } - - // ij¸¯ÅÍÀÇ ¿ëÈ¥¼® ÃßÃâ ¹× Ãß°¡ ȤÀº Á¦°Å. ºÎ»ê¹° Á¦°ø. - { - char buf[128]; - - if (bSuccess) - { - if (pExtractor) - { - sprintf(buf, "dice(%d) prob(%d + %d) EXTR(VN:%d)", (int)fDice, (int)fProb, iBonus, pExtractor->GetVnum()); - } - else - { - sprintf(buf, "dice(%d) prob(%d)", fDice, fProb); - } - LogManager::instance().ItemLog(ch, pItem, "DS_PULL_OUT_SUCCESS", buf); - ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¿ëÈ¥¼® ÃßÃâ¿¡ ¼º°øÇÏ¿´½À´Ï´Ù.")); - pItem->AddToCharacter(ch, DestCell); - return true; - } - else - { - if (pExtractor) - { - sprintf(buf, "dice(%d) prob(%d + %d) EXTR(VN:%d) ByProd(VN:%d)", (int)fDice, (int)fProb, iBonus, pExtractor->GetVnum(), dwByProduct); - } - else - { - sprintf(buf, "dice(%d) prob(%d) ByProd(VNUM:%d)", (int)fDice, (int)fProb, dwByProduct); - } - LogManager::instance().ItemLog(ch, pItem, "DS_PULL_OUT_FAILED", buf); - M2_DESTROY_ITEM(pItem); - pItem = NULL; - if (dwByProduct) - { - LPITEM pByProduct = ch->AutoGiveItem(dwByProduct, true); - if (pByProduct) - ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¿ëÈ¥¼® ÃßÃâ¿¡ ½ÇÆÐÇÏ¿© %s¸¦ ¾ò¾ú½À´Ï´Ù."), pByProduct->GetName()); - else - ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¿ëÈ¥¼® ÃßÃâ¿¡ ½ÇÆÐÇÏ¿´½À´Ï´Ù.")); - } - else - ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¿ëÈ¥¼® ÃßÃâ¿¡ ½ÇÆÐÇÏ¿´½À´Ï´Ù.")); - } - } - - return bSuccess; -} - -bool DSManager::DoRefineGrade(LPCHARACTER ch, TItemPos (&aItemPoses)[DRAGON_SOUL_REFINE_GRID_SIZE]) -{ - if (NULL == ch) - return false; - - if (NULL == aItemPoses) - { - return false; - } - - if (!ch->DragonSoul_RefineWindow_CanRefine()) - { - sys_err ("%s do not activate DragonSoulRefineWindow. But how can he come here?", ch->GetName()); - ch->ChatPacket(CHAT_TYPE_INFO, "[SYSTEM ERROR]You cannot upgrade dragon soul without refine window."); - return false; - } - - // Ȥ½Ã³ª ¸ð¸¦ Áߺ¹µÇ´Â item pointer ¾ø¾Ö±â À§Çؼ­ set »ç¿ë - // ÀÌ»óÇÑ ÆÐŶÀ» º¸³¾ °æ¿ì, Áߺ¹µÈ TItemPos°¡ ÀÖÀ» ¼öµµ ÀÖ°í, À߸øµÈ TItemPos°¡ ÀÖÀ» ¼öµµ ÀÖ´Ù. - std::set set_items; - for (int i = 0; i < DRAGON_SOUL_REFINE_GRID_SIZE; i++) - { - if (aItemPoses[i].IsEquipPosition()) - return false; - LPITEM pItem = ch->GetItem(aItemPoses[i]); - if (NULL != pItem) - { - // ¿ëÈ¥¼®ÀÌ ¾Æ´Ñ ¾ÆÀÌÅÛÀÌ °³·®Ã¢¿¡ ÀÖÀ» ¼ö ¾ø´Ù. - if (!pItem->IsDragonSoul()) - { - ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("µî±Þ °³·®¿¡ ÇÊ¿äÇÑ Àç·á°¡ ¾Æ´Õ´Ï´Ù.")); - SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL_INVALID_MATERIAL, TItemPos(pItem->GetWindow(), pItem->GetCell())); - - return false; - } - - set_items.insert(pItem); - } - } - - if (set_items.size() == 0) - { - SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL_NOT_ENOUGH_MATERIAL, NPOS); - return false; - } - - int count = set_items.size(); - int need_count = 0; - int fee = 0; - std::vector vec_probs; - float prob_sum; - - BYTE ds_type, grade_idx, step_idx, strength_idx; - int result_grade; - - // °¡Àå óÀ½ °ÍÀ» °­È­ÀÇ ±âÁØÀ¸·Î »ï´Â´Ù. - std::set ::iterator it = set_items.begin(); - { - LPITEM pItem = *it; - - GetDragonSoulInfo(pItem->GetVnum(), ds_type, grade_idx, step_idx, strength_idx); - - if (!m_pTable->GetRefineGradeValues(ds_type, grade_idx, need_count, fee, vec_probs)) - { - ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("µî±Þ °³·®ÇÒ ¼ö ¾ø´Â ¿ëÈ¥¼®ÀÔ´Ï´Ù.")); - SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL_INVALID_MATERIAL, TItemPos(pItem->GetWindow(), pItem->GetCell())); - - return false; - } - } - while (++it != set_items.end()) - { - LPITEM pItem = *it; - - // Ŭ¶ó ui¿¡¼­ ÀåÂøÇÑ ¾ÆÀÌÅÛÀº °³·®Ã¢¿¡ ¿Ã¸± ¼ö ¾øµµ·Ï ¸·¾Ò±â ¶§¹®¿¡, - // º°µµÀÇ ¾Ë¸² 󸮴 ¾ÈÇÔ. - if (pItem->IsEquipped()) - { - return false; - } - - if (ds_type != GetType(pItem->GetVnum()) || grade_idx != GetGradeIdx(pItem->GetVnum())) - { - ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("µî±Þ °³·®¿¡ ÇÊ¿äÇÑ Àç·á°¡ ¾Æ´Õ´Ï´Ù.")); - SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL_INVALID_MATERIAL, TItemPos(pItem->GetWindow(), pItem->GetCell())); - - return false; - } - } - - // Ŭ¶ó¿¡¼­ Çѹø °¹¼ö üũ¸¦ Çϱ⠶§¹®¿¡ count != need_count¶ó¸é invalid Ŭ¶óÀÏ °¡´É¼ºÀÌ Å©´Ù. - if (count != need_count) - { - sys_err ("Possiblity of invalid client. Name %s", ch->GetName()); - BYTE bSubHeader = count < need_count? DS_SUB_HEADER_REFINE_FAIL_NOT_ENOUGH_MATERIAL : DS_SUB_HEADER_REFINE_FAIL_TOO_MUCH_MATERIAL; - SendRefineResultPacket(ch, bSubHeader, NPOS); - return false; - } - - if (ch->GetGold() < fee) - { - ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°³·®À» Çϱâ À§ÇÑ µ·ÀÌ ºÎÁ·ÇÕ´Ï´Ù.")); - SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL_NOT_ENOUGH_MONEY, NPOS); - return false; - } - - if (-1 == (result_grade = Gamble(vec_probs))) - { - sys_err ("Gamble failed. See RefineGardeTables' probabilities"); - return false; - } - - LPITEM pResultItem = ITEM_MANAGER::instance().CreateItem(MakeDragonSoulVnum(ds_type, (BYTE)result_grade, 0, 0)); - - if (NULL == pResultItem) - { - sys_err ("INVALID DRAGON SOUL(%d)", MakeDragonSoulVnum(ds_type, (BYTE)result_grade, 0, 0)); - return false; - } - - ch->PointChange(POINT_GOLD, -fee); - int left_count = need_count; - - for (std::set ::iterator it = set_items.begin(); it != set_items.end(); it++) - { - LPITEM pItem = *it; - int n = pItem->GetCount(); - if (left_count > n) - { - pItem->RemoveFromCharacter(); - M2_DESTROY_ITEM(pItem); - left_count -= n; - } - else - { - pItem->SetCount(n - left_count); - } - } - - ch->AutoGiveItem(pResultItem, true); - - if (result_grade > grade_idx) - { - char buf[128]; - sprintf(buf, "GRADE : %d -> %d", grade_idx, result_grade); - LogManager::instance().ItemLog(ch, pResultItem, "DS_GRADE_REFINE_SUCCESS", buf); - ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("µî±Þ °³·®¿¡ ¼º°øÇß½À´Ï´Ù.")); - SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_SUCCEED, TItemPos (pResultItem->GetWindow(), pResultItem->GetCell())); - return true; - } - else - { - char buf[128]; - sprintf(buf, "GRADE : %d -> %d", grade_idx, result_grade); - LogManager::instance().ItemLog(ch, pResultItem, "DS_GRADE_REFINE_FAIL", buf); - ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("µî±Þ °³·®¿¡ ½ÇÆÐÇß½À´Ï´Ù.")); - SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL, TItemPos (pResultItem->GetWindow(), pResultItem->GetCell())); - return false; - } -} - -bool DSManager::DoRefineStep(LPCHARACTER ch, TItemPos (&aItemPoses)[DRAGON_SOUL_REFINE_GRID_SIZE]) -{ - if (NULL == ch) - return false; - if (NULL == aItemPoses) - { - return false; - } - - if (!ch->DragonSoul_RefineWindow_CanRefine()) - { - sys_err ("%s do not activate DragonSoulRefineWindow. But how can he come here?", ch->GetName()); - ch->ChatPacket(CHAT_TYPE_INFO, "[SYSTEM ERROR]You cannot use dragon soul refine window."); - return false; - } - - // Ȥ½Ã³ª ¸ð¸¦ Áߺ¹µÇ´Â item pointer ¾ø¾Ö±â À§Çؼ­ set »ç¿ë - // ÀÌ»óÇÑ ÆÐŶÀ» º¸³¾ °æ¿ì, Áߺ¹µÈ TItemPos°¡ ÀÖÀ» ¼öµµ ÀÖ°í, À߸øµÈ TItemPos°¡ ÀÖÀ» ¼öµµ ÀÖ´Ù. - std::set set_items; - for (int i = 0; i < DRAGON_SOUL_REFINE_GRID_SIZE; i++) - { - LPITEM pItem = ch->GetItem(aItemPoses[i]); - if (NULL != pItem) - { - // ¿ëÈ¥¼®ÀÌ ¾Æ´Ñ ¾ÆÀÌÅÛÀÌ °³·®Ã¢¿¡ ÀÖÀ» ¼ö ¾ø´Ù. - if (!pItem->IsDragonSoul()) - { - ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´Ü°è °³·®¿¡ ÇÊ¿äÇÑ Àç·á°¡ ¾Æ´Õ´Ï´Ù.")); - SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL_INVALID_MATERIAL, TItemPos(pItem->GetWindow(), pItem->GetCell())); - return false; - } - set_items.insert(pItem); - } - } - - if (set_items.size() == 0) - { - SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL_NOT_ENOUGH_MATERIAL, NPOS); - return false; - } - - std::string stGroupName; - int count = set_items.size(); - int need_count = 0; - int fee = 0; - std::vector vec_probs; - - BYTE ds_type, grade_idx, step_idx, strength_idx; - int result_step; - - // °¡Àå óÀ½ °ÍÀ» °­È­ÀÇ ±âÁØÀ¸·Î »ï´Â´Ù. - std::set ::iterator it = set_items.begin(); - { - LPITEM pItem = *it; - GetDragonSoulInfo(pItem->GetVnum(), ds_type, grade_idx, step_idx, strength_idx); - - if (!m_pTable->GetRefineStepValues(ds_type, step_idx, need_count, fee, vec_probs)) - { - ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´Ü°è °³·®ÇÒ ¼ö ¾ø´Â ¿ëÈ¥¼®ÀÔ´Ï´Ù.")); - SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL_INVALID_MATERIAL, TItemPos(pItem->GetWindow(), pItem->GetCell())); - return false; - } - } - - while(++it != set_items.end()) - { - LPITEM pItem = *it; - // Ŭ¶ó ui¿¡¼­ ÀåÂøÇÑ ¾ÆÀÌÅÛÀº °³·®Ã¢¿¡ ¿Ã¸± ¼ö ¾øµµ·Ï ¸·¾Ò±â ¶§¹®¿¡, - // º°µµÀÇ ¾Ë¸² 󸮴 ¾ÈÇÔ. - if (pItem->IsEquipped()) - { - return false; - } - if (ds_type != GetType(pItem->GetVnum()) || grade_idx != GetGradeIdx(pItem->GetVnum()) || step_idx != GetStepIdx(pItem->GetVnum())) - { - ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´Ü°è °³·®¿¡ ÇÊ¿äÇÑ Àç·á°¡ ¾Æ´Õ´Ï´Ù.")); - SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL_INVALID_MATERIAL, TItemPos(pItem->GetWindow(), pItem->GetCell())); - return false; - } - } - - // Ŭ¶ó¿¡¼­ Çѹø °¹¼ö üũ¸¦ Çϱ⠶§¹®¿¡ count != need_count¶ó¸é invalid Ŭ¶óÀÏ °¡´É¼ºÀÌ Å©´Ù. - if (count != need_count) - { - sys_err ("Possiblity of invalid client. Name %s", ch->GetName()); - BYTE bSubHeader = count < need_count? DS_SUB_HEADER_REFINE_FAIL_NOT_ENOUGH_MATERIAL : DS_SUB_HEADER_REFINE_FAIL_TOO_MUCH_MATERIAL; - SendRefineResultPacket(ch, bSubHeader, NPOS); - return false; - } - - if (ch->GetGold() < fee) - { - ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°³·®À» Çϱâ À§ÇÑ µ·ÀÌ ºÎÁ·ÇÕ´Ï´Ù.")); - SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL_NOT_ENOUGH_MONEY, NPOS); - return false; - } - - float sum = 0.f; - - if (-1 == (result_step = Gamble(vec_probs))) - { - sys_err ("Gamble failed. See RefineStepTables' probabilities"); - return false; - } - - LPITEM pResultItem = ITEM_MANAGER::instance().CreateItem(MakeDragonSoulVnum(ds_type, grade_idx, (BYTE)result_step, 0)); - - if (NULL == pResultItem) - { - sys_err ("INVALID DRAGON SOUL(%d)", MakeDragonSoulVnum(ds_type, grade_idx, (BYTE)result_step, 0)); - return false; - } - - ch->PointChange(POINT_GOLD, -fee); - int left_count = need_count; - for (std::set ::iterator it = set_items.begin(); it != set_items.end(); it++) - { - LPITEM pItem = *it; - int n = pItem->GetCount(); - if (left_count > n) - { - pItem->RemoveFromCharacter(); - M2_DESTROY_ITEM(pItem); - left_count -= n; - } - else - { - pItem->SetCount(n - left_count); - } - } - - ch->AutoGiveItem(pResultItem, true); - if (result_step > step_idx) - { - char buf[128]; - sprintf(buf, "STEP : %d -> %d", step_idx, result_step); - LogManager::instance().ItemLog(ch, pResultItem, "DS_STEP_REFINE_SUCCESS", buf); - ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´Ü°è °³·®¿¡ ¼º°øÇß½À´Ï´Ù.")); - SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_SUCCEED, TItemPos (pResultItem->GetWindow(), pResultItem->GetCell())); - return true; - } - else - { - char buf[128]; - sprintf(buf, "STEP : %d -> %d", step_idx, result_step); - LogManager::instance().ItemLog(ch, pResultItem, "DS_STEP_REFINE_FAIL", buf); - ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´Ü°è °³·®¿¡ ½ÇÆÐÇß½À´Ï´Ù.")); - SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL, TItemPos (pResultItem->GetWindow(), pResultItem->GetCell())); - return false; - } -} - -bool IsDragonSoulRefineMaterial(LPITEM pItem) -{ - if (pItem->GetType() != ITEM_MATERIAL) - return false; - return (pItem->GetSubType() == MATERIAL_DS_REFINE_NORMAL || - pItem->GetSubType() == MATERIAL_DS_REFINE_BLESSED || - pItem->GetSubType() == MATERIAL_DS_REFINE_HOLLY); -} - -bool DSManager::DoRefineStrength(LPCHARACTER ch, TItemPos (&aItemPoses)[DRAGON_SOUL_REFINE_GRID_SIZE]) -{ - if (NULL == ch) - return false; - if (NULL == aItemPoses) - { - return false; - } - - if (!ch->DragonSoul_RefineWindow_CanRefine()) - { - sys_err ("%s do not activate DragonSoulRefineWindow. But how can he come here?", ch->GetName()); - ch->ChatPacket(CHAT_TYPE_INFO, "[SYSTEM ERROR]You cannot use dragon soul refine window."); - return false; - } - - // Ȥ½Ã³ª ¸ð¸¦ Áߺ¹µÇ´Â item pointer ¾ø¾Ö±â À§Çؼ­ set »ç¿ë - // ÀÌ»óÇÑ ÆÐŶÀ» º¸³¾ °æ¿ì, Áߺ¹µÈ TItemPos°¡ ÀÖÀ» ¼öµµ ÀÖ°í, À߸øµÈ TItemPos°¡ ÀÖÀ» ¼öµµ ÀÖ´Ù. - std::set set_items; - for (int i = 0; i < DRAGON_SOUL_REFINE_GRID_SIZE; i++) - { - LPITEM pItem = ch->GetItem(aItemPoses[i]); - if (pItem) - { - set_items.insert(pItem); - } - } - if (set_items.size() == 0) - { - return false; - } - - int fee; - - LPITEM pRefineStone = NULL; - LPITEM pDragonSoul = NULL; - for (std::set ::iterator it = set_items.begin(); it != set_items.end(); it++) - { - LPITEM pItem = *it; - // Ŭ¶ó ui¿¡¼­ ÀåÂøÇÑ ¾ÆÀÌÅÛÀº °³·®Ã¢¿¡ ¿Ã¸± ¼ö ¾øµµ·Ï ¸·¾Ò±â ¶§¹®¿¡, - // º°µµÀÇ ¾Ë¸² 󸮴 ¾ÈÇÔ. - if (pItem->IsEquipped()) - { - return false; - } - - // ¿ëÈ¥¼®°ú °­È­¼®¸¸ÀÌ °³·®Ã¢¿¡ ÀÖÀ» ¼ö ÀÖ´Ù. - // ±×¸®°í Çϳª¾¿¸¸ ÀÖ¾î¾ßÇÑ´Ù. - if (pItem->IsDragonSoul()) - { - if (pDragonSoul != NULL) - { - SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL_TOO_MUCH_MATERIAL, TItemPos(pItem->GetWindow(), pItem->GetCell())); - return false; - } - pDragonSoul = pItem; - } - else if(IsDragonSoulRefineMaterial(pItem)) - { - if (pRefineStone != NULL) - { - SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL_TOO_MUCH_MATERIAL, TItemPos(pItem->GetWindow(), pItem->GetCell())); - return false; - } - pRefineStone = pItem; - } - else - { - ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°­È­¿¡ ÇÊ¿äÇÑ Àç·á°¡ ¾Æ´Õ´Ï´Ù.")); - SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL_INVALID_MATERIAL, TItemPos(pItem->GetWindow(), pItem->GetCell())); - return false; - } - } - - BYTE bType, bGrade, bStep, bStrength; - - if (!pDragonSoul || !pRefineStone) - { - SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL_NOT_ENOUGH_MATERIAL, NPOS); - - return false; - } - - if (NULL != pDragonSoul) - { - GetDragonSoulInfo(pDragonSoul->GetVnum(), bType, bGrade, bStep, bStrength); - - float fWeight = 0.f; - // °¡ÁßÄ¡ °ªÀÌ ¾ø´Ù¸é °­È­ÇÒ ¼ö ¾ø´Â ¿ëÈ¥¼® - if (!m_pTable->GetWeight(bType, bGrade, bStep, bStrength + 1, fWeight)) - { - ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°­È­ÇÒ ¼ö ¾ø´Â ¿ëÈ¥¼®ÀÔ´Ï´Ù.")); - SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL_MAX_REFINE, TItemPos(pDragonSoul->GetWindow(), pDragonSoul->GetCell())); - return false; - } - // °­È­ÇßÀ» ¶§ °¡ÁßÄ¡°¡ 0À̶ó¸é ´õ ÀÌ»ó °­È­µÇ¼­´Â ¾ÈµÈ´Ù. - if (fWeight < FLT_EPSILON) - { - ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°­È­ÇÒ ¼ö ¾ø´Â ¿ëÈ¥¼®ÀÔ´Ï´Ù.")); - SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL_MAX_REFINE, TItemPos(pDragonSoul->GetWindow(), pDragonSoul->GetCell())); - return false; - } - } - - float fProb; - if (!m_pTable->GetRefineStrengthValues(bType, pRefineStone->GetSubType(), bStrength, fee, fProb)) - { - ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°­È­ÇÒ ¼ö ¾ø´Â ¿ëÈ¥¼®ÀÔ´Ï´Ù.")); - SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL_INVALID_MATERIAL, TItemPos(pDragonSoul->GetWindow(), pDragonSoul->GetCell())); - - return false; - } - - if (ch->GetGold() < fee) - { - ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°³·®À» Çϱâ À§ÇÑ µ·ÀÌ ºÎÁ·ÇÕ´Ï´Ù.")); - SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL_NOT_ENOUGH_MONEY, NPOS); - return false; - } - - ch->PointChange(POINT_GOLD, -fee); - LPITEM pResult = NULL; - BYTE bSubHeader; - - if (fnumber(0.f, 100.f) <= fProb) - { - pResult = ITEM_MANAGER::instance().CreateItem(MakeDragonSoulVnum(bType, bGrade, bStep, bStrength + 1)); - if (NULL == pResult) - { - sys_err ("INVALID DRAGON SOUL(%d)", MakeDragonSoulVnum(bType, bGrade, bStep, bStrength + 1)); - return false; - } - pDragonSoul->RemoveFromCharacter(); - - pDragonSoul->CopyAttributeTo(pResult); - RefreshItemAttributes(pResult); - - pDragonSoul->SetCount(pDragonSoul->GetCount() - 1); - pRefineStone->SetCount(pRefineStone->GetCount() - 1); - - char buf[128]; - sprintf(buf, "STRENGTH : %d -> %d", bStrength, bStrength + 1); - LogManager::instance().ItemLog(ch, pDragonSoul, "DS_STRENGTH_REFINE_SUCCESS", buf); - ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°­È­¿¡ ¼º°øÇß½À´Ï´Ù.")); - ch->AutoGiveItem(pResult, true); - bSubHeader = DS_SUB_HEADER_REFINE_SUCCEED; - } - else - { - if (bStrength != 0) - { - pResult = ITEM_MANAGER::instance().CreateItem(MakeDragonSoulVnum(bType, bGrade, bStep, bStrength - 1)); - if (NULL == pResult) - { - sys_err ("INVALID DRAGON SOUL(%d)", MakeDragonSoulVnum(bType, bGrade, bStep, bStrength - 1)); - return false; - } - pDragonSoul->CopyAttributeTo(pResult); - RefreshItemAttributes(pResult); - } - bSubHeader = DS_SUB_HEADER_REFINE_FAIL; - - char buf[128]; - sprintf(buf, "STRENGTH : %d -> %d", bStrength, bStrength - 1); - // strength°­È­´Â ½ÇÆÐ½Ã ±úÁú ¼öµµ ÀÖ¾î, ¿øº» ¾ÆÀÌÅÛÀ» ¹ÙÅÁÀ¸·Î ·Î±×¸¦ ³²±è. - LogManager::instance().ItemLog(ch, pDragonSoul, "DS_STRENGTH_REFINE_FAIL", buf); - - ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°­È­¿¡ ½ÇÆÐÇß½À´Ï´Ù.")); - pDragonSoul->SetCount(pDragonSoul->GetCount() - 1); - pRefineStone->SetCount(pRefineStone->GetCount() - 1); - if (NULL != pResult) - ch->AutoGiveItem(pResult, true); - - } - - SendRefineResultPacket(ch, bSubHeader, NULL == pResult? NPOS : TItemPos (pResult->GetWindow(), pResult->GetCell())); - - return true; -} - -void DSManager::SendRefineResultPacket(LPCHARACTER ch, BYTE bSubHeader, const TItemPos& pos) -{ - TPacketGCDragonSoulRefine pack; - pack.bSubType = bSubHeader; - - if (pos.IsValidItemPosition()) - { - pack.Pos = pos; - } - LPDESC d = ch->GetDesc(); - if (NULL == d) - { - return ; - } - else - { - d->Packet(&pack, sizeof(pack)); - } -} - -int DSManager::LeftTime(LPITEM pItem) const -{ - if (pItem == NULL) - return false; - - // ÀÏ´ÜÀº timer based on wearÀÎ ¿ëÈ¥¼®¸¸ ½Ã°£ ´Ù µÇ¾îµµ ¾È ¾ø¾îÁø´Ù. - if (pItem->GetProto()->cLimitTimerBasedOnWearIndex >= 0) - { - return pItem->GetSocket(ITEM_SOCKET_REMAIN_SEC); - } - // ´Ù¸¥ limit typeÀÎ ¿ëÈ¥¼®µéÀº ½Ã°£ µÇ¸é ¸ðµÎ »ç¶óÁö±â ¶§¹®¿¡ ¿©±â µé¾î¿Â ¾ÆÀÌÅÛÀº ÀÏ´Ü ½Ã°£ÀÌ ³²¾Ò´Ù°í ÆÇ´Ü. - else - { - return INT_MAX; - } -} - -bool DSManager::IsTimeLeftDragonSoul(LPITEM pItem) const -{ - if (pItem == NULL) - return false; - - // ÀÏ´ÜÀº timer based on wearÀÎ ¿ëÈ¥¼®¸¸ ½Ã°£ ´Ù µÇ¾îµµ ¾È ¾ø¾îÁø´Ù. - if (pItem->GetProto()->cLimitTimerBasedOnWearIndex >= 0) - { - return pItem->GetSocket(ITEM_SOCKET_REMAIN_SEC) > 0; - } - // ´Ù¸¥ limit typeÀÎ ¿ëÈ¥¼®µéÀº ½Ã°£ µÇ¸é ¸ðµÎ »ç¶óÁö±â ¶§¹®¿¡ ¿©±â µé¾î¿Â ¾ÆÀÌÅÛÀº ÀÏ´Ü ½Ã°£ÀÌ ³²¾Ò´Ù°í ÆÇ´Ü. - else - { - return true; - } -} - -bool DSManager::IsActiveDragonSoul(LPITEM pItem) const -{ - return pItem->GetSocket(ITEM_SOCKET_DRAGON_SOUL_ACTIVE_IDX); -} - -bool DSManager::ActivateDragonSoul(LPITEM pItem) -{ - if (NULL == pItem) - return false; - LPCHARACTER pOwner = pItem->GetOwner(); - if (NULL == pOwner) - return false; - - int deck_idx = pOwner->DragonSoul_GetActiveDeck(); - - if (deck_idx < 0) - return false; - - if (INVENTORY_MAX_NUM + WEAR_MAX_NUM + DS_SLOT_MAX * deck_idx <= pItem->GetCell() && - pItem->GetCell() < INVENTORY_MAX_NUM + WEAR_MAX_NUM + DS_SLOT_MAX * (deck_idx + 1)) - { - if (IsTimeLeftDragonSoul(pItem) && !IsActiveDragonSoul(pItem)) - { - char buf[128]; - sprintf (buf, "LEFT TIME(%d)", LeftTime(pItem)); - LogManager::instance().ItemLog(pOwner, pItem, "DS_ACTIVATE", buf); - pItem->ModifyPoints(true); - pItem->SetSocket(ITEM_SOCKET_DRAGON_SOUL_ACTIVE_IDX, 1); - - pItem->StartTimerBasedOnWearExpireEvent(); - } - return true; - } - else - return false; -} - -bool DSManager::DeactivateDragonSoul(LPITEM pItem, bool bSkipRefreshOwnerActiveState) -{ - if (NULL == pItem) - return false; - - LPCHARACTER pOwner = pItem->GetOwner(); - if (NULL == pOwner) - return false; - - if (!IsActiveDragonSoul(pItem)) - return false; - - char buf[128]; - pItem->StopTimerBasedOnWearExpireEvent(); - pItem->SetSocket(ITEM_SOCKET_DRAGON_SOUL_ACTIVE_IDX, 0); - pItem->ModifyPoints(false); - - sprintf (buf, "LEFT TIME(%d)", LeftTime(pItem)); - LogManager::instance().ItemLog(pOwner, pItem, "DS_DEACTIVATE", buf); - - if (false == bSkipRefreshOwnerActiveState) - RefreshDragonSoulState(pOwner); - - return true; -} - -void DSManager::RefreshDragonSoulState(LPCHARACTER ch) -{ - if (NULL == ch) - return ; - for (int i = WEAR_MAX_NUM; i < WEAR_MAX_NUM + DS_SLOT_MAX * DRAGON_SOUL_DECK_MAX_NUM; i++) - { - LPITEM pItem = ch->GetWear(i); - if (pItem != NULL) - { - if(IsActiveDragonSoul(pItem)) - { - return; - } - } - } - ch->DragonSoul_DeactivateAll(); -} - -DSManager::DSManager() -{ - m_pTable = NULL; -} - -DSManager::~DSManager() -{ - if (m_pTable) - delete m_pTable; -} diff --git a/server/game/src/DragonSoul.h b/server/game/src/DragonSoul.h deleted file mode 100755 index 4d8b9d9..0000000 --- a/server/game/src/DragonSoul.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef __INC_METIN_II_GAME_DRAGON_SOUL_H__ -#define __INC_METIN_II_GAME_DRAGON_SOUL_H__ - -#include "../../common/length.h" - -class CHARACTER; -class CItem; - -class DragonSoulTable; - -class DSManager : public singleton -{ -public: - DSManager(); - ~DSManager(); - bool ReadDragonSoulTableFile(const char * c_pszFileName); - - void GetDragonSoulInfo(DWORD dwVnum, OUT BYTE& bType, OUT BYTE& bGrade, OUT BYTE& bStep, OUT BYTE& bRefine) const; - // fixme : titempos·Î - WORD GetBasePosition(const LPITEM pItem) const; - bool IsValidCellForThisItem(const LPITEM pItem, const TItemPos& Cell) const; - int GetDuration(const LPITEM pItem) const; - - // ¿ëÈ¥¼®À» ¹Þ¾Æ¼­ ƯÁ¤ ¿ë½ÉÀ» ÃßÃâÇÏ´Â ÇÔ¼ö - bool ExtractDragonHeart(LPCHARACTER ch, LPITEM pItem, LPITEM pExtractor = NULL); - - // ƯÁ¤ ¿ëÈ¥¼®(pItem)À» Àåºñâ¿¡¼­ Á¦°ÅÇÒ ¶§¿¡ ¼º°ø ¿©ºÎ¸¦ °áÁ¤Çϰí, - // ½ÇÆÐ½Ã ºÎ»ê¹°À» ÁÖ´Â ÇÔ¼ö.(ºÎ»ê¹°Àº dragon_soul_table.txt¿¡ Á¤ÀÇ) - // DestCell¿¡ invalidÇÑ °ªÀ» ³ÖÀ¸¸é ¼º°ø ½Ã, ¿ëÈ¥¼®À» ºó °ø°£¿¡ ÀÚµ¿ Ãß°¡. - // ½ÇÆÐ ½Ã, ¿ëÈ¥¼®(pItem)Àº deleteµÊ. - // ÃßÃâ¾ÆÀÌÅÛÀÌ ÀÖ´Ù¸é ÃßÃâ ¼º°ø È®·üÀÌ pExtractor->GetValue(0)%¸¸Å­ Áõ°¡ÇÔ. - // ºÎ»ê¹°Àº ¾ðÁ¦³ª ÀÚµ¿ Ãß°¡. - bool PullOut(LPCHARACTER ch, TItemPos DestCell, IN OUT LPITEM& pItem, LPITEM pExtractor = NULL); - - // ¿ëÈ¥¼® ¾÷±×·¹À̵å ÇÔ¼ö - bool DoRefineGrade(LPCHARACTER ch, TItemPos (&aItemPoses)[DRAGON_SOUL_REFINE_GRID_SIZE]); - bool DoRefineStep(LPCHARACTER ch, TItemPos (&aItemPoses)[DRAGON_SOUL_REFINE_GRID_SIZE]); - bool DoRefineStrength(LPCHARACTER ch, TItemPos (&aItemPoses)[DRAGON_SOUL_REFINE_GRID_SIZE]); - - bool DragonSoulItemInitialize(LPITEM pItem); - - bool IsTimeLeftDragonSoul(LPITEM pItem) const; - int LeftTime(LPITEM pItem) const; - bool ActivateDragonSoul(LPITEM pItem); - bool DeactivateDragonSoul(LPITEM pItem, bool bSkipRefreshOwnerActiveState = false); - bool IsActiveDragonSoul(LPITEM pItem) const; -private: - void SendRefineResultPacket(LPCHARACTER ch, BYTE bSubHeader, const TItemPos& pos); - - // ij¸¯ÅÍÀÇ ¿ëÈ¥¼® µ¦À» »ìÆìº¸°í, Ȱ¼ºÈ­ µÈ ¿ëÈ¥¼®ÀÌ ¾ø´Ù¸é, ij¸¯ÅÍÀÇ ¿ëÈ¥¼® Ȱ¼º »óŸ¦ off ½ÃŰ´Â ÇÔ¼ö. - void RefreshDragonSoulState(LPCHARACTER ch); - - DWORD MakeDragonSoulVnum(BYTE bType, BYTE grade, BYTE step, BYTE refine); - bool PutAttributes(LPITEM pDS); - bool RefreshItemAttributes(LPITEM pItem); - - DragonSoulTable* m_pTable; -}; - -#endif diff --git a/server/game/src/char_dragonsoul.cpp b/server/game/src/char_dragonsoul.cpp deleted file mode 100755 index 25105c9..0000000 --- a/server/game/src/char_dragonsoul.cpp +++ /dev/null @@ -1,145 +0,0 @@ -#include "stdafx.h" -#include "char.h" -#include "item.h" -#include "desc.h" -#include "DragonSoul.h" -#include "log.h" - -// ¿ëÈ¥¼® ÃʱâÈ­ -// ¿ëÈ¥¼® on/off´Â Affect·Î ÀúÀåµÇ±â ¶§¹®¿¡, -// ¿ëÈ¥¼® Affect°¡ ÀÖ´Ù¸é µ¦¿¡ ÀÖ´Â ¿ëÈ¥¼®À» activateÇØ¾ßÇÑ´Ù. -// ¶ÇÇÑ ¿ëÈ¥¼® »ç¿ë ÀÚ°ÝÀº QuestFlag·Î ÀúÀåÇØ ³õ¾Ò±â ¶§¹®¿¡, -// Äù½ºÆ® Flag¿¡¼­ ¿ëÈ¥¼® »ç¿ë ÀÚ°ÝÀ» Àоî¿Â´Ù. - -// ij¸¯ÅÍÀÇ affect, quest°¡ load µÇ±â Àü¿¡ DragonSoul_Initialize¸¦ È£ÃâÇÏ¸é ¾ÈµÈ´Ù. -// affect°¡ °¡Àå ¸¶Áö¸·¿¡ ·ÎµåµÇ¾î LoadAffect¿¡¼­ È£ÃâÇÔ. -void CHARACTER::DragonSoul_Initialize() -{ - for (int i = INVENTORY_MAX_NUM + WEAR_MAX_NUM; i < DRAGON_SOUL_EQUIP_SLOT_END; i++) - { - LPITEM pItem = GetItem(TItemPos(INVENTORY, i)); - if (NULL != pItem) - pItem->SetSocket(ITEM_SOCKET_DRAGON_SOUL_ACTIVE_IDX, 0); - } - - if (FindAffect(AFFECT_DRAGON_SOUL_DECK_0)) - { - DragonSoul_ActivateDeck(DRAGON_SOUL_DECK_0); - } - else if (FindAffect(AFFECT_DRAGON_SOUL_DECK_1)) - { - DragonSoul_ActivateDeck(DRAGON_SOUL_DECK_1); - } -} - -int CHARACTER::DragonSoul_GetActiveDeck() const -{ - return m_pointsInstant.iDragonSoulActiveDeck; -} - -bool CHARACTER::DragonSoul_IsDeckActivated() const -{ - return m_pointsInstant.iDragonSoulActiveDeck >= 0; -} - -bool CHARACTER::DragonSoul_IsQualified() const -{ - return FindAffect(AFFECT_DRAGON_SOUL_QUALIFIED) != NULL; -} - -void CHARACTER::DragonSoul_GiveQualification() -{ - if(NULL == FindAffect(AFFECT_DRAGON_SOUL_QUALIFIED)) - { - LogManager::instance().CharLog(this, 0, "DS_QUALIFIED", ""); - } - AddAffect(AFFECT_DRAGON_SOUL_QUALIFIED, APPLY_NONE, 0, AFF_NONE, INFINITE_AFFECT_DURATION, 0, false, false); - //SetQuestFlag("dragon_soul.is_qualified", 1); - //// ÀÚ°ÝÀÖ´Ù¸é POINT_DRAGON_SOUL_IS_QUALIFIED´Â ¹«Á¶°Ç 1 - //PointChange(POINT_DRAGON_SOUL_IS_QUALIFIED, 1 - GetPoint(POINT_DRAGON_SOUL_IS_QUALIFIED)); -} - -bool CHARACTER::DragonSoul_ActivateDeck(int deck_idx) -{ - if (deck_idx < DRAGON_SOUL_DECK_0 || deck_idx >= DRAGON_SOUL_DECK_MAX_NUM) - { - return false; - } - - if (DragonSoul_GetActiveDeck() == deck_idx) - return true; - - DragonSoul_DeactivateAll(); - - if (!DragonSoul_IsQualified()) - { - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¿ëÈ¥¼® »óÀÚ°¡ Ȱ¼ºÈ­µÇÁö ¾Ê¾Ò½À´Ï´Ù.")); - return false; - } - - AddAffect(AFFECT_DRAGON_SOUL_DECK_0 + deck_idx, APPLY_NONE, 0, 0, INFINITE_AFFECT_DURATION, 0, false); - - m_pointsInstant.iDragonSoulActiveDeck = deck_idx; - - for (int i = DRAGON_SOUL_EQUIP_SLOT_START + DS_SLOT_MAX * deck_idx; - i < DRAGON_SOUL_EQUIP_SLOT_START + DS_SLOT_MAX * (deck_idx + 1); i++) - { - LPITEM pItem = GetInventoryItem(i); - if (NULL != pItem) - DSManager::instance().ActivateDragonSoul(pItem); - } - - return true; //fix -} - -void CHARACTER::DragonSoul_DeactivateAll() -{ - for (int i = DRAGON_SOUL_EQUIP_SLOT_START; i < DRAGON_SOUL_EQUIP_SLOT_END; i++) - { - DSManager::instance().DeactivateDragonSoul(GetInventoryItem(i), true); - } - m_pointsInstant.iDragonSoulActiveDeck = -1; - RemoveAffect(AFFECT_DRAGON_SOUL_DECK_0); - RemoveAffect(AFFECT_DRAGON_SOUL_DECK_1); -} - -void CHARACTER::DragonSoul_CleanUp() -{ - for (int i = DRAGON_SOUL_EQUIP_SLOT_START; i < DRAGON_SOUL_EQUIP_SLOT_END; i++) - { - DSManager::instance().DeactivateDragonSoul(GetInventoryItem(i), true); - } -} - -bool CHARACTER::DragonSoul_RefineWindow_Open(LPENTITY pEntity) -{ - if (NULL == m_pointsInstant.m_pDragonSoulRefineWindowOpener) - { - m_pointsInstant.m_pDragonSoulRefineWindowOpener = pEntity; - } - - TPacketGCDragonSoulRefine PDS; - PDS.header = HEADER_GC_DRAGON_SOUL_REFINE; - PDS.bSubType = DS_SUB_HEADER_OPEN; - LPDESC d = GetDesc(); - - if (NULL == d) - { - sys_err ("User(%s)'s DESC is NULL POINT.", GetName()); - return false; - } - - d->Packet(&PDS, sizeof(PDS)); - return true; -} - -bool CHARACTER::DragonSoul_RefineWindow_Close() -{ - m_pointsInstant.m_pDragonSoulRefineWindowOpener = NULL; - return true; -} - -bool CHARACTER::DragonSoul_RefineWindow_CanRefine() -{ - return NULL != m_pointsInstant.m_pDragonSoulRefineWindowOpener; -} \ No newline at end of file diff --git a/server/game/src/dragon_soul_table.cpp b/server/game/src/dragon_soul_table.cpp deleted file mode 100755 index 07079a5..0000000 --- a/server/game/src/dragon_soul_table.cpp +++ /dev/null @@ -1,902 +0,0 @@ -#include "stdafx.h" -#include "constants.h" -#include "group_text_parse_tree.h" -#include "dragon_soul_table.h" -#include "item_manager.h" -#include -const std::string g_astGradeName[] = -{ - "grade_normal", - "grade_brilliant", - "grade_rare", - "grade_ancient", - "grade_legendary", -}; - -const std::string g_astStepName[] = -{ - "step_lowest", - "step_low", - "step_mid", - "step_high", - "step_highest", -}; - -const std::string g_astMaterialName[] = -{ - "material_leather", - "material_blood", - "material_root", - "material_needle", - "material_jewel", - "material_ds_refine_normal", - "material_ds_refine_blessed", - "material_ds_refine_holly", -}; - -bool DragonSoulTable::ReadDragonSoulTableFile(const char * c_pszFileName) -{ - m_pLoader = new CGroupTextParseTreeLoader; - CGroupTextParseTreeLoader& loader = *m_pLoader; - - if (false == loader.Load(c_pszFileName)) - { - sys_err ("dragon_soul_table.txt load error"); - return false; - } - - // Group VnumMapper Reading. - if (!ReadVnumMapper()) - return false; - - // Group BasicApplys Reading. - if (!ReadBasicApplys()) - return false; - - // Group AdditionalApplys Reading. - if (!ReadAdditionalApplys()) - return false; - - m_pApplyNumSettingNode = loader.GetGroup("applynumsettings"); - m_pWeightTableNode = loader.GetGroup("weighttables"); - m_pRefineGradeTableNode = loader.GetGroup("refinegradetables"); - m_pRefineStepTableNode = loader.GetGroup("refinesteptables"); - m_pRefineStrengthTableNode = loader.GetGroup("refinestrengthtables"); - m_pDragonHeartExtTableNode = loader.GetGroup("dragonheartexttables"); - m_pDragonSoulExtTableNode = loader.GetGroup("dragonsoulexttables"); - - if (CheckApplyNumSettings() - && CheckWeightTables() - && CheckRefineGradeTables() - && CheckRefineStepTables() - && CheckRefineStrengthTables() - && CheckDragonHeartExtTables() - && CheckDragonSoulExtTables()) - { - return true; - } - else - { - sys_err ("DragonSoul table Check failed."); - return false; - } -} - -bool DragonSoulTable::GetDragonSoulGroupName(BYTE bType, std::string& stGroupName) const -{ - DragonSoulTable::TMapTypeToName::const_iterator it = m_map_type_to_name.find (bType); - if (it != m_map_type_to_name.end()) - { - stGroupName = it->second; - return true; - } - else - { - sys_err ("Invalid DragonSoul Type(%d)", bType); - return false; - } -} - -bool DragonSoulTable::ReadVnumMapper() -{ - std::string stName; - - // Group VnumMapper Reading. - CGroupNode* pGroupNode = m_pLoader->GetGroup("vnummapper"); - - if (NULL == pGroupNode) - { - sys_err ("dragon_soul_table.txt need VnumMapper."); - return false; - } - { - int n = pGroupNode->GetRowCount(); - if (0 == n) - { - sys_err ("Group VnumMapper is Empty."); - return false; - } - - std::set setTypes; - - for (int i = 0; i < n; i++) - { - const CGroupNode::CGroupNodeRow* pRow; - pGroupNode->GetRow(i, &pRow); - - std::string stDragonSoulName; - BYTE bType; - if (!pRow->GetValue("dragonsoulname", stDragonSoulName)) - { - sys_err ("In Group VnumMapper, No DragonSoulName column."); - return false; - } - if (!pRow->GetValue("type", bType)) - { - sys_err ("In Group VnumMapper, %s's Vnum is invalid", stDragonSoulName.c_str()); - return false; - } - - if (setTypes.end() != setTypes.find(bType)) - { - sys_err ("In Group VnumMapper, duplicated vnum exist."); - return false; - } - m_map_name_to_type.insert(TMapNameToType::value_type(stDragonSoulName, bType)); - m_map_type_to_name.insert(TMapTypeToName::value_type(bType, stDragonSoulName)); - m_vecDragonSoulTypes.push_back(bType); - m_vecDragonSoulNames.push_back(stDragonSoulName); - } - } - return true; -} - -bool DragonSoulTable::ReadBasicApplys() -{ - CGroupNode* pGroupNode = m_pLoader->GetGroup("basicapplys"); - - if (NULL == pGroupNode) - { - sys_err ("dragon_soul_table.txt need BasicApplys."); - return false; - } - - for (uint i = 0; i < m_vecDragonSoulNames.size(); i++) - { - CGroupNode* pChild; - if (NULL == (pChild = pGroupNode->GetChildNode(m_vecDragonSoulNames[i]))) - { - sys_err ("In Group BasicApplys, %s group is not defined.", m_vecDragonSoulNames[i].c_str()); - return false; - } - TVecApplys vecApplys; - int n = pChild->GetRowCount(); - - // BasicApply GroupÀº Key°¡ 1ºÎÅÍ ½ÃÀÛÇÔ. - for (int j = 1; j <= n; j++) - { - std::stringstream ss; - ss << j; - const CGroupNode::CGroupNodeRow* pRow = NULL; - - pChild->GetRow(ss.str(), &pRow); - if (NULL == pRow) - { - sys_err("In Group BasicApplys, No %d row.", j); - } - EApplyTypes at; - int av; - - std::string stTypeName; - if (!pRow->GetValue("apply_type", stTypeName)) - { - sys_err ("In Group BasicApplys, %s group's apply_type is empty.", m_vecDragonSoulNames[i].c_str()); - return false; - } - if (!(at = (EApplyTypes)FN_get_apply_type(stTypeName.c_str()))) - { - sys_err ("In Group BasicApplys, %s group's apply_type %s is invalid.", m_vecDragonSoulNames[i].c_str(), stTypeName.c_str()); - return false; - } - if (!pRow->GetValue("apply_value", av)) - { - sys_err ("In Group BasicApplys, %s group's apply_value %s is invalid.", m_vecDragonSoulNames[i].c_str(), av); - return false; - } - vecApplys.push_back(SApply(at, av)); - } - m_map_basic_applys_group.insert (TMapApplyGroup::value_type (m_map_name_to_type[m_vecDragonSoulNames[i]], vecApplys)); - } - - return true; -} - -bool DragonSoulTable::ReadAdditionalApplys() -{ - CGroupNode* pGroupNode = m_pLoader->GetGroup("additionalapplys"); - if (NULL == pGroupNode) - { - sys_err ("dragon_soul_table.txt need AdditionalApplys."); - return false; - } - - for (int i = 0; i < m_vecDragonSoulNames.size(); i++) - { - CGroupNode* pChild; - if (NULL == (pChild = pGroupNode->GetChildNode(m_vecDragonSoulNames[i]))) - { - sys_err ("In Group AdditionalApplys, %s group is not defined.", m_vecDragonSoulNames[i].c_str()); - return false; - } - TVecApplys vecApplys; - - int n = pChild->GetRowCount(); - - for (int j = 0; j < n; j++) - { - const CGroupNode::CGroupNodeRow* pRow; - - pChild->GetRow(j, &pRow); - - EApplyTypes at; - int av; - float prob; - std::string stTypeName; - if (!pRow->GetValue("apply_type", stTypeName)) - { - sys_err ("In Group AdditionalApplys, %s group's apply_type is empty.", m_vecDragonSoulNames[i].c_str()); - return false; - } - if (!(at = (EApplyTypes)FN_get_apply_type(stTypeName.c_str()))) - { - sys_err ("In Group AdditionalApplys, %s group's apply_type %s is invalid.", m_vecDragonSoulNames[i].c_str(), stTypeName.c_str()); - return false; - } - if (!pRow->GetValue("apply_value", av)) - { - sys_err ("In Group AdditionalApplys, %s group's apply_value %s is invalid.", m_vecDragonSoulNames[i].c_str(), av); - return false; - } - if (!pRow->GetValue("prob", prob)) - { - sys_err ("In Group AdditionalApplys, %s group's probability %s is invalid.", m_vecDragonSoulNames[i].c_str(), prob); - return false; - } - vecApplys.push_back(SApply(at, av, prob)); - } - m_map_additional_applys_group.insert (TMapApplyGroup::value_type (m_map_name_to_type[m_vecDragonSoulNames[i]], vecApplys)); - } - - return true; -} - -bool DragonSoulTable::CheckApplyNumSettings () -{ - // Group ApplyNumSettings Reading. - if (NULL == m_pApplyNumSettingNode) - { - sys_err ("dragon_soul_table.txt need ApplyNumSettings."); - return false; - } - else - { - for (int i = 0; i < m_vecDragonSoulTypes.size(); i++) - { - for (int j = 0; j < DRAGON_SOUL_GRADE_MAX; j++) - { - int basis, add_min, add_max; - if (!GetApplyNumSettings(m_vecDragonSoulTypes[i], j, basis, add_min, add_max)) - { - sys_err ("In %s group of ApplyNumSettings, values in Grade(%s) row is invalid.", - m_vecDragonSoulNames[i].c_str(), g_astGradeName[j].c_str()); - return false; - } - } - } - } - - return true; -} - -bool DragonSoulTable::CheckWeightTables () -{ - // Group WeightTables Reading. - if (NULL == m_pWeightTableNode) - { - sys_err ("dragon_soul_table.txt need WeightTables."); - return false; - } - else - { - for (int i = 0; i < m_vecDragonSoulTypes.size(); i++) - { - for (int j = 0; j < DRAGON_SOUL_GRADE_MAX; j++) - { - for (int k = 0; k < DRAGON_SOUL_STEP_MAX; k++) - { - for (int l = 0; l < DRAGON_SOUL_STRENGTH_MAX; l++) - { - float fWeight; - if (!GetWeight(m_vecDragonSoulTypes[i], j, k, l, fWeight)) - { - sys_err ("In %s group of WeightTables, value(Grade(%s), Step(%s), Strength(%d) is invalid.", - m_vecDragonSoulNames[i].c_str(), g_astGradeName[j].c_str(), g_astStepName[k].c_str(), l); - } - } - } - } - } - } - return true; -} - -bool DragonSoulTable::CheckRefineGradeTables() -{ - // Group UpgradeTables Reading. - if (NULL == m_pRefineGradeTableNode) - { - sys_err ("dragon_soul_table.txt need RefineGradeTables."); - return false; - } - else - { - for (int i = 0; i < m_vecDragonSoulTypes.size(); i++) - { - for (int j = 0; j < DRAGON_SOUL_GRADE_MAX - 1; j++) - { - int need_count, fee; - std::vector vec_probs; - if (!GetRefineGradeValues(m_vecDragonSoulTypes[i], j, need_count, fee, vec_probs)) - { - sys_err ("In %s group of RefineGradeTables, values in Grade(%s) row is invalid.", - m_vecDragonSoulNames[i].c_str(), g_astGradeName[j].c_str()); - return false; - } - if (need_count < 1) - { - sys_err ("In %s group of RefineGradeTables, need_count of Grade(%s) is less than 1.", - m_vecDragonSoulNames[i].c_str(), g_astGradeName[j].c_str()); - return false; - } - if (fee < 0) - { - sys_err ("In %s group of RefineGradeTables, fee of Grade(%s) is less than 0.", - m_vecDragonSoulNames[i].c_str(), g_astGradeName[j].c_str()); - return false; - } - if (DRAGON_SOUL_GRADE_MAX != vec_probs.size()) - { - sys_err ("In %s group of RefineGradeTables, probability list size is not %d.", DRAGON_SOUL_GRADE_MAX); - return false; - } - for (int k = 0; k < vec_probs.size(); k++) - { - if (vec_probs[k] < 0.f) - { - sys_err ("In %s group of RefineGradeTables, probability(index : %d) is less than 0.", k); - return false; - } - } - } - } - } - - return true; -} - -bool DragonSoulTable::CheckRefineStepTables () -{ - // Group ImproveTables Reading. - if (NULL == m_pRefineStrengthTableNode) - { - sys_err ("dragon_soul_table.txt need RefineStepTables."); - return false; - } - else - { - for (int i = 0; i < m_vecDragonSoulTypes.size(); i++) - { - for (int j = 0; j < DRAGON_SOUL_STEP_MAX - 1; j++) - { - int need_count, fee; - std::vector vec_probs; - if (!GetRefineStepValues(m_vecDragonSoulTypes[i], j, need_count, fee, vec_probs)) - { - sys_err ("In %s group of RefineStepTables, values in Step(%s) row is invalid.", - m_vecDragonSoulNames[i].c_str(), g_astStepName[j].c_str()); - return false; - } - if (need_count < 1) - { - sys_err ("In %s group of RefineStepTables, need_count of Step(%s) is less than 1.", - m_vecDragonSoulNames[i].c_str(), g_astStepName[j].c_str()); - return false; - } - if (fee < 0) - { - sys_err ("In %s group of RefineStepTables, fee of Step(%s) is less than 0.", - m_vecDragonSoulNames[i].c_str(), g_astStepName[j].c_str()); - return false; - } - if (DRAGON_SOUL_GRADE_MAX != vec_probs.size()) - { - sys_err ("In %s group of RefineStepTables, probability list size is not %d.", - m_vecDragonSoulNames[i].c_str(), DRAGON_SOUL_GRADE_MAX); - return false; - } - for (int k = 0; k < vec_probs.size(); k++) - { - if (vec_probs[k] < 0.f) - { - sys_err ("In %s group of RefineStepTables, probability(index : %d) is less than 0.", - m_vecDragonSoulNames[i].c_str(), k); - return false; - } - } - } - } - } - - return true; -} - - -bool DragonSoulTable::CheckRefineStrengthTables() -{ - CGroupNode* pGroupNode = m_pRefineStrengthTableNode; - // Group RefineTables Reading. - if (NULL == pGroupNode) - { - sys_err ("dragon_soul_table.txt need RefineStrengthTables."); - return false; - } - for (int i = 0; i < m_vecDragonSoulTypes.size(); i++) - { - for (int j = MATERIAL_DS_REFINE_NORMAL; j <= MATERIAL_DS_REFINE_HOLLY; j++) - { - int fee; - float prob; - for (int k = 0; k < DRAGON_SOUL_STRENGTH_MAX -1; k++) - { - if (!GetRefineStrengthValues(m_vecDragonSoulTypes[i], j, k, fee, prob)) - { - sys_err ("In %s group of RefineStrengthTables, value(Material(%s), Strength(%d)) or fee are invalid.", - m_vecDragonSoulNames[i].c_str(), g_astMaterialName[j].c_str(), k); - return false; - } - if (fee < 0) - { - sys_err ("In %s group of RefineStrengthTables, fee of Material(%s) is less than 0.", - m_vecDragonSoulNames[i].c_str(), g_astMaterialName[j].c_str()); - return false; - } - if (prob < 0.f) - { - sys_err ("In %s group of RefineStrengthTables, probability(Material(%s), Strength(%d)) is less than 0.", - m_vecDragonSoulNames[i].c_str(), g_astMaterialName[j].c_str(), k); - return false; - } - } - } - } - - return true; -} - -bool DragonSoulTable::CheckDragonHeartExtTables() -{ - // Group DragonHeartExtTables Reading. - if (NULL == m_pDragonHeartExtTableNode) - { - sys_err ("dragon_soul_table.txt need DragonHeartExtTables."); - return false; - } - for (int i = 0; i < m_vecDragonSoulTypes.size(); i++) - { - for (int j = 0; j < DRAGON_SOUL_GRADE_MAX; j++) - { - std::vector vec_chargings; - std::vector vec_probs; - - if (!GetDragonHeartExtValues(m_vecDragonSoulTypes[i], j, vec_chargings, vec_probs)) - { - sys_err ("In %s group of DragonHeartExtTables, CHARGING row or Grade(%s) row are invalid.", - m_vecDragonSoulNames[i].c_str(), g_astGradeName[j].c_str()); - return false; - } - if (vec_chargings.size() != vec_probs.size()) - { - sys_err ("In %s group of DragonHeartExtTables, CHARGING row size(%d) are not equal Grade(%s) row size(%d).", - m_vecDragonSoulNames[i].c_str(), vec_chargings.size(), vec_probs.size()); - return false; - } - for (int k = 0; k < vec_chargings.size(); k++) - { - if (vec_chargings[k] < 0.f) - { - sys_err ("In %s group of DragonHeartExtTables, CHARGING value(index : %d) is less than 0", - m_vecDragonSoulNames[i].c_str(), k); - return false; - } - } - for (int k = 0; k < vec_probs.size(); k++) - { - if (vec_probs[k] < 0.f) - { - sys_err ("In %s group of DragonHeartExtTables, Probability(Grade : %s, index : %d) is less than 0", - m_vecDragonSoulNames[i].c_str(), g_astGradeName[j].c_str(), k); - return false; - } - } - } - } - - return true; -} - -bool DragonSoulTable::CheckDragonSoulExtTables() -{ - // Group DragonSoulExtTables Reading. - if (NULL == m_pDragonSoulExtTableNode) - { - sys_err ("dragon_soul_table.txt need DragonSoulExtTables."); - return false; - } - for (int i = 0; i < m_vecDragonSoulTypes.size(); i++) - { - for (int j = 0; j < DRAGON_SOUL_GRADE_MAX; j++) - { - float prob; - DWORD by_product; - if (!GetDragonSoulExtValues(m_vecDragonSoulTypes[i], j, prob, by_product)) - { - sys_err ("In %s group of DragonSoulExtTables, Grade(%s) row is invalid.", - m_vecDragonSoulNames[i].c_str(), g_astGradeName[j].c_str()); - return false; - } - if (prob < 0.f) - { - sys_err ("In %s group of DragonSoulExtTables, Probability(Grade : %s) is less than 0", - m_vecDragonSoulNames[i].c_str(), g_astGradeName[j].c_str()); - return false; - } - if (0 != by_product && NULL == ITEM_MANAGER::instance().GetTable(by_product)) - { - sys_err ("In %s group of DragonSoulExtTables, ByProduct(%d) of Grade %s is not exist.", - m_vecDragonSoulNames[i].c_str(), by_product, g_astGradeName[j].c_str()); - return false; - } - } - } - return true; -} - -bool DragonSoulTable::GetBasicApplys(BYTE ds_type, OUT TVecApplys& vec_basic_applys) -{ - TMapApplyGroup::iterator it = m_map_basic_applys_group.find(ds_type); - if (m_map_basic_applys_group.end() == it) - { - return false; - } - vec_basic_applys = it->second; - return true; -} - -bool DragonSoulTable::GetAdditionalApplys(BYTE ds_type, OUT TVecApplys& vec_additional_applys) -{ - TMapApplyGroup::iterator it = m_map_additional_applys_group.find(ds_type); - if (m_map_additional_applys_group.end() == it) - { - return false; - } - vec_additional_applys = it->second; - return true; -} - -bool DragonSoulTable::GetApplyNumSettings(BYTE ds_type, BYTE grade_idx, OUT int& basis, OUT int& add_min, OUT int& add_max) -{ - if (grade_idx >= DRAGON_SOUL_GRADE_MAX) - { - sys_err ("Invalid dragon soul grade_idx(%d).", grade_idx); - return false; - } - - std::string stValue; - std::string stDragonSoulName; - if (!GetDragonSoulGroupName(ds_type, stDragonSoulName)) - { - sys_err ("Invalid dragon soul type(%d).", ds_type); - return false; - } - - if (!m_pApplyNumSettingNode->GetGroupValue(stDragonSoulName, "basis", g_astGradeName[grade_idx], basis)) - { - sys_err ("Invalid basis value. DragonSoulGroup(%s) Grade(%s)", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str()); - return false; - } - - if (!m_pApplyNumSettingNode->GetGroupValue(stDragonSoulName, "add_min", g_astGradeName[grade_idx], add_min)) - { - sys_err ("Invalid add_min value. DragonSoulGroup(%s) Grade(%s)", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str()); - return false; - } - - if (!m_pApplyNumSettingNode->GetGroupValue(stDragonSoulName, "add_max", g_astGradeName[grade_idx], add_max)) - { - sys_err ("Invalid add_max value. DragonSoulGroup(%s) Grade(%s)", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str()); - return false; - } - - return true; -} - -bool DragonSoulTable::GetWeight(BYTE ds_type, BYTE grade_idx, BYTE step_index, BYTE strength_idx, OUT float& fWeight) -{ - if (grade_idx >= DRAGON_SOUL_GRADE_MAX || step_index >= DRAGON_SOUL_STEP_MAX || strength_idx >= DRAGON_SOUL_STRENGTH_MAX) - { - sys_err ("Invalid dragon soul grade_idx(%d) step_index(%d) strength_idx(%d).", grade_idx, step_index, strength_idx); - return false; - } - - std::string stValue; - std::string stDragonSoulName; - if (!GetDragonSoulGroupName(ds_type, stDragonSoulName)) - { - sys_err ("Invalid dragon soul type(%d).", ds_type); - return false; - } - - CGroupNode* pDragonSoulGroup = m_pWeightTableNode->GetChildNode(stDragonSoulName); - if (NULL != pDragonSoulGroup) - { - if (pDragonSoulGroup->GetGroupValue(g_astGradeName[grade_idx], g_astStepName[step_index], strength_idx, fWeight)) - { - return true; - } - } - // default groupÀ» »ìÆìº½. - pDragonSoulGroup = m_pWeightTableNode->GetChildNode("default"); - if (NULL != pDragonSoulGroup) - { - if (!pDragonSoulGroup->GetGroupValue(g_astGradeName[grade_idx], g_astStepName[step_index], strength_idx, fWeight)) - { - sys_err ("Invalid float. DragonSoulGroup(%s) Grade(%s) Row(%s) Col(%d))", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str(), g_astStepName[step_index].c_str(), strength_idx); - return false; - } - else - return true; - } - sys_err ("Invalid value. DragonSoulGroup(%s) Grade(%s) Row(%s) Col(%d))", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str(), g_astStepName[step_index].c_str(), strength_idx); - return false; -} - -bool DragonSoulTable::GetRefineGradeValues(BYTE ds_type, BYTE grade_idx, OUT int& need_count, OUT int& fee, OUT std::vector& vec_probs) -{ - if (grade_idx >= DRAGON_SOUL_GRADE_MAX -1) - { - sys_err ("Invalid dragon soul grade_idx(%d).", grade_idx); - return false; - } - - std::string stValue; - std::string stDragonSoulName; - if (!GetDragonSoulGroupName(ds_type, stDragonSoulName)) - { - sys_err ("Invalid dragon soul type(%d).", ds_type); - return false; - } - - const CGroupNode::CGroupNodeRow * pRow; - if (!m_pRefineGradeTableNode->GetGroupRow(stDragonSoulName, g_astGradeName[grade_idx], &pRow)) - { - sys_err ("Invalid row. DragonSoulGroup(%s) Grade(%s)", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str()); - return false; - } - - if (!pRow->GetValue("need_count", need_count)) - { - sys_err ("Invalid value. DragonSoulGroup(%s) Grade(%s) Col(need_count)", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str()); - return false; - } - - if (!pRow->GetValue("fee", fee)) - { - sys_err ("Invalid value. DragonSoulGroup(%s) Grade(%s) Col(fee)", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str()); - return false; - } - - vec_probs.resize(DRAGON_SOUL_GRADE_MAX); - for (int i = 0; i < DRAGON_SOUL_GRADE_MAX; i++) - { - if (!pRow->GetValue(g_astGradeName[i], vec_probs[i])) - { - sys_err ("Invalid value. DragonSoulGroup(%s) Grade(%s) Col(%s)", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str(), g_astGradeName[i].c_str()); - return false; - } - } - - return true; -} - -bool DragonSoulTable::GetRefineStepValues(BYTE ds_type, BYTE step_idx, OUT int& need_count, OUT int& fee, OUT std::vector& vec_probs) -{ - if (step_idx >= DRAGON_SOUL_STEP_MAX - 1) - { - sys_err ("Invalid dragon soul step_idx(%d).", step_idx); - return false; - } - - std::string stValue; - std::string stDragonSoulName; - if (!GetDragonSoulGroupName(ds_type, stDragonSoulName)) - { - sys_err ("Invalid dragon soul type(%d).", ds_type); - return false; - } - - const CGroupNode::CGroupNodeRow * pRow; - if (!m_pRefineStepTableNode->GetGroupRow(stDragonSoulName, g_astStepName[step_idx], &pRow)) - { - sys_err ("Invalid row. DragonSoulGroup(%s) Step(%s)", stDragonSoulName.c_str(), g_astStepName[step_idx].c_str()); - return false; - } - - if (!pRow->GetValue("need_count", need_count)) - { - sys_err ("Invalid value. DragonSoulGroup(%s) Step(%s) Col(need_count)", stDragonSoulName.c_str(), g_astStepName[step_idx].c_str()); - return false; - } - - if (!pRow->GetValue("fee", fee)) - { - sys_err ("Invalid value. DragonSoulGroup(%s) Step(%s) Col(fee)", stDragonSoulName.c_str(), g_astStepName[step_idx].c_str()); - return false; - } - - vec_probs.resize(DRAGON_SOUL_STEP_MAX); - for (int i = 0; i < DRAGON_SOUL_STEP_MAX; i++) - { - if (!pRow->GetValue(g_astStepName[i], vec_probs[i])) - { - sys_err ("Invalid value. DragonSoulGroup(%s) Step(%s) Col(%s)", stDragonSoulName.c_str(), g_astStepName[step_idx].c_str(), g_astStepName[i].c_str()); - return false; - } - } - - return true; -} - -bool DragonSoulTable::GetRefineStrengthValues(BYTE ds_type, BYTE material_type, BYTE strength_idx, OUT int& fee, OUT float& prob) -{ - if (material_type < MATERIAL_DS_REFINE_NORMAL || material_type > MATERIAL_DS_REFINE_HOLLY) - { - sys_err ("Invalid dragon soul material_type(%d).", material_type); - return false; - } - - std::string stValue; - std::string stDragonSoulName; - if (!GetDragonSoulGroupName(ds_type, stDragonSoulName)) - { - sys_err ("Invalid dragon soul type(%d).", ds_type); - return false; - } - - if (!m_pRefineStrengthTableNode->GetGroupValue(stDragonSoulName, g_astMaterialName[material_type], "fee", fee)) - { - sys_err ("Invalid fee. DragonSoulGroup(%s) Material(%s)", - stDragonSoulName.c_str(), g_astMaterialName[material_type].c_str()); - return false; - } - std::string stStrengthIdx = boost::lexical_cast ((int)strength_idx); - - if (!m_pRefineStrengthTableNode->GetGroupValue(stDragonSoulName, g_astMaterialName[material_type], stStrengthIdx, prob)) - { - sys_err ("Invalid prob. DragonSoulGroup(%s) Material(%s) Strength(%d)", - stDragonSoulName.c_str(), g_astMaterialName[material_type].c_str(), strength_idx); - return false; - } - - return true; -} - -bool DragonSoulTable::GetDragonHeartExtValues(BYTE ds_type, BYTE grade_idx, OUT std::vector& vec_chargings, OUT std::vector& vec_probs) -{ - if (grade_idx >= DRAGON_SOUL_GRADE_MAX) - { - sys_err ("Invalid dragon soul grade_idx(%d).", grade_idx); - return false; - } - - std::string stDragonSoulName; - if (!GetDragonSoulGroupName(ds_type, stDragonSoulName)) - { - sys_err ("Invalid dragon soul type(%d).", ds_type); - return false; - } - - const CGroupNode::CGroupNodeRow * pRow; - if (!m_pDragonHeartExtTableNode->GetGroupRow(stDragonSoulName, "charging", &pRow)) - { - sys_err ("Invalid CHARGING row. DragonSoulGroup(%s)", stDragonSoulName.c_str()); - return false; - } - int n = pRow->GetSize(); - vec_chargings.resize(n); - for (int i = 0; i < n; i++) - { - if (!pRow->GetValue(i, vec_chargings[i])) - { - sys_err ("Invalid CHARGING value. DragonSoulGroup(%s), Col(%d)", stDragonSoulName.c_str(), i); - return false; - } - } - - if (!m_pDragonHeartExtTableNode->GetGroupRow(stDragonSoulName, g_astGradeName[grade_idx], &pRow)) - { - sys_err ("Invalid row. DragonSoulGroup(%s) Grade(%s)", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str()); - return false; - } - - int m = pRow->GetSize(); - if (n != m) - { - sys_err ("Invalid row size(%d). It must be same CHARGING row size(%d). DragonSoulGroup(%s) Grade(%s)", m, n, - stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str()); - return false; - } - vec_probs.resize(m); - for (int i = 0; i < m; i++) - { - if (!pRow->GetValue(i, vec_probs[i])) - { - sys_err ("Invalid value. DragonSoulGroup(%s), Grade(%s) Col(%d)", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str(), i); - return false; - } - } - - return true; -} - -bool DragonSoulTable::GetDragonSoulExtValues(BYTE ds_type, BYTE grade_idx, OUT float& prob, OUT DWORD& by_product) -{ - if (grade_idx >= DRAGON_SOUL_GRADE_MAX) - { - sys_err ("Invalid dragon soul grade_idx(%d).", grade_idx); - return false; - } - - std::string stValue; - std::string stDragonSoulName; - if (!GetDragonSoulGroupName(ds_type, stDragonSoulName)) - { - sys_err ("Invalid dragon soul type(%d).", ds_type); - return false; - } - - if (!m_pDragonSoulExtTableNode->GetGroupValue(stDragonSoulName, g_astGradeName[grade_idx], "prob", prob)) - { - sys_err ("Invalid Prob. DragonSoulGroup(%s) Grade(%s)", - stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str(), g_astGradeName[grade_idx].c_str()); - return false; - } - - if (!m_pDragonSoulExtTableNode->GetGroupValue(stDragonSoulName, g_astGradeName[grade_idx], "byproduct", by_product)) - { - sys_err ("Invalid fee. DragonSoulGroup(%s) Grade(%d)", - stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str(), grade_idx); - return false; - } - - return true; -} - -DragonSoulTable::DragonSoulTable() -{ - m_pLoader = NULL; -} -DragonSoulTable::~DragonSoulTable () -{ - if (m_pLoader) - delete m_pLoader; -} diff --git a/server/game/src/dragon_soul_table.h b/server/game/src/dragon_soul_table.h deleted file mode 100755 index 754626d..0000000 --- a/server/game/src/dragon_soul_table.h +++ /dev/null @@ -1,74 +0,0 @@ -#ifndef __INC_METIN_II_DRAGON_SOUL_TABLE_H__ -#define __INC_METIN_II_DRAGON_SOUL_TABLE_H__ - -struct SApply -{ - SApply (EApplyTypes at, int av, float p = 0.f) : apply_type(at), apply_value(av), prob(p) {} - EApplyTypes apply_type; - int apply_value; - float prob; -}; -const int DRAGON_SOUL_ADDITIONAL_ATTR_START_IDX = 3; - -class CGroupNode; -class CGroupTextParseTreeLoader; - -class DragonSoulTable -{ -public: - DragonSoulTable(); - ~DragonSoulTable(); - typedef std::vector TVecApplys; - typedef std::map TMapApplyGroup; - - bool ReadDragonSoulTableFile(const char * c_pszFileName); - bool GetDragonSoulGroupName(BYTE bType, std::string& stGroupName) const; - - bool GetBasicApplys(BYTE ds_type, OUT TVecApplys& vec_basic_applys); - bool GetAdditionalApplys(BYTE ds_type, OUT TVecApplys& vec_additional_attrs); - - bool GetApplyNumSettings(BYTE ds_type, BYTE grade_idx, OUT int& basis, OUT int& add_min, OUT int& add_max); - bool GetWeight(BYTE ds_type, BYTE grade_idx, BYTE step_index, BYTE strength_idx, OUT float& fWeight); - bool GetRefineGradeValues(BYTE ds_type, BYTE grade_idx, OUT int& need_count, OUT int& fee, OUT std::vector& vec_probs); - bool GetRefineStepValues(BYTE ds_type, BYTE step_idx, OUT int& need_count, OUT int& fee, OUT std::vector& vec_probs); - bool GetRefineStrengthValues(BYTE ds_type, BYTE material_type, BYTE strength_idx, OUT int& fee, OUT float& prob); - bool GetDragonHeartExtValues(BYTE ds_type, BYTE grade_idx, OUT std::vector& vec_chargings, OUT std::vector& vec_probs); - bool GetDragonSoulExtValues(BYTE ds_type, BYTE grade_idx, OUT float& prob, OUT DWORD& by_product); - -private: - CGroupTextParseTreeLoader* m_pLoader; - std::string stFileName; - - // caching m_pLoader's child nodes. - CGroupNode* m_pApplyNumSettingNode; - CGroupNode* m_pWeightTableNode; - CGroupNode* m_pRefineGradeTableNode; - CGroupNode* m_pRefineStepTableNode; - CGroupNode* m_pRefineStrengthTableNode; - CGroupNode* m_pDragonHeartExtTableNode; - CGroupNode* m_pDragonSoulExtTableNode; - - typedef std::map TMapNameToType; - typedef std::map TMapTypeToName; - std::vector m_vecDragonSoulNames; - std::vector m_vecDragonSoulTypes; - - TMapNameToType m_map_name_to_type; - TMapTypeToName m_map_type_to_name; - TMapApplyGroup m_map_basic_applys_group; - TMapApplyGroup m_map_additional_applys_group; - - bool ReadVnumMapper(); - bool ReadBasicApplys(); - bool ReadAdditionalApplys(); - // table check functions. - bool CheckApplyNumSettings(); - bool CheckWeightTables(); - bool CheckRefineGradeTables(); - bool CheckRefineStepTables(); - bool CheckRefineStrengthTables(); - bool CheckDragonHeartExtTables(); - bool CheckDragonSoulExtTables(); -}; - -#endif \ No newline at end of file diff --git a/server/game/src/questlua_dragonsoul.cpp b/server/game/src/questlua_dragonsoul.cpp deleted file mode 100755 index 3073b85..0000000 --- a/server/game/src/questlua_dragonsoul.cpp +++ /dev/null @@ -1,69 +0,0 @@ -#include "stdafx.h" - -#include "config.h" -#include "questmanager.h" -#include "char.h" - -#undef sys_err -#ifndef __WIN32__ -#define sys_err(fmt, args...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, ##args) -#else -#define sys_err(fmt, ...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, __VA_ARGS__) -#endif - -namespace quest -{ - int ds_open_refine_window(lua_State* L) - { - const LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); - if (NULL == ch) - { - sys_err ("NULL POINT ERROR"); - return 0; - } - if (ch->DragonSoul_IsQualified()) - ch->DragonSoul_RefineWindow_Open(CQuestManager::instance().GetCurrentNPCCharacterPtr()); - - return 0; - } - - int ds_give_qualification(lua_State* L) - { - const LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); - if (NULL == ch) - { - sys_err ("NULL POINT ERROR"); - return 0; - } - ch->DragonSoul_GiveQualification(); - - return 0; - } - - int ds_is_qualified(lua_State* L) - { - const LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); - if (NULL == ch) - { - sys_err ("NULL POINT ERROR"); - lua_pushnumber(L, 0); - return 1; - } - - lua_pushnumber(L, ch->DragonSoul_IsQualified()); - return 1; - } - - void RegisterDragonSoulFunctionTable() - { - luaL_reg ds_functions[] = - { - { "open_refine_window" , ds_open_refine_window }, - { "give_qualification" , ds_give_qualification }, - { "is_qualified" , ds_is_qualified }, - { NULL , NULL } - }; - - CQuestManager::instance().AddLuaFunctionTable("ds", ds_functions); - } -}; diff --git a/serverfiles/share/locale/english/dragon_soul_table.txt b/serverfiles/share/locale/english/dragon_soul_table.txt deleted file mode 100755 index 6e272f9..0000000 --- a/serverfiles/share/locale/english/dragon_soul_table.txt +++ /dev/null @@ -1,314 +0,0 @@ -# ¿ëÈ¥¼® Å×À̺íµé... -# TAB À¸·Î ±¸ºÐµÇ´Ï ¿¢¼¿·Î º¼ °Í. -# vimÀ¸·Î º»´Ù¸é Åǰ£ °£°ÝÀ» Á¶Á¤ÇÏ°í º¼ °Í. (set ts=16 Ãßõ) -# Å« µû¿ÈÇ¥·Î ¹­ÀÎ ºÎºÐÀº ¾È ±¸ºÐ. -# \" À̵ý°Å Áö¿ø ¾ÈÇÔ. - -# ¿ëÈ¥¼® Vnum¿¡ ´ëÇÑ comment -# ITEM VNUMÀ» 10¸¸ ÀÚ¸®ºÎÅÍ, FEDCBA¶ó°í ÇÑ´Ù¸é -# FE : ¿ëÈ¥¼® Á¾·ù. D : µî±Þ -# C : ´Ü°è B : °­È­ -# A : ¿©¹úÀÇ ¹øÈ£µé... -# ÀÌ Ã¼°è¿¡¼­ ¹þ¾î³ª´Â ¿ëÈ¥¼®Àº ¿ë¼­ÇÏÁö ¾ÊÀ» °ÍÀÌ´Ù. -# ok? -# ¿ëÈ¥¼®ÀÌ ³Ê¹«³ªµµ ¸¹±â ¶§¹®¿¡ VnumÀÌ Áß±¸³­¹æÀ̸é, -# Special item group¿¡¼­ groupÀ¸·Î ¹­¾î¼­ ó¸®Çϱ⵵ Èûµé°í-_-, -# VnumHelper.h¿¡¼­ ó¸®ÇÏ´Â °Íµµ Èûµé´Ù. -_- -# Group Àâ´Âµ¥¸¸ ¼öõÁÙÀ» ½á¾ßÇÒ Áöµµ... -# Vnum¿¡ ü°è¸¦ Àâ¾Æ¼­ ÀÚ¸´¼ö ±â¹ÝÀ¸·Î ÇØ¾ß¸¸ ÇÑ´Ù. - -# TableÀº "Group"°ú "À̸§"À¸·Î ½ÃÀÛÇÑ´Ù. -# Table ³»ºÎ¿¡ ¶Ç TableÀÌ ÀÖÀ» ¼ö ÀÖ´Ù. -# ±×·¸´Ù°í ¾û¶×ÇÑ Å×À̺íÀ» ½á³õ´Â´Ù°í ¼­¹ö°¡ ÀνÄÇÏ´Â °ÍÀº ¾Æ´Ï´Ù. -# ÇÊ¿äÇÑ Å×À̺íÀº ´ÙÀ½°ú °°´Ù. -# BaseVnums, BaseAttrs, AddtionalAttrs, AttrSettings, UpgradeTable, ImproveTable, -# RefineTable, UpgradeMoneys, ImproveTable, RefineMoneys, WeightTable, DurationTable, -# DragonHeartExtTable, DragonSoulExtTable - -# È®·ü Å×À̺íÀÇ °ªÀº ±âº»ÀûÀ¸·Î floatÀÌ´Ù. - -# Áß¿ä !!!!! -# Å×À̺íÀ» º¸´Ù º¸¸é #--#ÀÌ¶ó ¾²¿©Áø ºÎºÐÀÌ Àִµ¥ Àý´ë·Î Áö¿ìÁö ¸»°Í. -# - -# ÀÌ°Ç vnum to À̸§ mapping. -# À̰ɷΠƯÁ¤ vnumÀÇ ¿ëÈ¥¼®ÀÌ ¾î¶² Á¾·ùÀÇ ¿ëÈ¥¼®ÀÎÁö(À̸§ÀÌ ¹ºÁö) ¾Ë¾Æ³½ ÈÄ, -# ±× ¿ëÈ¥¼®¿¡ ÇØ´çÇÏ´Â ¼Ó¼ºÀ» ã´Â´Ù. -# ¶ÇÇÑ ¿©±â¿¡ ÀûÇôÀÖÁö ¾ÊÀº ¿ëÈ¥¼®ÀÌ ¹Ø¿¡ Group Á¤ÀÇÇÏ´Â ºÎºÐ¿¡ ÀÖ´Ù¸é -# ¿¡·¯. -Group VnumMapper -{ - # ½ÃÀÛ vnum. - # ¿©±â¼­ ½á¾ßÇÒ ºÎºÐÀº À§¿¡ ¼³¸íÇÑ FE¿¡ ÇØ´çÇÏ´Â ºÎºÐ. - # FE¸¦ ½áÁÙ °Í - #--# DragonSoulName Type - 1 ¹é·æ¼® 11 - 2 È­·æ¼® 12 - 3 dz·æ¼® 13 - 4 ö·æ¼® 14 - 5 ³ú·æ¼® 15 - 6 Èæ·æ¼® 16 -} - -Group BasicApplys -{ - Group ¹é·æ¼® - { - # 1ºÎÅÍ ¼ø¼­´ë·Î ºÎ¿©µÈ´Ù. - #--# Apply_Type Apply_value - 1 INT 10 - 2 RESIST_ICE 10 - } - - Group È­·æ¼® - { - #--# Apply_Type Apply_value - 1 STR 10 - 2 RESIST_FIRE 10 - } - Group dz·æ¼® - { - #--# Apply_Type Apply_value - 1 MAX_SP 500 - 2 RESIST_WIND 10 - } - Group ö·æ¼® - { - #--# Apply_Type Apply_value - 1 DEX 10 - 2 RESIST_EARTH 10 - } - Group ³ú·æ¼® - { - #--# Apply_Type Apply_value - 1 MAX_HP 1500 - 2 RESIST_ELEC 10 - } - Group Èæ·æ¼® - { - #--# Apply_Type Apply_value - 1 CON 10 - 2 RESIST_DARK 10 - } -} - -Group AdditionalApplys -{ - Group ¹é·æ¼® - { - # ¾ÕÀÇ Ã¹ Ä÷³Àº ¼ø¼­¿Í °ü°è ¾ø´Ù. öÀúÈ÷ È®·ü¿¡ µû¶ó ¼Ó¼ºÀÌ ºÎ¿©µÉ »ÓÀÌ´Ù. - #--# Apply_Type Apply_value Prob - 1 MAGIC_ATT_GRADE 15 10 - 2 MAGIC_DEF_GRADE 15 10 - 3 SKILL_DAMAGE_BONUS 15 10 - 4 SKILL_DEFEND_BONUS 15 10 - } - Group È­·æ¼® - { - #--# Apply_Type Apply_value Prob - 1 ATT_BONUS 300 10 - 2 DEF_BONUS 200 10 - 3 NORMAL_HIT_DAMAGE_BONUS 15 10 - 4 NORMAL_HIT_DEFEND_BONUS 15 10 - } - Group dz·æ¼® - { - #--# Apply_Type Apply_value Prob - 1 MAX_HP 3000 10 - 2 HP_REGEN 10 10 - 3 STEAL_HP 10 10 - 4 KILL_HP_RECOVER 5 10 - 5 MAX_HP_PCT 20 10 - } - Group ö·æ¼® - { - #--# Apply_Type Apply_value Prob - 1 ATT_BONUS_TO_WARRIOR 15 10 - 2 ATT_BONUS_TO_ASSASSIN 15 10 - 3 ATT_BONUS_TO_SURA 15 10 - 4 ATT_BONUS_TO_SHAMAN 15 10 - 5 RESIST_WARRIOR 15 10 - 6 RESIST_ASSASSIN 15 10 - 7 RESIST_SURA 15 10 - 8 RESIST_SHAMAN 15 10 - } - Group ³ú·æ¼® - { - #--# Apply_Type Apply_value Prob - 1 MAX_SP 1500 10 - 2 SP_REGEN 10 10 - 3 STEAL_SP 10 10 - 4 KILL_SP_RECOVER 5 10 - 5 MAX_SP_PCT 20 10 - } - Group Èæ·æ¼® - { - #--# Apply_Type Apply_value Prob - 1 BLOCK 10 10 - 2 DODGE 10 10 - 3 REFLECT_MELEE 10 10 - 4 RESIST_CRITICAL 10 10 - 5 RESIST_PENETRATE 10 10 - } -} - -# ¿©±âºÎÅÍ Default¸¦ µÐ´Ù. -# Default °ªÀ» ¸ðµç ¿ëÈ¥¼®ÀÌ µû¸£°í, -# ƯÁ¤ °ªÀÌ ÀÖ´Â ¿ëÈ¥¼®Àº Default¸¦ ¹ÙÅÁÀ¸·Î ±× °ªÀ» µ¤¾î¾´´Ù. -# µî±Þ¿¡ µû¸¥ ¼Ó¼º¼ö -# ´Ü, basis, add_max´Â 3º¸´Ù Å©¸é ¾ÈµÈ´Ù. -Group ApplyNumSettings -{ - Group Default - { - #--# GRADE_NORMAL GRADE_BRILLIANT GRADE_RARE GRADE_ANCIENT GRADE_LEGENDARY - basis 1 1 1 2 2 - add_min 0 0 0 0 0 - add_max 0 1 2 2 3 - } -# Group ¹é·æ¼® -# { -# #--# GRADE_NORMAL GRADE_BRILLIANT GRADE_RARE GRADE_ANCIENT GRADE_LEGENDARY -# basis 1 1 1 2 2 -# } -} - -# ¿ëÈ¥¼® °¡ÁßÄ¡ Å×À̺í. -# ÀÌ Å×ÀÌºí¿¡¼­ °ªÀÌ 0À̶ó¸é ±× ÀÌ»óÀÇ °­È­´Â ºÒ°¡´ÉÇÏ´Ù°í ÆÇ´ÜÇÑ´Ù. -Group WeightTables -{ - Group Default - { - Group GRADE_NORMAL - { - # ´Ü°è °­È­ - #--# 0 1 2 3 4 5 6 - STEP_LOWEST 1 2 3 0 0 0 0 - STEP_LOW 2 3 4 0 0 0 0 - STEP_MID 3 4 5 6 0 0 0 - STEP_HIGH 4 5 6 7 0 0 0 - STEP_HIGHEST 5 6 7 8 10 0 0 - } - Group GRADE_BRILLIANT - { - STEP_LOWEST 3 4 5 6 0 0 0 - STEP_LOW 4 5 6 8 0 0 0 - STEP_MID 5 6 8 10 0 0 0 - STEP_HIGH 6 8 10 12 15 0 0 - STEP_HIGHEST 8 10 12 15 20 0 0 - } - Group GRADE_RARE - { - #--# 0 1 2 3 4 5 6 - STEP_LOWEST 6 7 9 11 15 0 0 - STEP_LOW 7 9 11 15 20 0 0 - STEP_MID 9 11 15 20 25 0 0 - STEP_HIGH 11 15 20 25 30 0 0 - STEP_HIGHEST 15 20 25 30 40 0 0 - } - Group GRADE_ANCIENT - { - #--# 0 1 2 3 4 5 6 - STEP_LOWEST 10 12 15 18 20 0 0 - STEP_LOW 12 15 18 20 25 0 0 - STEP_MID 15 18 20 25 35 0 0 - STEP_HIGH 18 20 25 35 40 0 0 - STEP_HIGHEST 20 25 35 40 60 80 0 - } - Group GRADE_LEGENDARY - { - #--# 0 1 2 3 4 5 6 - STEP_LOWEST 30 35 40 45 50 0 0 - STEP_LOW 35 40 45 50 55 0 0 - STEP_MID 40 45 50 55 65 0 0 - STEP_HIGH 45 50 55 65 75 90 0 - STEP_HIGHEST 50 55 65 75 90 105 120 - } - } -# Group ¹é·æ¼® -# { -# Group GRADE_NORMAL -# { -# #--# 0 1 2 3 4 5 6 -# STEP_LOWEST 10 20 53 0 0 0 0 -# STEP_HIGHEST 50 60 37 18 10 0 0 -# } -# } -} - -# °³·® table -Group RefineGradeTables -{ - Group Default - { - #--# NEED_COUNT FEE GRADE_NORMAL GRADE_BRILLIANT GRADE_RARE GRADE_ANCIENT GRADE_LEGENDARY - GRADE_NORMAL 15 30000 70 25 5 0 0 - GRADE_BRILLIANT 10 50000 25 70 5 0 0 - GRADE_RARE 5 70000 8 15 75 2 0 - GRADE_ANCIENT 3 100000 2 3 8 85 2 - } -} - -Group RefineStepTables -{ - Group Default - { - #--# NEED_COUNT FEE STEP_LOWEST STEP_LOW STEP_MID STEP_HIGH STEP_HIGHEST - STEP_LOWEST 4 20000 70 25 5 0 0 - STEP_LOW 3 30000 25 70 5 0 0 - STEP_MID 2 40000 10 20 80 1 0 - STEP_HIGH 1 50000 2 3 5 89 1 - } -} - -Group RefineStrengthTables -{ - Group Default - { - # MATERIAL_DS_REFINE_NORMAL : GRADE_NORMAL °­È­¼® - # MATERIAL_DS_REFINE_BLESSED : ÃູÀÇ °­È­¼® - # MATERIAL_DS_REFINE_HOLLY : ¿ë½ÅÀÇ °­È­¼® - #--# FEE 0 1 2 3 4 5 - MATERIAL_DS_REFINE_NORMAL 10000 100 80 70 50 30 20 - MATERIAL_DS_REFINE_BLESSED 20000 100 88 77 55 33 22 - MATERIAL_DS_REFINE_HOLLY 30000 100 90 80 60 40 30 - } -} - -# ¿ë½ÉÀº 100000(Àӽà vnum)À̰í, ÃæÀü·®Àº socket (0)¿¡ ¹Ú¾Æ³Ö´Â´Ù. -# ´Ü, special item group¿¡ vnum 10053À¸·Î Á¤ÀǵǾîÀÖ´Â ´Ù¸¥ ¿ë½ÉµéÀº Value(0)¿¡ ÀÖ´Â °ªÀÌ ÃæÀü·®. -# ¿ë½É ÃßÃâ È®·ü Å×À̺í -# ÃæÀü·®ÀÌ 0À̶ó´Â °ÍÀº ÃßÃâ ½ÇÆÐ¶ó´Â °Å. -Group DragonHeartExtTables -{ - Group Default - { - #--# 1 2 3 4 5 - # ¿ë½É ÃæÀü·®(%) - CHARGING 0 5 15 30 50 - # µî±Þ°ú ÃæÀü·®¿¡ µû¸¥ È®·ü Å×À̺í - # µî±Þ È®·ü - GRADE_NORMAL 50 35 12 2 1 - GRADE_BRILLIANT 35 40 20 4 1 - GRADE_RARE 20 35 30 12 3 - GRADE_ANCIENT 15 30 35 15 5 - GRADE_LEGENDARY 10 20 40 20 10 - } -} - -# ¿ëÈ¥¼® ÃßÃâ È®·ü Å×À̺í. -# À̰͵µ 1, 2¾ÈÀÌ ÀÖ¾î ÅëÇÕÇÒ ¼ö ÀÖ´Â ¹æ¾ÈÀ¸·Î °¨. -# ÃßÃâ È®·üÀ» Á¤ÇÒ ¼ö ÀÖ°í, ½ÇÆÐ ºÎ»ê¹°µµ Á¤ÇÒ ¼ö ÀÖÀ½.(0ÀÌ¸é ¾ÈÁÜ) -Group DragonSoulExtTables -{ - Group Default - { - #½ÇÆÐ ºÎ»ê¹° - #--# Prob ByProduct - GRADE_NORMAL 50 30270 - GRADE_BRILLIANT 40 30270 - GRADE_RARE 30 30270 - GRADE_ANCIENT 30 30270 - GRADE_LEGENDARY 20 30270 - } -}