void GCKillPlayerExpSendHook(int aIndex, int TargetIndex, int exp, int AttackDamage, BOOL MSBFlag) { // ----- // ----- OBJECTSTRUCT * lpObj = (OBJECTSTRUCT*) OBJECT_POINTER (aIndex); unsigned int pNewExperience = exp; unsigned int pBonusExp = 0; unsigned int pNewExperenceML = exp; unsigned int pBonusExpML = 0; // ---- if(lpObj->pInventory[8].m_Type == 0x1A50) // Panda { pBonusExp = ((exp * Config.Panda.PetPandaExpirence) / 100); pBonusExpML = ((exp * Config.Panda.PetPandaMLExpirence) / 100); // ---- pNewExperience += pBonusExp; pNewExperenceML += pBonusExpML; // ---- lpObj->Experience += pBonusExp; lpObj->MLExp += pBonusExpML; } if(lpObj->pInventory[10].m_Type == 0x1A4C || lpObj->pInventory[11].m_Type == 0x1A4C) // Panda Ring { pBonusExp = ((exp * Config.Panda.PandaRingExpirence) / 100); pBonusExpML = ((exp * Config.Panda.PandaRingMLExpirence) / 100); // ---- pNewExperience += pBonusExp; pNewExperenceML += pBonusExpML; // ---- lpObj->Experience += pBonusExp; lpObj->MLExp += pBonusExpML; } GCKillPlayerExpSend(aIndex , TargetIndex , pNewExperience , AttackDamage , MSBFlag); }
// ----------------------------------------------------------------------------------------------------------------------- //int VIPEXP = Experience + VIPExp; // ----------------------------------------------------------------------------------------------------------------------- void ExpSystem(int aIndex, int TargetIndex, int Exp, int AttackDamage, BOOL MSBFlag) { if (ExpSystemEnabled = 1) { OBJECTSTRUCT *gObj = (OBJECTSTRUCT*) OBJECT_POINTER (aIndex); unsigned int pNewExperience = Exp; unsigned int pBonusExp = 0; int ExpRes = 0; int ExpDel = (ExpSystempDel+1); int ExpS; if (SQL.ResetS > 30) { ExpS = 200; } if ((SQL.ResetS < 30)||(SQL.ResetS = 30)) { ExpS = 100; } SQL.GetResetCharacter(gObj->Name); ExpRes = (ExpDel-SQL.ResetS); pBonusExp = ((Exp*ExpRes)/100); pNewExperience += pBonusExp; gObj->Experience += pBonusExp; GCKillPlayerExpSend(aIndex,TargetIndex,pNewExperience,AttackDamage,MSBFlag); } else { float * EXPERIENCE = (float *)(CGAddExperience); (*EXPERIENCE) = NormEXP; } }
void CDevilSquareGround::SendScore() { if ( this->m_DevilSquareRankList.size() < 1 ) { return; } BYTE count = 1; int iUserCount = this->m_DevilSquareRankList.size(); int iExp = 0; std::vector<LPOBJ>::iterator Itor = this->m_DevilSquareRankList.begin(); for ( ; Itor != this->m_DevilSquareRankList.end() ; Itor++ ) { memcpy(this->m_DevilSquareScoreInfoTOP10.Score[count].Name , (*(Itor))->Name, MAX_ACCOUNT_LEN); this->m_DevilSquareScoreInfoTOP10.Score[count].TotalScore = (*(Itor))->m_nEventScore; if ( iUserCount <= 6 ) { if ( count < 4 ) // For DS from 0 to 3 { this->m_DevilSquareScoreInfoTOP10.Score[count].BonusZen = this->m_Bonus[count-1][0]; this->m_DevilSquareScoreInfoTOP10.Score[count].BonusExp = this->m_Bonus[count-1][1]; } else { this->m_DevilSquareScoreInfoTOP10.Score[count].BonusZen = this->m_Bonus[3][0]; this->m_DevilSquareScoreInfoTOP10.Score[count].BonusExp = this->m_Bonus[3][1]; } } else { int lc5 = count*100/iUserCount; if ( count == 1 ) { this->m_DevilSquareScoreInfoTOP10.Score[count].BonusZen = this->m_Bonus[0][0]; this->m_DevilSquareScoreInfoTOP10.Score[count].BonusExp = this->m_Bonus[0][1]; } else if ( lc5 <= 30 ) { this->m_DevilSquareScoreInfoTOP10.Score[count].BonusZen = this->m_Bonus[1][0]; this->m_DevilSquareScoreInfoTOP10.Score[count].BonusExp = this->m_Bonus[1][1]; } else if ( lc5 <= 50 ) { this->m_DevilSquareScoreInfoTOP10.Score[count].BonusZen = this->m_Bonus[2][0]; this->m_DevilSquareScoreInfoTOP10.Score[count].BonusExp = this->m_Bonus[2][1]; } else { this->m_DevilSquareScoreInfoTOP10.Score[count].BonusZen = this->m_Bonus[3][0]; this->m_DevilSquareScoreInfoTOP10.Score[count].BonusExp = this->m_Bonus[3][1]; } } count++; if ( count >= 10 ) { break; } } this->m_DevilSquareScoreInfoTOP10.Count = count; int iSize = count * 24 + 5; PHeadSetB((LPBYTE)&this->m_DevilSquareScoreInfoTOP10, 0x93, iSize); count = 1; Itor = this->m_DevilSquareRankList.begin(); LogAddTD("[DevilSquare] Rank [%d]", this->m_iIndex); for ( ; Itor != this->m_DevilSquareRankList.end(); Itor++ ) { if ( iUserCount <= 6 ) { if ( count < 4 ) { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusZen = this->m_Bonus[count-1][0]; this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = this->m_Bonus[count-1][1]; } else { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusZen = this->m_Bonus[3][0]; this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = this->m_Bonus[3][1]; } } else { int lc7 = count*100/iUserCount; if ( count ==1 ) { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusZen = this->m_Bonus[0][0]; this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = this->m_Bonus[0][1]; } else if ( lc7 <= 30 ) { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusZen = this->m_Bonus[1][0]; this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = this->m_Bonus[1][1]; } else if ( lc7 <= 50 ) { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusZen = this->m_Bonus[2][0]; this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = this->m_Bonus[2][1]; } else { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusZen = this->m_Bonus[3][0]; this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = this->m_Bonus[3][1]; } } if ( g_CrywolfSync.GetOccupationState() == 1 && g_iCrywolfApplyMvpPenalty != FALSE) { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = (this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp * g_CrywolfSync.GetGettingExpPenaltyRate()) / 100; } __int64 iExp64 = this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp; CheckItemOptForGetExpEx((*(Itor)),iExp64,TRUE); (*(Itor))->Experience += (DWORD)iExp64; bool ret = gObjLevelUp((*(Itor)), &iExp64, 0, EVENT_TYPE_DEVILSQUARE); (*(Itor))->m_nEventMoney = this->m_DevilSquareScoreInfoTOP10.Score[0].BonusZen; if ( gObjCheckMaxZen((*(Itor))->m_Index, (*(Itor))->m_nEventMoney) == FALSE ) { int Zen = MAX_ZEN - (*(Itor))->Money; (*(Itor))->Money += Zen; } else { (*(Itor))->Money += (*(Itor))->m_nEventMoney; } GCMoneySend((*(Itor))->m_Index, (*(Itor))->Money); if ( ret == true ) { GCKillPlayerExpSend((*(Itor))->m_Index, (WORD)-1, this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp, 0, 0); } if( count == 1 ) { g_EventItemBagManager.OpenSpecial(EventBagSpecial::DevilSquare1, (*(Itor))->m_Index, (*(Itor))->MapNumber, (*(Itor))->X, (*(Itor))->Y); } else if( count == 2) { g_EventItemBagManager.OpenSpecial(EventBagSpecial::DevilSquare2, (*(Itor))->m_Index, (*(Itor))->MapNumber, (*(Itor))->X, (*(Itor))->Y); } else if( count == 3) { g_EventItemBagManager.OpenSpecial(EventBagSpecial::DevilSquare3, (*(Itor))->m_Index, (*(Itor))->MapNumber, (*(Itor))->X, (*(Itor))->Y); } this->SendRankingInfo((*(Itor))); LogAddTD("Rank :[%d] : [%s][%s][%d][%d][%d]", count, (*(Itor))->AccountID, (*(Itor))->Name, (*(Itor))->m_nEventMoney, (*(Itor))->m_nEventExp, (*(Itor))->m_nEventScore); memcpy(this->m_DevilSquareScoreInfoTOP10.Score[0].Name , (*(Itor))->Name, MAX_ACCOUNT_LEN); this->m_DevilSquareScoreInfoTOP10.Score[0].TotalScore = (*(Itor))->m_nEventScore; this->m_DevilSquareScoreInfoTOP10.MyRank = count; count++; DataSend((*(Itor))->m_Index, (BYTE *)&this->m_DevilSquareScoreInfoTOP10 , iSize); #ifdef POINTEX g_ShopPointEx.AddEventBonus((*(Itor))->m_Index, ShopPointExEvent::DS); #endif #if( __4GAMERS__ == 1 ) g_Achievements.GD_UpdateEventDataDS((*(Itor)), (*(Itor))->m_nEventExp, (*(Itor))->m_nEventScore); #endif (*(Itor))->m_nEventScore = 0; (*(Itor))->m_nEventMoney = 0; (*(Itor))->m_nEventExp = 0; } }
void CDevilSquareGround::SendScore() { if ( this->m_DevilSquareRankList.size() < 1 ) { return; } BYTE count = 1; int iUserCount = this->m_DevilSquareRankList.size(); int iExp = 0; for ( std::vector<OBJECTSTRUCT *>::iterator Itor = this->m_DevilSquareRankList.begin() ; Itor != this->m_DevilSquareRankList.end() ; Itor++ ) { memcpy(this->m_DevilSquareScoreInfoTOP10.Score[count].Name , (*(Itor))->Name, MAX_ACCOUNT_LEN); this->m_DevilSquareScoreInfoTOP10.Score[count].TotalScore = (*(Itor))->m_nEventScore; if ( iUserCount <= 6 ) { if ( count < 4 ) { this->m_DevilSquareScoreInfoTOP10.Score[count].BonusZen = this->m_Bonus[count-1][0]; this->m_DevilSquareScoreInfoTOP10.Score[count].BonusExp = this->m_Bonus[count-1][1]; } else { this->m_DevilSquareScoreInfoTOP10.Score[count].BonusZen = this->m_Bonus[3][0]; this->m_DevilSquareScoreInfoTOP10.Score[count].BonusExp = this->m_Bonus[3][1]; } } else { int lc5 = count*100/iUserCount; if ( count == 1 ) { this->m_DevilSquareScoreInfoTOP10.Score[count].BonusZen = this->m_Bonus[0][0]; this->m_DevilSquareScoreInfoTOP10.Score[count].BonusExp = this->m_Bonus[0][1]; } else if ( lc5 <= 30 ) { this->m_DevilSquareScoreInfoTOP10.Score[count].BonusZen = this->m_Bonus[1][0]; this->m_DevilSquareScoreInfoTOP10.Score[count].BonusExp = this->m_Bonus[1][1]; } else if ( lc5 <= 50 ) { this->m_DevilSquareScoreInfoTOP10.Score[count].BonusZen = this->m_Bonus[2][0]; this->m_DevilSquareScoreInfoTOP10.Score[count].BonusExp = this->m_Bonus[2][1]; } else { this->m_DevilSquareScoreInfoTOP10.Score[count].BonusZen = this->m_Bonus[3][0]; this->m_DevilSquareScoreInfoTOP10.Score[count].BonusExp = this->m_Bonus[3][1]; } } count++; if ( count >= 10 ) { break; } } this->m_DevilSquareScoreInfoTOP10.Count = count; int iSize = count * 24 + 5; PHeadSetB((LPBYTE)&this->m_DevilSquareScoreInfoTOP10, 0x93, iSize); count = 1; std::vector<OBJECTSTRUCT *>::iterator Itor = this->m_DevilSquareRankList.begin(); LogAddTD("[DevilSquare] Rank [%d]", this->m_iIndex); for ( ; Itor != this->m_DevilSquareRankList.end(); Itor++ ) { if ( iUserCount <= 6 ) { if ( count < 4 ) //webzen fixed on season 3.0 { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusZen = this->m_Bonus[count-1][0]; this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = this->m_Bonus[count-1][1]; } else { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusZen = this->m_Bonus[3][0]; this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = this->m_Bonus[3][1]; } } else { int lc7 = count*100/iUserCount; if ( count ==1 ) { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusZen = this->m_Bonus[0][0]; this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = this->m_Bonus[0][1]; } else if ( lc7 <= 30 ) { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusZen = this->m_Bonus[1][0]; this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = this->m_Bonus[1][1]; } else if ( lc7 <= 50 ) { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusZen = this->m_Bonus[2][0]; this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = this->m_Bonus[2][1]; } else { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusZen = this->m_Bonus[3][0]; this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = this->m_Bonus[3][1]; } } if ( g_CrywolfSync.GetOccupationState() == 1 && Configs.CrywolfApplyMvpPenalty != FALSE) { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = (this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp * g_CrywolfSync.GetGettingExpPenaltyRate()) / 100; } __int64 exp = this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp; gObjSealUserSetExp((*(Itor)), exp, TRUE); //Seal Exp (Season3 add-on) (*(Itor))->Experience += (int)exp; bool ret = gObjLevelUp((*(Itor)), exp, 0, EVENT_TYPE_DEVILSQUARE); (*(Itor))->m_nEventMoney = this->m_DevilSquareScoreInfoTOP10.Score[0].BonusZen; if ( gObjCheckMaxZen((*(Itor))->m_Index, (*(Itor))->m_nEventMoney) == FALSE ) { int Zen = MAX_ZEN - (*(Itor))->Money; (*(Itor))->Money += Zen; } else { (*(Itor))->Money += (*(Itor))->m_nEventMoney; } GCMoneySend((*(Itor))->m_Index, (*(Itor))->Money); if ( ret == true ) { GCKillPlayerExpSend((*(Itor))->m_Index, (WORD)-1, exp, 0, 0);//Season 4.5 changed } this->SendRankingInfo((*(Itor))); LogAddTD("Rank :[%d] : [%s][%s][%d][%d][%d]", count, (*(Itor))->AccountID, (*(Itor))->Name, (*(Itor))->m_nEventMoney, (*(Itor))->m_nEventExp, (*(Itor))->m_nEventScore); memcpy(this->m_DevilSquareScoreInfoTOP10.Score[0].Name , (*(Itor))->Name, MAX_ACCOUNT_LEN); this->m_DevilSquareScoreInfoTOP10.Score[0].TotalScore = (*(Itor))->m_nEventScore; this->m_DevilSquareScoreInfoTOP10.MyRank = count; count++; DataSend((*(Itor))->m_Index, (LPBYTE)&this->m_DevilSquareScoreInfoTOP10 , iSize); (*(Itor))->m_nEventScore = 0; (*(Itor))->m_nEventMoney = 0; (*(Itor))->m_nEventExp = 0; } }
void CDevilSquare::gObjExpParty(LPOBJ lpObj, LPOBJ lpTargetObj, int AttackDamage, BOOL MSBFlag) { int n; __int64 exp; __int64 maxexp = 0; __int64 totalexp; int level = ((lpTargetObj->Level + 25) * lpTargetObj->Level) / 3; int number; int partynum = 0; int totallevel = 0; int partylevel; int partycount; int dis[6]; int viewplayer = 0; int viewpercent = 100; BOOL bApplaySetParty = FALSE; bool bCheckSetParty[6]; partynum = lpObj->PartyNumber; LPOBJ lpPartyObj; int toplevel = 0; int distance; for (n=0; n<MAX_USER_IN_PARTY; n++) { number = gParty.m_PartyS[partynum].Number[n]; if ( number >= 0 ) { lpPartyObj = &gObj[number]; distance = gObjCalDistance(lpObj,lpPartyObj); if( distance < 10 ) { if(lpPartyObj->Level > toplevel) { toplevel = lpPartyObj->Level; } } } } if ( OBJMAX_RANGE(partynum) == FALSE ) { LogAdd("error : %s %d", __FILE__, __LINE__); return; } partycount = gParty.m_PartyS[partynum].Count; for ( n =0; n<MAX_USER_IN_PARTY; n++) { number = gParty.m_PartyS[partynum].Number[n]; if ( number >= 0 ) { lpPartyObj = &gObj[number]; if ( lpTargetObj->MapNumber ==lpPartyObj->MapNumber ) { dis[n] = gObjCalDistance(lpTargetObj, &gObj[number]); if ( dis[n] < 10 ) { lpPartyObj = &gObj[number]; if ( toplevel >= (lpPartyObj->Level + 200 ) ) // #formula { totallevel = totallevel + lpPartyObj->Level + 200; } else { totallevel += lpPartyObj->Level; } viewplayer++; bCheckSetParty[lpPartyObj->Class] = true; } } } } viewpercent += gParty.GetExpBonus(lpObj, lpTargetObj, partynum); if ( viewplayer > 1 ) { partylevel = totallevel / viewplayer; } else { partylevel = totallevel; } if ( (lpTargetObj->Level +10) < partylevel ) { level = (level * (lpTargetObj->Level+10) ) / partylevel; } if ( lpTargetObj->Level >= 65 ) { if ( viewplayer == 1 ) { level += (lpTargetObj->Level - 64) * (lpTargetObj->Level/ 4); } else { level += (int)(200.0 - (lpObj->Level * 0.2)); } } if ( level > 0 ) { maxexp = level / 2; } else { level = 0; } if ( maxexp < 1 ) { totalexp = level; } else { totalexp = level + rand()%maxexp; } if ( lpTargetObj->Type == OBJ_MONSTER ) { lpTargetObj->Money = (int)totalexp; } for ( n=0; n<MAX_USER_IN_PARTY; n++) { number = gParty.m_PartyS[partynum].Number[n]; if ( number >= 0 ) { lpPartyObj = &gObj[number]; if ( lpTargetObj->MapNumber == lpPartyObj->MapNumber ) { if ( dis[n] < 10 ) { DWORD myexp = gLevelExperience[lpPartyObj->Level]; exp = ((totalexp * viewpercent* lpPartyObj->Level ) / totallevel ) / 100; if ( exp > myexp ) { exp = myexp; } if( lpPartyObj->Type == OBJ_USER ) { if ( lpTargetObj->Type == OBJ_USER ) { exp = 0; } } if ( g_MasterExp.IsEnabled(lpPartyObj) == FALSE ) { exp += (exp * m_ObjBill[lpPartyObj->m_Index].GetExp()) / 100; exp = int(exp * g_MapRateInfo.GetExp(lpPartyObj->MapNumber)); } if ( g_CrywolfSync.GetOccupationState() == 1 && g_iCrywolfApplyMvpPenalty != FALSE) { exp = (exp * g_CrywolfSync.GetGettingExpPenaltyRate()) / 100; } if ( exp > 0 ) { if ( lpPartyObj->Type == OBJ_USER ) { CheckItemOptForGetExpEx(lpPartyObj,exp,0); lpPartyObj->Experience += (DWORD)exp; lpPartyObj->m_nEventExp += (int)exp; if ( gObjLevelUp(lpPartyObj, &exp, lpTargetObj->Class, EVENT_TYPE_PARTY) == false ) { continue; } } } if ( lpPartyObj->Type == OBJ_USER ) { GCKillPlayerExpSend(lpPartyObj->m_Index, lpTargetObj->m_Index,(int)exp, AttackDamage, MSBFlag); } } } } } }
void CDevilSquare::gObjExpParty(LPOBJ lpObj, LPOBJ lpTargetObj, int AttackDamage, BOOL MSBFlag) { int n; DWORD exp; DWORD maxexp = 0; int totalexp; int level = ((lpTargetObj->Level + 25) * lpTargetObj->Level) / 3; int number; int partynum = 0; int totallevel = 0; int partylevel; int partycount; int dis[MAX_USER_IN_PARTY]; int viewplayer = 0; int viewpercent = 100; BOOL bApplaySetParty = FALSE; bool bCheckSetParty[MAX_TYPE_PLAYER]; partynum = lpObj->PartyNumber; LPOBJ lpPartyObj; int toplevel = 0; for (n=0;n<MAX_USER_IN_PARTY;n++) { number = gParty.m_PartyS[partynum].Number[n]; if ( number >= 0 ) { lpPartyObj = &gObj[number]; if ( lpPartyObj->Level > toplevel ) { toplevel = lpPartyObj->Level; } } } if ( OBJMAX_RANGE(partynum) == FALSE ) { LogAdd("error : %s %d", __FILE__, __LINE__); return; } partycount = gParty.m_PartyS[partynum].Count; for ( n =0;n<MAX_USER_IN_PARTY;n++) { number = gParty.m_PartyS[partynum].Number[n]; if ( number >= 0 ) { lpPartyObj = &gObj[number]; if ( lpTargetObj->MapNumber ==lpPartyObj->MapNumber ) { dis[n] = gObjCalDistance(lpTargetObj, &gObj[number]); if ( dis[n] < 10 ) { lpPartyObj = &gObj[number]; if ( toplevel >= (lpPartyObj->Level + 200 ) ) // #formula { totallevel = totallevel + lpPartyObj->Level + 200; } else { totallevel += lpPartyObj->Level; } viewplayer++; bCheckSetParty[lpPartyObj->Class] = true; } } } } if ( bCheckSetParty[0] != false && bCheckSetParty[1] != false && bCheckSetParty[2] != false ) { bApplaySetParty = TRUE; } if ( viewplayer > 1 ) { if ( bApplaySetParty != FALSE ) { if ( viewplayer == 3 ) { viewpercent = 230; } else if ( viewplayer == 4 ) { viewpercent = 270; } else if ( viewplayer >= 5 ) { viewpercent = 300; } else { viewpercent = 120; } } else { if ( viewplayer == 2 ) { viewpercent = 160; } else if ( viewplayer == 3 ) { viewpercent = 180; } else if ( viewplayer == 4 ) { viewpercent = 200; } else if ( viewplayer >= 5 ) { viewpercent = 220; } else { viewpercent = 120; } } partylevel = totallevel / viewplayer; } else { partylevel = totallevel; } if ( (lpTargetObj->Level +10) < partylevel ) { level = (level * (lpTargetObj->Level+10) ) / partylevel; } if ( lpTargetObj->Level >= 65 ) { if ( viewplayer == 1 ) { level += (lpTargetObj->Level - 64) * (lpTargetObj->Level/ 4); } else { level += int(200.0 - (lpObj->Level * 0.2)); } } if ( level > 0 ) { maxexp = level / 2; } else { level = 0; } if ( maxexp < 1 ) { totalexp = level; } else { totalexp = level + Random(0,maxexp); } if ( lpTargetObj->Type == OBJ_MONSTER ) { lpTargetObj->Money = totalexp; } for ( n=0;n<MAX_USER_IN_PARTY;n++) { number = gParty.m_PartyS[partynum].Number[n]; if ( number >= 0 ) { lpPartyObj = &gObj[number]; if ( lpTargetObj->MapNumber == lpPartyObj->MapNumber ) { if ( dis[n] < 10 ) { DWORD myexp = gLevelExperience[lpPartyObj->Level]; exp = ((totalexp * viewpercent* lpPartyObj->Level ) / totallevel ) / 100; if ( exp > myexp ) { exp = myexp; } if( lpPartyObj->Type == OBJ_USER ) { if ( lpTargetObj->Type == OBJ_USER ) { exp = 0; } } //exp *= (DWORD)gAddExperience; exp *= VipSystem_MapExp[lpObj->VipType][lpObj->MapNumber]; if ( lpPartyObj->m_wExprienceRate == 0 ) exp = 0; else exp = DWORD( (double)exp * ((double)lpPartyObj->m_wExprienceRate / 100.0) ); if ( g_CrywolfSync.GetOccupationState() == 1 && g_iCrywolfApplyMvpPenalty != FALSE) { exp = (exp * g_CrywolfSync.GetGettingExpPenaltyRate()) / 100; } if ( exp > 0 ) { if ( lpPartyObj->Type == OBJ_USER ) { if ( lpPartyObj->m_wExprienceRate > 0 ) { lpPartyObj->Experience += exp; lpPartyObj->m_nEventExp += exp; } if ( gObjLevelUp(lpPartyObj, exp, lpTargetObj->Class, EVENT_TYPE_PARTY) == false ) { continue; } } } if ( lpPartyObj->Type == OBJ_USER ) { if ( lpPartyObj->m_wExprienceRate > 0 ) { GCKillPlayerExpSend(lpPartyObj->m_Index, lpTargetObj->m_Index, exp, AttackDamage, MSBFlag); } } } } } } }
void CDevilSquareGround::SendScore() { if ( this->m_DevilSquareRankList.size() < 1 ) { return; } BYTE count = 1; int iUserCount = this->m_DevilSquareRankList.size(); int iExp = 0; std::vector<OBJECTSTRUCT *>::iterator Itor; for (Itor = this->m_DevilSquareRankList.begin() ; Itor != this->m_DevilSquareRankList.end() ; Itor++ ) { memcpy(this->m_DevilSquareScoreInfoTOP10.Score[count].Name , (*(Itor))->Name, MAX_ACCOUNT_LEN); this->m_DevilSquareScoreInfoTOP10.Score[count].TotalScore = (*(Itor))->m_nEventScore; if ( iUserCount <= 7 )//6 { if ( count < 4 ) // For DS from 0 to 3 { this->m_DevilSquareScoreInfoTOP10.Score[count].BonusZen = this->m_Bonus[count-1][0]; this->m_DevilSquareScoreInfoTOP10.Score[count].BonusExp = this->m_Bonus[count-1][1]; } else { this->m_DevilSquareScoreInfoTOP10.Score[count].BonusZen = this->m_Bonus[3][0]; this->m_DevilSquareScoreInfoTOP10.Score[count].BonusExp = this->m_Bonus[3][1]; } } else { int lc5 = count*100/iUserCount; if ( count == 1 ) { this->m_DevilSquareScoreInfoTOP10.Score[count].BonusZen = this->m_Bonus[0][0]; this->m_DevilSquareScoreInfoTOP10.Score[count].BonusExp = this->m_Bonus[0][1]; } else if ( lc5 <= 30 ) { this->m_DevilSquareScoreInfoTOP10.Score[count].BonusZen = this->m_Bonus[1][0]; this->m_DevilSquareScoreInfoTOP10.Score[count].BonusExp = this->m_Bonus[1][1]; } else if ( lc5 <= 50 ) { this->m_DevilSquareScoreInfoTOP10.Score[count].BonusZen = this->m_Bonus[2][0]; this->m_DevilSquareScoreInfoTOP10.Score[count].BonusExp = this->m_Bonus[2][1]; } else { this->m_DevilSquareScoreInfoTOP10.Score[count].BonusZen = this->m_Bonus[3][0]; this->m_DevilSquareScoreInfoTOP10.Score[count].BonusExp = this->m_Bonus[3][1]; } } count++; if ( count >= 10 ) { break; } } this->m_DevilSquareScoreInfoTOP10.Count = count; int iSize = count * 24 + 5; PHeadSetB((LPBYTE)&this->m_DevilSquareScoreInfoTOP10, 0x93, iSize); count = 1; Itor = this->m_DevilSquareRankList.begin(); LogAddTD("[DevilSquare] Rank [%d]", this->m_iIndex); for ( ; Itor != this->m_DevilSquareRankList.end(); Itor++ ) { if ( (*(Itor))->Type != OBJ_USER ) continue; if ( iUserCount <= 7 )//6 { if ( count < 3 ) { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusZen = this->m_Bonus[count-1][0]; this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = this->m_Bonus[count-1][1]; } else { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusZen = this->m_Bonus[3][0]; this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = this->m_Bonus[3][1]; } } else { int lc7 = count*100/iUserCount; if ( count ==1 ) { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusZen = this->m_Bonus[0][0]; this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = this->m_Bonus[0][1]; } else if ( lc7 <= 30 ) { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusZen = this->m_Bonus[1][0]; this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = this->m_Bonus[1][1]; } else if ( lc7 <= 50 ) { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusZen = this->m_Bonus[2][0]; this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = this->m_Bonus[2][1]; } else { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusZen = this->m_Bonus[3][0]; this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = this->m_Bonus[3][1]; } } if ( g_CrywolfSync.GetOccupationState() == CRYWOLF_OCCUPATION_FAILED && g_iCrywolfApplyMvpPenalty != FALSE) { #if (PACK_EDITION>=2) if ((VipSystem.VipIsApplyCWExpPenalty == 0)&&((*(Itor))->Vip >= 1)) { } else { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = (this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp * g_CrywolfSync.GetGettingExpPenaltyRate()) / 100; } #else this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = (this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp * g_CrywolfSync.GetGettingExpPenaltyRate()) / 100; #endif } if ( ((*(Itor))->m_wExprienceRate + (*(Itor))->MasterCharacterInfo->IncExperience) == 0 ) iExp = 0; else { if ((*(Itor))->m_btDisableExpGain == 0 ) { iExp = this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp; (*(Itor))->Experience += iExp; } } //(*(Itor))->Experience += this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp; int ret = -1; int LevelUp = 0; if ( ((*(Itor))->m_wExprienceRate + (*(Itor))->MasterCharacterInfo->IncExperience) > 0 && (*(Itor))->m_btDisableExpGain == 0 ) { gObjSetExpPetItem((*(Itor))->m_Index, iExp); int iMAX_LEVCOUNT = 0; ret = iExp; while ( ret > 0 ) { if ( ret > 0 ) { ret = gObjLevelUp((*(Itor)), ret, 0, EVENT_TYPE_DEVILSQUARE, LevelUp); } iMAX_LEVCOUNT++; if (iMAX_LEVCOUNT > 5) break; } if ((ret < 0)&&(iMAX_LEVCOUNT > 1)) ret=0; } (*(Itor))->m_nEventMoney = this->m_DevilSquareScoreInfoTOP10.Score[0].BonusZen; if ( (__int64)((*(Itor))->m_Index + (*(Itor))->m_nEventMoney) > (__int64)MAX_ZEN ) { int Zen = MAX_ZEN - (*(Itor))->Money; (*(Itor))->Money += Zen; } else { (*(Itor))->Money += (*(Itor))->m_nEventMoney; } GCMoneySend((*(Itor))->m_Index, (*(Itor))->Money); if ( ret >= 0 ) { if ( ((*(Itor))->m_wExprienceRate + (*(Itor))->MasterCharacterInfo->IncExperience) > 0 && (*(Itor))->m_btDisableExpGain == 0 ) { if(LevelUp == 0) GCKillPlayerExpSend((*(Itor))->m_Index, (WORD)-1, iExp, 0, 0); } } this->SendRankingInfo((*(Itor))); LogAddTD("Rank :[%d] : [%s][%s][%d][%d][%d]", count, (*(Itor))->AccountID, (*(Itor))->Name, (*(Itor))->m_nEventMoney, (*(Itor))->m_nEventExp, (*(Itor))->m_nEventScore); memcpy(this->m_DevilSquareScoreInfoTOP10.Score[0].Name , (*(Itor))->Name, MAX_ACCOUNT_LEN); this->m_DevilSquareScoreInfoTOP10.Score[0].TotalScore = (*(Itor))->m_nEventScore; if ( ((*(Itor))->m_wExprienceRate + (*(Itor))->MasterCharacterInfo->IncExperience) == 0 || (*(Itor))->m_btDisableExpGain == 1 ) { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = 0; } else { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = iExp; } this->m_DevilSquareScoreInfoTOP10.MyRank = count; count++; DataSend((*(Itor))->m_Index, (BYTE *)&this->m_DevilSquareScoreInfoTOP10 , iSize); (*(Itor))->m_nEventScore = 0; (*(Itor))->m_nEventMoney = 0; (*(Itor))->m_nEventExp = 0; } }
void CDevilSquareGround::SendScore() { if ( this->m_DevilSquareRankList.size() < 1 ) { return; } BYTE count = 1; int iUserCount = this->m_DevilSquareRankList.size(); int iExp = 0; std::vector<OBJECTSTRUCT *>::iterator Itor = this->m_DevilSquareRankList.begin(); for (Itor = this->m_DevilSquareRankList.begin() ; Itor != this->m_DevilSquareRankList.end() ; Itor++ ) { memcpy(this->m_DevilSquareScoreInfoTOP10.Score[count].Name , (*(Itor))->Name, MAX_ACCOUNT_LEN); this->m_DevilSquareScoreInfoTOP10.Score[count].TotalScore = (*(Itor))->m_nEventScore; if ( iUserCount <= 6 ) { if ( count < 4 ) // For DS from 0 to 3 { this->m_DevilSquareScoreInfoTOP10.Score[count].BonusZen = this->m_Bonus[count-1][0]; this->m_DevilSquareScoreInfoTOP10.Score[count].BonusExp = this->m_Bonus[count-1][1]; } else { this->m_DevilSquareScoreInfoTOP10.Score[count].BonusZen = this->m_Bonus[3][0]; this->m_DevilSquareScoreInfoTOP10.Score[count].BonusExp = this->m_Bonus[3][1]; } } else { int lc5 = count*100/iUserCount; if ( count == 1 ) { this->m_DevilSquareScoreInfoTOP10.Score[count].BonusZen = this->m_Bonus[0][0]; this->m_DevilSquareScoreInfoTOP10.Score[count].BonusExp = this->m_Bonus[0][1]; } else if ( lc5 <= 30 ) { this->m_DevilSquareScoreInfoTOP10.Score[count].BonusZen = this->m_Bonus[1][0]; this->m_DevilSquareScoreInfoTOP10.Score[count].BonusExp = this->m_Bonus[1][1]; } else if ( lc5 <= 50 ) { this->m_DevilSquareScoreInfoTOP10.Score[count].BonusZen = this->m_Bonus[2][0]; this->m_DevilSquareScoreInfoTOP10.Score[count].BonusExp = this->m_Bonus[2][1]; } else { this->m_DevilSquareScoreInfoTOP10.Score[count].BonusZen = this->m_Bonus[3][0]; this->m_DevilSquareScoreInfoTOP10.Score[count].BonusExp = this->m_Bonus[3][1]; } } count++; if ( count >= 10 ) { break; } } this->m_DevilSquareScoreInfoTOP10.Count = count; int iSize = count * 24 + 5; PHeadSetB((LPBYTE)&this->m_DevilSquareScoreInfoTOP10, 0x93, iSize); count = 1; Itor = this->m_DevilSquareRankList.begin(); LogAdd("[DevilSquare] Rank [%d]", this->m_iIndex); for ( ; Itor != this->m_DevilSquareRankList.end(); Itor++ ) { if ( iUserCount <= 6 ) { if ( count < 3 ) { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusZen = this->m_Bonus[count-1][0]; this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = this->m_Bonus[count-1][1]; } else { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusZen = this->m_Bonus[3][0]; this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = this->m_Bonus[3][1]; } } else { int lc7 = count*100/iUserCount; if ( count ==1 ) { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusZen = this->m_Bonus[0][0]; this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = this->m_Bonus[0][1]; } else if ( lc7 <= 30 ) { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusZen = this->m_Bonus[1][0]; this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = this->m_Bonus[1][1]; } else if ( lc7 <= 50 ) { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusZen = this->m_Bonus[2][0]; this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = this->m_Bonus[2][1]; } else { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusZen = this->m_Bonus[3][0]; this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = this->m_Bonus[3][1]; } } if ( g_CrywolfSync.GetOccupationState() == 1 && g_iCrywolfApplyMvpPenalty != FALSE) { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = (this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp * g_CrywolfSync.GetGettingExpPenaltyRate()) / 100; } /*if ( iExp > 0 ) { if ( lpObj->Type == OBJ_USER ) { if ( lpObj->m_wExprienceRate > 0 ) { lpObj->Experience += iExp; lpObj->m_nEventExp += iExp; } } }*/ if ( (*(Itor))->m_wExprienceRate == 0 ) iExp = 0; else { iExp = this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp; (*(Itor))->Experience += iExp; } //(*(Itor))->Experience += this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp; bool ret = false; if ( (*(Itor))->m_wExprienceRate > 0 ) { ret = gObjLevelUp((*(Itor)), iExp, 0, EVENT_TYPE_DEVILSQUARE); } (*(Itor))->m_nEventMoney = this->m_DevilSquareScoreInfoTOP10.Score[0].BonusZen; if ( gObjCheckMaxZen((*(Itor))->m_Index, (*(Itor))->m_nEventMoney) == FALSE ) { int Zen = MAX_ZEN - (*(Itor))->Money; (*(Itor))->Money += Zen; } else { (*(Itor))->Money += (*(Itor))->m_nEventMoney; } GCMoneySend((*(Itor))->m_Index, (*(Itor))->Money); if ( ret == true ) { if ( (*(Itor))->m_wExprienceRate > 0 ) { GCKillPlayerExpSend((*(Itor))->m_Index, (WORD)-1, iExp, 0, 0); } } this->SendRankingInfo((*(Itor))); LogAdd("Rank :[%d] : [%s][%s][%d][%d][%d]", count, (*(Itor))->AccountID, (*(Itor))->Name, (*(Itor))->m_nEventMoney, (*(Itor))->m_nEventExp, (*(Itor))->m_nEventScore); memcpy(this->m_DevilSquareScoreInfoTOP10.Score[0].Name , (*(Itor))->Name, MAX_ACCOUNT_LEN); this->m_DevilSquareScoreInfoTOP10.Score[0].TotalScore = (*(Itor))->m_nEventScore; if ( (*(Itor))->m_wExprienceRate == 0 ) { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = 0; } else { this->m_DevilSquareScoreInfoTOP10.Score[0].BonusExp = iExp; } this->m_DevilSquareScoreInfoTOP10.MyRank = count; count++; DataSend((*(Itor))->m_Index, (BYTE *)&this->m_DevilSquareScoreInfoTOP10 , iSize); (*(Itor))->m_nEventScore = 0; (*(Itor))->m_nEventMoney = 0; (*(Itor))->m_nEventExp = 0; } }
void GCKillPlayerExpSendHook(int aIndex, int TargetIndex, int exp, int AttackDamage, BOOL MSBFlag) { // ----- // ----- OBJECTSTRUCT * lpObj = (OBJECTSTRUCT*) OBJECT_POINTER (aIndex); unsigned int pNewExperience = exp; unsigned int pBonusExp = 0; unsigned int pNewExperenceML = exp; unsigned int pBonusExpML = 0; // ---- if(lpObj->pInventory[8].m_Type == 0x1A50) // Panda { pBonusExp = ((exp * Config.Panda.PetPandaExpirence) / 100); pBonusExpML = ((exp * Config.Panda.PetPandaMLExpirence) / 100); // ---- pNewExperience += pBonusExp; pNewExperenceML += pBonusExpML; // ---- lpObj->Experience += pBonusExp; lpObj->MLExp += pBonusExpML; } if(lpObj->pInventory[10].m_Type == 0x1A4C || lpObj->pInventory[11].m_Type == 0x1A4C) // Panda Ring { pBonusExp = ((exp * Config.Panda.PandaRingExpirence) / 100); pBonusExpML = ((exp * Config.Panda.PandaRingMLExpirence) / 100); // ---- pNewExperience += pBonusExp; pNewExperenceML += pBonusExpML; // ---- lpObj->Experience += pBonusExp; lpObj->MLExp += pBonusExpML; } //VIPSystem if(Config.VIP.Enabled && AddTab[lpObj->m_Index].VIP_Type > 0) { int VIPInfo = AddTab[lpObj->m_Index].VIP_Type; pBonusExp = ((exp * Config.VIP.VIPState[VIPInfo].BonusExp) / 100); pBonusExpML = ((exp * Config.VIP.VIPState[VIPInfo].BonusExp) / 100); // ---- pNewExperience += pBonusExp; pNewExperenceML += pBonusExpML; // ---- lpObj->Experience += pBonusExp; lpObj->MLExp += pBonusExpML; } //MapSystem Module Exp if(MapSystem.Enabled && MapSystem.Maps[lpObj->MapNumber].Exp != 0) { pBonusExp = ((exp * MapSystem.Maps[lpObj->MapNumber].Exp) / 100); pBonusExpML = ((exp * MapSystem.Maps[lpObj->MapNumber].Exp) / 100); // ---- pNewExperience += pBonusExp; pNewExperenceML += pBonusExpML; // ---- lpObj->Experience += pBonusExp; lpObj->MLExp += pBonusExpML; } GCKillPlayerExpSend(aIndex , TargetIndex , pNewExperience , AttackDamage , MSBFlag); }