本文整理汇总了C#中RoomItem.Serialize方法的典型用法代码示例。如果您正苦于以下问题:C# RoomItem.Serialize方法的具体用法?C# RoomItem.Serialize怎么用?C# RoomItem.Serialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RoomItem
的用法示例。
在下文中一共展示了RoomItem.Serialize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1:
void IFurniTrigger.OnTrigger(GameClient Session, RoomItem Item, int Request, bool UserHasRights)
{
if (UserHasRights && Item.GetRoom() != null)
{
string[] ExtradataSplat = Item.ExtraData.Split(Convert.ToChar(5));
if (ExtradataSplat.Length == 4)
{
if (ExtradataSplat[0] == "0")
Item.ExtraData = "1" + ExtradataSplat[1] + ExtradataSplat[2] + ExtradataSplat[3];
else
Item.ExtraData = "0" + ExtradataSplat[1] + ExtradataSplat[2] + ExtradataSplat[3];
ServerMessage Message = PacketHandelingManager.GetRecycledItem(OutputCode.ObjectUpdateMessageEvent);
Item.Serialize(Message);
Item.GetRoom().SendMessage(Message);
Item.UpdateState(true, false);
}
}
}
示例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;
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);
}
示例3: SetWallItem
/// <summary>
/// Sets the wall item.
/// </summary>
/// <param name="session">The session.</param>
/// <param name="item">The item.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
internal bool SetWallItem(GameClient session, RoomItem item)
{
if (!item.IsWallItem || WallItems.ContainsKey(item.Id))
return false;
if (FloorItems.ContainsKey(item.Id))
return true;
item.Interactor.OnPlace(session, item);
if (item.GetBaseItem().InteractionType == Interaction.Dimmer && _room.MoodlightData == null)
{
_room.MoodlightData = new MoodlightData(item.Id);
item.ExtraData = _room.MoodlightData.GenerateExtraData();
}
WallItems.TryAdd(item.Id, item);
AddOrUpdateItem(item.Id);
var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("AddWallItemMessageComposer"));
item.Serialize(serverMessage);
serverMessage.AppendString(_room.RoomData.Owner);
_room.SendMessage(serverMessage);
return true;
}
示例4: SetFloorItem
/// <summary>
/// Sets the floor item.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="newX">The new x.</param>
/// <param name="newY">The new y.</param>
/// <param name="newZ">The new z.</param>
/// <param name="rot">The rot.</param>
/// <param name="sendUpdate">if set to <c>true</c> [sendupdate].</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
internal bool SetFloorItem(RoomItem item, int newX, int newY, double newZ, int rot, bool sendUpdate)
{
_room.GetGameMap().RemoveFromMap(item);
item.SetState(newX, newY, newZ,
Gamemap.GetAffectedTiles(item.GetBaseItem().Length,
item.GetBaseItem().Width, newX, newY, rot));
if (item.GetBaseItem().InteractionType == Interaction.RoomBg && _room.TonerData == null)
_room.TonerData = new TonerData(item.Id);
AddOrUpdateItem(item.Id);
_room.GetGameMap().AddItemToMap(item);
if (!sendUpdate)
return true;
var message = new ServerMessage(LibraryParser.OutgoingRequest("UpdateRoomItemMessageComposer"));
item.Serialize(message);
_room.SendMessage(message);
return true;
}
示例5: PlaceBuildersWallItem
internal void PlaceBuildersWallItem()
{
/*var pageId = */
Request.GetInteger();
var itemId = Request.GetUInteger();
var extradata = Request.GetString();
var wallcoords = Request.GetString();
var actualRoom = Session.GetHabbo().CurrentRoom;
var item = AzureEmulator.GetGame().GetCatalog().GetItem(itemId);
if (actualRoom == null || item == null) return;
Session.GetHabbo().BuildersItemsUsed++;
BuildersClubUpdateFurniCount();
using (var adapter = AzureEmulator.GetDatabaseManager().GetQueryReactor())
{
adapter.SetQuery(
"INSERT INTO items_rooms (user_id,room_id,base_item,wall_pos,builders) VALUES (@userId,@roomId,@baseItem,@wallpos,'1')");
adapter.AddParameter("userId", Session.GetHabbo().Id);
adapter.AddParameter("roomId", actualRoom.RoomId);
adapter.AddParameter("baseItem", item.BaseId);
adapter.AddParameter("wallpos", wallcoords);
var insertId = (uint)adapter.InsertQuery();
var newItem = new RoomItem(insertId, actualRoom.RoomId, item.BaseId, extradata,
new WallCoordinate(wallcoords), actualRoom, Session.GetHabbo().Id, 0, item.GetFirstBaseItem().FlatId,
true);
actualRoom.GetRoomItemHandler().WallItems.TryAdd(newItem.Id, newItem);
var message = new ServerMessage(LibraryParser.OutgoingRequest("AddWallItemMessageComposer"));
newItem.Serialize(message);
message.AppendString(Session.GetHabbo().UserName);
Session.SendMessage(message);
actualRoom.GetGameMap().AddItemToMap(newItem);
}
}
示例6: PlaceBuildersFurniture
internal void PlaceBuildersFurniture()
{
Request.GetInteger();
var itemId = Convert.ToUInt32(Request.GetInteger());
var extradata = Request.GetString();
var x = Request.GetInteger();
var y = Request.GetInteger();
var dir = Request.GetInteger();
var actualRoom = Session.GetHabbo().CurrentRoom;
var item = AzureEmulator.GetGame().GetCatalog().GetItem(itemId);
if (actualRoom == null || item == null)
return;
Session.GetHabbo().BuildersItemsUsed++;
BuildersClubUpdateFurniCount();
var z = actualRoom.GetGameMap().SqAbsoluteHeight(x, y);
using (var adapter = AzureEmulator.GetDatabaseManager().GetQueryReactor())
{
adapter.SetQuery(
"INSERT INTO items_rooms (user_id,room_id,base_item,x,y,z,rot,builders) VALUES (@userId,@roomId,@baseItem,@x,@y,@z,@rot,'1')");
adapter.AddParameter("userId", Session.GetHabbo().Id);
adapter.AddParameter("roomId", actualRoom.RoomId);
adapter.AddParameter("baseItem", item.BaseId);
adapter.AddParameter("x", x);
adapter.AddParameter("y", y);
adapter.AddParameter("z", z);
adapter.AddParameter("rot", dir);
var insertId = (uint)adapter.InsertQuery();
var newItem = new RoomItem(insertId, actualRoom.RoomId, item.BaseId, extradata, x, y, z, dir, actualRoom,
Session.GetHabbo().Id, 0, item.GetFirstBaseItem().FlatId, "", true);
Session.GetHabbo().BuildersItemsUsed++;
actualRoom.GetRoomItemHandler().FloorItems.TryAdd(newItem.Id, newItem);
var message = new ServerMessage(LibraryParser.OutgoingRequest("AddFloorItemMessageComposer"));
newItem.Serialize(message);
message.AppendString(Session.GetHabbo().UserName);
actualRoom.SendMessage(message);
actualRoom.GetGameMap().AddItemToMap(newItem);
}
}
示例7: SetWallItem
internal bool SetWallItem(GameClient Session, RoomItem Item)
{
if (!Item.IsWallItem || mWallItems.ContainsKey(Item.Id))
return false;
if (mFloorItems.ContainsKey(Item.Id))
{
Session.SendNotif(LanguageLocale.GetValue("room.itemplaced"));
return true;
}
Item.Interactor.OnPlace(Session, Item);
if (Item.GetBaseItem().InteractionType == InteractionType.dimmer)
{
if (room.MoodlightData == null)
{
room.MoodlightData = new MoodlightData(Item.Id);
Item.ExtraData = room.MoodlightData.GenerateExtraData();
}
}
mWallItems.Add(Item.Id, Item);
AddItem(Item);
ServerMessage Message = new ServerMessage(83);
Item.Serialize(Message);
room.SendMessage(Message);
return true;
}
示例8: SetFloorItem
//.........这里部分代码省略.........
}
}
}
// Verify the rotation is correct
if (newRot != 0 && newRot != 2 && newRot != 4 && newRot != 6 && newRot != 8)
{
newRot = 0;
}
//Item.GetX = newX;
//Item.GetY = newY;
//Item.GetZ = newZ;
Item.Rot = newRot;
int oldX = Item.GetX;
int oldY = Item.GetY;
Item.SetState(newX, newY, newZ, AffectedTiles);
if (!OnRoller && Session != null)
Item.Interactor.OnPlace(Session, Item);
if (newItem)
{
if (mFloorItems.ContainsKey(Item.Id))
{
if (Session != null)
Session.SendNotif(LanguageLocale.GetValue("room.itemplaced"));
//Remove from map!!!
return true;
}
//using (DatabaseClient dbClient = PiciEnvironment.GetDatabase().GetClient())
//{
// dbClient.addParameter("extra_data", Item.ExtraData);
// dbClient.runFastQuery("INSERT INTO room_items (id,room_id,base_item,extra_data,x,y,z,rot,wall_pos) VALUES ('" + Item.Id + "','" + RoomId + "','" + Item.BaseItem + "',@extra_data,'" + Item.GetX + "','" + Item.GetY + "','" + Item.GetZ + "','" + Item.Rot + "','')");
//}
//if (mRemovedItems.ContainsKey(Item.Id))
// mRemovedItems.Remove(Item.Id);
//if (mAddedItems.ContainsKey(Item.Id))
// return false;
//mAddedItems.Add(Item.Id, Item);
if (Item.IsFloorItem && !mFloorItems.ContainsKey(Item.Id))
mFloorItems.Add(Item.Id, Item);
else if (Item.IsWallItem && !mWallItems.ContainsKey(Item.Id))
mWallItems.Add(Item.Id, Item);
AddItem(Item);
if (sendMessage)
{
ServerMessage Message = new ServerMessage(93);
Item.Serialize(Message);
room.SendMessage(Message);
}
}
else
{
//using (DatabaseClient dbClient = PiciEnvironment.GetDatabase().GetClient())
//{
// dbClient.runFastQuery("UPDATE room_items SET x = '" + Item.GetX + "', y = '" + Item.GetY + "', z = '" + Item.GetZ + "', rot = '" + Item.Rot + "', wall_pos = '' WHERE id = '" + Item.Id + "' LIMIT 1");
//}
UpdateItem(Item);
if (!OnRoller && sendMessage)
{
ServerMessage Message = new ServerMessage(95);
Item.Serialize(Message);
room.SendMessage(Message);
}
}
if (!newItem)
{
room.GetWiredHandler().RemoveWiredItem(new System.Drawing.Point(oldX, oldY));
if (WiredHandler.TypeIsWire(Item.GetBaseItem().InteractionType))
{
room.GetWiredHandler().AddWire(Item, new System.Drawing.Point(newX, newY), newRot, Item.GetBaseItem().InteractionType);
}
}
else
{
if (WiredHandler.TypeIsWire(Item.GetBaseItem().InteractionType))
{
room.GetWiredHandler().AddWire(Item, Item.Coordinate, newRot, Item.GetBaseItem().InteractionType);
}
}
//GenerateMaps(false);
room.GetGameMap().AddToMap(Item);
if (updateRoomUserStatuses)
room.GetRoomUserManager().UpdateUserStatusses();
return true;
}
示例9: PlaceBuildersFurniture
internal void PlaceBuildersFurniture()
{
Request.GetInteger();
uint itemId = Convert.ToUInt32(Request.GetInteger());
string extradata = Request.GetString();
int x = Request.GetInteger();
int y = Request.GetInteger();
int dir = Request.GetInteger();
Room actualRoom = Session.GetHabbo().CurrentRoom;
CatalogItem item = Yupi.GetGame().GetCatalog().GetItem(itemId);
if (actualRoom == null || item == null)
return;
Session.GetHabbo().BuildersItemsUsed++;
BuildersClubUpdateFurniCount();
double z = actualRoom.GetGameMap().SqAbsoluteHeight(x, y);
using (IQueryAdapter adapter = Yupi.GetDatabaseManager().GetQueryReactor())
{
adapter.SetQuery(
"INSERT INTO items_rooms (user_id,room_id,item_name,x,y,z,rot,builders) VALUES (@userId,@roomId,@itemName,@x,@y,@z,@rot,'1')");
adapter.AddParameter("userId", Session.GetHabbo().Id);
adapter.AddParameter("roomId", actualRoom.RoomId);
adapter.AddParameter("itemName", item.BaseName);
adapter.AddParameter("x", x);
adapter.AddParameter("y", y);
adapter.AddParameter("z", z);
adapter.AddParameter("rot", dir);
uint insertId = (uint) adapter.InsertQuery();
RoomItem newItem = new RoomItem(insertId, actualRoom.RoomId, item.BaseName, extradata, x, y, z, dir,
actualRoom, Session.GetHabbo().Id, 0, string.Empty, true);
Session.GetHabbo().BuildersItemsUsed++;
actualRoom.GetRoomItemHandler().FloorItems.TryAdd(newItem.Id, newItem);
ServerMessage message = new ServerMessage(LibraryParser.OutgoingRequest("AddFloorItemMessageComposer"));
newItem.Serialize(message);
message.AppendString(Session.GetHabbo().UserName);
actualRoom.SendMessage(message);
actualRoom.GetGameMap().AddItemToMap(newItem);
}
}
示例10: SetWallItem
internal bool SetWallItem(GameClient Session, RoomItem Item)
{
if (!Item.IsWallItem || this.mWallItems.ContainsKey(Item.Id))
{
return false;
}
if (this.mFloorItems.ContainsKey(Item.Id))
{
return true;
}
Item.Interactor.OnPlace(Session, Item);
if (Item.GetBaseItem().InteractionType == InteractionType.dimmer && this.room.MoodlightData == null)
{
this.room.MoodlightData = new MoodlightData(Item.Id);
Item.ExtraData = this.room.MoodlightData.GenerateExtraData();
}
this.mWallItems.Add(Item.Id, Item);
this.AddItem(Item);
ServerMessage serverMessage = new ServerMessage(Outgoing.AddWallItemMessageComposer);
Item.Serialize(serverMessage);
serverMessage.AppendString(this.room.Owner);
this.room.SendMessage(serverMessage);
return true;
}
示例11: SetFloorItem
internal bool SetFloorItem(RoomItem Item, int newX, int newY, double newZ, int rot, bool sendupdate)
{
this.room.GetGameMap().RemoveFromMap(Item);
Item.SetState(newX, newY, newZ, Gamemap.GetAffectedTiles(Item.GetBaseItem().InteractionType, Item.GetBaseItem().Length, Item.GetBaseItem().Width, newX, newY, rot));
if (Item.GetBaseItem().InteractionType == InteractionType.roombg && this.room.TonerData == null)
{
this.room.TonerData = new TonerData(Item.Id);
}
this.UpdateItem(Item);
this.room.GetGameMap().AddItemToMap(Item, true);
if (sendupdate)
{
ServerMessage message = new ServerMessage(Outgoing.UpdateRoomItemMessageComposer);
Item.Serialize(message);
this.room.SendMessage(message);
}
return true;
}
示例12: SetWallItem
internal bool SetWallItem(GameClient Session, RoomItem Item)
{
if (!Item.IsWallItem || mWallItems.ContainsKey(Item.Id))
return false;
if (mFloorItems.ContainsKey(Item.Id))
{
Session.SendNotif("Oeps! Er is iets mis gegaan, probeer het opnieuw!\r\r<b>Beschrijving:</b>\rJe hebt dit Meubi al eerder in je kamer geplaatst.");
return true;
}
Item.Interactor.OnPlace(Session, Item);
if (Item.GetBaseItem().InteractionType == InteractionType.dimmer)
{
if (room.MoodlightData == null)
{
room.MoodlightData = new MoodlightData(Item.Id);
Item.ExtraData = room.MoodlightData.GenerateExtraData();
}
}
mWallItems.Add(Item.Id, Item);
AddItem(Item);
ServerMessage Message = PacketHandelingManager.GetRecycledItem(OutputCode.ItemWallAddMessageEvent);
Item.Serialize(Message);
Message.AddString(room.Owner);
room.SendMessage(Message);
return true;
}
示例13: SetFloorItem
//.........这里部分代码省略.........
{
StacktitleZ = I.TotalHeight;
}
}
if (StacktitleZ != 99998)
newZ = StacktitleZ;
}
// Verify the rotation is valid
if (Item.GetBaseItem().InteractionType == InteractionType.mannequin)
{
if (newRot < 0 || newRot > 12)
newRot = 0;
}
else
{
if (newRot < 0 || newRot > 12 || newRot % 2 != 0)
newRot = 0;
}
//Item.GetX = newX;
//Item.GetY = newY;
//Item.GetZ = newZ;
Item.Rot = newRot;
int oldX = Item.GetX;
int oldY = Item.GetY;
Item.SetState(newX, newY, newZ, AffectedTiles);
if (!OnRoller && Session != null)
Item.Interactor.OnPlace(Session, Item);
if (newItem)
{
if (mFloorItems.ContainsKey(Item.Id))
{
if (Session != null)
Session.SendNotif("Oeps! Er is iets mis gegaan, probeer het opnieuw!\r\r<b>Beschrijving:</b>\rJe hebt dit Meubi al eerder in je kamer geplaatst.");
return true;
}
if (Item.IsFloorItem && !mFloorItems.ContainsKey(Item.Id))
mFloorItems.Add(Item.Id, Item);
else if (Item.IsWallItem && !mWallItems.ContainsKey(Item.Id))
mWallItems.Add(Item.Id, Item);
AddItem(Item);
if (sendMessage)
{
ServerMessage Message = PacketHandelingManager.GetRecycledItem(OutputCode.ObjectAddMessageEvent);
Item.Serialize(Message);
Message.AddString(room.Owner);
room.SendMessage(Message);
}
}
else
{
UpdateItem(Item);
if (!OnRoller && sendMessage)
{
ServerMessage Message = PacketHandelingManager.GetRecycledItem(OutputCode.ObjectUpdateMessageEvent);
Item.Serialize(Message);
room.SendMessage(Message);
}
}
if (Item.wiredCondition != null)
{
room.GetWiredHandler().conditionHandler.AddOrIgnoreRefferance(Item);
}
if (!newItem)
{
room.GetWiredHandler().RemoveWiredItem(new Point(oldX, oldY));
if (WiredHandler.TypeIsWire(Item.GetBaseItem().InteractionType))
{
room.GetWiredHandler().AddWire(Item, new Point(newX, newY), newRot, Item.GetBaseItem().InteractionType);
}
}
else
{
if (WiredHandler.TypeIsWire(Item.GetBaseItem().InteractionType))
{
room.GetWiredHandler().AddWire(Item, Item.Coordinate, newRot, Item.GetBaseItem().InteractionType);
}
}
//GenerateMaps(false);
room.GetGameMap().AddToMap(Item);
if (updateRoomUserStatuses)
room.GetRoomUserManager().UpdateUserStatusses();
return true;
}
示例14: DeveloperSetFloorItem
internal void DeveloperSetFloorItem(GameClient session, RoomItem item)
{
if (FloorItems.ContainsKey(item.Id)) return;
FloorItems.TryAdd(item.Id, item);
AddOrUpdateItem(item.Id);
var affectedTiles = Gamemap.GetAffectedTiles(item.GetBaseItem().Length, item.GetBaseItem().Width, item.X,
item.Y, item.Rot);
item.SetState(item.X, item.Y, item.Z, affectedTiles);
var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("AddFloorItemMessageComposer"));
item.Serialize(serverMessage);
serverMessage.AppendString(_room.RoomData.Group != null ? session.GetHabbo().UserName : _room.RoomData.Owner);
_room.SendMessage(serverMessage);
_room.GetGameMap().AddToMap(item);
}
示例15: PlaceItem
internal void PlaceItem()
{
// [email protected] 10 10 0
Room Room = FirewindEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
if (Room == null || !Room.CheckRights(Session))
{
return;
}
string PlacementData = Request.ReadString();
string[] DataBits = PlacementData.Split(' ');
uint ItemId = uint.Parse(DataBits[0].Replace("-",""));
UserItem Item = Session.GetHabbo().GetInventoryComponent().GetItem(ItemId);
if (Item == null)
{
return;
}
//bool UpdateNeeded = false;
switch (Item.GetBaseItem().InteractionType)
{
case Firewind.HabboHotel.Items.InteractionType.dimmer:
{
MoodlightData moodData = Room.MoodlightData;
if (moodData != null && Room.GetRoomItemHandler().GetItem(moodData.ItemId) != null)
Session.SendNotif(LanguageLocale.GetValue("user.maxmoodlightsreached"));
break;
}
}
// Wall Item
if (DataBits[1].StartsWith(":"))
{
try
{
WallCoordinate coordinate = new WallCoordinate(":" + PlacementData.Split(':')[1]);
RoomItem RoomItem = new RoomItem(Item.Id, Room.RoomId, Item.BaseItem, Item.Data, Item.Extra, coordinate, Room);
if (Room.GetRoomItemHandler().SetWallItem(Session, RoomItem))
{
Session.GetHabbo().GetInventoryComponent().RemoveItem(ItemId, true);
}
}
catch
{
// Invalid wallitem
/*
Response.Init(516);
Response.AppendInt32(11);
SendResponse();*/
return;
}
}
// Floor Item
else
{
int X = int.Parse(DataBits[1]);
int Y = int.Parse(DataBits[2]);
int Rot = int.Parse(DataBits[3]);
if (Session.GetHabbo().forceRot > -1)
Rot = Session.GetHabbo().forceRot;
RoomItem RoomItem = new RoomItem(Item.Id, Room.RoomId, Item.BaseItem, Item.Data, Item.Extra, X, Y, 0, Rot, Room);
if (Room.GetRoomItemHandler().SetFloorItem(Session, RoomItem, X, Y, Rot, true, false, true))
{
Session.GetHabbo().GetInventoryComponent().RemoveItem(ItemId, true);
}
else // Placing failed, tell client to put item back
{
Response.Init(Outgoing.ObjectUpdate);
RoomItem.Serialize(Response, Room.OwnerId);
SendResponse();
return;
}
if (WiredUtillity.TypeIsWired(Item.GetBaseItem().InteractionType))
{
WiredSaver.HandleDefaultSave(Item.Id, Room);
}
FirewindEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, HabboHotel.Quests.QuestType.FURNI_PLACE);
}
//if (UpdateNeeded)
// Room.SaveFurniture();
}