void OfflineTrade::AddedSoul(LPOBJ lpUser, int SoulCount) { int Total = 0; // ---- for( int i = INVETORY_WEAR_SIZE; i < MAIN_INVENTORY_SIZE; i++ ) { int ItemDiff = SoulCount - Total; // ---- if( ItemDiff >= 30 && !lpUser->pInventory[i].IsItem() ) { ItemSerialCreateSend(lpUser->m_Index, 235, 0, 0, ITEMGET(12, 31), 2, 255, 0, 0, 0, -1, 0, 0); Total += 30; } else if( ItemDiff >= 20 && !lpUser->pInventory[i].IsItem()) { ItemSerialCreateSend(lpUser->m_Index, 235, 0, 0, ITEMGET(12, 31), 1, 255, 0, 0, 0, -1, 0, 0); Total += 20; } else if( ItemDiff >= 10 && !lpUser->pInventory[i].IsItem()) { ItemSerialCreateSend(lpUser->m_Index, 235, 0, 0, ITEMGET(12, 31), 0, 255, 0, 0, 0, -1, 0, 0); Total += 10; } else if( ItemDiff >= 1 && !lpUser->pInventory[i].IsItem()) { ItemSerialCreateSend(lpUser->m_Index, 235, 0, 0, ITEMGET(14, 14), 0, 255, 0, 0, 0, -1, 0, 0); Total++; } if( SoulCount == Total ) return; } // ---- }
void GameShop::RequestStorageItemUse(int aIndex, GAMESHOP_REQ_STORAGEITEMUSE * lpRequest) { #if( GAMESHOP_DEBUG == 1 ) LogAddC(2, "[DEBUG] [%s] [%s] [%s]", __FUNCTION__, &gObj[aIndex].AccountID, &gObj[aIndex].Name); #endif // ---- LPOBJ lpUser = &gObj[aIndex]; // ---- if( !gObjIsConnected(aIndex) || lpUser->Connected != PLAYER_PLAYING ) { return; } // ---- GAMESHOP_ANS_STORAGE_ITEM_USE pAnswer; PHeadSubSetB((LPBYTE)&pAnswer, 0xD2, cStorageItemUse, sizeof(pAnswer)); // ---- GAMESHOP_ITEM_DATA * lpItem = this->GetStorageItem(aIndex, lpRequest->AuthIndex, lpRequest->AuthID); // ---- if( !lpItem || !CheckInventoryEmptySpace(lpUser, lpItem->X, lpItem->Y) ) { pAnswer.Result = true; DataSend(aIndex, (LPBYTE)&pAnswer, pAnswer.h.size); LogAddC(3, "[GameShop] %d", __LINE__); return; } // ---- if( !DeleteItemInStorage(aIndex, lpRequest->AuthIndex, lpRequest->AuthID) ) { LogAddC(3, "[GameShop] %d", __LINE__); return; } // ---- if( g_BuffScript.GetBuffDataFromItemCode(lpItem->ItemID) //-> Buff && !this->IsInventoryBuff(lpItem->ItemID) ) { g_CashItemPeriodSystem.SearchAndDeleteItemPeriodEffect(lpUser, lpItem->ItemID); //fix g_CashItemPeriodSystem.GDReqPeriodItemInsert(lpUser, lpItem->ItemID, lpItem->Duration); } else if( lpItem->Duration > 0 ) //-> Period item { ItemSerialCreateSend(aIndex, 236, 0, 0, lpItem->ItemID, lpItem->Level, lpItem->Durability, lpItem->Skill, lpItem->Luck, lpItem->Option, lpItem->Duration * 60, lpItem->Excellent, 0); } else //-> Simply item { ItemSerialCreateSend(aIndex, 235, 0, 0, lpItem->ItemID, lpItem->Level, lpItem->Durability, lpItem->Skill, lpItem->Luck, lpItem->Option, aIndex, lpItem->Excellent, 0); } // ---- pAnswer.Result = false; DataSend(aIndex, (LPBYTE)&pAnswer, pAnswer.h.size); // ---- this->GDSaveUserInfo(aIndex); }
BOOL CRingMonsterHerd::MonsterHerdItemDrop(LPOBJ lpObj) { switch(lpObj->Class) { case 135: { int iIndex = gObjMonsterTopHitDamageUser(lpObj); int itemnumber = ItemGetNumberMake(Configs.WW_Group, Configs.WW_ID); ItemSerialCreateSend(lpObj->m_Index, lpObj->MapNumber, lpObj->X, lpObj->Y, itemnumber, Configs.WW_Level, Configs.WW_Dur, Configs.WW_Luck, Configs.WW_Skill, Configs.WW_Opt, iIndex, Configs.WW_Exc, Configs.WW_Anc); char szTemp[256]; wsprintf(szTemp, lMsg.Get(MSGGET(4, 181)), gObj[iIndex].Name, Configs.MapName[lpObj->MapNumber]); AllSendServerMsg( szTemp ); LogAddTD("[Ring Event] White Wizard Killed by [%s][%s], MapNumber:%d", gObj[iIndex].AccountID, gObj[iIndex].Name, gObj[iIndex].MapNumber); return TRUE; } break; case 136: case 137: { if ( (rand()%100) < 30 ) { int iIndex = gObjMonsterTopHitDamageUser(lpObj); int itemnumber = ItemGetNumberMake(13, 20); ItemSerialCreateSend(lpObj->m_Index, lpObj->MapNumber, lpObj->X, lpObj->Y, itemnumber, 0, 30, 0, 0, 0, iIndex, 0, 0); return TRUE; } if ( (rand() % Configs.RingOrcKillGiftRate) == 0 ) { int iIndex = gObjMonsterTopHitDamageUser(lpObj); this->SendEventGiftWinner(iIndex, 1); return TRUE; } MapC[lpObj->MapNumber].MoneyItemDrop(10000, (BYTE)lpObj->X, (BYTE)lpObj->Y); return TRUE; } break; default: return FALSE; break; } }
int MygEventMonsterItemDrop (BYTE * b_MonsterDataAddr,BYTE * a_gObjAddr) { WORD wMonsterLv =0; WORD wMonsterId =0; WORD Player; BYTE cMapID, cX, cY; PBYTE bDataAddr =0; bDataAddr = (PBYTE)b_MonsterDataAddr; memcpy(&Player,bDataAddr+0x73,sizeof(WORD)); memcpy(&wMonsterLv, bDataAddr+0xA0, sizeof(WORD)); memcpy(&wMonsterId, bDataAddr+0x9C, sizeof(WORD)); memcpy(&cMapID, bDataAddr+0x10D, sizeof(BYTE)); memcpy(&cX, bDataAddr+0x108, sizeof(BYTE)); memcpy(&cY, bDataAddr+0x10A, sizeof(BYTE)); DWORD dwPena = ItemGetNumberMake(13,14); //pluma //(13,14) = pluma xD DWORD dwPena2 = ItemGetNumberMake(12,31); //jewels soul DWORD dwTopHitUser = gObjMonsterTopHitDamageUser( b_MonsterDataAddr ); DWORD dwRand = rand(); WORD gMonsterID = 0x4D ; //monster Lvl 77 Metal Balrog if (wMonsterId<=gMonsterID) { if ( dwRand % 10000 >= (10000 - 60)) //60% es para probar { ItemSerialCreateSend(b_MonsterDataAddr[0], cMapID,cX,cY,dwPena ,0,255,0,0,0 ,dwTopHitUser,0,0); return 1; } } //WORD gMonsterID = 0x34 ; //monster level 52 Ice Queen if (wMonsterId>=gMonsterID) //Mayor a monsters lvl 72 dropearan soul { if ( dwRand % 10000 >= (10000 - 90)) //90% es para probar { ItemSerialCreateSend(b_MonsterDataAddr[0], cMapID,cX,cY,dwPena2 ,0,255,0,0,0 ,dwTopHitUser,0,0); return 1; } } int rValue = gEventMonsterItemDrop(b_MonsterDataAddr, a_gObjAddr); return rValue; }
void cDropEvent::dropItem(int aIndex, BYTE MapNumber, BYTE x, BYTE y, int LootIndex, s_DropEventItem&i) { // User input fix's if (i.minLvl > i.maxLvl) i.minLvl = i.maxLvl; if (i.minOpt > i.maxOpt) i.minOpt = i.maxOpt; if (i.minExc > i.maxExc) i.minExc = i.maxExc; // Drop procedure int i_item = i.iGroup * 512 + i.iId; int i_lvl = (i.minLvl == i.maxLvl) ? i.minLvl : i.minLvl + rand() % (i.maxLvl - i.minLvl + 1); int i_skill = ((rand() % 100 + 1) <= i.skill) ? 1 : 0; int i_luck = ((rand() % 100 + 1) <= i.luck) ? 1 : 0; int i_opt = (i.minOpt == i.maxOpt) ? i.minOpt : i.minOpt + rand() % (i.maxOpt - i.minOpt + 1); // Exc randomizer int i_exc = 0; if ((rand() % 100 + 1) <= i.exc) { i_exc = Util.GenExcOpt((i.minExc == i.maxExc) ? i.minExc : i.minExc + rand() % (i.maxExc - i.minExc + 1)); } // Anc randomizer int i_anc_type = (i.ancType == 5 || i.ancType == 10) ? i.ancType : 0; int i_anc = ((rand() % 100 + 1) <= i.anc) ? i_anc_type : 0; //�מ טהוט LootIndex = aIndex ItemSerialCreateSend(aIndex, MapNumber, x, y, i_item, i_lvl, i.dur, i_skill, i_luck, i_opt, LootIndex, i_exc, i_anc); }
void cTvTEvent::Reward(int aIndex) { if(!this->Enable)return; int TeamReward = 0; if(this->ScoreBlue > this->ScoreRed) TeamReward = BLUETEAM; else if(this->ScoreRed > ScoreBlue) TeamReward = REDTEAM; if(TeamReward == 0) return; if(this->Player[aIndex].Team != TeamReward) return; LPOBJ lpObj = &gObj[aIndex]; if(this->RewardExPoint > 0) { ExUser[aIndex].PCPoint += this->RewardExPoint; ExPCPointSystem.InitPCPointForPlayer(lpObj, ExUser[aIndex].PCPoint ); } if(this->RewardWCoin > 0) { GDRequestWcoinInfoLoad (lpObj,this->RewardWCoin,1); } if(this->RewardItem == 0) return; ItemSerialCreateSend(aIndex,235,lpObj->X,lpObj->Y,ITEMGET(this->ItemRewardType,this->ItemRewardIndex),(BYTE)this->ItemRewardLevel,0,0,0,0,aIndex,0,0); }
BOOL CCashShop::GiveBuyItemToInventory(LPOBJ lpObj, int iItemGuid) { BYTE btPosition = 0; BYTE btResult = 0; BOOL bEmptySpace = FALSE; CASHSHOP_ITEMLIST* lpItemInfo = NULL; CItem pItem; int iItemCode = 0; BYTE ExOption[MAX_EXOPTION_SIZE]; lpItemInfo = this->SearchItemList(iItemGuid); iItemCode = ITEMGET(lpItemInfo->btItemType, lpItemInfo->wItemIndex); bEmptySpace = this->CheckInventoryEmptySpace(lpObj, lpItemInfo); if ( bEmptySpace == FALSE ) return FALSE; pItem.Convert(iItemCode, lpItemInfo->btItemSkillOpion, lpItemInfo->btItemLuckOption, lpItemInfo->btItemAddOption, lpItemInfo->btItemExOption, 0, 0, NULL, 0xFF, TEMP_PERIOD_VAR, CURRENT_DB_VERSION); pItem.m_Level = lpItemInfo->btItemLevel; pItem.m_Durability = lpItemInfo->btItemDuration; ItemIsBufExOption(ExOption, &pItem); ItemSerialCreateSend(lpObj->m_Index, 0xEC, lpObj->X, lpObj->Y, pItem.m_Type, pItem.m_Level, pItem.m_Durability, pItem.m_Option1, pItem.m_Option2, pItem.m_Option3, lpObj->m_Index, pItem.m_NewOption, 0); LogAddTD("[CashShop][Buy Item Create in Inven] - User(ID:%s,Name:%s) Item(Name:%s,Code:%d,Skill:%d,Luck:%d,Add:%d,Ex(%d:%d:%d:%d:%d:%d))", lpObj->AccountID, lpObj->Name, ItemAttribute[iItemCode].Name, iItemCode, pItem.m_Option1, pItem.m_Option2, pItem.m_Option3, ExOption[0], ExOption[1], ExOption[2], ExOption[3], ExOption[4], ExOption[5]); return TRUE; }
void PCPointShop::BuyItem(DWORD PlayerID,int Position) { int ID=PlayerID-MIN_PLAYERID; LPGOBJSTRUCT pObj = (LPGOBJSTRUCT)(PlayerID*gObjSize + gObjBaseAddr); char sBuf[255] = {0}; int i=SearchIndex(Position); BOOL IfBuy=FALSE; if(i!=(-1)) { if(Items[i].Cost<pObjGS[ID].PCPlayerPoints) { int RewardItem=Items[i].ItemIndex*512+Items[i].ItemID; ItemSerialCreateSend(PlayerID,235,0,0,(DWORD)RewardItem,Items[i].Level,Items[i].Dur,Items[i].Skill,Items[i].Luck,(Items[i].Opt/4),-1,Items[i].Exc,0); DecreasePoints(PlayerID,Items[i].Cost); IfBuy=TRUE; } } //Log if((IfBuy==TRUE) && (i!=(-1))) { wsprintf(sBuf, "[PCPointShop] BuyItem [%s][%s] Item {%d %d} Cost: %d",pObj->AccountID,pObj->Name,Items[i].ItemIndex,Items[i].ItemID,Items[i].Cost); Log.outNormal(sBuf); } else { wsprintf(sBuf, "[PCPointShop] Attempt to BuyItem [%s][%s] Item {%d %d} Cost: %d",pObj->AccountID,pObj->Name,Items[i].ItemIndex,Items[i].ItemID,Items[i].Cost); Log.outError(sBuf,14); } }
BOOL CRingMonsterHerd::MonsterHerdItemDrop(LPOBJ lpObj) { if ( lpObj->Class == 135 ) { int iIndex = gObjMonsterTopHitDamageUser(lpObj); int itemnumber = ItemGetNumberMake(14, 13); ItemSerialCreateSend(lpObj->m_Index, lpObj->MapNumber, lpObj->X, lpObj->Y, itemnumber, 0, 0, 0, 0, 0, iIndex, 0, 0); char szTemp[256]; wsprintf(szTemp, lMsg.Get(MSGGET(4, 181)), gObj[iIndex].Name, gMapName[lpObj->MapNumber]); // #error Apply Deathway fix here AllSendServerMsg( szTemp ); LogAddTD("[Ring Event] White Wizard Killed by [%s][%s], MapNumber:%d", gObj[iIndex].AccountID, gObj[iIndex].Name, gObj[iIndex].MapNumber); return TRUE; } if ( lpObj->Class == 136 || lpObj->Class == 137) { if ( (rand()%100) < 30 ) { int iIndex = gObjMonsterTopHitDamageUser(lpObj); int itemnumber = ItemGetNumberMake(13, 20); // Wizards Ring ItemSerialCreateSend(lpObj->m_Index, lpObj->MapNumber, lpObj->X, lpObj->Y, itemnumber, 0, 30, 0, 0, 0, iIndex, 0, 0); return TRUE; } if ( (rand() % g_iRingOrcKillGiftRate) == 0 ) { int iIndex = gObjMonsterTopHitDamageUser(lpObj); this->SendEventGiftWinner(iIndex, 1); return TRUE; } MapC[lpObj->MapNumber].MoneyItemDrop(10000, (BYTE)lpObj->X, (BYTE)lpObj->Y); return TRUE; } return FALSE; }
BOOL CRingMonsterHerd::MonsterHerdItemDrop(LPOBJ lpObj) { if ( lpObj->Class == 135 ) { int iIndex = gObjMonsterTopHitDamageUser(lpObj); int itemnumber = ItemGetNumberMake(14, 13); ItemSerialCreateSend(lpObj->m_Index, lpObj->MapNumber, (BYTE)lpObj->X, (BYTE)lpObj->Y, itemnumber, 0, 0, 0, 0, 0, iIndex, 0, 0); char szTemp[128]; wsprintf(szTemp, "%s has defeated the White Wizard Corps", gObj[iIndex].Name); AllSendServerMsg( szTemp ); LogAdd("[Ring Event] White Wizard Killed by [%s][%s], MapNumber:%d", gObj[iIndex].AccountID, gObj[iIndex].Name, gObj[iIndex].MapNumber); return TRUE; } if ( lpObj->Class == 136 || lpObj->Class == 137) { if ( Random(0,99) < 30 ) { int iIndex = gObjMonsterTopHitDamageUser(lpObj); int itemnumber = ItemGetNumberMake(13, 20); // Wizards Ring ItemSerialCreateSend(lpObj->m_Index, lpObj->MapNumber, (BYTE)lpObj->X, (BYTE)lpObj->Y, itemnumber, 0, 30, 0, 0, 0, iIndex, 0, 0); return TRUE; } if ( !Random(0,g_iRingOrcKillGiftRate-1) ) { int iIndex = gObjMonsterTopHitDamageUser(lpObj); this->SendEventGiftWinner(iIndex, 1); return TRUE; } MapC[lpObj->MapNumber].MoneyItemDrop(10000, (BYTE)lpObj->X, (BYTE)lpObj->Y); return TRUE; } return FALSE; }
//bool cChat::AddMobCommand(LPOBJ gObj, char *Msg) //{ //#ifdef _GS // if(CheckCommand(gObj, 1, GmSystem.cSetZen, 0, 0, 0, 0, "AddMob", "/mobadd <mobid> <count> <speed> <distance> <map> <x> <y>", Msg)) // return true; // // int Mob; // int Map = gObj->MapNumber; // int Speed = 10; // int X1 = (int)gObj->X, X2 = (int)gObj->X; // int Y1 = (int)gObj->Y, Y2 = (int)gObj->Y; // int Dir = -1; // int Count = 1; // int Distance = 0; // // sscanf(Msg, "%d %d %d %d %d %d %d", &Mob, &Count, &Speed, &Distance, &Map, &X1, &Y1); // // FILE* AddMobFile; // // if((AddMobFile = fopen(NNMobAdd,"a+")) == NULL) // { // MessageBox(NULL, "Cant Find MonsterSpawn.ini", "Error", 0); // } // else // { // //ID, Count, Speed, Distance, Map, X, Y // //Mob,Map,Speed,x1,y1,x2,y2,dir,count // //17 9 30 119 80 150 115 -1 35 // Cyclops // if(Count == 1) // Dir = gObj->Dir; // if(Distance > 0) // { // X1 -= Distance; // Y1 -= Distance; // X2 += Distance; // Y2 += Distance; // } // // fprintf(AddMobFile, "\n%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d", Mob, Map, Speed, X1, Y1, X2, Y2, Dir, Count); // fclose(AddMobFile); // } // for(int i = 0; i < Count; i++) // { // Monster.MonsterAddAndSpawn(Mob, Map, Speed, X1, Y1, X2, Y2, Dir); // } // TNotice.MessageLog(1, gObj, "[AddMob] %d Mob Successfully spawned (Map: %d, X: %d, Y: %d, MobID: %d)", Count,Map,X1,Y1, Mob); //#endif // return true; //} void cChat::DropCommand(LPOBJ gObj, char *Msg, int aIndex) { OBJECTSTRUCT *lpObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex); if (!OBJMAX_RANGE(aIndex)) return; if (!gObjIsConnected(aIndex)) return; if (CheckCommand(lpObj, Configs.Commands.IsDrop, GmSystem.cDrop, 0, 0, 0, aIndex, "Drop", "[Name] /drop <ItemType> <ItemIndex> <Level> <Skill> <Luck> <JoLOption> <Excellent> <Ancient> <Count>", Msg)) return; int ItemType = 0; int ItemIndex = 0; int Level = 0; int Skill = 0; int Luck = 0; int JoLOption = 0; int Durability = 0; int Excellent = 0; int Ancient = 0; int Element = 0; int Count = 0; if (Count < 1 || Count > 10) Count = 1; sscanf(Msg, "%d %d %d %d %d %d %d %d %d", &ItemType, &ItemIndex, &Level, &Skill, &Luck, &JoLOption, &Excellent, &Ancient, &Count); if ((ItemType < 0 || ItemType > 15) || ItemIndex < 0 || (Level<0 || Level > 15) || (Skill < 0 || Skill > 1) || (Luck < 0 || Luck > 1) || (JoLOption < 0 || JoLOption > 7) || (Durability < 0 || Durability > 255) || (Excellent < 0 || Excellent > 63) || (Ancient < 0 || Ancient > 40)) { TNotice.SendNotice(aIndex, 1, "[Drop] Usage: /drop <ItemType> <ItemIndex> <Level> <Skill> <Luck> <JoLOption> <Excellent> <Ancient> <Count>"); return; } else { int ItemNumber = ITEMGET(ItemType, ItemIndex); for (int i = 0; i < Count; i++) { if (ItemNumber == ITEMGET(13, 4) || ItemNumber == ITEMGET(13, 5)) //Dark Horse and Raven { PetItemSerialCreateSend(aIndex, lpObj->MapNumber, lpObj->X, lpObj->Y, ItemNumber, Level, Durability, Skill, Luck, JoLOption, aIndex, Excellent, 0); } else { ItemSerialCreateSend(aIndex, lpObj->MapNumber, lpObj->X, lpObj->Y, ItemNumber, Level, Durability, Skill, Luck, JoLOption, aIndex, Excellent, Ancient, 0, 0, 0, Element); } } TNotice.SendNotice(aIndex, 1, "[Drop] %d Item Created %d %d %d %d %d %d %d %d %d %d - Success", Count, ItemType, ItemIndex, Level, Durability, Skill, Luck, JoLOption, Excellent, Ancient, Element); } return; }
void CInfernoEvent::DropItem(int aIndex){ if(aIndex < (OBJMAX-OBJMAXUSER) || aIndex > (OBJMAX-1)) return; if(!gObjIsConnected(aIndex)) return; LPOBJ lpObj = &gObj[aIndex]; if(this->ItemsCount < 0){ LogAddTD("[InfernoAttack][%s][%s] No Items Found",gObj->AccountID,gObj->Name); return; } int ItemID = rand() % this->ItemsCount; for(int i=0; i < this->Items[ItemID].Count;i++){ int CordX = (gObj->X-2) + rand()%3; int CordY = (gObj->Y-2) + rand()%3; int Excellent = GetExcellentOption(); ItemSerialCreateSend(gObj->m_Index,gObj->MapNumber,CordX,CordY, ((this->Items[ItemID].Index*512)+this->Items[ItemID].ID), this->Items[ItemID].Level, this->Items[ItemID].Durability, this->Items[ItemID].Skill, this->Items[ItemID].Luck, this->Items[ItemID].Option, gObj->m_Index, Excellent, this->Items[ItemID].Ancient); } LogAddTD("[InfernoAttack][%s][%s] Prize Drop [%d][%d][%d,%d,%d][%d,%d,%d,%d,%d,%d,%d,%d,%d]", gObj->AccountID,gObj->Name, this->Items[ItemID].Count, ItemID,gObj->MapNumber,gObj->X,gObj->Y, this->Items[ItemID].Index, this->Items[ItemID].ID, this->Items[ItemID].Level, this->Items[ItemID].Durability, this->Items[ItemID].Skill, this->Items[ItemID].Luck, this->Items[ItemID].Option, this->Items[ItemID].Excellent, this->Items[ItemID].Ancient); return; }
bool CSantaEvent::DropManager(LPOBJ lpObj) { bool bResult = false; int MaxHitUser; int ItemNumber; BYTE Socket[5]; Socket[0] = 0xFF; Socket[1] = 0xFF; Socket[2] = 0xFF; Socket[3] = 0xFF; Socket[4] = 0xFF; // ---- switch ( lpObj->Class ) { case 476: MaxHitUser = gObjMonsterTopHitDamageUser(lpObj); ItemNumber = ItemGetNumberMake(14, 13); ItemSerialCreateSend(lpObj->m_Index, lpObj->MapNumber, (BYTE)lpObj->X, (BYTE)lpObj->Y, ItemNumber, 0, 0, 0, 0, 0, MaxHitUser, 0,0, Socket); bResult = true; break; case 466: if ( (rand()%100) < 30 ) { MaxHitUser = gObjMonsterTopHitDamageUser(lpObj); ItemNumber = ItemGetNumberMake(13, 66); ItemSerialCreateSend(lpObj->m_Index, lpObj->MapNumber, (BYTE)lpObj->X, (BYTE)lpObj->Y, ItemNumber, 0, 0, 0, 0, 0, MaxHitUser, 0, 0, Socket); } else { MapC[lpObj->MapNumber].MoneyItemDrop(10000, (BYTE)lpObj->X, (BYTE)lpObj->Y); } bResult = true; break; } return bResult; }
bool cChat::SetDropCommand(LPOBJ gObj, char *Msg, int Index) { if(CheckCommand(gObj, Configs.Commands.IsDrop, GmSystem.cDrop, 0, 0, 1, Index, "SetDrop", "[Name] /setdrop <ItemIndex> <ItemLvl> <ItemLuck> <ItemOpt> <ItemExc> <ItemAnc>", Msg)) return true; //int ItemType = 0; int ItemIndex = 0; int Level = 0; int Skill = 0; int Luck = 0; int JoLOption = 0; int Durability = 0; int Excellent = 0; int Ancient = 0; int Element = 0; int ItemMin = 7; //MG Set Season 4.6 if(ItemIndex == 15 || ItemIndex == 20 || ItemIndex == 23 || ItemIndex == 32 || ItemIndex == 37 || ItemIndex == 47 || ItemIndex == 48) ItemMin = 8; //sscanf(Msg, "%d %d %d %d %d %d", &ItemIndex, &ItemLevel, &ItemLuck, &ItemOpt, &ItemExc, &ItemAncient); sscanf(Msg, "%d %d %d %d %d %d %d %d", &ItemIndex, &Level, &Skill, &Luck, &JoLOption, &Excellent, &Ancient, &ItemMin); if (ItemIndex < 0 || (Level<0 || Level > 15) || (Skill < 0 || Skill > 1) || (Luck < 0 || Luck > 1) || (JoLOption < 0 || JoLOption > 7) || (Durability < 0 || Durability > 255) || (Excellent < 0 || Excellent > 63) || (Ancient < 0 || Ancient > 40)) //if(ItemIndex < 0 || (ItemLevel<0 || ItemLevel > 13) || (ItemOpt < 0 || ItemOpt > 7) || (ItemLuck < 0 || ItemLuck > 1) || (ItemExc < 0 || ItemExc > 63) || (ItemAncient < 0 || ItemAncient > 40)) { //TNotice.SendNotice(aIndex, 1, "[SetDrop] Usage: /setdrop <ItemType> <ItemIndex> <Level> <Skill> <Luck> <JoLOption> <Durability> <Excellent> <Ancient> <Count>"); TNotice.MessageLog(1, gObj, "[SetDrop] Usage: /setdrop <ItemIndex> <Level> <Skill> <Luck> <JoLOption> <Excellent> <Ancient>"); return true; } OBJECTSTRUCT *gUbj = (OBJECTSTRUCT*)OBJECT_POINTER(Index); for(int i = ItemMin; i < 12; i++) { int Item = i * 512 + ItemIndex; int Rand1 = rand() % 3; int Rand2 = rand() % 3; //ItemSerialCreateSend(gUbj->m_Index, gUbj->MapNumber, (int)gUbj->X + Rand1, (int)gUbj->Y + Rand2, Item, ItemLevel, 0, 0, // ItemLuck, ItemOpt, gUbj->m_Index, ItemExc, ItemAncient, lDuration, dwEventIndex, SocketOption, MainAttribute); ItemSerialCreateSend(gUbj->m_Index, gUbj->MapNumber, gUbj->X + Rand1, gUbj->Y + Rand2, Item, Level, Durability, Skill, Luck, JoLOption, gUbj->m_Index, Excellent, Ancient, 0, 0, 0, Element); //ItemSerialCreateSend(Index, tObj->MapNumber, (int)tObj->X, (int)tObj->Y, Item, ItemLevel, 0, ItemSkill, ItemLuck, ItemOpt, Index, ItemExc, ItemAncient, lDuration, dwEventIndex, SocketOption, MainAttribute); } return true; }
// -------------------------------------------------------------------------------------------------------------------------------------------------- void CGoldenArcher::RewardItem(int aIndex) { int ItemLine = Role(static_cast<int>(gGAEvent.ReadFiles.size() - 1)); LPOBJ lpObj = &gObj[aIndex]; int ItemType, ItemIndex, Level, Durability, Luck, Skill, Option, Exc, Ancient; unsigned char Socket[5]; sscanf(this->ReadFiles.at(ItemLine).c_str(), "%d %d %d %d %d %d %d %d %d %d %d %d %d %d", &ItemType, &ItemIndex, &Level, &Durability, &Luck, &Skill, &Option, &Exc, &Ancient, &Socket[0], &Socket[1], &Socket[2],&Socket[3],&Socket[4]); UINT RewardItem = ItemType *512 + ItemIndex; ItemSerialCreateSend(aIndex, lpObj->MapNumber, lpObj->X, lpObj->Y, RewardItem, Level, Durability, Luck, Skill, Option, aIndex, Exc, Ancient, Socket); }
void CCrywolf::MakeRewardForHeroListTop5(int iUserIndex) { int iItemNumber = ITEMGET(14,13); ItemSerialCreateSend(gObj[iUserIndex].m_Index, gObj[iUserIndex].MapNumber, (BYTE)gObj[iUserIndex].X, (BYTE)gObj[iUserIndex].Y, iItemNumber, 0, 0, 0, 0, 0, iUserIndex, 0, 0); LogAdd("[ Crywolf ][Reward] [Hero List Top 5] [%s][%s] Success Reward - Gem Of Bless", gObj[iUserIndex].AccountID, gObj[iUserIndex].Name); }
void CCrywolf::MakeRewardForAltarElf(int iAltarUserIndex) { int iItemNumber = ITEMGET(14,13); ItemSerialCreateSend(gObj[iAltarUserIndex].m_Index, gObj[iAltarUserIndex].MapNumber, gObj[iAltarUserIndex].X, gObj[iAltarUserIndex].Y, iItemNumber, 0, 0, 0, 0, 0, iAltarUserIndex, 0, 0); LogAddTD("[ Crywolf ][Reward] [Altar Elf] [%s][%s] Success Reward - Gem Of Bless", gObj[iAltarUserIndex].AccountID, gObj[iAltarUserIndex].Name); }
// ----------------------------------------------------------------------------------------------------------------------------------------- bool CItemBagEx::DropEventItem(int aIndex) { LPOBJ lpObj = &gObj[aIndex]; BYTE Socket[5]; Socket[0] = 0xFF; Socket[1] = 0xFF; Socket[2] = 0xFF; Socket[3] = 0xFF; Socket[4] = 0xFF; if ( this->m_IBLoad == FALSE ) { return false; } if ( this->IsEnableEventItemDrop(aIndex) == false ) { return false; } if ( (rand()%10000) < this->m_IBItemDropRate ) { int CordX = lpObj->X; int CordY = lpObj->Y; int ItemLvl = this->m_IBEventItemLevel; int ItemType = this->m_IBEventItemType; float Durablity = 255.0; int CPlayer = gObjMonsterTopHitDamageUser(lpObj); ItemSerialCreateSend(lpObj->m_Index, lpObj->MapNumber, CordX, CordY, ItemType, ItemLvl, Durablity, 0, 0, 0, CPlayer, 0, 0, Socket); CLog.LogAddC(TColor.AliceBlue(), "[%s][%s]::[%s]::MonsterEventItemDrop (%d)(%d/%d)", lpObj->AccountID, lpObj->Name, this->m_IBEventName, lpObj->MapNumber, CordX, CordY); return true; } return false; }
bool cLuckyPenny::GetReward(int aIndex,BYTE Count) { if(OBJMAX_RANGE(aIndex) == 0) { return false; } int cnt = (Count / 10)-1; if(cnt >= 0 && cnt <= 2) { int RandNum = rand()%this->iCount[cnt]; BYTE TempInventoryMap[MAIN_INVENTORY_NORMAL_SIZE + (MAX_EXTENDED_INV*EXTENDED_INV_SIZE) + PSHOP_SIZE]; memcpy(TempInventoryMap,gObj[aIndex].pInventoryMap,ReadConfig.GETSLOTS(aIndex)); if(gObjTempInventoryInsertItem(&gObj[aIndex],this->items[cnt][RandNum].num,TempInventoryMap) != 255) { ItemSerialCreateSend(aIndex, 235, 0, 0, this->items[cnt][RandNum].num, this->items[cnt][RandNum].Level, this->items[cnt][RandNum].Dur, this->items[cnt][RandNum].Skill, this->items[cnt][RandNum].Luck, (this->items[cnt][RandNum].Opt/4), -1, this->items[cnt][RandNum].Exc, this->items[cnt][RandNum].Anc); return true; } } return false; }
bool cDropSystem::DropItem2(LPOBJ mObj,LPOBJ pObj, sItemsDrop ItemDrop[], unsigned int MaxItem) { int MapArrayItem[1000]; int CountArrayItem = 0; int LvlArrayItem[1000]; int CountLvlArrayItem = 0; for(unsigned int i = 0; i < MaxItem; i++) { if(ItemDrop[i].MMap == mObj->MapNumber || ItemDrop[i].MMap == -1) { MapArrayItem[CountArrayItem] = i; CountArrayItem++; } } if(CountArrayItem == 0) return false; for(int j = 0; j < CountArrayItem; j++) { if((ItemDrop[MapArrayItem[j]].MMinLvl <= mObj->Level && ItemDrop[MapArrayItem[j]].MMaxLvl >= mObj->Level) || ItemDrop[MapArrayItem[j]].MMaxLvl == 0) { LvlArrayItem[CountLvlArrayItem] = MapArrayItem[j]; CountLvlArrayItem++; } } if(CountLvlArrayItem == 0) { return false; } int RandomValue = rand() % 10000 + 1; if(LastRandomValue == RandomValue) { return false; } else { LastRandomValue = RandomValue; } int d = 0; int RandomItem = -1; short d_start = 0; short d_end = 0; for(int f = 0; f < CountLvlArrayItem; f++) { if(d_start > 10000) d_start = 10000; d_end = d_start + ItemDrop[LvlArrayItem[f]].IDropRate; if(d_end > 10000) { d_end = 10000; } if(RandomValue >= d_start && RandomValue <= d_end) { RandomItem = LvlArrayItem[f]; break; } else { d_start += ItemDrop[LvlArrayItem[f]].IDropRate; } } if(RandomItem == -1) { return false; } // make opt int Level=0, Skill=0, Luck=0, Opt=0, Exc=0, ExcNum=0, Group=0, Index=0, Anc=0; Index = ItemDrop[RandomItem].IIndex; Group = ItemDrop[RandomItem].IGroup; if(Group == -1) { if(Index == 15 || Index == 20 || Index == 23 || Index == 32 || Index == 37 || Index == 47 || Index == 48) { Group = rand()%4+8; } else { Group = rand()%5+7; } } Level = Utilits.GetNumberByPercent(ItemDrop[RandomItem].ILvlRate,ItemDrop[RandomItem].IMinLvl,ItemDrop[RandomItem].IMaxLvl); Opt = Utilits.GetNumberByPercent(ItemDrop[RandomItem].IOptRate,ItemDrop[RandomItem].IMinOpt,ItemDrop[RandomItem].IMaxOpt); Skill = Utilits.GetNumberByPercent(ItemDrop[RandomItem].ISkillRate,0,ItemDrop[RandomItem].ISkill); Luck = Utilits.GetNumberByPercent(ItemDrop[RandomItem].ILuckRate,0,ItemDrop[RandomItem].ILuck); if(ItemDrop[RandomItem].IExcRate > 0) { ExcNum = Utilits.GetNumberByPercent(ItemDrop[RandomItem].IExcRate,ItemDrop[RandomItem].IMinExc,ItemDrop[RandomItem].IMaxExc); Exc = Utilits.GenExcOpt(ExcNum); } if(ItemDrop[RandomItem].IAnc > 0) { if(ItemDrop[RandomItem].IAncRate > rand()%100) { Anc = ItemDrop[RandomItem].IAnc; } } int Item = ITEMGET(Group,Index); ItemSerialCreateSend (mObj->m_Index,mObj->MapNumber,(BYTE)mObj->X,(BYTE)mObj->Y,Item,Level,0,Skill,Luck,Opt,pObj->m_Index,Exc,Anc); Log.ConsoleOutPut(1,c_Green,t_DROP,"[Drop System] [R=%d] [%s]\t%d %d %d %d %d %d %d %d",RandomValue,pObj->Name,Group,Index,Level,Luck,Skill,Opt,Exc,Anc); return true; }
// ------------------------------------------------------------ void GenSystem::RankingGen(LPOBJ lpObj,int Type) { SYSTEMTIME time; GetLocalTime(&time); // ---- if ( lpObj->GenFamily == 0 ) { BYTE Packet[5] = { 0xC1, 0x05, 0xF8, 0x0A, 0x06 }; // You have not Joined The Gens gSendProto.DataSend (lpObj->m_Index, Packet, Packet[1]); return; } else if ( lpObj->GenFamily != Type ) { BYTE Packet[5] = { 0xC1, 0x05 ,0xF8 ,0x0A ,0x05 }; //You are a member of other Gens gSendProto.DataSend (lpObj->m_Index, Packet, Packet[1]); return; } else if (time.wDay > 10) { BYTE Packet[5] = { 0xC1, 0x05 ,0xF8 ,0x0A ,0x01 }; //Ranking rewards are given of first week of each month gSendProto.DataSend (lpObj->m_Index ,Packet, Packet[1]); return; } else if (lpObj->GenReward == 1) { BYTE Packet[5] = { 0xC1, 0x05 ,0xF8 ,0x0A ,0x04 }; //The reward has already been handed out gSendProto.DataSend (lpObj->m_Index, Packet, Packet[1]); return; } else if (lpObj->GenLevel > 8) { BYTE Packet[5] = { 0xC1, 0x05 ,0xF8 ,0x0A ,0x02 }; //You are not eligible for reward. Try harder later gSendProto.DataSend (lpObj->m_Index, Packet, Packet[1]); return; } else if (CheckInventoryEmptySpace(lpObj,1,1) == 0) { BYTE Packet[5] = { 0xC1, 0x05 ,0xF8 ,0x0A ,0x03 }; //You don't have enought space for the item gSendProto.DataSend (lpObj->m_Index, Packet, Packet[1]); return; } int ItemIndex=14*512+141; BYTE Socket[5]; Socket[0] = 0xFF; Socket[1] = 0xFF; Socket[2] = 0xFF; Socket[3] = 0xFF; Socket[4] = 0xFF; // ---- switch (lpObj->GenLevel) { case 1: case 2: ItemSerialCreateSend(lpObj->m_Index,235,0,0,ItemIndex,0,0,0,0,0,lpObj->m_Index,0,0, Socket); // Winning Jewelry Box break; case 3: case 4: ItemSerialCreateSend(lpObj->m_Index,235,0,0,ItemIndex+1,0,0,0,0,0,lpObj->m_Index,0,0, Socket); // Sophisticated Jewelry Box break; case 5: case 6: ItemSerialCreateSend(lpObj->m_Index,235,0,0,ItemIndex+2,0,0,0,0,0,lpObj->m_Index,0,0, Socket); // Metal Jewelry Box break; case 7: case 8: ItemSerialCreateSend(lpObj->m_Index,235,0,0,ItemIndex+3,0,0,0,0,0,lpObj->m_Index,0,0, Socket); // Old Jewelry Box break; } // ---- lpObj->GenReward = 1; BYTE Packet[5] = { 0xC1, 0x05 ,0xF8 ,0x0A ,0x00 }; //Congratulations You has been rewarded gSendProto.DataSend (lpObj->m_Index, Packet, Packet[1]); return; }
BYTE CGambleSystem::TryGamble(int aIndex, BYTE MapNumber, int cX, int cY, BYTE btRareItemNum) //0049C6D0 (Identical) { if (this->bLoad == FALSE) { return 0; } float Dur = 0; int ItemType = 0; int Level = 0; int MapPosX = 0; int MapPosY = 0; int Op1 = 0; int Op2 = 0; int Op3 = 0; DWORD n = 0; //loc10 int loc_11 = 0; int NewOp = 0; LPOBJ lpObj = &gObj[aIndex]; //loc_13 if(this->GetBagItemCount() > 0) { if (this->m_dwSpecialItemRate[btRareItemNum] >= GetLargeRand() % 1000000) { Level = 0; Dur = 0; Op1 = 1; Op2 = 0; DWORD dwOptionRate = GetLargeRand() % 1000000; if ( dwOptionRate <= this->m_iBagItemOptionRate[0]) { Op3 = 1; } else if ( dwOptionRate <= this->m_iBagItemOptionRate[0] + this->m_iBagItemOptionRate[1]) { Op3 = 2; } else if ( dwOptionRate <= this->m_iBagItemOptionRate[0] + this->m_iBagItemOptionRate[1] + this->m_iBagItemOptionRate[2]) { Op3 = 3; } else if ( dwOptionRate <= this->m_iBagItemOptionRate[0] + this->m_iBagItemOptionRate[1] + this->m_iBagItemOptionRate[2] + this->m_iBagItemOptionRate[3]) { Op3 = 4; } DWORD dwNewOptionRate = GetLargeRand() % 1000000; if ( dwNewOptionRate <= this->m_iBagItemExcRate[0]) { NewOp = this->SortExcNumberPerKind(1); } else if ( dwNewOptionRate <= this->m_iBagItemExcRate[0] + this->m_iBagItemExcRate[1]) { NewOp = this->SortExcNumberPerKind(2); } else if ( dwNewOptionRate <= this->m_iBagItemExcRate[0] + this->m_iBagItemExcRate[1] + this->m_iBagItemExcRate[2]) { NewOp = this->SortExcNumberPerKind(3); } else if ( dwNewOptionRate <= this->m_iBagItemExcRate[0] + this->m_iBagItemExcRate[1] + this->m_iBagItemExcRate[2] + this->m_iBagItemExcRate[3]) { NewOp = this->SortExcNumberPerKind(4); } switch ( btRareItemNum ) //5 Types of Special Item { case 0: ItemType = ItemGetNumberMake(3, 11); break; case 1: ItemType = ItemGetNumberMake(5, 33); break; case 2: ItemType = ItemGetNumberMake(4, 24); break; case 3: ItemType = ItemGetNumberMake(2, 18); break; case 4: ItemType = ItemGetNumberMake(5, 34); break; } } else //else for common items like a bag { int iBagNumberCount = 0; int iRandA = 0; int iRandB = 0; int iBagNumber = 0; switch( btRareItemNum ) { case 0: iBagNumber = 0; break; case 1: iBagNumber = 5; break; case 2: iBagNumber = 10; break; case 3: iBagNumber = 15; break; case 4: iBagNumber = 20; break; } DWORD dwSortItemRand = GetLargeRand() % 1000000; int iSortItemRate = 0; for ( int i = iBagNumber; i < iBagNumber + GAMBLE_MAX_NORMAL_ITEM; i++) { iSortItemRate += this->m_GamblingInfo[i].m_iSortItemRate; if(dwSortItemRand <= iSortItemRate) { iBagNumber = i; break; } } while(true) //Max 25 { iRandB += this->m_iDropRatePerItemCount[iBagNumberCount]; if (iBagNumber <= iBagNumberCount) { break; } iRandA += this->m_iDropRatePerItemCount[iBagNumberCount]; iBagNumberCount++; } while(true) //temp fix { if( iRandB > iRandA ) { break; } // --- iRandB++; } n = (GetLargeRand() % (iRandB - iRandA)) + iRandA; Dur = 0; MapPosX = 0; MapPosY = 0; Level = this->GetLevel(n); ItemType = ItemGetNumberMake(this->BagObject[n].m_type,this->BagObject[n].m_index); if (ItemType == -1) { return 0; } if( this->BagObject[n].m_isskill != 0) { if (this->m_GamblingInfo[iBagNumber].m_iSkillRate >= GetLargeRand()%1000000) { Op1 = 1; } } if(this->BagObject[n].m_isluck != 0) { if (this->m_GamblingInfo[iBagNumber].m_iLuckRate >= GetLargeRand()%1000000) { Op2 = 1; } } if(this->BagObject[n].m_isoption != 0) { if (this->m_GamblingInfo[iBagNumber].m_iOptionRate >= GetLargeRand()%1000000) { int iOpt3Rand = GetLargeRand() % 1000000; if ( iOpt3Rand <= this->m_iBagItemOptionRate[0]) { Op3 = 1; } else if ( iOpt3Rand <= this->m_iBagItemOptionRate[0] + this->m_iBagItemOptionRate[1]) { Op3 = 2; } else if ( iOpt3Rand <= this->m_iBagItemOptionRate[0] + this->m_iBagItemOptionRate[1] + this->m_iBagItemOptionRate[2]) { Op3 = 3; } else if ( iOpt3Rand <= this->m_iBagItemOptionRate[0] + this->m_iBagItemOptionRate[1] + this->m_iBagItemOptionRate[2] + this->m_iBagItemOptionRate[3]) { Op3 = 4; } } } if(this->BagObject[n].m_isexitem != 0) { if (this->m_GamblingInfo[iBagNumber].m_iExcRate >= GetLargeRand()%1000000) { NewOp = this->SortExcOption(); Op2 = 0; Op1 = 1; Level = 0; } } } ItemSerialCreateSend(lpObj->m_Index,MapNumber,MapPosX,MapPosY,ItemType,Level,Dur,Op1,Op2,Op3,lpObj->m_Index,NewOp,0); LogAddTD("[ GAMBLING ][ TryGambling ] %s(%s) Try Item : [%s]%d Level:%d op1:%d op2:%d op3:%d ExOp:%d",lpObj->AccountID,lpObj->Name,ItemAttribute[ItemType].Name,ItemType,Level,Op1,Op2, Op3,NewOp); } return 1; }
BOOL CJewelOfHarmonySystem::MakeSmeltingStoneItem(LPOBJ lpObj) { if ( this->m_bSystemMixSmeltingStone != TRUE ) { GCServerMsgStringSend(lMsg.Get(MSGGET(13,53)), lpObj->m_Index, 1); return TRUE; } lpObj->ChaosLock = TRUE; int iValidItemCount = 0; int iInvalidItemCount = 0; int iMakeSmeltingStoneMixPrice = 0; PMSG_CHAOSMIXRESULT pMsg; C1HeadSet((LPBYTE)&pMsg, 0x86, sizeof(pMsg)); pMsg.Result = 0; int iItemPos = -1; for ( int n=0;n<CHAOS_BOX_SIZE;n++) { if ( lpObj->pChaosBox[n].IsItem() == TRUE ) { if ( this->IsEnableToMakeSmeltingStoneItem(&lpObj->pChaosBox[n]) == TRUE ) { iValidItemCount++; iItemPos = n; } else { iInvalidItemCount++; } } } if ( iValidItemCount != 1 || iInvalidItemCount || iItemPos == -1 ) { gSendProto.DataSend(lpObj->m_Index, (LPBYTE)&pMsg, pMsg.h.size); lpObj->ChaosLock = FALSE; return FALSE; } int JEWEL_OF_HARMONY_MAKE_SMELTINGSTONE_RATE; BOOL bIsItemNormal = TRUE; if ( lpObj->pChaosBox[iItemPos].IsExtItem() == TRUE ) { bIsItemNormal = FALSE; JEWEL_OF_HARMONY_MAKE_SMELTINGSTONE_RATE = this->m_iRateMixSmeltingStoneExt; } else { bIsItemNormal = TRUE; JEWEL_OF_HARMONY_MAKE_SMELTINGSTONE_RATE = this->m_iRateMixSmeltingStoneNor; } iMakeSmeltingStoneMixPrice = this->m_iZenForMixSmeltingStone; int iChaosTaxMoney = iMakeSmeltingStoneMixPrice * g_CastleSiegeSync.GetTaxRateChaos(lpObj->m_Index) / 100; if ( iChaosTaxMoney < 0 ) iChaosTaxMoney = 0; iMakeSmeltingStoneMixPrice += iChaosTaxMoney; if ( iMakeSmeltingStoneMixPrice < 0 ) iMakeSmeltingStoneMixPrice = 0; if ( lpObj->Money < iMakeSmeltingStoneMixPrice ) { pMsg.Result = 2; gSendProto.DataSend(lpObj->m_Index, (LPBYTE)&pMsg, pMsg.h.size); lpObj->ChaosLock = FALSE; return FALSE; } lpObj->Money -= iMakeSmeltingStoneMixPrice; g_CastleSiegeSync.AddTributeMoney(iChaosTaxMoney); GCMoneySend(lpObj->m_Index, lpObj->Money); LogChaosItem(lpObj, "JewelOfHarmony][Smelt Item Mix"); CLog.LogAdd("[JewelOfHarmony][Smelt Item Mix] - Mix Start"); int iRate = rand() % 100; BYTE Socket[5]; Socket[0] = 0xFF; Socket[1] = 0xFF; Socket[2] = 0xFF; Socket[3] = 0xFF; Socket[4] = 0xFF; if ( iRate < JEWEL_OF_HARMONY_MAKE_SMELTINGSTONE_RATE ) { int iItemType; if ( bIsItemNormal == TRUE ) iItemType = this->JEWEL_OF_HARMONY_SMELT_NOR_ITEMINDEX; else iItemType = this->JEWEL_OF_HARMONY_SMELT_EXT_ITEMINDEX; ItemSerialCreateSend(lpObj->m_Index, 255, 0, 0, iItemType, 0, 1, 0, 0, 0, lpObj->m_Index, 0, 0, Socket); gObjInventoryCommit(lpObj->m_Index); CLog.LogAdd("[JewelOfHarmony][Smelt Item Mix] Smelting Stone Normal[%d] Mix Success [%s][%s], Money(%d-%d) Rate(%d/%d)", bIsItemNormal, lpObj->AccountID, lpObj->Name, lpObj->Money, iMakeSmeltingStoneMixPrice, iRate, JEWEL_OF_HARMONY_MAKE_SMELTINGSTONE_RATE); } else { gChaosBox.ChaosBoxInit(lpObj); GCUserChaosBoxSend(lpObj, 0); gSendProto.DataSend(lpObj->m_Index, (LPBYTE)&pMsg, pMsg.h.size); CLog.LogAdd("[JewelOfHarmony][Smelt Item Mix] Smelting Stone Normal[%d] Mix Fail [%s][%s], Money : %d-%d Rate(%d/%d)", bIsItemNormal, lpObj->AccountID, lpObj->Name, lpObj->Money, iMakeSmeltingStoneMixPrice, iRate, JEWEL_OF_HARMONY_MAKE_SMELTINGSTONE_RATE); } lpObj->ChaosLock = FALSE; return TRUE; }
void CJewelOfHarmonySystem::PurityJewelOfHarmony(LPOBJ lpObj) { if ( this->m_bSystemPrutiyJewel != TRUE ) { GCServerMsgStringSend(lMsg.Get(MSGGET(13, 50)), lpObj->m_Index, 1); return; } if ( this->IsEnableToUsePuritySystem() == FALSE ) { GCServerMsgStringSend(lMsg.Get(MSGGET(13, 50)), lpObj->m_Index, 1); CLog.LogAdd("[JewelOfHarmony][%s][%s] Not Purtiy Time ", lpObj->AccountID, lpObj->Name); return; } lpObj->ChaosLock = TRUE; // Chaos Lock was Enabled int iJewelOfHarmonyItemCount = 0; int iInvalidItemCount = 0; int iChaosMixPrice = 0; PMSG_CHAOSMIXRESULT pMsg; C1HeadSet((LPBYTE)&pMsg, 0x86, sizeof(PMSG_CHAOSMIXRESULT)); pMsg.Result = CB_ERROR; for ( int n =0;n<CHAOS_BOX_SIZE;n++) { if ( lpObj->pChaosBox[n].IsItem() == TRUE ) { if ( lpObj->pChaosBox[n].m_Type == this->JEWEL_OF_HARMONY_ITEMINDEX ) { iJewelOfHarmonyItemCount++; } else { iInvalidItemCount++; } } } if ( iInvalidItemCount > 0 || iJewelOfHarmonyItemCount !=1 ) { gSendProto.DataSend(lpObj->m_Index, (LPBYTE)&pMsg, pMsg.h.size); lpObj->ChaosLock = FALSE; return; } iChaosMixPrice = this->m_iZenForPurity; int iChaosTaxMoney = iChaosMixPrice * g_CastleSiegeSync.GetTaxRateChaos(lpObj->m_Index) / 100; if (iChaosTaxMoney < 0 ) iChaosTaxMoney = 0; iChaosMixPrice += iChaosTaxMoney; if ( iChaosMixPrice < 0 ) iChaosMixPrice = 0; if ( lpObj->Money < iChaosMixPrice ) { pMsg.Result = CB_NOT_ENOUGH_ZEN; gSendProto.DataSend(lpObj->m_Index, (LPBYTE)&pMsg, pMsg.h.size); lpObj->ChaosLock = FALSE; return; } lpObj->Money -= iChaosMixPrice; g_CastleSiegeSync.AddTributeMoney(iChaosTaxMoney); GCMoneySend(lpObj->m_Index, lpObj->Money); LogChaosItem(lpObj, "JewelOfHarmony][Purity"); CLog.LogAdd("[JewelOfHarmony][Purity] - Mix Start"); BYTE Socket[5]; Socket[0] = 0xFF; Socket[1] = 0xFF; Socket[2] = 0xFF; Socket[3] = 0xFF; Socket[4] = 0xFF; int iRate = rand() % 100; if ( iRate < this->m_iRatePuritySuccess ) { int iItemType = this->JEWEL_OF_HARMONY_PURITY_ITEMINDEX; ItemSerialCreateSend(lpObj->m_Index, -1, 0, 0, iItemType, 0, 1, 0, 0, 0, lpObj->m_Index, 0, 0, Socket); gObjInventoryCommit(lpObj->m_Index); CLog.LogAdd("[JewelOfHarmony][Purity] Purity Success [%s][%s] Rate %d/%d", lpObj->AccountID, lpObj->Name, iRate, this->m_iRatePuritySuccess); } else { gChaosBox.ChaosBoxInit(lpObj); GCUserChaosBoxSend(lpObj, 0); gSendProto.DataSend(lpObj->m_Index, (LPBYTE)&pMsg, pMsg.h.size); CLog.LogAdd("[JewelOfHarmony][Purity] Purity Fail [%s][%s] Rate %d/%d", lpObj->AccountID, lpObj->Name, iRate, this->m_iRatePuritySuccess); } // Chaos Lock was Disabled lpObj->ChaosLock = FALSE; }
void CChaosCard::ChaosCardMix(LPOBJ lpObj) { lpObj->ChaosLock = TRUE; int iChaosCardCount = 0; int iChaosMoney = 0; int iInvalidItemCount = 0; PMSG_CHAOSMIXRESULT pMsg; C1HeadSet((LPBYTE)&pMsg.h, 0x86, sizeof(PMSG_CHAOSMIXRESULT)); pMsg.Result = CB_ERROR; for ( int n=0;n<CHAOS_BOX_SIZE;n++) { if ( lpObj->pChaosBox[n].IsItem() == TRUE ) { if ( lpObj->pChaosBox[n].m_Type == ITEMGET(14,54) ) { iChaosCardCount++; } else { iInvalidItemCount++; } } } if ( iChaosCardCount == 0 ) { return; } if ( iInvalidItemCount > 0 ) { return; } if ( iChaosCardCount > 1 ) { MsgOutput(lpObj->m_Index,"[ChaosCard]: Can only use 1 card at the same time"); gSendProto.DataSend(lpObj->m_Index, (LPBYTE)&pMsg, pMsg.h.size); lpObj->ChaosLock = FALSE; return; } LogChaosItem(lpObj,"ChaosCard"); CLog.LogAdd("[ChaosCard] Chaos Mix Start"); lpObj->ChaosSuccessRate = 100; BYTE Socket[5]; Socket[0] = 0xFF; Socket[1] = 0xFF; Socket[2] = 0xFF; Socket[3] = 0xFF; Socket[4] = 0xFF; if ( (rand()%100) < lpObj->ChaosSuccessRate ) { int ItemNum = ITEMGET(14,14); int Level = 0; ItemSerialCreateSend(lpObj->m_Index, -1, 0, 0, ItemNum, Level, 0, 0, 0, 0, -1, 0, 0, Socket); ::gObjInventoryCommit(lpObj->m_Index); CLog.LogAdd("[ChaosCard] [%s][%s] CBMix Success %d ", lpObj->AccountID, lpObj->Name, lpObj->ChaosSuccessRate); } else { gChaosBox.ChaosBoxInit(lpObj); ::GCUserChaosBoxSend(lpObj, 1); gSendProto.DataSend(lpObj->m_Index, (UCHAR*)&pMsg, pMsg.h.size); CLog.LogAdd("[ChaosCard] [%s][%s] CBMix Fail %d ", lpObj->AccountID, lpObj->Name, lpObj->ChaosSuccessRate); lpObj->ChaosLock = FALSE; } }
void GameShop::RequestStorageItemUse(int aIndex, GAMESHOP_REQ_STORAGEITEMUSE * lpRequest) { #if( GAMESHOP_DEBUG == 1 ) LogAddC(2, "[DEBUG] [%s] [%s] [%s]", __FUNCTION__, &gObj[aIndex].AccountID, &gObj[aIndex].Name); #endif // ---- LPOBJ lpUser = &gObj[aIndex]; // ---- if( !gObjIsConnected(aIndex) || lpUser->Connected != PLAYER_PLAYING ) { return; } // ---- GAMESHOP_ITEM_DATA * lpItem = this->GetStorageItem(aIndex, lpRequest->AuthIndex, lpRequest->AuthID); if(lpItem->ItemID == g_Buyvip1ItemCode) { if(lpUser->Vip != 1 && lpUser->Vip != 0) { GCServerMsgStringSend("You already vip! You can't buy other vip type now.",lpUser->m_Index, 1); return; } } else if (lpItem->ItemID == g_Buyvip2ItemCode) { if(lpUser->Vip != 2 && lpUser->Vip != 0) { GCServerMsgStringSend("You already vip! You can't buy other vip type now.",lpUser->m_Index, 1); return; } } else if (lpItem->ItemID == g_Buyvip3ItemCode) { if(lpUser->Vip != 3 && lpUser->Vip != 0) { GCServerMsgStringSend("You already vip! You can't buy other vip type now.",lpUser->m_Index, 1); return; } } else if (lpItem->ItemID == g_Buyvip4ItemCode) { if(lpUser->Vip != 4 && lpUser->Vip != 0) { GCServerMsgStringSend("You already vip! You can't buy other vip type now.",lpUser->m_Index, 1); return; } } else if (lpItem->ItemID == g_Buyvip5ItemCode) { if(lpUser->Vip != 5 && lpUser->Vip != 0) { GCServerMsgStringSend("You already vip! You can't buy other vip type now.",lpUser->m_Index, 1); return; } } else if (lpItem->ItemID == g_Buyvip6ItemCode) { if(lpUser->Vip != 6 && lpUser->Vip != 0) { GCServerMsgStringSend("You already vip! You can't buy other vip type now.",lpUser->m_Index, 1); return; } } // ---- GAMESHOP_ANS_STORAGE_ITEM_USE pAnswer; PHeadSubSetB((LPBYTE)&pAnswer, 0xD2, cStorageItemUse, sizeof(pAnswer)); // ---- if( !lpItem || !CheckInventoryEmptySpace(lpUser, lpItem->X, lpItem->Y) ) { pAnswer.Result = true; DataSend(aIndex, (LPBYTE)&pAnswer, pAnswer.h.size); LogAddC(3, "[GameShop] %d", __LINE__); return; } // ---- if( !DeleteItemInStorage(aIndex, lpRequest->AuthIndex, lpRequest->AuthID) ) { LogAddC(3, "[GameShop] %d", __LINE__); return; } // ---- //GOLD CHANNEL VIP SYSTEM /*char ms[200]; wsprintf(ms, "%d / %d", lpItem->ItemID, g_Buyvip1ItemCode); GCServerMsgStringSend(ms, lpUser->m_Index, 1);*/ if(lpItem->ItemID == g_Buyvip1ItemCode || lpItem->ItemID == g_Buyvip2ItemCode || lpItem->ItemID == g_Buyvip3ItemCode || lpItem->ItemID == g_Buyvip4ItemCode || lpItem->ItemID == g_Buyvip5ItemCode || lpItem->ItemID == g_Buyvip6ItemCode) { UPDATEGOLDCHANNELSTATUS pReq; if(lpItem->ItemID == g_Buyvip1ItemCode) { pReq.vipType = 1; } else if (lpItem->ItemID == g_Buyvip2ItemCode) { pReq.vipType = 2; } else if (lpItem->ItemID == g_Buyvip3ItemCode) { pReq.vipType = 3; } else if (lpItem->ItemID == g_Buyvip4ItemCode) { pReq.vipType = 4; } else if (lpItem->ItemID == g_Buyvip5ItemCode) { pReq.vipType = 5; } else if (lpItem->ItemID == g_Buyvip6ItemCode) { pReq.vipType = 6; } //Gold Channel Ticket ConMember.InsertUser(lpUser->AccountID); pReq.h.set((LPBYTE)&pReq, 0xD7, 0x01, sizeof(UPDATEGOLDCHANNELSTATUS)); memcpy(pReq.AccountID, lpUser->AccountID, 10); pReq.Duration = lpItem->Duration; cDBSMng.Send((char*)&pReq, sizeof(pReq)); } else if( g_BuffScript.GetBuffDataFromItemCode(lpItem->ItemID) //-> Buff && !this->IsInventoryBuff(lpItem->ItemID) ) { g_CashItemPeriodSystem.SearchAndDeleteItemPeriodEffect(lpUser, lpItem->ItemID); //fix g_CashItemPeriodSystem.GDReqPeriodItemInsert(lpUser, lpItem->ItemID, lpItem->Duration); } else if( lpItem->Duration > 0 ) //-> Period item { ItemSerialCreateSend(aIndex, 236, 0, 0, lpItem->ItemID, lpItem->Level, lpItem->Durability, lpItem->Skill, lpItem->Luck, lpItem->Option, lpItem->Duration * 60, lpItem->Excellent, 0); } else if(lpItem->ItemID == ITEMGET(14,91)) { GDSummonerStateUpdate(lpUser, lpUser->m_Index); } else if(lpItem->ItemID == ITEMGET(14, 169)) { GDRageFighterStateUpdate(lpUser, lpUser->m_Index); } else { ItemSerialCreateSend(aIndex, 235, 0, 0, lpItem->ItemID, lpItem->Level, lpItem->Durability, lpItem->Skill, lpItem->Luck, lpItem->Option, aIndex, lpItem->Excellent, 0); } // ---- pAnswer.Result = false; DataSend(aIndex, (LPBYTE)&pAnswer, pAnswer.h.size); // ---- this->GDSaveUserInfo(aIndex); }
BYTE CIllusionTempleEvent::TicketMix(int iIndex, int iLevel, int iCharmCount) { if( OBJMAX_RANGE( iIndex ) == FALSE ) { return FALSE; } if( IT_MAP_RANGE( iLevel + (MAP_INDEX_ILLUSIONTEMPLE1 - 1)) == FALSE ) { return FALSE; } int Empty = 0; PMSG_CHAOSMIXRESULT pMsg; PHeadSetB((LPBYTE)&pMsg,0x86,sizeof(pMsg)); pMsg.Result = 0; gObj[iIndex].ChaosLock = TRUE; LogAddTD("[Illusion Temple] Mix Chaos Mix Start (Account:%s, Name:%s, Level:%d)", gObj[iIndex].AccountID,gObj[iIndex].Name,iLevel); char szTmp[23]; wsprintf(szTmp,"IllusionTemple Mix,%d",iLevel); g_ChaosBox.LogChaosItem(&gObj[iIndex],szTmp); int MixRate = IT_TicketRate[-1 + iLevel]; if( MixRate < 0 || MixRate > 100 ) { DataSend(iIndex,(LPBYTE)&pMsg,pMsg.h.size); LogAddTD("[Illusion Temple] Mix Chaos Mix Failed - MixRate Out of Bound (Account:%s, Name:%s, Level:%d)", gObj[iIndex].AccountID,gObj[iIndex].Name,iLevel); return FALSE; } if ( g_CrywolfSync.GetOccupationState() == 0 && g_iCrywolfApplyMvpBenefit ) { MixRate += g_CrywolfSync.GetPlusChaosRate(); } int iNeedChaosMoney = IT_TicketZen[-1 + iLevel]; int iChaosTaxMoney = (int)((__int64)iNeedChaosMoney * (__int64)g_CastleSiegeSync.GetTaxRateChaos(iIndex) / (__int64)100); if ( iChaosTaxMoney < 0 ) { iChaosTaxMoney = 0; } iNeedChaosMoney += iChaosTaxMoney; if ( iNeedChaosMoney < 0 ) { DataSend(iIndex,(LPBYTE)&pMsg,pMsg.h.size); LogAddTD("[Illusion Temple] Mix Chaos Mix Failed - MixMoney< 0 (Account:%s, Name:%s, Level:%d).", gObj[iIndex].AccountID,gObj[iIndex].Name,iLevel); return false; } if ( ( gObj[iIndex].Money - iNeedChaosMoney ) < 0 ) { pMsg.Result = 11; DataSend(iIndex,(LPBYTE)&pMsg,pMsg.h.size); LogAddTD("[Illusion Temple] Mix Chaos Mix Failed - Not Enough Money (Account:%s, Name:%s, Level:%d)", gObj[iIndex].AccountID,gObj[iIndex].Name,iLevel); return false; } gObj[iIndex].Money -= iNeedChaosMoney; g_CastleSiegeSync.AddTributeMoney(iChaosTaxMoney); GCMoneySend(iIndex, gObj[iIndex].Money); MixRate += iCharmCount; if( rand() % 100 < MixRate ) { #if( __4GAMERS__ == 1 ) g_Achievements.GD_UpdateMixData(&gObj[iIndex], true); #endif int Item = ITEMGET(13,51); ItemSerialCreateSend(iIndex,0xFF,0,0,Item,iLevel,0,0,0,0,-1,0,0); LogAddTD("[Illusion Temple] [%s][%s] CBMix Success %d Money : %d-%d, CharmRate : %d", gObj[iIndex].AccountID,gObj[iIndex].Name,MixRate,gObj[iIndex].Money,iNeedChaosMoney,iCharmCount); } else { #if( __4GAMERS__ == 1 ) g_Achievements.GD_UpdateMixData(&gObj[iIndex], false); #endif g_ChaosBox.ChaosBoxInit(&gObj[iIndex]); GCUserChaosBoxSend(&gObj[iIndex], 0); DataSend(iIndex,(LPBYTE)&pMsg,pMsg.h.size); LogAddTD("[Illusion Temple] [%s][%s] CBMix Fail %d Money : %d-%d, CharmRate : %d", gObj[iIndex].AccountID,gObj[iIndex].Name,MixRate,gObj[iIndex].Money,iNeedChaosMoney,iCharmCount); return FALSE; } gObjInventoryCommit(iIndex); return TRUE; }
bool CItemDropManager::ProccessItemDrop(LPOBJ lpMobObj) { unsigned char Map = lpMobObj->MapNumber; unsigned char X = lpMobObj->X; unsigned char Y = lpMobObj->Y; int Type = 0; char Level = 0; unsigned char Dur = 0; char Luck = 0; char Skill = 0; char Opt = 0; char Exe = 0; char Anc = 0; unsigned char Socket[5]; Socket[0] = 0xFF; Socket[1] = 0xFF; Socket[2] = 0xFF; Socket[3] = 0xFF; Socket[4] = 0xFF; if ( gItemDropManager.ItemsCount > 0 ) { int iTopHitUser = gObjMonsterTopHitDamageUser(lpMobObj); for (int i=0;i<gItemDropManager.ItemsCount;++i) { if ( lpMobObj->MapNumber == gItemDropManager.DropMap[i] || gItemDropManager.DropMap[i] == -1 ) { if ( lpMobObj->Level >= gItemDropManager.MobMinLvl[i] && lpMobObj->Level <= gItemDropManager.MobMaxLvl[i] ) { if ( (rand()%10000) < gItemDropManager.DropRate[i] ) { Type = ItemGetNumberMake(gItemDropManager.ItemType[i],gItemDropManager.ItemIndex[i]); Level = gItemDropManager.ItemLevel[i]; Dur = gItemDropManager.ItemDur[i]; Luck = gItemDropManager.ItemLuck[i]; Skill = gItemDropManager.ItemSkill[i]; Opt = gItemDropManager.ItemOption[i]; if ( gItemDropManager.ItemExe[i] > 0 ) { Exe = GetRandomExeOption(gItemDropManager.ItemExe[i]+1); } if ( gItemDropManager.ItemAncient[i] == 5 || gItemDropManager.ItemAncient[i] == 10 ) { Anc = gItemDropManager.ItemAncient[i]; } if ( gItemDropManager.Socket[0][i] != 255 ) { Socket[0] = gItemDropManager.Socket[0][i]; if ( gItemDropManager.Socket[1][i] != 255 ) { Socket[1] = gItemDropManager.Socket[1][i]; if ( gItemDropManager.Socket[2][i] != 255 ) { Socket[2] = gItemDropManager.Socket[2][i]; if ( gItemDropManager.Socket[3][i] != 255 ) { Socket[3] = gItemDropManager.Socket[3][i]; if ( gItemDropManager.Socket[4][i] != 255 ) { Socket[4] = gItemDropManager.Socket[4][i]; } } } } } ItemSerialCreateSend(lpMobObj->m_Index,Map,X,Y,Type,Level,Dur,Skill,Luck,Opt,iTopHitUser,Exe,Anc,Socket); return true; } } } } } return false; }
BOOL CQuestInfo::MonsterItemDrop(LPOBJ lpObj) { int MaxHitUser = gObjMonsterTopHitDamageUser(lpObj); if ( MaxHitUser == -1 ) { return false; } int partycount = gParty.GetPartyCount(gObj[MaxHitUser].PartyNumber); if ( partycount > 0 ) { return false; } LPOBJ lpTarget = &gObj[MaxHitUser]; int questcount = this->GetQeustCount(); int foundquest = 0; LPQUEST_INFO lpQuestInfo; LPQUEST_SUB_INFO lpSubInfo; int type; int level; int x; int y; float dur = 0; int Option1 = 0; int Option2 = 0; int Option3 = 0; for ( int i=0;i<MAX_QUEST_INFO;i++) { lpQuestInfo = this->GetQuestInfo(i); if ( lpQuestInfo == NULL ) { continue; } for ( int n =0;n<lpQuestInfo->QuestSubInfoCount;n++) { lpSubInfo = this->GetSubquestInfo(lpTarget, lpQuestInfo, n); if ( lpSubInfo != NULL ) { if ( lpSubInfo->QuestType == 1 && lpSubInfo->NeedTargetMinLevel != -1 ) //Third Quest Fix, only READS Monster Level Min and Max if Level Min is != 1 { if ( lpObj->Level >= lpSubInfo->NeedTargetMinLevel) { if ( lpObj->Level <= lpSubInfo->NeedTargetMaxLevel ) { if ( this->GetQuestState(lpTarget, lpQuestInfo->QuestIndex) == TRUE ) { if ( (rand() % ITEM_QUEST_DROP_PROBABILITY) < lpSubInfo->NeedDropRate) { int itemcount = gObjGetItemCountInIventory(MaxHitUser, lpSubInfo->NeedType, lpSubInfo->NeedSubType, lpSubInfo->ItemLevel); if ( itemcount >= lpSubInfo->NeedNumber) { continue; } dur = 0; x = lpObj->X; y = lpObj->Y; level = lpSubInfo->ItemLevel; type = ItemGetNumberMake(lpSubInfo->NeedType, lpSubInfo->NeedSubType); ItemSerialCreateSend(lpObj->m_Index, lpObj->MapNumber, x, y, type, level, dur, Option1, Option2, Option3, MaxHitUser, 0, 0); LogAddTD("[Quest] Quest Item Drop [%s]: [%s][%s] (%s) (%d,%d)", lpObj->Name, lpTarget->AccountID, lpTarget->Name, lpQuestInfo->Name, lpSubInfo->NeedType, lpSubInfo->NeedSubType); qMsg->Msg(lpObj->m_Index, "@[Quest] Your item droped."); return true; } } } } } //Start of S3 Quest if ( lpSubInfo->QuestType == 1 && lpSubInfo->NeedTargetMinLevel == -1 ) //Third Quest { if ( lpObj->Class == lpSubInfo->NeedTargetMaxLevel) //READS Monster Class on TargetMax Level Category (for Original Quest.txt) { if ( this->GetQuestState(lpTarget, lpQuestInfo->QuestIndex) == TRUE ) { if ( (rand() % ITEM_QUEST_DROP_PROBABILITY) < lpSubInfo->NeedDropRate) { int itemcount = gObjGetItemCountInIventory(MaxHitUser, lpSubInfo->NeedType, lpSubInfo->NeedSubType, lpSubInfo->ItemLevel); if ( itemcount >= lpSubInfo->NeedNumber) { continue; } dur = 0; x = lpObj->X; y = lpObj->Y; level = lpSubInfo->ItemLevel; type = ItemGetNumberMake(lpSubInfo->NeedType, lpSubInfo->NeedSubType); ItemSerialCreateSend(lpObj->m_Index, lpObj->MapNumber, x, y, type, level, dur, Option1, Option2, Option3, MaxHitUser, 0, 0); LogAddTD("[Season3 Quest] Quest Item Drop [%s]: [%s][%s] (%s) (%d,%d)", lpObj->Name, lpTarget->AccountID, lpTarget->Name, lpQuestInfo->Name, lpSubInfo->NeedType, lpSubInfo->NeedSubType); return true; } } } } if ( lpSubInfo->QuestType == 2 && lpSubInfo->NeedTargetMinLevel == -1 ) //Third Quest for Kill Count { if ( lpObj->Class == lpSubInfo->NeedTargetMaxLevel) //READS Monster Class on TargetMax Level Category (for Original Quest.txt) { if ( this->GetQuestState(lpTarget, lpQuestInfo->QuestIndex) == TRUE ) { if( lpTarget->m_Quest[1] == 0xF6 && lpTarget->MapNumber == 41 ) { if( lpTarget->m_Quest[30] > 10) { lpTarget->m_Quest[30] = 0; } if( lpTarget->m_Quest[31] > 10 ) { lpTarget->m_Quest[31] = 0; } if( lpTarget->m_Quest[32] > 10 ) { lpTarget->m_Quest[32] = 0; } if(lpObj->Class == 409 && lpTarget->m_Quest[30] < 10) { lpTarget->m_Quest[30] += 1; MsgOutput(lpTarget->m_Index, "[Quest] (%d/10) Balram(Hero)", lpTarget->m_Quest[30]); } if(lpObj->Class == 410 && lpTarget->m_Quest[31] < 10) { lpTarget->m_Quest[31] += 1; MsgOutput(lpTarget->m_Index, "[Quest] (%d/10) Death Spirit(Hero)", lpTarget->m_Quest[31]); } if(lpObj->Class == 411 && lpTarget->m_Quest[32] < 10) { lpTarget->m_Quest[32] += 1; lpTarget->m_Quest[34] += 1; MsgOutput(lpTarget->m_Index, "[Quest] (%d/10) Soram(Hero).", lpTarget->m_Quest[32]); } } if( lpTarget->m_Quest[1] == 0xDA && lpTarget->MapNumber == 42 ) { if( lpTarget->m_Quest[34] > 1 ) { lpTarget->m_Quest[34] = 0; } if(lpObj->Class == 412 && lpTarget->m_Quest[34] < 1) { lpTarget->m_Quest[34] += 1; MsgOutput(lpTarget->m_Index, "[Quest] (%d/1) Dark Elf(Hero)", lpTarget->m_Quest[34]); } } //End of S3 Quest } } } // } } foundquest++; if ( foundquest == questcount ) { break; } } return false; }
// ---------------------------------------------------------------------------------------- void CDoubleGoer::ChestDrop(int aIndex, unsigned char Type, unsigned char Map, unsigned char X, unsigned char Y) { LPOBJ lpObj = &gObj[aIndex]; int RandomItem; int Item; unsigned char Skill; unsigned char Luck; unsigned char Opt; unsigned char Level; unsigned char Dur; unsigned char Exe; unsigned char Anc; unsigned char Socket[5]; Socket[0] = 0xFF; Socket[1] = 0xFF; Socket[2] = 0xFF; Socket[3] = 0xFF; Socket[4] = 0xFF; Skill = 0; Luck = 0; Opt = 0; Level = 0; Dur = 0; Exe = 0; Anc = 0; Item = 0; RandomItem = rand()%gDoubleGoer.ItemCount[Type]; Item = ITEMGET(gDoubleGoer.Type[Type][RandomItem],gDoubleGoer.Index[Type][RandomItem]); if ( rand()%1000 < 50 ) { Skill = gDoubleGoer.Skill[Type][RandomItem]; } if ( rand()%1000 < 50 ) { Luck = gDoubleGoer.Luck[Type][RandomItem]; } if ( rand()%1000 < 50 ) { if ( gDoubleGoer.Level[Type][RandomItem] > 0 ) { Level = rand()%(gDoubleGoer.Level[Type][RandomItem]+1); } else { Level = 0; } } if ( rand()%1000 < 50 ) { if ( gDoubleGoer.Opt[Type][RandomItem] > 0 ) { Opt = rand()%(gDoubleGoer.Opt[Type][RandomItem]+1); } else { Opt = 0; } } if ( rand()%1000 < 50 ) { Exe = GetRandomExeOption(gDoubleGoer.Exe[Type][RandomItem]+1); } if ( rand()%1000 < 10 ) { if ( gDoubleGoer.Anc[Type][RandomItem] == 5 || gDoubleGoer.Anc[Type][RandomItem] == 10 ) { Anc = gDoubleGoer.Anc[Type][RandomItem]; } else { Anc = 0; } } if ( rand()%1000 < 50 ) { Socket[0] = gDoubleGoer.Socket[0][Type][RandomItem]; if ( rand()%1000 < 50 ) { Socket[1] = gDoubleGoer.Socket[1][Type][RandomItem]; if ( rand()%1000 < 50 ) { Socket[2] = gDoubleGoer.Socket[2][Type][RandomItem]; if ( rand()%1000 < 50 ) { Socket[3] = gDoubleGoer.Socket[3][Type][RandomItem]; if ( rand()%1000 < 50 ) { Socket[4] = gDoubleGoer.Socket[4][Type][RandomItem]; } } } } } ItemSerialCreateSend(aIndex,Map,X,Y,Item,Level,Dur,Luck,Skill,Opt,aIndex,Exe,Anc,Socket); }