本文整理汇总了C#中RoomItem.RefreshItem方法的典型用法代码示例。如果您正苦于以下问题:C# RoomItem.RefreshItem方法的具体用法?C# RoomItem.RefreshItem怎么用?C# RoomItem.RefreshItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RoomItem
的用法示例。
在下文中一共展示了RoomItem.RefreshItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}