Example #1
0
        public string[] toStringArray()
        {
            string[] info = { Health.ToString(), Armor.ToString(), Strength.ToString(), Dexterity.ToString(), Mana.ToString(),
                              Level.ToString(),  EXP.ToString(),   Name,                Race,                 ClassName };

            return(info);
        }
Example #2
0
        /// <summary>
        /// 加载产品
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void btnLoadProduct_Click(object sender, EventArgs e)
        {
            string Errstring = "";

            if (lbxProductCategory.SelectedIndex == -1)
            {
                return;
            }
            btnLoadProduct.Enabled = false;

            string pdt = null;

            pdt = lbxProductCategory.SelectedValue.ToString();

            btnLoadProduct.Enabled = true;
            Form_Wait.ShowForm();
            await Task.Run(new Action(() =>
            {
                try
                {
                    //需要加载当前产品相关的参数
                    _operation = JFHubCenter.Instance.RecipeManager.GetRecipe("Product", pdt) as JFDLAFProductRecipe;
                    if (_operation == null)
                    {
                        HTUi.TipError("Recipe Manager中不存在配方:" + pdt);
                        return;
                    }

                    if (Errstring == "")
                    {
                        HTLog.Info("加载产品完成.");
                        HTUi.TipHint("加载产品完成");
                        if (_operation.MgzIdx == -1)
                        {
                            HTLog.Error("注意:当前产品未选择料盒型号,开始流程需要选择料盒型号.");
                        }
                    }
                    else
                    {
                        HTLog.Error("加载产品失败!!!" + Errstring);
                        HTUi.TipError("加载产品失败");
                        HTUi.PopWarn("产品加载失败\n" + Errstring);
                    }
                }
                catch (Exception EXP)
                {
                    HTLog.Error(String.Format("{0}加载新产品失败\n", EXP.ToString()));
                    HTUi.TipError("加载新产品失败");
                }
            }));

            if (_operation != null)
            {
                SetupUI();
            }
            JFHubCenter.Instance.SystemCfg.SetItemValue("CurrentID", pdt);
            JFHubCenter.Instance.SystemCfg.Save();
            Form_Wait.CloseForm();
        }
 public Status(string n)
 {
     _name = n;
     _hp   = new HP(100, 100, 0);
     _atc  = new ATC(999, 10, 0);
     _exp  = new EXP(100, 0, 0);
     _lv   = new LV(99, 1, 0);
 }
Example #4
0
        void editPlayerlevel(byte level, int offset)
        {
            int PlayerBlockOffset = (offset * length);

            byte[] block   = ModifiedBlock.Skip(PlayerStartOffset + PlayerBlockOffset).Take(length).ToArray();
            ushort ScoutID = BitConverter.ToUInt16(block.Skip(0x4).Take(2).ToArray(), 0);
            EXP    E       = new EXP();
            int    EXPType = 0;

            ushort[] Moves        = { };
            byte[]   UnlockLevels = { };

            if (!PlayerClass.IEPlayer.ContainsKey(ScoutID))
            {
                MessageBox.Show("An unknown Error occured");
                return;
            }
            EXPType      = PlayerClass.IEPlayer[ScoutID].EXPType;
            Moves        = PlayerClass.IEPlayer[ScoutID].MoveHEXID;
            UnlockLevels = PlayerClass.IEPlayer[ScoutID].MoveUnlockLevel;

            block[0x4a] = level;

            uint EXPToWrite = E.TypeToExp[EXPType][block[0x4a] - 1];

            ushort[] MovesInBlock = new ushort[4];

            List <Tuple <byte, ushort> > myList = new List <Tuple <byte, ushort> >();

            for (int i = 0; i < 4; i++)
            {
                MovesInBlock[i] = BitConverter.ToUInt16(block.Skip(0x38 + i * 2).Take(2).ToArray(), 0);
                block[i]        = BitConverter.GetBytes(EXPToWrite)[i]; // since we do a for loop with 4 bytes, we can save some lines of code and drop it here
                myList.Add(new Tuple <byte, ushort>(UnlockLevels[i], Moves[i]));
            }

            myList.Sort(Comparer <Tuple <byte, ushort> > .Default);                                    // Sort the List

            for (int i = 0; i < 4; i++)                                                                // these are checks for wheter or not a player has learned a move or not, done this way just to prevent possible bugs
            {
                if (level >= myList[i].Item1 && !MovesInBlock.Contains(myList[i].Item2))               // if the player level is higher or equal to the player's level and the move we're trying to learn isn't learned yet, write it
                {
                    for (int j = i; j < 4; j++)                                                        // finds empty slot
                    {
                        if (BitConverter.ToUInt16(block.Skip(0x38 + j * 2).Take(2).ToArray(), 0) == 0) // if slot is empty, write move
                        {
                            block = FileIO.WriteData(block, 0x38 + (j * 2), BitConverter.GetBytes(myList[i].Item2), BitConverter.GetBytes(myList[i].Item2).Length);
                            break; // break and don't exectue loop further
                        }
                    }
                }
            }

            ModifiedBlock = FileIO.WriteData(ModifiedBlock, PlayerStartOffset + PlayerBlockOffset, block, block.Length); // no extra formatting to do since the EXP offset is 0
            LoadPlayer();                                                                                                // once done, reload
        }
Example #5
0
        public void MsgPackReader(string file, bool JSON)
        {
            int i0 = 0;
            int i1 = 0;

            this.Dex = new EXP[0];
            Header   = new PDHead();

            MsgPack MsgPack = file.ReadMPAllAtOnce(JSON);

            if (!MsgPack.Element <MsgPack>("Dex", out MsgPack Dex))
            {
                return;
            }

            this.Dex = new EXP[Dex.Array.Length];
            for (i0 = 0; i0 < this.Dex.Length; i0++)
            {
                if (Dex[i0] is MsgPack EXP)
                {
                    this.Dex[i0] = new EXP {
                        Name = EXP.ReadString("Name")
                    };

                    if (EXP.Element <MsgPack>("Main", out MsgPack Main))
                    {
                        this.Dex[i0].Main = new List <EXPElement>();
                        for (i1 = 0; i1 < Main.Array.Length; i1++)
                        {
                            if (Main[i1] is MsgPack Exp)
                            {
                                this.Dex[i0].Main.Add(ReadEXP(Exp));
                            }
                        }
                    }
                    if (EXP.Element <MsgPack>("Eyes", out MsgPack Eyes))
                    {
                        this.Dex[i0].Eyes = new List <EXPElement>();
                        for (i1 = 0; i1 < Eyes.Array.Length; i1++)
                        {
                            if (Eyes[i1] is MsgPack Exp)
                            {
                                this.Dex[i0].Eyes.Add(ReadEXP(Exp));
                            }
                        }
                    }
                }
            }
            MsgPack = MsgPack.New;
        }
Example #6
0
            public Exp TranslateRecordExp(Level home, List <Exp> field)
            {
                Temp.Temp addr  = new Temp.Temp();
                Expr      alloc = home.Frame.ExternalCall("_record",
                                                          new Tree.ExpList(new CONST(
                                                                               (field.Count == 0 ? 1 : field.Count) * home.Frame.WordSize()), null));
                Stm init = new EXP(new CONST(0));

                for (int i = field.Count - 1; i >= 0; --i)
                {
                    Expr offset = new BINOP(BINOP.Op.Plus, new TEMP(addr), new CONST(i * home.Frame.WordSize()));
                    Expr v      = field[i].UnEx();
                    init = new SEQ(new MOVE(new MEM(offset), v), init);
                }
                return(new Ex(new ESEQ(new SEQ(new MOVE(new TEMP(addr), alloc), init), new TEMP(addr))));
            }
Example #7
0
    /// <summary>
    /// You died!
    /// </summary>
    public override void Die()
    {
        // add experience to the current level.
        BF_GameManager.instance.DeltaCurrentExp(EXP);

        // minus monster count.
        --BF_GameManager.instance.MOB_CURRENT_IN_SCENE;

        JCS_UtilitiesManager jcsUm = JCS_UtilitiesManager.instance;

        if (jcsUm.GetIGLogSystem() != null)
        {
            string expMsg = BF_MessageSettings.instance.EXP_BASE + EXP.ToString();

            jcsUm.GetIGLogSystem().SendLogMessage(expMsg);
        }

        base.Die();
    }
Example #8
0
        public void MsgPackReader(string file, bool json)
        {
            Dex    = null;
            header = new Header();

            MsgPack msgPack = file.ReadMPAllAtOnce(json);
            MsgPack dex;

            if ((dex = msgPack["Dex", true]).NotNull)
            {
                Dex = new EXP[dex.Array.Length];
                for (i0 = 0; i0 < Dex.Length; i0++)
                {
                    Dex[i0] = new EXP {
                        Name = dex[i0].RS("Name")
                    };

                    MsgPack temp;
                    if ((temp = dex[i0]["Main", true]).NotNull)
                    {
                        Dex[i0].Main          = KKdList <EXPElement> .New;
                        Dex[i0].Main.Capacity = temp.Array.Length;
                        for (i1 = 0; i1 < Dex[i0].Main.Capacity; i1++)
                        {
                            Dex[i0].Main.Add(EXPElement.Read(temp[i1]));
                        }
                    }
                    if ((temp = dex[i0]["Eyes", true]).NotNull)
                    {
                        Dex[i0].Eyes          = KKdList <EXPElement> .New;
                        Dex[i0].Eyes.Capacity = temp.Array.Length;
                        for (i1 = 0; i1 < this.Dex[i0].Eyes.Capacity; i1++)
                        {
                            Dex[i0].Eyes.Add(EXPElement.Read(temp[i1]));
                        }
                    }
                    temp.Dispose();
                }
            }
            dex.Dispose();
            msgPack.Dispose();
        }
Example #9
0
 public void SaveData()//حفظ الداتا
 {
     try
     {
         StreamWriter SW = new StreamWriter("Data");
         SW.Write(size + ";");
         SW.Write(PenCase + ";");
         SW.Write(Case + ";");
         SW.Write(color.R + ";");
         SW.Write(color.G + ";");
         SW.Write(color.B + ";");
         SW.Write(color2.R + ";");
         SW.Write(color2.G + ";");
         SW.Write(color2.B);
         SW.Close();
     }
     catch (Exception EXP)
     {
         MessageBox.Show(EXP.ToString());
     }
 }
Example #10
0
        public int DEXReader(string filepath, string ext)
        {
            Header = new PDHead();
            IO     = File.OpenReader(filepath + ext);

            Header.Format    = Main.Format.F;
            Header.Signature = IO.ReadInt32();
            if (Header.Signature == 0x43505845)
            {
                Header = IO.ReadHeader(true);
            }
            if (Header.Signature != 0x64)
            {
                return(0);
            }

            Offset = IO.Position - 0x4;
            Dex    = new EXP[IO.ReadInt32()];
            int DEXOffset = IO.ReadInt32();

            if (IO.ReadInt32() == 0x00)
            {
                Header.Format = Main.Format.X;
            }
            int DEXNameOffset = IO.ReadInt32();

            if (Header.IsX)
            {
                IO.ReadInt32();
            }

            IO.Seek(DEXOffset + Offset, 0);
            for (int i0 = 0; i0 < Dex.Length; i0++)
            {
                Dex[i0] = new EXP {
                    Main = new List <EXPElement>(), Eyes = new List <EXPElement>()
                }
            }
            ;

            for (int i0 = 0; i0 < Dex.Length; i0++)
            {
                Dex[i0].MainOffset = IO.ReadInt32();
                if (Header.IsX)
                {
                    IO.ReadInt32();
                }
                Dex[i0].EyesOffset = IO.ReadInt32();
                if (Header.IsX)
                {
                    IO.ReadInt32();
                }
            }
            IO.Seek(DEXNameOffset + Offset, 0);
            for (int i0 = 0; i0 < Dex.Length; i0++)
            {
                Dex[i0].NameOffset = IO.ReadInt32();
                if (Header.IsX)
                {
                    IO.ReadInt32();
                }
            }

            for (int i0 = 0; i0 < Dex.Length; i0++)
            {
                EXPElement element = new EXPElement();
                IO.Seek(Dex[i0].MainOffset + Offset, 0);
                while (true)
                {
                    element.Frame = IO.ReadSingle();
                    element.Both  = IO.ReadUInt16();
                    element.ID    = IO.ReadUInt16();
                    element.Value = IO.ReadSingle();
                    element.Trans = IO.ReadSingle();
                    Dex[i0].Main.Add(element);

                    if (element.Frame == 999999 || element.Both == 0xFFFF)
                    {
                        break;
                    }
                }

                IO.Seek(Dex[i0].EyesOffset + Offset, 0);
                while (true)
                {
                    element.Frame = IO.ReadSingle();
                    element.Both  = IO.ReadUInt16();
                    element.ID    = IO.ReadUInt16();
                    element.Value = IO.ReadSingle();
                    element.Trans = IO.ReadSingle();
                    Dex[i0].Eyes.Add(element);

                    if (element.Frame == 999999 || element.Both == 0xFFFF)
                    {
                        break;
                    }
                }

                IO.Seek(Dex[i0].NameOffset + Offset, 0);
                Dex[i0].Name = IO.NullTerminatedUTF8();
            }

            IO.Close();
            return(1);
        }
Example #11
0
        public int DEXReader()
        {
            KKtIO reader = KKtIO.OpenReader(filepath + ext);

            Header = new KKtMain.Header();

            Header.Format    = KKtMain.Format.F;
            Header.Signature = reader.ReadInt32();
            if (Header.Signature == 0x43505845)
            {
                Header = reader.ReadHeader(true);
            }
            if (Header.Signature != 0x64)
            {
                return(0);
            }

            Offset = reader.Position - 0x4;
            DEX    = new EXP[reader.ReadInt32()];
            int DEXOffset = reader.ReadInt32();

            if (reader.ReadInt32() == 0x00)
            {
                Header.Format = KKtMain.Format.X;
            }

            reader.Seek(DEXOffset + Offset, 0);
            for (int i0 = 0; i0 < DEX.Length; i0++)
            {
                DEX[i0] = new EXP {
                    Main = new List <EXPElement>(), Eyes = new List <EXPElement>()
                }
            }
            ;

            for (int i0 = 0; i0 < DEX.Length; i0++)
            {
                DEX[i0].MainOffset = reader.ReadInt32();
                if (Header.Format == KKtMain.Format.X)
                {
                    reader.ReadInt32();
                }
                DEX[i0].EyesOffset = reader.ReadInt32();
                if (Header.Format == KKtMain.Format.X)
                {
                    reader.ReadInt32();
                }
            }
            for (int i0 = 0; i0 < DEX.Length; i0++)
            {
                DEX[i0].NameOffset = reader.ReadInt32();
                if (Header.Format == KKtMain.Format.X)
                {
                    reader.ReadInt32();
                }
            }

            for (int i0 = 0; i0 < DEX.Length; i0++)
            {
                EXPElement element = new EXPElement();
                reader.Seek(DEX[i0].MainOffset + Offset, 0);
                while (true)
                {
                    element.Frame = reader.ReadSingle();
                    element.Both  = reader.ReadUInt16();
                    element.ID    = reader.ReadUInt16();
                    element.Value = reader.ReadSingle();
                    element.Trans = reader.ReadSingle();
                    DEX[i0].Main.Add(element);

                    if (element.Frame == 999999 || element.Both == 0xFFFF)
                    {
                        break;
                    }
                }

                reader.Seek(DEX[i0].EyesOffset + Offset, 0);
                while (true)
                {
                    element.Frame = reader.ReadSingle();
                    element.Both  = reader.ReadUInt16();
                    element.ID    = reader.ReadUInt16();
                    element.Value = reader.ReadSingle();
                    element.Trans = reader.ReadSingle();
                    DEX[i0].Eyes.Add(element);

                    if (element.Frame == 999999 || element.Both == 0xFFFF)
                    {
                        break;
                    }
                }

                reader.Seek(DEX[i0].NameOffset + Offset, 0);
                DEX[i0].Name = KKtText.ToUTF8(reader.NullTerminated());
            }

            reader.Close();
            return(1);
        }
Example #12
0
        public void XMLReader()
        {
            DEX    = new EXP[0];
            Header = new KKtMain.Header();

            KKtXml Xml = new KKtXml();

            Xml.OpenXml(filepath + ".xml", true);
            Xml.Compact = true;
            int i = 0;

            foreach (XElement DEX_ in Xml.doc.Elements("DEX"))
            {
                foreach (XAttribute Entry in DEX_.Attributes())
                {
                    if (Entry.Name == "Format")
                    {
                        Enum.TryParse(Entry.Value, out Header.Format);
                    }
                    else if (Entry.Name == "Length")
                    {
                        DEX = new EXP[int.Parse(Entry.Value)];
                    }
                }
                foreach (XElement EXP in DEX_.Elements())
                {
                    if (EXP.Name != "EXP")
                    {
                        continue;
                    }

                    DEX[i] = new EXP {
                        Main = new List <EXPElement>(), Eyes = new List <EXPElement>()
                    };
                    foreach (XAttribute Entry in EXP.Attributes())
                    {
                        if (Entry.Name == "Name")
                        {
                            DEX[i].Name = Entry.Value;
                        }
                    }
                    foreach (XElement EXPElement in EXP.Elements())
                    {
                        if (EXPElement.Name == "Main" || EXPElement.Name == "Eyes")
                        {
                            foreach (XElement Element in EXPElement.Elements())
                            {
                                if (Element.Name != "Element")
                                {
                                    continue;
                                }

                                EXPElement element = new EXPElement();
                                foreach (XAttribute Entry in Element.Attributes())
                                {
                                    if (Entry.Name == "Frame")
                                    {
                                        element.Frame = KKtMain.ToDouble(Entry.Value);
                                    }
                                    if (Entry.Name == "Both")
                                    {
                                        element.Both = ushort.Parse(Entry.Value);
                                    }
                                    if (Entry.Name == "ID")
                                    {
                                        element.ID = ushort.Parse(Entry.Value);
                                    }
                                    if (Entry.Name == "Value")
                                    {
                                        element.Value = KKtMain.ToDouble(Entry.Value);
                                    }
                                    if (Entry.Name == "Trans")
                                    {
                                        element.Trans = KKtMain.ToDouble(Entry.Value);
                                    }
                                }
                                if (EXPElement.Name == "Main")
                                {
                                    DEX[i].Main.Add(element);
                                }
                                else if (EXPElement.Name == "Eyes")
                                {
                                    DEX[i].Eyes.Add(element);
                                }
                            }
                        }
                    }
                    i++;
                }
            }
        }
Example #13
0
 public Exp TranslateRecordExp(Level home, List<Exp> field)
 {
     Temp.Temp addr = new Temp.Temp();
     Expr alloc = home.Frame.ExternalCall("_record",
         new Tree.ExpList(new CONST(
             (field.Count == 0 ? 1 : field.Count) * home.Frame.WordSize()), null));
     Stm init = new EXP(new CONST(0));
     for (int i = field.Count - 1; i >= 0; --i)
     {
         Expr offset = new BINOP(BINOP.Op.Plus, new TEMP(addr), new CONST(i * home.Frame.WordSize()));
         Expr v = field[i].UnEx();
         init = new SEQ(new MOVE(new MEM(offset), v), init);
     }
     return new Ex(new ESEQ(new SEQ(new MOVE(new TEMP(addr), alloc), init), new TEMP(addr)));
 }
Example #14
0
 void PrintStm(EXP s, int d)
 {
     Indent(d); SayLn("EXP("); PrintExp(s.Exp, d + 1); Say(")");
 }
Example #15
0
 private void TranslateStm(EXP stm)
 {
     TranslateExpr(stm.Exp);
 }
Example #16
0
 private void TranslateStm(EXP stm)
 {
     TranslateExpr(stm.Exp);
 }
Example #17
0
 void Func()
 {
     EXP ei = new EXP(this);
 }
Example #18
0
 static void Main(string[] args)
 {
     i1 i = EXP.RealiseInterfeces(typeof(BaseTestClass), typeof(i1)) as i1;
 }
Example #19
0
 void PrintStm(EXP s, int d)
 {
     Indent(d); SayLn("EXP("); PrintExp(s.Exp, d + 1); Say(")");
 }