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 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 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 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)); } } }
// ----------------------------------------------------------------------------------------------------------------------- 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; }
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; }
// ----------------------------------------------------------------------------------------------------------------------------------------------------- void CPersonalShop::BuyItemPersonalShop(PMSG_REQ_BUYITEM_FROM_PSHOP * lpMsg, int aSourceIndex) { LPOBJ SrcObj = &gObj[aSourceIndex]; // ------ if( gDoPShopOpen == FALSE ) return; // ------ if( gObjIsConnected( MAKE_NUMBERW(lpMsg->NumberH, lpMsg->NumberL)) == FALSE ) { CLog.LogAddC(TColor.Red(), PShopModule, "[%s][%s] Shop Item Buy Request Failed: Seller is Offline (%d).", SrcObj->AccountID, SrcObj->Name, MAKE_NUMBERW(lpMsg->NumberH, lpMsg->NumberL)); // ------ SendPShopBuyItemResult(aSourceIndex, -1, 0, 2); return; } // ------ LPOBJ lpObj = &gObj[MAKE_NUMBERW(lpMsg->NumberH, lpMsg->NumberL)]; // ------ if( lpObj->Type != OBJ_USER ) { CLog.LogAddC(TColor.Red(), PShopModule, "[%s][%s] Shop Item Buy Request Failed: Seller isn't an Object User (%d).", SrcObj->AccountID, SrcObj->Name, MAKE_NUMBERW(lpMsg->NumberH, lpMsg->NumberL)); // ------ SendPShopBuyItemResult(aSourceIndex, -1, 0, 2); return; } // ------ if( lpObj->CloseCount >= 0 ) { CLog.LogAddC(TColor.Red(), PShopModule, "[%s][%s] Shop Item Buy Request Failed: Seller is Closing (%d).", SrcObj->AccountID, SrcObj->Name, MAKE_NUMBERW(lpMsg->NumberH, lpMsg->NumberL)); // ------ SendPShopBuyItemResult(aSourceIndex, -1, 0,2); return; } // ------ if( SrcObj->CloseCount >= 0 ) { CLog.LogAddC(TColor.Red(), PShopModule, "[%s][%s] Shop Item Buy Request Failed: Buyer is Closing (%d).", SrcObj->AccountID, SrcObj->Name, MAKE_NUMBERW(lpMsg->NumberH, lpMsg->NumberL)); // ------ SendPShopBuyItemResult(aSourceIndex, -1, 0, 2); return; } // ------ if( lpObj->m_bPShopOpen == false ) { CLog.LogAddC(TColor.Red(), PShopModule, "[%s][%s] Shop Item Buy Request Failed: [%s][%s] Didn't Open Shop.", SrcObj->AccountID, SrcObj->Name, lpObj->AccountID, lpObj->Name); // ------ SendPShopBuyItemResult(aSourceIndex, lpObj->m_Index, 0, 3); return; } // ------ char szName[MAX_ACCOUNT_LEN+1] = {0}; // ------ memcpy(szName, lpMsg->btName, sizeof(lpMsg->btName)); szName[MAX_ACCOUNT_LEN] = 0; // ------ int iITEM_LOG_TYPE; int iITEM_LOG_LEVEL; int iITEM_LOG_DUR; int iITEM_LOG_SERIAL; // ------ if( strcmp(szName, lpObj->Name) ) { CLog.LogAddC(TColor.Red(), PShopModule, "[%s][%s] Shop Item Buy Request Failed: Name Mismatch [%s]-[%s]", SrcObj->AccountID, SrcObj->Name, szName, lpObj->Name); // ------ SendPShopBuyItemResult(aSourceIndex, lpObj->m_Index, 0, 6); return; } // ------ if( (lpObj->Penalty &4) == 4 || (lpObj->Penalty &8) == 8 ) { CLog.LogAddC(TColor.Red(), PShopModule, "[%s][%s] Shop Item Buy Request Failed: [%s][%s] is in Item Block", SrcObj->AccountID, SrcObj->Name, lpObj->AccountID, lpObj->Name); // ------ SendPShopBuyItemResult(aSourceIndex, lpObj->m_Index, 0,9); return; } // ------ if( (SrcObj->Penalty &4) == 4 || (SrcObj->Penalty &8) == 8 ) { CLog.LogAddC(TColor.Red(), PShopModule, "[%s][%s] Shop Item Buy Request Failed: [%s][%s] is in Item Block", SrcObj->AccountID, SrcObj->Name, lpObj->AccountID, lpObj->Name); // ------ SendPShopBuyItemResult(aSourceIndex, lpObj->m_Index, 0,9); return; } // ------ EnterCriticalSection(&lpObj->m_critPShopTrade); // ------ if( lpObj->m_bPShopTransaction == true ) { CLog.LogAddC(TColor.Red(), PShopModule, "[%s][%s] Shop Item Buy Request Failed: [%s][%s] Already In Trade.", SrcObj->AccountID, SrcObj->Name, lpObj->AccountID, lpObj->Name); // ------ SendPShopBuyItemResult(aSourceIndex, lpObj->m_Index, 0,4); // ------ LeaveCriticalSection(&lpObj->m_critPShopTrade); } else { lpObj->m_bPShopTransaction = true; // ------ LeaveCriticalSection(&lpObj->m_critPShopTrade); // ------ if( gObjInventorySearchSerialNumber(&gObj[aSourceIndex], lpObj->Inventory1[lpMsg->btItemPos].GetNumber()) == FALSE ) { GCReFillSend(aSourceIndex, SrcObj->Life, -3, 1, SrcObj->iShield); // ------ CLog.LogAddC(TColor.Red(), PShopModule, "(Error): [%s][%s] CopyItem :: [%s](%d)", SrcObj->AccountID, SrcObj->Name, __FILE__, __LINE__); return; } // ------ if( gObjInventorySearchSerialNumber(lpObj, lpObj->Inventory1[lpMsg->btItemPos].GetNumber()) == FALSE ) { GCReFillSend(lpObj->m_Index, lpObj->Life, -3, 1, lpObj->iShield); // ------ CLog.LogAddC(TColor.Red(), PShopModule, "(Error): [%s][%s] CopyItem :: [%s](%d)", lpObj->AccountID, lpObj->Name, __FILE__, __LINE__); return; } // ------ if(gObjFixInventoryPointer(aSourceIndex) == false ) { CLog.LogAddC(TColor.Red(), PShopModule, "[Fix Inv.Ptr] False Location - [%s](%d)", __FILE__, __LINE__); } // ------ if( SrcObj->pTransaction == 1 ) { CLog.LogAddC(TColor.Red(), PShopModule, "[%s][%s] Item Buy Request Failed: Requester Transaction == 1, IF_STAT_TYPE : %d", SrcObj->AccountID, SrcObj->Name, SrcObj->m_IfState.type); return; } // ------ iITEM_LOG_TYPE = 0; iITEM_LOG_LEVEL = 0; iITEM_LOG_DUR = 0; iITEM_LOG_SERIAL = 0; // ------ __try { if( PSHOP_RANGE(lpMsg->btItemPos) == FALSE ) { SendPShopBuyItemResult(aSourceIndex, lpObj->m_Index, 0, 5); return; } // ------ if( lpObj->m_bMapSvrMoveQuit == true ) { SendPShopBuyItemResult(aSourceIndex, -1, 0, 2); return; } // ------ if( lpObj->Inventory1[lpMsg->btItemPos].IsItem() == TRUE ) { if( lpObj->Inventory1[lpMsg->btItemPos].m_iPShopValue <= 0 ) { CLog.LogAddC(TColor.Red(), PShopModule, "[%s][%s] Shop Item Buy Request Failed: [%s][%s] Didn't Choose Item Price.", SrcObj->AccountID, SrcObj->Name, lpObj->AccountID, lpObj->Name); // ------ SendPShopBuyItemResult(aSourceIndex, lpObj->m_Index, 0, 6); return; } // ------ if( SrcObj->Money < lpObj->Inventory1[lpMsg->btItemPos].m_iPShopValue ) { CLog.LogAddC(TColor.Red(), PShopModule, "[%s][%s] Shop Item Buy Request Failed: [%s][%s] Lack of Zen.", SrcObj->AccountID, SrcObj->Name, lpObj->AccountID, lpObj->Name); // ------ SendPShopBuyItemResult(aSourceIndex, lpObj->m_Index, 0, 7); return; } // ------ DWORD dwCost = lpObj->Inventory1[lpMsg->btItemPos].m_iPShopValue; // ------ if( gObjCheckMaxZen(lpObj->m_Index, dwCost) == FALSE ) { CLog.LogAddC(TColor.Red(), PShopModule, "[%s][%s] Shop Item Buy Request Failed: [%s][%s] Exceeding Zen of the Host", SrcObj->AccountID, SrcObj->Name, lpObj->AccountID, lpObj->Name); // ------ SendPShopBuyItemResult(aSourceIndex, lpObj->m_Index, 0, 8); return; } // ------ BYTE btNewItemPos = 0; btNewItemPos = gObjOnlyInventoryInsertItem(aSourceIndex, lpObj->Inventory1[lpMsg->btItemPos]); // ------ if( btNewItemPos == 0xFF ) { CLog.LogAddC(TColor.Red(), PShopModule, "[%s][%s] Shop Item Buy Request Failed: [%s][%s] No Room to Buy Item.", SrcObj->AccountID, SrcObj->Name, lpObj->AccountID, lpObj->Name); // ------ SendPShopBuyItemResult(aSourceIndex, lpObj->m_Index, 0, 8); return; } // ------ iITEM_LOG_TYPE = lpObj->Inventory1[lpMsg->btItemPos].m_Type; iITEM_LOG_LEVEL = lpObj->Inventory1[lpMsg->btItemPos].m_Level; iITEM_LOG_DUR = lpObj->Inventory1[lpMsg->btItemPos].m_Durability; iITEM_LOG_SERIAL = lpObj->Inventory1[lpMsg->btItemPos].m_Number; // ------ gObjInventoryItemSet_PShop(lpObj->m_Index, lpMsg->btItemPos, -1); // ------ lpObj->Inventory1[lpMsg->btItemPos].Clear(); GCInventoryItemDeleteSend(lpObj->m_Index, lpMsg->btItemPos, TRUE); // ------ SrcObj->Money -= dwCost; lpObj->Money += dwCost; // ------ GCMoneySend(aSourceIndex, SrcObj->Money); GCMoneySend(lpObj->m_Index, lpObj->Money); // ------ SendPShopBuyItemResult(aSourceIndex, lpObj->m_Index, btNewItemPos, 1); // ------ SendPShopSoldItemResult(lpObj->m_Index, aSourceIndex, lpMsg->btItemPos); // ------ CLog.LogAddC(TColor.Green(), PShopModule, "[%s][%s][%s] Shop Item Buy Request Succeed: [%s][%s][%s] Price = (%d), Type:(%d)[%s] Level:(%d) Dur:(%d) Serial:(%d).", SrcObj->AccountID, SrcObj->Name, SrcObj->Ip_addr, lpObj->AccountID, lpObj->Name, lpObj->Ip_addr, dwCost, iITEM_LOG_TYPE, ItemAttribute[iITEM_LOG_TYPE].Name, iITEM_LOG_LEVEL, iITEM_LOG_DUR, iITEM_LOG_SERIAL); // ------ if( PShop_CheckInventoryEmpty(lpObj->m_Index) == true ) { CLog.LogAddC(TColor.Green(), PShopModule, "[%s][%s] Sold All Items - Auto Closing Shop.", lpObj->AccountID, lpObj->Name); // ------ SendMsg.MessageOut(lpObj->m_Index, 0x01, "[PersonalShop] All items in Your Shop have been sold!"); // ------ lpObj->m_bPShopOpen = false; // ------ memset(lpObj->m_szPShopText, 0, sizeof(lpObj->m_szPShopText)); // ------ SendPShopCloseResult(lpObj->m_Index, 1); } else { lpObj->m_bPShopItemChange = true; } } } // ------ __finally { lpObj->m_bPShopTransaction = false; } } }
//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; } }
//0051d8a0 -> Checked BOOL CObjBaseAttack::DecreaseArrow(LPOBJ lpObj) { if (lpObj->Class == CLASS_ELF && lpObj->Type == OBJ_USER ) { CItem * Right = &lpObj->pInventory[0]; CItem * Left = &lpObj->pInventory[1]; if ( (Right->m_Type >= ITEMGET(4,8) && Right->m_Type <= ITEMGET(4,14)) || Right->m_Type == ITEMGET(4,16) || Right->m_Type == ITEMGET(4,18) || Right->m_Type == ITEMGET(4,19) ) { if ( Left->m_Type == ITEMGET(4,7) ) { if ( Left->m_Durability < 1.0f ) { return FALSE; } Left->m_Durability -= 1.0f; GCItemDurSend(lpObj->m_Index, 1, Left->m_Durability, 0); if ( Left->m_Durability < 1.0f ) { lpObj->pInventory[1].Clear(); GCInventoryItemDeleteSend(lpObj->m_Index, 1, 0); } } else { return FALSE; } } else if ( (Left->m_Type >= ITEMGET(4,0) && Left->m_Type <= ITEMGET(4,6) ) || Left->m_Type == ITEMGET(4,17) || Left->m_Type == ITEMGET(4,20) || Left->m_Type == ITEMGET(4,21) || Left->m_Type == ITEMGET(4,22) || Left->m_Type == ITEMGET(4,23) || Left->m_Type == ITEMGET(4,24)) //season4.6 add-on { if ( Right->m_Type == ITEMGET(4,15) ) { if ( Right->m_Durability < 1.0f ) { return FALSE; } Right->m_Durability -= 1.0f; GCItemDurSend(lpObj->m_Index, 0, Right->m_Durability, 0); if ( Right->m_Durability < 1.0f ) { lpObj->pInventory[0].Clear(); GCInventoryItemDeleteSend(lpObj->m_Index, 0, 0); } } else { return FALSE; } } } 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); }