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


C# RoomItem.GetBaseItem方法代码示例

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


在下文中一共展示了RoomItem.GetBaseItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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();
            item.BaseItem = pinataItem.Rewards[new Random().Next((pinataItem.Rewards.Count - 1))];

            item.ExtraData = string.Empty;
            room.GetRoomItemHandler().RemoveFurniture(user.GetClient(), item.Id, false);
            using (var queryReactor = AzureEmulator.GetDatabaseManager().GetQueryReactor())
            {
                queryReactor.RunFastQuery(string.Format("UPDATE items_rooms SET base_item='{0}', extra_data='' WHERE id='{1}'", item.BaseItem, item.Id));
                queryReactor.RunQuery();
            }

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

示例3: OnTrigger

        public void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights)
        {
            if (!hasRights)
                return;
            if (item == null || item.GetBaseItem() == null || item.GetBaseItem().InteractionType != Interaction.Gate)
                return;

            var modes = item.GetBaseItem().Modes - 1;
            if (modes <= 0)
                item.UpdateState(false, true);

            if (item.GetRoom() == null || item.GetRoom().GetGameMap() == null || item.GetRoom().GetGameMap().SquareHasUsers(item.X, item.Y))
                return;

            int currentMode;
            int.TryParse(item.ExtraData, out currentMode);
            int newMode;
            if (currentMode <= 0)
                newMode = 1;
            else if (currentMode >= modes)
                newMode = 0;
            else
                newMode = currentMode + 1;

            if (newMode == 0 && !item.GetRoom().GetGameMap().ItemCanBePlacedHere(item.X, item.Y))
                return;

            item.ExtraData = newMode.ToString();
            item.UpdateState();
            item.GetRoom().GetGameMap().UpdateMapForItem(item);
            item.GetRoom().GetWiredHandler().ExecuteWired(Interaction.TriggerStateChanged, item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id), item);
        }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:32,代码来源:InteractorGate.cs

示例4: GenerateMessage

        internal static ServerMessage GenerateMessage(RoomItem wiredItem)
        {
            ServerMessage message = PacketHandelingManager.GetRecycledItem(OutputCode.WiredFurniConditionEvent);
            InteractionType type = wiredItem.GetBaseItem().InteractionType;
            if (NeedsFurni(type))
            {
                message.AddBoolean(true);
                message.AddInt32(BaseWiredInteractor.MAX_FURNI_SELECTION);
                List<RoomItem> list;
                if (wiredItem.wiredCondition != null)
                {
                    list = wiredItem.wiredCondition.getAffectedItemList();
                }
                else
                {
                    list = new List<RoomItem>();
                }
                message.AddInt32(list.Count);
                foreach (RoomItem item2 in list)
                {
                    message.AddInt32((int)item2.Id);
                }
            }
            else
            {
                message.AddBoolean(false);
                message.AddInt32(0);
                message.AddInt32(0);
            }

            message.AddInt32(wiredItem.GetBaseItem().SpriteId);
            message.AddInt32((int)wiredItem.Id);
            message.AddString("");
            if (wiredItem.wiredCondition != null && NeedsSettings(type))
            {
                int max = 1;
                if(type == InteractionType.conditionhasfurnionfurni)
                {
                    message.AddInt32(1);
                }
                else
                {
                    message.AddInt32(3);
                    max = 3;
                }
                string[] settings = (wiredItem.wiredCondition as IWiredSettingsTrigger).GetSettings();
                for (int i = 0; i < max; i++)
                {
                    message.AddInt32(settings[i].ToLower() == "true" ? 1 : 0);
                }
            }
            else
            {
                message.AddInt32(0);
            }
            message.AddInt32(0); // does nothing, seriously
            message.AddInt32(GetDialogtype(type));
            return (message);
        }
开发者ID:BjkGkh,项目名称:R106,代码行数:59,代码来源:ConditionPacketBuilder.cs

示例5: DoTrigger

        protected override void DoTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool UserHasRights)
        {
            ServerMessage message = PacketHandelingManager.GetRecycledItem(OutputCode.WiredFurniActionEvent);

            if (Item.wiredHandler != null)
            {
                MoveRotate handler = (MoveRotate)Item.wiredHandler;
                message.AddBoolean(false);
                message.AddInt32(MAX_FURNI_SELECTION);

                message.AddInt32(handler.items.Count);
                foreach (RoomItem item in handler.items)
                {
                    message.AddInt32((int)item.Id);
                }

                message.AddInt32(Item.GetBaseItem().SpriteId);
                message.AddUInt32(Item.Id);

                message.AddString(string.Empty);
                message.AddInt32(2);
                message.AddInt32((int)handler.movement);
                message.AddInt32((int)handler.rotation);
                message.AddInt32(0);
                message.AddInt32(4);
                message.AddInt32(handler.delay);
                message.AddInt32(0);
                message.AddString(string.Empty);
            }
            else
            {
                message.AddBoolean(false);
                message.AddInt32(MAX_FURNI_SELECTION);
                message.AddInt32(0);
                message.AddInt32(Item.GetBaseItem().SpriteId);
                message.AddUInt32(Item.Id);

                message.AddString(string.Empty);
                message.AddInt32(2);
                message.AddInt32(0);
                message.AddInt32(0);
                message.AddInt32(0);
                message.AddInt32(4);
                message.AddInt32(0);
                message.AddInt32(0);
                message.AddString(string.Empty);
            }

            Session.SendMessage(message);
                        
        }
开发者ID:BjkGkh,项目名称:R106,代码行数:51,代码来源:MoveOrRotateWired.cs

示例6: OnTrigger

		public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights)
		{
			checked
			{
				int num = Item.GetBaseItem().Modes - 1;
				if (Session == null || !HasRights || num <= 0 || Item.GetBaseItem().InteractionType == InteractionType.pinata)
				{
					return;
				}
				CyberEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.FURNI_SWITCH, 0u);
				int num2 = 0;
				int.TryParse(Item.ExtraData, out num2);
				int num3;
				if (num2 <= 0)
				{
					num3 = 1;
				}
				else
				{
					if (num2 >= num)
					{
						num3 = 0;
					}
					else
					{
						num3 = num2 + 1;
					}
				}
				Item.ExtraData = num3.ToString();
				Item.UpdateState();
				Item.GetRoom().GetWiredHandler().ExecuteWired(WiredItemType.TriggerToggleFurni, new object[]
				{
					Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id),
					Item
				});
				if (Item.GetBaseItem().StackMultipler)
				{
					Room room = Item.GetRoom();
					foreach (RoomUser current in room.GetRoomUserManager().UserList.Values)
					{
						if (current.Statusses.ContainsKey("sit"))
						{
							room.GetRoomUserManager().UpdateUserStatus(current, true);
						}
					}
				}
			}
		}
开发者ID:kessiler,项目名称:habboServer,代码行数:48,代码来源:InteractorGenericSwitch.cs

示例7: OnTrigger

 public override void OnTrigger(GameClient Session, RoomItem RoomItem_0, int int_0, bool bool_0)
 {
     if (bool_0)
     {
         ServerMessage Message = new ServerMessage(Outgoing.WiredCondition); // Updated
         Message.AppendBoolean(false);
         if (Session.GetHabbo().HasFuse("wired_unlimitedselects"))
             Message.AppendInt32(1000000);
         else
             Message.AppendInt32(5);
         Message.AppendInt32(0);
         Message.AppendInt32(RoomItem_0.GetBaseItem().Sprite);
         Message.AppendUInt(RoomItem_0.uint_0);
         Message.AppendInt32(0);
         Message.AppendInt32(0);
         Message.AppendInt32(0);
         Message.AppendInt32(0);
         Message.AppendInt32(0);
         Message.AppendInt32(0);
         Message.AppendInt32(0);
         Message.AppendInt32(0);
         Message.AppendInt32(0);
         Session.SendMessage(Message);
     }
 }
开发者ID:RootkitR,项目名称:Essential-5.1,代码行数:25,代码来源:InteractorWiredConditionTimeMoreOrLess.cs

示例8: DoTrigger

        protected override void DoTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool UserHasRights)
        {
            ServerMessage message = PacketHandelingManager.GetRecycledItem(OutputCode.WiredFurniTriggerEvent);
            message.AddBoolean(false);
            message.AddInt32(0);
            message.AddInt32(0);
            message.AddInt32(Item.GetBaseItem().SpriteId);
            message.AddUInt32(Item.Id);

            if (Item.wiredHandler != null)
            {
                EntersRoom handler = (EntersRoom)Item.wiredHandler;

                if (!string.IsNullOrEmpty(handler.userName))
                    message.AddString(handler.userName);
                else
                    message.AddString(string.Empty);
            }
            else
            {
                message.AddString(string.Empty);
            }

            message.AddInt32(0);
            message.AddInt32(0);
            message.AddInt32(7);
            message.AddInt32(0);
            message.AddString(string.Empty);

            Session.SendMessage(message);
                        
        }
开发者ID:BjkGkh,项目名称:R106,代码行数:32,代码来源:RoomEnterTriggerWired.cs

示例9: if

        void IFurniTrigger.OnTrigger(GameClient Session, RoomItem Item, int Request, bool UserHasRights)
        {
            RoomUser User = null;
            if (Session != null)
                User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
            if (User == null)
                return;

            if (!Gamemap.TilesTouching(Item.GetX, Item.GetY, User.X, User.Y))
            {
                return;
            }

            int Modes = (Item.GetBaseItem().Modes - 1);

            if (Modes < 0)
            {
                Modes = 0;
            }

            if (Session != null)
                ButterflyEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, HabboHotel.Quests.QuestType.FURNI_SWITCH);
            if (!UserHasRights)
            {
                return;
            }

            if (Modes == 0)
            {
                return;
            }

            int currentMode = 0;
            int newMode = 0;

            try
            {
                currentMode = int.Parse(Item.ExtraData);
            }
            catch // (Exception e)
            {
                //Logging.HandleException(e, "InteractorGenericSwitch.OnTrigger");
            }

            if (currentMode <= 0)
            {
                newMode = 1;
            }
            else if (currentMode >= Modes)
            {
                newMode = 0;
            }
            else
            {
                newMode = currentMode + 1;
            }

            Item.ExtraData = newMode.ToString();
            Item.UpdateState();
        }
开发者ID:BjkGkh,项目名称:R106,代码行数:60,代码来源:GenericStandNextToTriggerWithModes.cs

示例10:

        void IFurniTrigger.OnTrigger(GameClient Session, RoomItem Item, int Request, bool UserHasRights)
        {
            if (Item.ExtraData != "1" && Item.GetBaseItem().VendingIds.Count >= 1 && Item.InteractingUser == 0 && Session != null)
            {
                RoomUser user = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
                if (user == null)
                    return;

                if (!Gamemap.TilesTouching(user.X, user.Y, Item.GetX, Item.GetY))
                {
                    user.MoveTo(Item.SquareInFront);
                    return;
                }

                Item.InteractingUser = Session.GetHabbo().Id;

                //user.ClearMovement(true);
                user.SetRot(Rotation.Calculate(user.X, user.Y, Item.GetX, Item.GetY), false);

                Item.ReqUpdate(2, true);

                Item.ExtraData = "1";
                Item.UpdateState(false, true);
            }
        }
开发者ID:BjkGkh,项目名称:R106,代码行数:25,代码来源:VendingTrigger.cs

示例11: OnTrigger

        public override void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights)
        {
            RoomUser roomUser = null;

            if (session != null)
                roomUser = item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id);

            if (roomUser == null)
                return;

            if (Gamemap.TilesTouching(item.X, item.Y, roomUser.X, roomUser.Y))
            {
                var num = item.GetBaseItem().Modes - 1;
                int num2, num3;
                int.TryParse(item.ExtraData, out num2);

                if (num2 <= 0)
                    num3 = 1;
                else
                {
                    if (num2 >= num)
                        num3 = 0;
                    else
                        num3 = num2 + 1;
                }

                item.ExtraData = num3.ToString();
                item.UpdateState();
                item.GetRoom().GetWiredHandler().ExecuteWired(Interaction.TriggerStateChanged, roomUser, item);

                return;
            }

            roomUser.MoveTo(item.SquareInFront);
        }
开发者ID:kessiler,项目名称:azureEmulator,代码行数:35,代码来源:InteractorSwitch.cs

示例12: DoTrigger

        protected override void DoTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool UserHasRights)
        {
            ServerMessage message = PacketHandelingManager.GetRecycledItem(OutputCode.WiredFurniTriggerEvent);
            message.AddBoolean(false);
            message.AddInt32(5);
            message.AddInt32(0);
            message.AddInt32(Item.GetBaseItem().SpriteId);
            message.AddUInt32(Item.Id);

            message.AddString(string.Empty);
            message.AddInt32(1);

            if (Item.wiredHandler != null)
            {
                ScoreAchieved handler = (ScoreAchieved)Item.wiredHandler;
                message.AddInt32(handler.scoreLevel);
            }
            else
            {
                message.AddInt32(0);
            }

            message.AddInt32(0);
            message.AddInt32(10);
            message.AddInt32(0);
            message.AddString(string.Empty);

            Session.SendMessage(message);
                        
        }
开发者ID:BjkGkh,项目名称:R106,代码行数:30,代码来源:ScoreAchievedTriggerWired.cs

示例13: OnTrigger

 public override void OnTrigger(GameClient Session, RoomItem Item, int Request, bool UserHasRights)
 {
     if (UserHasRights && Session != null)
     {
         Item.method_9();
         ServerMessage Message = new ServerMessage(652u);
         Message.AppendInt32(0);
         Message.AppendInt32(5);
         if (Item.string_5.Length > 0)
         {
             Message.AppendString(Item.string_5);
         }
         else
         {
             Message.AppendInt32(0);
         }
         Message.AppendInt32(Item.GetBaseItem().Sprite);
         Message.AppendUInt(Item.uint_0);
         Message.AppendStringWithBreak("");
         Message.AppendString("J");
         if (Item.string_3.Length > 0)
         {
             Message.AppendString(Item.string_3);
         }
         else
         {
             Message.AppendString("HHH");
         }
         Session.SendMessage(Message);
     }
 }
开发者ID:ArneVanDaele,项目名称:GoldenTreeEMU,代码行数:31,代码来源:InteractorWiredConditionFurniStatesAndPositionsMatch.cs

示例14: DoTrigger

        protected override void DoTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool UserHasRights)
        {
            ServerMessage message = PacketHandelingManager.GetRecycledItem(OutputCode.WiredFurniActionEvent);
            message.AddBoolean(false);
            message.AddInt32(0);
            message.AddInt32(0);
            message.AddInt32(Item.GetBaseItem().SpriteId);
            message.AddUInt32(Item.Id);

            message.AddString(string.Empty);
            message.AddInt32(2);

            if (Item.wiredHandler != null)
            {
                GiveScore handler = (GiveScore)Item.wiredHandler;
                message.AddInt32(handler.scoreToGive);
                message.AddInt32(handler.maxCountPerGame);
            }
            else
            {
                message.AddInt32(0); //Points 
                message.AddInt32(0); //Rounds
            }

            message.AddInt32(0);
            message.AddInt32(6);
            message.AddInt32(0);
            message.AddInt32(0);
            message.AddString(string.Empty);

            Session.SendMessage(message);
                        
        }
开发者ID:BjkGkh,项目名称:R106,代码行数:33,代码来源:ActionGiveScoreWired.cs

示例15: GetServerMessage

 internal ServerMessage GetServerMessage(ServerMessage message, RoomItem item)
 {
     var cracks = 0;
     var cracks_max = MaxCracks(item.GetBaseItem().Name);
     if (AzureEmulator.IsNum(item.ExtraData))
         cracks = Convert.ToInt16(item.ExtraData);
     var state = "0";
     if (cracks >= cracks_max)
         state = "14";
     else if (cracks >= cracks_max * 6 / 7)
         state = "12";
     else if (cracks >= cracks_max * 5 / 7)
         state = "10";
     else if (cracks >= cracks_max * 4 / 7)
         state = "8";
     else if (cracks >= cracks_max * 3 / 7)
         state = "6";
     else if (cracks >= cracks_max * 2 / 7)
         state = "4";
     else if (cracks >= cracks_max * 1 / 7)
         state = "2";
     message.AppendInteger(7);
     message.AppendString(state); //state (0-7)
     message.AppendInteger(cracks); //actual
     message.AppendInteger(cracks_max); //max
     return message;
 }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:27,代码来源:CrackableEggHandler.cs


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