Inheritance: BaseTab
Exemplo n.º 1
0
    public static PacketWriter WriteSkills(this PacketWriter pWriter, Player player)
    {
        SkillTab skillTab = player.SkillTabs.First(x => x.TabId == player.ActiveSkillTabId);
        Dictionary <int, SkillMetadata> skillData = skillTab.SkillJob;
        Dictionary <int, short>         skills    = skillTab.SkillLevels;

        // Ordered list of skill ids (must be sent in this order)
        List <int> ids     = skillTab.Order;
        byte       split   = (byte)Enum.Parse <JobSkillSplit>(Enum.GetName(player.Job));
        int        countId = ids[ids.Count - split];  // Split to last skill id

        pWriter.WriteByte((byte)(ids.Count - split)); // Skill count minus split

        // List of Skills to display on the client
        foreach (int id in ids)
        {
            if (id == countId)
            {
                pWriter.WriteByte(split); // Write that there are (split) skills left
            }
            pWriter.WriteByte();
            pWriter.WriteBool(skills[id] > 0);                                                                                       // Is it learned?
            pWriter.WriteInt(id);                                                                                                    // Skill to display
            pWriter.WriteInt(Math.Clamp(skills[id], skillData[id].SkillLevels.Select(x => x.Level).FirstOrDefault(), int.MaxValue)); // Level to display
            pWriter.WriteByte();
        }
        pWriter.WriteShort(); // Ends with zero short

        return(pWriter);
    }
Exemplo n.º 2
0
        public static Packet Open(Player character)
        {
            PacketWriter pWriter = PacketWriter.Of(SendOp.SKILL_BOOK_TREE);

            // Writes only skills that are learned and for the job rank tab that is opened also doesn't write default passive skills
            pWriter.WriteByte(0);                         // Mode (0 = open) (1 = save)
            pWriter.WriteInt(1);                          // Possibly always 1
            pWriter.WriteLong(character.SkillTabs[0].Id); // Skill tab id
            pWriter.WriteInt(1);                          // Repeat of last int and long
            pWriter.WriteLong(character.SkillTabs[0].Id); // Same as previous identifier
            pWriter.WriteUnicodeString("Build 1");        // Page name

            // Get feature skills, for now just rank 1 skills, not sure how to tell which tab is opened
            // Get first skill tab skills only for now, uncertain of how to have multiple skill tabs
            List <SkillMetadata> skills = SkillTab.GetJobFeatureSkills(character.Job);

            skills.RemoveAll(x => x.Learned < 1); // Remove all unlearned skills
            pWriter.WriteInt(skills.Count);       // Skill count

            // List of learned skills for given tab in format (int skill_id) (int skill_level)
            for (int i = 0; i < skills.Count; i++)
            {
                pWriter.WriteInt(skills[i].SkillId);
                pWriter.WriteInt(skills[i].SkillLevels.Select(x => x.Level).FirstOrDefault());
            }

            return(pWriter);
        }
        public void VerifyDeleteSkill(IWebDriver driver)
        {
            // Refresh the page
            driver.Navigate().Refresh();

            // Wait for all text present in Element
            WaitForTextPresentInElement(driver, profileName, ExcelLib.ReadData(2, "Name"), 10);

            // Jump to Skill tab
            SkillTab.Click();

            // Record the qty after deletion
            var ele = driver.FindElements(By.XPath("//*[@id='account-profile-section']//form/div[3]//div[2]/div/table/tbody"));
            int eleQtyAfterDelete = ele.Count;

            Debug.WriteLine("****The Ele Qty: " + eleQty + " ****The Ele Qty After Deletion: " + eleQtyAfterDelete);

            if (eleQtyAfterDelete == eleQty - 1)
            {
                CommonMethods.test.Log(LogStatus.Pass, "Delete a skill sucessfully!");
            }
            else
            {
                CommonMethods.test.Log(LogStatus.Fail, "Fail to delete a skill!");
                Assert.Fail("Failed to delete skill");
            }
        }
        public void DeleteSkill(IWebDriver driver)
        {
            //Populate Test Data
            ExcelLib.PopulateInCollection(ConstantUtils.TestDataPath, "Profile");

            // Wait for all text present in Element
            WaitForTextPresentInElement(driver, profileName, ExcelLib.ReadData(2, "Name"), 10);

            var ele = driver.FindElements(By.XPath("//*[@id='account-profile-section']//form/div[3]//div[2]/div/table/tbody"));

            eleQty = ele.Count;

            try
            {
                //Delete the last record
                SkillTab.Click();
                SkillDeleteBtn.Click();
            }
            catch (NoSuchElementException e)
            {
                CommonMethods.test.Log(LogStatus.Fail, "No records in list to delete!");
                Assert.Fail("No records in list to delete, please add skill first!", e.Message);
            }
            catch (Exception ex)
            {
                CommonMethods.test.Log(LogStatus.Fail, "Fail to delete a skill!");
                Assert.Fail("Test failed to delete skill", ex.Message);
            }
        }
Exemplo n.º 5
0
    public int PlaceTab(CardDefinition def, float localTime)
    {
        for (int i = 0; i < tabList.Length; i++)
        {
            if (tabList[i] == null)
            {
                continue;
            }
            if (tabList[i].definition.GetHashCode() == def.GetHashCode())
            {
                return(-1);
            }
        }
        int slot = nextAvailableIndex(def.cost, LocalTimeToSlot(localTime));

        if (slot == -1)
        {
            return(-1);
        }
        SkillTab tab = Instantiate(tabPrefab, transform);

        tab.Load(def);
        MoveToSlot(tab, slot);
        // Timey Whimy Stuff
        //GameManager.time = SlotToGT(slot) - 0.2f;

        return(slot);
    }
        public void VerifyAddSkill(IWebDriver driver, string skillName, string skillLevel)
        {
            try
            {
                //Jump to Skill tab
                SkillTab.Click();

                //Verify Skill Name
                var lastRowSkillName = driver.FindElement(By.XPath("//*[@id='account-profile-section']" +
                                                                   "/div/section[2]//div[3]/form/div[3]//div[2]//tbody[last()]/tr/td[1]")).Text;
                Assert.That(lastRowSkillName, Is.EqualTo(skillName));

                //Verify Skill Level
                var lastRowSkillLevel = driver.FindElement(By.XPath("//*[@id='account-profile-section']" +
                                                                    "/div/section[2]//div[3]/form/div[3]//div[2]//tbody[last()]/tr/td[2]")).Text;
                Assert.That(lastRowSkillLevel, Is.EqualTo(skillLevel));

                test.Log(LogStatus.Pass, "Add skill sucessfully!");
            }
            catch (Exception ex)
            {
                test.Log(LogStatus.Fail, "Fail to add skill!");
                Assert.Fail("Test failed to add skill", ex.Message);
            }
        }
Exemplo n.º 7
0
 public void MoveToSlot(SkillTab tab, int index)
 {
     tab.rectTransform.anchoredPosition = new Vector2(index * costCoefficient, tab.rectTransform.anchoredPosition.y);
     for (int i = 0; i < tab.definition.cost; i++)
     {
         tabList[index + i] = tab;
     }
 }
Exemplo n.º 8
0
 public long CreateSkillTab(long characterId, SkillTab skillTab)
 {
     Maple2.Sql.Model.SkillTab model = storage.skillTabConverter.ToModel(skillTab);
     model.Id          = 0;
     model.CharacterId = characterId;
     context.SkillTab.Add(model);
     return(context.TrySaveChanges() ? model.Id : -1);
 }
 public void Update(SkillTab skillTab)
 {
     QueryFactory.Query(TableName).Where("uid", skillTab.Uid).Update(new
     {
         tab_id = skillTab.TabId,
         skillTab.Name,
         skill_levels = JsonConvert.SerializeObject(skillTab.SkillLevels),
     });
 }
 public long Insert(SkillTab skillTab, long characterId)
 {
     return(QueryFactory.Query(TableName).InsertGetId <long>(new
     {
         tab_id = skillTab.TabId,
         skillTab.Name,
         skill_levels = JsonConvert.SerializeObject(skillTab.SkillLevels),
         character_id = characterId
     }));
 }
Exemplo n.º 11
0
    private static void HandleResetSkillTree(GameSession session, PacketReader packet)
    {
        int unknown = packet.ReadInt();

        SkillTab skillTab = session.Player.SkillTabs.FirstOrDefault(x => x.TabId == session.Player.ActiveSkillTabId);

        skillTab.ResetSkillTree(session.Player.Job);
        session.Send(JobPacket.Save(session.Player, session.Player.FieldPlayer.ObjectId));
        DatabaseManager.SkillTabs.Update(skillTab);
    }
Exemplo n.º 12
0
        private static void HandleRename(GameSession session, PacketReader packet)
        {
            long   id      = packet.ReadLong();
            string newName = packet.ReadUnicodeString();

            SkillTab skillTab = session.Player.SkillTabs.FirstOrDefault(x => x.TabId == id);

            skillTab.Name = newName;
            session.Send(SkillBookTreePacket.Rename(id, newName));
        }
Exemplo n.º 13
0
        // Parses skills_{job}
        public static SkillTab ParseSkills(int job, string name = "test")
        {
            // Load skill xml
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load($"MapleServer2/Constants/Skills/skills_{job}.xml");

            // Parse skill id order and count split num
            XmlAttribute oAttr = xmlDoc.DocumentElement.Attributes["order"];

            int[] order = oAttr != null?Array.ConvertAll(oAttr.Value.Split(","), int.Parse) : null;

            XmlAttribute splitAttr = xmlDoc.DocumentElement.Attributes["split"];
            byte         split     = splitAttr != null?byte.Parse(splitAttr.Value) : (byte)8;

            // Create new skill tab with name and skill order
            SkillTab skillTab = new SkillTab(name, order, split);

            // Parse skills and add to skillTab
            XmlNodeList skills = xmlDoc.SelectNodes("/ms2/key");
            IEnumerator ienum  = skills.GetEnumerator();

            while (ienum.MoveNext())
            {
                XmlNode currentNode = (XmlNode)ienum.Current;

                // Skill id
                int id = int.Parse(currentNode.Attributes["id"].Value);
                // Default
                XmlAttribute dAttr        = currentNode.Attributes["default"];
                int          DefaultSkill = dAttr != null?int.Parse(dAttr.Value) : 0;

                // Skill feature (awakening)
                XmlAttribute fAttr   = currentNode.Attributes["feature"];
                string       feature = fAttr != null ? fAttr.Value : "";
                // Skill sub skills
                XmlAttribute subAttr = currentNode.Attributes["sub"];
                int[]        sub     = subAttr != null?Array.ConvertAll(subAttr.Value.Split(","), int.Parse) : null;

                if (DefaultSkill > 0)
                {
                    skillTab.AddOrUpdate(new Skill(id, 1, 1, feature, sub));
                }
                else
                {
                    skillTab.AddOrUpdate(new Skill(id, 1, 0, feature, sub));
                }
            }

            return(skillTab);
        }
Exemplo n.º 14
0
    private static void HandleSave(GameSession session, PacketReader packet)
    {
        Player player = session.Player;

        long activeTabId = packet.ReadLong();
        long selectedTab = packet.ReadLong(); // if 0 player used activate tab
        int  unknown     = packet.ReadInt();
        int  tabCount    = packet.ReadInt();

        for (int i = 0; i < tabCount; i++)
        {
            long   tabId   = packet.ReadLong();
            string tabName = packet.ReadUnicodeString();

            SkillTab skillTab = player.SkillTabs.FirstOrDefault(x => x.TabId == tabId);
            if (skillTab is null)
            {
                skillTab = new(player.CharacterId, player.Job, player.JobCode, tabId, tabName);
                player.SkillTabs.Add(skillTab);
            }
            else
            {
                skillTab       = player.SkillTabs[i];
                skillTab.TabId = tabId;
                skillTab.Name  = tabName;
            }

            // Count of skills that were added to the tab, doesn't show skills that were removed
            int skillCount = packet.ReadInt();
            for (int j = 0; j < skillCount; j++)
            {
                int skillId    = packet.ReadInt();
                int skillLevel = packet.ReadInt();

                // not sure what to do with this
            }
        }

        session.Player.ActiveSkillTabId = activeTabId;
        session.Send(SkillBookTreePacket.Save(session.Player, selectedTab));
        foreach (SkillTab skillTab in session.Player.SkillTabs)
        {
            DatabaseManager.SkillTabs.Update(skillTab);
        }

        if (selectedTab == 0)
        {
            session.Player.UpdatePassiveSkills();
        }
    }
Exemplo n.º 15
0
    public static void WriteSkills(this PacketWriter pWriter, SkillTab skillTab, SkillType type, HashSet <int> newSkillsId = null)
    {
        List <(int skillId, short skillLevel)> skills = skillTab.GetSkillsByType(type);

        pWriter.WriteByte((byte)skills.Count);

        foreach ((int skillId, short skillLevel) in skills)
        {
            pWriter.WriteBool(newSkillsId?.Contains(skillId) ?? false);
            pWriter.WriteBool(skillLevel > 0); // Is it learned?
            pWriter.WriteInt(skillId);
            pWriter.WriteInt(Math.Max((int)skillLevel, 1));
            pWriter.WriteByte();
        }
    }
Exemplo n.º 16
0
    public static PacketWriter Join(Player player)
    {
        SkillTab skillTab = player.SkillTabs.First(x => x.TabId == player.ActiveSkillTabId);

        PacketWriter pWriter = PacketWriter.Of(SendOp.Party);

        pWriter.Write(PartyPacketMode.Join);
        pWriter.WriteCharacter(player);
        pWriter.WriteInt();
        pWriter.WriteSkills(skillTab, SkillType.Active);
        pWriter.WriteSkills(skillTab, SkillType.Passive);
        pWriter.WriteShort(); // more skills?
        pWriter.WriteLong();
        return(pWriter);
    }
Exemplo n.º 17
0
    public override void Execute(GameCommandTrigger trigger)
    {
        string jobName  = trigger.Get <string>("job");
        byte   awakened = trigger.Get <byte>("awakened");

        Player player = trigger.Session.Player;
        IFieldObject <Player> fieldPlayer = trigger.Session.Player.FieldPlayer;

        long     activeSkillTabId = player.ActiveSkillTabId;
        SkillTab skillTab         = player.SkillTabs.First(tab => tab.TabId == activeSkillTabId);

        if (string.IsNullOrEmpty(jobName))
        {
            string[] classes = Enum.GetNames(typeof(Job));

            player.Session.Send(NoticePacket.Notice("You have to give a classname and specifiy awakening (1 or 0)\nAvailable classes:\n".Bold().Color(Color.DarkOrange) +
                                                    $"{string.Join(", ", classes).Color(Color.Aquamarine)}", NoticeType.Chat));

            return;
        }

        Job job = Job.None;

        if (!Enum.TryParse(jobName, true, out job))
        {
            player.Session.SendNotice($"{jobName} is not a valid class name");
            return;
        }

        if (job == Job.None)
        {
            player.Session.SendNotice("None is not a valid class");
            return;
        }

        if (job != player.Job)
        {
            DatabaseManager.SkillTabs.Delete(skillTab.Uid);
            SkillTab newSkillTab = new(player.CharacterId, job, skillTab.TabId, skillTab.Name);

            player.SkillTabs[player.SkillTabs.IndexOf(skillTab)] = newSkillTab;
            player.Job = job;
        }

        player.Awakened = awakened == 1;

        trigger.Session.Send(JobPacket.SendJob(fieldPlayer));
    }
Exemplo n.º 18
0
    private static void HandlePresetSkillTree(GameSession session, PacketReader packet)
    {
        SkillTab skillTab   = session.Player.SkillTabs.FirstOrDefault(x => x.TabId == session.Player.ActiveSkillTabId);
        int      skillCount = packet.ReadInt();

        for (int i = 0; i < skillCount; i++)
        {
            int   skillId    = packet.ReadInt();
            short skillLevel = packet.ReadShort();
            bool  learned    = packet.ReadBool();
            skillTab.AddOrUpdate(skillId, skillLevel, learned);
        }

        session.Send(JobPacket.Save(session.Player, session.Player.FieldPlayer.ObjectId));
        session.Send(KeyTablePacket.SendHotbars(session.Player.GameOptions));
        DatabaseManager.SkillTabs.Update(skillTab);
    }
Exemplo n.º 19
0
        private Panel CreateSkillTab(SkillTab skillTab, AtlasImageLoader loader)
        {
            Panel panel = new Panel();
            Point distanceToNeighbor = new Point(140, 140);

            //panel.AutoScroll = true;
            //panel.BackColor = Color.Red;

            foreach (Skill skill in skillTab.Skills)
            {
                SingleSkillControl control = new SingleSkillControl(skill, loader, distanceToNeighbor);
                panel.Controls.Add(control);
            }

            panel.Size = new Size(distanceToNeighbor.X * 8 + 102, distanceToNeighbor.Y * 6 + 96);

            return(panel);
        }
Exemplo n.º 20
0
    private static void ReadSkills(PacketReader packet, SkillTab skillTab, out HashSet <int> newSkillIds)
    {
        newSkillIds = new();
        int skillCount = packet.ReadInt();

        for (int i = 0; i < skillCount; i++)
        {
            int   skillId    = packet.ReadInt();
            short skillLevel = packet.ReadShort();
            bool  learned    = packet.ReadBool();

            if (skillTab.SkillLevels[skillId] == 0 && learned)
            {
                newSkillIds.Add(skillId);
            }

            skillTab.AddOrUpdate(skillId, skillLevel, learned);
        }
    }
Exemplo n.º 21
0
    public static void WriteJobInfo(this PacketWriter pWriter, Player player, HashSet <int> newSkillIds = null)
    {
        SkillTab skillTab = player.SkillTabs.First(x => x.TabId == player.ActiveSkillTabId);

        pWriter.Write(player.JobCode);
        bool flag = true;

        pWriter.WriteBool(flag);
        if (!flag)
        {
            return;
        }

        pWriter.Write(player.Job);
        pWriter.WriteSkills(skillTab, SkillType.Active, newSkillIds);
        pWriter.WriteSkills(skillTab, SkillType.Passive, newSkillIds);
        pWriter.WriteByte(); // More skills?
        pWriter.WriteByte(); // More skills?
    }
Exemplo n.º 22
0
        private static void HandleSave(GameSession session, PacketReader packet)
        {
            long activeTabId = packet.ReadLong();
            long selectedTab = packet.ReadLong(); // if 0 player used activate tab
            int  unknown     = packet.ReadInt();
            int  tabCount    = packet.ReadInt();

            for (int i = 0; i < tabCount; i++)
            {
                long   tabId   = packet.ReadLong();
                string tabName = packet.ReadUnicodeString();

                SkillTab skillTab = session.Player.SkillTabs.FirstOrDefault(x => x.TabId == tabId);
                if (skillTab == default)
                {
                    skillTab = new SkillTab(session.Player.CharacterId, session.Player.Job, tabId, tabName);
                    session.Player.SkillTabs.Add(skillTab);
                }
                else
                {
                    skillTab       = session.Player.SkillTabs[i];
                    skillTab.TabId = tabId;
                    skillTab.Name  = tabName;
                }

                skillTab.ResetSkillTree(session.Player.Job);
                int skillCount = packet.ReadInt();
                for (int j = 0; j < skillCount; j++)
                {
                    int skillId    = packet.ReadInt();
                    int skillLevel = packet.ReadInt();
                    skillTab.AddOrUpdate(skillId, (short)skillLevel, skillLevel > 0);
                }
            }

            session.Player.ActiveSkillTabId = activeTabId;
            session.Send(SkillBookTreePacket.Save(session.Player, selectedTab));
            foreach (SkillTab skillTab in session.Player.SkillTabs)
            {
                DatabaseManager.SkillTabs.Update(skillTab);
            }
        }
        public void AddSkill(IWebDriver driver, string skillName, string skillLevel)
        {
            // Click Skills tab
            WaitForElement(driver, "XPath", "//a[@data-tab='second']", 5);
            SkillTab.Click();

            // Click Add New
            WaitForElement(driver, "XPath", "//div[@data-tab='second']//div[contains(text(),'Add New')]", 5);
            SkillAddNewBtn.Click();

            // Enter Skill
            WaitForElement(driver, "XPath", "//input[@placeholder='Add Skill']", 5);
            SkillName.SendKeys(skillName);

            // Choose Skill level 0-beginer; 1-intermediate; 2-expert
            SkillDropdownBox.Click();
            new SelectElement(SkillDropdownBox).SelectByText(skillLevel);

            // Click Add
            SkillAddBtn.Click();
        }
Exemplo n.º 24
0
    private static void HandleSaveSkillTree(GameSession session, PacketReader packet)
    {
        Player   player   = session.Player;
        SkillTab skillTab = player.SkillTabs.FirstOrDefault(x => x.TabId == player.ActiveSkillTabId);

        if (skillTab is null)
        {
            return;
        }

        ReadSkills(packet, skillTab, out HashSet <int> newSkillIds);

        player.RemoveSkillsFromHotbar();
        player.AddNewSkillsToHotbar(newSkillIds);

        session.Send(JobPacket.Save(player.FieldPlayer, newSkillIds));
        DatabaseManager.SkillTabs.Update(skillTab);

        session.Send(KeyTablePacket.SendHotbars(player.GameOptions));
        DatabaseManager.GameOptions.Update(player.GameOptions);
    }
Exemplo n.º 25
0
    private static void HandleResetSkillTree(GameSession session, PacketReader packet)
    {
        int unknown = packet.ReadInt();

        Player   player   = session.Player;
        SkillTab skillTab = player.SkillTabs.FirstOrDefault(x => x.TabId == player.ActiveSkillTabId);

        if (skillTab is null)
        {
            return;
        }

        skillTab.ResetSkillTree(player.Job, player.JobCode);
        player.RemoveSkillsFromHotbar();

        session.Send(JobPacket.Save(player.FieldPlayer));
        DatabaseManager.SkillTabs.Update(skillTab);

        session.Send(KeyTablePacket.SendHotbars(player.GameOptions));
        DatabaseManager.GameOptions.Update(player.GameOptions);
    }
Exemplo n.º 26
0
        private void HandleSaveSkillTree(GameSession session, PacketReader packet)
        {
            // Get skill tab to update
            SkillTab skillTab = session.Player.SkillTabs[0]; // Get first skill tab only for now, uncertain of how to have multiple skill tabs

            // Read skills
            int count = packet.ReadInt(); // Number of skills

            for (int i = 0; i < count; i++)
            {
                // Read skill info
                int   id      = packet.ReadInt();   // Skill id
                short level   = packet.ReadShort(); // Skill level
                byte  learned = packet.ReadByte();  // 00 if unlearned 01 if learned
                // Update current character skill tree data with new skill
                skillTab.AddOrUpdate(new Skill(id, level, learned));
            }

            // Send JOB packet that contains all skills then send KEY_TABLE packet to update hotbars
            session.Send(JobPacket.Save(session.Player, session.FieldPlayer.ObjectId));
            session.Send(KeyTablePacket.SendHotbars(session.Player.GameOptions));
        }
        public void UpdateSkill(IWebDriver driver, string skillName, string skillLevel)
        {
            // Click Skill tab
            WaitForElement(driver, "XPath", "//a[@data-tab='second']", 5);
            SkillTab.Click();

            // Click Edit
            WaitForElementClickable(driver, "XPath", "//*[@id='account-profile-section']//div[3]/form/div[3]//div[2]//tbody[2]/tr/td[3]/span[1]/i", 5);
            EditIcon.Click();

            // Update Skill
            WaitForElement(driver, "XPath", "//input[@placeholder='Add Skill']", 5);
            SkillName.Clear();
            SkillName.SendKeys(skillName);

            // Choose Skill level
            SkillDropdownBox.Click();
            new SelectElement(SkillDropdownBox).SelectByText(skillLevel);

            // Click Update
            UpdateBtn.Click();
        }
Exemplo n.º 28
0
    public static void WritePassiveSkills(this PacketWriter pWriter, IFieldObject <Player> fieldPlayer)
    {
        Player   player   = fieldPlayer.Value;
        SkillTab skillTab = player.SkillTabs.First(x => x.TabId == player.ActiveSkillTabId);

        List <(int skillId, short skillLevel)> passiveSkillList = skillTab.GetSkillsByType(SkillType.Passive);

        pWriter.WriteShort((short)passiveSkillList.Count);

        foreach ((int skillId, short skillLevel) in passiveSkillList)
        {
            pWriter.WriteInt(fieldPlayer.ObjectId);
            pWriter.WriteInt(); // unk int
            pWriter.WriteInt(fieldPlayer.ObjectId);
            pWriter.WriteInt(); // unk int 2
            pWriter.WriteInt(); // same as the unk int 2
            pWriter.WriteInt(skillId);
            pWriter.WriteShort(skillLevel);
            pWriter.WriteInt(1);  // unk int = 1
            pWriter.WriteByte(1); // unk byte = 1
            pWriter.WriteLong();
        }
    }
Exemplo n.º 29
0
    private static void HandleSaveSkillTree(GameSession session, PacketReader packet)
    {
        // Get skill tab to update
        SkillTab skillTab = session.Player.SkillTabs.FirstOrDefault(x => x.TabId == session.Player.ActiveSkillTabId);

        // Read skills
        int count = packet.ReadInt(); // Number of skills

        for (int i = 0; i < count; i++)
        {
            // Read skill info
            int   id      = packet.ReadInt();   // Skill id
            short level   = packet.ReadShort(); // Skill level
            byte  learned = packet.ReadByte();  // 00 if unlearned 01 if learned

            // Update current character skill tree data with new skill
            skillTab.AddOrUpdate(id, level, learned > 0);
        }

        // Send JOB packet that contains all skills then send KEY_TABLE packet to update hotbars
        session.Send(JobPacket.Save(session.Player, session.Player.FieldPlayer.ObjectId));
        session.Send(KeyTablePacket.SendHotbars(session.Player.GameOptions));
        DatabaseManager.SkillTabs.Update(skillTab);
    }
        internal void EditProfile()
        {
            //Populate the Excel Sheet
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "Profile");
            Thread.Sleep(1000);

            //Click on Edit button
            ProfileEdit.Click();

            //User's First Name
            FirstName.Clear();
            FirstName.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "FirstName"));

            //User's Last Name
            LastName.Clear();
            LastName.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "LastName"));

            //Save User's Details
            SaveUserDetails.Click();

            //Availability Time option
            Thread.Sleep(1500);
            AvailabilityTime.Click();
            AvailabilityTimeOpt.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "AvailableTime"));


            //Availability Hours
            Thread.Sleep(2000);
            AvailabilityHours.Click();
            //Availability Hours option
            Availability.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Hours"));

            //Earn Target
            Thread.Sleep(2000);
            EarnTarget.Click();
            selectTarget.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "EarnTarget"));

            //-----------------------------------------------------

            //IJavaScriptExecutor js = GlobalDefinitions.driver as IJavaScriptExecutor;
            //Thread.Sleep(1000);
            //js.ExecuteScript("window.scrollBy(0,100);");
            //Thread.Sleep(1000);


            //---------------------------------------------------------
            //Click on Add New Language button
            AddNewBtn.Click();
            Thread.Sleep(1000);
            //Enter the Language
            AddLangText.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Language"));

            //Choose Language
            ChooseLangLevel.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Level"));
            Thread.Sleep(1000);
            AddLang.Click();
            Base.test.Log(LogStatus.Info, "Added Language successfully");

            //-----------------------------------------------------------
            //Click on Add New Skill Button
            SkillTab.Click();
            AddNewSkillBtn.Click();
            //Enter the skill
            AddSkillText.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill"));

            //Click the skill dropdown
            ChooseSkilllevel.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "SkillsLevel"));
            Thread.Sleep(500);
            //ChooseSkilllevel.Click();
            AddSkill.Click();
            Thread.Sleep(500);
            Base.test.Log(LogStatus.Info, "Added Skills successfully");

            //---------------------------------------------------------
            //Add Education
            EducationTab.Click();
            AddNewEducation.Click();
            //Enter the University
            EnterUniversity.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "University"));

            //Choose Country
            ChooseCountry.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Country"));
            Thread.Sleep(500);


            //Choose Title
            ChooseTitle.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title"));
            Thread.Sleep(500);


            //Enter Degree
            Degree.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Degree"));

            //Year of Graduation
            DegreeYear.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "GraduateYear"));
            Thread.Sleep(500);

            AddEdu.Click();
            Thread.Sleep(500);
            Base.test.Log(LogStatus.Info, "Added Education successfully");

            //-------------------------------------------------
            //Click on Certificate tab
            CertiTab.Click();

            //Click on add new
            AddNewCertibtn.Click();

            //Enter Certificate Name
            CertiName.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Certificate"));

            //Enter Certified from
            CertiFrom.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "CertifiedFrom"));

            //Enter the Year
            CertiYear.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "CerYear"));;
            Thread.Sleep(500);

            //Click Add new
            AddCerti.Click();
            Thread.Sleep(500);
            Base.test.Log(LogStatus.Info, "Added Certificate successfully");

            //-------------------------------------------------------------------------------
            //Add Description ICON
            DescrIco.Click();

            //Enter description
            Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description"));
            Thread.Sleep(500);

            //Click on Save
            Save.Click();
            Base.test.Log(LogStatus.Info, "Added Description successfully");
        }