本文整理汇总了C#中Plus.HabboHotel.GameClients.GameClient.SendNotification方法的典型用法代码示例。如果您正苦于以下问题:C# GameClient.SendNotification方法的具体用法?C# GameClient.SendNotification怎么用?C# GameClient.SendNotification使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plus.HabboHotel.GameClients.GameClient
的用法示例。
在下文中一共展示了GameClient.SendNotification方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateRoom
public RoomData CreateRoom(GameClient Session, string Name, string Description, string Model, int Category, int MaxVisitors, int TradeSettings)
{
if (!_roomModels.ContainsKey(Model))
{
Session.SendNotification(PlusEnvironment.GetGame().GetLanguageLocale().TryGetValue("room_model_missing"));
return null;
}
if (Name.Length < 3)
{
Session.SendNotification(PlusEnvironment.GetGame().GetLanguageLocale().TryGetValue("room_name_length_short"));
return null;
}
int RoomId = 0;
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
dbClient.SetQuery("INSERT INTO `rooms` (`roomtype`,`caption`,`description`,`owner`,`model_name`,`category`,`users_max`,`trade_settings`) VALUES ('private',@caption,@description,@UserId,@model,@category,@usersmax,@tradesettings)");
dbClient.AddParameter("caption", Name);
dbClient.AddParameter("description", Description);
dbClient.AddParameter("UserId", Session.GetHabbo().Id);
dbClient.AddParameter("model", Model);
dbClient.AddParameter("category", Category);
dbClient.AddParameter("usersmax", MaxVisitors);
dbClient.AddParameter("tradesettings", TradeSettings);
RoomId = Convert.ToInt32(dbClient.InsertQuery());
}
RoomData newRoomData = GenerateRoomData(RoomId);
Session.GetHabbo().UsersRooms.Add(newRoomData);
return newRoomData;
}
示例2: Parse
public void Parse(GameClient Session, ClientPacket Packet)
{
string VoucherCode = Packet.PopString().Replace("\r", "");
Voucher Voucher = null;
if (!PlusEnvironment.GetGame().GetCatalog().GetVoucherManager().TryGetVoucher(VoucherCode, out Voucher))
{
Session.SendMessage(new VoucherRedeemErrorComposer(0));
return;
}
if (Voucher.CurrentUses >= Voucher.MaxUses)
{
Session.SendNotification("Oops, this voucher has reached the maximum usage limit!");
return;
}
DataRow GetRow = null;
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
dbClient.SetQuery("SELECT * FROM `user_vouchers` WHERE `user_id` = '" + Session.GetHabbo().Id + "' AND `voucher` = @Voucher LIMIT 1");
dbClient.AddParameter("Voucher", VoucherCode);
GetRow = dbClient.getRow();
}
if (GetRow != null)
{
Session.SendNotification("You've already used this voucher code, one per each user, sorry!");
return;
}
else
{
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
dbClient.SetQuery("INSERT INTO `user_vouchers` (`user_id`,`voucher`) VALUES ('" + Session.GetHabbo().Id + "', @Voucher)");
dbClient.AddParameter("Voucher", VoucherCode);
dbClient.RunQuery();
}
}
Voucher.UpdateUses();
if (Voucher.Type == VoucherType.CREDIT)
{
Session.GetHabbo().Credits += Voucher.Value;
Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));
}
else if (Voucher.Type == VoucherType.DUCKET)
{
Session.GetHabbo().Duckets += Voucher.Value;
Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().Duckets, Voucher.Value));
}
Session.SendMessage(new VoucherRedeemOkComposer());
}
示例3: Parse
public void Parse(GameClient Session, ClientPacket Packet)
{
if (Session.GetHabbo().TimeMuted > 0)
{
Session.SendNotification("Oops, you're currently muted - you cannot change your motto.");
return;
}
if ((DateTime.Now - Session.GetHabbo().LastMottoUpdateTime).TotalSeconds <= 2.0)
{
Session.GetHabbo().MottoUpdateWarnings += 1;
if (Session.GetHabbo().MottoUpdateWarnings >= 25)
Session.GetHabbo().SessionMottoBlocked = true;
return;
}
if (Session.GetHabbo().SessionMottoBlocked)
return;
Session.GetHabbo().LastMottoUpdateTime = DateTime.Now;
string newMotto = StringCharFilter.Escape(Packet.PopString().Trim());
if (newMotto.Length > 38)
newMotto = newMotto.Substring(0, 38);
if (newMotto == Session.GetHabbo().Motto)
return;
if (!Session.GetHabbo().GetPermissions().HasRight("word_filter_override"))
newMotto = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(newMotto);
Session.GetHabbo().Motto = newMotto;
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
dbClient.SetQuery("UPDATE `users` SET `motto` = @motto WHERE `id` = '" + Session.GetHabbo().Id + "' LIMIT 1");
dbClient.AddParameter("motto", newMotto);
dbClient.RunQuery();
}
PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.PROFILE_CHANGE_MOTTO);
PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_Motto", 1);
if (Session.GetHabbo().InRoom)
{
Room Room = Session.GetHabbo().CurrentRoom;
if (Room == null)
return;
RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
if (User == null || User.GetClient() == null)
return;
Room.SendMessage(new UserChangeComposer(User, false));
}
}
示例4: CheckRewards
public void CheckRewards(GameClient Session)
{
if (Session == null || Session.GetHabbo() == null)
return;
foreach (KeyValuePair<int, Reward> Entry in _rewards)
{
int Id = Entry.Key;
Reward Reward = Entry.Value;
if (this.HasReward(Session.GetHabbo().Id, Id))
continue;
if (Reward.isActive())
{
switch (Reward.Type)
{
case RewardType.BADGE:
{
if (!Session.GetHabbo().GetBadgeComponent().HasBadge(Reward.RewardData))
Session.GetHabbo().GetBadgeComponent().GiveBadge(Reward.RewardData, true, Session);
break;
}
case RewardType.CREDITS:
{
Session.GetHabbo().Credits += Convert.ToInt32(Reward.RewardData);
Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));
break;
}
case RewardType.DUCKETS:
{
Session.GetHabbo().Duckets += Convert.ToInt32(Reward.RewardData);
Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().Duckets, Convert.ToInt32(Reward.RewardData)));
break;
}
case RewardType.DIAMONDS:
{
Session.GetHabbo().Diamonds += Convert.ToInt32(Reward.RewardData);
Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().Diamonds, Convert.ToInt32(Reward.RewardData), 5));
break;
}
}
if (!String.IsNullOrEmpty(Reward.Message))
Session.SendNotification(Reward.Message);
this.LogReward(Session.GetHabbo().Id, Id);
}
else
continue;
}
}
示例5: Execute
public void Execute(GameClient Session, Room Room, string[] Params)
{
if (!Room.CheckRights(Session, true))
return;
if (Params.Length == 1)
{
Session.SendWhisper("Oops, you forgot to choose a price to sell the room for.");
return;
}
else if (Room.Group != null)
{
Session.SendWhisper("Oops, this room has a group. You must delete the group before you can sell the room.");
return;
}
int Price = 0;
if (!int.TryParse(Params[1], out Price))
{
Session.SendWhisper("Oops, you've entered an invalid integer.");
return;
}
if (Price == 0)
{
Session.SendWhisper("Oops, you cannot sell a room for 0 credits.");
return;
}
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
dbClient.SetQuery("UPDATE `rooms` SET `sale_price` = @SalePrice WHERE `id` = @Id LIMIT 1");
dbClient.AddParameter("SalePrice", Price);
dbClient.AddParameter("Id", Room.Id);
dbClient.RunQuery();
}
Session.SendNotification("Your room is now up for sale. The the current room visitors have been alerted, any item that belongs to you in this room will be transferred to the new owner once purchased. Other items shall be ejected.");
foreach (RoomUser User in Room.GetRoomUserManager().GetRoomUsers())
{
if (User == null || User.GetClient() == null)
continue;
User.GetClient().SendWhisper("Attention! This room has been put up for sale, you can buy it now for " + Price + " credits! Use the :buyroom command.");
}
}
示例6: SetWallItem
public bool SetWallItem(GameClient Session, Item Item)
{
if (!Item.IsWallItem || _wallItems.ContainsKey(Item.Id))
return false;
if (_floorItems.ContainsKey(Item.Id))
{
Session.SendNotification(PlusEnvironment.GetGame().GetLanguageLocale().TryGetValue("room_item_placed"));
return true;
}
Item.Interactor.OnPlace(Session, Item);
if (Item.GetBaseItem().InteractionType == InteractionType.MOODLIGHT)
{
if (_room.MoodlightData != null)
{
_room.MoodlightData = new MoodlightData(Item.Id);
Item.ExtraData = _room.MoodlightData.GenerateExtraData();
}
}
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
dbClient.SetQuery("UPDATE `items` SET `room_id` = '" + _room.RoomId + "', `x` = '" + Item.GetX + "', `y` = '" + Item.GetY + "', `z` = '" + Item.GetZ + "', `rot` = '" + Item.Rotation + "', `wall_pos` = @WallPos WHERE `id` = '" + Item.Id + "' LIMIT 1");
dbClient.AddParameter("WallPos", Item.wallCoord);
dbClient.RunQuery();
}
_wallItems.TryAdd(Item.Id, Item);
_room.SendMessage(new ItemAddComposer(Item));
return true;
}
示例7: SetFloorItem
//.........这里部分代码省略.........
if (I.Id == Item.Id)
continue;
if (I.GetBaseItem() == null)
continue;
if (!I.GetBaseItem().Stackable)
{
if (NeedsReAdd)
{
//AddItem(Item);
_room.GetGameMap().AddToMap(Item);
}
return false;
}
}
}
//if (!Item.IsRoller)
{
// If this is a rotating action, maintain item at current height
if (Item.Rotation != newRot && Item.GetX == newX && Item.GetY == newY)
newZ = Item.GetZ;
Double StackingTile = 0;
// Are there any higher objects in the stack!?
foreach (Item I in ItemsComplete.ToList())
{
if (I == null)
continue;
if (I.Id == Item.Id)
continue; // cannot stack on self
if (I.GetBaseItem().InteractionType == InteractionType.STACKTOOL)
StackingTile = I.GetZ;
if (I.TotalHeight > newZ)
newZ = StackingTile != 0 ? StackingTile : I.TotalHeight;
}
}
// Verify the rotation is correct
if (newRot != 0 && newRot != 2 && newRot != 4 && newRot != 6 && newRot != 8 && !Item.GetBaseItem().ExtraRot)
newRot = 0;
Item.Rotation = newRot;
int oldX = Item.GetX;
int oldY = Item.GetY;
Item.SetState(newX, newY, newZ, AffectedTiles);
if (!OnRoller && Session != null)
Item.Interactor.OnPlace(Session, Item);
if (newItem)
{
if (_floorItems.ContainsKey(Item.Id))
{
if (Session != null)
Session.SendNotification(PlusEnvironment.GetGame().GetLanguageLocale().TryGetValue("room_item_placed"));
_room.GetGameMap().RemoveFromMap(Item);
return true;
}
if (Item.IsFloorItem && !_floorItems.ContainsKey(Item.Id))
_floorItems.TryAdd(Item.Id, Item);
else if (Item.IsWallItem && !_wallItems.ContainsKey(Item.Id))
_wallItems.TryAdd(Item.Id, Item);
if (sendMessage)
_room.SendMessage(new ObjectAddComposer(Item, _room));
}
else
{
UpdateItem(Item);
if (!OnRoller && sendMessage)
_room.SendMessage(new ObjectUpdateComposer(Item, _room.OwnerId));
}
_room.GetGameMap().AddToMap(Item);
if (Item.GetBaseItem().IsSeat)
updateRoomUserStatuses = true;
if (updateRoomUserStatuses)
_room.GetRoomUserManager().UpdateUserStatusses();
if (Item.GetBaseItem().InteractionType == InteractionType.TENT || Item.GetBaseItem().InteractionType == InteractionType.TENT_SMALL)
{
_room.RemoveTent(Item.Id, Item);
_room.AddTent(Item.Id);
}
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
dbClient.RunQuery("UPDATE `items` SET `room_id` = '" + _room.RoomId + "', `x` = '" + Item.GetX + "', `y` = '" + Item.GetY + "', `z` = '" + Item.GetZ + "', `rot` = '" + Item.Rotation + "' WHERE `id` = '" + Item.Id + "' LIMIT 1");
}
return true;
}
示例8: Parse
public void Parse(GameClient Session, ClientPacket Packet)
{
if (PlusEnvironment.GetDBConfig().DBData["catalogue_enabled"] != "1")
{
Session.SendNotification("The hotel managers have disabled the catalogue");
return;
}
int PageId = Packet.PopInt();
int ItemId = Packet.PopInt();
string ExtraData = Packet.PopString();
int Amount = Packet.PopInt();
CatalogPage Page = null;
if (!PlusEnvironment.GetGame().GetCatalog().TryGetPage(PageId, out Page))
return;
if (!Page.Enabled || !Page.Visible || Page.MinimumRank > Session.GetHabbo().Rank || (Page.MinimumVIP > Session.GetHabbo().VIPRank && Session.GetHabbo().Rank == 1))
return;
CatalogItem Item = null;
if (!Page.Items.TryGetValue(ItemId, out Item))
{
if (Page.ItemOffers.ContainsKey(ItemId))
{
Item = (CatalogItem)Page.ItemOffers[ItemId];
if (Item == null)
return;
}
else
return;
}
if (Amount < 1 || Amount > 100)
Amount = 1;
int AmountPurchase = Item.Amount > 1 ? Item.Amount : Amount;
int TotalCreditsCost = Amount > 1 ? ((Item.CostCredits * Amount) - ((int)Math.Floor((double)Amount / 6) * Item.CostCredits)) : Item.CostCredits;
int TotalPixelCost = Amount > 1 ? ((Item.CostPixels * Amount) - ((int)Math.Floor((double)Amount / 6) * Item.CostPixels)) : Item.CostPixels;
int TotalDiamondCost = Amount > 1 ? ((Item.CostDiamonds * Amount) - ((int)Math.Floor((double)Amount / 6) * Item.CostDiamonds)) : Item.CostDiamonds;
if (Session.GetHabbo().Credits < TotalCreditsCost || Session.GetHabbo().Duckets < TotalPixelCost || Session.GetHabbo().Diamonds < TotalDiamondCost)
return;
int LimitedEditionSells = 0;
int LimitedEditionStack = 0;
#region Create the extradata
switch (Item.Data.InteractionType)
{
case InteractionType.NONE:
ExtraData = "";
break;
case InteractionType.GUILD_ITEM:
case InteractionType.GUILD_GATE:
break;
#region Pet handling
case InteractionType.pet0:
case InteractionType.pet1:
case InteractionType.pet2:
case InteractionType.pet3:
case InteractionType.pet4:
case InteractionType.pet5:
case InteractionType.pet6:
case InteractionType.pet7:
case InteractionType.pet8:
case InteractionType.pet9:
case InteractionType.pet10:
case InteractionType.pet11:
case InteractionType.pet12:
case InteractionType.pet13: //Caballo
case InteractionType.pet14:
case InteractionType.pet15:
case InteractionType.pet16: //Mascota agregada
case InteractionType.pet17: //Mascota agregada
case InteractionType.pet18: //Mascota agregada
case InteractionType.pet19: //Mascota agregada
case InteractionType.pet20: //Mascota agregada
case InteractionType.pet21: //Mascota agregada
case InteractionType.pet22: //Mascota agregada
case InteractionType.pet28:
case InteractionType.pet29:
case InteractionType.pet30:
try
{
string[] Bits = ExtraData.Split('\n');
string PetName = Bits[0];
string Race = Bits[1];
string Color = Bits[2];
int.Parse(Race); // to trigger any possible errors
if (!PetUtility.CheckPetName(PetName))
return;
//.........这里部分代码省略.........
示例9: OnTrigger
public void OnTrigger(GameClient Session, Item Item, int Request, bool HasRights)
{
RoomUser User = null;
if (Session != null)
User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
if (User == null)
return;
if (Gamemap.TilesTouching(Item.GetX, Item.GetY, User.X, User.Y))
{
if (Item.ExtraData == null || Item.ExtraData.Length <= 1 || !Item.ExtraData.Contains(Convert.ToChar(5).ToString()))
{
Point pointOne;
Point pointTwo;
switch (Item.Rotation)
{
case 2:
pointOne = new Point(Item.GetX, Item.GetY + 1);
pointTwo = new Point(Item.GetX, Item.GetY - 1);
break;
case 4:
pointOne = new Point(Item.GetX - 1, Item.GetY);
pointTwo = new Point(Item.GetX + 1, Item.GetY);
break;
default:
return;
}
RoomUser UserOne = Item.GetRoom().GetRoomUserManager().GetUserForSquare(pointOne.X, pointOne.Y);
RoomUser UserTwo = Item.GetRoom().GetRoomUserManager().GetUserForSquare(pointTwo.X, pointTwo.Y);
if(UserOne == null || UserTwo == null)
Session.SendNotification("We couldn't find a valid user to lock this love lock with.");
else if(UserOne.GetClient() == null || UserTwo.GetClient() == null)
Session.SendNotification("We couldn't find a valid user to lock this love lock with.");
else if(UserOne.HabboId != Item.UserID && UserTwo.HabboId != Item.UserID)
Session.SendNotification("You can only use this item with the item owner.");
else
{
UserOne.CanWalk = false;
UserTwo.CanWalk = false;
Item.InteractingUser = UserOne.GetClient().GetHabbo().Id;
Item.InteractingUser2 = UserTwo.GetClient().GetHabbo().Id;
UserOne.GetClient().SendMessage(new LoveLockDialogueMessageComposer(Item.Id));
UserTwo.GetClient().SendMessage(new LoveLockDialogueMessageComposer(Item.Id));
}
}
else
return;
}
else
{
User.MoveTo(Item.SquareInFront);
}
}