BOOL CJewelOfHarmonySystem::MakeSmeltingStoneItem(LPOBJ lpObj) { if ( this->m_bSystemMixSmeltingStone != TRUE ) { GCServerMsgStringSend(lMsg.Get(MSGGET(13,53)), lpObj->m_Index, 1); return TRUE; } lpObj->ChaosLock = TRUE; int iValidItemCount = 0; int iInvalidItemCount = 0; int iMakeSmeltingStoneMixPrice = 0; PMSG_CHAOSMIXRESULT pMsg; C1HeadSet((LPBYTE)&pMsg, 0x86, sizeof(pMsg)); pMsg.Result = 0; int iItemPos = -1; for ( int n=0;n<CHAOS_BOX_SIZE;n++) { if ( lpObj->pChaosBox[n].IsItem() == TRUE ) { if ( this->IsEnableToMakeSmeltingStoneItem(&lpObj->pChaosBox[n]) == TRUE ) { iValidItemCount++; iItemPos = n; } else { iInvalidItemCount++; } } } if ( iValidItemCount != 1 || iInvalidItemCount || iItemPos == -1 ) { gSendProto.DataSend(lpObj->m_Index, (LPBYTE)&pMsg, pMsg.h.size); lpObj->ChaosLock = FALSE; return FALSE; } int JEWEL_OF_HARMONY_MAKE_SMELTINGSTONE_RATE; BOOL bIsItemNormal = TRUE; if ( lpObj->pChaosBox[iItemPos].IsExtItem() == TRUE ) { bIsItemNormal = FALSE; JEWEL_OF_HARMONY_MAKE_SMELTINGSTONE_RATE = this->m_iRateMixSmeltingStoneExt; } else { bIsItemNormal = TRUE; JEWEL_OF_HARMONY_MAKE_SMELTINGSTONE_RATE = this->m_iRateMixSmeltingStoneNor; } iMakeSmeltingStoneMixPrice = this->m_iZenForMixSmeltingStone; int iChaosTaxMoney = iMakeSmeltingStoneMixPrice * g_CastleSiegeSync.GetTaxRateChaos(lpObj->m_Index) / 100; if ( iChaosTaxMoney < 0 ) iChaosTaxMoney = 0; iMakeSmeltingStoneMixPrice += iChaosTaxMoney; if ( iMakeSmeltingStoneMixPrice < 0 ) iMakeSmeltingStoneMixPrice = 0; if ( lpObj->Money < iMakeSmeltingStoneMixPrice ) { pMsg.Result = 2; gSendProto.DataSend(lpObj->m_Index, (LPBYTE)&pMsg, pMsg.h.size); lpObj->ChaosLock = FALSE; return FALSE; } lpObj->Money -= iMakeSmeltingStoneMixPrice; g_CastleSiegeSync.AddTributeMoney(iChaosTaxMoney); GCMoneySend(lpObj->m_Index, lpObj->Money); LogChaosItem(lpObj, "JewelOfHarmony][Smelt Item Mix"); CLog.LogAdd("[JewelOfHarmony][Smelt Item Mix] - Mix Start"); int iRate = rand() % 100; BYTE Socket[5]; Socket[0] = 0xFF; Socket[1] = 0xFF; Socket[2] = 0xFF; Socket[3] = 0xFF; Socket[4] = 0xFF; if ( iRate < JEWEL_OF_HARMONY_MAKE_SMELTINGSTONE_RATE ) { int iItemType; if ( bIsItemNormal == TRUE ) iItemType = this->JEWEL_OF_HARMONY_SMELT_NOR_ITEMINDEX; else iItemType = this->JEWEL_OF_HARMONY_SMELT_EXT_ITEMINDEX; ItemSerialCreateSend(lpObj->m_Index, 255, 0, 0, iItemType, 0, 1, 0, 0, 0, lpObj->m_Index, 0, 0, Socket); gObjInventoryCommit(lpObj->m_Index); CLog.LogAdd("[JewelOfHarmony][Smelt Item Mix] Smelting Stone Normal[%d] Mix Success [%s][%s], Money(%d-%d) Rate(%d/%d)", bIsItemNormal, lpObj->AccountID, lpObj->Name, lpObj->Money, iMakeSmeltingStoneMixPrice, iRate, JEWEL_OF_HARMONY_MAKE_SMELTINGSTONE_RATE); } else { gChaosBox.ChaosBoxInit(lpObj); GCUserChaosBoxSend(lpObj, 0); gSendProto.DataSend(lpObj->m_Index, (LPBYTE)&pMsg, pMsg.h.size); CLog.LogAdd("[JewelOfHarmony][Smelt Item Mix] Smelting Stone Normal[%d] Mix Fail [%s][%s], Money : %d-%d Rate(%d/%d)", bIsItemNormal, lpObj->AccountID, lpObj->Name, lpObj->Money, iMakeSmeltingStoneMixPrice, iRate, JEWEL_OF_HARMONY_MAKE_SMELTINGSTONE_RATE); } lpObj->ChaosLock = FALSE; return TRUE; }
BOOL CJewelOfHarmonySystem::RestoreStrengthenItem(LPOBJ lpObj) { if ( this->m_bSystemRestoreStrengthen != TRUE ) { GCServerMsgStringSend(lMsg.Get(MSGGET(13,54)), lpObj->m_Index, 1); return TRUE; } lpObj->ChaosLock = TRUE; PMSG_CHAOSMIXRESULT pMsg; C1HeadSet((LPBYTE)&pMsg, 0x86, sizeof(pMsg)); pMsg.Result = 0; int iStrengtenItemCount = 0; int iInvalidItemCount = 0; CItem * pItem = NULL; for ( int n=0;n<CHAOS_BOX_SIZE;n++) { if ( lpObj->pChaosBox[n].IsItem() == TRUE ) { if ( this->IsStrengthenByJewelOfHarmony(&lpObj->pChaosBox[n]) == TRUE ) { iStrengtenItemCount++; pItem = &lpObj->pChaosBox[n]; } } } if ( iStrengtenItemCount != 1 ) { gSendProto.DataSend(lpObj->m_Index, (LPBYTE)&pMsg, pMsg.h.size); lpObj->ChaosLock = FALSE; return FALSE; } int iItemOption = this->GetItemStrengthenOption(pItem); int iItemOptionLevel = this->_GetItemOptionLevel(pItem); int JEWEL_OF_HARMONY_RETORE_NEEDZEN = this->_GetZenForRestoreItem(pItem); if ( JEWEL_OF_HARMONY_RETORE_NEEDZEN < 0 ) { gSendProto.DataSend(lpObj->m_Index, (LPBYTE)&pMsg, pMsg.h.size); lpObj->ChaosLock = FALSE; return FALSE; } int iChaosTaxMoney = JEWEL_OF_HARMONY_RETORE_NEEDZEN * g_CastleSiegeSync.GetTaxRateChaos(lpObj->m_Index) / 100; if ( iChaosTaxMoney < 0 ) iChaosTaxMoney = 0; JEWEL_OF_HARMONY_RETORE_NEEDZEN += iChaosTaxMoney; if ( JEWEL_OF_HARMONY_RETORE_NEEDZEN < 0 ) JEWEL_OF_HARMONY_RETORE_NEEDZEN = 0; if ( lpObj->Money < JEWEL_OF_HARMONY_RETORE_NEEDZEN ) { pMsg.Result = 2; gSendProto.DataSend(lpObj->m_Index, (LPBYTE)&pMsg, pMsg.h.size); lpObj->ChaosLock = FALSE; return FALSE; } lpObj->Money -= JEWEL_OF_HARMONY_RETORE_NEEDZEN; g_CastleSiegeSync.AddTributeMoney(iChaosTaxMoney); GCMoneySend(lpObj->m_Index, lpObj->Money); LogChaosItem(lpObj, "JewelOfHarmony][Restore Item"); CLog.LogAdd("[JewelOfHarmony][Restore Item] - Restore Start"); CLog.LogAdd("[JewelOfHarmony][Restore Item] Restore Strengtened Item [%s][%s] Name[%s] ItemType[%d] Serial[%d] OptionType[%d] OptionLevel [%d] Money %d-%d", lpObj->AccountID, lpObj->Name, pItem->GetName(), pItem->m_Type, pItem->m_Number, iItemOption, iItemOptionLevel, lpObj->Money, JEWEL_OF_HARMONY_RETORE_NEEDZEN); pItem->m_JewelOfHarmonyOption = 0; GCUserChaosBoxSend(lpObj, 0); this->ShowStrengthenOption(pItem); lpObj->ChaosLock = FALSE; return TRUE; }
void CJewelOfHarmonySystem::PurityJewelOfHarmony(LPOBJ lpObj) { if ( this->m_bSystemPrutiyJewel != TRUE ) { GCServerMsgStringSend(lMsg.Get(MSGGET(13, 50)), lpObj->m_Index, 1); return; } if ( this->IsEnableToUsePuritySystem() == FALSE ) { GCServerMsgStringSend(lMsg.Get(MSGGET(13, 50)), lpObj->m_Index, 1); CLog.LogAdd("[JewelOfHarmony][%s][%s] Not Purtiy Time ", lpObj->AccountID, lpObj->Name); return; } lpObj->ChaosLock = TRUE; // Chaos Lock was Enabled int iJewelOfHarmonyItemCount = 0; int iInvalidItemCount = 0; int iChaosMixPrice = 0; PMSG_CHAOSMIXRESULT pMsg; C1HeadSet((LPBYTE)&pMsg, 0x86, sizeof(PMSG_CHAOSMIXRESULT)); pMsg.Result = CB_ERROR; for ( int n =0;n<CHAOS_BOX_SIZE;n++) { if ( lpObj->pChaosBox[n].IsItem() == TRUE ) { if ( lpObj->pChaosBox[n].m_Type == this->JEWEL_OF_HARMONY_ITEMINDEX ) { iJewelOfHarmonyItemCount++; } else { iInvalidItemCount++; } } } if ( iInvalidItemCount > 0 || iJewelOfHarmonyItemCount !=1 ) { gSendProto.DataSend(lpObj->m_Index, (LPBYTE)&pMsg, pMsg.h.size); lpObj->ChaosLock = FALSE; return; } iChaosMixPrice = this->m_iZenForPurity; int iChaosTaxMoney = iChaosMixPrice * g_CastleSiegeSync.GetTaxRateChaos(lpObj->m_Index) / 100; if (iChaosTaxMoney < 0 ) iChaosTaxMoney = 0; iChaosMixPrice += iChaosTaxMoney; if ( iChaosMixPrice < 0 ) iChaosMixPrice = 0; if ( lpObj->Money < iChaosMixPrice ) { pMsg.Result = CB_NOT_ENOUGH_ZEN; gSendProto.DataSend(lpObj->m_Index, (LPBYTE)&pMsg, pMsg.h.size); lpObj->ChaosLock = FALSE; return; } lpObj->Money -= iChaosMixPrice; g_CastleSiegeSync.AddTributeMoney(iChaosTaxMoney); GCMoneySend(lpObj->m_Index, lpObj->Money); LogChaosItem(lpObj, "JewelOfHarmony][Purity"); CLog.LogAdd("[JewelOfHarmony][Purity] - Mix Start"); BYTE Socket[5]; Socket[0] = 0xFF; Socket[1] = 0xFF; Socket[2] = 0xFF; Socket[3] = 0xFF; Socket[4] = 0xFF; int iRate = rand() % 100; if ( iRate < this->m_iRatePuritySuccess ) { int iItemType = this->JEWEL_OF_HARMONY_PURITY_ITEMINDEX; ItemSerialCreateSend(lpObj->m_Index, -1, 0, 0, iItemType, 0, 1, 0, 0, 0, lpObj->m_Index, 0, 0, Socket); gObjInventoryCommit(lpObj->m_Index); CLog.LogAdd("[JewelOfHarmony][Purity] Purity Success [%s][%s] Rate %d/%d", lpObj->AccountID, lpObj->Name, iRate, this->m_iRatePuritySuccess); } else { gChaosBox.ChaosBoxInit(lpObj); GCUserChaosBoxSend(lpObj, 0); gSendProto.DataSend(lpObj->m_Index, (LPBYTE)&pMsg, pMsg.h.size); CLog.LogAdd("[JewelOfHarmony][Purity] Purity Fail [%s][%s] Rate %d/%d", lpObj->AccountID, lpObj->Name, iRate, this->m_iRatePuritySuccess); } // Chaos Lock was Disabled lpObj->ChaosLock = FALSE; }
BYTE CIllusionTempleEvent::TicketMix(int iIndex, int iLevel, int iCharmCount) { if( OBJMAX_RANGE( iIndex ) == FALSE ) { return FALSE; } if( IT_MAP_RANGE( iLevel + (MAP_INDEX_ILLUSIONTEMPLE1 - 1)) == FALSE ) { return FALSE; } int Empty = 0; PMSG_CHAOSMIXRESULT pMsg; PHeadSetB((LPBYTE)&pMsg,0x86,sizeof(pMsg)); pMsg.Result = 0; gObj[iIndex].ChaosLock = TRUE; LogAddTD("[Illusion Temple] Mix Chaos Mix Start (Account:%s, Name:%s, Level:%d)", gObj[iIndex].AccountID,gObj[iIndex].Name,iLevel); char szTmp[23]; wsprintf(szTmp,"IllusionTemple Mix,%d",iLevel); g_ChaosBox.LogChaosItem(&gObj[iIndex],szTmp); int MixRate = IT_TicketRate[-1 + iLevel]; if( MixRate < 0 || MixRate > 100 ) { DataSend(iIndex,(LPBYTE)&pMsg,pMsg.h.size); LogAddTD("[Illusion Temple] Mix Chaos Mix Failed - MixRate Out of Bound (Account:%s, Name:%s, Level:%d)", gObj[iIndex].AccountID,gObj[iIndex].Name,iLevel); return FALSE; } if ( g_CrywolfSync.GetOccupationState() == 0 && g_iCrywolfApplyMvpBenefit ) { MixRate += g_CrywolfSync.GetPlusChaosRate(); } int iNeedChaosMoney = IT_TicketZen[-1 + iLevel]; int iChaosTaxMoney = (int)((__int64)iNeedChaosMoney * (__int64)g_CastleSiegeSync.GetTaxRateChaos(iIndex) / (__int64)100); if ( iChaosTaxMoney < 0 ) { iChaosTaxMoney = 0; } iNeedChaosMoney += iChaosTaxMoney; if ( iNeedChaosMoney < 0 ) { DataSend(iIndex,(LPBYTE)&pMsg,pMsg.h.size); LogAddTD("[Illusion Temple] Mix Chaos Mix Failed - MixMoney< 0 (Account:%s, Name:%s, Level:%d).", gObj[iIndex].AccountID,gObj[iIndex].Name,iLevel); return false; } if ( ( gObj[iIndex].Money - iNeedChaosMoney ) < 0 ) { pMsg.Result = 11; DataSend(iIndex,(LPBYTE)&pMsg,pMsg.h.size); LogAddTD("[Illusion Temple] Mix Chaos Mix Failed - Not Enough Money (Account:%s, Name:%s, Level:%d)", gObj[iIndex].AccountID,gObj[iIndex].Name,iLevel); return false; } gObj[iIndex].Money -= iNeedChaosMoney; g_CastleSiegeSync.AddTributeMoney(iChaosTaxMoney); GCMoneySend(iIndex, gObj[iIndex].Money); MixRate += iCharmCount; if( rand() % 100 < MixRate ) { #if( __4GAMERS__ == 1 ) g_Achievements.GD_UpdateMixData(&gObj[iIndex], true); #endif int Item = ITEMGET(13,51); ItemSerialCreateSend(iIndex,0xFF,0,0,Item,iLevel,0,0,0,0,-1,0,0); LogAddTD("[Illusion Temple] [%s][%s] CBMix Success %d Money : %d-%d, CharmRate : %d", gObj[iIndex].AccountID,gObj[iIndex].Name,MixRate,gObj[iIndex].Money,iNeedChaosMoney,iCharmCount); } else { #if( __4GAMERS__ == 1 ) g_Achievements.GD_UpdateMixData(&gObj[iIndex], false); #endif g_ChaosBox.ChaosBoxInit(&gObj[iIndex]); GCUserChaosBoxSend(&gObj[iIndex], 0); DataSend(iIndex,(LPBYTE)&pMsg,pMsg.h.size); LogAddTD("[Illusion Temple] [%s][%s] CBMix Fail %d Money : %d-%d, CharmRate : %d", gObj[iIndex].AccountID,gObj[iIndex].Name,MixRate,gObj[iIndex].Money,iNeedChaosMoney,iCharmCount); return FALSE; } gObjInventoryCommit(iIndex); return TRUE; }
BOOL CItem380System::ChaosMix380ItemOption(LPOBJ lpObj) { if ( this->m_bSystemFor380ItemOption != TRUE ) { GCServerMsgStringSend(lMsg.Get(MSGGET(13,55)), lpObj->m_Index, 1); lpObj->bIsChaosMixCompleted = false; return FALSE; } lpObj->ChaosLock = TRUE; int iValidItemCount = 0; int iJewelOfHarmony = 0; int iJewelOfSuho = 0; int iInvalidItemCount = 0; int iMixPrice = 0; int iCharmOfLuckCount = 0; PMSG_CHAOSMIXRESULT pMsg; C1HeadSet((LPBYTE)&pMsg, 0x86, sizeof(pMsg)); pMsg.Result = 0; CItem * pTargetItem = NULL; int iPosOfJewelOfHarmony= -1; int iPosOfJewelOfSuho= -1; for ( int n=0;n<CHAOS_BOX_SIZE;n++) { if ( lpObj->pChaosBox[n].IsItem() == TRUE ) { if ( this->Is380Item(&lpObj->pChaosBox[n]) == TRUE && this->Is380OptionItem(&lpObj->pChaosBox[n]) == FALSE && lpObj->pChaosBox[n].m_Level > 3 && (lpObj->pChaosBox[n].m_Option3<<2) > 3) { iValidItemCount++; pTargetItem = &lpObj->pChaosBox[n]; } else if ( g_kJewelOfHarmonySystem.IsJewelOfHarmonyPurity(lpObj->pChaosBox[n].m_Type) == TRUE ) { iJewelOfHarmony++; iPosOfJewelOfHarmony = n; } else if ( lpObj->pChaosBox[n].m_Type == ITEMGET(14, 31) ) { iJewelOfSuho++; iPosOfJewelOfSuho = n; } else if ( lpObj->pChaosBox[n].m_Type == ITEMGET(14,53) ) { iCharmOfLuckCount += (int)lpObj->pChaosBox[n].m_Durability; } else { iInvalidItemCount++; } } } if ( iInvalidItemCount || iValidItemCount != 1 || iJewelOfHarmony != 1 || iJewelOfSuho != 1 || pTargetItem == NULL || iPosOfJewelOfHarmony == -1 || iPosOfJewelOfSuho == -1 || iCharmOfLuckCount > 10 ) { gSendProto.DataSend(lpObj->m_Index, (LPBYTE)&pMsg, pMsg.h.size); lpObj->ChaosLock = FALSE; return FALSE; } iMixPrice = this->m_iNeedZenFor380Option; int iChaosTaxMoney = iMixPrice * g_CastleSiegeSync.GetTaxRateChaos(lpObj->m_Index) / 100; if ( iChaosTaxMoney < 0 ) iChaosTaxMoney = 0; iMixPrice += iChaosTaxMoney; if ( iMixPrice < 0 ) iMixPrice = 0; if ( lpObj->Money < iMixPrice ) { pMsg.Result = 2; gSendProto.DataSend(lpObj->m_Index, (LPBYTE)&pMsg, pMsg.h.size); lpObj->ChaosLock = FALSE; return FALSE; } lpObj->Money -= iMixPrice; g_CastleSiegeSync.AddTributeMoney(iChaosTaxMoney); GCMoneySend(lpObj->m_Index, lpObj->Money); LogChaosItem(lpObj, "380Item][Item Mix"); CLog.LogAdd("[380Item][Item Mix] - Mix Start"); int iRate = rand() % 100; int iRateSuccess = this->m_iRateSuccessRateForMix1; if ( pTargetItem->m_Level < 7 ) iRateSuccess = this->m_iRateSuccessRateForMix1; else if ( pTargetItem->m_Level < 10 ) iRateSuccess = this->m_iRateSuccessRateForMix2; else if ( pTargetItem->m_Level < 16 ) iRateSuccess = this->m_iRateSuccessRateForMix3; iRateSuccess += iCharmOfLuckCount; lpObj->pChaosBox[iPosOfJewelOfHarmony].Clear(); lpObj->pChaosBoxMap[iPosOfJewelOfHarmony] = -1; lpObj->pChaosBox[iPosOfJewelOfSuho].Clear(); lpObj->pChaosBoxMap[iPosOfJewelOfSuho] = -1; if ( iRate < iRateSuccess ) { this->_SetOption(pTargetItem, TRUE); GCUserChaosBoxSend(lpObj, 0); CLog.LogAdd("[380Item][ItemMix] Mix Success [%s][%s], Money(%d-%d) Rate(%d/%d) Option(%d,%d) OptionValue(%d,%d)", lpObj->AccountID, lpObj->Name, lpObj->Money, iMixPrice, iRate, iRateSuccess, this->m_itemOption[(pTargetItem->m_Type )].m_Option1, this->m_itemOption[(pTargetItem->m_Type )].m_Option2, this->m_itemOption[(pTargetItem->m_Type )].m_Value1, this->m_itemOption[(pTargetItem->m_Type )].m_Value2); } else { GCUserChaosBoxSend(lpObj, 0); gSendProto.DataSend(lpObj->m_Index, (LPBYTE)&pMsg, pMsg.h.size); CLog.LogAdd("[380Item][ItemMix] Mix Fail [%s][%s], Money(%d-%d) Rate(%d/%d)", lpObj->AccountID, lpObj->Name, lpObj->Money, iMixPrice, iRate, iRateSuccess); } lpObj->ChaosLock = FALSE; return TRUE; }
BYTE CIllusionTempleEvent::IllusionTempleChaosMix(int nIndex, int nLEVEL, int iCharmOfLuckCount) { if( OBJMAX_RANGE(nIndex) == FALSE ) { return FALSE; } if ( IT_MAP_RANGE((nLEVEL+(45-1))) == FALSE ) { return FALSE; } int loc2 = 0; PMSG_CHAOSMIXRESULT pMsg; PHeadSetB((LPBYTE)&pMsg.h, 0x86, sizeof(PMSG_CHAOSMIXRESULT)); pMsg.Result = CB_ERROR; gObj[nIndex].ChaosLock = TRUE; LogAddTD("[Illusion Temple] 피의 두루마리 Mix Chaos Mix Start (Account:%s, Name:%s, Level:%d)", gObj[nIndex].AccountID, gObj[nIndex].Name, nLEVEL); char szTemp[17]; wsprintf(szTemp, "피의 두루마리 Mix,%d", nLEVEL); g_MixSystem.LogChaosItem(&gObj[nIndex], szTemp); int iMIX_SUCCESS_RATE = g_iIT_ChoasMixSuccessRate[nLEVEL-1]; //loc11 if ( iMIX_SUCCESS_RATE < 0 || iMIX_SUCCESS_RATE > 100 ) { DataSend(nIndex, (LPBYTE)&pMsg, pMsg.h.size); LogAddTD("[Illusion Temple] 피의 두루마리 Mix Chaos Mix Failed - MixRate Out of Bound (Account:%s, Name:%s, Level:%d)", gObj[nIndex].AccountID, gObj[nIndex].Name, nLEVEL); return FALSE; } if ( g_CrywolfSync.GetOccupationState() == 0 && g_iCrywolfApplyMvpBenefit ) { iMIX_SUCCESS_RATE += g_CrywolfSync.GetPlusChaosRate(); } int iMIX_NEED_MONEY = g_iIT_ChoasMixMoney[nLEVEL-1]; //loc12 int iChaosTaxMoney = (int)((__int64)(iMIX_NEED_MONEY) * (__int64)(g_CastleSiegeSync.GetTaxRateChaos(nIndex)) / (__int64)100); //loc13 if ( iChaosTaxMoney < 0 ) { iChaosTaxMoney = 0; } iMIX_NEED_MONEY += iChaosTaxMoney; if ( iMIX_NEED_MONEY < 0 ) { DataSend(nIndex, (LPBYTE)&pMsg, pMsg.h.size); LogAddTD("[Illusion Temple] 피의 두루마리 Mix Chaos Mix Failed - MixMoney < 0 (Account:%s, Name:%s, Level:%d)", gObj[nIndex].AccountID, gObj[nIndex].Name, nLEVEL); return FALSE; } if ( (gObj[nIndex].Money - iMIX_NEED_MONEY) < 0 ) { pMsg.Result = CB_BC_NOT_ENOUGH_ZEN; DataSend(nIndex, (LPBYTE)&pMsg, pMsg.h.size); LogAddTD("[Illusion Temple] 피의 두루마리 Mix Chaos Mix Failed - Not Enough Money (Account:%s, Name:%s, Level:%d)", gObj[nIndex].AccountID, gObj[nIndex].Name, nLEVEL); return FALSE; } gObj[nIndex].Money -= iMIX_NEED_MONEY; g_CastleSiegeSync.AddTributeMoney(iChaosTaxMoney); GCMoneySend(nIndex, gObj[nIndex].Money); iMIX_SUCCESS_RATE += iCharmOfLuckCount; //season 3.0 moved if ( (rand()%100) < iMIX_SUCCESS_RATE ) // Success (season 3.0 changed) { int item_num = ITEMGET(13,51); // Blood Scroll loc14 ItemSerialCreateSend(nIndex, -1, 0, 0, item_num, nLEVEL, 0, 0, 0, 0, -1, 0, 0); LogAddTD("[피의 두루마리 Mix] [%s][%s] CBMix Success %d Money : %d-%d, CharmRate : %d", gObj[nIndex].AccountID, gObj[nIndex].Name, iMIX_SUCCESS_RATE, gObj[nIndex].Money, iMIX_NEED_MONEY, iCharmOfLuckCount); } else { g_MixSystem.ChaosBoxInit(&gObj[nIndex]); GCUserChaosBoxSend(&gObj[nIndex], 0); DataSend(nIndex, (LPBYTE)&pMsg, pMsg.h.size); LogAddTD("[피의 두루마리 Mix] [%s][%s] CBMix Fail %d Money : %d-%d, CharmRate : %d", gObj[nIndex].AccountID, gObj[nIndex].Name, iMIX_SUCCESS_RATE, gObj[nIndex].Money, iMIX_NEED_MONEY, iCharmOfLuckCount); return FALSE; } ::gObjInventoryCommit(nIndex); return TRUE; }
// ----------------------------------------------------------------------------------------------------------------------- void CItemSocket::SeedSphere(LPOBJ lpObj) { int ChaosCount = 0; int CreationCount = 0; int SeedCount = 0; int SeedType = 0; int SeedLevel = 0; int SphereCount = 0; int SphereType = 0; lpObj->ChaosLock = 1; for(int n=0;n < CHAOS_BOX_SIZE;n++) { if(lpObj->pChaosBox[n].IsItem() == 0) { continue; } if(lpObj->pChaosBox[n].m_Type == ITEMGET(12,15)) { ChaosCount++; } else if(lpObj->pChaosBox[n].m_Type == ITEMGET(14,22)) { CreationCount++; } else if(lpObj->pChaosBox[n].m_Type >= ITEMGET(12,60) && lpObj->pChaosBox[n].m_Type <= ITEMGET(12,66)) { SeedCount++; SeedType = lpObj->pChaosBox[n].m_Type - ITEMGET(12,60); // From 0 to 5 SeedLevel = lpObj->pChaosBox[n].m_Level; } else if(lpObj->pChaosBox[n].m_Type >= ITEMGET(12,70) && lpObj->pChaosBox[n].m_Type <= ITEMGET(12,74)) { SphereCount++; SphereType = lpObj->pChaosBox[n].m_Type - ITEMGET(12,70); // From 0 to 4 } } PMSG_CHAOSMIXRESULT pMsg; C1HeadSet((LPBYTE)&pMsg.h,0x86,sizeof(pMsg)); if(ChaosCount != 1 || CreationCount != 1 || SeedCount != 1 || SphereCount != 1) { lpObj->ChaosLock = 0; pMsg.Result = CB_INCORRECT_MIX_ITEMS; gSendProto.DataSend(lpObj->m_Index,(BYTE *)&pMsg, pMsg.h.size); return; } lpObj->ChaosSuccessRate = 85-(SphereType*5); lpObj->ChaosMoney = 1000000; int TaxMoney = (lpObj->ChaosMoney*g_CastleSiegeSync.GetTaxRateChaos(lpObj->m_Index))/100; lpObj->ChaosMoney += TaxMoney; if(lpObj->Money < lpObj->ChaosMoney) { lpObj->ChaosLock = 0; pMsg.Result = CB_NOT_ENOUGH_ZEN; gSendProto.DataSend(lpObj->m_Index,(BYTE *)&pMsg, pMsg.h.size); return; } lpObj->Money -= lpObj->ChaosMoney; GCMoneySend(lpObj->m_Index,lpObj->Money); g_CastleSiegeSync.AddTributeMoney(TaxMoney); BYTE Socket[5]; Socket[0] = 0xFF; Socket[1] = 0xFF; Socket[2] = 0xFF; Socket[3] = 0xFF; Socket[4] = 0xFF; if((rand()%100) < lpObj->ChaosSuccessRate) { int index = ITEMGET(12,100)+(SphereType*6)+SeedType; int level = SeedLevel; ItemSerialCreateSend(lpObj->m_Index,-1,0,0,index,level,0,0,0,0,-1,0,0,Socket); CLog.LogAdd("[%s][%s] SeedSphere Composite Success - Seed Info ( Index : %d, Level : %d )",lpObj->AccountID,lpObj->Name,index,level); } else { gChaosBox.ChaosBoxInit(lpObj); GCUserChaosBoxSend(lpObj,0); pMsg.Result = 0; gSendProto.DataSend(lpObj->m_Index,(BYTE *)&pMsg, pMsg.h.size); CLog.LogAdd("[%s][%s] SeedSphere Composite Failed",lpObj->AccountID,lpObj->Name); } lpObj->ChaosLock = 0; }
// ----------------------------------------------------------------------------------------------------------------------- void CItemSocket::SeedExtract(LPOBJ lpObj) //GOOD { int ChaosCount = 0; int HarmonyCount = 0; int CreationCount = 0; int ExcItemCount = 0; int SetItemCount = 0; lpObj->ChaosLock = 1; for(int n=0;n < CHAOS_BOX_SIZE;n++) { if(lpObj->pChaosBox[n].IsItem() == 0) { continue; } if(lpObj->pChaosBox[n].m_Type == ITEMGET(12,15)) { ChaosCount++; } else if(lpObj->pChaosBox[n].m_Type == ITEMGET(14,42)) { HarmonyCount++; } else if(lpObj->pChaosBox[n].m_Type == ITEMGET(14,22)) { CreationCount++; } else if(lpObj->pChaosBox[n].IsExtItem() != 0 && lpObj->pChaosBox[n].m_Level >= 4) { ExcItemCount++; } else if(lpObj->pChaosBox[n].IsSetItem() != 0 && lpObj->pChaosBox[n].m_Level >= 4) { SetItemCount++; } } PMSG_CHAOSMIXRESULT pMsg; C1HeadSet((LPBYTE)&pMsg.h,0x86,sizeof(pMsg)); if(ChaosCount != 1 || HarmonyCount != 1 || CreationCount != 1 || ExcItemCount != 1 || SetItemCount != 1) { lpObj->ChaosLock = 0; pMsg.Result = CB_INCORRECT_MIX_ITEMS; gSendProto.DataSend(lpObj->m_Index,(BYTE*)&pMsg,pMsg.h.size); return; } lpObj->ChaosSuccessRate = 90; lpObj->ChaosMoney = 1000000; int TaxMoney = (lpObj->ChaosMoney* g_CastleSiegeSync.GetTaxRateChaos(lpObj->m_Index))/100; lpObj->ChaosMoney += TaxMoney; if(lpObj->Money < lpObj->ChaosMoney) { lpObj->ChaosLock = 0; pMsg.Result = CB_NOT_ENOUGH_ZEN; gSendProto.DataSend(lpObj->m_Index,(BYTE *)&pMsg, pMsg.h.size); return; } int type = rand()%6; // ---- if ( type < 0 ) { type = 0; } else if ( type > 5 ) { type = 5; } int count = this->GetOptionCount(type); if(count == 0) { lpObj->ChaosLock = 0; pMsg.Result = CB_ERROR; gSendProto.DataSend(lpObj->m_Index,(BYTE *)&pMsg, pMsg.h.size); CLog.LogAdd("[%s][%s] Seed Extract Mix Failed",lpObj->AccountID,lpObj->Name); return; } lpObj->Money -= lpObj->ChaosMoney; GCMoneySend(lpObj->m_Index,lpObj->Money); g_CastleSiegeSync.AddTributeMoney(TaxMoney); if((rand()%100) < lpObj->ChaosSuccessRate) { int index = ITEMGET(12,60)+type; int level; if ( type == 5 ) { level = 2; } else { level = rand()%count; } BYTE Socket[5]; Socket[0] = 0xFF; Socket[1] = 0xFF; Socket[2] = 0xFF; Socket[3] = 0xFF; Socket[4] = 0xFF; ItemSerialCreateSend(lpObj->m_Index,-1,0,0,index,level,0,0,0,0,-1,0,0,Socket); CLog.LogAdd("[%s][%s] Seed Extract Mix Success - Seed Info ( Index : %d, Level : %d )",lpObj->AccountID,lpObj->Name,index,level); } else { gChaosBox.ChaosBoxInit(lpObj); GCUserChaosBoxSend(lpObj,0); pMsg.Result = CB_ERROR; gSendProto.DataSend(lpObj->m_Index,(BYTE *)&pMsg, pMsg.h.size); CLog.LogAdd("[%s][%s] Seed Extract Mix Failed",lpObj->AccountID,lpObj->Name); } lpObj->ChaosLock = 0; }