本文整理汇总了C#中Silverwave.Messages.ServerMessage.AppendString方法的典型用法代码示例。如果您正苦于以下问题:C# ServerMessage.AppendString方法的具体用法?C# ServerMessage.AppendString怎么用?C# ServerMessage.AppendString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Silverwave.Messages.ServerMessage
的用法示例。
在下文中一共展示了ServerMessage.AppendString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SerializeWall
internal void SerializeWall(ServerMessage Message, Boolean Inventory)
{
Message.AppendInt32(Id);
Message.AppendString(mBaseItem.Type.ToString().ToUpper());
Message.AppendInt32(Id);
Message.AppendInt32(GetBaseItem().SpriteId);
if (GetBaseItem().Name.Contains("a2"))
{
Message.AppendInt32(3);
}
else if (GetBaseItem().Name.Contains("wallpaper"))
{
Message.AppendInt32(2);
}
else if (GetBaseItem().Name.Contains("landscape"))
{
Message.AppendInt32(4);
}
else
{
Message.AppendInt32(1);
}
Message.AppendInt32(0);
Message.AppendString(ExtraData);
Message.AppendBoolean(GetBaseItem().AllowRecycle);
Message.AppendBoolean(GetBaseItem().AllowTrade);
Message.AppendBoolean(GetBaseItem().AllowInventoryStack);
Message.AppendBoolean(false);
Message.AppendInt32(-1);
Message.AppendBoolean(true);
Message.AppendInt32(-1);
}
示例2: Compose
internal static ServerMessage Compose(GameClient Session, List<Achievement> Achievements)
{
ServerMessage Message = new ServerMessage(Outgoing.AchievementList);
Message.AppendInt32(Achievements.Count);
foreach (Achievement Achievement in Achievements)
{
UserAchievement UserData = Session.GetHabbo().GetAchievementData(Achievement.GroupName);
int TargetLevel = (UserData != null ? UserData.Level + 1 : 1);
int TotalLevels = Achievement.Levels.Count;
if (TargetLevel > TotalLevels)
{
TargetLevel = TotalLevels;
}
AchievementLevel TargetLevelData = Achievement.Levels[TargetLevel];
Message.AppendInt32(Achievement.Id); // Unknown (ID?)
Message.AppendInt32(TargetLevel); // Target level
Message.AppendString(Achievement.GroupName + TargetLevel); // Target name/desc/badge
Message.AppendInt32(TargetLevelData.RewardPixels);
Message.AppendInt32(TargetLevelData.Requirement); // Progress req/target
Message.AppendInt32(TargetLevelData.RewardPoints);
Message.AppendInt32(0); // Type of reward
Message.AppendInt32(UserData != null ? UserData.Progress : 0); // Current progress
Message.AppendBoolean(UserData != null ? (UserData.Level >= TotalLevels) : false); // Set 100% completed(??)
Message.AppendString(Achievement.Category); // Category
Message.AppendString(String.Empty);
Message.AppendInt32(TotalLevels); // Total amount of levels
Message.AppendInt32(0);
}
Message.AppendString("");
return Message;
}
示例3: OnTrigger
public void OnTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool HasRights)
{
if (Session == null)
return;
RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
if (User == null)
{
return;
}
if (!((Math.Abs((int)(User.X - Item.GetX)) >= 2) || (Math.Abs((int)(User.Y - Item.GetY)) >= 2)))
{
User.SetRot(Rotation.Calculate(User.X, User.Y, Item.GetX, Item.GetY), false);
if (User.RotBody % 2 != 0)
{
User.MoveTo(Item.GetX + 1, Item.GetY);
return;
}
Room Room = Item.GetRoom();
Point NewPoint = new Point(0, 0);
if (User.RotBody == 4)
{ NewPoint = new Point(Item.GetX, Item.GetY + 1); }
if (User.RotBody == 0)
{ NewPoint = new Point(Item.GetX, Item.GetY - 1); }
if (User.RotBody == 6)
{ NewPoint = new Point(Item.GetX - 1, Item.GetY); }
if (User.RotBody == 2)
{ NewPoint = new Point(Item.GetX + 1, Item.GetY); }
if (Room.GetGameMap().ValidTile(NewPoint.X, NewPoint.Y) && Room.GetGameMap().itemCanBePlacedHere(NewPoint.X, NewPoint.Y) && Room.GetGameMap().CanRollItemHere(NewPoint.X, NewPoint.Y))
{
Double NewZ = Item.GetRoom().GetGameMap().SqAbsoluteHeight(NewPoint.X, NewPoint.Y);
ServerMessage mMessage = new ServerMessage();
mMessage.Init(Outgoing.ObjectOnRoller); // Cf
mMessage.AppendInt32(Item.GetX);
mMessage.AppendInt32(Item.GetY);
mMessage.AppendInt32(NewPoint.X);
mMessage.AppendInt32(NewPoint.Y);
mMessage.AppendInt32(1);
mMessage.AppendInt32(Item.Id);
mMessage.AppendString(Item.GetZ.ToString().Replace(',', '.'));
mMessage.AppendString(NewZ.ToString().Replace(',', '.'));
mMessage.AppendInt32(0);
Room.SendMessage(mMessage);
Item.GetRoom().GetRoomItemHandler().SetFloorItem(User.GetClient(), Item, NewPoint.X, NewPoint.Y, Item.Rot, false, false, false);
}
}
else
{
User.MoveTo(Item.GetX + 1, Item.GetY);
}
}
示例4: Serialize
internal void Serialize(ServerMessage Request)
{
// [email protected]22033860
Request.AppendInt32(FromUser);
Request.AppendString(mUsername);
Habbo user = SilverwaveEnvironment.getHabboForName(mUsername);
Request.AppendString((user != null) ? user.Look : "");
}
示例5: Searialize
internal void Searialize(ServerMessage reply)
{
reply.AppendInt32(userID);
reply.AppendString(username);
reply.AppendString(motto);
bool Online = (SilverwaveEnvironment.GetGame().GetClientManager().GetClient(userID) != null);
reply.AppendBoolean(Online);
reply.AppendBoolean(false);
reply.AppendString(string.Empty);
reply.AppendInt32(0);
reply.AppendString(look);
reply.AppendString(last_online);
}
示例6: Compose
public static ServerMessage Compose(List<SongData> Songs)
{
ServerMessage Message = new ServerMessage(Outgoing.ComposeSongs);
Message.AppendInt32(Songs.Count);
foreach (SongData Song in Songs)
{
Message.AppendInt32(Song.Id);
Message.AppendString("");
Message.AppendString(Song.Name);
Message.AppendString(Song.Data);
Message.AppendInt32(Song.LengthMiliseconds);
Message.AppendString(Song.Artist);
}
return Message;
}
示例7: DeliverInstantMessage
internal void DeliverInstantMessage(string message, uint convoID)
{
ServerMessage InstantMessage = new ServerMessage(Outgoing.InstantChat);
InstantMessage.AppendInt32(convoID);
InstantMessage.AppendString(message);
InstantMessage.AppendInt32(0);// + string.Empty);
GetClient().SendMessage(InstantMessage);
}
示例8: Compose
internal static ServerMessage Compose(Achievement Achievement, int Level, int PointReward, int PixelReward)
{
//2210:I,I,I,S,I,I,I,I,I,S,S,B
ServerMessage Message = new ServerMessage(Outgoing.UnlockAchievement);
Message.AppendInt32(Achievement.Id); // Achievement ID
Message.AppendInt32(Level); // Achieved level
Message.AppendInt32(144); // Unknown. Random useless number.
Message.AppendString(Achievement.GroupName + Level); // Achieved name
Message.AppendInt32(PointReward); // Point reward
Message.AppendInt32(PixelReward); // Pixel reward
Message.AppendInt32(0); // Unknown.
Message.AppendInt32(10); // Unknown.
Message.AppendInt32(21); // Unknown. (Extra reward?)
Message.AppendString(Level > 1 ? Achievement.GroupName + (Level - 1) : string.Empty);
Message.AppendString(Achievement.Category);
Message.AppendBoolean(true);
return Message;
}
示例9: Compose
internal static ServerMessage Compose(Achievement Achievement, int TargetLevel, AchievementLevel TargetLevelData,
int TotalLevels, UserAchievement UserData)
{
//I,I,S,I,I,I,I,I,B,S,S,I,I
ServerMessage Message = new ServerMessage(Outgoing.AchievementProgress);
Message.AppendInt32(Achievement.Id); // Unknown (ID?)
Message.AppendInt32(TargetLevel); // Target level
Message.AppendString(Achievement.GroupName + TargetLevel); // Target name/desc/badge
Message.AppendInt32(TargetLevelData.Requirement); // Progress req/target
Message.AppendInt32(TargetLevelData.Requirement); // Reward in Pixels
Message.AppendInt32(TargetLevelData.RewardPixels); // Reward Ach Score
Message.AppendInt32(0); // ?
Message.AppendInt32(UserData != null ? UserData.Progress : 0); // Current progress
Message.AppendBoolean(UserData != null ? (UserData.Level >= TotalLevels) : false); // Set 100% completed(??)
Message.AppendString(Achievement.Category); // Category
Message.AppendString(String.Empty);
Message.AppendInt32(TotalLevels); // Total amount of levels
Message.AppendInt32(0);
return Message;
}
示例10: Compose
internal static ServerMessage Compose(GameClient Session, Quest Quest)
{
// 518:S,I,I,I,I,B,S,S,I,S,I,I,I,S,S,B,B
int AmountInCat = SilverwaveEnvironment.GetGame().GetQuestManager().GetAmountOfQuestsInCategory(Quest.Category);
int Number = Quest == null ? AmountInCat : Quest.Number;
int UserProgress = Quest == null ? 0 : Session.GetHabbo().GetQuestProgress(Quest.Id);
ServerMessage Message = new ServerMessage(Outgoing.QuestCompletedCompser);
Message.AppendString(Quest.Category);
Message.AppendInt32(Number); // Quest progress in this cat
Message.AppendInt32((Quest.Name.Contains("xmas2012")) ? 1 : AmountInCat); // Total quests in this cat
Message.AppendInt32(Quest == null ? 3 : Quest.RewardType); // Reward type (1 = Snowflakes, 2 = Love hearts, 3 = Pixels, 4 = Seashells, everything else is pixels
Message.AppendInt32(Quest == null ? 0 : Quest.Id); // Quest id
Message.AppendBoolean(Quest == null ? false : Session.GetHabbo().CurrentQuestId == Quest.Id); // Quest started
Message.AppendString(Quest == null ? string.Empty : Quest.ActionName);
Message.AppendString(Quest == null ? string.Empty : Quest.DataBit);
Message.AppendInt32(Quest == null ? 0 : Quest.Reward);
Message.AppendString(Quest == null ? string.Empty : Quest.Name);
Message.AppendInt32(UserProgress); // Current progress
Message.AppendInt32(Quest == null ? 0 : Quest.GoalData); // Target progress
Message.AppendInt32(Quest == null ? 0 : Quest.TimeUnlock); // "Next quest available countdown" in seconds
Message.AppendString("");
Message.AppendString("");
Message.AppendBoolean(true); // ?
Message.AppendBoolean(true); // Activate next quest..
return Message;
}
示例11: SerializeFloor
internal void SerializeFloor(ServerMessage Message, Boolean Inventory)
{
int result = 0;
if (this.GetBaseItem().InteractionType == InteractionType.gift && ExtraData.Contains(Convert.ToChar(5).ToString()))
{
int color = int.Parse(ExtraData.Split((char)5)[1]);
int lazo = int.Parse(ExtraData.Split((char)5)[2]);
result = color * 1000 + lazo;
}
Message.AppendInt32(Id);
Message.AppendString(mBaseItem.Type.ToString().ToUpper());
Message.AppendInt32(Id);
Message.AppendInt32(GetBaseItem().SpriteId);
if (GetBaseItem().InteractionType == InteractionType.gld_item || this.GetBaseItem().InteractionType == InteractionType.gld_gate)
{
Group Group = SilverwaveEnvironment.GetGame().GetGroupManager().GetGroup(GroupId);
if (Group != null)
{
Message.AppendInt32(17);
Message.AppendInt32(2);
Message.AppendInt32(5);
Message.AppendString(ExtraData);
Message.AppendString(Group.Id.ToString());
Message.AppendString(Group.Badge);
Message.AppendString(SilverwaveEnvironment.GetGame().GetGroupManager().GetGroupColour(Group.Colour1, true)); // Group Colour 1
Message.AppendString(SilverwaveEnvironment.GetGame().GetGroupManager().GetGroupColour(Group.Colour2, false)); // Group Colour 2
}
else
{
Message.AppendInt32(1);
Message.AppendInt32(0);
Message.AppendString(ExtraData);
}
}
else
{
Message.AppendInt32(1);
Message.AppendInt32(0);
Message.AppendString(ExtraData);
}
Message.AppendBoolean(GetBaseItem().AllowRecycle);
Message.AppendBoolean(GetBaseItem().AllowTrade);
Message.AppendBoolean(GetBaseItem().AllowInventoryStack);
Message.AppendBoolean(false); // Marketplace
Message.AppendInt32(-1); //second to expiration
Message.AppendBoolean(true); //has rent period started
Message.AppendInt32(-1);
Message.AppendString("");
Message.AppendInt32(0);
}
示例12: SerializeEventListing
internal ServerMessage SerializeEventListing()
{
ServerMessage Message = new ServerMessage(Outgoing.NavigatorPacket);
Message.AppendInt32(16);
Message.AppendString("");
KeyValuePair<RoomData, int>[] eventRooms = SilverwaveEnvironment.GetGame().GetRoomManager().GetEventRooms();
Message.AppendInt32(eventRooms.Length);
foreach (KeyValuePair<RoomData, int> pair in eventRooms)
{
pair.Key.Serialize(Message, true);
}
return Message;
}
示例13: AllowAllRide
internal void AllowAllRide()
{
Room Room = SilverwaveEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
uint PetID = Request.PopWiredUInt();
RoomUser Pet = Room.GetRoomUserManager().GetPet(PetID);
if (Pet.PetData.AnyoneCanRide == 1)
{
using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor())
dbClient.runFastQuery("UPDATE bots_petdata SET anyone_ride=0 WHERE id=" + PetID + " LIMIT 1");
Pet.PetData.AnyoneCanRide = 0;
}
else
{
using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor())
dbClient.runFastQuery("UPDATE bots_petdata SET anyone_ride=1 WHERE id=" + PetID + " LIMIT 1");
Pet.PetData.AnyoneCanRide = 1;
}
ServerMessage Nfo = new ServerMessage(Outgoing.PetInformation);
Nfo.AppendInt32(Pet.PetData.PetId);
Nfo.AppendString(Pet.PetData.Name);
Nfo.AppendInt32(Pet.PetData.Level);
Nfo.AppendInt32(20);
Nfo.AppendInt32(Pet.PetData.experience);
Nfo.AppendInt32(Pet.PetData.experienceGoal);
Nfo.AppendInt32(Pet.PetData.Energy);
Nfo.AppendInt32(100);
Nfo.AppendInt32(Pet.PetData.Nutrition);
Nfo.AppendInt32(150);
//Nfo.AppendString(Color.ToLower());
Nfo.AppendInt32(Pet.PetData.Respect);
Nfo.AppendInt32(Pet.PetData.OwnerId);
Nfo.AppendInt32(Pet.PetData.Age);
Nfo.AppendString(Pet.PetData.OwnerName);
Nfo.AppendInt32(1);
Nfo.AppendBoolean(Pet.PetData.HaveSaddle);
Nfo.AppendBoolean(SilverwaveEnvironment.GetGame().GetRoomManager().GetRoom(Pet.PetData.RoomId).GetRoomUserManager().GetRoomUserByVirtualId(Pet.PetData.VirtualId).RidingHorse);
Nfo.AppendInt32(0);
Nfo.AppendInt32(Pet.PetData.AnyoneCanRide); // Anyone can ride horse
Nfo.AppendInt32(0);
Nfo.AppendInt32(0);
Nfo.AppendInt32(0);
Nfo.AppendInt32(0);
Nfo.AppendInt32(0);
Nfo.AppendInt32(0);
Nfo.AppendString("");
Nfo.AppendBoolean(false);
Nfo.AppendInt32(-1);
Nfo.AppendInt32(-1);
Nfo.AppendInt32(-1);
Nfo.AppendBoolean(false);
Room.SendMessage(Nfo);
}
示例14: MountOnPet
internal void MountOnPet()
{
Room Room = SilverwaveEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
//if (Room == null || Room.IsPublic || (!Room.AllowPets && !Room.CheckRights(Session, true)))
if (Room == null)
{
return;
}
RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
if (User == null)
return;
uint PetId = Request.PopWiredUInt();
bool Type = Request.PopWiredBoolean();
RoomUser Pet = Room.GetRoomUserManager().GetPet(PetId);
//if (Pet == null || Pet.PetData == null || Pet.PetData.OwnerId != Session.GetHabbo().Id)
if (Pet == null || Pet.PetData == null)
{
return;
}
if (Pet.PetData.AnyoneCanRide == 0 && Pet.PetData.OwnerId != User.userID)
{
Session.SendNotif("You are unable to ride this horse.\nThe owner of the pet has not selected for anyone to ride it.");
return;
}
if (Type)
{
if (Pet.RidingHorse == true)
{
string[] Speech2 = PetLocale.GetValue("pet.alreadymounted");
Random RandomSpeech2 = new Random();
Pet.Chat(null, Speech2[RandomSpeech2.Next(0, Speech2.Length - 1)], false, 0, 0);
}
else if (User.RidingHorse == true)
{
Session.SendNotif("You are already riding a horse!");
}
else
{
Pet.Statusses.Remove("sit");
Pet.Statusses.Remove("lay");
Pet.Statusses.Remove("snf");
Pet.Statusses.Remove("eat");
Pet.Statusses.Remove("ded");
Pet.Statusses.Remove("jmp");
int NewX2 = User.X;
int NewY2 = User.Y;
//Pet.PetData.Addexperience(10); // Give XP
Room.SendMessage(Room.GetRoomItemHandler().UpdateUserOnRoller(Pet, new Point(NewX2, NewY2), 0, Room.GetGameMap().SqAbsoluteHeight(NewX2, NewY2)));
Room.GetRoomUserManager().UpdateUserStatus(Pet, false);
Room.SendMessage(Room.GetRoomItemHandler().UpdateUserOnRoller(User, new Point(NewX2, NewY2), 0, Room.GetGameMap().SqAbsoluteHeight(NewX2, NewY2) + 1));
Room.GetRoomUserManager().UpdateUserStatus(User, false);
Pet.ClearMovement(true);
User.RidingHorse = true;
Pet.RidingHorse = true;
Pet.HorseID = (uint)User.VirtualId;
User.HorseID = Convert.ToUInt32(Pet.VirtualId);
User.ApplyEffect(77);
User.Z += 1;
User.UpdateNeeded = true;
Pet.UpdateNeeded = true;
}
}
else
{
if (User.VirtualId == Pet.HorseID)
{
Pet.Statusses.Remove("sit");
Pet.Statusses.Remove("lay");
Pet.Statusses.Remove("snf");
Pet.Statusses.Remove("eat");
Pet.Statusses.Remove("ded");
Pet.Statusses.Remove("jmp");
User.RidingHorse = false;
User.HorseID = 0;
Pet.RidingHorse = false;
Pet.HorseID = 0;
User.MoveTo(new Point(User.X + 2, User.Y + 2));
User.ApplyEffect(-1);
User.UpdateNeeded = true;
Pet.UpdateNeeded = true;
}
else
{
Session.SendNotif("Could not dismount this horse - You are not riding it!");
}
}
ServerMessage AddToPet = new ServerMessage(Outgoing.PetData);
AddToPet.AppendInt32(Pet.PetData.VirtualId);
AddToPet.AppendInt32(Pet.PetData.PetId);
AddToPet.AppendInt32(Pet.PetData.Type);
AddToPet.AppendInt32(int.Parse(Pet.PetData.Race));
AddToPet.AppendString(Pet.PetData.Color.ToLower());
AddToPet.AppendInt32(2);
//.........这里部分代码省略.........
示例15: OnRoomUserAdd
internal void OnRoomUserAdd()
{
if (Session == null || GetResponse() == null)
return;
QueuedServerMessage response = new QueuedServerMessage(Session.GetConnection());
List<RoomUser> UsersToDisplay = new List<RoomUser>();
if (CurrentLoadingRoom == null || CurrentLoadingRoom.GetRoomUserManager() == null || CurrentLoadingRoom.GetRoomUserManager().UserList == null)
return;
foreach (RoomUser User in CurrentLoadingRoom.GetRoomUserManager().UserList.Values)
{
if (User == null || User.IsSpectator)
continue;
UsersToDisplay.Add(User);
}
Response.Init(Outgoing.SetRoomUser);
Response.AppendInt32(UsersToDisplay.Count);
foreach (RoomUser User in UsersToDisplay)
{
User.Serialize(Response, CurrentLoadingRoom.GetGameMap().gotPublicPool);
}
response.appendResponse(GetResponse());
response.appendResponse(RoomFloorAndWallComposer(CurrentLoadingRoom));
response.appendResponse(GetResponse());
Response.Init(Outgoing.ValidRoom);
Response.AppendBoolean(true);
Response.AppendInt32(CurrentLoadingRoom.RoomId);
Response.AppendBoolean(CurrentLoadingRoom.CheckRights(Session, true));
response.appendResponse(GetResponse());
//DataTable Table;
//using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor())
//{
//dbClient.setQuery("SELECT user_id FROM room_rights WHERE room_id=" + CurrentLoadingRoom.RoomData.Id);
//Table = dbClient.getTable();
//}
/*GetResponse().Init(Outgoing.GetPowerList);
GetResponse().AppendUInt(CurrentLoadingRoom.RoomData.Id);
GetResponse().AppendInt32(Table.Rows.Count);
foreach (DataRow i in Table.Rows)
{
Habbo xUser = SilverwaveEnvironment.getHabboForId((uint)i[0]);
GetResponse().AppendUInt(xUser.Id);
GetResponse().AppendString(xUser.Username);
}
//response.appendResponse(GetResponse());*/
foreach (uint i in CurrentLoadingRoom.UsersWithRights)
{
Habbo xUser = SilverwaveEnvironment.getHabboForId(i);
if (xUser != null)
{
GetResponse().Init(Outgoing.GivePowers);
GetResponse().AppendInt32(CurrentLoadingRoom.RoomId);
GetResponse().AppendInt32(xUser.Id);
GetResponse().AppendString(xUser.Username);
response.appendResponse(GetResponse());
}
}
ServerMessage Updates = CurrentLoadingRoom.GetRoomUserManager().SerializeStatusUpdates(true);
if (Updates != null)
response.appendResponse(Updates);
if (CurrentLoadingRoom.Event != null)
{
SilverwaveEnvironment.GetGame().GetRoomEvents().SerializeEventInfo(CurrentLoadingRoom.RoomId);
}
foreach (RoomUser User in CurrentLoadingRoom.GetRoomUserManager().UserList.Values)
{
if (User == null || User.IsSpectator)
continue;
if (User.IsBot)
{
if (User.BotData.DanceId > 0)
{
Response.Init(Outgoing.Dance);
Response.AppendInt32(User.VirtualId);
Response.AppendInt32(User.BotData.DanceId);
response.appendResponse(GetResponse());
}
}
else
{
if (User.IsDancing)
{
Response.Init(Outgoing.Dance);
Response.AppendInt32(User.VirtualId);
//.........这里部分代码省略.........