public FurniListAddComposer(Item item) : base(ServerPacketHeader.FurniListAddMessageComposer) { WriteInteger(item.Id); WriteString(item.GetBaseItem().Type.ToString().ToUpper()); WriteInteger(item.Id); WriteInteger(item.GetBaseItem().SpriteId); if (item.LimitedNo > 0) { WriteInteger(1); WriteInteger(256); WriteString(item.ExtraData); WriteInteger(item.LimitedNo); WriteInteger(item.LimitedTot); } else { ItemBehaviourUtility.GenerateExtradata(item, this); } WriteBoolean(item.GetBaseItem().AllowEcotronRecycle); WriteBoolean(item.GetBaseItem().AllowTrade); WriteBoolean(item.LimitedNo == 0 ? item.GetBaseItem().AllowInventoryStack : false); WriteBoolean(ItemUtility.IsRare(item)); WriteInteger(-1); //Seconds to expiration. WriteBoolean(true); WriteInteger(-1); //Item RoomId if (item.IsWallItem) { return; } WriteString(string.Empty); WriteInteger(0); }
public async Task <IActionResult> Edit(int id) { if (id == null) { return(NotFound()); } var item = await db.Items.FindAsync(id); layoutVM.ItemVM = ItemUtility.MapModelToVM(item); int[] selectedCategoryIds = db.CategoryItems.Where(x => x.ItemId == id).Select(i => i.CategoryId).ToArray(); layoutVM.ItemVM.Categories = db.Categories.Select(a => new SelectListItem { Value = a.Id.ToString(), Text = a.Name }).ToList(); layoutVM.ItemVM.BidStatuses = new List <SelectListItem>() { new SelectListItem { Value = "0", Text = "Not Start" }, new SelectListItem { Value = "1", Text = "Start bid" } }; layoutVM.ItemVM.SelectedCategoryIds = selectedCategoryIds; if (item == null) { return(NotFound()); } return(View(layoutVM)); }
// Token: 0x0600254E RID: 9550 RVA: 0x000D7F30 File Offset: 0x000D6130 protected override void RenderButtons() { base.RenderHelpButton(HelpIdsLight.DefaultLight.ToString(), string.Empty); base.RenderButton(ToolbarButtons.PostReply); base.RenderButton(ToolbarButtons.Reply); base.RenderButton(ToolbarButtons.Forward); bool flag = ItemUtility.UserCanEditItem(this.item); ToolbarButtonFlags flags = (flag && !this.isEmbeddedItem) ? ToolbarButtonFlags.None : ToolbarButtonFlags.Disabled; base.RenderButton(ToolbarButtons.Flag, flags); base.RenderButton(ToolbarButtons.Categories, flags); base.RenderButton(ToolbarButtons.Print); bool flag2 = ItemUtility.UserCanDeleteItem(this.item); ToolbarButtonFlags flags2 = (flag2 && !this.isEmbeddedItem) ? ToolbarButtonFlags.None : ToolbarButtonFlags.Disabled; base.RenderButton(ToolbarButtons.Delete, flags2); ToolbarButtonFlags toolbarButtonFlags = this.isEmbeddedItem ? ToolbarButtonFlags.Disabled : ToolbarButtonFlags.None; base.RenderButton(ToolbarButtons.Move, toolbarButtonFlags); ToolbarButtonFlags flags3 = toolbarButtonFlags; base.RenderButton(ToolbarButtons.Previous, flags3); base.RenderButton(ToolbarButtons.Next, flags3); }
public void TakeOutItem(ItemData item, bool all = false) { if (Handler == null || item == null) { return; } WindowsManager.CloseWindow <ItemWindow>(); int have = Handler.GetAmount(item); if (!all) { if (have == 1 && OnTakeOut(item, 1, 1) > 0) { MessageManager.Instance.New($"取出了1个 [{ItemUtility.GetColorName(item.Model_old)}"); } else { AmountWindow.StartInput(delegate(long amount) { int take = OnTakeOut(item, (int)amount, have); if (take > 0) { MessageManager.Instance.New($"取出了{take}个 [{ItemUtility.GetColorName(item.Model_old)}]"); } }, have, "取出数量", ZetanUtility.ScreenCenter, Vector2.zero); } } else { int take = OnTakeOut(item, have, have); if (take > 0) { MessageManager.Instance.New($"取出了{have + take}个 [{ItemUtility.GetColorName(item.Model_old)}]"); } } }
IList <TruckReturnItem> SortItems(TruckReturn ret) { IList <TruckReturnItem> nonEmpties = new List <TruckReturnItem>(); IList <TruckReturnItem> empties = new List <TruckReturnItem>(); foreach (TruckReturnItem i in ret.Items) { if (ItemUtility.IsEmpty(i.Item.Name)) { empties.Add(i); } else { nonEmpties.Add(i); } } IList <TruckReturnItem> items = new List <TruckReturnItem>(nonEmpties); foreach (TruckReturnItem i in empties) { items.Add(i); } return(items); }
/// <summary>Initializes the zone selector control.</summary> protected override void OnInit(EventArgs e) { this.CssClass = "ZoneSelector"; base.OnInit(e); ContentItem item = ItemUtility.FindCurrentItem(this.Parent); if (item != null && item.Parent != null) { Type parentItemType = item.Parent.GetContentType(); N2.Definitions.ItemDefinition definition = N2.Context.Definitions.GetDefinition(parentItemType); this.DataSource = definition.AvailableZones; this.DataTextField = "Title"; this.DataValueField = "ZoneName"; this.DataBind(); this.Items.Insert(0, ""); string defaultValue = this.Page.Request.QueryString["zoneName"]; if (!string.IsNullOrEmpty(defaultValue) && this.Items.FindByValue(defaultValue) != null) { this.SelectedValue = defaultValue; } } }
// Token: 0x060020A2 RID: 8354 RVA: 0x000BCFE0 File Offset: 0x000BB1E0 protected override void RenderButtons() { ToolbarButtonFlags flags = ToolbarButtonFlags.None; if (this.item != null && !ItemUtility.UserCanEditItem(this.item)) { flags = ToolbarButtonFlags.Disabled; } ToolbarButtonFlags flags2 = ToolbarButtonFlags.None; if (this.item != null && !ItemUtility.UserCanDeleteItem(this.item)) { flags2 = ToolbarButtonFlags.Disabled; } base.RenderButton(ToolbarButtons.SaveAndClose, flags); base.RenderButton(ToolbarButtons.NewMessageToDistributionList); if (base.UserContext.IsFeatureEnabled(Feature.Calendar)) { base.RenderButton(ToolbarButtons.NewMeetingRequestToContact); } base.RenderButton(ToolbarButtons.Delete, flags2); base.RenderButton(ToolbarButtons.Flag, flags); base.RenderButton(ToolbarButtons.Categories, flags); }
public static IItem GetItem(ItemSlots slot, ulong val) { if (val == 0) { return(ItemUtility.NoneItem); } short modelSet; short modelBase; short modelVariant; if (slot == ItemSlots.MainHand || slot == ItemSlots.OffHand) { modelSet = (short)val; modelBase = (short)(val >> 16); modelVariant = (short)(val >> 32); } else { modelSet = 0; modelBase = (short)val; modelVariant = (short)(val >> 16); } // Some NPC's seem to have invalid equipment ids? or atleast ids that dont work as we expect. if (modelSet < 0 || modelBase < 0 || modelVariant < 0) { Log.Information($"Invalid item value: {val}"); modelSet = 0; modelBase = 0; modelVariant = 0; } return(ItemUtility.GetItem(slot, (ushort)modelSet, (ushort)modelBase, (ushort)modelVariant)); }
private void DeleteItemClick(object sender, ImageClickEventArgs e) { var b = (ImageButton)sender; b.Enabled = false; b.CssClass += " disabled"; int index = int.Parse(b.CommandArgument); DeletedIndexes.Add(index); ItemEditors[index].Enabled = false; ItemEditors[index].CssClass += " disabled"; foreach (IValidator validator in ItemUtility.FindInChildren <IValidator>(ItemEditors[index])) { if (validator is BaseValidator) { (validator as BaseValidator).Enabled = false; } if (Page.Validators.Contains(validator)) { Page.Validators.Remove(validator); } } }
protected override void Render(HtmlTextWriter writer) { writer.Write(@"<div id="""); writer.Write(ClientID); writer.Write(@""" class=""sc"); var item = ItemUtility.FindCurrentItem(this); if (item != null) { writer.Write(" state" + item.State.ToString()); } writer.Write("\""); if (BackgroundUrl.Length > 0) { WriteBgStyle(BackgroundUrl, writer); } writer.Write(">"); writer.Write(@"<div class=""scContent"">"); base.Render(writer); writer.Write( @"<a href=""javascript:void(0);"" class=""close sc-toggler"" title=""Close"">«</a><a href=""javascript:void(0);"" class=""open sc-toggler"" title=""Open"">»</a>"); writer.Write("</div>"); }
IList <TruckLoadItem> SortItems(TruckLoad load) { IList <TruckLoadItem> nonEmpties = new List <TruckLoadItem>(); IList <TruckLoadItem> empties = new List <TruckLoadItem>(); foreach (TruckLoadItem item in load.Items) { if (ItemUtility.IsEmpty(item.Item.Name)) { empties.Add(item); } else { nonEmpties.Add(item); } } IList <TruckLoadItem> items = new List <TruckLoadItem>(nonEmpties); foreach (TruckLoadItem i in empties) { items.Add(i); } return(items); }
public CatalogOfferComposer(CatalogItem Item) : base(ServerPacketHeader.CatalogOfferMessageComposer) { WriteInteger(Item.OfferId); WriteString(Item.Data.ItemName); WriteBoolean(false); //IsRentable WriteInteger(Item.CostCredits); if (Item.CostDiamonds > 0) { WriteInteger(Item.CostDiamonds); WriteInteger(5); // Diamonds } else if (Item.CostGotw > 0) { WriteInteger(Item.CostGotw); WriteInteger(103); // Puntos de fama } else { WriteInteger(Item.CostPixels); WriteInteger(0); // Type of PixelCost } WriteBoolean(ItemUtility.CanGiftItem(Item)); WriteInteger(string.IsNullOrEmpty(Item.Badge) ? 1 : 2); //Count 1 item if there is no badge, otherwise count as 2. if (!string.IsNullOrEmpty(Item.Badge)) { WriteString("b"); WriteString(Item.Badge); } WriteString(Item.Data.Type.ToString()); if (Item.Data.Type.ToString().ToLower() == "b") { WriteString(Item.Data.ItemName); //Badge name. } else { WriteInteger(Item.Data.SpriteId); if (Item.Data.InteractionType == InteractionType.WALLPAPER || Item.Data.InteractionType == InteractionType.FLOOR || Item.Data.InteractionType == InteractionType.LANDSCAPE) { WriteString(Item.Name.Split('_')[2]); } else if (Item.PageID == 9)//Bots { CatalogBot CataBot = null; if (!BiosEmuThiago.GetGame().GetCatalog().TryGetBot(Item.ItemId, out CataBot)) { WriteString("hd-180-7.ea-1406-62.ch-210-1321.hr-831-49.ca-1813-62.sh-295-1321.lg-285-92"); } else { WriteString(CataBot.Figure); } } else if (Item.ExtraData != null) { WriteString(Item.ExtraData ?? string.Empty); } WriteInteger(Item.Amount); WriteBoolean(Item.IsLimited); // IsLimited if (Item.IsLimited) { WriteInteger(Item.LimitedEditionStack); WriteInteger(Item.LimitedEditionStack - Item.LimitedEditionSells); } } WriteInteger(0); // club_level WriteBoolean(ItemUtility.CanSelectAmount(Item)); WriteInteger(0); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) { return; } Room Room = null; if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) { return; } RoomUser PetUser = null; if (!Room.GetRoomUserManager().TryGetPet(Packet.PopInt(), out PetUser)) { return; } //Fetch the furniture Id for the pets current saddle. int SaddleId = ItemUtility.GetSaddleId(PetUser.PetData.Saddle); //Remove the saddle from the pet. PetUser.PetData.Saddle = 0; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `bots_petdata` SET `have_saddle` = 0 WHERE `id` = '" + PetUser.PetData.PetId + "' LIMIT 1"); } //When removing Saddle From Horse the user gets down the horse if (PetUser.RidingHorse) { RoomUser UserRiding = Room.GetRoomUserManager().GetRoomUserByVirtualId(PetUser.HorseID); if (UserRiding != null) { UserRiding.RidingHorse = false; PetUser.RidingHorse = false; UserRiding.ApplyEffect(-1); UserRiding.MoveTo(new Point(UserRiding.X + 1, UserRiding.Y + 1)); } else { PetUser.RidingHorse = false; } } ItemData ItemData = null; if (!PlusEnvironment.GetGame().GetItemManager().GetItem(SaddleId, out ItemData)) { return; } //Creates the item for the user Item Item = ItemFactory.CreateSingleItemNullable(ItemData, Session.GetHabbo(), "", "", 0, 0, 0); if (Item != null) { Session.GetHabbo().GetInventoryComponent().TryAddItem(Item); Session.SendMessage(new FurniListNotificationComposer(Item.Id, 1)); Session.SendMessage(new PurchaseOKComposer()); Session.SendMessage(new FurniListAddComposer(Item)); Session.SendMessage(new FurniListUpdateComposer()); } Room.SendMessage(new UsersComposer(PetUser)); Room.SendMessage(new PetHorseFigureInformationComposer(PetUser)); }
public static List <GameItem> GetSortedList() { return(ItemUtility.SortByRarity(new List <GameItem>(m_Items.Keys))); }
public void Update(KeyboardState kstate, GameTime gameTime, Camera camera) { // Update the storage inventory for timedItems List <int> removeExpiredItem = new List <int>(); List <InventoryItem> addTimedItem = new List <InventoryItem>(); foreach (var item in inventory) { if (item == null) { continue; } // for spoiled food if (item is ISpoiles) { item.msSpoilTime += gameTime.ElapsedGameTime.Milliseconds; Tuple <int, string> spoilDetails = ItemMappings.SpoilMappings[item.bbKey]; if (item.msSpoilTime > spoilDetails.Item1) { InventoryItem spoiled = ItemUtility.CreateInventoryItem(spoilDetails.Item2, item.teamType, regionKey, location, _content, _graphics); item.msSpoilTime = 0; if (item.amountStacked > 1) { item.amountStacked -= 1; } else { removeExpiredItem.Add(inventory.IndexOf(item)); } addTimedItem.Add(spoiled); } } } foreach (var remove in removeExpiredItem) { inventory[remove] = null; } foreach (var item in addTimedItem) { if (!AddInventoryItem(item)) { item.location = new Vector2(GetBoundingBox().Center.ToVector2().X, GetBoundingBox().Center.ToVector2().Y + 40); item.onGround = true; if (inInteriorId != Guid.Empty) // add drops to interior { BoundingBoxLocations.interiorMap[inInteriorId].interiorObjectsToAdd.Add(item); } else // add drops to world { ItemUtility.ItemsToUpdate.Add(item); } } } if (canOpenStorage && !storageOpen && kstate.IsKeyDown(Keys.O)) { storageOpen = true; } if (storageOpen) { if (kstate.IsKeyDown(Keys.Escape) || !canOpenStorage) { storageOpen = false; } } if (canPickUp) { // pick up the item if (playerNearItem != null && kstate.IsKeyDown(Keys.P)) { // TODO: might need to switch different chest types here? InventoryItem bci = new BaseChestItem(playerNearItem.teamType, regionKey, location, _content, _graphics); if (playerNearItem.AddInventoryItem(bci)) { bci.placeableVersion = this; bci.inInventory = true; bci.onGround = false; bci.stackable = false; bci.amountStacked = 1; remove = true; canPickUp = false; } } // there is a timer for how long you have to pick up item once you have the required number of hits msSinceStartPickupTimer += gameTime.ElapsedGameTime.Milliseconds; if (msSinceStartPickupTimer > msPickupTimer) { msSinceStartPickupTimer = 0; canPickUp = false; nTimesHit = 0; } } if (inWater) { currRowFrame = 1; msThisFrame += gameTime.ElapsedGameTime.Milliseconds; if (msThisFrame > msPerFrame) { currColumnFrame++; if (currColumnFrame >= nColumns) { currColumnFrame = 0; } msThisFrame = 0; } } else { currRowFrame = 0; } inWater = true; canOpenStorage = false; playerNearItem = null; }
public CatalogPageComposer(CatalogPage Page, string CataMode, Language Langue) : base(ServerPacketHeader.CatalogPageMessageComposer) { WriteInteger(Page.Id); WriteString(CataMode); WriteString(Page.Template); WriteInteger(Page.PageStrings1.Count); foreach (string s in Page.PageStrings1) { WriteString(s); } if (Page.GetPageStrings2ByLangue(Langue).Count == 1 && (Page.Template == "default_3x3" || Page.Template == "default_3x3_color_grouping") && string.IsNullOrEmpty(Page.GetPageStrings2ByLangue(Langue)[0])) { WriteInteger(1); WriteString(string.Format(ButterflyEnvironment.GetLanguageManager().TryGetValue("catalog.desc.default", Langue), Page.GetCaptionByLangue(Langue))); } else { WriteInteger(Page.GetPageStrings2ByLangue(Langue).Count); foreach (string s in Page.GetPageStrings2ByLangue(Langue)) { WriteString(s); } } if (!Page.Template.Equals("frontpage") && !Page.Template.Equals("club_buy")) { WriteInteger(Page.Items.Count); foreach (CatalogItem Item in Page.Items.Values) { WriteInteger(Item.Id); WriteString(Item.Name); WriteBoolean(false);//IsRentable WriteInteger(Item.CostCredits); if (Item.CostDiamonds > 0) { WriteInteger(Item.CostDiamonds); WriteInteger(105); // Diamonds } else { WriteInteger(Item.CostDuckets); WriteInteger(0); } WriteBoolean(ItemUtility.CanGiftItem(Item)); WriteInteger(string.IsNullOrEmpty(Item.Badge) || Item.Data.Type.ToString() == "b" ? 1 : 2); if (!string.IsNullOrEmpty(Item.Badge)) { WriteString("b"); WriteString(Item.Badge); } if (Item.Data.Type.ToString().ToLower() != "b") { WriteString(Item.Data.Type.ToString()); WriteInteger(Item.Data.SpriteId); if (Item.Data.InteractionType == InteractionType.WALLPAPER || Item.Data.InteractionType == InteractionType.FLOOR || Item.Data.InteractionType == InteractionType.LANDSCAPE) { WriteString(Item.Name.Split('_')[2]); } else if (Item.Data.InteractionType == InteractionType.bot)//Bots { CatalogBot CatalogBot = null; if (!ButterflyEnvironment.GetGame().GetCatalog().TryGetBot(Item.ItemId, out CatalogBot)) { WriteString("hd-180-7.ea-1406-62.ch-210-1321.hr-831-49.ca-1813-62.sh-295-1321.lg-285-92"); } else { WriteString(CatalogBot.Figure); } } else { WriteString(""); } WriteInteger(Item.Amount); WriteBoolean(Item.IsLimited); // IsLimited if (Item.IsLimited) { WriteInteger(Item.LimitedEditionStack); WriteInteger(Item.LimitedEditionStack - Item.LimitedEditionSells); } } WriteInteger(0); //club_level WriteBoolean(ItemUtility.CanSelectAmount(Item)); WriteBoolean(false); // TODO: Figure out WriteString(""); //previewImage -> e.g; catalogue/pet_lion.png } } else { WriteInteger(0); } WriteInteger(-1); WriteBoolean(false); WriteInteger(ButterflyEnvironment.GetGame().GetCatalog().GetPromotions().ToList().Count);//Count foreach (CatalogPromotion Promotion in ButterflyEnvironment.GetGame().GetCatalog().GetPromotions().ToList()) { WriteInteger(Promotion.Id); WriteString(Promotion.GetTitleByLangue(Langue)); WriteString(Promotion.Image); WriteInteger(Promotion.Unknown); WriteString(Promotion.PageLink); WriteInteger(Promotion.ParentId); } }
public CatalogPageComposer(CatalogPage Page, string CataMode) : base(ServerPacketHeader.CatalogPageMessageComposer) { WriteInteger(Page.Id); WriteString(CataMode); WriteString(Page.Template); WriteInteger(Page.PageStrings1.Count); foreach (string s in Page.PageStrings1) { WriteString(s); } WriteInteger(Page.PageStrings2.Count); foreach (string s in Page.PageStrings2) { WriteString(s); } if (!Page.Template.Equals("frontpage") && !Page.Template.Equals("loyalty_vip_buy")) { WriteInteger(Page.Items.Count); foreach (CatalogItem Item in Page.Items.Values) { WriteInteger(Item.Id); WriteString(Item.Name); WriteBoolean(false); //IsRentable WriteInteger(Item.CostCredits); if (Item.CostDiamonds > 0) { WriteInteger(Item.CostDiamonds); WriteInteger(5); // Diamonds } else if (Item.CostPixels > 0) { WriteInteger(Item.CostPixels); WriteInteger(0); // Type of PixelCost } else { WriteInteger(Item.CostGotw); WriteInteger(103); // Gotw } WriteBoolean(Item.PredesignedId > 0 ? false : ItemUtility.CanGiftItem(Item)); if (Item.PredesignedId > 0) { WriteInteger(Page.PredesignedItems.Items.Count); foreach (var predesigned in Page.PredesignedItems.Items.ToList()) { ItemData Data = null; if (CloudServer.GetGame().GetItemManager().GetItem(predesigned.Key, out Data)) { } WriteString(Data.Type.ToString()); WriteInteger(Data.SpriteId); WriteString(string.Empty); WriteInteger(predesigned.Value); WriteBoolean(false); } WriteInteger(0); WriteBoolean(false); WriteBoolean(true); // Niu Rilí WriteString(""); // Niu Rilí } else if (Page.Deals.Count > 0) { foreach (var Deal in Page.Deals.Values) { WriteInteger(Deal.ItemDataList.Count); foreach (var DealItem in Deal.ItemDataList.ToList()) { WriteString(DealItem.Data.Type.ToString()); WriteInteger(DealItem.Data.SpriteId); WriteString(string.Empty); WriteInteger(DealItem.Amount); WriteBoolean(false); } WriteInteger(0); WriteBoolean(false); } } else { WriteInteger(string.IsNullOrEmpty(Item.Badge) ? 1 : 2); //Count 1 item if there is no badge, otherwise count as 2. { if (!string.IsNullOrEmpty(Item.Badge)) { WriteString("b"); WriteString(Item.Badge); } WriteString(Item.Data.Type.ToString()); if (Item.Data.Type.ToString().ToLower() == "b") { //This is just a badge, append the name. WriteString(Item.Data.ItemName); } else { WriteInteger(Item.Data.SpriteId); if (Item.Data.InteractionType == InteractionType.WALLPAPER || Item.Data.InteractionType == InteractionType.FLOOR || Item.Data.InteractionType == InteractionType.LANDSCAPE) { WriteString(Item.Name.Split('_')[2]); } else if (Item.Data.InteractionType == InteractionType.BOT)//Bots { CatalogBot CatalogBot = null; if (!CloudServer.GetGame().GetCatalog().TryGetBot(Item.ItemId, out CatalogBot)) { WriteString("hd-180-7.ea-1406-62.ch-210-1321.hr-831-49.ca-1813-62.sh-295-1321.lg-285-92"); } else { WriteString(CatalogBot.Figure); } } else if (Item.ExtraData != null) { WriteString(Item.ExtraData ?? string.Empty); } WriteInteger(Item.Amount); WriteBoolean(Item.IsLimited); // IsLimited if (Item.IsLimited) { WriteInteger(Item.LimitedEditionStack); WriteInteger(Item.LimitedEditionStack - Item.LimitedEditionSells); } } WriteInteger(0); //club_level WriteBoolean(ItemUtility.CanSelectAmount(Item)); WriteBoolean(true); // Niu Rilí WriteString(""); // Niu Rilí } } } /*}*/ } else { WriteInteger(0); } WriteInteger(-1); WriteBoolean(false); if (Page.Template.Equals("frontpage4")) { WriteInteger(4); // count //New Rare Jellyfish Lamp! WriteInteger(1); // id WriteString(CatalogSettings.CATALOG_NOTICE_1); // name WriteString(CatalogSettings.CATALOG_IMG_NOTICE_1); // image WriteInteger(0); WriteString(CatalogSettings.CATALOG_URL_NOTICE_1); // page link? WriteInteger(-1); // page id? WriteInteger(2); WriteString(CatalogSettings.CATALOG_NOTICE_2); // name WriteString(CatalogSettings.CATALOG_IMG_NOTICE_2); // image WriteInteger(0); WriteString(CatalogSettings.CATALOG_URL_NOTICE_2); // page link? WriteInteger(-1); WriteInteger(3); WriteString(CatalogSettings.CATALOG_NOTICE_3); // name WriteString(CatalogSettings.CATALOG_IMG_NOTICE_3); // image WriteInteger(0); WriteString(CatalogSettings.CATALOG_URL_NOTICE_3); // page link? WriteInteger(-1); WriteInteger(4); WriteString(CatalogSettings.CATALOG_NOTICE_4); // name WriteString(CatalogSettings.CATALOG_IMG_NOTICE_4); // image WriteInteger(0); WriteString(CatalogSettings.CATALOG_URL_NOTICE_4); // page link? WriteInteger(-1); if (Page.Template.Equals("loyalty_vip_buy")) { WriteInteger(0); //Page ID WriteString("NORMAL"); WriteString("loyalty_vip_buy"); WriteInteger(2); WriteString("hc2_clubtitle"); WriteString("clubcat_pic"); WriteInteger(0); // Nueva Release WriteInteger(0); WriteInteger(-1); WriteBoolean(false); if (Page.Template.Equals("club_gifts")) { WriteString("club_gifts"); WriteInteger(1); WriteString(Convert.ToString(Page.PageStrings2)); WriteInteger(1); WriteString(Convert.ToString(Page.PageStrings2)); } } } }
// Token: 0x0600254B RID: 9547 RVA: 0x000D7AD0 File Offset: 0x000D5CD0 protected override void RenderButtons() { ToolbarButtonFlags flags = this.isEmbeddedItem ? ToolbarButtonFlags.Disabled : ToolbarButtonFlags.None; bool flag = Utilities.IsPublic(this.message); bool flag2 = Utilities.IsOtherMailbox(this.message); base.RenderHelpButton(ObjectClass.IsSmsMessage(this.message.ClassName) ? HelpIdsLight.DefaultLight.ToString() : HelpIdsLight.MailLight.ToString(), string.Empty); if (ItemUtility.ShouldRenderSendAgain(this.message, this.isEmbeddedItem) && !flag2) { base.RenderButton(ToolbarButtons.SendAgain, flag ? ToolbarButtonFlags.Disabled : ToolbarButtonFlags.None); } if (this.isInJunkEmailFolder && base.UserContext.IsJunkEmailEnabled && !this.isSuspectedPhishingItem) { base.RenderButton(ToolbarButtons.NotJunk); } ToolbarButtonFlags flags2 = ToolbarButtonFlags.None; ToolbarButtonFlags flags3 = ToolbarButtonFlags.None; if (this.isInJunkEmailFolder || (this.isSuspectedPhishingItem && !this.isLinkEnabled)) { flags2 = ToolbarButtonFlags.Disabled; flags3 = ToolbarButtonFlags.Disabled; } if (!base.UserContext.IsFeatureEnabled(Feature.Tasks) && ObjectClass.IsOfClass(this.message.ClassName, "IPM.Task")) { flags2 = ToolbarButtonFlags.Disabled; flags3 = ToolbarButtonFlags.Disabled; } bool flag3 = ReadMessageToolbar.IsReplySupported(this.message); bool flag4 = base.UserContext.IsSmsEnabled && ObjectClass.IsSmsMessage(this.message.ClassName); if (this.isReplyRestricted) { flags2 = ToolbarButtonFlags.Disabled; } if (this.isReplyAllRestricted) { flags3 = ToolbarButtonFlags.Disabled; } if (flag3) { base.RenderButton(flag4 ? ToolbarButtons.ReplySms : ToolbarButtons.Reply, flags2); base.RenderButton(flag4 ? ToolbarButtons.ReplyAllSms : ToolbarButtons.ReplyAll, flags3); } ToolbarButtonFlags flags4 = ToolbarButtonFlags.None; if (ObjectClass.IsOfClass(this.message.ClassName, "IPM.Note.Microsoft.Approval.Request") || this.isForwardRestricted || this.isInJunkEmailFolder || (this.isSuspectedPhishingItem && !this.isLinkEnabled)) { flags4 = ToolbarButtonFlags.Disabled; } if (!ObjectClass.IsOfClass(this.message.ClassName, "IPM.Conflict.Message")) { base.RenderButton(flag4 ? ToolbarButtons.ForwardSms : ToolbarButtons.Forward, flags4); } bool flag5 = this.message is CalendarItemBase; bool flag6 = ItemUtility.UserCanEditItem(this.message); if (base.UserContext.IsInstantMessageEnabled() && (!flag5 || (flag5 && flag3))) { base.RenderButton(ToolbarButtons.Chat, ToolbarButtonFlags.Disabled); } MessageItem messageItem = this.message as MessageItem; bool flag7 = messageItem != null && messageItem.IsDraft; ToolbarButtonFlags flags5 = (flag6 && !flag7) ? ToolbarButtonFlags.None : ToolbarButtonFlags.Disabled; if (!this.isEmbeddedItem && base.UserContext.ExchangePrincipal.RecipientTypeDetails == RecipientTypeDetails.DiscoveryMailbox) { base.RenderButton(ToolbarButtons.MessageNoteInToolbar); } if (!flag5 && !this.isInDeleteItems && !this.isEmbeddedItem) { base.RenderButton(ToolbarButtons.Flag, flags5); } ToolbarButtonFlags flags6 = flag6 ? ToolbarButtonFlags.None : ToolbarButtonFlags.Disabled; if (!this.isEmbeddedItem) { bool flag8 = true; if (flag5) { CalendarItemBase calendarItemBase = (CalendarItemBase)this.message; flag8 = (CalendarItemType.Occurrence != calendarItemBase.CalendarItemType && CalendarItemType.Exception != calendarItemBase.CalendarItemType); } if (flag8) { base.RenderButton(ToolbarButtons.Categories, flags6); } } if (!flag5) { base.RenderButton(ToolbarButtons.MessageDetails); } base.RenderButton(ToolbarButtons.Print, this.isPrintRestricted ? ToolbarButtonFlags.Disabled : ToolbarButtonFlags.None); if (base.UserContext.IsFeatureEnabled(Feature.Rules) && this.isMessageReadForm && !flag2 && !this.isEmbeddedItem) { base.RenderButton(ToolbarButtons.CreateRule, (base.UserContext.IsWebPartRequest || flag) ? ToolbarButtonFlags.Disabled : ToolbarButtonFlags.None); } bool flag9; if (flag5) { flag9 = CalendarUtilities.UserCanDeleteCalendarItem((CalendarItemBase)this.message); } else { flag9 = ItemUtility.UserCanDeleteItem(this.message); } ToolbarButtonFlags flags7 = (!flag9 || this.isEmbeddedItem) ? ToolbarButtonFlags.Disabled : ToolbarButtonFlags.None; base.RenderButton(ToolbarButtons.Delete, flags7); if (!this.isEmbeddedItem && !flag5) { base.RenderButton(ToolbarButtons.Move); } if (!flag5) { base.RenderButton(ToolbarButtons.Previous, flags); base.RenderButton(ToolbarButtons.Next, flags); } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int PageId = Packet.PopInt(); int ItemId = Packet.PopInt(); string Data = Packet.PopString(); string GiftUser = StringCharFilter.Escape(Packet.PopString()); string GiftMessage = StringCharFilter.Escape(Packet.PopString().Replace(Convert.ToChar(5), ' ')); int SpriteId = Packet.PopInt(); int Ribbon = Packet.PopInt(); int Colour = Packet.PopInt(); bool dnow = Packet.PopBoolean(); if (PlusEnvironment.GetSettingsManager().TryGetValue("room.item.gifts.enabled") != "1") { Session.SendNotification("The hotel managers have disabled gifting"); return; } /*if (PlusEnvironment.GetGame().GetCatalog().CatalogFlatOffers.ContainsKey(ItemId) && PageId < 0) * { * PageId = PlusEnvironment.GetGame().GetCatalog().CatalogFlatOffers[ItemId]; * * CatalogPage P = null; * if (!PlusEnvironment.GetGame().GetCatalog().Pages.TryGetValue(PageId, out P)) * PageId = 0; * }*/ CatalogPage Page = null; if (!PlusEnvironment.GetGame().GetCatalog().TryGetPage(PageId, out Page)) { return; } if (!Page.Enabled || !Page.Visible || Page.MinimumRank > Session.GetHabbo().Rank || (Page.MinimumVIP > Session.GetHabbo().VIPRank&& Session.GetHabbo().Rank == 1)) { return; } CatalogItem Item = null; if (!Page.Items.TryGetValue(ItemId, out Item)) { if (Page.ItemOffers.ContainsKey(ItemId)) { Item = (CatalogItem)Page.ItemOffers[ItemId]; if (Item == null) { return; } } else { return; } } if (!ItemUtility.CanGiftItem(Item)) { return; } ItemData PresentData = null; if (!PlusEnvironment.GetGame().GetItemManager().GetGift(SpriteId, out PresentData) || PresentData.InteractionType != InteractionType.GIFT) { return; } if (Session.GetHabbo().Credits < Item.CostCredits) { Session.SendPacket(new PresentDeliverErrorMessageComposer(true, false)); return; } if (Session.GetHabbo().Duckets < Item.CostPixels) { Session.SendPacket(new PresentDeliverErrorMessageComposer(false, true)); return; } Habbo Habbo = PlusEnvironment.GetHabboByUsername(GiftUser); if (Habbo == null) { Session.SendPacket(new GiftWrappingErrorComposer()); return; } if (!Habbo.AllowGifts) { Session.SendNotification("Oops, this user doesn't allow gifts to be sent to them!"); return; } if ((DateTime.Now - Session.GetHabbo().LastGiftPurchaseTime).TotalSeconds <= 15.0) { Session.SendNotification("You're purchasing gifts too fast! Please wait 15 seconds!"); Session.GetHabbo().GiftPurchasingWarnings += 1; if (Session.GetHabbo().GiftPurchasingWarnings >= 25) { Session.GetHabbo().SessionGiftBlocked = true; } return; } if (Session.GetHabbo().SessionGiftBlocked) { return; } string ED = GiftUser + Convert.ToChar(5) + GiftMessage + Convert.ToChar(5) + Session.GetHabbo().Id + Convert.ToChar(5) + Item.Data.Id + Convert.ToChar(5) + SpriteId + Convert.ToChar(5) + Ribbon + Convert.ToChar(5) + Colour; int NewItemId = 0; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { //Insert the dummy item. dbClient.SetQuery("INSERT INTO `items` (`base_item`,`user_id`,`extra_data`) VALUES (@baseId, @habboId, @extra_data)"); dbClient.AddParameter("baseId", PresentData.Id); dbClient.AddParameter("habboId", Habbo.Id); dbClient.AddParameter("extra_data", ED); NewItemId = Convert.ToInt32(dbClient.InsertQuery()); string ItemExtraData = null; switch (Item.Data.InteractionType) { case InteractionType.NONE: ItemExtraData = ""; break; #region Pet handling case InteractionType.PET: try { string[] Bits = Data.Split('\n'); string PetName = Bits[0]; string Race = Bits[1]; string Color = Bits[2]; int.Parse(Race); // to trigger any possible errors if (PetUtility.CheckPetName(PetName)) { return; } if (Race.Length > 2) { return; } if (Color.Length != 6) { return; } PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_PetLover", 1); } catch { return; } break; #endregion case InteractionType.FLOOR: case InteractionType.WALLPAPER: case InteractionType.LANDSCAPE: Double Number = 0; try { if (string.IsNullOrEmpty(Data)) { Number = 0; } else { Number = Double.Parse(Data, PlusEnvironment.CultureInfo); } } catch { } ItemExtraData = Number.ToString().Replace(',', '.'); break; // maintain extra data // todo: validate case InteractionType.POSTIT: ItemExtraData = "FFFF33"; break; case InteractionType.MOODLIGHT: ItemExtraData = "1,1,1,#000000,255"; break; case InteractionType.TROPHY: ItemExtraData = Session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + Convert.ToChar(9) + Data; break; case InteractionType.MANNEQUIN: ItemExtraData = "m" + Convert.ToChar(5) + ".ch-210-1321.lg-285-92" + Convert.ToChar(5) + "Default Mannequin"; break; case InteractionType.BADGE_DISPLAY: if (!Session.GetHabbo().GetBadgeComponent().HasBadge(Data)) { Session.SendPacket(new BroadcastMessageAlertComposer("Oops, it appears that you do not own this badge.")); return; } ItemExtraData = Data + Convert.ToChar(9) + Session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year; break; default: ItemExtraData = Data; break; } //Insert the present, forever. dbClient.SetQuery("INSERT INTO `user_presents` (`item_id`,`base_id`,`extra_data`) VALUES (@itemId, @baseId, @extra_data)"); dbClient.AddParameter("itemId", NewItemId); dbClient.AddParameter("baseId", Item.Data.Id); dbClient.AddParameter("extra_data", (string.IsNullOrEmpty(ItemExtraData) ? "" : ItemExtraData)); dbClient.RunQuery(); //Here we're clearing up a record, this is dumb, but okay. dbClient.SetQuery("DELETE FROM `items` WHERE `id` = @deleteId LIMIT 1"); dbClient.AddParameter("deleteId", NewItemId); dbClient.RunQuery(); } Item GiveItem = ItemFactory.CreateGiftItem(PresentData, Habbo, ED, ED, NewItemId, 0, 0); if (GiveItem != null) { GameClient Receiver = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Habbo.Id); if (Receiver != null) { Receiver.GetHabbo().GetInventoryComponent().TryAddItem(GiveItem); Receiver.SendPacket(new FurniListNotificationComposer(GiveItem.Id, 1)); Receiver.SendPacket(new PurchaseOKComposer()); Receiver.SendPacket(new FurniListAddComposer(GiveItem)); Receiver.SendPacket(new FurniListUpdateComposer()); } if (Habbo.Id != Session.GetHabbo().Id&& !string.IsNullOrWhiteSpace(GiftMessage)) { PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_GiftGiver", 1); if (Receiver != null) { PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Receiver, "ACH_GiftReceiver", 1); } PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.GIFT_OTHERS); } } Session.SendPacket(new PurchaseOKComposer(Item, PresentData)); if (Item.CostCredits > 0) { Session.GetHabbo().Credits -= Item.CostCredits; Session.SendPacket(new CreditBalanceComposer(Session.GetHabbo().Credits)); } if (Item.CostPixels > 0) { Session.GetHabbo().Duckets -= Item.CostPixels; Session.SendPacket(new HabboActivityPointNotificationComposer(Session.GetHabbo().Duckets, Session.GetHabbo().Duckets)); } Session.GetHabbo().LastGiftPurchaseTime = DateTime.Now; }
// Token: 0x06002E97 RID: 11927 RVA: 0x0010A150 File Offset: 0x00108350 private void MarkAsReadOrUnread(bool isRead) { OwaStoreObjectId[] array = (OwaStoreObjectId[])base.GetParameter("id"); if (ConversationUtilities.ContainsConversationItem(base.UserContext, array)) { List <OwaStoreObjectId> list = new List <OwaStoreObjectId>(); List <OwaStoreObjectId> list2 = new List <OwaStoreObjectId>(); foreach (OwaStoreObjectId owaStoreObjectId in array) { if (base.UserContext.SentItemsFolderId.Equals(owaStoreObjectId.ParentFolderId)) { list.Add(owaStoreObjectId); } else { list2.Add(owaStoreObjectId); } } List <OwaStoreObjectId> list3 = new List <OwaStoreObjectId>(); Func <IStorePropertyBag, bool> filter = (IStorePropertyBag propertyBag) => ItemUtility.GetProperty <bool>(propertyBag, MessageItemSchema.IsRead, isRead) != isRead; if (list2.Count > 0) { list3.AddRange(ConversationUtilities.GetAllItemIds(base.UserContext, list2.ToArray(), new PropertyDefinition[] { MessageItemSchema.IsRead }, filter, new StoreObjectId[] { base.UserContext.SentItemsFolderId })); } if (list.Count > 0) { list3.AddRange(ConversationUtilities.GetAllItemIds(base.UserContext, list.ToArray(), new PropertyDefinition[] { MessageItemSchema.IsRead }, filter, new StoreObjectId[0])); } array = list3.ToArray(); } if (array.Length > 500) { throw new OwaInvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Marking {0} item(s) as read or unread in a single request is not supported", new object[] { array.Length })); } JunkEmailStatus junkEmailStatus = JunkEmailStatus.NotJunk; if (base.IsParameterSet("JS")) { junkEmailStatus = (JunkEmailStatus)base.GetParameter("JS"); } if (array.Length > 0) { Utilities.MarkItemsAsRead(base.UserContext, array, junkEmailStatus, !isRead); } }
// Token: 0x060022D3 RID: 8915 RVA: 0x000C7598 File Offset: 0x000C5798 public static void AddDeletePolicyInformation(Infobar infobar, IStorePropertyBag storePropertyBag, UserContext userContext) { if (infobar == null) { throw new ArgumentNullException("infobar"); } if (storePropertyBag == null) { throw new ArgumentNullException("storePropertyBag"); } if (userContext == null) { throw new ArgumentNullException("userContext"); } if (PolicyProvider.DeletePolicyProvider.IsPolicyEnabled(userContext.MailboxSession) && ItemUtility.HasDeletePolicy(storePropertyBag)) { ExDateTime now = ExDateTime.Now; ExDateTime property = ItemUtility.GetProperty <ExDateTime>(storePropertyBag, ItemSchema.RetentionDate, ExDateTime.MinValue); if (property > ExDateTime.MinValue) { TimeSpan timeSpan = property - now; string s = string.Format(LocalizedStrings.GetNonEncoded(217128690), (timeSpan.Days < 0) ? 0 : timeSpan.Days); Guid? guid = null; byte[] property2 = ItemUtility.GetProperty <byte[]>(storePropertyBag, StoreObjectSchema.PolicyTag, null); if (property2 != null && property2.Length == InfobarMessageBuilder.SizeOfGuid) { guid = new Guid?(new Guid(property2)); } PolicyTagList allPolicies = PolicyProvider.DeletePolicyProvider.GetAllPolicies(userContext.MailboxSession); List <PolicyTag> list = new List <PolicyTag>(allPolicies.Values.Count); if (guid != null && allPolicies.Count > 0) { foreach (PolicyTag policyTag in allPolicies.Values) { if (object.Equals(policyTag.PolicyGuid, guid)) { list.Add(policyTag); } } } string s2 = string.Format(LocalizedStrings.GetNonEncoded(2084315882), (list.Count > 0) ? list[0].Name : string.Empty, (list.Count > 0) ? PolicyContextMenuBase.TimeSpanToString(list[0].TimeSpanForRetention) : string.Empty, property.ToString("d", CultureInfo.CurrentUICulture)); infobar.AddMessage(Utilities.SanitizeHtmlEncode(s2), InfobarMessageType.Informational); if (timeSpan.Days < 30) { infobar.AddMessage(Utilities.SanitizeHtmlEncode(s), InfobarMessageType.Informational); } } } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int PageId = Packet.PopInt(); int ItemId = Packet.PopInt(); string Data = Packet.PopString(); string GiftUser = StringCharFilter.Escape(Packet.PopString()); string GiftMessage = StringCharFilter.Escape(Packet.PopString().Replace(Convert.ToChar(5), ' ')); int SpriteId = Packet.PopInt(); int Ribbon = Packet.PopInt(); int Colour = Packet.PopInt(); bool dnow = Packet.PopBoolean(); if (QuasarEnvironment.GetDBConfig().DBData["gifts_enabled"] != "1") { Session.SendNotification("Het sturen van cadeau's is tijdelijk uitgeschakeld door het Hotel Management."); return; } /*if (QuasarEnvironment.GetGame().GetCatalog().CatalogFlatOffers.ContainsKey(ItemId) && PageId < 0) * { * PageId = QuasarEnvironment.GetGame().GetCatalog().CatalogFlatOffers[ItemId]; * * CatalogPage P = null; * if (!QuasarEnvironment.GetGame().GetCatalog().Pages.TryGetValue(PageId, out P)) * PageId = 0; * }*/ CatalogPage Page = null; if (!QuasarEnvironment.GetGame().GetCatalog().TryGetPage(PageId, out Page)) { return; } if (!Page.Enabled || !Page.Visible || Page.MinimumRank > Session.GetHabbo().Rank) /*|| (Page.MinimumVIP > Session.GetHabbo().VIPRank && Session.GetHabbo().Rank == 1))*/ { return; } CatalogItem Item = null; if (!Page.Items.TryGetValue(ItemId, out Item)) { if (Page.ItemOffers.ContainsKey(ItemId)) { Item = (CatalogItem)Page.ItemOffers[ItemId]; if (Item == null) { return; } } else { return; } } if (!ItemUtility.CanGiftItem(Item)) { return; } ItemData PresentData = null; if (!QuasarEnvironment.GetGame().GetItemManager().GetGift(SpriteId, out PresentData) || PresentData.InteractionType != InteractionType.GIFT) { return; } if (Session.GetHabbo().Credits < Item.CostCredits) { Session.SendMessage(new PresentDeliverErrorMessageComposer(true, false)); return; } if (Session.GetHabbo().Duckets < Item.CostPixels) { Session.SendMessage(new PresentDeliverErrorMessageComposer(false, true)); return; } Habbo Habbo = QuasarEnvironment.GetHabboByUsername(GiftUser); if (Habbo == null) { Session.SendMessage(new GiftWrappingErrorComposer()); return; } if (!Habbo.AllowGifts) { Session.SendNotification("Oeps! Je kan geen cadeau's sturen naar deze Habbis."); return; } if (Session.GetHabbo().Rank < 4) { if ((DateTime.Now - Session.GetHabbo().LastGiftPurchaseTime).TotalSeconds <= 10.0) { Session.SendNotification("Oeps! Wacht minstens 10 seconden tussen het kopen van cadeau's."); return; } } if (Session.GetHabbo().SessionGiftBlocked) { return; } string ED = GiftUser + Convert.ToChar(5) + GiftMessage + Convert.ToChar(5) + Session.GetHabbo().Id + Convert.ToChar(5) + Item.Data.Id + Convert.ToChar(5) + SpriteId + Convert.ToChar(5) + Ribbon + Convert.ToChar(5) + Colour; int NewItemId = 0; using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { //Insert the dummy item. dbClient.SetQuery("INSERT INTO `items` (`base_item`,`user_id`,`extra_data`) VALUES ('" + PresentData.Id + "', '" + Habbo.Id + "', @extra_data)"); dbClient.AddParameter("extra_data", ED); NewItemId = Convert.ToInt32(dbClient.InsertQuery()); string ItemExtraData = null; switch (Item.Data.InteractionType) { case InteractionType.NONE: ItemExtraData = ""; break; #region Pet handling case InteractionType.pet0: // Hond case InteractionType.pet1: // Kat case InteractionType.pet2: // Krokodillen case InteractionType.pet3: // Terriers case InteractionType.pet4: // Beren case InteractionType.pet5: // Varkens case InteractionType.pet6: // Leeuwen case InteractionType.pet7: // Neushoorns case InteractionType.pet8: // Spinnen case InteractionType.pet9: // Schildpadden case InteractionType.pet10: // Kuikens case InteractionType.pet11: // Kikkers case InteractionType.pet12: // Draken case InteractionType.pet13: // Slenderman case InteractionType.pet14: // Apen case InteractionType.pet15: // Paarden case InteractionType.pet16: // Monsterplanten case InteractionType.pet17: // Konijnen case InteractionType.pet18: // Evil Konijnen case InteractionType.pet19: // Depressieve Konijnen case InteractionType.pet20: // Liefdes Konijnen case InteractionType.pet21: // Witte Duiven case InteractionType.pet22: // Zwarte Duiven case InteractionType.pet23: // Rode Aap case InteractionType.pet24: // Baby Beertjes case InteractionType.pet25: // Baby Terriers case InteractionType.pet26: // Kabouters case InteractionType.pet27: // Baby's case InteractionType.pet28: // Baby Beertjes case InteractionType.pet29: // Baby Terriers case InteractionType.pet30: // Kabouters case InteractionType.pet31: // Oempa Loempa's case InteractionType.pet32: // Stenen case InteractionType.pet33: // Pterodactylussen case InteractionType.pet34: // Velociraptors case InteractionType.pet35: // Wolven case InteractionType.pet36: // Monster Konijnen case InteractionType.pet37: // Pickachu case InteractionType.pet38: // Pinguins case InteractionType.pet39: // Mario case InteractionType.pet40: // Olifanten case InteractionType.pet41: // Alien Konijnen case InteractionType.pet42: // Gouden Konijnen case InteractionType.pet43: // Roze Mewtwo case InteractionType.pet44: // Entei case InteractionType.pet45: // Blauwe Mewtwo case InteractionType.pet46: // Cavia case InteractionType.pet47: // Uil case InteractionType.pet48: // Goude Mewtwo case InteractionType.pet49: // Eend case InteractionType.pet50: // Baby Bruin case InteractionType.pet51: // Baby Wit case InteractionType.pet52: // Dino case InteractionType.pet53: // Yoshi case InteractionType.pet54: // Koe case InteractionType.pet55: // Pokémon: Gengar case InteractionType.pet56: // Pokémon: Gengar case InteractionType.pet57: // Pokémon: Gengar case InteractionType.pet58: // Pokémon: Gengar case InteractionType.pet59: // Pokémon: Gengar case InteractionType.pet60: // Pokémon: Gengar case InteractionType.pet61: // Pokémon: Gengar case InteractionType.pet62: // Pokémon: Gengar case InteractionType.pet63: // Pokémon: Gengar case InteractionType.pet64: // Pokémon: Gengar case InteractionType.pet65: // Pokémon: Gengar case InteractionType.pet66: // Pokémon: Gengar case InteractionType.pet67: // Pokémon: Gengar case InteractionType.pet68: // Pokémon: Gengar case InteractionType.pet69: // Pokémon: Gengar case InteractionType.pet70: // Pokémon: Gengar try { string[] Bits = Data.Split('\n'); string PetName = Bits[0]; string Race = Bits[1]; string Color = Bits[2]; int.Parse(Race); // to trigger any possible errors if (PetUtility.CheckPetName(PetName)) { return; } if (Race.Length > 2) { return; } if (Color.Length != 6) { return; } QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_PetLover", 1); } catch { return; } break; #endregion case InteractionType.FLOOR: case InteractionType.WALLPAPER: case InteractionType.LANDSCAPE: Double Number = 0; try { if (string.IsNullOrEmpty(Data)) { Number = 0; } else { Number = Double.Parse(Data, QuasarEnvironment.CultureInfo); } } catch { } ItemExtraData = Number.ToString().Replace(',', '.'); break; // maintain extra data // todo: validate case InteractionType.POSTIT: ItemExtraData = "FFFF33"; break; case InteractionType.MOODLIGHT: ItemExtraData = "1,1,1,#000000,255"; break; case InteractionType.TROPHY: ItemExtraData = Session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + Convert.ToChar(9) + Data; break; case InteractionType.MANNEQUIN: ItemExtraData = "m" + Convert.ToChar(5) + ".ch-210-1321.lg-285-92" + Convert.ToChar(5) + "Default Maniqui"; break; case InteractionType.BADGE_DISPLAY: if (!Session.GetHabbo().GetBadgeComponent().HasBadge(Data)) { Session.SendMessage(new BroadcastMessageAlertComposer("Oeps! Je kan deze badge niet in een vitrine zetteno omdat je deze badge niet in je bezit hebt.")); return; } ItemExtraData = Data + Convert.ToChar(9) + Session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year; break; default: ItemExtraData = Data; break; } //Insert the present, forever. dbClient.SetQuery("INSERT INTO `user_presents` (`item_id`,`base_id`,`extra_data`) VALUES ('" + NewItemId + "', '" + Item.Data.Id + "', @extra_data)"); dbClient.AddParameter("extra_data", (string.IsNullOrEmpty(ItemExtraData) ? "" : ItemExtraData)); dbClient.RunQuery(); //Here we're clearing up a record, this is dumb, but okay. dbClient.RunQuery("DELETE FROM `items` WHERE `id` = " + NewItemId + " LIMIT 1;"); } Item GiveItem = ItemFactory.CreateGiftItem(PresentData, Habbo, ED, ED, NewItemId, 0, 0); if (GiveItem != null) { GameClient Receiver = QuasarEnvironment.GetGame().GetClientManager().GetClientByUserID(Habbo.Id); if (Receiver != null) { if (Receiver.GetHabbo().Rank <= 5) { Session.SendMessage(new RoomCustomizedAlertComposer("Je hebt een cadeau ontvangen van " + Session.GetHabbo().Username + ".")); } { Receiver.GetHabbo().GetInventoryComponent().TryAddItem(GiveItem); Receiver.SendMessage(new FurniListNotificationComposer(GiveItem.Id, 1)); Receiver.SendMessage(new PurchaseOKComposer()); Receiver.SendMessage(new FurniListAddComposer(GiveItem)); Receiver.SendMessage(new FurniListUpdateComposer()); } } QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_GiftGiver", 1); QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Receiver, "ACH_GiftReceiver", 1); QuasarEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.GIFT_OTHERS); Session.SendMessage(new RoomCustomizedAlertComposer("Je cadeau is ingepakt en verzonden!")); } Session.SendMessage(new PurchaseOKComposer(Item, PresentData)); if (Item.CostCredits > 0) { Session.GetHabbo().Credits -= Item.CostCredits; Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits)); } if (Item.CostPixels > 0) { Session.GetHabbo().Duckets -= Item.CostPixels; Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().Duckets, Session.GetHabbo().Duckets)); } Session.GetHabbo().LastGiftPurchaseTime = DateTime.Now; }
public override void OnInitialize() { Width = (408, 0); Height = (100 + (Container.Handler.Slots + Container.HandlerIngredients.Slots) / 9 * 44, 0); this.Center(); textLabel = new UIText(Container.DisplayName.GetTranslation()) { HAlign = 0.5f }; Append(textLabel); UIButton buttonLootAll = new UIButton(PortableStorage.textureLootAll) { Size = new Vector2(20) }; buttonLootAll.OnClick += (evt, element) => { ItemUtility.LootAll(Container.HandlerIngredients, Main.LocalPlayer); ItemUtility.LootAll(Container.Handler, Main.LocalPlayer); }; buttonLootAll.GetHoverText += () => Language.GetText("LegacyInterface.29").ToString(); Append(buttonLootAll); UIButton buttonDepositAll = new UIButton(PortableStorage.textureDepositAll) { Size = new Vector2(20), Left = (28, 0) }; buttonDepositAll.OnClick += (evt, element) => { ItemUtility.DepositAll(Container.Handler, Main.LocalPlayer); ItemUtility.DepositAll(Container.HandlerIngredients, Main.LocalPlayer); }; buttonDepositAll.GetHoverText += () => Language.GetText("LegacyInterface.30").ToString(); Append(buttonDepositAll); buttonClose = new UITextButton("X") { Size = new Vector2(20), Left = (-20, 1), RenderPanel = false }; buttonClose.OnClick += (evt, element) => BaseLibrary.BaseLibrary.PanelGUI.UI.CloseUI(Container); Append(buttonClose); UIText textPotions = new UIText("Potions") { Top = (28, 0) }; Append(textPotions); gridItems = new UIGrid <UIContainerSlot>(9) { Width = (0, 1), Height = (84, 0), Top = (56, 0), OverflowHidden = true, ListPadding = 4f }; Append(gridItems); for (int i = 0; i < Container.Handler.Slots; i++) { UIContainerSlot slot = new UIContainerSlot(() => Container.Handler, i); gridItems.Add(slot); } UIText textIngredients = new UIText("Ingredients") { Top = (148, 0) }; Append(textIngredients); UIGrid <UIContainerSlot> gridIngredients = new UIGrid <UIContainerSlot>(9) { Width = (0, 1), Height = (304, 0), Top = (176, 0), OverflowHidden = true, ListPadding = 4f }; Append(gridIngredients); for (int i = 0; i < Container.HandlerIngredients.Slots; i++) { UIContainerSlot slot = new UIContainerSlot(() => Container.HandlerIngredients, i); gridIngredients.Add(slot); } } } }
public void Update(KeyboardState kstate, GameTime gameTime, Camera cam) { if (menuOpen) { timeRClicked += gameTime.ElapsedGameTime.Milliseconds; timeLClicked += gameTime.ElapsedGameTime.Milliseconds; cursorPos = new Vector2(Mouse.GetState().X, Mouse.GetState().Y); Rectangle cursorRect = new Rectangle((int)cursorPos.X, (int)cursorPos.Y, cursor.Width, cursor.Height); selectedIndex = -1; int i = 0; foreach (var slot in slotLocations.Values) { if (slot.Intersects(cursorRect)) { selectedIndex = i; // TODO: have this start timer for crafting (do some sort of animation) and then create item when timer is done. OR have a sound effect if (Mouse.GetState().LeftButton == ButtonState.Pressed && !(timeLClicked < 400)) // click timer { bool canCreateItem = false; if (craftableItemsChecked.Count > 0) { var item = craftableItemsChecked[selectedIndex]; // get item from menu icons if (emptySpotAvailable || (item.stackable && playerInvCanStackItem[item.bbKey])) { canCreateItem = true; } else { // check to see if the ingredients used will free up a spot foreach (KeyValuePair <string, int> ingredient in ingredientsAmountDifferences[item.bbKey]) { if (ingredient.Value <= 0) { canCreateItem = true; break; } } } InventoryItem itemCreated = null; if (canCreateItem) { // remove ingredients from player inv foreach (var itm in inventoryOfPlayer.inventory) { if (itm == null) { continue; } foreach (var ing in Mappings.ItemMappings.CraftingRecipes[craftObj.GetCraftSet()][item.bbKey]) { if (itm.bbKey.Equals(ing.Key)) { itm.amountStacked -= ing.Value; } } } // create inv item and add to players inv itemCreated = ItemUtility.CreateInventoryItem(item.bbKey, inventoryOfPlayer.teamType, inventoryOfPlayer.regionKey, item.location, _content, _graphics); craftObj.GetCraftingQueue().Enqueue(itemCreated); /*if (inventoryOfPlayer.AddInventoryItem(itemCreated)) * { * itemCreated.inInventory = true; * itemCreated.onGround = false; * }*/ timeLClicked = 0; } } } } i++; } } menuOpen = false; }
// Token: 0x060022C1 RID: 8897 RVA: 0x000C69B8 File Offset: 0x000C4BB8 public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action) { if (owaContext == null) { throw new ArgumentNullException("owaContext"); } applicationElement = ApplicationElement.NotSet; type = string.Empty; action = string.Empty; state = string.Empty; Item item = null; Item item2 = null; Item item3 = null; bool flag = false; BodyFormat bodyFormat = BodyFormat.TextPlain; PreFormActionResponse result; try { HttpContext httpContext = owaContext.HttpContext; UserContext userContext = owaContext.UserContext; PreFormActionResponse preFormActionResponse = new PreFormActionResponse(httpContext.Request, new string[] { "cb", "smime" }); item = ReplyForwardUtilities.GetItemForRequest(owaContext, out item2); if (item != null && !ItemUtility.IsForwardSupported(item)) { throw new OwaInvalidRequestException("Forwarding of such a type item is not supported."); } CalendarItemBase calendarItemBase = item as CalendarItemBase; if (item is Task || item is ContactBase || (calendarItemBase != null && !calendarItemBase.IsMeeting)) { item3 = ReplyForwardUtilities.CreateForwardMessageWithItemAttached(item, userContext); preFormActionResponse.Action = "New"; preFormActionResponse.AddParameter("exdltdrft", "1"); } else { bool flag2 = false; string queryStringParameter = Utilities.GetQueryStringParameter(httpContext.Request, "smime", false); RightsManagedMessageDecryptionStatus decryptionStatus = RightsManagedMessageDecryptionStatus.FeatureDisabled; if (userContext.IsIrmEnabled) { try { flag = Utilities.IrmDecryptForReplyForward(owaContext, ref item, ref item2, ref bodyFormat, out decryptionStatus); } catch (RightsManagementPermanentException exception) { decryptionStatus = RightsManagedMessageDecryptionStatus.CreateFromException(exception); } } if (!flag) { bodyFormat = ReplyForwardUtilities.GetReplyForwardBodyFormat(item, userContext); } bool flag3 = Utilities.IsSMimeControlNeededForEditForm(queryStringParameter, owaContext); flag2 = ((flag3 && Utilities.IsSMime(item)) || flag); bool flag4 = userContext.IsSmsEnabled && ObjectClass.IsSmsMessage(owaContext.FormsRegistryContext.Type); ReplyForwardFlags replyForwardFlags = ReplyForwardFlags.None; if (flag2) { replyForwardFlags |= ReplyForwardFlags.DropBody; } if (flag4 || flag) { replyForwardFlags |= ReplyForwardFlags.DropHeader; } StoreObjectId parentFolderId = Utilities.GetParentFolderId(item2, item); item3 = ReplyForwardUtilities.CreateForwardItem(flag3 ? BodyFormat.TextHtml : bodyFormat, item, replyForwardFlags, userContext, parentFolderId); if (flag) { item3.AttachmentCollection.RemoveAll(); using (ItemAttachment itemAttachment = item3.AttachmentCollection.AddExistingItem(item)) { itemAttachment.Save(); goto IL_205; } } if (Utilities.IsIrmRestrictedAndNotDecrypted(item)) { ReplyForwardUtilities.SetAlternateIrmBody(item3, flag3 ? BodyFormat.TextHtml : bodyFormat, userContext, parentFolderId, decryptionStatus, ObjectClass.IsVoiceMessage(item.ClassName)); item3.AttachmentCollection.RemoveAll(); } IL_205: preFormActionResponse.Action = "Forward"; if (flag2) { preFormActionResponse.AddParameter("srcId", Utilities.GetItemIdQueryString(httpContext.Request)); if (Utilities.GetQueryStringParameter(httpContext.Request, "cb", false) == null && Utilities.IsWebBeaconsAllowed(item)) { preFormActionResponse.AddParameter("cb", "1"); } } if (flag4) { item3.ClassName = "IPM.Note.Mobile.SMS"; } } item3.Save(SaveMode.ResolveConflicts); item3.Load(); ReplyForwardUtilities.DeleteLevelOneAttachments(item3, userContext); preFormActionResponse.ApplicationElement = ApplicationElement.Item; preFormActionResponse.Type = item3.ClassName; preFormActionResponse.AddParameter("id", OwaStoreObjectId.CreateFromStoreObject(item3).ToBase64String()); if (userContext.IsInOtherMailbox(item)) { preFormActionResponse.AddParameter("fOMF", "1"); } if (flag) { preFormActionResponse.AddParameter("fIrmAsAttach", "1"); } result = preFormActionResponse; } finally { if (item != null) { item.Dispose(); item = null; } if (item2 != null) { item2.Dispose(); item2 = null; } if (item3 != null) { item3.Dispose(); item3 = null; } } return(result); }
// Token: 0x06002FD0 RID: 12240 RVA: 0x00116600 File Offset: 0x00114800 public static void AddCalendarInfobarMessages(Infobar infobar, CalendarItemBase calendarItemBase, MeetingMessage meetingMessage, UserContext userContext) { if (infobar == null) { throw new ArgumentNullException("infobar"); } if (calendarItemBase == null) { throw new ArgumentNullException("calendarItemBase"); } if (userContext == null) { throw new ArgumentNullException("userContext"); } bool flag = calendarItemBase.IsOrganizer() && calendarItemBase.IsMeeting; ExDateTime localTime = DateTimeUtilities.GetLocalTime(); bool flag2 = false; if (calendarItemBase.IsMeeting && calendarItemBase.IsCancelled) { infobar.AddMessage(-161808760, InfobarMessageType.Informational); } if (calendarItemBase.CalendarItemType == CalendarItemType.RecurringMaster) { CalendarItem calendarItem = (CalendarItem)calendarItemBase; if (calendarItem.Recurrence != null && !(calendarItem.Recurrence.Range is NoEndRecurrenceRange)) { OccurrenceInfo lastOccurrence = calendarItem.Recurrence.GetLastOccurrence(); if (lastOccurrence != null && lastOccurrence.EndTime < localTime) { infobar.AddMessage(-2124392108, InfobarMessageType.Informational); flag2 = true; } } } else if (calendarItemBase.EndTime < localTime) { flag2 = true; if (calendarItemBase.CalendarItemType != CalendarItemType.RecurringMaster) { infobar.AddMessage(-593429293, InfobarMessageType.Informational); } } InfobarMessageBuilder.AddFlag(infobar, calendarItemBase, userContext); if (flag) { if (calendarItemBase.MeetingRequestWasSent) { CalendarUtilities.AddAttendeeResponseCountMessage(infobar, calendarItemBase); } else { infobar.AddMessage(613373695, InfobarMessageType.Informational); } } if (!calendarItemBase.IsOrganizer() && calendarItemBase.IsMeeting) { bool flag3 = false; MeetingRequest meetingRequest = meetingMessage as MeetingRequest; if (meetingRequest != null) { flag3 = (meetingRequest.MeetingRequestType == MeetingMessageType.PrincipalWantsCopy); } if (calendarItemBase.ResponseType != ResponseType.NotResponded) { Strings.IDs?ds = null; Strings.IDs?ds2 = null; switch (calendarItemBase.ResponseType) { case ResponseType.Tentative: ds = new Strings.IDs?(-1859761232); ds2 = new Strings.IDs?(1365345389); break; case ResponseType.Accept: ds = new Strings.IDs?(-700793833); ds2 = new Strings.IDs?(-1153967082); break; case ResponseType.Decline: ds = new Strings.IDs?(-278420592); ds2 = new Strings.IDs?(2009978813); break; } if (ds != null) { ExDateTime property = ItemUtility.GetProperty <ExDateTime>(calendarItemBase, CalendarItemBaseSchema.AppointmentReplyTime, ExDateTime.MinValue); string text = Strings.None; string text2 = string.Empty; if (property != ExDateTime.MinValue) { text = property.ToString(userContext.UserOptions.DateFormat); text2 = property.ToString(userContext.UserOptions.TimeFormat); } string property2 = ItemUtility.GetProperty <string>(calendarItemBase, CalendarItemBaseSchema.AppointmentReplyName, string.Empty); SanitizedHtmlString messageHtml; if (string.Compare(property2, userContext.ExchangePrincipal.MailboxInfo.DisplayName, StringComparison.OrdinalIgnoreCase) == 0) { messageHtml = SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(ds.Value), new object[] { text, text2 }); } else { messageHtml = SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(ds2.Value), new object[] { property2, text, text2 }); } infobar.AddMessage(messageHtml, InfobarMessageType.Informational); return; } } else if (!flag2 && !calendarItemBase.IsCancelled) { if (!flag3) { bool property3 = ItemUtility.GetProperty <bool>(calendarItemBase, ItemSchema.IsResponseRequested, true); if (property3) { infobar.AddMessage(919273049, InfobarMessageType.Informational); } else { infobar.AddMessage(1602295502, InfobarMessageType.Informational); } } else { infobar.AddMessage(-200304859, InfobarMessageType.Informational); } CalendarUtilities.GetConflictingAppointments(infobar, calendarItemBase, userContext); } } }
// Token: 0x06002EBE RID: 11966 RVA: 0x0010C4DC File Offset: 0x0010A6DC private bool BindItemAndShowDialog(Event eventItem, string type) { MessageItem messageItem = null; bool result; try { messageItem = Item.BindAsMessage(base.UserContext.MailboxSession, eventItem.ObjectId); if (messageItem != null) { string text = ItemUtility.GetProperty<string>(messageItem, StoreObjectSchema.ItemClass, null); if (text == null) { text = "IPM.Note"; } this.Writer.Write("shwNwItmDlg(\""); if (messageItem.From != null && messageItem.From.DisplayName != null) { Utilities.JavascriptEncode(Utilities.HtmlEncode(messageItem.From.DisplayName), this.Writer); } this.Writer.Write("\",\""); if (messageItem.Subject != null) { Utilities.JavascriptEncode(Utilities.HtmlEncode(messageItem.Subject), this.Writer); } this.Writer.Write("\",\"" + type + "\",\""); using (StringWriter stringWriter = new StringWriter()) { SmallIconManager.RenderItemIcon(stringWriter, base.UserContext, text, false, "nwItmImg", new string[0]); Utilities.JavascriptEncode(stringWriter.ToString(), this.Writer); } this.Writer.Write("\");"); } result = true; } catch (ObjectNotFoundException) { if (type != null) { if (!(type == "lnkNwMl")) { if (!(type == "lnkNwVMl")) { if (type == "lnkNwFx") { this.Writer.Write("shwNF(0);"); } } else { this.Writer.Write("shwNVM(0);"); } } else { this.Writer.Write("shwNM(0);"); } } result = false; } finally { if (messageItem != null) { messageItem.Dispose(); } } return result; }
public void Parse(GameClient session, ClientPacket packet) { int pageId = packet.PopInt(); int itemId = packet.PopInt(); string data = packet.PopString(); string giftUser = StringCharFilter.Escape(packet.PopString()); string giftMessage = StringCharFilter.Escape(packet.PopString().Replace(Convert.ToChar(5), ' ')); int spriteId = packet.PopInt(); int ribbon = packet.PopInt(); int colour = packet.PopInt(); packet.PopBoolean(); if (PlusEnvironment.GetSettingsManager().TryGetValue("room.item.gifts.enabled") != "1") { session.SendNotification("The hotel managers have disabled gifting"); return; } if (!PlusEnvironment.GetGame().GetCatalog().TryGetPage(pageId, out CatalogPage page)) { return; } if (!page.Enabled || !page.Visible || page.MinimumRank > session.GetHabbo().Rank || page.MinimumVIP > session.GetHabbo().VIPRank&& session.GetHabbo().Rank == 1) { return; } if (!page.Items.TryGetValue(itemId, out CatalogItem item)) { if (page.ItemOffers.ContainsKey(itemId)) { item = page.ItemOffers[itemId]; if (item == null) { return; } } else { return; } } if (!ItemUtility.CanGiftItem(item)) { return; } if (!PlusEnvironment.GetGame().GetItemManager().GetGift(spriteId, out ItemData presentData) || presentData.InteractionType != InteractionType.GIFT) { return; } if (session.GetHabbo().Credits < item.CostCredits) { session.SendPacket(new PresentDeliverErrorMessageComposer(true, false)); return; } if (session.GetHabbo().Duckets < item.CostPixels) { session.SendPacket(new PresentDeliverErrorMessageComposer(false, true)); return; } Habbo habbo = PlusEnvironment.GetHabboByUsername(giftUser); if (habbo == null) { session.SendPacket(new GiftWrappingErrorComposer()); return; } if (!habbo.AllowGifts) { session.SendNotification("Oops, this user doesn't allow gifts to be sent to them!"); return; } if ((DateTime.Now - session.GetHabbo().LastGiftPurchaseTime).TotalSeconds <= 15.0) { session.SendNotification("You're purchasing gifts too fast! Please wait 15 seconds!"); session.GetHabbo().GiftPurchasingWarnings += 1; if (session.GetHabbo().GiftPurchasingWarnings >= 25) { session.GetHabbo().SessionGiftBlocked = true; } return; } if (session.GetHabbo().SessionGiftBlocked) { return; } string ed = giftUser + Convert.ToChar(5) + giftMessage + Convert.ToChar(5) + session.GetHabbo().Id + Convert.ToChar(5) + item.Data.Id + Convert.ToChar(5) + spriteId + Convert.ToChar(5) + ribbon + Convert.ToChar(5) + colour; int newItemId; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { //Insert the dummy item. dbClient.SetQuery("INSERT INTO `items` (`base_item`,`user_id`,`extra_data`) VALUES (@baseId, @habboId, @extra_data)"); dbClient.AddParameter("baseId", presentData.Id); dbClient.AddParameter("habboId", habbo.Id); dbClient.AddParameter("extra_data", ed); newItemId = Convert.ToInt32(dbClient.InsertQuery()); string itemExtraData = null; switch (item.Data.InteractionType) { case InteractionType.NONE: itemExtraData = ""; break; #region Pet handling case InteractionType.PET: try { string[] bits = data.Split('\n'); string petName = bits[0]; string race = bits[1]; string color = bits[2]; if (PetUtility.CheckPetName(petName)) { return; } if (race.Length > 2) { return; } if (color.Length != 6) { return; } PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_PetLover", 1); } catch { return; } break; #endregion case InteractionType.FLOOR: case InteractionType.WALLPAPER: case InteractionType.LANDSCAPE: double number = 0; try { number = string.IsNullOrEmpty(data) ? 0 : double.Parse(data, PlusEnvironment.CultureInfo); } catch { //ignored } itemExtraData = number.ToString(CultureInfo.CurrentCulture).Replace(',', '.'); break; // maintain extra data // todo: validate case InteractionType.POSTIT: itemExtraData = "FFFF33"; break; case InteractionType.MOODLIGHT: itemExtraData = "1,1,1,#000000,255"; break; case InteractionType.TROPHY: itemExtraData = session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + Convert.ToChar(9) + data; break; case InteractionType.MANNEQUIN: itemExtraData = "m" + Convert.ToChar(5) + ".ch-210-1321.lg-285-92" + Convert.ToChar(5) + "Default Mannequin"; break; case InteractionType.BADGE_DISPLAY: if (!session.GetHabbo().GetBadgeComponent().HasBadge(data)) { session.SendPacket(new BroadcastMessageAlertComposer("Oops, it appears that you do not own this badge.")); return; } itemExtraData = data + Convert.ToChar(9) + session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year; break; default: itemExtraData = data; break; } //Insert the present, forever. dbClient.SetQuery("INSERT INTO `user_presents` (`item_id`,`base_id`,`extra_data`) VALUES (@itemId, @baseId, @extra_data)"); dbClient.AddParameter("itemId", newItemId); dbClient.AddParameter("baseId", item.Data.Id); dbClient.AddParameter("extra_data", string.IsNullOrEmpty(itemExtraData) ? "" : itemExtraData); dbClient.RunQuery(); //Here we're clearing up a record, this is dumb, but okay. dbClient.SetQuery("DELETE FROM `items` WHERE `id` = @deleteId LIMIT 1"); dbClient.AddParameter("deleteId", newItemId); dbClient.RunQuery(); } Item giveItem = ItemFactory.CreateGiftItem(presentData, habbo, ed, ed, newItemId); if (giveItem != null) { GameClient receiver = PlusEnvironment.GetGame().GetClientManager().GetClientByUserId(habbo.Id); if (receiver != null) { receiver.GetHabbo().GetInventoryComponent().TryAddItem(giveItem); receiver.SendPacket(new FurniListNotificationComposer(giveItem.Id, 1)); receiver.SendPacket(new PurchaseOKComposer()); receiver.SendPacket(new FurniListAddComposer(giveItem)); receiver.SendPacket(new FurniListUpdateComposer()); } if (habbo.Id != session.GetHabbo().Id&& !string.IsNullOrWhiteSpace(giftMessage)) { PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_GiftGiver", 1); if (receiver != null) { PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(receiver, "ACH_GiftReceiver", 1); } PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(session, QuestType.GiftOthers); } } session.SendPacket(new PurchaseOKComposer(item, presentData)); if (item.CostCredits > 0) { session.GetHabbo().Credits -= item.CostCredits; session.SendPacket(new CreditBalanceComposer(session.GetHabbo().Credits)); } if (item.CostPixels > 0) { session.GetHabbo().Duckets -= item.CostPixels; session.SendPacket(new HabboActivityPointNotificationComposer(session.GetHabbo().Duckets, session.GetHabbo().Duckets)); } session.GetHabbo().LastGiftPurchaseTime = DateTime.Now; }
void OnEnable() { // First thing is to se the singleton reference, many things will use this, and this object spawns pretty much everything instance = this; if(textureManager == null) { Debug.LogError("WorldManager Does not have a texture manager assigned! Please add one as a child and assign it to the world manager in the inspector!"); } // Start by loading all data craftingItemState = ItemUtility.LoadCraftingItems(craftingItemFile); if(craftingItemState == null) { Debug.Log("ERROR! No crafting items found at " + craftingItemFile); } wearableItemState = ItemUtility.LoadWearableItems(wearableItemFile); if(wearableItemState == null) { Debug.Log("ERROR! No wearable items found at " + wearableItemFile); } textUtility = ProceduralTextUtility.LoadTextTypes(textSourceFile); if(textUtility == null) { Debug.Log("ERROR! No procedural text source file found at " + textSourceFile); } dieties = new Diety[NUM_DIETIES]; for(int i = 0; i < NUM_DIETIES; i++) { string prefix = ""; string title = ""; string suffix = ""; textUtility.GenerateCompleteName(ref prefix, ref title, ref suffix); Diety d = new Diety(prefix, title, suffix); dieties[i] = d; } // Next grabs the world generator, which should be attached to the world manager object worldGenerator = GetComponent<WorldGenerator>(); if(worldGenerator == null) { Debug.LogWarning("WARNING! No world generator found on "+name+". No terrain will be created!"); } // Grab the gramlin manager: this isnt suuuuper critical, but the game really doesnt work without it lootGremlinSpawnManager = GetComponent<LootGremlinSpawner>(); if(worldGenerator == null) { Debug.LogWarning("WARNING! No LootGremlinSpawner found on " + name + ". No Loot gremlins will be spawned!"); } uiManager = new UI_Manager(); objectPool = new ObjectPool(); sunLight = (Light)Instantiate(sunPrototype, new Vector3(0.0f, 0.0f, -10.0f), Quaternion.identity); maxSunIntensity = sunLight.intensity; // attempt to load game state, if it exists, otherwise create a new one gameState = GameStateUtility.LoadGameState(saveLocation); if(gameState == null) { gameState = new GameStateUtility(); GameStateUtility.SaveGameState(saveLocation, gameState); } if(playerPrototype == null) { Debug.LogError("Player prototype is not set, cannot initialize game!"); return; } playerStartLocation = worldGenerator.GeneratorOrigin(); playerCharacter = (Player)Instantiate(playerPrototype, playerStartLocation, Quaternion.identity); // Assign the state that was loaded if(gameState.playerState != null) { playerCharacter.SetState(gameState.playerState); } else { Debug.Log("ERROR! Player state was not loaded / created in the game state!"); } if(worldGenerator != null) { worldGenerator.StartGeneratingWorld(playerCharacter); } // Instaniate all of the background layers from prototypes: they are self managing foreach(ParallaxBackground bg in backGroundSet) { Instantiate(bg.gameObject); } // Fill out the ability object map with the editor assigned objects, mapped to names abilityObjectMap = new Dictionary<string, GameObject>(); foreach(GameObject obj in spawnableObjects) { if(obj != null) { abilityObjectMap.Add(obj.name, obj); } } pawnsOnScreen = new List<Pawn>(); }
// Token: 0x060022CC RID: 8908 RVA: 0x000C71E4 File Offset: 0x000C53E4 public static void AddNoEditPermissionWarning(Infobar infobar, Item item, bool isPreviewForm) { if (infobar == null) { throw new ArgumentNullException("infobar"); } if (item == null) { throw new ArgumentNullException("item"); } if ((Utilities.IsPublic(item) || Utilities.IsOtherMailbox(item)) && !isPreviewForm && !ItemUtility.UserCanEditItem(item)) { infobar.AddMessage(SanitizedHtmlString.FromStringId(2078257811), InfobarMessageType.Informational); } }
// Token: 0x06001F31 RID: 7985 RVA: 0x000B32DC File Offset: 0x000B14DC public static void RenderCategories(OwaContext owaContext, TextWriter writer, IStorePropertyBag storePropertyBag, StoreSession storeSession) { if (owaContext == null) { throw new ArgumentNullException("owaContext"); } if (writer == null) { throw new ArgumentNullException("writer"); } if (storePropertyBag == null) { throw new ArgumentNullException("storePropertyBag"); } string[] property = ItemUtility.GetProperty <string[]>(storePropertyBag, ItemSchema.Categories, null); string value = owaContext.UserContext.IsRtl ? "rtl" : "ltr"; int num = 0; if (property != null && 0 < property.Length) { MasterCategoryList masterCategoryList = null; try { if (storeSession != null && owaContext.UserContext.IsOtherMailbox(storeSession)) { masterCategoryList = owaContext.UserContext.GetMasterCategoryList(storeSession as MailboxSession); } else { masterCategoryList = owaContext.UserContext.GetMasterCategoryList(); } } catch (QuotaExceededException ex) { ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "CategorySwatch.RenderCategories: Failed. Exception: {0}", ex.Message); return; } if (masterCategoryList != null) { for (int i = 0; i < property.Length; i++) { writer.Write("<span class=\"spanCatContainer\" dir=\""); writer.Write(value); writer.Write("\">"); CategorySwatch.RenderSwatch(writer, masterCategoryList[property[i]]); writer.Write(" "); Utilities.SanitizeHtmlEncode(property[i], writer); if (i < property.Length - 1) { writer.Write("; "); } writer.Write("</span><wbr>"); num++; } } } if (num == 0) { writer.Write("<span class=\"spanCatContainer catAfter\" dir=\""); writer.Write(value); writer.Write("\">"); int legacyColoredFlag = ItemUtility.GetLegacyColoredFlag(storePropertyBag); if (0 < legacyColoredFlag && legacyColoredFlag < CategorySwatch.FlagCategory.Length) { CategorySwatch.RenderSwatch(writer, (ItemColor)legacyColoredFlag); writer.Write("<span id=\"vaM\">"); writer.Write(SanitizedHtmlString.FromStringId(CategorySwatch.FlagCategory[legacyColoredFlag])); writer.Write("</span>"); } writer.Write("</span>"); } }