chipvip05
03-11-18, 12:46 PM
Chaobox của E đã thêm đc ntn k bik đúng chưa. đã Build đc nhưng chỉ còn công thức trong file mix e chưa hiểu về nó lắm. bác hd e chút đc k.
BOOL Wing25ChaosMix(LPOBJ lpObj) { lpObj->ChaosLock = TRUE;
int WingCount = 0;
int ItemCount = 0;
int ChaosGemCount = 0;
int JewelOfCreationCount = 0;
int Wing25TypeItemCount = 0;
int iChaosMoney = 0;
int iWingChaosMoney = 0;
BYTE WingTypeResult = 0;
for (int n = 0; n < CHAOS_BOX_SIZE; n++) {
if (lpObj->pChaosBox[n].IsItem() == TRUE) {
if ((lpObj->pChaosBox[n].m_Type >= ITEMGET(12, 3) &&
lpObj->pChaosBox[n].m_Type <= ITEMGET(12, 6))) { // Second Wings
WingCount++;
iWingChaosMoney = lpObj->pChaosBox[n].m_BuyMoney;
}
else if (lpObj->pChaosBox[n].m_Type == ITEMGET(13, 30)) { // Dark Lord Cape
WingCount++;
iWingChaosMoney = lpObj->pChaosBox[n].m_BuyMoney;
}
else if (lpObj->pChaosBox[n].m_Type == ITEMGET(12, 49)) { // Wing of Rage Fighter
WingCount++;
iWingChaosMoney = lpObj->pChaosBox[n].m_BuyMoney;
}
else if (lpObj->pChaosBox[n].m_Type == ITEMGET(12, 42)) { // Summoner Wings [Wing of Despair]
WingCount++;
iWingChaosMoney = lpObj->pChaosBox[n].m_BuyMoney;
}
else if (lpObj->pChaosBox[n].m_Type == ITEMGET(12, 15)) { // Chaos
ChaosGemCount++;
}
else if (lpObj->pChaosBox[n].m_Type == ITEMGET(14, 22)) { // Jewel of Creation
JewelOfCreationCount++;
}
else if (lpObj->pChaosBox[n].m_Type == ITEMGET(14, 176)) { // Wing 2.5 Part
WingTypeResult = 1;
Wing25TypeItemCount++;
}
else if (lpObj->pChaosBox[n].m_Type == ITEMGET(14, 177)) { // Wing 2.5 Part
WingTypeResult = 2;
Wing25TypeItemCount++;
}
else if (lpObj->pChaosBox[n].m_Type == ITEMGET(14, 178)) { // Wing 2.5 Part
WingTypeResult = 3;
Wing25TypeItemCount++;
}
else if (lpObj->pChaosBox[n].m_Type == ITEMGET(14, 179)) { // Wing 2.5 Part
WingTypeResult = 4;
Wing25TypeItemCount++;
}
}
}
PMSG_CHAOSMIXRESULT pMsg;
PHeadSetB((LPBYTE)&pMsg.h, 0x86, sizeof(PMSG_CHAOSMIXRESULT));
pMsg.Result = CB_ERROR;
if (WingCount != 1 || JewelOfCreationCount != 1 || ChaosGemCount != 1 || Wing25TypeItemCount != 1) {
lpObj->ChaosLock = FALSE;
pMsg.Result = CB_INCORRECT_MIX_ITEMS;
DataSend(lpObj->m_Index, (BYTE *)&pMsg, pMsg.h.size);
return FALSE;
}
int nChaosNeedMoney = 3000000;
int iChaosTaxMoney = (int)((__int64)nChaosNeedMoney * (__int64)g_CastleSiegeSync.GetTaxRateChaos(lpObj->m_Index) / (__int64)100);
if (iChaosTaxMoney < 0) { iChaosTaxMoney = 0; }
nChaosNeedMoney += iChaosTaxMoney;
if (nChaosNeedMoney < 0) {
nChaosNeedMoney = 0;
}
if (lpObj->Money < nChaosNeedMoney) {
pMsg.Result = CB_NOT_ENOUGH_ZEN;
DataSend(lpObj->m_Index, (BYTE *)&pMsg, pMsg.h.size);
lpObj->ChaosLock = FALSE;
return TRUE;
}
lpObj->ChaosSuccessRate = ((DWORD)((DWORD)iWingChaosMoney / (DWORD)4000000)) & 255;
if (iChaosMoney > 0) {
lpObj->ChaosSuccessRate = (lpObj->ChaosSuccessRate + (iChaosMoney / 2800000)) & 255;
}
if (iChaosMoney < 0) {
lpObj->ChaosSuccessRate = (lpObj->ChaosSuccessRate + (-1 * iChaosMoney / 2800000)) & 255;
}
LogChaosItem(lpObj, "WingMix,2.5");
CHAOS_LOG.Output("[WingMix 2.5] Chaos Mix Start");
if (WingCount == 1) {
if (lpObj->ChaosSuccessRate > ReadConfig.Wing25MaxPercent) {
lpObj->ChaosSuccessRate = ReadConfig.Wing25MaxPercent;
}
if (lpObj->ChaosSuccessRate < ReadConfig.Wing25MinPercent) {
lpObj->ChaosSuccessRate = ReadConfig.Wing25MinPercent;
}
}
if (ReadConfig.IsVipExtraMixPercent == 1 && lpObj->Vip == 1) {
if (lpObj->ChaosSuccessRate + ReadConfig.VipExtraMixPercent < 100) {
lpObj->ChaosSuccessRate += ReadConfig.VipExtraMixPercent;
}
else {
lpObj->ChaosSuccessRate = 100;
}
CHAOS_LOG.Output(
"[CBMix][%s][%s] VIP Extra Percent brings mix up to: %d",
lpObj->AccountID, lpObj->Name,
lpObj->ChaosSuccessRate
char sbuff[1024] = { 0 };
wsprintf(sbuff, "[VIP] Extra %d percent added!", ReadConfig.VipExtraMixPercent);
GCServerMsgStringSend(sbuff, lpObj->m_Index, 1);
}
if (lpObj->ChaosSuccessRate > 100) {
lpObj->ChaosSuccessRate = 100;
}
lpObj->Money -= nChaosNeedMoney;
g_CastleSiegeSync.AddTributeMoney(iChaosTaxMoney);
GCMoneySend(lpObj->m_Index, lpObj->Money);
int SuccessRateRandom = 0;
SuccessRateRandom = (rand() % 100);
if (SuccessRateRandom < lpObj->ChaosSuccessRate) {
int iWingLevel = 0;
int iItemType = 0;
int iItemSubType = 0;
if (WingTypeResult == 1) {
iItemType = 12;
iItemSubType = 246;
}
else if (WingTypeResult == 2) {
iItemType = 12;
iItemSubType = 247;
}
else if (WingTypeResult == 3) {
iItemType = 12;
iItemSubType = 248;
}
else if (WingTypeResult == 4) {
iItemType = 12;
iItemSubType = 249;
}
int iWingNum = ITEMGET(iItemType, iItemSubType);
int iOption1 = 0;
int iOption2 = 0;
int iOption3 = 0;
//Luck
if (ReadConfig.Wing25LuckPercent > (rand() % 100)) {
iOption1 = 1;
}
//Z28 Options
if (ReadConfig.Wing25Z28Percent > (rand() % 100)) {
int z28Percent = ReadConfig.Wing25Z28Percent * 100;
iOption2 = rand() % (z28Percent + 1);
iOption2 = iOption2 / 100;
}
if (ReadConfig.Wing25Z28Percent == 0) {
int iRandomValue = rand() % 100;
int iRandomValue2 = rand() % 3;
switch (iRandomValue2) {
case 0:
if (iRandomValue < 4) {
iOption2 = 3; // +12
}
break;
case 1:
if (iRandomValue < 10) {
iOption2 = 2; // +8
}
break;
case 2:
if (iRandomValue < 20) {
iOption2 = 1; // +4;
}
break;
}
}
//Exc Options
if ((rand() % 100) < ReadConfig.Wing25ExcOptionProbability) {
iOption3 = BoxExcOptions(ReadConfig.Wing25MaxExcOption);
}
::ItemSerialCreateSend(lpObj->m_Index, -1, 0, 0, iWingNum, iWingLevel, 0, 0, iOption1, iOption2, -1, iOption3, 0);
CHAOS_LOG.Output("[WingMix 2.5] [%s][%s] CBMix Success %d/%d Money : %d-%d (%d,%d)",
lpObj->AccountID, lpObj->Name,
lpObj->ChaosSuccessRate, SuccessRateRandom,
lpObj->Money, nChaosNeedMoney,
iChaosMoney, iWingChaosMoney);
::gObjInventoryCommit(lpObj->m_Index);
MuItemShop.EarnGoblinPointsCBMix(lpObj->m_Index, lpObj->ChaosSuccessRate, 0);
lpObj->ChaosLock = FALSE;
return TRUE;
}
else {
for (int n = 0; n < CHAOS_BOX_SIZE; n++) {
lpObj->pChaosBox[n].Clear();
}
GCUserChaosBoxSend(lpObj, 0);
DataSend(lpObj->m_Index, (BYTE *)&pMsg, pMsg.h.size);
CHAOS_LOG.Output("[WingMix 2.5] [%s][%s] CBMix Fail %d/%d Money : %d-%d (%d,%d)",
lpObj->AccountID, lpObj->Name,
lpObj->ChaosSuccessRate, SuccessRateRandom,
lpObj->Money, nChaosNeedMoney,
iChaosMoney, iWingChaosMoney);
::gObjInventoryCommit(lpObj->m_Index);
MuItemShop.EarnGoblinPointsCBMix(lpObj->m_Index, lpObj->ChaosSuccessRate, 1);
lpObj->ChaosLock = FALSE;
return FALSE;
}
}
Chaosbox.h đã thêm
CHAOS_MIX_WING_25 = 56,
BOOL Wing25ChaosMix(LPOBJ lpObj);
ReadConfig.h
BYTE Wing25MinPercent; BYTE Wing25MaxPercent;
BYTE Wing25LuckPercent;
BYTE Wing25Z28Percent;
BYTE Wing25Z28Max;
BYTE Wing25ExcOptionProbability;
BYTE Wing25MaxExcOption;
BOOL Wing25ChaosMix(LPOBJ lpObj) { lpObj->ChaosLock = TRUE;
int WingCount = 0;
int ItemCount = 0;
int ChaosGemCount = 0;
int JewelOfCreationCount = 0;
int Wing25TypeItemCount = 0;
int iChaosMoney = 0;
int iWingChaosMoney = 0;
BYTE WingTypeResult = 0;
for (int n = 0; n < CHAOS_BOX_SIZE; n++) {
if (lpObj->pChaosBox[n].IsItem() == TRUE) {
if ((lpObj->pChaosBox[n].m_Type >= ITEMGET(12, 3) &&
lpObj->pChaosBox[n].m_Type <= ITEMGET(12, 6))) { // Second Wings
WingCount++;
iWingChaosMoney = lpObj->pChaosBox[n].m_BuyMoney;
}
else if (lpObj->pChaosBox[n].m_Type == ITEMGET(13, 30)) { // Dark Lord Cape
WingCount++;
iWingChaosMoney = lpObj->pChaosBox[n].m_BuyMoney;
}
else if (lpObj->pChaosBox[n].m_Type == ITEMGET(12, 49)) { // Wing of Rage Fighter
WingCount++;
iWingChaosMoney = lpObj->pChaosBox[n].m_BuyMoney;
}
else if (lpObj->pChaosBox[n].m_Type == ITEMGET(12, 42)) { // Summoner Wings [Wing of Despair]
WingCount++;
iWingChaosMoney = lpObj->pChaosBox[n].m_BuyMoney;
}
else if (lpObj->pChaosBox[n].m_Type == ITEMGET(12, 15)) { // Chaos
ChaosGemCount++;
}
else if (lpObj->pChaosBox[n].m_Type == ITEMGET(14, 22)) { // Jewel of Creation
JewelOfCreationCount++;
}
else if (lpObj->pChaosBox[n].m_Type == ITEMGET(14, 176)) { // Wing 2.5 Part
WingTypeResult = 1;
Wing25TypeItemCount++;
}
else if (lpObj->pChaosBox[n].m_Type == ITEMGET(14, 177)) { // Wing 2.5 Part
WingTypeResult = 2;
Wing25TypeItemCount++;
}
else if (lpObj->pChaosBox[n].m_Type == ITEMGET(14, 178)) { // Wing 2.5 Part
WingTypeResult = 3;
Wing25TypeItemCount++;
}
else if (lpObj->pChaosBox[n].m_Type == ITEMGET(14, 179)) { // Wing 2.5 Part
WingTypeResult = 4;
Wing25TypeItemCount++;
}
}
}
PMSG_CHAOSMIXRESULT pMsg;
PHeadSetB((LPBYTE)&pMsg.h, 0x86, sizeof(PMSG_CHAOSMIXRESULT));
pMsg.Result = CB_ERROR;
if (WingCount != 1 || JewelOfCreationCount != 1 || ChaosGemCount != 1 || Wing25TypeItemCount != 1) {
lpObj->ChaosLock = FALSE;
pMsg.Result = CB_INCORRECT_MIX_ITEMS;
DataSend(lpObj->m_Index, (BYTE *)&pMsg, pMsg.h.size);
return FALSE;
}
int nChaosNeedMoney = 3000000;
int iChaosTaxMoney = (int)((__int64)nChaosNeedMoney * (__int64)g_CastleSiegeSync.GetTaxRateChaos(lpObj->m_Index) / (__int64)100);
if (iChaosTaxMoney < 0) { iChaosTaxMoney = 0; }
nChaosNeedMoney += iChaosTaxMoney;
if (nChaosNeedMoney < 0) {
nChaosNeedMoney = 0;
}
if (lpObj->Money < nChaosNeedMoney) {
pMsg.Result = CB_NOT_ENOUGH_ZEN;
DataSend(lpObj->m_Index, (BYTE *)&pMsg, pMsg.h.size);
lpObj->ChaosLock = FALSE;
return TRUE;
}
lpObj->ChaosSuccessRate = ((DWORD)((DWORD)iWingChaosMoney / (DWORD)4000000)) & 255;
if (iChaosMoney > 0) {
lpObj->ChaosSuccessRate = (lpObj->ChaosSuccessRate + (iChaosMoney / 2800000)) & 255;
}
if (iChaosMoney < 0) {
lpObj->ChaosSuccessRate = (lpObj->ChaosSuccessRate + (-1 * iChaosMoney / 2800000)) & 255;
}
LogChaosItem(lpObj, "WingMix,2.5");
CHAOS_LOG.Output("[WingMix 2.5] Chaos Mix Start");
if (WingCount == 1) {
if (lpObj->ChaosSuccessRate > ReadConfig.Wing25MaxPercent) {
lpObj->ChaosSuccessRate = ReadConfig.Wing25MaxPercent;
}
if (lpObj->ChaosSuccessRate < ReadConfig.Wing25MinPercent) {
lpObj->ChaosSuccessRate = ReadConfig.Wing25MinPercent;
}
}
if (ReadConfig.IsVipExtraMixPercent == 1 && lpObj->Vip == 1) {
if (lpObj->ChaosSuccessRate + ReadConfig.VipExtraMixPercent < 100) {
lpObj->ChaosSuccessRate += ReadConfig.VipExtraMixPercent;
}
else {
lpObj->ChaosSuccessRate = 100;
}
CHAOS_LOG.Output(
"[CBMix][%s][%s] VIP Extra Percent brings mix up to: %d",
lpObj->AccountID, lpObj->Name,
lpObj->ChaosSuccessRate
char sbuff[1024] = { 0 };
wsprintf(sbuff, "[VIP] Extra %d percent added!", ReadConfig.VipExtraMixPercent);
GCServerMsgStringSend(sbuff, lpObj->m_Index, 1);
}
if (lpObj->ChaosSuccessRate > 100) {
lpObj->ChaosSuccessRate = 100;
}
lpObj->Money -= nChaosNeedMoney;
g_CastleSiegeSync.AddTributeMoney(iChaosTaxMoney);
GCMoneySend(lpObj->m_Index, lpObj->Money);
int SuccessRateRandom = 0;
SuccessRateRandom = (rand() % 100);
if (SuccessRateRandom < lpObj->ChaosSuccessRate) {
int iWingLevel = 0;
int iItemType = 0;
int iItemSubType = 0;
if (WingTypeResult == 1) {
iItemType = 12;
iItemSubType = 246;
}
else if (WingTypeResult == 2) {
iItemType = 12;
iItemSubType = 247;
}
else if (WingTypeResult == 3) {
iItemType = 12;
iItemSubType = 248;
}
else if (WingTypeResult == 4) {
iItemType = 12;
iItemSubType = 249;
}
int iWingNum = ITEMGET(iItemType, iItemSubType);
int iOption1 = 0;
int iOption2 = 0;
int iOption3 = 0;
//Luck
if (ReadConfig.Wing25LuckPercent > (rand() % 100)) {
iOption1 = 1;
}
//Z28 Options
if (ReadConfig.Wing25Z28Percent > (rand() % 100)) {
int z28Percent = ReadConfig.Wing25Z28Percent * 100;
iOption2 = rand() % (z28Percent + 1);
iOption2 = iOption2 / 100;
}
if (ReadConfig.Wing25Z28Percent == 0) {
int iRandomValue = rand() % 100;
int iRandomValue2 = rand() % 3;
switch (iRandomValue2) {
case 0:
if (iRandomValue < 4) {
iOption2 = 3; // +12
}
break;
case 1:
if (iRandomValue < 10) {
iOption2 = 2; // +8
}
break;
case 2:
if (iRandomValue < 20) {
iOption2 = 1; // +4;
}
break;
}
}
//Exc Options
if ((rand() % 100) < ReadConfig.Wing25ExcOptionProbability) {
iOption3 = BoxExcOptions(ReadConfig.Wing25MaxExcOption);
}
::ItemSerialCreateSend(lpObj->m_Index, -1, 0, 0, iWingNum, iWingLevel, 0, 0, iOption1, iOption2, -1, iOption3, 0);
CHAOS_LOG.Output("[WingMix 2.5] [%s][%s] CBMix Success %d/%d Money : %d-%d (%d,%d)",
lpObj->AccountID, lpObj->Name,
lpObj->ChaosSuccessRate, SuccessRateRandom,
lpObj->Money, nChaosNeedMoney,
iChaosMoney, iWingChaosMoney);
::gObjInventoryCommit(lpObj->m_Index);
MuItemShop.EarnGoblinPointsCBMix(lpObj->m_Index, lpObj->ChaosSuccessRate, 0);
lpObj->ChaosLock = FALSE;
return TRUE;
}
else {
for (int n = 0; n < CHAOS_BOX_SIZE; n++) {
lpObj->pChaosBox[n].Clear();
}
GCUserChaosBoxSend(lpObj, 0);
DataSend(lpObj->m_Index, (BYTE *)&pMsg, pMsg.h.size);
CHAOS_LOG.Output("[WingMix 2.5] [%s][%s] CBMix Fail %d/%d Money : %d-%d (%d,%d)",
lpObj->AccountID, lpObj->Name,
lpObj->ChaosSuccessRate, SuccessRateRandom,
lpObj->Money, nChaosNeedMoney,
iChaosMoney, iWingChaosMoney);
::gObjInventoryCommit(lpObj->m_Index);
MuItemShop.EarnGoblinPointsCBMix(lpObj->m_Index, lpObj->ChaosSuccessRate, 1);
lpObj->ChaosLock = FALSE;
return FALSE;
}
}
Chaosbox.h đã thêm
CHAOS_MIX_WING_25 = 56,
BOOL Wing25ChaosMix(LPOBJ lpObj);
ReadConfig.h
BYTE Wing25MinPercent; BYTE Wing25MaxPercent;
BYTE Wing25LuckPercent;
BYTE Wing25Z28Percent;
BYTE Wing25Z28Max;
BYTE Wing25ExcOptionProbability;
BYTE Wing25MaxExcOption;