本文整理汇总了C#中Firewind.Messages.ServerMessage.Init方法的典型用法代码示例。如果您正苦于以下问题:C# ServerMessage.Init方法的具体用法?C# ServerMessage.Init怎么用?C# ServerMessage.Init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Firewind.Messages.ServerMessage
的用法示例。
在下文中一共展示了ServerMessage.Init方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Handle
public bool Handle(RoomUnit unit, Team team, RoomItem item)
{
RoomUser user = unit as RoomUser;
if (user != null && user.GetClient() != null)
{
ServerMessage servermsg = new ServerMessage();
servermsg.Init(Outgoing.Whisp);
servermsg.AppendInt32(user.VirtualID);
servermsg.AppendString(message);
servermsg.AppendInt32(0);
servermsg.AppendInt32(0);
servermsg.AppendInt32(-1);
user.GetClient().SendMessage(servermsg);
handler.OnEvent(itemID);
return true;
}
return false;
}
示例2: close
internal void close()
{
Room TargetRoom = Session.GetHabbo().CurrentRoom;
TargetRoom = FirewindEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
TargetRoom.Name = LanguageLocale.GetValue("moderation.room.roomclosed");
TargetRoom.Description = LanguageLocale.GetValue("moderation.room.roomclosed");
TargetRoom.State = 1;
ServerMessage nMessage = new ServerMessage();
nMessage.Init(Outgoing.SendNotif);
nMessage.AppendString(LanguageLocale.GetValue("moderation.room.roomclosed"));
nMessage.AppendString("");
TargetRoom.QueueRoomMessage(nMessage);
using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
{
dbClient.runFastQuery("UPDATE rooms SET state = 'locked', caption = '" + LanguageLocale.GetValue("moderation.room.roomclosed") + "', description = '" + LanguageLocale.GetValue("moderation.room.roomclosed") + "' WHERE id = " + TargetRoom.RoomId);
}
FirewindEnvironment.GetGame().GetRoomManager().UnloadRoom(TargetRoom);
}
示例3: roomalert
internal void roomalert()
{
Room TargetRoom = Session.GetHabbo().CurrentRoom;
TargetRoom = FirewindEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
if (TargetRoom == null)
return;
if (TargetRoom.OwnerId == Session.GetHabbo().Id && Session.GetHabbo().Rank >= 2)
{
if(Session.GetHabbo().Rank < 5)
{
string Msg = MergeParams(Params, 1);
ServerMessage nMessage = new ServerMessage();
nMessage.Init(Outgoing.SendNotif);
nMessage.AppendString("Fra roomeier: (" + TargetRoom.Owner + ")\n" + Msg);
nMessage.AppendString("");
TargetRoom.QueueRoomMessage(nMessage);
}
else
{
string Msg = MergeParams(Params, 1);
ServerMessage nMessage = new ServerMessage();
nMessage.Init(Outgoing.SendNotif);
nMessage.AppendString(Msg);
nMessage.AppendString("");
FirewindEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, string.Empty, "Alert", "Room alert with message [" + Msg + "]");
TargetRoom.QueueRoomMessage(nMessage);
}
}
else
{
if (Session.GetHabbo().Rank > 5)
{
string Msg = MergeParams(Params, 1);
ServerMessage nMessage = new ServerMessage();
nMessage.Init(Outgoing.SendNotif);
nMessage.AppendString(Msg);
nMessage.AppendString("");
FirewindEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, string.Empty, "Alert", "Room alert with message [" + Msg + "]");
TargetRoom.QueueRoomMessage(nMessage);
}
}
}
示例4: 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(Outgoing.UpdateFreezeLives);
message.AppendInt32(user.VirtualID);
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;
((StringData)item.data).Data = "1" + ((StringData)item.data).Data;
item.UpdateState(false, true);
}
示例5: FreezeUser
private void FreezeUser(RoomUser user)
{
if (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)
{
ServerMessage message2 = new ServerMessage();
message2.Init(Outgoing.UpdateFreezeLives);
message2.AppendInt32(user.VirtualID);
message2.AppendInt32(user.FreezeLives);
user.GetClient().SendMessage(message2);
user.ApplyEffect(-1);
room.GetGameManager().AddPointToTeam(user.Team, -20, user);
TeamManager t = room.GetTeamManagerForFreeze();
t.OnUserLeave(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;
if (t.BlueTeam.Count <= 0 && t.RedTeam.Count <= 0 && t.GreenTeam.Count <= 0 && t.YellowTeam.Count > 0)
this.StopGame(); // yellow team win
else if (t.BlueTeam.Count > 0 && t.RedTeam.Count <= 0 && t.GreenTeam.Count <= 0 && t.YellowTeam.Count <= 0)
this.StopGame(); // blue team win
else if (t.BlueTeam.Count <= 0 && t.RedTeam.Count > 0 && t.GreenTeam.Count <= 0 && t.YellowTeam.Count <= 0)
this.StopGame(); // red team win
else if (t.BlueTeam.Count <= 0 && t.RedTeam.Count <= 0 && t.GreenTeam.Count > 0 && t.YellowTeam.Count <= 0)
this.StopGame(); // green team win
return;
}
room.GetGameManager().AddPointToTeam(user.Team, -10, user);
user.ApplyEffect(12);
ServerMessage message = new ServerMessage();
message.Init(Outgoing.UpdateFreezeLives);
message.AppendInt32(user.VirtualID);
message.AppendInt32(user.FreezeLives);
user.GetClient().SendMessage(message);
}
示例6: CountTeamPoints
private void CountTeamPoints()
{
room.GetGameManager().Reset();
foreach (RoomUnit unit in room.GetRoomUserManager().UnitList.Values)
{
RoomUser user = unit as RoomUser;
if (user == null || 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(Outgoing.UpdateFreezeLives);
message.AppendInt32(user.VirtualID);
message.AppendInt32(user.FreezeLives);
user.GetClient().SendMessage(message);
}
}
示例7: OnTrigger
internal override bool OnTrigger(GameClient Session, RoomItem Item, int Request, bool UserHasRights)
{
RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
Point ItemCoordx1 = new Point(Item.Coordinate.X + 1, Item.Coordinate.Y);
Point ItemCoordx2 = new Point(Item.Coordinate.X - 1, Item.Coordinate.Y);
Point ItemCoordy1 = new Point(Item.Coordinate.X, Item.Coordinate.Y + 1);
Point ItemCoordy2 = new Point(Item.Coordinate.X, Item.Coordinate.Y - 1);
if (User == null)
{
return false;
}
if (User.Coordinate != ItemCoordx1 && User.Coordinate != ItemCoordx2 && User.Coordinate != ItemCoordy1 && User.Coordinate != ItemCoordy2)
{
if (User.CanWalk)
{
User.MoveTo(Item.SquareInFront);
return false;
}
}
else
{
int NewX = Item.Coordinate.X;
int NewY = Item.Coordinate.Y;
if (User.Coordinate == ItemCoordx1)
{
NewX = Item.Coordinate.X - 1;
NewY = Item.Coordinate.Y;
}
else if (User.Coordinate == ItemCoordx2)
{
NewX = Item.Coordinate.X + 1;
NewY = Item.Coordinate.Y;
}
else if (User.Coordinate == ItemCoordy1)
{
NewX = Item.Coordinate.X;
NewY = Item.Coordinate.Y - 1;
}
else if (User.Coordinate == ItemCoordy2)
{
NewX = Item.Coordinate.X;
NewY = Item.Coordinate.Y + 1;
}
if (Item.GetRoom().GetGameMap().itemCanBePlacedHere(NewX, NewY))
{
Double NewZ = Item.GetRoom().GetGameMap().SqAbsoluteHeight(NewX, NewY);
ServerMessage Message = new ServerMessage();
Message.Init(Outgoing.ObjectOnRoller); // Cf
Message.AppendInt32(Item.Coordinate.X);
Message.AppendInt32(Item.Coordinate.Y);
Message.AppendInt32(NewX);
Message.AppendInt32(NewY);
Message.AppendInt32(1);
Message.AppendUInt(Item.Id);
Message.AppendString(Item.GetZ.ToString().Replace(',', '.'));
Message.AppendString(NewZ.ToString().Replace(',', '.'));
Message.AppendUInt(0);
Item.GetRoom().SendMessage(Message);
Item.GetRoom().GetRoomItemHandler().SetFloorItem(User.GetClient(), Item, NewX, NewY, Item.Rot, false, false, false);
}
}
return true;
}
示例8: 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(Outgoing.UpdateItemOnRoom);
Message.AppendUInt(item.Id);
Message.AppendInt32(item.GetBaseItem().SpriteId);
Message.AppendInt32(item.CoordinateX);
Message.AppendInt32(item.CoordinateY);
Message.AppendInt32(Rot);
Message.AppendString(String.Format("{0:0.00}", TextHandling.GetString(mZ)));
Message.AppendInt32(0);
Message.AppendInt32(0);
if (GetBaseItem().InteractionType != InteractionType.fbgate)
Message.AppendString(ExtraData);
else
Message.AppendString(string.Empty);
Message.AppendInt32(-1);
Message.AppendInt32(1); // Type New R63 ('use bottom')
Message.AppendInt32(UserId);
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.AppendString(NewZ.ToString());
Message.AppendString("H11");
Message.AppendInt32(-1);
Message.AppendInt32(0);
room.SendMessage(Message);*/
ServerMessage mMessage = new ServerMessage();
mMessage.Init(Outgoing.ObjectOnRoller); // 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.AppendString(item.GetZ.ToString().Replace(',', '.'));
mMessage.AppendString(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));
}
示例9: UpdateItemOnRoller
private ServerMessage UpdateItemOnRoller(RoomItem pItem, Point NextCoord, uint pRolledID, Double NextZ)
{
ServerMessage mMessage = new ServerMessage();
mMessage.Init(Outgoing.ObjectOnRoller); // 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.AppendString(TextHandling.GetString(pItem.GetZ));
mMessage.AppendString(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;
}
示例10: UpdateUserOnRoller
internal ServerMessage UpdateUserOnRoller(RoomUser pUser, Point pNextCoord, uint pRollerID, Double NextZ)
{
ServerMessage mMessage = new ServerMessage(0);
mMessage.Init(Outgoing.ObjectOnRoller); // Cf
mMessage.AppendInt32(pUser.X);
mMessage.AppendInt32(pUser.Y);
mMessage.AppendInt32(pNextCoord.X);
mMessage.AppendInt32(pNextCoord.Y);
mMessage.AppendInt32(0);
mMessage.AppendUInt(pRollerID);
mMessage.AppendInt32(2);
mMessage.AppendInt32(pUser.VirtualId);
mMessage.AppendString(TextHandling.GetString(pUser.Z));
mMessage.AppendString(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;
}
示例11: 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.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.AppendString(NewZ.ToString());
//Message.AppendString("H11");
//Message.AppendInt32(-1);
//Message.AppendInt32(0);
//SendMessage(Message);
if (oldRoomCoord.X == newX && oldRoomCoord.Y == newY)
return;
((StringData)item.data).Data = ((int)team).ToString();
item.UpdateNeeded = true;
item.UpdateState();
ServerMessage mMessage = new ServerMessage();
mMessage.Init(Outgoing.ObjectOnRoller); // 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.AppendString(TextHandling.GetString(item.GetZ));
mMessage.AppendString(TextHandling.GetString(NewZ));
mMessage.AppendUInt(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);
}
}
示例12: Whisper
internal void Whisper()
{
if (FirewindEnvironment.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;
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(Outgoing.FloodFilter);
Packet.AppendInt32(30); //Blocked for 30sec
Session.SendMessage(Packet);
return;
}
FloodTime = DateTime.Now;
FloodCount++;
string Params = Request.ReadString();
string ToUser = Params.Split(' ')[0];
string Message = Params.Substring(ToUser.Length + 1);
Message = LanguageLocale.FilterSwearwords(Message);
RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
ServerMessage TellMsg = new ServerMessage();
TellMsg.Init(Outgoing.Whisp);
TellMsg.AppendInt32(User.VirtualId);
TellMsg.AppendStringWithBreak(Message);
TellMsg.AppendInt32(0);
TellMsg.AppendInt32(0);
TellMsg.AppendInt32(-1);
Session.SendMessage(TellMsg);
User.Unidle();
RoomUser User2 = Room.GetRoomUserManager().GetRoomUserByHabbo(ToUser);
if (ToUser == User.GetUsername() || User2 == null)
return;
if (!User2.IsBot)
{
if (!User2.GetClient().GetHabbo().MutedUsers.Contains(Session.GetHabbo().Id))
User2.GetClient().SendMessage(TellMsg);
}
List<RoomUser> ToNotify = Room.GetRoomUserManager().GetRoomUserByRank(6);
if (ToNotify.Count > 0)
{
TellMsg = new ServerMessage();
TellMsg.Init(Outgoing.Whisp);
TellMsg.AppendInt32(User.VirtualId);
TellMsg.AppendStringWithBreak(LanguageLocale.GetValue("moderation.whisper") + ToUser + ": " + Message);
TellMsg.AppendInt32(0);
TellMsg.AppendInt32(0);
TellMsg.AppendInt32(-1);
foreach (RoomUser user in ToNotify)
if (user.HabboId != User2.HabboId && user.HabboId != User.HabboId)
user.GetClient().SendMessage(TellMsg);
}
}
示例13: roomUserManager_OnUserSays
private void roomUserManager_OnUserSays(object sender, UserSaysArgs e, out bool messageHandled)
{
RoomUser userSaying = e.user;
string message = e.message;
if ((!isOwnerOnly && canBeTriggered(message)) || (isOwnerOnly && userSaying.IsOwner() && canBeTriggered(message)))
{
// Send whisper to self
ServerMessage servermsg = new ServerMessage();
servermsg.Init(Outgoing.Whisp);
servermsg.AppendInt32(userSaying.VirtualID);
servermsg.AppendString(message);
servermsg.AppendInt32(0);
servermsg.AppendInt32(0);
servermsg.AppendInt32(-1);
userSaying.GetClient().SendMessage(servermsg);
handler.RequestStackHandle(item.Coordinate, null, userSaying, Games.Team.none);
handler.OnEvent(item.Id);
messageHandled = true;
}
else
messageHandled = false;
}
示例14: UpdateUnitOnRoller
internal ServerMessage UpdateUnitOnRoller(RoomUnit unit, Point pNextCoord, uint pRollerID, Double NextZ)
{
ServerMessage mMessage = new ServerMessage(0);
mMessage.Init(Outgoing.ObjectOnRoller); // Cf
mMessage.AppendInt32(unit.X);
mMessage.AppendInt32(unit.Y);
mMessage.AppendInt32(pNextCoord.X);
mMessage.AppendInt32(pNextCoord.Y);
mMessage.AppendInt32(0);
mMessage.AppendUInt(pRollerID);
mMessage.AppendInt32(2);
mMessage.AppendInt32(unit.VirtualID);
mMessage.AppendString(TextHandling.GetString(unit.Z));
mMessage.AppendString(TextHandling.GetString(NextZ));
room.GetGameMap().UpdateUnitMovement(new Point(unit.X, unit.Y), new Point(pNextCoord.X, pNextCoord.Y), unit);
room.GetGameMap().Map[unit.X, unit.Y] = 1;
unit.X = pNextCoord.X;
unit.Y = pNextCoord.Y;
unit.Z = NextZ;
room.GetGameMap().Map[unit.X, unit.Y] = 0;
return mMessage;
}