Added more quest functions and completed the scripts for Gridania and most of Ul'dah. Up to the battle part that is.

This commit is contained in:
Filip Maj 2016-04-17 19:09:01 -04:00
parent 95849e1c1c
commit 79eaf5d79e
36 changed files with 733 additions and 28 deletions

View file

@ -345,7 +345,7 @@ namespace FFXIVClassic_Lobby_Server
cmd = new MySqlCommand(query, conn);
cmd.Parameters.AddWithValue("@charaId", player.actorId);
cmd.Parameters.AddWithValue("@slot", slot);
cmd.Parameters.AddWithValue("@questId", quest.actorId);
cmd.Parameters.AddWithValue("@questId", 0xFFFFF & quest.actorId);
cmd.Parameters.AddWithValue("@questData", quest.GetSerializedQuestData());
cmd.Parameters.AddWithValue("@questFlags", quest.GetQuestFlags());

View file

@ -72,6 +72,8 @@
<Compile Include="actors\debug\Debug.cs" />
<Compile Include="actors\director\Director.cs" />
<Compile Include="actors\director\OpeningDirector.cs" />
<Compile Include="actors\director\quest\QuestDirectorMan0u001.cs" />
<Compile Include="actors\director\quest\QuestDirectorMan0g001.cs" />
<Compile Include="actors\director\quest\QuestDirectorMan0l001..cs" />
<Compile Include="actors\director\WeatherDirector.cs" />
<Compile Include="actors\EventList.cs" />
@ -102,7 +104,6 @@
<Compile Include="actors\chara\ParameterSave.cs" />
<Compile Include="actors\chara\player\PlayerWork.cs" />
<Compile Include="dataobjects\DBWorld.cs" />
<Compile Include="dataobjects\Event.cs" />
<Compile Include="dataobjects\InventoryItem.cs" />
<Compile Include="dataobjects\ConnectedPlayer.cs" />
<Compile Include="dataobjects\Item.cs" />

View file

@ -432,6 +432,7 @@ namespace FFXIVClassic_Lobby_Server
if (spawnType.ToLower().StartsWith("0x"))
sType = Convert.ToByte(spawnType, 16);
else
sType = Convert.ToByte(spawnType);
if (mWorldManager.GetZone(zoneId) == null)

View file

@ -2,6 +2,7 @@
using FFXIVClassic_Lobby_Server.common;
using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.actors;
using FFXIVClassic_Map_Server.Actors.Chara;
using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send.actor;
@ -20,6 +21,8 @@ namespace FFXIVClassic_Map_Server.Actors
{
private uint actorClassId;
public NpcWork npcWork = new NpcWork();
public Npc(uint id, string actorName, uint zoneId, float posX, float posY, float posZ, float rot, ushort actorState, uint animationId, uint displayNameId, string customDisplayName, string className)
: base(id)
{
@ -38,6 +41,26 @@ namespace FFXIVClassic_Map_Server.Actors
this.zoneId = zoneId;
loadNpcTemplate(id);
charaWork.battleSave.potencial = 1.0f;
charaWork.parameterSave.state_mainSkill[0] = 3;
charaWork.parameterSave.state_mainSkill[2] = 3;
charaWork.parameterSave.state_mainSkillLevel = 2;
charaWork.parameterSave.hp[0] = 500;
charaWork.parameterSave.hpMax[0] = 500;
charaWork.property[0] = 1;
charaWork.property[1] = 1;
if (className.Equals("JellyfishScenarioLimsaLv00"))
{
charaWork.property[2] = 1;
npcWork.hateType = 1;
}
charaWork.property[3] = 1;
charaWork.property[4] = 1;
}
public SubPacket createAddActorPacket(uint playerActorId)
@ -80,6 +103,54 @@ namespace FFXIVClassic_Map_Server.Actors
return BasePacket.createPacket(subpackets, true, false);
}
public override BasePacket getInitPackets(uint playerActorId)
{
ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("/_init", this, playerActorId);
//Properties
for (int i = 0; i < charaWork.property.Length; i++)
{
if (charaWork.property[i] != 0)
propPacketUtil.addProperty(String.Format("charaWork.property[{0}]", i));
}
//Parameters
propPacketUtil.addProperty("charaWork.parameterSave.hp[0]");
propPacketUtil.addProperty("charaWork.parameterSave.hpMax[0]");
propPacketUtil.addProperty("charaWork.parameterSave.mp");
propPacketUtil.addProperty("charaWork.parameterSave.mpMax");
propPacketUtil.addProperty("charaWork.parameterTemp.tp");
if (charaWork.parameterSave.state_mainSkill[0] != 0)
propPacketUtil.addProperty("charaWork.parameterSave.state_mainSkill[0]");
if (charaWork.parameterSave.state_mainSkill[1] != 0)
propPacketUtil.addProperty("charaWork.parameterSave.state_mainSkill[1]");
if (charaWork.parameterSave.state_mainSkill[2] != 0)
propPacketUtil.addProperty("charaWork.parameterSave.state_mainSkill[2]");
if (charaWork.parameterSave.state_mainSkill[3] != 0)
propPacketUtil.addProperty("charaWork.parameterSave.state_mainSkill[3]");
propPacketUtil.addProperty("charaWork.parameterSave.state_mainSkillLevel");
//Status Times
for (int i = 0; i < charaWork.statusShownTime.Length; i++)
{
if (charaWork.statusShownTime[i] != 0xFFFFFFFF)
propPacketUtil.addProperty(String.Format("charaWork.statusShownTime[{0}]", i));
}
//General Parameters
for (int i = 3; i < charaWork.battleTemp.generalParameter.Length; i++)
{
if (charaWork.battleTemp.generalParameter[i] != 0)
propPacketUtil.addProperty(String.Format("charaWork.battleTemp.generalParameter[{0}]", i));
}
propPacketUtil.addProperty("npcWork.hateType");
return BasePacket.createPacket(propPacketUtil.done(), true, false);
}
public uint getActorClassId()
{
return actorClassId;

View file

@ -966,6 +966,47 @@ namespace FFXIVClassic_Map_Server.Actors
public Equipment getEquipment()
{
return equipment;
}
public byte getInitialTown()
{
return playerWork.initialTown;
}
public int getFreeQuestSlot()
{
for (int i = 0; i < questScenario.Length; i++)
{
if (questScenario[i] == null)
return i;
}
return -1;
}
public void addQuest(uint id)
{
Actor actor = Server.getStaticActors((0xA0F00000 | id));
addQuest(actor.actorName);
}
public void addQuest(string name)
{
Actor actor = Server.getStaticActors(name);
if (actor == null)
return;
uint id = actor.actorId;
int freeSlot = getFreeQuestSlot();
if (freeSlot == -1)
return;
playerWork.questScenario[freeSlot] = id;
questScenario[freeSlot] = new Quest(this, playerWork.questScenario[freeSlot], name, null, 0);
Database.saveQuest(this, questScenario[freeSlot]);
}
public Quest getQuest(uint id)
@ -1033,6 +1074,14 @@ namespace FFXIVClassic_Map_Server.Actors
{
currentDirector = new QuestDirectorMan0l001(this, 0x46080012);
}
else if (directorType.Equals("QuestDirectorMan0g001"))
{
currentDirector = new QuestDirectorMan0g001(this, 0x46080012);
}
else if (directorType.Equals("QuestDirectorMan0u001"))
{
currentDirector = new QuestDirectorMan0u001(this, 0x46080012);
}
if (sendPackets)
{

View file

@ -15,9 +15,12 @@ namespace FFXIVClassic_Map_Server.actors.director
public OpeningDirector(Player player, uint id) : base(player, id)
{
this.displayNameId = 0;
this.customDisplayName = "openingDire";
this.customDisplayName = String.Format("openingDire_{0}_{1}", player.zone.zoneName, "04");
this.actorName = String.Format("openingDire_{0}_{1}@{2:x3}{3:x2}", player.zone.zoneName, "04", player.zoneId, 0);
this.actorName = this.actorName.Replace("Battle", "Btl");
this.actorName = "openingDire";
this.className = "OpeningDirector";
this.eventConditions = new EventList();

View file

@ -0,0 +1,41 @@
using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.Actors;
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 QuestDirectorMan0g001 : Director
{
public QuestDirectorMan0g001(Player player, uint id)
: base(player, id)
{
this.displayNameId = 0;
this.customDisplayName = "questDirect_fst0Btl03_01";
this.actorName = "questDirect_fst0Btl03_01@0A615";
this.className = "QuestDirectorMan0g001";
this.eventConditions = new EventList();
List<EventList.NoticeEventCondition> noticeEventList = new List<EventList.NoticeEventCondition>();
noticeEventList.Add(new EventList.NoticeEventCondition("noticeEvent", 0xE, 0x0));
noticeEventList.Add(new EventList.NoticeEventCondition("noticeRequest", 0x0, 0x1));
this.eventConditions.noticeEventConditions = noticeEventList;
}
public override SubPacket createScriptBindPacket(uint playerActorId)
{
List<LuaParam> lParams;
lParams = LuaUtils.createLuaParamList("/Director/Quest/QuestDirectorMan0g001", false, false, false, false, false, 0x753A);
return ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, className, lParams);
}
}
}

View file

@ -0,0 +1,41 @@
using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.Actors;
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 QuestDirectorMan0u001 : Director
{
public QuestDirectorMan0u001(Player player, uint id)
: base(player, id)
{
this.displayNameId = 0;
this.customDisplayName = "questDirect_wil0Btl01_01";
this.actorName = "questDirect_wil0Btl01_01@0A615";
this.className = "QuestDirectorMan0u001";
this.eventConditions = new EventList();
List<EventList.NoticeEventCondition> noticeEventList = new List<EventList.NoticeEventCondition>();
noticeEventList.Add(new EventList.NoticeEventCondition("noticeEvent", 0xE, 0x0));
noticeEventList.Add(new EventList.NoticeEventCondition("noticeRequest", 0x0, 0x1));
this.eventConditions.noticeEventConditions = noticeEventList;
}
public override SubPacket createScriptBindPacket(uint playerActorId)
{
List<LuaParam> lParams;
lParams = LuaUtils.createLuaParamList("/Director/Quest/QuestDirectorMan0u001", false, false, false, false, false, 0x757F);
return ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, className, lParams);
}
}
}

View file

@ -25,7 +25,12 @@ namespace FFXIVClassic_Map_Server.Actors
this.owner = owner;
actorName = name;
this.questFlags = questFlags;
this.questData = JsonConvert.DeserializeObject<Dictionary<string, Object>>(questDataJson);
if (questDataJson != null)
this.questData = JsonConvert.DeserializeObject<Dictionary<string, Object>>(questDataJson);
else
questData = null;
if (questData == null)
questData = new Dictionary<string, object>();
}