Exemplo n.º 1
0
        private void loadQuest(int selectedIndex)
        {
            tcQuest.Visible = true;
            SelectedQuest = (Quest)lbQuests.Items[selectedIndex];

            pgQuestProperties.SelectedObject = SelectedQuest;
            lblQuestName.Text = SelectedQuest.TitleString;

            txtScriptStart.Text = SelectedQuest.StartScript;
            txtScriptInProgress.Text = SelectedQuest.InProgressScript;
            txtScriptFinish.Text = SelectedQuest.FinishScript;

            lblMob00.Text = SelectedQuest.Mobs[0].IsEnabled ? SelectedQuest.Mobs[0].KillAmount + " " + SelectedQuest.Mobs[0].Name : "-";
            lblMob01.Text = SelectedQuest.Mobs[1].IsEnabled ? SelectedQuest.Mobs[1].KillAmount + " " + SelectedQuest.Mobs[1].Name : "-";
            lblMob02.Text = SelectedQuest.Mobs[2].IsEnabled ? SelectedQuest.Mobs[2].KillAmount + " " + SelectedQuest.Mobs[2].Name : "-";
            lblMob03.Text = SelectedQuest.Mobs[3].IsEnabled ? SelectedQuest.Mobs[3].KillAmount + " " + SelectedQuest.Mobs[3].Name : "-";

            txtDescription.Text = file.QuestStrings[SelectedQuest.Description];
            nudDescription.Value = SelectedQuest.Description;
        }
Exemplo n.º 2
0
        public async Task Load(IProgress<int> progress)
        {
            int percent = 0;
            if (isNewFile)
            {
                return;
            }

            using (reader = new BinaryReader(File.OpenRead(FilePath)))
            {
                Header = reader.ReadInt16();

                var questCount = reader.ReadInt16();

                for (int i = 0; i < questCount; i++)
                {
                    var quest = new Quest();
                    quest.Mobs = new List<Mob>();

                    quest.Length = reader.ReadUInt16();
                    reader.ReadUInt16(); // unk
                    quest.ID = reader.ReadUInt16();
                    quest.Title = reader.ReadUInt16();
                    quest.TitleString = QuestStrings[quest.Title];
                    quest.Description = reader.ReadUInt16();

                    reader.ReadInt32(); // unk
                    reader.ReadUInt16(); // unk

                    quest.HasLevelRequirement = Convert.ToBoolean(reader.ReadByte());
                    quest.MinLevel = reader.ReadByte();
                    quest.MaxLevel = reader.ReadByte();
                    quest.IsEnabled = Convert.ToBoolean(reader.ReadByte());

                    quest.QuestNPC = new Mob()
                    {
                        ID = reader.ReadUInt16()
                    };

                    reader.ReadBytes(28); // unk

                    quest.HasClassRequirement = Convert.ToBoolean(reader.ReadByte());
                    quest.RequiredClass = (PlayerClass)reader.ReadByte();

                    reader.ReadBytes(20); // unk
                    quest.IsLevelQuest = Convert.ToBoolean(reader.ReadByte());
                    quest.LevelToReach = reader.ReadByte();
                    reader.ReadUInt16(); // unk
                    ushort id = reader.ReadUInt16();
                    quest.RewardingNPC = new Mob()
                    {
                        ID = id,
                    };
                    reader.ReadUInt16();

                    readMobs(quest);

                    var unk = reader.ReadBytes(512); // unk

                    quest.StartScript = reader.ReadStringUntilZero();
                    quest.InProgressScript = reader.ReadStringUntilZero();
                    quest.FinishScript = reader.ReadStringUntilZero();

                    Quests.Add(quest);

                    percent = Convert.ToInt32(((double)i / questCount) * 100);
                    progress.Report(percent);
                }
            }
        }
Exemplo n.º 3
0
        private void readMobs(Quest quest)
        {
            for (int i = 0; i < 4; i++)
            {
                var mob = new Mob();

                mob.IsEnabled = Convert.ToBoolean(reader.ReadByte());
                reader.ReadByte();
                mob.ID = reader.ReadUInt16();

                if (MobRows.ContainsKey(mob.ID))
                    mob.Name = MobRows[mob.ID][2].ToString();
                else
                    mob.Name = "-";

                mob.IsToKill = Convert.ToBoolean(reader.ReadByte());
                mob.KillAmount = reader.ReadByte();

                quest.Mobs.Add(mob);
            }
        }