public GuildQuestList(TeraMessageReader r) : base(r) { itemsCount = r.ReadUInt16(); firstQuestOffset = r.ReadUInt16(); guildNameOffset = r.ReadUInt16(); masterNameOffset = r.ReadUInt16(); guildId = r.ReadUInt64(); guildLvl = r.ReadUInt32(); totalXp = r.ReadUInt32(); unk1 = r.ReadUInt32(); nextLvXp = r.ReadUInt32(); unk2 = r.ReadUInt32(); funds = r.ReadUInt32(); unk3 = r.ReadUInt32(); totalChars = r.ReadUInt32(); totalAccounts = r.ReadUInt32(); guildSize = r.ReadUInt32(); dateCreated = r.ReadUInt64(); dailyQuestsDone = r.ReadUInt32(); maxDailyQuests = r.ReadUInt32(); guildName = r.ReadTeraString(); masterName = r.ReadTeraString(); Quests = new List <GuildQuest>(); for (int i = 0; i < itemsCount; i++) { r.Skip(4); var q = new GuildQuest(r); Quests.Add(q); } }
internal S_GUILD_QUEST_LIST(TeraMessageReader reader) : base(reader) { //PrintRaw(); GuildQuests = new List <GuildQuest>(); var counter = reader.ReadUInt16(); var questOffset = reader.ReadUInt16(); var guildNameOffset = reader.ReadUInt16(); var guildMasterOffset = reader.ReadUInt16(); var guildId = reader.ReadUInt32(); var guildMasterId = reader.ReadInt32(); GuildLevel = reader.ReadUInt32(); GuildXpCurrent = reader.ReadUInt64(); GuildXpNextLevel = reader.ReadUInt64(); Gold = reader.ReadUInt64(); NumberCharacters = reader.ReadUInt32(); NumberAccount = reader.ReadUInt32(); GuildSize = (GuildSizeType)reader.ReadUInt32(); GuildCreationTime = UnixTimeStampToDateTime(reader.ReadUInt64()); NumberQuestsDone = reader.ReadUInt32(); NumberTotalDailyQuest = reader.ReadUInt32(); GuildName = reader.ReadTeraString(); GuildMaster = reader.ReadTeraString(); for (var i = 1; i <= counter; i++) { reader.BaseStream.Position = questOffset - 4; var pointer = reader.ReadUInt16(); Debug.Assert(pointer == questOffset);//should be the same var nextOffset = reader.ReadUInt16(); var countTargets = reader.ReadUInt16(); var offsetTargets = reader.ReadUInt16(); var countUnk2 = reader.ReadUInt16(); var offsetUnk2 = reader.ReadUInt16(); var countRewards = reader.ReadUInt16(); var offsetRewards = reader.ReadUInt16(); var offsetName = reader.ReadUInt16(); var offsetDescription = reader.ReadUInt16(); var offsetGuildName = reader.ReadUInt16(); var id = reader.ReadUInt32(); var questType2 = (GuildQuestType2)reader.ReadUInt32(); var questSize = (QuestSizeType)reader.ReadUInt32(); var unk3 = reader.ReadByte(); var unk4 = reader.ReadUInt32(); var active = reader.ReadByte(); //Debug.WriteLine(active.ToString("X")); var activeBool = active == 1; var unk7 = reader.ReadBytes(3); //in seconds var timeRemaining = reader.ReadUInt32(); var guildQuestType = (GuildQuestType)reader.ReadUInt32(); var unk5 = reader.ReadByte(); var unk6 = reader.ReadInt32(); var guildQuestDescriptionLabel = reader.ReadTeraString(); var guildQuestTitleLabel = reader.ReadTeraString(); var questguildname = reader.ReadTeraString(); //Debug.WriteLine( // ";unk3:" + unk3 + // ";unk4:" + unk4 + // ";unk5:" + unk5.ToString("X") + // ";unk6:" + unk6 + // ";unk7:" + BitConverter.ToString(unk7) + // ";countUnk2:" + countUnk2 + // ";offsetUnk2:" + offsetUnk2 // ); var targets = new List <GuildQuestTarget>(); reader.BaseStream.Position = offsetTargets - 4; for (var j = 1; j <= countTargets; j++) { var currentPosition = reader.ReadUInt16(); var nextTargetOffset = reader.ReadUInt16(); var zoneId = reader.ReadUInt32(); var targetId = reader.ReadUInt32(); var countQuest = reader.ReadUInt32(); var totalQuest = reader.ReadUInt32(); targets.Add(new GuildQuestTarget(zoneId, targetId, countQuest, totalQuest)); } var nextUnk2Offset = offsetUnk2; for (var j = 1; j <= countUnk2; j++) { reader.BaseStream.Position = nextUnk2Offset - 4; var currentPosition = reader.ReadUInt16(); nextUnk2Offset = reader.ReadUInt16(); Debug.WriteLine("unk2:" + reader.ReadByte().ToString("X") + " ;" + j + "/" + countUnk2); } var rewards = new List <GuildQuestItem>(); reader.BaseStream.Position = offsetRewards - 4; for (var j = 1; j <= countRewards; j++) { var currentPosition = reader.ReadUInt16(); var nextRewardOffset = reader.ReadUInt16(); var item = reader.ReadUInt32(); var amount = reader.ReadUInt64(); rewards.Add(new GuildQuestItem(item, amount)); } questOffset = nextOffset; var quest = new GuildQuest( guildQuestType, questType2, guildQuestDescriptionLabel, guildQuestTitleLabel, questguildname, targets, activeBool, rewards, timeRemaining, questSize ); GuildQuests.Add(quest); } // Debug.WriteLine(ToString()); }
private static string ReplaceQuestInfo(string str, GuildQuest quest, DiscordInfoByGuild discordInfo) { str = str.Replace("{quest_guildname}", quest.GuildName); str = str.Replace("{quest_type}", quest.GuildQuestType1.ToString()); str = str.Replace("{quest_size}", quest.QuestSize.ToString()); str = str.Replace("{quest_time_remaining}", quest.TimeRemaining.ToString(@"hh\:mm\:ss")); var isBamQuest = false; foreach (var target in quest.Targets) { if (target.TotalQuest == 1) { isBamQuest = true; } } str = str.Replace("{quest_is_bam_quest}", isBamQuest.ToString()); var rewardStr = new StringBuilder(); rewardStr.Append(discordInfo.RewardHeaderText); foreach (var reward in quest.Rewards) { rewardStr.Append(ReplaceRewardInfo(discordInfo.RewardContentText, reward)); } rewardStr.Append(discordInfo.RewardFooterText); str = str.Replace("{rewards}", rewardStr.ToString()); var targetStr = new StringBuilder(); targetStr.Append(discordInfo.TargetHeaderText); foreach (var target in quest.Targets) { targetStr.Append(ReplaceTargetInfo(discordInfo.TargetContentText, quest, target)); } targetStr.Append(discordInfo.TargetFooterText); str = str.Replace("{targets}", targetStr.ToString()); return str; }
private static string ReplaceTargetInfo(string str, GuildQuest quest, GuildQuestTarget target) { str = str.Replace("{target_current_count}", target.CountQuest.ToString()); str = str.Replace("{target_total_count}", target.TotalQuest.ToString()); str = str.Replace("{target_remaining}", (target.TotalQuest - target.CountQuest).ToString()); var targetName = ""; switch (quest.GuildQuestType1) { case Tera.Game.Messages.S_GUILD_QUEST_LIST.GuildQuestType.Hunt: targetName = BasicTeraData.Instance.MonsterDatabase.GetAreaName((ushort)target.ZoneId); break; case Tera.Game.Messages.S_GUILD_QUEST_LIST.GuildQuestType.Battleground: case Tera.Game.Messages.S_GUILD_QUEST_LIST.GuildQuestType.Gathering: targetName += BasicTeraData.Instance.QuestInfoDatabase.Get((int)target.TargetId); break; } str = str.Replace("{target_name}", targetName); return str; }