public uint XPValue(uint playerLevel) { if (playerLevel != 0) { uint questLevel = (Level == -1 ? playerLevel : (uint)Level); QuestXPRecord questXp = CliDB.QuestXPStorage.LookupByKey(questLevel); if (questXp == null || RewardXPDifficulty >= 10) { return(0); } float multiplier = 1.0f; if (questLevel != playerLevel) { multiplier = CliDB.XpGameTable.GetRow(Math.Min(playerLevel, questLevel)).Divisor / CliDB.XpGameTable.GetRow(playerLevel).Divisor; } int diffFactor = (int)(2 * (questLevel - playerLevel) + 20); if (diffFactor < 1) { diffFactor = 1; } else if (diffFactor > 10) { diffFactor = 10; } uint xp = (uint)(diffFactor * questXp.Exp[RewardXPDifficulty] * RewardXPMultiplier / 10 * multiplier); if (xp <= 100) { xp = 5 * ((xp + 2) / 5); } else if (xp <= 500) { xp = 10 * ((xp + 5) / 10); } else if (xp <= 1000) { xp = 25 * ((xp + 12) / 25); } else { xp = 50 * ((xp + 25) / 50); } return(xp); } return(0); }
public uint XPValue(Player player) { if (player) { uint questLevel = (uint)player.GetQuestLevel(this); QuestXPRecord questXp = CliDB.QuestXPStorage.LookupByKey(questLevel); if (questXp == null || RewardXPDifficulty >= 10) { return(0); } int diffFactor = (int)(2 * (questLevel - player.GetLevel()) + 12); if (diffFactor < 1) { diffFactor = 1; } else if (diffFactor > 10) { diffFactor = 10; } uint xp = (uint)(diffFactor * questXp.Difficulty[RewardXPDifficulty] * RewardXPMultiplier / 10); if (player.GetLevel() >= Global.ObjectMgr.GetMaxLevelForExpansion(PlayerConst.CurrentExpansion - 1) && player.GetSession().GetExpansion() == PlayerConst.CurrentExpansion && Expansion < (int)PlayerConst.CurrentExpansion) { xp = (uint)(xp / 9.0f); } if (xp <= 100) { xp = 5 * ((xp + 2) / 5); } else if (xp <= 500) { xp = 10 * ((xp + 5) / 10); } else if (xp <= 1000) { xp = 25 * ((xp + 12) / 25); } else { xp = 50 * ((xp + 25) / 50); } return(xp); } return(0); }
public uint XPValue(Player player) { if (player) { uint questLevel = (uint)player.GetQuestLevel(this); QuestXPRecord questXp = CliDB.QuestXPStorage.LookupByKey(questLevel); if (questXp == null || RewardXPDifficulty >= 10) { return(0); } int diffFactor = (int)(2 * (questLevel - player.GetLevel()) + 12); if (diffFactor < 1) { diffFactor = 1; } else if (diffFactor > 10) { diffFactor = 10; } uint xp = (uint)(diffFactor * questXp.Difficulty[RewardXPDifficulty] * RewardXPMultiplier / 10); if (player.GetLevel() >= Global.ObjectMgr.GetMaxLevelForExpansion(PlayerConst.CurrentExpansion - 1) && player.GetSession().GetExpansion() == PlayerConst.CurrentExpansion && Expansion < (int)PlayerConst.CurrentExpansion) { xp = (uint)(xp / 9.0f); } xp = RoundXPValue(xp); if (WorldConfig.GetUIntValue(WorldCfg.MinQuestScaledXpRatio) != 0) { uint minScaledXP = RoundXPValue((uint)(questXp.Difficulty[RewardXPDifficulty] * RewardXPMultiplier)) * WorldConfig.GetUIntValue(WorldCfg.MinQuestScaledXpRatio) / 100; xp = Math.Max(minScaledXP, xp); } return(xp); } return(0); }