private GetGold ( |
||
mapMonster | ||
Результат | int |
public string GetRewardPacket(Character character) { if (!QuestRewards.Any()) { return(string.Empty); } return($"qr {GetRewardPacket()} {InfoId}"); string GetRewardPacket() { string str = ""; for (int a = 0; a < 4; a++) { QuestRewardDTO reward = QuestRewards.Skip(a).FirstOrDefault(); if (reward == null) { str += "0 0 0 "; continue; } switch ((QuestRewardType)reward.RewardType) { // Item case QuestRewardType.WearItem: case QuestRewardType.EtcMainItem: character.GiftAdd((short)reward.Data, (byte)(reward.Amount == 0 ? 1 : reward.Amount), reward.Design, reward.Upgrade, (sbyte)reward.Rarity, true); str += $"{reward.RewardType} {reward.Data} {(reward.Amount == 0 ? 1 : reward.Amount)} "; break; // Gold case QuestRewardType.Gold: case QuestRewardType.SecondGold: case QuestRewardType.ThirdGold: case QuestRewardType.FourthGold: character.GetGold(reward.Amount, true); str += $"{reward.RewardType} 0 {(reward.Amount == 0 ? 1 : reward.Amount)} "; break; case QuestRewardType.Reput: // Reputation character.GetReput(reward.Amount); str += $"{reward.RewardType} 0 0"; break; case QuestRewardType.Exp: // Experience if (character.Level >= ServerManager.Instance.MaxLevel) { str += "0 0 0 "; break; } character.GetXp((long)(CharacterHelper.Instance.XpData[reward.Data > 255 ? 255 : reward.Data] * reward.Amount / 100D)); str += $"{reward.RewardType} 0 0 "; break; case QuestRewardType.SecondExp: // % Experience if (character.Level >= ServerManager.Instance.MaxLevel) { str += "0 0 0 "; break; } character.GetXp((long)(CharacterHelper.Instance.XpData[character.Level] * reward.Amount / 100D)); str += $"{reward.RewardType} 0 0 "; break; case QuestRewardType.JobExp: // JobExperience character.GetJobExp((long)((character.Class == (byte)ClassType.Adventurer ? CharacterHelper.Instance.FirstJobXpData[reward.Data > 255 ? 255 : reward.Data] : CharacterHelper.Instance.SecondJobXpData[reward.Data > 255 ? 255 : reward.Data]) * reward.Amount / 100D)); str += $"{reward.RewardType} 0 0 "; break; case QuestRewardType.SecondJobExp: // % JobExperience character.GetJobExp((long)((character.Class == (byte)ClassType.Adventurer ? CharacterHelper.Instance.FirstJobXpData[character.JobLevel] : CharacterHelper.Instance.SecondJobXpData[character.JobLevel]) * reward.Amount / 100D)); str += $"{reward.RewardType} 0 0 "; break; default: str += "0 0 0 "; break; } } return(str); } }
public string GetRewardPacket(Character character, bool onlyItems = false) { if (!QuestRewards.Any() || onlyItems && !QuestRewards.Any(s => (QuestRewardType)s.RewardType == QuestRewardType.WearItem || (QuestRewardType)s.RewardType == QuestRewardType.EtcMainItem)) { return(""); } return($"qr {GetRewardPacket()} {InfoId}"); string GetRewardPacket() { string str = ""; for (int a = 0; a < 4; a++) { QuestRewardDTO reward = QuestRewards.Skip(a).FirstOrDefault(); if (reward == null || onlyItems && (QuestRewardType)reward.RewardType != QuestRewardType.WearItem && (QuestRewardType)reward.RewardType != QuestRewardType.EtcMainItem) { str += "0 0 0 "; continue; } switch ((QuestRewardType)reward.RewardType) { // Item case QuestRewardType.WearItem: case QuestRewardType.EtcMainItem: byte amount = (byte)(reward.Amount == 0 ? 1 : reward.Amount); if (reward.Data == 1917 && character.IsMorphed) { amount *= 2; } character.GiftAdd((short)reward.Data, amount, reward.Rarity, reward.Upgrade, reward.Design, false); str += $"{reward.RewardType} {reward.Data} {amount} "; break; // Gold case QuestRewardType.Gold: case QuestRewardType.SecondGold: case QuestRewardType.ThirdGold: case QuestRewardType.FourthGold: character.GetGold(reward.Amount, true); str += $"{reward.RewardType} 0 {(reward.Amount == 0 ? 1 : reward.Amount)} "; break; case QuestRewardType.Reput: // Reputation character.GetReputation(reward.Amount); str += $"{reward.RewardType} 0 0"; break; case QuestRewardType.Exp: // Experience if (character.Level < ServerManager.Instance.Configuration.MaxLevel) { character.GetXp((long)(CharacterHelper.XPData[reward.Data > 255 ? 255 : reward.Data] * reward.Amount / 100D)); } str += $"{reward.RewardType} 0 0 "; break; case QuestRewardType.SecondExp: // % Experience if (character.Level < ServerManager.Instance.Configuration.MaxLevel) { character.GetXp((long)(CharacterHelper.XPData[character.Level] * reward.Amount / 100D)); } str += $"{reward.RewardType} 0 0 "; break; case QuestRewardType.JobExp: // JobExperience character.GetJobExp((long)((character.Class == (byte)ClassType.Adventurer ? CharacterHelper.FirstJobXPData[reward.Data > 255 ? 255 : reward.Data] : CharacterHelper.SecondJobXPData[reward.Data > 255 ? 255 : reward.Data]) * reward.Amount / 100D)); str += $"{reward.RewardType} 0 0 "; break; case QuestRewardType.SecondJobExp: // % JobExperience character.GetJobExp((long)((character.Class == (byte)ClassType.Adventurer ? CharacterHelper.FirstJobXPData[character.JobLevel] : CharacterHelper.SecondJobXPData[character.JobLevel]) * reward.Amount / 100D)); str += $"{reward.RewardType} 0 0 "; break; default: str += "0 0 0 "; break; } } return(str); } }