private static void SellRequest(WorldClient Client, string Packet) { Client.Send(new GameRideMessage("v")); int price = int.Parse(Packet.Substring(2)); MountPark MP1 = Client.Character.myMap.mountPark; if (MP1 == null) { return; } if (MP1.get_owner() == -1) { Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 94)); return; } if (MP1.get_owner() != Client.Character.ID) { Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 95)); return; } MP1.set_price(price); MountParkTable.Update(MP1); Client.Character.myMap.SendToMap(new MapMountParkMessage(MP1)); }
private static void BuyRequest(WorldClient Client, string Packet) { Client.Send(new GameRideMessage("v")); MountPark MP = Client.Character.myMap.mountPark; if (MP == null) { Client.Send(new BasicNoOperationMessage()); return; } if (MP.get_owner() == -1) { Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 96)); return; } if (MP.get_price() == 0) { Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 97)); return; } if (!Client.Character.HasGuild()) { Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 135)); return; } if (Client.GetCharacter().getCharacterGuild().GradeType != GuildGradeEnum.GRADE_BOSS) { Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 98)); return; } byte enclosMax = (byte)Math.Floor((double)Client.Character.GetGuild().Level / 10); byte TotalEncloGuild = (byte)MountParkTable.CountByGuild(Client.Character.GetGuild().ID); if (TotalEncloGuild >= enclosMax) { Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 103)); return; } if (Client.Character.Kamas < MP.get_price()) { Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 82)); return; } Client.GetCharacter().InventoryCache.SubstractKamas(MP.get_price()); if (MP.get_owner() > 0) { var Owner = CharacterTable.GetCharacter(MP.get_owner()); if (Owner != null && Owner.Account.curPlayer != null) { Owner.Send(new ChatGameMessage("Un enclo a ete vendu a " + MP.get_price() + ".", "CC0000")); Owner.Account.Data.BankKamas += MP.get_price(); Owner.Account.Data.Save(); } else { AccountDataTable.Update(MP.get_price(), MP.get_owner()); } } MP.set_price(0); MP.set_owner(Client.Character.ID); MP.set_guild(Client.Character.GetGuild()); MountParkTable.Update(MP); CharacterTable.Update(Client.Character); Client.GetCharacter().myMap.SendToMap(new MapMountParkMessage(MP)); }