bool OfflineTrade::DeleteSoulCount(int UserIndex, int SoulCount) { LogAddTD("[OffTrade][DeBug] SoulCount: %d",SoulCount); if( !OBJMAX_RANGE(UserIndex) ) { return false; } // ---- if( this->GetSoulCount(UserIndex) < SoulCount ) { return false; } // ---- int DeletedItem = 0; LPOBJ lpUser = &gObj[UserIndex]; // ---- while(true) { int ItemDiff = SoulCount - DeletedItem; // ---- if( ItemDiff <= 0 ) { break; } // ---- if( ItemDiff >= 30 && this->CheckItem(UserIndex, ITEMGET(12, 31), 2) != -1 ) { int ItemPos = this->CheckItem(UserIndex, ITEMGET(12, 31), 2); gObjInventoryDeleteItem(lpUser->m_Index, ItemPos); GCInventoryItemDeleteSend(lpUser->m_Index, ItemPos, 1); DeletedItem += 30; } else if( ItemDiff >= 20 && this->CheckItem(UserIndex, ITEMGET(12, 31), 1) != -1 ) { int ItemPos = this->CheckItem(UserIndex, ITEMGET(12, 31), 1); gObjInventoryDeleteItem(lpUser->m_Index, ItemPos); GCInventoryItemDeleteSend(lpUser->m_Index, ItemPos, 1); DeletedItem += 20; } else if( ItemDiff >= 10 && this->CheckItem(UserIndex, ITEMGET(12, 31), 0) != -1 ) { int ItemPos = this->CheckItem(UserIndex, ITEMGET(12, 31), 0); gObjInventoryDeleteItem(lpUser->m_Index, ItemPos); GCInventoryItemDeleteSend(lpUser->m_Index, ItemPos, 1); DeletedItem += 10; } else if( this->CheckItem(UserIndex, ITEMGET(14, 14), 0) != -1 ) { int ItemPos = this->CheckItem(UserIndex, ITEMGET(14, 14), 0); gObjInventoryDeleteItem(lpUser->m_Index, ItemPos); GCInventoryItemDeleteSend(lpUser->m_Index, ItemPos, 1); DeletedItem++; } } // ---- LogAddTD("[OfflineTrade] [%s] [%s] Deleted %d Jewels Of Soul",lpUser->AccountID, lpUser->Name); // ---- return true; }
// -------------------------------------------------------------------------------------------------------------------------------------------------- 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 CIllusionTemple::NpcRegister(OBJECTSTRUCT* lpObj, PMSG_IT_REGISTER* pMsg) { if(lpObj->m_IfState.use > 0) { CLog.LogAdd("[IllusionTemple] Interface State Error (%d)(%d)(%s)", lpObj->m_IfState.use, lpObj->m_IfState.type, lpObj->Name); return; } if(lpObj->pInventory[pMsg->TicketPosition].m_Type != ITEMGET(13, 51) || lpObj->pInventory[pMsg->TicketPosition].m_Level != pMsg->TargetTemple ) { GCServerMsgStringSend("You missed Illusion Temple Ticket.", lpObj->m_Index, 1); return; } pMsg->TargetTemple--; if(IT_FLOOR_RANGE(pMsg->TargetTemple) == FALSE) { CLog.LogAdd("[IllusionTemple] Index out of range (%d)(%s)", pMsg->TargetTemple, &lpObj->Name[0]); return; } if(this->m_IllusionTemple[pMsg->TargetTemple].m_iUserCount >= 10) { GCServerMsgStringSend("[IllusionTemple] Event is already Full!", lpObj->m_Index, 1); return; } ILLUSION_OBJ obj; obj.m_Index = lpObj->m_Index; obj.m_TeamIndex = -1; obj.m_BonusCount = 0; obj.m_TempleIndex = pMsg->TargetTemple; gObjInventoryDeleteItem(lpObj->m_Index, pMsg->TicketPosition); GCInventoryItemDeleteSend(lpObj->m_Index, pMsg->TicketPosition, 1); if ( lpObj->PartyNumber >= 0 ) { PMSG_PARTYDELUSER pMsg; int iPartyIndex = gParty.GetIndex(lpObj->PartyNumber, lpObj->m_Index, lpObj->DBNumber); if ( iPartyIndex >= 0 ) { pMsg.Number = iPartyIndex; CGPartyDelUser(&pMsg, lpObj->m_Index); } } lpObj->m_IllusionIndex = pMsg->TargetTemple; gObjSetIllusionKillCount(lpObj->m_Index, KILLCOUNT_RESET, 0); gObjMoveGate(lpObj->m_Index, 142 + pMsg->TargetTemple); }
// ----------------------------------------------------------------------------------------------------------------------- void CIllusionTemple::UserStateCheck(int iTempleIndex) { if(this->m_dwUserCheckTick < GetTickCount()) { if(this->m_IllusionTemple[iTempleIndex].m_TempleState != IT_STATE_CLOSED && this->m_IllusionTemple[iTempleIndex].m_TempleState != IT_STATE_OPEN) { for(int iTeamIndex = 0; iTeamIndex < MAX_ILLUSION_TEAMS; iTeamIndex++) { for(ILLUSION_OBJIT it = this->m_IllusionTemple[iTempleIndex].m_Teams[iTeamIndex].m_Members.begin(); it != this->m_IllusionTemple[iTempleIndex].m_Teams[iTeamIndex].m_Members.end(); it++) { if(gObj[it->m_Index].MapNumber != (MAP_INDEX_ILLUSION1 + iTempleIndex) || gObjIsConnected(&gObj[it->m_Index]) == FALSE) { CLog.LogAdd("[IllusionTemple] %s UserOut (%d)", gObj[it->m_Index].Name, iTempleIndex+1); if(it->m_Index == this->m_IllusionTemple[it->m_TempleIndex].m_BallOwner) { this->m_IllusionTemple[it->m_TempleIndex].m_BallOwner = this->m_IllusionTemple[it->m_TempleIndex].m_Statues[rand()%MAX_IT_STATUES]; } if(gObjIsConnected(it->m_Index)) { for(int i = 0; i < INVENTORY_SIZE; i++) { if(gObj[it->m_Index].pInventory[i].IsItem()) { if(gObj[it->m_Index].pInventory[i].m_Type == ITEMGET(14, 64)) { gObjInventoryDeleteItem(it->m_Index, i); GCInventoryItemDeleteSend(it->m_Index, i, 1); } } } gObj[it->m_Index].m_Change = -1; gObjViewportListProtocolCreate(&gObj[it->m_Index]); } this->m_IllusionTemple[iTempleIndex].m_Teams[iTeamIndex].m_Members.erase(it); this->UserStateCheck(iTempleIndex); return; } } } } if(iTempleIndex == MAX_ILLUSION_TEMPLES-1) { this->m_dwUserCheckTick = GetTickCount() + 2000; } } }
int CHatcheryEvent::CheckTicket(int aIndex) { int iType = ITEMGET(14,47); for(int i = 12; i < 76; i++) { if(gObj[aIndex].pInventory[i].m_Type == iType && gObj[aIndex].pInventory[i].m_Level == 0) { gObjInventoryDeleteItem(aIndex,i); GCInventoryItemDeleteSend(aIndex,i,1); return true; } } return false; }
bool CIllusionTemple::SetProc_Closed(int iTempleIndex) { this->SynchronizeTemple(iTempleIndex); for(int i = OBJ_STARTUSERINDEX; i < OBJMAX; i++) { if(gObj[i].MapNumber == MAP_INDEX_ILLUSION1 + iTempleIndex) { for(int it = 0; it < INVENTORY_SIZE; it++) { if(gObj[i].pInventory[it].IsItem()) { if(gObj[i].pInventory[it].m_Type == ITEMGET(14, 64)) { gObjInventoryDeleteItem(gObj[i].m_Index, it); GCInventoryItemDeleteSend(gObj[i].m_Index, it, 1); } } } gObj[i].m_Change = -1; gObjViewportListProtocolCreate(&gObj[i]); gObj[i].m_IllusionIndex = -1; gObj[i].m_IllusionTeam = -1; gObj[i].m_IllusionKillCount = 0; gObjMoveGate(i, 257); } } this->m_IllusionTemple[iTempleIndex].m_Statues[IT_STATUE_UP] = -1; this->m_IllusionTemple[iTempleIndex].m_Statues[IT_STATUE_DOWN] = -1; this->m_IllusionTemple[iTempleIndex].m_BallOwner = -1; this->m_IllusionTemple[iTempleIndex].m_iUserCount = 0; this->m_IllusionTemple[iTempleIndex].m_Teams[IT_TEAM_RED].m_Members.clear(); this->m_IllusionTemple[iTempleIndex].m_Teams[IT_TEAM_RED].m_BallOwner = -1; this->m_IllusionTemple[iTempleIndex].m_Teams[IT_TEAM_RED].m_Score = 0; this->m_IllusionTemple[iTempleIndex].m_Teams[IT_TEAM_BLUE].m_Members.clear(); this->m_IllusionTemple[iTempleIndex].m_Teams[IT_TEAM_BLUE].m_BallOwner = -1; this->m_IllusionTemple[iTempleIndex].m_Teams[IT_TEAM_BLUE].m_Score = 0; return TRUE; }
// ----------------------------------------------------------------------------------------------------------------------- void CIllusionTemple::ProcessUserKiller(OBJECTSTRUCT* lpObj, OBJECTSTRUCT* lpTarget) { if(IT_FLOOR_RANGE(lpObj->m_IllusionIndex) == FALSE) return; if(lpObj->MapNumber != lpTarget->MapNumber) return; if(lpObj->m_IllusionTeam != lpTarget->m_IllusionTeam) { gObjSetIllusionKillCount(lpTarget->m_Index, KILLCOUNT_RESET, 0); if(lpTarget->m_Index == this->m_IllusionTemple[lpObj->m_IllusionIndex].m_BallOwner) { bool bFound = false; for(int i = 0; i < INVENTORY_SIZE; i++) { if(lpTarget->pInventory[i].IsItem()) { if(lpTarget->pInventory[i].m_Type == ITEMGET(14, 64)) { gObjInventoryDeleteItem(lpTarget->m_Index, i); GCInventoryItemDeleteSend(lpTarget->m_Index, i, 1); bFound = true; } } } if(!bFound) { CLog.LogAddC(2, "[IllusionTemple] Player killed, but ball not found in inventory! [BUG!?] (killer: %s, target: %s)", lpObj->Name, lpTarget->Name); } // Ball back to the Statue this->m_IllusionTemple[lpObj->m_IllusionIndex].m_BallOwner = this->m_IllusionTemple[lpObj->m_IllusionIndex].m_Statues[rand()%MAX_IT_STATUES]; gObjSetIllusionKillCount(lpObj->m_Index, KILLCOUNT_INCREASE, this->m_iBallKillPoint); } else { gObjSetIllusionKillCount(lpObj->m_Index, KILLCOUNT_INCREASE, this->m_iPlayerKillPoint); } } return; }
// ----------------------------------------------------------------------------------------------------------------------- bool CIllusionTemple::SetProc_End(int iTempleIndex) { PMSG_ILLUSION_STATE pMsg; C1SubHeadSet((BYTE*)&pMsg, 0xBF, 0x09, sizeof(pMsg)); pMsg.Unknow = 0; pMsg.State = 3; this->SendDataTemple(iTempleIndex, (BYTE*)&pMsg, pMsg.h.size); for(int i = OBJ_STARTUSERINDEX; i < OBJMAX; i++) { if(IT_MAP_RANGE(gObj[i].MapNumber) == TRUE) { for(int it = 0; it < INVENTORY_SIZE; it++) { if(gObj[i].pInventory[it].IsItem()) { if(gObj[i].pInventory[it].m_Type == ITEMGET(14, 64)) { gObjInventoryDeleteItem(gObj[i].m_Index, i); GCInventoryItemDeleteSend(gObj[i].m_Index, i, 1); } } } if(iTempleIndex == (gObj[i].MapNumber - MAP_INDEX_ILLUSION1)) { gObj[i].m_Change = -1; gObjViewportListProtocolCreate(&gObj[i]); gObjMoveGate(i, 142 + iTempleIndex); } } } this->UnSetTempleMonsters(iTempleIndex); // Send Items! // Give Bonus! this->m_IllusionTemple[iTempleIndex].m_TickCount = GetTickCount() + 60000; return TRUE; }
//006bbc00 bool CPeriodItemEx::RemovePeriodItemData(LPOBJ lpObj,WORD wItemCode,unsigned long dwSerial) //OK { int iInventoryPosition = 0; if( !lpObj ) return false; if( lpObj->Type != OBJ_USER || lpObj->Connected < PLAYER_LOGGED ) return false; iInventoryPosition = this->GetItemFromInventory(lpObj,wItemCode,dwSerial); if( iInventoryPosition == -1 ) return false; //auto-deleting gObjInventoryDeleteItem(lpObj->m_Index, iInventoryPosition); GCInventoryItemDeleteSend(lpObj->m_Index, iInventoryPosition, 1); gObjCalCharacter(lpObj->m_Index); // ---- this->SetDisableItemToExpire(lpObj,iInventoryPosition); return true; }
//006bbab0 bool CPeriodItemEx::RemovePeriodItemData(LPOBJ lpObj, BYTE btItemType, WORD wItemCode, unsigned long dwSerial) //OK { if( !lpObj ) return false; if( lpObj->Type != OBJ_USER || lpObj->Connected < 2 ) return false; if( btItemType == 1 ) { BUFF_EFFECT_DATE* lpBuffData = 0; lpBuffData = g_BuffEffectSlot.GetEffectDataFromItemCode(wItemCode); if( !lpBuffData ) return false; gObjRemoveBuffEffect(lpObj,lpBuffData->btIndex); } else if( btItemType == 2 ) { if( dwSerial == 0 ) return false; int iInventoryPosition = 0; iInventoryPosition = this->GetItemFromInventory(lpObj,wItemCode,dwSerial); if( iInventoryPosition == -1 ) return false; SetDisableItemToExpire(lpObj,iInventoryPosition); //auto-deleting gObjInventoryDeleteItem(lpObj->m_Index, iInventoryPosition); GCInventoryItemDeleteSend(lpObj->m_Index, iInventoryPosition, 1); gObjCalCharacter(lpObj->m_Index); // ---- if( iInventoryPosition < 12 ) { if( iInventoryPosition == 10 || iInventoryPosition == 11 ) { gObjUseSkill.SkillChangeUse(lpObj->m_Index); } // ---- gObjMakePreviewCharSet(lpObj->m_Index); PMSG_USEREQUIPMENTCHANGED pChange; PHeadSetB((LPBYTE)&pChange, 0x25, sizeof(pChange)); pChange.NumberH = SET_NUMBERH(lpObj->m_Index); pChange.NumberL = SET_NUMBERL(lpObj->m_Index); ItemByteConvert(pChange.ItemInfo, lpObj->pInventory[iInventoryPosition]); pChange.ItemInfo[1] = iInventoryPosition << 4; pChange.ItemInfo[1] |= LevelSmallConvert(lpObj->m_Index, iInventoryPosition) & 0x0F; DataSend(lpObj->m_Index, (LPBYTE)&pChange, pChange.h.size); MsgSendV2(lpObj, (LPBYTE)&pChange, pChange.h.size); } } else { return false; } ITEMDATA ItemData; ItemData.btType = btItemType; ItemData.wItemCode = wItemCode; ItemData.dwSerial = dwSerial; RequestPeriodItemDelete(lpObj,&ItemData); return true; }
// ----------------------------------------------------------------------------------------------------------------------- bool CIllusionTemple::NpcTalk(OBJECTSTRUCT* lpNpc, OBJECTSTRUCT* lpObj) { if ( (lpObj->m_IfState.use) > 0 ) { return true; } switch(lpNpc->Class) { case 385: { int templeIndex = this->GetObjTempleIndex(lpObj); if(templeIndex != -1) { if(templeIndex >= 0 && templeIndex < MAX_ILLUSION_TEMPLES) { if(!(this->m_IllusionTemple[templeIndex].m_TempleState == IT_STATE_OPEN)) { char szBuff[100] = {0}; if(this->m_IllusionTemple[templeIndex].m_TempleState == IT_STATE_CLOSED) { sprintf(&szBuff[0], "IT Event will be Opened in %d Minute(s).", (this->m_IllusionTemple[0].m_RemainTime / 60000) - 4); } else { sprintf(&szBuff[0], "IT Event is Running Now, Try again Later!", (this->m_IllusionTemple[0].m_RemainTime / 60000) - 4); } ChatTargetSend(lpNpc, &szBuff[0], lpObj->m_Index); } else { PMSG_ILLUSION_NPC pMsg; pMsg.MemberCount = this->GetUserCount(templeIndex); pMsg.State = 0; gSendProto.DataSend(lpObj->m_Index, (unsigned char*)&pMsg, pMsg.h.size); ChatTargetSend(lpNpc, "Illusion Temple Event Awaits You!", lpObj->m_Index); } } else { ChatTargetSend(lpNpc, "Sorry, You are not allowed to enter the IT Event.", lpObj->m_Index); CLog.LogAddC(2, "[IllusionTemple] Gate Index Error (%d)(%s).", templeIndex, &lpObj->Name[0]); } } else { ChatTargetSend(lpNpc, "You don't have sufficient Level to Enter IT Event.", lpObj->m_Index); } } return TRUE; case 380: { if(IT_FLOOR_RANGE(lpObj->m_IllusionIndex) && IT_MAP_RANGE(lpObj->MapNumber)) { if(this->m_IllusionTemple[lpObj->m_IllusionIndex].m_BallOwner == lpNpc->m_Index) { BYTE ItemPosition = gObjInventoryInsertItem(lpObj, 14, 64, 0); if(ItemPosition != -1) { GCInventoryItemOneSend(lpObj->m_Index, ItemPosition); this->m_IllusionTemple[lpObj->m_IllusionIndex].m_BallOwner = lpObj->m_Index; } else { GCServerMsgStringSend("You do not have space to capture the artifact!", lpObj->m_Index, 1); } // Need To be Translated By Testers "Você não tem espaço para capturar o artefato!" } else { GCServerMsgStringSend("The artifact is not in the statue!", lpObj->m_Index, 1); } // Need To be Translated By Testers "O artefato não se encontra nesta estátua!" } } return TRUE; case 383: // Blue case 384: { int iTeam = lpNpc->Class == 383 ? IT_TEAM_BLUE : IT_TEAM_RED; if(IT_FLOOR_RANGE(lpObj->m_IllusionIndex) && IT_MAP_RANGE(lpObj->MapNumber)) { bool bFound = false; for(int i = 0; i < INVENTORY_SIZE; i++) { if(lpObj->pInventory[i].IsItem()) { if(lpObj->pInventory[i].m_Type == ITEMGET(14, 64)) { gObjInventoryDeleteItem(lpObj->m_Index, i); GCInventoryItemDeleteSend(lpObj->m_Index, i, 1); bFound = true; } } } if(bFound) { this->m_IllusionTemple[lpObj->m_IllusionIndex].m_BallOwner = this->m_IllusionTemple[lpObj->m_IllusionIndex].m_Statues[rand()%MAX_IT_STATUES]; this->m_IllusionTemple[lpObj->m_IllusionIndex].m_Teams[iTeam].m_Score++; } } } return TRUE; default: 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; }
void CDoppelganger::EnterDoppelganger(int aIndex,int Invitation) { if(aIndex < (OBJMAX-OBJMAXUSER) || aIndex > (OBJMAX-1)) return; if(!gObjIsConnected(aIndex)) return; LPOBJ lpObj = &gObj[aIndex]; if(this->State != NONE) return; //Get Map Number this->EventMap += 1; if(this->EventMap > 68) this->EventMap = 65; int Gate = 264 + this->EventMap; if(this->OnlyInParty == 1 && lpObj->PartyNumber == -1){ GCServerMsgStringSend("[Doppelganger] Event only for Party.",aIndex,1); return; } this->EventLevel = lpObj->Level / 10; //Set Player who Give the Ticket as Principal Player this->Player[0] = aIndex; LogAddTD("[Doppelganger][%d] Add Player: %d %s",this->PlayersCount,lpObj->m_Index,lpObj->Name); this->PlayersCount += 1; this->PartyNumber = lpObj->PartyNumber; if(lpObj->PartyNumber != -1) { for(int i=OBJ_STARTUSERINDEX; i < OBJMAX;i++){ if(this->PlayersCount < 5 && gObjIsConnected(i)){ LPOBJ gTargetObj = &gObj[i]; if(gTargetObj->PartyNumber == lpObj->PartyNumber && gTargetObj->m_Index != aIndex && gTargetObj->PartyNumber >= 0){ this->Player[this->PlayersCount] = gTargetObj->m_Index; if(this->EventLevel < (gTargetObj->Level / 10)) this->EventLevel = gTargetObj->Level / 10; LogAddTD("[Doppelganger][%d] Add Player: %d %s",this->PlayersCount,gTargetObj->m_Index,gTargetObj->Name); gObjMoveGate(i,Gate); this->PlayersCount++; } } } } //Ticket if(lpObj->pInventory[Invitation].m_Type != ITEMGET(14,111) && (lpObj->pInventory[Invitation].m_Type != ITEMGET(13,125) || lpObj->pInventory[Invitation].m_Durability <= 0.0f)){ return; } if(lpObj->pInventory[Invitation].m_Type == ITEMGET(13,125) && lpObj->pInventory[Invitation].m_Durability >= 1.0f){ lpObj->pInventory[Invitation].m_Durability -= 1.0f; GCItemDurSend2(lpObj->m_Index, Invitation,lpObj->pInventory[Invitation].m_Durability,0); } else { //Delete Mirror gObjInventoryDeleteItem(aIndex,Invitation); GCInventoryItemDeleteSend(aIndex,Invitation,1); } gObjMoveGate(aIndex,Gate); for(int X=0; X < 5;X++){ if(this->Player[X] >= OBJ_STARTUSERINDEX){ this->ChangeMapAttr(TRUE,Doppelganger.Player[X]); //Block Map Entrance this->SendTimeInfo(17,Doppelganger.Player[X]); //Send 30 Seconds to Start } } this->dwTickCount = GetTickCount(); //Set Start Time this->State = PREPARING; LogAddTD("[Doppelganger] SetState->PREPARING"); LogAddTD("[Doppelganger] Players: %d/5, Event Map: %d, Level: %d",this->PlayersCount,this->EventMap,this->EventLevel); }