本文整理汇总了C#中Pici.Messages.ServerMessage.Init方法的典型用法代码示例。如果您正苦于以下问题:C# ServerMessage.Init方法的具体用法?C# ServerMessage.Init怎么用?C# ServerMessage.Init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pici.Messages.ServerMessage
的用法示例。
在下文中一共展示了ServerMessage.Init方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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.AppendInt32(3508);
Message.AppendInt32(item.Coordinate.X);
Message.AppendInt32(item.Coordinate.Y);
Message.AppendInt32(newX);
Message.AppendInt32(newY);
Message.AppendInt32(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.AppendInt32(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));
}
示例2: 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;
}
示例3: SendNotif
internal void SendNotif(string Message, Boolean FromHotelManager)
{
ServerMessage nMessage = new ServerMessage();
if (FromHotelManager)
{
nMessage.Init(139);
}
else
{
nMessage.Init(161);
}
nMessage.AppendStringWithBreak(Message);
GetConnection().SendData(nMessage.GetBytes());
}
示例4: 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;
}
示例5: UpdateItemOnRoller
private ServerMessage UpdateItemOnRoller(RoomItem pItem, Point NextCoord, uint pRolledID, Double NextZ)
{
ServerMessage mMessage = new ServerMessage();
mMessage.Init(230); // Cf
mMessage.AppendInt32(pItem.GetX);
mMessage.AppendInt32(pItem.GetY);
mMessage.AppendInt32(NextCoord.X);
mMessage.AppendInt32(NextCoord.Y);
mMessage.AppendInt32(1);
mMessage.AppendUInt(pItem.Id);
mMessage.AppendStringWithBreak(TextHandling.GetString(pItem.GetZ));
mMessage.AppendStringWithBreak(TextHandling.GetString(NextZ));
mMessage.AppendUInt(pRolledID);
//room.SendMessage(mMessage);
//SetFloorItem(null, pItem, NextCoord.X, NextCoord.Y, pItem.Rot, false, true);
SetFloorItem(pItem, NextCoord.X, NextCoord.Y, NextZ);
return mMessage;
}
示例6: commands
internal void commands()
{
ServerMessage nMessage = new ServerMessage();
nMessage.Init(810);
nMessage.Append(1);
nMessage.Append(ChatCommandRegister.GenerateCommandList(Session));
Session.GetConnection().SendData(nMessage.GetBytes());
}
示例7: roomalert
internal void roomalert()
{
Room TargetRoom = Session.GetHabbo().CurrentRoom;
TargetRoom = PiciEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
if (TargetRoom == null)
return;
string Msg = MergeParams(Params, 1);
ServerMessage nMessage = new ServerMessage();
nMessage.Init(161);
nMessage.Append(Msg);
PiciEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, string.Empty, "Alert", "Room alert with message [" + Msg + "]");
TargetRoom.QueueRoomMessage(nMessage);
}
示例8: 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);
}
示例9: FreezeUser
private void FreezeUser(RoomUser user)
{
if (user.IsBot || user.shieldActive || user.team == Team.none)
return;
if (user.Freezed)
{
user.Freezed = false;
user.ApplyEffect((int)user.team + 39);
return;
}
user.Freezed = true;
user.FreezeCounter = 0;
user.FreezeLives--;
if (user.FreezeLives <= 0)
{
user.ApplyEffect(-1);
room.GetGameManager().AddPointToTeam(user.team, -20, user);
user.team = Team.none;
if (exitTeleport != null)
room.GetGameMap().TeleportToItem(user, exitTeleport);
user.Freezed = false;
user.SetStep = false;
user.IsWalking = false;
user.UpdateNeeded = true;
return;
}
room.GetGameManager().AddPointToTeam(user.team, -10, user);
user.ApplyEffect(12);
ServerMessage message = new ServerMessage();
message.Init(701);
message.AppendInt32(user.InternalRoomID);
message.AppendInt32(user.FreezeLives);
user.GetClient().SendMessage(message);
}
示例10: 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);
}
}
示例11: Whisper
internal void Whisper()
{
if (PiciEnvironment.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 = PiciEnvironment.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.Append(User.VirtualId);
TellMsg.Append(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.Append(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.Append(User.VirtualId);
NotifyMessage.Append(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);
}
}
示例12: MovePuck
internal void MovePuck(RoomItem item, GameClient mover, int newX, int newY, Team team)
{
if (!room.GetGameMap().itemCanBePlacedHere(newX, newY))
return;
Point oldRoomCoord = item.Coordinate;
Double NewZ = room.GetGameMap().Model.SqFloorHeight[newX, newY];
//ServerMessage Message = new ServerMessage(95);
//Message.Append(item.Id);
//Message.Append(3508);
//Message.Append(item.Coordinate.X);
//Message.Append(item.Coordinate.Y);
//Message.Append(newX);
//Message.Append(newY);
//Message.Append(4);
//Message.Append(NewZ.ToString());
//Message.Append("H11");
//Message.Append(-1);
//Message.Append(0);
//SendMessage(Message);
if (oldRoomCoord.X == newX && oldRoomCoord.Y == newY)
return;
item.ExtraData = ((int)team).ToString();
item.UpdateNeeded = true;
item.UpdateState();
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(TextHandling.GetString(item.GetZ));
mMessage.AppendStringWithBreak(TextHandling.GetString(NewZ));
mMessage.AppendInt32(1);
room.SendMessage(mMessage);
//HandleBanzaiTiles(new Coord(item.GetX, item.GetY), team);
room.GetRoomItemHandler().SetFloorItem(mover, item, newX, newY, item.Rot, false, false, false, false);
if (mover == null || mover.GetHabbo() == null)
return;
RoomUser user = mover.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(mover.GetHabbo().Id);
if (banzaiStarted)
{
HandleBanzaiTiles(new Point(newX, newY), team, user);
}
}