public void Parse(GameClient Session, ClientPacket paket) { if (!Session.GetHabbo().lastPhotoPreview.Contains("-")) { return; } if (Session.GetHabbo().Duckets < 1) { Session.SendMessage(RoomNotificationComposer.SendBubble("camera", "Necesitas tener al menos 1 Ducket para adquirir una foto de Mabbi.", "")); return; } string roomId = Session.GetHabbo().lastPhotoPreview.Split('-')[0]; string timestamp = Session.GetHabbo().lastPhotoPreview.Split('-')[1]; string md5image = URLPost.GetMD5(Session.GetHabbo().lastPhotoPreview); ItemData Item = null; if (!RavenEnvironment.GetGame().GetItemManager().GetItem(8763, out Item)) { return; } if (Item == null) { return; } Item photoPoster = ItemFactory.CreateSingleItemNullable(Item, Session.GetHabbo(), "{\"timestamp\":\"" + timestamp + "\", \"id\":\"" + md5image + "\"}", ""); if (photoPoster != null) { Session.GetHabbo().GetInventoryComponent().TryAddItem(photoPoster); Session.SendMessage(new FurniListAddComposer(photoPoster)); Session.SendMessage(new FurniListUpdateComposer()); Session.SendMessage(new FurniListNotificationComposer(photoPoster.Id, 1)); Session.GetHabbo().Duckets--; Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().Duckets, -1)); RavenEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_CameraPhotoCount", 1); } Session.SendMessage(new BuyPhoto()); Session.GetHabbo().GetInventoryComponent().UpdateItems(false); using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("INSERT INTO items_camera VALUES (@id, '" + Session.GetHabbo().Id + "',@creator_name, '" + roomId + "','" + timestamp + "')"); dbClient.AddParameter("id", md5image); dbClient.AddParameter("creator_name", Session.GetHabbo().Username); dbClient.RunQuery(); } }
public void Parse(GameClient Session, ClientPacket paket) { if (!Session.GetHabbo().lastPhotoPreview.Contains("-")) { return; } string roomId = Session.GetHabbo().lastPhotoPreview.Split('-')[0]; string timestamp = Session.GetHabbo().lastPhotoPreview.Split('-')[1]; string md5image = URLPost.GetMD5(Session.GetHabbo().lastPhotoPreview); ItemData Item = null; if (!QuasarEnvironment.GetGame().GetItemManager().GetItem(8763, out Item)) // Ok I don't know why your item is this crazy id? Change it here, anyways. { return; } if (Item == null) { return; } Item photoPoster = ItemFactory.CreateSingleItemNullable(Item, Session.GetHabbo(), "{\"timestamp\":\"" + timestamp + "\", \"id\":\"" + md5image + "\"}", ""); if (photoPoster != null) { Session.GetHabbo().GetInventoryComponent().TryAddItem(photoPoster); Session.SendMessage(new FurniListAddComposer(photoPoster)); Session.SendMessage(new FurniListUpdateComposer()); } Session.SendMessage(new BuyPhoto()); Session.GetHabbo().GetInventoryComponent().UpdateItems(false); using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("INSERT INTO items_camera VALUES (@id, '" + Session.GetHabbo().Id + "',@creator_name, '" + roomId + "','" + timestamp + "')"); dbClient.AddParameter("id", md5image); dbClient.AddParameter("creator_name", Session.GetHabbo().Username); dbClient.RunQuery(); } }
internal void BuyServerCameraPhoto() { if ((OtanixEnvironment.GetUnixTimestamp() - Session.GetHabbo().UltimaFotoComprada) < 20) { Session.SendNotif("Você deve esperar 20 segundos antes de comprar outra foto."); return; } if (!Session.GetHabbo().lastPhotoPreview.Contains("-")) { return; } string roomId = Session.GetHabbo().lastPhotoPreview.Split('-')[0]; string timestamp = Session.GetHabbo().lastPhotoPreview.Split('-')[1]; string md5image = URLPost.GetMD5(Session.GetHabbo().lastPhotoPreview); Item Item = OtanixEnvironment.GetGame().GetItemManager().GetItem(EmuSettings.CAMERA_BASEID); if (Item == null) { return; } ServerMessage Message = new ServerMessage(Outgoing.BuyPhoto); Session.SendMessage(Message); OtanixEnvironment.GetGame().GetCatalog().DeliverItems(Session, Item, 1, "{\"timestamp\":\"" + timestamp + "\", \"id\":\"" + md5image + "\"}", true, 0); Session.GetHabbo().GetInventoryComponent().UpdateItems(false); OtanixEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(Session.GetHabbo().Id, "ACH_CameraPhotoCount", 1); using (IQueryAdapter dbClient = OtanixEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("REPLACE INTO items_camera VALUES (@id, '" + Session.GetHabbo().Id + "',@creator_name, '" + roomId + "','" + timestamp + "')"); dbClient.addParameter("id", md5image); dbClient.addParameter("creator_name", Session.GetHabbo().Username); dbClient.runQuery(); } Session.GetHabbo().UltimaFotoComprada = OtanixEnvironment.GetUnixTimestamp(); }