// -------------------------------------------------------------------------------------------------------------------------------------------------- void CGoldenArcher::PlayerDeleteQuestItem(int iIndex) { int count = 0; // ---- if ( gObjIsConnected(iIndex) == FALSE ) { return; } // ---- for ( int x=0; x<MAIN_INVENTORY_SIZE; x++) { if ( gObj[iIndex].pInventory[x].IsItem() == TRUE ) { if ( gObj[iIndex].pInventory[x].m_Type == 0x1C15 && gObj[iIndex].pInventory[x].m_Level == 0 ) { gObjInventoryItemSet(iIndex, x, -1); gObjInventoryDeleteItem(iIndex, x); GCInventoryItemDeleteSend(iIndex, x, TRUE); count++; if(count == count) break; } } } }
void cLuckyPenny::Exchange(int aIndex,BYTE Count) { if(OBJMAX_RANGE(aIndex) == 0) { return; } if(this->Enabled == TRUE) { if ( gObj[aIndex].m_IfState.type != 97 ) { ANTI_HACK_LOG.Output("[ANTI-HACK][Coins][Exchange] User in map(%d) [%s][%s] State(u:%d,t:%d,s:%d)", gObj[aIndex].MapNumber, gObj[aIndex].AccountID, gObj[aIndex].Name, gObj[aIndex].m_IfState.use,gObj[aIndex].m_IfState.type,gObj[aIndex].m_IfState.state); return; } if(Count != 10 && Count != 20 && Count != 30) return; int pos = gObjCheckItemPosByDur(aIndex,ITEMGET(14,100),Count); if(pos >= 0) { if ( ReadConfig.MAIN_INVENTORY_RANGE(aIndex,pos,false) != FALSE ) { if(this->GetReward(aIndex,Count) == true) { gObj[aIndex].pInventory[pos].m_Durability -= Count; if(gObj[aIndex].pInventory[pos].m_Durability <= 0) { gObjInventoryItemSet(aIndex, pos, -1); gObj[aIndex].pInventory[pos].Clear(); GCInventoryItemDeleteSend(aIndex, pos, 1); }else { GCItemDurSend(aIndex, pos, gObj[aIndex].pInventory[pos].m_Durability, 0); } LogAddTD("[LuckyPenny] [%s][%s][%d] LuckyPenny Item Buy Exchange Success", gObj[aIndex].AccountID, gObj[aIndex].Name,Count); }else { LogAddTD("[LuckyPenny] [%s][%s] LuckyPenny Item Buy Exchange Failed : No Room to Get Item", gObj[aIndex].AccountID, gObj[aIndex].Name); GCServerMsgStringSend("No Room in Inventory to Get Item!!",aIndex, 1); } } }else { char LackPacket[5] = {0xC1,0x05,0xBF,0x0C,0x00}; DataSend(aIndex ,(UCHAR*)LackPacket, sizeof(LackPacket)); } } }
void cOffExp::UseMana(int aIndex) { LPOBJ lpObj = &gObj[aIndex]; if(lpObj->Mana > 100) return; int pos; pos = gObjGetManaItemPos(aIndex); if(pos == -1) return; if( lpObj->pInventory[pos].m_Type == ITEMGET(14,4) || lpObj->pInventory[pos].m_Type == ITEMGET(14,5) || lpObj->pInventory[pos].m_Type == ITEMGET(14,6) ) { int tMana = (lpObj->pInventory[pos].m_Value*10) - (gObj[aIndex].Level); if ( tMana < 0 ) { tMana=0; } switch ( lpObj->pInventory[pos].m_Type ) { case ITEMGET(14,4): tMana += ((int)(gObj[aIndex].MaxMana + gObj[aIndex].AddMana))*20/100; break; case ITEMGET(14,5): tMana += ((int)(gObj[aIndex].MaxMana + gObj[aIndex].AddMana))*30/100; break; case ITEMGET(14,6): tMana += ((int)(gObj[aIndex].MaxMana + gObj[aIndex].AddMana))*40/100; break; } gObj[aIndex].Mana += tMana; if ( gObj[aIndex].Mana > (gObj[aIndex].MaxMana+gObj[aIndex].AddMana-1.0f) ) { gObj[aIndex].Mana = gObj[aIndex].MaxMana+gObj[aIndex].AddMana; } GCManaSend(aIndex, (int)gObj[aIndex].Mana, 0xFF, 0, (int)gObj[aIndex].BP); if ( !gObjSearchItemMinus(&gObj[aIndex], pos, 1) ) { gObjInventoryItemSet(aIndex, pos, -1); gObj[aIndex].pInventory[pos].Clear(); GCInventoryItemDeleteSend(aIndex, pos, 1); } } }
void cLuckyPenny::RegisterSend(int aIndex) { if(OBJMAX_RANGE(aIndex) == 0) { return; } if(this->Enabled == TRUE) { if ( gObj[aIndex].m_IfState.type != 97 ) { ANTI_HACK_LOG.Output("[ANTI-HACK][Coins][Register] User in map(%d) [%s][%s] State(u:%d,t:%d,s:%d)", gObj[aIndex].MapNumber, gObj[aIndex].AccountID, gObj[aIndex].Name, gObj[aIndex].m_IfState.use,gObj[aIndex].m_IfState.type,gObj[aIndex].m_IfState.state); return; } int pos = gObjCheckItemPos(aIndex,ITEMGET(14,100)); if(pos >= 0) { if ( ReadConfig.MAIN_INVENTORY_RANGE(aIndex,pos,false) != FALSE ) { gObj[aIndex].pInventory[pos].m_Durability -= 1; gObj[aIndex].LuckyCoins++; PMSG_LUCKYCOINSCOUNT result; PHeadSubSetB((LPBYTE)&result, 0xBF, 0x0B, sizeof(result)); result.Count = gObj[aIndex].LuckyCoins; DataSend(gObj[aIndex].m_Index,(BYTE*)&result,sizeof(result)); if(gObj[aIndex].pInventory[pos].m_Durability <= 0) { gObjInventoryItemSet(aIndex, pos, -1); gObj[aIndex].pInventory[pos].Clear(); GCInventoryItemDeleteSend(aIndex, pos, 1); }else { GCItemDurSend(aIndex, pos, gObj[aIndex].pInventory[pos].m_Durability, 0); } char RegisterButton[4] = {0xC1,0x04,0xBF,0x0C}; DataSend(aIndex ,(UCHAR*)RegisterButton, sizeof(RegisterButton)); gObj[aIndex].AccountExtraInfoModified = 1; } }else { char LackPacket[5] = {0xC1,0x05,0xBF,0x0C,0x00}; DataSend(aIndex ,(UCHAR*)LackPacket, sizeof(LackPacket)); } } }
bool CustomJewels::Apply(LPOBJ lpObj, int source, int target) { char sbuf[1024]={0}; int TIndex = lpObj->pInventory[target].m_Type; int SIndex = lpObj->pInventory[source].m_Type; if(source < 0 || source > ReadConfig.MAIN_INVENTORY_SIZE(lpObj->m_Index,false)-1 ) { return false; } if(target < 0 || target > ReadConfig.MAIN_INVENTORY_SIZE(lpObj->m_Index,false)-1 ) { return false; } if(lpObj->pInventory[source].IsItem() == 0) { return false; } if(lpObj->pInventory[target].IsItem() == 0) { return false; } if (lpObj->pInventory[target].m_Type >= ITEMGET(12,0)) { GCServerMsgStringSend("Can not aply this jewel to this item!",lpObj->m_Index, 0x01); return false; } if (!gObjJewelUpHackCheck(lpObj,target)) { GCServerMsgStringSend("[Anti-Hack] Shadow Bug Attempt!",lpObj->m_Index, 0x01); if(ReadConfig.AHLog == TRUE) { ANTI_HACK_LOG.Output("[Anti-Hack][Custom Jewel][%s][%s] Shadow Bug Attempt, Item: %d", lpObj->AccountID,lpObj->Name,lpObj->pInventory[target].m_Type); } return false; } BYTE jPos = IsJewel(SIndex); BYTE jSuccess = GetSuccessPosition(SIndex); BYTE jFail = GetFailPosition(SIndex); if(jPos == -1) { LogAddTD("[CJewel] Could not find jewel property with id: %d", SIndex); GCServerMsgStringSend("JEWEL ERROR, contact GM!",lpObj->m_Index, 0x01); return false; } if(jSuccess == -1) { LogAddTD("[CJewel] Could not find jewel success with id: %d", SIndex); GCServerMsgStringSend("JEWEL ERROR, contact GM!",lpObj->m_Index, 0x01); return false; } if(jFail == -1) { LogAddTD("[CJewel] Could not find jewel fail with id: %d", SIndex); GCServerMsgStringSend("JEWEL ERROR, contact GM!",lpObj->m_Index, 0x01); return false; } if(lpObj->pInventory[target].m_Level < this->Property[jPos].MinLevel) { wsprintf(sbuf,"Item level must be higher than %d!",this->Property[jPos].MinLevel); GCServerMsgStringSend(sbuf,lpObj->m_Index, 0x01); return false; } if(lpObj->pInventory[target].m_Level > this->Property[jPos].MaxLevel) { wsprintf(sbuf,"Item level must be lower than %d!",this->Property[jPos].MaxLevel); GCServerMsgStringSend(sbuf,lpObj->m_Index, 0x01); return false; } if(lpObj->pInventory[target].m_Z28Option < this->Property[jPos].MinZ28Option) { wsprintf(sbuf,"Item JOL option minimum is +%d",(this->Property[jPos].MinZ28Option*4)); GCServerMsgStringSend(sbuf,lpObj->m_Index, 0x01); return false; } if(this->Property[jPos].hasToHaveLuck == -1) { if (lpObj->pInventory[target].m_LuckOption != 0) { GCServerMsgStringSend("Item can not have Luck!",lpObj->m_Index, 0x01); return false; } } if(this->Property[jPos].hasToHaveLuck > 0) { if (lpObj->pInventory[target].m_LuckOption == 0) { GCServerMsgStringSend("Item has to have Luck!",lpObj->m_Index, 0x01); return false; } } if(this->Property[jPos].hasToHaveSkill == -1) { if (lpObj->pInventory[target].m_SkillOption != 0) { GCServerMsgStringSend("Item can not have Skill!",lpObj->m_Index, 0x01); return false; } } if(this->Property[jPos].hasToHaveSkill > 0) { if (lpObj->pInventory[target].m_SkillOption == 0) { GCServerMsgStringSend("Item has to have Skill!",lpObj->m_Index, 0x01); return false; } } if(this->Property[jPos].hasToBeAncient == -1) { if (lpObj->pInventory[target].m_SetOption != 0) { GCServerMsgStringSend("Item can not be Ancient!",lpObj->m_Index, 0x01); return false; } } if(this->Property[jPos].hasToBeAncient > 0) { if (lpObj->pInventory[target].m_SetOption == 0) { GCServerMsgStringSend("Item must be Ancient!",lpObj->m_Index, 0x01); return false; } } if(this->Property[jPos].hasToBeExcellent == -1) { if (lpObj->pInventory[target].m_NewOption != 0) { GCServerMsgStringSend("Item can not be Excellent!",lpObj->m_Index, 0x01); return false; } } if(this->Property[jPos].hasToBeExcellent > 0) { if (lpObj->pInventory[target].m_NewOption == 0) { GCServerMsgStringSend("Item must be Excellent!",lpObj->m_Index, 0x01); return false; } } if(this->Property[jPos].MaxExc != 0) { if(NumOfExcOptions(lpObj->pInventory[target].m_NewOption) >= this->Property[jPos].MaxExc) { wsprintf(sbuf,"Cant add jewel, you have a lot of excellent options, max opt are %d!",this->Property[jPos].MaxExc); GCServerMsgStringSend(sbuf,lpObj->m_Index, 0x01); return false; } } if(this->Property[jPos].hasToBeSoketItem == -1) { if(IsSlotItem(lpObj->pInventory[target].m_Type)==1) { GCServerMsgStringSend("Item can not be socket item!",lpObj->m_Index, 0x01); return false; } } if(this->Property[jPos].hasToBeSoketItem == 1) { if(IsSlotItem(lpObj->pInventory[target].m_Type)==0) { GCServerMsgStringSend("This item has to be socket item!",lpObj->m_Index, 0x01); return false; } else { if(this->Property[jPos].MinNumberSokets > 0) { BYTE counter = 0; if (lpObj->pInventory[target].m_ItemSlot1 > 0) counter += 1; if (lpObj->pInventory[target].m_ItemSlot2 > 0) counter += 1; if (lpObj->pInventory[target].m_ItemSlot3 > 0) counter += 1; if (lpObj->pInventory[target].m_ItemSlot4 > 0) counter += 1; if (lpObj->pInventory[target].m_ItemSlot5 > 0) counter += 1; if (this->Property[jPos].MinNumberSokets > counter) { wsprintf(sbuf,"Item minimum socket count is %d",this->Property[jPos].MinNumberSokets); GCServerMsgStringSend(sbuf,lpObj->m_Index, 0x01); return false; } } } } if(this->Property[jPos].MaxNumberSokets != 0) { BYTE counter = 0; if (lpObj->pInventory[target].m_ItemSlot1 > 0) counter += 1; if (lpObj->pInventory[target].m_ItemSlot2 > 0) counter += 1; if (lpObj->pInventory[target].m_ItemSlot3 > 0) counter += 1; if (lpObj->pInventory[target].m_ItemSlot4 > 0) counter += 1; if (lpObj->pInventory[target].m_ItemSlot5 > 0) counter += 1; if(counter >= this->Property[jPos].MaxNumberSokets) { wsprintf(sbuf,"Cant add jewel, you have a lot of socket slots, max slot are %d!",this->Property[jPos].MaxNumberSokets); GCServerMsgStringSend(sbuf,lpObj->m_Index, 0x01); return false; } } //if(MuItemShop.IsCShopItem(aIndex,target) == true) //{ // GCServerMsgStringSend("You can not use the jewel in this item!",lpObj->m_Index, 0x01); // return true; //} LogAddTD("[CJewel][%s][%s] Use %s on item %s (%d)", lpObj->AccountID,lpObj->Name,lpObj->pInventory[source].GetName(),lpObj->pInventory[target].GetName(), lpObj->pInventory[target].m_Number); int _r = rand()%100; if(_r < this->Property[jPos].Rate ) { //Success GCServerMsgStringSend("Jewel Succeded!",lpObj->m_Index, 0x01); LogAddTD("[CJewel][%s][%s] Success %s on item %s (%d) [%d][%d,%d]", lpObj->AccountID,lpObj->Name,lpObj->pInventory[source].GetName(),lpObj->pInventory[target].GetName(), lpObj->pInventory[target].m_Number, TIndex,_r,this->Property[jPos].Rate); if(this->Success[jSuccess].Luck == 1) { lpObj->pInventory[target].m_LuckOption = 1; } if(this->Success[jSuccess].Skill == 1) { lpObj->pInventory[target].m_SkillOption = 1; } if(this->Success[jSuccess].SetItem == 1) { lpObj->pInventory[target].m_SetOption = gSetItemOption.GenSetOption(lpObj->pInventory[target].m_Type); } if(this->Success[jSuccess].Excellent != 63) { if(this->Success[jSuccess].Excellent > 0) { lpObj->pInventory[target].m_NewOption |= this->Success[jSuccess].Excellent; } }else { lpObj->pInventory[target].m_NewOption = 63; } if(this->Success[jSuccess].Level > 0) { if((lpObj->pInventory[target].m_Level + this->Success[jSuccess].Level) > MAX_ITEM_LEVEL) { lpObj->pInventory[target].m_Level = MAX_ITEM_LEVEL; }else { lpObj->pInventory[target].m_Level += this->Success[jSuccess].Level; } } if(this->Success[jSuccess].Sokets > 0) { if ( IsSlotItem(lpObj->pInventory[target].m_Type) ) { for(int k=0;k<this->Success[jSuccess].Sokets;k++) { if (lpObj->pInventory[target].m_ItemSlot1 == 0) lpObj->pInventory[target].m_ItemSlot1 = 0xFF; else if (lpObj->pInventory[target].m_ItemSlot2 == 0) lpObj->pInventory[target].m_ItemSlot2 = 0xFF; else if (lpObj->pInventory[target].m_ItemSlot3 == 0) lpObj->pInventory[target].m_ItemSlot3 = 0xFF; else if (lpObj->pInventory[target].m_ItemSlot4 == 0) lpObj->pInventory[target].m_ItemSlot4 = 0xFF; else if (lpObj->pInventory[target].m_ItemSlot5 == 0) lpObj->pInventory[target].m_ItemSlot5 = 0xFF; } } } if(this->Success[jSuccess].Option > 0) { if((lpObj->pInventory[target].m_Z28Option + this->Success[jSuccess].Option) > 7) { lpObj->pInventory[target].m_Z28Option = 7; }else { lpObj->pInventory[target].m_Z28Option += this->Success[jSuccess].Option; } } } else { //Fail GCServerMsgStringSend("Jewel Failed!",lpObj->m_Index, 0x01); LogAddTD("[CJewel][%s][%s] Fail %s on item %s (%d) [%d][%d,%d]", lpObj->AccountID,lpObj->Name,lpObj->pInventory[source].GetName(),lpObj->pInventory[target].GetName(), lpObj->pInventory[target].m_Number, TIndex,_r,this->Property[jPos].Rate); if(this->Fail[jFail].Destroy == 1) { gObjInventoryItemSet(lpObj->m_Index, target, -1); lpObj->pInventory[target].Clear(); GCInventoryItemDeleteSend(lpObj->m_Index, target, 1); return true; } if(this->Fail[jFail].Luck == -1) { lpObj->pInventory[target].m_LuckOption = 0; } if(this->Fail[jFail].Skill == -1) { lpObj->pInventory[target].m_SkillOption = 0; } if(this->Fail[jFail].SetItem == -1) { lpObj->pInventory[target].m_SetOption = 0; } if(this->Fail[jFail].Excellent < 0) { if(this->Fail[jFail].Excellent == -63) lpObj->pInventory[target].m_NewOption = 0; else if( (lpObj->pInventory[target].m_NewOption&(this->Fail[jFail].Excellent)) ) lpObj->pInventory[target].m_NewOption += (this->Fail[jFail].Excellent); if(lpObj->pInventory[target].m_NewOption < 0) lpObj->pInventory[target].m_NewOption = 0; } if(this->Fail[jFail].Level < 0) { if((lpObj->pInventory[target].m_Level + (this->Fail[jFail].Level)) < 0) { lpObj->pInventory[target].m_Level = 0; }else { lpObj->pInventory[target].m_Level += (this->Fail[jFail].Level); } } if(this->Fail[jFail].Sokets < 0) { if ( IsSlotItem(lpObj->pInventory[target].m_Type) ) { for(int k=0;k<(this->Fail[jFail].Sokets);k++) { if (lpObj->pInventory[target].m_ItemSlot5 > 0) lpObj->pInventory[target].m_ItemSlot5 = 0x00; else if (lpObj->pInventory[target].m_ItemSlot4 > 0) lpObj->pInventory[target].m_ItemSlot4 = 0x00; else if (lpObj->pInventory[target].m_ItemSlot3 > 0) lpObj->pInventory[target].m_ItemSlot3 = 0x00; else if (lpObj->pInventory[target].m_ItemSlot2 > 0) lpObj->pInventory[target].m_ItemSlot2 = 0x00; else if (lpObj->pInventory[target].m_ItemSlot1 > 0) lpObj->pInventory[target].m_ItemSlot1 = 0x00; } } } if(this->Fail[jFail].Option < 0) { if((lpObj->pInventory[target].m_Z28Option + (this->Fail[jFail].Option)) < 0) { lpObj->pInventory[target].m_Z28Option = 0; }else { lpObj->pInventory[target].m_Z28Option += (this->Fail[jFail].Option); } } } float levelitemdur = ItemGetDurability(lpObj->pInventory[target].m_Type,lpObj->pInventory[target].m_Level,lpObj->pInventory[target].IsExtItem(),lpObj->pInventory[target].IsSetItem()); lpObj->pInventory[target].m_Durability = levelitemdur * lpObj->pInventory[target].m_Durability / lpObj->pInventory[target].m_BaseDurability; lpObj->pInventory[target].Convert( lpObj->pInventory[target].m_Type, lpObj->pInventory[target].m_SkillOption, lpObj->pInventory[target].m_LuckOption, lpObj->pInventory[target].m_Z28Option, lpObj->pInventory[target].m_NewOption, lpObj->pInventory[target].m_SetOption, lpObj->pInventory[target].m_ItemOptionEx, CURRENT_DB_VERSION); if(g_kJewelOfHarmonySystem.IsStrengthenByJewelOfHarmony(&lpObj->pInventory[target])== 1) { if(g_kJewelOfHarmonySystem.IsActive(&lpObj->pInventory[target]) == 0) { GCServerMsgStringSend(lMsg.Get(3370),lpObj->m_Index,1); } } return true; }
BOOL CJewelMixSystem::UnMixJewel(int iIndex, int iJewelType, int iJewelLevel, int iInventoryPos) { if ( !gObjIsConnected(iIndex)) return FALSE; if ( gObjCheckInventorySerial0Item(&gObj[iIndex])) { MsgOutput(iIndex, lMsg.Get(MSGGET(13,26))); GCAnsJewelUnMix(iIndex, 0); LogAddTD("[ANTI-HACK][Serial 0 Item] [UnMix Jewel] (%s)(%s)", gObj[iIndex].AccountID, gObj[iIndex].Name); return FALSE; } if ( gObj[iIndex].m_IfState.type == 1 ) { LogAddTD("[JewelMix] [%s][%s] Attempted ItemCopy using Trade Window", gObj[iIndex].AccountID, gObj[iIndex].Name); return FALSE; } if ( gObj[iIndex].ChaosLock == TRUE ) { LogAddTD("[JewelMix] [%s][%s] Chaos Mix is already working", gObj[iIndex].AccountID, gObj[iIndex].Name); GCAnsJewelUnMix(iIndex, 0); return FALSE; } gObj[iIndex].ChaosLock = TRUE; if ( !CHECK_LIMIT(iJewelType, 10) ) { LogAddTD("[JewelMix] [%s][%s] UnMix iJewelType is out of bound : %d", gObj[iIndex].AccountID, gObj[iIndex].Name, iJewelType); gObj[iIndex].ChaosLock = FALSE; GCAnsJewelUnMix(iIndex, 2); return FALSE; } if ( !CHECK_LIMIT(iInventoryPos, MAIN_INVENTORY_SIZE)) { LogAddTD("[JewelMix] [%s][%s] iInventoryPos is out of bound : %d", gObj[iIndex].AccountID, gObj[iIndex].Name, iInventoryPos); gObj[iIndex].ChaosLock = FALSE; GCAnsJewelUnMix(iIndex, 5); return FALSE; } int iInventoryItemType; int iInventoryItemLevel; if ( gObj[iIndex].pInventory[iInventoryPos].IsItem() == TRUE ) { if ( gObj[iIndex].pInventory[iInventoryPos].m_Level == iJewelLevel ) { iInventoryItemType = gObj[iIndex].pInventory[iInventoryPos].m_Type; iInventoryItemLevel = gObj[iIndex].pInventory[iInventoryPos].m_Level; } else { LogAddTD("[JewelMix] [%s][%s] iJewelLevel is different from request : %d / %d", gObj[iIndex].AccountID, gObj[iIndex].Name, gObj[iIndex].pInventory[iInventoryPos].m_Level, iJewelLevel); gObj[iIndex].ChaosLock = FALSE; GCAnsJewelUnMix(iIndex, 3); return FALSE; } } else { LogAddTD("[JewelMix] [%s][%s] Item to unmix is not exist", gObj[iIndex].AccountID, gObj[iIndex].Name); gObj[iIndex].ChaosLock = FALSE; GCAnsJewelUnMix(iIndex, 4); return FALSE; } if ( !CHECK_LIMIT(iInventoryItemLevel, 3)) { LogAddTD("[JewelMix] [%s][%s] iInventoryItemLevel is out of bound : %d", gObj[iIndex].AccountID, gObj[iIndex].Name, iInventoryItemLevel); gObj[iIndex].ChaosLock = FALSE; GCAnsJewelUnMix(iIndex, 3); return FALSE; } int iItemType = g_JewelMixInfo[iJewelType][iInventoryItemLevel].m_iChangeType; int iJewelCount = g_JewelMixInfo[iJewelType][iInventoryItemLevel].m_iJewelCount; int iChangeType = g_JewelMixInfo[iJewelType][iInventoryItemLevel].m_iSourceType; int iMixMoney = 1000000; if ( iInventoryItemType != iItemType ) { LogAddTD("[JewelMix] [%s][%s] iItemType is different from request : %d / %d", gObj[iIndex].AccountID, gObj[iIndex].Name, iInventoryItemType, iItemType); gObj[iIndex].ChaosLock = FALSE; GCAnsJewelUnMix(iIndex, 6); return FALSE; } if ( iMixMoney > gObj[iIndex].Money ) { LogAddTD("[JewelMix] [%s][%s] lack of money to unmix : %d / %d", gObj[iIndex].AccountID, gObj[iIndex].Name, gObj[iIndex].Money, iMixMoney); gObj[iIndex].ChaosLock = FALSE; GCAnsJewelUnMix(iIndex, 8); return FALSE; } int invSize = INVENTORY_MAP_SIZE-PSHOP_MAP_SIZE; if( gObj[iIndex].pInventoryExtend <= 4 ) { invSize = (INVENTORY_MAP_SIZE-PSHOP_MAP_SIZE)-(32*(4-gObj[iIndex].pInventoryExtend)); } int iEmptyCount = 0; int x; for ( x=0;x<invSize;x++) { if ( gObj[iIndex].pInventoryMap[x] == 0xFF ) { iEmptyCount++; } } if ( iEmptyCount < iJewelCount ) { LogAddTD("[JewelMix] [%s][%s] lack of empty slot to unmix : %d / %d", gObj[iIndex].AccountID, gObj[iIndex].Name, iEmptyCount, iJewelCount); gObj[iIndex].ChaosLock = FALSE; GCAnsJewelUnMix(iIndex, 7); return FALSE; } LogAddTD("[JewelMix] [%s][%s] UnMix - Delete Jewel, Type:%d, Level:%d, Serial:%d", gObj[iIndex].AccountID, gObj[iIndex].Name, gObj[iIndex].pInventory[iInventoryPos].m_Type, gObj[iIndex].pInventory[iInventoryPos].m_Level, gObj[iIndex].pInventory[iInventoryPos].m_Number); gObjInventoryItemSet(iIndex, iInventoryPos, 0xFF); gObjInventoryDeleteItem(iIndex, iInventoryPos); GCInventoryItemDeleteSend(iIndex, iInventoryPos, 1); int iCrtJewelCount = 0; BOOL bItemCrtOK = FALSE; for ( x=0;x<invSize;x++) { if ( gObj[iIndex].pInventoryMap[x] == 0xFF ) { ItemSerialCreateSend(iIndex, 235, gObj[iIndex].X, gObj[iIndex].Y, iChangeType, 0, 0, 0, 0, 0, iIndex, 0, 0); iCrtJewelCount++; if ( iJewelCount <= iCrtJewelCount ) { bItemCrtOK = TRUE; break; } } } gObj[iIndex].ChaosLock = FALSE; if ( bItemCrtOK == TRUE ) { LogAddTD("[JewelMix] [%s][%s] jewel unmix succeed : ItemType:%d, JewelCount:%d", gObj[iIndex].AccountID, gObj[iIndex].Name, iItemType, iJewelCount); gObj[iIndex].Money -= iMixMoney; GCMoneySend(iIndex, gObj[iIndex].Money); GCAnsJewelUnMix(iIndex, 1); } else { LogAddTD("[JewelMix] [%s][%s] jewel unmix failed : ItemType:%d, JewelCount:%d", gObj[iIndex].AccountID, gObj[iIndex].Name, iItemType, iJewelCount); GCAnsJewelUnMix(iIndex, 0); } return TRUE; }
BOOL CJewelMixSystem::MixJewel( int iIndex, int iJewelType, int iMixType) { if ( !gObjIsConnected(iIndex)) return FALSE; if ( gObjCheckInventorySerial0Item(&gObj[iIndex])) { MsgOutput(iIndex, lMsg.Get(MSGGET(13,26))); GCAnsJewelMix(iIndex, 4); LogAddTD("[ANTI-HACK][Serial 0 Item] [Mix Jewel] (%s)(%s)", gObj[iIndex].AccountID, gObj[iIndex].Name); return FALSE; } if ( gObj[iIndex].m_IfState.type == 1 ) { LogAddTD("[JewelMix] [%s][%s] Attempted ItemCopy using Trade Window", gObj[iIndex].AccountID, gObj[iIndex].Name); return FALSE; } if ( gObj[iIndex].ChaosLock == TRUE ) { LogAddTD("[JewelMix] [%s][%s] Chaos Mix is already working", gObj[iIndex].AccountID, gObj[iIndex].Name); GCAnsJewelMix(iIndex, 0); return FALSE; } gObj[iIndex].ChaosLock = TRUE; if ( !CHECK_LIMIT(iJewelType, 10) ) { LogAddTD("[JewelMix] [%s][%s] Mix iJewelType is out of bound : %d", gObj[iIndex].AccountID, gObj[iIndex].Name, iJewelType); gObj[iIndex].ChaosLock = FALSE; GCAnsJewelMix(iIndex, 2); return FALSE; } if ( !CHECK_LIMIT(iMixType, 3)) { LogAddTD("[JewelMix] [%s][%s] iMixType is out of bound : %d", gObj[iIndex].AccountID, gObj[iIndex].Name, iMixType); gObj[iIndex].ChaosLock = FALSE; GCAnsJewelMix(iIndex, 3); return FALSE; } int iItemType = g_JewelMixInfo[iJewelType][iMixType].m_iSourceType; int iJewelCount = g_JewelMixInfo[iJewelType][iMixType].m_iJewelCount; int iMixMoney = g_JewelMixInfo[iJewelType][iMixType].m_iMixMoney; int iChangeType = g_JewelMixInfo[iJewelType][iMixType].m_iChangeType; if ( iJewelCount <= 0 ) { gObj[iIndex].ChaosLock = FALSE; GCAnsJewelMix(iIndex, 0); return FALSE; } int iUserJewelCount = gObjGetItemCountInIventory(iIndex, iItemType); if ( iJewelCount > iUserJewelCount ) { LogAddTD("[JewelMix] [%s][%s] lack of jewel to mix : %d / %d", gObj[iIndex].AccountID, gObj[iIndex].Name, iUserJewelCount, iJewelCount); gObj[iIndex].ChaosLock = FALSE; GCAnsJewelMix(iIndex, 4); return FALSE; } if ( iMixMoney > gObj[iIndex].Money ) { LogAddTD("[JewelMix] [%s][%s] lack of money to mix : %d / %d", gObj[iIndex].AccountID, gObj[iIndex].Name, gObj[iIndex].Money, iMixMoney); gObj[iIndex].ChaosLock = FALSE; GCAnsJewelMix(iIndex, 5); return FALSE; } int iDelJewelCount = 0; BOOL bItemDelOK = FALSE; int invSize = MAIN_INVENTORY_SIZE; if( gObj[iIndex].pInventoryExtend <= 4 ) { invSize = (MAIN_INVENTORY_SIZE)-(32*(4-gObj[iIndex].pInventoryExtend)); } for ( int x= INVETORY_WEAR_SIZE ; x< invSize; x++) { if ( gObj[iIndex].pInventory[x].IsItem() == TRUE ) { if ( gObj[iIndex].pInventory[x].m_Type == iItemType ) { LogAddTD("[JewelMix] [%s][%s] Mix - Delete Jewel, Type:%d, Level:%d, Serial:%d", gObj[iIndex].AccountID, gObj[iIndex].Name, gObj[iIndex].pInventory[x].m_Type, gObj[iIndex].pInventory[x].m_Level, gObj[iIndex].pInventory[x].m_Number); gObjInventoryItemSet(iIndex, x, 0xFF); gObj[iIndex].pInventory[x].Clear(); iDelJewelCount++; if ( iJewelCount <= iDelJewelCount ) { bItemDelOK = TRUE; break; } } } } GCItemListSend(iIndex); if ( bItemDelOK == FALSE ) { LogAddTD("[JewelMix] [%s][%s] lack of jewel to mix (in deleting) : %d / %d", gObj[iIndex].AccountID, gObj[iIndex].Name, iDelJewelCount, iJewelCount); gObj[iIndex].ChaosLock = FALSE; GCAnsJewelMix(iIndex, 0); return FALSE; } ItemSerialCreateSend(iIndex, 235, gObj[iIndex].X, gObj[iIndex].Y, iChangeType, iMixType, 0, 0, 0, 0, iIndex, 0, 0); gObj[iIndex].ChaosLock = FALSE; gObj[iIndex].Money -= iMixMoney; GCMoneySend(iIndex, gObj[iIndex].Money); GCAnsJewelMix(iIndex, 1); LogAddTD("[JewelMix] [%s][%s] jewel mix succeed : ItemType:%d, JewelCount:%d", gObj[iIndex].AccountID, gObj[iIndex].Name, iItemType, iJewelCount); return TRUE; }