RobinLA
New Member
- Nov 20, 2020
- 8
- 0
Hello everyone,
I try to explain my problem.
I just try to setup a RP-Hotel, but the websockets doesn't work perfectly.
Near the catalogue icon is another icon, when I click on it it's opening the "Gang"-Menu (Websockets) without any problems. (So the Websockets should work)
But every websockets which hasn't any button to click doen't work.
For examble:
I have a "Taxi"-Function. When you walk over a "Taxi"-Sign, then it should open a websockets window - but it doesn't work. (The furni is correctly linked)
Another examble:
At the top left corner of the client it should have an "health" and "energy" bar, but they aren't there...
Here is the source code for the "Taxi"-function.
Can someone please help me?
File: InteractorTaxi.cs
File: TaxiWebEvent.cs
File: ClientGetTaxi.php
I try to explain my problem.
I just try to setup a RP-Hotel, but the websockets doesn't work perfectly.
Near the catalogue icon is another icon, when I click on it it's opening the "Gang"-Menu (Websockets) without any problems. (So the Websockets should work)
But every websockets which hasn't any button to click doen't work.
For examble:
I have a "Taxi"-Function. When you walk over a "Taxi"-Sign, then it should open a websockets window - but it doesn't work. (The furni is correctly linked)
Another examble:
At the top left corner of the client it should have an "health" and "energy" bar, but they aren't there...
Here is the source code for the "Taxi"-function.
Can someone please help me?
File: InteractorTaxi.cs
C#:
using System;
using System.Linq;
using System.Text;
using System.Threading;
using System.Collections.Generic;
using System.Windows.Forms;
using Plus.Database.Interfaces;
using Plus.HabboHotel.Moderation;
using Plus.HabboHotel.GameClients;
using System.Collections;
using System.Collections.Concurrent;
using System.Drawing;
using Plus.Communication.Packets.Outgoing.Rooms.Avatar;
using Plus.Core;
using Plus.HabboHotel.Items;
using Plus.HabboHotel.Rooms;
using Plus.HabboHotel.Rooms.AI;
using Plus.HabboHotel.Quests;
using Plus.HabboHotel.Rooms.Games;
using Plus.HabboHotel.Users;
using Plus.HabboHotel.Users.Inventory;
using Plus.Communication.Packets.Incoming;
using Plus.Utilities;
using System.Data;
using Plus.Communication.Packets.Outgoing.Rooms.Session;
using Plus.Communication.Packets.Outgoing.Rooms.Engine;
using Plus.Communication.Packets.Outgoing.Rooms.Permissions;
using Plus.Communication.Packets.Outgoing.Handshake;
using System.Text.RegularExpressions;
using Plus.HabboHotel.Rooms.Games.Teams;
using System.Threading.Tasks;
using Plus.Communication.Packets.Outgoing.Rooms.Notifications;
using Plus.HabboHotel.Pathfinding;
using Plus.Communication.Packets.Outgoing;
using Plus.Communication.Packets.Outgoing.Inventory.Purse;
using Plus.Communication.Packets.Outgoing.Rooms.Chat;
namespace Plus.HabboHotel.Items.Interactor
{
public class InteractorTaxi : IFurniInteractor
{
public void OnPlace(GameClient Session, Item Item)
{
}
public void OnRemove(GameClient Session, Item Item)
{
}
public void OnTrigger(GameClient Session, Item Item, int Request, bool HasRights)
{
RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
if (!Gamemap.TilesTouching(Item.GetX, Item.GetY, User.Coordinate.X, User.Coordinate.Y) && Item.GetBaseItem().SpriteId != 3090) //6116
{
User.MoveToIfCanWalk(Item.SquareInFront);
return;
}
User.usingTaxi = true;
User.SetRot(Pathfinding.Rotation.Calculate(User.Coordinate.X, User.Coordinate.Y, Item.GetX, Item.GetY), false);
PlusEnvironment.GetGame().GetWebEventManager().SendDataDirect(Session, "TaxiWebEvent;open;");
}
public void OnWiredTrigger(Item Item)
{
}
}
}
File: TaxiWebEvent.cs
C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Plus;
using Fleck;
using Plus.HabboHotel.GameClients;
using System.Text.RegularExpressions;
using Plus.Database.Interfaces;
using Plus.HabboHotel.Rooms;
using Plus.Communication.Packets.Outgoing.Inventory.Purse;
using System.Data;
using System.Threading;
namespace Bobba.HabboRoleplay.Web.Outgoing
{
class TaxiWebEvent : IWebEvent
{
/// <summary>
/// Executes socket data.
/// </summary>
/// <param name="Client"></param>
/// <param name="Data"></param>
/// <param name="Socket"></param>
public void Execute(GameClient Client, string Data, IWebSocketConnection Socket)
{
if (!PlusEnvironment.GetGame().GetWebEventManager().SocketReady(Client, true) || !PlusEnvironment.GetGame().GetWebEventManager().SocketReady(Socket))
return;
string Action = (Data.Contains(',') ? Data.Split(',')[0] : Data);
switch (Action)
{
#region Highland Hospital
case "Genesungshalt":
{
Room Room = Client.GetHabbo().CurrentRoom;
if (Room == null)
return;
RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Client.GetHabbo().Id);
if (User == null)
return;
if (Convert.ToInt32(13) == Client.GetHabbo().CurrentRoomId)
{
Client.SendWhisper("Du befindest dich bereits im Genesungshalt.");
return;
}
if (Client.GetHabbo().Credits < 13)
{
Client.SendWhisper("Du brauchst 13 Euro, um ein Taxi zu Genesungshalt zu rufen.");
return;
}
PlusEnvironment.GetGame().GetWebEventManager().SendDataDirect(Client, "taxi;close;");
User.GetClient().Shout("*Ruft ein Taxi zu Genesungshalt*", 5);
User.ApplyEffect(596);
User.usingTaxi = true;
System.Timers.Timer Timer = new System.Timers.Timer(5000);
Timer.Interval = 5000;
Timer.Elapsed += delegate
{
if (User.usingTaxi == true)
{
Client.GetHabbo().Credits -= 13;
Client.GetHabbo().CanChangeRoom = true;
Client.GetHabbo().PrepareRoom(13, "");
}
Timer.Stop();
};
Timer.Start();
Client.SendMessage(new CreditBalanceComposer(Client.GetHabbo().Credits));
PlusEnvironment.GetGame().GetWebEventManager().SendDataDirect(Client, "my_stats;" + Client.GetHabbo().Credits + ";" + Client.GetHabbo().Duckets + ";" + Client.GetHabbo().EventPoints);
}
break;
#endregion
#region Lehkreuz
case "Lehkreuz":
{
Room Room = Client.GetHabbo().CurrentRoom;
if (Room == null)
return;
RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Client.GetHabbo().Id);
if (User == null)
return;
if (Convert.ToInt32(14) == Client.GetHabbo().CurrentRoomId)
{
Client.SendWhisper("Du befindest dich bereits im Lehkreuz.");
return;
}
if (Client.GetHabbo().Credits < 13)
{
Client.SendWhisper("Du brauchst 13 Euro, um ein Taxi zu Lehkreuz zu rufen.");
return;
}
PlusEnvironment.GetGame().GetWebEventManager().SendDataDirect(Client, "taxi;close;");
User.GetClient().Shout("*Ruft ein Taxi zu Lehkreuz*", 5);
User.ApplyEffect(596);
User.usingTaxi = true;
User.Frozen = true;
Thread.Sleep(5000);
Client.GetHabbo().Credits -= 13;
Client.GetHabbo().CanChangeRoom = true;
Client.GetHabbo().PrepareRoom(14, "");
Client.SendMessage(new CreditBalanceComposer(Client.GetHabbo().Credits));
PlusEnvironment.GetGame().GetWebEventManager().SendDataDirect(Client, "my_stats;" + Client.GetHabbo().Credits + ";" + Client.GetHabbo().Duckets + ";" + Client.GetHabbo().EventPoints);
}
break;
#endregion
#region TiffsWeg
case "TiffsWeg":
{
Room Room = Client.GetHabbo().CurrentRoom;
if (Room == null)
return;
RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Client.GetHabbo().Id);
if (User == null)
return;
if (Convert.ToInt32(15) == Client.GetHabbo().CurrentRoomId)
{
Client.SendWhisper("Du befindest dich bereits im Tiff's Weg.");
return;
}
if (Client.GetHabbo().Credits < 13)
{
Client.SendWhisper("Du brauchst 13 Euro, um ein Taxi zu Tiff's Weg zu rufen.");
return;
}
PlusEnvironment.GetGame().GetWebEventManager().SendDataDirect(Client, "taxi;close;");
User.GetClient().Shout("*Ruft ein Taxi zu Tiff's Weg*", 5);
User.ApplyEffect(596);
User.usingTaxi = true;
User.Frozen = true;
Thread.Sleep(5000);
Client.GetHabbo().Credits -= 13;
Client.GetHabbo().CanChangeRoom = true;
Client.GetHabbo().PrepareRoom(15, "");
Client.SendMessage(new CreditBalanceComposer(Client.GetHabbo().Credits));
PlusEnvironment.GetGame().GetWebEventManager().SendDataDirect(Client, "my_stats;" + Client.GetHabbo().Credits + ";" + Client.GetHabbo().Duckets + ";" + Client.GetHabbo().EventPoints);
}
break;
#endregion
#region ZudenEchos
case "ZudenEchos":
{
Room Room = Client.GetHabbo().CurrentRoom;
if (Room == null)
return;
RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Client.GetHabbo().Id);
if (User == null)
return;
if (Convert.ToInt32(18) == Client.GetHabbo().CurrentRoomId)
{
Client.SendWhisper("Du befindest dich bereits im Zu den Echos.");
return;
}
if (Client.GetHabbo().Credits < 13)
{
Client.SendWhisper("Du brauchst 13 Euro, um ein Taxi zu Zu den Echos zu rufen.");
return;
}
PlusEnvironment.GetGame().GetWebEventManager().SendDataDirect(Client, "taxi;close;");
User.GetClient().Shout("*Ruft ein Taxi zu Zu den Echos*", 5);
User.ApplyEffect(596);
User.usingTaxi = true;
User.Frozen = true;
Thread.Sleep(5000);
Client.GetHabbo().Credits -= 13;
Client.GetHabbo().CanChangeRoom = true;
Client.GetHabbo().PrepareRoom(18, "");
Client.SendMessage(new CreditBalanceComposer(Client.GetHabbo().Credits));
PlusEnvironment.GetGame().GetWebEventManager().SendDataDirect(Client, "my_stats;" + Client.GetHabbo().Credits + ";" + Client.GetHabbo().Duckets + ";" + Client.GetHabbo().EventPoints);
}
break;
#endregion
#region BeidenWohlhabenden
case "BeidenWohlhabenden":
{
Room Room = Client.GetHabbo().CurrentRoom;
if (Room == null)
return;
RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Client.GetHabbo().Id);
if (User == null)
return;
if (Convert.ToInt32(21) == Client.GetHabbo().CurrentRoomId)
{
Client.SendWhisper("Du befindest dich bereits im Bei den Wohlhabenden");
return;
}
if (Client.GetHabbo().Credits < 13)
{
Client.SendWhisper("Du brauchst 13 Euro, um ein Taxi zu Bei den Wohlhabenden zu rufen.");
return;
}
PlusEnvironment.GetGame().GetWebEventManager().SendDataDirect(Client, "taxi;close;");
User.GetClient().Shout("*Ruft ein Taxi zu Bei den Wohlhabenden*", 5);
User.ApplyEffect(596);
User.usingTaxi = true;
User.Frozen = true;
Thread.Sleep(5000);
Client.GetHabbo().Credits -= 13;
Client.GetHabbo().CanChangeRoom = true;
Client.GetHabbo().PrepareRoom(21, "");
Client.SendMessage(new CreditBalanceComposer(Client.GetHabbo().Credits));
PlusEnvironment.GetGame().GetWebEventManager().SendDataDirect(Client, "my_stats;" + Client.GetHabbo().Credits + ";" + Client.GetHabbo().Duckets + ";" + Client.GetHabbo().EventPoints);
}
break;
#endregion
}
}
}
}
File: ClientGetTaxi.php
Code:
<div class="taxiroom">
Genesungshalt
<div class="taxibutton"><input type="submit" id="Genesungshalt" value="Taxi rufen"></input></div>
</div>
<div class="taxiroom">
Lehkreuz
<div class="taxibutton"><input type="submit" id="Lehkreuz" value="Taxi rufen"></input></div>
</div>
<div class="taxiroom">
Tiff's Weg
<div class="taxibutton"><input type="submit" id="TiffsWeg" value="Taxi rufen"></input></div>
</div>
<!--
<div class="taxiroom">
Zu den Echos
<div class="taxibutton"><input type="submit" id="ZudenEchos" value="Taxi rufen"></input></div>
</div>
-->
<div class="taxiroom">
Bei den Wohlhabenden
<div class="taxibutton"><input type="submit" id="BeidenWohlhabenden" value="Taxi rufen"></input></div>
</div>
</div>