本文整理汇总了C#中Snowlight.Communication.ClientMessage.PopWiredInt32方法的典型用法代码示例。如果您正苦于以下问题:C# ClientMessage.PopWiredInt32方法的具体用法?C# ClientMessage.PopWiredInt32怎么用?C# ClientMessage.PopWiredInt32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Snowlight.Communication.ClientMessage
的用法示例。
在下文中一共展示了ClientMessage.PopWiredInt32方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AlertRoom
private static void AlertRoom(Session Session, ClientMessage Message)
{
if (!Session.HasRight("moderation_tool"))
{
return;
}
RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);
if (Instance == null)
{
Session.SendData(NotificationMessageComposer.Compose("Could not send room alert."));
return;
}
int Unknown1 = Message.PopWiredInt32();
int AlertMode = Message.PopWiredInt32();
string AlertMessage = Message.PopString();
bool IsCaution = AlertMode != 3;
Instance.SendModerationAlert(AlertMessage, IsCaution);
using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
{
ModerationLogs.LogModerationAction(MySqlClient, Session, "Sent room " + (IsCaution ? "caution" : "message"),
"Room " + Instance.Info.Name + " (ID " + Instance.RoomId + "): '" + AlertMessage + "'");
}
}
示例2: ApplyEffect
private static void ApplyEffect(Session Session, ClientMessage Message)
{
int EffectSpriteId = Message.PopWiredInt32();
if (EffectSpriteId < 0)
{
EffectSpriteId = 0;
}
RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);
if (Instance == null)
{
return;
}
RoomActor Actor = Instance.GetActorByReferenceId(Session.CharacterId);
if (Actor == null || (EffectSpriteId != 0 && !Session.AvatarEffectCache.HasEffect(EffectSpriteId, true)))
{
return;
}
Actor.ApplyEffect(EffectSpriteId);
Session.CurrentEffect = EffectSpriteId;
}
示例3: SubmitAnswer
private static void SubmitAnswer(Session Session, ClientMessage Message)
{
RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);
if (Instance == null)
{
return;
}
RoomActor Actor = Instance.GetActorByReferenceId(Session.CharacterId);
if (Actor == null)
{
return;
}
int AnswerId = Message.PopWiredInt32();
lock (mInfobusQuestions)
{
if (mInfobusQuestions.ContainsKey(Instance.RoomId))
{
mInfobusQuestions[Instance.RoomId].SubmitAnswer(Actor.Id, AnswerId);
}
}
}
示例4: BanUser
private static void BanUser(Session Session, ClientMessage Message)
{
if (!Session.HasRight("moderation_tool"))
{
return;
}
uint UserId = Message.PopWiredUInt32();
string MessageText = Message.PopString();
double Length = (Message.PopWiredInt32() * 3600);
Session TargetSession = SessionManager.GetSessionByCharacterId(UserId);
if (TargetSession == null || TargetSession.HasRight("moderation_tool"))
{
Session.SendData(NotificationMessageComposer.Compose("This user is not online or you do not have permission to ban them.\nPlease use housekeeping to ban users that are offline."));
return;
}
SessionManager.StopSession(TargetSession.Id);
using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
{
ModerationBanManager.BanUser(MySqlClient, UserId, MessageText, Session.CharacterId, Length);
ModerationLogs.LogModerationAction(MySqlClient, Session, "Banned user",
"User '" + TargetSession.CharacterInfo.Username + "' (ID " + TargetSession.CharacterId + ") for " +
Length + " hours: '" + MessageText + "'");
}
}
示例5: OnSessionLatencyTest
private static void OnSessionLatencyTest(Session Session, ClientMessage Message)
{
// Sesion timer sends a number to the server and expects it right back.
// Maybe something to do with latency testing... or a keepalive?
// Seems like a waste of bandwith since we're using pinging
Session.SendData(LatencyTestResponseComposer.Compose(Message.PopWiredInt32()));
}
示例6: ActivateEffect
private static void ActivateEffect(Session Session, ClientMessage Message)
{
AvatarEffect Effect = Session.AvatarEffectCache.GetEffect(Message.PopWiredInt32(), false, true);
// If we do not have an effect that needs activating OR if we already have an effect
// of this sort which IS activated, stop.
if (Effect == null || Session.AvatarEffectCache.HasEffect(Effect.SpriteId, true))
{
return;
}
Effect.Activate();
Session.SendData(UserEffectActivatedComposer.Compose(Effect));
}
示例7: OnClientConfig
private static void OnClientConfig(Session Session, ClientMessage Message)
{
int Volume = Message.PopWiredInt32();
bool Something = Message.PopWiredBoolean();
if (Volume < 0)
{
Volume = 0;
}
if (Volume > 100)
{
Volume = 100;
}
Session.CharacterInfo.ConfigVolume = Volume;
}
示例8: UpdateMoodlight
private static void UpdateMoodlight(Session Session, ClientMessage Message)
{
RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);
if (Instance == null || !Instance.CheckUserRights(Session, true))
{
return;
}
Item Item = Instance.MoodlightItem;
if (Item == null)
{
return;
}
MoodlightData Data = MoodlightData.GenerateFromFlags(Item.Flags);
int PresetId = Message.PopWiredInt32();
MoodlightPreset Preset = null;
if (Data.Presets.ContainsKey(PresetId))
{
Preset = Data.Presets[PresetId];
}
if (Preset == null)
{
return;
}
Preset.BackgroundOnly = !Message.PopWiredBoolean();
Preset.ColorCode = UserInputFilter.FilterString(Message.PopString().Trim());
Preset.ColorIntensity = Message.PopWiredInt32();
if (!MoodlightData.IsValidColor(Preset.ColorCode))
{
return;
}
Item.Flags = Data.ToItemFlagData();
Item.DisplayFlags = Data.ToDisplayData();
using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
{
Item.SynchronizeDatabase(MySqlClient, true);
}
Item.BroadcastStateUpdate(Instance);
}
示例9: UserDance
private static void UserDance(Session Session, ClientMessage Message)
{
RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);
if (Instance == null)
{
return;
}
RoomActor Actor = Instance.GetActorByReferenceId(Session.CharacterId);
if (Actor == null || Actor.AvatarEffectId > 0)
{
return;
}
int DanceId = Message.PopWiredInt32();
if (DanceId < 0 || DanceId > 4)
{
return;
}
if (!Session.HasRight("club_regular") && !Session.HasRight("club_vip") && DanceId != 0)
{
DanceId = 1;
}
Actor.Dance(DanceId);
QuestManager.ProgressUserQuest(Session, QuestType.SOCIAL_DANCE);
}
示例10: SetBadgeOrder
private static void SetBadgeOrder(Session Session, ClientMessage Message)
{
int i = 0;
Dictionary<int, Badge> NewSettings = new Dictionary<int, Badge>();
while (Message.RemainingLength > 0)
{
if (i > 5)
{
continue;
}
int SlotId = Message.PopWiredInt32();
string BadgeCode = Message.PopString();
Badge BadgeRef = RightsManager.GetBadgeByCode(BadgeCode);
if (BadgeRef == null || !Session.BadgeCache.ContainsCode(BadgeCode) || SlotId >= 6 ||
SlotId <= 0 || NewSettings.ContainsKey(SlotId))
{
continue;
}
NewSettings.Add(SlotId, BadgeRef);
i++;
}
using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
{
Session.BadgeCache.UpdateBadgeOrder(MySqlClient, NewSettings);
}
RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);
if (Instance == null)
{
return;
}
Instance.BroadcastMessage(RoomUserBadgesComposer.Compose(Session.CharacterId, Session.BadgeCache.EquippedBadges));
QuestManager.ProgressUserQuest(Session, QuestType.PROFILE_BADGE);
}
示例11: RemoveFromPlaylist
private static void RemoveFromPlaylist(Session Session, ClientMessage Message)
{
RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);
if (Instance == null || Instance.MusicController == null || !Instance.CheckUserRights(Session, true))
{
return;
}
Item TakenItem = Instance.MusicController.RemoveDisk(Message.PopWiredInt32());
// playlist will skip to the next item automatically if it has to
if (TakenItem == null)
{
return;
}
Session.InventoryCache.Add(TakenItem);
using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
{
TakenItem.MoveToUserInventory(MySqlClient, Session.CharacterId);
}
Session.SendData(InventoryItemAddedComposer.Compose(TakenItem));
Session.SendData(JukeboxDisksComposer.Compose(Session));
Session.SendData(JukeboxPlaylistComposer.Compose(Instance.MusicController.PlaylistCapacity,
Instance.MusicController.Playlist.Values.ToList()));
}
示例12: GetRoomChatlog
private static void GetRoomChatlog(Session Session, ClientMessage Message)
{
if (!Session.HasRight("chatlogs"))
{
Session.SendData(NotificationMessageComposer.Compose("You are not allowed to use this!"));
return;
}
int Unknown1 = Message.PopWiredInt32();
uint RoomId = Message.PopWiredUInt32();
RoomInfo Info = RoomInfoLoader.GetRoomInfo(RoomId);
if (Info == null)
{
Session.SendData(NotificationMessageComposer.Compose("Room not found; could not load chatlogs."));
return;
}
Session.SendData(ModerationRoomChatlogsComposer.Compose(Info, ModerationLogs.GetLogsForRoom(RoomId,
(UnixTimestamp.GetCurrent() - 3600), UnixTimestamp.GetCurrent())));
}
示例13: OnFriendRemove
private static void OnFriendRemove(Session Session, ClientMessage Message)
{
int Amount = Message.PopWiredInt32();
// Precaution: limit queries to 50
if (Amount > 50)
{
Amount = 50;
}
List<MessengerUpdate> LocalUpdates = new List<MessengerUpdate>();
using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
{
for (int i = 0; i < Amount; i++)
{
uint FriendId = Message.PopWiredUInt32();
if (DestroyFriendship(MySqlClient, Session.CharacterId, FriendId))
{
Session.MessengerFriendCache.RemoveFromCache(FriendId);
LocalUpdates.Add(new MessengerUpdate(-1, CharacterInfoLoader.GenerateNullCharacter(FriendId)));
Session TargetSession = SessionManager.GetSessionByCharacterId(FriendId); ;
if (TargetSession != null)
{
TargetSession.MessengerFriendCache.RemoveFromCache(Session.CharacterId);
TargetSession.SendData(MessengerUpdateListComposer.Compose(new List<MessengerUpdate>() { new MessengerUpdate(-1, CharacterInfoLoader.GenerateNullCharacter(Session.CharacterId)) }));
}
}
}
}
Session.SendData(MessengerUpdateListComposer.Compose(LocalUpdates));
}
示例14: SetIcon
private static void SetIcon(Session Session, ClientMessage Message)
{
RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);
if (Instance == null || !Instance.CheckUserRights(Session, true))
{
return;
}
int Junk = Message.PopWiredInt32();
int Background = Message.PopWiredInt32();
if (Background < 1 || Background > 24)
{
Background = 1;
}
int Foreground = Message.PopWiredInt32();
if (Foreground < 0 || Foreground > 11)
{
Foreground = 0;
}
int ObjectCount = Message.PopWiredInt32();
Dictionary<int, int> Objects = new Dictionary<int, int>();
for (int i = 0; (i < ObjectCount && i < 10); i++)
{
int Position = Message.PopWiredInt32();
int Item = Message.PopWiredInt32();
if (Position < 0 || Position > 10 || Item < 1 || Item > 27 || Objects.ContainsKey(Position))
{
continue;
}
Objects.Add(Position, Item);
}
Instance.Info.UpdateIcon(Background, Foreground, Objects);
Session.SendData(RoomUpdatedNotification3Composer.Compose(Instance.RoomId));
Instance.BroadcastMessage(RoomUpdatedNotification2Composer.Compose(Instance.RoomId));
}
示例15: EditRoom
private static void EditRoom(Session Session, ClientMessage Message)
{
RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);
if (Instance == null || !Instance.CheckUserRights(Session, true))
{
return;
}
// [email protected]'s [email protected] is where I handle business. [email protected]@[email protected]@IbuttsechsAAAA
uint Id = Message.PopWiredUInt32();
if (Id != Instance.RoomId)
{
return;
}
string Name = UserInputFilter.FilterString(Message.PopString()).Trim();
string Description = UserInputFilter.FilterString(Message.PopString()).Trim();
RoomAccessType AccessType = (RoomAccessType)Message.PopWiredInt32();
string Password = UserInputFilter.FilterString(Message.PopString()).Trim();
int UserLimit = Message.PopWiredInt32();
int CategoryId = Message.PopWiredInt32();
int TagCount = Message.PopWiredInt32();
List<string> Tags = new List<string>();
for (int i = 0; (i < TagCount && i < 2); i++)
{
string Tag = UserInputFilter.FilterString(Message.PopString()).Trim().ToLower();
if (Tag.Length > 32)
{
Tag = Tag.Substring(0, 32);
}
if (Tag.Length > 0 && !Tags.Contains(Tag))
{
Tags.Add(Tag);
}
}
bool AllowPets = (Message.ReadBytes(1)[0] == 65);
bool AllowPetEating = (Message.ReadBytes(1)[0] == 65);
bool AllowBlocking = (Message.ReadBytes(1)[0] == 65);
bool HideWalls = (Message.ReadBytes(1)[0] == 65);
int WallThickness = Message.PopWiredInt32();
int FloorThickness = Message.PopWiredInt32();
if (WallThickness < -2 || WallThickness > 1)
{
WallThickness = 0;
}
if (FloorThickness < -2 || FloorThickness > 1)
{
FloorThickness = 0;
}
if (HideWalls && !Session.HasRight("club_vip"))
{
HideWalls = false;
}
if (Name.Length > 60) // was 25
{
Name = Name.Substring(0, 60);
}
if (Description.Length > 128)
{
Description = Description.Substring(0, 128);
}
if (Password.Length > 64)
{
Password = Password.Substring(0, 64);
}
if (UserLimit > Instance.Model.MaxUsers)
{
UserLimit = Instance.Model.MaxUsers;
}
if (Name.Length == 0)
{
Name = "Room";
}
if (AccessType == RoomAccessType.PasswordProtected && Password.Length == 0)
{
AccessType = RoomAccessType.Open;
}
Instance.Info.EditRoom(Name, Description, AccessType, Password, UserLimit, CategoryId, Tags, AllowPets,
AllowPetEating, AllowBlocking, HideWalls, WallThickness, FloorThickness);
Session.SendData(RoomUpdatedNotification1Composer.Compose(Instance.RoomId));
Instance.BroadcastMessage(RoomUpdatedNotification2Composer.Compose(Instance.RoomId));
//.........这里部分代码省略.........