Example #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);
        }
Example #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;
            }
        }