当前位置: 首页>>代码示例>>C#>>正文


C# Room.GetRoomItemHandler方法代码示例

本文整理汇总了C#中Yupi.Game.Rooms.Room.GetRoomItemHandler方法的典型用法代码示例。如果您正苦于以下问题:C# Room.GetRoomItemHandler方法的具体用法?C# Room.GetRoomItemHandler怎么用?C# Room.GetRoomItemHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Yupi.Game.Rooms.Room的用法示例。


在下文中一共展示了Room.GetRoomItemHandler方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeliverRandomPinataItem

        /// <summary>
        ///     Delivers the random pinata item.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="room">The room.</param>
        /// <param name="item">The item.</param>
        internal void DeliverRandomPinataItem(RoomUser user, Room room, RoomItem item)
        {
            if (room == null || item == null || item.GetBaseItem().InteractionType != Interaction.Pinata ||
                !Pinatas.ContainsKey(item.GetBaseItem().ItemId))
                return;

            PinataItem pinataItem;
            Pinatas.TryGetValue(item.GetBaseItem().ItemId, out pinataItem);

            if (pinataItem == null || pinataItem.Rewards.Count < 1)
                return;

            item.RefreshItem();

            //@TODO :: KESSILER, now PINATA DOESNT WORK. MUST CREATE SOLUTION LATER.

            //item.BaseName = pinataItem.Rewards[new Random().Next((pinataItem.Rewards.Count - 1))];

            item.ExtraData = string.Empty;
            room.GetRoomItemHandler().RemoveFurniture(user.GetClient(), item.Id, false);

            using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor())
                queryReactor.RunFastQuery(
                    $"UPDATE items_rooms SET item_name='{item.BaseName}', extra_data='' WHERE id='{item.Id}'");

            if (!room.GetRoomItemHandler().SetFloorItem(user.GetClient(), item, item.X, item.Y, 0, true, false, true))
                user.GetClient().GetHabbo().GetInventoryComponent().AddItem(item);
        }
开发者ID:ImNotSatan,项目名称:Yupi,代码行数:34,代码来源:PinataHandler.cs

示例2: IsTeleLinked

 /// <summary>
 ///     Determines whether [is tele linked] [the specified tele identifier].
 /// </summary>
 /// <param name="teleId">The tele identifier.</param>
 /// <param name="pRoom">The p room.</param>
 /// <returns><c>true</c> if [is tele linked] [the specified tele identifier]; otherwise, <c>false</c>.</returns>
 internal static bool IsTeleLinked(uint teleId, Room pRoom)
 {
     uint linkedTele = GetLinkedTele(teleId, pRoom);
     if (linkedTele == 0u)
         return false;
     RoomItem item = pRoom.GetRoomItemHandler().GetItem(linkedTele);
     return (item != null &&
             (item.GetBaseItem().InteractionType == Interaction.Teleport ||
              item.GetBaseItem().InteractionType == Interaction.QuickTeleport)) ||
            GetTeleRoomId(linkedTele, pRoom) != 0u;
 }
开发者ID:weslley17w,项目名称:Yupi,代码行数:17,代码来源:TeleHandler.cs

示例3: GetTeleRoomId

        /// <summary>
        ///     Gets the tele room identifier.
        /// </summary>
        /// <param name="teleId">The tele identifier.</param>
        /// <param name="pRoom">The p room.</param>
        /// <returns>System.UInt32.</returns>
        internal static uint GetTeleRoomId(uint teleId, Room pRoom)
        {
            if (pRoom.GetRoomItemHandler().GetItem(teleId) != null)
                return pRoom.RoomId;

            uint result;

            using (IQueryAdapter commitableQueryReactor = Yupi.GetDatabaseManager().GetQueryReactor())
            {
                commitableQueryReactor.SetQuery($"SELECT room_id FROM items_rooms WHERE id = {teleId} LIMIT 1");
                DataRow row = commitableQueryReactor.GetRow();

                result = row == null ? 0 : Convert.ToUInt32(row[0]);
            }

            return result;
        }
开发者ID:weslley17w,项目名称:Yupi,代码行数:23,代码来源:TeleHandler.cs

示例4: GetFurniItems

        private static List<RoomItem> GetFurniItems(ClientMessage request, Room room)
        {
            List<RoomItem> list = new List<RoomItem>();
            int itemCount = request.GetInteger();

            for (int i = 0; i < itemCount; i++)
            {
                RoomItem item = room.GetRoomItemHandler().GetItem(request.GetUInteger());

                if (item != null)
                    list.Add(item);
            }

            return list;
        }
开发者ID:weslley17w,项目名称:Yupi,代码行数:15,代码来源:WiredSaver.cs

示例5: PlantMonsterplant

        internal void PlantMonsterplant(RoomItem mopla, Room room)
        {
            int rarity = 0, internalRarity;

            if (room == null || mopla == null)
                return;

            if ((mopla.GetBaseItem().InteractionType != Interaction.Moplaseed) &&
                (mopla.GetBaseItem().InteractionType != Interaction.RareMoplaSeed))
                return;

            if (string.IsNullOrEmpty(mopla.ExtraData) || mopla.ExtraData == "0")
                rarity = 1;

            if (!string.IsNullOrEmpty(mopla.ExtraData) && mopla.ExtraData != "0")
                rarity = int.TryParse(mopla.ExtraData, out internalRarity) ? internalRarity : 1;

            int getX = mopla.X;
            int getY = mopla.Y;

            room.GetRoomItemHandler().RemoveFurniture(Session, mopla.Id, false);

            Pet pet = CatalogManager.CreatePet(Session.GetHabbo().Id, "Monsterplant", "pet_monster", "0", "0", rarity);

            Response.Init(LibraryParser.OutgoingRequest("SendMonsterplantIdMessageComposer"));
            Response.AppendInteger(pet.PetId);
            SendResponse();

            using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor())
                queryReactor.RunFastQuery(string.Concat("UPDATE pets_data SET room_id = '", room.RoomId, "', x = '", getX, "', y = '", getY, "' WHERE id = '", pet.PetId, "'"));

            pet.PlacedInRoom = true;
            pet.RoomId = room.RoomId;

            RoomBot bot = new RoomBot(pet.PetId, pet.OwnerId, pet.RoomId, AiType.Pet, "freeroam", pet.Name, "", pet.Look, getX, getY, 0.0, 4, null, null, "", 0, "");

            room.GetRoomUserManager().DeployBot(bot, pet);

            if (pet.DbState != DatabaseUpdateState.NeedsInsert)
                pet.DbState = DatabaseUpdateState.NeedsUpdate;

            using (IQueryAdapter queryreactor2 = Yupi.GetDatabaseManager().GetQueryReactor())
            {
                queryreactor2.RunFastQuery($"DELETE FROM items_rooms WHERE id = {mopla.Id}");
                room.GetRoomUserManager().SavePets(queryreactor2);
            }
        }
开发者ID:AngelRmz,项目名称:Yupi,代码行数:47,代码来源:Rooms.cs


注:本文中的Yupi.Game.Rooms.Room.GetRoomItemHandler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。