# Conflicts:
#	FFXIVClassic Map Server/actors/Actor.cs
#	FFXIVClassic Map Server/dataobjects/Session.cs
#	FFXIVClassic Map Server/lua/LuaEngine.cs
This commit is contained in:
Tahir Akhlaq 2017-07-08 04:10:36 +01:00
commit 4695193aa0
235 changed files with 2840 additions and 1024 deletions

View file

@ -0,0 +1,61 @@
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.dataobjects
{
class GuildleveData
{
public readonly uint id;
public readonly uint classType;
public readonly uint location;
public readonly ushort factionCreditRequired;
public readonly ushort level;
public readonly uint aetheryte;
public readonly uint plateId;
public readonly uint borderId;
public readonly uint objective;
public readonly byte timeLimit;
public readonly uint skill;
public readonly byte favorCount;
public readonly sbyte[] aimNum = new sbyte[4];
public readonly uint[] itemTarget = new uint[4];
public readonly uint[] mobTarget = new uint[4];
public GuildleveData(MySqlDataReader reader)
{
id = reader.GetUInt32("id");
classType = reader.GetUInt32("classType");
location = reader.GetUInt32("location");
factionCreditRequired = reader.GetUInt16("factionCreditRequired");
level = reader.GetUInt16("level");
aetheryte = reader.GetUInt32("aetheryte");
plateId = reader.GetUInt32("plateId");
borderId = reader.GetUInt32("borderId");
objective = reader.GetUInt32("objective");
timeLimit = reader.GetByte("timeLimit");
skill = reader.GetUInt32("skill");
favorCount = reader.GetByte("favorCount");
aimNum[0] = reader.GetSByte("aimNum1");
aimNum[1] = reader.GetSByte("aimNum2");
aimNum[2] = reader.GetSByte("aimNum3");
aimNum[3] = reader.GetSByte("aimNum4");
itemTarget[0] = reader.GetUInt32("item1");
itemTarget[1] = reader.GetUInt32("item2");
itemTarget[2] = reader.GetUInt32("item3");
itemTarget[3] = reader.GetUInt32("item4");
mobTarget[0] = reader.GetUInt32("mob1");
mobTarget[1] = reader.GetUInt32("mob2");
mobTarget[2] = reader.GetUInt32("mob3");
mobTarget[3] = reader.GetUInt32("mob4");
}
}
}

View file

@ -30,7 +30,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
this.quantity = 1;
this.slot = slot;
Item gItem = Server.GetItemGamedata(itemId);
ItemData gItem = Server.GetItemGamedata(itemId);
itemType = gItem.isExclusive ? (byte)0x3 : (byte)0x0;
}

View file

@ -3,7 +3,7 @@ using System;
namespace FFXIVClassic_Map_Server.dataobjects
{
class Item
class ItemData
{
//Basic
public readonly uint catalogID;
@ -39,7 +39,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
public readonly int repairLevel;
public readonly int repairLicense;
public Item(MySqlDataReader reader)
public ItemData(MySqlDataReader reader)
{
catalogID = reader.GetUInt32("catalogID");
name = reader.GetString("name");
@ -387,7 +387,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
}
class EquipmentItem : Item
class EquipmentItem : ItemData
{
//graphics
public readonly uint graphicsWeaponId;

View file

@ -28,17 +28,18 @@ namespace FFXIVClassic_Map_Server.dataobjects
{
this.id = sessionId;
playerActor = new Player(this, sessionId);
actorInstanceList.Add(playerActor);
}
public void QueuePacket(BasePacket basePacket)
public void QueuePacket(List<SubPacket> packets)
{
Server.GetWorldConnection().QueuePacket(basePacket);
foreach (SubPacket s in packets)
QueuePacket(s);
}
public void QueuePacket(SubPacket subPacket, bool isAuthed, bool isEncrypted)
public void QueuePacket(SubPacket subPacket)
{
Server.GetWorldConnection().QueuePacket(subPacket, isAuthed, isEncrypted);
subPacket.SetTargetId(id);
Server.GetWorldConnection().QueuePacket(subPacket);
}
public Player GetActor()
@ -82,7 +83,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
playerActor.rotation = rot;
playerActor.moveState = moveState;
GetActor().zone.UpdateActorPosition(GetActor());
GetActor().GetZone().UpdateActorPosition(GetActor());
playerActor.QueuePositionUpdate(new Vector3(x,y,z));
}
@ -99,29 +100,11 @@ namespace FFXIVClassic_Map_Server.dataobjects
//Remove missing actors
for (int i = 0; i < actorInstanceList.Count; i++)
{
if (list.Contains(actorInstanceList[i]) && actorInstanceList[i] is Npc)
{
Npc npc = (Npc)actorInstanceList[i];
long milliseconds = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
if (npc.GetUniqueId().Equals("1") && milliseconds - lastMilis > 1000)
{
lastMilis = milliseconds;
GetActor().QueuePacket(RemoveActorPacket.BuildPacket(playerActor.actorId, actorInstanceList[i].actorId));
actorInstanceList.RemoveAt(i);
continue;
}
}
if (!list.Contains(actorInstanceList[i]))
{
GetActor().QueuePacket(RemoveActorPacket.BuildPacket(playerActor.actorId, actorInstanceList[i].actorId));
QueuePacket(RemoveActorPacket.BuildPacket(actorInstanceList[i].actorId));
actorInstanceList.RemoveAt(i);
}
}
}
//Add new actors or move
@ -139,16 +122,14 @@ namespace FFXIVClassic_Map_Server.dataobjects
if (actor is Character && ((Character)actor).isStatic)
continue;
var packet = actor.CreatePositionUpdatePacket(playerActor.actorId);
if (packet != null)
GetActor().QueuePacket(packet);
QueuePacket(actor.CreatePositionUpdatePacket());
}
else
{
GetActor().QueuePacket(actor.GetSpawnPackets(playerActor.actorId, 1));
GetActor().QueuePacket(actor.GetInitPackets(playerActor.actorId));
GetActor().QueuePacket(actor.GetSetEventStatusPackets(playerActor.actorId));
{
QueuePacket(actor.GetSpawnPackets(playerActor, 1));
QueuePacket(actor.GetInitPackets());
QueuePacket(actor.GetSetEventStatusPackets());
actorInstanceList.Add(actor);
if (actor is Npc)

View file

@ -17,14 +17,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
private BlockingCollection<SubPacket> SendPacketQueue = new BlockingCollection<SubPacket>(1000);
public int lastPartialSize = 0;
public void QueuePacket(BasePacket packet)
{
List<SubPacket> subPackets = packet.GetSubpackets();
foreach (SubPacket s in subPackets)
SendPacketQueue.Add(s);
}
public void QueuePacket(SubPacket subpacket, bool isAuthed, bool isEncrypted)
public void QueuePacket(SubPacket subpacket)
{
SendPacketQueue.Add(subpacket);
}
@ -68,7 +61,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
public void RequestZoneChange(uint sessionId, uint destinationZoneId, byte spawnType, float spawnX, float spawnY, float spawnZ, float spawnRotation)
{
WorldRequestZoneChangePacket.BuildPacket(sessionId, destinationZoneId, spawnType, spawnX, spawnY, spawnZ, spawnRotation).DebugPrintSubPacket();
QueuePacket(WorldRequestZoneChangePacket.BuildPacket(sessionId, destinationZoneId, spawnType, spawnX, spawnY, spawnZ, spawnRotation), true, false);
QueuePacket(WorldRequestZoneChangePacket.BuildPacket(sessionId, destinationZoneId, spawnType, spawnX, spawnY, spawnZ, spawnRotation));
}
}
}