本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}