mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04:00
Built a WorldManager to handle zones.
This commit is contained in:
parent
887da7b503
commit
0462b790b7
@ -184,131 +184,9 @@ namespace FFXIVClassic_Lobby_Server
|
||||
//Unknown
|
||||
case 0x0002:
|
||||
|
||||
player.getActor().zone = mServer.GetWorldManager().GetZone(player.getActor().zoneId);
|
||||
|
||||
BasePacket reply9 = new BasePacket("./packets/login/login9_zonesetup.bin"); //Bed, Book 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
|
||||
|
||||
#region replaceid
|
||||
//currancy.replaceActorID(player.actorID);
|
||||
//keyitems.replaceActorID(player.actorID);
|
||||
|
||||
reply9.replaceActorID(player.actorID);
|
||||
reply10.replaceActorID(player.actorID);
|
||||
reply11.replaceActorID(player.actorID);
|
||||
#endregion
|
||||
|
||||
client.queuePacket(SetMapPacket.buildPacket(player.actorID, 0xD1, 0xF4), true, false);
|
||||
// client.queuePacket(SetMapPacket.buildPacket(player.actorID, 0x68, 0xF4), true, false);
|
||||
client.queuePacket(_0x2Packet.buildPacket(player.actorID), true, false);
|
||||
client.queuePacket(SendMessagePacket.buildPacket(player.actorID, player.actorID, SendMessagePacket.MESSAGE_TYPE_GENERAL_INFO, "", "-------- Login Message --------\nWelcome to the 1.0 Dev Server"), true, false);
|
||||
client.queuePacket(SetMusicPacket.buildPacket(player.actorID, 0x3D, 0x01), true, false);
|
||||
client.queuePacket(SetWeatherPacket.buildPacket(player.actorID, SetWeatherPacket.WEATHER_CLEAR), true, false);
|
||||
mServer.GetWorldManager().DoLogin(player.getActor());
|
||||
|
||||
BasePacket actorPacket = player.getActor().getSpawnPackets(player.actorID);
|
||||
client.queuePacket(actorPacket);
|
||||
|
||||
//Retainers
|
||||
List<ListEntry> retainerListEntries = new List<ListEntry>();
|
||||
retainerListEntries.Add(new ListEntry(player.actorID, 0xFFFFFFFF, 0x139E, false, true, player.getActor().customDisplayName));
|
||||
retainerListEntries.Add(new ListEntry(0x23, 0x0, 0xFFFFFFFF, false, false, "TEST1"));
|
||||
retainerListEntries.Add(new ListEntry(0x24, 0x0, 0xFFFFFFFF, false, false, "TEST2"));
|
||||
retainerListEntries.Add(new ListEntry(0x25, 0x0, 0xFFFFFFFF, false, false, "TEST3"));
|
||||
BasePacket retainerListPacket = BasePacket.createPacket(ListUtils.createRetainerList(player.actorID, 0xF4, 1, 0x800000000004e639, retainerListEntries), true, false);
|
||||
client.queuePacket(retainerListPacket);
|
||||
|
||||
//Party
|
||||
List<ListEntry> partyListEntries = new List<ListEntry>();
|
||||
partyListEntries.Add(new ListEntry(player.actorID, 0xFFFFFFFF, 0xFFFFFFFF, false, true, player.getActor().customDisplayName));
|
||||
partyListEntries.Add(new ListEntry(0x029B27D3, 0xFFFFFFFF, 0x195, false, true, "Valentine Bluefeather"));
|
||||
BasePacket partyListPacket = BasePacket.createPacket(ListUtils.createPartyList(player.actorID, 0xF4, 1, 0x8000000000696df2, partyListEntries), true, false);
|
||||
client.queuePacket(partyListPacket);
|
||||
|
||||
#region itemsetup
|
||||
////////ITEMS////////
|
||||
client.queuePacket(InventoryBeginChangePacket.buildPacket(player.actorID), true, false);
|
||||
|
||||
|
||||
//TEST
|
||||
List<Item> items = new List<Item>();
|
||||
items.Add(new Item(1337, 8030920, 5)); //Leather Jacket
|
||||
items.Add(new Item(1338, 8013626, 1)); //Chocobo Mask
|
||||
items.Add(new Item(1339, 5030402, 2)); //Thyrus
|
||||
items.Add(new Item(1340, 8013635, 3)); //Dalamud Horn
|
||||
items.Add(new Item(1341, 10100132, 4)); //Savage Might 4
|
||||
items.Add(new Item(1342, 8032407, 6)); //Green Summer Halter (Female)
|
||||
items.Add(new Item(1343, 8051307, 7)); //Green Summer Tanga (Female)
|
||||
items.Add(new Item(1344, 8050766, 8)); //Flame Private's Saroul
|
||||
|
||||
int count = 0;
|
||||
|
||||
items[2].isHighQuality = true;
|
||||
items[0].durability = 9999;
|
||||
items[0].spiritbind = 10000;
|
||||
items[0].materia1 = 6;
|
||||
items[0].materia2 = 7;
|
||||
items[0].materia3 = 8;
|
||||
items[0].materia4 = 9;
|
||||
items[0].materia5 = 10;
|
||||
items[1].durability = 9999;
|
||||
items[2].durability = 0xFFFFFFF;
|
||||
items[3].durability = 9999;
|
||||
items[4].quantity = 99;
|
||||
|
||||
//Reused
|
||||
SubPacket endInventory = InventorySetEndPacket.buildPacket(player.actorID);
|
||||
SubPacket beginInventory = InventorySetBeginPacket.buildPacket(player.actorID, 200, 00);
|
||||
SubPacket setInventory = InventoryItemPacket.buildPacket(player.actorID, items, ref count);
|
||||
|
||||
List<SubPacket> setinvPackets = new List<SubPacket>();
|
||||
setinvPackets.Add(beginInventory);
|
||||
setinvPackets.Add(setInventory);
|
||||
setinvPackets.Add(endInventory);
|
||||
|
||||
//client.queuePacket(currancy);
|
||||
//client.queuePacket(keyitems);
|
||||
|
||||
#endregion
|
||||
|
||||
#region equipsetup
|
||||
client.queuePacket(BasePacket.createPacket(setinvPackets, true, false));
|
||||
EquipmentSetupPacket initialEqupmentPacket = new EquipmentSetupPacket();
|
||||
initialEqupmentPacket.setItem(EquipmentSetupPacket.SLOT_BODY, 5);
|
||||
initialEqupmentPacket.setItem(EquipmentSetupPacket.SLOT_HEAD, 3);
|
||||
initialEqupmentPacket.setItem(EquipmentSetupPacket.SLOT_UNDERSHIRT, 6);
|
||||
initialEqupmentPacket.setItem(EquipmentSetupPacket.SLOT_UNDERGARMENT, 7);
|
||||
initialEqupmentPacket.setItem(EquipmentSetupPacket.SLOT_MAINHAND, 2);
|
||||
initialEqupmentPacket.setItem(EquipmentSetupPacket.SLOT_LEGS, 8);
|
||||
|
||||
//Equip Init
|
||||
client.queuePacket(InventorySetBeginPacket.buildPacket(player.actorID, 0x23, InventorySetBeginPacket.CODE_EQUIPMENT), true, false);
|
||||
client.queuePacket(BasePacket.createPacket(initialEqupmentPacket.buildPackets(player.actorID), true, false));
|
||||
client.queuePacket(InventorySetEndPacket.buildPacket(player.actorID), true, false);
|
||||
|
||||
client.queuePacket(InventoryEndChangePacket.buildPacket(player.actorID), true, false);
|
||||
////////ITEMS////////
|
||||
|
||||
#endregion
|
||||
|
||||
BasePacket tpacket = player.getActor().getInitPackets(player.actorID);
|
||||
//tpacket.debugPrintPacket();
|
||||
client.queuePacket(tpacket);
|
||||
|
||||
player.getActor().zone.addActorToZone(player.getActor());
|
||||
|
||||
BasePacket innSpawn = player.getActor().zone.getSpawnPackets(player.actorID);
|
||||
BasePacket debugSpawn = mServer.GetWorldManager().GetDebugActor().getSpawnPackets(player.actorID);
|
||||
BasePacket worldMasterSpawn = mServer.GetWorldManager().GetActor().getSpawnPackets(player.actorID);
|
||||
innSpawn.debugPrintPacket();
|
||||
|
||||
client.queuePacket(innSpawn);
|
||||
client.queuePacket(debugSpawn);
|
||||
client.queuePacket(worldMasterSpawn);
|
||||
|
||||
client.queuePacket(reply9);
|
||||
client.queuePacket(reply10);
|
||||
client.queuePacket(reply11);
|
||||
|
||||
break;
|
||||
//Chat Received
|
||||
|
@ -23,6 +23,13 @@ namespace FFXIVClassic_Map_Server
|
||||
private Dictionary<uint, Zone> zoneList;
|
||||
private Dictionary<uint, ZoneEntrance> zoneEntranceList;
|
||||
|
||||
private Server mServer;
|
||||
|
||||
public WorldManager(Server server)
|
||||
{
|
||||
mServer = server;
|
||||
}
|
||||
|
||||
public void LoadZoneList()
|
||||
{
|
||||
zoneList = new Dictionary<uint, Zone>();
|
||||
@ -138,7 +145,7 @@ namespace FFXIVClassic_Map_Server
|
||||
}
|
||||
|
||||
//Moves actor to new zone, and sends packets to spawn at the given zone entrance
|
||||
public void DoTeleportZoneChange(Player player, uint destinationZoneId, uint zoneEntrance)
|
||||
public void DoZoneChange(Player player, uint destinationZoneId, uint zoneEntrance)
|
||||
{
|
||||
if (!zoneEntranceList.ContainsKey(zoneEntrance))
|
||||
{
|
||||
@ -147,11 +154,11 @@ namespace FFXIVClassic_Map_Server
|
||||
}
|
||||
|
||||
ZoneEntrance ze = zoneEntranceList[zoneEntrance];
|
||||
DoTeleportZoneChange(player, destinationZoneId, ze.spawnType, ze.spawnX, ze.spawnY, ze.spawnZ, ze.spawnRotation);
|
||||
DoZoneChange(player, destinationZoneId, ze.spawnType, ze.spawnX, ze.spawnY, ze.spawnZ, ze.spawnRotation);
|
||||
}
|
||||
|
||||
//Moves actor to new zone, and sends packets to spawn at the given coords.
|
||||
public void DoTeleportZoneChange(Player player, uint destinationZoneId, byte spawnType, float spawnX, float spawnY, float spawnZ, float spawnRotation)
|
||||
public void DoZoneChange(Player player, uint destinationZoneId, byte spawnType, float spawnX, float spawnY, float spawnZ, float spawnRotation)
|
||||
{
|
||||
Zone oldZone;
|
||||
|
||||
@ -183,6 +190,24 @@ namespace FFXIVClassic_Map_Server
|
||||
player.sendZoneInPackets(this);
|
||||
}
|
||||
|
||||
//Login Zone In
|
||||
public void DoLogin(Player player)
|
||||
{
|
||||
//Add player to new zone and update
|
||||
Zone zone = GetZone(player.zoneId);
|
||||
|
||||
//This server does not contain that zoneId
|
||||
if (zone == null)
|
||||
return;
|
||||
|
||||
//Set the current zone and add player
|
||||
player.zone = zone;
|
||||
zone.addActorToZone(player);
|
||||
|
||||
//Send packets
|
||||
player.sendZoneInPackets(this);
|
||||
}
|
||||
|
||||
public Player GetPCInWorld(string name)
|
||||
{
|
||||
foreach (Zone zone in zoneList.Values)
|
||||
|
@ -4,6 +4,8 @@ using FFXIVClassic_Lobby_Server.packets;
|
||||
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.inventory;
|
||||
using FFXIVClassic_Map_Server.packets.send.list;
|
||||
using FFXIVClassic_Map_Server.packets.send.player;
|
||||
using FFXIVClassic_Map_Server.utils;
|
||||
using MySql.Data.MySqlClient;
|
||||
@ -363,19 +365,114 @@ namespace FFXIVClassic_Map_Server.dataobjects.chara
|
||||
client.queuePacket(SetMapPacket.buildPacket(actorId, zone.regionId, zone.actorId), true, false);
|
||||
//client.queuePacket(_0x2Packet.buildPacket(player.actorID), true, false);
|
||||
client.queuePacket(SetMusicPacket.buildPacket(actorId, 0x3D, 0x01), true, false);
|
||||
client.queuePacket(SetWeatherPacket.buildPacket(actorId, SetWeatherPacket.WEATHER_CLEAR), true, false);
|
||||
client.queuePacket(SetWeatherPacket.buildPacket(actorId, SetWeatherPacket.WEATHER_CLEAR), true, false);
|
||||
|
||||
client.queuePacket(getSpawnPackets(actorId));
|
||||
|
||||
#region grouptest
|
||||
//Retainers
|
||||
List<ListEntry> retainerListEntries = new List<ListEntry>();
|
||||
retainerListEntries.Add(new ListEntry(actorId, 0xFFFFFFFF, 0x139E, false, true, customDisplayName));
|
||||
retainerListEntries.Add(new ListEntry(0x23, 0x0, 0xFFFFFFFF, false, false, "TEST1"));
|
||||
retainerListEntries.Add(new ListEntry(0x24, 0x0, 0xFFFFFFFF, false, false, "TEST2"));
|
||||
retainerListEntries.Add(new ListEntry(0x25, 0x0, 0xFFFFFFFF, false, false, "TEST3"));
|
||||
BasePacket retainerListPacket = BasePacket.createPacket(ListUtils.createRetainerList(actorId, 0xF4, 1, 0x800000000004e639, retainerListEntries), true, false);
|
||||
client.queuePacket(retainerListPacket);
|
||||
|
||||
//Party
|
||||
List<ListEntry> partyListEntries = new List<ListEntry>();
|
||||
partyListEntries.Add(new ListEntry(actorId, 0xFFFFFFFF, 0xFFFFFFFF, false, true, customDisplayName));
|
||||
partyListEntries.Add(new ListEntry(0x029B27D3, 0xFFFFFFFF, 0x195, false, true, "Valentine Bluefeather"));
|
||||
BasePacket partyListPacket = BasePacket.createPacket(ListUtils.createPartyList(actorId, 0xF4, 1, 0x8000000000696df2, partyListEntries), true, false);
|
||||
client.queuePacket(partyListPacket);
|
||||
#endregion
|
||||
|
||||
#region itemsetup
|
||||
////////ITEMS////////
|
||||
client.queuePacket(InventoryBeginChangePacket.buildPacket(actorId), true, false);
|
||||
|
||||
|
||||
//TEST
|
||||
List<Item> items = new List<Item>();
|
||||
items.Add(new Item(1337, 8030920, 5)); //Leather Jacket
|
||||
items.Add(new Item(1338, 8013626, 1)); //Chocobo Mask
|
||||
items.Add(new Item(1339, 5030402, 2)); //Thyrus
|
||||
items.Add(new Item(1340, 8013635, 3)); //Dalamud Horn
|
||||
items.Add(new Item(1341, 10100132, 4)); //Savage Might 4
|
||||
items.Add(new Item(1342, 8032407, 6)); //Green Summer Halter (Female)
|
||||
items.Add(new Item(1343, 8051307, 7)); //Green Summer Tanga (Female)
|
||||
items.Add(new Item(1344, 8050766, 8)); //Flame Private's Saroul
|
||||
|
||||
int count = 0;
|
||||
|
||||
items[2].isHighQuality = true;
|
||||
items[0].durability = 9999;
|
||||
items[0].spiritbind = 10000;
|
||||
items[0].materia1 = 6;
|
||||
items[0].materia2 = 7;
|
||||
items[0].materia3 = 8;
|
||||
items[0].materia4 = 9;
|
||||
items[0].materia5 = 10;
|
||||
items[1].durability = 9999;
|
||||
items[2].durability = 0xFFFFFFF;
|
||||
items[3].durability = 9999;
|
||||
items[4].quantity = 99;
|
||||
|
||||
//Reused
|
||||
SubPacket endInventory = InventorySetEndPacket.buildPacket(actorId);
|
||||
SubPacket beginInventory = InventorySetBeginPacket.buildPacket(actorId, 200, 00);
|
||||
SubPacket setInventory = InventoryItemPacket.buildPacket(actorId, items, ref count);
|
||||
|
||||
List<SubPacket> setinvPackets = new List<SubPacket>();
|
||||
setinvPackets.Add(beginInventory);
|
||||
setinvPackets.Add(setInventory);
|
||||
setinvPackets.Add(endInventory);
|
||||
|
||||
//client.queuePacket(currancy);
|
||||
//client.queuePacket(keyitems);
|
||||
|
||||
#endregion
|
||||
#region equipsetup
|
||||
client.queuePacket(BasePacket.createPacket(setinvPackets, true, false));
|
||||
EquipmentSetupPacket initialEqupmentPacket = new EquipmentSetupPacket();
|
||||
initialEqupmentPacket.setItem(EquipmentSetupPacket.SLOT_BODY, 5);
|
||||
initialEqupmentPacket.setItem(EquipmentSetupPacket.SLOT_HEAD, 3);
|
||||
initialEqupmentPacket.setItem(EquipmentSetupPacket.SLOT_UNDERSHIRT, 6);
|
||||
initialEqupmentPacket.setItem(EquipmentSetupPacket.SLOT_UNDERGARMENT, 7);
|
||||
initialEqupmentPacket.setItem(EquipmentSetupPacket.SLOT_MAINHAND, 2);
|
||||
initialEqupmentPacket.setItem(EquipmentSetupPacket.SLOT_LEGS, 8);
|
||||
|
||||
//Equip Init
|
||||
client.queuePacket(InventorySetBeginPacket.buildPacket(actorId, 0x23, InventorySetBeginPacket.CODE_EQUIPMENT), true, false);
|
||||
client.queuePacket(BasePacket.createPacket(initialEqupmentPacket.buildPackets(actorId), true, false));
|
||||
client.queuePacket(InventorySetEndPacket.buildPacket(actorId), true, false);
|
||||
|
||||
client.queuePacket(InventoryEndChangePacket.buildPacket(actorId), true, false);
|
||||
////////ITEMS////////
|
||||
|
||||
#endregion
|
||||
|
||||
client.queuePacket(getInitPackets(actorId));
|
||||
|
||||
|
||||
|
||||
BasePacket innSpawn = zone.getSpawnPackets(actorId);
|
||||
BasePacket debugSpawn = world.GetDebugActor().getSpawnPackets(actorId);
|
||||
BasePacket worldMasterSpawn = world.GetActor().getSpawnPackets(actorId);
|
||||
client.queuePacket(innSpawn);
|
||||
client.queuePacket(debugSpawn);
|
||||
client.queuePacket(worldMasterSpawn);
|
||||
|
||||
#region hardcode
|
||||
BasePacket reply9 = new BasePacket("./packets/login/login9_zonesetup.bin"); //Bed, Book 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
|
||||
reply9.replaceActorID(actorId);
|
||||
reply10.replaceActorID(actorId);
|
||||
reply11.replaceActorID(actorId);
|
||||
client.queuePacket(reply9);
|
||||
client.queuePacket(reply10);
|
||||
client.queuePacket(reply11);
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
public bool isMyPlayer(uint otherActorId)
|
||||
|
Loading…
Reference in New Issue
Block a user