From 77d6cb2e43d01edf1957aed3e3edc3e1fa170120 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Sun, 9 Jul 2017 11:39:17 -0400 Subject: [PATCH] Fixed up how "special" items work (ie: PUG and ARC weapons). No more glitches hopefully. --- FFXIVClassic Map Server/Database.cs | 11 ++++---- .../actors/chara/player/Player.cs | 13 ++++++++++ .../dataobjects/ItemData.cs | 12 +++++++++ data/scripts/commands/EquipCommand.lua | 10 +++---- sql/gamedata_items_graphics_extra.sql | 26 +++++++++++++++++++ 5 files changed, 62 insertions(+), 10 deletions(-) create mode 100644 sql/gamedata_items_graphics_extra.sql diff --git a/FFXIVClassic Map Server/Database.cs b/FFXIVClassic Map Server/Database.cs index b23214f1..576ef116 100644 --- a/FFXIVClassic Map Server/Database.cs +++ b/FFXIVClassic Map Server/Database.cs @@ -84,11 +84,12 @@ namespace FFXIVClassic_Map_Server SELECT * FROM gamedata_items - LEFT JOIN gamedata_items_equipment ON gamedata_items.catalogID = gamedata_items_equipment.catalogID - LEFT JOIN gamedata_items_accessory ON gamedata_items.catalogID = gamedata_items_accessory.catalogID - LEFT JOIN gamedata_items_armor ON gamedata_items.catalogID = gamedata_items_armor.catalogID - LEFT JOIN gamedata_items_weapon ON gamedata_items.catalogID = gamedata_items_weapon.catalogID - LEFT JOIN gamedata_items_graphics ON gamedata_items.catalogID = gamedata_items_graphics.catalogID + LEFT JOIN gamedata_items_equipment ON gamedata_items.catalogID = gamedata_items_equipment.catalogID + LEFT JOIN gamedata_items_accessory ON gamedata_items.catalogID = gamedata_items_accessory.catalogID + LEFT JOIN gamedata_items_armor ON gamedata_items.catalogID = gamedata_items_armor.catalogID + LEFT JOIN gamedata_items_weapon ON gamedata_items.catalogID = gamedata_items_weapon.catalogID + LEFT JOIN gamedata_items_graphics ON gamedata_items.catalogID = gamedata_items_graphics.catalogID + LEFT JOIN gamedata_items_graphics_extra ON gamedata_items.catalogID = gamedata_items_graphics_extra.catalogID "; MySqlCommand cmd = new MySqlCommand(query, conn); diff --git a/FFXIVClassic Map Server/actors/chara/player/Player.cs b/FFXIVClassic Map Server/actors/chara/player/Player.cs index fed88f12..7801edac 100644 --- a/FFXIVClassic Map Server/actors/chara/player/Player.cs +++ b/FFXIVClassic Map Server/actors/chara/player/Player.cs @@ -1005,6 +1005,19 @@ namespace FFXIVClassic_Map_Server.Actors appearanceIds[slot] = graphicId; } + + //Handle offhand + if (slot == MAINHAND && item is WeaponItem) + { + WeaponItem wpItem = (WeaponItem)item; + + uint graphicId = + (wpItem.graphicsOffhandWeaponId & 0x3FF) << 20 | + (wpItem.graphicsOffhandEquipmentId & 0x3FF) << 10 | + (wpItem.graphicsOffhandVariantId & 0x3FF); + + appearanceIds[SetActorAppearancePacket.OFFHAND] = graphicId; + } } Database.SavePlayerAppearance(this); diff --git a/FFXIVClassic Map Server/dataobjects/ItemData.cs b/FFXIVClassic Map Server/dataobjects/ItemData.cs index c07dc4e1..f72d73dc 100644 --- a/FFXIVClassic Map Server/dataobjects/ItemData.cs +++ b/FFXIVClassic Map Server/dataobjects/ItemData.cs @@ -467,6 +467,11 @@ namespace FFXIVClassic_Map_Server.dataobjects class WeaponItem : EquipmentItem { + //extra graphics + public readonly uint graphicsOffhandWeaponId; + public readonly uint graphicsOffhandEquipmentId; + public readonly uint graphicsOffhandVariantId; + //weapon sheet public readonly short attack; public readonly short magicAttack; @@ -497,6 +502,13 @@ namespace FFXIVClassic_Map_Server.dataobjects public WeaponItem(MySqlDataReader reader) : base(reader) { + if (!reader.IsDBNull(reader.GetOrdinal("offHandWeaponId")) && !reader.IsDBNull(reader.GetOrdinal("offHandEquipmentId")) && !reader.IsDBNull(reader.GetOrdinal("offHandVarientId"))) + { + graphicsOffhandWeaponId = reader.GetUInt32("offHandWeaponId"); + graphicsOffhandEquipmentId = reader.GetUInt32("offHandEquipmentId"); + graphicsOffhandVariantId = reader.GetUInt32("offHandVarientId"); + } + attack = reader.GetInt16("attack"); magicAttack = reader.GetInt16("magicAttack"); craftProcessing = reader.GetInt16("craftProcessing"); diff --git a/data/scripts/commands/EquipCommand.lua b/data/scripts/commands/EquipCommand.lua index 8d741d32..966939ac 100644 --- a/data/scripts/commands/EquipCommand.lua +++ b/data/scripts/commands/EquipCommand.lua @@ -147,8 +147,10 @@ function equipItem(player, equipSlot, item) player:GetEquipment():Equip(equipSlot, item); - if (equipSlot == EQUIPSLOT_MAINHAND and gItem:IsNailWeapon() == false and gItem:IsBowWeapon() == false) then graphicSlot = GRAPHICSLOT_MAINHAND; + if (equipSlot == EQUIPSLOT_MAINHAND and gItem:IsNailWeapon() == false) then graphicSlot = GRAPHICSLOT_MAINHAND; elseif (equipSlot == EQUIPSLOT_OFFHAND) then graphicSlot = GRAPHICSLOT_OFFHAND; + elseif (equipSlot == EQUIPSLOT_THROWINGWEAPON) then graphicSlot = GRAPHICSLOT_THROWING; + elseif (equipSlot == EQUIPSLOT_PACK) then graphicSlot = GRAPHICSLOT_PACK; elseif (equipSlot == EQUIPSLOT_HEAD) then graphicSlot = GRAPHICSLOT_HEAD; elseif (equipSlot == EQUIPSLOT_BODY) then graphicSlot = GRAPHICSLOT_BODY; elseif (equipSlot == EQUIPSLOT_LEGS) then graphicSlot = GRAPHICSLOT_LEGS; @@ -162,13 +164,9 @@ function equipItem(player, equipSlot, item) --Graphic Slot was set, otherwise it's a special case if (graphicSlot ~= nil) then player:GraphicChange(graphicSlot, item); - if (graphicSlot == GRAPHICSLOT_MAINHAND) then player:GraphicChange(GRAPHICSLOT_OFFHAND, nil); end elseif (gItem:IsNailWeapon()) then player:GraphicChange(GRAPHICSLOT_MAINHAND, item); player:GraphicChange(GRAPHICSLOT_OFFHAND, item); - elseif (gItem:IsBowWeapon()) then - player:GraphicChange(GRAPHICSLOT_MAINHAND, item); - --player:GraphicChange(GRAPHICSLOT_OFFHAND, item); elseif (equipSlot == EQUIPSLOT_EARS) then player:GraphicChange(GRAPHICSLOT_R_EAR, item); player:GraphicChange(GRAPHICSLOT_L_EAR, item); @@ -203,6 +201,8 @@ function unequipItem(player, equipSlot, item) else if (equipSlot == EQUIPSLOT_MAINHAND) then player:GraphicChange(GRAPHICSLOT_MAINHAND, nil); elseif (equipSlot == EQUIPSLOT_OFFHAND) then player:GraphicChange(GRAPHICSLOT_OFFHAND, nil); + elseif (equipSlot == EQUIPSLOT_THROWINGWEAPON) then player:GraphicChange(GRAPHICSLOT_THROWING, nil); + elseif (equipSlot == EQUIPSLOT_PACK) then player:GraphicChange(GRAPHICSLOT_PACK, nil); elseif (equipSlot == EQUIPSLOT_HEAD) then player:GraphicChange(GRAPHICSLOT_HEAD, nil); elseif (equipSlot == EQUIPSLOT_WAIST) then player:GraphicChange(GRAPHICSLOT_WAIST, nil); elseif (equipSlot == EQUIPSLOT_EARS) then player:GraphicChange(GRAPHICSLOT_L_EAR, nil); player:GraphicChange(GRAPHICSLOT_R_EAR, nil); diff --git a/sql/gamedata_items_graphics_extra.sql b/sql/gamedata_items_graphics_extra.sql new file mode 100644 index 00000000..c78a928d --- /dev/null +++ b/sql/gamedata_items_graphics_extra.sql @@ -0,0 +1,26 @@ +/* +MySQL Data Transfer +Source Host: localhost +Source Database: ffxiv_server +Target Host: localhost +Target Database: ffxiv_server +Date: 7/9/2017 11:38:35 AM +*/ + +SET FOREIGN_KEY_CHECKS=0; +-- ---------------------------- +-- Table structure for gamedata_items_graphics_extra +-- ---------------------------- +CREATE TABLE `gamedata_items_graphics_extra` ( + `catalogID` int(10) unsigned NOT NULL, + `offHandWeaponId` int(10) unsigned NOT NULL DEFAULT '0', + `offHandEquipmentId` int(10) unsigned NOT NULL DEFAULT '0', + `offHandVarientId` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`catalogID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- ---------------------------- +-- Records +-- ---------------------------- +INSERT INTO `gamedata_items_graphics_extra` VALUES ('4020001', '58', '1', '0'); +INSERT INTO `gamedata_items_graphics_extra` VALUES ('4070001', '226', '1', '0');