示例#1
0
 internal S_CREST_INFO(Tera.Game.Messages.S_CREST_INFO message)
 {
     NetworkController.Instance.Glyphs.playerServer = BasicTeraData.Instance.Servers.GetServerName(NetworkController.Instance.EntityTracker.MeterUser.ServerId);
     NetworkController.Instance.Glyphs.playerName = NetworkController.Instance.EntityTracker.MeterUser.Name;
     NetworkController.Instance.Glyphs.playerClass = NetworkController.Instance.EntityTracker.MeterUser.RaceGenderClass.Class.ToString();
     NetworkController.Instance.Glyphs.glyphs = message.Glyphs;
 }
        internal S_GUILD_QUEST_LIST(Tera.Game.Messages.S_GUILD_QUEST_LIST guildquest)
        {
            if (BasicTeraData.Instance.WindowData.DiscordLogin == "") return;
            DiscordInfoByGuild discordData = null;

            var guildname = (NetworkController.Instance.Server.Name.ToLowerInvariant() + "_" + guildquest.GuildName.ToLowerInvariant()).Replace(" ", "");
            BasicTeraData.Instance.WindowData.DiscordInfoByGuild.TryGetValue(guildname, out discordData);

            if (discordData == null) return;
            var quests = guildquest.ActiveQuests();
            if (quests.Count == 0)
            {
                var activeQuestThread = new Thread(() => Discord.Instance.Send(discordData.DiscordServer, discordData.DiscordChannelGuildQuest, ReplaceGuildInfo(ReplaceNoQuest(discordData.QuestNoActiveText), guildquest, discordData), true));
                activeQuestThread.Start();
            }
            else
            {
                var str = string.Empty;
                foreach (var quest in quests)
                {
                    str += ReplaceQuestInfo(discordData.QuestInfoText, quest, discordData);
                }
                var activeQuestThread = new Thread(() => Discord.Instance.Send(discordData.DiscordServer, discordData.DiscordChannelGuildQuest, ReplaceGuildInfo(str, guildquest, discordData), true));
                activeQuestThread.Start();
            }
            var thread = new Thread(() => Discord.Instance.Send(discordData.DiscordServer, discordData.DiscordChannelGuildInfo, ReplaceGuildInfo(discordData.GuildInfosText, guildquest, discordData), true));
            thread.Start();
        }
        private static string ReplaceGuildInfo(string str, Tera.Game.Messages.S_GUILD_QUEST_LIST guildquest, DiscordInfoByGuild discordInfo)
        {
            str = str.Replace("{guild_guildname}", guildquest.GuildName);
            str = str.Replace("{guild_gold}", guildquest.Gold.ToString());
            str = str.Replace("{guild_creationtime}", guildquest.GuildCreationTime.ToString(@"yyyy-MM-dd"));
            str = str.Replace("{guild_lvl}", guildquest.GuildLevel.ToString());
            str = str.Replace("{guild_master}", guildquest.GuildMaster);
            str = str.Replace("{guild_size}", guildquest.GuildSize.ToString());
            str = str.Replace("{guild_xp_to_next_level}", (guildquest.GuildXpNextLevel - guildquest.GuildXpCurrent).ToString());
            str = str.Replace("{guild_current_xp}", guildquest.GuildXpCurrent.ToString());
            str = str.Replace("{guild_next_level_xp}", guildquest.GuildXpNextLevel.ToString());
            str = str.Replace("{guild_number_accounts}", guildquest.NumberAccount.ToString());
            str = str.Replace("{guild_number_characters}", guildquest.NumberCharacters.ToString());
            str = str.Replace("{guild_number_quest_done}", guildquest.NumberQuestsDone.ToString());
            str = str.Replace("{guild_total_number_quest}", guildquest.NumberTotalDailyQuest.ToString());
            str = str.Replace("{guild_number_quest_remaining}", (guildquest.NumberTotalDailyQuest - guildquest.NumberQuestsDone).ToString());
            str = str.Replace("{gold_label}", BasicTeraData.Instance.QuestInfoDatabase.Get(20000000));
            str = str.Replace("{xp_label}", BasicTeraData.Instance.QuestInfoDatabase.Get(20000001));

            var activeQuest = ReplaceNoQuest(discordInfo.QuestNoActiveText);
            var quests = guildquest.ActiveQuests();
            if (quests.Count > 0)
            {
                var activeQuests = string.Empty;
                foreach (var quest in quests)
                {
                    activeQuests += ReplaceQuestInfo(discordInfo.QuestInfoText, quest, discordInfo);
                }
                activeQuest = activeQuests;
            }
            str = str.Replace("{active_quest}", activeQuest);
            var questList = ReplaceQuestListInfo(guildquest, discordInfo);
            str = str.Replace("{quest_list}", questList);
            return str;
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Capture c = new Capture();

            ServerInfoItem[] servers    = ServerInfoItem.servers();
            InitWindow       initWindow = new InitWindow(c.devices, ServerInfoItem.getServersName(servers));

            if (initWindow.ShowDialog() != true)
            {
                Close(); return;
            }
            c.serverIps = new string[1] {
                servers[initWindow.selectedIndexServer].serverIp
            };
            tera = new Tera(c);
            tera.onStartSnifferSync  += tera_onStartSnifferSync;
            tera.onNewConnectionSync += tera_onNewConnectionSync;
            tera.onEndConnectionSync += tera_onEndConnectionSync;
            tera.onParsePacketSync   += tera_onParsePacketSync;

            timer          = new DispatcherTimer();
            timer.Interval = TimeSpan.FromMilliseconds(101);
            timer.Tick    += timer_Tick;
            timer.Start();

            tera.start(initWindow.selectedIndexDevice);
        }
        public void Update(Tera.Game.Skill skill, SkillAggregate skillAggregate)
        {
            var chained = skill.IsChained;
            var hit = skill.Detail;

            if (skill.IsHotDot)
            {
                hit = LP.Hot;
            }
            if (hit != null)
            {
                LabelName.Content = hit;
            }
            if (chained == true)
            {
                LabelName.Content += " " + LP.Chained;
            }

            LabelName.ToolTip = skill.Id;
            LabelCritRateHeal.Content = skillAggregate.CritRate(skill.Id) + "%";
            LabelNumberHitHeal.Content = skillAggregate.Hits(skill.Id);
            LabelNumberCritHeal.Content = skillAggregate.Crits(skill.Id);
            LabelTotalHeal.Content = FormatHelpers.Instance.FormatValue(skillAggregate.Amount(skill.Id));
            LabelBiggestHit.Content = FormatHelpers.Instance.FormatValue(skillAggregate.BiggestHit(skill.Id));
            LabelBiggestCrit.Content = FormatHelpers.Instance.FormatValue(skillAggregate.BiggestCrit(skill.Id));
            LabelAverageCrit.Content = FormatHelpers.Instance.FormatValue((long) skillAggregate.AvgCrit(skill.Id));
            LabelAverageHit.Content = FormatHelpers.Instance.FormatValue((long) skillAggregate.AvgWhite(skill.Id));
            LabelAverage.Content = FormatHelpers.Instance.FormatValue((long) skillAggregate.Avg(skill.Id));
        }
 internal S_EACH_SKILL_RESULT(Tera.Game.Messages.EachSkillResultServerMessage message)
 {
     NetworkController.Instance.EntityTracker.Update(message);
     var skillResult = new SkillResult(message, NetworkController.Instance.EntityTracker, NetworkController.Instance.PlayerTracker,
                BasicTeraData.Instance.SkillDatabase, BasicTeraData.Instance.PetSkillDatabase, NetworkController.Instance.AbnormalityTracker);
     DamageTracker.Instance.Update(skillResult);
     NotifyProcessor.Instance.UpdateMeterBoss(message);
 }
示例#7
0
        public void VeryLargeResultantExponentsAreSupported()
        {
            var   leftOperand         = new Exa();
            var   rightOperand        = new Tera();
            Int32 multiplication      = leftOperand.Exponent + rightOperand.Exponent;
            var   expectedScaleFactor = Math.Pow(10, multiplication - Normalisers.Largest.Exponent);
            var   resultantOperator   = Normalisers.Get(multiplication);

            Assert.Equal(Normalisers.Largest.Exponent, resultantOperator.Exponent);
        }
示例#8
0
 internal S_LOGIN(Tera.Game.Messages.LoginServerMessage message)
 {
     if (NetworkController.Instance.NeedInit)
     {
         NetworkController.Instance.RaiseConnected(BasicTeraData.Instance.Servers.GetServerName(message.ServerId, NetworkController.Instance.Server));
         bool trackerreset = true;
         if (NetworkController.Instance.EntityTracker != null)
         {
             try
             {
                 var oldregion = BasicTeraData.Instance.Servers.GetServer(NetworkController.Instance.EntityTracker.MeterUser.ServerId).Region;
                 trackerreset = NetworkController.Instance.Server.Region != oldregion;
             }
             catch
             {
                 BasicTeraData.LogError("New server:" + NetworkController.Instance.Server + ";Old server Id:" + NetworkController.Instance.EntityTracker.MeterUser.ServerId, false, true);
                 throw;
             }
         }
         NetworkController.Instance.Server = BasicTeraData.Instance.Servers.GetServer(message.ServerId, NetworkController.Instance.Server);
         NetworkController.Instance.MessageFactory.Version = NetworkController.Instance.Server.Region;
         if (trackerreset)
         {
             NetworkController.Instance.TeraData = BasicTeraData.Instance.DataForRegion(NetworkController.Instance.Server.Region);
             BasicTeraData.Instance.HotDotDatabase.Enraged.Name = LP.Enrage;
             BasicTeraData.Instance.HotDotDatabase.Slaying.Name = LP.Slaying;
             BasicTeraData.Instance.HotDotDatabase.Slaying.Tooltip = LP.SlayingTooltip;
             NetworkController.Instance.EntityTracker = new EntityTracker(BasicTeraData.Instance.MonsterDatabase);
             NetworkController.Instance.PlayerTracker = new PlayerTracker(NetworkController.Instance.EntityTracker, BasicTeraData.Instance.Servers);
             Database.Database.Instance.DeleteAll();
             SelectFont(NetworkController.Instance.Server.Region);
         }
         NetworkController.Instance.NeedInit = false;
     }
     NetworkController.Instance.AbnormalityStorage.EndAll(message.Time.Ticks);
     NetworkController.Instance.AbnormalityTracker = new AbnormalityTracker(NetworkController.Instance.EntityTracker, NetworkController.Instance.PlayerTracker,
         BasicTeraData.Instance.HotDotDatabase, NetworkController.Instance.AbnormalityStorage, DamageTracker.Instance.Update);
     if (NetworkController.Instance.MessageFactory.ChatEnabled)
     {
         NetworkController.Instance.AbnormalityTracker.AbnormalityAdded += NotifyProcessor.Instance.AbnormalityNotifierAdded;
         NetworkController.Instance.AbnormalityTracker.AbnormalityRemoved += NotifyProcessor.Instance.AbnormalityNotifierRemoved;
     }
     NetworkController.Instance.OnGuildIconAction(NetworkController.Instance.UserLogoTracker.GetLogo(message.PlayerId));
     NetworkController.Instance.EntityTracker.Update(message);
     BasicTeraData.Instance.EventsData.Load(NetworkController.Instance.EntityTracker.MeterUser.RaceGenderClass.Class);
     NetworkController.Instance.PacketProcessing.Update();
 }
示例#9
0
 internal C_CHECK_VERSION(Tera.Game.Messages.C_CHECK_VERSION message)
 {
     Debug.WriteLine("VERSION0 = " + message.Versions[0]);
     //            Debug.WriteLine("VERSION1 = " + message.Versions[1]);
     var opCodeNamer =
         new OpCodeNamer(Path.Combine(BasicTeraData.Instance.ResourceDirectory,
             $"data/opcodes/{message.Versions[0]}.txt"));
     OpCodeNamer sysMsgNamer=null;
     try //we we can have working opcodes from older KR versions included, but don't have sysmsg codes for them, todo: delete trycatch when we have all files for all upcoming versions.
     {sysMsgNamer =
             new OpCodeNamer(Path.Combine(BasicTeraData.Instance.ResourceDirectory,
                 $"data/opcodes/smt_{message.Versions[0]}.txt"));}
     catch{}
     NetworkController.Instance.MessageFactory = new MessageFactory(opCodeNamer, NetworkController.Instance.Server.Region, false, sysMsgNamer);
     if (TeraSniffer.Instance.ClientProxyOverhead + TeraSniffer.Instance.ServerProxyOverhead > 0x1000)
         BasicTeraData.LogError("Client Proxy overhead: " + TeraSniffer.Instance.ClientProxyOverhead + "\r\nServer Proxy overhead: " + TeraSniffer.Instance.ServerProxyOverhead);
 }
        public void Update(Tera.Game.Skill skill, SkillAggregate skillAggregate)
        {
            var chained = skill.IsChained;
            var hit = skill.Detail;

            if (skill.IsHotDot)
            {
                hit = LP.Mot;
            }
            if (hit != null)
            {
                LabelName.Content = hit;
            }
            if (chained == true)
            {
                LabelName.Content += " " + LP.Chained;
            }

            LabelName.ToolTip = skill.Id;
            LabelNumberHitMana.Content = skillAggregate.Hits(skill.Id);
            LabelTotalMana.Content = FormatHelpers.Instance.FormatValue(skillAggregate.Amount(skill.Id));
        }
示例#11
0
 internal S_DESPAWN_NPC(Tera.Game.Messages.SDespawnNpc message)
 {
     NetworkController.Instance.AbnormalityTracker.Update(message);
     NotifyProcessor.Instance.DespawnNpc(message);
     DataExporter.Export(message, NetworkController.Instance.AbnormalityStorage);
 }
 public bool Process(Tera.Game.Messages.ParsedMessage message)
 {
     Delegate type;
     MainProcessor.TryGetValue(message.GetType(), out type);
     if (type == null) return false;
     type.DynamicInvoke(message);
     return true;
 }
 public SkillDetailMana(Tera.Game.Skill skill, SkillAggregate skillAggregate)
 {
     InitializeComponent();
     Update(skill, skillAggregate);
 }
示例#14
0
 internal S_CREATURE_LIFE(Tera.Game.Messages.SCreatureLife message)
 {
     NetworkController.Instance.EntityTracker.Update(message);
     NetworkController.Instance.AbnormalityTracker.Update(message);
 }
示例#15
0
 public static void Process(Tera.Game.Messages.SpawnMeServerMessage message)
 {
     NetworkController.Instance.AbnormalityTracker.Update(message);
 }
示例#16
0
 private static string ReplaceQuestListInfo(Tera.Game.Messages.S_GUILD_QUEST_LIST guildquest, DiscordInfoByGuild discordInfo)
 {
     var str = discordInfo.QuestListHeaderText;
     var questLists = ReplaceNoQuest(discordInfo.QuestNoActiveText);
     foreach (var nonActiveQuest in guildquest.GuildQuests.Where(x =>
         (int)x.QuestSize <= (int)guildquest.GuildSize && !x.Active).OrderBy(x => x.GuildQuestType1))
     {
         str += ReplaceQuestInfo(discordInfo.QuestListInfoText, nonActiveQuest, discordInfo);
     }
     return str;
 }
示例#17
0
 public static void Process(Tera.Game.Messages.SpawnNpcServerMessage message)
 {
     NetworkController.Instance.EntityTracker.Update(message);
     DamageTracker.Instance.UpdateEntities(message);
 }
示例#18
0
 internal S_SPAWN_USER(Tera.Game.Messages.SpawnUserServerMessage message)
 {
     NetworkController.Instance.EntityTracker.Update(message);
     NetworkController.Instance.AbnormalityTracker.Update(message);
     NotifyProcessor.Instance.SpawnUser(message);
 }
示例#19
0
 public static void Update(Tera.Game.Messages.SAbnormalityRefresh message)
 {
     NetworkController.Instance.AbnormalityTracker.Update(message);
 }
示例#20
0
 public S_DESPAWN_USER(Tera.Game.Messages.SDespawnUser message)
 {
     NetworkController.Instance.AbnormalityTracker.Update(message);
     NetworkController.Instance.EntityTracker.Update(message);
 }