mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-24 13:47:46 +00:00
Finished check command as well as gearsets and switching between classes. Property changes still have to be written though.
This commit is contained in:
parent
44e5430fdc
commit
e851c767df
16 changed files with 222 additions and 58 deletions
|
@ -641,7 +641,7 @@ namespace FFXIVClassic_Lobby_Server
|
||||||
player.getInventory(Inventory.MELDREQUEST).initList(getInventory(player, 0, Inventory.MELDREQUEST));
|
player.getInventory(Inventory.MELDREQUEST).initList(getInventory(player, 0, Inventory.MELDREQUEST));
|
||||||
player.getInventory(Inventory.LOOT).initList(getInventory(player, 0, Inventory.LOOT));
|
player.getInventory(Inventory.LOOT).initList(getInventory(player, 0, Inventory.LOOT));
|
||||||
|
|
||||||
player.getEquipment().SetEquipment(getEquipment(player));
|
player.getEquipment().SetEquipment(getEquipment(player, player.charaWork.parameterSave.state_mainSkill[0]));
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{ Console.WriteLine(e); }
|
{ Console.WriteLine(e); }
|
||||||
|
@ -653,9 +653,9 @@ namespace FFXIVClassic_Lobby_Server
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Tuple<ushort, InventoryItem>> getEquipment(Player player)
|
public static InventoryItem[] getEquipment(Player player, ushort classId)
|
||||||
{
|
{
|
||||||
List<Tuple<ushort, InventoryItem>> equipment = new List<Tuple<ushort, InventoryItem>>();
|
InventoryItem[] equipment = new InventoryItem[player.getEquipment().GetCapacity()];
|
||||||
|
|
||||||
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||||
{
|
{
|
||||||
|
@ -666,21 +666,22 @@ namespace FFXIVClassic_Lobby_Server
|
||||||
string query = @"
|
string query = @"
|
||||||
SELECT
|
SELECT
|
||||||
equipSlot,
|
equipSlot,
|
||||||
itemSlot
|
itemId
|
||||||
FROM characters_inventory_equipment
|
FROM characters_inventory_equipment
|
||||||
WHERE characterId = @charId ORDER BY equipSlot";
|
WHERE characterId = @charId AND classId = @classId ORDER BY equipSlot";
|
||||||
|
|
||||||
MySqlCommand cmd = new MySqlCommand(query, conn);
|
MySqlCommand cmd = new MySqlCommand(query, conn);
|
||||||
cmd.Parameters.AddWithValue("@charId", player.actorId);
|
cmd.Parameters.AddWithValue("@charId", player.actorId);
|
||||||
|
cmd.Parameters.AddWithValue("@classId", classId);
|
||||||
|
|
||||||
using (MySqlDataReader reader = cmd.ExecuteReader())
|
using (MySqlDataReader reader = cmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
{
|
{
|
||||||
ushort equipSlot = reader.GetUInt16(0);
|
ushort equipSlot = reader.GetUInt16(0);
|
||||||
ushort itemSlot = reader.GetUInt16(1);
|
ulong uniqueItemId = reader.GetUInt16(1);
|
||||||
InventoryItem item = player.getInventory(Inventory.NORMAL).getItem(itemSlot);
|
InventoryItem item = player.getInventory(Inventory.NORMAL).getItemById(uniqueItemId);
|
||||||
equipment.Add(new Tuple<ushort, InventoryItem>(equipSlot, item));
|
equipment[equipSlot] = item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -695,7 +696,7 @@ namespace FFXIVClassic_Lobby_Server
|
||||||
return equipment;
|
return equipment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void equipItem(Player player, ushort equipSlot, ushort itemSlot)
|
public static void equipItem(Player player, ushort equipSlot, ulong uniqueItemId)
|
||||||
{
|
{
|
||||||
|
|
||||||
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||||
|
@ -706,16 +707,17 @@ namespace FFXIVClassic_Lobby_Server
|
||||||
|
|
||||||
string query = @"
|
string query = @"
|
||||||
INSERT INTO characters_inventory_equipment
|
INSERT INTO characters_inventory_equipment
|
||||||
(characterId, equipSlot, itemSlot)
|
(characterId, classId, equipSlot, itemId)
|
||||||
VALUES
|
VALUES
|
||||||
(@characterId, @equipSlot, @itemSlot)
|
(@characterId, @classId, @equipSlot, @uniqueItemId)
|
||||||
ON DUPLICATE KEY UPDATE itemSlot=@itemSlot;
|
ON DUPLICATE KEY UPDATE itemId=@uniqueItemId;
|
||||||
";
|
";
|
||||||
|
|
||||||
MySqlCommand cmd = new MySqlCommand(query, conn);
|
MySqlCommand cmd = new MySqlCommand(query, conn);
|
||||||
cmd.Parameters.AddWithValue("@characterId", player.actorId);
|
cmd.Parameters.AddWithValue("@characterId", player.actorId);
|
||||||
|
cmd.Parameters.AddWithValue("@classId", player.charaWork.parameterSave.state_mainSkill[0]);
|
||||||
cmd.Parameters.AddWithValue("@equipSlot", equipSlot);
|
cmd.Parameters.AddWithValue("@equipSlot", equipSlot);
|
||||||
cmd.Parameters.AddWithValue("@itemSlot", itemSlot);
|
cmd.Parameters.AddWithValue("@uniqueItemId", uniqueItemId);
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
|
@ -740,11 +742,12 @@ namespace FFXIVClassic_Lobby_Server
|
||||||
|
|
||||||
string query = @"
|
string query = @"
|
||||||
DELETE FROM characters_inventory_equipment
|
DELETE FROM characters_inventory_equipment
|
||||||
WHERE characterId = @characterId AND equipSlot = @equipSlot;
|
WHERE characterId = @characterId AND classId = @classId AND equipSlot = @equipSlot;
|
||||||
";
|
";
|
||||||
|
|
||||||
MySqlCommand cmd = new MySqlCommand(query, conn);
|
MySqlCommand cmd = new MySqlCommand(query, conn);
|
||||||
cmd.Parameters.AddWithValue("@characterId", player.actorId);
|
cmd.Parameters.AddWithValue("@characterId", player.actorId);
|
||||||
|
cmd.Parameters.AddWithValue("@classId", player.charaWork.parameterSave.state_mainSkill[0]);
|
||||||
cmd.Parameters.AddWithValue("@equipSlot", equipSlot);
|
cmd.Parameters.AddWithValue("@equipSlot", equipSlot);
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
|
|
|
@ -23,14 +23,6 @@ namespace FFXIVClassic_Lobby_Server
|
||||||
#endif
|
#endif
|
||||||
bool startServer = true;
|
bool startServer = true;
|
||||||
|
|
||||||
Utils.FFXIVLoginStringDecodeBinary("C:\\Program Files (x86)\\SquareEnix\\FINAL FANTASY XIV\\ffxivlogin.exe");
|
|
||||||
|
|
||||||
Console.WriteLine(Utils.FFXIVLoginStringDecode(new byte[]{0x6F, 0xD6, 0x3C, 0xD6, 0x20, 0x81, 0x3F, 0x06, 0x36, 0x78, 0xD3, 0xAE, 0xDB, 0x4E, 0x08, 0xF1, 0x7D, 0xAE, 0x90, 0x43, 0x18, 0x70, 0x32, 0x08, 0x6B, 0x75, 0x98, 0xA1, 0x51, 0x15, 0xA9, 0xF7, 0x74, 0xB3, 0x6F, 0x10, 0xEA, 0x76, 0x34, 0x0B, 0x7E, 0x2D, 0xD2, 0xAC, 0xD7, 0xC3, 0xD3, 0xC1, 0x4D, 0x96, 0xED, 0xD4, 0xCC, 0x5E, 0x0D, 0xF5, 0x7E, 0x35, 0x99, 0xB9, 0x57, 0x38, 0x51, 0x79, 0x39, 0x3F, 0x08, 0xFB, 0xE8, 0xEE, 0x25, 0x4F, 0xAE, 0xE2, 0xFC, 0x7E, 0x2A, 0x72, 0x34, 0x57, 0x7E}));
|
|
||||||
|
|
||||||
Console.WriteLine(Utils.ByteArrayToHex(Utils.FFXIVLoginStringEncode(0xd018, "http://141.117.163.26/login/")));
|
|
||||||
|
|
||||||
return;
|
|
||||||
|
|
||||||
Console.ForegroundColor = ConsoleColor.Cyan;
|
Console.ForegroundColor = ConsoleColor.Cyan;
|
||||||
Console.WriteLine("---------FFXIV 1.0 Map Server---------");
|
Console.WriteLine("---------FFXIV 1.0 Map Server---------");
|
||||||
Console.ForegroundColor = ConsoleColor.Gray;
|
Console.ForegroundColor = ConsoleColor.Gray;
|
||||||
|
|
|
@ -478,6 +478,7 @@ namespace FFXIVClassic_Lobby_Server
|
||||||
{
|
{
|
||||||
Player p = client.getActor();
|
Player p = client.getActor();
|
||||||
p.graphicChange(slot, wId, eId, vId, cId);
|
p.graphicChange(slot, wId, eId, vId, cId);
|
||||||
|
p.sendAppearance();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -485,6 +486,7 @@ namespace FFXIVClassic_Lobby_Server
|
||||||
{
|
{
|
||||||
Player p = entry.Value.getActor();
|
Player p = entry.Value.getActor();
|
||||||
p.graphicChange(slot, wId, eId, vId, cId);
|
p.graphicChange(slot, wId, eId, vId, cId);
|
||||||
|
p.sendAppearance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
||||||
private InventoryItem[] list;
|
private InventoryItem[] list;
|
||||||
private Inventory normalInventory;
|
private Inventory normalInventory;
|
||||||
|
|
||||||
|
private bool writeToDB = true;
|
||||||
|
|
||||||
public Equipment(Player ownerPlayer, Inventory normalInventory, ushort capacity, ushort code)
|
public Equipment(Player ownerPlayer, Inventory normalInventory, ushort capacity, ushort code)
|
||||||
{
|
{
|
||||||
owner = ownerPlayer;
|
owner = ownerPlayer;
|
||||||
|
@ -55,6 +57,38 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendCheckEquipmentToPlayer(Player toPlayer)
|
||||||
|
{
|
||||||
|
List<InventoryItem> items = new List<InventoryItem>();
|
||||||
|
for (ushort i = 0; i < list.Length; i++)
|
||||||
|
{
|
||||||
|
if (list[i] != null)
|
||||||
|
{
|
||||||
|
InventoryItem equipItem = new InventoryItem(list[i], i);
|
||||||
|
items.Add(equipItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
toPlayer.queuePacket(InventorySetBeginPacket.buildPacket(owner.actorId, toPlayer.actorId, 0x23, Inventory.EQUIPMENT_OTHERPLAYER));
|
||||||
|
int currentIndex = 0;
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
if (items.Count - currentIndex >= 16)
|
||||||
|
toPlayer.queuePacket(InventoryListX16Packet.buildPacket(owner.actorId, toPlayer.actorId, items, ref currentIndex));
|
||||||
|
else if (items.Count - currentIndex > 1)
|
||||||
|
toPlayer.queuePacket(InventoryListX08Packet.buildPacket(owner.actorId, toPlayer.actorId, items, ref currentIndex));
|
||||||
|
else if (items.Count - currentIndex == 1)
|
||||||
|
{
|
||||||
|
toPlayer.queuePacket(InventoryListX01Packet.buildPacket(owner.actorId, toPlayer.actorId, items[currentIndex]));
|
||||||
|
currentIndex++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
toPlayer.queuePacket(InventorySetEndPacket.buildPacket(owner.actorId, toPlayer.actorId));
|
||||||
|
}
|
||||||
|
|
||||||
public void SendFullEquipment(bool doClear)
|
public void SendFullEquipment(bool doClear)
|
||||||
{
|
{
|
||||||
List<ushort> slotsToUpdate = new List<ushort>();
|
List<ushort> slotsToUpdate = new List<ushort>();
|
||||||
|
@ -78,13 +112,13 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
||||||
|
|
||||||
for (int i = 0; i < slots.Length; i++)
|
for (int i = 0; i < slots.Length; i++)
|
||||||
{
|
{
|
||||||
InventoryItem item = normalInventory.getItem(itemSlots[i]);
|
InventoryItem item = normalInventory.getItemBySlot(itemSlots[i]);
|
||||||
|
|
||||||
if (item == null)
|
if (item == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Database.equipItem(owner, slots[i], itemSlots[i]);
|
Database.equipItem(owner, slots[i], itemSlots[i]);
|
||||||
list[slots[i]] = normalInventory.getItem(itemSlots[i]);
|
list[slots[i]] = normalInventory.getItemBySlot(itemSlots[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
owner.queuePacket(InventoryBeginChangePacket.buildPacket(owner.actorId));
|
owner.queuePacket(InventoryBeginChangePacket.buildPacket(owner.actorId));
|
||||||
|
@ -92,19 +126,20 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
||||||
owner.queuePacket(InventoryEndChangePacket.buildPacket(owner.actorId));
|
owner.queuePacket(InventoryEndChangePacket.buildPacket(owner.actorId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetEquipment(List<Tuple<ushort, InventoryItem>> toEquip)
|
public void SetEquipment(InventoryItem[] toEquip)
|
||||||
{
|
{
|
||||||
List<ushort> slotsToUpdate = new List<ushort>();
|
List<ushort> slotsToUpdate = new List<ushort>();
|
||||||
for (int i = 0; i < toEquip.Count; i++)
|
for (ushort i = 0; i < toEquip.Length; i++)
|
||||||
{
|
{
|
||||||
slotsToUpdate.Add(toEquip[i].Item1);
|
if (toEquip[i] != null)
|
||||||
list[toEquip[i].Item1] = toEquip[i].Item2;
|
slotsToUpdate.Add(i);
|
||||||
}
|
}
|
||||||
|
list = toEquip;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Equip(ushort slot, ushort invSlot)
|
public void Equip(ushort slot, ushort invSlot)
|
||||||
{
|
{
|
||||||
InventoryItem item = normalInventory.getItem(invSlot);
|
InventoryItem item = normalInventory.getItemBySlot(invSlot);
|
||||||
|
|
||||||
if (item == null)
|
if (item == null)
|
||||||
return;
|
return;
|
||||||
|
@ -117,7 +152,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
||||||
if (slot >= list.Length)
|
if (slot >= list.Length)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Database.equipItem(owner, slot, item.slot);
|
if (writeToDB)
|
||||||
|
Database.equipItem(owner, slot, item.uniqueId);
|
||||||
|
|
||||||
owner.queuePacket(InventoryBeginChangePacket.buildPacket(owner.actorId));
|
owner.queuePacket(InventoryBeginChangePacket.buildPacket(owner.actorId));
|
||||||
|
|
||||||
|
@ -135,11 +171,17 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
||||||
list[slot] = item;
|
list[slot] = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ToggleDBWrite(bool flag)
|
||||||
|
{
|
||||||
|
writeToDB = flag;
|
||||||
|
}
|
||||||
|
|
||||||
public void Unequip(ushort slot)
|
public void Unequip(ushort slot)
|
||||||
{
|
{
|
||||||
if (slot >= list.Length)
|
if (slot >= list.Length)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (writeToDB)
|
||||||
Database.unequipItem(owner, slot);
|
Database.unequipItem(owner, slot);
|
||||||
|
|
||||||
owner.queuePacket(InventoryBeginChangePacket.buildPacket(owner.actorId));
|
owner.queuePacket(InventoryBeginChangePacket.buildPacket(owner.actorId));
|
||||||
|
@ -189,5 +231,10 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int GetCapacity()
|
||||||
|
{
|
||||||
|
return list.Length;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
||||||
list = itemsFromDB;
|
list = itemsFromDB;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InventoryItem getItem(ushort slot)
|
public InventoryItem getItemBySlot(ushort slot)
|
||||||
{
|
{
|
||||||
if (slot < list.Count)
|
if (slot < list.Count)
|
||||||
return list[slot];
|
return list[slot];
|
||||||
|
@ -49,6 +49,16 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InventoryItem getItemById(ulong itemId)
|
||||||
|
{
|
||||||
|
foreach (InventoryItem item in list)
|
||||||
|
{
|
||||||
|
if (item.uniqueId == itemId)
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public void RefreshItem(InventoryItem item)
|
public void RefreshItem(InventoryItem item)
|
||||||
{
|
{
|
||||||
owner.queuePacket(InventorySetBeginPacket.buildPacket(owner.actorId, inventoryCapacity, inventoryCode));
|
owner.queuePacket(InventorySetBeginPacket.buildPacket(owner.actorId, inventoryCapacity, inventoryCode));
|
||||||
|
|
|
@ -409,7 +409,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
propPacketUtil.addProperty("playerWork.birthdayDay");
|
propPacketUtil.addProperty("playerWork.birthdayDay");
|
||||||
propPacketUtil.addProperty("playerWork.initialTown");
|
propPacketUtil.addProperty("playerWork.initialTown");
|
||||||
|
|
||||||
return propPacketUtil.done();
|
return BasePacket.createPacket(propPacketUtil.done(), true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendZoneInPackets(WorldManager world, ushort spawnType)
|
public void sendZoneInPackets(WorldManager world, ushort spawnType)
|
||||||
|
@ -684,7 +684,6 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
public void graphicChange(uint slot, uint graphicId)
|
public void graphicChange(uint slot, uint graphicId)
|
||||||
{
|
{
|
||||||
appearanceIds[slot] = graphicId;
|
appearanceIds[slot] = graphicId;
|
||||||
broadcastPacket(createAppearancePacket(actorId), true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void graphicChange(uint slot, uint weapId, uint equipId, uint variantId, uint colorId)
|
public void graphicChange(uint slot, uint weapId, uint equipId, uint variantId, uint colorId)
|
||||||
|
@ -703,10 +702,34 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
(mixedVariantId & 0x3FF);
|
(mixedVariantId & 0x3FF);
|
||||||
|
|
||||||
appearanceIds[slot] = graphicId;
|
appearanceIds[slot] = graphicId;
|
||||||
broadcastPacket(createAppearancePacket(actorId), true);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void sendAppearance()
|
||||||
|
{
|
||||||
|
broadcastPacket(createAppearancePacket(actorId), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public InventoryItem[] getGearset(ushort classId)
|
||||||
|
{
|
||||||
|
return Database.getEquipment(this, classId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void doClassChange(byte classId)
|
||||||
|
{
|
||||||
|
charaWork.parameterSave.state_mainSkill[0] = classId;
|
||||||
|
|
||||||
|
ActorPropertyPacketUtil propertyBuilder = new ActorPropertyPacketUtil("charaWork/stateForAll", this, actorId);
|
||||||
|
propertyBuilder.addProperty("charaWork.parameterSave.state_mainSkill[0]");
|
||||||
|
propertyBuilder.addProperty("charaWork.parameterSave.state_mainSkillLevel");
|
||||||
|
List<SubPacket> packets = propertyBuilder.done();
|
||||||
|
|
||||||
|
foreach (SubPacket packet in packets)
|
||||||
|
broadcastPacket(packet, true);
|
||||||
|
|
||||||
|
Log.info("Class change request to: " + classId);
|
||||||
|
}
|
||||||
|
|
||||||
public void graphicChange(int slot, InventoryItem invItem)
|
public void graphicChange(int slot, InventoryItem invItem)
|
||||||
{
|
{
|
||||||
if (invItem == null)
|
if (invItem == null)
|
||||||
|
@ -747,11 +770,35 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Actor getActorInInstance(uint actorId)
|
||||||
|
{
|
||||||
|
foreach (Actor a in playerSession.actorInstanceList)
|
||||||
|
{
|
||||||
|
if (a.actorId == actorId)
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public Equipment getEquipment()
|
public Equipment getEquipment()
|
||||||
{
|
{
|
||||||
return equipment;
|
return equipment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void examinePlayer(Actor examinee)
|
||||||
|
{
|
||||||
|
Player toBeExamined;
|
||||||
|
if (examinee is Player)
|
||||||
|
toBeExamined = (Player)examinee;
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
|
||||||
|
queuePacket(InventoryBeginChangePacket.buildPacket(toBeExamined.actorId, actorId));
|
||||||
|
toBeExamined.getEquipment().SendCheckEquipmentToPlayer(this);
|
||||||
|
queuePacket(InventoryEndChangePacket.buildPacket(toBeExamined.actorId, actorId));
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
||||||
{
|
{
|
||||||
class InventoryItem
|
class InventoryItem
|
||||||
{
|
{
|
||||||
public uint uniqueId;
|
public ulong uniqueId;
|
||||||
public uint itemId;
|
public uint itemId;
|
||||||
public int quantity = 1;
|
public int quantity = 1;
|
||||||
public ushort slot;
|
public ushort slot;
|
||||||
|
@ -32,13 +32,34 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
||||||
{
|
{
|
||||||
this.uniqueId = id;
|
this.uniqueId = id;
|
||||||
this.itemId = itemId;
|
this.itemId = itemId;
|
||||||
this.quantity = quantity;
|
this.quantity = 1;
|
||||||
this.slot = slot;
|
this.slot = slot;
|
||||||
|
|
||||||
Item gItem = Server.getItemGamedata(id);
|
Item gItem = Server.getItemGamedata(itemId);
|
||||||
itemType = gItem.isExclusive ? (byte)0x3 : (byte)0x0;
|
itemType = gItem.isExclusive ? (byte)0x3 : (byte)0x0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//For check command
|
||||||
|
public InventoryItem(InventoryItem item, ushort equipSlot)
|
||||||
|
{
|
||||||
|
this.uniqueId = item.uniqueId;
|
||||||
|
this.itemId = item.itemId;
|
||||||
|
this.quantity = item.quantity;
|
||||||
|
this.slot = equipSlot;
|
||||||
|
|
||||||
|
this.itemType = item.itemType;
|
||||||
|
this.quality = item.quality;
|
||||||
|
|
||||||
|
this.durability = item.durability;
|
||||||
|
this.spiritbind = item.spiritbind;
|
||||||
|
|
||||||
|
this.materia1 = item.materia1;
|
||||||
|
this.materia2 = item.materia2;
|
||||||
|
this.materia3 = item.materia3;
|
||||||
|
this.materia4 = item.materia4;
|
||||||
|
this.materia5 = item.materia5;
|
||||||
|
}
|
||||||
|
|
||||||
public InventoryItem(uint uniqueId, uint itemId, int quantity, ushort slot, byte itemType, byte qualityNumber, int durability, ushort spiritbind, byte materia1, byte materia2, byte materia3, byte materia4, byte materia5)
|
public InventoryItem(uint uniqueId, uint itemId, int quantity, ushort slot, byte itemType, byte qualityNumber, int durability, ushort spiritbind, byte materia1, byte materia2, byte materia3, byte materia4, byte materia5)
|
||||||
{
|
{
|
||||||
this.uniqueId = uniqueId;
|
this.uniqueId = uniqueId;
|
||||||
|
@ -64,13 +85,12 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
||||||
{
|
{
|
||||||
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
||||||
{
|
{
|
||||||
binWriter.Write((UInt32)uniqueId);
|
binWriter.Write((UInt64)uniqueId);
|
||||||
binWriter.Write((UInt32)0x00000000);
|
|
||||||
binWriter.Write((Int32)quantity);
|
binWriter.Write((Int32)quantity);
|
||||||
binWriter.Write((UInt32)itemId);
|
binWriter.Write((UInt32)itemId);
|
||||||
binWriter.Write((UInt16)slot);
|
binWriter.Write((UInt16)slot);
|
||||||
|
|
||||||
binWriter.Write((UInt16)0x0000);
|
binWriter.Write((UInt16)0x0001);
|
||||||
binWriter.Write((UInt32)0x00000000);
|
binWriter.Write((UInt32)0x00000000);
|
||||||
binWriter.Write((UInt32)0x00000000);
|
binWriter.Write((UInt32)0x00000000);
|
||||||
binWriter.Write((UInt32)0x00000000);
|
binWriter.Write((UInt32)0x00000000);
|
||||||
|
|
|
@ -42,6 +42,7 @@ namespace FFXIVClassic_Map_Server.lua
|
||||||
((ScriptLoaderBase)script.Options.ScriptLoader).ModulePaths = new string[] { "./scripts/?", "./scripts/?.lua" };
|
((ScriptLoaderBase)script.Options.ScriptLoader).ModulePaths = new string[] { "./scripts/?", "./scripts/?.lua" };
|
||||||
script.Globals["getStaticActor"] = (Func<string, Actor>)Server.getStaticActors;
|
script.Globals["getStaticActor"] = (Func<string, Actor>)Server.getStaticActors;
|
||||||
script.Globals["getWorldMaster"] = (Func<Actor>)Server.getServer().GetWorldManager().GetActor;
|
script.Globals["getWorldMaster"] = (Func<Actor>)Server.getServer().GetWorldManager().GetActor;
|
||||||
|
script.Globals["getItemGamedata"] = (Func<uint, Item>)Server.getItemGamedata;
|
||||||
script.DoFile(luaPath);
|
script.DoFile(luaPath);
|
||||||
DynValue result = script.Call(script.Globals["onInstantiate"], target);
|
DynValue result = script.Call(script.Globals["onInstantiate"], target);
|
||||||
List<LuaParam> lparams = LuaUtils.createLuaParamList(result);
|
List<LuaParam> lparams = LuaUtils.createLuaParamList(result);
|
||||||
|
@ -77,6 +78,7 @@ namespace FFXIVClassic_Map_Server.lua
|
||||||
((ScriptLoaderBase)script.Options.ScriptLoader).ModulePaths = new string[] { "./scripts/?", "./scripts/?.lua" };
|
((ScriptLoaderBase)script.Options.ScriptLoader).ModulePaths = new string[] { "./scripts/?", "./scripts/?.lua" };
|
||||||
script.Globals["getStaticActor"] = (Func<string, Actor>)Server.getStaticActors;
|
script.Globals["getStaticActor"] = (Func<string, Actor>)Server.getStaticActors;
|
||||||
script.Globals["getWorldMaster"] = (Func<Actor>)Server.getServer().GetWorldManager().GetActor;
|
script.Globals["getWorldMaster"] = (Func<Actor>)Server.getServer().GetWorldManager().GetActor;
|
||||||
|
script.Globals["getItemGamedata"] = (Func<uint, Item>)Server.getItemGamedata;
|
||||||
script.DoFile(luaPath);
|
script.DoFile(luaPath);
|
||||||
|
|
||||||
//Have to do this to combine LuaParams
|
//Have to do this to combine LuaParams
|
||||||
|
@ -113,6 +115,7 @@ namespace FFXIVClassic_Map_Server.lua
|
||||||
((ScriptLoaderBase)script.Options.ScriptLoader).ModulePaths = new string[] { "./scripts/?", "./scripts/?.lua" };
|
((ScriptLoaderBase)script.Options.ScriptLoader).ModulePaths = new string[] { "./scripts/?", "./scripts/?.lua" };
|
||||||
script.Globals["getStaticActor"] = (Func<string, Actor>)Server.getStaticActors;
|
script.Globals["getStaticActor"] = (Func<string, Actor>)Server.getStaticActors;
|
||||||
script.Globals["getWorldMaster"] = (Func<Actor>)Server.getServer().GetWorldManager().GetActor;
|
script.Globals["getWorldMaster"] = (Func<Actor>)Server.getServer().GetWorldManager().GetActor;
|
||||||
|
script.Globals["getItemGamedata"] = (Func<uint, Item>)Server.getItemGamedata;
|
||||||
script.DoFile(luaPath);
|
script.DoFile(luaPath);
|
||||||
|
|
||||||
//Have to do this to combine LuaParams
|
//Have to do this to combine LuaParams
|
||||||
|
@ -144,6 +147,7 @@ namespace FFXIVClassic_Map_Server.lua
|
||||||
((ScriptLoaderBase)script.Options.ScriptLoader).ModulePaths = new string[] { "./scripts/?", "./scripts/?.lua" };
|
((ScriptLoaderBase)script.Options.ScriptLoader).ModulePaths = new string[] { "./scripts/?", "./scripts/?.lua" };
|
||||||
script.Globals["getStaticActor"] = (Func<string, Actor>)Server.getStaticActors;
|
script.Globals["getStaticActor"] = (Func<string, Actor>)Server.getStaticActors;
|
||||||
script.Globals["getWorldMaster"] = (Func<Actor>)Server.getServer().GetWorldManager().GetActor;
|
script.Globals["getWorldMaster"] = (Func<Actor>)Server.getServer().GetWorldManager().GetActor;
|
||||||
|
script.Globals["getItemGamedata"] = (Func<uint, Item>)Server.getItemGamedata;
|
||||||
script.DoFile(luaPath);
|
script.DoFile(luaPath);
|
||||||
|
|
||||||
//Run Script
|
//Run Script
|
||||||
|
@ -159,6 +163,7 @@ namespace FFXIVClassic_Map_Server.lua
|
||||||
((ScriptLoaderBase)script.Options.ScriptLoader).ModulePaths = new string[] { "./scripts/?", "./scripts/?.lua" };
|
((ScriptLoaderBase)script.Options.ScriptLoader).ModulePaths = new string[] { "./scripts/?", "./scripts/?.lua" };
|
||||||
script.Globals["getStaticActor"] = (Func<string, Actor>)Server.getStaticActors;
|
script.Globals["getStaticActor"] = (Func<string, Actor>)Server.getStaticActors;
|
||||||
script.Globals["getWorldMaster"] = (Func<Actor>)Server.getServer().GetWorldManager().GetActor;
|
script.Globals["getWorldMaster"] = (Func<Actor>)Server.getServer().GetWorldManager().GetActor;
|
||||||
|
script.Globals["getItemGamedata"] = (Func<uint, Item>)Server.getItemGamedata;
|
||||||
script.DoFile(FILEPATH_PLAYER);
|
script.DoFile(FILEPATH_PLAYER);
|
||||||
|
|
||||||
//Run Script
|
//Run Script
|
||||||
|
|
|
@ -12,9 +12,17 @@ namespace FFXIVClassic_Map_Server.packets.send.Actor.inventory
|
||||||
public const ushort OPCODE = 0x016D;
|
public const ushort OPCODE = 0x016D;
|
||||||
public const uint PACKET_SIZE = 0x28;
|
public const uint PACKET_SIZE = 0x28;
|
||||||
|
|
||||||
|
public static SubPacket buildPacket(uint sourceActorId, uint targetActorId)
|
||||||
|
{
|
||||||
|
byte[] data = new byte[8];
|
||||||
|
data[0] = 2;
|
||||||
|
return new SubPacket(OPCODE, sourceActorId, targetActorId, data);
|
||||||
|
}
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID)
|
public static SubPacket buildPacket(uint playerActorID)
|
||||||
{
|
{
|
||||||
return new SubPacket(OPCODE, playerActorID, playerActorID, new byte[8]);
|
byte[] data = new byte[8];
|
||||||
|
return new SubPacket(OPCODE, playerActorID, playerActorID, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,11 @@ namespace FFXIVClassic_Map_Server.packets.send.Actor.inventory
|
||||||
public const ushort OPCODE = 0x016E;
|
public const ushort OPCODE = 0x016E;
|
||||||
public const uint PACKET_SIZE = 0x28;
|
public const uint PACKET_SIZE = 0x28;
|
||||||
|
|
||||||
|
public static SubPacket buildPacket(uint sourceActorId, uint targetActorId)
|
||||||
|
{
|
||||||
|
return new SubPacket(OPCODE, sourceActorId, targetActorId, new byte[8]);
|
||||||
|
}
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID)
|
public static SubPacket buildPacket(uint playerActorID)
|
||||||
{
|
{
|
||||||
return new SubPacket(OPCODE, playerActorID, playerActorID, new byte[8]);
|
return new SubPacket(OPCODE, playerActorID, playerActorID, new byte[8]);
|
||||||
|
|
|
@ -14,7 +14,12 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.inventory
|
||||||
public const ushort OPCODE = 0x0148;
|
public const ushort OPCODE = 0x0148;
|
||||||
public const uint PACKET_SIZE = 0x90;
|
public const uint PACKET_SIZE = 0x90;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, InventoryItem item)
|
public static SubPacket buildPacket(uint playerActorId, InventoryItem item)
|
||||||
|
{
|
||||||
|
return buildPacket(playerActorId, playerActorId, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SubPacket buildPacket(uint sourceActorId, uint targetActorId, InventoryItem item)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -26,7 +31,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.inventory
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new SubPacket(OPCODE, playerActorID, playerActorID, data);
|
return new SubPacket(OPCODE, sourceActorId, targetActorId, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,12 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.inventory
|
||||||
public const ushort OPCODE = 0x0149;
|
public const ushort OPCODE = 0x0149;
|
||||||
public const uint PACKET_SIZE = 0x3A8;
|
public const uint PACKET_SIZE = 0x3A8;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, List<InventoryItem> items, ref int listOffset)
|
public static SubPacket buildPacket(uint playerActorId, List<InventoryItem> items, ref int listOffset)
|
||||||
|
{
|
||||||
|
return buildPacket(playerActorId, playerActorId, items, ref listOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SubPacket buildPacket(uint sourceActorId, uint targetActorId, List<InventoryItem> items, ref int listOffset)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -39,7 +44,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.inventory
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new SubPacket(OPCODE, playerActorID, playerActorID, data);
|
return new SubPacket(OPCODE, sourceActorId, targetActorId, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,12 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.inventory
|
||||||
public const ushort OPCODE = 0x014A;
|
public const ushort OPCODE = 0x014A;
|
||||||
public const uint PACKET_SIZE = 0x720;
|
public const uint PACKET_SIZE = 0x720;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, List<InventoryItem> items, ref int listOffset)
|
public static SubPacket buildPacket(uint playerActorId, List<InventoryItem> items, ref int listOffset)
|
||||||
|
{
|
||||||
|
return buildPacket(playerActorId, playerActorId, items, ref listOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SubPacket buildPacket(uint sourceActorId, uint targetActorId, List<InventoryItem> items, ref int listOffset)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -36,7 +41,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.inventory
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new SubPacket(OPCODE, playerActorID, playerActorID, data);
|
return new SubPacket(OPCODE, sourceActorId, targetActorId, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,12 @@ namespace FFXIVClassic_Map_Server.packets.send.Actor.inventory
|
||||||
public const ushort OPCODE = 0x0146;
|
public const ushort OPCODE = 0x0146;
|
||||||
public const uint PACKET_SIZE = 0x28;
|
public const uint PACKET_SIZE = 0x28;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, ushort size, ushort code)
|
public static SubPacket buildPacket(uint playerActorId, ushort size, ushort code)
|
||||||
|
{
|
||||||
|
return buildPacket(playerActorId, playerActorId, size, code);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SubPacket buildPacket(uint sourceActorId, uint targetActorId, ushort size, ushort code)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[8];
|
byte[] data = new byte[8];
|
||||||
|
|
||||||
|
@ -21,13 +26,13 @@ namespace FFXIVClassic_Map_Server.packets.send.Actor.inventory
|
||||||
{
|
{
|
||||||
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
||||||
{
|
{
|
||||||
binWriter.Write((UInt32)playerActorID);
|
binWriter.Write((UInt32)sourceActorId);
|
||||||
binWriter.Write((UInt16)size);
|
binWriter.Write((UInt16)size);
|
||||||
binWriter.Write((UInt16)code);
|
binWriter.Write((UInt16)code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new SubPacket(OPCODE, playerActorID, playerActorID, data);
|
return new SubPacket(OPCODE, sourceActorId, targetActorId, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,9 +13,14 @@ namespace FFXIVClassic_Map_Server.packets.send.Actor.inventory
|
||||||
public const ushort OPCODE = 0x0147;
|
public const ushort OPCODE = 0x0147;
|
||||||
public const uint PACKET_SIZE = 0x28;
|
public const uint PACKET_SIZE = 0x28;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID)
|
public static SubPacket buildPacket(uint playerActorId)
|
||||||
{
|
{
|
||||||
return new SubPacket(OPCODE, playerActorID, playerActorID, new byte[8]);
|
return new SubPacket(OPCODE, playerActorId, playerActorId, new byte[8]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SubPacket buildPacket(uint sourceActorId, uint targetActorID)
|
||||||
|
{
|
||||||
|
return new SubPacket(OPCODE, sourceActorId, targetActorID, new byte[8]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,12 +37,12 @@ namespace FFXIVClassic_Map_Server.utils
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public BasePacket done()
|
public List<SubPacket> done()
|
||||||
{
|
{
|
||||||
currentActorPropertyPacket.addTarget();
|
currentActorPropertyPacket.addTarget();
|
||||||
currentActorPropertyPacket.setIsMore(false);
|
currentActorPropertyPacket.setIsMore(false);
|
||||||
subPackets.Add(currentActorPropertyPacket.buildPacket(playerActorId, forActor.actorId));
|
subPackets.Add(currentActorPropertyPacket.buildPacket(playerActorId, forActor.actorId));
|
||||||
return BasePacket.createPacket(subPackets, true, false);
|
return subPackets;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue