Merge branch 'develop'

# Conflicts:
#	FFXIVClassic Map Server/FFXIVClassic Map Server.csproj
This commit is contained in:
Filip Maj 2016-04-01 23:27:34 -04:00
commit 91842ab08a
24 changed files with 731 additions and 342 deletions

View file

@ -67,8 +67,8 @@ namespace FFXIVClassic_Map_Server.Actors
}
public SubPacket createNamePacket(uint playerActorId)
{
return SetActorNamePacket.buildPacket(actorId, playerActorId, displayNameId, displayNameId == 0xFFFFFFFF ? customDisplayName : "");
{
return SetActorNamePacket.buildPacket(actorId, playerActorId, displayNameId, displayNameId == 0xFFFFFFFF | displayNameId == 0x0 ? customDisplayName : "");
}
public SubPacket createSpeedPacket(uint playerActorId)
@ -94,8 +94,6 @@ namespace FFXIVClassic_Map_Server.Actors
//return SetActorPositionPacket.buildPacket(actorId, playerActorId, -211.895477f, 190.000000f, 29.651011f, 2.674819f, SetActorPositionPacket.SPAWNTYPE_PLAYERWAKE);
spawnedFirstTime = true;
spawnPacket.debugPrintSubPacket();
return spawnPacket;
}
@ -180,37 +178,37 @@ namespace FFXIVClassic_Map_Server.Actors
if (eventConditions.talkEventConditions != null)
{
foreach (EventList.TalkEventCondition condition in eventConditions.talkEventConditions)
subpackets.Add(SetEventStatus.buildPacket(playerActorId, actorId, 1, 1, condition.conditionName));
subpackets.Add(SetEventStatus.buildPacket(playerActorId, actorId, true, 1, condition.conditionName));
}
if (eventConditions.noticeEventConditions != null)
{
foreach (EventList.NoticeEventCondition condition in eventConditions.noticeEventConditions)
subpackets.Add(SetEventStatus.buildPacket(playerActorId, actorId, 1, 1, condition.conditionName));
subpackets.Add(SetEventStatus.buildPacket(playerActorId, actorId, true, 1, condition.conditionName));
}
if (eventConditions.emoteEventConditions != null)
{
foreach (EventList.EmoteEventCondition condition in eventConditions.emoteEventConditions)
subpackets.Add(SetEventStatus.buildPacket(playerActorId, actorId, 1, 3, condition.conditionName));
subpackets.Add(SetEventStatus.buildPacket(playerActorId, actorId, true, 3, condition.conditionName));
}
if (eventConditions.pushWithCircleEventConditions != null)
{
foreach (EventList.PushCircleEventCondition condition in eventConditions.pushWithCircleEventConditions)
subpackets.Add(SetEventStatus.buildPacket(playerActorId, actorId, 1, 2, condition.conditionName));
subpackets.Add(SetEventStatus.buildPacket(playerActorId, actorId, true, 2, condition.conditionName));
}
if (eventConditions.pushWithFanEventConditions != null)
{
foreach (EventList.PushFanEventCondition condition in eventConditions.pushWithFanEventConditions)
subpackets.Add(SetEventStatus.buildPacket(playerActorId, actorId, 1, 2, condition.conditionName));
subpackets.Add(SetEventStatus.buildPacket(playerActorId, actorId, true, 2, condition.conditionName));
}
if (eventConditions.pushWithBoxEventConditions != null)
{
foreach (EventList.PushBoxEventCondition condition in eventConditions.pushWithBoxEventConditions)
subpackets.Add(SetEventStatus.buildPacket(playerActorId, actorId, 1, 2, condition.conditionName));
subpackets.Add(SetEventStatus.buildPacket(playerActorId, actorId, true, 2, condition.conditionName));
}
return BasePacket.createPacket(subpackets, true, false);
@ -227,7 +225,7 @@ namespace FFXIVClassic_Map_Server.Actors
}
public virtual BasePacket getSpawnPackets(uint playerActorId)
{
{
return getSpawnPackets(playerActorId, 0x1);
}

View file

@ -27,6 +27,13 @@ namespace FFXIVClassic_Map_Server.actors
public byte unknown1;
public byte unknown2;
public string conditionName;
public NoticeEventCondition(string name, byte unk1, byte unk2)
{
conditionName = name;
unknown1 = unk1;
unknown2 = unk2;
}
}
public class EmoteEventCondition

View file

@ -88,7 +88,6 @@ namespace FFXIVClassic_Map_Server.Actors
subpackets.Add(createStatePacket(playerActorId));
subpackets.Add(createIsZoneingPacket(playerActorId));
subpackets.Add(createScriptBindPacket(playerActorId));
subpackets[6].debugPrintSubPacket();
return BasePacket.createPacket(subpackets, true, false);
}

View file

@ -3,11 +3,13 @@ using FFXIVClassic_Lobby_Server.common;
using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.actors.area;
using FFXIVClassic_Map_Server.actors.chara.player;
using FFXIVClassic_Map_Server.actors.director;
using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Map_Server.dataobjects.chara;
using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send;
using FFXIVClassic_Map_Server.packets.send.actor;
using FFXIVClassic_Map_Server.packets.send.actor.events;
using FFXIVClassic_Map_Server.packets.send.actor.inventory;
using FFXIVClassic_Map_Server.packets.send.Actor.inventory;
using FFXIVClassic_Map_Server.packets.send.events;
@ -89,6 +91,7 @@ namespace FFXIVClassic_Map_Server.Actors
public uint playTime;
public uint lastPlayTimeUpdate;
public bool isGM = false;
public bool isZoneChanging = true;
//Inventory
private Dictionary<ushort, Inventory> inventories = new Dictionary<ushort, Inventory>();
@ -122,6 +125,8 @@ namespace FFXIVClassic_Map_Server.Actors
public Quest[] questScenario = new Quest[16];
public Quest[] questGuildleve = new Quest[8];
public Director currentDirector;// = new OpeningDirector(0x46080012);
public PlayerWork playerWork = new PlayerWork();
public ConnectedPlayer playerSession;
@ -250,7 +255,10 @@ namespace FFXIVClassic_Map_Server.Actors
List<LuaParam> lParams;
if (isMyPlayer(playerActorId))
{
lParams = LuaUtils.createLuaParamList("/Chara/Player/Player_work", false, false, false, true, 0, false, timers, true);
if (currentDirector != null)
lParams = LuaUtils.createLuaParamList("/Chara/Player/Player_work", false, false, true, currentDirector, 0, false, timers, true);
else
lParams = LuaUtils.createLuaParamList("/Chara/Player/Player_work", false, false, false, true, 0, false, timers, true);
}
else
lParams = LuaUtils.createLuaParamList("/Chara/Player/Player_work", false, false, false, false, false, true);
@ -476,12 +484,13 @@ namespace FFXIVClassic_Map_Server.Actors
}
public void sendZoneInPackets(WorldManager world, ushort spawnType)
{
queuePacket(SetMapPacket.buildPacket(actorId, zone.regionId, zone.actorId));
{
queuePacket(SetMapPacket.buildPacket(actorId, zone.regionId, zone.actorId));
queuePacket(SetMusicPacket.buildPacket(actorId, zone.bgmDay, 0x01));
queuePacket(SetWeatherPacket.buildPacket(actorId, SetWeatherPacket.WEATHER_CLEAR));
queuePacket(getSpawnPackets(actorId, spawnType));
queuePacket(getSpawnPackets(actorId, spawnType));
//getSpawnPackets(actorId, spawnType).debugPrintPacket();
#region grouptest
//Retainers
@ -518,19 +527,43 @@ namespace FFXIVClassic_Map_Server.Actors
BasePacket areaMasterSpawn = zone.getSpawnPackets(actorId);
BasePacket debugSpawn = world.GetDebugActor().getSpawnPackets(actorId);
BasePacket worldMasterSpawn = world.GetActor().getSpawnPackets(actorId);
BasePacket directorSpawn = null;
if (currentDirector != null)
directorSpawn = currentDirector.getSpawnPackets(actorId);
playerSession.queuePacket(areaMasterSpawn);
playerSession.queuePacket(debugSpawn);
if (directorSpawn != null)
{
directorSpawn.debugPrintPacket();
currentDirector.getInitPackets(actorId).debugPrintPacket();
queuePacket(directorSpawn);
queuePacket(currentDirector.getInitPackets(actorId));
//queuePacket(currentDirector.getSetEventStatusPackets(actorId));
}
playerSession.queuePacket(worldMasterSpawn);
if (zone.isInn)
{
SetCutsceneBookPacket cutsceneBookPacket = new SetCutsceneBookPacket();
for (int i = 64; i < 1200; i++)
cutsceneBookPacket.cutsceneFlags[i] = true;
SubPacket packet = cutsceneBookPacket.buildPacket(actorId, "Test PathCompanion", 11, 1, 1);
packet.debugPrintSubPacket();
queuePacket(packet);
}
#region hardcode
BasePacket reply10 = new BasePacket("./packets/login/login10.bin"); //Item Storage, Inn Door created
BasePacket reply11 = new BasePacket("./packets/login/login11.bin"); //NPC Create ??? Final init
reply10.replaceActorID(actorId);
reply11.replaceActorID(actorId);
playerSession.queuePacket(reply10);
playerSession.queuePacket(reply11);
//playerSession.queuePacket(reply10);
// playerSession.queuePacket(reply11);
#endregion
}
private void sendRemoveInventoryPackets(List<ushort> slots)
@ -555,32 +588,6 @@ namespace FFXIVClassic_Map_Server.Actors
}
/*
private void sendEquipmentPackets(List<int> indexes)
{
int currentIndex = 0;
InventorySetBeginPacket.buildPacket(actorId, MAXSIZE_INVENTORY_EQUIPMENT, InventorySetBeginPacket.CODE_EQUIPMENT);
while (true)
{
if (indexes.Count - currentIndex >= 64)
queuePacket(EquipmentListX64Packet.buildPacket(actorId, indexes, ref currentIndex));
else if (indexes.Count - currentIndex >= 32)
queuePacket(EquipmentListX32Packet.buildPacket(actorId, indexes, ref currentIndex));
else if (indexes.Count - currentIndex >= 16)
queuePacket(EquipmentListX16Packet.buildPacket(actorId, indexes, ref currentIndex));
else if (indexes.Count - currentIndex >= 8)
queuePacket(EquipmentListX08Packet.buildPacket(actorId, indexes, ref currentIndex));
else if (indexes.Count - currentIndex == 1)
queuePacket(EquipmentListX01Packet.buildPacket(actorId, indexes[currentIndex]));
else
break;
}
InventorySetEndPacket.buildPacket(actorId);
}
*/
public bool isMyPlayer(uint otherActorId)
{
return actorId == otherActorId;
@ -945,11 +952,63 @@ namespace FFXIVClassic_Map_Server.Actors
return null;
}
public void setZoneChanging(bool flag)
{
isZoneChanging = flag;
}
public bool isInZoneChange()
{
return isZoneChanging;
}
public Equipment getEquipment()
{
return equipment;
}
public Quest getQuest(uint id)
{
for (int i = 0; i < questScenario.Length; i++)
{
if (questScenario[i] != null && questScenario[i].actorId == (0xA0F00000 | id))
return questScenario[i];
}
return null;
}
public bool hasQuest(uint id)
{
for (int i = 0; i < questScenario.Length; i++)
{
if (questScenario[i] != null && questScenario[i].actorId == (0xA0F00000 | id))
return true;
}
return false;
}
public void setDirector(string directorType)
{
if (directorType.Equals("openingDirector"))
{
currentDirector = new OpeningDirector(0x46080012);
}
queuePacket(RemoveActorPacket.buildPacket(actorId, 0x46080012));
queuePacket(currentDirector.getSpawnPackets(actorId));
queuePacket(currentDirector.getInitPackets(actorId));
// queuePacket(currentDirector.getSetEventStatusPackets(actorId));
// currentDirector.getSpawnPackets(actorId).debugPrintPacket();
// currentDirector.getInitPackets(actorId).debugPrintPacket();
}
public Director getDirector()
{
return currentDirector;
}
public void examinePlayer(Actor examinee)
{
Player toBeExamined;
@ -971,6 +1030,22 @@ namespace FFXIVClassic_Map_Server.Actors
queuePacket(spacket);
}
public void kickEvent(Actor actor, string conditionName, params object[] parameters)
{
if (actor == null)
return;
List<LuaParam> lParams = LuaUtils.createLuaParamList(parameters);
SubPacket spacket = KickEventPacket.buildPacket(actorId, actor.actorId, conditionName, lParams);
spacket.debugPrintSubPacket();
queuePacket(spacket);
}
public void setEventStatus(Actor actor, string conditionName, bool enabled, byte unknown)
{
queuePacket(SetEventStatus.buildPacket(actorId, actor.actorId, enabled, unknown, conditionName));
}
public void runEventFunction(string functionName, params object[] parameters)
{
List<LuaParam> lParams = LuaUtils.createLuaParamList(parameters);
@ -982,6 +1057,7 @@ namespace FFXIVClassic_Map_Server.Actors
public void endEvent()
{
SubPacket p = EndEventPacket.buildPacket(actorId, eventCurrentOwner, eventCurrentStarter);
p.debugPrintSubPacket();
queuePacket(p);
eventCurrentOwner = 0;

View file

@ -0,0 +1,41 @@
using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic_Map_Server.packets.send.actor;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.actors.director
{
class Director : Actor
{
public Director(uint id) : base(id)
{
}
public virtual BasePacket getSpawnPackets(uint playerActorId, uint spawnType)
{
List<SubPacket> subpackets = new List<SubPacket>();
subpackets.Add(createAddActorPacket(playerActorId, 0));
subpackets.AddRange(getEventConditionPackets(playerActorId));
subpackets.Add(createSpeedPacket(playerActorId));
subpackets.Add(createSpawnPositonPacket(playerActorId, 0));
subpackets.Add(createNamePacket(playerActorId));
subpackets.Add(createStatePacket(playerActorId));
subpackets.Add(createIsZoneingPacket(playerActorId));
subpackets.Add(createScriptBindPacket(playerActorId));
return BasePacket.createPacket(subpackets, true, false);
}
public override BasePacket getInitPackets(uint playerActorId)
{
SetActorPropetyPacket initProperties = new SetActorPropetyPacket("/_init");
initProperties.addTarget();
return BasePacket.createPacket(initProperties.buildPacket(playerActorId, actorId), true, false);
}
}
}

View file

@ -0,0 +1,39 @@
using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send.actor;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.actors.director
{
class OpeningDirector : Director
{
public OpeningDirector(uint id) : base(id)
{
this.displayNameId = 0;
this.customDisplayName = "openingDire";
this.actorName = "openingDire";
this.className = "OpeningDirector";
this.eventConditions = new EventList();
List<EventList.NoticeEventCondition> noticeEventList = new List<EventList.NoticeEventCondition>();
noticeEventList.Add(new EventList.NoticeEventCondition("noticeEvent", 0xE, 0x0));
noticeEventList.Add(new EventList.NoticeEventCondition("noticeRequest", 0x0, 0x1));
this.eventConditions.noticeEventConditions = noticeEventList;
}
public override SubPacket createScriptBindPacket(uint playerActorId)
{
List<LuaParam> lParams;
lParams = LuaUtils.createLuaParamList("/Director/OpeningDirector", false, false, false, false, 0x13881);
return ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, className, lParams);
}
}
}

View file

@ -1,4 +1,5 @@
using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.actors.director;
using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send.actor;
@ -10,12 +11,12 @@ using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.Actors
{
class WeatherDirector : Actor
class WeatherDirector : Director
{
private uint weatherId;
public WeatherDirector(uint weatherId)
: base(0x5FF80002)
: base(0x5FF80003)
{
this.weatherId = weatherId;