mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-08 05:24:34 +02:00
Cleaned up a lot of the "ConnectedPlayer" objects, turning them into "Session" objects. A lot of duplicate lists were also removed.
This commit is contained in:
parent
06e7ea59f4
commit
cf38454c8f
7 changed files with 131 additions and 159 deletions
|
@ -1,40 +1,24 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using FFXIVClassic.Common;
|
||||
using FFXIVClassic_Map_Server.dataobjects;
|
||||
|
||||
using System.IO;
|
||||
using FFXIVClassic_Map_Server.packets.send.actor;
|
||||
using FFXIVClassic_Map_Server;
|
||||
using FFXIVClassic_Map_Server.packets.send;
|
||||
using FFXIVClassic_Map_Server.dataobjects.chara;
|
||||
using FFXIVClassic_Map_Server.Actors;
|
||||
using FFXIVClassic_Map_Server.lua;
|
||||
using FFXIVClassic_Map_Server.actors.chara.player;
|
||||
using FFXIVClassic_Map_Server.Properties;
|
||||
|
||||
namespace FFXIVClassic_Map_Server
|
||||
{
|
||||
class CommandProcessor
|
||||
{
|
||||
private Dictionary<uint, ConnectedPlayer> mConnectedPlayerList;
|
||||
private static Dictionary<uint, Item> gamedataItems = Server.GetGamedataItems();
|
||||
|
||||
// For the moment, this is the only predefined item
|
||||
// TODO: make a list/enum in the future so that items can be given by name, instead of by id
|
||||
const UInt32 ITEM_GIL = 1000001;
|
||||
|
||||
public CommandProcessor(Dictionary<uint, ConnectedPlayer> playerList)
|
||||
{
|
||||
mConnectedPlayerList = playerList;
|
||||
}
|
||||
|
||||
|
||||
public void ChangeProperty(uint id, uint value, string target)
|
||||
{
|
||||
SetActorPropetyPacket ChangeProperty = new SetActorPropetyPacket(target);
|
||||
|
@ -43,9 +27,11 @@ namespace FFXIVClassic_Map_Server
|
|||
ChangeProperty.AddInt(id, value);
|
||||
ChangeProperty.AddTarget();
|
||||
|
||||
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
||||
Dictionary<uint, Session> sessionList = Server.GetServer().GetSessionList();
|
||||
|
||||
foreach (KeyValuePair<uint, Session> entry in sessionList)
|
||||
{
|
||||
SubPacket ChangePropertyPacket = ChangeProperty.BuildPacket((entry.Value.actorID), (entry.Value.actorID));
|
||||
SubPacket ChangePropertyPacket = ChangeProperty.BuildPacket((entry.Value.id), (entry.Value.id));
|
||||
|
||||
BasePacket packet = BasePacket.CreatePacket(ChangePropertyPacket, true, false);
|
||||
packet.DebugPrintPacket();
|
||||
|
@ -60,13 +46,13 @@ namespace FFXIVClassic_Map_Server
|
|||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="message"></param>
|
||||
private void SendMessage(ConnectedPlayer client, String message)
|
||||
private void SendMessage(Session session, String message)
|
||||
{
|
||||
if (client != null)
|
||||
client.GetActor().QueuePacket(SendMessagePacket.BuildPacket(client.actorID, client.actorID, SendMessagePacket.MESSAGE_TYPE_GENERAL_INFO, "", message));
|
||||
if (session != null)
|
||||
session.GetActor().QueuePacket(SendMessagePacket.BuildPacket(session.id, session.id, SendMessagePacket.MESSAGE_TYPE_GENERAL_INFO, "", message));
|
||||
}
|
||||
|
||||
internal bool DoCommand(string input, ConnectedPlayer client)
|
||||
internal bool DoCommand(string input, Session session)
|
||||
{
|
||||
if (!input.Any() || input.Equals(""))
|
||||
return false;
|
||||
|
@ -88,7 +74,7 @@ namespace FFXIVClassic_Map_Server
|
|||
if (cmd.Any())
|
||||
{
|
||||
// if client isnt null, take player to be the player actor
|
||||
var player = client.GetActor();
|
||||
var player = session.GetActor();
|
||||
|
||||
if (cmd.Equals("help"))
|
||||
{
|
||||
|
@ -125,11 +111,11 @@ namespace FFXIVClassic_Map_Server
|
|||
if (split[0].Equals("reloaditems"))
|
||||
{
|
||||
Program.Log.Info(String.Format("Got request to reload item gamedata"));
|
||||
SendMessage(client, "Reloading Item Gamedata...");
|
||||
SendMessage(session, "Reloading Item Gamedata...");
|
||||
gamedataItems.Clear();
|
||||
gamedataItems = Database.GetItemGamedata();
|
||||
Program.Log.Info(String.Format("Loaded {0} items.", gamedataItems.Count));
|
||||
SendMessage(client, String.Format("Loaded {0} items.", gamedataItems.Count));
|
||||
SendMessage(session, String.Format("Loaded {0} items.", gamedataItems.Count));
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue