Пример #1
0
        public bool ClubRemoveStatus(TCLUB_STATUS Slot)
        {
            Update();
            switch (Slot)
            {
            case TCLUB_STATUS.csPower:
            {
                if (ItemC0 > 0)
                {
                    ItemC0 -= 1;
                    return(true);
                }
                return(false);
            }

            case TCLUB_STATUS.csControl:
            {
                if (ItemC1 > 0)
                {
                    ItemC1 -= 1;
                    return(true);
                }
                return(false);
            }

            case TCLUB_STATUS.csImpact:
            {
                if (ItemC2 > 0)
                {
                    ItemC2 -= 1;
                    return(true);
                }
                return(false);
            }

            case TCLUB_STATUS.csSpin:
            {
                if (ItemC3 > 0)
                {
                    ItemC3 -= 1;
                    return(true);
                }
                return(false);
            }

            case TCLUB_STATUS.csCurve:
            {
                if (ItemC4 > 0)
                {
                    ItemC4 -= 1;
                    return(true);
                }
                return(false);
            }
            }
            return(true);
        }
Пример #2
0
        public static byte[] ShowClubStatus(TCLUB_ACTION Action, TCLUB_ACTION code, TCLUB_STATUS slot, uint ClubIndex, uint PangConsume = 0)
        {
            var result = new PangyaBinaryWriter();

            result.Write(new byte[] { 0xA5, 0x00 });
            result.WriteByte((byte)Action);
            result.WriteByte((byte)code);
            result.WriteByte((byte)slot);
            result.WriteUInt32(ClubIndex);
            result.WriteUInt64(PangConsume);
            return(result.GetBytes());
        }
Пример #3
0
        public bool ClubAddStatus(TCLUB_STATUS Slot)
        {
            Update();
            switch (Slot)
            {
            case TCLUB_STATUS.csPower:
            {
                ItemC0Slot += 1;
            }
            break;

            case TCLUB_STATUS.csControl:
            {
                ItemC1Slot += 1;
            }
            break;

            case TCLUB_STATUS.csImpact:
            {
                ItemC2Slot += 1;
            }
            break;

            case TCLUB_STATUS.csSpin:
            {
                ItemC3Slot += 1;
            }
            break;

            case TCLUB_STATUS.csCurve:
            {
                ItemC0Slot += 1;
            }
            break;
            }
            return(true);
        }
Пример #4
0
        public TClubUpgradeData ClubSlotAvailable(TCLUB_STATUS Slot)
        {
            const uint Power = 2100, Con = 1700, Impact = 2400, Spin = 1900, Curve = 1900;


            var ClubData = GetClubMaxStatus(ItemTypeID);

            switch (Slot)
            {
            case TCLUB_STATUS.csPower:
            {
                if (ItemC0 < (ClubData.Power + this.ItemC0Slot))
                {
                    var result = new TClubUpgradeData()
                    {
                        Able = true,
                        Pang = (ItemC0 * Power) + Power
                    };
                    return(result);
                }
            }
            break;

            case TCLUB_STATUS.csControl:
            {
                if (ItemC1 < (ClubData.Control + ItemC1Slot))
                {
                    var result = new TClubUpgradeData()
                    {
                        Able = true,
                        Pang = (ItemC1 * Con) + Con
                    };
                    return(result);
                }
            }
            break;

            case TCLUB_STATUS.csImpact:
            {
                if (ItemC2 < (ClubData.Impact + ItemC2))
                {
                    var result = new TClubUpgradeData()
                    {
                        Able = true,
                        Pang = (ItemC2 * Impact) + Impact
                    };
                    return(result);
                }
            }
            break;

            case TCLUB_STATUS.csSpin:
            {
                if (ItemC3 < (ClubData.Spin + ItemC3))
                {
                    var result = new TClubUpgradeData()
                    {
                        Able = true,
                        Pang = (ItemC3 * Spin) + Spin
                    };
                    return(result);
                }
            }
            break;

            case TCLUB_STATUS.csCurve:
            {
                if (ItemC4 < (ClubData.Curve + ItemC4))
                {
                    var result = new TClubUpgradeData()
                    {
                        Able = true,
                        Pang = (ItemC4 * Curve) + Curve
                    };
                    return(result);
                }
            }
            break;
            }

            return(new TClubUpgradeData());
        }
Пример #5
0
        public void PlayerUpgradeClubSlot(GPlayer player, Packet packet)
        {
            TCLUB_ACTION Action    = (TCLUB_ACTION)packet.ReadByte();
            TCLUB_STATUS Slot      = (TCLUB_STATUS)packet.ReadByte();
            uint         ClubIndex = packet.ReadUInt32();

            var Club = player.Inventory.ItemWarehouse.GetClub(ClubIndex, TGET_CLUB.gcIndex);

            if (Club == null)
            {
                WriteConsole.WriteLine("PLAYER_CLUB_NULL");
                player.SendResponse(new byte[] { 0xA5, 0x00, 0x04 });
                return;
            }
            switch (Action)
            {
            case TCLUB_ACTION.Upgrade:
            {
                var GetClub = Club.ClubSlotAvailable(Slot);

                if (!GetClub.Able)
                {
                    WriteConsole.WriteLine("PLAYER_CLUB_UPGRADE_FALIED 1");
                    player.SendResponse(new byte[] { 0xA5, 0x00, 0x04 });
                    return;
                }
                if (!player.RemovePang(GetClub.Pang))
                {
                    WriteConsole.WriteLine("PLAYER_CLUB_UPGRADE_FALIED 2");
                    player.SendResponse(new byte[] { 0xA5, 0x00, 0x03 });
                    return;
                }

                if (Club.ClubAddStatus(Slot))
                {
                    Club.ItemClubPangLog = Club.ItemClubPangLog += GetClub.Pang;
                    GetClub.Pang         = (uint)Club.ItemClubPangLog;
                    player.Inventory.ItemWarehouse.Update(Club);

                    player.Write(ShowClubStatus(TCLUB_ACTION.Upgrade, TCLUB_ACTION.Upgrade, Slot, Club.ItemIndex, GetClub.Pang));
                    player.SendPang();
                }
            }
            break;

            case TCLUB_ACTION.Downgrade:
            {
                var GetClub = Club.ClubSlotAvailable(Slot);
                if (!GetClub.Able)
                {
                    WriteConsole.WriteLine("PLAYER_CLUB_DOWN_FALIED 1");
                    player.SendResponse(new byte[] { 0xA5, 0x00, 0x04 });
                    return;
                }
                if (!player.RemovePang((uint)Club.ItemClubPangLog))
                {
                    WriteConsole.WriteLine("PLAYER_CLUB_DOWN_FALIED 2");
                    player.SendResponse(new byte[] { 0xA5, 0x00, 0x03 });
                    return;
                }
                if (Club.ClubRemoveStatus(Slot))
                {
                    Club.ItemClubPangLog = Club.ItemClubPangLog -= GetClub.Pang;

                    player.Inventory.ItemWarehouse.Update(Club);

                    player.SendResponse(ShowClubStatus(TCLUB_ACTION.Decrement, TCLUB_ACTION.Downgrade, Slot, Club.ItemIndex, GetClub.Pang));
                    player.SendPang();
                }
            }
            break;

            default:
            {
                WriteConsole.WriteLine("PLAYER_CLUB_ACTION_UNKNOWN");
                player.SendResponse(new byte[] { 0xA5, 0x00, 0x04 });
            }
            break;
            }
        }