Example #1
0
 public IEnumerable <MapName> GetMapNames(string searchFor = null, int startPosition = 0, int?count = null)
 {
     if (!string.IsNullOrEmpty(searchFor))
     {
         searchFor.ToLower();
     }
     return(WZ.Resolve("String/Map").Children
            .SelectMany(c => c.Children)
            .Where(c =>
     {
         int mapId = 0;
         if (!int.TryParse(c.NameWithoutExtension, out mapId))
         {
             return false;
         }
         string eightDigitId = mapId.ToString("D8");
         string nineDigitId = mapId.ToString("D9");
         WZProperty eightDigits = WZ.Resolve($"Map/Map/Map{eightDigitId[0]}");
         WZProperty nineDigits = WZ.Resolve($"Map/Map/Map{nineDigitId[0]}");
         return (eightDigits?.Children?.Any(m => m.NameWithoutExtension.Equals(eightDigitId) || m.NameWithoutExtension.Equals(nineDigitId)) ?? false) || (nineDigits?.Children?.Any(m => m.NameWithoutExtension.Equals(eightDigitId) || m.NameWithoutExtension.Equals(nineDigitId)) ?? false);
     })
            .Where(c => c != null)
            .Select(c => MapName.Parse(c))
            .Where(c => string.IsNullOrEmpty(searchFor) || (!string.IsNullOrEmpty(c.Name) && c.Name.ToLower().Contains(searchFor)) || (!string.IsNullOrEmpty(c.StreetName) && c.StreetName.ToLower().Contains(searchFor)))
            .Skip(startPosition)
            .Take(count ?? int.MaxValue));
 }
Example #2
0
        public void CopyWZ()
        {
            conf Config = new conf();

            try
            {
                File.Copy(pdfName, Config.outPath + "Rok_20" + year + "\\" + docName + ".pdf");
                StreamWriter WZ;
                WZ = File.AppendText(fileLog);
                WZ.WriteLine(Config.outPath + "Rok_20" + year + "\\" + docName + ".pdf");
                WZ.Close();
            }
            catch (IOException)
            {
                FileInfo infoFirst  = new FileInfo(Config.outPath + "Rok_20" + year + "\\" + docName + ".pdf");
                long     byteFirst  = infoFirst.Length;
                FileInfo infoSecond = new FileInfo(pdfName);
                long     byteSecond = infoSecond.Length;
                if (byteFirst != byteSecond)
                {
                    File.Copy(pdfName, Config.outPath + "Rok_20" + year + "\\duplikaty\\" + docName + ".pdf");
                    StreamWriter WZ2;
                    WZ2 = File.AppendText(fileLog);
                    WZ2.WriteLine("!! DUPLIKAT !!    " + Config.outPath + "Rok_20" + year + "\\duplikaty\\" + docName + ".pdf" + "    !! DUPLIKAT !!");
                    WZ2.Close();
                }
                else
                {
                    StreamWriter WZ3;
                    WZ3 = File.AppendText(fileLog);
                    WZ3.WriteLine("!! Identyczny plik istnieje !!    " + Config.outPath + "Rok_20" + year + "\\" + docName + ".pdf" + "    !! Identyczny plik istnieje !!");
                    WZ3.Close();
                }
            }
        }
Example #3
0
        public Skill GetSkill(int id)
        {
            WZProperty skillBooks = WZ.Resolve("Skill");
            string     friendlyId = id.ToString();
            WZProperty skillBook  = null;

            if (skillBook == null)
            {
                skillBook = skillBooks.Children.FirstOrDefault(c => c.NameWithoutExtension.Equals(friendlyId.Substring(0, 6)))?.Resolve($"skill/{friendlyId}");
            }
            if (skillBook == null)
            {
                skillBook = skillBooks.Children.FirstOrDefault(c => c.NameWithoutExtension.Equals(friendlyId.Substring(0, 5)))?.Resolve($"{friendlyId.Substring(0, 5)}/skill/{friendlyId}");
            }
            if (skillBook == null)
            {
                skillBook = skillBooks.Children.FirstOrDefault(c => c.NameWithoutExtension.Equals(friendlyId.Substring(0, 4)))?.Resolve($"{friendlyId.Substring(0, 4)}/skill/{friendlyId}");
            }
            if (skillBook == null)
            {
                skillBook = skillBooks.Children.FirstOrDefault(c => c.NameWithoutExtension.Equals(friendlyId.Substring(0, 3)))?.Resolve($"{friendlyId.Substring(0, 3)}/skill/{friendlyId}");
            }
            if (skillBook == null)
            {
                skillBook = skillBooks.Children.SelectMany(c => c.Resolve("skill")?.Children).Where(c => c != null && c.NameWithoutExtension.Equals(friendlyId)).First();
            }

            return(Skill.Parse(skillBook, GetSkillDescription));
        }
Example #4
0
        private void load_a_mmmm()
        {
            ushort addr = WordAtPCPlusInitialOpcodeLength;

            A.Value  = Memory[addr];
            WZ.Value = addr;
            WZ.Inc();
        }
Example #5
0
        private void load_xx_mmmm(IRegister <ushort> XX)
        {
            var addr = WordAtPCPlusInitialOpcodeLength;

            XX.Value = Memory.GetWordAt(addr);
            WZ.Value = addr;
            WZ.Inc();
        }
Example #6
0
        private void load_mmmm_xx(IRegister <ushort> XX)
        {
            var addr = WordAtPCPlusInitialOpcodeLength;

            Memory.SetWordAt(WordAtPCPlusInitialOpcodeLength, XX.Value);
            WZ.Value = addr;
            WZ.Inc();
        }
Example #7
0
        public MapName GetMapName(int id)
        {
            WZProperty mapName = WZ.Resolve("String/Map").Children
                                 .SelectMany(c => c.Children)
                                 .Where(c => c.NameWithoutExtension == id.ToString())
                                 .FirstOrDefault();
            MapName name = MapName.Parse(mapName);

            return(name);
        }
Example #8
0
        private void rrd()
        {
            int oldHlm = HLM.Value;
            int newHlm = (oldHlm >> 4) | (A.Value << 4);

            A.Value   = (byte)((A.Value & 0xF0) | (oldHlm & 0x0F));
            HLM.Value = (byte)newHlm;
            F.Value   = (byte)((F.Value & 0x01) | SZ53P(A.Value));

            WZ.Value = HL.Value;
            WZ.Inc();
        }
Example #9
0
        public IEnumerable <ItemNameInfo> GetItems(
            int startPosition            = 0,
            int?count                    = null,
            string overallCategoryFilter = null,
            string categoryFilter        = null,
            string subCategoryFilter     = null,
            int?jobFilter                = null,
            bool?cashFilter              = null,
            int?minLevelFilter           = null,
            int?maxLevelFilter           = null,
            int?genderFilter             = null,
            string searchFor             = null
            )
        {
            WZProperty stringWz = WZ.Resolve("String");

            string[] jobFilterNames = jobFilter == null ? null : JobNameLookup.Where(b => (b.Key & jobFilter) == b.Key && (b.Key != 0 || jobFilter == 0)).Select(b => b.Value).ToArray();

            // TODO: Refactor this
            IEnumerable <ItemNameInfo> results = ItemNameInfo.GetNames(stringWz).Select(name =>
            {
                if (WZ.EquipMeta.ContainsKey(name.Id))
                {
                    name.RequiredJobs  = WZ.EquipMeta[name.Id].Item1;
                    name.RequiredLevel = WZ.EquipMeta[name.Id].Item2;
                    name.IsCash        = WZ.EquipMeta[name.Id].Item3;
                }
                return(name);
            })
                                                 .Where(item =>
            {
                bool matchesFilter = true;
                matchesFilter     &= overallCategoryFilter == null || item.TypeInfo.OverallCategory.Equals(overallCategoryFilter, StringComparison.CurrentCultureIgnoreCase);
                matchesFilter     &= categoryFilter == null || item.TypeInfo.Category.Equals(categoryFilter, StringComparison.CurrentCultureIgnoreCase);
                matchesFilter     &= subCategoryFilter == null || item.TypeInfo.SubCategory.Equals(subCategoryFilter, StringComparison.CurrentCultureIgnoreCase);
                matchesFilter     &= jobFilter == null || (item.RequiredJobs?.SequenceEqual(jobFilterNames) ?? false);
                matchesFilter     &= cashFilter == null || item.IsCash == cashFilter;
                matchesFilter     &= minLevelFilter == null || minLevelFilter <= item.RequiredLevel;
                matchesFilter     &= maxLevelFilter == null || maxLevelFilter >= item.RequiredLevel;
                matchesFilter     &= genderFilter == null || item.RequiredGender == genderFilter;
                matchesFilter     &= searchFor == null || (item.Name?.ToLower().Contains(searchFor.ToLower()) ?? false) || (item.Desc?.ToLower().Contains(searchFor.ToLower()) ?? false);

                return(matchesFilter);
            })
                                                 .Skip(startPosition);

            if (count != null && count.HasValue)
            {
                return(results.Take(count.Value));
            }
            return(results);
        }
Example #10
0
        private void wzButt_Click(object sender, EventArgs e)
        {
            List <String> list = new List <String>();

            foreach (var x in checkedListBox1.CheckedItems.OfType <String>().ToList())
            {
                list.Add(x);
            }

            WZ wz = new WZ(this, list, pracownik);

            wz.Show();
            this.Enabled = false;
        }
Example #11
0
 private void lddr()
 {
     ldd();
     if (BC.NZ)
     {
         NextPC          -= 2;
         RecordExtraTicks = true;
     }
     else
     {
         WZ.Value = PC.Value;
         WZ.Inc();
     }
 }
Example #12
0
        public WZProperty GetItemNode(int id)
        {
            string idString = id.ToString("D8");
            // TODO: Refactor to use character grouping IDs
            WZProperty item = WZ.Resolve("Character").Children.SelectMany(c => c.Resolve().Children).Where(c => c.Type == PropertyType.Image || c.Type == PropertyType.Lua).FirstOrDefault(c => c.NameWithoutExtension == idString)?.Resolve();

            if (item != null)
            {
                return(item);
            }

            item = WZ.Resolve($"Item/Etc/{idString.Substring(0, 4)}/{idString}");
            if (item != null)
            {
                return(item);
            }

            item = WZ.Resolve($"Item/Install").Children.FirstOrDefault(b => idString.StartsWith(b.NameWithoutExtension))?.Resolve(idString);
            if (item != null)
            {
                return(item);
            }

            item = WZ.Resolve($"Item/Cash/{idString.Substring(0, 4)}/{idString}");
            if (item != null)
            {
                return(item);
            }

            item = WZ.Resolve($"Item/Consume/{idString.Substring(0, 4)}/{idString}");
            if (item != null)
            {
                return(item);
            }

            item = WZ.Resolve($"Item/Special/{idString.Substring(0, 4)}/{idString}");
            if (item != null)
            {
                return(item);
            }

            item = WZ.Resolve($"Item/Pet/{idString}");
            if (item != null)
            {
                return(item);
            }

            return(null);
        }
Example #13
0
        private void sbc_hl(IRegister <ushort> r2)
        {
            WZ.Value = HL.Value;
            WZ.Inc();

            int cfVal = CF ? 1 : 0;
            int diff  = HL.Value - r2.Value - cfVal;

            F.Value = (byte)(S_NF | (diff >> 8) & (S_SF | S_F5 | S_F3));
            HF      = ((HL.Value & 0x0FFF) - (r2.Value & 0x0FFF)) - cfVal < 0;

            VF = ((r2.Value ^ HL.Value) & (HL.Value ^ diff) & 0x8000) != 0x0000;
            ZF = diff == 0;
            CF = diff < 0;

            HL.Value = (ushort)diff;
        }
Example #14
0
        private void add(IRegister <ushort> r1, IRegister <ushort> r2)
        {
            WZ.Value = r1.Value;
            WZ.Inc();

            int sum = r1.Value + r2.Value;

            F.Value = (byte)(F.Value & (S_SF | S_ZF | S_VF));

            HF = ((r1.Value & 0x0FFF) + (r2.Value & 0x0FFF)) > 0x0FFF;

            F5 = ((sum >> 8) & S_F5) == S_F5;
            F3 = ((sum >> 8) & S_F3) == S_F3;
            CF = sum > 0xFFFF;

            r1.Value = (ushort)sum;
        }
Example #15
0
        private void adc_hl(IRegister <ushort> r)
        {
            WZ.Value = HL.Value;
            WZ.Inc();

            int cfVal = CF ? 1 : 0;
            int sum   = HL.Value + r.Value + cfVal;

            F.Value = (byte)((sum >> 8) & (S_SF | S_F5 | S_F3));

            HF = ((HL.Value & 0x0FFF) + (r.Value & 0x0FFF) + cfVal) > 0x0FFF;

            VF = ((HL.Value ^ r.Value ^ 0x8000) & (r.Value ^ sum) & 0x8000) == 0x8000;
            ZF = (sum & 0xFFFF) == 0;
            CF = sum > 0xFFFF;

            HL.Value = (ushort)sum;
        }
Example #16
0
        private void cpxr()
        {
            /*
             * https://www.omnimaga.org/asm-language/bit-n-(hl)-flags/5/?wap2
             *
             * WZ: when BC=1 or A=(HL): exactly as CPI/R
             * In other cases WZ = PC + 1 on each step, where PC = instruction address.
             * Note since at the last execution BC=1 or A=(HL), resulting MEMPTR = PC + 1 + 1
             * (if there were not interrupts during the execution)
             */

            if (BC.NZ && !ZF)
            {
                WZ.Value = PC.Value;
                WZ.Inc();
                RecordExtraTicks = true;
                NextPC          -= 2;
                Debug.Assert(PC.Value == NextPC);
            }
        }
Example #17
0
        public Tuple <ItemNameInfo, IconInfo, EquipInfo>[] BulkItemInfo(int[] itemIds)
        {
            WZProperty stringWz = WZ.Resolve("String");
            ILookup <int, ItemNameInfo> nameLookup = ItemNameInfo.GetNameLookup(stringWz);

            return(itemIds.Select(c =>
            {
                ItemNameInfo name = nameLookup[c].FirstOrDefault();
                if (name != null)
                {
                    return new Tuple <int, ItemNameInfo>(c, name);
                }
                return null;
            }).Where(c => c != null)
                   .Select(c => {
                WZProperty info = GetItemNode(c.Item1).Resolve("info");
                return new Tuple <ItemNameInfo, IconInfo, EquipInfo>(c.Item2, IconInfo.Parse(info), EquipInfo.Parse(info));
            })
                   .ToArray());
        }
Example #18
0
        public Image <Rgba32> RenderPet(int petId, string animation, int frame, int petEquip)
        {
            Pet eq = GetPet(petId);

            Frame[] frames     = eq.frameBooks[animation].First().frames.ToArray();
            int     frameCount = frames.Count();
            int     realFrame  = (frame % frameCount);
            Frame   petFrame   = frames[realFrame];

            if (petEquip != -1)
            {
                Point      origin         = petFrame.OriginOrZero;
                WZProperty equipPetIdList = WZ.Resolve($"Character/PetEquip/{petEquip.ToString("D8")}");
                WZProperty equipNode      = equipPetIdList?.Resolve(petId.ToString())?.Resolve()?.Resolve($"{animation}/{realFrame}")?.Resolve();
                if (equipNode == null)
                {
                    return(petFrame.Image);
                }

                Frame equipFrame    = Frame.Parse(equipNode);
                Point equipOrigin   = equipFrame.OriginOrZero;
                Point renderEquipAt = new Point(origin.X - equipOrigin.X, origin.Y - equipOrigin.Y);

                int minX = Math.Min(renderEquipAt.X, 0);
                int minY = Math.Min(renderEquipAt.Y, 0);
                int maxX = Math.Max(renderEquipAt.X + equipFrame.Image.Width, petFrame.Image.Width);
                int maxY = Math.Max(renderEquipAt.Y + equipFrame.Image.Height, petFrame.Image.Height);

                Image <Rgba32> result = new Image <Rgba32>(maxX - minX, maxY - minY);
                result.Mutate(x =>
                {
                    x.DrawImage(petFrame.Image, 1, new Point(0 - minX, 0 - minY));
                    x.DrawImage(equipFrame.Image, 1, new Point(renderEquipAt.X - minX, renderEquipAt.Y - minY));
                });
                return(result);
            }
            else
            {
                return(petFrame.Image);
            }
        }
Example #19
0
        public IEnumerable <QuestMeta> GetQuests(string searchFor = null, int startPosition = 0, int?count = null)
        {
            if (!string.IsNullOrEmpty(searchFor))
            {
                searchFor.ToLower();
            }
            IEnumerable <Quest> quests = Quest.GetQuests(WZ.Resolve("Quest")).OrderBy(c => c.Id);

            return(quests.Select(q =>
                                 new QuestMeta(
                                     q.Id,
                                     q.Name,
                                     q.RequirementToStart?.LevelMinimum,
                                     q.RequirementToStart?.StartTime,
                                     q.RequirementToStart?.EndTime
                                     )
                                 )
                   .Where(c => string.IsNullOrEmpty(searchFor) || (!string.IsNullOrEmpty(c.Name) && c.Name.ToLower().Contains(searchFor)))
                   .Skip(startPosition)
                   .Take(count ?? int.MaxValue));
        }
Example #20
0
 private void InPortA()
 {
     InPortR(A);
     WZ.Value = BC.Value;
     WZ.Inc();
 }
Example #21
0
        public Pet GetPet(int petId)
        {
            WZProperty petItem = (WZ.Resolve("String/Pet") ?? WZ.Resolve("String/Item/Pet")).Resolve(petId.ToString());

            return(Pet.Parse(petItem));
        }
Example #22
0
        public IEnumerable <KeyValuePair <int, string> > GetPets(int startPosition = 0, int?count = null)
        {
            WZProperty pets = WZ.Resolve("String/Pet") ?? WZ.Resolve("String/Item/Pet");

            return(pets.Children.ToDictionary(c => int.Parse(c.NameWithoutExtension), c => c.ResolveForOrNull <string>("name")).Skip(startPosition).Take(count ?? int.MaxValue));
        }
Example #23
0
 public IEnumerable <Tips> GetTips() => Tips.GetTips(WZ.Resolve("Etc"));
Example #24
0
 private void outd()
 {
     outx(false);
     WZ.Value = BC.Value;
     WZ.Dec();
 }
Example #25
0
 private void OutPortA()
 {
     OutPort(C.Value, A.Value);
     WZ.Value = BC.Value;
     WZ.Inc();
 }
Example #26
0
 private void ind()
 {
     WZ.Value = BC.Value;
     WZ.Dec();
     inx(false);
 }
Example #27
0
 private void cpi()
 {
     WZ.Inc();
     cpx();
     HL.Inc();
 }
Example #28
0
 private void outi()
 {
     outx(true);
     WZ.Value = BC.Value;
     WZ.Inc();
 }
Example #29
0
 private void ini()
 {
     WZ.Value = BC.Value;
     WZ.Inc();
     inx(true);
 }
Example #30
0
 private void cpd()
 {
     WZ.Dec();
     cpx();
     HL.Dec();
 }