public MessageEntityEntryAttribute(string name, DirectionTypes direction, InteractionTypes interaction, string description) { Name = name; Direction = direction; Interaction = interaction; Description = description; }
public bool InitializeInteraction(InteractionTypes t) { EntityConfigBase c = EntityConfig; if (c == null) { return(false); } _log.Write(string.Format("Initializing {0} agent in entity {1}({2}).", t.ToString(), c.Name, c.EntityID.ToString())); if ((t & InteractionTypes.Publisher) == InteractionTypes.Publisher) { this.InitializePublisherAgent(c); } if ((t & InteractionTypes.Subscriber) == InteractionTypes.Subscriber) { this.InitializeSubscriberAgent(c); } if ((t & InteractionTypes.Requester) == InteractionTypes.Requester) { this.InitializeRequesterAgent(c); } if ((t & InteractionTypes.Responser) == InteractionTypes.Responser) { this.InitializeResponserAgent(c); } return(true); }
public SessionInteractionOccuredEvent(string id, string aggregateId, int version, InteractionTypes interactionType, string articleId, string articleLanguage, DateTime actionDateTime) : base(id, aggregateId, version) { InteractionType = interactionType; ArticleId = articleId; ArticleLanguage = articleLanguage; ActionDateTime = actionDateTime; }
private bool HandlePointer(PointerDeviceType pointerDeviceType) { ResetPlayer(); CoreWindow.GetForCurrentThread().KeyDown -= this.AttractorLoopPlayer_KeyDown; InteractionTypes interactionType = InteractionTypes.Mouse; switch (pointerDeviceType) { case PointerDeviceType.Mouse: interactionType = InteractionTypes.Mouse; break; case PointerDeviceType.Pen: interactionType = InteractionTypes.Pen; break; case PointerDeviceType.Touch: interactionType = InteractionTypes.Touch; break; } RaiseInteractionEvent(this, interactionType); return(true); }
public List <IWiredItem> GetWiredsByTypes(GlobalInteractions type) { return (_wiredItems.Where( item => item != null && InteractionTypes.AreFamiliar(type, item.Item.GetBaseItem().InteractionType)) .ToList()); }
private void RaiseInteractionEvent(AttractorLoopPlayer attractorLoop, InteractionTypes interactionType) { RaiseInteractionEvent(attractorLoop, new InteractedEventArgs() { InteractionType = interactionType }); }
private bool HandlePointer(PointerDeviceType pointerDeviceType) { ResetPlayer(); InteractionTypes interactionType = InteractionTypes.Mouse; switch (pointerDeviceType) { case PointerDeviceType.Mouse: interactionType = InteractionTypes.Mouse; break; case PointerDeviceType.Pen: interactionType = InteractionTypes.Pen; break; case PointerDeviceType.Touch: interactionType = InteractionTypes.Touch; break; } RaiseInteractionEvent(this, interactionType); return(true); }
private void OnInteractionAvailable(InteractionTypes interaction) { interactionAvailable = true; interactablePanel.SetActive(true); text.text = interaction.ToString(); }
void Start(){ if(ControlCenter == null){ ControlCenter = GameObject.Find ("Control Center"); } if (Interaction == null) { typeOfInteraction = InteractionTypes.NA; } }
private bool playerArrivedAtTarget; //Gibt an ob der Spieler beim Objekt ist // Use this for initialization void Start() { interaction = new InteractionTypes[types.Length]; for (int i = 0; i < types.Length; i++) { interaction[i] = new InteractionTypes(types[i]); } action = -1; playerArrivedAtTarget = true; }
void Start() { if (ControlCenter == null) { ControlCenter = GameObject.Find("Control Center"); } if (Interaction == null) { typeOfInteraction = InteractionTypes.NA; } }
private void buttonInteractionModify_Click(object sender, EventArgs e) { InteractionTypes t = (InteractionTypes)Enum.Parse(typeof(InteractionTypes), this.textBoxInteraction.Text.Trim()); FormInteractionType frm = new FormInteractionType(t); if (frm.ShowDialog(this) != DialogResult.OK) { return; } this.textBoxInteraction.Text = frm.Types.ToString(); }
private void SaveSetting() { InteractionTypes type = InteractionTypes.Unknown; foreach (object o in this.checkedListBoxTypes.CheckedItems) { InteractionTypes t = (InteractionTypes)o; type = (type | t); } _types = type; }
private void LockGate(RoomItem item) { var interactionType = item.GetBaseItem().InteractionType; if (!InteractionTypes.AreFamiliar(GlobalInteractions.GameGate, interactionType)) { return; } foreach (var current in _room.GetGameMap().GetRoomUsers(new Point(item.X, item.Y))) { current.SqState = 0; } _room.GetGameMap().GameMap[item.X, item.Y] = 0; }
/// <summary> /// This method holds the client object. And appropriate channel interactions will be notified to the subscriber /// </summary> /// <param name="types">The types.</param> /// <param name="clientObject">The client object.</param> public void Subscriber(InteractionTypes types, IInteractionServices clientObject) { // Settings settings = new Settings(); if (!Settings.subscriberObject.ContainsKey(InteractionTypes.Email) && types == InteractionTypes.Email) { Settings.subscriberObject.Add(types, clientObject); } if (!Settings.subscriberObject.ContainsKey(InteractionTypes.Chat) && types == InteractionTypes.Chat) { Settings.subscriberObject.Add(types, clientObject); } if (!Settings.subscriberObject.ContainsKey(InteractionTypes.OutboundPreview) && types == InteractionTypes.OutboundPreview) { Settings.subscriberObject.Add(types, clientObject); } messageToClient = clientObject; }
private void LoadSetting() { InitializeCheckBoxs(); for (int i = 0; i < this.checkedListBoxTypes.Items.Count; i++) { InteractionTypes t = (InteractionTypes)this.checkedListBoxTypes.Items[i]; if ((t & _types) == t) { this.checkedListBoxTypes.SetItemChecked(i, true); } else { this.checkedListBoxTypes.SetItemChecked(i, false); } } }
// Override the XRController's current interaction state (used for interaction state playback) internal void UpdateInteractionType(InteractionTypes interactionStateType, bool isInteractionStateOn) { switch (interactionStateType) { case InteractionTypes.select: UpdateInteractionState(ref m_SelectInteractionState, isInteractionStateOn); break; case InteractionTypes.activate: UpdateInteractionState(ref m_ActivateInteractionState, isInteractionStateOn); break; case InteractionTypes.uiPress: UpdateInteractionState(ref m_UIPressInteractionState, isInteractionStateOn); break; } }
public void ApplyInteractionAnimation(InteractionTypes type) { switch (type) { case InteractionTypes.None: break; case InteractionTypes.Grab: Controller.Play(GrabAnim, 0, 0f); break; case InteractionTypes.Open: Controller.Play(GrabAnim, 0, 0f); break; case InteractionTypes.Drink: Controller.Play(DrinkAnim, 0, 0f); break; case InteractionTypes.Pour: Controller.Play(GrabAnim, 0, 0f); break; case InteractionTypes.Instant: Controller.Play(GrabAnim, 0, 0f); break; case InteractionTypes.Place: Controller.Play(GrabAnim, 0, 0f); break; default: Debug.LogError("Invalid Interaction type: " + type); break; } }
public FormInteractionType(InteractionTypes types) { InitializeComponent(); _types = types; }
/// <summary> /// Deals with object interactions between each other. /// </summary> /// <param name="otherObject">The other object to interact with.</param> public virtual InteractionActions InteractWith(GameObject otherObject, InteractionTypes interactionType) { // TODO: Add the interaction chart for each possible object interaction. // The owner of this method is considered the "initiator" of the interaction return InteractionActions.None; }
/// <summary> /// Called when the player tries to interact /// </summary> /// <param name="type">Type of the interaction</param> /// <returns></returns> public bool ValidateInteraction(InteractionType type) => InteractionTypes.HasFlag(type);
public static SessionAction Create(string articleId, string articleLanguage, InteractionTypes interactionType, DateTime actionDateTime) { return(new SessionAction { ArticleId = articleId, ArticleLanguage = articleLanguage, ActionDateTime = actionDateTime, InteractionType = interactionType }); }
public InteractionLambda(InteractionTypes type, string text, System.Action action) { this.type = type; this.text = text; this.action = action; }
public virtual bool HasInteraction(InteractionTypes interactionType) { switch (interactionType) { case InteractionTypes.PlayerAction: switch (objectName) { case "SavePoint": return true; case "Lever": return true; default: return false; } case InteractionTypes.Collision: if (isItem || isHazard) return true; break; } return false; }
public int outcome; //move to scenarioID public Interaction(InteractionTypes type, string description, int outc) { interactionType = type; interactionDescription = description; outcome = outc; }
private void AddSubscriptionInteraction(int subscriptionID, int requestInputMechanismID, InteractionTypes interactionType) { CDB DB = new CDB("AddSubscriptionInteraction"); DB.Execute("SUB_AddSubscriptionInteraction " + subscriptionID.ToString() + "," + requestInputMechanismID.ToString() + "," + ((int)interactionType).ToString(), CDB.exmReturnTypes.RETURN_NON_QUERY); DB.Close(); DB = null; }
/// <summary> /// Moves to. /// </summary> /// <param name="x">The p x.</param> /// <param name="y">The p y.</param> /// <param name="pOverride">if set to <c>true</c> [p override].</param> internal void MoveTo(int x, int y, bool pOverride) { if (TeleportEnabled) { UnIdle(); GetRoom() .SendMessage(GetRoom() .GetRoomItemHandler() .UpdateUserOnRoller(this, new Point(x, y), 0u, GetRoom().GetGameMap().SqAbsoluteHeight(GoalX, GoalY))); if (Statusses.ContainsKey("sit")) { Z -= 0.35; } UpdateNeeded = true; GetRoom().GetRoomUserManager().UpdateUserStatus(this, false); return; } if (GetRoom().GetGameMap().SquareHasUsers(x, y) && !pOverride) { return; } if (Frozen) { return; } Point coord = new Point(x, y); List <RoomItem> allRoomItemForSquare = GetRoom().GetGameMap().GetCoordinatedHeighestItems(coord); if ((RidingHorse && !IsBot && allRoomItemForSquare.Any()) || (IsPet && allRoomItemForSquare.Any())) { if ( allRoomItemForSquare.Any( current => current.GetBaseItem().IsSeat || current.GetBaseItem().InteractionType == Interaction.LowPool || current.GetBaseItem().InteractionType == Interaction.Pool || current.GetBaseItem().InteractionType == Interaction.HaloweenPool || current.GetBaseItem().InteractionType == Interaction.Bed || current.GetBaseItem().InteractionType == Interaction.PressurePadBed || current.GetBaseItem().InteractionType == Interaction.Guillotine)) { return; } } if (IsPet && allRoomItemForSquare.Any( p => InteractionTypes.AreFamiliar(GlobalInteractions.PetBreeding, p.GetBaseItem().InteractionType))) { RoomItem s = allRoomItemForSquare.FirstOrDefault( p => InteractionTypes.AreFamiliar(GlobalInteractions.PetBreeding, p.GetBaseItem().InteractionType)); Z -= s.GetBaseItem().Height; } UnIdle(); GoalX = x; GoalY = y; LastSelectedX = x; LastSelectedY = y; PathRecalcNeeded = true; ThrowBallAtGoal = false; }
/// <summary> /// Searches the current room for the nearest valid interactable object and returns it if /// one is in range /// </summary> /// <returns>The nearest object</returns> private GameObject FindInteractionObject(GameObject initiator, InteractionTypes interactionType) { GameObject nearestObject = currentRoom.GetNearestObject(initiator.InteractionPoint, player.InteractionDistance, interactionType); return nearestObject; }
/// <summary> /// Interacts with the given object and interaction type. /// </summary> /// <param name="otherObject">The object to interaction type.</param> /// <param name="interactionType">The type of interaction to take place.</param> public override InteractionActions InteractWith(GameObject otherObject, InteractionTypes interactionType) { if (otherObject.ItemType != ItemList.NullItem && interactionType == InteractionTypes.Collision) { PickUpItem(otherObject); } else { switch (otherObject.ObjectName) { case "Door": if (interactionType == InteractionTypes.PlayerAction) { Door door = (Door)otherObject; if (!door.IsOpen) { if (!itemArray[(byte)door.LockType]) hudCallback("This door is locked.", false, true); else if (door.LinkedRoomName == "(unassigned)") hudCallback("This door appears to go nowhere.", false, true); else door.Open(); return InteractionActions.None; } } else if (!otherObject.IsSolid && interactionType == InteractionTypes.Collision) { Door door = (Door)otherObject; if (door.IsRoomLoaded) roomCallback(door.LinkedRoom); else { loadingDoor = door; GameManager.ToggleFreeze(true); hudCallback("Loading room...", false, false); } if (door.Orientation == Door.DoorOrientations.FacingLeft) ResetActionStates(XDirection.Right); else ResetActionStates(XDirection.Left); return InteractionActions.None; } break; case "SavePoint": if (interactionType == InteractionTypes.PlayerAction) { currentHealth = maxHealth; saveCallback(); return InteractionActions.None; } break; case "Lever": if (interactionType == InteractionTypes.PlayerAction) { otherObject.SwitchLever(); return InteractionActions.Lever; } break; default: return InteractionActions.None; } } return InteractionActions.None; }
private void OnInteractionUnavailable(InteractionTypes interaction) { interactionAvailable = false; interactablePanel.SetActive(false); }
public override bool HasInteraction(InteractionTypes interactionType) { if (interactionType == InteractionTypes.PlayerAction || interactionType == InteractionTypes.Collision) return true; else return false; }
private static bool IsTrigger(Interaction type) => InteractionTypes.AreFamiliar(GlobalInteractions.WiredTrigger, type);
private static bool IsEffect(Interaction type) => InteractionTypes.AreFamiliar(GlobalInteractions.WiredEffect, type);
private static bool IsCondition(Interaction type) => InteractionTypes.AreFamiliar(GlobalInteractions.WiredCondition, type);
/// <summary> /// Handles the purchase. /// </summary> /// <param name="session">The session.</param> /// <param name="pageId">The page identifier.</param> /// <param name="itemId">The item identifier.</param> /// <param name="extraData">The extra data.</param> /// <param name="priceAmount">The price amount.</param> /// <param name="isGift">if set to <c>true</c> [is gift].</param> /// <param name="giftUser">The gift user.</param> /// <param name="giftMessage">The gift message.</param> /// <param name="giftSpriteId">The gift sprite identifier.</param> /// <param name="giftLazo">The gift lazo.</param> /// <param name="giftColor">Color of the gift.</param> /// <param name="undef">if set to <c>true</c> [undef].</param> /// <param name="theGroup">The theGroup.</param> internal void HandlePurchase(GameClient session, uint pageId, uint itemId, string extraData, uint priceAmount, bool isGift, string giftUser, string giftMessage, int giftSpriteId, int giftLazo, int giftColor, bool undef, uint theGroup) { priceAmount = priceAmount < 1 || priceAmount > 100 ? 1 : priceAmount; uint totalPrice = priceAmount, limitedId = 0, limtot = 0; if (priceAmount >= 6) { totalPrice -= Convert.ToUInt32(Math.Ceiling(Convert.ToDouble(priceAmount) / 6)) * 2 - 1; } if (!Categories.Contains(pageId)) { return; } CatalogPage catalogPage = GetPage(pageId); if (catalogPage == null || !catalogPage.Enabled || !catalogPage.Visible || session?.GetHabbo() == null) { return; } if (catalogPage.MinRank > session.GetHabbo().Rank || catalogPage.Layout == "sold_ltd_items") { return; } CatalogItem item = catalogPage.GetItem(itemId); if (item == null) { return; } if (session.GetHabbo().Credits < item.CreditsCost) { return; } if (session.GetHabbo().ActivityPoints < item.DucketsCost) { return; } if (session.GetHabbo().Diamonds < item.DiamondsCost) { return; } if (item.Name == "room_ad_plus_badge") { return; } #region Habbo Club Purchase if (catalogPage.Layout == "vip_buy" || catalogPage.Layout == "club_buy" || HabboClubItems.Contains(item)) { string[] array = item.Name.Split('_'); double dayLength; if (item.Name.Contains("DAY")) { dayLength = double.Parse(array[3]); } else if (item.Name.Contains("MONTH")) { dayLength = Math.Ceiling(double.Parse(array[3]) * 31 - 0.205); } else if (item.Name.Contains("YEAR")) { dayLength = double.Parse(array[3]) * 31 * 12; } else { dayLength = 31; } session.GetHabbo().GetSubscriptionManager().AddSubscription(dayLength); if (item.CreditsCost > 0) { session.GetHabbo().Credits -= item.CreditsCost * totalPrice; session.GetHabbo().UpdateCreditsBalance(); } if (item.DucketsCost > 0) { session.GetHabbo().ActivityPoints -= item.DucketsCost * totalPrice; session.GetHabbo().UpdateActivityPointsBalance(); } if (item.DiamondsCost > 0) { session.GetHabbo().Diamonds -= item.DiamondsCost * totalPrice; session.GetHabbo().UpdateSeasonalCurrencyBalance(); } return; } #endregion #region Is Only for Habbo Club users Check if (item.ClubOnly && !session.GetHabbo().GetSubscriptionManager().HasSubscription) { ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("CatalogPurchaseNotAllowedMessageComposer")); serverMessage.AppendInteger(1); session.SendMessage(serverMessage); return; } #endregion #region Check if is a Pet. If is we have problem. if (item.Items.Keys.Any(current => InteractionTypes.AreFamiliar(GlobalInteractions.Pet, current.InteractionType))) { return; } #endregion #region Limited Items Purchase if (item.IsLimited) { totalPrice = 1; priceAmount = 1; if (item.LimitedSelled >= item.LimitedStack) { session.SendMessage(new ServerMessage(LibraryParser.OutgoingRequest("CatalogLimitedItemSoldOutMessageComposer"))); return; } item.LimitedSelled++; using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor()) { queryReactor.RunFastQuery(string.Concat("UPDATE catalog_items SET limited_sells = ", item.LimitedSelled, " WHERE id = ", item.Id)); limitedId = item.LimitedSelled; limtot = item.LimitedStack; } } else if (isGift && priceAmount > 1) { totalPrice = 1; priceAmount = 1; } #endregion uint toUserId = 0u; if (session.GetHabbo().Credits < item.CreditsCost * totalPrice) { return; } if (session.GetHabbo().ActivityPoints < item.DucketsCost * totalPrice) { return; } if (session.GetHabbo().Diamonds < item.DiamondsCost * totalPrice) { return; } if (!isGift) { if (item.CreditsCost > 0) { session.GetHabbo().Credits -= item.CreditsCost * totalPrice; session.GetHabbo().UpdateCreditsBalance(); } if (item.DucketsCost > 0) { session.GetHabbo().ActivityPoints -= item.DucketsCost * totalPrice; session.GetHabbo().UpdateActivityPointsBalance(); } if (item.DiamondsCost > 0) { session.GetHabbo().Diamonds -= item.DiamondsCost * totalPrice; session.GetHabbo().UpdateSeasonalCurrencyBalance(); } } foreach (Item baseItem in item.Items.Keys) { if (isGift) { if ((DateTime.Now - session.GetHabbo().LastGiftPurchaseTime).TotalSeconds <= 15.0) { session.SendNotif(Yupi.GetLanguage().GetVar("user_send_gift")); return; } if (!baseItem.AllowGift) { return; } DataRow row; using (IQueryAdapter queryreactor3 = Yupi.GetDatabaseManager().GetQueryReactor()) { queryreactor3.SetQuery("SELECT id FROM users WHERE username = @gift_user"); queryreactor3.AddParameter("gift_user", giftUser); row = queryreactor3.GetRow(); } if (row == null) { session.GetMessageHandler().GetResponse().Init(LibraryParser.OutgoingRequest("GiftErrorMessageComposer")); session.GetMessageHandler().GetResponse().AppendString(giftUser); session.GetMessageHandler().SendResponse(); return; } toUserId = (uint)row["id"]; if (toUserId == 0u) { session.GetMessageHandler().GetResponse().Init(LibraryParser.OutgoingRequest("GiftErrorMessageComposer")); session.GetMessageHandler().GetResponse().AppendString(giftUser); session.GetMessageHandler().SendResponse(); return; } if (item.CreditsCost > 0 && isGift) { session.GetHabbo().Credits -= item.CreditsCost * totalPrice; session.GetHabbo().UpdateCreditsBalance(); } if (item.DucketsCost > 0 && isGift) { session.GetHabbo().ActivityPoints -= item.DucketsCost * totalPrice; session.GetHabbo().UpdateActivityPointsBalance(); } if (item.DiamondsCost > 0 && isGift) { session.GetHabbo().Diamonds -= item.DiamondsCost * totalPrice; session.GetHabbo().UpdateSeasonalCurrencyBalance(); } } if (isGift && baseItem.Type == 'e') { session.SendNotif(Yupi.GetLanguage().GetVar("user_send_gift_effect")); return; } if (item.Name.StartsWith("builders_club_addon_")) { int furniAmount = Convert.ToInt32(item.Name.Replace("builders_club_addon_", "").Replace("furnis", "")); session.GetHabbo().BuildersItemsMax += furniAmount; ServerMessage update = new ServerMessage(LibraryParser.OutgoingRequest("BuildersClubMembershipMessageComposer")); update.AppendInteger(session.GetHabbo().BuildersExpire); update.AppendInteger(session.GetHabbo().BuildersItemsMax); update.AppendInteger(2); session.SendMessage(update); using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor()) { queryReactor.SetQuery("UPDATE users SET builders_items_max = @max WHERE id = @userId"); queryReactor.AddParameter("max", session.GetHabbo().BuildersItemsMax); queryReactor.AddParameter("userId", session.GetHabbo().Id); queryReactor.RunQuery(); } session.SendMessage(CatalogPageComposer.PurchaseOk(item, item.Items)); session.SendNotif("${notification.builders_club.membership_extended.message}", "${notification.builders_club.membership_extended.title}", "builders_club_membership_extended"); return; } if (item.Name.StartsWith("builders_club_time_")) { int timeAmount = Convert.ToInt32(item.Name.Replace("builders_club_time_", "").Replace("seconds", "")); session.GetHabbo().BuildersExpire += timeAmount; ServerMessage update = new ServerMessage(LibraryParser.OutgoingRequest("BuildersClubMembershipMessageComposer")); update.AppendInteger(session.GetHabbo().BuildersExpire); update.AppendInteger(session.GetHabbo().BuildersItemsMax); update.AppendInteger(2); session.SendMessage(update); using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor()) { queryReactor.SetQuery("UPDATE users SET builders_expire = @max WHERE id = @userId"); queryReactor.AddParameter("max", session.GetHabbo().BuildersExpire); queryReactor.AddParameter("userId", session.GetHabbo().Id); queryReactor.RunQuery(); } session.SendMessage(CatalogPageComposer.PurchaseOk(item, item.Items)); session.SendNotif("${notification.builders_club.membership_extended.message}", "${notification.builders_club.membership_extended.title}", "builders_club_membership_extended"); return; } string text = string.Empty; Interaction interactionType = baseItem.InteractionType; switch (interactionType) { case Interaction.None: case Interaction.Gate: case Interaction.Bed: case Interaction.PressurePadBed: case Interaction.Guillotine: case Interaction.HcGate: case Interaction.ScoreBoard: case Interaction.VendingMachine: case Interaction.Alert: case Interaction.OneWayGate: case Interaction.LoveShuffler: case Interaction.HabboWheel: case Interaction.Dice: case Interaction.Bottle: case Interaction.Hopper: case Interaction.Teleport: case Interaction.QuickTeleport: case Interaction.Pet: case Interaction.Pool: case Interaction.Roller: break; case Interaction.PostIt: extraData = "FFFF33"; break; case Interaction.RoomEffect: double number = string.IsNullOrEmpty(extraData) ? 0.0 : double.Parse(extraData, Yupi.CultureInfo); extraData = number.ToString(CultureInfo.InvariantCulture).Replace(',', '.'); break; case Interaction.Dimmer: extraData = "1,1,1,#000000,255"; break; case Interaction.Trophy: extraData = string.Concat(session.GetHabbo().UserName, Convert.ToChar(9), DateTime.Now.Day.ToString("00"), "-", DateTime.Now.Month.ToString("00"), "-", DateTime.Now.Year, Convert.ToChar(9), extraData); break; case Interaction.Rentals: extraData = item.ExtraData; break; case Interaction.PetDog: case Interaction.PetCat: case Interaction.PetCrocodile: case Interaction.PetTerrier: case Interaction.PetBear: case Interaction.PetPig: case Interaction.PetLion: case Interaction.PetRhino: case Interaction.PetSpider: case Interaction.PetTurtle: case Interaction.PetChick: case Interaction.PetFrog: case Interaction.PetDragon: case Interaction.PetHorse: case Interaction.PetMonkey: case Interaction.PetGnomo: case Interaction.PetMonsterPlant: case Interaction.PetWhiteRabbit: case Interaction.PetEvilRabbit: case Interaction.PetLoveRabbit: case Interaction.PetCafeRabbit: case Interaction.PetPigeon: case Interaction.PetEvilPigeon: case Interaction.PetDemonMonkey: case Interaction.Pet24: case Interaction.Pet25: case Interaction.Pet26: case Interaction.Pet27: case Interaction.Pet28: case Interaction.Pet29: case Interaction.Pet30: case Interaction.Pet31: case Interaction.Pet32: case Interaction.Pet33: case Interaction.Pet34: string[] data = extraData.Split('\n'); string petName = data[0]; string race = data[1]; string color = data[2]; if (!CheckPetName(petName)) { return; } if (race.Length != 1 && race.Length != 2) { return; } if (color.Length != 6) { return; } Yupi.GetGame().GetAchievementManager().ProgressUserAchievement(session, "ACH_PetLover", 1); break; case Interaction.Mannequin: extraData = string.Concat("m", Convert.ToChar(5), "ch-215-92.lg-3202-1322-73", Convert.ToChar(5), "Mannequin"); break; case Interaction.VipGate: case Interaction.MysteryBox: case Interaction.YoutubeTv: case Interaction.TileStackMagic: case Interaction.Tent: case Interaction.BedTent: break; case Interaction.BadgeDisplay: if (!session.GetHabbo().GetBadgeComponent().HasBadge(extraData)) { extraData = "UMAD"; } extraData = $"{extraData}|{session.GetHabbo().UserName}|{DateTime.Now.Day.ToString("00")}-{DateTime.Now.Month.ToString("00")}-{DateTime.Now.Year}"; break; case Interaction.FootballGate: extraData = "hd-99999-99999.lg-270-62;hd-99999-99999.ch-630-62.lg-695-62"; break; case Interaction.LoveLock: extraData = "0"; break; case Interaction.Pinata: case Interaction.RunWaySage: case Interaction.Shower: extraData = "0"; break; case Interaction.GroupForumTerminal: case Interaction.GuildItem: case Interaction.GuildGate: case Interaction.GuildForum: case Interaction.Poster: break; case Interaction.Moplaseed: extraData = new Random().Next(0, 12).ToString(); break; case Interaction.RareMoplaSeed: extraData = new Random().Next(10, 12).ToString(); break; case Interaction.MusicDisc: SongData song = SoundMachineSongManager.GetSongById(item.SongId); extraData = string.Empty; if (song == null) { break; } extraData = string.Concat(session.GetHabbo().UserName, '\n', DateTime.Now.Year, '\n', DateTime.Now.Month, '\n', DateTime.Now.Day, '\n', song.LengthSeconds, '\n', song.Name); text = song.CodeName; break; default: extraData = item.ExtraData; break; } session.GetMessageHandler().GetResponse().Init(LibraryParser.OutgoingRequest("UpdateInventoryMessageComposer")); session.GetMessageHandler().SendResponse(); session.SendMessage(CatalogPageComposer.PurchaseOk(item, item.Items)); if (isGift) { Item itemBySprite = Yupi.GetGame().GetItemManager().GetItemBySpriteId(giftSpriteId); if (itemBySprite == null) { return; } uint insertId; using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor()) { queryReactor.SetQuery("INSERT INTO items_rooms (item_name,user_id) VALUES (" + itemBySprite.Name + ", " + toUserId + ")"); insertId = (uint)queryReactor.InsertQuery(); queryReactor.SetQuery(string.Concat("INSERT INTO users_gifts (gift_id,item_id,extradata,giver_name,Message,ribbon,color,gift_sprite,show_sender,rare_id) VALUES (", insertId, ", ", baseItem.ItemId, ",@extradata, @name, @Message,", giftLazo, ",", giftColor, ",", giftSpriteId, ",", undef ? 1 : 0, ",", limitedId, ")")); queryReactor.AddParameter("extradata", extraData); queryReactor.AddParameter("name", giftUser); queryReactor.AddParameter("message", giftMessage); queryReactor.RunQuery(); if (session.GetHabbo().Id != toUserId) { Yupi.GetGame().GetAchievementManager().ProgressUserAchievement(session, "ACH_GiftGiver", 1, true); queryReactor.RunFastQuery("UPDATE users_stats SET gifts_given = gifts_given + 1 WHERE id = " + session.GetHabbo().Id + ";UPDATE users_stats SET gifts_received = gifts_received + 1 WHERE id = " + toUserId); } } GameClient clientByUserId = Yupi.GetGame().GetClientManager().GetClientByUserId(toUserId); if (clientByUserId != null) { clientByUserId.GetHabbo().GetInventoryComponent().AddNewItem(insertId, itemBySprite.Name, string.Concat(session.GetHabbo().Id, (char)9, giftMessage, (char)9, giftLazo, (char)9, giftColor, (char)9, undef ? "1" : "0", (char)9, session.GetHabbo().UserName, (char)9, session.GetHabbo().Look, (char)9, item.Name), 0u, false, false, 0, 0); if (clientByUserId.GetHabbo().Id != session.GetHabbo().Id) { Yupi.GetGame().GetAchievementManager().ProgressUserAchievement(clientByUserId, "ACH_GiftReceiver", 1, true); } } session.GetHabbo().LastGiftPurchaseTime = DateTime.Now; continue; } session.GetMessageHandler().GetResponse().Init(LibraryParser.OutgoingRequest("NewInventoryObjectMessageComposer")); session.GetMessageHandler().GetResponse().AppendInteger(1); int i = 1; if (baseItem.Type == 's') { i = InteractionTypes.AreFamiliar(GlobalInteractions.Pet, baseItem.InteractionType) ? 3 : 1; } session.GetMessageHandler().GetResponse().AppendInteger(i); List <UserItem> list = DeliverItems(session, baseItem, priceAmount * item.Items[baseItem], extraData, limitedId, limtot, text); session.GetMessageHandler().GetResponse().AppendInteger(list.Count); foreach (UserItem current3 in list) { session.GetMessageHandler().GetResponse().AppendInteger(current3.Id); } session.GetMessageHandler().SendResponse(); session.GetHabbo().GetInventoryComponent().UpdateItems(false); if (InteractionTypes.AreFamiliar(GlobalInteractions.Pet, baseItem.InteractionType)) { session.SendMessage(session.GetHabbo().GetInventoryComponent().SerializePetInventory()); } } if (item.Badge.Length >= 1) { session.GetHabbo().GetBadgeComponent().GiveBadge(item.Badge, true, session); } }
/// <summary> /// Loads the items. /// </summary> /// <param name="dbClient">The database client.</param> internal void LoadItems(IQueryAdapter dbClient) { _items.Clear(); GiftWrapper.Clear(); dbClient.SetQuery("SELECT * FROM catalog_furnitures"); DataTable table = dbClient.GetTable(); if (table == null) { return; } List <double> heights = null; foreach (DataRow dataRow in table.Rows) { try { uint id = (uint)dataRow["id"]; uint modes = (uint)dataRow["interaction_modes_count"]; uint effect = (uint)dataRow["effectid"]; char type = char.Parse((string)dataRow["type"]); uint flatId = (uint)dataRow["flat_id"]; int sprite = 0; string name = (string)dataRow["item_name"]; string publicName = (string)dataRow["item_name"]; string stackHeightStr = (string)dataRow["stack_height"]; string vendingIds = (string)dataRow["vending_ids"]; bool sub = (string)dataRow["subscriber"] == "1"; bool stackable = (string)dataRow["can_stack"] == "1"; bool allowRecycle = (string)dataRow["allow_recycle"] == "1"; bool allowTrade = (string)dataRow["allow_trade"] == "1"; bool allowMarketplaceSell = (string)dataRow["allow_marketplace_sell"] == "1"; bool allowGift = (string)dataRow["allow_gift"] == "1"; bool allowInventoryStack = (string)dataRow["allow_inventory_stack"] == "1"; bool canWalk = false, canSit = false, stackMultiple = false; ushort x = ushort.MinValue, y = ushort.MinValue; double stackHeight; Interaction typeFromString = InteractionTypes.GetTypeFromString((string)dataRow["interaction_type"]); if (stackHeightStr.Contains(';')) { heights = stackHeightStr.Split(';').Select(heightStr => double.Parse(heightStr, CultureInfo.InvariantCulture)).ToList(); stackHeight = heights[0]; stackMultiple = true; } else { stackHeight = double.Parse(stackHeightStr, CultureInfo.InvariantCulture); } if (name == "landscape" || name == "floor" || name == "wallpaper") { sprite = FurnitureDataManager.WallItems[name].Id; x = 1; y = 1; } else if (type == 's' && FurnitureDataManager.FloorItems.ContainsKey(name)) { sprite = FurnitureDataManager.FloorItems[name].Id; publicName = FurnitureDataManager.FloorItems[name].Name; x = FurnitureDataManager.FloorItems[name].X; y = FurnitureDataManager.FloorItems[name].Y; canWalk = FurnitureDataManager.FloorItems[name].CanWalk; canSit = FurnitureDataManager.FloorItems[name].CanSit; } else if (type == 'i' && FurnitureDataManager.WallItems.ContainsKey(name)) { sprite = FurnitureDataManager.WallItems[name].Id; publicName = FurnitureDataManager.WallItems[name].Name; } else if (name.StartsWith("a0 pet", StringComparison.InvariantCulture)) { x = 1; y = 1; publicName = name; } else if (type != 'e' && type != 'h' && type != 'r' && type != 'b') { continue; } if (name.StartsWith("present_gen")) { GiftWrapper.AddOld(sprite); } else if (name.StartsWith("present_wrap*")) { GiftWrapper.Add(sprite); } // If Can Walk if (InteractionTypes.AreFamiliar(GlobalInteractions.Gate, typeFromString) || (typeFromString == Interaction.BanzaiPyramid) || name.StartsWith("hole")) { canWalk = false; } // Add Item Item value = new Item(id, sprite, publicName, name, type, x, y, stackHeight, stackable, canWalk, canSit, allowRecycle, allowTrade, allowMarketplaceSell, allowGift, allowInventoryStack, typeFromString, modes, vendingIds, sub, effect, stackMultiple, heights?.ToArray(), flatId); _items.Add(id, value); } catch (Exception ex) { Console.WriteLine(ex.ToString()); Console.ReadKey(); Writer.WriteLine($"Could not load item #{Convert.ToUInt32(dataRow[0])}, please verify the data is okay.", "Yupi.Items", ConsoleColor.DarkRed); } } }
/// <summary> /// Finds the nearest GameObject to the given location /// </summary> /// <param name="location">The location to check from.</param> /// <returns>The nearest object</returns> public GameObject GetNearestObject(Vector2 location, int maxDistance, InteractionTypes interactionType) { if ((doorArray.Length == 0) && (enemyArray.Length == 0) && (environmentArray.Length == 0)) return null; else { GameObject nearestObject = null; float closestDistance = 0; float tempDistance = 0; foreach (GameObject obj in objectArray) { if (interactionType != InteractionTypes.None && obj.HasInteraction(interactionType)) { if (nearestObject == null) { nearestObject = obj; closestDistance = Vector2.Distance(location, obj.InteractionPoint); } else { tempDistance = Vector2.Distance(location, obj.InteractionPoint); if (tempDistance < closestDistance) { nearestObject = obj; closestDistance = tempDistance; } } } } if (closestDistance <= maxDistance) return nearestObject; else return null; } }
public override bool HasInteraction(InteractionTypes interactionType) { return false; }