2019-06-18 22:55:32 -04:00
|
|
|
|
/*
|
|
|
|
|
===========================================================================
|
|
|
|
|
Copyright (C) 2015-2019 Project Meteor Dev Team
|
|
|
|
|
|
|
|
|
|
This file is part of Project Meteor Server.
|
|
|
|
|
|
|
|
|
|
Project Meteor Server is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU Affero General Public License as published by
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
Project Meteor Server is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
|
|
|
|
|
===========================================================================
|
|
|
|
|
*/
|
|
|
|
|
|
2019-06-19 00:05:18 -04:00
|
|
|
|
using Meteor.World.Packets.Send.Subpackets;
|
2016-08-22 10:43:04 -04:00
|
|
|
|
|
2019-06-19 00:05:18 -04:00
|
|
|
|
namespace Meteor.World.DataObjects
|
2016-08-22 10:43:04 -04:00
|
|
|
|
{
|
|
|
|
|
class Session
|
|
|
|
|
{
|
|
|
|
|
public enum Channel {ZONE, CHAT};
|
|
|
|
|
|
2016-08-24 15:41:54 -04:00
|
|
|
|
public readonly uint sessionId;
|
2016-12-13 15:02:28 -05:00
|
|
|
|
|
|
|
|
|
public string characterName;
|
|
|
|
|
public uint currentZoneId;
|
2017-01-09 23:12:56 -05:00
|
|
|
|
public string activeLinkshellName = "";
|
2016-12-13 15:02:28 -05:00
|
|
|
|
|
2016-08-24 15:41:54 -04:00
|
|
|
|
public readonly ClientConnection clientConnection;
|
2016-08-22 10:43:04 -04:00
|
|
|
|
public readonly Channel type;
|
|
|
|
|
public ZoneServer routing1, routing2;
|
|
|
|
|
|
2016-08-28 14:25:37 -04:00
|
|
|
|
public Session(uint sessionId, ClientConnection connection, Channel type)
|
2016-08-22 10:43:04 -04:00
|
|
|
|
{
|
|
|
|
|
this.sessionId = sessionId;
|
2016-08-24 15:41:54 -04:00
|
|
|
|
this.clientConnection = connection;
|
2016-08-22 10:43:04 -04:00
|
|
|
|
this.type = type;
|
2016-08-24 15:41:54 -04:00
|
|
|
|
connection.owner = this;
|
2017-01-09 23:12:56 -05:00
|
|
|
|
Database.LoadZoneSessionInfo(this);
|
2017-01-08 21:42:43 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SendGameMessage(uint actorId, ushort textId, byte log, params object[] msgParams)
|
|
|
|
|
{
|
|
|
|
|
if (msgParams == null || msgParams.Length == 0)
|
|
|
|
|
{
|
2017-06-27 17:31:17 -04:00
|
|
|
|
clientConnection.QueuePacket(GameMessagePacket.BuildPacket(0x5FF80001, actorId, 0x5FF80001, textId, log));
|
2017-01-08 21:42:43 -05:00
|
|
|
|
}
|
|
|
|
|
else
|
2017-06-27 17:31:17 -04:00
|
|
|
|
clientConnection.QueuePacket(GameMessagePacket.BuildPacket(0x5FF80001, actorId, 0x5FF80001, textId, log, LuaUtils.CreateLuaParamList(msgParams)));
|
2016-08-22 10:43:04 -04:00
|
|
|
|
}
|
2016-12-21 18:02:50 -05:00
|
|
|
|
|
|
|
|
|
public void SendGameMessage( ushort textId, byte log, params object[] msgParams)
|
|
|
|
|
{
|
|
|
|
|
if (msgParams == null || msgParams.Length == 0)
|
2017-06-27 17:31:17 -04:00
|
|
|
|
clientConnection.QueuePacket(GameMessagePacket.BuildPacket(0x5FF80001, 0x5FF80001, textId, log));
|
2016-12-21 18:02:50 -05:00
|
|
|
|
else
|
2017-06-27 17:31:17 -04:00
|
|
|
|
clientConnection.QueuePacket(GameMessagePacket.BuildPacket(0x5FF80001, 0x5FF80001, textId, log, LuaUtils.CreateLuaParamList(msgParams)));
|
2016-12-21 18:02:50 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SendGameMessage( ushort textId, byte log, string customSender, params object[] msgParams)
|
|
|
|
|
{
|
|
|
|
|
if (msgParams == null || msgParams.Length == 0)
|
2017-06-27 17:31:17 -04:00
|
|
|
|
clientConnection.QueuePacket(GameMessagePacket.BuildPacket(0x5FF80001, 0x5FF80001, textId, customSender, log));
|
2016-12-21 18:02:50 -05:00
|
|
|
|
else
|
2017-06-27 17:31:17 -04:00
|
|
|
|
clientConnection.QueuePacket(GameMessagePacket.BuildPacket(0x5FF80001, 0x5FF80001, textId, customSender, log, LuaUtils.CreateLuaParamList(msgParams)));
|
2016-12-21 18:02:50 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SendGameMessage(ushort textId, byte log, uint displayId, params object[] msgParams)
|
|
|
|
|
{
|
|
|
|
|
if (msgParams == null || msgParams.Length == 0)
|
2017-06-27 17:31:17 -04:00
|
|
|
|
clientConnection.QueuePacket(GameMessagePacket.BuildPacket(0x5FF80001, 0x5FF80001, textId, displayId, log));
|
2016-12-21 18:02:50 -05:00
|
|
|
|
else
|
2017-06-27 17:31:17 -04:00
|
|
|
|
clientConnection.QueuePacket(GameMessagePacket.BuildPacket(0x5FF80001, 0x5FF80001, textId, displayId, log, LuaUtils.CreateLuaParamList(msgParams)));
|
2016-12-21 18:02:50 -05:00
|
|
|
|
}
|
|
|
|
|
|
2017-01-09 23:12:56 -05:00
|
|
|
|
|
|
|
|
|
public bool SetActiveLS(string name)
|
|
|
|
|
{
|
|
|
|
|
if (Database.SetActiveLS(this, name))
|
|
|
|
|
{
|
|
|
|
|
activeLinkshellName = name;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2016-08-22 10:43:04 -04:00
|
|
|
|
}
|
|
|
|
|
}
|