void AutoExpClass__AddExp(void * lpParam) { PMSG_KILLPLAYER pkillMsg; PHeadSetBE((LPBYTE)&pkillMsg, 0x16, sizeof(pkillMsg)); while(AutoExp.Enabled) { Sleep(AutoExp.Time); for ( int n = OBJ_STARTUSERINDEX ; n < OBJMAX ; n++) { if ( gObj[n].Connected == PLAYER_PLAYING ) { if ( gObj[n].Type == OBJ_USER ) { if((gObj[n].Level < ReadConfig.Max_Normal_Level)||(gObj[n].MasterCharacterInfo->MasterLevel < ReadConfig.Max_Master_Level)) { if(gObjItsInSafeZone(gObj[n].m_Index) == 1)//If safezone { int AddExp = 0; AddExp = (int)(AutoExp.BaseExp * gObj[n].Level) ; if(AddExp > 0x0FFFF) AddExp = 65534; if(AddExp > 0) { pkillMsg.NumberH = 0xFF; pkillMsg.NumberL = 0xFF; pkillMsg.ExpH = SET_NUMBERH(AddExp); pkillMsg.ExpL = SET_NUMBERL(AddExp); pkillMsg.DamageH = SET_NUMBERH(0x00); pkillMsg.DamageL = SET_NUMBERL(0x00); DataSend(gObj[n].m_Index, (UCHAR*)&pkillMsg, pkillMsg.h.size); gObjSetExpPetItem(n, AddExp); int LevelUp = 0; gObjLevelUp(&gObj[n],AddExp,gObj[n].Class,EVENT_TYPE_AUTOEXP,LevelUp); } } } } } } } }
int CCrywolfUtil::CrywolfMVPLevelUp(int iUserIndex, int iAddExp) { if ( !OBJMAX_RANGE(iUserIndex ) ) return 0; int iLEFT_EXP = 0; LogAddTD("[ Crywolf ][MVP Exp.] : [%s][%s](%d) %u %d", gObj[iUserIndex].AccountID, gObj[iUserIndex].Name, gObj[iUserIndex].Level, gObj[iUserIndex].Experience, iAddExp); LogAddTD("Experience : Map[%d]-(%d,%d) [%s][%s](%d) %u %d MonsterIndex : %d, EventType : %d", gObj[iUserIndex].MapNumber, gObj[iUserIndex].X, gObj[iUserIndex].Y, // #error Deathway - Must be Y gObj[iUserIndex].AccountID, gObj[iUserIndex].Name, gObj[iUserIndex].Level, gObj[iUserIndex].Experience, iAddExp, 0, EVENT_TYPE_CRYWOLF); gObjSetExpPetItem(iUserIndex, iAddExp); if ( gObj[iUserIndex].Level >= MAX_CHAR_LEVEL ) { GCServerMsgStringSend(lMsg.Get(MSGGET(4, 112)), gObj[iUserIndex].m_Index, 1); return 0; } if ( (gObj[iUserIndex].Experience + iAddExp) < gObj[iUserIndex].NextExp ) { gObj[iUserIndex].Experience += iAddExp; } else { iLEFT_EXP = gObj[iUserIndex].Experience + iAddExp - gObj[iUserIndex].NextExp; gObj[iUserIndex].Experience = gObj[iUserIndex].NextExp; gObj[iUserIndex].Level++; if ( gObj[iUserIndex].Class == CLASS_DARKLORD || gObj[iUserIndex].Class == CLASS_MAGUMSA ) { gObj[iUserIndex].LevelUpPoint += gLevelUpPointMGDL; } else { gObj[iUserIndex].LevelUpPoint += gLevelUpPointNormal; } if ( gObj[iUserIndex].PlusStatQuestClear != false ) { gObj[iUserIndex].LevelUpPoint++; LogAddTD("[ Crywolf ][MVP Exp.] [%s][%s] LevelUp PlusStatQuest Clear AddStat %d", gObj[iUserIndex].AccountID, gObj[iUserIndex].Name, gObj[iUserIndex].LevelUpPoint); } gObj[iUserIndex].MaxLife += DCInfo.DefClass[gObj[iUserIndex].Class].LevelLife; gObj[iUserIndex].MaxMana += DCInfo.DefClass[gObj[iUserIndex].Class].LevelMana; gObj[iUserIndex].Life = gObj[iUserIndex].MaxLife; gObj[iUserIndex].Mana = gObj[iUserIndex].MaxMana; gObjNextExpCal(&gObj[iUserIndex]); gObjSetBP(gObj[iUserIndex].m_Index); GCLevelUpMsgSend(gObj[iUserIndex].m_Index, 1); gObjCalcMaxLifePower(gObj[iUserIndex].m_Index); LogAddTD(lMsg.Get(MSGGET(2, 8)), gObj[iUserIndex].AccountID, gObj[iUserIndex].Name, gObj[iUserIndex].Level); } return iLEFT_EXP; }
int CCrywolfUtil::CrywolfMVPLevelUp(int iUserIndex,int iAddExp) { if ( !OBJMAX_RANGE(iUserIndex ) ) return 0; LogAddTD("[ Crywolf ][MVP Exp.] : [%s][%s](%d) %u %d", gObj[iUserIndex].AccountID, gObj[iUserIndex].Name, gObj[iUserIndex].Level, gObj[iUserIndex].Experience, iAddExp); if( g_MasterExp.LevelUp(&gObj[iUserIndex],iAddExp) ) { return FALSE; } gObjSetExpPetItem(iUserIndex, iAddExp); int iLEFT_EXP = 0; LogAddTD("Experience : Map[%d]-(%d,%d) [%s][%s](%d) %u %d MonsterIndex : %d, EventType : %d", gObj[iUserIndex].MapNumber, gObj[iUserIndex].X, gObj[iUserIndex].Y, gObj[iUserIndex].AccountID, gObj[iUserIndex].Name, gObj[iUserIndex].Level, gObj[iUserIndex].Experience, iAddExp, 0, EVENT_TYPE_CRYWOLF); if ( gObj[iUserIndex].Level >= MAX_CHAR_LEVEL ) { GCServerMsgStringSend(lMsg.Get(MSGGET(4, 112)), gObj[iUserIndex].m_Index, 1); return 0; } if ( (gObj[iUserIndex].Experience + iAddExp) < gObj[iUserIndex].NextExp ) { gObj[iUserIndex].Experience += iAddExp; } else { iLEFT_EXP = gObj[iUserIndex].Experience + iAddExp - gObj[iUserIndex].NextExp; gObj[iUserIndex].Experience = gObj[iUserIndex].NextExp; gObj[iUserIndex].Level++; #if (ENABLE_CUSTOM_CLASSCALC == 1) gObj[iUserIndex].LevelUpPoint += g_ClassCalc.GetLevelPoint(&gObj[iUserIndex], 0, 0); #else if( gObj[iUserIndex].Class == CLASS_DARKLORD ) { gObj[iUserIndex].LevelUpPoint += 7; } else if( gObj[iUserIndex].Class == CLASS_MAGUMSA ) { gObj[iUserIndex].LevelUpPoint += 7; } else if( gObj[iUserIndex].Class == CLASS_FIGHTER ) { gObj[iUserIndex].LevelUpPoint += 7; } else { gObj[iUserIndex].LevelUpPoint += 5; } #endif if( gObj[iUserIndex].PlusStatQuestClear != false ) { #if (ENABLE_CUSTOM_CLASSCALC == 1) gObj[iUserIndex].LevelUpPoint += g_ClassCalc.GetLevelPoint(&gObj[iUserIndex], 0, 1); #else gObj[iUserIndex].LevelUpPoint += 1; #endif LogAddTD("[ Crywolf ][MVP Exp.] [%s][%s] LevelUp PlusStatQuest Clear AddStat %d", gObj[iUserIndex].AccountID, gObj[iUserIndex].Name, gObj[iUserIndex].LevelUpPoint); } gObj[iUserIndex].MaxLife += DCInfo.DefClass[gObj[iUserIndex].Class].LevelLife; gObj[iUserIndex].MaxMana += DCInfo.DefClass[gObj[iUserIndex].Class].LevelMana; gObj[iUserIndex].Life = gObj[iUserIndex].MaxLife; gObj[iUserIndex].Mana = gObj[iUserIndex].MaxMana; gObjNextExpCal(&gObj[iUserIndex]); gObjSetBP(gObj[iUserIndex].m_Index); GCLevelUpMsgSend(gObj[iUserIndex].m_Index, 1); LogAddTD(lMsg.Get(MSGGET(2, 8)), gObj[iUserIndex].AccountID, gObj[iUserIndex].Name, gObj[iUserIndex].Level); if( gObj[iUserIndex].Level == 400 && gObj[iUserIndex].PartyNumber >= 0 ) { int partynumber = gObj[iUserIndex].PartyNumber; char szTmp[256]; sprintf(szTmp,"400 LevelUp (%s)(%s) Party ",gObj[iUserIndex].AccountID,gObj[iUserIndex].Name); int tObjNum; for(int i = 0; i < 5; i++) { tObjNum = gParty.m_PartyS[partynumber].Number[i]; if( tObjNum >= 0 ) { int len = strlen(szTmp); sprintf(&szTmp[len],",(%s)(%s) ",gObj[tObjNum].AccountID,gObj[tObjNum].Name); } } LogAddTD(szTmp); } } return iLEFT_EXP; }
//005535a0 -> 100% int CMasterLevelSystem::MasterLevelUp(LPOBJ lpObj, __int64 iAddExp, bool bEventMapReward, int iMonsterType) //OK { if( !this->IsMasterLevelUser(lpObj) ) { return false; } int m_maxMasterLevel = GetPrivateProfileInt("Common", "MaxMasterLevel", 200, gDirPath.GetNewPath("MasterSystem.cfg")); int numCoded = 201; if (m_maxMasterLevel >= numCoded || m_maxMasterLevel <= 0){ int m_maxMasterLevel = 200; } // ---- if (lpObj->m_nMasterLevel >= m_maxMasterLevel) { GCServerMsgStringSend(lMsg.Get(1136), lpObj->m_Index, 1); return false; } // ---- if( bEventMapReward ) //-> New { iAddExp = iAddExp; //??? } else { #ifdef GENS if( gGensSystem.IsMapBattleZone(lpObj->MapNumber) ) //-> Original g_GensSystem maybe { iAddExp = iAddExp * (this->m_fAddExpRate + g_MLBattleZoneAddExp); } else { iAddExp = iAddExp * this->m_fAddExpRate; } #else iAddExp = iAddExp * this->m_fAddExpRate; #endif } // ---- if( lpObj->m_MPSkillOpt.MpsPlusExp > 0 ) { iAddExp += iAddExp * lpObj->m_MPSkillOpt.MpsPlusExp / 100; } // ---- if( iAddExp > 0 ) { gObjSetExpPetItem(lpObj->m_Index, iAddExp); // ---- LogAddTD("ML Experience : Map[%d]-(%d,%d) [%s][%s](%d) %I64d %I64d MonsterIndex : %d", //-> Updated lpObj->MapNumber, lpObj->X, lpObj->Y, lpObj->AccountID,lpObj->Name, lpObj->m_nMasterLevel, lpObj->m_i64MasterLevelExp, iAddExp, iMonsterType); // ---- if( iAddExp + lpObj->m_i64MasterLevelExp >= lpObj->m_i64NextMasterLevelExp ) { iAddExp = 0; // ----- int m_masterPointsPerLvl = GetPrivateProfileInt("Common", "MasterPointsPerLvl", 100, gDirPath.GetNewPath("MasterSystem.cfg")); int numCodeds = 101; if (m_maxMasterLevel >= numCodeds) { int m_masterPointsPerLvl = 1; } // ----- lpObj->m_i64MasterLevelExp = lpObj->m_i64NextMasterLevelExp; lpObj->m_nMasterLevel++; lpObj->m_iMasterLevelPoint += m_masterPointsPerLvl; //-> In future can use it for change ml point per level) // ----- gObjCalCharacter(lpObj->m_Index); // ----- lpObj->MaxLife += DCInfo.DefClass[ lpObj->Class ].LevelLife; lpObj->MaxMana += DCInfo.DefClass[ lpObj->Class ].LevelMana; lpObj->Life = lpObj->AddLife + lpObj->MaxLife; lpObj->Mana = lpObj->AddMana + lpObj->MaxMana; // ----- gObjCalcShieldPoint(lpObj); lpObj->iShield = lpObj->iAddShield + lpObj->iMaxShield; // ----- this->gObjNextMLExpCal(lpObj); // ---- gObjCalcMaxLifePower(lpObj->m_Index); gObjSetBP(lpObj->m_Index); GJSetCharacterInfo(lpObj, lpObj->m_Index, 0, 0); this->GCMasterLevelUpInfo(lpObj); GCReFillSend(lpObj->m_Index, lpObj->Life, 0xFF, 0, lpObj->iShield); GCManaSend(lpObj->m_Index, lpObj->Mana, 0xFF, 0, lpObj->BP); //-> Original name ->_BP } else { lpObj->m_i64MasterLevelExp += iAddExp; } // ---- GCSendExp_INT64(lpObj->m_Index, 65535, iAddExp, 0, 0); } // ---- return true; }
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; } }