From 92de857cda8e9b97d5c82a07022f54cddc7716ff Mon Sep 17 00:00:00 2001 From: yogurt Date: Tue, 10 Oct 2017 13:32:47 -0500 Subject: [PATCH] opening quest stuff --- FFXIVClassic Lobby Server/Database.cs | 2 +- FFXIVClassic Map Server/Database.cs | 38 ++-- FFXIVClassic Map Server/WorldManager.cs | 2 + FFXIVClassic Map Server/actors/Actor.cs | 3 + FFXIVClassic Map Server/actors/area/Area.cs | 3 +- FFXIVClassic Map Server/actors/area/Zone.cs | 10 + .../actors/chara/Character.cs | 12 +- .../actors/chara/ai/BattleCommand.cs | 2 +- .../ai/controllers/BattleNpcController.cs | 1 - .../actors/chara/ai/helpers/PathFind.cs | 8 +- .../actors/chara/ai/state/WeaponSkillState.cs | 2 +- .../actors/chara/npc/BattleNpc.cs | 12 +- .../actors/chara/npc/Npc.cs | 2 +- .../actors/chara/player/Player.cs | 36 +++- .../actors/director/Director.cs | 3 +- .../actors/group/ContentGroup.cs | 2 +- FFXIVClassic Map Server/actors/quest/Quest.cs | 2 +- FFXIVClassic Map Server/lua/LuaEngine.cs | 25 ++- .../Actor/battle/BattleActionX01Packet.cs | 1 + data/scripts/commands/gm/eaction.lua | 34 ++++ data/scripts/commands/gm/setmaxhp.lua | 33 ++++ data/scripts/commands/gm/setmaxmp.lua | 33 ++++ data/scripts/commands/gm/yolo.lua | 178 ++++++++++++++++++ .../commands/weaponskill/chaos_thrust.lua | 26 +++ data/scripts/commands/weaponskill/default.lua | 26 +++ .../commands/weaponskill/doom_spike.lua | 26 +++ .../commands/weaponskill/dread_spike.lua | 26 +++ data/scripts/commands/weaponskill/feint.lua | 26 +++ .../commands/weaponskill/flat_blade.lua | 26 +++ .../commands/weaponskill/full_thrust.lua | 26 +++ .../commands/weaponskill/heavy_thrust.lua | 27 +++ .../commands/weaponskill/impulse_drive.lua | 26 +++ .../commands/weaponskill/leg_sweep.lua | 26 +++ data/scripts/commands/weaponskill/pummel.lua | 26 +++ .../commands/weaponskill/true_thrust.lua | 26 +++ .../commands/weaponskill/vorpal_thrust.lua | 26 +++ data/scripts/content/SimpleContent30010.lua | 38 ++-- .../directors/Quest/QuestDirectorMan0g001.lua | 63 ++++--- .../fst0Battle03/PopulaceStandard/yda.lua | 7 +- .../PopulaceStandard/serpent_private_hill.lua | 7 + .../PopulaceStandard/task_board.lua | 7 + .../fst0Town01a/PopulaceStandard/gagaroon.lua | 7 + .../fst0Town01a/PopulaceStandard/louisoix.lua | 7 + .../serpent_private_carver.lua | 7 + .../serpent_private_holmes.lua | 7 + .../PopulaceStandard/serpent_private_kirk.lua | 7 + .../serpent_private_stone.lua | 7 + .../serpent_private_white.lua | 7 + .../sea0Town01a/PopulaceStandard/rubh_hob.lua | 7 + 49 files changed, 873 insertions(+), 88 deletions(-) create mode 100644 data/scripts/commands/gm/eaction.lua create mode 100644 data/scripts/commands/gm/setmaxhp.lua create mode 100644 data/scripts/commands/gm/setmaxmp.lua create mode 100644 data/scripts/commands/gm/yolo.lua create mode 100644 data/scripts/commands/weaponskill/chaos_thrust.lua create mode 100644 data/scripts/commands/weaponskill/default.lua create mode 100644 data/scripts/commands/weaponskill/doom_spike.lua create mode 100644 data/scripts/commands/weaponskill/dread_spike.lua create mode 100644 data/scripts/commands/weaponskill/feint.lua create mode 100644 data/scripts/commands/weaponskill/flat_blade.lua create mode 100644 data/scripts/commands/weaponskill/full_thrust.lua create mode 100644 data/scripts/commands/weaponskill/heavy_thrust.lua create mode 100644 data/scripts/commands/weaponskill/impulse_drive.lua create mode 100644 data/scripts/commands/weaponskill/leg_sweep.lua create mode 100644 data/scripts/commands/weaponskill/pummel.lua create mode 100644 data/scripts/commands/weaponskill/true_thrust.lua create mode 100644 data/scripts/commands/weaponskill/vorpal_thrust.lua create mode 100644 data/scripts/unique/fst0Town01/PopulaceStandard/serpent_private_hill.lua create mode 100644 data/scripts/unique/fst0Town01/PopulaceStandard/task_board.lua create mode 100644 data/scripts/unique/fst0Town01a/PopulaceStandard/gagaroon.lua create mode 100644 data/scripts/unique/fst0Town01a/PopulaceStandard/louisoix.lua create mode 100644 data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_carver.lua create mode 100644 data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_holmes.lua create mode 100644 data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_kirk.lua create mode 100644 data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_stone.lua create mode 100644 data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_white.lua create mode 100644 data/scripts/unique/sea0Town01a/PopulaceStandard/rubh_hob.lua diff --git a/FFXIVClassic Lobby Server/Database.cs b/FFXIVClassic Lobby Server/Database.cs index dce95d6b..a08da78e 100644 --- a/FFXIVClassic Lobby Server/Database.cs +++ b/FFXIVClassic Lobby Server/Database.cs @@ -219,7 +219,7 @@ namespace FFXIVClassic_Lobby_Server { MySqlCommand cmd = new MySqlCommand(); cmd.Connection = conn; - cmd.CommandText = String.Format("INSERT INTO characters_parametersave(characterId, hp, hpMax, mp, mpMax, mainSkill, mainSkillLevel) VALUES(@characterId, 1, 1, 1, 1, @mainSkill, 1);", CharacterCreatorUtils.GetClassNameForId((short)charaInfo.currentClass)); + cmd.CommandText = String.Format("INSERT INTO characters_parametersave(characterId, hp, hpMax, mp, mpMax, mainSkill, mainSkillLevel) VALUES(@characterId, 1900, 1000, 115, 115, @mainSkill, 1);", CharacterCreatorUtils.GetClassNameForId((short)charaInfo.currentClass)); cmd.Prepare(); cmd.Parameters.AddWithValue("@characterId", cid); diff --git a/FFXIVClassic Map Server/Database.cs b/FFXIVClassic Map Server/Database.cs index 2aeb81f2..8a0f3188 100644 --- a/FFXIVClassic Map Server/Database.cs +++ b/FFXIVClassic Map Server/Database.cs @@ -817,27 +817,27 @@ namespace FFXIVClassic_Map_Server { if (reader.Read()) { - player.charaWork.battleSave.skillPoint[Player.CLASSID_PUG - 1] = reader.GetInt16("pug"); - player.charaWork.battleSave.skillPoint[Player.CLASSID_GLA - 1] = reader.GetInt16("gla"); - player.charaWork.battleSave.skillPoint[Player.CLASSID_MRD - 1] = reader.GetInt16("mrd"); - player.charaWork.battleSave.skillPoint[Player.CLASSID_ARC - 1] = reader.GetInt16("arc"); - player.charaWork.battleSave.skillPoint[Player.CLASSID_LNC - 1] = reader.GetInt16("lnc"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_PUG - 1] = reader.GetInt32("pug"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_GLA - 1] = reader.GetInt32("gla"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_MRD - 1] = reader.GetInt32("mrd"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_ARC - 1] = reader.GetInt32("arc"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_LNC - 1] = reader.GetInt32("lnc"); - player.charaWork.battleSave.skillPoint[Player.CLASSID_THM - 1] = reader.GetInt16("thm"); - player.charaWork.battleSave.skillPoint[Player.CLASSID_CNJ - 1] = reader.GetInt16("cnj"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_THM - 1] = reader.GetInt32("thm"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_CNJ - 1] = reader.GetInt32("cnj"); - player.charaWork.battleSave.skillPoint[Player.CLASSID_CRP - 1] = reader.GetInt16("crp"); - player.charaWork.battleSave.skillPoint[Player.CLASSID_BSM - 1] = reader.GetInt16("bsm"); - player.charaWork.battleSave.skillPoint[Player.CLASSID_ARM - 1] = reader.GetInt16("arm"); - player.charaWork.battleSave.skillPoint[Player.CLASSID_GSM - 1] = reader.GetInt16("gsm"); - player.charaWork.battleSave.skillPoint[Player.CLASSID_LTW - 1] = reader.GetInt16("ltw"); - player.charaWork.battleSave.skillPoint[Player.CLASSID_WVR - 1] = reader.GetInt16("wvr"); - player.charaWork.battleSave.skillPoint[Player.CLASSID_ALC - 1] = reader.GetInt16("alc"); - player.charaWork.battleSave.skillPoint[Player.CLASSID_CUL - 1] = reader.GetInt16("cul"); - - player.charaWork.battleSave.skillPoint[Player.CLASSID_MIN - 1] = reader.GetInt16("min"); - player.charaWork.battleSave.skillPoint[Player.CLASSID_BTN - 1] = reader.GetInt16("btn"); - player.charaWork.battleSave.skillPoint[Player.CLASSID_FSH - 1] = reader.GetInt16("fsh"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_CRP - 1] = reader.GetInt32("crp"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_BSM - 1] = reader.GetInt32("bsm"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_ARM - 1] = reader.GetInt32("arm"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_GSM - 1] = reader.GetInt32("gsm"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_LTW - 1] = reader.GetInt32("ltw"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_WVR - 1] = reader.GetInt32("wvr"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_ALC - 1] = reader.GetInt32("alc"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_CUL - 1] = reader.GetInt32("cul"); + + player.charaWork.battleSave.skillPoint[Player.CLASSID_MIN - 1] = reader.GetInt32("min"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_BTN - 1] = reader.GetInt32("btn"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_FSH - 1] = reader.GetInt32("fsh"); } } diff --git a/FFXIVClassic Map Server/WorldManager.cs b/FFXIVClassic Map Server/WorldManager.cs index 978187cd..a3c2db1d 100644 --- a/FFXIVClassic Map Server/WorldManager.cs +++ b/FFXIVClassic Map Server/WorldManager.cs @@ -1291,7 +1291,9 @@ namespace FFXIVClassic_Map_Server { Program.Tick = DateTime.Now; foreach (Zone zone in zoneList.Values) + { zone.Update(Program.Tick); + } Program.LastTick = Program.Tick; } } diff --git a/FFXIVClassic Map Server/actors/Actor.cs b/FFXIVClassic Map Server/actors/Actor.cs index 313b62cc..cce7f1a8 100644 --- a/FFXIVClassic Map Server/actors/Actor.cs +++ b/FFXIVClassic Map Server/actors/Actor.cs @@ -438,6 +438,9 @@ namespace FFXIVClassic_Map_Server.Actors updateFlags = ActorUpdateFlags.None; zone.BroadcastPacketsAroundActor(this, packets); + + SetActorPropetyPacket hpInfo = new SetActorPropetyPacket("charaWork/exp"); + hpInfo.AddTarget(); } } diff --git a/FFXIVClassic Map Server/actors/area/Area.cs b/FFXIVClassic Map Server/actors/area/Area.cs index 7e657d1a..b3a0e6c2 100644 --- a/FFXIVClassic Map Server/actors/area/Area.cs +++ b/FFXIVClassic Map Server/actors/area/Area.cs @@ -489,13 +489,14 @@ namespace FFXIVClassic_Map_Server.Actors zoneId = actorId; Npc npc; - if (isMob) npc = new BattleNpc(mActorList.Count + 1, actorClass, uniqueId, this, x, y, z, rot, state, animId, null); else npc = new Npc(mActorList.Count + 1, actorClass, uniqueId, this, x, y, z, rot, state, animId, null); npc.LoadEventConditions(actorClass.eventConditions); + npc.SetMaxHP(300); + npc.SetHP(300); AddActorToZone(npc); diff --git a/FFXIVClassic Map Server/actors/area/Zone.cs b/FFXIVClassic Map Server/actors/area/Zone.cs index 27cb19ab..dc3a5787 100644 --- a/FFXIVClassic Map Server/actors/area/Zone.cs +++ b/FFXIVClassic Map Server/actors/area/Zone.cs @@ -152,6 +152,7 @@ namespace FFXIVClassic_Map_Server.actors.area contentAreas.Add(areaName, new List()); PrivateAreaContent contentArea = new PrivateAreaContent(this, classPath, areaName, 1, director, starterPlayer); contentAreas[areaName].Add(contentArea); + return contentArea; } } @@ -167,6 +168,15 @@ namespace FFXIVClassic_Map_Server.actors.area public override void Update(DateTime tick) { base.Update(tick); + foreach (var a in privateAreas.Values) + foreach(var b in a.Values) + b.Update(tick); + + foreach (var a in contentAreas.Values) + foreach (var b in a) + { + b.Update(tick); + } // todo: again, this is retarded but debug stuff var diffTime = tick - lastUpdate; diff --git a/FFXIVClassic Map Server/actors/chara/Character.cs b/FFXIVClassic Map Server/actors/chara/Character.cs index 618c3b18..c9621219 100644 --- a/FFXIVClassic Map Server/actors/chara/Character.cs +++ b/FFXIVClassic Map Server/actors/chara/Character.cs @@ -401,6 +401,7 @@ namespace FFXIVClassic_Map_Server.Actors aiContainer.Engage(zone.FindActorInArea(targid)); } } + return false; } @@ -470,7 +471,7 @@ namespace FFXIVClassic_Map_Server.Actors public bool IsAlive() { - return !aiContainer.IsDead() && GetHP() > 0; + return !aiContainer.IsDead();// && GetHP() > 0; } public short GetHP() @@ -511,7 +512,7 @@ namespace FFXIVClassic_Map_Server.Actors public byte GetHPP() { - return (byte)((charaWork.parameterSave.hp[0] / charaWork.parameterSave.hpMax[0]) * 100); + return (byte)(charaWork.parameterSave.hp[0] == 0 ? 0 : (charaWork.parameterSave.hp[0] / charaWork.parameterSave.hpMax[0]) * 100); } public void SetHP(uint hp) @@ -570,7 +571,11 @@ namespace FFXIVClassic_Map_Server.Actors public void AddTP(int tp) { charaWork.parameterTemp.tp = (short)((charaWork.parameterTemp.tp + tp).Clamp(0, 3000)); + tpBase = (ushort) charaWork.parameterTemp.tp; updateFlags |= ActorUpdateFlags.HpTpMp; + + if (tpBase >= 1000) + lua.LuaEngine.GetInstance().OnSignal("tpOver1000"); } public void DelHP(int hp) @@ -638,6 +643,9 @@ namespace FFXIVClassic_Map_Server.Actors target.DelHP(action.amount); if (target is BattleNpc) ((BattleNpc)target).lastAttacker = this; + + AddTP(115); + target.AddTP(100); } public virtual void OnCast(State state, BattleAction[] actions, ref BattleAction[] errors) diff --git a/FFXIVClassic Map Server/actors/chara/ai/BattleCommand.cs b/FFXIVClassic Map Server/actors/chara/ai/BattleCommand.cs index 8a01284c..dc04bb46 100644 --- a/FFXIVClassic Map Server/actors/chara/ai/BattleCommand.cs +++ b/FFXIVClassic Map Server/actors/chara/ai/BattleCommand.cs @@ -233,7 +233,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai if (mpCost != 0) return (ushort)Math.Ceiling((cost * mpCost * 0.001)); - return tpCost; + return mpCost != 0 ? (ushort)Math.Ceiling((cost * mpCost * 0.001)) : (ushort)0; } public List GetTargets() diff --git a/FFXIVClassic Map Server/actors/chara/ai/controllers/BattleNpcController.cs b/FFXIVClassic Map Server/actors/chara/ai/controllers/BattleNpcController.cs index 43359fed..3a802c19 100644 --- a/FFXIVClassic Map Server/actors/chara/ai/controllers/BattleNpcController.cs +++ b/FFXIVClassic Map Server/actors/chara/ai/controllers/BattleNpcController.cs @@ -194,7 +194,6 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers protected virtual void DoCombatTick(DateTime tick, List contentGroupCharas = null) { HandleHate(); - // todo: magic/attack/ws cooldowns etc if (TryDeaggro()) { diff --git a/FFXIVClassic Map Server/actors/chara/ai/helpers/PathFind.cs b/FFXIVClassic Map Server/actors/chara/ai/helpers/PathFind.cs index 9af398f0..399bb9b5 100644 --- a/FFXIVClassic Map Server/actors/chara/ai/helpers/PathFind.cs +++ b/FFXIVClassic Map Server/actors/chara/ai/helpers/PathFind.cs @@ -44,7 +44,13 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai { var pos = new Vector3(owner.positionX, owner.positionY, owner.positionZ); var dest = new Vector3(x, y, z); - var zone = (Zone)owner.GetZone(); + + Zone zone; + if (owner.GetZone() is PrivateArea || owner.GetZone() is PrivateAreaContent) + zone = (Zone)((PrivateArea)owner.GetZone()).GetParentZone(); + else + zone = (Zone)owner.GetZone(); + var sw = new System.Diagnostics.Stopwatch(); sw.Start(); diff --git a/FFXIVClassic Map Server/actors/chara/ai/state/WeaponSkillState.cs b/FFXIVClassic Map Server/actors/chara/ai/state/WeaponSkillState.cs index e9b05019..f918c8be 100644 --- a/FFXIVClassic Map Server/actors/chara/ai/state/WeaponSkillState.cs +++ b/FFXIVClassic Map Server/actors/chara/ai/state/WeaponSkillState.cs @@ -106,7 +106,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state var errors = (BattleAction[])actions.Clone(); owner.OnWeaponSkill(this, actions, ref errors); - owner.DoBattleAction(skill.id, 0, actions); + owner.DoBattleAction(skill.id, skill.battleAnimation, actions); } public override void TryInterrupt() diff --git a/FFXIVClassic Map Server/actors/chara/npc/BattleNpc.cs b/FFXIVClassic Map Server/actors/chara/npc/BattleNpc.cs index e90bb91f..c528a12c 100644 --- a/FFXIVClassic Map Server/actors/chara/npc/BattleNpc.cs +++ b/FFXIVClassic Map Server/actors/chara/npc/BattleNpc.cs @@ -298,7 +298,13 @@ namespace FFXIVClassic_Map_Server.Actors // onDeath(monster, player, killer) lua.LuaEngine.CallLuaBattleFunction(this, "onDeath", this, partyMember, lastAttacker); // defeat/defeats - ((Player)lastAttacker).QueuePacket(BattleActionX01Packet.BuildPacket(lastAttacker.actorId, 0, 0, new BattleAction(actorId, 30108, 0))); + + if (lastAttacker is Player) + ((Player)lastAttacker).QueuePacket(BattleActionX01Packet.BuildPacket(lastAttacker.actorId, 0, 0, new BattleAction(actorId, 30108, 0))); + + if(partyMember is Player) + ((Player)partyMember).AddExp(1500, (byte)partyMember.GetJob(), 5); + } } else @@ -311,8 +317,10 @@ namespace FFXIVClassic_Map_Server.Actors positionUpdates?.Clear(); aiContainer.InternalDie(tick, despawnTime); this.ResetMoveSpeeds(); - + // todo: reset cooldowns + + lua.LuaEngine.GetInstance().OnSignal("mobkill"); } else { diff --git a/FFXIVClassic Map Server/actors/chara/npc/Npc.cs b/FFXIVClassic Map Server/actors/chara/npc/Npc.cs index 8feb3f51..31c9541d 100644 --- a/FFXIVClassic Map Server/actors/chara/npc/Npc.cs +++ b/FFXIVClassic Map Server/actors/chara/npc/Npc.cs @@ -80,7 +80,7 @@ namespace FFXIVClassic_Map_Server.Actors charaWork.parameterSave.hpMax[0] = 80; } for (int i = 0; i < 32; i++ ) - charaWork.property[i] = (byte)(((int)actorClass.propertyFlags >> i) & 1); + charaWork.property[i] = (byte)(((int)actorClass.propertyFlags >> i) & 1); npcWork.pushCommand = actorClass.pushCommand; npcWork.pushCommandSub = actorClass.pushCommandSub; diff --git a/FFXIVClassic Map Server/actors/chara/player/Player.cs b/FFXIVClassic Map Server/actors/chara/player/Player.cs index 0579e523..cd2d3509 100644 --- a/FFXIVClassic Map Server/actors/chara/player/Player.cs +++ b/FFXIVClassic Map Server/actors/chara/player/Player.cs @@ -234,7 +234,7 @@ namespace FFXIVClassic_Map_Server.Actors charaWork.commandBorder = 0x20; - charaWork.parameterTemp.tp = 3000; + charaWork.parameterTemp.tp = 0; Database.LoadPlayerCharacter(this); lastPlayTimeUpdate = Utils.UnixTimeStampUTC(); @@ -1777,9 +1777,13 @@ namespace FFXIVClassic_Map_Server.Actors propPacketUtil.AddProperty($"charaWork.parameterSave.state_mainSkillLevel"); packets.AddRange(propPacketUtil.Done()); + } base.PostUpdate(tick, packets); + SetActorPropetyPacket hpInfo = new SetActorPropetyPacket("charaWork/exp"); + hpInfo.AddTarget(); + QueuePacket(hpInfo.BuildPacket(actorId)); } public override void Die(DateTime tick) @@ -1813,19 +1817,20 @@ namespace FFXIVClassic_Map_Server.Actors ActorPropertyPacketUtil compatibiltyUtil = new ActorPropertyPacketUtil("charaWork/commandDetailForSelf", this); foreach (ushort slot in slotsToUpdate) { - propPacketUtil.AddProperty(String.Format("charaWork.command[{0}]", slot)); - propPacketUtil.AddProperty(String.Format("charaWork.commandCategory[{0}]", slot)); + propPacketUtil.AddProperty($"charaWork.command[{slot}]"); + propPacketUtil.AddProperty($"charaWork.commandCategory[{slot}]"); } + propPacketUtil.NewTarget("charaWork/commandDetailForSelf"); //Enable or disable slots based on whether there is an ability in that slot foreach (ushort slot in slotsToUpdate) { charaWork.parameterSave.commandSlot_compatibility[slot - charaWork.commandBorder] = charaWork.command[slot] != 0; - compatibiltyUtil.AddProperty(String.Format("charaWork.parameterSave.commandSlot_compatibility[{0}]", slot - charaWork.commandBorder)); + propPacketUtil.AddProperty($"charaWork.parameterSave.commandSlot_compatibility[{slot - charaWork.commandBorder}]"); } QueuePackets(propPacketUtil.Done()); - QueuePackets(compatibiltyUtil.Done()); + //QueuePackets(compatibiltyUtil.Done()); } //Update recast timers for the passed in hotbar slots @@ -1874,6 +1879,7 @@ namespace FFXIVClassic_Map_Server.Actors uint recastEnd = Utils.UnixTimeStampUTC() + maxRecastTime; List slotsToUpdate = new List(); + Database.EquipAbility(this, classId, (ushort) (hotbarSlot - charaWork.commandBorder), commandId, recastEnd); //If the class we're equipping for is the current class (need to find out if state_mainSkill is supposed to change when you're a job) //then equip the ability in charawork.commands and save in databse, otherwise just save in database if (classId == charaWork.parameterSave.state_mainSkill[0]) @@ -1887,7 +1893,6 @@ namespace FFXIVClassic_Map_Server.Actors UpdateHotbar(slotsToUpdate); } - Database.EquipAbility(this, classId, (ushort) (hotbarSlot - charaWork.commandBorder), commandId, recastEnd); if(printMessage) SendGameMessage(Server.GetWorldManager().GetActor(), 30603, 0x20, 0, commandId); @@ -2184,6 +2189,8 @@ namespace FFXIVClassic_Map_Server.Actors { ((BattleNpc)target).hateContainer.UpdateHate(this, action.amount); } + + LuaEngine.GetInstance().OnSignal("playerAttack"); } public override void OnCast(State state, BattleAction[] actions, ref BattleAction[] errors) @@ -2213,7 +2220,6 @@ namespace FFXIVClassic_Map_Server.Actors exp += (int) Math.Ceiling((exp * bonusPercent / 100.0f)); //You earn [exp](+[bonusPercent]%) experience point(s). SendGameMessage(this, Server.GetWorldManager().GetActor(), 33934, 0x44, this, 0, 0, 0, 0, 0, 0, 0, 0, 0, exp, "", bonusPercent); - bool leveled = false; int diff = MAXEXP[GetLevel() - 1] - charaWork.battleSave.skillPoint[classId - 1]; //While there is enough experience to level up, keep leveling up, unlocking skills and removing experience from exp until we don't have enough to level up @@ -2314,5 +2320,21 @@ namespace FFXIVClassic_Map_Server.Actors return charaWork.parameterSave.state_mainSkill[0]; } + + public void hpstuff(uint hp) + { + SetMaxHP(hp); + SetHP(hp); + mpMaxBase = (ushort)hp; + charaWork.parameterSave.mpMax = (short)hp; + charaWork.parameterSave.mp = (short)hp; + AddTP(0); + //SendCharaExpInfo(); + //ActorPropertyPacketUtil exp = new ActorPropertyPacketUtil("charaWork/exp", this); + SetActorPropetyPacket hpInfo = new SetActorPropetyPacket("charaWork/exp"); + hpInfo.AddTarget(); + QueuePacket(hpInfo.BuildPacket(actorId)); + } + } } diff --git a/FFXIVClassic Map Server/actors/director/Director.cs b/FFXIVClassic Map Server/actors/director/Director.cs index 53eee828..04d1740f 100644 --- a/FFXIVClassic Map Server/actors/director/Director.cs +++ b/FFXIVClassic Map Server/actors/director/Director.cs @@ -103,7 +103,7 @@ namespace FFXIVClassic_Map_Server.actors.director List lparams = CallLuaScript("init", args2); - if (lparams.Count >= 1 && lparams[0].value is string) + if (lparams != null && lparams.Count >= 1 && lparams[0].value is string) { classPath = (string)lparams[0].value; className = classPath.Substring(classPath.LastIndexOf("/") + 1); @@ -270,6 +270,7 @@ namespace FFXIVClassic_Map_Server.actors.director { if (directorScript != null) { + directorScript = LuaEngine.LoadScript(String.Format(LuaEngine.FILEPATH_DIRECTORS, directorScriptPath)); if (!directorScript.Globals.Get(funcName).IsNil()) { DynValue result = directorScript.Call(directorScript.Globals[funcName], args); diff --git a/FFXIVClassic Map Server/actors/group/ContentGroup.cs b/FFXIVClassic Map Server/actors/group/ContentGroup.cs index 4370f1c4..bebeb49c 100644 --- a/FFXIVClassic Map Server/actors/group/ContentGroup.cs +++ b/FFXIVClassic Map Server/actors/group/ContentGroup.cs @@ -49,7 +49,7 @@ namespace FFXIVClassic_Map_Server.actors.group { if (actor == null) return; - + members.Add(actor.actorId); if (actor is Character) diff --git a/FFXIVClassic Map Server/actors/quest/Quest.cs b/FFXIVClassic Map Server/actors/quest/Quest.cs index 17a2e292..109f8570 100644 --- a/FFXIVClassic Map Server/actors/quest/Quest.cs +++ b/FFXIVClassic Map Server/actors/quest/Quest.cs @@ -93,7 +93,7 @@ namespace FFXIVClassic_Map_Server.Actors return false; } else - return (questFlags & (1 << bitIndex)) == (1 << bitIndex); + return (questFlags & (1 << bitIndex)) == (1 << bitIndex); } public uint GetPhase() diff --git a/FFXIVClassic Map Server/lua/LuaEngine.cs b/FFXIVClassic Map Server/lua/LuaEngine.cs index e2373967..7de47460 100644 --- a/FFXIVClassic Map Server/lua/LuaEngine.cs +++ b/FFXIVClassic Map Server/lua/LuaEngine.cs @@ -224,7 +224,7 @@ namespace FFXIVClassic_Map_Server.lua Program.Log.Error($"LuaEngine.CallLuaBattleCommandFunction [{functionName}] {e.Message}"); } DynValue res = new DynValue(); - + if (!script.Globals.Get(functionName).IsNil()) { res = script.Call(script.Globals.Get(functionName), args); @@ -234,7 +234,27 @@ namespace FFXIVClassic_Map_Server.lua } else { - Program.Log.Error($"LuaEngine.CallLuaBattleCommandFunction [{command.name}] Unable to find script {path}"); + path = $"./scripts/commands/{folder}/default.lua"; + //Program.Log.Error($"LuaEngine.CallLuaBattleCommandFunction [{command.name}] Unable to find script {path}"); + var script = LoadGlobals(); + + try + { + script.DoFile(path); + } + catch (Exception e) + { + Program.Log.Error($"LuaEngine.CallLuaBattleCommandFunction [{functionName}] {e.Message}"); + } + DynValue res = new DynValue(); + DynValue r = script.Globals.Get(functionName); + + if (!script.Globals.Get(functionName).IsNil()) + { + res = script.Call(script.Globals.Get(functionName), args); + if (res != null) + return (int)res.Number; + } } return -1; } @@ -461,6 +481,7 @@ namespace FFXIVClassic_Map_Server.lua Coroutine coroutine = script.CreateCoroutine(script.Globals[funcName]).Coroutine; DynValue value = coroutine.Resume(args2); ResolveResume(player, coroutine, value); + } else { diff --git a/FFXIVClassic Map Server/packets/send/Actor/battle/BattleActionX01Packet.cs b/FFXIVClassic Map Server/packets/send/Actor/battle/BattleActionX01Packet.cs index de771305..006a2740 100644 --- a/FFXIVClassic Map Server/packets/send/Actor/battle/BattleActionX01Packet.cs +++ b/FFXIVClassic Map Server/packets/send/Actor/battle/BattleActionX01Packet.cs @@ -25,6 +25,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle using (BinaryWriter binWriter = new BinaryWriter(mem)) { binWriter.Write((UInt32)sourceActorId); + binWriter.Write((UInt32)animationId); //Missing... last value is float, string in here as well? diff --git a/data/scripts/commands/gm/eaction.lua b/data/scripts/commands/gm/eaction.lua new file mode 100644 index 00000000..597c4952 --- /dev/null +++ b/data/scripts/commands/gm/eaction.lua @@ -0,0 +1,34 @@ +require("global"); + +properties = { + permissions = 0, + parameters = "s", + description = +[[ +Equips in the first open slot without checking if you can. +!eaction +]], +} + +function onTrigger(player, argc, commandid) + local sender = "[givegil] "; + + print(commandid); + if name then + if lastName then + player = GetWorldManager():GetPCInWorld(name.." "..lastName) or nil; + else + player = GetWorldManager():GetPCInWorld(name) or nil; + end; + end; + + if player then + classid = player:GetCurrentClassOrJob(); + commandid = tonumber(commandid) or 0; + + local added = player:EquipAbilityInFirstOpenSlot(classid, commandid); + + else + print(sender.."unable to add command, ensure player name is valid."); + end; +end; \ No newline at end of file diff --git a/data/scripts/commands/gm/setmaxhp.lua b/data/scripts/commands/gm/setmaxhp.lua new file mode 100644 index 00000000..5088680c --- /dev/null +++ b/data/scripts/commands/gm/setmaxhp.lua @@ -0,0 +1,33 @@ +require("global"); + +properties = { + permissions = 0, + parameters = "sss", + description = +[[ +Sets player or 's maximum hp to and heals them to full. +!setmaxhp | +!setmaxhp +]], +} + +function onTrigger(player, argc, hp, name, lastName) + local sender = "[setmaxhp] "; + + if name then + if lastName then + player = GetWorldManager():GetPCInWorld(name.." "..lastName) or nil; + else + player = GetWorldManager():GetPCInWorld(name) or nil; + end; + end; + + if player then + hp = tonumber(hp) or 1; + location = INVENTORY_CURRENCY; + + player:hpstuff(hp); + else + print(sender.."unable to add experience, ensure player name is valid."); + end; +end; \ No newline at end of file diff --git a/data/scripts/commands/gm/setmaxmp.lua b/data/scripts/commands/gm/setmaxmp.lua new file mode 100644 index 00000000..5088680c --- /dev/null +++ b/data/scripts/commands/gm/setmaxmp.lua @@ -0,0 +1,33 @@ +require("global"); + +properties = { + permissions = 0, + parameters = "sss", + description = +[[ +Sets player or 's maximum hp to and heals them to full. +!setmaxhp | +!setmaxhp +]], +} + +function onTrigger(player, argc, hp, name, lastName) + local sender = "[setmaxhp] "; + + if name then + if lastName then + player = GetWorldManager():GetPCInWorld(name.." "..lastName) or nil; + else + player = GetWorldManager():GetPCInWorld(name) or nil; + end; + end; + + if player then + hp = tonumber(hp) or 1; + location = INVENTORY_CURRENCY; + + player:hpstuff(hp); + else + print(sender.."unable to add experience, ensure player name is valid."); + end; +end; \ No newline at end of file diff --git a/data/scripts/commands/gm/yolo.lua b/data/scripts/commands/gm/yolo.lua new file mode 100644 index 00000000..34ad7d25 --- /dev/null +++ b/data/scripts/commands/gm/yolo.lua @@ -0,0 +1,178 @@ +require("global"); + +properties = { + permissions = 0, + parameters = "ssss", + description = +[[ +yolo +]], +} + +local quests = +{ + [111807] = { level = 25, weight = 4, rewardexp = 1080 }, + [110868] = { level = 50, weight = 4, rewardexp = 4400 }, + [111603] = { level = 22, weight = 5, rewardexp = 1100 }, + [111602] = { level = 22, weight = 5, rewardexp = 1100 }, + [111420] = { level = 45, weight = 5, rewardexp = 4450 }, + [110811] = { level = 18, weight = 6, rewardexp = 780 }, + [110814] = { level = 18, weight = 6, rewardexp = 780 }, + [110707] = { level = 25, weight = 6, rewardexp = 1620 }, + [110682] = { level = 34, weight = 6, rewardexp = 3180 }, + [111202] = { level = 35, weight = 6, rewardexp = 3360 }, + [111222] = { level = 35, weight = 6, rewardexp = 3360 }, + [111302] = { level = 35, weight = 6, rewardexp = 3360 }, + [111223] = { level = 40, weight = 6, rewardexp = 4260 }, + [110819] = { level = 45, weight = 6, rewardexp = 5340 }, + [111224] = { level = 45, weight = 6, rewardexp = 5340 }, + [111225] = { level = 45, weight = 6, rewardexp = 5340 }, + [110867] = { level = 45, weight = 6, rewardexp = 5340 }, + [110869] = { level = 45, weight = 6, rewardexp = 5340 }, + [110708] = { level = 45, weight = 6, rewardexp = 5340 }, + [110627] = { level = 45, weight = 6, rewardexp = 5340 }, + [111434] = { level = 50, weight = 6, rewardexp = 6600 }, + [110850] = { level = 1, weight = 7, rewardexp = 40 }, + [110851] = { level = 1, weight = 7, rewardexp = 40 }, + [110841] = { level = 20, weight = 7, rewardexp = 1120 }, + [110642] = { level = 20, weight = 7, rewardexp = 1120 }, + [110840] = { level = 20, weight = 7, rewardexp = 1120 }, + [110727] = { level = 21, weight = 7, rewardexp = 1401 }, + [111221] = { level = 30, weight = 7, rewardexp = 2661 }, + [111241] = { level = 30, weight = 7, rewardexp = 2661 }, + [110687] = { level = 28, weight = 9, rewardexp = 2970 }, + [110016] = { level = 34, weight = 50, rewardexp = 26500 }, + [110017] = { level = 38, weight = 50, rewardexp = 32500 }, + [110019] = { level = 46, weight = 50, rewardexp = 46000 } +}; + +local expTable = { + 570, -- 1 + 700, + 880, + 1100, + 1500, + 1800, + 2300, + 3200, + 4300, + 5000, -- 10 + 5900, + 6800, + 7700, + 8700, + 9700, + 11000, + 12000, + 13000, + 15000, + 16000, -- 20 + 20000, + 22000, + 23000, + 25000, + 27000, + 29000, + 31000, + 33000, + 35000, + 38000, -- 30 + 45000, + 47000, + 50000, + 53000, + 56000, + 59000, + 62000, + 65000, + 68000, + 71000, -- 40 + 74000, + 78000, + 81000, + 85000, + 89000, + 92000, + 96000, + 100000, + 100000, + 110000 -- 50 +}; + +local commandCost = { + ["raise"] = 150, + ["cure"] = 40, + ["cura"] = 100, + ["curaga"] = 150, +}; +-- stone: (1, 9) (5, 12) (10, ) +-- cure: (1, 5) (5, 6) (10, ) +-- aero: (1, 9) (5, 12) (10, ) +-- protect: (1, 9) (5, 12) (10, ) +--[[ +function onTrigger(player, argc, id, level, weight) + id = tonumber(id) or 111807; + level = tonumber(level) or quests[id].level; + weight = tonumber(weight) or quests[id].weight; + local messageId = MESSAGE_TYPE_SYSTEM_ERROR; + local sender = "yolo"; + + if id == 1 then + return + end + local message = calcSkillPoint(player, level, weight); + if player then + player.SendMessage(messageId, sender, string.format("calculated %s | expected %s", message, quests[id].rewardexp)); + end; + printf("calculated %s | expected %s", message, quests[id].rewardexp); +end; +]] + +function onTrigger(player, argc, skillName, level) + local messageId = MESSAGE_TYPE_SYSTEM_ERROR; + local sender = "yolo"; + + if player then + if false then + local effectId = 223004; + + player.statusEffects.RemoveStatusEffect(effectId); + player.statusEffects.AddStatusEffect(effectId, 1, 0, 5); + return; + end; + + local pos = player:GetPos(); + local x = tonumber(pos[0]); + local y = tonumber(pos[1]); + local z = tonumber(pos[2]); + local rot = tonumber(pos[3]); + local zone = pos[4]; + + printf("%f %f %f", x, y, z); + --local x, y, z = player.GetPos(); + for i = 1, 1 do + + local actor = player.GetZone().SpawnActor(2207303, 'ass', x, y, z, rot, 0, 0, true ); + + --actor.FollowTarget(player, 3.2); + end; + return; + end + level = tonumber(level) or 1; + if player then + player.SendMessage(messageId, sender, string.format("name %s | cost %d | level %u", skillName, calculateCommandCost(player, skillName, level), level)); + end; +end; + +function calculateCommandCost(player, skillName, level) + if skillName and level and commandCost[skillName] then + return math.ceil((8000 + (level - 70) * 500) * (commandCost[skillName] * 0.001)); + end; + return 1; +end + +function calcSkillPoint(player, lvl, weight) + weight = weight / 100 + + return math.ceil(expTable[lvl] * weight) +end \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/chaos_thrust.lua b/data/scripts/commands/weaponskill/chaos_thrust.lua new file mode 100644 index 00000000..98ea45f1 --- /dev/null +++ b/data/scripts/commands/weaponskill/chaos_thrust.lua @@ -0,0 +1,26 @@ +require("global"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onSkillFinish(caster, target, skill, action) + local damage = math.random(100, 200); + + -- todo: populate a global script with statuses and modifiers + action.worldMasterTextId = 0x765D; + + -- todo: populate a global script with statuses and modifiers + -- magic.HandleAttackMagic(caster, target, spell, action) + -- action.effectId = bit32.bxor(0x8000000, spell.effectAnimation, 15636); + --action.effectId = bit32.bxor(0x8000000, spell.effectAnimation, 15636); + + if target.hateContainer then + target.hateContainer.UpdateHate(caster, damage); + end; + return damage; +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/default.lua b/data/scripts/commands/weaponskill/default.lua new file mode 100644 index 00000000..965bcb8d --- /dev/null +++ b/data/scripts/commands/weaponskill/default.lua @@ -0,0 +1,26 @@ +require("global"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onSkillFinish(caster, target, skill, action) + local damage = math.random(100, 200); + + -- todo: populate a global script with statuses and modifiers + action.worldMasterTextId = 0x765D; + + -- todo: populate a global script with statuses and modifiers + -- magic.HandleAttackMagic(caster, target, spell, action) + -- action.effectId = bit32.bxor(0x8000000, spell.effectAnimation, 15636); + action.effectId = bit32.bxor(0x8000000, skill.effectAnimation, 15636); + + if target.hateContainer then + target.hateContainer.UpdateHate(caster, damage); + end; + return damage; +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/doom_spike.lua b/data/scripts/commands/weaponskill/doom_spike.lua new file mode 100644 index 00000000..98ea45f1 --- /dev/null +++ b/data/scripts/commands/weaponskill/doom_spike.lua @@ -0,0 +1,26 @@ +require("global"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onSkillFinish(caster, target, skill, action) + local damage = math.random(100, 200); + + -- todo: populate a global script with statuses and modifiers + action.worldMasterTextId = 0x765D; + + -- todo: populate a global script with statuses and modifiers + -- magic.HandleAttackMagic(caster, target, spell, action) + -- action.effectId = bit32.bxor(0x8000000, spell.effectAnimation, 15636); + --action.effectId = bit32.bxor(0x8000000, spell.effectAnimation, 15636); + + if target.hateContainer then + target.hateContainer.UpdateHate(caster, damage); + end; + return damage; +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/dread_spike.lua b/data/scripts/commands/weaponskill/dread_spike.lua new file mode 100644 index 00000000..98ea45f1 --- /dev/null +++ b/data/scripts/commands/weaponskill/dread_spike.lua @@ -0,0 +1,26 @@ +require("global"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onSkillFinish(caster, target, skill, action) + local damage = math.random(100, 200); + + -- todo: populate a global script with statuses and modifiers + action.worldMasterTextId = 0x765D; + + -- todo: populate a global script with statuses and modifiers + -- magic.HandleAttackMagic(caster, target, spell, action) + -- action.effectId = bit32.bxor(0x8000000, spell.effectAnimation, 15636); + --action.effectId = bit32.bxor(0x8000000, spell.effectAnimation, 15636); + + if target.hateContainer then + target.hateContainer.UpdateHate(caster, damage); + end; + return damage; +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/feint.lua b/data/scripts/commands/weaponskill/feint.lua new file mode 100644 index 00000000..98ea45f1 --- /dev/null +++ b/data/scripts/commands/weaponskill/feint.lua @@ -0,0 +1,26 @@ +require("global"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onSkillFinish(caster, target, skill, action) + local damage = math.random(100, 200); + + -- todo: populate a global script with statuses and modifiers + action.worldMasterTextId = 0x765D; + + -- todo: populate a global script with statuses and modifiers + -- magic.HandleAttackMagic(caster, target, spell, action) + -- action.effectId = bit32.bxor(0x8000000, spell.effectAnimation, 15636); + --action.effectId = bit32.bxor(0x8000000, spell.effectAnimation, 15636); + + if target.hateContainer then + target.hateContainer.UpdateHate(caster, damage); + end; + return damage; +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/flat_blade.lua b/data/scripts/commands/weaponskill/flat_blade.lua new file mode 100644 index 00000000..fa1c4b1f --- /dev/null +++ b/data/scripts/commands/weaponskill/flat_blade.lua @@ -0,0 +1,26 @@ +require("global"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onSkillFinish(caster, target, skill, action) + local damage = math.random(100, 200); + + -- todo: populate a global script with statuses and modifiers + action.worldMasterTextId = 0x765D; + + -- todo: populate a global script with statuses and modifiers + -- magic.HandleAttackMagic(caster, target, spell, action) + -- action.effectId = bit32.bxor(0x8000000, spell.effectAnimation, 15636); + action.effectId = bit32.bxor(0x8000000, spell.effectAnimation, 15636); + + if target.hateContainer then + target.hateContainer.UpdateHate(caster, damage); + end; + return damage; +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/full_thrust.lua b/data/scripts/commands/weaponskill/full_thrust.lua new file mode 100644 index 00000000..98ea45f1 --- /dev/null +++ b/data/scripts/commands/weaponskill/full_thrust.lua @@ -0,0 +1,26 @@ +require("global"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onSkillFinish(caster, target, skill, action) + local damage = math.random(100, 200); + + -- todo: populate a global script with statuses and modifiers + action.worldMasterTextId = 0x765D; + + -- todo: populate a global script with statuses and modifiers + -- magic.HandleAttackMagic(caster, target, spell, action) + -- action.effectId = bit32.bxor(0x8000000, spell.effectAnimation, 15636); + --action.effectId = bit32.bxor(0x8000000, spell.effectAnimation, 15636); + + if target.hateContainer then + target.hateContainer.UpdateHate(caster, damage); + end; + return damage; +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/heavy_thrust.lua b/data/scripts/commands/weaponskill/heavy_thrust.lua new file mode 100644 index 00000000..9c72078a --- /dev/null +++ b/data/scripts/commands/weaponskill/heavy_thrust.lua @@ -0,0 +1,27 @@ +require("global"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onSkillFinish(caster, target, skill, action) + local damage = math.random(100, 200); + + -- todo: populate a global script with statuses and modifiers + action.worldMasterTextId = 0x765D; + + -- todo: populate a global script with statuses and modifiers + -- magic.HandleAttackMagic(caster, target, spell, action) + -- action.effectId = bit32.bxor(0x8000000, spell.effectAnimation, 15636); + + action.effectId = bit32.bxor(0x8000000, skill.effectAnimation, 15636); + + if target.hateContainer then + target.hateContainer.UpdateHate(caster, damage); + end; + return damage; +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/impulse_drive.lua b/data/scripts/commands/weaponskill/impulse_drive.lua new file mode 100644 index 00000000..98ea45f1 --- /dev/null +++ b/data/scripts/commands/weaponskill/impulse_drive.lua @@ -0,0 +1,26 @@ +require("global"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onSkillFinish(caster, target, skill, action) + local damage = math.random(100, 200); + + -- todo: populate a global script with statuses and modifiers + action.worldMasterTextId = 0x765D; + + -- todo: populate a global script with statuses and modifiers + -- magic.HandleAttackMagic(caster, target, spell, action) + -- action.effectId = bit32.bxor(0x8000000, spell.effectAnimation, 15636); + --action.effectId = bit32.bxor(0x8000000, spell.effectAnimation, 15636); + + if target.hateContainer then + target.hateContainer.UpdateHate(caster, damage); + end; + return damage; +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/leg_sweep.lua b/data/scripts/commands/weaponskill/leg_sweep.lua new file mode 100644 index 00000000..98ea45f1 --- /dev/null +++ b/data/scripts/commands/weaponskill/leg_sweep.lua @@ -0,0 +1,26 @@ +require("global"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onSkillFinish(caster, target, skill, action) + local damage = math.random(100, 200); + + -- todo: populate a global script with statuses and modifiers + action.worldMasterTextId = 0x765D; + + -- todo: populate a global script with statuses and modifiers + -- magic.HandleAttackMagic(caster, target, spell, action) + -- action.effectId = bit32.bxor(0x8000000, spell.effectAnimation, 15636); + --action.effectId = bit32.bxor(0x8000000, spell.effectAnimation, 15636); + + if target.hateContainer then + target.hateContainer.UpdateHate(caster, damage); + end; + return damage; +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/pummel.lua b/data/scripts/commands/weaponskill/pummel.lua new file mode 100644 index 00000000..98ea45f1 --- /dev/null +++ b/data/scripts/commands/weaponskill/pummel.lua @@ -0,0 +1,26 @@ +require("global"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onSkillFinish(caster, target, skill, action) + local damage = math.random(100, 200); + + -- todo: populate a global script with statuses and modifiers + action.worldMasterTextId = 0x765D; + + -- todo: populate a global script with statuses and modifiers + -- magic.HandleAttackMagic(caster, target, spell, action) + -- action.effectId = bit32.bxor(0x8000000, spell.effectAnimation, 15636); + --action.effectId = bit32.bxor(0x8000000, spell.effectAnimation, 15636); + + if target.hateContainer then + target.hateContainer.UpdateHate(caster, damage); + end; + return damage; +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/true_thrust.lua b/data/scripts/commands/weaponskill/true_thrust.lua new file mode 100644 index 00000000..965bcb8d --- /dev/null +++ b/data/scripts/commands/weaponskill/true_thrust.lua @@ -0,0 +1,26 @@ +require("global"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onSkillFinish(caster, target, skill, action) + local damage = math.random(100, 200); + + -- todo: populate a global script with statuses and modifiers + action.worldMasterTextId = 0x765D; + + -- todo: populate a global script with statuses and modifiers + -- magic.HandleAttackMagic(caster, target, spell, action) + -- action.effectId = bit32.bxor(0x8000000, spell.effectAnimation, 15636); + action.effectId = bit32.bxor(0x8000000, skill.effectAnimation, 15636); + + if target.hateContainer then + target.hateContainer.UpdateHate(caster, damage); + end; + return damage; +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/vorpal_thrust.lua b/data/scripts/commands/weaponskill/vorpal_thrust.lua new file mode 100644 index 00000000..98ea45f1 --- /dev/null +++ b/data/scripts/commands/weaponskill/vorpal_thrust.lua @@ -0,0 +1,26 @@ +require("global"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onSkillFinish(caster, target, skill, action) + local damage = math.random(100, 200); + + -- todo: populate a global script with statuses and modifiers + action.worldMasterTextId = 0x765D; + + -- todo: populate a global script with statuses and modifiers + -- magic.HandleAttackMagic(caster, target, spell, action) + -- action.effectId = bit32.bxor(0x8000000, spell.effectAnimation, 15636); + --action.effectId = bit32.bxor(0x8000000, spell.effectAnimation, 15636); + + if target.hateContainer then + target.hateContainer.UpdateHate(caster, damage); + end; + return damage; +end; \ No newline at end of file diff --git a/data/scripts/content/SimpleContent30010.lua b/data/scripts/content/SimpleContent30010.lua index d78c2935..3e3b72f9 100644 --- a/data/scripts/content/SimpleContent30010.lua +++ b/data/scripts/content/SimpleContent30010.lua @@ -1,25 +1,31 @@ +require ("global") function onCreate(starterPlayer, contentArea, director) + --papalymo = contentArea:SpawnActor(2290005, "papalymo", 365.89, 4.0943, -706.72, -0.718); + --yda = contentArea:SpawnActor(2290006, "yda", 365.266, 4.122, -700.73, 1.5659); + --yda = GetWorldManager().SpawnBattleNpcById(6, contentArea); + --papalymo = GetWorldManager().SpawnBattleNpcById(7, contentArea); + + --mob1 = GetWorldManager().SpawnBattleNpcById(3, contentArea); + --mob2 = GetWorldManager().SpawnBattleNpcById(4, contentArea); + --mob3 = GetWorldManager().SpawnBattleNpcById(5, contentArea); + ---yda:ChangeState(2); - papalymo = contentArea:SpawnActor(2290005, "papalymo", 365.89, 4.0943, -706.72, -0.718); - yda = contentArea:SpawnActor(2290006, "yda", 365.266, 4.122, -700.73, 1.5659); - yda:ChangeState(2); + --mob1 = contentArea:SpawnActor(2201407, "mob1", 374.427, 4.4, -698.711, -1.942); + --mob2 = contentArea:SpawnActor(2201407, "mob2", 375.377, 4.4, -700.247, -1.992); + --mob3 = contentArea:SpawnActor(2201407, "mob3", 375.125, 4.4, -703.591, -1.54); - mob1 = contentArea:SpawnActor(2201407, "mob1", 374.427, 4.4, -698.711, -1.942); - mob2 = contentArea:SpawnActor(2201407, "mob2", 375.377, 4.4, -700.247, -1.992); - mob3 = contentArea:SpawnActor(2201407, "mob3", 375.125, 4.4, -703.591, -1.54); + --openingStoper = contentArea:SpawnActor(1090384, "openingstoper", 356.09, 3.74, -701.62, -1.41); - openingStoper = contentArea:SpawnActor(1090384, "openingstoper", 356.09, 3.74, -701.62, -1.41); + --director:AddMember(starterPlayer); + --director:AddMember(director); +-- director:AddMember(papalymo); + --director:AddMember(yda); + --director:AddMember(mob1); + --director:AddMember(mob2); + --director:AddMember(mob3); - director:AddMember(starterPlayer); - director:AddMember(director); - director:AddMember(papalymo); - director:AddMember(yda); - director:AddMember(mob1); - director:AddMember(mob2); - director:AddMember(mob3); - - director:StartContentGroup(); + --director:StartContentGroup(); end diff --git a/data/scripts/directors/Quest/QuestDirectorMan0g001.lua b/data/scripts/directors/Quest/QuestDirectorMan0g001.lua index 81bf270e..e6dc16e3 100644 --- a/data/scripts/directors/Quest/QuestDirectorMan0g001.lua +++ b/data/scripts/directors/Quest/QuestDirectorMan0g001.lua @@ -14,44 +14,52 @@ function onCreateContentArea(players, director, contentArea, contentGroup) local worldManager = GetWorldManager(); - yshtola = GetWorldManager().SpawnBattleNpcById(6, contentArea); - stahlmann = GetWorldManager().SpawnBattleNpcById(7, contentArea); + yda = GetWorldManager().SpawnBattleNpcById(6, contentArea); + papalymo = GetWorldManager().SpawnBattleNpcById(7, contentArea); + + mob1 = GetWorldManager().SpawnBattleNpcById(3, contentArea); + mob2 = GetWorldManager().SpawnBattleNpcById(4, contentArea); + mob3 = GetWorldManager().SpawnBattleNpcById(5, contentArea); + + --papalymo = contentArea:SpawnActor(2290005, "papalymo", 365.89, 4.0943, -706.72, -0.718); + --yda = contentArea:SpawnActor(2290006, "yda", 365.266, 4.122, -700.73, 1.5659); + --yda:ChangeState(2); - mob1 = GetWorldManager().SpawnBattleNpcById(3, contentArea); - mob2 = GetWorldManager().SpawnBattleNpcById(4, contentArea); - mob3 = GetWorldManager().SpawnBattleNpcById(5, contentArea); + --mob1 = contentArea:SpawnActor(2201407, "mob1", 374.427, 4.4, -698.711, -1.942); + --mob2 = contentArea:SpawnActor(2201407, "mob2", 375.377, 4.4, -700.247, -1.992); + --mob3 = contentArea:SpawnActor(2201407, "mob3", 375.125, 4.4, -703.591, -1.54); + openingStoper = contentArea:SpawnActor(1090384, "openingstoper", 356.09, 3.74, -701.62, -1.41); + + local added = false; - for i = 0, players.Count do - local player = players[i]; - print("asses "..players.Count) + for player in players do if player.currentParty and not added then - print("shitness") - player.currentParty.members:Add(yshtola.actorId); - print("cunt") - player.currentParty.members:Add(stahlmann.actorId); - print("dickbag") + player.currentParty.members:Add(yda.actorId); + print("cunt"); + player.currentParty.members:Add(papalymo.actorId); + print("dickbag"); added = true; end; -- dont let player die + print("shittttt3"); player:SetMod(modifiersGlobal.MinimumHpLock, 1); - contentGroup:AddMember(player) - print("shittttt") - break + print("shittttt2"); + director:AddMember(player) + print("shittttt1"); + --GetWorldManager():DoZoneChangeContent(player, contentArea, 362.4087, 4, -703.8168, 1.5419, 16); end; print("shit") - contentGroup:AddMember(director); - print("shit2"); - contentGroup:AddMember(yshtola); - print("shit3") - contentGroup:AddMember(stahlmann); - print("shit4") - contentGroup:AddMember(mob1); - print("shit5") - contentGroup:AddMember(mob2); - print("shit6") - contentGroup:AddMember(mob3); + director:AddMember(director); + director:AddMember(yda); + director:AddMember(papalymo); + director:AddMember(mob1); + director:AddMember(mob2); + print("shit6") + director:AddMember(mob3); print("dicks") + + director:StartContentGroup(); end function onEventStarted(player, actor, triggerName) @@ -120,5 +128,4 @@ end function main(director, contentGroup) print("shitstain") onCreateContentArea(director:GetPlayerMembers(), director, director:GetZone(), contentGroup); - player:EndEvent(); end; \ No newline at end of file diff --git a/data/scripts/unique/fst0Battle03/PopulaceStandard/yda.lua b/data/scripts/unique/fst0Battle03/PopulaceStandard/yda.lua index a82963ad..0f4d5f7e 100644 --- a/data/scripts/unique/fst0Battle03/PopulaceStandard/yda.lua +++ b/data/scripts/unique/fst0Battle03/PopulaceStandard/yda.lua @@ -7,9 +7,10 @@ end function onEventStarted(player, npc, triggerName) man0g0Quest = player:GetQuest("Man0g0"); - + print("hi"); if (man0g0Quest ~= nil) then - + + print("hi2"); if (triggerName == "pushDefault") then callClientFunction(player, "delegateEvent", player, man0g0Quest, "processTtrNomal002", nil, nil, nil); elseif (triggerName == "talkDefault") then @@ -22,6 +23,7 @@ function onEventStarted(player, npc, triggerName) man0g0Quest:SaveData(); player:GetDirector("OpeningDirector"):onTalkEvent(player, npc); --Was she talked to after papalymo? + print("hi3"); else if (man0g0Quest:GetQuestFlag(MAN0G0_FLAG_MINITUT_DONE1) == true) then @@ -41,6 +43,7 @@ function onEventStarted(player, npc, triggerName) player:KickEvent(director, "noticeEvent", true); player:SetLoginDirector(director); + print("hi5"); GetWorldManager():DoZoneChangeContent(player, contentArea, 362.4087, 4, -703.8168, 1.5419, 16); return; else diff --git a/data/scripts/unique/fst0Town01/PopulaceStandard/serpent_private_hill.lua b/data/scripts/unique/fst0Town01/PopulaceStandard/serpent_private_hill.lua new file mode 100644 index 00000000..02e67d32 --- /dev/null +++ b/data/scripts/unique/fst0Town01/PopulaceStandard/serpent_private_hill.lua @@ -0,0 +1,7 @@ +require ("global") + +function onEventStarted(player, npc) + defaultFst = GetStaticActor("DftFst"); + callClientFunction(player, "delegateEvent", player, defaultFst, "defaultTalkWithSerpent_private_hill_001", nil, nil, nil); + player:endEvent(); +end \ No newline at end of file diff --git a/data/scripts/unique/fst0Town01/PopulaceStandard/task_board.lua b/data/scripts/unique/fst0Town01/PopulaceStandard/task_board.lua new file mode 100644 index 00000000..b7448428 --- /dev/null +++ b/data/scripts/unique/fst0Town01/PopulaceStandard/task_board.lua @@ -0,0 +1,7 @@ +require ("global") + +function onEventStarted(player, npc) + defaultFst = GetStaticActor("DftFst"); + callClientFunction(player, "delegateEvent", player, defaultFst, "defaultTalkWithTask_board_001", nil, nil, nil); + player:endEvent(); +end \ No newline at end of file diff --git a/data/scripts/unique/fst0Town01a/PopulaceStandard/gagaroon.lua b/data/scripts/unique/fst0Town01a/PopulaceStandard/gagaroon.lua new file mode 100644 index 00000000..19143bdf --- /dev/null +++ b/data/scripts/unique/fst0Town01a/PopulaceStandard/gagaroon.lua @@ -0,0 +1,7 @@ +require ("global") + +function onEventStarted(player, npc) + defaultFst = GetStaticActor("DftFst"); + callClientFunction(player, "delegateEvent", player, defaultFst, "defaultTalkWithGagaroon_001", nil, nil, nil); + player:endEvent(); +end \ No newline at end of file diff --git a/data/scripts/unique/fst0Town01a/PopulaceStandard/louisoix.lua b/data/scripts/unique/fst0Town01a/PopulaceStandard/louisoix.lua new file mode 100644 index 00000000..b0b08cd5 --- /dev/null +++ b/data/scripts/unique/fst0Town01a/PopulaceStandard/louisoix.lua @@ -0,0 +1,7 @@ +require ("global") + +function onEventStarted(player, npc) + defaultFst = GetStaticActor("DftFst"); + callClientFunction(player, "delegateEvent", player, defaultFst, "defaultTalkWithLouisoix_001", nil, nil, nil); + player:endEvent(); +end \ No newline at end of file diff --git a/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_carver.lua b/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_carver.lua new file mode 100644 index 00000000..0a24f7e7 --- /dev/null +++ b/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_carver.lua @@ -0,0 +1,7 @@ +require ("global") + +function onEventStarted(player, npc) + defaultFst = GetStaticActor("DftFst"); + callClientFunction(player, "delegateEvent", player, defaultFst, "defaultTalkWithSerpent_private_carver_001", nil, nil, nil); + player:endEvent(); +end \ No newline at end of file diff --git a/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_holmes.lua b/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_holmes.lua new file mode 100644 index 00000000..fc7c975d --- /dev/null +++ b/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_holmes.lua @@ -0,0 +1,7 @@ +require ("global") + +function onEventStarted(player, npc) + defaultFst = GetStaticActor("DftFst"); + callClientFunction(player, "delegateEvent", player, defaultFst, "defaultTalkWithSerpent_private_holmes_001", nil, nil, nil); + player:endEvent(); +end \ No newline at end of file diff --git a/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_kirk.lua b/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_kirk.lua new file mode 100644 index 00000000..c7b840aa --- /dev/null +++ b/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_kirk.lua @@ -0,0 +1,7 @@ +require ("global") + +function onEventStarted(player, npc) + defaultFst = GetStaticActor("DftFst"); + callClientFunction(player, "delegateEvent", player, defaultFst, "defaultTalkWithSerpent_private_kirk_001", nil, nil, nil); + player:endEvent(); +end \ No newline at end of file diff --git a/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_stone.lua b/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_stone.lua new file mode 100644 index 00000000..d6d2ff82 --- /dev/null +++ b/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_stone.lua @@ -0,0 +1,7 @@ +require ("global") + +function onEventStarted(player, npc) + defaultFst = GetStaticActor("DftFst"); + callClientFunction(player, "delegateEvent", player, defaultFst, "defaultTalkWithSerpent_private_stone_001", nil, nil, nil); + player:endEvent(); +end \ No newline at end of file diff --git a/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_white.lua b/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_white.lua new file mode 100644 index 00000000..d66e5dad --- /dev/null +++ b/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_white.lua @@ -0,0 +1,7 @@ +require ("global") + +function onEventStarted(player, npc) + defaultFst = GetStaticActor("DftFst"); + callClientFunction(player, "delegateEvent", player, defaultFst, "defaultTalkWithSerpent_private_white_001", nil, nil, nil); + player:endEvent(); +end \ No newline at end of file diff --git a/data/scripts/unique/sea0Town01a/PopulaceStandard/rubh_hob.lua b/data/scripts/unique/sea0Town01a/PopulaceStandard/rubh_hob.lua new file mode 100644 index 00000000..2b97c724 --- /dev/null +++ b/data/scripts/unique/sea0Town01a/PopulaceStandard/rubh_hob.lua @@ -0,0 +1,7 @@ +require ("global") + +function onEventStarted(player, npc) + defaultSea = GetStaticActor("DftSea"); + callClientFunction(player, "delegateEvent", player, defaultSea, "defaultTalkWithRubh_hob_001", nil, nil, nil); + player:endEvent(); +end \ No newline at end of file