mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-24 05:37:46 +00:00
Got the kick event packet working and implemented the director parameter in the player instantiation. The first argument of the set event status packet is an "isEnabled" flag; switched to bool rather than int.
This commit is contained in:
parent
597a800599
commit
6c3918ac2f
6 changed files with 39 additions and 46 deletions
|
@ -63,7 +63,7 @@ namespace FFXIVClassic_Lobby_Server
|
||||||
byte[] reply1Data = {
|
byte[] reply1Data = {
|
||||||
0x01, 0x00, 0x00, 0x00, 0x28, 0x0, 0x01, 0x0, 0x0, 0x0, 0x0, 0x0, 0x00, 0x00, 0x00, 0x00,
|
0x01, 0x00, 0x00, 0x00, 0x28, 0x0, 0x01, 0x0, 0x0, 0x0, 0x0, 0x0, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x18, 0x00, 0x07, 0x00, 0x00, 0x0, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7F, 0xFD, 0xFF, 0xFF,
|
0x18, 0x00, 0x07, 0x00, 0x00, 0x0, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7F, 0xFD, 0xFF, 0xFF,
|
||||||
0x43, 0xEC, 0x00, 0xE0, 0x00, 0x0, 0x00, 0x0
|
0xE5, 0x6E, 0x01, 0xE0, 0x00, 0x0, 0x00, 0x0
|
||||||
};
|
};
|
||||||
|
|
||||||
BasePacket reply1 = new BasePacket(reply1Data);
|
BasePacket reply1 = new BasePacket(reply1Data);
|
||||||
|
@ -289,6 +289,10 @@ namespace FFXIVClassic_Lobby_Server
|
||||||
if (updateOwnerActor == null)
|
if (updateOwnerActor == null)
|
||||||
{
|
{
|
||||||
updateOwnerActor = Server.GetWorldManager().GetActorInWorld(player.getActor().eventCurrentOwner);
|
updateOwnerActor = Server.GetWorldManager().GetActorInWorld(player.getActor().eventCurrentOwner);
|
||||||
|
|
||||||
|
if (player.getActor().currentDirector != null && player.getActor().eventCurrentOwner == player.getActor().currentDirector.actorId)
|
||||||
|
updateOwnerActor = player.getActor().currentDirector;
|
||||||
|
|
||||||
if (updateOwnerActor == null)
|
if (updateOwnerActor == null)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,37 +178,37 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
if (eventConditions.talkEventConditions != null)
|
if (eventConditions.talkEventConditions != null)
|
||||||
{
|
{
|
||||||
foreach (EventList.TalkEventCondition condition in eventConditions.talkEventConditions)
|
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)
|
if (eventConditions.noticeEventConditions != null)
|
||||||
{
|
{
|
||||||
foreach (EventList.NoticeEventCondition condition in eventConditions.noticeEventConditions)
|
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)
|
if (eventConditions.emoteEventConditions != null)
|
||||||
{
|
{
|
||||||
foreach (EventList.EmoteEventCondition condition in eventConditions.emoteEventConditions)
|
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)
|
if (eventConditions.pushWithCircleEventConditions != null)
|
||||||
{
|
{
|
||||||
foreach (EventList.PushCircleEventCondition condition in eventConditions.pushWithCircleEventConditions)
|
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)
|
if (eventConditions.pushWithFanEventConditions != null)
|
||||||
{
|
{
|
||||||
foreach (EventList.PushFanEventCondition condition in eventConditions.pushWithFanEventConditions)
|
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)
|
if (eventConditions.pushWithBoxEventConditions != null)
|
||||||
{
|
{
|
||||||
foreach (EventList.PushBoxEventCondition condition in eventConditions.pushWithBoxEventConditions)
|
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);
|
return BasePacket.createPacket(subpackets, true, false);
|
||||||
|
|
|
@ -9,6 +9,7 @@ using FFXIVClassic_Map_Server.dataobjects.chara;
|
||||||
using FFXIVClassic_Map_Server.lua;
|
using FFXIVClassic_Map_Server.lua;
|
||||||
using FFXIVClassic_Map_Server.packets.send;
|
using FFXIVClassic_Map_Server.packets.send;
|
||||||
using FFXIVClassic_Map_Server.packets.send.actor;
|
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.Actor.inventory;
|
using FFXIVClassic_Map_Server.packets.send.Actor.inventory;
|
||||||
using FFXIVClassic_Map_Server.packets.send.events;
|
using FFXIVClassic_Map_Server.packets.send.events;
|
||||||
|
@ -124,7 +125,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
public Quest[] questScenario = new Quest[16];
|
public Quest[] questScenario = new Quest[16];
|
||||||
public Quest[] questGuildleve = new Quest[8];
|
public Quest[] questGuildleve = new Quest[8];
|
||||||
|
|
||||||
public Director currentDirector = new OpeningDirector(0x46080012);
|
public Director currentDirector;// = new OpeningDirector(0x46080012);
|
||||||
|
|
||||||
public PlayerWork playerWork = new PlayerWork();
|
public PlayerWork playerWork = new PlayerWork();
|
||||||
|
|
||||||
|
@ -254,7 +255,10 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
List<LuaParam> lParams;
|
List<LuaParam> lParams;
|
||||||
if (isMyPlayer(playerActorId))
|
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
|
else
|
||||||
lParams = LuaUtils.createLuaParamList("/Chara/Player/Player_work", false, false, false, false, false, true);
|
lParams = LuaUtils.createLuaParamList("/Chara/Player/Player_work", false, false, false, false, false, true);
|
||||||
|
@ -480,13 +484,12 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendZoneInPackets(WorldManager world, ushort spawnType)
|
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(SetMusicPacket.buildPacket(actorId, zone.bgmDay, 0x01));
|
||||||
queuePacket(SetWeatherPacket.buildPacket(actorId, SetWeatherPacket.WEATHER_CLEAR));
|
queuePacket(SetWeatherPacket.buildPacket(actorId, SetWeatherPacket.WEATHER_CLEAR));
|
||||||
|
|
||||||
queuePacket(getSpawnPackets(actorId, spawnType));
|
queuePacket(getSpawnPackets(actorId, spawnType));
|
||||||
|
|
||||||
//getSpawnPackets(actorId, spawnType).debugPrintPacket();
|
//getSpawnPackets(actorId, spawnType).debugPrintPacket();
|
||||||
|
|
||||||
#region grouptest
|
#region grouptest
|
||||||
|
@ -561,8 +564,6 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
//playerSession.queuePacket(reply10);
|
//playerSession.queuePacket(reply10);
|
||||||
// playerSession.queuePacket(reply11);
|
// playerSession.queuePacket(reply11);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
kickEvent(currentDirector, "noticeEvent", "noticeEvent");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendRemoveInventoryPackets(List<ushort> slots)
|
private void sendRemoveInventoryPackets(List<ushort> slots)
|
||||||
|
@ -587,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)
|
public bool isMyPlayer(uint otherActorId)
|
||||||
{
|
{
|
||||||
return actorId == otherActorId;
|
return actorId == otherActorId;
|
||||||
|
@ -1066,6 +1041,11 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
queuePacket(spacket);
|
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)
|
public void runEventFunction(string functionName, params object[] parameters)
|
||||||
{
|
{
|
||||||
List<LuaParam> lParams = LuaUtils.createLuaParamList(parameters);
|
List<LuaParam> lParams = LuaUtils.createLuaParamList(parameters);
|
||||||
|
@ -1077,6 +1057,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
public void endEvent()
|
public void endEvent()
|
||||||
{
|
{
|
||||||
SubPacket p = EndEventPacket.buildPacket(actorId, eventCurrentOwner, eventCurrentStarter);
|
SubPacket p = EndEventPacket.buildPacket(actorId, eventCurrentOwner, eventCurrentStarter);
|
||||||
|
p.debugPrintSubPacket();
|
||||||
queuePacket(p);
|
queuePacket(p);
|
||||||
|
|
||||||
eventCurrentOwner = 0;
|
eventCurrentOwner = 0;
|
||||||
|
|
|
@ -93,7 +93,9 @@ namespace FFXIVClassic_Map_Server.lua
|
||||||
objects.Add(player);
|
objects.Add(player);
|
||||||
objects.Add(target);
|
objects.Add(target);
|
||||||
objects.Add(eventStart.triggerName);
|
objects.Add(eventStart.triggerName);
|
||||||
objects.AddRange(LuaUtils.createLuaParamObjectList(eventStart.luaParams));
|
|
||||||
|
if (eventStart.luaParams != null)
|
||||||
|
objects.AddRange(LuaUtils.createLuaParamObjectList(eventStart.luaParams));
|
||||||
|
|
||||||
//Run Script
|
//Run Script
|
||||||
DynValue result = script.Call(script.Globals["onEventStarted"], objects.ToArray());
|
DynValue result = script.Call(script.Globals["onEventStarted"], objects.ToArray());
|
||||||
|
@ -110,12 +112,14 @@ namespace FFXIVClassic_Map_Server.lua
|
||||||
|
|
||||||
public static void doActorOnEventUpdated(Player player, Actor target, EventUpdatePacket eventUpdate)
|
public static void doActorOnEventUpdated(Player player, Actor target, EventUpdatePacket eventUpdate)
|
||||||
{
|
{
|
||||||
string luaPath;
|
string luaPath;
|
||||||
|
|
||||||
if (target is Command)
|
if (target is Command)
|
||||||
luaPath = String.Format(FILEPATH_COMMANDS, target.getName());
|
luaPath = String.Format(FILEPATH_COMMANDS, target.getName());
|
||||||
|
else if (target is Director)
|
||||||
|
luaPath = String.Format(FILEPATH_DIRECTORS, target.getName());
|
||||||
else
|
else
|
||||||
luaPath = String.Format(FILEPATH_NPCS, target.zoneId, target.getName());
|
luaPath = String.Format(FILEPATH_NPCS, target.zoneId, target.getName());
|
||||||
|
|
||||||
if (File.Exists(luaPath))
|
if (File.Exists(luaPath))
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events
|
||||||
public const ushort OPCODE = 0x0136;
|
public const ushort OPCODE = 0x0136;
|
||||||
public const uint PACKET_SIZE = 0x48;
|
public const uint PACKET_SIZE = 0x48;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, uint sourceActorID, uint unknown1, byte unknown2, string conditionName)
|
public static SubPacket buildPacket(uint playerActorID, uint sourceActorID, bool enabled, byte unknown2, string conditionName)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events
|
||||||
{
|
{
|
||||||
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
||||||
{
|
{
|
||||||
binWriter.Write((UInt32)unknown1);
|
binWriter.Write((UInt32)(enabled ? 1 : 0));
|
||||||
binWriter.Write((Byte)unknown2);
|
binWriter.Write((Byte)unknown2);
|
||||||
binWriter.Write(Encoding.ASCII.GetBytes(conditionName), 0, Encoding.ASCII.GetByteCount(conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(conditionName));
|
binWriter.Write(Encoding.ASCII.GetBytes(conditionName), 0, Encoding.ASCII.GetByteCount(conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(conditionName));
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,9 +25,13 @@ namespace FFXIVClassic_Map_Server.packets.send.events
|
||||||
binWriter.Write((UInt32)playerActorId);
|
binWriter.Write((UInt32)playerActorId);
|
||||||
binWriter.Write((UInt32)targetActorId);
|
binWriter.Write((UInt32)targetActorId);
|
||||||
binWriter.Write((Byte)0x5);
|
binWriter.Write((Byte)0x5);
|
||||||
|
binWriter.Write((Byte)0x87);
|
||||||
|
binWriter.Write((Byte)0xDC);
|
||||||
|
binWriter.Write((Byte)0x75);
|
||||||
|
binWriter.Write((UInt32)0x30400000);
|
||||||
binWriter.Write(Encoding.ASCII.GetBytes(conditionName), 0, Encoding.ASCII.GetByteCount(conditionName) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(conditionName));
|
binWriter.Write(Encoding.ASCII.GetBytes(conditionName), 0, Encoding.ASCII.GetByteCount(conditionName) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(conditionName));
|
||||||
|
|
||||||
binWriter.Seek(0x29, SeekOrigin.Begin);
|
binWriter.Seek(0x30, SeekOrigin.Begin);
|
||||||
|
|
||||||
LuaUtils.writeLuaParams(binWriter, luaParams);
|
LuaUtils.writeLuaParams(binWriter, luaParams);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue