本文整理汇总了C#中Azure.HabboHotel.GameClients.Interfaces.GameClient.GetMessageHandler方法的典型用法代码示例。如果您正苦于以下问题:C# GameClient.GetMessageHandler方法的具体用法?C# GameClient.GetMessageHandler怎么用?C# GameClient.GetMessageHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Azure.HabboHotel.GameClients.Interfaces.GameClient
的用法示例。
在下文中一共展示了GameClient.GetMessageHandler方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public override bool Execute(GameClient session, string[] pms)
{
session.GetMessageHandler().Sit();
return true;
}
示例2: OnTrigger
public override void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights)
{
if (!item.ExtraData.Contains(Convert.ToChar(5).ToString()))
return;
var array = item.ExtraData.Split(Convert.ToChar(5));
session.GetHabbo().Gender = (array[0].ToUpper() == "F" ? "F" : "M");
var dictionary = new Dictionary<string, string>();
dictionary.Clear();
var array2 = array[1].Split('.');
foreach (var text in array2)
{
var array3 = session.GetHabbo().Look.Split('.');
foreach (var text2 in array3)
{
if (text2.Split('-')[0] == text.Split('-')[0])
{
if (dictionary.ContainsKey(text2.Split('-')[0]) && !dictionary.ContainsValue(text))
{
dictionary.Remove(text2.Split('-')[0]);
dictionary.Add(text2.Split('-')[0], text);
}
else
{
if (!dictionary.ContainsKey(text2.Split('-')[0]) && !dictionary.ContainsValue(text))
dictionary.Add(text2.Split('-')[0], text);
}
}
else
{
if (!dictionary.ContainsKey(text2.Split('-')[0]))
dictionary.Add(text2.Split('-')[0], text2);
}
}
}
var text3 = dictionary.Values.Aggregate("", (current1, current) => $"{current1}{current}.");
session.GetHabbo().Look = text3.TrimEnd('.');
using (var queryReactor = Azure.GetDatabaseManager().GetQueryReactor())
{
queryReactor.SetQuery(
$"UPDATE users SET look = @look, gender = @gender WHERE id = {session.GetHabbo().Id}");
queryReactor.AddParameter("look", session.GetHabbo().Look);
queryReactor.AddParameter("gender", session.GetHabbo().Gender);
queryReactor.RunQuery();
}
session.GetMessageHandler()
.GetResponse()
.Init(LibraryParser.OutgoingRequest("UpdateUserDataMessageComposer"));
session.GetMessageHandler().GetResponse().AppendInteger(-1);
session.GetMessageHandler().GetResponse().AppendString(session.GetHabbo().Look);
session.GetMessageHandler().GetResponse().AppendString(session.GetHabbo().Gender.ToLower());
session.GetMessageHandler().GetResponse().AppendString(session.GetHabbo().Motto);
session.GetMessageHandler().GetResponse().AppendInteger(session.GetHabbo().AchievementPoints);
session.GetMessageHandler().SendResponse();
var roomUserByHabbo = item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id);
var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("UpdateUserDataMessageComposer"));
serverMessage.AppendInteger(roomUserByHabbo.VirtualId);
serverMessage.AppendString(session.GetHabbo().Look);
serverMessage.AppendString(session.GetHabbo().Gender.ToLower());
serverMessage.AppendString(session.GetHabbo().Motto);
serverMessage.AppendInteger(session.GetHabbo().AchievementPoints);
session.GetHabbo().CurrentRoom.SendMessage(serverMessage);
}
示例3: DeliverItems
//.........这里部分代码省略.........
list.Add(session.GetHabbo().GetInventoryComponent().AddNewItem(0, 1534, "0", 0u, true, false, 0, 0, string.Empty));
break;
case Interaction.MusicDisc:
list.Add(session.GetHabbo().GetInventoryComponent().AddNewItem(0u, item.ItemId, extraData, 0u, true, false, 0, 0, songCode));
break;
case Interaction.PuzzleBox:
list.Add(session.GetHabbo().GetInventoryComponent().AddNewItem(0u, item.ItemId, extraData, 0u, true, false, limno, limtot));
break;
case Interaction.RoomBg:
var userItem44 = session.GetHabbo().GetInventoryComponent().AddNewItem(0u, item.ItemId, extraData, 0u, true, false, 0, 0, string.Empty);
var id44 = userItem44.Id;
list.Add(userItem44);
using (var queryreactor3 = Azure.GetDatabaseManager().GetQueryReactor())
queryreactor3.RunFastQuery($"INSERT INTO items_toners VALUES ({id44},'0',0,0,0)");
break;
case Interaction.GuildItem:
case Interaction.GuildGate:
case Interaction.GroupForumTerminal:
list.Add(session.GetHabbo().GetInventoryComponent().AddNewItem(0u, item.ItemId, "0", Convert.ToUInt32(extraData), true, false, 0, 0, string.Empty));
break;
case Interaction.GuildForum:
uint groupId;
uint.TryParse(extraData, out groupId);
var group = Azure.GetGame().GetGroupManager().GetGroup(groupId);
if (group != null)
{
if (group.CreatorId == session.GetHabbo().Id)
{
session.GetMessageHandler().GetResponse().Init(LibraryParser.OutgoingRequest("SuperNotificationMessageComposer"));
session.GetMessageHandler().GetResponse().AppendString("forums.delivered");
session.GetMessageHandler().GetResponse().AppendInteger(2);
session.GetMessageHandler().GetResponse().AppendString("groupId");
session.GetMessageHandler().GetResponse().AppendString(extraData);
session.GetMessageHandler().GetResponse().AppendString("groupName");
session.GetMessageHandler().GetResponse().AppendString(group.Name);
session.GetMessageHandler().SendResponse();
if (!group.HasForum)
{
group.HasForum = true;
group.UpdateForum();
}
}
else
session.SendNotif(Azure.GetLanguage().GetVar("user_group_owner_error"));
}
list.Add(session.GetHabbo().GetInventoryComponent().AddNewItem(0u, item.ItemId, "0", Convert.ToUInt32(extraData), true, false, 0, 0, string.Empty));
break;
default:
list.Add(session.GetHabbo().GetInventoryComponent().AddNewItem(0u, item.ItemId, extraData, 0u, true, false, limno, limtot));
break;
}
i++;
}
return list;
}
if (a == 'e')
{
for (var j = 0; j < amount; j++)
session.GetHabbo().GetAvatarEffectsInventoryComponent().AddNewEffect(item.SpriteId, 7200, 0);
}
else if (a == 'r')
{
if (item.Name == "bot_bartender")
{
var bot = CreateBot(session.GetHabbo().Id, "Mahw",
"hr-9534-39.hd-600-1.ch-819-92.lg-3058-64.sh-3064-110.wa-2005",
"Sacia a sede e você pode dançar!", "f", true);
session.GetHabbo().GetInventoryComponent().AddBot(bot);
session.SendMessage(session.GetHabbo().GetInventoryComponent().SerializeBotInventory());
}
else
{
var bot2 = CreateBot(session.GetHabbo().Id, "Claudio",
"hr-3020-34.hd-3091-2.ch-225-92.lg-3058-100.sh-3089-1338.ca-3084-78-108.wa-2005",
"Fala, caminhadas, danças e vestidos", "m", false);
session.GetHabbo().GetInventoryComponent().AddBot(bot2);
session.SendMessage(session.GetHabbo().GetInventoryComponent().SerializeBotInventory());
}
}
return list;
}
示例4: HandlePurchase
//.........这里部分代码省略.........
session.GetHabbo().ActivityPoints -= (int)item.DucketsCost * totalPrice;
session.GetHabbo().UpdateActivityPointsBalance();
}
if (item.DiamondsCost > 0 && !isGift)
{
session.GetHabbo().Diamonds -= (int)item.DiamondsCost * totalPrice;
session.GetHabbo().UpdateSeasonalCurrencyBalance();
}
foreach (var baseItem in item.Items.Keys)
{
if (isGift)
{
if ((DateTime.Now - session.GetHabbo().LastGiftPurchaseTime).TotalSeconds <= 15.0)
{
session.SendNotif(Azure.GetLanguage().GetVar("user_send_gift"));
return;
}
if (!baseItem.AllowGift)
return;
DataRow row;
using (var queryreactor3 = Azure.GetDatabaseManager().GetQueryReactor())
{
queryreactor3.SetQuery("SELECT id FROM users WHERE username = @gift_user");
queryreactor3.AddParameter("gift_user", giftUser);
row = queryreactor3.GetRow();
}
if (row == null)
{
session.GetMessageHandler()
.GetResponse()
.Init(LibraryParser.OutgoingRequest("GiftErrorMessageComposer"));
session.GetMessageHandler().GetResponse().AppendString(giftUser);
session.GetMessageHandler().SendResponse();
return;
}
toUserId = Convert.ToUInt32(row["id"]);
if (toUserId == 0u)
{
session.GetMessageHandler()
.GetResponse()
.Init(LibraryParser.OutgoingRequest("GiftErrorMessageComposer"));
session.GetMessageHandler().GetResponse().AppendString(giftUser);
session.GetMessageHandler().SendResponse();
return;
}
if (item.CreditsCost > 0 && isGift)
{
session.GetHabbo().Credits -= (int)item.CreditsCost * totalPrice;
session.GetHabbo().UpdateCreditsBalance();
}
if (item.DucketsCost > 0 && isGift)
{
session.GetHabbo().ActivityPoints -= (int)item.DucketsCost * totalPrice;
session.GetHabbo().UpdateActivityPointsBalance();
}
if (item.DiamondsCost > 0 && isGift)
{
session.GetHabbo().Diamonds -= (int)item.DiamondsCost * totalPrice;
示例5: RemoveUserFromRoom
/// <summary>
/// Removes the user from room.
/// </summary>
/// <param name="session">The session.</param>
/// <param name="notifyClient">if set to <c>true</c> [notify client].</param>
/// <param name="notifyKick">if set to <c>true</c> [notify kick].</param>
internal void RemoveUserFromRoom(GameClient session, bool notifyClient, bool notifyKick)
{
try
{
if (session == null || session.GetHabbo() == null || _userRoom == null)
return;
var userId = session.GetHabbo().Id;
session.GetHabbo().GetAvatarEffectsInventoryComponent().OnRoomExit();
//using (var queryReactor = Azure.GetDatabaseManager().GetQueryReactor())
// queryReactor.RunFastQuery("UPDATE users_rooms_visits SET exit_timestamp = '" + Azure.GetUnixTimeStamp() + "' WHERE room_id = '" + _room.RoomId + "' AND user_id = '" + session.GetHabbo().Id + "' ORDER BY entry_timestamp DESC LIMIT 1");
var roomUserByHabbo = GetRoomUserByHabbo(userId);
if (roomUserByHabbo == null)
return;
if (notifyKick)
{
var room = Azure.GetGame().GetRoomManager().GetRoom(roomUserByHabbo.RoomId);
var model = room.GetGameMap().Model;
roomUserByHabbo.MoveTo(model.DoorX, model.DoorY);
roomUserByHabbo.CanWalk = false;
session.GetMessageHandler()
.GetResponse()
.Init(LibraryParser.OutgoingRequest("RoomErrorMessageComposer"));
session.GetMessageHandler().GetResponse().AppendInteger(4008);
session.GetMessageHandler().SendResponse();
session.GetMessageHandler()
.GetResponse()
.Init(LibraryParser.OutgoingRequest("OutOfRoomMessageComposer"));
session.GetMessageHandler().GetResponse().AppendShort(2);
session.GetMessageHandler().SendResponse();
}
else if (notifyClient)
{
var serverMessage =
new ServerMessage(LibraryParser.OutgoingRequest("UserIsPlayingFreezeMessageComposer"));
serverMessage.AppendBool(roomUserByHabbo.Team != Team.None);
roomUserByHabbo.GetClient().SendMessage(serverMessage);
session.GetMessageHandler()
.GetResponse()
.Init(LibraryParser.OutgoingRequest("OutOfRoomMessageComposer"));
session.GetMessageHandler().GetResponse().AppendShort(2);
session.GetMessageHandler().SendResponse();
}
if (roomUserByHabbo.Team != Team.None)
{
_userRoom.GetTeamManagerForBanzai().OnUserLeave(roomUserByHabbo);
_userRoom.GetTeamManagerForFreeze().OnUserLeave(roomUserByHabbo);
}
if (roomUserByHabbo.RidingHorse)
{
roomUserByHabbo.RidingHorse = false;
var horse = GetRoomUserByVirtualId((int) roomUserByHabbo.HorseId);
if (horse != null)
{
horse.RidingHorse = false;
horse.HorseId = 0u;
}
}
if (roomUserByHabbo.IsLyingDown || roomUserByHabbo.IsSitting)
{
roomUserByHabbo.IsSitting = false;
roomUserByHabbo.IsLyingDown = false;
}
RemoveRoomUser(roomUserByHabbo);
if (session.GetHabbo() != null && !roomUserByHabbo.IsSpectator)
{
if (roomUserByHabbo.CurrentItemEffect != ItemEffectType.None)
roomUserByHabbo.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().CurrentEffect = -1;
if (session.GetHabbo() != null)
{
if (_userRoom.HasActiveTrade(session.GetHabbo().Id))
_userRoom.TryStopTrade(session.GetHabbo().Id);
session.GetHabbo().CurrentRoomId = 0;
if (session.GetHabbo().GetMessenger() != null)
session.GetHabbo().GetMessenger().OnStatusChanged(true);
}
using (var queryreactor2 = Azure.GetDatabaseManager().GetQueryReactor())
if (session.GetHabbo() != null)
queryreactor2.RunFastQuery(string.Concat(
"UPDATE users_rooms_visits SET exit_timestamp = '", Azure.GetUnixTimeStamp(),
"' WHERE room_id = '", _userRoom.RoomId, "' AND user_id = '", userId,
"' ORDER BY exit_timestamp DESC LIMIT 1"));
}
UsersByUserId.Remove(roomUserByHabbo.UserId);
if (session.GetHabbo() != null)
UsersByUserName.Remove(session.GetHabbo().UserName.ToLower());
roomUserByHabbo.Dispose();
}
catch (Exception ex)
{
Logging.LogCriticalException($"Error during removing user from room:{ex}");
//.........这里部分代码省略.........
示例6: ProgressUserAchievement
//.........这里部分代码省略.........
var targetLevelData = achievement.Levels[acount];
var achievementColoc = session.GetHabbo().GetAchievementData(achievementGroup);
if ((achievementColoc != null) && (fromZero))
fromZero = false;
var progress = (fromZero) ? progressAmount : ((userAchievement.Value.Progress + progressAmount));
var achievementLevel = userAchievement.Value.Level;
var levelEndCheck = achievementLevel + 1;
if (levelEndCheck > count)
levelEndCheck = count;
if (progress >= targetLevelData.Requirement)
{
achievementLevel++;
levelEndCheck++;
progress = 0;
var userBadgeComponent = user.GetBadgeComponent();
if (acount != 1)
userBadgeComponent.RemoveBadge(Convert.ToString($"{achievementGroup}{acount - 1}"), session);
userBadgeComponent.GiveBadge($"{achievementGroup}{acount}", true, session);
if (levelEndCheck > count)
levelEndCheck = count;
user.ActivityPoints += targetLevelData.RewardPixels;
user.NotifyNewPixels(targetLevelData.RewardPixels);
user.UpdateActivityPointsBalance();
session.SendMessage(AchievementUnlockedComposer.Compose(achievement, acount,
targetLevelData.RewardPoints, targetLevelData.RewardPixels));
using (var queryReactor = Azure.GetDatabaseManager().GetQueryReactor())
{
queryReactor.SetQuery(string.Concat("REPLACE INTO users_achievements VALUES (", user.Id, ", @group, ", achievementLevel, ", ", progress, ")"));
queryReactor.AddParameter("group", achievementGroup);
queryReactor.RunQuery();
}
userAchievement.Value.SetLevel(achievementLevel);
userAchievement.Value.SetProgress(progress);
user.AchievementPoints += targetLevelData.RewardPoints;
user.NotifyNewPixels(targetLevelData.RewardPixels);
user.ActivityPoints += targetLevelData.RewardPixels;
user.UpdateActivityPointsBalance();
session.SendMessage(AchievementScoreUpdateComposer.Compose(user.AchievementPoints));
UserAchievement? achievementData = user.GetAchievementData(achievementGroup);
if (achievementData != null)
session.SendMessage(AchievementProgressComposer.Compose(achievement, levelEndCheck, achievement.Levels[levelEndCheck], count, achievementData.Value));
Talent talent;
if (Azure.GetGame().GetTalentManager().TryGetTalent(achievementGroup, out talent))
Azure.GetGame().GetTalentManager().CompleteUserTalent(session, talent);
return true;
}
userAchievement.Value.SetLevel(achievementLevel);
userAchievement.Value.SetProgress(progress);
using (var queryreactor2 = Azure.GetDatabaseManager().GetQueryReactor())
{
queryreactor2.SetQuery(string.Concat("REPLACE INTO users_achievements VALUES (", session.GetHabbo().Id, ", @group, ", achievementLevel, ", ", progress, ")"));
queryreactor2.AddParameter("group", achievementGroup);
queryreactor2.RunQuery();
}
var messageHandler = session.GetMessageHandler();
if (messageHandler != null)
{
UserAchievement? achievementData = user.GetAchievementData(achievementGroup);
if (achievementData != null)
session.SendMessage(AchievementProgressComposer.Compose(achievement, acount, targetLevelData, count, achievementData.Value));
messageHandler.GetResponse().Init(LibraryParser.OutgoingRequest("UpdateUserDataMessageComposer"));
messageHandler.GetResponse().AppendInteger(-1);
messageHandler.GetResponse().AppendString(user.Look);
messageHandler.GetResponse().AppendString(user.Gender.ToLower());
messageHandler.GetResponse().AppendString(user.Motto);
messageHandler.GetResponse().AppendInteger(user.AchievementPoints);
messageHandler.SendResponse();
return true;
}
}
return false;
}