Implemented WeatherDirector , ZoneMaster, and WorldMaster in code. Zone objects has become the ZoneMaster actor object.

This commit is contained in:
Filip Maj 2016-01-16 23:03:04 -05:00
parent 724445a54a
commit 1c845e62e3
9 changed files with 209 additions and 18 deletions

View File

@ -67,8 +67,11 @@
<Compile Include="actors\chara\npc\NpcWork.cs" /> <Compile Include="actors\chara\npc\NpcWork.cs" />
<Compile Include="actors\chara\AetheryteWork.cs" /> <Compile Include="actors\chara\AetheryteWork.cs" />
<Compile Include="actors\chara\Work.cs" /> <Compile Include="actors\chara\Work.cs" />
<Compile Include="actors\debug\Debug.cs" />
<Compile Include="actors\director\WeatherDirector.cs" />
<Compile Include="actors\judge\Judge.cs" /> <Compile Include="actors\judge\Judge.cs" />
<Compile Include="actors\StaticActors.cs" /> <Compile Include="actors\StaticActors.cs" />
<Compile Include="actors\world\WorldMaster.cs" />
<Compile Include="ClientConnection.cs" /> <Compile Include="ClientConnection.cs" />
<Compile Include="common\Bitfield.cs" /> <Compile Include="common\Bitfield.cs" />
<Compile Include="common\Blowfish.cs" /> <Compile Include="common\Blowfish.cs" />
@ -208,16 +211,13 @@
<Compile Include="utils\ActorPropertyPacketUtil.cs" /> <Compile Include="utils\ActorPropertyPacketUtil.cs" />
<Compile Include="utils\CharacterUtils.cs" /> <Compile Include="utils\CharacterUtils.cs" />
<Compile Include="utils\SQLGeneration.cs" /> <Compile Include="utils\SQLGeneration.cs" />
<Compile Include="Zone.cs" /> <Compile Include="actors\area\Zone.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="App.config" /> <None Include="App.config" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup />
<Folder Include="actors\area\" />
<Folder Include="actors\director\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup> <PropertyGroup>
<PostBuildEvent> <PostBuildEvent>

View File

@ -34,6 +34,8 @@ using FFXIVClassic_Map_Server.dataobjects.actors;
using FFXIVClassic_Map_Server.dataobjects.chara.npc; using FFXIVClassic_Map_Server.dataobjects.chara.npc;
using FFXIVClassic_Map_Server.actors; using FFXIVClassic_Map_Server.actors;
using System.Net; using System.Net;
using FFXIVClassic_Map_Server.actors.debug;
using FFXIVClassic_Map_Server.actors.world;
namespace FFXIVClassic_Lobby_Server namespace FFXIVClassic_Lobby_Server
{ {
@ -44,7 +46,10 @@ namespace FFXIVClassic_Lobby_Server
List<ClientConnection> mConnections; List<ClientConnection> mConnections;
StaticActors mStaticActors = new StaticActors(); StaticActors mStaticActors = new StaticActors();
Zone inn = new Zone();
DebugProg debug = new DebugProg();
WorldMaster worldMaster = new WorldMaster();
Zone inn = new Zone(0xF4, "prv0Inn01", 0xD1, false, false, false, false);
public PacketProcessor(Dictionary<uint, ConnectedPlayer> playerList, List<ClientConnection> connectionList) public PacketProcessor(Dictionary<uint, ConnectedPlayer> playerList, List<ClientConnection> connectionList)
{ {
@ -182,8 +187,7 @@ namespace FFXIVClassic_Lobby_Server
break; break;
//Unknown //Unknown
case 0x0002: case 0x0002:
BasePacket reply8 = new BasePacket("./packets/login/login8_data.bin"); //Debug, World Master, Director created BasePacket reply9 = new BasePacket("./packets/login/login9_zonesetup.bin"); //Bed, Book created
BasePacket reply9 = new BasePacket("./packets/login/login9_zonesetup.bin"); //Area Master, Bed, Book created
BasePacket reply10 = new BasePacket("./packets/login/login10.bin"); //Item Storage, Inn Door created 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 BasePacket reply11 = new BasePacket("./packets/login/login11.bin"); //NPC Create ??? Final init
@ -191,7 +195,6 @@ namespace FFXIVClassic_Lobby_Server
//currancy.replaceActorID(player.actorID); //currancy.replaceActorID(player.actorID);
//keyitems.replaceActorID(player.actorID); //keyitems.replaceActorID(player.actorID);
reply8.replaceActorID(player.actorID);
reply9.replaceActorID(player.actorID); reply9.replaceActorID(player.actorID);
reply10.replaceActorID(player.actorID); reply10.replaceActorID(player.actorID);
reply11.replaceActorID(player.actorID); reply11.replaceActorID(player.actorID);
@ -290,12 +293,20 @@ namespace FFXIVClassic_Lobby_Server
#endregion #endregion
BasePacket tpacket = player.getActor().getInitPackets(player.actorID); BasePacket tpacket = player.getActor().getInitPackets(player.actorID);
tpacket.debugPrintPacket(); //tpacket.debugPrintPacket();
client.queuePacket(tpacket); client.queuePacket(tpacket);
inn.addActorToZone(player.getActor()); inn.addActorToZone(player.getActor());
client.queuePacket(reply8); BasePacket innSpawn = inn.getSpawnPackets(player.actorID);
BasePacket debugSpawn = debug.getSpawnPackets(player.actorID);
BasePacket worldMasterSpawn = worldMaster.getSpawnPackets(player.actorID);
innSpawn.debugPrintPacket();
client.queuePacket(innSpawn);
client.queuePacket(debugSpawn);
client.queuePacket(worldMasterSpawn);
client.queuePacket(reply9); client.queuePacket(reply9);
client.queuePacket(reply10); client.queuePacket(reply10);
client.queuePacket(reply11); client.queuePacket(reply11);

View File

@ -24,7 +24,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
public ushort currentMainState = SetActorStatePacket.MAIN_STATE_PASSIVE; public ushort currentMainState = SetActorStatePacket.MAIN_STATE_PASSIVE;
public ushort currentSubState = SetActorStatePacket.SUB_STATE_NONE; public ushort currentSubState = SetActorStatePacket.SUB_STATE_NONE;
public float positionX = SetActorPositionPacket.INNPOS_X, positionY = SetActorPositionPacket.INNPOS_Y, positionZ = SetActorPositionPacket.INNPOS_Z, rotation = SetActorPositionPacket.INNPOS_ROT; public float positionX, positionY, positionZ, rotation;
public float oldPositionX, oldPositionY, oldPositionZ, oldRotation; public float oldPositionX, oldPositionY, oldPositionZ, oldRotation;
public ushort moveState, oldMoveState; public ushort moveState, oldMoveState;

View File

@ -1,5 +1,8 @@
using FFXIVClassic_Lobby_Server.common; using FFXIVClassic_Lobby_Server.common;
using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.dataobjects; using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send.actor;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -8,19 +11,36 @@ using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server namespace FFXIVClassic_Map_Server
{ {
class Zone class Zone : Actor
{ {
public uint mapId; public string zoneName;
public ushort regionId;
public bool canStealth, isInn, canRideChocobo, isInstanceRaid;
public ushort weatherNormal, weatherCommon, weatherRare; public ushort weatherNormal, weatherCommon, weatherRare;
public ushort bgmDay, bgmNight, bgmBattle; public ushort bgmDay, bgmNight, bgmBattle;
public int boundingGridSize = 50; public int boundingGridSize = 50;
public int minX = -100, minY = -100, maxX = 100, maxY = 100; public int minX = -100, minY = -100, maxX = 100, maxY = 100;
private int numXBlocks, numYBlocks; private int numXBlocks, numYBlocks;
private int halfWidth, halfHeight; private int halfWidth, halfHeight;
private List<Actor>[,] actorBlock; private List<Actor>[,] actorBlock;
public Zone() public Zone(uint id, string zoneName, ushort regionId, bool canStealth, bool isInn, bool canRideChocobo, bool isInstanceRaid) : base(id)
{ {
this.zoneName = zoneName;
this.regionId = regionId;
this.canStealth = canStealth;
this.isInn = isInn;
this.canRideChocobo = canRideChocobo;
this.isInstanceRaid = isInstanceRaid;
this.displayNameId = 0;
this.customDisplayName = "_areaMaster";
this.actorName = String.Format("_areaMaster@{0:X5}",id<<8);
this.className = "ZoneMasterPrvI0";
numXBlocks = (maxX - minX) / boundingGridSize; numXBlocks = (maxX - minX) / boundingGridSize;
numYBlocks = (maxY - minY) / boundingGridSize; numYBlocks = (maxY - minY) / boundingGridSize;
actorBlock = new List<Actor>[numXBlocks, numYBlocks]; actorBlock = new List<Actor>[numXBlocks, numYBlocks];
@ -37,6 +57,26 @@ namespace FFXIVClassic_Map_Server
} }
public override SubPacket createScriptBindPacket(uint playerActorId)
{
List<LuaParam> lParams;
lParams = LuaUtils.createLuaParamList("/Area/Zone/ZoneMasterPrvI0", false, true, zoneName, "", 0xFFFFFFFF, false, false, canStealth, isInn, false, false, false, false, false, false);
return ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, className, lParams);
}
public override BasePacket getSpawnPackets(uint playerActorId)
{
List<SubPacket> subpackets = new List<SubPacket>();
subpackets.Add(createAddActorPacket(playerActorId));
subpackets.Add(createSpeedPacket(playerActorId));
subpackets.Add(createSpawnPositonPacket(playerActorId, 0x1));
subpackets.Add(createNamePacket(playerActorId));
subpackets.Add(createStatePacket(playerActorId));
subpackets.Add(createIsZoneingPacket(playerActorId));
subpackets.Add(createScriptBindPacket(playerActorId));
return BasePacket.createPacket(subpackets, true, false);
}
#region Actor Management #region Actor Management
public void addActorToZone(Actor actor) public void addActorToZone(Actor actor)

View File

@ -0,0 +1,47 @@
using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.dataobjects;
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.debug
{
class DebugProg : Actor
{
public DebugProg()
: base(0x5FF80002)
{
this.displayNameId = 0;
this.customDisplayName = "debug";
this.actorName = "debug";
this.className = "Debug";
}
public override SubPacket createScriptBindPacket(uint playerActorId)
{
List<LuaParam> lParams;
lParams = LuaUtils.createLuaParamList("/System/Debug.prog", false, false, false, false, true, 0xC51F, true, true);
return ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, className, lParams);
}
public override BasePacket getSpawnPackets(uint playerActorId)
{
List<SubPacket> subpackets = new List<SubPacket>();
subpackets.Add(createAddActorPacket(playerActorId));
subpackets.Add(createSpeedPacket(playerActorId));
subpackets.Add(createSpawnPositonPacket(playerActorId, 0x1));
subpackets.Add(createNamePacket(playerActorId));
subpackets.Add(createStatePacket(playerActorId));
subpackets.Add(createIsZoneingPacket(playerActorId));
subpackets.Add(createScriptBindPacket(playerActorId));
return BasePacket.createPacket(subpackets, true, false);
}
}
}

View File

@ -0,0 +1,49 @@
using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.dataobjects;
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 WeatherDirector : Actor
{
private uint weatherId;
public WeatherDirector(uint weatherId, Zone zone)
: base(0x5FF80002)
{
this.weatherId = weatherId;
this.displayNameId = 0;
this.customDisplayName = String.Format("weatherDire_{0}", zone.zoneName, zone.currentZoneId);
this.actorName = String.Format("weatherDire_{0}@{0:04x}", zone.zoneName, zone.currentZoneId);
this.className = "Debug";
}
public override SubPacket createScriptBindPacket(uint playerActorId)
{
List<LuaParam> lParams;
lParams = LuaUtils.createLuaParamList("/Director/Weather/WeatherDirector", false, false, false, false, weatherId);
return ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, className, lParams);
}
public override BasePacket getSpawnPackets(uint playerActorId)
{
List<SubPacket> subpackets = new List<SubPacket>();
subpackets.Add(createAddActorPacket(playerActorId));
subpackets.Add(createSpeedPacket(playerActorId));
subpackets.Add(createSpawnPositonPacket(playerActorId, 0x1));
subpackets.Add(createNamePacket(playerActorId));
subpackets.Add(createStatePacket(playerActorId));
subpackets.Add(createIsZoneingPacket(playerActorId));
subpackets.Add(createScriptBindPacket(playerActorId));
return BasePacket.createPacket(subpackets, true, false);
}
}
}

View File

@ -0,0 +1,44 @@
using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.dataobjects;
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.world
{
class WorldMaster : Actor
{
public WorldMaster() : base(0x5FF80001)
{
this.displayNameId = 0;
this.customDisplayName = "worldMaster";
this.actorName = "worldMaster";
this.className = "WorldMaster";
}
public override SubPacket createScriptBindPacket(uint playerActorId)
{
List<LuaParam> lParams;
lParams = LuaUtils.createLuaParamList("/World/WorldMaster_event", false, false, false, false, false, null);
return ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, className, lParams);
}
public override BasePacket getSpawnPackets(uint playerActorId)
{
List<SubPacket> subpackets = new List<SubPacket>();
subpackets.Add(createAddActorPacket(playerActorId));
subpackets.Add(createSpeedPacket(playerActorId));
subpackets.Add(createSpawnPositonPacket(playerActorId, 0x1));
subpackets.Add(createNamePacket(playerActorId));
subpackets.Add(createStatePacket(playerActorId));
subpackets.Add(createIsZoneingPacket(playerActorId));
subpackets.Add(createScriptBindPacket(playerActorId));
return BasePacket.createPacket(subpackets, true, false);
}
}
}

View File

@ -195,7 +195,7 @@ namespace FFXIVClassic_Map_Server
foreach (object o in list) foreach (object o in list)
{ {
if (o.GetType().IsArray) if (o != null && o.GetType().IsArray)
{ {
Array arrayO = (Array)o; Array arrayO = (Array)o;
foreach (object o2 in arrayO) foreach (object o2 in arrayO)

View File

@ -23,7 +23,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
{ {
binWriter.Write((UInt32)displayNameID); binWriter.Write((UInt32)displayNameID);
if (displayNameID == 0xFFFFFFFF) if (displayNameID == 0 || displayNameID == 0xFFFFFFFF)
{ {
binWriter.Write(Encoding.ASCII.GetBytes(customName), 0, Encoding.ASCII.GetByteCount(customName) >= 0x20 ? 0x19 : Encoding.ASCII.GetByteCount(customName)); binWriter.Write(Encoding.ASCII.GetBytes(customName), 0, Encoding.ASCII.GetByteCount(customName) >= 0x20 ? 0x19 : Encoding.ASCII.GetByteCount(customName));
} }