本文整理汇总了C#中ServerMessage.Init方法的典型用法代码示例。如果您正苦于以下问题:C# ServerMessage.Init方法的具体用法?C# ServerMessage.Init怎么用?C# ServerMessage.Init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ServerMessage
的用法示例。
在下文中一共展示了ServerMessage.Init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadClubGifts
/// <summary>
/// Loads the club gifts.
/// </summary>
internal void LoadClubGifts()
{
if (Session?.GetHabbo() == null)
return;
Session.GetHabbo().GetSubscriptionManager().GetSubscription();
ServerMessage serverMessage = new ServerMessage();
serverMessage.Init(LibraryParser.OutgoingRequest("LoadCatalogClubGiftsMessageComposer"));
serverMessage.AppendInteger(0); // i
serverMessage.AppendInteger(0); // i2
serverMessage.AppendInteger(1);
}
示例2: MoveBall
internal void MoveBall(RoomItem item, GameClient mover, int newX, int newY)
{
if (item == null || mover == null)
return;
if (!room.GetGameMap().itemCanBePlacedHere(newX, newY))
return;
Point oldRoomCoord = item.Coordinate;
bool itemIsOnGameItem = GameItemOverlaps(item);
Double NewZ = room.GetGameMap().Model.SqFloorHeight[newX, newY];
ServerMessage Message = new ServerMessage(95);
Message.AppendUInt(item.Id);
Message.AppendUInt(3508);
Message.AppendInt32(item.Coordinate.X);
Message.AppendInt32(item.Coordinate.Y);
Message.AppendInt32(newX);
Message.AppendInt32(newY);
Message.AppendUInt(4);
Message.AppendStringWithBreak(NewZ.ToString());
Message.AppendStringWithBreak("H11");
Message.AppendInt32(-1);
Message.AppendInt32(0);
room.SendMessage(Message);
ServerMessage mMessage = new ServerMessage();
mMessage.Init(230); // Cf
mMessage.AppendInt32(item.Coordinate.X);
mMessage.AppendInt32(item.Coordinate.Y);
mMessage.AppendInt32(newX);
mMessage.AppendInt32(newY);
mMessage.AppendInt32(1);
mMessage.AppendUInt(item.Id);
mMessage.AppendStringWithBreak(item.GetZ.ToString().Replace(',', '.'));
mMessage.AppendStringWithBreak(NewZ.ToString().Replace(',', '.'));
mMessage.AppendUInt(0);
room.SendMessage(mMessage);
if (oldRoomCoord.X == newX && oldRoomCoord.Y == newY)
return;
room.GetRoomItemHandler().SetFloorItem(mover, item, newX, newY, item.Rot, false, false, false, false);
if (!itemIsOnGameItem)
HandleFootballGameItems(new Point(newX, newY), room.GetRoomUserManager().GetRoomUserByHabbo(mover.GetHabbo().Id));
}
示例3: Handle
public bool Handle(RoomUser user, Team team, RoomItem item)
{
if (user != null && !user.IsBot && user.GetClient() != null)
{
ServerMessage servermsg = new ServerMessage();
servermsg.Init(25);
servermsg.AppendInt32(user.VirtualId);
servermsg.AppendStringWithBreak(message);
servermsg.AppendBoolean(false);
user.GetClient().SendMessage(servermsg);
handler.OnEvent(itemID);
return true;
}
return false;
}
示例4: Handle
public bool Handle(RoomUser user, Team team, RoomItem item)
{
if (user != null && !user.IsBot && user.GetClient() != null && !string.IsNullOrWhiteSpace(message))
{
ServerMessage servermsg = new ServerMessage();
servermsg.Init(Outgoing.Whisp);
servermsg.AppendInt32(user.VirtualId);
servermsg.AppendString(message);
servermsg.AppendInt32(0);
servermsg.AppendInt32(0);
servermsg.AppendInt32(0);
servermsg.AppendInt32(-1);
user.GetClient().SendMessage(servermsg);
handler.OnEvent(itemID);
return true;
}
return false;
}
示例5: INFORETRIEVE
public void INFORETRIEVE()
{
string username = NewSocket.split[2];
string password = NewSocket.split[3];
using (DatabaseClient dbClient = Program.Manager.GetClient())
{
dbClient.AddParamWithValue("username", username);
dbClient.AddParamWithValue("password", password);
try
{
string checkdata = dbClient.ReadString("SELECT * FROM users WHERE username = @username AND password = @password");
if (checkdata != null)
{
DataRow dbRow = dbClient.ReadDataRow("SELECT * FROM users WHERE username = @username;");
Username = (String)dbRow["username"];
ServerMessage fuseMessage = new ServerMessage();
fuseMessage.Init("USEROBJECT");
fuseMessage.AppendString("name=" + (String)dbRow["username"]);
fuseMessage.AppendString("figure=" + (String)dbRow["figure"]);
fuseMessage.AppendString("birthday=" + (String)dbRow["dob"]);
fuseMessage.AppendString("phonenumber=");
fuseMessage.AppendString("customData=" + (String)dbRow["motto"]);
fuseMessage.AppendString("had_read_agreement=1");
fuseMessage.AppendString("sex=" + (String)dbRow["gender"]);
fuseMessage.AppendString("country=nl");
fuseMessage.AppendString("has_special_rights=0");
fuseMessage.AppendString("badge_type=1");
NewSocket.SendData(clientStream, fuseMessage);
}
else
{
}
}
catch
{
}
}
}
示例6: Whisper
internal void Whisper()
{
if (ButterflyEnvironment.SystemMute)
return;
if (Session == null || Session.GetHabbo() == null)
return;
Room Room = Session.GetHabbo().CurrentRoom;
if (Room == null)
{
return;
}
if (Session.GetHabbo().Muted)
{
Session.SendNotif(LanguageLocale.GetValue("user.ismuted"));
return;
}
if (Room.RoomMuted)
return;
string Params = ButterflyEnvironment.FilterInjectionChars(Request.PopFixedString());
string ToUser = Params.Split(' ')[0];
string Message = Params.Substring(ToUser.Length + 1);
Message = LanguageLocale.FilterSwearwords(Message);
RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
RoomUser User2 = Room.GetRoomUserManager().GetRoomUserByHabbo(ToUser);
ServerMessage TellMsg = new ServerMessage();
TellMsg.Init(25);
TellMsg.AppendInt32(User.VirtualId);
TellMsg.AppendStringWithBreak(Message);
TellMsg.AppendBoolean(false);
if (User != null && !User.IsBot)
{
User.GetClient().SendMessage(TellMsg);
}
User.Unidle();
if (User2 != null && !User2.IsBot)
{
if (!User2.GetClient().GetHabbo().MutedUsers.Contains(Session.GetHabbo().Id))
User2.GetClient().SendMessage(TellMsg);
}
TimeSpan SinceLastMessage = DateTime.Now - FloodTime;
if (SinceLastMessage.Seconds > 4)
FloodCount = 0;
if (SinceLastMessage.Seconds < 4 && FloodCount > 5 && Session.GetHabbo().Rank < 5)
{
ServerMessage Packet = new ServerMessage(27);
Packet.AppendInt32(30); //Blocked for 30sec
User.GetClient().SendMessage(Packet);
return;
}
FloodTime = DateTime.Now;
FloodCount++;
List<RoomUser> ToNotify = Room.GetRoomUserManager().GetRoomUserByRank(4);
if (ToNotify.Count > 0)
{
ServerMessage NotifyMessage = new ServerMessage();
NotifyMessage.Init(25);
NotifyMessage.AppendInt32(User.VirtualId);
NotifyMessage.AppendStringWithBreak(LanguageLocale.GetValue("moderation.whisper") + ToUser + ": " + Message);
NotifyMessage.AppendBoolean(false);
foreach (RoomUser user in ToNotify)
if (user != null)
if (user.HabboId != User2.HabboId && user.HabboId != User.HabboId)
if (user.GetClient() != null)
user.GetClient().SendMessage(NotifyMessage);
}
}
示例7: GetTVPlayer
internal void GetTVPlayer()
{
var itemId = Request.GetUInteger();
var item = Session.GetHabbo().CurrentRoom.GetRoomItemHandler().GetItem(itemId);
if (item == null) return;
var videos = Session.GetHabbo().GetYoutubeManager().Videos;
if (videos == null) return;
var serverMessage = new ServerMessage();
serverMessage.Init(LibraryParser.OutgoingRequest("YouTubeLoadVideoMessageComposer"));
serverMessage.AppendInteger(itemId);
serverMessage.AppendString(item.ExtraData);
serverMessage.AppendInteger(0);
serverMessage.AppendInteger(0);// duration
serverMessage.AppendInteger(0);
Response = serverMessage;
SendResponse();
var serverMessage2 = new ServerMessage();
serverMessage2.Init(LibraryParser.OutgoingRequest("YouTubeLoadPlaylistsMessageComposer"));
serverMessage2.AppendInteger(itemId);
serverMessage2.AppendInteger(videos.Count);
foreach (var video in videos.Values)
video.Serialize(serverMessage2);
serverMessage2.AppendString(item.ExtraData);
Response = serverMessage2;
SendResponse();
}
示例8: tryLogin
internal bool tryLogin(string AuthTicket)
{
try
{
string ip = GetConnection().getIp();
byte errorCode = 0;
UserData userData = UserDataFactory.GetUserData(AuthTicket, ip, out errorCode);
if (errorCode == 1)
{
SendNotifWithScroll(LanguageLocale.GetValue("login.invalidsso"));
return false;
}
else if (errorCode == 2)
{
SendNotifWithScroll(LanguageLocale.GetValue("login.loggedin"));
return false;
}
if (Program.LicHandeler != null && ButterflyEnvironment.GetGame().GetClientManager().ClientCount > Program.LicHandeler.AmountOfSlots)
{
Program.LicHandeler.ReportFullServer();
SendBanMessage(LanguageLocale.GetValue("server.full"));
return false;
}
ButterflyEnvironment.GetGame().GetClientManager().RegisterClient(this, userData.userID, userData.user.Username);
this.Habbo = userData.user;
userData.user.LoadData(userData);
if (userData.user.Username == null)
{
SendBanMessage("You have no username.");
return false;
}
string banReason = ButterflyEnvironment.GetGame().GetBanManager().GetBanReason(userData.user.Username, ip);
if (!string.IsNullOrEmpty(banReason))
{
SendBanMessage(banReason);
return false;
}
userData.user.Init(this, userData);
QueuedServerMessage response = new QueuedServerMessage(Connection);
userData.user.SerializeQuests(ref response);
List<string> Rights = ButterflyEnvironment.GetGame().GetRoleManager().GetRightsForHabbo(userData.user);
ServerMessage appendingResponse = new ServerMessage(2);
appendingResponse.Init(2);
appendingResponse.AppendInt32(Rights.Count);
foreach (string Right in Rights)
{
appendingResponse.AppendStringWithBreak(Right);
}
response.appendResponse(appendingResponse);
if (userData.user.HasFuse("fuse_mod"))
{
response.appendResponse(ButterflyEnvironment.GetGame().GetModerationTool().SerializeTool());
ButterflyEnvironment.GetGame().GetModerationTool().SerializeOpenTickets(ref response, userData.userID);
}
response.appendResponse(userData.user.GetAvatarEffectsInventoryComponent().Serialize());
appendingResponse.Init(290);
appendingResponse.AppendBoolean(true);
appendingResponse.AppendBoolean(false);
response.appendResponse(appendingResponse);
appendingResponse.Init(3);
response.appendResponse(appendingResponse);
appendingResponse.Init(517);
appendingResponse.AppendBoolean(true);
response.appendResponse(appendingResponse);
//if (PixelManager.NeedsUpdate(this))
// PixelManager.GivePixels(this);
if (ButterflyEnvironment.GetGame().GetClientManager().pixelsOnLogin > 0)
{
PixelManager.GivePixels(this, ButterflyEnvironment.GetGame().GetClientManager().pixelsOnLogin);
}
if (ButterflyEnvironment.GetGame().GetClientManager().creditsOnLogin > 0)
{
userData.user.Credits += ButterflyEnvironment.GetGame().GetClientManager().creditsOnLogin;
userData.user.UpdateCreditsBalance();
}
if (userData.user.HomeRoom > 0)
{
appendingResponse.Init(455);
appendingResponse.AppendUInt(userData.user.HomeRoom);
response.appendResponse(appendingResponse);
}
//.........这里部分代码省略.........
示例9: ChooseTVPlaylist
internal void ChooseTVPlaylist()
{
var num = Request.GetUInteger();
var video = Request.GetString();
var item = Session.GetHabbo().CurrentRoom.GetRoomItemHandler().GetItem(num);
if (item.GetBaseItem().InteractionType != Interaction.YoutubeTv)
return;
if (!Session.GetHabbo().GetYoutubeManager().Videos.ContainsKey(video))
return;
item.ExtraData = video;
item.UpdateState();
var serverMessage = new ServerMessage();
serverMessage.Init(LibraryParser.OutgoingRequest("YouTubeLoadVideoMessageComposer"));
serverMessage.AppendInteger(num);
serverMessage.AppendString(video);
serverMessage.AppendInteger(0);
serverMessage.AppendInteger(0);
serverMessage.AppendInteger(0);
Response = serverMessage;
SendResponse();
}
示例10: PickUpPowerUp
private void PickUpPowerUp(RoomItem item, RoomUser user)
{
switch (item.freezePowerUp)
{
case FreezePowerUp.Heart:
{
if (user.FreezeLives < 3)
{
user.FreezeLives++;
room.GetGameManager().AddPointToTeam(user.team, 10, user);
}
ServerMessage message = new ServerMessage();
message.Init(701);
message.AppendInt32(user.InternalRoomID);
message.AppendInt32(user.FreezeLives);
user.GetClient().SendMessage(message);
break;
}
case FreezePowerUp.Shield:
{
ActivateShield(user);
break;
}
case FreezePowerUp.BlueArrow:
case FreezePowerUp.GreenArrow:
case FreezePowerUp.OrangeSnowball:
{
user.banzaiPowerUp = item.freezePowerUp;
break;
}
}
item.freezePowerUp = FreezePowerUp.None;
item.ExtraData = "1" + item.ExtraData;
item.UpdateState(false, true);
}
示例11: UpdateUserOnRoller
internal ServerMessage UpdateUserOnRoller(RoomUser pUser, Point pNextCoord, uint pRollerID, Double NextZ)
{
ServerMessage mMessage = new ServerMessage();
mMessage.Init(230); // Cf
mMessage.AppendInt32(pUser.X);
mMessage.AppendInt32(pUser.Y);
mMessage.AppendInt32(pNextCoord.X);
mMessage.AppendInt32(pNextCoord.Y);
mMessage.AppendInt32(0);
mMessage.AppendUInt(pRollerID);
mMessage.AppendString("J");
mMessage.AppendInt32(pUser.VirtualId);
mMessage.AppendStringWithBreak(TextHandling.GetString(pUser.Z));
mMessage.AppendStringWithBreak(TextHandling.GetString(NextZ));
room.GetGameMap().UpdateUserMovement(new Point(pUser.X, pUser.Y), new Point(pNextCoord.X, pNextCoord.Y), pUser);
room.GetGameMap().GameMap[pUser.X, pUser.Y] = 1;
pUser.X = pNextCoord.X;
pUser.Y = pNextCoord.Y;
pUser.Z = NextZ;
room.GetGameMap().GameMap[pUser.X, pUser.Y] = 0;
return mMessage;
}
示例12: OnTrigger
internal override void OnTrigger(GameClient Session, RoomItem Item, int Request, bool UserHasRights)
{
if (Item.ExtraData.StartsWith("0"))
{
return;
}
else if (Item.ExtraData.EndsWith("0"))
{
return;
}
ServerMessage Response = new ServerMessage();
int BoxColour = int.Parse(Item.ExtraData.Split(Convert.ToChar(5))[0]);
RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
User.GateId = Item.Id;
if (Session.GetHabbo().Id == Item.GetRoom().OwnerId)
{
Item.InteractingUser = Session.GetHabbo().Id;
Response.Init(Outgoing.OpenMysteryBox);
Session.SendMessage(Response);
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().getQueryreactor())
dbClient.runFastQuery("UPDATE items SET extra_data = '" + BoxColour + Convert.ToChar(5) + "1' WHERE id=" + Item.Id + " LIMIT 1;");
Item.ExtraData = BoxColour + Convert.ToChar(5) + "1";
Item.UpdateNeeded = true;
Item.UpdateState(true, true);
}
else
{
if (BoxColour == Session.GetHabbo().MysteryKeyColour)
{
Item.InteractingUser2 = Session.GetHabbo().Id;
Response.Init(Outgoing.OpenMysteryBox);
Session.SendMessage(Response);
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().getQueryreactor())
dbClient.runFastQuery("UPDATE items SET extra_data = '" + BoxColour + Convert.ToChar(5) + "1' WHERE id=" + Item.Id + " LIMIT 1;");
Item.ExtraData = BoxColour + Convert.ToChar(5) + "1";
Item.UpdateNeeded = true;
Item.UpdateState(true, true);
}
else
{
Response.Init(Outgoing.SerializeCoolMessage);
Response.AppendString("${mysterybox.error.title}");
Response.AppendString("${mysterybox.error.wrong_key.subtitle}");
Response.AppendString("${mysterybox.error.wrong_key.message}");
Response.AppendString("");
Response.AppendString("");
Response.AppendString("");
Session.SendMessage(Response);
return;
}
}
if (Item.InteractingUser > 0 && Item.InteractingUser2 > 0)
{
GameClient BoxOwner = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Item.InteractingUser);
GameClient Helper = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Item.InteractingUser2);
if (Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(PlusEnvironment.getHabboForId(Item.InteractingUser).Username) == null || BoxOwner == null)
{
Item.InteractingUser = 0;
return;
}
else if (Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(PlusEnvironment.getHabboForId(Item.InteractingUser2).Username) == null || Helper == null)
{
Item.InteractingUser2 = 0;
return;
}
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().getQueryreactor())
{
dbClient.runFastQuery("UPDATE items SET extra_data = '" + BoxColour + Convert.ToChar(5) + "0' WHERE user_id=" + BoxOwner.GetHabbo().Id + " AND base_item=4700 LIMIT 1;" +
"UPDATE users SET key_colour=0 WHERE id=" + Helper.GetHabbo().Id + " LIMIT 1");
EcotronReward Reward = PlusEnvironment.GetGame().GetCatalog().GetRandomEcotronReward();
Item.ExtraData = BoxColour + Convert.ToChar(5) + "0";
Item.UpdateNeeded = true;
Item.UpdateState(true, true);
Response.Init(Outgoing.SendMysteryBoxPrize);
Response.AppendString(PlusEnvironment.GetGame().GetItemManager().GetItem(Reward.BaseId).Type.ToString());
Response.AppendUInt(Reward.DisplayId);
Helper.SendMessage(Response);
BoxOwner.SendMessage(Response);
PlusEnvironment.GetGame().GetCatalog().DeliverItems(BoxOwner, PlusEnvironment.GetGame().GetItemManager().GetItem(Reward.BaseId), 1, "",0,0);
PlusEnvironment.GetGame().GetCatalog().DeliverItems(Helper, PlusEnvironment.GetGame().GetItemManager().GetItem(Reward.BaseId), 1, "",0,0);
BoxOwner.GetHabbo().GetInventoryComponent().UpdateItems(true);
Helper.GetHabbo().GetInventoryComponent().UpdateItems(true);
PlusEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(BoxOwner, "ACH_MysteryBox", 1);
Helper.GetHabbo().MysteryKeyColour = 0;
Helper.SendMessage(Helper.GetHabbo().SerializeColours(Response));
BoxOwner.SendMessage(BoxOwner.GetHabbo().SerializeColours(Response));
//.........这里部分代码省略.........
示例13: CountTeamPoints
private void CountTeamPoints()
{
room.GetGameManager().Reset();
foreach (RoomUser user in room.GetRoomUserManager().UserList.Values)
{
if (user.IsBot || user.team == Team.none || user.GetClient() == null)
continue;
user.banzaiPowerUp = FreezePowerUp.None;
user.FreezeLives = 3;
user.shieldActive = false;
user.shieldCounter = 11;
room.GetGameManager().AddPointToTeam(user.team, 40, null);
ServerMessage message = new ServerMessage();
message.Init(701);
message.AppendInt32(user.InternalRoomID);
message.AppendInt32(user.FreezeLives);
user.GetClient().SendMessage(message);
}
}
示例14: commands
internal void commands()
{
ServerMessage nMessage = new ServerMessage();
nMessage.Init(810);
nMessage.AppendUInt(1);
nMessage.AppendStringWithBreak(ChatCommandRegister.GenerateCommandList(Session));
Session.GetConnection().SendData(nMessage.GetBytes());
}
示例15: roomalert
internal void roomalert()
{
Room TargetRoom = Session.GetHabbo().CurrentRoom;
TargetRoom = ButterflyEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
if (TargetRoom == null)
return;
string Msg = MergeParams(Params, 1);
ServerMessage nMessage = new ServerMessage();
nMessage.Init(161);
nMessage.AppendStringWithBreak(Msg);
ButterflyEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, string.Empty, "Alert", "Room alert with message [" + Msg + "]");
TargetRoom.QueueRoomMessage(nMessage);
}