Ejemplo n.º 1
0
        void LoadContext(CHR chr)
        {
            ControlBoxes.Clear();
            ControlBoxes.Add(BGTextureBox);
            ControlBoxes.Add(tb);
            for (int i = 0; i < chr.Bag.Count; i++)
            {
                if (chr.Bag[i] != null)
                {
                    bb[i].Index = i;
                    //bb[i].Location = new Point(160 + 160 * (i / 8), 64 + 32 * (i % 8));
                    bb[i].Location = new Point(24, 24 + 24 * i);

                    bb[i].WaitTextBox.Location = new Point(48, 4);
                    bb[i].WaitTextBox.Text     = chr.Bag[i].Name;
                    //bb[i].WaitTextBox.FontSize = 15;
                    bb[i].WaitTextureBox.Texture.Name = chr.Bag[i].Icon.Name;
                    //bb[i].WaitTextureBox.Texture.Index = -1;
                    bb[i].WaitTextureBox.Size = new System.Drawing.Size(48, 32);
                    bb[i].SameAsWait();

                    bb[i].OnButtonUp    += new ButtonBoxEvent(MenuBAG_OnButtonUp);
                    bb[i].OnButtonFocus += new ButtonBoxEvent(MenuBAG_OnButtonFocus);

                    ControlBoxes.Add(bb[i]);
                }
            }
            FocusNowButtonBox();

            if (NowButtonBoxIndex >= chr.Bag.Count)
            {
                FocusLastButtonBox();
            }
        }
Ejemplo n.º 2
0
    static void Main(string[] args)
    {
        Console.WriteLine("CHRUnpack for King's Field IV (The Ancient City)\n");

        if (args.Length < 1)
        {
            Console.WriteLine("Usage:\n\tCHRUnpack.exe f.chr\n");

            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
            return;
        }

        //Get path for extraction
        string unpackPath = Path.GetDirectoryName(args[0]) + "\\" + Path.GetFileNameWithoutExtension(args[0]) + "\\";
        string unpackName = Path.GetFileNameWithoutExtension(args[0]);

        Directory.CreateDirectory(unpackPath);

        //Read CHR
        Console.WriteLine("Unpacking...");
        CHR chr = CHR.FromFile(args[0]);

        //Save CHR data
        Console.WriteLine("Writing Files...");
        chr.Save(unpackPath + unpackName);

        //Finished
        Console.WriteLine("Press any key to exit...");
        Console.ReadKey();
    }
Ejemplo n.º 3
0
 public void Scan()
 {
     EL.Clear();
     CHR.LoadLocation();
     ScanNPC();
     ScanLoot();
     ScanPlayers();
 }
Ejemplo n.º 4
0
 public void Approach(double dist = 2.0)
 {
     CalculateDistance();
     if (distance > dist + 0.5)
     {
         CHR.Move(loc.Approach(CHR.LOC, dist), true, 0.5);
     }
 }
Ejemplo n.º 5
0
 public Boolean IsGood()
 {
     if (id > 0 && (lvl < CHR.GetClass <FairyFactory>().GOODNEES + 10 || (P2 - P1 < CHR.GetClass <FairyFactory>().GOODNEES&& lvl < 100)))
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 6
0
        void DrawCHR(CHR chr)
        {
            Vector3 loc = chr.BattleMovie.DrawLocation;

            loc = Util.Vector3AddVector3(loc, this.ScreenOffsetPixel);
            Color color = Util.MixColor(ColorFilter, chr.BattleMovie.ColorFilter);

            game.DrawMetalXTexture(chr.BattleMovie.MXT, chr.BattleMovie.DrawZone, loc, chr.BattleMovie.TileSize2X, 0, color);
        }
Ejemplo n.º 7
0
 public void LoadFairiesFromInventory()
 {
     CHR.GetClass <Inventory>().Load();
     FL.Clear();
     foreach (ItemInventory i in CHR.GetClass <Inventory>().IL)
     {
         if (i.id == 0 || i.ptr == 0 || i.type != 41)
         {
             continue;
         }
         FL.Add(ItemFairy.LoadInvFairy(i));
     }
 }
Ejemplo n.º 8
0
        public void OpenItem()
        {
            //CHR.GetClass<Inventory>().Load();
            ItemInventory UI = CHR.GetClass <Inventory>().GetFirstById(item);

            if (UI == null)
            {
                return;
            }
            UI.Use();
            Utils.RandomDelay(delay * 1000 - 300, (delay + 1) * 1000 + 300);
            OpenItem();
        }
Ejemplo n.º 9
0
        public void GetPrizeBag()
        {
            if (CHR.GetClass <Inventory>().GetFreeCount() < 1)
            {
                return;
            }
            Packet P = new Packet(CHR.HNDL, "C0-00-3A-15-00-00-0C-00-00-00-00-A4-20-1A-00-00-00-00-00-00-00-00");

            P.CopyR(CHR.ID, 14, 4);
            P.CopyR(CHR.ID, 18, 4);
            P.Send();
            Utils.RandomDelay();
        }
Ejemplo n.º 10
0
 public void MoveAllBeastsToStore()
 {
     CHR.GetClass <GUI>().Click("Win_HomePetMain", "Btn_Storage");
     CHR.GetClass <Inventory>().Load();
     foreach (ItemInventory i in CHR.GetClass <Inventory>().IL)
     {
         if (i.id >= Beast.ITEM_BASE + Beast.MIN_ITEM && i.id <= Beast.ITEM_BASE + Beast.MAX_ITEM)
         {
             ItemBeast.FromItem(i).PutToBI();
         }
     }
     CHR.GetClass <GUI>().Click("Win_HomePetMain", "Btn_Storage");
 }
Ejemplo n.º 11
0
        public void GetReward()
        {
            int RN = BeastReward.GetRewardNumber(Points, Reward);

            if (RN < 1 || CHR.GetClass <Inventory>().GetFreeCount() < 1)
            {
                return;
            }
            Packet P = new Packet(CHR.HNDL, "C0-00-3B-15-00-00-10-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00");

            P.CopyR(CHR.ID, 14, 4);
            P.CopyR(CHR.ID, 18, 4);
            P.CopyR(RN, 22, 4);
            P.Send();
            Utils.RandomDelay();
        }
Ejemplo n.º 12
0
        public ItemFairy SelectFairyForEnchance()
        {
            if (GetEquiped().id > 0)
            {
                int IP = CHR.GetClass <Inventory>().GetFirstFreePlace();
                if (IP > 0)
                {
                    ItemInventory.Equip(CHR.HNDL, IP, 0x17);
                }
            }
            Thread.Sleep(2000);
            LoadFairiesFromInventory();
            ItemFairy BEST  = new ItemFairy(CHR);
            ItemFairy WORST = new ItemFairy(CHR);

            BEST.P1  = 0;
            BEST.P2  = 1;
            WORST.P1 = 1;
            WORST.P2 = 1;
            int count = 0;

            foreach (ItemFairy FI in FL)
            {
                if (FI.IsGood())
                {
                    if (FI.lvl < 10)
                    {
                        ItemInventory.Equip(CHR.HNDL, FI.place, 0x17);
                        return(FI);
                    }
                    BEST  = ((double)FI.P1 / (double)FI.P2 >= (double)BEST.P1 / (double)BEST.P2) ? FI : BEST;
                    WORST = ((double)FI.P1 / (double)FI.P2 < (double)WORST.P1 / (double)WORST.P2) ? FI : WORST;
                    count++;
                }
            }
            if (count == 0)
            {
                return(new ItemFairy(CHR));
            }
            BEST = BEST.id == 0 ? WORST : BEST;
            Boolean RA = RAS.Analize();

            (RA ? WORST : BEST).Equip(0x17);
            return(RA ? WORST : BEST);
        }
Ejemplo n.º 13
0
 public void OpenAllBags()
 {
     if (!OpenBags)
     {
         return;
     }
     CHR.GetClass <Inventory>().Load();
     while (CHR.GetClass <Inventory>().HasItemsFromList(BagsId))
     {
         foreach (ItemInventory i in CHR.GetClass <Inventory>().IL)
         {
             if (BagsId.Contains(i.id))
             {
                 i.Use();
             }
         }
         Utils.RandomDelay(3500, 4500);
         MoveAllBeastsToStore();
     }
 }
Ejemplo n.º 14
0
        public void Run()
        {
            IsRun = true;

            /*CHR.EnterHome();
             * CHR.WND.WaitForWindow("Win_Chat", 20, false);
             * Utils.RandomDelay();*/
            LoadMine();
            Utils.RandomDelay();
            if (GamesRemain < 1 || Points > PointLimit)
            {
                return;
            }
            OpenBattle();
            Utils.RandomDelay();
            int EC = GetRandomEnemyCommander();

            SelectEnemy(EC);
            Utils.RandomDelay();
            LoadEnemy();
            Utils.RandomDelay();
            Beast[] BB = AnalizeEnemy();
            Utils.RandomDelay();
            StartBattle(BB, EC);
            Utils.RandomDelay();
            if (SkipBattles)
            {
                if (CHR.GetClass <GUI>().WaitForCurrentWindow("Win_HomePetPrepare", 10))
                {
                    CHR.GetClass <GUI>().Click("Win_HomePetPrepare", "Btn_Skip");
                }
            }
            if (CHR.GetClass <GUI>().WaitForCurrentWindow("Win_HomePetFirstAward", SkipBattles ? 10 : 60))
            {
                GetPrizeBag();
                CHR.GetClass <GUI>().Click("Win_HomePetFirstAward", "Btn_Close");
            }
            Run();
            THH.SelfStop("BeastBattle:" + CHR.Name);
            IsRun = false;
        }
Ejemplo n.º 15
0
        public void LoadInventory()
        {
            CHR.GetClass <GUI>().Click("Win_HomePetMain", "Btn_Storage");
            BIL.Clear();
            int rr  = -1;
            int BIB = Memory.RD(CHR.HNDL, MBO + OFS.GetInt("BS_InventoryBegin"));
            int BIE = Memory.RD(CHR.HNDL, MBO + OFS.GetInt("BS_InventoryEnd"));

            while (BIB < BIE)
            {
                byte[] buffer = new byte[OFS.GetInt("BS_InventoryItemSize")];
                EF.ReadProcessMemory(CHR.HNDL, BIB, buffer, buffer.Length, ref rr);
                int[] oa = new int[buffer.Length / 4];
                Buffer.BlockCopy(buffer, 0, oa, 0, buffer.Length);
                ItemBeast NBI = new ItemBeast(CHR);
                NBI.id    = oa[OFS.GetInt("BS_BI_ID") / 4];
                NBI.count = oa[OFS.GetInt("BS_BI_Count") / 4];
                BIL.Add(NBI.id, NBI);
                BIB += OFS.GetInt("BS_InventoryItemSize");
            }
            CHR.GetClass <GUI>().Click("Win_HomePetMain", "Btn_Storage");
        }
Ejemplo n.º 16
0
 public ChrImporter()
 {
     targetPath = "Assets/Npcs";
     chr        = new CHR(Utils.CombinePath(dataPath, "3DDATA/NPC/LIST_NPC.CHR"));
     zsc        = new ZscImporter("3DDATA/NPC/PART_NPC.ZSC");
 }
Ejemplo n.º 17
0
 public void CalculateDistance()
 {
     CHR.LoadLocation();
     distance = (float)CHR.LOC.GetDistance(loc);
 }
Ejemplo n.º 18
0
        public Boolean LevelUpForSpirit()
        {
            ItemFairy FI = GetEquiped();

            if (!FI.IsGood())
            {
                return(false);
            }
            int    DSU = (int)((double)Level.EXP[FI.lvl] * 0.4 / (FI.lvl < 11 ? 0.5 : Math.Round((double)FI.lvl / (double)CHR.GetVar("LVL"), 2) * 5));
            Packet P   = new Packet(CHR.HNDL, "71-00-00-00-00-00-01");

            P.Copy(DSU, 2, 4);
            P.Send();
            return(true);
        }
Ejemplo n.º 19
0
        void LoadContext(CHR chr)
        {
            chr.HeadTextureName = chr.TextureName + "_icon";

            //this.head.Texture.Index = chr.HeadTextureIndex;
            this.head.Texture.Name = chr.HeadTextureName;

            this.nam.Text = "名字: " + chr.Name;

            this.hp.Text = "HP: " + chr.HP + " / " + chr.HPMax;

            this.lv.Text    = "LV: " + chr.Level;
            this.chrlv.Text = "徒步战LV: " + chr.CBLevel;
            this.mtllv.Text = "驾驶战LV: " + chr.MBLevel;

            this.exp.Text = "经验: " + chr.EXP;
            try
            {
                this.dmg.Text = "攻击: " + chr.Weapon.Damage.ToString("f1") + "\n命中: " + chr.Accurate.ToString("f1") + "%";
                this.def.Text = "防御: " + chr.Defense.ToString("f1") + "\n闪避: " + chr.Missrate.ToString("f1") + "%";
            }
            catch
            {
                this.dmg.Text = "攻击: 0";
                this.def.Text = "防御: 0";
            }
            this.str.Text = "力量: " + chr.Strength;
            this.agi.Text = "敏捷: " + chr.Agility;
            this.itl.Text = "智力: " + chr.Intelligence;
            this.phy.Text = "体质: " + chr.Physique;

            string name;
            string icon_name;

            //if (chr.Equipments[(int)EquipmentCHRType.Weapon].Name != null)
            //{
            //    name = chr.Equipments[(int)EquipmentCHRType.Weapon].Name;
            //    icon_name = chr.Equipments[(int)EquipmentCHRType.Weapon].Icon.Name;
            //}
            //else
            //{
            //    name = "X";
            //    icon_name = "icon_" + ((EquipmentCHRType)(int)EquipmentCHRType.Weapon).ToString().ToLower();
            //}
            //this.b_weapon.Index = 0;
            //this.b_weapon.WaitTextBox.Location = new Point(48, 4);
            //this.b_weapon.WaitTextBox.Text = name;
            //this.b_weapon.WaitTextureBox.Texture.Name = icon_name;
            //this.b_weapon.WaitTextureBox.Size = new Size(48, 32);

            //this.b_weapon.SameAsWait();
            for (int i = 0; i < 8; i++)
            {
                if (chr.Equipments[i].Name != null)
                {
                    name      = chr.Equipments[i].Name;
                    icon_name = chr.Equipments[i].Icon.Name;
                }
                else
                {
                    name      = "无";
                    icon_name = "icon_" + ((EquipmentCHRType)i).ToString().ToLower();
                }
                this.b_equip[i].Index = i;
                this.b_equip[i].WaitTextBox.Location        = new Point(48, 4);
                this.b_equip[i].WaitTextBox.Text            = name;
                this.b_equip[i].WaitTextureBox.Texture.Name = icon_name;
                this.b_equip[i].WaitTextureBox.Size         = new Size(48, 32);
                this.b_equip[i].SameAsWait();
            }
        }
Ejemplo n.º 20
0
        protected void DrawCHR(CHR chr)
        {
            if (chr == null)
            {
                return;
            }
            if (chr.TextureName == null)
            {
                return;
            }
            if (chr.Invisible)
            {
                return;
            }
            if (chr.TextureIndex < 0)
            {
                chr.TextureIndex = game.Textures.GetIndex(chr.TextureName);
            }
            Rectangle dz = new Rectangle();

            dz.Y = (int)chr.RealDirection * game.Textures[chr.TextureIndex].TileSize.Height;
            if (chr.NeedMovePixel > 0 && chr.IsRigor == false)
            {
                dz.X = (((int)((float)game.Options.TilePixelX - chr.NeedMovePixel)) / (game.Options.TileSizePixelX.Width / 4) + 1) * game.Textures[chr.TextureIndex].TileSize.Width;
            }
            else
            {
                dz.X = 0;
            }
            //if (chr is NPC)
            //{
            //    if (((NPC)chr).IsDoor)
            //    {
            //        dz.Y += (2 - chr.Size.Height) * game.Textures[chr.TextureIndex].TileSize.Height;
            //    }
            //}
            Size tdz = game.Textures[chr.TextureIndex].TileSize;

            tdz.Width  *= chr.Size.Width;
            tdz.Height *= chr.Size.Height;
            //if (chr is NPC)
            //{
            //    if (((NPC)chr).IsDoor)
            //    {
            //        tdz.Height *= 2;
            //    }
            //}
            dz.Size = tdz;
            Vector3 v31 = chr.RealLocationPixel;

            v31.Y += game.Options.SpriteOffsetPixel;
            v31.X += game.SCN.RealLocationPixel.X;
            v31.Y += game.SCN.RealLocationPixel.Y;
            v31.Z += game.SCN.RealLocationPixel.Z;
            v31    = Util.Vector3AddVector3(v31, ScreenOffsetPixel);
            if (chr is NPC)
            {
                if (((NPC)chr).IsDoor)
                {
                    v31.Y -= game.Options.TileSizePixelX.Height * (chr.Size.Height - 1);
                }
            }
            Size dsize = game.Options.TileSizePixelX;

            dsize.Width  *= chr.Size.Width;
            dsize.Height *= chr.Size.Height;
            //if (chr is NPC)
            //{
            //    if (((NPC)chr).IsDoor)
            //    {
            //        dsize.Height *= 2;
            //    }
            //}
            float rot = 0;

            game.DrawMetalXTexture(
                game.Textures[chr.TextureIndex],
                dz,
                v31,
                dsize,
                rot,
                Util.MixColor(chr.ColorFilter, ColorFilter));
        }