public void PlayerUpgradeRank(GPlayer player, Packet packet) { var ItemTypeID = packet.ReadUInt32(); var ItemQty = packet.ReadUInt16(); var ClubIndex = packet.ReadUInt32(); TClubUpgradeRank UpgradeInfo; PlayerItemData Club; sbyte GetType; AddData RemoveItem; void SendCode(byte[] Code) { player.Response.Write(new byte[] { 0x40, 0x02 }); player.Response.Write(Code); player.SendResponse(); } bool Check() { bool result; result = (ItemTypeID == 0x7C800041); return(result); } if (!Check()) { SendCode(READ_PACKET_ERROR); return; } Club = player.Inventory.ItemWarehouse.GetItem(ClubIndex, TGET_CLUB.gcIndex); if ((Club == null) || (!(GetItemGroup(Club.ItemTypeID) == 0x4))) { SendCode(CLUBSET_NOT_FOUND_OR_NOT_EXIST); return; } UpgradeInfo = PlayerGetClubRankUPData(Club.ItemTypeID, Club.GetClubSlotStatus()); if (UpgradeInfo.ClubPoint <= 0) { SendCode(CLUBSET_NOT_ENOUGHT_POINT_FOR_UPGRADE); // TODO: This must be showned as cannot rank up anymore return; } GetType = PlayerGetSlotUpgrade(ItemTypeID, ItemQty, UpgradeInfo.ClubSlotLeft); if (GetType <= -1) { SendCode(CLUBSET_CANNOT_ADD_SLOT); return; } // /* remove soren card */ RemoveItem = player.Inventory.Remove(ItemTypeID, ItemQty, true); if (!RemoveItem.Status) { SendCode(REMOVE_ITEM_FAIL); return; } if (!Club.RemoveClubPoint(UpgradeInfo.ClubPoint)) { SendCode(CLUBSET_NOT_ENOUGHT_POINT_FOR_UPGRADE); return; } // Add To Log Club.ItemClubPointLog += UpgradeInfo.ClubPoint; if (!Club.ClubAddStatus((TCLUB_STATUS)GetType)) { SendCode(CLUBSET_CANNOT_ADD_SLOT); return; } // * this is used for add club slot when rank is up to Special * if (UpgradeInfo.ClubCurrentRank >= 4) { if (!Club.ClubAddStatus((TCLUB_STATUS)UpgradeInfo.ClubSPoint)) { SendCode(CLUBSET_CANNOT_ADD_SLOT); return; } } // ## add transaction player.Inventory.ItemTransaction.AddClubSystem(Club); player.SendTransaction(); player.Response.Write(new byte[] { 0x40, 0x02 }); player.Response.Write(0); player.Response.WriteUInt32((uint)GetType); player.Response.WriteUInt32(Club.ItemIndex); player.SendResponse(); }