Exemplo n.º 1
0
        public void SendUnequipBattleHench(byte order)
        {
            XBATTLE_HENCH hench = GetOcupiedBattleHenchPocket(order);

            if (hench == null)
            {
                return;
            }
            hench.SendRefreshStatus(this, order);
            int empty = GetEmptyHenchPocket();

            if (empty == -1)
            {
                return;
            }

            XHENCH_INFO hench_info = (XHENCH_INFO)hench.hench_base.Clone();

            this.AsyncRemoveBattleHench(hench);

            hench_info.hench_order = (byte)empty;
            hench_info.position    = 1;

            hench_info.SendHenchInfoPacket();
            henchs.Add(hench_info);
        }
Exemplo n.º 2
0
        public void MoveHenchPocket(byte initial, byte end)
        {
            if (initial < 0 || initial > 19)
            {
                return;
            }
            if (end < 0 || end > 19)
            {
                return;
            }
            Console.WriteLine("Move Hench pocket request: " + initial + " to " + end);


            if (initial == end)
            {
                return;
            }
            XHENCH_INFO hench1 = GetOccupiedHenchPocket(initial);

            Console.WriteLine("Hench1: " + hench1.hench_order);
            if (hench1 == null)
            {
                return;
            }

            XHENCH_INFO hench2 = GetOccupiedHenchPocket(end);

            if (hench2 == null) // no have hench
            {
                XHENCH_INFO clone1 = (XHENCH_INFO)hench1.Clone();
                clone1.hench_order = end;

                AsyncRemoveHench(hench1);

                henchs.Add(clone1);
                clone1.SendHenchInfoPacket();

                return;
            }
            else
            {
                byte hench1_order = hench1.hench_order;
                hench1.hench_order = hench2.hench_order;
                hench2.hench_order = hench1_order;

                hench1.SendHenchInfoPacket();
                hench2.SendHenchInfoPacket();
                return;
            }
        }
Exemplo n.º 3
0
        public void AsyncRemoveHench(XHENCH_INFO hench)
        {
            if (hench == null)
            {
                return;
            }
            using (MemoryStream ms = new MemoryStream())
            {
                int packetlen = 0;
                using (BinaryWriter bw = new BinaryWriter(ms))
                {
                    bw.Write((byte)145); // packet type
                    Console.WriteLine("remover hench: " + hench.hench_order);
                    bw.Write((byte)hench.hench_order);
                    packetlen = (int)bw.BaseStream.Length;
                }
                byte[] buffer = ms.GetBuffer();
                Array.Resize(ref buffer, packetlen);
                Init.server.sendManager.MakePacketAndSend(this.zs_data.GetConnectionAtributes(), buffer);
            }

            this.RemoveHench(hench);
        }
Exemplo n.º 4
0
 public void AddHench(XHENCH_INFO hench)
 {
     this.henchs.Add(hench);
 }
Exemplo n.º 5
0
        private void SendHenchBattleInfoPacket(XBATTLE_HENCH battle_hench)
        {
            Console.WriteLine("Enviando Hench Pocket ...");
            using (MemoryStream stream = new MemoryStream())
            {
                int len = 0;
                using (BinaryWriter bw = new BinaryWriter(stream, Encoding.UTF8))
                {
                    XHENCH_INFO hench = battle_hench.hench_base;

                    bw.Write((byte)103);               // packet type
                    bw.Write((byte)hench.position);    // position
                    bw.Write((byte)hench.hench_order); // hench order
                    bw.Write((short)hench.HenchID);

                    byte[] hench_name = new byte[25];
                    for (int i = 0; i < hench.HenchName.Length; i++)
                    {
                        hench_name[i] = (byte)hench.HenchName[i];
                    }
                    bw.Write(hench_name);


                    bw.Write((byte)hench.sex);

                    if (hench.IsDead)
                    {
                        bw.Write((byte)(0x01));
                    }
                    else
                    {
                        bw.Write((byte)0x00);
                    }


                    bw.Write((short)hench.mixnum); // talvez


                    bw.Write((short)hench.hench_lvmax);
                    bw.Write((short)hench.hench_lv);
                    bw.Write((long)hench.hench_exp);       // current exp
                    bw.Write((long)hench.hench_exp);       // exp base
                    bw.Write((long)hench.hench_exp + 400); // exp next lv

                    bw.Write((byte)0x03);                  // speed move
                    bw.Write((byte)0x00);                  // speed attack
                    bw.Write((byte)0x00);                  // speed skill
                    bw.Write((short)hench.str);
                    bw.Write((short)hench.dex);
                    bw.Write((short)hench.aim);
                    bw.Write((short)hench.luck);
                    bw.Write((short)hench.ap); // talvez
                    bw.Write((short)hench.dp); // talvez
                    bw.Write((short)hench.hc); // talvez
                    bw.Write((short)hench.hd); // talvez
                    bw.Write((short)hench.race_val);
                    bw.Write((short)hench.hp);
                    bw.Write((short)hench.mp);
                    bw.Write((short)hench.max_hp);
                    bw.Write((short)hench.max_mp);
                    bw.Write((byte)hench.growthtype);
                    bw.Write((byte)hench.enchant_grade);
                    bw.Write((long)hench.duration);
                    bw.Write((byte)0x00); // unk
                    bw.Write((byte)hench.item_slot_total);
                    bw.Write((short)hench.item0_idx);
                    bw.Write((int)hench.item0_duration);
                    bw.Write((short)hench.item1_idx);
                    bw.Write((int)hench.item1_duration);
                    bw.Write((short)hench.item2_idx);
                    bw.Write((int)hench.item2_duration);


                    len = (int)bw.BaseStream.Length;
                    Console.WriteLine("Hench packet len: " + len);
                }
                byte[] buffer = stream.GetBuffer();
                Array.Resize(ref buffer, len);
                Init.server.sendManager.MakePacketAndSend(this.zs_data.GetConnectionAtributes(), buffer);
            }
        }
Exemplo n.º 6
0
 public void RemoveHench(XHENCH_INFO hench)
 {
     this.henchs.Remove(hench);
 }
Exemplo n.º 7
0
 public XBATTLE_HENCH(XHENCH_INFO hench)
 {
     this.hench_base = hench;
 }