本文整理汇总了C#中RoomItem.refreshItem方法的典型用法代码示例。如果您正苦于以下问题:C# RoomItem.refreshItem方法的具体用法?C# RoomItem.refreshItem怎么用?C# RoomItem.refreshItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RoomItem
的用法示例。
在下文中一共展示了RoomItem.refreshItem方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeliverRandomPinataItem
internal void DeliverRandomPinataItem(RoomUser User, Room Room, RoomItem Item)
{
if (Room == null || Item == null || Item.GetBaseItem().InteractionType != InteractionType.pinata || !this.Pinatas.ContainsKey(Item.GetBaseItem().ItemId))
{
return;
}
PinataItem pinataItem;
this.Pinatas.TryGetValue(Item.GetBaseItem().ItemId, out pinataItem);
if (pinataItem == null || pinataItem.Rewards.Count < 1)
{
return;
}
int getX = Item.GetX;
int getY = Item.GetY;
double getZ = Item.GetZ;
Thread.Sleep(900);
Item.refreshItem();
Item.BaseItem = pinataItem.Rewards[new Random().Next(checked(pinataItem.Rewards.Count - 1))];
Item.ExtraData = "";
Room.GetRoomItemHandler().RemoveFurniture(User.GetClient(), Item.Id, false);
using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
{
queryreactor.runFastQuery(string.Concat(new object[]
{
"UPDATE items SET base_item = '",
Item.BaseItem,
"', extra_data = '' WHERE id = ",
Item.Id
}));
queryreactor.runQuery();
}
Room.GetRoomItemHandler().SetFloorItem(Item, getX, getY, getZ, 0, false);
ServerMessage serverMessage = new ServerMessage(Outgoing.AddFloorItemMessageComposer);
Item.Serialize(serverMessage);
serverMessage.AppendString(Room.Owner);
Room.SendMessage(serverMessage);
Room.GetRoomItemHandler().SetFloorItem(User.GetClient(), Item, Item.GetX, Item.GetY, 0, true, false, true);
}
示例2: DeliverRandomPinataItem
internal void DeliverRandomPinataItem(RoomUser User, Room Room, RoomItem Item)
{
if (Room == null || Item == null || Item.GetBaseItem().InteractionType != InteractionType.pinata || !this.Pinatas.ContainsKey(Item.GetBaseItem().ItemId))
{
return;
}
PinataItem pinataItem;
this.Pinatas.TryGetValue(Item.GetBaseItem().ItemId, out pinataItem);
if (pinataItem == null || pinataItem.Rewards.Count < 1)
{
return;
}
int getX = Item.GetX;
int getY = Item.GetY;
double getZ = Item.GetZ;
Item.refreshItem();
Item.BaseItem = pinataItem.Rewards[new Random().Next(checked(pinataItem.Rewards.Count - 1))];
Item.ExtraData = "";
Room.GetRoomItemHandler().RemoveFurniture(User.GetClient(), Item.Id, false);
using (IQueryAdapter queryreactor = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
{
queryreactor.runFastQuery(string.Concat(new object[]
{
"UPDATE items SET base_item = '",
Item.BaseItem,
"', extra_data = '' WHERE id = ",
Item.Id
}));
queryreactor.runQuery();
}
//Room.GetRoomItemHandler().SetFloorItem(Item, getX, getY, getZ, 0, false);
if (!Room.GetRoomItemHandler().SetFloorItem(User.GetClient(), Item, Item.GetX, Item.GetY, 0, true, false, true))
{
User.GetClient().GetHabbo().GetInventoryComponent().AddItem(Item);
}
}
示例3: OpenPresent
/*
internal void OpenPresent()
{
Room Room = SilverwaveEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
if (Room == null || !Room.CheckRights(Session, true))
{
return;
}
uint ItemId = Request.PopWiredUInt();
RoomItem Present = Room.GetRoomItemHandler().GetItem(ItemId);
if (Present == null)
{
return;
}
if (SilverwaveEnvironment.GetDBConfig().DBData["gifts_enabled"] != "1")
{
Session.SendNotif("The hotel managers have disabled gifting");
return;
}
DataRow Data = null;
using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor())
{
dbClient.setQuery("SELECT base_id,amount,extra_data FROM user_presents WHERE item_id = " + Present.Id + "");
Data = dbClient.getRow();
}
if (Data == null)
{
Room.GetRoomItemHandler().RemoveFurniture(Session, Present.Id);
return;
}
Item BaseItem = SilverwaveEnvironment.GetGame().GetItemManager().GetItem(Convert.ToUInt32(Data["base_id"]));
if (BaseItem == null)
{
Room.GetRoomItemHandler().RemoveFurniture(Session, Present.Id);
return;
}
uint PurchaserId = (uint)int.Parse(Present.ExtraData.Split(';')[0]);
Habbo Purchaser = SilverwaveEnvironment.getHabboForId(PurchaserId);
Response.Init(Outgoing.UpdateFloorItemExtraData);
Response.AppendString(ItemId.ToString());
Response.AppendInt32(1);
Response.AppendInt32(6);
Response.AppendString("EXTRA_PARAM");
Response.AppendString("");
Response.AppendString("MESSAGE");
Response.AppendString(Present.ExtraData.Split(';')[1].Split((char)5)[0]);
Response.AppendString("PURCHASER_NAME");
Response.AppendString(Purchaser.Username);
Response.AppendString("PURCHASER_FIGURE");
Response.AppendString(Purchaser.Look);
Response.AppendString("PRODUCT_CODE");
Response.AppendString("A1 KUMIANKKA");
Response.AppendString("state");
Response.AppendString("1");
Room.SendMessage(Response);
Present.ReqUpdate(5, true);
Thread thread = new Thread(() => FinishOpenGift(BaseItem, Present, Room, Data));
thread.Start();
}*/
private void FinishOpenGift(Item BaseItem, RoomItem Present, Room Room, DataRow Data)
{
Thread.Sleep(3000);
try
{
if (BaseItem == null || Present == null || Room == null || Data == null)
return;
if (BaseItem.Type.ToString().ToLower().Equals("s") && BaseItem.InteractionType != InteractionType.teleport)
{
Room.GetRoomItemHandler().RemoveFurniture(Session, Present.Id);
using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor())
{
dbClient.runFastQuery("DELETE FROM items WHERE id=" + Present.Id + " LIMIT 1;");
dbClient.setQuery("UPDATE items SET extra_data = @Edata WHERE id = " + Present.Id + " LIMIT 1");
dbClient.addParameter("edata", Data["extra_data"]);
dbClient.runQuery();
dbClient.runFastQuery("DELETE FROM user_presents WHERE item_id = " + Present.Id + " LIMIT 1");
}
string type = Present.GetBaseItem().Type.ToString().ToLower();
string ExtraData = Present.ExtraData;
Present.BaseItem = Convert.ToUInt32(Data["base_id"]);
Present.refreshItem();
Present.ExtraData = "";
if ((int)Data["amount"] == 1)
{
if (!Room.GetRoomItemHandler().SetFloorItem(Session, Present, Present.GetX, Present.GetY, Present.Rot, true, false, true))
{
SilverwaveEnvironment.GetGame().GetCatalog().DeliverItems(Session, BaseItem, (int)Data["amount"], (String)Data["extra_data"], 0, 0);
Session.GetHabbo().GetInventoryComponent().UpdateItems(true);
//.........这里部分代码省略.........