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()); }
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; } }